Previous topic

pJSON (persistent json)

Next topic

vesper.app

This Page

vesper.data.DataStore

This module defined the high-level public interface to a data store.

class vesper.data.DataStore.BasicStore(requestProcessor, model_factory=None, schemaFactory=<class 'vesper.data.base.schema.BaseSchema'>, storage_path='', storage_template='', storage_template_path='', application_model='', transaction_log='', save_history=False, version_storage_path='', version_model_factory=None, storage_template_options=None, model_options=None, trunk_id='0A', branch_id=None, replication_hosts=None, replication_channel=None, send_stomp_ack=True, **kw)

Provides transacted operations on the underlying data store.

create(adds)

Adds data to the store. If the id of any resource is already present in the datastore an exception is raised.

adds: A list of either statements or pjson conforming dicts

isDirty(txnService)
return True if this transaction participant was modified
remove(removes)

Removes data from the store.

removes: A list of a statements or list containing pjson-conforming dicts and strings.

If the item is a string it will be treated as an object reference and the entire resource will be removed. If the object is a dict, the specified property/value pairs will be removed from the store, unless the value is null. In that case, the property and all associated values will be deleted.

replace(replacements)

Replace the given objects in the store. Unlike update this method will remove properties in the store that aren’t specified. Also, if the data contains json object and an object has no properties (just an id property), the object will be removed.

See also update and updateAll.

replacements: A list of either statements or pjson conforming dicts

update(updates)

Update the store by either adding or replacing the property value pairs given in the update, depending on whether or not the pair currently appears in the store.

See also replace.

updates: A list of either statements or pjson conforming dicts

updateAll(update, replace, removedResources=None)

Add, remove, update, or replace resources in the store.

update: A list of either statements or pjson conforming dicts that will be processed with the same semantics as the update method.

replace: A list of either statements or pjson conforming dicts that will be processed with the same semantics as the replace method.

removedResources: A list of ids of resources that will be removed from the store.

class vesper.data.DataStore.DataStore(requestProcessor, **kw)

Abstract interface for DataStores

getStateKey()
Returns the a hashable object that uniquely identifies the current state of this datastore. Used for caching. If this is not implemented, it should raise KeyError (the default implementation).
exception vesper.data.DataStore.DataStoreError
Base DataStore error
class vesper.data.DataStore.TwoPhaseTxnGraphManagerAdapter(graph)

Each underlying model is a wrapped with a TwoPhaseTxnModelAdapter if necessary. This must be be listed before those participants

isDirty(txnService)
return True if this transaction participant was modified
class vesper.data.DataStore.TwoPhaseTxnModelAdapter(model)

Adapts models which doesn’t support transactions or only support simple (one-phase) transactions.

isDirty(txnService)
return True if this transaction participant was modified