public class MemoryStorageNoDupsBucket extends OrderedLocalBucket<LocalAbstractObject> implements java.io.Serializable
LocalBucket
.
It stores all objects in a memory storage
.
Objects are indexed by their data
and
does not allow to store two objects with the same data. If an object that is
dataEquals
to
any object actually stored in the bucket, the addObject method will
throw DuplicateObjectException
.
This bucket has an efficient LocalBucket.deleteObject(messif.objects.LocalAbstractObject, int)
implementation
at the cost of additional memory overhead for maintaining the index.
If fast deleteObject
implementation is not required and
the iteration over all objects is used frequently, consider using
MemoryStorageBucket
.
BucketDispatcher
,
LocalBucket
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected ModifiableOrderedIndex<LocalAbstractObject,LocalAbstractObject> |
objects
Object storage with object-id index
|
counterBucketAddObject, counterBucketDelObject, counterBucketRead
Constructor and Description |
---|
MemoryStorageNoDupsBucket(long capacity,
long softCapacity,
long lowOccupation,
boolean occupationAsBytes)
Constructs a new instance of MemoryStorageNoDupsBucket.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroy this bucket.
|
void |
finalize()
Finalize this bucket.
|
protected ModifiableOrderedIndex<LocalAbstractObject,LocalAbstractObject> |
getModifiableIndex()
Returns the index (including storage) for this bucket.
|
getIndex
addObject, addObject, addObjectErrCode, deleteAllObjects, deleteObject, deleteObject, deleteObject, deleteObjects, deregisterFilter, getAllObjects, getBucketID, getCapacity, getFilter, getLowOccupation, getObject, getObject, getObjectCount, getOccupation, getOccupationRatio, getSoftCapacity, isBucketStandalone, isSoftCapacityExceeded, registerFilter, setLowOccupation, setSoftCapacity, toString
addObjects, addObjects, deleteObject, deleteObject, processQuery, provideObjects, split
protected ModifiableOrderedIndex<LocalAbstractObject,LocalAbstractObject> objects
public MemoryStorageNoDupsBucket(long capacity, long softCapacity, long lowOccupation, boolean occupationAsBytes)
capacity
- maximal capacity of the bucket - cannot be exceededsoftCapacity
- maximal soft capacity of the bucketlowOccupation
- a minimal occupation for deleting objects - cannot be loweredoccupationAsBytes
- flag whether the occupation (and thus all the limits) are in bytes or number of objectsprotected ModifiableOrderedIndex<LocalAbstractObject,LocalAbstractObject> getModifiableIndex()
LocalBucket
getModifiableIndex
in class OrderedLocalBucket<LocalAbstractObject>
public void finalize() throws java.lang.Throwable
LocalBucket
BucketDispatcher
when it is finalized.finalize
in class LocalBucket
java.lang.Throwable
- if there was an error while cleaningpublic void destroy() throws java.lang.Throwable
LocalBucket
BucketDispatcher
when the bucket is removed
from the dispatcher.destroy
in class LocalBucket
java.lang.Throwable
- if there was an error while cleaning