sec

package sec

Type members

Classlikes

sealed abstract case class CacheControl(value: FiniteDuration)

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.

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.

Companion:
object
Companion:
class
sealed trait ContentType

Content type for EventData. There are two variants:

Content type for EventData. There are two variants:

Companion:
object
Companion:
class
sealed trait Event[P <: PositionInfo]

A persisted event in EventStoreDB. There are two variants:

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.
Type parameters:
P

Tells whether the event is retrieved from the global stream PositionInfo.Global or from an individual stream PositionInfo.Local.

Companion:
object
object Event
Companion:
class
final case class EventData(eventType: EventType, eventId: UUID, data: ByteVector, metadata: ByteVector, contentType: ContentType)

Event payload for an event. This is the actual data that you persist in EventStoreDB.

Event payload for an event. This is the actual data that you persist in EventStoreDB.

Value parameters:
contentType

the ContentType of encoded data and metadata.

data

a scodec.bits.ByteVector of encoded data.

eventId

unique identifier for the event.

eventType

the EventType for the event.

metadata

a scodec.bits.ByteVector of encoded metadata.

Companion:
object
object EventData
Companion:
class
final case class EventRecord[P <: PositionInfo](streamId: StreamId, position: P, eventData: EventData, created: ZonedDateTime) extends Event[P]

An event persisted in an event stream.

An event persisted in an event stream.

Value parameters:
created

the creation date of the event in java.time.ZonedDateTime.

eventData

the payload of the event.

position

the position information about of the event.

streamId

the stream identifier of the stream the event belongs to.

Companion:
object
Companion:
class
sealed trait EventType

Event type for an Event. There are two event type variants:

Event type for an Event. There are two event type variants:

See also:

https://ahjohannessen.github.io/sec/docs/types#eventtype for more information about event type usage.

Companion:
object
object EventType
Companion:
class
final case class InvalidInput(msg: String) extends ValidationError
sealed trait LogPosition

Log position for the global stream. There are two variants:

Log position for the global stream. There are two variants:

Companion:
object
Companion:
class
sealed abstract case class MaxAge(value: FiniteDuration)

The maximum age of events in the stream. Events older than this will be automatically removed.

The maximum age of events in the stream. Events older than this will be automatically removed.

Companion:
object
object MaxAge
Companion:
class
sealed abstract case class MaxCount(value: Int)

The maximum count of events in the stream. When the stream has more than max count then the oldest will be removed.

The maximum count of events in the stream. When the stream has more than max count then the oldest will be removed.

Companion:
object
object MaxCount
Companion:
class
sealed trait PositionInfo
Companion:
object
Companion:
class
final case class ResolvedEvent[P <: PositionInfo](event: EventRecord[P], link: EventRecord[P]) extends Event[P]

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-.

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-.

Value parameters:
event

the original and linked to event record.

link

the link event to the resolved event.

Companion:
object
Companion:
class
final case class StreamAcl(readRoles: Set[String], writeRoles: Set[String], deleteRoles: Set[String], metaReadRoles: Set[String], metaWriteRoles: Set[String])

Access Control List for a stream.

Access Control List for a stream.

Value parameters:
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.

readRoles

Roles and users permitted to read the stream.

writeRoles

Roles and users permitted to write to the stream.

Companion:
object
object StreamAcl
Companion:
class
sealed trait StreamId

Stream identifier for streams in EventStoreDB. There are three variants:

Stream identifier for streams in EventStoreDB. There are three variants:

Companion:
object
object StreamId
Companion:
class
sealed trait StreamPosition

Stream position in an individual stream. There are two variants:

Stream position in an individual stream. There are two variants:

Companion:
object
Companion:
class
sealed trait StreamState

The expected state that a stream is currently in. There are four variants:

The expected state that a stream is currently in. There are four variants:

==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.

Companion:
object
Companion:
class
sealed abstract class ValidationError(msg: String) extends RuntimeException with NoStackTrace

Types

type ULong = ULong

Value members

Concrete fields

val ULong: ULong.type