discovery

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLeaseInSeconds = 3

DefaultLeaseInSeconds is the default lease time in seconds.

Variables

This section is empty.

Functions

func Discover

func Discover(cli *clientv3.Client, clusterID, serviceName string) ([]string, error)

Discover is used to get all the service instances of the specified service name.

func TSOPath

func TSOPath(clusterID uint64) string

TSOPath returns the path to store TSO addresses.

Types

type ServiceRegister

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

ServiceRegister is used to register the service to etcd.

func NewServiceRegister

func NewServiceRegister(ctx context.Context, cli *clientv3.Client, clusterID, serviceName, serviceAddr, serializedValue string, ttl int64) *ServiceRegister

NewServiceRegister creates a new ServiceRegister.

func (*ServiceRegister) Deregister

func (sr *ServiceRegister) Deregister() error

Deregister deregisters the service from etcd.

func (*ServiceRegister) Register

func (sr *ServiceRegister) Register() error

Register registers the service to etcd.

type ServiceRegistryEntry

type ServiceRegistryEntry struct {
	ServiceAddr string `json:"serviceAddr"`
}

ServiceRegistryEntry is the registry entry of a service

func (*ServiceRegistryEntry) Deserialize

func (e *ServiceRegistryEntry) Deserialize(data []byte) error

Deserialize the data to this service registry entry

func (*ServiceRegistryEntry) Serialize

func (e *ServiceRegistryEntry) Serialize() (serializedValue string, err error)

Serialize this service registry entry

Jump to

Keyboard shortcuts

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