Files
gitks/proto/git/tree.proto
T
2026-06-07 11:30:56 +08:00

131 lines
2.6 KiB
Protocol Buffer

syntax = "proto3";
package gitks;
import "oid.proto";
import "repository.proto";
message RecentCommit {
Oid oid = 1;
string subject = 2;
int64 committed_timestamp = 3;
}
message TreeEntry {
enum EntryType {
TREE_ENTRY_TYPE_UNSPECIFIED = 0;
TREE_ENTRY_TYPE_TREE = 1;
TREE_ENTRY_TYPE_BLOB = 2;
TREE_ENTRY_TYPE_COMMIT = 3;
TREE_ENTRY_TYPE_SYMLINK = 4;
TREE_ENTRY_TYPE_EXECUTABLE = 5;
}
string name = 1;
string path = 2;
Oid oid = 3;
EntryType type = 4;
uint32 mode = 5;
int64 size = 6;
bool is_lfs = 7;
RecentCommit recent_commit = 8;
}
message Tree {
Oid oid = 1;
string path = 2;
repeated TreeEntry entries = 3;
bool truncated = 4;
}
message Blob {
Oid oid = 1;
string path = 2;
uint32 mode = 3;
int64 size = 4;
bytes data = 5;
string encoding = 6;
bool binary = 7;
bool truncated = 8;
bool is_lfs = 9;
RecentCommit recent_commit = 10;
}
message FileMetadata {
string path = 1;
Oid oid = 2;
uint32 mode = 3;
int64 size = 4;
ObjectType type = 5;
bool binary = 6;
bool is_lfs = 7;
RecentCommit recent_commit = 8;
}
message ListTreeRequest {
RepositoryHeader repository = 1;
ObjectSelector revision = 2;
string path = 3;
bool recursive = 4;
Pagination pagination = 5;
}
message ListTreeResponse {
repeated TreeEntry entries = 1;
PageInfo page_info = 2;
bool truncated = 3;
}
message GetTreeRequest {
RepositoryHeader repository = 1;
ObjectSelector revision = 2;
string path = 3;
}
message GetBlobRequest {
RepositoryHeader repository = 1;
ObjectSelector revision = 2;
string path = 3;
Oid oid = 4;
uint64 max_bytes = 5;
}
message GetRawBlobRequest {
RepositoryHeader repository = 1;
ObjectSelector revision = 2;
string path = 3;
Oid oid = 4;
}
message GetRawBlobResponse {
bytes data = 1;
}
message GetFileMetadataRequest {
RepositoryHeader repository = 1;
ObjectSelector revision = 2;
string path = 3;
}
message FindFilesRequest {
RepositoryHeader repository = 1;
ObjectSelector revision = 2;
string pattern = 3;
repeated string pathspec = 4;
Pagination pagination = 5;
}
message FindFilesResponse {
repeated FileMetadata files = 1;
PageInfo page_info = 2;
}
service TreeService {
rpc ListTree(ListTreeRequest) returns (ListTreeResponse);
rpc GetTree(GetTreeRequest) returns (Tree);
rpc GetBlob(GetBlobRequest) returns (Blob);
rpc GetRawBlob(GetRawBlobRequest) returns (stream GetRawBlobResponse);
rpc GetFileMetadata(GetFileMetadataRequest) returns (FileMetadata);
rpc FindFiles(FindFilesRequest) returns (FindFilesResponse);
}