Documentation ¶
Index ¶
- Variables
- type RemoteWeavelet
- func (w *RemoteWeavelet) GetHealth(context.Context, *protos.GetHealthRequest) (*protos.GetHealthReply, error)
- func (w *RemoteWeavelet) GetImpl(t reflect.Type) (any, error)
- func (w *RemoteWeavelet) GetIntf(t reflect.Type) (any, error)
- func (w *RemoteWeavelet) GetLoad(context.Context, *protos.GetLoadRequest) (*protos.GetLoadReply, error)
- func (w *RemoteWeavelet) GetMetrics(context.Context, *protos.GetMetricsRequest) (*protos.GetMetricsReply, error)
- func (w *RemoteWeavelet) GetProfile(ctx context.Context, req *protos.GetProfileRequest) (*protos.GetProfileReply, error)
- func (w *RemoteWeavelet) Info() *protos.WeaveletArgs
- func (w *RemoteWeavelet) InitWeavelet(ctx context.Context, req *protos.InitWeaveletRequest) (*protos.InitWeaveletReply, error)
- func (w *RemoteWeavelet) UpdateComponents(_ context.Context, req *protos.UpdateComponentsRequest) (*protos.UpdateComponentsReply, error)
- func (w *RemoteWeavelet) UpdateRoutingInfo(_ context.Context, req *protos.UpdateRoutingInfoRequest) (reply *protos.UpdateRoutingInfoReply, err error)
- func (w *RemoteWeavelet) Wait() error
- type RemoteWeaveletOptions
- type SingleWeavelet
- func (w *SingleWeavelet) GetImpl(t reflect.Type) (any, error)
- func (w *SingleWeavelet) GetIntf(t reflect.Type) (any, error)
- func (w *SingleWeavelet) Metrics(context.Context) (*status.Metrics, error)
- func (w *SingleWeavelet) Profile(ctx context.Context, req *protos.GetProfileRequest) (*protos.GetProfileReply, error)
- func (w *SingleWeavelet) ServeStatus(ctx context.Context) error
- func (w *SingleWeavelet) Status(context.Context) (*status.Status, error)
- type SingleWeaveletOptions
- type Weavelet
- type WeaverInfo
Constants ¶
This section is empty.
Variables ¶
var ( // SetLogger sets the logger of a component implementation struct. impl // should be a pointer to the implementation struct. SetLogger func(impl any, logger *slog.Logger) error // SetWeaverInfo sets the application's runtime information. SetWeaverInfo func(impl any, info *WeaverInfo) error // HasRefs returns whether the provided component implementation has // weaver.Refs fields. HasRefs func(impl any) bool // FillRefs initializes Ref[T] fields in a component implement struct. // - impl should be a pointer to the implementation struct // - get should be a function that returns the component of interface // type T when passed the reflect.Type for T. FillRefs func(impl any, get func(reflect.Type) (any, error)) error // HasListeners returns whether the provided component implementation has // weaver.Listener fields. HasListeners func(impl any) bool // FillListeners initializes Listener fields in a component implementation // struct. // - impl should be a pointer to the implementation struct // - get should be a function that returns the required Listener values, // namely the network listener and the proxy address. FillListeners func(impl any, get func(string) (net.Listener, string, error)) error // HasConfig returns whether the provided component implementation has // an embedded weaver.Config field. HasConfig func(impl any) bool // GetConfig returns the config stored in the provided component // implementation, or returns nil if there is no config. GetConfig func(impl any) any )
Functions ¶
This section is empty.
Types ¶
type RemoteWeavelet ¶
type RemoteWeavelet struct {
// contains filtered or unexported fields
}
RemoteWeavelet is a weavelet that runs some components locally, but coordinates with a deployer over a set of Unix pipes to start other components remotely. It is the weavelet used by all deployers, except for the single process deployer.
RemoteWeavelet must implement the weaver.controller component interface.
func NewRemoteWeavelet ¶
func NewRemoteWeavelet(ctx context.Context, regs []*codegen.Registration, bootstrap runtime.Bootstrap, opts RemoteWeaveletOptions) (*RemoteWeavelet, error)
NewRemoteWeavelet returns a new RemoteWeavelet that hosts the components specified in the provided registrations. bootstrap is used to establish a connection with an envelope.
func (*RemoteWeavelet) GetHealth ¶ added in v0.23.0
func (w *RemoteWeavelet) GetHealth(context.Context, *protos.GetHealthRequest) (*protos.GetHealthReply, error)
GetHealth implements controller.GetHealth.
func (*RemoteWeavelet) GetImpl ¶
func (w *RemoteWeavelet) GetImpl(t reflect.Type) (any, error)
GetImpl implements the Weavelet interface.
func (*RemoteWeavelet) GetIntf ¶
func (w *RemoteWeavelet) GetIntf(t reflect.Type) (any, error)
GetIntf implements the Weavelet interface.
func (*RemoteWeavelet) GetLoad ¶
func (w *RemoteWeavelet) GetLoad(context.Context, *protos.GetLoadRequest) (*protos.GetLoadReply, error)
GetLoad implements controller interface.
func (*RemoteWeavelet) GetMetrics ¶ added in v0.23.0
func (w *RemoteWeavelet) GetMetrics(context.Context, *protos.GetMetricsRequest) (*protos.GetMetricsReply, error)
GetMetrics implements controller.GetMetrics.
func (*RemoteWeavelet) GetProfile ¶ added in v0.23.0
func (w *RemoteWeavelet) GetProfile(ctx context.Context, req *protos.GetProfileRequest) (*protos.GetProfileReply, error)
GetProfile implements controller.GetProfile.
func (*RemoteWeavelet) Info ¶
func (w *RemoteWeavelet) Info() *protos.WeaveletArgs
Info returns the WeaveletArgs received from the envelope.
func (*RemoteWeavelet) InitWeavelet ¶ added in v0.23.0
func (w *RemoteWeavelet) InitWeavelet(ctx context.Context, req *protos.InitWeaveletRequest) (*protos.InitWeaveletReply, error)
InitWeavelet implements weaver.controller and conn.WeaverHandler interfaces.
func (*RemoteWeavelet) UpdateComponents ¶
func (w *RemoteWeavelet) UpdateComponents(_ context.Context, req *protos.UpdateComponentsRequest) (*protos.UpdateComponentsReply, error)
UpdateComponents implements weaver.controller and conn.WeaverHandler interfaces.
func (*RemoteWeavelet) UpdateRoutingInfo ¶
func (w *RemoteWeavelet) UpdateRoutingInfo(_ context.Context, req *protos.UpdateRoutingInfoRequest) (reply *protos.UpdateRoutingInfoReply, err error)
UpdateRoutingInfo implements controller.UpdateRoutingInfo.
func (*RemoteWeavelet) Wait ¶ added in v0.20.0
func (w *RemoteWeavelet) Wait() error
Wait waits for the RemoteWeavelet to fully shut down after its context has been cancelled.
type RemoteWeaveletOptions ¶
type RemoteWeaveletOptions struct { Fakes map[reflect.Type]any // component fakes, by component interface type InjectRetries int // Number of artificial retries to inject per retriable call }
RemoteWeaveletOptions configure a RemoteWeavelet.
type SingleWeavelet ¶
type SingleWeavelet struct {
// contains filtered or unexported fields
}
SingleWeavelet is a weavelet that runs all components locally in a single process. It is the weavelet used when you "go run" a Service Weaver app.
func NewSingleWeavelet ¶
func NewSingleWeavelet(ctx context.Context, regs []*codegen.Registration, opts SingleWeaveletOptions) (*SingleWeavelet, error)
NewSingleWeavelet returns a new SingleWeavelet that hosts the components specified in the provided registrations.
func (*SingleWeavelet) GetImpl ¶
func (w *SingleWeavelet) GetImpl(t reflect.Type) (any, error)
GetImpl implements the Weavelet interface.
func (*SingleWeavelet) GetIntf ¶
func (w *SingleWeavelet) GetIntf(t reflect.Type) (any, error)
GetIntf implements the Weavelet interface.
func (*SingleWeavelet) Profile ¶
func (w *SingleWeavelet) Profile(ctx context.Context, req *protos.GetProfileRequest) (*protos.GetProfileReply, error)
Profile implements the status.Server interface.
func (*SingleWeavelet) ServeStatus ¶
func (w *SingleWeavelet) ServeStatus(ctx context.Context) error
ServeStatus runs an HTTP status server.
type SingleWeaveletOptions ¶
type SingleWeaveletOptions struct { ConfigFilename string // TOML config filename Config string // TOML config contents Fakes map[reflect.Type]any // component fakes, by component interface type Quiet bool // if true, do not print or log anything }
SingleWeaveletOptions configure a SingleWeavelet.
type Weavelet ¶
type Weavelet interface { // GetIntf returns a handle to the component with the provided interface // type. For example, given component interface Foo, GetIntf(Foo) returns a // value of type Foo. GetIntf(t reflect.Type) (any, error) // GetImpl returns the component implementation with the provided type. If // the component does not exist, it is created. For example, given // component interface Foo and implementing struct foo, GetImpl(foo) // returns an instance of type *foo. GetImpl(t reflect.Type) (any, error) }
A Weavelet is an agent that hosts a set of components.
type WeaverInfo ¶ added in v0.23.0
type WeaverInfo struct { // Unique identifier for the application deployment. DeploymentID string }
Copy of the same struct in the main weaver package.