steveyen / gkvlite

Simple, ordered, key-value persistence library for the Go Language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Any plans to add transactions?

dumblob opened this issue · comments

Transactions (for any combination of reading & writing during the transaction) maintain a consistent view of the DB during some operation (typically upsert-like ones - i.e. read value V under key K, update part of V so, that it's based on its previous value, and finally save V under K).

Having more go routines (or even real threads from a pool) whereas one is a mutator and the others are readers makes transactions a requirement.

If one needs just non-persistent transactions, then synchronization primitives might be enough (though not easy to grasp from the code). But if one expects transactions take longer, then such blocking behavior is not an option and persistent transactions become a requirement.