partitioning

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataSplit

type DataSplit struct {
}

DataSplit can split a large slice of byte slices in chunks with len(chunks) <= limit It does not marshal the data

func (*DataSplit) SplitDataInChunks

func (ds *DataSplit) SplitDataInChunks(data [][]byte, limit int) ([][][]byte, error)

SplitDataInChunks splits the provided data into smaller chunks limit is expressed in number of elements

type SimpleDataPacker

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

SimpleDataPacker can split a large slice of byte slices in chunks <= maxPacketSize If one element still exceeds maxPacketSize, it will be returned alone It does the marshaling of the resulted (smaller) slice of byte slices This is a simpler version of a data packer that does not marshall in a repetitive manner currentChunk slice as the SizeDataPacker does. This limitation is lighter in terms of CPU cycles and memory used but is not as precise as SizeDataPacker.

func NewSimpleDataPacker

func NewSimpleDataPacker(marshalizer marshal.Marshalizer) (*SimpleDataPacker, error)

NewSimpleDataPacker creates a new SizeDataPacker instance

func (*SimpleDataPacker) IsInterfaceNil

func (sdp *SimpleDataPacker) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SimpleDataPacker) PackDataInChunks

func (sdp *SimpleDataPacker) PackDataInChunks(data [][]byte, limit int) ([][]byte, error)

PackDataInChunks packs the provided data into smaller chunks limit is expressed in bytes

type SizeDataPacker

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

SizeDataPacker can split a large slice of byte slices in chunks <= maxPacketSize If one element still exceeds maxPacketSize, it will be returned alone It does the marshaling of the resulted (smaller) slice of byte slices

func NewSizeDataPacker

func NewSizeDataPacker(marshalizer marshal.Marshalizer) (*SizeDataPacker, error)

NewSizeDataPacker creates a new SizeDataPacker instance

func (*SizeDataPacker) IsInterfaceNil

func (sdp *SizeDataPacker) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SizeDataPacker) PackDataInChunks

func (sdp *SizeDataPacker) PackDataInChunks(data [][]byte, limit int) ([][]byte, error)

PackDataInChunks packs the provided data into smaller chunks limit is expressed in bytes

Jump to

Keyboard shortcuts

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