Documentation
¶
Overview ¶
Event Horizon client
Index ¶
- Variables
- func Bootstrap(ctx context.Context, e *Client) error
- type AppendResult
- type ChildStreamCreated
- type Client
- func (e *Client) Append(ctx context.Context, stream string, events []string) (*AppendResult, error)
- func (e *Client) AppendAfter(ctx context.Context, after Cursor, events []string) (*AppendResult, error)
- func (e *Client) CreateStream(ctx context.Context, parent string, name string) error
- func (e *Client) Read(ctx context.Context, lastKnown Cursor) (*ReadResult, error)
- type Cursor
- type DynamoDbOptions
- type ErrOptimisticLockingFailed
- type LogEntry
- type ReadResult
- type Reader
- type ReaderWriter
- type StreamStarted
- type Writer
Constants ¶
This section is empty.
Variables ¶
var MetaTypes = ehevent.Allocators{ "ChildStreamCreated": func() ehevent.Event { return &ChildStreamCreated{} }, "StreamStarted": func() ehevent.Event { return &StreamStarted{} }, }
please have a very good reason if you use this from outside of this package
Functions ¶
Types ¶
type AppendResult ¶
type AppendResult struct {
Cursor Cursor
}
type ChildStreamCreated ¶
type ChildStreamCreated struct {
Stream string
// contains filtered or unexported fields
}
func NewChildStreamCreated ¶
func NewChildStreamCreated(stream string, meta ehevent.EventMeta) *ChildStreamCreated
func (*ChildStreamCreated) Meta ¶
func (e *ChildStreamCreated) Meta() *ehevent.EventMeta
func (*ChildStreamCreated) MetaType ¶
func (e *ChildStreamCreated) MetaType() string
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶
func New(opts DynamoDbOptions) *Client
func (*Client) AppendAfter ¶
func (e *Client) AppendAfter(ctx context.Context, after Cursor, events []string) (*AppendResult, error)
NOTE: be very sure that stream exists, since it is not validated (only happens if malicious Cursor provided) NOTE: be sure that you don't set version into the future, since that will leave a gap NOTE: returned error is *ErrOptimisticLockingFailed if stream had writes
func (*Client) CreateStream ¶
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
func (*Cursor) AtBeginning ¶
type DynamoDbOptions ¶
type ErrOptimisticLockingFailed ¶
type ErrOptimisticLockingFailed struct {
// contains filtered or unexported fields
}
func NewErrOptimisticLockingFailed ¶
func NewErrOptimisticLockingFailed(err error) *ErrOptimisticLockingFailed
needed for testing from outside of this package
type LogEntry ¶
type LogEntry struct {
Stream string `json:"s"` // stream + version form the composite key
Version int64 `json:"v"`
MetaEvent *string `json:"meta_event"` // StreamStarted | ChildStreamCreated created | ...
Events []string `json:"e"`
}
Raw entry from DynamoDB - can contain 0-n events. commit all events in a single transaction. - might contain a single meta event - why most common attribute names shortened? DynamoDB charges for each byte in item attribute names.. - we have JSON marshalling defined but please consider it DynamoDB internal implementation
type ReadResult ¶
type Reader ¶
type Reader interface {
Read(ctx context.Context, lastKnown Cursor) (*ReadResult, error)
}
interface for reading log entries from a stream
type ReaderWriter ¶
type StreamStarted ¶
type StreamStarted struct {
Parent string
// contains filtered or unexported fields
}
func NewStreamStarted ¶
func NewStreamStarted(parent string, meta ehevent.EventMeta) *StreamStarted
func (*StreamStarted) Meta ¶
func (e *StreamStarted) Meta() *ehevent.EventMeta
func (*StreamStarted) MetaType ¶
func (e *StreamStarted) MetaType() string
type Writer ¶
type Writer interface {
Append(ctx context.Context, stream string, events []string) (*AppendResult, error)
// used for transactional writes
// returns *ErrOptimisticLockingFailed if stream had writes after you read it
AppendAfter(ctx context.Context, after Cursor, events []string) (*AppendResult, error)
}
interface for appending log entries to a stream