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

FMWK-572 Prepare 0.8.2 patch adding durableDelete for batch ClientPolicies #258

Merged
merged 2 commits into from
Oct 8, 2024
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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</modules>

<properties>
<revision>0.8.1</revision>
<revision>0.8.2</revision>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@
import com.aerospike.client.IAerospikeClient;
import com.aerospike.client.async.EventLoops;
import com.aerospike.client.async.NioEventLoops;
import com.aerospike.client.policy.BatchPolicy;
import com.aerospike.client.policy.ClientPolicy;
import com.aerospike.client.policy.Policy;
import com.aerospike.client.policy.ClientPolicy;
import com.aerospike.client.policy.QueryPolicy;
import com.aerospike.client.policy.WritePolicy;
import com.aerospike.client.policy.BatchPolicy;
import com.aerospike.client.policy.BatchDeletePolicy;
import com.aerospike.client.policy.BatchUDFPolicy;
import com.aerospike.client.policy.BatchWritePolicy;
import com.aerospike.client.reactor.AerospikeReactorClient;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
Expand Down Expand Up @@ -78,8 +81,11 @@ public ClientPolicy aerospikeClientPolicy(AerospikeProperties properties,

clientPolicy.readPolicyDefault = setupReadPolicy(properties);
clientPolicy.writePolicyDefault = setupWritePolicy(properties);
clientPolicy.batchPolicyDefault = setupBatchPolicy(properties);
clientPolicy.queryPolicyDefault = setupQueryPolicy(properties);
clientPolicy.batchPolicyDefault = setupBatchPolicy(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 @@ -141,6 +147,27 @@ private QueryPolicy setupQueryPolicy(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 void setGeneralPolicyProperties(Policy policy, AerospikeProperties.PolicyDefault policyDefault) {
whenPresent(policyDefault.socketTimeout, p -> policy.socketTimeout = (int) p.toMillis());
whenPresent(policyDefault.totalTimeout, p -> policy.totalTimeout = (int) p.toMillis());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,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 @@ -221,4 +227,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