You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cli.md
+43Lines changed: 43 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,3 +32,46 @@ The CLI respects standard AWS environment variables:
32
32
|`2`| Invalid arguments |
33
33
|`3`| AWS API error |
34
34
|`4`| Stack not found |
35
+
36
+
## Namespace Flag
37
+
38
+
Most data-access commands accept `--namespace` / `-N` to scope operations to a specific namespace. When omitted, operations default to the `"default"` namespace.
| List all items in namespace | GSI4: `GSI4PK={ns}`|
50
+
51
+
### Namespace Isolation
52
+
53
+
All partition key values are prefixed with an opaque namespace ID (`{ns}/`), providing logical isolation between tenants within a single DynamoDB table. The reserved namespace `_` is used for the namespace registry itself (forward and reverse lookup records).
54
+
55
+
-**Namespace ID format**: 11-character opaque string generated via `secrets.token_urlsafe(8)`
56
+
-**Default namespace**: Automatically registered on first deploy or `RepositoryBuilder.build()`
57
+
-**GSI4**: A KEYS_ONLY index on `GSI4PK=namespace_id` enables `purge_namespace()` to discover and delete all items belonging to a namespace
44
58
45
59
### Optimized Read Patterns
46
60
@@ -80,7 +94,7 @@ See [ADR-111](../adr/111-flatten-all-records.md).
80
94
```{.python .lint-only}
81
95
# Entity record (FLAT structure):
82
96
{
83
-
"PK": "ENTITY#user-1",
97
+
"PK": "{ns}/ENTITY#user-1",
84
98
"SK": "#META",
85
99
"entity_id": "user-1",
86
100
"name": "User One",
@@ -94,7 +108,7 @@ See [ADR-111](../adr/111-flatten-all-records.md).
94
108
```python
95
109
# Bucket record (FLAT structure, ADR-114/115):
96
110
{
97
-
"PK": "ENTITY#user-1",
111
+
"PK": "{ns}/ENTITY#user-1",
98
112
"SK": "#BUCKET#gpt-4",
99
113
"entity_id": "user-1",
100
114
"resource": "gpt-4",
@@ -105,7 +119,7 @@ See [ADR-111](../adr/111-flatten-all-records.md).
105
119
"b_rpm_cp": 100000, # capacity_milli for rpm limit
106
120
"b_rpm_tc": 5000, # total_consumed_milli for rpm
107
121
"rf": 1704067200000, # last_refill_ms (shared across limits)
108
-
"GSI2PK": "RESOURCE#gpt-4",
122
+
"GSI2PK": "{ns}/RESOURCE#gpt-4",
109
123
"ttl": 1234567890
110
124
}
111
125
```
@@ -121,15 +135,15 @@ exceeds consumption rate. See [Issue #179](https://github.com/zeroae/zae-limiter
0 commit comments