TarTrickle.mesa
Copyright Ó 1990 by Xerox Corporation. All rights reserved.
Bill Jackson (bj), May 21, 1990 4:31 pm PDT
DIRECTORY
BasicTime USING [GMT],
IO USING [STREAM],
PFSNames USING [Version],
RedBlackTree USING [Compare, GetKey, Table],
Rope USING [ROPE];
TarTrickle: CEDAR DEFINITIONS ~ {
OPEN Rope;
Types
Translation: TYPE ~ RECORD [
prefix: ROPE, -- prefix (pseudo server equiv) in filenames
translation: ROPE, -- prefix value for (truthful) source
supress: ROPE-- prefix path for source to supress
];
TCType: TYPE ~ { fullDirectory, oneDF, allDFs };
TCInfo: TYPE ~ REF TCInfoRec;
TCInfoRec: TYPE ~ RECORD [
tarFileName: ROPE,
tcType: TCType ← fullDirectory,
fixes: LIST OF Translation ← NIL,
arg: ROPE
];
FileEntryState: TYPE ~ { init, doingHeader, copying, moved };
FileEntry: TYPE ~ REF FileEntryRep;
FileEntryRep: TYPE ~ RECORD [
key: REF,  -- RedBlackTree.Key, either ROPE or PFS.PATH
name: ROPE, -- actual file found
date: BasicTime.GMT, -- create date of the file
version: PFSNames.Version, -- version of file (from repository)
len: INT,  -- byte count of the file (useful redundancy)
fileType: CARD32, -- PFS.FileType
state: FileEntryState -- indicates the state of the file (obvious)
];
Operations
EnumerateFiles: PROC [pattern: ROPE, out: IO.STREAM]
RETURNS
[table: RedBlackTree.Table, filesSeen: INT ← 0, bytesSeen: INT ← 0];
accumulate list of files to be operated upon by recursing thru directory tree
EnumerateDFs: PROC [pattern: ROPE, tcInfo: TCInfo, out: IO.STREAM, test: BOOLFALSE]
RETURNS [table: RedBlackTree.Table, filesSeen: INT ← 0];
accumulate list of files to be operated upon by recursing thru df structure
ExpandInfo: PROC [table: RedBlackTree.Table, out: IO.STREAM]
RETURNS
[bytesSeen: INT ← 0];
fill in the date/version information for all entries
BumpCounter: PROC [out: IO.STREAM, num: INT] RETURNS [res: INT];
increment counter, putting mark(s) on stream when appropriate
GetKey: RedBlackTree.GetKey;
returns data as key
Compare: RedBlackTree.Compare;
compares key (rope, PATH, or FileEntry) with data (FileEntry)
provides case insensitive (Rope.Compare) ordering
}.