public abstract class UserKeyValueStorage extends java.lang.Object implements KeyValueStorage
Modifier and Type | Class and Description |
---|---|
static class |
UserKeyValueStorage.Chunk
Represents a chunk of a string data.
|
Constructor and Description |
---|
UserKeyValueStorage() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
collectChunks(java.lang.String key,
UserKeyValueStorage.Chunk head)
Collect stored chunks into the string value of the given key.
|
abstract void |
flushChanges()
Flushes the current changes into this storage backend.
|
java.lang.Boolean |
getBoolean(java.lang.String key)
Retrieves the boolean value of the given key from this storage.
|
abstract UserKeyValueStorage.Chunk |
getFirstChunk(java.lang.String key)
Retrieves the first chunk node.
|
abstract int |
getMaximalValueSize()
Returns the maximal value size that can be stored into this storage backend.
|
abstract UserKeyValueStorage.Chunk |
getNextChunk(UserKeyValueStorage.Chunk head,
java.lang.String nextChunkKey)
Retrieves the next chunk of stored data.
|
java.lang.String |
getNextChunkKey(UserKeyValueStorage.Chunk head,
int chunkNumber)
Returns the next chunk key.
|
java.lang.Number |
getNumber(java.lang.String key)
Retrieves the value of the given key from this storage.
|
java.lang.String |
getString(java.lang.String key)
Retrieves the string value of the given key from this storage.
|
abstract boolean |
isChunkKey(java.lang.String key)
Tests if the given key is used by a chunk that follows the head chunk.
|
void |
saveByChunks(java.lang.String key,
java.lang.String value)
Saves the string value of this key in this storage by splitting it into chunks in order
to fit value capacity limits of this storage backend.
|
abstract void |
saveHeadChunk(java.lang.String key,
UserKeyValueStorage.Chunk head)
Stores the head chunk with the given key within this storage backend.
|
abstract void |
saveNextChunk(UserKeyValueStorage.Chunk head,
java.lang.String nextChunkKey,
UserKeyValueStorage.Chunk node)
Stores the given chunk with the given key within this storage backend.
|
void |
setBoolean(java.lang.String key,
java.lang.Boolean value)
Saves the boolean value of this key in this storage.
|
void |
setNumber(java.lang.String key,
java.lang.Number value)
Saves the number value of this key in this storage.
|
void |
setString(java.lang.String key,
java.lang.String value)
Saves the string value of this key in this storage.
|
void |
setUniqueHeadName(UserKeyValueStorage.Chunk head)
Sets the unique name to the given head chunk.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
delete, getKey, getSize
public java.lang.Number getNumber(java.lang.String key)
getNumber
in interface KeyValueStorage
key
- The given keypublic void setNumber(java.lang.String key, java.lang.Number value)
setNumber
in interface KeyValueStorage
key
- The given keyvalue
- The value of the given keypublic java.lang.Boolean getBoolean(java.lang.String key)
getBoolean
in interface KeyValueStorage
key
- The given keypublic void setBoolean(java.lang.String key, java.lang.Boolean value)
setBoolean
in interface KeyValueStorage
key
- The given keyvalue
- The value of the given keypublic java.lang.String getString(java.lang.String key)
getString
in interface KeyValueStorage
key
- The given keypublic void setString(java.lang.String key, java.lang.String value)
setString
in interface KeyValueStorage
key
- The given keyvalue
- The string value of the given keypublic java.lang.String collectChunks(java.lang.String key, UserKeyValueStorage.Chunk head)
key
- The given keyhead
- The first chunkpublic void saveByChunks(java.lang.String key, java.lang.String value)
key
- The given keyvalue
- The string value of the given keypublic void setUniqueHeadName(UserKeyValueStorage.Chunk head)
head
- The first chunkpublic java.lang.String getNextChunkKey(UserKeyValueStorage.Chunk head, int chunkNumber)
head
- The first chunk of the stored data valuechunkNumber
- The current chunk numberpublic abstract boolean isChunkKey(java.lang.String key)
key
- The given key to testpublic abstract void saveHeadChunk(java.lang.String key, UserKeyValueStorage.Chunk head)
key
- The given keyhead
- The head chunkpublic abstract void saveNextChunk(UserKeyValueStorage.Chunk head, java.lang.String nextChunkKey, UserKeyValueStorage.Chunk node)
head
- The head chunknextChunkKey
- The given chunk keynode
- The chunkpublic abstract void flushChanges()
public abstract int getMaximalValueSize()
public abstract UserKeyValueStorage.Chunk getFirstChunk(java.lang.String key)
key
- The given keypublic abstract UserKeyValueStorage.Chunk getNextChunk(UserKeyValueStorage.Chunk head, java.lang.String nextChunkKey)
head
- The first chunk of the stored data valuenextChunkKey
- The next chunk key