chunk

package
v0.0.0-...-f617e85 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2016 License: MIT Imports: 17 Imported by: 2

Documentation

Index

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) ReadBlock

func (store *BlockStore) ReadBlock(block types.BlockID, w io.Writer) error

ReadBlock read block data from storage file to io writer.

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

func (store *BlockStore) WriteBlock(block types.BlockID, size int64, r io.Reader) (string, error)

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

func (*ChunkRPC) Sync

func (c *ChunkRPC) Sync(block Block, checksum *string) error

func (*ChunkRPC) Write

func (c *ChunkRPC) Write(block Block, checksum *string) 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL