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:
objectAn 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
Storefacade.The interface is fairly simple: For the data entities that exist in the TiddlyWeb system there (optionally) exists
<entity>_put,<entity>_getand<entity>_deletemethods.When
<entity>_getis 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(), andlist_tiddler_revisions()that provide methods for getting a collection.It is useful to understand the classes in the
tiddlyweb.modelpackage when implementing new StorageInterface classes.If a method is not implemented by the StorageInterface a
StoreMethodNotImplementedexception 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.-
list_tiddler_revisions(tiddler)¶ Retrieve a list of all the revision identifiers for the one
tiddler.
-
search(search_query)¶ Search the entire
tiddlerstore forsearch_query.How search operates is entirely dependent on the StorageInterface implementation. The only requirement is that an iterator of tiddler objects is returned.
-
tiddler_get(tiddler)¶ Get a tiddler from the store, returning a populated tiddler object.
tiddler.creatorandtiddler.createdare based on the modifier and modified of the first revision of a tiddler.
-
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.StorageInterfaceA
StorageInterfacewhich stores text-based representations in a collection of directories and files.Some of the entities are serialized to and from text by the
textSerializer.-
search(search_query)¶ Search in the store for
tiddlersthat matchsearch_query. This is intentionally implemented as a simple and limited grep through files.
-