bolt

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package bolt implements inmem resource collection backing store in BoltDB (github.com/etcd-io/bbolt).

Example
Output:

example-resource-id
error getting resource: resource testResource(persistent/non-existent-resource@undefined) doesn't exist

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackingStore

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

BackingStore implements inmem.BackingStore using BoltDB.

Layout of the database:

  -> top-level bucket: $namespace
	 	-> bucket: $resourceType
			-> key: $resourceID
			-> value: marshaled resource

func NewBackingStore

func NewBackingStore(opener func() (*bbolt.DB, error), marshaler store.Marshaler) (*BackingStore, error)

NewBackingStore opens the BoltDB store with the given marshaler.

func (*BackingStore) Close

func (store *BackingStore) Close() error

Close the database.

func (*BackingStore) WithNamespace

func (store *BackingStore) WithNamespace(namespace resource.Namespace) *NamespacedBackingStore

WithNamespace returns an implementation of inmem.BackingStore interface for a given namespace.

type NamespacedBackingStore

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

NamespacedBackingStore implements inmem.BackingStore for a given namespace.

func (*NamespacedBackingStore) Destroy

func (store *NamespacedBackingStore) Destroy(_ context.Context, resourceType resource.Type, ptr resource.Pointer) error

Destroy implements inmem.BackingStore.

func (*NamespacedBackingStore) Load

func (store *NamespacedBackingStore) Load(_ context.Context, handler inmem.LoadHandler) error

Load implements inmem.BackingStore.

func (*NamespacedBackingStore) Put

func (store *NamespacedBackingStore) Put(_ context.Context, resourceType resource.Type, res resource.Resource) error

Put implements inmem.BackingStore.

Jump to

Keyboard shortcuts

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