codec

package
v0.0.0-...-7e052fb Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 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 PacketV2DataSize = 1024
View Source
const PacketV2HashSize = 8
View Source
const PacketV2HeaderSize = 24
View Source
const PacketV3DataSize = 1024
View Source
const PacketV3HashSize = 8
View Source
const PacketV3HeaderSize = 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 PacketV2DataSize

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 PacketV2

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

func NewPacketV2

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

func (*PacketV2) Data

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

func (*PacketV2) Marshal

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

func (*PacketV2) Unmarshal

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

type PacketV3

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

func NewPacketV3

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

func (*PacketV3) Data

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

func (*PacketV3) Marshal

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

func (*PacketV3) Unmarshal

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

Jump to

Keyboard shortcuts

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