Rover Server-Side Database and Log Interface

C database and log calls into the server-side Rover library

Description: Generic GDBM database and log routines.

Database functions

db_openRead // db_openWrite // db_reopenRead // db_reopenWrite // db_close // db_getAccessTime // db_setAccessTime // db_getUID

Log manipulation functions

log_add // log_clean // log_flush // log_info // log_outstrSuffix // log_purge // log_purgeAll // log_print // log_search // log_suffix



Database Functions

The following functions manipulate GDBM databases.


PUBLIC void db_openRead(char *filename, Database *db, DbBuilder builder, mode_t mode)

Opens a database for reading.

No return value.


PUBLIC void db_openWrite(char *filename, Database *db, DbBuilder builder, mode_t mode)

Opens a database for writing.

No return value.


PUBLIC void db_reopenRead(Database *db)

Reopens a database in read mode.

No return value.


PUBLIC void db_reopenWrite(Database *db)

Reopens a database in write mode.

No return value.


PUBLIC void db_close(Database *db)

Closes a database.

No return value.


PUBLIC time_t db_getAccessTime(Database *db, char *obj)

Returns the time that an object in the database was last accessed by a particular client and user. The information is stored under the tuple <ClientHost, User, Object>.

Returns the access time for the object, or 0 if the the object is not found in the database.


PUBLIC void db_setAccessTime(Database *db, char *obj, time_t stamp)

Sets the time that an object in the database was last accessed by a particular client and user. The information is stored under the tuple <ClientHost, User, Object>.

No return value.


PUBLIC char *db_getUID(Database *db, char *template)

Generates a unique object identifier.

Returns a newly allocated string containing a unique object identifier. The caller is responsible for freeing the string.



Log Manipulation Functions

All the following functions manipulate the operation log for a particular object.


PUBLIC void log_add(Database *db, char *obj, time_t stamp, char *host, int logID, HTOpStatus status, char *operation, int opsize)

Adds a log record to an object in the data base.

No return value.


PUBLIC void log_clean(Database *db, char *obj, LogCleaner cleaner)

Clean the log records for an object in the database.

No return value.


PUBLIC void log_flush(Database *db)

Flush out all log information and log records.

No return value.


PUBLIC void log_info(Database *db, char *obj, time_t *start, time_t *end, int *size, time_t *time)

Return information about an object's log records.

Returns -1, if no log information is found for the object. Otherwise, returns 1.


PUBLIC int log_outstrSuffix(Log *log)

Given a log record, output it as a log suffix record.

Returns 1.


PUBLIC void log_purge(Database *db, char *obj)

Purge the log records for an object.

No return value.


PUBLIC void log_purgeAll(Database *db)

Purge the log records for all objects in the database.

No return value.


PUBLIC void log_print(Database *db, char *obj, LogPrinter printer, FILE *file)

Print the log records for an object in the database.

No return value.


PUBLIC Log *log_search(Database *db, char *obj, char *host, int logID)

Search for a matching log record for an object in the database.

Returns the log record, if one is found. Otherwise, returns NULL.


PUBLIC void log_suffix(Database *db, char *obj, time_t start, LogUpdater updater)

Generate a log suffix for an object in the database.

No return value.


Last updated by $Author: adj $ on $Date: 1997/12/01 23:41:43 $.
Copyright © 1995-1998 Anthony D. Joseph and Massachusetts Institute of Technology