SeanCheatham/scala-storage

Replication Storage

Opened this issue · 0 comments

Overview

Implement a new storage mechanism which writes to two or more (other) storage systems. There should be adapters for both DocumentStorage and BinaryStorage.

Implementation

Write requests should be made to all child storage mechanisms. All requests must succeed. If even one write fails, the other writes should be rolled back. For read requests, a configurable strategy may be employed. The strategy could be one of:

  • First Of: The read request will be asynchronously sent to all children. The first to successfully respond will win.
  • Sequential: The request will be passed to the children sequentially, until a successful response is returned.
  • All Of: The request will be sent to all children. The responses must succeed for all child requests, and the responses must all be equal.

Example

Primary: Firebase, MongoDB, DynamoDB
Read Strategy: First Of

Write requests will be passed to Firebase, MongoDB, and DynamoDB. All requests must succeed. If any are unsuccessful, the rest must be rolled back.
Read requests will be sent to Firebase, MongoDB, and Dynamo DB at the same time. The first one to respond will be returned.