Files
zeekayandHanzo Dev 1a3cc15421 namespace: a value that names one entity database
The fleet stores OLTP data as one SQLite file per entity, and the name of
that file is a path -- <dir>/<ns>.db locally, a key prefix in object
storage. orm/db canonicalised it with path.Clean plus "must begin with a
letter", which leaves a namespace an opaque string that every consumer
re-derives structure from and re-validates: orm/replicated re-split and
re-checked each segment, commerce/db has splitTenant.

So make it a value. Namespace wraps an unexported string, the only routes
to one are the constructors and Parse, and the shape is kind[/id][/group].
Segments are [a-z0-9][a-z0-9_-]*, which leaves no spelling of a separator,
a dot-segment or a hidden name to reject later, and ids fold to lowercase
because on a case-insensitive filesystem org/Acme and org/acme are two
namespaces over one file.

This package is what a namespace IS; orm/db.Namespaces resolves one to a
handle.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-28 09:39:30 -07:00

22 lines
1.0 KiB
Plaintext

MIT License
Copyright (c) 2026 Hanzo AI Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.