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

15 lines
335 B
Go
Raw Permalink Normal View History

2022-10-19 23:23:11 +03:00
// 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)
}