Skip to content

Commit

Permalink
Support for .proto files with clang-format (#4198)
Browse files Browse the repository at this point in the history
  • Loading branch information
jumaffre authored Sep 7, 2022
1 parent bf7ad90 commit ccda2a6
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 43 deletions.
5 changes: 5 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,9 @@ StatementMacros:
TabWidth: 2
UseCRLF: false
UseTab: Never
---
Language: Proto
IndentWidth: 2
UseTab: Never
BreakBeforeBraces: Stroustrup
...
2 changes: 1 addition & 1 deletion scripts/check-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fi
file_name_regex="^[[:lower:]0-9_]+$"
unformatted_files=""
badly_named_files=""
for file in $(git ls-files "$@" | grep -e '\.h$' -e '\.hpp$' -e '\.cpp$' -e '\.c$'); do
for file in $(git ls-files "$@" | grep -e '\.h$' -e '\.hpp$' -e '\.cpp$' -e '\.c$' -e '\.proto$'); do
if ! clang-format-10 -n -Werror -style=file "$file"; then
if $fix ; then
clang-format-10 -style=file -i "$file"
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci-checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ else
fi

echo "$CHECK_DELIMITER"
echo "-- C/C++ format"
echo "-- C/C++/Proto format"
if [ $FIX -ne 0 ]; then
"$SCRIPT_DIR"/check-format.sh -f include src samples
else
Expand Down
16 changes: 0 additions & 16 deletions src/apps/external_executor/echo.proto

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ service ExecutorRegistration
// the given client cert.
// Returns indication of whether the registration succeeded, and error
// details where appropriate.
rpc RegisterExecutor (NewExecutor) returns (RegistrationResult) {}
rpc RegisterExecutor(NewExecutor) returns (RegistrationResult) {}
}

message Attestation
Expand Down
36 changes: 12 additions & 24 deletions src/apps/external_executor/protobuf/kv.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,28 @@ service KV
{
// Indicate to node that this executor is ready for a new request.
// Returns description of a client request, to be executed.
rpc StartTx (google.protobuf.Empty) returns (stream RequestDescription) {}
rpc StartTx(google.protobuf.Empty) returns (stream RequestDescription) {}

// Indicate that this executor has completed execution of the previous Tx.
// Contains description of response which should be forwarded to user.
rpc EndTx (ResponseDescription) returns (google.protobuf.Empty) {}
rpc EndTx(ResponseDescription) returns (google.protobuf.Empty) {}

// Read a single key
rpc Get (KVKey) returns (KVValue) {}
rpc Get(KVKey) returns (KVValue) {}

// Test a single key
rpc Has (KVKey) returns (KVHasResult) {}
rpc Has(KVKey) returns (KVHasResult) {}

// Read version of a single key
rpc GetVersion (KVKey) returns (KVVersion) {}
rpc GetVersion(KVKey) returns (KVVersion) {}

// Write a single key-value pair
rpc Put (KVKeyValue) returns (google.protobuf.Empty) {}
rpc Put(KVKeyValue) returns (google.protobuf.Empty) {}

// Remove a single key-value pair
rpc Delete (KVKey) returns (google.protobuf.Empty) {}
rpc Delete(KVKey) returns (google.protobuf.Empty) {}

rpc GetAll (KVTable) returns (stream KVKeyValue) {}
rpc GetAll(KVTable) returns (stream KVKeyValue) {}
}

message Header
Expand All @@ -51,10 +51,7 @@ message RequestDescription
bytes body = 4;
}

message KVTable
{
string table = 1;
}
message KVTable { string table = 1; }

message KVKey
{
Expand All @@ -69,20 +66,11 @@ message KVKeyValue
bytes value = 3;
}

message KVValue
{
bytes value = 1;
}
message KVValue { bytes value = 1; }

message KVHasResult
{
bool present = 1;
}
message KVHasResult { bool present = 1; }

message KVVersion
{
uint64 version = 1;
}
message KVVersion { uint64 version = 1; }

message ResponseDescription
{
Expand Down

0 comments on commit ccda2a6

Please sign in to comment.