本文整理汇总了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
}