encoder

package
v0.0.0-...-70c1fab Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoder

type Encoder interface {
	PieceCount() uint
	PieceSize() uint
	DecodableLen() uint
	CodedPieceLen() uint
	Padding() uint
	CodedPiece() *coder.CodedPiece
}

func NewFullRLNCEncoder

func NewFullRLNCEncoder(pieces []coder.Piece) Encoder

Provide with original pieces on which fullRLNC to be performed & get encoder, to be used for on-the-fly generation to N-many coded pieces

func NewFullRLNCEncoderWithPieceCount

func NewFullRLNCEncoderWithPieceCount(data []byte, pieceCount uint) (Encoder, error)

If you know #-of pieces you want to code together, invoking this function splits whole data chunk into N-pieces, with padding bytes appended at end of last piece, if required & prepares full RLNC encoder for obtaining coded pieces

func NewFullRLNCEncoderWithPieceSize

func NewFullRLNCEncoderWithPieceSize(data []byte, pieceSize uint) (Encoder, error)

If you want to have N-bytes piece size for each, this function generates M-many pieces each of N-bytes size, which are ready to be coded together with full RLNC

func NewSparseRLNCEncoder

func NewSparseRLNCEncoder(pieces []coder.Piece, probability float64) Encoder

Provide with original pieces on which sparseRLNC to be performed & get encoder, to be used for on-the-fly generation to N-many coded pieces

func NewSparseRLNCEncoderWithPieceCount

func NewSparseRLNCEncoderWithPieceCount(data []byte, pieceCount uint, probability float64) (Encoder, error)

If you know #-of pieces you want to code together, invoking this function splits whole data chunk into N-pieces, with padding bytes appended at end of last piece, if required & prepares sparse RLNC encoder for obtaining coded pieces

func NewSparseRLNCEncoderWithPieceSize

func NewSparseRLNCEncoderWithPieceSize(data []byte, pieceSize uint, probability float64) (Encoder, error)

If you want to have N-bytes piece size for each, this function generates M-many pieces each of N-bytes size, which are ready to be coded together with sparse RLNC

func NewSystematicRLNCEncoder

func NewSystematicRLNCEncoder(pieces []coder.Piece) Encoder

When you've already splitted original data chunk into pieces of same length ( in terms of bytes ), this function can be used for creating one systematic RLNC encoder, which delivers coded pieces on-the-fly

func NewSystematicRLNCEncoderWithPieceCount

func NewSystematicRLNCEncoderWithPieceCount(data []byte, pieceCount uint) (Encoder, error)

If you know #-of pieces you want to code together, invoking this function splits whole data chunk into N-pieces, with padding bytes appended at end of last piece, if required & prepares full RLNC encoder for obtaining coded pieces

func NewSystematicRLNCEncoderWithPieceSize

func NewSystematicRLNCEncoderWithPieceSize(data []byte, pieceSize uint) (Encoder, error)

If you want to have N-bytes piece size for each, this function generates M-many pieces each of N-bytes size, which are ready to be coded together with full RLNC

type FullRLNCEncoder

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

func (*FullRLNCEncoder) CodedPiece

func (f *FullRLNCEncoder) CodedPiece() *coder.CodedPiece

Returns a coded piece, which is constructed on-the-fly by randomly drawing elements from finite field i.e. coding coefficients & performing full-RLNC with all original pieces

func (*FullRLNCEncoder) CodedPieceLen

func (f *FullRLNCEncoder) CodedPieceLen() uint

If N-many original pieces are coded together what could be length of one such coded piece obtained by invoking `CodedPiece` ?

Here N = len(pieces), original pieces which are being coded together

func (*FullRLNCEncoder) DecodableLen

func (f *FullRLNCEncoder) DecodableLen() uint

How many bytes of data, constructed by concatenating coded pieces together, required at minimum for decoding back to original pieces ?

As I'm coding N-many pieces together, I need at least N-many linearly independent pieces, which are concatenated together to form a byte slice & can be used for original data reconstruction.

So it computes N * codedPieceLen

func (*FullRLNCEncoder) Padding

func (f *FullRLNCEncoder) Padding() uint

How many extra padding bytes added at end of original data slice so that splitted pieces are all of same size ?

