Represents a list of filenames as returned by notmuch
Objects of this class implement the iterator protocol.
Note
The underlying library only provides a one-time iterator (it cannot reset the iterator to the start). Thus iterating over the function will “exhaust” the list of tags, and a subsequent iteration attempt will raise a NotInitializedError. Also note, that any function that uses iteration (nearly all) will also exhaust the tags. So both:
for name in filenames: print name
as well as:
number_of_names = len(names)
and even a simple:
#str() iterates over all tags to construct a space separated list
print(str(filenames))
will “exhaust” the Filenames. However, you can use Message.get_filenames() repeatedly to get fresh Filenames objects to perform various actions on filenames.
Parameters: |
|
---|
Represents a directory entry in the notmuch directory
Modifying attributes of this object will modify the database, not the real directory attributes.
The Directory object is usually derived from another object e.g. via Database.get_directory(), and will automatically be become invalid whenever that parent is deleted. You should therefore initialized this object handing it a reference to the parent, preventing the parent from automatically being garbage collected.
Parameters: |
|
---|
Gets a Filenames iterator listing all the filenames of messages in the database within the given directory.
The returned filenames will be the basename-entries only (not complete paths.
Gets a Filenames iterator listing all the filenames of sub-directories in the database within the given directory
The returned filenames will be the basename-entries only (not complete paths.
Gets the mtime value of this directory in the database
Retrieves a previously stored mtime for this directory.
Parameters: | mtime – A (time_t) timestamp |
---|---|
Raises : |
|
Sets the mtime value of this directory in the database
The intention is for the caller to use the mtime to allow efficient identification of new messages to be added to the database. The recommended usage is as follows:
Read the mtime of a directory from the filesystem
Call Database.add_message() for all mail files in the directory
Call notmuch_directory_set_mtime with the mtime read from the filesystem. Then, when wanting to check for updates to the directory in the future, the client can call get_mtime() and know that it only needs to add files if the mtime of the directory and files are newer than the stored timestamp.
Note
get_mtime() function does not allow the caller to distinguish a timestamp of 0 from a non-existent timestamp. So don’t store a timestamp of 0 unless you are comfortable with that.
Parameters: | mtime – A (time_t) timestamp |
---|---|
Raises : | XapianError a Xapian exception occurred, mtime not stored |
Raises : | ReadOnlyDatabaseError the database was opened in read-only mode so directory mtime cannot be modified |
Raises : | NotInitializedError the directory object has not been initialized |
Property that allows getting and setting of the Directory mtime (read-write)
See get_mtime() and set_mtime() for usage and possible exceptions.
Returns the absolute path of this Directory (read-only)