Implements Persistit™'s core functionality.
Applications initialize and close Persistit through an instance of the {@link com.persistit.Persistit} class. A Persistit instance must be initialized through one of the {@link com.persistit.Persistit#initialize initialize} methods, and must be closed by the {@link com.persistit.Persistit#close close} to ensure all updates are written to disk.
Applications interact with Persistit through instances of {@link com.persistit.Exchange}.
An Exchange
has two important associated member objects, a {@link com.persistit.Key}
and a {@link com.persistit.Value}. A Key
is a mutable representation of a
key, and a Value
is a mutable representation of a value. Applications
manipulate these objects and interact with the database through one of the following
four general patterns:
Key
, perform a {@link com.persistit.Exchange#fetch fetch}
operation, and query the Value
.
Key
, modify the Value
, and then perform a
{@link com.persistit.Exchange#store store} operation to insert or replace data
in the database.
Key
, and then perform a
{@link com.persistit.Exchange#remove remove} to remove one or more key/value pairs.
Key
, perform a
{@link com.persistit.Exchange#traverse traverse},
{@link com.persistit.Exchange#traverse next} or
{@link com.persistit.Exchange#traverse previous}, then query the
resulting state of Key
and/or Value
to enumerate key/value pairs
currently stored in the database.
Additional methods of Exchange
include
{@link com.persistit.Exchange#fetchAndStore fetchAndStore}
and {@link com.persistit.Exchange#fetchAndRemove fetchAndRemove}.
These atomically modify the database
and return the former value associated with the Key
.
Every Exchange
has an associated {@link com.persistit.Transaction
Transaction} object that represents its current transactional state. Every
operation performed by any of the access or update methods of the
Exchange
is performed within the context of this Transaction
,
meaning that its result is atomic, consistent, isolated and durable (the ACID properties).
By default these methods behave as if the bounded by {@link com.persistit.Transaction#begin begin}
{@link com.persistit.Transaction#commit commit} and
{@link com.persistit.Transaction#end end} calls on the Transaction
.
An application can group multiple operations together by explicitly invoking
begin
, commit
and end
calls. See
{@link com.persistit.Transaction} for further information.
The Persistit database is stored in physical files managed by {@link com.persistit.Volume Volume}s.
A Volume
contains an unbounded number of logical {@link com.persistit.Tree Tree}s, each
of which constitutes a physical balanced tree.
{@link com.persistit.IntegrityCheck IntegrityCheck} provides a simple mechanism to verify
the internal integrity of Volume
s and/or individual Tree
s.
This package also includes {@link com.persistit.PersistitMap PersistitMap} which
provides a persistent, fast implementation of java.util.SortedMap
.
Finally, an application can obtain an instance of a {@link com.persistit.Management} object that exposes an API for measuring performance data, sizes and utilization of database volumes, and many other elements from the {@link com.persistit.Persistit#getManagement} method. Optionally this class can be exported via Java RMI (Remote Method Invocation) to permit administration from a connected workstation.