|
|
1.1 ! root 1: .de am ! 2: .ne 8 ! 3: .sp 4 ! 4: \\$1 (\\$2) ! 5: .. ! 6: .th INTERNAL AM 1/19/79 ! 7: .sh NAME ! 8: internal routine used by the access methods. ! 9: .sh SYNOPSIS ! 10: The functions listed in this section should not be ! 11: called directly by any higher level program. ! 12: These functions are all used to implement the ! 13: access method calls described elsewhere in this manual. ! 14: .am ACC_CLOSE 9/3/77 ! 15: .sh NAME ! 16: acc_close - close relations opened by readadmin ! 17: .sh SYNOPSIS ! 18: acc_close() ! 19: .sh DESCRIPTION ! 20: ACC_CLOSE closes the relation and attribute relations ! 21: which were opened by READADMIN using the ! 22: Admin_rel and Admin_att descriptor structs. ! 23: ACC_CLOSE calls CLEANREL to flush and reset any ! 24: buffers associated with these two relations. ! 25: .sh DIAGNOSTICS ! 26: If an error occurs in CLEANREL ! 27: a SYSERR is generated. ! 28: .sh "SEE ALSO" ! 29: readadmin ! 30: .am ACC_ERR 9/13/77 ! 31: .sh NAME ! 32: acc_err - set global Accerror indicator ! 33: .sh SYNOPSIS ! 34: .nf ! 35: acc_err(errnum) ! 36: int errnum; ! 37: .fi ! 38: .sh DESCRIPTION ! 39: ACC_ERR will set the global Accerror indicator to the value ! 40: of ERRNUM and then return that value. ! 41: The Accerror indicator is printed whenever a SYSERR occurs ! 42: and its value is non-zero. ! 43: .sh "TRACE FLAGS" ! 44: 85.0 ! 45: .sh "SEE ALSO" ! 46: closer, get_attuples, get_page, openr, pageflush ! 47: .am ACC_INIT 8/31/77 ! 48: .sh NAME ! 49: acc_init - initialize access methods ! 50: .sh SYNOPSIS ! 51: .nf ! 52: acc_init() ! 53: .fi ! 54: .sh DESCRIPTION ! 55: ACC_INIT initializes the access methods by setting up ! 56: all of the access method buffers and all the pointers ! 57: that link them together. ! 58: The buffers are organized so that only one buffer can be used ! 59: by any one relation. ! 60: This helps so that ! 61: "there is a little bit of each relation" available since ! 62: many programs go back and forth between two or more relations. ! 63: The buffers are allocated in a least recenlty used fashion. ! 64: ACC_INIT calls READADMIN to initialize the Admin, ! 65: Admin_rel and Admin_att structures and to ! 66: open the relation and attribute relations. ! 67: ACC_INIT also opens the lock device ! 68: used for concurrency control. ! 69: .sh DIAGNOSTICS ! 70: No value is returned. ! 71: If an error occurs a SYSERR is generated. ! 72: .sh "TRACE FLAGS" ! 73: 81.0, 81.1 ! 74: .sh "SEE ALSO" ! 75: resetacc, readadmin ! 76: .am ADD_A_PAGE 9/3/77 ! 77: .sh NAME ! 78: add_a_page - add a page to a relation ! 79: .sh SYNOPSIS ! 80: .nf ! 81: add_a_page(d, tid) ! 82: struct descriptor *d; ! 83: struct tup_id *tid; ! 84: .fi ! 85: .sh DESCRIPTION ! 86: ADD_A_PAGE adds a page to the given relation. ! 87: It is assumed that the current access method buffer ! 88: contains a page from the relation. ! 89: No linking is done to this page, ! 90: i.e. no other page is affected by adding a page ! 91: to a relation using this function. ! 92: The new page is not written but is marked for writing. ! 93: TID will contain the page id of the new page. ! 94: This function is used by MODIFY. ! 95: .sh DIAGNOSTICS ! 96: .nf ! 97: -1 -- pageflush failure on previous page in buffer ! 98: 0 -- success ! 99: .fi ! 100: .sh "SEE ALSO" ! 101: add_ovflo, add_prim ! 102: .am ADD_OVFLO 9/6/77 ! 103: .sh NAME ! 104: add_ovflo - add overflow page to a relation ! 105: .sh SYNOPSIS ! 106: .nf ! 107: add_ovflo(d, tid) ! 108: struct descriptor *d; ! 109: struct tup_id *tid; ! 110: .fi ! 111: .sh DESCRIPTION ! 112: ADD_OVFLO will add an overflow page to the page ! 113: in the current access method buffer. ! 114: The page must be part of the relation described in D. ! 115: TID will be updated to the id of the new overflow page. ! 116: .sh DIAGNOSTICS ! 117: .nf ! 118: -5, -3 -- get_page failure ! 119: -4, -2, -1 -- pageflush failure ! 120: 0 -- success ! 121: .fi ! 122: .sh "SEE ALSO" ! 123: add_a_page, add_prim, findbest ! 124: .am ADD_PRIM 9/3/77 ! 125: .sh NAME ! 126: add_prim - add a primary page to a relation ! 127: .sh SYNOPSIS ! 128: .nf ! 129: add_prim(d, tid) ! 130: struct descriptor *d; ! 131: struct tup_id *tid; ! 132: .fi ! 133: .sh DESCRIPTION ! 134: ADD_PRIM adds a primary page to the given relation. ! 135: It is assumed that the current access method buffer ! 136: contains the last primary page of the relation. ! 137: The new page is marked for writing. ! 138: TID will contain the page id of the new page. ! 139: ADD_PRIM is called by MODIFY. ! 140: .sh DIAGNOSTICS ! 141: .nf ! 142: -1, -2 -- pageflush failure ! 143: 0 -- success ! 144: .fi ! 145: .sh "SEE ALSO" ! 146: add_a_page, add_ovflo ! 147: .am ADDABYTE 9/7/77 ! 148: .sh NAME ! 149: addabyte - add byte to hash key ! 150: .sh SYNOPSIS ! 151: .nf ! 152: addabyte(ch, word, knt) ! 153: char ch; ! 154: long *word; ! 155: int knt; ! 156: .fi ! 157: .sh DESCRIPTION ! 158: ADDABYTE takes a byte at a time from CH which is rotated and exclusive-ored ! 159: into WORD, a long integer. ! 160: This function is used by RHASH to form the hash key. ! 161: KNT determines how CH is rotated. ! 162: .sh DIAGNOSTICS ! 163: No value is returned. ! 164: .sh "SEE ALSO" ! 165: rhash ! 166: .am CANONICAL 9/13/77 ! 167: .sh NAME ! 168: canonical - make tuple canonical ! 169: .sh SYNOPSIS ! 170: .nf ! 171: canonical (d, tuple) ! 172: struct descriptor *d; ! 173: char tuple[MAXTUP]; ! 174: .fi ! 175: .sh DESCRIPTION ! 176: CANONICAL will make TUPLE canonical and return the new length ! 177: of the tuple. ! 178: If the relation specified by D is compressed, ! 179: TUPLE will be compressed and stored in the global Accanon. ! 180: If the relation is not compressed, ! 181: all character domains of TUPLE will be blank padded. ! 182: In either case the global pointer Acctuple ! 183: will point to the canonical tuple. ! 184: .sh DIAGNOSTICS ! 185: No error value is returned. ! 186: .sh "SEE ALSO" ! 187: comp_tup, insert, put_tuple, replace ! 188: .am CHOOSE_BUF 9/3/77 ! 189: .sh NAME ! 190: choose_buf - select an access method buffer ! 191: .sh SYNOPSIS ! 192: .nf ! 193: struct accbuf *choose_buf() ! 194: .fi ! 195: .sh DESCRIPTION ! 196: CHOOSE_BUF will scan the access method buffers for a ! 197: free buffer and return a pointer to the buffer. ! 198: If there is no free buffer ! 199: the last buffer in the LRU list is flushed and reset ! 200: and a pointer to it is returned. ! 201: .sh DIAGNOSTICS ! 202: .nf ! 203: -1 -- pageflush or reset failure ! 204: .fi ! 205: .sh "TRACE FLAGS" ! 206: 82.8 ! 207: .sh "SEE ALSO" ! 208: formatpg, get_page, resetacc ! 209: .am COMP_TUP 9/13/77 ! 210: .sh NAME ! 211: comp_tup - compress a tuple ! 212: .sh SYNOPSIS ! 213: .nf ! 214: comp_tup(d, tuple) ! 215: struct descriptor *d; ! 216: char tuple[MAXTUP]; ! 217: .fi ! 218: .sh DESCRIPTION ! 219: COMP_TUP will compress TUPLE into the global area Accanon. ! 220: The compression consists of replacing trailing blanks in character fields ! 221: with null string terminators. ! 222: No compression is done on numeric fields. ! 223: This compression method will never result in a tuple ! 224: becoming longer than the normal tuple. ! 225: COMP_TUP will return the length of the compressed tuple. ! 226: .sh DIAGNOSTICS ! 227: No error value is returned. ! 228: .sh "SEE ALSO" ! 229: canonical, put_tuple, uncomp_tup ! 230: .am DEL_TUPLE 9/6/77 ! 231: .sh NAME ! 232: del_tuple - delete specified tuple from current page ! 233: .sh SYNOPSIS ! 234: .nf ! 235: del_tuple(tid, width) ! 236: struct tup_id *tid; ! 237: int width; ! 238: .fi ! 239: .sh DESCRIPTION ! 240: DEL_TUPLE deletes the tuple specified by TID from the page ! 241: in the current access method buffer. ! 242: WIDTH must equal the true width of the tuple in bytes ! 243: after any compression is performed. ! 244: No checking is done to guarantee that the page id in TID ! 245: matches the page in the access method buffer. ! 246: .sh DIAGNOSTICS ! 247: No value is returned. ! 248: .sh "SEE ALSO" ! 249: delete, replace ! 250: .am DUMPTID 9/14/77 ! 251: .sh NAME ! 252: dumptid - print tuple id ! 253: .sh SYNOPSIS ! 254: .nf ! 255: dumptid(tid) ! 256: struct tup_id *tid; ! 257: .fi ! 258: .sh DESCRIPTION ! 259: DUMPTID will print the page and line ids of TID ! 260: on the UNIX standard output. ! 261: .sh DIAGNOSTICS ! 262: .nf ! 263: 0 -- success ! 264: .fi ! 265: .am DUP_CHECK 9/14/77 ! 266: .sh NAME ! 267: dup_check - check page for duplicate tuple ! 268: .sh SYNOPSIS ! 269: .nf ! 270: dup_check(d, tuple) ! 271: struct descriptor *d; ! 272: char tuple[MAXTUP]; ! 273: .fi ! 274: .sh DESCRIPTION ! 275: DUP_CHECK will scan the page in the current access method buffer ! 276: for a duplicate of TUPLE. ! 277: No checking is done to verify that the page in the current access ! 278: method buffer is part of the relation described by D. ! 279: .sh DIAGNOSTICS ! 280: .nf ! 281: 0 -- no duplicate found ! 282: 1 -- duplicate found ! 283: .fi ! 284: .sh "SEE ALSO" ! 285: findbest, scan_dups ! 286: .am FIND_BUF 9/3/77 ! 287: .sh NAME ! 288: find_buf - find a buffer with a page from the given relation ! 289: .sh SYNOPSIS ! 290: .nf ! 291: struct accbuf *find_buf(d) ! 292: struct descriptor *d; ! 293: .fi ! 294: .sh DESCRIPTION ! 295: FIND_BUF will scan all the access method buffers until it finds ! 296: a buffer with a relation id that matches the relation id ! 297: in the descriptor struct, ! 298: and return a pointer to the buffer. ! 299: If no buffer is found a zero is returned. ! 300: If the access method buffers have not been initialized ! 301: by the time FIND_BUF is called, ! 302: ACC_INIT is called to initialize them. ! 303: .sh DIAGNOSTICS ! 304: If an error occurs in ACC_INIT a SYSERR is generated. ! 305: .sh "TRACE FLAGS" ! 306: 82.0 ! 307: .sh "SEE ALSO" ! 308: acc_init, cleanrel, closer, find, findbest, inpcloser, noclose, get_page ! 309: .am FINDBEST 9/8/77 ! 310: .sh NAME ! 311: findbest - determine best page to insert a tuple ! 312: .sh SYNOPSIS ! 313: .nf ! 314: findbest(d, tid, tuple, need, checkdups) ! 315: struct descriptor *d; ! 316: struct tup_id *tid; ! 317: char tuple[MAXTUP]; ! 318: int need, checkdups; ! 319: .fi ! 320: .sh DESCRIPTION ! 321: FINDBEST will find the best page in the relation described ! 322: by D for TUPLE. ! 323: NEED indicates how much space is needed to store the tuple. ! 324: If the relation is stored as a heap, ! 325: FINDBEST will try to fit the tuple on the current page ! 326: in the access method buffers. ! 327: If there is no space, ! 328: or if the current page is not available, ! 329: the last page of the relation is selected. ! 330: For other storage structures, ! 331: FINDBEST will try to fit the tuple on the correct primary page ! 332: or on one of its overflow pages that is closest to the primary page. ! 333: If there is no free space a new overflow page is created. ! 334: If CHECKDUPS is true, ! 335: the primary page and all its overflow pages will be scanned ! 336: for a duplicate of the tuple. ! 337: If a duplicate is found ! 338: then the new tuple will not be inserted, ! 339: otherwise FINDBEST allocates an entry in the line number table ! 340: of the target page for the tuple being inserted. ! 341: TID will be set to the location of the new tuple. ! 342: .sh DIAGNOSTICS ! 343: .nf ! 344: -8 -- unidentifiable storage structure in find ! 345: -5, -3, -1 -- get_page failure ! 346: -4, -2, -1 -- pageflush failure ! 347: 1 -- duplicate found ! 348: .fi ! 349: .sh "TRACE FLAGS" ! 350: 88.2 ! 351: .sh "SEE ALSO" ! 352: dup_check, find, insert, replace, scan_dups ! 353: .am FULLKEY 9/6/77 ! 354: .sh NAME ! 355: fullkey - determine if SETKEY has been called ! 356: for every keyed domain of a relation. ! 357: .sh SYNOPSIS ! 358: .nf ! 359: fullkey(d) ! 360: struct descriptor *d; ! 361: .fi ! 362: .sh DESCRIPTION ! 363: FULLKEY will determine if SETKEY was called ! 364: for every keyed domain of a given relation. ! 365: This is important for the hashing function ! 366: since it can only accept keys where a value has ! 367: been provided for each keyed domain. ! 368: .sh DIAGNOSTICS ! 369: .nf ! 370: 0 -- only a partial key is provided ! 371: 1 -- a full key is provided ! 372: .fi ! 373: .sh "SEE ALSO" ! 374: find, rhash ! 375: .am GET_ADDR 9/12/77 ! 376: .sh NAME ! 377: get_addr - get address of tuple within page ! 378: .sh SYNOPSIS ! 379: .nf ! 380: char *get_addr(tid) ! 381: struct tup_id *tid; ! 382: .fi ! 383: .sh DESCRIPTION ! 384: GET_ADDR computes and returns the character address of the tuple specified ! 385: by TID in the current access method buffer. ! 386: .sh DIAGNOSTICS ! 387: No error codes are returned. ! 388: If an error is detected ! 389: a SYSERR is generated. ! 390: .sh "SEE ALSO" ! 391: get_tuple, put_tuple ! 392: .am GET_ATTUPLES 9/13/77 ! 393: .sh NAME ! 394: get_attuples - get tuples from attribute relation ! 395: .sh SYNOPSIS ! 396: .nf ! 397: get_attuples(d) ! 398: struct descriptor *d; ! 399: .fi ! 400: .sh DESCRIPTION ! 401: GET_ATTUPLES will fill the attribute template of the descriptor ! 402: struct D with data from tuples of the attribute relation. ! 403: The relation must be identified in D, ! 404: which can be done by calling GET_RELTUPLE. ! 405: .sh DIAGNOSTICS ! 406: .nf ! 407: -8 -- unidentifiable storage structure in find ! 408: -6 -- missing attributes from attribute relation ! 409: -2 -- pagelfush failure ! 410: -1 -- get_page failure or invalid error ! 411: 0 -- success ! 412: .fi ! 413: .sh "TRACE FLAGS" ! 414: 90.3 ! 415: .sh "SEE ALSO" ! 416: get_reltuple, openr ! 417: .am GET_PAGE 4/5/77 ! 418: .sh NAME ! 419: get_page - get a page from a relation ! 420: .sh SYNOPSIS ! 421: .nf ! 422: get_page(d, tid) ! 423: struct descriptor *d; ! 424: struct tup_id *tid; ! 425: .fi ! 426: .sh DESCRIPTION ! 427: GET_PAGE will retrieve a page from the UNIX file ! 428: which corresponds to a given relation, ! 429: unless the page is already available in one of ! 430: the access method buffers. ! 431: If the page has to be read in, ! 432: it will be placed in a buffer corresponding to the ! 433: relation specified by D. ! 434: If there is no such buffer, ! 435: the last buffer in the LRU buffer queue is flushed ! 436: and the page is placed in that buffer. ! 437: The buffer containing the requested page is then placed at the ! 438: top of the LRU buffer queue. ! 439: If the relation was opened in read/write mode, ! 440: a lock is set on the page to maintain proper concurrency control. ! 441: The current page size is 512 bytes of which ! 442: 498 bytes are available for tuple storage. ! 443: .sh DIAGNOSTICS ! 444: .nf ! 445: -2 -- pageflush error ! 446: -1 -- UNIX read error ! 447: 0 -- success ! 448: .fi ! 449: .sh "TRACE FLAGS" ! 450: 83.0, 83.1, 83.2 ! 451: .sh "SEE ALSO" ! 452: choose_buf, find_buf, get, resetacc, pageflush, top_acc ! 453: .am GET_RELTUPLE 9/13/77 ! 454: .sh NAME ! 455: get_reltuple - get tuple from relation relation ! 456: .sh SYNOPSIS ! 457: .nf ! 458: get_reltuple(d, name) ! 459: struct descriptor *d; ! 460: char name[MAXNAME + 1]; ! 461: .fi ! 462: .sh DESCRIPTION ! 463: GET_RELTUPLE will get a tuple from the relation relation ! 464: for the relation specified by NAME ! 465: and place the tuple in the descriptor struct pointed to by D. ! 466: Two search attempts are made, ! 467: the first for a relation owned by the current user, ! 468: the second for a relation owned by the ! 469: data base administrator. ! 470: .sh DIAGNOSTICS ! 471: .nf ! 472: -8 -- unidentifiable storage structure in find ! 473: -2 -- pageflush failure ! 474: -1 -- get_page failure or invalid error ! 475: 0 -- success ! 476: 1 -- no tuples could be found ! 477: .fi ! 478: .sh "TRACE FLAGS" ! 479: 90.1 ! 480: .sh "SEE ALSO" ! 481: openr, readadmin ! 482: .am GET_TUPLE 9/12/77 ! 483: .sh NAME ! 484: get_tuple - get tuple from page ! 485: .sh SYNOPSIS ! 486: .nf ! 487: get_tuple(d, tid, tuple) ! 488: struct descriptor *d; ! 489: struct tup_id *tid; ! 490: char tuple[MAXTUP]; ! 491: .fi ! 492: .sh DESCRIPTION ! 493: GET_TUPLE will move a tuple from the page in the current ! 494: access method buffer to TUPLE, ! 495: performing any necessary decompression. ! 496: The tuple is identified by TID, ! 497: no checking is done to verify that the current page in the ! 498: access method buffer corresponds to TID or the relation ! 499: specified by D. ! 500: .sh DIAGNOSTICS ! 501: No value is returned. ! 502: .sh "SEE ALSO" ! 503: get, uncomp_tup ! 504: .am INVALID 9/12/77 ! 505: .sh NAME ! 506: invalid - check the validity of a tuple id ! 507: .sh SYNOPSIS ! 508: .nf ! 509: invalid(tid) ! 510: struct tup_id *tid; ! 511: .fi ! 512: .sh DESCRIPTION ! 513: INVALID checks if the tuple id represents a valid tuple ! 514: versus one that has been deleted. ! 515: INVALID assumes that the tuple id is for the ! 516: page in the current buffer. ! 517: .sh DIAGNOSTICS ! 518: .nf ! 519: -1 -- line id exceeded line number table ! 520: 0 -- tuple id is valid ! 521: 2 -- tuple was deleted ! 522: .fi ! 523: .sh "SEE ALSO" ! 524: delete, get, replace ! 525: .am LAST_PAGE 9/13/77 ! 526: .sh NAME ! 527: last_page - compute tid for last page in relation ! 528: .sh SYNOPSIS ! 529: .nf ! 530: last_page(d, tid) ! 531: struct descriptor *d; ! 532: struct tup_id *tid; ! 533: .fi ! 534: .sh DESCRIPTION ! 535: LAST_PAGE computes a tuple id for the last page in the relation specified ! 536: by D and stores the id in TID. ! 537: The line id in TID is set to zero. ! 538: .sh DIAGNOSTICS ! 539: .nf ! 540: 0 -- success ! 541: .fi ! 542: If an error occurs a SYSERR is generated. ! 543: .sh "SEE ALSO" ! 544: add_ovflo, findbest, fstat (UNIX function) ! 545: .am NDXSEARCH 9/7/77 ! 546: .sh NAME ! 547: ndxsearch - search ISAM directory ! 548: .sh SYNOPSIS ! 549: .nf ! 550: ndxsearch(d, tid, key, mode, keyok) ! 551: struct descriptor *d; ! 552: struct tup_id *tid; ! 553: char key[MAXTUP]; ! 554: int mode, keyok; ! 555: .fi ! 556: .sh DESCRIPTION ! 557: NDXSEARCH will search the ISAM directory for the given relation. ! 558: It is assumed that the relation is stored as an ISAM file. ! 559: It is not necessary to provide values for all keyed domains, ! 560: but the only values used are those starting with the most ! 561: significant keyed domain ! 562: to the first keyed domain that does not have a value ! 563: provided by SETKEY. ! 564: If MODE is less than zero, ! 565: NDXSEARCH will determine the lower limit of a scan ! 566: according to the key. ! 567: The limit is returned in TID. ! 568: If MODE is greater than zero, ! 569: the upper scan limit is determined. ! 570: If KEYOK is true (not equal to zero), ! 571: it is assumed that values for all keyed domains ! 572: have been provided regardless of whether SETKEY was called. ! 573: .sh DIAGNOSTICS ! 574: .nf ! 575: -2 -- pageflush failure ! 576: -1 -- get_page failure ! 577: 0 -- success ! 578: .fi ! 579: .sh "SEE ALSO" ! 580: find, setkey ! 581: .am NEWLINO 9/13/77 ! 582: .sh NAME ! 583: newlino - find free line number on page ! 584: .sh SYNOPSIS ! 585: .nf ! 586: newlino(len) ! 587: int len; ! 588: .fi ! 589: .sh DESCRIPTION ! 590: NEWLINO will scan the line number table in the page in the ! 591: current access method buffer, ! 592: looking for a free table entry. ! 593: If an entry is found it is allocated for a new tuple, ! 594: otherwise a new entry is created at the end of the ! 595: line number table and allocated for a new tuple. ! 596: Space in the page is also reserved for a tuple ! 597: of length LEN. ! 598: NEWLINO returns the line number allocated for a new tuple. ! 599: .sh DIAGNOSTICS ! 600: No error value is returned. ! 601: .sh "SEE ALSO" ! 602: findbest ! 603: .am PAGEFLUSH 9/13/77 ! 604: .sh NAME ! 605: pageflush - flush access method buffers ! 606: .sh SYNOPSIS ! 607: .nf ! 608: pageflush(buf) ! 609: struct accbuf *buf; ! 610: .fi ! 611: .sh DESCRIPTION ! 612: PAGEFLUSH will write the access method buffer pointed to ! 613: by BUF onto disk if the buffer was tagged for writing. ! 614: PAGEFLUSH can be called with the parameter "Acc_head" ! 615: which is a global buffer pointer (declared in access.h) ! 616: which will flush the current access method buffer. ! 617: PAGEFLUSH can also be called with a 0 (i.e. a null pointer) ! 618: which will flush all buffers ! 619: tagged for writing. ! 620: If a page was locked, ! 621: it is unlocked after being written to disk. ! 622: .sh DIAGNOSTICS ! 623: .nf ! 624: -2 -- UNIX write error ! 625: 0 -- success ! 626: .fi ! 627: .sh "TRACE FLAGS" ! 628: 84.0, 84.1, 84.2 ! 629: .sh "SEE ALSO" ! 630: get_page, resetacc ! 631: .am PLUCK_PAGE 9/14/77 ! 632: .sh NAME ! 633: pluck_page - extract page id from tuple id ! 634: .sh SYNOPSIS ! 635: .nf ! 636: pluck_page(tid, pnum) ! 637: struct tup_id *tid; ! 638: long *pnum; ! 639: .fi ! 640: .sh DESCRIPTION ! 641: PLUCK_PAGE will extract the page id from TID and ! 642: store it in the long variable pointed to by PNUM. ! 643: .sh DIAGNOSTICS ! 644: .nf ! 645: 0 -- success ! 646: .fi ! 647: .sh "SEE ALSO" ! 648: stuff_page, tup_id ! 649: .am PUT_TUPLE 9/13/77 ! 650: .sh NAME ! 651: put_tuple - put tuple in page ! 652: .sh SYNOPSIS ! 653: .nf ! 654: put_tuple(tid, tuple, length) ! 655: struct tup_id *tid; ! 656: char tuple[MAXTUP]; ! 657: int length; ! 658: .fi ! 659: .sh DESCRIPTION ! 660: PUT_TUPLE will move TUPLE into the page in the current access method buffer ! 661: at the location specified by TID. ! 662: It is assumed that any required compression has already been done ! 663: and that the correct amount of space has been reserved on the page ! 664: for the tuple. ! 665: No checking is done to verify that the page identified by TID ! 666: corresponds to the page in the current access method buffer. ! 667: .sh DIAGNOSTICS ! 668: No value is returned. ! 669: .sh "TRACE FLAGS" ! 670: 87.0 ! 671: .sh "SEE ALSO" ! 672: canonical, get_addr, insert, replace ! 673: .am READADMIN 9/3/77 ! 674: .sh NAME ! 675: readadmin - read data from admin file ! 676: .sh SYNOPSIS ! 677: .nf ! 678: readadmin() ! 679: .fi ! 680: .sh DESCRIPTION ! 681: READADMIN will read data from the admin file. ! 682: The admin file contains two descriptor structs, ! 683: one for the relation relation and one for the ! 684: attribute relation. ! 685: These two descriptors are used by the access methods ! 686: whenever either of the relations has to be used ! 687: to retrieve or update information. ! 688: The two descriptors are globally declared as ! 689: Admin_rel and Admin_att. ! 690: The admin file also contains the user id for the data base administrator, ! 691: which is stored in the Admin_admin struct. ! 692: .sh DIAGNOSTICS ! 693: Nothing is returned. ! 694: If an error occurs a SYSERR is generated. ! 695: .sh "SEE ALSO" ! 696: acc_init ! 697: .am RESETACC 8/31/77 ! 698: .sh NAME ! 699: resetacc - reset access method buffer ! 700: .sh SYNOPSIS ! 701: .nf ! 702: resetacc(buf) ! 703: struct accbuf *buf; ! 704: .fi ! 705: .sh DESCRIPTION ! 706: RESETACC will first flush the given buffer ! 707: if it contains a dirty page from some relation, ! 708: then clear the relation identifier and other fields in the buffer. ! 709: This has ! 710: the effect of erasing the buffer so that any attempt to access ! 711: the page that was contained in the buffer will fail unless ! 712: the page is read back from disk. ! 713: If the buf parameter equals zero, ! 714: the current access method buffer is reset. ! 715: .sh DIAGNOSTICS ! 716: .nf ! 717: 0 -- success ! 718: < 0 -- pageflush fail (see pageflush for error codes) ! 719: .fi ! 720: .sh "TRACE FLAGS" ! 721: 80.0 ! 722: .sh "SEE ALSO" ! 723: acc_init, choose_buf, cleanrel, pageflush ! 724: .am RHASH 9/7/77 ! 725: .sh NAME ! 726: rhash - compute hash key ! 727: .sh SYNOPSIS ! 728: .nf ! 729: long rhash(d, key) ! 730: struct descriptor *d; ! 731: char key[MAXTUP]; ! 732: .fi ! 733: .sh DESCRIPTION ! 734: RHASH will perform a randomizing hash on the full key. ! 735: Values for the hash function are taken from every keyed domain of KEY. ! 736: It is important that every keyed domain have a correct value, ! 737: otherwise the hash result will be incorrect. ! 738: RHASH returns a page number in the form of a long integer. ! 739: .sh DIAGNOSTICS ! 740: None. ! 741: .sh "TRACE FLAGS" ! 742: 92.8 ! 743: .sh "SEE ALSO" ! 744: addabyte, find ! 745: .am SCAN_DUPS 9/14/77 ! 746: .sh NAME ! 747: scan_dups - scan for duplicate tuples ! 748: .sh SYNOPSIS ! 749: .nf ! 750: scan_dups(d, tid, tuple) ! 751: struct descriptor *d; ! 752: struct tup_id *tid; ! 753: char tuple[MAXTUP]; ! 754: .fi ! 755: .sh DESCRIPTION ! 756: SCAN_DUPS will look for a duplicate of TUPLE ! 757: beginning with the page specified by TID. ! 758: SCAN_DUPS will also check all overflow pages linked ! 759: to the first page until a duplicate is found. ! 760: SCAN_DUPS will make sure that the page ! 761: that was in the current access method buffer upon entry ! 762: will be there upon exit, ! 763: as long as that page was part of the relation ! 764: described by D. ! 765: .sh DIAGNOSTICS ! 766: .nf ! 767: -2 -- pageflush failure ! 768: -1 -- get_page failure ! 769: 0 -- no duplicate found ! 770: 1 -- duplicate found ! 771: .fi ! 772: .sh "SEE ALSO" ! 773: dup_check, findbest, replace ! 774: .am SPACE_LEFT 9/13/77 ! 775: .sh NAME ! 776: space_left - compute amount of free space on page ! 777: .sh DESCRIPTION ! 778: SPACE_LEFT will determine how much space is left on ! 779: the current page for tuple storage. ! 780: The return value is the amount of free space in bytes. ! 781: .sh DIAGNOSTICS ! 782: none ! 783: .sh "SEE ALSO" ! 784: findbest ! 785: .am STUFF_PAGE 9/14/77 ! 786: .sh NAME ! 787: stuff_page - set page id of tuple id ! 788: .sh SYNOPSIS ! 789: .nf ! 790: stuff_page(tid, pnum) ! 791: struct tup_id *tid; ! 792: long *pnum; ! 793: .fi ! 794: .sh DESCRIPTION ! 795: STUFF_PAGE will take the page number pointed to by PNUM ! 796: and store it in TID without affecting the ! 797: line id in TID. ! 798: .sh DIAGNOSTICS ! 799: .nf ! 800: 0 -- success ! 801: .fi ! 802: .sh "SEE ALSO" ! 803: pluck_page, tup_id ! 804: .am TOP_ACC 9/3/77 ! 805: .sh NAME ! 806: top_acc - move buffer to top of LRU list ! 807: .sh SYNOPSIS ! 808: .nf ! 809: top_acc(buf) ! 810: struct accbuf *buf ! 811: .fi ! 812: .sh DESCRIPTION ! 813: TOP_ACC unlinks the buffer from its current position ! 814: in the LRU linked list and relinks it at the top of the list. ! 815: TOP_ACC is called for a buffer every time it is accessed ! 816: to maintain the LRU sequence of the linked list. ! 817: .sh DIAGNOSTICS ! 818: .nf ! 819: 0 -- success ! 820: .fi ! 821: .sh "SEE ALSO" ! 822: acc_init ! 823: .am TUP_ID 9/14/77 ! 824: .sh NAME ! 825: tup_id - tuple id structure ! 826: .sh SYNOPSIS ! 827: .nf ! 828: struct tup_id ! 829: { ! 830: char pg1, line_id; ! 831: int pg2; ! 832: } tid; ! 833: .fi ! 834: .sh DESCRIPTION ! 835: The TUP_ID structure is used to declare tuple id's ! 836: which are passed as parameters to some of the ! 837: access method routines. ! 838: The tuple id uniquely addresses a tuple of a relation. ! 839: Since tuples can move around within a relation, ! 840: tuple id's should NOT be saved. ! 841: It may be desirable to access the tuple id in some ! 842: special cases to gather statistics on disk usage. ! 843: At no time should a program modify a tuple id, ! 844: the access methods take care of initializing ! 845: and updating tuple id's as necessary. ! 846: .sh "SEE ALSO" ! 847: delete, find, get, insert, pluck_page, replace, stuff_page ! 848: .am TUP_LEN 9/14/77 ! 849: .sh NAME ! 850: tup_len - determine length of tuple ! 851: .sh SYNOPSIS ! 852: .nf ! 853: tup_len(tid) ! 854: struct tup_id *tid; ! 855: .fi ! 856: .sh DESCRIPTION ! 857: TUP_LEN will determine how many bytes in the page in the current access method ! 858: buffer are used by the tuple ! 859: pointed to by TID, ! 860: and return the length. ! 861: No checking is done to verify that the page specified by TID ! 862: corresponds to the page in the current access method buffer. ! 863: .sh DIAGNOSTICS ! 864: No error value is returned. ! 865: .sh "TRACE FLAGS" ! 866: 89.1 ! 867: .sh "SEE ALSO" ! 868: delete, replace ! 869: .am UNCOMP_TUP 9/12/77 ! 870: .sh NAME ! 871: uncomp_tup - decompress tuple ! 872: .sh SYNOPSIS ! 873: .nf ! 874: uncomp_tup(d, cp, tuple) ! 875: struct descriptor *d; ! 876: char *cp, tuple[MAXTUP]; ! 877: .fi ! 878: .sh DESCRIPTION ! 879: UNCOMP_TUP will decompress the tuple pointed to by CP ! 880: and store the result in TUPLE. ! 881: .sh DIAGNOSTICS ! 882: No value is returned. ! 883: .sh "SEE ALSO" ! 884: comp_tup, get_tuple
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.