-
Notifications
You must be signed in to change notification settings - Fork 169
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
base: master
Are you sure you want to change the base?
Conversation
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"` | ||
} |
There was a problem hiding this comment.
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
return &dynamodb.CreateTableInput{ | ||
AttributeDefinitions: []types.AttributeDefinition{ | ||
{ | ||
AttributeName: aws.String("PK"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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
?
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"` | ||
} |
There was a problem hiding this comment.
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.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call
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) | ||
} |
There was a problem hiding this comment.
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"), |
There was a problem hiding this comment.
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.
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"` | ||
} |
There was a problem hiding this comment.
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?
Why are these changes needed?
Set up v2 blob metadata store. Only implements few basic methods for now.
Checks