spacer

package
v0.0.0-...-9812a50 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2019 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const CONFIG_VERSION = 1
View Source
const DEFAULT_CONSUMER_GROUP = "spacer-$appName"
View Source
const DEFAULT_FUNCTION_INVOKER = "http://localhost:3000"
View Source
const DEFAULT_WRITE_PROXY_LISTEN = ":9065"

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type Application

type Application struct {
	Log             *log.Entry
	Triggers        map[Event][]*url.URL
	WorkerPool      *Pool
	ConsumerGroupID string
	Env             string
	// contains filtered or unexported fields
}

func NewApplication

func NewApplication(configFile string, env string) (*Application, error)

func (*Application) Brokers

func (app *Application) Brokers() []string

func (*Application) ConnString

func (app *Application) ConnString() string

func (*Application) EnvVar

func (app *Application) EnvVar() []string

func (*Application) FunctionInvoker

func (app *Application) FunctionInvoker() string

func (*Application) Invoke

func (app *Application) Invoke(msg Message)

func (*Application) InvokeFunc

func (app *Application) InvokeFunc(msg Message) error

For WorkerPool

func (*Application) LogStorageDriver

func (app *Application) LogStorageDriver() string

func (*Application) Name

func (app *Application) Name() string

func (*Application) Start

func (app *Application) Start(readyChan chan int, withWriteProxy bool) error

func (*Application) Topics

func (app *Application) Topics() []string

func (*Application) WriteProxyListen

func (app *Application) WriteProxyListen() string

type Config

type Config struct {
	*viper.Viper
}

func NewProjectConfig

func NewProjectConfig(path string) (*Config, error)

type Event

type Event string

type KafkaConsumer

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

func NewKafkaConsumer

func NewKafkaConsumer(app *Application) (*KafkaConsumer, error)

func (*KafkaConsumer) Close

func (kc *KafkaConsumer) Close() error

func (*KafkaConsumer) Poll

func (kc *KafkaConsumer) Poll(timeoutMs int) (*Message, error)

type KafkaProducer

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

func NewKafkaProducer

func NewKafkaProducer(app *Application) (*KafkaProducer, error)

func (*KafkaProducer) Close

func (kp *KafkaProducer) Close() error

func (*KafkaProducer) CreateTopics

func (kp *KafkaProducer) CreateTopics(topics []string) error

func (*KafkaProducer) Events

func (kp *KafkaProducer) Events() chan Message

func (*KafkaProducer) ProduceChannel

func (kp *KafkaProducer) ProduceChannel() chan Message

type LogStorageConsumer

type LogStorageConsumer interface {
	Poll(int) (*Message, error)

	Close() error
}

type LogStorageProducer

type LogStorageProducer interface {
	CreateTopics([]string) error

	Events() chan Message
	ProduceChannel() chan Message

	Close() error
}

type MemoryConsumer

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

func NewMemoryConsumer

func NewMemoryConsumer() *MemoryConsumer

func (*MemoryConsumer) Close

func (mc *MemoryConsumer) Close() error

func (*MemoryConsumer) Poll

func (mc *MemoryConsumer) Poll(timeoutMs int) (*Message, error)

type MemoryProducer

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

func NewMemoryProducer

func NewMemoryProducer() *MemoryProducer

func (*MemoryProducer) Close

func (mp *MemoryProducer) Close() error

func (*MemoryProducer) CreateTopics

func (mp *MemoryProducer) CreateTopics(topics []string) error

func (*MemoryProducer) Events

func (mp *MemoryProducer) Events() chan Message

func (*MemoryProducer) ProduceChannel

func (mp *MemoryProducer) ProduceChannel() chan Message

type Message

type Message struct {
	Topic  *string
	Value  []byte
	Key    []byte
	Offset int
}

type NginxConfig

type NginxConfig struct {
	EnvVar              []string
	NoCodeCache         bool
	WriteProxyPort      string
	FunctionInvokerPort string
}

func (NginxConfig) Generate

func (c NginxConfig) Generate(sourcePath string) (string, error)

type PGConsumer

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

func NewPGConsumer

func NewPGConsumer(app *Application) (*PGConsumer, error)

func (*PGConsumer) Close

func (c *PGConsumer) Close() error

func (*PGConsumer) Poll

func (c *PGConsumer) Poll(timeoutMs int) (*Message, error)

type PGProducer

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

func NewPGProducer

func NewPGProducer(app *Application) (*PGProducer, error)

func (*PGProducer) Close

func (p *PGProducer) Close() error

func (*PGProducer) CreateTopics

func (p *PGProducer) CreateTopics(topics []string) error

func (*PGProducer) Events

func (p *PGProducer) Events() chan Message

func (*PGProducer) ProduceChannel

func (p *PGProducer) ProduceChannel() chan Message

type Pool

type Pool struct {
	Work Work
	*sync.RWMutex
	// contains filtered or unexported fields
}

func NewPool

func NewPool(work Work) *Pool

func (*Pool) RunTask

func (p *Pool) RunTask(msg Message)

type Work

type Work func(Message) error

type Worker

type Worker struct {
	CloseChan chan int
	TaskChan  chan Message
	Error     error
}

func NewWorker

func NewWorker(work Work) *Worker

func (*Worker) Start

func (w *Worker) Start(work Work)

type WriteProxy

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

func NewWriteProxy

func NewWriteProxy(app *Application, produceChan chan Message) (*WriteProxy, error)

func (WriteProxy) ServeHTTP

func (p WriteProxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

type WriteRequest

type WriteRequest struct {
	Topic   string                     `json:"topic"`
	Entries map[string]json.RawMessage `json:"entries"`
}

Jump to

Keyboard shortcuts

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