registry

package
v0.0.0-...-3bc3b58 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Discovery

type Discovery interface {
	// GetService return the service instances according to the service name.
	GetService(ctx context.Context, opts ...ServiceOption) ([]*ServiceInstance, error)
}

Discovery is service discovery.

type IP

type IP struct {
	PublicIP  string `json:"public_ip"`
	PrivateIP string `json:"private_ip"`
}

type Port

type Port struct {
	PublicPort  uint16 `json:"public_port"`
	PrivatePort uint16 `json:"private_port"`
}

type Registrar

type Registrar interface {
	// Register the registration.
	Register(ctx context.Context, service *ServiceInstance) error
	// Deregister the registration.
	Deregister(ctx context.Context, service *ServiceInstance) error

	//HealthCheck the registration.
	HealthCheck(service *ServiceInstance)
}

Registrar is service registrar.

type Service

type Service struct {
	Name      string            `json:"name"`
	Namespace string            `json:"namespace"`
	Labels    map[string]string `json:"labels"`
}

type ServiceInstance

type ServiceInstance struct {
	Service
	IP   IP
	Port Port
	ID   string `json:"id"`
}

func NewServiceInstance

func NewServiceInstance(namespace string, name string, id string, privateIP string, privatePort uint16, publicIP string, publicPort uint16) *ServiceInstance

type ServiceOption

type ServiceOption func(*ServiceInstance)

func WithNamespace

func WithNamespace(namespace string) ServiceOption

func WithPrivateIP

func WithPrivateIP(privateIP string) ServiceOption

func WithPrivatePort

func WithPrivatePort(privatePort uint16) ServiceOption

Jump to

Keyboard shortcuts

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