From 68dc4da50e67437d56fe13255ebd672ae8f356e8 Mon Sep 17 00:00:00 2001 From: Todd Date: Thu, 6 Apr 2023 11:36:21 -0700 Subject: [PATCH] Add CloseConnectionRecording enums to the upstream message service --- .../upstream_message_service_worker.go | 2 ++ internal/errors/code.go | 2 ++ internal/errors/error.go | 3 +++ .../services/upstream_message_service.pb.go | 21 ++++++++++++------- .../v1/upstream_message_service.proto | 1 + 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/internal/daemon/cluster/handlers/upstream_message_service_worker.go b/internal/daemon/cluster/handlers/upstream_message_service_worker.go index e1dbb8f265..f68d245dc2 100644 --- a/internal/daemon/cluster/handlers/upstream_message_service_worker.go +++ b/internal/daemon/cluster/handlers/upstream_message_service_worker.go @@ -167,6 +167,8 @@ func toMsgType(ctx context.Context, m proto.Message) (pbs.MsgType, error) { return pbs.MsgType_MSG_TYPE_UNWRAP_KEYS, nil case *pbs.VerifySignatureRequest, *pbs.VerifySignatureResponse: return pbs.MsgType_MSG_TYPE_VERIFY_SIGNATURE, nil + case *pbs.CloseConnectionRecordingRequest, *pbs.CloseConnectionRecordingResponse: + return pbs.MsgType_MSG_TYPE_CLOSE_CONNECTION, nil default: return pbs.MsgType_MSG_TYPE_UNSPECIFIED, errors.New(ctx, errors.InvalidParameter, op, fmt.Sprintf("%q is an unknown msg type", t)) } diff --git a/internal/errors/code.go b/internal/errors/code.go index 6b3011e53d..f0aee9d743 100644 --- a/internal/errors/code.go +++ b/internal/errors/code.go @@ -119,6 +119,8 @@ const ( // specific number of records returned a different count, e.g. if you // expected to delete three items and only one was deleted. UnexpectedRowsAffected Code = 1107 + // ImmutableColumn is used when an operation attempted to mutate an immutable column. + ImmutableColumn Code = 1108 // Migration setup errors are codes 2000-2999 MigrationIntegrity Code = 2000 // MigrationIntegrity represents an error with the generated migration related code diff --git a/internal/errors/error.go b/internal/errors/error.go index fc0ab7d077..1ef7cb2043 100644 --- a/internal/errors/error.go +++ b/internal/errors/error.go @@ -208,6 +208,9 @@ func Convert(e error) *Err { case "23514": // check_violation msg := fmt.Sprintf("%s constraint failed", pgxError.ConstraintName) return E(ctx, WithoutEvent(), WithMsg(msg), WithWrap(E(ctx, WithoutEvent(), WithCode(CheckConstraint), WithMsg("check constraint violated")))).(*Err) + case "23602": // set_once_column + msg := fmt.Sprintf("%s.%s can only be set once", pgxError.TableName, pgxError.ColumnName) + return E(ctx, WithoutEvent(), WithMsg(msg), WithWrap(E(ctx, WithoutEvent(), WithCode(ImmutableColumn), WithMsg("set_once_column constraint violated")))).(*Err) default: return E(ctx, WithoutEvent(), WithCode(NotSpecificIntegrity), WithMsg(pgxError.Message)).(*Err) } diff --git a/internal/gen/controller/servers/services/upstream_message_service.pb.go b/internal/gen/controller/servers/services/upstream_message_service.pb.go index b783e4b741..dd51d742bb 100644 --- a/internal/gen/controller/servers/services/upstream_message_service.pb.go +++ b/internal/gen/controller/servers/services/upstream_message_service.pb.go @@ -30,6 +30,7 @@ const ( MsgType_MSG_TYPE_ECHO MsgType = 1 // currently this only used for testing. MsgType_MSG_TYPE_UNWRAP_KEYS MsgType = 2 MsgType_MSG_TYPE_VERIFY_SIGNATURE MsgType = 3 + MsgType_MSG_TYPE_CLOSE_CONNECTION MsgType = 4 ) // Enum value maps for MsgType. @@ -39,12 +40,14 @@ var ( 1: "MSG_TYPE_ECHO", 2: "MSG_TYPE_UNWRAP_KEYS", 3: "MSG_TYPE_VERIFY_SIGNATURE", + 4: "MSG_TYPE_CLOSE_CONNECTION", } MsgType_value = map[string]int32{ "MSG_TYPE_UNSPECIFIED": 0, "MSG_TYPE_ECHO": 1, "MSG_TYPE_UNWRAP_KEYS": 2, "MSG_TYPE_VERIFY_SIGNATURE": 3, + "MSG_TYPE_CLOSE_CONNECTION": 4, } ) @@ -396,14 +399,16 @@ var file_controller_servers_services_v1_upstream_message_service_proto_rawDesc = 0x73, 0x67, 0x22, 0x2f, 0x0a, 0x1b, 0x45, 0x63, 0x68, 0x6f, 0x55, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x6d, 0x73, 0x67, 0x2a, 0x6f, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, - 0x0a, 0x14, 0x4d, 0x53, 0x47, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, - 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x4d, 0x53, 0x47, 0x5f, - 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x43, 0x48, 0x4f, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x4d, - 0x53, 0x47, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x57, 0x52, 0x41, 0x50, 0x5f, 0x4b, - 0x45, 0x59, 0x53, 0x10, 0x02, 0x12, 0x1d, 0x0a, 0x19, 0x4d, 0x53, 0x47, 0x5f, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x56, 0x45, 0x52, 0x49, 0x46, 0x59, 0x5f, 0x53, 0x49, 0x47, 0x4e, 0x41, 0x54, 0x55, - 0x52, 0x45, 0x10, 0x03, 0x32, 0x9f, 0x01, 0x0a, 0x16, 0x55, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x73, 0x67, 0x2a, 0x8e, 0x01, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x18, 0x0a, 0x14, 0x4d, 0x53, 0x47, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x4d, 0x53, 0x47, + 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x43, 0x48, 0x4f, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, + 0x4d, 0x53, 0x47, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x57, 0x52, 0x41, 0x50, 0x5f, + 0x4b, 0x45, 0x59, 0x53, 0x10, 0x02, 0x12, 0x1d, 0x0a, 0x19, 0x4d, 0x53, 0x47, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x56, 0x45, 0x52, 0x49, 0x46, 0x59, 0x5f, 0x53, 0x49, 0x47, 0x4e, 0x41, 0x54, + 0x55, 0x52, 0x45, 0x10, 0x03, 0x12, 0x1d, 0x0a, 0x19, 0x4d, 0x53, 0x47, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x5f, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x49, + 0x4f, 0x4e, 0x10, 0x04, 0x32, 0x9f, 0x01, 0x0a, 0x16, 0x55, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x84, 0x01, 0x0a, 0x0f, 0x55, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x36, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, diff --git a/internal/proto/controller/servers/services/v1/upstream_message_service.proto b/internal/proto/controller/servers/services/v1/upstream_message_service.proto index 6147de23da..cea54705bf 100644 --- a/internal/proto/controller/servers/services/v1/upstream_message_service.proto +++ b/internal/proto/controller/servers/services/v1/upstream_message_service.proto @@ -52,6 +52,7 @@ enum MsgType { MSG_TYPE_ECHO = 1; // currently this only used for testing. MSG_TYPE_UNWRAP_KEYS = 2; MSG_TYPE_VERIFY_SIGNATURE = 3; + MSG_TYPE_CLOSE_CONNECTION = 4; } message EchoUpstreamMessageRequest {