Documentation ¶
Index ¶
- type NodeData
- type PoolData
- type SignedField
- type SignedList
- type State
- func (s *State) GetJSON() ([]byte, error)
- func (s *State) GetNodeField(address, key string) interface{}
- func (s *State) GetNodeFields(key string) []interface{}
- func (s *State) GetNodeFieldsMap(key string) map[string]interface{}
- func (s *State) GetPoolField(key string) interface{}
- func (s *State) GetSignatureList() []*signature.SignedMessage
- func (s *State) UpdateState(sm *signature.SignedMessage) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NodeData ¶
type NodeData struct { IPAddress SignedField `json:"ip_address"` ContentPort SignedField `json:"content_port"` LastHeartbeat SignedField `json:"last_heartbeat"` DiskContent SignedList `json:"disk_content"` }
NodeData is a type that stores infomration about an indiviudal node
type PoolData ¶
type PoolData struct {
RequiredContent SignedList `json:"required_content"`
}
PoolData is a type that stores information about the pool
type SignedField ¶
type SignedField struct { Data interface{} `json:"data"` SignedMessage *signature.SignedMessage `json:"signed_message"` }
SignedField is a type that represents a string field that includes the signature that last updated it
type SignedList ¶
type SignedList struct { Data []string `json:"data"` SignedMessage *signature.SignedMessage `json:"signed_message"` }
SignedList is a type that represents a list of string fields and includes the signature that last updated it
type State ¶
type State struct { PoolData *PoolData `json:"pool_data"` NodeDataMap map[string]*NodeData `json:"node_data_map"` // contains filtered or unexported fields }
State is a type that represents the network state
func ParseNetworkState ¶
ParseNetworkState takes the network state json string in and returns a state type if it is valid.
func (*State) GetNodeField ¶
func (*State) GetNodeFields ¶
GetNodeFields gets the same field from all nodes
func (*State) GetNodeFieldsMap ¶
GetNodeFieldsMap gets a map of node address to that field
func (*State) GetPoolField ¶
GetPoolField gets the field name from the pool
func (*State) GetSignatureList ¶
func (s *State) GetSignatureList() []*signature.SignedMessage
GetSignatureList returns a list of all of the signed messages used to make the current state
func (*State) UpdateState ¶
func (s *State) UpdateState(sm *signature.SignedMessage) error
UpdateState updates the local state with the signed message information