facilities for shared access to files
Facilities for shared access to files.
lockfile(path, ext=None, poll_interval=None, timeout=None)
A context manager which takes and holds a lock file.
path: the base associated with the lock file.
ext: the extension to the base used to construct the lock file name. Default:
timeout: maximum time to wait before failing, default None (wait forever).
poll_interval: polling frequency when timeout is not 0.
A base class to share a modifiable file between multiple users.
The use case was driven from the shared CSV files used by
cs.nodedb.csvdb.Backend_CSVFile, where multiple users can
read from a common CSV file, and coordinate updates with a
This presents the following interfaces:
__iter__: yields data chunks from the underlying file up to EOF; it blocks no more than reading from the file does. Note that multiple iterators share the same read pointer.
open: a context manager returning a writable file for writing updates to the file; it blocks reads from this instance (though not, of course, by other users of the file) and arranges that users of
__iter__do not receive their own written data, thus arranging that
__iter__returns only foreign file updates.
Subclasses would normally override
__iter__ to parse the
received data into their natural records.
A line oriented subclass of
Shared access to a CSV file in UTF-8 encoding.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size cs.sharedfile-20190102.tar.gz (5.5 kB)||File type Source||Python version None||Upload date||Hashes View|