discovery

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServicePrefix    = "service"
	ServiceNodeIDKey = "node_id"
)

Variables

This section is empty.

Functions

func Init

func Init()

Types

type Debug added in v2.0.2

type Debug struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Debug) Close added in v2.0.2

func (m *Debug) Close()

Close the provider connection.

func (*Debug) Get added in v2.0.2

func (m *Debug) Get(key string, dir bool) (*discovery.KVPairs, error)

Get the value of the specified key or directory.

func (*Debug) Incr added in v2.0.2

func (m *Debug) Incr(key string) (int64, error)

Incr invokes an atomic value increase for the specified key.

func (*Debug) KeepAlive added in v2.0.2

func (m *Debug) KeepAlive(key, value string, ttl time.Duration) error

KeepAlive sets value and updates the ttl for the specified key.

func (*Debug) Set added in v2.0.2

func (m *Debug) Set(key, value string, ttl time.Duration) error

Set value for the specified key with a specified ttl.

func (*Debug) Type added in v2.0.2

func (m *Debug) Type() string

Type returns the backend provider type.

func (*Debug) Watch added in v2.0.2

func (m *Debug) Watch(key string, _ uint64, dir bool) (discovery.EventChan, error)

Watch for changes of the specified key or directory.

type Discovery added in v2.0.2

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

func (*Discovery) GetAddresses added in v2.0.2

func (m *Discovery) GetAddresses(service string) []resolver.Address

GetAddresses returns rpc service addresses.

func (*Discovery) PassthroughAddr added in v2.0.2

func (m *Discovery) PassthroughAddr(component string) (int64, string)

PassthroughAddr returns service unique ID and rpc address registered for the component.

func (*Discovery) Register added in v2.0.2

func (m *Discovery) Register(component, addr string, opts ...discovery.Option) (int64, error)

Register rpc address of the component node.

type NodeInfo added in v2.0.2

type NodeInfo struct {
	TTL      time.Duration     `json:"ttl,omitempty"`
	UniqueID int64             `json:"unique_id,omitempty"`
	Service  string            `json:"service,omitempty"`
	Address  string            `json:"address,omitempty"`
	Metadata map[string]string `json:"metadata,omitempty"`
}

func (*NodeInfo) String added in v2.0.2

func (info *NodeInfo) String() string

Jump to

Keyboard shortcuts

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