goes

package
v0.0.0-...-cba03c4 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendToStream

func AppendToStream(conn *EventStoreConnection, streamID string, expectedVersion int32, evnts []Event) (protobuf.WriteEventsCompleted, error)

AppendToStream appends an event to the stream

func CreatePersistentSubscription

func CreatePersistentSubscription(conn *EventStoreConnection, streamID string, groupName string, settings PersistentSubscriptionSettings) (protobuf.CreatePersistentSubscriptionCompleted, error)

CreatePersistentSubscription creates a new persistent subscription

func DecodeNetUUID

func DecodeNetUUID(netEncoded []byte) []byte

DecodeNetUUI decodes a dotnet UUID

func DeleteStream

func DeleteStream(conn *EventStoreConnection, streamID string, expectedVersion int32, requireMaster bool, hardDelete bool) (protobuf.DeleteStreamCompleted, error)

DeleteStream will delete the stream

func EncodeNetUUID

func EncodeNetUUID(uuid []byte) []byte

EncodeNetUUID encodes a dotnet UUID

func ReadSingleEvent

func ReadSingleEvent(conn *EventStoreConnection, streamID string, eventNumber int32, resolveLinkTos bool, requireMaster bool) (protobuf.ReadEventCompleted, error)

ReadSingleEvent reads a single event from a stream

func ReadStreamEventsBackward

func ReadStreamEventsBackward(conn *EventStoreConnection, streamID string, from int32, maxCount int32, resolveLinkTos bool, requireMaster bool) (protobuf.ReadStreamEventsCompleted, error)

ReadStreamEventsBackward will read n number of events from the stream backward.

func ReadStreamEventsForward

func ReadStreamEventsForward(conn *EventStoreConnection, streamID string, from int32, maxCount int32, resolveLinkTos bool, requireMaster bool) (protobuf.ReadStreamEventsCompleted, error)

ReadStreamEventsForward will read n number of events from the stream forward. The read includes the stream at the from position.

Types

type Command

type Command byte

Command represents a TCP Command

func (Command) String

func (c Command) String() string

type Configuration

type Configuration struct {
	Address             string
	Port                int
	Login               string
	Password            string
	ReconnectionDelay   int
	MaxReconnects       int
	MaxOperationRetries int
	EndpointDiscoverer  EndpointDiscoverer
}

Configuration for an Event Store Connection

func NewConfiguration

func NewConfiguration() *Configuration

NewConfiguration creates a configuration with default settings

type EndpointDiscoverer

type EndpointDiscoverer interface {
	Discover() (MemberInfo, error)
}

EndpointDiscoverer func that is used to discover an endpoint given the gossip seeds

type Event

type Event struct {
	EventID   uuid.UUID
	EventType string
	IsJSON    bool
	Data      []byte
	Metadata  []byte
}

Event is a structure that is used to help in marshalling events to and from a tcp package

type EventStoreConnection

type EventStoreConnection struct {
	Config *Configuration
	Socket *net.TCPConn

	ConnectionID uuid.UUID
	Mutex        *sync.Mutex
	// contains filtered or unexported fields
}

EventStoreConnection will manage the lifetime and connection to an Event Store Node/Cluster

func NewEventStoreConnection

func NewEventStoreConnection(config *Configuration) (*EventStoreConnection, error)

NewEventStoreConnection sets up a new Event Store Connection but does not open the connection

func (*EventStoreConnection) Close

func (connection *EventStoreConnection) Close() error

Close attempts to close the connection to Event Store

func (*EventStoreConnection) Connect

func (connection *EventStoreConnection) Connect() error

Connect attempts to connect to Event Store using the given configuration

type GossipEndpointDiscoverer

type GossipEndpointDiscoverer struct {
	MaxDiscoverAttempts int
	GossipSeeds         []string
}

GossipEndpointDiscoverer used for discovering and picking the most appropriate node in a cluster

func (*GossipEndpointDiscoverer) Discover

func (discoverer *GossipEndpointDiscoverer) Discover() (MemberInfo, error)

Discover will discover nodes via performing a gossip over HTTP and then picking the best candidate to connect to

type GossipResponse

type GossipResponse struct {
	Members []MemberInfo `json:"members"`
}

GossipResponse represents the response from a gossip request

type GossipSeed

type GossipSeed struct {
	ExternalTCPIP    string
	ExternalHTTPPort int
}

GossipSeed represents and endpoint where a gossip can be issued and nodes in a cluster discovered

type MemberInfo

type MemberInfo struct {
	State            string `json:"state"`
	IsAlive          bool   `json:"isAlive"`
	ExternalTCPIP    string `json:"externalTcpIp"`
	ExternalHTTPPort int    `json:"externalHttpPort"`
	ExternalTCPPort  int    `json:"externalTcpPort"`
}

MemberInfo represents the members in a cluster which is retrieved as part of the gossip request and lives inside of the members in the response

type PersistentSubscriptionSettings

type PersistentSubscriptionSettings struct {
	ResolveLinkTos             bool
	StartFrom                  int
	MessageTimeoutMilliseconds int
	RecordStatistics           bool
	LiveBufferSize             int
	ReadBatchSize              int
	BufferSize                 int
	MaxRetryCount              int
	PreferRoundRobit           bool
	CheckpointAfterTime        int
	CheckpointMaxCount         int
	CheckpointMinCount         int
	SubscriberMaxCount         int
	NamedConsumerStrategy      string
}

PersistentSubscriptionSettings describes the settings for the persistent subscription

func NewPersistentSubscriptionSettings

func NewPersistentSubscriptionSettings() *PersistentSubscriptionSettings

NewPersistentSubscriptionSettings creates new subscription settings

type Subscription

type Subscription struct {
	CorrelationID uuid.UUID
	Connection    *EventStoreConnection
	Channel       chan TCPPackage
	EventAppeared eventAppeared
	Dropped       dropped
	Started       bool
}

Subscription represents an Event Store Client Subscription to a stream

func ConnectToPersistentSubscription

func ConnectToPersistentSubscription(conn *EventStoreConnection, stream string, groupName string, eventAppeared eventAppeared, dropped dropped, bufferSize int, autoAck bool) (*Subscription, error)

ConnectToPersistentSubscription connects to a persistent subscription

func NewSubscription

func NewSubscription(connection *EventStoreConnection, correlationID uuid.UUID, channel chan TCPPackage, appeared eventAppeared, dropped dropped) (*Subscription, error)

NewSubscription creates a new subscription to a stream

func SubscribeToStream

func SubscribeToStream(conn *EventStoreConnection, streamID string, resolveLinkTos bool, eventAppeared eventAppeared, dropped dropped) (*Subscription, error)

SubscribeToStream registers a subscription with the stream

func (*Subscription) Start

func (subscription *Subscription) Start() error

Start starts a subscription

func (*Subscription) Stop

func (subscription *Subscription) Stop() error

Stop stops a subscription from receiving events

type TCPPackage

type TCPPackage struct {
	PackageLength uint32
	Command       Command
	Flags         byte
	CorrelationID []byte
	Login         string
	Password      string
	Data          []byte
}

TCPPackage for describing the TCP Package structure from Event Store

Jump to

Keyboard shortcuts

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