NFIBrokerage / spear

A sharp EventStoreDB v20+ client backed by Mint :yum:
https://hex.pm/packages/spear
Apache License 2.0
87 stars 14 forks source link

read-only mode #18

Closed the-mikedavis closed 3 years ago

the-mikedavis commented 3 years ago

it shouldn't be immensely difficult to implement a read-only option for connections that disallows the Spear.Connection from emitting any write-related requests

I don't think the protos have any information about which RPCs are write-operations but it should be somewhat easy to curate a list or mapping

@write_apis %{
  Spear.Records.Streams => [:Write, :Delete, :Tombstone],
  ..
}

And check against this when a request is received, giving {:error, :read_only} when a write API is given in read-only mode.