137 lines
2.4 KiB
Markdown
137 lines
2.4 KiB
Markdown
# Overview
|
|||
|
|
|
||
|
|
A table/database, where each row contains the metadata for each chunk.
|
||
|
|
|
||
|
|
Authoritative only for mutable fields.
|
||
|
|
|
||
|
|
Recommended schema (conceptual)
|
||
|
|
chunks (
|
||
|
|
did_chunk PRIMARY KEY,
|
||
|
|
page_slug,
|
||
|
|
path,
|
||
|
|
|
||
|
|
-- Access control
|
||
|
|
access_level ENUM('open','preview','paid'),
|
||
|
|
price DECIMAL,
|
||
|
|
currency TEXT,
|
||
|
|
pricing_model TEXT,
|
||
|
|
|
||
|
|
-- Permissions
|
||
|
|
can_train BOOLEAN,
|
||
|
|
can_summarize BOOLEAN,
|
||
|
|
can_redistribute BOOLEAN,
|
||
|
|
|
||
|
|
-- Ops
|
||
|
|
status ENUM('active','deprecated'),
|
||
|
|
last_updated TIMESTAMP
|
||
|
|
)
|
||
|
|
|
||
|
|
usage_metrics (
|
||
|
|
did_chunk,
|
||
|
|
total_accesses,
|
||
|
|
paid_accesses,
|
||
|
|
unique_agents,
|
||
|
|
repeat_usage_rate,
|
||
|
|
updated_at
|
||
|
|
)
|
||
|
|
|
||
|
|
# Process
|
||
|
|
|
||
|
|
1. Build chunks with CIS evelope data
|
||
|
|
|
||
|
|
2. Register each chunk in control plane
|
||
|
|
|
||
|
|
3. Control plane becomes authority for mutable fields
|
||
|
|
|
||
|
|
You change:
|
||
|
|
|
||
|
|
price
|
||
|
|
access level
|
||
|
|
permissions
|
||
|
|
|
||
|
|
ONLY in the table
|
||
|
|
|
||
|
|
4. Runtime merge
|
||
|
|
|
||
|
|
Instead of rewriting the chunk file directly every time:
|
||
|
|
|
||
|
|
merge DB values at serve time (or build time)
|
||
|
|
|
||
|
|
Option A (recommended early): build-time merge
|
||
|
|
|
||
|
|
When generating your site:
|
||
|
|
|
||
|
|
chunks.base.json (immutable)
|
||
|
|
+ control-plane overrides
|
||
|
|
→ chunks.resolved.json (served)
|
||
|
|
|
||
|
|
Option B (later): runtime merge via API
|
||
|
|
|
||
|
|
GET /api/chunks/{id}
|
||
|
|
→ loads base chunk
|
||
|
|
→ overlays DB values
|
||
|
|
→ returns resolved CIS
|
||
|
|
|
||
|
|
Overlay, Not Mutation
|
||
|
|
|
||
|
|
Think of it like:
|
||
|
|
|
||
|
|
Base CIS (immutable)
|
||
|
|
+
|
||
|
|
Control Plane (mutable)
|
||
|
|
=
|
||
|
|
Resolved CIS (served)
|
||
|
|
|
||
|
|
Example
|
||
|
|
|
||
|
|
Base chunk (file)
|
||
|
|
{
|
||
|
|
"identity": { "did_chunk": "did:xyz" },
|
||
|
|
"integrity": { "cid_chunk": "cid:abc" },
|
||
|
|
"semantics": {...},
|
||
|
|
"rights": {
|
||
|
|
"usage_permissions": {
|
||
|
|
"train": false,
|
||
|
|
"summarize": true
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
Control plane row
|
||
|
|
{
|
||
|
|
"did_chunk": "did:xyz",
|
||
|
|
"access_level": "paid",
|
||
|
|
"price": "0.05",
|
||
|
|
"currency": "USDC"
|
||
|
|
}
|
||
|
|
Served response
|
||
|
|
{
|
||
|
|
"identity": {...},
|
||
|
|
"integrity": {...},
|
||
|
|
"semantics": {...},
|
||
|
|
"rights": {
|
||
|
|
"usage_permissions": {...},
|
||
|
|
"economic_terms": {
|
||
|
|
"pricing_model": "per_use",
|
||
|
|
"price": "0.05",
|
||
|
|
"currency": "USDC"
|
||
|
|
},
|
||
|
|
"access": "paid"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
# Control Plane Table Uses
|
||
|
|
|
||
|
|
Your table is not just admin—it becomes:
|
||
|
|
|
||
|
|
1. Pricing engine
|
||
|
|
adjust prices dynamically
|
||
|
|
test models (per-use vs subscription)
|
||
|
|
2. Access control system
|
||
|
|
open → preview → paid transitions
|
||
|
|
3. Reputation aggregator
|
||
|
|
usage metrics live here
|
||
|
|
4. Analytics layer
|
||
|
|
which chunks drive revenue
|
||
|
|
which get reused
|
||
|
|
|
||
|
|
It is a control plane for knowledge economics, not just content management
|