sec
package sec
- Source
- package.scala
- Alphabetic
- By Inheritance
- sec
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- type AllEvent = Event[Global]
- sealed abstract case class CacheControl extends Product with Serializable
Used for the ATOM API of EventStoreDB.
Used for the ATOM API of EventStoreDB. The head of a feed in the ATOM API is not cacheable. This value allows you to specify a period of time you want it to be cacheable. Low numbers are best here, e.g. 30-60 seconds, and introducing values here will introduce latency over the ATOM protocol if caching is occuring.
- sealed trait ContentType extends AnyRef
Content type for EventData.
Content type for EventData. There are two variants:
- ContentType.Json used when event data and metadata are encoded as JSON.
- ContentType.Binary used when event data and metadata are encoded as binary. This can for instance be https://developers.google.com/protocol-buffers or utf8 encoded data like EventType.LinkTo events.
- sealed trait Event[P <: PositionInfo] extends AnyRef
A persisted event in EventStoreDB.
A persisted event in EventStoreDB. There are two variants:
- EventRecord An event in an event stream.
- ResolvedEvent A special event that contains a link and a linked event record.
- P
Tells whether the event is retrieved from the global stream PositionInfo.Global or from an individual stream PositionInfo.Local.
- final case class EventData(eventType: EventType, eventId: UUID, data: ByteVector, metadata: ByteVector, contentType: ContentType) extends Product with Serializable
Event payload for an event.
Event payload for an event. This is the actual data that you persist in EventStoreDB.
- eventType
the EventType for the event.
- eventId
unique identifier for the event.
- data
a scodec.bits.ByteVector of encoded data.
- metadata
a scodec.bits.ByteVector of encoded metadata.
- contentType
the ContentType of encoded data and metadata.
- final case class EventRecord[P <: PositionInfo](streamId: StreamId, position: P, eventData: EventData, created: ZonedDateTime) extends Event[P] with Product with Serializable
An event persisted in an event stream.
An event persisted in an event stream.
- streamId
the stream identifier of the stream the event belongs to.
- position
the position information about of the event.
- eventData
the payload of the event.
- created
the creation date of the event in java.time.ZonedDateTime.
- sealed trait EventType extends AnyRef
Event type for an Event.
Event type for an Event. There are two event type variants:
- EventType.System Type used for reserverd internal system events.
- EventType.Normal Type used by users.
- See also
https://ahjohannessen.github.io/sec/docs/types#eventtype for more information about event type usage.
- final case class InvalidInput(msg: String) extends ValidationError with Product with Serializable
- sealed trait LogPosition extends AnyRef
Log position for the global stream.
Log position for the global stream. There are two variants:
- LogPosition.Exact An exact position in the global stream.
- LogPosition.End Represents the end of the global stream.
- sealed abstract case class MaxAge extends Product with Serializable
The maximum age of events in the stream.
The maximum age of events in the stream. Events older than this will be automatically removed.
- sealed abstract case class MaxCount extends Product with Serializable
The maximum count of events in the stream.
The maximum count of events in the stream. When the stream has more than max count then the oldest will be removed.
- sealed trait PositionInfo extends AnyRef
- final case class ResolvedEvent[P <: PositionInfo](event: EventRecord[P], link: EventRecord[P]) extends Event[P] with Product with Serializable
Represents a EventType.LinkTo event that points to another event.
Represents a EventType.LinkTo event that points to another event. Resolved events are common when reading or subscribing to system prefixed streams, for instance category streams like
$ce-
or$et-
.- event
the original and linked to event record.
- link
the link event to the resolved event.
- final case class StreamAcl(readRoles: Set[String], writeRoles: Set[String], deleteRoles: Set[String], metaReadRoles: Set[String], metaWriteRoles: Set[String]) extends Product with Serializable
Access Control List for a stream.
Access Control List for a stream.
- readRoles
Roles and users permitted to read the stream.
- writeRoles
Roles and users permitted to write to the stream.
- deleteRoles
Roles and users permitted to delete the stream.
- metaReadRoles
Roles and users permitted to read stream metadata.
- metaWriteRoles
Roles and users permitted to write stream metadata.
- type StreamEvent = Event[Local]
- sealed trait StreamId extends AnyRef
Stream identifier for streams in EventStoreDB.
Stream identifier for streams in EventStoreDB. There are three variants:
- StreamId.System identifier used for reserverd internal system streams.
- StreamId.Normal identifier used by users.
- StreamId.MetaId identifier used for metadata streams of StreamId.System streams or StreamId.Normal streams.
- sealed trait StreamPosition extends AnyRef
Stream position in an individual stream.
Stream position in an individual stream. There are two variants:
- StreamPosition.Exact An exact position in a stream.
- StreamPosition.End Represents the end of a particular stream.
- sealed trait StreamState extends AnyRef
The expected state that a stream is currently in.
The expected state that a stream is currently in. There are four variants:
- StreamState.NoStream the stream does not exist yet.
- StreamState.Any No expectation of the current stream state.
- StreamState.StreamExists The stream, or its metadata stream, exists.
- StreamPosition.Exact The stream exists and its last written stream position is expected to be an exact value.
Use Cases
When you write to a stream for the first time you provide StreamState.NoStream. In order to decide if StreamState.NoStream is required you can try to read from the stream and if the read operation raises sec.api.exceptions.StreamNotFound you know that your expectation should be StreamState.NoStream.
When you do not have any expectation of the current state of a stream you should use StreamState.Any. This is, for instance, used when you just wish to append data to a stream regardless of other concurrent operations to the stream.
When you require that a stream, or its metadata stream, is present you should use StreamState.StreamExists.
When you need to implement optimistic concurrency you use StreamPosition.Exact and StreamState.NoStream as your exected stream state. You use StreamState.NoStream as expected stream state when you append to a stream for the first time, otherwise you use an StreamPosition.Exact value. A sec.api.exceptions.WrongExpectedState exception is rasised when the stream exists and has changed in the meantime.
- final class ULong extends AnyVal
- sealed abstract class ValidationError extends RuntimeException with NoStackTrace
Value Members
- object CacheControl extends Serializable
- object ContentType
- object Event
- object EventData extends Serializable
- object EventRecord extends Serializable
- object EventType
- object LogPosition
- object MaxAge extends Serializable
- object MaxCount extends Serializable
- object PositionInfo
- object ResolvedEvent extends Serializable
- object StreamAcl extends Serializable
- object StreamId
- object StreamPosition
- object StreamState
- object ULong