aws-sdk-go: Index | Files

package crr

import ""


Package Files

cache.go endpoint.go sync_map.go

func BuildEndpointKey Uses

func BuildEndpointKey(params map[string]*string) string

BuildEndpointKey will sort the keys in alphabetical order and then retrieve the values in that order. Those values are then concatenated together to form the endpoint key.

type Discoverer Uses

type Discoverer interface {
    Discover() (Endpoint, error)

Discoverer is an interface used to discovery which endpoint hit. This allows for specifics about what parameters need to be used to be contained in the Discoverer implementor.

type Endpoint Uses

type Endpoint struct {
    Key       string
    Addresses WeightedAddresses

Endpoint represents an endpoint used in endpoint discovery.

func (*Endpoint) Add Uses

func (e *Endpoint) Add(addr WeightedAddress)

Add will add a given WeightedAddress to the address list of Endpoint.

func (*Endpoint) GetValidAddress Uses

func (e *Endpoint) GetValidAddress() (WeightedAddress, bool)

GetValidAddress will return a non-expired weight endpoint

func (*Endpoint) Len Uses

func (e *Endpoint) Len() int

Len returns the number of valid endpoints where valid means the endpoint has not expired.

type EndpointCache Uses

type EndpointCache struct {
    // contains filtered or unexported fields

EndpointCache is an LRU cache that holds a series of endpoints based on some key. The datastructure makes use of a read write mutex to enable asynchronous use.

func NewEndpointCache Uses

func NewEndpointCache(endpointLimit int64) *EndpointCache

NewEndpointCache will return a newly initialized cache with a limit of endpointLimit entries.

func (*EndpointCache) Add Uses

func (c *EndpointCache) Add(endpoint Endpoint)

Add is a concurrent safe operation that will allow new endpoints to be added to the cache. If the cache is full, the number of endpoints equal endpointLimit, then this will remove the oldest entry before adding the new endpoint.

func (*EndpointCache) Get Uses

func (c *EndpointCache) Get(d Discoverer, endpointKey string, required bool) (WeightedAddress, error)

Get will retrieve a weighted address based off of the endpoint key. If an endpoint should be retrieved, due to not existing or the current endpoint has expired the Discoverer object that was passed in will attempt to discover a new endpoint and add that to the cache.

func (*EndpointCache) Has Uses

func (c *EndpointCache) Has(endpointKey string) bool

Has returns if the enpoint cache contains a valid entry for the endpoint key provided.

type WeightedAddress Uses

type WeightedAddress struct {
    URL     *url.URL
    Expired time.Time

WeightedAddress represents an address with a given weight.

func (WeightedAddress) HasExpired Uses

func (e WeightedAddress) HasExpired() bool

HasExpired will return whether or not the endpoint has expired with the exception of a zero expiry meaning does not expire.

type WeightedAddresses Uses

type WeightedAddresses []WeightedAddress

WeightedAddresses represents a list of WeightedAddress.

Package crr imports 7 packages (graph) and is imported by 19 packages. Updated 2018-11-28. Refresh now. Tools for package owners.