当前位置: 首页>>代码示例>>Golang>>正文


Golang storagerpc.GetServersReply类代码示例

本文整理汇总了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
}
开发者ID:aditij1,项目名称:p2aditijakkamat,代码行数:11,代码来源:storageserver_impl.go

示例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
}
开发者ID:oldady,项目名称:Tribbler,代码行数:11,代码来源:storageserver_impl.go

示例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
	}
}
开发者ID:pyurky,项目名称:p2,代码行数:12,代码来源:storageserver_impl.go

示例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
}
开发者ID:iedwardwangi,项目名称:Tribbler,代码行数:12,代码来源:storageserver_impl.go

示例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
}
开发者ID:jbuckman,项目名称:p2-440,代码行数:14,代码来源:storageserver_impl.go

示例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
}
开发者ID:mallocanswer,项目名称:Tribbler,代码行数:15,代码来源:storageserver_impl.go

示例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
}
开发者ID:thuhujin,项目名称:Tribbler,代码行数:15,代码来源:storageserver_impl.go

示例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
}
开发者ID:oldady,项目名称:ds_p2,代码行数:19,代码来源:storageserver_impl.go

示例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
}
开发者ID:wentianqi7,项目名称:15640-distributed-systems,代码行数:26,代码来源:storageserver_impl.go


注:本文中的github.com/cmu440/tribbler/rpc/storagerpc.GetServersReply类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。