babysitter

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Babysitter

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

Babysitter starts and manages weavelets belonging to a single colocation group for a single application version, on the local machine.

func NewBabysitter

func NewBabysitter(
	ctx context.Context,
	cfg *config.GKEConfig,
	group *protos.ColocationGroup,
	podName string,
	useLocalhost bool,
	manager clients.ManagerClient,
	logSaver func(*protos.LogEntry),
	traceSaver func(spans []trace.ReadOnlySpan) error,
	metricExporter func(metrics []*metrics.MetricSnapshot) error,
	opts envelope.Options) (*Babysitter, error)

NewBabysitter returns a new babysitter.

func (*Babysitter) CheckHealth

func (b *Babysitter) CheckHealth(_ context.Context, req *clients.HealthCheck) (*protos.HealthReport, error)

CheckHealth implements the clients.BabysitterClient interface.

func (*Babysitter) Run

func (b *Babysitter) Run() error

Run runs the babysitter. This call will block until the context passed to NewBabysitter is canceled.

func (*Babysitter) RunProfiling

func (b *Babysitter) RunProfiling(_ context.Context, req *protos.RunProfiling) (*protos.Profile, error)

RunProfiling implements the clients.BabysitterClient interface.

func (*Babysitter) Stop

func (b *Babysitter) Stop() error

Stop terminates the envelope managed by the babysitter.

type Handler

type Handler struct {
	Ctx            context.Context // context for all operations
	Logger         *logging.FuncLogger
	Config         *config.GKEConfig       // GKE config for the handler
	Group          *protos.ColocationGroup // colocation group for the handler
	PodName        string                  // Pod hosting babysitter/envelope
	Manager        clients.ManagerClient   // connection to the manager
	BabysitterAddr string                  // IP address of the babysitter
	LogSaver       func(*protos.LogEntry)  // called on every log entry

	TraceSaver func(spans []trace.ReadOnlySpan) error // called on every trace

	// Used for reporting the current internal IP address of the weavelet.
	// May be called multiple times, with same or different IP addresses, in
	// case the weavelet gets restarted.
	ReportWeaveletAddr func(addr string) error
}

Handler is an EnvelopeHandler that issues all requests to the manager.

func (*Handler) ExportListener

func (h *Handler) ExportListener(request *protos.ExportListenerRequest) (*protos.ExportListenerReply, error)

ExportListener implements the protos.EnvelopeHandler interface.

func (*Handler) GetAddress added in v0.1.3

func (h *Handler) GetAddress(req *protos.GetAddressRequest) (*protos.GetAddressReply, error)

GetAddress implements the protos.EnvelopeHandler interface.

func (*Handler) GetComponentsToStart

func (h *Handler) GetComponentsToStart(request *protos.GetComponentsToStart) (*protos.ComponentsToStart, error)

GetComponentsToStart implements the protos.EnvelopeHandler interface.

func (*Handler) GetRoutingInfo

func (h *Handler) GetRoutingInfo(request *protos.GetRoutingInfo) (*protos.RoutingInfo, error)

GetRoutingInfo implements the protos.EnvelopeHandler interface.

func (*Handler) RecvLogEntry

func (h *Handler) RecvLogEntry(entry *protos.LogEntry)

RecvLogEntry implements the protos.EnvelopeHandler interface.

func (*Handler) RecvTraceSpans

func (h *Handler) RecvTraceSpans(traces []trace.ReadOnlySpan) error

RecvTraceSpans implements the protos.EnvelopeHandler interface.

func (*Handler) RegisterReplica

func (h *Handler) RegisterReplica(replica *protos.ReplicaToRegister) error

RegisterReplica implements the protos.EnvelopeHandler interface.

func (*Handler) ReportLoad

func (h *Handler) ReportLoad(request *protos.WeaveletLoadReport) error

ReportLoad implements the protos.EnvelopeHandler interface.

func (*Handler) StartColocationGroup

func (h *Handler) StartColocationGroup(target *protos.ColocationGroup) error

StartColocationGroup implements the protos.EnvelopeHandler interface.

func (*Handler) StartComponent

func (h *Handler) StartComponent(request *protos.ComponentToStart) error

StartComponent implements the protos.EnvelopeHandler interface.

type HttpClient

type HttpClient struct {
	Addr string // babysitter address
}

HttpClient is a Client that executes requests over HTTP.

func (*HttpClient) CheckHealth

func (h *HttpClient) CheckHealth(ctx context.Context, req *clients.HealthCheck) (*protos.HealthReport, error)

CheckHealth implements the clients.BabysitterClient interface.

func (*HttpClient) RunProfiling

func (h *HttpClient) RunProfiling(ctx context.Context, req *protos.RunProfiling) (*protos.Profile, error)

RunProfiling implements the clients.BabysitterClient interface.

Jump to

Keyboard shortcuts

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