router

package
v0.21.2 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Options)

Option options' of registing service functions

func Heartbeat

func Heartbeat(hb time.Duration) Option

func ID

func ID(id string) Option

func RetryTimes

func RetryTimes(rTimes uint32) Option

func TTL

func TTL(ttl time.Duration) Option

type Options

type Options struct {
	ID string

	TTL time.Duration

	Heartbeat time.Duration

	RetryTimes uint32
}

Options regist service Options

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns router default options

type ReadOption

type ReadOption func(o *ReadOptions)

func ReadKeys

func ReadKeys(keys ...string) ReadOption

ReadKeys if need keys for node

func ReadService

func ReadService(s *service.Service) ReadOption

ReadService sets the service to read from the table

type ReadOptions

type ReadOptions struct {
	Service *service.Service
	Keys    []string
}

type Router

type Router interface {
	service.LifeCycle

	// // Caller handle serving messages
	// type Caller interface {
	// Remote for handler TODO
	GetServiceNodes(...ReadOption) ([]*node.Node, error) // []*node.Node || component

	// // Registry router registry
	// type Registry interface {
	RegisterRegistry(string, registry.Registry) error
	DeregisterRegistry(string) error

	RegisterService(string, *service.Service, ...registry.RegisterOption) error
	DeregisterService(string, *service.Service, ...registry.DeregisterOption) error
	WatchService(string, ...registry.WatchOption) error
}

Router router

Jump to

Keyboard shortcuts

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