Documentation
¶
Index ¶
- Constants
- Variables
- type CdnSharedObject
- func (s *CdnSharedObject) AccessLocalStateStore(_ context.Context, _ string, _ func()) (kvtx.Store, func(), error)
- func (s *CdnSharedObject) AccessSharedObjectHealth(_ context.Context, _ func()) (ccontainer.Watchable[*sobject.SharedObjectHealth], func(), error)
- func (s *CdnSharedObject) AccessSharedObjectState(_ context.Context, _ func()) (ccontainer.Watchable[sobject.SharedObjectStateSnapshot], func(), error)
- func (s *CdnSharedObject) ClearOperationResult(_ context.Context, _ string) error
- func (s *CdnSharedObject) GetBlockStore() bstore.BlockStore
- func (s *CdnSharedObject) GetBus() bus.Bus
- func (s *CdnSharedObject) GetDisplayName() string
- func (s *CdnSharedObject) GetHeadInnerState() (*sobject_world_engine.InnerState, error)
- func (s *CdnSharedObject) GetMeta() *sobject.SharedObjectMeta
- func (s *CdnSharedObject) GetPeerID() peer.ID
- func (s *CdnSharedObject) GetSORoot() *sobject.SORoot
- func (s *CdnSharedObject) GetSharedObjectID() string
- func (s *CdnSharedObject) GetSharedObjectState(_ context.Context) (sobject.SharedObjectStateSnapshot, error)
- func (s *CdnSharedObject) IsPublicRead() bool
- func (s *CdnSharedObject) ProcessOperations(_ context.Context, _ bool, _ sobject.ProcessOpsFunc) error
- func (s *CdnSharedObject) QueueOperation(_ context.Context, _ []byte) (string, error)
- func (s *CdnSharedObject) RefreshSnapshot(ctx context.Context) error
- func (s *CdnSharedObject) WaitOperation(_ context.Context, _ string) (uint64, bool, error)
- type CdnSharedObjectOptions
- type CdnSpaceBody
- type WorldEngine
Constants ¶
const CdnBodyType = "cdn.spacewave"
CdnBodyType is the body_type recorded in the synthetic SharedObjectMeta that CdnSharedObject returns. It lets UI code identify a CDN-mount source without depending on the well-known Space ID string.
const CdnDisplayName = "Spacewave CDN"
CdnDisplayName is the human-readable name surfaced for the CDN Space mount.
const CdnEngineID = "cdn.spacewave/world"
CdnEngineID is the world engine id used for the CDN Space. A LookupOpController registered on the bus for this engine id resolves the full alpha op surface so world RPCs against the CDN mount behave the same as against an authored Space.
const CdnProviderID = "cdn"
CdnProviderID is the synthetic provider id used in the SharedObjectRef surfaced by a CdnSpaceBody. It lets call sites detect CDN-origin mounts without depending on the well-known CdnSpaceID string.
Variables ¶
var ErrCdnReadOnly = errors.New("cdn shared object is read-only")
ErrCdnReadOnly is returned from any CdnSharedObject write path.
Functions ¶
This section is empty.
Types ¶
type CdnSharedObject ¶
type CdnSharedObject struct {
// contains filtered or unexported fields
}
CdnSharedObject is a read-only sobject.SharedObject backed by the anonymous CDN block store. It exposes the decoded SORoot from the cached CdnRootPointer so callers can build a WorldState against the CDN's world without going through the normal SO-world-engine controller path.
func NewCdnSharedObject ¶
func NewCdnSharedObject(opts CdnSharedObjectOptions) (*CdnSharedObject, error)
NewCdnSharedObject constructs a new CdnSharedObject. The caller is expected to refresh the block store pointer before the first read so GetSORoot returns the current published root.
func (*CdnSharedObject) AccessLocalStateStore ¶
func (s *CdnSharedObject) AccessLocalStateStore(_ context.Context, _ string, _ func()) (kvtx.Store, func(), error)
AccessLocalStateStore is not supported on a read-only CDN mount.
func (*CdnSharedObject) AccessSharedObjectHealth ¶
func (s *CdnSharedObject) AccessSharedObjectHealth(_ context.Context, _ func()) (ccontainer.Watchable[*sobject.SharedObjectHealth], func(), error)
AccessSharedObjectHealth returns a watchable health container for the CDN mount.
func (*CdnSharedObject) AccessSharedObjectState ¶
func (s *CdnSharedObject) AccessSharedObjectState(_ context.Context, _ func()) (ccontainer.Watchable[sobject.SharedObjectStateSnapshot], func(), error)
AccessSharedObjectState returns a watchable state container. Callers observe refreshed CDN roots by waiting on value changes; the session layer invokes RefreshSnapshot after cdn-root-changed WS frames so a fresh cdnStateSnapshot is emitted here.
func (*CdnSharedObject) ClearOperationResult ¶
func (s *CdnSharedObject) ClearOperationResult(_ context.Context, _ string) error
ClearOperationResult is not supported on a read-only CDN mount.
func (*CdnSharedObject) GetBlockStore ¶
func (s *CdnSharedObject) GetBlockStore() bstore.BlockStore
GetBlockStore returns the anonymous CDN-backed block store.
func (*CdnSharedObject) GetBus ¶
func (s *CdnSharedObject) GetBus() bus.Bus
GetBus returns the session bus. Returns nil for anonymous local-only mounts that were constructed without a bus.
func (*CdnSharedObject) GetDisplayName ¶
func (s *CdnSharedObject) GetDisplayName() string
GetDisplayName returns the fixed CDN display label.
func (*CdnSharedObject) GetHeadInnerState ¶
func (s *CdnSharedObject) GetHeadInnerState() (*sobject_world_engine.InnerState, error)
GetHeadInnerState decodes SORoot.Inner as a SORootInner, then unmarshals its StateData as the sobject_world_engine.InnerState. CDN Spaces publish Inner as plain (unencrypted) protobuf because the data is public; the admin CLI (runPostRoot) produces the same shape. Returns nil, nil when there is no published root yet.
func (*CdnSharedObject) GetMeta ¶
func (s *CdnSharedObject) GetMeta() *sobject.SharedObjectMeta
GetMeta returns the synthetic metadata used for display surfaces. Display_name is CdnDisplayName; public_read is implicitly true because the mount is anonymous and served from the public CDN.
func (*CdnSharedObject) GetPeerID ¶
func (s *CdnSharedObject) GetPeerID() peer.ID
GetPeerID returns the local peer id recorded at construction time. May be empty for anonymous mounts.
func (*CdnSharedObject) GetSORoot ¶
func (s *CdnSharedObject) GetSORoot() *sobject.SORoot
GetSORoot returns the signed SORoot decoded from the most recent CdnRootPointer. Returns nil if the CDN Space has no published root yet.
func (*CdnSharedObject) GetSharedObjectID ¶
func (s *CdnSharedObject) GetSharedObjectID() string
GetSharedObjectID returns the CDN Space ULID.
func (*CdnSharedObject) GetSharedObjectState ¶
func (s *CdnSharedObject) GetSharedObjectState(_ context.Context) (sobject.SharedObjectStateSnapshot, error)
GetSharedObjectState returns a snapshot that exposes the decoded CDN root. Mutation-oriented snapshot methods (ProcessOperations, GetParticipantConfig) return errors because the CDN mount has no participants and no transformer.
func (*CdnSharedObject) IsPublicRead ¶
func (s *CdnSharedObject) IsPublicRead() bool
IsPublicRead reports the CDN mount's public_read flag, which is always true. Exposed as a method so call sites do not hard-code the value.
func (*CdnSharedObject) ProcessOperations ¶
func (s *CdnSharedObject) ProcessOperations(_ context.Context, _ bool, _ sobject.ProcessOpsFunc) error
ProcessOperations is not supported on a read-only CDN mount.
func (*CdnSharedObject) QueueOperation ¶
QueueOperation is not supported on a read-only CDN mount.
func (*CdnSharedObject) RefreshSnapshot ¶
func (s *CdnSharedObject) RefreshSnapshot(ctx context.Context) error
RefreshSnapshot forces the CDN block store to re-fetch the root pointer and emits a fresh cdnStateSnapshot on the watch container. Callers that observe cdn-root-changed signals invoke this so downstream consumers (engine refresh goroutine, SpaceSharedObjectBody) see the new head ref.
func (*CdnSharedObject) WaitOperation ¶
WaitOperation is not supported on a read-only CDN mount.
type CdnSharedObjectOptions ¶
type CdnSharedObjectOptions struct {
SpaceID string
Bus bus.Bus
// mounts on local-only bootstraps where no session identity exists yet.
PeerID peer.ID
BlockStore *cdn_bstore.CdnBlockStore
}
CdnSharedObjectOptions configure a CdnSharedObject.
type CdnSpaceBody ¶
type CdnSpaceBody struct {
// contains filtered or unexported fields
}
CdnSpaceBody adapts a CdnSharedObject and its read-only WorldEngine to the space.SpaceSharedObjectBody interface so MountSharedObjectBody can return a resource_space.SpaceResource for the CDN Space.
func NewCdnSpaceBody ¶
func NewCdnSpaceBody(so *CdnSharedObject, we *WorldEngine) *CdnSpaceBody
NewCdnSpaceBody constructs a SpaceSharedObjectBody wrapping the CDN SharedObject and its WorldEngine. The caller retains ownership of both and must call WorldEngine.Release when done.
The synthesized SharedObjectRef carries a CdnProviderID provider id and a provider account id equal to the CDN Space ULID, so downstream code that branches on provider id (e.g. mailbox access) can recognize CDN mounts without depending on the well-known Space ID.
func (*CdnSpaceBody) GetSharedObject ¶
func (b *CdnSpaceBody) GetSharedObject() sobject.SharedObject
GetSharedObject returns the underlying CdnSharedObject as a generic sobject.SharedObject handle.
func (*CdnSpaceBody) GetSharedObjectRef ¶
func (b *CdnSpaceBody) GetSharedObjectRef() *sobject.SharedObjectRef
GetSharedObjectRef returns the synthesized shared object ref for the CDN Space. The ref has a CdnProviderID provider id; downstream code that branches on provider id (e.g. mailbox access) skips CDN mounts.
func (*CdnSpaceBody) GetWorldEngine ¶
func (b *CdnSpaceBody) GetWorldEngine() world.Engine
GetWorldEngine returns the read-only world engine for the CDN Space.
func (*CdnSpaceBody) GetWorldEngineBucketID ¶
func (b *CdnSpaceBody) GetWorldEngineBucketID() string
GetWorldEngineBucketID returns the bucket id of the CDN block store. It equals the CDN Space ULID verbatim, per the SharedObject -> BlockStore ID rule (see alpha/AGENTS.md).
func (*CdnSpaceBody) GetWorldEngineID ¶
func (b *CdnSpaceBody) GetWorldEngineID() string
GetWorldEngineID returns the world engine id for the CDN Space. It is "cdn/<spaceID>" so LookupWorldOp directives dispatched against the engine can be resolved by the standard space-world-ops controller (which accepts any engine id when its config EngineId is empty).
type WorldEngine ¶
type WorldEngine struct {
// Engine is the read-only world block engine. The engine's own root ref
// (via GetRootRef) is authoritative for the currently applied head.
Engine *world_block.Engine
// Cursor is the underlying root bucket cursor held by the engine. Release
// via WorldEngine.Release when done; Engine itself does not own it.
Cursor *bucket_lookup.Cursor
// contains filtered or unexported fields
}
WorldEngine is the read-only world engine constructed for a CdnSharedObject. The engine supports SetRootRef for live refresh when the CDN root changes. A background refresh routine watches the CdnSharedObject snapshot container and advances Engine via SetRootRef when the published head changes.
func NewWorldEngine ¶
func NewWorldEngine( ctx context.Context, le *logrus.Entry, b bus.Bus, so *CdnSharedObject, lookupOp world.LookupOp, ) (*WorldEngine, error)
NewWorldEngine builds a read-only *world_block.Engine against the CDN SharedObject's current published head. Returns an error when the CDN Space has no published root yet, when decoding the head state fails, or when the head ref lacks a transform config. The returned engine is suitable for wrapping in a resource.space SpaceSharedObjectBody.
The caller owns the returned WorldEngine and must call Release when done. lookupOp is supplied by the caller so the engine and any derived resource surfaces share the same op lookup path.
A background routine is started to watch the CdnSharedObject snapshot container and advance the engine's root ref via SetRootRef whenever the published head changes. The routine exits when Release is called.
func (*WorldEngine) Release ¶
func (w *WorldEngine) Release()
Release releases the underlying cursor and stops the refresh routine. Safe to call more than once; the cursor's own Release guards against double-release.