edge

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialer

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

type Edge

type Edge interface {
	// Edge can directly Publish Message or Call RPC
	RPCMessager

	// Edge can manage(create, list...) streams from or to a Service
	Multiplexer

	// Edge is a net.Listener, actually it's wrapper of Multiplexer
	// The Accept function is a wrapper from AccetpStream
	// The Addr is a wrapper from LocalAddr
	net.Listener

	// Meta
	EdgeID() uint64

	Close() error
}

func NewEdge

func NewEdge(dialer Dialer, opts ...EdgeOption) (Edge, error)

func NewNoRetryEdge added in v1.1.0

func NewNoRetryEdge(dialer Dialer, opts ...EdgeOption) (Edge, error)

type EdgeOption

type EdgeOption func(*edgeOption)

func OptionEdgeID

func OptionEdgeID(edgeID uint64) EdgeOption

Pre set EdgeID for the sdk

func OptionEdgeLog

func OptionEdgeLog(logger Logger) EdgeOption

func OptionEdgeMeta

func OptionEdgeMeta(meta []byte) EdgeOption

func OptionEdgeTimer

func OptionEdgeTimer(tmr Timer) EdgeOption

Pre set timer for the sdk

func OptionServiceBufferSize added in v1.1.0

func OptionServiceBufferSize(read, write int) EdgeOption

type Logger

type Logger log.Logger

type Messager

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

	// Publish a message to specific topic
	Publish(ctx context.Context, topic string, msg geminio.Message) error
	// Publish async a message to specific topic
	PublishAsync(ctx context.Context, topic string, msg geminio.Message, ch chan *geminio.Publish) (*geminio.Publish, error)
	Receive(ctx context.Context) (geminio.Message, error)
}

Messager is topic oriented

type Multiplexer

type Multiplexer interface {
	// Open a stream to a specific service
	OpenStream(serviceName string) (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, method string, req geminio.Request) (geminio.Response, error)
	CallAsync(ctx context.Context, method string, req geminio.Request, ch chan *geminio.Call) (*geminio.Call, error)
	Register(ctx context.Context, method string, rpc geminio.RPC) error
}

RPCer is method oriented

type Timer

type Timer timer.Timer

Jump to

Keyboard shortcuts

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