-- Transport Mechanism Mail Server: DEFS for mail spilling

-- [Juniper]<DMS>MS>SpillDefs.mesa

-- Andrew Birrell  25-Feb-81 16:09:54

DIRECTORY
BodyDefs	USING[ RName],
HeapDefs	USING[ WriterHandle ],
ObjectDirDefs	USING[ ObjectNumber],
ProtocolDefs	USING[ Handle ];

SpillDefs: DEFINITIONS =

BEGIN

ServerCrash:	ERROR;
   -- raised if the remote server fails. --



-- Archive file creation: only one may be created at a time --

StartWrite:	PROC[user: BodyDefs.RName, bodies: CARDINAL]
		RETURNS[obj: ObjectDirDefs.ObjectNumber];
   -- "obj" is the spill object; it has reference count 1.  May try
   -- several servers.  Raises ServerCrash if none is available. --

AddBody:	PROC[body: ObjectDirDefs.ObjectNumber];
   -- copies the body into the file --

EndWrite:	PROC;
   -- closes the file --



-- Archive file access:  multiple clients allowed --

ArchReader:	TYPE[SIZE[POINTER]];
   -- represents the state of reading an archive file --

OpenToRead:	PROC[obj: ObjectDirDefs.ObjectNumber]
		RETURNS[file: ArchReader];
   -- "obj" is the spill object; "file" is the remote file --

CopyBody:	PROC[file: ArchReader, body: CARDINAL,
		     str: ProtocolDefs.Handle];
   -- copies the entire body into the stream --

CopyText:	PROC[file: ArchReader, body: CARDINAL,
		     sendTextLength: PROC[LONG CARDINAL],
		     str: UNSPECIFIED,
		     sendBytes: PROC[UNSPECIFIED,POINTER,CARDINAL]];
   -- copies the Text part of the message --

RecoverBody:	PROC[file: ArchReader, body: CARDINAL]
		RETURNS[writer: HeapDefs.WriterHandle];
   -- copies the entire body back into the heap, with type "body" --

DeleteEntry:	PROC[file: ArchReader, body: CARDINAL];
   -- marks body as deleted in archive file. --

TestDeletion:	PROC[file: ArchReader, body: CARDINAL]
		RETURNS[deleted: BOOLEAN];
   -- tells whether the body is marked as deleted in archive file --

EndReading:	PROC[file: ArchReader];
   -- closes the archive file --



-- Deleting archive files --

Delete:		PROC[obj: ObjectDirDefs.ObjectNumber];
   -- deletes the archive file --

END.