client

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandClient

type CommandClient interface {
	// stream
	Delete(stream string) (bool, error)
	Exists(stream string) (bool, error)
	SList() ([]Stream, error)

	// events
	EList(stream string, offset string, index string) ([]SimpleEvent, error)

	// pubsub
	Publish(stream string, version string, event string) (bool, error)
	Subscribe(inc chan<- FullEvent, errc chan<- error, stream string, offset string)
	SubscribeAll(inc chan<- FullEvent, errc chan<- error, offset string)
}

CommandClient - interface to define the client implementation

type Context

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

Context - holds the client connection

func NewClient

func NewClient(addr string) (*Context, error)

NewClient - generate a new client connection

func (*Context) Delete

func (c *Context) Delete(stream string) (bool, error)

Delete - delete a stream

func (*Context) EList

func (c *Context) EList(stream, offset, index string) ([]SimpleEvent, error)

EList - list all events in a stream

func (*Context) Exists

func (c *Context) Exists(stream string) (bool, error)

Exists - determine if a stream exists

func (*Context) Publish

func (c *Context) Publish(stream, version, event string) (bool, error)

Publish - publish an event to a stream

func (*Context) SList

func (c *Context) SList() ([]Stream, error)

SList - list all streams

func (*Context) Subscribe

func (c *Context) Subscribe(inc chan<- FullEvent, errc chan<- error, stream, offset string)

Subscribe - subscribes to a stream to stream events from that stream

func (*Context) SubscribeAll

func (c *Context) SubscribeAll(inc chan<- FullEvent, errc chan<- error, offset string)

SubscribeAll - subscribes to all streams to get all events that occur

type FullEvent

type FullEvent struct {
	StreamID string
	EventID  string
	Version  int
	Data     string
}

FullEvent - defines an event on a stream with metadata

type SimpleEvent

type SimpleEvent struct {
	Version int
	Data    string
}

SimpleEvent - defines an event on a stream without metadata

type Stream

type Stream struct {
	StreamID   string
	EventCount int
}

Stream - defines the aggregate stream response

Jump to

Keyboard shortcuts

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