From bbb9889001d1654f471e0abc8ad6ef4671eb1a1d Mon Sep 17 00:00:00 2001 From: MuZhou233 Date: Tue, 6 Aug 2024 01:37:58 +0100 Subject: [PATCH] feat: update porter & porter context --- proto/librarian/porter/v1/porter.proto | 26 +++++++---- proto/librarian/sephirah/v1/tiphereth.proto | 50 ++++++++++++++++----- 2 files changed, 56 insertions(+), 20 deletions(-) diff --git a/proto/librarian/porter/v1/porter.proto b/proto/librarian/porter/v1/porter.proto index 7fbf986..4d8f57f 100644 --- a/proto/librarian/porter/v1/porter.proto +++ b/proto/librarian/porter/v1/porter.proto @@ -92,10 +92,20 @@ message EnablePorterRequest { optional string refresh_token = 2; } message EnablePorterResponse { - // Used to request sephirah to sync data. - // To handle request, sephirah should send all `Enable*` requests to porter. - // Useful when porter is restarted. - bool need_full_sync = 1; + // Human-readable status message. + string status_message = 1; + // If true, enabler should resend request with `refresh_token`. + bool need_refresh_token = 2; + PorterEnablesSummary enables_summary = 3; +} + +message PorterEnablesSummary { + // `EnableContextRequest.context_id` + repeated librarian.v1.InternalID context_ids = 1; + // `EnableFeedSetterRequest.setter_id` + repeated librarian.v1.InternalID feed_setter_ids = 2; + // `EnableFeedGetterRequest.getter_id` + repeated librarian.v1.InternalID feed_getter_ids = 3; } message EnableContextRequest { @@ -173,7 +183,7 @@ message ExecFeedItemActionResponse { } message EnableFeedSetterRequest { - librarian.v1.InternalID id = 1; + librarian.v1.InternalID setter_id = 1; // `PorterFeatureSummary.feed_setters` librarian.v1.FeatureRequest setter = 2; librarian.v1.InternalID feed_id = 3; @@ -182,13 +192,13 @@ message EnableFeedSetterRequest { message EnableFeedSetterResponse {} message DisableFeedSetterRequest { - librarian.v1.InternalID id = 1; + librarian.v1.InternalID setter_id = 1; } message DisableFeedSetterResponse {} message EnableFeedGetterRequest { - librarian.v1.InternalID id = 1; + librarian.v1.InternalID getter_id = 1; // `PorterFeatureSummary.feed_getters` librarian.v1.FeatureRequest getter = 2; librarian.v1.InternalID feed_id = 3; @@ -197,7 +207,7 @@ message EnableFeedGetterRequest { message EnableFeedGetterResponse {} message DisableFeedGetterRequest { - librarian.v1.InternalID id = 1; + librarian.v1.InternalID getter_id = 1; } message DisableFeedGetterResponse {} diff --git a/proto/librarian/sephirah/v1/tiphereth.proto b/proto/librarian/sephirah/v1/tiphereth.proto index 5375541..f032935 100644 --- a/proto/librarian/sephirah/v1/tiphereth.proto +++ b/proto/librarian/sephirah/v1/tiphereth.proto @@ -154,8 +154,7 @@ message UpdatePorterStatusRequest { message UpdatePorterStatusResponse {} message CreatePorterContextRequest { - librarian.v1.InternalID porter_id = 1; - PorterContext context = 2; + PorterContext context = 1; } message CreatePorterContextResponse { @@ -172,19 +171,10 @@ message ListPorterContextsResponse { } message UpdatePorterContextRequest { - librarian.v1.InternalID porter_id = 1; - PorterContext context = 2; + PorterContext context = 1; } message UpdatePorterContextResponse {} -message PorterContext { - librarian.v1.InternalID id = 1; - librarian.v1.InternalID porter_id = 2; - optional string context_json = 3; - string name = 4; - string description = 5; -} - message User { librarian.v1.InternalID id = 1; string username = 2; @@ -247,6 +237,8 @@ message Porter { PorterConnectionStatus connection_status = 7; // Only used in response optional string context_json_schema = 8; + // Only used in response + string connection_status_message = 9; } enum PorterConnectionStatus { @@ -259,4 +251,38 @@ enum PorterConnectionStatus { PORTER_CONNECTION_STATUS_ACTIVE = 3; // Available but failed to activate PORTER_CONNECTION_STATUS_ACTIVATION_FAILED = 4; + // Active but downgraded + PORTER_CONNECTION_STATUS_DOWNGRADED = 5; +} + +message PorterContext { + librarian.v1.InternalID id = 1; + string global_name = 2; + string region = 3; + string context_json = 4; + string name = 5; + string description = 6; + PorterContextStatus status = 7; + // Only used in response + PorterContextHandleStatus handle_status = 8; + // Only used in response + string handle_status_message = 9; +} + +enum PorterContextStatus { + PORTER_CONTEXT_STATUS_UNSPECIFIED = 0; + PORTER_CONTEXT_STATUS_ACTIVE = 1; + PORTER_CONTEXT_STATUS_DISABLED = 2; +} + +enum PorterContextHandleStatus { + PORTER_CONTEXT_HANDLE_STATUS_UNSPECIFIED = 0; + // Active and can be used + PORTER_CONTEXT_HANDLE_STATUS_ACTIVE = 1; + // Active but downgraded + PORTER_CONTEXT_HANDLE_STATUS_DOWNGRADED = 2; + // In queueing + PORTER_CONTEXT_HANDLE_STATUS_QUEUEING = 3; + // Blocked by some reason (e.g. no available resources) + PORTER_CONTEXT_HANDLE_STATUS_BLOCKED = 4; }