version_id
)
before it can invoke save() again for the same object which can take quite some time if
save() is sync - especially if other activities are saving at the same time.tree_id
?tree_id
and/or version_id?
tree_id
duplicate detection/optimizationtree_id
version_id
tree_id
but unique on its own, potentially across systems (UUID).parent_id
version_id
of the parent of an object, set by datastore. Empty for the root of the
ancestry graph.ctime
bundle_id
bundle_id
of the
Activity template associated with the entry. Only set for session continuation objects. Will be used
for resuming the session.entry_type
action
and object
. Intended for use by Journal for implementing
action-oriented view.creator
bundle_id
of the Activity template the entry has been created by (e.g.
org.laptop.WebActivity
for downloaded files).mime_type
create(properties, filename, transfer_ownership)
properties
, returns uid
/ object_id
.
If transfer_ownership
is False the data store will make a copy of the file. Metadata storage and index update
is synchronous and while file storage and optimizer run in a separate thread, the API call actually only returns
after everything is done (including emitting a Created(uid)
signal) and thus is fully synchronous.
Returns uid
(object_id
).
update(uid, properties, filename, transfer_ownership)
uid
(object_id
). Similar to create()
Metadata storage and index update is synchronous,
file storage and optimizer run in a separate thread, but the API call only returns after everything is done, including
emitting an Updated(uid)
signal. Doesn't return anything.
delete(uid)
Deleted(uid)
.get_properties(uid)
get_filename(uid)
find(query, properties)
query
in the index, returning the values of the requested properties
.
If the index is unavailable, all entries are returned (but taking limit
and offset
into account). query
is a dictionary and may contain propertyname=value
mappings
(that are directly matched against metadata - only timestamp
(with a range), uid
,
activity
, activity_id
, keep
and mime_type
are supported so far)
in addition to values for limit
(max. number of results), offset
(skip given number of results) and
query
("full-text" search in all properties). Returns estimated number of matching entries (not affected by
limit
and offset
) and requested metadata for matching entries.
Journal passes sort=-mtime
in query; datastore currently ignores it (but sorts by timestamp anyway).
get_uniquevaluesfor(propertyname, query)
propertyname='activity'
and
query=None
, so a list of all activities (activity
/ bundle_id
) is returned.mount(uri, options)
unmount(mount_point_id)
mounts()
Stopped()
save(tree_id, parent_id, metadata, path, delete_after)
Submit new version (data and/or metadata) of the given object, returns tree_id
, child_id
.
parent_id
and child_id
are the version_id
of the predecessor resp. the
to-be-saved entry.
If tree_id
is empty parent_id
must be empty as well and both will be newly allocated
(equivalent to create() in previous API). If only parent_id
is empty there must not be any entry
with the same tree_id
already in datastore.
Actual file storage and index update happen asynchronously, emitting the
signal Saved(tree_id, parent_id, child_id)
on completion.
If path
is non-empty it designates a file or directory containing the data and the
parent must contain of the same type (file / directory; not metadata-only), if a parent exists at all.
If path
is empty and the parent contained data then a metadata-only update is performed,
reusing the data of the parent. If both parent_id
and path
are empty a
metadata-only entry is created.
If delete_after
is True the contents of path
are deleted
after they have been committed, but before sending the signal.
change_metadata(tree_id, version_id, metadata)
metadata
.
Fully synchronous, no return value. Emits signal
ChangedMetadata(tree_id, version_id, metadata)
.
delete(tree_id)
Deleted(tree_id)
.get_data(tree_id, version_id)
GotData(sender, tree_id, version_id, path)
where sender
is the bus name of
the sender.
find(query, options)
query
and returns output according to options
,
including the number of matches (unaffected by limit
) and the
tree_id
/ version_id
of each entry.
query
is a dictionary with metadata names as keys and
either basic types (exact/wildcard match), 2-tuples (range) or a list (multiple exact/wildcard matches)
as values. Prefixing a key name with '!'
inverts the sense of matching, OPTIONAL: prefixing it with '*' enables regular expression search (slow).
An empty dictionary matches everything. Arbitrary key names are allowed, but speed
may vary (i.e. not everything is indexed).
options
is a dictionary which may contain values for the following keys:
metadata
all_versions
sort
metadata
);
prefix '+' for ascending order, prefix '-' for descending order; default is
undefined, potentially by relevancelimit
offset
offset
textsearch(querystring, query, options)
querystring
is passed to Xapians query parser; query
and options
are interpreted like for find()
. Returns the same format as find()
.
find_unique_values(query, metadata_name)
find(...)
, but returns the set of unique values for the requested
metadata name.
check_ready()
Ready()
Stopped()
Ready()
before
starting to issue any API call (except check_ready()
).