本文整理匯總了Golang中github.com/cmu440/tribbler/rpc/storagerpc.GetServersReply類的典型用法代碼示例。如果您正苦於以下問題:Golang GetServersReply類的具體用法?Golang GetServersReply怎麽用?Golang GetServersReply使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了GetServersReply類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: GetServers
func (ss *storageServer) GetServers(args *storagerpc.GetServersArgs, reply *storagerpc.GetServersReply) error {
ss.dataLock.Lock()
defer ss.dataLock.Unlock()
if ss.nextNode == ss.numNodes {
reply.Status = storagerpc.OK
reply.Servers = ss.servers
} else {
reply.Status = storagerpc.NotReady
}
return nil
}
示例2: GetServers
func (ss *storageServer) GetServers(args *storagerpc.GetServersArgs, reply *storagerpc.GetServersReply) error {
if ss.serverReady == false {
reply.Status = storagerpc.NotReady
reply.Servers = nil
} else {
reply.Status = storagerpc.OK
reply.Servers = ss.nodeList
}
return nil
}
示例3: GetServers
func (ss *storageServer) GetServers(args *storagerpc.GetServersArgs, reply *storagerpc.GetServersReply) error {
// Reply with OK and servers only if all have connected
if ss.count == len(ss.servers) {
reply.Status = storagerpc.OK
reply.Servers = ss.servers
return nil
} else {
reply.Status = storagerpc.NotReady
return nil
}
}
示例4: GetServers
func (ss *storageServer) GetServers(args *storagerpc.GetServersArgs, reply *storagerpc.GetServersReply) error {
if ss.storageServerReady {
reply.Status = storagerpc.OK
tmp := make([]storagerpc.Node, len(ss.nodesList), cap(ss.nodesList))
copy(tmp, ss.nodesList)
reply.Servers = tmp
} else {
reply.Status = storagerpc.NotReady
}
return nil
}
示例5: GetServers
func (ss *storageServer) GetServers(args *storagerpc.GetServersArgs, reply *storagerpc.GetServersReply) error {
//Will fix race condition after checkpoint
//ss.registerMapLock.Lock()
//defer ss.registerMapLock.Unlock()
if ss.nodeCount == ss.numNodes {
reply.Status = storagerpc.OK
reply.Servers = ss.ring
} else {
reply.Status = storagerpc.NotReady
reply.Servers = nil
}
return nil
}
示例6: GetServers
func (ss *storageServer) GetServers(args *storagerpc.GetServersArgs, reply *storagerpc.GetServersReply) error {
if !ss.isMaster {
return errors.New("I am not a master!")
}
ss.registerLocker.Lock()
defer ss.registerLocker.Unlock()
if ss.registerCnt == ss.numNodes {
reply.Status = storagerpc.OK
reply.Servers = ss.nodes
} else {
reply.Status = storagerpc.NotReady
reply.Servers = ss.nodes
}
return nil
}
示例7: GetServers
func (ss *storageServer) GetServers(args *storagerpc.GetServersArgs, reply *storagerpc.GetServersReply) error {
ss.serverMutex.Lock()
defer ss.serverMutex.Unlock()
if !ss.isMaster {
return errors.New("Error is not master server")
}
if ss.isReady {
reply.Servers = list2SliceNode(ss.serverList)
reply.Status = storagerpc.OK
} else {
reply.Servers = nil
reply.Status = storagerpc.NotReady
}
return nil
}
示例8: GetServers
func (ss *storageServer) GetServers(args *storagerpc.GetServersArgs, reply *storagerpc.GetServersReply) error {
if !ss.isMaster {
return errors.New("server is not a master")
}
ss.infoRWL.RLock()
defer ss.infoRWL.RUnlock()
if !ss.isReady {
reply.Status = storagerpc.NotReady
return nil
}
reply.Status = storagerpc.OK
for k := range ss.servers {
reply.Servers = append(reply.Servers, *ss.servers[k])
}
return nil
}
示例9: GetServers
// GetServers retrieves a list of all connected nodes in the ring. It
// replies with status NotReady if not all nodes in the ring have joined.
/// TODO this funcion might not need the mutex at all.
func (ss *storageServer) GetServers(args *storagerpc.GetServersArgs, reply *storagerpc.GetServersReply) error {
// fmt.Println("GetServer Called")
ss.rMutex.Lock()
defer ss.rMutex.Unlock()
if !ss.isMaster {
fmt.Println("!!!!!!!!! The get server is called in the slave node!!!")
}
if len(ss.ring) == ss.totalNode {
// if the connection is finished
reply.Servers = ss.ring
reply.Status = storagerpc.OK
//fmt.Println(reply.Servers);
} else {
reply.Status = storagerpc.NotReady
}
return nil
}