Module Rocksdb
A binding to RocksDB
This library is a binding to Facebook's RocksDB library. This library attempts to provide a layer on top of Rock's C FFI adapting it as much as possible to OCaml idioms. It aims to cover most of the C FFI in the long run, along with tests to ensure no function is left never called and untested.
module Options : sig ... endval open_db : config:Options.config -> name:string -> (t, error) Stdlib.resultopen_db options namewill return an handle to the database in case of success or the error returned by RocksDB in case of failure.nameis the path to the database.
val open_db_read_only : ?fail_on_wal:bool -> config:Options.config -> name:string -> (t, error) Stdlib.resultopen_db options namewill return a read-only handle to the database in case of success or the error returned by RocksDB in case of failure.nameis the path to the database.fail_on_walreturns an error if write log is not empty
val open_db_with_ttl : config:Options.config -> name:string -> ttl:int -> (t, error) Stdlib.resultopen_db_with_ttl options name ttlwill return an handle to the database in case of success or the error returned by RocksDB in case of failure.nameis the path to the database.ttlTime in seconds after which a key should be removed (best-effort basis, during compaction)
val put : t -> Options.Write_options.t -> key:string -> value:string -> (unit, error) Stdlib.resultput db write_options key valuewill write at keykeythe valuevalue, on databasedb. Return unit on success, RocksDB reported error on error.
val delete : t -> Options.Write_options.t -> string -> (unit, error) Stdlib.resultdelete db write_options keywill delete keykeyon databasedb. Return unit on success, RocksDB reported error on error.
val get : t -> Options.Read_options.t -> string -> ([ `Not_found | `Found of string ], error) Stdlib.resultget db read_options keywill fetch keykeyon databasedb. Returns `Ok value if the key is found, `Not_found otherwise, and `Error if a failure occurred.
val flush : t -> Options.Flush_options.t -> (unit, error) Stdlib.resultflush db flush_optionswill flush all pending memtables on databasedb. Return unit on success, RocksDB reported error on error.
val compact_now : t -> (unit, error) Stdlib.resultcompact_now dbwill initiate a compaction on all ranges available in database. This is an asynchronous operation, returning unit once operation is started.
val stats : t -> (string option, error) Stdlib.resultstats dbwill return the accumulated stats for this database handle as an optional string form
val get_cache_usage : t -> (int, error) Stdlib.resultval close_db : t -> (unit, error) Stdlib.resultclose dbexplicitly closes the db handle. Any further access will raise an error
module Batch : sig ... endBatch processing RocksDB allows to batch operations through a dedicated batch object that must be fed to
write. A batch objectBatch.batchis a collection of operation to run on a database. (likeBatch.putor delete).
module Iterator : sig ... endmodule Perf_context : sig ... end