Merge pull request #8540 from filecoin-project/fix/market-deal-api-pointer
fix: api: Make MarketListDeals and DealsList return pointers for MarketDeal
This commit is contained in:
commit
52d5d57460
@ -517,7 +517,7 @@ type FullNode interface {
|
|||||||
// StateMarketParticipants returns the Escrow and Locked balances of every participant in the Storage Market
|
// StateMarketParticipants returns the Escrow and Locked balances of every participant in the Storage Market
|
||||||
StateMarketParticipants(context.Context, types.TipSetKey) (map[string]MarketBalance, error) //perm:read
|
StateMarketParticipants(context.Context, types.TipSetKey) (map[string]MarketBalance, error) //perm:read
|
||||||
// StateMarketDeals returns information about every deal in the Storage Market
|
// StateMarketDeals returns information about every deal in the Storage Market
|
||||||
StateMarketDeals(context.Context, types.TipSetKey) (map[string]MarketDeal, error) //perm:read
|
StateMarketDeals(context.Context, types.TipSetKey) (map[string]*MarketDeal, error) //perm:read
|
||||||
// StateMarketStorageDeal returns information about the indicated deal
|
// StateMarketStorageDeal returns information about the indicated deal
|
||||||
StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*MarketDeal, error) //perm:read
|
StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*MarketDeal, error) //perm:read
|
||||||
// StateLookupID retrieves the ID address of the given address
|
// StateLookupID retrieves the ID address of the given address
|
||||||
|
@ -162,7 +162,7 @@ type StorageMiner interface {
|
|||||||
StorageStat(ctx context.Context, id storiface.ID) (fsutil.FsStat, error) //perm:admin
|
StorageStat(ctx context.Context, id storiface.ID) (fsutil.FsStat, error) //perm:admin
|
||||||
|
|
||||||
MarketImportDealData(ctx context.Context, propcid cid.Cid, path string) error //perm:write
|
MarketImportDealData(ctx context.Context, propcid cid.Cid, path string) error //perm:write
|
||||||
MarketListDeals(ctx context.Context) ([]MarketDeal, error) //perm:read
|
MarketListDeals(ctx context.Context) ([]*MarketDeal, error) //perm:read
|
||||||
MarketListRetrievalDeals(ctx context.Context) ([]retrievalmarket.ProviderDealState, error) //perm:read
|
MarketListRetrievalDeals(ctx context.Context) ([]retrievalmarket.ProviderDealState, error) //perm:read
|
||||||
MarketGetDealUpdates(ctx context.Context) (<-chan storagemarket.MinerDeal, error) //perm:read
|
MarketGetDealUpdates(ctx context.Context) (<-chan storagemarket.MinerDeal, error) //perm:read
|
||||||
MarketListIncompleteDeals(ctx context.Context) ([]storagemarket.MinerDeal, error) //perm:read
|
MarketListIncompleteDeals(ctx context.Context) ([]storagemarket.MinerDeal, error) //perm:read
|
||||||
@ -239,7 +239,7 @@ type StorageMiner interface {
|
|||||||
RuntimeSubsystems(ctx context.Context) (MinerSubsystems, error) //perm:read
|
RuntimeSubsystems(ctx context.Context) (MinerSubsystems, error) //perm:read
|
||||||
|
|
||||||
DealsImportData(ctx context.Context, dealPropCid cid.Cid, file string) error //perm:admin
|
DealsImportData(ctx context.Context, dealPropCid cid.Cid, file string) error //perm:admin
|
||||||
DealsList(ctx context.Context) ([]MarketDeal, error) //perm:admin
|
DealsList(ctx context.Context) ([]*MarketDeal, error) //perm:admin
|
||||||
DealsConsiderOnlineStorageDeals(context.Context) (bool, error) //perm:admin
|
DealsConsiderOnlineStorageDeals(context.Context) (bool, error) //perm:admin
|
||||||
DealsSetConsiderOnlineStorageDeals(context.Context, bool) error //perm:admin
|
DealsSetConsiderOnlineStorageDeals(context.Context, bool) error //perm:admin
|
||||||
DealsConsiderOnlineRetrievalDeals(context.Context) (bool, error) //perm:admin
|
DealsConsiderOnlineRetrievalDeals(context.Context) (bool, error) //perm:admin
|
||||||
|
@ -2512,10 +2512,10 @@ func (mr *MockFullNodeMockRecorder) StateMarketBalance(arg0, arg1, arg2 interfac
|
|||||||
}
|
}
|
||||||
|
|
||||||
// StateMarketDeals mocks base method.
|
// StateMarketDeals mocks base method.
|
||||||
func (m *MockFullNode) StateMarketDeals(arg0 context.Context, arg1 types.TipSetKey) (map[string]api.MarketDeal, error) {
|
func (m *MockFullNode) StateMarketDeals(arg0 context.Context, arg1 types.TipSetKey) (map[string]*api.MarketDeal, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "StateMarketDeals", arg0, arg1)
|
ret := m.ctrl.Call(m, "StateMarketDeals", arg0, arg1)
|
||||||
ret0, _ := ret[0].(map[string]api.MarketDeal)
|
ret0, _ := ret[0].(map[string]*api.MarketDeal)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
@ -366,7 +366,7 @@ type FullNodeStruct struct {
|
|||||||
|
|
||||||
StateMarketBalance func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (MarketBalance, error) `perm:"read"`
|
StateMarketBalance func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (MarketBalance, error) `perm:"read"`
|
||||||
|
|
||||||
StateMarketDeals func(p0 context.Context, p1 types.TipSetKey) (map[string]MarketDeal, error) `perm:"read"`
|
StateMarketDeals func(p0 context.Context, p1 types.TipSetKey) (map[string]*MarketDeal, error) `perm:"read"`
|
||||||
|
|
||||||
StateMarketParticipants func(p0 context.Context, p1 types.TipSetKey) (map[string]MarketBalance, error) `perm:"read"`
|
StateMarketParticipants func(p0 context.Context, p1 types.TipSetKey) (map[string]MarketBalance, error) `perm:"read"`
|
||||||
|
|
||||||
@ -671,7 +671,7 @@ type StorageMinerStruct struct {
|
|||||||
|
|
||||||
DealsImportData func(p0 context.Context, p1 cid.Cid, p2 string) error `perm:"admin"`
|
DealsImportData func(p0 context.Context, p1 cid.Cid, p2 string) error `perm:"admin"`
|
||||||
|
|
||||||
DealsList func(p0 context.Context) ([]MarketDeal, error) `perm:"admin"`
|
DealsList func(p0 context.Context) ([]*MarketDeal, error) `perm:"admin"`
|
||||||
|
|
||||||
DealsPieceCidBlocklist func(p0 context.Context) ([]cid.Cid, error) `perm:"admin"`
|
DealsPieceCidBlocklist func(p0 context.Context) ([]cid.Cid, error) `perm:"admin"`
|
||||||
|
|
||||||
@ -709,7 +709,7 @@ type StorageMinerStruct struct {
|
|||||||
|
|
||||||
MarketListDataTransfers func(p0 context.Context) ([]DataTransferChannel, error) `perm:"write"`
|
MarketListDataTransfers func(p0 context.Context) ([]DataTransferChannel, error) `perm:"write"`
|
||||||
|
|
||||||
MarketListDeals func(p0 context.Context) ([]MarketDeal, error) `perm:"read"`
|
MarketListDeals func(p0 context.Context) ([]*MarketDeal, error) `perm:"read"`
|
||||||
|
|
||||||
MarketListIncompleteDeals func(p0 context.Context) ([]storagemarket.MinerDeal, error) `perm:"read"`
|
MarketListIncompleteDeals func(p0 context.Context) ([]storagemarket.MinerDeal, error) `perm:"read"`
|
||||||
|
|
||||||
@ -2539,15 +2539,15 @@ func (s *FullNodeStub) StateMarketBalance(p0 context.Context, p1 address.Address
|
|||||||
return *new(MarketBalance), ErrNotSupported
|
return *new(MarketBalance), ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FullNodeStruct) StateMarketDeals(p0 context.Context, p1 types.TipSetKey) (map[string]MarketDeal, error) {
|
func (s *FullNodeStruct) StateMarketDeals(p0 context.Context, p1 types.TipSetKey) (map[string]*MarketDeal, error) {
|
||||||
if s.Internal.StateMarketDeals == nil {
|
if s.Internal.StateMarketDeals == nil {
|
||||||
return *new(map[string]MarketDeal), ErrNotSupported
|
return *new(map[string]*MarketDeal), ErrNotSupported
|
||||||
}
|
}
|
||||||
return s.Internal.StateMarketDeals(p0, p1)
|
return s.Internal.StateMarketDeals(p0, p1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FullNodeStub) StateMarketDeals(p0 context.Context, p1 types.TipSetKey) (map[string]MarketDeal, error) {
|
func (s *FullNodeStub) StateMarketDeals(p0 context.Context, p1 types.TipSetKey) (map[string]*MarketDeal, error) {
|
||||||
return *new(map[string]MarketDeal), ErrNotSupported
|
return *new(map[string]*MarketDeal), ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FullNodeStruct) StateMarketParticipants(p0 context.Context, p1 types.TipSetKey) (map[string]MarketBalance, error) {
|
func (s *FullNodeStruct) StateMarketParticipants(p0 context.Context, p1 types.TipSetKey) (map[string]MarketBalance, error) {
|
||||||
@ -4024,15 +4024,15 @@ func (s *StorageMinerStub) DealsImportData(p0 context.Context, p1 cid.Cid, p2 st
|
|||||||
return ErrNotSupported
|
return ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StorageMinerStruct) DealsList(p0 context.Context) ([]MarketDeal, error) {
|
func (s *StorageMinerStruct) DealsList(p0 context.Context) ([]*MarketDeal, error) {
|
||||||
if s.Internal.DealsList == nil {
|
if s.Internal.DealsList == nil {
|
||||||
return *new([]MarketDeal), ErrNotSupported
|
return *new([]*MarketDeal), ErrNotSupported
|
||||||
}
|
}
|
||||||
return s.Internal.DealsList(p0)
|
return s.Internal.DealsList(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StorageMinerStub) DealsList(p0 context.Context) ([]MarketDeal, error) {
|
func (s *StorageMinerStub) DealsList(p0 context.Context) ([]*MarketDeal, error) {
|
||||||
return *new([]MarketDeal), ErrNotSupported
|
return *new([]*MarketDeal), ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StorageMinerStruct) DealsPieceCidBlocklist(p0 context.Context) ([]cid.Cid, error) {
|
func (s *StorageMinerStruct) DealsPieceCidBlocklist(p0 context.Context) ([]cid.Cid, error) {
|
||||||
@ -4233,15 +4233,15 @@ func (s *StorageMinerStub) MarketListDataTransfers(p0 context.Context) ([]DataTr
|
|||||||
return *new([]DataTransferChannel), ErrNotSupported
|
return *new([]DataTransferChannel), ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StorageMinerStruct) MarketListDeals(p0 context.Context) ([]MarketDeal, error) {
|
func (s *StorageMinerStruct) MarketListDeals(p0 context.Context) ([]*MarketDeal, error) {
|
||||||
if s.Internal.MarketListDeals == nil {
|
if s.Internal.MarketListDeals == nil {
|
||||||
return *new([]MarketDeal), ErrNotSupported
|
return *new([]*MarketDeal), ErrNotSupported
|
||||||
}
|
}
|
||||||
return s.Internal.MarketListDeals(p0)
|
return s.Internal.MarketListDeals(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StorageMinerStub) MarketListDeals(p0 context.Context) ([]MarketDeal, error) {
|
func (s *StorageMinerStub) MarketListDeals(p0 context.Context) ([]*MarketDeal, error) {
|
||||||
return *new([]MarketDeal), ErrNotSupported
|
return *new([]*MarketDeal), ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StorageMinerStruct) MarketListIncompleteDeals(p0 context.Context) ([]storagemarket.MinerDeal, error) {
|
func (s *StorageMinerStruct) MarketListIncompleteDeals(p0 context.Context) ([]storagemarket.MinerDeal, error) {
|
||||||
|
@ -521,7 +521,7 @@ type FullNode interface {
|
|||||||
// StateMarketParticipants returns the Escrow and Locked balances of every participant in the Storage Market
|
// StateMarketParticipants returns the Escrow and Locked balances of every participant in the Storage Market
|
||||||
StateMarketParticipants(context.Context, types.TipSetKey) (map[string]api.MarketBalance, error) //perm:read
|
StateMarketParticipants(context.Context, types.TipSetKey) (map[string]api.MarketBalance, error) //perm:read
|
||||||
// StateMarketDeals returns information about every deal in the Storage Market
|
// StateMarketDeals returns information about every deal in the Storage Market
|
||||||
StateMarketDeals(context.Context, types.TipSetKey) (map[string]api.MarketDeal, error) //perm:read
|
StateMarketDeals(context.Context, types.TipSetKey) (map[string]*api.MarketDeal, error) //perm:read
|
||||||
// StateMarketStorageDeal returns information about the indicated deal
|
// StateMarketStorageDeal returns information about the indicated deal
|
||||||
StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*api.MarketDeal, error) //perm:read
|
StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*api.MarketDeal, error) //perm:read
|
||||||
// StateLookupID retrieves the ID address of the given address
|
// StateLookupID retrieves the ID address of the given address
|
||||||
|
@ -283,7 +283,7 @@ type FullNodeStruct struct {
|
|||||||
|
|
||||||
StateMarketBalance func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (api.MarketBalance, error) `perm:"read"`
|
StateMarketBalance func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (api.MarketBalance, error) `perm:"read"`
|
||||||
|
|
||||||
StateMarketDeals func(p0 context.Context, p1 types.TipSetKey) (map[string]api.MarketDeal, error) `perm:"read"`
|
StateMarketDeals func(p0 context.Context, p1 types.TipSetKey) (map[string]*api.MarketDeal, error) `perm:"read"`
|
||||||
|
|
||||||
StateMarketParticipants func(p0 context.Context, p1 types.TipSetKey) (map[string]api.MarketBalance, error) `perm:"read"`
|
StateMarketParticipants func(p0 context.Context, p1 types.TipSetKey) (map[string]api.MarketBalance, error) `perm:"read"`
|
||||||
|
|
||||||
@ -1834,15 +1834,15 @@ func (s *FullNodeStub) StateMarketBalance(p0 context.Context, p1 address.Address
|
|||||||
return *new(api.MarketBalance), ErrNotSupported
|
return *new(api.MarketBalance), ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FullNodeStruct) StateMarketDeals(p0 context.Context, p1 types.TipSetKey) (map[string]api.MarketDeal, error) {
|
func (s *FullNodeStruct) StateMarketDeals(p0 context.Context, p1 types.TipSetKey) (map[string]*api.MarketDeal, error) {
|
||||||
if s.Internal.StateMarketDeals == nil {
|
if s.Internal.StateMarketDeals == nil {
|
||||||
return *new(map[string]api.MarketDeal), ErrNotSupported
|
return *new(map[string]*api.MarketDeal), ErrNotSupported
|
||||||
}
|
}
|
||||||
return s.Internal.StateMarketDeals(p0, p1)
|
return s.Internal.StateMarketDeals(p0, p1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FullNodeStub) StateMarketDeals(p0 context.Context, p1 types.TipSetKey) (map[string]api.MarketDeal, error) {
|
func (s *FullNodeStub) StateMarketDeals(p0 context.Context, p1 types.TipSetKey) (map[string]*api.MarketDeal, error) {
|
||||||
return *new(map[string]api.MarketDeal), ErrNotSupported
|
return *new(map[string]*api.MarketDeal), ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FullNodeStruct) StateMarketParticipants(p0 context.Context, p1 types.TipSetKey) (map[string]api.MarketBalance, error) {
|
func (s *FullNodeStruct) StateMarketParticipants(p0 context.Context, p1 types.TipSetKey) (map[string]api.MarketBalance, error) {
|
||||||
|
@ -2396,10 +2396,10 @@ func (mr *MockFullNodeMockRecorder) StateMarketBalance(arg0, arg1, arg2 interfac
|
|||||||
}
|
}
|
||||||
|
|
||||||
// StateMarketDeals mocks base method.
|
// StateMarketDeals mocks base method.
|
||||||
func (m *MockFullNode) StateMarketDeals(arg0 context.Context, arg1 types.TipSetKey) (map[string]api.MarketDeal, error) {
|
func (m *MockFullNode) StateMarketDeals(arg0 context.Context, arg1 types.TipSetKey) (map[string]*api.MarketDeal, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "StateMarketDeals", arg0, arg1)
|
ret := m.ctrl.Call(m, "StateMarketDeals", arg0, arg1)
|
||||||
ret0, _ := ret[0].(map[string]api.MarketDeal)
|
ret0, _ := ret[0].(map[string]*api.MarketDeal)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
@ -670,8 +670,8 @@ func (a *StateAPI) StateMarketParticipants(ctx context.Context, tsk types.TipSet
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateMarketDeals(ctx context.Context, tsk types.TipSetKey) (map[string]api.MarketDeal, error) {
|
func (a *StateAPI) StateMarketDeals(ctx context.Context, tsk types.TipSetKey) (map[string]*api.MarketDeal, error) {
|
||||||
out := map[string]api.MarketDeal{}
|
out := map[string]*api.MarketDeal{}
|
||||||
|
|
||||||
ts, err := a.Chain.GetTipSetFromKey(ctx, tsk)
|
ts, err := a.Chain.GetTipSetFromKey(ctx, tsk)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -700,7 +700,7 @@ func (a *StateAPI) StateMarketDeals(ctx context.Context, tsk types.TipSetKey) (m
|
|||||||
} else if !found {
|
} else if !found {
|
||||||
s = market.EmptyDealState()
|
s = market.EmptyDealState()
|
||||||
}
|
}
|
||||||
out[strconv.FormatInt(int64(dealID), 10)] = api.MarketDeal{
|
out[strconv.FormatInt(int64(dealID), 10)] = &api.MarketDeal{
|
||||||
Proposal: d,
|
Proposal: d,
|
||||||
State: *s,
|
State: *s,
|
||||||
}
|
}
|
||||||
|
@ -454,7 +454,7 @@ func (sm *StorageMinerAPI) MarketImportDealData(ctx context.Context, propCid cid
|
|||||||
return sm.StorageProvider.ImportDataForDeal(ctx, propCid, fi)
|
return sm.StorageProvider.ImportDataForDeal(ctx, propCid, fi)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sm *StorageMinerAPI) listDeals(ctx context.Context) ([]api.MarketDeal, error) {
|
func (sm *StorageMinerAPI) listDeals(ctx context.Context) ([]*api.MarketDeal, error) {
|
||||||
ts, err := sm.Full.ChainHead(ctx)
|
ts, err := sm.Full.ChainHead(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -465,7 +465,7 @@ func (sm *StorageMinerAPI) listDeals(ctx context.Context) ([]api.MarketDeal, err
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var out []api.MarketDeal
|
var out []*api.MarketDeal
|
||||||
|
|
||||||
for _, deal := range allDeals {
|
for _, deal := range allDeals {
|
||||||
if deal.Proposal.Provider == sm.Miner.Address() {
|
if deal.Proposal.Provider == sm.Miner.Address() {
|
||||||
@ -476,7 +476,7 @@ func (sm *StorageMinerAPI) listDeals(ctx context.Context) ([]api.MarketDeal, err
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sm *StorageMinerAPI) MarketListDeals(ctx context.Context) ([]api.MarketDeal, error) {
|
func (sm *StorageMinerAPI) MarketListDeals(ctx context.Context) ([]*api.MarketDeal, error) {
|
||||||
return sm.listDeals(ctx)
|
return sm.listDeals(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1072,7 +1072,7 @@ func (sm *StorageMinerAPI) DagstoreLookupPieces(ctx context.Context, cid cid.Cid
|
|||||||
return ret, nil
|
return ret, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sm *StorageMinerAPI) DealsList(ctx context.Context) ([]api.MarketDeal, error) {
|
func (sm *StorageMinerAPI) DealsList(ctx context.Context) ([]*api.MarketDeal, error) {
|
||||||
return sm.listDeals(ctx)
|
return sm.listDeals(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user