A simple thread safe persisted counter
The module provides a simple counter on top of a go-ipfs-datastore interface
go get github.com/filecoin-project/go-storedcounter
Create/load a counter for a datastore and key:
import(
"github.com/ipfs/go-datastore"
"github.com/filecoin-project/go-storedcounter"
)
var ds datastore.Datastore
var name datastore.Key
storedCounter := storedcounter.New(ds, name)
Get the next value (will start at 0):
next := storedcCounter.Next()
Dual-licensed under MIT + Apache 2.0