Skip to content

lore-revision: Expose size and file mode in TreePath#19

Open
jblazquez wants to merge 2 commits into
EpicGames:mainfrom
jblazquez:treepath-size-and-mode
Open

lore-revision: Expose size and file mode in TreePath#19
jblazquez wants to merge 2 commits into
EpicGames:mainfrom
jblazquez:treepath-size-and-mode

Conversation

@jblazquez

Copy link
Copy Markdown

This allows a thin client to use ThinClientService.RevisionTree to efficiently retrieve additional information such as file size and mode.

If this change looks good, a future change could add similar information to RevisionDiffResponse.

Fixes #18

This allows a thin client to use ThinClientService.RevisionTree to efficiently retrieve additional information such as file size and mode.

Fixes EpicGames#18

Signed-off-by: Javier Blazquez <blaz@blazlabs.com>
/// 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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'm not sure if size for DIRECTORY entries being the sum of all descendant files is a guarantee that Lore fundamentally provides or whether it just happens to be like that in the current implementation. If it's not something Lore wants to commit to, we could explicitly set this to 0 for directories.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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?

@jblazquez jblazquez Jun 19, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The 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.

@ahaczewski ahaczewski Jun 20, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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.

@mjansson

Copy link
Copy Markdown
Collaborator

Looks good, my only concern is the reduction of the file mode to an executable bit boolean - this is the only mode we currently track, but we could potentially add more in the future.

@jblazquez

Copy link
Copy Markdown
Author

Looks good, my only concern is the reduction of the file mode to an executable bit boolean - this is the only mode we currently track, but we could potentially add more in the future.

Yes, I wasn't sure which way we'd like to go. I'll change the boolean to an integer field, and add an enum that represents the different mode flags.

This replaces the use of a boolean to indicate the executable flags on
files.

Signed-off-by: Javier Blazquez <blaz@blazlabs.com>
@jblazquez jblazquez force-pushed the treepath-size-and-mode branch from 788409f to f37a1e8 Compare June 22, 2026 19:32
// Original size in bytes. For DIRECTORY entries, this is the cumulative size of its descendant files.
uint64 size = 4;
// File mode for this entry. For possible flags and values, see enum FileMode.
uint64 mode = 5;

Copy link
Copy Markdown
Author

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 FileMode directly because it needs to be able to represent multiple mode flags, so it has to be an integer. Also making it uint64 despite mode internally being u16 for future-proofness and because Protobuf varint encoding takes care of making this small on the wire (0 bytes if mode = NONE and 1 byte if mode = EXECUTABLE).

@jblazquez

Copy link
Copy Markdown
Author

@mjansson Thanks for the review, I have updated the ThinClient service to use a new enum FileMode. Hopefully it looks good to merge now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

ThinClientService should expose more information about files in a revision

3 participants