Interface AerospikeOperations
- All Known Implementing Classes:
AerospikeTemplate
- Author:
- Oliver Gierke, Peter Milne, Anastasiia Smirnova, Roman Terentiev
-
Method Summary
Modifier and TypeMethodDescription<T> TFind an existing record matching the document's class and id, add specified value to the record's bin and return the modified record mapped to the document's class.<T> TFind an existing record matching the document's id and the given set name, add specified value to the record's bin and return the modified record mapped to the document's class.<T> TFind an existing record matching the document's id and the given set name, add map values to the corresponding bins of the record and return the modified record mapped to the document's class.<T> TFind an existing record matching the document's class and id, add map values to the corresponding bins of the record and return the modified record mapped to the document's class.<T> com.aerospike.client.query.ResultSetaggregate(com.aerospike.client.query.Filter filter, Class<T> entityClass, String module, String function, List<com.aerospike.client.Value> arguments) Execute query, apply statement's aggregation function, and return result iterator.com.aerospike.client.query.ResultSetaggregate(com.aerospike.client.query.Filter filter, String setName, String module, String function, List<com.aerospike.client.Value> arguments) Execute query within the given set, apply statement's aggregation function, and return result iterator.<T> TFind an existing record matching the document's class and id, append specified value to the record's bin and return the modified record mapped to the document's class.<T> TFind an existing record matching the document's id and the given set name, append specified value to the record's bin and return the modified record mapped to the document's class.<T> TFind an existing record matching the document's id and the given set name, append map values to the corresponding bins of the record and return the modified record mapped to the document's class.<T> TFind an existing record matching the document's class and id, append map values to the corresponding bins of the record and return the modified record mapped to the document's class.<T> longReturn the amount of records in the set determined by the given entityClass.longReturn the amount of records in the given Aerospike set.<T> longReturn the amount of records in query results.longReturn the amount of records in query results within the given set.<T> voidcreateIndex(Class<T> entityClass, String indexName, String binName, com.aerospike.client.query.IndexType indexType) Create an index with the 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) Create an index with the 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, com.aerospike.client.cdt.CTX... ctx) Create an index with the specified name in Aerospike.voidcreateIndex(String setName, String indexName, String binName, com.aerospike.client.query.IndexType indexType) Create an index with the specified name in Aerospike.voidcreateIndex(String setName, String indexName, String binName, com.aerospike.client.query.IndexType indexType, com.aerospike.client.query.IndexCollectionType indexCollectionType) Create an index with the specified name in Aerospike.voidcreateIndex(String setName, String indexName, String binName, com.aerospike.client.query.IndexType indexType, com.aerospike.client.query.IndexCollectionType indexCollectionType, com.aerospike.client.cdt.CTX... ctx) Create an index with the specified name in Aerospike.<T> voidDeprecated.<T> booleanDeprecated.since 4.6.0, usedeleteById(Object, Class)instead.<T> booleandelete(T document) Delete a record using the document's id.<T> booleanDelete a record within the given set using the document's id.<T> voidTruncate/Delete all records in the set determined by the given entity class.<T> voidTruncate/Delete all documents in the given set.<T> voidDelete multiple records in one batch request.<T> voidDelete multiple records within the given set (overrides the default set associated with the documents) in one batch request.voidTruncate/Delete all documents in the given set.voidTruncate/Delete all documents in the given set.<T> booleandeleteById(Object id, Class<T> entityClass) Delete a record by id, set name will be determined by the given entityClass.booleandeleteById(Object id, String setName) Delete a record by id within the given set.<T> voiddeleteByIds(Iterable<?> ids, Class<T> entityClass) Delete records by ids using a single batch delete operation, set name will be determined by the given entityClass.voiddeleteByIds(Iterable<?> ids, String setName) Delete records by ids within the given set using a single batch delete operation.voiddeleteByIds(GroupedKeys groupedKeys) Perform a single batch delete operation for records from different sets.<T> voiddeleteIndex(Class<T> entityClass, String indexName) Delete an index with the specified name in Aerospike.voiddeleteIndex(String setName, String indexName) Delete an index with the specified name within the given set in Aerospike.<T> TExecute an operation against underlying store.<T> booleanCheck by id if a record exists within the set associated with the given entityClass.booleanCheck by id if a record exists within the given set name.<T> booleanexistsByQuery(Query query, Class<T> entityClass) Check using a query if any matching records exist within the set associated with the given entityClass.<T> booleanexistsByQuery(Query query, Class<T> entityClass, String setName) Check using a query if any matching records exist within the given set.<T> Stream<T> Find records in the given entityClass's set using a query and map them to the given class type.<T,S> Stream <S> Find records in the given entityClass's set using a query and map them to the given target class type.<T> Stream<T> Find records in the given set using a query and map them to the given target class type.<T> Stream<T> Find all records in the given entityClass's set and map them to the given class type.<T,S> Stream <S> Find all records in the given entityClass's set and map them to the given target class type.<T> Stream<T> Find all records in the given set and map them to the given class type.<T> Stream<T> Find all records in the given entityClass's set using a provided sort and map them to the given class type.<T,S> Stream <S> Find all records in the given entityClass's set using a provided sort and map them to the given target class type.<T> Stream<T> Find all records in the given set using a provided sort and map them to the given target class type.<T> TFind a record by id, set name will be determined by the given entityClass.<T,S> S Find a record by id, set name will be determined by the given entityClass.<T,S> S Find a record by id within the given set.<T> TFind a record by id within the given set.<T> List<T> Find records by ids using a single batch read operation, set name will be determined by the given entityClass.<T,S> List <S> Find records by ids using a single batch read operation, set name will be determined by the given entityClass.<T,S> List <S> Find records by ids within the given set using a single batch read operation.<T> List<T> Find records by ids within the given set using a single batch read operation.findByIds(GroupedKeys groupedKeys) Execute a single batch request to find several records, possibly from different sets.<T,S> List <?> findByIdsUsingQuery(Collection<?> ids, Class<T> entityClass, Class<S> targetClass, String setName, Query query) Find records by ids within the given set.<T,S> List <?> findByIdsUsingQuery(Collection<?> ids, Class<T> entityClass, Class<S> targetClass, Query query) Find records by ids and a query, set name will be determined by the given entityClass.<T,S> Object findByIdUsingQuery(Object id, Class<T> entityClass, Class<S> targetClass, String setName, Query query) Find a record by id within the given set using a query.<T,S> Object findByIdUsingQuery(Object id, Class<T> entityClass, Class<S> targetClass, Query query) Find a record by id using a query, set name will be determined by the given entityClass.<T> Stream<T> findInRange(long offset, long limit, Sort sort, Class<T> entityClass) Find records in the given entityClass's set using a range (offset, limit) and a sort and map them to the given class type.<T,S> Stream <S> findInRange(long offset, long limit, Sort sort, Class<T> entityClass, Class<S> targetClass) Find records in the given entityClass's set using a range (offset, limit) and a sort and map them to the given target class type.<T> Stream<T> findInRange(long offset, long limit, Sort sort, Class<T> targetClass, String setName) Find records in the given set using a range (offset, limit) and a sort and map them to the given target class type.<T,S> Stream <S> findUsingQueryWithoutPostProcessing(Class<T> entityClass, Class<S> targetClass, Query query) Find records in the given entityClass set using a query and map them to the given target class type.com.aerospike.client.IAerospikeClientMappingContext<?, ?> long<T> StringgetSetName(Class<T> entityClass) Return set name used for the given entityClass in the namespace configured for the AerospikeTemplate in use.<T> StringgetSetName(T document) Return set name used for the given document in the namespace configured for the AerospikeTemplate in use.booleanindexExists(String indexName) Check whether an index with the specified name exists in Aerospike.<T> voidinsert(T document) Insert a document usingRecordExistsAction.CREATE_ONLYpolicy.<T> voidInsert a document within the given set (overrides the set associated with the document) usingRecordExistsAction.CREATE_ONLYpolicy.<T> voidInsert multiple documents in one batch request.<T> voidInsert multiple documents within the given set (overrides the set associated with the document) in one batch request.<T> voidpersist(T document, com.aerospike.client.policy.WritePolicy writePolicy) Persist a document using specified WritePolicy.<T> voidPersist a document within the given set (overrides the default set associated with the document) using specified WritePolicy.<T> TFind an existing record matching the document's class and id, prepend specified value to the record's bin and return the modified record mapped to the document's class.<T> TFind an existing record matching the document's id and the given set name, prepend specified value to the record's bin and return the modified record mapped to the document's class.<T> TFind an existing record matching the document's id and the given set name, prepend map values to the corresponding bins of the record and return the modified record mapped to the document's class.<T> TFind an existing record matching the document's class and id, prepend map values to the corresponding bins of the record and return the modified record mapped to the document's class.<T> voidsave(T document) Save a document.<T> voidSave a document within the given set (overrides the set associated with the document)<T> voidSave multiple documents in one batch request.<T> voidSave multiple documents within the given set (overrides the default set associated with the documents) in one batch request.<T> voidupdate(T document) Update a record usingRecordExistsAction.UPDATE_ONLYpolicy combined with removing bins at first (analogous toRecordExistsAction.REPLACE_ONLY) taking into consideration the version property of the document if it is present.<T> voidUpdate a record with the given set (overrides the set associated with the document) usingRecordExistsAction.UPDATE_ONLYpolicy combined with removing bins at first (analogous toRecordExistsAction.REPLACE_ONLY) taking into consideration the version property of the document if it is present.<T> voidupdate(T document, String setName, Collection<String> fields) Update specific fields of a record based on the given collection of fields with the given set (overrides the set associated with the document) usingRecordExistsAction.UPDATE_ONLYpolicy.<T> voidupdate(T document, Collection<String> fields) Update specific fields of a record based on the given collection of fields usingRecordExistsAction.UPDATE_ONLYpolicy.<T> voidUpdate multiple records in one batch request.<T> voidUpdate multiple records within the given set (overrides the default set associated with the documents) in one batch request.
-
Method Details
-
getSetName
Return set name used for the given entityClass in the namespace configured for the AerospikeTemplate in use.- Parameters:
entityClass- The class to get the set name for.- Returns:
- The set name used for the given entityClass.
-
getSetName
Return set name used for the given document in the namespace configured for the AerospikeTemplate in use.- Parameters:
document- The document to get the set name for.- Returns:
- The set name used for the given document.
-
getMappingContext
MappingContext<?,?> getMappingContext()- Returns:
- Mapping context in use.
-
getAerospikeConverter
MappingAerospikeConverter getAerospikeConverter()- Returns:
- converter in use.
-
getAerospikeClient
com.aerospike.client.IAerospikeClient getAerospikeClient()- Returns:
- Aerospike client in use.
-
getQueryMaxRecords
long getQueryMaxRecords()- Returns:
- Value of configuration parameter
.
invalid reference
AerospikeDataSettings#getQueryMaxRecords()
-
save
<T> void save(T document) Save a document.If the document has version property, CAS algorithm is used for updating record. Version property is used for deciding whether to create a new record or update an existing one. If the version is set to zero, a new record will be created, creation will fail if such record already exists. If the version is greater than zero, existing record will be updated with
RecordExistsAction.UPDATE_ONLYpolicy combined with removing bins at first (analogous toRecordExistsAction.REPLACE_ONLY) taking into consideration the version property of the document. Document's version property will be updated with the server's version after successful operation.If the document does not have version property, record is updated with
RecordExistsAction.UPDATEpolicy combined with removing bins at first (analogous toRecordExistsAction.REPLACE). This means that when such record does not exist it will be created, otherwise updated (an "upsert").- Parameters:
document- The document to be saved. Must not be null.- Throws:
OptimisticLockingFailureException- if the document has a version attribute with a different value from that found on server.DataAccessException- If operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
save
Save a document within the given set (overrides the set associated with the document)If the document has version property, CAS algorithm is used for updating record. Version property is used for deciding whether to create a new record or update an existing one. If the version is set to zero, a new record will be created, creation will fail if such record already exists. If the version is greater than zero, existing record will be updated with
RecordExistsAction.UPDATE_ONLYpolicy combined with removing bins at first (analogous toRecordExistsAction.REPLACE_ONLY) taking into consideration the version property of the document. Document's version property will be updated with the server's version after successful operation.If the document does not have version property, record is updated with
RecordExistsAction.UPDATEpolicy combined with removing bins at first (analogous toRecordExistsAction.REPLACE). This means that when such record does not exist it will be created, otherwise updated (an "upsert").- Parameters:
document- The document to be saved. Must not be null.setName- Set name to override the set associated with the document.- Throws:
OptimisticLockingFailureException- if the document has a version attribute with a different value from that found on server.DataAccessException- If operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
saveAll
Save multiple documents in one batch request. The policies are analogous tosave(Object).The order of returned results is preserved. The execution order is NOT preserved.
This operation requires Server version 6.0+.
- Parameters:
documents- The documents to be saved. Must not be null.- Throws:
com.aerospike.client.AerospikeException.BatchRecordArray- If batch save succeeds, but results contain errors or null records.OptimisticLockingFailureException- If at least one document has a version attribute with a different value from that found on server.DataAccessException- If batch operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
saveAll
Save multiple documents within the given set (overrides the default set associated with the documents) in one batch request. The policies are analogous tosave(Object).The order of returned results is preserved. The execution order is NOT preserved.
This operation requires Server version 6.0+.
- Parameters:
documents- The documents to be saved. Must not be null.setName- Set name to override the default set associated with the documents.- Throws:
com.aerospike.client.AerospikeException.BatchRecordArray- If batch save succeeds, but results contain errors or null records.OptimisticLockingFailureException- If at least one document has a version attribute with a different value from that found on server.DataAccessException- If batch operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
insert
<T> void insert(T document) Insert a document usingRecordExistsAction.CREATE_ONLYpolicy.If the document has version property it will be updated with the server's version after successful operation.
- Parameters:
document- The document to be inserted. Must not be null.- Throws:
OptimisticLockingFailureException- if the document has a version attribute with a different value from that found on server.DataAccessException- If batch operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
insert
Insert a document within the given set (overrides the set associated with the document) 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 be inserted. Must not be null.setName- Set name to override the set associated with the document.- Throws:
OptimisticLockingFailureException- if the document has a version attribute with a different value from that found on server.DataAccessException- If batch operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
insertAll
Insert multiple documents in one batch request. The policies are analogous toinsert(Object).The order of returned results is preserved. The execution order is NOT preserved.
This operation requires Server version 6.0+.
- Parameters:
documents- Documents to be inserted. Must not be null.- Throws:
com.aerospike.client.AerospikeException.BatchRecordArray- If batch insert succeeds, but results contain errors or null records.OptimisticLockingFailureException- If at least one document has a version attribute with a different value from that found on server.DataAccessException- If batch operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
insertAll
Insert multiple documents within the given set (overrides the set associated with the document) in one batch request. The policies are analogous toinsert(Object).The order of returned results is preserved. The execution order is NOT preserved.
This operation requires Server version 6.0+.
- Parameters:
documents- Documents to be inserted. Must not be null.setName- Set name to override the set associated with the document.- Throws:
com.aerospike.client.AerospikeException.BatchRecordArray- If batch insert succeeds, but results contain errors or null records.OptimisticLockingFailureException- If at least one document has a version attribute with a different value from that found on server.DataAccessException- If batch operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
persist
<T> void persist(T document, com.aerospike.client.policy.WritePolicy writePolicy) Persist a document using specified WritePolicy.- Parameters:
document- The document to be persisted. Must not be null.writePolicy- The Aerospike write policy for the inner Aerospike put operation. Must not be null.- Throws:
DataAccessException- If operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
persist
Persist a document within the given set (overrides the default set associated with the document) using specified WritePolicy.- Parameters:
document- The document to be persisted. Must not be null.writePolicy- The Aerospike write policy for the inner Aerospike put operation. Must not be null.setName- Set name to override the set associated with the document.- Throws:
DataAccessException- If operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
update
<T> void update(T document) Update a record usingRecordExistsAction.UPDATE_ONLYpolicy combined with removing bins at first (analogous toRecordExistsAction.REPLACE_ONLY) 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:
document- The document that identifies the record to be updated. Must not be null.- Throws:
OptimisticLockingFailureException- if the document has a version attribute with a different value from that found on server.DataAccessException- If operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
update
Update a record with the given set (overrides the set associated with the document) usingRecordExistsAction.UPDATE_ONLYpolicy combined with removing bins at first (analogous toRecordExistsAction.REPLACE_ONLY) 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:
document- The document that identifies the record to be updated. Must not be null.setName- Set name to override the set associated with the document.- Throws:
OptimisticLockingFailureException- if the document has a version attribute with a different value from that found on server.DataAccessException- If operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
update
Update specific fields of a record based on the given collection of fields usingRecordExistsAction.UPDATE_ONLYpolicy. You can instantiate the document with only the relevant fields and specify the list of fields that you want to update. 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:
document- The document that identifies the record to be updated. Must not be null.fields- Specific fields to update.- Throws:
OptimisticLockingFailureException- if the document has a version attribute with a different value from that found on server.DataAccessException- If operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
update
Update specific fields of a record based on the given collection of fields with the given set (overrides the set associated with the document) usingRecordExistsAction.UPDATE_ONLYpolicy. You can instantiate the document with only the relevant fields and specify the list of fields that you want to update. 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:
document- The document that identifies the record to be updated. Must not be null.setName- Set name to override the set associated with the document.fields- Specific fields to update.- Throws:
OptimisticLockingFailureException- if the document has a version attribute with a different value from that found on server.DataAccessException- If operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
updateAll
Update multiple records in one batch request. The policies are analogous toupdate(Object).The order of returned results is preserved. The execution order is NOT preserved.
This operation requires Server version 6.0+.
- Parameters:
documents- The documents that identify the records to be updated. Must not be null.- Throws:
com.aerospike.client.AerospikeException.BatchRecordArray- If batch update succeeds, but results contain errors or null records.OptimisticLockingFailureException- If at least one document has a version attribute with a different value from that found on server.DataAccessException- If batch operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
updateAll
Update multiple records within the given set (overrides the default set associated with the documents) in one batch request. The policies are analogous toupdate(Object).The order of returned results is preserved. The execution order is NOT preserved.
This operation requires Server version 6.0+.
- Parameters:
documents- The documents that identify the records to be updated. Must not be null.setName- Set name to override the set associated with the document.- Throws:
com.aerospike.client.AerospikeException.BatchRecordArray- If batch update succeeds, but results contain errors or null records.OptimisticLockingFailureException- If at least one document has a version attribute with a different value from that found on server.DataAccessException- If batch operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
delete
Deprecated.since 4.6.0, usedeleteAll(Class)instead.Truncate/Delete all records in the set determined by the given entityClass.- Parameters:
entityClass- The class to extract set name from. Must not be null.
-
delete
Deprecated.since 4.6.0, usedeleteById(Object, Class)instead.Delete a record by id, set name will be determined by the given entityClass.- Parameters:
id- The id of the record to delete. Must not be null.entityClass- The class to extract set name from. Must not be null.- Returns:
- whether the record existed on server before deletion.
-
delete
<T> boolean delete(T document) Delete a record using the document's id.If the document has version property it will be compared with the corresponding record's version on server.
- Parameters:
document- The document to get set name and id from. Must not be null.- Returns:
- Whether the record existed on server before deletion.
- Throws:
OptimisticLockingFailureException- if the document has a version attribute with a different value from that found on server.DataAccessException- If operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
delete
Delete a record within the given set using the document's id.If the document has version property it will be compared with the corresponding record's version on server.
- Parameters:
document- The document to get id from. Must not be null.setName- Set name to use.- Returns:
- Whether the record existed on server before deletion.
- Throws:
OptimisticLockingFailureException- if the document has a version attribute with a different value from that found on server.DataAccessException- If operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
deleteAll
Delete multiple records in one batch request. The policies are analogous todelete(Object).The execution order is NOT preserved.
This operation requires Server version 6.0+.
- Parameters:
documents- The documents to be deleted. Must not be null.- Throws:
com.aerospike.client.AerospikeException.BatchRecordArray- If batch save succeeds, but results contain errors or null records.OptimisticLockingFailureException- If at least one document has a version attribute with a different value from that found on server.DataAccessException- If batch operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
deleteAll
Delete multiple records within the given set (overrides the default set associated with the documents) in one batch request. The policies are analogous todelete(Object).The execution order is NOT preserved.
This operation requires Server version 6.0+.
- Parameters:
documents- The documents to be deleted. Must not be null.setName- Set name to override the default set associated with the documents.- Throws:
com.aerospike.client.AerospikeException.BatchRecordArray- If batch delete results contain errors.OptimisticLockingFailureException- If at least one document has a version attribute with a different value from that found on server.DataAccessException- If batch operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
deleteById
Delete a record by id, set name will be determined by the given entityClass.If the document has version property it is not compared with the corresponding record's version on server.
- Parameters:
id- The id of the record to be deleted. Must not be null.entityClass- The class to extract set name from. Must not be null.- Returns:
- Whether the record existed on server before deletion.
- Throws:
DataAccessException- If operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
deleteById
Delete a record by id within the given set.If the document has version property it is not compared with the corresponding record's version on server.
- Parameters:
id- The id of the record to be deleted. Must not be null.setName- Set name to use.- Returns:
- Whether the record existed on server before deletion.
- Throws:
DataAccessException- If operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
deleteByIds
Delete records by ids using a single batch delete operation, set name will be determined by the given entityClass. The policies are analogous todeleteById(Object, Class).This operation requires Server version 6.0+.
- Parameters:
ids- The ids of the records to be deleted. Must not be null.entityClass- The class to extract set name from. Must not be null.- Throws:
com.aerospike.client.AerospikeException.BatchRecordArray- If batch delete results contain errors.DataAccessException- If batch operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
deleteByIds
Delete records by ids within the given set using a single batch delete operation. The policies are analogous todeleteById(Object, String).This operation requires Server version 6.0+.
- Parameters:
ids- The ids of the records to be deleted. Must not be null.setName- Set name to use.- Throws:
com.aerospike.client.AerospikeException.BatchRecordArray- If batch delete results contain errors.DataAccessException- If batch operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
deleteByIds
Perform a single batch delete operation for records from different sets.Records' versions on server are not checked.
This operation requires Server 6.0+.
- Parameters:
groupedKeys- Keys grouped by document type. Must not be null, groupedKeys.getEntitiesKeys() must not be null.- Throws:
com.aerospike.client.AerospikeException.BatchRecordArray- If batch delete results contain errors.DataAccessException- If batch operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
deleteAll
Truncate/Delete all records in the set determined by the given entity class.- Parameters:
entityClass- The class to extract set name from. Must not be null.- Throws:
DataAccessException- If operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
deleteAll
Truncate/Delete all documents in the given set.- Parameters:
entityClass- The class to extract set name from. Must not be null.beforeLastUpdate- Delete records before the specified time (must be earlier than the current time at millisecond resolution).- Throws:
DataAccessException- If operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
deleteAll
Truncate/Delete all documents in the given set.- Parameters:
setName- Set name to truncate/delete all records in.- Throws:
DataAccessException- If operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
deleteAll
Truncate/Delete all documents in the given set.- Parameters:
setName- Set name to truncate/delete all records in.beforeLastUpdate- Delete records before the specified time (must be earlier than the current time at millisecond resolution).- Throws:
DataAccessException- If operation failed (seeDefaultAerospikeExceptionTranslatorfor details).
-
add
Find an existing record matching the document's class and id, add map values to the corresponding bins of the record and return the modified record mapped to the document's class.- Parameters:
document- The document to get set name and id from and to map the record to. Must not be null.values- The Map of bin names and values to add. Must not be null.- Returns:
- Modified record mapped to the document's class.
-
add
Find an existing record matching the document's id and the given set name, add map values to the corresponding bins of the record and return the modified record mapped to the document's class.- Parameters:
document- The document to get id from and to map the record to. Must not be null.setName- Set name to use.values- The Map of bin names and values to add. Must not be null.- Returns:
- Modified record mapped to the document's class.
-
add
Find an existing record matching the document's class and id, add specified value to the record's bin and return the modified record mapped to the document's class.- Parameters:
document- The document to get set name and id from and to map the record to. Must not be null.binName- Bin name to use add operation on. Must not be null.value- The value to add.- Returns:
- Modified record mapped to the document's class.
-
add
Find an existing record matching the document's id and the given set name, add specified value to the record's bin and return the modified record mapped to the document's class.- Parameters:
document- The document to get id from and to map the record to. Must not be null.setName- Set name to use.binName- Bin name to use add operation on. Must not be null.value- The value to add.- Returns:
- Modified record mapped to the document's class.
-
append
Find an existing record matching the document's class and id, append map values to the corresponding bins of the record and return the modified record mapped to the document's class.- Parameters:
document- The document to get set name and id from and to map the record to. Must not be null.values- The Map of bin names and values to append. Must not be null.- Returns:
- Modified record mapped to the document's class.
-
append
Find an existing record matching the document's id and the given set name, append map values to the corresponding bins of the record and return the modified record mapped to the document's class.- Parameters:
document- The document to get id from and to map the record to. Must not be null.setName- Set name to use.values- The Map of bin names and values to append. Must not be null.- Returns:
- Modified record mapped to the document's class.
-
append
Find an existing record matching the document's class and id, append specified value to the record's bin and return the modified record mapped to the document's class.- Parameters:
document- The document to get set name and id from and to map the record to. Must not be null.binName- Bin name to use append operation on.value- The value to append.- Returns:
- Modified record mapped to the document's class.
-
append
Find an existing record matching the document's id and the given set name, append specified value to the record's bin and return the modified record mapped to the document's class.- Parameters:
document- The document to get id from and to map the record to. Must not be null.setName- Set name to use.binName- Bin name to use append operation on.value- The value to append.- Returns:
- Modified record mapped to the document's class.
-
prepend
Find an existing record matching the document's class and id, prepend map values to the corresponding bins of the record and return the modified record mapped to the document's class.- Parameters:
document- The document to get set name and id from and to map the record to. Must not be null.values- The Map of bin names and values to prepend. Must not be null.- Returns:
- Modified record mapped to the document's class.
-
prepend
Find an existing record matching the document's id and the given set name, prepend map values to the corresponding bins of the record and return the modified record mapped to the document's class.- Parameters:
document- The document to get id from and to map the record to. Must not be null.setName- Set name to use.values- The Map of bin names and values to prepend. Must not be null.- Returns:
- Modified record mapped to the document's class.
-
prepend
Find an existing record matching the document's class and id, prepend specified value to the record's bin and return the modified record mapped to the document's class.- Parameters:
document- The document to get set name and id from and to map the record to. Must not be null.binName- Bin name to use prepend operation on.value- The value to prepend.- Returns:
- Modified record mapped to the document's class.
-
prepend
Find an existing record matching the document's id and the given set name, prepend specified value to the record's bin and return the modified record mapped to the document's class.- Parameters:
document- The document to get id from and to map the record to. Must not be null.setName- Set name to use.binName- Bin name to use prepend operation on.value- The value to prepend.- Returns:
- Modified record mapped to the document's class.
-
execute
Execute an operation against underlying store.- Parameters:
supplier- must not be null.- Returns:
- The resulting document.
-
findById
Find a record by id, set name will be determined by the given entityClass.The matching record will be mapped to the given entityClass.
- Parameters:
id- The id of the record to find. Must not be null.entityClass- The class to extract set name from and to map the record to. Must not be null.- Returns:
- The document mapped to entityClass's type or null if nothing is found
-
findById
Find a record by id within the given set.The matching record will be mapped to the given entityClass.
- Parameters:
id- The id of the record to find. Must not be null.entityClass- The class to map the record to and to get entity properties from (such as expiration). Must not be null.setName- Set name to find the document from.- Returns:
- The record mapped to entityClass's type or null if document does not exist
-
findById
Find a record by id, set name will be determined by the given entityClass.The matching record will be mapped to the given entityClass.
- Parameters:
id- The id of the record to find. Must not be null.entityClass- The class to extract set name from. Must not be null.targetClass- The class to map the record to. Must not be null.- Returns:
- The record mapped to targetClass's type or null if document doesn't exist.
-
findById
Find a record by id within the given set.The matching record will be mapped to the given entityClass.
- Parameters:
id- The id of the record to find. Must not be null.entityClass- The class to get entity properties from (such as expiration). Must not be null.targetClass- The class to map the record to. Must not be null.setName- Set name to find the document from.- Returns:
- The record mapped to targetClass's type or null if document doesn't exist.
-
findByIds
Find records by ids using a single batch read operation, set name will be determined by the given entityClass.The records will be mapped to the given entityClass.
- Parameters:
ids- The ids of the documents to find. Must not be null.entityClass- The class to extract set name from and to map the records to. Must not be null.- Returns:
- The matching records mapped to entityClass's type, if no document exists, an empty list is returned.
-
findByIds
Find records by ids within the given set using a single batch read operation.The records will be mapped to the given entityClass.
- Parameters:
ids- The ids of the documents to find. Must not be null.entityClass- The class to map the records to. Must not be null.setName- Set name to use.- Returns:
- The matching records mapped to entityClass's type or an empty list if nothing found.
-
findByIds
Find records by ids using a single batch read operation, set name will be determined by the given entityClass.The records will be mapped to the given targetClass.
- Parameters:
ids- The ids of the documents to find. Must not be null.entityClass- The class to extract set name from. Must not be null.targetClass- The class to map the record to. Must not be null.- Returns:
- The matching records mapped to targetClass's type or an empty list if nothing found.
-
findByIds
<T,S> List<S> findByIds(Iterable<?> ids, Class<T> entityClass, Class<S> targetClass, String setName) Find records by ids within the given set using a single batch read operation.The records will be mapped to the given targetClass.
- Parameters:
ids- The ids of the documents to find. Must not be null.entityClass- The class to get entity properties from (such as expiration). Must not be null.targetClass- The class to map the record to. Must not be null.setName- Set name to use.- Returns:
- The matching records mapped to targetClass's type or an empty list if nothing found.
-
findByIds
Execute a single batch request to find several records, possibly from different sets.Aerospike provides functionality to get records from different sets in 1 batch request. This method receives keys grouped by document type as a parameter and returns Aerospike records mapped to documents grouped by type.
- Parameters:
groupedKeys- Keys grouped by document type. Must not be null, groupedKeys.getEntitiesKeys() must not be null.- Returns:
- grouped documents.
-
findByIdUsingQuery
<T,S> Object findByIdUsingQuery(Object id, Class<T> entityClass, Class<S> targetClass, @Nullable Query query) Find a record by id using a query, set name will be determined by the given entityClass.The record will be mapped to the given targetClass.
- Parameters:
id- The id of the record to find. Must not be null.entityClass- The class to extract set name from. Must not be null.targetClass- The class to map the record to.query- TheQueryto filter results. Optional argument (null if no filtering required).- Returns:
- The matching record mapped to targetClass's type.
-
findByIdUsingQuery
<T,S> Object findByIdUsingQuery(Object id, Class<T> entityClass, Class<S> targetClass, String setName, @Nullable Query query) Find a record by id within the given set using a query.The record will be mapped to the given targetClass.
- Parameters:
id- The id of the record to find. Must not be null.entityClass- The class to get the entity properties from (such as expiration). Must not be null.targetClass- The class to map the record to.setName- Set name to use.query- TheQueryto filter results. Optional argument (null if no filtering required).- Returns:
- The matching record mapped to targetClass's type.
-
findByIdsUsingQuery
<T,S> List<?> findByIdsUsingQuery(Collection<?> ids, Class<T> entityClass, Class<S> targetClass, @Nullable Query query) Find records by ids and a query, set name will be determined by the given entityClass.The records will be mapped to the given targetClass.
- Parameters:
ids- The ids of the documents to find. Must not be null.entityClass- The class to extract set name from. Must not be null.targetClass- The class to map the record to.query- TheQueryto filter results. Optional argument (null if no filtering required).- Returns:
- The matching records mapped to targetClass's type if provided (otherwise to entityClass's type), or an empty list if no documents found.
-
findByIdsUsingQuery
<T,S> List<?> findByIdsUsingQuery(Collection<?> ids, Class<T> entityClass, Class<S> targetClass, String setName, @Nullable Query query) Find records by ids within the given set.The records will be mapped to the given targetClass.
- Parameters:
ids- The ids of the documents to find. Must not be null.entityClass- The class to get the entity properties from (such as expiration). Must not be null.targetClass- The class to map the record to.setName- Set name to use.query- TheQueryto filter results. Optional argument (null if no filtering required).- Returns:
- The matching records mapped to targetClass's type if provided (otherwise to entityClass's type), or an empty list if no documents found.
-
find
Find records in the given entityClass's set using a query and map them to the given class type.- Parameters:
query- TheQueryto filter results. Must not be null.entityClass- The class to extract set name from and to map the records to. Must not be null.- Returns:
- A Stream of matching records mapped to entityClass type.
-
find
Find records in the given entityClass's set using a query and map them to the given target class type.- Parameters:
query- TheQueryto filter results. Must not be null.entityClass- The class to extract set name from. Must not be null.targetClass- The class to map the record to. Must not be null.- Returns:
- A Stream of matching records mapped to targetClass type.
-
find
Find records in the given set using a query and map them to the given target class type.- Parameters:
query- TheQueryto filter results. Must not be null.targetClass- The class to map the record to. Must not be null.setName- Set name to use.- Returns:
- A Stream of matching records mapped to targetClass type.
-
findAll
Find all records in the given entityClass's set and map them to the given class type.- Parameters:
entityClass- The class to extract set name from and to map the records to. Must not be null.- Returns:
- A Stream of matching records mapped to entityClass type.
-
findAll
Find all records in the given entityClass's set and map them to the given target class type.- Parameters:
entityClass- The class to extract set name from. Must not be null.targetClass- The class to map the record to. Must not be null.- Returns:
- A Stream of matching records mapped to targetClass type.
-
findAll
Find all records in the given set and map them to the given class type.- Parameters:
targetClass- The class to map the records to. Must not be null.setName- Set name to use.- Returns:
- A Stream of matching records mapped to entityClass type.
-
findAll
Find all records in the given entityClass's set using a provided sort and map them to the given class type.- Parameters:
sort- The sort to affect the returned iterable documents order.offset- The offset to start the range from.limit- The limit of the range.entityClass- The class to extract set name from and to map the records to.- Returns:
- A Stream of matching records mapped to entityClass type.
-
findAll
<T,S> Stream<S> findAll(Sort sort, long offset, long limit, Class<T> entityClass, Class<S> targetClass) Find all records in the given entityClass's set using a provided sort and map them to the given target class type.- Parameters:
sort- The sort to affect the returned iterable documents order.offset- The offset to start the range from.limit- The limit of the range.entityClass- The class to extract set name from.targetClass- The class to map the record to. Must not be null.- Returns:
- A Stream of matching records mapped to targetClass type.
-
findAll
Find all records in the given set using a provided sort and map them to the given target class type.- Parameters:
sort- The sort to affect the returned iterable documents order.offset- The offset to start the range from.limit- The limit of the range.targetClass- The class to map the record to. Must not be null.setName- Set name to use.- Returns:
- A Stream of matching records mapped to targetClass type.
-
findInRange
Find records in the given entityClass's set using a range (offset, limit) and a sort and map them to the given class type.- Parameters:
offset- The offset to start the range from.limit- The limit of the range.sort- The sort to affect the order of the returned Stream of documents.entityClass- The class to extract set name from and to map the records to. Must not be null.- Returns:
- A Stream of matching records mapped to entityClass type.
-
findInRange
<T,S> Stream<S> findInRange(long offset, long limit, Sort sort, Class<T> entityClass, Class<S> targetClass) Find records in the given entityClass's set using a range (offset, limit) and a sort and map them to the given target class type.- Parameters:
offset- The offset to start the range from.limit- The limit of the range.sort- The sort to affect the returned Stream of documents order.entityClass- The class to extract set name from. Must not be null.targetClass- The class to map the record to. Must not be null.- Returns:
- A Stream of matching records mapped to targetClass type.
-
findInRange
Find records in the given set using a range (offset, limit) and a sort and map them to the given target class type.- Parameters:
offset- The offset to start the range from.limit- The limit of the range.sort- The sort to affect the returned Stream of documents order.targetClass- The class to map the record to. Must not be null.setName- Set name to use.- Returns:
- A Stream of matching records mapped to targetClass type.
-
findUsingQueryWithoutPostProcessing
<T,S> Stream<S> findUsingQueryWithoutPostProcessing(Class<T> entityClass, Class<S> targetClass, Query query) Find records in the given entityClass set using a query and map them to the given target class type. If the query has pagination and/or sorting, post-processing must be applied separately.- Parameters:
entityClass- The class to extract set name from. Must not be null.targetClass- The class to map the records to.query- TheQueryto filter results.- Returns:
- A Stream of all matching records (regardless of pagination/sorting) mapped to targetClass type.
-
exists
Check by id if a record exists within the set associated with the given entityClass.- Parameters:
id- The id to check for record existence. Must not be null.entityClass- The class to extract set name from. Must not be null.- Returns:
- whether the matching record exists.
-
exists
Check by id if a record exists within the given set name.- Parameters:
id- The id to check for record existence. Must not be null.setName- Set name to use.- Returns:
- whether the matching record exists.
-
existsByQuery
Check using a query if any matching records exist within the set associated with the given entityClass.- Parameters:
query- The query to check if any matching records exist. Must not be null.entityClass- The class to extract set name from. Must not be null.- Returns:
- whether any matching records exist.
-
existsByQuery
Check using a query if any matching records exist within the given set.- Parameters:
query- The query to check if any matching records exist. Must not be null.entityClass- The class to translate to returned records into. Must not be null.setName- Set name to use. Must not be null.- Returns:
- whether any matching records exist.
-
count
Return the amount of records in the set determined by the given entityClass.- Parameters:
entityClass- The class to extract set name from. Must not be null.- Returns:
- amount of records in the set of the given entityClass.
-
count
Return the amount of records in the given Aerospike set.- Parameters:
setName- The name of the set to count. Must not be null.- Returns:
- amount of records in the given set.
-
count
Return the amount of records in query results. Set name will be determined by the given entityClass.- Parameters:
query- The query that provides the result set for count.entityClass- The class to extract set name from. Must not be null.- Returns:
- amount of records matching the given query and entity class.
-
count
Return the amount of records in query results within the given set.- Parameters:
query- The query that provides the result set for count.setName- Set name to use.- Returns:
- amount of documents matching the given query and set.
-
aggregate
<T> com.aerospike.client.query.ResultSet aggregate(com.aerospike.client.query.Filter filter, Class<T> entityClass, String module, String function, List<com.aerospike.client.Value> arguments) Execute query, apply statement's aggregation function, and return result iterator.- Parameters:
filter- The filter to pass to the query.entityClass- The class to extract set name from. Must not be null.module- server package where user defined function resides.function- aggregation function name.arguments- arguments to pass to function name, if any.- Returns:
- Result iterator.
-
aggregate
com.aerospike.client.query.ResultSet aggregate(com.aerospike.client.query.Filter filter, String setName, String module, String function, List<com.aerospike.client.Value> arguments) Execute query within the given set, apply statement's aggregation function, and return result iterator.- Parameters:
filter- The filter to pass to the query.setName- Set name to use.module- server package where user defined function resides.function- aggregation function name.arguments- arguments to pass to function name, if any.- Returns:
- Result iterator.
-
createIndex
<T> void createIndex(Class<T> entityClass, String indexName, String binName, com.aerospike.client.query.IndexType indexType) Create an index with the specified name in Aerospike.- Parameters:
entityClass- The class to extract set name from. Must not be null.indexName- The index name. Must not be null.binName- The bin name to create the index on. Must not be null.indexType- The type of the index. Must not be null.
-
createIndex
<T> void createIndex(Class<T> entityClass, String indexName, String binName, com.aerospike.client.query.IndexType indexType, com.aerospike.client.query.IndexCollectionType indexCollectionType) Create an index with the specified name in Aerospike.- Parameters:
entityClass- The class to extract set name from. Must not be null.indexName- The index name. Must not be null.binName- The bin name to create the index on. Must not be null.indexType- The type of the index. Must not be null.indexCollectionType- The collection type of the index. Must not be null.
-
createIndex
<T> void createIndex(Class<T> entityClass, String indexName, String binName, com.aerospike.client.query.IndexType indexType, com.aerospike.client.query.IndexCollectionType indexCollectionType, com.aerospike.client.cdt.CTX... ctx) Create an index with the specified name in Aerospike.- Parameters:
entityClass- The class to extract set name from. Must not be null.indexName- The index name. Must not be null.binName- The bin name to create the index on. Must not be null.indexType- The type of the index. Must not be null.indexCollectionType- The collection type of the index. Must not be null.ctx- optional context to index on elements within a CDT.
-
createIndex
void createIndex(String setName, String indexName, String binName, com.aerospike.client.query.IndexType indexType) Create an index with the specified name in Aerospike.- Parameters:
setName- Set name to use.indexName- The index name. Must not be null.binName- The bin name to create the index on. Must not be null.indexType- The type of the index. Must not be null.
-
createIndex
void createIndex(String setName, String indexName, String binName, com.aerospike.client.query.IndexType indexType, com.aerospike.client.query.IndexCollectionType indexCollectionType) Create an index with the specified name in Aerospike.- Parameters:
setName- Set name to use.indexName- The index name. Must not be null.binName- The bin name to create the index on. Must not be null.indexType- The type of the index. Must not be null.indexCollectionType- The collection type of the index. Must not be null.
-
createIndex
void createIndex(String setName, String indexName, String binName, com.aerospike.client.query.IndexType indexType, com.aerospike.client.query.IndexCollectionType indexCollectionType, com.aerospike.client.cdt.CTX... ctx) Create an index with the specified name in Aerospike.- Parameters:
setName- Set name to use.indexName- The index name. Must not be null.binName- The bin name to create the index on. Must not be null.indexType- The type of the index. Must not be null.indexCollectionType- The collection type of the index. Must not be null.ctx- optional context to index on elements within a CDT.
-
deleteIndex
Delete an index with the specified name in Aerospike.- Parameters:
entityClass- The class to extract set name from. Must not be null.indexName- The index name. Must not be null.
-
deleteIndex
Delete an index with the specified name within the given set in Aerospike.- Parameters:
setName- Set name to use.indexName- The index name. Must not be null.
-
indexExists
Check whether an index with the specified name exists in Aerospike.- Parameters:
indexName- The Aerospike index name. Must not be null.- Returns:
- true if exists
-
deleteAll(Class)instead.