Skip to content

Commit

Permalink
add note for later
Browse files Browse the repository at this point in the history
  • Loading branch information
juliannguyen4 committed Sep 24, 2024
1 parent 4b54d6d commit ae25f79
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/include/policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 2 additions & 3 deletions src/main/client/exists.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/client/get.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/main/client/select.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/main/policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit ae25f79

Please sign in to comment.