dagnode

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsErr added in v0.2.0

func IsErr(err error, errs ...error) bool

IsErr returns whether given error is exact error.

Types

type DagNode

type DagNode struct {
	Nodes []*datanode.Client
	// contains filtered or unexported fields
}

DagNode Implemented the Blockstore interface

func NewDagNode

func NewDagNode(cfg config.DagNodeConfig) (*DagNode, error)

NewDagNode creates a new DagNode

func (*DagNode) AllKeysChan

func (d *DagNode) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)

AllKeysChan returns a channel that will yield every key in the dag

func (*DagNode) Close

func (d *DagNode) Close()

func (*DagNode) DeleteBlock

func (d *DagNode) DeleteBlock(ctx context.Context, cid cid.Cid) (err error)

DeleteBlock deletes a block from the DagNode

func (*DagNode) Get

func (d *DagNode) Get(ctx context.Context, cid cid.Cid) (blocks.Block, error)

Get returns the block with the given cid

func (*DagNode) GetSize

func (d *DagNode) GetSize(ctx context.Context, cid cid.Cid) (int, error)

GetSize returns the size of the block with the given cid

func (*DagNode) Has

func (d *DagNode) Has(ctx context.Context, cid cid.Cid) (bool, error)

Has returns true if the given cid is in the DagNode

func (*DagNode) HashOnRead

func (d *DagNode) HashOnRead(enabled bool)

HashOnRead tells the dag node to calculate the hash of the block

func (*DagNode) Put

func (d *DagNode) Put(ctx context.Context, block blocks.Block) (err error)

Put adds the given block to the DagNode

func (*DagNode) PutMany

func (d *DagNode) PutMany(ctx context.Context, blocks []blocks.Block) (err error)

PutMany adds the given blocks to the DagNode

func (*DagNode) RepairDataNode added in v0.2.0

func (d *DagNode) RepairDataNode(ctx context.Context, fromNodeIndex int, repairNodeIndex int) error

RepairDataNode prepare node repair

type Erasure

type Erasure struct {
	// contains filtered or unexported fields
}

Erasure - erasure encoding details.

func NewErasure

func NewErasure(dataBlocks, parityBlocks int, blockSize int64) (e Erasure, err error)

NewErasure creates a new ErasureStorage.

func (*Erasure) DecodeDataAndParityBlocks

func (e *Erasure) DecodeDataAndParityBlocks(data [][]byte) error

DecodeDataAndParityBlocks decodes the given erasure-coded data and verifies it. It returns an error if the decoding failed.

func (*Erasure) DecodeDataBlocks

func (e *Erasure) DecodeDataBlocks(data [][]byte) error

DecodeDataBlocks decodes the given erasure-coded data. It only decodes the data blocks but does not verify them. It returns an error if the decoding failed.

func (*Erasure) EncodeData

func (e *Erasure) EncodeData(data []byte) ([][]byte, error)

EncodeData encodes the given data and returns the erasure-coded data. It returns an error if the erasure coding failed.

func (*Erasure) ShardFileOffset

func (e *Erasure) ShardFileOffset(startOffset, length, totalLength int64) int64

ShardFileOffset - returns the effective offset where erasure reading begins.

func (*Erasure) ShardFileSize

func (e *Erasure) ShardFileSize(totalLength int64) int64

ShardFileSize - returns final erasure size from original size.

func (*Erasure) ShardSize

func (e *Erasure) ShardSize() int64

ShardSize - returns actual shared size from erasure blockSize.

type Meta added in v0.2.0

type Meta struct {
	BlockSize int32
}

Jump to

Keyboard shortcuts

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