sop4py 2.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,120 @@
1
+ /* Code generated by cmd/cgo; DO NOT EDIT. */
2
+
3
+ /* package command-line-arguments */
4
+
5
+
6
+ #line 1 "cgo-builtin-export-prolog"
7
+
8
+ #include <stddef.h>
9
+
10
+ #ifndef GO_CGO_EXPORT_PROLOGUE_H
11
+ #define GO_CGO_EXPORT_PROLOGUE_H
12
+
13
+ #ifndef GO_CGO_GOSTRING_TYPEDEF
14
+ typedef struct { const char *p; ptrdiff_t n; } _GoString_;
15
+ #endif
16
+
17
+ #endif
18
+
19
+ /* Start of preamble from import "C" comments. */
20
+
21
+
22
+
23
+ #line 3 "jsondb_main.go"
24
+
25
+ #include <stdio.h> // C.longlong
26
+ #include <stdlib.h> // For free
27
+
28
+ #line 1 "cgo-generated-wrapper"
29
+
30
+ #line 3 "jsondb_manage_btree.go"
31
+
32
+ #include <stdlib.h> // For free
33
+
34
+ #line 1 "cgo-generated-wrapper"
35
+
36
+
37
+ /* End of preamble from import "C" comments. */
38
+
39
+
40
+ /* Start of boilerplate cgo prologue. */
41
+ #line 1 "cgo-gcc-export-header-prolog"
42
+
43
+ #ifndef GO_CGO_PROLOGUE_H
44
+ #define GO_CGO_PROLOGUE_H
45
+
46
+ typedef signed char GoInt8;
47
+ typedef unsigned char GoUint8;
48
+ typedef short GoInt16;
49
+ typedef unsigned short GoUint16;
50
+ typedef int GoInt32;
51
+ typedef unsigned int GoUint32;
52
+ typedef long long GoInt64;
53
+ typedef unsigned long long GoUint64;
54
+ typedef GoInt64 GoInt;
55
+ typedef GoUint64 GoUint;
56
+ typedef size_t GoUintptr;
57
+ typedef float GoFloat32;
58
+ typedef double GoFloat64;
59
+ #ifdef _MSC_VER
60
+ #include <complex.h>
61
+ typedef _Fcomplex GoComplex64;
62
+ typedef _Dcomplex GoComplex128;
63
+ #else
64
+ typedef float _Complex GoComplex64;
65
+ typedef double _Complex GoComplex128;
66
+ #endif
67
+
68
+ /*
69
+ static assertion to make sure the file is being used on architecture
70
+ at least with matching size of GoInt.
71
+ */
72
+ typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
73
+
74
+ #ifndef GO_CGO_GOSTRING_TYPEDEF
75
+ typedef _GoString_ GoString;
76
+ #endif
77
+ typedef void *GoMap;
78
+ typedef void *GoChan;
79
+ typedef struct { void *t; void *v; } GoInterface;
80
+ typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
81
+
82
+ #endif
83
+
84
+ /* End of boilerplate cgo prologue. */
85
+
86
+ #ifdef __cplusplus
87
+ extern "C" {
88
+ #endif
89
+
90
+ extern char* navigateBtree(long long ctxID, int action, char* payload, char* payload2);
91
+ extern char* isUniqueBtree(char* payload);
92
+
93
+ /* Return type for getFromBtree */
94
+ struct getFromBtree_return {
95
+ char* r0;
96
+ char* r1;
97
+ };
98
+ extern struct getFromBtree_return getFromBtree(long long ctxID, int action, char* payload, char* payload2);
99
+
100
+ /* Return type for getBtreeItemCount */
101
+ struct getBtreeItemCount_return {
102
+ long long r0;
103
+ char* r1;
104
+ };
105
+ extern struct getBtreeItemCount_return getBtreeItemCount(char* payload);
106
+ extern long long createContext();
107
+ extern void cancelContext(long long ctxID);
108
+ extern void removeContext(long long ctxID);
109
+
110
+ // Redis global connection management related.
111
+ //
112
+ extern char* openRedisConnection(char* host, int port, char* password);
113
+ extern char* closeRedisConnection();
114
+ extern char* manageTransaction(long long ctxID, int action, char* payload);
115
+ extern void freeString(char* cString);
116
+ extern char* manageBtree(long long ctxID, int action, char* payload, char* payload2);
117
+
118
+ #ifdef __cplusplus
119
+ }
120
+ #endif
@@ -0,0 +1,120 @@
1
+ /* Code generated by cmd/cgo; DO NOT EDIT. */
2
+
3
+ /* package command-line-arguments */
4
+
5
+
6
+ #line 1 "cgo-builtin-export-prolog"
7
+
8
+ #include <stddef.h>
9
+
10
+ #ifndef GO_CGO_EXPORT_PROLOGUE_H
11
+ #define GO_CGO_EXPORT_PROLOGUE_H
12
+
13
+ #ifndef GO_CGO_GOSTRING_TYPEDEF
14
+ typedef struct { const char *p; ptrdiff_t n; } _GoString_;
15
+ #endif
16
+
17
+ #endif
18
+
19
+ /* Start of preamble from import "C" comments. */
20
+
21
+
22
+
23
+ #line 3 "jsondb_main.go"
24
+
25
+ #include <stdio.h> // C.longlong
26
+ #include <stdlib.h> // For free
27
+
28
+ #line 1 "cgo-generated-wrapper"
29
+
30
+ #line 3 "jsondb_manage_btree.go"
31
+
32
+ #include <stdlib.h> // For free
33
+
34
+ #line 1 "cgo-generated-wrapper"
35
+
36
+
37
+ /* End of preamble from import "C" comments. */
38
+
39
+
40
+ /* Start of boilerplate cgo prologue. */
41
+ #line 1 "cgo-gcc-export-header-prolog"
42
+
43
+ #ifndef GO_CGO_PROLOGUE_H
44
+ #define GO_CGO_PROLOGUE_H
45
+
46
+ typedef signed char GoInt8;
47
+ typedef unsigned char GoUint8;
48
+ typedef short GoInt16;
49
+ typedef unsigned short GoUint16;
50
+ typedef int GoInt32;
51
+ typedef unsigned int GoUint32;
52
+ typedef long long GoInt64;
53
+ typedef unsigned long long GoUint64;
54
+ typedef GoInt64 GoInt;
55
+ typedef GoUint64 GoUint;
56
+ typedef size_t GoUintptr;
57
+ typedef float GoFloat32;
58
+ typedef double GoFloat64;
59
+ #ifdef _MSC_VER
60
+ #include <complex.h>
61
+ typedef _Fcomplex GoComplex64;
62
+ typedef _Dcomplex GoComplex128;
63
+ #else
64
+ typedef float _Complex GoComplex64;
65
+ typedef double _Complex GoComplex128;
66
+ #endif
67
+
68
+ /*
69
+ static assertion to make sure the file is being used on architecture
70
+ at least with matching size of GoInt.
71
+ */
72
+ typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
73
+
74
+ #ifndef GO_CGO_GOSTRING_TYPEDEF
75
+ typedef _GoString_ GoString;
76
+ #endif
77
+ typedef void *GoMap;
78
+ typedef void *GoChan;
79
+ typedef struct { void *t; void *v; } GoInterface;
80
+ typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
81
+
82
+ #endif
83
+
84
+ /* End of boilerplate cgo prologue. */
85
+
86
+ #ifdef __cplusplus
87
+ extern "C" {
88
+ #endif
89
+
90
+ extern char* navigateBtree(long long ctxID, int action, char* payload, char* payload2);
91
+ extern char* isUniqueBtree(char* payload);
92
+
93
+ /* Return type for getFromBtree */
94
+ struct getFromBtree_return {
95
+ char* r0;
96
+ char* r1;
97
+ };
98
+ extern struct getFromBtree_return getFromBtree(long long ctxID, int action, char* payload, char* payload2);
99
+
100
+ /* Return type for getBtreeItemCount */
101
+ struct getBtreeItemCount_return {
102
+ long long r0;
103
+ char* r1;
104
+ };
105
+ extern struct getBtreeItemCount_return getBtreeItemCount(char* payload);
106
+ extern long long createContext();
107
+ extern void cancelContext(long long ctxID);
108
+ extern void removeContext(long long ctxID);
109
+
110
+ // Redis global connection management related.
111
+ //
112
+ extern char* openRedisConnection(char* host, int port, char* password);
113
+ extern char* closeRedisConnection();
114
+ extern char* manageTransaction(long long ctxID, int action, char* payload);
115
+ extern void freeString(char* cString);
116
+ extern char* manageBtree(long long ctxID, int action, char* payload, char* payload2);
117
+
118
+ #ifdef __cplusplus
119
+ }
120
+ #endif
Binary file
sop/redis.py ADDED
@@ -0,0 +1,40 @@
1
+ import ctypes
2
+ import call_go
3
+
4
+
5
+ class RedisOptions:
6
+ """
7
+ Redis connection (pool) options to be sent to SOP.
8
+ """
9
+
10
+ def __init__(self):
11
+ self.host = "localhost"
12
+ self.port = 6379
13
+ self.password = ""
14
+
15
+
16
+ class Redis:
17
+ """Redis Python wrapper. Delegates API calls to the SOP library that does Direct IO to disk drives w/ built-in L1/L2 caching."""
18
+
19
+ def open_connection(options: RedisOptions):
20
+ """
21
+ Open the global Redis connection.
22
+ """
23
+ print("inside OpenRedisConnection")
24
+ errMsg = call_go.open_redis_connection(
25
+ options.host, options.port, options.password
26
+ )
27
+ if errMsg == None:
28
+ print("Redis connection was successfully opened")
29
+ else:
30
+ raise Exception(f"Redis connection failed to open, details: {errMsg}")
31
+
32
+ def close_connection():
33
+ """
34
+ Close the global Redis connection.
35
+ """
36
+ errMsg = call_go.close_redis_connection()
37
+ if errMsg == None:
38
+ print("Redis connection was successfully closed")
39
+ else:
40
+ raise Exception(f"Redis connection failed to close, details: {errMsg}")