Documentation ¶
Index ¶
- type BlockStore
- func (store *BlockStore) BlockCheckSum(block BlockID) (string, error)
- func (store *BlockStore) BlockMetaPath(blockID BlockID) string
- func (store *BlockStore) BlockSize(block types.BlockID) (int64, error)
- func (store *BlockStore) BlockStoragePath(block types.BlockID) string
- func (store *BlockStore) BlocksDirectory() string
- func (store *BlockStore) DeleteBlock(block types.BlockID) error
- func (store *BlockStore) ListBlocks() ([]types.BlockID, error)
- func (store *BlockStore) MetaDirectory() string
- func (store *BlockStore) ReadBlock(block types.BlockID, w io.Writer) error
- func (store *BlockStore) ReadMeta(block BlockID) (*BlockHeader, error)
- func (store *BlockStore) Utilization() int64
- func (store *BlockStore) WriteBlock(block types.BlockID, size int64, r io.Reader) (string, error)
- func (store *BlockStore) WriteMeta(block *BlockHeader, checksum string) error
- type ChunkRPC
- type ChunkServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockStore ¶
type BlockStore struct {
DataDir string
}
BlockStore is a block storage manage object.
func NewBlockStore ¶
func NewBlockStore(directory string) *BlockStore
NewBlockStore returns a new store with given data directory.
func (*BlockStore) BlockCheckSum ¶
func (store *BlockStore) BlockCheckSum(block BlockID) (string, error)
BlockCheckSum returns block's checksum data, calculate using crc32.
func (*BlockStore) BlockMetaPath ¶
func (store *BlockStore) BlockMetaPath(blockID BlockID) string
BlockMetaPath returns absolute path of specified block's checksum data.
func (*BlockStore) BlockSize ¶
func (store *BlockStore) BlockSize(block types.BlockID) (int64, error)
BlockSize return bytes size of block.
func (*BlockStore) BlockStoragePath ¶
func (store *BlockStore) BlockStoragePath(block types.BlockID) string
BlockStoragePath returns absolute storage path of specified block.
func (*BlockStore) BlocksDirectory ¶
func (store *BlockStore) BlocksDirectory() string
BlocksDirectory returns blocks storage directory path.
func (*BlockStore) DeleteBlock ¶
func (store *BlockStore) DeleteBlock(block types.BlockID) error
func (*BlockStore) ListBlocks ¶
func (store *BlockStore) ListBlocks() ([]types.BlockID, error)
ListBlocks returns all blocks' id in current block store data directory.
func (*BlockStore) MetaDirectory ¶
func (store *BlockStore) MetaDirectory() string
MetaDirectory returns block's metadata storage path.
func (*BlockStore) ReadMeta ¶
func (store *BlockStore) ReadMeta(block BlockID) (*BlockHeader, error)
ReadChecksum reads block's checksum data from its storage path.
func (*BlockStore) Utilization ¶
func (store *BlockStore) Utilization() int64
Utilization returns total disk usage of store data directory.
func (*BlockStore) WriteBlock ¶
WriteBlock write block data from given io reader to storage file and return its checksum.
func (*BlockStore) WriteMeta ¶
func (store *BlockStore) WriteMeta(block *BlockHeader, checksum string) error
type ChunkRPC ¶
type ChunkRPC struct {
// contains filtered or unexported fields
}
func NewChunkRPC ¶
func NewChunkRPC(blockStore *BlockStore, blockSyncDone chan *BlockHeader) *ChunkRPC
func (*ChunkRPC) Read ¶
func (c *ChunkRPC) Read(blockID BlockID, reply *communication.BlockMessage) error
type ChunkServer ¶
type ChunkServer struct { NodeID NodeID Addr string MasterAddr string RPCPort int // contains filtered or unexported fields }
ChunkServer is the slave node which store data blocks.
func NewChunkServer ¶
func NewChunkServer(config *Config) *ChunkServer
NewChunkServer returns a server which store data.
func (*ChunkServer) Heartbeat ¶
func (chunk *ChunkServer) Heartbeat()
Heartbeat send chunk server's heart according to an interval.
func (*ChunkServer) ListenRPC ¶
func (c *ChunkServer) ListenRPC()
ListenRPC setup a RPC server on chunk node.
func (*ChunkServer) Run ¶
func (chunk *ChunkServer) Run()
Run methods run up all necessary goroutines.