Skip to content

Commit

Permalink
refactor(metadata): rename shortcut field
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahhoward committed Sep 27, 2024
1 parent 9bd7d10 commit e2a3886
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions pkg/metadata/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ type ContentClaimMetadata struct {
// kind of claim
ClaimType ClaimType
// based on the claim type, this can be used to access the key information in the claim without fetching the whole claim
ShortCut []byte
EmbeddedData []byte
// ClaimCID indicates the cid of the claim - the claim should be fetchable by combining the http multiaddr of the provider with the claim cid
ClaimCID cid.Cid
}
Expand Down Expand Up @@ -137,7 +137,7 @@ func (ccm *ContentClaimMetadata) ReadFrom(r io.Reader) (n int64, err error) {
nd := nb.Build()
read := bindnode.Unwrap(nd).(*ContentClaimMetadata)
ccm.ClaimType = read.ClaimType
ccm.ShortCut = read.ShortCut
ccm.EmbeddedData = read.EmbeddedData
ccm.ClaimCID = read.ClaimCID
return cr.readCount, nil
}
Expand Down Expand Up @@ -170,23 +170,23 @@ func (EqualsClaimPreview) isClaimPreview() {}
func (ccm *ContentClaimMetadata) ClaimPreview() (ClaimPreview, error) {
switch ccm.ClaimType {
case LocationCommitment:
location, err := url.ParseRequestURI(string(ccm.ShortCut))
location, err := url.ParseRequestURI(string(ccm.EmbeddedData))
if err != nil {
return nil, err
}
return LocationCommitmentPreview{
Location: *location,
}, nil
case IndexClaim:
_, index, err := cid.CidFromBytes(ccm.ShortCut)
_, index, err := cid.CidFromBytes(ccm.EmbeddedData)
if err != nil {
return nil, err
}
return IndexClaimPreview{
Index: index,
}, nil
case EqualsClaim:
_, equals, err := cid.CidFromBytes(ccm.ShortCut)
_, equals, err := cid.CidFromBytes(ccm.EmbeddedData)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/metadata/metadata.ipldsch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type ContentClaimMetadata struct {
ClaimType Int
ShortCut Bytes
EmbeddedData Bytes
Claim Link
}
} representation tuple
6 changes: 3 additions & 3 deletions pkg/redis/ipnistore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ func randomProviderResults(num int) (multihash.Multihash, []model.ProviderResult
return nil, nil, err
}
metadata, err := (&metadata.ContentClaimMetadata{
ClaimType: metadata.LocationCommitment,
ShortCut: testutil.RandomBytes(30),
ClaimCID: testutil.RandomCID().(cidlink.Link).Cid,
ClaimType: metadata.LocationCommitment,
EmbeddedData: testutil.RandomBytes(30),
ClaimCID: testutil.RandomCID().(cidlink.Link).Cid,
}).MarshalBinary()
if err != nil {
return nil, nil, err
Expand Down

0 comments on commit e2a3886

Please sign in to comment.