Documentation ¶
Index ¶
- type CodeMode
- type CodeModeName
- type Policy
- type Tactic
- func (c *Tactic) AllLocalStripe() (stripes [][]int, n, m int)
- func (c *Tactic) GetECLayoutByAZ() (azStripes [][]int)
- func (c *Tactic) GlobalStripe() (indexes []int, n, m int)
- func (c *Tactic) IsValid() bool
- func (c *Tactic) LocalStripe(index int) (localStripe []int, n, m int)
- func (c *Tactic) LocalStripeInAZ(azIndex int) (localStripe []int, n, m int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CodeMode ¶
type CodeMode uint8
CodeMode EC encode and decode mode
const ( EC15P12 CodeMode = 1 EC6P6 CodeMode = 2 EC16P20L2 CodeMode = 3 EC6P10L2 CodeMode = 4 EC6P3L3 CodeMode = 5 EC6P6Align0 CodeMode = 6 EC6P6Align512 CodeMode = 7 EC4P4L2 CodeMode = 8 EC12P4 CodeMode = 9 EC16P4 CodeMode = 10 EC3P3 CodeMode = 11 EC10P4 CodeMode = 12 EC6P3 CodeMode = 13 EC12P9 CodeMode = 14 // for test EC6P6L9 CodeMode = 200 EC6P8L10 CodeMode = 201 )
pre-defined mode
func GetAllCodeModes ¶
func GetAllCodeModes() []CodeMode
GetAllCodeModes get all the available CodeModes
func (CodeMode) GetShardNum ¶
GetShardNum returns all shards number.
type CodeModeName ¶
type CodeModeName string
func (CodeModeName) GetCodeMode ¶
func (cn CodeModeName) GetCodeMode() CodeMode
GetCodeMode get the code mode by name
func (CodeModeName) IsValid ¶
func (cn CodeModeName) IsValid() bool
IsValid check the CodeMode is valid by Name
func (CodeModeName) Tactic ¶
func (cn CodeModeName) Tactic() Tactic
Tactic get tactic by code mode name
type Policy ¶
type Policy struct { ModeName CodeModeName `json:"mode_name"` // min size of object, access use this to put object MinSize int64 `json:"min_size"` // max size of object. access use this to put object MaxSize int64 `json:"max_size"` // code mode's cluster space size ratio, clusterMgr should use this to create specified num of volume SizeRatio float64 `json:"size_ratio"` // enable means this kind of code mode enable or not // access/allocator will ignore this kind of code mode's allocation when enable is false // clustermgr will ignore this kind of code mode's creation when enable is false Enable bool `json:"enable"` }
Policy will be used to adjust code mode's upload range or code mode's volume ratio and so on
type Tactic ¶
type Tactic struct { N int M int // local parity count L int // the count of AZ, access use this for split data shards and parity shards AZCount int // PutQuorum write quorum, // MUST make sure that ec data is recoverable if one AZ was down // We SHOULD ignore the local shards // (N + M) / AZCount + N <= PutQuorum <= M + N PutQuorum int // get quorum config GetQuorum int // MinShardSize min size per shard, fill data into shards 0-N continuously, // align with zero bytes if data size less than MinShardSize*N // // length of data less than MinShardSize*N, size of per shard = MinShardSize // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // | data | align zero bytes | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // | 0 | 1 | 2 | .... | N | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // // length of data more than MinShardSize*N, size of per shard = ceil(len(data)/N) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // | data |padding| // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // | 0 | 1 | 2 | .... | N | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MinShardSize int }
Tactic constant strategy of one CodeMode
func (*Tactic) AllLocalStripe ¶
AllLocalStripe returns all local stripes
func (*Tactic) GetECLayoutByAZ ¶
GetECLayoutByAZ ec layout by AZ
func (*Tactic) GlobalStripe ¶
GlobalStripe returns initial stripe return name.GetCodeMode().Tactic()
func (*Tactic) LocalStripe ¶
LocalStripe get local stripe by index
Click to show internal directories.
Click to hide internal directories.