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

cdn_world_controller

package
v0.57.28 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ConfigID = ControllerID

ConfigID is the string used to identify this config object.

View Source
const ControllerID = "spacewave/cdn/world"

ControllerID identifies the CDN world controller.

View Source
const ReleaseBlockStoreID = "spacewave-release-cdn"

ReleaseBlockStoreID identifies the block store shared by Release World metadata reads and release-manifest bucket reads.

View Source
const SRPCWorldRefreshServiceID = "cdn.world.controller.WorldRefresh"

Variables

View Source
var Version = controller.MustParseVersion("0.0.1")

Version is the version of the world implementation.

Functions

func NewSRPCWorldRefreshHandler

func NewSRPCWorldRefreshHandler(impl SRPCWorldRefreshServer, serviceID string) srpc.Handler

NewSRPCWorldRefreshHandler constructs a new RPC handler. serviceID: if empty, uses default: cdn.world.controller.WorldRefresh

func SRPCRegisterWorldRefresh

func SRPCRegisterWorldRefresh(mux srpc.Mux, impl SRPCWorldRefreshServer) error

SRPCRegisterWorldRefresh registers the implementation with the mux. Uses the default serviceID: cdn.world.controller.WorldRefresh

func WorldRefreshServiceID

func WorldRefreshServiceID(engineID string) string

WorldRefreshServiceID addresses the refresh owner for one mounted engine.

Types

type Config

type Config struct {

	// EngineId is the world engine id exposed on the bus.
	EngineId string `protobuf:"bytes,1,opt,name=engine_id,json=engineId,proto3" json:"engineId,omitempty"`
	// SpaceId is the public CDN Space id.
	SpaceId string `protobuf:"bytes,2,opt,name=space_id,json=spaceId,proto3" json:"spaceId,omitempty"`
	// CdnBaseUrl is the public CDN base URL.
	CdnBaseUrl string `protobuf:"bytes,3,opt,name=cdn_base_url,json=cdnBaseUrl,proto3" json:"cdnBaseUrl,omitempty"`
	// PointerTtlDur is the cached root pointer TTL.
	// Empty uses the CDN block store default. Negative disables expiry.
	PointerTtlDur string `protobuf:"bytes,4,opt,name=pointer_ttl_dur,json=pointerTtlDur,proto3" json:"pointerTtlDur,omitempty"`
	// CacheBlockStoreId optionally resolves the lifecycle-owned local block store
	// used for durable writeback while reading remote pack ranges.
	CacheBlockStoreId string `protobuf:"bytes,5,opt,name=cache_block_store_id,json=cacheBlockStoreId,proto3" json:"cacheBlockStoreId,omitempty"`
	// WritebackWindowBytes sets the semantic co-block writeback window.
	WritebackWindowBytes int64 `protobuf:"varint,6,opt,name=writeback_window_bytes,json=writebackWindowBytes,proto3" json:"writebackWindowBytes,omitempty"`
	// SuppliedBlockStoreId reads every block from that block store on the bus
	// instead of opening a CDN transport for this mount. Set it where another
	// process already owns the CDN transport, pack readers, index cache, and
	// durable writeback for this Space and supplies that store over the block
	// store RPC. The controller fetches the root pointer independently to build
	// its world head. It resolves no LookupBlockStore because it owns no store.
	// Mutually exclusive with cache_block_store_id.
	SuppliedBlockStoreId string `protobuf:"bytes,7,opt,name=supplied_block_store_id,json=suppliedBlockStoreId,proto3" json:"suppliedBlockStoreId,omitempty"`
	// RootPointerBaseUrl optionally serves root.packedmsg from another base URL,
	// so an owner can serve the mutable pointer from its own server and keep the
	// CDN hostname immutable. Empty reads the pointer from cdn_base_url.
	RootPointerBaseUrl string `protobuf:"bytes,8,opt,name=root_pointer_base_url,json=rootPointerBaseUrl,proto3" json:"rootPointerBaseUrl,omitempty"`
	// contains filtered or unexported fields
}

