|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmessif.buckets.Bucket
public abstract class Bucket
A data area that hold a collection of AbstractObjects. A bucket can represent a metric space partition or it is used just as a generic object storage. The bucket provides methods for inserting one or more objects, deleting them, retrieving all objects or just a particular one (providing its ID). It also has a method for evaluating queries, which pushes all objects from the bucket to the sequential scan implementation of the respective query (if not overriden). Every bucket is also automatically assigned a unique ID used for addressing the bucket.
LocalBucket
,
messif.netbucket.RemoteBucket
Constructor Summary | |
---|---|
Bucket()
|
Method Summary | |
---|---|
abstract void |
addObject(LocalAbstractObject object)
Insert a new object into this bucket. |
BucketErrorCode |
addObjectErrCode(LocalAbstractObject object)
Insert a new object into this bucket and returns error code instead of exception. |
int |
addObjects(java.util.Collection<? extends LocalAbstractObject> objects)
Insert several new objects into this bucket. |
int |
addObjects(java.util.Iterator<? extends LocalAbstractObject> objects)
Insert several new objects to this bucket. |
abstract int |
deleteAllObjects()
Delete all objects from this bucket. |
int |
deleteObject(LocalAbstractObject object)
Delete all objects from this bucket that are data-equals to
the specified object. |
abstract int |
deleteObject(LocalAbstractObject object,
int deleteLimit)
Delete all objects from this bucket that are data-equals to
the specified object. |
abstract LocalAbstractObject |
deleteObject(UniqueID objectID)
Delete object with the specified ID from this bucket. |
AbstractObjectList<LocalAbstractObject> |
deleteObjects(java.util.Collection<? extends UniqueID> objectIDs,
boolean removeDeletedIDs)
Delete multiple objects with specified IDs. |
abstract AbstractObjectIterator<LocalAbstractObject> |
getAllObjects()
Returns iterator over all objects from this bucket. |
abstract int |
getBucketID()
Returns the unique ID of this bucket. |
abstract LocalAbstractObject |
getObject(AbstractObjectKey key)
Retrieve an object with the specified key from this bucket. |
abstract LocalAbstractObject |
getObject(java.lang.String locator)
Retrieve an object with the specified locator from this bucket. |
abstract LocalAbstractObject |
getObject(UniqueID objectID)
Retrieves an object with the specified ID from this bucket. |
int |
processQuery(QueryOperation<?> query)
Process a query operation on objects from this bucket. |
AbstractObjectIterator<LocalAbstractObject> |
provideObjects()
The iterator for provided objects for ObjectProvider interface. |
int |
split(SplitPolicy policy,
java.util.List<Bucket> targetBuckets,
BucketDispatcher bucketCreator,
int whoStays)
Splits this bucket according to the specified policy. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Bucket()
Method Detail |
---|
public abstract int getBucketID()
public abstract void addObject(LocalAbstractObject object) throws BucketStorageException
object
- a new object to be inserted
BucketStorageException
- if the object cannot be inserted into the bucketpublic BucketErrorCode addObjectErrCode(LocalAbstractObject object)
object
- the new object to be inserted
public int addObjects(java.util.Collection<? extends LocalAbstractObject> objects) throws BucketStorageException
objects
- the collection of new objects
BucketStorageException
- if there was an object that cannot be inserted into the bucketpublic int addObjects(java.util.Iterator<? extends LocalAbstractObject> objects) throws BucketStorageException
objects
- iterator that provides the new objects to insert
BucketStorageException
- if there was an object that cannot be inserted into the bucketpublic abstract LocalAbstractObject deleteObject(UniqueID objectID) throws java.util.NoSuchElementException, BucketStorageException
objectID
- the ID of the object to delete
java.util.NoSuchElementException
- if there is no object with the specified ID in this bucket
BucketStorageException
- if the object cannot be deleted from the bucketpublic abstract int deleteObject(LocalAbstractObject object, int deleteLimit) throws BucketStorageException
data-equals
to
the specified object. If deleteLimit
is greater than zero, only the first deleteLimit
data-equal objects found are deleted.
object
- the object to match againstdeleteLimit
- the maximal number of deleted objects (zero means unlimited)
BucketStorageException
- if there was an object that cannot be deleted from the bucketpublic int deleteObject(LocalAbstractObject object) throws BucketStorageException
data-equals
to
the specified object.
object
- the object to match against
BucketStorageException
- if the object cannot be deleted from the bucketpublic AbstractObjectList<LocalAbstractObject> deleteObjects(java.util.Collection<? extends UniqueID> objectIDs, boolean removeDeletedIDs) throws BucketStorageException
objectIDs
- List of object IDs to be deletedremoveDeletedIDs
-
BucketStorageException
- if the object cannot be deleted from the bucketpublic abstract int deleteAllObjects() throws BucketStorageException
BucketStorageException
- if there was an object that cannot be deleted from the bucketpublic int split(SplitPolicy policy, java.util.List<Bucket> targetBuckets, BucketDispatcher bucketCreator, int whoStays) throws java.lang.IllegalArgumentException, BucketStorageException
targetBuckets
parameters.
The position is the value returned by the policy's matcher method.
The parameter whoStays
denotes the partition that corresponds to this
bucket, i.e.,
the objects marked with this number (whoStays
) by the policy's matcher are left in this bucket
and not moved to any new bucket. As a result, the whoStays
index in targetBuckets
is null
(if this index existed in targetBuckets
, it is left untouched).
The list targetBuckets
is extended to contain all getPartitionsCount()
items.
The items correponding to indexes that have not been returned by matcher for any object are initialized to null
(or left
untouched if the index have already existed).
If targetBuckets
is not initialized with references to buckets, the bucketCreator
must be able to create additional buckets.
Remark: to partition all objects to new buckets pass an empty instance of list in targetBuckets
and set whoStays
to
a negative value since the matcher returns non-negative values only.
policy
- the split policy used to split this buckettargetBuckets
- the list of target buckets to split the objects tobucketCreator
- the bucket dispatcher to use when creating target buckets; can be null if the targetBuckets
has enough bucketswhoStays
- identification of a partition whose objects stay in this bucket.
java.lang.IllegalArgumentException
- if there are too few target buckets
BucketStorageException
- if there was a storage error during objects
between buckets (including capacity overflow or underflow) during object move;
warning: the split is interrupted and should be reinitializedpublic abstract LocalAbstractObject getObject(UniqueID objectID) throws java.util.NoSuchElementException
objectID
- the ID of the object to retrieve
java.util.NoSuchElementException
- if there is no object with the specified ID in this bucketpublic abstract LocalAbstractObject getObject(java.lang.String locator) throws java.util.NoSuchElementException
locator
- the locator URI of the object to retrieve
java.util.NoSuchElementException
- This exception is thrown if there is no object with the specified locator in this bucketpublic abstract LocalAbstractObject getObject(AbstractObjectKey key) throws java.util.NoSuchElementException
key
- the key of the object to retrieve
java.util.NoSuchElementException
- This exception is thrown if there is no object with the specified key in this bucketpublic abstract AbstractObjectIterator<LocalAbstractObject> getAllObjects()
public int processQuery(QueryOperation<?> query)
query
- query operation that is to be processed on this bucket
public AbstractObjectIterator<LocalAbstractObject> provideObjects()
provideObjects
in interface ObjectProvider<LocalAbstractObject>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |