<> <> <<>> DIRECTORY AlpineDirectory USING [Version, highest, all], AlpineEnvironment, AlpTransaction USING [Handle], BTree USING [PathStk, Tree], BTreeAlpineVM USING [Handle], Rope USING [ROPE, Text]; AlpineDirectoryBTree: CEDAR DEFINITIONS = BEGIN <> <> <> <<>> <<>> OPEN AD: AlpineDirectory, AE: AlpineEnvironment; EntryHandle: TYPE = REF EntryRecord; EntryRecord: TYPE = RECORD[ found: BOOL _ FALSE, -- whether or not the entry exists name: Rope.ROPE _ NIL, -- path name passed in by client volume: Rope.Text _ NIL, -- the name of the volume group owner: Rope.Text _ NIL, -- the name of the owner nameBody: Rope.Text _ NIL, -- subdirectories and filename; no version desiredVersion: AD.Version _ 0, -- version in the name (includes highest, lowest, and all) pattern: Rope.ROPE _ NIL, -- pattern used for enumerations pVolume: Rope.Text _ NIL, -- pattern volume name pOwner: Rope.Text _ NIL, -- pattern owner name pNameBody: Rope.Text _ NIL, -- pattern nameBody pVersion: AD.Version _ 0, -- pattern version (includes highest, lowest, and all) trans: AlpTransaction.Handle, volGroupID: AE.VolumeGroupID _ AE.nullVolumeGroupID, btree: TreeRecord _ [], -- btree and backing storage pathStk: BTree.PathStk _ NIL, -- a hint to the btree usePathStk: BOOL _ FALSE, -- a hint to the btree directory: BOOL _ FALSE, -- this is the entry for the directory btree file: AE.UniversalFile _ AE.nullUniversalFile, -- actual file link: Rope.Text _ NIL, -- actual link version: AD.Version _ 0, -- actual version keep: CARDINAL _ 0, -- actual keep inUse: EntryHandle _ NIL, -- inUse = NIL => this handle is being used recentlyInUse: BOOL _ FALSE -- one bit LRU marker ]; TreeRecord: TYPE = RECORD[ tree: BTree.Tree _ NIL, storage: BTreeAlpineVM.Handle _ NIL]; -- the backing storage for the btree ReadEntry: PROC [trans: AlpTransaction.Handle, name: Rope.ROPE, defaultVersion: AD.Version _ AD.highest, desiredVersion: AD.Version _ AD.all] RETURNS [entry: EntryHandle]; <> <> <> <> <<>> NextEntry: PROC [trans: AlpTransaction.Handle, pattern, start: Rope.ROPE, defaultVersion: AD.Version _ AD.all] RETURNS [entry: EntryHandle]; <> <> <> <<>> WriteEntry: PROC [entry: EntryHandle]; <> <> DeleteEntry: PROC [entry: EntryHandle]; <> <> GetDirectory: PROC [trans: AlpTransaction.Handle, volume: Rope.ROPE, owner: AE.OwnerName] RETURNS [directory: AE.UniversalFile]; <> FreeEntryHandle: PROC [entry: EntryHandle]; <> <<>> FullPathName: PROC [entry: EntryHandle] RETURNS[name: Rope.ROPE]; END.