Config configures a read-only CDN-backed world engine controller.

func NewConfig

func NewConfig(engineID, spaceID, cdnBaseURL string) *Config

NewConfig constructs a new config.

func (*Config) CloneMessageVT

func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*Config) CloneVT

func (m *Config) CloneVT() *Config

func (*Config) EqualMessageVT

func (this *Config) EqualMessageVT(thatMsg any) bool

func (*Config) EqualVT

func (this *Config) EqualVT(that *Config) bool

func (*Config) EqualsConfig

func (c *Config) EqualsConfig(other config.Config) bool

EqualsConfig checks if the config is equal to another.

func (*Config) GetCacheBlockStoreId added in v0.56.1

func (x *Config) GetCacheBlockStoreId() string

func (*Config) GetCdnBaseUrl

func (x *Config) GetCdnBaseUrl() string

func (*Config) GetConfigID

func (c *Config) GetConfigID() string

GetConfigID returns the unique string for this configuration type.

func (*Config) GetEngineId

func (x *Config) GetEngineId() string

func (*Config) GetPointerTtlDur

func (x *Config) GetPointerTtlDur() string

func (*Config) GetRootPointerBaseUrl

func (x *Config) GetRootPointerBaseUrl() string

func (*Config) GetSpaceId

func (x *Config) GetSpaceId() string

func (*Config) GetSuppliedBlockStoreId added in v0.57.2

func (x *Config) GetSuppliedBlockStoreId() string

func (*Config) GetWritebackWindowBytes added in v0.56.1

func (x *Config) GetWritebackWindowBytes() int64

func (*Config) MarshalJSON

func (x *Config) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Config to JSON.

func (*Config) MarshalProtoJSON

func (x *Config) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the Config message to JSON.

func (*Config) MarshalProtoText

func (x *Config) MarshalProtoText() string

func (*Config) MarshalToSizedBufferVT

func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Config) MarshalToVT

func (m *Config) MarshalToVT(dAtA []byte) (int, error)

func (*Config) MarshalVT

func (m *Config) MarshalVT() (dAtA []byte, err error)

func (*Config) ParsePointerTTLDur

func (c *Config) ParsePointerTTLDur() (time.Duration, error)

ParsePointerTTLDur parses the root pointer TTL field.

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) Reset

func (x *Config) Reset()

func (*Config) SizeVT

func (m *Config) SizeVT() (n int)

func (*Config) String

func (x *Config) String() string

func (*Config) UnmarshalJSON

func (x *Config) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the Config from JSON.

func (*Config) UnmarshalProtoJSON

func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the Config message from JSON.

func (*Config) UnmarshalVT

func (m *Config) UnmarshalVT(dAtA []byte) error

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration.

type Controller

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

Controller exposes a read-only CDN-backed world engine.

func NewController

func NewController(le *logrus.Entry, b bus.Bus, conf *Config) *Controller

NewController builds a new CDN world controller.

func (*Controller) Close

func (c *Controller) Close() error

Close releases any resources used by the controller.

func (*Controller) Execute

func (c *Controller) Execute(ctx context.Context) error

Execute builds the CDN world engine and holds it until shutdown. A failed mount is published so lookups stop waiting on an unreachable Space.

func (*Controller) GetControllerInfo

func (c *Controller) GetControllerInfo() *controller.Info

GetControllerInfo returns information about the controller.

func (*Controller) GetWorldEngine

func (c *Controller) GetWorldEngine(ctx context.Context) (world.Engine, error)

GetWorldEngine waits for the engine to be built.

func (*Controller) HandleDirective

func (c *Controller) HandleDirective(_ context.Context, di directive.Instance) ([]directive.Resolver, error)

HandleDirective asks if the handler can resolve the directive.

func (*Controller) InvokeMethod

