WalnutRegistry.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Donahue, July 9, 1985 12:51:15 pm PDT
Willie-Sue, July 12, 1985 9:55:25 am PDT
Walnut Registry provides notification to outside clients of changes in Walnut databases. Walnut RegistryImpl can be run without running Walnut -- WalnutKernel imports it, rather than the other way around.
Procedures registered with Walnut Registry are placed on the queue, using MBQueue.QueueClientAction, given in the registration when the database changes; clients are guaranteed that the procedures will be queued in the order in which the database changes that caused their invocation occurred.
DIRECTORY
MBQueue USING[Queue],
Rope USING [ROPE];
WalnutRegistry: CEDAR DEFINITIONS =
BEGIN
WalnutState: TYPE = {unknown, active, stopped};
unknown means that Walnut has not notified the registry yet
Event: TYPE = {started, stopped, mailRead, expungeComplete};
EventProc: TYPE = PROC[event: Event, clientData: REF ANY];
MsgEvent: TYPE = {firstRead, deleted, unDeleted};
MsgProc: TYPE = PROC[msgName: Rope.ROPE, event: MsgEvent, clientData: REF ANY];
MsgGroup: TYPE = ARRAY[0..MsgGroupSize) OF Rope.ROPE;
MsgGroupSize: CARDINAL = 20;
MsgGroupEvent: TYPE = {added, destroyed};
MsgGroupProc: TYPE = PROC[
msgGroup: REF MsgGroup, event: MsgGroupEvent, clientData: REF ANY];
MsgSetEvent: TYPE = {created, destroyed};
MsgSetProc: TYPE = PROC[msgSetName: Rope.ROPE, event: MsgSetEvent, clientData: REF ANY];
MoveProc: TYPE = PROC[
msgName: Rope.ROPE, fromMsgSet, toMsgSet: Rope.ROPE, clientData: REF ANY];
ProcSet: TYPE =
RECORD[eventProc: EventProc ← NIL,
eventProcData: REF ANYNIL,
msgProc: MsgProc ← NIL,
msgProcData: REF ANYNIL,
msgGroupProc: MsgGroupProc ← NIL,
msgGroupData: REF ANYNIL,
msgSetProc: MsgSetProc ← NIL,
msgSetData: REF ANYNIL,
moveProc: MoveProc ← NIL,
moveProcData: REF ANYNIL];
Registration: TYPE = REF;
Register: PROC [procSet: ProcSet, queue: MBQueue.Queue] RETURNS[registration: Registration];
Register a set of procedures to be invoked when the appropriate database changes occur. Return a registration that can be used to name the set
InvalidRegistration: ERROR;
Each of the procedures below will raise this error if given a registration that does not currently exist in the table of registered procedures
UnRegister: PROC [registration: Registration];
Remove the procedures named by the registration
GetProcs: PROC[registration: Registration] RETURNS[procSet: ProcSet, queue: MBQueue.Queue];
Return the procedures named by the registration
CurrentWalnutState: PROC RETURNS[walnutState: WalnutState];
a quick and safe way to find out if Walnut has been loaded and if it is active or not
END.