sop4py 2.0.0__tar.gz
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.
Potentially problematic release.
This version of sop4py might be problematic. Click here for more details.
- sop4py-2.0.0/MANIFEST.in +10 -0
- sop4py-2.0.0/PKG-INFO +124 -0
- sop4py-2.0.0/README.md +103 -0
- sop4py-2.0.0/pyproject.toml +37 -0
- sop4py-2.0.0/setup.cfg +4 -0
- sop4py-2.0.0/sop/__init__.py +3 -0
- sop4py-2.0.0/sop/btree.py +612 -0
- sop4py-2.0.0/sop/call_go.py +304 -0
- sop4py-2.0.0/sop/context.py +33 -0
- sop4py-2.0.0/sop/libjsondb_amd64darwin.dylib +0 -0
- sop4py-2.0.0/sop/libjsondb_amd64darwin.h +120 -0
- sop4py-2.0.0/sop/libjsondb_amd64linux.h +120 -0
- sop4py-2.0.0/sop/libjsondb_amd64linux.so +0 -0
- sop4py-2.0.0/sop/libjsondb_amd64windows.dll +0 -0
- sop4py-2.0.0/sop/libjsondb_amd64windows.h +120 -0
- sop4py-2.0.0/sop/libjsondb_arm64darwin.dylib +0 -0
- sop4py-2.0.0/sop/libjsondb_arm64darwin.h +120 -0
- sop4py-2.0.0/sop/libjsondb_arm64linux.h +120 -0
- sop4py-2.0.0/sop/libjsondb_arm64linux.so +0 -0
- sop4py-2.0.0/sop/redis.py +40 -0
- sop4py-2.0.0/sop/test_btree.py +479 -0
- sop4py-2.0.0/sop/test_btree_idx.py +86 -0
- sop4py-2.0.0/sop/transaction.py +167 -0
- sop4py-2.0.0/sop4py.egg-info/PKG-INFO +124 -0
- sop4py-2.0.0/sop4py.egg-info/SOURCES.txt +26 -0
- sop4py-2.0.0/sop4py.egg-info/dependency_links.txt +1 -0
- sop4py-2.0.0/sop4py.egg-info/requires.txt +10 -0
- sop4py-2.0.0/sop4py.egg-info/top_level.txt +1 -0
sop4py-2.0.0/MANIFEST.in
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
include sop/libjsondb_amd64darwin.dylib
|
|
2
|
+
include sop/libjsondb_amd64darwin.h
|
|
3
|
+
include sop/libjsondb_arm64darwin.dylib
|
|
4
|
+
include sop/libjsondb_arm64darwin.h
|
|
5
|
+
include sop/libjsondb_amd64linux.so
|
|
6
|
+
include sop/libjsondb_amd64linux.h
|
|
7
|
+
include sop/libjsondb_arm64linux.so
|
|
8
|
+
include sop/libjsondb_arm64linux.h
|
|
9
|
+
include sop/libjsondb_amd64windows.dll
|
|
10
|
+
include sop/libjsondb_amd64windows.h
|
sop4py-2.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sop4py
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Scalable Objects Persistence for Python.
|
|
5
|
+
Author-email: Gerardo Recinto <gerardorecinto@yahoo.com>
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.7
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: libjsondb_amd64darwin.dylib
|
|
12
|
+
Requires-Dist: libjsondb_amd64darwin.h
|
|
13
|
+
Requires-Dist: libjsondb_arm64darwin.dylib
|
|
14
|
+
Requires-Dist: libjsondb_arm64darwin.h
|
|
15
|
+
Requires-Dist: libjsondb_amd64linux.so
|
|
16
|
+
Requires-Dist: libjsondb_amd64linux.h
|
|
17
|
+
Requires-Dist: libjsondb_arm64linux.so
|
|
18
|
+
Requires-Dist: libjsondb_arm64linux.h
|
|
19
|
+
Requires-Dist: libjsondb_amd64windows.dll
|
|
20
|
+
Requires-Dist: libjsondb_amd64windows.h
|
|
21
|
+
|
|
22
|
+
# What is SOP?
|
|
23
|
+
|
|
24
|
+
Scalable Objects Persistence (SOP) is a raw storage engine that bakes together a set of storage related features & algorithms in order to provide the most efficient & reliable (ACID attributes of transactions) technique (known) of storage management and rich search, as it brings to the application, the raw muscle of "raw storage", direct IO communications w/ disk drives. In a code library form factor.
|
|
25
|
+
|
|
26
|
+
# SOP supported Hardware/OS
|
|
27
|
+
SOP supports popular architectures & Operating Systems such as Linux, Darwin & Microsoft Windows, in both ARM64 & AMD64 architectures. For Windows, only AMD64 is supported since it is the only architecture Windows is available in.
|
|
28
|
+
|
|
29
|
+
# SOP Dependencies
|
|
30
|
+
* Redis, you will need to have one of the recent or latest version of Redis for use in SOP caching.
|
|
31
|
+
* More than one Disk Drives(recommended is around four or more, for replication) with plenty of drive space available, for storage management. Example:
|
|
32
|
+
```
|
|
33
|
+
/disk1
|
|
34
|
+
/disk2
|
|
35
|
+
/disk3
|
|
36
|
+
/disk4
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
# SOP for Python package
|
|
40
|
+
Following steps outlines how to use the Scalable Objects Persistence code library for Python:
|
|
41
|
+
* Install the package using: pip install sop-python-beta-3
|
|
42
|
+
* Follow standard Python package import and start coding to use the SOP for Python code library for data management. Import the sop package in your python code file.
|
|
43
|
+
* Specify Home base folders where Store info & Registry data files will be stored.
|
|
44
|
+
* Specify Erasure Coding (EC) configuration details which will be used by SOP's EC based replication.
|
|
45
|
+
* Create a transaction
|
|
46
|
+
* Begin a transaction
|
|
47
|
+
* Create a new B-tree, or Open an existing B-tree
|
|
48
|
+
* Manage data, do some CRUD operations
|
|
49
|
+
* Commit the transaction
|
|
50
|
+
|
|
51
|
+
Below is an example code black for illustrating the above steps. For other SOP B-tree examples, you can checkout the code in the unit tests test_btree.py & test_btree_idx.py files that comes w/ the SOP package you downloaded from pypi.
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
import sop.transaction
|
|
55
|
+
import sop.btree
|
|
56
|
+
import sop.context
|
|
57
|
+
|
|
58
|
+
stores_folders = ("/disk1", "/disk2")
|
|
59
|
+
ec = {
|
|
60
|
+
# Erasure Config default entry(key="") will allow different B-tree(tables) to share same EC structure.
|
|
61
|
+
"": transaction.ErasureCodingConfig(
|
|
62
|
+
2, # two data shards
|
|
63
|
+
2, # two parity shards
|
|
64
|
+
(
|
|
65
|
+
# 4 disk drives paths
|
|
66
|
+
"/disk1",
|
|
67
|
+
"/disk2",
|
|
68
|
+
"/disk3",
|
|
69
|
+
"/disk4",
|
|
70
|
+
),
|
|
71
|
+
# False means Auto repair of failed reads from (shards') disk drive will not get repaired.
|
|
72
|
+
False,
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
# Transaction Options (to).
|
|
77
|
+
to = transaction.TransationOptions(
|
|
78
|
+
transaction.TransactionMode.ForWriting.value,
|
|
79
|
+
# commit timeout of 5mins
|
|
80
|
+
5,
|
|
81
|
+
# Min Registry hash mod value is 250, you can specify higher value like 1000. A 250 hashmod
|
|
82
|
+
# will use 1MB sized file segments. Good for demo, but for Prod, perhaps a bigger value is better.
|
|
83
|
+
transaction.MIN_HASH_MOD_VALUE,
|
|
84
|
+
# Store info & Registry home base folders. Array of strings of two elements, one for Active & another, for passive folder.
|
|
85
|
+
stores_folders,
|
|
86
|
+
# Erasure Coding config as shown above.
|
|
87
|
+
ec,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
# Context object.
|
|
91
|
+
ctx = context.Context()
|
|
92
|
+
|
|
93
|
+
# initialize/open SOP global Redis connection
|
|
94
|
+
ro = RedisOptions()
|
|
95
|
+
Redis.open_connection(ro)
|
|
96
|
+
|
|
97
|
+
t = transaction.Transaction(ctx, to)
|
|
98
|
+
t.begin()
|
|
99
|
+
|
|
100
|
+
cache = btree.CacheConfig()
|
|
101
|
+
|
|
102
|
+
# "barstoreec" is new b-tree name, 2nd parameter set to True specifies B-tree Key field to be native data type
|
|
103
|
+
bo = btree.BtreeOptions("barstoreec", True, cache_config=cache)
|
|
104
|
+
bo.set_value_data_size(btree.ValueDataSize.Small)
|
|
105
|
+
|
|
106
|
+
# create the new "barstoreec" b-tree store.
|
|
107
|
+
b3 = btree.Btree.new(ctx, bo, t)
|
|
108
|
+
|
|
109
|
+
# Since we've specified Native data type = True in BtreeOptions, we can use "integer" values as Key.
|
|
110
|
+
l = [
|
|
111
|
+
btree.Item(1, "foo"),
|
|
112
|
+
]
|
|
113
|
+
|
|
114
|
+
# Add Item to the B-tree,
|
|
115
|
+
b3.add(ctx, l)
|
|
116
|
+
|
|
117
|
+
# Commit the transaction to finalize the new B-tree (store) change.
|
|
118
|
+
t.commit(ctx)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
# SOP in Github
|
|
122
|
+
SOP open source project (MIT license) is in github. You can checkout the "...sop/jsondb/" package which contains the Go code enabling general purpose JSON data management & the Python wrapper, coding guideline of which, was described above.
|
|
123
|
+
|
|
124
|
+
Please feel free to join the SOP project if you have the bandwidth and participate/co-own/lead! the project engineering.
|
sop4py-2.0.0/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# What is SOP?
|
|
2
|
+
|
|
3
|
+
Scalable Objects Persistence (SOP) is a raw storage engine that bakes together a set of storage related features & algorithms in order to provide the most efficient & reliable (ACID attributes of transactions) technique (known) of storage management and rich search, as it brings to the application, the raw muscle of "raw storage", direct IO communications w/ disk drives. In a code library form factor.
|
|
4
|
+
|
|
5
|
+
# SOP supported Hardware/OS
|
|
6
|
+
SOP supports popular architectures & Operating Systems such as Linux, Darwin & Microsoft Windows, in both ARM64 & AMD64 architectures. For Windows, only AMD64 is supported since it is the only architecture Windows is available in.
|
|
7
|
+
|
|
8
|
+
# SOP Dependencies
|
|
9
|
+
* Redis, you will need to have one of the recent or latest version of Redis for use in SOP caching.
|
|
10
|
+
* More than one Disk Drives(recommended is around four or more, for replication) with plenty of drive space available, for storage management. Example:
|
|
11
|
+
```
|
|
12
|
+
/disk1
|
|
13
|
+
/disk2
|
|
14
|
+
/disk3
|
|
15
|
+
/disk4
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
# SOP for Python package
|
|
19
|
+
Following steps outlines how to use the Scalable Objects Persistence code library for Python:
|
|
20
|
+
* Install the package using: pip install sop-python-beta-3
|
|
21
|
+
* Follow standard Python package import and start coding to use the SOP for Python code library for data management. Import the sop package in your python code file.
|
|
22
|
+
* Specify Home base folders where Store info & Registry data files will be stored.
|
|
23
|
+
* Specify Erasure Coding (EC) configuration details which will be used by SOP's EC based replication.
|
|
24
|
+
* Create a transaction
|
|
25
|
+
* Begin a transaction
|
|
26
|
+
* Create a new B-tree, or Open an existing B-tree
|
|
27
|
+
* Manage data, do some CRUD operations
|
|
28
|
+
* Commit the transaction
|
|
29
|
+
|
|
30
|
+
Below is an example code black for illustrating the above steps. For other SOP B-tree examples, you can checkout the code in the unit tests test_btree.py & test_btree_idx.py files that comes w/ the SOP package you downloaded from pypi.
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
import sop.transaction
|
|
34
|
+
import sop.btree
|
|
35
|
+
import sop.context
|
|
36
|
+
|
|
37
|
+
stores_folders = ("/disk1", "/disk2")
|
|
38
|
+
ec = {
|
|
39
|
+
# Erasure Config default entry(key="") will allow different B-tree(tables) to share same EC structure.
|
|
40
|
+
"": transaction.ErasureCodingConfig(
|
|
41
|
+
2, # two data shards
|
|
42
|
+
2, # two parity shards
|
|
43
|
+
(
|
|
44
|
+
# 4 disk drives paths
|
|
45
|
+
"/disk1",
|
|
46
|
+
"/disk2",
|
|
47
|
+
"/disk3",
|
|
48
|
+
"/disk4",
|
|
49
|
+
),
|
|
50
|
+
# False means Auto repair of failed reads from (shards') disk drive will not get repaired.
|
|
51
|
+
False,
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
# Transaction Options (to).
|
|
56
|
+
to = transaction.TransationOptions(
|
|
57
|
+
transaction.TransactionMode.ForWriting.value,
|
|
58
|
+
# commit timeout of 5mins
|
|
59
|
+
5,
|
|
60
|
+
# Min Registry hash mod value is 250, you can specify higher value like 1000. A 250 hashmod
|
|
61
|
+
# will use 1MB sized file segments. Good for demo, but for Prod, perhaps a bigger value is better.
|
|
62
|
+
transaction.MIN_HASH_MOD_VALUE,
|
|
63
|
+
# Store info & Registry home base folders. Array of strings of two elements, one for Active & another, for passive folder.
|
|
64
|
+
stores_folders,
|
|
65
|
+
# Erasure Coding config as shown above.
|
|
66
|
+
ec,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
# Context object.
|
|
70
|
+
ctx = context.Context()
|
|
71
|
+
|
|
72
|
+
# initialize/open SOP global Redis connection
|
|
73
|
+
ro = RedisOptions()
|
|
74
|
+
Redis.open_connection(ro)
|
|
75
|
+
|
|
76
|
+
t = transaction.Transaction(ctx, to)
|
|
77
|
+
t.begin()
|
|
78
|
+
|
|
79
|
+
cache = btree.CacheConfig()
|
|
80
|
+
|
|
81
|
+
# "barstoreec" is new b-tree name, 2nd parameter set to True specifies B-tree Key field to be native data type
|
|
82
|
+
bo = btree.BtreeOptions("barstoreec", True, cache_config=cache)
|
|
83
|
+
bo.set_value_data_size(btree.ValueDataSize.Small)
|
|
84
|
+
|
|
85
|
+
# create the new "barstoreec" b-tree store.
|
|
86
|
+
b3 = btree.Btree.new(ctx, bo, t)
|
|
87
|
+
|
|
88
|
+
# Since we've specified Native data type = True in BtreeOptions, we can use "integer" values as Key.
|
|
89
|
+
l = [
|
|
90
|
+
btree.Item(1, "foo"),
|
|
91
|
+
]
|
|
92
|
+
|
|
93
|
+
# Add Item to the B-tree,
|
|
94
|
+
b3.add(ctx, l)
|
|
95
|
+
|
|
96
|
+
# Commit the transaction to finalize the new B-tree (store) change.
|
|
97
|
+
t.commit(ctx)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
# SOP in Github
|
|
101
|
+
SOP open source project (MIT license) is in github. You can checkout the "...sop/jsondb/" package which contains the Go code enabling general purpose JSON data management & the Python wrapper, coding guideline of which, was described above.
|
|
102
|
+
|
|
103
|
+
Please feel free to join the SOP project if you have the bandwidth and participate/co-own/lead! the project engineering.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[tool.setuptools]
|
|
6
|
+
include-package-data = true
|
|
7
|
+
|
|
8
|
+
[project]
|
|
9
|
+
name = "sop4py"
|
|
10
|
+
version = "2.0.0"
|
|
11
|
+
authors = [
|
|
12
|
+
{ name="Gerardo Recinto", email="gerardorecinto@yahoo.com" },
|
|
13
|
+
]
|
|
14
|
+
description = "Scalable Objects Persistence for Python."
|
|
15
|
+
readme = "README.md"
|
|
16
|
+
requires-python = ">=3.7"
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
]
|
|
22
|
+
dependencies = [
|
|
23
|
+
"libjsondb_amd64darwin.dylib",
|
|
24
|
+
"libjsondb_amd64darwin.h",
|
|
25
|
+
"libjsondb_arm64darwin.dylib",
|
|
26
|
+
"libjsondb_arm64darwin.h",
|
|
27
|
+
"libjsondb_amd64linux.so",
|
|
28
|
+
"libjsondb_amd64linux.h",
|
|
29
|
+
"libjsondb_arm64linux.so",
|
|
30
|
+
"libjsondb_arm64linux.h",
|
|
31
|
+
"libjsondb_amd64windows.dll",
|
|
32
|
+
"libjsondb_amd64windows.h",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
# build: python3 -m build
|
|
36
|
+
# upload to pypi using twine: python3 -m twine upload dist/*
|
|
37
|
+
# project link: https://pypi.org/project/sop-python-beta-3
|
sop4py-2.0.0/setup.cfg
ADDED