gereedsolomon

package
v0.0.0-...-63a5211 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package gereedsolomon provides Reed-Solomon implementations of the gerasure interfaces, by wrapping the github.com/klauspost/reedsolomon package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoder

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

Encoder is a wrapper around reedsolomon.Encoder satisfying the gerasure.Encoder interface.

func NewEncoder

func NewEncoder(rs reedsolomon.Encoder) Encoder

NewEncoder returns a new Encoder. The options within the given reedsolomon.Encoder determine the number of shards.

func (Encoder) Encode

func (e Encoder) Encode(_ context.Context, data []byte) ([][]byte, error)

Encode satisfies gerasure.Encoder. Callers should assume that the Encoder takes ownership of the given data slice.

type Reconstructor

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

Reconstructor is a wrapper around reedsolomon.Encoder satisfying the gerasure.Reconstructor interface.

func NewReconstructor

func NewReconstructor(rs reedsolomon.Encoder, shardSize int) *Reconstructor

NewReconstructor returns a new Reconstructor. The options within the given reedsolomon.Encoder determine the number of shards. The shardSize and totalDataSize must be discovered out of band;

func (*Reconstructor) Data

func (r *Reconstructor) Data(dst []byte, dataSize int) ([]byte, error)

Data satisfies gerasure.Reconstructor.

func (*Reconstructor) ReconstructData

func (r *Reconstructor) ReconstructData(_ context.Context, idx int, shard []byte) error

ReconstructData satisfies gerasure.Reconstructor. We assume that the caller is keeping track of already marked indices; nothing should go wrong if the same index is used more than once, but it will waste some CPU cycles.

Jump to

Keyboard shortcuts

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