srpcconsul

package
v0.0.0-...-b729584 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Consul KV structure services/{group}/{service}/{version}

Consul Service Structure {group}-{service.replace('.','-')}-{version}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetServiceKeyPrefix

func GetServiceKeyPrefix(c srpc.ServiceCoordinate) string

Prefix of service kv store

func GetServiceMeta

func GetServiceMeta(c srpc.ServiceCoordinate) map[string]string

func GetServiceName

func GetServiceName(c srpc.ServiceCoordinate) string

Name of service

func GetServiceSelector

func GetServiceSelector(c srpc.ServiceCoordinate) (serviceName string, tags []string)

func GetServiceTags

func GetServiceTags(c srpc.ServiceCoordinate) []string

Types

type Configurer

type Configurer interface {
	Run() error // blocked run
	Ready() <-chan struct{}
	IsReady() bool
	Stop()
}

func NewServiceConfigurer

func NewServiceConfigurer(opts ServiceConfigurerOptions) (Configurer, error)

type KeyValueChangeWatcher

type KeyValueChangeWatcher struct {
	Client       *consulapi.Client
	QueryOptions *consulapi.QueryOptions
	Key          string
	Wait         time.Duration

	Value func([]byte)
	Ready func()

	Logger kitlog.Logger
	// contains filtered or unexported fields
}

func (*KeyValueChangeWatcher) Stop

func (r *KeyValueChangeWatcher) Stop()

func (*KeyValueChangeWatcher) Watch

func (r *KeyValueChangeWatcher) Watch()

type ServiceConfigurerOptions

type ServiceConfigurerOptions struct {
	Client            *consulapi.Client
	Service           interface{}
	ServiceCoordinate srpc.ServiceCoordinate // override
	Logger            kitlog.Logger

	Conf  interface{}
	State interface{}
}

type StateChangeWatcher

type StateChangeWatcher struct {
	Value interface{}
	Wait  time.Duration

	Change func([]byte)
	Ready  func()

	Logger kitlog.Logger
	// contains filtered or unexported fields
}

func (*StateChangeWatcher) Stop

func (r *StateChangeWatcher) Stop()

func (*StateChangeWatcher) Watch

func (r *StateChangeWatcher) Watch()

Jump to

Keyboard shortcuts

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