dagnode

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DagNode

type DagNode struct {
	Nodes []*DataNodeClient
	// 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) RepairDisk

func (d *DagNode) RepairDisk(ip, port string) error

RepairDisk prepare disk repair

func (*DagNode) RepairHost

func (d *DagNode) RepairHost(oldIp, newIp, oldPort, newPort string) error

RepairHost prepare host repair

type DataNodeClient

type DataNodeClient struct {
	Client      proto.DataNodeClient
	HeartClient healthpb.HealthClient
	Ip          string
	Port        string
	Conn        *grpc.ClientConn
}

DataNodeClient is a node that stores erasure-coded sharded data

func NewDataNodeClient

func NewDataNodeClient(cfg config.DataNodeConfig) (datanode *DataNodeClient, err error)

NewDataNodeClient creates a grpc connection to a slice

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.

Jump to

Keyboard shortcuts

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