Correctly construct sealbstore

This commit is contained in:
Łukasz Magiera 2019-08-26 11:08:39 +02:00
parent 9691211df1
commit e0dc17bc1a
3 changed files with 22 additions and 10 deletions

View File

@ -3,6 +3,7 @@ package node
import ( import (
"context" "context"
"errors" "errors"
"github.com/filecoin-project/go-lotus/storage/sealedbstore"
"reflect" "reflect"
"time" "time"
@ -232,6 +233,7 @@ func Online() Option {
ApplyIf(func(s *Settings) bool { return s.nodeType == nodeStorageMiner }, ApplyIf(func(s *Settings) bool { return s.nodeType == nodeStorageMiner },
Override(new(*sectorbuilder.SectorBuilder), sectorbuilder.New), Override(new(*sectorbuilder.SectorBuilder), sectorbuilder.New),
Override(new(*sector.Store), sector.NewStore), Override(new(*sector.Store), sector.NewStore),
Override(new(*sealedbstore.Sealedbstore), sealedbstore.NewSealedbstore),
Override(new(*storage.Miner), modules.StorageMiner), Override(new(*storage.Miner), modules.StorageMiner),
Override(new(dtypes.StagingDAG), modules.StagingDAG), Override(new(dtypes.StagingDAG), modules.StagingDAG),

View File

@ -7,6 +7,7 @@ import (
) )
type QueryResponse int type QueryResponse int
const ( const (
Available QueryResponse = iota Available QueryResponse = iota
Unavailable Unavailable
@ -27,5 +28,3 @@ type RetQueryResponse struct {
MinPricePerMiB types.BigInt // TODO: check units used for sector size MinPricePerMiB types.BigInt // TODO: check units used for sector size
} }

View File

@ -1,6 +1,8 @@
package sealedbstore package sealedbstore
import ( import (
"github.com/filecoin-project/go-lotus/node/modules/dtypes"
"github.com/ipfs/go-datastore/namespace"
"sync" "sync"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
@ -18,6 +20,8 @@ const (
SerializationUnixfs0 SealSerialization = 'u' SerializationUnixfs0 SealSerialization = 'u'
) )
var dsPrefix = datastore.NewKey("/sealedblocks")
type SealedRef struct { type SealedRef struct {
Serialization SealSerialization Serialization SealSerialization
@ -33,6 +37,13 @@ type Sealedbstore struct {
keyLk sync.Mutex keyLk sync.Mutex
} }
func NewSealedbstore(sectst *sector.Store, ds dtypes.MetadataDS) *Sealedbstore {
return &Sealedbstore{
Store: sectst,
keys: namespace.Wrap(ds, dsPrefix),
}
}
type UnixfsReader interface { type UnixfsReader interface {
files.File files.File