deals: fix statestore

This commit is contained in:
Łukasz Magiera 2019-08-07 01:17:41 +02:00 committed by whyrusleeping
parent 7423327b26
commit cdc535394d
3 changed files with 7 additions and 4 deletions

View File

@ -93,6 +93,7 @@ func (h *Handler) Run(ctx context.Context) {
}
go func(id cid.Cid) {
log.Info("fetching data for a deal")
err := merkledag.FetchGraph(ctx, deal.Ref, h.dag)
if err != nil {
return
@ -102,6 +103,7 @@ func (h *Handler) Run(ctx context.Context) {
case fetched <- id:
case <-h.stop:
}
log.Info("Fetched!")
}(deal.ProposalCid)
case id := <-fetched:
// TODO: send response if client still there

View File

@ -18,7 +18,8 @@ func (st *StateStore) Begin(i cid.Cid, s interface{}) error {
return err
}
if has {
return xerrors.Errorf("Already tracking state for %s", i)
// TODO: uncomment after deals work
//return xerrors.Errorf("Already tracking state for %s", i)
}
b, err := cbor.DumpObject(s)
if err != nil {
@ -49,7 +50,7 @@ func (st *StateStore) MutateMiner(i cid.Cid, mutator func(MinerDeal) (MinerDeal,
func minerMutator(m func(MinerDeal) (MinerDeal, error)) func([]byte) ([]byte, error) {
return func(in []byte) ([]byte, error) {
var cur MinerDeal
err := cbor.DecodeInto(in, cur)
err := cbor.DecodeInto(in, &cur)
if err != nil {
return nil, err
}
@ -70,7 +71,7 @@ func (st *StateStore) MutateClient(i cid.Cid, mutator func(ClientDeal) (ClientDe
func clientMutator(m func(ClientDeal) (ClientDeal, error)) func([]byte) ([]byte, error) {
return func(in []byte) ([]byte, error) {
var cur ClientDeal
err := cbor.DecodeInto(in, cur)
err := cbor.DecodeInto(in, &cur)
if err != nil {
return nil, err
}

View File

@ -17,7 +17,7 @@ var log = logging.Logger("main")
const FlagStorageRepo = "storagerepo"
func main() {
logging.SetLogLevel("*", "DEBUG")
logging.SetLogLevel("*", "INFO")
local := []*cli.Command{
runCmd,
initCmd,