Documentation
¶
Index ¶
- type FullRLNCDecoder
- func (d *FullRLNCDecoder) AddPiece(piece *kodr_internals.CodedPiece) error
- func (d *FullRLNCDecoder) GetPiece(i uint) (kodr_internals.Piece, error)
- func (d *FullRLNCDecoder) GetPieces() ([]kodr_internals.Piece, error)
- func (d *FullRLNCDecoder) IsDecoded() bool
- func (d *FullRLNCDecoder) PieceLength() uint
- func (d *FullRLNCDecoder) Required() uint
- type FullRLNCEncoder
- type FullRLNCRecoder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FullRLNCDecoder ¶
type FullRLNCDecoder struct {
// contains filtered or unexported fields
}
func NewFullRLNCDecoder ¶
func NewFullRLNCDecoder(pieceCount uint) *FullRLNCDecoder
If minimum #-of linearly independent coded pieces required for decoding coded pieces --- is provided with, it returns a decoder, which keeps applying full RLNC decoding step on received coded pieces
As soon as minimum #-of linearly independent pieces are obtained which is generally equal to original #-of pieces, decoded pieces can be read back
func (*FullRLNCDecoder) AddPiece ¶
func (d *FullRLNCDecoder) AddPiece(piece *kodr_internals.CodedPiece) error
AddPiece - Adds a new received coded piece along with coding vector. After every new coded piece reception augmented matrix ( coding vector + coded piece ) is rref-ed, to keep it as ready as possible for consuming decoded pieces
Note: As soon as all pieces are decoded, no more calls to this method does anything useful --- so better check for error & proceed !
func (*FullRLNCDecoder) GetPiece ¶
func (d *FullRLNCDecoder) GetPiece(i uint) (kodr_internals.Piece, error)
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 (*FullRLNCDecoder) GetPieces ¶
func (d *FullRLNCDecoder) GetPieces() ([]kodr_internals.Piece, error)
GetPieces - Get a list of all decoded pieces, given full decoding has happened
func (*FullRLNCDecoder) IsDecoded ¶ added in v0.2.1
func (d *FullRLNCDecoder) IsDecoded() bool
IsDecoded - Use it for checking whether more piece collection is required or not
If it returns false, denotes more linearly independent pieces need to be collected, only then decoding can be completed
func (*FullRLNCDecoder) PieceLength ¶
func (d *FullRLNCDecoder) PieceLength() uint
PieceLength - Returns piece length in bytes
If no pieces are yet added to decoder state, then returns 0, denoting **unknown**
func (*FullRLNCDecoder) Required ¶ added in v0.2.1
func (d *FullRLNCDecoder) Required() uint
Required - How many more linearly independent pieces are required for successfully decoding pieces ?
type FullRLNCEncoder ¶
type FullRLNCEncoder struct {
// contains filtered or unexported fields
}
func NewFullRLNCEncoder ¶
func NewFullRLNCEncoder(pieces []kodr_internals.Piece) *FullRLNCEncoder
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) (*FullRLNCEncoder, 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) (*FullRLNCEncoder, 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 (*FullRLNCEncoder) CodedPiece ¶
func (f *FullRLNCEncoder) CodedPiece() *kodr_internals.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 ¶ added in v0.2.1
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 ¶ added in v0.2.1
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 ¶ added in v0.2.1
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 ¶ added in v0.2.1
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 ¶ added in v0.2.1
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 FullRLNCRecoder ¶
type FullRLNCRecoder struct {
// contains filtered or unexported fields
}
func NewFullRLNCRecoder ¶
func NewFullRLNCRecoder(pieces []*kodr_internals.CodedPiece) *FullRLNCRecoder
Provide with all coded pieces, which are to be used for performing fullRLNC ( read recoding of coded data ) & get back recoder which is used for on-the-fly construction of N-many recoded pieces
func NewFullRLNCRecoderWithFlattenData ¶
func NewFullRLNCRecoderWithFlattenData(data []byte, pieceCount uint, piecesCodedTogether uint) (*FullRLNCRecoder, error)
A byte slice which is formed by concatenating coded pieces, will be splitted into structured coded pieces ( read having two components i.e. coding vector & piece ) & recoder to be returned, which can be used for on-the-fly random piece recoding
func (*FullRLNCRecoder) CodedPiece ¶
func (r *FullRLNCRecoder) CodedPiece() (*kodr_internals.CodedPiece, error)
Returns recoded piece, which is constructed on-the-fly by randomly drawing some coding coefficients from finite field & performing full RLNC with all coded pieces