libbe.storage.base
¶
Abstract bug repository data storage to easily support multiple backends.
-
exception
libbe.storage.base.
ConnectionError
¶
-
exception
libbe.storage.base.
DirectoryNotEmpty
¶
-
exception
libbe.storage.base.
EmptyCommit
¶
-
class
libbe.storage.base.
Entry
(id, value=<class 'libbe.storage.base._EMPTY'>, parent=None, directory=False, children=None)¶ Methods
append
L.append(object) – append object to end branch_len
()Return the largest number of nodes from root to leaf (inclusive). count
(…)extend
L.extend(iterable) – extend list by appending elements from the iterable has_descendant
(descendant[, depth_first, …])Check if a node is contained in a tree. index
((value, [start, …)Raises ValueError if the value is not present. insert
L.insert(index, object) – insert object before index pop
(…)Raises IndexError if list is empty or index is out of range. remove
L.remove(value) – remove first occurrence of value. reverse
L.reverse() – reverse IN PLACE sort
(*args, **kwargs)Sort the tree recursively. thread
([flatten])Generate a (depth, node) tuple for every node in the tree. traverse
([depth_first])Generate all the nodes in a tree, starting with the root node.
-
exception
libbe.storage.base.
InvalidDirectory
¶
-
exception
libbe.storage.base.
InvalidID
(id=None, revision=None, msg=None)¶
-
exception
libbe.storage.base.
InvalidRevision
¶
-
exception
libbe.storage.base.
InvalidStorageVersion
(active_version, expected_version=None)¶
-
exception
libbe.storage.base.
NotReadable
(msg)¶
-
exception
libbe.storage.base.
NotWriteable
(msg)¶
-
class
libbe.storage.base.
Storage
(repo='/', encoding='utf-8', options=None)¶ This class declares all the methods required by a Storage interface. This implementation just keeps the data in a dictionary and uses pickle for persistent storage.
Methods
add
(id, *args, **kwargs)Add an entry ancestors
(*args, **kwargs)Return a list of the specified entry’s ancestors’ ids. children
(*args, **kwargs)Return a list of specified entry’s children’s ids. connect
()Open a connection to the repository. destroy
()Remove the storage repository. disconnect
()Close the connection to the repository. exists
(*args, **kwargs)Check an entry’s existence get
(*args, **kwargs)Get contents of and entry as they were in a given revision. init
()Create a new storage repository. is_readable
()is_writeable
()recursive_remove
(*args, **kwargs)Remove an entry and all its decendents. remove
(*args, **kwargs)Remove an entry. set
(id, value, *args, **kwargs)Set the entry contents. storage_version
([revision])Return the storage format for this backend. version
()Return a version string for this backend. -
add
(id, *args, **kwargs)¶ Add an entry
-
ancestors
(*args, **kwargs)¶ Return a list of the specified entry’s ancestors’ ids.
-
children
(*args, **kwargs)¶ Return a list of specified entry’s children’s ids.
-
connect
()¶ Open a connection to the repository.
-
destroy
()¶ Remove the storage repository.
-
disconnect
()¶ Close the connection to the repository.
-
exists
(*args, **kwargs)¶ Check an entry’s existence
-
get
(*args, **kwargs)¶ Get contents of and entry as they were in a given revision. revision==None specifies the current revision.
If there is no id, return default, unless default is not given, in which case raise InvalidID.
-
init
()¶ Create a new storage repository.
-
is_readable
()¶
-
is_writeable
()¶
-
name
= 'Storage'¶
-
recursive_remove
(*args, **kwargs)¶ Remove an entry and all its decendents.
-
remove
(*args, **kwargs)¶ Remove an entry.
-
set
(id, value, *args, **kwargs)¶ Set the entry contents.
-
storage_version
(revision=None)¶ Return the storage format for this backend.
-
version
()¶ Return a version string for this backend.
-
-
class
libbe.storage.base.
VersionedStorage
(*args, **kwargs)¶ This class declares all the methods required by a Storage interface that supports versioning. This implementation just keeps the data in a list and uses pickle for persistent storage.
Methods
add
(id, *args, **kwargs)Add an entry ancestors
(*args, **kwargs)Return a list of the specified entry’s ancestors’ ids. changed
(revision)Return a tuple of lists of ids (new, modified, removed) from the specified revision to the current situation. children
(*args, **kwargs)Return a list of specified entry’s children’s ids. commit
(*args, **kwargs)Commit the current repository, with a commit message string summary and body. connect
()Open a connection to the repository. destroy
()Remove the storage repository. disconnect
()Close the connection to the repository. exists
(*args, **kwargs)Check an entry’s existence get
(*args, **kwargs)Get contents of and entry as they were in a given revision. init
()Create a new storage repository. is_readable
()is_writeable
()recursive_remove
(*args, **kwargs)Remove an entry and all its decendents. remove
(*args, **kwargs)Remove an entry. revision_id
([index])Return the name of the <index>th revision. set
(id, value, *args, **kwargs)Set the entry contents. storage_version
([revision])Return the storage format for this backend. version
()Return a version string for this backend. -
changed
(revision)¶ Return a tuple of lists of ids (new, modified, removed) from the specified revision to the current situation.
-
commit
(*args, **kwargs)¶ Commit the current repository, with a commit message string summary and body. Return the name of the new revision.
If allow_empty == False (the default), raise EmptyCommit if there are no changes to commit.
-
name
= 'VersionedStorage'¶
-
revision_id
(index=None)¶ Return the name of the <index>th revision. The choice of which branch to follow when crossing branches/merges is not defined. Revision indices start at 1; ID 0 is the blank repository.
Return None if index==None.
If the specified revision does not exist, raise InvalidRevision.
-