com.sun.labs.minion.indexer.partition
Class Partition

java.lang.Object
  extended by com.sun.labs.minion.indexer.partition.Partition
All Implemented Interfaces:
com.sun.labs.util.props.Component, com.sun.labs.util.props.Configurable, java.lang.Comparable<Partition>
Direct Known Subclasses:
DiskPartition, MemoryPartition

public abstract class Partition
extends java.lang.Object
implements java.lang.Comparable<Partition>, com.sun.labs.util.props.Configurable

A superclass for Partitions. This is mostly used to provide a bit of information that we want subclasses to have in common.


Field Summary
protected static int DICT_OFFSETS_SIZE
          The size, in bytes of the offsets that will be written for the dictionaries in the partition.
protected  DictionaryFactory docDictFactory
           
protected  java.lang.Class entryClass
          The class for the postings entries that we'll be building.
protected  java.lang.String entryName
          The name of the entries.
protected  IndexConfig indexConfig
          The configuration for this index.
protected static java.lang.String logTag
          The log tag.
protected  DictionaryFactory mainDictFactory
           
protected  java.io.RandomAccessFile mainDictFile
          The file for the main dictionaries.
protected  java.io.RandomAccessFile[] mainPostFiles
          The streams for the postings.
protected  PartitionManager manager
          The manager for this partition.
protected  int maxID
          The maximum ID that was allocated in the partition.
protected  int nEntries
          The number of actual entries in the partition.
protected  int partNumber
          The number of this partition.
static java.lang.String PROP_DOC_DICT_FACTORY
           
static java.lang.String PROP_INDEX_CONFIG
           
static java.lang.String PROP_MAIN_DICT_FACTORY
           
static java.lang.String PROP_PARTITION_MANAGER
           
protected  PartitionStats stats
          The statistics for this partition.
 
Constructor Summary
Partition()
           
 
Method Summary
 int compareTo(Partition p)
          Compares two partitions by their partition numbers.
protected  java.io.File[] getAllFiles()
          Gets all the files associated with a partition.
protected static java.io.File[] getAllFiles(PartitionManager manager, int partNumber)
          Gets all the files associated with a partition.
protected  java.io.File[] getDocFiles()
          Gets the files associated with the document keys for a partition.
protected static java.io.File[] getDocFiles(PartitionManager manager, int partNumber)
          Gets the files associated with the document keys for a partition.
 IndexConfig getIndexConfig()
          Gets a set of statistics for the collection holding this partition.
protected  java.io.File[] getMainFiles()
          Gets the files associated with the main postings for a partition.
protected static java.io.File[] getMainFiles(PartitionManager manager, int partNumber)
          Gets the files associated with the main postings for a partition.
 PartitionManager getManager()
          Get the manager for this partition.
 java.lang.String getName()
           
abstract  int getNDocs()
          Gets the number of documents in this partition.
 int getNumPostingsChannels()
          Gets the number of channels that we'll need to store postings for our main dictionary.
 int getPartitionNumber()
          Get the number for this file.
 QueryConfig getQueryConfig()
          Gets a set of statistics for the collection holding this partition.
 PartitionStats getStats()
          Gets the statistics for this partition.
 void newProperties(com.sun.labs.util.props.PropertySheet ps)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

manager

protected PartitionManager manager
The manager for this partition.


stats

protected PartitionStats stats
The statistics for this partition.


entryName

protected java.lang.String entryName
The name of the entries.


entryClass

protected java.lang.Class entryClass
The class for the postings entries that we'll be building.


partNumber

protected int partNumber
The number of this partition.


maxID

protected int maxID
The maximum ID that was allocated in the partition.


nEntries

protected int nEntries
The number of actual entries in the partition.


mainDictFile

protected java.io.RandomAccessFile mainDictFile
The file for the main dictionaries.


mainPostFiles

protected java.io.RandomAccessFile[] mainPostFiles
The streams for the postings.


DICT_OFFSETS_SIZE

protected static final int DICT_OFFSETS_SIZE
The size, in bytes of the offsets that will be written for the dictionaries in the partition.

See Also:
Constant Field Values

logTag

protected static java.lang.String logTag
The log tag.


PROP_DOC_DICT_FACTORY

@ConfigComponent(type=DictionaryFactory.class)
public static final java.lang.String PROP_DOC_DICT_FACTORY
See Also:
Constant Field Values

PROP_INDEX_CONFIG

@ConfigComponent(type=IndexConfig.class)
public static final java.lang.String PROP_INDEX_CONFIG
See Also:
Constant Field Values

PROP_MAIN_DICT_FACTORY

@ConfigComponent(type=DictionaryFactory.class)
public static final java.lang.String PROP_MAIN_DICT_FACTORY
See Also:
Constant Field Values

PROP_PARTITION_MANAGER

@ConfigComponent(type=PartitionManager.class)
public static final java.lang.String PROP_PARTITION_MANAGER
See Also:
Constant Field Values

docDictFactory

protected DictionaryFactory docDictFactory

mainDictFactory

protected DictionaryFactory mainDictFactory

indexConfig

protected IndexConfig indexConfig
The configuration for this index.

Constructor Detail

Partition

public Partition()
Method Detail

getPartitionNumber

public int getPartitionNumber()
Get the number for this file.


getStats

public PartitionStats getStats()
Gets the statistics for this partition.


getIndexConfig

public IndexConfig getIndexConfig()
Gets a set of statistics for the collection holding this partition.


getQueryConfig

public QueryConfig getQueryConfig()
Gets a set of statistics for the collection holding this partition.


getNDocs

public abstract int getNDocs()
Gets the number of documents in this partition.


getManager

public PartitionManager getManager()
Get the manager for this partition.


getNumPostingsChannels

public int getNumPostingsChannels()
Gets the number of channels that we'll need to store postings for our main dictionary.


getMainFiles

protected java.io.File[] getMainFiles()
Gets the files associated with the main postings for a partition.

Returns:
an array of files. The first is for the dictionary, and the remaining are for the postings files.

getMainFiles

protected static java.io.File[] getMainFiles(PartitionManager manager,
                                             int partNumber)
Gets the files associated with the main postings for a partition.

Parameters:
partNumber - the partition number for which we want the files.
Returns:
an array of files. The first is for the dictionary, and the remaining are for the postings files.

getDocFiles

protected java.io.File[] getDocFiles()
Gets the files associated with the document keys for a partition.

Returns:
an array of files. The first is for the dictionary, and the remaining are for the postings files.

getDocFiles

protected static java.io.File[] getDocFiles(PartitionManager manager,
                                            int partNumber)
Gets the files associated with the document keys for a partition.

Parameters:
partNumber - the partition number for which we want the files.
Returns:
an array of files. The first is for the dictionary, and the remaining are for the postings files.

getAllFiles

protected java.io.File[] getAllFiles()
Gets all the files associated with a partition.


getAllFiles

protected static java.io.File[] getAllFiles(PartitionManager manager,
                                            int partNumber)
Gets all the files associated with a partition.


compareTo

public int compareTo(Partition p)
Compares two partitions by their partition numbers.

Specified by:
compareTo in interface java.lang.Comparable<Partition>

getName

public java.lang.String getName()

newProperties

public void newProperties(com.sun.labs.util.props.PropertySheet ps)
                   throws com.sun.labs.util.props.PropertyException
Specified by:
newProperties in interface com.sun.labs.util.props.Configurable
Throws:
com.sun.labs.util.props.PropertyException