Operations to Move Messages Among Message Sets
AddMsg:
PROC[opsH: WalnutOpsHandle, msg:
ROPE, from, to: MsgSet]
RETURNS[exists: BOOL];
Adds Msg to MsgSet, if it's not already in it. IF msgSet=deletedMsgSet, does nothing and returns existed=FALSE
RemoveMsg:
PROC[opsH: WalnutOpsHandle, msg:
ROPE, from: MsgSet, deletedVersion:
INT]
RETURNS[deleted:
BOOL];
IF removing msg from msgSet would leave it in no MsgSet, then msg gets added to the distinguished MsgSet Deleted, and returns deleted = TRUE
MoveMsg:
PROC[opsH: WalnutOpsHandle, msg:
ROPE, from, to: MsgSet]
RETURNS [exists:
BOOL];
Move the message. Note that the result of a move may be that a message becomes deleted (if to was the Deleted message set) or undeleted (if from is the Deleted message set)
AcceptNewMail:
PROC[opsH: WalnutOpsHandle, pos:
INT, activeVersion:
INT];
makes new messages visible to the outside world. Commits periodically.
Other operations
DeclareDB:
PROC[opsH: WalnutOpsHandle, schemaInvalid:
BOOL]
RETURNS[ok:
BOOL];
This procedure need only be called once. Of course, if the readOnly status changes DeclareDB[] will have to be called again to establish the new values.
InitSchema:
PROC[opsH: WalnutOpsHandle, schemaInvalid:
BOOL ¬
TRUE]
RETURNS[ok:
BOOL];
must be called after doing an erase
GetRootInfo:
PROC[opsH: WalnutOpsHandle]
RETURNS[dbRootCreateDate:
GMT, dbFileKey, dbMailFor:
ROPE];
SetRootInfo:
PROC[opsH: WalnutOpsHandle, dbRootCreateDate:
GMT, dbFileKey, dbMailFor:
ROPE];
GetRootFileVersion:
PROC[opsH: WalnutOpsHandle]
RETURNS[rootFileStamp:
GMT];
rootFileVersion is needed more often
SetRootFileVersion:
PROC[opsH: WalnutOpsHandle, rootFileStamp:
GMT];
GetOpInProgressPos: PROC[opsH: WalnutOpsHandle] RETURNS[inProgressPos: INT];
SetOpInProgressPos: PROC[opsH: WalnutOpsHandle, inProgressPos: INT];
GetParseLogInProgress: PROC[opsH: WalnutOpsHandle] RETURNS[inProgress: BOOL];
SetParseLogInProgress: PROC[opsH: WalnutOpsHandle, inProgress: BOOL];
GetParseLogPos: PROC[opsH: WalnutOpsHandle] RETURNS[pos: INT];
SetParseLogPos: PROC[opsH: WalnutOpsHandle, pos: INT];
GetTimeOfLastScavenge: PROC[opsH: WalnutOpsHandle] RETURNS[when: GMT];
SetTimeOfLastScavenge: PROC[opsH: WalnutOpsHandle, when: GMT];
Operations used during Expunge, NewMail and reading Archive files
GetExpungeFileID: PROC[opsH: WalnutOpsHandle] RETURNS[expungeFileID: INT];
SetExpungeFileID: PROC[opsH: WalnutOpsHandle, expungeFileID: INT];
GetExpungeInfo:
PROC[opsH: WalnutOpsHandle]
RETURNS[firstDestroyedMsgPos, bytesInDestroyedMsgs: INT];
SetExpungeInfo: PROC[opsH: WalnutOpsHandle, firstDestroyedMsgPos, bytesInDestroyedMsgs: INT];
GetLogExpungePhase: PROC[opsH: WalnutOpsHandle] RETURNS[expungePhase: LogExpungePhase];
SetLogExpungePhase: PROC[opsH: WalnutOpsHandle, expungePhase: LogExpungePhase]; -- commits
GetExpungeProgressInfo:
PROC[opsH: WalnutOpsHandle]
RETURNS[currentLogPos, expungeLogPos: INT];
SetExpungeProgressInfo: PROC[opsH: WalnutOpsHandle, currentLogPos, expungeLogPos: INT]; -- commits
SetTimeOfLastExpunge: PROC[opsH: WalnutOpsHandle, when: GMT];
GetTimeOfLastExpunge: PROC[opsH: WalnutOpsHandle] RETURNS[when: GMT];
SetAcceptNewMailPos: PROC[opsH: WalnutOpsHandle, pos: INT];
GetAcceptNewMailPos: PROC[opsH: WalnutOpsHandle] RETURNS[pos: INT];
SetAddingServerMsgs: PROC[opsH: WalnutOpsHandle, addingServerMsgs: BOOL];
GetAddingServerMsgs: PROC[opsH: WalnutOpsHandle] RETURNS[addingServerMsgs: BOOL];
GetServerInfo:
PROC[opsH: WalnutOpsHandle, server:
ROPE]
RETURNS[num:
INT];
returns 0 if server doesn't exist
EnumerateServers: PROC[opsH: WalnutOpsHandle] RETURNS[serverList: LIST OF ServerInfo];
SetNewMailInfo:
PROC[
opsH: WalnutOpsHandle, logLen: INT, when: GMT, server: ROPE, num: INT];
sets newMailLog length to logLen; if server doesn't exist, it will be created
SetNewMailLogLength: PROC[opsH: WalnutOpsHandle, logLen: INT];
GetNewMailLogLength: PROC[opsH: WalnutOpsHandle] RETURNS[logLen: INT];
GetLastNewMailTimeStamp: PROC[opsH: WalnutOpsHandle] RETURNS[when: GMT];
SetCopyMailLogPos: PROC[opsH: WalnutOpsHandle, pos: INT];
GetCopyMailLogPos: PROC[opsH: WalnutOpsHandle] RETURNS[pos: INT];
SetReadArchivePos: PROC[opsH: WalnutOpsHandle, pos: INT];
GetReadArchivePos: PROC[opsH: WalnutOpsHandle] RETURNS[pos: INT];
SetCopyReadArchivePos: PROC[opsH: WalnutOpsHandle, pos: INT];
GetCopyReadArchivePos: PROC[opsH: WalnutOpsHandle] RETURNS[pos: INT];