2020-09-30 08:00:05 +00:00
|
|
|
package repository
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
)
|
|
|
|
|
2020-10-06 19:28:09 +00:00
|
|
|
//Repository pushes and filters events
|
2020-09-30 08:00:05 +00:00
|
|
|
type Repository interface {
|
2020-10-06 19:28:09 +00:00
|
|
|
//Health checks if the connection to the storage is available
|
2020-09-30 08:00:05 +00:00
|
|
|
Health(ctx context.Context) error
|
2022-07-22 10:08:39 +00:00
|
|
|
// Push adds all events of the given aggregates to the event streams of the aggregates.
|
2021-01-21 09:49:38 +00:00
|
|
|
// if unique constraints are pushed, they will be added to the unique table for checking unique constraint violations
|
2020-09-30 08:00:05 +00:00
|
|
|
// This call is transaction save. The transaction will be rolled back if one event fails
|
2021-05-03 08:15:50 +00:00
|
|
|
Push(ctx context.Context, events []*Event, uniqueConstraints ...*UniqueConstraint) error
|
2020-09-30 08:00:05 +00:00
|
|
|
// Filter returns all events matching the given search query
|
|
|
|
Filter(ctx context.Context, searchQuery *SearchQuery) (events []*Event, err error)
|
2022-07-22 10:08:39 +00:00
|
|
|
//LatestSequence returns the latest sequence found by the search query
|
2020-09-30 08:00:05 +00:00
|
|
|
LatestSequence(ctx context.Context, queryFactory *SearchQuery) (uint64, error)
|
2022-07-22 10:08:39 +00:00
|
|
|
//InstanceIDs returns the instance ids found by the search query
|
|
|
|
InstanceIDs(ctx context.Context, queryFactory *SearchQuery) ([]string, error)
|
2022-04-13 05:42:48 +00:00
|
|
|
//CreateInstance creates a new sequence for the given instance
|
|
|
|
CreateInstance(ctx context.Context, instanceID string) error
|
2020-09-30 08:00:05 +00:00
|
|
|
}
|