]> git.tuebingen.mpg.de Git - osl.git/blobdiff - osl.h.in
osl-0.2.0.
[osl.git] / osl.h.in
diff --git a/osl.h.in b/osl.h.in
deleted file mode 100644 (file)
index 8c386c7..0000000
--- a/osl.h.in
+++ /dev/null
@@ -1,180 +0,0 @@
-#include <sys/mman.h>
-/*
- * Copyright (C) 2007-2008 Andre Noll <maan@systemlinux.org>
- *
- * Licensed under the GPL v2. For licencing details see COPYING.
- */
-
-/** \file osl.h User interface for the object storage layer. */
-
-/** describes an object of the object storage layer (osl) */
-struct osl_object {
-       /** Pointer to the data of the object. */
-       void *data;
-       /** The object's size. */
-       size_t size;
-};
-
-/** Flags that change the internal handling of osl tables. */
-enum osl_table_flags {
-       /** This table will have many rows. */
-       OSL_LARGE_TABLE = 1
-};
-
-/** The three different types of storage for an osl column */
-enum osl_storage_type {
-       /**
-        * All data for this column is stored in one file which gets mmapped by
-        * osl_open_table(). This is suitable for columns that do not hold much
-        * data.
-        */
-       OSL_MAPPED_STORAGE,
-       /**
-        * Each entry is stored on disk and is loaded on demand by
-        * open_disk_object(). This is the preferable storage type for large
-        * objects that need not be in memory all the time.
-        */
-        OSL_DISK_STORAGE,
-       /**
-        * Objects for columns of this type are volatile: They are only stored
-        * in memory and are discarded once the table gets closed.
-        */
-       OSL_NO_STORAGE
-};
-
-/**
- * Additional per-column flags
- */
-enum osl_storage_flags {
-       /**
-        * Build an rbtree for this column. This is only possible if the
-        * storage type of the column is either \a OSL_MAPPED_STORAGE or \a
-        * OSL_NO_STORAGE. In order to lookup objects in the table by using \a
-        * osl_get_row(), the lookup column must have an associated rbtree.
-        *
-        * \sa osl_storage_type, osl_get_row()
-        */
-       OSL_RBTREE = 1,
-       /** The data for this column will have constant size. */
-       OSL_FIXED_SIZE = 2,
-       /** All values of this column will be different. */
-       OSL_UNIQUE = 4,
-       /** Do not free the data for this column (\p OSL_NO_STORAGE). */
-       OSL_DONT_FREE = 8
-};
-
-struct osl_table;
-struct osl_row;
-
-/**
- * In order to build up an rbtree a compare function for the objects must be
- * specified. Such a function always 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 sorted array is undefined.
- */
-typedef int osl_compare_func(const struct osl_object *obj1,
-       const struct osl_object *obj2);
-typedef int osl_rbtree_loop_func(struct osl_row *row, void *data);
-
-osl_compare_func osl_hash_compare, uint32_compare;
-
-/**
- * Describes one column of a osl table.
- */
-struct osl_column_description {
-       /** One of zje tree possible types of storage */
-       enum osl_storage_type storage_type;
-       /** Specifies further properties of the column */
-       enum osl_storage_flags storage_flags;
-       /**
-        * The column name determines the name of the directory where all data
-        * for this column will be stored. Its hash is stored in the table
-        * header. This field is ignored if the storage type is \a NO_STORAGE
-        */
-       char *name;
-       /**
-        * For columns with an associated rbtree, this must point to a function
-        * that compares the values of two objects, either a built-in function
-        * or a function defined by the application may be supplied.  This
-        * field is ignored if the column does not have an associated rbtree.
-        *
-        * \sa osl_storage_flags, osl_compare_func
-        */
-       osl_compare_func *compare_function;
-       /**
-        * If the \a OSL_FIXED_SIZE flag is set for this column, this value
-        * determines the fixed size of all objects of this column. It is
-        * ignored, if \a OSL_FIXED_SIZE is not set.
-        */
-       uint32_t data_size;
-};
-
-/**
- * Describes one osl table.
- */
-struct osl_table_description {
-       /** The directory which contains all files of this table. */
-       const char *dir;
-       /**
-        * The table name. A subdirectory of \a dir called \a name is created
-        * at table creation time. It must be a valid name for a subdirectory.
-        * In particular, no slashes are allowed for \a name.
-        */
-       const char *name;
-       /** The number of columns of this table. */
-       uint16_t num_columns;
-       /** Further table-wide information. */
-       enum osl_table_flags flags;
-       /** The array describing the individual columns of the table. */
-       struct osl_column_description *column_descriptions;
-};
-
-/** Flags to be passed to \a osl_close_table(). */
-enum osl_close_flags {
-       /**
-        * The table header contains a "dirty" flag which specifies whether
-        * the table is currently open by another process. This flag specifies
-        * that the dirty flag should be cleared before closing the table.
-        */
-       OSL_MARK_CLEAN = 1,
-       /**
-        * If the table contains columns of type \a OSL_NO_STORAGE and this
-        * flag is passed to osl_close_table(), free(3) is called for each
-        * object of each column of type \a OSL_NO_STORAGE.
-        */
-       OSL_FREE_VOLATILE = 2
-};
-
-
-
-int osl_create_table(const struct osl_table_description *desc);
-int osl_open_table(const struct osl_table_description *desc,
-       struct osl_table **result);
-int osl_close_table(struct osl_table *t, enum osl_close_flags flags);
-int osl_get_row(const struct osl_table *t, unsigned col_num,
-       const struct osl_object *obj, struct osl_row **result);
-int osl_get_object(const struct osl_table *t, const struct osl_row *row,
-       unsigned col_num, struct osl_object *object);
-int osl_open_disk_object(const struct osl_table *t,
-       const struct osl_row *r, unsigned col_num, struct osl_object *obj);
-int osl_close_disk_object(struct osl_object *obj);
-int osl_add_and_get_row(struct osl_table *t, struct osl_object *objects,
-       struct osl_row **row);
-int osl_add_row(struct osl_table *t, struct osl_object *objects);
-int osl_del_row(struct osl_table *t, struct osl_row *row);
-int osl_rbtree_loop(const struct osl_table *t, unsigned col_num,
-       void *private_data, osl_rbtree_loop_func *func);
-int osl_rbtree_loop_reverse(const struct osl_table *t, unsigned col_num,
-       void *private_data, osl_rbtree_loop_func *func);
-int osl_update_object(struct osl_table *t, const struct osl_row *r,
-       unsigned col_num, struct osl_object *obj);
-int osl_get_num_rows(const struct osl_table *t, unsigned *num_rows);
-int osl_rbtree_first_row(const struct osl_table *t, unsigned col_num,
-       struct osl_row **result);
-int osl_rbtree_last_row(const struct osl_table *t, unsigned col_num,
-       struct osl_row **result);
-int osl_get_nth_row(const struct osl_table *t, unsigned col_num,
-       unsigned n, struct osl_row **result);
-int osl_get_rank(const struct osl_table *t, struct osl_row *r,
-       unsigned col_num, unsigned *rank);