prefix

package
v0.1.6-0...-5c25bcb Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const StorageKIDPrefix = "k"

StorageKIDPrefix is the KID prefix for key IDs (used by localkms).

Variables

This section is empty.

Functions

This section is empty.

Types

type StorePrefixWrapper

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

StorePrefixWrapper is a wrapper store that prepends IDPrefix to IDs. IDs will be stored in the embedded store with IDPrefix as prefix while the user of this wrapper store will interact the original unchanged ID.

func NewPrefixStoreWrapper

func NewPrefixStoreWrapper(store storage.Store, prefix string) (*StorePrefixWrapper, error)

NewPrefixStoreWrapper creates a new StorePrefixWrapper of store.

func (*StorePrefixWrapper) Delete

func (b *StorePrefixWrapper) Delete(k string) error

Delete will delete a record with k by prefixing it with IDPrefix first.

func (*StorePrefixWrapper) Get

func (b *StorePrefixWrapper) Get(k string) ([]byte, error)

Get fetches the record based on k by first prefixing it with IDPrefix.

func (*StorePrefixWrapper) Iterator

func (b *StorePrefixWrapper) Iterator(startKey, endKey string) storage.StoreIterator

Iterator returns an iterator for the latest snapshot of the underlying store.

Args:

startKey: Start of the key range, include in the range by converting it from base64 to IDPrefix encoded value first. endKey: End of the key range, not include in the range by converting it from base64 to IDPrefix encoded value first.

Returns:

StoreIterator: a wrapped iterator for result range.

func (*StorePrefixWrapper) Put

func (b *StorePrefixWrapper) Put(k string, v []byte) error

Put stores v with k ID by prefixing it with IDPrefix.

Jump to

Keyboard shortcuts

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