Documentation
¶
Overview ¶
Package namespace provides the isolation boundary for schemas. Each namespace maintains independent current and staged snapshots, with lock-free reads via atomic pointers and serialized writes.
Index ¶
- type Namespace
- func (ns *Namespace) AllCurrent() map[string]*snapshot.Snapshot
- func (ns *Namespace) Current(schemaID string) *snapshot.Snapshot
- func (ns *Namespace) DiscardStaging()
- func (ns *Namespace) ID() string
- func (ns *Namespace) Promote() []string
- func (ns *Namespace) ProposedView() map[string]*snapshot.Snapshot
- func (ns *Namespace) SchemaIDs() []string
- func (ns *Namespace) SetCurrent(schemaID string, snap *snapshot.Snapshot) *snapshot.Snapshot
- func (ns *Namespace) SetStaged(schemaID string, snap *snapshot.Snapshot)
- func (ns *Namespace) Staged(schemaID string) *snapshot.Snapshot
- func (ns *Namespace) String() string
- type Registry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
Namespace is an isolation boundary containing schemas. Schemas within a namespace can import each other's files; cross-namespace imports are not allowed.
func (*Namespace) AllCurrent ¶
AllCurrent returns a map of schema ID → current snapshot for all schemas that have a current version. Used for building the namespace resolver during compilation.
func (*Namespace) Current ¶
Current returns the current snapshot for a schema, or nil if no version has been promoted.
func (*Namespace) DiscardStaging ¶
func (ns *Namespace) DiscardStaging()
DiscardStaging clears all staged snapshots.
func (*Namespace) Promote ¶
Promote atomically moves all staged snapshots to current. Returns the schema IDs that were promoted.
func (*Namespace) ProposedView ¶
ProposedView returns the proposed state: staged if available, otherwise current. This is the view used for compiling against the staging environment.
func (*Namespace) SetCurrent ¶
SetCurrent atomically swaps the current snapshot for a schema. Returns the previous snapshot (may be nil).
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages all namespaces. It is the top-level entry point for looking up and creating namespaces.
func (*Registry) GetOrCreate ¶
GetOrCreate returns an existing namespace or creates a new one.