home *** CD-ROM | disk | FTP | other *** search
- /*
- IXBTree.h
- Copyright 1991, NeXT, Inc.
- */
-
- #import "protocols.h"
-
- #ifndef RELEASE_2
- #import <mach/cthreads.h>
- #else RELEASE_2
- #import <cthreads.h>
- #endif RELEASE_2
- #import <objc/Object.h>
- #import <store/IXStoreFile.h>
-
- #ifndef RELEASE_2
- @interface IXBTree: Object <IXBlockAndStoreAccess, IXNameAndFileAccess, IXComparatorSetting, IXComparisonSetting>
- #else RELEASE_2
- @interface IXBTree: Object
- #endif RELEASE_2
- {
- @public
- struct mutex mutexLock; // public for explicit locking
- #ifndef RELEASE_2
- @protected
- #endif RELEASE_2
- vm_offset_t _rootOffset;
- unsigned _recordCount;
- unsigned _syncVersion;
- unsigned _codeVersion;
- unsigned _page_size_shift;
- unsigned _btreeDepth;
- boolean_t _freeStore;
- char *_handleName;
- unsigned _blockHandle;
- IXStore *_store;
- IXComparator *_comparator;
- void *_context;
- char *_comparison;
- struct BTreeStore *_btreeStore;
- struct {
- unsigned isSpanning:1;
- unsigned rightRotation:1;
- unsigned leftRotation:1;
- } _cursorStatus;
- }
-
- - (unsigned)count; // returns the number of key/record pairs
- - empty; // removes all key/record pairs
-
- - compact; // reduces storage by ~25%; reduces key insertion performance
- - (unsigned)keyLimit; // returns maximum key length
-
- - optimizeForTime; // faster insertion, more empty space per page
- - optimizeForSpace; // slower insertion, less empty space per page
-
- - setSpanning:(BOOL)flag; // undocumented; packing read only B* trees
-
- #ifdef RELEASE_2
- // @protocol IXComparatorSetting
-
- - getComparator:(IXComparator **)comparator andContext:(const void **)context;
- - setComparator:(IXComparator *)comparator andContext:(const void *)context;
-
- // @protocol IXComparisonSetting
-
- - (const char *)comparisonFormat;
- - setComparisonFormat:(const char *)aFormat;
-
- // @protocol IXBlockAndStoreAccess
-
- + freeFromBlock:(unsigned)aHandle inStore:(id)aStore;
- - freeFromStore;
-
- - initInStore:(id)aStore;
- - initFromBlock:(unsigned)aHandle inStore:(id)aStore;
-
- - getBlock:(unsigned *)aHandle andStore:(id *)aStore;
-
- // @protocol IXNameAndFileAccess
-
- + freeFromName:(const char *)aName inFile:(const char *)aFile;
-
- - initWithName:(const char *)aName inFile:(const char *)aFile;
- - initFromName:(const char *)'e inFile:(const char *)aFile
- forWriting:(BOOL)writingFlag;
-
- - getName:(const char **)aName andFile:(const char **)aFile;
- #endif RELEASE_2
-
- @end
-
- #define IXLockBTreeMutex(btree) mutex_lock(&(btree)->mutexLock)
- #define IXUnlockBTreeMutex(btree) mutex_unlock(&(btree)->mutexLock)
-
-