Documentation
¶
Index ¶
- Constants
- Variables
- func CanonicalTagOperator(operator string) (string, error)
- func EncodeCriterion(tags []ReadTag) map[string]any
- func EncodeQueryCriteria(query *Query) []map[string]any
- func EncodeReadCriteria(criteria []ReadCriterion) []map[string]any
- func GetBuildInfo() (string, string, string)
- func GetNotificationSubjectName(boundary string) string
- func GetVersion() string
- func MarshalConsistency(checks []ConsistencyCheck) ([]byte, error)
- func MatchTagValue(value any, target, operator string) bool
- func TagSQLOperator(operator string) (string, error)
- func ValidateQuery(query *Query) error
- func ValidateReadCriteria(criteria []ReadCriterion) error
- func ValidateTag(key, value, operator string) error
- func WriteID(commit, prepare int64) string
- type Backoff
- type BoundaryIndex
- type BoundaryIndexCondition
- type BoundaryIndexField
- type BoundaryIndexManager
- type BoundaryNotificationManager
- type ComparationResult
- type ConditionCombinator
- type ConsistencyCheck
- type ConsistencyObservation
- type CreateIndexRequest
- type Criterion
- type CustomEventStream
- type Direction
- type DropIndexRequest
- type Event
- type EventSignal
- type EventStore
- func (s *EventStore) ActivateBoundary(boundary string) error
- func (s *EventStore) CreateIndex(ctx context.Context, req *CreateIndexRequest) error
- func (s *EventStore) DropIndex(ctx context.Context, req *DropIndexRequest) error
- func (s *EventStore) EnableBoundaryActivationGate(initiallyActive ...string) error
- func (s *EventStore) EnableOpenTelemetryMetrics() error
- func (s *EventStore) EnsureBoundary(ctx context.Context, boundary string) error
- func (s *EventStore) GetEvents(ctx context.Context, req *GetEventsRequest) (*GetEventsResponse, error)
- func (s *EventStore) GetIndex(ctx context.Context, req *GetIndexRequest) (*GetIndexResponse, error)
- func (s *EventStore) GetLatestByCriteria(ctx context.Context, req *GetLatestByCriteriaRequest) (*GetLatestByCriteriaResponse, error)
- func (s *EventStore) GetWriteContext(ctx context.Context, req *GetWriteContextRequest) (*WriteContext, error)
- func (s *EventStore) ListIndexes(ctx context.Context, req *ListIndexesRequest) (*ListIndexesResponse, error)
- func (s *EventStore) Ping(ctx context.Context) error
- func (s *EventStore) RequireBoundaryActive(boundary string) error
- func (s *EventStore) SaveEventsV2(ctx context.Context, req *SaveEventsV2Request) (*WriteResult, error)
- func (s *EventStore) SubscribeToAllEvents(ctx context.Context, request coreeventstore.SubscribeRequest, ...) error
- type EventToSave
- type EventWithMapTags
- type EventsRetriever
- type EventsSaver
- type GetEventsRequest
- type GetEventsResponse
- type GetIndexRequest
- type GetIndexResponse
- type GetLatestByCriteriaRequest
- type GetLatestByCriteriaResponse
- type GetWriteContextRequest
- type IndexCondition
- type IndexField
- type JetStreamLockProvider
- type LatestByCriteriaBatch
- type LatestByCriteriaQuery
- type LatestCriterionMatch
- type LatestCriterionResult
- type ListIndexesRequest
- type ListIndexesResponse
- type LockLease
- type LockProvider
- type MessageHandler
- type OrisunServer
- func (c *OrisunServer) ActivateBoundary(_ context.Context, boundary string) error
- func (s *OrisunServer) ConfigureSubscriptions(interval time.Duration) error
- func (c *OrisunServer) EnableBoundaryActivationGate(initiallyActive ...string) error
- func (c *OrisunServer) EnsureBoundary(ctx context.Context, boundary string) error
- func (c *OrisunServer) GetEvents(ctx context.Context, req *GetEventsRequest) (ReadEventBatch, error)
- func (c *OrisunServer) GetLatestByCriteria(ctx context.Context, query LatestByCriteriaQuery) (LatestByCriteriaBatch, error)
- func (c *OrisunServer) GetWriteContext(ctx context.Context, req *GetWriteContextRequest) (*WriteContext, error)
- func (c *OrisunServer) RequireBoundaryActive(boundary string) error
- func (c *OrisunServer) SaveEvents(ctx context.Context, events []EventWithMapTags, boundary string, ...) (*Position, error)
- func (c *OrisunServer) SaveEventsV2(ctx context.Context, events []EventWithMapTags, boundary string, ...) (*Position, error)
- func (c *OrisunServer) SubscribeToEvents(ctx context.Context, request coreeventstore.SubscribeRequest, ...) error
- type Position
- type PreparedEvent
- type PreparedEventBatch
- type Query
- type ReadCriterion
- type ReadEvent
- type ReadEventBatch
- type ReadTag
- type Role
- type SaveEventsV2Request
- type Tag
- type TagPredicate
- type User
- type UserContextKeyType
- type ValueType
- type WriteContext
- type WriteContextRetriever
- type WriteResult
Constants ¶
const ( IndexCombinatorAND = "AND" IndexCombinatorOR = "OR" BoundaryIndexStateBuilding = "building" BoundaryIndexStateReady = "ready" )
const ( // DefaultReadBatchSize is used by storage backends when an in-process // caller does not provide a page size. DefaultReadBatchSize uint32 = 1_000 // MaxReadBatchSize bounds one database read and its result allocation. // Larger logical reads must advance by position and fetch another page. MaxReadBatchSize uint32 = 10_000 )
const (
StreamDoesNotExist = -1
)
Variables ¶
var BuildTime = "unknown"
BuildTime is the time when the binary was built. This will be overridden during build by the -ldflags="-X 'orisun/orisun.BuildTime=<timestamp>'" flag.
var ErrQueueFull = errors.New("message handler queue full")
var GitCommit = "unknown"
GitCommit is the git commit hash from which the binary was built. This will be overridden during build by the -ldflags="-X 'orisun/orisun.GitCommit=<hash>'" flag.
var Roles = []Role{RoleAdmin, RoleOperations}
var Version = "dev"
Version is the current version of Orisun. This will be overridden during build by the -ldflags="-X 'orisun/orisun.Version=v1.2.3'" flag.
Functions ¶
func CanonicalTagOperator ¶ added in v0.14.0
func EncodeCriterion ¶ added in v0.14.0
EncodeCriterion preserves the equality representation already stored in write contexts. Non-equality and repeated-key predicates retain every comparison.
func EncodeQueryCriteria ¶ added in v0.14.0
func EncodeReadCriteria ¶ added in v0.14.0
func EncodeReadCriteria(criteria []ReadCriterion) []map[string]any
func GetBuildInfo ¶
GetBuildInfo returns the version, build time, and git commit hash.
func GetNotificationSubjectName ¶ added in v0.14.0
GetNotificationSubjectName identifies transient boundary change hints.
func MarshalConsistency ¶ added in v0.12.0
func MarshalConsistency(checks []ConsistencyCheck) ([]byte, error)
func MatchTagValue ¶ added in v0.14.0
MatchTagValue supplies scalar comparison semantics for storage engines that evaluate predicates in Go. A missing field must be rejected by the caller; JSON null never matches any operator.
func TagSQLOperator ¶ added in v0.14.0
func ValidateQuery ¶ added in v0.14.0
func ValidateReadCriteria ¶ added in v0.14.0
func ValidateReadCriteria(criteria []ReadCriterion) error
func ValidateTag ¶ added in v0.14.0
Types ¶
type BoundaryIndex ¶ added in v0.9.3
type BoundaryIndex struct {
Name string
Fields []BoundaryIndexField
Conditions []BoundaryIndexCondition
Combinator string
State string
}
type BoundaryIndexCondition ¶
type BoundaryIndexField ¶
type BoundaryIndexManager ¶
type BoundaryIndexManager interface {
CreateBoundaryIndex(ctx context.Context, boundary, name string, fields []BoundaryIndexField, conditions []BoundaryIndexCondition, combinator string) error
DropBoundaryIndex(ctx context.Context, boundary, name string) error
ListBoundaryIndexes(ctx context.Context, boundary string) ([]BoundaryIndex, error)
GetBoundaryIndex(ctx context.Context, boundary, name string) (*BoundaryIndex, error)
}
type BoundaryNotificationManager ¶ added in v0.14.0
type BoundaryNotificationManager struct {
// contains filtered or unexported fields
}
BoundaryNotificationManager forwards backend signals. It deliberately has no event retriever or publisher-checkpoint dependency.
func StartNotificationRelays ¶ added in v0.14.0
func StartNotificationRelays(ctx context.Context, lockProvider LockProvider, conn notificationPublisher, signalProvider func(string) EventSignal, logger logging.Logger) *BoundaryNotificationManager
func (*BoundaryNotificationManager) StartBoundary ¶ added in v0.14.0
func (m *BoundaryNotificationManager) StartBoundary(boundary string) error
func (*BoundaryNotificationManager) Stop ¶ added in v0.14.0
func (m *BoundaryNotificationManager) Stop()
Stop cancels relays and waits for their signals and leases to be released.
type ComparationResult ¶
type ComparationResult int
const IsEqual ComparationResult = 0
const IsGreaterThan ComparationResult = 1
const IsLessThan ComparationResult = -1
func ComparePositions ¶
func ComparePositions(p1, p2 *Position) ComparationResult
type ConditionCombinator ¶
type ConditionCombinator int32
const ( ConditionCombinator_AND ConditionCombinator = iota ConditionCombinator_OR )
type ConsistencyCheck ¶ added in v0.11.0
type ConsistencyCheck struct {
Criteria []ReadCriterion
Position Position
}
ConsistencyCheck is one normalized query observation. Criteria are ORed; tags within each criterion are ANDed.
func ConsistencyChecksFromObservations ¶ added in v0.14.0
func ConsistencyChecksFromObservations(observations []*ConsistencyObservation) ([]ConsistencyCheck, error)
ConsistencyChecksFromObservations validates query observations for native storage.
type ConsistencyObservation ¶ added in v0.11.0
type CreateIndexRequest ¶
type CreateIndexRequest struct {
Boundary string
Name string
Fields []*IndexField
Conditions []*IndexCondition
ConditionCombinator ConditionCombinator
}
type CustomEventStream ¶
type CustomEventStream struct {
// contains filtered or unexported fields
}
func NewCustomEventStream ¶
func NewCustomEventStream(ctx context.Context) *CustomEventStream
func (*CustomEventStream) Context ¶
func (s *CustomEventStream) Context() context.Context
func (*CustomEventStream) Events ¶
func (s *CustomEventStream) Events() <-chan *Event
Events returns the channel for consuming events
func (*CustomEventStream) Recv ¶
func (s *CustomEventStream) Recv() (*Event, error)
func (*CustomEventStream) Send ¶
func (s *CustomEventStream) Send(event *Event) error
type DropIndexRequest ¶
type Event ¶
type Event struct {
WriteId string `json:"write_id,omitempty"`
EventId string `json:"event_id"`
EventType string `json:"event_type"`
Data string `json:"data"`
Metadata string `json:"metadata"`
Position *Position `json:"position"`
DateCreated time.Time `json:"date_created"`
}
Event is the transport-neutral event shape used by in-process command handlers. Storage backends use ReadEvent directly.
type EventSignal ¶
EventSignal reports that new events may be available.
type EventStore ¶
type EventStore struct {
// contains filtered or unexported fields
}
func InitializeEventStore ¶
func InitializeEventStore( ctx context.Context, config c.AppConfig, saveEvents EventsSaver, getEvents EventsRetriever, lockProvider LockProvider, indexManager BoundaryIndexManager, js jetstream.JetStream, logger logging.Logger) *EventStore
func NewEventStoreServer ¶
func NewEventStoreServer( js jetstream.JetStream, saveEventsFn EventsSaver, getEventsFn EventsRetriever, lockProvider LockProvider, indexManager BoundaryIndexManager, logger logging.Logger, ) *EventStore
func (*EventStore) ActivateBoundary ¶ added in v0.8.0
func (s *EventStore) ActivateBoundary(boundary string) error
ActivateBoundary exposes a boundary to public requests after its activation event is durable. It is idempotent for replay and clustered delivery.
func (*EventStore) CreateIndex ¶
func (s *EventStore) CreateIndex(ctx context.Context, req *CreateIndexRequest) error
func (*EventStore) DropIndex ¶
func (s *EventStore) DropIndex(ctx context.Context, req *DropIndexRequest) error
func (*EventStore) EnableBoundaryActivationGate ¶ added in v0.8.0
func (s *EventStore) EnableBoundaryActivationGate(initiallyActive ...string) error
EnableBoundaryActivationGate makes public event-store operations require a locally observed ACTIVE catalog state. The bootstrap boundary is supplied as initially active so the catalog can replay itself before application boundaries are exposed.
func (*EventStore) EnableOpenTelemetryMetrics ¶ added in v0.9.3
func (s *EventStore) EnableOpenTelemetryMetrics() error
EnableOpenTelemetryMetrics attaches event-store instruments to the current global OpenTelemetry MeterProvider. Metrics are disabled until this is called.
func (*EventStore) EnsureBoundary ¶ added in v0.8.0
func (s *EventStore) EnsureBoundary(ctx context.Context, boundary string) error
EnsureBoundary validates a boundary. Core NATS subjects require no provisioning.
func (*EventStore) GetEvents ¶
func (s *EventStore) GetEvents(ctx context.Context, req *GetEventsRequest) (*GetEventsResponse, error)
func (*EventStore) GetIndex ¶ added in v0.9.3
func (s *EventStore) GetIndex(ctx context.Context, req *GetIndexRequest) (*GetIndexResponse, error)
func (*EventStore) GetLatestByCriteria ¶
func (s *EventStore) GetLatestByCriteria(ctx context.Context, req *GetLatestByCriteriaRequest) (*GetLatestByCriteriaResponse, error)
func (*EventStore) GetWriteContext ¶ added in v0.12.0
func (s *EventStore) GetWriteContext(ctx context.Context, req *GetWriteContextRequest) (*WriteContext, error)
func (*EventStore) ListIndexes ¶ added in v0.9.3
func (s *EventStore) ListIndexes(ctx context.Context, req *ListIndexesRequest) (*ListIndexesResponse, error)
func (*EventStore) RequireBoundaryActive ¶ added in v0.8.0
func (s *EventStore) RequireBoundaryActive(boundary string) error
RequireBoundaryActive rejects unknown, provisioning, and failed catalog boundaries before a public request reaches a backend.
func (*EventStore) SaveEventsV2 ¶ added in v0.11.0
func (s *EventStore) SaveEventsV2(ctx context.Context, req *SaveEventsV2Request) (*WriteResult, error)
func (*EventStore) SubscribeToAllEvents ¶
func (s *EventStore) SubscribeToAllEvents(ctx context.Context, request coreeventstore.SubscribeRequest, handler coreeventstore.EventHandler) error
type EventToSave ¶
type EventWithMapTags ¶
type EventWithMapTags struct {
EventId string `json:"event_id"`
EventType string `json:"event_type"`
Data any `json:"data"`
Metadata any `json:"metadata"`
}
EventWithMapTags is the flexible input representation used by embedding APIs.
type EventsRetriever ¶
type EventsRetriever interface {
GetBatch(ctx context.Context, req *GetEventsRequest) (ReadEventBatch, error)
GetLatestByCriteria(ctx context.Context, query LatestByCriteriaQuery) (LatestByCriteriaBatch, error)
}
EventsRetriever reads backend-neutral event batches and carried-state snapshots without depending on a network transport.
type EventsSaver ¶
type EventsSaver interface {
SavePrepared(
ctx context.Context,
events PreparedEventBatch,
boundary string,
consistency []ConsistencyCheck,
) (transactionID string, globalID int64, err error)
}
EventsSaver accepts canonical batches prepared at an API boundary.
type GetEventsRequest ¶
type GetEventsResponse ¶
type GetEventsResponse struct {
Events []*Event
}
type GetIndexRequest ¶ added in v0.9.3
type GetIndexResponse ¶ added in v0.9.3
type GetIndexResponse struct {
Index *BoundaryIndex
}
type GetLatestByCriteriaResponse ¶
type GetLatestByCriteriaResponse struct {
Results []*LatestCriterionResult
ContextPosition *Position
}
type GetWriteContextRequest ¶ added in v0.12.0
type IndexCondition ¶
type IndexField ¶
type JetStreamLockProvider ¶
type JetStreamLockProvider struct {
// contains filtered or unexported fields
}
JetStreamLockProvider implements a renewable, revision-fenced distributed lock using NATS JetStream KV.
func NewJetStreamLockProvider ¶
func NewJetStreamLockProvider(ctx context.Context, js jetstream.JetStream, logger logging.Logger) (*JetStreamLockProvider, error)
NewJetStreamLockProvider creates a new JetStreamLockProvider.
func (*JetStreamLockProvider) AcquireLock ¶ added in v0.7.0
func (p *JetStreamLockProvider) AcquireLock(ctx context.Context, lockName string) (LockLease, error)
AcquireLock acquires a renewable, token-fenced lease. An expired lease may be replaced with a revision-guarded update.
type LatestByCriteriaBatch ¶
type LatestByCriteriaBatch struct {
Matches []LatestCriterionMatch
ContextCommitPosition int64
ContextPreparePosition int64
}
LatestByCriteriaBatch is the packed result used by embedded callers and storage backends. Matches is positionally aligned with the input criteria.
type LatestByCriteriaQuery ¶
type LatestByCriteriaQuery struct {
Boundary string
Criteria []ReadCriterion
}
LatestByCriteriaQuery is the protobuf-free request used below the gRPC boundary.
type LatestCriterionMatch ¶
LatestCriterionMatch is positionally aligned with the corresponding input criterion. Event is valid only when Found is true.
type LatestCriterionResult ¶
type ListIndexesRequest ¶ added in v0.9.3
type ListIndexesRequest struct {
Boundary string
}
type ListIndexesResponse ¶ added in v0.9.3
type ListIndexesResponse struct {
Indexes []*BoundaryIndex
}
type LockProvider ¶
type LockProvider interface {
AcquireLock(ctx context.Context, lockName string) (LockLease, error)
}
LockProvider owns explicit lease lifecycles for named work.
type MessageHandler ¶
type MessageHandler[T any] struct { // contains filtered or unexported fields }
func NewMessageHandler ¶
func NewMessageHandler[T any](ctx context.Context) *MessageHandler[T]
NewMessageHandler Add constructor and methods for the generic stream
func NewMessageHandlerWithBuffer ¶
func NewMessageHandlerWithBuffer[T any](ctx context.Context, bufferSize int) *MessageHandler[T]
NewMessageHandlerWithBuffer allows configuring the internal buffer size
func (*MessageHandler[T]) Close ¶
func (s *MessageHandler[T]) Close()
Close marks the handler as closed to prevent further sends
func (*MessageHandler[T]) Context ¶
func (s *MessageHandler[T]) Context() context.Context
func (*MessageHandler[T]) Recv ¶
func (s *MessageHandler[T]) Recv() (*T, error)
func (*MessageHandler[T]) Send ¶
func (s *MessageHandler[T]) Send(event *T) error
func (*MessageHandler[T]) TrySend ¶
func (s *MessageHandler[T]) TrySend(event *T) error
TrySend attempts to enqueue without blocking and returns ErrQueueFull if buffer is full
type OrisunServer ¶
type OrisunServer struct {
// contains filtered or unexported fields
}
OrisunServer provides a high-level interface to interact with the Orisun event store
func NewOrisunServer ¶
func NewOrisunServer( ctx context.Context, saveEvents EventsSaver, getEvents EventsRetriever, lockProvider LockProvider, js jetstream.JetStream, logger logging.Logger, ) (*OrisunServer, error)
NewOrisunServer creates a new Orisun client with the provided configuration
func (*OrisunServer) ActivateBoundary ¶ added in v0.8.0
func (c *OrisunServer) ActivateBoundary(_ context.Context, boundary string) error
ActivateBoundary exposes a durably activated boundary to public operations.
func (*OrisunServer) ConfigureSubscriptions ¶ added in v0.14.0
func (s *OrisunServer) ConfigureSubscriptions(interval time.Duration) error
ConfigureSubscriptions configures an embedded server before subscriptions or boundary provisioning start.
func (*OrisunServer) EnableBoundaryActivationGate ¶ added in v0.8.0
func (c *OrisunServer) EnableBoundaryActivationGate(initiallyActive ...string) error
EnableBoundaryActivationGate makes public operations require an ACTIVE boundary catalog state. The admin boundary is supplied during bootstrap.
func (*OrisunServer) EnsureBoundary ¶ added in v0.8.0
func (c *OrisunServer) EnsureBoundary(ctx context.Context, boundary string) error
EnsureBoundary prepares the real-time stream for a newly provisioned boundary. Durable backend creation remains the backend adapter's concern.
func (*OrisunServer) GetEvents ¶
func (c *OrisunServer) GetEvents(ctx context.Context, req *GetEventsRequest) (ReadEventBatch, error)
GetEvents retrieves events from the event store based on the request.
func (*OrisunServer) GetLatestByCriteria ¶
func (c *OrisunServer) GetLatestByCriteria(ctx context.Context, query LatestByCriteriaQuery) (LatestByCriteriaBatch, error)
GetLatestByCriteria returns the latest event per criterion from one backend read snapshot, plus the max observed position as the optimistic-lock token for the combined context.
func (*OrisunServer) GetWriteContext ¶ added in v0.12.0
func (c *OrisunServer) GetWriteContext(ctx context.Context, req *GetWriteContextRequest) (*WriteContext, error)
func (*OrisunServer) RequireBoundaryActive ¶ added in v0.8.0
func (c *OrisunServer) RequireBoundaryActive(boundary string) error
RequireBoundaryActive validates a boundary against the local catalog gate.
func (*OrisunServer) SaveEvents ¶
func (c *OrisunServer) SaveEvents(ctx context.Context, events []EventWithMapTags, boundary string, expectedPosition *Position, query *Query) (*Position, error)
SaveEvents saves a batch with an optional single-query consistency condition.
func (*OrisunServer) SaveEventsV2 ¶ added in v0.11.0
func (c *OrisunServer) SaveEventsV2( ctx context.Context, events []EventWithMapTags, boundary string, consistency []*ConsistencyObservation, ) (*Position, error)
SaveEventsV2 saves events after atomically validating every supplied query observation.
func (*OrisunServer) SubscribeToEvents ¶
func (c *OrisunServer) SubscribeToEvents( ctx context.Context, request coreeventstore.SubscribeRequest, handler coreeventstore.EventHandler, ) error
SubscribeToEvents subscribes to events from a boundary with the given handler
type Position ¶
type Position struct {
CommitPosition int64 `json:"commit_position"`
PreparePosition int64 `json:"prepare_position"`
}
Position identifies one event in a boundary's total order.
func FirstPosition ¶
func FirstPosition() Position
FirstPosition returns the first persisted event position.
func NotExistsPosition ¶
func NotExistsPosition() Position
NotExistsPosition is the optimistic-concurrency position before any event.
func ValidateWriteContextRequest ¶ added in v0.12.0
func ValidateWriteContextRequest(req *GetWriteContextRequest) (Position, error)
type PreparedEvent ¶
PreparedEvent is the validated backend-facing event envelope; DataJSON contains only application data.
func (PreparedEvent) MarshalJSON ¶
func (e PreparedEvent) MarshalJSON() ([]byte, error)
MarshalJSON preserves the canonical data and metadata as JSON values.
type PreparedEventBatch ¶
type PreparedEventBatch []PreparedEvent
PreparedEventBatch keeps canonical event descriptors contiguous.
func PrepareEventsForSave ¶
func PrepareEventsForSave(events []EventWithMapTags) (PreparedEventBatch, error)
PrepareEventsForSave normalizes flexible embedding input exactly once.
type ReadCriterion ¶
type ReadCriterion struct {
Tags []ReadTag
}
ReadCriterion is one conjunction of tag predicates. Criteria in a LatestByCriteriaQuery are independent and retain their input order.
type ReadEvent ¶
type ReadEvent struct {
WriteId string
EventId string
EventType string
Data string
Metadata string
CommitPosition int64
PreparePosition int64
DateCreated time.Time
}
ReadEvent is the backend-neutral, contiguous read representation. Positions and timestamps are scalar values so storage and internal consumers do not allocate an object graph for every row. Backends extract stored envelope fields before returning this representation; Data contains application data.
type ReadEventBatch ¶
type ReadEventBatch []ReadEvent
ReadEventBatch keeps database results in one value slab.
func (ReadEventBatch) Response ¶ added in v0.8.0
func (b ReadEventBatch) Response() *GetEventsResponse
Response materializes the in-process response shape.
type ReadTag ¶
ReadTag is the protobuf-free criterion tag used by embedded callers and storage backends.
type SaveEventsV2Request ¶ added in v0.11.0
type SaveEventsV2Request struct {
Boundary string
Events []*EventToSave
Consistency []*ConsistencyObservation
}
type TagPredicate ¶ added in v0.14.0
TagPredicate is a comparison against one field. The field name is owned by the enclosing criterion. A string field in the durable encoding is eq; an array of predicates represents a conjunction on that same field.
func DecodeTagPredicates ¶ added in v0.14.0
func DecodeTagPredicates(value any) ([]TagPredicate, error)
type UserContextKeyType ¶
type UserContextKeyType string
const UserContextKey UserContextKeyType = "user"
type WriteContext ¶ added in v0.12.0
type WriteContext struct {
WriteId string
Consistency []*ConsistencyObservation
}
WriteContext is store-owned evidence of the observations checked for one save. WriteId is boundary-scoped and identifies the complete final position in that save. An existing record with no observations means an unconditional append. Events predating context recording have no write ID and no context record.
func DecodeWriteContext ¶ added in v0.12.0
func DecodeWriteContext(writeID string, data []byte) (*WriteContext, error)
type WriteContextRetriever ¶ added in v0.12.0
type WriteContextRetriever interface {
GetWriteContext(context.Context, *GetWriteContextRequest) (*WriteContext, error)
}
WriteContextRetriever is implemented by backends that retain write provenance.
type WriteResult ¶
Source Files
¶
- client.go
- common.go
- consistency.go
- eventstore.go
- eventstore_core.go
- eventstore_messages.go
- eventstore_metrics.go
- indexes.go
- jetstream_lock_provider.go
- latest_batch.go
- notification_relay.go
- query_predicates.go
- read_batch.go
- stream.go
- subscription_drain.go
- subscription_notifications.go
- tag_matching.go
- types.go
- utils.go
- version.go
- write_context.go
- write_context_server.go