Documentation
¶
Overview ¶
Package kvstore provides a registry plugin based on a key-value store.
Index ¶
- Constants
- Variables
- func Provide(datas map[string]any, _ *types.Components, logger log.Logger, ...) (registry.Type, error)
- func WithDatabase(n string) registry.Option
- func WithNoCache() registry.Option
- func WithServiceDelimiter(n string) registry.Option
- func WithTTL(n time.Duration) registry.Option
- func WithTable(n string) registry.Option
- type Config
- type Registry
- func (c *Registry) Deregister(ctx context.Context, serviceNode registry.ServiceNode) error
- func (c *Registry) GetService(ctx context.Context, namespace, region, name string, schemes []string) ([]registry.ServiceNode, error)
- func (c *Registry) ListServices(ctx context.Context, namespace, region string, schemes []string) ([]registry.ServiceNode, error)
- func (c *Registry) Register(ctx context.Context, serviceNode registry.ServiceNode) error
- func (c *Registry) Start(ctx context.Context) error
- func (c *Registry) Stop(ctx context.Context) error
- func (c *Registry) String() string
- func (c *Registry) Type() string
- func (c *Registry) Watch(_ context.Context, _ ...registry.WatchOption) (registry.Watcher, error)
- type Watcher
Constants ¶
View Source
const Name = "kvstore"
Name provides the name of this registry.
Variables ¶
View Source
var ( // DefaultServiceDelimiter is the default delimiter used to separate service name and version. DefaultServiceDelimiter = "@" // DefaultDatabase is the default database name. DefaultDatabase = "service-registry" // DefaultTable is the default table name. DefaultTable = "service-registry" // DefaultTTL is the default time after which a node is considered stale. DefaultTTL = 10 * time.Millisecond // DefaultCache enables caching. DefaultCache = true )
Functions ¶
func Provide ¶
func Provide( datas map[string]any, _ *types.Components, logger log.Logger, opts ...registry.Option, ) (registry.Type, error)
Provide creates a new memory registry.
func WithDatabase ¶
WithDatabase sets the database name.
func WithServiceDelimiter ¶
WithServiceDelimiter sets the service delimiter.
Types ¶
type Config ¶
type Config struct {
registry.Config `yaml:",inline"`
// ServiceDelimiter is the delimiter used to separate service name and version.
ServiceDelimiter string `json:"serviceDelimiter" yaml:"serviceDelimiter"`
// TTL is the time after which a node is considered stale.
TTL config.Duration `json:"ttl" yaml:"ttl"`
// Database is the database name in the kvstore.
Database string `json:"database" yaml:"database"`
// Table is the table name in the kvstore.
Table string `json:"table" yaml:"table"`
// Cache enables/disables caching.
Cache bool `json:"cache" yaml:"cache"`
}
Config provides configuration for the memory registry.
func (*Config) ApplyOptions ¶
ApplyOptions applies a set of options to the config.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is the memory registry for go-orb.
func (*Registry) Deregister ¶
Deregister deregisters a service within the registry.
func (*Registry) GetService ¶
func (c *Registry) GetService(ctx context.Context, namespace, region, name string, schemes []string) ([]registry.ServiceNode, error)
GetService returns a service from the registry.
func (*Registry) ListServices ¶
func (c *Registry) ListServices(ctx context.Context, namespace, region string, schemes []string) ([]registry.ServiceNode, error)
ListServices lists services within the registry.
Click to show internal directories.
Click to hide internal directories.