Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( FileInQueue = FileStatus(0) FileWriting = FileStatus(1) FileSync = FileStatus(2) FileOK = FileStatus(3) FileDelete = FileStatus(4) )
View Source
var ( Healthy = NodeStatus(0) Unhealthy = NodeStatus(1) )
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { ID BlockID Header *BlockHeader // metadata Data []byte // contents of this block }
Block is storage unit of each file
type BlockHeader ¶
type BlockHeader struct { BlockID BlockID `json:"block_id"` FileID FileID `json:"file_id"` Chunk NodeID `json:"chunk"` Checksum string `json:"checksum"` Filename string `json:"filenam"` Size int64 `json:"size"` }
BlockHeaders holds Block metadata
type File ¶
type File struct { ID FileID Name string Length int64 Replications int Createtime time.Time Status FileStatus Blocks map[BlockID]*BlockHeader }
type FileStatus ¶
type FileStatus int
type Node ¶
type Node struct { ID NodeID Addr string Blocks []BlockID Connections int Heath NodeStatus LastHeartbeat time.Time LastUtilization int64 }
func NewInitialNode ¶
NewInitialNode return a whole new node with initial information.
func (*Node) HeartbeatDuration ¶
HeartbeatDuration compute the duration between last heartbeat and now.
type NodeStatus ¶
type NodeStatus int
type UUID ¶
type UUID [16]byte
UUID type.
func FromStr ¶
FromStr returns a UUID based on a string. The string could be in the following format:
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
If the string is not in one of these formats, it'll return an error.
func MustFromStr ¶
MustFromStr behaves similarly to FromStr except that it'll panic instead of returning an error.
Click to show internal directories.
Click to hide internal directories.