configuratorapi

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package configuratorapi implements the public API of the configurator.core microservice, including clients and data structures.

The Configurator is a core microservice that centralizes the dissemination of configuration values to other microservices.

Index

Constants

View Source
const Hostname = "configurator.core"

Hostname is the default hostname of the microservice: configurator.core.

Variables

View Source
var (
	URLOfValues  = httpx.JoinHostAndPath(Hostname, `:443/values`)
	URLOfRefresh = httpx.JoinHostAndPath(Hostname, `:443/refresh`)
	URLOfSync    = httpx.JoinHostAndPath(Hostname, `:443/sync`)
)

Fully-qualified URLs of the microservice's endpoints.

Functions

This section is empty.

Types

type Client

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

Client is an interface to calling the endpoints of the configurator.core microservice. This simple version is for unicast calls.

func NewClient

func NewClient(caller service.Publisher) *Client

NewClient creates a new unicast client to the configurator.core microservice.

func (*Client) ForHost

func (_c *Client) ForHost(host string) *Client

ForHost replaces the default hostname of this client.

func (*Client) Refresh

func (_c *Client) Refresh(ctx context.Context) (err error)

Refresh tells all microservices to contact the configurator and refresh their configs. An error is returned if any of the values sent to the microservices fails validation.

func (*Client) Sync

func (_c *Client) Sync(ctx context.Context, timestamp time.Time, values map[string]map[string]string) (err error)

Sync is used to synchronize values among replica peers of the configurator.

func (*Client) Values

func (_c *Client) Values(ctx context.Context, names []string) (values map[string]string, err error)

Values returns the values associated with the specified config property names for the caller microservice.

type MulticastClient

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

MulticastClient is an interface to calling the endpoints of the configurator.core microservice. This advanced version is for multicast calls.

func NewMulticastClient

func NewMulticastClient(caller service.Publisher) *MulticastClient

NewMulticastClient creates a new multicast client to the configurator.core microservice.

func (*MulticastClient) ForHost

func (_c *MulticastClient) ForHost(host string) *MulticastClient

ForHost replaces the default hostname of this client.

func (*MulticastClient) Refresh

func (_c *MulticastClient) Refresh(ctx context.Context) <-chan *RefreshResponse

Refresh tells all microservices to contact the configurator and refresh their configs. An error is returned if any of the values sent to the microservices fails validation.

func (*MulticastClient) Sync

func (_c *MulticastClient) Sync(ctx context.Context, timestamp time.Time, values map[string]map[string]string) <-chan *SyncResponse

Sync is used to synchronize values among replica peers of the configurator.

func (*MulticastClient) Values

func (_c *MulticastClient) Values(ctx context.Context, names []string) <-chan *ValuesResponse

Values returns the values associated with the specified config property names for the caller microservice.

type RefreshIn

type RefreshIn struct {
}

RefreshIn are the input arguments of Refresh.

type RefreshOut

type RefreshOut struct {
}

RefreshOut are the return values of Refresh.

type RefreshResponse

type RefreshResponse struct {
	HTTPResponse *http.Response
	// contains filtered or unexported fields
}

RefreshResponse is the response to Refresh.

func (*RefreshResponse) Get

func (_out *RefreshResponse) Get() (err error)

Get retrieves the return values.

type SyncIn

type SyncIn struct {
	Timestamp time.Time                    `json:"timestamp"`
	Values    map[string]map[string]string `json:"values"`
}

SyncIn are the input arguments of Sync.

type SyncOut

type SyncOut struct {
}

SyncOut are the return values of Sync.

type SyncResponse

type SyncResponse struct {
	HTTPResponse *http.Response
	// contains filtered or unexported fields
}

SyncResponse is the response to Sync.

func (*SyncResponse) Get

func (_out *SyncResponse) Get() (err error)

Get retrieves the return values.

type ValuesIn

type ValuesIn struct {
	Names []string `json:"names"`
}

ValuesIn are the input arguments of Values.

type ValuesOut

type ValuesOut struct {
	Values map[string]string `json:"values"`
}

ValuesOut are the return values of Values.

type ValuesResponse

type ValuesResponse struct {
	HTTPResponse *http.Response
	// contains filtered or unexported fields
}

ValuesResponse is the response to Values.

func (*ValuesResponse) Get

func (_out *ValuesResponse) Get() (values map[string]string, err error)

Get retrieves the return values.

Jump to

Keyboard shortcuts

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