class type blockmap_t =block maps are in-memory representation of the per-datastore bitmaps whether blocks are used or free. Changes to block maps are done in a transactional way. One can finally get the accumulated updates of a transaction for writing them out to the dbobject
..end
method active : bool
datastore
table. If the object is inactive, the other methods (except id
and identity
) will fail with Inactive
.method id : int
method identity : string
method size : int64
method n_used : int64
method n_trans : int64
method n_free : int64
method fill_blockmap : int64 -> string -> unit
fill_blockmap index data
: Fills the blockmap at index
with data
, a string consisting of 0 and 1. index
must be
a multiple of 1024. (This is only allowed once per row for init,
and is outside any transaction.)method has_free_blocks : bool
method reserve : int -> < > -> int64 list
reserve n owner
: finds n
free blocks and returns their indices.
The reservation is owned by owner
, an arbitrary object.
Reserved blocks are one of two forms of transitional blocks.
Reserved blocks are turned into used blocks at commit time,
and freed again on abort
.method free : int64 list -> < > -> unit
free l owner
: deallocates these blocks. If they are still
only reserved but not yet committed, they keep their reserved
status until commit time, and are freed only then. It is
allowed to free kept blocks.method keep : int64 list -> < > -> unit
keep l owner
: marks these blocks as "to keep" even if a
competing transaction frees them. Kept blocks are the other
form of transitional blocks. They are counted in n_used
as
long as there is no committed free
. They are counted in
n_trans
when there is a committed free
. In the latter
case, the blocks are turned into free blocks at commit or abort
time. It is not allowed to keep blocks when there was already
a free
for them in the same transaction, or a competing
transaction could free
the block and commit that.
Kept blocks are not entered into the db, so it is not required
to get_changes
.
method commit : < > -> unit
commit owner
: commits owner
's reservations, and makes them
permanent. If owner is unknown this is a no-op.method rollback : < > -> unit
rollback owner
: unreserves owner
's blocks. If owner is unknown
this is a no-op.method get_changes : < > -> (int64 * string) list
get_changes owner
: Returns the changes made by owner
.
This is a list of database rows (start_index,row_data
),
to be used for SQL UPDATE
s. If owner
is unknown, the empty
list is returned.method inactivate : unit -> unit
active
to false
method dump : string