Skip to content

Commit af674e9

Browse files
committed
feat: Add RPC method to fetch DDO deal
1 parent a370034 commit af674e9

File tree

7 files changed

+68
-0
lines changed

7 files changed

+68
-0
lines changed

Diff for: api/api.go

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ type Boost interface {
3939
BoostIndexerAnnounceDeal(ctx context.Context, deal *smtypes.ProviderDealState) (cid.Cid, error) //perm:admin
4040
BoostIndexerAnnounceLegacyDeal(ctx context.Context, proposalCid cid.Cid) (cid.Cid, error) //perm:admin
4141
BoostDirectDeal(ctx context.Context, params smtypes.DirectDealParams) (*ProviderDealRejectionInfo, error) //perm:admin
42+
BoostGetDirectDeal(ctx context.Context, dealID uuid.UUID) (*smtypes.DirectDeal, error) //perm:admin
4243
MarketGetAsk(ctx context.Context) (*legacytypes.SignedStorageAsk, error) //perm:read
4344

4445
// MethodGroup: Blockstore

Diff for: api/proxy_gen.go

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: build/openrpc/boost.json.gz

145 Bytes
Binary file not shown.

Diff for: documentation/en/api-v1-methods.md

+40
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* [BoostDealBySignedProposalCid](#boostdealbysignedproposalcid)
1414
* [BoostDirectDeal](#boostdirectdeal)
1515
* [BoostDummyDeal](#boostdummydeal)
16+
* [BoostGetDirectDeal](#boostgetdirectdeal)
1617
* [BoostIndexerAnnounceAllDeals](#boostindexerannouncealldeals)
1718
* [BoostIndexerAnnounceDeal](#boostindexerannouncedeal)
1819
* [BoostIndexerAnnounceDealRemoved](#boostindexerannouncedealremoved)
@@ -373,6 +374,45 @@ Response:
373374
}
374375
```
375376

377+
### BoostGetDirectDeal
378+
379+
380+
Perms: admin
381+
382+
Inputs:
383+
```json
384+
[
385+
"07070707-0707-0707-0707-070707070707"
386+
]
387+
```
388+
389+
Response:
390+
```json
391+
{
392+
"ID": "07070707-0707-0707-0707-070707070707",
393+
"CreatedAt": "0001-01-01T00:00:00Z",
394+
"PieceCID": null,
395+
"PieceSize": 1032,
396+
"Client": "f01234",
397+
"Provider": "f01234",
398+
"AllocationID": 0,
399+
"CleanupData": true,
400+
"InboundFilePath": "string value",
401+
"InboundFileSize": 9,
402+
"SectorID": 9,
403+
"Offset": 1032,
404+
"Length": 1032,
405+
"Checkpoint": 1,
406+
"CheckpointAt": "0001-01-01T00:00:00Z",
407+
"StartEpoch": 10101,
408+
"EndEpoch": 10101,
409+
"Err": "string value",
410+
"Retry": "auto",
411+
"KeepUnsealedCopy": true,
412+
"AnnounceToIPNI": true
413+
}
414+
```
415+
376416
### BoostIndexerAnnounceAllDeals
377417
There are not yet any comments for this method.
378418

Diff for: go.work.sum

+1
Original file line numberDiff line numberDiff line change
@@ -2732,6 +2732,7 @@ github.com/whyrusleeping/cbor-gen v0.0.0-20230126041949-52956bd4c9aa/go.mod h1:f
27322732
github.com/whyrusleeping/cbor-gen v0.0.0-20230418232409-daab9ece03a0/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
27332733
github.com/whyrusleeping/cbor-gen v0.0.0-20230818171029-f91ae536ca25/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
27342734
github.com/whyrusleeping/cbor-gen v0.0.0-20240109153615-66e95c3e8a87/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
2735+
github.com/whyrusleeping/cbor-gen v0.1.0/go.mod h1:pM99HXyEbSQHcosHc0iW7YFmwnscr+t9Te4ibko05so=
27352736
github.com/whyrusleeping/go-ctrlnet v0.0.0-20180313164037-f564fbbdaa95 h1:c23eYhe7i8MG6dUSPzyIDDy5+cWOoZMovPamBKqrjYQ=
27362737
github.com/whyrusleeping/go-logging v0.0.1 h1:fwpzlmT0kRC/Fmd0MdmGgJG/CXIZ6gFq46FQZjprUcc=
27372738
github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f h1:M/lL30eFZTKnomXY6huvM6G0+gVquFNf6mxghaWlFUg=

Diff for: node/impl/boost.go

+4
Original file line numberDiff line numberDiff line change
@@ -231,3 +231,7 @@ func (sm *BoostAPI) PdCleanup(ctx context.Context) error {
231231
func (sm *BoostAPI) MarketGetAsk(ctx context.Context) (*legacytypes.SignedStorageAsk, error) {
232232
return sm.StorageProvider.GetAsk(), nil
233233
}
234+
235+
func (sm *BoostAPI) BoostGetDirectDeal(ctx context.Context, dealID uuid.UUID) (*types.DirectDeal, error) {
236+
return sm.DirectDealsProvider.GetDeal(ctx, dealID)
237+
}

Diff for: storagemarket/direct_deals_provider.go

+9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package storagemarket
22

33
import (
44
"context"
5+
"database/sql"
56
"errors"
67
"fmt"
78
"os"
@@ -780,3 +781,11 @@ func (ddp *DirectDealsProvider) trackCurioSealing(sectorNum abi.SectorNumber) *d
780781
}
781782
}
782783
}
784+
785+
func (ddp *DirectDealsProvider) GetDeal(ctx context.Context, dealUuid uuid.UUID) (*types.DirectDeal, error) {
786+
deal, err := ddp.directDealsDB.ByID(ctx, dealUuid)
787+
if errors.Is(err, sql.ErrNoRows) {
788+
return nil, fmt.Errorf("getting direct deal %s: %w", dealUuid, ErrDealNotFound)
789+
}
790+
return deal, nil
791+
}

0 commit comments

Comments
 (0)