stores Package

stores Package

Storage systems for TiddlyWeb.

The base class and Interface for classes used to get and put data into a storage system.

class tiddlyweb.stores.StorageInterface(store_config=None, environ=None)

Bases: object

An implementation of the StorageInterface is a collection of methods that either store an object or retrieve an object. It is not usually access directly but instead called through a Store facade.

The interface is fairly simple: For the data entities that exist in the TiddlyWeb system there (optionally) exists <entity>_put, <entity>_get and <entity>_delete methods.

When <entity>_get is used, an empty object is provided. This object is filled by the store method.

There are also five supporting methods, list_recipes(), list_bags(), list_users(), list_bag_tiddlers(), and list_tiddler_revisions() that provide methods for getting a collection.

It is useful to understand the classes in the tiddlyweb.model package when implementing new StorageInterface classes.

If a method is not implemented by the StorageInterface a StoreMethodNotImplemented exception is raised and the calling code is expected to handle that intelligently.

It is somewhat common to not implement list_tiddler_revisions(). When this is done it means the instance does not support revisions.

bag_delete(bag)

Remove bag from the store, including the tiddlers contained by the bag.

bag_get(bag)

Get the indicated bag from the store.

bag_put(bag)

Put bag into the store.

list_bag_tiddlers(bag)

Retrieve a list of all tiddler objects in the named bag.

list_bags()

Retrieve a list of all bag objects in the system.

list_recipes()

Retrieve a list of all recipe objects in the system.

list_tiddler_revisions(tiddler)

Retrieve a list of all the revision identifiers for the one tiddler.

list_users()

Retrieve a list of all user objects in the system.

recipe_delete(recipe)

Remove the recipe from the store, with no impact on the recipe’s tiddlers.

recipe_get(recipe)

Get the indicated recipe from the store.

recipe_put(recipe)

Put recipe into the store.

search(search_query)

Search the entire tiddler store for search_query.

How search operates is entirely dependent on the StorageInterface implementation. The only requirement is that an iterator of tiddler objects is returned.

tiddler_delete(tiddler)

Delete tiddler (and all its revisions) from the store.

tiddler_get(tiddler)

Get a tiddler from the store, returning a populated tiddler object. tiddler.creator and tiddler.created are based on the modifier and modified of the first revision of a tiddler.

tiddler_put(tiddler)

Put tiddler into the store.

user_delete(user)

Delete user from the store.

This will remove the user object but has no impact on other entities which may have been modified by the user.

user_get(user)

Get user from the store.

user_put(user)

Put user into the store.

text Module

A text-based StorageInterface that stores entities in a hierarchy of directories in the filesystem.

class tiddlyweb.stores.text.Store(store_config=None, environ=None)

Bases: tiddlyweb.stores.StorageInterface

A StorageInterface which stores text-based representations in a collection of directories and files.

Some of the entities are serialized to and from text by the text Serializer.

bag_delete(bag)

Delete bag and the tiddlers within from the system.

bag_get(bag)

Fill bag with data from the store.

bag_put(bag)

Put bag into the store.

list_bag_tiddlers(bag)

List all the tiddlers in the provided bag.

list_bags()

List all the bags in the store.

list_recipes()

List all the recipes in the store.

list_tiddler_revisions(tiddler)

List all the revisions of one tiddler, returning a list of ints.

list_users()

List all the users in the store.

recipe_delete(recipe)

Remove a recipe, irrevocably, from the system. No impact on tiddlers.

recipe_get(recipe)

Fill recipe with data in the store.

recipe_put(recipe)

Put recipe into the store.

search(search_query)

Search in the store for tiddlers that match search_query. This is intentionally implemented as a simple and limited grep through files.

tiddler_delete(tiddler)

Irrevocably remove tiddler from the filesystem.

tiddler_get(tiddler)

Fill tiddler with data from the store.

tiddler_put(tiddler)

Write a tiddler into the store. We only write if the tiddler’s bag already exists. Bag creation is a separate action.

user_delete(user)

Delete user from the store.

user_get(user)

Fill user with data from the store.

user_put(user)

Put user data into the store.