Help us shape the future of Go! Take the 2026 Go Developer Survey

resource_cdn

package
v0.57.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRegistryClosed = errors.New("cdn registry is closed")

ErrRegistryClosed is returned when a lookup occurs after registry shutdown.

View Source
var ErrUnknownCdn = errors.New("unknown cdn id")

ErrUnknownCdn is returned when Lookup is called with an unregistered cdn_id. Today only the default slot is populated.

Functions

This section is empty.

Types

type CdnInstance

type CdnInstance struct {
	// contains filtered or unexported fields
}

CdnInstance owns the process-scoped singleton CdnSharedObject and the shared CdnBlockStore backing it for a single CDN (identified by cdn_id in the enclosing registry). Future multi-CDN support will create one CdnInstance per configured CDN; today only the default instance exists.

CdnInstance is process-lived: started once by the Registry on first lookup, torn down via Close when the Registry is stopped.

func (*CdnInstance) Close

func (c *CdnInstance) Close()

Close stops the refresh routine and releases the block-store cache.

func (*CdnInstance) GetBlockStore

func (c *CdnInstance) GetBlockStore() *cdn_bstore.CdnBlockStore

GetBlockStore returns the CDN block store.

func (*CdnInstance) GetSharedObject

func (c *CdnInstance) GetSharedObject() *cdn_sharedobject.CdnSharedObject

GetSharedObject returns the underlying CDN SharedObject.

func (*CdnInstance) GetSpaceID

func (c *CdnInstance) GetSpaceID() string

GetSpaceID returns the CDN Space ULID.

func (*CdnInstance) Refresh

func (c *CdnInstance) Refresh()

Refresh triggers a cheap invalidate + snapshot refresh. Called by upstream notification plumbing (cdn-root-changed WS frame, wired in iter 4) so mounted clients see a new snapshot shortly after the CDN root moves.

type CdnResource

type CdnResource struct {
	// contains filtered or unexported fields
}

CdnResource exposes one CDN instance through the resource protocol. The instance outlives the resource and remains owned by its registry.

func NewCdnResource

func NewCdnResource(le *logrus.Entry, b bus.Bus, instance *CdnInstance) *CdnResource

NewCdnResource constructs a CdnResource bound to the supplied instance. The caller retains ownership of the instance; CdnResource does not tear it down on its own.

func (*CdnResource) CopyV86ImageToSpace added in v0.51.0

CopyV86ImageToSpace copies a V86Image from this CDN Space into a user-owned destination Space identified by session index + destination space id. Source is a fresh read-only WorldEngine built from the bound CdnInstance; destination is resolved via space_resolve.ResolveSpace using the caller's session. Both engines are released before the RPC returns. Underlying copy semantics (metadata block + five asset edges, dedupe by target key) are handled by core/cdn.CopyV86ImageFromCdn.

func (*CdnResource) GetCdnSpaceId

GetCdnSpaceId returns the CDN Space ULID this resource is bound to.

func (*CdnResource) GetMux

func (r *CdnResource) GetMux() srpc.Invoker

GetMux returns the rpc mux.

func (*CdnResource) MountCdnSpace

MountCdnSpace mounts the CDN SharedObject as a read-only Space resource on the caller's client. Reuses the shared cdn_sharedobject.NewWorldEngine + NewCdnSpaceBody + resource_space.NewSpaceResource machinery that backs the CdnBodyType branch in resource_sobject.MountSharedObjectBody, so both mount paths produce structurally identical SpaceResources.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry owns one process-scoped instance per canonical CDN Space ID. The empty ID and configured Space ID resolve to the same lazy instance.

func NewRegistry

func NewRegistry(le *logrus.Entry, b bus.Bus) *Registry

NewRegistry constructs a Registry. The returned registry owns a detached lifecycle context used to scope any instance-level background routines (e.g. refresh routines). Close cancels that context and tears down all registered instances. The CDN singleton is anonymous: no peer id is required because the CDN Space is not part of any session's provider account.

func (*Registry) Close

func (r *Registry) Close()

Close tears down every registered instance and cancels the registry lifecycle context. Safe to call more than once.

func (*Registry) Lookup

func (r *Registry) Lookup(cdnID string) (*CdnInstance, error)

Lookup returns the shared instance for the empty alias or configured CDN ID. Unknown IDs return ErrUnknownCdn without initializing or fetching a CDN.

func (*Registry) NotifyRootChanged

func (r *Registry) NotifyRootChanged(spaceID string) bool

NotifyRootChanged wakes up the CdnInstance whose SpaceID matches spaceID so the downstream block store cache is invalidated and the cached snapshot is refreshed. Called when an upstream cdn-root-changed signal arrives (e.g. the session-level WS frame). Unknown spaceIDs are silently ignored so future CDNs that this process has not registered yet do not produce spurious errors. Returns true when a matching instance was found.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL