systematic

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 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 SystematicRLNCDecoder

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

func NewSystematicRLNCDecoder

func NewSystematicRLNCDecoder(pieceCount uint) *SystematicRLNCDecoder

Pieces coded by systematic mean, along with randomly coded pieces, are decoded with this decoder

@note Actually FullRLNCDecoder could have been used for same purpose making this one redundant

I'll consider improving decoding by exploiting systematic coded pieces ( vectors )/ removing this in some future date

func (*SystematicRLNCDecoder) AddPiece

Add one more collected coded piece, which will be used for decoding back to original pieces

If all required pieces are already collected i.e. successful decoding has happened --- new pieces to be discarded, with an error denoting same

func (*SystematicRLNCDecoder) GetPiece

GetPiece - Get a decoded piece by index, may ( not ) succeed !

Note: It's not necessary that full decoding needs to happen for this method to return something useful

If M-many pieces are received among N-many expected ( read M <= N ) then pieces with index in [0..M] ( remember upper bound exclusive ) can be attempted to be consumed, given algebric structure has revealed requested piece at index `i`

func (*SystematicRLNCDecoder) GetPieces

func (s *SystematicRLNCDecoder) GetPieces() ([]kodr_internals.Piece, error)

All original pieces in order --- only when full decoding has happened

func (*SystematicRLNCDecoder) IsDecoded

func (s *SystematicRLNCDecoder) IsDecoded() bool

Already decoded back to original pieces, with collected pieces ?

If yes, no more pieces need to be collected

func (*SystematicRLNCDecoder) PieceLength

func (s *SystematicRLNCDecoder) PieceLength() uint

Each piece of N-many bytes

Note: If no pieces are yet added to decoder state, then returns 0, denoting **unknown**

func (*SystematicRLNCDecoder) Required

func (s *SystematicRLNCDecoder) Required() uint

How many more pieces are required to be collected so that whole data can be decoded successfully ?

After collecting these many pieces, original data can be decoded

type SystematicRLNCEncoder

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

func NewSystematicRLNCEncoder

func NewSystematicRLNCEncoder(pieces []kodr_internals.Piece) *SystematicRLNCEncoder

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) (*SystematicRLNCEncoder, 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) (*SystematicRLNCEncoder, 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 (*SystematicRLNCEncoder) 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