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
{{ message }}
Repository navigation
Commit d16ebc4
Browse filesBrowse the repository at this point in the historyBrowse files
## Summary
### Why?
Resource identity should stay flexible at storage and API boundaries even when the current allocator produces sequential numbers.
### What?
Define generated IDs as canonical decimal strings, keep resource and reference columns as VARCHAR, and limit integer storage to counter high-water marks.
Copy file name to clipboardExpand all lines: doc/rfc/scoped-resource-ids.md
+10-9Lines changed: 10 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,15 +6,15 @@ Proposed.
6
6
7
7
## Decision
8
8
9
-
A generated resource ID is the positive `int64` returned by a durable counter scoped to `(owner domain, queue, resource kind)`.
9
+
A generated resource ID is the canonical decimal string for a positive value returned by a durable counter scoped to `(owner domain, queue, resource kind)`.
10
10
11
11
| Resource | Current ID | Proposed ID | Complete identity |
The numeric ID is unique only within its scope. The same value may appear in another queue, resource kind, or domain. APIs and messages therefore carry the queue separately; their typed field or message type supplies the resource kind.
17
+
The decimal ID is unique only within its scope. The same value may appear in another queue, resource kind, or domain. APIs and messages therefore carry the queue separately; their typed field or message type supplies the resource kind.
18
18
19
19
Do not embed scope into the ID. Forms such as `demo-queue/42`, `demo-queue/batch/7`, `request.42`, and ARN-like resource names are not stored or accepted as IDs.
20
20
@@ -40,14 +40,14 @@ The counter contract requires an atomic durable increment, not MySQL specificall
40
40
41
41
## Storage and contracts
42
42
43
-
Resource tables store the numeric value directly. Queue remains the leading key:
43
+
Resource tables keep IDs as strings. Queue remains the leading key:
44
44
45
45
```text
46
-
request(queue, id BIGINT, ...) PRIMARY KEY (queue, id)
47
-
batch(queue, id BIGINT, ...) PRIMARY KEY (queue, id)
46
+
request(queue, id VARCHAR(...), ...) PRIMARY KEY (queue, id)
47
+
batch(queue, id VARCHAR(...), ...) PRIMARY KEY (queue, id)
48
48
```
49
49
50
-
Reference columns use the same numeric type. Domain entities use distinct named types such as `RequestID` and `BatchID`, and protobuf resource fields use `int64`.
50
+
Reference columns use the same string type. Domain entities may use distinct named string types such as `RequestID` and `BatchID`; protobuf resource fields remain `string`. The counter backend may store its high-water marks as integers, and controllers convert allocated values to canonical decimal strings before creating resources.
51
51
52
52
This proposal applies only to counter-generated resources. Provider build IDs, message and hook IDs, change URIs, and content hashes keep their existing contracts.
53
53
@@ -69,5 +69,6 @@ A UI may display `request.42`, `batch.7`, or `#42`, but those are derived labels
69
69
-**Queue or kind prefixes:** duplicate explicit context, lengthen keys, require parsing, and introduce URL separators.
70
70
-**ARN-like names:** solve global lookup, which current APIs neither provide nor require.
71
71
-**UUIDs or a global counter:** provide global uniqueness at the cost of unnecessary encoding or coordination.
72
+
-**Integer resource fields:** couple the persisted and wire contracts to the current counter representation without adding identity semantics.
72
73
-**SQL auto-increment or `MAX(id) + 1`:** move allocation into one storage implementation or fail under concurrency.
73
74
-**Process-local counters:** reuse IDs after restart and collide across replicas.
0 commit comments