Plasma GitLab Archive
Projects Blog Knowledge

Class type Nn_blockmap.blockmap_t


class type blockmap_t = object .. end
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 db

method active : bool
whether this object refers to an existing row in the datastore table. If the object is inactive, the other methods (except id and identity) will fail with Inactive.
method id : int
the datastore db table id
method identity : string
This is the blockmap for this datastore identity
method size : int64
Size of the blockmap in blocks
method n_used : int64
method n_trans : int64
method n_free : int64
Number of used, transitional, free blocks
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
whether there are still free blocks
method reserve : int -> <  > -> reserve_info -> triv_range list
reserve n owner ri: 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 : triv_range 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 : triv_range 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 UPDATEs. If owner is unknown, the empty list is returned.
method inactivate : unit -> unit
Sets active to false
method dump : string
Get a dump of the internal state
This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml