linear

package
v1.18.4 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: BSD-3-Clause Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DefaultMaxBlobSize = 256 * 1024 * 1024

DefaultMaxBlobSize is the default per-blob ceiling enforced by Manager. It is sized to comfortably hold:

  • FHE bootstrap keys for STD128 / PN10QP27 / PN11QP54 parameters (~50MB)
  • State sync chunks and large Verkle proofs
  • 4x headroom on top of the largest known caller

256MiB is a soft cap; callers may pass a larger value to NewManager. The hard cap remains MaxInt (math.MaxInt32 = ~2GiB) due to the on-disk length prefix being uint32.

View Source
const MaxInt = math.MaxInt32

MaxInt is the absolute upper bound on a slice length encoded by this codec. Slice lengths are written as a uint32, so the encoded length cannot exceed math.MaxInt32 without overflowing on 32-bit platforms during decode.

Variables

View Source
var (
	ErrUnknownVersion      = errors.New("unknown codec version")
	ErrMarshalNil          = errors.New("can't marshal nil")
	ErrUnmarshalNil        = errors.New("can't unmarshal nil")
	ErrUnexpectedType      = errors.New("unexpected type")
	ErrDoesNotImplement    = errors.New("type does not implement interface")
	ErrUnexportedField     = errors.New("unexported field")
	ErrMaxSliceLenExceeded = errors.New("max slice length exceeded")
)

Functions

func NewDefault

func NewDefault() codec.Codec

NewDefault creates a new linear codec

func NewManager

func NewManager(maxSize int) codec.Manager

NewManager creates a new codec manager. maxSize is the per-blob ceiling in bytes; pass 0 (or any non-positive value) to use DefaultMaxBlobSize. Values above MaxInt are clamped to MaxInt.

Types

type LinearCodec

type LinearCodec struct{}

LinearCodec is a simple codec implementation

func (*LinearCodec) MarshalInto

func (c *LinearCodec) MarshalInto(source interface{}, destination []byte) error

MarshalInto marshals the source into the destination buffer

func (*LinearCodec) Size

func (c *LinearCodec) Size(value interface{}) (int, error)

Size returns the encoded size of the value

func (*LinearCodec) Unmarshal

func (c *LinearCodec) Unmarshal(source []byte, destination interface{}) error

Unmarshal unmarshals from source into destination

type Manager

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

Manager implements codec.Manager.

maxBlobSize bounds the largest single value the Manager will accept on Marshal and the largest single value it will return on Unmarshal. Set via NewManager. A value <= 0 means "use DefaultMaxBlobSize". The ceiling is MaxInt; values above MaxInt are clamped.

func (*Manager) Marshal

func (m *Manager) Marshal(version uint16, source interface{}) ([]byte, error)

Marshal encodes the source object

func (*Manager) RegisterCodec

func (m *Manager) RegisterCodec(version uint16, codec codec.Codec) error

RegisterCodec registers a codec for a version

func (*Manager) Size

func (m *Manager) Size(version uint16, source interface{}) (int, error)

Size returns the encoded size of the object

func (*Manager) Unmarshal

func (m *Manager) Unmarshal(source []byte, destination interface{}) (uint16, error)

Unmarshal decodes into the destination object

Jump to

Keyboard shortcuts

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