File: DBIndexOp.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Willie-Sue, February 15, 1985 3:46:17 pm PST
Donahue, May 22, 1986 12:04:35 pm PDT
Contents: General operations on pages of B-trees.
Derived from: DBIndexLeaf created November 26, 1980
Last edited by:
Cattell: July 19, 1983 3:34 pm
DIRECTORY
DBCommon USING[TID],
DBIndex USING [Page, IndexKey, State];
DBIndexOp: CEDAR DEFINITIONS = {
Page: TYPE = DBIndex.Page;
State: TYPE = DBIndex.State;
IndexKey: TYPE = DBIndex.IndexKey;
OverFlow: PROC [p: Page, key: REF TEXT] RETURNS [BOOLEAN];
EntrySize: PROC [p: Page, i: CARDINAL] RETURNS [CARDINAL];
Returns the size of the entry: key plus value
RopeForKey: PROC[key: IndexKey] RETURNS[REF TEXT];
SplitPage: PROC [p: Page, loc: CARDINAL, insertSize: INTEGER] RETURNS [splitLoc: CARDINAL, splitKey: REF TEXT, overflow: Page];
SplitLeaf: PROC [p: Page, key: REF TEXT, value: LONG CARDINAL] RETURNS [Page, REF TEXT];
The page overflows if we insert <key, value> pair. We allocate a page to the right of p and moves contents, and insert <key, value> at the same time.
SplitInternal: PROC [p: Page, insertLoc: CARDINAL, key: REF TEXT, value: LONG CARDINAL]
RETURNS [Page, REF TEXT];
InsertInInternalPage: PROC [p: Page, i: CARDINAL, newPage: LONG CARDINAL, newKey: REF TEXT] RETURNS [State, Page, REF TEXT];
DeleteFromLeafPage: PROC [p: Page, key: REF TEXT, tid: DBCommon.TID] RETURNS [State, Page, REF TEXT];
MergeInLeafPage: PROC [p: Page, son: Page, index: CARDINAL] RETURNS [State, Page, REF TEXT];
ChangeKey: PROC[p: Page, newKey: REF TEXT, index: CARDINAL] RETURNS[state: State, overflow: Page, key: REF TEXT];
Sets indexed key in leaf page p to be newKey.
MoveScanIndexLeft: PUBLIC PROC [from, to: Page, nentries: CARDINAL];
"from" is to the right of "to"
moves the first "nentries" in "from" to "to"
MoveScanIndexRight: PUBLIC PROC [from, to: Page, after: CARDINAL];
moves the scan index on "from" to "to", if the index is greater than "after"
"to" is empty
DecrementScanIndex: PROC [page: Page, atOrAfter: CARDINAL];
Decrements any effected scan indices by one, if they are on "page" with index greater or equal to "atOrAfter"
IncrementScanIndex: PUBLIC PROC [page: Page, atOrAfter: CARDINAL, howMuch: CARDINAL ← 1];
Increments any effected scan indices by howMuch, if they are on "page" with index greater or equal to "atOrAfter"
}.
Change log since Sept 82:
By Cattell September 22, 1982 9:20 am: Re-organized DBIndex interfaces for isolating page writes. Moved some procs from here to DBIndexMod.
Changed by Willie-Sue on February 15, 1985
made Cedar, added tioga formatting