tlv

package
v0.26.13 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package tlv declares the error codes and the sentinels of the TLV codec, internal/service/data/codec/tlv — range 0.3.22.* (ADR 0006 service/data/codec/tlv block).

The codes live in the core at the path that mirrors the package emitting them (ADR 0160 §2) and keep the values they were allocated with: the LL byte 3 records the layer that allocated the range, not the directory that declares it today (ADR 0160 §3). Nothing here encodes or decodes — the mechanism, and the constructors that attach a failure's detail, stay in the service package.

Package tlv — the sentinel *errs.Error values, one per code. Each Reason derives from its var name or from its Code constant (ADR 0020); the Public and Private texts are the ones the service package always emitted, so moving the declaration changed no rendering.

Index

Constants

View Source
const CodeTLVDepthExceeded errs.Code = 0x00_03_16_04 // 0.3.22.4

CodeTLVDepthExceeded identifies a nested value whose depth exceeds the hard cap of 32 levels (CWE-674 stack-exhaustion defence).

View Source
const CodeTLVMarshalFailed errs.Code = 0x00_03_16_01 // 0.3.22.1

CodeTLVMarshalFailed identifies an encode-side failure (reflection dispatch, unsupported value, writer error during streaming encode).

View Source
const CodeTLVSizeExceeded errs.Code = 0x00_03_16_05 // 0.3.22.5

CodeTLVSizeExceeded identifies an Unmarshal input whose length exceeds the 10 MiB hard cap (CWE-400 memory-exhaustion defence).

View Source
const CodeTLVTruncated errs.Code = 0x00_03_16_06 // 0.3.22.6

CodeTLVTruncated identifies a buffer that ends mid-record (length declared but value bytes missing, or varint declared but bytes missing).

View Source
const CodeTLVUnmarshalFailed errs.Code = 0x00_03_16_02 // 0.3.22.2

CodeTLVUnmarshalFailed identifies a decode-side failure (malformed record, type mismatch, reader error during streaming decode).

View Source
const CodeTLVUnsupportedType errs.Code = 0x00_03_16_03 // 0.3.22.3

CodeTLVUnsupportedType identifies a value whose reflect.Kind cannot be TLV-encoded (chan, func, complex*, unsafe.Pointer).

Variables

View Source
var (
	// MarshalFailed wraps an encode-side failure in the TLV codec.
	MarshalFailed = errs.Static(CodeTLVMarshalFailed, "MARSHAL_FAILED",
		"TLV encoding failed",
		"service/data/codec/tlv: Marshal/Append/Encode failed during reflection-driven encode",
		0,
		0)

	// UnmarshalFailed wraps a decode-side failure in the TLV codec.
	UnmarshalFailed = errs.Static(CodeTLVUnmarshalFailed, "UNMARSHAL_FAILED",
		"TLV decoding failed",
		"service/data/codec/tlv: Unmarshal/Decode failed (malformed record, type mismatch, reader error)",
		0,
		0)

	// UnsupportedType fires for values the TLV format cannot represent
	// (chan, func, complex*, unsafe.Pointer).
	UnsupportedType = errs.Static(CodeTLVUnsupportedType, "UNSUPPORTED_TYPE",
		"TLV codec cannot encode this type",
		"service/data/codec/tlv: reflect.Kind is not representable in the TLV wire format",
		0,
		0)

	// DepthExceeded fires when a nested value exceeds the 32-level cap.
	DepthExceeded = errs.Static(CodeTLVDepthExceeded, "DEPTH_EXCEEDED",
		"TLV nesting depth exceeds limit",
		"service/data/codec/tlv: nesting depth > maxTLVDepth (CWE-674 defence)",
		0,
		0)

	// SizeExceeded fires when an Unmarshal input exceeds the 10 MiB cap.
	SizeExceeded = errs.Static(CodeTLVSizeExceeded, "SIZE_EXCEEDED",
		"TLV input exceeds size limit",
		"service/data/codec/tlv: len(data) exceeds maxTLVBytes (CWE-400 defence)",
		0,
		0)

	// Truncated fires when a buffer ends mid-record.
	Truncated = errs.Static(CodeTLVTruncated, "TRUNCATED",
		"TLV buffer truncated",
		"service/data/codec/tlv: buffer ended before the declared record length was satisfied",
		0,
		0)
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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