func (*FullRLNCEncoder) PieceCount

func (f *FullRLNCEncoder) PieceCount() uint

Total #-of pieces being coded together --- denoting these many linearly independent pieces are required successfully decoding back to original pieces

func (*FullRLNCEncoder) PieceSize

func (f *FullRLNCEncoder) PieceSize() uint

Pieces which are coded together are all of same size

Total data being coded = pieceSize * pieceCount ( may include some padding bytes )

type SparseRLNCEncoder

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

func (*SparseRLNCEncoder) CodedPiece

func (s *SparseRLNCEncoder) CodedPiece() *coder.CodedPiece

Returns a coded piece, which is constructed on-the-fly by randomly drawing elements from finite field i.e. coding coefficients & performing sparse-RLNC with all original pieces

func (*SparseRLNCEncoder) CodedPieceLen

func (s *SparseRLNCEncoder) CodedPieceLen() uint

If N-many original pieces are coded together what could be length of one such coded piece obtained by invoking `CodedPiece` ?

Here N = len(pieces), original pieces which are being coded together

func (*SparseRLNCEncoder) DecodableLen

func (s *SparseRLNCEncoder) DecodableLen() uint

How many bytes of data, constructed by concatenating coded pieces together, required at minimum for decoding back to original pieces ?

As I'm coding N-many pieces together, I need at least N-many linearly independent pieces, which are concatenated together to form a byte slice & can be used for original data reconstruction.

So it computes N * codedPieceLen

func (*SparseRLNCEncoder) Padding

func (s *SparseRLNCEncoder) Padding() uint

How many extra padding bytes added at end of original data slice so that splitted pieces are all of same size ?

func (*SparseRLNCEncoder) PieceCount

func (s *SparseRLNCEncoder) PieceCount() uint

Total #-of pieces being coded together --- denoting these many linearly independent pieces are required successfully decoding back to original pieces

func (*SparseRLNCEncoder) PieceSize

func (s *SparseRLNCEncoder) PieceSize() uint

Pieces which are coded together are all of same size

Total data being coded = pieceSize * pieceCount ( may include some padding bytes )

type SystematicRLNCEncoder

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

func (*SystematicRLNCEncoder) CodedPiece

func (s *SystematicRLNCEncoder) CodedPiece() *coder.CodedPiece

For systematic coding, first N-piece are returned in uncoded form i.e. coding vectors are having only single non-zero element ( 1 ) in respective index of piece

Piece index `i` ( returned from this method ), where i < N is going to have coding vector = [N]byte, where only i'th index of this vector will have 1, all other fields will have 0.

Here N = #-of pieces being coded together

Later pieces are coded as they're done in Full RLNC scheme `i` keeps incrementing by +1, until it reaches N

func (*SystematicRLNCEncoder) CodedPieceLen

func (s *SystematicRLNCEncoder) CodedPieceLen() uint

If N-many original pieces are coded together what could be length of one such coded piece obtained by invoking `CodedPiece` ?

Here N = len(pieces), original pieces which are being coded together

func (*SystematicRLNCEncoder) DecodableLen

func (s *SystematicRLNCEncoder) DecodableLen() uint

How many bytes of data, constructed by concatenating coded pieces together, required at minimum for decoding back to original pieces ?

As I'm coding N-many pieces together, I need at least N-many linearly independent pieces, which are concatenated together to form a byte slice & can be used for original data reconstruction.

So it computes N * codedPieceLen

func (*SystematicRLNCEncoder) Padding

func (s *SystematicRLNCEncoder) Padding() uint

If any extra padding bytes added at end of original data slice for making all pieces of same size, returned value will be >0

func (*SystematicRLNCEncoder) PieceCount

func (s *SystematicRLNCEncoder) PieceCount() uint

Total #-of pieces being coded together --- denoting these many linearly independent pieces are required successfully decoding back to original pieces

func (*SystematicRLNCEncoder) PieceSize

func (s *SystematicRLNCEncoder) PieceSize() uint

Pieces which are coded together are all of same size

Total data being coded = pieceSize * pieceCount ( may include some padding bytes )

Jump to

Keyboard shortcuts

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