codec

package
v0.0.0-...-1ab6266 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const AddrFec = 1
View Source
const ChunkHeaderSize = 22
View Source
const KindData = 1
View Source
const PacketDataSize = 1024
View Source
const PacketHashSize = 8
View Source
const PacketHeaderSize = 24

Variables

This section is empty.

Functions

This section is empty.

Types

type Chunk

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

func NewChunk

func NewChunk(parts, csn uint64, kind uint8, data []byte) (*Chunk, []byte)

func (*Chunk) Data

func (c *Chunk) Data() []byte

Data returns copy of internal data field

func (*Chunk) Len

func (c *Chunk) Len() uint64

Len returns length of the chunk in bytes. It'll be multiples of PacketDataSize

func (*Chunk) Marshal

func (c *Chunk) Marshal(total uint64) [][]byte

Marshal accepts total number of parts for allocation purposes. Values less than number of chunk's parts are ignored

func (*Chunk) Parts

func (c *Chunk) Parts() uint64

func (*Chunk) Unmarshal

func (c *Chunk) Unmarshal(data [][]byte) bool

type Decoder

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

func NewDecoder

func NewDecoder(dataParts, totalParts, assemblerLines, dispatcherSize uint64) (decoder *Decoder, err error)

func (*Decoder) Decode

func (decoder *Decoder) Decode(ctx context.Context) (in, out chan []byte, err error)

func (*Decoder) IncomingSize

func (decoder *Decoder) IncomingSize() uint64

func (*Decoder) OutgoingSize

func (decoder *Decoder) OutgoingSize() uint64

type Encoder

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

func NewEncoder

func NewEncoder(aggrtTimeout time.Duration, dispatcherSize, dataParts, totalParts uint64) (*Encoder, error)

func (*Encoder) Encode

func (encoder *Encoder) Encode(ctx context.Context) (in, out chan []byte, err error)

func (*Encoder) IncomingSize

func (encoder *Encoder) IncomingSize() uint64

func (*Encoder) OutgoingSize

func (encoder *Encoder) OutgoingSize() uint64

type Packet

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

func NewPacket

func NewPacket(kind uint8, csn uint64, psn uint32, addr uint64, data []byte) (*Packet, []byte)

func (*Packet) Data

func (p *Packet) Data() []byte

func (*Packet) Marshal

func (p *Packet) Marshal() []byte

func (*Packet) Unmarshal

func (p *Packet) Unmarshal(data []byte) bool

Jump to

Keyboard shortcuts

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