conn

package
v0.1.5 Latest Latest
Warning

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

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

Documentation

Overview

Package conn implements a bi-directional communication channel between an envelope and a weavelet.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Profile

func Profile(req *protos.RunProfiling) ([]byte, error)

Profile collects profiles for the weavelet.

Types

type EnvelopeConn

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

EnvelopeConn is the envelope side of the connection between a weavelet and the envelope.

func NewEnvelopeConn

func NewEnvelopeConn(r io.ReadCloser, w io.WriteCloser, h EnvelopeHandler, weavelet *protos.WeaveletInfo) (*EnvelopeConn, error)

NewEnvelopeConn creates the envelope side of the connection between a weavelet and an envelope. The connection uses (r,w) to carry messages. Synthesized high-level events are passed to h.

NewEnvelopeConn sends the provided protos.Weavelet to the weavelet.

func (*EnvelopeConn) DoProfilingRPC

func (e *EnvelopeConn) DoProfilingRPC(req *protos.RunProfiling) (*protos.Profile, error)

DoProfilingRPC requests the weavelet to profile itself and return its profile data.

func (*EnvelopeConn) GetMetricsRPC

func (e *EnvelopeConn) GetMetricsRPC() ([]*metrics.MetricSnapshot, error)

GetMetricsRPC requests the weavelet to return its up-to-date metrics.

func (*EnvelopeConn) HealthStatusRPC

func (e *EnvelopeConn) HealthStatusRPC() (protos.HealthStatus, error)

HealthStatusRPC requests the weavelet to return its health status.

func (*EnvelopeConn) Run

func (e *EnvelopeConn) Run() error

Run interacts with the peer. Messages that are received are handled as an ordered sequence.

type EnvelopeHandler

type EnvelopeHandler interface {
	// StartComponent starts the given component.
	StartComponent(entry *protos.ComponentToStart) error

	// StartColocationGroup starts the given colocation group.
	StartColocationGroup(entry *protos.ColocationGroup) error

	// RegisterReplica registers the given weavelet replica.
	RegisterReplica(entry *protos.ReplicaToRegister) error

	// ReportLoad reports the given weavelet load information.
	ReportLoad(entry *protos.WeaveletLoadReport) error

	// GetAddress gets the address a weavelet should listen on for a listener.
	GetAddress(req *protos.GetAddressRequest) (*protos.GetAddressReply, error)

	// ExportListener exports the given listener.
	ExportListener(req *protos.ExportListenerRequest) (*protos.ExportListenerReply, error)

	// GetRoutingInfo returns the latest routing information for the weavelet.
	//
	// This is a blocking method that can be processed out-of-order w.r.t.
	// the other methods.
	GetRoutingInfo(request *protos.GetRoutingInfo) (*protos.RoutingInfo, error)

	// GetComponentsToStart is a blocking call that returns the latest set of
	// components that should be started by the weavelet.
	//
	// This is a blocking method that can be processed out-of-order w.r.t.
	// the other methods.
	GetComponentsToStart(request *protos.GetComponentsToStart) (*protos.ComponentsToStart, error)

	// RecvLogEntry enables the envelope to receive a log entry.
	RecvLogEntry(entry *protos.LogEntry)

	// RecvTraceSpans enables the envelope to receive a sequence of trace spans.
	RecvTraceSpans(spans []trace.ReadOnlySpan) error
}

EnvelopeHandler implements the envelope side processing of messages exchanged with the managed weavelet.

type WeaveletConn

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

WeaveletConn is the weavelet side of the connection between a weavelet and its envelope. It communicates with the envelope over a pair of pipes.

func NewWeaveletConn

func NewWeaveletConn(r io.ReadCloser, w io.WriteCloser) (*WeaveletConn, error)

NewWeaveletConn creates the weavelet side of the connection between a weavelet and its envelope. The connection uses (r,w) to carry messages. Synthesized high-level events are passed to h.

NewWeaveletConn blocks until it receives a protos.Weavelet from the envelope.

func (*WeaveletConn) ExportListenerRPC

func (*WeaveletConn) GetAddressRPC added in v0.1.2

func (d *WeaveletConn) GetAddressRPC(req *protos.GetAddressRequest) (*protos.GetAddressReply, error)

func (*WeaveletConn) GetComponentsToStartRPC

func (d *WeaveletConn) GetComponentsToStartRPC(info *protos.GetComponentsToStart) (*protos.ComponentsToStart, error)

GetComponentsToStartRPC is a blocking call to the envelope to send us a list of components to start.

func (*WeaveletConn) GetRoutingInfoRPC

func (d *WeaveletConn) GetRoutingInfoRPC(info *protos.GetRoutingInfo) (*protos.RoutingInfo, error)

GetRoutingInfoRPC requests the envelope to send us the latest routing info.

func (*WeaveletConn) RegisterReplicaRPC

func (d *WeaveletConn) RegisterReplicaRPC(replica *protos.ReplicaToRegister) error

RegisterReplicaRPC requests the envelope to register the given replica.

func (*WeaveletConn) ReportLoadRPC

func (d *WeaveletConn) ReportLoadRPC(load *protos.WeaveletLoadReport) error

ReportLoadRPC reports the given load to the envelope.

func (*WeaveletConn) Run

func (d *WeaveletConn) Run() error

Run interacts with the peer. Messages that are received are handled as an ordered sequence.

func (*WeaveletConn) SendLogEntry

func (d *WeaveletConn) SendLogEntry(entry *protos.LogEntry) error

SendLogEntry sends a log entry to the envelope, without waiting for a reply.

func (*WeaveletConn) SendTraceSpans

func (d *WeaveletConn) SendTraceSpans(spans *protos.Spans) error

SendTraceSpans sends a set of trace spans to the envelope, without waiting for a reply.

func (*WeaveletConn) StartColocationGroupRPC

func (d *WeaveletConn) StartColocationGroupRPC(group *protos.ColocationGroup) error

StartColocationGroupRPC requests the envelope to start the given colocation group.

func (*WeaveletConn) StartComponentRPC

func (d *WeaveletConn) StartComponentRPC(componentToStart *protos.ComponentToStart) error

StartComponentRPC requests the envelope to start the given component.

func (*WeaveletConn) Weavelet

func (d *WeaveletConn) Weavelet() *protos.WeaveletInfo

Weavelet returns the protos.Weavelet for this weavelet.

Jump to

Keyboard shortcuts

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