depot/packages/networking/ipfs-cluster/datastore/inmem/inmem.go

14 lines
335 B
Go

// Package inmem provides a in-memory thread-safe datastore for use with
// Cluster.
package inmem
import (
ds "github.com/ipfs/go-datastore"
sync "github.com/ipfs/go-datastore/sync"
)
// New returns a new thread-safe in-memory go-datastore.
func New() ds.Datastore {
mapDs := ds.NewMapDatastore()
return sync.MutexWrap(mapDs)
}