Skip to content

Commit 01716ed

Browse files
committed
Merge branch 'release/v0.0.2'
2 parents 3099542 + a81fdb1 commit 01716ed

16 files changed

+285
-10
lines changed

CITATION.cff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cff-version: 1.2.0
2-
title: Rocket-Store Python
2+
title: Rocket-Store
33
message: >-
44
If you use this software, please cite it using the
55
metadata from this file.
@@ -17,4 +17,4 @@ keywords:
1717
- file
1818
- rocket
1919
license: MIT
20-
version: 0.0.1
20+
version: 0.0.2

MANIFEST.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
include LICENSE
22
include CITATION.cff
33
include README.md
4-
recursive-include utils *
5-
recursive-include *.py
4+
include *.toml
5+
recursive-include src *.py
6+
recursive-include src/Rocketstore *.py
7+
recursive-include src/Rocketstore/utils *.py

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Rocketstore is a Python library for data storage. It provides an interface for s
1010

1111
***ORIGINAL / NODE VERSION:*** https://github.com/Paragi/rocket-store/
1212

13+
You can download from PyPi repository: https://pypi.org/project/Rocket-Store/
14+
1315
---
1416

1517
# Basic terminology
@@ -173,4 +175,13 @@ Contributions are welcome. Please open an issue to discuss what you would like t
173175

174176
### Docs:
175177
* https://packaging.python.org/en/latest/tutorials/packaging-projects/
176-
* https://realpython.com/pypi-publish-python-package/
178+
* https://realpython.com/pypi-publish-python-package/
179+
180+
### Publish to Pypi
181+
182+
```shell
183+
python -m pip install build twine
184+
python3 -m build
185+
twine check dist/*
186+
twine upload dist/*
187+
```

dist/Rocket-Store-0.0.1.tar.gz

17.1 KB
Binary file not shown.
16.1 KB
Binary file not shown.
-19.2 KB
Binary file not shown.

dist/rocketstore-0.0.1.tar.gz

-17.5 KB
Binary file not shown.

