public abstract class BucketStore extends Object
BucketId
. There is one-to-one relationship between recorded splits and buckets.
The KV-pairs corresponding to a split are put in one bucket.
Each bucket store is created for the specific Image
by the BucketStoreFactory
.Constructor and Description |
---|
BucketStore() |
Modifier and Type | Method and Description |
---|---|
static List<BucketId> |
bucketizeNamedCache(int appId)
Returns a full set of buckets for the NamedCache.
|
abstract void |
clearBucket(BucketId bucketId)
Clears the specified bucket.
|
abstract LinkedList<com.scaleoutsoftware.soss.client.da.StateServerKey> |
getBucketContents(BucketId bucketId)
Gets a list of all object keys in the specified bucket.
|
static InetAddress |
getBucketLocation(BucketId bucketId)
Gets the name of the host where this bucket is local.
|
abstract Image |
getImage(boolean lock)
Return the
Image object corresponding to this bucket store. |
static List<com.scaleoutsoftware.soss.client.da.StateServerKey> |
getNamedCacheBucketContents(BucketId id)
Returns the contents of the NamedCache bucket.
|
abstract BucketId |
getNextLocalBucketId()
Creates a new bucket on the local host.
|
static ObjectReader |
getObjectReader(int initialSize)
Gets an object reader which can retrieve objects based on key.
|
abstract void |
putObject(BucketId bucketId,
long objectIndex,
byte[] object,
int length)
Writes an object to ScaleOut StateServer and assigns it to the specified bucket.
|
abstract void |
removeImage()
Removes the
Image object from the StateServer. |
abstract void |
unlockImage()
Unlocks the
Image object. |
abstract void |
writeImage(Image image,
boolean unlock)
Writes the
Image object to ScaleOut StateServer. |
public static InetAddress getBucketLocation(BucketId bucketId) throws com.scaleoutsoftware.soss.client.da.StateServerException
bucketId
- bucket IDcom.scaleoutsoftware.soss.client.da.StateServerException
- If there was a communication error between the JVM and ScaleOut StateServer (or if ScaleOut StateServer experienced an internal error)public abstract BucketId getNextLocalBucketId() throws com.scaleoutsoftware.soss.client.da.StateServerException
com.scaleoutsoftware.soss.client.da.StateServerException
- If there was a communication error between the JVM and ScaleOut StateServer (or if ScaleOut StateServer experienced an internal error)public abstract void putObject(BucketId bucketId, long objectIndex, byte[] object, int length) throws com.scaleoutsoftware.soss.client.da.StateServerException
bucketId
- bucket IDobjectIndex
- object index in the bucket (to preserve ordering)object
- buffer, containing byte representation of the object to writelength
- length of the objectcom.scaleoutsoftware.soss.client.da.StateServerException
- If there was a communication error between the JVM and ScaleOut StateServer (or if ScaleOut StateServer experienced an internal error)public abstract LinkedList<com.scaleoutsoftware.soss.client.da.StateServerKey> getBucketContents(BucketId bucketId) throws com.scaleoutsoftware.soss.client.da.StateServerException
bucketId
- bucket IDcom.scaleoutsoftware.soss.client.da.StateServerException
- If there was a communication error between the JVM and ScaleOut StateServer (or if ScaleOut StateServer experienced an internal error)public abstract void clearBucket(BucketId bucketId) throws com.scaleoutsoftware.soss.client.da.StateServerException
bucketId
- bucket IDcom.scaleoutsoftware.soss.client.da.StateServerException
- If there was a communication error between the JVM and ScaleOut StateServer (or if ScaleOut StateServer experienced an internal error)public abstract Image getImage(boolean lock) throws com.scaleoutsoftware.soss.client.da.StateServerException, IOException, ClassNotFoundException
Image
object corresponding to this bucket store.lock
- if true
, the object in the ScaleOut StateServer store is locked, so no other process can overwrite it
until it is unlocked. Unlocking is performed by the writeImage(com.scaleoutsoftware.soss.hserver.interop.Image, boolean)
or unlockImage()
methods.com.scaleoutsoftware.soss.client.da.StateServerException
- If there was a communication error between the JVM and ScaleOut StateServer (or if ScaleOut StateServer experienced an internal error)IOException
- If there was an error while communicating with ScaleOut StateServerClassNotFoundException
- If there was a class path issuepublic abstract void writeImage(Image image, boolean unlock) throws com.scaleoutsoftware.soss.client.da.StateServerException
Image
object to ScaleOut StateServer.image
- image objectunlock
- if true
, the object in the ScaleOut StateServer store is unlocked after writing.com.scaleoutsoftware.soss.client.da.StateServerException
- If there was a communication error between the JVM and ScaleOut StateServer (or if ScaleOut StateServer experienced an internal error)public abstract void unlockImage() throws com.scaleoutsoftware.soss.client.da.StateServerException
Image
object.com.scaleoutsoftware.soss.client.da.StateServerException
- If there was a communication error between the JVM and ScaleOut StateServer (or if ScaleOut StateServer experienced an internal error)public abstract void removeImage() throws com.scaleoutsoftware.soss.client.da.StateServerException
Image
object from the StateServer.com.scaleoutsoftware.soss.client.da.StateServerException
- If there was a communication error between the JVM and ScaleOut StateServer (or if ScaleOut StateServer experienced an internal error)public static List<BucketId> bucketizeNamedCache(int appId)
appId
- id for the cachepublic static List<com.scaleoutsoftware.soss.client.da.StateServerKey> getNamedCacheBucketContents(BucketId id) throws com.scaleoutsoftware.soss.client.da.StateServerException
bucketizeNamedCache(int)
.id
- bucket id;com.scaleoutsoftware.soss.client.da.StateServerException
- If there was a communication error between the JVM and ScaleOut StateServer (or if ScaleOut StateServer experienced an internal error)public static ObjectReader getObjectReader(int initialSize)
initialSize
- initial size of the reusable buffer in bytesCopyright (C) 2007-2014 ScaleOut Software, Inc.