diff --git a/lore-proto/proto/lore/thin_client/v1/model.proto b/lore-proto/proto/lore/thin_client/v1/model.proto index 44812ae..ae28020 100644 --- a/lore-proto/proto/lore/thin_client/v1/model.proto +++ b/lore-proto/proto/lore/thin_client/v1/model.proto @@ -14,6 +14,14 @@ enum NodeType { LINK = 2; } +// File mode for a file-system entry. +enum FileMode { + // No special file mode. + NONE = 0; + // File is executable. + EXECUTABLE = 1; +} + // Per-path action describing what happened between two states (or relative // to the common ancestor in 3-way merges). enum Action { @@ -90,6 +98,10 @@ message TreeNode { NodeType node_type = 2; // Content address for FILE / LINK entries; unused for DIRECTORY. lore.model.v1.Address address = 3; + // 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; } // Self-describing revision record. Carries the resolved RevisionIdentifier diff --git a/lore-proto/src/grpc/lore.thin_client.v1.rs b/lore-proto/src/grpc/lore.thin_client.v1.rs index 157147b..98ee32e 100644 --- a/lore-proto/src/grpc/lore.thin_client.v1.rs +++ b/lore-proto/src/grpc/lore.thin_client.v1.rs @@ -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, + /// Original size in bytes. For DIRECTORY entries, this is the cumulative size of its descendant files. + #[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"; diff --git a/lore-proto/tests/v1_thin_client.rs b/lore-proto/tests/v1_thin_client.rs index 84ccbac..ad5cf5f 100644 --- a/lore-proto/tests/v1_thin_client.rs +++ b/lore-proto/tests/v1_thin_client.rs @@ -108,6 +108,8 @@ fn v1_thin_client_field_shapes() { path: _, node_type: _, address: _, + size: _, + mode: _, } = TreeNode::default(); // Revision + nested Parent + Metadata diff --git a/lore-revision/src/state.rs b/lore-revision/src/state.rs index 61f792d..b3401bd 100644 --- a/lore-revision/src/state.rs +++ b/lore-revision/src/state.rs @@ -3305,6 +3305,8 @@ pub struct TreePath { pub path: RelativePath, pub address: Option
, pub flags: NodeFlags, + pub size: u64, + pub mode: u64, } pub type CanReadRepository = Arc bool + Send + Sync>; @@ -3466,6 +3468,8 @@ async fn gather_tree_paths_node( path: node_path.clone(), address, flags, + size: node.size, + mode: node.mode as u64, }); let depth_remaining = max_depth == 0 || depth + 1 < max_depth; diff --git a/lore-server/src/grpc/thinclient/v1/revision_tree.rs b/lore-server/src/grpc/thinclient/v1/revision_tree.rs index d05f072..dadf610 100644 --- a/lore-server/src/grpc/thinclient/v1/revision_tree.rs +++ b/lore-server/src/grpc/thinclient/v1/revision_tree.rs @@ -155,6 +155,8 @@ async fn stream_tree( hash: address.hash.into(), context: address.context.into(), }), + size: tree_path.size, + mode: tree_path.mode, }; if tx .send(Ok(RevisionTreeResponse {