pressly / chainstore

Lightweight key-value interface to a bunch of storage engines with middleware support, organized as a chain of operations; written in Go
130 stars 10 forks source link

Chain: Underlying Store fails on PUT - what to do? #10

Open VojtechVitek opened 9 years ago

VojtechVitek commented 9 years ago

Let's say I have 3 stores: Memstore, BoltDB (async) and s3 (async).

given chain.Put(ctx, key, data)

What should we do? Should we automatically re-try storing the value into the BoltDB again? What if the DB is down for a bit? Should we have a retry queue per Store?

Or since we have LRU, should we have something like PUT down ON DELETE functionality on chain?

VojtechVitek commented 9 years ago

Idea:

err, errCh := chain.Put(ctx, key, value)
if err != nil {
    // handle errors coming from blocking (sync) stores
}
go func() {
      for _, err := range errCh {
            // handle errors coming from async stores
            err.(StoreErr).Retry() // ?
      }
}