dbset

package
v1.7.9 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBSet

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

DBSet is an implementation of rangesync.OrderedSet that uses an SQL database as its backing store. It uses an FPTree to perform efficient range queries.

func NewDBSet

func NewDBSet(
	db sql.Executor,
	st *sqlstore.SyncedTable,
	keyLen, maxDepth int,
) *DBSet

NewDBSet creates a new DBSet.

func (*DBSet) Add

func (d *DBSet) Add(k rangesync.KeyBytes) error

Add adds an item to the DBSet. Implements rangesync.OrderedSet.

func (*DBSet) Advance

func (d *DBSet) Advance() error

Advance advances the DBSet to the latest state of the underlying database table.

func (*DBSet) Empty

func (d *DBSet) Empty() (bool, error)

Empty returns true if the DBSet is empty. Implements rangesync.OrderedSet.

func (*DBSet) EnsureLoaded

func (d *DBSet) EnsureLoaded() error

EnsureLoaded ensures that the DBSet is loaded and ready to be used. Implements rangesync.OrderedSet.

func (*DBSet) GetRangeInfo

func (d *DBSet) GetRangeInfo(x, y rangesync.KeyBytes) (rangesync.RangeInfo, error)

GetRangeInfo returns information about the range of items in the DBSet. Implements rangesync.OrderedSet.

func (*DBSet) Has

func (d *DBSet) Has(k rangesync.KeyBytes) (bool, error)

Has returns true if the DBSet contains the given item. Implements rangesync.OrderedSet.

func (*DBSet) Items

func (d *DBSet) Items() rangesync.SeqResult

Items returns a sequence of all items in the DBSet. Implements rangesync.OrderedSet.

func (*DBSet) Loaded added in v1.7.9

func (d *DBSet) Loaded() bool

Loaded returns true if the DBSet is loaded. Implements rangesync.OrderedSet.

func (*DBSet) Receive

func (d *DBSet) Receive(k rangesync.KeyBytes) error

Receive handles a newly received item, arranging for it to be returned as part of the sequence returned by Received. Implements rangesync.OrderedSet.

func (*DBSet) Received

func (d *DBSet) Received() rangesync.SeqResult

Received returns a sequence of all items that have been received. Implements rangesync.OrderedSet.

func (*DBSet) Recent

func (d *DBSet) Recent(since time.Time) (rangesync.SeqResult, int)

Recent returns a sequence of items that have been added to the DBSet since the given time. Implements rangesync.OrderedSet.

func (*DBSet) SplitRange

func (d *DBSet) SplitRange(x, y rangesync.KeyBytes, count int) (rangesync.SplitInfo, error)

SplitRange splits the range of items in the DBSet into two parts, returning information about eachn part and the middle item. Implements rangesync.OrderedSet.

func (*DBSet) WithCopy added in v1.7.9

func (d *DBSet) WithCopy(ctx context.Context, toCall func(rangesync.OrderedSet) error) error

WithCopy invokes the specified function, passing it a temporary copy of the DBSet. Implements rangesync.OrderedSet.

Jump to

Keyboard shortcuts

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