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

Add sharding package and update validators #583

Merged
merged 2 commits into from
Jan 6, 2022
Merged

Conversation

lkatalin
Copy link
Contributor

@lkatalin lkatalin commented Jan 5, 2022

Summary

Commit 1: Add sharding package. I moved this to pkg/ so it can be accessed by both the server and cli as needed, but if this is no the right place, I can move it.
Commit 2: Update UUID validators to accept both current 64-char UUID and longer 80-char FullID defined in sharding package.

Ticket Link

Related to #487
(More work to be done before the issue is closed)

Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

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

lgtm

UUID: uuid}, nil
}

func CreateEmptyFullID() FullID {
Copy link
Member

Choose a reason for hiding this comment

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

is this intent for this to be public or just a internal helper function?

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 catch, I'm still getting used to go's use of caps to mean public. I suppose for now it should be internal so I'll update it.

pkg/sharding/sharding.go Show resolved Hide resolved
Comment on lines 200 to 203
IDStringValidatorFunc := validateString("required,hexadecimal")
IDErr := IDStringValidatorFunc(v)

if IDErr != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
IDStringValidatorFunc := validateString("required,hexadecimal")
IDErr := IDStringValidatorFunc(v)
if IDErr != nil {
if err := validateString("required,hexadecimal")(v); err != nil {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice, thank you! I'm making this change.

Signed-off-by: Lily Sturmann <[email protected]>
A FullID is a UUID prepended by a TreeID. This will be used for log sharding

Signed-off-by: Lily Sturmann <[email protected]>
@lkatalin
Copy link
Contributor Author

lkatalin commented Jan 5, 2022

Thanks for the helpful comments, @bobcallaway . I've made some updates. Also I'm not sure what we should call the TreeID + UUID. I've been using FullID, but maybe there is something more descriptive?

Copy link
Member

@bobcallaway bobcallaway left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

@bobcallaway
Copy link
Member

Thanks for the helpful comments, @bobcallaway . I've made some updates. Also I'm not sure what we should call the TreeID + UUID. I've been using FullID, but maybe there is something more descriptive?

EntryID?

@dlorenc dlorenc merged commit a61d5f6 into sigstore:main Jan 6, 2022
@dlorenc
Copy link
Member

dlorenc commented Jan 6, 2022

Nice job!

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.

4 participants