Skip to content

Commit

Permalink
remove deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
agrgr committed Nov 28, 2024
1 parent 855134c commit c746f9b
Show file tree
Hide file tree
Showing 23 changed files with 15 additions and 678 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -366,24 +366,6 @@ public interface AerospikeOperations {
*/
<T> void updateAll(Iterable<T> documents, String setName);

/**
* Truncate/Delete all records in the set determined by the given entityClass.
*
* @param entityClass The class to extract set name from. Must not be {@literal null}.
* @deprecated since 4.6.0, use {@link AerospikeOperations#deleteAll(Class)} instead.
*/
<T> void delete(Class<T> entityClass);

/**
* Delete a record by id, set name will be determined by the given entityClass.
*
* @param id The id of the record to delete. Must not be {@literal null}.
* @param entityClass The class to extract set name from. Must not be {@literal null}.
* @return whether the record existed on server before deletion.
* @deprecated since 4.6.0, use {@link AerospikeOperations#deleteById(Object, Class)} instead.
*/
<T> boolean delete(Object id, Class<T> entityClass);

/**
* Delete a record using the document's id.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,28 +377,6 @@ public <T> void updateAll(Iterable<T> documents, String setName) {
applyBufferedBatchWrite(documents, setName, UPDATE_OPERATION);
}

@Deprecated(since = "4.6.0", forRemoval = true)
@Override
public <T> void delete(Class<T> entityClass) {
Assert.notNull(entityClass, "Class must not be null!");
delete(getSetName(entityClass));
}

@Deprecated(since = "4.6.0", forRemoval = true)
@Override
public <T> boolean delete(Object id, Class<T> entityClass) {
Assert.notNull(entityClass, "Class must not be null!");
Assert.notNull(id, "Id must not be null!");

try {
Key key = getKey(id, getSetName(entityClass));

return client.delete(ignoreGenerationPolicy(), key);
} catch (AerospikeException e) {
throw translateError(e);
}
}

@Override
public <T> boolean delete(T document) {
Assert.notNull(document, "Document must not be null!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,8 @@ protected void validateGroupedKeys(GroupedKeys groupedKeys) {

protected void validateForBatchWrite(Object object, String objectName) {
Assert.notNull(object, objectName + " must not be null!");
Assert.isTrue(batchWriteSupported(), "Batch write operations are supported starting with " +
"server version " + TemplateUtils.SERVER_VERSION_6);
// Assert.isTrue(batchWriteSupported(), "Batch write operations are supported starting with " +
// "server version " + TemplateUtils.SERVER_VERSION_6);
}

protected boolean batchWriteSizeMatch(int batchSize, int currentSize) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.springframework.dao.QueryTimeoutException;
import org.springframework.dao.RecoverableDataAccessException;
import org.springframework.dao.TransientDataAccessResourceException;
import org.springframework.data.aerospike.exceptions.IndexAlreadyExistsException;
import org.springframework.data.aerospike.exceptions.IndexNotFoundException;

/**
Expand Down Expand Up @@ -53,7 +52,6 @@ public DataAccessException translateExceptionIfPossible(RuntimeException cause)
case ResultCode.KEY_EXISTS_ERROR -> new DuplicateKeyException(msg, cause);
case ResultCode.KEY_NOT_FOUND_ERROR -> new DataRetrievalFailureException(msg, cause);
case ResultCode.INDEX_NOTFOUND -> new IndexNotFoundException(msg, cause);
case ResultCode.INDEX_ALREADY_EXISTS -> new IndexAlreadyExistsException(msg, cause);
case ResultCode.TIMEOUT, ResultCode.QUERY_TIMEOUT -> new QueryTimeoutException(msg, cause);
case ResultCode.DEVICE_OVERLOAD, ResultCode.NO_MORE_CONNECTIONS, ResultCode.KEY_BUSY ->
new TransientDataAccessResourceException(msg, cause);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,24 +353,6 @@ public interface ReactiveAerospikeOperations {
*/
<T> Flux<T> updateAll(Iterable<? extends T> documents, String setName);

/**
* Reactively truncate/delete all records from the set determined by the given entityClass.
*
* @param entityClass The class to extract the Aerospike set name from. Must not be {@literal null}.
* @deprecated since 4.6.0, use {@link AerospikeOperations#deleteAll(Class)} instead.
*/
<T> Mono<Void> delete(Class<T> entityClass);

/**
* Reactively delete a record by id, set name will be determined by the given entity class.
*
* @param id The id of a record to be deleted. Must not be {@literal null}.
* @param entityClass The class to extract the Aerospike set name from. Must not be {@literal null}.
* @return A Mono of whether the document existed on server before deletion.
* @deprecated since 4.6.0, use {@link AerospikeOperations#deleteById(Object, Class)} instead.
*/
<T> Mono<Boolean> delete(Object id, Class<T> entityClass);

/**
* Reactively delete a record using the document's id.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,34 +387,6 @@ public <T> Flux<T> updateAll(Iterable<? extends T> documents, String setName) {
return applyBufferedBatchWrite(documents, setName, UPDATE_OPERATION);
}

@Deprecated(since = "4.6.0", forRemoval = true)
@Override
public <T> Mono<Void> delete(Class<T> entityClass) {
Assert.notNull(entityClass, "Class must not be null!");

try {
String set = getSetName(entityClass);
return Mono.fromRunnable(
() -> reactorClient.getAerospikeClient().truncate(null, namespace, set, null));
} catch (AerospikeException e) {
throw translateError(e);
}
}

@Deprecated(since = "4.6.0", forRemoval = true)
@Override
public <T> Mono<Boolean> delete(Object id, Class<T> entityClass) {
Assert.notNull(id, "Id must not be null!");
Assert.notNull(entityClass, "Class must not be null!");

AerospikePersistentEntity<?> entity = mappingContext.getRequiredPersistentEntity(entityClass);

return reactorClient
.delete(ignoreGenerationPolicy(), getKey(id, entity))
.map(k -> true)
.onErrorMap(this::translateError);
}

@Override
public <T> Mono<Boolean> delete(T document) {
return delete(document, getSetName(document));
Expand Down Expand Up @@ -450,12 +422,12 @@ public <T> Mono<Void> delete(Query query, Class<T> entityClass, String setName)

return findQueryResults.flatMap(list -> {
if (!list.isEmpty()) {
if (serverVersionSupport.isBatchWriteSupported()) {
// if (serverVersionSupport.isBatchWriteSupported()) {
return deleteAll(list);
} else {
list.forEach(this::delete);
return Mono.empty();
}
// } else {
// list.forEach(this::delete);
// return Mono.empty();
// }
}
return Mono.empty();
}
Expand Down Expand Up @@ -484,12 +456,12 @@ public <T> Mono<Void> deleteByIdsUsingQuery(Collection<?> ids, Class<T> entityCl

return findQueryResults.flatMap(list -> {
if (!list.isEmpty()) {
if (serverVersionSupport.isBatchWriteSupported()) {
// if (serverVersionSupport.isBatchWriteSupported()) {
return deleteAll(list);
} else {
list.forEach(this::delete);
return Mono.empty();
}
// } else {
// list.forEach(this::delete);
// return Mono.empty();
// }
}
return Mono.empty();
}
Expand Down
Loading

0 comments on commit c746f9b

Please sign in to comment.