Documentation ¶
Index ¶
- Variables
- type Block
- type File
- type Host
- type HostPath
- type Seed
- func (sd *Seed) Add(host Host)
- func (sd *Seed) GetAllHosts() []Host
- func (sd *Seed) GetBlockIndex(host Host) []uint32
- func (sd *Seed) Localize(cmdSrcPath string, cmdDestPath string) (err error)
- func (sd *Seed) LocateBlock(blockId int64, n int) []Host
- func (sd *Seed) Remove(host Host)
- func (sd *Seed) TouchAll() (err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DefaultBlockSize int64 = 4 * 1024 * 1024
)
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct { Mode os.FileMode `json:"mode"` //Size of file, -1 for dir, -2 for symbol link Size int64 `json:"size"` //SymPath if symbol link target path SymPath string `json:"symPath"` Path string `json:"path"` LocalPath string `json:"-"` CheckSum []byte `json:"checkSum"` // contains filtered or unexported fields }
type Seed ¶
type Seed struct { sync.RWMutex Path string `json:"path"` FileCount int `json:"fileCount"` Files []*File `json:"files"` Blocks []*Block `json:"blocks"` BlockSize int64 `json:"blockSize"` VNodeCount uint8 `json:"vnodeCount"` // Hosts are only updated before Marshal Hosts []Host `json:"hosts"` //InitFileIdx int `json:"initFileIdx"` //InitBlockIdx int `json:"initBlockIdx"` TotalSize int64 `json:"totalSize"` TotalWritten int64 `json:"-"` }
func (*Seed) GetAllHosts ¶
func (*Seed) GetBlockIndex ¶
func (*Seed) LocateBlock ¶
LocateBlock tries to find maximum `n` different hosts for `blockId`. As the golang map is not deterministic on iteration, when multiple hosts hashed onto the same block the LocateBlock returned hosts are also not deterministic which is good for load balancing.
Click to show internal directories.
Click to hide internal directories.