serial

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: GPL-2.0, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const Len = 8

Variables

This section is empty.

Functions

func Make

func Make(s uint64) (ser []byte)

func Match

func Match(index, ser []byte) bool

Match compares a key bytes to a serial, all indexes have the serial at the end indicating the event record they refer to, and if they match returns true.

Types

type T

type T struct {
	Val []byte
}

T is a badger DB serial number used for conflict free event record keys.

func FromKey

func FromKey(k []byte) (p *T)

FromKey expects the last Len bytes of the given slice to be the serial.

func New

func New(ser []byte) (p *T)

New returns a new serial record key.Element - if nil or short slice is given, initialize a fresh one with Len (for reading), otherwise if equal or longer, trim if long and store into struct (for writing).

func (*T) Len

func (p *T) Len() int

func (*T) Read

func (p *T) Read(buf *bytes.Buffer) (el keys.Element)

func (*T) Uint64

func (p *T) Uint64() (u uint64)

func (*T) Write

func (p *T) Write(buf *bytes.Buffer)

Jump to

Keyboard shortcuts

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