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 a Git-backed storage.ReadBucket
via storagegit
#2114
Conversation
private/pkg/git/git.go
Outdated
// Traverse walks down a tree, following the name-path specified, | ||
// and returns the terminal TreeEntry. If no entry is found, it returns | ||
// ErrSubTreeNotFound. | ||
Traverse(objectReader ObjectReader, names ...string) (TreeEntry, 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.
Why not Walk
?
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.
I could go either way, but I felt that Walk
was overloaded with storage's walk (i.e, it's not walking all paths in a subtree, it's navigating to a particular descendant). Maybe Descendant
is better?
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.
Looking very nice, left mainly nits
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.
A bunch of rename suggestions and other nits. Nice work!
private/pkg/git/git.go
Outdated
// ModeFile is a blob that should be written as a plain file. | ||
ModeFile FileMode = 010_0644 | ||
// ModeExec is a blob that should be written with the executable bit set. | ||
ModeExe FileMode = 010_0755 | ||
// ModeDir is a tree to be unpacked as a subdirectory in the current | ||
// directory. | ||
ModeDir FileMode = 004_0000 | ||
// ModeSymlink is a blob with its content being the path linked to. | ||
ModeSymlink FileMode = 012_0000 | ||
// ModeSubmodule is a commit that the submodule is checked out at. | ||
ModeSubmodule FileMode = 016_0000 |
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.
Do we need the left padded zeroes in all of them? I think at least one zero can be removed in all of them?
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.
Yes, these are octal literals :)
func (b *bucket) walk( | ||
parent git.Tree, | ||
objectReader git.ObjectReader, | ||
prefix string, |
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.
I guess that partial prefixes won't work then, so for a valid dir foo/bar/baz/*
, the prefix foo/b
won't walk anything. Unsure how other buckets handle this.
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.
That's correct, that's be design for buckets. The prefix is a segment prefix, but a path key prefix.
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.
Looks generally good to me! One comment, then defer to @unmultimedio for the rest.
No description provided.