org.helidb.backend.heapcrs
Class ConstantRecordSizeHeapBackendBuilder<K,V>

java.lang.Object
  extended by org.helidb.backend.heapcrs.ConstantRecordSizeHeapBackendBuilder<K,V>
Type Parameters:
K - The type of keys in the backend.
V - The type of values in the backend.

public class ConstantRecordSizeHeapBackendBuilder<K,V>
extends Object

This is a builder for ConstantRecordSizeHeapBackend objects. A builder object may be reused to create several backends with similar configurations.

Since:
1.0
Author:
Karl Gustafsson
See Also:
ConstantRecordSizeHeapBackend
In_jar:
helidb-core

Constructor Summary
ConstantRecordSizeHeapBackendBuilder()
           
 
Method Summary
 ConstantRecordSizeHeapBackend<K,V> create(RandomlyAccessibleFile f)
          Create a new backend object.
 ConstantRecordSizeHeapBackendBuilder<K,V> setBufferSize(int size)
          Set the size of temporary in-memory buffers used by the backend.
 ConstantRecordSizeHeapBackendBuilder<K,V> setKeySerializer(Serializer<K> serializer)
          Set the key serializer.
 ConstantRecordSizeHeapBackendBuilder<K,V> setLogAdapterHolder(LogAdapterHolder lah)
          Set the log adapter holder.
 ConstantRecordSizeHeapBackendBuilder<K,V> setReadOnly(boolean b)
          Should the created backend be read only? The default value is false.
 ConstantRecordSizeHeapBackendBuilder<K,V> setStartPosOfDb(long pos)
          Set the start position of database data in the database file.
 ConstantRecordSizeHeapBackendBuilder<K,V> setValueSerializer(Serializer<V> serializer)
          Set the value serializer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstantRecordSizeHeapBackendBuilder

public ConstantRecordSizeHeapBackendBuilder()
Method Detail

setReadOnly

public ConstantRecordSizeHeapBackendBuilder<K,V> setReadOnly(boolean b)
Should the created backend be read only? The default value is false.

Parameters:
b - Should the created backend be read only?
Returns:
this

setKeySerializer

public ConstantRecordSizeHeapBackendBuilder<K,V> setKeySerializer(Serializer<K> serializer)
Set the key serializer. This property must be set.

Parameters:
serializer - The key serializer.
Returns:
this

setValueSerializer

public ConstantRecordSizeHeapBackendBuilder<K,V> setValueSerializer(Serializer<V> serializer)
Set the value serializer. This property must be set.

Parameters:
serializer - The value serializer.
Returns:
this

setStartPosOfDb

public ConstantRecordSizeHeapBackendBuilder<K,V> setStartPosOfDb(long pos)
                                                          throws IllegalArgumentException
Set the start position of database data in the database file. The default value of this property is 0.

Parameters:
pos - The start position of database data in the database file.
Returns:
this
Throws:
IllegalArgumentException - If pos < 0.

setBufferSize

public ConstantRecordSizeHeapBackendBuilder<K,V> setBufferSize(int size)
                                                        throws IllegalArgumentException
Set the size of temporary in-memory buffers used by the backend. The default value of this property is 8192 bytes.

Parameters:
size - The size of temporary in-memory buffers, in bytes.
Returns:
this
Throws:
IllegalArgumentException - If size < 1

setLogAdapterHolder

public ConstantRecordSizeHeapBackendBuilder<K,V> setLogAdapterHolder(LogAdapterHolder lah)
Set the log adapter holder. The default value of this property is a log adapter holding holding a StdOutLogAdapter.

Parameters:
lah - The log adapter holder.
Returns:
this

create

public ConstantRecordSizeHeapBackend<K,V> create(RandomlyAccessibleFile f)
Create a new backend object.

Parameters:
f - The database file.
Returns:
A new backend object.