ratchet

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRatchetNotFound = fmt.Errorf("ratchet not found")
View Source
var ErrUnknownRatchetRelation = fmt.Errorf("cannot relate ratchets")

Functions

This section is empty.

Types

type Spiral

type Spiral struct {
	// contains filtered or unexported fields
}

func DecodeSpiral

func DecodeSpiral(s string) (*Spiral, error)

func NewSpiral

func NewSpiral() *Spiral

func (Spiral) Compare

func (r Spiral) Compare(b Spiral, maxSteps int) (int, error)

func (*Spiral) Copy

func (r *Spiral) Copy() *Spiral

func (Spiral) Encode

func (r Spiral) Encode() string

func (Spiral) Equal

func (r Spiral) Equal(b Spiral) bool

func (*Spiral) Inc

func (r *Spiral) Inc()

func (*Spiral) IncBy

func (r *Spiral) IncBy(n int)

func (Spiral) Key

func (r Spiral) Key() [32]byte

func (Spiral) KnownAfter

func (r Spiral) KnownAfter(b Spiral) bool

KnownAfter is probabilistic. Returns true if r is known to be after b, and false if large counters are inequal (meaning r is before, equal, unrelated, or after)

func (Spiral) Previous

func (r Spiral) Previous(old *Spiral, limit int) ([]*Spiral, error)

func (Spiral) PreviousBudget

func (r Spiral) PreviousBudget(old *Spiral, discrepencyBudget, limit int) ([]*Spiral, error)

func (Spiral) Summary

func (r Spiral) Summary() string

type Store

type Store interface {
	PutRatchet(ctx context.Context, name string, ratchet *Spiral) (updated bool, err error)
	OldestKnownRatchet(ctx context.Context, name string) (*Spiral, error)
	ForEach(ctx context.Context, visit func(name string, ratchet *Spiral) error) error
	Flush() error
}

func NewMemStore

func NewMemStore(ctx context.Context) Store

func NewStore

func NewStore(ctx context.Context, path string) (Store, error)

Jump to

Keyboard shortcuts

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