Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
feat: expose deal ID as replica ID
Browse files Browse the repository at this point in the history
Closes: #216
  • Loading branch information
rvagg committed Nov 7, 2023
1 parent 63ceec3 commit 401d368
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ curl http://localhost:40080/v0/blob/ad7ef987-a932-495c-aa0c-7ffcabeda45f/status
"id": "ad7ef987-a932-495c-aa0c-7ffcabeda45f",
"replicas": [
{
"id": 1,
"provider": "f1234",
"status": "active",
"lastVerified": "2020-12-01T22:48:00Z",
Expand Down
1 change: 1 addition & 0 deletions api/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type (
Pieces []Piece `json:"pieces"`
}
Piece struct {
Id int64 `json:"id"`
Expiration time.Time `json:"expiration"`
LastVerified time.Time `json:"lastVerified"`
PieceCID string `json:"pieceCid"`
Expand Down
1 change: 1 addition & 0 deletions api/server/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ func (m *HttpServer) handleBlobGetStatusByID(w http.ResponseWriter, r *http.Requ
apiPieces := make([]api.Piece, 0, len(replica.Pieces))
for _, piece := range replica.Pieces {
apiPieces = append(apiPieces, api.Piece{
Id: piece.Id,
Expiration: piece.Expiration,
LastVerified: piece.LastUpdated,
PieceCID: piece.PieceCID,
Expand Down
5 changes: 2 additions & 3 deletions blob/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ var (
ErrBlobNotFound = errors.New("no blob is found with given ID")
)

var (
logger = log.Logger("motion/blobstore")
)
var logger = log.Logger("motion/blobstore")

type (
// ID uniquely identifies a blob.
Expand All @@ -37,6 +35,7 @@ type (
Pieces []Piece
}
Piece struct {
Id int64
Expiration time.Time
LastUpdated time.Time
PieceCID string
Expand Down
1 change: 1 addition & 0 deletions integration/singularity/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ func (s *SingularityStore) Describe(ctx context.Context, id blob.ID) (*blob.Desc
updatedAt = time.Time{}
}
piece := blob.Piece{
Id: deal.ID,
Expiration: epochutil.EpochToTime(int32(deal.EndEpoch)),
LastUpdated: updatedAt,
PieceCID: deal.PieceCid,
Expand Down
6 changes: 5 additions & 1 deletion openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ paths:
items:
type: object
properties:
id:
type: integer
description: 'Unique, opaque identifier for the replica.'
expiration:
type: string
format: date-time
Expand All @@ -133,7 +136,8 @@ paths:
replica:
provider: 'f0xxxx'
pieces:
- expiration: '2023-06-29T00:00:00Z'
- id: 1
expiration: '2023-06-29T00:00:00Z'
lastVerified: '2023-05-29T00:00:00Z'
pieceCid: 'baguqexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
status: 'active'
Expand Down

0 comments on commit 401d368

Please sign in to comment.