home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Headers / btree / IXBTree.h next >
Text File  |  1993-08-15  |  2KB  |  70 lines

  1. /*
  2. IXBTree.h
  3. Copyright 1991, NeXT, Inc.
  4. */
  5.  
  6. #import    "protocols.h"
  7.  
  8. #import <mach/cthreads.h>
  9. #import    <objc/Object.h>
  10. #import    <store/IXStoreFile.h>
  11.  
  12. #ifdef    NX_COMPILER_RELEASE_3_0
  13. @interface IXBTree: Object <IXNameAndFileAccess, IXComparatorSetting, IXComparisonSetting>
  14. #else    NX_COMPILER_RELEASE_3_0
  15. @interface IXBTree: Object
  16. #endif    NX_COMPILER_RELEASE_3_0
  17. {
  18. @public
  19.     struct mutex    mutexLock; // public for explicit locking
  20. #ifdef    NX_COMPILER_RELEASE_3_0
  21. @protected
  22. #endif    NX_COMPILER_RELEASE_3_0
  23.     vm_offset_t        _rootOffset;
  24.     unsigned        _recordCount;
  25.     unsigned        _syncVersion;
  26.     unsigned        _codeVersion;
  27.     unsigned        _blockShift;
  28.     unsigned        _btreeDepth;
  29.     boolean_t        _freeStore;
  30.     char        *_handleName;
  31.     unsigned        _handle;
  32.     IXStore        *_store;
  33.     IXComparator    *_comparator;
  34.     void        *_context;
  35.     char        *_comparison;
  36.     struct BTreeStore    *_btreeStore;
  37.     struct        {
  38.     unsigned    isSpanning:1;
  39.     unsigned    rightRotation:1;
  40.     unsigned    leftRotation:1;
  41.     }            _cursorStatus;
  42. }
  43.  
  44. // Returns the store, e.g., [[client store] startTransaction].
  45. - (IXStore *)store;
  46.  
  47. - (unsigned)count; // returns the number of key/record pairs
  48. - empty; // removes all key/record pairs
  49.  
  50. - compact; // this method is not implemented, but remains for compatibility
  51. - (unsigned)keyLimit; // returns the maximum key length
  52.  
  53. - optimizeForTime; // faster insertion, more empty space per page
  54. - optimizeForSpace; // slower insertion, less empty space per page
  55.  
  56. // This method causes records to span node boundaries for optimal space 
  57. // utilization.  It renders the resulting B* tree unchangeable, however, and 
  58. // attempting to modify a spanned B* tree will produce an exception.  The 
  59. // records must be added to the B* tree in key order when spanning is enabled.
  60.  
  61. - setSpanning:(BOOL)flag;
  62.  
  63. // These macros accquire and release the public mutex lock instance variable.  
  64. // The lock is advisory only.  Callers must cooperate to obtain thread safety.
  65.  
  66. #define    IXLockBTreeMutex(btree)    mutex_lock(&(btree)->mutexLock)
  67. #define IXUnlockBTreeMutex(btree) mutex_unlock(&(btree)->mutexLock)
  68.  
  69. @end
  70.