LoganBerryClass.mesa
Copyright Ó 1989, 1992 by Xerox Corporation. All rights reserved.
Doug Terry, October 24, 1990 12:29 pm PDT
Willie-s, April 23, 1992 3:06 pm PDT
Mechanisms for registering new LoganBerry classes. A LoganBerry class is a collection of routines that implement the LoganBerry interface. In addition to the standard LoganBerry implementation, examples of LoganBerry classes include stubs for performing RPC calls to remote LoganBerry servers and "veneers" that enable other databases, such as Cypress, to be accessed as LoganBerry databases.

A specific class is bound to a database handle during the Open call. On Open, each registered LoganBerry class is given the opportunity to Open the named database. The first class that returns a non-null open database handle is used for subsequent calls on that handle. Thus, the Open routine for each class should first check that the named database is one that is managed by the particular class.
DIRECTORY
LoganBerry;
LoganBerryClass: CEDAR DEFINITIONS
~ BEGIN
OPEN LoganBerry;
Methods
See LoganBerry.mesa for a description of the various LoganBerry operations.
OpenProc: TYPE ~ PROC [conv: Conv, dbName: ROPE] RETURNS [db: OpenDB];
DescribeProc: TYPE ~ PROC [conv: Conv, db: OpenDB] RETURNS [info: SchemaInfo];
ReadEntryProc: TYPE ~ PROC [conv: Conv, db: OpenDB, key: AttributeType, value: AttributeValue] RETURNS [entry: Entry, others: BOOLEAN];
EnumerateEntriesProc: TYPE ~ PROC [db: OpenDB, key: AttributeType, start: AttributeValue, end: AttributeValue, proc: EntryProc] RETURNS [];
GenerateEntriesProc: TYPE ~ PROC [conv: Conv, db: OpenDB, key: AttributeType, start: AttributeValue, end: AttributeValue] RETURNS [cursor: Cursor];
NextEntryProc: TYPE ~ PROC [conv: Conv, cursor: Cursor, dir: CursorDirection] RETURNS [entry: Entry];
EndGenerateProc: TYPE ~ PROC [conv: Conv, cursor: Cursor] RETURNS [];
WriteEntryProc: TYPE ~ PROC [conv: Conv, db: OpenDB, entry: Entry, log: LogID, replace: BOOLEAN] RETURNS [];
DeleteEntryProc: TYPE ~ PROC [conv: Conv, db: OpenDB, key: AttributeType, value: AttributeValue] RETURNS [deleted: Entry];
CloseProc: TYPE ~ PROC [conv: Conv, db: OpenDB] RETURNS [];
BuildIndicesProc: TYPE ~ PROC [conv: Conv, db: OpenDB] RETURNS [];
CompactLogsProc: TYPE ~ PROC [conv: Conv, db: OpenDB] RETURNS [];
RegisterWriteProcProc: TYPE ~ PROC [proc: WriteProc, db: OpenDB, ident: ATOM, clientData: REF] RETURNS [];
UnregisterWriteProcProc: TYPE ~ PROC [db: OpenDB, ident: ATOM] RETURNS [];
IsLocalProc: TYPE ~ PROC [db: OpenDB] RETURNS [local: BOOL];
StartTransactionProc: TYPE ~ PROC [db: OpenDB, wantAtomic: BOOLEAN ¬ FALSE];
EndTransactionProc: TYPE ~ PROC [db: OpenDB, commit: BOOLEAN ¬ TRUE] RETURNS [committed: BOOLEAN];
FlushDBCacheProc: TYPE ~ PROC [db: OpenDB ¬ nullDB];
Class: TYPE ~ REF ClassObject;
ClassObject: TYPE ~ RECORD [
name: ATOM ¬ NIL,
open: OpenProc ¬ NIL,
describe: DescribeProc ¬ NIL,
readEntry: ReadEntryProc ¬ NIL,
enumerateEntries: EnumerateEntriesProc ¬ NIL,
generateEntries: GenerateEntriesProc ¬ NIL,
nextEntry: NextEntryProc ¬ NIL,
endGenerate: EndGenerateProc ¬ NIL,
writeEntry: WriteEntryProc ¬ NIL,
deleteEntry: DeleteEntryProc ¬ NIL,
close: CloseProc ¬ NIL,
buildIndices: BuildIndicesProc ¬ NIL,
compactLogs: CompactLogsProc ¬ NIL,
isLocal: IsLocalProc ¬ NIL,
startTransaction: StartTransactionProc ¬ NIL,
endTransaction: EndTransactionProc ¬ NIL,
flushDBCache: FlushDBCacheProc ¬ NIL,
classData: REF ¬ NIL
];
Record for class-specific methods and state.
Registration
Register: PROC [name: ATOM, class: Class, tryLast: BOOLEAN ¬ FALSE] RETURNS [];
Registers the given LoganBerry class with the given name. Any class already registered with the name is replaced. class=NIL unregisters the named class. If tryLast=TRUE then this class is given the last opportunity to open a named database (this is intended for use by the main LoganBerry implementation); otherwise, newly registered classes are placed at the front of the line.
Lookup: PROC [name: ATOM] RETURNS [class: Class];
Returns the named class or NIL if a class is not registered under the given name.
List: PROC [] RETURNS [classes: LIST OF Class];
Returns a list of all currently registered classes.
Advanced operations
GetDBSpecifics: PROC [db: LoganBerry.OpenDB]
RETURNS [class: ATOM, dbhandle: LoganBerry.OpenDB];
Returns the name of the class that implements operations on the specified database and the class-specific database handle.
END.