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 ¶
type Client interface {
Fetch(context.Context, *pbgo.ClientLatestConfigsRequest) (*pbgo.LatestConfigsResponse, error)
}
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 ¶
func (c *HTTPClient) Fetch(ctx context.Context, request *pbgo.ClientLatestConfigsRequest) (*pbgo.LatestConfigsResponse, error)
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 ¶
Service defines the remote config management service responsible for fetching, storing and dispatching the configurations
func NewService ¶
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) RegisterSubscriber ¶
func (s *Service) RegisterSubscriber(subscriber *Subscriber)
RegisterSubscriber registers a new subscriber for a product's configurations
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