diff --git a/src/include/policy.h b/src/include/policy.h index e9092c7cc..bf2221ebf 100644 --- a/src/include/policy.h +++ b/src/include/policy.h @@ -229,11 +229,11 @@ as_status pyobject_to_policy_query(AerospikeClient *self, as_error *err, as_policy_query *config_query_policy, as_exp *exp_list, as_exp **exp_list_p); -int initialize_as_policy_read_using_py_policy_dict(AerospikeClient *self, - as_error *err, - as_policy_read *policy, - PyObject *py_policy, - as_exp **exp_list_ref); +int initialize_as_policy_using_py_policy_dict(AerospikeClient *self, + as_error *err, void *policy, + enum as_policy_type policy_type, + PyObject *py_policy, + as_exp **exp_list_ref); as_status pyobject_to_policy_remove(AerospikeClient *self, as_error *err, PyObject *py_policy, diff --git a/src/main/client/exists.c b/src/main/client/exists.c index 30c9a5a6c..de6f021ef 100644 --- a/src/main/client/exists.c +++ b/src/main/client/exists.c @@ -77,9 +77,8 @@ extern PyObject *AerospikeClient_Exists_Invoke(AerospikeClient *self, // key is initialised successfully key_initialised = true; - // Convert python policy object to as_policy_exists - int retval = initialize_as_policy_read_using_py_policy_dict( - self, &err, &read_policy, py_policy, &exp_list); + int retval = initialize_as_policy_using_py_policy_dict( + self, &err, &read_policy, AS_POLICY_TYPE_READ, py_policy, &exp_list); if (retval != AEROSPIKE_OK) { goto CLEANUP; } diff --git a/src/main/client/get.c b/src/main/client/get.c index 591a17305..e1f68f269 100644 --- a/src/main/client/get.c +++ b/src/main/client/get.c @@ -82,7 +82,7 @@ PyObject *AerospikeClient_Get_Invoke(AerospikeClient *self, PyObject *py_key, key_initialised = true; // Convert python policy object to as_policy_exists - int retval = initialize_as_policy_read_using_py_policy_dict( + int retval = initialize_as_policy_using_py_policy_dict( self, &err, &transaction_read_policy, py_policy, &exp_list); if (retval != AEROSPIKE_OK) { goto CLEANUP; diff --git a/src/main/client/select.c b/src/main/client/select.c index a6c5dde42..fc3df214c 100644 --- a/src/main/client/select.c +++ b/src/main/client/select.c @@ -141,7 +141,7 @@ PyObject *AerospikeClient_Select_Invoke(AerospikeClient *self, PyObject *py_key, } // Convert python policy object to as_policy_exists - int retval = initialize_as_policy_read_using_py_policy_dict( + int retval = initialize_as_policy_using_py_policy_dict( self, &err, &read_policy, py_policy, &exp_list); if (retval != AEROSPIKE_OK) { goto CLEANUP; diff --git a/src/main/policy.c b/src/main/policy.c index dbbf2d0e6..b7b13ce45 100644 --- a/src/main/policy.c +++ b/src/main/policy.c @@ -841,6 +841,8 @@ int set_as_policy_fields_using_pyobject(AerospikeClient *self, as_error *err, return -1; } +// TODO: create individual functions for each policy type +// using an enum to represent types is an antipattern /** * Initializes and sets as_policy_read instance using a Python policy dictionary * Returns 0 on success. On error, return -1.