當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。