cache

package
v1.1.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2019 License: MPL-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(ctx context.Context, logger hclog.Logger, proxier Proxier, inmemSink sink.Sink) http.Handler

func ServerListener

func ServerListener(lnConfig *config.Listener, logger io.Writer, ui cli.Ui) (net.Listener, map[string]string, reload.ReloadFunc, error)

Types

type APIProxy

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

APIProxy is an implementation of the proxier interface that is used to forward the request to Vault and get the response.

func (*APIProxy) Send

func (ap *APIProxy) Send(ctx context.Context, req *SendRequest) (*SendResponse, error)

type APIProxyConfig

type APIProxyConfig struct {
	Client *api.Client
	Logger hclog.Logger
}

type ContextInfo

type ContextInfo struct {
	Ctx        context.Context
	CancelFunc context.CancelFunc
	DoneCh     chan struct{}
}

ContextInfo holds a derived context and cancelFunc pair.

type LeaseCache

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

LeaseCache is an implementation of Proxier that handles the caching of responses. It passes the incoming request to an underlying Proxier implementation.

func NewLeaseCache

func NewLeaseCache(conf *LeaseCacheConfig) (*LeaseCache, error)

NewLeaseCache creates a new instance of a LeaseCache.

func (*LeaseCache) HandleCacheClear

func (c *LeaseCache) HandleCacheClear(ctx context.Context) http.Handler

HandleCacheClear returns a handlerFunc that can perform cache clearing operations.

func (*LeaseCache) Send

func (c *LeaseCache) Send(ctx context.Context, req *SendRequest) (*SendResponse, error)

Send performs a cache lookup on the incoming request. If it's a cache hit, it will return the cached response, otherwise it will delegate to the underlying Proxier and cache the received response.

type LeaseCacheConfig

type LeaseCacheConfig struct {
	Client      *api.Client
	BaseContext context.Context
	Proxier     Proxier
	Logger      hclog.Logger
}

LeaseCacheConfig is the configuration for initializing a new Lease.

type Proxier

type Proxier interface {
	Send(ctx context.Context, req *SendRequest) (*SendResponse, error)
}

Proxier is the interface implemented by different components that are responsible for performing specific tasks, such as caching and proxying. All these tasks combined together would serve the request received by the agent.

func NewAPIProxy

func NewAPIProxy(config *APIProxyConfig) (Proxier, error)

type SendRequest

type SendRequest struct {
	Token       string
	Request     *http.Request
	RequestBody []byte
}

SendRequest is the input for Proxier.Send.

type SendResponse

type SendResponse struct {
	Response     *api.Response
	ResponseBody []byte
}

SendResponse is the output from Proxier.Send.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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