Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to configure durableDelete property for Batch Client Policies #256

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ public ClientPolicy aerospikeClientPolicy(AerospikeProperties properties,
clientPolicy.writePolicyDefault = setupWritePolicy(properties);
clientPolicy.batchPolicyDefault = setupBatchPolicy(properties);
clientPolicy.queryPolicyDefault = setupQueryPolicy(properties);
clientPolicy.batchWritePolicyDefault = setupBatchWritePolicy(properties);
clientPolicy.batchDeletePolicyDefault = setupBatchDeletePolicy(properties);
clientPolicy.batchUDFPolicyDefault = setupBatchUDFPolicy(properties);
aerospikeEventLoops.ifPresent(loops -> clientPolicy.eventLoops = loops);

return clientPolicy;
Expand Down Expand Up @@ -142,6 +145,27 @@ private BatchPolicy setupBatchPolicy(AerospikeProperties properties) {
return policy;
}

private BatchWritePolicy setupBatchWritePolicy(AerospikeProperties properties) {
AerospikeProperties.BatchWritePolicyDefault batchWritePolicyDefault = properties.getBatchWrite();
BatchWritePolicy policy = new BatchWritePolicy();
whenPresent(batchWritePolicyDefault.durableDelete, p -> policy.durableDelete = p);
return policy;
}

private BatchDeletePolicy setupBatchDeletePolicy(AerospikeProperties properties) {
AerospikeProperties.BatchDeletePolicyDefault batchDeletePolicyDefault = properties.getBatchDelete();
BatchDeletePolicy policy = new BatchDeletePolicy();
whenPresent(batchDeletePolicyDefault.durableDelete, p -> policy.durableDelete = p);
return policy;
}

private BatchUDFPolicy setupBatchUDFPolicy(AerospikeProperties properties) {
AerospikeProperties.BatchUDFPolicyDefault batchUDFPolicyDefault = properties.getBatchUdf();
BatchUDFPolicy policy = new BatchUDFPolicy();
whenPresent(batchUDFPolicyDefault.durableDelete, p -> policy.durableDelete = p);
return policy;
}

private QueryPolicy setupQueryPolicy(AerospikeProperties properties) {
AerospikeProperties.QueryPolicyDefault queryPolicyDefault = properties.getQuery();
QueryPolicy policy = new QueryPolicy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ public class AerospikeProperties {

private BatchPolicyDefault batch = new BatchPolicyDefault();

private BatchWritePolicyDefault batchWrite = new BatchWritePolicyDefault();

private BatchDeletePolicyDefault batchDelete = new BatchDeletePolicyDefault();

private BatchUDFPolicyDefault batchUdf = new BatchUDFPolicyDefault();

private QueryPolicyDefault query = new QueryPolicyDefault();

/**
Expand Down Expand Up @@ -232,4 +238,40 @@ public static class BatchPolicyDefault extends PolicyDefault {
*/
public Boolean sendSetName;
}

/**
* For more details on each option see corresponding field documentation in {@link com.aerospike.client.policy.BatchWritePolicy}.
*/
@Data
public static class BatchWritePolicyDefault extends PolicyDefault {

/**
* If the transaction results in a record deletion, leave a tombstone for the record.
*/
public Boolean durableDelete;
}

/**
* For more details on each option see corresponding field documentation in {@link com.aerospike.client.policy.BatchDeletePolicy}.
*/
@Data
public static class BatchDeletePolicyDefault extends PolicyDefault {

/**
* If the transaction results in a record deletion, leave a tombstone for the record.
*/
public Boolean durableDelete;
}

/**
* For more details on each option see corresponding field documentation in {@link com.aerospike.client.policy.BatchUDFPolicy}.
*/
@Data
public static class BatchUDFPolicyDefault extends PolicyDefault {

/**
* If the transaction results in a record deletion, leave a tombstone for the record.
*/
public Boolean durableDelete;
}
}
Loading