index¶
-
class
PimarcIndex
[source]¶ Bases:
object
Simple index to accompany a Pimarc, stored along with the .prc file as a .prci file. Provides a list of the filenames in the archive, along with the starting byte of the file’s metadata and data.
filenames is an OrderedDict mapping filename -> (metadata start byte, data start byte).
-
class
PimarcIndexAppender
(store_path, mode='w')[source]¶ Bases:
object
Class for writing out a Pimarc index as each file is added to the archive. This is used by the Pimarc writer, instead of creating a PimarcIndex and calling save(), so that the index is always kept up to date with what’s in the archive.
Mode may be “w” to write a new index or “a” to append to an existing one.
-
reindex
(pimarc_path)[source]¶ Rebuild the index of a Pimarc archive from its data file (.prc).
Stores the new index in the correct location (.prci), overwriting any existing index.
Parameters: pimarc_path – path to the .prc file Returns: the PimarcIndex