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

feat: expose deal ID as replica ID #217

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -167,6 +167,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 @@ -16,9 +16,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 @@ -38,6 +36,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 @@ -536,6 +536,7 @@ func (s *Store) Describe(ctx context.Context, id blob.ID) (*blob.Descriptor, err
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
Loading