DIRECTORY BTree USING [ PageNumber, PagePtr, PageSize, ReferencePage, ReleasePage ], IO USING [ STREAM ]; BTreeVM: CEDAR DEFINITIONS = BEGIN Ref: TYPE = REF VMObjectRep; VMObjectRep: TYPE = MONITORED RECORD[impl: REF VMObjectRepImpl]; VMObjectRepImpl: TYPE; CacheSize: TYPE = [8..4000]; -- in BTree pages -- Stats: TYPE = REF Statistics; Statistics: TYPE = RECORD [ hits, misses, reads, writes, cumChainLength, cumReadWriteTime: CARD ]; Open: PROC [readBacking, writeBacking: IO.STREAM, pageSize: BTree.PageSize, cacheSize: CacheSize, offset: CARD ¬ 0] RETURNS [Ref]; ReferencePage: BTree.ReferencePage; ReleasePage: BTree.ReleasePage; GetStats: PROC [h: Ref] RETURNS [stats: Stats]; FlushCache: PROC [h: Ref]; FreeBuffers: PROC [h: Ref]; END. BTreeVM.mesa (using PFS) Copyright Ó 1985, 1986, 1988, 1992 by Xerox Corporation. All rights reserved. Created by M. D. Schroeder Taft, June 9, 1983 2:10 pm Schroeder, August 18, 1983 11:52 am Russ Atkinson (RRA) April 22, 1988 7:36:16 pm PDT Doug Wyatt, February 27, 1985 10:18:19 am PST Brian Oki, February 6, 1990 10:50:42 am PST Interface for the VM to support the BTree package. The representation type The Handle returned should be passed to BTree.Open as the "storage" argument. If you want the BTree on the disk to be maintained in a consistent state, then the BTree should be opened with "maintainRecomputableState" set TRUE. If you don't want this, then you probably should be using another package. "offset" specifies which byte offset is the origin for BTree page zero. The BTreeVM package has a finialization procedure that will return any virtual memory allocated to the cache whenever all references to the "handle" from outside the package disappear. The client is responsible for the integrity of the cache accross a checkpoint/rollback. The procedures Flush and FreeBuffers below may help in this regard. Effects: Used by the BTree package to read pages of the BTree file. BTreeVM will automatically extend the backing file as the BTree grows. It never shrinks the backing file, and make no effort to keep the byte count and created-date correct. Effects: Used by the BTree package to write pages of the BTree file. Effects: Returns performance statistics (by assigning to stats^), measured from the time the handle was created. Hits are the number of ReferencePage operations for pages that were already in teh cache, and misses are the number of ReferencePage operations for pages that were not already in the cache. Reads and writes are the number of actual reads and writes to the backing file; and cumReadWriteTime is the total amount of time spent waiting for reads and writes. cumChainLength is the total number of hash chain entries searched during all lookups; the average search length is cumChainLength/(hits+misses). Effects: Forces out any dirty pages and then renders the cache empty, so that subsequent references will require pages to be read afresh from the file. Effects: All VM buffers associated with the Handle are freed. The cache is not flushed first. Êë–(cedarcode) style•NewlineDelimiter ˜codešœ™Kšœ ÏeœC™NKšœ™KšÏy™Kšž#™#K™1K™-K™+—K˜Kšœ2™2K˜šÏk ˜ KšœŸœ?˜JKšŸœŸœŸœ˜K˜K˜—KšÏnœŸœŸ œŸ˜"˜K™KšœŸœŸœ ˜Kš œ ŸœŸ œŸœŸœ˜AKšœŸœ˜K˜Kšœ ŸœÏc˜1K˜KšœŸœŸœ ˜šœ ŸœŸœ˜Kšœ?Ÿ˜CK˜K˜—š  œŸœŸœŸœ:ŸœŸœ˜ƒKšœÞŸœ–™øK™K™×K™—š  œ˜#K™ö—K˜š  œ˜K™GK™—K˜š œŸœ Ÿœ˜/K™é—K˜š  œŸœ ˜K™š—K˜š  œŸœ ˜K™a——K˜K™K˜KšŸœ˜—…—ú ÿ