cache

package
v0.0.0-...-089673d Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reactor

type Reactor interface {
	Modified(key string, value []byte)
	Deleted(key string, value []byte)
}

Reactor is a type that can react to state changes on keys in a directory.

type Target

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

Target is an implementation of router.Targeter using the docker/libkv library for watching data in etcd, zookeeper, and consul.

func NewTarget

func NewTarget(path string, kvstore store.Store, log *zap.Logger) *Target

NewTarget instantiates a new Target, rooted at a particular location.

func (*Target) AsyncSubscribers

func (tc *Target) AsyncSubscribers(method, path string, eventType eventpkg.TypeName) []router.AsyncSubscriber

AsyncSubscribers is used for determining which functions is async subscribed to the event.

func (*Target) CORS

func (tc *Target) CORS(method, path string) *cors.CORS

CORS returns CORS configuration for method and path pair

func (*Target) EventType

func (tc *Target) EventType(space string, name eventpkg.TypeName) *eventpkg.Type

EventType takes a event type name and returns a deserialized instance of event type, if it exists

func (*Target) Function

func (tc *Target) Function(space string, id function.ID) *function.Function

Function takes a function ID and returns a deserialized instance of that function, if it exists

func (*Target) Shutdown

func (tc *Target) Shutdown()

Shutdown causes all state watchers to clean up their state.

func (*Target) SyncSubscriber

func (tc *Target) SyncSubscriber(method, path string, eventType eventpkg.TypeName) *router.SyncSubscriber

SyncSubscriber returns function space and ID for handling sync subscription. It also returns matched URL parameters in case of HTTP subscription containing parameters in path.

type Watcher

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

Watcher provides a means of watching for changes to interesting configuration in the backing database. It also maintains a cache of updates observed by a Reactive instance.

func NewWatcher

func NewWatcher(path string, kv store.Store, log *zap.Logger) *Watcher

NewWatcher instantiates a new Watcher.

func (*Watcher) React

func (w *Watcher) React(reactor Reactor, shutdown chan struct{})

React will watch for events on the PathWatcher's root directory, and call the Created/Modified/Deleted functions on a provided Reactive when changes are detected.

Jump to

Keyboard shortcuts

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