Interface AerospikeOperations
- All Known Implementing Classes:
AerospikeTemplate
public interface AerospikeOperations
Aerospike specific data access operations.
- Author:
- Oliver Gierke, Peter Milne, Anastasiia Smirnova, Roman Terentiev
-
Method Summary
Modifier and Type Method Description <T> Tadd(T objectToAddTo, String binName, long value)<T> Tadd(T objectToAddTo, Map<String,Long> values)<T> Iterable<T>aggregate(com.aerospike.client.query.Filter filter, Class<T> entityClass, String module, String function, List<com.aerospike.client.Value> arguments)<T> Tappend(T objectToAppendTo, String binName, String value)<T> Tappend(T objectToAppendTo, Map<String,String> values)<T> longcount(Class<T> entityClass)Returns the amount of records in the given entityClass's Aerospike set and AerospikeTemplate configured namespace.<T> longcount(String setName)Returns the amount of records in the given Aerospike set and AerospikeTemplate configured namespace.<T> longcount(Query query, Class<T> entityClass)Returns the amount of records in a query results.<T> voidcreateIndex(Class<T> entityClass, String indexName, String binName, com.aerospike.client.query.IndexType indexType)Creates index by specified name in Aerospike.<T> voidcreateIndex(Class<T> entityClass, String indexName, String binName, com.aerospike.client.query.IndexType indexType, com.aerospike.client.query.IndexCollectionType indexCollectionType)Creates index by specified name in Aerospike.<T> voiddelete(Class<T> entityClass)<T> booleandelete(Object id, Class<T> entityClass)<T> booleandelete(T objectToDelete)<T> voiddeleteIndex(Class<T> entityClass, String indexName)Deletes index by specified name from Aerospike.<T> Texecute(Supplier<T> supplier)Execute operation against underlying store.<T> booleanexists(Object id, Class<T> entityClass)<T> Stream<T>find(Query query, Class<T> entityClass)<T> Stream<T>findAll(Class<T> entityClass)<T> Iterable<T>findAll(Sort sort, Class<T> entityClass)<T> TfindById(Object id, Class<T> entityClass)<T> List<T>findByIds(Iterable<?> ids, Class<T> entityClass)GroupedEntitiesfindByIds(GroupedKeys groupedKeys)<T> Stream<T>findInRange(long offset, long limit, Sort sort, Class<T> entityClass)com.aerospike.client.IAerospikeClientgetAerospikeClient()MappingContext<?,?>getMappingContext()<T> StringgetSetName(Class<T> entityClass)Returns the Set name used for the specified class by this template.booleanindexExists(String indexName)Deprecated.This operation is deprecated due to complications that are required for guaranteed index existence response.<T> voidinsert(T document)Insert operation usingRecordExistsAction.CREATE_ONLYpolicy.<T> voidpersist(T document, com.aerospike.client.policy.WritePolicy writePolicy)Persist document using specified WritePolicy.<T> Tprepend(T objectToPrependTo, String binName, String value)<T> Tprepend(T objectToPrependTo, Map<String,String> values)<T> voidsave(T document)Save operation.<T> voidupdate(T objectToUpdate)Update operation usingRecordExistsAction.REPLACE_ONLYpolicy taking into consideration the version property of the document if it is present.
-
Method Details
-
getSetName
Returns the Set name used for the specified class by this template.- Parameters:
entityClass- must not be null.- Returns:
- The set name used for the specified class.
-
insert
<T> void insert(T document)Insert operation usingRecordExistsAction.CREATE_ONLYpolicy. If document has version property it will be updated with the server's version after successful operation.- Parameters:
document- The document to insert.
-
getMappingContext
MappingContext<?,?> getMappingContext()- Returns:
- mapping context in use.
-
save
<T> void save(T document)Save operation. If document has version property - CAS algorithm is used for updating record. Version property is used for deciding whether to create new record or update existing. If version is set to zero - new record will be created, creation will fail is such record already exists. If version is greater than zero - existing record will be updated withRecordExistsAction.REPLACE_ONLYpolicy taking into consideration the version property of the document. Version property will be updated with the server's version after successful operation. If document does not have version property - record is updated withRecordExistsAction.REPLACEpolicy. This means that when such record does not exist it will be created, otherwise updated.- Parameters:
document- The document to save.
-
persist
<T> void persist(T document, com.aerospike.client.policy.WritePolicy writePolicy)Persist document using specified WritePolicy.- Parameters:
document- The document to persist.writePolicy- The Aerospike write policy for the inner Aerospike put operation.
-
update
<T> void update(T objectToUpdate)Update operation usingRecordExistsAction.REPLACE_ONLYpolicy taking into consideration the version property of the document if it is present. If document has version property it will be updated with the server's version after successful operation.- Parameters:
objectToUpdate- The object to update.
-
delete
-
delete
-
delete
<T> boolean delete(T objectToDelete) -
exists
-
find
-
findAll
-
findById
-
findByIds
-
findByIds
-
add
-
add
-
append
-
append
-
prepend
-
prepend
-
aggregate
-
execute
Execute operation against underlying store.- Parameters:
supplier- must not be null.- Returns:
- Execution result.
-
findAll
-
findInRange
-
count
Returns the amount of records in a query results.- Parameters:
query- The query that provides the result set for count.entityClass- The class to provide for the query.- Returns:
- amount of records that the given query and entity class provided.
-
count
Returns the amount of records in the given Aerospike set and AerospikeTemplate configured namespace.- Returns:
- amount of records in the set (in the configured namespace).
-
count
Returns the amount of records in the given entityClass's Aerospike set and AerospikeTemplate configured namespace.- Parameters:
entityClass- The class to extract the Aerospike set from.- Returns:
- amount of records in the set (in the configured namespace).
-
createIndex
<T> void createIndex(Class<T> entityClass, String indexName, String binName, com.aerospike.client.query.IndexType indexType)Creates index by specified name in Aerospike. -
createIndex
<T> void createIndex(Class<T> entityClass, String indexName, String binName, com.aerospike.client.query.IndexType indexType, com.aerospike.client.query.IndexCollectionType indexCollectionType)Creates index by specified name in Aerospike. -
deleteIndex
Deletes index by specified name from Aerospike. -
indexExists
Deprecated.This operation is deprecated due to complications that are required for guaranteed index existence response.If you need to conditionally create index — replace this method (indexExists) with
createIndex(java.lang.Class<T>, java.lang.String, java.lang.String, com.aerospike.client.query.IndexType)and catchIndexAlreadyExistsException.More information can be found at: https://github.com/aerospike/aerospike-client-java/pull/149
Checks whether index by specified name exists in Aerospike.- Parameters:
indexName- The Aerospike index name- Returns:
- true if exists
-
getAerospikeClient
com.aerospike.client.IAerospikeClient getAerospikeClient()
-