Skip to content

Commit 6d038df

Browse files
authored
Merge branch 'main' into claude/issue-187-20251101-1758
2 parents fbb54ea + 1aa915d commit 6d038df

File tree

19 files changed

+1823
-9
lines changed

19 files changed

+1823
-9
lines changed

docs/api/stores.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ Persistent disk-based key-value store using DiskCache.
2323
members:
2424
- __init__
2525

26+
## FileTree Store
27+
28+
Directory-based store for visual inspection and testing.
29+
30+
::: key_value.aio.stores.filetree.FileTreeStore
31+
options:
32+
show_source: false
33+
members:
34+
- __init__
35+
2636
## Redis Store
2737

2838
Redis-backed key-value store.

docs/stores.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Local stores are stored in memory or on disk, local to the application.
3434
| Memory | N/A ||| Fast in-memory storage for development and caching |
3535
| Disk | Stable | ☑️ || Persistent file-based storage in a single file |
3636
| Disk (Per-Collection) | Stable | ☑️ || Persistent storage with separate files per collection |
37+
| FileTree (test) | Unstable | ☑️ || Directory-based storage with JSON files for visual inspection |
3738
| Null (test) | N/A ||| No-op store for testing without side effects |
3839
| RocksDB | Unstable | ☑️ || High-performance embedded database |
3940
| Simple (test) | N/A ||| Simple in-memory store for testing |
@@ -140,6 +141,74 @@ pip install py-key-value-aio[disk]
140141

141142
---
142143

144+
### FileTreeStore
145+
146+
Directory-based storage for visual inspection and debugging.
147+
148+
```python
149+
from key_value.aio.stores.filetree import FileTreeStore
150+
151+
store = FileTreeStore(directory="./debug-store")
152+
```
153+
154+
**Installation:**
155+
156+
```bash
157+
pip install py-key-value-aio[filetree]
158+
```
159+
160+
**Use Cases:**
161+
162+
- Visual inspection of store contents
163+
- Debugging store behavior
164+
- Development and testing
165+
- Understanding data structure
166+
167+
**Characteristics:**
168+
169+
- Collections as directories
170+
- Keys as JSON files (`{key}.json`)
171+
- Human-readable filesystem layout
172+
- Easy to inspect and modify
173+
- **NOT for production use**
174+
175+
**Directory Structure:**
176+
177+
```text
178+
{base_directory}/
179+
{collection_1}/
180+
{key_1}.json
181+
{key_2}.json
182+
{collection_2}/
183+
{key_3}.json
184+
```
185+
186+
**Important Limitations:**
187+
188+
- Poor performance with many keys
189+
- No atomic operations
190+
- No automatic cleanup of expired entries
191+
- Filesystem path length constraints
192+
- Subject to filesystem limitations
193+
194+
**When to Use:**
195+
196+
Use FileTreeStore when you need to:
197+
198+
- Visually inspect what's being stored
199+
- Debug complex data structures
200+
- Understand how the store organizes data
201+
- Manually modify stored data for testing
202+
203+
**When NOT to Use:**
204+
205+
- Production environments
206+
- High-performance requirements
207+
- Large datasets
208+
- Concurrent access scenarios
209+
210+
---
211+
143212
### RocksDBStore
144213

145214
High-performance embedded database using RocksDB.

key-value/key-value-aio/pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ py-key-value-shared-test = { workspace = true }
3434
[project.optional-dependencies]
3535
memory = ["cachetools>=5.0.0"]
3636
disk = ["diskcache>=5.0.0", "pathvalidate>=3.3.1",]
37+
filetree = ["aiofile>=3.5.0", "anyio>=4.4.0"]
3738
redis = ["redis>=4.3.0"]
3839
mongodb = ["pymongo>=4.0.0"]
3940
valkey = ["valkey-glide>=2.1.0"]
@@ -48,6 +49,7 @@ rocksdb = [
4849
"rocksdict>=0.3.24 ; python_version >= '3.12'", # RocksDB 0.3.24 is the first version to support Python 3.13
4950
"rocksdict>=0.3.2 ; python_version < '3.12'"
5051
]
52+
duckdb = ["duckdb>=1.1.1", "pytz>=2025.2"]
5153
wrappers-encryption = ["cryptography>=45.0.0"]
5254

5355
[tool.pytest.ini_options]
@@ -67,7 +69,7 @@ env_files = [".env"]
6769

6870
[dependency-groups]
6971
dev = [
70-
"py-key-value-aio[memory,disk,redis,elasticsearch,memcached,mongodb,vault,dynamodb,rocksdb]",
72+
"py-key-value-aio[memory,disk,filetree,redis,elasticsearch,memcached,mongodb,vault,dynamodb,rocksdb,duckdb]",
7173
"py-key-value-aio[valkey]; platform_system != 'Windows'",
7274
"py-key-value-aio[keyring]",
7375
"py-key-value-aio[pydantic]",
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from key_value.aio.stores.duckdb.store import DuckDBStore
2+
3+
__all__ = ["DuckDBStore"]

0 commit comments

Comments
 (0)