cursor

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KindInteger = "integer"
	KindVector  = "vector"
)

Variables

This section is empty.

Functions

func EncodeUvarint

func EncodeUvarint(u uint64) []byte

Optional: compact binary helpers if you later want non-JSON wire payloads.

func InitDefaultCodecs

func InitDefaultCodecs()

func Register

func Register(c Codec)

func ValidateWireCursor

func ValidateWireCursor(wc *WireCursor) error

Types

type Codec

type Codec interface {
	Kind() string
	Marshal(c Cursor) (json.RawMessage, error)      // returns the Data part only
	Unmarshal(data json.RawMessage) (Cursor, error) // parse Data into a Cursor
}

Codec for marshaling/unmarshaling cursors to a stable wire form.

func Lookup

func Lookup(kind string) (Codec, bool)

type ConcurrentTestCodec

type ConcurrentTestCodec struct {
	ID string
}

ConcurrentTestCodec is a test-only codec for concurrent registry tests

func (ConcurrentTestCodec) Kind

func (c ConcurrentTestCodec) Kind() string

func (ConcurrentTestCodec) Marshal

func (ConcurrentTestCodec) Unmarshal

func (ConcurrentTestCodec) Unmarshal(data json.RawMessage) (Cursor, error)

type Cursor

type Cursor interface {
	Kind() string
}

func UnmarshalWire

func UnmarshalWire(wc *WireCursor) (Cursor, error)

type IntegerCursor

type IntegerCursor struct {
	Seq uint64
}

IntegerCursor is a simple high-water mark (seq).

func (IntegerCursor) Compare

func (ic IntegerCursor) Compare(other interfaces.Version) int

Compare implements interfaces.Version

func (IntegerCursor) IsZero

func (ic IntegerCursor) IsZero() bool

IsZero implements interfaces.Version

func (IntegerCursor) Kind

func (IntegerCursor) Kind() string

func (IntegerCursor) String

func (ic IntegerCursor) String() string

String implements interfaces.Version

type VectorCursor

type VectorCursor struct {
	Counters map[string]uint64
}

VectorCursor is a dotted-vector summary: map[node]counter

func (VectorCursor) Compare

func (vc VectorCursor) Compare(other interfaces.Version) int

Compare implements interfaces.Version

func (VectorCursor) IsZero

func (vc VectorCursor) IsZero() bool

IsZero implements interfaces.Version

func (VectorCursor) Kind

func (VectorCursor) Kind() string

func (VectorCursor) String

func (vc VectorCursor) String() string

String implements interfaces.Version

type WireCursor

type WireCursor struct {
	Kind string          `json:"kind"`
	Data json.RawMessage `json:"data"`
}

WireCursor is the typed union for transport (HTTP JSON).

func MarshalWire

func MarshalWire(c Cursor) (*WireCursor, error)

Jump to

Keyboard shortcuts

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