lmdb

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: Unlicense Imports: 22 Imported by: 18

Documentation

Index

Constants

View Source
const (
	DB_VERSION byte = 'v'
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LMDBBackend

type LMDBBackend struct {
	Path               string
	MaxLimit           int
	MaxLimitNegentropy int
	MapSize            int64

	EnableHLLCacheFor func(kind int) (useCache bool, skipSavingActualEvent bool)
	// contains filtered or unexported fields
}

func (*LMDBBackend) Close

func (b *LMDBBackend) Close()

func (*LMDBBackend) Compact added in v0.14.2

func (b *LMDBBackend) Compact(tmppath string) error

Compact can only be called when the database is not being used because it will overwrite everything. It will temporarily move the database to a new location, then move it back. If something goes wrong crash the process and look for the copy of the data on tmppath.

func (*LMDBBackend) CountEvents

func (b *LMDBBackend) CountEvents(ctx context.Context, filter nostr.Filter) (int64, error)

func (*LMDBBackend) CountEventsHLL added in v0.14.1

func (b *LMDBBackend) CountEventsHLL(ctx context.Context, filter nostr.Filter, offset int) (int64, *hyperloglog.HyperLogLog, error)

CountEventsHLL is like CountEvents, but it will build a hyperloglog value while iterating through results, following NIP-45

func (*LMDBBackend) DeleteEvent

func (b *LMDBBackend) DeleteEvent(ctx context.Context, evt *nostr.Event) error

func (*LMDBBackend) Init

func (b *LMDBBackend) Init() error

func (*LMDBBackend) QueryEvents

func (b *LMDBBackend) QueryEvents(ctx context.Context, filter nostr.Filter) (chan *nostr.Event, error)

func (*LMDBBackend) ReplaceEvent added in v0.14.2

func (b *LMDBBackend) ReplaceEvent(ctx context.Context, evt *nostr.Event) error

func (*LMDBBackend) SaveEvent

func (b *LMDBBackend) SaveEvent(ctx context.Context, evt *nostr.Event) error

func (*LMDBBackend) Serial

func (b *LMDBBackend) Serial() []byte

Jump to

Keyboard shortcuts

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