package leveldb

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module LevelDB.IteratorSource

Iteration over bindings in a database.

Sourceval make : ?fill_cache:bool -> db -> iterator

Create a new iterator. Note that the iterator keeps a reference to the * DB, so the latter will not be GCed automatically as long as the iterator * is being used. Note also that if the DB is closed manually, the iterator * will be invalidated and further operations will fail. The returned * iterator needs not be closed manually, for it will be closed in its * finalizer.

Sourceval close : iterator -> unit

Close the iterator. Further operations on it will fail. Note that * the iterator fill be closed automatically in its finalizer if this * function is not called manually.

Sourceval seek_to_first : iterator -> unit

Jump the the first binding in the database/snapshot.

Sourceval seek_to_last : iterator -> unit

Jump the the last binding in the database/snapshot.

Sourceval seek : iterator -> string -> int -> int -> unit

seek it s off len seeks to first binding whose key is >= to the key * corresponding to the substring of s starting at off and of length * len. * Note that the contents of the key will be copied to the stack, so * exceedingly large keys could cause a stack overflow. *

  • raises Error

    if the offset/length does not represent a substring of the * key.

Sourceval next : iterator -> unit

Jump to the next binding.

Sourceval prev : iterator -> unit

Jump to the previous binding.

Sourceval valid : iterator -> bool
  • returns

    true iff the iterator is pointing to a binding.

Sourceval fill_key : iterator -> bytes ref -> int

fill_key it r places the key for the current binding in the string * referred to by r if it fits, otherwise it creates a new string and * updates the reference. *

  • raises Error

    if the iterator is not valid *

    @return

    length of the key

Sourceval fill_value : iterator -> bytes ref -> int

Similar to fill_key, but returning the value.

Sourceval get_key : iterator -> string

Return the key part of the binding pointer to by the iterator. *

Sourceval get_value : iterator -> string

Return the value part of the binding pointer to by the iterator. *

Sourceval iter : (string -> string -> bool) -> iterator -> unit

iter f db applies f to all the bindings in the database/snapshot the * iterator belongs to, until f returns false, i.e. runs f key value * for all the bindings in lexicographic key order.

Sourceval rev_iter : (string -> string -> bool) -> iterator -> unit

Like iter, but proceed in reverse lexicographic order.

Sourceval iter_from : (string -> string -> bool) -> iterator -> string -> unit

iter_from f it start applies f key value for all the bindings after * start (inclusive) until it returns false.

Sourceval rev_iter_from : (string -> string -> bool) -> iterator -> string -> unit

iter_from f it start applies f key value for all the bindings before * start (inclusive) in reverse lexicographic order until f returns * false..