ExESDBGater.Repl (ex_esdb_gater v0.0.6)

This module is to interact with the ExESDB.system, running a store called "reg_gh" (Regulate Greenhouse)

Summary

Functions

Append events to a stream.

Starts an observer (a transient subscription) for all streams.

Starts an observer (a transient subscription) for a specific event payload pattern. ## Parameters

Starts an observer for a specific event type. ## Possible event types

Starts an observer (a transient subscription) for a specific stream. ## Parameters

Starts a number of producers. Each producer will append events to a stream with stream id greenhouse-n. Where n is the number of the producer.

Stops a producer for a specific stream_id.

Functions

append(stream, nbr_of_events)

@spec append(
  stream :: atom(),
  nbr_of_events :: integer()
) :: {:ok, list(), integer()} | {:error, term()}

Append events to a stream.

get_opts()

get_streams()

get_subscriptions()

start_observer_for_all_streams()

@spec start_observer_for_all_streams() :: :ok

Starts an observer (a transient subscription) for all streams.

start_observer_for_event_payload(observer_name, event_payload_pattern)

Starts an observer (a transient subscription) for a specific event payload pattern. ## Parameters

  • observer_name: the name of the observer
  • event_payload_pattern: the event payload pattern as a map (e.g.: %{operator: "John"})

start_observer_for_event_type(event_type \\ "initialized:v1")

@spec start_observer_for_event_type(event_type :: String.t()) :: :ok

Starts an observer for a specific event type. ## Possible event types:

  • "initialized:v1" (default)
  • "temperature_measured:v1"
  • "humidity_measured:v1"
  • "light_measured:v1"
  • "fan_activated:v1"
  • "fan_deactivated:v1"
  • "light_activated:v1"
  • "light_deactivated:v1"
  • "heater_activated:v1"
  • "heater_deactivated:v1"
  • "sprinkler_activated:v1"
  • "sprinkler_deactivated:v1"
  • "desired_temperature_set:v1"
  • "desired_humidity_set:v1"
  • "desired_light_set:v1"

start_observer_for_stream(stream \\ "$greenhouse-1")

@spec start_observer_for_stream(stream :: String.t()) :: :ok

Starts an observer (a transient subscription) for a specific stream. ## Parameters

  • stream: the stream to subscribe to (default: "$greenhouse-1")

start_producers(nbr_of_producers \\ 10)

Starts a number of producers. Each producer will append events to a stream with stream id greenhouse-n. Where n is the number of the producer.

start_subscriber_for_stream(subscription_name, stream \\ "$greenhouse-1", start_from \\ 0)

@spec start_subscriber_for_stream(
  subscription_name :: String.t(),
  stream :: String.t(),
  start_from :: integer()
) :: :ok

Starts a subscriber for a specific stream. ## Parameters

- subscription_name: the name of the subscription
- stream: the stream to subscribe to (default: "$greenhouse-1")
- start_from: the version to start from (default: 0)

stop_producer_for_stream(stream_id \\ "greenhouse-1")

@spec stop_producer_for_stream(stream_id :: String.t()) :: :ok

Stops a producer for a specific stream_id.

store()

stream1()

stream2()

stream3()

stream4()

stream5()