diff options
Diffstat (limited to '')
| -rw-r--r-- | crates/turtle/proto/history.proto | 76 |
1 files changed, 41 insertions, 35 deletions
diff --git a/crates/turtle/proto/history.proto b/crates/turtle/proto/history.proto index 59c12471..c6bdd99b 100644 --- a/crates/turtle/proto/history.proto +++ b/crates/turtle/proto/history.proto @@ -1,29 +1,37 @@ syntax = "proto3"; package history; +service History { + rpc StartHistory(StartHistoryRequest) returns (StartHistoryReply); + rpc EndHistory(EndHistoryRequest) returns (EndHistoryReply); + + rpc TailHistory(TailHistoryRequest) returns (stream TailHistoryReply); + + // Request history from the daemon + rpc History(HistoryRequest) returns (HistoryReply); +} + message StartHistoryRequest { - // If people are still using my software in ~530 years, they can figure out a u128 migration - uint64 timestamp = 1; // nanosecond unix epoch + Timestamp timestamp = 1; string command = 2; string cwd = 3; string session = 4; string hostname = 5; string author = 6; - string intent = 7; + optional string intent = 7; } - -message EndHistoryRequest { - string id = 1; - int64 exit = 2; - uint64 duration = 3; -} - message StartHistoryReply { string id = 1; string version = 2; uint32 protocol = 3; } +message EndHistoryRequest { + string id = 1; + + int64 exit = 2; + Duration duration = 3; +} message EndHistoryReply { string id = 1; uint64 idx = 2; @@ -31,22 +39,12 @@ message EndHistoryReply { uint32 protocol = 4; } -message StatusRequest {} - -message StatusReply { - bool healthy = 1; - string version = 2; - uint32 pid = 3; - uint32 protocol = 4; -} - -message ShutdownRequest {} - -message ShutdownReply { - bool accepted = 1; -} message TailHistoryRequest {} +message TailHistoryReply { + HistoryEventKind kind = 1; + HistoryEntry history = 2; +} enum HistoryEventKind { HISTORY_EVENT_KIND_UNSPECIFIED = 0; @@ -55,7 +53,7 @@ enum HistoryEventKind { } message HistoryEntry { - uint64 timestamp = 1; // nanosecond unix epoch + Timestamp timestamp = 1; string id = 2; string command = 3; string cwd = 4; @@ -64,18 +62,26 @@ message HistoryEntry { string author = 7; string intent = 8; int64 exit = 9; - int64 duration = 10; + Duration duration = 10; } -message TailHistoryReply { - HistoryEventKind kind = 1; - HistoryEntry history = 2; +message Range { + Timestamp start = 1; + Timestamp end = 2; } -service History { - rpc StartHistory(StartHistoryRequest) returns (StartHistoryReply); - rpc EndHistory(EndHistoryRequest) returns (EndHistoryReply); - rpc TailHistory(TailHistoryRequest) returns (stream TailHistoryReply); - rpc Status(StatusRequest) returns (StatusReply); - rpc Shutdown(ShutdownRequest) returns (ShutdownReply); +message Timestamp { + // Encoded as nanoseconds since the UNIX epoch. + uint64 value = 1; +} +message Duration { + // Encoded as nanoseconds. + uint64 value = 1; +} + +message HistoryRequest { + Range range = 2; +} +message HistoryReply { + repeated HistoryEntry entries = 1; } |
