github.com/geniusesgroup/libgo@v0.0.0-20220713101832-828057a9d3d4/protocol/node.go (about) 1 /* For license and copyright information please see LEGAL file in repository */ 2 3 package protocol 4 5 // Cluster store application nodes data and ready to return in many ways. 6 type Cluster interface { 7 LocalNode() ApplicationNode 8 ReplicatedLocalNode() []ApplicationNode 9 10 GetReplicatedNodes(node ApplicationNode) []ApplicationNode 11 GetNodeByID(nodeID uint64) ApplicationNode 12 GetNodeByObjectID(id [32]byte) (node ApplicationNode, err Error) 13 } 14 15 type ApplicationNode interface { 16 Type() NodeType 17 ID() [16]byte // as InstanceID 18 DataCenterID() [16]byte // orgID 19 ThingID() [16]byte 20 ReplicationID() uint8 21 StorageCapacity() uint64 // In bytes, Max 16EB(Exabyte) that more enough for one node capacity. 0 means service only node. 22 Conn() Connection 23 Status() ApplicationState 24 Stats() 25 } 26 27 type NodeType uint8 28 29 const ( 30 Node_Unset NodeType = iota 31 Node_Cloud 32 Node_Edge 33 )