eventsourceservice

package
v0.0.76 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEventTooNew = errors.New("event is too new")
View Source
var ErrEventTooOld = errors.New("event is too old")
View Source
var ErrInvalidParameter = errors.New("invalid parameter")
View Source
var ErrMissingRequiredField = errors.New("missing required field")

Functions

This section is empty.

Types

type EventSource

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

EventSource implements the event source service with partition management

func (*EventSource) AppendEvent

func (s *EventSource) AppendEvent(ctx context.Context, event *eventstore.Event) error

AppendEvent implements Service interface

func (*EventSource) DeleteEventsByTypeInRange

func (s *EventSource) DeleteEventsByTypeInRange(ctx context.Context, eventType string, from, to time.Time) error

DeleteEventsByTypeInRange implements Service interface

func (*EventSource) GetEventTypesInRange

func (s *EventSource) GetEventTypesInRange(ctx context.Context, from, to time.Time, limit int) ([]string, error)

GetEventTypesInRange implements Service interface

func (*EventSource) GetEventsByAggregate

func (s *EventSource) GetEventsByAggregate(ctx context.Context, eventType string, from, to time.Time, aggregateType, aggregateID string, limit int) ([]eventstore.Event, error)

GetEventsByAggregate implements Service interface

func (*EventSource) GetEventsBySource

func (s *EventSource) GetEventsBySource(ctx context.Context, eventType string, from, to time.Time, eventSource string, limit int) ([]eventstore.Event, error)

GetEventsBySource implements Service interface

func (*EventSource) GetEventsByType

func (s *EventSource) GetEventsByType(ctx context.Context, eventType string, from, to time.Time, limit int) ([]eventstore.Event, error)

GetEventsByType implements Service interface

func (*EventSource) SubscribeToEvents

func (s *EventSource) SubscribeToEvents(ctx context.Context, eventType string, ch chan<- []byte) (Subscription, error)

type Service

type Service interface {
	AppendEvent(ctx context.Context, event *eventstore.Event) error
	GetEventsByAggregate(ctx context.Context, eventType string, from, to time.Time, aggregateType, aggregateID string, limit int) ([]eventstore.Event, error)
	GetEventsByType(ctx context.Context, eventType string, from, to time.Time, limit int) ([]eventstore.Event, error)
	GetEventsBySource(ctx context.Context, eventType string, from, to time.Time, eventSource string, limit int) ([]eventstore.Event, error)
	SubscribeToEvents(ctx context.Context, eventType string, ch chan<- []byte) (Subscription, error)

	GetEventTypesInRange(ctx context.Context, from, to time.Time, limit int) ([]string, error)
	DeleteEventsByTypeInRange(ctx context.Context, eventType string, from, to time.Time) error
}

Service defines the interface for the event source service

func NewEventSourceService

func NewEventSourceService(
	ctx context.Context,
	dbInstance libdbexec.DBManager,
	messenger libbus.Messenger,
	action eventdispatch.Trigger,
) (Service, error)

NewEventSourceService creates a new event source service with partition management

func WithActivityTracker

func WithActivityTracker(service Service, tracker libtracker.ActivityTracker) Service

WithActivityTracker decorates a Service with activity tracking

type Subscription

type Subscription interface {
	Unsubscribe() error
}

Jump to

Keyboard shortcuts

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