Plasma GitLab Archive
Projects Blog Knowledge

Module Mapred_toolkit.Store

module Store: sig .. end


A store is a container for records. There is the in-memory form notebook, but a store can also be a file.

Stores connected with files need to be closed after use.

type 'a store 
A store is a container for data
val notebook : unit -> 'a store
Creates a new in-memory store.
val place : 'a store -> 'a Mapred_toolkit.Place.t
returns the place where this store resides
val read_place : 'a Mapred_toolkit.Place.t -> 'a store list
Returns the stores at one place. This is intended for reading only, and the returned store objects only support to read records.
val write_place : ?filename:string ->
'a Mapred_toolkit.Place.t -> 'a store
Returns a new store with an automatically generated name. This is intended for writing only, and the returned store object only supports to write records.

The optional filename argument influences the filename. If passed:

  • If prefix ^ filename ^ suffix does not exist yes, this file name is chosen. Otherwise:
  • A fragment uuid is generated so that prefix ^ filename ^ uuid ^ suffix is the new file
If not passed, the name is prefix ^ uuid ^ suffix.
val length : 'a store -> int
val length64 : 'a store -> int64
These two functions return the number of records. For notebooks and write-only stores the number is immediately known. For read-only stores this means a pass over the whole file.
val read : 'a store -> 'a store
Returns another store value reading the data from the same physical place. This is especially useful to read data back that was appended to a write-only store

It is undefined whether data added to the original store later will be visible after invoking read.

val file_name : 'a store -> string
Returns the absolute file name
val flush : 'a store -> unit
Flushes the internal buffers (for stores writing to files)
val close : 'a store -> unit
Flushes unwritten data to disk (when writing to a store), and closes all OS resources
This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml