blockdevice 1.16.0__tar.gz → 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.
- blockdevice-2.0.0/MANIFEST.in +6 -0
- blockdevice-2.0.0/PKG-INFO +308 -0
- blockdevice-2.0.0/README.md +156 -0
- {blockdevice-1.16.0 → blockdevice-2.0.0}/blockdevice/__init__.py +3 -11
- {blockdevice-1.16.0 → blockdevice-2.0.0}/blockdevice/fuse_ops.py +1 -16
- blockdevice-2.0.0/blockdevice/utils/__init__.py +307 -0
- blockdevice-2.0.0/blockdevice.egg-info/PKG-INFO +308 -0
- {blockdevice-1.16.0 → blockdevice-2.0.0}/blockdevice.egg-info/SOURCES.txt +8 -1
- blockdevice-2.0.0/blockdevice.egg-info/requires.txt +4 -0
- blockdevice-2.0.0/examples/compressed.py +195 -0
- blockdevice-2.0.0/examples/fs.bin +0 -0
- blockdevice-2.0.0/examples/network/client.py +207 -0
- blockdevice-2.0.0/examples/network/server.py +9 -0
- {blockdevice-1.16.0 → blockdevice-2.0.0}/include/blockdevice.h +9 -9
- blockdevice-2.0.0/pyproject.toml +39 -0
- blockdevice-1.16.0/blockdevice.egg-info/requires.txt → blockdevice-2.0.0/requirements.txt +1 -0
- blockdevice-2.0.0/setup.py +19 -0
- blockdevice-2.0.0/tests/__init__.py +1 -0
- blockdevice-1.16.0/MANIFEST.in +0 -2
- blockdevice-1.16.0/PKG-INFO +0 -44
- blockdevice-1.16.0/README.md +0 -7
- blockdevice-1.16.0/blockdevice.egg-info/PKG-INFO +0 -44
- blockdevice-1.16.0/pyproject.toml +0 -3
- blockdevice-1.16.0/setup.py +0 -131
- /blockdevice-1.16.0/COPYING.md → /blockdevice-2.0.0/LICENSE.md +0 -0
- {blockdevice-1.16.0 → blockdevice-2.0.0}/blockdevice/_blockdevice.pyi +0 -0
- {blockdevice-1.16.0 → blockdevice-2.0.0}/blockdevice/py.typed +0 -0
- {blockdevice-1.16.0 → blockdevice-2.0.0}/blockdevice.egg-info/dependency_links.txt +0 -0
- {blockdevice-1.16.0 → blockdevice-2.0.0}/blockdevice.egg-info/top_level.txt +0 -0
- {blockdevice-1.16.0 → blockdevice-2.0.0}/setup.cfg +0 -0
- {blockdevice-1.16.0 → blockdevice-2.0.0}/src/blockdevice.cpp +0 -0
- {blockdevice-1.16.0 → blockdevice-2.0.0}/src/blockdevice_class.cpp +0 -0
- {blockdevice-1.16.0 → blockdevice-2.0.0}/tests/test_blockdevice.py +0 -0
- {blockdevice-1.16.0 → blockdevice-2.0.0}/tests/test_fuse_ops.py +0 -0
- {blockdevice-1.16.0 → blockdevice-2.0.0}/tests/test_utils.py +0 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: blockdevice
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: A simple C++ Python library for block device operations
|
|
5
|
+
Author-email: Omena0 <omena0mc@gmail.com>
|
|
6
|
+
License: # PolyForm Noncommercial License 1.0.0
|
|
7
|
+
|
|
8
|
+
<https://polyformproject.org/licenses/noncommercial/1.0.0>
|
|
9
|
+
|
|
10
|
+
## Acceptance
|
|
11
|
+
|
|
12
|
+
In order to get any license under these terms, you must agree
|
|
13
|
+
to them as both strict obligations and conditions to all
|
|
14
|
+
your licenses.
|
|
15
|
+
|
|
16
|
+
## Copyright License
|
|
17
|
+
|
|
18
|
+
The licensor grants you a copyright license for the
|
|
19
|
+
software to do everything you might do with the software
|
|
20
|
+
that would otherwise infringe the licensor's copyright
|
|
21
|
+
in it for any permitted purpose. However, you may
|
|
22
|
+
only distribute the software according to [Distribution
|
|
23
|
+
License](#distribution-license) and make changes or new works
|
|
24
|
+
based on the software according to [Changes and New Works
|
|
25
|
+
License](#changes-and-new-works-license).
|
|
26
|
+
|
|
27
|
+
## Distribution License
|
|
28
|
+
|
|
29
|
+
The licensor grants you an additional copyright license
|
|
30
|
+
to distribute copies of the software. Your license
|
|
31
|
+
to distribute covers distributing the software with
|
|
32
|
+
changes and new works permitted by [Changes and New Works
|
|
33
|
+
License](#changes-and-new-works-license).
|
|
34
|
+
|
|
35
|
+
## Notices
|
|
36
|
+
|
|
37
|
+
You must ensure that anyone who gets a copy of any part of
|
|
38
|
+
the software from you also gets a copy of these terms or the
|
|
39
|
+
URL for them above, as well as copies of any plain-text lines
|
|
40
|
+
beginning with `Required Notice:` that the licensor provided
|
|
41
|
+
with the software. For example:
|
|
42
|
+
|
|
43
|
+
> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
|
|
44
|
+
|
|
45
|
+
## Changes and New Works License
|
|
46
|
+
|
|
47
|
+
The licensor grants you an additional copyright license to
|
|
48
|
+
make changes and new works based on the software for any
|
|
49
|
+
permitted purpose.
|
|
50
|
+
|
|
51
|
+
## Patent License
|
|
52
|
+
|
|
53
|
+
The licensor grants you a patent license for the software that
|
|
54
|
+
covers patent claims the licensor can license, or becomes able
|
|
55
|
+
to license, that you would infringe by using the software.
|
|
56
|
+
|
|
57
|
+
## Noncommercial Purposes
|
|
58
|
+
|
|
59
|
+
Any noncommercial purpose is a permitted purpose.
|
|
60
|
+
|
|
61
|
+
## Personal Uses
|
|
62
|
+
|
|
63
|
+
Personal use for research, experiment, and testing for
|
|
64
|
+
the benefit of public knowledge, personal study, private
|
|
65
|
+
entertainment, hobby projects, amateur pursuits, or religious
|
|
66
|
+
observance, without any anticipated commercial application,
|
|
67
|
+
is use for a permitted purpose.
|
|
68
|
+
|
|
69
|
+
## Noncommercial Organizations
|
|
70
|
+
|
|
71
|
+
Use by any charitable organization, educational institution,
|
|
72
|
+
public research organization, public safety or health
|
|
73
|
+
organization, environmental protection organization,
|
|
74
|
+
or government institution is use for a permitted purpose
|
|
75
|
+
regardless of the source of funding or obligations resulting
|
|
76
|
+
from the funding.
|
|
77
|
+
|
|
78
|
+
## Fair Use
|
|
79
|
+
|
|
80
|
+
You may have "fair use" rights for the software under the
|
|
81
|
+
law. These terms do not limit them.
|
|
82
|
+
|
|
83
|
+
## No Other Rights
|
|
84
|
+
|
|
85
|
+
These terms do not allow you to sublicense or transfer any of
|
|
86
|
+
your licenses to anyone else, or prevent the licensor from
|
|
87
|
+
granting licenses to anyone else. These terms do not imply
|
|
88
|
+
any other licenses.
|
|
89
|
+
|
|
90
|
+
## Patent Defense
|
|
91
|
+
|
|
92
|
+
If you make any written claim that the software infringes or
|
|
93
|
+
contributes to infringement of any patent, your patent license
|
|
94
|
+
for the software granted under these terms ends immediately. If
|
|
95
|
+
your company makes such a claim, your patent license ends
|
|
96
|
+
immediately for work on behalf of your company.
|
|
97
|
+
|
|
98
|
+
## Violations
|
|
99
|
+
|
|
100
|
+
The first time you are notified in writing that you have
|
|
101
|
+
violated any of these terms, or done anything with the software
|
|
102
|
+
not covered by your licenses, your licenses can nonetheless
|
|
103
|
+
continue if you come into full compliance with these terms,
|
|
104
|
+
and take practical steps to correct past violations, within
|
|
105
|
+
32 days of receiving notice. Otherwise, all your licenses
|
|
106
|
+
end immediately.
|
|
107
|
+
|
|
108
|
+
## No Liability
|
|
109
|
+
|
|
110
|
+
***As far as the law allows, the software comes as is, without
|
|
111
|
+
any warranty or condition, and the licensor will not be liable
|
|
112
|
+
to you for any damages arising out of these terms or the use
|
|
113
|
+
or nature of the software, under any kind of legal claim.***
|
|
114
|
+
|
|
115
|
+
## Definitions
|
|
116
|
+
|
|
117
|
+
The **licensor** is the individual or entity offering these
|
|
118
|
+
terms, and the **software** is the software the licensor makes
|
|
119
|
+
available under these terms.
|
|
120
|
+
|
|
121
|
+
**You** refers to the individual or entity agreeing to these
|
|
122
|
+
terms.
|
|
123
|
+
|
|
124
|
+
**Your company** is any legal entity, sole proprietorship,
|
|
125
|
+
or other kind of organization that you work for, plus all
|
|
126
|
+
organizations that have control over, are under the control of,
|
|
127
|
+
or are under common control with that organization. **Control**
|
|
128
|
+
means ownership of substantially all the assets of an entity,
|
|
129
|
+
or the power to direct its management and policies by vote,
|
|
130
|
+
contract, or otherwise. Control can be direct or indirect.
|
|
131
|
+
|
|
132
|
+
**Your licenses** are all the licenses granted to you for the
|
|
133
|
+
software under these terms.
|
|
134
|
+
|
|
135
|
+
**Use** means anything you do with the software requiring one
|
|
136
|
+
of your licenses.
|
|
137
|
+
|
|
138
|
+
Keywords: block-device,fuse,filesystem,storage
|
|
139
|
+
Classifier: Development Status :: 3 - Alpha
|
|
140
|
+
Classifier: Intended Audience :: Developers
|
|
141
|
+
Classifier: Programming Language :: Python :: 3
|
|
142
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
143
|
+
Classifier: Topic :: System :: Filesystems
|
|
144
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
145
|
+
Requires-Python: >=3.8
|
|
146
|
+
Description-Content-Type: text/markdown
|
|
147
|
+
License-File: LICENSE.md
|
|
148
|
+
Provides-Extra: dev
|
|
149
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
150
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
151
|
+
Dynamic: license-file
|
|
152
|
+
|
|
153
|
+
# Blockdevice
|
|
154
|
+
|
|
155
|
+
[](https://github.com/Omena0/blockdevice/actions/workflows/publish.yml)
|
|
156
|
+
[](https://github.com/Omena0/blockdevice/actions/workflows/pytest.yml)
|
|
157
|
+
[](https://github.com/Omena0/blockdevice/actions/workflows/pytest.yml)
|
|
158
|
+

|
|
159
|
+
|
|
160
|
+
A Python library for creating and managing block devices with FUSE filesystem support. Provides persistent object storage with compression options and real-time synchronization capabilities.
|
|
161
|
+
|
|
162
|
+
## Features
|
|
163
|
+
|
|
164
|
+
- **Block Device Operations**: C++ extension for efficient block device operations
|
|
165
|
+
- **FUSE Filesystem**: Mount block devices as user-space filesystems
|
|
166
|
+
- **Persistent Storage**: Multiple storage backends including disk-based and compressed storage
|
|
167
|
+
- **Real-time Sync**: Network synchronization for distributed applications
|
|
168
|
+
- **Python Integration**: Seamless integration with Python applications
|
|
169
|
+
|
|
170
|
+
## Installation
|
|
171
|
+
|
|
172
|
+
### From Source
|
|
173
|
+
```bash
|
|
174
|
+
git clone https://github.com/Omena0/blockdevice.git
|
|
175
|
+
cd blockdevice
|
|
176
|
+
pip install .
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Quick Start
|
|
180
|
+
|
|
181
|
+
### Basic Usage
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
from blockdevice import BlockDevice, DiskObject
|
|
185
|
+
|
|
186
|
+
# Create a block device
|
|
187
|
+
dev = BlockDevice("/path/to/device", dolphin=True)
|
|
188
|
+
|
|
189
|
+
# Create persistent storage
|
|
190
|
+
storage = DiskObject("data.pkl")
|
|
191
|
+
storage['key'] = 'value'
|
|
192
|
+
print(storage['key']) # 'value'
|
|
193
|
+
|
|
194
|
+
dev.start(True) # Start FUSE filesystem
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Compressed Storage
|
|
198
|
+
|
|
199
|
+
```python
|
|
200
|
+
from blockdevice import CompressedDiskObject
|
|
201
|
+
|
|
202
|
+
# Create compressed persistent storage
|
|
203
|
+
storage = CompressedDiskObject("data.zst", compression_level=10)
|
|
204
|
+
storage['large_data'] = 'x' * 10000 # Automatically compressed
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Network Synchronization
|
|
208
|
+
|
|
209
|
+
```python
|
|
210
|
+
from blockdevice import NetworkObject
|
|
211
|
+
|
|
212
|
+
# Create synchronized object (connects to server or becomes server)
|
|
213
|
+
sync_obj = NetworkObject('localhost', 8080)
|
|
214
|
+
sync_obj['shared_data'] = 'available on all connected instances'
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Architecture
|
|
218
|
+
|
|
219
|
+
The library consists of several key components:
|
|
220
|
+
|
|
221
|
+
- **BlockDevice**: C++ extension providing low-level block operations
|
|
222
|
+
- **Storage Objects**:
|
|
223
|
+
- `Object`: Abstract base class for persistent objects
|
|
224
|
+
- `DiskObject`: Pickle-based disk storage
|
|
225
|
+
- `CompressedDiskObject`: Zstd-compressed disk storage
|
|
226
|
+
- `NetworkObject`: Real-time synchronized storage
|
|
227
|
+
- **FUSE Integration**: `BlockDeviceFUSE` class for filesystem mounting
|
|
228
|
+
|
|
229
|
+
## Development
|
|
230
|
+
|
|
231
|
+
### Setup
|
|
232
|
+
```bash
|
|
233
|
+
git clone https://github.com/Omena0/blockdevice.git
|
|
234
|
+
cd blockdevice
|
|
235
|
+
python -m venv .venv
|
|
236
|
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
|
237
|
+
pip install -r requirements.txt
|
|
238
|
+
pip install -e .
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Testing
|
|
242
|
+
```bash
|
|
243
|
+
# Run all tests
|
|
244
|
+
pytest
|
|
245
|
+
|
|
246
|
+
# Run with coverage
|
|
247
|
+
pytest --cov=blockdevice --cov-report=html
|
|
248
|
+
|
|
249
|
+
# Run specific test file
|
|
250
|
+
pytest tests/test_utils.py
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Building
|
|
254
|
+
```bash
|
|
255
|
+
# Build the C++ extension
|
|
256
|
+
python setup.py build_ext --inplace
|
|
257
|
+
|
|
258
|
+
# Build distribution
|
|
259
|
+
python setup.py sdist bdist_wheel
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## Examples
|
|
263
|
+
|
|
264
|
+
See the `examples/` directory for sample applications:
|
|
265
|
+
|
|
266
|
+
- `compressed.py`: Filesystem implementation with compression
|
|
267
|
+
- `network/`: Client-server examples
|
|
268
|
+
|
|
269
|
+
## API Reference
|
|
270
|
+
|
|
271
|
+
### BlockDevice
|
|
272
|
+
```python
|
|
273
|
+
BlockDevice(path: str, dolphin: bool = False)
|
|
274
|
+
```
|
|
275
|
+
Core block device operations.
|
|
276
|
+
|
|
277
|
+
### Storage Classes
|
|
278
|
+
|
|
279
|
+
#### DiskObject
|
|
280
|
+
```python
|
|
281
|
+
DiskObject(path: str, default_value=None)
|
|
282
|
+
```
|
|
283
|
+
Persistent dictionary stored as pickle file.
|
|
284
|
+
|
|
285
|
+
#### CompressedDiskObject
|
|
286
|
+
```python
|
|
287
|
+
CompressedDiskObject(path: str, default_value=None, compression_level=5)
|
|
288
|
+
```
|
|
289
|
+
Compressed persistent storage using zstd.
|
|
290
|
+
|
|
291
|
+
#### NetworkObject
|
|
292
|
+
```python
|
|
293
|
+
NetworkObject(host: str, port: int = None, default_value=None)
|
|
294
|
+
```
|
|
295
|
+
Real-time synchronized storage across network.
|
|
296
|
+
|
|
297
|
+
## Contributing
|
|
298
|
+
|
|
299
|
+
1. Fork the repository
|
|
300
|
+
2. Create a feature branch
|
|
301
|
+
3. Add tests for new functionality
|
|
302
|
+
4. Ensure all tests pass
|
|
303
|
+
5. Submit a pull request
|
|
304
|
+
|
|
305
|
+
## License
|
|
306
|
+
|
|
307
|
+
See LICENSE.md for license information.
|
|
308
|
+
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# Blockdevice
|
|
2
|
+
|
|
3
|
+
[](https://github.com/Omena0/blockdevice/actions/workflows/publish.yml)
|
|
4
|
+
[](https://github.com/Omena0/blockdevice/actions/workflows/pytest.yml)
|
|
5
|
+
[](https://github.com/Omena0/blockdevice/actions/workflows/pytest.yml)
|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
A Python library for creating and managing block devices with FUSE filesystem support. Provides persistent object storage with compression options and real-time synchronization capabilities.
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- **Block Device Operations**: C++ extension for efficient block device operations
|
|
13
|
+
- **FUSE Filesystem**: Mount block devices as user-space filesystems
|
|
14
|
+
- **Persistent Storage**: Multiple storage backends including disk-based and compressed storage
|
|
15
|
+
- **Real-time Sync**: Network synchronization for distributed applications
|
|
16
|
+
- **Python Integration**: Seamless integration with Python applications
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
### From Source
|
|
21
|
+
```bash
|
|
22
|
+
git clone https://github.com/Omena0/blockdevice.git
|
|
23
|
+
cd blockdevice
|
|
24
|
+
pip install .
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
### Basic Usage
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from blockdevice import BlockDevice, DiskObject
|
|
33
|
+
|
|
34
|
+
# Create a block device
|
|
35
|
+
dev = BlockDevice("/path/to/device", dolphin=True)
|
|
36
|
+
|
|
37
|
+
# Create persistent storage
|
|
38
|
+
storage = DiskObject("data.pkl")
|
|
39
|
+
storage['key'] = 'value'
|
|
40
|
+
print(storage['key']) # 'value'
|
|
41
|
+
|
|
42
|
+
dev.start(True) # Start FUSE filesystem
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Compressed Storage
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from blockdevice import CompressedDiskObject
|
|
49
|
+
|
|
50
|
+
# Create compressed persistent storage
|
|
51
|
+
storage = CompressedDiskObject("data.zst", compression_level=10)
|
|
52
|
+
storage['large_data'] = 'x' * 10000 # Automatically compressed
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Network Synchronization
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from blockdevice import NetworkObject
|
|
59
|
+
|
|
60
|
+
# Create synchronized object (connects to server or becomes server)
|
|
61
|
+
sync_obj = NetworkObject('localhost', 8080)
|
|
62
|
+
sync_obj['shared_data'] = 'available on all connected instances'
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Architecture
|
|
66
|
+
|
|
67
|
+
The library consists of several key components:
|
|
68
|
+
|
|
69
|
+
- **BlockDevice**: C++ extension providing low-level block operations
|
|
70
|
+
- **Storage Objects**:
|
|
71
|
+
- `Object`: Abstract base class for persistent objects
|
|
72
|
+
- `DiskObject`: Pickle-based disk storage
|
|
73
|
+
- `CompressedDiskObject`: Zstd-compressed disk storage
|
|
74
|
+
- `NetworkObject`: Real-time synchronized storage
|
|
75
|
+
- **FUSE Integration**: `BlockDeviceFUSE` class for filesystem mounting
|
|
76
|
+
|
|
77
|
+
## Development
|
|
78
|
+
|
|
79
|
+
### Setup
|
|
80
|
+
```bash
|
|
81
|
+
git clone https://github.com/Omena0/blockdevice.git
|
|
82
|
+
cd blockdevice
|
|
83
|
+
python -m venv .venv
|
|
84
|
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
|
85
|
+
pip install -r requirements.txt
|
|
86
|
+
pip install -e .
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Testing
|
|
90
|
+
```bash
|
|
91
|
+
# Run all tests
|
|
92
|
+
pytest
|
|
93
|
+
|
|
94
|
+
# Run with coverage
|
|
95
|
+
pytest --cov=blockdevice --cov-report=html
|
|
96
|
+
|
|
97
|
+
# Run specific test file
|
|
98
|
+
pytest tests/test_utils.py
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Building
|
|
102
|
+
```bash
|
|
103
|
+
# Build the C++ extension
|
|
104
|
+
python setup.py build_ext --inplace
|
|
105
|
+
|
|
106
|
+
# Build distribution
|
|
107
|
+
python setup.py sdist bdist_wheel
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Examples
|
|
111
|
+
|
|
112
|
+
See the `examples/` directory for sample applications:
|
|
113
|
+
|
|
114
|
+
- `compressed.py`: Filesystem implementation with compression
|
|
115
|
+
- `network/`: Client-server examples
|
|
116
|
+
|
|
117
|
+
## API Reference
|
|
118
|
+
|
|
119
|
+
### BlockDevice
|
|
120
|
+
```python
|
|
121
|
+
BlockDevice(path: str, dolphin: bool = False)
|
|
122
|
+
```
|
|
123
|
+
Core block device operations.
|
|
124
|
+
|
|
125
|
+
### Storage Classes
|
|
126
|
+
|
|
127
|
+
#### DiskObject
|
|
128
|
+
```python
|
|
129
|
+
DiskObject(path: str, default_value=None)
|
|
130
|
+
```
|
|
131
|
+
Persistent dictionary stored as pickle file.
|
|
132
|
+
|
|
133
|
+
#### CompressedDiskObject
|
|
134
|
+
```python
|
|
135
|
+
CompressedDiskObject(path: str, default_value=None, compression_level=5)
|
|
136
|
+
```
|
|
137
|
+
Compressed persistent storage using zstd.
|
|
138
|
+
|
|
139
|
+
#### NetworkObject
|
|
140
|
+
```python
|
|
141
|
+
NetworkObject(host: str, port: int = None, default_value=None)
|
|
142
|
+
```
|
|
143
|
+
Real-time synchronized storage across network.
|
|
144
|
+
|
|
145
|
+
## Contributing
|
|
146
|
+
|
|
147
|
+
1. Fork the repository
|
|
148
|
+
2. Create a feature branch
|
|
149
|
+
3. Add tests for new functionality
|
|
150
|
+
4. Ensure all tests pass
|
|
151
|
+
5. Submit a pull request
|
|
152
|
+
|
|
153
|
+
## License
|
|
154
|
+
|
|
155
|
+
See LICENSE.md for license information.
|
|
156
|
+
|
|
@@ -5,20 +5,12 @@ This module provides a BlockDevice class with decorators for read, write, and li
|
|
|
5
5
|
It also includes FUSE filesystem support for mounting the block device as a real filesystem.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
from
|
|
8
|
+
from ._blockdevice import BlockDevice
|
|
9
|
+
from .fuse_ops import BlockDeviceFUSE
|
|
10
|
+
from .utils import Object, DiskObject, CompressedDiskObject, NetworkObject
|
|
9
11
|
|
|
10
|
-
# Debug flag - set to True to enable debug output
|
|
11
12
|
debug = False
|
|
12
13
|
|
|
13
|
-
if TYPE_CHECKING:
|
|
14
|
-
from ._blockdevice import BlockDevice as _BlockDevice
|
|
15
|
-
BlockDevice = _BlockDevice
|
|
16
|
-
else:
|
|
17
|
-
from ._blockdevice import BlockDevice
|
|
18
|
-
|
|
19
|
-
from .fuse_ops import BlockDeviceFUSE
|
|
20
|
-
from .utils import *
|
|
21
|
-
|
|
22
14
|
__version__ = "0.1.0"
|
|
23
15
|
__author__ = "Omena0"
|
|
24
16
|
|
|
@@ -19,21 +19,6 @@ def _debug_print(*args, **kwargs):
|
|
|
19
19
|
# Silently fail if debug flag is not available
|
|
20
20
|
pass
|
|
21
21
|
|
|
22
|
-
import threading
|
|
23
|
-
from typing import Any, Dict, List, Optional, Union
|
|
24
|
-
from fuse import FuseOSError, Operations
|
|
25
|
-
|
|
26
|
-
# Import debug function from parent module
|
|
27
|
-
def _debug__debug_print(*args, **kwargs):
|
|
28
|
-
"""Debug print that respects the module's debug flag"""
|
|
29
|
-
try:
|
|
30
|
-
import blockdevice
|
|
31
|
-
if blockdevice.debug:
|
|
32
|
-
_debug_print(*args, **kwargs)
|
|
33
|
-
except (ImportError, AttributeError):
|
|
34
|
-
# Fallback if debug flag is not available
|
|
35
|
-
pass
|
|
36
|
-
|
|
37
22
|
|
|
38
23
|
class BlockDeviceFUSE(Operations):
|
|
39
24
|
"""
|
|
@@ -54,7 +39,7 @@ class BlockDeviceFUSE(Operations):
|
|
|
54
39
|
|
|
55
40
|
def getattr(self, path: str, fh: Optional[int] = None) -> Dict[str, Any]:
|
|
56
41
|
"""Get file attributes"""
|
|
57
|
-
|
|
42
|
+
_debug_print(f"FUSE getattr: {path}")
|
|
58
43
|
|
|
59
44
|
try:
|
|
60
45
|
# If it's the root, always return directory attributes
|