Documentation ¶
Index ¶
- Constants
- func NodeKey(account string) string
- func NodeOccupyNameKey(name string) string
- func NodeOccupyPidKey(pid string) string
- func NodeTypeKey(typ string) string
- func NvpNodeNameKey(name string) string
- func VpNodeIdKey(id string) string
- func VpNodePidKey(pid string) string
- type Node
- type NodeManager
- func (nm *NodeManager) All(_ []byte) (interface{}, error)
- func (nm *NodeManager) Bind(nodeAccount, auditAdminAddr string) (bool, []byte)
- func (nm *NodeManager) ChangeStatus(nodeAccount string, trigger, lastStatus string, _ []byte) (bool, []byte)
- func (nm *NodeManager) CountAll(nodeType []byte) (bool, []byte)
- func (nm *NodeManager) CountAvailable(nodeType []byte) (bool, []byte)
- func (nm *NodeManager) GetAccountByName(name string) (string, error)
- func (nm *NodeManager) GetAccountByPid(pid string) (string, error)
- func (nm *NodeManager) GetAccountByVpId(vpNodeId string) (string, error)
- func (nm *NodeManager) GetAccountMapByType(typ string) *orderedmap.OrderedMap
- func (nm *NodeManager) GovernancePre(nodeAccount string, event governance.EventType, _ []byte) (interface{}, *boltvm.BxhError)
- func (nm *NodeManager) QueryById(nodeAccount string, _ []byte) (interface{}, error)
- func (nm *NodeManager) Register(node *Node)
- func (nm *NodeManager) RegisterPre(node *Node)
- func (nm *NodeManager) Update(nodeInfo *Node) (bool, []byte)
- type NodeMgr
- type NodeType
Constants ¶
View Source
const ( NODEPREFIX = "node" NODETYPE_PREFIX = "type" VP_NODE_ID_PREFIX = "vp-id" VP_NODE_PID_PREFIX = "vp-pid" NVP_NODE_NAME_PREFIX = "nvp-name" NODE_OCCUPY_PID_PREFIX = "occupy-node-pid" NODE_OCCUPY_NAME_PREFIX = "occupy-node-name" VPNode NodeType = "vpNode" NVPNode NodeType = "nvpNode" )
Variables ¶
This section is empty.
Functions ¶
func NodeOccupyNameKey ¶
func NodeOccupyPidKey ¶
func NodeTypeKey ¶
func NvpNodeNameKey ¶
func VpNodeIdKey ¶
func VpNodePidKey ¶
Types ¶
type Node ¶
type Node struct { Account string `toml:"account" json:"account"` NodeType NodeType `toml:"node_type" json:"node_type"` // VP Node Info Pid string `toml:"pid" json:"pid"` VPNodeId uint64 `toml:"id" json:"id"` Primary bool `toml:"primary" json:"primary"` // NVP Node Name string `toml:"name" json:"name"` Permissions map[string]struct{} `toml:"permissions" json:"permissions"` AuditAdminAddr string `toml:"audit_admin_addr" json:"audit_admin_addr"` Status governance.GovernanceStatus `toml:"status" json:"status"` FSM *fsm.FSM `json:"fsm"` }
func (*Node) IsAvailable ¶
type NodeManager ¶
type NodeManager struct {
governance.Persister
}
func (*NodeManager) All ¶
func (nm *NodeManager) All(_ []byte) (interface{}, error)
All returns all nodes
func (*NodeManager) Bind ¶
func (nm *NodeManager) Bind(nodeAccount, auditAdminAddr string) (bool, []byte)
func (*NodeManager) ChangeStatus ¶
func (*NodeManager) CountAvailable ¶
func (nm *NodeManager) CountAvailable(nodeType []byte) (bool, []byte)
CountAvailable counts all available nodes (available、logouting)
func (*NodeManager) GetAccountByName ¶
func (nm *NodeManager) GetAccountByName(name string) (string, error)
func (*NodeManager) GetAccountByPid ¶
func (nm *NodeManager) GetAccountByPid(pid string) (string, error)
func (*NodeManager) GetAccountByVpId ¶
func (nm *NodeManager) GetAccountByVpId(vpNodeId string) (string, error)
func (*NodeManager) GetAccountMapByType ¶
func (nm *NodeManager) GetAccountMapByType(typ string) *orderedmap.OrderedMap
func (*NodeManager) GovernancePre ¶
func (nm *NodeManager) GovernancePre(nodeAccount string, event governance.EventType, _ []byte) (interface{}, *boltvm.BxhError)
GovernancePre checks if the appchain can do the event. (only check, not modify infomation) return *node, extra info, error
func (*NodeManager) QueryById ¶
func (nm *NodeManager) QueryById(nodeAccount string, _ []byte) (interface{}, error)
func (*NodeManager) Register ¶
func (nm *NodeManager) Register(node *Node)
Register record node info
func (*NodeManager) RegisterPre ¶
func (nm *NodeManager) RegisterPre(node *Node)
type NodeMgr ¶
type NodeMgr interface { governance.Governance // Register registers node info, return node id and error RegisterPre(node *Node) Register(node *Node) Update(nodeInfo *Node) (bool, []byte) Bind(nodeAccount, auditAdminAddr string) (bool, []byte) GetAccountMapByType(typ string) *orderedmap.OrderedMap GetAccountByVpId(vpNodeId string) (string, error) GetAccountByPid(pid string) (string, error) GetAccountByName(name string) (string, error) }
func New ¶
func New(persister governance.Persister) NodeMgr
Click to show internal directories.
Click to hide internal directories.