Documentation ¶
Index ¶
- func EncodeLevel(span []byte, level Level)
- func GetReplicaCounts() [5]int
- func IsLevelEncoded(span []byte) bool
- func SetLevelInContext(ctx context.Context, level Level) context.Context
- type ErasureEncoder
- type Level
- type Params
- func (p *Params) ChunkWrite(chunkLevel int, data []byte, callback ParityChunkCallback) error
- func (p *Params) ElevateCarrierChunk(chunkLevel int, callback ParityChunkCallback) error
- func (p *Params) Encode(chunkLevel int, callback ParityChunkCallback) error
- func (p *Params) GetRootData() ([]byte, error)
- func (p *Params) Level() Level
- func (p *Params) MaxShards() int
- func (p *Params) Parities(shards int) int
- type ParityChunkCallback
- type RedundancyParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeLevel ¶
EncodeLevel encodes used redundancy level for uploading into span keeping the real byte count for the chunk. assumes span is LittleEndian
func GetReplicaCounts ¶
func GetReplicaCounts() [5]int
GetReplicaCounts returns back the ascending dispersed replica counts for all redundancy levels
func IsLevelEncoded ¶
IsLevelEncoded checks whether the redundancy level is encoded in the span assumes span is LittleEndian
Types ¶
type ErasureEncoder ¶
type Level ¶
type Level uint8
Level is the redundancy level which carries information about how much redundancy should be added to data to remain retrievable with a 1-10^(-6) certainty in different groups of expected chunk retrieval error rates (level values)
func DecodeSpan ¶
DecodeSpan decodes the used redundancy level from span keeping the real byte count for the chunk. assumes span is LittleEndian
func GetLevelFromContext ¶
GetLevelFromContext is a helper function to extract the redundancy level from the context
func (Level) GetEncParities ¶
GetEncParities returns number of parities for encrypted chunks based on appendix F table 6
func (Level) GetMaxEncShards ¶
GetMaxEncShards returns back the maximum number of effective encrypted data chunks
func (Level) GetMaxShards ¶
GetMaxShards returns back the maximum number of effective data chunks
func (Level) GetParities ¶
GetParities returns number of parities based on appendix F table 5
func (Level) GetReplicaCount ¶
GetReplicaCount returns back the dispersed replica number
type Params ¶
type Params struct {
// contains filtered or unexported fields
}
func (*Params) ChunkWrite ¶
func (p *Params) ChunkWrite(chunkLevel int, data []byte, callback ParityChunkCallback) error
ChunkWrite caches the chunk data on the given chunk level and if it is full then it calls Encode
func (*Params) ElevateCarrierChunk ¶
func (p *Params) ElevateCarrierChunk(chunkLevel int, callback ParityChunkCallback) error
ElevateCarrierChunk moves the last poor orphan chunk to the level above where it can fit and there are other chunks as well.
func (*Params) Encode ¶
func (p *Params) Encode(chunkLevel int, callback ParityChunkCallback) error
Encode produces and stores parity chunks that will be also passed back to the caller
func (*Params) GetRootData ¶
GetRootData returns the topmost chunk in the tree. throws and error if the encoding has not been finished in the BMT OR redundancy is not used in the BMT
type ParityChunkCallback ¶
ParityChunkCallback is called when a new parity chunk has been created
type RedundancyParams ¶
type RedundancyParams interface { MaxShards() int // returns the maximum data shard number being used in an intermediate chunk Level() Level Parities(int) int ChunkWrite(int, []byte, ParityChunkCallback) error ElevateCarrierChunk(int, ParityChunkCallback) error Encode(int, ParityChunkCallback) error GetRootData() ([]byte, error) }