service

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: Apache-2.0 Imports: 27 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGRPCSubscriber

func NewGRPCSubscriber(product pbgo.Product, callback SubscriberCallback) (context.CancelFunc, error)

NewGRPCSubscriber returns a new gRPC stream based subscriber.

Types

type Client

Client is the interface to implement for a configuration fetcher

type HTTPClient

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

HTTPClient fetches configurations using HTTP requests

func NewHTTPClient

func NewHTTPClient(baseURL, apiKey, appKey, hostname string) *HTTPClient

NewHTTPClient returns a new HTTP configuration client

func (*HTTPClient) Fetch

Fetch remote configuration

type Opts

type Opts struct {
	URL                    string
	APIKey                 string
	RemoteConfigurationKey string
	Hostname               string
	DBPath                 string
	RefreshInterval        time.Duration
	MaxBucketSize          int
	ReadOnly               bool
}

Opts defines the remote config service options

type Service

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

Service defines the remote config management service responsible for fetching, storing and dispatching the configurations

func NewService

func NewService(opts Opts) (*Service, error)

NewService instantiates a new remote configuration management service

func (*Service) GetConfigs

func (s *Service) GetConfigs(product string) ([]*pbgo.ConfigResponse, error)

GetConfigs returns config for the given product

func (*Service) GetStore

func (s *Service) GetStore() *store.Store

GetStore returns the configuration store

func (*Service) RegisterSubscriber

func (s *Service) RegisterSubscriber(subscriber *Subscriber)

RegisterSubscriber registers a new subscriber for a product's configurations

func (*Service) Start

func (s *Service) Start(ctx context.Context) error

Start the remote configuration management service

func (*Service) UnregisterSubscriber

func (s *Service) UnregisterSubscriber(unregister *Subscriber)

UnregisterSubscriber unregisters a subscriber for a product's configurations

type Subscriber

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

Subscriber describes a product's configuration subscriber

func NewSubscriber

func NewSubscriber(product pbgo.Product, refreshRate time.Duration, callback SubscriberCallback) *Subscriber

NewSubscriber returns a new subscriber with the specified refresh rate and a callback

type SubscriberCallback

type SubscriberCallback func(config *pbgo.ConfigResponse) error

SubscriberCallback defines the function called when a new configuration was fetched

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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