osl logo

The lightweight storage library


[README] [INSTALL] [Quick Start] [API] [man page]

API Reference

struct osl_object Describes an object of the object storage layer.
enum osl_table_flags Flags that change the internal handling of osl tables.
enum osl_storage_type The three different types of storage for an osl column.
enum osl_storage_flags Additional per-column flags.
struct osl_table Opaque osl table structure.
struct osl_row Opaque osl row structure.
typedef int osl_compare_func(const struct osl_object *obj1, const struct osl_object *obj2) Comparator for rbtree nodes.
typedef int osl_rbtree_loop_func(struct osl_row *row, void *data) Loop callback function.
struct osl_column_description Describes one column of an osl table.
struct osl_table_description Describes one osl table.
enum osl_close_flags Flags to be passed to osl_close_table().
osl_create_table() Create a new osl table.
osl_open_table() Open an osl table.
osl_close_table() Close an osl table.
osl_get_row() Get the row that contains the given object.
osl_get_object() Retrieve an object identified by row and column.
osl_open_disk_object() Retrieve an object of type OSL_DISK_STORAGE by row and column.
osl_close_disk_object() Free resources allocated during osl_open_disk_object().
osl_add_and_get_row() Add a new row to an osl table and retrieve this row.
osl_add_row() Add a new row to an osl table.
osl_del_row() Delete a row from an osl table.
osl_rbtree_loop() Loop over all nodes in an rbtree.
osl_rbtree_loop_reverse() Loop over all nodes in an rbtree in reverse order.
osl_update_object() Change an object of an osl table.
osl_get_num_rows() Get the number of rows of the given table.
osl_rbtree_first_row() Get the row corresponding to the smallest rbtree node of a column.
osl_rbtree_last_row() Get the row corresponding to the greatest rbtree node of a column.
osl_get_nth_row() Get the row with n-th greatest value.
osl_get_rank() Get the rank of a row.
osl_strerror() Get a string describing the error code passed in the argument.

Describes an object of the object storage layer.

Members:
Flags that change the internal handling of osl tables.

Enumeration Constants:
The three different types of storage for an osl column.

Enumeration Constants:
Additional per-column flags.

Enumeration Constants:
Opaque osl table structure.


Opaque osl row structure.


Comparator for rbtree nodes.

To build an rbtree, a compare function for the objects must be provided. This function takes pointers to the two objects to be compared. It must return -1, zero, or 1, if the first argument is considered to be respectively less than, equal to, or greater than the second. If two members compare as equal, their order in the rbtree is undefined.


Loop callback function.

The osl_rbreee_loop functions take a function pointer of this type. For each node in the rbtree, the given function is called.

See also: osl_rbtree_loop(), osl_rbtree_loop_reverse().


Describes one column of an osl table.

Members:
Describes one osl table.

A pointer to the table description is passed to osl_create_table() and osl_open_table(). The osl library calls which operate on an open table refer to the fields of the table description through this pointer. Hence the table description must not be modified or freed before the table is closed.

Members:
Flags to be passed to osl_close_table().

Enumeration Constants:
Create a new osl table.

Return (int):


Open an osl table.

An osl table must be opened before its data can be accessed.

The table description given by desc should coincide with the description used at creation time.

Return (int):


Close an osl table.

If osl_open_table() succeeds, the resulting table pointer must later be passed to this function in order to flush all changes to the file system and to free the resources that were allocated by osl_open_table().

Return (int):


Get the row that contains the given object.

Lookup the given object and return the row containing it. The column specified by col_num must have an associated rbtree.

Return (int):


Retrieve an object identified by row and column.

The column determined by col_num must be of type OSL_MAPPED_STORAGE or OSL_NO_STORAGE, i.e. no disk storage objects may be retrieved by this function.

See also: osl_storage_type, osl_open_disk_object().

Return (int):


Retrieve an object of type OSL_DISK_STORAGE by row and column.

For columns of type OSL_DISK_STORAGE this function must be used to retrieve one of its containing objects. Afterwards, osl_close_disk_object() must be called in order to deallocate the resources.

See also: osl_get_object(), osl_storage_type, osl_close_disk_object().

Return (int):


Free resources allocated during osl_open_disk_object().

Return (int):


Add a new row to an osl table and retrieve this row.

The objects parameter must point to an array containing one object per column. The order of the objects in the array is given by the table description of the table. Several sanity checks are performed during object insertion and the function returns without modifying the table if any of these tests fail. In fact, it is atomic in the sense that it either succeeds or leaves the table unchanged (i.e. either all or none of the objects are added to the table).

See also: struct osl_table_description, osl_compare_func, osl_add_row().

Return (int):


Add a new row to an osl table.

This is equivalent to calling osl_add_and_get_row(t, objects, NULL);

Return (int):


Delete a row from an osl table.

This removes all disk storage objects, removes all rbtree nodes, and frees all volatile objects belonging to the given row. For mapped columns, the data is merely marked invalid and may be pruned from time to time by oslfsck(1).

Return (int):


Loop over all nodes in an rbtree.

This function does an in-order walk of the rbtree associated with col_num. It is an error if the OSL_RBTREE flag is not set for this column. For each node in the rbtree, the given function func is called with two pointers as arguments: The first osl_row* argument points to the row that contains the object corresponding to the rbtree node currently traversed, and the private_data pointer is passed verbatim as the second argument. The loop terminates either if the callback returns a negative value, or if all nodes of the tree have been visited.

Return (int):


Loop over all nodes in an rbtree in reverse order.

This function is identical to osl_rbtree_loop(), the only difference is that the tree is walked in reverse order.

See also: osl_rbtree_loop().

Return (int):


Change an object of an osl table.

This function gets rid of all references to the old object. This includes removal of the rbtree node in case there is an rbtree associated with col_num. It then inserts obj into the table and the rbtree if necessary.

Return (int):


Get the number of rows of the given table.

The number of rows returned excludes any invalid rows.

Return (int):


Get the row corresponding to the smallest rbtree node of a column.

The rbtree node of the smallest object (with respect to the corresponding compare function) is selected and the row containing this object is returned. It is an error if col_num refers to a column without an associated rbtree.

See also: osl_get_nth_row(), osl_rbtree_last_row().

Return (int):


Get the row corresponding to the greatest rbtree node of a column.

This function works just like osl_rbtree_first_row(), the only difference is that the row containing the greatest rather than the smallest object is returned.

See also: osl_get_nth_row(), osl_rbtree_first_row()

Return (int):


Get the row with n-th greatest value.

Retrieve the n-th order statistic with respect to the compare function of the rbtree column col_num. In other words, get the row with n-th greatest value in column col_num. It is an error if col_num is not a rbtree column, or if n is larger than the number of rows in the table.

Return (int):


Get the rank of a row.

The rank is, by definition, the position of the row in the linear order determined by an in-order tree walk of the rbtree associated with given column number.

See also: osl_get_nth_row().

Return (int):


Get a string describing the error code passed in the argument.

This works just like strerror(3). The given number must be an osl error code. The result must not be freed by the caller.

Return (const char *):