tlwire

package
v0.26.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: MIT Imports: 18 Imported by: 6

Documentation

Index

Constants

View Source
const (
	Int    = cbor.Int
	Neg    = cbor.Neg
	Bytes  = cbor.Bytes
	String = cbor.String
	Array  = cbor.Array
	Map    = cbor.Map
	Label  = cbor.Label
	Simple = cbor.Simple

	Semantic = Label
	Special  = Simple

	TagMask    = cbor.TagMask
	SubMask    = cbor.SubMask
	TagDetMask = SubMask
)

Major types.

View Source
const (
	Len1 = cbor.Len1
	Len2 = cbor.Len2
	Len4 = cbor.Len4
	Len8 = cbor.Len8

	LenBreak = Break
)

Len.

View Source
const (
	False     = cbor.False
	True      = cbor.True
	Nil       = cbor.Null
	Undefined = cbor.Undefined

	Float8  = cbor.Float8
	Float16 = cbor.Float16
	Float32 = cbor.Float32
	Float64 = cbor.Float64

	Break = cbor.Break

	None = cbor.None

	SelfRef = 10 // self reference
	Hidden  = 11 // passwords, etc. when you want to preserve the key
)

Specials.

View Source
const (
	Meta = iota
	Error
	Time
	Duration
	Big

	Caller
	NetAddr
	Hex

	Embedding

	LabelTlogBase    = 10
	SemanticTlogBase = LabelTlogBase
)

Semantics.

View Source
const (
	MetaMagic = iota
	MetaVer

	MetaTlogBase = 8
)

Meta.

View Source
const Magic = "\xc0\x64tlog"

Variables

This section is empty.

Functions

func Dump

func Dump(p []byte) (r string)

func SetEncoder

func SetEncoder(tp interface{}, encoder ValueEncoder)

Types

type Decoder

type Decoder struct {
	cbor.Iterator
}

func (*Decoder) Addr added in v0.24.0

func (d *Decoder) Addr(p []byte, st int) (a netip.Addr, ap netip.AddrPort, i int, err error)

func (*Decoder) BigInt added in v0.26.0

func (d *Decoder) BigInt(p []byte, st int, x *big.Int) (i int, err error)

func (*Decoder) Caller

func (d *Decoder) Caller(p []byte, st int) (pc loc.PC, i int)

func (*Decoder) Callers

func (d *Decoder) Callers(p []byte, st int) (pc loc.PC, pcs loc.PCs, i int)

func (*Decoder) Duration

func (d *Decoder) Duration(p []byte, st int) (dr time.Duration, i int)

func (*Decoder) Time

func (d *Decoder) Time(p []byte, st int) (t time.Time, i int)

func (*Decoder) Timestamp

func (d *Decoder) Timestamp(p []byte, st int) (ts int64, i int)

type Dumper

type Dumper struct {
	cbor.Iterator

	io.Writer

	NoGlobalOffset bool
	// contains filtered or unexported fields
}

func NewDumper

func NewDumper(w io.Writer) *Dumper

func (*Dumper) Write

func (d *Dumper) Write(p []byte) (n int, err error)

type Encoder

type Encoder struct {
	cbor.Emitter
	// contains filtered or unexported fields
}

func (*Encoder) AppendAddr added in v0.24.0

func (e *Encoder) AppendAddr(b []byte, a netip.Addr) []byte

func (*Encoder) AppendAddrPort added in v0.24.0

func (e *Encoder) AppendAddrPort(b []byte, a netip.AddrPort) []byte

func (*Encoder) AppendBigInt added in v0.26.0

func (e *Encoder) AppendBigInt(b []byte, x *big.Int) []byte

func (*Encoder) AppendCaller

func (e *Encoder) AppendCaller(b []byte, pc loc.PC) []byte

func (*Encoder) AppendCallers

func (e *Encoder) AppendCallers(b []byte, pcs loc.PCs) []byte

func (*Encoder) AppendDuration

func (e *Encoder) AppendDuration(b []byte, d time.Duration) []byte

func (*Encoder) AppendError

func (e *Encoder) AppendError(b []byte, err error) []byte

func (*Encoder) AppendFormat

func (e *Encoder) AppendFormat(b []byte, args ...interface{}) []byte

func (*Encoder) AppendFormatf added in v0.26.0

func (e *Encoder) AppendFormatf(b []byte, format string, args ...interface{}) []byte

func (*Encoder) AppendKey

func (e *Encoder) AppendKey(b []byte, key string) []byte

func (*Encoder) AppendKeyInt

func (e *Encoder) AppendKeyInt(b []byte, k string, v int) []byte

func (*Encoder) AppendKeyInt64

func (e *Encoder) AppendKeyInt64(b []byte, k string, v int64) []byte

func (*Encoder) AppendKeyString

func (e *Encoder) AppendKeyString(b []byte, k, v string) []byte

func (*Encoder) AppendKeyUint

func (e *Encoder) AppendKeyUint(b []byte, k string, v uint) []byte

func (*Encoder) AppendKeyUint64

func (e *Encoder) AppendKeyUint64(b []byte, k string, v uint64) []byte

func (*Encoder) AppendKeyValue

func (e *Encoder) AppendKeyValue(b []byte, key string, v interface{}) []byte

func (*Encoder) AppendPC

func (e *Encoder) AppendPC(b []byte, pc loc.PC) []byte

func (*Encoder) AppendPCs

func (e *Encoder) AppendPCs(b []byte, pcs loc.PCs) []byte

func (*Encoder) AppendSemantic added in v0.26.0

func (e *Encoder) AppendSemantic(b []byte, l int) []byte

func (*Encoder) AppendTime

func (e *Encoder) AppendTime(b []byte, t time.Time) []byte

func (*Encoder) AppendTimeMonoTZ

func (e *Encoder) AppendTimeMonoTZ(b []byte, t time.Time) []byte

func (*Encoder) AppendTimeTZ

func (e *Encoder) AppendTimeTZ(b []byte, t time.Time) []byte

func (*Encoder) AppendTimestamp

func (e *Encoder) AppendTimestamp(b []byte, t int64) []byte

func (*Encoder) AppendValue

func (e *Encoder) AppendValue(b []byte, v interface{}) []byte

func (*Encoder) AppendValueSafe

func (e *Encoder) AppendValueSafe(b []byte, v interface{}) []byte

func (*Encoder) InsertLen

func (e *Encoder) InsertLen(b []byte, st, l int) []byte

InsertLen inserts length l before value starting at st copying l bytes forward if needed. It is created for AppendFormat because we don't know the final message length. But it can be also used in other similar situations.

func (*Encoder) SetEncoder

func (e *Encoder) SetEncoder(tp interface{}, encoder ValueEncoder)

type LowDecoder

type LowDecoder struct {
	cbor.Iterator
}

type LowEncoder

type LowEncoder struct {
	cbor.Emitter
}

func (LowEncoder) AppendSemantic

func (e LowEncoder) AppendSemantic(b []byte, l int) []byte

type Reader added in v0.26.0

type Reader struct {
	io.Reader
	// contains filtered or unexported fields
}

func NewReader added in v0.26.0

func NewReader(r io.Reader) *Reader

func (*Reader) Read added in v0.26.0

func (d *Reader) Read(p []byte) (n int, err error)

func (*Reader) ReadOne added in v0.26.0

func (d *Reader) ReadOne() (data []byte, err error)

func (*Reader) WriteTo added in v0.26.0

func (d *Reader) WriteTo(w io.Writer) (n int64, err error)

type Tag added in v0.26.0

type Tag = cbor.Tag

type TlogAppender

type TlogAppender interface {
	TlogAppend(b []byte) []byte
}

type ValueEncoder

type ValueEncoder func(e *Encoder, b []byte, val interface{}) []byte

Jump to

Keyboard shortcuts

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