datastore

package
v0.0.0-...-b0deb01 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type T

type T[K dsobj] struct {
	// contains filtered or unexported fields
}

T is a file-backed key-value store.

func NewDataStore

func NewDataStore[K dsobj](rng uo.RandomSource) *T[K]

NewDataStore initializes and returns a new DataStore object.

func (*T[K]) Add

func (s *T[K]) Add(k K, t uo.SerialType)

Add adds a new object to the datastore assigning it a new serial of the correct type.

func (*T[K]) Data

func (s *T[K]) Data() map[uo.Serial]K

Data returns the underlying data store.

func (*T[K]) Get

func (s *T[K]) Get(serial uo.Serial) K

Get returns the identified object or nil.

func (*T[K]) Insert

func (s *T[K]) Insert(k K)

Insert inserts the object into the datastore with its current serial and will overwrite existing values without warning. This is typically only used when rebuilding the dataset from an external data source.

func (*T[K]) Remove

func (s *T[K]) Remove(o dsobj)

Remove blindly removes the object from the datastore that is indexed by this object's serial.

Jump to

Keyboard shortcuts

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