Other decorators

class minimalkv.decorator.PrefixDecorator(prefix: str, store: KeyValueStore)

Prefixes any key with a string before passing it on the decorated store.

Automatically strips the prefix upon key retrieval.

Parameters

storeKeyValueStore

The store to pass keys on to.

prefixstr

Prefix to add.

class minimalkv.decorator.URLEncodeKeysDecorator(store: KeyValueStore)

URL-encodes keys before passing them on to the underlying store.

class minimalkv.decorator.ReadOnlyDecorator(store: KeyValueStore)

A read-only view of an underlying minimalkv store.

Provides only access to the following methods/attributes of the underlying store: get, iter_keys, keys, open, get_file and __contains__. Accessing any other method will raise AttributeError.

Note that the original store for read / write can still be accessed, so using this class as a wrapper only provides protection against bugs and other kinds of unintentional writes; it is not meant to be a real security measure.