Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
3f3d987
Only set parts_all (as_partitions_status) if it was set by the user i…
juliannguyen4 Oct 15, 2024
7924046
exp
juliannguyen4 Oct 15, 2024
5188362
fix undef behavior
juliannguyen4 Oct 15, 2024
c97ed48
Revert "exp"
juliannguyen4 Oct 15, 2024
1ee10a4
fix test
juliannguyen4 Oct 15, 2024
455be7c
fix more undef behavior
juliannguyen4 Oct 15, 2024
89a3e54
fix segf
juliannguyen4 Oct 15, 2024
6fadbda
undo
juliannguyen4 Oct 15, 2024
dac71e2
Try reserving
juliannguyen4 Oct 15, 2024
1a57da6
fix seg fault
juliannguyen4 Oct 15, 2024
7c2d18a
rm
juliannguyen4 Oct 15, 2024
a736da4
rm
juliannguyen4 Oct 15, 2024
4a97db0
rm
juliannguyen4 Oct 16, 2024
f1becc8
wip
juliannguyen4 Oct 16, 2024
70f22e6
add
juliannguyen4 Oct 16, 2024
377badd
proto
juliannguyen4 Oct 16, 2024
e395027
whoop
juliannguyen4 Oct 16, 2024
302a6cc
fix
juliannguyen4 Oct 16, 2024
e7ccb58
rm:
juliannguyen4 Oct 16, 2024
ee53645
fix
juliannguyen4 Oct 16, 2024
316cdbb
add
juliannguyen4 Oct 16, 2024
7a0cc28
add missing obj file
juliannguyen4 Oct 16, 2024
0c96bd0
mv
juliannguyen4 Oct 16, 2024
695479f
dont make static
juliannguyen4 Oct 16, 2024
6f784cc
typecast
juliannguyen4 Oct 16, 2024
4a9ee0c
next pass
juliannguyen4 Oct 17, 2024
129193f
typecast
juliannguyen4 Oct 17, 2024
9b01a33
fix
juliannguyen4 Oct 17, 2024
d7ffa71
or
juliannguyen4 Oct 17, 2024
9548878
fix
juliannguyen4 Oct 17, 2024
97f2881
oops
juliannguyen4 Oct 17, 2024
2646d9b
fix
juliannguyen4 Oct 17, 2024
5991a9b
dont free twice
juliannguyen4 Oct 17, 2024
d183c3e
Fix tests
juliannguyen4 Oct 18, 2024
4693707
not finished
juliannguyen4 Oct 21, 2024
6eb78dc
finish
juliannguyen4 Oct 21, 2024
c315606
fix
juliannguyen4 Oct 21, 2024
bf3e591
f
juliannguyen4 Oct 21, 2024
0c4a93e
Merge remote-tracking branch 'origin/dev' into CLIENT-2417-rm-parts-s…
juliannguyen4 Oct 21, 2024
d76401e
try to improve names
juliannguyen4 Oct 22, 2024
700823e
fix most tests failing
juliannguyen4 Oct 24, 2024
2e86b33
prob need to paginate
juliannguyen4 Oct 24, 2024
277604e
fix
juliannguyen4 Oct 24, 2024
f57571d
Merge remote-tracking branch 'origin/dev' into CLIENT-2417-rm-parts-s…
juliannguyen4 Nov 14, 2024
316435c
implement get item for one attr
juliannguyen4 Nov 14, 2024
43677d7
stub
juliannguyen4 Nov 14, 2024
b18908c
fix:
juliannguyen4 Nov 14, 2024
ff106ff
wip not done
juliannguyen4 Nov 14, 2024
1bd2b05
wip
juliannguyen4 Nov 14, 2024
f4e61d5
Add intermediate PartitionStatus class
juliannguyen4 Nov 14, 2024
e1faf7d
Check if this works
juliannguyen4 Nov 14, 2024
aa3c40a
try
juliannguyen4 Nov 15, 2024
d2507d6
this method doesnt need to be exposed
juliannguyen4 Nov 15, 2024
7978ebd
Fix
juliannguyen4 Nov 15, 2024
261db52
rm
juliannguyen4 Nov 15, 2024
4cc805d
allow getting by index
juliannguyen4 Nov 15, 2024
9badaa1
bad cast
juliannguyen4 Nov 15, 2024
949f6a6
try creating copy of partition status in case partitionsstatus object…
juliannguyen4 Nov 15, 2024
b1ce2ba
fix
juliannguyen4 Nov 15, 2024
1d7d2ac
addressing
juliannguyen4 Nov 18, 2024
766c653
Merge remote-tracking branch 'origin/dev' into CLIENT-2417-rm-parts-s…
juliannguyen4 Nov 20, 2024
6f7c82c
fix stubs
juliannguyen4 Nov 20, 2024
577269f
cleanup
juliannguyen4 Nov 20, 2024
23f81a8
Add input validation for partition idx
juliannguyen4 Nov 20, 2024
5a764bb
Finish PartitionsStatus.__getitem__
juliannguyen4 Nov 20, 2024
f480deb
Just return a tuple for as_partition_status
juliannguyen4 Nov 20, 2024
38d99d1
Merge remote-tracking branch 'origin/dev' into CLIENT-2417-rm-parts-s…
juliannguyen4 Dec 4, 2024
72ab4c4
Merge remote-tracking branch 'origin/dev' into CLIENT-2417-rm-parts-s…
juliannguyen4 Jun 4, 2025
a7cbc9c
Merge remote-tracking branch 'origin/dev' into CLIENT-2417-rm-parts-s…
juliannguyen4 Jun 5, 2025
3f399ec
Revert "Just return a tuple for as_partition_status"
juliannguyen4 Jun 5, 2025
fb55fb5
use fixed test from CLIENT-3161 branch
juliannguyen4 Jun 5, 2025
2eb9d2b
fix
juliannguyen4 Jun 5, 2025
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
8 changes: 7 additions & 1 deletion aerospike-stubs/aerospike.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Callable, Union, final, Literal, Optional, Final
from typing import Any, Callable, Union, final, Literal, Optional

