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:
Aayush Rajasekaran 2022-04-23 11:55:22 -04:00 committed by GitHub
commit 52d5d57460
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 35 additions and 35 deletions

View File

@ -517,7 +517,7 @@ type FullNode interface {
// 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
// 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(context.Context, abi.DealID, types.TipSetKey) (*MarketDeal, error) //perm:read
// StateLookupID retrieves the ID address of the given address

View File

@ -162,7 +162,7 @@ type StorageMiner interface {
StorageStat(ctx context.Context, id storiface.ID) (fsutil.FsStat, error) //perm:admin
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
MarketGetDealUpdates(ctx context.Context) (<-chan 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
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
DealsSetConsiderOnlineStorageDeals(context.Context, bool) error //perm:admin
DealsConsiderOnlineRetrievalDeals(context.Context) (bool, error) //perm:admin

View File

@ -2512,10 +2512,10 @@ func (mr *MockFullNodeMockRecorder) StateMarketBalance(arg0, arg1, arg2 interfac
}
// 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()
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)
return ret0, ret1
}

View File

@ -366,7 +366,7 @@ type FullNodeStruct struct {
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"`
@ -671,7 +671,7 @@ type StorageMinerStruct struct {
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"`
@ -709,7 +709,7 @@ type StorageMinerStruct struct {
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"`
@ -2539,15 +2539,15 @@ func (s *FullNodeStub) StateMarketBalance(p0 context.Context, p1 address.Address
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 {
return *new(map[string]MarketDeal), ErrNotSupported
return *new(map[string]*MarketDeal), ErrNotSupported
}
return s.Internal.StateMarketDeals(p0, p1)
}
func (s *FullNodeStub) StateMarketDeals(p0 context.Context, p1 types.TipSetKey) (map[string]MarketDeal, error) {
return *new(map[string]MarketDeal), ErrNotSupported
func (s *FullNodeStub) StateMarketDeals(p0 context.Context, p1 types.TipSetKey) (map[string]*MarketDeal, error) {
return *new(map[string]*MarketDeal), ErrNotSupported
}
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
}
func (s *StorageMinerStruct) DealsList(p0 context.Context) ([]MarketDeal, error) {
func (s *StorageMinerStruct) DealsList(p0 context.Context) ([]*MarketDeal, error) {
if s.Internal.DealsList == nil {
return *new([]MarketDeal), ErrNotSupported
return *new([]*MarketDeal), ErrNotSupported
}
return s.Internal.DealsList(p0)
}
func (s *StorageMinerStub) DealsList(p0 context.Context) ([]MarketDeal, error) {
return *new([]MarketDeal), ErrNotSupported
func (s *StorageMinerStub) DealsList(p0 context.Context) ([]*MarketDeal, error) {
return *new([]*MarketDeal), ErrNotSupported
}
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
}
func (s *StorageMinerStruct) MarketListDeals(p0 context.Context) ([]MarketDeal, error) {
func (s *StorageMinerStruct) MarketListDeals(p0 context.Context) ([]*MarketDeal, error) {
if s.Internal.MarketListDeals == nil {
return *new([]MarketDeal), ErrNotSupported
return *new([]*MarketDeal), ErrNotSupported
}
return s.Internal.MarketListDeals(p0)
}
func (s *StorageMinerStub) MarketListDeals(p0 context.Context) ([]MarketDeal, error) {
return *new([]MarketDeal), ErrNotSupported
func (s *StorageMinerStub) MarketListDeals(p0 context.Context) ([]*MarketDeal, error) {
return *new([]*MarketDeal), ErrNotSupported
}
func (s *StorageMinerStruct) MarketListIncompleteDeals(p0 context.Context) ([]storagemarket.MinerDeal, error) {

View File

@ -521,7 +521,7 @@ type FullNode interface {
// 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
// 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(context.Context, abi.DealID, types.TipSetKey) (*api.MarketDeal, error) //perm:read
// StateLookupID retrieves the ID address of the given address

View File

@ -283,7 +283,7 @@ type FullNodeStruct struct {
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"`
@ -1834,15 +1834,15 @@ func (s *FullNodeStub) StateMarketBalance(p0 context.Context, p1 address.Address
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 {
return *new(map[string]api.MarketDeal), ErrNotSupported
return *new(map[string]*api.MarketDeal), ErrNotSupported
}
return s.Internal.StateMarketDeals(p0, p1)
}
func (s *FullNodeStub) StateMarketDeals(p0 context.Context, p1 types.TipSetKey) (map[string]api.MarketDeal, error) {
return *new(map[string]api.MarketDeal), ErrNotSupported
func (s *FullNodeStub) StateMarketDeals(p0 context.Context, p1 types.TipSetKey) (map[string]*api.MarketDeal, error) {
return *new(map[string]*api.MarketDeal), ErrNotSupported
}
func (s *FullNodeStruct) StateMarketParticipants(p0 context.Context, p1 types.TipSetKey) (map[string]api.MarketBalance, error) {

View File

@ -2396,10 +2396,10 @@ func (mr *MockFullNodeMockRecorder) StateMarketBalance(arg0, arg1, arg2 interfac
}
// 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()
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)
return ret0, ret1
}

View File

@ -670,8 +670,8 @@ func (a *StateAPI) StateMarketParticipants(ctx context.Context, tsk types.TipSet
return out, nil
}
func (a *StateAPI) StateMarketDeals(ctx context.Context, tsk types.TipSetKey) (map[string]api.MarketDeal, error) {
out := map[string]api.MarketDeal{}
func (a *StateAPI) StateMarketDeals(ctx context.Context, tsk types.TipSetKey) (map[string]*api.MarketDeal, error) {
out := map[string]*api.MarketDeal{}
ts, err := a.Chain.GetTipSetFromKey(ctx, tsk)
if err != nil {
@ -700,7 +700,7 @@ func (a *StateAPI) StateMarketDeals(ctx context.Context, tsk types.TipSetKey) (m
} else if !found {
s = market.EmptyDealState()
}
out[strconv.FormatInt(int64(dealID), 10)] = api.MarketDeal{
out[strconv.FormatInt(int64(dealID), 10)] = &api.MarketDeal{
Proposal: d,
State: *s,
}

View File

@ -454,7 +454,7 @@ func (sm *StorageMinerAPI) MarketImportDealData(ctx context.Context, propCid cid
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)
if err != nil {
return nil, err
@ -465,7 +465,7 @@ func (sm *StorageMinerAPI) listDeals(ctx context.Context) ([]api.MarketDeal, err
return nil, err
}
var out []api.MarketDeal
var out []*api.MarketDeal
for _, deal := range allDeals {
if deal.Proposal.Provider == sm.Miner.Address() {
@ -476,7 +476,7 @@ func (sm *StorageMinerAPI) listDeals(ctx context.Context) ([]api.MarketDeal, err
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)
}
@ -1072,7 +1072,7 @@ func (sm *StorageMinerAPI) DagstoreLookupPieces(ctx context.Context, cid cid.Cid
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)
}