inmemory

package
v0.11.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package inmemory is the in-memory database using b-trees.

Index

Constants

Name is the storage type name for inmemory backend.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB is an in-memory database of records using b-trees.

func NewDB

func NewDB(recordType string, btreeDegree int) *DB

NewDB creates a new in-memory database for the given record type.

func (*DB) ClearDeleted

func (db *DB) ClearDeleted(_ context.Context, cutoff time.Time)

ClearDeleted clears all the currently deleted records older than the given cutoff.

func (*DB) Close added in v0.11.0

func (db *DB) Close() error

Close closes the database. Any watchers will be closed.

func (*DB) Delete

func (db *DB) Delete(_ context.Context, id string) error

Delete marks a record as deleted.

func (*DB) Get

func (db *DB) Get(_ context.Context, id string) (*databroker.Record, error)

Get gets a record from the db.

func (*DB) GetAll

func (db *DB) GetAll(_ context.Context) ([]*databroker.Record, error)

GetAll gets all the records in the db.

func (*DB) List

func (db *DB) List(_ context.Context, sinceVersion string) ([]*databroker.Record, error)

List lists all the changes since the given version.

func (*DB) Put

func (db *DB) Put(_ context.Context, id string, data *anypb.Any) error

Put replaces or inserts a record in the db.

func (*DB) Watch

func (db *DB) Watch(ctx context.Context) <-chan struct{}

Watch returns the underlying signal.Signal binding channel to the caller. Then the caller can listen to the channel for detecting changes.

Jump to

Keyboard shortcuts

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