Documentation ¶
Index ¶
- func SortBlockByFunc(f func(*BlockHeader) int, list []*BlockHeader) sort.Interface
- func SortNodeByFunc(f func(NodeID) int, list []NodeID) sort.Interface
- type BlockManager
- func (b *BlockManager) AddBlock(id FileID, block *BlockHeader)
- func (b *BlockManager) AddFile(file *File)
- func (b *BlockManager) DeleteBlock(id FileID, blockID BlockID)
- func (b *BlockManager) DeleteFile(id FileID)
- func (b *BlockManager) GetBlock(blockID BlockID) *BlockHeader
- func (b *BlockManager) GetFile(id FileID) *File
- func (b *BlockManager) HasBlock(blockID BlockID) bool
- func (b *BlockManager) ListFile() []*File
- func (b *BlockManager) UpdateFileStatus(id FileID, status FileStatus)
- type BlockSort
- type HTTPServer
- type Master
- type MasterRPC
- type NodeManager
- func (n *NodeManager) AddNode(node *Node)
- func (n *NodeManager) DeleteNode(nodeID NodeID)
- func (n *NodeManager) GetNode(id NodeID) *Node
- func (n *NodeManager) LeastBlocksNodes() []NodeID
- func (n *NodeManager) LeastConnectionNodes() []NodeID
- func (n *NodeManager) ListNode() []*Node
- func (n *NodeManager) LostNode(node *Node, blockManager *BlockManager)
- func (n *NodeManager) ReRegisterChunkNode(addr string, id NodeID)
- func (n *NodeManager) RegisterChunkNode(addr string) NodeID
- func (n *NodeManager) UpdateNode(node *Node)
- func (n *NodeManager) UpdateNodeWithHeartbeat(message comm.HeartbeatMessage)
- type NodeSort
- type ReplicationController
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SortBlockByFunc ¶
func SortNodeByFunc ¶
Types ¶
type BlockManager ¶
type BlockManager struct {
// contains filtered or unexported fields
}
func NewBlockManager ¶
func NewBlockManager() *BlockManager
func (*BlockManager) AddBlock ¶
func (b *BlockManager) AddBlock(id FileID, block *BlockHeader)
func (*BlockManager) AddFile ¶
func (b *BlockManager) AddFile(file *File)
func (*BlockManager) DeleteBlock ¶
func (b *BlockManager) DeleteBlock(id FileID, blockID BlockID)
func (*BlockManager) DeleteFile ¶
func (b *BlockManager) DeleteFile(id FileID)
func (*BlockManager) GetBlock ¶
func (b *BlockManager) GetBlock(blockID BlockID) *BlockHeader
func (*BlockManager) GetFile ¶
func (b *BlockManager) GetFile(id FileID) *File
func (*BlockManager) HasBlock ¶
func (b *BlockManager) HasBlock(blockID BlockID) bool
func (*BlockManager) ListFile ¶
func (b *BlockManager) ListFile() []*File
func (*BlockManager) UpdateFileStatus ¶
func (b *BlockManager) UpdateFileStatus(id FileID, status FileStatus)
type BlockSort ¶
type BlockSort struct { Func func(*BlockHeader) int // contains filtered or unexported fields }
type HTTPServer ¶
func NewHTTPServer ¶
func NewHTTPServer(host string, port int, blockManager *BlockManager, nodeManager *NodeManager) *HTTPServer
func (*HTTPServer) Addr ¶
func (server *HTTPServer) Addr() string
func (*HTTPServer) AddrWithScheme ¶
func (server *HTTPServer) AddrWithScheme() string
func (*HTTPServer) ListenAndServe ¶
func (server *HTTPServer) ListenAndServe()
type Master ¶
type Master struct { RPCPort int // contains filtered or unexported fields }
Master node controllers all metadata of the whole cluster.
type MasterRPC ¶
type MasterRPC struct {
// contains filtered or unexported fields
}
func NewMasterRPC ¶
func NewMasterRPC(nodeManager *NodeManager, blockManager *BlockManager, replicationController *ReplicationController) *MasterRPC
func (*MasterRPC) Heartbeat ¶
func (c *MasterRPC) Heartbeat(message comm.HeartbeatMessage, reply *comm.HeartbeatResponse) error
type NodeManager ¶
type NodeManager struct {
// contains filtered or unexported fields
}
func NewNodeManager ¶
func NewNodeManager() *NodeManager
func (*NodeManager) AddNode ¶
func (n *NodeManager) AddNode(node *Node)
func (*NodeManager) DeleteNode ¶
func (n *NodeManager) DeleteNode(nodeID NodeID)
func (*NodeManager) GetNode ¶
func (n *NodeManager) GetNode(id NodeID) *Node
func (*NodeManager) LeastBlocksNodes ¶
func (n *NodeManager) LeastBlocksNodes() []NodeID
func (*NodeManager) LeastConnectionNodes ¶
func (n *NodeManager) LeastConnectionNodes() []NodeID
func (*NodeManager) ListNode ¶
func (n *NodeManager) ListNode() []*Node
func (*NodeManager) LostNode ¶
func (n *NodeManager) LostNode(node *Node, blockManager *BlockManager)
LostNode wipe a node from healthy node.
func (*NodeManager) ReRegisterChunkNode ¶
func (n *NodeManager) ReRegisterChunkNode(addr string, id NodeID)
ReRegisterChunkNode re-register a lost node to node manager.
func (*NodeManager) RegisterChunkNode ¶
func (n *NodeManager) RegisterChunkNode(addr string) NodeID
RegisterChunkNode generate universal unique id for a chunk node and register this node. to master's map.
func (*NodeManager) UpdateNode ¶
func (n *NodeManager) UpdateNode(node *Node)
func (*NodeManager) UpdateNodeWithHeartbeat ¶
func (n *NodeManager) UpdateNodeWithHeartbeat(message comm.HeartbeatMessage)
UpdateNodeWithHeartbeat update node information with heartbeat message.
type NodeSort ¶
type NodeSort struct { Func func(NodeID) int // contains filtered or unexported fields }
type ReplicationController ¶
type ReplicationController struct {
// contains filtered or unexported fields
}
func NewReplicationController ¶
func NewReplicationController(defaultReplication int) *ReplicationController
func (*ReplicationController) Replicate ¶
func (rc *ReplicationController) Replicate(blockManager *BlockManager, nodeManager *NodeManager, blocks []BlockID) []*SyncBlock
Click to show internal directories.
Click to hide internal directories.