func (c *Controller) InvokeMethod(serviceID, methodID string, stream srpc.Stream) (bool, error)

InvokeMethod serves refresh requests on this mount's RPC service.

func (*Controller) Refresh

func (c *Controller) Refresh(ctx context.Context, req *RefreshRequest) (*RefreshResponse, error)

Refresh queues a fetch after the mount has reported a first outcome: a mounted engine, a missing head, or an unreachable Space. A mount waiting for its first head fetches only when asked, so this is what wakes it. The controller retains the current engine on fetch failure and retries within its own lifetime.

type Factory

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

Factory constructs the CDN world controller.

func NewFactory

func NewFactory(b bus.Bus) *Factory

NewFactory builds the factory.

func (*Factory) Construct

Construct constructs the associated controller given configuration.

func (*Factory) ConstructConfig

func (f *Factory) ConstructConfig() config.Config

ConstructConfig constructs an instance of the controller configuration.

func (*Factory) GetConfigID

func (f *Factory) GetConfigID() string

GetConfigID returns the configuration ID for the controller.

func (*Factory) GetControllerID

func (f *Factory) GetControllerID() string

GetControllerID returns the unique ID for the controller.

func (*Factory) GetVersion

func (f *Factory) GetVersion() controller.Version

GetVersion returns the version of this controller.

type RefreshRequest

type RefreshRequest struct {

	// SpaceId is empty for an explicit refresh of the configured mount.
	SpaceId string `protobuf:"bytes,1,opt,name=space_id,json=spaceId,proto3" json:"spaceId,omitempty"`
	// contains filtered or unexported fields
}

RefreshRequest optionally limits an invalidation to its published Space.

func (*RefreshRequest) CloneMessageVT

func (m *RefreshRequest) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*RefreshRequest) CloneVT

func (m *RefreshRequest) CloneVT() *RefreshRequest

func (*RefreshRequest) EqualMessageVT

func (this *RefreshRequest) EqualMessageVT(thatMsg any) bool

func (*RefreshRequest) EqualVT

func (this *RefreshRequest) EqualVT(that *RefreshRequest) bool

func (*RefreshRequest) GetSpaceId

func (x *RefreshRequest) GetSpaceId() string

func (*RefreshRequest) MarshalJSON

func (x *RefreshRequest) MarshalJSON() ([]byte, error)

MarshalJSON marshals the RefreshRequest to JSON.

func (*RefreshRequest) MarshalProtoJSON

func (x *RefreshRequest) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the RefreshRequest message to JSON.

func (*RefreshRequest) MarshalProtoText

func (x *RefreshRequest) MarshalProtoText() string

func (*RefreshRequest) MarshalToSizedBufferVT

func (m *RefreshRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*RefreshRequest) MarshalToVT

func (m *RefreshRequest) MarshalToVT(dAtA []byte) (int, error)

func (*RefreshRequest) MarshalVT

func (m *RefreshRequest) MarshalVT() (dAtA []byte, err error)

func (*RefreshRequest) ProtoMessage

func (*RefreshRequest) ProtoMessage()

func (*RefreshRequest) Reset

func (x *RefreshRequest) Reset()

func (*RefreshRequest) SizeVT

func (m *RefreshRequest) SizeVT() (n int)

func (*RefreshRequest) String

func (x *RefreshRequest) String() string

func (*RefreshRequest) UnmarshalJSON

func (x *RefreshRequest) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the RefreshRequest from JSON.

func (*RefreshRequest) UnmarshalProtoJSON

func (x *RefreshRequest) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the RefreshRequest message from JSON.

func (*RefreshRequest) UnmarshalVT

func (m *RefreshRequest) UnmarshalVT(dAtA []byte) error

type RefreshResponse

type RefreshResponse struct {

	// Accepted is true when the mount queued the requested refresh.
	Accepted bool `protobuf:"varint,1,opt,name=accepted,proto3" json:"accepted,omitempty"`
	// contains filtered or unexported fields
}

