add context to LockedRepo#Datastore().
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package repo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@@ -67,7 +68,7 @@ func (fsr *fsLockedRepo) openDatastores(readonly bool) (map[string]datastore.Bat
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (fsr *fsLockedRepo) Datastore(ns string) (datastore.Batching, error) {
|
||||
func (fsr *fsLockedRepo) Datastore(_ context.Context, ns string) (datastore.Batching, error) {
|
||||
fsr.dsOnce.Do(func() {
|
||||
fsr.ds, fsr.dsErr = fsr.openDatastores(fsr.readonly)
|
||||
})
|
||||
|
||||
@@ -52,7 +52,10 @@ type LockedRepo interface {
|
||||
Close() error
|
||||
|
||||
// Returns datastore defined in this repo.
|
||||
Datastore(namespace string) (datastore.Batching, error)
|
||||
// The supplied context must only be used to initialize the datastore.
|
||||
// The implementation should not retain the context for usage throughout
|
||||
// the lifecycle.
|
||||
Datastore(ctx context.Context, namespace string) (datastore.Batching, error)
|
||||
|
||||
// Blockstore returns an IPLD blockstore for the requested domain.
|
||||
// The supplied context must only be used to initialize the blockstore.
|
||||
|
||||
@@ -237,7 +237,7 @@ func (lmem *lockedMemRepo) Close() error {
|
||||
|
||||
}
|
||||
|
||||
func (lmem *lockedMemRepo) Datastore(ns string) (datastore.Batching, error) {
|
||||
func (lmem *lockedMemRepo) Datastore(_ context.Context, ns string) (datastore.Batching, error) {
|
||||
if err := lmem.checkToken(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user