public class RemoteBucket extends Bucket implements java.io.Serializable
NetworkBucketDispatcher
running on both sides that handles
the communication.
This class cannot be created directly, instead, it is obtained by a call to
createRemoteBucket
method of
NetworkBucketDispatcher
.LocalBucket
,
NetworkBucketDispatcher
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected int |
bucketID
ID of the bucket on the remote node
|
protected long |
capacity
The maximal (hard) capacity of the remote bucket
|
protected NetworkBucketDispatcher |
netbucketDisp
Network storage (bucket) dispatcher to which this remote bucket is associated
|
Modifier | Constructor and Description |
---|---|
protected |
RemoteBucket(NetworkBucketDispatcher netbucketDisp,
int bucketID,
NetworkNode remoteNetworkNode,
long capacity)
Creates a new instance of RemoteBucket from parameters.
|
protected |
RemoteBucket(NetworkBucketDispatcher netbucketDisp,
LocalBucket bucket)
Creates a new instance of RemoteBucket from LocalBucket.
|
Modifier and Type | Method and Description |
---|---|
void |
addObject(LocalAbstractObject object)
Insert a new object into this bucket.
|
int |
addObjects(java.util.Iterator<? extends LocalAbstractObject> objects)
Insert several new objects to this bucket.
|
int |
deleteAllObjects()
Delete all objects from this bucket.
|
int |
deleteObject(LocalAbstractObject object,
int deleteLimit)
Delete all objects from this bucket that are
data-equals to
the specified object. |
int |
deleteObject(java.lang.String locatorURI,
int deleteLimit)
Delete all objects from this bucket that have the specified
locatorURI . |
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.
|
AbstractObjectIterator<LocalAbstractObject> |
getAllObjects()
Returns iterator over all objects from the remote bucket.
|
int |
getBucketID()
Returns the ID of the bucket on remote node.
|
long |
getCapacity()
Returns the maximal capacity of the remote bucket.
|
LocalAbstractObject |
getObject(AbstractObjectKey key)
Retrieve an object with the specified key from this bucket.
|
LocalAbstractObject |
getObject(java.lang.String locator)
Retrieve an object with the specified locator from this bucket.
|
NetworkNode |
getRemoteNetworkNode()
Returns the remote node on which the bucket resides.
|
int |
hashCode()
Returns a hash code value for this bucket.
|
boolean |
isLocalBucket()
Returns whether this bucket is local or remote
|
int |
processQuery(QueryOperation<?> query)
Process a query operation on objects from the remote bucket.
|
void |
setRemoteNetworkNode(NetworkNode remoteNetworkNode)
Sets the remote node on which the bucket resides.
|
java.lang.String |
toString()
Returns a string representation of this bucket.
|
addObjectErrCode, addObjects, deleteObject, deleteObject, provideObjects, split
protected final int bucketID
protected final NetworkBucketDispatcher netbucketDisp
protected final long capacity
protected RemoteBucket(NetworkBucketDispatcher netbucketDisp, LocalBucket bucket)
netbucketDisp
- Network storage (bucket) dispatcher to which this remote bucket is associatedbucket
- The local bucket from which this remote bucket is createdprotected RemoteBucket(NetworkBucketDispatcher netbucketDisp, int bucketID, NetworkNode remoteNetworkNode, long capacity)
netbucketDisp
- the network storage (bucket) dispatcher with which this remote bucket is associatedbucketID
- the ID of the bucket on remote noderemoteNetworkNode
- the remote node on which the bucket residescapacity
- the hard capacity of the bucket on remote nodepublic int getBucketID()
getBucketID
in class Bucket
public NetworkNode getRemoteNetworkNode()
public void setRemoteNetworkNode(NetworkNode remoteNetworkNode)
remoteNetworkNode
- the remote node on which the bucket residespublic long getCapacity()
public boolean isLocalBucket()
public LocalAbstractObject getObject(java.lang.String locator) throws java.lang.IllegalStateException
public LocalAbstractObject getObject(AbstractObjectKey key) throws java.lang.IllegalStateException
public AbstractObjectIterator<LocalAbstractObject> getAllObjects() throws java.lang.IllegalStateException
getAllObjects
in class Bucket
java.lang.IllegalStateException
- if there was an error communicating with the remote bucket dispatcherpublic void addObject(LocalAbstractObject object) throws BucketStorageException, java.lang.IllegalStateException
Bucket
addObject
in class Bucket
object
- a new object to be insertedBucketStorageException
- if the object cannot be inserted into the bucketjava.lang.IllegalStateException
public int addObjects(java.util.Iterator<? extends LocalAbstractObject> objects) throws BucketStorageException, java.lang.IllegalStateException
Bucket
addObjects
in class Bucket
objects
- iterator that provides the new objects to insertBucketStorageException
- if there was an object that cannot be inserted into the bucketjava.lang.IllegalStateException
public int deleteObject(LocalAbstractObject object, int deleteLimit) throws BucketStorageException, java.lang.IllegalStateException
Bucket
data-equals
to
the specified object. If deleteLimit
is greater than zero, only the first deleteLimit
data-equal objects found are deleted.deleteObject
in class Bucket
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 bucketjava.lang.IllegalStateException
public int deleteObject(java.lang.String locatorURI, int deleteLimit) throws BucketStorageException
Bucket
locatorURI
.
If deleteLimit
is greater than zero, only the first deleteLimit
objects with the given locator are deleted.deleteObject
in class Bucket
locatorURI
- the object locator to matchdeleteLimit
- the maximal number of deleted objects (zero means unlimited)BucketStorageException
- if there was an object that cannot be deleted from the bucketpublic int deleteAllObjects() throws BucketStorageException
Bucket
deleteAllObjects
in class Bucket
BucketStorageException
- if there was an object that cannot be deleted from the bucketpublic int processQuery(QueryOperation<?> query) throws java.lang.IllegalStateException
processQuery
in class Bucket
query
- query operation that is to be processed on the bucketjava.lang.IllegalStateException
- if there was an error communicating with the remote bucket dispatcherpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the reference object with which to comparetrue
if this object is the same as the obj
argument; false
otherwisepublic int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object