encdec

package
v0.33.2 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDecodePanic = errors.New("panic while decoding message queue")

ErrDecodePanic is returned when gob.Decode panics (malformed/corrupt input that trips an unchecked internal invariant rather than a clean error return).

Functions

func DecodeMsgs

func DecodeMsgs(val []byte) (msgs []msgtypes.Message, err error)

DecodeMsgs takes a byte slice, decodes it as a GOB-encoded slice of msgtypes.Message, and returns the decoded slice and any decoding error.

The gob decoder is hardened against panics here: on-disk queue bytes may come from an older binary or have been corrupted on disk, and a few historical gob paths panic on malformed type metadata rather than returning an error. Wrapping Decode in defer/recover converts any such panic into a regular error so the caller can log and start fresh instead of crashing the whole daemon.

func EncodeMsgs

func EncodeMsgs(msgs []msgtypes.Message) ([]byte, error)

EncodeMsgs encodes a given list of messages using GOB encoding and returns the []byte representation of the messages. If there is an error during encoding, the function returns it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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