IndexManager Interface details
An IndexManager provides the interface to using and Index, and keeps multiple Index object. This is designed to be used with a GOODS database, but it wouldn't have to be. There is one method used that is part of the GOODS package: Object>>yourClass. This is to allow the retreival of a class name through a KKKProxyObject.
An Index keeps a single BTree to store the mapping this Index is responsible for, which are Class-Selector pairs.
The protocol for the IndexManager is:
- instance creation
- new
indexMgr := IndexManager new
- new
- creating a new index
- for:index:unique:
indexMgr for: MyExampleClass index: #myExampleMethod unique: true. " This a convenience method that defaults to non unique. Leaf values are stored in Sets. indexMgr for: MyExampleClass index: #myExampleMethod
- for:index:unique:
- finding an object
- find:where:is:
" This will return a Set or an object depending on whether the index was unique or not" indexMgr find: MyExampleClass where: #myExampleMethod is: 'foo'
- find:where:is:
- adding objects
- add:
"This will add for all defined indexes" indexMgr add: (MyExampleClass new myExampleMethod: 'foo')
- add:
- removing objects
- remove:
" This removes from all indexes for this class" indexMgr remove: myExampleObject
- remove:
