api

package
v0.0.0-...-f244974 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	spec.GoetheServer
}

API is the goethe grpc API

func New

func New(producer Producer, consumer Consumer) API

New creates a new API instance

type Consumer

type Consumer interface {
	// GetIterator creates an iterator pointing to the given cursor.
	// ConsumerIterator.Value() will retrieves the given cursor.
	// If the given Cursor has no|empty CurrentEvent.ID set, the last known consumer's cursor position is used.
	GetIterator(from *spec.Cursor) (ConsumerIterator, error)
	// Commit marks the event as successfully handled by the consumer.
	Commit(cursor *spec.Cursor) error
}

Consumer proxies a consumer.

func NewConsumer

func NewConsumer(cursors storage.CursorStorage, events storage.EventStorage) Consumer

NewConsumer ctor.

type ConsumerIterator

type ConsumerIterator interface {
	io.Closer

	// Value returns the current cursor or nil if done.
	Value() (*spec.Cursor, error)

	// Next moves the iterator to the next cursor position.
	// It returns false if the iterator is exhausted.
	Next() bool
}

A ConsumerIterator is used to move the consumer's cursor.

func NewIterator

func NewIterator(topic spec.Topic, consumer string, inner storage.EventsIterator, cursors storage.CursorStorage) ConsumerIterator

NewIterator ctor.

type Metrics

type Metrics interface {
	EventProduced(topic string)
}

Metrics provides metrics over the API

func NewMetrics

func NewMetrics() Metrics

NewMetrics ctor.

type Producer

type Producer interface {
	// Produce produces the given event.
	Produce(event *spec.Event) (*spec.Event, error)
}

Producer proxies producer capabilities.

func NewProducer

func NewProducer(eventStorage storage.EventStorage, metrics Metrics) Producer

NewProducer ctor.

Jump to

Keyboard shortcuts

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