Documentation
¶
Index ¶
Constants ¶
const ( KindInteger = "integer" KindVector = "vector" )
Variables ¶
This section is empty.
Functions ¶
func EncodeUvarint ¶
Optional: compact binary helpers if you later want non-JSON wire payloads.
func InitDefaultCodecs ¶
func InitDefaultCodecs()
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.
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) Marshal(c Cursor) (json.RawMessage, error)
func (ConcurrentTestCodec) Unmarshal ¶
func (ConcurrentTestCodec) Unmarshal(data json.RawMessage) (Cursor, error)
type Cursor ¶
type Cursor interface {
Kind() string
}
func MustUnmarshalWire ¶ added in v0.10.0
MustUnmarshalWire unmarshals a WireCursor to a Cursor, panicking on error This is useful for cases where the wire cursor is known to be valid
func UnmarshalWire ¶
func UnmarshalWire(wc *WireCursor) (Cursor, error)
type IntegerCursor ¶
type IntegerCursor struct {
Seq uint64
}
IntegerCursor is a simple high-water mark (seq).
func NewInteger ¶ added in v0.10.0
func NewInteger(seq uint64) IntegerCursor
NewInteger creates a new IntegerCursor with the given sequence number
func (IntegerCursor) Compare ¶
func (ic IntegerCursor) Compare(other types.Version) int
Compare implements types.Version
func (IntegerCursor) Kind ¶
func (IntegerCursor) Kind() string
func (IntegerCursor) String ¶
func (ic IntegerCursor) String() string
String implements types.Version
type VectorCursor ¶
VectorCursor is a dotted-vector summary: map[node]counter
func NewVector ¶ added in v0.10.0
func NewVector(counters map[string]uint64) VectorCursor
NewVector creates a new VectorCursor with the given counters
func (VectorCursor) Compare ¶
func (vc VectorCursor) Compare(other types.Version) int
Compare implements types.Version
func (VectorCursor) Kind ¶
func (VectorCursor) Kind() string
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)
func MustMarshalWire ¶ added in v0.10.0
func MustMarshalWire(c Cursor) WireCursor
MustMarshalWire marshals a cursor to WireCursor format, panicking on error This is useful for cases where the cursor is known to be valid