dictdb

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store provides access to dictionary storage backed by a TreeDB backend.

func New

func New(backend *db.DB) *Store

New wraps an existing backend.

func Open

func Open(path string, opts db.Options) (*Store, error)

Open opens a dictdb backend at path and returns a Store.

func (*Store) Close

func (s *Store) Close() error

Close closes the underlying backend.

func (*Store) GetCurrent

func (s *Store) GetCurrent(_ context.Context) (uint64, error)

GetCurrent returns the current dictionary ID or 0 if unset.

func (*Store) GetCurrentForClass added in v0.4.0

func (s *Store) GetCurrentForClass(ctx context.Context, class string) (uint64, error)

GetCurrentForClass returns the current dictionary ID for a payload class. Empty class and aliases "single"/"default" fall back to the legacy global current marker.

func (*Store) GetDictBytes

func (s *Store) GetDictBytes(_ context.Context, dictID uint64) ([]byte, error)

GetDictBytes returns the dictionary bytes for dictID.

func (*Store) GetK

func (s *Store) GetK(ctx context.Context, dictID uint64) (int, error)

GetK loads the preferred frame group size (K) for dictID. Returns 0 when unset.

func (*Store) PutDictBytes

func (s *Store) PutDictBytes(ctx context.Context, dictBytes []byte) (uint64, error)

PutDictBytes inserts dict bytes (deduped by hash) and returns its dictID.

func (*Store) SetCurrent

func (s *Store) SetCurrent(ctx context.Context, dictID uint64) error

SetCurrent marks dictID as the current dictionary.

func (*Store) SetCurrentForClass added in v0.4.0

func (s *Store) SetCurrentForClass(ctx context.Context, class string, dictID uint64) error

SetCurrentForClass marks dictID as the current dictionary for a payload class. Empty class and aliases "single"/"default" use the legacy global current key. A dictID of 0 clears the class marker via DeleteSync.

func (*Store) SetK

func (s *Store) SetK(ctx context.Context, dictID uint64, k int) error

SetK stores the preferred frame group size (K) for dictID.

Jump to

Keyboard shortcuts

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