threescale

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2019 License: Apache-2.0 Imports: 22 Imported by: 3

Documentation

Overview

nolint: lll

Index

Constants

View Source
const (
	// DefaultCacheTTL - Default time to wait before purging expired items from the cache
	DefaultCacheTTL = time.Duration(time.Minute * 5)

	// DefaultCacheRefreshBuffer - Default time difference to refresh the cache element before expiry time
	DefaultCacheRefreshBuffer = time.Duration(time.Minute * 3)

	// DefaultCacheLimit - Default max number of items that can be stored in the cache at any time
	DefaultCacheLimit = 1000

	// DefaultCacheUpdateRetries - Default number of additional attempts made to update cached entries for unreachable hosts
	DefaultCacheUpdateRetries = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AdapterConfig

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

AdapterConfig wraps optional configuration for the 3scale adapter

func NewAdapterConfig

func NewAdapterConfig(cache *ProxyConfigCache, metrics *prometheus.Reporter) *AdapterConfig

NewAdapterConfig - Creates configuration for Threescale adapter

type ProxyConfigCache

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

ProxyConfigCache provides a mechanism to enable caching of calls to 3scale system

func NewProxyConfigCache

func NewProxyConfigCache(cacheTTL time.Duration, refreshBuffer time.Duration, refreshRetries int, limit int) *ProxyConfigCache

NewProxyConfigCache returns a ProxyConfigCache The accepted parameters are cacheTTL - the time between when an entry is added to the cache and when it should expire, and limit - the total number of entries that can be stored in the cache at any given time.

func (*ProxyConfigCache) FlushCache

func (pc *ProxyConfigCache) FlushCache()

FlushCache iterates over the items in the cache and purges any expired items

func (*ProxyConfigCache) StartFlushWorker

func (pc *ProxyConfigCache) StartFlushWorker() error

StartFlushWorker starts a background process that periodically carries out the functionality provided by FlushCache

func (*ProxyConfigCache) StartRefreshWorker

func (pc *ProxyConfigCache) StartRefreshWorker() error

StartRefreshWorker starts a background process that periodically carries out the functionality provided by refreshCache

func (*ProxyConfigCache) StopFlushWorker

func (pc *ProxyConfigCache) StopFlushWorker() error

StopFlushWorker stops a background process started by StartFlushWorker if it has been started Returns an error if the background task is not running

func (*ProxyConfigCache) StopRefreshWorker

func (pc *ProxyConfigCache) StopRefreshWorker() error

StopRefreshWorker stops a background process started by StartRefreshWorker if it has been started Returns an error if the background task is not running

type Server

type Server interface {
	Addr() string
	Close() error
	Run(shutdown chan error)
}

Server interface - specifies the interface for gRPC server/adapter

func NewThreescale

func NewThreescale(addr string, client *http.Client, conf *AdapterConfig) (Server, error)

NewThreescale returns a Server interface

type Threescale

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

Threescale contains the Listener and the server

func (*Threescale) Addr

func (s *Threescale) Addr() string

Addr returns the Threescale addrs as a string

func (*Threescale) Close

func (s *Threescale) Close() error

Close stops the Threescale grpc Server

func (*Threescale) HandleAuthorization

HandleAuthorization takes care of the authorization request from mixer

func (*Threescale) Run

func (s *Threescale) Run(shutdown chan error)

Run starts the Threescale grpc Server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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