pyproject.toml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
[build-system]
2-
requires = ["hatchling"]
3-
build-backend = "hatchling.build"
2+
requires = ["setuptools>=61.0.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
44

55
[project]
6-
name = "rocketstore"
7-
version = "0.0.1"
6+
name = "Rocket-Store"
7+
version = "0.0.2"
88
authors = [
99
{ name="Anton Sychev", email="anton@sychev.xyz" },
1010
]
1111
description = "Using the filesystem as a searchable database."
1212
readme = "README.md"
13+
license = { file = "LICENSE" }
14+
keywords = ["database", "store", "file", "document", "database-mangement", "record", "file-store", "store-file", "filebase"]
1315
requires-python = ">=3.8"
1416
classifiers = [
1517
"Programming Language :: Python :: 3",
1618
"License :: OSI Approved :: MIT License",
1719
"Operating System :: OS Independent",
1820
]
1921

22+
[project.optional-dependencies]
23+
build = ["build", "twine"]
24+
2025
[project.urls]
2126
Homepage = "https://github.com/klich3/rocket-store-python"
2227
Issues = "https://github.com/klich3/rocket-store-python/issues"

requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.11
3+
# by the following command:
4+
#
5+
# pip-compile pyproject.toml
6+
#

src/Rocket_Store.egg-info/PKG-INFO

Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
Metadata-Version: 2.1
2+
Name: Rocket-Store
3+
Version: 0.0.1
4+
Summary: Using the filesystem as a searchable database.
5+
Author-email: Anton Sychev <anton@sychev.xyz>
6+
License: Rocket Store
7+
8+
A very simple and yet powerful file storage.
9+
10+
Copyright (c) Paragi 2017, Simon Riget.
11+
12+
Permission is hereby granted, free of charge, to any person obtaining
13+
a copy of this software and associated documentation files (the
14+
"Software"), to deal in the Software without restriction, including
15+
without limitation the rights to use, copy, modify, merge, publish,
16+
distribute, sublicense, and/or sell copies of the Software, and to
17+
permit persons to whom the Software is furnished to do so, subject to
18+
the following conditions:
19+
20+
The above copyright notice and this permission notice shall be
21+
included in all copies or substantial portions of the Software.
22+
23+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30+
Project-URL: Homepage, https://github.com/klich3/rocket-store-python
31+
Project-URL: Issues, https://github.com/klich3/rocket-store-python/issues
32+
Keywords: database,store,file,document,database-mangement,record,file-store,store-file,filebase
33+
Classifier: Programming Language :: Python :: 3
34+
Classifier: License :: OSI Approved :: MIT License
35+
Classifier: Operating System :: OS Independent
36+
Requires-Python: >=3.8
37+
Description-Content-Type: text/markdown
38+
License-File: LICENSE
39+
Provides-Extra: build
40+
Requires-Dist: build; extra == "build"
41+
Requires-Dist: twine; extra == "build"
42+
43+
# Rocket-Store Python
44+
45+
[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)
46+
[![Issues](http://img.shields.io/github/issues/klich3/rocket-store-python.svg)]( https://github.com/klich3/rocket-store-python/issues )
47+
[![GitHub pull-requests](https://img.shields.io/github/issues-pr/paragi/rocket-store.svg)](https://github.com/klich3/rocket-store-python/pull/)
48+
49+
***Using the filesystem as a searchable database.***
50+
51+
Rocketstore is a Python library for data storage. It provides an interface for storing and retrieving data in various formats.
52+
53+
***ORIGINAL / NODE VERSION:*** https://github.com/Paragi/rocket-store/
54+
55+
You can download from PyPi repository: https://pypi.org/project/Rocket-Store/
56+
57+
---
58+
59+
# Basic terminology
60+
61+
Rocket-Store was made to replace a more complex database, in a setting that required a low footprint and high performance.
62+
63+
Rocket-Store is intended to store and retrieve records/documents, organized in collections, using a key.
64+
65+
Terms used:
66+
* __Collection__: name of a collections of records. (Like an SQL table)
67+
* __Record__: the data store. (Like an SQL row)
68+
* __Data storage area__: area/directory where collections are stored. (Like SQL data base)
69+
* __Key__: every record has exactly one unique key, which is the same as a file name (same restrictions) and the same wildcards used in searches.
70+
71+
Compare Rocket-Store, SQL and file system terms:
72+
73+
| Rocket-Store | SQL| File system |
74+
|---|---|---
75+
| __storage area__ | database | data directory root |
76+
| __collection__ | table | directory |
77+
| __key__ | key | file name |
78+
| __record__ | row | file |
79+
80+
81+
## Features
82+
83+
- Support for file locking.
84+
- Support for creating data storage directories.
85+
- Support for adding auto incrementing sequences and GUIDs to keys.
86+
87+
88+
## Usage
89+
90+
To use Rocketstore, you must first import the library:
91+
92+
```python
93+
from Rocketstore import Rocketstore, _FORMAT_JSON
94+
```
95+
96+
### Post
97+
98+
```python
99+
rs.post(collection="delete_fodders1", key="1", record={"some":"json input"}, flags=_FORMAT_JSON)
100+
# or
101+
rs.post("delete_fodders1", "1", {"some":"json input"}, _FORMAT_JSON)
102+
```
103+
104+
Stores a record in a collection identified by a unique key
105+
106+
__Collection__ name to contain the records.
107+
108+
__Key__ uniquely identifying the record
109+
110+
No path separators or wildcards etc. are allowed in collection names and keys.
111+
Illigal charakters are silently striped off.
112+
113+
__Content__ Data input to store
114+
115+
__Options__
116+
* _ADD_AUTO_INC: Add an auto incremented sequence to the beginning of the key
117+
* _ADD_GUID: Add a Globally Unique IDentifier to the key
118+
119+
__Returns__ an associative array containing the result of the operation:
120+
* count : number of records affected (1 on succes)
121+
* key: string containing the actual key used
122+
123+
124+
If the key already exists, the record will be replaced.
125+
126+
If no key is given, an auto-incremented sequence is used as key.
127+
128+
If the function fails for any reason, an error is thrown.
129+
130+
### Get
131+
132+
Find and retrieve records, in a collection.
133+
134+
```python
135+
rs.get(collection="delete_fodders1")
136+
# or
137+
rs.get("delete_fodders1")
138+
# Get wildcar
139+
rs.get("delete_*")
140+
```
141+
142+
__Collection__ to search. If no collection name is given, get will return a list of data base assets: collections and sequences etc.
143+
144+
__Key__ to search for. Can be mixed with wildcards '\*' and '?'. An undefined or empty key is the equivalent of '*'
145+
146+
__Options__:
147+
* _ORDER : Results returned are ordered alphabetically ascending.
148+
* _ORDER_DESC : Results returned are ordered alphabetically descending.
149+
* _KEYS : Return keys only (no records)
150+
* _COUNT : Return record count only
151+
152+
__Return__ an array of
153+
* count : number of records affected
154+
* key : array of keys
155+
* result : array of records
156+
157+
NB: wildcards are very expensive on large datasets with most filesystems.
158+
(on a regular PC with +10^7 records in the collection, it might take up to a second to retreive one record, whereas one might retrieve up to 100.000 records with an exact key match)
159+
160+
### Delete
161+
162+
Delete one or more records, whos key match.
163+
164+
```python
165+
# Delete database
166+
rs.delete()
167+
168+
# Delete collection with content
169+
rs.delete("delete_fodders1")
170+
171+
# Delete wild collection
172+
rs.delete("delete_*")
173+
174+
# Delete exact key
175+
rs.delete("delete_fodders1", "1")
176+
177+
```
178+
179+
__Collection__ to search. If no collection is given, **THE WHOLE DATA BASE IS DELETED!**
180+
181+
__Key__ to search for. Can be mixed with wildcards '\*' and '?'. If no key is given, **THE ENTIRE COLLECTION INCLUDING SEQUENCES IS DELETED!**
182+
183+
__Return__ an array of
184+
* count : number of records or collections affected
185+
186+
### Options
187+
188+
Can be called at any time to change the configuration values of the initialized instance
189+
190+
__Options__:
191+
* data_storage_area: The directory where the database resides. The default is to use a subdirectory to the temporary directory provided by the operating system. If that doesn't work, the DOCUMENT_ROOT directory is used.
192+
* data_format: Specify which format the records are stored in. Values are: _FORMAT_NATIVE - default. and RS_FORMAT_JSON - Use JSON data format.
193+
194+
```python
195+
rs.options(data_format=_FORMAT_JSON)
196+
# or
197+
rs.options(**{
198+
"data_format": _FORMAT_JSON,
199+
...
200+
})
201+
```
202+
203+
#### Inserting with Globally Unique IDentifier key
204+
205+
Another option is to add a GUID to the key.
206+
The GUID is a combination of a timestamp and a random sequence, formatet in accordance to RFC 4122 (Valid but slightly less random)
207+
208+
If ID's are generated more than 1 millisecond apart, they are 100% unique.
209+
If two ID's are generated at shorter intervals, the likelyhod of collission is up to 1 of 10^15.
210+
211+
---
212+
213+
### Contribute
214+
Contributions are welcome. Please open an issue to discuss what you would like to change.
215+
216+
---
217+
218+
### Docs:
219+
* https://packaging.python.org/en/latest/tutorials/packaging-projects/
220+
* https://realpython.com/pypi-publish-python-package/
221+
222+
### Publish to Pypi
223+
224+
```shell
225+
python -m pip install build twine
226+
python3 -m build
227+
twine check dist/*
228+
twine upload dist/*
229+
```

0 commit comments

Comments
 (0)