gofmt
This commit is contained in:
parent
6714240653
commit
433550e9a4
@ -93,7 +93,7 @@ type FullNode interface {
|
||||
ClientStartDeal(ctx context.Context, data cid.Cid, miner address.Address, price types.BigInt, blocksDuration uint64) (*cid.Cid, error)
|
||||
ClientHasLocal(ctx context.Context, root cid.Cid) (bool, error)
|
||||
ClientFindData(ctx context.Context, root cid.Cid) ([]QueryOffer, error) // TODO: specify serialization mode we want (defaults to unixfs for now)
|
||||
ClientRetrieve(ctx context.Context, order RetrievalOrder) error // TODO: maybe just allow putting this straight into some file
|
||||
ClientRetrieve(ctx context.Context, order RetrievalOrder) error // TODO: maybe just allow putting this straight into some file
|
||||
|
||||
// ClientUnimport removes references to the specified file from filestore
|
||||
//ClientUnimport(path string)
|
||||
|
@ -73,7 +73,7 @@ type FullNodeStruct struct {
|
||||
ClientHasLocal func(ctx context.Context, root cid.Cid) (bool, error) `perm:"write"`
|
||||
ClientFindData func(ctx context.Context, root cid.Cid) ([]QueryOffer, error) `perm:"read"`
|
||||
ClientStartDeal func(ctx context.Context, data cid.Cid, miner address.Address, price types.BigInt, blocksDuration uint64) (*cid.Cid, error) `perm:"admin"`
|
||||
ClientRetrieve func(ctx context.Context, order RetrievalOrder) error `perm:"admin"`
|
||||
ClientRetrieve func(ctx context.Context, order RetrievalOrder) error `perm:"admin"`
|
||||
|
||||
StateMinerSectors func(context.Context, address.Address) ([]*SectorInfo, error) `perm:"read"`
|
||||
StateMinerProvingSet func(context.Context, address.Address) ([]*SectorInfo, error) `perm:"read"`
|
||||
|
@ -62,7 +62,7 @@ func (c *Client) Query(ctx context.Context, p discovery.RetrievalPeer, data cid.
|
||||
}
|
||||
|
||||
return api.QueryOffer{
|
||||
Root: data,
|
||||
Root: data,
|
||||
Size: resp.Size,
|
||||
MinPrice: resp.MinPrice,
|
||||
Miner: p.Address, // TODO: check
|
||||
@ -104,8 +104,8 @@ func (c *Client) RetrieveUnixfs(ctx context.Context, root cid.Cid, size uint64,
|
||||
|
||||
root: root,
|
||||
offset: 0, // TODO: Check how much data we have locally
|
||||
// TODO: Support in handler
|
||||
// TODO: Allow client to specify this
|
||||
// TODO: Support in handler
|
||||
// TODO: Allow client to specify this
|
||||
|
||||
windowSize: build.UnixfsChunkSize,
|
||||
verifier: &OptimisticVerifier{}, // TODO: Use a real verifier
|
||||
|
@ -54,7 +54,7 @@ func (m *Miner) HandleQueryStream(stream network.Stream) {
|
||||
|
||||
// TODO: get price, look for already unsealed ref to reduce work
|
||||
answer.MinPrice = types.BigMul(types.NewInt(uint64(refs[0].Size)), m.pricePerByte)
|
||||
answer.Size = uint64(refs[0].Size) // TODO: verify on intermediate
|
||||
answer.Size = uint64(refs[0].Size) // TODO: verify on intermediate
|
||||
}
|
||||
|
||||
if err := cborrpc.WriteCborRPC(stream, answer); err != nil {
|
||||
@ -66,7 +66,7 @@ func (m *Miner) HandleQueryStream(stream network.Stream) {
|
||||
func writeErr(stream network.Stream, err error) {
|
||||
log.Errorf("Retrieval deal error: %s", err)
|
||||
_ = cborrpc.WriteCborRPC(stream, DealResponse{
|
||||
Status: Error,
|
||||
Status: Error,
|
||||
Message: err.Error(),
|
||||
})
|
||||
}
|
||||
@ -82,9 +82,9 @@ func (m *Miner) HandleDealStream(stream network.Stream) { // TODO: should we blo
|
||||
for {
|
||||
var deal Deal
|
||||
if err := cborrpc.ReadCborRPC(stream, &deal); err != nil {
|
||||
return
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
if deal.Unixfs0 == nil {
|
||||
writeErr(stream, xerrors.New("unknown deal type"))
|
||||
return
|
||||
@ -133,7 +133,7 @@ func (m *Miner) HandleDealStream(stream network.Stream) { // TODO: should we blo
|
||||
size = uint64(isize)
|
||||
}
|
||||
|
||||
if deal.Unixfs0.Offset + deal.Unixfs0.Size > size {
|
||||
if deal.Unixfs0.Offset+deal.Unixfs0.Size > size {
|
||||
writeErr(stream, xerrors.Errorf("tried to read too much %d+%d > %d", deal.Unixfs0.Offset, deal.Unixfs0.Size, size))
|
||||
return
|
||||
}
|
||||
|
@ -59,6 +59,6 @@ type Deal struct {
|
||||
}
|
||||
|
||||
type DealResponse struct {
|
||||
Status int // TODO: make this more spec complainant
|
||||
Status int // TODO: make this more spec complainant
|
||||
Message string
|
||||
}
|
||||
|
@ -3,21 +3,21 @@ package storage
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/filecoin-project/go-lotus/build"
|
||||
"github.com/filecoin-project/go-lotus/storage/sector"
|
||||
|
||||
"github.com/filecoin-project/go-lotus/api"
|
||||
"github.com/filecoin-project/go-lotus/chain/actors"
|
||||
"github.com/filecoin-project/go-lotus/chain/address"
|
||||
"github.com/filecoin-project/go-lotus/chain/store"
|
||||
"github.com/filecoin-project/go-lotus/chain/types"
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/ipfs/go-datastore"
|
||||
logging "github.com/ipfs/go-log"
|
||||
host "github.com/libp2p/go-libp2p-core/host"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/filecoin-project/go-lotus/api"
|
||||
"github.com/filecoin-project/go-lotus/build"
|
||||
"github.com/filecoin-project/go-lotus/chain/actors"
|
||||
"github.com/filecoin-project/go-lotus/chain/address"
|
||||
"github.com/filecoin-project/go-lotus/chain/store"
|
||||
"github.com/filecoin-project/go-lotus/chain/types"
|
||||
"github.com/filecoin-project/go-lotus/lib/sectorbuilder"
|
||||
"github.com/filecoin-project/go-lotus/storage/sector"
|
||||
)
|
||||
|
||||
var log = logging.Logger("storageminer")
|
||||
|
@ -31,8 +31,8 @@ type SectorBlocks struct {
|
||||
*sector.Store
|
||||
|
||||
unsealed *unsealedBlocks
|
||||
keys datastore.Batching
|
||||
keyLk sync.Mutex
|
||||
keys datastore.Batching
|
||||
keyLk sync.Mutex
|
||||
}
|
||||
|
||||
func NewSectorBlocks(sectst *sector.Store, ds dtypes.MetadataDS, sb *sectorbuilder.SectorBuilder) *SectorBlocks {
|
||||
@ -43,7 +43,7 @@ func NewSectorBlocks(sectst *sector.Store, ds dtypes.MetadataDS, sb *sectorbuild
|
||||
|
||||
unsealed := &unsealedBlocks{ // TODO: untangle this
|
||||
sb: sb,
|
||||
unsealed: map[string][]byte{},
|
||||
unsealed: map[string][]byte{},
|
||||
unsealing: map[string]chan struct{}{},
|
||||
}
|
||||
|
||||
@ -201,4 +201,3 @@ func (st *SectorBlocks) SealedBlockstore(approveUnseal func() error) *SectorBloc
|
||||
approveUnseal: approveUnseal,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,5 +74,4 @@ func (s *SectorBlockStore) Get(c cid.Cid) (blocks.Block, error) {
|
||||
return blocks.NewBlockWithCid(data, c)
|
||||
}
|
||||
|
||||
|
||||
var _ blockstore.Blockstore = &SectorBlockStore{}
|
||||
|
@ -31,7 +31,7 @@ func (ub *unsealedBlocks) getRef(ctx context.Context, refs []api.SealedRef, appr
|
||||
b, ok := ub.unsealed[ref.Piece]
|
||||
if ok {
|
||||
ub.lk.Unlock()
|
||||
return b[ref.Offset:ref.Offset + uint64(ref.Size)], nil // TODO: check slice math
|
||||
return b[ref.Offset : ref.Offset+uint64(ref.Size)], nil // TODO: check slice math
|
||||
}
|
||||
// TODO: pick unsealing based on how long it's running (or just select all relevant, usually it'll be just one)
|
||||
_, ok = ub.unsealing[ref.Piece]
|
||||
@ -48,7 +48,7 @@ func (ub *unsealedBlocks) getRef(ctx context.Context, refs []api.SealedRef, appr
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return b[best.Offset:best.Offset + uint64(best.Size)], nil // TODO: check slice math
|
||||
return b[best.Offset : best.Offset+uint64(best.Size)], nil // TODO: check slice math
|
||||
}
|
||||
|
||||
func (ub *unsealedBlocks) maybeUnseal(ctx context.Context, pieceKey string, approveUnseal func() error) ([]byte, error) {
|
||||
@ -94,5 +94,3 @@ func (ub *unsealedBlocks) maybeUnseal(ctx context.Context, pieceKey string, appr
|
||||
close(ub.unsealing[pieceKey])
|
||||
return data, nil
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user