connection

package
v0.20.14 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//Event_CONNECTION_CLOSE connection close event type
	Event_CONNECTION_CLOSE exe.Event_Type = 1024
)

Variables

This section is empty.

Functions

func NewReader

func NewReader(r io.Reader) io.Reader

NewReader returns an io.Reader that unpacks the data read from r out of RecordIO framing before returning it.

Types

type Connection

type Connection interface {
	//Install mount an handler based on incoming message name.
	Install(eventType exe.Event_Type, dispatch DispatchFunc) error

	//TLSConfig setting TLS Connection to remote server
	TLSConfig(config *tls.Config, handshakeTimeout time.Duration)

	//Start starts the Connection to remote server.
	Start(endpoint string, path string) error

	//Stop kills the transporter.
	Stop(graceful bool)

	//Send sends message to remote process. Will stop sending when Connection is stopped.
	//if aliveLoop is true, keep connection alive for incomming package
	Send(call *exe.Call, aliveLoop bool) error

	//Recv receives message initialtively
	Recv() (*exe.Event, error)

	//GetConnStatus return connection status
	GetConnStatus() Status
}

Connection maintain http connection with Mesos slave

func NewConnection

func NewConnection() Connection

NewConnection return Connection

func NewFakeConnection

func NewFakeConnection() Connection

NewFakeConnection return Connection

type DispatchFunc

type DispatchFunc func(from *upid.UPID, event *exe.Event)

DispatchFunc dispatch event message to HandleFunc

type FakeConnection

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

FakeConnection is a proxy Connection for testing Executor message register, runTaskGroup, shutdown

func (*FakeConnection) GetConnStatus

func (httpConn *FakeConnection) GetConnStatus() Status

GetConnStatus return connection status

func (*FakeConnection) Install

func (httpConn *FakeConnection) Install(eventType exe.Event_Type, dispatch DispatchFunc) error

Install mount an handler based on incoming message name.

func (*FakeConnection) Recv

func (httpConn *FakeConnection) Recv() (*exe.Event, error)

Recv receives message initialtively

func (*FakeConnection) Send

func (httpConn *FakeConnection) Send(call *exe.Call, keepAlive bool) error

Send sends message to remote process. Will stop sending when Connection is stopped. if aliveLoop is true, keep connection alive for incomming package, when new message coming, dispatch message to installed callback handlerFunc

func (*FakeConnection) Start

func (httpConn *FakeConnection) Start(endpoint string, path string) error

Start starts the Connection to remote server. endpoint: remote endpoint url info, like mesos-slave:8080, mesos-slave:8080 path: remote, like /v1/executor

func (*FakeConnection) Stop

func (httpConn *FakeConnection) Stop(graceful bool)

Stop kills the transporter.

func (*FakeConnection) TLSConfig

func (httpConn *FakeConnection) TLSConfig(config *tls.Config, handshakeTimeout time.Duration)

TLSConfig setting TLS Connection to remote server

type HTTPConnection

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

HTTPConnection implement Connection interface communicate mesos slave

func (*HTTPConnection) GetConnStatus

func (httpConn *HTTPConnection) GetConnStatus() Status

GetConnStatus return connection status

func (*HTTPConnection) Install

func (httpConn *HTTPConnection) Install(eventType exe.Event_Type, dispatch DispatchFunc) error

Install mount an handler based on incoming message name.

func (*HTTPConnection) Recv

func (httpConn *HTTPConnection) Recv() (*exe.Event, error)

Recv receives message initialtively

func (*HTTPConnection) Send

func (httpConn *HTTPConnection) Send(call *exe.Call, keepAlive bool) error

Send sends message to remote process. Will stop sending when Connection is stopped. if aliveLoop is true, keep connection alive for incomming package, when new message coming, dispatch message to installed callback handlerFunc

func (*HTTPConnection) Start

func (httpConn *HTTPConnection) Start(endpoint string, path string) error

Start starts the Connection to remote server. endpoint: remote endpoint url info, like mesos-slave:8080, mesos-slave:8080 path: remote, like /v1/executor

func (*HTTPConnection) Stop

func (httpConn *HTTPConnection) Stop(graceful bool)

Stop kills the transporter.

func (*HTTPConnection) TLSConfig

func (httpConn *HTTPConnection) TLSConfig(config *tls.Config, handshakeTimeout time.Duration)

TLSConfig setting TLS Connection to remote server

type HandleFunc

type HandleFunc func(from *upid.UPID, msg proto.Message)

HandleFunc handlefunc is call back for receiving message from: Message from server msg: receiving message

type Message

type Message struct {
	UPID  *upid.UPID //remote server
	URI   string     //remote uri
	Name  string     //message name
	Bytes []byte     //json bytes
}

Message defines the type that passes in the ExecutorDriver.

type Status

type Status int

Status status for Connection

const (
	//NOTCONNECT init status for Connection
	NOTCONNECT Status = iota
	//DISCONNECT if connection is broken, set to DISCONNECT
	DISCONNECT
	//CONNECTED connection is OK
	CONNECTED
	//STOPPED connection is stop
	STOPPED
)

Jump to

Keyboard shortcuts

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