Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2] Blob Metadata Store #818

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ian-shim
Copy link
Contributor

Why are these changes needed?

Set up v2 blob metadata store. Only implements few basic methods for now.

Checks

  • I've made sure the lint is passing in this PR.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, in that case, please comment that they are not relevant.
  • I've checked the new test coverage and the coverage percentage didn't drop.
  • Testing Strategy
    • Unit tests
    • Integration tests
    • This PR is not tested :(

Comment on lines +522 to +544
type BlobVersion uint32

type BlobKey [32]byte

func (b BlobKey) Hex() string {
return hex.EncodeToString(b[:])
}

func HexToBlobKey(h string) (BlobKey, error) {
b, err := hex.DecodeString(h)
if err != nil {
return BlobKey{}, err
}
return BlobKey(b), nil
}

type BlobHeaderV2 struct {
BlobVersion BlobVersion `json:"version"`
QuorumIDs []QuorumID `json:"quorum_ids"`
BlobCommitment encoding.BlobCommitments `json:"commitments"`

PaymentMetadata `json:"payment_metadata"`
}
Copy link
Contributor Author

@ian-shim ian-shim Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Placeholder for now. These will be replaced by v2 core types in #806

@ian-shim ian-shim marked this pull request as ready for review October 18, 2024 06:13
return &dynamodb.CreateTableInput{
AttributeDefinitions: []types.AttributeDefinition{
{
AttributeName: aws.String("PK"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you document the tables that are abbreviations? It's not obvious to me what PK and SK stand for.


blobKeyPrefix = "BlobKey#"
dispersalIDPrefix = "DispersalID#"
blobMetadataSK = "BlobMetadata"
Copy link
Collaborator

@pschork pschork Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we're not using immutable design where blob metadata updates create a new unique sortable item via compound SK like BlobMetadata#UUID7 or BlobMetadata#EpochSeconds?

Comment on lines +14 to +24
type BlobMetadata struct {
core.BlobHeaderV2 `json:"blob_header"`

BlobKey core.BlobKey `json:"blob_key"`
BlobStatus BlobStatus `json:"blob_status"`
// Expiry is Unix timestamp of the blob expiry in seconds from epoch
Expiry uint64 `json:"expiry"`
NumRetries uint `json:"num_retries"`
BlobSize uint64 `json:"blob_size"`
RequestedAt uint64 `json:"requested_at"`
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a high level struct that will get reused in a bunch of places, would it be worth while to add godocs? (This request is non-blocking, feel free to disregard it if you don't think they are worthwile.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call

Comment on lines +10 to +15
type BlobMetadataStore interface {
PutBlobMetadata(ctx context.Context, metadata *v2.BlobMetadata) error
GetBlobMetadata(ctx context.Context, blobKey core.BlobKey) (*v2.BlobMetadata, error)
GetBlobMetadataByStatus(ctx context.Context, status v2.BlobStatus) ([]*v2.BlobMetadata, error)
GetBlobMetadataCountByStatus(ctx context.Context, status v2.BlobStatus) (int32, error)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add godocs if you think it's worth it. (This request is non-blocking, feel free to disregard it if you don't think they are worthwile.)

return &dynamodb.CreateTableInput{
AttributeDefinitions: []types.AttributeDefinition{
{
AttributeName: aws.String("PK"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you document the tables that are abbreviations? It's not obvious to me what PK and SK stand for.

Comment on lines +14 to +24
type BlobMetadata struct {
core.BlobHeaderV2 `json:"blob_header"`

BlobKey core.BlobKey `json:"blob_key"`
BlobStatus BlobStatus `json:"blob_status"`
// Expiry is Unix timestamp of the blob expiry in seconds from epoch
Expiry uint64 `json:"expiry"`
NumRetries uint `json:"num_retries"`
BlobSize uint64 `json:"blob_size"`
RequestedAt uint64 `json:"requested_at"`
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this eventually contain information such as blob header and/or blob cert?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants