Module Rapids


module Rapids: sig .. end
Random Access Package Information Data Structure.

Provides a fast, indexed archive for working on historical metadata archives expressed in the NAPKIN format.


exception Conflicting_information of string
This exception is raised if the database gets non-unifiable, conflicting pieces of information.

type liquid =
| RPM
| Debian
| Pkgsrc
module type ORDERED_LITERATE = sig .. end
module type STRING_ORDERED_LITERATE = sig .. end
module Version_order: sig .. end
module Release_order: sig .. end
module type SET = sig .. end
module type ID = sig .. end
module type INDEX = sig .. end
module type DOUBLE_INDEX = sig .. end
module type VERSION_POOL = sig .. end
module type LABELED_INDEX = sig .. end
module type CHRONOLOGICAL_MAP = sig .. end
type archive_name = string 
An archive name is a list of strings intended to identify a component such as debian/stable/main/i386 by a list like ["debian";"stable";"main";"i386"]. However it is up to the user to enforce constraints such as homogeneity of a given archive with respect to architecture.
type architecture_name = string 
type unit_name = string 
type version_name = string 
type source_name = unit_name * version_name 
type source_version_name = version_name 
type version_number 
A comparable version number
type release_number 
type version_id 
The following are opaque, but unique IDs
type release_id 
type unit_id 
type source_id 
type architecture_id 
type package_id 
type archive_id 
type glob = string 
type archive 
An archive is a map from dates to sets of packages.
module Architecture_name: ORDERED_LITERATE  with type   t = architecture_name
Architectures, units and versions are indexed for reducing memory usage and allowing for fast set operations.
module Architecture_index: INDEX             with type elt = architecture_name and type id = architecture_id
module Unit_name: ORDERED_LITERATE  with type   t = unit_name
module Package_ID: ID                with type id  = package_id
module Package_set: SET               with type elt = package_id
module Unit_index: LABELED_INDEX     with type elt = unit_name and type id = unit_id
module Unit_set: SET               with type elt = unit_id
module Source_name: ORDERED_LITERATE  with type   t = source_name
module Source_index: INDEX             with type elt = source_name and type id = source_id
module Source_set: SET               with type elt = source_id
module Version_index: VERSION_POOL      with type version = string and type id = version_id and type handle = version_number
module Release_index: VERSION_POOL      with type version = string option and type id = release_id and type handle = release_number
module Archive_index: LABELED_INDEX     with type elt = archive_name and type data = archive and type id = archive_id
module Archive_set: SET               with type elt = archive_id
type package_name = unit_id * version_id * release_id *
architecture_id
A package is uniquely identified by its unit, version and architecture. We use IDs for speed.
type package_extra 
Extra private information (cached results and other things)
type package = (package_extra, unit_id,
version_number * release_number, glob,
architecture_id, source_id)
Napkin.package
A package is essentially a Napkin with strings replaced by IDs for efficiency.
module Package_index: DOUBLE_INDEX  with
  type e1 = package_name and
  type e2 = package and
  type id = package_id
The database contains a ``double index'' for packages, the first is for mapping package names to package IDs.
type package_set = Package_set.t 
Handy aliases.
type unit_set = Unit_set.t 
type source_set = Source_set.t 
type archive_set = Archive_set.t 
module Chronology: CHRONOLOGICAL_MAP  with type elt = Package_ID.id and type set = Package_set.t
The Chronology module efficiently maps days to sets of packages.
type db 
A RAPIDS database.
val create_database : unit -> db
Create a fresh database.
val add_package : db -> Napkin.default_package -> package_id
Add the given napkin into the database and return its ID. This operation is idempotent -- if the napkin is already interned, it does no harm and returns the correct package ID with an efficient lookup, provided the information in the given and stored napkins coincide. If not, a Conflicting_information exception is raised. If the package had only its name interned, this will fill the package's napkin.
val replace_package : db -> package -> unit
Replace a package in the database. If the package did not already exist, it will be added.
val self_test : db -> unit
Run a series of self-tests on the database, which must have been previously filled.
val get_liquid : db -> liquid option
The following functions return the various indexes from the database.
val get_package_index : db -> Package_index.t
val get_unit_index : db -> Unit_index.t
val get_version_index : db -> Version_index.t
val get_release_index : db -> Release_index.t
val get_architecture_index : db -> Architecture_index.t
val get_archive_index : db -> Archive_index.t
val get_source_index : db -> Source_index.t
val set_liquid : db -> liquid -> unit
val split_version : string -> string * string option
val add_archive : db -> archive_name -> archive_id
Register an archive. Efficient and idempotent.
val get_archive : db -> archive_id -> archive
Get an archive
val get_archive_contents : archive -> Lifetime.day -> package_set
Get the contents of an archive on a given day
val iterate_over_archive : (Lifetime.day -> package_set -> unit) -> archive -> unit
Iterate over the days of an archive
val archive_range : db -> archive -> Lifetime.day * Lifetime.day
Get the first and last days for which this archive contains packages.
val add_packages_to_archive : db ->
archive -> package_set -> Lifetime.lifetime -> unit
Add the given packages to the archive for the given days.
module Functions: sig .. end