/* * Please do not edit this file. * It was generated using rpcgen. */ #ifndef _DB_LOG_H_RPCGEN #define _DB_LOG_H_RPCGEN #include #pragma ident "%Z%%M% %I% %E% SMI" #ifndef _DB_LOG_H #define _DB_LOG_H #include "db_pickle.h" #include "db_log_entry.h" #include "nisdb_rw.h" class db_log: public pickle_file { private: int syncstate; /* 0 if changes xfrd to .log */ char *tmplog; /*
.log.tmp */ char *stablelog; /*
.log.stable */ char *oldlog; /* remember name of
.log */ STRUCTRWLOCK(log); public: /* Constructor: create log file; default is PICKLE_READ mode. */ db_log( char* f, pickle_mode m = PICKLE_READ ): pickle_file(f, m) { syncstate = 0; tmplog = stablelog = oldlog = 0; INITRW(log); } ~db_log(void) { DESTROYRW(log); } /* Execute given function 'func' on log. function takes as arguments: pointer to log entry, character pointer to another argument, and pointer to an integer, which is used as a counter. 'func' should increment this value for each successful application. The log is traversed until either 'func' returns FALSE, or when the log is exhausted. The second argument to 'execute_on_log' is passed as the second argument to 'func'. The third argument, 'clean' determines whether the log entry is deleted after the function has been applied. Returns the number of times that 'func' incremented its third argument. */ int execute_on_log( bool_t(* f) (db_log_entry *, char *, int *), char *, bool_t = TRUE ); /* Print contents of log file to stdout */ int print(); /* Make copy of current log to log pointed to by 'f'. */ int copy( db_log*); /*Rewinds current log */ int rewind(); /*Append given log entry to log. */ int append( db_log_entry * ); /* Flush and sync log file. */ int sync_log(); /* Return the next element in current log; return NULL if end of log or error. Log must have been opened for READ. */ db_log_entry *get(); /* bool_t dump( pptr ) {return TRUE;}*/ // does nothing. /* Open log file */ int open(void); /* Close log file */ int close(); /* Do we need to copy the log file */ bool_t copylog; /* Locking methods */ int acqexcl(void) { return (WLOCK(log)); } int relexcl(void) { return (WULOCK(log)); } int acqnonexcl(void) { return (RLOCK(log)); } int relnonexcl(void) { return (RULOCK(log)); } }; #endif /* _DB_LOG_H */ #endif /* !_DB_LOG_H_RPCGEN */