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
      
  • 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 
      
  • 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'
      
  • adding objects
    • add:
      "This will add for all defined indexes"
      indexMgr add: (MyExampleClass new myExampleMethod: 'foo')
      
  • removing objects
    • remove:
      " This removes from all indexes for this class"
      indexMgr remove: myExampleObject