public interface StorageService
Modifier and Type | Field and Description |
---|---|
static String |
PARTITION_PROPERTY |
Modifier and Type | Method and Description |
---|---|
void |
closeService()
Closes the service and all its used resources
|
void |
ensureIndex(CompositeIndexField indexField,
boolean isUnique,
IndexField... valueFields)
Ensures an index with a composite key (multiple fields) is present.
|
void |
ensureIndex(IndexField indexField,
boolean isUnique,
IndexField... valueFields)
Ensures an index with the given field is present.
|
void |
flush()
An operation that can be called to guarantee all changes are flushed to the disk.
|
String |
getBagName()
Gets the name of the bag that this storage service represents
|
long |
getDiskSize()
Gets the size on the disk (if the flushing strategy is async could misrepresent the real number)
|
QueryResult |
getEntities(RequestContext context)
This retrieves all items from storage with an iterator, the documents are only loaded once the iterator is used.
|
QueryResult |
getEntities(RequestContext context,
int max)
This retrieves all items from storage with an iterator, the documents are only loaded
once the iterator is used.
|
SimpleEntity |
getEntityById(RequestContext requestContext,
String id)
Retrieve a specific entity from storage by the given unique document id
|
List<String> |
getIndexNames()
Gets a list of all present index names
|
String |
getInstanceId()
Gets the instance this bag belongs to
|
PartitioningManager |
getPartitionManager() |
long |
getSize()
Gets the amount of items stored
|
void |
initializePartitions() |
void |
insertEntity(RequestContext context,
SimpleEntity entity)
This inserts the entity into the storage and indexes
|
void |
openService(Configuration configuration)
Opens the service and all the resources required.
|
void |
remove()
Removes the bag and all related resources from the storage location
|
void |
removeEntity(RequestContext context,
SimpleEntity entity)
This removes and entity from storage and the indexes
|
void |
removeEntity(RequestContext context,
String internalId)
This removes the entity based on the internal id of the entity
|
void |
removeIndex(String indexName)
Removes the index with the given name
|
QueryResult |
search(RequestContext context,
BlockOperation blockOperation,
SearchLimit limit,
List<SortParameter> params)
This is the query entrypoint, all API queries are translated into a Query Object Model which can be executed on the
indexes and be sorted after all index queries have been resolved
|
void |
updateEntity(RequestContext context,
SimpleEntity entity)
This updates the entity in the storage and indexes if needed
|
static final String PARTITION_PROPERTY
String getBagName()
String getInstanceId()
void openService(Configuration configuration) throws JasDBStorageException
configuration
- The configurationJasDBStorageException
- If unable to open the storage servicevoid closeService() throws JasDBStorageException
JasDBStorageException
- If unable to cleanly close the resourcesvoid flush() throws JasDBStorageException
JasDBStorageException
- If unable to flush the changes to the diskvoid remove() throws JasDBStorageException
JasDBStorageException
- If unable to remove the bag and related resourcesvoid initializePartitions() throws JasDBStorageException
JasDBStorageException
PartitioningManager getPartitionManager()
void insertEntity(RequestContext context, SimpleEntity entity) throws JasDBStorageException
context
- The request contextentity
- The entity to store in the storage and which is used to populate the indexesJasDBStorageException
- If unable to insert the entity or the indexesvoid removeEntity(RequestContext context, SimpleEntity entity) throws JasDBStorageException
context
- The request contextentity
- The entity to remove from the storage and the indexesJasDBStorageException
- If unable to remove the entity from the indexes or storagevoid removeEntity(RequestContext context, String internalId) throws JasDBStorageException
context
- The request contextinternalId
- The entity to remove the storage and indexesJasDBStorageException
- If unable to remove the entity from the indexes or storagevoid updateEntity(RequestContext context, SimpleEntity entity) throws JasDBStorageException
context
- The request contextentity
- The entity to updateJasDBStorageException
- If unable to updatelong getSize() throws JasDBStorageException
JasDBStorageException
- If unable to retrieve the amount of stored itemslong getDiskSize() throws JasDBStorageException
JasDBStorageException
- If unable to return the amount of used disk spaceSimpleEntity getEntityById(RequestContext requestContext, String id) throws JasDBStorageException
requestContext
- The request contextid
- The unique documentId of the itemJasDBStorageException
- If unable to retrieve the item from storageQueryResult getEntities(RequestContext context) throws JasDBStorageException
JasDBStorageException
- If unable to load the iterator over all documentsQueryResult getEntities(RequestContext context, int max) throws JasDBStorageException
max
- The maximum amount of records to retrieveJasDBStorageException
- If unable to load the iterator over all documentsQueryResult search(RequestContext context, BlockOperation blockOperation, SearchLimit limit, List<SortParameter> params) throws JasDBStorageException
context
- THe request contextblockOperation
- The main blockoperation, the parent item in the Query Object Model.limit
- The limits of the given queryparams
- The sorting paramaters to be applied to the resultsetJasDBStorageException
- If unable to execute the search queryvoid ensureIndex(IndexField indexField, boolean isUnique, IndexField... valueFields) throws JasDBStorageException
indexField
- The field to be indexedisUnique
- True If the field needs to have a unique constraint, False if notvalueFields
- The value fields to be added to the index, can be used to improve sorting performance or secondary queriesJasDBStorageException
- If unable to ensure the index existsvoid ensureIndex(CompositeIndexField indexField, boolean isUnique, IndexField... valueFields) throws JasDBStorageException
indexField
- The indexed composite fieldsisUnique
- True If the field needs to have a unique constraint, False if notvalueFields
- The value fields to be added to the index, can be used to improve sorting performance or secondary queriesJasDBStorageException
- If unable to ensure the index existsList<String> getIndexNames() throws JasDBStorageException
JasDBStorageException
- If unable to retrieve the list of index namesvoid removeIndex(String indexName) throws JasDBStorageException
indexName
- The name of the index to be removedJasDBStorageException
- If unable to remove the indexCopyright © 2015. All rights reserved.