org.exist.indexing
Interface Index

All Known Implementing Classes:
AbstractIndex, FTIndex

public interface Index

Represents an arbitrary index structure that can be used by eXist. This is the main interface to be registered with the database instance. It provides methods to configure, open and close the index. These methods will be called by the main database instance during startup/shutdown. They don't need to be synchronized.


Method Summary
 boolean checkIndex(DBBroker broker)
          Convenience method that allows to check index consistency.
 void close()
          Closes the index and all associated resources.
 void configure(BrokerPool pool, String dataDir, Element config)
          Configure the index and all resources associated with it.
 BrokerPool getBrokerPool()
          Returns the BrokerPool on with this Index operates.
 String getIndexId()
          Returns an id which uniquely identifies this index.
 String getIndexName()
          Returns a human-readable name which uniquely identifies this index.
 IndexWorker getWorker(DBBroker broker)
          Returns a new IndexWorker, which is used to access the index in a multi-threaded environment.
 void open()
          Opens the index for writing and reading.
 void remove()
          Closes the index and removes it completely, including all resources and files associated to it.
 void sync()
          Sync the index.
 

Method Detail

getIndexId

String getIndexId()
Returns an id which uniquely identifies this index. This is usually the class name.

Returns:
a unique name identifying this index.

getIndexName

String getIndexName()
Returns a human-readable name which uniquely identifies this index. This is configured by the user

Returns:
a unique name identifying this index.

getBrokerPool

BrokerPool getBrokerPool()
Returns the BrokerPool on with this Index operates.

Returns:
the broker pool

configure

void configure(BrokerPool pool,
               String dataDir,
               Element config)
               throws DatabaseConfigurationException
Configure the index and all resources associated with it. This method is called while the database instance is initializing and receives the
<module id="foo" class="bar"/>
section of the configuration file.

Parameters:
pool - the BrokerPool representing the current database instance.
dataDir - the main data directory where eXist stores its files (if relevant).
config - the module element which configures this index, as found in conf.xml
Throws:
DatabaseConfigurationException

open

void open()
          throws DatabaseConfigurationException
Opens the index for writing and reading. Will be called during initialization, but also if the database has to be restarted.

Throws:
DatabaseConfigurationException

close

void close()
           throws DBException
Closes the index and all associated resources.

Throws:
DBException

sync

void sync()
          throws DBException
Sync the index. This method should make sure that all index contents are written to disk. It will be called during checkpoint events and the system relies on the index to materialize all data.

Throws:
DBException

remove

void remove()
            throws DBException
Closes the index and removes it completely, including all resources and files associated to it. This method is called during database repair before the db contents are reindexed.

Throws:
DBException

getWorker

IndexWorker getWorker(DBBroker broker)
Returns a new IndexWorker, which is used to access the index in a multi-threaded environment. Every database instance has a number of DBBroker objects. All operations on the db have to go through one of these brokers. Each DBBroker retrieves an IndexWorker for every index by calling this method.

Parameters:
broker - The DBBroker that owns this worker
Returns:
a new IndexWorker that can be used for concurrent access to the index.

checkIndex

boolean checkIndex(DBBroker broker)
Convenience method that allows to check index consistency.

Parameters:
broker - the broker that will perform the operation.
Returns:
whether or not the index is in a consistent state. The definition of "consistency" is left to the user.


Copyright (C) Wolfgang Meier. All rights reserved.