trait Streams[F[_]] extends AnyRef
API for interacting with streams in EventStoreDB.
Main operations
- subscribing to the global stream or an individual stream.
- reading from the global stream or an individual stream.
- appending event data to an existing stream or creating a new stream.
- deleting events from a stream.
- F
the effect type in which Streams operates.
- Alphabetic
- By Inheritance
- Streams
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def appendToStream(streamId: StreamId, expectedState: StreamState, data: NonEmptyList[EventData]): F[WriteResult]
Appends EventData to a stream and returns WriteResult with current positions of the stream after a successful operation.
Appends EventData to a stream and returns WriteResult with current positions of the stream after a successful operation. Failure to fulfill the expected state is manifested by raising sec.api.exceptions.WrongExpectedState.
- streamId
the id of the stream to append to.
- expectedState
the state that the stream is expected to in. See StreamState for details.
- data
event data to be appended to the stream. See EventData.
- See also
https://ahjohannessen.github.io/sec/docs/writing for details about appending to a stream.
- abstract def delete(streamId: StreamId, expectedState: StreamState): F[DeleteResult]
Deletes a stream and returns DeleteResult with current log position after a successful operation.
Deletes a stream and returns DeleteResult with current log position after a successful operation. Failure to fulfill the expected stated is manifested by raising sec.api.exceptions.WrongExpectedState.
- streamId
the id of the stream to delete.
- expectedState
the state that the stream is expected to in. See StreamState for details.
- Note
Deleted streams can be recreated.
- See also
https://ahjohannessen.github.io/sec/docs/deleting for details about what it means to delete a stream.
- abstract def readAll(from: LogPosition, direction: Direction, maxCount: Long, resolveLinkTos: Boolean): Stream[F, AllEvent]
Read events from the global stream, sec.StreamId.All.
Read events from the global stream, sec.StreamId.All.
- from
log position to read from.
- direction
whether to read forwards or backwards.
- maxCount
limits maximum events returned.
- resolveLinkTos
whether to resolve EventType.LinkTo events automatically.
- returns
a Stream that emits AllEvent values.
- abstract def readStream(streamId: StreamId, from: StreamPosition, direction: Direction, maxCount: Long, resolveLinkTos: Boolean): Stream[F, StreamEvent]
Read events from an individual stream.
Read events from an individual stream. A sec.api.exceptions.StreamNotFound is raised when the stream does not exist.
- streamId
the id of the stream to subscribe to.
- from
stream position to read from.
- direction
whether to read forwards or backwards.
- maxCount
limits maximum events returned.
- resolveLinkTos
whether to resolve EventType.LinkTo events automatically.
- returns
a Stream that emits StreamEvent values.
- abstract def subscribeToAll(exclusiveFrom: Option[LogPosition], filterOptions: SubscriptionFilterOptions, resolveLinkTos: Boolean): Stream[F, Either[Checkpoint, AllEvent]]
Subscribes to the global stream, StreamId.All using a subscription filter.
Subscribes to the global stream, StreamId.All using a subscription filter.
- exclusiveFrom
log position to start from. Use None to subscribe from the beginning.
- filterOptions
to use when subscribing - See sec.api.SubscriptionFilterOptions.
- resolveLinkTos
whether to resolve EventType.LinkTo events automatically.
- returns
a Stream that emits either Checkpoint or AllEvent values. How frequent Checkpoint is emitted depends on
filterOptions
.
- abstract def subscribeToAll(exclusiveFrom: Option[LogPosition], resolveLinkTos: Boolean): Stream[F, AllEvent]
Subscribes to the global stream, StreamId.All.
Subscribes to the global stream, StreamId.All.
- exclusiveFrom
position to start from. Use None to subscribe from the beginning.
- resolveLinkTos
whether to resolve EventType.LinkTo events automatically.
- returns
a Stream that emits AllEvent values.
- abstract def subscribeToStream(streamId: StreamId, exclusiveFrom: Option[StreamPosition], resolveLinkTos: Boolean): Stream[F, StreamEvent]
Subscribes to an individual stream.
Subscribes to an individual stream.
- streamId
the id of the stream to subscribe to.
- exclusiveFrom
stream position to start from. Use None to subscribe from the beginning.
- resolveLinkTos
whether to resolve EventType.LinkTo events automatically.
- returns
a Stream that emits StreamEvent values.
- abstract def tombstone(streamId: StreamId, expectedState: StreamState): F[TombstoneResult]
Tombstones a stream and returns TombstoneResult with current log position after a successful operation.
Tombstones a stream and returns TombstoneResult with current log position after a successful operation. Failure to fulfill the expected stated is manifested by raising sec.api.exceptions.WrongExpectedState.
- streamId
the id of the stream to delete.
- expectedState
the state that the stream is expected to in. See StreamState for details.
- Note
Tombstoned streams can *never* be recreated.
- See also
https://ahjohannessen.github.io/sec/docs/deleting for details about what it means to tombstone a stream.
- abstract def withCredentials(creds: UserCredentials): Streams[F]
Returns an instance that uses provided UserCredentials.
Returns an instance that uses provided UserCredentials. This is useful when an operation requires different credentials from what is provided through configuration.
- creds
Custom user credentials to use.
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated