module Seqdb_archive:Archives of element files ("gar" format)sig..end
If an archive is opened for reading, the elements are read from the end to the beginning. If a name occurs several times in the archive, the entry is found that is stored last.
Archives can only be modified by appending new elements at the end.
Archives can be stored in three ways:
Seqdb_fsys_ht user-space file system. There is no
additional locking in this case as the file system module already
performs adequate locking.
Conventionally, the file suffix for these archives is "gar". If stored
in a file system, the file type 'a' is used, but not name suffix.
type t
typemode =[ `Rdonly | `Rdwr | `Rdwr_exclusive ]
`Rdonly: only for reading`Rdwr: for reading and writing (appending)`Rdwr_exclusive: as `Rdwr, but the file is write-locked before
it is accessed. If another writer already locks the file, it is waited
until the lock can be acquired from the other writer. This mode is
only available if the archive is stored as regular file.
It is generally not required to lock files for reading.
type entry
type properties = {
|
entry_name : |
(* | unique name of the entry | *) |
|
entry_timestamp : |
(* | timestamp when the entry was added | *) |
|
entry_gzip : |
(* | whether the entry is stored compressed | *) |
|
entry_comment : |
(* | an arbitrary comment string | *) |
val openfile : mode -> string -> tmode=`Rdwr the file is created if not yet existingval openfile_filesys : 'a Seqdb_fsys_types.file_system ->
mode -> string -> tmode=`Rdwr the file is created if not yet existing.
mode=`Rdwr_exclusive is handled like `Rdwr.val openstring : string -> t`Rdonly)val close : t -> unitval contents : t -> entry listval info : entry -> propertiesval read : entry -> Netchannels.in_obj_channelval append : t ->
string -> int64 -> bool -> bool -> string -> Netchannels.out_obj_channellet ch = append arch entry_name entry_timestamp entry_gzip data_gzip comment:
Appends data to
the archive. The data must be written to the returned ch, and ch
must be closed (using close_out) afterwards.
entry_gzip says whether the entry is to be stored compressed.
data_gzip says whether the data written to the out_obj_channel
are already compressed.
Limitation: If data_gzip && not entry_gzip, the decompression is fully
done in memory, not chunk by chunk as for the other combinations.
It is only possible to append one entry or to read one entry at a time,
i.e. the next entry cannot be added or read before all data for the
previous are written or read and ch is closed.
val keep_page_cache_clean : t -> unitt from the page cache. Applies only if
t is a file