public class BlueCollectionOnDiskBuilder<K extends BlueKey,T extends java.io.Serializable> extends java.lang.Object implements BlueCollectionBuilder<K,T>
Modifier | Constructor and Description |
---|---|
protected |
BlueCollectionOnDiskBuilder(BlueDbOnDisk db,
java.lang.String name,
java.lang.Class<K> keyType,
java.lang.Class<T> valueType) |
Modifier and Type | Method and Description |
---|---|
BlueCollectionOnDisk<T> |
build() |
BlueCollectionOnDiskBuilder<K,T> |
withOptimizedClasses(java.util.Collection<java.lang.Class<? extends java.io.Serializable>> classesToRegister)
Registers classesToRegister with the serializer to make serialization and deserialization faster and more compact, then returns itself.
|
BlueCollectionOnDiskBuilder<K,T> |
withSegmentSize(SegmentSize<K> segmentSize)
Requests a specific segment size to use for the collection.
|
protected BlueCollectionOnDiskBuilder(BlueDbOnDisk db, java.lang.String name, java.lang.Class<K> keyType, java.lang.Class<T> valueType)
public BlueCollectionOnDiskBuilder<K,T> withOptimizedClasses(java.util.Collection<java.lang.Class<? extends java.io.Serializable>> classesToRegister)
BlueCollectionBuilder
withOptimizedClasses
in interface BlueCollectionBuilder<K extends BlueKey,T extends java.io.Serializable>
classesToRegister
- classes that will be stored as values, in values, or in keys inside this collection.public BlueCollectionOnDiskBuilder<K,T> withSegmentSize(SegmentSize<K> segmentSize) throws BlueDbException
BlueCollectionBuilder
withSegmentSize
in interface BlueCollectionBuilder<K extends BlueKey,T extends java.io.Serializable>
segmentSize
- the requested segment size for the collection. Values of the collection are grouped into segments and
values in a segment can be vacuumed into a single file. Therefore, segment size will affect how fast you can access
a specific value in a segment and how many i-nodes (files and directories) the collection will use on disk. This will be
ignored if the collection already exists. In the future BlueDB might support migrating from one segment size to another.BlueDbException
- if the requested segment size is invalidpublic BlueCollectionOnDisk<T> build() throws BlueDbException
build
in interface BlueCollectionBuilder<K extends BlueKey,T extends java.io.Serializable>
BlueCollection
or else builds a new one if none existsBlueDbException
- if any problems are encountered, such as the collection already existing with a different type