RefreshResponse confirms that a matching mount accepted the invalidation.

func (*RefreshResponse) CloneMessageVT

func (m *RefreshResponse) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*RefreshResponse) CloneVT

func (m *RefreshResponse) CloneVT() *RefreshResponse

func (*RefreshResponse) EqualMessageVT

func (this *RefreshResponse) EqualMessageVT(thatMsg any) bool

func (*RefreshResponse) EqualVT

func (this *RefreshResponse) EqualVT(that *RefreshResponse) bool

func (*RefreshResponse) GetAccepted

func (x *RefreshResponse) GetAccepted() bool

func (*RefreshResponse) MarshalJSON

func (x *RefreshResponse) MarshalJSON() ([]byte, error)

MarshalJSON marshals the RefreshResponse to JSON.

func (*RefreshResponse) MarshalProtoJSON

func (x *RefreshResponse) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the RefreshResponse message to JSON.

func (*RefreshResponse) MarshalProtoText

func (x *RefreshResponse) MarshalProtoText() string

func (*RefreshResponse) MarshalToSizedBufferVT

func (m *RefreshResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*RefreshResponse) MarshalToVT

func (m *RefreshResponse) MarshalToVT(dAtA []byte) (int, error)

func (*RefreshResponse) MarshalVT

func (m *RefreshResponse) MarshalVT() (dAtA []byte, err error)

func (*RefreshResponse) ProtoMessage

func (*RefreshResponse) ProtoMessage()

func (*RefreshResponse) Reset

func (x *RefreshResponse) Reset()

func (*RefreshResponse) SizeVT

func (m *RefreshResponse) SizeVT() (n int)

func (*RefreshResponse) String

func (x *RefreshResponse) String() string

func (*RefreshResponse) UnmarshalJSON

func (x *RefreshResponse) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the RefreshResponse from JSON.

func (*RefreshResponse) UnmarshalProtoJSON

func (x *RefreshResponse) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the RefreshResponse message from JSON.

func (*RefreshResponse) UnmarshalVT

func (m *RefreshResponse) UnmarshalVT(dAtA []byte) error

type SRPCWorldRefreshClient

type SRPCWorldRefreshClient interface {
	// SRPCClient returns the underlying SRPC client.
	SRPCClient() srpc.Client

	// Refresh queues a root fetch under the mount's lifetime.
	Refresh(ctx context.Context, in *RefreshRequest) (*RefreshResponse, error)
}

func NewSRPCWorldRefreshClient

func NewSRPCWorldRefreshClient(cc srpc.Client) SRPCWorldRefreshClient

func NewSRPCWorldRefreshClientWithServiceID

func NewSRPCWorldRefreshClientWithServiceID(cc srpc.Client, serviceID string) SRPCWorldRefreshClient

type SRPCWorldRefreshHandler

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

func (SRPCWorldRefreshHandler) GetMethodIDs

func (SRPCWorldRefreshHandler) GetMethodIDs() []string

func (*SRPCWorldRefreshHandler) GetServiceID

func (d *SRPCWorldRefreshHandler) GetServiceID() string

func (*SRPCWorldRefreshHandler) InvokeMethod

func (d *SRPCWorldRefreshHandler) InvokeMethod(
	serviceID, methodID string,
	strm srpc.Stream,
) (bool, error)

func (SRPCWorldRefreshHandler) InvokeMethod_Refresh

func (SRPCWorldRefreshHandler) InvokeMethod_Refresh(impl SRPCWorldRefreshServer, strm srpc.Stream) error

type SRPCWorldRefreshServer

type SRPCWorldRefreshServer interface {
	// Refresh queues a root fetch under the mount's lifetime.
	Refresh(context.Context, *RefreshRequest) (*RefreshResponse, error)
}

type SRPCWorldRefresh_RefreshStream

type SRPCWorldRefresh_RefreshStream interface {
	srpc.Stream
}

Jump to

Keyboard shortcuts

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