kurrentdb
KurrentDB client core.
Types
pub type AppendOptions {
AppendOptions(expected_revision: ExpectedRevision)
}
Constructors
-
AppendOptions(expected_revision: ExpectedRevision)
pub type Client {
Client(endpoint: String, tls: Bool)
}
Constructors
-
Client(endpoint: String, tls: Bool)
pub type DeleteOptions {
DeleteOptions(expected_revision: ExpectedRevision)
}
Constructors
-
DeleteOptions(expected_revision: ExpectedRevision)
pub type Direction {
Forwards
Backwards
}
Constructors
-
Forwards -
Backwards
pub type Error {
HttpStatus(Int)
GrpcStatus(String)
UnknownGrpcStatus(status: String, message: String)
EmptyResponse
ManyResponses
FrameError(FrameError)
UnableToDecodeGrpcResponse(List(ProtobufDecodeError))
UnableToDecodeStreamMetadata(json.DecodeError)
AppendWrongExpectedVersion
ReadStreamNotFound(String)
StreamDeleted(String)
AccessDenied
NotAuthenticated
Unavailable
DeadlineExceeded
NotLeader(String)
UnableToBuildRequest
StreamFinished
}
Constructors
-
HttpStatus(Int) -
GrpcStatus(String) -
UnknownGrpcStatus(status: String, message: String) -
EmptyResponse -
ManyResponses -
FrameError(FrameError) -
UnableToDecodeGrpcResponse(List(ProtobufDecodeError)) -
UnableToDecodeStreamMetadata(json.DecodeError) -
AppendWrongExpectedVersion -
ReadStreamNotFound(String) -
StreamDeleted(String) -
AccessDenied -
NotAuthenticated -
Unavailable -
DeadlineExceeded -
NotLeader(String) -
UnableToBuildRequest -
StreamFinished
pub type Event {
Event(
id: String,
type_: String,
content_type: String,
data: BitArray,
metadata: BitArray,
)
}
Constructors
-
Event( id: String, type_: String, content_type: String, data: BitArray, metadata: BitArray, )
pub type ExpectedRevision {
Revision(Int)
NoStream
Any
StreamExists
}
Constructors
-
Revision(Int) -
NoStream -
Any -
StreamExists
pub type FilterWindow {
FilterMax(Int)
FilterCount
}
Constructors
-
FilterMax(Int) -
FilterCount
pub type FrameError {
IncompleteHeader
CompressedMessage
IncompleteMessage(expected_bytes: Int)
}
Constructors
-
IncompleteHeader -
CompressedMessage -
IncompleteMessage(expected_bytes: Int)
pub type Position {
NoPositionReturned
Position(commit_position: Int, prepare_position: Int)
}
Constructors
-
NoPositionReturned -
Position(commit_position: Int, prepare_position: Int)
pub type ProtobufDecodeError {
DecodeError(
expected: String,
found: String,
path: List(String),
)
FieldNotFound(field_number: Int)
}
Constructors
-
DecodeError(expected: String, found: String, path: List(String)) -
FieldNotFound(field_number: Int)
pub type ReadAllFilter {
NoFilter
EventTypePrefix(prefixes: List(String), window: FilterWindow)
EventTypeRegex(regex: String, window: FilterWindow)
StreamNamePrefix(prefixes: List(String), window: FilterWindow)
StreamNameRegex(regex: String, window: FilterWindow)
}
Constructors
-
NoFilter -
EventTypePrefix(prefixes: List(String), window: FilterWindow) -
EventTypeRegex(regex: String, window: FilterWindow) -
StreamNamePrefix(prefixes: List(String), window: FilterWindow) -
StreamNameRegex(regex: String, window: FilterWindow)
pub type ReadAllOptions {
ReadAllOptions(
direction: Direction,
from_position: ReadAllPosition,
max_count: Int,
resolve_links: Bool,
filter: ReadAllFilter,
)
}
Constructors
-
ReadAllOptions( direction: Direction, from_position: ReadAllPosition, max_count: Int, resolve_links: Bool, filter: ReadAllFilter, )
pub type ReadAllPosition {
ReadAllFromStart
ReadAllFromEnd
ReadAllFromPosition(
commit_position: Int,
prepare_position: Int,
)
}
Constructors
-
ReadAllFromStart -
ReadAllFromEnd -
ReadAllFromPosition(commit_position: Int, prepare_position: Int)
pub type ReadEvent {
Recorded(RecordedEvent)
Resolved(link: RecordedEvent, event: RecordedEvent)
}
Constructors
-
Recorded(RecordedEvent) -
Resolved(link: RecordedEvent, event: RecordedEvent)
pub type ReadMessage {
ReadEvent(ReadEvent)
SubscriptionConfirmed(String)
Checkpoint(Position)
CaughtUp(SubscriptionCheckpoint)
FellBehind(SubscriptionCheckpoint)
FirstStreamPosition(Int)
LastStreamPosition(Int)
LastAllStreamPosition(Position)
ReadIgnored
}
Constructors
-
ReadEvent(ReadEvent) -
SubscriptionConfirmed(String) -
Checkpoint(Position) -
CaughtUp(SubscriptionCheckpoint) -
FellBehind(SubscriptionCheckpoint) -
FirstStreamPosition(Int) -
LastStreamPosition(Int) -
LastAllStreamPosition(Position) -
ReadIgnored
pub type ReadRevision {
FromStart
FromEnd
FromRevision(Int)
}
Constructors
-
FromStart -
FromEnd -
FromRevision(Int)
pub type ReadStreamOptions {
ReadStreamOptions(
direction: Direction,
from_revision: ReadRevision,
max_count: Int,
resolve_links: Bool,
)
}
Constructors
-
ReadStreamOptions( direction: Direction, from_revision: ReadRevision, max_count: Int, resolve_links: Bool, )
pub type ReadTransport(stream, transport_error) {
ReadTransport(
open: fn(request.Request(BitArray)) -> Result(
stream,
transport_error,
),
receive: fn(stream, Int) -> Result(
#(stream, ReadTransportMessage),
transport_error,
),
close: fn(stream) -> Nil,
)
}
Constructors
-
ReadTransport( open: fn(request.Request(BitArray)) -> Result( stream, transport_error, ), receive: fn(stream, Int) -> Result( #(stream, ReadTransportMessage), transport_error, ), close: fn(stream) -> Nil, )
pub type ReadTransportMessage {
ReadTransportMessage(BitArray)
ReadTransportFinished
}
Constructors
-
ReadTransportMessage(BitArray) -
ReadTransportFinished
pub type RecordedEvent {
RecordedEvent(
id: String,
stream: String,
revision: Int,
prepare_position: Int,
commit_position: Int,
metadata: List(#(String, String)),
custom_metadata: BitArray,
data: BitArray,
)
}
Constructors
-
RecordedEvent( id: String, stream: String, revision: Int, prepare_position: Int, commit_position: Int, metadata: List(#(String, String)), custom_metadata: BitArray, data: BitArray, )
pub type SetStreamMetadataOptions {
SetStreamMetadataOptions(expected_revision: ExpectedRevision)
}
Constructors
-
SetStreamMetadataOptions(expected_revision: ExpectedRevision)
pub type StreamAcl {
StreamAcl(
read_roles: List(String),
write_roles: List(String),
delete_roles: List(String),
meta_read_roles: List(String),
meta_write_roles: List(String),
)
}
Constructors
-
StreamAcl( read_roles: List(String), write_roles: List(String), delete_roles: List(String), meta_read_roles: List(String), meta_write_roles: List(String), )
pub type StreamMetadata {
StreamMetadata(
max_count: option.Option(Int),
max_age: option.Option(Int),
truncate_before: option.Option(Int),
cache_control: option.Option(Int),
acl: option.Option(StreamAcl),
custom: List(#(String, json.Json)),
)
}
Constructors
-
StreamMetadata( max_count: option.Option(Int), max_age: option.Option(Int), truncate_before: option.Option(Int), cache_control: option.Option(Int), acl: option.Option(StreamAcl), custom: List(#(String, json.Json)), )
pub type SubscribeToAllOptions {
SubscribeToAllOptions(
direction: Direction,
from_position: ReadAllPosition,
resolve_links: Bool,
filter: ReadAllFilter,
)
}
Constructors
-
SubscribeToAllOptions( direction: Direction, from_position: ReadAllPosition, resolve_links: Bool, filter: ReadAllFilter, )
pub type SubscribeToStreamOptions {
SubscribeToStreamOptions(
direction: Direction,
from_revision: ReadRevision,
resolve_links: Bool,
)
}
Constructors
-
SubscribeToStreamOptions( direction: Direction, from_revision: ReadRevision, resolve_links: Bool, )
pub type Subscription(stream, transport_error) {
Subscription(
stream: stream,
transport: ReadTransport(stream, transport_error),
)
}
Constructors
-
Subscription( stream: stream, transport: ReadTransport(stream, transport_error), )
pub type TombstoneOptions {
TombstoneOptions(expected_revision: ExpectedRevision)
}
Constructors
-
TombstoneOptions(expected_revision: ExpectedRevision)
Values
pub fn append_to_stream(
client: Client,
stream stream: String,
events events: List(Event),
options options: AppendOptions,
using send: fn(request.Request(BitArray)) -> Result(
response.Response(BitArray),
send_error,
),
) -> Result(Append, OperationError(send_error))
pub fn binary_event(
uuid id: String,
type_ type_: String,
data data: BitArray,
) -> Event
pub fn close_subscription(
subscription: Subscription(stream, transport_error),
) -> Nil
pub fn decode_append_to_stream_response(
response: response.Response(BitArray),
) -> Result(Append, Error)
pub fn decode_delete_stream_response(
response: response.Response(BitArray),
) -> Result(Delete, Error)
pub fn decode_read_stream_message(
message: BitArray,
) -> Result(ReadMessage, Error)
pub fn decode_stream_metadata(
data: BitArray,
) -> Result(StreamMetadata, Error)
pub fn decode_tombstone_stream_response(
response: response.Response(BitArray),
) -> Result(Tombstone, Error)
pub fn default_append_options() -> AppendOptions
pub fn default_delete_options() -> DeleteOptions
pub fn default_read_all_options() -> ReadAllOptions
pub fn default_read_stream_options() -> ReadStreamOptions
pub fn default_set_stream_metadata_options() -> SetStreamMetadataOptions
pub fn default_subscribe_to_all_options() -> SubscribeToAllOptions
pub fn default_subscribe_to_stream_options() -> SubscribeToStreamOptions
pub fn default_tombstone_options() -> TombstoneOptions
pub fn delete_expected_revision(
options: DeleteOptions,
expected_revision: ExpectedRevision,
) -> DeleteOptions
pub fn delete_stream(
client: Client,
stream stream_name: String,
options options: DeleteOptions,
using send: fn(request.Request(BitArray)) -> Result(
response.Response(BitArray),
send_error,
),
) -> Result(Delete, OperationError(send_error))
pub fn expected_revision(
options: AppendOptions,
expected_revision: ExpectedRevision,
) -> AppendOptions
pub fn from_connection_string(
connection_string: String,
) -> Result(Client, @internal Error)
pub fn get_stream_metadata(
client: Client,
stream stream_name: String,
using transport: ReadTransport(stream, transport_error),
within timeout: Int,
) -> Result(StreamMetadata, OperationError(transport_error))
pub fn metadata_acl(
metadata: StreamMetadata,
acl: StreamAcl,
) -> StreamMetadata
pub fn metadata_cache_control(
metadata: StreamMetadata,
cache_control: Int,
) -> StreamMetadata
pub fn metadata_custom(
metadata: StreamMetadata,
key: String,
value: json.Json,
) -> StreamMetadata
pub fn metadata_expected_revision(
options: SetStreamMetadataOptions,
expected_revision: ExpectedRevision,
) -> SetStreamMetadataOptions
pub fn metadata_max_age(
metadata: StreamMetadata,
max_age: Int,
) -> StreamMetadata
pub fn metadata_max_count(
metadata: StreamMetadata,
max_count: Int,
) -> StreamMetadata
pub fn metadata_truncate_before(
metadata: StreamMetadata,
truncate_before: Int,
) -> StreamMetadata
pub fn read_all(
client: Client,
options options: ReadAllOptions,
using transport: ReadTransport(stream, transport_error),
within timeout: Int,
) -> Result(List(ReadEvent), OperationError(transport_error))
pub fn read_all_direction(
options: ReadAllOptions,
direction: Direction,
) -> ReadAllOptions
pub fn read_all_filter(
options: ReadAllOptions,
filter: ReadAllFilter,
) -> ReadAllOptions
pub fn read_all_from_position(
options: ReadAllOptions,
position: ReadAllPosition,
) -> ReadAllOptions
pub fn read_all_max_count(
options: ReadAllOptions,
max_count: Int,
) -> ReadAllOptions
pub fn read_all_messages(
client: Client,
options options: ReadAllOptions,
using transport: ReadTransport(stream, transport_error),
within timeout: Int,
) -> Result(List(ReadMessage), OperationError(transport_error))
pub fn read_all_resolve_links(
options: ReadAllOptions,
resolve_links: Bool,
) -> ReadAllOptions
pub fn read_stream(
client: Client,
stream stream_name: String,
options options: ReadStreamOptions,
using transport: ReadTransport(stream, transport_error),
within timeout: Int,
) -> Result(List(ReadEvent), OperationError(transport_error))
pub fn read_stream_from_revision(
options: ReadStreamOptions,
revision: ReadRevision,
) -> ReadStreamOptions
pub fn read_stream_max_count(
options: ReadStreamOptions,
max_count: Int,
) -> ReadStreamOptions
pub fn read_stream_messages(
client: Client,
stream stream: String,
options options: ReadStreamOptions,
using transport: ReadTransport(stream, transport_error),
within timeout: Int,
) -> Result(List(ReadMessage), OperationError(transport_error))
pub fn read_stream_read_direction(
options: ReadStreamOptions,
direction: Direction,
) -> ReadStreamOptions
pub fn read_stream_resolve_links(
options: ReadStreamOptions,
resolve_links: Bool,
) -> ReadStreamOptions
pub fn receive_subscription_event(
subscription: Subscription(stream, transport_error),
within timeout: Int,
) -> Result(
#(Subscription(stream, transport_error), ReadEvent),
OperationError(transport_error),
)
pub fn receive_subscription_message(
subscription: Subscription(stream, transport_error),
within timeout: Int,
) -> Result(
#(Subscription(stream, transport_error), ReadMessage),
OperationError(transport_error),
)
pub fn set_stream_metadata(
client: Client,
stream stream_name: String,
metadata metadata: StreamMetadata,
uuid id: String,
options options: SetStreamMetadataOptions,
using send: fn(request.Request(BitArray)) -> Result(
response.Response(BitArray),
send_error,
),
) -> Result(Append, OperationError(send_error))
pub fn stream_acl() -> StreamAcl
pub fn stream_metadata() -> StreamMetadata
pub fn subscribe_to_all(
client: Client,
options options: SubscribeToAllOptions,
using transport: ReadTransport(stream, transport_error),
) -> Result(
Subscription(stream, transport_error),
OperationError(transport_error),
)
pub fn subscribe_to_all_direction(
options: SubscribeToAllOptions,
direction: Direction,
) -> SubscribeToAllOptions
pub fn subscribe_to_all_filter(
options: SubscribeToAllOptions,
filter: ReadAllFilter,
) -> SubscribeToAllOptions
pub fn subscribe_to_all_from_position(
options: SubscribeToAllOptions,
position: ReadAllPosition,
) -> SubscribeToAllOptions
pub fn subscribe_to_all_resolve_links(
options: SubscribeToAllOptions,
resolve_links: Bool,
) -> SubscribeToAllOptions
pub fn subscribe_to_stream(
client: Client,
stream stream_name: String,
options options: SubscribeToStreamOptions,
using transport: ReadTransport(stream, transport_error),
) -> Result(
Subscription(stream, transport_error),
OperationError(transport_error),
)
pub fn subscribe_to_stream_from_revision(
options: SubscribeToStreamOptions,
revision: ReadRevision,
) -> SubscribeToStreamOptions
pub fn subscribe_to_stream_read_direction(
options: SubscribeToStreamOptions,
direction: Direction,
) -> SubscribeToStreamOptions
pub fn subscribe_to_stream_resolve_links(
options: SubscribeToStreamOptions,
resolve_links: Bool,
) -> SubscribeToStreamOptions
pub fn tombstone_expected_revision(
options: TombstoneOptions,
expected_revision: ExpectedRevision,
) -> TombstoneOptions
pub fn tombstone_stream(
client: Client,
stream stream_name: String,
options options: TombstoneOptions,
using send: fn(request.Request(BitArray)) -> Result(
response.Response(BitArray),
send_error,
),
) -> Result(Tombstone, OperationError(send_error))