Oreo is an open source implementation of Cherry Garcia protocol written in Go, it aims to provide an easy-to-use interface for enabling efficient multi-item transactions across heterogeneous key-value store.
It supports:
- A simple MemoryDatabase(for test only)
- Redis
- Kvrocks
- MongoDB
- CouchDB
It provides:
- Unified
Read(key string)
,Write(key string, value any)
,Delete(key string)
interfaces - ACID distributed transactions
- Snapshot Isolation
- Serializable
It is currently beta.
- An easy-to-use interface for distributed transactions.
- Support heterogeneous key-value store.
- Clean architecture.
Oreo supports 2 last Go versions and requires a Go version with modules support. So make sure to initialize a Go module:
go mod init github.com/my/repo
Then install oreo:
go get github.com/kkkzoz/oreo
Full example is in
examples/oreo_basic_with_memory_datastore
func insertTwoUsers(txn *txn.Transaction) {
user1 := User{
Username: "user1",
Password: "password1",
Email: "user1@gmail.com",
}
user2 := User{
Username: "user2",
Password: "password2",
Email: "user2@gmail.com",
}
txn.Start()
// write to memory datastore 1
txn.Write("mem1", "user1", user1)
// write to memory datastore 2
txn.Write("mem2", "user2", user2)
err := txn.Commit()
if err != nil {
panic(err)
}
fmt.Println("inserted two users")
}
Can be found here
I love Oreo and Oreo also has many different flavors of fillings!
A client coordinated transaction protocol to enable efficient multi-item transactions across heterogeneous key-value store.
This project is licensed under the MIT License. See the LICENSE file for details.