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()
, andlist_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.-
list_tiddler_revisions
(tiddler)¶ Retrieve a list of all the revision identifiers for the one
tiddler
.
-
search
(search_query)¶ Search the entire
tiddler
store 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.creator
andtiddler.created
are 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.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
.-
search
(search_query)¶ Search in the store for
tiddlers
that matchsearch_query
. This is intentionally implemented as a simple and limited grep through files.
-