Skip to content

Commit

Permalink
wip macro
Browse files Browse the repository at this point in the history
  • Loading branch information
juliannguyen4 committed Sep 16, 2024
1 parent 4befcba commit 7a9a487
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
3 changes: 3 additions & 0 deletions src/include/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
#include <aerospike/as_operations.h>
#include "pool.h"

#define AEROSPIKE_MODULE_NAME "aerospike"
#define FULLY_QUALIFIED_TYPE_NAME(name) AEROSPIKE_MODULE_NAME "." name

// Bin names can be of type Unicode in Python
// DB supports 32767 maximum number of bins
#define MAX_UNICODE_OBJECTS 32767
Expand Down
7 changes: 3 additions & 4 deletions src/main/aerospike.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ config = {\n\
}\n\
client = aerospike.client(config)");

static PyMethodDef Aerospike_Methods[] = {
static PyMethodDef aerospike_methods[] = {

//Serialization
{"set_serializer", (PyCFunction)AerospikeClient_Set_Serializer,
Expand Down Expand Up @@ -508,7 +508,6 @@ struct module_obj_name_to_creation_method {
};

static struct module_obj_name_to_creation_method module_pyobjects[] = {
// TODO: Define macros somewhere
{"exception", AerospikeException_New},
{"predicates", AerospikePredicates_New},
{"Client", (PyObject * (*)(void)) AerospikeClient_Ready},
Expand All @@ -526,9 +525,9 @@ PyMODINIT_FUNC PyInit_aerospike(void)
// TODO: use macro for module name
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
.m_name = "aerospike",
.m_name = AEROSPIKE_MODULE_NAME,
.m_doc = "Aerospike Python Client",
.m_methods = Aerospike_Methods,
.m_methods = aerospike_methods,
};

PyObject *py_aerospike_module = PyModule_Create(&moduledef);
Expand Down
37 changes: 19 additions & 18 deletions src/main/client/type.c
Original file line number Diff line number Diff line change
Expand Up @@ -1290,24 +1290,25 @@ static void AerospikeClient_Type_Dealloc(PyObject *self)
******************************************************************************/

static PyTypeObject AerospikeClient_Type = {
PyVarObject_HEAD_INIT(NULL, 0) "aerospike.Client", // tp_name
sizeof(AerospikeClient), // tp_basicsize
0, // tp_itemsize
(destructor)AerospikeClient_Type_Dealloc, // tp_dealloc
0, // tp_print
0, // tp_getattr
0, // tp_setattr
0, // tp_compare
0, // tp_repr
0, // tp_as_number
0, // tp_as_sequence
0, // tp_as_mapping
0, // tp_hash
0, // tp_call
0, // tp_str
0, // tp_getattro
0, // tp_setattro
0, // tp_as_buffer
PyVarObject_HEAD_INIT(NULL, 0)
FULLY_QUALIFIED_TYPE_NAME("Client"), // tp_name
sizeof(AerospikeClient), // tp_basicsize
0, // tp_itemsize
(destructor)AerospikeClient_Type_Dealloc, // tp_dealloc
0, // tp_print
0, // tp_getattr
0, // tp_setattr
0, // tp_compare
0, // tp_repr
0, // tp_as_number
0, // tp_as_sequence
0, // tp_as_mapping
0, // tp_hash
0, // tp_call
0, // tp_str
0, // tp_getattro
0, // tp_setattro
0, // tp_as_buffer
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
// tp_flags
"The Client class manages the connections and trasactions against\n"
Expand Down

0 comments on commit 7a9a487

Please sign in to comment.