-
Notifications
You must be signed in to change notification settings - Fork 234
lore-revision: Expose size and file mode in TreePath #19
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,6 +75,12 @@ pub struct TreeNode { | |
| /// Content address for FILE / LINK entries; unused for DIRECTORY. | ||
| #[prost(message, optional, tag = "3")] | ||
| pub address: ::core::option::Option<crate::lore::model::v1::Address>, | ||
| /// Original size in bytes. For DIRECTORY entries, this is the cumulative size of its descendant files. | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is definitely something Lore provides - with the caveat that it is the full unfiltered size of all child nodes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it would be possible to math-it-out, like, subtract the sizes of child directory nodes, to get the size of files in the directory?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the current behavior is actually better. Imagine a UI that shows the contents of the repo as a tree view. At each level, it could show a size next to a directory that describes the total size of everything under that directory, recursively, so you can at a glance see where the largest parts of the repo are. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well I think that it can do both: show the size of files in the directory and the tree beneath. Just make two fields, makes the API reacher
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lore usually avoids duplicating info that can be gathered or calculated reasonably easy on the receiving side. Data over the wire should be the minimal unique set of data. |
||
| #[prost(uint64, tag = "4")] | ||
| pub size: u64, | ||
| /// File mode for this entry. For possible flags and values, see enum FileMode. | ||
| #[prost(uint64, tag = "5")] | ||
| pub mode: u64, | ||
| } | ||
| impl ::prost::Name for TreeNode { | ||
| const NAME: &'static str = "TreeNode"; | ||
|
|
||
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.
Not making this of type
FileModedirectly because it needs to be able to represent multiple mode flags, so it has to be an integer. Also making ituint64despite mode internally beingu16for future-proofness and because Protobuf varint encoding takes care of making this small on the wire (0 bytes ifmode = NONEand 1 byte ifmode = EXECUTABLE).