Documentation ¶
Index ¶
- Constants
- Variables
- func Amerge(tlvs [][]byte) (merged []byte)
- func Atlv(log LogT) (tlv []byte)
- func COYdefault() []byte
- func Cstring(tlv []byte) string
- func DiffFIRST(tlv []byte, vvdiff VV) []byte
- func ELMdefault() (tlv []byte)
- func ELMstring(tlv []byte) string
- func Edelta(tlv []byte, new_val int64, clock Clock) (tlv_delta []byte)
- func Ediff(tlv []byte, vvdiff VV) []byte
- func Emerge(tlvs [][]byte) (merged []byte)
- func Eparse(txt string) (tlv []byte)
- func Estring(tlv []byte) (txt string)
- func Evalid(tlv []byte) bool
- func FIRSTcompare(a, b []byte) int
- func FIRSTdefault(rdt byte) []byte
- func FIRSTparsee(rdt byte, val string) (tlv []byte)
- func FIRSTparsez(bulk []byte) (zrev uint64, src uint64, value []byte)
- func FIRSTrdx2tlv(a *RDX) (tlv []byte)
- func FIRSTrdxs2tlv(a []RDX) (tlv []byte)
- func FIRSTrdxs2tlvs(a []RDX) (tlv protocol.Records)
- func FIRSTtlv(rev int64, src uint64, value []byte) (bulk []byte)
- func Fdelta(tlv []byte, new_val float64, clock Clock) (tlv_delta []byte)
- func Fdiff(tlv []byte, vvdiff VV) []byte
- func Fmerge(tlvs [][]byte) (tlv []byte)
- func Fnative(tlv []byte) float64
- func Fparse(txt string) (tlv []byte)
- func Fstring(tlv []byte) (txt string)
- func Ftlv(i float64) (tlv []byte)
- func Fvalid(tlv []byte) bool
- func Idefault() []byte
- func Idelta(tlv []byte, new_val int64, clock Clock) (tlv_delta []byte)
- func Idiff(tlv []byte, vvdiff VV) []byte
- func Imerge(tlvs [][]byte) (tlv []byte)
- func Inative(tlv []byte) int64
- func Iparse(txt string) (tlv []byte)
- func IsFirst(c byte) bool
- func Istring(tlv []byte) (txt string)
- func Itlv(i int64) (tlv []byte)
- func Itlve(rev int64, src uint64, inc int64) []byte
- func Ivalid(tlv []byte) bool
- func Ldelta(tlv []byte, new_val int64, clock Clock) (tlv_delta []byte)
- func Ldiff(tlv []byte, vvdiff VV) []byte
- func Lmerge(tlvs [][]byte) (merged []byte)
- func Lparse(txt string) (tlv []byte)
- func Lstring(tlv []byte) (txt string)
- func Lvalid(tlv []byte) bool
- func Mdelta(tlv []byte, new_tlv []byte) (tlv_delta []byte)
- func Mdelta2(tlv []byte, changes []byte) (tlv_delta []byte)
- func MdeltaTR(tlv []byte, changes MapTR, clock Clock) (tlv_delta []byte)
- func Mdiff(tlv []byte, vvdiff VV) []byte
- func MelAppend(to []byte, lit byte, t Time, body []byte) []byte
- func MelReSource(first []byte, src uint64) (ret []byte, err error)
- func MergeFIRST(tlvs [][]byte) (tlv []byte)
- func Mmerge(tlvs [][]byte) (merged []byte)
- func Mparse(txt string) (tlv []byte)
- func Mrdx2tlv(a *RDX) (tlv []byte)
- func Mstring(tlv []byte) (txt string)
- func MtlvII(nat MapTT) (tlv []byte)
- func MtlvSS(m MapSS) (tlv []byte)
- func MtlvTR(nat MapTR) (tlv []byte)
- func MtlvTT(mtt MapTT) (tlv []byte)
- func Mvalid(tlv []byte) bool
- func N2string(tlv []byte, new_val string, src uint64) (tlv_delta []byte)
- func NOmerge(inputs [][]byte) []byte
- func Ndefault() []byte
- func Ndelta(tlv []byte, new_val uint64, clock Clock) (tlv_delta []byte)
- func Ndiff(tlv []byte, vvdiff VV) []byte
- func NextRev(revz uint64) (next int64)
- func Nmerge(tlvs [][]byte) (merged []byte)
- func Nmine(tlv []byte, src uint64) uint64
- func Nnative(tlv []byte) (sum uint64)
- func NoMerge(inputs [][]byte) []byte
- func Nparse(txt string) (tlv []byte)
- func Nstring(tlv []byte) (txt string)
- func Ntlv(u uint64) (tlv []byte)
- func Ntlvt(inc uint64, src uint64) []byte
- func Nvalid(tlv []byte) bool
- func OValid(tlv []byte) bool
- func OYstring(tlv []byte) string
- func Parse583Off(hex583 []byte) (off uint16)
- func ParseFIRST(bulk []byte) (rev int64, src uint64, value []byte)
- func Rdefault() []byte
- func Rdelta(tlv []byte, new_val ID, clock Clock) (tlv_delta []byte)
- func Rdiff(tlv []byte, vvdiff VV) []byte
- func Restamp(first []byte, time Time) (stamped []byte)
- func Rmerge(tlvs [][]byte) (tlv []byte)
- func Rparse(txt string) (tlv []byte)
- func Rstring(tlv []byte) (txt string)
- func Rtlv(i ID) (tlv []byte)
- func Rvalid(tlv []byte) bool
- func Sdefault() []byte
- func Sdelta(tlv []byte, new_val string, clock Clock) (tlv_delta []byte)
- func Sdiff(tlv []byte, vvdiff VV) []byte
- func SetSourceFIRST(bare []byte, src uint64) (res []byte, err error)
- func SetTimeFIRST(bare []byte, t Time) (res []byte)
- func Smerge(tlvs [][]byte) (tlv []byte)
- func Snative(tlv []byte) string
- func Sparse(txt string) (tlv []byte)
- func Sparset(txt string, t Time) (tlv []byte)
- func SrcSeqOff(id ID) (src uint64, seq uint64, off uint16)
- func Sstring(tlv []byte) (txt string)
- func Stlv(s string) (tlv []byte)
- func Svalid(tlv []byte) bool
- func Tdelta(tlv []byte, clock Clock) (tlv_delta []byte)
- func Tdiff(tlv []byte, vvdiff VV) []byte
- func Time64FromRevzSrc(revz, src uint64) uint64
- func Tmerge(tlvs [][]byte) (tlv []byte)
- func Tparse(txt string) (tlv []byte)
- func Tstring(tlv []byte) (txt string)
- func Ttlv(term string) (tlv []byte)
- func Tvalid(tlv []byte) bool
- func Uint32Pair(a, b uint32) (x uint64)
- func Uint32Unpair(x uint64) (a, b uint32)
- func UnHex(hex []byte) (num uint64)
- func Unescape(in, out []byte) ([]byte, error)
- func UnzipFloat64(zip []byte) float64
- func UnzipInt64(zip []byte) int64
- func UnzipIntUint64Pair(zip []byte) (i int64, u uint64)
- func UnzipUint32Pair(buf []byte) (big, lil uint32)
- func UnzipUint64(zip []byte) (v uint64)
- func UnzipUint64Pair(buf []byte) (big, lil uint64)
- func VValid(tlv []byte) bool
- func VVdelta(old VV, new_val VV) (tlv_delta []byte)
- func Vdelta(tlv []byte, new_val VV) (tlv_delta []byte)
- func Vdiff(tlv []byte, vvdiff VV) (diff_tlv []byte)
- func Vmerge(tlvs [][]byte) (tlv []byte)
- func Vparse(txt string) (tlv []byte)
- func Vstring(tlv []byte) (txt string)
- func Vtlv(vv VV) (tlv []byte)
- func Vvalid(tlv []byte) bool
- func X2string(rdt byte, tlv []byte, new_val string, src uint64) (delta []byte)
- func Xdefault(rdt byte) (tlv []byte)
- func Xdiff(rdt byte, tlv []byte, sendvv VV) (diff []byte)
- func Xmerge(rdt byte, tlvs [][]byte) (tlv []byte)
- func Xparse(rdt byte, val string) (tlv []byte)
- func Xstring(rdt byte, tlv []byte) string
- func Xvalid(rdt byte, bare []byte) bool
- func Xvalide(tlve []byte) bool
- func ZagZigUint64(u uint64) int64
- func Zdelta(tlv []byte, new_val int64, clock Clock) (tlv_delta []byte)
- func Zdiff(tlv []byte, vvdiff VV) []byte
- func ZigZagInt64(i int64) uint64
- func ZipFloat64(f float64) []byte
- func ZipInt64(v int64) []byte
- func ZipIntUint64Pair(i int64, u uint64) []byte
- func ZipUint64(v uint64) []byte
- func ZipUint64Pair(big, lil uint64) []byte
- func ZipZagInt64(i int64) []byte
- func Zmerge(tlvs [][]byte) (merged []byte)
- func Znative(tlv []byte) (sum int64)
- func Znative3(tlv []byte, src uint64) (sum, mine, minerev int64)
- func Zparse(txt string) (tlv []byte)
- func Zstring(tlv []byte) (txt string)
- func Ztlv(i int64) (tlv []byte)
- func Ztlvt(i int64, src uint64, rev int64) (tlv []byte)
- func Zvalid(tlv []byte) bool
- type AIterator
- type Clock
- type EIterator
- type FIRSTIterator
- type ID
- func IDFromBracketedString(bid []byte) ID
- func IDFromBytes(by []byte) ID
- func IDFromSrcSeqOff(src uint64, seq uint64, off uint16) ID
- func IDFromString(idstr string) (parsed ID)
- func IDFromText(idstr []byte) (parsed ID)
- func IDFromZipBytes(zip []byte) ID
- func IDfromSrcPro(src, pro uint64) ID
- func Rnative(tlv []byte) ID
- func TakeIDWary(lit byte, pack []byte) (id ID, rest []byte, err error)
- func (id ID) Bytes() []byte
- func (id *ID) Drain(from []byte) (rest []byte)
- func (id ID) Feed(into []byte) (res []byte)
- func (id ID) Hex583() []byte
- func (id ID) Off() uint64
- func (id ID) Pro() uint64
- func (id ID) Seq() uint64
- func (id ID) Src() uint64
- func (id ID) String() string
- func (id ID) String583() string
- func (id ID) ToOff(newoff uint64) ID
- func (id ID) UInt64() uint64
- func (id ID) ZeroOff() ID
- func (id ID) ZipBytes() []byte
- type ItHeap
- type LIterator
- type LocalLogicalClock
- type LogT
- type MIterator
- type MapSS
- type MapTR
- type MapTT
- type NIterator
- type RDT
- type RDX
- type SortedIterator
- type Time
- type VV
- func (vv VV) Get(src uint64) (pro uint64)
- func (vv VV) GetID(src uint64) ID
- func (vv VV) IDs() (ids []ID)
- func (vv VV) InterestOver(b VV) VV
- func (vv VV) ProgressedOver(b VV) bool
- func (vv VV) Put(src, pro uint64) bool
- func (vv VV) PutID(id ID) bool
- func (vv VV) PutTLV(rec []byte) (err error)
- func (vv VV) Seen(bb VV) bool
- func (vv VV) Set(src, pro uint64)
- func (vv VV) String() string
- func (vv VV) TLV() (ret []byte)
- type ZIterator
Constants ¶
const ( MergeA = iota MergeAB MergeB MergeBA )
const ( None = byte(0) Float = byte('F') Integer = byte('I') Reference = byte('R') String = byte('S') Term = byte('T') Natural = byte('N') NInc = byte('n') ZCounter = byte('Z') ZInc = byte('z') Eulerian = byte('E') Linear = byte('L') Mapping = byte('M') VVector = byte('V') )
const ( RdxOOpen = iota RdxOClose RdxAOpen RdxAClose RdxComma RdxColon RdxDot )
const ( VvSeen = -1 VvNext = 0 VvGap = 1 )
const BadId = ID(0xffffffffffffffff)
const Bytes1 = 0xff
const Bytes2 = 0xffff
const Bytes4 = 0xffffffff
const Hex = "0123456789abcdef"
const Hex583Len = 18
const MaxSrc = (1 << SrcBits) - 1
const OffBits = 12
const OffMask = ID(1<<OffBits) - 1
const ProBits = SeqBits + OffBits
const ProInc = ID(1 << OffBits)
const ProMask = uint64(uint64(1)<<ProBits) - 1
const RdxMaxNesting = 64
const SeqBits = 32
const SeqOne = 1 << OffBits
const SrcBits = 20
const ValidZipPairLen = 0xe880 ^ 0xffff
const ZeroId = ID(0)
Variables ¶
var ErrBadFIRST = errors.New("bad FIRST record")
var ErrBadId = errors.New("not an expected id")
var ErrBadPacket = errors.New("bad packet")
var ErrBadRdx = errors.New("bad RDX syntax")
var ErrBadV0Record = errors.New("bad V0 record")
var ErrBadVRecord = errors.New("bad V record")
var ErrBadValueForAType = errors.New("rdx: bad value for the type")
var ErrGap = errors.New("id sequence gap")
var ErrSeen = errors.New("previously seen id")
var MalformedStringEscapeError = errors.New("malformed string escape")
var RdxSep = []byte("{}[],:.")
Functions ¶
func COYdefault ¶
func COYdefault() []byte
func ELMdefault ¶
func ELMdefault() (tlv []byte)
func FIRSTcompare ¶
func FIRSTdefault ¶
func FIRSTparsee ¶
func FIRSTparsez ¶
same as ParseFIRST, but the Rev number is zigzagged
func FIRSTrdx2tlv ¶
func FIRSTrdxs2tlv ¶
func FIRSTrdxs2tlvs ¶
func MergeFIRST ¶
func Ndelta ¶
produce an op that turns the old value into the new one return nil on error, empty slice for "no changes"
func Parse583Off ¶
func ParseFIRST ¶
for bad format, value==nil (an empty value is an empty slice)
func SetTimeFIRST ¶
func Time64FromRevzSrc ¶
func Uint32Pair ¶
func Uint32Unpair ¶
func Unescape ¶
unescape unescapes the string contained in 'in' and returns it as a slice. If 'in' contains no escaped characters:
Returns 'in'.
Else, if 'out' is of sufficient capacity (guaranteed if cap(out) >= len(in)):
'out' is used to build the unescaped string and is returned with no extra allocation
Else:
A new slice is allocated and returned.
func UnzipFloat64 ¶
func UnzipInt64 ¶
func UnzipIntUint64Pair ¶
func UnzipUint32Pair ¶
func UnzipUint64 ¶
func UnzipUint64Pair ¶
func ZagZigUint64 ¶
func ZigZagInt64 ¶
func ZipFloat64 ¶
func ZipIntUint64Pair ¶
func ZipUint64Pair ¶
ZipUint64Pair packs a pair of uint64 into a byte string. The smaller the ints, the shorter the string TODO 4+3 etc
func ZipZagInt64 ¶
Types ¶
type AIterator ¶
type AIterator struct {
FIRSTIterator
}
func (*AIterator) Merge ¶
func (a *AIterator) Merge(bb SortedIterator) int
type EIterator ¶
type EIterator struct {
FIRSTIterator
}
func (*EIterator) Merge ¶
func (a *EIterator) Merge(b SortedIterator) int
type FIRSTIterator ¶
type FIRSTIterator struct { TLV []byte // contains filtered or unexported fields }
func (*FIRSTIterator) Next ¶
func (a *FIRSTIterator) Next() bool
func (*FIRSTIterator) ParsedValue ¶
func (a *FIRSTIterator) ParsedValue() (rdt byte, time Time, value []byte)
func (*FIRSTIterator) Value ¶
func (a *FIRSTIterator) Value() []byte
type ID ¶
type ID uint64
ID is an 64-bit locator/identifier. This is NOT a Lamport timestamp (need more bits for that). This is *log time*, not *logical time*.
0...............16..............32..............48.............64 +-------+-------+-------+-------+-------+-------+-------+------- |offset(12)||......sequence.(32.bits)......|..source.(20.bits)..| |...........progress.(44.bits).............|....................|
const ID0 ID = 0
func IDFromBracketedString ¶
func IDFromBytes ¶
func IDFromString ¶
func IDFromText ¶
func IDFromZipBytes ¶
func IDfromSrcPro ¶
type ItHeap ¶
type ItHeap[T SortedIterator] []T
func (ItHeap[T]) Fix ¶
Fix re-establishes the heap ordering after the element at index i has changed its value. Changing the value of the element at index i and then calling Fix is equivalent to, but less expensive than, calling Remove(h, i) followed by a push of the new value. The complexity is O(log n) where n = h.Len().
type LIterator ¶
type LIterator struct {
FIRSTIterator
}
func (*LIterator) Merge ¶
func (a *LIterator) Merge(bb SortedIterator) int
type LocalLogicalClock ¶
type LocalLogicalClock struct {
Source uint64
}
func (*LocalLogicalClock) See ¶
func (llc *LocalLogicalClock) See(time, src uint64)
func (*LocalLogicalClock) Src ¶
func (llc *LocalLogicalClock) Src() uint64
func (*LocalLogicalClock) Time ¶
func (llc *LocalLogicalClock) Time(maxtime uint64) uint64
type MIterator ¶
type MIterator struct {
Key, Val FIRSTIterator
// contains filtered or unexported fields
}
func (*MIterator) Merge ¶
func (a *MIterator) Merge(b SortedIterator) int
type NIterator ¶
type NIterator struct {
FIRSTIterator
}
func (*NIterator) Merge ¶
func (a *NIterator) Merge(b SortedIterator) int
type SortedIterator ¶
type SortedIterator interface { Next() bool Merge(b SortedIterator) int Value() []byte }
type Time ¶
func ParseEnvelopedFIRST ¶
Parses an enveloped FIRST record
func TimeFrom64 ¶
func TimeFromZipBytes ¶
type VV ¶
VV is a version vector, max ids seen from each known replica.
func VVFromString ¶
func (VV) InterestOver ¶
func (VV) ProgressedOver ¶
Whether this VV overlaps with another one (have common non-zero entry)
func (VV) Put ¶
Put the Src-pro pair to the VV, returns whether it was unseen (i.e. made any difference)
type ZIterator ¶
type ZIterator struct {
FIRSTIterator
}
func (*ZIterator) Merge ¶
func (a *ZIterator) Merge(b SortedIterator) int