Documentation ¶
Index ¶
- Variables
- type RemoteWeavelet
- func (w *RemoteWeavelet) GetImpl(t reflect.Type) (any, error)
- func (w *RemoteWeavelet) GetIntf(t reflect.Type) (any, error)
- func (w *RemoteWeavelet) GetLoad(*protos.GetLoadRequest) (*protos.GetLoadReply, error)
- func (w *RemoteWeavelet) Info() *protos.EnvelopeInfo
- func (w *RemoteWeavelet) UpdateComponents(req *protos.UpdateComponentsRequest) (*protos.UpdateComponentsReply, error)
- func (w *RemoteWeavelet) UpdateRoutingInfo(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(_ 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
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 // 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 // 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 )
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.
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) 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(*protos.GetLoadRequest) (*protos.GetLoadReply, error)
GetLoad implements the conn.WeaveletHandler interface.
func (*RemoteWeavelet) Info ¶
func (w *RemoteWeavelet) Info() *protos.EnvelopeInfo
Info returns the EnvelopeInfo received from the envelope.
func (*RemoteWeavelet) UpdateComponents ¶
func (w *RemoteWeavelet) UpdateComponents(req *protos.UpdateComponentsRequest) (*protos.UpdateComponentsReply, error)
UpdateComponents implements the conn.WeaverHandler interface.
func (*RemoteWeavelet) UpdateRoutingInfo ¶
func (w *RemoteWeavelet) UpdateRoutingInfo(req *protos.UpdateRoutingInfoRequest) (reply *protos.UpdateRoutingInfoReply, err error)
UpdateRoutingInfo implements the conn.WeaverHandler interface.
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(_ 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.