negentropy

package
v0.49.7 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: MIT Imports: 9 Imported by: 4

README

this is a fork of https://github.com/illuzen/go-negentropy

Documentation

Index

Constants

View Source
const FingerprintSize = 16

Variables

View Source
var InfiniteBound = Bound{Item: Item{Timestamp: maxTimestamp}}

Functions

func EncodeVarInt added in v0.37.0

func EncodeVarInt(n int) []byte

func ItemCompare added in v0.37.0

func ItemCompare(a, b Item) int

Types

type Bound

type Bound struct{ Item }

func (Bound) String

func (b Bound) String() string

type Item

type Item struct {
	Timestamp nostr.Timestamp
	ID        string
}

func (Item) String

func (i Item) String() string

type Mode

type Mode uint8
const (
	SkipMode        Mode = 0
	FingerprintMode Mode = 1
	IdListMode      Mode = 2
)

func (Mode) String added in v0.36.1

func (v Mode) String() string

type Negentropy

type Negentropy struct {
	Haves    chan string
	HaveNots chan string
	// contains filtered or unexported fields
}

func New added in v0.37.0

func New(storage Storage, frameSizeLimit int) *Negentropy

func (*Negentropy) Name

func (n *Negentropy) Name() string

func (*Negentropy) Reconcile

func (n *Negentropy) Reconcile(msg string) (output string, err error)

func (*Negentropy) SplitRange

func (n *Negentropy) SplitRange(lower, upper int, upperBound Bound, output *StringHexWriter)

func (*Negentropy) Start added in v0.37.0

func (n *Negentropy) Start() string

func (*Negentropy) String added in v0.36.1

func (n *Negentropy) String() string

type Storage

type Storage interface {
	Size() int
	Range(begin, end int) iter.Seq2[int, Item]
	FindLowerBound(begin, end int, value Bound) int
	GetBound(idx int) Bound
	Fingerprint(begin, end int) string
}

type StringHexReader added in v0.36.1

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

func NewStringHexReader added in v0.36.1

func NewStringHexReader(source string) *StringHexReader

func (*StringHexReader) Len added in v0.36.1

func (r *StringHexReader) Len() int

func (*StringHexReader) ReadHexByte added in v0.36.1

func (r *StringHexReader) ReadHexByte() (byte, error)

func (*StringHexReader) ReadHexBytes added in v0.36.1

func (r *StringHexReader) ReadHexBytes(buf []byte) error

func (*StringHexReader) ReadString added in v0.36.1

func (r *StringHexReader) ReadString(size int) (string, error)

type StringHexWriter added in v0.36.1

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

func NewStringHexWriter added in v0.36.1

func NewStringHexWriter(buf []byte) *StringHexWriter

func (*StringHexWriter) Hex added in v0.36.1

func (r *StringHexWriter) Hex() string

func (*StringHexWriter) Len added in v0.36.1

func (r *StringHexWriter) Len() int

func (*StringHexWriter) Reset added in v0.36.1

func (r *StringHexWriter) Reset()

func (*StringHexWriter) WriteByte added in v0.36.1

func (r *StringHexWriter) WriteByte(b byte) error

func (*StringHexWriter) WriteBytes added in v0.36.1

func (r *StringHexWriter) WriteBytes(in []byte)

func (*StringHexWriter) WriteHex added in v0.36.1

func (r *StringHexWriter) WriteHex(hexString string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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