service

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ControlRegister

type ControlRegister interface {
	RegisterGetEdgeID(ctx context.Context, getEdgeID GetEdgeID) error
	RegisterEdgeOnline(ctx context.Context, edgeOnline EdgeOnline) error
	RegisterEdgeOffline(ctx context.Context, edgeOffline EdgeOffline) error
}

type Delegate

type Delegate delegate.ClientDelegate

type Dialer

type Dialer func() (net.Conn, error)

type EdgeOffline

type EdgeOffline func(edgeID uint64, meta []byte, addr net.Addr) error

type EdgeOnline

type EdgeOnline func(edgeID uint64, meta []byte, addr net.Addr) error

type GetEdgeID

type GetEdgeID func(meta []byte) (uint64, error)

Controller functions

type Logger

type Logger log.Logger

type Messager

type Messager interface {
	NewMessage(data []byte) geminio.Message

	Publish(ctx context.Context, edgeID uint64, msg geminio.Message) error
	PublishAsync(ctx context.Context, edgeID uint64, msg geminio.Message, ch chan *geminio.Publish) (*geminio.Publish, error)
	Receive(ctx context.Context) (geminio.Message, error)
}

Messager is edge oriented

type Multiplexer

type Multiplexer interface {
	// Open a stream to specific edgeID
	OpenStream(ctx context.Context, edgeID uint64) (geminio.Stream, error)
	AcceptStream() (geminio.Stream, error)
	ListStreams() []geminio.Stream
}

Stream multiplexer

type RPCMessager

type RPCMessager interface {
	RPCer
	Messager
}

type RPCer

type RPCer interface {
	NewRequest(data []byte) geminio.Request

	Call(ctx context.Context, edgeID uint64, method string, req geminio.Request) (geminio.Response, error)
	CallAsync(ctx context.Context, edgeID uint64, method string, req geminio.Request, ch chan *geminio.Call) (*geminio.Call, error)
	Register(ctx context.Context, method string, rpc geminio.RPC) error
}

RPCer is edge and it's method oriented

type Service

type Service interface {
	// Service can direct Message or RPC
	RPCMessager

	// Service can manage streams from or to a Edge
	Multiplexer

	// Service is a net.Listener, actually it's wrapper of Multiplexer
	// The Accept is a wrapper for AcceptStream
	// The Addr is a wrapper for LocalAddr
	net.Listener

	// Service can register some control functions that be called by frontier when edge updated
	ControlRegister

	Close() error
}

Service

func NewClusterService added in v1.1.0

func NewClusterService(frontlasAddr string, opts ...ServiceOption) (Service, error)

call this function when you deploy a frontier cluster

func NewService

func NewService(dialer Dialer, opts ...ServiceOption) (Service, error)

the service field specific the role for this Service, and then Edge can OpenStream to this service

type ServiceOption

type ServiceOption func(*serviceOption)

func OptionServiceBufferSize added in v1.1.0

func OptionServiceBufferSize(read, write int) ServiceOption

func OptionServiceDelegate

func OptionServiceDelegate(delegate Delegate) ServiceOption

delegations for the service own connection, streams and more

func OptionServiceID added in v1.1.0

func OptionServiceID(serviceID uint64) ServiceOption

func OptionServiceLog

func OptionServiceLog(logger Logger) ServiceOption

func OptionServiceName

func OptionServiceName(service string) ServiceOption

func OptionServiceReceiveTopics

func OptionServiceReceiveTopics(topics []string) ServiceOption

func OptionServiceTimer

func OptionServiceTimer(tmr Timer) ServiceOption

Pre set timer for the sdk

type Timer

type Timer timer.Timer

Jump to

Keyboard shortcuts

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