org.apache.xindice.core.filer
Class HashFiler
java.lang.Object
|
+--org.apache.xindice.core.filer.Paged
|
+--org.apache.xindice.core.filer.HashFiler
- All Implemented Interfaces:
- Configurable, DBObject, Filer, Named
- public class HashFiler
- extends Paged
- implements Filer
HashFiler is a Filer implementation based on the Paged class. By
extending Paged, HashFiler inherits the ability to maintain Record
metadata such as creation and modification time. It also provides
quite a bit more flexibility in its ability to retreive blocks of
data and allocate Record space.
HashFile has folowing configuration attributes:
- pagesize: Size of the page used by the paged file.
Default page size is 4096 bytes. This parameter can be set only
before paged file is created. Once it is created, this parameter
can not be changed.
- pagecount: This parameter has a special meaning
for HashFiler. This determines the size of the hash table main
storage, which is equal to the number of pages filer will be
created with. The default is 1024. Please note that if made
too small, it will affect efficiency of the hash table.
- maxkeysize: Maximum allowed size of the key.
Default maximum key size is 256 bytes.
- max-descriptors: Defines maximum amount of
simultaneously opened file descriptors this paged file can have.
Several descriptors are needed to provide multithreaded access
to the underlying file. Too large number will limit amount of
collections you can open. Default value is 16
(DEFAULT_DESCRIPTORS_MAX).
- Version:
- $Revision: 530607 $, $Date: 2007-04-19 21:26:25 -0400 (Thu, 19 Apr 2007) $
Field Summary |
protected static byte |
RECORD
Record page status |
Method Summary |
Paged.FileHeader |
createFileHeader()
createFileHeader must be implemented by a Paged implementation
in order to create an appropriate subclass instance of a FileHeader. |
Paged.PageHeader |
createPageHeader()
createPageHeader must be implemented by a Paged implementation
in order to create an appropriate subclass instance of a PageHeader. |
boolean |
deleteRecord(Key key)
deleteRecord removes a Record from the Filer based on the
specified Key. |
String |
getName()
getName retrieves the contextually important name of the object |
long |
getRecordCount()
getRecordCount returns the number of Records in the Filer. |
RecordSet |
getRecordSet()
getRecordSet returns a RecordSet object for the current Filer. |
Record |
readRecord(Key key)
readRecord returns a Record from the Filer based on the specified
Key. |
void |
setConfig(Configuration config)
setConfig sets the configuration information for the Configurable
object instance. |
void |
setLocation(File root,
String location)
setLocation tells the Filer where to store its data. |
protected void |
unlinkPages(Paged.Page page)
Mark pages in primary store as 'DELETED', and let Paged handle all
overflow pages. |
boolean |
writeRecord(Key key,
Value value)
writeRecord writes a Value to the Filer based on the specified Key. |
Methods inherited from class org.apache.xindice.core.filer.Paged |
checkOpened, close, closeDescriptor, create, deleteArrayInt, deleteArrayLong, deleteArrayShort, deleteArrayValue, drop, exists, flush, getConfig, getDescriptor, getFile, getFileHeader, getFreePage, getPage, insertArrayInt, insertArrayLong, insertArrayShort, insertArrayValue, isOpened, open, putDescriptor, readValue, readValue, setFile, unlinkPages, writeValue, writeValue |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.xindice.core.filer.Filer |
flush |
RECORD
protected static final byte RECORD
- Record page status
HashFiler
public HashFiler()
setLocation
public void setLocation(File root,
String location)
- Description copied from interface:
Filer
- setLocation tells the Filer where to store its data.
- Specified by:
setLocation
in interface Filer
- Following copied from interface:
org.apache.xindice.core.filer.Filer
- Parameters:
root
- The root under which to store datalocation
- The name to use for storing data
getName
public String getName()
- Description copied from interface:
Named
- getName retrieves the contextually important name of the object
- Specified by:
getName
in interface Named
- Following copied from interface:
org.apache.xindice.util.Named
- Returns:
- The object's name
setConfig
public void setConfig(Configuration config)
- Description copied from interface:
Configurable
- setConfig sets the configuration information for the Configurable
object instance.
- Specified by:
setConfig
in interface Configurable
- Overrides:
setConfig
in class Paged
- Following copied from interface:
org.apache.xindice.util.Configurable
- Parameters:
config
- The configuration Node
readRecord
public Record readRecord(Key key)
throws DBException
- Description copied from interface:
Filer
- readRecord returns a Record from the Filer based on the specified
Key.
- Specified by:
readRecord
in interface Filer
- Following copied from interface:
org.apache.xindice.core.filer.Filer
- Parameters:
key
- The Record's Key- Returns:
- The returned Record
writeRecord
public boolean writeRecord(Key key,
Value value)
throws DBException
- Description copied from interface:
Filer
- writeRecord writes a Value to the Filer based on the specified Key.
- Specified by:
writeRecord
in interface Filer
- Following copied from interface:
org.apache.xindice.core.filer.Filer
- Parameters:
key
- The Record's Keyvalue
- The Record's Value- Returns:
- Whether or not the Record could be written
unlinkPages
protected void unlinkPages(Paged.Page page)
throws IOException
- Mark pages in primary store as 'DELETED', and let Paged handle all
overflow pages.
- Overrides:
unlinkPages
in class Paged
- Following copied from class:
org.apache.xindice.core.filer.Paged
- Parameters:
page
- The starting Page to unlink- Throws:
IOException
- if an Exception occurs
deleteRecord
public boolean deleteRecord(Key key)
throws DBException
- Description copied from interface:
Filer
- deleteRecord removes a Record from the Filer based on the
specified Key.
- Specified by:
deleteRecord
in interface Filer
- Following copied from interface:
org.apache.xindice.core.filer.Filer
- Parameters:
key
- The Record's Key- Returns:
- Whether or not the Record was deleted
getRecordCount
public long getRecordCount()
throws DBException
- Description copied from interface:
Filer
- getRecordCount returns the number of Records in the Filer.
- Specified by:
getRecordCount
in interface Filer
- Following copied from interface:
org.apache.xindice.core.filer.Filer
- Returns:
- The Record count
getRecordSet
public RecordSet getRecordSet()
throws DBException
- Description copied from interface:
Filer
- getRecordSet returns a RecordSet object for the current Filer.
- Specified by:
getRecordSet
in interface Filer
- Following copied from interface:
org.apache.xindice.core.filer.Filer
- Returns:
- The Filer Enumerator
createFileHeader
public Paged.FileHeader createFileHeader()
- Description copied from class:
Paged
- createFileHeader must be implemented by a Paged implementation
in order to create an appropriate subclass instance of a FileHeader.
- Overrides:
createFileHeader
in class Paged
- Following copied from class:
org.apache.xindice.core.filer.Paged
- Returns:
- a new FileHeader
createPageHeader
public Paged.PageHeader createPageHeader()
- Description copied from class:
Paged
- createPageHeader must be implemented by a Paged implementation
in order to create an appropriate subclass instance of a PageHeader.
- Overrides:
createPageHeader
in class Paged
- Following copied from class:
org.apache.xindice.core.filer.Paged
- Returns:
- a new PageHeader
Copyright (c) 1999-2007 The Apache Software Foundation. All Rights Reserved.