from aerospike_helpers.batch.records import BatchRecords
from aerospike_helpers.metrics import MetricsPolicy
Expand Down Expand Up @@ -463,3 +463,9 @@ def set_log_handler(callback: Callable = ...) -> None: ...
def set_log_level(log_level: int) -> None: ...
def set_serializer(callback: Callable) -> None: ...
def unset_serializers() -> None: ...

class PartitionStatus:
def __getitem__(self, attr): ...

class PartitionsStatus:
def __getitem__(self, attr): ...
7 changes: 1 addition & 6 deletions src/include/conversions.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,11 @@ as_status convert_exp_list(AerospikeClient *self, PyObject *py_exp_list,
as_status convert_partition_filter(AerospikeClient *self,
PyObject *py_partition_filter,
as_partition_filter *partition_filter,
as_partitions_status **ps, as_error *err);
as_error *err);

as_status get_int_from_py_int(as_error *err, PyObject *py_long,
int *int_pointer, const char *py_object_name);

as_status
as_partitions_status_to_pyobject(as_error *err,
const as_partitions_status *parts_status,
PyObject **py_dict);

as_status as_partition_status_to_pyobject(
as_error *err, const as_partition_status *part_status, PyObject **py_tuple);

Expand Down
11 changes: 11 additions & 0 deletions src/include/partitions_status.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <Python.h>

#include <aerospike/as_partition_filter.h>

PyTypeObject *AerospikePartitionsStatusObject_Ready();
PyTypeObject *AerospikePartitionStatusObject_Ready();

PyObject *create_py_partitions_status_object(as_error *err,
as_partitions_status *parts_all);

extern PyTypeObject AerospikePartitionsStatusObject_Type;
8 changes: 8 additions & 0 deletions src/include/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ typedef struct {
PyDictObject dict;
} AerospikeKeyOrderedDict;

typedef struct {
PyObject_HEAD as_partitions_status *parts_all;
} AerospikePartitionsStatusObject;

typedef struct {
PyObject_HEAD as_partition_status *part_status;
} AerospikePartitionStatusObject;

typedef struct {
PyObject_HEAD
/* Type-specific fields go here. */
Expand Down
3 changes: 3 additions & 0 deletions src/main/aerospike.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "module_functions.h"
#include "nullobject.h"
#include "cdt_types.h"
#include "partitions_status.h"
#include "transaction.h"
#include "config_provider.h"

Expand Down Expand Up @@ -556,6 +557,8 @@ static struct type_name_to_creation_method py_module_types[] = {
{"null", AerospikeNullObject_Ready},
{"CDTWildcard", AerospikeWildcardObject_Ready},
{"CDTInfinite", AerospikeInfiniteObject_Ready},
{"PartitionsStatus", AerospikePartitionsStatusObject_Ready},
{"PartitionStatus", AerospikePartitionStatusObject_Ready},
{"Transaction", AerospikeTransaction_Ready},
{"ConfigProvider", AerospikeConfigProvider_Ready},
};
Expand Down
59 changes: 0 additions & 59 deletions src/main/conversions.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,65 +356,6 @@ as_status as_partition_status_to_pyobject(
return err->code;
}

// creates a python dict of tuples from an as_partitions_status
// EX: {id:(id, init, done, digest, bval) for id in range (1000, 1004,1)}
// returns and empty dict if parts_status == NULL
as_status as_partitions_status_to_pyobject(
as_error *err, const as_partitions_status *parts_status, PyObject **py_dict)
{
as_error_reset(err);

PyObject *new_dict = PyDict_New();
if (new_dict == NULL) {
as_error_update(err, AEROSPIKE_ERR_CLIENT, "failed to create new_dict");
goto END;
}

if (parts_status == NULL) {
// If parts_status is NULL return an empty dict because
// the query/scan is not tracking its partitions.
*py_dict = new_dict;
goto END;
}

PyObject *py_done = PyBool_FromLong(parts_status->done);
PyDict_SetItemString(new_dict, PARTITIONS_STATUS_KEY_DONE, py_done);
Py_DECREF(py_done);

PyObject *py_retry = PyBool_FromLong(parts_status->retry);
PyDict_SetItemString(new_dict, PARTITIONS_STATUS_KEY_RETRY, py_retry);
Py_DECREF(py_retry);

for (int i = 0; i < parts_status->part_count; ++i) {

const as_partition_status *part = &parts_status->parts[i];

PyObject *new_py_tuple = NULL;
if (as_partition_status_to_pyobject(err, part, &new_py_tuple) !=
AEROSPIKE_OK) {
Py_DECREF(new_dict);
goto END;
}

PyObject *py_id = PyLong_FromUnsignedLong((unsigned long)part->part_id);

if (PyDict_SetItem(new_dict, py_id, new_py_tuple) != 0) {
as_error_update(err, AEROSPIKE_ERR_CLIENT,
"failed set item in new_dict");
Py_DECREF(new_dict);
Py_DECREF(new_py_tuple);
Py_XDECREF(py_id);
goto END;
}
Py_DECREF(py_id);
}

*py_dict = new_dict;

END:
return err->code;
}

as_status as_user_info_to_pyobject(as_error *err, as_user *user,
PyObject **py_as_user)
{
Expand Down
Loading
Loading