From 86fc0f67616fde018285ae5ca3f238f7f4d97eed Mon Sep 17 00:00:00 2001 From: Daniel Selans Date: Tue, 12 Mar 2024 23:45:12 -0700 Subject: [PATCH 1/9] using locally updated protos --- plumber/cli_manage_relay.go | 15 + validate/cli.go | 33 + .../go/protos/args/ps_args_activemq.pb.go | 351 +- .../go/protos/args/ps_args_aws_kinesis.pb.go | 456 ++- .../go/protos/args/ps_args_aws_sns.pb.go | 288 +- .../go/protos/args/ps_args_aws_sqs.pb.go | 602 ++-- .../protos/args/ps_args_azure_event_hub.pb.go | 339 +- .../args/ps_args_azure_service_bus.pb.go | 365 +- .../go/protos/args/ps_args_gcp_pubsub.pb.go | 378 +- .../build/go/protos/args/ps_args_kafka.pb.go | 750 ++-- .../go/protos/args/ps_args_kubemq_queue.pb.go | 364 +- .../go/protos/args/ps_args_memphis.pb.go | 411 ++- .../build/go/protos/args/ps_args_mongo.pb.go | 277 +- .../build/go/protos/args/ps_args_mqtt.pb.go | 566 +-- .../build/go/protos/args/ps_args_nats.pb.go | 482 ++- .../protos/args/ps_args_nats_jetstream.pb.go | 568 +-- .../protos/args/ps_args_nats_streaming.pb.go | 544 +-- .../build/go/protos/args/ps_args_nsq.pb.go | 416 ++- .../go/protos/args/ps_args_postgres.pb.go | 323 +- .../build/go/protos/args/ps_args_pulsar.pb.go | 538 ++- .../build/go/protos/args/ps_args_rabbit.pb.go | 518 +-- .../protos/args/ps_args_rabbit_streams.pb.go | 550 +-- .../go/protos/args/ps_args_redis_pubsub.pb.go | 361 +- .../protos/args/ps_args_redis_streams.pb.go | 569 ++-- .../go/protos/common/ps_common_auth.pb.go | 394 ++- .../go/protos/common/ps_common_backends.pb.go | 269 +- .../go/protos/common/ps_common_status.pb.go | 351 +- .../protos/common/ps_common_validation.pb.go | 300 +- .../protos/encoding/ps_encoding_options.pb.go | 1112 +++--- .../opts/batch_connection_options.pb.go | 144 +- .../build/go/protos/opts/ps_opts_cli.pb.go | 418 ++- .../go/protos/opts/ps_opts_connection.pb.go | 730 ++-- .../build/go/protos/opts/ps_opts_manage.pb.go | 921 +++-- .../opts/ps_opts_manage_connection.pb.go | 667 ++-- .../go/protos/opts/ps_opts_manage_relay.pb.go | 924 +++-- .../protos/opts/ps_opts_manage_tunnel.pb.go | 860 +++-- .../build/go/protos/opts/ps_opts_read.pb.go | 3031 +++++++++++------ .../build/go/protos/opts/ps_opts_relay.pb.go | 2048 +++++++---- .../build/go/protos/opts/ps_opts_server.pb.go | 347 +- .../go/protos/opts/ps_opts_streamdal.pb.go | 1783 ++++++---- .../build/go/protos/opts/ps_opts_tunnel.pb.go | 2424 ++++++++----- .../build/go/protos/opts/ps_opts_write.pb.go | 2526 +++++++++----- .../build/go/protos/ps_base.pb.go | 1111 ++---- .../build/go/protos/ps_base_grpc.pb.go | 835 +++++ .../build/go/protos/ps_connect.pb.go | 1147 ++++--- .../build/go/protos/ps_foreman_client.pb.go | 372 +- .../go/protos/ps_foreman_client_grpc.pb.go | 105 + .../build/go/protos/ps_foreman_server.pb.go | 1420 +++----- .../go/protos/ps_foreman_server_grpc.pb.go | 875 +++++ .../build/go/protos/ps_relay.pb.go | 1334 +++++--- .../build/go/protos/ps_server.pb.go | 273 +- .../build/go/protos/ps_tunnel.pb.go | 1336 +++++--- .../protos/records/ps_records_activemq.pb.go | 222 +- .../records/ps_records_aws_kinesis.pb.go | 222 +- .../protos/records/ps_records_aws_sqs.pb.go | 233 +- .../records/ps_records_azure_event_hub.pb.go | 222 +- .../ps_records_azure_service_bus.pb.go | 548 +-- .../go/protos/records/ps_records_base.pb.go | 1012 ++++-- .../records/ps_records_gcp_pubsub.pb.go | 256 +- .../go/protos/records/ps_records_kafka.pb.go | 335 +- .../go/protos/records/ps_records_kubemq.pb.go | 235 +- .../protos/records/ps_records_memphis.pb.go | 187 +- .../go/protos/records/ps_records_mongo.pb.go | 187 +- .../go/protos/records/ps_records_mqtt.pb.go | 246 +- .../go/protos/records/ps_records_nats.pb.go | 186 +- .../records/ps_records_nats_jetstream.pb.go | 209 +- .../records/ps_records_nats_streaming.pb.go | 210 +- .../go/protos/records/ps_records_nsq.pb.go | 248 +- .../protos/records/ps_records_postgres.pb.go | 210 +- .../go/protos/records/ps_records_pulsar.pb.go | 316 +- .../go/protos/records/ps_records_rabbit.pb.go | 427 ++- .../records/ps_records_rabbit_streams.pb.go | 407 ++- .../records/ps_records_redis_pubsub.pb.go | 210 +- .../records/ps_records_redis_streams.pb.go | 215 +- 74 files changed, 28830 insertions(+), 15834 deletions(-) create mode 100644 vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_base_grpc.pb.go create mode 100644 vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_foreman_client_grpc.pb.go create mode 100644 vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_foreman_server_grpc.pb.go diff --git a/plumber/cli_manage_relay.go b/plumber/cli_manage_relay.go index 18df738ca..87e1078c7 100644 --- a/plumber/cli_manage_relay.go +++ b/plumber/cli_manage_relay.go @@ -2,6 +2,7 @@ package plumber import ( "context" + "fmt" "strings" "github.com/pkg/errors" @@ -10,6 +11,8 @@ import ( "github.com/batchcorp/plumber-schemas/build/go/protos" "github.com/batchcorp/plumber-schemas/build/go/protos/common" "github.com/batchcorp/plumber-schemas/build/go/protos/opts" + + "github.com/streamdal/plumber/validate" ) func (p *Plumber) HandleGetRelayCmd(ctx context.Context, client protos.PlumberServerClient) error { @@ -152,6 +155,15 @@ func (p *Plumber) HandleDeleteRelayCmd(ctx context.Context, client protos.Plumbe } func (p *Plumber) HandleCreateRelayCmd(ctx context.Context, client protos.PlumberServerClient) error { + // Just in case + if p.CLIOptions == nil || p.CLIOptions.Manage == nil || p.CLIOptions.Manage.Create == nil || p.CLIOptions.Manage.Create.Relay == nil { + return errors.New("unable to create relay: missing CLI options") + } + + if err := validate.ManageCreateRelayCmd(p.CLIOptions.Manage.Create.Relay); err != nil { + return errors.Wrap(err, "unable to validate manage create relay options") + } + p.EnqueueManage(posthog.Capture{ Event: "command_manage", DistinctId: p.PersistentConfig.PlumberID, @@ -169,6 +181,8 @@ func (p *Plumber) HandleCreateRelayCmd(ctx context.Context, client protos.Plumbe return errors.Wrap(err, "failed to generate relay options") } + fmt.Printf("Would pass this to grpc api: %+v\n", relayOpts) + resp, err := client.CreateRelay(ctx, &protos.CreateRelayRequest{ Auth: &common.Auth{ Token: p.CLIOptions.Manage.GlobalOptions.ManageToken, @@ -193,6 +207,7 @@ func generateRelayOptionsForManageCreate(cliOpts *opts.CLIOptions) (*opts.RelayO BatchMaxRetry: cliOpts.Manage.Create.Relay.BatchMaxRetry, ConnectionId: cliOpts.Manage.Create.Relay.ConnectionId, NumWorkers: cliOpts.Manage.Create.Relay.NumWorkers, + StreamdalIntegrationOptions: cliOpts.Manage.Create.Relay.StreamdalIntegrationOptions, XStreamdalGrpcAddress: cliOpts.Manage.Create.Relay.StreamdalGrpcAddress, XStreamdalGrpcDisableTls: cliOpts.Manage.Create.Relay.StreamdalGrpcDisableTls, XStreamdalGrpcTimeoutSeconds: cliOpts.Manage.Create.Relay.StreamdalGrpcTimeoutSeconds, diff --git a/validate/cli.go b/validate/cli.go index 7daa287bc..a0125d39d 100644 --- a/validate/cli.go +++ b/validate/cli.go @@ -4,6 +4,7 @@ package validate import ( "fmt" "os" + "regexp" "github.com/pkg/errors" @@ -60,6 +61,38 @@ func ReadOptionsForCLI(readOpts *opts.ReadOptions) error { return nil } +func ManageCreateRelayCmd(relayOpts *opts.CreateRelayOptions) error { + if relayOpts == nil { + return errors.New("create relay options cannot be nil") + } + + // Perform additional validations if streamdal integration is enabled + if relayOpts.StreamdalIntegrationOptions != nil && relayOpts.StreamdalIntegrationOptions.StreamdalIntegrationEnable { + // Server and auth token must be set + if relayOpts.StreamdalIntegrationOptions.StreamdalIntegrationServerAddress == "" { + return errors.New("--streamdal-server must be set if Streamdal integration is enabled") + } + + if relayOpts.StreamdalIntegrationOptions.StreamdalIntegrationAuthToken == "" { + return errors.New("--streamdal-auth-token must be set if Streamdal integration is enabled") + } + + // Only allow service name to be alphanumeric + if relayOpts.StreamdalIntegrationOptions.StreamdalIntegrationServiceName != "" { + re, err := regexp.Compile(`^[a-zA-Z0-9]*$`) + if err != nil { + return errors.Wrap(err, "unable to compile service name regex") + } + + if !re.MatchString(relayOpts.StreamdalIntegrationOptions.StreamdalIntegrationServiceName) { + return errors.New("--streamdal-service-name must be alphanumeric") + } + } + } + + return nil +} + func WriteOptionsForCLI(writeOpts *opts.WriteOptions) error { if writeOpts == nil { return ErrEmptyWriteOpts diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_activemq.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_activemq.pb.go index 8995e3cc0..070f0d6ee 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_activemq.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_activemq.pb.go @@ -1,184 +1,295 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_args_activemq.proto package args import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type ActiveMQConn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Destination host address',required,default=localhost:61613" - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" kong:"help='Destination host address',required,default=localhost:61613"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" kong:"help='Destination host address',required,default=localhost:61613"` } -func (m *ActiveMQConn) Reset() { *m = ActiveMQConn{} } -func (m *ActiveMQConn) String() string { return proto.CompactTextString(m) } -func (*ActiveMQConn) ProtoMessage() {} -func (*ActiveMQConn) Descriptor() ([]byte, []int) { - return fileDescriptor_2628143e7f9c016a, []int{0} +func (x *ActiveMQConn) Reset() { + *x = ActiveMQConn{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_activemq_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ActiveMQConn) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ActiveMQConn.Unmarshal(m, b) -} -func (m *ActiveMQConn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ActiveMQConn.Marshal(b, m, deterministic) +func (x *ActiveMQConn) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ActiveMQConn) XXX_Merge(src proto.Message) { - xxx_messageInfo_ActiveMQConn.Merge(m, src) -} -func (m *ActiveMQConn) XXX_Size() int { - return xxx_messageInfo_ActiveMQConn.Size(m) -} -func (m *ActiveMQConn) XXX_DiscardUnknown() { - xxx_messageInfo_ActiveMQConn.DiscardUnknown(m) + +func (*ActiveMQConn) ProtoMessage() {} + +func (x *ActiveMQConn) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_activemq_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ActiveMQConn proto.InternalMessageInfo +// Deprecated: Use ActiveMQConn.ProtoReflect.Descriptor instead. +func (*ActiveMQConn) Descriptor() ([]byte, []int) { + return file_ps_args_activemq_proto_rawDescGZIP(), []int{0} +} -func (m *ActiveMQConn) GetAddress() string { - if m != nil { - return m.Address +func (x *ActiveMQConn) GetAddress() string { + if x != nil { + return x.Address } return "" } type ActiveMQReadArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Topic to read message(s) from',xor=activemq_read" Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty" kong:"help='Topic to read message(s) from',xor=activemq_read"` // @gotags: kong:'help='Queue to read message(s) from',xor=activemq_read" - Queue string `protobuf:"bytes,2,opt,name=queue,proto3" json:"queue,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Queue string `protobuf:"bytes,2,opt,name=queue,proto3" json:"queue,omitempty"` } -func (m *ActiveMQReadArgs) Reset() { *m = ActiveMQReadArgs{} } -func (m *ActiveMQReadArgs) String() string { return proto.CompactTextString(m) } -func (*ActiveMQReadArgs) ProtoMessage() {} -func (*ActiveMQReadArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_2628143e7f9c016a, []int{1} +func (x *ActiveMQReadArgs) Reset() { + *x = ActiveMQReadArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_activemq_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ActiveMQReadArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ActiveMQReadArgs.Unmarshal(m, b) -} -func (m *ActiveMQReadArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ActiveMQReadArgs.Marshal(b, m, deterministic) -} -func (m *ActiveMQReadArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_ActiveMQReadArgs.Merge(m, src) +func (x *ActiveMQReadArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ActiveMQReadArgs) XXX_Size() int { - return xxx_messageInfo_ActiveMQReadArgs.Size(m) -} -func (m *ActiveMQReadArgs) XXX_DiscardUnknown() { - xxx_messageInfo_ActiveMQReadArgs.DiscardUnknown(m) + +func (*ActiveMQReadArgs) ProtoMessage() {} + +func (x *ActiveMQReadArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_activemq_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ActiveMQReadArgs proto.InternalMessageInfo +// Deprecated: Use ActiveMQReadArgs.ProtoReflect.Descriptor instead. +func (*ActiveMQReadArgs) Descriptor() ([]byte, []int) { + return file_ps_args_activemq_proto_rawDescGZIP(), []int{1} +} -func (m *ActiveMQReadArgs) GetTopic() string { - if m != nil { - return m.Topic +func (x *ActiveMQReadArgs) GetTopic() string { + if x != nil { + return x.Topic } return "" } -func (m *ActiveMQReadArgs) GetQueue() string { - if m != nil { - return m.Queue +func (x *ActiveMQReadArgs) GetQueue() string { + if x != nil { + return x.Queue } return "" } type ActiveMQWriteArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Topic to write message(s) to',xor=activemq_write" Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty" kong:"help='Topic to write message(s) to',xor=activemq_write"` // @gotags: kong:'help='Queue to write message(s) to',xor=activemq_write" - Queue string `protobuf:"bytes,2,opt,name=queue,proto3" json:"queue,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Queue string `protobuf:"bytes,2,opt,name=queue,proto3" json:"queue,omitempty"` } -func (m *ActiveMQWriteArgs) Reset() { *m = ActiveMQWriteArgs{} } -func (m *ActiveMQWriteArgs) String() string { return proto.CompactTextString(m) } -func (*ActiveMQWriteArgs) ProtoMessage() {} -func (*ActiveMQWriteArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_2628143e7f9c016a, []int{2} +func (x *ActiveMQWriteArgs) Reset() { + *x = ActiveMQWriteArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_activemq_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ActiveMQWriteArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ActiveMQWriteArgs.Unmarshal(m, b) -} -func (m *ActiveMQWriteArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ActiveMQWriteArgs.Marshal(b, m, deterministic) -} -func (m *ActiveMQWriteArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_ActiveMQWriteArgs.Merge(m, src) -} -func (m *ActiveMQWriteArgs) XXX_Size() int { - return xxx_messageInfo_ActiveMQWriteArgs.Size(m) +func (x *ActiveMQWriteArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ActiveMQWriteArgs) XXX_DiscardUnknown() { - xxx_messageInfo_ActiveMQWriteArgs.DiscardUnknown(m) + +func (*ActiveMQWriteArgs) ProtoMessage() {} + +func (x *ActiveMQWriteArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_activemq_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ActiveMQWriteArgs proto.InternalMessageInfo +// Deprecated: Use ActiveMQWriteArgs.ProtoReflect.Descriptor instead. +func (*ActiveMQWriteArgs) Descriptor() ([]byte, []int) { + return file_ps_args_activemq_proto_rawDescGZIP(), []int{2} +} -func (m *ActiveMQWriteArgs) GetTopic() string { - if m != nil { - return m.Topic +func (x *ActiveMQWriteArgs) GetTopic() string { + if x != nil { + return x.Topic } return "" } -func (m *ActiveMQWriteArgs) GetQueue() string { - if m != nil { - return m.Queue +func (x *ActiveMQWriteArgs) GetQueue() string { + if x != nil { + return x.Queue } return "" } -func init() { - proto.RegisterType((*ActiveMQConn)(nil), "protos.args.ActiveMQConn") - proto.RegisterType((*ActiveMQReadArgs)(nil), "protos.args.ActiveMQReadArgs") - proto.RegisterType((*ActiveMQWriteArgs)(nil), "protos.args.ActiveMQWriteArgs") -} - -func init() { proto.RegisterFile("ps_args_activemq.proto", fileDescriptor_2628143e7f9c016a) } - -var fileDescriptor_2628143e7f9c016a = []byte{ - // 201 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2b, 0x28, 0x8e, 0x4f, - 0x2c, 0x4a, 0x2f, 0x8e, 0x4f, 0x4c, 0x2e, 0xc9, 0x2c, 0x4b, 0xcd, 0x2d, 0xd4, 0x2b, 0x28, 0xca, - 0x2f, 0xc9, 0x17, 0xe2, 0x06, 0x53, 0xc5, 0x7a, 0x20, 0x39, 0x25, 0x0d, 0x2e, 0x1e, 0x47, 0xb0, - 0xb4, 0x6f, 0xa0, 0x73, 0x7e, 0x5e, 0x9e, 0x90, 0x04, 0x17, 0x7b, 0x62, 0x4a, 0x4a, 0x51, 0x6a, - 0x71, 0xb1, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x8c, 0xab, 0x64, 0xc7, 0x25, 0x00, 0x53, - 0x19, 0x94, 0x9a, 0x98, 0xe2, 0x58, 0x94, 0x5e, 0x2c, 0x24, 0xc2, 0xc5, 0x5a, 0x92, 0x5f, 0x90, - 0x99, 0x0c, 0x55, 0x0b, 0xe1, 0x80, 0x44, 0x0b, 0x4b, 0x53, 0x4b, 0x53, 0x25, 0x98, 0x20, 0xa2, - 0x60, 0x8e, 0x92, 0x3d, 0x97, 0x20, 0x4c, 0x7f, 0x78, 0x51, 0x66, 0x49, 0x2a, 0xa9, 0x06, 0x38, - 0x59, 0x47, 0x59, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x27, 0x25, - 0x96, 0x24, 0x67, 0x24, 0xe7, 0x17, 0x15, 0xe8, 0x17, 0xe4, 0x94, 0xe6, 0x26, 0xa5, 0x16, 0xe9, - 0x16, 0x27, 0x67, 0xa4, 0xe6, 0x26, 0x16, 0xeb, 0x27, 0x95, 0x66, 0xe6, 0xa4, 0xe8, 0xa7, 0xe7, - 0xeb, 0x43, 0xfc, 0xa9, 0x0f, 0xf2, 0x67, 0x12, 0x1b, 0x98, 0x63, 0x0c, 0x08, 0x00, 0x00, 0xff, - 0xff, 0xb1, 0xdf, 0x39, 0x91, 0x15, 0x01, 0x00, 0x00, +var File_ps_args_activemq_proto protoreflect.FileDescriptor + +var file_ps_args_activemq_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, + 0x6d, 0x71, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x61, 0x72, 0x67, 0x73, 0x22, 0x28, 0x0a, 0x0c, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4d, + 0x51, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, + 0x3e, 0x0a, 0x10, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4d, 0x51, 0x52, 0x65, 0x61, 0x64, 0x41, + 0x72, 0x67, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x75, 0x65, 0x22, + 0x3f, 0x0a, 0x11, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4d, 0x51, 0x57, 0x72, 0x69, 0x74, 0x65, + 0x41, 0x72, 0x67, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, + 0x65, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x75, 0x65, + 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, + 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, + 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x61, 0x72, 0x67, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ps_args_activemq_proto_rawDescOnce sync.Once + file_ps_args_activemq_proto_rawDescData = file_ps_args_activemq_proto_rawDesc +) + +func file_ps_args_activemq_proto_rawDescGZIP() []byte { + file_ps_args_activemq_proto_rawDescOnce.Do(func() { + file_ps_args_activemq_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_args_activemq_proto_rawDescData) + }) + return file_ps_args_activemq_proto_rawDescData +} + +var file_ps_args_activemq_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_ps_args_activemq_proto_goTypes = []interface{}{ + (*ActiveMQConn)(nil), // 0: protos.args.ActiveMQConn + (*ActiveMQReadArgs)(nil), // 1: protos.args.ActiveMQReadArgs + (*ActiveMQWriteArgs)(nil), // 2: protos.args.ActiveMQWriteArgs +} +var file_ps_args_activemq_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_ps_args_activemq_proto_init() } +func file_ps_args_activemq_proto_init() { + if File_ps_args_activemq_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_args_activemq_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ActiveMQConn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_activemq_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ActiveMQReadArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_activemq_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ActiveMQWriteArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_args_activemq_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_args_activemq_proto_goTypes, + DependencyIndexes: file_ps_args_activemq_proto_depIdxs, + MessageInfos: file_ps_args_activemq_proto_msgTypes, + }.Build() + File_ps_args_activemq_proto = out.File + file_ps_args_activemq_proto_rawDesc = nil + file_ps_args_activemq_proto_goTypes = nil + file_ps_args_activemq_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_aws_kinesis.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_aws_kinesis.pb.go index 0c139dca8..1b9b80901 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_aws_kinesis.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_aws_kinesis.pb.go @@ -1,26 +1,30 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_args_aws_kinesis.proto package args import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type AWSKinesisConn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"env=AWS_DEFAULT_REGION,hidden" AwsRegion string `protobuf:"bytes,1,opt,name=aws_region,json=awsRegion,proto3" json:"aws_region,omitempty" kong:"env=AWS_DEFAULT_REGION,hidden"` // @gotags: kong:"env=AWS_ACCESS_KEY_ID,hidden" @@ -28,66 +32,74 @@ type AWSKinesisConn struct { // @gotags: kong:"env=AWS_SECRET_ACCESS_KEY,hidden" AwsSecretAccessKey string `protobuf:"bytes,3,opt,name=aws_secret_access_key,json=awsSecretAccessKey,proto3" json:"aws_secret_access_key,omitempty" kong:"env=AWS_SECRET_ACCESS_KEY,hidden"` // @gotags: kong:"env=AWS_PROFILE,hidden" - AwsProfile string `protobuf:"bytes,4,opt,name=aws_profile,json=awsProfile,proto3" json:"aws_profile,omitempty" kong:"env=AWS_PROFILE,hidden"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + AwsProfile string `protobuf:"bytes,4,opt,name=aws_profile,json=awsProfile,proto3" json:"aws_profile,omitempty" kong:"env=AWS_PROFILE,hidden"` } -func (m *AWSKinesisConn) Reset() { *m = AWSKinesisConn{} } -func (m *AWSKinesisConn) String() string { return proto.CompactTextString(m) } -func (*AWSKinesisConn) ProtoMessage() {} -func (*AWSKinesisConn) Descriptor() ([]byte, []int) { - return fileDescriptor_7f353884fb0804cc, []int{0} +func (x *AWSKinesisConn) Reset() { + *x = AWSKinesisConn{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_aws_kinesis_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AWSKinesisConn) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AWSKinesisConn.Unmarshal(m, b) -} -func (m *AWSKinesisConn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AWSKinesisConn.Marshal(b, m, deterministic) +func (x *AWSKinesisConn) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AWSKinesisConn) XXX_Merge(src proto.Message) { - xxx_messageInfo_AWSKinesisConn.Merge(m, src) -} -func (m *AWSKinesisConn) XXX_Size() int { - return xxx_messageInfo_AWSKinesisConn.Size(m) -} -func (m *AWSKinesisConn) XXX_DiscardUnknown() { - xxx_messageInfo_AWSKinesisConn.DiscardUnknown(m) + +func (*AWSKinesisConn) ProtoMessage() {} + +func (x *AWSKinesisConn) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_aws_kinesis_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AWSKinesisConn proto.InternalMessageInfo +// Deprecated: Use AWSKinesisConn.ProtoReflect.Descriptor instead. +func (*AWSKinesisConn) Descriptor() ([]byte, []int) { + return file_ps_args_aws_kinesis_proto_rawDescGZIP(), []int{0} +} -func (m *AWSKinesisConn) GetAwsRegion() string { - if m != nil { - return m.AwsRegion +func (x *AWSKinesisConn) GetAwsRegion() string { + if x != nil { + return x.AwsRegion } return "" } -func (m *AWSKinesisConn) GetAwsAccessKeyId() string { - if m != nil { - return m.AwsAccessKeyId +func (x *AWSKinesisConn) GetAwsAccessKeyId() string { + if x != nil { + return x.AwsAccessKeyId } return "" } -func (m *AWSKinesisConn) GetAwsSecretAccessKey() string { - if m != nil { - return m.AwsSecretAccessKey +func (x *AWSKinesisConn) GetAwsSecretAccessKey() string { + if x != nil { + return x.AwsSecretAccessKey } return "" } -func (m *AWSKinesisConn) GetAwsProfile() string { - if m != nil { - return m.AwsProfile +func (x *AWSKinesisConn) GetAwsProfile() string { + if x != nil { + return x.AwsProfile } return "" } type AWSKinesisReadArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Stream Name',required" Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty" kong:"help='Stream Name',required"` // @gotags: kong:"help='Shard ID. If empty, will read from all shards'" @@ -103,188 +115,300 @@ type AWSKinesisReadArgs struct { // @gotags: kong:"help='Deliver messages starting at the last untrimmed record in the shard in the system, which is the oldest data record in the shard.',xor=kinesis_delivery_option" ReadTrimHorizon bool `protobuf:"varint,7,opt,name=read_trim_horizon,json=readTrimHorizon,proto3" json:"read_trim_horizon,omitempty" kong:"help='Deliver messages starting at the last untrimmed record in the shard in the system, which is the oldest data record in the shard.',xor=kinesis_delivery_option"` // @gotags: kong:"help='Deliver messages after the most recent record',xor=kinesis_delivery_option" - ReadLatest bool `protobuf:"varint,8,opt,name=read_latest,json=readLatest,proto3" json:"read_latest,omitempty" kong:"help='Deliver messages after the most recent record',xor=kinesis_delivery_option"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ReadLatest bool `protobuf:"varint,8,opt,name=read_latest,json=readLatest,proto3" json:"read_latest,omitempty" kong:"help='Deliver messages after the most recent record',xor=kinesis_delivery_option"` } -func (m *AWSKinesisReadArgs) Reset() { *m = AWSKinesisReadArgs{} } -func (m *AWSKinesisReadArgs) String() string { return proto.CompactTextString(m) } -func (*AWSKinesisReadArgs) ProtoMessage() {} -func (*AWSKinesisReadArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_7f353884fb0804cc, []int{1} +func (x *AWSKinesisReadArgs) Reset() { + *x = AWSKinesisReadArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_aws_kinesis_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AWSKinesisReadArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AWSKinesisReadArgs.Unmarshal(m, b) -} -func (m *AWSKinesisReadArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AWSKinesisReadArgs.Marshal(b, m, deterministic) +func (x *AWSKinesisReadArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AWSKinesisReadArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_AWSKinesisReadArgs.Merge(m, src) -} -func (m *AWSKinesisReadArgs) XXX_Size() int { - return xxx_messageInfo_AWSKinesisReadArgs.Size(m) -} -func (m *AWSKinesisReadArgs) XXX_DiscardUnknown() { - xxx_messageInfo_AWSKinesisReadArgs.DiscardUnknown(m) + +func (*AWSKinesisReadArgs) ProtoMessage() {} + +func (x *AWSKinesisReadArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_aws_kinesis_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AWSKinesisReadArgs proto.InternalMessageInfo +// Deprecated: Use AWSKinesisReadArgs.ProtoReflect.Descriptor instead. +func (*AWSKinesisReadArgs) Descriptor() ([]byte, []int) { + return file_ps_args_aws_kinesis_proto_rawDescGZIP(), []int{1} +} -func (m *AWSKinesisReadArgs) GetStream() string { - if m != nil { - return m.Stream +func (x *AWSKinesisReadArgs) GetStream() string { + if x != nil { + return x.Stream } return "" } -func (m *AWSKinesisReadArgs) GetShard() string { - if m != nil { - return m.Shard +func (x *AWSKinesisReadArgs) GetShard() string { + if x != nil { + return x.Shard } return "" } -func (m *AWSKinesisReadArgs) GetMaxRecords() int64 { - if m != nil { - return m.MaxRecords +func (x *AWSKinesisReadArgs) GetMaxRecords() int64 { + if x != nil { + return x.MaxRecords } return 0 } -func (m *AWSKinesisReadArgs) GetReadFromTimestamp() int64 { - if m != nil { - return m.ReadFromTimestamp +func (x *AWSKinesisReadArgs) GetReadFromTimestamp() int64 { + if x != nil { + return x.ReadFromTimestamp } return 0 } -func (m *AWSKinesisReadArgs) GetReadSequenceNumber() string { - if m != nil { - return m.ReadSequenceNumber +func (x *AWSKinesisReadArgs) GetReadSequenceNumber() string { + if x != nil { + return x.ReadSequenceNumber } return "" } -func (m *AWSKinesisReadArgs) GetReadAfterSequenceNumber() string { - if m != nil { - return m.ReadAfterSequenceNumber +func (x *AWSKinesisReadArgs) GetReadAfterSequenceNumber() string { + if x != nil { + return x.ReadAfterSequenceNumber } return "" } -func (m *AWSKinesisReadArgs) GetReadTrimHorizon() bool { - if m != nil { - return m.ReadTrimHorizon +func (x *AWSKinesisReadArgs) GetReadTrimHorizon() bool { + if x != nil { + return x.ReadTrimHorizon } return false } -func (m *AWSKinesisReadArgs) GetReadLatest() bool { - if m != nil { - return m.ReadLatest +func (x *AWSKinesisReadArgs) GetReadLatest() bool { + if x != nil { + return x.ReadLatest } return false } type AWSKinesisWriteArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Stream Name',required" Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty" kong:"help='Stream Name',required"` // @gotags: kong:"help='Partition Key',required" PartitionKey string `protobuf:"bytes,2,opt,name=partition_key,json=partitionKey,proto3" json:"partition_key,omitempty" kong:"help='Partition Key',required"` // @gotags: kong:"help='Sequence number for ordering'" - SequenceNumber string `protobuf:"bytes,3,opt,name=sequence_number,json=sequenceNumber,proto3" json:"sequence_number,omitempty" kong:"help='Sequence number for ordering'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + SequenceNumber string `protobuf:"bytes,3,opt,name=sequence_number,json=sequenceNumber,proto3" json:"sequence_number,omitempty" kong:"help='Sequence number for ordering'"` } -func (m *AWSKinesisWriteArgs) Reset() { *m = AWSKinesisWriteArgs{} } -func (m *AWSKinesisWriteArgs) String() string { return proto.CompactTextString(m) } -func (*AWSKinesisWriteArgs) ProtoMessage() {} -func (*AWSKinesisWriteArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_7f353884fb0804cc, []int{2} +func (x *AWSKinesisWriteArgs) Reset() { + *x = AWSKinesisWriteArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_aws_kinesis_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AWSKinesisWriteArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AWSKinesisWriteArgs.Unmarshal(m, b) -} -func (m *AWSKinesisWriteArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AWSKinesisWriteArgs.Marshal(b, m, deterministic) +func (x *AWSKinesisWriteArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AWSKinesisWriteArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_AWSKinesisWriteArgs.Merge(m, src) -} -func (m *AWSKinesisWriteArgs) XXX_Size() int { - return xxx_messageInfo_AWSKinesisWriteArgs.Size(m) -} -func (m *AWSKinesisWriteArgs) XXX_DiscardUnknown() { - xxx_messageInfo_AWSKinesisWriteArgs.DiscardUnknown(m) + +func (*AWSKinesisWriteArgs) ProtoMessage() {} + +func (x *AWSKinesisWriteArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_aws_kinesis_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AWSKinesisWriteArgs proto.InternalMessageInfo +// Deprecated: Use AWSKinesisWriteArgs.ProtoReflect.Descriptor instead. +func (*AWSKinesisWriteArgs) Descriptor() ([]byte, []int) { + return file_ps_args_aws_kinesis_proto_rawDescGZIP(), []int{2} +} -func (m *AWSKinesisWriteArgs) GetStream() string { - if m != nil { - return m.Stream +func (x *AWSKinesisWriteArgs) GetStream() string { + if x != nil { + return x.Stream } return "" } -func (m *AWSKinesisWriteArgs) GetPartitionKey() string { - if m != nil { - return m.PartitionKey +func (x *AWSKinesisWriteArgs) GetPartitionKey() string { + if x != nil { + return x.PartitionKey } return "" } -func (m *AWSKinesisWriteArgs) GetSequenceNumber() string { - if m != nil { - return m.SequenceNumber +func (x *AWSKinesisWriteArgs) GetSequenceNumber() string { + if x != nil { + return x.SequenceNumber } return "" } -func init() { - proto.RegisterType((*AWSKinesisConn)(nil), "protos.args.AWSKinesisConn") - proto.RegisterType((*AWSKinesisReadArgs)(nil), "protos.args.AWSKinesisReadArgs") - proto.RegisterType((*AWSKinesisWriteArgs)(nil), "protos.args.AWSKinesisWriteArgs") -} - -func init() { proto.RegisterFile("ps_args_aws_kinesis.proto", fileDescriptor_7f353884fb0804cc) } - -var fileDescriptor_7f353884fb0804cc = []byte{ - // 453 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x51, 0x6b, 0x13, 0x41, - 0x14, 0x85, 0x49, 0x63, 0x63, 0x7b, 0xab, 0x29, 0x9d, 0x56, 0x5d, 0x05, 0xb1, 0xc4, 0x07, 0xab, - 0x60, 0x56, 0xf1, 0x49, 0xfa, 0x14, 0x05, 0x51, 0x2a, 0x22, 0x9b, 0x42, 0xc1, 0x97, 0x61, 0x76, - 0xf7, 0x66, 0x77, 0x68, 0x66, 0x67, 0xbd, 0x77, 0x42, 0x5a, 0xfd, 0x4f, 0xfe, 0x15, 0xff, 0x92, - 0xcc, 0xdd, 0xb4, 0xd5, 0x0a, 0x7d, 0x5a, 0xe6, 0x9c, 0xef, 0xb0, 0xe7, 0xce, 0x1d, 0x78, 0xd8, - 0xb2, 0x36, 0x54, 0xb1, 0x36, 0x4b, 0xd6, 0xa7, 0xb6, 0x41, 0xb6, 0x3c, 0x6e, 0xc9, 0x07, 0xaf, - 0xb6, 0xe4, 0xc3, 0xe3, 0x68, 0x8f, 0x7e, 0xf5, 0x60, 0x38, 0x39, 0x99, 0x1e, 0x75, 0xc4, 0x7b, - 0xdf, 0x34, 0xea, 0x31, 0x40, 0x0c, 0x11, 0x56, 0xd6, 0x37, 0x49, 0x6f, 0xbf, 0x77, 0xb0, 0x99, - 0x6d, 0x9a, 0x25, 0x67, 0x22, 0xa8, 0xe7, 0xb0, 0x13, 0x6d, 0x53, 0x14, 0xc8, 0xac, 0x4f, 0xf1, - 0x5c, 0xdb, 0x32, 0x59, 0x13, 0x6a, 0x68, 0x96, 0x3c, 0x11, 0xfd, 0x08, 0xcf, 0x3f, 0x95, 0xea, - 0x35, 0xdc, 0x8b, 0x28, 0x63, 0x41, 0x18, 0xfe, 0x4a, 0x24, 0x7d, 0xc1, 0x95, 0x59, 0xf2, 0x54, - 0xbc, 0xcb, 0x90, 0x7a, 0x02, 0x5b, 0x31, 0xd2, 0x92, 0x9f, 0xd9, 0x39, 0x26, 0xb7, 0x04, 0x8c, - 0x7d, 0xbe, 0x76, 0xca, 0xe8, 0xf7, 0x1a, 0xa8, 0xab, 0xc2, 0x19, 0x9a, 0x72, 0x42, 0x15, 0xab, - 0xfb, 0x30, 0xe0, 0x40, 0x68, 0xdc, 0xaa, 0xf0, 0xea, 0xa4, 0xf6, 0x60, 0x9d, 0x6b, 0x43, 0x17, - 0x0d, 0xbb, 0x43, 0xfc, 0x8b, 0x33, 0x67, 0x9a, 0xb0, 0xf0, 0x54, 0xb2, 0xd4, 0xe9, 0x67, 0xe0, - 0xcc, 0x59, 0xd6, 0x29, 0x6a, 0x0c, 0xbb, 0x84, 0xa6, 0xd4, 0x33, 0xf2, 0x4e, 0x07, 0xeb, 0x90, - 0x83, 0x71, 0xad, 0xd4, 0xe9, 0x67, 0x3b, 0xd1, 0xfa, 0x40, 0xde, 0x1d, 0x5f, 0x18, 0xea, 0x15, - 0xec, 0x09, 0xcf, 0xf8, 0x7d, 0x81, 0x4d, 0x81, 0xba, 0x59, 0xb8, 0x1c, 0x29, 0x59, 0xef, 0x06, - 0x8d, 0xde, 0x74, 0x65, 0x7d, 0x11, 0x47, 0x1d, 0xc2, 0x23, 0x49, 0x98, 0x59, 0x40, 0xfa, 0x2f, - 0x37, 0x90, 0xdc, 0x83, 0x48, 0x4c, 0x22, 0x70, 0x2d, 0xfc, 0x02, 0xa4, 0x83, 0x0e, 0x64, 0x9d, - 0xae, 0x3d, 0xd9, 0x1f, 0xbe, 0x49, 0x6e, 0xef, 0xf7, 0x0e, 0x36, 0xb2, 0xed, 0x68, 0x1c, 0x93, - 0x75, 0x1f, 0x3b, 0x39, 0xce, 0x2a, 0xec, 0xdc, 0x04, 0xe4, 0x90, 0x6c, 0x08, 0x05, 0x51, 0xfa, - 0x2c, 0xca, 0xe8, 0x27, 0xec, 0x5e, 0x5d, 0xe8, 0x09, 0xd9, 0x80, 0x37, 0xde, 0xe8, 0x53, 0xb8, - 0xdb, 0x1a, 0x0a, 0x36, 0x58, 0xdf, 0xc8, 0x32, 0xbb, 0x9b, 0xbd, 0x73, 0x29, 0xc6, 0x35, 0x3e, - 0x83, 0xed, 0xeb, 0x23, 0x75, 0x3b, 0x1f, 0xf2, 0x3f, 0x93, 0xbc, 0x3b, 0xfc, 0xf6, 0xb6, 0xb2, - 0xa1, 0x5e, 0xe4, 0xe3, 0xc2, 0xbb, 0x34, 0x37, 0xa1, 0xa8, 0x0b, 0x4f, 0x6d, 0xda, 0xce, 0xc5, - 0x7f, 0xc9, 0x45, 0x8d, 0xce, 0x70, 0x9a, 0x2f, 0xec, 0xbc, 0x4c, 0x2b, 0x9f, 0x76, 0x8f, 0x37, - 0x8d, 0x8f, 0x37, 0x1f, 0xc8, 0xe1, 0xcd, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6e, 0x7e, 0x51, - 0x21, 0xed, 0x02, 0x00, 0x00, +var File_ps_args_aws_kinesis_proto protoreflect.FileDescriptor + +var file_ps_args_aws_kinesis_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x77, 0x73, 0x5f, 0x6b, 0x69, + 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x22, 0xae, 0x01, 0x0a, 0x0e, 0x41, 0x57, 0x53, + 0x4b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x61, + 0x77, 0x73, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x61, 0x77, 0x73, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x11, 0x61, 0x77, + 0x73, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x77, 0x73, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x4b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x31, 0x0a, 0x15, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x65, 0x63, + 0x72, 0x65, 0x74, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x61, 0x77, 0x73, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x41, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x77, 0x73, 0x5f, + 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, + 0x77, 0x73, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x22, 0xcf, 0x02, 0x0a, 0x12, 0x41, 0x57, + 0x53, 0x4b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, + 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x68, 0x61, 0x72, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x68, 0x61, 0x72, 0x64, 0x12, 0x1f, + 0x0a, 0x0b, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6d, 0x61, 0x78, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x12, + 0x2e, 0x0a, 0x13, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x72, 0x65, + 0x61, 0x64, 0x46, 0x72, 0x6f, 0x6d, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, + 0x30, 0x0a, 0x14, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, + 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x72, + 0x65, 0x61, 0x64, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x12, 0x3b, 0x0a, 0x1a, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x61, 0x66, 0x74, 0x65, 0x72, 0x5f, + 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x17, 0x72, 0x65, 0x61, 0x64, 0x41, 0x66, 0x74, 0x65, 0x72, + 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x2a, + 0x0a, 0x11, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x74, 0x72, 0x69, 0x6d, 0x5f, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x72, 0x65, 0x61, 0x64, 0x54, + 0x72, 0x69, 0x6d, 0x48, 0x6f, 0x72, 0x69, 0x7a, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, + 0x61, 0x64, 0x5f, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x0a, 0x72, 0x65, 0x61, 0x64, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x22, 0x7b, 0x0a, 0x13, 0x41, + 0x57, 0x53, 0x4b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, + 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x61, + 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, + 0x27, 0x0a, 0x0f, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, + 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, + 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, + 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2f, 0x61, 0x72, 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ps_args_aws_kinesis_proto_rawDescOnce sync.Once + file_ps_args_aws_kinesis_proto_rawDescData = file_ps_args_aws_kinesis_proto_rawDesc +) + +func file_ps_args_aws_kinesis_proto_rawDescGZIP() []byte { + file_ps_args_aws_kinesis_proto_rawDescOnce.Do(func() { + file_ps_args_aws_kinesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_args_aws_kinesis_proto_rawDescData) + }) + return file_ps_args_aws_kinesis_proto_rawDescData +} + +var file_ps_args_aws_kinesis_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_ps_args_aws_kinesis_proto_goTypes = []interface{}{ + (*AWSKinesisConn)(nil), // 0: protos.args.AWSKinesisConn + (*AWSKinesisReadArgs)(nil), // 1: protos.args.AWSKinesisReadArgs + (*AWSKinesisWriteArgs)(nil), // 2: protos.args.AWSKinesisWriteArgs +} +var file_ps_args_aws_kinesis_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_ps_args_aws_kinesis_proto_init() } +func file_ps_args_aws_kinesis_proto_init() { + if File_ps_args_aws_kinesis_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_args_aws_kinesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AWSKinesisConn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_aws_kinesis_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AWSKinesisReadArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_aws_kinesis_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AWSKinesisWriteArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_args_aws_kinesis_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_args_aws_kinesis_proto_goTypes, + DependencyIndexes: file_ps_args_aws_kinesis_proto_depIdxs, + MessageInfos: file_ps_args_aws_kinesis_proto_msgTypes, + }.Build() + File_ps_args_aws_kinesis_proto = out.File + file_ps_args_aws_kinesis_proto_rawDesc = nil + file_ps_args_aws_kinesis_proto_goTypes = nil + file_ps_args_aws_kinesis_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_aws_sns.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_aws_sns.pb.go index 2c88af2ae..1cd823561 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_aws_sns.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_aws_sns.pb.go @@ -1,26 +1,30 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_args_aws_sns.proto package args import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type AWSSNSConn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"env=AWS_DEFAULT_REGION,hidden" AwsRegion string `protobuf:"bytes,1,opt,name=aws_region,json=awsRegion,proto3" json:"aws_region,omitempty" kong:"env=AWS_DEFAULT_REGION,hidden"` // @gotags: kong:"env=AWS_ACCESS_KEY_ID,hidden" @@ -28,128 +32,214 @@ type AWSSNSConn struct { // @gotags: kong:"env=AWS_SECRET_ACCESS_KEY,hidden" AwsSecretAccessKey string `protobuf:"bytes,3,opt,name=aws_secret_access_key,json=awsSecretAccessKey,proto3" json:"aws_secret_access_key,omitempty" kong:"env=AWS_SECRET_ACCESS_KEY,hidden"` // @gotags: kong:"env=AWS_PROFILE,hidden" - AwsProfile string `protobuf:"bytes,4,opt,name=aws_profile,json=awsProfile,proto3" json:"aws_profile,omitempty" kong:"env=AWS_PROFILE,hidden"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + AwsProfile string `protobuf:"bytes,4,opt,name=aws_profile,json=awsProfile,proto3" json:"aws_profile,omitempty" kong:"env=AWS_PROFILE,hidden"` } -func (m *AWSSNSConn) Reset() { *m = AWSSNSConn{} } -func (m *AWSSNSConn) String() string { return proto.CompactTextString(m) } -func (*AWSSNSConn) ProtoMessage() {} -func (*AWSSNSConn) Descriptor() ([]byte, []int) { - return fileDescriptor_8796da66147c217f, []int{0} +func (x *AWSSNSConn) Reset() { + *x = AWSSNSConn{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_aws_sns_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AWSSNSConn) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AWSSNSConn.Unmarshal(m, b) +func (x *AWSSNSConn) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AWSSNSConn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AWSSNSConn.Marshal(b, m, deterministic) -} -func (m *AWSSNSConn) XXX_Merge(src proto.Message) { - xxx_messageInfo_AWSSNSConn.Merge(m, src) -} -func (m *AWSSNSConn) XXX_Size() int { - return xxx_messageInfo_AWSSNSConn.Size(m) -} -func (m *AWSSNSConn) XXX_DiscardUnknown() { - xxx_messageInfo_AWSSNSConn.DiscardUnknown(m) + +func (*AWSSNSConn) ProtoMessage() {} + +func (x *AWSSNSConn) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_aws_sns_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AWSSNSConn proto.InternalMessageInfo +// Deprecated: Use AWSSNSConn.ProtoReflect.Descriptor instead. +func (*AWSSNSConn) Descriptor() ([]byte, []int) { + return file_ps_args_aws_sns_proto_rawDescGZIP(), []int{0} +} -func (m *AWSSNSConn) GetAwsRegion() string { - if m != nil { - return m.AwsRegion +func (x *AWSSNSConn) GetAwsRegion() string { + if x != nil { + return x.AwsRegion } return "" } -func (m *AWSSNSConn) GetAwsAccessKeyId() string { - if m != nil { - return m.AwsAccessKeyId +func (x *AWSSNSConn) GetAwsAccessKeyId() string { + if x != nil { + return x.AwsAccessKeyId } return "" } -func (m *AWSSNSConn) GetAwsSecretAccessKey() string { - if m != nil { - return m.AwsSecretAccessKey +func (x *AWSSNSConn) GetAwsSecretAccessKey() string { + if x != nil { + return x.AwsSecretAccessKey } return "" } -func (m *AWSSNSConn) GetAwsProfile() string { - if m != nil { - return m.AwsProfile +func (x *AWSSNSConn) GetAwsProfile() string { + if x != nil { + return x.AwsProfile } return "" } type AWSSNSWriteArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Topic ARN',required" - Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty" kong:"help='Topic ARN',required"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty" kong:"help='Topic ARN',required"` } -func (m *AWSSNSWriteArgs) Reset() { *m = AWSSNSWriteArgs{} } -func (m *AWSSNSWriteArgs) String() string { return proto.CompactTextString(m) } -func (*AWSSNSWriteArgs) ProtoMessage() {} -func (*AWSSNSWriteArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_8796da66147c217f, []int{1} +func (x *AWSSNSWriteArgs) Reset() { + *x = AWSSNSWriteArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_aws_sns_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AWSSNSWriteArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AWSSNSWriteArgs.Unmarshal(m, b) -} -func (m *AWSSNSWriteArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AWSSNSWriteArgs.Marshal(b, m, deterministic) +func (x *AWSSNSWriteArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AWSSNSWriteArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_AWSSNSWriteArgs.Merge(m, src) -} -func (m *AWSSNSWriteArgs) XXX_Size() int { - return xxx_messageInfo_AWSSNSWriteArgs.Size(m) -} -func (m *AWSSNSWriteArgs) XXX_DiscardUnknown() { - xxx_messageInfo_AWSSNSWriteArgs.DiscardUnknown(m) + +func (*AWSSNSWriteArgs) ProtoMessage() {} + +func (x *AWSSNSWriteArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_aws_sns_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AWSSNSWriteArgs proto.InternalMessageInfo +// Deprecated: Use AWSSNSWriteArgs.ProtoReflect.Descriptor instead. +func (*AWSSNSWriteArgs) Descriptor() ([]byte, []int) { + return file_ps_args_aws_sns_proto_rawDescGZIP(), []int{1} +} -func (m *AWSSNSWriteArgs) GetTopic() string { - if m != nil { - return m.Topic +func (x *AWSSNSWriteArgs) GetTopic() string { + if x != nil { + return x.Topic } return "" } -func init() { - proto.RegisterType((*AWSSNSConn)(nil), "protos.args.AWSSNSConn") - proto.RegisterType((*AWSSNSWriteArgs)(nil), "protos.args.AWSSNSWriteArgs") -} - -func init() { proto.RegisterFile("ps_args_aws_sns.proto", fileDescriptor_8796da66147c217f) } - -var fileDescriptor_8796da66147c217f = []byte{ - // 255 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0x4f, 0x4b, 0xc4, 0x30, - 0x14, 0xc4, 0xa9, 0xff, 0x60, 0xdf, 0x82, 0x62, 0x70, 0xa1, 0x17, 0x51, 0xf6, 0xa2, 0x1e, 0x6c, - 0x10, 0x4f, 0xe2, 0xa9, 0x7a, 0x12, 0x41, 0x64, 0x7b, 0x58, 0xf0, 0x52, 0x92, 0xf4, 0x99, 0x06, - 0xdb, 0x26, 0xe4, 0xa5, 0x94, 0xfd, 0x4a, 0x7e, 0x4a, 0x49, 0x2a, 0xe2, 0x29, 0xbc, 0x99, 0xdf, - 0x90, 0x61, 0x60, 0xe5, 0xa8, 0x16, 0x5e, 0x53, 0x2d, 0x26, 0xaa, 0x69, 0xa0, 0xc2, 0x79, 0x1b, - 0x2c, 0x5b, 0xa6, 0x87, 0x8a, 0x68, 0xad, 0xbf, 0x33, 0x80, 0x72, 0x5b, 0x55, 0x6f, 0xd5, 0xb3, - 0x1d, 0x06, 0x76, 0x0e, 0x10, 0x61, 0x8f, 0xda, 0xd8, 0x21, 0xcf, 0x2e, 0xb3, 0xeb, 0xc5, 0x66, - 0x21, 0x26, 0xda, 0x24, 0x81, 0xdd, 0xc0, 0x69, 0xb4, 0x85, 0x52, 0x48, 0x54, 0x7f, 0xe1, 0xae, - 0x36, 0x4d, 0xbe, 0x97, 0xa8, 0x63, 0x31, 0x51, 0x99, 0xf4, 0x57, 0xdc, 0xbd, 0x34, 0xec, 0x0e, - 0x56, 0xe9, 0x5b, 0x54, 0x1e, 0xc3, 0xbf, 0x44, 0xbe, 0x9f, 0x70, 0x26, 0x26, 0xaa, 0x92, 0xf7, - 0x17, 0x62, 0x17, 0xb0, 0x8c, 0x11, 0xe7, 0xed, 0xa7, 0xe9, 0x30, 0x3f, 0x48, 0x60, 0xec, 0xf3, - 0x3e, 0x2b, 0xeb, 0x2b, 0x38, 0x99, 0xbb, 0x6e, 0xbd, 0x09, 0x58, 0x7a, 0x4d, 0xec, 0x0c, 0x0e, - 0x83, 0x75, 0x46, 0xfd, 0x76, 0x9d, 0x8f, 0xa7, 0xc7, 0x8f, 0x07, 0x6d, 0x42, 0x3b, 0xca, 0x42, - 0xd9, 0x9e, 0x4b, 0x11, 0x54, 0xab, 0xac, 0x77, 0xdc, 0x75, 0x63, 0x2f, 0xd1, 0xdf, 0x92, 0x6a, - 0xb1, 0x17, 0xc4, 0xe5, 0x68, 0xba, 0x86, 0x6b, 0xcb, 0xe7, 0x49, 0x78, 0x9c, 0x44, 0x1e, 0xa5, - 0xe3, 0xfe, 0x27, 0x00, 0x00, 0xff, 0xff, 0xf8, 0x3b, 0xd5, 0x62, 0x3f, 0x01, 0x00, 0x00, +var File_ps_args_aws_sns_proto protoreflect.FileDescriptor + +var file_ps_args_aws_sns_proto_rawDesc = []byte{ + 0x0a, 0x15, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x6e, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x22, 0xaa, 0x01, 0x0a, 0x0a, 0x41, 0x57, 0x53, 0x53, 0x4e, 0x53, 0x43, + 0x6f, 0x6e, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x77, 0x73, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x6f, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x77, 0x73, 0x52, 0x65, 0x67, 0x69, + 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x11, 0x61, 0x77, 0x73, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, + 0x77, 0x73, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x31, 0x0a, + 0x15, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x61, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x61, 0x77, + 0x73, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, + 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x77, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x77, 0x73, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, + 0x65, 0x22, 0x27, 0x0a, 0x0f, 0x41, 0x57, 0x53, 0x53, 0x4e, 0x53, 0x57, 0x72, 0x69, 0x74, 0x65, + 0x41, 0x72, 0x67, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, + 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2f, 0x61, 0x72, 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ps_args_aws_sns_proto_rawDescOnce sync.Once + file_ps_args_aws_sns_proto_rawDescData = file_ps_args_aws_sns_proto_rawDesc +) + +func file_ps_args_aws_sns_proto_rawDescGZIP() []byte { + file_ps_args_aws_sns_proto_rawDescOnce.Do(func() { + file_ps_args_aws_sns_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_args_aws_sns_proto_rawDescData) + }) + return file_ps_args_aws_sns_proto_rawDescData +} + +var file_ps_args_aws_sns_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_ps_args_aws_sns_proto_goTypes = []interface{}{ + (*AWSSNSConn)(nil), // 0: protos.args.AWSSNSConn + (*AWSSNSWriteArgs)(nil), // 1: protos.args.AWSSNSWriteArgs +} +var file_ps_args_aws_sns_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_ps_args_aws_sns_proto_init() } +func file_ps_args_aws_sns_proto_init() { + if File_ps_args_aws_sns_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_args_aws_sns_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AWSSNSConn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_aws_sns_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AWSSNSWriteArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_args_aws_sns_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_args_aws_sns_proto_goTypes, + DependencyIndexes: file_ps_args_aws_sns_proto_depIdxs, + MessageInfos: file_ps_args_aws_sns_proto_msgTypes, + }.Build() + File_ps_args_aws_sns_proto = out.File + file_ps_args_aws_sns_proto_rawDesc = nil + file_ps_args_aws_sns_proto_goTypes = nil + file_ps_args_aws_sns_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_aws_sqs.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_aws_sqs.pb.go index e11d49f7f..291bd6d12 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_aws_sqs.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_aws_sqs.pb.go @@ -1,26 +1,30 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_args_aws_sqs.proto package args import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type AWSSQSConn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"env=AWS_DEFAULT_REGION,hidden" AwsRegion string `protobuf:"bytes,1,opt,name=aws_region,json=awsRegion,proto3" json:"aws_region,omitempty" kong:"env=AWS_DEFAULT_REGION,hidden"` // @gotags: kong:"env=AWS_ACCESS_KEY_ID,hidden" @@ -28,66 +32,74 @@ type AWSSQSConn struct { // @gotags: kong:"env=AWS_SECRET_ACCESS_KEY,hidden" AwsSecretAccessKey string `protobuf:"bytes,3,opt,name=aws_secret_access_key,json=awsSecretAccessKey,proto3" json:"aws_secret_access_key,omitempty" kong:"env=AWS_SECRET_ACCESS_KEY,hidden"` // @gotags: kong:"env=AWS_PROFILE,hidden" - AwsProfile string `protobuf:"bytes,4,opt,name=aws_profile,json=awsProfile,proto3" json:"aws_profile,omitempty" kong:"env=AWS_PROFILE,hidden"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + AwsProfile string `protobuf:"bytes,4,opt,name=aws_profile,json=awsProfile,proto3" json:"aws_profile,omitempty" kong:"env=AWS_PROFILE,hidden"` } -func (m *AWSSQSConn) Reset() { *m = AWSSQSConn{} } -func (m *AWSSQSConn) String() string { return proto.CompactTextString(m) } -func (*AWSSQSConn) ProtoMessage() {} -func (*AWSSQSConn) Descriptor() ([]byte, []int) { - return fileDescriptor_34ab51852233331d, []int{0} +func (x *AWSSQSConn) Reset() { + *x = AWSSQSConn{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_aws_sqs_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AWSSQSConn) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AWSSQSConn.Unmarshal(m, b) -} -func (m *AWSSQSConn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AWSSQSConn.Marshal(b, m, deterministic) -} -func (m *AWSSQSConn) XXX_Merge(src proto.Message) { - xxx_messageInfo_AWSSQSConn.Merge(m, src) +func (x *AWSSQSConn) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AWSSQSConn) XXX_Size() int { - return xxx_messageInfo_AWSSQSConn.Size(m) -} -func (m *AWSSQSConn) XXX_DiscardUnknown() { - xxx_messageInfo_AWSSQSConn.DiscardUnknown(m) + +func (*AWSSQSConn) ProtoMessage() {} + +func (x *AWSSQSConn) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_aws_sqs_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AWSSQSConn proto.InternalMessageInfo +// Deprecated: Use AWSSQSConn.ProtoReflect.Descriptor instead. +func (*AWSSQSConn) Descriptor() ([]byte, []int) { + return file_ps_args_aws_sqs_proto_rawDescGZIP(), []int{0} +} -func (m *AWSSQSConn) GetAwsRegion() string { - if m != nil { - return m.AwsRegion +func (x *AWSSQSConn) GetAwsRegion() string { + if x != nil { + return x.AwsRegion } return "" } -func (m *AWSSQSConn) GetAwsAccessKeyId() string { - if m != nil { - return m.AwsAccessKeyId +func (x *AWSSQSConn) GetAwsAccessKeyId() string { + if x != nil { + return x.AwsAccessKeyId } return "" } -func (m *AWSSQSConn) GetAwsSecretAccessKey() string { - if m != nil { - return m.AwsSecretAccessKey +func (x *AWSSQSConn) GetAwsSecretAccessKey() string { + if x != nil { + return x.AwsSecretAccessKey } return "" } -func (m *AWSSQSConn) GetAwsProfile() string { - if m != nil { - return m.AwsProfile +func (x *AWSSQSConn) GetAwsProfile() string { + if x != nil { + return x.AwsProfile } return "" } type AWSSQSReadArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Queue name'" QueueName string `protobuf:"bytes,1,opt,name=queue_name,json=queueName,proto3" json:"queue_name,omitempty" kong:"help='Queue name'"` // @gotags: kong:"help='Remote AWS account ID',optional" @@ -99,80 +111,88 @@ type AWSSQSReadArgs struct { // @gotags: kong:"help='Auto-delete read/received message(s)'" AutoDelete bool `protobuf:"varint,5,opt,name=auto_delete,json=autoDelete,proto3" json:"auto_delete,omitempty" kong:"help='Auto-delete read/received message(s)'"` // @gotags: kong:"help='Number of seconds to wait for messages (not used when using --continuous)',default=5" - WaitTimeSeconds int64 `protobuf:"varint,6,opt,name=wait_time_seconds,json=waitTimeSeconds,proto3" json:"wait_time_seconds,omitempty" kong:"help='Number of seconds to wait for messages (not used when using --continuous)',default=5"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + WaitTimeSeconds int64 `protobuf:"varint,6,opt,name=wait_time_seconds,json=waitTimeSeconds,proto3" json:"wait_time_seconds,omitempty" kong:"help='Number of seconds to wait for messages (not used when using --continuous)',default=5"` } -func (m *AWSSQSReadArgs) Reset() { *m = AWSSQSReadArgs{} } -func (m *AWSSQSReadArgs) String() string { return proto.CompactTextString(m) } -func (*AWSSQSReadArgs) ProtoMessage() {} -func (*AWSSQSReadArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_34ab51852233331d, []int{1} +func (x *AWSSQSReadArgs) Reset() { + *x = AWSSQSReadArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_aws_sqs_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AWSSQSReadArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AWSSQSReadArgs.Unmarshal(m, b) -} -func (m *AWSSQSReadArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AWSSQSReadArgs.Marshal(b, m, deterministic) -} -func (m *AWSSQSReadArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_AWSSQSReadArgs.Merge(m, src) -} -func (m *AWSSQSReadArgs) XXX_Size() int { - return xxx_messageInfo_AWSSQSReadArgs.Size(m) +func (x *AWSSQSReadArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AWSSQSReadArgs) XXX_DiscardUnknown() { - xxx_messageInfo_AWSSQSReadArgs.DiscardUnknown(m) + +func (*AWSSQSReadArgs) ProtoMessage() {} + +func (x *AWSSQSReadArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_aws_sqs_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AWSSQSReadArgs proto.InternalMessageInfo +// Deprecated: Use AWSSQSReadArgs.ProtoReflect.Descriptor instead. +func (*AWSSQSReadArgs) Descriptor() ([]byte, []int) { + return file_ps_args_aws_sqs_proto_rawDescGZIP(), []int{1} +} -func (m *AWSSQSReadArgs) GetQueueName() string { - if m != nil { - return m.QueueName +func (x *AWSSQSReadArgs) GetQueueName() string { + if x != nil { + return x.QueueName } return "" } -func (m *AWSSQSReadArgs) GetRemoteAccountId() string { - if m != nil { - return m.RemoteAccountId +func (x *AWSSQSReadArgs) GetRemoteAccountId() string { + if x != nil { + return x.RemoteAccountId } return "" } -func (m *AWSSQSReadArgs) GetMaxNumMessages() int64 { - if m != nil { - return m.MaxNumMessages +func (x *AWSSQSReadArgs) GetMaxNumMessages() int64 { + if x != nil { + return x.MaxNumMessages } return 0 } -func (m *AWSSQSReadArgs) GetReceiveRequestAttemptId() string { - if m != nil { - return m.ReceiveRequestAttemptId +func (x *AWSSQSReadArgs) GetReceiveRequestAttemptId() string { + if x != nil { + return x.ReceiveRequestAttemptId } return "" } -func (m *AWSSQSReadArgs) GetAutoDelete() bool { - if m != nil { - return m.AutoDelete +func (x *AWSSQSReadArgs) GetAutoDelete() bool { + if x != nil { + return x.AutoDelete } return false } -func (m *AWSSQSReadArgs) GetWaitTimeSeconds() int64 { - if m != nil { - return m.WaitTimeSeconds +func (x *AWSSQSReadArgs) GetWaitTimeSeconds() int64 { + if x != nil { + return x.WaitTimeSeconds } return 0 } type AWSSQSWriteArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Queue name'" QueueName string `protobuf:"bytes,1,opt,name=queue_name,json=queueName,proto3" json:"queue_name,omitempty" kong:"help='Queue name'"` // @gotags: kong:"help='Remote AWS account ID',optional" @@ -184,81 +204,89 @@ type AWSSQSWriteArgs struct { // @gotags: kong:"help='Message Group ID. For FIFO queues only'" MessageGroupId string `protobuf:"bytes,5,opt,name=message_group_id,json=messageGroupId,proto3" json:"message_group_id,omitempty" kong:"help='Message Group ID. For FIFO queues only'"` // @gotags: kong:"help='Required when publishing to a FIFO queue that does not have content based deduplication enabled'" - MessageDeduplicationId string `protobuf:"bytes,6,opt,name=message_deduplication_id,json=messageDeduplicationId,proto3" json:"message_deduplication_id,omitempty" kong:"help='Required when publishing to a FIFO queue that does not have content based deduplication enabled'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + MessageDeduplicationId string `protobuf:"bytes,6,opt,name=message_deduplication_id,json=messageDeduplicationId,proto3" json:"message_deduplication_id,omitempty" kong:"help='Required when publishing to a FIFO queue that does not have content based deduplication enabled'"` } -func (m *AWSSQSWriteArgs) Reset() { *m = AWSSQSWriteArgs{} } -func (m *AWSSQSWriteArgs) String() string { return proto.CompactTextString(m) } -func (*AWSSQSWriteArgs) ProtoMessage() {} -func (*AWSSQSWriteArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_34ab51852233331d, []int{2} +func (x *AWSSQSWriteArgs) Reset() { + *x = AWSSQSWriteArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_aws_sqs_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AWSSQSWriteArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AWSSQSWriteArgs.Unmarshal(m, b) -} -func (m *AWSSQSWriteArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AWSSQSWriteArgs.Marshal(b, m, deterministic) -} -func (m *AWSSQSWriteArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_AWSSQSWriteArgs.Merge(m, src) +func (x *AWSSQSWriteArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AWSSQSWriteArgs) XXX_Size() int { - return xxx_messageInfo_AWSSQSWriteArgs.Size(m) -} -func (m *AWSSQSWriteArgs) XXX_DiscardUnknown() { - xxx_messageInfo_AWSSQSWriteArgs.DiscardUnknown(m) + +func (*AWSSQSWriteArgs) ProtoMessage() {} + +func (x *AWSSQSWriteArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_aws_sqs_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AWSSQSWriteArgs proto.InternalMessageInfo +// Deprecated: Use AWSSQSWriteArgs.ProtoReflect.Descriptor instead. +func (*AWSSQSWriteArgs) Descriptor() ([]byte, []int) { + return file_ps_args_aws_sqs_proto_rawDescGZIP(), []int{2} +} -func (m *AWSSQSWriteArgs) GetQueueName() string { - if m != nil { - return m.QueueName +func (x *AWSSQSWriteArgs) GetQueueName() string { + if x != nil { + return x.QueueName } return "" } -func (m *AWSSQSWriteArgs) GetRemoteAccountId() string { - if m != nil { - return m.RemoteAccountId +func (x *AWSSQSWriteArgs) GetRemoteAccountId() string { + if x != nil { + return x.RemoteAccountId } return "" } -func (m *AWSSQSWriteArgs) GetDelaySeconds() int64 { - if m != nil { - return m.DelaySeconds +func (x *AWSSQSWriteArgs) GetDelaySeconds() int64 { + if x != nil { + return x.DelaySeconds } return 0 } -func (m *AWSSQSWriteArgs) GetAttributes() map[string]string { - if m != nil { - return m.Attributes +func (x *AWSSQSWriteArgs) GetAttributes() map[string]string { + if x != nil { + return x.Attributes } return nil } -func (m *AWSSQSWriteArgs) GetMessageGroupId() string { - if m != nil { - return m.MessageGroupId +func (x *AWSSQSWriteArgs) GetMessageGroupId() string { + if x != nil { + return x.MessageGroupId } return "" } -func (m *AWSSQSWriteArgs) GetMessageDeduplicationId() string { - if m != nil { - return m.MessageDeduplicationId +func (x *AWSSQSWriteArgs) GetMessageDeduplicationId() string { + if x != nil { + return x.MessageDeduplicationId } return "" } // SQS has a dedicated RelayArgs struct as relay has different defaults than read type AWSSQSRelayArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Queue name',env=PLUMBER_RELAY_SQS_QUEUE_NAME" QueueName string `protobuf:"bytes,1,opt,name=queue_name,json=queueName,proto3" json:"queue_name,omitempty" kong:"help='Queue name',env=PLUMBER_RELAY_SQS_QUEUE_NAME"` // @gotags: kong:"help='Remote AWS account ID',env=PLUMBER_RELAY_SQS_REMOTE_ACCOUNT_ID,optional" @@ -270,123 +298,263 @@ type AWSSQSRelayArgs struct { // @gotags: kong:"help='Auto-delete read/received message(s)',env=PLUMBER_RELAY_SQS_AUTO_DELETE" AutoDelete bool `protobuf:"varint,5,opt,name=auto_delete,json=autoDelete,proto3" json:"auto_delete,omitempty" kong:"help='Auto-delete read/received message(s)',env=PLUMBER_RELAY_SQS_AUTO_DELETE"` // @gotags: kong:"help='Number of seconds to wait for messages (not used when using --continuous)',env=PLUMBER_RELAY_SQS_WAIT_TIME_SECONDS,default=5" - WaitTimeSeconds int64 `protobuf:"varint,6,opt,name=wait_time_seconds,json=waitTimeSeconds,proto3" json:"wait_time_seconds,omitempty" kong:"help='Number of seconds to wait for messages (not used when using --continuous)',env=PLUMBER_RELAY_SQS_WAIT_TIME_SECONDS,default=5"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + WaitTimeSeconds int64 `protobuf:"varint,6,opt,name=wait_time_seconds,json=waitTimeSeconds,proto3" json:"wait_time_seconds,omitempty" kong:"help='Number of seconds to wait for messages (not used when using --continuous)',env=PLUMBER_RELAY_SQS_WAIT_TIME_SECONDS,default=5"` } -func (m *AWSSQSRelayArgs) Reset() { *m = AWSSQSRelayArgs{} } -func (m *AWSSQSRelayArgs) String() string { return proto.CompactTextString(m) } -func (*AWSSQSRelayArgs) ProtoMessage() {} -func (*AWSSQSRelayArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_34ab51852233331d, []int{3} +func (x *AWSSQSRelayArgs) Reset() { + *x = AWSSQSRelayArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_aws_sqs_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AWSSQSRelayArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AWSSQSRelayArgs.Unmarshal(m, b) +func (x *AWSSQSRelayArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AWSSQSRelayArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AWSSQSRelayArgs.Marshal(b, m, deterministic) -} -func (m *AWSSQSRelayArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_AWSSQSRelayArgs.Merge(m, src) -} -func (m *AWSSQSRelayArgs) XXX_Size() int { - return xxx_messageInfo_AWSSQSRelayArgs.Size(m) -} -func (m *AWSSQSRelayArgs) XXX_DiscardUnknown() { - xxx_messageInfo_AWSSQSRelayArgs.DiscardUnknown(m) + +func (*AWSSQSRelayArgs) ProtoMessage() {} + +func (x *AWSSQSRelayArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_aws_sqs_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AWSSQSRelayArgs proto.InternalMessageInfo +// Deprecated: Use AWSSQSRelayArgs.ProtoReflect.Descriptor instead. +func (*AWSSQSRelayArgs) Descriptor() ([]byte, []int) { + return file_ps_args_aws_sqs_proto_rawDescGZIP(), []int{3} +} -func (m *AWSSQSRelayArgs) GetQueueName() string { - if m != nil { - return m.QueueName +func (x *AWSSQSRelayArgs) GetQueueName() string { + if x != nil { + return x.QueueName } return "" } -func (m *AWSSQSRelayArgs) GetRemoteAccountId() string { - if m != nil { - return m.RemoteAccountId +func (x *AWSSQSRelayArgs) GetRemoteAccountId() string { + if x != nil { + return x.RemoteAccountId } return "" } -func (m *AWSSQSRelayArgs) GetMaxNumMessages() int64 { - if m != nil { - return m.MaxNumMessages +func (x *AWSSQSRelayArgs) GetMaxNumMessages() int64 { + if x != nil { + return x.MaxNumMessages } return 0 } -func (m *AWSSQSRelayArgs) GetReceiveRequestAttemptId() string { - if m != nil { - return m.ReceiveRequestAttemptId +func (x *AWSSQSRelayArgs) GetReceiveRequestAttemptId() string { + if x != nil { + return x.ReceiveRequestAttemptId } return "" } -func (m *AWSSQSRelayArgs) GetAutoDelete() bool { - if m != nil { - return m.AutoDelete +func (x *AWSSQSRelayArgs) GetAutoDelete() bool { + if x != nil { + return x.AutoDelete } return false } -func (m *AWSSQSRelayArgs) GetWaitTimeSeconds() int64 { - if m != nil { - return m.WaitTimeSeconds +func (x *AWSSQSRelayArgs) GetWaitTimeSeconds() int64 { + if x != nil { + return x.WaitTimeSeconds } return 0 } -func init() { - proto.RegisterType((*AWSSQSConn)(nil), "protos.args.AWSSQSConn") - proto.RegisterType((*AWSSQSReadArgs)(nil), "protos.args.AWSSQSReadArgs") - proto.RegisterType((*AWSSQSWriteArgs)(nil), "protos.args.AWSSQSWriteArgs") - proto.RegisterMapType((map[string]string)(nil), "protos.args.AWSSQSWriteArgs.AttributesEntry") - proto.RegisterType((*AWSSQSRelayArgs)(nil), "protos.args.AWSSQSRelayArgs") -} - -func init() { proto.RegisterFile("ps_args_aws_sqs.proto", fileDescriptor_34ab51852233331d) } - -var fileDescriptor_34ab51852233331d = []byte{ - // 539 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x92, 0xdf, 0x6e, 0xd3, 0x30, - 0x18, 0xc5, 0xd5, 0x76, 0xab, 0x98, 0x0b, 0xed, 0x66, 0x31, 0x88, 0x26, 0x21, 0xaa, 0x72, 0x53, - 0x10, 0x24, 0x02, 0x6e, 0x06, 0x13, 0x17, 0x81, 0x21, 0x54, 0x01, 0x13, 0xa4, 0x48, 0x93, 0xb8, - 0xb1, 0x9c, 0xf8, 0x23, 0xb5, 0x88, 0xe3, 0xd4, 0x7f, 0xd6, 0xf5, 0x29, 0xe0, 0x39, 0x78, 0x3c, - 0x9e, 0x00, 0xd9, 0xce, 0x4a, 0xb5, 0x6b, 0x2e, 0xb9, 0x4a, 0x7c, 0xce, 0xf9, 0x92, 0x5f, 0x4e, - 0x3e, 0x74, 0xd8, 0x68, 0x42, 0x55, 0xa9, 0x09, 0x5d, 0x69, 0xa2, 0x97, 0x3a, 0x6e, 0x94, 0x34, - 0x12, 0x0f, 0xfc, 0x45, 0xc7, 0xce, 0x9a, 0xfc, 0xea, 0x20, 0x94, 0x9e, 0xcf, 0xe7, 0x9f, 0xe7, - 0x6f, 0x64, 0x5d, 0xe3, 0x7b, 0x08, 0xb9, 0xb0, 0x82, 0x92, 0xcb, 0x3a, 0xea, 0x8c, 0x3b, 0xd3, - 0xbd, 0x6c, 0x8f, 0xae, 0x74, 0xe6, 0x05, 0xfc, 0x10, 0x1d, 0x38, 0x9b, 0x16, 0x05, 0x68, 0x4d, - 0xbe, 0xc3, 0x9a, 0x70, 0x16, 0x75, 0x7d, 0x6a, 0x48, 0x57, 0x3a, 0xf5, 0xfa, 0x7b, 0x58, 0xcf, - 0x18, 0x7e, 0x8a, 0x0e, 0xfd, 0x6b, 0xa1, 0x50, 0x60, 0xb6, 0x26, 0xa2, 0x9e, 0x8f, 0x63, 0xba, - 0xd2, 0x73, 0xef, 0x6d, 0x86, 0xf0, 0x7d, 0x34, 0x70, 0x23, 0x8d, 0x92, 0xdf, 0x78, 0x05, 0xd1, - 0x8e, 0x0f, 0x3a, 0x9e, 0x4f, 0x41, 0x99, 0xfc, 0xe8, 0xa2, 0x61, 0x80, 0xcd, 0x80, 0xb2, 0x54, - 0x95, 0xda, 0x01, 0x2f, 0x2d, 0x58, 0x20, 0x35, 0x15, 0x70, 0x05, 0xec, 0x95, 0x33, 0x2a, 0x00, - 0x3f, 0x42, 0x07, 0x0a, 0x84, 0x34, 0xe0, 0x08, 0xa4, 0xad, 0xcd, 0x5f, 0xe0, 0x51, 0x30, 0xd2, - 0xa0, 0xcf, 0x18, 0x9e, 0xa2, 0x7d, 0x41, 0x2f, 0x49, 0x6d, 0x05, 0x11, 0xa0, 0x35, 0x2d, 0x41, - 0x7b, 0xd8, 0x5e, 0x36, 0x14, 0xf4, 0xf2, 0xcc, 0x8a, 0x8f, 0xad, 0x8a, 0x4f, 0xd0, 0x91, 0x82, - 0x02, 0xf8, 0x05, 0x10, 0x05, 0x4b, 0x0b, 0xda, 0x10, 0x6a, 0x0c, 0x88, 0xc6, 0x3f, 0x3e, 0x70, - 0xdf, 0x6d, 0x13, 0x59, 0x08, 0xa4, 0xc1, 0x9f, 0x31, 0xff, 0x95, 0xd6, 0x48, 0xc2, 0xa0, 0x02, - 0x03, 0xd1, 0xee, 0xb8, 0x33, 0xbd, 0x91, 0x21, 0x27, 0x9d, 0x7a, 0xc5, 0x31, 0xaf, 0x28, 0x37, - 0xc4, 0x70, 0x01, 0xae, 0x3f, 0x59, 0x33, 0x1d, 0xf5, 0x3d, 0xc8, 0xc8, 0x19, 0x5f, 0xb8, 0x80, - 0x79, 0x90, 0x27, 0xbf, 0xbb, 0x68, 0x14, 0x1a, 0x39, 0x57, 0xdc, 0xc0, 0xbf, 0xae, 0xe4, 0x01, - 0xba, 0xc5, 0xa0, 0xa2, 0xeb, 0x0d, 0x46, 0xe8, 0xe3, 0xa6, 0x17, 0x5b, 0x06, 0xfc, 0x01, 0x21, - 0x6a, 0x8c, 0xe2, 0xb9, 0x35, 0xa0, 0xa3, 0x9d, 0x71, 0x6f, 0x3a, 0x78, 0xf6, 0x38, 0xde, 0x5a, - 0xb2, 0xf8, 0x1a, 0x61, 0x9c, 0x6e, 0xe2, 0x6f, 0x6b, 0xa3, 0xd6, 0xd9, 0xd6, 0xbc, 0xff, 0x0b, - 0xa1, 0x67, 0x52, 0x2a, 0x69, 0x1b, 0x47, 0xb7, 0x1b, 0x36, 0xac, 0xd5, 0xdf, 0x39, 0x79, 0xc6, - 0xf0, 0x31, 0x8a, 0xae, 0x92, 0x0c, 0x98, 0x6d, 0x2a, 0x5e, 0x50, 0xc3, 0x65, 0xed, 0x26, 0xfa, - 0x7e, 0xe2, 0x4e, 0xeb, 0x9f, 0x6e, 0xdb, 0x33, 0x76, 0xf4, 0x0a, 0x8d, 0xae, 0x21, 0xe0, 0x7d, - 0xd4, 0x73, 0xcb, 0x19, 0xda, 0x72, 0xb7, 0xf8, 0x36, 0xda, 0xbd, 0xa0, 0x95, 0x85, 0xb6, 0x9b, - 0x70, 0x78, 0xd9, 0x3d, 0xee, 0x4c, 0x7e, 0x6e, 0x4a, 0xcf, 0x5c, 0x0f, 0xff, 0xf7, 0x50, 0xbf, - 0x3e, 0xf9, 0xfa, 0xa2, 0xe4, 0x66, 0x61, 0xf3, 0xb8, 0x90, 0x22, 0xc9, 0xa9, 0x29, 0x16, 0x85, - 0x54, 0x4d, 0xd2, 0x54, 0x56, 0xe4, 0xa0, 0x9e, 0xe8, 0x62, 0x01, 0x82, 0xea, 0x24, 0xb7, 0xbc, - 0x62, 0x49, 0x29, 0x93, 0xb0, 0x1e, 0x89, 0x5b, 0x8f, 0xbc, 0xef, 0x0f, 0xcf, 0xff, 0x04, 0x00, - 0x00, 0xff, 0xff, 0x6c, 0xf4, 0xf3, 0x08, 0xb0, 0x04, 0x00, 0x00, +var File_ps_args_aws_sqs_proto protoreflect.FileDescriptor + +var file_ps_args_aws_sqs_proto_rawDesc = []byte{ + 0x0a, 0x15, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x71, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x22, 0xaa, 0x01, 0x0a, 0x0a, 0x41, 0x57, 0x53, 0x53, 0x51, 0x53, 0x43, + 0x6f, 0x6e, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x77, 0x73, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x6f, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x77, 0x73, 0x52, 0x65, 0x67, 0x69, + 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x11, 0x61, 0x77, 0x73, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, + 0x77, 0x73, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x31, 0x0a, + 0x15, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x61, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x61, 0x77, + 0x73, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, + 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x77, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x77, 0x73, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, + 0x65, 0x22, 0x8f, 0x02, 0x0a, 0x0e, 0x41, 0x57, 0x53, 0x53, 0x51, 0x53, 0x52, 0x65, 0x61, 0x64, + 0x41, 0x72, 0x67, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x71, 0x75, 0x65, 0x75, 0x65, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x71, 0x75, 0x65, 0x75, 0x65, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, + 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x12, + 0x28, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x5f, 0x6e, 0x75, 0x6d, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x4e, 0x75, + 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x3b, 0x0a, 0x1a, 0x72, 0x65, 0x63, + 0x65, 0x69, 0x76, 0x65, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x74, 0x74, + 0x65, 0x6d, 0x70, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x17, 0x72, + 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x41, 0x74, 0x74, + 0x65, 0x6d, 0x70, 0x74, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x75, 0x74, 0x6f, 0x5f, 0x64, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x75, 0x74, + 0x6f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x77, 0x61, 0x69, 0x74, 0x5f, + 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x0f, 0x77, 0x61, 0x69, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x53, 0x65, 0x63, 0x6f, + 0x6e, 0x64, 0x73, 0x22, 0xf2, 0x02, 0x0a, 0x0f, 0x41, 0x57, 0x53, 0x53, 0x51, 0x53, 0x57, 0x72, + 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x71, 0x75, 0x65, 0x75, 0x65, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x71, 0x75, 0x65, + 0x75, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, + 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x73, 0x65, 0x63, 0x6f, + 0x6e, 0x64, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x64, 0x65, 0x6c, 0x61, 0x79, + 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x4c, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x53, 0x51, 0x53, + 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x28, 0x0a, 0x10, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x12, + 0x38, 0x0a, 0x18, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x64, 0x65, 0x64, 0x75, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x16, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x44, 0x65, 0x64, 0x75, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x1a, 0x3d, 0x0a, 0x0f, 0x41, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x90, 0x02, 0x0a, 0x0f, 0x41, 0x57, 0x53, + 0x53, 0x51, 0x53, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x41, 0x72, 0x67, 0x73, 0x12, 0x1d, 0x0a, 0x0a, + 0x71, 0x75, 0x65, 0x75, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x71, 0x75, 0x65, 0x75, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x72, + 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x5f, 0x6e, + 0x75, 0x6d, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x4e, 0x75, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x73, 0x12, 0x3b, 0x0a, 0x1a, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x5f, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x5f, 0x69, 0x64, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x17, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x41, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x49, 0x64, 0x12, 0x1f, + 0x0a, 0x0b, 0x61, 0x75, 0x74, 0x6f, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x75, 0x74, 0x6f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, + 0x2a, 0x0a, 0x11, 0x77, 0x61, 0x69, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x73, 0x65, 0x63, + 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x77, 0x61, 0x69, 0x74, + 0x54, 0x69, 0x6d, 0x65, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x42, 0x3b, 0x5a, 0x39, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, + 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2f, 0x61, 0x72, 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ps_args_aws_sqs_proto_rawDescOnce sync.Once + file_ps_args_aws_sqs_proto_rawDescData = file_ps_args_aws_sqs_proto_rawDesc +) + +func file_ps_args_aws_sqs_proto_rawDescGZIP() []byte { + file_ps_args_aws_sqs_proto_rawDescOnce.Do(func() { + file_ps_args_aws_sqs_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_args_aws_sqs_proto_rawDescData) + }) + return file_ps_args_aws_sqs_proto_rawDescData +} + +var file_ps_args_aws_sqs_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_ps_args_aws_sqs_proto_goTypes = []interface{}{ + (*AWSSQSConn)(nil), // 0: protos.args.AWSSQSConn + (*AWSSQSReadArgs)(nil), // 1: protos.args.AWSSQSReadArgs + (*AWSSQSWriteArgs)(nil), // 2: protos.args.AWSSQSWriteArgs + (*AWSSQSRelayArgs)(nil), // 3: protos.args.AWSSQSRelayArgs + nil, // 4: protos.args.AWSSQSWriteArgs.AttributesEntry +} +var file_ps_args_aws_sqs_proto_depIdxs = []int32{ + 4, // 0: protos.args.AWSSQSWriteArgs.attributes:type_name -> protos.args.AWSSQSWriteArgs.AttributesEntry + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_ps_args_aws_sqs_proto_init() } +func file_ps_args_aws_sqs_proto_init() { + if File_ps_args_aws_sqs_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_args_aws_sqs_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AWSSQSConn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_aws_sqs_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AWSSQSReadArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_aws_sqs_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AWSSQSWriteArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_aws_sqs_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AWSSQSRelayArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_args_aws_sqs_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_args_aws_sqs_proto_goTypes, + DependencyIndexes: file_ps_args_aws_sqs_proto_depIdxs, + MessageInfos: file_ps_args_aws_sqs_proto_msgTypes, + }.Build() + File_ps_args_aws_sqs_proto = out.File + file_ps_args_aws_sqs_proto_rawDesc = nil + file_ps_args_aws_sqs_proto_goTypes = nil + file_ps_args_aws_sqs_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_azure_event_hub.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_azure_event_hub.pb.go index 650fa40f4..e27c27fea 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_azure_event_hub.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_azure_event_hub.pb.go @@ -1,168 +1,277 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_args_azure_event_hub.proto package args import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type AzureEventHubConn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Connection string',env='EVENTHUB_CONNECTION_STRING',required" - ConnectionString string `protobuf:"bytes,1,opt,name=connection_string,json=connectionString,proto3" json:"connection_string,omitempty" kong:"help='Connection string',env='EVENTHUB_CONNECTION_STRING',required"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ConnectionString string `protobuf:"bytes,1,opt,name=connection_string,json=connectionString,proto3" json:"connection_string,omitempty" kong:"help='Connection string',env='EVENTHUB_CONNECTION_STRING',required"` } -func (m *AzureEventHubConn) Reset() { *m = AzureEventHubConn{} } -func (m *AzureEventHubConn) String() string { return proto.CompactTextString(m) } -func (*AzureEventHubConn) ProtoMessage() {} -func (*AzureEventHubConn) Descriptor() ([]byte, []int) { - return fileDescriptor_16b95bd39efe3a29, []int{0} +func (x *AzureEventHubConn) Reset() { + *x = AzureEventHubConn{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_azure_event_hub_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AzureEventHubConn) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AzureEventHubConn.Unmarshal(m, b) -} -func (m *AzureEventHubConn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AzureEventHubConn.Marshal(b, m, deterministic) +func (x *AzureEventHubConn) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AzureEventHubConn) XXX_Merge(src proto.Message) { - xxx_messageInfo_AzureEventHubConn.Merge(m, src) -} -func (m *AzureEventHubConn) XXX_Size() int { - return xxx_messageInfo_AzureEventHubConn.Size(m) -} -func (m *AzureEventHubConn) XXX_DiscardUnknown() { - xxx_messageInfo_AzureEventHubConn.DiscardUnknown(m) + +func (*AzureEventHubConn) ProtoMessage() {} + +func (x *AzureEventHubConn) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_azure_event_hub_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AzureEventHubConn proto.InternalMessageInfo +// Deprecated: Use AzureEventHubConn.ProtoReflect.Descriptor instead. +func (*AzureEventHubConn) Descriptor() ([]byte, []int) { + return file_ps_args_azure_event_hub_proto_rawDescGZIP(), []int{0} +} -func (m *AzureEventHubConn) GetConnectionString() string { - if m != nil { - return m.ConnectionString +func (x *AzureEventHubConn) GetConnectionString() string { + if x != nil { + return x.ConnectionString } return "" } type AzureEventHubReadArgs struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } -func (m *AzureEventHubReadArgs) Reset() { *m = AzureEventHubReadArgs{} } -func (m *AzureEventHubReadArgs) String() string { return proto.CompactTextString(m) } -func (*AzureEventHubReadArgs) ProtoMessage() {} -func (*AzureEventHubReadArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_16b95bd39efe3a29, []int{1} +func (x *AzureEventHubReadArgs) Reset() { + *x = AzureEventHubReadArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_azure_event_hub_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AzureEventHubReadArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AzureEventHubReadArgs.Unmarshal(m, b) -} -func (m *AzureEventHubReadArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AzureEventHubReadArgs.Marshal(b, m, deterministic) -} -func (m *AzureEventHubReadArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_AzureEventHubReadArgs.Merge(m, src) -} -func (m *AzureEventHubReadArgs) XXX_Size() int { - return xxx_messageInfo_AzureEventHubReadArgs.Size(m) +func (x *AzureEventHubReadArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AzureEventHubReadArgs) XXX_DiscardUnknown() { - xxx_messageInfo_AzureEventHubReadArgs.DiscardUnknown(m) + +func (*AzureEventHubReadArgs) ProtoMessage() {} + +func (x *AzureEventHubReadArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_azure_event_hub_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AzureEventHubReadArgs proto.InternalMessageInfo +// Deprecated: Use AzureEventHubReadArgs.ProtoReflect.Descriptor instead. +func (*AzureEventHubReadArgs) Descriptor() ([]byte, []int) { + return file_ps_args_azure_event_hub_proto_rawDescGZIP(), []int{1} +} type AzureEventHubWriteArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Send message with this ID'" MessageId string `protobuf:"bytes,1,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty" kong:"help='Send message with this ID'"` // @gotags: kong:"help='Send message with this partition key'" - PartitionKey string `protobuf:"bytes,2,opt,name=partition_key,json=partitionKey,proto3" json:"partition_key,omitempty" kong:"help='Send message with this partition key'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + PartitionKey string `protobuf:"bytes,2,opt,name=partition_key,json=partitionKey,proto3" json:"partition_key,omitempty" kong:"help='Send message with this partition key'"` } -func (m *AzureEventHubWriteArgs) Reset() { *m = AzureEventHubWriteArgs{} } -func (m *AzureEventHubWriteArgs) String() string { return proto.CompactTextString(m) } -func (*AzureEventHubWriteArgs) ProtoMessage() {} -func (*AzureEventHubWriteArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_16b95bd39efe3a29, []int{2} +func (x *AzureEventHubWriteArgs) Reset() { + *x = AzureEventHubWriteArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_azure_event_hub_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AzureEventHubWriteArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AzureEventHubWriteArgs.Unmarshal(m, b) -} -func (m *AzureEventHubWriteArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AzureEventHubWriteArgs.Marshal(b, m, deterministic) -} -func (m *AzureEventHubWriteArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_AzureEventHubWriteArgs.Merge(m, src) -} -func (m *AzureEventHubWriteArgs) XXX_Size() int { - return xxx_messageInfo_AzureEventHubWriteArgs.Size(m) +func (x *AzureEventHubWriteArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AzureEventHubWriteArgs) XXX_DiscardUnknown() { - xxx_messageInfo_AzureEventHubWriteArgs.DiscardUnknown(m) + +func (*AzureEventHubWriteArgs) ProtoMessage() {} + +func (x *AzureEventHubWriteArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_azure_event_hub_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AzureEventHubWriteArgs proto.InternalMessageInfo +// Deprecated: Use AzureEventHubWriteArgs.ProtoReflect.Descriptor instead. +func (*AzureEventHubWriteArgs) Descriptor() ([]byte, []int) { + return file_ps_args_azure_event_hub_proto_rawDescGZIP(), []int{2} +} -func (m *AzureEventHubWriteArgs) GetMessageId() string { - if m != nil { - return m.MessageId +func (x *AzureEventHubWriteArgs) GetMessageId() string { + if x != nil { + return x.MessageId } return "" } -func (m *AzureEventHubWriteArgs) GetPartitionKey() string { - if m != nil { - return m.PartitionKey +func (x *AzureEventHubWriteArgs) GetPartitionKey() string { + if x != nil { + return x.PartitionKey } return "" } -func init() { - proto.RegisterType((*AzureEventHubConn)(nil), "protos.args.AzureEventHubConn") - proto.RegisterType((*AzureEventHubReadArgs)(nil), "protos.args.AzureEventHubReadArgs") - proto.RegisterType((*AzureEventHubWriteArgs)(nil), "protos.args.AzureEventHubWriteArgs") -} - -func init() { proto.RegisterFile("ps_args_azure_event_hub.proto", fileDescriptor_16b95bd39efe3a29) } - -var fileDescriptor_16b95bd39efe3a29 = []byte{ - // 235 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x8f, 0x41, 0x4b, 0x03, 0x31, - 0x10, 0x85, 0xa9, 0x07, 0xa1, 0x51, 0xc1, 0x2e, 0xa8, 0xbd, 0x14, 0xa4, 0x5e, 0x04, 0xb1, 0x39, - 0x78, 0x12, 0x2f, 0x56, 0x11, 0x14, 0x6f, 0xf5, 0x20, 0x88, 0x10, 0x92, 0xec, 0x90, 0x0d, 0x76, - 0x93, 0x30, 0x33, 0x11, 0xea, 0xaf, 0x97, 0xc4, 0x62, 0xd9, 0x53, 0xc8, 0x7b, 0x1f, 0x6f, 0xf8, - 0xc4, 0x2c, 0x91, 0xd2, 0xe8, 0x48, 0xe9, 0x9f, 0x8c, 0xa0, 0xe0, 0x1b, 0x02, 0xab, 0x2e, 0x9b, - 0x45, 0xc2, 0xc8, 0xb1, 0x39, 0xa8, 0x0f, 0x2d, 0x0a, 0x32, 0xbf, 0x17, 0x93, 0x65, 0xa1, 0x9e, - 0x0a, 0xf4, 0x9c, 0xcd, 0x63, 0x0c, 0xa1, 0xb9, 0x12, 0x13, 0x1b, 0x43, 0x00, 0xcb, 0x3e, 0x06, - 0x45, 0x8c, 0x3e, 0xb8, 0xe9, 0xe8, 0x7c, 0x74, 0x39, 0x5e, 0x1d, 0xef, 0x8a, 0xb7, 0x9a, 0xcf, - 0xcf, 0xc4, 0xc9, 0x60, 0x61, 0x05, 0xba, 0x5d, 0x96, 0xe9, 0x4f, 0x71, 0x3a, 0x28, 0xde, 0xd1, - 0x33, 0x94, 0xa6, 0x99, 0x09, 0xd1, 0x03, 0x91, 0x76, 0xa0, 0x7c, 0xbb, 0x1d, 0x1e, 0x6f, 0x93, - 0x97, 0xb6, 0xb9, 0x10, 0x47, 0x49, 0x23, 0xfb, 0x7a, 0xfd, 0x0b, 0x36, 0xd3, 0xbd, 0x4a, 0x1c, - 0xfe, 0x87, 0xaf, 0xb0, 0x79, 0xb8, 0xfb, 0xb8, 0x75, 0x9e, 0x8b, 0x95, 0x8d, 0xbd, 0x34, 0x9a, - 0x6d, 0x67, 0x23, 0x26, 0x99, 0xd6, 0xb9, 0x37, 0x80, 0xd7, 0x64, 0x3b, 0xe8, 0x35, 0x49, 0x93, - 0xfd, 0xba, 0x95, 0x2e, 0xca, 0x3f, 0x6b, 0x59, 0xac, 0xcd, 0x7e, 0xfd, 0xdc, 0xfc, 0x06, 0x00, - 0x00, 0xff, 0xff, 0x54, 0x1b, 0x42, 0x69, 0x2a, 0x01, 0x00, 0x00, +var File_ps_args_azure_event_hub_proto protoreflect.FileDescriptor + +var file_ps_args_azure_event_hub_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, + 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x22, 0x40, 0x0a, 0x11, + 0x41, 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x75, 0x62, 0x43, 0x6f, 0x6e, + 0x6e, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x17, + 0x0a, 0x15, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x75, 0x62, 0x52, + 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x22, 0x5c, 0x0a, 0x16, 0x41, 0x7a, 0x75, 0x72, 0x65, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x75, 0x62, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, + 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, + 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, + 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, + 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x61, 0x72, + 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ps_args_azure_event_hub_proto_rawDescOnce sync.Once + file_ps_args_azure_event_hub_proto_rawDescData = file_ps_args_azure_event_hub_proto_rawDesc +) + +func file_ps_args_azure_event_hub_proto_rawDescGZIP() []byte { + file_ps_args_azure_event_hub_proto_rawDescOnce.Do(func() { + file_ps_args_azure_event_hub_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_args_azure_event_hub_proto_rawDescData) + }) + return file_ps_args_azure_event_hub_proto_rawDescData +} + +var file_ps_args_azure_event_hub_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_ps_args_azure_event_hub_proto_goTypes = []interface{}{ + (*AzureEventHubConn)(nil), // 0: protos.args.AzureEventHubConn + (*AzureEventHubReadArgs)(nil), // 1: protos.args.AzureEventHubReadArgs + (*AzureEventHubWriteArgs)(nil), // 2: protos.args.AzureEventHubWriteArgs +} +var file_ps_args_azure_event_hub_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_ps_args_azure_event_hub_proto_init() } +func file_ps_args_azure_event_hub_proto_init() { + if File_ps_args_azure_event_hub_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_args_azure_event_hub_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AzureEventHubConn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_azure_event_hub_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AzureEventHubReadArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_azure_event_hub_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AzureEventHubWriteArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_args_azure_event_hub_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_args_azure_event_hub_proto_goTypes, + DependencyIndexes: file_ps_args_azure_event_hub_proto_depIdxs, + MessageInfos: file_ps_args_azure_event_hub_proto_msgTypes, + }.Build() + File_ps_args_azure_event_hub_proto = out.File + file_ps_args_azure_event_hub_proto_rawDesc = nil + file_ps_args_azure_event_hub_proto_goTypes = nil + file_ps_args_azure_event_hub_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_azure_service_bus.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_azure_service_bus.pb.go index 207fd500c..f7a528c34 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_azure_service_bus.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_azure_service_bus.pb.go @@ -1,196 +1,311 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_args_azure_service_bus.proto package args import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type AzureServiceBusConn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // NOTE: This is an azure-defined env var // @gotags: kong:"help='Connection string',env='SERVICEBUS_CONNECTION_STRING',required" - ConnectionString string `protobuf:"bytes,1,opt,name=connection_string,json=connectionString,proto3" json:"connection_string,omitempty" kong:"help='Connection string',env='SERVICEBUS_CONNECTION_STRING',required"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ConnectionString string `protobuf:"bytes,1,opt,name=connection_string,json=connectionString,proto3" json:"connection_string,omitempty" kong:"help='Connection string',env='SERVICEBUS_CONNECTION_STRING',required"` } -func (m *AzureServiceBusConn) Reset() { *m = AzureServiceBusConn{} } -func (m *AzureServiceBusConn) String() string { return proto.CompactTextString(m) } -func (*AzureServiceBusConn) ProtoMessage() {} -func (*AzureServiceBusConn) Descriptor() ([]byte, []int) { - return fileDescriptor_d1b595db94f5f784, []int{0} +func (x *AzureServiceBusConn) Reset() { + *x = AzureServiceBusConn{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_azure_service_bus_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AzureServiceBusConn) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AzureServiceBusConn.Unmarshal(m, b) -} -func (m *AzureServiceBusConn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AzureServiceBusConn.Marshal(b, m, deterministic) +func (x *AzureServiceBusConn) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AzureServiceBusConn) XXX_Merge(src proto.Message) { - xxx_messageInfo_AzureServiceBusConn.Merge(m, src) -} -func (m *AzureServiceBusConn) XXX_Size() int { - return xxx_messageInfo_AzureServiceBusConn.Size(m) -} -func (m *AzureServiceBusConn) XXX_DiscardUnknown() { - xxx_messageInfo_AzureServiceBusConn.DiscardUnknown(m) + +func (*AzureServiceBusConn) ProtoMessage() {} + +func (x *AzureServiceBusConn) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_azure_service_bus_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AzureServiceBusConn proto.InternalMessageInfo +// Deprecated: Use AzureServiceBusConn.ProtoReflect.Descriptor instead. +func (*AzureServiceBusConn) Descriptor() ([]byte, []int) { + return file_ps_args_azure_service_bus_proto_rawDescGZIP(), []int{0} +} -func (m *AzureServiceBusConn) GetConnectionString() string { - if m != nil { - return m.ConnectionString +func (x *AzureServiceBusConn) GetConnectionString() string { + if x != nil { + return x.ConnectionString } return "" } type AzureServiceBusReadArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Queue name',env='PLUMBER_RELAY_AZURE_QUEUE_NAME',xor=asb_read" Queue string `protobuf:"bytes,1,opt,name=queue,proto3" json:"queue,omitempty" kong:"help='Queue name',env='PLUMBER_RELAY_AZURE_QUEUE_NAME',xor=asb_read"` // @gotags: kong:"help='Topic name',env='PLUMBER_RELAY_AZURE_TOPIC_NAME',xor=asb_read" Topic string `protobuf:"bytes,2,opt,name=topic,proto3" json:"topic,omitempty" kong:"help='Topic name',env='PLUMBER_RELAY_AZURE_TOPIC_NAME',xor=asb_read"` // @gotags: kong:"help='Subscription name',env='PLUMBER_RELAY_AZURE_SUBSCRIPTION',required" - SubscriptionName string `protobuf:"bytes,3,opt,name=subscription_name,json=subscriptionName,proto3" json:"subscription_name,omitempty" kong:"help='Subscription name',env='PLUMBER_RELAY_AZURE_SUBSCRIPTION',required"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + SubscriptionName string `protobuf:"bytes,3,opt,name=subscription_name,json=subscriptionName,proto3" json:"subscription_name,omitempty" kong:"help='Subscription name',env='PLUMBER_RELAY_AZURE_SUBSCRIPTION',required"` } -func (m *AzureServiceBusReadArgs) Reset() { *m = AzureServiceBusReadArgs{} } -func (m *AzureServiceBusReadArgs) String() string { return proto.CompactTextString(m) } -func (*AzureServiceBusReadArgs) ProtoMessage() {} -func (*AzureServiceBusReadArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_d1b595db94f5f784, []int{1} +func (x *AzureServiceBusReadArgs) Reset() { + *x = AzureServiceBusReadArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_azure_service_bus_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AzureServiceBusReadArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AzureServiceBusReadArgs.Unmarshal(m, b) -} -func (m *AzureServiceBusReadArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AzureServiceBusReadArgs.Marshal(b, m, deterministic) -} -func (m *AzureServiceBusReadArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_AzureServiceBusReadArgs.Merge(m, src) +func (x *AzureServiceBusReadArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AzureServiceBusReadArgs) XXX_Size() int { - return xxx_messageInfo_AzureServiceBusReadArgs.Size(m) -} -func (m *AzureServiceBusReadArgs) XXX_DiscardUnknown() { - xxx_messageInfo_AzureServiceBusReadArgs.DiscardUnknown(m) + +func (*AzureServiceBusReadArgs) ProtoMessage() {} + +func (x *AzureServiceBusReadArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_azure_service_bus_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AzureServiceBusReadArgs proto.InternalMessageInfo +// Deprecated: Use AzureServiceBusReadArgs.ProtoReflect.Descriptor instead. +func (*AzureServiceBusReadArgs) Descriptor() ([]byte, []int) { + return file_ps_args_azure_service_bus_proto_rawDescGZIP(), []int{1} +} -func (m *AzureServiceBusReadArgs) GetQueue() string { - if m != nil { - return m.Queue +func (x *AzureServiceBusReadArgs) GetQueue() string { + if x != nil { + return x.Queue } return "" } -func (m *AzureServiceBusReadArgs) GetTopic() string { - if m != nil { - return m.Topic +func (x *AzureServiceBusReadArgs) GetTopic() string { + if x != nil { + return x.Topic } return "" } -func (m *AzureServiceBusReadArgs) GetSubscriptionName() string { - if m != nil { - return m.SubscriptionName +func (x *AzureServiceBusReadArgs) GetSubscriptionName() string { + if x != nil { + return x.SubscriptionName } return "" } type AzureServiceBusWriteArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Queue name',xor=asb_write" Queue string `protobuf:"bytes,1,opt,name=queue,proto3" json:"queue,omitempty" kong:"help='Queue name',xor=asb_write"` // @gotags: kong:"help='Topic name',xor=asb_write" - Topic string `protobuf:"bytes,2,opt,name=topic,proto3" json:"topic,omitempty" kong:"help='Topic name',xor=asb_write"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Topic string `protobuf:"bytes,2,opt,name=topic,proto3" json:"topic,omitempty" kong:"help='Topic name',xor=asb_write"` } -func (m *AzureServiceBusWriteArgs) Reset() { *m = AzureServiceBusWriteArgs{} } -func (m *AzureServiceBusWriteArgs) String() string { return proto.CompactTextString(m) } -func (*AzureServiceBusWriteArgs) ProtoMessage() {} -func (*AzureServiceBusWriteArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_d1b595db94f5f784, []int{2} +func (x *AzureServiceBusWriteArgs) Reset() { + *x = AzureServiceBusWriteArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_azure_service_bus_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AzureServiceBusWriteArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AzureServiceBusWriteArgs.Unmarshal(m, b) -} -func (m *AzureServiceBusWriteArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AzureServiceBusWriteArgs.Marshal(b, m, deterministic) -} -func (m *AzureServiceBusWriteArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_AzureServiceBusWriteArgs.Merge(m, src) -} -func (m *AzureServiceBusWriteArgs) XXX_Size() int { - return xxx_messageInfo_AzureServiceBusWriteArgs.Size(m) +func (x *AzureServiceBusWriteArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AzureServiceBusWriteArgs) XXX_DiscardUnknown() { - xxx_messageInfo_AzureServiceBusWriteArgs.DiscardUnknown(m) + +func (*AzureServiceBusWriteArgs) ProtoMessage() {} + +func (x *AzureServiceBusWriteArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_azure_service_bus_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AzureServiceBusWriteArgs proto.InternalMessageInfo +// Deprecated: Use AzureServiceBusWriteArgs.ProtoReflect.Descriptor instead. +func (*AzureServiceBusWriteArgs) Descriptor() ([]byte, []int) { + return file_ps_args_azure_service_bus_proto_rawDescGZIP(), []int{2} +} -func (m *AzureServiceBusWriteArgs) GetQueue() string { - if m != nil { - return m.Queue +func (x *AzureServiceBusWriteArgs) GetQueue() string { + if x != nil { + return x.Queue } return "" } -func (m *AzureServiceBusWriteArgs) GetTopic() string { - if m != nil { - return m.Topic +func (x *AzureServiceBusWriteArgs) GetTopic() string { + if x != nil { + return x.Topic } return "" } -func init() { - proto.RegisterType((*AzureServiceBusConn)(nil), "protos.args.AzureServiceBusConn") - proto.RegisterType((*AzureServiceBusReadArgs)(nil), "protos.args.AzureServiceBusReadArgs") - proto.RegisterType((*AzureServiceBusWriteArgs)(nil), "protos.args.AzureServiceBusWriteArgs") -} - -func init() { proto.RegisterFile("ps_args_azure_service_bus.proto", fileDescriptor_d1b595db94f5f784) } - -var fileDescriptor_d1b595db94f5f784 = []byte{ - // 240 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x90, 0xbb, 0x4b, 0x04, 0x31, - 0x10, 0xc6, 0x39, 0x45, 0xc1, 0xd8, 0xe8, 0x2a, 0xb8, 0x9d, 0xb2, 0x95, 0x20, 0x6e, 0x0a, 0x2b, - 0xb1, 0xba, 0x15, 0x2c, 0x2d, 0xee, 0x0a, 0xc1, 0x26, 0x24, 0xb9, 0x21, 0x1b, 0xb8, 0x3c, 0x9c, - 0x49, 0x2c, 0xfc, 0xeb, 0x25, 0x89, 0xa0, 0x6c, 0x67, 0x15, 0xbe, 0x47, 0xe6, 0x07, 0x1f, 0xbb, - 0x8e, 0x24, 0x24, 0x1a, 0x12, 0xf2, 0x2b, 0x23, 0x08, 0x02, 0xfc, 0xb4, 0x1a, 0x84, 0xca, 0x34, - 0x46, 0x0c, 0x29, 0x74, 0xa7, 0xf5, 0xa1, 0xb1, 0x94, 0x86, 0x89, 0x5d, 0xac, 0x4b, 0x6f, 0xdb, - 0x6a, 0x53, 0xa6, 0xe7, 0xe0, 0x7d, 0x77, 0xc7, 0xce, 0x75, 0xf0, 0x1e, 0x74, 0xb2, 0xc1, 0x0b, - 0x4a, 0x68, 0xbd, 0xe9, 0x57, 0x37, 0xab, 0xdb, 0x93, 0xcd, 0xd9, 0x6f, 0xb0, 0xad, 0xfe, 0x80, - 0xec, 0x6a, 0x71, 0x63, 0x03, 0x72, 0xb7, 0x46, 0x43, 0xdd, 0x25, 0x3b, 0xfa, 0xc8, 0x90, 0xe1, - 0xe7, 0x6f, 0x13, 0xc5, 0x4d, 0x21, 0x5a, 0xdd, 0x1f, 0x34, 0xb7, 0x8a, 0xc2, 0xa4, 0xac, 0x48, - 0xa3, 0x8d, 0x95, 0xea, 0xa5, 0x83, 0xfe, 0xb0, 0x31, 0xff, 0x06, 0xaf, 0xd2, 0xc1, 0xf0, 0xc2, - 0xfa, 0x05, 0xf3, 0x0d, 0x6d, 0x82, 0xff, 0x42, 0xa7, 0xa7, 0xf7, 0x47, 0x63, 0xd3, 0x9c, 0xd5, - 0xa8, 0x83, 0xe3, 0x4a, 0x26, 0x3d, 0xeb, 0x80, 0x91, 0xc7, 0x7d, 0x76, 0x0a, 0xf0, 0x9e, 0xf4, - 0x0c, 0x4e, 0x12, 0x57, 0xd9, 0xee, 0x77, 0xdc, 0x04, 0xde, 0xc6, 0xe3, 0x65, 0x3c, 0x75, 0x5c, - 0xc5, 0xc3, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0d, 0xd8, 0xfd, 0xf3, 0x73, 0x01, 0x00, 0x00, +var File_ps_args_azure_service_bus_proto protoreflect.FileDescriptor + +var file_ps_args_azure_service_bus_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x22, 0x42, + 0x0a, 0x13, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, + 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x22, 0x72, 0x0a, 0x17, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x42, 0x75, 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x12, 0x14, 0x0a, + 0x05, 0x71, 0x75, 0x65, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, + 0x65, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x2b, 0x0a, 0x11, 0x73, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x46, 0x0a, 0x18, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, + 0x67, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, + 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x42, 0x3b, + 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, + 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x61, 0x72, 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_ps_args_azure_service_bus_proto_rawDescOnce sync.Once + file_ps_args_azure_service_bus_proto_rawDescData = file_ps_args_azure_service_bus_proto_rawDesc +) + +func file_ps_args_azure_service_bus_proto_rawDescGZIP() []byte { + file_ps_args_azure_service_bus_proto_rawDescOnce.Do(func() { + file_ps_args_azure_service_bus_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_args_azure_service_bus_proto_rawDescData) + }) + return file_ps_args_azure_service_bus_proto_rawDescData +} + +var file_ps_args_azure_service_bus_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_ps_args_azure_service_bus_proto_goTypes = []interface{}{ + (*AzureServiceBusConn)(nil), // 0: protos.args.AzureServiceBusConn + (*AzureServiceBusReadArgs)(nil), // 1: protos.args.AzureServiceBusReadArgs + (*AzureServiceBusWriteArgs)(nil), // 2: protos.args.AzureServiceBusWriteArgs +} +var file_ps_args_azure_service_bus_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_ps_args_azure_service_bus_proto_init() } +func file_ps_args_azure_service_bus_proto_init() { + if File_ps_args_azure_service_bus_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_args_azure_service_bus_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AzureServiceBusConn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_azure_service_bus_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AzureServiceBusReadArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_azure_service_bus_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AzureServiceBusWriteArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_args_azure_service_bus_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_args_azure_service_bus_proto_goTypes, + DependencyIndexes: file_ps_args_azure_service_bus_proto_depIdxs, + MessageInfos: file_ps_args_azure_service_bus_proto_msgTypes, + }.Build() + File_ps_args_azure_service_bus_proto = out.File + file_ps_args_azure_service_bus_proto_rawDesc = nil + file_ps_args_azure_service_bus_proto_goTypes = nil + file_ps_args_azure_service_bus_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_gcp_pubsub.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_gcp_pubsub.pb.go index a54ee4845..af59a6da1 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_gcp_pubsub.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_gcp_pubsub.pb.go @@ -1,198 +1,322 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_args_gcp_pubsub.proto package args import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type GCPPubSubConn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Project ID',env='PLUMBER_RELAY_GCP_PROJECT_ID',required" ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty" kong:"help='Project ID',env='PLUMBER_RELAY_GCP_PROJECT_ID',required"` // @gotags: kong:"help='GCP Credentials in JSON format',env='PLUMBER_RELAY_GCP_CREDENTIALS'" CredentialsJson string `protobuf:"bytes,2,opt,name=credentials_json,json=credentialsJson,proto3" json:"credentials_json,omitempty" kong:"help='GCP Credentials in JSON format',env='PLUMBER_RELAY_GCP_CREDENTIALS'"` // @gotags: kong:"help='Path to GCP credentials JSON file',env='GOOGLE_APPLICATION_CREDENTIALS'" - CredentialsFile string `protobuf:"bytes,3,opt,name=credentials_file,json=credentialsFile,proto3" json:"credentials_file,omitempty" kong:"help='Path to GCP credentials JSON file',env='GOOGLE_APPLICATION_CREDENTIALS'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + CredentialsFile string `protobuf:"bytes,3,opt,name=credentials_file,json=credentialsFile,proto3" json:"credentials_file,omitempty" kong:"help='Path to GCP credentials JSON file',env='GOOGLE_APPLICATION_CREDENTIALS'"` } -func (m *GCPPubSubConn) Reset() { *m = GCPPubSubConn{} } -func (m *GCPPubSubConn) String() string { return proto.CompactTextString(m) } -func (*GCPPubSubConn) ProtoMessage() {} -func (*GCPPubSubConn) Descriptor() ([]byte, []int) { - return fileDescriptor_e51274dec22f496a, []int{0} +func (x *GCPPubSubConn) Reset() { + *x = GCPPubSubConn{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_gcp_pubsub_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GCPPubSubConn) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GCPPubSubConn.Unmarshal(m, b) -} -func (m *GCPPubSubConn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GCPPubSubConn.Marshal(b, m, deterministic) -} -func (m *GCPPubSubConn) XXX_Merge(src proto.Message) { - xxx_messageInfo_GCPPubSubConn.Merge(m, src) +func (x *GCPPubSubConn) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GCPPubSubConn) XXX_Size() int { - return xxx_messageInfo_GCPPubSubConn.Size(m) -} -func (m *GCPPubSubConn) XXX_DiscardUnknown() { - xxx_messageInfo_GCPPubSubConn.DiscardUnknown(m) + +func (*GCPPubSubConn) ProtoMessage() {} + +func (x *GCPPubSubConn) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_gcp_pubsub_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_GCPPubSubConn proto.InternalMessageInfo +// Deprecated: Use GCPPubSubConn.ProtoReflect.Descriptor instead. +func (*GCPPubSubConn) Descriptor() ([]byte, []int) { + return file_ps_args_gcp_pubsub_proto_rawDescGZIP(), []int{0} +} -func (m *GCPPubSubConn) GetProjectId() string { - if m != nil { - return m.ProjectId +func (x *GCPPubSubConn) GetProjectId() string { + if x != nil { + return x.ProjectId } return "" } -func (m *GCPPubSubConn) GetCredentialsJson() string { - if m != nil { - return m.CredentialsJson +func (x *GCPPubSubConn) GetCredentialsJson() string { + if x != nil { + return x.CredentialsJson } return "" } -func (m *GCPPubSubConn) GetCredentialsFile() string { - if m != nil { - return m.CredentialsFile +func (x *GCPPubSubConn) GetCredentialsFile() string { + if x != nil { + return x.CredentialsFile } return "" } type GCPPubSubReadArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Subscription ID',env='PLUMBER_RELAY_GCP_SUBSCRIPTION_ID',required" SubscriptionId string `protobuf:"bytes,1,opt,name=subscription_id,json=subscriptionId,proto3" json:"subscription_id,omitempty" kong:"help='Subscription ID',env='PLUMBER_RELAY_GCP_SUBSCRIPTION_ID',required"` // @gotags: kong:"help='Whether to acknowledge message receive',env='PLUMBER_RELAY_GCP_ACK_MESSAGE',default=true" - AckMessages bool `protobuf:"varint,2,opt,name=ack_messages,json=ackMessages,proto3" json:"ack_messages,omitempty" kong:"help='Whether to acknowledge message receive',env='PLUMBER_RELAY_GCP_ACK_MESSAGE',default=true"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + AckMessages bool `protobuf:"varint,2,opt,name=ack_messages,json=ackMessages,proto3" json:"ack_messages,omitempty" kong:"help='Whether to acknowledge message receive',env='PLUMBER_RELAY_GCP_ACK_MESSAGE',default=true"` + // @gotags: kong:"help='Testing new field'" + AnotherField string `protobuf:"bytes,3,opt,name=another_field,json=anotherField,proto3" json:"another_field,omitempty" kong:"help='Testing new field'"` } -func (m *GCPPubSubReadArgs) Reset() { *m = GCPPubSubReadArgs{} } -func (m *GCPPubSubReadArgs) String() string { return proto.CompactTextString(m) } -func (*GCPPubSubReadArgs) ProtoMessage() {} -func (*GCPPubSubReadArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_e51274dec22f496a, []int{1} +func (x *GCPPubSubReadArgs) Reset() { + *x = GCPPubSubReadArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_gcp_pubsub_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GCPPubSubReadArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GCPPubSubReadArgs.Unmarshal(m, b) -} -func (m *GCPPubSubReadArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GCPPubSubReadArgs.Marshal(b, m, deterministic) -} -func (m *GCPPubSubReadArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_GCPPubSubReadArgs.Merge(m, src) -} -func (m *GCPPubSubReadArgs) XXX_Size() int { - return xxx_messageInfo_GCPPubSubReadArgs.Size(m) +func (x *GCPPubSubReadArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GCPPubSubReadArgs) XXX_DiscardUnknown() { - xxx_messageInfo_GCPPubSubReadArgs.DiscardUnknown(m) + +func (*GCPPubSubReadArgs) ProtoMessage() {} + +func (x *GCPPubSubReadArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_gcp_pubsub_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_GCPPubSubReadArgs proto.InternalMessageInfo +// Deprecated: Use GCPPubSubReadArgs.ProtoReflect.Descriptor instead. +func (*GCPPubSubReadArgs) Descriptor() ([]byte, []int) { + return file_ps_args_gcp_pubsub_proto_rawDescGZIP(), []int{1} +} -func (m *GCPPubSubReadArgs) GetSubscriptionId() string { - if m != nil { - return m.SubscriptionId +func (x *GCPPubSubReadArgs) GetSubscriptionId() string { + if x != nil { + return x.SubscriptionId } return "" } -func (m *GCPPubSubReadArgs) GetAckMessages() bool { - if m != nil { - return m.AckMessages +func (x *GCPPubSubReadArgs) GetAckMessages() bool { + if x != nil { + return x.AckMessages } return false } +func (x *GCPPubSubReadArgs) GetAnotherField() string { + if x != nil { + return x.AnotherField + } + return "" +} + type GCPPubSubWriteArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Topic ID to publish message(s) to',required" - TopicId string `protobuf:"bytes,1,opt,name=topic_id,json=topicId,proto3" json:"topic_id,omitempty" kong:"help='Topic ID to publish message(s) to',required"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + TopicId string `protobuf:"bytes,1,opt,name=topic_id,json=topicId,proto3" json:"topic_id,omitempty" kong:"help='Topic ID to publish message(s) to',required"` } -func (m *GCPPubSubWriteArgs) Reset() { *m = GCPPubSubWriteArgs{} } -func (m *GCPPubSubWriteArgs) String() string { return proto.CompactTextString(m) } -func (*GCPPubSubWriteArgs) ProtoMessage() {} -func (*GCPPubSubWriteArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_e51274dec22f496a, []int{2} +func (x *GCPPubSubWriteArgs) Reset() { + *x = GCPPubSubWriteArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_gcp_pubsub_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GCPPubSubWriteArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GCPPubSubWriteArgs.Unmarshal(m, b) +func (x *GCPPubSubWriteArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GCPPubSubWriteArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GCPPubSubWriteArgs.Marshal(b, m, deterministic) + +func (*GCPPubSubWriteArgs) ProtoMessage() {} + +func (x *GCPPubSubWriteArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_gcp_pubsub_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func (m *GCPPubSubWriteArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_GCPPubSubWriteArgs.Merge(m, src) + +// Deprecated: Use GCPPubSubWriteArgs.ProtoReflect.Descriptor instead. +func (*GCPPubSubWriteArgs) Descriptor() ([]byte, []int) { + return file_ps_args_gcp_pubsub_proto_rawDescGZIP(), []int{2} } -func (m *GCPPubSubWriteArgs) XXX_Size() int { - return xxx_messageInfo_GCPPubSubWriteArgs.Size(m) + +func (x *GCPPubSubWriteArgs) GetTopicId() string { + if x != nil { + return x.TopicId + } + return "" } -func (m *GCPPubSubWriteArgs) XXX_DiscardUnknown() { - xxx_messageInfo_GCPPubSubWriteArgs.DiscardUnknown(m) + +var File_ps_args_gcp_pubsub_proto protoreflect.FileDescriptor + +var file_ps_args_gcp_pubsub_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x67, 0x63, 0x70, 0x5f, 0x70, 0x75, + 0x62, 0x73, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x22, 0x84, 0x01, 0x0a, 0x0d, 0x47, 0x43, 0x50, 0x50, + 0x75, 0x62, 0x53, 0x75, 0x62, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, + 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, + 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x72, 0x65, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x4a, + 0x73, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x6c, 0x73, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, + 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x46, 0x69, 0x6c, 0x65, 0x22, 0x84, + 0x01, 0x0a, 0x11, 0x47, 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x52, 0x65, 0x61, 0x64, + 0x41, 0x72, 0x67, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x21, 0x0a, + 0x0c, 0x61, 0x63, 0x6b, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x0b, 0x61, 0x63, 0x6b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, + 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, + 0x46, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x2f, 0x0a, 0x12, 0x47, 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, + 0x75, 0x62, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x74, + 0x6f, 0x70, 0x69, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, + 0x6f, 0x70, 0x69, 0x63, 0x49, 0x64, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, + 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, + 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x61, + 0x72, 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var xxx_messageInfo_GCPPubSubWriteArgs proto.InternalMessageInfo +var ( + file_ps_args_gcp_pubsub_proto_rawDescOnce sync.Once + file_ps_args_gcp_pubsub_proto_rawDescData = file_ps_args_gcp_pubsub_proto_rawDesc +) -func (m *GCPPubSubWriteArgs) GetTopicId() string { - if m != nil { - return m.TopicId - } - return "" +func file_ps_args_gcp_pubsub_proto_rawDescGZIP() []byte { + file_ps_args_gcp_pubsub_proto_rawDescOnce.Do(func() { + file_ps_args_gcp_pubsub_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_args_gcp_pubsub_proto_rawDescData) + }) + return file_ps_args_gcp_pubsub_proto_rawDescData +} + +var file_ps_args_gcp_pubsub_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_ps_args_gcp_pubsub_proto_goTypes = []interface{}{ + (*GCPPubSubConn)(nil), // 0: protos.args.GCPPubSubConn + (*GCPPubSubReadArgs)(nil), // 1: protos.args.GCPPubSubReadArgs + (*GCPPubSubWriteArgs)(nil), // 2: protos.args.GCPPubSubWriteArgs +} +var file_ps_args_gcp_pubsub_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } -func init() { - proto.RegisterType((*GCPPubSubConn)(nil), "protos.args.GCPPubSubConn") - proto.RegisterType((*GCPPubSubReadArgs)(nil), "protos.args.GCPPubSubReadArgs") - proto.RegisterType((*GCPPubSubWriteArgs)(nil), "protos.args.GCPPubSubWriteArgs") -} - -func init() { proto.RegisterFile("ps_args_gcp_pubsub.proto", fileDescriptor_e51274dec22f496a) } - -var fileDescriptor_e51274dec22f496a = []byte{ - // 280 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0x4f, 0x4b, 0x33, 0x31, - 0x18, 0xc4, 0xd9, 0xf7, 0x05, 0x6d, 0x53, 0xb5, 0x9a, 0xd3, 0x7a, 0x10, 0x74, 0x2f, 0xea, 0xc1, - 0xcd, 0xc1, 0x93, 0x78, 0xd2, 0x82, 0xb2, 0x82, 0x50, 0xd6, 0x83, 0xe0, 0x25, 0xe4, 0x9f, 0xd9, - 0xb4, 0xbb, 0x49, 0xc8, 0x93, 0x7c, 0x03, 0x3f, 0xb8, 0x34, 0x96, 0xb6, 0xe8, 0x29, 0xcc, 0x2f, - 0xc3, 0x33, 0xc3, 0xa0, 0xd2, 0x03, 0x65, 0x41, 0x03, 0xd5, 0xc2, 0x53, 0x9f, 0x38, 0x24, 0x5e, - 0xfb, 0xe0, 0xa2, 0xc3, 0x93, 0xfc, 0x40, 0xbd, 0xfa, 0xad, 0xbe, 0x0a, 0x74, 0xf8, 0x3c, 0x9b, - 0xcf, 0x13, 0x7f, 0x4b, 0x7c, 0xe6, 0xac, 0xc5, 0x67, 0x08, 0xf9, 0xe0, 0x16, 0x4a, 0x44, 0x6a, - 0x64, 0x59, 0x9c, 0x17, 0x57, 0xe3, 0x76, 0xbc, 0x26, 0x8d, 0xc4, 0xd7, 0xe8, 0x58, 0x04, 0x25, - 0x95, 0x8d, 0x86, 0xf5, 0x40, 0x17, 0xe0, 0x6c, 0xf9, 0x2f, 0x9b, 0xa6, 0x3b, 0xfc, 0x05, 0x9c, - 0xfd, 0x6d, 0xfd, 0x34, 0xbd, 0x2a, 0xff, 0xff, 0xb1, 0x3e, 0x99, 0x5e, 0x55, 0x14, 0x9d, 0x6c, - 0x5a, 0xb4, 0x8a, 0xc9, 0x87, 0xa0, 0x01, 0x5f, 0xa2, 0x29, 0x24, 0x0e, 0x22, 0x18, 0x1f, 0x8d, - 0xb3, 0xdb, 0x3a, 0x47, 0xbb, 0xb8, 0x91, 0xf8, 0x02, 0x1d, 0x30, 0xb1, 0xa4, 0x83, 0x02, 0x60, - 0x5a, 0x41, 0xee, 0x33, 0x6a, 0x27, 0x4c, 0x2c, 0x5f, 0xd7, 0xa8, 0x22, 0x08, 0x6f, 0x02, 0xde, - 0x83, 0x89, 0x2a, 0x27, 0x9c, 0xa2, 0x51, 0x74, 0xde, 0x88, 0xed, 0xe9, 0xfd, 0xac, 0x1b, 0xf9, - 0x78, 0xff, 0x71, 0xa7, 0x4d, 0xec, 0x12, 0xaf, 0x85, 0x1b, 0x08, 0x67, 0x51, 0x74, 0xc2, 0x05, - 0x4f, 0x7c, 0x9f, 0x06, 0xae, 0xc2, 0x0d, 0x88, 0x4e, 0x0d, 0x0c, 0x08, 0x4f, 0xa6, 0x97, 0x44, - 0x3b, 0xf2, 0xb3, 0x2a, 0x59, 0xad, 0xca, 0xf7, 0xb2, 0xb8, 0xfd, 0x0e, 0x00, 0x00, 0xff, 0xff, - 0xac, 0xe8, 0x15, 0xc6, 0x85, 0x01, 0x00, 0x00, +func init() { file_ps_args_gcp_pubsub_proto_init() } +func file_ps_args_gcp_pubsub_proto_init() { + if File_ps_args_gcp_pubsub_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_args_gcp_pubsub_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GCPPubSubConn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_gcp_pubsub_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GCPPubSubReadArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_gcp_pubsub_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GCPPubSubWriteArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_args_gcp_pubsub_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_args_gcp_pubsub_proto_goTypes, + DependencyIndexes: file_ps_args_gcp_pubsub_proto_depIdxs, + MessageInfos: file_ps_args_gcp_pubsub_proto_msgTypes, + }.Build() + File_ps_args_gcp_pubsub_proto = out.File + file_ps_args_gcp_pubsub_proto_rawDesc = nil + file_ps_args_gcp_pubsub_proto_goTypes = nil + file_ps_args_gcp_pubsub_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_kafka.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_kafka.pb.go index 09050b4e3..08f397f6d 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_kafka.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_kafka.pb.go @@ -1,24 +1,24 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_args_kafka.proto package args import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type SASLType int32 @@ -28,27 +28,52 @@ const ( SASLType_SCRAM SASLType = 2 ) -var SASLType_name = map[int32]string{ - 0: "NONE", - 1: "PLAIN", - 2: "SCRAM", -} +// Enum value maps for SASLType. +var ( + SASLType_name = map[int32]string{ + 0: "NONE", + 1: "PLAIN", + 2: "SCRAM", + } + SASLType_value = map[string]int32{ + "NONE": 0, + "PLAIN": 1, + "SCRAM": 2, + } +) -var SASLType_value = map[string]int32{ - "NONE": 0, - "PLAIN": 1, - "SCRAM": 2, +func (x SASLType) Enum() *SASLType { + p := new(SASLType) + *p = x + return p } func (x SASLType) String() string { - return proto.EnumName(SASLType_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } +func (SASLType) Descriptor() protoreflect.EnumDescriptor { + return file_ps_args_kafka_proto_enumTypes[0].Descriptor() +} + +func (SASLType) Type() protoreflect.EnumType { + return &file_ps_args_kafka_proto_enumTypes[0] +} + +func (x SASLType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SASLType.Descriptor instead. func (SASLType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_5f98a21d9d819f0c, []int{0} + return file_ps_args_kafka_proto_rawDescGZIP(), []int{0} } type KafkaConn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Kafka broker address (you may specify this flag multiple times)',env=PLUMBER_RELAY_KAFKA_ADDRESS,default='localhost:9092',required" Address []string `protobuf:"bytes,1,rep,name=address,proto3" json:"address,omitempty" kong:"help='Kafka broker address (you may specify this flag multiple times)',env=PLUMBER_RELAY_KAFKA_ADDRESS,default='localhost:9092',required"` // @gotags: kong:"help='Connect timeout',env=PLUMBER_RELAY_TIMEOUT_SECONDS,default=10" @@ -63,87 +88,95 @@ type KafkaConn struct { SaslUsername string `protobuf:"bytes,6,opt,name=sasl_username,json=saslUsername,proto3" json:"sasl_username,omitempty" kong:"help='SASL Username',env=PLUMBER_RELAY_KAFKA_USERNAME"` // Required if sasl_type is not NONE // @gotags: kong:"help='SASL Password. You will be prompted for the password if omitted',env=PLUMBER_RELAY_KAFKA_PASSWORD" - SaslPassword string `protobuf:"bytes,7,opt,name=sasl_password,json=saslPassword,proto3" json:"sasl_password,omitempty" kong:"help='SASL Password. You will be prompted for the password if omitted',env=PLUMBER_RELAY_KAFKA_PASSWORD"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + SaslPassword string `protobuf:"bytes,7,opt,name=sasl_password,json=saslPassword,proto3" json:"sasl_password,omitempty" kong:"help='SASL Password. You will be prompted for the password if omitted',env=PLUMBER_RELAY_KAFKA_PASSWORD"` } -func (m *KafkaConn) Reset() { *m = KafkaConn{} } -func (m *KafkaConn) String() string { return proto.CompactTextString(m) } -func (*KafkaConn) ProtoMessage() {} -func (*KafkaConn) Descriptor() ([]byte, []int) { - return fileDescriptor_5f98a21d9d819f0c, []int{0} +func (x *KafkaConn) Reset() { + *x = KafkaConn{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_kafka_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *KafkaConn) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_KafkaConn.Unmarshal(m, b) -} -func (m *KafkaConn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_KafkaConn.Marshal(b, m, deterministic) -} -func (m *KafkaConn) XXX_Merge(src proto.Message) { - xxx_messageInfo_KafkaConn.Merge(m, src) -} -func (m *KafkaConn) XXX_Size() int { - return xxx_messageInfo_KafkaConn.Size(m) +func (x *KafkaConn) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *KafkaConn) XXX_DiscardUnknown() { - xxx_messageInfo_KafkaConn.DiscardUnknown(m) + +func (*KafkaConn) ProtoMessage() {} + +func (x *KafkaConn) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_kafka_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_KafkaConn proto.InternalMessageInfo +// Deprecated: Use KafkaConn.ProtoReflect.Descriptor instead. +func (*KafkaConn) Descriptor() ([]byte, []int) { + return file_ps_args_kafka_proto_rawDescGZIP(), []int{0} +} -func (m *KafkaConn) GetAddress() []string { - if m != nil { - return m.Address +func (x *KafkaConn) GetAddress() []string { + if x != nil { + return x.Address } return nil } -func (m *KafkaConn) GetTimeoutSeconds() int32 { - if m != nil { - return m.TimeoutSeconds +func (x *KafkaConn) GetTimeoutSeconds() int32 { + if x != nil { + return x.TimeoutSeconds } return 0 } -func (m *KafkaConn) GetUseTls() bool { - if m != nil { - return m.UseTls +func (x *KafkaConn) GetUseTls() bool { + if x != nil { + return x.UseTls } return false } -func (m *KafkaConn) GetTlsSkipVerify() bool { - if m != nil { - return m.TlsSkipVerify +func (x *KafkaConn) GetTlsSkipVerify() bool { + if x != nil { + return x.TlsSkipVerify } return false } -func (m *KafkaConn) GetSaslType() SASLType { - if m != nil { - return m.SaslType +func (x *KafkaConn) GetSaslType() SASLType { + if x != nil { + return x.SaslType } return SASLType_NONE } -func (m *KafkaConn) GetSaslUsername() string { - if m != nil { - return m.SaslUsername +func (x *KafkaConn) GetSaslUsername() string { + if x != nil { + return x.SaslUsername } return "" } -func (m *KafkaConn) GetSaslPassword() string { - if m != nil { - return m.SaslPassword +func (x *KafkaConn) GetSaslPassword() string { + if x != nil { + return x.SaslPassword } return "" } type KafkaReadArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Topic(s) to read from',required" Topics []string `protobuf:"bytes,1,rep,name=topics,proto3" json:"topics,omitempty" kong:"help='Topic(s) to read from',required"` // @gotags: kong:"help='Specify what offset the consumer should read from (only works if --use-consumer-group is false)',default=0" @@ -169,187 +202,203 @@ type KafkaReadArgs struct { // @gotags: kong:"help='Only lookup consumer group lag',group=lag" Lag bool `protobuf:"varint,12,opt,name=lag,proto3" json:"lag,omitempty" kong:"help='Only lookup consumer group lag',group=lag"` // @gotags: kong:"help='What consumer group to lookup lag for (required if --lag is set)',group=lag" - LagConsumerGroup string `protobuf:"bytes,13,opt,name=lag_consumer_group,json=lagConsumerGroup,proto3" json:"lag_consumer_group,omitempty" kong:"help='What consumer group to lookup lag for (required if --lag is set)',group=lag"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + LagConsumerGroup string `protobuf:"bytes,13,opt,name=lag_consumer_group,json=lagConsumerGroup,proto3" json:"lag_consumer_group,omitempty" kong:"help='What consumer group to lookup lag for (required if --lag is set)',group=lag"` } -func (m *KafkaReadArgs) Reset() { *m = KafkaReadArgs{} } -func (m *KafkaReadArgs) String() string { return proto.CompactTextString(m) } -func (*KafkaReadArgs) ProtoMessage() {} -func (*KafkaReadArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_5f98a21d9d819f0c, []int{1} +func (x *KafkaReadArgs) Reset() { + *x = KafkaReadArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_kafka_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *KafkaReadArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_KafkaReadArgs.Unmarshal(m, b) -} -func (m *KafkaReadArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_KafkaReadArgs.Marshal(b, m, deterministic) -} -func (m *KafkaReadArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_KafkaReadArgs.Merge(m, src) -} -func (m *KafkaReadArgs) XXX_Size() int { - return xxx_messageInfo_KafkaReadArgs.Size(m) +func (x *KafkaReadArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *KafkaReadArgs) XXX_DiscardUnknown() { - xxx_messageInfo_KafkaReadArgs.DiscardUnknown(m) + +func (*KafkaReadArgs) ProtoMessage() {} + +func (x *KafkaReadArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_kafka_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_KafkaReadArgs proto.InternalMessageInfo +// Deprecated: Use KafkaReadArgs.ProtoReflect.Descriptor instead. +func (*KafkaReadArgs) Descriptor() ([]byte, []int) { + return file_ps_args_kafka_proto_rawDescGZIP(), []int{1} +} -func (m *KafkaReadArgs) GetTopics() []string { - if m != nil { - return m.Topics +func (x *KafkaReadArgs) GetTopics() []string { + if x != nil { + return x.Topics } return nil } -func (m *KafkaReadArgs) GetReadOffset() int64 { - if m != nil { - return m.ReadOffset +func (x *KafkaReadArgs) GetReadOffset() int64 { + if x != nil { + return x.ReadOffset } return 0 } -func (m *KafkaReadArgs) GetUseConsumerGroup() bool { - if m != nil { - return m.UseConsumerGroup +func (x *KafkaReadArgs) GetUseConsumerGroup() bool { + if x != nil { + return x.UseConsumerGroup } return false } -func (m *KafkaReadArgs) GetConsumerGroupName() string { - if m != nil { - return m.ConsumerGroupName +func (x *KafkaReadArgs) GetConsumerGroupName() string { + if x != nil { + return x.ConsumerGroupName } return "" } -func (m *KafkaReadArgs) GetMaxWaitSeconds() int32 { - if m != nil { - return m.MaxWaitSeconds +func (x *KafkaReadArgs) GetMaxWaitSeconds() int32 { + if x != nil { + return x.MaxWaitSeconds } return 0 } -func (m *KafkaReadArgs) GetMinBytes() int32 { - if m != nil { - return m.MinBytes +func (x *KafkaReadArgs) GetMinBytes() int32 { + if x != nil { + return x.MinBytes } return 0 } -func (m *KafkaReadArgs) GetMaxBytes() int32 { - if m != nil { - return m.MaxBytes +func (x *KafkaReadArgs) GetMaxBytes() int32 { + if x != nil { + return x.MaxBytes } return 0 } -func (m *KafkaReadArgs) GetCommitIntervalSeconds() int32 { - if m != nil { - return m.CommitIntervalSeconds +func (x *KafkaReadArgs) GetCommitIntervalSeconds() int32 { + if x != nil { + return x.CommitIntervalSeconds } return 0 } -func (m *KafkaReadArgs) GetRebalanceTimeoutSeconds() int32 { - if m != nil { - return m.RebalanceTimeoutSeconds +func (x *KafkaReadArgs) GetRebalanceTimeoutSeconds() int32 { + if x != nil { + return x.RebalanceTimeoutSeconds } return 0 } -func (m *KafkaReadArgs) GetQueueCapacity() int32 { - if m != nil { - return m.QueueCapacity +func (x *KafkaReadArgs) GetQueueCapacity() int32 { + if x != nil { + return x.QueueCapacity } return 0 } -func (m *KafkaReadArgs) GetIncludeOffsetInfo() bool { - if m != nil { - return m.IncludeOffsetInfo +func (x *KafkaReadArgs) GetIncludeOffsetInfo() bool { + if x != nil { + return x.IncludeOffsetInfo } return false } -func (m *KafkaReadArgs) GetLag() bool { - if m != nil { - return m.Lag +func (x *KafkaReadArgs) GetLag() bool { + if x != nil { + return x.Lag } return false } -func (m *KafkaReadArgs) GetLagConsumerGroup() string { - if m != nil { - return m.LagConsumerGroup +func (x *KafkaReadArgs) GetLagConsumerGroup() string { + if x != nil { + return x.LagConsumerGroup } return "" } type KafkaWriteArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Key to write to kafka (optional)'" Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty" kong:"help='Key to write to kafka (optional)'"` // @gotags: kong:"help='Add one or more headers (optional; repeat flags to specify multiple)'" Headers map[string]string `protobuf:"bytes,2,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" kong:"help='Add one or more headers (optional; repeat flags to specify multiple)'"` // @gotags: kong:"help='Topic(s) to write to',required" - Topics []string `protobuf:"bytes,3,rep,name=topics,proto3" json:"topics,omitempty" kong:"help='Topic(s) to write to',required"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Topics []string `protobuf:"bytes,3,rep,name=topics,proto3" json:"topics,omitempty" kong:"help='Topic(s) to write to',required"` } -func (m *KafkaWriteArgs) Reset() { *m = KafkaWriteArgs{} } -func (m *KafkaWriteArgs) String() string { return proto.CompactTextString(m) } -func (*KafkaWriteArgs) ProtoMessage() {} -func (*KafkaWriteArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_5f98a21d9d819f0c, []int{2} +func (x *KafkaWriteArgs) Reset() { + *x = KafkaWriteArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_kafka_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *KafkaWriteArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_KafkaWriteArgs.Unmarshal(m, b) +func (x *KafkaWriteArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *KafkaWriteArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_KafkaWriteArgs.Marshal(b, m, deterministic) -} -func (m *KafkaWriteArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_KafkaWriteArgs.Merge(m, src) -} -func (m *KafkaWriteArgs) XXX_Size() int { - return xxx_messageInfo_KafkaWriteArgs.Size(m) -} -func (m *KafkaWriteArgs) XXX_DiscardUnknown() { - xxx_messageInfo_KafkaWriteArgs.DiscardUnknown(m) + +func (*KafkaWriteArgs) ProtoMessage() {} + +func (x *KafkaWriteArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_kafka_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_KafkaWriteArgs proto.InternalMessageInfo +// Deprecated: Use KafkaWriteArgs.ProtoReflect.Descriptor instead. +func (*KafkaWriteArgs) Descriptor() ([]byte, []int) { + return file_ps_args_kafka_proto_rawDescGZIP(), []int{2} +} -func (m *KafkaWriteArgs) GetKey() string { - if m != nil { - return m.Key +func (x *KafkaWriteArgs) GetKey() string { + if x != nil { + return x.Key } return "" } -func (m *KafkaWriteArgs) GetHeaders() map[string]string { - if m != nil { - return m.Headers +func (x *KafkaWriteArgs) GetHeaders() map[string]string { + if x != nil { + return x.Headers } return nil } -func (m *KafkaWriteArgs) GetTopics() []string { - if m != nil { - return m.Topics +func (x *KafkaWriteArgs) GetTopics() []string { + if x != nil { + return x.Topics } return nil } type KafkaRelayArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Topic(s) to read, write or get lag stats for',env=PLUMBER_RELAY_KAFKA_TOPIC,required" Topics []string `protobuf:"bytes,1,rep,name=topics,proto3" json:"topics,omitempty" kong:"help='Topic(s) to read, write or get lag stats for',env=PLUMBER_RELAY_KAFKA_TOPIC,required"` // @gotags: kong:"help='Specify what offset the consumer should read from (only works if --use-consumer-group is false)',env=PLUMBER_RELAY_KAFKA_READ_OFFSET,default=0" @@ -369,162 +418,319 @@ type KafkaRelayArgs struct { // @gotags: kong:"help='How long a coordinator will wait for member joins as part of a rebalance',env=PLUMBER_RELAY_KAFKA_REBALANCE_TIMEOUT,default=5" RebalanceTimeoutSeconds int32 `protobuf:"varint,9,opt,name=rebalance_timeout_seconds,json=rebalanceTimeoutSeconds,proto3" json:"rebalance_timeout_seconds,omitempty" kong:"help='How long a coordinator will wait for member joins as part of a rebalance',env=PLUMBER_RELAY_KAFKA_REBALANCE_TIMEOUT,default=5"` // @gotags: kong:"help='Internal library queue capacity (throughput optimization)',env=PLUMBER_RELAY_KAFKA_QUEUE_CAPACITY,default=1000" - QueueCapacity int32 `protobuf:"varint,10,opt,name=queue_capacity,json=queueCapacity,proto3" json:"queue_capacity,omitempty" kong:"help='Internal library queue capacity (throughput optimization)',env=PLUMBER_RELAY_KAFKA_QUEUE_CAPACITY,default=1000"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + QueueCapacity int32 `protobuf:"varint,10,opt,name=queue_capacity,json=queueCapacity,proto3" json:"queue_capacity,omitempty" kong:"help='Internal library queue capacity (throughput optimization)',env=PLUMBER_RELAY_KAFKA_QUEUE_CAPACITY,default=1000"` } -func (m *KafkaRelayArgs) Reset() { *m = KafkaRelayArgs{} } -func (m *KafkaRelayArgs) String() string { return proto.CompactTextString(m) } -func (*KafkaRelayArgs) ProtoMessage() {} -func (*KafkaRelayArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_5f98a21d9d819f0c, []int{3} +func (x *KafkaRelayArgs) Reset() { + *x = KafkaRelayArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_kafka_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *KafkaRelayArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_KafkaRelayArgs.Unmarshal(m, b) -} -func (m *KafkaRelayArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_KafkaRelayArgs.Marshal(b, m, deterministic) -} -func (m *KafkaRelayArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_KafkaRelayArgs.Merge(m, src) -} -func (m *KafkaRelayArgs) XXX_Size() int { - return xxx_messageInfo_KafkaRelayArgs.Size(m) +func (x *KafkaRelayArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *KafkaRelayArgs) XXX_DiscardUnknown() { - xxx_messageInfo_KafkaRelayArgs.DiscardUnknown(m) + +func (*KafkaRelayArgs) ProtoMessage() {} + +func (x *KafkaRelayArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_kafka_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_KafkaRelayArgs proto.InternalMessageInfo +// Deprecated: Use KafkaRelayArgs.ProtoReflect.Descriptor instead. +func (*KafkaRelayArgs) Descriptor() ([]byte, []int) { + return file_ps_args_kafka_proto_rawDescGZIP(), []int{3} +} -func (m *KafkaRelayArgs) GetTopics() []string { - if m != nil { - return m.Topics +func (x *KafkaRelayArgs) GetTopics() []string { + if x != nil { + return x.Topics } return nil } -func (m *KafkaRelayArgs) GetReadOffset() int64 { - if m != nil { - return m.ReadOffset +func (x *KafkaRelayArgs) GetReadOffset() int64 { + if x != nil { + return x.ReadOffset } return 0 } -func (m *KafkaRelayArgs) GetUseConsumerGroup() bool { - if m != nil { - return m.UseConsumerGroup +func (x *KafkaRelayArgs) GetUseConsumerGroup() bool { + if x != nil { + return x.UseConsumerGroup } return false } -func (m *KafkaRelayArgs) GetConsumerGroupName() string { - if m != nil { - return m.ConsumerGroupName +func (x *KafkaRelayArgs) GetConsumerGroupName() string { + if x != nil { + return x.ConsumerGroupName } return "" } -func (m *KafkaRelayArgs) GetMaxWaitSeconds() int32 { - if m != nil { - return m.MaxWaitSeconds +func (x *KafkaRelayArgs) GetMaxWaitSeconds() int32 { + if x != nil { + return x.MaxWaitSeconds } return 0 } -func (m *KafkaRelayArgs) GetMinBytes() int32 { - if m != nil { - return m.MinBytes +func (x *KafkaRelayArgs) GetMinBytes() int32 { + if x != nil { + return x.MinBytes } return 0 } -func (m *KafkaRelayArgs) GetMaxBytes() int32 { - if m != nil { - return m.MaxBytes +func (x *KafkaRelayArgs) GetMaxBytes() int32 { + if x != nil { + return x.MaxBytes } return 0 } -func (m *KafkaRelayArgs) GetCommitIntervalSeconds() int32 { - if m != nil { - return m.CommitIntervalSeconds +func (x *KafkaRelayArgs) GetCommitIntervalSeconds() int32 { + if x != nil { + return x.CommitIntervalSeconds } return 0 } -func (m *KafkaRelayArgs) GetRebalanceTimeoutSeconds() int32 { - if m != nil { - return m.RebalanceTimeoutSeconds +func (x *KafkaRelayArgs) GetRebalanceTimeoutSeconds() int32 { + if x != nil { + return x.RebalanceTimeoutSeconds } return 0 } -func (m *KafkaRelayArgs) GetQueueCapacity() int32 { - if m != nil { - return m.QueueCapacity +func (x *KafkaRelayArgs) GetQueueCapacity() int32 { + if x != nil { + return x.QueueCapacity } return 0 } -func init() { - proto.RegisterEnum("protos.args.SASLType", SASLType_name, SASLType_value) - proto.RegisterType((*KafkaConn)(nil), "protos.args.KafkaConn") - proto.RegisterType((*KafkaReadArgs)(nil), "protos.args.KafkaReadArgs") - proto.RegisterType((*KafkaWriteArgs)(nil), "protos.args.KafkaWriteArgs") - proto.RegisterMapType((map[string]string)(nil), "protos.args.KafkaWriteArgs.HeadersEntry") - proto.RegisterType((*KafkaRelayArgs)(nil), "protos.args.KafkaRelayArgs") -} - -func init() { proto.RegisterFile("ps_args_kafka.proto", fileDescriptor_5f98a21d9d819f0c) } - -var fileDescriptor_5f98a21d9d819f0c = []byte{ - // 694 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x54, 0xdd, 0x6e, 0xd3, 0x48, - 0x18, 0x5d, 0xc7, 0xf9, 0xf3, 0xa4, 0x49, 0xdd, 0xe9, 0x76, 0xeb, 0xdd, 0xbd, 0xd8, 0x28, 0x2b, - 0xc0, 0xaa, 0x20, 0x91, 0x8a, 0x84, 0xa0, 0x5c, 0xa5, 0x51, 0x05, 0x15, 0x25, 0xad, 0x9c, 0x42, - 0x25, 0x6e, 0x46, 0x13, 0x7b, 0xe2, 0x8c, 0x62, 0x7b, 0xcc, 0xcc, 0xb8, 0x8d, 0x1f, 0x82, 0x4b, - 0x5e, 0x81, 0x87, 0xe0, 0xe9, 0xd0, 0x8c, 0x9d, 0x34, 0xa9, 0x78, 0x00, 0x2e, 0xb8, 0xca, 0xf7, - 0x9d, 0x73, 0x3e, 0xcd, 0xcc, 0xf9, 0x4e, 0x0c, 0xf6, 0x53, 0x81, 0x30, 0x0f, 0x05, 0x5a, 0xe0, - 0xd9, 0x02, 0xf7, 0x53, 0xce, 0x24, 0x83, 0x2d, 0xfd, 0x23, 0xfa, 0x8a, 0xe8, 0x7d, 0xa9, 0x00, - 0xeb, 0x9d, 0x22, 0x47, 0x2c, 0x49, 0xa0, 0x03, 0x1a, 0x38, 0x08, 0x38, 0x11, 0xc2, 0x31, 0xba, - 0xa6, 0x6b, 0x79, 0xab, 0x16, 0x3e, 0x01, 0xbb, 0x92, 0xc6, 0x84, 0x65, 0x12, 0x09, 0xe2, 0xb3, - 0x24, 0x10, 0x4e, 0xa5, 0x6b, 0xb8, 0x35, 0xaf, 0x53, 0xc2, 0x93, 0x02, 0x85, 0x87, 0xa0, 0x91, - 0x09, 0x82, 0x64, 0x24, 0x1c, 0xb3, 0x6b, 0xb8, 0x4d, 0xaf, 0x9e, 0x09, 0x72, 0x1d, 0x09, 0xf8, - 0x18, 0xec, 0xca, 0x48, 0x20, 0xb1, 0xa0, 0x29, 0xba, 0x25, 0x9c, 0xce, 0x72, 0xa7, 0xaa, 0x05, - 0x6d, 0x19, 0x89, 0xc9, 0x82, 0xa6, 0x1f, 0x35, 0x08, 0x8f, 0x81, 0x25, 0xb0, 0x88, 0x90, 0xcc, - 0x53, 0xe2, 0xd4, 0xba, 0x86, 0xdb, 0x39, 0x3e, 0xe8, 0x6f, 0x5c, 0xb9, 0x3f, 0x19, 0x4e, 0x2e, - 0xae, 0xf3, 0x94, 0x78, 0x4d, 0xa5, 0x53, 0x15, 0xfc, 0x1f, 0xb4, 0xf5, 0x4c, 0x26, 0x08, 0x4f, - 0x70, 0x4c, 0x9c, 0x7a, 0xd7, 0x70, 0x2d, 0x6f, 0x47, 0x81, 0x1f, 0x4a, 0x6c, 0x2d, 0x4a, 0xb1, - 0x10, 0x77, 0x8c, 0x07, 0x4e, 0xe3, 0x5e, 0x74, 0x55, 0x62, 0xbd, 0xaf, 0x55, 0xd0, 0xd6, 0x7e, - 0x78, 0x04, 0x07, 0x43, 0x1e, 0x0a, 0xf8, 0x17, 0xa8, 0x4b, 0x96, 0x52, 0x7f, 0x65, 0x49, 0xd9, - 0xc1, 0xff, 0x40, 0x8b, 0x13, 0x1c, 0x20, 0x36, 0x9b, 0x09, 0x22, 0xb5, 0x1b, 0xa6, 0x07, 0x14, - 0x74, 0xa9, 0x11, 0xf8, 0x14, 0x40, 0xe5, 0x84, 0xcf, 0x12, 0x91, 0xc5, 0x84, 0xa3, 0x90, 0xb3, - 0x2c, 0x2d, 0x4d, 0xb1, 0x33, 0x41, 0x46, 0x25, 0xf1, 0x46, 0xe1, 0xb0, 0x0f, 0xf6, 0xb7, 0x95, - 0x48, 0x3f, 0xa4, 0xaa, 0xef, 0xb8, 0xe7, 0x6f, 0x6a, 0xc7, 0xea, 0x35, 0x2e, 0xb0, 0x63, 0xbc, - 0x44, 0x77, 0x98, 0xde, 0x6f, 0xa4, 0x56, 0x6c, 0x24, 0xc6, 0xcb, 0x1b, 0x4c, 0xd7, 0x1b, 0xf9, - 0x17, 0x58, 0x31, 0x4d, 0xd0, 0x34, 0x97, 0x44, 0x68, 0x63, 0x6a, 0x5e, 0x33, 0xa6, 0xc9, 0xa9, - 0xea, 0x35, 0x89, 0x97, 0x25, 0xd9, 0x28, 0x49, 0xbc, 0x2c, 0xc8, 0x17, 0xe0, 0xd0, 0x67, 0x71, - 0x4c, 0x25, 0xa2, 0x89, 0x24, 0xfc, 0x16, 0x47, 0xeb, 0xa3, 0x9a, 0x5a, 0x7a, 0x50, 0xd0, 0xe7, - 0x25, 0xbb, 0x3a, 0xf1, 0x04, 0xfc, 0xcd, 0xc9, 0x14, 0x47, 0x38, 0xf1, 0x09, 0x7a, 0x18, 0x1b, - 0x4b, 0x4f, 0x1e, 0xae, 0x05, 0xd7, 0xdb, 0xf9, 0x79, 0x04, 0x3a, 0x9f, 0x33, 0x92, 0x11, 0xe4, - 0xe3, 0x14, 0xfb, 0x54, 0xe6, 0x0e, 0xd0, 0x03, 0x6d, 0x8d, 0x8e, 0x4a, 0x50, 0xd9, 0x45, 0x13, - 0x3f, 0xca, 0x02, 0x52, 0x2e, 0x00, 0xd1, 0x64, 0xc6, 0x9c, 0x96, 0x76, 0x77, 0xaf, 0xa4, 0x8a, - 0x45, 0x9c, 0x27, 0x33, 0x06, 0x6d, 0x60, 0x46, 0x38, 0x74, 0x76, 0x34, 0xaf, 0x4a, 0xb5, 0x9e, - 0x08, 0x87, 0x0f, 0xd7, 0xd3, 0xd6, 0x7e, 0xdb, 0x11, 0x0e, 0xb7, 0xd6, 0xd3, 0xfb, 0x6e, 0x80, - 0x8e, 0xce, 0xc5, 0x0d, 0xa7, 0x92, 0xe8, 0x60, 0xd8, 0xc0, 0x5c, 0x90, 0xdc, 0x31, 0xf4, 0x84, - 0x2a, 0xe1, 0x29, 0x68, 0xcc, 0x09, 0x0e, 0x08, 0x57, 0x7f, 0x0e, 0xd3, 0x6d, 0x1d, 0xbb, 0x5b, - 0xc1, 0xdd, 0x9e, 0xef, 0xbf, 0x2d, 0xa4, 0x67, 0x89, 0xe4, 0xb9, 0xb7, 0x1a, 0xdc, 0x88, 0x9b, - 0xb9, 0x19, 0xb7, 0x7f, 0x4e, 0xc0, 0xce, 0xe6, 0xc0, 0x4f, 0x4e, 0xff, 0x13, 0xd4, 0x6e, 0x71, - 0x94, 0x11, 0x1d, 0x45, 0xcb, 0x2b, 0x9a, 0x93, 0xca, 0x4b, 0xa3, 0xf7, 0xcd, 0x2c, 0x2f, 0xef, - 0x91, 0x08, 0xe7, 0xbf, 0x53, 0xfd, 0xab, 0xa6, 0xfa, 0xe8, 0x08, 0x34, 0x57, 0x5f, 0x37, 0xd8, - 0x04, 0xd5, 0xf1, 0xe5, 0xf8, 0xcc, 0xfe, 0x03, 0x5a, 0xa0, 0x76, 0x75, 0x31, 0x3c, 0x1f, 0xdb, - 0x86, 0x2a, 0x27, 0x23, 0x6f, 0xf8, 0xde, 0xae, 0x9c, 0xbe, 0xfe, 0xf4, 0x2a, 0xa4, 0x72, 0x9e, - 0x4d, 0xfb, 0x3e, 0x8b, 0x07, 0x53, 0x2c, 0xfd, 0xb9, 0xcf, 0x78, 0x3a, 0x48, 0xa3, 0x2c, 0x9e, - 0x12, 0xfe, 0x4c, 0xf8, 0x73, 0x12, 0x63, 0x31, 0x98, 0x66, 0x34, 0x0a, 0x06, 0x21, 0x1b, 0x14, - 0x51, 0x1c, 0xa8, 0x28, 0x4e, 0xeb, 0xba, 0x79, 0xfe, 0x23, 0x00, 0x00, 0xff, 0xff, 0x0a, 0xc7, - 0x4a, 0xb4, 0x21, 0x06, 0x00, 0x00, +var File_ps_args_kafka_proto protoreflect.FileDescriptor + +var file_ps_args_kafka_proto_rawDesc = []byte{ + 0x0a, 0x13, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, + 0x67, 0x73, 0x22, 0x8d, 0x02, 0x0a, 0x09, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x43, 0x6f, 0x6e, 0x6e, + 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x74, 0x69, + 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x0e, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x53, 0x65, 0x63, 0x6f, + 0x6e, 0x64, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x5f, 0x74, 0x6c, 0x73, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x75, 0x73, 0x65, 0x54, 0x6c, 0x73, 0x12, 0x26, 0x0a, 0x0f, + 0x74, 0x6c, 0x73, 0x5f, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x74, 0x6c, 0x73, 0x53, 0x6b, 0x69, 0x70, 0x56, 0x65, + 0x72, 0x69, 0x66, 0x79, 0x12, 0x32, 0x0a, 0x09, 0x73, 0x61, 0x73, 0x6c, 0x5f, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x53, 0x41, 0x53, 0x4c, 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, + 0x73, 0x61, 0x73, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x61, 0x73, 0x6c, + 0x5f, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0c, 0x73, 0x61, 0x73, 0x6c, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, + 0x0d, 0x73, 0x61, 0x73, 0x6c, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x61, 0x73, 0x6c, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, + 0x72, 0x64, 0x22, 0x95, 0x04, 0x0a, 0x0d, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x52, 0x65, 0x61, 0x64, + 0x41, 0x72, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x73, 0x12, 0x1f, 0x0a, 0x0b, + 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x0a, 0x72, 0x65, 0x61, 0x64, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x2c, 0x0a, + 0x12, 0x75, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x5f, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x75, 0x73, 0x65, 0x43, 0x6f, + 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x2e, 0x0a, 0x13, 0x63, + 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, + 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x6d, + 0x61, 0x78, 0x5f, 0x77, 0x61, 0x69, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x57, 0x61, 0x69, 0x74, 0x53, 0x65, + 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x62, 0x79, 0x74, + 0x65, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x42, 0x79, 0x74, + 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, + 0x36, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, + 0x61, 0x6c, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x15, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, + 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x3a, 0x0a, 0x19, 0x72, 0x65, 0x62, 0x61, 0x6c, + 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x73, 0x65, 0x63, + 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x17, 0x72, 0x65, 0x62, 0x61, + 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x53, 0x65, 0x63, 0x6f, + 0x6e, 0x64, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x71, 0x75, 0x65, 0x75, 0x65, 0x5f, 0x63, 0x61, 0x70, + 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x71, 0x75, 0x65, + 0x75, 0x65, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x2e, 0x0a, 0x13, 0x69, 0x6e, + 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x5f, 0x69, 0x6e, 0x66, + 0x6f, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, + 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x61, + 0x67, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x6c, 0x61, 0x67, 0x12, 0x2c, 0x0a, 0x12, + 0x6c, 0x61, 0x67, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x5f, 0x67, 0x72, 0x6f, + 0x75, 0x70, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x6e, + 0x73, 0x75, 0x6d, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0xba, 0x01, 0x0a, 0x0e, 0x4b, + 0x61, 0x66, 0x6b, 0x61, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x42, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x28, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4b, + 0x61, 0x66, 0x6b, 0x61, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x2e, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x06, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x73, 0x1a, 0x3a, 0x0a, 0x0c, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xa6, 0x03, 0x0a, 0x0e, 0x4b, 0x61, 0x66, 0x6b, + 0x61, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x41, 0x72, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x6f, + 0x70, 0x69, 0x63, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x74, 0x6f, 0x70, 0x69, + 0x63, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x72, 0x65, 0x61, 0x64, 0x4f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x12, 0x2c, 0x0a, 0x12, 0x75, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x75, + 0x6d, 0x65, 0x72, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x10, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x12, 0x2e, 0x0a, 0x13, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x5f, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, + 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x28, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x5f, 0x77, 0x61, 0x69, 0x74, 0x5f, 0x73, 0x65, + 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x6d, 0x61, 0x78, + 0x57, 0x61, 0x69, 0x74, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, + 0x69, 0x6e, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, + 0x6d, 0x69, 0x6e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, + 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6d, 0x61, 0x78, + 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x15, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x49, 0x6e, + 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x3a, 0x0a, + 0x19, 0x72, 0x65, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, + 0x75, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x17, 0x72, 0x65, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, + 0x75, 0x74, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x71, 0x75, 0x65, + 0x75, 0x65, 0x5f, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x0d, 0x71, 0x75, 0x65, 0x75, 0x65, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, + 0x2a, 0x2a, 0x0a, 0x08, 0x53, 0x41, 0x53, 0x4c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, + 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x50, 0x4c, 0x41, 0x49, 0x4e, 0x10, + 0x01, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x43, 0x52, 0x41, 0x4d, 0x10, 0x02, 0x42, 0x3b, 0x5a, 0x39, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, + 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x61, 0x72, 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_ps_args_kafka_proto_rawDescOnce sync.Once + file_ps_args_kafka_proto_rawDescData = file_ps_args_kafka_proto_rawDesc +) + +func file_ps_args_kafka_proto_rawDescGZIP() []byte { + file_ps_args_kafka_proto_rawDescOnce.Do(func() { + file_ps_args_kafka_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_args_kafka_proto_rawDescData) + }) + return file_ps_args_kafka_proto_rawDescData +} + +var file_ps_args_kafka_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_ps_args_kafka_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_ps_args_kafka_proto_goTypes = []interface{}{ + (SASLType)(0), // 0: protos.args.SASLType + (*KafkaConn)(nil), // 1: protos.args.KafkaConn + (*KafkaReadArgs)(nil), // 2: protos.args.KafkaReadArgs + (*KafkaWriteArgs)(nil), // 3: protos.args.KafkaWriteArgs + (*KafkaRelayArgs)(nil), // 4: protos.args.KafkaRelayArgs + nil, // 5: protos.args.KafkaWriteArgs.HeadersEntry +} +var file_ps_args_kafka_proto_depIdxs = []int32{ + 0, // 0: protos.args.KafkaConn.sasl_type:type_name -> protos.args.SASLType + 5, // 1: protos.args.KafkaWriteArgs.headers:type_name -> protos.args.KafkaWriteArgs.HeadersEntry + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_ps_args_kafka_proto_init() } +func file_ps_args_kafka_proto_init() { + if File_ps_args_kafka_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_args_kafka_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KafkaConn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_kafka_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KafkaReadArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_kafka_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KafkaWriteArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_kafka_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KafkaRelayArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_args_kafka_proto_rawDesc, + NumEnums: 1, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_args_kafka_proto_goTypes, + DependencyIndexes: file_ps_args_kafka_proto_depIdxs, + EnumInfos: file_ps_args_kafka_proto_enumTypes, + MessageInfos: file_ps_args_kafka_proto_msgTypes, + }.Build() + File_ps_args_kafka_proto = out.File + file_ps_args_kafka_proto_rawDesc = nil + file_ps_args_kafka_proto_goTypes = nil + file_ps_args_kafka_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_kubemq_queue.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_kubemq_queue.pb.go index dc0a90b7d..8c2d909fc 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_kubemq_queue.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_kubemq_queue.pb.go @@ -1,26 +1,30 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_args_kubemq_queue.proto package args import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type KubeMQQueueConn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Dial string for KubeMQ server',env='PLUMBER_RELAY_KUBEMQ_QUEUE_ADDRESS',default='localhost:50000',required" Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" kong:"help='Dial string for KubeMQ server',env='PLUMBER_RELAY_KUBEMQ_QUEUE_ADDRESS',default='localhost:50000',required"` // @gotags: kong:"help='Client JWT authentication token',env='PLUMBER_RELAY_KUBEMQ_QUEUE_AUTH_TOKEN'" @@ -28,170 +32,278 @@ type KubeMQQueueConn struct { // @gotags: kong:"help='KubeMQ client cert file',env='PLUMBER_RELAY_KUBEMQ_QUEUE_TLS_CLIENT_CERT'" TlsClientCert string `protobuf:"bytes,3,opt,name=tls_client_cert,json=tlsClientCert,proto3" json:"tls_client_cert,omitempty" kong:"help='KubeMQ client cert file',env='PLUMBER_RELAY_KUBEMQ_QUEUE_TLS_CLIENT_CERT'"` // @gotags: kong:"help='KubeMQ client ID',env='PLUMBER_RELAY_KUBEMQ_QUEUE_CLIENT_ID',default=plumber" - ClientId string `protobuf:"bytes,4,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" kong:"help='KubeMQ client ID',env='PLUMBER_RELAY_KUBEMQ_QUEUE_CLIENT_ID',default=plumber"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ClientId string `protobuf:"bytes,4,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" kong:"help='KubeMQ client ID',env='PLUMBER_RELAY_KUBEMQ_QUEUE_CLIENT_ID',default=plumber"` } -func (m *KubeMQQueueConn) Reset() { *m = KubeMQQueueConn{} } -func (m *KubeMQQueueConn) String() string { return proto.CompactTextString(m) } -func (*KubeMQQueueConn) ProtoMessage() {} -func (*KubeMQQueueConn) Descriptor() ([]byte, []int) { - return fileDescriptor_c6c5d36c3dc96c32, []int{0} +func (x *KubeMQQueueConn) Reset() { + *x = KubeMQQueueConn{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_kubemq_queue_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *KubeMQQueueConn) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_KubeMQQueueConn.Unmarshal(m, b) -} -func (m *KubeMQQueueConn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_KubeMQQueueConn.Marshal(b, m, deterministic) +func (x *KubeMQQueueConn) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *KubeMQQueueConn) XXX_Merge(src proto.Message) { - xxx_messageInfo_KubeMQQueueConn.Merge(m, src) -} -func (m *KubeMQQueueConn) XXX_Size() int { - return xxx_messageInfo_KubeMQQueueConn.Size(m) -} -func (m *KubeMQQueueConn) XXX_DiscardUnknown() { - xxx_messageInfo_KubeMQQueueConn.DiscardUnknown(m) + +func (*KubeMQQueueConn) ProtoMessage() {} + +func (x *KubeMQQueueConn) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_kubemq_queue_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_KubeMQQueueConn proto.InternalMessageInfo +// Deprecated: Use KubeMQQueueConn.ProtoReflect.Descriptor instead. +func (*KubeMQQueueConn) Descriptor() ([]byte, []int) { + return file_ps_args_kubemq_queue_proto_rawDescGZIP(), []int{0} +} -func (m *KubeMQQueueConn) GetAddress() string { - if m != nil { - return m.Address +func (x *KubeMQQueueConn) GetAddress() string { + if x != nil { + return x.Address } return "" } -func (m *KubeMQQueueConn) GetAuthToken() string { - if m != nil { - return m.AuthToken +func (x *KubeMQQueueConn) GetAuthToken() string { + if x != nil { + return x.AuthToken } return "" } -func (m *KubeMQQueueConn) GetTlsClientCert() string { - if m != nil { - return m.TlsClientCert +func (x *KubeMQQueueConn) GetTlsClientCert() string { + if x != nil { + return x.TlsClientCert } return "" } -func (m *KubeMQQueueConn) GetClientId() string { - if m != nil { - return m.ClientId +func (x *KubeMQQueueConn) GetClientId() string { + if x != nil { + return x.ClientId } return "" } type KubeMQQueueReadArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='KubeMQ queue name',env='PLUMBER_RELAY_KUBEMQ_QUEUE_QUEUE'" - QueueName string `protobuf:"bytes,1,opt,name=queue_name,json=queueName,proto3" json:"queue_name,omitempty" kong:"help='KubeMQ queue name',env='PLUMBER_RELAY_KUBEMQ_QUEUE_QUEUE'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + QueueName string `protobuf:"bytes,1,opt,name=queue_name,json=queueName,proto3" json:"queue_name,omitempty" kong:"help='KubeMQ queue name',env='PLUMBER_RELAY_KUBEMQ_QUEUE_QUEUE'"` } -func (m *KubeMQQueueReadArgs) Reset() { *m = KubeMQQueueReadArgs{} } -func (m *KubeMQQueueReadArgs) String() string { return proto.CompactTextString(m) } -func (*KubeMQQueueReadArgs) ProtoMessage() {} -func (*KubeMQQueueReadArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_c6c5d36c3dc96c32, []int{1} +func (x *KubeMQQueueReadArgs) Reset() { + *x = KubeMQQueueReadArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_kubemq_queue_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *KubeMQQueueReadArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_KubeMQQueueReadArgs.Unmarshal(m, b) -} -func (m *KubeMQQueueReadArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_KubeMQQueueReadArgs.Marshal(b, m, deterministic) -} -func (m *KubeMQQueueReadArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_KubeMQQueueReadArgs.Merge(m, src) +func (x *KubeMQQueueReadArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *KubeMQQueueReadArgs) XXX_Size() int { - return xxx_messageInfo_KubeMQQueueReadArgs.Size(m) -} -func (m *KubeMQQueueReadArgs) XXX_DiscardUnknown() { - xxx_messageInfo_KubeMQQueueReadArgs.DiscardUnknown(m) + +func (*KubeMQQueueReadArgs) ProtoMessage() {} + +func (x *KubeMQQueueReadArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_kubemq_queue_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_KubeMQQueueReadArgs proto.InternalMessageInfo +// Deprecated: Use KubeMQQueueReadArgs.ProtoReflect.Descriptor instead. +func (*KubeMQQueueReadArgs) Descriptor() ([]byte, []int) { + return file_ps_args_kubemq_queue_proto_rawDescGZIP(), []int{1} +} -func (m *KubeMQQueueReadArgs) GetQueueName() string { - if m != nil { - return m.QueueName +func (x *KubeMQQueueReadArgs) GetQueueName() string { + if x != nil { + return x.QueueName } return "" } type KubeMQQueueWriteArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='KubeMQ queue name'" - QueueName string `protobuf:"bytes,1,opt,name=queue_name,json=queueName,proto3" json:"queue_name,omitempty" kong:"help='KubeMQ queue name'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + QueueName string `protobuf:"bytes,1,opt,name=queue_name,json=queueName,proto3" json:"queue_name,omitempty" kong:"help='KubeMQ queue name'"` } -func (m *KubeMQQueueWriteArgs) Reset() { *m = KubeMQQueueWriteArgs{} } -func (m *KubeMQQueueWriteArgs) String() string { return proto.CompactTextString(m) } -func (*KubeMQQueueWriteArgs) ProtoMessage() {} -func (*KubeMQQueueWriteArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_c6c5d36c3dc96c32, []int{2} +func (x *KubeMQQueueWriteArgs) Reset() { + *x = KubeMQQueueWriteArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_kubemq_queue_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *KubeMQQueueWriteArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_KubeMQQueueWriteArgs.Unmarshal(m, b) +func (x *KubeMQQueueWriteArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *KubeMQQueueWriteArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_KubeMQQueueWriteArgs.Marshal(b, m, deterministic) + +func (*KubeMQQueueWriteArgs) ProtoMessage() {} + +func (x *KubeMQQueueWriteArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_kubemq_queue_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func (m *KubeMQQueueWriteArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_KubeMQQueueWriteArgs.Merge(m, src) + +// Deprecated: Use KubeMQQueueWriteArgs.ProtoReflect.Descriptor instead. +func (*KubeMQQueueWriteArgs) Descriptor() ([]byte, []int) { + return file_ps_args_kubemq_queue_proto_rawDescGZIP(), []int{2} } -func (m *KubeMQQueueWriteArgs) XXX_Size() int { - return xxx_messageInfo_KubeMQQueueWriteArgs.Size(m) + +func (x *KubeMQQueueWriteArgs) GetQueueName() string { + if x != nil { + return x.QueueName + } + return "" } -func (m *KubeMQQueueWriteArgs) XXX_DiscardUnknown() { - xxx_messageInfo_KubeMQQueueWriteArgs.DiscardUnknown(m) + +var File_ps_args_kubemq_queue_proto protoreflect.FileDescriptor + +var file_ps_args_kubemq_queue_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, + 0x5f, 0x71, 0x75, 0x65, 0x75, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x22, 0x8f, 0x01, 0x0a, 0x0f, 0x4b, 0x75, + 0x62, 0x65, 0x4d, 0x51, 0x51, 0x75, 0x65, 0x75, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x18, 0x0a, + 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x5f, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, + 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x6c, 0x73, 0x5f, 0x63, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0d, 0x74, 0x6c, 0x73, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x65, 0x72, 0x74, 0x12, 0x1b, + 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x34, 0x0a, 0x13, 0x4b, + 0x75, 0x62, 0x65, 0x4d, 0x51, 0x51, 0x75, 0x65, 0x75, 0x65, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, + 0x67, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x71, 0x75, 0x65, 0x75, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x71, 0x75, 0x65, 0x75, 0x65, 0x4e, 0x61, 0x6d, + 0x65, 0x22, 0x35, 0x0a, 0x14, 0x4b, 0x75, 0x62, 0x65, 0x4d, 0x51, 0x51, 0x75, 0x65, 0x75, 0x65, + 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x71, 0x75, 0x65, + 0x75, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x71, + 0x75, 0x65, 0x75, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, + 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, + 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2f, 0x61, 0x72, 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var xxx_messageInfo_KubeMQQueueWriteArgs proto.InternalMessageInfo +var ( + file_ps_args_kubemq_queue_proto_rawDescOnce sync.Once + file_ps_args_kubemq_queue_proto_rawDescData = file_ps_args_kubemq_queue_proto_rawDesc +) -func (m *KubeMQQueueWriteArgs) GetQueueName() string { - if m != nil { - return m.QueueName - } - return "" +func file_ps_args_kubemq_queue_proto_rawDescGZIP() []byte { + file_ps_args_kubemq_queue_proto_rawDescOnce.Do(func() { + file_ps_args_kubemq_queue_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_args_kubemq_queue_proto_rawDescData) + }) + return file_ps_args_kubemq_queue_proto_rawDescData } -func init() { - proto.RegisterType((*KubeMQQueueConn)(nil), "protos.args.KubeMQQueueConn") - proto.RegisterType((*KubeMQQueueReadArgs)(nil), "protos.args.KubeMQQueueReadArgs") - proto.RegisterType((*KubeMQQueueWriteArgs)(nil), "protos.args.KubeMQQueueWriteArgs") -} - -func init() { proto.RegisterFile("ps_args_kubemq_queue.proto", fileDescriptor_c6c5d36c3dc96c32) } - -var fileDescriptor_c6c5d36c3dc96c32 = []byte{ - // 264 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x90, 0x4d, 0x4b, 0xc4, 0x30, - 0x10, 0x86, 0xa9, 0x8a, 0xda, 0x88, 0x2c, 0x54, 0x0f, 0x45, 0x11, 0xa4, 0x07, 0xf1, 0x62, 0x73, - 0x50, 0x0f, 0xe2, 0x49, 0x7b, 0x12, 0x51, 0xd8, 0x45, 0x10, 0xbc, 0x84, 0x7c, 0x0c, 0x6d, 0xd9, - 0x7c, 0x74, 0x93, 0xc9, 0xef, 0xf0, 0x2f, 0x4b, 0xb2, 0x2b, 0xec, 0x71, 0x4f, 0x61, 0x9e, 0x79, - 0x86, 0xcc, 0xbc, 0xe4, 0x62, 0x0a, 0x8c, 0xfb, 0x3e, 0xb0, 0x65, 0x14, 0x60, 0x56, 0x6c, 0x15, - 0x21, 0x42, 0x3b, 0x79, 0x87, 0xae, 0x3a, 0xc9, 0x4f, 0x68, 0x53, 0xbf, 0xf9, 0x2d, 0xc8, 0xec, - 0x3d, 0x0a, 0xf8, 0x98, 0xcf, 0x93, 0xd2, 0x39, 0x6b, 0xab, 0x9a, 0x1c, 0x71, 0xa5, 0x3c, 0x84, - 0x50, 0x17, 0xd7, 0xc5, 0x6d, 0xb9, 0xf8, 0x2f, 0xab, 0x2b, 0x42, 0x78, 0xc4, 0x81, 0xa1, 0x5b, - 0x82, 0xad, 0xf7, 0x72, 0xb3, 0x4c, 0xe4, 0x2b, 0x81, 0xea, 0x86, 0xcc, 0x50, 0x07, 0x26, 0xf5, - 0x08, 0x16, 0x99, 0x04, 0x8f, 0xf5, 0x7e, 0x76, 0x4e, 0x51, 0x87, 0x2e, 0xd3, 0x0e, 0x3c, 0x56, - 0x97, 0xa4, 0xdc, 0x38, 0xa3, 0xaa, 0x0f, 0xb2, 0x71, 0xbc, 0x06, 0x6f, 0xaa, 0x79, 0x20, 0x67, - 0x5b, 0x0b, 0x2d, 0x80, 0xab, 0x17, 0xdf, 0xe7, 0xaf, 0xf3, 0x11, 0xcc, 0x72, 0x03, 0x9b, 0xbd, - 0xca, 0x4c, 0x3e, 0xb9, 0x81, 0xe6, 0x91, 0x9c, 0x6f, 0x4d, 0x7d, 0xfb, 0x11, 0x61, 0x87, 0xb1, - 0xd7, 0xe7, 0x9f, 0xa7, 0x7e, 0xc4, 0x21, 0x8a, 0x56, 0x3a, 0x43, 0x05, 0x47, 0x39, 0x48, 0xe7, - 0x27, 0x3a, 0xe9, 0x68, 0x04, 0xf8, 0xbb, 0x20, 0x07, 0x30, 0x3c, 0x50, 0x11, 0x47, 0xad, 0x68, - 0xef, 0xe8, 0x3a, 0x3b, 0x9a, 0xb2, 0x13, 0x87, 0xb9, 0xb8, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, - 0x74, 0x82, 0x6f, 0x1e, 0x6d, 0x01, 0x00, 0x00, +var file_ps_args_kubemq_queue_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_ps_args_kubemq_queue_proto_goTypes = []interface{}{ + (*KubeMQQueueConn)(nil), // 0: protos.args.KubeMQQueueConn + (*KubeMQQueueReadArgs)(nil), // 1: protos.args.KubeMQQueueReadArgs + (*KubeMQQueueWriteArgs)(nil), // 2: protos.args.KubeMQQueueWriteArgs +} +var file_ps_args_kubemq_queue_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_ps_args_kubemq_queue_proto_init() } +func file_ps_args_kubemq_queue_proto_init() { + if File_ps_args_kubemq_queue_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_args_kubemq_queue_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KubeMQQueueConn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_kubemq_queue_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KubeMQQueueReadArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_kubemq_queue_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KubeMQQueueWriteArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_args_kubemq_queue_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_args_kubemq_queue_proto_goTypes, + DependencyIndexes: file_ps_args_kubemq_queue_proto_depIdxs, + MessageInfos: file_ps_args_kubemq_queue_proto_msgTypes, + }.Build() + File_ps_args_kubemq_queue_proto = out.File + file_ps_args_kubemq_queue_proto_rawDesc = nil + file_ps_args_kubemq_queue_proto_goTypes = nil + file_ps_args_kubemq_queue_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_memphis.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_memphis.pb.go index 964a50b9e..e3587fd5c 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_memphis.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_memphis.pb.go @@ -1,142 +1,162 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_args_memphis.proto package args import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type MemphisConn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Address of Memphis broker (Ex: localhost:6666)',default='localhost:6666'" Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" kong:"help='Address of Memphis broker (Ex: localhost:6666)',default='localhost:6666'"` // @gotags: kong:"help='Broker username',default='plumber'" Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty" kong:"help='Broker username',default='plumber'"` // @gotags: kong:"help='Broker access token',default='memphis'" - BrokerToken string `protobuf:"bytes,3,opt,name=broker_token,json=brokerToken,proto3" json:"broker_token,omitempty" kong:"help='Broker access token',default='memphis'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + BrokerToken string `protobuf:"bytes,3,opt,name=broker_token,json=brokerToken,proto3" json:"broker_token,omitempty" kong:"help='Broker access token',default='memphis'"` } -func (m *MemphisConn) Reset() { *m = MemphisConn{} } -func (m *MemphisConn) String() string { return proto.CompactTextString(m) } -func (*MemphisConn) ProtoMessage() {} -func (*MemphisConn) Descriptor() ([]byte, []int) { - return fileDescriptor_8ff59a42f37d2a3b, []int{0} +func (x *MemphisConn) Reset() { + *x = MemphisConn{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_memphis_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *MemphisConn) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MemphisConn.Unmarshal(m, b) -} -func (m *MemphisConn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MemphisConn.Marshal(b, m, deterministic) +func (x *MemphisConn) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MemphisConn) XXX_Merge(src proto.Message) { - xxx_messageInfo_MemphisConn.Merge(m, src) -} -func (m *MemphisConn) XXX_Size() int { - return xxx_messageInfo_MemphisConn.Size(m) -} -func (m *MemphisConn) XXX_DiscardUnknown() { - xxx_messageInfo_MemphisConn.DiscardUnknown(m) + +func (*MemphisConn) ProtoMessage() {} + +func (x *MemphisConn) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_memphis_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_MemphisConn proto.InternalMessageInfo +// Deprecated: Use MemphisConn.ProtoReflect.Descriptor instead. +func (*MemphisConn) Descriptor() ([]byte, []int) { + return file_ps_args_memphis_proto_rawDescGZIP(), []int{0} +} -func (m *MemphisConn) GetAddress() string { - if m != nil { - return m.Address +func (x *MemphisConn) GetAddress() string { + if x != nil { + return x.Address } return "" } -func (m *MemphisConn) GetUsername() string { - if m != nil { - return m.Username +func (x *MemphisConn) GetUsername() string { + if x != nil { + return x.Username } return "" } -func (m *MemphisConn) GetBrokerToken() string { - if m != nil { - return m.BrokerToken +func (x *MemphisConn) GetBrokerToken() string { + if x != nil { + return x.BrokerToken } return "" } type MemphisReadArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Station name to consume from',required" Station string `protobuf:"bytes,1,opt,name=station,proto3" json:"station,omitempty" kong:"help='Station name to consume from',required"` // @gotags: kong:"help='Consumer Name',default='plumber'" ConsumerName string `protobuf:"bytes,2,opt,name=consumer_name,json=consumerName,proto3" json:"consumer_name,omitempty" kong:"help='Consumer Name',default='plumber'"` // @gotags: kong:"help='Consumer Group, defaults to consumer-name if not specified',env='PLUMBER_RELAY_MEMPHIS_CONSUMER_GROUP'" - ConsumerGroup string `protobuf:"bytes,3,opt,name=consumer_group,json=consumerGroup,proto3" json:"consumer_group,omitempty" kong:"help='Consumer Group, defaults to consumer-name if not specified',env='PLUMBER_RELAY_MEMPHIS_CONSUMER_GROUP'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ConsumerGroup string `protobuf:"bytes,3,opt,name=consumer_group,json=consumerGroup,proto3" json:"consumer_group,omitempty" kong:"help='Consumer Group, defaults to consumer-name if not specified',env='PLUMBER_RELAY_MEMPHIS_CONSUMER_GROUP'"` } -func (m *MemphisReadArgs) Reset() { *m = MemphisReadArgs{} } -func (m *MemphisReadArgs) String() string { return proto.CompactTextString(m) } -func (*MemphisReadArgs) ProtoMessage() {} -func (*MemphisReadArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_8ff59a42f37d2a3b, []int{1} +func (x *MemphisReadArgs) Reset() { + *x = MemphisReadArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_memphis_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *MemphisReadArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MemphisReadArgs.Unmarshal(m, b) -} -func (m *MemphisReadArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MemphisReadArgs.Marshal(b, m, deterministic) -} -func (m *MemphisReadArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_MemphisReadArgs.Merge(m, src) +func (x *MemphisReadArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MemphisReadArgs) XXX_Size() int { - return xxx_messageInfo_MemphisReadArgs.Size(m) -} -func (m *MemphisReadArgs) XXX_DiscardUnknown() { - xxx_messageInfo_MemphisReadArgs.DiscardUnknown(m) + +func (*MemphisReadArgs) ProtoMessage() {} + +func (x *MemphisReadArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_memphis_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_MemphisReadArgs proto.InternalMessageInfo +// Deprecated: Use MemphisReadArgs.ProtoReflect.Descriptor instead. +func (*MemphisReadArgs) Descriptor() ([]byte, []int) { + return file_ps_args_memphis_proto_rawDescGZIP(), []int{1} +} -func (m *MemphisReadArgs) GetStation() string { - if m != nil { - return m.Station +func (x *MemphisReadArgs) GetStation() string { + if x != nil { + return x.Station } return "" } -func (m *MemphisReadArgs) GetConsumerName() string { - if m != nil { - return m.ConsumerName +func (x *MemphisReadArgs) GetConsumerName() string { + if x != nil { + return x.ConsumerName } return "" } -func (m *MemphisReadArgs) GetConsumerGroup() string { - if m != nil { - return m.ConsumerGroup +func (x *MemphisReadArgs) GetConsumerGroup() string { + if x != nil { + return x.ConsumerGroup } return "" } type MemphisWriteArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Station name to write to',required" Station string `protobuf:"bytes,1,opt,name=station,proto3" json:"station,omitempty" kong:"help='Station name to write to',required"` // @gotags: kong:"help='Producer name',default='plumber'" @@ -144,96 +164,197 @@ type MemphisWriteArgs struct { // @gotags: kong:"help='Add one or more headers (optional; repeat flags to specify multiple)'" Headers map[string]string `protobuf:"bytes,3,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" kong:"help='Add one or more headers (optional; repeat flags to specify multiple)'"` // @gotags: kong:"help='ID to give message'" - MessageId string `protobuf:"bytes,4,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty" kong:"help='ID to give message'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + MessageId string `protobuf:"bytes,4,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty" kong:"help='ID to give message'"` } -func (m *MemphisWriteArgs) Reset() { *m = MemphisWriteArgs{} } -func (m *MemphisWriteArgs) String() string { return proto.CompactTextString(m) } -func (*MemphisWriteArgs) ProtoMessage() {} -func (*MemphisWriteArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_8ff59a42f37d2a3b, []int{2} +func (x *MemphisWriteArgs) Reset() { + *x = MemphisWriteArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_memphis_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *MemphisWriteArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MemphisWriteArgs.Unmarshal(m, b) -} -func (m *MemphisWriteArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MemphisWriteArgs.Marshal(b, m, deterministic) -} -func (m *MemphisWriteArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_MemphisWriteArgs.Merge(m, src) +func (x *MemphisWriteArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MemphisWriteArgs) XXX_Size() int { - return xxx_messageInfo_MemphisWriteArgs.Size(m) -} -func (m *MemphisWriteArgs) XXX_DiscardUnknown() { - xxx_messageInfo_MemphisWriteArgs.DiscardUnknown(m) + +func (*MemphisWriteArgs) ProtoMessage() {} + +func (x *MemphisWriteArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_memphis_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_MemphisWriteArgs proto.InternalMessageInfo +// Deprecated: Use MemphisWriteArgs.ProtoReflect.Descriptor instead. +func (*MemphisWriteArgs) Descriptor() ([]byte, []int) { + return file_ps_args_memphis_proto_rawDescGZIP(), []int{2} +} -func (m *MemphisWriteArgs) GetStation() string { - if m != nil { - return m.Station +func (x *MemphisWriteArgs) GetStation() string { + if x != nil { + return x.Station } return "" } -func (m *MemphisWriteArgs) GetProducerName() string { - if m != nil { - return m.ProducerName +func (x *MemphisWriteArgs) GetProducerName() string { + if x != nil { + return x.ProducerName } return "" } -func (m *MemphisWriteArgs) GetHeaders() map[string]string { - if m != nil { - return m.Headers +func (x *MemphisWriteArgs) GetHeaders() map[string]string { + if x != nil { + return x.Headers } return nil } -func (m *MemphisWriteArgs) GetMessageId() string { - if m != nil { - return m.MessageId +func (x *MemphisWriteArgs) GetMessageId() string { + if x != nil { + return x.MessageId } return "" } -func init() { - proto.RegisterType((*MemphisConn)(nil), "protos.args.MemphisConn") - proto.RegisterType((*MemphisReadArgs)(nil), "protos.args.MemphisReadArgs") - proto.RegisterType((*MemphisWriteArgs)(nil), "protos.args.MemphisWriteArgs") - proto.RegisterMapType((map[string]string)(nil), "protos.args.MemphisWriteArgs.HeadersEntry") -} - -func init() { proto.RegisterFile("ps_args_memphis.proto", fileDescriptor_8ff59a42f37d2a3b) } - -var fileDescriptor_8ff59a42f37d2a3b = []byte{ - // 349 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x90, 0x5f, 0x4b, 0xe3, 0x40, - 0x14, 0xc5, 0x49, 0xb3, 0xbb, 0xdd, 0x4e, 0xba, 0xbb, 0x65, 0xd8, 0x85, 0x50, 0x58, 0xa8, 0x15, - 0xa1, 0x08, 0x26, 0xa0, 0x2f, 0x5a, 0x9f, 0xfc, 0x87, 0xfa, 0xa0, 0x0f, 0x45, 0x10, 0x7c, 0x09, - 0x93, 0xcc, 0x35, 0x09, 0xed, 0x64, 0xc2, 0xbd, 0x33, 0x4a, 0xbf, 0xb6, 0x9f, 0x40, 0xf2, 0xaf, - 0x94, 0xbe, 0xf8, 0x94, 0x9c, 0x73, 0xee, 0xe1, 0x77, 0x18, 0xf6, 0xaf, 0xa4, 0x48, 0x60, 0x4a, - 0x91, 0x02, 0x55, 0x66, 0x39, 0x05, 0x25, 0x6a, 0xa3, 0xb9, 0x57, 0x7f, 0x28, 0xa8, 0xa2, 0xe9, - 0x2b, 0xf3, 0x1e, 0x9a, 0xf4, 0x4a, 0x17, 0x05, 0xf7, 0x59, 0x5f, 0x48, 0x89, 0x40, 0xe4, 0x3b, - 0x13, 0x67, 0x36, 0x58, 0x74, 0x92, 0x8f, 0xd9, 0x4f, 0x4b, 0x80, 0x85, 0x50, 0xe0, 0xf7, 0xea, - 0x68, 0xa3, 0xf9, 0x1e, 0x1b, 0xc6, 0xa8, 0x97, 0x80, 0x91, 0xd1, 0x4b, 0x28, 0x7c, 0xb7, 0xce, - 0xbd, 0xc6, 0x7b, 0xaa, 0xac, 0xe9, 0x3b, 0xfb, 0xd3, 0x72, 0x16, 0x20, 0xe4, 0x05, 0xa6, 0x54, - 0xb1, 0xc8, 0x08, 0x93, 0xeb, 0xa2, 0x63, 0xb5, 0x92, 0xef, 0xb3, 0x5f, 0x89, 0x2e, 0xc8, 0x2a, - 0xc0, 0x68, 0x0b, 0x38, 0xec, 0xcc, 0xc7, 0x0a, 0x7a, 0xc0, 0x7e, 0x6f, 0x8e, 0x52, 0xd4, 0xb6, - 0x6c, 0xb1, 0x9b, 0xea, 0x6d, 0x65, 0x4e, 0x3f, 0x1c, 0x36, 0x6a, 0xc9, 0xcf, 0x98, 0x1b, 0xf8, - 0x1a, 0x5d, 0xa2, 0x96, 0x36, 0xd9, 0x41, 0x77, 0x66, 0x8d, 0xbe, 0x66, 0xfd, 0x0c, 0x84, 0x04, - 0x24, 0xdf, 0x9d, 0xb8, 0x33, 0xef, 0xf8, 0x30, 0xd8, 0x7a, 0xd3, 0x60, 0x17, 0x17, 0xdc, 0x35, - 0xc7, 0x37, 0x85, 0xc1, 0xf5, 0xa2, 0xab, 0xf2, 0xff, 0x8c, 0x29, 0x20, 0x12, 0x29, 0x44, 0xb9, - 0xf4, 0xbf, 0xd5, 0x9c, 0x41, 0xeb, 0xdc, 0xcb, 0xf1, 0x9c, 0x0d, 0xb7, 0x7b, 0x7c, 0xc4, 0xdc, - 0x25, 0xac, 0xdb, 0xbd, 0xd5, 0x2f, 0xff, 0xcb, 0xbe, 0xbf, 0x89, 0x95, 0xed, 0x36, 0x36, 0x62, - 0xde, 0x3b, 0x75, 0x2e, 0xcf, 0x5f, 0xce, 0xd2, 0xdc, 0x64, 0x36, 0x0e, 0x12, 0xad, 0xc2, 0x58, - 0x98, 0x24, 0x4b, 0x34, 0x96, 0x61, 0xb9, 0xb2, 0x2a, 0x06, 0x3c, 0xa2, 0x24, 0x03, 0x25, 0x28, - 0x8c, 0x6d, 0xbe, 0x92, 0x61, 0xaa, 0xc3, 0x66, 0x7e, 0x58, 0xcd, 0x8f, 0x7f, 0xd4, 0xe2, 0xe4, - 0x33, 0x00, 0x00, 0xff, 0xff, 0x89, 0xce, 0x37, 0xea, 0x3f, 0x02, 0x00, 0x00, +var File_ps_args_memphis_proto protoreflect.FileDescriptor + +var file_ps_args_memphis_proto_rawDesc = []byte{ + 0x0a, 0x15, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6d, 0x65, 0x6d, 0x70, 0x68, 0x69, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x22, 0x66, 0x0a, 0x0b, 0x4d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x43, + 0x6f, 0x6e, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, + 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x72, 0x6f, + 0x6b, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x77, 0x0a, 0x0f, + 0x4d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x12, + 0x18, 0x0a, 0x07, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, + 0x73, 0x75, 0x6d, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x25, + 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0xf2, 0x01, 0x0a, 0x10, 0x4d, 0x65, 0x6d, 0x70, 0x68, 0x69, + 0x73, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x72, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x72, 0x6f, + 0x64, 0x75, 0x63, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x44, 0x0a, 0x07, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, + 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, + 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, 0x1a, 0x3a, + 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, + 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2f, 0x61, 0x72, 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ps_args_memphis_proto_rawDescOnce sync.Once + file_ps_args_memphis_proto_rawDescData = file_ps_args_memphis_proto_rawDesc +) + +func file_ps_args_memphis_proto_rawDescGZIP() []byte { + file_ps_args_memphis_proto_rawDescOnce.Do(func() { + file_ps_args_memphis_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_args_memphis_proto_rawDescData) + }) + return file_ps_args_memphis_proto_rawDescData +} + +var file_ps_args_memphis_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_ps_args_memphis_proto_goTypes = []interface{}{ + (*MemphisConn)(nil), // 0: protos.args.MemphisConn + (*MemphisReadArgs)(nil), // 1: protos.args.MemphisReadArgs + (*MemphisWriteArgs)(nil), // 2: protos.args.MemphisWriteArgs + nil, // 3: protos.args.MemphisWriteArgs.HeadersEntry +} +var file_ps_args_memphis_proto_depIdxs = []int32{ + 3, // 0: protos.args.MemphisWriteArgs.headers:type_name -> protos.args.MemphisWriteArgs.HeadersEntry + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_ps_args_memphis_proto_init() } +func file_ps_args_memphis_proto_init() { + if File_ps_args_memphis_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_args_memphis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MemphisConn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_memphis_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MemphisReadArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_memphis_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MemphisWriteArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_args_memphis_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_args_memphis_proto_goTypes, + DependencyIndexes: file_ps_args_memphis_proto_depIdxs, + MessageInfos: file_ps_args_memphis_proto_msgTypes, + }.Build() + File_ps_args_memphis_proto = out.File + file_ps_args_memphis_proto_rawDesc = nil + file_ps_args_memphis_proto_goTypes = nil + file_ps_args_memphis_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_mongo.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_mongo.pb.go index 9aa6fc612..c6a2d021f 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_mongo.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_mongo.pb.go @@ -1,144 +1,233 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_args_mongo.proto package args import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type MongoConn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Dial string for mongo server (Ex: mongodb://localhost:27017)',env='PLUMBER_RELAY_CDCMONGO_DSN',default='mongodb://localhost:27017'" - Dsn string `protobuf:"bytes,1,opt,name=dsn,proto3" json:"dsn,omitempty" kong:"help='Dial string for mongo server (Ex: mongodb://localhost:27017)',env='PLUMBER_RELAY_CDCMONGO_DSN',default='mongodb://localhost:27017'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Dsn string `protobuf:"bytes,1,opt,name=dsn,proto3" json:"dsn,omitempty" kong:"help='Dial string for mongo server (Ex: mongodb://localhost:27017)',env='PLUMBER_RELAY_CDCMONGO_DSN',default='mongodb://localhost:27017'"` } -func (m *MongoConn) Reset() { *m = MongoConn{} } -func (m *MongoConn) String() string { return proto.CompactTextString(m) } -func (*MongoConn) ProtoMessage() {} -func (*MongoConn) Descriptor() ([]byte, []int) { - return fileDescriptor_ddb675a156ea8339, []int{0} +func (x *MongoConn) Reset() { + *x = MongoConn{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_mongo_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *MongoConn) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MongoConn.Unmarshal(m, b) +func (x *MongoConn) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MongoConn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MongoConn.Marshal(b, m, deterministic) -} -func (m *MongoConn) XXX_Merge(src proto.Message) { - xxx_messageInfo_MongoConn.Merge(m, src) -} -func (m *MongoConn) XXX_Size() int { - return xxx_messageInfo_MongoConn.Size(m) -} -func (m *MongoConn) XXX_DiscardUnknown() { - xxx_messageInfo_MongoConn.DiscardUnknown(m) + +func (*MongoConn) ProtoMessage() {} + +func (x *MongoConn) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_mongo_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_MongoConn proto.InternalMessageInfo +// Deprecated: Use MongoConn.ProtoReflect.Descriptor instead. +func (*MongoConn) Descriptor() ([]byte, []int) { + return file_ps_args_mongo_proto_rawDescGZIP(), []int{0} +} -func (m *MongoConn) GetDsn() string { - if m != nil { - return m.Dsn +func (x *MongoConn) GetDsn() string { + if x != nil { + return x.Dsn } return "" } type MongoReadArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Database name',env='PLUMBER_RELAY_CDCMONGO_DATABASE'" Database string `protobuf:"bytes,1,opt,name=database,proto3" json:"database,omitempty" kong:"help='Database name',env='PLUMBER_RELAY_CDCMONGO_DATABASE'"` // @gotags: kong:"help='Collection name',env='PLUMBER_RELAY_CDCMONGO_COLLECTION'" Collection string `protobuf:"bytes,2,opt,name=collection,proto3" json:"collection,omitempty" kong:"help='Collection name',env='PLUMBER_RELAY_CDCMONGO_COLLECTION'"` // @gotags: kong:"help='Include full document in update in update changes (default - return deltas only)',env='PLUMBER_RELAY_CDCMONGO_INCLUDE_FULL_DOC'" - IncludeFullDocument bool `protobuf:"varint,3,opt,name=include_full_document,json=includeFullDocument,proto3" json:"include_full_document,omitempty" kong:"help='Include full document in update in update changes (default - return deltas only)',env='PLUMBER_RELAY_CDCMONGO_INCLUDE_FULL_DOC'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + IncludeFullDocument bool `protobuf:"varint,3,opt,name=include_full_document,json=includeFullDocument,proto3" json:"include_full_document,omitempty" kong:"help='Include full document in update in update changes (default - return deltas only)',env='PLUMBER_RELAY_CDCMONGO_INCLUDE_FULL_DOC'"` } -func (m *MongoReadArgs) Reset() { *m = MongoReadArgs{} } -func (m *MongoReadArgs) String() string { return proto.CompactTextString(m) } -func (*MongoReadArgs) ProtoMessage() {} -func (*MongoReadArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_ddb675a156ea8339, []int{1} +func (x *MongoReadArgs) Reset() { + *x = MongoReadArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_mongo_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *MongoReadArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MongoReadArgs.Unmarshal(m, b) -} -func (m *MongoReadArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MongoReadArgs.Marshal(b, m, deterministic) +func (x *MongoReadArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MongoReadArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_MongoReadArgs.Merge(m, src) -} -func (m *MongoReadArgs) XXX_Size() int { - return xxx_messageInfo_MongoReadArgs.Size(m) -} -func (m *MongoReadArgs) XXX_DiscardUnknown() { - xxx_messageInfo_MongoReadArgs.DiscardUnknown(m) + +func (*MongoReadArgs) ProtoMessage() {} + +func (x *MongoReadArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_mongo_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_MongoReadArgs proto.InternalMessageInfo +// Deprecated: Use MongoReadArgs.ProtoReflect.Descriptor instead. +func (*MongoReadArgs) Descriptor() ([]byte, []int) { + return file_ps_args_mongo_proto_rawDescGZIP(), []int{1} +} -func (m *MongoReadArgs) GetDatabase() string { - if m != nil { - return m.Database +func (x *MongoReadArgs) GetDatabase() string { + if x != nil { + return x.Database } return "" } -func (m *MongoReadArgs) GetCollection() string { - if m != nil { - return m.Collection +func (x *MongoReadArgs) GetCollection() string { + if x != nil { + return x.Collection } return "" } -func (m *MongoReadArgs) GetIncludeFullDocument() bool { - if m != nil { - return m.IncludeFullDocument +func (x *MongoReadArgs) GetIncludeFullDocument() bool { + if x != nil { + return x.IncludeFullDocument } return false } -func init() { - proto.RegisterType((*MongoConn)(nil), "protos.args.MongoConn") - proto.RegisterType((*MongoReadArgs)(nil), "protos.args.MongoReadArgs") -} - -func init() { proto.RegisterFile("ps_args_mongo.proto", fileDescriptor_ddb675a156ea8339) } - -var fileDescriptor_ddb675a156ea8339 = []byte{ - // 221 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0xcf, 0x4f, 0x4b, 0xc4, 0x30, - 0x10, 0x05, 0x70, 0xea, 0x82, 0xec, 0x46, 0x04, 0xc9, 0x22, 0x14, 0x41, 0x59, 0xf6, 0xd4, 0x8b, - 0x0d, 0xe8, 0x49, 0x3c, 0xf9, 0x07, 0x6f, 0x5e, 0x7a, 0xf4, 0x52, 0x92, 0x49, 0x4c, 0x0b, 0x93, - 0x4c, 0xc9, 0x24, 0x67, 0xbf, 0xba, 0xb4, 0x16, 0xd9, 0xd3, 0xcc, 0x9b, 0xdf, 0x5c, 0x9e, 0xd8, - 0x4f, 0xdc, 0xeb, 0xe4, 0xb9, 0x0f, 0x14, 0x3d, 0xb5, 0x53, 0xa2, 0x4c, 0xf2, 0x62, 0x19, 0xdc, - 0xce, 0x70, 0xbc, 0x15, 0xbb, 0xcf, 0xd9, 0xde, 0x28, 0x46, 0x79, 0x25, 0x36, 0x96, 0x63, 0x5d, - 0x1d, 0xaa, 0x66, 0xd7, 0xcd, 0xeb, 0xf1, 0x47, 0x5c, 0x2e, 0xdc, 0x39, 0x6d, 0x5f, 0x92, 0x67, - 0x79, 0x23, 0xb6, 0x56, 0x67, 0x6d, 0x34, 0xbb, 0xf5, 0xef, 0x3f, 0xcb, 0x3b, 0x21, 0x80, 0x10, - 0x1d, 0xe4, 0x91, 0x62, 0x7d, 0xb6, 0xe8, 0xc9, 0x45, 0x3e, 0x88, 0xeb, 0x31, 0x02, 0x16, 0xeb, - 0xfa, 0xef, 0x82, 0xd8, 0x5b, 0x82, 0x12, 0x5c, 0xcc, 0xf5, 0xe6, 0x50, 0x35, 0xdb, 0x6e, 0xbf, - 0xe2, 0x47, 0x41, 0x7c, 0x5f, 0xe9, 0xf5, 0xf9, 0xeb, 0xc9, 0x8f, 0x79, 0x28, 0xa6, 0x05, 0x0a, - 0xca, 0xe8, 0x0c, 0x03, 0x50, 0x9a, 0xd4, 0x84, 0x25, 0x18, 0x97, 0xee, 0x19, 0x06, 0x17, 0x34, - 0x2b, 0x53, 0x46, 0xb4, 0xca, 0x93, 0xfa, 0x2b, 0xa7, 0xe6, 0x72, 0xe6, 0x7c, 0x09, 0x8f, 0xbf, - 0x01, 0x00, 0x00, 0xff, 0xff, 0x18, 0x18, 0x95, 0xfe, 0x07, 0x01, 0x00, 0x00, +var File_ps_args_mongo_proto protoreflect.FileDescriptor + +var file_ps_args_mongo_proto_rawDesc = []byte{ + 0x0a, 0x13, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, + 0x67, 0x73, 0x22, 0x1d, 0x0a, 0x09, 0x4d, 0x6f, 0x6e, 0x67, 0x6f, 0x43, 0x6f, 0x6e, 0x6e, 0x12, + 0x10, 0x0a, 0x03, 0x64, 0x73, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x73, + 0x6e, 0x22, 0x7f, 0x0a, 0x0d, 0x4d, 0x6f, 0x6e, 0x67, 0x6f, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, + 0x67, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x1e, + 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x32, + 0x0a, 0x15, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x64, + 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x69, + 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x46, 0x75, 0x6c, 0x6c, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, + 0x6e, 0x74, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, + 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x61, 0x72, 0x67, 0x73, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ps_args_mongo_proto_rawDescOnce sync.Once + file_ps_args_mongo_proto_rawDescData = file_ps_args_mongo_proto_rawDesc +) + +func file_ps_args_mongo_proto_rawDescGZIP() []byte { + file_ps_args_mongo_proto_rawDescOnce.Do(func() { + file_ps_args_mongo_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_args_mongo_proto_rawDescData) + }) + return file_ps_args_mongo_proto_rawDescData +} + +var file_ps_args_mongo_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_ps_args_mongo_proto_goTypes = []interface{}{ + (*MongoConn)(nil), // 0: protos.args.MongoConn + (*MongoReadArgs)(nil), // 1: protos.args.MongoReadArgs +} +var file_ps_args_mongo_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_ps_args_mongo_proto_init() } +func file_ps_args_mongo_proto_init() { + if File_ps_args_mongo_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_args_mongo_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MongoConn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_mongo_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MongoReadArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_args_mongo_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_args_mongo_proto_goTypes, + DependencyIndexes: file_ps_args_mongo_proto_depIdxs, + MessageInfos: file_ps_args_mongo_proto_msgTypes, + }.Build() + File_ps_args_mongo_proto = out.File + file_ps_args_mongo_proto_rawDesc = nil + file_ps_args_mongo_proto_goTypes = nil + file_ps_args_mongo_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_mqtt.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_mqtt.pb.go index d2a03dd8f..79b81b671 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_mqtt.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_mqtt.pb.go @@ -1,24 +1,24 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_args_mqtt.proto package args import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type MQTTQoSLevel int32 @@ -28,27 +28,52 @@ const ( MQTTQoSLevel_MQTT_QOS_LEVEL_EXACTLY_ONCE MQTTQoSLevel = 2 ) -var MQTTQoSLevel_name = map[int32]string{ - 0: "MQTT_QOS_LEVEL_AT_MOST_ONCE", - 1: "MQTT_QOS_LEVEL_AT_LEAST_ONCE", - 2: "MQTT_QOS_LEVEL_EXACTLY_ONCE", -} +// Enum value maps for MQTTQoSLevel. +var ( + MQTTQoSLevel_name = map[int32]string{ + 0: "MQTT_QOS_LEVEL_AT_MOST_ONCE", + 1: "MQTT_QOS_LEVEL_AT_LEAST_ONCE", + 2: "MQTT_QOS_LEVEL_EXACTLY_ONCE", + } + MQTTQoSLevel_value = map[string]int32{ + "MQTT_QOS_LEVEL_AT_MOST_ONCE": 0, + "MQTT_QOS_LEVEL_AT_LEAST_ONCE": 1, + "MQTT_QOS_LEVEL_EXACTLY_ONCE": 2, + } +) -var MQTTQoSLevel_value = map[string]int32{ - "MQTT_QOS_LEVEL_AT_MOST_ONCE": 0, - "MQTT_QOS_LEVEL_AT_LEAST_ONCE": 1, - "MQTT_QOS_LEVEL_EXACTLY_ONCE": 2, +func (x MQTTQoSLevel) Enum() *MQTTQoSLevel { + p := new(MQTTQoSLevel) + *p = x + return p } func (x MQTTQoSLevel) String() string { - return proto.EnumName(MQTTQoSLevel_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (MQTTQoSLevel) Descriptor() protoreflect.EnumDescriptor { + return file_ps_args_mqtt_proto_enumTypes[0].Descriptor() +} + +func (MQTTQoSLevel) Type() protoreflect.EnumType { + return &file_ps_args_mqtt_proto_enumTypes[0] +} + +func (x MQTTQoSLevel) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) } +// Deprecated: Use MQTTQoSLevel.Descriptor instead. func (MQTTQoSLevel) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_11ff87d0ae52f3d2, []int{0} + return file_ps_args_mqtt_proto_rawDescGZIP(), []int{0} } type MQTTTLSOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='CA cert (only needed if addr is ssl://)',env=PLUMBER_RELAY_MQTT_TLS_CA_CERT" TlsCaCert string `protobuf:"bytes,1,opt,name=tls_ca_cert,json=tlsCaCert,proto3" json:"tls_ca_cert,omitempty" kong:"help='CA cert (only needed if addr is ssl://)',env=PLUMBER_RELAY_MQTT_TLS_CA_CERT"` // @gotags: kong:"help='Client cert file (only needed if addr is ssl://)',env=PLUMBER_RELAY_MQTT_TLS_CLIENT_CERT" @@ -56,66 +81,74 @@ type MQTTTLSOptions struct { // @gotags: kong:"help='Client key file (only needed if addr is ssl://)',env=PLUMBER_RELAY_MQTT_TLS_CLIENT_KEY" TlsClientKey string `protobuf:"bytes,3,opt,name=tls_client_key,json=tlsClientKey,proto3" json:"tls_client_key,omitempty" kong:"help='Client key file (only needed if addr is ssl://)',env=PLUMBER_RELAY_MQTT_TLS_CLIENT_KEY"` // @gotags: kong:"help='Whether to verify server certificate',env=PLUMBER_RELAY_MQTT_SKIP_VERIFY_TLS" - TlsSkipVerify bool `protobuf:"varint,4,opt,name=tls_skip_verify,json=tlsSkipVerify,proto3" json:"tls_skip_verify,omitempty" kong:"help='Whether to verify server certificate',env=PLUMBER_RELAY_MQTT_SKIP_VERIFY_TLS"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + TlsSkipVerify bool `protobuf:"varint,4,opt,name=tls_skip_verify,json=tlsSkipVerify,proto3" json:"tls_skip_verify,omitempty" kong:"help='Whether to verify server certificate',env=PLUMBER_RELAY_MQTT_SKIP_VERIFY_TLS"` } -func (m *MQTTTLSOptions) Reset() { *m = MQTTTLSOptions{} } -func (m *MQTTTLSOptions) String() string { return proto.CompactTextString(m) } -func (*MQTTTLSOptions) ProtoMessage() {} -func (*MQTTTLSOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_11ff87d0ae52f3d2, []int{0} +func (x *MQTTTLSOptions) Reset() { + *x = MQTTTLSOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_mqtt_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *MQTTTLSOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MQTTTLSOptions.Unmarshal(m, b) +func (x *MQTTTLSOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MQTTTLSOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MQTTTLSOptions.Marshal(b, m, deterministic) -} -func (m *MQTTTLSOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_MQTTTLSOptions.Merge(m, src) -} -func (m *MQTTTLSOptions) XXX_Size() int { - return xxx_messageInfo_MQTTTLSOptions.Size(m) -} -func (m *MQTTTLSOptions) XXX_DiscardUnknown() { - xxx_messageInfo_MQTTTLSOptions.DiscardUnknown(m) + +func (*MQTTTLSOptions) ProtoMessage() {} + +func (x *MQTTTLSOptions) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_mqtt_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_MQTTTLSOptions proto.InternalMessageInfo +// Deprecated: Use MQTTTLSOptions.ProtoReflect.Descriptor instead. +func (*MQTTTLSOptions) Descriptor() ([]byte, []int) { + return file_ps_args_mqtt_proto_rawDescGZIP(), []int{0} +} -func (m *MQTTTLSOptions) GetTlsCaCert() string { - if m != nil { - return m.TlsCaCert +func (x *MQTTTLSOptions) GetTlsCaCert() string { + if x != nil { + return x.TlsCaCert } return "" } -func (m *MQTTTLSOptions) GetTlsClientCert() string { - if m != nil { - return m.TlsClientCert +func (x *MQTTTLSOptions) GetTlsClientCert() string { + if x != nil { + return x.TlsClientCert } return "" } -func (m *MQTTTLSOptions) GetTlsClientKey() string { - if m != nil { - return m.TlsClientKey +func (x *MQTTTLSOptions) GetTlsClientKey() string { + if x != nil { + return x.TlsClientKey } return "" } -func (m *MQTTTLSOptions) GetTlsSkipVerify() bool { - if m != nil { - return m.TlsSkipVerify +func (x *MQTTTLSOptions) GetTlsSkipVerify() bool { + if x != nil { + return x.TlsSkipVerify } return false } type MQTTConn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='MQTT address',default='tcp://localhost:1883',env='PLUMBER_RELAY_MQTT_ADDRESS',required" Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" kong:"help='MQTT address',default='tcp://localhost:1883',env='PLUMBER_RELAY_MQTT_ADDRESS',required"` // @gotags: kong:"help='How long to attempt to connect for',env='PLUMBER_RELAY_MQTT_CONNECT_TIMEOUT',default=5" @@ -125,210 +158,349 @@ type MQTTConn struct { // @gotags: kong:"help='QoS level to use for pub/sub (options: at_most_once, at_least_once, exactly_once)',env=PLUMBER_RELAY_MQTT_QOS,type=pbenum,pbenum_strip_prefix=MQTT_QOS_LEVEL_,pbenum_lowercase,default=at_most_once" QosLevel MQTTQoSLevel `protobuf:"varint,5,opt,name=qos_level,json=qosLevel,proto3,enum=protos.args.MQTTQoSLevel" json:"qos_level,omitempty" kong:"help='QoS level to use for pub/sub (options: at_most_once, at_least_once, exactly_once)',env=PLUMBER_RELAY_MQTT_QOS,type=pbenum,pbenum_strip_prefix=MQTT_QOS_LEVEL_,pbenum_lowercase,default=at_most_once"` // @gotags: kong:"embed" - TlsOptions *MQTTTLSOptions `protobuf:"bytes,6,opt,name=tls_options,json=tlsOptions,proto3" json:"tls_options,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + TlsOptions *MQTTTLSOptions `protobuf:"bytes,6,opt,name=tls_options,json=tlsOptions,proto3" json:"tls_options,omitempty" kong:"embed"` } -func (m *MQTTConn) Reset() { *m = MQTTConn{} } -func (m *MQTTConn) String() string { return proto.CompactTextString(m) } -func (*MQTTConn) ProtoMessage() {} -func (*MQTTConn) Descriptor() ([]byte, []int) { - return fileDescriptor_11ff87d0ae52f3d2, []int{1} +func (x *MQTTConn) Reset() { + *x = MQTTConn{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_mqtt_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *MQTTConn) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MQTTConn.Unmarshal(m, b) -} -func (m *MQTTConn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MQTTConn.Marshal(b, m, deterministic) +func (x *MQTTConn) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MQTTConn) XXX_Merge(src proto.Message) { - xxx_messageInfo_MQTTConn.Merge(m, src) -} -func (m *MQTTConn) XXX_Size() int { - return xxx_messageInfo_MQTTConn.Size(m) -} -func (m *MQTTConn) XXX_DiscardUnknown() { - xxx_messageInfo_MQTTConn.DiscardUnknown(m) + +func (*MQTTConn) ProtoMessage() {} + +func (x *MQTTConn) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_mqtt_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_MQTTConn proto.InternalMessageInfo +// Deprecated: Use MQTTConn.ProtoReflect.Descriptor instead. +func (*MQTTConn) Descriptor() ([]byte, []int) { + return file_ps_args_mqtt_proto_rawDescGZIP(), []int{1} +} -func (m *MQTTConn) GetAddress() string { - if m != nil { - return m.Address +func (x *MQTTConn) GetAddress() string { + if x != nil { + return x.Address } return "" } -func (m *MQTTConn) GetConnTimeoutSeconds() uint32 { - if m != nil { - return m.ConnTimeoutSeconds +func (x *MQTTConn) GetConnTimeoutSeconds() uint32 { + if x != nil { + return x.ConnTimeoutSeconds } return 0 } -func (m *MQTTConn) GetClientId() string { - if m != nil { - return m.ClientId +func (x *MQTTConn) GetClientId() string { + if x != nil { + return x.ClientId } return "" } -func (m *MQTTConn) GetQosLevel() MQTTQoSLevel { - if m != nil { - return m.QosLevel +func (x *MQTTConn) GetQosLevel() MQTTQoSLevel { + if x != nil { + return x.QosLevel } return MQTTQoSLevel_MQTT_QOS_LEVEL_AT_MOST_ONCE } -func (m *MQTTConn) GetTlsOptions() *MQTTTLSOptions { - if m != nil { - return m.TlsOptions +func (x *MQTTConn) GetTlsOptions() *MQTTTLSOptions { + if x != nil { + return x.TlsOptions } return nil } type MQTTReadArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Topic to read message(s) from',env='PLUMBER_RELAY_MQTT_TOPIC',required" Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty" kong:"help='Topic to read message(s) from',env='PLUMBER_RELAY_MQTT_TOPIC',required"` // @gotags: kong:"help='How long to attempt to read message(s)',default=0,env='PLUMBER_RELAY_MQTT_READ_TIMEOUT_SECONDS'" - ReadTimeoutSeconds uint32 `protobuf:"varint,2,opt,name=read_timeout_seconds,json=readTimeoutSeconds,proto3" json:"read_timeout_seconds,omitempty" kong:"help='How long to attempt to read message(s)',default=0,env='PLUMBER_RELAY_MQTT_READ_TIMEOUT_SECONDS'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ReadTimeoutSeconds uint32 `protobuf:"varint,2,opt,name=read_timeout_seconds,json=readTimeoutSeconds,proto3" json:"read_timeout_seconds,omitempty" kong:"help='How long to attempt to read message(s)',default=0,env='PLUMBER_RELAY_MQTT_READ_TIMEOUT_SECONDS'"` } -func (m *MQTTReadArgs) Reset() { *m = MQTTReadArgs{} } -func (m *MQTTReadArgs) String() string { return proto.CompactTextString(m) } -func (*MQTTReadArgs) ProtoMessage() {} -func (*MQTTReadArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_11ff87d0ae52f3d2, []int{2} +func (x *MQTTReadArgs) Reset() { + *x = MQTTReadArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_mqtt_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *MQTTReadArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MQTTReadArgs.Unmarshal(m, b) -} -func (m *MQTTReadArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MQTTReadArgs.Marshal(b, m, deterministic) +func (x *MQTTReadArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MQTTReadArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_MQTTReadArgs.Merge(m, src) -} -func (m *MQTTReadArgs) XXX_Size() int { - return xxx_messageInfo_MQTTReadArgs.Size(m) -} -func (m *MQTTReadArgs) XXX_DiscardUnknown() { - xxx_messageInfo_MQTTReadArgs.DiscardUnknown(m) + +func (*MQTTReadArgs) ProtoMessage() {} + +func (x *MQTTReadArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_mqtt_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_MQTTReadArgs proto.InternalMessageInfo +// Deprecated: Use MQTTReadArgs.ProtoReflect.Descriptor instead. +func (*MQTTReadArgs) Descriptor() ([]byte, []int) { + return file_ps_args_mqtt_proto_rawDescGZIP(), []int{2} +} -func (m *MQTTReadArgs) GetTopic() string { - if m != nil { - return m.Topic +func (x *MQTTReadArgs) GetTopic() string { + if x != nil { + return x.Topic } return "" } -func (m *MQTTReadArgs) GetReadTimeoutSeconds() uint32 { - if m != nil { - return m.ReadTimeoutSeconds +func (x *MQTTReadArgs) GetReadTimeoutSeconds() uint32 { + if x != nil { + return x.ReadTimeoutSeconds } return 0 } type MQTTWriteArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Topic to write message(s) to',required" Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty" kong:"help='Topic to write message(s) to',required"` // @gotags: kong:"help='How long to attempt to publish message(s)',default=5" - WriteTimeoutSeconds uint32 `protobuf:"varint,2,opt,name=write_timeout_seconds,json=writeTimeoutSeconds,proto3" json:"write_timeout_seconds,omitempty" kong:"help='How long to attempt to publish message(s)',default=5"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + WriteTimeoutSeconds uint32 `protobuf:"varint,2,opt,name=write_timeout_seconds,json=writeTimeoutSeconds,proto3" json:"write_timeout_seconds,omitempty" kong:"help='How long to attempt to publish message(s)',default=5"` } -func (m *MQTTWriteArgs) Reset() { *m = MQTTWriteArgs{} } -func (m *MQTTWriteArgs) String() string { return proto.CompactTextString(m) } -func (*MQTTWriteArgs) ProtoMessage() {} -func (*MQTTWriteArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_11ff87d0ae52f3d2, []int{3} +func (x *MQTTWriteArgs) Reset() { + *x = MQTTWriteArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_mqtt_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *MQTTWriteArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MQTTWriteArgs.Unmarshal(m, b) -} -func (m *MQTTWriteArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MQTTWriteArgs.Marshal(b, m, deterministic) +func (x *MQTTWriteArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MQTTWriteArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_MQTTWriteArgs.Merge(m, src) -} -func (m *MQTTWriteArgs) XXX_Size() int { - return xxx_messageInfo_MQTTWriteArgs.Size(m) -} -func (m *MQTTWriteArgs) XXX_DiscardUnknown() { - xxx_messageInfo_MQTTWriteArgs.DiscardUnknown(m) + +func (*MQTTWriteArgs) ProtoMessage() {} + +func (x *MQTTWriteArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_mqtt_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_MQTTWriteArgs proto.InternalMessageInfo +// Deprecated: Use MQTTWriteArgs.ProtoReflect.Descriptor instead. +func (*MQTTWriteArgs) Descriptor() ([]byte, []int) { + return file_ps_args_mqtt_proto_rawDescGZIP(), []int{3} +} -func (m *MQTTWriteArgs) GetTopic() string { - if m != nil { - return m.Topic +func (x *MQTTWriteArgs) GetTopic() string { + if x != nil { + return x.Topic } return "" } -func (m *MQTTWriteArgs) GetWriteTimeoutSeconds() uint32 { - if m != nil { - return m.WriteTimeoutSeconds +func (x *MQTTWriteArgs) GetWriteTimeoutSeconds() uint32 { + if x != nil { + return x.WriteTimeoutSeconds } return 0 } -func init() { - proto.RegisterEnum("protos.args.MQTTQoSLevel", MQTTQoSLevel_name, MQTTQoSLevel_value) - proto.RegisterType((*MQTTTLSOptions)(nil), "protos.args.MQTTTLSOptions") - proto.RegisterType((*MQTTConn)(nil), "protos.args.MQTTConn") - proto.RegisterType((*MQTTReadArgs)(nil), "protos.args.MQTTReadArgs") - proto.RegisterType((*MQTTWriteArgs)(nil), "protos.args.MQTTWriteArgs") -} - -func init() { proto.RegisterFile("ps_args_mqtt.proto", fileDescriptor_11ff87d0ae52f3d2) } - -var fileDescriptor_11ff87d0ae52f3d2 = []byte{ - // 472 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0xd1, 0x8a, 0xd3, 0x40, - 0x14, 0x86, 0x4d, 0x75, 0xd7, 0x66, 0xba, 0xad, 0x32, 0xae, 0x10, 0xa9, 0x68, 0x28, 0x22, 0x45, - 0x30, 0x91, 0x0a, 0x82, 0xe8, 0x4d, 0x0d, 0xb9, 0x10, 0xb3, 0x96, 0x26, 0xa1, 0xba, 0xde, 0x0c, - 0xc9, 0x64, 0x6c, 0x87, 0x26, 0x99, 0x74, 0x66, 0xba, 0xd2, 0x17, 0xf2, 0xdd, 0x7c, 0x0b, 0x99, - 0x99, 0x46, 0xb7, 0x54, 0xf7, 0x2a, 0x73, 0xce, 0xff, 0xe5, 0x3f, 0xe7, 0xfc, 0x00, 0x36, 0x02, - 0x65, 0x7c, 0x29, 0x50, 0xb5, 0x91, 0xd2, 0x6b, 0x38, 0x93, 0x0c, 0xf6, 0xf4, 0x47, 0x78, 0xaa, - 0x3f, 0xfa, 0x69, 0x81, 0xc1, 0xc5, 0x3c, 0x4d, 0xd3, 0x28, 0x99, 0x35, 0x92, 0xb2, 0x5a, 0xc0, - 0x27, 0xa0, 0x27, 0x4b, 0x81, 0x70, 0x86, 0x30, 0xe1, 0xd2, 0xb1, 0x5c, 0x6b, 0x6c, 0xc7, 0xb6, - 0x2c, 0x45, 0x90, 0x05, 0x84, 0x4b, 0xf8, 0x1c, 0xdc, 0xd3, 0x7a, 0x49, 0x49, 0x2d, 0x0d, 0xd3, - 0xd1, 0x4c, 0x5f, 0x31, 0xba, 0xab, 0xb9, 0x67, 0x60, 0x70, 0x8d, 0x5b, 0x93, 0x9d, 0x73, 0x5b, - 0x63, 0x67, 0x7f, 0xb0, 0x4f, 0x64, 0xd7, 0xba, 0x89, 0x35, 0x6d, 0xd0, 0x15, 0xe1, 0xf4, 0xfb, - 0xce, 0xb9, 0xe3, 0x5a, 0xe3, 0xae, 0x76, 0x4b, 0xd6, 0xb4, 0x59, 0xe8, 0xe6, 0xe8, 0x97, 0x05, - 0xba, 0x6a, 0xd1, 0x80, 0xd5, 0x35, 0x74, 0xc0, 0xdd, 0xac, 0x28, 0x38, 0x11, 0x62, 0xbf, 0x5e, - 0x5b, 0xc2, 0x57, 0xe0, 0x1c, 0xb3, 0xba, 0x46, 0x92, 0x56, 0x84, 0x6d, 0x25, 0x12, 0x04, 0xb3, - 0xba, 0x10, 0x7a, 0x74, 0x3f, 0x86, 0x4a, 0x4b, 0x8d, 0x94, 0x18, 0x05, 0x0e, 0x81, 0xbd, 0x5f, - 0x91, 0x16, 0x7a, 0xb4, 0x1d, 0x77, 0x4d, 0xe3, 0x63, 0x01, 0xdf, 0x00, 0x7b, 0xc3, 0x04, 0x2a, - 0xc9, 0x15, 0x29, 0x9d, 0x13, 0xd7, 0x1a, 0x0f, 0x26, 0x8f, 0xbc, 0x6b, 0xf9, 0x79, 0x6a, 0xa5, - 0x39, 0x4b, 0x22, 0x05, 0xc4, 0xdd, 0x0d, 0x13, 0xfa, 0x05, 0xdf, 0x9b, 0x0c, 0x99, 0x89, 0xd4, - 0x39, 0x75, 0xad, 0x71, 0x6f, 0x32, 0x3c, 0xfa, 0xf3, 0x6f, 0xea, 0x31, 0x90, 0xa5, 0xd8, 0xbf, - 0x47, 0x0b, 0x70, 0xa6, 0xd4, 0x98, 0x64, 0xc5, 0x94, 0x2f, 0x05, 0x3c, 0x07, 0x27, 0x92, 0x35, - 0x14, 0xef, 0x8f, 0x35, 0x85, 0x3a, 0x95, 0x93, 0xac, 0x38, 0x3a, 0xb5, 0x63, 0x4e, 0x55, 0xda, - 0xe1, 0xa9, 0xa3, 0x4b, 0xd0, 0x57, 0xbe, 0x5f, 0x38, 0x95, 0xe4, 0x06, 0xe3, 0x09, 0x78, 0xf8, - 0x43, 0x21, 0xff, 0x71, 0x7e, 0xa0, 0xc5, 0x43, 0xeb, 0x17, 0xdc, 0xac, 0xdc, 0x46, 0x01, 0x9f, - 0x82, 0xa1, 0xaa, 0xd1, 0x7c, 0x96, 0xa0, 0x28, 0x5c, 0x84, 0x11, 0x9a, 0xa6, 0xe8, 0x62, 0x96, - 0xa4, 0x68, 0xf6, 0x39, 0x08, 0xef, 0xdf, 0x82, 0x2e, 0x78, 0x7c, 0x0c, 0x44, 0xe1, 0xb4, 0x25, - 0xac, 0x7f, 0x58, 0x84, 0x5f, 0xa7, 0x41, 0x1a, 0x5d, 0x1a, 0xa0, 0xf3, 0xe1, 0xdd, 0xb7, 0xb7, - 0x4b, 0x2a, 0x57, 0xdb, 0xdc, 0xc3, 0xac, 0xf2, 0xf3, 0x4c, 0xe2, 0x15, 0x66, 0xbc, 0xf1, 0x9b, - 0x72, 0x5b, 0xe5, 0x84, 0xbf, 0x14, 0x78, 0x45, 0xaa, 0x4c, 0xf8, 0xf9, 0x96, 0x96, 0x85, 0xbf, - 0x64, 0xbe, 0x89, 0xdf, 0x57, 0xf1, 0xe7, 0xa7, 0xba, 0x78, 0xfd, 0x3b, 0x00, 0x00, 0xff, 0xff, - 0x44, 0x05, 0x7c, 0xfe, 0x22, 0x03, 0x00, 0x00, +var File_ps_args_mqtt_proto protoreflect.FileDescriptor + +var file_ps_args_mqtt_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6d, 0x71, 0x74, 0x74, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, + 0x73, 0x22, 0xa6, 0x01, 0x0a, 0x0e, 0x4d, 0x51, 0x54, 0x54, 0x54, 0x4c, 0x53, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1e, 0x0a, 0x0b, 0x74, 0x6c, 0x73, 0x5f, 0x63, 0x61, 0x5f, 0x63, + 0x65, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x6c, 0x73, 0x43, 0x61, + 0x43, 0x65, 0x72, 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x6c, 0x73, 0x5f, 0x63, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, + 0x6c, 0x73, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x65, 0x72, 0x74, 0x12, 0x24, 0x0a, 0x0e, + 0x74, 0x6c, 0x73, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x6c, 0x73, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4b, + 0x65, 0x79, 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x6c, 0x73, 0x5f, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x76, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x74, 0x6c, 0x73, + 0x53, 0x6b, 0x69, 0x70, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x22, 0xe9, 0x01, 0x0a, 0x08, 0x4d, + 0x51, 0x54, 0x54, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x12, 0x30, 0x0a, 0x14, 0x63, 0x6f, 0x6e, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, + 0x74, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x12, 0x63, 0x6f, 0x6e, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x53, 0x65, 0x63, 0x6f, + 0x6e, 0x64, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, + 0x12, 0x36, 0x0a, 0x09, 0x71, 0x6f, 0x73, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, + 0x73, 0x2e, 0x4d, 0x51, 0x54, 0x54, 0x51, 0x6f, 0x53, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, 0x08, + 0x71, 0x6f, 0x73, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x3c, 0x0a, 0x0b, 0x74, 0x6c, 0x73, 0x5f, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4d, 0x51, 0x54, 0x54, + 0x54, 0x4c, 0x53, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0a, 0x74, 0x6c, 0x73, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x56, 0x0a, 0x0c, 0x4d, 0x51, 0x54, 0x54, 0x52, 0x65, + 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x30, 0x0a, 0x14, + 0x72, 0x65, 0x61, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x73, 0x65, 0x63, + 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x12, 0x72, 0x65, 0x61, 0x64, + 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x22, 0x59, + 0x0a, 0x0d, 0x4d, 0x51, 0x54, 0x54, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x12, + 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x74, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x32, 0x0a, 0x15, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x74, + 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x13, 0x77, 0x72, 0x69, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, + 0x75, 0x74, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x2a, 0x72, 0x0a, 0x0c, 0x4d, 0x51, 0x54, + 0x54, 0x51, 0x6f, 0x53, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x1f, 0x0a, 0x1b, 0x4d, 0x51, 0x54, + 0x54, 0x5f, 0x51, 0x4f, 0x53, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x41, 0x54, 0x5f, 0x4d, + 0x4f, 0x53, 0x54, 0x5f, 0x4f, 0x4e, 0x43, 0x45, 0x10, 0x00, 0x12, 0x20, 0x0a, 0x1c, 0x4d, 0x51, + 0x54, 0x54, 0x5f, 0x51, 0x4f, 0x53, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x41, 0x54, 0x5f, + 0x4c, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x4f, 0x4e, 0x43, 0x45, 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, + 0x4d, 0x51, 0x54, 0x54, 0x5f, 0x51, 0x4f, 0x53, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x45, + 0x58, 0x41, 0x43, 0x54, 0x4c, 0x59, 0x5f, 0x4f, 0x4e, 0x43, 0x45, 0x10, 0x02, 0x42, 0x3b, 0x5a, + 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, + 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x61, 0x72, 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_ps_args_mqtt_proto_rawDescOnce sync.Once + file_ps_args_mqtt_proto_rawDescData = file_ps_args_mqtt_proto_rawDesc +) + +func file_ps_args_mqtt_proto_rawDescGZIP() []byte { + file_ps_args_mqtt_proto_rawDescOnce.Do(func() { + file_ps_args_mqtt_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_args_mqtt_proto_rawDescData) + }) + return file_ps_args_mqtt_proto_rawDescData +} + +var file_ps_args_mqtt_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_ps_args_mqtt_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_ps_args_mqtt_proto_goTypes = []interface{}{ + (MQTTQoSLevel)(0), // 0: protos.args.MQTTQoSLevel + (*MQTTTLSOptions)(nil), // 1: protos.args.MQTTTLSOptions + (*MQTTConn)(nil), // 2: protos.args.MQTTConn + (*MQTTReadArgs)(nil), // 3: protos.args.MQTTReadArgs + (*MQTTWriteArgs)(nil), // 4: protos.args.MQTTWriteArgs +} +var file_ps_args_mqtt_proto_depIdxs = []int32{ + 0, // 0: protos.args.MQTTConn.qos_level:type_name -> protos.args.MQTTQoSLevel + 1, // 1: protos.args.MQTTConn.tls_options:type_name -> protos.args.MQTTTLSOptions + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_ps_args_mqtt_proto_init() } +func file_ps_args_mqtt_proto_init() { + if File_ps_args_mqtt_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_args_mqtt_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MQTTTLSOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_mqtt_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MQTTConn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_mqtt_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MQTTReadArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_mqtt_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MQTTWriteArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_args_mqtt_proto_rawDesc, + NumEnums: 1, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_args_mqtt_proto_goTypes, + DependencyIndexes: file_ps_args_mqtt_proto_depIdxs, + EnumInfos: file_ps_args_mqtt_proto_enumTypes, + MessageInfos: file_ps_args_mqtt_proto_msgTypes, + }.Build() + File_ps_args_mqtt_proto = out.File + file_ps_args_mqtt_proto_rawDesc = nil + file_ps_args_mqtt_proto_goTypes = nil + file_ps_args_mqtt_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_nats.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_nats.pb.go index 4cc0b1951..816399df9 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_nats.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_nats.pb.go @@ -1,26 +1,30 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_args_nats.proto package args import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type NatsConn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Dial string for NATS server. Ex: nats://localhost:4222',default='nats://localhost:4222',env='PLUMBER_RELAY_NATS_DSN'" Dsn string `protobuf:"bytes,1,opt,name=dsn,proto3" json:"dsn,omitempty" kong:"help='Dial string for NATS server. Ex: nats://localhost:4222',default='nats://localhost:4222',env='PLUMBER_RELAY_NATS_DSN'"` // @gotags: kong:"help='NATS .creds file containing authentication credentials',env='PLUMBER_RELAY_NATS_CREDENTIALS'" @@ -28,66 +32,74 @@ type NatsConn struct { // @gotags: kong:"embed" TlsOptions *NatsTLSOptions `protobuf:"bytes,3,opt,name=tls_options,json=tlsOptions,proto3" json:"tls_options,omitempty" kong:"embed"` // @gotags: kong:"help='File containing NATS NKey',env='PLUMBER_RELAY_NATS_NKEY'" - Nkey string `protobuf:"bytes,4,opt,name=nkey,proto3" json:"nkey,omitempty" kong:"help='File containing NATS NKey',env='PLUMBER_RELAY_NATS_NKEY'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Nkey string `protobuf:"bytes,4,opt,name=nkey,proto3" json:"nkey,omitempty" kong:"help='File containing NATS NKey',env='PLUMBER_RELAY_NATS_NKEY'"` } -func (m *NatsConn) Reset() { *m = NatsConn{} } -func (m *NatsConn) String() string { return proto.CompactTextString(m) } -func (*NatsConn) ProtoMessage() {} -func (*NatsConn) Descriptor() ([]byte, []int) { - return fileDescriptor_ee5ddeb96e248a57, []int{0} +func (x *NatsConn) Reset() { + *x = NatsConn{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_nats_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *NatsConn) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NatsConn.Unmarshal(m, b) -} -func (m *NatsConn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NatsConn.Marshal(b, m, deterministic) -} -func (m *NatsConn) XXX_Merge(src proto.Message) { - xxx_messageInfo_NatsConn.Merge(m, src) +func (x *NatsConn) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *NatsConn) XXX_Size() int { - return xxx_messageInfo_NatsConn.Size(m) -} -func (m *NatsConn) XXX_DiscardUnknown() { - xxx_messageInfo_NatsConn.DiscardUnknown(m) + +func (*NatsConn) ProtoMessage() {} + +func (x *NatsConn) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_nats_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_NatsConn proto.InternalMessageInfo +// Deprecated: Use NatsConn.ProtoReflect.Descriptor instead. +func (*NatsConn) Descriptor() ([]byte, []int) { + return file_ps_args_nats_proto_rawDescGZIP(), []int{0} +} -func (m *NatsConn) GetDsn() string { - if m != nil { - return m.Dsn +func (x *NatsConn) GetDsn() string { + if x != nil { + return x.Dsn } return "" } -func (m *NatsConn) GetUserCredentials() string { - if m != nil { - return m.UserCredentials +func (x *NatsConn) GetUserCredentials() string { + if x != nil { + return x.UserCredentials } return "" } -func (m *NatsConn) GetTlsOptions() *NatsTLSOptions { - if m != nil { - return m.TlsOptions +func (x *NatsConn) GetTlsOptions() *NatsTLSOptions { + if x != nil { + return x.TlsOptions } return nil } -func (m *NatsConn) GetNkey() string { - if m != nil { - return m.Nkey +func (x *NatsConn) GetNkey() string { + if x != nil { + return x.Nkey } return "" } type NatsTLSOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Whether to verify server certificate',env='PLUMBER_RELAY_NATS_SKIP_VERIFY_TLS'" TlsSkipVerify bool `protobuf:"varint,1,opt,name=tls_skip_verify,json=tlsSkipVerify,proto3" json:"tls_skip_verify,omitempty" kong:"help='Whether to verify server certificate',env='PLUMBER_RELAY_NATS_SKIP_VERIFY_TLS'"` // @gotags: kong:"help='CA file (only needed if addr is tls://)',env='PLUMBER_RELAY_NATS_TLS_CA_CERT'" @@ -97,184 +109,310 @@ type NatsTLSOptions struct { // @gotags: kong:"help='client key file (only needed if addr is tls://)',env='PLUMBER_RELAY_NATS_TLS_CLIENT_KEY'" TlsClientKey string `protobuf:"bytes,4,opt,name=tls_client_key,json=tlsClientKey,proto3" json:"tls_client_key,omitempty" kong:"help='client key file (only needed if addr is tls://)',env='PLUMBER_RELAY_NATS_TLS_CLIENT_KEY'"` // @gotags: kong:"help='Enable TLS',env='PLUMBER_RELAY_NATS_USE_TLS'" - UseTls bool `protobuf:"varint,5,opt,name=use_tls,json=useTls,proto3" json:"use_tls,omitempty" kong:"help='Enable TLS',env='PLUMBER_RELAY_NATS_USE_TLS'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + UseTls bool `protobuf:"varint,5,opt,name=use_tls,json=useTls,proto3" json:"use_tls,omitempty" kong:"help='Enable TLS',env='PLUMBER_RELAY_NATS_USE_TLS'"` } -func (m *NatsTLSOptions) Reset() { *m = NatsTLSOptions{} } -func (m *NatsTLSOptions) String() string { return proto.CompactTextString(m) } -func (*NatsTLSOptions) ProtoMessage() {} -func (*NatsTLSOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ee5ddeb96e248a57, []int{1} +func (x *NatsTLSOptions) Reset() { + *x = NatsTLSOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_nats_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *NatsTLSOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NatsTLSOptions.Unmarshal(m, b) -} -func (m *NatsTLSOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NatsTLSOptions.Marshal(b, m, deterministic) -} -func (m *NatsTLSOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_NatsTLSOptions.Merge(m, src) -} -func (m *NatsTLSOptions) XXX_Size() int { - return xxx_messageInfo_NatsTLSOptions.Size(m) +func (x *NatsTLSOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *NatsTLSOptions) XXX_DiscardUnknown() { - xxx_messageInfo_NatsTLSOptions.DiscardUnknown(m) + +func (*NatsTLSOptions) ProtoMessage() {} + +func (x *NatsTLSOptions) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_nats_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_NatsTLSOptions proto.InternalMessageInfo +// Deprecated: Use NatsTLSOptions.ProtoReflect.Descriptor instead. +func (*NatsTLSOptions) Descriptor() ([]byte, []int) { + return file_ps_args_nats_proto_rawDescGZIP(), []int{1} +} -func (m *NatsTLSOptions) GetTlsSkipVerify() bool { - if m != nil { - return m.TlsSkipVerify +func (x *NatsTLSOptions) GetTlsSkipVerify() bool { + if x != nil { + return x.TlsSkipVerify } return false } -func (m *NatsTLSOptions) GetTlsCaCert() string { - if m != nil { - return m.TlsCaCert +func (x *NatsTLSOptions) GetTlsCaCert() string { + if x != nil { + return x.TlsCaCert } return "" } -func (m *NatsTLSOptions) GetTlsClientCert() string { - if m != nil { - return m.TlsClientCert +func (x *NatsTLSOptions) GetTlsClientCert() string { + if x != nil { + return x.TlsClientCert } return "" } -func (m *NatsTLSOptions) GetTlsClientKey() string { - if m != nil { - return m.TlsClientKey +func (x *NatsTLSOptions) GetTlsClientKey() string { + if x != nil { + return x.TlsClientKey } return "" } -func (m *NatsTLSOptions) GetUseTls() bool { - if m != nil { - return m.UseTls +func (x *NatsTLSOptions) GetUseTls() bool { + if x != nil { + return x.UseTls } return false } type NatsReadArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='NATS Subject. Ex: foo.bar.*',env='PLUMBER_RELAY_NATS_SUBJECT'" - Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty" kong:"help='NATS Subject. Ex: foo.bar.*',env='PLUMBER_RELAY_NATS_SUBJECT'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty" kong:"help='NATS Subject. Ex: foo.bar.*',env='PLUMBER_RELAY_NATS_SUBJECT'"` } -func (m *NatsReadArgs) Reset() { *m = NatsReadArgs{} } -func (m *NatsReadArgs) String() string { return proto.CompactTextString(m) } -func (*NatsReadArgs) ProtoMessage() {} -func (*NatsReadArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_ee5ddeb96e248a57, []int{2} +func (x *NatsReadArgs) Reset() { + *x = NatsReadArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_nats_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *NatsReadArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NatsReadArgs.Unmarshal(m, b) -} -func (m *NatsReadArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NatsReadArgs.Marshal(b, m, deterministic) -} -func (m *NatsReadArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_NatsReadArgs.Merge(m, src) +func (x *NatsReadArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *NatsReadArgs) XXX_Size() int { - return xxx_messageInfo_NatsReadArgs.Size(m) -} -func (m *NatsReadArgs) XXX_DiscardUnknown() { - xxx_messageInfo_NatsReadArgs.DiscardUnknown(m) + +func (*NatsReadArgs) ProtoMessage() {} + +func (x *NatsReadArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_nats_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_NatsReadArgs proto.InternalMessageInfo +// Deprecated: Use NatsReadArgs.ProtoReflect.Descriptor instead. +func (*NatsReadArgs) Descriptor() ([]byte, []int) { + return file_ps_args_nats_proto_rawDescGZIP(), []int{2} +} -func (m *NatsReadArgs) GetSubject() string { - if m != nil { - return m.Subject +func (x *NatsReadArgs) GetSubject() string { + if x != nil { + return x.Subject } return "" } type NatsWriteArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='NATS Subject. Ex: foo.bar.*'" - Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty" kong:"help='NATS Subject. Ex: foo.bar.*'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty" kong:"help='NATS Subject. Ex: foo.bar.*'"` } -func (m *NatsWriteArgs) Reset() { *m = NatsWriteArgs{} } -func (m *NatsWriteArgs) String() string { return proto.CompactTextString(m) } -func (*NatsWriteArgs) ProtoMessage() {} -func (*NatsWriteArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_ee5ddeb96e248a57, []int{3} +func (x *NatsWriteArgs) Reset() { + *x = NatsWriteArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_nats_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *NatsWriteArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NatsWriteArgs.Unmarshal(m, b) +func (x *NatsWriteArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *NatsWriteArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NatsWriteArgs.Marshal(b, m, deterministic) -} -func (m *NatsWriteArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_NatsWriteArgs.Merge(m, src) -} -func (m *NatsWriteArgs) XXX_Size() int { - return xxx_messageInfo_NatsWriteArgs.Size(m) -} -func (m *NatsWriteArgs) XXX_DiscardUnknown() { - xxx_messageInfo_NatsWriteArgs.DiscardUnknown(m) + +func (*NatsWriteArgs) ProtoMessage() {} + +func (x *NatsWriteArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_nats_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_NatsWriteArgs proto.InternalMessageInfo +// Deprecated: Use NatsWriteArgs.ProtoReflect.Descriptor instead. +func (*NatsWriteArgs) Descriptor() ([]byte, []int) { + return file_ps_args_nats_proto_rawDescGZIP(), []int{3} +} -func (m *NatsWriteArgs) GetSubject() string { - if m != nil { - return m.Subject +func (x *NatsWriteArgs) GetSubject() string { + if x != nil { + return x.Subject } return "" } -func init() { - proto.RegisterType((*NatsConn)(nil), "protos.args.NatsConn") - proto.RegisterType((*NatsTLSOptions)(nil), "protos.args.NatsTLSOptions") - proto.RegisterType((*NatsReadArgs)(nil), "protos.args.NatsReadArgs") - proto.RegisterType((*NatsWriteArgs)(nil), "protos.args.NatsWriteArgs") -} - -func init() { proto.RegisterFile("ps_args_nats.proto", fileDescriptor_ee5ddeb96e248a57) } - -var fileDescriptor_ee5ddeb96e248a57 = []byte{ - // 358 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0x4f, 0xcb, 0xd3, 0x40, - 0x10, 0xc6, 0x89, 0x7d, 0x7d, 0xdb, 0x6e, 0xff, 0xb2, 0x17, 0x03, 0x82, 0x94, 0x20, 0xd2, 0x1e, - 0x4c, 0x40, 0x4f, 0xa2, 0x17, 0xcd, 0x51, 0x51, 0x48, 0x8b, 0x82, 0x97, 0xb0, 0xd9, 0x8c, 0xe9, - 0xda, 0xed, 0x6e, 0xd8, 0x99, 0x08, 0xfd, 0x28, 0x7e, 0x1a, 0xbf, 0x9a, 0xec, 0xa6, 0xb5, 0xf5, - 0xf2, 0x9e, 0x32, 0xf3, 0xe4, 0xb7, 0xf3, 0x3c, 0xbb, 0xc3, 0x78, 0x8b, 0xa5, 0x70, 0x0d, 0x96, - 0x46, 0x10, 0xa6, 0xad, 0xb3, 0x64, 0xf9, 0x24, 0x7c, 0x30, 0xf5, 0x7a, 0xf2, 0x3b, 0x62, 0xa3, - 0xcf, 0x82, 0x30, 0xb7, 0xc6, 0xf0, 0x25, 0x1b, 0xd4, 0x68, 0xe2, 0x68, 0x15, 0xad, 0xc7, 0x85, - 0x2f, 0xf9, 0x86, 0x2d, 0x3b, 0x04, 0x57, 0x4a, 0x07, 0x35, 0x18, 0x52, 0x42, 0x63, 0xfc, 0x28, - 0xfc, 0x5e, 0x78, 0x3d, 0xbf, 0xca, 0xfc, 0x1d, 0x9b, 0x90, 0xc6, 0xd2, 0xb6, 0xa4, 0xac, 0xc1, - 0x78, 0xb0, 0x8a, 0xd6, 0x93, 0x57, 0x4f, 0xd3, 0x1b, 0xb3, 0xd4, 0x1b, 0xed, 0x3e, 0x6d, 0xbf, - 0xf4, 0x48, 0xc1, 0x48, 0xe3, 0xb9, 0xe6, 0x9c, 0xdd, 0x99, 0x03, 0x9c, 0xe2, 0xbb, 0x30, 0x3c, - 0xd4, 0xc9, 0x9f, 0x88, 0xcd, 0xff, 0x3f, 0xc2, 0x5f, 0xb0, 0x85, 0x37, 0xc1, 0x83, 0x6a, 0xcb, - 0x5f, 0xe0, 0xd4, 0x8f, 0x53, 0x48, 0x3b, 0x2a, 0x66, 0xa4, 0x71, 0x7b, 0x50, 0xed, 0xd7, 0x20, - 0xf2, 0x67, 0x7d, 0x18, 0x29, 0x4a, 0x09, 0x8e, 0xce, 0x91, 0xc7, 0xa4, 0x31, 0x17, 0x39, 0x38, - 0xba, 0xcc, 0x91, 0x5a, 0x81, 0xa1, 0x9e, 0x19, 0x04, 0xc6, 0xcf, 0xc9, 0x83, 0x1a, 0xb8, 0xe7, - 0x6c, 0x7e, 0xc3, 0x5d, 0x03, 0x4e, 0xff, 0x61, 0x1f, 0xe1, 0xc4, 0x9f, 0xb0, 0x61, 0x87, 0x50, - 0x92, 0xc6, 0xf8, 0x71, 0x48, 0x73, 0xdf, 0x21, 0xec, 0x34, 0x26, 0x6b, 0x36, 0xf5, 0x17, 0x28, - 0x40, 0xd4, 0xef, 0x5d, 0x83, 0x3c, 0x66, 0x43, 0xec, 0xaa, 0x9f, 0x20, 0xe9, 0xfc, 0xc8, 0x97, - 0x36, 0xd9, 0xb0, 0x99, 0x27, 0xbf, 0x39, 0x45, 0xf0, 0x30, 0xfa, 0xe1, 0xed, 0xf7, 0x37, 0x8d, - 0xa2, 0x7d, 0x57, 0xa5, 0xd2, 0x1e, 0xb3, 0x4a, 0x90, 0xdc, 0x4b, 0xeb, 0xda, 0xac, 0xd5, 0xdd, - 0xb1, 0x02, 0xf7, 0x12, 0xe5, 0x1e, 0x8e, 0x02, 0xb3, 0xaa, 0x53, 0xba, 0xce, 0x1a, 0x9b, 0xf5, - 0x2b, 0xc8, 0xfc, 0x0a, 0xaa, 0xfb, 0xd0, 0xbc, 0xfe, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xac, 0x3a, - 0x25, 0x5e, 0x19, 0x02, 0x00, 0x00, +var File_ps_args_nats_proto protoreflect.FileDescriptor + +var file_ps_args_nats_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, + 0x73, 0x22, 0x99, 0x01, 0x0a, 0x08, 0x4e, 0x61, 0x74, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x10, + 0x0a, 0x03, 0x64, 0x73, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x73, 0x6e, + 0x12, 0x29, 0x0a, 0x10, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x61, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x75, 0x73, 0x65, 0x72, + 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x12, 0x3c, 0x0a, 0x0b, 0x74, + 0x6c, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, + 0x61, 0x74, 0x73, 0x54, 0x4c, 0x53, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0a, 0x74, + 0x6c, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x6b, 0x65, + 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x6b, 0x65, 0x79, 0x22, 0xbf, 0x01, + 0x0a, 0x0e, 0x4e, 0x61, 0x74, 0x73, 0x54, 0x4c, 0x53, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x6c, 0x73, 0x5f, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x76, 0x65, 0x72, + 0x69, 0x66, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x74, 0x6c, 0x73, 0x53, 0x6b, + 0x69, 0x70, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x12, 0x1e, 0x0a, 0x0b, 0x74, 0x6c, 0x73, 0x5f, + 0x63, 0x61, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, + 0x6c, 0x73, 0x43, 0x61, 0x43, 0x65, 0x72, 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x6c, 0x73, 0x5f, + 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x74, 0x6c, 0x73, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x65, 0x72, 0x74, + 0x12, 0x24, 0x0a, 0x0e, 0x74, 0x6c, 0x73, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6b, + 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x6c, 0x73, 0x43, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x5f, 0x74, 0x6c, + 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x75, 0x73, 0x65, 0x54, 0x6c, 0x73, 0x22, + 0x28, 0x0a, 0x0c, 0x4e, 0x61, 0x74, 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x12, + 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x29, 0x0a, 0x0d, 0x4e, 0x61, 0x74, + 0x73, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, + 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x61, 0x72, 0x67, + 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ps_args_nats_proto_rawDescOnce sync.Once + file_ps_args_nats_proto_rawDescData = file_ps_args_nats_proto_rawDesc +) + +func file_ps_args_nats_proto_rawDescGZIP() []byte { + file_ps_args_nats_proto_rawDescOnce.Do(func() { + file_ps_args_nats_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_args_nats_proto_rawDescData) + }) + return file_ps_args_nats_proto_rawDescData +} + +var file_ps_args_nats_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_ps_args_nats_proto_goTypes = []interface{}{ + (*NatsConn)(nil), // 0: protos.args.NatsConn + (*NatsTLSOptions)(nil), // 1: protos.args.NatsTLSOptions + (*NatsReadArgs)(nil), // 2: protos.args.NatsReadArgs + (*NatsWriteArgs)(nil), // 3: protos.args.NatsWriteArgs +} +var file_ps_args_nats_proto_depIdxs = []int32{ + 1, // 0: protos.args.NatsConn.tls_options:type_name -> protos.args.NatsTLSOptions + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_ps_args_nats_proto_init() } +func file_ps_args_nats_proto_init() { + if File_ps_args_nats_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_args_nats_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NatsConn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_nats_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NatsTLSOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_nats_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NatsReadArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_nats_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NatsWriteArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_args_nats_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_args_nats_proto_goTypes, + DependencyIndexes: file_ps_args_nats_proto_depIdxs, + MessageInfos: file_ps_args_nats_proto_msgTypes, + }.Build() + File_ps_args_nats_proto = out.File + file_ps_args_nats_proto_rawDesc = nil + file_ps_args_nats_proto_goTypes = nil + file_ps_args_nats_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_nats_jetstream.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_nats_jetstream.pb.go index 049de0467..2aa8f1acf 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_nats_jetstream.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_nats_jetstream.pb.go @@ -1,26 +1,30 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_args_nats_jetstream.proto package args import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type NatsJetstreamTLSOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='CA file (only needed if addr is tls://*)',env='PLUMBER_RELAY_NATS_JETSTREAM_TLS_CA_CERT'" TlsCaCert string `protobuf:"bytes,1,opt,name=tls_ca_cert,json=tlsCaCert,proto3" json:"tls_ca_cert,omitempty" kong:"help='CA file (only needed if addr is tls://*)',env='PLUMBER_RELAY_NATS_JETSTREAM_TLS_CA_CERT'"` // @gotags: kong:"help='Client cert file (only needed if addr is tls://*)',env='PLUMBER_RELAY_NATS_JETSTREAM_TLS_CLIENT_CERT'" @@ -30,73 +34,81 @@ type NatsJetstreamTLSOptions struct { // @gotags: kong:"help='Whether to verify server certificate',env='PLUMBER_RELAY_NATS_JETSTREAM_SKIP_VERIFY_TLS'" TlsSkipVerify bool `protobuf:"varint,4,opt,name=tls_skip_verify,json=tlsSkipVerify,proto3" json:"tls_skip_verify,omitempty" kong:"help='Whether to verify server certificate',env='PLUMBER_RELAY_NATS_JETSTREAM_SKIP_VERIFY_TLS'"` // @gotags: kong:"help='Enable TLS',env='PLUMBER_RELAY_NATS_JETSTREAM_USE_TLS'" - UseTls bool `protobuf:"varint,5,opt,name=use_tls,json=useTls,proto3" json:"use_tls,omitempty" kong:"help='Enable TLS',env='PLUMBER_RELAY_NATS_JETSTREAM_USE_TLS'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + UseTls bool `protobuf:"varint,5,opt,name=use_tls,json=useTls,proto3" json:"use_tls,omitempty" kong:"help='Enable TLS',env='PLUMBER_RELAY_NATS_JETSTREAM_USE_TLS'"` } -func (m *NatsJetstreamTLSOptions) Reset() { *m = NatsJetstreamTLSOptions{} } -func (m *NatsJetstreamTLSOptions) String() string { return proto.CompactTextString(m) } -func (*NatsJetstreamTLSOptions) ProtoMessage() {} -func (*NatsJetstreamTLSOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_a1868c7e9e1b078c, []int{0} +func (x *NatsJetstreamTLSOptions) Reset() { + *x = NatsJetstreamTLSOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_nats_jetstream_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *NatsJetstreamTLSOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NatsJetstreamTLSOptions.Unmarshal(m, b) -} -func (m *NatsJetstreamTLSOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NatsJetstreamTLSOptions.Marshal(b, m, deterministic) -} -func (m *NatsJetstreamTLSOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_NatsJetstreamTLSOptions.Merge(m, src) +func (x *NatsJetstreamTLSOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *NatsJetstreamTLSOptions) XXX_Size() int { - return xxx_messageInfo_NatsJetstreamTLSOptions.Size(m) -} -func (m *NatsJetstreamTLSOptions) XXX_DiscardUnknown() { - xxx_messageInfo_NatsJetstreamTLSOptions.DiscardUnknown(m) + +func (*NatsJetstreamTLSOptions) ProtoMessage() {} + +func (x *NatsJetstreamTLSOptions) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_nats_jetstream_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_NatsJetstreamTLSOptions proto.InternalMessageInfo +// Deprecated: Use NatsJetstreamTLSOptions.ProtoReflect.Descriptor instead. +func (*NatsJetstreamTLSOptions) Descriptor() ([]byte, []int) { + return file_ps_args_nats_jetstream_proto_rawDescGZIP(), []int{0} +} -func (m *NatsJetstreamTLSOptions) GetTlsCaCert() string { - if m != nil { - return m.TlsCaCert +func (x *NatsJetstreamTLSOptions) GetTlsCaCert() string { + if x != nil { + return x.TlsCaCert } return "" } -func (m *NatsJetstreamTLSOptions) GetTlsClientCert() string { - if m != nil { - return m.TlsClientCert +func (x *NatsJetstreamTLSOptions) GetTlsClientCert() string { + if x != nil { + return x.TlsClientCert } return "" } -func (m *NatsJetstreamTLSOptions) GetTlsClientKey() string { - if m != nil { - return m.TlsClientKey +func (x *NatsJetstreamTLSOptions) GetTlsClientKey() string { + if x != nil { + return x.TlsClientKey } return "" } -func (m *NatsJetstreamTLSOptions) GetTlsSkipVerify() bool { - if m != nil { - return m.TlsSkipVerify +func (x *NatsJetstreamTLSOptions) GetTlsSkipVerify() bool { + if x != nil { + return x.TlsSkipVerify } return false } -func (m *NatsJetstreamTLSOptions) GetUseTls() bool { - if m != nil { - return m.UseTls +func (x *NatsJetstreamTLSOptions) GetUseTls() bool { + if x != nil { + return x.UseTls } return false } type NatsJetstreamConn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Dial string for NATS server. Ex: nats://localhost:4222',default='nats://localhost:4222',env='PLUMBER_RELAY_NATS_JETSTREAM_DSN'" Dsn string `protobuf:"bytes,1,opt,name=dsn,proto3" json:"dsn,omitempty" kong:"help='Dial string for NATS server. Ex: nats://localhost:4222',default='nats://localhost:4222',env='PLUMBER_RELAY_NATS_JETSTREAM_DSN'"` // @gotags: kong:"help='NATS .creds file containing authentication credentials',env='PLUMBER_RELAY_NATS_JETSTREAM_CREDENTIALS'" @@ -106,73 +118,81 @@ type NatsJetstreamConn struct { // @gotags: kong:"embed" TlsOptions *NatsJetstreamTLSOptions `protobuf:"bytes,4,opt,name=tls_options,json=tlsOptions,proto3" json:"tls_options,omitempty" kong:"embed"` // @gotags: kong:"help='File containing NATS NKey',env='PLUMBER_RELAY_NATS_JETSTREAM_NKEY'" - Nkey string `protobuf:"bytes,5,opt,name=nkey,proto3" json:"nkey,omitempty" kong:"help='File containing NATS NKey',env='PLUMBER_RELAY_NATS_JETSTREAM_NKEY'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Nkey string `protobuf:"bytes,5,opt,name=nkey,proto3" json:"nkey,omitempty" kong:"help='File containing NATS NKey',env='PLUMBER_RELAY_NATS_JETSTREAM_NKEY'"` } -func (m *NatsJetstreamConn) Reset() { *m = NatsJetstreamConn{} } -func (m *NatsJetstreamConn) String() string { return proto.CompactTextString(m) } -func (*NatsJetstreamConn) ProtoMessage() {} -func (*NatsJetstreamConn) Descriptor() ([]byte, []int) { - return fileDescriptor_a1868c7e9e1b078c, []int{1} +func (x *NatsJetstreamConn) Reset() { + *x = NatsJetstreamConn{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_nats_jetstream_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *NatsJetstreamConn) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NatsJetstreamConn.Unmarshal(m, b) -} -func (m *NatsJetstreamConn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NatsJetstreamConn.Marshal(b, m, deterministic) -} -func (m *NatsJetstreamConn) XXX_Merge(src proto.Message) { - xxx_messageInfo_NatsJetstreamConn.Merge(m, src) -} -func (m *NatsJetstreamConn) XXX_Size() int { - return xxx_messageInfo_NatsJetstreamConn.Size(m) +func (x *NatsJetstreamConn) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *NatsJetstreamConn) XXX_DiscardUnknown() { - xxx_messageInfo_NatsJetstreamConn.DiscardUnknown(m) + +func (*NatsJetstreamConn) ProtoMessage() {} + +func (x *NatsJetstreamConn) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_nats_jetstream_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_NatsJetstreamConn proto.InternalMessageInfo +// Deprecated: Use NatsJetstreamConn.ProtoReflect.Descriptor instead. +func (*NatsJetstreamConn) Descriptor() ([]byte, []int) { + return file_ps_args_nats_jetstream_proto_rawDescGZIP(), []int{1} +} -func (m *NatsJetstreamConn) GetDsn() string { - if m != nil { - return m.Dsn +func (x *NatsJetstreamConn) GetDsn() string { + if x != nil { + return x.Dsn } return "" } -func (m *NatsJetstreamConn) GetUserCredentials() string { - if m != nil { - return m.UserCredentials +func (x *NatsJetstreamConn) GetUserCredentials() string { + if x != nil { + return x.UserCredentials } return "" } -func (m *NatsJetstreamConn) GetClientId() string { - if m != nil { - return m.ClientId +func (x *NatsJetstreamConn) GetClientId() string { + if x != nil { + return x.ClientId } return "" } -func (m *NatsJetstreamConn) GetTlsOptions() *NatsJetstreamTLSOptions { - if m != nil { - return m.TlsOptions +func (x *NatsJetstreamConn) GetTlsOptions() *NatsJetstreamTLSOptions { + if x != nil { + return x.TlsOptions } return nil } -func (m *NatsJetstreamConn) GetNkey() string { - if m != nil { - return m.Nkey +func (x *NatsJetstreamConn) GetNkey() string { + if x != nil { + return x.Nkey } return "" } type NatsJetstreamReadArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='NATS JetStream stream name. Ex: orders.>',env='PLUMBER_RELAY_NATS_JETSTREAM_STREAM'" Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty" kong:"help='NATS JetStream stream name. Ex: orders.>',env='PLUMBER_RELAY_NATS_JETSTREAM_STREAM'"` // @gotags: kong:"help='Consumer name (default: random consumer name; has no effect if create_durable_consumer or existing_durable_consumer is not set)',env='PLUMBER_RELAY_NATS_JETSTREAM_CONSUMER_NAME'" @@ -188,176 +208,310 @@ type NatsJetstreamReadArgs struct { // @gotags: kong:"help='At what time to start stream (RFC3339 format, Ex: 2016-06-20T12:41:45.14Z)',env='PLUMBER_RELAY_NATS_JETSTREAM_CONSUMER_START_TIME'" ConsumerStartTime string `protobuf:"bytes,7,opt,name=consumer_start_time,json=consumerStartTime,proto3" json:"consumer_start_time,omitempty" kong:"help='At what time to start stream (RFC3339 format, Ex: 2016-06-20T12:41:45.14Z)',env='PLUMBER_RELAY_NATS_JETSTREAM_CONSUMER_START_TIME'"` // @gotags: kong:"help='Only receive a subset of messages from the Stream based on the subject',env='PLUMBER_RELAY_NATS_JETSTREAM_CONSUMER_FILTER_SUBJECT'" - ConsumerFilterSubject string `protobuf:"bytes,8,opt,name=consumer_filter_subject,json=consumerFilterSubject,proto3" json:"consumer_filter_subject,omitempty" kong:"help='Only receive a subset of messages from the Stream based on the subject',env='PLUMBER_RELAY_NATS_JETSTREAM_CONSUMER_FILTER_SUBJECT'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ConsumerFilterSubject string `protobuf:"bytes,8,opt,name=consumer_filter_subject,json=consumerFilterSubject,proto3" json:"consumer_filter_subject,omitempty" kong:"help='Only receive a subset of messages from the Stream based on the subject',env='PLUMBER_RELAY_NATS_JETSTREAM_CONSUMER_FILTER_SUBJECT'"` } -func (m *NatsJetstreamReadArgs) Reset() { *m = NatsJetstreamReadArgs{} } -func (m *NatsJetstreamReadArgs) String() string { return proto.CompactTextString(m) } -func (*NatsJetstreamReadArgs) ProtoMessage() {} -func (*NatsJetstreamReadArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_a1868c7e9e1b078c, []int{2} +func (x *NatsJetstreamReadArgs) Reset() { + *x = NatsJetstreamReadArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_nats_jetstream_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *NatsJetstreamReadArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NatsJetstreamReadArgs.Unmarshal(m, b) -} -func (m *NatsJetstreamReadArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NatsJetstreamReadArgs.Marshal(b, m, deterministic) -} -func (m *NatsJetstreamReadArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_NatsJetstreamReadArgs.Merge(m, src) +func (x *NatsJetstreamReadArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *NatsJetstreamReadArgs) XXX_Size() int { - return xxx_messageInfo_NatsJetstreamReadArgs.Size(m) -} -func (m *NatsJetstreamReadArgs) XXX_DiscardUnknown() { - xxx_messageInfo_NatsJetstreamReadArgs.DiscardUnknown(m) + +func (*NatsJetstreamReadArgs) ProtoMessage() {} + +func (x *NatsJetstreamReadArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_nats_jetstream_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_NatsJetstreamReadArgs proto.InternalMessageInfo +// Deprecated: Use NatsJetstreamReadArgs.ProtoReflect.Descriptor instead. +func (*NatsJetstreamReadArgs) Descriptor() ([]byte, []int) { + return file_ps_args_nats_jetstream_proto_rawDescGZIP(), []int{2} +} -func (m *NatsJetstreamReadArgs) GetStream() string { - if m != nil { - return m.Stream +func (x *NatsJetstreamReadArgs) GetStream() string { + if x != nil { + return x.Stream } return "" } -func (m *NatsJetstreamReadArgs) GetConsumerName() string { - if m != nil { - return m.ConsumerName +func (x *NatsJetstreamReadArgs) GetConsumerName() string { + if x != nil { + return x.ConsumerName } return "" } -func (m *NatsJetstreamReadArgs) GetCreateDurableConsumer() bool { - if m != nil { - return m.CreateDurableConsumer +func (x *NatsJetstreamReadArgs) GetCreateDurableConsumer() bool { + if x != nil { + return x.CreateDurableConsumer } return false } -func (m *NatsJetstreamReadArgs) GetExistingDurableConsumer() bool { - if m != nil { - return m.ExistingDurableConsumer +func (x *NatsJetstreamReadArgs) GetExistingDurableConsumer() bool { + if x != nil { + return x.ExistingDurableConsumer } return false } -func (m *NatsJetstreamReadArgs) GetKeepConsumer() bool { - if m != nil { - return m.KeepConsumer +func (x *NatsJetstreamReadArgs) GetKeepConsumer() bool { + if x != nil { + return x.KeepConsumer } return false } -func (m *NatsJetstreamReadArgs) GetConsumerStartSequence() int64 { - if m != nil { - return m.ConsumerStartSequence +func (x *NatsJetstreamReadArgs) GetConsumerStartSequence() int64 { + if x != nil { + return x.ConsumerStartSequence } return 0 } -func (m *NatsJetstreamReadArgs) GetConsumerStartTime() string { - if m != nil { - return m.ConsumerStartTime +func (x *NatsJetstreamReadArgs) GetConsumerStartTime() string { + if x != nil { + return x.ConsumerStartTime } return "" } -func (m *NatsJetstreamReadArgs) GetConsumerFilterSubject() string { - if m != nil { - return m.ConsumerFilterSubject +func (x *NatsJetstreamReadArgs) GetConsumerFilterSubject() string { + if x != nil { + return x.ConsumerFilterSubject } return "" } type NatsJetstreamWriteArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='NATS JetStream subject name to write to. Ex: orders.>'" - Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty" kong:"help='NATS JetStream subject name to write to. Ex: orders.>'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty" kong:"help='NATS JetStream subject name to write to. Ex: orders.>'"` } -func (m *NatsJetstreamWriteArgs) Reset() { *m = NatsJetstreamWriteArgs{} } -func (m *NatsJetstreamWriteArgs) String() string { return proto.CompactTextString(m) } -func (*NatsJetstreamWriteArgs) ProtoMessage() {} -func (*NatsJetstreamWriteArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_a1868c7e9e1b078c, []int{3} +func (x *NatsJetstreamWriteArgs) Reset() { + *x = NatsJetstreamWriteArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_nats_jetstream_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *NatsJetstreamWriteArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NatsJetstreamWriteArgs.Unmarshal(m, b) +func (x *NatsJetstreamWriteArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *NatsJetstreamWriteArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NatsJetstreamWriteArgs.Marshal(b, m, deterministic) -} -func (m *NatsJetstreamWriteArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_NatsJetstreamWriteArgs.Merge(m, src) -} -func (m *NatsJetstreamWriteArgs) XXX_Size() int { - return xxx_messageInfo_NatsJetstreamWriteArgs.Size(m) -} -func (m *NatsJetstreamWriteArgs) XXX_DiscardUnknown() { - xxx_messageInfo_NatsJetstreamWriteArgs.DiscardUnknown(m) + +func (*NatsJetstreamWriteArgs) ProtoMessage() {} + +func (x *NatsJetstreamWriteArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_nats_jetstream_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_NatsJetstreamWriteArgs proto.InternalMessageInfo +// Deprecated: Use NatsJetstreamWriteArgs.ProtoReflect.Descriptor instead. +func (*NatsJetstreamWriteArgs) Descriptor() ([]byte, []int) { + return file_ps_args_nats_jetstream_proto_rawDescGZIP(), []int{3} +} -func (m *NatsJetstreamWriteArgs) GetSubject() string { - if m != nil { - return m.Subject +func (x *NatsJetstreamWriteArgs) GetSubject() string { + if x != nil { + return x.Subject } return "" } -func init() { - proto.RegisterType((*NatsJetstreamTLSOptions)(nil), "protos.args.NatsJetstreamTLSOptions") - proto.RegisterType((*NatsJetstreamConn)(nil), "protos.args.NatsJetstreamConn") - proto.RegisterType((*NatsJetstreamReadArgs)(nil), "protos.args.NatsJetstreamReadArgs") - proto.RegisterType((*NatsJetstreamWriteArgs)(nil), "protos.args.NatsJetstreamWriteArgs") -} - -func init() { proto.RegisterFile("ps_args_nats_jetstream.proto", fileDescriptor_a1868c7e9e1b078c) } - -var fileDescriptor_a1868c7e9e1b078c = []byte{ - // 533 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0x5d, 0x6f, 0xd3, 0x30, - 0x14, 0x55, 0xe9, 0xd6, 0xb5, 0x6e, 0xcb, 0x36, 0xa3, 0xae, 0x41, 0x20, 0x54, 0x75, 0x13, 0x2a, - 0x0f, 0x24, 0xd2, 0x90, 0x90, 0x80, 0x27, 0x28, 0x20, 0xf1, 0xa1, 0x21, 0xb5, 0x15, 0x48, 0xbc, - 0x58, 0x4e, 0x72, 0xd7, 0x7a, 0x4d, 0x9c, 0xe0, 0x7b, 0x83, 0xe8, 0x8f, 0xe0, 0x7f, 0xf1, 0xb3, - 0x50, 0xec, 0xa4, 0x5b, 0x87, 0x78, 0x8a, 0x7d, 0xce, 0xb9, 0x37, 0xe7, 0x9e, 0x6b, 0xf6, 0x30, - 0x47, 0x21, 0xcd, 0x12, 0x85, 0x96, 0x84, 0xe2, 0x0a, 0x08, 0xc9, 0x80, 0x4c, 0xfd, 0xdc, 0x64, - 0x94, 0xf1, 0xae, 0xfd, 0xa0, 0x5f, 0x2a, 0xc6, 0x7f, 0x1a, 0x6c, 0x78, 0x21, 0x09, 0x3f, 0xd6, - 0xa2, 0xc5, 0xe7, 0xf9, 0x97, 0x9c, 0x54, 0xa6, 0x91, 0x3f, 0x62, 0x5d, 0x4a, 0x50, 0x44, 0x52, - 0x44, 0x60, 0xc8, 0x6b, 0x8c, 0x1a, 0x93, 0xce, 0xac, 0x43, 0x09, 0x4e, 0xe5, 0x14, 0x0c, 0xf1, - 0xc7, 0xec, 0xd0, 0xf2, 0x89, 0x02, 0x4d, 0x4e, 0x73, 0xc7, 0x6a, 0xfa, 0xa5, 0xc6, 0xa2, 0x56, - 0x77, 0xc6, 0xee, 0xde, 0xd0, 0xad, 0x61, 0xe3, 0x35, 0xad, 0xac, 0xb7, 0x95, 0x7d, 0x82, 0x4d, - 0xdd, 0x0d, 0xd7, 0x2a, 0x17, 0x3f, 0xc1, 0xa8, 0xcb, 0x8d, 0xb7, 0x37, 0x6a, 0x4c, 0xda, 0xb6, - 0xdb, 0x7c, 0xad, 0xf2, 0xaf, 0x16, 0xe4, 0x43, 0x76, 0x50, 0x20, 0x08, 0x4a, 0xd0, 0xdb, 0xb7, - 0x7c, 0xab, 0x40, 0x58, 0x24, 0x76, 0x94, 0xe3, 0x9d, 0x51, 0xa6, 0x99, 0xd6, 0xfc, 0x88, 0x35, - 0x63, 0xd4, 0x95, 0xf9, 0xf2, 0xc8, 0x9f, 0xb0, 0xa3, 0x02, 0xc1, 0x88, 0xc8, 0x40, 0x0c, 0x9a, - 0x94, 0x4c, 0xb0, 0xf2, 0x7d, 0x58, 0xe2, 0xd3, 0x6b, 0x98, 0x3f, 0x60, 0x9d, 0xca, 0xb5, 0x8a, - 0x2b, 0xd3, 0x6d, 0x07, 0x7c, 0x88, 0xf9, 0x3b, 0x17, 0x4f, 0xe6, 0xd2, 0xb2, 0x66, 0xbb, 0xe7, - 0x67, 0xfe, 0x8d, 0x74, 0xfd, 0xff, 0x24, 0x3b, 0x63, 0x94, 0x60, 0x9d, 0x32, 0x67, 0x7b, 0xba, - 0xcc, 0x64, 0xdf, 0xb6, 0xb7, 0xe7, 0xf1, 0xef, 0x26, 0x1b, 0xec, 0xd4, 0xce, 0x40, 0xc6, 0xaf, - 0xcd, 0x12, 0xf9, 0x09, 0x6b, 0x39, 0xa4, 0x9a, 0xa8, 0xba, 0xf1, 0x53, 0xd6, 0x8f, 0x32, 0x8d, - 0x45, 0x0a, 0x46, 0x68, 0x99, 0x42, 0x35, 0x51, 0xaf, 0x06, 0x2f, 0x64, 0x0a, 0xfc, 0x39, 0x1b, - 0x46, 0x06, 0x24, 0x81, 0x88, 0x0b, 0x23, 0xc3, 0x04, 0x44, 0x4d, 0xdb, 0xe1, 0xda, 0xb3, 0x81, - 0xa3, 0xdf, 0x3a, 0x76, 0x5a, 0x91, 0xfc, 0x25, 0xbb, 0x0f, 0xbf, 0x14, 0x92, 0xd2, 0xcb, 0x7f, - 0x2b, 0xdd, 0x92, 0x86, 0xb5, 0xe0, 0x76, 0xed, 0x29, 0xeb, 0xaf, 0x01, 0xf2, 0x6b, 0xbd, 0x5b, - 0x5a, 0xaf, 0x04, 0xb7, 0xa2, 0xd2, 0x58, 0xed, 0x1e, 0x49, 0x1a, 0x12, 0x08, 0x3f, 0x0a, 0xd0, - 0x11, 0x78, 0xad, 0x51, 0x63, 0xd2, 0x9c, 0x0d, 0x6a, 0x7a, 0x5e, 0xb2, 0xf3, 0x8a, 0xe4, 0x3e, - 0xbb, 0x77, 0xab, 0x8e, 0x54, 0x0a, 0xde, 0x81, 0x9d, 0xfd, 0x78, 0xa7, 0x66, 0xa1, 0xaa, 0x00, - 0x6a, 0xfd, 0xa5, 0x4a, 0xa8, 0x2c, 0x2b, 0xc2, 0x2b, 0x88, 0xc8, 0x6b, 0xdb, 0x9a, 0xed, 0x7f, - 0xde, 0x5b, 0x76, 0xee, 0xc8, 0xf1, 0x39, 0x3b, 0xd9, 0x59, 0xc7, 0x37, 0xa3, 0x08, 0xec, 0x3e, - 0x3c, 0x76, 0x50, 0x77, 0x70, 0x0b, 0xa9, 0xaf, 0x6f, 0x5e, 0x7d, 0x7f, 0xb1, 0x54, 0xb4, 0x2a, - 0x42, 0x3f, 0xca, 0xd2, 0x20, 0x94, 0x14, 0xad, 0xa2, 0xcc, 0xe4, 0x41, 0x9e, 0x14, 0x69, 0x08, - 0xe6, 0x29, 0x46, 0x2b, 0x48, 0x25, 0x06, 0x61, 0xa1, 0x92, 0x38, 0x58, 0x66, 0x81, 0x7b, 0x38, - 0x41, 0xf9, 0x70, 0xc2, 0x96, 0xbd, 0x3c, 0xfb, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x00, 0xe9, 0x9b, - 0x9b, 0xca, 0x03, 0x00, 0x00, +var File_ps_args_nats_jetstream_proto protoreflect.FileDescriptor + +var file_ps_args_nats_jetstream_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x6a, + 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x22, 0xc8, 0x01, 0x0a, 0x17, + 0x4e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x54, 0x4c, 0x53, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1e, 0x0a, 0x0b, 0x74, 0x6c, 0x73, 0x5f, 0x63, + 0x61, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x6c, + 0x73, 0x43, 0x61, 0x43, 0x65, 0x72, 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x6c, 0x73, 0x5f, 0x63, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0d, 0x74, 0x6c, 0x73, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x65, 0x72, 0x74, 0x12, + 0x24, 0x0a, 0x0e, 0x74, 0x6c, 0x73, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6b, 0x65, + 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x6c, 0x73, 0x43, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x6c, 0x73, 0x5f, 0x73, 0x6b, 0x69, + 0x70, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, + 0x74, 0x6c, 0x73, 0x53, 0x6b, 0x69, 0x70, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x12, 0x17, 0x0a, + 0x07, 0x75, 0x73, 0x65, 0x5f, 0x74, 0x6c, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, + 0x75, 0x73, 0x65, 0x54, 0x6c, 0x73, 0x22, 0xc8, 0x01, 0x0a, 0x11, 0x4e, 0x61, 0x74, 0x73, 0x4a, + 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x10, 0x0a, 0x03, + 0x64, 0x73, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x73, 0x6e, 0x12, 0x29, + 0x0a, 0x10, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x43, 0x72, + 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x45, 0x0a, 0x0b, 0x74, 0x6c, 0x73, 0x5f, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x4a, 0x65, + 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x54, 0x4c, 0x53, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x0a, 0x74, 0x6c, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x6b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x6b, 0x65, + 0x79, 0x22, 0x8d, 0x03, 0x0a, 0x15, 0x4e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x73, + 0x75, 0x6d, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x36, 0x0a, 0x17, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x75, + 0x6d, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x44, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, + 0x12, 0x3a, 0x0a, 0x19, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x75, 0x72, + 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x17, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x44, 0x75, 0x72, + 0x61, 0x62, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, + 0x6b, 0x65, 0x65, 0x70, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x0c, 0x6b, 0x65, 0x65, 0x70, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, + 0x72, 0x12, 0x36, 0x0a, 0x17, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x5f, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x5f, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x15, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x53, 0x74, 0x61, 0x72, + 0x74, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x2e, 0x0a, 0x13, 0x63, 0x6f, 0x6e, + 0x73, 0x75, 0x6d, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, + 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x36, 0x0a, 0x17, 0x63, 0x6f, 0x6e, + 0x73, 0x75, 0x6d, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x75, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, 0x6f, 0x6e, 0x73, + 0x75, 0x6d, 0x65, 0x72, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x22, 0x32, 0x0a, 0x16, 0x4e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, + 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, + 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x61, 0x72, + 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ps_args_nats_jetstream_proto_rawDescOnce sync.Once + file_ps_args_nats_jetstream_proto_rawDescData = file_ps_args_nats_jetstream_proto_rawDesc +) + +func file_ps_args_nats_jetstream_proto_rawDescGZIP() []byte { + file_ps_args_nats_jetstream_proto_rawDescOnce.Do(func() { + file_ps_args_nats_jetstream_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_args_nats_jetstream_proto_rawDescData) + }) + return file_ps_args_nats_jetstream_proto_rawDescData +} + +var file_ps_args_nats_jetstream_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_ps_args_nats_jetstream_proto_goTypes = []interface{}{ + (*NatsJetstreamTLSOptions)(nil), // 0: protos.args.NatsJetstreamTLSOptions + (*NatsJetstreamConn)(nil), // 1: protos.args.NatsJetstreamConn + (*NatsJetstreamReadArgs)(nil), // 2: protos.args.NatsJetstreamReadArgs + (*NatsJetstreamWriteArgs)(nil), // 3: protos.args.NatsJetstreamWriteArgs +} +var file_ps_args_nats_jetstream_proto_depIdxs = []int32{ + 0, // 0: protos.args.NatsJetstreamConn.tls_options:type_name -> protos.args.NatsJetstreamTLSOptions + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_ps_args_nats_jetstream_proto_init() } +func file_ps_args_nats_jetstream_proto_init() { + if File_ps_args_nats_jetstream_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_args_nats_jetstream_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NatsJetstreamTLSOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_nats_jetstream_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NatsJetstreamConn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_nats_jetstream_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NatsJetstreamReadArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_nats_jetstream_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NatsJetstreamWriteArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_args_nats_jetstream_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_args_nats_jetstream_proto_goTypes, + DependencyIndexes: file_ps_args_nats_jetstream_proto_depIdxs, + MessageInfos: file_ps_args_nats_jetstream_proto_msgTypes, + }.Build() + File_ps_args_nats_jetstream_proto = out.File + file_ps_args_nats_jetstream_proto_rawDesc = nil + file_ps_args_nats_jetstream_proto_goTypes = nil + file_ps_args_nats_jetstream_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_nats_streaming.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_nats_streaming.pb.go index 99a93df3c..cec6a4562 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_nats_streaming.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_nats_streaming.pb.go @@ -1,26 +1,30 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_args_nats_streaming.proto package args import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type NatsStreamingTLSOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='CA file (only needed if addr is tls://*)',env='PLUMBER_RELAY_NATS_STREAMING_TLS_CA_CERT'" TlsCaCert string `protobuf:"bytes,1,opt,name=tls_ca_cert,json=tlsCaCert,proto3" json:"tls_ca_cert,omitempty" kong:"help='CA file (only needed if addr is tls://*)',env='PLUMBER_RELAY_NATS_STREAMING_TLS_CA_CERT'"` // @gotags: kong:"help='Client cert file (only needed if addr is tls://*)',env='PLUMBER_RELAY_NATS_STREAMING_TLS_CLIENT_CERT'" @@ -30,73 +34,81 @@ type NatsStreamingTLSOptions struct { // @gotags: kong:"help='Whether to verify server certificate',env='PLUMBER_RELAY_NATS_STREAMING_SKIP_VERIFY_TLS'" TlsSkipVerify bool `protobuf:"varint,4,opt,name=tls_skip_verify,json=tlsSkipVerify,proto3" json:"tls_skip_verify,omitempty" kong:"help='Whether to verify server certificate',env='PLUMBER_RELAY_NATS_STREAMING_SKIP_VERIFY_TLS'"` // @gotags: kong:"help='Enable TLS',env='PLUMBER_RELAY_NATS_STREAMING_USE_TLS'" - UseTls bool `protobuf:"varint,5,opt,name=use_tls,json=useTls,proto3" json:"use_tls,omitempty" kong:"help='Enable TLS',env='PLUMBER_RELAY_NATS_STREAMING_USE_TLS'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + UseTls bool `protobuf:"varint,5,opt,name=use_tls,json=useTls,proto3" json:"use_tls,omitempty" kong:"help='Enable TLS',env='PLUMBER_RELAY_NATS_STREAMING_USE_TLS'"` } -func (m *NatsStreamingTLSOptions) Reset() { *m = NatsStreamingTLSOptions{} } -func (m *NatsStreamingTLSOptions) String() string { return proto.CompactTextString(m) } -func (*NatsStreamingTLSOptions) ProtoMessage() {} -func (*NatsStreamingTLSOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_5bc025e0cb724b14, []int{0} +func (x *NatsStreamingTLSOptions) Reset() { + *x = NatsStreamingTLSOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_nats_streaming_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *NatsStreamingTLSOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NatsStreamingTLSOptions.Unmarshal(m, b) -} -func (m *NatsStreamingTLSOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NatsStreamingTLSOptions.Marshal(b, m, deterministic) -} -func (m *NatsStreamingTLSOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_NatsStreamingTLSOptions.Merge(m, src) +func (x *NatsStreamingTLSOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *NatsStreamingTLSOptions) XXX_Size() int { - return xxx_messageInfo_NatsStreamingTLSOptions.Size(m) -} -func (m *NatsStreamingTLSOptions) XXX_DiscardUnknown() { - xxx_messageInfo_NatsStreamingTLSOptions.DiscardUnknown(m) + +func (*NatsStreamingTLSOptions) ProtoMessage() {} + +func (x *NatsStreamingTLSOptions) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_nats_streaming_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_NatsStreamingTLSOptions proto.InternalMessageInfo +// Deprecated: Use NatsStreamingTLSOptions.ProtoReflect.Descriptor instead. +func (*NatsStreamingTLSOptions) Descriptor() ([]byte, []int) { + return file_ps_args_nats_streaming_proto_rawDescGZIP(), []int{0} +} -func (m *NatsStreamingTLSOptions) GetTlsCaCert() string { - if m != nil { - return m.TlsCaCert +func (x *NatsStreamingTLSOptions) GetTlsCaCert() string { + if x != nil { + return x.TlsCaCert } return "" } -func (m *NatsStreamingTLSOptions) GetTlsClientCert() string { - if m != nil { - return m.TlsClientCert +func (x *NatsStreamingTLSOptions) GetTlsClientCert() string { + if x != nil { + return x.TlsClientCert } return "" } -func (m *NatsStreamingTLSOptions) GetTlsClientKey() string { - if m != nil { - return m.TlsClientKey +func (x *NatsStreamingTLSOptions) GetTlsClientKey() string { + if x != nil { + return x.TlsClientKey } return "" } -func (m *NatsStreamingTLSOptions) GetTlsSkipVerify() bool { - if m != nil { - return m.TlsSkipVerify +func (x *NatsStreamingTLSOptions) GetTlsSkipVerify() bool { + if x != nil { + return x.TlsSkipVerify } return false } -func (m *NatsStreamingTLSOptions) GetUseTls() bool { - if m != nil { - return m.UseTls +func (x *NatsStreamingTLSOptions) GetUseTls() bool { + if x != nil { + return x.UseTls } return false } type NatsStreamingConn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Dial string for NATS server. Ex: nats://localhost:4222',default='nats://localhost:4222',env='PLUMBER_RELAY_NATS_STREAMING_DSN'" Dsn string `protobuf:"bytes,1,opt,name=dsn,proto3" json:"dsn,omitempty" kong:"help='Dial string for NATS server. Ex: nats://localhost:4222',default='nats://localhost:4222',env='PLUMBER_RELAY_NATS_STREAMING_DSN'"` // @gotags: kong:"help='NATS .creds file containing authentication credentials',env='PLUMBER_RELAY_NATS_STREAMING_CREDENTIALS'" @@ -106,73 +118,81 @@ type NatsStreamingConn struct { // @gotags: kong:"help='User specified client ID to connect with',default='plumber',env='PLUMBER_RELAY_NATS_STREAMING_CLIENT_ID'" ClientId string `protobuf:"bytes,4,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" kong:"help='User specified client ID to connect with',default='plumber',env='PLUMBER_RELAY_NATS_STREAMING_CLIENT_ID'"` // @gotags: kong:"embed" - TlsOptions *NatsStreamingTLSOptions `protobuf:"bytes,5,opt,name=tls_options,json=tlsOptions,proto3" json:"tls_options,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + TlsOptions *NatsStreamingTLSOptions `protobuf:"bytes,5,opt,name=tls_options,json=tlsOptions,proto3" json:"tls_options,omitempty" kong:"embed"` } -func (m *NatsStreamingConn) Reset() { *m = NatsStreamingConn{} } -func (m *NatsStreamingConn) String() string { return proto.CompactTextString(m) } -func (*NatsStreamingConn) ProtoMessage() {} -func (*NatsStreamingConn) Descriptor() ([]byte, []int) { - return fileDescriptor_5bc025e0cb724b14, []int{1} +func (x *NatsStreamingConn) Reset() { + *x = NatsStreamingConn{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_nats_streaming_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *NatsStreamingConn) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NatsStreamingConn.Unmarshal(m, b) -} -func (m *NatsStreamingConn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NatsStreamingConn.Marshal(b, m, deterministic) -} -func (m *NatsStreamingConn) XXX_Merge(src proto.Message) { - xxx_messageInfo_NatsStreamingConn.Merge(m, src) -} -func (m *NatsStreamingConn) XXX_Size() int { - return xxx_messageInfo_NatsStreamingConn.Size(m) +func (x *NatsStreamingConn) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *NatsStreamingConn) XXX_DiscardUnknown() { - xxx_messageInfo_NatsStreamingConn.DiscardUnknown(m) + +func (*NatsStreamingConn) ProtoMessage() {} + +func (x *NatsStreamingConn) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_nats_streaming_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_NatsStreamingConn proto.InternalMessageInfo +// Deprecated: Use NatsStreamingConn.ProtoReflect.Descriptor instead. +func (*NatsStreamingConn) Descriptor() ([]byte, []int) { + return file_ps_args_nats_streaming_proto_rawDescGZIP(), []int{1} +} -func (m *NatsStreamingConn) GetDsn() string { - if m != nil { - return m.Dsn +func (x *NatsStreamingConn) GetDsn() string { + if x != nil { + return x.Dsn } return "" } -func (m *NatsStreamingConn) GetUserCredentials() string { - if m != nil { - return m.UserCredentials +func (x *NatsStreamingConn) GetUserCredentials() string { + if x != nil { + return x.UserCredentials } return "" } -func (m *NatsStreamingConn) GetClusterId() string { - if m != nil { - return m.ClusterId +func (x *NatsStreamingConn) GetClusterId() string { + if x != nil { + return x.ClusterId } return "" } -func (m *NatsStreamingConn) GetClientId() string { - if m != nil { - return m.ClientId +func (x *NatsStreamingConn) GetClientId() string { + if x != nil { + return x.ClientId } return "" } -func (m *NatsStreamingConn) GetTlsOptions() *NatsStreamingTLSOptions { - if m != nil { - return m.TlsOptions +func (x *NatsStreamingConn) GetTlsOptions() *NatsStreamingTLSOptions { + if x != nil { + return x.TlsOptions } return nil } type NatsStreamingReadArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='NATS stream channel. Ex: orders',env='PLUMBER_RELAY_NATS_STREAMING_CHANNEL'" Channel string `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel,omitempty" kong:"help='NATS stream channel. Ex: orders',env='PLUMBER_RELAY_NATS_STREAMING_CHANNEL'"` // @gotags: kong:"help='Create a durable subscription with this name for the given channel',env='PLUMBER_RELAY_NATS_STREAMING_DURABLE_SUBSCRIPTION_NAME'" @@ -184,159 +204,287 @@ type NatsStreamingReadArgs struct { // @gotags: kong:"help='Deliver messages in last interval (e.g. 1s, 1h)',xor=nats_delivery_option,env='PLUMBER_RELAY_NATS_STREAMING_READ_SINCE'" ReadSince string `protobuf:"bytes,5,opt,name=read_since,json=readSince,proto3" json:"read_since,omitempty" kong:"help='Deliver messages in last interval (e.g. 1s, 1h)',xor=nats_delivery_option,env='PLUMBER_RELAY_NATS_STREAMING_READ_SINCE'"` // @gotags: kong:"help='Deliver all available messages',xor=nats_delivery_option,env='PLUMBER_RELAY_NATS_STREAMING_READ_ALL'" - ReadAll bool `protobuf:"varint,6,opt,name=read_all,json=readAll,proto3" json:"read_all,omitempty" kong:"help='Deliver all available messages',xor=nats_delivery_option,env='PLUMBER_RELAY_NATS_STREAMING_READ_ALL'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ReadAll bool `protobuf:"varint,6,opt,name=read_all,json=readAll,proto3" json:"read_all,omitempty" kong:"help='Deliver all available messages',xor=nats_delivery_option,env='PLUMBER_RELAY_NATS_STREAMING_READ_ALL'"` } -func (m *NatsStreamingReadArgs) Reset() { *m = NatsStreamingReadArgs{} } -func (m *NatsStreamingReadArgs) String() string { return proto.CompactTextString(m) } -func (*NatsStreamingReadArgs) ProtoMessage() {} -func (*NatsStreamingReadArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_5bc025e0cb724b14, []int{2} +func (x *NatsStreamingReadArgs) Reset() { + *x = NatsStreamingReadArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_nats_streaming_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *NatsStreamingReadArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NatsStreamingReadArgs.Unmarshal(m, b) -} -func (m *NatsStreamingReadArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NatsStreamingReadArgs.Marshal(b, m, deterministic) -} -func (m *NatsStreamingReadArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_NatsStreamingReadArgs.Merge(m, src) +func (x *NatsStreamingReadArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *NatsStreamingReadArgs) XXX_Size() int { - return xxx_messageInfo_NatsStreamingReadArgs.Size(m) -} -func (m *NatsStreamingReadArgs) XXX_DiscardUnknown() { - xxx_messageInfo_NatsStreamingReadArgs.DiscardUnknown(m) + +func (*NatsStreamingReadArgs) ProtoMessage() {} + +func (x *NatsStreamingReadArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_nats_streaming_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_NatsStreamingReadArgs proto.InternalMessageInfo +// Deprecated: Use NatsStreamingReadArgs.ProtoReflect.Descriptor instead. +func (*NatsStreamingReadArgs) Descriptor() ([]byte, []int) { + return file_ps_args_nats_streaming_proto_rawDescGZIP(), []int{2} +} -func (m *NatsStreamingReadArgs) GetChannel() string { - if m != nil { - return m.Channel +func (x *NatsStreamingReadArgs) GetChannel() string { + if x != nil { + return x.Channel } return "" } -func (m *NatsStreamingReadArgs) GetDurableName() string { - if m != nil { - return m.DurableName +func (x *NatsStreamingReadArgs) GetDurableName() string { + if x != nil { + return x.DurableName } return "" } -func (m *NatsStreamingReadArgs) GetReadLastAvailable() bool { - if m != nil { - return m.ReadLastAvailable +func (x *NatsStreamingReadArgs) GetReadLastAvailable() bool { + if x != nil { + return x.ReadLastAvailable } return false } -func (m *NatsStreamingReadArgs) GetReadSequenceNumber() uint32 { - if m != nil { - return m.ReadSequenceNumber +func (x *NatsStreamingReadArgs) GetReadSequenceNumber() uint32 { + if x != nil { + return x.ReadSequenceNumber } return 0 } -func (m *NatsStreamingReadArgs) GetReadSince() string { - if m != nil { - return m.ReadSince +func (x *NatsStreamingReadArgs) GetReadSince() string { + if x != nil { + return x.ReadSince } return "" } -func (m *NatsStreamingReadArgs) GetReadAll() bool { - if m != nil { - return m.ReadAll +func (x *NatsStreamingReadArgs) GetReadAll() bool { + if x != nil { + return x.ReadAll } return false } type NatsStreamingWriteArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='NATS stream channel. Ex: orders'" - Channel string `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel,omitempty" kong:"help='NATS stream channel. Ex: orders'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Channel string `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel,omitempty" kong:"help='NATS stream channel. Ex: orders'"` } -func (m *NatsStreamingWriteArgs) Reset() { *m = NatsStreamingWriteArgs{} } -func (m *NatsStreamingWriteArgs) String() string { return proto.CompactTextString(m) } -func (*NatsStreamingWriteArgs) ProtoMessage() {} -func (*NatsStreamingWriteArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_5bc025e0cb724b14, []int{3} +func (x *NatsStreamingWriteArgs) Reset() { + *x = NatsStreamingWriteArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_nats_streaming_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *NatsStreamingWriteArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NatsStreamingWriteArgs.Unmarshal(m, b) +func (x *NatsStreamingWriteArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *NatsStreamingWriteArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NatsStreamingWriteArgs.Marshal(b, m, deterministic) -} -func (m *NatsStreamingWriteArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_NatsStreamingWriteArgs.Merge(m, src) -} -func (m *NatsStreamingWriteArgs) XXX_Size() int { - return xxx_messageInfo_NatsStreamingWriteArgs.Size(m) -} -func (m *NatsStreamingWriteArgs) XXX_DiscardUnknown() { - xxx_messageInfo_NatsStreamingWriteArgs.DiscardUnknown(m) + +func (*NatsStreamingWriteArgs) ProtoMessage() {} + +func (x *NatsStreamingWriteArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_nats_streaming_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_NatsStreamingWriteArgs proto.InternalMessageInfo +// Deprecated: Use NatsStreamingWriteArgs.ProtoReflect.Descriptor instead. +func (*NatsStreamingWriteArgs) Descriptor() ([]byte, []int) { + return file_ps_args_nats_streaming_proto_rawDescGZIP(), []int{3} +} -func (m *NatsStreamingWriteArgs) GetChannel() string { - if m != nil { - return m.Channel +func (x *NatsStreamingWriteArgs) GetChannel() string { + if x != nil { + return x.Channel } return "" } -func init() { - proto.RegisterType((*NatsStreamingTLSOptions)(nil), "protos.args.NatsStreamingTLSOptions") - proto.RegisterType((*NatsStreamingConn)(nil), "protos.args.NatsStreamingConn") - proto.RegisterType((*NatsStreamingReadArgs)(nil), "protos.args.NatsStreamingReadArgs") - proto.RegisterType((*NatsStreamingWriteArgs)(nil), "protos.args.NatsStreamingWriteArgs") -} - -func init() { proto.RegisterFile("ps_args_nats_streaming.proto", fileDescriptor_5bc025e0cb724b14) } - -var fileDescriptor_5bc025e0cb724b14 = []byte{ - // 491 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0x5f, 0x6f, 0xd3, 0x30, - 0x14, 0xc5, 0x15, 0x06, 0x6b, 0xe3, 0x6e, 0x6c, 0x33, 0x7f, 0x16, 0xc4, 0x1f, 0x8d, 0x6a, 0x42, - 0xe3, 0x81, 0x04, 0x8d, 0x27, 0xc4, 0x53, 0xa9, 0x78, 0x98, 0x98, 0x8a, 0x94, 0x4e, 0x20, 0xf1, - 0x62, 0x39, 0xce, 0xa5, 0xb5, 0xea, 0x38, 0xc1, 0xd7, 0x99, 0xd4, 0x6f, 0xc8, 0x3b, 0x5f, 0x84, - 0x8f, 0x80, 0x7c, 0x93, 0xc2, 0xfa, 0x00, 0x4f, 0xf5, 0x3d, 0xe7, 0x57, 0xe7, 0x9c, 0x6b, 0xf6, - 0xa4, 0x41, 0x21, 0xdd, 0x02, 0x85, 0x95, 0x1e, 0x05, 0x7a, 0x07, 0xb2, 0xd2, 0x76, 0x91, 0x36, - 0xae, 0xf6, 0x35, 0x1f, 0xd1, 0x0f, 0xa6, 0x81, 0x18, 0xff, 0x88, 0xd8, 0xf1, 0x4c, 0x7a, 0x9c, - 0x6f, 0xa0, 0xab, 0xcb, 0xf9, 0xa7, 0xc6, 0xeb, 0xda, 0x22, 0x7f, 0xc6, 0x46, 0xde, 0xa0, 0x50, - 0x52, 0x28, 0x70, 0x3e, 0x89, 0x4e, 0xa2, 0xb3, 0x38, 0x8f, 0xbd, 0xc1, 0xa9, 0x9c, 0x82, 0xf3, - 0xfc, 0x05, 0x3b, 0x20, 0xdf, 0x68, 0xb0, 0xbe, 0x63, 0x6e, 0x11, 0xb3, 0x1f, 0x18, 0x52, 0x89, - 0x3b, 0x65, 0x77, 0x6f, 0x70, 0x2b, 0x58, 0x27, 0x3b, 0x84, 0xed, 0xfd, 0xc1, 0x3e, 0xc2, 0x7a, - 0x73, 0x1b, 0xae, 0x74, 0x23, 0xae, 0xc1, 0xe9, 0x6f, 0xeb, 0xe4, 0xf6, 0x49, 0x74, 0x36, 0xa4, - 0xdb, 0xe6, 0x2b, 0xdd, 0x7c, 0x26, 0x91, 0x1f, 0xb3, 0x41, 0x8b, 0x20, 0xbc, 0xc1, 0xe4, 0x0e, - 0xf9, 0xbb, 0x2d, 0xc2, 0x95, 0xc1, 0xf1, 0xcf, 0x88, 0x1d, 0x6d, 0x55, 0x99, 0xd6, 0xd6, 0xf2, - 0x43, 0xb6, 0x53, 0xa2, 0xed, 0xc3, 0x87, 0x23, 0x7f, 0xc9, 0x0e, 0x5b, 0x04, 0x27, 0x94, 0x83, - 0x12, 0xac, 0xd7, 0xd2, 0x60, 0x9f, 0xfb, 0x20, 0xe8, 0xd3, 0xbf, 0x32, 0x7f, 0xca, 0x98, 0x32, - 0x2d, 0x7a, 0x70, 0x42, 0x97, 0x7d, 0xea, 0xb8, 0x57, 0x2e, 0x4a, 0xfe, 0x98, 0xc5, 0x7d, 0x29, - 0x5d, 0x52, 0xd8, 0x38, 0x1f, 0x76, 0xc2, 0x45, 0xc9, 0x3f, 0x74, 0xdb, 0xab, 0xbb, 0x65, 0x52, - 0xd6, 0xd1, 0xf9, 0x69, 0x7a, 0x63, 0xf9, 0xe9, 0x3f, 0x16, 0x9f, 0x33, 0x6f, 0xb0, 0x3f, 0x8f, - 0x7f, 0x45, 0xec, 0xc1, 0x16, 0x97, 0x83, 0x2c, 0x27, 0x6e, 0x81, 0x3c, 0x61, 0x03, 0xb5, 0x94, - 0xd6, 0x82, 0xe9, 0xdb, 0x6d, 0x46, 0xfe, 0x9c, 0xed, 0x95, 0xad, 0x93, 0x85, 0x01, 0x61, 0x65, - 0x05, 0x7d, 0xbb, 0x51, 0xaf, 0xcd, 0x64, 0x05, 0x3c, 0x65, 0xf7, 0x1c, 0xc8, 0x52, 0x18, 0x89, - 0x5e, 0xc8, 0x6b, 0xa9, 0x4d, 0xb0, 0xa8, 0xe2, 0x30, 0x3f, 0x0a, 0xd6, 0xa5, 0x44, 0x3f, 0xd9, - 0x18, 0xfc, 0x35, 0xbb, 0x4f, 0x3c, 0xc2, 0xf7, 0x16, 0xac, 0x02, 0x61, 0xdb, 0xaa, 0x00, 0x47, - 0xad, 0xf7, 0x73, 0x1e, 0xbc, 0x79, 0x6f, 0xcd, 0xc8, 0x09, 0xbb, 0xeb, 0xfe, 0xa1, 0xad, 0x02, - 0xaa, 0x1f, 0xe7, 0x31, 0x71, 0x41, 0xe0, 0x8f, 0xd8, 0x90, 0x6c, 0x69, 0x4c, 0xb2, 0x4b, 0x5f, - 0x1d, 0x84, 0x79, 0x62, 0xcc, 0xf8, 0x9c, 0x3d, 0xdc, 0x6a, 0xfc, 0xc5, 0x69, 0x0f, 0xff, 0xaf, - 0xfc, 0xfe, 0xdd, 0xd7, 0xb7, 0x0b, 0xed, 0x97, 0x6d, 0x91, 0xaa, 0xba, 0xca, 0x0a, 0xe9, 0xd5, - 0x52, 0xd5, 0xae, 0xc9, 0x1a, 0x43, 0x69, 0x5e, 0xa1, 0x5a, 0x42, 0x25, 0x31, 0x2b, 0x5a, 0x6d, - 0xca, 0x6c, 0x51, 0x67, 0xdd, 0x3b, 0x64, 0xe1, 0x1d, 0x8a, 0x5d, 0x1a, 0xde, 0xfc, 0x0e, 0x00, - 0x00, 0xff, 0xff, 0x23, 0x13, 0xcd, 0x60, 0x38, 0x03, 0x00, 0x00, +var File_ps_args_nats_streaming_proto protoreflect.FileDescriptor + +var file_ps_args_nats_streaming_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x22, 0xc8, 0x01, 0x0a, 0x17, + 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x54, 0x4c, 0x53, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1e, 0x0a, 0x0b, 0x74, 0x6c, 0x73, 0x5f, 0x63, + 0x61, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x6c, + 0x73, 0x43, 0x61, 0x43, 0x65, 0x72, 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x6c, 0x73, 0x5f, 0x63, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0d, 0x74, 0x6c, 0x73, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x65, 0x72, 0x74, 0x12, + 0x24, 0x0a, 0x0e, 0x74, 0x6c, 0x73, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6b, 0x65, + 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x6c, 0x73, 0x43, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x6c, 0x73, 0x5f, 0x73, 0x6b, 0x69, + 0x70, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, + 0x74, 0x6c, 0x73, 0x53, 0x6b, 0x69, 0x70, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x12, 0x17, 0x0a, + 0x07, 0x75, 0x73, 0x65, 0x5f, 0x74, 0x6c, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, + 0x75, 0x73, 0x65, 0x54, 0x6c, 0x73, 0x22, 0xd3, 0x01, 0x0a, 0x11, 0x4e, 0x61, 0x74, 0x73, 0x53, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x10, 0x0a, 0x03, + 0x64, 0x73, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x73, 0x6e, 0x12, 0x29, + 0x0a, 0x10, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x43, 0x72, + 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x75, + 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, + 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x45, 0x0a, 0x0b, 0x74, 0x6c, 0x73, 0x5f, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x54, 0x4c, 0x53, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x0a, 0x74, 0x6c, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xf0, 0x01, 0x0a, + 0x15, 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x52, 0x65, + 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, + 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, + 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x2e, 0x0a, 0x13, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6c, 0x61, 0x73, 0x74, + 0x5f, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x11, 0x72, 0x65, 0x61, 0x64, 0x4c, 0x61, 0x73, 0x74, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, + 0x62, 0x6c, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x73, 0x65, 0x71, 0x75, + 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x12, 0x72, 0x65, 0x61, 0x64, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x73, 0x69, + 0x6e, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x61, 0x64, 0x53, + 0x69, 0x6e, 0x63, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x61, 0x6c, 0x6c, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x61, 0x64, 0x41, 0x6c, 0x6c, 0x22, + 0x32, 0x0a, 0x16, 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, + 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, + 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, + 0x6e, 0x65, 0x6c, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, + 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x61, 0x72, 0x67, 0x73, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ps_args_nats_streaming_proto_rawDescOnce sync.Once + file_ps_args_nats_streaming_proto_rawDescData = file_ps_args_nats_streaming_proto_rawDesc +) + +func file_ps_args_nats_streaming_proto_rawDescGZIP() []byte { + file_ps_args_nats_streaming_proto_rawDescOnce.Do(func() { + file_ps_args_nats_streaming_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_args_nats_streaming_proto_rawDescData) + }) + return file_ps_args_nats_streaming_proto_rawDescData +} + +var file_ps_args_nats_streaming_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_ps_args_nats_streaming_proto_goTypes = []interface{}{ + (*NatsStreamingTLSOptions)(nil), // 0: protos.args.NatsStreamingTLSOptions + (*NatsStreamingConn)(nil), // 1: protos.args.NatsStreamingConn + (*NatsStreamingReadArgs)(nil), // 2: protos.args.NatsStreamingReadArgs + (*NatsStreamingWriteArgs)(nil), // 3: protos.args.NatsStreamingWriteArgs +} +var file_ps_args_nats_streaming_proto_depIdxs = []int32{ + 0, // 0: protos.args.NatsStreamingConn.tls_options:type_name -> protos.args.NatsStreamingTLSOptions + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_ps_args_nats_streaming_proto_init() } +func file_ps_args_nats_streaming_proto_init() { + if File_ps_args_nats_streaming_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_args_nats_streaming_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NatsStreamingTLSOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_nats_streaming_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NatsStreamingConn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_nats_streaming_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NatsStreamingReadArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_nats_streaming_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NatsStreamingWriteArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_args_nats_streaming_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_args_nats_streaming_proto_goTypes, + DependencyIndexes: file_ps_args_nats_streaming_proto_depIdxs, + MessageInfos: file_ps_args_nats_streaming_proto_msgTypes, + }.Build() + File_ps_args_nats_streaming_proto = out.File + file_ps_args_nats_streaming_proto_rawDesc = nil + file_ps_args_nats_streaming_proto_goTypes = nil + file_ps_args_nats_streaming_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_nsq.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_nsq.pb.go index 2ca7049f3..804f3830a 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_nsq.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_nsq.pb.go @@ -1,26 +1,30 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_args_nsq.proto package args import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type NSQConn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Address of NSQ server (Ex: localhost:4150)',env='PLUMBER_RELAY_NSQ_NSQD_ADDRESS',default='localhost:4150',xor=nsq_addressZ" NsqdAddress string `protobuf:"bytes,1,opt,name=nsqd_address,json=nsqdAddress,proto3" json:"nsqd_address,omitempty" kong:"help='Address of NSQ server (Ex: localhost:4150)',env='PLUMBER_RELAY_NSQ_NSQD_ADDRESS',default='localhost:4150',xor=nsq_addressZ"` // @gotags: kong:"help='Address of LookupD server (Ex: localhost:4161)',env='PLUMBER_RELAY_NSQ_LOOKUPD_ADDRESS',xor=nsq_address" @@ -38,220 +42,332 @@ type NSQConn struct { // @gotags: kong:"help='Authentication secret',env='PLUMBER_RELAY_NSQ_AUTH_SECRET'" AuthSecret string `protobuf:"bytes,8,opt,name=auth_secret,json=authSecret,proto3" json:"auth_secret,omitempty" kong:"help='Authentication secret',env='PLUMBER_RELAY_NSQ_AUTH_SECRET'"` // @gotags: kong:"help='Client ID to identify as',env='PLUMBER_RELAY_NSQ_CLIENT_ID',default=plumber" - ClientId string `protobuf:"bytes,9,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" kong:"help='Client ID to identify as',env='PLUMBER_RELAY_NSQ_CLIENT_ID',default=plumber"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ClientId string `protobuf:"bytes,9,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" kong:"help='Client ID to identify as',env='PLUMBER_RELAY_NSQ_CLIENT_ID',default=plumber"` } -func (m *NSQConn) Reset() { *m = NSQConn{} } -func (m *NSQConn) String() string { return proto.CompactTextString(m) } -func (*NSQConn) ProtoMessage() {} -func (*NSQConn) Descriptor() ([]byte, []int) { - return fileDescriptor_8e92bb24d9732da6, []int{0} +func (x *NSQConn) Reset() { + *x = NSQConn{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_nsq_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *NSQConn) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NSQConn.Unmarshal(m, b) -} -func (m *NSQConn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NSQConn.Marshal(b, m, deterministic) +func (x *NSQConn) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *NSQConn) XXX_Merge(src proto.Message) { - xxx_messageInfo_NSQConn.Merge(m, src) -} -func (m *NSQConn) XXX_Size() int { - return xxx_messageInfo_NSQConn.Size(m) -} -func (m *NSQConn) XXX_DiscardUnknown() { - xxx_messageInfo_NSQConn.DiscardUnknown(m) + +func (*NSQConn) ProtoMessage() {} + +func (x *NSQConn) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_nsq_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_NSQConn proto.InternalMessageInfo +// Deprecated: Use NSQConn.ProtoReflect.Descriptor instead. +func (*NSQConn) Descriptor() ([]byte, []int) { + return file_ps_args_nsq_proto_rawDescGZIP(), []int{0} +} -func (m *NSQConn) GetNsqdAddress() string { - if m != nil { - return m.NsqdAddress +func (x *NSQConn) GetNsqdAddress() string { + if x != nil { + return x.NsqdAddress } return "" } -func (m *NSQConn) GetLookupdAddress() string { - if m != nil { - return m.LookupdAddress +func (x *NSQConn) GetLookupdAddress() string { + if x != nil { + return x.LookupdAddress } return "" } -func (m *NSQConn) GetUseTls() bool { - if m != nil { - return m.UseTls +func (x *NSQConn) GetUseTls() bool { + if x != nil { + return x.UseTls } return false } -func (m *NSQConn) GetTlsSkipVerify() bool { - if m != nil { - return m.TlsSkipVerify +func (x *NSQConn) GetTlsSkipVerify() bool { + if x != nil { + return x.TlsSkipVerify } return false } -func (m *NSQConn) GetTlsCaCert() string { - if m != nil { - return m.TlsCaCert +func (x *NSQConn) GetTlsCaCert() string { + if x != nil { + return x.TlsCaCert } return "" } -func (m *NSQConn) GetTlsClientCert() string { - if m != nil { - return m.TlsClientCert +func (x *NSQConn) GetTlsClientCert() string { + if x != nil { + return x.TlsClientCert } return "" } -func (m *NSQConn) GetTlsClientKey() string { - if m != nil { - return m.TlsClientKey +func (x *NSQConn) GetTlsClientKey() string { + if x != nil { + return x.TlsClientKey } return "" } -func (m *NSQConn) GetAuthSecret() string { - if m != nil { - return m.AuthSecret +func (x *NSQConn) GetAuthSecret() string { + if x != nil { + return x.AuthSecret } return "" } -func (m *NSQConn) GetClientId() string { - if m != nil { - return m.ClientId +func (x *NSQConn) GetClientId() string { + if x != nil { + return x.ClientId } return "" } type NSQReadArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='NSQ topic to read from',env='PLUMBER_RELAY_NSQ_TOPIC',required" Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty" kong:"help='NSQ topic to read from',env='PLUMBER_RELAY_NSQ_TOPIC',required"` // @gotags: kong:"help='Output channel',env='PLUMBER_RELAY_NSQ_CHANNEL',required" - Channel string `protobuf:"bytes,2,opt,name=channel,proto3" json:"channel,omitempty" kong:"help='Output channel',env='PLUMBER_RELAY_NSQ_CHANNEL',required"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Channel string `protobuf:"bytes,2,opt,name=channel,proto3" json:"channel,omitempty" kong:"help='Output channel',env='PLUMBER_RELAY_NSQ_CHANNEL',required"` } -func (m *NSQReadArgs) Reset() { *m = NSQReadArgs{} } -func (m *NSQReadArgs) String() string { return proto.CompactTextString(m) } -func (*NSQReadArgs) ProtoMessage() {} -func (*NSQReadArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_8e92bb24d9732da6, []int{1} +func (x *NSQReadArgs) Reset() { + *x = NSQReadArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_nsq_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *NSQReadArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NSQReadArgs.Unmarshal(m, b) -} -func (m *NSQReadArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NSQReadArgs.Marshal(b, m, deterministic) +func (x *NSQReadArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *NSQReadArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_NSQReadArgs.Merge(m, src) -} -func (m *NSQReadArgs) XXX_Size() int { - return xxx_messageInfo_NSQReadArgs.Size(m) -} -func (m *NSQReadArgs) XXX_DiscardUnknown() { - xxx_messageInfo_NSQReadArgs.DiscardUnknown(m) + +func (*NSQReadArgs) ProtoMessage() {} + +func (x *NSQReadArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_nsq_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_NSQReadArgs proto.InternalMessageInfo +// Deprecated: Use NSQReadArgs.ProtoReflect.Descriptor instead. +func (*NSQReadArgs) Descriptor() ([]byte, []int) { + return file_ps_args_nsq_proto_rawDescGZIP(), []int{1} +} -func (m *NSQReadArgs) GetTopic() string { - if m != nil { - return m.Topic +func (x *NSQReadArgs) GetTopic() string { + if x != nil { + return x.Topic } return "" } -func (m *NSQReadArgs) GetChannel() string { - if m != nil { - return m.Channel +func (x *NSQReadArgs) GetChannel() string { + if x != nil { + return x.Channel } return "" } type NSQWriteArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='NSQ topic to write to',required" - Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty" kong:"help='NSQ topic to write to',required"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty" kong:"help='NSQ topic to write to',required"` } -func (m *NSQWriteArgs) Reset() { *m = NSQWriteArgs{} } -func (m *NSQWriteArgs) String() string { return proto.CompactTextString(m) } -func (*NSQWriteArgs) ProtoMessage() {} -func (*NSQWriteArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_8e92bb24d9732da6, []int{2} +func (x *NSQWriteArgs) Reset() { + *x = NSQWriteArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_nsq_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *NSQWriteArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NSQWriteArgs.Unmarshal(m, b) +func (x *NSQWriteArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *NSQWriteArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NSQWriteArgs.Marshal(b, m, deterministic) + +func (*NSQWriteArgs) ProtoMessage() {} + +func (x *NSQWriteArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_nsq_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func (m *NSQWriteArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_NSQWriteArgs.Merge(m, src) + +// Deprecated: Use NSQWriteArgs.ProtoReflect.Descriptor instead. +func (*NSQWriteArgs) Descriptor() ([]byte, []int) { + return file_ps_args_nsq_proto_rawDescGZIP(), []int{2} } -func (m *NSQWriteArgs) XXX_Size() int { - return xxx_messageInfo_NSQWriteArgs.Size(m) + +func (x *NSQWriteArgs) GetTopic() string { + if x != nil { + return x.Topic + } + return "" } -func (m *NSQWriteArgs) XXX_DiscardUnknown() { - xxx_messageInfo_NSQWriteArgs.DiscardUnknown(m) + +var File_ps_args_nsq_proto protoreflect.FileDescriptor + +var file_ps_args_nsq_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x73, 0x71, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, + 0x22, 0xc2, 0x02, 0x0a, 0x07, 0x4e, 0x53, 0x51, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x21, 0x0a, 0x0c, + 0x6e, 0x73, 0x71, 0x64, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0b, 0x6e, 0x73, 0x71, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, + 0x27, 0x0a, 0x0f, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x64, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, + 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x5f, + 0x74, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x75, 0x73, 0x65, 0x54, 0x6c, + 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x6c, 0x73, 0x5f, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x76, 0x65, + 0x72, 0x69, 0x66, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x74, 0x6c, 0x73, 0x53, + 0x6b, 0x69, 0x70, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x12, 0x1e, 0x0a, 0x0b, 0x74, 0x6c, 0x73, + 0x5f, 0x63, 0x61, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x74, 0x6c, 0x73, 0x43, 0x61, 0x43, 0x65, 0x72, 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x6c, 0x73, + 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0d, 0x74, 0x6c, 0x73, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x65, 0x72, + 0x74, 0x12, 0x24, 0x0a, 0x0e, 0x74, 0x6c, 0x73, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, + 0x6b, 0x65, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x6c, 0x73, 0x43, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x75, 0x74, 0x68, 0x5f, + 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x75, + 0x74, 0x68, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x3d, 0x0a, 0x0b, 0x4e, 0x53, 0x51, 0x52, 0x65, 0x61, 0x64, + 0x41, 0x72, 0x67, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, + 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, + 0x6e, 0x6e, 0x65, 0x6c, 0x22, 0x24, 0x0a, 0x0c, 0x4e, 0x53, 0x51, 0x57, 0x72, 0x69, 0x74, 0x65, + 0x41, 0x72, 0x67, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, + 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2f, 0x61, 0x72, 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var xxx_messageInfo_NSQWriteArgs proto.InternalMessageInfo +var ( + file_ps_args_nsq_proto_rawDescOnce sync.Once + file_ps_args_nsq_proto_rawDescData = file_ps_args_nsq_proto_rawDesc +) -func (m *NSQWriteArgs) GetTopic() string { - if m != nil { - return m.Topic - } - return "" +func file_ps_args_nsq_proto_rawDescGZIP() []byte { + file_ps_args_nsq_proto_rawDescOnce.Do(func() { + file_ps_args_nsq_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_args_nsq_proto_rawDescData) + }) + return file_ps_args_nsq_proto_rawDescData +} + +var file_ps_args_nsq_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_ps_args_nsq_proto_goTypes = []interface{}{ + (*NSQConn)(nil), // 0: protos.args.NSQConn + (*NSQReadArgs)(nil), // 1: protos.args.NSQReadArgs + (*NSQWriteArgs)(nil), // 2: protos.args.NSQWriteArgs +} +var file_ps_args_nsq_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } -func init() { - proto.RegisterType((*NSQConn)(nil), "protos.args.NSQConn") - proto.RegisterType((*NSQReadArgs)(nil), "protos.args.NSQReadArgs") - proto.RegisterType((*NSQWriteArgs)(nil), "protos.args.NSQWriteArgs") -} - -func init() { proto.RegisterFile("ps_args_nsq.proto", fileDescriptor_8e92bb24d9732da6) } - -var fileDescriptor_8e92bb24d9732da6 = []byte{ - // 359 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0xc1, 0xeb, 0xd3, 0x30, - 0x14, 0xc7, 0xd9, 0x4f, 0x7f, 0xeb, 0x9a, 0xce, 0x0d, 0x83, 0x60, 0x40, 0xd0, 0x39, 0x86, 0xee, - 0xe2, 0x7a, 0xf0, 0x24, 0xe2, 0x61, 0xf6, 0x24, 0xc2, 0x60, 0xab, 0x28, 0x78, 0x09, 0x69, 0xfa, - 0x6c, 0x43, 0xb3, 0x26, 0xcb, 0x4b, 0x85, 0xfd, 0x7b, 0xfe, 0x65, 0xd2, 0xb4, 0x53, 0x2f, 0x9e, - 0xc2, 0xf7, 0x93, 0x4f, 0xbe, 0x81, 0xf7, 0xc8, 0x63, 0x8b, 0x5c, 0xb8, 0x0a, 0x79, 0x8b, 0x97, - 0x9d, 0x75, 0xc6, 0x1b, 0x9a, 0x84, 0x03, 0x77, 0x3d, 0x5e, 0xff, 0xba, 0x23, 0xd1, 0x21, 0x3f, - 0x66, 0xa6, 0x6d, 0xe9, 0x4b, 0x32, 0x6f, 0xf1, 0x52, 0x72, 0x51, 0x96, 0x0e, 0x10, 0xd9, 0x64, - 0x35, 0xd9, 0xc6, 0xa7, 0xa4, 0x67, 0xfb, 0x01, 0xd1, 0xd7, 0x64, 0xa9, 0x8d, 0x69, 0x3a, 0xfb, - 0xd7, 0xba, 0x0b, 0xd6, 0x62, 0xc4, 0x37, 0xf1, 0x29, 0x89, 0x3a, 0x04, 0xee, 0x35, 0xb2, 0x07, - 0xab, 0xc9, 0x76, 0x76, 0x9a, 0x76, 0x08, 0x5f, 0x34, 0xd2, 0x57, 0x64, 0xe9, 0x35, 0x72, 0x6c, - 0x94, 0xe5, 0x3f, 0xc1, 0xa9, 0x1f, 0x57, 0xf6, 0x30, 0x08, 0x8f, 0xbc, 0xc6, 0xbc, 0x51, 0xf6, - 0x6b, 0x80, 0xf4, 0x39, 0x49, 0x7a, 0x4f, 0x0a, 0x2e, 0xc1, 0x79, 0x76, 0x1f, 0x7e, 0x89, 0xbd, - 0xc6, 0x4c, 0x64, 0xe0, 0xfc, 0xad, 0x47, 0x6a, 0x05, 0xad, 0x1f, 0x9c, 0x69, 0x70, 0xfa, 0x9e, - 0x2c, 0xd0, 0xe0, 0x6d, 0xc8, 0xe2, 0x1f, 0xaf, 0x81, 0x2b, 0x8b, 0x82, 0x36, 0xff, 0xa3, 0x7d, - 0x86, 0x2b, 0x7d, 0x41, 0x12, 0xd1, 0xf9, 0x9a, 0x23, 0x48, 0x07, 0x9e, 0xcd, 0x82, 0x42, 0x7a, - 0x94, 0x07, 0x42, 0x9f, 0x91, 0x78, 0xac, 0x50, 0x25, 0x8b, 0xc3, 0xf5, 0x6c, 0x00, 0x9f, 0xca, - 0xf5, 0x07, 0x92, 0x1c, 0xf2, 0xe3, 0x09, 0x44, 0xb9, 0x77, 0x15, 0xd2, 0x27, 0xe4, 0xde, 0x1b, - 0xab, 0xe4, 0x38, 0xc0, 0x21, 0x50, 0x46, 0x22, 0x59, 0x8b, 0xb6, 0x05, 0x3d, 0x8e, 0xec, 0x16, - 0xd7, 0x1b, 0x32, 0x3f, 0xe4, 0xc7, 0x6f, 0x4e, 0x79, 0xf8, 0xff, 0xfb, 0x8f, 0xef, 0xbf, 0xbf, - 0xab, 0x94, 0xaf, 0xbb, 0x62, 0x27, 0xcd, 0x39, 0x2d, 0x84, 0x97, 0xb5, 0x34, 0xce, 0xa6, 0x56, - 0x77, 0xe7, 0x02, 0xdc, 0x1b, 0x94, 0x35, 0x9c, 0x05, 0xa6, 0x45, 0xa7, 0x74, 0x99, 0x56, 0x26, - 0x1d, 0xd6, 0x9c, 0xf6, 0x6b, 0x2e, 0xa6, 0x21, 0xbc, 0xfd, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xde, - 0x66, 0x2e, 0x57, 0x0f, 0x02, 0x00, 0x00, +func init() { file_ps_args_nsq_proto_init() } +func file_ps_args_nsq_proto_init() { + if File_ps_args_nsq_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_args_nsq_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NSQConn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_nsq_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NSQReadArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_nsq_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NSQWriteArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_args_nsq_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_args_nsq_proto_goTypes, + DependencyIndexes: file_ps_args_nsq_proto_depIdxs, + MessageInfos: file_ps_args_nsq_proto_msgTypes, + }.Build() + File_ps_args_nsq_proto = out.File + file_ps_args_nsq_proto_rawDesc = nil + file_ps_args_nsq_proto_goTypes = nil + file_ps_args_nsq_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_postgres.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_postgres.pb.go index 5135bad16..3f22fe3f0 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_postgres.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_postgres.pb.go @@ -1,26 +1,30 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_args_postgres.proto package args import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type PostgresConn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Postgres server hostname',env='PLUMBER_RELAY_CDCPOSTGRES_HOSTNAME',required" Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" kong:"help='Postgres server hostname',env='PLUMBER_RELAY_CDCPOSTGRES_HOSTNAME',required"` // @gotags: kong:"help='Postgres port',env='PLUMBER_RELAY_CDCPOSTGRES_PORT',default=5432,required" @@ -34,162 +38,251 @@ type PostgresConn struct { // @gotags: kong:"help='Enable TLS usage',env='PLUMBER_RELAY_CDCPOSTGRES_USE_TLS'" UseTls bool `protobuf:"varint,6,opt,name=use_tls,json=useTls,proto3" json:"use_tls,omitempty" kong:"help='Enable TLS usage',env='PLUMBER_RELAY_CDCPOSTGRES_USE_TLS'"` // @gotags: kong:"help='Whether to verify server certificate',env='PLUMBER_RELAY_CDCPOSTGRES_SKIP_VERIFY_TLS'" - TlsSkipVerify bool `protobuf:"varint,7,opt,name=tls_skip_verify,json=tlsSkipVerify,proto3" json:"tls_skip_verify,omitempty" kong:"help='Whether to verify server certificate',env='PLUMBER_RELAY_CDCPOSTGRES_SKIP_VERIFY_TLS'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + TlsSkipVerify bool `protobuf:"varint,7,opt,name=tls_skip_verify,json=tlsSkipVerify,proto3" json:"tls_skip_verify,omitempty" kong:"help='Whether to verify server certificate',env='PLUMBER_RELAY_CDCPOSTGRES_SKIP_VERIFY_TLS'"` } -func (m *PostgresConn) Reset() { *m = PostgresConn{} } -func (m *PostgresConn) String() string { return proto.CompactTextString(m) } -func (*PostgresConn) ProtoMessage() {} -func (*PostgresConn) Descriptor() ([]byte, []int) { - return fileDescriptor_70e195e7c743e225, []int{0} +func (x *PostgresConn) Reset() { + *x = PostgresConn{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_postgres_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *PostgresConn) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PostgresConn.Unmarshal(m, b) +func (x *PostgresConn) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *PostgresConn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PostgresConn.Marshal(b, m, deterministic) -} -func (m *PostgresConn) XXX_Merge(src proto.Message) { - xxx_messageInfo_PostgresConn.Merge(m, src) -} -func (m *PostgresConn) XXX_Size() int { - return xxx_messageInfo_PostgresConn.Size(m) -} -func (m *PostgresConn) XXX_DiscardUnknown() { - xxx_messageInfo_PostgresConn.DiscardUnknown(m) + +func (*PostgresConn) ProtoMessage() {} + +func (x *PostgresConn) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_postgres_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_PostgresConn proto.InternalMessageInfo +// Deprecated: Use PostgresConn.ProtoReflect.Descriptor instead. +func (*PostgresConn) Descriptor() ([]byte, []int) { + return file_ps_args_postgres_proto_rawDescGZIP(), []int{0} +} -func (m *PostgresConn) GetAddress() string { - if m != nil { - return m.Address +func (x *PostgresConn) GetAddress() string { + if x != nil { + return x.Address } return "" } -func (m *PostgresConn) GetPort() uint32 { - if m != nil { - return m.Port +func (x *PostgresConn) GetPort() uint32 { + if x != nil { + return x.Port } return 0 } -func (m *PostgresConn) GetUsername() string { - if m != nil { - return m.Username +func (x *PostgresConn) GetUsername() string { + if x != nil { + return x.Username } return "" } -func (m *PostgresConn) GetPassword() string { - if m != nil { - return m.Password +func (x *PostgresConn) GetPassword() string { + if x != nil { + return x.Password } return "" } -func (m *PostgresConn) GetDatabase() string { - if m != nil { - return m.Database +func (x *PostgresConn) GetDatabase() string { + if x != nil { + return x.Database } return "" } -func (m *PostgresConn) GetUseTls() bool { - if m != nil { - return m.UseTls +func (x *PostgresConn) GetUseTls() bool { + if x != nil { + return x.UseTls } return false } -func (m *PostgresConn) GetTlsSkipVerify() bool { - if m != nil { - return m.TlsSkipVerify +func (x *PostgresConn) GetTlsSkipVerify() bool { + if x != nil { + return x.TlsSkipVerify } return false } type PostgresReadArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='CDC replication slot name',env='PLUMBER_RELAY_CDCPOSTGRES_SLOT',required" ReplicationSlotName string `protobuf:"bytes,2,opt,name=replication_slot_name,json=replicationSlotName,proto3" json:"replication_slot_name,omitempty" kong:"help='CDC replication slot name',env='PLUMBER_RELAY_CDCPOSTGRES_SLOT',required"` // @gotags: kong:"help='CDC publisher name',env='PLUMBER_RELAY_CDCPOSTGRES_PUBLISHER',required" - PublisherName string `protobuf:"bytes,3,opt,name=publisher_name,json=publisherName,proto3" json:"publisher_name,omitempty" kong:"help='CDC publisher name',env='PLUMBER_RELAY_CDCPOSTGRES_PUBLISHER',required"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + PublisherName string `protobuf:"bytes,3,opt,name=publisher_name,json=publisherName,proto3" json:"publisher_name,omitempty" kong:"help='CDC publisher name',env='PLUMBER_RELAY_CDCPOSTGRES_PUBLISHER',required"` } -func (m *PostgresReadArgs) Reset() { *m = PostgresReadArgs{} } -func (m *PostgresReadArgs) String() string { return proto.CompactTextString(m) } -func (*PostgresReadArgs) ProtoMessage() {} -func (*PostgresReadArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_70e195e7c743e225, []int{1} +func (x *PostgresReadArgs) Reset() { + *x = PostgresReadArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_postgres_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *PostgresReadArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PostgresReadArgs.Unmarshal(m, b) -} -func (m *PostgresReadArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PostgresReadArgs.Marshal(b, m, deterministic) -} -func (m *PostgresReadArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_PostgresReadArgs.Merge(m, src) +func (x *PostgresReadArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *PostgresReadArgs) XXX_Size() int { - return xxx_messageInfo_PostgresReadArgs.Size(m) -} -func (m *PostgresReadArgs) XXX_DiscardUnknown() { - xxx_messageInfo_PostgresReadArgs.DiscardUnknown(m) + +func (*PostgresReadArgs) ProtoMessage() {} + +func (x *PostgresReadArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_postgres_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_PostgresReadArgs proto.InternalMessageInfo +// Deprecated: Use PostgresReadArgs.ProtoReflect.Descriptor instead. +func (*PostgresReadArgs) Descriptor() ([]byte, []int) { + return file_ps_args_postgres_proto_rawDescGZIP(), []int{1} +} -func (m *PostgresReadArgs) GetReplicationSlotName() string { - if m != nil { - return m.ReplicationSlotName +func (x *PostgresReadArgs) GetReplicationSlotName() string { + if x != nil { + return x.ReplicationSlotName } return "" } -func (m *PostgresReadArgs) GetPublisherName() string { - if m != nil { - return m.PublisherName +func (x *PostgresReadArgs) GetPublisherName() string { + if x != nil { + return x.PublisherName } return "" } -func init() { - proto.RegisterType((*PostgresConn)(nil), "protos.args.PostgresConn") - proto.RegisterType((*PostgresReadArgs)(nil), "protos.args.PostgresReadArgs") -} - -func init() { proto.RegisterFile("ps_args_postgres.proto", fileDescriptor_70e195e7c743e225) } - -var fileDescriptor_70e195e7c743e225 = []byte{ - // 310 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0x41, 0x4b, 0x33, 0x31, - 0x10, 0x86, 0xd9, 0x7e, 0xfd, 0xda, 0x1a, 0xad, 0x4a, 0x44, 0x0d, 0x9e, 0x4a, 0x41, 0xe9, 0xc5, - 0x2e, 0xe8, 0x49, 0x3c, 0xa9, 0x77, 0x91, 0xad, 0x78, 0xf0, 0x12, 0xb2, 0xbb, 0xe3, 0x6e, 0x68, - 0x76, 0x13, 0x66, 0x12, 0xc5, 0x9f, 0xe9, 0x3f, 0x92, 0x4d, 0xdd, 0xd2, 0x53, 0xf2, 0xcc, 0xf3, - 0x42, 0xf2, 0x0e, 0x3b, 0x73, 0x24, 0x15, 0x56, 0x24, 0x9d, 0x25, 0x5f, 0x21, 0xd0, 0xd2, 0xa1, - 0xf5, 0x96, 0xef, 0xc7, 0x83, 0x96, 0x9d, 0x9b, 0xff, 0x24, 0xec, 0xe0, 0xe5, 0xcf, 0x3f, 0xd9, - 0xb6, 0xe5, 0x82, 0x8d, 0x55, 0x59, 0x22, 0x10, 0x89, 0x64, 0x96, 0x2c, 0xf6, 0xb2, 0x1e, 0x39, - 0x67, 0x43, 0x67, 0xd1, 0x8b, 0xc1, 0x2c, 0x59, 0x4c, 0xb3, 0x78, 0xe7, 0x17, 0x6c, 0x12, 0x08, - 0xb0, 0x55, 0x0d, 0x88, 0x7f, 0x31, 0xbe, 0xe5, 0xce, 0x39, 0x45, 0xf4, 0x65, 0xb1, 0x14, 0xc3, - 0x8d, 0xeb, 0xb9, 0x73, 0xa5, 0xf2, 0x2a, 0x57, 0x04, 0xe2, 0xff, 0xc6, 0xf5, 0xcc, 0xcf, 0xd9, - 0x38, 0x10, 0x48, 0x6f, 0x48, 0x8c, 0x66, 0xc9, 0x62, 0x92, 0x8d, 0x02, 0xc1, 0xab, 0x21, 0x7e, - 0xc5, 0x8e, 0xbc, 0x21, 0x49, 0x6b, 0xed, 0xe4, 0x27, 0xa0, 0xfe, 0xf8, 0x16, 0xe3, 0x18, 0x98, - 0x7a, 0x43, 0xab, 0xb5, 0x76, 0x6f, 0x71, 0x38, 0x6f, 0xd8, 0x71, 0x5f, 0x29, 0x03, 0x55, 0x3e, - 0x60, 0x45, 0xfc, 0x86, 0x9d, 0x22, 0x38, 0xa3, 0x0b, 0xe5, 0xb5, 0x6d, 0x25, 0x19, 0xeb, 0x65, - 0xfc, 0xf5, 0x20, 0xbe, 0x7e, 0xb2, 0x23, 0x57, 0xc6, 0xfa, 0xe7, 0xae, 0xc0, 0x25, 0x3b, 0x74, - 0x21, 0x37, 0x9a, 0x6a, 0x40, 0xb9, 0x53, 0x71, 0xba, 0x9d, 0x76, 0xb1, 0xc7, 0xfb, 0xf7, 0xbb, - 0x4a, 0xfb, 0x3a, 0xe4, 0xcb, 0xc2, 0x36, 0x69, 0xae, 0x7c, 0x51, 0x17, 0x16, 0x5d, 0xea, 0x4c, - 0x68, 0x72, 0xc0, 0x6b, 0x2a, 0x6a, 0x68, 0x14, 0xa5, 0x79, 0xd0, 0xa6, 0x4c, 0x2b, 0x9b, 0x6e, - 0xf6, 0x9f, 0x76, 0xfb, 0xcf, 0x47, 0x11, 0x6e, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xf3, 0x6b, - 0x3e, 0xc5, 0xad, 0x01, 0x00, 0x00, +var File_ps_args_postgres_proto protoreflect.FileDescriptor + +var file_ps_args_postgres_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, + 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x61, 0x72, 0x67, 0x73, 0x22, 0xd1, 0x01, 0x0a, 0x0c, 0x50, 0x6f, 0x73, 0x74, 0x67, 0x72, + 0x65, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, + 0x70, 0x6f, 0x72, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1a, 0x0a, 0x08, + 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x5f, + 0x74, 0x6c, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x75, 0x73, 0x65, 0x54, 0x6c, + 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x6c, 0x73, 0x5f, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x76, 0x65, + 0x72, 0x69, 0x66, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x74, 0x6c, 0x73, 0x53, + 0x6b, 0x69, 0x70, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x22, 0x6d, 0x0a, 0x10, 0x50, 0x6f, 0x73, + 0x74, 0x67, 0x72, 0x65, 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x12, 0x32, 0x0a, + 0x15, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x6c, 0x6f, + 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x72, 0x65, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x6c, 0x6f, 0x74, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x72, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x75, 0x62, 0x6c, 0x69, + 0x73, 0x68, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, + 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, + 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2f, 0x61, 0x72, 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ps_args_postgres_proto_rawDescOnce sync.Once + file_ps_args_postgres_proto_rawDescData = file_ps_args_postgres_proto_rawDesc +) + +func file_ps_args_postgres_proto_rawDescGZIP() []byte { + file_ps_args_postgres_proto_rawDescOnce.Do(func() { + file_ps_args_postgres_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_args_postgres_proto_rawDescData) + }) + return file_ps_args_postgres_proto_rawDescData +} + +var file_ps_args_postgres_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_ps_args_postgres_proto_goTypes = []interface{}{ + (*PostgresConn)(nil), // 0: protos.args.PostgresConn + (*PostgresReadArgs)(nil), // 1: protos.args.PostgresReadArgs +} +var file_ps_args_postgres_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_ps_args_postgres_proto_init() } +func file_ps_args_postgres_proto_init() { + if File_ps_args_postgres_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_args_postgres_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PostgresConn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_postgres_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PostgresReadArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_args_postgres_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_args_postgres_proto_goTypes, + DependencyIndexes: file_ps_args_postgres_proto_depIdxs, + MessageInfos: file_ps_args_postgres_proto_msgTypes, + }.Build() + File_ps_args_postgres_proto = out.File + file_ps_args_postgres_proto_rawDesc = nil + file_ps_args_postgres_proto_goTypes = nil + file_ps_args_postgres_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_pulsar.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_pulsar.pb.go index 15a21dfd0..50f3d25a7 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_pulsar.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_pulsar.pb.go @@ -1,24 +1,24 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_args_pulsar.proto package args import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type SubscriptionType int32 @@ -29,26 +29,47 @@ const ( SubscriptionType_KEYSHARED SubscriptionType = 3 ) -var SubscriptionType_name = map[int32]string{ - 0: "SHARED", - 1: "EXCLUSIVE", - 2: "FAILOVER", - 3: "KEYSHARED", -} +// Enum value maps for SubscriptionType. +var ( + SubscriptionType_name = map[int32]string{ + 0: "SHARED", + 1: "EXCLUSIVE", + 2: "FAILOVER", + 3: "KEYSHARED", + } + SubscriptionType_value = map[string]int32{ + "SHARED": 0, + "EXCLUSIVE": 1, + "FAILOVER": 2, + "KEYSHARED": 3, + } +) -var SubscriptionType_value = map[string]int32{ - "SHARED": 0, - "EXCLUSIVE": 1, - "FAILOVER": 2, - "KEYSHARED": 3, +func (x SubscriptionType) Enum() *SubscriptionType { + p := new(SubscriptionType) + *p = x + return p } func (x SubscriptionType) String() string { - return proto.EnumName(SubscriptionType_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } +func (SubscriptionType) Descriptor() protoreflect.EnumDescriptor { + return file_ps_args_pulsar_proto_enumTypes[0].Descriptor() +} + +func (SubscriptionType) Type() protoreflect.EnumType { + return &file_ps_args_pulsar_proto_enumTypes[0] +} + +func (x SubscriptionType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SubscriptionType.Descriptor instead. func (SubscriptionType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_88efd85ac0b2fc8d, []int{0} + return file_ps_args_pulsar_proto_rawDescGZIP(), []int{0} } type SubscriptionInitialPosition int32 @@ -58,25 +79,50 @@ const ( SubscriptionInitialPosition_PULSAR_EARLIEST SubscriptionInitialPosition = 1 ) -var SubscriptionInitialPosition_name = map[int32]string{ - 0: "PULSAR_LATEST", - 1: "PULSAR_EARLIEST", -} +// Enum value maps for SubscriptionInitialPosition. +var ( + SubscriptionInitialPosition_name = map[int32]string{ + 0: "PULSAR_LATEST", + 1: "PULSAR_EARLIEST", + } + SubscriptionInitialPosition_value = map[string]int32{ + "PULSAR_LATEST": 0, + "PULSAR_EARLIEST": 1, + } +) -var SubscriptionInitialPosition_value = map[string]int32{ - "PULSAR_LATEST": 0, - "PULSAR_EARLIEST": 1, +func (x SubscriptionInitialPosition) Enum() *SubscriptionInitialPosition { + p := new(SubscriptionInitialPosition) + *p = x + return p } func (x SubscriptionInitialPosition) String() string { - return proto.EnumName(SubscriptionInitialPosition_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SubscriptionInitialPosition) Descriptor() protoreflect.EnumDescriptor { + return file_ps_args_pulsar_proto_enumTypes[1].Descriptor() +} + +func (SubscriptionInitialPosition) Type() protoreflect.EnumType { + return &file_ps_args_pulsar_proto_enumTypes[1] +} + +func (x SubscriptionInitialPosition) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) } +// Deprecated: Use SubscriptionInitialPosition.Descriptor instead. func (SubscriptionInitialPosition) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_88efd85ac0b2fc8d, []int{1} + return file_ps_args_pulsar_proto_rawDescGZIP(), []int{1} } type PulsarConn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Full DSN to connect to Pulsar',default='pulsar://localhost:6650',required" Dsn string `protobuf:"bytes,1,opt,name=dsn,proto3" json:"dsn,omitempty" kong:"help='Full DSN to connect to Pulsar',default='pulsar://localhost:6650',required"` // @gotags: kong:"help='Connection timeout',default=10" @@ -90,87 +136,95 @@ type PulsarConn struct { // @gotags: kong:"help='Authentication token file'" Token string `protobuf:"bytes,6,opt,name=token,proto3" json:"token,omitempty" kong:"help='Authentication token file'"` // @gotags: kong:"help='Listener name'" - ListenerName string `protobuf:"bytes,7,opt,name=listener_name,json=listenerName,proto3" json:"listener_name,omitempty" kong:"help='Listener name'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ListenerName string `protobuf:"bytes,7,opt,name=listener_name,json=listenerName,proto3" json:"listener_name,omitempty" kong:"help='Listener name'"` } -func (m *PulsarConn) Reset() { *m = PulsarConn{} } -func (m *PulsarConn) String() string { return proto.CompactTextString(m) } -func (*PulsarConn) ProtoMessage() {} -func (*PulsarConn) Descriptor() ([]byte, []int) { - return fileDescriptor_88efd85ac0b2fc8d, []int{0} +func (x *PulsarConn) Reset() { + *x = PulsarConn{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_pulsar_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *PulsarConn) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PulsarConn.Unmarshal(m, b) -} -func (m *PulsarConn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PulsarConn.Marshal(b, m, deterministic) +func (x *PulsarConn) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *PulsarConn) XXX_Merge(src proto.Message) { - xxx_messageInfo_PulsarConn.Merge(m, src) -} -func (m *PulsarConn) XXX_Size() int { - return xxx_messageInfo_PulsarConn.Size(m) -} -func (m *PulsarConn) XXX_DiscardUnknown() { - xxx_messageInfo_PulsarConn.DiscardUnknown(m) + +func (*PulsarConn) ProtoMessage() {} + +func (x *PulsarConn) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_pulsar_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_PulsarConn proto.InternalMessageInfo +// Deprecated: Use PulsarConn.ProtoReflect.Descriptor instead. +func (*PulsarConn) Descriptor() ([]byte, []int) { + return file_ps_args_pulsar_proto_rawDescGZIP(), []int{0} +} -func (m *PulsarConn) GetDsn() string { - if m != nil { - return m.Dsn +func (x *PulsarConn) GetDsn() string { + if x != nil { + return x.Dsn } return "" } -func (m *PulsarConn) GetConnectTimeoutSeconds() uint32 { - if m != nil { - return m.ConnectTimeoutSeconds +func (x *PulsarConn) GetConnectTimeoutSeconds() uint32 { + if x != nil { + return x.ConnectTimeoutSeconds } return 0 } -func (m *PulsarConn) GetTlsSkipVerify() bool { - if m != nil { - return m.TlsSkipVerify +func (x *PulsarConn) GetTlsSkipVerify() bool { + if x != nil { + return x.TlsSkipVerify } return false } -func (m *PulsarConn) GetTlsClientCert() string { - if m != nil { - return m.TlsClientCert +func (x *PulsarConn) GetTlsClientCert() string { + if x != nil { + return x.TlsClientCert } return "" } -func (m *PulsarConn) GetTlsClientKey() string { - if m != nil { - return m.TlsClientKey +func (x *PulsarConn) GetTlsClientKey() string { + if x != nil { + return x.TlsClientKey } return "" } -func (m *PulsarConn) GetToken() string { - if m != nil { - return m.Token +func (x *PulsarConn) GetToken() string { + if x != nil { + return x.Token } return "" } -func (m *PulsarConn) GetListenerName() string { - if m != nil { - return m.ListenerName +func (x *PulsarConn) GetListenerName() string { + if x != nil { + return x.ListenerName } return "" } type PulsarReadArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Topic to read messages from',required" Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty" kong:"help='Topic to read messages from',required"` // @gotags: kong:"help='Subscription name',required" @@ -178,146 +232,264 @@ type PulsarReadArgs struct { // @gotags: kong:"help='Subscription type (options: shared exclusive failover keyshared)',default=shared,type=pbenum,pbenum_lowercase" SubscriptionType SubscriptionType `protobuf:"varint,3,opt,name=subscription_type,json=subscriptionType,proto3,enum=protos.args.SubscriptionType" json:"subscription_type,omitempty" kong:"help='Subscription type (options: shared exclusive failover keyshared)',default=shared,type=pbenum,pbenum_lowercase"` // @gotags: kong:"help='Subscription initial position (options: latest earliest)',default=latest,type=pbenum,pbenum_lowercase,pbenum_strip_prefix=PULSAR_" - InitialPosition SubscriptionInitialPosition `protobuf:"varint,4,opt,name=initial_position,json=initialPosition,proto3,enum=protos.args.SubscriptionInitialPosition" json:"initial_position,omitempty" kong:"help='Subscription initial position (options: latest earliest)',default=latest,type=pbenum,pbenum_lowercase,pbenum_strip_prefix=PULSAR_"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + InitialPosition SubscriptionInitialPosition `protobuf:"varint,4,opt,name=initial_position,json=initialPosition,proto3,enum=protos.args.SubscriptionInitialPosition" json:"initial_position,omitempty" kong:"help='Subscription initial position (options: latest earliest)',default=latest,type=pbenum,pbenum_lowercase,pbenum_strip_prefix=PULSAR_"` } -func (m *PulsarReadArgs) Reset() { *m = PulsarReadArgs{} } -func (m *PulsarReadArgs) String() string { return proto.CompactTextString(m) } -func (*PulsarReadArgs) ProtoMessage() {} -func (*PulsarReadArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_88efd85ac0b2fc8d, []int{1} +func (x *PulsarReadArgs) Reset() { + *x = PulsarReadArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_pulsar_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *PulsarReadArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PulsarReadArgs.Unmarshal(m, b) -} -func (m *PulsarReadArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PulsarReadArgs.Marshal(b, m, deterministic) +func (x *PulsarReadArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *PulsarReadArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_PulsarReadArgs.Merge(m, src) -} -func (m *PulsarReadArgs) XXX_Size() int { - return xxx_messageInfo_PulsarReadArgs.Size(m) -} -func (m *PulsarReadArgs) XXX_DiscardUnknown() { - xxx_messageInfo_PulsarReadArgs.DiscardUnknown(m) + +func (*PulsarReadArgs) ProtoMessage() {} + +func (x *PulsarReadArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_pulsar_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_PulsarReadArgs proto.InternalMessageInfo +// Deprecated: Use PulsarReadArgs.ProtoReflect.Descriptor instead. +func (*PulsarReadArgs) Descriptor() ([]byte, []int) { + return file_ps_args_pulsar_proto_rawDescGZIP(), []int{1} +} -func (m *PulsarReadArgs) GetTopic() string { - if m != nil { - return m.Topic +func (x *PulsarReadArgs) GetTopic() string { + if x != nil { + return x.Topic } return "" } -func (m *PulsarReadArgs) GetSubscriptionName() string { - if m != nil { - return m.SubscriptionName +func (x *PulsarReadArgs) GetSubscriptionName() string { + if x != nil { + return x.SubscriptionName } return "" } -func (m *PulsarReadArgs) GetSubscriptionType() SubscriptionType { - if m != nil { - return m.SubscriptionType +func (x *PulsarReadArgs) GetSubscriptionType() SubscriptionType { + if x != nil { + return x.SubscriptionType } return SubscriptionType_SHARED } -func (m *PulsarReadArgs) GetInitialPosition() SubscriptionInitialPosition { - if m != nil { - return m.InitialPosition +func (x *PulsarReadArgs) GetInitialPosition() SubscriptionInitialPosition { + if x != nil { + return x.InitialPosition } return SubscriptionInitialPosition_PULSAR_LATEST } type PulsarWriteArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='topic to write messages to'" - Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty" kong:"help='topic to write messages to'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty" kong:"help='topic to write messages to'"` } -func (m *PulsarWriteArgs) Reset() { *m = PulsarWriteArgs{} } -func (m *PulsarWriteArgs) String() string { return proto.CompactTextString(m) } -func (*PulsarWriteArgs) ProtoMessage() {} -func (*PulsarWriteArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_88efd85ac0b2fc8d, []int{2} +func (x *PulsarWriteArgs) Reset() { + *x = PulsarWriteArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_pulsar_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *PulsarWriteArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PulsarWriteArgs.Unmarshal(m, b) -} -func (m *PulsarWriteArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PulsarWriteArgs.Marshal(b, m, deterministic) +func (x *PulsarWriteArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *PulsarWriteArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_PulsarWriteArgs.Merge(m, src) -} -func (m *PulsarWriteArgs) XXX_Size() int { - return xxx_messageInfo_PulsarWriteArgs.Size(m) -} -func (m *PulsarWriteArgs) XXX_DiscardUnknown() { - xxx_messageInfo_PulsarWriteArgs.DiscardUnknown(m) + +func (*PulsarWriteArgs) ProtoMessage() {} + +func (x *PulsarWriteArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_pulsar_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_PulsarWriteArgs proto.InternalMessageInfo +// Deprecated: Use PulsarWriteArgs.ProtoReflect.Descriptor instead. +func (*PulsarWriteArgs) Descriptor() ([]byte, []int) { + return file_ps_args_pulsar_proto_rawDescGZIP(), []int{2} +} -func (m *PulsarWriteArgs) GetTopic() string { - if m != nil { - return m.Topic +func (x *PulsarWriteArgs) GetTopic() string { + if x != nil { + return x.Topic } return "" } -func init() { - proto.RegisterEnum("protos.args.SubscriptionType", SubscriptionType_name, SubscriptionType_value) - proto.RegisterEnum("protos.args.SubscriptionInitialPosition", SubscriptionInitialPosition_name, SubscriptionInitialPosition_value) - proto.RegisterType((*PulsarConn)(nil), "protos.args.PulsarConn") - proto.RegisterType((*PulsarReadArgs)(nil), "protos.args.PulsarReadArgs") - proto.RegisterType((*PulsarWriteArgs)(nil), "protos.args.PulsarWriteArgs") -} - -func init() { proto.RegisterFile("ps_args_pulsar.proto", fileDescriptor_88efd85ac0b2fc8d) } - -var fileDescriptor_88efd85ac0b2fc8d = []byte{ - // 487 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xdf, 0x6e, 0xd3, 0x30, - 0x18, 0xc5, 0x97, 0x96, 0x95, 0xed, 0x63, 0x6d, 0x33, 0x33, 0x44, 0x24, 0x84, 0x54, 0x15, 0x04, - 0xd5, 0x10, 0x8d, 0x34, 0x24, 0x24, 0xc4, 0x55, 0x28, 0x41, 0x74, 0xab, 0xa0, 0x4a, 0xba, 0xf2, - 0xe7, 0xc6, 0x4a, 0x5c, 0xd3, 0x5a, 0x4d, 0x6c, 0xcb, 0x76, 0x90, 0xfa, 0x04, 0xbc, 0x30, 0x0f, - 0x80, 0x62, 0x77, 0xa8, 0x9b, 0xb4, 0x5d, 0x25, 0xdf, 0x39, 0x3f, 0x9f, 0xf8, 0x3b, 0x81, 0x13, - 0xa9, 0x71, 0xa6, 0x96, 0x1a, 0xcb, 0xaa, 0xd0, 0x99, 0x1a, 0x4a, 0x25, 0x8c, 0x40, 0x0f, 0xec, - 0x43, 0x0f, 0x6b, 0xa7, 0xff, 0xa7, 0x01, 0x30, 0xb5, 0xee, 0x48, 0x70, 0x8e, 0x7c, 0x68, 0x2e, - 0x34, 0x0f, 0xbc, 0x9e, 0x37, 0x38, 0x4c, 0xea, 0x57, 0xf4, 0x16, 0x1e, 0x13, 0xc1, 0x39, 0x25, - 0x06, 0x1b, 0x56, 0x52, 0x51, 0x19, 0xac, 0x29, 0x11, 0x7c, 0xa1, 0x83, 0x46, 0xcf, 0x1b, 0xb4, - 0x93, 0x47, 0x5b, 0x7b, 0xe6, 0xdc, 0xd4, 0x99, 0xe8, 0x05, 0x74, 0x4d, 0xa1, 0xb1, 0x5e, 0x33, - 0x89, 0x7f, 0x53, 0xc5, 0x7e, 0x6d, 0x82, 0x66, 0xcf, 0x1b, 0x1c, 0x24, 0x6d, 0x53, 0xe8, 0x74, - 0xcd, 0xe4, 0xdc, 0x8a, 0x57, 0x1c, 0x29, 0x18, 0xe5, 0x06, 0x13, 0xaa, 0x4c, 0x70, 0xcf, 0x7e, - 0xbd, 0xe6, 0x46, 0x56, 0x1d, 0x51, 0x65, 0xd0, 0x73, 0xe8, 0xec, 0x70, 0x6b, 0xba, 0x09, 0xf6, - 0x2d, 0x76, 0xf4, 0x1f, 0xbb, 0xa0, 0x1b, 0x74, 0x02, 0xfb, 0x46, 0xac, 0x29, 0x0f, 0x5a, 0xd6, - 0x74, 0x03, 0x7a, 0x06, 0xed, 0x82, 0x69, 0x43, 0x39, 0x55, 0x98, 0x67, 0x25, 0x0d, 0xee, 0xbb, - 0xa3, 0x57, 0xe2, 0x97, 0xac, 0xa4, 0xfd, 0xbf, 0x1e, 0x74, 0x5c, 0x13, 0x09, 0xcd, 0x16, 0x91, - 0x5a, 0x6a, 0x97, 0x26, 0x19, 0xd9, 0xf6, 0xe1, 0x06, 0xf4, 0x0a, 0x8e, 0x75, 0x95, 0x6b, 0xa2, - 0x98, 0x34, 0x4c, 0x70, 0x97, 0xd8, 0xb0, 0x84, 0xbf, 0x6b, 0xd4, 0xa9, 0xe8, 0xfc, 0x06, 0x6c, - 0x36, 0x92, 0xda, 0x22, 0x3a, 0x67, 0x4f, 0x87, 0x3b, 0x3f, 0x62, 0x98, 0xee, 0x50, 0xb3, 0x8d, - 0xa4, 0xd7, 0xb3, 0x6a, 0x05, 0xa5, 0xe0, 0x33, 0xce, 0x0c, 0xcb, 0x0a, 0x2c, 0x85, 0x66, 0xb5, - 0x6e, 0xbb, 0xea, 0x9c, 0x0d, 0x6e, 0x8d, 0x1a, 0xbb, 0x03, 0xd3, 0x2d, 0x9f, 0x74, 0xd9, 0x75, - 0xa1, 0xff, 0x12, 0xba, 0x6e, 0xeb, 0x6f, 0x8a, 0x19, 0x7a, 0xfb, 0xda, 0xa7, 0xe7, 0xe0, 0xdf, - 0xbc, 0x23, 0x02, 0x68, 0xa5, 0x9f, 0xa3, 0x24, 0xfe, 0xe8, 0xef, 0xa1, 0x36, 0x1c, 0xc6, 0xdf, - 0x47, 0x93, 0xcb, 0x74, 0x3c, 0x8f, 0x7d, 0x0f, 0x1d, 0xc1, 0xc1, 0xa7, 0x68, 0x3c, 0xf9, 0x3a, - 0x8f, 0x13, 0xbf, 0x51, 0x9b, 0x17, 0xf1, 0x8f, 0x2d, 0xdb, 0x3c, 0x8d, 0xe1, 0xc9, 0x1d, 0x97, - 0x44, 0xc7, 0xd0, 0x9e, 0x5e, 0x4e, 0xd2, 0x28, 0xc1, 0x93, 0x68, 0x16, 0xa7, 0x33, 0x7f, 0x0f, - 0x3d, 0x84, 0xee, 0x56, 0x8a, 0xa3, 0x64, 0x32, 0xae, 0x45, 0xef, 0xc3, 0xfb, 0x9f, 0xef, 0x96, - 0xcc, 0xac, 0xaa, 0x7c, 0x48, 0x44, 0x19, 0xe6, 0x99, 0x21, 0x2b, 0x22, 0x94, 0x0c, 0x65, 0x51, - 0x95, 0x39, 0x55, 0xaf, 0x35, 0x59, 0xd1, 0x32, 0xd3, 0x61, 0x5e, 0xb1, 0x62, 0x11, 0x2e, 0x45, - 0xe8, 0x5a, 0x0a, 0xeb, 0x96, 0xf2, 0x96, 0x1d, 0xde, 0xfc, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x1b, - 0x03, 0x19, 0x28, 0x25, 0x03, 0x00, 0x00, +var File_ps_args_pulsar_proto protoreflect.FileDescriptor + +var file_ps_args_pulsar_proto_rawDesc = []byte{ + 0x0a, 0x14, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x70, 0x75, 0x6c, 0x73, 0x61, 0x72, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, + 0x72, 0x67, 0x73, 0x22, 0x87, 0x02, 0x0a, 0x0a, 0x50, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x43, 0x6f, + 0x6e, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x73, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x64, 0x73, 0x6e, 0x12, 0x36, 0x0a, 0x17, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, + 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x15, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x54, 0x69, + 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x26, 0x0a, 0x0f, + 0x74, 0x6c, 0x73, 0x5f, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x74, 0x6c, 0x73, 0x53, 0x6b, 0x69, 0x70, 0x56, 0x65, + 0x72, 0x69, 0x66, 0x79, 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x6c, 0x73, 0x5f, 0x63, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, + 0x6c, 0x73, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x65, 0x72, 0x74, 0x12, 0x24, 0x0a, 0x0e, + 0x74, 0x6c, 0x73, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x6c, 0x73, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x6c, 0x69, 0x73, 0x74, + 0x65, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0c, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xf4, 0x01, + 0x0a, 0x0e, 0x50, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, + 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x2b, 0x0a, 0x11, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x10, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x4a, 0x0a, 0x11, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x53, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x10, 0x73, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x53, 0x0a, 0x10, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x0f, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x50, 0x6f, 0x73, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x27, 0x0a, 0x0f, 0x50, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x57, 0x72, + 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x2a, 0x4a, 0x0a, + 0x10, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x48, 0x41, 0x52, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0d, 0x0a, + 0x09, 0x45, 0x58, 0x43, 0x4c, 0x55, 0x53, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, + 0x46, 0x41, 0x49, 0x4c, 0x4f, 0x56, 0x45, 0x52, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x4b, 0x45, + 0x59, 0x53, 0x48, 0x41, 0x52, 0x45, 0x44, 0x10, 0x03, 0x2a, 0x45, 0x0a, 0x1b, 0x53, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, + 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x55, 0x4c, 0x53, + 0x41, 0x52, 0x5f, 0x4c, 0x41, 0x54, 0x45, 0x53, 0x54, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x50, + 0x55, 0x4c, 0x53, 0x41, 0x52, 0x5f, 0x45, 0x41, 0x52, 0x4c, 0x49, 0x45, 0x53, 0x54, 0x10, 0x01, + 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, + 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, + 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x61, 0x72, 0x67, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ps_args_pulsar_proto_rawDescOnce sync.Once + file_ps_args_pulsar_proto_rawDescData = file_ps_args_pulsar_proto_rawDesc +) + +func file_ps_args_pulsar_proto_rawDescGZIP() []byte { + file_ps_args_pulsar_proto_rawDescOnce.Do(func() { + file_ps_args_pulsar_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_args_pulsar_proto_rawDescData) + }) + return file_ps_args_pulsar_proto_rawDescData +} + +var file_ps_args_pulsar_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_ps_args_pulsar_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_ps_args_pulsar_proto_goTypes = []interface{}{ + (SubscriptionType)(0), // 0: protos.args.SubscriptionType + (SubscriptionInitialPosition)(0), // 1: protos.args.SubscriptionInitialPosition + (*PulsarConn)(nil), // 2: protos.args.PulsarConn + (*PulsarReadArgs)(nil), // 3: protos.args.PulsarReadArgs + (*PulsarWriteArgs)(nil), // 4: protos.args.PulsarWriteArgs +} +var file_ps_args_pulsar_proto_depIdxs = []int32{ + 0, // 0: protos.args.PulsarReadArgs.subscription_type:type_name -> protos.args.SubscriptionType + 1, // 1: protos.args.PulsarReadArgs.initial_position:type_name -> protos.args.SubscriptionInitialPosition + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_ps_args_pulsar_proto_init() } +func file_ps_args_pulsar_proto_init() { + if File_ps_args_pulsar_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_args_pulsar_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PulsarConn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_pulsar_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PulsarReadArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_pulsar_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PulsarWriteArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_args_pulsar_proto_rawDesc, + NumEnums: 2, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_args_pulsar_proto_goTypes, + DependencyIndexes: file_ps_args_pulsar_proto_depIdxs, + EnumInfos: file_ps_args_pulsar_proto_enumTypes, + MessageInfos: file_ps_args_pulsar_proto_msgTypes, + }.Build() + File_ps_args_pulsar_proto = out.File + file_ps_args_pulsar_proto_rawDesc = nil + file_ps_args_pulsar_proto_goTypes = nil + file_ps_args_pulsar_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_rabbit.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_rabbit.pb.go index 50b18a43b..bf0a5a4e5 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_rabbit.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_rabbit.pb.go @@ -1,84 +1,96 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_args_rabbit.proto package args import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type RabbitConn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Destination host address (full DSN)',env='PLUMBER_RELAY_RABBIT_ADDRESS',default='amqp://localhost',required" Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" kong:"help='Destination host address (full DSN)',env='PLUMBER_RELAY_RABBIT_ADDRESS',default='amqp://localhost',required"` // @gotags: kong:"help='Force TLS usage (regardless of DSN)',env='PLUMBER_RELAY_RABBIT_USE_TLS'" UseTls bool `protobuf:"varint,2,opt,name=use_tls,json=useTls,proto3" json:"use_tls,omitempty" kong:"help='Force TLS usage (regardless of DSN)',env='PLUMBER_RELAY_RABBIT_USE_TLS'"` // @gotags: kong:"help='Whether to verify server TLS certificate',env='PLUMBER_RELAY_RABBIT_SKIP_VERIFY_TLS'" - TlsSkipVerify bool `protobuf:"varint,3,opt,name=tls_skip_verify,json=tlsSkipVerify,proto3" json:"tls_skip_verify,omitempty" kong:"help='Whether to verify server TLS certificate',env='PLUMBER_RELAY_RABBIT_SKIP_VERIFY_TLS'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + TlsSkipVerify bool `protobuf:"varint,3,opt,name=tls_skip_verify,json=tlsSkipVerify,proto3" json:"tls_skip_verify,omitempty" kong:"help='Whether to verify server TLS certificate',env='PLUMBER_RELAY_RABBIT_SKIP_VERIFY_TLS'"` } -func (m *RabbitConn) Reset() { *m = RabbitConn{} } -func (m *RabbitConn) String() string { return proto.CompactTextString(m) } -func (*RabbitConn) ProtoMessage() {} -func (*RabbitConn) Descriptor() ([]byte, []int) { - return fileDescriptor_01d1eee3dc8ebf97, []int{0} +func (x *RabbitConn) Reset() { + *x = RabbitConn{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_rabbit_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RabbitConn) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RabbitConn.Unmarshal(m, b) +func (x *RabbitConn) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RabbitConn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RabbitConn.Marshal(b, m, deterministic) -} -func (m *RabbitConn) XXX_Merge(src proto.Message) { - xxx_messageInfo_RabbitConn.Merge(m, src) -} -func (m *RabbitConn) XXX_Size() int { - return xxx_messageInfo_RabbitConn.Size(m) -} -func (m *RabbitConn) XXX_DiscardUnknown() { - xxx_messageInfo_RabbitConn.DiscardUnknown(m) + +func (*RabbitConn) ProtoMessage() {} + +func (x *RabbitConn) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_rabbit_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RabbitConn proto.InternalMessageInfo +// Deprecated: Use RabbitConn.ProtoReflect.Descriptor instead. +func (*RabbitConn) Descriptor() ([]byte, []int) { + return file_ps_args_rabbit_proto_rawDescGZIP(), []int{0} +} -func (m *RabbitConn) GetAddress() string { - if m != nil { - return m.Address +func (x *RabbitConn) GetAddress() string { + if x != nil { + return x.Address } return "" } -func (m *RabbitConn) GetUseTls() bool { - if m != nil { - return m.UseTls +func (x *RabbitConn) GetUseTls() bool { + if x != nil { + return x.UseTls } return false } -func (m *RabbitConn) GetTlsSkipVerify() bool { - if m != nil { - return m.TlsSkipVerify +func (x *RabbitConn) GetTlsSkipVerify() bool { + if x != nil { + return x.TlsSkipVerify } return false } type RabbitReadArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Name of the exchange',env='PLUMBER_RELAY_RABBIT_EXCHANGE',required" ExchangeName string `protobuf:"bytes,1,opt,name=exchange_name,json=exchangeName,proto3" json:"exchange_name,omitempty" kong:"help='Name of the exchange',env='PLUMBER_RELAY_RABBIT_EXCHANGE',required"` // @gotags: kong:"help='Name of the queue where messages will be routed to',env='PLUMBER_RELAY_RABBIT_QUEUE',required" @@ -100,115 +112,123 @@ type RabbitReadArgs struct { // @gotags: kong:"help='Key=Value pair for sending additional queue argument to RabbitMQ. Example: --queue-arg x-dead-letter-exchange=mydlexchange --queue-arg x-queue-mode=lazy',env='PLUMBER_RELAY_RABBIT_QUEUE_ARGS'" QueueArg map[string]string `protobuf:"bytes,10,rep,name=queue_arg,json=queueArg,proto3" json:"queue_arg,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" kong:"help='Key=Value pair for sending additional queue argument to RabbitMQ. Example: --queue-arg x-dead-letter-exchange=mydlexchange --queue-arg x-queue-mode=lazy',env='PLUMBER_RELAY_RABBIT_QUEUE_ARGS'"` // @gotags: kong:"help='Exclude messages with routing key matching regex',env='PLUMBER_RELAY_RABBIT_BINDING_KEY_EXCLUDE_REGEX'" - ExcludeBindingKeyRegex string `protobuf:"bytes,11,opt,name=exclude_binding_key_regex,json=excludeBindingKeyRegex,proto3" json:"exclude_binding_key_regex,omitempty" kong:"help='Exclude messages with routing key matching regex',env='PLUMBER_RELAY_RABBIT_BINDING_KEY_EXCLUDE_REGEX'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ExcludeBindingKeyRegex string `protobuf:"bytes,11,opt,name=exclude_binding_key_regex,json=excludeBindingKeyRegex,proto3" json:"exclude_binding_key_regex,omitempty" kong:"help='Exclude messages with routing key matching regex',env='PLUMBER_RELAY_RABBIT_BINDING_KEY_EXCLUDE_REGEX'"` } -func (m *RabbitReadArgs) Reset() { *m = RabbitReadArgs{} } -func (m *RabbitReadArgs) String() string { return proto.CompactTextString(m) } -func (*RabbitReadArgs) ProtoMessage() {} -func (*RabbitReadArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_01d1eee3dc8ebf97, []int{1} +func (x *RabbitReadArgs) Reset() { + *x = RabbitReadArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_rabbit_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RabbitReadArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RabbitReadArgs.Unmarshal(m, b) -} -func (m *RabbitReadArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RabbitReadArgs.Marshal(b, m, deterministic) -} -func (m *RabbitReadArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_RabbitReadArgs.Merge(m, src) +func (x *RabbitReadArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RabbitReadArgs) XXX_Size() int { - return xxx_messageInfo_RabbitReadArgs.Size(m) -} -func (m *RabbitReadArgs) XXX_DiscardUnknown() { - xxx_messageInfo_RabbitReadArgs.DiscardUnknown(m) + +func (*RabbitReadArgs) ProtoMessage() {} + +func (x *RabbitReadArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_rabbit_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RabbitReadArgs proto.InternalMessageInfo +// Deprecated: Use RabbitReadArgs.ProtoReflect.Descriptor instead. +func (*RabbitReadArgs) Descriptor() ([]byte, []int) { + return file_ps_args_rabbit_proto_rawDescGZIP(), []int{1} +} -func (m *RabbitReadArgs) GetExchangeName() string { - if m != nil { - return m.ExchangeName +func (x *RabbitReadArgs) GetExchangeName() string { + if x != nil { + return x.ExchangeName } return "" } -func (m *RabbitReadArgs) GetQueueName() string { - if m != nil { - return m.QueueName +func (x *RabbitReadArgs) GetQueueName() string { + if x != nil { + return x.QueueName } return "" } -func (m *RabbitReadArgs) GetBindingKey() string { - if m != nil { - return m.BindingKey +func (x *RabbitReadArgs) GetBindingKey() string { + if x != nil { + return x.BindingKey } return "" } -func (m *RabbitReadArgs) GetQueueExclusive() bool { - if m != nil { - return m.QueueExclusive +func (x *RabbitReadArgs) GetQueueExclusive() bool { + if x != nil { + return x.QueueExclusive } return false } -func (m *RabbitReadArgs) GetQueueDeclare() bool { - if m != nil { - return m.QueueDeclare +func (x *RabbitReadArgs) GetQueueDeclare() bool { + if x != nil { + return x.QueueDeclare } return false } -func (m *RabbitReadArgs) GetQueueDurable() bool { - if m != nil { - return m.QueueDurable +func (x *RabbitReadArgs) GetQueueDurable() bool { + if x != nil { + return x.QueueDurable } return false } -func (m *RabbitReadArgs) GetAutoAck() bool { - if m != nil { - return m.AutoAck +func (x *RabbitReadArgs) GetAutoAck() bool { + if x != nil { + return x.AutoAck } return false } -func (m *RabbitReadArgs) GetConsumerTag() string { - if m != nil { - return m.ConsumerTag +func (x *RabbitReadArgs) GetConsumerTag() string { + if x != nil { + return x.ConsumerTag } return "" } -func (m *RabbitReadArgs) GetQueueDelete() bool { - if m != nil { - return m.QueueDelete +func (x *RabbitReadArgs) GetQueueDelete() bool { + if x != nil { + return x.QueueDelete } return false } -func (m *RabbitReadArgs) GetQueueArg() map[string]string { - if m != nil { - return m.QueueArg +func (x *RabbitReadArgs) GetQueueArg() map[string]string { + if x != nil { + return x.QueueArg } return nil } -func (m *RabbitReadArgs) GetExcludeBindingKeyRegex() string { - if m != nil { - return m.ExcludeBindingKeyRegex +func (x *RabbitReadArgs) GetExcludeBindingKeyRegex() string { + if x != nil { + return x.ExcludeBindingKeyRegex } return "" } type RabbitWriteArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Exchange to write message(s) to',required" ExchangeName string `protobuf:"bytes,1,opt,name=exchange_name,json=exchangeName,proto3" json:"exchange_name,omitempty" kong:"help='Exchange to write message(s) to',required"` // @gotags: kong:"help='Routing key to write message(s) to',required" @@ -222,130 +242,246 @@ type RabbitWriteArgs struct { // @gotags: kong:"help='Whether to make a declared exchange durable',group=exchange" ExchangeDurable bool `protobuf:"varint,6,opt,name=exchange_durable,json=exchangeDurable,proto3" json:"exchange_durable,omitempty" kong:"help='Whether to make a declared exchange durable',group=exchange"` // @gotags: kong:"help='Whether to auto-delete the exchange (after writes)',group=exchange" - ExchangeAutoDelete bool `protobuf:"varint,7,opt,name=exchange_auto_delete,json=exchangeAutoDelete,proto3" json:"exchange_auto_delete,omitempty" kong:"help='Whether to auto-delete the exchange (after writes)',group=exchange"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ExchangeAutoDelete bool `protobuf:"varint,7,opt,name=exchange_auto_delete,json=exchangeAutoDelete,proto3" json:"exchange_auto_delete,omitempty" kong:"help='Whether to auto-delete the exchange (after writes)',group=exchange"` } -func (m *RabbitWriteArgs) Reset() { *m = RabbitWriteArgs{} } -func (m *RabbitWriteArgs) String() string { return proto.CompactTextString(m) } -func (*RabbitWriteArgs) ProtoMessage() {} -func (*RabbitWriteArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_01d1eee3dc8ebf97, []int{2} +func (x *RabbitWriteArgs) Reset() { + *x = RabbitWriteArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_rabbit_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RabbitWriteArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RabbitWriteArgs.Unmarshal(m, b) -} -func (m *RabbitWriteArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RabbitWriteArgs.Marshal(b, m, deterministic) -} -func (m *RabbitWriteArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_RabbitWriteArgs.Merge(m, src) -} -func (m *RabbitWriteArgs) XXX_Size() int { - return xxx_messageInfo_RabbitWriteArgs.Size(m) +func (x *RabbitWriteArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RabbitWriteArgs) XXX_DiscardUnknown() { - xxx_messageInfo_RabbitWriteArgs.DiscardUnknown(m) + +func (*RabbitWriteArgs) ProtoMessage() {} + +func (x *RabbitWriteArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_rabbit_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RabbitWriteArgs proto.InternalMessageInfo +// Deprecated: Use RabbitWriteArgs.ProtoReflect.Descriptor instead. +func (*RabbitWriteArgs) Descriptor() ([]byte, []int) { + return file_ps_args_rabbit_proto_rawDescGZIP(), []int{2} +} -func (m *RabbitWriteArgs) GetExchangeName() string { - if m != nil { - return m.ExchangeName +func (x *RabbitWriteArgs) GetExchangeName() string { + if x != nil { + return x.ExchangeName } return "" } -func (m *RabbitWriteArgs) GetRoutingKey() string { - if m != nil { - return m.RoutingKey +func (x *RabbitWriteArgs) GetRoutingKey() string { + if x != nil { + return x.RoutingKey } return "" } -func (m *RabbitWriteArgs) GetAppId() string { - if m != nil { - return m.AppId +func (x *RabbitWriteArgs) GetAppId() string { + if x != nil { + return x.AppId } return "" } -func (m *RabbitWriteArgs) GetExchangeType() string { - if m != nil { - return m.ExchangeType +func (x *RabbitWriteArgs) GetExchangeType() string { + if x != nil { + return x.ExchangeType } return "" } -func (m *RabbitWriteArgs) GetExchangeDeclare() bool { - if m != nil { - return m.ExchangeDeclare +func (x *RabbitWriteArgs) GetExchangeDeclare() bool { + if x != nil { + return x.ExchangeDeclare } return false } -func (m *RabbitWriteArgs) GetExchangeDurable() bool { - if m != nil { - return m.ExchangeDurable +func (x *RabbitWriteArgs) GetExchangeDurable() bool { + if x != nil { + return x.ExchangeDurable } return false } -func (m *RabbitWriteArgs) GetExchangeAutoDelete() bool { - if m != nil { - return m.ExchangeAutoDelete +func (x *RabbitWriteArgs) GetExchangeAutoDelete() bool { + if x != nil { + return x.ExchangeAutoDelete } return false } -func init() { - proto.RegisterType((*RabbitConn)(nil), "protos.args.RabbitConn") - proto.RegisterType((*RabbitReadArgs)(nil), "protos.args.RabbitReadArgs") - proto.RegisterMapType((map[string]string)(nil), "protos.args.RabbitReadArgs.QueueArgEntry") - proto.RegisterType((*RabbitWriteArgs)(nil), "protos.args.RabbitWriteArgs") -} - -func init() { proto.RegisterFile("ps_args_rabbit.proto", fileDescriptor_01d1eee3dc8ebf97) } - -var fileDescriptor_01d1eee3dc8ebf97 = []byte{ - // 554 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0x86, 0x95, 0xb4, 0xcd, 0xc7, 0xb8, 0x6d, 0xaa, 0x55, 0x81, 0x2d, 0x12, 0x6a, 0x29, 0x12, - 0xb4, 0x07, 0x6c, 0x04, 0x17, 0x4a, 0x4f, 0x29, 0x14, 0x09, 0x21, 0x21, 0x61, 0x2a, 0x90, 0xb8, - 0xac, 0xd6, 0xf6, 0xe0, 0x58, 0xf1, 0xc7, 0x76, 0x3f, 0xaa, 0xe6, 0x27, 0xf0, 0x1b, 0xf8, 0xb3, - 0x68, 0x77, 0xed, 0x10, 0xdf, 0x38, 0x25, 0xf3, 0xce, 0xe3, 0xd9, 0xd1, 0xbc, 0x2f, 0x1c, 0x0a, - 0xc5, 0xb8, 0xcc, 0x15, 0x93, 0x3c, 0x49, 0x0a, 0x1d, 0x0a, 0xd9, 0xe8, 0x86, 0x04, 0xee, 0x47, - 0x85, 0xb6, 0x73, 0x9a, 0x03, 0xc4, 0xae, 0xf9, 0xbe, 0xa9, 0x6b, 0x42, 0x61, 0xcc, 0xb3, 0x4c, - 0xa2, 0x52, 0x74, 0x70, 0x32, 0x38, 0x9b, 0xc6, 0x5d, 0x49, 0x1e, 0xc1, 0xd8, 0x28, 0x64, 0xba, - 0x54, 0x74, 0x78, 0x32, 0x38, 0x9b, 0xc4, 0x23, 0xa3, 0xf0, 0xa6, 0x54, 0xe4, 0x39, 0xcc, 0x74, - 0xa9, 0x98, 0x5a, 0x16, 0x82, 0xdd, 0xa1, 0x2c, 0x7e, 0xad, 0xe8, 0x96, 0x03, 0xf6, 0x74, 0xa9, - 0xbe, 0x2d, 0x0b, 0xf1, 0xdd, 0x89, 0xa7, 0xbf, 0xb7, 0x61, 0xdf, 0xbf, 0x14, 0x23, 0xcf, 0xe6, - 0x32, 0x57, 0xe4, 0x19, 0xec, 0xe1, 0x7d, 0xba, 0xe0, 0x75, 0x8e, 0xac, 0xe6, 0x15, 0xb6, 0x6f, - 0xee, 0x76, 0xe2, 0x17, 0x5e, 0x21, 0x79, 0x02, 0x70, 0x6b, 0xd0, 0xb4, 0xc4, 0xd0, 0x11, 0x53, - 0xa7, 0xb8, 0xf6, 0x31, 0x04, 0x49, 0x51, 0x67, 0x45, 0x9d, 0xb3, 0x25, 0xfa, 0xa7, 0xa7, 0x31, - 0xb4, 0xd2, 0x67, 0x5c, 0x91, 0x17, 0x30, 0xf3, 0xdf, 0xe3, 0x7d, 0x5a, 0x1a, 0x55, 0xdc, 0x21, - 0xdd, 0x76, 0xfb, 0xed, 0x3b, 0xf9, 0xba, 0x53, 0xed, 0x36, 0x1e, 0xcc, 0x30, 0x2d, 0xb9, 0x44, - 0xba, 0xe3, 0xb0, 0x5d, 0x27, 0x7e, 0xf0, 0xda, 0x06, 0x64, 0x24, 0x4f, 0x4a, 0xa4, 0xa3, 0x4d, - 0xc8, 0x6b, 0xe4, 0x08, 0x26, 0xdc, 0xe8, 0x86, 0xf1, 0x74, 0x49, 0xc7, 0xae, 0x3f, 0xb6, 0xf5, - 0x3c, 0x5d, 0x92, 0xa7, 0xb0, 0x9b, 0x36, 0xb5, 0x32, 0x15, 0x4a, 0xa6, 0x79, 0x4e, 0x27, 0x6e, - 0xdf, 0xa0, 0xd3, 0x6e, 0x78, 0x6e, 0x91, 0x6e, 0x8f, 0x12, 0x35, 0xd2, 0xa9, 0x9b, 0x10, 0xb4, - 0x6b, 0x58, 0x89, 0x7c, 0x04, 0x7f, 0x01, 0x6b, 0x2e, 0x85, 0x93, 0xad, 0xb3, 0xe0, 0xf5, 0x79, - 0xb8, 0xe1, 0x6a, 0xd8, 0x3f, 0x74, 0xf8, 0xd5, 0xc2, 0x73, 0x99, 0x5f, 0xd7, 0x5a, 0xae, 0xe2, - 0xc9, 0x6d, 0x5b, 0x92, 0x0b, 0x38, 0x72, 0x57, 0xc9, 0x90, 0x6d, 0x1c, 0x91, 0x49, 0xcc, 0xf1, - 0x9e, 0x06, 0x6e, 0xb5, 0x87, 0x2d, 0x70, 0xb5, 0xbe, 0x68, 0x6c, 0xbb, 0x8f, 0x2f, 0x61, 0xaf, - 0x37, 0x95, 0x1c, 0xc0, 0x96, 0x35, 0xc0, 0x5b, 0x68, 0xff, 0x92, 0x43, 0xd8, 0xb9, 0xe3, 0xa5, - 0xe9, 0x4c, 0xf3, 0xc5, 0xbb, 0xe1, 0xdb, 0xc1, 0xe9, 0x9f, 0x21, 0xcc, 0xfc, 0x8a, 0x3f, 0x64, - 0xa1, 0xf1, 0xff, 0xc3, 0x70, 0x0c, 0x81, 0x6c, 0x8c, 0xee, 0xdc, 0xf6, 0x83, 0xa1, 0x95, 0xac, - 0xdb, 0x0f, 0x60, 0xc4, 0x85, 0x60, 0x45, 0xd6, 0x26, 0x61, 0x87, 0x0b, 0xf1, 0x29, 0xeb, 0x0d, - 0xd7, 0x2b, 0xe1, 0x23, 0xb0, 0x31, 0xfc, 0x66, 0x25, 0x90, 0x9c, 0xc3, 0xc1, 0x1a, 0xea, 0x67, - 0x60, 0xd6, 0xe9, 0x5d, 0x0c, 0x7a, 0x68, 0x2f, 0x09, 0xff, 0xd0, 0x36, 0x0c, 0xaf, 0xe0, 0x70, - 0x8d, 0xba, 0x54, 0xb4, 0xb6, 0xfa, 0x60, 0x90, 0xae, 0x37, 0x37, 0xba, 0xf1, 0xee, 0x5e, 0x5d, - 0xfe, 0xbc, 0xc8, 0x0b, 0xbd, 0x30, 0x49, 0x98, 0x36, 0x55, 0x94, 0x70, 0x9d, 0x2e, 0xd2, 0x46, - 0x8a, 0x48, 0x94, 0xa6, 0x4a, 0x50, 0xbe, 0x54, 0xe9, 0x02, 0x2b, 0xae, 0xa2, 0xc4, 0x14, 0x65, - 0x16, 0xe5, 0x4d, 0xe4, 0x9d, 0x8f, 0xac, 0xf3, 0xc9, 0xc8, 0x15, 0x6f, 0xfe, 0x06, 0x00, 0x00, - 0xff, 0xff, 0x97, 0xb9, 0x38, 0x2a, 0xfb, 0x03, 0x00, 0x00, +var File_ps_args_rabbit_proto protoreflect.FileDescriptor + +var file_ps_args_rabbit_proto_rawDesc = []byte{ + 0x0a, 0x14, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, + 0x72, 0x67, 0x73, 0x22, 0x67, 0x0a, 0x0a, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x43, 0x6f, 0x6e, + 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x75, + 0x73, 0x65, 0x5f, 0x74, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x75, 0x73, + 0x65, 0x54, 0x6c, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x6c, 0x73, 0x5f, 0x73, 0x6b, 0x69, 0x70, + 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x74, + 0x6c, 0x73, 0x53, 0x6b, 0x69, 0x70, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x22, 0x89, 0x04, 0x0a, + 0x0e, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x12, + 0x23, 0x0a, 0x0d, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x71, 0x75, 0x65, 0x75, 0x65, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x71, 0x75, 0x65, 0x75, 0x65, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x6b, + 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x69, 0x6e, 0x64, 0x69, 0x6e, + 0x67, 0x4b, 0x65, 0x79, 0x12, 0x27, 0x0a, 0x0f, 0x71, 0x75, 0x65, 0x75, 0x65, 0x5f, 0x65, 0x78, + 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x71, + 0x75, 0x65, 0x75, 0x65, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x12, 0x23, 0x0a, + 0x0d, 0x71, 0x75, 0x65, 0x75, 0x65, 0x5f, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x71, 0x75, 0x65, 0x75, 0x65, 0x44, 0x65, 0x63, 0x6c, 0x61, + 0x72, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x71, 0x75, 0x65, 0x75, 0x65, 0x5f, 0x64, 0x75, 0x72, 0x61, + 0x62, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x71, 0x75, 0x65, 0x75, 0x65, + 0x44, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x75, 0x74, 0x6f, 0x5f, + 0x61, 0x63, 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x61, 0x75, 0x74, 0x6f, 0x41, + 0x63, 0x6b, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x5f, 0x74, + 0x61, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, + 0x65, 0x72, 0x54, 0x61, 0x67, 0x12, 0x21, 0x0a, 0x0c, 0x71, 0x75, 0x65, 0x75, 0x65, 0x5f, 0x64, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x71, 0x75, 0x65, + 0x75, 0x65, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x46, 0x0a, 0x09, 0x71, 0x75, 0x65, 0x75, + 0x65, 0x5f, 0x61, 0x72, 0x67, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, + 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x2e, 0x51, 0x75, 0x65, 0x75, 0x65, 0x41, 0x72, + 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x71, 0x75, 0x65, 0x75, 0x65, 0x41, 0x72, 0x67, + 0x12, 0x39, 0x0a, 0x19, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x62, 0x69, 0x6e, 0x64, + 0x69, 0x6e, 0x67, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x72, 0x65, 0x67, 0x65, 0x78, 0x18, 0x0b, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x16, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x42, 0x69, 0x6e, 0x64, + 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x67, 0x65, 0x78, 0x1a, 0x3b, 0x0a, 0x0d, 0x51, + 0x75, 0x65, 0x75, 0x65, 0x41, 0x72, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x9b, 0x02, 0x0a, 0x0f, 0x52, 0x61, 0x62, + 0x62, 0x69, 0x74, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x12, 0x23, 0x0a, 0x0d, + 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x6b, 0x65, 0x79, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x4b, + 0x65, 0x79, 0x12, 0x15, 0x0a, 0x06, 0x61, 0x70, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x78, 0x63, + 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0c, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x29, + 0x0a, 0x10, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x64, 0x65, 0x63, 0x6c, 0x61, + 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, + 0x67, 0x65, 0x44, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x65, 0x78, 0x63, + 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x0f, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x44, 0x75, 0x72, + 0x61, 0x62, 0x6c, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, + 0x5f, 0x61, 0x75, 0x74, 0x6f, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x12, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x41, 0x75, 0x74, 0x6f, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, + 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, + 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x61, + 0x72, 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ps_args_rabbit_proto_rawDescOnce sync.Once + file_ps_args_rabbit_proto_rawDescData = file_ps_args_rabbit_proto_rawDesc +) + +func file_ps_args_rabbit_proto_rawDescGZIP() []byte { + file_ps_args_rabbit_proto_rawDescOnce.Do(func() { + file_ps_args_rabbit_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_args_rabbit_proto_rawDescData) + }) + return file_ps_args_rabbit_proto_rawDescData +} + +var file_ps_args_rabbit_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_ps_args_rabbit_proto_goTypes = []interface{}{ + (*RabbitConn)(nil), // 0: protos.args.RabbitConn + (*RabbitReadArgs)(nil), // 1: protos.args.RabbitReadArgs + (*RabbitWriteArgs)(nil), // 2: protos.args.RabbitWriteArgs + nil, // 3: protos.args.RabbitReadArgs.QueueArgEntry +} +var file_ps_args_rabbit_proto_depIdxs = []int32{ + 3, // 0: protos.args.RabbitReadArgs.queue_arg:type_name -> protos.args.RabbitReadArgs.QueueArgEntry + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_ps_args_rabbit_proto_init() } +func file_ps_args_rabbit_proto_init() { + if File_ps_args_rabbit_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_args_rabbit_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RabbitConn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_rabbit_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RabbitReadArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_rabbit_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RabbitWriteArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_args_rabbit_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_args_rabbit_proto_goTypes, + DependencyIndexes: file_ps_args_rabbit_proto_depIdxs, + MessageInfos: file_ps_args_rabbit_proto_msgTypes, + }.Build() + File_ps_args_rabbit_proto = out.File + file_ps_args_rabbit_proto_rawDesc = nil + file_ps_args_rabbit_proto_goTypes = nil + file_ps_args_rabbit_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_rabbit_streams.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_rabbit_streams.pb.go index c0cadbc2f..c5e1ebe8b 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_rabbit_streams.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_rabbit_streams.pb.go @@ -1,26 +1,30 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_args_rabbit_streams.proto package args import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type RabbitStreamsConn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='DSN used to connect to RabbitMQ',default='rabbitmq-stream://guest:guest@localhost:5552',required" Dsn string `protobuf:"bytes,1,opt,name=dsn,proto3" json:"dsn,omitempty" kong:"help='DSN used to connect to RabbitMQ',default='rabbitmq-stream://guest:guest@localhost:5552',required"` // @gotags: kong:"help='Enable TLS usage (regardless of DSN)'" @@ -32,80 +36,88 @@ type RabbitStreamsConn struct { // @gotags: kong:"help='Password used to authenticate to server with',default=guest" Password string `protobuf:"bytes,5,opt,name=password,proto3" json:"password,omitempty" kong:"help='Password used to authenticate to server with',default=guest"` // @gotags: kong:"help='Consumer or producer name to identify as to RabbitMQ',default=plumber,required" - ClientName string `protobuf:"bytes,6,opt,name=client_name,json=clientName,proto3" json:"client_name,omitempty" kong:"help='Consumer or producer name to identify as to RabbitMQ',default=plumber,required"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ClientName string `protobuf:"bytes,6,opt,name=client_name,json=clientName,proto3" json:"client_name,omitempty" kong:"help='Consumer or producer name to identify as to RabbitMQ',default=plumber,required"` } -func (m *RabbitStreamsConn) Reset() { *m = RabbitStreamsConn{} } -func (m *RabbitStreamsConn) String() string { return proto.CompactTextString(m) } -func (*RabbitStreamsConn) ProtoMessage() {} -func (*RabbitStreamsConn) Descriptor() ([]byte, []int) { - return fileDescriptor_cc3c29996a2cfa7f, []int{0} +func (x *RabbitStreamsConn) Reset() { + *x = RabbitStreamsConn{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_rabbit_streams_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RabbitStreamsConn) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RabbitStreamsConn.Unmarshal(m, b) -} -func (m *RabbitStreamsConn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RabbitStreamsConn.Marshal(b, m, deterministic) -} -func (m *RabbitStreamsConn) XXX_Merge(src proto.Message) { - xxx_messageInfo_RabbitStreamsConn.Merge(m, src) +func (x *RabbitStreamsConn) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RabbitStreamsConn) XXX_Size() int { - return xxx_messageInfo_RabbitStreamsConn.Size(m) -} -func (m *RabbitStreamsConn) XXX_DiscardUnknown() { - xxx_messageInfo_RabbitStreamsConn.DiscardUnknown(m) + +func (*RabbitStreamsConn) ProtoMessage() {} + +func (x *RabbitStreamsConn) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_rabbit_streams_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RabbitStreamsConn proto.InternalMessageInfo +// Deprecated: Use RabbitStreamsConn.ProtoReflect.Descriptor instead. +func (*RabbitStreamsConn) Descriptor() ([]byte, []int) { + return file_ps_args_rabbit_streams_proto_rawDescGZIP(), []int{0} +} -func (m *RabbitStreamsConn) GetDsn() string { - if m != nil { - return m.Dsn +func (x *RabbitStreamsConn) GetDsn() string { + if x != nil { + return x.Dsn } return "" } -func (m *RabbitStreamsConn) GetUseTls() bool { - if m != nil { - return m.UseTls +func (x *RabbitStreamsConn) GetUseTls() bool { + if x != nil { + return x.UseTls } return false } -func (m *RabbitStreamsConn) GetTlsSkipVerify() bool { - if m != nil { - return m.TlsSkipVerify +func (x *RabbitStreamsConn) GetTlsSkipVerify() bool { + if x != nil { + return x.TlsSkipVerify } return false } -func (m *RabbitStreamsConn) GetUsername() string { - if m != nil { - return m.Username +func (x *RabbitStreamsConn) GetUsername() string { + if x != nil { + return x.Username } return "" } -func (m *RabbitStreamsConn) GetPassword() string { - if m != nil { - return m.Password +func (x *RabbitStreamsConn) GetPassword() string { + if x != nil { + return x.Password } return "" } -func (m *RabbitStreamsConn) GetClientName() string { - if m != nil { - return m.ClientName +func (x *RabbitStreamsConn) GetClientName() string { + if x != nil { + return x.ClientName } return "" } type RabbitStreamsOffsetOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"group=offset,xor=offset" SpecificOffset int64 `protobuf:"varint,1,opt,name=specific_offset,json=specificOffset,proto3" json:"specific_offset,omitempty" kong:"group=offset,xor=offset"` // @gotags: kong:"group=offset,xor=offset" @@ -115,73 +127,81 @@ type RabbitStreamsOffsetOptions struct { // @gotags: kong:"group=offset,xor=offset" FirstOffset bool `protobuf:"varint,4,opt,name=first_offset,json=firstOffset,proto3" json:"first_offset,omitempty" kong:"group=offset,xor=offset"` // @gotags: kong:"group=offset,xor=offset" - NextOffset bool `protobuf:"varint,5,opt,name=next_offset,json=nextOffset,proto3" json:"next_offset,omitempty" kong:"group=offset,xor=offset"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + NextOffset bool `protobuf:"varint,5,opt,name=next_offset,json=nextOffset,proto3" json:"next_offset,omitempty" kong:"group=offset,xor=offset"` } -func (m *RabbitStreamsOffsetOptions) Reset() { *m = RabbitStreamsOffsetOptions{} } -func (m *RabbitStreamsOffsetOptions) String() string { return proto.CompactTextString(m) } -func (*RabbitStreamsOffsetOptions) ProtoMessage() {} -func (*RabbitStreamsOffsetOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_cc3c29996a2cfa7f, []int{1} +func (x *RabbitStreamsOffsetOptions) Reset() { + *x = RabbitStreamsOffsetOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_rabbit_streams_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RabbitStreamsOffsetOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RabbitStreamsOffsetOptions.Unmarshal(m, b) -} -func (m *RabbitStreamsOffsetOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RabbitStreamsOffsetOptions.Marshal(b, m, deterministic) -} -func (m *RabbitStreamsOffsetOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_RabbitStreamsOffsetOptions.Merge(m, src) -} -func (m *RabbitStreamsOffsetOptions) XXX_Size() int { - return xxx_messageInfo_RabbitStreamsOffsetOptions.Size(m) +func (x *RabbitStreamsOffsetOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RabbitStreamsOffsetOptions) XXX_DiscardUnknown() { - xxx_messageInfo_RabbitStreamsOffsetOptions.DiscardUnknown(m) + +func (*RabbitStreamsOffsetOptions) ProtoMessage() {} + +func (x *RabbitStreamsOffsetOptions) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_rabbit_streams_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RabbitStreamsOffsetOptions proto.InternalMessageInfo +// Deprecated: Use RabbitStreamsOffsetOptions.ProtoReflect.Descriptor instead. +func (*RabbitStreamsOffsetOptions) Descriptor() ([]byte, []int) { + return file_ps_args_rabbit_streams_proto_rawDescGZIP(), []int{1} +} -func (m *RabbitStreamsOffsetOptions) GetSpecificOffset() int64 { - if m != nil { - return m.SpecificOffset +func (x *RabbitStreamsOffsetOptions) GetSpecificOffset() int64 { + if x != nil { + return x.SpecificOffset } return 0 } -func (m *RabbitStreamsOffsetOptions) GetLastOffset() bool { - if m != nil { - return m.LastOffset +func (x *RabbitStreamsOffsetOptions) GetLastOffset() bool { + if x != nil { + return x.LastOffset } return false } -func (m *RabbitStreamsOffsetOptions) GetLastConsumed() bool { - if m != nil { - return m.LastConsumed +func (x *RabbitStreamsOffsetOptions) GetLastConsumed() bool { + if x != nil { + return x.LastConsumed } return false } -func (m *RabbitStreamsOffsetOptions) GetFirstOffset() bool { - if m != nil { - return m.FirstOffset +func (x *RabbitStreamsOffsetOptions) GetFirstOffset() bool { + if x != nil { + return x.FirstOffset } return false } -func (m *RabbitStreamsOffsetOptions) GetNextOffset() bool { - if m != nil { - return m.NextOffset +func (x *RabbitStreamsOffsetOptions) GetNextOffset() bool { + if x != nil { + return x.NextOffset } return false } type RabbitStreamsReadArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Stream name',required" Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty" kong:"help='Stream name',required"` // @gotags: kong:"help='Declare the stream if it does not exist'" @@ -190,160 +210,294 @@ type RabbitStreamsReadArgs struct { DeclareStreamSize string `protobuf:"bytes,3,opt,name=declare_stream_size,json=declareStreamSize,proto3" json:"declare_stream_size,omitempty" kong:"help='Stream capacity to declare (required if declare_stream is true; ex: 1024k; 10mb; 3gb)'"` // TODO: Will this break? Might just need to be a string. // @gotags: kong:"help='Offset to start reading at',embed" - OffsetOptions *RabbitStreamsOffsetOptions `protobuf:"bytes,4,opt,name=offset_options,json=offsetOptions,proto3" json:"offset_options,omitempty" kong:"help='Offset to start reading at',embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OffsetOptions *RabbitStreamsOffsetOptions `protobuf:"bytes,4,opt,name=offset_options,json=offsetOptions,proto3" json:"offset_options,omitempty" kong:"help='Offset to start reading at',embed"` } -func (m *RabbitStreamsReadArgs) Reset() { *m = RabbitStreamsReadArgs{} } -func (m *RabbitStreamsReadArgs) String() string { return proto.CompactTextString(m) } -func (*RabbitStreamsReadArgs) ProtoMessage() {} -func (*RabbitStreamsReadArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_cc3c29996a2cfa7f, []int{2} +func (x *RabbitStreamsReadArgs) Reset() { + *x = RabbitStreamsReadArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_rabbit_streams_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RabbitStreamsReadArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RabbitStreamsReadArgs.Unmarshal(m, b) -} -func (m *RabbitStreamsReadArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RabbitStreamsReadArgs.Marshal(b, m, deterministic) -} -func (m *RabbitStreamsReadArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_RabbitStreamsReadArgs.Merge(m, src) +func (x *RabbitStreamsReadArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RabbitStreamsReadArgs) XXX_Size() int { - return xxx_messageInfo_RabbitStreamsReadArgs.Size(m) -} -func (m *RabbitStreamsReadArgs) XXX_DiscardUnknown() { - xxx_messageInfo_RabbitStreamsReadArgs.DiscardUnknown(m) + +func (*RabbitStreamsReadArgs) ProtoMessage() {} + +func (x *RabbitStreamsReadArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_rabbit_streams_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RabbitStreamsReadArgs proto.InternalMessageInfo +// Deprecated: Use RabbitStreamsReadArgs.ProtoReflect.Descriptor instead. +func (*RabbitStreamsReadArgs) Descriptor() ([]byte, []int) { + return file_ps_args_rabbit_streams_proto_rawDescGZIP(), []int{2} +} -func (m *RabbitStreamsReadArgs) GetStream() string { - if m != nil { - return m.Stream +func (x *RabbitStreamsReadArgs) GetStream() string { + if x != nil { + return x.Stream } return "" } -func (m *RabbitStreamsReadArgs) GetDeclareStream() bool { - if m != nil { - return m.DeclareStream +func (x *RabbitStreamsReadArgs) GetDeclareStream() bool { + if x != nil { + return x.DeclareStream } return false } -func (m *RabbitStreamsReadArgs) GetDeclareStreamSize() string { - if m != nil { - return m.DeclareStreamSize +func (x *RabbitStreamsReadArgs) GetDeclareStreamSize() string { + if x != nil { + return x.DeclareStreamSize } return "" } -func (m *RabbitStreamsReadArgs) GetOffsetOptions() *RabbitStreamsOffsetOptions { - if m != nil { - return m.OffsetOptions +func (x *RabbitStreamsReadArgs) GetOffsetOptions() *RabbitStreamsOffsetOptions { + if x != nil { + return x.OffsetOptions } return nil } type RabbitStreamsWriteArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Stream name',required" Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty" kong:"help='Stream name',required"` // @gotags: kong:"help='Declare the stream if it does not exist'" DeclareStream bool `protobuf:"varint,2,opt,name=declare_stream,json=declareStream,proto3" json:"declare_stream,omitempty" kong:"help='Declare the stream if it does not exist'"` // @gotags: kong:"help='Stream capacity to declare (required if declare_stream is true; ex: 1024k, 10mb, 3gb',default=10mb" - DeclareStreamSize string `protobuf:"bytes,3,opt,name=declare_stream_size,json=declareStreamSize,proto3" json:"declare_stream_size,omitempty" kong:"help='Stream capacity to declare (required if declare_stream is true; ex: 1024k, 10mb, 3gb',default=10mb"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + DeclareStreamSize string `protobuf:"bytes,3,opt,name=declare_stream_size,json=declareStreamSize,proto3" json:"declare_stream_size,omitempty" kong:"help='Stream capacity to declare (required if declare_stream is true; ex: 1024k, 10mb, 3gb',default=10mb"` } -func (m *RabbitStreamsWriteArgs) Reset() { *m = RabbitStreamsWriteArgs{} } -func (m *RabbitStreamsWriteArgs) String() string { return proto.CompactTextString(m) } -func (*RabbitStreamsWriteArgs) ProtoMessage() {} -func (*RabbitStreamsWriteArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_cc3c29996a2cfa7f, []int{3} +func (x *RabbitStreamsWriteArgs) Reset() { + *x = RabbitStreamsWriteArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_rabbit_streams_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RabbitStreamsWriteArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RabbitStreamsWriteArgs.Unmarshal(m, b) +func (x *RabbitStreamsWriteArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RabbitStreamsWriteArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RabbitStreamsWriteArgs.Marshal(b, m, deterministic) -} -func (m *RabbitStreamsWriteArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_RabbitStreamsWriteArgs.Merge(m, src) -} -func (m *RabbitStreamsWriteArgs) XXX_Size() int { - return xxx_messageInfo_RabbitStreamsWriteArgs.Size(m) -} -func (m *RabbitStreamsWriteArgs) XXX_DiscardUnknown() { - xxx_messageInfo_RabbitStreamsWriteArgs.DiscardUnknown(m) + +func (*RabbitStreamsWriteArgs) ProtoMessage() {} + +func (x *RabbitStreamsWriteArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_rabbit_streams_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RabbitStreamsWriteArgs proto.InternalMessageInfo +// Deprecated: Use RabbitStreamsWriteArgs.ProtoReflect.Descriptor instead. +func (*RabbitStreamsWriteArgs) Descriptor() ([]byte, []int) { + return file_ps_args_rabbit_streams_proto_rawDescGZIP(), []int{3} +} -func (m *RabbitStreamsWriteArgs) GetStream() string { - if m != nil { - return m.Stream +func (x *RabbitStreamsWriteArgs) GetStream() string { + if x != nil { + return x.Stream } return "" } -func (m *RabbitStreamsWriteArgs) GetDeclareStream() bool { - if m != nil { - return m.DeclareStream +func (x *RabbitStreamsWriteArgs) GetDeclareStream() bool { + if x != nil { + return x.DeclareStream } return false } -func (m *RabbitStreamsWriteArgs) GetDeclareStreamSize() string { - if m != nil { - return m.DeclareStreamSize +func (x *RabbitStreamsWriteArgs) GetDeclareStreamSize() string { + if x != nil { + return x.DeclareStreamSize } return "" } -func init() { - proto.RegisterType((*RabbitStreamsConn)(nil), "protos.args.RabbitStreamsConn") - proto.RegisterType((*RabbitStreamsOffsetOptions)(nil), "protos.args.RabbitStreamsOffsetOptions") - proto.RegisterType((*RabbitStreamsReadArgs)(nil), "protos.args.RabbitStreamsReadArgs") - proto.RegisterType((*RabbitStreamsWriteArgs)(nil), "protos.args.RabbitStreamsWriteArgs") -} - -func init() { proto.RegisterFile("ps_args_rabbit_streams.proto", fileDescriptor_cc3c29996a2cfa7f) } - -var fileDescriptor_cc3c29996a2cfa7f = []byte{ - // 447 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x92, 0xcf, 0x6e, 0xd4, 0x30, - 0x10, 0xc6, 0x15, 0xda, 0x2e, 0xed, 0x6c, 0x77, 0x4b, 0x8d, 0x28, 0x51, 0x85, 0x44, 0x59, 0x04, - 0xed, 0x85, 0x44, 0x82, 0x13, 0xe2, 0x04, 0xbd, 0xb7, 0x52, 0x16, 0x81, 0xc4, 0xc5, 0x72, 0x9c, - 0xc9, 0xae, 0x55, 0x27, 0xb6, 0x3c, 0x0e, 0x7f, 0xfa, 0x02, 0x3c, 0x16, 0x8f, 0xc0, 0x8d, 0xe7, - 0x41, 0xb1, 0xb3, 0x6d, 0x73, 0xe0, 0xcc, 0x29, 0xf9, 0xbe, 0xf9, 0x65, 0xc6, 0x9f, 0x27, 0xf0, - 0xc4, 0x12, 0x17, 0x6e, 0x45, 0xdc, 0x89, 0xb2, 0x54, 0x9e, 0x93, 0x77, 0x28, 0x1a, 0xca, 0xac, - 0x33, 0xde, 0xb0, 0x69, 0x78, 0x50, 0xd6, 0x13, 0x8b, 0x5f, 0x09, 0x1c, 0x16, 0x81, 0x5a, 0x46, - 0xe8, 0xdc, 0xb4, 0x2d, 0x7b, 0x00, 0x5b, 0x15, 0xb5, 0x69, 0x72, 0x92, 0x9c, 0xed, 0x15, 0xfd, - 0x2b, 0x7b, 0x0c, 0xf7, 0x3b, 0x42, 0xee, 0x35, 0xa5, 0xf7, 0x4e, 0x92, 0xb3, 0xdd, 0x62, 0xd2, - 0x11, 0x7e, 0xd4, 0xc4, 0x5e, 0xc2, 0x81, 0xd7, 0xc4, 0xe9, 0x4a, 0x59, 0xfe, 0x15, 0x9d, 0xaa, - 0x7f, 0xa4, 0x5b, 0x01, 0x98, 0x79, 0x4d, 0xcb, 0x2b, 0x65, 0x3f, 0x05, 0x93, 0x1d, 0xc3, 0x6e, - 0x47, 0xe8, 0x5a, 0xd1, 0x60, 0xba, 0x1d, 0xfa, 0xde, 0xe8, 0xbe, 0x66, 0x05, 0xd1, 0x37, 0xe3, - 0xaa, 0x74, 0x27, 0xd6, 0x36, 0x9a, 0x3d, 0x85, 0xa9, 0xd4, 0x0a, 0x5b, 0xcf, 0xc3, 0xa7, 0x93, - 0x50, 0x86, 0x68, 0x5d, 0x88, 0x06, 0x17, 0xbf, 0x13, 0x38, 0x1e, 0x25, 0xb8, 0xac, 0x6b, 0x42, - 0x7f, 0x69, 0xbd, 0x32, 0x2d, 0xb1, 0x53, 0x38, 0x20, 0x8b, 0x52, 0xd5, 0x4a, 0x72, 0x13, 0x2a, - 0x21, 0xd6, 0x56, 0x31, 0xdf, 0xd8, 0x91, 0xef, 0x07, 0x69, 0x41, 0x7e, 0x03, 0xc5, 0x94, 0xd0, - 0x5b, 0x03, 0xf0, 0x1c, 0x66, 0x01, 0x90, 0xa6, 0xa5, 0xae, 0xc1, 0x6a, 0xc8, 0xb9, 0xdf, 0x9b, - 0xe7, 0x83, 0xc7, 0x9e, 0xc1, 0x7e, 0xad, 0xdc, 0x6d, 0x9b, 0xed, 0xc0, 0x4c, 0x83, 0x77, 0x3b, - 0xa8, 0xc5, 0xef, 0x37, 0xc4, 0x4e, 0x1c, 0xd4, 0x5b, 0x11, 0x58, 0xfc, 0x49, 0xe0, 0xd1, 0x28, - 0x51, 0x81, 0xa2, 0x7a, 0xef, 0x56, 0xc4, 0x8e, 0x60, 0x12, 0x77, 0x39, 0xac, 0x66, 0x50, 0xec, - 0x05, 0xcc, 0x2b, 0x94, 0x5a, 0x38, 0x1c, 0x76, 0x3d, 0x1c, 0x7f, 0x36, 0xb8, 0xb1, 0x0f, 0xcb, - 0xe0, 0xe1, 0x18, 0xe3, 0xa4, 0xae, 0x31, 0xe4, 0xd8, 0x2b, 0x0e, 0x47, 0xec, 0x52, 0x5d, 0x23, - 0xbb, 0x80, 0x79, 0x3c, 0x24, 0x37, 0xf1, 0x36, 0x43, 0x9c, 0xe9, 0xeb, 0xd3, 0xec, 0xce, 0x2f, - 0x94, 0xfd, 0xfb, 0xf2, 0x8b, 0x99, 0xb9, 0x2b, 0x17, 0x3f, 0x13, 0x38, 0x1a, 0xd1, 0x9f, 0x9d, - 0xf2, 0xf8, 0x1f, 0x92, 0x7d, 0x78, 0xf7, 0xe5, 0xed, 0x4a, 0xf9, 0x75, 0x57, 0x66, 0xd2, 0x34, - 0x79, 0x29, 0xbc, 0x5c, 0x4b, 0xe3, 0x6c, 0x6e, 0x75, 0xd7, 0x94, 0xe8, 0x5e, 0x91, 0x5c, 0x63, - 0x23, 0x28, 0x2f, 0x3b, 0xa5, 0xab, 0x7c, 0x65, 0xf2, 0x18, 0x38, 0xef, 0x03, 0x97, 0x93, 0x20, - 0xde, 0xfc, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xd9, 0x79, 0x86, 0xc9, 0x67, 0x03, 0x00, 0x00, +var File_ps_args_rabbit_streams_proto protoreflect.FileDescriptor + +var file_ps_args_rabbit_streams_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, + 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x22, 0xbf, 0x01, 0x0a, 0x11, + 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x43, 0x6f, 0x6e, + 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x73, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x64, 0x73, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x5f, 0x74, 0x6c, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x75, 0x73, 0x65, 0x54, 0x6c, 0x73, 0x12, 0x26, 0x0a, 0x0f, + 0x74, 0x6c, 0x73, 0x5f, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x74, 0x6c, 0x73, 0x53, 0x6b, 0x69, 0x70, 0x56, 0x65, + 0x72, 0x69, 0x66, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1f, 0x0a, 0x0b, + 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xcf, 0x01, + 0x0a, 0x1a, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x4f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x27, 0x0a, 0x0f, + 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x4f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x6c, 0x61, 0x73, 0x74, + 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x63, + 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x6c, + 0x61, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x66, + 0x69, 0x72, 0x73, 0x74, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x0b, 0x66, 0x69, 0x72, 0x73, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x1f, + 0x0a, 0x0b, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x0a, 0x6e, 0x65, 0x78, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x22, + 0xd6, 0x01, 0x0a, 0x15, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x5f, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x64, 0x65, 0x63, 0x6c, 0x61, + 0x72, 0x65, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x2e, 0x0a, 0x13, 0x64, 0x65, 0x63, 0x6c, + 0x61, 0x72, 0x65, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x53, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x4e, 0x0a, 0x0e, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x27, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, + 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x4f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0d, 0x6f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x87, 0x01, 0x0a, 0x16, 0x52, 0x61, 0x62, + 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, + 0x72, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x25, 0x0a, 0x0e, 0x64, + 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x0d, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x53, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x12, 0x2e, 0x0a, 0x13, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x5f, 0x73, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x11, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x53, 0x69, + 0x7a, 0x65, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, + 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x61, 0x72, 0x67, 0x73, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ps_args_rabbit_streams_proto_rawDescOnce sync.Once + file_ps_args_rabbit_streams_proto_rawDescData = file_ps_args_rabbit_streams_proto_rawDesc +) + +func file_ps_args_rabbit_streams_proto_rawDescGZIP() []byte { + file_ps_args_rabbit_streams_proto_rawDescOnce.Do(func() { + file_ps_args_rabbit_streams_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_args_rabbit_streams_proto_rawDescData) + }) + return file_ps_args_rabbit_streams_proto_rawDescData +} + +var file_ps_args_rabbit_streams_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_ps_args_rabbit_streams_proto_goTypes = []interface{}{ + (*RabbitStreamsConn)(nil), // 0: protos.args.RabbitStreamsConn + (*RabbitStreamsOffsetOptions)(nil), // 1: protos.args.RabbitStreamsOffsetOptions + (*RabbitStreamsReadArgs)(nil), // 2: protos.args.RabbitStreamsReadArgs + (*RabbitStreamsWriteArgs)(nil), // 3: protos.args.RabbitStreamsWriteArgs +} +var file_ps_args_rabbit_streams_proto_depIdxs = []int32{ + 1, // 0: protos.args.RabbitStreamsReadArgs.offset_options:type_name -> protos.args.RabbitStreamsOffsetOptions + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_ps_args_rabbit_streams_proto_init() } +func file_ps_args_rabbit_streams_proto_init() { + if File_ps_args_rabbit_streams_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_args_rabbit_streams_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RabbitStreamsConn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_rabbit_streams_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RabbitStreamsOffsetOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_rabbit_streams_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RabbitStreamsReadArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_rabbit_streams_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RabbitStreamsWriteArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_args_rabbit_streams_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_args_rabbit_streams_proto_goTypes, + DependencyIndexes: file_ps_args_rabbit_streams_proto_depIdxs, + MessageInfos: file_ps_args_rabbit_streams_proto_msgTypes, + }.Build() + File_ps_args_rabbit_streams_proto = out.File + file_ps_args_rabbit_streams_proto_rawDesc = nil + file_ps_args_rabbit_streams_proto_goTypes = nil + file_ps_args_rabbit_streams_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_redis_pubsub.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_redis_pubsub.pb.go index cb91df0cd..72ef52549 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_redis_pubsub.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_redis_pubsub.pb.go @@ -1,26 +1,30 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_args_redis_pubsub.proto package args import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type RedisPubSubConn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Address of redis server',env='PLUMBER_RELAY_REDIS_PUBSUB_ADDRESS',default=localhost:6379" Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" kong:"help='Address of redis server',env='PLUMBER_RELAY_REDIS_PUBSUB_ADDRESS',default=localhost:6379"` // @gotags: kong:"help='Optional username to auth with (redis >= v6.0.0)',env='PLUMBER_RELAY_REDIS_PUBSUB_USERNAME'" @@ -28,168 +32,277 @@ type RedisPubSubConn struct { // @gotags: kong:"help='Optional password to auth with (redis >= v6.0.0)',env='PLUMBER_RELAY_REDIS_PUBSUB_PASSWORD'" Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty" kong:"help='Optional password to auth with (redis >= v6.0.0)',env='PLUMBER_RELAY_REDIS_PUBSUB_PASSWORD'"` // @gotags: kong:"help='Database (0-16)',env='PLUMBER_RELAY_REDIS_PUBSUB_DATABASE'" - Database uint32 `protobuf:"varint,4,opt,name=database,proto3" json:"database,omitempty" kong:"help='Database (0-16)',env='PLUMBER_RELAY_REDIS_PUBSUB_DATABASE'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Database uint32 `protobuf:"varint,4,opt,name=database,proto3" json:"database,omitempty" kong:"help='Database (0-16)',env='PLUMBER_RELAY_REDIS_PUBSUB_DATABASE'"` } -func (m *RedisPubSubConn) Reset() { *m = RedisPubSubConn{} } -func (m *RedisPubSubConn) String() string { return proto.CompactTextString(m) } -func (*RedisPubSubConn) ProtoMessage() {} -func (*RedisPubSubConn) Descriptor() ([]byte, []int) { - return fileDescriptor_02834b0677b77745, []int{0} +func (x *RedisPubSubConn) Reset() { + *x = RedisPubSubConn{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_redis_pubsub_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RedisPubSubConn) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RedisPubSubConn.Unmarshal(m, b) -} -func (m *RedisPubSubConn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RedisPubSubConn.Marshal(b, m, deterministic) +func (x *RedisPubSubConn) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RedisPubSubConn) XXX_Merge(src proto.Message) { - xxx_messageInfo_RedisPubSubConn.Merge(m, src) -} -func (m *RedisPubSubConn) XXX_Size() int { - return xxx_messageInfo_RedisPubSubConn.Size(m) -} -func (m *RedisPubSubConn) XXX_DiscardUnknown() { - xxx_messageInfo_RedisPubSubConn.DiscardUnknown(m) + +func (*RedisPubSubConn) ProtoMessage() {} + +func (x *RedisPubSubConn) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_redis_pubsub_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RedisPubSubConn proto.InternalMessageInfo +// Deprecated: Use RedisPubSubConn.ProtoReflect.Descriptor instead. +func (*RedisPubSubConn) Descriptor() ([]byte, []int) { + return file_ps_args_redis_pubsub_proto_rawDescGZIP(), []int{0} +} -func (m *RedisPubSubConn) GetAddress() string { - if m != nil { - return m.Address +func (x *RedisPubSubConn) GetAddress() string { + if x != nil { + return x.Address } return "" } -func (m *RedisPubSubConn) GetUsername() string { - if m != nil { - return m.Username +func (x *RedisPubSubConn) GetUsername() string { + if x != nil { + return x.Username } return "" } -func (m *RedisPubSubConn) GetPassword() string { - if m != nil { - return m.Password +func (x *RedisPubSubConn) GetPassword() string { + if x != nil { + return x.Password } return "" } -func (m *RedisPubSubConn) GetDatabase() uint32 { - if m != nil { - return m.Database +func (x *RedisPubSubConn) GetDatabase() uint32 { + if x != nil { + return x.Database } return 0 } type RedisPubSubReadArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Comma separated list of channels to read from',env='PLUMBER_RELAY_REDIS_PUBSUB_CHANNELS',required" - Channels []string `protobuf:"bytes,1,rep,name=channels,proto3" json:"channels,omitempty" kong:"help='Comma separated list of channels to read from',env='PLUMBER_RELAY_REDIS_PUBSUB_CHANNELS',required"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Channels []string `protobuf:"bytes,1,rep,name=channels,proto3" json:"channels,omitempty" kong:"help='Comma separated list of channels to read from',env='PLUMBER_RELAY_REDIS_PUBSUB_CHANNELS',required"` } -func (m *RedisPubSubReadArgs) Reset() { *m = RedisPubSubReadArgs{} } -func (m *RedisPubSubReadArgs) String() string { return proto.CompactTextString(m) } -func (*RedisPubSubReadArgs) ProtoMessage() {} -func (*RedisPubSubReadArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_02834b0677b77745, []int{1} +func (x *RedisPubSubReadArgs) Reset() { + *x = RedisPubSubReadArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_redis_pubsub_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RedisPubSubReadArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RedisPubSubReadArgs.Unmarshal(m, b) -} -func (m *RedisPubSubReadArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RedisPubSubReadArgs.Marshal(b, m, deterministic) -} -func (m *RedisPubSubReadArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_RedisPubSubReadArgs.Merge(m, src) +func (x *RedisPubSubReadArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RedisPubSubReadArgs) XXX_Size() int { - return xxx_messageInfo_RedisPubSubReadArgs.Size(m) -} -func (m *RedisPubSubReadArgs) XXX_DiscardUnknown() { - xxx_messageInfo_RedisPubSubReadArgs.DiscardUnknown(m) + +func (*RedisPubSubReadArgs) ProtoMessage() {} + +func (x *RedisPubSubReadArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_redis_pubsub_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RedisPubSubReadArgs proto.InternalMessageInfo +// Deprecated: Use RedisPubSubReadArgs.ProtoReflect.Descriptor instead. +func (*RedisPubSubReadArgs) Descriptor() ([]byte, []int) { + return file_ps_args_redis_pubsub_proto_rawDescGZIP(), []int{1} +} -func (m *RedisPubSubReadArgs) GetChannels() []string { - if m != nil { - return m.Channels +func (x *RedisPubSubReadArgs) GetChannels() []string { + if x != nil { + return x.Channels } return nil } type RedisPubSubWriteArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Comma separated list of channels to write to',required" - Channels []string `protobuf:"bytes,1,rep,name=channels,proto3" json:"channels,omitempty" kong:"help='Comma separated list of channels to write to',required"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Channels []string `protobuf:"bytes,1,rep,name=channels,proto3" json:"channels,omitempty" kong:"help='Comma separated list of channels to write to',required"` } -func (m *RedisPubSubWriteArgs) Reset() { *m = RedisPubSubWriteArgs{} } -func (m *RedisPubSubWriteArgs) String() string { return proto.CompactTextString(m) } -func (*RedisPubSubWriteArgs) ProtoMessage() {} -func (*RedisPubSubWriteArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_02834b0677b77745, []int{2} +func (x *RedisPubSubWriteArgs) Reset() { + *x = RedisPubSubWriteArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_redis_pubsub_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RedisPubSubWriteArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RedisPubSubWriteArgs.Unmarshal(m, b) +func (x *RedisPubSubWriteArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RedisPubSubWriteArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RedisPubSubWriteArgs.Marshal(b, m, deterministic) + +func (*RedisPubSubWriteArgs) ProtoMessage() {} + +func (x *RedisPubSubWriteArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_redis_pubsub_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func (m *RedisPubSubWriteArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_RedisPubSubWriteArgs.Merge(m, src) + +// Deprecated: Use RedisPubSubWriteArgs.ProtoReflect.Descriptor instead. +func (*RedisPubSubWriteArgs) Descriptor() ([]byte, []int) { + return file_ps_args_redis_pubsub_proto_rawDescGZIP(), []int{2} } -func (m *RedisPubSubWriteArgs) XXX_Size() int { - return xxx_messageInfo_RedisPubSubWriteArgs.Size(m) + +func (x *RedisPubSubWriteArgs) GetChannels() []string { + if x != nil { + return x.Channels + } + return nil } -func (m *RedisPubSubWriteArgs) XXX_DiscardUnknown() { - xxx_messageInfo_RedisPubSubWriteArgs.DiscardUnknown(m) + +var File_ps_args_redis_pubsub_proto protoreflect.FileDescriptor + +var file_ps_args_redis_pubsub_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, + 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x22, 0x7f, 0x0a, 0x0f, 0x52, 0x65, 0x64, + 0x69, 0x73, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x18, 0x0a, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1a, + 0x0a, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x22, 0x31, 0x0a, 0x13, 0x52, 0x65, + 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, + 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x22, 0x32, 0x0a, + 0x14, 0x52, 0x65, 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x57, 0x72, 0x69, 0x74, + 0x65, 0x41, 0x72, 0x67, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, + 0x73, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, + 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x61, 0x72, 0x67, 0x73, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var xxx_messageInfo_RedisPubSubWriteArgs proto.InternalMessageInfo +var ( + file_ps_args_redis_pubsub_proto_rawDescOnce sync.Once + file_ps_args_redis_pubsub_proto_rawDescData = file_ps_args_redis_pubsub_proto_rawDesc +) -func (m *RedisPubSubWriteArgs) GetChannels() []string { - if m != nil { - return m.Channels - } - return nil +func file_ps_args_redis_pubsub_proto_rawDescGZIP() []byte { + file_ps_args_redis_pubsub_proto_rawDescOnce.Do(func() { + file_ps_args_redis_pubsub_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_args_redis_pubsub_proto_rawDescData) + }) + return file_ps_args_redis_pubsub_proto_rawDescData } -func init() { - proto.RegisterType((*RedisPubSubConn)(nil), "protos.args.RedisPubSubConn") - proto.RegisterType((*RedisPubSubReadArgs)(nil), "protos.args.RedisPubSubReadArgs") - proto.RegisterType((*RedisPubSubWriteArgs)(nil), "protos.args.RedisPubSubWriteArgs") -} - -func init() { proto.RegisterFile("ps_args_redis_pubsub.proto", fileDescriptor_02834b0677b77745) } - -var fileDescriptor_02834b0677b77745 = []byte{ - // 239 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x90, 0x4f, 0x4b, 0xc4, 0x30, - 0x10, 0xc5, 0x59, 0x57, 0xfc, 0x13, 0x11, 0xa1, 0x7a, 0x28, 0x7b, 0x5a, 0x7a, 0xda, 0x8b, 0x0d, - 0xea, 0x49, 0x3c, 0xa9, 0x5f, 0x40, 0xea, 0x41, 0xf0, 0x52, 0x66, 0x92, 0xa1, 0x2d, 0xb4, 0x49, - 0x98, 0x49, 0xf0, 0xe8, 0x57, 0x97, 0x74, 0xe9, 0xb2, 0x37, 0x4f, 0xe1, 0xc7, 0x2f, 0x2f, 0x79, - 0x3c, 0xb5, 0x09, 0xd2, 0x02, 0x77, 0xd2, 0x32, 0xd9, 0x41, 0xda, 0x90, 0x50, 0x12, 0xd6, 0x81, - 0x7d, 0xf4, 0xc5, 0xd5, 0x7c, 0x48, 0x9d, 0x7d, 0xf5, 0xab, 0x6e, 0x9a, 0x7c, 0xe5, 0x23, 0xe1, - 0x67, 0xc2, 0x77, 0xef, 0x5c, 0x51, 0xaa, 0x73, 0xb0, 0x96, 0x49, 0xa4, 0x5c, 0x6d, 0x57, 0xbb, - 0xcb, 0x66, 0xc1, 0x62, 0xa3, 0x2e, 0x92, 0x10, 0x3b, 0x98, 0xa8, 0x3c, 0x99, 0xd5, 0x81, 0xb3, - 0x0b, 0x20, 0xf2, 0xe3, 0xd9, 0x96, 0xeb, 0xbd, 0x5b, 0x38, 0x3b, 0x0b, 0x11, 0x10, 0x84, 0xca, - 0xd3, 0xed, 0x6a, 0x77, 0xdd, 0x1c, 0xb8, 0x7a, 0x50, 0xb7, 0x47, 0x05, 0x1a, 0x02, 0xfb, 0xca, - 0xdd, 0xfc, 0x95, 0xe9, 0xc1, 0x39, 0x1a, 0x73, 0x8b, 0x75, 0x7e, 0x6e, 0xe1, 0xea, 0x51, 0xdd, - 0x1d, 0x45, 0xbe, 0x78, 0x88, 0xf4, 0x5f, 0xe6, 0xed, 0xe5, 0xfb, 0xb9, 0x1b, 0x62, 0x9f, 0xb0, - 0x36, 0x7e, 0xd2, 0x08, 0xd1, 0xf4, 0xc6, 0x73, 0xd0, 0x61, 0x4c, 0x13, 0x12, 0xdf, 0x8b, 0xe9, - 0x69, 0x02, 0xd1, 0x98, 0x86, 0xd1, 0xea, 0xce, 0xeb, 0xfd, 0x48, 0x3a, 0x8f, 0x84, 0x67, 0x33, - 0x3c, 0xfd, 0x05, 0x00, 0x00, 0xff, 0xff, 0xad, 0xb0, 0x6d, 0x17, 0x56, 0x01, 0x00, 0x00, +var file_ps_args_redis_pubsub_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_ps_args_redis_pubsub_proto_goTypes = []interface{}{ + (*RedisPubSubConn)(nil), // 0: protos.args.RedisPubSubConn + (*RedisPubSubReadArgs)(nil), // 1: protos.args.RedisPubSubReadArgs + (*RedisPubSubWriteArgs)(nil), // 2: protos.args.RedisPubSubWriteArgs +} +var file_ps_args_redis_pubsub_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_ps_args_redis_pubsub_proto_init() } +func file_ps_args_redis_pubsub_proto_init() { + if File_ps_args_redis_pubsub_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_args_redis_pubsub_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RedisPubSubConn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_redis_pubsub_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RedisPubSubReadArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_redis_pubsub_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RedisPubSubWriteArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_args_redis_pubsub_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_args_redis_pubsub_proto_goTypes, + DependencyIndexes: file_ps_args_redis_pubsub_proto_depIdxs, + MessageInfos: file_ps_args_redis_pubsub_proto_msgTypes, + }.Build() + File_ps_args_redis_pubsub_proto = out.File + file_ps_args_redis_pubsub_proto_rawDesc = nil + file_ps_args_redis_pubsub_proto_goTypes = nil + file_ps_args_redis_pubsub_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_redis_streams.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_redis_streams.pb.go index 145c9daa0..e81825621 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_redis_streams.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_redis_streams.pb.go @@ -1,24 +1,24 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_args_redis_streams.proto package args import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type OffsetStart int32 @@ -27,25 +27,50 @@ const ( OffsetStart_OLDEST OffsetStart = 1 ) -var OffsetStart_name = map[int32]string{ - 0: "LATEST", - 1: "OLDEST", -} +// Enum value maps for OffsetStart. +var ( + OffsetStart_name = map[int32]string{ + 0: "LATEST", + 1: "OLDEST", + } + OffsetStart_value = map[string]int32{ + "LATEST": 0, + "OLDEST": 1, + } +) -var OffsetStart_value = map[string]int32{ - "LATEST": 0, - "OLDEST": 1, +func (x OffsetStart) Enum() *OffsetStart { + p := new(OffsetStart) + *p = x + return p } func (x OffsetStart) String() string { - return proto.EnumName(OffsetStart_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (OffsetStart) Descriptor() protoreflect.EnumDescriptor { + return file_ps_args_redis_streams_proto_enumTypes[0].Descriptor() +} + +func (OffsetStart) Type() protoreflect.EnumType { + return &file_ps_args_redis_streams_proto_enumTypes[0] +} + +func (x OffsetStart) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) } +// Deprecated: Use OffsetStart.Descriptor instead. func (OffsetStart) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_7ec80c3317f49688, []int{0} + return file_ps_args_redis_streams_proto_rawDescGZIP(), []int{0} } type RedisStreamsConn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Address of redis server',default=localhost:6379,required,env='PLUMBER_RELAY_REDIS_STREAMS_ADDRESS'" Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" kong:"help='Address of redis server',default=localhost:6379,required,env='PLUMBER_RELAY_REDIS_STREAMS_ADDRESS'"` // @gotags: kong:"help='Username (redis >= v6.0.0)',env='PLUMBER_RELAY_REDIS_STREAMS_USERNAME'" @@ -53,124 +78,140 @@ type RedisStreamsConn struct { // @gotags: kong:"help='Password (redis >= v6.0.0)',env='PLUMBER_RELAY_REDIS_STREAMS_PASSWORD'" Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty" kong:"help='Password (redis >= v6.0.0)',env='PLUMBER_RELAY_REDIS_STREAMS_PASSWORD'"` // @gotags: kong:"help='Database (0-16)',env='PLUMBER_RELAY_REDIS_PUBSUB_DATABASE'" - Database uint32 `protobuf:"varint,4,opt,name=database,proto3" json:"database,omitempty" kong:"help='Database (0-16)',env='PLUMBER_RELAY_REDIS_PUBSUB_DATABASE'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Database uint32 `protobuf:"varint,4,opt,name=database,proto3" json:"database,omitempty" kong:"help='Database (0-16)',env='PLUMBER_RELAY_REDIS_PUBSUB_DATABASE'"` } -func (m *RedisStreamsConn) Reset() { *m = RedisStreamsConn{} } -func (m *RedisStreamsConn) String() string { return proto.CompactTextString(m) } -func (*RedisStreamsConn) ProtoMessage() {} -func (*RedisStreamsConn) Descriptor() ([]byte, []int) { - return fileDescriptor_7ec80c3317f49688, []int{0} +func (x *RedisStreamsConn) Reset() { + *x = RedisStreamsConn{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_redis_streams_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RedisStreamsConn) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RedisStreamsConn.Unmarshal(m, b) +func (x *RedisStreamsConn) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RedisStreamsConn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RedisStreamsConn.Marshal(b, m, deterministic) -} -func (m *RedisStreamsConn) XXX_Merge(src proto.Message) { - xxx_messageInfo_RedisStreamsConn.Merge(m, src) -} -func (m *RedisStreamsConn) XXX_Size() int { - return xxx_messageInfo_RedisStreamsConn.Size(m) -} -func (m *RedisStreamsConn) XXX_DiscardUnknown() { - xxx_messageInfo_RedisStreamsConn.DiscardUnknown(m) + +func (*RedisStreamsConn) ProtoMessage() {} + +func (x *RedisStreamsConn) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_redis_streams_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RedisStreamsConn proto.InternalMessageInfo +// Deprecated: Use RedisStreamsConn.ProtoReflect.Descriptor instead. +func (*RedisStreamsConn) Descriptor() ([]byte, []int) { + return file_ps_args_redis_streams_proto_rawDescGZIP(), []int{0} +} -func (m *RedisStreamsConn) GetAddress() string { - if m != nil { - return m.Address +func (x *RedisStreamsConn) GetAddress() string { + if x != nil { + return x.Address } return "" } -func (m *RedisStreamsConn) GetUsername() string { - if m != nil { - return m.Username +func (x *RedisStreamsConn) GetUsername() string { + if x != nil { + return x.Username } return "" } -func (m *RedisStreamsConn) GetPassword() string { - if m != nil { - return m.Password +func (x *RedisStreamsConn) GetPassword() string { + if x != nil { + return x.Password } return "" } -func (m *RedisStreamsConn) GetDatabase() uint32 { - if m != nil { - return m.Database +func (x *RedisStreamsConn) GetDatabase() uint32 { + if x != nil { + return x.Database } return 0 } type CreateConsumerConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Create the streams if creating a new consumer group',env='PLUMBER_RELAY_REDIS_STREAMS_CREATE_STREAMS'" CreateStreams bool `protobuf:"varint,1,opt,name=create_streams,json=createStreams,proto3" json:"create_streams,omitempty" kong:"help='Create the streams if creating a new consumer group',env='PLUMBER_RELAY_REDIS_STREAMS_CREATE_STREAMS'"` // @gotags: kong:"help='Recreate this consumer group if it does not exist',env='PLUMBER_RELAY_REDIS_STREAMS_RECREATE_CONSUMER_GROUP'" RecreateConsumerGroup bool `protobuf:"varint,2,opt,name=recreate_consumer_group,json=recreateConsumerGroup,proto3" json:"recreate_consumer_group,omitempty" kong:"help='Recreate this consumer group if it does not exist',env='PLUMBER_RELAY_REDIS_STREAMS_RECREATE_CONSUMER_GROUP'"` // @gotags: kong:"help='What offset to start reading at (options: latest oldest)',default=latest,required,env='PLUMBER_RELAY_REDIS_STREAMS_START_ID',type=pbenum,pbenum_lowercase" - OffsetStart OffsetStart `protobuf:"varint,3,opt,name=offset_start,json=offsetStart,proto3,enum=protos.args.OffsetStart" json:"offset_start,omitempty" kong:"help='What offset to start reading at (options: latest oldest)',default=latest,required,env='PLUMBER_RELAY_REDIS_STREAMS_START_ID',type=pbenum,pbenum_lowercase"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OffsetStart OffsetStart `protobuf:"varint,3,opt,name=offset_start,json=offsetStart,proto3,enum=protos.args.OffsetStart" json:"offset_start,omitempty" kong:"help='What offset to start reading at (options: latest oldest)',default=latest,required,env='PLUMBER_RELAY_REDIS_STREAMS_START_ID',type=pbenum,pbenum_lowercase"` } -func (m *CreateConsumerConfig) Reset() { *m = CreateConsumerConfig{} } -func (m *CreateConsumerConfig) String() string { return proto.CompactTextString(m) } -func (*CreateConsumerConfig) ProtoMessage() {} -func (*CreateConsumerConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_7ec80c3317f49688, []int{1} +func (x *CreateConsumerConfig) Reset() { + *x = CreateConsumerConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_redis_streams_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *CreateConsumerConfig) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateConsumerConfig.Unmarshal(m, b) -} -func (m *CreateConsumerConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateConsumerConfig.Marshal(b, m, deterministic) +func (x *CreateConsumerConfig) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CreateConsumerConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateConsumerConfig.Merge(m, src) -} -func (m *CreateConsumerConfig) XXX_Size() int { - return xxx_messageInfo_CreateConsumerConfig.Size(m) -} -func (m *CreateConsumerConfig) XXX_DiscardUnknown() { - xxx_messageInfo_CreateConsumerConfig.DiscardUnknown(m) + +func (*CreateConsumerConfig) ProtoMessage() {} + +func (x *CreateConsumerConfig) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_redis_streams_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_CreateConsumerConfig proto.InternalMessageInfo +// Deprecated: Use CreateConsumerConfig.ProtoReflect.Descriptor instead. +func (*CreateConsumerConfig) Descriptor() ([]byte, []int) { + return file_ps_args_redis_streams_proto_rawDescGZIP(), []int{1} +} -func (m *CreateConsumerConfig) GetCreateStreams() bool { - if m != nil { - return m.CreateStreams +func (x *CreateConsumerConfig) GetCreateStreams() bool { + if x != nil { + return x.CreateStreams } return false } -func (m *CreateConsumerConfig) GetRecreateConsumerGroup() bool { - if m != nil { - return m.RecreateConsumerGroup +func (x *CreateConsumerConfig) GetRecreateConsumerGroup() bool { + if x != nil { + return x.RecreateConsumerGroup } return false } -func (m *CreateConsumerConfig) GetOffsetStart() OffsetStart { - if m != nil { - return m.OffsetStart +func (x *CreateConsumerConfig) GetOffsetStart() OffsetStart { + if x != nil { + return x.OffsetStart } return OffsetStart_LATEST } type RedisStreamsReadArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Streams to read from',required,env='PLUMBER_RELAY_REDIS_STREAMS_STREAMS'" Streams []string `protobuf:"bytes,1,rep,name=streams,proto3" json:"streams,omitempty" kong:"help='Streams to read from',required,env='PLUMBER_RELAY_REDIS_STREAMS_STREAMS'"` // @gotags: kong:"help='Consumer group name',env='PLUMBER_RELAY_REDIS_STREAMS_CONSUMER_GROUP',default=plumber" @@ -181,167 +222,299 @@ type RedisStreamsReadArgs struct { Count uint32 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty" kong:"help='Number of records to read from stream(s) per read',env='PLUMBER_RELAY_REDIS_STREAMS_COUNT',default=10"` // @gotags: kong:"embed" CreateConsumerConfig *CreateConsumerConfig `protobuf:"bytes,5,opt,name=create_consumer_config,json=createConsumerConfig,proto3" json:"create_consumer_config,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` } -func (m *RedisStreamsReadArgs) Reset() { *m = RedisStreamsReadArgs{} } -func (m *RedisStreamsReadArgs) String() string { return proto.CompactTextString(m) } -func (*RedisStreamsReadArgs) ProtoMessage() {} -func (*RedisStreamsReadArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_7ec80c3317f49688, []int{2} +func (x *RedisStreamsReadArgs) Reset() { + *x = RedisStreamsReadArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_redis_streams_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RedisStreamsReadArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RedisStreamsReadArgs.Unmarshal(m, b) -} -func (m *RedisStreamsReadArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RedisStreamsReadArgs.Marshal(b, m, deterministic) +func (x *RedisStreamsReadArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RedisStreamsReadArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_RedisStreamsReadArgs.Merge(m, src) -} -func (m *RedisStreamsReadArgs) XXX_Size() int { - return xxx_messageInfo_RedisStreamsReadArgs.Size(m) -} -func (m *RedisStreamsReadArgs) XXX_DiscardUnknown() { - xxx_messageInfo_RedisStreamsReadArgs.DiscardUnknown(m) + +func (*RedisStreamsReadArgs) ProtoMessage() {} + +func (x *RedisStreamsReadArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_redis_streams_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RedisStreamsReadArgs proto.InternalMessageInfo +// Deprecated: Use RedisStreamsReadArgs.ProtoReflect.Descriptor instead. +func (*RedisStreamsReadArgs) Descriptor() ([]byte, []int) { + return file_ps_args_redis_streams_proto_rawDescGZIP(), []int{2} +} -func (m *RedisStreamsReadArgs) GetStreams() []string { - if m != nil { - return m.Streams +func (x *RedisStreamsReadArgs) GetStreams() []string { + if x != nil { + return x.Streams } return nil } -func (m *RedisStreamsReadArgs) GetConsumerGroup() string { - if m != nil { - return m.ConsumerGroup +func (x *RedisStreamsReadArgs) GetConsumerGroup() string { + if x != nil { + return x.ConsumerGroup } return "" } -func (m *RedisStreamsReadArgs) GetConsumerName() string { - if m != nil { - return m.ConsumerName +func (x *RedisStreamsReadArgs) GetConsumerName() string { + if x != nil { + return x.ConsumerName } return "" } -func (m *RedisStreamsReadArgs) GetCount() uint32 { - if m != nil { - return m.Count +func (x *RedisStreamsReadArgs) GetCount() uint32 { + if x != nil { + return x.Count } return 0 } -func (m *RedisStreamsReadArgs) GetCreateConsumerConfig() *CreateConsumerConfig { - if m != nil { - return m.CreateConsumerConfig +func (x *RedisStreamsReadArgs) GetCreateConsumerConfig() *CreateConsumerConfig { + if x != nil { + return x.CreateConsumerConfig } return nil } type RedisStreamsWriteArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='What redis ID to use for input data (* = auto-generate)',default='*'" WriteId string `protobuf:"bytes,1,opt,name=write_id,json=writeId,proto3" json:"write_id,omitempty" kong:"help='What redis ID to use for input data (* = auto-generate)',default='*'"` // @gotags: kong:"help='Streams to write to'" Streams []string `protobuf:"bytes,2,rep,name=streams,proto3" json:"streams,omitempty" kong:"help='Streams to write to'"` // @gotags: kong:"help='Key name to write input data to'" - Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty" kong:"help='Key name to write input data to'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty" kong:"help='Key name to write input data to'"` } -func (m *RedisStreamsWriteArgs) Reset() { *m = RedisStreamsWriteArgs{} } -func (m *RedisStreamsWriteArgs) String() string { return proto.CompactTextString(m) } -func (*RedisStreamsWriteArgs) ProtoMessage() {} -func (*RedisStreamsWriteArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_7ec80c3317f49688, []int{3} +func (x *RedisStreamsWriteArgs) Reset() { + *x = RedisStreamsWriteArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_args_redis_streams_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RedisStreamsWriteArgs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RedisStreamsWriteArgs.Unmarshal(m, b) -} -func (m *RedisStreamsWriteArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RedisStreamsWriteArgs.Marshal(b, m, deterministic) +func (x *RedisStreamsWriteArgs) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RedisStreamsWriteArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_RedisStreamsWriteArgs.Merge(m, src) -} -func (m *RedisStreamsWriteArgs) XXX_Size() int { - return xxx_messageInfo_RedisStreamsWriteArgs.Size(m) -} -func (m *RedisStreamsWriteArgs) XXX_DiscardUnknown() { - xxx_messageInfo_RedisStreamsWriteArgs.DiscardUnknown(m) + +func (*RedisStreamsWriteArgs) ProtoMessage() {} + +func (x *RedisStreamsWriteArgs) ProtoReflect() protoreflect.Message { + mi := &file_ps_args_redis_streams_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RedisStreamsWriteArgs proto.InternalMessageInfo +// Deprecated: Use RedisStreamsWriteArgs.ProtoReflect.Descriptor instead. +func (*RedisStreamsWriteArgs) Descriptor() ([]byte, []int) { + return file_ps_args_redis_streams_proto_rawDescGZIP(), []int{3} +} -func (m *RedisStreamsWriteArgs) GetWriteId() string { - if m != nil { - return m.WriteId +func (x *RedisStreamsWriteArgs) GetWriteId() string { + if x != nil { + return x.WriteId } return "" } -func (m *RedisStreamsWriteArgs) GetStreams() []string { - if m != nil { - return m.Streams +func (x *RedisStreamsWriteArgs) GetStreams() []string { + if x != nil { + return x.Streams } return nil } -func (m *RedisStreamsWriteArgs) GetKey() string { - if m != nil { - return m.Key +func (x *RedisStreamsWriteArgs) GetKey() string { + if x != nil { + return x.Key } return "" } -func init() { - proto.RegisterEnum("protos.args.OffsetStart", OffsetStart_name, OffsetStart_value) - proto.RegisterType((*RedisStreamsConn)(nil), "protos.args.RedisStreamsConn") - proto.RegisterType((*CreateConsumerConfig)(nil), "protos.args.CreateConsumerConfig") - proto.RegisterType((*RedisStreamsReadArgs)(nil), "protos.args.RedisStreamsReadArgs") - proto.RegisterType((*RedisStreamsWriteArgs)(nil), "protos.args.RedisStreamsWriteArgs") -} - -func init() { proto.RegisterFile("ps_args_redis_streams.proto", fileDescriptor_7ec80c3317f49688) } - -var fileDescriptor_7ec80c3317f49688 = []byte{ - // 444 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0x51, 0x6b, 0xd4, 0x40, - 0x14, 0x85, 0x4d, 0xd7, 0xd6, 0xed, 0xdd, 0x6e, 0x59, 0xc2, 0x56, 0xa3, 0xbe, 0xac, 0x2b, 0x85, - 0x45, 0x30, 0x81, 0x0a, 0x82, 0xf4, 0xa9, 0x46, 0x11, 0xa1, 0x58, 0x98, 0x2d, 0x14, 0x7c, 0x30, - 0x4c, 0x66, 0x66, 0xb3, 0xc1, 0x26, 0x13, 0xee, 0x9d, 0x50, 0x7c, 0xf3, 0x37, 0xf9, 0xb7, 0xfc, - 0x13, 0x32, 0x93, 0x64, 0x9b, 0xb5, 0xfb, 0x94, 0x7b, 0xee, 0xb9, 0x0c, 0xe7, 0x7c, 0x04, 0x5e, - 0x56, 0x94, 0x70, 0xcc, 0x28, 0x41, 0x25, 0x73, 0x4a, 0xc8, 0xa0, 0xe2, 0x05, 0x85, 0x15, 0x6a, - 0xa3, 0xfd, 0x91, 0xfb, 0x50, 0x68, 0x0f, 0xe6, 0xbf, 0x3d, 0x98, 0x30, 0x7b, 0xb4, 0x6c, 0x6e, - 0x62, 0x5d, 0x96, 0x7e, 0x00, 0x4f, 0xb8, 0x94, 0xa8, 0x88, 0x02, 0x6f, 0xe6, 0x2d, 0x0e, 0x59, - 0x27, 0xfd, 0x17, 0x30, 0xac, 0x49, 0x61, 0xc9, 0x0b, 0x15, 0xec, 0x39, 0x6b, 0xa3, 0xad, 0x57, - 0x71, 0xa2, 0x3b, 0x8d, 0x32, 0x18, 0x34, 0x5e, 0xa7, 0xad, 0x27, 0xb9, 0xe1, 0x29, 0x27, 0x15, - 0x3c, 0x9e, 0x79, 0x8b, 0x31, 0xdb, 0xe8, 0xf9, 0x1f, 0x0f, 0xa6, 0x31, 0x2a, 0x6e, 0x54, 0xac, - 0x4b, 0xaa, 0x0b, 0x85, 0xb1, 0x2e, 0x57, 0x79, 0xe6, 0x9f, 0xc2, 0xb1, 0x70, 0xfb, 0xae, 0x80, - 0x4b, 0x33, 0x64, 0xe3, 0x66, 0xdb, 0x26, 0xf6, 0xdf, 0xc3, 0x33, 0x54, 0xed, 0xa1, 0x68, 0x5f, - 0x48, 0x32, 0xd4, 0x75, 0xe5, 0x22, 0x0e, 0xd9, 0x49, 0x67, 0x77, 0xef, 0x7f, 0xb1, 0xa6, 0x7f, - 0x0e, 0x47, 0x7a, 0xb5, 0x22, 0x65, 0x12, 0x32, 0x1c, 0x8d, 0xcb, 0x7c, 0x7c, 0x16, 0x84, 0x3d, - 0x3c, 0xe1, 0x95, 0x3b, 0x58, 0x5a, 0x9f, 0x8d, 0xf4, 0xbd, 0x98, 0xff, 0xf5, 0x60, 0xda, 0xe7, - 0xc6, 0x14, 0x97, 0x17, 0x98, 0x91, 0x65, 0x77, 0x9f, 0x76, 0x60, 0xd9, 0xb5, 0xd2, 0xd5, 0x79, - 0x18, 0xef, 0x90, 0x8d, 0xc5, 0x56, 0xac, 0xd7, 0xb0, 0x59, 0x24, 0x8e, 0x73, 0xc3, 0xf2, 0xa8, - 0x5b, 0x7e, 0xb3, 0xac, 0xa7, 0xb0, 0x2f, 0x74, 0x5d, 0x9a, 0x16, 0x66, 0x23, 0xfc, 0x1b, 0x78, - 0xfa, 0x3f, 0x07, 0xe1, 0x50, 0x06, 0xfb, 0x33, 0x6f, 0x31, 0x3a, 0x7b, 0xb5, 0xd5, 0x6d, 0x17, - 0x73, 0x36, 0x15, 0x3b, 0xb6, 0xf3, 0x1f, 0x70, 0xd2, 0x2f, 0x7b, 0x83, 0xb9, 0x51, 0xae, 0xed, - 0x73, 0x18, 0xde, 0x59, 0x91, 0xe4, 0xb2, 0xfb, 0x55, 0x9c, 0xfe, 0x2a, 0xfb, 0x20, 0xf6, 0xb6, - 0x41, 0x4c, 0x60, 0xf0, 0x53, 0xfd, 0x6a, 0x7b, 0xd9, 0xf1, 0xcd, 0x29, 0x8c, 0x7a, 0xa4, 0x7d, - 0x80, 0x83, 0xcb, 0x8b, 0xeb, 0xcf, 0xcb, 0xeb, 0xc9, 0x23, 0x3b, 0x5f, 0x5d, 0x7e, 0xb2, 0xb3, - 0xf7, 0xf1, 0xfc, 0xfb, 0x87, 0x2c, 0x37, 0xeb, 0x3a, 0x0d, 0x85, 0x2e, 0xa2, 0x94, 0x1b, 0xb1, - 0x16, 0x1a, 0xab, 0xa8, 0xba, 0xad, 0x8b, 0x54, 0xe1, 0x5b, 0x12, 0x6b, 0x55, 0x70, 0x8a, 0xd2, - 0x3a, 0xbf, 0x95, 0x51, 0xa6, 0xa3, 0xa6, 0x6e, 0x64, 0xeb, 0xa6, 0x07, 0x4e, 0xbc, 0xfb, 0x17, - 0x00, 0x00, 0xff, 0xff, 0x8e, 0xba, 0x17, 0xde, 0x1c, 0x03, 0x00, 0x00, +var File_ps_args_redis_streams_proto protoreflect.FileDescriptor + +var file_ps_args_redis_streams_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, + 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x22, 0x80, 0x01, 0x0a, 0x10, 0x52, + 0x65, 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x12, + 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, + 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, + 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x22, 0xb2, 0x01, + 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, + 0x17, 0x72, 0x65, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, + 0x65, 0x72, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, + 0x72, 0x65, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x3b, 0x0a, 0x0c, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x5f, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x0b, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x53, 0x74, 0x61, + 0x72, 0x74, 0x22, 0xeb, 0x01, 0x0a, 0x14, 0x52, 0x65, 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, + 0x72, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, + 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x23, 0x0a, 0x0d, + 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x57, 0x0a, 0x16, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x73, + 0x75, 0x6d, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x14, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x22, 0x5e, 0x0a, 0x15, 0x52, 0x65, 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, + 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x77, 0x72, 0x69, + 0x74, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x77, 0x72, 0x69, + 0x74, 0x65, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x2a, 0x25, 0x0a, 0x0b, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, + 0x0a, 0x0a, 0x06, 0x4c, 0x41, 0x54, 0x45, 0x53, 0x54, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, + 0x4c, 0x44, 0x45, 0x53, 0x54, 0x10, 0x01, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, + 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, + 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, + 0x61, 0x72, 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ps_args_redis_streams_proto_rawDescOnce sync.Once + file_ps_args_redis_streams_proto_rawDescData = file_ps_args_redis_streams_proto_rawDesc +) + +func file_ps_args_redis_streams_proto_rawDescGZIP() []byte { + file_ps_args_redis_streams_proto_rawDescOnce.Do(func() { + file_ps_args_redis_streams_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_args_redis_streams_proto_rawDescData) + }) + return file_ps_args_redis_streams_proto_rawDescData +} + +var file_ps_args_redis_streams_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_ps_args_redis_streams_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_ps_args_redis_streams_proto_goTypes = []interface{}{ + (OffsetStart)(0), // 0: protos.args.OffsetStart + (*RedisStreamsConn)(nil), // 1: protos.args.RedisStreamsConn + (*CreateConsumerConfig)(nil), // 2: protos.args.CreateConsumerConfig + (*RedisStreamsReadArgs)(nil), // 3: protos.args.RedisStreamsReadArgs + (*RedisStreamsWriteArgs)(nil), // 4: protos.args.RedisStreamsWriteArgs +} +var file_ps_args_redis_streams_proto_depIdxs = []int32{ + 0, // 0: protos.args.CreateConsumerConfig.offset_start:type_name -> protos.args.OffsetStart + 2, // 1: protos.args.RedisStreamsReadArgs.create_consumer_config:type_name -> protos.args.CreateConsumerConfig + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_ps_args_redis_streams_proto_init() } +func file_ps_args_redis_streams_proto_init() { + if File_ps_args_redis_streams_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_args_redis_streams_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RedisStreamsConn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_redis_streams_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateConsumerConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_redis_streams_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RedisStreamsReadArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_args_redis_streams_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RedisStreamsWriteArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_args_redis_streams_proto_rawDesc, + NumEnums: 1, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_args_redis_streams_proto_goTypes, + DependencyIndexes: file_ps_args_redis_streams_proto_depIdxs, + EnumInfos: file_ps_args_redis_streams_proto_enumTypes, + MessageInfos: file_ps_args_redis_streams_proto_msgTypes, + }.Build() + File_ps_args_redis_streams_proto = out.File + file_ps_args_redis_streams_proto_rawDesc = nil + file_ps_args_redis_streams_proto_goTypes = nil + file_ps_args_redis_streams_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/common/ps_common_auth.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/common/ps_common_auth.pb.go index a59dcdbe5..053e20d0f 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/common/ps_common_auth.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/common/ps_common_auth.pb.go @@ -1,211 +1,329 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_common_auth.proto package common import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type Foreman struct { - AuthToken string `protobuf:"bytes,1,opt,name=auth_token,json=authToken,proto3" json:"auth_token,omitempty"` - PlumberClusterId string `protobuf:"bytes,2,opt,name=plumber_cluster_id,json=plumberClusterId,proto3" json:"plumber_cluster_id,omitempty"` - TeamId string `protobuf:"bytes,3,opt,name=team_id,json=teamId,proto3" json:"team_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *Foreman) Reset() { *m = Foreman{} } -func (m *Foreman) String() string { return proto.CompactTextString(m) } -func (*Foreman) ProtoMessage() {} -func (*Foreman) Descriptor() ([]byte, []int) { - return fileDescriptor_69536745fee4073a, []int{0} + AuthToken string `protobuf:"bytes,1,opt,name=auth_token,json=authToken,proto3" json:"auth_token,omitempty"` + PlumberClusterId string `protobuf:"bytes,2,opt,name=plumber_cluster_id,json=plumberClusterId,proto3" json:"plumber_cluster_id,omitempty"` + TeamId string `protobuf:"bytes,3,opt,name=team_id,json=teamId,proto3" json:"team_id,omitempty"` } -func (m *Foreman) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Foreman.Unmarshal(m, b) -} -func (m *Foreman) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Foreman.Marshal(b, m, deterministic) -} -func (m *Foreman) XXX_Merge(src proto.Message) { - xxx_messageInfo_Foreman.Merge(m, src) +func (x *Foreman) Reset() { + *x = Foreman{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_common_auth_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Foreman) XXX_Size() int { - return xxx_messageInfo_Foreman.Size(m) + +func (x *Foreman) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Foreman) XXX_DiscardUnknown() { - xxx_messageInfo_Foreman.DiscardUnknown(m) + +func (*Foreman) ProtoMessage() {} + +func (x *Foreman) ProtoReflect() protoreflect.Message { + mi := &file_ps_common_auth_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_Foreman proto.InternalMessageInfo +// Deprecated: Use Foreman.ProtoReflect.Descriptor instead. +func (*Foreman) Descriptor() ([]byte, []int) { + return file_ps_common_auth_proto_rawDescGZIP(), []int{0} +} -func (m *Foreman) GetAuthToken() string { - if m != nil { - return m.AuthToken +func (x *Foreman) GetAuthToken() string { + if x != nil { + return x.AuthToken } return "" } -func (m *Foreman) GetPlumberClusterId() string { - if m != nil { - return m.PlumberClusterId +func (x *Foreman) GetPlumberClusterId() string { + if x != nil { + return x.PlumberClusterId } return "" } -func (m *Foreman) GetTeamId() string { - if m != nil { - return m.TeamId +func (x *Foreman) GetTeamId() string { + if x != nil { + return x.TeamId } return "" } type SourceManager struct { - ServerToken string `protobuf:"bytes,1,opt,name=server_token,json=serverToken,proto3" json:"server_token,omitempty"` - SourceId string `protobuf:"bytes,2,opt,name=source_id,json=sourceId,proto3" json:"source_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *SourceManager) Reset() { *m = SourceManager{} } -func (m *SourceManager) String() string { return proto.CompactTextString(m) } -func (*SourceManager) ProtoMessage() {} -func (*SourceManager) Descriptor() ([]byte, []int) { - return fileDescriptor_69536745fee4073a, []int{1} + ServerToken string `protobuf:"bytes,1,opt,name=server_token,json=serverToken,proto3" json:"server_token,omitempty"` + SourceId string `protobuf:"bytes,2,opt,name=source_id,json=sourceId,proto3" json:"source_id,omitempty"` } -func (m *SourceManager) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SourceManager.Unmarshal(m, b) -} -func (m *SourceManager) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SourceManager.Marshal(b, m, deterministic) -} -func (m *SourceManager) XXX_Merge(src proto.Message) { - xxx_messageInfo_SourceManager.Merge(m, src) +func (x *SourceManager) Reset() { + *x = SourceManager{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_common_auth_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *SourceManager) XXX_Size() int { - return xxx_messageInfo_SourceManager.Size(m) + +func (x *SourceManager) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *SourceManager) XXX_DiscardUnknown() { - xxx_messageInfo_SourceManager.DiscardUnknown(m) + +func (*SourceManager) ProtoMessage() {} + +func (x *SourceManager) ProtoReflect() protoreflect.Message { + mi := &file_ps_common_auth_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_SourceManager proto.InternalMessageInfo +// Deprecated: Use SourceManager.ProtoReflect.Descriptor instead. +func (*SourceManager) Descriptor() ([]byte, []int) { + return file_ps_common_auth_proto_rawDescGZIP(), []int{1} +} -func (m *SourceManager) GetServerToken() string { - if m != nil { - return m.ServerToken +func (x *SourceManager) GetServerToken() string { + if x != nil { + return x.ServerToken } return "" } -func (m *SourceManager) GetSourceId() string { - if m != nil { - return m.SourceId +func (x *SourceManager) GetSourceId() string { + if x != nil { + return x.SourceId } return "" } type Auth struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` // Filled out by Streamdal. Not intended to be used by plumber. XForeman *Foreman `protobuf:"bytes,2,opt,name=_foreman,json=Foreman,proto3" json:"_foreman,omitempty"` // Filled out by Streamdal. Not intended to be used by Plumber. - XSourceManager *SourceManager `protobuf:"bytes,3,opt,name=_source_manager,json=SourceManager,proto3" json:"_source_manager,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + XSourceManager *SourceManager `protobuf:"bytes,3,opt,name=_source_manager,json=SourceManager,proto3" json:"_source_manager,omitempty"` } -func (m *Auth) Reset() { *m = Auth{} } -func (m *Auth) String() string { return proto.CompactTextString(m) } -func (*Auth) ProtoMessage() {} -func (*Auth) Descriptor() ([]byte, []int) { - return fileDescriptor_69536745fee4073a, []int{2} +func (x *Auth) Reset() { + *x = Auth{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_common_auth_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Auth) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Auth.Unmarshal(m, b) -} -func (m *Auth) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Auth.Marshal(b, m, deterministic) -} -func (m *Auth) XXX_Merge(src proto.Message) { - xxx_messageInfo_Auth.Merge(m, src) -} -func (m *Auth) XXX_Size() int { - return xxx_messageInfo_Auth.Size(m) +func (x *Auth) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Auth) XXX_DiscardUnknown() { - xxx_messageInfo_Auth.DiscardUnknown(m) + +func (*Auth) ProtoMessage() {} + +func (x *Auth) ProtoReflect() protoreflect.Message { + mi := &file_ps_common_auth_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_Auth proto.InternalMessageInfo +// Deprecated: Use Auth.ProtoReflect.Descriptor instead. +func (*Auth) Descriptor() ([]byte, []int) { + return file_ps_common_auth_proto_rawDescGZIP(), []int{2} +} -func (m *Auth) GetToken() string { - if m != nil { - return m.Token +func (x *Auth) GetToken() string { + if x != nil { + return x.Token } return "" } -func (m *Auth) GetXForeman() *Foreman { - if m != nil { - return m.XForeman +func (x *Auth) GetXForeman() *Foreman { + if x != nil { + return x.XForeman } return nil } -func (m *Auth) GetXSourceManager() *SourceManager { - if m != nil { - return m.XSourceManager +func (x *Auth) GetXSourceManager() *SourceManager { + if x != nil { + return x.XSourceManager } return nil } -func init() { - proto.RegisterType((*Foreman)(nil), "protos.common.Foreman") - proto.RegisterType((*SourceManager)(nil), "protos.common.SourceManager") - proto.RegisterType((*Auth)(nil), "protos.common.Auth") -} - -func init() { proto.RegisterFile("ps_common_auth.proto", fileDescriptor_69536745fee4073a) } - -var fileDescriptor_69536745fee4073a = []byte{ - // 290 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x50, 0x4d, 0x4b, 0xc4, 0x30, - 0x14, 0x64, 0xfd, 0xd8, 0xdd, 0xbe, 0xba, 0x28, 0x61, 0xd1, 0x05, 0x15, 0xb4, 0x27, 0x0f, 0xda, - 0xe0, 0x7a, 0x14, 0x0f, 0x7e, 0x20, 0xf4, 0x20, 0x42, 0xf5, 0xe4, 0x25, 0xa4, 0x69, 0x6c, 0x8b, - 0x4d, 0x53, 0xf2, 0xe1, 0x3f, 0xf1, 0xff, 0x4a, 0x92, 0xa2, 0xd6, 0x53, 0x78, 0xf3, 0xe6, 0xcd, - 0x64, 0x06, 0x96, 0xbd, 0x26, 0x4c, 0x0a, 0x21, 0x3b, 0x42, 0xad, 0xa9, 0xd3, 0x5e, 0x49, 0x23, - 0xd1, 0xc2, 0x3f, 0x3a, 0x0d, 0x9b, 0x44, 0xc2, 0xec, 0x51, 0x2a, 0x2e, 0x68, 0x87, 0x8e, 0x01, - 0x1c, 0x8f, 0x18, 0xf9, 0xc1, 0xbb, 0xd5, 0xe4, 0x64, 0x72, 0x16, 0xe5, 0x91, 0x43, 0x5e, 0x1d, - 0x80, 0xce, 0x01, 0xf5, 0xad, 0x15, 0x05, 0x57, 0x84, 0xb5, 0x56, 0x1b, 0xae, 0x48, 0x53, 0xae, - 0x36, 0x3c, 0x6d, 0x6f, 0xd8, 0xdc, 0x87, 0x45, 0x56, 0xa2, 0x03, 0x98, 0x19, 0x4e, 0x85, 0xa3, - 0x6c, 0x7a, 0xca, 0xd4, 0x8d, 0x59, 0x99, 0x3c, 0xc3, 0xe2, 0x45, 0x5a, 0xc5, 0xf8, 0x13, 0xed, - 0x68, 0xc5, 0x15, 0x3a, 0x85, 0x1d, 0xcd, 0xd5, 0x27, 0x57, 0x23, 0xe3, 0x38, 0x60, 0xc1, 0xfa, - 0x10, 0x22, 0xed, 0x6f, 0x7e, 0x1d, 0xe7, 0x01, 0xc8, 0xca, 0xe4, 0x6b, 0x02, 0x5b, 0xb7, 0xd6, - 0xd4, 0x68, 0x09, 0xdb, 0x7f, 0x15, 0xc2, 0x80, 0x2e, 0x61, 0x4e, 0xde, 0x43, 0x42, 0x7f, 0x1a, - 0xaf, 0xf7, 0xd3, 0x51, 0x05, 0xe9, 0x90, 0x3f, 0xff, 0x29, 0xe2, 0x01, 0x76, 0xc9, 0xe0, 0x27, - 0xc2, 0x27, 0x7d, 0x86, 0x78, 0x7d, 0xf4, 0xef, 0x72, 0x14, 0x24, 0x1f, 0xe7, 0xba, 0xbb, 0x79, - 0xbb, 0xae, 0x1a, 0x53, 0xdb, 0xc2, 0xb1, 0x71, 0x41, 0x0d, 0xab, 0x99, 0x54, 0x3d, 0x1e, 0xaa, - 0xba, 0xd0, 0xac, 0xe6, 0x82, 0x6a, 0x5c, 0xd8, 0xa6, 0x2d, 0x71, 0x25, 0x71, 0xd0, 0xc6, 0x41, - 0xbb, 0x98, 0xfa, 0xf1, 0xea, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xbb, 0x06, 0x17, 0x4d, 0xc6, 0x01, - 0x00, 0x00, +var File_ps_common_auth_proto protoreflect.FileDescriptor + +var file_ps_common_auth_proto_rawDesc = []byte{ + 0x0a, 0x14, 0x70, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x61, 0x75, 0x74, 0x68, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x22, 0x6f, 0x0a, 0x07, 0x46, 0x6f, 0x72, 0x65, 0x6d, 0x61, 0x6e, + 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, + 0x2c, 0x0a, 0x12, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, + 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x70, 0x6c, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, + 0x07, 0x74, 0x65, 0x61, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x74, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x22, 0x4f, 0x0a, 0x0d, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x22, 0x95, 0x01, 0x0a, 0x04, 0x41, 0x75, 0x74, 0x68, + 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x31, 0x0a, 0x08, 0x5f, 0x66, 0x6f, 0x72, 0x65, 0x6d, + 0x61, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x46, 0x6f, 0x72, 0x65, 0x6d, 0x61, 0x6e, + 0x52, 0x07, 0x46, 0x6f, 0x72, 0x65, 0x6d, 0x61, 0x6e, 0x12, 0x44, 0x0a, 0x0f, 0x5f, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x52, 0x0d, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x42, + 0x3d, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, + 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ps_common_auth_proto_rawDescOnce sync.Once + file_ps_common_auth_proto_rawDescData = file_ps_common_auth_proto_rawDesc +) + +func file_ps_common_auth_proto_rawDescGZIP() []byte { + file_ps_common_auth_proto_rawDescOnce.Do(func() { + file_ps_common_auth_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_common_auth_proto_rawDescData) + }) + return file_ps_common_auth_proto_rawDescData +} + +var file_ps_common_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_ps_common_auth_proto_goTypes = []interface{}{ + (*Foreman)(nil), // 0: protos.common.Foreman + (*SourceManager)(nil), // 1: protos.common.SourceManager + (*Auth)(nil), // 2: protos.common.Auth +} +var file_ps_common_auth_proto_depIdxs = []int32{ + 0, // 0: protos.common.Auth._foreman:type_name -> protos.common.Foreman + 1, // 1: protos.common.Auth._source_manager:type_name -> protos.common.SourceManager + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_ps_common_auth_proto_init() } +func file_ps_common_auth_proto_init() { + if File_ps_common_auth_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_common_auth_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Foreman); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_common_auth_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SourceManager); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_common_auth_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Auth); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_common_auth_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_common_auth_proto_goTypes, + DependencyIndexes: file_ps_common_auth_proto_depIdxs, + MessageInfos: file_ps_common_auth_proto_msgTypes, + }.Build() + File_ps_common_auth_proto = out.File + file_ps_common_auth_proto_rawDesc = nil + file_ps_common_auth_proto_goTypes = nil + file_ps_common_auth_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/common/ps_common_backends.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/common/ps_common_backends.pb.go index fa9803010..20c3be57f 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/common/ps_common_backends.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/common/ps_common_backends.pb.go @@ -1,24 +1,26 @@ +// ps_common_backends.proto contains the list of all supported / available backends. + // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_common_backends.proto package common import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type BackendType int32 @@ -46,93 +48,178 @@ const ( BackendType_BACKEND_TYPE_AWS_KINESIS BackendType = 20 ) -var BackendType_name = map[int32]string{ - 0: "BACKEND_TYPE_UNSET", - 1: "BACKEND_TYPE_KAFKA", - 2: "BACKEND_TYPE_RABBIT", - 3: "BACKEND_TYPE_RABBIT_STREAMS", - 4: "BACKEND_TYPE_NSQ", - 5: "BACKEND_TYPE_NATS", - 6: "BACKEND_TYPE_NATS_STREAMING", - 7: "BACKEND_TYPE_GCP_PUBSUB", - 8: "BACKEND_TYPE_AZURE_SERVICE_BUS", - 9: "BACKEND_TYPE_AZURE_EVENT_HUB", - 10: "BACKEND_TYPE_AWS_SQS", - 11: "BACKEND_TYPE_AWS_SNS", - 12: "BACKEND_TYPE_REDIS_PUBSUB", - 13: "BACKEND_TYPE_REDIS_STREAMS", - 14: "BACKEND_TYPE_ACTIVEMQ", - 15: "BACKEND_TYPE_PULSAR", - 16: "BACKEND_TYPE_MQTT", - 17: "BACKEND_TYPE_POSTGRES_CDC", - 18: "BACKEND_TYPE_MONGODB_CDC", - 19: "BACKEND_TYPE_KUBE_MQ", - 20: "BACKEND_TYPE_AWS_KINESIS", -} +// Enum value maps for BackendType. +var ( + BackendType_name = map[int32]string{ + 0: "BACKEND_TYPE_UNSET", + 1: "BACKEND_TYPE_KAFKA", + 2: "BACKEND_TYPE_RABBIT", + 3: "BACKEND_TYPE_RABBIT_STREAMS", + 4: "BACKEND_TYPE_NSQ", + 5: "BACKEND_TYPE_NATS", + 6: "BACKEND_TYPE_NATS_STREAMING", + 7: "BACKEND_TYPE_GCP_PUBSUB", + 8: "BACKEND_TYPE_AZURE_SERVICE_BUS", + 9: "BACKEND_TYPE_AZURE_EVENT_HUB", + 10: "BACKEND_TYPE_AWS_SQS", + 11: "BACKEND_TYPE_AWS_SNS", + 12: "BACKEND_TYPE_REDIS_PUBSUB", + 13: "BACKEND_TYPE_REDIS_STREAMS", + 14: "BACKEND_TYPE_ACTIVEMQ", + 15: "BACKEND_TYPE_PULSAR", + 16: "BACKEND_TYPE_MQTT", + 17: "BACKEND_TYPE_POSTGRES_CDC", + 18: "BACKEND_TYPE_MONGODB_CDC", + 19: "BACKEND_TYPE_KUBE_MQ", + 20: "BACKEND_TYPE_AWS_KINESIS", + } + BackendType_value = map[string]int32{ + "BACKEND_TYPE_UNSET": 0, + "BACKEND_TYPE_KAFKA": 1, + "BACKEND_TYPE_RABBIT": 2, + "BACKEND_TYPE_RABBIT_STREAMS": 3, + "BACKEND_TYPE_NSQ": 4, + "BACKEND_TYPE_NATS": 5, + "BACKEND_TYPE_NATS_STREAMING": 6, + "BACKEND_TYPE_GCP_PUBSUB": 7, + "BACKEND_TYPE_AZURE_SERVICE_BUS": 8, + "BACKEND_TYPE_AZURE_EVENT_HUB": 9, + "BACKEND_TYPE_AWS_SQS": 10, + "BACKEND_TYPE_AWS_SNS": 11, + "BACKEND_TYPE_REDIS_PUBSUB": 12, + "BACKEND_TYPE_REDIS_STREAMS": 13, + "BACKEND_TYPE_ACTIVEMQ": 14, + "BACKEND_TYPE_PULSAR": 15, + "BACKEND_TYPE_MQTT": 16, + "BACKEND_TYPE_POSTGRES_CDC": 17, + "BACKEND_TYPE_MONGODB_CDC": 18, + "BACKEND_TYPE_KUBE_MQ": 19, + "BACKEND_TYPE_AWS_KINESIS": 20, + } +) -var BackendType_value = map[string]int32{ - "BACKEND_TYPE_UNSET": 0, - "BACKEND_TYPE_KAFKA": 1, - "BACKEND_TYPE_RABBIT": 2, - "BACKEND_TYPE_RABBIT_STREAMS": 3, - "BACKEND_TYPE_NSQ": 4, - "BACKEND_TYPE_NATS": 5, - "BACKEND_TYPE_NATS_STREAMING": 6, - "BACKEND_TYPE_GCP_PUBSUB": 7, - "BACKEND_TYPE_AZURE_SERVICE_BUS": 8, - "BACKEND_TYPE_AZURE_EVENT_HUB": 9, - "BACKEND_TYPE_AWS_SQS": 10, - "BACKEND_TYPE_AWS_SNS": 11, - "BACKEND_TYPE_REDIS_PUBSUB": 12, - "BACKEND_TYPE_REDIS_STREAMS": 13, - "BACKEND_TYPE_ACTIVEMQ": 14, - "BACKEND_TYPE_PULSAR": 15, - "BACKEND_TYPE_MQTT": 16, - "BACKEND_TYPE_POSTGRES_CDC": 17, - "BACKEND_TYPE_MONGODB_CDC": 18, - "BACKEND_TYPE_KUBE_MQ": 19, - "BACKEND_TYPE_AWS_KINESIS": 20, +func (x BackendType) Enum() *BackendType { + p := new(BackendType) + *p = x + return p } func (x BackendType) String() string { - return proto.EnumName(BackendType_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (BackendType) Descriptor() protoreflect.EnumDescriptor { + return file_ps_common_backends_proto_enumTypes[0].Descriptor() +} + +func (BackendType) Type() protoreflect.EnumType { + return &file_ps_common_backends_proto_enumTypes[0] } +func (x BackendType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use BackendType.Descriptor instead. func (BackendType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_b7390f38ee25065b, []int{0} + return file_ps_common_backends_proto_rawDescGZIP(), []int{0} +} + +var File_ps_common_backends_proto protoreflect.FileDescriptor + +var file_ps_common_backends_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x70, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x62, 0x61, 0x63, 0x6b, + 0x65, 0x6e, 0x64, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2a, 0xdb, 0x04, 0x0a, 0x0b, 0x42, 0x61, + 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x42, 0x41, 0x43, + 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x45, 0x54, 0x10, + 0x00, 0x12, 0x16, 0x0a, 0x12, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x4b, 0x41, 0x46, 0x4b, 0x41, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x42, 0x41, 0x43, + 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x52, 0x41, 0x42, 0x42, 0x49, 0x54, + 0x10, 0x02, 0x12, 0x1f, 0x0a, 0x1b, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x52, 0x41, 0x42, 0x42, 0x49, 0x54, 0x5f, 0x53, 0x54, 0x52, 0x45, 0x41, 0x4d, + 0x53, 0x10, 0x03, 0x12, 0x14, 0x0a, 0x10, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x4e, 0x53, 0x51, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x42, 0x41, 0x43, + 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4e, 0x41, 0x54, 0x53, 0x10, 0x05, + 0x12, 0x1f, 0x0a, 0x1b, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x4e, 0x41, 0x54, 0x53, 0x5f, 0x53, 0x54, 0x52, 0x45, 0x41, 0x4d, 0x49, 0x4e, 0x47, 0x10, + 0x06, 0x12, 0x1b, 0x0a, 0x17, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x47, 0x43, 0x50, 0x5f, 0x50, 0x55, 0x42, 0x53, 0x55, 0x42, 0x10, 0x07, 0x12, 0x22, + 0x0a, 0x1e, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x41, + 0x5a, 0x55, 0x52, 0x45, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x5f, 0x42, 0x55, 0x53, + 0x10, 0x08, 0x12, 0x20, 0x0a, 0x1c, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x41, 0x5a, 0x55, 0x52, 0x45, 0x5f, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x48, + 0x55, 0x42, 0x10, 0x09, 0x12, 0x18, 0x0a, 0x14, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x41, 0x57, 0x53, 0x5f, 0x53, 0x51, 0x53, 0x10, 0x0a, 0x12, 0x18, + 0x0a, 0x14, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x41, + 0x57, 0x53, 0x5f, 0x53, 0x4e, 0x53, 0x10, 0x0b, 0x12, 0x1d, 0x0a, 0x19, 0x42, 0x41, 0x43, 0x4b, + 0x45, 0x4e, 0x44, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x52, 0x45, 0x44, 0x49, 0x53, 0x5f, 0x50, + 0x55, 0x42, 0x53, 0x55, 0x42, 0x10, 0x0c, 0x12, 0x1e, 0x0a, 0x1a, 0x42, 0x41, 0x43, 0x4b, 0x45, + 0x4e, 0x44, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x52, 0x45, 0x44, 0x49, 0x53, 0x5f, 0x53, 0x54, + 0x52, 0x45, 0x41, 0x4d, 0x53, 0x10, 0x0d, 0x12, 0x19, 0x0a, 0x15, 0x42, 0x41, 0x43, 0x4b, 0x45, + 0x4e, 0x44, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x4d, 0x51, + 0x10, 0x0e, 0x12, 0x17, 0x0a, 0x13, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x50, 0x55, 0x4c, 0x53, 0x41, 0x52, 0x10, 0x0f, 0x12, 0x15, 0x0a, 0x11, 0x42, + 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x51, 0x54, 0x54, + 0x10, 0x10, 0x12, 0x1d, 0x0a, 0x19, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x50, 0x4f, 0x53, 0x54, 0x47, 0x52, 0x45, 0x53, 0x5f, 0x43, 0x44, 0x43, 0x10, + 0x11, 0x12, 0x1c, 0x0a, 0x18, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x4d, 0x4f, 0x4e, 0x47, 0x4f, 0x44, 0x42, 0x5f, 0x43, 0x44, 0x43, 0x10, 0x12, 0x12, + 0x18, 0x0a, 0x14, 0x42, 0x41, 0x43, 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x4b, 0x55, 0x42, 0x45, 0x5f, 0x4d, 0x51, 0x10, 0x13, 0x12, 0x1c, 0x0a, 0x18, 0x42, 0x41, 0x43, + 0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x41, 0x57, 0x53, 0x5f, 0x4b, 0x49, + 0x4e, 0x45, 0x53, 0x49, 0x53, 0x10, 0x14, 0x42, 0x3d, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, + 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, + 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func init() { - proto.RegisterEnum("protos.common.BackendType", BackendType_name, BackendType_value) +var ( + file_ps_common_backends_proto_rawDescOnce sync.Once + file_ps_common_backends_proto_rawDescData = file_ps_common_backends_proto_rawDesc +) + +func file_ps_common_backends_proto_rawDescGZIP() []byte { + file_ps_common_backends_proto_rawDescOnce.Do(func() { + file_ps_common_backends_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_common_backends_proto_rawDescData) + }) + return file_ps_common_backends_proto_rawDescData +} + +var file_ps_common_backends_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_ps_common_backends_proto_goTypes = []interface{}{ + (BackendType)(0), // 0: protos.common.BackendType +} +var file_ps_common_backends_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } -func init() { proto.RegisterFile("ps_common_backends.proto", fileDescriptor_b7390f38ee25065b) } - -var fileDescriptor_b7390f38ee25065b = []byte{ - // 390 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0xe5, 0xa3, 0x14, 0x98, 0x52, 0x98, 0x4e, 0x53, 0x9a, 0xd2, 0x52, 0x10, 0x47, 0x24, 0xea, - 0x03, 0x47, 0xc4, 0x61, 0xd7, 0x59, 0x82, 0x65, 0xb2, 0x71, 0x3c, 0xbb, 0x41, 0xf4, 0xb2, 0x8a, - 0xdd, 0xa8, 0xa9, 0x68, 0x6a, 0x2b, 0x4e, 0x0e, 0xfc, 0x56, 0xfe, 0x0c, 0x72, 0x4c, 0x0f, 0x2b, - 0xfb, 0xb4, 0xda, 0xf7, 0xde, 0x3c, 0xcd, 0x3c, 0x3d, 0xe8, 0x97, 0x95, 0xcb, 0x8b, 0xe5, 0xb2, - 0xb8, 0x73, 0xd9, 0x2c, 0xff, 0x3d, 0xbf, 0xbb, 0xaa, 0x2e, 0xca, 0x55, 0xb1, 0x2e, 0x68, 0x7f, - 0xfb, 0x54, 0x17, 0x0d, 0xfb, 0xf1, 0xef, 0x0e, 0xec, 0xc9, 0x46, 0x61, 0xfe, 0x94, 0x73, 0x7a, - 0x0d, 0x24, 0x45, 0x18, 0x2b, 0x3d, 0x70, 0xe6, 0x57, 0xa2, 0x9c, 0xd5, 0xac, 0x0c, 0x3e, 0x68, - 0xe1, 0xb1, 0xf8, 0x16, 0x0b, 0x7c, 0x48, 0xc7, 0x70, 0xe8, 0xe1, 0xa9, 0x90, 0x32, 0x32, 0xf8, - 0x88, 0xde, 0xc1, 0x69, 0x07, 0xe1, 0xd8, 0xa4, 0x4a, 0x8c, 0x18, 0x1f, 0x53, 0x0f, 0xd0, 0x13, - 0x68, 0x9e, 0xe0, 0x0e, 0x1d, 0xc1, 0x81, 0x8f, 0x0a, 0xc3, 0xf8, 0xa4, 0xe5, 0x56, 0xc3, 0xff, - 0xbd, 0x22, 0x3d, 0xc4, 0x5d, 0x3a, 0x85, 0x63, 0x4f, 0x30, 0x0c, 0x13, 0x97, 0x58, 0xc9, 0x56, - 0xe2, 0x53, 0xfa, 0x00, 0xe7, 0x1e, 0x29, 0x2e, 0x6d, 0xaa, 0x1c, 0xab, 0x74, 0x1a, 0x85, 0xca, - 0x49, 0xcb, 0xf8, 0x8c, 0xde, 0xc3, 0x59, 0x87, 0x46, 0x4d, 0x95, 0x36, 0xee, 0xbb, 0x95, 0xf8, - 0x9c, 0xfa, 0xd0, 0xf3, 0x15, 0x3f, 0xd9, 0xf1, 0x84, 0x11, 0xba, 0x19, 0xcd, 0xb8, 0x47, 0x6f, - 0xe1, 0xc4, 0x4f, 0x41, 0x0d, 0x22, 0xbe, 0x5f, 0xec, 0x05, 0x9d, 0xc3, 0x9b, 0x0e, 0xfa, 0x3e, - 0xa3, 0x7d, 0x3a, 0x81, 0x23, 0xdf, 0x38, 0x34, 0xd1, 0x54, 0x8d, 0x26, 0xf8, 0xb2, 0x15, 0x7c, - 0x62, 0x7f, 0xb0, 0x48, 0xf1, 0x55, 0x2b, 0xc1, 0xd1, 0xc4, 0x18, 0xc4, 0xd6, 0x26, 0xc9, 0x98, - 0xcd, 0x30, 0x55, 0xec, 0xc2, 0x41, 0x88, 0x07, 0x74, 0x06, 0x7d, 0x7f, 0x6a, 0xac, 0x87, 0xe3, - 0x81, 0xdc, 0xb2, 0xd4, 0x3a, 0x30, 0xb6, 0xb2, 0x36, 0xc6, 0xc3, 0xd6, 0x5c, 0x7d, 0x7a, 0x1c, - 0x69, 0xc5, 0x11, 0x63, 0x4f, 0x7e, 0xbd, 0xfc, 0x72, 0x7d, 0xb3, 0x5e, 0x6c, 0xb2, 0xba, 0x6e, - 0x41, 0x36, 0x5b, 0xe7, 0x8b, 0xbc, 0x58, 0x95, 0x41, 0x79, 0xbb, 0x59, 0x66, 0xf3, 0xd5, 0xa7, - 0x2a, 0x5f, 0xcc, 0x97, 0xb3, 0x2a, 0xc8, 0x36, 0x37, 0xb7, 0x57, 0xc1, 0x75, 0x11, 0x34, 0xe5, - 0x0c, 0x9a, 0x72, 0x66, 0xbb, 0xdb, 0xef, 0xe7, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x60, 0xc3, - 0x1b, 0x9e, 0xce, 0x02, 0x00, 0x00, +func init() { file_ps_common_backends_proto_init() } +func file_ps_common_backends_proto_init() { + if File_ps_common_backends_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_common_backends_proto_rawDesc, + NumEnums: 1, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_common_backends_proto_goTypes, + DependencyIndexes: file_ps_common_backends_proto_depIdxs, + EnumInfos: file_ps_common_backends_proto_enumTypes, + }.Build() + File_ps_common_backends_proto = out.File + file_ps_common_backends_proto_rawDesc = nil + file_ps_common_backends_proto_goTypes = nil + file_ps_common_backends_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/common/ps_common_status.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/common/ps_common_status.pb.go index 251c61955..97881f173 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/common/ps_common_status.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/common/ps_common_status.pb.go @@ -1,30 +1,29 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_common_status.proto package common import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) // https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto // // The canonical error codes for gRPC APIs. // -// // Sometimes multiple error codes may apply. Services should return // the most specific error code that applies. For example, prefer // `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply. @@ -106,15 +105,16 @@ const ( // // Service implementors can use the following guidelines to decide // between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: - // (a) Use `UNAVAILABLE` if the client can retry just the failing call. - // (b) Use `ABORTED` if the client should retry at a higher level - // (e.g., when a client-specified test-and-set fails, indicating the - // client should restart a read-modify-write sequence). - // (c) Use `FAILED_PRECONDITION` if the client should not retry until - // the system state has been explicitly fixed. E.g., if an "rmdir" - // fails because the directory is non-empty, `FAILED_PRECONDITION` - // should be returned since the client should not retry unless - // the files are deleted from the directory. + // + // (a) Use `UNAVAILABLE` if the client can retry just the failing call. + // (b) Use `ABORTED` if the client should retry at a higher level + // (e.g., when a client-specified test-and-set fails, indicating the + // client should restart a read-modify-write sequence). + // (c) Use `FAILED_PRECONDITION` if the client should not retry until + // the system state has been explicitly fixed. E.g., if an "rmdir" + // fails because the directory is non-empty, `FAILED_PRECONDITION` + // should be returned since the client should not retry unless + // the files are deleted from the directory. // // HTTP Mapping: 400 Bad Request Code_FAILED_PRECONDITION Code = 9 @@ -171,145 +171,242 @@ const ( Code_DATA_LOSS Code = 15 ) -var Code_name = map[int32]string{ - 0: "OK", - 1: "CANCELLED", - 2: "UNKNOWN", - 3: "INVALID_ARGUMENT", - 4: "DEADLINE_EXCEEDED", - 5: "NOT_FOUND", - 6: "ALREADY_EXISTS", - 7: "PERMISSION_DENIED", - 16: "UNAUTHENTICATED", - 8: "RESOURCE_EXHAUSTED", - 9: "FAILED_PRECONDITION", - 10: "ABORTED", - 11: "OUT_OF_RANGE", - 12: "UNIMPLEMENTED", - 13: "INTERNAL", - 14: "UNAVAILABLE", - 15: "DATA_LOSS", -} +// Enum value maps for Code. +var ( + Code_name = map[int32]string{ + 0: "OK", + 1: "CANCELLED", + 2: "UNKNOWN", + 3: "INVALID_ARGUMENT", + 4: "DEADLINE_EXCEEDED", + 5: "NOT_FOUND", + 6: "ALREADY_EXISTS", + 7: "PERMISSION_DENIED", + 16: "UNAUTHENTICATED", + 8: "RESOURCE_EXHAUSTED", + 9: "FAILED_PRECONDITION", + 10: "ABORTED", + 11: "OUT_OF_RANGE", + 12: "UNIMPLEMENTED", + 13: "INTERNAL", + 14: "UNAVAILABLE", + 15: "DATA_LOSS", + } + Code_value = map[string]int32{ + "OK": 0, + "CANCELLED": 1, + "UNKNOWN": 2, + "INVALID_ARGUMENT": 3, + "DEADLINE_EXCEEDED": 4, + "NOT_FOUND": 5, + "ALREADY_EXISTS": 6, + "PERMISSION_DENIED": 7, + "UNAUTHENTICATED": 16, + "RESOURCE_EXHAUSTED": 8, + "FAILED_PRECONDITION": 9, + "ABORTED": 10, + "OUT_OF_RANGE": 11, + "UNIMPLEMENTED": 12, + "INTERNAL": 13, + "UNAVAILABLE": 14, + "DATA_LOSS": 15, + } +) -var Code_value = map[string]int32{ - "OK": 0, - "CANCELLED": 1, - "UNKNOWN": 2, - "INVALID_ARGUMENT": 3, - "DEADLINE_EXCEEDED": 4, - "NOT_FOUND": 5, - "ALREADY_EXISTS": 6, - "PERMISSION_DENIED": 7, - "UNAUTHENTICATED": 16, - "RESOURCE_EXHAUSTED": 8, - "FAILED_PRECONDITION": 9, - "ABORTED": 10, - "OUT_OF_RANGE": 11, - "UNIMPLEMENTED": 12, - "INTERNAL": 13, - "UNAVAILABLE": 14, - "DATA_LOSS": 15, +func (x Code) Enum() *Code { + p := new(Code) + *p = x + return p } func (x Code) String() string { - return proto.EnumName(Code_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } +func (Code) Descriptor() protoreflect.EnumDescriptor { + return file_ps_common_status_proto_enumTypes[0].Descriptor() +} + +func (Code) Type() protoreflect.EnumType { + return &file_ps_common_status_proto_enumTypes[0] +} + +func (x Code) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Code.Descriptor instead. func (Code) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_296064714e5a036a, []int{0} + return file_ps_common_status_proto_rawDescGZIP(), []int{0} } type Status struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + Code Code `protobuf:"varint,1,opt,name=code,proto3,enum=protos.common.Code" json:"code,omitempty"` // Message containing status details Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` // Set by the backend (to enable troubleshooting) - RequestId string `protobuf:"bytes,3,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + RequestId string `protobuf:"bytes,3,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` } -func (m *Status) Reset() { *m = Status{} } -func (m *Status) String() string { return proto.CompactTextString(m) } -func (*Status) ProtoMessage() {} -func (*Status) Descriptor() ([]byte, []int) { - return fileDescriptor_296064714e5a036a, []int{0} +func (x *Status) Reset() { + *x = Status{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_common_status_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Status) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Status.Unmarshal(m, b) +func (x *Status) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Status) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Status.Marshal(b, m, deterministic) -} -func (m *Status) XXX_Merge(src proto.Message) { - xxx_messageInfo_Status.Merge(m, src) -} -func (m *Status) XXX_Size() int { - return xxx_messageInfo_Status.Size(m) -} -func (m *Status) XXX_DiscardUnknown() { - xxx_messageInfo_Status.DiscardUnknown(m) + +func (*Status) ProtoMessage() {} + +func (x *Status) ProtoReflect() protoreflect.Message { + mi := &file_ps_common_status_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_Status proto.InternalMessageInfo +// Deprecated: Use Status.ProtoReflect.Descriptor instead. +func (*Status) Descriptor() ([]byte, []int) { + return file_ps_common_status_proto_rawDescGZIP(), []int{0} +} -func (m *Status) GetCode() Code { - if m != nil { - return m.Code +func (x *Status) GetCode() Code { + if x != nil { + return x.Code } return Code_OK } -func (m *Status) GetMessage() string { - if m != nil { - return m.Message +func (x *Status) GetMessage() string { + if x != nil { + return x.Message } return "" } -func (m *Status) GetRequestId() string { - if m != nil { - return m.RequestId +func (x *Status) GetRequestId() string { + if x != nil { + return x.RequestId } return "" } -func init() { - proto.RegisterEnum("protos.common.Code", Code_name, Code_value) - proto.RegisterType((*Status)(nil), "protos.common.Status") +var File_ps_common_status_proto protoreflect.FileDescriptor + +var file_ps_common_status_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x70, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x22, 0x6a, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x27, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, + 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x49, 0x64, 0x2a, 0xb7, 0x02, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x06, 0x0a, 0x02, + 0x4f, 0x4b, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x4c, 0x45, + 0x44, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x02, + 0x12, 0x14, 0x0a, 0x10, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x41, 0x52, 0x47, 0x55, + 0x4d, 0x45, 0x4e, 0x54, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x44, 0x45, 0x41, 0x44, 0x4c, 0x49, + 0x4e, 0x45, 0x5f, 0x45, 0x58, 0x43, 0x45, 0x45, 0x44, 0x45, 0x44, 0x10, 0x04, 0x12, 0x0d, 0x0a, + 0x09, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x05, 0x12, 0x12, 0x0a, 0x0e, + 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, 0x59, 0x5f, 0x45, 0x58, 0x49, 0x53, 0x54, 0x53, 0x10, 0x06, + 0x12, 0x15, 0x0a, 0x11, 0x50, 0x45, 0x52, 0x4d, 0x49, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x44, + 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x07, 0x12, 0x13, 0x0a, 0x0f, 0x55, 0x4e, 0x41, 0x55, 0x54, + 0x48, 0x45, 0x4e, 0x54, 0x49, 0x43, 0x41, 0x54, 0x45, 0x44, 0x10, 0x10, 0x12, 0x16, 0x0a, 0x12, + 0x52, 0x45, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x45, 0x58, 0x48, 0x41, 0x55, 0x53, 0x54, + 0x45, 0x44, 0x10, 0x08, 0x12, 0x17, 0x0a, 0x13, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x5f, 0x50, + 0x52, 0x45, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x09, 0x12, 0x0b, 0x0a, + 0x07, 0x41, 0x42, 0x4f, 0x52, 0x54, 0x45, 0x44, 0x10, 0x0a, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x55, + 0x54, 0x5f, 0x4f, 0x46, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x0b, 0x12, 0x11, 0x0a, 0x0d, + 0x55, 0x4e, 0x49, 0x4d, 0x50, 0x4c, 0x45, 0x4d, 0x45, 0x4e, 0x54, 0x45, 0x44, 0x10, 0x0c, 0x12, + 0x0c, 0x0a, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x0d, 0x12, 0x0f, 0x0a, + 0x0b, 0x55, 0x4e, 0x41, 0x56, 0x41, 0x49, 0x4c, 0x41, 0x42, 0x4c, 0x45, 0x10, 0x0e, 0x12, 0x0d, + 0x0a, 0x09, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x4c, 0x4f, 0x53, 0x53, 0x10, 0x0f, 0x42, 0x3d, 0x5a, + 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, + 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } -func init() { proto.RegisterFile("ps_common_status.proto", fileDescriptor_296064714e5a036a) } +var ( + file_ps_common_status_proto_rawDescOnce sync.Once + file_ps_common_status_proto_rawDescData = file_ps_common_status_proto_rawDesc +) + +func file_ps_common_status_proto_rawDescGZIP() []byte { + file_ps_common_status_proto_rawDescOnce.Do(func() { + file_ps_common_status_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_common_status_proto_rawDescData) + }) + return file_ps_common_status_proto_rawDescData +} + +var file_ps_common_status_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_ps_common_status_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_ps_common_status_proto_goTypes = []interface{}{ + (Code)(0), // 0: protos.common.Code + (*Status)(nil), // 1: protos.common.Status +} +var file_ps_common_status_proto_depIdxs = []int32{ + 0, // 0: protos.common.Status.code:type_name -> protos.common.Code + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} -var fileDescriptor_296064714e5a036a = []byte{ - // 430 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x51, 0x4b, 0x6f, 0x13, 0x3d, - 0x14, 0xfd, 0x92, 0xe6, 0x4b, 0x9a, 0x9b, 0x97, 0xeb, 0x40, 0xc9, 0x06, 0xa9, 0x62, 0x43, 0x85, - 0x44, 0x46, 0x82, 0x25, 0x62, 0xe1, 0x8c, 0x6f, 0x5a, 0xab, 0xce, 0x75, 0xe4, 0x19, 0x97, 0xc2, - 0xc6, 0xca, 0x63, 0x94, 0x04, 0x35, 0x4c, 0xc8, 0x4c, 0x7e, 0x1b, 0x7f, 0x0f, 0x79, 0x02, 0x0b, - 0x56, 0xd6, 0x79, 0xf8, 0xd8, 0x47, 0x07, 0xae, 0x0f, 0x85, 0x5f, 0xe5, 0xfb, 0x7d, 0xfe, 0xc3, - 0x17, 0xe5, 0xa2, 0x3c, 0x15, 0xe3, 0xc3, 0x31, 0x2f, 0x73, 0xde, 0xab, 0x8e, 0x62, 0x7c, 0xd6, - 0xde, 0x7c, 0x87, 0x66, 0x52, 0xc9, 0xfc, 0x2d, 0x34, 0x56, 0xf9, 0x3a, 0x1b, 0xd5, 0x6e, 0x6a, - 0xb7, 0xfd, 0x0f, 0xc3, 0xf1, 0x3f, 0xbe, 0x71, 0x9c, 0xaf, 0x33, 0x5b, 0x19, 0xf8, 0x08, 0x5a, - 0xfb, 0xac, 0x28, 0x16, 0x9b, 0x6c, 0x54, 0xbf, 0xa9, 0xdd, 0xb6, 0xed, 0x5f, 0xc8, 0x5f, 0x03, - 0x1c, 0xb3, 0x9f, 0xa7, 0xac, 0x28, 0xfd, 0x6e, 0x3d, 0xba, 0xa8, 0xc4, 0xf6, 0x1f, 0x46, 0xad, - 0xdf, 0xfd, 0xaa, 0x43, 0x23, 0xe4, 0xf0, 0x26, 0xd4, 0xcd, 0x03, 0xfb, 0x8f, 0xf7, 0xa0, 0x1d, - 0x0b, 0x8a, 0x51, 0x6b, 0x94, 0xac, 0xc6, 0x3b, 0xd0, 0x72, 0xf4, 0x40, 0xe6, 0x0b, 0xb1, 0x3a, - 0x7f, 0x01, 0x4c, 0xd1, 0xa3, 0xd0, 0x4a, 0x7a, 0x61, 0xef, 0xdc, 0x0c, 0x29, 0x65, 0x17, 0xfc, - 0x25, 0x5c, 0x49, 0x14, 0x52, 0x2b, 0x42, 0x8f, 0x4f, 0x31, 0xa2, 0x44, 0xc9, 0x1a, 0x21, 0x88, - 0x4c, 0xea, 0xa7, 0xc6, 0x91, 0x64, 0xff, 0x73, 0x0e, 0x7d, 0xa1, 0x2d, 0x0a, 0xf9, 0xd5, 0xe3, - 0x93, 0x4a, 0xd2, 0x84, 0x35, 0xc3, 0xcd, 0x39, 0xda, 0x99, 0x4a, 0x12, 0x65, 0xc8, 0x4b, 0x24, - 0x85, 0x92, 0xb5, 0xf8, 0x10, 0x06, 0x8e, 0x84, 0x4b, 0xef, 0x91, 0x52, 0x15, 0x8b, 0x14, 0x25, - 0x63, 0xfc, 0x1a, 0xb8, 0xc5, 0xc4, 0x38, 0x1b, 0x87, 0x57, 0xee, 0x85, 0x4b, 0x02, 0x7f, 0xc9, - 0x5f, 0xc1, 0x70, 0x2a, 0x94, 0x46, 0xe9, 0xe7, 0x16, 0x63, 0x43, 0x52, 0xa5, 0xca, 0x10, 0x6b, - 0x87, 0x9f, 0x8b, 0x89, 0xb1, 0xc1, 0x05, 0x9c, 0x41, 0xd7, 0xb8, 0xd4, 0x9b, 0xa9, 0xb7, 0x82, - 0xee, 0x90, 0x75, 0xf8, 0x15, 0xf4, 0x1c, 0xa9, 0xd9, 0x5c, 0x63, 0xa8, 0x81, 0x92, 0x75, 0x79, - 0x17, 0x2e, 0x15, 0xa5, 0x68, 0x49, 0x68, 0xd6, 0xe3, 0x03, 0xe8, 0x38, 0x12, 0x8f, 0x42, 0x69, - 0x31, 0xd1, 0xc8, 0xfa, 0xa1, 0x90, 0x14, 0xa9, 0xf0, 0xda, 0x24, 0x09, 0x1b, 0x4c, 0x3e, 0x7f, - 0xfb, 0xb4, 0xd9, 0x95, 0xdb, 0xd3, 0x32, 0xcc, 0x11, 0x2d, 0x17, 0xe5, 0x6a, 0xbb, 0xca, 0x8f, - 0x87, 0xe8, 0xf0, 0x7c, 0xda, 0x2f, 0xb3, 0xe3, 0xfb, 0x62, 0xb5, 0xcd, 0xf6, 0x8b, 0x22, 0x5a, - 0x9e, 0x76, 0xcf, 0xeb, 0x68, 0x93, 0x47, 0xe7, 0xf1, 0xa2, 0xf3, 0x78, 0xcb, 0x66, 0x05, 0x3f, - 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x88, 0x00, 0x88, 0x70, 0x14, 0x02, 0x00, 0x00, +func init() { file_ps_common_status_proto_init() } +func file_ps_common_status_proto_init() { + if File_ps_common_status_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_common_status_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Status); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_common_status_proto_rawDesc, + NumEnums: 1, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_common_status_proto_goTypes, + DependencyIndexes: file_ps_common_status_proto_depIdxs, + EnumInfos: file_ps_common_status_proto_enumTypes, + MessageInfos: file_ps_common_status_proto_msgTypes, + }.Build() + File_ps_common_status_proto = out.File + file_ps_common_status_proto_rawDesc = nil + file_ps_common_status_proto_goTypes = nil + file_ps_common_status_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/common/ps_common_validation.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/common/ps_common_validation.pb.go index e49dcada1..827585b54 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/common/ps_common_validation.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/common/ps_common_validation.pb.go @@ -1,161 +1,253 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_common_validation.proto package common import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type Validation struct { - XId string `protobuf:"bytes,1,opt,name=_id,json=Id,proto3" json:"_id,omitempty"` - SchemaId string `protobuf:"bytes,2,opt,name=schema_id,json=schemaId,proto3" json:"schema_id,omitempty"` - Fields []*Validation_Field `protobuf:"bytes,3,rep,name=fields,proto3" json:"fields,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *Validation) Reset() { *m = Validation{} } -func (m *Validation) String() string { return proto.CompactTextString(m) } -func (*Validation) ProtoMessage() {} -func (*Validation) Descriptor() ([]byte, []int) { - return fileDescriptor_fa078415ce86cb5b, []int{0} + XId string `protobuf:"bytes,1,opt,name=_id,json=Id,proto3" json:"_id,omitempty"` + SchemaId string `protobuf:"bytes,2,opt,name=schema_id,json=schemaId,proto3" json:"schema_id,omitempty"` + Fields []*Validation_Field `protobuf:"bytes,3,rep,name=fields,proto3" json:"fields,omitempty"` } -func (m *Validation) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Validation.Unmarshal(m, b) -} -func (m *Validation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Validation.Marshal(b, m, deterministic) -} -func (m *Validation) XXX_Merge(src proto.Message) { - xxx_messageInfo_Validation.Merge(m, src) +func (x *Validation) Reset() { + *x = Validation{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_common_validation_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Validation) XXX_Size() int { - return xxx_messageInfo_Validation.Size(m) + +func (x *Validation) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Validation) XXX_DiscardUnknown() { - xxx_messageInfo_Validation.DiscardUnknown(m) + +func (*Validation) ProtoMessage() {} + +func (x *Validation) ProtoReflect() protoreflect.Message { + mi := &file_ps_common_validation_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_Validation proto.InternalMessageInfo +// Deprecated: Use Validation.ProtoReflect.Descriptor instead. +func (*Validation) Descriptor() ([]byte, []int) { + return file_ps_common_validation_proto_rawDescGZIP(), []int{0} +} -func (m *Validation) GetXId() string { - if m != nil { - return m.XId +func (x *Validation) GetXId() string { + if x != nil { + return x.XId } return "" } -func (m *Validation) GetSchemaId() string { - if m != nil { - return m.SchemaId +func (x *Validation) GetSchemaId() string { + if x != nil { + return x.SchemaId } return "" } -func (m *Validation) GetFields() []*Validation_Field { - if m != nil { - return m.Fields +func (x *Validation) GetFields() []*Validation_Field { + if x != nil { + return x.Fields } return nil } type Validation_Field struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // path in our jsonquery filter syntax Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` // https://github.com/batchcorp/lucene2x/blob/55f43862dfc294d5594758cba6a5c0ba088c0040/jsonquery/validate.go#L22 ValidationType string `protobuf:"bytes,2,opt,name=validation_type,json=validationType,proto3" json:"validation_type,omitempty"` // For Regex / HasPrefix / HasSuffix / StringContains validation types only. Ignored for all others - MatchValue string `protobuf:"bytes,3,opt,name=match_value,json=matchValue,proto3" json:"match_value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + MatchValue string `protobuf:"bytes,3,opt,name=match_value,json=matchValue,proto3" json:"match_value,omitempty"` } -func (m *Validation_Field) Reset() { *m = Validation_Field{} } -func (m *Validation_Field) String() string { return proto.CompactTextString(m) } -func (*Validation_Field) ProtoMessage() {} -func (*Validation_Field) Descriptor() ([]byte, []int) { - return fileDescriptor_fa078415ce86cb5b, []int{0, 0} +func (x *Validation_Field) Reset() { + *x = Validation_Field{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_common_validation_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Validation_Field) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Validation_Field.Unmarshal(m, b) -} -func (m *Validation_Field) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Validation_Field.Marshal(b, m, deterministic) +func (x *Validation_Field) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Validation_Field) XXX_Merge(src proto.Message) { - xxx_messageInfo_Validation_Field.Merge(m, src) -} -func (m *Validation_Field) XXX_Size() int { - return xxx_messageInfo_Validation_Field.Size(m) -} -func (m *Validation_Field) XXX_DiscardUnknown() { - xxx_messageInfo_Validation_Field.DiscardUnknown(m) + +func (*Validation_Field) ProtoMessage() {} + +func (x *Validation_Field) ProtoReflect() protoreflect.Message { + mi := &file_ps_common_validation_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_Validation_Field proto.InternalMessageInfo +// Deprecated: Use Validation_Field.ProtoReflect.Descriptor instead. +func (*Validation_Field) Descriptor() ([]byte, []int) { + return file_ps_common_validation_proto_rawDescGZIP(), []int{0, 0} +} -func (m *Validation_Field) GetPath() string { - if m != nil { - return m.Path +func (x *Validation_Field) GetPath() string { + if x != nil { + return x.Path } return "" } -func (m *Validation_Field) GetValidationType() string { - if m != nil { - return m.ValidationType +func (x *Validation_Field) GetValidationType() string { + if x != nil { + return x.ValidationType } return "" } -func (m *Validation_Field) GetMatchValue() string { - if m != nil { - return m.MatchValue +func (x *Validation_Field) GetMatchValue() string { + if x != nil { + return x.MatchValue } return "" } -func init() { - proto.RegisterType((*Validation)(nil), "protos.common.Validation") - proto.RegisterType((*Validation_Field)(nil), "protos.common.Validation.Field") -} - -func init() { proto.RegisterFile("ps_common_validation.proto", fileDescriptor_fa078415ce86cb5b) } - -var fileDescriptor_fa078415ce86cb5b = []byte{ - // 246 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x8f, 0x31, 0x4b, 0x03, 0x31, - 0x14, 0xc7, 0xb9, 0x9e, 0x16, 0xfb, 0x8a, 0x16, 0xde, 0x74, 0xd4, 0xa1, 0xc5, 0xc5, 0x2e, 0x26, - 0xa0, 0x83, 0x83, 0xb8, 0x38, 0x08, 0x5d, 0x8b, 0x74, 0x70, 0x39, 0x92, 0x4b, 0xec, 0x05, 0x2e, - 0x4d, 0xb8, 0x24, 0xc2, 0x7d, 0x55, 0x3f, 0x8d, 0x24, 0x39, 0x3c, 0x9c, 0x92, 0xf7, 0x7b, 0x7f, - 0xde, 0xfb, 0x3d, 0x58, 0x5b, 0x57, 0x37, 0x46, 0x6b, 0x73, 0xae, 0xbf, 0x59, 0xa7, 0x04, 0xf3, - 0xca, 0x9c, 0x89, 0xed, 0x8d, 0x37, 0x78, 0x9d, 0x1e, 0x47, 0x72, 0xff, 0xee, 0xa7, 0x00, 0x38, - 0xfe, 0x65, 0x70, 0x05, 0x65, 0xad, 0x44, 0x55, 0x6c, 0x8b, 0xdd, 0xe2, 0x30, 0xdb, 0x0b, 0xbc, - 0x85, 0x85, 0x6b, 0x5a, 0xa9, 0x59, 0xc4, 0xb3, 0x84, 0xaf, 0x32, 0xd8, 0x0b, 0x7c, 0x86, 0xf9, - 0x97, 0x92, 0x9d, 0x70, 0x55, 0xb9, 0x2d, 0x77, 0xcb, 0xc7, 0x0d, 0xf9, 0x37, 0x9c, 0x4c, 0x83, - 0xc9, 0x7b, 0xcc, 0x1d, 0xc6, 0xf8, 0x5a, 0xc2, 0x65, 0x02, 0x88, 0x70, 0x61, 0x99, 0x6f, 0xc7, - 0x85, 0xe9, 0x8f, 0xf7, 0xb0, 0x9a, 0xac, 0x6b, 0x3f, 0x58, 0x39, 0x2e, 0xbe, 0x99, 0xf0, 0xc7, - 0x60, 0x25, 0x6e, 0x60, 0xa9, 0x99, 0x6f, 0xda, 0x78, 0x64, 0x90, 0x55, 0x99, 0x42, 0x90, 0xd0, - 0x31, 0x92, 0xb7, 0xd7, 0xcf, 0x97, 0x93, 0xf2, 0x6d, 0xe0, 0x51, 0x88, 0xf2, 0xd8, 0x68, 0x4c, - 0x6f, 0xa9, 0xed, 0x82, 0xe6, 0xb2, 0x7f, 0xc8, 0x87, 0x38, 0xca, 0x83, 0xea, 0x04, 0x3d, 0x19, - 0x9a, 0xf5, 0x69, 0xd6, 0xe7, 0xf3, 0x54, 0x3e, 0xfd, 0x06, 0x00, 0x00, 0xff, 0xff, 0x4f, 0x09, - 0x7c, 0xd8, 0x4f, 0x01, 0x00, 0x00, +var File_ps_common_validation_proto protoreflect.FileDescriptor + +var file_ps_common_validation_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x70, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x22, 0xda, 0x01, 0x0a, 0x0a, + 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x0a, 0x03, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x73, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x49, 0x64, 0x12, 0x37, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x73, 0x1a, 0x65, 0x0a, 0x05, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, + 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x27, + 0x0a, 0x0f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x61, 0x74, 0x63, 0x68, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x61, + 0x74, 0x63, 0x68, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x3d, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, + 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, + 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ps_common_validation_proto_rawDescOnce sync.Once + file_ps_common_validation_proto_rawDescData = file_ps_common_validation_proto_rawDesc +) + +func file_ps_common_validation_proto_rawDescGZIP() []byte { + file_ps_common_validation_proto_rawDescOnce.Do(func() { + file_ps_common_validation_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_common_validation_proto_rawDescData) + }) + return file_ps_common_validation_proto_rawDescData +} + +var file_ps_common_validation_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_ps_common_validation_proto_goTypes = []interface{}{ + (*Validation)(nil), // 0: protos.common.Validation + (*Validation_Field)(nil), // 1: protos.common.Validation.Field +} +var file_ps_common_validation_proto_depIdxs = []int32{ + 1, // 0: protos.common.Validation.fields:type_name -> protos.common.Validation.Field + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_ps_common_validation_proto_init() } +func file_ps_common_validation_proto_init() { + if File_ps_common_validation_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_common_validation_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Validation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_common_validation_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Validation_Field); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_common_validation_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_common_validation_proto_goTypes, + DependencyIndexes: file_ps_common_validation_proto_depIdxs, + MessageInfos: file_ps_common_validation_proto_msgTypes, + }.Build() + File_ps_common_validation_proto = out.File + file_ps_common_validation_proto_rawDesc = nil + file_ps_common_validation_proto_goTypes = nil + file_ps_common_validation_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/encoding/ps_encoding_options.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/encoding/ps_encoding_options.pb.go index 3903f34eb..955493ef8 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/encoding/ps_encoding_options.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/encoding/ps_encoding_options.pb.go @@ -1,24 +1,28 @@ +// The encoding proto schema is intended to be used for either encoding or +// decoding. The intent of whether to encode or decode should be specified +// somewhere outside of this proto. + // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_encoding_options.proto package encoding import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type EncodeType int32 @@ -29,26 +33,47 @@ const ( EncodeType_ENCODE_TYPE_CLOUDEVENT EncodeType = 3 ) -var EncodeType_name = map[int32]string{ - 0: "ENCODE_TYPE_UNSET", - 1: "ENCODE_TYPE_JSONPB", - 2: "ENCODE_TYPE_AVRO", - 3: "ENCODE_TYPE_CLOUDEVENT", -} +// Enum value maps for EncodeType. +var ( + EncodeType_name = map[int32]string{ + 0: "ENCODE_TYPE_UNSET", + 1: "ENCODE_TYPE_JSONPB", + 2: "ENCODE_TYPE_AVRO", + 3: "ENCODE_TYPE_CLOUDEVENT", + } + EncodeType_value = map[string]int32{ + "ENCODE_TYPE_UNSET": 0, + "ENCODE_TYPE_JSONPB": 1, + "ENCODE_TYPE_AVRO": 2, + "ENCODE_TYPE_CLOUDEVENT": 3, + } +) -var EncodeType_value = map[string]int32{ - "ENCODE_TYPE_UNSET": 0, - "ENCODE_TYPE_JSONPB": 1, - "ENCODE_TYPE_AVRO": 2, - "ENCODE_TYPE_CLOUDEVENT": 3, +func (x EncodeType) Enum() *EncodeType { + p := new(EncodeType) + *p = x + return p } func (x EncodeType) String() string { - return proto.EnumName(EncodeType_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } +func (EncodeType) Descriptor() protoreflect.EnumDescriptor { + return file_ps_encoding_options_proto_enumTypes[0].Descriptor() +} + +func (EncodeType) Type() protoreflect.EnumType { + return &file_ps_encoding_options_proto_enumTypes[0] +} + +func (x EncodeType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use EncodeType.Descriptor instead. func (EncodeType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_b8f6b0c5cf15b9fa, []int{0} + return file_ps_encoding_options_proto_rawDescGZIP(), []int{0} } type DecodeType int32 @@ -61,28 +86,49 @@ const ( DecodeType_DECODE_TYPE_FLATBUFFER DecodeType = 4 ) -var DecodeType_name = map[int32]string{ - 0: "DECODE_TYPE_UNSET", - 1: "DECODE_TYPE_PROTOBUF", - 2: "DECODE_TYPE_AVRO", - 3: "DECODE_TYPE_THRIFT", - 4: "DECODE_TYPE_FLATBUFFER", -} +// Enum value maps for DecodeType. +var ( + DecodeType_name = map[int32]string{ + 0: "DECODE_TYPE_UNSET", + 1: "DECODE_TYPE_PROTOBUF", + 2: "DECODE_TYPE_AVRO", + 3: "DECODE_TYPE_THRIFT", + 4: "DECODE_TYPE_FLATBUFFER", + } + DecodeType_value = map[string]int32{ + "DECODE_TYPE_UNSET": 0, + "DECODE_TYPE_PROTOBUF": 1, + "DECODE_TYPE_AVRO": 2, + "DECODE_TYPE_THRIFT": 3, + "DECODE_TYPE_FLATBUFFER": 4, + } +) -var DecodeType_value = map[string]int32{ - "DECODE_TYPE_UNSET": 0, - "DECODE_TYPE_PROTOBUF": 1, - "DECODE_TYPE_AVRO": 2, - "DECODE_TYPE_THRIFT": 3, - "DECODE_TYPE_FLATBUFFER": 4, +func (x DecodeType) Enum() *DecodeType { + p := new(DecodeType) + *p = x + return p } func (x DecodeType) String() string { - return proto.EnumName(DecodeType_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (DecodeType) Descriptor() protoreflect.EnumDescriptor { + return file_ps_encoding_options_proto_enumTypes[1].Descriptor() +} + +func (DecodeType) Type() protoreflect.EnumType { + return &file_ps_encoding_options_proto_enumTypes[1] } +func (x DecodeType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use DecodeType.Descriptor instead. func (DecodeType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_b8f6b0c5cf15b9fa, []int{1} + return file_ps_encoding_options_proto_rawDescGZIP(), []int{1} } type EnvelopeType int32 @@ -93,27 +139,52 @@ const ( EnvelopeType_ENVELOPE_TYPE_SHALLOW EnvelopeType = 2 ) -var EnvelopeType_name = map[int32]string{ - 0: "ENVELOPE_TYPE_UNSET", - 1: "ENVELOPE_TYPE_DEEP", - 2: "ENVELOPE_TYPE_SHALLOW", -} +// Enum value maps for EnvelopeType. +var ( + EnvelopeType_name = map[int32]string{ + 0: "ENVELOPE_TYPE_UNSET", + 1: "ENVELOPE_TYPE_DEEP", + 2: "ENVELOPE_TYPE_SHALLOW", + } + EnvelopeType_value = map[string]int32{ + "ENVELOPE_TYPE_UNSET": 0, + "ENVELOPE_TYPE_DEEP": 1, + "ENVELOPE_TYPE_SHALLOW": 2, + } +) -var EnvelopeType_value = map[string]int32{ - "ENVELOPE_TYPE_UNSET": 0, - "ENVELOPE_TYPE_DEEP": 1, - "ENVELOPE_TYPE_SHALLOW": 2, +func (x EnvelopeType) Enum() *EnvelopeType { + p := new(EnvelopeType) + *p = x + return p } func (x EnvelopeType) String() string { - return proto.EnumName(EnvelopeType_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (EnvelopeType) Descriptor() protoreflect.EnumDescriptor { + return file_ps_encoding_options_proto_enumTypes[2].Descriptor() +} + +func (EnvelopeType) Type() protoreflect.EnumType { + return &file_ps_encoding_options_proto_enumTypes[2] +} + +func (x EnvelopeType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) } +// Deprecated: Use EnvelopeType.Descriptor instead. func (EnvelopeType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_b8f6b0c5cf15b9fa, []int{2} + return file_ps_encoding_options_proto_rawDescGZIP(), []int{2} } type ProtobufSettings struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Input message(s) should be encoded with this message envelope'" ProtobufRootMessage string `protobuf:"bytes,1,opt,name=protobuf_root_message,json=protobufRootMessage,proto3" json:"protobuf_root_message,omitempty" kong:"help='Input message(s) should be encoded with this message envelope'"` // Desktop/server should not use this. @@ -138,249 +209,281 @@ type ProtobufSettings struct { // @gotags: kong:"-" XShallowEnvelopeMessageDescriptor []byte `protobuf:"bytes,9,opt,name=_shallow_envelope_message_descriptor,json=ShallowEnvelopeMessageDescriptor,proto3" json:"_shallow_envelope_message_descriptor,omitempty" kong:"-"` // @gotags: kong:"help='Protobuf descriptor set(.protoset or .fds file)'" - ProtobufDescriptorSet string `protobuf:"bytes,10,opt,name=protobuf_descriptor_set,json=protobufDescriptorSet,proto3" json:"protobuf_descriptor_set,omitempty" kong:"help='Protobuf descriptor set(.protoset or .fds file)'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ProtobufDescriptorSet string `protobuf:"bytes,10,opt,name=protobuf_descriptor_set,json=protobufDescriptorSet,proto3" json:"protobuf_descriptor_set,omitempty" kong:"help='Protobuf descriptor set(.protoset or .fds file)'"` } -func (m *ProtobufSettings) Reset() { *m = ProtobufSettings{} } -func (m *ProtobufSettings) String() string { return proto.CompactTextString(m) } -func (*ProtobufSettings) ProtoMessage() {} -func (*ProtobufSettings) Descriptor() ([]byte, []int) { - return fileDescriptor_b8f6b0c5cf15b9fa, []int{0} +func (x *ProtobufSettings) Reset() { + *x = ProtobufSettings{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_encoding_options_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ProtobufSettings) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ProtobufSettings.Unmarshal(m, b) +func (x *ProtobufSettings) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ProtobufSettings) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ProtobufSettings.Marshal(b, m, deterministic) -} -func (m *ProtobufSettings) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProtobufSettings.Merge(m, src) -} -func (m *ProtobufSettings) XXX_Size() int { - return xxx_messageInfo_ProtobufSettings.Size(m) -} -func (m *ProtobufSettings) XXX_DiscardUnknown() { - xxx_messageInfo_ProtobufSettings.DiscardUnknown(m) + +func (*ProtobufSettings) ProtoMessage() {} + +func (x *ProtobufSettings) ProtoReflect() protoreflect.Message { + mi := &file_ps_encoding_options_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ProtobufSettings proto.InternalMessageInfo +// Deprecated: Use ProtobufSettings.ProtoReflect.Descriptor instead. +func (*ProtobufSettings) Descriptor() ([]byte, []int) { + return file_ps_encoding_options_proto_rawDescGZIP(), []int{0} +} -func (m *ProtobufSettings) GetProtobufRootMessage() string { - if m != nil { - return m.ProtobufRootMessage +func (x *ProtobufSettings) GetProtobufRootMessage() string { + if x != nil { + return x.ProtobufRootMessage } return "" } -func (m *ProtobufSettings) GetProtobufDirs() []string { - if m != nil { - return m.ProtobufDirs +func (x *ProtobufSettings) GetProtobufDirs() []string { + if x != nil { + return x.ProtobufDirs } return nil } -func (m *ProtobufSettings) GetXProtobufRootDir() string { - if m != nil { - return m.XProtobufRootDir +func (x *ProtobufSettings) GetXProtobufRootDir() string { + if x != nil { + return x.XProtobufRootDir } return "" } -func (m *ProtobufSettings) GetArchive() []byte { - if m != nil { - return m.Archive +func (x *ProtobufSettings) GetArchive() []byte { + if x != nil { + return x.Archive } return nil } -func (m *ProtobufSettings) GetXMessageDescriptor() []byte { - if m != nil { - return m.XMessageDescriptor +func (x *ProtobufSettings) GetXMessageDescriptor() []byte { + if x != nil { + return x.XMessageDescriptor } return nil } -func (m *ProtobufSettings) GetProtobufEnvelopeType() EnvelopeType { - if m != nil { - return m.ProtobufEnvelopeType +func (x *ProtobufSettings) GetProtobufEnvelopeType() EnvelopeType { + if x != nil { + return x.ProtobufEnvelopeType } return EnvelopeType_ENVELOPE_TYPE_UNSET } -func (m *ProtobufSettings) GetShallowEnvelopeMessage() string { - if m != nil { - return m.ShallowEnvelopeMessage +func (x *ProtobufSettings) GetShallowEnvelopeMessage() string { + if x != nil { + return x.ShallowEnvelopeMessage } return "" } -func (m *ProtobufSettings) GetShallowEnvelopeFieldNumber() int32 { - if m != nil { - return m.ShallowEnvelopeFieldNumber +func (x *ProtobufSettings) GetShallowEnvelopeFieldNumber() int32 { + if x != nil { + return x.ShallowEnvelopeFieldNumber } return 0 } -func (m *ProtobufSettings) GetXShallowEnvelopeMessageDescriptor() []byte { - if m != nil { - return m.XShallowEnvelopeMessageDescriptor +func (x *ProtobufSettings) GetXShallowEnvelopeMessageDescriptor() []byte { + if x != nil { + return x.XShallowEnvelopeMessageDescriptor } return nil } -func (m *ProtobufSettings) GetProtobufDescriptorSet() string { - if m != nil { - return m.ProtobufDescriptorSet +func (x *ProtobufSettings) GetProtobufDescriptorSet() string { + if x != nil { + return x.ProtobufDescriptorSet } return "" } type AvroSettings struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Used by CLI; desktop should not set/use this. // @gotags: kong:"help='If encode-type is set to avro, must specify avro schema file',existingfile" AvroSchemaFile string `protobuf:"bytes,1,opt,name=avro_schema_file,json=avroSchemaFile,proto3" json:"avro_schema_file,omitempty" kong:"help='If encode-type is set to avro, must specify avro schema file',existingfile"` // Used by desktop; CLI should not set/use this. // @gotags: kong:"-" - Schema []byte `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty" kong:"-"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Schema []byte `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty" kong:"-"` } -func (m *AvroSettings) Reset() { *m = AvroSettings{} } -func (m *AvroSettings) String() string { return proto.CompactTextString(m) } -func (*AvroSettings) ProtoMessage() {} -func (*AvroSettings) Descriptor() ([]byte, []int) { - return fileDescriptor_b8f6b0c5cf15b9fa, []int{1} +func (x *AvroSettings) Reset() { + *x = AvroSettings{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_encoding_options_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AvroSettings) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AvroSettings.Unmarshal(m, b) -} -func (m *AvroSettings) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AvroSettings.Marshal(b, m, deterministic) -} -func (m *AvroSettings) XXX_Merge(src proto.Message) { - xxx_messageInfo_AvroSettings.Merge(m, src) -} -func (m *AvroSettings) XXX_Size() int { - return xxx_messageInfo_AvroSettings.Size(m) +func (x *AvroSettings) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AvroSettings) XXX_DiscardUnknown() { - xxx_messageInfo_AvroSettings.DiscardUnknown(m) + +func (*AvroSettings) ProtoMessage() {} + +func (x *AvroSettings) ProtoReflect() protoreflect.Message { + mi := &file_ps_encoding_options_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AvroSettings proto.InternalMessageInfo +// Deprecated: Use AvroSettings.ProtoReflect.Descriptor instead. +func (*AvroSettings) Descriptor() ([]byte, []int) { + return file_ps_encoding_options_proto_rawDescGZIP(), []int{1} +} -func (m *AvroSettings) GetAvroSchemaFile() string { - if m != nil { - return m.AvroSchemaFile +func (x *AvroSettings) GetAvroSchemaFile() string { + if x != nil { + return x.AvroSchemaFile } return "" } -func (m *AvroSettings) GetSchema() []byte { - if m != nil { - return m.Schema +func (x *AvroSettings) GetSchema() []byte { + if x != nil { + return x.Schema } return nil } type ThriftSettings struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='One or more directories containing Thrift IDL files'" ThriftDirs []string `protobuf:"bytes,1,rep,name=thrift_dirs,json=thriftDirs,proto3" json:"thrift_dirs,omitempty" kong:"help='One or more directories containing Thrift IDL files'"` // @gotags: kong:"help='Namespace and struct name to decode the message with. Ex: com.mycompany.Account'" - ThriftStruct string `protobuf:"bytes,2,opt,name=thrift_struct,json=thriftStruct,proto3" json:"thrift_struct,omitempty" kong:"help='Namespace and struct name to decode the message with. Ex: com.mycompany.Account'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ThriftStruct string `protobuf:"bytes,2,opt,name=thrift_struct,json=thriftStruct,proto3" json:"thrift_struct,omitempty" kong:"help='Namespace and struct name to decode the message with. Ex: com.mycompany.Account'"` } -func (m *ThriftSettings) Reset() { *m = ThriftSettings{} } -func (m *ThriftSettings) String() string { return proto.CompactTextString(m) } -func (*ThriftSettings) ProtoMessage() {} -func (*ThriftSettings) Descriptor() ([]byte, []int) { - return fileDescriptor_b8f6b0c5cf15b9fa, []int{2} +func (x *ThriftSettings) Reset() { + *x = ThriftSettings{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_encoding_options_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ThriftSettings) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ThriftSettings.Unmarshal(m, b) -} -func (m *ThriftSettings) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ThriftSettings.Marshal(b, m, deterministic) -} -func (m *ThriftSettings) XXX_Merge(src proto.Message) { - xxx_messageInfo_ThriftSettings.Merge(m, src) -} -func (m *ThriftSettings) XXX_Size() int { - return xxx_messageInfo_ThriftSettings.Size(m) +func (x *ThriftSettings) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ThriftSettings) XXX_DiscardUnknown() { - xxx_messageInfo_ThriftSettings.DiscardUnknown(m) + +func (*ThriftSettings) ProtoMessage() {} + +func (x *ThriftSettings) ProtoReflect() protoreflect.Message { + mi := &file_ps_encoding_options_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ThriftSettings proto.InternalMessageInfo +// Deprecated: Use ThriftSettings.ProtoReflect.Descriptor instead. +func (*ThriftSettings) Descriptor() ([]byte, []int) { + return file_ps_encoding_options_proto_rawDescGZIP(), []int{2} +} -func (m *ThriftSettings) GetThriftDirs() []string { - if m != nil { - return m.ThriftDirs +func (x *ThriftSettings) GetThriftDirs() []string { + if x != nil { + return x.ThriftDirs } return nil } -func (m *ThriftSettings) GetThriftStruct() string { - if m != nil { - return m.ThriftStruct +func (x *ThriftSettings) GetThriftStruct() string { + if x != nil { + return x.ThriftStruct } return "" } type JSONSchemaSettings struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Used by desktop; CLI should not set/use this. // @gotags: kong:"-" - Schema []byte `protobuf:"bytes,1,opt,name=schema,proto3" json:"schema,omitempty" kong:"-"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Schema []byte `protobuf:"bytes,1,opt,name=schema,proto3" json:"schema,omitempty" kong:"-"` } -func (m *JSONSchemaSettings) Reset() { *m = JSONSchemaSettings{} } -func (m *JSONSchemaSettings) String() string { return proto.CompactTextString(m) } -func (*JSONSchemaSettings) ProtoMessage() {} -func (*JSONSchemaSettings) Descriptor() ([]byte, []int) { - return fileDescriptor_b8f6b0c5cf15b9fa, []int{3} +func (x *JSONSchemaSettings) Reset() { + *x = JSONSchemaSettings{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_encoding_options_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *JSONSchemaSettings) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_JSONSchemaSettings.Unmarshal(m, b) -} -func (m *JSONSchemaSettings) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_JSONSchemaSettings.Marshal(b, m, deterministic) -} -func (m *JSONSchemaSettings) XXX_Merge(src proto.Message) { - xxx_messageInfo_JSONSchemaSettings.Merge(m, src) -} -func (m *JSONSchemaSettings) XXX_Size() int { - return xxx_messageInfo_JSONSchemaSettings.Size(m) +func (x *JSONSchemaSettings) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *JSONSchemaSettings) XXX_DiscardUnknown() { - xxx_messageInfo_JSONSchemaSettings.DiscardUnknown(m) + +func (*JSONSchemaSettings) ProtoMessage() {} + +func (x *JSONSchemaSettings) ProtoReflect() protoreflect.Message { + mi := &file_ps_encoding_options_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_JSONSchemaSettings proto.InternalMessageInfo +// Deprecated: Use JSONSchemaSettings.ProtoReflect.Descriptor instead. +func (*JSONSchemaSettings) Descriptor() ([]byte, []int) { + return file_ps_encoding_options_proto_rawDescGZIP(), []int{3} +} -func (m *JSONSchemaSettings) GetSchema() []byte { - if m != nil { - return m.Schema +func (x *JSONSchemaSettings) GetSchema() []byte { + if x != nil { + return x.Schema } return nil } type CloudEventSettings struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='ID to give cloud event. If left blank, plumber will auto-generate a random UUIDv4'" CeId string `protobuf:"bytes,1,opt,name=ce_id,json=ceId,proto3" json:"ce_id,omitempty" kong:"help='ID to give cloud event. If left blank, plumber will auto-generate a random UUIDv4'"` // @gotags: kong:"help='Source for cloud event',default='plumber'" @@ -394,87 +497,95 @@ type CloudEventSettings struct { // @gotags: kong:"help='Type of encoding of the event data',default='application/json; charset=utf-8'" CeDataContentType string `protobuf:"bytes,6,opt,name=ce_data_content_type,json=ceDataContentType,proto3" json:"ce_data_content_type,omitempty" kong:"help='Type of encoding of the event data',default='application/json; charset=utf-8'"` // @gotags: kong:"help='Path to JSON schema file for the cloud event'" - CeDataSchema string `protobuf:"bytes,7,opt,name=ce_data_schema,json=ceDataSchema,proto3" json:"ce_data_schema,omitempty" kong:"help='Path to JSON schema file for the cloud event'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + CeDataSchema string `protobuf:"bytes,7,opt,name=ce_data_schema,json=ceDataSchema,proto3" json:"ce_data_schema,omitempty" kong:"help='Path to JSON schema file for the cloud event'"` } -func (m *CloudEventSettings) Reset() { *m = CloudEventSettings{} } -func (m *CloudEventSettings) String() string { return proto.CompactTextString(m) } -func (*CloudEventSettings) ProtoMessage() {} -func (*CloudEventSettings) Descriptor() ([]byte, []int) { - return fileDescriptor_b8f6b0c5cf15b9fa, []int{4} +func (x *CloudEventSettings) Reset() { + *x = CloudEventSettings{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_encoding_options_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *CloudEventSettings) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CloudEventSettings.Unmarshal(m, b) -} -func (m *CloudEventSettings) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CloudEventSettings.Marshal(b, m, deterministic) -} -func (m *CloudEventSettings) XXX_Merge(src proto.Message) { - xxx_messageInfo_CloudEventSettings.Merge(m, src) -} -func (m *CloudEventSettings) XXX_Size() int { - return xxx_messageInfo_CloudEventSettings.Size(m) +func (x *CloudEventSettings) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CloudEventSettings) XXX_DiscardUnknown() { - xxx_messageInfo_CloudEventSettings.DiscardUnknown(m) + +func (*CloudEventSettings) ProtoMessage() {} + +func (x *CloudEventSettings) ProtoReflect() protoreflect.Message { + mi := &file_ps_encoding_options_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_CloudEventSettings proto.InternalMessageInfo +// Deprecated: Use CloudEventSettings.ProtoReflect.Descriptor instead. +func (*CloudEventSettings) Descriptor() ([]byte, []int) { + return file_ps_encoding_options_proto_rawDescGZIP(), []int{4} +} -func (m *CloudEventSettings) GetCeId() string { - if m != nil { - return m.CeId +func (x *CloudEventSettings) GetCeId() string { + if x != nil { + return x.CeId } return "" } -func (m *CloudEventSettings) GetCeSource() string { - if m != nil { - return m.CeSource +func (x *CloudEventSettings) GetCeSource() string { + if x != nil { + return x.CeSource } return "" } -func (m *CloudEventSettings) GetCeType() string { - if m != nil { - return m.CeType +func (x *CloudEventSettings) GetCeType() string { + if x != nil { + return x.CeType } return "" } -func (m *CloudEventSettings) GetCeSubject() string { - if m != nil { - return m.CeSubject +func (x *CloudEventSettings) GetCeSubject() string { + if x != nil { + return x.CeSubject } return "" } -func (m *CloudEventSettings) GetCeSpecVersion() string { - if m != nil { - return m.CeSpecVersion +func (x *CloudEventSettings) GetCeSpecVersion() string { + if x != nil { + return x.CeSpecVersion } return "" } -func (m *CloudEventSettings) GetCeDataContentType() string { - if m != nil { - return m.CeDataContentType +func (x *CloudEventSettings) GetCeDataContentType() string { + if x != nil { + return x.CeDataContentType } return "" } -func (m *CloudEventSettings) GetCeDataSchema() string { - if m != nil { - return m.CeDataSchema +func (x *CloudEventSettings) GetCeDataSchema() string { + if x != nil { + return x.CeDataSchema } return "" } type EncodeOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Use an existing schema for encoding (and ignore all other encode settings) // @gotags: kong:"-" SchemaId string `protobuf:"bytes,1,opt,name=schema_id,json=schemaId,proto3" json:"schema_id,omitempty" kong:"-"` @@ -485,73 +596,81 @@ type EncodeOptions struct { // @gotags: kong:"embed,group=avro" AvroSettings *AvroSettings `protobuf:"bytes,4,opt,name=avro_settings,json=avroSettings,proto3" json:"avro_settings,omitempty" kong:"embed,group=avro"` // @gotags: kong:"embed,group=cloudevent" - CloudeventSettings *CloudEventSettings `protobuf:"bytes,5,opt,name=cloudevent_settings,json=cloudeventSettings,proto3" json:"cloudevent_settings,omitempty" kong:"embed,group=cloudevent"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + CloudeventSettings *CloudEventSettings `protobuf:"bytes,5,opt,name=cloudevent_settings,json=cloudeventSettings,proto3" json:"cloudevent_settings,omitempty" kong:"embed,group=cloudevent"` } -func (m *EncodeOptions) Reset() { *m = EncodeOptions{} } -func (m *EncodeOptions) String() string { return proto.CompactTextString(m) } -func (*EncodeOptions) ProtoMessage() {} -func (*EncodeOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_b8f6b0c5cf15b9fa, []int{5} +func (x *EncodeOptions) Reset() { + *x = EncodeOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_encoding_options_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *EncodeOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EncodeOptions.Unmarshal(m, b) -} -func (m *EncodeOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EncodeOptions.Marshal(b, m, deterministic) -} -func (m *EncodeOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_EncodeOptions.Merge(m, src) +func (x *EncodeOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *EncodeOptions) XXX_Size() int { - return xxx_messageInfo_EncodeOptions.Size(m) -} -func (m *EncodeOptions) XXX_DiscardUnknown() { - xxx_messageInfo_EncodeOptions.DiscardUnknown(m) + +func (*EncodeOptions) ProtoMessage() {} + +func (x *EncodeOptions) ProtoReflect() protoreflect.Message { + mi := &file_ps_encoding_options_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_EncodeOptions proto.InternalMessageInfo +// Deprecated: Use EncodeOptions.ProtoReflect.Descriptor instead. +func (*EncodeOptions) Descriptor() ([]byte, []int) { + return file_ps_encoding_options_proto_rawDescGZIP(), []int{5} +} -func (m *EncodeOptions) GetSchemaId() string { - if m != nil { - return m.SchemaId +func (x *EncodeOptions) GetSchemaId() string { + if x != nil { + return x.SchemaId } return "" } -func (m *EncodeOptions) GetEncodeType() EncodeType { - if m != nil { - return m.EncodeType +func (x *EncodeOptions) GetEncodeType() EncodeType { + if x != nil { + return x.EncodeType } return EncodeType_ENCODE_TYPE_UNSET } -func (m *EncodeOptions) GetProtobufSettings() *ProtobufSettings { - if m != nil { - return m.ProtobufSettings +func (x *EncodeOptions) GetProtobufSettings() *ProtobufSettings { + if x != nil { + return x.ProtobufSettings } return nil } -func (m *EncodeOptions) GetAvroSettings() *AvroSettings { - if m != nil { - return m.AvroSettings +func (x *EncodeOptions) GetAvroSettings() *AvroSettings { + if x != nil { + return x.AvroSettings } return nil } -func (m *EncodeOptions) GetCloudeventSettings() *CloudEventSettings { - if m != nil { - return m.CloudeventSettings +func (x *EncodeOptions) GetCloudeventSettings() *CloudEventSettings { + if x != nil { + return x.CloudeventSettings } return nil } type DecodeOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Use an existing schema for decoding (and ignore all other decode settings) // @gotags: kong:"-" SchemaId string `protobuf:"bytes,1,opt,name=schema_id,json=schemaId,proto3" json:"schema_id,omitempty" kong:"-"` @@ -562,146 +681,369 @@ type DecodeOptions struct { // @gotags: kong:"embed,group=avro" AvroSettings *AvroSettings `protobuf:"bytes,4,opt,name=avro_settings,json=avroSettings,proto3" json:"avro_settings,omitempty" kong:"embed,group=avro"` // @gotags: kong:"embed,group=thrift" - ThriftSettings *ThriftSettings `protobuf:"bytes,5,opt,name=thrift_settings,json=thriftSettings,proto3" json:"thrift_settings,omitempty" kong:"embed,group=thrift"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ThriftSettings *ThriftSettings `protobuf:"bytes,5,opt,name=thrift_settings,json=thriftSettings,proto3" json:"thrift_settings,omitempty" kong:"embed,group=thrift"` } -func (m *DecodeOptions) Reset() { *m = DecodeOptions{} } -func (m *DecodeOptions) String() string { return proto.CompactTextString(m) } -func (*DecodeOptions) ProtoMessage() {} -func (*DecodeOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_b8f6b0c5cf15b9fa, []int{6} +func (x *DecodeOptions) Reset() { + *x = DecodeOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_encoding_options_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *DecodeOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DecodeOptions.Unmarshal(m, b) -} -func (m *DecodeOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DecodeOptions.Marshal(b, m, deterministic) -} -func (m *DecodeOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_DecodeOptions.Merge(m, src) +func (x *DecodeOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *DecodeOptions) XXX_Size() int { - return xxx_messageInfo_DecodeOptions.Size(m) -} -func (m *DecodeOptions) XXX_DiscardUnknown() { - xxx_messageInfo_DecodeOptions.DiscardUnknown(m) + +func (*DecodeOptions) ProtoMessage() {} + +func (x *DecodeOptions) ProtoReflect() protoreflect.Message { + mi := &file_ps_encoding_options_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_DecodeOptions proto.InternalMessageInfo +// Deprecated: Use DecodeOptions.ProtoReflect.Descriptor instead. +func (*DecodeOptions) Descriptor() ([]byte, []int) { + return file_ps_encoding_options_proto_rawDescGZIP(), []int{6} +} -func (m *DecodeOptions) GetSchemaId() string { - if m != nil { - return m.SchemaId +func (x *DecodeOptions) GetSchemaId() string { + if x != nil { + return x.SchemaId } return "" } -func (m *DecodeOptions) GetDecodeType() DecodeType { - if m != nil { - return m.DecodeType +func (x *DecodeOptions) GetDecodeType() DecodeType { + if x != nil { + return x.DecodeType } return DecodeType_DECODE_TYPE_UNSET } -func (m *DecodeOptions) GetProtobufSettings() *ProtobufSettings { - if m != nil { - return m.ProtobufSettings +func (x *DecodeOptions) GetProtobufSettings() *ProtobufSettings { + if x != nil { + return x.ProtobufSettings } return nil } -func (m *DecodeOptions) GetAvroSettings() *AvroSettings { - if m != nil { - return m.AvroSettings +func (x *DecodeOptions) GetAvroSettings() *AvroSettings { + if x != nil { + return x.AvroSettings } return nil } -func (m *DecodeOptions) GetThriftSettings() *ThriftSettings { - if m != nil { - return m.ThriftSettings +func (x *DecodeOptions) GetThriftSettings() *ThriftSettings { + if x != nil { + return x.ThriftSettings } return nil } -func init() { - proto.RegisterEnum("protos.encoding.EncodeType", EncodeType_name, EncodeType_value) - proto.RegisterEnum("protos.encoding.DecodeType", DecodeType_name, DecodeType_value) - proto.RegisterEnum("protos.encoding.EnvelopeType", EnvelopeType_name, EnvelopeType_value) - proto.RegisterType((*ProtobufSettings)(nil), "protos.encoding.ProtobufSettings") - proto.RegisterType((*AvroSettings)(nil), "protos.encoding.AvroSettings") - proto.RegisterType((*ThriftSettings)(nil), "protos.encoding.ThriftSettings") - proto.RegisterType((*JSONSchemaSettings)(nil), "protos.encoding.JSONSchemaSettings") - proto.RegisterType((*CloudEventSettings)(nil), "protos.encoding.CloudEventSettings") - proto.RegisterType((*EncodeOptions)(nil), "protos.encoding.EncodeOptions") - proto.RegisterType((*DecodeOptions)(nil), "protos.encoding.DecodeOptions") -} - -func init() { proto.RegisterFile("ps_encoding_options.proto", fileDescriptor_b8f6b0c5cf15b9fa) } - -var fileDescriptor_b8f6b0c5cf15b9fa = []byte{ - // 933 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xdd, 0x6e, 0xe2, 0x46, - 0x14, 0xae, 0xc9, 0xcf, 0x86, 0x13, 0x48, 0x9c, 0x21, 0x21, 0xde, 0x5d, 0x45, 0x4b, 0xc9, 0xaa, - 0x42, 0x69, 0x0b, 0x52, 0x2a, 0x55, 0xbd, 0x68, 0x55, 0x41, 0x30, 0x4a, 0x2a, 0x0a, 0xc8, 0x76, - 0xa8, 0xba, 0x37, 0x96, 0x19, 0x9f, 0x80, 0x2b, 0xf0, 0x58, 0xf6, 0x40, 0xb5, 0x4f, 0xd0, 0x97, - 0xea, 0x03, 0xf4, 0x01, 0xfa, 0x3a, 0x95, 0x2a, 0xcf, 0xf8, 0x8f, 0x90, 0xaa, 0xea, 0x5d, 0xaf, - 0x12, 0x7f, 0xe7, 0x9c, 0xef, 0x9c, 0xf3, 0xcd, 0x37, 0x03, 0xbc, 0x0e, 0x22, 0x1b, 0x7d, 0xca, - 0x5c, 0xcf, 0x9f, 0xdb, 0x2c, 0xe0, 0x1e, 0xf3, 0xa3, 0x76, 0x10, 0x32, 0xce, 0xc8, 0xa9, 0xf8, - 0x13, 0xb5, 0xd3, 0x70, 0xf3, 0xf7, 0x7d, 0x50, 0x27, 0x31, 0x36, 0x5b, 0x3f, 0x99, 0xc8, 0xb9, - 0xe7, 0xcf, 0x23, 0x72, 0x0b, 0x17, 0x41, 0x82, 0xd9, 0x21, 0x63, 0xdc, 0x5e, 0x61, 0x14, 0x39, - 0x73, 0xd4, 0x94, 0x86, 0xd2, 0x2a, 0x1b, 0xb5, 0x34, 0x68, 0x30, 0xc6, 0x7f, 0x94, 0x21, 0x72, - 0x0d, 0xd5, 0xac, 0xc6, 0xf5, 0xc2, 0x48, 0x2b, 0x35, 0xf6, 0x5a, 0x65, 0xa3, 0x92, 0x82, 0x7d, - 0x2f, 0x8c, 0xc8, 0xe7, 0x40, 0xec, 0x6d, 0x66, 0xd7, 0x0b, 0xb5, 0x3d, 0xc1, 0x7a, 0x3a, 0x29, - 0xb0, 0xf6, 0xbd, 0x90, 0x68, 0xf0, 0xca, 0x09, 0xe9, 0xc2, 0xdb, 0xa0, 0xb6, 0xdf, 0x50, 0x5a, - 0x15, 0x23, 0xfd, 0x24, 0x6d, 0xa8, 0xa5, 0x23, 0xd9, 0x2e, 0x46, 0x34, 0xf4, 0x02, 0xce, 0x42, - 0xed, 0x40, 0x64, 0x9d, 0x25, 0x13, 0xf5, 0xb3, 0x00, 0x31, 0xa1, 0x9e, 0x75, 0x45, 0x7f, 0x83, - 0x4b, 0x16, 0xa0, 0xcd, 0x3f, 0x06, 0xa8, 0x1d, 0x36, 0x94, 0xd6, 0xc9, 0xed, 0x55, 0xfb, 0x99, - 0x2c, 0x6d, 0x3d, 0xc9, 0xb2, 0x3e, 0x06, 0x68, 0x9c, 0xa7, 0xc5, 0x45, 0x94, 0x7c, 0x03, 0x5a, - 0xb4, 0x70, 0x96, 0x4b, 0xf6, 0x6b, 0xce, 0x99, 0xea, 0xf4, 0x4a, 0x6c, 0x54, 0x4f, 0xe2, 0x69, - 0x59, 0x2a, 0x55, 0x17, 0xae, 0x76, 0x2a, 0x9f, 0x3c, 0x5c, 0xba, 0xb6, 0xbf, 0x5e, 0xcd, 0x30, - 0xd4, 0x8e, 0x1a, 0x4a, 0xeb, 0xc0, 0x78, 0xf3, 0xac, 0x7c, 0x10, 0xa7, 0x8c, 0x44, 0x06, 0x19, - 0xc1, 0x7b, 0xfb, 0x9f, 0xba, 0x17, 0x25, 0x29, 0x0b, 0x49, 0x1a, 0xe6, 0x8b, 0x83, 0x14, 0x14, - 0xfa, 0x1a, 0x2e, 0xf3, 0xd3, 0xcb, 0x60, 0x3b, 0x42, 0xae, 0x81, 0xd8, 0x25, 0x33, 0x44, 0x5e, - 0x64, 0x22, 0x6f, 0x4e, 0xa0, 0xd2, 0xdd, 0x84, 0x2c, 0x73, 0x4e, 0x0b, 0x54, 0x67, 0x13, 0x32, - 0x3b, 0xa2, 0x0b, 0x5c, 0x39, 0xf6, 0x93, 0xb7, 0x4c, 0x4d, 0x73, 0x12, 0xe3, 0xa6, 0x80, 0x07, - 0xde, 0x12, 0x49, 0x1d, 0x0e, 0x65, 0x92, 0x56, 0x12, 0x33, 0x26, 0x5f, 0xcd, 0x29, 0x9c, 0x58, - 0x8b, 0xd0, 0x7b, 0xe2, 0x19, 0xe7, 0x3b, 0x38, 0xe6, 0x02, 0x91, 0xbe, 0x52, 0x84, 0xaf, 0x40, - 0x42, 0xc2, 0x55, 0xd7, 0x50, 0x4d, 0x12, 0x22, 0x1e, 0xae, 0x29, 0x17, 0x8c, 0x65, 0xa3, 0x22, - 0x41, 0x53, 0x60, 0xcd, 0x2f, 0x80, 0xfc, 0x60, 0x8e, 0x47, 0x72, 0x82, 0x8c, 0x3b, 0x9f, 0x42, - 0xd9, 0x9a, 0xe2, 0x2f, 0x05, 0xc8, 0xdd, 0x92, 0xad, 0x5d, 0x7d, 0x83, 0x7e, 0x3e, 0x4a, 0x0d, - 0x0e, 0x28, 0xda, 0x9e, 0x9b, 0xec, 0xb4, 0x4f, 0xf1, 0xc1, 0x25, 0x6f, 0xa1, 0x4c, 0xd1, 0x8e, - 0xd8, 0x3a, 0xa4, 0x98, 0xb4, 0x3e, 0xa2, 0x68, 0x8a, 0x6f, 0x72, 0x09, 0xaf, 0x68, 0xe2, 0x35, - 0x69, 0xf3, 0x43, 0x2a, 0xed, 0x73, 0x05, 0x10, 0x57, 0xad, 0x67, 0xbf, 0x20, 0xe5, 0xc2, 0xe0, - 0x65, 0xa3, 0x4c, 0xd1, 0x94, 0x00, 0xf9, 0x0c, 0x4e, 0xe3, 0x70, 0x80, 0xd4, 0xde, 0x60, 0x18, - 0x79, 0xcc, 0x17, 0xf6, 0x2e, 0x1b, 0x55, 0x8a, 0x66, 0x80, 0x74, 0x2a, 0x41, 0xd2, 0x81, 0x73, - 0x8a, 0xb6, 0xeb, 0x70, 0xc7, 0xa6, 0xcc, 0xe7, 0xe8, 0xf3, 0xdc, 0xd8, 0x65, 0xe3, 0x8c, 0x62, - 0xdf, 0xe1, 0xce, 0x9d, 0x8c, 0x88, 0xbe, 0xef, 0xe1, 0x24, 0x2d, 0x48, 0x36, 0x97, 0x66, 0xad, - 0xc8, 0x54, 0xa9, 0x4f, 0xf3, 0xcf, 0x12, 0x54, 0xf5, 0xf8, 0x32, 0xe0, 0x58, 0xbe, 0x1f, 0xf1, - 0x96, 0xc9, 0xa1, 0x66, 0xeb, 0x1f, 0x49, 0xe0, 0xc1, 0x25, 0xdf, 0xc2, 0xb1, 0xb8, 0x3a, 0xc9, - 0xa6, 0x25, 0x71, 0xab, 0xde, 0xbe, 0x70, 0xab, 0xe2, 0x1c, 0x71, 0xa7, 0x00, 0xb3, 0xff, 0xc9, - 0x08, 0xce, 0x32, 0xf3, 0x45, 0x89, 0xd4, 0x42, 0xad, 0xe3, 0xdb, 0x4f, 0x77, 0x38, 0x9e, 0x3f, - 0x56, 0x86, 0x1a, 0x3c, 0x7f, 0xbe, 0x7a, 0x50, 0x95, 0x26, 0x4c, 0xb9, 0xf6, 0x05, 0xd7, 0xee, - 0x2d, 0x2f, 0x5a, 0xd7, 0xa8, 0x38, 0x45, 0x23, 0x5b, 0x50, 0xa3, 0xf1, 0xf9, 0x63, 0x7c, 0xfe, - 0x39, 0xd3, 0x81, 0x60, 0xba, 0xde, 0x61, 0xda, 0xf5, 0x8a, 0x41, 0xf2, 0xfa, 0x14, 0x6b, 0xfe, - 0x51, 0x82, 0x6a, 0x1f, 0xff, 0x8b, 0xac, 0x2e, 0xfe, 0xbb, 0xac, 0x92, 0x51, 0xca, 0xea, 0xe2, - 0xff, 0x5a, 0xd6, 0x7b, 0x38, 0x4d, 0xaf, 0xea, 0xb6, 0xa4, 0xef, 0x76, 0x58, 0xb6, 0x5f, 0x01, - 0xe3, 0x84, 0x6f, 0x7d, 0xdf, 0xac, 0x00, 0x72, 0x3b, 0x91, 0x0b, 0x38, 0xd3, 0x47, 0x77, 0xe3, - 0xbe, 0x6e, 0x5b, 0x3f, 0x4f, 0x74, 0xfb, 0x71, 0x64, 0xea, 0x96, 0xfa, 0x09, 0xa9, 0x03, 0x29, - 0xc2, 0xf1, 0x03, 0x30, 0xe9, 0xa9, 0x0a, 0x39, 0x07, 0xb5, 0x88, 0x77, 0xa7, 0xc6, 0x58, 0x2d, - 0x91, 0x37, 0x50, 0x2f, 0xa2, 0x77, 0xc3, 0xf1, 0x63, 0x5f, 0x9f, 0xea, 0x23, 0x4b, 0xdd, 0xbb, - 0xf9, 0x4d, 0x01, 0xc8, 0x75, 0x8e, 0xfb, 0xf5, 0xf5, 0xdd, 0x7e, 0x1a, 0x9c, 0x17, 0xe1, 0x89, - 0x31, 0xb6, 0xc6, 0xbd, 0xc7, 0x81, 0xec, 0x58, 0x8c, 0x24, 0x1d, 0xeb, 0x40, 0x8a, 0xa8, 0x75, - 0x6f, 0x3c, 0x0c, 0x2c, 0x75, 0x2f, 0x9e, 0xa4, 0x88, 0x0f, 0x86, 0x5d, 0xab, 0xf7, 0x38, 0x18, - 0xe8, 0x86, 0xba, 0x7f, 0xf3, 0x01, 0x2a, 0x5b, 0xbf, 0x43, 0x97, 0x50, 0xd3, 0x47, 0x53, 0x7d, - 0x38, 0x9e, 0xbc, 0xb4, 0x7c, 0x31, 0xd0, 0xd7, 0xf5, 0x89, 0xaa, 0x90, 0xd7, 0x70, 0xb1, 0x8d, - 0x9b, 0xf7, 0xdd, 0xe1, 0x70, 0xfc, 0x93, 0x5a, 0xea, 0x7d, 0xff, 0xe1, 0xbb, 0xb9, 0xc7, 0x17, - 0xeb, 0x59, 0x9b, 0xb2, 0x55, 0x67, 0xe6, 0x70, 0xba, 0xa0, 0x2c, 0x0c, 0x3a, 0xc1, 0x52, 0xfc, - 0xec, 0x7c, 0x29, 0x9d, 0x19, 0x75, 0x66, 0x6b, 0x6f, 0xe9, 0x76, 0xe6, 0xac, 0x23, 0x0f, 0xad, - 0x93, 0x1e, 0xda, 0xec, 0x50, 0x00, 0x5f, 0xfd, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xa9, 0x86, 0xf1, - 0x86, 0x83, 0x08, 0x00, 0x00, +var File_ps_encoding_options_proto protoreflect.FileDescriptor + +var file_ps_encoding_options_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x70, 0x73, 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x22, 0xbc, 0x04, 0x0a, + 0x10, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x73, 0x12, 0x32, 0x0a, 0x15, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x5f, 0x72, 0x6f, + 0x6f, 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x13, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x52, 0x6f, 0x6f, 0x74, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x5f, 0x64, 0x69, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x44, 0x69, 0x72, 0x73, 0x12, 0x2b, 0x0a, 0x12, 0x5f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x5f, 0x64, 0x69, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x52, 0x6f, 0x6f, 0x74, 0x44, 0x69, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x72, 0x63, 0x68, 0x69, + 0x76, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, + 0x65, 0x12, 0x2e, 0x0a, 0x13, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x11, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, + 0x72, 0x12, 0x53, 0x0a, 0x16, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x5f, 0x65, 0x6e, + 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x65, 0x6e, 0x63, 0x6f, 0x64, + 0x69, 0x6e, 0x67, 0x2e, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x54, 0x79, 0x70, 0x65, + 0x52, 0x14, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, + 0x70, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x38, 0x0a, 0x18, 0x73, 0x68, 0x61, 0x6c, 0x6c, 0x6f, + 0x77, 0x5f, 0x65, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, 0x73, 0x68, 0x61, 0x6c, 0x6c, 0x6f, + 0x77, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x12, 0x41, 0x0a, 0x1d, 0x73, 0x68, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x65, 0x6e, 0x76, 0x65, + 0x6c, 0x6f, 0x70, 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x1a, 0x73, 0x68, 0x61, 0x6c, 0x6c, 0x6f, 0x77, + 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4e, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x12, 0x4e, 0x0a, 0x24, 0x5f, 0x73, 0x68, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, + 0x65, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x20, 0x53, 0x68, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, + 0x70, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x6f, 0x72, 0x12, 0x36, 0x0a, 0x17, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x5f, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x18, 0x0a, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x44, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x74, 0x22, 0x50, 0x0a, 0x0c, 0x41, + 0x76, 0x72, 0x6f, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x28, 0x0a, 0x10, 0x61, + 0x76, 0x72, 0x6f, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x76, 0x72, 0x6f, 0x53, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0x56, 0x0a, + 0x0e, 0x54, 0x68, 0x72, 0x69, 0x66, 0x74, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, + 0x1f, 0x0a, 0x0b, 0x74, 0x68, 0x72, 0x69, 0x66, 0x74, 0x5f, 0x64, 0x69, 0x72, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x68, 0x72, 0x69, 0x66, 0x74, 0x44, 0x69, 0x72, 0x73, + 0x12, 0x23, 0x0a, 0x0d, 0x74, 0x68, 0x72, 0x69, 0x66, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x75, 0x63, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x68, 0x72, 0x69, 0x66, 0x74, 0x53, + 0x74, 0x72, 0x75, 0x63, 0x74, 0x22, 0x2c, 0x0a, 0x12, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x22, 0xfd, 0x01, 0x0a, 0x12, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x13, 0x0a, 0x05, 0x63, 0x65, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x65, 0x49, 0x64, 0x12, + 0x1b, 0x0a, 0x09, 0x63, 0x65, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x63, 0x65, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x17, 0x0a, 0x07, + 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, + 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x65, 0x5f, 0x73, 0x75, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x65, 0x53, 0x75, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x63, 0x65, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x5f, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, + 0x65, 0x53, 0x70, 0x65, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2f, 0x0a, 0x14, + 0x63, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x63, 0x65, 0x44, 0x61, + 0x74, 0x61, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, + 0x0e, 0x63, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x65, 0x44, 0x61, 0x74, 0x61, 0x53, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x22, 0xd4, 0x02, 0x0a, 0x0d, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, + 0x49, 0x64, 0x12, 0x3c, 0x0a, 0x0b, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x4e, 0x0a, 0x11, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x5f, 0x73, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x10, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, + 0x12, 0x42, 0x0a, 0x0d, 0x61, 0x76, 0x72, 0x6f, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x41, 0x76, 0x72, 0x6f, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x0c, 0x61, 0x76, 0x72, 0x6f, 0x53, 0x65, 0x74, 0x74, + 0x69, 0x6e, 0x67, 0x73, 0x12, 0x54, 0x0a, 0x13, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x65, 0x6e, 0x63, 0x6f, 0x64, + 0x69, 0x6e, 0x67, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x12, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x22, 0xc8, 0x02, 0x0a, 0x0d, 0x44, + 0x65, 0x63, 0x6f, 0x64, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1b, 0x0a, 0x09, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x49, 0x64, 0x12, 0x3c, 0x0a, 0x0b, 0x64, 0x65, 0x63, + 0x6f, 0x64, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, + 0x2e, 0x44, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x63, + 0x6f, 0x64, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x4e, 0x0a, 0x11, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x65, 0x6e, 0x63, 0x6f, + 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x53, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x53, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x42, 0x0a, 0x0d, 0x61, 0x76, 0x72, 0x6f, 0x5f, + 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, + 0x2e, 0x41, 0x76, 0x72, 0x6f, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x0c, 0x61, + 0x76, 0x72, 0x6f, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x48, 0x0a, 0x0f, 0x74, + 0x68, 0x72, 0x69, 0x66, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x65, 0x6e, + 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x54, 0x68, 0x72, 0x69, 0x66, 0x74, 0x53, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x0e, 0x74, 0x68, 0x72, 0x69, 0x66, 0x74, 0x53, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2a, 0x6d, 0x0a, 0x0a, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x45, 0x4e, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x45, 0x54, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x45, 0x4e, + 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4a, 0x53, 0x4f, 0x4e, 0x50, 0x42, + 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x45, 0x4e, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x41, 0x56, 0x52, 0x4f, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x45, 0x4e, 0x43, 0x4f, + 0x44, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4c, 0x4f, 0x55, 0x44, 0x45, 0x56, 0x45, + 0x4e, 0x54, 0x10, 0x03, 0x2a, 0x87, 0x01, 0x0a, 0x0a, 0x44, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x44, 0x45, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x45, 0x54, 0x10, 0x00, 0x12, 0x18, 0x0a, 0x14, 0x44, 0x45, + 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x42, + 0x55, 0x46, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x45, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x41, 0x56, 0x52, 0x4f, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x44, 0x45, + 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x48, 0x52, 0x49, 0x46, 0x54, + 0x10, 0x03, 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x45, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x46, 0x4c, 0x41, 0x54, 0x42, 0x55, 0x46, 0x46, 0x45, 0x52, 0x10, 0x04, 0x2a, 0x5a, + 0x0a, 0x0c, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x17, + 0x0a, 0x13, 0x45, 0x4e, 0x56, 0x45, 0x4c, 0x4f, 0x50, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x55, 0x4e, 0x53, 0x45, 0x54, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x45, 0x4e, 0x56, 0x45, 0x4c, + 0x4f, 0x50, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x45, 0x45, 0x50, 0x10, 0x01, 0x12, + 0x19, 0x0a, 0x15, 0x45, 0x4e, 0x56, 0x45, 0x4c, 0x4f, 0x50, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x53, 0x48, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x10, 0x02, 0x42, 0x3f, 0x5a, 0x3d, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, + 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_ps_encoding_options_proto_rawDescOnce sync.Once + file_ps_encoding_options_proto_rawDescData = file_ps_encoding_options_proto_rawDesc +) + +func file_ps_encoding_options_proto_rawDescGZIP() []byte { + file_ps_encoding_options_proto_rawDescOnce.Do(func() { + file_ps_encoding_options_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_encoding_options_proto_rawDescData) + }) + return file_ps_encoding_options_proto_rawDescData +} + +var file_ps_encoding_options_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_ps_encoding_options_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_ps_encoding_options_proto_goTypes = []interface{}{ + (EncodeType)(0), // 0: protos.encoding.EncodeType + (DecodeType)(0), // 1: protos.encoding.DecodeType + (EnvelopeType)(0), // 2: protos.encoding.EnvelopeType + (*ProtobufSettings)(nil), // 3: protos.encoding.ProtobufSettings + (*AvroSettings)(nil), // 4: protos.encoding.AvroSettings + (*ThriftSettings)(nil), // 5: protos.encoding.ThriftSettings + (*JSONSchemaSettings)(nil), // 6: protos.encoding.JSONSchemaSettings + (*CloudEventSettings)(nil), // 7: protos.encoding.CloudEventSettings + (*EncodeOptions)(nil), // 8: protos.encoding.EncodeOptions + (*DecodeOptions)(nil), // 9: protos.encoding.DecodeOptions +} +var file_ps_encoding_options_proto_depIdxs = []int32{ + 2, // 0: protos.encoding.ProtobufSettings.protobuf_envelope_type:type_name -> protos.encoding.EnvelopeType + 0, // 1: protos.encoding.EncodeOptions.encode_type:type_name -> protos.encoding.EncodeType + 3, // 2: protos.encoding.EncodeOptions.protobuf_settings:type_name -> protos.encoding.ProtobufSettings + 4, // 3: protos.encoding.EncodeOptions.avro_settings:type_name -> protos.encoding.AvroSettings + 7, // 4: protos.encoding.EncodeOptions.cloudevent_settings:type_name -> protos.encoding.CloudEventSettings + 1, // 5: protos.encoding.DecodeOptions.decode_type:type_name -> protos.encoding.DecodeType + 3, // 6: protos.encoding.DecodeOptions.protobuf_settings:type_name -> protos.encoding.ProtobufSettings + 4, // 7: protos.encoding.DecodeOptions.avro_settings:type_name -> protos.encoding.AvroSettings + 5, // 8: protos.encoding.DecodeOptions.thrift_settings:type_name -> protos.encoding.ThriftSettings + 9, // [9:9] is the sub-list for method output_type + 9, // [9:9] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name +} + +func init() { file_ps_encoding_options_proto_init() } +func file_ps_encoding_options_proto_init() { + if File_ps_encoding_options_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_encoding_options_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProtobufSettings); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_encoding_options_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AvroSettings); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_encoding_options_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ThriftSettings); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_encoding_options_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*JSONSchemaSettings); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_encoding_options_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CloudEventSettings); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_encoding_options_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EncodeOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_encoding_options_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DecodeOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_encoding_options_proto_rawDesc, + NumEnums: 3, + NumMessages: 7, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_encoding_options_proto_goTypes, + DependencyIndexes: file_ps_encoding_options_proto_depIdxs, + EnumInfos: file_ps_encoding_options_proto_enumTypes, + MessageInfos: file_ps_encoding_options_proto_msgTypes, + }.Build() + File_ps_encoding_options_proto = out.File + file_ps_encoding_options_proto_rawDesc = nil + file_ps_encoding_options_proto_goTypes = nil + file_ps_encoding_options_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/batch_connection_options.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/batch_connection_options.pb.go index a58f5fe19..ef1128903 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/batch_connection_options.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/batch_connection_options.pb.go @@ -8,86 +8,86 @@ import ( func GenerateConnOpts(backend string, connArgs interface{}) (IsConnectionOptions_Conn, bool) { switch backend { - case "nsq": - asserted, ok := connArgs.(args.NSQConn) + case "azureservicebus": + asserted, ok := connArgs.(args.AzureServiceBusConn) if !ok { return nil, false } - return &ConnectionOptions_Nsq{ - Nsq: &asserted, + return &ConnectionOptions_AzureServiceBus{ + AzureServiceBus: &asserted, }, true - case "postgres": - asserted, ok := connArgs.(args.PostgresConn) + case "mqtt": + asserted, ok := connArgs.(args.MQTTConn) if !ok { return nil, false } - return &ConnectionOptions_Postgres{ - Postgres: &asserted, + return &ConnectionOptions_Mqtt{ + Mqtt: &asserted, }, true - case "pulsar": - asserted, ok := connArgs.(args.PulsarConn) + case "kafka": + asserted, ok := connArgs.(args.KafkaConn) if !ok { return nil, false } - return &ConnectionOptions_Pulsar{ - Pulsar: &asserted, + return &ConnectionOptions_Kafka{ + Kafka: &asserted, }, true - case "rabbitstreams": - asserted, ok := connArgs.(args.RabbitStreamsConn) + case "activemq": + asserted, ok := connArgs.(args.ActiveMQConn) if !ok { return nil, false } - return &ConnectionOptions_RabbitStreams{ - RabbitStreams: &asserted, + return &ConnectionOptions_ActiveMq{ + ActiveMq: &asserted, }, true - case "redisstreams": - asserted, ok := connArgs.(args.RedisStreamsConn) + case "postgres": + asserted, ok := connArgs.(args.PostgresConn) if !ok { return nil, false } - return &ConnectionOptions_RedisStreams{ - RedisStreams: &asserted, + return &ConnectionOptions_Postgres{ + Postgres: &asserted, }, true - case "gcppubsub": - asserted, ok := connArgs.(args.GCPPubSubConn) + case "pulsar": + asserted, ok := connArgs.(args.PulsarConn) if !ok { return nil, false } - return &ConnectionOptions_GcpPubsub{ - GcpPubsub: &asserted, + return &ConnectionOptions_Pulsar{ + Pulsar: &asserted, }, true - case "activemq": - asserted, ok := connArgs.(args.ActiveMQConn) + case "rabbit": + asserted, ok := connArgs.(args.RabbitConn) if !ok { return nil, false } - return &ConnectionOptions_ActiveMq{ - ActiveMq: &asserted, + return &ConnectionOptions_Rabbit{ + Rabbit: &asserted, }, true - case "natsstreaming": - asserted, ok := connArgs.(args.NatsStreamingConn) + case "azureeventhub": + asserted, ok := connArgs.(args.AzureEventHubConn) if !ok { return nil, false } - return &ConnectionOptions_NatsStreaming{ - NatsStreaming: &asserted, + return &ConnectionOptions_AzureEventHub{ + AzureEventHub: &asserted, }, true - case "memphis": - asserted, ok := connArgs.(args.MemphisConn) + case "gcppubsub": + asserted, ok := connArgs.(args.GCPPubSubConn) if !ok { return nil, false } - return &ConnectionOptions_Memphis{ - Memphis: &asserted, + return &ConnectionOptions_GcpPubsub{ + GcpPubsub: &asserted, }, true case "awskinesis": asserted, ok := connArgs.(args.AWSKinesisConn) @@ -98,23 +98,23 @@ func GenerateConnOpts(backend string, connArgs interface{}) (IsConnectionOptions return &ConnectionOptions_AwsKinesis{ AwsKinesis: &asserted, }, true - case "azureservicebus": - asserted, ok := connArgs.(args.AzureServiceBusConn) + case "memphis": + asserted, ok := connArgs.(args.MemphisConn) if !ok { return nil, false } - return &ConnectionOptions_AzureServiceBus{ - AzureServiceBus: &asserted, + return &ConnectionOptions_Memphis{ + Memphis: &asserted, }, true - case "mqtt": - asserted, ok := connArgs.(args.MQTTConn) + case "awssqs": + asserted, ok := connArgs.(args.AWSSQSConn) if !ok { return nil, false } - return &ConnectionOptions_Mqtt{ - Mqtt: &asserted, + return &ConnectionOptions_AwsSqs{ + AwsSqs: &asserted, }, true case "mongo": asserted, ok := connArgs.(args.MongoConn) @@ -125,23 +125,23 @@ func GenerateConnOpts(backend string, connArgs interface{}) (IsConnectionOptions return &ConnectionOptions_Mongo{ Mongo: &asserted, }, true - case "rabbit": - asserted, ok := connArgs.(args.RabbitConn) + case "nats": + asserted, ok := connArgs.(args.NatsConn) if !ok { return nil, false } - return &ConnectionOptions_Rabbit{ - Rabbit: &asserted, + return &ConnectionOptions_Nats{ + Nats: &asserted, }, true - case "azureeventhub": - asserted, ok := connArgs.(args.AzureEventHubConn) + case "redispubsub": + asserted, ok := connArgs.(args.RedisPubSubConn) if !ok { return nil, false } - return &ConnectionOptions_AzureEventHub{ - AzureEventHub: &asserted, + return &ConnectionOptions_RedisPubsub{ + RedisPubsub: &asserted, }, true case "kubemqqueue": asserted, ok := connArgs.(args.KubeMQQueueConn) @@ -161,50 +161,50 @@ func GenerateConnOpts(backend string, connArgs interface{}) (IsConnectionOptions return &ConnectionOptions_NatsJetstream{ NatsJetstream: &asserted, }, true - case "awssqs": - asserted, ok := connArgs.(args.AWSSQSConn) + case "natsstreaming": + asserted, ok := connArgs.(args.NatsStreamingConn) if !ok { return nil, false } - return &ConnectionOptions_AwsSqs{ - AwsSqs: &asserted, + return &ConnectionOptions_NatsStreaming{ + NatsStreaming: &asserted, }, true - case "awssns": - asserted, ok := connArgs.(args.AWSSNSConn) + case "nsq": + asserted, ok := connArgs.(args.NSQConn) if !ok { return nil, false } - return &ConnectionOptions_AwsSns{ - AwsSns: &asserted, + return &ConnectionOptions_Nsq{ + Nsq: &asserted, }, true - case "redispubsub": - asserted, ok := connArgs.(args.RedisPubSubConn) + case "awssns": + asserted, ok := connArgs.(args.AWSSNSConn) if !ok { return nil, false } - return &ConnectionOptions_RedisPubsub{ - RedisPubsub: &asserted, + return &ConnectionOptions_AwsSns{ + AwsSns: &asserted, }, true - case "kafka": - asserted, ok := connArgs.(args.KafkaConn) + case "rabbitstreams": + asserted, ok := connArgs.(args.RabbitStreamsConn) if !ok { return nil, false } - return &ConnectionOptions_Kafka{ - Kafka: &asserted, + return &ConnectionOptions_RabbitStreams{ + RabbitStreams: &asserted, }, true - case "nats": - asserted, ok := connArgs.(args.NatsConn) + case "redisstreams": + asserted, ok := connArgs.(args.RedisStreamsConn) if !ok { return nil, false } - return &ConnectionOptions_Nats{ - Nats: &asserted, + return &ConnectionOptions_RedisStreams{ + RedisStreams: &asserted, }, true default: return nil, false diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_cli.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_cli.pb.go index c73ebcfb2..379796dab 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_cli.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_cli.pb.go @@ -1,26 +1,30 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: opts/ps_opts_cli.proto package opts import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type GlobalCLIOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Enable debug output',short=d" Debug bool `protobuf:"varint,1,opt,name=debug,proto3" json:"debug,omitempty" kong:"help='Enable debug output',short=d"` // @gotags: kong:"help='Disable fancy output (like curl -s)',short=q" @@ -34,82 +38,86 @@ type GlobalCLIOptions struct { // @gotags: kong:"-" XBackend string `protobuf:"bytes,1002,opt,name=_backend,json=Backend,proto3" json:"_backend,omitempty" kong:"-"` // @gotags: kong:"-" - XCommands []string `protobuf:"bytes,1003,rep,name=_commands,json=Commands,proto3" json:"_commands,omitempty" kong:"-"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + XCommands []string `protobuf:"bytes,1003,rep,name=_commands,json=Commands,proto3" json:"_commands,omitempty" kong:"-"` } -func (m *GlobalCLIOptions) Reset() { *m = GlobalCLIOptions{} } -func (m *GlobalCLIOptions) String() string { return proto.CompactTextString(m) } -func (*GlobalCLIOptions) ProtoMessage() {} -func (*GlobalCLIOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_e6a10a7c41f3437b, []int{0} +func (x *GlobalCLIOptions) Reset() { + *x = GlobalCLIOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_cli_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GlobalCLIOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GlobalCLIOptions.Unmarshal(m, b) +func (x *GlobalCLIOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GlobalCLIOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GlobalCLIOptions.Marshal(b, m, deterministic) -} -func (m *GlobalCLIOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_GlobalCLIOptions.Merge(m, src) -} -func (m *GlobalCLIOptions) XXX_Size() int { - return xxx_messageInfo_GlobalCLIOptions.Size(m) -} -func (m *GlobalCLIOptions) XXX_DiscardUnknown() { - xxx_messageInfo_GlobalCLIOptions.DiscardUnknown(m) + +func (*GlobalCLIOptions) ProtoMessage() {} + +func (x *GlobalCLIOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_cli_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_GlobalCLIOptions proto.InternalMessageInfo +// Deprecated: Use GlobalCLIOptions.ProtoReflect.Descriptor instead. +func (*GlobalCLIOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_cli_proto_rawDescGZIP(), []int{0} +} -func (m *GlobalCLIOptions) GetDebug() bool { - if m != nil { - return m.Debug +func (x *GlobalCLIOptions) GetDebug() bool { + if x != nil { + return x.Debug } return false } -func (m *GlobalCLIOptions) GetQuiet() bool { - if m != nil { - return m.Quiet +func (x *GlobalCLIOptions) GetQuiet() bool { + if x != nil { + return x.Quiet } return false } -func (m *GlobalCLIOptions) GetVersion() bool { - if m != nil { - return m.Version +func (x *GlobalCLIOptions) GetVersion() bool { + if x != nil { + return x.Version } return false } -func (m *GlobalCLIOptions) GetXFullCommand() string { - if m != nil { - return m.XFullCommand +func (x *GlobalCLIOptions) GetXFullCommand() string { + if x != nil { + return x.XFullCommand } return "" } -func (m *GlobalCLIOptions) GetXAction() string { - if m != nil { - return m.XAction +func (x *GlobalCLIOptions) GetXAction() string { + if x != nil { + return x.XAction } return "" } -func (m *GlobalCLIOptions) GetXBackend() string { - if m != nil { - return m.XBackend +func (x *GlobalCLIOptions) GetXBackend() string { + if x != nil { + return x.XBackend } return "" } -func (m *GlobalCLIOptions) GetXCommands() []string { - if m != nil { - return m.XCommands +func (x *GlobalCLIOptions) GetXCommands() []string { + if x != nil { + return x.XCommands } return nil } @@ -121,6 +129,10 @@ func (m *GlobalCLIOptions) GetXCommands() []string { // // For more info, check README_CLI.md type CLIOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" Global *GlobalCLIOptions `protobuf:"bytes,1,opt,name=global,proto3" json:"global,omitempty" kong:"embed"` // @gotags: kong:"cmd,help='Read message(s) from messaging system'" @@ -136,129 +148,255 @@ type CLIOptions struct { // @gotags: kong:"cmd,help='Run plumber in server mode'" Server *ServerOptions `protobuf:"bytes,7,opt,name=server,proto3" json:"server,omitempty" kong:"cmd,help='Run plumber in server mode'"` // @gotags: kong:"cmd,help='Manage plumber server'" - Manage *ManageOptions `protobuf:"bytes,8,opt,name=manage,proto3" json:"manage,omitempty" kong:"cmd,help='Manage plumber server'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Manage *ManageOptions `protobuf:"bytes,8,opt,name=manage,proto3" json:"manage,omitempty" kong:"cmd,help='Manage plumber server'"` } -func (m *CLIOptions) Reset() { *m = CLIOptions{} } -func (m *CLIOptions) String() string { return proto.CompactTextString(m) } -func (*CLIOptions) ProtoMessage() {} -func (*CLIOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_e6a10a7c41f3437b, []int{1} +func (x *CLIOptions) Reset() { + *x = CLIOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_cli_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *CLIOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CLIOptions.Unmarshal(m, b) -} -func (m *CLIOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CLIOptions.Marshal(b, m, deterministic) +func (x *CLIOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CLIOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_CLIOptions.Merge(m, src) -} -func (m *CLIOptions) XXX_Size() int { - return xxx_messageInfo_CLIOptions.Size(m) -} -func (m *CLIOptions) XXX_DiscardUnknown() { - xxx_messageInfo_CLIOptions.DiscardUnknown(m) + +func (*CLIOptions) ProtoMessage() {} + +func (x *CLIOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_cli_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_CLIOptions proto.InternalMessageInfo +// Deprecated: Use CLIOptions.ProtoReflect.Descriptor instead. +func (*CLIOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_cli_proto_rawDescGZIP(), []int{1} +} -func (m *CLIOptions) GetGlobal() *GlobalCLIOptions { - if m != nil { - return m.Global +func (x *CLIOptions) GetGlobal() *GlobalCLIOptions { + if x != nil { + return x.Global } return nil } -func (m *CLIOptions) GetRead() *ReadOptions { - if m != nil { - return m.Read +func (x *CLIOptions) GetRead() *ReadOptions { + if x != nil { + return x.Read } return nil } -func (m *CLIOptions) GetWrite() *WriteOptions { - if m != nil { - return m.Write +func (x *CLIOptions) GetWrite() *WriteOptions { + if x != nil { + return x.Write } return nil } -func (m *CLIOptions) GetRelay() *RelayOptions { - if m != nil { - return m.Relay +func (x *CLIOptions) GetRelay() *RelayOptions { + if x != nil { + return x.Relay } return nil } -func (m *CLIOptions) GetTunnel() *TunnelOptions { - if m != nil { - return m.Tunnel +func (x *CLIOptions) GetTunnel() *TunnelOptions { + if x != nil { + return x.Tunnel } return nil } -func (m *CLIOptions) GetStreamdal() *StreamdalOptions { - if m != nil { - return m.Streamdal +func (x *CLIOptions) GetStreamdal() *StreamdalOptions { + if x != nil { + return x.Streamdal } return nil } -func (m *CLIOptions) GetServer() *ServerOptions { - if m != nil { - return m.Server +func (x *CLIOptions) GetServer() *ServerOptions { + if x != nil { + return x.Server } return nil } -func (m *CLIOptions) GetManage() *ManageOptions { - if m != nil { - return m.Manage +func (x *CLIOptions) GetManage() *ManageOptions { + if x != nil { + return x.Manage } return nil } -func init() { - proto.RegisterType((*GlobalCLIOptions)(nil), "protos.opts.GlobalCLIOptions") - proto.RegisterType((*CLIOptions)(nil), "protos.opts.CLIOptions") +var File_opts_ps_opts_cli_proto protoreflect.FileDescriptor + +var file_opts_ps_opts_cli_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x63, + 0x6c, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x1a, 0x19, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, + 0x70, 0x74, 0x73, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x17, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x72, + 0x65, 0x61, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x6f, 0x70, 0x74, 0x73, 0x2f, + 0x70, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, 0x70, 0x74, + 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, + 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x6f, 0x70, + 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x74, 0x75, 0x6e, 0x6e, 0x65, + 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, + 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0xd1, 0x01, 0x0a, 0x10, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x43, 0x4c, 0x49, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x12, 0x14, 0x0a, 0x05, + 0x71, 0x75, 0x69, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x71, 0x75, 0x69, + 0x65, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, + 0x5f, 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0xe8, 0x07, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x46, 0x75, 0x6c, 0x6c, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, + 0x64, 0x12, 0x18, 0x0a, 0x07, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe9, 0x07, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x5f, + 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x18, 0xea, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, + 0x61, 0x6e, 0x64, 0x73, 0x18, 0xeb, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x43, 0x6f, 0x6d, + 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x22, 0xac, 0x03, 0x0a, 0x0a, 0x43, 0x4c, 0x49, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x35, 0x0a, 0x06, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, + 0x74, 0x73, 0x2e, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x43, 0x4c, 0x49, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x12, 0x2c, 0x0a, 0x04, 0x72, + 0x65, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x04, 0x72, 0x65, 0x61, 0x64, 0x12, 0x2f, 0x0a, 0x05, 0x77, 0x72, 0x69, + 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x05, 0x77, 0x72, 0x69, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x05, 0x72, 0x65, + 0x6c, 0x61, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x05, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x32, 0x0a, 0x06, 0x74, + 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x12, + 0x3b, 0x0a, 0x09, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, + 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x09, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x12, 0x32, 0x0a, 0x06, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x12, 0x32, 0x0a, 0x06, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x4d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, + 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x6f, 0x70, 0x74, + 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func init() { proto.RegisterFile("opts/ps_opts_cli.proto", fileDescriptor_e6a10a7c41f3437b) } - -var fileDescriptor_e6a10a7c41f3437b = []byte{ - // 457 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xdf, 0x8a, 0xd4, 0x30, - 0x14, 0xc6, 0x19, 0x67, 0xa7, 0x9d, 0x49, 0x11, 0x24, 0x88, 0x66, 0x87, 0x15, 0x86, 0xf5, 0x66, - 0x2e, 0xb4, 0x85, 0x8a, 0x17, 0xb2, 0x57, 0xee, 0x82, 0x22, 0x28, 0x42, 0x57, 0x10, 0xbc, 0x29, - 0x69, 0x1a, 0x3b, 0xc5, 0xb4, 0xa9, 0xf9, 0xb3, 0xe2, 0x3b, 0xf9, 0x32, 0xbe, 0x85, 0x7f, 0x5e, - 0x42, 0x72, 0xd2, 0xd6, 0xed, 0xd0, 0xab, 0x72, 0xce, 0xef, 0xfb, 0xce, 0xe9, 0x97, 0x04, 0x3d, - 0x90, 0x9d, 0xd1, 0x49, 0xa7, 0x73, 0xf7, 0xcd, 0x99, 0xa8, 0xe3, 0x4e, 0x49, 0x23, 0x71, 0x04, - 0x1f, 0x1d, 0xbb, 0xf6, 0xf6, 0x74, 0x22, 0x6a, 0x68, 0x4b, 0x2b, 0xee, 0x75, 0xdb, 0x87, 0x13, - 0xa4, 0x38, 0x2d, 0x7b, 0x40, 0x8e, 0x80, 0xa0, 0xdf, 0x7b, 0x32, 0x9d, 0xa6, 0xb9, 0xba, 0xe1, - 0xaa, 0x47, 0x67, 0x53, 0x64, 0x14, 0xa7, 0x4d, 0x49, 0xc5, 0xac, 0xd1, 0xd8, 0xb6, 0xe5, 0x62, - 0x76, 0xdb, 0x37, 0x55, 0x9b, 0xfe, 0x07, 0xcf, 0x7f, 0x2e, 0xd0, 0xbd, 0xd7, 0x42, 0x16, 0x54, - 0x5c, 0xbd, 0x7d, 0xf3, 0xbe, 0x33, 0xb5, 0x6c, 0x35, 0xbe, 0x8f, 0x56, 0x25, 0x2f, 0x6c, 0x45, - 0x16, 0xbb, 0xc5, 0x7e, 0x9d, 0xf9, 0xc2, 0x75, 0xbf, 0xda, 0x9a, 0x1b, 0x72, 0xc7, 0x77, 0xa1, - 0xc0, 0x04, 0x85, 0x37, 0x5c, 0xe9, 0x5a, 0xb6, 0x64, 0x09, 0xfd, 0xa1, 0xc4, 0x8f, 0xd1, 0xdd, - 0xfc, 0xb3, 0x15, 0x22, 0x67, 0xb2, 0x69, 0x68, 0x5b, 0x92, 0x5f, 0xe1, 0x6e, 0xb1, 0xdf, 0x64, - 0xd1, 0x2b, 0x2b, 0xc4, 0x95, 0xef, 0x39, 0x7b, 0x4e, 0x99, 0x5b, 0x4b, 0x7e, 0x7b, 0x1c, 0xbc, - 0x84, 0x12, 0x6f, 0xd1, 0x3a, 0x2f, 0x28, 0xfb, 0xc2, 0xdb, 0x92, 0xfc, 0xf1, 0x28, 0xbc, 0xf4, - 0x35, 0x3e, 0x43, 0x9b, 0x61, 0xaa, 0x26, 0x7f, 0xc3, 0xdd, 0x72, 0xbf, 0xc9, 0xd6, 0xfd, 0x48, - 0x7d, 0xfe, 0x63, 0x89, 0xd0, 0xad, 0x34, 0xcf, 0x51, 0x50, 0x41, 0x42, 0x88, 0x13, 0xa5, 0x8f, - 0xe2, 0x5b, 0x97, 0x17, 0x1f, 0x87, 0xcf, 0x7a, 0x31, 0x7e, 0x82, 0x4e, 0xdc, 0x7d, 0x41, 0xda, - 0x28, 0x25, 0x13, 0x53, 0xc6, 0x69, 0x39, 0xe8, 0x41, 0x85, 0x13, 0xb4, 0x82, 0x63, 0x85, 0x43, - 0x88, 0xd2, 0xd3, 0x89, 0xfc, 0xa3, 0x23, 0x83, 0xde, 0xeb, 0x9c, 0x01, 0x6e, 0x9d, 0x9c, 0xcc, - 0x18, 0x32, 0x47, 0x46, 0x03, 0xe8, 0x70, 0x8a, 0x02, 0x7f, 0xa7, 0x64, 0x05, 0x8e, 0xed, 0xc4, - 0xf1, 0x01, 0xd0, 0x98, 0xc1, 0x2b, 0xf1, 0x05, 0xda, 0x8c, 0xaf, 0x84, 0x04, 0x33, 0xe9, 0xaf, - 0x07, 0x3a, 0x38, 0xff, 0xeb, 0xdd, 0x42, 0xff, 0xfa, 0x48, 0x38, 0xb3, 0xf0, 0x1a, 0xd0, 0xb8, - 0xd0, 0x2b, 0x9d, 0xc7, 0xbf, 0x7f, 0xb2, 0x9e, 0xf1, 0xbc, 0x03, 0x34, 0x7a, 0xbc, 0xf2, 0xf2, - 0xe2, 0xd3, 0x8b, 0xaa, 0x36, 0x07, 0x5b, 0xc4, 0x4c, 0x36, 0x49, 0x41, 0x0d, 0x3b, 0x30, 0xa9, - 0xba, 0xa4, 0x13, 0xb6, 0x29, 0xb8, 0x7a, 0xaa, 0xd9, 0x81, 0x37, 0x54, 0x27, 0x85, 0xad, 0x45, - 0x99, 0x54, 0x32, 0xf1, 0x23, 0x13, 0x37, 0xb2, 0x08, 0xa0, 0x78, 0xf6, 0x2f, 0x00, 0x00, 0xff, - 0xff, 0x80, 0xd5, 0xdc, 0x99, 0xa9, 0x03, 0x00, 0x00, +var ( + file_opts_ps_opts_cli_proto_rawDescOnce sync.Once + file_opts_ps_opts_cli_proto_rawDescData = file_opts_ps_opts_cli_proto_rawDesc +) + +func file_opts_ps_opts_cli_proto_rawDescGZIP() []byte { + file_opts_ps_opts_cli_proto_rawDescOnce.Do(func() { + file_opts_ps_opts_cli_proto_rawDescData = protoimpl.X.CompressGZIP(file_opts_ps_opts_cli_proto_rawDescData) + }) + return file_opts_ps_opts_cli_proto_rawDescData +} + +var file_opts_ps_opts_cli_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_opts_ps_opts_cli_proto_goTypes = []interface{}{ + (*GlobalCLIOptions)(nil), // 0: protos.opts.GlobalCLIOptions + (*CLIOptions)(nil), // 1: protos.opts.CLIOptions + (*ReadOptions)(nil), // 2: protos.opts.ReadOptions + (*WriteOptions)(nil), // 3: protos.opts.WriteOptions + (*RelayOptions)(nil), // 4: protos.opts.RelayOptions + (*TunnelOptions)(nil), // 5: protos.opts.TunnelOptions + (*StreamdalOptions)(nil), // 6: protos.opts.StreamdalOptions + (*ServerOptions)(nil), // 7: protos.opts.ServerOptions + (*ManageOptions)(nil), // 8: protos.opts.ManageOptions +} +var file_opts_ps_opts_cli_proto_depIdxs = []int32{ + 0, // 0: protos.opts.CLIOptions.global:type_name -> protos.opts.GlobalCLIOptions + 2, // 1: protos.opts.CLIOptions.read:type_name -> protos.opts.ReadOptions + 3, // 2: protos.opts.CLIOptions.write:type_name -> protos.opts.WriteOptions + 4, // 3: protos.opts.CLIOptions.relay:type_name -> protos.opts.RelayOptions + 5, // 4: protos.opts.CLIOptions.tunnel:type_name -> protos.opts.TunnelOptions + 6, // 5: protos.opts.CLIOptions.streamdal:type_name -> protos.opts.StreamdalOptions + 7, // 6: protos.opts.CLIOptions.server:type_name -> protos.opts.ServerOptions + 8, // 7: protos.opts.CLIOptions.manage:type_name -> protos.opts.ManageOptions + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name +} + +func init() { file_opts_ps_opts_cli_proto_init() } +func file_opts_ps_opts_cli_proto_init() { + if File_opts_ps_opts_cli_proto != nil { + return + } + file_opts_ps_opts_manage_proto_init() + file_opts_ps_opts_read_proto_init() + file_opts_ps_opts_relay_proto_init() + file_opts_ps_opts_server_proto_init() + file_opts_ps_opts_streamdal_proto_init() + file_opts_ps_opts_tunnel_proto_init() + file_opts_ps_opts_write_proto_init() + if !protoimpl.UnsafeEnabled { + file_opts_ps_opts_cli_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GlobalCLIOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_cli_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CLIOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_opts_ps_opts_cli_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_opts_ps_opts_cli_proto_goTypes, + DependencyIndexes: file_opts_ps_opts_cli_proto_depIdxs, + MessageInfos: file_opts_ps_opts_cli_proto_msgTypes, + }.Build() + File_opts_ps_opts_cli_proto = out.File + file_opts_ps_opts_cli_proto_rawDesc = nil + file_opts_ps_opts_cli_proto_goTypes = nil + file_opts_ps_opts_cli_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_connection.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_connection.pb.go index 68c88df89..e54a70eab 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_connection.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_connection.pb.go @@ -1,34 +1,39 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: opts/ps_opts_connection.proto package opts import ( - fmt "fmt" args "github.com/batchcorp/plumber-schemas/build/go/protos/args" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) // ConnectionConfig is used for creating a new backend. CLI creates an instance // of this structure by injecting the conn struct it receives via *Args. type ConnectionOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Friendly name to identify this connection by (used in plumber-server logs) Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // Any notes associated with this connection (stored plumber-server side) Notes string `protobuf:"bytes,2,opt,name=notes,proto3" json:"notes,omitempty"` - // Types that are valid to be assigned to Conn: + // Types that are assignable to Conn: + // // *ConnectionOptions_Kafka // *ConnectionOptions_ActiveMq // *ConnectionOptions_AwsSqs @@ -53,47 +58,219 @@ type ConnectionOptions struct { // *ConnectionOptions_Memphis Conn isConnectionOptions_Conn `protobuf_oneof:"conn"` // Used internally by plumber - XId string `protobuf:"bytes,1000,opt,name=_id,json=Id,proto3" json:"_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + XId string `protobuf:"bytes,1000,opt,name=_id,json=Id,proto3" json:"_id,omitempty"` +} + +func (x *ConnectionOptions) Reset() { + *x = ConnectionOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_connection_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConnectionOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ConnectionOptions) Reset() { *m = ConnectionOptions{} } -func (m *ConnectionOptions) String() string { return proto.CompactTextString(m) } -func (*ConnectionOptions) ProtoMessage() {} +func (*ConnectionOptions) ProtoMessage() {} + +func (x *ConnectionOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_connection_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConnectionOptions.ProtoReflect.Descriptor instead. func (*ConnectionOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_894e2be3fdae18cb, []int{0} + return file_opts_ps_opts_connection_proto_rawDescGZIP(), []int{0} } -func (m *ConnectionOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ConnectionOptions.Unmarshal(m, b) +func (x *ConnectionOptions) GetName() string { + if x != nil { + return x.Name + } + return "" } -func (m *ConnectionOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ConnectionOptions.Marshal(b, m, deterministic) + +func (x *ConnectionOptions) GetNotes() string { + if x != nil { + return x.Notes + } + return "" } -func (m *ConnectionOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ConnectionOptions.Merge(m, src) + +func (m *ConnectionOptions) GetConn() isConnectionOptions_Conn { + if m != nil { + return m.Conn + } + return nil } -func (m *ConnectionOptions) XXX_Size() int { - return xxx_messageInfo_ConnectionOptions.Size(m) + +func (x *ConnectionOptions) GetKafka() *args.KafkaConn { + if x, ok := x.GetConn().(*ConnectionOptions_Kafka); ok { + return x.Kafka + } + return nil } -func (m *ConnectionOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ConnectionOptions.DiscardUnknown(m) + +func (x *ConnectionOptions) GetActiveMq() *args.ActiveMQConn { + if x, ok := x.GetConn().(*ConnectionOptions_ActiveMq); ok { + return x.ActiveMq + } + return nil } -var xxx_messageInfo_ConnectionOptions proto.InternalMessageInfo +func (x *ConnectionOptions) GetAwsSqs() *args.AWSSQSConn { + if x, ok := x.GetConn().(*ConnectionOptions_AwsSqs); ok { + return x.AwsSqs + } + return nil +} -func (m *ConnectionOptions) GetName() string { - if m != nil { - return m.Name +func (x *ConnectionOptions) GetAwsSns() *args.AWSSNSConn { + if x, ok := x.GetConn().(*ConnectionOptions_AwsSns); ok { + return x.AwsSns } - return "" + return nil } -func (m *ConnectionOptions) GetNotes() string { - if m != nil { - return m.Notes +func (x *ConnectionOptions) GetMongo() *args.MongoConn { + if x, ok := x.GetConn().(*ConnectionOptions_Mongo); ok { + return x.Mongo + } + return nil +} + +func (x *ConnectionOptions) GetNats() *args.NatsConn { + if x, ok := x.GetConn().(*ConnectionOptions_Nats); ok { + return x.Nats + } + return nil +} + +func (x *ConnectionOptions) GetNatsStreaming() *args.NatsStreamingConn { + if x, ok := x.GetConn().(*ConnectionOptions_NatsStreaming); ok { + return x.NatsStreaming + } + return nil +} + +func (x *ConnectionOptions) GetNsq() *args.NSQConn { + if x, ok := x.GetConn().(*ConnectionOptions_Nsq); ok { + return x.Nsq + } + return nil +} + +func (x *ConnectionOptions) GetPostgres() *args.PostgresConn { + if x, ok := x.GetConn().(*ConnectionOptions_Postgres); ok { + return x.Postgres + } + return nil +} + +func (x *ConnectionOptions) GetPulsar() *args.PulsarConn { + if x, ok := x.GetConn().(*ConnectionOptions_Pulsar); ok { + return x.Pulsar + } + return nil +} + +func (x *ConnectionOptions) GetRabbit() *args.RabbitConn { + if x, ok := x.GetConn().(*ConnectionOptions_Rabbit); ok { + return x.Rabbit + } + return nil +} + +func (x *ConnectionOptions) GetRabbitStreams() *args.RabbitStreamsConn { + if x, ok := x.GetConn().(*ConnectionOptions_RabbitStreams); ok { + return x.RabbitStreams + } + return nil +} + +func (x *ConnectionOptions) GetRedisPubsub() *args.RedisPubSubConn { + if x, ok := x.GetConn().(*ConnectionOptions_RedisPubsub); ok { + return x.RedisPubsub + } + return nil +} + +func (x *ConnectionOptions) GetRedisStreams() *args.RedisStreamsConn { + if x, ok := x.GetConn().(*ConnectionOptions_RedisStreams); ok { + return x.RedisStreams + } + return nil +} + +func (x *ConnectionOptions) GetAzureEventHub() *args.AzureEventHubConn { + if x, ok := x.GetConn().(*ConnectionOptions_AzureEventHub); ok { + return x.AzureEventHub + } + return nil +} + +func (x *ConnectionOptions) GetAzureServiceBus() *args.AzureServiceBusConn { + if x, ok := x.GetConn().(*ConnectionOptions_AzureServiceBus); ok { + return x.AzureServiceBus + } + return nil +} + +func (x *ConnectionOptions) GetMqtt() *args.MQTTConn { + if x, ok := x.GetConn().(*ConnectionOptions_Mqtt); ok { + return x.Mqtt + } + return nil +} + +func (x *ConnectionOptions) GetKubemqQueue() *args.KubeMQQueueConn { + if x, ok := x.GetConn().(*ConnectionOptions_KubemqQueue); ok { + return x.KubemqQueue + } + return nil +} + +func (x *ConnectionOptions) GetGcpPubsub() *args.GCPPubSubConn { + if x, ok := x.GetConn().(*ConnectionOptions_GcpPubsub); ok { + return x.GcpPubsub + } + return nil +} + +func (x *ConnectionOptions) GetNatsJetstream() *args.NatsJetstreamConn { + if x, ok := x.GetConn().(*ConnectionOptions_NatsJetstream); ok { + return x.NatsJetstream + } + return nil +} + +func (x *ConnectionOptions) GetAwsKinesis() *args.AWSKinesisConn { + if x, ok := x.GetConn().(*ConnectionOptions_AwsKinesis); ok { + return x.AwsKinesis + } + return nil +} + +func (x *ConnectionOptions) GetMemphis() *args.MemphisConn { + if x, ok := x.GetConn().(*ConnectionOptions_Memphis); ok { + return x.Memphis + } + return nil +} + +func (x *ConnectionOptions) GetXId() string { + if x != nil { + return x.XId } return "" } @@ -234,177 +411,235 @@ func (*ConnectionOptions_AwsKinesis) isConnectionOptions_Conn() {} func (*ConnectionOptions_Memphis) isConnectionOptions_Conn() {} -func (m *ConnectionOptions) GetConn() isConnectionOptions_Conn { - if m != nil { - return m.Conn - } - return nil -} - -func (m *ConnectionOptions) GetKafka() *args.KafkaConn { - if x, ok := m.GetConn().(*ConnectionOptions_Kafka); ok { - return x.Kafka - } - return nil -} - -func (m *ConnectionOptions) GetActiveMq() *args.ActiveMQConn { - if x, ok := m.GetConn().(*ConnectionOptions_ActiveMq); ok { - return x.ActiveMq - } - return nil -} - -func (m *ConnectionOptions) GetAwsSqs() *args.AWSSQSConn { - if x, ok := m.GetConn().(*ConnectionOptions_AwsSqs); ok { - return x.AwsSqs - } - return nil -} - -func (m *ConnectionOptions) GetAwsSns() *args.AWSSNSConn { - if x, ok := m.GetConn().(*ConnectionOptions_AwsSns); ok { - return x.AwsSns - } - return nil -} - -func (m *ConnectionOptions) GetMongo() *args.MongoConn { - if x, ok := m.GetConn().(*ConnectionOptions_Mongo); ok { - return x.Mongo - } - return nil -} - -func (m *ConnectionOptions) GetNats() *args.NatsConn { - if x, ok := m.GetConn().(*ConnectionOptions_Nats); ok { - return x.Nats - } - return nil -} - -func (m *ConnectionOptions) GetNatsStreaming() *args.NatsStreamingConn { - if x, ok := m.GetConn().(*ConnectionOptions_NatsStreaming); ok { - return x.NatsStreaming - } - return nil -} - -func (m *ConnectionOptions) GetNsq() *args.NSQConn { - if x, ok := m.GetConn().(*ConnectionOptions_Nsq); ok { - return x.Nsq - } - return nil -} - -func (m *ConnectionOptions) GetPostgres() *args.PostgresConn { - if x, ok := m.GetConn().(*ConnectionOptions_Postgres); ok { - return x.Postgres - } - return nil -} - -func (m *ConnectionOptions) GetPulsar() *args.PulsarConn { - if x, ok := m.GetConn().(*ConnectionOptions_Pulsar); ok { - return x.Pulsar - } - return nil -} - -func (m *ConnectionOptions) GetRabbit() *args.RabbitConn { - if x, ok := m.GetConn().(*ConnectionOptions_Rabbit); ok { - return x.Rabbit - } - return nil -} - -func (m *ConnectionOptions) GetRabbitStreams() *args.RabbitStreamsConn { - if x, ok := m.GetConn().(*ConnectionOptions_RabbitStreams); ok { - return x.RabbitStreams - } - return nil -} - -func (m *ConnectionOptions) GetRedisPubsub() *args.RedisPubSubConn { - if x, ok := m.GetConn().(*ConnectionOptions_RedisPubsub); ok { - return x.RedisPubsub - } - return nil -} - -func (m *ConnectionOptions) GetRedisStreams() *args.RedisStreamsConn { - if x, ok := m.GetConn().(*ConnectionOptions_RedisStreams); ok { - return x.RedisStreams - } - return nil -} - -func (m *ConnectionOptions) GetAzureEventHub() *args.AzureEventHubConn { - if x, ok := m.GetConn().(*ConnectionOptions_AzureEventHub); ok { - return x.AzureEventHub - } - return nil -} - -func (m *ConnectionOptions) GetAzureServiceBus() *args.AzureServiceBusConn { - if x, ok := m.GetConn().(*ConnectionOptions_AzureServiceBus); ok { - return x.AzureServiceBus - } - return nil -} - -func (m *ConnectionOptions) GetMqtt() *args.MQTTConn { - if x, ok := m.GetConn().(*ConnectionOptions_Mqtt); ok { - return x.Mqtt - } - return nil -} - -func (m *ConnectionOptions) GetKubemqQueue() *args.KubeMQQueueConn { - if x, ok := m.GetConn().(*ConnectionOptions_KubemqQueue); ok { - return x.KubemqQueue - } - return nil -} - -func (m *ConnectionOptions) GetGcpPubsub() *args.GCPPubSubConn { - if x, ok := m.GetConn().(*ConnectionOptions_GcpPubsub); ok { - return x.GcpPubsub - } - return nil -} - -func (m *ConnectionOptions) GetNatsJetstream() *args.NatsJetstreamConn { - if x, ok := m.GetConn().(*ConnectionOptions_NatsJetstream); ok { - return x.NatsJetstream - } - return nil -} - -func (m *ConnectionOptions) GetAwsKinesis() *args.AWSKinesisConn { - if x, ok := m.GetConn().(*ConnectionOptions_AwsKinesis); ok { - return x.AwsKinesis - } - return nil -} +var File_opts_ps_opts_connection_proto protoreflect.FileDescriptor + +var file_opts_ps_opts_connection_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x63, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x1a, 0x1b, 0x61, 0x72, + 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x76, + 0x65, 0x6d, 0x71, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x61, 0x72, 0x67, 0x73, 0x2f, + 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x77, 0x73, 0x5f, 0x6b, 0x69, 0x6e, 0x65, + 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x61, 0x72, 0x67, 0x73, 0x2f, + 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x6e, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, + 0x72, 0x67, 0x73, 0x5f, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x71, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x22, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, + 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x75, 0x62, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x24, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, + 0x72, 0x67, 0x73, 0x5f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x61, 0x72, 0x67, + 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x67, 0x63, 0x70, 0x5f, 0x70, 0x75, + 0x62, 0x73, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x61, 0x72, 0x67, 0x73, + 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, + 0x67, 0x73, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, 0x5f, 0x71, 0x75, 0x65, 0x75, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, + 0x72, 0x67, 0x73, 0x5f, 0x6d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x18, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, + 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x61, 0x72, 0x67, + 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6d, 0x71, 0x74, 0x74, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, + 0x67, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x61, + 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, + 0x5f, 0x6a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x21, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, + 0x61, 0x74, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, + 0x73, 0x5f, 0x6e, 0x73, 0x71, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x61, 0x72, 0x67, + 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, + 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, + 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x70, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, + 0x73, 0x5f, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, + 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x61, 0x62, + 0x62, 0x69, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x1f, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, + 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x20, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, + 0x5f, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf0, 0x0a, 0x0a, 0x11, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, + 0x0a, 0x05, 0x6e, 0x6f, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6e, + 0x6f, 0x74, 0x65, 0x73, 0x12, 0x2e, 0x0a, 0x05, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x18, 0x64, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, + 0x73, 0x2e, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x43, 0x6f, 0x6e, 0x6e, 0x48, 0x00, 0x52, 0x05, 0x6b, + 0x61, 0x66, 0x6b, 0x61, 0x12, 0x38, 0x0a, 0x09, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x6d, + 0x71, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4d, 0x51, 0x43, 0x6f, + 0x6e, 0x6e, 0x48, 0x00, 0x52, 0x08, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4d, 0x71, 0x12, 0x32, + 0x0a, 0x07, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x71, 0x73, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, + 0x53, 0x53, 0x51, 0x53, 0x43, 0x6f, 0x6e, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, 0x77, 0x73, 0x53, + 0x71, 0x73, 0x12, 0x32, 0x0a, 0x07, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x6e, 0x73, 0x18, 0x67, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, + 0x73, 0x2e, 0x41, 0x57, 0x53, 0x53, 0x4e, 0x53, 0x43, 0x6f, 0x6e, 0x6e, 0x48, 0x00, 0x52, 0x06, + 0x61, 0x77, 0x73, 0x53, 0x6e, 0x73, 0x12, 0x2e, 0x0a, 0x05, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x18, + 0x68, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, + 0x72, 0x67, 0x73, 0x2e, 0x4d, 0x6f, 0x6e, 0x67, 0x6f, 0x43, 0x6f, 0x6e, 0x6e, 0x48, 0x00, 0x52, + 0x05, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x12, 0x2b, 0x0a, 0x04, 0x6e, 0x61, 0x74, 0x73, 0x18, 0x69, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, + 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x48, 0x00, 0x52, 0x04, 0x6e, + 0x61, 0x74, 0x73, 0x12, 0x47, 0x0a, 0x0e, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x6a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x6e, 0x48, 0x00, 0x52, 0x0d, 0x6e, + 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x0a, 0x03, + 0x6e, 0x73, 0x71, 0x18, 0x6b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x53, 0x51, 0x43, 0x6f, 0x6e, 0x6e, 0x48, + 0x00, 0x52, 0x03, 0x6e, 0x73, 0x71, 0x12, 0x37, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, + 0x65, 0x73, 0x18, 0x6c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x43, + 0x6f, 0x6e, 0x6e, 0x48, 0x00, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x12, + 0x31, 0x0a, 0x06, 0x70, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x18, 0x6d, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x50, 0x75, + 0x6c, 0x73, 0x61, 0x72, 0x43, 0x6f, 0x6e, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x70, 0x75, 0x6c, 0x73, + 0x61, 0x72, 0x12, 0x31, 0x0a, 0x06, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x18, 0x6e, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, + 0x2e, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x72, + 0x61, 0x62, 0x62, 0x69, 0x74, 0x12, 0x47, 0x0a, 0x0e, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x5f, + 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x6f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x61, 0x62, 0x62, + 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x48, 0x00, 0x52, + 0x0d, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x41, + 0x0a, 0x0c, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x18, 0x70, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, + 0x67, 0x73, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x43, 0x6f, + 0x6e, 0x6e, 0x48, 0x00, 0x52, 0x0b, 0x72, 0x65, 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, 0x73, 0x75, + 0x62, 0x12, 0x44, 0x0a, 0x0d, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x73, 0x18, 0x71, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x48, 0x00, 0x52, 0x0c, 0x72, 0x65, 0x64, 0x69, 0x73, + 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x48, 0x0a, 0x0f, 0x61, 0x7a, 0x75, 0x72, 0x65, + 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x75, 0x62, 0x18, 0x72, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, + 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x75, 0x62, 0x43, 0x6f, 0x6e, 0x6e, + 0x48, 0x00, 0x52, 0x0d, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x75, + 0x62, 0x12, 0x4e, 0x0a, 0x11, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x5f, 0x62, 0x75, 0x73, 0x18, 0x73, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x7a, 0x75, 0x72, 0x65, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x48, 0x00, + 0x52, 0x0f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, + 0x73, 0x12, 0x2b, 0x0a, 0x04, 0x6d, 0x71, 0x74, 0x74, 0x18, 0x74, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4d, 0x51, + 0x54, 0x54, 0x43, 0x6f, 0x6e, 0x6e, 0x48, 0x00, 0x52, 0x04, 0x6d, 0x71, 0x74, 0x74, 0x12, 0x41, + 0x0a, 0x0c, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, 0x5f, 0x71, 0x75, 0x65, 0x75, 0x65, 0x18, 0x75, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, + 0x67, 0x73, 0x2e, 0x4b, 0x75, 0x62, 0x65, 0x4d, 0x51, 0x51, 0x75, 0x65, 0x75, 0x65, 0x43, 0x6f, + 0x6e, 0x6e, 0x48, 0x00, 0x52, 0x0b, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, 0x51, 0x75, 0x65, 0x75, + 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x67, 0x63, 0x70, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x18, + 0x76, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, + 0x72, 0x67, 0x73, 0x2e, 0x47, 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x43, 0x6f, 0x6e, + 0x6e, 0x48, 0x00, 0x52, 0x09, 0x67, 0x63, 0x70, 0x50, 0x75, 0x62, 0x73, 0x75, 0x62, 0x12, 0x47, + 0x0a, 0x0e, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x6a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x18, 0x77, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x43, 0x6f, 0x6e, 0x6e, 0x48, 0x00, 0x52, 0x0d, 0x6e, 0x61, 0x74, 0x73, 0x4a, 0x65, + 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x3e, 0x0a, 0x0b, 0x61, 0x77, 0x73, 0x5f, 0x6b, + 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x18, 0x78, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x4b, 0x69, + 0x6e, 0x65, 0x73, 0x69, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x48, 0x00, 0x52, 0x0a, 0x61, 0x77, 0x73, + 0x4b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x12, 0x34, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x70, 0x68, + 0x69, 0x73, 0x18, 0x79, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x43, 0x6f, + 0x6e, 0x6e, 0x48, 0x00, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x12, 0x10, 0x0a, + 0x03, 0x5f, 0x69, 0x64, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x64, 0x42, + 0x06, 0x0a, 0x04, 0x63, 0x6f, 0x6e, 0x6e, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, + 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, + 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, + 0x6f, 0x70, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_opts_ps_opts_connection_proto_rawDescOnce sync.Once + file_opts_ps_opts_connection_proto_rawDescData = file_opts_ps_opts_connection_proto_rawDesc +) -func (m *ConnectionOptions) GetMemphis() *args.MemphisConn { - if x, ok := m.GetConn().(*ConnectionOptions_Memphis); ok { - return x.Memphis +func file_opts_ps_opts_connection_proto_rawDescGZIP() []byte { + file_opts_ps_opts_connection_proto_rawDescOnce.Do(func() { + file_opts_ps_opts_connection_proto_rawDescData = protoimpl.X.CompressGZIP(file_opts_ps_opts_connection_proto_rawDescData) + }) + return file_opts_ps_opts_connection_proto_rawDescData +} + +var file_opts_ps_opts_connection_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_opts_ps_opts_connection_proto_goTypes = []interface{}{ + (*ConnectionOptions)(nil), // 0: protos.opts.ConnectionOptions + (*args.KafkaConn)(nil), // 1: protos.args.KafkaConn + (*args.ActiveMQConn)(nil), // 2: protos.args.ActiveMQConn + (*args.AWSSQSConn)(nil), // 3: protos.args.AWSSQSConn + (*args.AWSSNSConn)(nil), // 4: protos.args.AWSSNSConn + (*args.MongoConn)(nil), // 5: protos.args.MongoConn + (*args.NatsConn)(nil), // 6: protos.args.NatsConn + (*args.NatsStreamingConn)(nil), // 7: protos.args.NatsStreamingConn + (*args.NSQConn)(nil), // 8: protos.args.NSQConn + (*args.PostgresConn)(nil), // 9: protos.args.PostgresConn + (*args.PulsarConn)(nil), // 10: protos.args.PulsarConn + (*args.RabbitConn)(nil), // 11: protos.args.RabbitConn + (*args.RabbitStreamsConn)(nil), // 12: protos.args.RabbitStreamsConn + (*args.RedisPubSubConn)(nil), // 13: protos.args.RedisPubSubConn + (*args.RedisStreamsConn)(nil), // 14: protos.args.RedisStreamsConn + (*args.AzureEventHubConn)(nil), // 15: protos.args.AzureEventHubConn + (*args.AzureServiceBusConn)(nil), // 16: protos.args.AzureServiceBusConn + (*args.MQTTConn)(nil), // 17: protos.args.MQTTConn + (*args.KubeMQQueueConn)(nil), // 18: protos.args.KubeMQQueueConn + (*args.GCPPubSubConn)(nil), // 19: protos.args.GCPPubSubConn + (*args.NatsJetstreamConn)(nil), // 20: protos.args.NatsJetstreamConn + (*args.AWSKinesisConn)(nil), // 21: protos.args.AWSKinesisConn + (*args.MemphisConn)(nil), // 22: protos.args.MemphisConn +} +var file_opts_ps_opts_connection_proto_depIdxs = []int32{ + 1, // 0: protos.opts.ConnectionOptions.kafka:type_name -> protos.args.KafkaConn + 2, // 1: protos.opts.ConnectionOptions.active_mq:type_name -> protos.args.ActiveMQConn + 3, // 2: protos.opts.ConnectionOptions.aws_sqs:type_name -> protos.args.AWSSQSConn + 4, // 3: protos.opts.ConnectionOptions.aws_sns:type_name -> protos.args.AWSSNSConn + 5, // 4: protos.opts.ConnectionOptions.mongo:type_name -> protos.args.MongoConn + 6, // 5: protos.opts.ConnectionOptions.nats:type_name -> protos.args.NatsConn + 7, // 6: protos.opts.ConnectionOptions.nats_streaming:type_name -> protos.args.NatsStreamingConn + 8, // 7: protos.opts.ConnectionOptions.nsq:type_name -> protos.args.NSQConn + 9, // 8: protos.opts.ConnectionOptions.postgres:type_name -> protos.args.PostgresConn + 10, // 9: protos.opts.ConnectionOptions.pulsar:type_name -> protos.args.PulsarConn + 11, // 10: protos.opts.ConnectionOptions.rabbit:type_name -> protos.args.RabbitConn + 12, // 11: protos.opts.ConnectionOptions.rabbit_streams:type_name -> protos.args.RabbitStreamsConn + 13, // 12: protos.opts.ConnectionOptions.redis_pubsub:type_name -> protos.args.RedisPubSubConn + 14, // 13: protos.opts.ConnectionOptions.redis_streams:type_name -> protos.args.RedisStreamsConn + 15, // 14: protos.opts.ConnectionOptions.azure_event_hub:type_name -> protos.args.AzureEventHubConn + 16, // 15: protos.opts.ConnectionOptions.azure_service_bus:type_name -> protos.args.AzureServiceBusConn + 17, // 16: protos.opts.ConnectionOptions.mqtt:type_name -> protos.args.MQTTConn + 18, // 17: protos.opts.ConnectionOptions.kubemq_queue:type_name -> protos.args.KubeMQQueueConn + 19, // 18: protos.opts.ConnectionOptions.gcp_pubsub:type_name -> protos.args.GCPPubSubConn + 20, // 19: protos.opts.ConnectionOptions.nats_jetstream:type_name -> protos.args.NatsJetstreamConn + 21, // 20: protos.opts.ConnectionOptions.aws_kinesis:type_name -> protos.args.AWSKinesisConn + 22, // 21: protos.opts.ConnectionOptions.memphis:type_name -> protos.args.MemphisConn + 22, // [22:22] is the sub-list for method output_type + 22, // [22:22] is the sub-list for method input_type + 22, // [22:22] is the sub-list for extension type_name + 22, // [22:22] is the sub-list for extension extendee + 0, // [0:22] is the sub-list for field type_name +} + +func init() { file_opts_ps_opts_connection_proto_init() } +func file_opts_ps_opts_connection_proto_init() { + if File_opts_ps_opts_connection_proto != nil { + return } - return nil -} - -func (m *ConnectionOptions) GetXId() string { - if m != nil { - return m.XId + if !protoimpl.UnsafeEnabled { + file_opts_ps_opts_connection_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConnectionOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } - return "" -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*ConnectionOptions) XXX_OneofWrappers() []interface{} { - return []interface{}{ + file_opts_ps_opts_connection_proto_msgTypes[0].OneofWrappers = []interface{}{ (*ConnectionOptions_Kafka)(nil), (*ConnectionOptions_ActiveMq)(nil), (*ConnectionOptions_AwsSqs)(nil), @@ -428,65 +663,22 @@ func (*ConnectionOptions) XXX_OneofWrappers() []interface{} { (*ConnectionOptions_AwsKinesis)(nil), (*ConnectionOptions_Memphis)(nil), } -} - -func init() { - proto.RegisterType((*ConnectionOptions)(nil), "protos.opts.ConnectionOptions") -} - -func init() { proto.RegisterFile("opts/ps_opts_connection.proto", fileDescriptor_894e2be3fdae18cb) } - -var fileDescriptor_894e2be3fdae18cb = []byte{ - // 801 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x56, 0x5b, 0x4f, 0x13, 0x4f, - 0x14, 0xff, 0x73, 0x2b, 0x30, 0xfd, 0x57, 0x65, 0x82, 0x30, 0x14, 0xc1, 0x4a, 0x7c, 0x20, 0x31, - 0xb6, 0x11, 0x4d, 0xd4, 0x90, 0x98, 0x00, 0x1a, 0x50, 0x52, 0x6c, 0x59, 0x12, 0x13, 0x5f, 0x36, - 0xbb, 0xdb, 0x61, 0xbb, 0xb4, 0x3b, 0x7b, 0x99, 0x99, 0x56, 0xfd, 0xc4, 0x3e, 0xfa, 0x11, 0xcc, - 0xdc, 0x4a, 0x87, 0x0e, 0xbe, 0x74, 0xbb, 0xe7, 0x77, 0x99, 0x33, 0x67, 0xce, 0xcc, 0x2c, 0xd8, - 0xc9, 0x72, 0x46, 0x5b, 0x39, 0xf5, 0xc5, 0xd3, 0x8f, 0x32, 0x42, 0x70, 0xc4, 0x92, 0x8c, 0x34, - 0xf3, 0x32, 0x63, 0x19, 0xac, 0xca, 0x07, 0x6d, 0x0a, 0xb4, 0xbe, 0x1d, 0x94, 0xb1, 0xe4, 0x8a, - 0xa7, 0x1f, 0x44, 0x2c, 0x19, 0xe1, 0xb4, 0x50, 0xcc, 0xfa, 0xae, 0x0d, 0x8e, 0xa9, 0x3f, 0x48, - 0x08, 0xa6, 0x09, 0xd5, 0x78, 0x7d, 0x06, 0xa7, 0xe4, 0x1f, 0x58, 0x61, 0xb0, 0x3d, 0x1b, 0xfb, - 0xc5, 0x4b, 0xec, 0xe3, 0x11, 0x26, 0xcc, 0xef, 0xf3, 0x50, 0x73, 0x9e, 0x3b, 0x38, 0x14, 0x97, - 0xa3, 0x24, 0xc2, 0x7e, 0xc8, 0x8d, 0xd3, 0x8e, 0xc5, 0x8a, 0xa3, 0xdc, 0xcf, 0x79, 0x48, 0x27, - 0x26, 0xc8, 0x82, 0x07, 0xc1, 0xf5, 0x20, 0xd0, 0xc8, 0x53, 0x1b, 0xe1, 0x21, 0x4e, 0x0b, 0xbf, - 0xe0, 0x98, 0x63, 0x67, 0xfe, 0x29, 0x4e, 0xf3, 0xfe, 0x64, 0xde, 0xb6, 0x6d, 0x9a, 0x91, 0x38, - 0xd3, 0xc8, 0xa6, 0x8d, 0x14, 0x8c, 0x39, 0x01, 0x12, 0x30, 0xe3, 0xf5, 0x6c, 0x06, 0xf0, 0x6f, - 0x30, 0xa3, 0xac, 0xc4, 0x41, 0x7a, 0x3f, 0x45, 0xe1, 0x09, 0x89, 0x35, 0x65, 0xc3, 0xa6, 0x50, - 0xb3, 0x82, 0xf6, 0xf2, 0xe6, 0x19, 0x65, 0x71, 0x89, 0xcd, 0xd0, 0x5b, 0x36, 0xc8, 0x87, 0x34, - 0x28, 0x9d, 0x50, 0x19, 0x84, 0x61, 0xc2, 0x9c, 0xd9, 0x28, 0x48, 0xe7, 0x43, 0x9d, 0xc5, 0x2d, - 0x71, 0x2f, 0xa1, 0xf6, 0xba, 0x34, 0x1c, 0x04, 0xcb, 0x62, 0xef, 0x0f, 0x00, 0x6b, 0x27, 0x93, - 0xce, 0xfd, 0x9a, 0x8b, 0x5f, 0x0a, 0x21, 0x58, 0x24, 0x41, 0x8a, 0xd1, 0x5c, 0x63, 0x6e, 0x7f, - 0xf5, 0x52, 0xfe, 0x87, 0xeb, 0x60, 0x89, 0x64, 0x0c, 0x53, 0x34, 0x2f, 0x83, 0xea, 0x05, 0x36, - 0xc1, 0x92, 0x5c, 0x6e, 0xd4, 0x6b, 0xcc, 0xed, 0x57, 0x0f, 0x36, 0x9a, 0xba, 0xe9, 0xc5, 0x80, - 0xcd, 0x73, 0x81, 0x08, 0xf7, 0xb3, 0xff, 0x2e, 0x15, 0x0d, 0xbe, 0x03, 0xab, 0xaa, 0xf9, 0xfd, - 0xb4, 0x40, 0x58, 0x6a, 0xb6, 0x2c, 0xcd, 0x91, 0x44, 0xdb, 0x5d, 0x2d, 0x5b, 0x51, 0xec, 0x76, - 0x01, 0x0f, 0xc0, 0xb2, 0xee, 0x6e, 0x74, 0x2d, 0x75, 0x9b, 0xb6, 0xee, 0x9b, 0xe7, 0x75, 0x3d, - 0xad, 0xaa, 0x04, 0x63, 0xea, 0x15, 0x74, 0xa2, 0x21, 0x14, 0xc5, 0xf7, 0x68, 0x2e, 0x2c, 0x0d, - 0x91, 0x33, 0x92, 0x9d, 0x86, 0xfa, 0x8e, 0x19, 0xb5, 0x05, 0x62, 0x66, 0x24, 0x69, 0xf0, 0x85, - 0xa8, 0x15, 0xa3, 0x28, 0x91, 0xf4, 0xc7, 0x16, 0xfd, 0x22, 0x60, 0x54, 0xb3, 0x25, 0x09, 0x9e, - 0x82, 0x07, 0x76, 0x5f, 0xa1, 0x1b, 0x29, 0xdb, 0x9d, 0x91, 0x79, 0x86, 0xa1, 0xf5, 0x35, 0x32, - 0x1d, 0x84, 0xfb, 0x60, 0x81, 0xd0, 0x02, 0x0d, 0xa4, 0x7a, 0xdd, 0x56, 0x7b, 0xa6, 0x78, 0x82, - 0x02, 0xdf, 0x82, 0x15, 0xd3, 0x8f, 0x68, 0xe8, 0x28, 0x78, 0x47, 0x83, 0xa6, 0xe0, 0x86, 0x0c, - 0x5f, 0x81, 0x8a, 0xea, 0x55, 0x94, 0x3a, 0x6a, 0xd7, 0x91, 0x90, 0xa9, 0x9d, 0x22, 0x0a, 0x89, - 0x6a, 0x54, 0x44, 0x1c, 0x92, 0x4b, 0x09, 0x19, 0x89, 0x22, 0x8a, 0x8a, 0xd8, 0xbd, 0x8d, 0x32, - 0x47, 0x45, 0x94, 0x54, 0x4d, 0xdf, 0x64, 0x5a, 0x2b, 0xa7, 0x83, 0xf0, 0x08, 0xfc, 0x3f, 0xbd, - 0x03, 0x50, 0x2e, 0x6d, 0x9e, 0xd8, 0x36, 0x82, 0xd0, 0xe1, 0xa1, 0xc7, 0x43, 0x6d, 0x52, 0x2d, - 0x75, 0x88, 0xf2, 0x10, 0x7e, 0x04, 0x35, 0x6b, 0x8f, 0xa0, 0x42, 0x7a, 0xec, 0xcc, 0x7a, 0xd8, - 0x99, 0xa8, 0x81, 0x4d, 0x22, 0x67, 0xe0, 0xe1, 0x9d, 0xa3, 0x16, 0x95, 0x8e, 0x29, 0x1d, 0x09, - 0xce, 0x27, 0x41, 0x39, 0x9b, 0x64, 0x53, 0x0b, 0xa6, 0x83, 0xf0, 0x02, 0xac, 0xcd, 0x1c, 0xc8, - 0x88, 0x4a, 0xaf, 0xc6, 0xac, 0x97, 0xa7, 0x48, 0xc7, 0xdc, 0xa4, 0xa5, 0xd2, 0xb8, 0x0d, 0x8b, - 0x56, 0x15, 0x47, 0x25, 0x62, 0x8e, 0x56, 0x6d, 0x77, 0xaf, 0xae, 0x4c, 0xab, 0x0a, 0x92, 0xa8, - 0xe7, 0xf4, 0x71, 0x8d, 0xb8, 0xa3, 0x9e, 0xe7, 0x3c, 0xc4, 0xed, 0x6e, 0x57, 0xe0, 0xa6, 0x9e, - 0x4a, 0x23, 0x43, 0xf0, 0x10, 0x80, 0xdb, 0xab, 0x02, 0x8d, 0xa4, 0x41, 0xdd, 0x32, 0x38, 0x3d, - 0xe9, 0x58, 0xcb, 0xb1, 0x1a, 0x47, 0xb9, 0x5e, 0x0c, 0xb3, 0x55, 0x26, 0xa7, 0x34, 0x1a, 0xdf, - 0xb3, 0x55, 0xbe, 0x18, 0xc6, 0xf4, 0x56, 0x99, 0x04, 0xe1, 0x07, 0x50, 0x9d, 0xba, 0x52, 0xd1, - 0x0f, 0xe9, 0xb2, 0x7d, 0xf7, 0x20, 0x38, 0x57, 0xb0, 0xb6, 0x00, 0xc1, 0x98, 0xea, 0x08, 0x7c, - 0x03, 0x96, 0xf5, 0xb5, 0x84, 0x7e, 0x4a, 0x2d, 0xb2, 0x0b, 0xa7, 0x30, 0x2d, 0x34, 0x54, 0xf8, - 0x08, 0x2c, 0xf8, 0x49, 0x0f, 0xfd, 0x5e, 0x96, 0xa7, 0xe5, 0xfc, 0xe7, 0xde, 0x71, 0x05, 0x2c, - 0x8a, 0x6f, 0x84, 0xe3, 0xc3, 0xef, 0xef, 0xe3, 0x84, 0x89, 0x1b, 0x38, 0xca, 0xd2, 0x56, 0x18, - 0xb0, 0xa8, 0x1f, 0x65, 0x65, 0xde, 0xca, 0x87, 0x3c, 0x0d, 0x71, 0xf9, 0x92, 0x46, 0x7d, 0x9c, - 0x06, 0xb4, 0x15, 0xf2, 0x64, 0xd8, 0x6b, 0xc5, 0x59, 0x4b, 0x8d, 0xd6, 0x12, 0xdf, 0x11, 0x61, - 0x45, 0xbe, 0xbc, 0xfe, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x35, 0x8b, 0xeb, 0xcc, 0x7c, 0x08, 0x00, - 0x00, + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_opts_ps_opts_connection_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_opts_ps_opts_connection_proto_goTypes, + DependencyIndexes: file_opts_ps_opts_connection_proto_depIdxs, + MessageInfos: file_opts_ps_opts_connection_proto_msgTypes, + }.Build() + File_opts_ps_opts_connection_proto = out.File + file_opts_ps_opts_connection_proto_rawDesc = nil + file_opts_ps_opts_connection_proto_goTypes = nil + file_opts_ps_opts_connection_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_manage.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_manage.pb.go index b091a8969..4b62a04b8 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_manage.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_manage.pb.go @@ -1,26 +1,30 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: opts/ps_opts_manage.proto package opts import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type ManageOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" GlobalOptions *GlobalManageOptions `protobuf:"bytes,1,opt,name=global_options,json=globalOptions,proto3" json:"global_options,omitempty" kong:"embed"` // @gotags: kong:"cmd,help='Get resource(s) from plumber server'" @@ -32,80 +36,88 @@ type ManageOptions struct { // @gotags: kong:"cmd,help='Stop resources in plumber server'" Stop *StopOptions `protobuf:"bytes,6,opt,name=stop,proto3" json:"stop,omitempty" kong:"cmd,help='Stop resources in plumber server'"` // @gotags: kong:"cmd,help='Resume/Start resources in plumber server'" - Resume *ResumeOptions `protobuf:"bytes,7,opt,name=resume,proto3" json:"resume,omitempty" kong:"cmd,help='Resume/Start resources in plumber server'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Resume *ResumeOptions `protobuf:"bytes,7,opt,name=resume,proto3" json:"resume,omitempty" kong:"cmd,help='Resume/Start resources in plumber server'"` } -func (m *ManageOptions) Reset() { *m = ManageOptions{} } -func (m *ManageOptions) String() string { return proto.CompactTextString(m) } -func (*ManageOptions) ProtoMessage() {} -func (*ManageOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_1d5f0e150eafe5f0, []int{0} +func (x *ManageOptions) Reset() { + *x = ManageOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_manage_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ManageOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ManageOptions.Unmarshal(m, b) -} -func (m *ManageOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ManageOptions.Marshal(b, m, deterministic) +func (x *ManageOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ManageOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ManageOptions.Merge(m, src) -} -func (m *ManageOptions) XXX_Size() int { - return xxx_messageInfo_ManageOptions.Size(m) -} -func (m *ManageOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ManageOptions.DiscardUnknown(m) + +func (*ManageOptions) ProtoMessage() {} + +func (x *ManageOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_manage_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ManageOptions proto.InternalMessageInfo +// Deprecated: Use ManageOptions.ProtoReflect.Descriptor instead. +func (*ManageOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_manage_proto_rawDescGZIP(), []int{0} +} -func (m *ManageOptions) GetGlobalOptions() *GlobalManageOptions { - if m != nil { - return m.GlobalOptions +func (x *ManageOptions) GetGlobalOptions() *GlobalManageOptions { + if x != nil { + return x.GlobalOptions } return nil } -func (m *ManageOptions) GetGet() *GetOptions { - if m != nil { - return m.Get +func (x *ManageOptions) GetGet() *GetOptions { + if x != nil { + return x.Get } return nil } -func (m *ManageOptions) GetCreate() *CreateOptions { - if m != nil { - return m.Create +func (x *ManageOptions) GetCreate() *CreateOptions { + if x != nil { + return x.Create } return nil } -func (m *ManageOptions) GetDelete() *DeleteOptions { - if m != nil { - return m.Delete +func (x *ManageOptions) GetDelete() *DeleteOptions { + if x != nil { + return x.Delete } return nil } -func (m *ManageOptions) GetStop() *StopOptions { - if m != nil { - return m.Stop +func (x *ManageOptions) GetStop() *StopOptions { + if x != nil { + return x.Stop } return nil } -func (m *ManageOptions) GetResume() *ResumeOptions { - if m != nil { - return m.Resume +func (x *ManageOptions) GetResume() *ResumeOptions { + if x != nil { + return x.Resume } return nil } type GlobalManageOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Plumber server gRPC API address',default='localhost:9090'" ManageAddress string `protobuf:"bytes,1,opt,name=manage_address,json=manageAddress,proto3" json:"manage_address,omitempty" kong:"help='Plumber server gRPC API address',default='localhost:9090'"` // @gotags: kong:"help='Plumber server auth token',default='streamdal'" @@ -123,426 +135,707 @@ type GlobalManageOptions struct { // @gotags: kong:"help='TLS client key file'" ManageTlsKeyFile string `protobuf:"bytes,8,opt,name=manage_tls_key_file,json=manageTlsKeyFile,proto3" json:"manage_tls_key_file,omitempty" kong:"help='TLS client key file'"` // @gotags: kong:"help='Disable pretty/colorized output',default='false'" - DisablePretty bool `protobuf:"varint,9,opt,name=disable_pretty,json=disablePretty,proto3" json:"disable_pretty,omitempty" kong:"help='Disable pretty/colorized output',default='false'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + DisablePretty bool `protobuf:"varint,9,opt,name=disable_pretty,json=disablePretty,proto3" json:"disable_pretty,omitempty" kong:"help='Disable pretty/colorized output',default='false'"` } -func (m *GlobalManageOptions) Reset() { *m = GlobalManageOptions{} } -func (m *GlobalManageOptions) String() string { return proto.CompactTextString(m) } -func (*GlobalManageOptions) ProtoMessage() {} -func (*GlobalManageOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_1d5f0e150eafe5f0, []int{1} +func (x *GlobalManageOptions) Reset() { + *x = GlobalManageOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_manage_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GlobalManageOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GlobalManageOptions.Unmarshal(m, b) +func (x *GlobalManageOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GlobalManageOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GlobalManageOptions.Marshal(b, m, deterministic) -} -func (m *GlobalManageOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_GlobalManageOptions.Merge(m, src) -} -func (m *GlobalManageOptions) XXX_Size() int { - return xxx_messageInfo_GlobalManageOptions.Size(m) -} -func (m *GlobalManageOptions) XXX_DiscardUnknown() { - xxx_messageInfo_GlobalManageOptions.DiscardUnknown(m) + +func (*GlobalManageOptions) ProtoMessage() {} + +func (x *GlobalManageOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_manage_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_GlobalManageOptions proto.InternalMessageInfo +// Deprecated: Use GlobalManageOptions.ProtoReflect.Descriptor instead. +func (*GlobalManageOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_manage_proto_rawDescGZIP(), []int{1} +} -func (m *GlobalManageOptions) GetManageAddress() string { - if m != nil { - return m.ManageAddress +func (x *GlobalManageOptions) GetManageAddress() string { + if x != nil { + return x.ManageAddress } return "" } -func (m *GlobalManageOptions) GetManageToken() string { - if m != nil { - return m.ManageToken +func (x *GlobalManageOptions) GetManageToken() string { + if x != nil { + return x.ManageToken } return "" } -func (m *GlobalManageOptions) GetManageTimeoutSeconds() int64 { - if m != nil { - return m.ManageTimeoutSeconds +func (x *GlobalManageOptions) GetManageTimeoutSeconds() int64 { + if x != nil { + return x.ManageTimeoutSeconds } return 0 } -func (m *GlobalManageOptions) GetManageUseTls() bool { - if m != nil { - return m.ManageUseTls +func (x *GlobalManageOptions) GetManageUseTls() bool { + if x != nil { + return x.ManageUseTls } return false } -func (m *GlobalManageOptions) GetManageInsecureTls() bool { - if m != nil { - return m.ManageInsecureTls +func (x *GlobalManageOptions) GetManageInsecureTls() bool { + if x != nil { + return x.ManageInsecureTls } return false } -func (m *GlobalManageOptions) GetManageTlsCaFile() string { - if m != nil { - return m.ManageTlsCaFile +func (x *GlobalManageOptions) GetManageTlsCaFile() string { + if x != nil { + return x.ManageTlsCaFile } return "" } -func (m *GlobalManageOptions) GetManageTlsCertFile() string { - if m != nil { - return m.ManageTlsCertFile +func (x *GlobalManageOptions) GetManageTlsCertFile() string { + if x != nil { + return x.ManageTlsCertFile } return "" } -func (m *GlobalManageOptions) GetManageTlsKeyFile() string { - if m != nil { - return m.ManageTlsKeyFile +func (x *GlobalManageOptions) GetManageTlsKeyFile() string { + if x != nil { + return x.ManageTlsKeyFile } return "" } -func (m *GlobalManageOptions) GetDisablePretty() bool { - if m != nil { - return m.DisablePretty +func (x *GlobalManageOptions) GetDisablePretty() bool { + if x != nil { + return x.DisablePretty } return false } type GetOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"cmd,help='Get connection(s) from plumber server'" Connection *GetConnectionOptions `protobuf:"bytes,1,opt,name=connection,proto3" json:"connection,omitempty" kong:"cmd,help='Get connection(s) from plumber server'"` // @gotags: kong:"cmd,help='Get relay(s) from plumber server'" Relay *GetRelayOptions `protobuf:"bytes,2,opt,name=relay,proto3" json:"relay,omitempty" kong:"cmd,help='Get relay(s) from plumber server'"` // @gotags: kong:"cmd,help='Get tunnel(s) from plumber server'" - Tunnel *GetTunnelOptions `protobuf:"bytes,3,opt,name=tunnel,proto3" json:"tunnel,omitempty" kong:"cmd,help='Get tunnel(s) from plumber server'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Tunnel *GetTunnelOptions `protobuf:"bytes,3,opt,name=tunnel,proto3" json:"tunnel,omitempty" kong:"cmd,help='Get tunnel(s) from plumber server'"` } -func (m *GetOptions) Reset() { *m = GetOptions{} } -func (m *GetOptions) String() string { return proto.CompactTextString(m) } -func (*GetOptions) ProtoMessage() {} -func (*GetOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_1d5f0e150eafe5f0, []int{2} +func (x *GetOptions) Reset() { + *x = GetOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_manage_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GetOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetOptions.Unmarshal(m, b) +func (x *GetOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GetOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetOptions.Marshal(b, m, deterministic) -} -func (m *GetOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetOptions.Merge(m, src) -} -func (m *GetOptions) XXX_Size() int { - return xxx_messageInfo_GetOptions.Size(m) -} -func (m *GetOptions) XXX_DiscardUnknown() { - xxx_messageInfo_GetOptions.DiscardUnknown(m) + +func (*GetOptions) ProtoMessage() {} + +func (x *GetOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_manage_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_GetOptions proto.InternalMessageInfo +// Deprecated: Use GetOptions.ProtoReflect.Descriptor instead. +func (*GetOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_manage_proto_rawDescGZIP(), []int{2} +} -func (m *GetOptions) GetConnection() *GetConnectionOptions { - if m != nil { - return m.Connection +func (x *GetOptions) GetConnection() *GetConnectionOptions { + if x != nil { + return x.Connection } return nil } -func (m *GetOptions) GetRelay() *GetRelayOptions { - if m != nil { - return m.Relay +func (x *GetOptions) GetRelay() *GetRelayOptions { + if x != nil { + return x.Relay } return nil } -func (m *GetOptions) GetTunnel() *GetTunnelOptions { - if m != nil { - return m.Tunnel +func (x *GetOptions) GetTunnel() *GetTunnelOptions { + if x != nil { + return x.Tunnel } return nil } type CreateOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"cmd,help='Create connection in plumber server'" Connection *CreateConnectionOptions `protobuf:"bytes,1,opt,name=connection,proto3" json:"connection,omitempty" kong:"cmd,help='Create connection in plumber server'"` // @gotags: kong:"cmd,help='Create relay in plumber server'" Relay *CreateRelayOptions `protobuf:"bytes,2,opt,name=relay,proto3" json:"relay,omitempty" kong:"cmd,help='Create relay in plumber server'"` // @gotags: kong:"cmd,help='Create tunnel in plumber server'" - Tunnel *CreateTunnelOptions `protobuf:"bytes,3,opt,name=tunnel,proto3" json:"tunnel,omitempty" kong:"cmd,help='Create tunnel in plumber server'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Tunnel *CreateTunnelOptions `protobuf:"bytes,3,opt,name=tunnel,proto3" json:"tunnel,omitempty" kong:"cmd,help='Create tunnel in plumber server'"` } -func (m *CreateOptions) Reset() { *m = CreateOptions{} } -func (m *CreateOptions) String() string { return proto.CompactTextString(m) } -func (*CreateOptions) ProtoMessage() {} -func (*CreateOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_1d5f0e150eafe5f0, []int{3} +func (x *CreateOptions) Reset() { + *x = CreateOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_manage_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *CreateOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateOptions.Unmarshal(m, b) -} -func (m *CreateOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateOptions.Marshal(b, m, deterministic) -} -func (m *CreateOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateOptions.Merge(m, src) +func (x *CreateOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CreateOptions) XXX_Size() int { - return xxx_messageInfo_CreateOptions.Size(m) -} -func (m *CreateOptions) XXX_DiscardUnknown() { - xxx_messageInfo_CreateOptions.DiscardUnknown(m) + +func (*CreateOptions) ProtoMessage() {} + +func (x *CreateOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_manage_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_CreateOptions proto.InternalMessageInfo +// Deprecated: Use CreateOptions.ProtoReflect.Descriptor instead. +func (*CreateOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_manage_proto_rawDescGZIP(), []int{3} +} -func (m *CreateOptions) GetConnection() *CreateConnectionOptions { - if m != nil { - return m.Connection +func (x *CreateOptions) GetConnection() *CreateConnectionOptions { + if x != nil { + return x.Connection } return nil } -func (m *CreateOptions) GetRelay() *CreateRelayOptions { - if m != nil { - return m.Relay +func (x *CreateOptions) GetRelay() *CreateRelayOptions { + if x != nil { + return x.Relay } return nil } -func (m *CreateOptions) GetTunnel() *CreateTunnelOptions { - if m != nil { - return m.Tunnel +func (x *CreateOptions) GetTunnel() *CreateTunnelOptions { + if x != nil { + return x.Tunnel } return nil } type DeleteOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"cmd,help='Delete connection in plumber server'" Connection *DeleteConnectionOptions `protobuf:"bytes,1,opt,name=connection,proto3" json:"connection,omitempty" kong:"cmd,help='Delete connection in plumber server'"` // @gotags: kong:"cmd,help='Delete relay in plumber server'" Relay *DeleteRelayOptions `protobuf:"bytes,2,opt,name=relay,proto3" json:"relay,omitempty" kong:"cmd,help='Delete relay in plumber server'"` // @gotags: kong:"cmd,help='Delete tunnel in plumber server'" - Tunnel *DeleteTunnelOptions `protobuf:"bytes,3,opt,name=tunnel,proto3" json:"tunnel,omitempty" kong:"cmd,help='Delete tunnel in plumber server'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Tunnel *DeleteTunnelOptions `protobuf:"bytes,3,opt,name=tunnel,proto3" json:"tunnel,omitempty" kong:"cmd,help='Delete tunnel in plumber server'"` } -func (m *DeleteOptions) Reset() { *m = DeleteOptions{} } -func (m *DeleteOptions) String() string { return proto.CompactTextString(m) } -func (*DeleteOptions) ProtoMessage() {} -func (*DeleteOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_1d5f0e150eafe5f0, []int{4} +func (x *DeleteOptions) Reset() { + *x = DeleteOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_manage_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *DeleteOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeleteOptions.Unmarshal(m, b) -} -func (m *DeleteOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeleteOptions.Marshal(b, m, deterministic) -} -func (m *DeleteOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteOptions.Merge(m, src) +func (x *DeleteOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *DeleteOptions) XXX_Size() int { - return xxx_messageInfo_DeleteOptions.Size(m) -} -func (m *DeleteOptions) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteOptions.DiscardUnknown(m) + +func (*DeleteOptions) ProtoMessage() {} + +func (x *DeleteOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_manage_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_DeleteOptions proto.InternalMessageInfo +// Deprecated: Use DeleteOptions.ProtoReflect.Descriptor instead. +func (*DeleteOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_manage_proto_rawDescGZIP(), []int{4} +} -func (m *DeleteOptions) GetConnection() *DeleteConnectionOptions { - if m != nil { - return m.Connection +func (x *DeleteOptions) GetConnection() *DeleteConnectionOptions { + if x != nil { + return x.Connection } return nil } -func (m *DeleteOptions) GetRelay() *DeleteRelayOptions { - if m != nil { - return m.Relay +func (x *DeleteOptions) GetRelay() *DeleteRelayOptions { + if x != nil { + return x.Relay } return nil } -func (m *DeleteOptions) GetTunnel() *DeleteTunnelOptions { - if m != nil { - return m.Tunnel +func (x *DeleteOptions) GetTunnel() *DeleteTunnelOptions { + if x != nil { + return x.Tunnel } return nil } type StopOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"cmd,help='Stop relay in plumber server'" Relay *StopRelayOptions `protobuf:"bytes,1,opt,name=relay,proto3" json:"relay,omitempty" kong:"cmd,help='Stop relay in plumber server'"` // @gotags: kong:"cmd,help='Stop tunnel in plumber server'" - Tunnel *StopTunnelOptions `protobuf:"bytes,2,opt,name=tunnel,proto3" json:"tunnel,omitempty" kong:"cmd,help='Stop tunnel in plumber server'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Tunnel *StopTunnelOptions `protobuf:"bytes,2,opt,name=tunnel,proto3" json:"tunnel,omitempty" kong:"cmd,help='Stop tunnel in plumber server'"` } -func (m *StopOptions) Reset() { *m = StopOptions{} } -func (m *StopOptions) String() string { return proto.CompactTextString(m) } -func (*StopOptions) ProtoMessage() {} -func (*StopOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_1d5f0e150eafe5f0, []int{5} +func (x *StopOptions) Reset() { + *x = StopOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_manage_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *StopOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StopOptions.Unmarshal(m, b) -} -func (m *StopOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StopOptions.Marshal(b, m, deterministic) -} -func (m *StopOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_StopOptions.Merge(m, src) -} -func (m *StopOptions) XXX_Size() int { - return xxx_messageInfo_StopOptions.Size(m) +func (x *StopOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *StopOptions) XXX_DiscardUnknown() { - xxx_messageInfo_StopOptions.DiscardUnknown(m) + +func (*StopOptions) ProtoMessage() {} + +func (x *StopOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_manage_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_StopOptions proto.InternalMessageInfo +// Deprecated: Use StopOptions.ProtoReflect.Descriptor instead. +func (*StopOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_manage_proto_rawDescGZIP(), []int{5} +} -func (m *StopOptions) GetRelay() *StopRelayOptions { - if m != nil { - return m.Relay +func (x *StopOptions) GetRelay() *StopRelayOptions { + if x != nil { + return x.Relay } return nil } -func (m *StopOptions) GetTunnel() *StopTunnelOptions { - if m != nil { - return m.Tunnel +func (x *StopOptions) GetTunnel() *StopTunnelOptions { + if x != nil { + return x.Tunnel } return nil } type ResumeOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"cmd,help='Resume/Start relay in plumber server'" Relay *ResumeRelayOptions `protobuf:"bytes,1,opt,name=relay,proto3" json:"relay,omitempty" kong:"cmd,help='Resume/Start relay in plumber server'"` // @gotags: kong:"cmd,help='Resume/Start tunnel in plumber server'" - Tunnel *ResumeTunnelOptions `protobuf:"bytes,2,opt,name=tunnel,proto3" json:"tunnel,omitempty" kong:"cmd,help='Resume/Start tunnel in plumber server'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Tunnel *ResumeTunnelOptions `protobuf:"bytes,2,opt,name=tunnel,proto3" json:"tunnel,omitempty" kong:"cmd,help='Resume/Start tunnel in plumber server'"` } -func (m *ResumeOptions) Reset() { *m = ResumeOptions{} } -func (m *ResumeOptions) String() string { return proto.CompactTextString(m) } -func (*ResumeOptions) ProtoMessage() {} -func (*ResumeOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_1d5f0e150eafe5f0, []int{6} +func (x *ResumeOptions) Reset() { + *x = ResumeOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_manage_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ResumeOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ResumeOptions.Unmarshal(m, b) -} -func (m *ResumeOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ResumeOptions.Marshal(b, m, deterministic) -} -func (m *ResumeOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResumeOptions.Merge(m, src) +func (x *ResumeOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ResumeOptions) XXX_Size() int { - return xxx_messageInfo_ResumeOptions.Size(m) -} -func (m *ResumeOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ResumeOptions.DiscardUnknown(m) + +func (*ResumeOptions) ProtoMessage() {} + +func (x *ResumeOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_manage_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ResumeOptions proto.InternalMessageInfo +// Deprecated: Use ResumeOptions.ProtoReflect.Descriptor instead. +func (*ResumeOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_manage_proto_rawDescGZIP(), []int{6} +} -func (m *ResumeOptions) GetRelay() *ResumeRelayOptions { - if m != nil { - return m.Relay +func (x *ResumeOptions) GetRelay() *ResumeRelayOptions { + if x != nil { + return x.Relay } return nil } -func (m *ResumeOptions) GetTunnel() *ResumeTunnelOptions { - if m != nil { - return m.Tunnel +func (x *ResumeOptions) GetTunnel() *ResumeTunnelOptions { + if x != nil { + return x.Tunnel } return nil } -func init() { - proto.RegisterType((*ManageOptions)(nil), "protos.opts.ManageOptions") - proto.RegisterType((*GlobalManageOptions)(nil), "protos.opts.GlobalManageOptions") - proto.RegisterType((*GetOptions)(nil), "protos.opts.GetOptions") - proto.RegisterType((*CreateOptions)(nil), "protos.opts.CreateOptions") - proto.RegisterType((*DeleteOptions)(nil), "protos.opts.DeleteOptions") - proto.RegisterType((*StopOptions)(nil), "protos.opts.StopOptions") - proto.RegisterType((*ResumeOptions)(nil), "protos.opts.ResumeOptions") -} - -func init() { proto.RegisterFile("opts/ps_opts_manage.proto", fileDescriptor_1d5f0e150eafe5f0) } - -var fileDescriptor_1d5f0e150eafe5f0 = []byte{ - // 665 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x94, 0xcf, 0x6e, 0xd3, 0x4e, - 0x10, 0xc7, 0xe5, 0xe6, 0x4f, 0x9b, 0xcd, 0x2f, 0xfd, 0xb5, 0xdb, 0x0a, 0x4c, 0x05, 0x34, 0x8d, - 0x5a, 0xa9, 0x08, 0x1a, 0x4b, 0x2d, 0x45, 0x20, 0x4e, 0xa5, 0x15, 0x15, 0x20, 0x04, 0x72, 0xcb, - 0x85, 0x8b, 0x65, 0x3b, 0x43, 0x6a, 0x75, 0xe3, 0xb5, 0xbc, 0xeb, 0x43, 0x38, 0xf1, 0x26, 0xbc, - 0x07, 0x0f, 0xc0, 0x0b, 0xf0, 0x42, 0x68, 0x77, 0xd6, 0x4e, 0x1c, 0x96, 0x0a, 0xc4, 0x29, 0xca, - 0xcc, 0xe7, 0xbb, 0x33, 0xdf, 0xdd, 0x19, 0x93, 0x3b, 0x3c, 0x93, 0xc2, 0xcb, 0x44, 0xa0, 0x7e, - 0x83, 0x49, 0x98, 0x86, 0x63, 0x18, 0x66, 0x39, 0x97, 0x9c, 0x76, 0xf5, 0x8f, 0x18, 0xaa, 0xcc, - 0xd6, 0xae, 0x85, 0x0b, 0x62, 0x9e, 0xa6, 0x10, 0xcb, 0x84, 0xa7, 0x28, 0xd9, 0xda, 0xb6, 0x51, - 0x39, 0xb0, 0x70, 0x6a, 0x80, 0xbe, 0x0d, 0x90, 0x45, 0x9a, 0x02, 0x43, 0x62, 0xf0, 0x63, 0x89, - 0xf4, 0xde, 0xea, 0xf8, 0xbb, 0x4c, 0x9d, 0x2c, 0xe8, 0x39, 0x59, 0x1d, 0x33, 0x1e, 0x85, 0x4c, - 0x89, 0x54, 0xc4, 0x75, 0xfa, 0xce, 0x7e, 0xf7, 0xb0, 0x3f, 0x9c, 0x6b, 0x70, 0x78, 0xae, 0x91, - 0x9a, 0xd2, 0xef, 0xa1, 0xae, 0x3c, 0xe8, 0x01, 0x69, 0x8c, 0x41, 0xba, 0x4b, 0x5a, 0x7d, 0xbb, - 0xae, 0x06, 0x59, 0x8a, 0x14, 0x43, 0x0f, 0x49, 0x3b, 0xce, 0x21, 0x94, 0xe0, 0x36, 0x34, 0xbd, - 0x55, 0xa3, 0x4f, 0x75, 0xaa, 0x14, 0x18, 0x52, 0x69, 0x46, 0xc0, 0x40, 0x82, 0xdb, 0xb2, 0x68, - 0xce, 0x74, 0xaa, 0xd2, 0x20, 0x49, 0x1f, 0x91, 0xa6, 0x90, 0x3c, 0x73, 0xdb, 0x5a, 0xe1, 0xd6, - 0x14, 0x17, 0x92, 0x67, 0x25, 0xaf, 0x29, 0x55, 0x21, 0x07, 0x51, 0x4c, 0xc0, 0x5d, 0xb6, 0x54, - 0xf0, 0x75, 0xaa, 0xaa, 0x80, 0xe4, 0xeb, 0xe6, 0x4a, 0x73, 0xad, 0x35, 0xf8, 0xda, 0x20, 0x1b, - 0x96, 0x1b, 0xa2, 0x7b, 0x64, 0xd5, 0x3c, 0x42, 0x38, 0x1a, 0xe5, 0x20, 0xf0, 0x6e, 0x3b, 0x7e, - 0x0f, 0xa3, 0x27, 0x18, 0xa4, 0x3b, 0xe4, 0xbf, 0xf2, 0xad, 0xf8, 0x35, 0xa4, 0xfa, 0x0a, 0x3b, - 0x7e, 0x17, 0x63, 0x97, 0x2a, 0x44, 0x1f, 0x93, 0x5b, 0x25, 0x92, 0x4c, 0x80, 0x17, 0x32, 0x10, - 0x10, 0xf3, 0x74, 0x24, 0xf4, 0x0d, 0x36, 0xfc, 0x4d, 0x03, 0x63, 0xf2, 0x02, 0x73, 0x74, 0xb7, - 0xaa, 0x5f, 0x08, 0x08, 0x24, 0x13, 0x6e, 0xb3, 0xef, 0xec, 0xaf, 0xf8, 0xa6, 0xdc, 0x07, 0x01, - 0x97, 0x4c, 0xd0, 0x21, 0xd9, 0x30, 0x54, 0x92, 0x0a, 0x88, 0x8b, 0x1c, 0xd1, 0x96, 0x46, 0xd7, - 0x31, 0xf5, 0xca, 0x64, 0x14, 0xff, 0x90, 0xd0, 0xb2, 0x17, 0x26, 0x82, 0x38, 0x0c, 0x3e, 0x25, - 0x0c, 0xf4, 0x1d, 0x77, 0xfc, 0xff, 0x4d, 0x1f, 0x4c, 0x9c, 0x86, 0x2f, 0x13, 0x06, 0xd4, 0x23, - 0x9b, 0xf3, 0x30, 0xe4, 0x12, 0xf1, 0x65, 0x8d, 0xaf, 0xcf, 0x70, 0xc8, 0xa5, 0x16, 0x1c, 0x54, - 0xdd, 0x28, 0xc1, 0x35, 0x4c, 0x91, 0x5f, 0xd1, 0xfc, 0x5a, 0xc5, 0xbf, 0x81, 0xa9, 0xc6, 0xf7, - 0xc8, 0xea, 0x28, 0x11, 0x61, 0xc4, 0x20, 0xc8, 0x72, 0x90, 0x72, 0xea, 0x76, 0x74, 0xdf, 0x3d, - 0x13, 0x7d, 0xaf, 0x83, 0x83, 0x6f, 0x0e, 0x21, 0xb3, 0x29, 0xa4, 0x27, 0x84, 0xcc, 0xb6, 0xcb, - 0x0c, 0xfc, 0xce, 0xe2, 0xc8, 0x9e, 0x56, 0x44, 0xf9, 0xea, 0x73, 0x22, 0x7a, 0x48, 0x5a, 0x7a, - 0xf5, 0xcc, 0xc0, 0xdf, 0x5d, 0x54, 0xfb, 0x2a, 0x59, 0x0a, 0x11, 0xa5, 0xc7, 0xa4, 0x8d, 0xdb, - 0x68, 0xe6, 0xfe, 0xde, 0xa2, 0xe8, 0x52, 0x67, 0xab, 0x21, 0x43, 0x78, 0xf0, 0xdd, 0x21, 0xbd, - 0xda, 0x52, 0xd0, 0x33, 0x4b, 0xff, 0xbb, 0x96, 0x25, 0xba, 0xd9, 0xc2, 0x71, 0xdd, 0xc2, 0xb6, - 0xe5, 0x00, 0x9b, 0x8b, 0xa7, 0x0b, 0x2e, 0xfa, 0x16, 0xdd, 0xef, 0x8d, 0xd4, 0x36, 0xf5, 0x0f, - 0x8c, 0x20, 0xff, 0x0f, 0x46, 0xf0, 0x80, 0xbf, 0x37, 0x82, 0x3a, 0xbb, 0x91, 0xcf, 0xa4, 0x3b, - 0xf7, 0xfd, 0xa0, 0x47, 0x65, 0x7d, 0xc7, 0xf2, 0xac, 0x0a, 0xb4, 0x55, 0x7f, 0x52, 0x55, 0xc7, - 0xae, 0xef, 0xff, 0xa2, 0xb2, 0xd7, 0xfe, 0xe2, 0x90, 0x5e, 0xed, 0x63, 0x34, 0xb3, 0xef, 0x58, - 0xec, 0x23, 0x7a, 0xb3, 0xfd, 0x25, 0x8b, 0x7d, 0xd4, 0x59, 0x5b, 0x78, 0xf1, 0xfc, 0xe3, 0xb3, - 0x71, 0x22, 0xaf, 0x8a, 0x68, 0x18, 0xf3, 0x89, 0x17, 0x85, 0x32, 0xbe, 0x8a, 0x79, 0x9e, 0x79, - 0x19, 0x2b, 0x26, 0x11, 0xe4, 0x07, 0x22, 0xbe, 0x82, 0x49, 0x28, 0xbc, 0xa8, 0x48, 0xd8, 0xc8, - 0x1b, 0x73, 0x0f, 0x0f, 0xf6, 0xd4, 0xc1, 0x51, 0x5b, 0xff, 0x39, 0xfa, 0x19, 0x00, 0x00, 0xff, - 0xff, 0x1f, 0x96, 0x81, 0xae, 0x1c, 0x07, 0x00, 0x00, +var File_opts_ps_opts_manage_proto protoreflect.FileDescriptor + +var file_opts_ps_opts_manage_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x1a, 0x24, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, + 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, + 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x20, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0xd3, 0x02, 0x0a, 0x0d, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x47, 0x0a, 0x0e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x5f, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, + 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0d, 0x67, + 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x29, 0x0a, 0x03, + 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x03, 0x67, 0x65, 0x74, 0x12, 0x32, 0x0a, 0x06, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x32, 0x0a, 0x06, 0x64, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, + 0x2c, 0x0a, 0x04, 0x73, 0x74, 0x6f, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x70, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x04, 0x73, 0x74, 0x6f, 0x70, 0x12, 0x32, 0x0a, + 0x06, 0x72, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x75, + 0x6d, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6d, + 0x65, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x22, 0x9f, 0x03, 0x0a, 0x13, 0x47, 0x6c, 0x6f, 0x62, + 0x61, 0x6c, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x25, 0x0a, 0x0e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x34, 0x0a, 0x16, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x6f, + 0x6e, 0x64, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x14, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, + 0x24, 0x0a, 0x0e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x5f, 0x74, 0x6c, + 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x55, + 0x73, 0x65, 0x54, 0x6c, 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x5f, + 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x5f, 0x74, 0x6c, 0x73, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x11, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x49, 0x6e, 0x73, 0x65, 0x63, 0x75, + 0x72, 0x65, 0x54, 0x6c, 0x73, 0x12, 0x2b, 0x0a, 0x12, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x5f, + 0x74, 0x6c, 0x73, 0x5f, 0x63, 0x61, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x54, 0x6c, 0x73, 0x43, 0x61, 0x46, 0x69, + 0x6c, 0x65, 0x12, 0x2f, 0x0a, 0x14, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6c, 0x73, + 0x5f, 0x63, 0x65, 0x72, 0x74, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x11, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x54, 0x6c, 0x73, 0x43, 0x65, 0x72, 0x74, 0x46, + 0x69, 0x6c, 0x65, 0x12, 0x2d, 0x0a, 0x13, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6c, + 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x10, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x54, 0x6c, 0x73, 0x4b, 0x65, 0x79, 0x46, 0x69, + 0x6c, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x70, 0x72, + 0x65, 0x74, 0x74, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x64, 0x69, 0x73, 0x61, + 0x62, 0x6c, 0x65, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x22, 0xba, 0x01, 0x0a, 0x0a, 0x47, 0x65, + 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x0a, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x32, 0x0a, 0x05, 0x72, + 0x65, 0x6c, 0x61, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, + 0x79, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x05, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x12, + 0x35, 0x0a, 0x06, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x47, 0x65, + 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, + 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x22, 0xc6, 0x01, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x44, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x35, + 0x0a, 0x05, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x05, + 0x72, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x38, 0x0a, 0x06, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, + 0x70, 0x74, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x22, + 0xc6, 0x01, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x44, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, + 0x70, 0x74, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0a, 0x63, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x35, 0x0a, 0x05, 0x72, 0x65, 0x6c, 0x61, 0x79, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x05, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x38, + 0x0a, 0x06, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x06, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x22, 0x7a, 0x0a, 0x0b, 0x53, 0x74, 0x6f, 0x70, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x33, 0x0a, 0x05, 0x72, 0x65, 0x6c, 0x61, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x05, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x36, 0x0a, 0x06, + 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x54, + 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x74, 0x75, + 0x6e, 0x6e, 0x65, 0x6c, 0x22, 0x80, 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x35, 0x0a, 0x05, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, + 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x05, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x38, 0x0a, + 0x06, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x75, + 0x6d, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x06, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, + 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, + 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, + 0x6f, 0x70, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_opts_ps_opts_manage_proto_rawDescOnce sync.Once + file_opts_ps_opts_manage_proto_rawDescData = file_opts_ps_opts_manage_proto_rawDesc +) + +func file_opts_ps_opts_manage_proto_rawDescGZIP() []byte { + file_opts_ps_opts_manage_proto_rawDescOnce.Do(func() { + file_opts_ps_opts_manage_proto_rawDescData = protoimpl.X.CompressGZIP(file_opts_ps_opts_manage_proto_rawDescData) + }) + return file_opts_ps_opts_manage_proto_rawDescData +} + +var file_opts_ps_opts_manage_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_opts_ps_opts_manage_proto_goTypes = []interface{}{ + (*ManageOptions)(nil), // 0: protos.opts.ManageOptions + (*GlobalManageOptions)(nil), // 1: protos.opts.GlobalManageOptions + (*GetOptions)(nil), // 2: protos.opts.GetOptions + (*CreateOptions)(nil), // 3: protos.opts.CreateOptions + (*DeleteOptions)(nil), // 4: protos.opts.DeleteOptions + (*StopOptions)(nil), // 5: protos.opts.StopOptions + (*ResumeOptions)(nil), // 6: protos.opts.ResumeOptions + (*GetConnectionOptions)(nil), // 7: protos.opts.GetConnectionOptions + (*GetRelayOptions)(nil), // 8: protos.opts.GetRelayOptions + (*GetTunnelOptions)(nil), // 9: protos.opts.GetTunnelOptions + (*CreateConnectionOptions)(nil), // 10: protos.opts.CreateConnectionOptions + (*CreateRelayOptions)(nil), // 11: protos.opts.CreateRelayOptions + (*CreateTunnelOptions)(nil), // 12: protos.opts.CreateTunnelOptions + (*DeleteConnectionOptions)(nil), // 13: protos.opts.DeleteConnectionOptions + (*DeleteRelayOptions)(nil), // 14: protos.opts.DeleteRelayOptions + (*DeleteTunnelOptions)(nil), // 15: protos.opts.DeleteTunnelOptions + (*StopRelayOptions)(nil), // 16: protos.opts.StopRelayOptions + (*StopTunnelOptions)(nil), // 17: protos.opts.StopTunnelOptions + (*ResumeRelayOptions)(nil), // 18: protos.opts.ResumeRelayOptions + (*ResumeTunnelOptions)(nil), // 19: protos.opts.ResumeTunnelOptions +} +var file_opts_ps_opts_manage_proto_depIdxs = []int32{ + 1, // 0: protos.opts.ManageOptions.global_options:type_name -> protos.opts.GlobalManageOptions + 2, // 1: protos.opts.ManageOptions.get:type_name -> protos.opts.GetOptions + 3, // 2: protos.opts.ManageOptions.create:type_name -> protos.opts.CreateOptions + 4, // 3: protos.opts.ManageOptions.delete:type_name -> protos.opts.DeleteOptions + 5, // 4: protos.opts.ManageOptions.stop:type_name -> protos.opts.StopOptions + 6, // 5: protos.opts.ManageOptions.resume:type_name -> protos.opts.ResumeOptions + 7, // 6: protos.opts.GetOptions.connection:type_name -> protos.opts.GetConnectionOptions + 8, // 7: protos.opts.GetOptions.relay:type_name -> protos.opts.GetRelayOptions + 9, // 8: protos.opts.GetOptions.tunnel:type_name -> protos.opts.GetTunnelOptions + 10, // 9: protos.opts.CreateOptions.connection:type_name -> protos.opts.CreateConnectionOptions + 11, // 10: protos.opts.CreateOptions.relay:type_name -> protos.opts.CreateRelayOptions + 12, // 11: protos.opts.CreateOptions.tunnel:type_name -> protos.opts.CreateTunnelOptions + 13, // 12: protos.opts.DeleteOptions.connection:type_name -> protos.opts.DeleteConnectionOptions + 14, // 13: protos.opts.DeleteOptions.relay:type_name -> protos.opts.DeleteRelayOptions + 15, // 14: protos.opts.DeleteOptions.tunnel:type_name -> protos.opts.DeleteTunnelOptions + 16, // 15: protos.opts.StopOptions.relay:type_name -> protos.opts.StopRelayOptions + 17, // 16: protos.opts.StopOptions.tunnel:type_name -> protos.opts.StopTunnelOptions + 18, // 17: protos.opts.ResumeOptions.relay:type_name -> protos.opts.ResumeRelayOptions + 19, // 18: protos.opts.ResumeOptions.tunnel:type_name -> protos.opts.ResumeTunnelOptions + 19, // [19:19] is the sub-list for method output_type + 19, // [19:19] is the sub-list for method input_type + 19, // [19:19] is the sub-list for extension type_name + 19, // [19:19] is the sub-list for extension extendee + 0, // [0:19] is the sub-list for field type_name +} + +func init() { file_opts_ps_opts_manage_proto_init() } +func file_opts_ps_opts_manage_proto_init() { + if File_opts_ps_opts_manage_proto != nil { + return + } + file_opts_ps_opts_manage_connection_proto_init() + file_opts_ps_opts_manage_relay_proto_init() + file_opts_ps_opts_manage_tunnel_proto_init() + if !protoimpl.UnsafeEnabled { + file_opts_ps_opts_manage_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ManageOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_manage_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GlobalManageOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_manage_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_manage_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_manage_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_manage_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StopOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_manage_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResumeOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_opts_ps_opts_manage_proto_rawDesc, + NumEnums: 0, + NumMessages: 7, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_opts_ps_opts_manage_proto_goTypes, + DependencyIndexes: file_opts_ps_opts_manage_proto_depIdxs, + MessageInfos: file_opts_ps_opts_manage_proto_msgTypes, + }.Build() + File_opts_ps_opts_manage_proto = out.File + file_opts_ps_opts_manage_proto_rawDesc = nil + file_opts_ps_opts_manage_proto_goTypes = nil + file_opts_ps_opts_manage_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_manage_connection.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_manage_connection.pb.go index ae589af30..6be51fb3e 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_manage_connection.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_manage_connection.pb.go @@ -1,67 +1,79 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: opts/ps_opts_manage_connection.proto package opts import ( - fmt "fmt" args "github.com/batchcorp/plumber-schemas/build/go/protos/args" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type GetConnectionOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='ID of the connection to get (leave empty to get all)'" - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" kong:"help='ID of the connection to get (leave empty to get all)'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" kong:"help='ID of the connection to get (leave empty to get all)'"` } -func (m *GetConnectionOptions) Reset() { *m = GetConnectionOptions{} } -func (m *GetConnectionOptions) String() string { return proto.CompactTextString(m) } -func (*GetConnectionOptions) ProtoMessage() {} -func (*GetConnectionOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_135d08c7ffd8961f, []int{0} +func (x *GetConnectionOptions) Reset() { + *x = GetConnectionOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_manage_connection_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GetConnectionOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetConnectionOptions.Unmarshal(m, b) +func (x *GetConnectionOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GetConnectionOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetConnectionOptions.Marshal(b, m, deterministic) -} -func (m *GetConnectionOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetConnectionOptions.Merge(m, src) -} -func (m *GetConnectionOptions) XXX_Size() int { - return xxx_messageInfo_GetConnectionOptions.Size(m) -} -func (m *GetConnectionOptions) XXX_DiscardUnknown() { - xxx_messageInfo_GetConnectionOptions.DiscardUnknown(m) + +func (*GetConnectionOptions) ProtoMessage() {} + +func (x *GetConnectionOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_manage_connection_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_GetConnectionOptions proto.InternalMessageInfo +// Deprecated: Use GetConnectionOptions.ProtoReflect.Descriptor instead. +func (*GetConnectionOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_manage_connection_proto_rawDescGZIP(), []int{0} +} -func (m *GetConnectionOptions) GetId() string { - if m != nil { - return m.Id +func (x *GetConnectionOptions) GetId() string { + if x != nil { + return x.Id } return "" } type CreateConnectionOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Friendly name for the connection', required" Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty" kong:"help='Friendly name for the connection', required"` // @gotags: kong:"help='Optional notes to associate with the connection'" @@ -107,298 +119,515 @@ type CreateConnectionOptions struct { // @gotags: kong:"cmd,help='NATS JetStream'" NatsJetstream *args.NatsJetstreamConn `protobuf:"bytes,119,opt,name=nats_jetstream,json=natsJetstream,proto3" json:"nats_jetstream,omitempty" kong:"cmd,help='NATS JetStream'"` // @gotags: kong:"cmd,help='AWS Kinesis'" - AwsKinesis *args.AWSKinesisConn `protobuf:"bytes,120,opt,name=aws_kinesis,json=awsKinesis,proto3" json:"aws_kinesis,omitempty" kong:"cmd,help='AWS Kinesis'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + AwsKinesis *args.AWSKinesisConn `protobuf:"bytes,120,opt,name=aws_kinesis,json=awsKinesis,proto3" json:"aws_kinesis,omitempty" kong:"cmd,help='AWS Kinesis'"` } -func (m *CreateConnectionOptions) Reset() { *m = CreateConnectionOptions{} } -func (m *CreateConnectionOptions) String() string { return proto.CompactTextString(m) } -func (*CreateConnectionOptions) ProtoMessage() {} -func (*CreateConnectionOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_135d08c7ffd8961f, []int{1} +func (x *CreateConnectionOptions) Reset() { + *x = CreateConnectionOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_manage_connection_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *CreateConnectionOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateConnectionOptions.Unmarshal(m, b) -} -func (m *CreateConnectionOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateConnectionOptions.Marshal(b, m, deterministic) -} -func (m *CreateConnectionOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateConnectionOptions.Merge(m, src) +func (x *CreateConnectionOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CreateConnectionOptions) XXX_Size() int { - return xxx_messageInfo_CreateConnectionOptions.Size(m) -} -func (m *CreateConnectionOptions) XXX_DiscardUnknown() { - xxx_messageInfo_CreateConnectionOptions.DiscardUnknown(m) + +func (*CreateConnectionOptions) ProtoMessage() {} + +func (x *CreateConnectionOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_manage_connection_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_CreateConnectionOptions proto.InternalMessageInfo +// Deprecated: Use CreateConnectionOptions.ProtoReflect.Descriptor instead. +func (*CreateConnectionOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_manage_connection_proto_rawDescGZIP(), []int{1} +} -func (m *CreateConnectionOptions) GetName() string { - if m != nil { - return m.Name +func (x *CreateConnectionOptions) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *CreateConnectionOptions) GetNotes() string { - if m != nil { - return m.Notes +func (x *CreateConnectionOptions) GetNotes() string { + if x != nil { + return x.Notes } return "" } -func (m *CreateConnectionOptions) GetKafka() *args.KafkaConn { - if m != nil { - return m.Kafka +func (x *CreateConnectionOptions) GetKafka() *args.KafkaConn { + if x != nil { + return x.Kafka } return nil } -func (m *CreateConnectionOptions) GetActiveMq() *args.ActiveMQConn { - if m != nil { - return m.ActiveMq +func (x *CreateConnectionOptions) GetActiveMq() *args.ActiveMQConn { + if x != nil { + return x.ActiveMq } return nil } -func (m *CreateConnectionOptions) GetAwsSqs() *args.AWSSQSConn { - if m != nil { - return m.AwsSqs +func (x *CreateConnectionOptions) GetAwsSqs() *args.AWSSQSConn { + if x != nil { + return x.AwsSqs } return nil } -func (m *CreateConnectionOptions) GetAwsSns() *args.AWSSNSConn { - if m != nil { - return m.AwsSns +func (x *CreateConnectionOptions) GetAwsSns() *args.AWSSNSConn { + if x != nil { + return x.AwsSns } return nil } -func (m *CreateConnectionOptions) GetMongo() *args.MongoConn { - if m != nil { - return m.Mongo +func (x *CreateConnectionOptions) GetMongo() *args.MongoConn { + if x != nil { + return x.Mongo } return nil } -func (m *CreateConnectionOptions) GetNats() *args.NatsConn { - if m != nil { - return m.Nats +func (x *CreateConnectionOptions) GetNats() *args.NatsConn { + if x != nil { + return x.Nats } return nil } -func (m *CreateConnectionOptions) GetNatsStreaming() *args.NatsStreamingConn { - if m != nil { - return m.NatsStreaming +func (x *CreateConnectionOptions) GetNatsStreaming() *args.NatsStreamingConn { + if x != nil { + return x.NatsStreaming } return nil } -func (m *CreateConnectionOptions) GetNsq() *args.NSQConn { - if m != nil { - return m.Nsq +func (x *CreateConnectionOptions) GetNsq() *args.NSQConn { + if x != nil { + return x.Nsq } return nil } -func (m *CreateConnectionOptions) GetPostgres() *args.PostgresConn { - if m != nil { - return m.Postgres +func (x *CreateConnectionOptions) GetPostgres() *args.PostgresConn { + if x != nil { + return x.Postgres } return nil } -func (m *CreateConnectionOptions) GetPulsar() *args.PulsarConn { - if m != nil { - return m.Pulsar +func (x *CreateConnectionOptions) GetPulsar() *args.PulsarConn { + if x != nil { + return x.Pulsar } return nil } -func (m *CreateConnectionOptions) GetRabbit() *args.RabbitConn { - if m != nil { - return m.Rabbit +func (x *CreateConnectionOptions) GetRabbit() *args.RabbitConn { + if x != nil { + return x.Rabbit } return nil } -func (m *CreateConnectionOptions) GetRabbitStreams() *args.RabbitStreamsConn { - if m != nil { - return m.RabbitStreams +func (x *CreateConnectionOptions) GetRabbitStreams() *args.RabbitStreamsConn { + if x != nil { + return x.RabbitStreams } return nil } -func (m *CreateConnectionOptions) GetRedisPubsub() *args.RedisPubSubConn { - if m != nil { - return m.RedisPubsub +func (x *CreateConnectionOptions) GetRedisPubsub() *args.RedisPubSubConn { + if x != nil { + return x.RedisPubsub } return nil } -func (m *CreateConnectionOptions) GetRedisStreams() *args.RedisStreamsConn { - if m != nil { - return m.RedisStreams +func (x *CreateConnectionOptions) GetRedisStreams() *args.RedisStreamsConn { + if x != nil { + return x.RedisStreams } return nil } -func (m *CreateConnectionOptions) GetAzureEventHub() *args.AzureEventHubConn { - if m != nil { - return m.AzureEventHub +func (x *CreateConnectionOptions) GetAzureEventHub() *args.AzureEventHubConn { + if x != nil { + return x.AzureEventHub } return nil } -func (m *CreateConnectionOptions) GetAzureServiceBus() *args.AzureServiceBusConn { - if m != nil { - return m.AzureServiceBus +func (x *CreateConnectionOptions) GetAzureServiceBus() *args.AzureServiceBusConn { + if x != nil { + return x.AzureServiceBus } return nil } -func (m *CreateConnectionOptions) GetMqtt() *args.MQTTConn { - if m != nil { - return m.Mqtt +func (x *CreateConnectionOptions) GetMqtt() *args.MQTTConn { + if x != nil { + return x.Mqtt } return nil } -func (m *CreateConnectionOptions) GetKubemqQueue() *args.KubeMQQueueConn { - if m != nil { - return m.KubemqQueue +func (x *CreateConnectionOptions) GetKubemqQueue() *args.KubeMQQueueConn { + if x != nil { + return x.KubemqQueue } return nil } -func (m *CreateConnectionOptions) GetGcpPubsub() *args.GCPPubSubConn { - if m != nil { - return m.GcpPubsub +func (x *CreateConnectionOptions) GetGcpPubsub() *args.GCPPubSubConn { + if x != nil { + return x.GcpPubsub } return nil } -func (m *CreateConnectionOptions) GetNatsJetstream() *args.NatsJetstreamConn { - if m != nil { - return m.NatsJetstream +func (x *CreateConnectionOptions) GetNatsJetstream() *args.NatsJetstreamConn { + if x != nil { + return x.NatsJetstream } return nil } -func (m *CreateConnectionOptions) GetAwsKinesis() *args.AWSKinesisConn { - if m != nil { - return m.AwsKinesis +func (x *CreateConnectionOptions) GetAwsKinesis() *args.AWSKinesisConn { + if x != nil { + return x.AwsKinesis } return nil } type DeleteConnectionOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='ID of the connection to delete',required=true" - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" kong:"help='ID of the connection to delete',required=true"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" kong:"help='ID of the connection to delete',required=true"` } -func (m *DeleteConnectionOptions) Reset() { *m = DeleteConnectionOptions{} } -func (m *DeleteConnectionOptions) String() string { return proto.CompactTextString(m) } -func (*DeleteConnectionOptions) ProtoMessage() {} -func (*DeleteConnectionOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_135d08c7ffd8961f, []int{2} +func (x *DeleteConnectionOptions) Reset() { + *x = DeleteConnectionOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_manage_connection_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *DeleteConnectionOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeleteConnectionOptions.Unmarshal(m, b) -} -func (m *DeleteConnectionOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeleteConnectionOptions.Marshal(b, m, deterministic) -} -func (m *DeleteConnectionOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteConnectionOptions.Merge(m, src) -} -func (m *DeleteConnectionOptions) XXX_Size() int { - return xxx_messageInfo_DeleteConnectionOptions.Size(m) +func (x *DeleteConnectionOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *DeleteConnectionOptions) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteConnectionOptions.DiscardUnknown(m) + +func (*DeleteConnectionOptions) ProtoMessage() {} + +func (x *DeleteConnectionOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_manage_connection_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_DeleteConnectionOptions proto.InternalMessageInfo +// Deprecated: Use DeleteConnectionOptions.ProtoReflect.Descriptor instead. +func (*DeleteConnectionOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_manage_connection_proto_rawDescGZIP(), []int{2} +} -func (m *DeleteConnectionOptions) GetId() string { - if m != nil { - return m.Id +func (x *DeleteConnectionOptions) GetId() string { + if x != nil { + return x.Id } return "" } -func init() { - proto.RegisterType((*GetConnectionOptions)(nil), "protos.opts.GetConnectionOptions") - proto.RegisterType((*CreateConnectionOptions)(nil), "protos.opts.CreateConnectionOptions") - proto.RegisterType((*DeleteConnectionOptions)(nil), "protos.opts.DeleteConnectionOptions") -} - -func init() { - proto.RegisterFile("opts/ps_opts_manage_connection.proto", fileDescriptor_135d08c7ffd8961f) -} - -var fileDescriptor_135d08c7ffd8961f = []byte{ - // 795 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x96, 0xdf, 0x4f, 0xdb, 0x3a, - 0x14, 0xc7, 0x05, 0xf7, 0xc2, 0xa5, 0xee, 0x2d, 0x57, 0xd7, 0x62, 0xd4, 0x94, 0xc1, 0xba, 0x0a, - 0x21, 0x90, 0xb6, 0x66, 0xda, 0xb4, 0x49, 0x68, 0x93, 0x26, 0x60, 0x8c, 0x69, 0xac, 0xac, 0x25, - 0x48, 0x93, 0xf6, 0x12, 0x39, 0xa9, 0x49, 0x43, 0x1b, 0xe7, 0x87, 0xed, 0x76, 0xda, 0xdf, 0xbe, - 0x87, 0xc9, 0x76, 0x52, 0x62, 0x6a, 0xf6, 0x42, 0x88, 0xbf, 0x9f, 0xef, 0xc9, 0xf1, 0xc9, 0x39, - 0x4e, 0xc1, 0x5e, 0x92, 0x72, 0xe6, 0xa4, 0xcc, 0x93, 0x57, 0x2f, 0xc6, 0x14, 0x87, 0xc4, 0x0b, - 0x12, 0x4a, 0x49, 0xc0, 0xa3, 0x84, 0x76, 0xd3, 0x3c, 0xe1, 0x09, 0xac, 0xab, 0x0b, 0xeb, 0x4a, - 0xa8, 0xb5, 0x8d, 0xf3, 0x50, 0x59, 0xe4, 0xd5, 0xc3, 0x01, 0x8f, 0xa6, 0x24, 0xce, 0x34, 0xd9, - 0xda, 0x35, 0xc5, 0x19, 0xf3, 0xc6, 0x11, 0x25, 0x2c, 0x62, 0x85, 0xde, 0x5a, 0xd0, 0x19, 0xfd, - 0x83, 0x96, 0x95, 0x5a, 0xc7, 0xd4, 0x7e, 0x8a, 0x9c, 0x78, 0x64, 0x4a, 0x28, 0xf7, 0x46, 0xc2, - 0x2f, 0x98, 0x3d, 0x0b, 0xc3, 0x48, 0x3e, 0x8d, 0x02, 0xe2, 0xf9, 0xa2, 0x8c, 0xb4, 0x63, 0x50, - 0x61, 0x90, 0x7a, 0xa9, 0xf0, 0xd9, 0x3c, 0x08, 0x32, 0xe4, 0x31, 0xbe, 0x19, 0xe3, 0x42, 0x79, - 0x62, 0x2a, 0xc2, 0x27, 0x71, 0xe6, 0x65, 0x82, 0x08, 0x62, 0xb5, 0xc6, 0x09, 0x0d, 0x93, 0x42, - 0x69, 0x9a, 0x4a, 0xc6, 0xb9, 0x55, 0xa0, 0x98, 0x97, 0x59, 0x3e, 0x5d, 0x10, 0xbc, 0x5b, 0xc2, - 0x19, 0xcf, 0x09, 0x8e, 0x1f, 0x46, 0xb4, 0x1e, 0xd1, 0xb0, 0x40, 0x36, 0x4d, 0x84, 0x95, 0x6f, - 0xc9, 0x7c, 0x85, 0x69, 0xc2, 0x78, 0x98, 0x93, 0xf2, 0xd1, 0x5b, 0xa6, 0x28, 0x26, 0x0c, 0xe7, - 0x56, 0x29, 0xc7, 0xbe, 0x1f, 0x71, 0x6b, 0x36, 0x5a, 0x2a, 0xf2, 0x61, 0xd6, 0x02, 0xe6, 0x64, - 0x18, 0x31, 0xb3, 0xf6, 0x6d, 0x0b, 0x60, 0x84, 0xe8, 0xec, 0x83, 0x8d, 0x73, 0xc2, 0x4f, 0xe7, - 0xfd, 0xf9, 0x35, 0x95, 0x7f, 0x19, 0x5c, 0x07, 0xcb, 0xd1, 0x10, 0x2d, 0xb5, 0x97, 0x0e, 0x6a, - 0x57, 0xcb, 0xd1, 0xb0, 0xf3, 0xab, 0x06, 0x9a, 0xa7, 0x39, 0xc1, 0x9c, 0x2c, 0xb2, 0x10, 0xfc, - 0x4d, 0x71, 0x4c, 0x0a, 0x5a, 0xfd, 0x0f, 0x37, 0xc0, 0x0a, 0x4d, 0x38, 0x61, 0x68, 0x59, 0x2d, - 0xea, 0x1b, 0xf8, 0x0c, 0xac, 0xa8, 0x06, 0x40, 0xc3, 0xf6, 0xd2, 0x41, 0xfd, 0xe5, 0x66, 0xb7, - 0x18, 0x03, 0x99, 0x5e, 0xf7, 0x42, 0x2a, 0x32, 0xfa, 0x95, 0x86, 0xe0, 0x1b, 0x50, 0xd3, 0xc3, - 0xe0, 0xc5, 0x19, 0x22, 0xca, 0xb1, 0x65, 0x38, 0x8e, 0x95, 0xda, 0x1b, 0x28, 0xd3, 0x9a, 0x66, - 0x7b, 0x19, 0x7c, 0x01, 0xfe, 0x29, 0x7a, 0x1d, 0xdd, 0x28, 0x57, 0xd3, 0x74, 0x7d, 0x73, 0xdd, - 0x81, 0xab, 0x3c, 0xab, 0x78, 0xc6, 0xdc, 0x8c, 0xcd, 0x1d, 0x94, 0xa1, 0xf0, 0x01, 0xc7, 0x65, - 0xc5, 0x41, 0xd5, 0x4e, 0x54, 0x3f, 0xa2, 0x91, 0x65, 0x27, 0x3d, 0xa9, 0xe8, 0x9d, 0x28, 0x08, - 0x1e, 0xca, 0x0a, 0x71, 0x86, 0x22, 0x05, 0x3f, 0x32, 0xe0, 0x4b, 0xcc, 0x99, 0x62, 0x15, 0x02, - 0xcf, 0xc0, 0xba, 0xd9, 0x79, 0xe8, 0x56, 0x99, 0x76, 0x17, 0x4c, 0x6e, 0x49, 0x28, 0x77, 0x83, - 0x56, 0x97, 0xe0, 0x3e, 0xf8, 0x8b, 0xb2, 0x0c, 0x8d, 0x95, 0x77, 0xc3, 0xf4, 0xba, 0xba, 0x60, - 0x12, 0x80, 0xaf, 0xc1, 0x5a, 0xd9, 0xad, 0x68, 0x62, 0x29, 0x71, 0xbf, 0x10, 0x75, 0x89, 0x4b, - 0x14, 0x3a, 0x60, 0x55, 0xf7, 0x31, 0x8a, 0x2d, 0xf5, 0xea, 0x2b, 0x49, 0xd7, 0x4b, 0x63, 0xd2, - 0xa0, 0x5b, 0x18, 0x51, 0x8b, 0xe1, 0x4a, 0x49, 0xda, 0xa0, 0x31, 0x59, 0x07, 0xb3, 0xe7, 0x51, - 0x62, 0xa9, 0x83, 0x36, 0xea, 0x6d, 0xeb, 0x1c, 0x1b, 0x79, 0x75, 0x09, 0xbe, 0x07, 0xff, 0x56, - 0xe7, 0x02, 0xa5, 0x2a, 0xc8, 0x63, 0x33, 0x88, 0x04, 0xfa, 0xc2, 0x77, 0x85, 0xaf, 0x42, 0xd4, - 0xf3, 0x62, 0x81, 0x09, 0x1f, 0x9e, 0x80, 0x86, 0x31, 0x37, 0x28, 0x53, 0x11, 0x76, 0x16, 0x23, - 0x54, 0xb3, 0xd0, 0x0f, 0x2d, 0x93, 0xf8, 0x08, 0xfe, 0xbb, 0x77, 0xc0, 0xa2, 0xdc, 0xb2, 0x99, - 0x63, 0xc9, 0x9c, 0x49, 0xe4, 0x53, 0x91, 0x49, 0x03, 0x57, 0x97, 0xe0, 0x17, 0xf0, 0xff, 0xc2, - 0x21, 0x8c, 0x98, 0x8a, 0xd4, 0x5e, 0x8c, 0xe4, 0x6a, 0xe8, 0x44, 0xe8, 0x94, 0x74, 0x0a, 0x77, - 0x8b, 0xb2, 0x29, 0xe5, 0xc1, 0x89, 0xb8, 0xa5, 0x29, 0x7b, 0x83, 0xeb, 0x6b, 0xdd, 0x94, 0x12, - 0x91, 0x55, 0xac, 0x1e, 0xcf, 0x48, 0x58, 0xaa, 0x78, 0x21, 0x7c, 0xd2, 0x1b, 0x0c, 0xa4, 0xae, - 0xab, 0xa8, 0x1d, 0x6a, 0x01, 0x1e, 0x01, 0x70, 0xf7, 0x61, 0x40, 0x53, 0x65, 0x6f, 0x19, 0xf6, - 0xf3, 0xd3, 0x7e, 0xe5, 0x15, 0xd4, 0xc2, 0x20, 0x2d, 0x5e, 0x40, 0x39, 0x10, 0xf3, 0xd3, 0x1a, - 0xcd, 0x1e, 0x18, 0x88, 0xcf, 0x25, 0x71, 0x37, 0x10, 0xf3, 0x25, 0xf8, 0x0e, 0xd4, 0x2b, 0x1f, - 0x4f, 0xf4, 0x43, 0xc5, 0xd8, 0xbe, 0x3f, 0xe6, 0x17, 0x5a, 0x56, 0x01, 0x00, 0x9e, 0xb1, 0xe2, - 0xbe, 0x73, 0x08, 0x9a, 0x1f, 0xc8, 0x84, 0xd8, 0x4e, 0xbf, 0x7b, 0x27, 0xe5, 0xc9, 0xdb, 0xef, - 0x47, 0x61, 0xc4, 0xe5, 0x47, 0x34, 0x48, 0x62, 0xc7, 0xc7, 0x3c, 0x18, 0x05, 0x49, 0x9e, 0x3a, - 0xe9, 0x44, 0xc4, 0x3e, 0xc9, 0x9f, 0xb3, 0x60, 0x44, 0x62, 0xcc, 0x1c, 0x5f, 0x44, 0x93, 0xa1, - 0x13, 0x26, 0x8e, 0x4e, 0xc1, 0x91, 0x3f, 0x05, 0xfc, 0x55, 0x75, 0xf3, 0xea, 0x77, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x14, 0xce, 0x90, 0x3b, 0x46, 0x08, 0x00, 0x00, +var File_opts_ps_opts_manage_connection_proto protoreflect.FileDescriptor + +var file_opts_ps_opts_manage_connection_proto_rawDesc = []byte{ + 0x0a, 0x24, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, + 0x70, 0x74, 0x73, 0x1a, 0x1b, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, + 0x73, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x6d, 0x71, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1e, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, + 0x77, 0x73, 0x5f, 0x6b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1a, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, + 0x77, 0x73, 0x5f, 0x73, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x61, 0x72, + 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x77, 0x73, 0x5f, 0x73, + 0x71, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x22, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, + 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x5f, 0x68, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x24, 0x61, 0x72, + 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x7a, 0x75, 0x72, 0x65, + 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1d, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, + 0x5f, 0x67, 0x63, 0x70, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x18, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, + 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x61, 0x72, 0x67, + 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, + 0x5f, 0x71, 0x75, 0x65, 0x75, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x61, 0x72, + 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, + 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6d, 0x71, 0x74, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x17, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, + 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, + 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x6a, 0x65, 0x74, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x61, 0x72, 0x67, + 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, + 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x73, 0x71, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, + 0x61, 0x72, 0x67, 0x73, 0x5f, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, + 0x73, 0x5f, 0x70, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, + 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x61, 0x62, + 0x62, 0x69, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x61, 0x72, 0x67, 0x73, 0x2f, + 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x5f, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x61, 0x72, + 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x73, + 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x61, + 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x65, 0x64, 0x69, + 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x26, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0xfc, 0x09, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x74, 0x65, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6e, 0x6f, 0x74, 0x65, 0x73, 0x12, 0x2c, 0x0a, + 0x05, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4b, 0x61, 0x66, 0x6b, 0x61, + 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x05, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x12, 0x36, 0x0a, 0x09, 0x61, + 0x63, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x71, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x63, 0x74, + 0x69, 0x76, 0x65, 0x4d, 0x51, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x08, 0x61, 0x63, 0x74, 0x69, 0x76, + 0x65, 0x4d, 0x71, 0x12, 0x30, 0x0a, 0x07, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x71, 0x73, 0x18, 0x66, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, + 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x53, 0x51, 0x53, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x06, 0x61, + 0x77, 0x73, 0x53, 0x71, 0x73, 0x12, 0x30, 0x0a, 0x07, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x6e, 0x73, + 0x18, 0x67, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x53, 0x4e, 0x53, 0x43, 0x6f, 0x6e, 0x6e, 0x52, + 0x06, 0x61, 0x77, 0x73, 0x53, 0x6e, 0x73, 0x12, 0x2c, 0x0a, 0x05, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, + 0x18, 0x68, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4d, 0x6f, 0x6e, 0x67, 0x6f, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x05, + 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x12, 0x29, 0x0a, 0x04, 0x6e, 0x61, 0x74, 0x73, 0x18, 0x69, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, + 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x6e, 0x61, 0x74, 0x73, + 0x12, 0x45, 0x0a, 0x0e, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, + 0x6e, 0x67, 0x18, 0x6a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x0d, 0x6e, 0x61, 0x74, 0x73, 0x53, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x12, 0x26, 0x0a, 0x03, 0x6e, 0x73, 0x71, 0x18, 0x6b, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, + 0x67, 0x73, 0x2e, 0x4e, 0x53, 0x51, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x03, 0x6e, 0x73, 0x71, 0x12, + 0x35, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x18, 0x6c, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, + 0x50, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x08, 0x70, 0x6f, + 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x12, 0x2f, 0x0a, 0x06, 0x70, 0x75, 0x6c, 0x73, 0x61, 0x72, + 0x18, 0x6d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x50, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x43, 0x6f, 0x6e, 0x6e, 0x52, + 0x06, 0x70, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x12, 0x2f, 0x0a, 0x06, 0x72, 0x61, 0x62, 0x62, 0x69, + 0x74, 0x18, 0x6e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x6e, + 0x52, 0x06, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x12, 0x45, 0x0a, 0x0e, 0x72, 0x61, 0x62, 0x62, + 0x69, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x6f, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, + 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x43, 0x6f, 0x6e, 0x6e, + 0x52, 0x0d, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, + 0x3f, 0x0a, 0x0c, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x18, + 0x70, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, + 0x72, 0x67, 0x73, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x43, + 0x6f, 0x6e, 0x6e, 0x52, 0x0b, 0x72, 0x65, 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, 0x73, 0x75, 0x62, + 0x12, 0x42, 0x0a, 0x0d, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x73, 0x18, 0x71, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x0c, 0x72, 0x65, 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x73, 0x12, 0x46, 0x0a, 0x0f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x65, 0x76, + 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x75, 0x62, 0x18, 0x72, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x7a, 0x75, 0x72, + 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x75, 0x62, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x0d, 0x61, + 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x75, 0x62, 0x12, 0x4c, 0x0a, 0x11, + 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x62, 0x75, + 0x73, 0x18, 0x73, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x42, 0x75, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x0f, 0x61, 0x7a, 0x75, 0x72, 0x65, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, 0x12, 0x29, 0x0a, 0x04, 0x6d, 0x71, + 0x74, 0x74, 0x18, 0x74, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4d, 0x51, 0x54, 0x54, 0x43, 0x6f, 0x6e, 0x6e, 0x52, + 0x04, 0x6d, 0x71, 0x74, 0x74, 0x12, 0x3f, 0x0a, 0x0c, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, 0x5f, + 0x71, 0x75, 0x65, 0x75, 0x65, 0x18, 0x75, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4b, 0x75, 0x62, 0x65, 0x4d, 0x51, + 0x51, 0x75, 0x65, 0x75, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x0b, 0x6b, 0x75, 0x62, 0x65, 0x6d, + 0x71, 0x51, 0x75, 0x65, 0x75, 0x65, 0x12, 0x39, 0x0a, 0x0a, 0x67, 0x63, 0x70, 0x5f, 0x70, 0x75, + 0x62, 0x73, 0x75, 0x62, 0x18, 0x76, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x47, 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, + 0x75, 0x62, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x09, 0x67, 0x63, 0x70, 0x50, 0x75, 0x62, 0x73, 0x75, + 0x62, 0x12, 0x45, 0x0a, 0x0e, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x6a, 0x65, 0x74, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x18, 0x77, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x0d, 0x6e, 0x61, 0x74, 0x73, 0x4a, + 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x3c, 0x0a, 0x0b, 0x61, 0x77, 0x73, 0x5f, + 0x6b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x18, 0x78, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x4b, + 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x0a, 0x61, 0x77, 0x73, 0x4b, + 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x22, 0x29, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, + 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x6f, 0x70, 0x74, 0x73, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_opts_ps_opts_manage_connection_proto_rawDescOnce sync.Once + file_opts_ps_opts_manage_connection_proto_rawDescData = file_opts_ps_opts_manage_connection_proto_rawDesc +) + +func file_opts_ps_opts_manage_connection_proto_rawDescGZIP() []byte { + file_opts_ps_opts_manage_connection_proto_rawDescOnce.Do(func() { + file_opts_ps_opts_manage_connection_proto_rawDescData = protoimpl.X.CompressGZIP(file_opts_ps_opts_manage_connection_proto_rawDescData) + }) + return file_opts_ps_opts_manage_connection_proto_rawDescData +} + +var file_opts_ps_opts_manage_connection_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_opts_ps_opts_manage_connection_proto_goTypes = []interface{}{ + (*GetConnectionOptions)(nil), // 0: protos.opts.GetConnectionOptions + (*CreateConnectionOptions)(nil), // 1: protos.opts.CreateConnectionOptions + (*DeleteConnectionOptions)(nil), // 2: protos.opts.DeleteConnectionOptions + (*args.KafkaConn)(nil), // 3: protos.args.KafkaConn + (*args.ActiveMQConn)(nil), // 4: protos.args.ActiveMQConn + (*args.AWSSQSConn)(nil), // 5: protos.args.AWSSQSConn + (*args.AWSSNSConn)(nil), // 6: protos.args.AWSSNSConn + (*args.MongoConn)(nil), // 7: protos.args.MongoConn + (*args.NatsConn)(nil), // 8: protos.args.NatsConn + (*args.NatsStreamingConn)(nil), // 9: protos.args.NatsStreamingConn + (*args.NSQConn)(nil), // 10: protos.args.NSQConn + (*args.PostgresConn)(nil), // 11: protos.args.PostgresConn + (*args.PulsarConn)(nil), // 12: protos.args.PulsarConn + (*args.RabbitConn)(nil), // 13: protos.args.RabbitConn + (*args.RabbitStreamsConn)(nil), // 14: protos.args.RabbitStreamsConn + (*args.RedisPubSubConn)(nil), // 15: protos.args.RedisPubSubConn + (*args.RedisStreamsConn)(nil), // 16: protos.args.RedisStreamsConn + (*args.AzureEventHubConn)(nil), // 17: protos.args.AzureEventHubConn + (*args.AzureServiceBusConn)(nil), // 18: protos.args.AzureServiceBusConn + (*args.MQTTConn)(nil), // 19: protos.args.MQTTConn + (*args.KubeMQQueueConn)(nil), // 20: protos.args.KubeMQQueueConn + (*args.GCPPubSubConn)(nil), // 21: protos.args.GCPPubSubConn + (*args.NatsJetstreamConn)(nil), // 22: protos.args.NatsJetstreamConn + (*args.AWSKinesisConn)(nil), // 23: protos.args.AWSKinesisConn +} +var file_opts_ps_opts_manage_connection_proto_depIdxs = []int32{ + 3, // 0: protos.opts.CreateConnectionOptions.kafka:type_name -> protos.args.KafkaConn + 4, // 1: protos.opts.CreateConnectionOptions.active_mq:type_name -> protos.args.ActiveMQConn + 5, // 2: protos.opts.CreateConnectionOptions.aws_sqs:type_name -> protos.args.AWSSQSConn + 6, // 3: protos.opts.CreateConnectionOptions.aws_sns:type_name -> protos.args.AWSSNSConn + 7, // 4: protos.opts.CreateConnectionOptions.mongo:type_name -> protos.args.MongoConn + 8, // 5: protos.opts.CreateConnectionOptions.nats:type_name -> protos.args.NatsConn + 9, // 6: protos.opts.CreateConnectionOptions.nats_streaming:type_name -> protos.args.NatsStreamingConn + 10, // 7: protos.opts.CreateConnectionOptions.nsq:type_name -> protos.args.NSQConn + 11, // 8: protos.opts.CreateConnectionOptions.postgres:type_name -> protos.args.PostgresConn + 12, // 9: protos.opts.CreateConnectionOptions.pulsar:type_name -> protos.args.PulsarConn + 13, // 10: protos.opts.CreateConnectionOptions.rabbit:type_name -> protos.args.RabbitConn + 14, // 11: protos.opts.CreateConnectionOptions.rabbit_streams:type_name -> protos.args.RabbitStreamsConn + 15, // 12: protos.opts.CreateConnectionOptions.redis_pubsub:type_name -> protos.args.RedisPubSubConn + 16, // 13: protos.opts.CreateConnectionOptions.redis_streams:type_name -> protos.args.RedisStreamsConn + 17, // 14: protos.opts.CreateConnectionOptions.azure_event_hub:type_name -> protos.args.AzureEventHubConn + 18, // 15: protos.opts.CreateConnectionOptions.azure_service_bus:type_name -> protos.args.AzureServiceBusConn + 19, // 16: protos.opts.CreateConnectionOptions.mqtt:type_name -> protos.args.MQTTConn + 20, // 17: protos.opts.CreateConnectionOptions.kubemq_queue:type_name -> protos.args.KubeMQQueueConn + 21, // 18: protos.opts.CreateConnectionOptions.gcp_pubsub:type_name -> protos.args.GCPPubSubConn + 22, // 19: protos.opts.CreateConnectionOptions.nats_jetstream:type_name -> protos.args.NatsJetstreamConn + 23, // 20: protos.opts.CreateConnectionOptions.aws_kinesis:type_name -> protos.args.AWSKinesisConn + 21, // [21:21] is the sub-list for method output_type + 21, // [21:21] is the sub-list for method input_type + 21, // [21:21] is the sub-list for extension type_name + 21, // [21:21] is the sub-list for extension extendee + 0, // [0:21] is the sub-list for field type_name +} + +func init() { file_opts_ps_opts_manage_connection_proto_init() } +func file_opts_ps_opts_manage_connection_proto_init() { + if File_opts_ps_opts_manage_connection_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_opts_ps_opts_manage_connection_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetConnectionOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_manage_connection_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateConnectionOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_manage_connection_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteConnectionOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_opts_ps_opts_manage_connection_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_opts_ps_opts_manage_connection_proto_goTypes, + DependencyIndexes: file_opts_ps_opts_manage_connection_proto_depIdxs, + MessageInfos: file_opts_ps_opts_manage_connection_proto_msgTypes, + }.Build() + File_opts_ps_opts_manage_connection_proto = out.File + file_opts_ps_opts_manage_connection_proto_rawDesc = nil + file_opts_ps_opts_manage_connection_proto_goTypes = nil + file_opts_ps_opts_manage_connection_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_manage_relay.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_manage_relay.pb.go index 5ca8caf94..113eae167 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_manage_relay.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_manage_relay.pb.go @@ -1,67 +1,154 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: opts/ps_opts_manage_relay.proto package opts import ( - fmt "fmt" args "github.com/batchcorp/plumber-schemas/build/go/protos/args" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type GetRelayOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='ID of the relay to get (leave empty to get all)'" - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" kong:"help='ID of the relay to get (leave empty to get all)'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" kong:"help='ID of the relay to get (leave empty to get all)'"` +} + +func (x *GetRelayOptions) Reset() { + *x = GetRelayOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_manage_relay_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRelayOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRelayOptions) ProtoMessage() {} + +func (x *GetRelayOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_manage_relay_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func (m *GetRelayOptions) Reset() { *m = GetRelayOptions{} } -func (m *GetRelayOptions) String() string { return proto.CompactTextString(m) } -func (*GetRelayOptions) ProtoMessage() {} +// Deprecated: Use GetRelayOptions.ProtoReflect.Descriptor instead. func (*GetRelayOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_86dbec1f9d2837a2, []int{0} + return file_opts_ps_opts_manage_relay_proto_rawDescGZIP(), []int{0} +} + +func (x *GetRelayOptions) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type StreamdalIntegrationOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // @gotags: kong:"help='Whether to enable Streamdal integration',group='Streamdal Integration (github.com/streamdal/streamdal)'" + StreamdalIntegrationEnable bool `protobuf:"varint,1,opt,name=streamdal_integration_enable,json=streamdalIntegrationEnable,proto3" json:"streamdal_integration_enable,omitempty" kong:"help='Whether to enable Streamdal integration',group='Streamdal Integration (github.com/streamdal/streamdal)'"` + // @gotags: kong:"help='Streamdal integration server address',default='localhost:8082',group='Streamdal Integration (github.com/streamdal/streamdal)'" + StreamdalIntegrationServerAddress string `protobuf:"bytes,2,opt,name=streamdal_integration_server_address,json=streamdalIntegrationServerAddress,proto3" json:"streamdal_integration_server_address,omitempty" kong:"help='Streamdal integration server address',default='localhost:8082',group='Streamdal Integration (github.com/streamdal/streamdal)'"` + // @gotags: kong:"help='Streamdal integration auth token',default='1234',group='Streamdal Integration (github.com/streamdal/streamdal)'" + StreamdalIntegrationAuthToken string `protobuf:"bytes,3,opt,name=streamdal_integration_auth_token,json=streamdalIntegrationAuthToken,proto3" json:"streamdal_integration_auth_token,omitempty" kong:"help='Streamdal integration auth token',default='1234',group='Streamdal Integration (github.com/streamdal/streamdal)'"` + // @gotags: kong:"help='Streamdal integration service name',group='Streamdal Integration (github.com/streamdal/streamdal)'" + StreamdalIntegrationServiceName string `protobuf:"bytes,4,opt,name=streamdal_integration_service_name,json=streamdalIntegrationServiceName,proto3" json:"streamdal_integration_service_name,omitempty" kong:"help='Streamdal integration service name',group='Streamdal Integration (github.com/streamdal/streamdal)'"` +} + +func (x *StreamdalIntegrationOptions) Reset() { + *x = StreamdalIntegrationOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_manage_relay_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GetRelayOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetRelayOptions.Unmarshal(m, b) +func (x *StreamdalIntegrationOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GetRelayOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetRelayOptions.Marshal(b, m, deterministic) + +func (*StreamdalIntegrationOptions) ProtoMessage() {} + +func (x *StreamdalIntegrationOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_manage_relay_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func (m *GetRelayOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRelayOptions.Merge(m, src) + +// Deprecated: Use StreamdalIntegrationOptions.ProtoReflect.Descriptor instead. +func (*StreamdalIntegrationOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_manage_relay_proto_rawDescGZIP(), []int{1} } -func (m *GetRelayOptions) XXX_Size() int { - return xxx_messageInfo_GetRelayOptions.Size(m) + +func (x *StreamdalIntegrationOptions) GetStreamdalIntegrationEnable() bool { + if x != nil { + return x.StreamdalIntegrationEnable + } + return false } -func (m *GetRelayOptions) XXX_DiscardUnknown() { - xxx_messageInfo_GetRelayOptions.DiscardUnknown(m) + +func (x *StreamdalIntegrationOptions) GetStreamdalIntegrationServerAddress() string { + if x != nil { + return x.StreamdalIntegrationServerAddress + } + return "" } -var xxx_messageInfo_GetRelayOptions proto.InternalMessageInfo +func (x *StreamdalIntegrationOptions) GetStreamdalIntegrationAuthToken() string { + if x != nil { + return x.StreamdalIntegrationAuthToken + } + return "" +} -func (m *GetRelayOptions) GetId() string { - if m != nil { - return m.Id +func (x *StreamdalIntegrationOptions) GetStreamdalIntegrationServiceName() string { + if x != nil { + return x.StreamdalIntegrationServiceName } return "" } type CreateRelayOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='ID of the connection to use',required" ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" kong:"help='ID of the connection to use',required"` // @gotags: kong:"help='Secret collection token',required" @@ -80,6 +167,8 @@ type CreateRelayOptions struct { StreamdalGrpcTimeoutSeconds int32 `protobuf:"varint,8,opt,name=streamdal_grpc_timeout_seconds,json=streamdalGrpcTimeoutSeconds,proto3" json:"streamdal_grpc_timeout_seconds,omitempty" kong:"help='How long to wait before giving up talking to the gRPC collector',default=5"` // @gotags: kong:"help='Consumed messages are intended to be dead-lettered'" DeadLetter bool `protobuf:"varint,9,opt,name=dead_letter,json=deadLetter,proto3" json:"dead_letter,omitempty" kong:"help='Consumed messages are intended to be dead-lettered'"` + // @gotags: kong:"embed" + StreamdalIntegrationOptions *StreamdalIntegrationOptions `protobuf:"bytes,10,opt,name=streamdal_integration_options,json=streamdalIntegrationOptions,proto3" json:"streamdal_integration_options,omitempty" kong:"embed"` // @gotags: kong:"cmd,help='Apache Kafka'" Kafka *args.KafkaRelayArgs `protobuf:"bytes,100,opt,name=kafka,proto3" json:"kafka,omitempty" kong:"cmd,help='Apache Kafka'"` // @gotags: kong:"cmd,help='AWS Simple Queue System'" @@ -109,389 +198,676 @@ type CreateRelayOptions struct { // @gotags: kong:"cmd,help='NATS Streaming'" NatsStreaming *args.NatsStreamingReadArgs `protobuf:"bytes,114,opt,name=nats_streaming,json=natsStreaming,proto3" json:"nats_streaming,omitempty" kong:"cmd,help='NATS Streaming'"` // @gotags: kong:"cmd,help='NATS JetStream'" - NatsJetstream *args.NatsJetstreamReadArgs `protobuf:"bytes,115,opt,name=nats_jetstream,json=natsJetstream,proto3" json:"nats_jetstream,omitempty" kong:"cmd,help='NATS JetStream'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + NatsJetstream *args.NatsJetstreamReadArgs `protobuf:"bytes,115,opt,name=nats_jetstream,json=natsJetstream,proto3" json:"nats_jetstream,omitempty" kong:"cmd,help='NATS JetStream'"` } -func (m *CreateRelayOptions) Reset() { *m = CreateRelayOptions{} } -func (m *CreateRelayOptions) String() string { return proto.CompactTextString(m) } -func (*CreateRelayOptions) ProtoMessage() {} -func (*CreateRelayOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_86dbec1f9d2837a2, []int{1} +func (x *CreateRelayOptions) Reset() { + *x = CreateRelayOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_manage_relay_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *CreateRelayOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateRelayOptions.Unmarshal(m, b) -} -func (m *CreateRelayOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateRelayOptions.Marshal(b, m, deterministic) +func (x *CreateRelayOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CreateRelayOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateRelayOptions.Merge(m, src) -} -func (m *CreateRelayOptions) XXX_Size() int { - return xxx_messageInfo_CreateRelayOptions.Size(m) -} -func (m *CreateRelayOptions) XXX_DiscardUnknown() { - xxx_messageInfo_CreateRelayOptions.DiscardUnknown(m) + +func (*CreateRelayOptions) ProtoMessage() {} + +func (x *CreateRelayOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_manage_relay_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_CreateRelayOptions proto.InternalMessageInfo +// Deprecated: Use CreateRelayOptions.ProtoReflect.Descriptor instead. +func (*CreateRelayOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_manage_relay_proto_rawDescGZIP(), []int{2} +} -func (m *CreateRelayOptions) GetConnectionId() string { - if m != nil { - return m.ConnectionId +func (x *CreateRelayOptions) GetConnectionId() string { + if x != nil { + return x.ConnectionId } return "" } -func (m *CreateRelayOptions) GetCollectionToken() string { - if m != nil { - return m.CollectionToken +func (x *CreateRelayOptions) GetCollectionToken() string { + if x != nil { + return x.CollectionToken } return "" } -func (m *CreateRelayOptions) GetBatchSize() int32 { - if m != nil { - return m.BatchSize +func (x *CreateRelayOptions) GetBatchSize() int32 { + if x != nil { + return x.BatchSize } return 0 } -func (m *CreateRelayOptions) GetBatchMaxRetry() int32 { - if m != nil { - return m.BatchMaxRetry +func (x *CreateRelayOptions) GetBatchMaxRetry() int32 { + if x != nil { + return x.BatchMaxRetry } return 0 } -func (m *CreateRelayOptions) GetNumWorkers() int32 { - if m != nil { - return m.NumWorkers +func (x *CreateRelayOptions) GetNumWorkers() int32 { + if x != nil { + return x.NumWorkers } return 0 } -func (m *CreateRelayOptions) GetStreamdalGrpcAddress() string { - if m != nil { - return m.StreamdalGrpcAddress +func (x *CreateRelayOptions) GetStreamdalGrpcAddress() string { + if x != nil { + return x.StreamdalGrpcAddress } return "" } -func (m *CreateRelayOptions) GetStreamdalGrpcDisableTls() bool { - if m != nil { - return m.StreamdalGrpcDisableTls +func (x *CreateRelayOptions) GetStreamdalGrpcDisableTls() bool { + if x != nil { + return x.StreamdalGrpcDisableTls } return false } -func (m *CreateRelayOptions) GetStreamdalGrpcTimeoutSeconds() int32 { - if m != nil { - return m.StreamdalGrpcTimeoutSeconds +func (x *CreateRelayOptions) GetStreamdalGrpcTimeoutSeconds() int32 { + if x != nil { + return x.StreamdalGrpcTimeoutSeconds } return 0 } -func (m *CreateRelayOptions) GetDeadLetter() bool { - if m != nil { - return m.DeadLetter +func (x *CreateRelayOptions) GetDeadLetter() bool { + if x != nil { + return x.DeadLetter } return false } -func (m *CreateRelayOptions) GetKafka() *args.KafkaRelayArgs { - if m != nil { - return m.Kafka +func (x *CreateRelayOptions) GetStreamdalIntegrationOptions() *StreamdalIntegrationOptions { + if x != nil { + return x.StreamdalIntegrationOptions + } + return nil +} + +func (x *CreateRelayOptions) GetKafka() *args.KafkaRelayArgs { + if x != nil { + return x.Kafka } return nil } -func (m *CreateRelayOptions) GetAwsSqs() *args.AWSSQSRelayArgs { - if m != nil { - return m.AwsSqs +func (x *CreateRelayOptions) GetAwsSqs() *args.AWSSQSRelayArgs { + if x != nil { + return x.AwsSqs } return nil } -func (m *CreateRelayOptions) GetMongo() *args.MongoReadArgs { - if m != nil { - return m.Mongo +func (x *CreateRelayOptions) GetMongo() *args.MongoReadArgs { + if x != nil { + return x.Mongo } return nil } -func (m *CreateRelayOptions) GetNsq() *args.NSQReadArgs { - if m != nil { - return m.Nsq +func (x *CreateRelayOptions) GetNsq() *args.NSQReadArgs { + if x != nil { + return x.Nsq } return nil } -func (m *CreateRelayOptions) GetRabbit() *args.RabbitReadArgs { - if m != nil { - return m.Rabbit +func (x *CreateRelayOptions) GetRabbit() *args.RabbitReadArgs { + if x != nil { + return x.Rabbit } return nil } -func (m *CreateRelayOptions) GetMqtt() *args.MQTTReadArgs { - if m != nil { - return m.Mqtt +func (x *CreateRelayOptions) GetMqtt() *args.MQTTReadArgs { + if x != nil { + return x.Mqtt } return nil } -func (m *CreateRelayOptions) GetAzureServiceBus() *args.AzureServiceBusReadArgs { - if m != nil { - return m.AzureServiceBus +func (x *CreateRelayOptions) GetAzureServiceBus() *args.AzureServiceBusReadArgs { + if x != nil { + return x.AzureServiceBus } return nil } -func (m *CreateRelayOptions) GetGcpPubsub() *args.GCPPubSubReadArgs { - if m != nil { - return m.GcpPubsub +func (x *CreateRelayOptions) GetGcpPubsub() *args.GCPPubSubReadArgs { + if x != nil { + return x.GcpPubsub } return nil } -func (m *CreateRelayOptions) GetKubemqQueue() *args.KubeMQQueueReadArgs { - if m != nil { - return m.KubemqQueue +func (x *CreateRelayOptions) GetKubemqQueue() *args.KubeMQQueueReadArgs { + if x != nil { + return x.KubemqQueue } return nil } -func (m *CreateRelayOptions) GetRedisPubsub() *args.RedisPubSubReadArgs { - if m != nil { - return m.RedisPubsub +func (x *CreateRelayOptions) GetRedisPubsub() *args.RedisPubSubReadArgs { + if x != nil { + return x.RedisPubsub } return nil } -func (m *CreateRelayOptions) GetRedisStreams() *args.RedisStreamsReadArgs { - if m != nil { - return m.RedisStreams +func (x *CreateRelayOptions) GetRedisStreams() *args.RedisStreamsReadArgs { + if x != nil { + return x.RedisStreams } return nil } -func (m *CreateRelayOptions) GetPostgres() *args.PostgresReadArgs { - if m != nil { - return m.Postgres +func (x *CreateRelayOptions) GetPostgres() *args.PostgresReadArgs { + if x != nil { + return x.Postgres } return nil } -func (m *CreateRelayOptions) GetNats() *args.NatsReadArgs { - if m != nil { - return m.Nats +func (x *CreateRelayOptions) GetNats() *args.NatsReadArgs { + if x != nil { + return x.Nats } return nil } -func (m *CreateRelayOptions) GetNatsStreaming() *args.NatsStreamingReadArgs { - if m != nil { - return m.NatsStreaming +func (x *CreateRelayOptions) GetNatsStreaming() *args.NatsStreamingReadArgs { + if x != nil { + return x.NatsStreaming } return nil } -func (m *CreateRelayOptions) GetNatsJetstream() *args.NatsJetstreamReadArgs { - if m != nil { - return m.NatsJetstream +func (x *CreateRelayOptions) GetNatsJetstream() *args.NatsJetstreamReadArgs { + if x != nil { + return x.NatsJetstream } return nil } type DeleteRelayOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='ID of the relay to delete',required=true" - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" kong:"help='ID of the relay to delete',required=true"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" kong:"help='ID of the relay to delete',required=true"` } -func (m *DeleteRelayOptions) Reset() { *m = DeleteRelayOptions{} } -func (m *DeleteRelayOptions) String() string { return proto.CompactTextString(m) } -func (*DeleteRelayOptions) ProtoMessage() {} -func (*DeleteRelayOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_86dbec1f9d2837a2, []int{2} +func (x *DeleteRelayOptions) Reset() { + *x = DeleteRelayOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_manage_relay_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *DeleteRelayOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeleteRelayOptions.Unmarshal(m, b) -} -func (m *DeleteRelayOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeleteRelayOptions.Marshal(b, m, deterministic) -} -func (m *DeleteRelayOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteRelayOptions.Merge(m, src) +func (x *DeleteRelayOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *DeleteRelayOptions) XXX_Size() int { - return xxx_messageInfo_DeleteRelayOptions.Size(m) -} -func (m *DeleteRelayOptions) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteRelayOptions.DiscardUnknown(m) + +func (*DeleteRelayOptions) ProtoMessage() {} + +func (x *DeleteRelayOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_manage_relay_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_DeleteRelayOptions proto.InternalMessageInfo +// Deprecated: Use DeleteRelayOptions.ProtoReflect.Descriptor instead. +func (*DeleteRelayOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_manage_relay_proto_rawDescGZIP(), []int{3} +} -func (m *DeleteRelayOptions) GetId() string { - if m != nil { - return m.Id +func (x *DeleteRelayOptions) GetId() string { + if x != nil { + return x.Id } return "" } type StopRelayOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='ID of the relay to stop',required=true" - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" kong:"help='ID of the relay to stop',required=true"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" kong:"help='ID of the relay to stop',required=true"` } -func (m *StopRelayOptions) Reset() { *m = StopRelayOptions{} } -func (m *StopRelayOptions) String() string { return proto.CompactTextString(m) } -func (*StopRelayOptions) ProtoMessage() {} -func (*StopRelayOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_86dbec1f9d2837a2, []int{3} +func (x *StopRelayOptions) Reset() { + *x = StopRelayOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_manage_relay_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *StopRelayOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StopRelayOptions.Unmarshal(m, b) -} -func (m *StopRelayOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StopRelayOptions.Marshal(b, m, deterministic) -} -func (m *StopRelayOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_StopRelayOptions.Merge(m, src) +func (x *StopRelayOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *StopRelayOptions) XXX_Size() int { - return xxx_messageInfo_StopRelayOptions.Size(m) -} -func (m *StopRelayOptions) XXX_DiscardUnknown() { - xxx_messageInfo_StopRelayOptions.DiscardUnknown(m) + +func (*StopRelayOptions) ProtoMessage() {} + +func (x *StopRelayOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_manage_relay_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_StopRelayOptions proto.InternalMessageInfo +// Deprecated: Use StopRelayOptions.ProtoReflect.Descriptor instead. +func (*StopRelayOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_manage_relay_proto_rawDescGZIP(), []int{4} +} -func (m *StopRelayOptions) GetId() string { - if m != nil { - return m.Id +func (x *StopRelayOptions) GetId() string { + if x != nil { + return x.Id } return "" } type ResumeRelayOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='ID of the relay to resume',required=true" - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" kong:"help='ID of the relay to resume',required=true"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" kong:"help='ID of the relay to resume',required=true"` } -func (m *ResumeRelayOptions) Reset() { *m = ResumeRelayOptions{} } -func (m *ResumeRelayOptions) String() string { return proto.CompactTextString(m) } -func (*ResumeRelayOptions) ProtoMessage() {} -func (*ResumeRelayOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_86dbec1f9d2837a2, []int{4} +func (x *ResumeRelayOptions) Reset() { + *x = ResumeRelayOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_manage_relay_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ResumeRelayOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ResumeRelayOptions.Unmarshal(m, b) -} -func (m *ResumeRelayOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ResumeRelayOptions.Marshal(b, m, deterministic) -} -func (m *ResumeRelayOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResumeRelayOptions.Merge(m, src) +func (x *ResumeRelayOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ResumeRelayOptions) XXX_Size() int { - return xxx_messageInfo_ResumeRelayOptions.Size(m) -} -func (m *ResumeRelayOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ResumeRelayOptions.DiscardUnknown(m) + +func (*ResumeRelayOptions) ProtoMessage() {} + +func (x *ResumeRelayOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_manage_relay_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ResumeRelayOptions proto.InternalMessageInfo +// Deprecated: Use ResumeRelayOptions.ProtoReflect.Descriptor instead. +func (*ResumeRelayOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_manage_relay_proto_rawDescGZIP(), []int{5} +} -func (m *ResumeRelayOptions) GetId() string { - if m != nil { - return m.Id +func (x *ResumeRelayOptions) GetId() string { + if x != nil { + return x.Id } return "" } -func init() { - proto.RegisterType((*GetRelayOptions)(nil), "protos.opts.GetRelayOptions") - proto.RegisterType((*CreateRelayOptions)(nil), "protos.opts.CreateRelayOptions") - proto.RegisterType((*DeleteRelayOptions)(nil), "protos.opts.DeleteRelayOptions") - proto.RegisterType((*StopRelayOptions)(nil), "protos.opts.StopRelayOptions") - proto.RegisterType((*ResumeRelayOptions)(nil), "protos.opts.ResumeRelayOptions") -} - -func init() { proto.RegisterFile("opts/ps_opts_manage_relay.proto", fileDescriptor_86dbec1f9d2837a2) } - -var fileDescriptor_86dbec1f9d2837a2 = []byte{ - // 852 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x95, 0xdf, 0x6e, 0xdb, 0x36, - 0x18, 0xc5, 0xe1, 0xb4, 0x49, 0x13, 0xba, 0x69, 0x3a, 0x62, 0x68, 0x59, 0x67, 0x69, 0x1c, 0x2f, - 0x18, 0xb2, 0x01, 0xb5, 0xb7, 0x75, 0xbb, 0x28, 0x8a, 0x5d, 0xa4, 0x29, 0x16, 0x74, 0x5b, 0x3a, - 0x5b, 0x32, 0x50, 0x60, 0x37, 0x04, 0x25, 0x7d, 0x95, 0x55, 0x4b, 0xa2, 0xc4, 0x3f, 0x4b, 0x9b, - 0xe7, 0xda, 0x03, 0x0e, 0x24, 0x65, 0x39, 0xb4, 0xdd, 0x5e, 0x09, 0x3e, 0xe7, 0x77, 0x8e, 0x28, - 0x32, 0xfc, 0x82, 0x8e, 0x79, 0xa5, 0xe4, 0xa8, 0x92, 0xd4, 0x3c, 0x69, 0xc1, 0x4a, 0x96, 0x02, - 0x15, 0x90, 0xb3, 0x4f, 0xc3, 0x4a, 0x70, 0xc5, 0x71, 0xd7, 0x3e, 0xe4, 0xd0, 0xf8, 0xbd, 0x1e, - 0x13, 0xa9, 0xa5, 0xcd, 0x93, 0xb2, 0x6b, 0x49, 0x65, 0x2d, 0x1d, 0xd8, 0x3b, 0xf5, 0xbd, 0x1b, - 0x2d, 0x80, 0x4a, 0x10, 0xff, 0x66, 0x31, 0xd0, 0x48, 0x2f, 0xa8, 0x23, 0x8f, 0x4a, 0xe3, 0x8a, - 0x56, 0x3a, 0x92, 0x3a, 0x6a, 0x6c, 0xe2, 0xd9, 0x73, 0xf6, 0x7e, 0xce, 0x1a, 0xe7, 0xd8, 0x77, - 0x74, 0x04, 0x45, 0x4d, 0x6b, 0x0d, 0x1a, 0x36, 0x46, 0x0b, 0x5e, 0xa6, 0xbc, 0x71, 0x1e, 0xfb, - 0x4e, 0xad, 0xd4, 0x46, 0xa3, 0x64, 0x6a, 0xb1, 0xca, 0x93, 0x35, 0x83, 0x7e, 0x00, 0x25, 0x95, - 0x00, 0x56, 0x7c, 0x1e, 0x71, 0x7e, 0x56, 0xa6, 0x0d, 0xf2, 0xc8, 0x47, 0x64, 0xdd, 0xe8, 0x87, - 0x9e, 0x5e, 0x71, 0xa9, 0x52, 0x01, 0x8b, 0x57, 0x3f, 0xf1, 0x4c, 0xc1, 0xa2, 0x28, 0x53, 0x1b, - 0xb7, 0x40, 0x40, 0x92, 0x49, 0x7f, 0xf7, 0xfa, 0x1b, 0x00, 0xb7, 0xa8, 0xa6, 0x7d, 0x70, 0x82, - 0x0e, 0x2e, 0x41, 0x05, 0xe6, 0x7c, 0xff, 0xae, 0x54, 0xc6, 0x4b, 0x89, 0x1f, 0xa0, 0xad, 0x2c, - 0x21, 0x9d, 0x7e, 0xe7, 0x6c, 0x2f, 0xd8, 0xca, 0x92, 0xc1, 0x7f, 0x08, 0xe1, 0x0b, 0x01, 0x4c, - 0x81, 0x87, 0x7d, 0x8b, 0xf6, 0x63, 0x5e, 0x96, 0x10, 0x9b, 0x9f, 0xb4, 0x4d, 0xdc, 0x5f, 0x8a, - 0x6f, 0x12, 0xfc, 0x3d, 0x7a, 0x18, 0xf3, 0x3c, 0x6f, 0x20, 0xc5, 0xe7, 0x50, 0x92, 0x2d, 0xcb, - 0x1d, 0x2c, 0xf5, 0xa9, 0x91, 0xf1, 0x11, 0x42, 0x11, 0x53, 0xf1, 0x8c, 0xca, 0xec, 0x06, 0xc8, - 0x9d, 0x7e, 0xe7, 0x6c, 0x3b, 0xd8, 0xb3, 0x4a, 0x98, 0xdd, 0x00, 0xfe, 0x0e, 0x1d, 0x38, 0xbb, - 0x60, 0x1f, 0xa9, 0x00, 0x25, 0x3e, 0x91, 0xbb, 0x96, 0xd9, 0xb7, 0xf2, 0x15, 0xfb, 0x18, 0x18, - 0x11, 0x1f, 0xa3, 0x6e, 0xa9, 0x0b, 0x7a, 0xcd, 0xc5, 0x1c, 0x84, 0x24, 0xdb, 0x96, 0x41, 0xa5, - 0x2e, 0xde, 0x39, 0x05, 0xff, 0x82, 0x1e, 0xb9, 0x2d, 0x48, 0x58, 0x4e, 0x53, 0x51, 0xc5, 0x94, - 0x25, 0x89, 0x00, 0x29, 0xc9, 0x8e, 0x5d, 0xd8, 0xd7, 0xad, 0x7b, 0x29, 0xaa, 0xf8, 0xdc, 0x79, - 0xf8, 0x25, 0xea, 0xad, 0xa4, 0x92, 0x4c, 0xb2, 0x28, 0x07, 0xaa, 0x72, 0x49, 0xee, 0xf5, 0x3b, - 0x67, 0xbb, 0xc1, 0x63, 0x2f, 0xf9, 0xda, 0xf9, 0xd3, 0x5c, 0xe2, 0x0b, 0xf4, 0x74, 0x25, 0xac, - 0xb2, 0x02, 0xb8, 0x56, 0x54, 0x42, 0xcc, 0xcb, 0x44, 0x92, 0x5d, 0xbb, 0xcc, 0x43, 0xaf, 0x60, - 0xea, 0x98, 0xd0, 0x21, 0xe6, 0xc3, 0x12, 0x60, 0x09, 0xcd, 0x41, 0x29, 0x10, 0x64, 0xcf, 0xbe, - 0x12, 0x19, 0xe9, 0x2f, 0xab, 0xe0, 0x9f, 0xd0, 0xb6, 0xbd, 0x1f, 0x24, 0xe9, 0x77, 0xce, 0xba, - 0x3f, 0x1f, 0x0e, 0x9b, 0x8b, 0x6a, 0xce, 0x7e, 0xf8, 0xa7, 0x71, 0xec, 0xf9, 0x9d, 0x8b, 0x54, - 0x06, 0x8e, 0xc4, 0xbf, 0xa2, 0x7b, 0xcd, 0x9d, 0x25, 0x60, 0x43, 0xdf, 0x78, 0xa1, 0xf3, 0x77, - 0x61, 0x38, 0x09, 0x97, 0xa9, 0x1d, 0x76, 0x2d, 0xc3, 0x5a, 0xe2, 0x1f, 0xd1, 0xb6, 0xbd, 0x4e, - 0xe4, 0xbd, 0x0d, 0xf5, 0xbc, 0xd0, 0x95, 0x71, 0x02, 0x60, 0x89, 0x7b, 0x91, 0x05, 0xf1, 0x0f, - 0xe8, 0x4e, 0x29, 0x6b, 0x92, 0x5a, 0x9e, 0x78, 0xfc, 0xdb, 0x70, 0xd2, 0xd2, 0x06, 0xc2, 0xcf, - 0xd1, 0x8e, 0xfb, 0x2b, 0x27, 0xb3, 0x0d, 0x1f, 0x12, 0x58, 0xab, 0x4d, 0x34, 0x28, 0x7e, 0x86, - 0xee, 0x9a, 0x7b, 0x4c, 0x32, 0x1b, 0x79, 0xe2, 0xaf, 0x68, 0x32, 0x9d, 0xb6, 0x01, 0x8b, 0xe1, - 0x31, 0xfa, 0x6a, 0x6d, 0x20, 0x91, 0x0f, 0x36, 0x7b, 0xea, 0x6f, 0x81, 0xa1, 0x42, 0x07, 0xbd, - 0xd2, 0xb2, 0xad, 0x39, 0x60, 0xbe, 0x81, 0x7f, 0x43, 0x68, 0x39, 0xbc, 0xc8, 0xdc, 0x56, 0x3d, - 0xf5, 0xaa, 0x2e, 0x2f, 0xc6, 0x63, 0x1d, 0x85, 0x3a, 0x6a, 0x4b, 0xf6, 0xd2, 0xb8, 0x1a, 0xdb, - 0x00, 0xbe, 0x40, 0xf7, 0x6f, 0x8f, 0x30, 0x92, 0xdb, 0x82, 0xbe, 0x7f, 0x86, 0x3a, 0x82, 0xab, - 0xc9, 0xc4, 0xf8, 0x6d, 0x45, 0xd7, 0xa5, 0xac, 0x68, 0x4a, 0x6e, 0x0f, 0x01, 0x52, 0x6c, 0x28, - 0x09, 0x0c, 0xb0, 0xb2, 0x8e, 0xae, 0x68, 0x44, 0xb3, 0x92, 0xdf, 0xd1, 0xbe, 0x37, 0x28, 0x08, - 0xb7, 0x2d, 0x27, 0xeb, 0x2d, 0xa1, 0x03, 0xda, 0x1a, 0xf7, 0xf2, 0x46, 0xc5, 0x2f, 0xd0, 0xee, - 0x62, 0x92, 0x91, 0xca, 0x56, 0x1c, 0x79, 0x15, 0xe3, 0xc6, 0x6c, 0xe3, 0x2d, 0x6e, 0x0e, 0xd3, - 0xcc, 0x4f, 0x52, 0x6f, 0x38, 0xcc, 0xb7, 0x4c, 0x2d, 0x23, 0x16, 0xc3, 0x6f, 0xd0, 0x03, 0x7f, - 0xdc, 0x12, 0x61, 0x83, 0x83, 0xb5, 0x60, 0xb8, 0x20, 0xda, 0x86, 0xfd, 0xf2, 0xb6, 0xdc, 0x56, - 0xb5, 0xc3, 0x9d, 0xc8, 0xcf, 0x54, 0xfd, 0xb1, 0x20, 0xfc, 0xaa, 0x56, 0x1e, 0x9c, 0x22, 0xfc, - 0x1a, 0x72, 0x58, 0x99, 0x9a, 0xab, 0xc3, 0x75, 0x80, 0x1e, 0x86, 0x8a, 0x57, 0x5f, 0x64, 0x4e, - 0x11, 0x0e, 0x40, 0xea, 0xe2, 0x8b, 0x4d, 0xaf, 0x5e, 0xfe, 0xf3, 0x22, 0xcd, 0xd4, 0x4c, 0x47, - 0xc3, 0x98, 0x17, 0x23, 0x3b, 0x14, 0x63, 0x2e, 0xaa, 0x51, 0x95, 0xeb, 0x22, 0x02, 0xf1, 0x4c, - 0xc6, 0x33, 0x28, 0x98, 0x1c, 0x45, 0x3a, 0xcb, 0x93, 0x51, 0xca, 0x47, 0xee, 0x8b, 0x46, 0xe6, - 0xff, 0x78, 0xb4, 0x63, 0x7f, 0x3c, 0xff, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x58, 0x21, 0xc6, 0xe8, - 0xfe, 0x07, 0x00, 0x00, +var File_opts_ps_opts_manage_relay_proto protoreflect.FileDescriptor + +var file_opts_ps_opts_manage_relay_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x1a, 0x1a, + 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x77, 0x73, + 0x5f, 0x73, 0x71, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x24, 0x61, 0x72, 0x67, 0x73, + 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1d, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x67, + 0x63, 0x70, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x18, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6b, 0x61, + 0x66, 0x6b, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x61, 0x72, 0x67, 0x73, 0x2f, + 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, 0x5f, 0x71, + 0x75, 0x65, 0x75, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x61, 0x72, 0x67, 0x73, + 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, + 0x67, 0x73, 0x5f, 0x6d, 0x71, 0x74, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x61, + 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, + 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x6a, 0x65, 0x74, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x61, 0x72, 0x67, 0x73, 0x2f, + 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x61, 0x72, + 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x73, 0x71, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, + 0x67, 0x73, 0x5f, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x19, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, + 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x61, 0x72, + 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x73, + 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x61, + 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x65, 0x64, 0x69, + 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x21, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x69, 0x64, 0x22, 0xc6, 0x02, 0x0a, 0x1b, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, + 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x40, 0x0a, 0x1c, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x5f, + 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x6e, 0x61, 0x62, + 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x1a, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x64, 0x61, 0x6c, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x12, 0x4f, 0x0a, 0x24, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, + 0x6c, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x21, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x49, 0x6e, 0x74, + 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x47, 0x0a, 0x20, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, + 0x61, 0x6c, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, + 0x75, 0x74, 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x1d, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x4b, + 0x0a, 0x22, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x5f, 0x69, 0x6e, 0x74, 0x65, + 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x1f, 0x73, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xa2, 0x0b, 0x0a, 0x12, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x6f, 0x6c, 0x6c, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x73, 0x69, 0x7a, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x62, 0x61, 0x74, 0x63, 0x68, 0x53, 0x69, 0x7a, + 0x65, 0x12, 0x26, 0x0a, 0x0f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x72, + 0x65, 0x74, 0x72, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x62, 0x61, 0x74, 0x63, + 0x68, 0x4d, 0x61, 0x78, 0x52, 0x65, 0x74, 0x72, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x6e, 0x75, 0x6d, + 0x5f, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, + 0x6e, 0x75, 0x6d, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x73, 0x12, 0x34, 0x0a, 0x16, 0x73, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x73, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x47, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x12, 0x3b, 0x0a, 0x1a, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x5f, 0x67, 0x72, + 0x70, 0x63, 0x5f, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x74, 0x6c, 0x73, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x17, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x47, + 0x72, 0x70, 0x63, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x6c, 0x73, 0x12, 0x43, 0x0a, + 0x1e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, + 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x1b, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, + 0x47, 0x72, 0x70, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x53, 0x65, 0x63, 0x6f, 0x6e, + 0x64, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x65, 0x61, 0x64, 0x5f, 0x6c, 0x65, 0x74, 0x74, 0x65, + 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x61, 0x64, 0x4c, 0x65, 0x74, + 0x74, 0x65, 0x72, 0x12, 0x6c, 0x0a, 0x1d, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, + 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, + 0x61, 0x6c, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x1b, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x49, + 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x31, 0x0a, 0x05, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4b, + 0x61, 0x66, 0x6b, 0x61, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x41, 0x72, 0x67, 0x73, 0x52, 0x05, 0x6b, + 0x61, 0x66, 0x6b, 0x61, 0x12, 0x35, 0x0a, 0x07, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x71, 0x73, 0x18, + 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, + 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x53, 0x51, 0x53, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x41, + 0x72, 0x67, 0x73, 0x52, 0x06, 0x61, 0x77, 0x73, 0x53, 0x71, 0x73, 0x12, 0x30, 0x0a, 0x05, 0x6d, + 0x6f, 0x6e, 0x67, 0x6f, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4d, 0x6f, 0x6e, 0x67, 0x6f, 0x52, 0x65, + 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x05, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x12, 0x2a, 0x0a, + 0x03, 0x6e, 0x73, 0x71, 0x18, 0x67, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x53, 0x51, 0x52, 0x65, 0x61, 0x64, + 0x41, 0x72, 0x67, 0x73, 0x52, 0x03, 0x6e, 0x73, 0x71, 0x12, 0x33, 0x0a, 0x06, 0x72, 0x61, 0x62, + 0x62, 0x69, 0x74, 0x18, 0x68, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x52, 0x65, + 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x06, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x12, 0x2d, + 0x0a, 0x04, 0x6d, 0x71, 0x74, 0x74, 0x18, 0x69, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4d, 0x51, 0x54, 0x54, 0x52, + 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x6d, 0x71, 0x74, 0x74, 0x12, 0x50, 0x0a, + 0x11, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x62, + 0x75, 0x73, 0x18, 0x6a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x0f, + 0x61, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, 0x12, + 0x3d, 0x0a, 0x0a, 0x67, 0x63, 0x70, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x18, 0x6b, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, + 0x73, 0x2e, 0x47, 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x52, 0x65, 0x61, 0x64, 0x41, + 0x72, 0x67, 0x73, 0x52, 0x09, 0x67, 0x63, 0x70, 0x50, 0x75, 0x62, 0x73, 0x75, 0x62, 0x12, 0x43, + 0x0a, 0x0c, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, 0x5f, 0x71, 0x75, 0x65, 0x75, 0x65, 0x18, 0x6c, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, + 0x67, 0x73, 0x2e, 0x4b, 0x75, 0x62, 0x65, 0x4d, 0x51, 0x51, 0x75, 0x65, 0x75, 0x65, 0x52, 0x65, + 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x0b, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, 0x51, 0x75, + 0x65, 0x75, 0x65, 0x12, 0x43, 0x0a, 0x0c, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x70, 0x75, 0x62, + 0x73, 0x75, 0x62, 0x18, 0x6d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, + 0x53, 0x75, 0x62, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x0b, 0x72, 0x65, 0x64, + 0x69, 0x73, 0x50, 0x75, 0x62, 0x73, 0x75, 0x62, 0x12, 0x46, 0x0a, 0x0d, 0x72, 0x65, 0x64, 0x69, + 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x6f, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x65, + 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, + 0x67, 0x73, 0x52, 0x0c, 0x72, 0x65, 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, + 0x12, 0x39, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x18, 0x70, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, + 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, + 0x73, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x12, 0x2d, 0x0a, 0x04, 0x6e, + 0x61, 0x74, 0x73, 0x18, 0x71, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x52, 0x65, 0x61, 0x64, + 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x6e, 0x61, 0x74, 0x73, 0x12, 0x49, 0x0a, 0x0e, 0x6e, 0x61, + 0x74, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x72, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, + 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x52, 0x65, + 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x0d, 0x6e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x12, 0x49, 0x0a, 0x0e, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x6a, 0x65, + 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18, 0x73, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, + 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, + 0x73, 0x52, 0x0d, 0x6e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x22, 0x24, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x22, 0x0a, 0x10, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, + 0x6c, 0x61, 0x79, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x24, 0x0a, 0x12, 0x52, 0x65, + 0x73, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, + 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, + 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, + 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x6f, 0x70, 0x74, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_opts_ps_opts_manage_relay_proto_rawDescOnce sync.Once + file_opts_ps_opts_manage_relay_proto_rawDescData = file_opts_ps_opts_manage_relay_proto_rawDesc +) + +func file_opts_ps_opts_manage_relay_proto_rawDescGZIP() []byte { + file_opts_ps_opts_manage_relay_proto_rawDescOnce.Do(func() { + file_opts_ps_opts_manage_relay_proto_rawDescData = protoimpl.X.CompressGZIP(file_opts_ps_opts_manage_relay_proto_rawDescData) + }) + return file_opts_ps_opts_manage_relay_proto_rawDescData +} + +var file_opts_ps_opts_manage_relay_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_opts_ps_opts_manage_relay_proto_goTypes = []interface{}{ + (*GetRelayOptions)(nil), // 0: protos.opts.GetRelayOptions + (*StreamdalIntegrationOptions)(nil), // 1: protos.opts.StreamdalIntegrationOptions + (*CreateRelayOptions)(nil), // 2: protos.opts.CreateRelayOptions + (*DeleteRelayOptions)(nil), // 3: protos.opts.DeleteRelayOptions + (*StopRelayOptions)(nil), // 4: protos.opts.StopRelayOptions + (*ResumeRelayOptions)(nil), // 5: protos.opts.ResumeRelayOptions + (*args.KafkaRelayArgs)(nil), // 6: protos.args.KafkaRelayArgs + (*args.AWSSQSRelayArgs)(nil), // 7: protos.args.AWSSQSRelayArgs + (*args.MongoReadArgs)(nil), // 8: protos.args.MongoReadArgs + (*args.NSQReadArgs)(nil), // 9: protos.args.NSQReadArgs + (*args.RabbitReadArgs)(nil), // 10: protos.args.RabbitReadArgs + (*args.MQTTReadArgs)(nil), // 11: protos.args.MQTTReadArgs + (*args.AzureServiceBusReadArgs)(nil), // 12: protos.args.AzureServiceBusReadArgs + (*args.GCPPubSubReadArgs)(nil), // 13: protos.args.GCPPubSubReadArgs + (*args.KubeMQQueueReadArgs)(nil), // 14: protos.args.KubeMQQueueReadArgs + (*args.RedisPubSubReadArgs)(nil), // 15: protos.args.RedisPubSubReadArgs + (*args.RedisStreamsReadArgs)(nil), // 16: protos.args.RedisStreamsReadArgs + (*args.PostgresReadArgs)(nil), // 17: protos.args.PostgresReadArgs + (*args.NatsReadArgs)(nil), // 18: protos.args.NatsReadArgs + (*args.NatsStreamingReadArgs)(nil), // 19: protos.args.NatsStreamingReadArgs + (*args.NatsJetstreamReadArgs)(nil), // 20: protos.args.NatsJetstreamReadArgs +} +var file_opts_ps_opts_manage_relay_proto_depIdxs = []int32{ + 1, // 0: protos.opts.CreateRelayOptions.streamdal_integration_options:type_name -> protos.opts.StreamdalIntegrationOptions + 6, // 1: protos.opts.CreateRelayOptions.kafka:type_name -> protos.args.KafkaRelayArgs + 7, // 2: protos.opts.CreateRelayOptions.aws_sqs:type_name -> protos.args.AWSSQSRelayArgs + 8, // 3: protos.opts.CreateRelayOptions.mongo:type_name -> protos.args.MongoReadArgs + 9, // 4: protos.opts.CreateRelayOptions.nsq:type_name -> protos.args.NSQReadArgs + 10, // 5: protos.opts.CreateRelayOptions.rabbit:type_name -> protos.args.RabbitReadArgs + 11, // 6: protos.opts.CreateRelayOptions.mqtt:type_name -> protos.args.MQTTReadArgs + 12, // 7: protos.opts.CreateRelayOptions.azure_service_bus:type_name -> protos.args.AzureServiceBusReadArgs + 13, // 8: protos.opts.CreateRelayOptions.gcp_pubsub:type_name -> protos.args.GCPPubSubReadArgs + 14, // 9: protos.opts.CreateRelayOptions.kubemq_queue:type_name -> protos.args.KubeMQQueueReadArgs + 15, // 10: protos.opts.CreateRelayOptions.redis_pubsub:type_name -> protos.args.RedisPubSubReadArgs + 16, // 11: protos.opts.CreateRelayOptions.redis_streams:type_name -> protos.args.RedisStreamsReadArgs + 17, // 12: protos.opts.CreateRelayOptions.postgres:type_name -> protos.args.PostgresReadArgs + 18, // 13: protos.opts.CreateRelayOptions.nats:type_name -> protos.args.NatsReadArgs + 19, // 14: protos.opts.CreateRelayOptions.nats_streaming:type_name -> protos.args.NatsStreamingReadArgs + 20, // 15: protos.opts.CreateRelayOptions.nats_jetstream:type_name -> protos.args.NatsJetstreamReadArgs + 16, // [16:16] is the sub-list for method output_type + 16, // [16:16] is the sub-list for method input_type + 16, // [16:16] is the sub-list for extension type_name + 16, // [16:16] is the sub-list for extension extendee + 0, // [0:16] is the sub-list for field type_name +} + +func init() { file_opts_ps_opts_manage_relay_proto_init() } +func file_opts_ps_opts_manage_relay_proto_init() { + if File_opts_ps_opts_manage_relay_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_opts_ps_opts_manage_relay_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRelayOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_manage_relay_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamdalIntegrationOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_manage_relay_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateRelayOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_manage_relay_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteRelayOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_manage_relay_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StopRelayOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_manage_relay_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResumeRelayOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_opts_ps_opts_manage_relay_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_opts_ps_opts_manage_relay_proto_goTypes, + DependencyIndexes: file_opts_ps_opts_manage_relay_proto_depIdxs, + MessageInfos: file_opts_ps_opts_manage_relay_proto_msgTypes, + }.Build() + File_opts_ps_opts_manage_relay_proto = out.File + file_opts_ps_opts_manage_relay_proto_rawDesc = nil + file_opts_ps_opts_manage_relay_proto_goTypes = nil + file_opts_ps_opts_manage_relay_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_manage_tunnel.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_manage_tunnel.pb.go index ae73b646c..9804fd454 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_manage_tunnel.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_manage_tunnel.pb.go @@ -1,67 +1,79 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: opts/ps_opts_manage_tunnel.proto package opts import ( - fmt "fmt" args "github.com/batchcorp/plumber-schemas/build/go/protos/args" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type GetTunnelOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='ID of the tunnel to get (leave empty to get all)'" - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" kong:"help='ID of the tunnel to get (leave empty to get all)'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" kong:"help='ID of the tunnel to get (leave empty to get all)'"` } -func (m *GetTunnelOptions) Reset() { *m = GetTunnelOptions{} } -func (m *GetTunnelOptions) String() string { return proto.CompactTextString(m) } -func (*GetTunnelOptions) ProtoMessage() {} -func (*GetTunnelOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_b9d5e823fc1e6249, []int{0} +func (x *GetTunnelOptions) Reset() { + *x = GetTunnelOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_manage_tunnel_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GetTunnelOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetTunnelOptions.Unmarshal(m, b) -} -func (m *GetTunnelOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetTunnelOptions.Marshal(b, m, deterministic) -} -func (m *GetTunnelOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetTunnelOptions.Merge(m, src) -} -func (m *GetTunnelOptions) XXX_Size() int { - return xxx_messageInfo_GetTunnelOptions.Size(m) +func (x *GetTunnelOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GetTunnelOptions) XXX_DiscardUnknown() { - xxx_messageInfo_GetTunnelOptions.DiscardUnknown(m) + +func (*GetTunnelOptions) ProtoMessage() {} + +func (x *GetTunnelOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_manage_tunnel_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_GetTunnelOptions proto.InternalMessageInfo +// Deprecated: Use GetTunnelOptions.ProtoReflect.Descriptor instead. +func (*GetTunnelOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_manage_tunnel_proto_rawDescGZIP(), []int{0} +} -func (m *GetTunnelOptions) GetId() string { - if m != nil { - return m.Id +func (x *GetTunnelOptions) GetId() string { + if x != nil { + return x.Id } return "" } type CreateTunnelOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Connection ID for the tunnel to use',required=true" ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" kong:"help='Connection ID for the tunnel to use',required=true"` // @gotags: kong:"help='Streamdal API token (create in settings -> security)',required=true" @@ -115,413 +127,681 @@ type CreateTunnelOptions struct { // @gotags: kong:"cmd,help='AWS Kinesis Streams'" AwsKinesis *args.AWSKinesisWriteArgs `protobuf:"bytes,118,opt,name=aws_kinesis,json=awsKinesis,proto3" json:"aws_kinesis,omitempty" kong:"cmd,help='AWS Kinesis Streams'"` // @gotags: kong:"cmd,help='Memphis'" - Memphis *args.MemphisWriteArgs `protobuf:"bytes,119,opt,name=memphis,proto3" json:"memphis,omitempty" kong:"cmd,help='Memphis'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Memphis *args.MemphisWriteArgs `protobuf:"bytes,119,opt,name=memphis,proto3" json:"memphis,omitempty" kong:"cmd,help='Memphis'"` } -func (m *CreateTunnelOptions) Reset() { *m = CreateTunnelOptions{} } -func (m *CreateTunnelOptions) String() string { return proto.CompactTextString(m) } -func (*CreateTunnelOptions) ProtoMessage() {} -func (*CreateTunnelOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_b9d5e823fc1e6249, []int{1} +func (x *CreateTunnelOptions) Reset() { + *x = CreateTunnelOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_manage_tunnel_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *CreateTunnelOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateTunnelOptions.Unmarshal(m, b) +func (x *CreateTunnelOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CreateTunnelOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateTunnelOptions.Marshal(b, m, deterministic) -} -func (m *CreateTunnelOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateTunnelOptions.Merge(m, src) -} -func (m *CreateTunnelOptions) XXX_Size() int { - return xxx_messageInfo_CreateTunnelOptions.Size(m) -} -func (m *CreateTunnelOptions) XXX_DiscardUnknown() { - xxx_messageInfo_CreateTunnelOptions.DiscardUnknown(m) + +func (*CreateTunnelOptions) ProtoMessage() {} + +func (x *CreateTunnelOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_manage_tunnel_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_CreateTunnelOptions proto.InternalMessageInfo +// Deprecated: Use CreateTunnelOptions.ProtoReflect.Descriptor instead. +func (*CreateTunnelOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_manage_tunnel_proto_rawDescGZIP(), []int{1} +} -func (m *CreateTunnelOptions) GetConnectionId() string { - if m != nil { - return m.ConnectionId +func (x *CreateTunnelOptions) GetConnectionId() string { + if x != nil { + return x.ConnectionId } return "" } -func (m *CreateTunnelOptions) GetTunnelToken() string { - if m != nil { - return m.TunnelToken +func (x *CreateTunnelOptions) GetTunnelToken() string { + if x != nil { + return x.TunnelToken } return "" } -func (m *CreateTunnelOptions) GetName() string { - if m != nil { - return m.Name +func (x *CreateTunnelOptions) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *CreateTunnelOptions) GetNotes() string { - if m != nil { - return m.Notes +func (x *CreateTunnelOptions) GetNotes() string { + if x != nil { + return x.Notes } return "" } -func (m *CreateTunnelOptions) GetXTunnelAddress() string { - if m != nil { - return m.XTunnelAddress +func (x *CreateTunnelOptions) GetXTunnelAddress() string { + if x != nil { + return x.XTunnelAddress } return "" } -func (m *CreateTunnelOptions) GetXTunnelTimeoutSeconds() uint32 { - if m != nil { - return m.XTunnelTimeoutSeconds +func (x *CreateTunnelOptions) GetXTunnelTimeoutSeconds() uint32 { + if x != nil { + return x.XTunnelTimeoutSeconds } return 0 } -func (m *CreateTunnelOptions) GetXTunnelInsecure() bool { - if m != nil { - return m.XTunnelInsecure +func (x *CreateTunnelOptions) GetXTunnelInsecure() bool { + if x != nil { + return x.XTunnelInsecure } return false } -func (m *CreateTunnelOptions) GetKafka() *args.KafkaWriteArgs { - if m != nil { - return m.Kafka +func (x *CreateTunnelOptions) GetKafka() *args.KafkaWriteArgs { + if x != nil { + return x.Kafka } return nil } -func (m *CreateTunnelOptions) GetActivemq() *args.ActiveMQWriteArgs { - if m != nil { - return m.Activemq +func (x *CreateTunnelOptions) GetActivemq() *args.ActiveMQWriteArgs { + if x != nil { + return x.Activemq } return nil } -func (m *CreateTunnelOptions) GetAwsSqs() *args.AWSSQSWriteArgs { - if m != nil { - return m.AwsSqs +func (x *CreateTunnelOptions) GetAwsSqs() *args.AWSSQSWriteArgs { + if x != nil { + return x.AwsSqs } return nil } -func (m *CreateTunnelOptions) GetAwsSns() *args.AWSSNSWriteArgs { - if m != nil { - return m.AwsSns +func (x *CreateTunnelOptions) GetAwsSns() *args.AWSSNSWriteArgs { + if x != nil { + return x.AwsSns } return nil } -func (m *CreateTunnelOptions) GetNats() *args.NatsWriteArgs { - if m != nil { - return m.Nats +func (x *CreateTunnelOptions) GetNats() *args.NatsWriteArgs { + if x != nil { + return x.Nats } return nil } -func (m *CreateTunnelOptions) GetNatsStreaming() *args.NatsStreamingWriteArgs { - if m != nil { - return m.NatsStreaming +func (x *CreateTunnelOptions) GetNatsStreaming() *args.NatsStreamingWriteArgs { + if x != nil { + return x.NatsStreaming } return nil } -func (m *CreateTunnelOptions) GetNsq() *args.NSQWriteArgs { - if m != nil { - return m.Nsq +func (x *CreateTunnelOptions) GetNsq() *args.NSQWriteArgs { + if x != nil { + return x.Nsq } return nil } -func (m *CreateTunnelOptions) GetRabbit() *args.RabbitWriteArgs { - if m != nil { - return m.Rabbit +func (x *CreateTunnelOptions) GetRabbit() *args.RabbitWriteArgs { + if x != nil { + return x.Rabbit } return nil } -func (m *CreateTunnelOptions) GetMqtt() *args.MQTTWriteArgs { - if m != nil { - return m.Mqtt +func (x *CreateTunnelOptions) GetMqtt() *args.MQTTWriteArgs { + if x != nil { + return x.Mqtt } return nil } -func (m *CreateTunnelOptions) GetAzureServiceBus() *args.AzureServiceBusWriteArgs { - if m != nil { - return m.AzureServiceBus +func (x *CreateTunnelOptions) GetAzureServiceBus() *args.AzureServiceBusWriteArgs { + if x != nil { + return x.AzureServiceBus } return nil } -func (m *CreateTunnelOptions) GetAzureEventHub() *args.AzureEventHubWriteArgs { - if m != nil { - return m.AzureEventHub +func (x *CreateTunnelOptions) GetAzureEventHub() *args.AzureEventHubWriteArgs { + if x != nil { + return x.AzureEventHub } return nil } -func (m *CreateTunnelOptions) GetGcpPubsub() *args.GCPPubSubWriteArgs { - if m != nil { - return m.GcpPubsub +func (x *CreateTunnelOptions) GetGcpPubsub() *args.GCPPubSubWriteArgs { + if x != nil { + return x.GcpPubsub } return nil } -func (m *CreateTunnelOptions) GetKubemqQueue() *args.KubeMQQueueWriteArgs { - if m != nil { - return m.KubemqQueue +func (x *CreateTunnelOptions) GetKubemqQueue() *args.KubeMQQueueWriteArgs { + if x != nil { + return x.KubemqQueue } return nil } -func (m *CreateTunnelOptions) GetRedisPubsub() *args.RedisPubSubWriteArgs { - if m != nil { - return m.RedisPubsub +func (x *CreateTunnelOptions) GetRedisPubsub() *args.RedisPubSubWriteArgs { + if x != nil { + return x.RedisPubsub } return nil } -func (m *CreateTunnelOptions) GetRedisStreams() *args.RedisStreamsWriteArgs { - if m != nil { - return m.RedisStreams +func (x *CreateTunnelOptions) GetRedisStreams() *args.RedisStreamsWriteArgs { + if x != nil { + return x.RedisStreams } return nil } -func (m *CreateTunnelOptions) GetPulsar() *args.PulsarWriteArgs { - if m != nil { - return m.Pulsar +func (x *CreateTunnelOptions) GetPulsar() *args.PulsarWriteArgs { + if x != nil { + return x.Pulsar } return nil } -func (m *CreateTunnelOptions) GetRabbitStreams() *args.RabbitStreamsWriteArgs { - if m != nil { - return m.RabbitStreams +func (x *CreateTunnelOptions) GetRabbitStreams() *args.RabbitStreamsWriteArgs { + if x != nil { + return x.RabbitStreams } return nil } -func (m *CreateTunnelOptions) GetNatsJetstream() *args.NatsJetstreamWriteArgs { - if m != nil { - return m.NatsJetstream +func (x *CreateTunnelOptions) GetNatsJetstream() *args.NatsJetstreamWriteArgs { + if x != nil { + return x.NatsJetstream } return nil } -func (m *CreateTunnelOptions) GetAwsKinesis() *args.AWSKinesisWriteArgs { - if m != nil { - return m.AwsKinesis +func (x *CreateTunnelOptions) GetAwsKinesis() *args.AWSKinesisWriteArgs { + if x != nil { + return x.AwsKinesis } return nil } -func (m *CreateTunnelOptions) GetMemphis() *args.MemphisWriteArgs { - if m != nil { - return m.Memphis +func (x *CreateTunnelOptions) GetMemphis() *args.MemphisWriteArgs { + if x != nil { + return x.Memphis } return nil } type DeleteTunnelOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='ID of the tunnel to delete',required=true" - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" kong:"help='ID of the tunnel to delete',required=true"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" kong:"help='ID of the tunnel to delete',required=true"` } -func (m *DeleteTunnelOptions) Reset() { *m = DeleteTunnelOptions{} } -func (m *DeleteTunnelOptions) String() string { return proto.CompactTextString(m) } -func (*DeleteTunnelOptions) ProtoMessage() {} -func (*DeleteTunnelOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_b9d5e823fc1e6249, []int{2} +func (x *DeleteTunnelOptions) Reset() { + *x = DeleteTunnelOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_manage_tunnel_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *DeleteTunnelOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeleteTunnelOptions.Unmarshal(m, b) -} -func (m *DeleteTunnelOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeleteTunnelOptions.Marshal(b, m, deterministic) +func (x *DeleteTunnelOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *DeleteTunnelOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteTunnelOptions.Merge(m, src) -} -func (m *DeleteTunnelOptions) XXX_Size() int { - return xxx_messageInfo_DeleteTunnelOptions.Size(m) -} -func (m *DeleteTunnelOptions) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteTunnelOptions.DiscardUnknown(m) + +func (*DeleteTunnelOptions) ProtoMessage() {} + +func (x *DeleteTunnelOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_manage_tunnel_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_DeleteTunnelOptions proto.InternalMessageInfo +// Deprecated: Use DeleteTunnelOptions.ProtoReflect.Descriptor instead. +func (*DeleteTunnelOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_manage_tunnel_proto_rawDescGZIP(), []int{2} +} -func (m *DeleteTunnelOptions) GetId() string { - if m != nil { - return m.Id +func (x *DeleteTunnelOptions) GetId() string { + if x != nil { + return x.Id } return "" } type StopTunnelOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='ID of the tunnel to stop',required=true" - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" kong:"help='ID of the tunnel to stop',required=true"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" kong:"help='ID of the tunnel to stop',required=true"` } -func (m *StopTunnelOptions) Reset() { *m = StopTunnelOptions{} } -func (m *StopTunnelOptions) String() string { return proto.CompactTextString(m) } -func (*StopTunnelOptions) ProtoMessage() {} -func (*StopTunnelOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_b9d5e823fc1e6249, []int{3} +func (x *StopTunnelOptions) Reset() { + *x = StopTunnelOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_manage_tunnel_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *StopTunnelOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StopTunnelOptions.Unmarshal(m, b) -} -func (m *StopTunnelOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StopTunnelOptions.Marshal(b, m, deterministic) +func (x *StopTunnelOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *StopTunnelOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_StopTunnelOptions.Merge(m, src) -} -func (m *StopTunnelOptions) XXX_Size() int { - return xxx_messageInfo_StopTunnelOptions.Size(m) -} -func (m *StopTunnelOptions) XXX_DiscardUnknown() { - xxx_messageInfo_StopTunnelOptions.DiscardUnknown(m) + +func (*StopTunnelOptions) ProtoMessage() {} + +func (x *StopTunnelOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_manage_tunnel_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_StopTunnelOptions proto.InternalMessageInfo +// Deprecated: Use StopTunnelOptions.ProtoReflect.Descriptor instead. +func (*StopTunnelOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_manage_tunnel_proto_rawDescGZIP(), []int{3} +} -func (m *StopTunnelOptions) GetId() string { - if m != nil { - return m.Id +func (x *StopTunnelOptions) GetId() string { + if x != nil { + return x.Id } return "" } type ResumeTunnelOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='ID of the tunnel to resume',required=true" - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" kong:"help='ID of the tunnel to resume',required=true"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" kong:"help='ID of the tunnel to resume',required=true"` } -func (m *ResumeTunnelOptions) Reset() { *m = ResumeTunnelOptions{} } -func (m *ResumeTunnelOptions) String() string { return proto.CompactTextString(m) } -func (*ResumeTunnelOptions) ProtoMessage() {} -func (*ResumeTunnelOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_b9d5e823fc1e6249, []int{4} +func (x *ResumeTunnelOptions) Reset() { + *x = ResumeTunnelOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_manage_tunnel_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ResumeTunnelOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ResumeTunnelOptions.Unmarshal(m, b) -} -func (m *ResumeTunnelOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ResumeTunnelOptions.Marshal(b, m, deterministic) +func (x *ResumeTunnelOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ResumeTunnelOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResumeTunnelOptions.Merge(m, src) -} -func (m *ResumeTunnelOptions) XXX_Size() int { - return xxx_messageInfo_ResumeTunnelOptions.Size(m) -} -func (m *ResumeTunnelOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ResumeTunnelOptions.DiscardUnknown(m) + +func (*ResumeTunnelOptions) ProtoMessage() {} + +func (x *ResumeTunnelOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_manage_tunnel_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ResumeTunnelOptions proto.InternalMessageInfo +// Deprecated: Use ResumeTunnelOptions.ProtoReflect.Descriptor instead. +func (*ResumeTunnelOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_manage_tunnel_proto_rawDescGZIP(), []int{4} +} -func (m *ResumeTunnelOptions) GetId() string { - if m != nil { - return m.Id +func (x *ResumeTunnelOptions) GetId() string { + if x != nil { + return x.Id } return "" } -func init() { - proto.RegisterType((*GetTunnelOptions)(nil), "protos.opts.GetTunnelOptions") - proto.RegisterType((*CreateTunnelOptions)(nil), "protos.opts.CreateTunnelOptions") - proto.RegisterType((*DeleteTunnelOptions)(nil), "protos.opts.DeleteTunnelOptions") - proto.RegisterType((*StopTunnelOptions)(nil), "protos.opts.StopTunnelOptions") - proto.RegisterType((*ResumeTunnelOptions)(nil), "protos.opts.ResumeTunnelOptions") -} - -func init() { proto.RegisterFile("opts/ps_opts_manage_tunnel.proto", fileDescriptor_b9d5e823fc1e6249) } - -var fileDescriptor_b9d5e823fc1e6249 = []byte{ - // 901 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x56, 0xeb, 0x6f, 0xdb, 0x36, - 0x10, 0x87, 0xdb, 0xe6, 0x51, 0x3a, 0x4e, 0x5a, 0xa6, 0x58, 0xd9, 0x74, 0x6d, 0x1d, 0x67, 0x19, - 0x0c, 0x0c, 0xb3, 0xb1, 0x47, 0x31, 0x6c, 0x03, 0x06, 0xa4, 0xed, 0x90, 0xb5, 0x41, 0xba, 0xd8, - 0x32, 0x50, 0x60, 0x5f, 0x04, 0x4a, 0xba, 0xca, 0xaa, 0x2d, 0x4a, 0xe6, 0x23, 0x01, 0xf6, 0xaf, - 0xef, 0xcb, 0x40, 0x52, 0x2f, 0xda, 0x4a, 0x3e, 0xc9, 0xba, 0xdf, 0x43, 0xbc, 0xd3, 0xdd, 0xc9, - 0xa8, 0x9f, 0xe5, 0x52, 0x8c, 0x73, 0xe1, 0xeb, 0xab, 0x9f, 0x52, 0x46, 0x63, 0xf0, 0xa5, 0x62, - 0x0c, 0x96, 0xa3, 0x9c, 0x67, 0x32, 0xc3, 0x5d, 0x73, 0x11, 0x23, 0x4d, 0x38, 0x7a, 0x4e, 0x79, - 0x6c, 0xe8, 0xfa, 0xea, 0xd3, 0x50, 0x26, 0xd7, 0x90, 0xae, 0x2c, 0xf3, 0xe8, 0xa5, 0x0b, 0xde, - 0x08, 0x7f, 0x91, 0x30, 0x10, 0x89, 0x28, 0xf0, 0xa3, 0x0d, 0x5c, 0xb0, 0x3b, 0xb0, 0x55, 0x89, - 0x0d, 0x5c, 0xec, 0x5f, 0xc5, 0xc1, 0x87, 0x6b, 0x60, 0xd2, 0x9f, 0xab, 0xa0, 0xe0, 0x7c, 0xd3, - 0xc2, 0x11, 0xc0, 0xaf, 0x93, 0x10, 0xfc, 0x40, 0x95, 0x4e, 0x2f, 0x1c, 0x56, 0x1c, 0xe6, 0x7e, - 0xae, 0x02, 0x51, 0x99, 0x10, 0x07, 0x5e, 0xd0, 0xcf, 0x0b, 0x5a, 0x20, 0xaf, 0x5c, 0x44, 0x05, - 0x90, 0xae, 0xfc, 0x95, 0x02, 0x05, 0xad, 0xe7, 0x4f, 0x21, 0xcd, 0xe7, 0x55, 0xde, 0x4f, 0x5d, - 0x6c, 0x25, 0x65, 0x2b, 0xc0, 0xa8, 0x2c, 0x15, 0xc7, 0x1b, 0x80, 0xff, 0x05, 0xa4, 0x90, 0x1c, - 0x68, 0x7a, 0x3b, 0xc5, 0xe2, 0x09, 0x8b, 0x0b, 0xca, 0x57, 0x2e, 0x45, 0x94, 0xef, 0xe9, 0x99, - 0x13, 0xcf, 0xd5, 0x52, 0x50, 0xde, 0x0a, 0x71, 0x1a, 0x04, 0x89, 0x6c, 0x7d, 0xa0, 0x85, 0x8a, - 0x47, 0x8a, 0xd6, 0x2a, 0x71, 0x88, 0x12, 0xe1, 0x16, 0xb8, 0xdf, 0x42, 0x70, 0x2c, 0x06, 0x03, - 0xf4, 0xe8, 0x1c, 0xe4, 0xcc, 0x34, 0xe0, 0xdf, 0xb9, 0x4c, 0x32, 0x26, 0xf0, 0x3e, 0xba, 0x97, - 0x44, 0xa4, 0xd3, 0xef, 0x0c, 0x1f, 0x4e, 0xef, 0x25, 0xd1, 0xe0, 0xbf, 0x2e, 0x3a, 0x7c, 0xcb, - 0x81, 0x4a, 0x70, 0x79, 0x27, 0xa8, 0x17, 0x66, 0x8c, 0x41, 0xa8, 0x6f, 0xfd, 0x4a, 0xb2, 0x57, - 0x07, 0xdf, 0x47, 0xf8, 0x18, 0xed, 0xd9, 0xf6, 0xf6, 0x65, 0xb6, 0x00, 0x46, 0xee, 0x1b, 0x4e, - 0xd7, 0xc6, 0x66, 0x3a, 0x84, 0x31, 0x7a, 0xc0, 0x68, 0x0a, 0xe4, 0x81, 0x81, 0xcc, 0x6f, 0xfc, - 0x04, 0x6d, 0xb1, 0x4c, 0x82, 0x20, 0x5b, 0x26, 0x68, 0x6f, 0xf0, 0xb7, 0xe8, 0xa0, 0x18, 0x16, - 0x9f, 0x46, 0x11, 0x07, 0x21, 0xc8, 0xb6, 0xc1, 0x7b, 0xf6, 0x64, 0x67, 0x36, 0x88, 0x5f, 0xa3, - 0xa7, 0x25, 0x4f, 0x26, 0x29, 0x64, 0x4a, 0xfa, 0x02, 0xc2, 0x8c, 0x45, 0x82, 0xec, 0xf4, 0x3b, - 0xc3, 0xde, 0xf4, 0x89, 0xe5, 0xcf, 0x2c, 0xe8, 0x59, 0x0c, 0x0f, 0xd1, 0xa3, 0x52, 0x96, 0x30, - 0x01, 0xa1, 0xe2, 0x40, 0x76, 0xfb, 0x9d, 0xe1, 0xee, 0x74, 0xdf, 0xf2, 0xdf, 0x17, 0x51, 0xfc, - 0x03, 0xda, 0x32, 0xed, 0x4a, 0xa2, 0x7e, 0x67, 0xd8, 0xfd, 0xf1, 0xf9, 0xa8, 0x18, 0x5a, 0x5d, - 0xe7, 0xd1, 0x85, 0x46, 0x3e, 0xf1, 0x44, 0xc2, 0x19, 0x8f, 0xc5, 0xd4, 0x32, 0xf1, 0x6f, 0x68, - 0xb7, 0x9c, 0x5f, 0x02, 0x46, 0xf5, 0xd2, 0x51, 0x9d, 0x19, 0xf0, 0x72, 0x52, 0x0b, 0x2b, 0x3e, - 0x7e, 0x8d, 0x76, 0x8a, 0x11, 0x25, 0x9f, 0x8d, 0xf4, 0x6b, 0x57, 0xfa, 0xc9, 0xf3, 0x26, 0x5e, - 0x2d, 0xdc, 0xa6, 0x37, 0xc2, 0x5b, 0x89, 0x4a, 0xc6, 0x04, 0x89, 0x6f, 0x91, 0x7d, 0x5c, 0x97, - 0x31, 0x81, 0x47, 0xfa, 0x7d, 0x48, 0x41, 0xe6, 0x46, 0x73, 0xe4, 0x68, 0x3e, 0x52, 0x29, 0x6a, - 0x85, 0xe1, 0xe1, 0x0f, 0x68, 0xdf, 0x9d, 0x07, 0x92, 0x18, 0xe5, 0xc9, 0x86, 0xd2, 0x2b, 0x19, - 0xb5, 0x45, 0x8f, 0x35, 0xe3, 0xf8, 0x3b, 0x74, 0x9f, 0x89, 0x15, 0xf9, 0x62, 0x0c, 0x9e, 0xb9, - 0x06, 0x5e, 0xa3, 0x36, 0x9a, 0x85, 0x7f, 0x46, 0xdb, 0x76, 0x2e, 0xc8, 0xa2, 0x25, 0xbd, 0xa9, - 0x81, 0x1a, 0xe9, 0x59, 0xae, 0x4e, 0x4f, 0xef, 0x04, 0xb2, 0x6c, 0x49, 0xef, 0x72, 0x32, 0x9b, - 0x35, 0xd2, 0xd3, 0x3c, 0x3c, 0x41, 0x8f, 0x37, 0xf6, 0x1b, 0x49, 0x8d, 0xf8, 0xd4, 0xad, 0xa7, - 0x66, 0x79, 0x96, 0xf4, 0x46, 0x35, 0xca, 0x74, 0x40, 0x5d, 0x04, 0x5f, 0xa0, 0x83, 0xb5, 0xb5, - 0x4a, 0x58, 0x4b, 0xc9, 0x8c, 0xe1, 0x9f, 0x9a, 0xf2, 0x97, 0x0a, 0x1a, 0x25, 0xa3, 0xcd, 0x38, - 0xfe, 0x03, 0xa1, 0x7a, 0xb3, 0x92, 0xcc, 0xf8, 0xbc, 0x72, 0x7c, 0xce, 0xdf, 0x5e, 0x5d, 0xa9, - 0xc0, 0x6b, 0x7a, 0x3c, 0x8c, 0xc3, 0xfc, 0xca, 0x28, 0xf0, 0x3b, 0xb4, 0xd7, 0x5c, 0xb0, 0x24, - 0x37, 0x0e, 0xc7, 0x6e, 0x4b, 0xab, 0x00, 0x2e, 0x27, 0x13, 0x8d, 0xd7, 0x1e, 0x5d, 0x2b, 0x33, - 0x51, 0xed, 0xd2, 0x5c, 0x40, 0x64, 0xd5, 0xe2, 0x32, 0xd5, 0x84, 0xf5, 0x93, 0x74, 0x79, 0x11, - 0xd5, 0x67, 0x39, 0x47, 0x3d, 0x67, 0x4b, 0x11, 0x6e, 0x6c, 0x06, 0x9b, 0x36, 0xb6, 0x65, 0x1a, - 0x45, 0xb6, 0x8f, 0x2f, 0xc2, 0xba, 0x35, 0xec, 0xa2, 0x25, 0xa2, 0xa5, 0x35, 0xae, 0x0c, 0xd4, - 0x68, 0x0d, 0xcb, 0xd5, 0x9d, 0xec, 0x2e, 0x5a, 0x22, 0x5b, 0x5e, 0x8b, 0x6d, 0xac, 0x8d, 0x03, - 0xf4, 0x78, 0x33, 0x5e, 0x4d, 0x45, 0xf5, 0x21, 0x21, 0xea, 0x96, 0xa9, 0xf8, 0x50, 0x32, 0xd6, - 0xa6, 0xa2, 0x8a, 0xe3, 0x33, 0xd4, 0x6d, 0x7c, 0xde, 0xc9, 0xb5, 0x31, 0xea, 0xaf, 0x0f, 0xf3, - 0x85, 0x85, 0x6b, 0x17, 0x44, 0x6f, 0x44, 0x11, 0xc4, 0xbf, 0xa0, 0x9d, 0xe2, 0x2b, 0x49, 0x6e, - 0x8c, 0xfc, 0x85, 0xdb, 0xf8, 0x16, 0xab, 0xb5, 0x25, 0x7b, 0x70, 0x8a, 0x0e, 0xdf, 0xc1, 0x12, - 0xd6, 0x97, 0xff, 0xfa, 0x47, 0xe2, 0x04, 0x3d, 0xf6, 0x64, 0x96, 0xdf, 0x4d, 0x3a, 0x45, 0x87, - 0x53, 0x10, 0x2a, 0xbd, 0xdb, 0xeb, 0xcd, 0xef, 0xff, 0xfc, 0x1a, 0x27, 0x52, 0xff, 0xd9, 0x08, - 0xb3, 0x74, 0x1c, 0x50, 0x19, 0xce, 0xc3, 0x8c, 0xe7, 0xe3, 0x7c, 0xa9, 0xd2, 0x00, 0xf8, 0xf7, - 0x22, 0x9c, 0x43, 0x4a, 0xc5, 0x38, 0x50, 0xc9, 0x32, 0x1a, 0xc7, 0xd9, 0xd8, 0x66, 0x32, 0xd6, - 0x7f, 0x99, 0x82, 0x6d, 0x73, 0xf3, 0xd3, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa3, 0xcd, 0x38, - 0x2f, 0x6a, 0x09, 0x00, 0x00, +var File_opts_ps_opts_manage_tunnel_proto protoreflect.FileDescriptor + +var file_opts_ps_opts_manage_tunnel_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x1a, + 0x1b, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x63, + 0x74, 0x69, 0x76, 0x65, 0x6d, 0x71, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x61, 0x72, + 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x77, 0x73, 0x5f, 0x6b, + 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x61, 0x72, + 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x77, 0x73, 0x5f, 0x73, + 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, + 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x71, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x22, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, + 0x67, 0x73, 0x5f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x68, + 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x24, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, + 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, + 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x67, 0x63, 0x70, + 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x61, + 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6b, 0x61, 0x66, 0x6b, + 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, + 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, 0x5f, 0x71, 0x75, 0x65, + 0x75, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, + 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, + 0x67, 0x73, 0x5f, 0x6d, 0x71, 0x74, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x61, + 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, + 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x6a, 0x65, 0x74, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x61, 0x72, 0x67, 0x73, 0x2f, + 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x61, 0x72, + 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x73, 0x71, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, + 0x67, 0x73, 0x5f, 0x70, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x19, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x61, + 0x62, 0x62, 0x69, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x61, 0x72, 0x67, 0x73, + 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x5f, + 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x61, + 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x65, 0x64, 0x69, + 0x73, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, + 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x65, 0x64, + 0x69, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x22, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x22, 0xfb, 0x0b, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, + 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x23, 0x0a, 0x0d, + 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, + 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x74, 0x65, + 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6e, 0x6f, 0x74, 0x65, 0x73, 0x12, 0x26, + 0x0a, 0x0f, 0x5f, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x35, 0x0a, 0x17, 0x5f, 0x74, 0x75, 0x6e, 0x6e, 0x65, + 0x6c, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, + 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x14, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x54, + 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x28, 0x0a, + 0x10, 0x5f, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, + 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, + 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x12, 0x31, 0x0a, 0x05, 0x6b, 0x61, 0x66, 0x6b, 0x61, + 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, + 0x72, 0x67, 0x73, 0x52, 0x05, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x12, 0x3a, 0x0a, 0x08, 0x61, 0x63, + 0x74, 0x69, 0x76, 0x65, 0x6d, 0x71, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x76, + 0x65, 0x4d, 0x51, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x08, 0x61, 0x63, + 0x74, 0x69, 0x76, 0x65, 0x6d, 0x71, 0x12, 0x35, 0x0a, 0x07, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x71, + 0x73, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x53, 0x51, 0x53, 0x57, 0x72, 0x69, 0x74, + 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x06, 0x61, 0x77, 0x73, 0x53, 0x71, 0x73, 0x12, 0x35, 0x0a, + 0x07, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x6e, 0x73, 0x18, 0x67, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, + 0x53, 0x4e, 0x53, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x06, 0x61, 0x77, + 0x73, 0x53, 0x6e, 0x73, 0x12, 0x2e, 0x0a, 0x04, 0x6e, 0x61, 0x74, 0x73, 0x18, 0x68, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, + 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, + 0x6e, 0x61, 0x74, 0x73, 0x12, 0x4a, 0x0a, 0x0e, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x69, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x53, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, + 0x73, 0x52, 0x0d, 0x6e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, + 0x12, 0x2b, 0x0a, 0x03, 0x6e, 0x73, 0x71, 0x18, 0x6a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x53, 0x51, 0x57, + 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x03, 0x6e, 0x73, 0x71, 0x12, 0x34, 0x0a, + 0x06, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x18, 0x6b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x61, 0x62, 0x62, + 0x69, 0x74, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x06, 0x72, 0x61, 0x62, + 0x62, 0x69, 0x74, 0x12, 0x2e, 0x0a, 0x04, 0x6d, 0x71, 0x74, 0x74, 0x18, 0x6c, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, + 0x4d, 0x51, 0x54, 0x54, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x6d, + 0x71, 0x74, 0x74, 0x12, 0x51, 0x0a, 0x11, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x5f, 0x62, 0x75, 0x73, 0x18, 0x6d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x7a, 0x75, + 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, 0x57, 0x72, 0x69, 0x74, + 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x0f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, 0x12, 0x4b, 0x0a, 0x0f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, + 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x75, 0x62, 0x18, 0x6e, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x7a, + 0x75, 0x72, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x75, 0x62, 0x57, 0x72, 0x69, 0x74, 0x65, + 0x41, 0x72, 0x67, 0x73, 0x52, 0x0d, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x48, 0x75, 0x62, 0x12, 0x3e, 0x0a, 0x0a, 0x67, 0x63, 0x70, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, + 0x62, 0x18, 0x6f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x47, 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x57, + 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x09, 0x67, 0x63, 0x70, 0x50, 0x75, 0x62, + 0x73, 0x75, 0x62, 0x12, 0x44, 0x0a, 0x0c, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, 0x5f, 0x71, 0x75, + 0x65, 0x75, 0x65, 0x18, 0x70, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4b, 0x75, 0x62, 0x65, 0x4d, 0x51, 0x51, 0x75, + 0x65, 0x75, 0x65, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x0b, 0x6b, 0x75, + 0x62, 0x65, 0x6d, 0x71, 0x51, 0x75, 0x65, 0x75, 0x65, 0x12, 0x44, 0x0a, 0x0c, 0x72, 0x65, 0x64, + 0x69, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x18, 0x71, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x65, + 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, + 0x67, 0x73, 0x52, 0x0b, 0x72, 0x65, 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, 0x73, 0x75, 0x62, 0x12, + 0x47, 0x0a, 0x0d, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, + 0x18, 0x72, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x73, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x0c, 0x72, 0x65, 0x64, 0x69, + 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x34, 0x0a, 0x06, 0x70, 0x75, 0x6c, 0x73, + 0x61, 0x72, 0x18, 0x73, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x50, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x57, 0x72, 0x69, + 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x06, 0x70, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x12, 0x4a, + 0x0a, 0x0e, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, + 0x18, 0x74, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x73, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x0d, 0x72, 0x61, 0x62, + 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x4a, 0x0a, 0x0e, 0x6e, 0x61, + 0x74, 0x73, 0x5f, 0x6a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18, 0x75, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, + 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x57, 0x72, + 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x0d, 0x6e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, + 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x41, 0x0a, 0x0b, 0x61, 0x77, 0x73, 0x5f, 0x6b, 0x69, + 0x6e, 0x65, 0x73, 0x69, 0x73, 0x18, 0x76, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x4b, 0x69, 0x6e, + 0x65, 0x73, 0x69, 0x73, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x0a, 0x61, + 0x77, 0x73, 0x4b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x12, 0x37, 0x0a, 0x07, 0x6d, 0x65, 0x6d, + 0x70, 0x68, 0x69, 0x73, 0x18, 0x77, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, + 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x70, 0x68, + 0x69, 0x73, 0x22, 0x25, 0x0a, 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, + 0x65, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x23, 0x0a, 0x11, 0x53, 0x74, 0x6f, + 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x25, + 0x0a, 0x13, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, + 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x6f, 0x70, + 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_opts_ps_opts_manage_tunnel_proto_rawDescOnce sync.Once + file_opts_ps_opts_manage_tunnel_proto_rawDescData = file_opts_ps_opts_manage_tunnel_proto_rawDesc +) + +func file_opts_ps_opts_manage_tunnel_proto_rawDescGZIP() []byte { + file_opts_ps_opts_manage_tunnel_proto_rawDescOnce.Do(func() { + file_opts_ps_opts_manage_tunnel_proto_rawDescData = protoimpl.X.CompressGZIP(file_opts_ps_opts_manage_tunnel_proto_rawDescData) + }) + return file_opts_ps_opts_manage_tunnel_proto_rawDescData +} + +var file_opts_ps_opts_manage_tunnel_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_opts_ps_opts_manage_tunnel_proto_goTypes = []interface{}{ + (*GetTunnelOptions)(nil), // 0: protos.opts.GetTunnelOptions + (*CreateTunnelOptions)(nil), // 1: protos.opts.CreateTunnelOptions + (*DeleteTunnelOptions)(nil), // 2: protos.opts.DeleteTunnelOptions + (*StopTunnelOptions)(nil), // 3: protos.opts.StopTunnelOptions + (*ResumeTunnelOptions)(nil), // 4: protos.opts.ResumeTunnelOptions + (*args.KafkaWriteArgs)(nil), // 5: protos.args.KafkaWriteArgs + (*args.ActiveMQWriteArgs)(nil), // 6: protos.args.ActiveMQWriteArgs + (*args.AWSSQSWriteArgs)(nil), // 7: protos.args.AWSSQSWriteArgs + (*args.AWSSNSWriteArgs)(nil), // 8: protos.args.AWSSNSWriteArgs + (*args.NatsWriteArgs)(nil), // 9: protos.args.NatsWriteArgs + (*args.NatsStreamingWriteArgs)(nil), // 10: protos.args.NatsStreamingWriteArgs + (*args.NSQWriteArgs)(nil), // 11: protos.args.NSQWriteArgs + (*args.RabbitWriteArgs)(nil), // 12: protos.args.RabbitWriteArgs + (*args.MQTTWriteArgs)(nil), // 13: protos.args.MQTTWriteArgs + (*args.AzureServiceBusWriteArgs)(nil), // 14: protos.args.AzureServiceBusWriteArgs + (*args.AzureEventHubWriteArgs)(nil), // 15: protos.args.AzureEventHubWriteArgs + (*args.GCPPubSubWriteArgs)(nil), // 16: protos.args.GCPPubSubWriteArgs + (*args.KubeMQQueueWriteArgs)(nil), // 17: protos.args.KubeMQQueueWriteArgs + (*args.RedisPubSubWriteArgs)(nil), // 18: protos.args.RedisPubSubWriteArgs + (*args.RedisStreamsWriteArgs)(nil), // 19: protos.args.RedisStreamsWriteArgs + (*args.PulsarWriteArgs)(nil), // 20: protos.args.PulsarWriteArgs + (*args.RabbitStreamsWriteArgs)(nil), // 21: protos.args.RabbitStreamsWriteArgs + (*args.NatsJetstreamWriteArgs)(nil), // 22: protos.args.NatsJetstreamWriteArgs + (*args.AWSKinesisWriteArgs)(nil), // 23: protos.args.AWSKinesisWriteArgs + (*args.MemphisWriteArgs)(nil), // 24: protos.args.MemphisWriteArgs +} +var file_opts_ps_opts_manage_tunnel_proto_depIdxs = []int32{ + 5, // 0: protos.opts.CreateTunnelOptions.kafka:type_name -> protos.args.KafkaWriteArgs + 6, // 1: protos.opts.CreateTunnelOptions.activemq:type_name -> protos.args.ActiveMQWriteArgs + 7, // 2: protos.opts.CreateTunnelOptions.aws_sqs:type_name -> protos.args.AWSSQSWriteArgs + 8, // 3: protos.opts.CreateTunnelOptions.aws_sns:type_name -> protos.args.AWSSNSWriteArgs + 9, // 4: protos.opts.CreateTunnelOptions.nats:type_name -> protos.args.NatsWriteArgs + 10, // 5: protos.opts.CreateTunnelOptions.nats_streaming:type_name -> protos.args.NatsStreamingWriteArgs + 11, // 6: protos.opts.CreateTunnelOptions.nsq:type_name -> protos.args.NSQWriteArgs + 12, // 7: protos.opts.CreateTunnelOptions.rabbit:type_name -> protos.args.RabbitWriteArgs + 13, // 8: protos.opts.CreateTunnelOptions.mqtt:type_name -> protos.args.MQTTWriteArgs + 14, // 9: protos.opts.CreateTunnelOptions.azure_service_bus:type_name -> protos.args.AzureServiceBusWriteArgs + 15, // 10: protos.opts.CreateTunnelOptions.azure_event_hub:type_name -> protos.args.AzureEventHubWriteArgs + 16, // 11: protos.opts.CreateTunnelOptions.gcp_pubsub:type_name -> protos.args.GCPPubSubWriteArgs + 17, // 12: protos.opts.CreateTunnelOptions.kubemq_queue:type_name -> protos.args.KubeMQQueueWriteArgs + 18, // 13: protos.opts.CreateTunnelOptions.redis_pubsub:type_name -> protos.args.RedisPubSubWriteArgs + 19, // 14: protos.opts.CreateTunnelOptions.redis_streams:type_name -> protos.args.RedisStreamsWriteArgs + 20, // 15: protos.opts.CreateTunnelOptions.pulsar:type_name -> protos.args.PulsarWriteArgs + 21, // 16: protos.opts.CreateTunnelOptions.rabbit_streams:type_name -> protos.args.RabbitStreamsWriteArgs + 22, // 17: protos.opts.CreateTunnelOptions.nats_jetstream:type_name -> protos.args.NatsJetstreamWriteArgs + 23, // 18: protos.opts.CreateTunnelOptions.aws_kinesis:type_name -> protos.args.AWSKinesisWriteArgs + 24, // 19: protos.opts.CreateTunnelOptions.memphis:type_name -> protos.args.MemphisWriteArgs + 20, // [20:20] is the sub-list for method output_type + 20, // [20:20] is the sub-list for method input_type + 20, // [20:20] is the sub-list for extension type_name + 20, // [20:20] is the sub-list for extension extendee + 0, // [0:20] is the sub-list for field type_name +} + +func init() { file_opts_ps_opts_manage_tunnel_proto_init() } +func file_opts_ps_opts_manage_tunnel_proto_init() { + if File_opts_ps_opts_manage_tunnel_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_opts_ps_opts_manage_tunnel_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetTunnelOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_manage_tunnel_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateTunnelOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_manage_tunnel_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteTunnelOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_manage_tunnel_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StopTunnelOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_manage_tunnel_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResumeTunnelOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_opts_ps_opts_manage_tunnel_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_opts_ps_opts_manage_tunnel_proto_goTypes, + DependencyIndexes: file_opts_ps_opts_manage_tunnel_proto_depIdxs, + MessageInfos: file_opts_ps_opts_manage_tunnel_proto_msgTypes, + }.Build() + File_opts_ps_opts_manage_tunnel_proto = out.File + file_opts_ps_opts_manage_tunnel_proto_rawDesc = nil + file_opts_ps_opts_manage_tunnel_proto_goTypes = nil + file_opts_ps_opts_manage_tunnel_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_read.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_read.pb.go index b3e55c556..eafd33268 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_read.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_read.pb.go @@ -1,26 +1,26 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: opts/ps_opts_read.proto package opts import ( - fmt "fmt" args "github.com/batchcorp/plumber-schemas/build/go/protos/args" encoding "github.com/batchcorp/plumber-schemas/build/go/protos/encoding" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type ConvertOption int32 @@ -30,200 +30,270 @@ const ( ConvertOption_CONVERT_OPTION_GZIP ConvertOption = 2 ) -var ConvertOption_name = map[int32]string{ - 0: "CONVERT_OPTION_UNSET", - 1: "CONVERT_OPTION_BASE64", - 2: "CONVERT_OPTION_GZIP", -} +// Enum value maps for ConvertOption. +var ( + ConvertOption_name = map[int32]string{ + 0: "CONVERT_OPTION_UNSET", + 1: "CONVERT_OPTION_BASE64", + 2: "CONVERT_OPTION_GZIP", + } + ConvertOption_value = map[string]int32{ + "CONVERT_OPTION_UNSET": 0, + "CONVERT_OPTION_BASE64": 1, + "CONVERT_OPTION_GZIP": 2, + } +) -var ConvertOption_value = map[string]int32{ - "CONVERT_OPTION_UNSET": 0, - "CONVERT_OPTION_BASE64": 1, - "CONVERT_OPTION_GZIP": 2, +func (x ConvertOption) Enum() *ConvertOption { + p := new(ConvertOption) + *p = x + return p } func (x ConvertOption) String() string { - return proto.EnumName(ConvertOption_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ConvertOption) Descriptor() protoreflect.EnumDescriptor { + return file_opts_ps_opts_read_proto_enumTypes[0].Descriptor() +} + +func (ConvertOption) Type() protoreflect.EnumType { + return &file_opts_ps_opts_read_proto_enumTypes[0] +} + +func (x ConvertOption) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) } +// Deprecated: Use ConvertOption.Descriptor instead. func (ConvertOption) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{0} + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{0} } type InferSchemaOptions_Type int32 const ( InferSchemaOptions_UNSET InferSchemaOptions_Type = 0 - InferSchemaOptions_JSONSCHEMA InferSchemaOptions_Type = 1 + InferSchemaOptions_JSONSCHEMA InferSchemaOptions_Type = 1 // TODO: expand with other types when we support them ) -var InferSchemaOptions_Type_name = map[int32]string{ - 0: "UNSET", - 1: "JSONSCHEMA", -} +// Enum value maps for InferSchemaOptions_Type. +var ( + InferSchemaOptions_Type_name = map[int32]string{ + 0: "UNSET", + 1: "JSONSCHEMA", + } + InferSchemaOptions_Type_value = map[string]int32{ + "UNSET": 0, + "JSONSCHEMA": 1, + } +) -var InferSchemaOptions_Type_value = map[string]int32{ - "UNSET": 0, - "JSONSCHEMA": 1, +func (x InferSchemaOptions_Type) Enum() *InferSchemaOptions_Type { + p := new(InferSchemaOptions_Type) + *p = x + return p } func (x InferSchemaOptions_Type) String() string { - return proto.EnumName(InferSchemaOptions_Type_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } +func (InferSchemaOptions_Type) Descriptor() protoreflect.EnumDescriptor { + return file_opts_ps_opts_read_proto_enumTypes[1].Descriptor() +} + +func (InferSchemaOptions_Type) Type() protoreflect.EnumType { + return &file_opts_ps_opts_read_proto_enumTypes[1] +} + +func (x InferSchemaOptions_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use InferSchemaOptions_Type.Descriptor instead. func (InferSchemaOptions_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{25, 0} + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{25, 0} } type ReadCLIOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Display more verbose information during reads (varies by backend)'" VerboseOutput bool `protobuf:"varint,1,opt,name=verbose_output,json=verboseOutput,proto3" json:"verbose_output,omitempty" kong:"help='Display more verbose information during reads (varies by backend)'"` // @gotags: kong:"help='Pretty (colorized) output'" Pretty bool `protobuf:"varint,2,opt,name=pretty,proto3" json:"pretty,omitempty" kong:"help='Pretty (colorized) output'"` // @gotags: kong:"help='Display all output as JSON (including tabular metadata)'" - Json bool `protobuf:"varint,3,opt,name=json,proto3" json:"json,omitempty" kong:"help='Display all output as JSON (including tabular metadata)'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Json bool `protobuf:"varint,3,opt,name=json,proto3" json:"json,omitempty" kong:"help='Display all output as JSON (including tabular metadata)'"` } -func (m *ReadCLIOptions) Reset() { *m = ReadCLIOptions{} } -func (m *ReadCLIOptions) String() string { return proto.CompactTextString(m) } -func (*ReadCLIOptions) ProtoMessage() {} -func (*ReadCLIOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{0} +func (x *ReadCLIOptions) Reset() { + *x = ReadCLIOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadCLIOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadCLIOptions.Unmarshal(m, b) -} -func (m *ReadCLIOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadCLIOptions.Marshal(b, m, deterministic) -} -func (m *ReadCLIOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadCLIOptions.Merge(m, src) +func (x *ReadCLIOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadCLIOptions) XXX_Size() int { - return xxx_messageInfo_ReadCLIOptions.Size(m) -} -func (m *ReadCLIOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadCLIOptions.DiscardUnknown(m) + +func (*ReadCLIOptions) ProtoMessage() {} + +func (x *ReadCLIOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadCLIOptions proto.InternalMessageInfo +// Deprecated: Use ReadCLIOptions.ProtoReflect.Descriptor instead. +func (*ReadCLIOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{0} +} -func (m *ReadCLIOptions) GetVerboseOutput() bool { - if m != nil { - return m.VerboseOutput +func (x *ReadCLIOptions) GetVerboseOutput() bool { + if x != nil { + return x.VerboseOutput } return false } -func (m *ReadCLIOptions) GetPretty() bool { - if m != nil { - return m.Pretty +func (x *ReadCLIOptions) GetPretty() bool { + if x != nil { + return x.Pretty } return false } -func (m *ReadCLIOptions) GetJson() bool { - if m != nil { - return m.Json +func (x *ReadCLIOptions) GetJson() bool { + if x != nil { + return x.Json } return false } type ReadSampleOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='How many events to fetch during a sample interval',default=100" SampleRate uint32 `protobuf:"varint,1,opt,name=sample_rate,json=sampleRate,proto3" json:"sample_rate,omitempty" kong:"help='How many events to fetch during a sample interval',default=100"` // @gotags: kong:"help='Sample interval seconds',enum:'1,60',default=60" - SampleIntervalSeconds uint32 `protobuf:"varint,2,opt,name=sample_interval_seconds,json=sampleIntervalSeconds,proto3" json:"sample_interval_seconds,omitempty" kong:"help='Sample interval seconds',enum:'1,60',default=60"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + SampleIntervalSeconds uint32 `protobuf:"varint,2,opt,name=sample_interval_seconds,json=sampleIntervalSeconds,proto3" json:"sample_interval_seconds,omitempty" kong:"help='Sample interval seconds',enum:'1,60',default=60"` } -func (m *ReadSampleOptions) Reset() { *m = ReadSampleOptions{} } -func (m *ReadSampleOptions) String() string { return proto.CompactTextString(m) } -func (*ReadSampleOptions) ProtoMessage() {} -func (*ReadSampleOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{1} +func (x *ReadSampleOptions) Reset() { + *x = ReadSampleOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadSampleOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadSampleOptions.Unmarshal(m, b) -} -func (m *ReadSampleOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadSampleOptions.Marshal(b, m, deterministic) -} -func (m *ReadSampleOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadSampleOptions.Merge(m, src) +func (x *ReadSampleOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadSampleOptions) XXX_Size() int { - return xxx_messageInfo_ReadSampleOptions.Size(m) -} -func (m *ReadSampleOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadSampleOptions.DiscardUnknown(m) + +func (*ReadSampleOptions) ProtoMessage() {} + +func (x *ReadSampleOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadSampleOptions proto.InternalMessageInfo +// Deprecated: Use ReadSampleOptions.ProtoReflect.Descriptor instead. +func (*ReadSampleOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{1} +} -func (m *ReadSampleOptions) GetSampleRate() uint32 { - if m != nil { - return m.SampleRate +func (x *ReadSampleOptions) GetSampleRate() uint32 { + if x != nil { + return x.SampleRate } return 0 } -func (m *ReadSampleOptions) GetSampleIntervalSeconds() uint32 { - if m != nil { - return m.SampleIntervalSeconds +func (x *ReadSampleOptions) GetSampleIntervalSeconds() uint32 { + if x != nil { + return x.SampleIntervalSeconds } return 0 } type ReadFilterOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"-" - Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty" kong:"-"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty" kong:"-"` } -func (m *ReadFilterOptions) Reset() { *m = ReadFilterOptions{} } -func (m *ReadFilterOptions) String() string { return proto.CompactTextString(m) } -func (*ReadFilterOptions) ProtoMessage() {} -func (*ReadFilterOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{2} +func (x *ReadFilterOptions) Reset() { + *x = ReadFilterOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadFilterOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadFilterOptions.Unmarshal(m, b) -} -func (m *ReadFilterOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadFilterOptions.Marshal(b, m, deterministic) +func (x *ReadFilterOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadFilterOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadFilterOptions.Merge(m, src) -} -func (m *ReadFilterOptions) XXX_Size() int { - return xxx_messageInfo_ReadFilterOptions.Size(m) -} -func (m *ReadFilterOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadFilterOptions.DiscardUnknown(m) + +func (*ReadFilterOptions) ProtoMessage() {} + +func (x *ReadFilterOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadFilterOptions proto.InternalMessageInfo +// Deprecated: Use ReadFilterOptions.ProtoReflect.Descriptor instead. +func (*ReadFilterOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{2} +} -func (m *ReadFilterOptions) GetQuery() string { - if m != nil { - return m.Query +func (x *ReadFilterOptions) GetQuery() string { + if x != nil { + return x.Query } return "" } // Relay is the structure that backends accept for facilitating a relay. type ReadOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Required; friendly name for the read // @gotags: kong:"-" Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty" kong:"-"` @@ -298,1291 +368,1467 @@ type ReadOptions struct { // @gotags: kong:"cmd,help='AWS Kinesis Streams'" AwsKinesis *ReadGroupAWSKinesisOptions `protobuf:"bytes,119,opt,name=aws_kinesis,json=awsKinesis,proto3" json:"aws_kinesis,omitempty" kong:"cmd,help='AWS Kinesis Streams'"` // @gotags: kong:"cmd,help='Memphis'" - Memphis *ReadGroupMemphisOptions `protobuf:"bytes,120,opt,name=memphis,proto3" json:"memphis,omitempty" kong:"cmd,help='Memphis'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Memphis *ReadGroupMemphisOptions `protobuf:"bytes,120,opt,name=memphis,proto3" json:"memphis,omitempty" kong:"cmd,help='Memphis'"` } -func (m *ReadOptions) Reset() { *m = ReadOptions{} } -func (m *ReadOptions) String() string { return proto.CompactTextString(m) } -func (*ReadOptions) ProtoMessage() {} -func (*ReadOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{3} +func (x *ReadOptions) Reset() { + *x = ReadOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadOptions.Unmarshal(m, b) +func (x *ReadOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadOptions.Marshal(b, m, deterministic) -} -func (m *ReadOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadOptions.Merge(m, src) -} -func (m *ReadOptions) XXX_Size() int { - return xxx_messageInfo_ReadOptions.Size(m) -} -func (m *ReadOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadOptions.DiscardUnknown(m) + +func (*ReadOptions) ProtoMessage() {} + +func (x *ReadOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadOptions proto.InternalMessageInfo +// Deprecated: Use ReadOptions.ProtoReflect.Descriptor instead. +func (*ReadOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{3} +} -func (m *ReadOptions) GetName() string { - if m != nil { - return m.Name +func (x *ReadOptions) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *ReadOptions) GetConnectionId() string { - if m != nil { - return m.ConnectionId +func (x *ReadOptions) GetConnectionId() string { + if x != nil { + return x.ConnectionId } return "" } -func (m *ReadOptions) GetContinuous() bool { - if m != nil { - return m.Continuous +func (x *ReadOptions) GetContinuous() bool { + if x != nil { + return x.Continuous } return false } -func (m *ReadOptions) GetSampleOptions() *ReadSampleOptions { - if m != nil { - return m.SampleOptions +func (x *ReadOptions) GetSampleOptions() *ReadSampleOptions { + if x != nil { + return x.SampleOptions } return nil } -func (m *ReadOptions) GetDecodeOptions() *encoding.DecodeOptions { - if m != nil { - return m.DecodeOptions +func (x *ReadOptions) GetDecodeOptions() *encoding.DecodeOptions { + if x != nil { + return x.DecodeOptions } return nil } -func (m *ReadOptions) GetConvertOutput() ConvertOption { - if m != nil { - return m.ConvertOutput +func (x *ReadOptions) GetConvertOutput() ConvertOption { + if x != nil { + return x.ConvertOutput } return ConvertOption_CONVERT_OPTION_UNSET } -func (m *ReadOptions) GetFilter() *ReadFilterOptions { - if m != nil { - return m.Filter +func (x *ReadOptions) GetFilter() *ReadFilterOptions { + if x != nil { + return x.Filter } return nil } -func (m *ReadOptions) GetInferSchemaOptions() *InferSchemaOptions { - if m != nil { - return m.InferSchemaOptions +func (x *ReadOptions) GetInferSchemaOptions() *InferSchemaOptions { + if x != nil { + return x.InferSchemaOptions } return nil } -func (m *ReadOptions) GetXId() string { - if m != nil { - return m.XId +func (x *ReadOptions) GetXId() string { + if x != nil { + return x.XId } return "" } -func (m *ReadOptions) GetXActive() bool { - if m != nil { - return m.XActive +func (x *ReadOptions) GetXActive() bool { + if x != nil { + return x.XActive } return false } -func (m *ReadOptions) GetXCliOptions() *ReadCLIOptions { - if m != nil { - return m.XCliOptions +func (x *ReadOptions) GetXCliOptions() *ReadCLIOptions { + if x != nil { + return x.XCliOptions } return nil } -func (m *ReadOptions) GetKafka() *ReadGroupKafkaOptions { - if m != nil { - return m.Kafka +func (x *ReadOptions) GetKafka() *ReadGroupKafkaOptions { + if x != nil { + return x.Kafka } return nil } -func (m *ReadOptions) GetActivemq() *ReadGroupActiveMQOptions { - if m != nil { - return m.Activemq +func (x *ReadOptions) GetActivemq() *ReadGroupActiveMQOptions { + if x != nil { + return x.Activemq } return nil } -func (m *ReadOptions) GetAwsSqs() *ReadGroupAWSSQSOptions { - if m != nil { - return m.AwsSqs +func (x *ReadOptions) GetAwsSqs() *ReadGroupAWSSQSOptions { + if x != nil { + return x.AwsSqs } return nil } -func (m *ReadOptions) GetMongo() *ReadGroupMongoOptions { - if m != nil { - return m.Mongo +func (x *ReadOptions) GetMongo() *ReadGroupMongoOptions { + if x != nil { + return x.Mongo } return nil } -func (m *ReadOptions) GetNats() *ReadGroupNatsOptions { - if m != nil { - return m.Nats +func (x *ReadOptions) GetNats() *ReadGroupNatsOptions { + if x != nil { + return x.Nats } return nil } -func (m *ReadOptions) GetNatsStreaming() *ReadGroupNatsStreamingOptions { - if m != nil { - return m.NatsStreaming +func (x *ReadOptions) GetNatsStreaming() *ReadGroupNatsStreamingOptions { + if x != nil { + return x.NatsStreaming } return nil } -func (m *ReadOptions) GetNsq() *ReadGroupNSQOptions { - if m != nil { - return m.Nsq +func (x *ReadOptions) GetNsq() *ReadGroupNSQOptions { + if x != nil { + return x.Nsq } return nil } -func (m *ReadOptions) GetPulsar() *ReadGroupPulsarOptions { - if m != nil { - return m.Pulsar +func (x *ReadOptions) GetPulsar() *ReadGroupPulsarOptions { + if x != nil { + return x.Pulsar } return nil } -func (m *ReadOptions) GetRabbit() *ReadGroupRabbitOptions { - if m != nil { - return m.Rabbit +func (x *ReadOptions) GetRabbit() *ReadGroupRabbitOptions { + if x != nil { + return x.Rabbit } return nil } -func (m *ReadOptions) GetRabbitStreams() *ReadGroupRabbitStreamsOptions { - if m != nil { - return m.RabbitStreams +func (x *ReadOptions) GetRabbitStreams() *ReadGroupRabbitStreamsOptions { + if x != nil { + return x.RabbitStreams } return nil } -func (m *ReadOptions) GetMqtt() *ReadGroupMQTTOptions { - if m != nil { - return m.Mqtt +func (x *ReadOptions) GetMqtt() *ReadGroupMQTTOptions { + if x != nil { + return x.Mqtt } return nil } -func (m *ReadOptions) GetAzureServiceBus() *ReadGroupAzureServiceBusOptions { - if m != nil { - return m.AzureServiceBus +func (x *ReadOptions) GetAzureServiceBus() *ReadGroupAzureServiceBusOptions { + if x != nil { + return x.AzureServiceBus } return nil } -func (m *ReadOptions) GetAzureEventHub() *ReadGroupAzureEventHubOptions { - if m != nil { - return m.AzureEventHub +func (x *ReadOptions) GetAzureEventHub() *ReadGroupAzureEventHubOptions { + if x != nil { + return x.AzureEventHub } return nil } -func (m *ReadOptions) GetGcpPubsub() *ReadGroupGCPPubSubOptions { - if m != nil { - return m.GcpPubsub +func (x *ReadOptions) GetGcpPubsub() *ReadGroupGCPPubSubOptions { + if x != nil { + return x.GcpPubsub } return nil } -func (m *ReadOptions) GetKubemqQueue() *ReadGroupKubeMQQueueOptions { - if m != nil { - return m.KubemqQueue +func (x *ReadOptions) GetKubemqQueue() *ReadGroupKubeMQQueueOptions { + if x != nil { + return x.KubemqQueue } return nil } -func (m *ReadOptions) GetRedisPubsub() *ReadGroupRedisPubSubOptions { - if m != nil { - return m.RedisPubsub +func (x *ReadOptions) GetRedisPubsub() *ReadGroupRedisPubSubOptions { + if x != nil { + return x.RedisPubsub } return nil } -func (m *ReadOptions) GetRedisStreams() *ReadGroupRedisStreamsOptions { - if m != nil { - return m.RedisStreams +func (x *ReadOptions) GetRedisStreams() *ReadGroupRedisStreamsOptions { + if x != nil { + return x.RedisStreams } return nil } -func (m *ReadOptions) GetPostgres() *ReadGroupPostgresOptions { - if m != nil { - return m.Postgres +func (x *ReadOptions) GetPostgres() *ReadGroupPostgresOptions { + if x != nil { + return x.Postgres } return nil } -func (m *ReadOptions) GetNatsJetstream() *ReadGroupNatsJetstreamOptions { - if m != nil { - return m.NatsJetstream +func (x *ReadOptions) GetNatsJetstream() *ReadGroupNatsJetstreamOptions { + if x != nil { + return x.NatsJetstream } return nil } -func (m *ReadOptions) GetAwsKinesis() *ReadGroupAWSKinesisOptions { - if m != nil { - return m.AwsKinesis +func (x *ReadOptions) GetAwsKinesis() *ReadGroupAWSKinesisOptions { + if x != nil { + return x.AwsKinesis } return nil } -func (m *ReadOptions) GetMemphis() *ReadGroupMemphisOptions { - if m != nil { - return m.Memphis +func (x *ReadOptions) GetMemphis() *ReadGroupMemphisOptions { + if x != nil { + return x.Memphis } return nil } type ReadGroupKafkaOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.KafkaConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.KafkaReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.KafkaReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *ReadGroupKafkaOptions) Reset() { *m = ReadGroupKafkaOptions{} } -func (m *ReadGroupKafkaOptions) String() string { return proto.CompactTextString(m) } -func (*ReadGroupKafkaOptions) ProtoMessage() {} -func (*ReadGroupKafkaOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{4} +func (x *ReadGroupKafkaOptions) Reset() { + *x = ReadGroupKafkaOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadGroupKafkaOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadGroupKafkaOptions.Unmarshal(m, b) -} -func (m *ReadGroupKafkaOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadGroupKafkaOptions.Marshal(b, m, deterministic) -} -func (m *ReadGroupKafkaOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadGroupKafkaOptions.Merge(m, src) +func (x *ReadGroupKafkaOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadGroupKafkaOptions) XXX_Size() int { - return xxx_messageInfo_ReadGroupKafkaOptions.Size(m) -} -func (m *ReadGroupKafkaOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadGroupKafkaOptions.DiscardUnknown(m) + +func (*ReadGroupKafkaOptions) ProtoMessage() {} + +func (x *ReadGroupKafkaOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadGroupKafkaOptions proto.InternalMessageInfo +// Deprecated: Use ReadGroupKafkaOptions.ProtoReflect.Descriptor instead. +func (*ReadGroupKafkaOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{4} +} -func (m *ReadGroupKafkaOptions) GetXConn() *args.KafkaConn { - if m != nil { - return m.XConn +func (x *ReadGroupKafkaOptions) GetXConn() *args.KafkaConn { + if x != nil { + return x.XConn } return nil } -func (m *ReadGroupKafkaOptions) GetArgs() *args.KafkaReadArgs { - if m != nil { - return m.Args +func (x *ReadGroupKafkaOptions) GetArgs() *args.KafkaReadArgs { + if x != nil { + return x.Args } return nil } type ReadGroupActiveMQOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.ActiveMQConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.ActiveMQReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.ActiveMQReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *ReadGroupActiveMQOptions) Reset() { *m = ReadGroupActiveMQOptions{} } -func (m *ReadGroupActiveMQOptions) String() string { return proto.CompactTextString(m) } -func (*ReadGroupActiveMQOptions) ProtoMessage() {} -func (*ReadGroupActiveMQOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{5} +func (x *ReadGroupActiveMQOptions) Reset() { + *x = ReadGroupActiveMQOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadGroupActiveMQOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadGroupActiveMQOptions.Unmarshal(m, b) -} -func (m *ReadGroupActiveMQOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadGroupActiveMQOptions.Marshal(b, m, deterministic) -} -func (m *ReadGroupActiveMQOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadGroupActiveMQOptions.Merge(m, src) +func (x *ReadGroupActiveMQOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadGroupActiveMQOptions) XXX_Size() int { - return xxx_messageInfo_ReadGroupActiveMQOptions.Size(m) -} -func (m *ReadGroupActiveMQOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadGroupActiveMQOptions.DiscardUnknown(m) + +func (*ReadGroupActiveMQOptions) ProtoMessage() {} + +func (x *ReadGroupActiveMQOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadGroupActiveMQOptions proto.InternalMessageInfo +// Deprecated: Use ReadGroupActiveMQOptions.ProtoReflect.Descriptor instead. +func (*ReadGroupActiveMQOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{5} +} -func (m *ReadGroupActiveMQOptions) GetXConn() *args.ActiveMQConn { - if m != nil { - return m.XConn +func (x *ReadGroupActiveMQOptions) GetXConn() *args.ActiveMQConn { + if x != nil { + return x.XConn } return nil } -func (m *ReadGroupActiveMQOptions) GetArgs() *args.ActiveMQReadArgs { - if m != nil { - return m.Args +func (x *ReadGroupActiveMQOptions) GetArgs() *args.ActiveMQReadArgs { + if x != nil { + return x.Args } return nil } type ReadGroupAWSSQSOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.AWSSQSConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.AWSSQSReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.AWSSQSReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *ReadGroupAWSSQSOptions) Reset() { *m = ReadGroupAWSSQSOptions{} } -func (m *ReadGroupAWSSQSOptions) String() string { return proto.CompactTextString(m) } -func (*ReadGroupAWSSQSOptions) ProtoMessage() {} -func (*ReadGroupAWSSQSOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{6} +func (x *ReadGroupAWSSQSOptions) Reset() { + *x = ReadGroupAWSSQSOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadGroupAWSSQSOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadGroupAWSSQSOptions.Unmarshal(m, b) -} -func (m *ReadGroupAWSSQSOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadGroupAWSSQSOptions.Marshal(b, m, deterministic) +func (x *ReadGroupAWSSQSOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadGroupAWSSQSOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadGroupAWSSQSOptions.Merge(m, src) -} -func (m *ReadGroupAWSSQSOptions) XXX_Size() int { - return xxx_messageInfo_ReadGroupAWSSQSOptions.Size(m) -} -func (m *ReadGroupAWSSQSOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadGroupAWSSQSOptions.DiscardUnknown(m) + +func (*ReadGroupAWSSQSOptions) ProtoMessage() {} + +func (x *ReadGroupAWSSQSOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadGroupAWSSQSOptions proto.InternalMessageInfo +// Deprecated: Use ReadGroupAWSSQSOptions.ProtoReflect.Descriptor instead. +func (*ReadGroupAWSSQSOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{6} +} -func (m *ReadGroupAWSSQSOptions) GetXConn() *args.AWSSQSConn { - if m != nil { - return m.XConn +func (x *ReadGroupAWSSQSOptions) GetXConn() *args.AWSSQSConn { + if x != nil { + return x.XConn } return nil } -func (m *ReadGroupAWSSQSOptions) GetArgs() *args.AWSSQSReadArgs { - if m != nil { - return m.Args +func (x *ReadGroupAWSSQSOptions) GetArgs() *args.AWSSQSReadArgs { + if x != nil { + return x.Args } return nil } type ReadGroupMongoOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.MongoConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.MongoReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.MongoReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *ReadGroupMongoOptions) Reset() { *m = ReadGroupMongoOptions{} } -func (m *ReadGroupMongoOptions) String() string { return proto.CompactTextString(m) } -func (*ReadGroupMongoOptions) ProtoMessage() {} -func (*ReadGroupMongoOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{7} +func (x *ReadGroupMongoOptions) Reset() { + *x = ReadGroupMongoOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadGroupMongoOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadGroupMongoOptions.Unmarshal(m, b) +func (x *ReadGroupMongoOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadGroupMongoOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadGroupMongoOptions.Marshal(b, m, deterministic) -} -func (m *ReadGroupMongoOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadGroupMongoOptions.Merge(m, src) -} -func (m *ReadGroupMongoOptions) XXX_Size() int { - return xxx_messageInfo_ReadGroupMongoOptions.Size(m) -} -func (m *ReadGroupMongoOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadGroupMongoOptions.DiscardUnknown(m) + +func (*ReadGroupMongoOptions) ProtoMessage() {} + +func (x *ReadGroupMongoOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadGroupMongoOptions proto.InternalMessageInfo +// Deprecated: Use ReadGroupMongoOptions.ProtoReflect.Descriptor instead. +func (*ReadGroupMongoOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{7} +} -func (m *ReadGroupMongoOptions) GetXConn() *args.MongoConn { - if m != nil { - return m.XConn +func (x *ReadGroupMongoOptions) GetXConn() *args.MongoConn { + if x != nil { + return x.XConn } return nil } -func (m *ReadGroupMongoOptions) GetArgs() *args.MongoReadArgs { - if m != nil { - return m.Args +func (x *ReadGroupMongoOptions) GetArgs() *args.MongoReadArgs { + if x != nil { + return x.Args } return nil } type ReadGroupNatsOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.NatsConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.NatsReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.NatsReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *ReadGroupNatsOptions) Reset() { *m = ReadGroupNatsOptions{} } -func (m *ReadGroupNatsOptions) String() string { return proto.CompactTextString(m) } -func (*ReadGroupNatsOptions) ProtoMessage() {} -func (*ReadGroupNatsOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{8} +func (x *ReadGroupNatsOptions) Reset() { + *x = ReadGroupNatsOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadGroupNatsOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadGroupNatsOptions.Unmarshal(m, b) -} -func (m *ReadGroupNatsOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadGroupNatsOptions.Marshal(b, m, deterministic) -} -func (m *ReadGroupNatsOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadGroupNatsOptions.Merge(m, src) -} -func (m *ReadGroupNatsOptions) XXX_Size() int { - return xxx_messageInfo_ReadGroupNatsOptions.Size(m) +func (x *ReadGroupNatsOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadGroupNatsOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadGroupNatsOptions.DiscardUnknown(m) + +func (*ReadGroupNatsOptions) ProtoMessage() {} + +func (x *ReadGroupNatsOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadGroupNatsOptions proto.InternalMessageInfo +// Deprecated: Use ReadGroupNatsOptions.ProtoReflect.Descriptor instead. +func (*ReadGroupNatsOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{8} +} -func (m *ReadGroupNatsOptions) GetXConn() *args.NatsConn { - if m != nil { - return m.XConn +func (x *ReadGroupNatsOptions) GetXConn() *args.NatsConn { + if x != nil { + return x.XConn } return nil } -func (m *ReadGroupNatsOptions) GetArgs() *args.NatsReadArgs { - if m != nil { - return m.Args +func (x *ReadGroupNatsOptions) GetArgs() *args.NatsReadArgs { + if x != nil { + return x.Args } return nil } type ReadGroupNatsStreamingOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.NatsStreamingConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.NatsStreamingReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.NatsStreamingReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *ReadGroupNatsStreamingOptions) Reset() { *m = ReadGroupNatsStreamingOptions{} } -func (m *ReadGroupNatsStreamingOptions) String() string { return proto.CompactTextString(m) } -func (*ReadGroupNatsStreamingOptions) ProtoMessage() {} -func (*ReadGroupNatsStreamingOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{9} +func (x *ReadGroupNatsStreamingOptions) Reset() { + *x = ReadGroupNatsStreamingOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadGroupNatsStreamingOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadGroupNatsStreamingOptions.Unmarshal(m, b) -} -func (m *ReadGroupNatsStreamingOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadGroupNatsStreamingOptions.Marshal(b, m, deterministic) -} -func (m *ReadGroupNatsStreamingOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadGroupNatsStreamingOptions.Merge(m, src) +func (x *ReadGroupNatsStreamingOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadGroupNatsStreamingOptions) XXX_Size() int { - return xxx_messageInfo_ReadGroupNatsStreamingOptions.Size(m) -} -func (m *ReadGroupNatsStreamingOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadGroupNatsStreamingOptions.DiscardUnknown(m) + +func (*ReadGroupNatsStreamingOptions) ProtoMessage() {} + +func (x *ReadGroupNatsStreamingOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadGroupNatsStreamingOptions proto.InternalMessageInfo +// Deprecated: Use ReadGroupNatsStreamingOptions.ProtoReflect.Descriptor instead. +func (*ReadGroupNatsStreamingOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{9} +} -func (m *ReadGroupNatsStreamingOptions) GetXConn() *args.NatsStreamingConn { - if m != nil { - return m.XConn +func (x *ReadGroupNatsStreamingOptions) GetXConn() *args.NatsStreamingConn { + if x != nil { + return x.XConn } return nil } -func (m *ReadGroupNatsStreamingOptions) GetArgs() *args.NatsStreamingReadArgs { - if m != nil { - return m.Args +func (x *ReadGroupNatsStreamingOptions) GetArgs() *args.NatsStreamingReadArgs { + if x != nil { + return x.Args } return nil } type ReadGroupNatsJetstreamOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.NatsJetstreamConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.NatsJetstreamReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.NatsJetstreamReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *ReadGroupNatsJetstreamOptions) Reset() { *m = ReadGroupNatsJetstreamOptions{} } -func (m *ReadGroupNatsJetstreamOptions) String() string { return proto.CompactTextString(m) } -func (*ReadGroupNatsJetstreamOptions) ProtoMessage() {} -func (*ReadGroupNatsJetstreamOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{10} +func (x *ReadGroupNatsJetstreamOptions) Reset() { + *x = ReadGroupNatsJetstreamOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadGroupNatsJetstreamOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadGroupNatsJetstreamOptions.Unmarshal(m, b) -} -func (m *ReadGroupNatsJetstreamOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadGroupNatsJetstreamOptions.Marshal(b, m, deterministic) +func (x *ReadGroupNatsJetstreamOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadGroupNatsJetstreamOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadGroupNatsJetstreamOptions.Merge(m, src) -} -func (m *ReadGroupNatsJetstreamOptions) XXX_Size() int { - return xxx_messageInfo_ReadGroupNatsJetstreamOptions.Size(m) -} -func (m *ReadGroupNatsJetstreamOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadGroupNatsJetstreamOptions.DiscardUnknown(m) + +func (*ReadGroupNatsJetstreamOptions) ProtoMessage() {} + +func (x *ReadGroupNatsJetstreamOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadGroupNatsJetstreamOptions proto.InternalMessageInfo +// Deprecated: Use ReadGroupNatsJetstreamOptions.ProtoReflect.Descriptor instead. +func (*ReadGroupNatsJetstreamOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{10} +} -func (m *ReadGroupNatsJetstreamOptions) GetXConn() *args.NatsJetstreamConn { - if m != nil { - return m.XConn +func (x *ReadGroupNatsJetstreamOptions) GetXConn() *args.NatsJetstreamConn { + if x != nil { + return x.XConn } return nil } -func (m *ReadGroupNatsJetstreamOptions) GetArgs() *args.NatsJetstreamReadArgs { - if m != nil { - return m.Args +func (x *ReadGroupNatsJetstreamOptions) GetArgs() *args.NatsJetstreamReadArgs { + if x != nil { + return x.Args } return nil } type ReadGroupNSQOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.NSQConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.NSQReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.NSQReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *ReadGroupNSQOptions) Reset() { *m = ReadGroupNSQOptions{} } -func (m *ReadGroupNSQOptions) String() string { return proto.CompactTextString(m) } -func (*ReadGroupNSQOptions) ProtoMessage() {} -func (*ReadGroupNSQOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{11} +func (x *ReadGroupNSQOptions) Reset() { + *x = ReadGroupNSQOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadGroupNSQOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadGroupNSQOptions.Unmarshal(m, b) +func (x *ReadGroupNSQOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadGroupNSQOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadGroupNSQOptions.Marshal(b, m, deterministic) -} -func (m *ReadGroupNSQOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadGroupNSQOptions.Merge(m, src) -} -func (m *ReadGroupNSQOptions) XXX_Size() int { - return xxx_messageInfo_ReadGroupNSQOptions.Size(m) -} -func (m *ReadGroupNSQOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadGroupNSQOptions.DiscardUnknown(m) + +func (*ReadGroupNSQOptions) ProtoMessage() {} + +func (x *ReadGroupNSQOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadGroupNSQOptions proto.InternalMessageInfo +// Deprecated: Use ReadGroupNSQOptions.ProtoReflect.Descriptor instead. +func (*ReadGroupNSQOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{11} +} -func (m *ReadGroupNSQOptions) GetXConn() *args.NSQConn { - if m != nil { - return m.XConn +func (x *ReadGroupNSQOptions) GetXConn() *args.NSQConn { + if x != nil { + return x.XConn } return nil } -func (m *ReadGroupNSQOptions) GetArgs() *args.NSQReadArgs { - if m != nil { - return m.Args +func (x *ReadGroupNSQOptions) GetArgs() *args.NSQReadArgs { + if x != nil { + return x.Args } return nil } type ReadGroupPostgresOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.PostgresConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.PostgresReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.PostgresReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *ReadGroupPostgresOptions) Reset() { *m = ReadGroupPostgresOptions{} } -func (m *ReadGroupPostgresOptions) String() string { return proto.CompactTextString(m) } -func (*ReadGroupPostgresOptions) ProtoMessage() {} -func (*ReadGroupPostgresOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{12} +func (x *ReadGroupPostgresOptions) Reset() { + *x = ReadGroupPostgresOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadGroupPostgresOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadGroupPostgresOptions.Unmarshal(m, b) -} -func (m *ReadGroupPostgresOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadGroupPostgresOptions.Marshal(b, m, deterministic) -} -func (m *ReadGroupPostgresOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadGroupPostgresOptions.Merge(m, src) -} -func (m *ReadGroupPostgresOptions) XXX_Size() int { - return xxx_messageInfo_ReadGroupPostgresOptions.Size(m) +func (x *ReadGroupPostgresOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadGroupPostgresOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadGroupPostgresOptions.DiscardUnknown(m) + +func (*ReadGroupPostgresOptions) ProtoMessage() {} + +func (x *ReadGroupPostgresOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadGroupPostgresOptions proto.InternalMessageInfo +// Deprecated: Use ReadGroupPostgresOptions.ProtoReflect.Descriptor instead. +func (*ReadGroupPostgresOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{12} +} -func (m *ReadGroupPostgresOptions) GetXConn() *args.PostgresConn { - if m != nil { - return m.XConn +func (x *ReadGroupPostgresOptions) GetXConn() *args.PostgresConn { + if x != nil { + return x.XConn } return nil } -func (m *ReadGroupPostgresOptions) GetArgs() *args.PostgresReadArgs { - if m != nil { - return m.Args +func (x *ReadGroupPostgresOptions) GetArgs() *args.PostgresReadArgs { + if x != nil { + return x.Args } return nil } type ReadGroupPulsarOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.PulsarConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.PulsarReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.PulsarReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *ReadGroupPulsarOptions) Reset() { *m = ReadGroupPulsarOptions{} } -func (m *ReadGroupPulsarOptions) String() string { return proto.CompactTextString(m) } -func (*ReadGroupPulsarOptions) ProtoMessage() {} -func (*ReadGroupPulsarOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{13} +func (x *ReadGroupPulsarOptions) Reset() { + *x = ReadGroupPulsarOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadGroupPulsarOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadGroupPulsarOptions.Unmarshal(m, b) -} -func (m *ReadGroupPulsarOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadGroupPulsarOptions.Marshal(b, m, deterministic) -} -func (m *ReadGroupPulsarOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadGroupPulsarOptions.Merge(m, src) +func (x *ReadGroupPulsarOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadGroupPulsarOptions) XXX_Size() int { - return xxx_messageInfo_ReadGroupPulsarOptions.Size(m) -} -func (m *ReadGroupPulsarOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadGroupPulsarOptions.DiscardUnknown(m) + +func (*ReadGroupPulsarOptions) ProtoMessage() {} + +func (x *ReadGroupPulsarOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadGroupPulsarOptions proto.InternalMessageInfo +// Deprecated: Use ReadGroupPulsarOptions.ProtoReflect.Descriptor instead. +func (*ReadGroupPulsarOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{13} +} -func (m *ReadGroupPulsarOptions) GetXConn() *args.PulsarConn { - if m != nil { - return m.XConn +func (x *ReadGroupPulsarOptions) GetXConn() *args.PulsarConn { + if x != nil { + return x.XConn } return nil } -func (m *ReadGroupPulsarOptions) GetArgs() *args.PulsarReadArgs { - if m != nil { - return m.Args +func (x *ReadGroupPulsarOptions) GetArgs() *args.PulsarReadArgs { + if x != nil { + return x.Args } return nil } type ReadGroupRabbitOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.RabbitConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.RabbitReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.RabbitReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *ReadGroupRabbitOptions) Reset() { *m = ReadGroupRabbitOptions{} } -func (m *ReadGroupRabbitOptions) String() string { return proto.CompactTextString(m) } -func (*ReadGroupRabbitOptions) ProtoMessage() {} -func (*ReadGroupRabbitOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{14} +func (x *ReadGroupRabbitOptions) Reset() { + *x = ReadGroupRabbitOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadGroupRabbitOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadGroupRabbitOptions.Unmarshal(m, b) -} -func (m *ReadGroupRabbitOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadGroupRabbitOptions.Marshal(b, m, deterministic) +func (x *ReadGroupRabbitOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadGroupRabbitOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadGroupRabbitOptions.Merge(m, src) -} -func (m *ReadGroupRabbitOptions) XXX_Size() int { - return xxx_messageInfo_ReadGroupRabbitOptions.Size(m) -} -func (m *ReadGroupRabbitOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadGroupRabbitOptions.DiscardUnknown(m) + +func (*ReadGroupRabbitOptions) ProtoMessage() {} + +func (x *ReadGroupRabbitOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadGroupRabbitOptions proto.InternalMessageInfo +// Deprecated: Use ReadGroupRabbitOptions.ProtoReflect.Descriptor instead. +func (*ReadGroupRabbitOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{14} +} -func (m *ReadGroupRabbitOptions) GetXConn() *args.RabbitConn { - if m != nil { - return m.XConn +func (x *ReadGroupRabbitOptions) GetXConn() *args.RabbitConn { + if x != nil { + return x.XConn } return nil } -func (m *ReadGroupRabbitOptions) GetArgs() *args.RabbitReadArgs { - if m != nil { - return m.Args +func (x *ReadGroupRabbitOptions) GetArgs() *args.RabbitReadArgs { + if x != nil { + return x.Args } return nil } type ReadGroupRabbitStreamsOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.RabbitStreamsConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.RabbitStreamsReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.RabbitStreamsReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *ReadGroupRabbitStreamsOptions) Reset() { *m = ReadGroupRabbitStreamsOptions{} } -func (m *ReadGroupRabbitStreamsOptions) String() string { return proto.CompactTextString(m) } -func (*ReadGroupRabbitStreamsOptions) ProtoMessage() {} -func (*ReadGroupRabbitStreamsOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{15} +func (x *ReadGroupRabbitStreamsOptions) Reset() { + *x = ReadGroupRabbitStreamsOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadGroupRabbitStreamsOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadGroupRabbitStreamsOptions.Unmarshal(m, b) +func (x *ReadGroupRabbitStreamsOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadGroupRabbitStreamsOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadGroupRabbitStreamsOptions.Marshal(b, m, deterministic) -} -func (m *ReadGroupRabbitStreamsOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadGroupRabbitStreamsOptions.Merge(m, src) -} -func (m *ReadGroupRabbitStreamsOptions) XXX_Size() int { - return xxx_messageInfo_ReadGroupRabbitStreamsOptions.Size(m) -} -func (m *ReadGroupRabbitStreamsOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadGroupRabbitStreamsOptions.DiscardUnknown(m) + +func (*ReadGroupRabbitStreamsOptions) ProtoMessage() {} + +func (x *ReadGroupRabbitStreamsOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadGroupRabbitStreamsOptions proto.InternalMessageInfo +// Deprecated: Use ReadGroupRabbitStreamsOptions.ProtoReflect.Descriptor instead. +func (*ReadGroupRabbitStreamsOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{15} +} -func (m *ReadGroupRabbitStreamsOptions) GetXConn() *args.RabbitStreamsConn { - if m != nil { - return m.XConn +func (x *ReadGroupRabbitStreamsOptions) GetXConn() *args.RabbitStreamsConn { + if x != nil { + return x.XConn } return nil } -func (m *ReadGroupRabbitStreamsOptions) GetArgs() *args.RabbitStreamsReadArgs { - if m != nil { - return m.Args +func (x *ReadGroupRabbitStreamsOptions) GetArgs() *args.RabbitStreamsReadArgs { + if x != nil { + return x.Args } return nil } type ReadGroupRedisPubSubOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.RedisPubSubConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.RedisPubSubReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.RedisPubSubReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *ReadGroupRedisPubSubOptions) Reset() { *m = ReadGroupRedisPubSubOptions{} } -func (m *ReadGroupRedisPubSubOptions) String() string { return proto.CompactTextString(m) } -func (*ReadGroupRedisPubSubOptions) ProtoMessage() {} -func (*ReadGroupRedisPubSubOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{16} +func (x *ReadGroupRedisPubSubOptions) Reset() { + *x = ReadGroupRedisPubSubOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadGroupRedisPubSubOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadGroupRedisPubSubOptions.Unmarshal(m, b) -} -func (m *ReadGroupRedisPubSubOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadGroupRedisPubSubOptions.Marshal(b, m, deterministic) -} -func (m *ReadGroupRedisPubSubOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadGroupRedisPubSubOptions.Merge(m, src) -} -func (m *ReadGroupRedisPubSubOptions) XXX_Size() int { - return xxx_messageInfo_ReadGroupRedisPubSubOptions.Size(m) +func (x *ReadGroupRedisPubSubOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadGroupRedisPubSubOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadGroupRedisPubSubOptions.DiscardUnknown(m) + +func (*ReadGroupRedisPubSubOptions) ProtoMessage() {} + +func (x *ReadGroupRedisPubSubOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadGroupRedisPubSubOptions proto.InternalMessageInfo +// Deprecated: Use ReadGroupRedisPubSubOptions.ProtoReflect.Descriptor instead. +func (*ReadGroupRedisPubSubOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{16} +} -func (m *ReadGroupRedisPubSubOptions) GetXConn() *args.RedisPubSubConn { - if m != nil { - return m.XConn +func (x *ReadGroupRedisPubSubOptions) GetXConn() *args.RedisPubSubConn { + if x != nil { + return x.XConn } return nil } -func (m *ReadGroupRedisPubSubOptions) GetArgs() *args.RedisPubSubReadArgs { - if m != nil { - return m.Args +func (x *ReadGroupRedisPubSubOptions) GetArgs() *args.RedisPubSubReadArgs { + if x != nil { + return x.Args } return nil } type ReadGroupRedisStreamsOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.RedisStreamsConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.RedisStreamsReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.RedisStreamsReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *ReadGroupRedisStreamsOptions) Reset() { *m = ReadGroupRedisStreamsOptions{} } -func (m *ReadGroupRedisStreamsOptions) String() string { return proto.CompactTextString(m) } -func (*ReadGroupRedisStreamsOptions) ProtoMessage() {} -func (*ReadGroupRedisStreamsOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{17} +func (x *ReadGroupRedisStreamsOptions) Reset() { + *x = ReadGroupRedisStreamsOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadGroupRedisStreamsOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadGroupRedisStreamsOptions.Unmarshal(m, b) -} -func (m *ReadGroupRedisStreamsOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadGroupRedisStreamsOptions.Marshal(b, m, deterministic) -} -func (m *ReadGroupRedisStreamsOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadGroupRedisStreamsOptions.Merge(m, src) +func (x *ReadGroupRedisStreamsOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadGroupRedisStreamsOptions) XXX_Size() int { - return xxx_messageInfo_ReadGroupRedisStreamsOptions.Size(m) -} -func (m *ReadGroupRedisStreamsOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadGroupRedisStreamsOptions.DiscardUnknown(m) + +func (*ReadGroupRedisStreamsOptions) ProtoMessage() {} + +func (x *ReadGroupRedisStreamsOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadGroupRedisStreamsOptions proto.InternalMessageInfo +// Deprecated: Use ReadGroupRedisStreamsOptions.ProtoReflect.Descriptor instead. +func (*ReadGroupRedisStreamsOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{17} +} -func (m *ReadGroupRedisStreamsOptions) GetXConn() *args.RedisStreamsConn { - if m != nil { - return m.XConn +func (x *ReadGroupRedisStreamsOptions) GetXConn() *args.RedisStreamsConn { + if x != nil { + return x.XConn } return nil } -func (m *ReadGroupRedisStreamsOptions) GetArgs() *args.RedisStreamsReadArgs { - if m != nil { - return m.Args +func (x *ReadGroupRedisStreamsOptions) GetArgs() *args.RedisStreamsReadArgs { + if x != nil { + return x.Args } return nil } type ReadGroupAzureEventHubOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.AzureEventHubConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.AzureEventHubReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.AzureEventHubReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *ReadGroupAzureEventHubOptions) Reset() { *m = ReadGroupAzureEventHubOptions{} } -func (m *ReadGroupAzureEventHubOptions) String() string { return proto.CompactTextString(m) } -func (*ReadGroupAzureEventHubOptions) ProtoMessage() {} -func (*ReadGroupAzureEventHubOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{18} +func (x *ReadGroupAzureEventHubOptions) Reset() { + *x = ReadGroupAzureEventHubOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadGroupAzureEventHubOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadGroupAzureEventHubOptions.Unmarshal(m, b) -} -func (m *ReadGroupAzureEventHubOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadGroupAzureEventHubOptions.Marshal(b, m, deterministic) +func (x *ReadGroupAzureEventHubOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadGroupAzureEventHubOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadGroupAzureEventHubOptions.Merge(m, src) -} -func (m *ReadGroupAzureEventHubOptions) XXX_Size() int { - return xxx_messageInfo_ReadGroupAzureEventHubOptions.Size(m) -} -func (m *ReadGroupAzureEventHubOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadGroupAzureEventHubOptions.DiscardUnknown(m) + +func (*ReadGroupAzureEventHubOptions) ProtoMessage() {} + +func (x *ReadGroupAzureEventHubOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadGroupAzureEventHubOptions proto.InternalMessageInfo +// Deprecated: Use ReadGroupAzureEventHubOptions.ProtoReflect.Descriptor instead. +func (*ReadGroupAzureEventHubOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{18} +} -func (m *ReadGroupAzureEventHubOptions) GetXConn() *args.AzureEventHubConn { - if m != nil { - return m.XConn +func (x *ReadGroupAzureEventHubOptions) GetXConn() *args.AzureEventHubConn { + if x != nil { + return x.XConn } return nil } -func (m *ReadGroupAzureEventHubOptions) GetArgs() *args.AzureEventHubReadArgs { - if m != nil { - return m.Args +func (x *ReadGroupAzureEventHubOptions) GetArgs() *args.AzureEventHubReadArgs { + if x != nil { + return x.Args } return nil } type ReadGroupAzureServiceBusOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.AzureServiceBusConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.AzureServiceBusReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.AzureServiceBusReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *ReadGroupAzureServiceBusOptions) Reset() { *m = ReadGroupAzureServiceBusOptions{} } -func (m *ReadGroupAzureServiceBusOptions) String() string { return proto.CompactTextString(m) } -func (*ReadGroupAzureServiceBusOptions) ProtoMessage() {} -func (*ReadGroupAzureServiceBusOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{19} +func (x *ReadGroupAzureServiceBusOptions) Reset() { + *x = ReadGroupAzureServiceBusOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadGroupAzureServiceBusOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadGroupAzureServiceBusOptions.Unmarshal(m, b) -} -func (m *ReadGroupAzureServiceBusOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadGroupAzureServiceBusOptions.Marshal(b, m, deterministic) -} -func (m *ReadGroupAzureServiceBusOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadGroupAzureServiceBusOptions.Merge(m, src) +func (x *ReadGroupAzureServiceBusOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadGroupAzureServiceBusOptions) XXX_Size() int { - return xxx_messageInfo_ReadGroupAzureServiceBusOptions.Size(m) -} -func (m *ReadGroupAzureServiceBusOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadGroupAzureServiceBusOptions.DiscardUnknown(m) + +func (*ReadGroupAzureServiceBusOptions) ProtoMessage() {} + +func (x *ReadGroupAzureServiceBusOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadGroupAzureServiceBusOptions proto.InternalMessageInfo +// Deprecated: Use ReadGroupAzureServiceBusOptions.ProtoReflect.Descriptor instead. +func (*ReadGroupAzureServiceBusOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{19} +} -func (m *ReadGroupAzureServiceBusOptions) GetXConn() *args.AzureServiceBusConn { - if m != nil { - return m.XConn +func (x *ReadGroupAzureServiceBusOptions) GetXConn() *args.AzureServiceBusConn { + if x != nil { + return x.XConn } return nil } -func (m *ReadGroupAzureServiceBusOptions) GetArgs() *args.AzureServiceBusReadArgs { - if m != nil { - return m.Args +func (x *ReadGroupAzureServiceBusOptions) GetArgs() *args.AzureServiceBusReadArgs { + if x != nil { + return x.Args } return nil } type ReadGroupMQTTOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.MQTTConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.MQTTReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.MQTTReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *ReadGroupMQTTOptions) Reset() { *m = ReadGroupMQTTOptions{} } -func (m *ReadGroupMQTTOptions) String() string { return proto.CompactTextString(m) } -func (*ReadGroupMQTTOptions) ProtoMessage() {} -func (*ReadGroupMQTTOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{20} +func (x *ReadGroupMQTTOptions) Reset() { + *x = ReadGroupMQTTOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadGroupMQTTOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadGroupMQTTOptions.Unmarshal(m, b) -} -func (m *ReadGroupMQTTOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadGroupMQTTOptions.Marshal(b, m, deterministic) -} -func (m *ReadGroupMQTTOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadGroupMQTTOptions.Merge(m, src) -} -func (m *ReadGroupMQTTOptions) XXX_Size() int { - return xxx_messageInfo_ReadGroupMQTTOptions.Size(m) +func (x *ReadGroupMQTTOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadGroupMQTTOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadGroupMQTTOptions.DiscardUnknown(m) + +func (*ReadGroupMQTTOptions) ProtoMessage() {} + +func (x *ReadGroupMQTTOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadGroupMQTTOptions proto.InternalMessageInfo +// Deprecated: Use ReadGroupMQTTOptions.ProtoReflect.Descriptor instead. +func (*ReadGroupMQTTOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{20} +} -func (m *ReadGroupMQTTOptions) GetXConn() *args.MQTTConn { - if m != nil { - return m.XConn +func (x *ReadGroupMQTTOptions) GetXConn() *args.MQTTConn { + if x != nil { + return x.XConn } return nil } -func (m *ReadGroupMQTTOptions) GetArgs() *args.MQTTReadArgs { - if m != nil { - return m.Args +func (x *ReadGroupMQTTOptions) GetArgs() *args.MQTTReadArgs { + if x != nil { + return x.Args } return nil } type ReadGroupGCPPubSubOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.GCPPubSubConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.GCPPubSubReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.GCPPubSubReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *ReadGroupGCPPubSubOptions) Reset() { *m = ReadGroupGCPPubSubOptions{} } -func (m *ReadGroupGCPPubSubOptions) String() string { return proto.CompactTextString(m) } -func (*ReadGroupGCPPubSubOptions) ProtoMessage() {} -func (*ReadGroupGCPPubSubOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{21} +func (x *ReadGroupGCPPubSubOptions) Reset() { + *x = ReadGroupGCPPubSubOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadGroupGCPPubSubOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadGroupGCPPubSubOptions.Unmarshal(m, b) -} -func (m *ReadGroupGCPPubSubOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadGroupGCPPubSubOptions.Marshal(b, m, deterministic) -} -func (m *ReadGroupGCPPubSubOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadGroupGCPPubSubOptions.Merge(m, src) +func (x *ReadGroupGCPPubSubOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadGroupGCPPubSubOptions) XXX_Size() int { - return xxx_messageInfo_ReadGroupGCPPubSubOptions.Size(m) -} -func (m *ReadGroupGCPPubSubOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadGroupGCPPubSubOptions.DiscardUnknown(m) + +func (*ReadGroupGCPPubSubOptions) ProtoMessage() {} + +func (x *ReadGroupGCPPubSubOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadGroupGCPPubSubOptions proto.InternalMessageInfo +// Deprecated: Use ReadGroupGCPPubSubOptions.ProtoReflect.Descriptor instead. +func (*ReadGroupGCPPubSubOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{21} +} -func (m *ReadGroupGCPPubSubOptions) GetXConn() *args.GCPPubSubConn { - if m != nil { - return m.XConn +func (x *ReadGroupGCPPubSubOptions) GetXConn() *args.GCPPubSubConn { + if x != nil { + return x.XConn } return nil } -func (m *ReadGroupGCPPubSubOptions) GetArgs() *args.GCPPubSubReadArgs { - if m != nil { - return m.Args +func (x *ReadGroupGCPPubSubOptions) GetArgs() *args.GCPPubSubReadArgs { + if x != nil { + return x.Args } return nil } type ReadGroupKubeMQQueueOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.KubeMQQueueConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.KubeMQQueueReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.KubeMQQueueReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *ReadGroupKubeMQQueueOptions) Reset() { *m = ReadGroupKubeMQQueueOptions{} } -func (m *ReadGroupKubeMQQueueOptions) String() string { return proto.CompactTextString(m) } -func (*ReadGroupKubeMQQueueOptions) ProtoMessage() {} -func (*ReadGroupKubeMQQueueOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{22} +func (x *ReadGroupKubeMQQueueOptions) Reset() { + *x = ReadGroupKubeMQQueueOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadGroupKubeMQQueueOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadGroupKubeMQQueueOptions.Unmarshal(m, b) -} -func (m *ReadGroupKubeMQQueueOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadGroupKubeMQQueueOptions.Marshal(b, m, deterministic) +func (x *ReadGroupKubeMQQueueOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadGroupKubeMQQueueOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadGroupKubeMQQueueOptions.Merge(m, src) -} -func (m *ReadGroupKubeMQQueueOptions) XXX_Size() int { - return xxx_messageInfo_ReadGroupKubeMQQueueOptions.Size(m) -} -func (m *ReadGroupKubeMQQueueOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadGroupKubeMQQueueOptions.DiscardUnknown(m) + +func (*ReadGroupKubeMQQueueOptions) ProtoMessage() {} + +func (x *ReadGroupKubeMQQueueOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadGroupKubeMQQueueOptions proto.InternalMessageInfo +// Deprecated: Use ReadGroupKubeMQQueueOptions.ProtoReflect.Descriptor instead. +func (*ReadGroupKubeMQQueueOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{22} +} -func (m *ReadGroupKubeMQQueueOptions) GetXConn() *args.KubeMQQueueConn { - if m != nil { - return m.XConn +func (x *ReadGroupKubeMQQueueOptions) GetXConn() *args.KubeMQQueueConn { + if x != nil { + return x.XConn } return nil } -func (m *ReadGroupKubeMQQueueOptions) GetArgs() *args.KubeMQQueueReadArgs { - if m != nil { - return m.Args +func (x *ReadGroupKubeMQQueueOptions) GetArgs() *args.KubeMQQueueReadArgs { + if x != nil { + return x.Args } return nil } type ReadGroupAWSKinesisOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.AWSKinesisConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.AWSKinesisReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.AWSKinesisReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *ReadGroupAWSKinesisOptions) Reset() { *m = ReadGroupAWSKinesisOptions{} } -func (m *ReadGroupAWSKinesisOptions) String() string { return proto.CompactTextString(m) } -func (*ReadGroupAWSKinesisOptions) ProtoMessage() {} -func (*ReadGroupAWSKinesisOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{23} +func (x *ReadGroupAWSKinesisOptions) Reset() { + *x = ReadGroupAWSKinesisOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadGroupAWSKinesisOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadGroupAWSKinesisOptions.Unmarshal(m, b) -} -func (m *ReadGroupAWSKinesisOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadGroupAWSKinesisOptions.Marshal(b, m, deterministic) -} -func (m *ReadGroupAWSKinesisOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadGroupAWSKinesisOptions.Merge(m, src) +func (x *ReadGroupAWSKinesisOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadGroupAWSKinesisOptions) XXX_Size() int { - return xxx_messageInfo_ReadGroupAWSKinesisOptions.Size(m) -} -func (m *ReadGroupAWSKinesisOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadGroupAWSKinesisOptions.DiscardUnknown(m) + +func (*ReadGroupAWSKinesisOptions) ProtoMessage() {} + +func (x *ReadGroupAWSKinesisOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadGroupAWSKinesisOptions proto.InternalMessageInfo +// Deprecated: Use ReadGroupAWSKinesisOptions.ProtoReflect.Descriptor instead. +func (*ReadGroupAWSKinesisOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{23} +} -func (m *ReadGroupAWSKinesisOptions) GetXConn() *args.AWSKinesisConn { - if m != nil { - return m.XConn +func (x *ReadGroupAWSKinesisOptions) GetXConn() *args.AWSKinesisConn { + if x != nil { + return x.XConn } return nil } -func (m *ReadGroupAWSKinesisOptions) GetArgs() *args.AWSKinesisReadArgs { - if m != nil { - return m.Args +func (x *ReadGroupAWSKinesisOptions) GetArgs() *args.AWSKinesisReadArgs { + if x != nil { + return x.Args } return nil } type ReadGroupMemphisOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.MemphisConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.MemphisReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.MemphisReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *ReadGroupMemphisOptions) Reset() { *m = ReadGroupMemphisOptions{} } -func (m *ReadGroupMemphisOptions) String() string { return proto.CompactTextString(m) } -func (*ReadGroupMemphisOptions) ProtoMessage() {} -func (*ReadGroupMemphisOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{24} +func (x *ReadGroupMemphisOptions) Reset() { + *x = ReadGroupMemphisOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadGroupMemphisOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadGroupMemphisOptions.Unmarshal(m, b) -} -func (m *ReadGroupMemphisOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadGroupMemphisOptions.Marshal(b, m, deterministic) -} -func (m *ReadGroupMemphisOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadGroupMemphisOptions.Merge(m, src) +func (x *ReadGroupMemphisOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadGroupMemphisOptions) XXX_Size() int { - return xxx_messageInfo_ReadGroupMemphisOptions.Size(m) -} -func (m *ReadGroupMemphisOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ReadGroupMemphisOptions.DiscardUnknown(m) + +func (*ReadGroupMemphisOptions) ProtoMessage() {} + +func (x *ReadGroupMemphisOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadGroupMemphisOptions proto.InternalMessageInfo +// Deprecated: Use ReadGroupMemphisOptions.ProtoReflect.Descriptor instead. +func (*ReadGroupMemphisOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{24} +} -func (m *ReadGroupMemphisOptions) GetXConn() *args.MemphisConn { - if m != nil { - return m.XConn +func (x *ReadGroupMemphisOptions) GetXConn() *args.MemphisConn { + if x != nil { + return x.XConn } return nil } -func (m *ReadGroupMemphisOptions) GetArgs() *args.MemphisReadArgs { - if m != nil { - return m.Args +func (x *ReadGroupMemphisOptions) GetArgs() *args.MemphisReadArgs { + if x != nil { + return x.Args } return nil } type InferSchemaOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Type of schema to infer from the data // @gotags: kong:"-" Type InferSchemaOptions_Type `protobuf:"varint,1,opt,name=type,proto3,enum=protos.opts.InferSchemaOptions_Type" json:"type,omitempty" kong:"-"` @@ -1590,190 +1836,937 @@ type InferSchemaOptions struct { // If filled out by end user, plumber will pull the schema and evolve from it // If empty, plumber will make a new schema, save and publish to other instances, and then evolve from it // @gotags: kong:"-" - SchemaId string `protobuf:"bytes,2,opt,name=schema_id,json=schemaId,proto3" json:"schema_id,omitempty" kong:"-"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + SchemaId string `protobuf:"bytes,2,opt,name=schema_id,json=schemaId,proto3" json:"schema_id,omitempty" kong:"-"` } -func (m *InferSchemaOptions) Reset() { *m = InferSchemaOptions{} } -func (m *InferSchemaOptions) String() string { return proto.CompactTextString(m) } -func (*InferSchemaOptions) ProtoMessage() {} -func (*InferSchemaOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_ff5a708dd529ae21, []int{25} +func (x *InferSchemaOptions) Reset() { + *x = InferSchemaOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_read_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *InferSchemaOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_InferSchemaOptions.Unmarshal(m, b) -} -func (m *InferSchemaOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_InferSchemaOptions.Marshal(b, m, deterministic) +func (x *InferSchemaOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *InferSchemaOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_InferSchemaOptions.Merge(m, src) -} -func (m *InferSchemaOptions) XXX_Size() int { - return xxx_messageInfo_InferSchemaOptions.Size(m) -} -func (m *InferSchemaOptions) XXX_DiscardUnknown() { - xxx_messageInfo_InferSchemaOptions.DiscardUnknown(m) + +func (*InferSchemaOptions) ProtoMessage() {} + +func (x *InferSchemaOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_read_proto_msgTypes[25] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_InferSchemaOptions proto.InternalMessageInfo +// Deprecated: Use InferSchemaOptions.ProtoReflect.Descriptor instead. +func (*InferSchemaOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_read_proto_rawDescGZIP(), []int{25} +} -func (m *InferSchemaOptions) GetType() InferSchemaOptions_Type { - if m != nil { - return m.Type +func (x *InferSchemaOptions) GetType() InferSchemaOptions_Type { + if x != nil { + return x.Type } return InferSchemaOptions_UNSET } -func (m *InferSchemaOptions) GetSchemaId() string { - if m != nil { - return m.SchemaId +func (x *InferSchemaOptions) GetSchemaId() string { + if x != nil { + return x.SchemaId } return "" } -func init() { - proto.RegisterEnum("protos.opts.ConvertOption", ConvertOption_name, ConvertOption_value) - proto.RegisterEnum("protos.opts.InferSchemaOptions_Type", InferSchemaOptions_Type_name, InferSchemaOptions_Type_value) - proto.RegisterType((*ReadCLIOptions)(nil), "protos.opts.ReadCLIOptions") - proto.RegisterType((*ReadSampleOptions)(nil), "protos.opts.ReadSampleOptions") - proto.RegisterType((*ReadFilterOptions)(nil), "protos.opts.ReadFilterOptions") - proto.RegisterType((*ReadOptions)(nil), "protos.opts.ReadOptions") - proto.RegisterType((*ReadGroupKafkaOptions)(nil), "protos.opts.ReadGroupKafkaOptions") - proto.RegisterType((*ReadGroupActiveMQOptions)(nil), "protos.opts.ReadGroupActiveMQOptions") - proto.RegisterType((*ReadGroupAWSSQSOptions)(nil), "protos.opts.ReadGroupAWSSQSOptions") - proto.RegisterType((*ReadGroupMongoOptions)(nil), "protos.opts.ReadGroupMongoOptions") - proto.RegisterType((*ReadGroupNatsOptions)(nil), "protos.opts.ReadGroupNatsOptions") - proto.RegisterType((*ReadGroupNatsStreamingOptions)(nil), "protos.opts.ReadGroupNatsStreamingOptions") - proto.RegisterType((*ReadGroupNatsJetstreamOptions)(nil), "protos.opts.ReadGroupNatsJetstreamOptions") - proto.RegisterType((*ReadGroupNSQOptions)(nil), "protos.opts.ReadGroupNSQOptions") - proto.RegisterType((*ReadGroupPostgresOptions)(nil), "protos.opts.ReadGroupPostgresOptions") - proto.RegisterType((*ReadGroupPulsarOptions)(nil), "protos.opts.ReadGroupPulsarOptions") - proto.RegisterType((*ReadGroupRabbitOptions)(nil), "protos.opts.ReadGroupRabbitOptions") - proto.RegisterType((*ReadGroupRabbitStreamsOptions)(nil), "protos.opts.ReadGroupRabbitStreamsOptions") - proto.RegisterType((*ReadGroupRedisPubSubOptions)(nil), "protos.opts.ReadGroupRedisPubSubOptions") - proto.RegisterType((*ReadGroupRedisStreamsOptions)(nil), "protos.opts.ReadGroupRedisStreamsOptions") - proto.RegisterType((*ReadGroupAzureEventHubOptions)(nil), "protos.opts.ReadGroupAzureEventHubOptions") - proto.RegisterType((*ReadGroupAzureServiceBusOptions)(nil), "protos.opts.ReadGroupAzureServiceBusOptions") - proto.RegisterType((*ReadGroupMQTTOptions)(nil), "protos.opts.ReadGroupMQTTOptions") - proto.RegisterType((*ReadGroupGCPPubSubOptions)(nil), "protos.opts.ReadGroupGCPPubSubOptions") - proto.RegisterType((*ReadGroupKubeMQQueueOptions)(nil), "protos.opts.ReadGroupKubeMQQueueOptions") - proto.RegisterType((*ReadGroupAWSKinesisOptions)(nil), "protos.opts.ReadGroupAWSKinesisOptions") - proto.RegisterType((*ReadGroupMemphisOptions)(nil), "protos.opts.ReadGroupMemphisOptions") - proto.RegisterType((*InferSchemaOptions)(nil), "protos.opts.InferSchemaOptions") -} - -func init() { proto.RegisterFile("opts/ps_opts_read.proto", fileDescriptor_ff5a708dd529ae21) } - -var fileDescriptor_ff5a708dd529ae21 = []byte{ - // 1681 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x58, 0x6b, 0x6f, 0xdb, 0x46, - 0x16, 0x5d, 0x25, 0x7e, 0x5e, 0x45, 0x8a, 0x33, 0xf1, 0x63, 0x6c, 0xc7, 0x2f, 0x25, 0xd9, 0x75, - 0xb2, 0x89, 0x94, 0x38, 0x89, 0x91, 0x45, 0x16, 0x01, 0x1c, 0xaf, 0x36, 0x51, 0xb2, 0x7e, 0x91, - 0xde, 0xb6, 0x08, 0x50, 0x10, 0x14, 0x35, 0x96, 0x19, 0x4b, 0x24, 0xc5, 0x21, 0xed, 0x3a, 0x40, - 0x81, 0x02, 0x05, 0x0a, 0x14, 0x28, 0xfa, 0xa1, 0xbf, 0xb1, 0x1f, 0xda, 0xfe, 0x8a, 0x62, 0x66, - 0x48, 0x8a, 0xc3, 0x97, 0xd5, 0x2f, 0xb6, 0x34, 0xf7, 0x9c, 0x73, 0xcf, 0x3c, 0xef, 0x85, 0x60, - 0xc1, 0x76, 0x3c, 0xda, 0x70, 0xa8, 0xc6, 0xfe, 0x6b, 0x2e, 0xd1, 0x3b, 0x75, 0xc7, 0xb5, 0x3d, - 0x1b, 0x95, 0xf9, 0x3f, 0x5a, 0x67, 0xe3, 0x4b, 0xcb, 0xba, 0xdb, 0xe5, 0x28, 0xf6, 0x5f, 0xd3, - 0x0d, 0xcf, 0x3c, 0x27, 0xfd, 0x81, 0x40, 0x2e, 0xad, 0xca, 0xc1, 0x0b, 0xaa, 0x9d, 0x99, 0x16, - 0xa1, 0x26, 0x0d, 0xe2, 0x4b, 0xa9, 0x38, 0x1d, 0x84, 0xb1, 0x9a, 0x1c, 0xfb, 0xec, 0xbb, 0x44, - 0x23, 0xe7, 0xc4, 0xf2, 0xb4, 0x53, 0xbf, 0x1d, 0x60, 0xee, 0x65, 0x60, 0x28, 0x71, 0xcf, 0x4d, - 0x83, 0x68, 0x6d, 0x3f, 0x54, 0x5a, 0x91, 0x50, 0x5d, 0xc3, 0xd1, 0x1c, 0xbf, 0x4d, 0x23, 0x11, - 0x2c, 0x85, 0xcf, 0xf4, 0x93, 0x33, 0x3d, 0x88, 0xac, 0xc9, 0x11, 0xbf, 0x4d, 0xfa, 0x03, 0x6d, - 0xe0, 0x13, 0x9f, 0x64, 0xfa, 0xef, 0x93, 0xbe, 0x73, 0x1a, 0xcd, 0x4d, 0x96, 0xed, 0xdb, 0x56, - 0xd7, 0x0e, 0x22, 0x0b, 0x72, 0x64, 0xe0, 0x79, 0x99, 0x01, 0x4b, 0xf7, 0x42, 0xad, 0x8d, 0x54, - 0x40, 0xfb, 0x44, 0x3c, 0xea, 0xb9, 0x44, 0xef, 0xe7, 0x43, 0x44, 0xdc, 0xb4, 0xba, 0x01, 0x64, - 0x5e, 0x86, 0xd0, 0x70, 0x97, 0xe4, 0x2d, 0x74, 0x6c, 0xea, 0x75, 0x5d, 0x12, 0xa6, 0x5e, 0x94, - 0x83, 0x7e, 0x8f, 0xea, 0x6e, 0x66, 0xc8, 0xd5, 0xdb, 0x6d, 0xd3, 0xcb, 0x74, 0x23, 0x42, 0x81, - 0x1f, 0x9a, 0xb9, 0xb8, 0x2e, 0xe9, 0x98, 0x54, 0xde, 0x97, 0xf5, 0x0c, 0x80, 0x2c, 0x51, 0x23, - 0x96, 0x61, 0x77, 0x4c, 0xab, 0xcb, 0x50, 0xe1, 0x67, 0x76, 0x5c, 0x4d, 0xdb, 0x0a, 0x30, 0x35, - 0x03, 0xaa, 0x0a, 0xd1, 0x3b, 0xbb, 0xff, 0x6b, 0x1d, 0x88, 0x71, 0x74, 0x1f, 0xaa, 0xe7, 0xc4, - 0x6d, 0xdb, 0x94, 0x68, 0xb6, 0xef, 0x39, 0xbe, 0x87, 0x4b, 0xeb, 0xa5, 0xcd, 0x29, 0xa5, 0x12, - 0x8c, 0x1e, 0xf0, 0x41, 0x34, 0x0f, 0x13, 0x8e, 0x4b, 0x3c, 0xef, 0x12, 0x5f, 0xe3, 0xe1, 0xe0, - 0x1b, 0x42, 0x30, 0xf6, 0x89, 0xda, 0x16, 0xbe, 0xce, 0x47, 0xf9, 0xe7, 0x5a, 0x0f, 0x6e, 0xb1, - 0x24, 0xaa, 0xde, 0x77, 0x7a, 0x24, 0xcc, 0xb3, 0x06, 0x65, 0xca, 0x07, 0x34, 0x57, 0xf7, 0x08, - 0x4f, 0x52, 0x51, 0x40, 0x0c, 0x29, 0xba, 0x47, 0xd0, 0x36, 0x2c, 0x04, 0x00, 0xd3, 0xf2, 0x88, - 0x7b, 0xae, 0xf7, 0x34, 0x4a, 0x0c, 0xdb, 0xea, 0x50, 0x9e, 0xb2, 0xa2, 0xcc, 0x89, 0x70, 0x2b, - 0x88, 0xaa, 0x22, 0x58, 0x7b, 0x20, 0xb2, 0xfd, 0xd7, 0xec, 0x79, 0xc4, 0x0d, 0xb3, 0xcd, 0xc2, - 0xf8, 0xc0, 0x27, 0xee, 0x25, 0xcf, 0x33, 0xad, 0x88, 0x2f, 0xb5, 0x5f, 0x6f, 0x42, 0x99, 0x61, - 0x43, 0x14, 0x82, 0x31, 0x4b, 0xef, 0x93, 0x00, 0xc4, 0x3f, 0xa3, 0xbb, 0x50, 0x31, 0x6c, 0xcb, - 0x22, 0x06, 0x83, 0x68, 0x66, 0x87, 0x27, 0x9f, 0x56, 0x6e, 0x0c, 0x07, 0x5b, 0x1d, 0xb4, 0x0a, - 0x60, 0xd8, 0x96, 0x67, 0x5a, 0xbe, 0xed, 0xd3, 0x60, 0xee, 0xb1, 0x11, 0xd4, 0x84, 0x6a, 0x30, - 0x97, 0x60, 0xf9, 0xf1, 0xd8, 0x7a, 0x69, 0xb3, 0xbc, 0xb5, 0x5a, 0x8f, 0x3d, 0x16, 0xf5, 0xd4, - 0x22, 0x29, 0x15, 0x2a, 0xad, 0x59, 0x13, 0xaa, 0x1d, 0x62, 0xd8, 0x9d, 0xa1, 0xcc, 0xb8, 0x2c, - 0x13, 0xee, 0x72, 0xfd, 0x3f, 0x1c, 0x16, 0xc9, 0x74, 0xe2, 0x5f, 0xd1, 0x0e, 0x54, 0x0d, 0xdb, - 0x3a, 0x27, 0xae, 0x17, 0x6e, 0xf1, 0xc4, 0x7a, 0x69, 0xb3, 0xba, 0xb5, 0x24, 0xb9, 0xd9, 0x15, - 0x10, 0x41, 0x52, 0x2a, 0x01, 0x23, 0xd8, 0xfe, 0x6d, 0x98, 0x38, 0xe1, 0x0b, 0x8c, 0x27, 0x73, - 0x26, 0x22, 0xad, 0xbf, 0x12, 0xa0, 0xd1, 0x11, 0xcc, 0x9a, 0xd6, 0x09, 0x71, 0x35, 0x6a, 0x9c, - 0x92, 0xbe, 0x1e, 0xcd, 0x63, 0x8a, 0xab, 0xac, 0x49, 0x2a, 0x2d, 0x06, 0x54, 0x39, 0x2e, 0x94, - 0x41, 0x66, 0x6a, 0x0c, 0xcd, 0xc0, 0x75, 0xb6, 0x2d, 0xbf, 0x4d, 0xf2, 0x7d, 0xb9, 0xd6, 0xea, - 0x20, 0x0c, 0x93, 0xc1, 0x53, 0x8b, 0x7f, 0x9f, 0x14, 0xa7, 0x73, 0x87, 0x7f, 0x45, 0xaf, 0xe1, - 0x86, 0x66, 0xf4, 0xcc, 0x28, 0xed, 0x1f, 0xc2, 0xfd, 0x72, 0xca, 0xfd, 0xf0, 0x42, 0x28, 0xb0, - 0xdb, 0x33, 0xc3, 0x5c, 0x2f, 0x61, 0x9c, 0xbf, 0x80, 0xb8, 0xc3, 0x79, 0xb5, 0x14, 0xef, 0xad, - 0x6b, 0xfb, 0xce, 0x07, 0x06, 0x09, 0xe9, 0x82, 0x80, 0x76, 0x60, 0x2a, 0x7c, 0xfd, 0x31, 0xe1, - 0xe4, 0xfb, 0xd9, 0x64, 0xe1, 0x74, 0xef, 0x28, 0xe4, 0x47, 0x34, 0xf4, 0x6f, 0x98, 0x0c, 0x6a, - 0x00, 0x3e, 0xe1, 0x0a, 0x77, 0x73, 0x14, 0xbe, 0x54, 0xd5, 0x23, 0x35, 0x5a, 0x79, 0xfd, 0x82, - 0xaa, 0x03, 0x6e, 0x9d, 0xbf, 0xb2, 0xb8, 0x5b, 0x64, 0x7d, 0x8f, 0x41, 0x22, 0xeb, 0x9c, 0x80, - 0x5e, 0xb0, 0x5b, 0xe1, 0x51, 0x7c, 0xca, 0x89, 0x1b, 0xd9, 0xc4, 0x7d, 0xdd, 0xa3, 0x21, 0x8f, - 0xc3, 0xd1, 0x11, 0x54, 0xe5, 0x77, 0x16, 0x9b, 0x5c, 0xe0, 0x61, 0xbe, 0x80, 0x1a, 0x42, 0xa3, - 0x83, 0x6b, 0xc5, 0x47, 0xd1, 0x16, 0x5c, 0xb7, 0xe8, 0x00, 0x7f, 0xe2, 0x3a, 0xeb, 0x39, 0x3a, - 0x6a, 0xb4, 0x74, 0x0c, 0x8c, 0x5e, 0xc1, 0x84, 0x78, 0x96, 0xf1, 0x59, 0xd1, 0xa2, 0x1d, 0x72, - 0x4c, 0xb4, 0x68, 0x82, 0xc2, 0xc8, 0xe2, 0x75, 0xc6, 0xbd, 0x22, 0xb2, 0xc2, 0x31, 0x11, 0x59, - 0x50, 0xd8, 0x02, 0xc8, 0x4f, 0x3b, 0xee, 0x17, 0x2d, 0x80, 0x10, 0x11, 0x93, 0x8d, 0x96, 0xb2, - 0xe2, 0xc6, 0x47, 0xd9, 0x56, 0xb0, 0x82, 0x88, 0xad, 0xa2, 0xad, 0xd8, 0x3b, 0x3a, 0x3e, 0x8e, - 0xb6, 0x82, 0xc1, 0xd1, 0x57, 0x70, 0x2b, 0x55, 0xfd, 0xb1, 0xcd, 0x35, 0x1e, 0xe5, 0x9c, 0x21, - 0x06, 0x57, 0x05, 0xfa, 0x8d, 0x1f, 0xd9, 0xb9, 0xa9, 0xcb, 0xe3, 0x48, 0x81, 0x9b, 0x89, 0xde, - 0x03, 0x3b, 0x45, 0x93, 0xe4, 0xba, 0x4d, 0x86, 0x7d, 0xe7, 0xb7, 0xa3, 0x49, 0xea, 0xf1, 0x51, - 0xd4, 0x04, 0x18, 0x76, 0x21, 0x78, 0xc0, 0xe5, 0xfe, 0x9e, 0x2d, 0xf7, 0x76, 0xf7, 0xf0, 0xd0, - 0x6f, 0xab, 0x43, 0xa9, 0xe9, 0xae, 0xe1, 0x1c, 0x72, 0x22, 0xfa, 0x00, 0x37, 0xe2, 0x3d, 0x09, - 0x76, 0xb9, 0xd0, 0x66, 0xce, 0x95, 0xf5, 0xdb, 0x64, 0xef, 0xe8, 0x88, 0x01, 0x43, 0xa9, 0xb2, - 0x60, 0xf3, 0x31, 0x26, 0x16, 0xaf, 0xc1, 0x98, 0x16, 0x89, 0x29, 0x0c, 0x29, 0xfb, 0x2a, 0xbb, - 0xc1, 0x18, 0x73, 0xb6, 0x0f, 0x15, 0xa9, 0x5e, 0x63, 0x8f, 0xab, 0x3d, 0x28, 0x50, 0x4b, 0x1c, - 0x0b, 0x61, 0x26, 0x3c, 0x15, 0x3b, 0x30, 0x15, 0xb6, 0x25, 0xd8, 0x2f, 0x7a, 0x5b, 0x0e, 0x03, - 0x54, 0xf4, 0xb6, 0x84, 0xb4, 0xe8, 0xb2, 0x46, 0x7d, 0x13, 0x3e, 0xbf, 0xea, 0xb2, 0xbe, 0x0f, - 0xa1, 0xd2, 0x65, 0x8d, 0x46, 0xd1, 0x3b, 0x28, 0xc7, 0x5a, 0x5a, 0x7c, 0xc1, 0xf5, 0xfe, 0x91, - 0xfb, 0x64, 0x7d, 0x10, 0xb8, 0xe8, 0xd5, 0xd5, 0x2f, 0x68, 0x30, 0x84, 0x5e, 0xc3, 0x64, 0xd0, - 0x3c, 0xe2, 0x6f, 0xb8, 0xca, 0xbd, 0x9c, 0x83, 0x2f, 0x40, 0xa1, 0x44, 0x48, 0xaa, 0x79, 0x30, - 0x97, 0xf9, 0x36, 0xa3, 0x7f, 0xc2, 0xb8, 0xc6, 0xea, 0x38, 0x2f, 0xf8, 0xe5, 0xad, 0xf9, 0x50, - 0x96, 0xb5, 0x54, 0x75, 0x8e, 0xdc, 0xb5, 0x2d, 0x4b, 0x19, 0x63, 0x7f, 0x51, 0x1d, 0xc6, 0xd8, - 0x38, 0xaf, 0xff, 0xe5, 0x61, 0xad, 0x1c, 0x62, 0x59, 0x8e, 0x1d, 0xb7, 0x4b, 0x15, 0x8e, 0xab, - 0x7d, 0x0b, 0x38, 0xef, 0x51, 0x47, 0x75, 0x39, 0xf1, 0xa2, 0x24, 0x16, 0x82, 0x63, 0xb9, 0x9f, - 0x4a, 0xb9, 0x57, 0x32, 0xe1, 0x89, 0xf4, 0x17, 0x30, 0x9f, 0x5d, 0x11, 0xd0, 0x23, 0x39, 0xf9, - 0x82, 0xac, 0xc6, 0xa1, 0xb1, 0xd4, 0x0d, 0x29, 0xf5, 0x72, 0x06, 0x38, 0x91, 0x38, 0xbe, 0xda, - 0xf1, 0x72, 0x52, 0xbc, 0xda, 0x1c, 0x39, 0xe2, 0x6a, 0x73, 0x6c, 0x22, 0xeb, 0x00, 0x66, 0xb3, - 0x6a, 0x11, 0x7a, 0x28, 0x27, 0x9d, 0x93, 0x84, 0x18, 0x30, 0x96, 0xf3, 0xb1, 0x94, 0x73, 0x31, - 0x05, 0x4d, 0xa4, 0xfc, 0xa9, 0x04, 0x2b, 0x85, 0xe5, 0x0b, 0x3d, 0x93, 0x93, 0xaf, 0xa6, 0x14, - 0x23, 0x46, 0xcc, 0xc5, 0xb6, 0xe4, 0xa2, 0x96, 0xcf, 0xb9, 0xca, 0x4e, 0xf2, 0x82, 0x5e, 0x6d, - 0x27, 0x62, 0xfc, 0x05, 0x3b, 0x11, 0x27, 0x61, 0xc7, 0x82, 0xdb, 0x19, 0x35, 0x19, 0x3d, 0x90, - 0x3d, 0xcc, 0xca, 0x7a, 0x6a, 0xfc, 0xd0, 0x3f, 0x92, 0x32, 0xe3, 0x24, 0xb2, 0xe0, 0xba, 0x25, - 0xde, 0xb9, 0xe2, 0xeb, 0x16, 0x82, 0x47, 0xbc, 0x6e, 0x21, 0xbc, 0xe0, 0xba, 0x49, 0xbd, 0x44, - 0xf1, 0x75, 0x13, 0xd0, 0x11, 0xaf, 0x9b, 0x00, 0x17, 0x24, 0x96, 0xfa, 0x90, 0xe2, 0xc4, 0x02, - 0x3a, 0x62, 0x62, 0x01, 0x2e, 0x3a, 0x6f, 0x59, 0xcd, 0x4b, 0xf1, 0x79, 0x93, 0x18, 0x23, 0x9e, - 0x37, 0x89, 0x93, 0xb0, 0xf3, 0x43, 0x09, 0x96, 0x0b, 0x2a, 0x30, 0x7a, 0x2a, 0x9b, 0xb9, 0x23, - 0x0b, 0x0f, 0xf1, 0x31, 0x2b, 0xcf, 0x25, 0x2b, 0xeb, 0x79, 0x8c, 0x84, 0x91, 0x1f, 0x4b, 0x70, - 0xa7, 0xa8, 0x78, 0xa3, 0x2d, 0xd9, 0xc9, 0x4a, 0x5a, 0x37, 0xbd, 0x2a, 0x2f, 0x24, 0x2b, 0x1b, - 0xb9, 0x94, 0xa2, 0x3d, 0xca, 0xea, 0xbd, 0x8a, 0xf7, 0x48, 0x62, 0x8c, 0xb8, 0x47, 0x12, 0x27, - 0x61, 0xe7, 0x97, 0x12, 0xac, 0x5d, 0xd1, 0x62, 0xa2, 0x17, 0xb2, 0xa1, 0xf5, 0xb4, 0xf8, 0x90, - 0x13, 0xb3, 0xf4, 0x52, 0xb2, 0x74, 0xaf, 0x88, 0x55, 0x50, 0x39, 0x62, 0xad, 0x73, 0x71, 0xe5, - 0x60, 0xc0, 0x11, 0x2b, 0x07, 0x83, 0x26, 0x52, 0x7e, 0x57, 0x82, 0xc5, 0xdc, 0x1e, 0x16, 0x35, - 0xe4, 0xc4, 0x72, 0xed, 0x8b, 0xd0, 0xb1, 0xec, 0x5b, 0x52, 0xf6, 0xd5, 0x6c, 0x7c, 0xd1, 0x75, - 0x49, 0x77, 0xbf, 0xc5, 0xd7, 0x25, 0x86, 0x1f, 0xf1, 0xba, 0xc4, 0x18, 0x09, 0x23, 0xdf, 0x97, - 0x60, 0x29, 0xbf, 0x0f, 0x44, 0x4f, 0x64, 0x1f, 0xa9, 0xfe, 0x23, 0x80, 0xc7, 0x6c, 0x3c, 0x93, - 0x6c, 0xac, 0xe5, 0x10, 0x12, 0x2e, 0x3e, 0xc3, 0x42, 0x4e, 0x1b, 0x89, 0x1e, 0xcb, 0x0e, 0xe4, - 0x3a, 0x14, 0x60, 0x63, 0xe9, 0x9f, 0x48, 0xe9, 0xef, 0x64, 0xa1, 0x13, 0xb9, 0x7f, 0x2e, 0x01, - 0x4a, 0xff, 0xd6, 0xc1, 0x4e, 0xb4, 0x77, 0xe9, 0x88, 0x1f, 0xa3, 0xaa, 0x89, 0x96, 0x37, 0x0d, - 0xaf, 0x1f, 0x5f, 0x3a, 0x44, 0xe1, 0x0c, 0xb4, 0x0c, 0xd3, 0xc1, 0xcf, 0x2b, 0xd1, 0xcf, 0x55, - 0x53, 0x62, 0xa0, 0xd5, 0xa9, 0x6d, 0xc0, 0x18, 0x83, 0xa2, 0x69, 0x18, 0xff, 0xff, 0xbe, 0xda, - 0x3c, 0x9e, 0xf9, 0x1b, 0xaa, 0x02, 0xbc, 0x57, 0x0f, 0xf6, 0xd5, 0xdd, 0x77, 0xcd, 0xbd, 0x9d, - 0x99, 0xd2, 0xc3, 0xaf, 0xa1, 0x22, 0xfd, 0xf8, 0x83, 0x30, 0xcc, 0xee, 0x1e, 0xec, 0x7f, 0xd1, - 0x54, 0x8e, 0xb5, 0x83, 0xc3, 0xe3, 0xd6, 0xc1, 0xbe, 0x16, 0x52, 0x17, 0x61, 0x2e, 0x11, 0x79, - 0xb3, 0xa3, 0x36, 0xb7, 0x9f, 0xcf, 0x94, 0xd0, 0x02, 0xdc, 0x4e, 0x84, 0xde, 0x7e, 0x6c, 0x1d, - 0xce, 0x5c, 0x7b, 0xf3, 0xea, 0xe3, 0xbf, 0xba, 0xa6, 0x77, 0xea, 0xb7, 0xeb, 0x86, 0xdd, 0x6f, - 0xb4, 0x75, 0xcf, 0x38, 0x35, 0x6c, 0xd7, 0x69, 0x38, 0x3d, 0xbf, 0xdf, 0x26, 0xee, 0x63, 0x61, - 0x95, 0x36, 0xda, 0xbe, 0xd9, 0xeb, 0x34, 0xba, 0x76, 0x43, 0xcc, 0xbc, 0xc1, 0x66, 0xde, 0x9e, - 0xe0, 0x5f, 0x9e, 0xfd, 0x19, 0x00, 0x00, 0xff, 0xff, 0x93, 0x38, 0x82, 0x9a, 0x7f, 0x17, 0x00, - 0x00, +var File_opts_ps_opts_read_proto protoreflect.FileDescriptor + +var file_opts_ps_opts_read_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x72, + 0x65, 0x61, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x1a, 0x1b, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, + 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x6d, 0x71, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, + 0x73, 0x5f, 0x61, 0x77, 0x73, 0x5f, 0x6b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, + 0x73, 0x5f, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x71, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x22, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x7a, + 0x75, 0x72, 0x65, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x75, 0x62, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x24, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, + 0x73, 0x5f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, + 0x62, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x61, 0x72, 0x67, 0x73, 0x2f, + 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x67, 0x63, 0x70, 0x5f, 0x70, 0x75, 0x62, 0x73, + 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, + 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1f, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, + 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, 0x5f, 0x71, 0x75, 0x65, 0x75, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, + 0x73, 0x5f, 0x6d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x18, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6d, 0x6f, + 0x6e, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x61, 0x72, 0x67, 0x73, 0x2f, + 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6d, 0x71, 0x74, 0x74, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x17, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, + 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x61, 0x72, 0x67, + 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x6a, + 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, + 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, 0x74, + 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x16, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, + 0x6e, 0x73, 0x71, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x61, 0x72, 0x67, 0x73, 0x2f, + 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, + 0x61, 0x72, 0x67, 0x73, 0x5f, 0x70, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x19, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, + 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x61, 0x72, + 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x61, 0x62, 0x62, 0x69, + 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x1f, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x65, + 0x64, 0x69, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x20, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, + 0x65, 0x64, 0x69, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x22, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x2f, 0x70, 0x73, 0x5f, + 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x63, 0x0a, 0x0e, 0x52, 0x65, 0x61, 0x64, 0x43, 0x4c, + 0x49, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x76, 0x65, 0x72, 0x62, + 0x6f, 0x73, 0x65, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x0d, 0x76, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x65, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, + 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x74, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x06, 0x70, 0x72, 0x65, 0x74, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6a, 0x73, 0x6f, 0x6e, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x6a, 0x73, 0x6f, 0x6e, 0x22, 0x6c, 0x0a, 0x11, 0x52, + 0x65, 0x61, 0x64, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x61, 0x74, + 0x65, 0x12, 0x36, 0x0a, 0x17, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x76, 0x61, 0x6c, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x15, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, + 0x61, 0x6c, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x22, 0x29, 0x0a, 0x11, 0x52, 0x65, 0x61, + 0x64, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x14, + 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, + 0x75, 0x65, 0x72, 0x79, 0x22, 0xe4, 0x0f, 0x0a, 0x0b, 0x52, 0x65, 0x61, 0x64, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1e, 0x0a, + 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x6f, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x6f, 0x75, 0x73, 0x12, 0x45, 0x0a, + 0x0e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, + 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0d, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x45, 0x0a, 0x0e, 0x64, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x44, + 0x65, 0x63, 0x6f, 0x64, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0d, 0x64, 0x65, + 0x63, 0x6f, 0x64, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x0a, 0x0e, 0x63, + 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, + 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x0d, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x36, + 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x61, + 0x64, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, + 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x14, 0x69, 0x6e, 0x66, 0x65, 0x72, 0x5f, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, + 0x74, 0x73, 0x2e, 0x49, 0x6e, 0x66, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x12, 0x69, 0x6e, 0x66, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x5f, 0x69, 0x64, + 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x5f, + 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0xe9, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x41, + 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x3e, 0x0a, 0x0c, 0x5f, 0x63, 0x6c, 0x69, 0x5f, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xea, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x43, + 0x4c, 0x49, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0a, 0x43, 0x6c, 0x69, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x38, 0x0a, 0x05, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x18, 0x64, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, + 0x74, 0x73, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4b, 0x61, 0x66, 0x6b, + 0x61, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x05, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x12, + 0x41, 0x0a, 0x08, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x6d, 0x71, 0x18, 0x65, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x25, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, + 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4d, + 0x51, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x08, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, + 0x6d, 0x71, 0x12, 0x3c, 0x0a, 0x07, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x71, 0x73, 0x18, 0x66, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, + 0x73, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x57, 0x53, 0x53, 0x51, + 0x53, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x61, 0x77, 0x73, 0x53, 0x71, 0x73, + 0x12, 0x38, 0x0a, 0x05, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x18, 0x67, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x22, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, + 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x6f, 0x6e, 0x67, 0x6f, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x05, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x12, 0x35, 0x0a, 0x04, 0x6e, 0x61, + 0x74, 0x73, 0x18, 0x68, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x4e, 0x61, 0x74, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x04, 0x6e, 0x61, 0x74, + 0x73, 0x12, 0x51, 0x0a, 0x0e, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x69, 0x6e, 0x67, 0x18, 0x69, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0d, 0x6e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x69, 0x6e, 0x67, 0x12, 0x32, 0x0a, 0x03, 0x6e, 0x73, 0x71, 0x18, 0x6a, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, + 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x53, 0x51, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x03, 0x6e, 0x73, 0x71, 0x12, 0x3b, 0x0a, 0x06, 0x70, 0x75, 0x6c, 0x73, + 0x61, 0x72, 0x18, 0x6b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x50, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x70, + 0x75, 0x6c, 0x73, 0x61, 0x72, 0x12, 0x3b, 0x0a, 0x06, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x18, + 0x6c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, + 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x61, 0x62, + 0x62, 0x69, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x72, 0x61, 0x62, 0x62, + 0x69, 0x74, 0x12, 0x51, 0x0a, 0x0e, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x5f, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x73, 0x18, 0x6d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0d, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x35, 0x0a, 0x04, 0x6d, 0x71, 0x74, 0x74, 0x18, 0x6e, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, + 0x73, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x51, 0x54, 0x54, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x04, 0x6d, 0x71, 0x74, 0x74, 0x12, 0x58, 0x0a, 0x11, + 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x62, 0x75, + 0x73, 0x18, 0x6f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, + 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, 0x12, 0x52, 0x0a, 0x0f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, + 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x75, 0x62, 0x18, 0x70, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, + 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x48, 0x75, 0x62, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0d, 0x61, 0x7a, 0x75, + 0x72, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x75, 0x62, 0x12, 0x45, 0x0a, 0x0a, 0x67, 0x63, + 0x70, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x18, 0x71, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x61, + 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x47, 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x09, 0x67, 0x63, 0x70, 0x50, 0x75, 0x62, 0x73, 0x75, + 0x62, 0x12, 0x4b, 0x0a, 0x0c, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, 0x5f, 0x71, 0x75, 0x65, 0x75, + 0x65, 0x18, 0x72, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4b, + 0x75, 0x62, 0x65, 0x4d, 0x51, 0x51, 0x75, 0x65, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x0b, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, 0x51, 0x75, 0x65, 0x75, 0x65, 0x12, 0x4b, + 0x0a, 0x0c, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x18, 0x73, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, + 0x74, 0x73, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x64, 0x69, + 0x73, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0b, + 0x72, 0x65, 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, 0x73, 0x75, 0x62, 0x12, 0x4e, 0x0a, 0x0d, 0x72, + 0x65, 0x64, 0x69, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x74, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, + 0x2e, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x64, 0x69, 0x73, 0x53, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0c, 0x72, + 0x65, 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x41, 0x0a, 0x08, 0x70, + 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x18, 0x75, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x61, 0x64, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x12, 0x51, + 0x0a, 0x0e, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x6a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x18, 0x76, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, + 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x0d, 0x6e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x12, 0x48, 0x0a, 0x0b, 0x61, 0x77, 0x73, 0x5f, 0x6b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, + 0x18, 0x77, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x57, + 0x53, 0x4b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x0a, 0x61, 0x77, 0x73, 0x4b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x12, 0x3e, 0x0a, 0x07, 0x6d, + 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x18, 0x78, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x22, 0x74, 0x0a, 0x15, 0x52, + 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2b, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, + 0x73, 0x2e, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, + 0x6e, 0x12, 0x2e, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4b, 0x61, + 0x66, 0x6b, 0x61, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, + 0x73, 0x22, 0x7d, 0x0a, 0x18, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x63, + 0x74, 0x69, 0x76, 0x65, 0x4d, 0x51, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2e, 0x0a, + 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x76, + 0x65, 0x4d, 0x51, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x31, 0x0a, + 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, + 0x4d, 0x51, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, + 0x22, 0x77, 0x0a, 0x16, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x57, 0x53, + 0x53, 0x51, 0x53, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2c, 0x0a, 0x05, 0x5f, 0x63, + 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x53, 0x51, 0x53, 0x43, 0x6f, + 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x2f, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x53, 0x51, 0x53, 0x52, 0x65, 0x61, 0x64, 0x41, + 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x74, 0x0a, 0x15, 0x52, 0x65, 0x61, + 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x6f, 0x6e, 0x67, 0x6f, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x2b, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, + 0x4d, 0x6f, 0x6e, 0x67, 0x6f, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, + 0x2e, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4d, 0x6f, 0x6e, 0x67, + 0x6f, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, + 0x71, 0x0a, 0x14, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x74, 0x73, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, + 0x6f, 0x6e, 0x6e, 0x12, 0x2d, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, + 0x4e, 0x61, 0x74, 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, + 0x67, 0x73, 0x22, 0x8c, 0x01, 0x0a, 0x1d, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x33, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, + 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x43, + 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x36, 0x0a, 0x04, 0x61, 0x72, 0x67, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x69, 0x6e, 0x67, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, + 0x73, 0x22, 0x8c, 0x01, 0x0a, 0x1d, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, + 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x33, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, + 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6f, + 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x36, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, + 0x22, 0x6e, 0x0a, 0x13, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x53, 0x51, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x29, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x53, 0x51, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, + 0x6e, 0x6e, 0x12, 0x2c, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, + 0x53, 0x51, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, + 0x22, 0x7d, 0x0a, 0x18, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, 0x6f, 0x73, + 0x74, 0x67, 0x72, 0x65, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2e, 0x0a, 0x05, + 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x67, 0x72, + 0x65, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x31, 0x0a, 0x04, + 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, + 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, + 0x77, 0x0a, 0x16, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, 0x75, 0x6c, 0x73, + 0x61, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2c, 0x0a, 0x05, 0x5f, 0x63, 0x6f, + 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x50, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x43, 0x6f, 0x6e, + 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x2f, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, + 0x72, 0x67, 0x73, 0x2e, 0x50, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, + 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x77, 0x0a, 0x16, 0x52, 0x65, 0x61, 0x64, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x2c, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, + 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, + 0x12, 0x2f, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x61, 0x62, + 0x62, 0x69, 0x74, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, + 0x73, 0x22, 0x8c, 0x01, 0x0a, 0x1d, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, + 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x33, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, + 0x2e, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x43, 0x6f, + 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x36, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, + 0x22, 0x86, 0x01, 0x0a, 0x1b, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, + 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x31, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x65, + 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, + 0x6f, 0x6e, 0x6e, 0x12, 0x34, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, + 0x52, 0x65, 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x52, 0x65, 0x61, 0x64, 0x41, + 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x89, 0x01, 0x0a, 0x1c, 0x52, 0x65, + 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x32, 0x0a, 0x05, 0x5f, 0x63, + 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x35, + 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, + 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, + 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x8c, 0x01, 0x0a, 0x1d, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x75, 0x62, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x33, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, + 0x75, 0x62, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x36, 0x0a, 0x04, + 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x48, 0x75, 0x62, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, + 0x61, 0x72, 0x67, 0x73, 0x22, 0x92, 0x01, 0x0a, 0x1f, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, + 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x35, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x42, 0x75, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, + 0x38, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x7a, 0x75, 0x72, + 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, + 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x71, 0x0a, 0x14, 0x52, 0x65, 0x61, + 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x51, 0x54, 0x54, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4d, + 0x51, 0x54, 0x54, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x2d, 0x0a, + 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4d, 0x51, 0x54, 0x54, 0x52, 0x65, + 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x80, 0x01, 0x0a, + 0x19, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x47, 0x43, 0x50, 0x50, 0x75, 0x62, + 0x53, 0x75, 0x62, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2f, 0x0a, 0x05, 0x5f, 0x63, + 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x47, 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, + 0x62, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x32, 0x0a, 0x04, 0x61, + 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x47, 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, + 0x62, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, + 0x86, 0x01, 0x0a, 0x1b, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4b, 0x75, 0x62, + 0x65, 0x4d, 0x51, 0x51, 0x75, 0x65, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x31, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4b, 0x75, 0x62, + 0x65, 0x4d, 0x51, 0x51, 0x75, 0x65, 0x75, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, + 0x6e, 0x6e, 0x12, 0x34, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4b, + 0x75, 0x62, 0x65, 0x4d, 0x51, 0x51, 0x75, 0x65, 0x75, 0x65, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, + 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x83, 0x01, 0x0a, 0x1a, 0x52, 0x65, 0x61, + 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x57, 0x53, 0x4b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x30, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x4b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x43, + 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x33, 0x0a, 0x04, 0x61, 0x72, 0x67, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x4b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, + 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x7a, + 0x0a, 0x17, 0x52, 0x65, 0x61, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x70, 0x68, + 0x69, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2d, 0x0a, 0x05, 0x5f, 0x63, 0x6f, + 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x43, 0x6f, + 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x30, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x52, 0x65, 0x61, 0x64, + 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x8e, 0x01, 0x0a, 0x12, 0x49, + 0x6e, 0x66, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x38, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x49, 0x6e, + 0x66, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x73, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x49, 0x64, 0x22, 0x21, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x09, 0x0a, 0x05, 0x55, 0x4e, 0x53, 0x45, 0x54, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4a, + 0x53, 0x4f, 0x4e, 0x53, 0x43, 0x48, 0x45, 0x4d, 0x41, 0x10, 0x01, 0x2a, 0x5d, 0x0a, 0x0d, 0x43, + 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x14, + 0x43, 0x4f, 0x4e, 0x56, 0x45, 0x52, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, + 0x4e, 0x53, 0x45, 0x54, 0x10, 0x00, 0x12, 0x19, 0x0a, 0x15, 0x43, 0x4f, 0x4e, 0x56, 0x45, 0x52, + 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x41, 0x53, 0x45, 0x36, 0x34, 0x10, + 0x01, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, 0x4e, 0x56, 0x45, 0x52, 0x54, 0x5f, 0x4f, 0x50, 0x54, + 0x49, 0x4f, 0x4e, 0x5f, 0x47, 0x5a, 0x49, 0x50, 0x10, 0x02, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, + 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2f, 0x6f, 0x70, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_opts_ps_opts_read_proto_rawDescOnce sync.Once + file_opts_ps_opts_read_proto_rawDescData = file_opts_ps_opts_read_proto_rawDesc +) + +func file_opts_ps_opts_read_proto_rawDescGZIP() []byte { + file_opts_ps_opts_read_proto_rawDescOnce.Do(func() { + file_opts_ps_opts_read_proto_rawDescData = protoimpl.X.CompressGZIP(file_opts_ps_opts_read_proto_rawDescData) + }) + return file_opts_ps_opts_read_proto_rawDescData +} + +var file_opts_ps_opts_read_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_opts_ps_opts_read_proto_msgTypes = make([]protoimpl.MessageInfo, 26) +var file_opts_ps_opts_read_proto_goTypes = []interface{}{ + (ConvertOption)(0), // 0: protos.opts.ConvertOption + (InferSchemaOptions_Type)(0), // 1: protos.opts.InferSchemaOptions.Type + (*ReadCLIOptions)(nil), // 2: protos.opts.ReadCLIOptions + (*ReadSampleOptions)(nil), // 3: protos.opts.ReadSampleOptions + (*ReadFilterOptions)(nil), // 4: protos.opts.ReadFilterOptions + (*ReadOptions)(nil), // 5: protos.opts.ReadOptions + (*ReadGroupKafkaOptions)(nil), // 6: protos.opts.ReadGroupKafkaOptions + (*ReadGroupActiveMQOptions)(nil), // 7: protos.opts.ReadGroupActiveMQOptions + (*ReadGroupAWSSQSOptions)(nil), // 8: protos.opts.ReadGroupAWSSQSOptions + (*ReadGroupMongoOptions)(nil), // 9: protos.opts.ReadGroupMongoOptions + (*ReadGroupNatsOptions)(nil), // 10: protos.opts.ReadGroupNatsOptions + (*ReadGroupNatsStreamingOptions)(nil), // 11: protos.opts.ReadGroupNatsStreamingOptions + (*ReadGroupNatsJetstreamOptions)(nil), // 12: protos.opts.ReadGroupNatsJetstreamOptions + (*ReadGroupNSQOptions)(nil), // 13: protos.opts.ReadGroupNSQOptions + (*ReadGroupPostgresOptions)(nil), // 14: protos.opts.ReadGroupPostgresOptions + (*ReadGroupPulsarOptions)(nil), // 15: protos.opts.ReadGroupPulsarOptions + (*ReadGroupRabbitOptions)(nil), // 16: protos.opts.ReadGroupRabbitOptions + (*ReadGroupRabbitStreamsOptions)(nil), // 17: protos.opts.ReadGroupRabbitStreamsOptions + (*ReadGroupRedisPubSubOptions)(nil), // 18: protos.opts.ReadGroupRedisPubSubOptions + (*ReadGroupRedisStreamsOptions)(nil), // 19: protos.opts.ReadGroupRedisStreamsOptions + (*ReadGroupAzureEventHubOptions)(nil), // 20: protos.opts.ReadGroupAzureEventHubOptions + (*ReadGroupAzureServiceBusOptions)(nil), // 21: protos.opts.ReadGroupAzureServiceBusOptions + (*ReadGroupMQTTOptions)(nil), // 22: protos.opts.ReadGroupMQTTOptions + (*ReadGroupGCPPubSubOptions)(nil), // 23: protos.opts.ReadGroupGCPPubSubOptions + (*ReadGroupKubeMQQueueOptions)(nil), // 24: protos.opts.ReadGroupKubeMQQueueOptions + (*ReadGroupAWSKinesisOptions)(nil), // 25: protos.opts.ReadGroupAWSKinesisOptions + (*ReadGroupMemphisOptions)(nil), // 26: protos.opts.ReadGroupMemphisOptions + (*InferSchemaOptions)(nil), // 27: protos.opts.InferSchemaOptions + (*encoding.DecodeOptions)(nil), // 28: protos.encoding.DecodeOptions + (*args.KafkaConn)(nil), // 29: protos.args.KafkaConn + (*args.KafkaReadArgs)(nil), // 30: protos.args.KafkaReadArgs + (*args.ActiveMQConn)(nil), // 31: protos.args.ActiveMQConn + (*args.ActiveMQReadArgs)(nil), // 32: protos.args.ActiveMQReadArgs + (*args.AWSSQSConn)(nil), // 33: protos.args.AWSSQSConn + (*args.AWSSQSReadArgs)(nil), // 34: protos.args.AWSSQSReadArgs + (*args.MongoConn)(nil), // 35: protos.args.MongoConn + (*args.MongoReadArgs)(nil), // 36: protos.args.MongoReadArgs + (*args.NatsConn)(nil), // 37: protos.args.NatsConn + (*args.NatsReadArgs)(nil), // 38: protos.args.NatsReadArgs + (*args.NatsStreamingConn)(nil), // 39: protos.args.NatsStreamingConn + (*args.NatsStreamingReadArgs)(nil), // 40: protos.args.NatsStreamingReadArgs + (*args.NatsJetstreamConn)(nil), // 41: protos.args.NatsJetstreamConn + (*args.NatsJetstreamReadArgs)(nil), // 42: protos.args.NatsJetstreamReadArgs + (*args.NSQConn)(nil), // 43: protos.args.NSQConn + (*args.NSQReadArgs)(nil), // 44: protos.args.NSQReadArgs + (*args.PostgresConn)(nil), // 45: protos.args.PostgresConn + (*args.PostgresReadArgs)(nil), // 46: protos.args.PostgresReadArgs + (*args.PulsarConn)(nil), // 47: protos.args.PulsarConn + (*args.PulsarReadArgs)(nil), // 48: protos.args.PulsarReadArgs + (*args.RabbitConn)(nil), // 49: protos.args.RabbitConn + (*args.RabbitReadArgs)(nil), // 50: protos.args.RabbitReadArgs + (*args.RabbitStreamsConn)(nil), // 51: protos.args.RabbitStreamsConn + (*args.RabbitStreamsReadArgs)(nil), // 52: protos.args.RabbitStreamsReadArgs + (*args.RedisPubSubConn)(nil), // 53: protos.args.RedisPubSubConn + (*args.RedisPubSubReadArgs)(nil), // 54: protos.args.RedisPubSubReadArgs + (*args.RedisStreamsConn)(nil), // 55: protos.args.RedisStreamsConn + (*args.RedisStreamsReadArgs)(nil), // 56: protos.args.RedisStreamsReadArgs + (*args.AzureEventHubConn)(nil), // 57: protos.args.AzureEventHubConn + (*args.AzureEventHubReadArgs)(nil), // 58: protos.args.AzureEventHubReadArgs + (*args.AzureServiceBusConn)(nil), // 59: protos.args.AzureServiceBusConn + (*args.AzureServiceBusReadArgs)(nil), // 60: protos.args.AzureServiceBusReadArgs + (*args.MQTTConn)(nil), // 61: protos.args.MQTTConn + (*args.MQTTReadArgs)(nil), // 62: protos.args.MQTTReadArgs + (*args.GCPPubSubConn)(nil), // 63: protos.args.GCPPubSubConn + (*args.GCPPubSubReadArgs)(nil), // 64: protos.args.GCPPubSubReadArgs + (*args.KubeMQQueueConn)(nil), // 65: protos.args.KubeMQQueueConn + (*args.KubeMQQueueReadArgs)(nil), // 66: protos.args.KubeMQQueueReadArgs + (*args.AWSKinesisConn)(nil), // 67: protos.args.AWSKinesisConn + (*args.AWSKinesisReadArgs)(nil), // 68: protos.args.AWSKinesisReadArgs + (*args.MemphisConn)(nil), // 69: protos.args.MemphisConn + (*args.MemphisReadArgs)(nil), // 70: protos.args.MemphisReadArgs +} +var file_opts_ps_opts_read_proto_depIdxs = []int32{ + 3, // 0: protos.opts.ReadOptions.sample_options:type_name -> protos.opts.ReadSampleOptions + 28, // 1: protos.opts.ReadOptions.decode_options:type_name -> protos.encoding.DecodeOptions + 0, // 2: protos.opts.ReadOptions.convert_output:type_name -> protos.opts.ConvertOption + 4, // 3: protos.opts.ReadOptions.filter:type_name -> protos.opts.ReadFilterOptions + 27, // 4: protos.opts.ReadOptions.infer_schema_options:type_name -> protos.opts.InferSchemaOptions + 2, // 5: protos.opts.ReadOptions._cli_options:type_name -> protos.opts.ReadCLIOptions + 6, // 6: protos.opts.ReadOptions.kafka:type_name -> protos.opts.ReadGroupKafkaOptions + 7, // 7: protos.opts.ReadOptions.activemq:type_name -> protos.opts.ReadGroupActiveMQOptions + 8, // 8: protos.opts.ReadOptions.aws_sqs:type_name -> protos.opts.ReadGroupAWSSQSOptions + 9, // 9: protos.opts.ReadOptions.mongo:type_name -> protos.opts.ReadGroupMongoOptions + 10, // 10: protos.opts.ReadOptions.nats:type_name -> protos.opts.ReadGroupNatsOptions + 11, // 11: protos.opts.ReadOptions.nats_streaming:type_name -> protos.opts.ReadGroupNatsStreamingOptions + 13, // 12: protos.opts.ReadOptions.nsq:type_name -> protos.opts.ReadGroupNSQOptions + 15, // 13: protos.opts.ReadOptions.pulsar:type_name -> protos.opts.ReadGroupPulsarOptions + 16, // 14: protos.opts.ReadOptions.rabbit:type_name -> protos.opts.ReadGroupRabbitOptions + 17, // 15: protos.opts.ReadOptions.rabbit_streams:type_name -> protos.opts.ReadGroupRabbitStreamsOptions + 22, // 16: protos.opts.ReadOptions.mqtt:type_name -> protos.opts.ReadGroupMQTTOptions + 21, // 17: protos.opts.ReadOptions.azure_service_bus:type_name -> protos.opts.ReadGroupAzureServiceBusOptions + 20, // 18: protos.opts.ReadOptions.azure_event_hub:type_name -> protos.opts.ReadGroupAzureEventHubOptions + 23, // 19: protos.opts.ReadOptions.gcp_pubsub:type_name -> protos.opts.ReadGroupGCPPubSubOptions + 24, // 20: protos.opts.ReadOptions.kubemq_queue:type_name -> protos.opts.ReadGroupKubeMQQueueOptions + 18, // 21: protos.opts.ReadOptions.redis_pubsub:type_name -> protos.opts.ReadGroupRedisPubSubOptions + 19, // 22: protos.opts.ReadOptions.redis_streams:type_name -> protos.opts.ReadGroupRedisStreamsOptions + 14, // 23: protos.opts.ReadOptions.postgres:type_name -> protos.opts.ReadGroupPostgresOptions + 12, // 24: protos.opts.ReadOptions.nats_jetstream:type_name -> protos.opts.ReadGroupNatsJetstreamOptions + 25, // 25: protos.opts.ReadOptions.aws_kinesis:type_name -> protos.opts.ReadGroupAWSKinesisOptions + 26, // 26: protos.opts.ReadOptions.memphis:type_name -> protos.opts.ReadGroupMemphisOptions + 29, // 27: protos.opts.ReadGroupKafkaOptions._conn:type_name -> protos.args.KafkaConn + 30, // 28: protos.opts.ReadGroupKafkaOptions.args:type_name -> protos.args.KafkaReadArgs + 31, // 29: protos.opts.ReadGroupActiveMQOptions._conn:type_name -> protos.args.ActiveMQConn + 32, // 30: protos.opts.ReadGroupActiveMQOptions.args:type_name -> protos.args.ActiveMQReadArgs + 33, // 31: protos.opts.ReadGroupAWSSQSOptions._conn:type_name -> protos.args.AWSSQSConn + 34, // 32: protos.opts.ReadGroupAWSSQSOptions.args:type_name -> protos.args.AWSSQSReadArgs + 35, // 33: protos.opts.ReadGroupMongoOptions._conn:type_name -> protos.args.MongoConn + 36, // 34: protos.opts.ReadGroupMongoOptions.args:type_name -> protos.args.MongoReadArgs + 37, // 35: protos.opts.ReadGroupNatsOptions._conn:type_name -> protos.args.NatsConn + 38, // 36: protos.opts.ReadGroupNatsOptions.args:type_name -> protos.args.NatsReadArgs + 39, // 37: protos.opts.ReadGroupNatsStreamingOptions._conn:type_name -> protos.args.NatsStreamingConn + 40, // 38: protos.opts.ReadGroupNatsStreamingOptions.args:type_name -> protos.args.NatsStreamingReadArgs + 41, // 39: protos.opts.ReadGroupNatsJetstreamOptions._conn:type_name -> protos.args.NatsJetstreamConn + 42, // 40: protos.opts.ReadGroupNatsJetstreamOptions.args:type_name -> protos.args.NatsJetstreamReadArgs + 43, // 41: protos.opts.ReadGroupNSQOptions._conn:type_name -> protos.args.NSQConn + 44, // 42: protos.opts.ReadGroupNSQOptions.args:type_name -> protos.args.NSQReadArgs + 45, // 43: protos.opts.ReadGroupPostgresOptions._conn:type_name -> protos.args.PostgresConn + 46, // 44: protos.opts.ReadGroupPostgresOptions.args:type_name -> protos.args.PostgresReadArgs + 47, // 45: protos.opts.ReadGroupPulsarOptions._conn:type_name -> protos.args.PulsarConn + 48, // 46: protos.opts.ReadGroupPulsarOptions.args:type_name -> protos.args.PulsarReadArgs + 49, // 47: protos.opts.ReadGroupRabbitOptions._conn:type_name -> protos.args.RabbitConn + 50, // 48: protos.opts.ReadGroupRabbitOptions.args:type_name -> protos.args.RabbitReadArgs + 51, // 49: protos.opts.ReadGroupRabbitStreamsOptions._conn:type_name -> protos.args.RabbitStreamsConn + 52, // 50: protos.opts.ReadGroupRabbitStreamsOptions.args:type_name -> protos.args.RabbitStreamsReadArgs + 53, // 51: protos.opts.ReadGroupRedisPubSubOptions._conn:type_name -> protos.args.RedisPubSubConn + 54, // 52: protos.opts.ReadGroupRedisPubSubOptions.args:type_name -> protos.args.RedisPubSubReadArgs + 55, // 53: protos.opts.ReadGroupRedisStreamsOptions._conn:type_name -> protos.args.RedisStreamsConn + 56, // 54: protos.opts.ReadGroupRedisStreamsOptions.args:type_name -> protos.args.RedisStreamsReadArgs + 57, // 55: protos.opts.ReadGroupAzureEventHubOptions._conn:type_name -> protos.args.AzureEventHubConn + 58, // 56: protos.opts.ReadGroupAzureEventHubOptions.args:type_name -> protos.args.AzureEventHubReadArgs + 59, // 57: protos.opts.ReadGroupAzureServiceBusOptions._conn:type_name -> protos.args.AzureServiceBusConn + 60, // 58: protos.opts.ReadGroupAzureServiceBusOptions.args:type_name -> protos.args.AzureServiceBusReadArgs + 61, // 59: protos.opts.ReadGroupMQTTOptions._conn:type_name -> protos.args.MQTTConn + 62, // 60: protos.opts.ReadGroupMQTTOptions.args:type_name -> protos.args.MQTTReadArgs + 63, // 61: protos.opts.ReadGroupGCPPubSubOptions._conn:type_name -> protos.args.GCPPubSubConn + 64, // 62: protos.opts.ReadGroupGCPPubSubOptions.args:type_name -> protos.args.GCPPubSubReadArgs + 65, // 63: protos.opts.ReadGroupKubeMQQueueOptions._conn:type_name -> protos.args.KubeMQQueueConn + 66, // 64: protos.opts.ReadGroupKubeMQQueueOptions.args:type_name -> protos.args.KubeMQQueueReadArgs + 67, // 65: protos.opts.ReadGroupAWSKinesisOptions._conn:type_name -> protos.args.AWSKinesisConn + 68, // 66: protos.opts.ReadGroupAWSKinesisOptions.args:type_name -> protos.args.AWSKinesisReadArgs + 69, // 67: protos.opts.ReadGroupMemphisOptions._conn:type_name -> protos.args.MemphisConn + 70, // 68: protos.opts.ReadGroupMemphisOptions.args:type_name -> protos.args.MemphisReadArgs + 1, // 69: protos.opts.InferSchemaOptions.type:type_name -> protos.opts.InferSchemaOptions.Type + 70, // [70:70] is the sub-list for method output_type + 70, // [70:70] is the sub-list for method input_type + 70, // [70:70] is the sub-list for extension type_name + 70, // [70:70] is the sub-list for extension extendee + 0, // [0:70] is the sub-list for field type_name +} + +func init() { file_opts_ps_opts_read_proto_init() } +func file_opts_ps_opts_read_proto_init() { + if File_opts_ps_opts_read_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_opts_ps_opts_read_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadCLIOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadSampleOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadFilterOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadGroupKafkaOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadGroupActiveMQOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadGroupAWSSQSOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadGroupMongoOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadGroupNatsOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadGroupNatsStreamingOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadGroupNatsJetstreamOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadGroupNSQOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadGroupPostgresOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadGroupPulsarOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadGroupRabbitOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadGroupRabbitStreamsOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadGroupRedisPubSubOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadGroupRedisStreamsOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadGroupAzureEventHubOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadGroupAzureServiceBusOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadGroupMQTTOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadGroupGCPPubSubOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadGroupKubeMQQueueOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadGroupAWSKinesisOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadGroupMemphisOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_read_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InferSchemaOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_opts_ps_opts_read_proto_rawDesc, + NumEnums: 2, + NumMessages: 26, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_opts_ps_opts_read_proto_goTypes, + DependencyIndexes: file_opts_ps_opts_read_proto_depIdxs, + EnumInfos: file_opts_ps_opts_read_proto_enumTypes, + MessageInfos: file_opts_ps_opts_read_proto_msgTypes, + }.Build() + File_opts_ps_opts_read_proto = out.File + file_opts_ps_opts_read_proto_rawDesc = nil + file_opts_ps_opts_read_proto_goTypes = nil + file_opts_ps_opts_read_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_relay.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_relay.pb.go index 372864668..ac4b60435 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_relay.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_relay.pb.go @@ -1,62 +1,70 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: opts/ps_opts_relay.proto package opts import ( - fmt "fmt" args "github.com/batchcorp/plumber-schemas/build/go/protos/args" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type RelayCLIOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='What address to bind the built-in HTTP server to',env='PLUMBER_RELAY_HTTP_LISTEN_ADDRESS',default='localhost:9191'" - HttpListenAddress string `protobuf:"bytes,1,opt,name=http_listen_address,json=httpListenAddress,proto3" json:"http_listen_address,omitempty" kong:"help='What address to bind the built-in HTTP server to',env='PLUMBER_RELAY_HTTP_LISTEN_ADDRESS',default='localhost:9191'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + HttpListenAddress string `protobuf:"bytes,1,opt,name=http_listen_address,json=httpListenAddress,proto3" json:"http_listen_address,omitempty" kong:"help='What address to bind the built-in HTTP server to',env='PLUMBER_RELAY_HTTP_LISTEN_ADDRESS',default='localhost:9191'"` } -func (m *RelayCLIOptions) Reset() { *m = RelayCLIOptions{} } -func (m *RelayCLIOptions) String() string { return proto.CompactTextString(m) } -func (*RelayCLIOptions) ProtoMessage() {} -func (*RelayCLIOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_8864927d5e1ac547, []int{0} +func (x *RelayCLIOptions) Reset() { + *x = RelayCLIOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_relay_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RelayCLIOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RelayCLIOptions.Unmarshal(m, b) -} -func (m *RelayCLIOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RelayCLIOptions.Marshal(b, m, deterministic) -} -func (m *RelayCLIOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_RelayCLIOptions.Merge(m, src) +func (x *RelayCLIOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RelayCLIOptions) XXX_Size() int { - return xxx_messageInfo_RelayCLIOptions.Size(m) -} -func (m *RelayCLIOptions) XXX_DiscardUnknown() { - xxx_messageInfo_RelayCLIOptions.DiscardUnknown(m) + +func (*RelayCLIOptions) ProtoMessage() {} + +func (x *RelayCLIOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_relay_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RelayCLIOptions proto.InternalMessageInfo +// Deprecated: Use RelayCLIOptions.ProtoReflect.Descriptor instead. +func (*RelayCLIOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_relay_proto_rawDescGZIP(), []int{0} +} -func (m *RelayCLIOptions) GetHttpListenAddress() string { - if m != nil { - return m.HttpListenAddress +func (x *RelayCLIOptions) GetHttpListenAddress() string { + if x != nil { + return x.HttpListenAddress } return "" } @@ -64,6 +72,10 @@ func (m *RelayCLIOptions) GetHttpListenAddress() string { // Relay is the structure that backends accept for facilitating a relay. // NOTE: _conn is only used by the CLI - desktop does not need to set it. type RelayOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Secret collection token',env='PLUMBER_RELAY_TOKEN',name=token,required" CollectionToken string `protobuf:"bytes,1,opt,name=collection_token,json=collectionToken,proto3" json:"collection_token,omitempty" kong:"help='Secret collection token',env='PLUMBER_RELAY_TOKEN',name=token,required"` // @gotags: kong:"help='How many messages to send in a single batch',env='PLUMBER_RELAY_BATCH_SIZE',default=1000" @@ -81,6 +93,8 @@ type RelayOptions struct { StatsReportIntervalSec int32 `protobuf:"varint,7,opt,name=stats_report_interval_sec,json=statsReportIntervalSec,proto3" json:"stats_report_interval_sec,omitempty" kong:"group=stats,help='How often to print stats',default=5"` // @gotags: kong:"help='Consumed messages are intended to be dead-lettered',env='PLUMBER_RELAY_DEAD_LETTER'" DeadLetter bool `protobuf:"varint,8,opt,name=dead_letter,json=deadLetter,proto3" json:"dead_letter,omitempty" kong:"help='Consumed messages are intended to be dead-lettered',env='PLUMBER_RELAY_DEAD_LETTER'"` + // @gotags: kong:"embed" + StreamdalIntegrationOptions *StreamdalIntegrationOptions `protobuf:"bytes,9,opt,name=streamdal_integration_options,json=streamdalIntegrationOptions,proto3" json:"streamdal_integration_options,omitempty" kong:"embed"` // @gotags: kong:"help='Alternative collector to relay events to',name='grpc-address',env='PLUMBER_RELAY_GRPC_ADDRESS',default='grpc-collector.streamdal.com:9000'" XStreamdalGrpcAddress string `protobuf:"bytes,1000,opt,name=_streamdal_grpc_address,json=StreamdalGrpcAddress,proto3" json:"_streamdal_grpc_address,omitempty" kong:"help='Alternative collector to relay events to',name='grpc-address',env='PLUMBER_RELAY_GRPC_ADDRESS',default='grpc-collector.streamdal.com:9000'"` // @gotags: kong:"help='Whether to use TLS with collector',name=grpc-disable-tls,env='PLUMBER_RELAY_GRPC_DISABLE_TLS',default=false" @@ -124,1080 +138,1732 @@ type RelayOptions struct { // @gotags: kong:"cmd,help='NATS Streaming'" NatsStreaming *RelayGroupNatsStreamingOptions `protobuf:"bytes,114,opt,name=nats_streaming,json=natsStreaming,proto3" json:"nats_streaming,omitempty" kong:"cmd,help='NATS Streaming'"` // @gotags: kong:"cmd,help='NATS JetStream'" - NatsJetstream *RelayGroupNatsJetStreamOptions `protobuf:"bytes,115,opt,name=nats_jetstream,json=natsJetstream,proto3" json:"nats_jetstream,omitempty" kong:"cmd,help='NATS JetStream'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + NatsJetstream *RelayGroupNatsJetStreamOptions `protobuf:"bytes,115,opt,name=nats_jetstream,json=natsJetstream,proto3" json:"nats_jetstream,omitempty" kong:"cmd,help='NATS JetStream'"` } -func (m *RelayOptions) Reset() { *m = RelayOptions{} } -func (m *RelayOptions) String() string { return proto.CompactTextString(m) } -func (*RelayOptions) ProtoMessage() {} -func (*RelayOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_8864927d5e1ac547, []int{1} +func (x *RelayOptions) Reset() { + *x = RelayOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_relay_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RelayOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RelayOptions.Unmarshal(m, b) -} -func (m *RelayOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RelayOptions.Marshal(b, m, deterministic) -} -func (m *RelayOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_RelayOptions.Merge(m, src) +func (x *RelayOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RelayOptions) XXX_Size() int { - return xxx_messageInfo_RelayOptions.Size(m) -} -func (m *RelayOptions) XXX_DiscardUnknown() { - xxx_messageInfo_RelayOptions.DiscardUnknown(m) + +func (*RelayOptions) ProtoMessage() {} + +func (x *RelayOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_relay_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RelayOptions proto.InternalMessageInfo +// Deprecated: Use RelayOptions.ProtoReflect.Descriptor instead. +func (*RelayOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_relay_proto_rawDescGZIP(), []int{1} +} -func (m *RelayOptions) GetCollectionToken() string { - if m != nil { - return m.CollectionToken +func (x *RelayOptions) GetCollectionToken() string { + if x != nil { + return x.CollectionToken } return "" } -func (m *RelayOptions) GetBatchSize() int32 { - if m != nil { - return m.BatchSize +func (x *RelayOptions) GetBatchSize() int32 { + if x != nil { + return x.BatchSize } return 0 } -func (m *RelayOptions) GetBatchMaxRetry() int32 { - if m != nil { - return m.BatchMaxRetry +func (x *RelayOptions) GetBatchMaxRetry() int32 { + if x != nil { + return x.BatchMaxRetry } return 0 } -func (m *RelayOptions) GetConnectionId() string { - if m != nil { - return m.ConnectionId +func (x *RelayOptions) GetConnectionId() string { + if x != nil { + return x.ConnectionId } return "" } -func (m *RelayOptions) GetNumWorkers() int32 { - if m != nil { - return m.NumWorkers +func (x *RelayOptions) GetNumWorkers() int32 { + if x != nil { + return x.NumWorkers } return 0 } -func (m *RelayOptions) GetStatsEnable() bool { - if m != nil { - return m.StatsEnable +func (x *RelayOptions) GetStatsEnable() bool { + if x != nil { + return x.StatsEnable } return false } -func (m *RelayOptions) GetStatsReportIntervalSec() int32 { - if m != nil { - return m.StatsReportIntervalSec +func (x *RelayOptions) GetStatsReportIntervalSec() int32 { + if x != nil { + return x.StatsReportIntervalSec } return 0 } -func (m *RelayOptions) GetDeadLetter() bool { - if m != nil { - return m.DeadLetter +func (x *RelayOptions) GetDeadLetter() bool { + if x != nil { + return x.DeadLetter } return false } -func (m *RelayOptions) GetXStreamdalGrpcAddress() string { - if m != nil { - return m.XStreamdalGrpcAddress +func (x *RelayOptions) GetStreamdalIntegrationOptions() *StreamdalIntegrationOptions { + if x != nil { + return x.StreamdalIntegrationOptions + } + return nil +} + +func (x *RelayOptions) GetXStreamdalGrpcAddress() string { + if x != nil { + return x.XStreamdalGrpcAddress } return "" } -func (m *RelayOptions) GetXStreamdalGrpcDisableTls() bool { - if m != nil { - return m.XStreamdalGrpcDisableTls +func (x *RelayOptions) GetXStreamdalGrpcDisableTls() bool { + if x != nil { + return x.XStreamdalGrpcDisableTls } return false } -func (m *RelayOptions) GetXStreamdalGrpcTimeoutSeconds() int32 { - if m != nil { - return m.XStreamdalGrpcTimeoutSeconds +func (x *RelayOptions) GetXStreamdalGrpcTimeoutSeconds() int32 { + if x != nil { + return x.XStreamdalGrpcTimeoutSeconds } return 0 } -func (m *RelayOptions) GetXRelayId() string { - if m != nil { - return m.XRelayId +func (x *RelayOptions) GetXRelayId() string { + if x != nil { + return x.XRelayId } return "" } -func (m *RelayOptions) GetXCliOptions() *RelayCLIOptions { - if m != nil { - return m.XCliOptions +func (x *RelayOptions) GetXCliOptions() *RelayCLIOptions { + if x != nil { + return x.XCliOptions } return nil } -func (m *RelayOptions) GetXActive() bool { - if m != nil { - return m.XActive +func (x *RelayOptions) GetXActive() bool { + if x != nil { + return x.XActive } return false } -func (m *RelayOptions) GetKafka() *RelayGroupKafkaOptions { - if m != nil { - return m.Kafka +func (x *RelayOptions) GetKafka() *RelayGroupKafkaOptions { + if x != nil { + return x.Kafka } return nil } -func (m *RelayOptions) GetAwsSqs() *RelayGroupAWSSQSOptions { - if m != nil { - return m.AwsSqs +func (x *RelayOptions) GetAwsSqs() *RelayGroupAWSSQSOptions { + if x != nil { + return x.AwsSqs } return nil } -func (m *RelayOptions) GetMongo() *RelayGroupMongoOptions { - if m != nil { - return m.Mongo +func (x *RelayOptions) GetMongo() *RelayGroupMongoOptions { + if x != nil { + return x.Mongo } return nil } -func (m *RelayOptions) GetNsq() *RelayGroupNSQOptions { - if m != nil { - return m.Nsq +func (x *RelayOptions) GetNsq() *RelayGroupNSQOptions { + if x != nil { + return x.Nsq } return nil } -func (m *RelayOptions) GetRabbit() *RelayGroupRabbitOptions { - if m != nil { - return m.Rabbit +func (x *RelayOptions) GetRabbit() *RelayGroupRabbitOptions { + if x != nil { + return x.Rabbit } return nil } -func (m *RelayOptions) GetMqtt() *RelayGroupMQTTOptions { - if m != nil { - return m.Mqtt +func (x *RelayOptions) GetMqtt() *RelayGroupMQTTOptions { + if x != nil { + return x.Mqtt } return nil } -func (m *RelayOptions) GetAzureServiceBus() *RelayGroupAzureServiceBusOptions { - if m != nil { - return m.AzureServiceBus +func (x *RelayOptions) GetAzureServiceBus() *RelayGroupAzureServiceBusOptions { + if x != nil { + return x.AzureServiceBus } return nil } -func (m *RelayOptions) GetGcpPubsub() *RelayGroupGCPPubSubOptions { - if m != nil { - return m.GcpPubsub +func (x *RelayOptions) GetGcpPubsub() *RelayGroupGCPPubSubOptions { + if x != nil { + return x.GcpPubsub } return nil } -func (m *RelayOptions) GetKubemqQueue() *RelayGroupKubeMQQueueOptions { - if m != nil { - return m.KubemqQueue +func (x *RelayOptions) GetKubemqQueue() *RelayGroupKubeMQQueueOptions { + if x != nil { + return x.KubemqQueue } return nil } -func (m *RelayOptions) GetRedisPubsub() *RelayGroupRedisPubSubOptions { - if m != nil { - return m.RedisPubsub +func (x *RelayOptions) GetRedisPubsub() *RelayGroupRedisPubSubOptions { + if x != nil { + return x.RedisPubsub } return nil } -func (m *RelayOptions) GetRedisStreams() *RelayGroupRedisStreamsOptions { - if m != nil { - return m.RedisStreams +func (x *RelayOptions) GetRedisStreams() *RelayGroupRedisStreamsOptions { + if x != nil { + return x.RedisStreams } return nil } -func (m *RelayOptions) GetPostgres() *RelayGroupPostgresOptions { - if m != nil { - return m.Postgres +func (x *RelayOptions) GetPostgres() *RelayGroupPostgresOptions { + if x != nil { + return x.Postgres } return nil } -func (m *RelayOptions) GetNats() *RelayGroupNatsOptions { - if m != nil { - return m.Nats +func (x *RelayOptions) GetNats() *RelayGroupNatsOptions { + if x != nil { + return x.Nats } return nil } -func (m *RelayOptions) GetNatsStreaming() *RelayGroupNatsStreamingOptions { - if m != nil { - return m.NatsStreaming +func (x *RelayOptions) GetNatsStreaming() *RelayGroupNatsStreamingOptions { + if x != nil { + return x.NatsStreaming } return nil } -func (m *RelayOptions) GetNatsJetstream() *RelayGroupNatsJetStreamOptions { - if m != nil { - return m.NatsJetstream +func (x *RelayOptions) GetNatsJetstream() *RelayGroupNatsJetStreamOptions { + if x != nil { + return x.NatsJetstream } return nil } type RelayGroupKafkaOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.KafkaConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.KafkaRelayArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.KafkaRelayArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *RelayGroupKafkaOptions) Reset() { *m = RelayGroupKafkaOptions{} } -func (m *RelayGroupKafkaOptions) String() string { return proto.CompactTextString(m) } -func (*RelayGroupKafkaOptions) ProtoMessage() {} -func (*RelayGroupKafkaOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_8864927d5e1ac547, []int{2} +func (x *RelayGroupKafkaOptions) Reset() { + *x = RelayGroupKafkaOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_relay_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RelayGroupKafkaOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RelayGroupKafkaOptions.Unmarshal(m, b) +func (x *RelayGroupKafkaOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RelayGroupKafkaOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RelayGroupKafkaOptions.Marshal(b, m, deterministic) -} -func (m *RelayGroupKafkaOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_RelayGroupKafkaOptions.Merge(m, src) -} -func (m *RelayGroupKafkaOptions) XXX_Size() int { - return xxx_messageInfo_RelayGroupKafkaOptions.Size(m) -} -func (m *RelayGroupKafkaOptions) XXX_DiscardUnknown() { - xxx_messageInfo_RelayGroupKafkaOptions.DiscardUnknown(m) + +func (*RelayGroupKafkaOptions) ProtoMessage() {} + +func (x *RelayGroupKafkaOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_relay_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RelayGroupKafkaOptions proto.InternalMessageInfo +// Deprecated: Use RelayGroupKafkaOptions.ProtoReflect.Descriptor instead. +func (*RelayGroupKafkaOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_relay_proto_rawDescGZIP(), []int{2} +} -func (m *RelayGroupKafkaOptions) GetXConn() *args.KafkaConn { - if m != nil { - return m.XConn +func (x *RelayGroupKafkaOptions) GetXConn() *args.KafkaConn { + if x != nil { + return x.XConn } return nil } -func (m *RelayGroupKafkaOptions) GetArgs() *args.KafkaRelayArgs { - if m != nil { - return m.Args +func (x *RelayGroupKafkaOptions) GetArgs() *args.KafkaRelayArgs { + if x != nil { + return x.Args } return nil } type RelayGroupAWSSQSOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.AWSSQSConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.AWSSQSRelayArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.AWSSQSRelayArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *RelayGroupAWSSQSOptions) Reset() { *m = RelayGroupAWSSQSOptions{} } -func (m *RelayGroupAWSSQSOptions) String() string { return proto.CompactTextString(m) } -func (*RelayGroupAWSSQSOptions) ProtoMessage() {} -func (*RelayGroupAWSSQSOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_8864927d5e1ac547, []int{3} +func (x *RelayGroupAWSSQSOptions) Reset() { + *x = RelayGroupAWSSQSOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_relay_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RelayGroupAWSSQSOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RelayGroupAWSSQSOptions.Unmarshal(m, b) -} -func (m *RelayGroupAWSSQSOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RelayGroupAWSSQSOptions.Marshal(b, m, deterministic) +func (x *RelayGroupAWSSQSOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RelayGroupAWSSQSOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_RelayGroupAWSSQSOptions.Merge(m, src) -} -func (m *RelayGroupAWSSQSOptions) XXX_Size() int { - return xxx_messageInfo_RelayGroupAWSSQSOptions.Size(m) -} -func (m *RelayGroupAWSSQSOptions) XXX_DiscardUnknown() { - xxx_messageInfo_RelayGroupAWSSQSOptions.DiscardUnknown(m) + +func (*RelayGroupAWSSQSOptions) ProtoMessage() {} + +func (x *RelayGroupAWSSQSOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_relay_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RelayGroupAWSSQSOptions proto.InternalMessageInfo +// Deprecated: Use RelayGroupAWSSQSOptions.ProtoReflect.Descriptor instead. +func (*RelayGroupAWSSQSOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_relay_proto_rawDescGZIP(), []int{3} +} -func (m *RelayGroupAWSSQSOptions) GetXConn() *args.AWSSQSConn { - if m != nil { - return m.XConn +func (x *RelayGroupAWSSQSOptions) GetXConn() *args.AWSSQSConn { + if x != nil { + return x.XConn } return nil } -func (m *RelayGroupAWSSQSOptions) GetArgs() *args.AWSSQSRelayArgs { - if m != nil { - return m.Args +func (x *RelayGroupAWSSQSOptions) GetArgs() *args.AWSSQSRelayArgs { + if x != nil { + return x.Args } return nil } type RelayGroupMongoOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.MongoConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.MongoReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.MongoReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *RelayGroupMongoOptions) Reset() { *m = RelayGroupMongoOptions{} } -func (m *RelayGroupMongoOptions) String() string { return proto.CompactTextString(m) } -func (*RelayGroupMongoOptions) ProtoMessage() {} -func (*RelayGroupMongoOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_8864927d5e1ac547, []int{4} +func (x *RelayGroupMongoOptions) Reset() { + *x = RelayGroupMongoOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_relay_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RelayGroupMongoOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RelayGroupMongoOptions.Unmarshal(m, b) -} -func (m *RelayGroupMongoOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RelayGroupMongoOptions.Marshal(b, m, deterministic) -} -func (m *RelayGroupMongoOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_RelayGroupMongoOptions.Merge(m, src) -} -func (m *RelayGroupMongoOptions) XXX_Size() int { - return xxx_messageInfo_RelayGroupMongoOptions.Size(m) +func (x *RelayGroupMongoOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RelayGroupMongoOptions) XXX_DiscardUnknown() { - xxx_messageInfo_RelayGroupMongoOptions.DiscardUnknown(m) + +func (*RelayGroupMongoOptions) ProtoMessage() {} + +func (x *RelayGroupMongoOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_relay_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RelayGroupMongoOptions proto.InternalMessageInfo +// Deprecated: Use RelayGroupMongoOptions.ProtoReflect.Descriptor instead. +func (*RelayGroupMongoOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_relay_proto_rawDescGZIP(), []int{4} +} -func (m *RelayGroupMongoOptions) GetXConn() *args.MongoConn { - if m != nil { - return m.XConn +func (x *RelayGroupMongoOptions) GetXConn() *args.MongoConn { + if x != nil { + return x.XConn } return nil } -func (m *RelayGroupMongoOptions) GetArgs() *args.MongoReadArgs { - if m != nil { - return m.Args +func (x *RelayGroupMongoOptions) GetArgs() *args.MongoReadArgs { + if x != nil { + return x.Args } return nil } type RelayGroupNSQOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.NSQConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.NSQReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.NSQReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *RelayGroupNSQOptions) Reset() { *m = RelayGroupNSQOptions{} } -func (m *RelayGroupNSQOptions) String() string { return proto.CompactTextString(m) } -func (*RelayGroupNSQOptions) ProtoMessage() {} -func (*RelayGroupNSQOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_8864927d5e1ac547, []int{5} +func (x *RelayGroupNSQOptions) Reset() { + *x = RelayGroupNSQOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_relay_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RelayGroupNSQOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RelayGroupNSQOptions.Unmarshal(m, b) -} -func (m *RelayGroupNSQOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RelayGroupNSQOptions.Marshal(b, m, deterministic) +func (x *RelayGroupNSQOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RelayGroupNSQOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_RelayGroupNSQOptions.Merge(m, src) -} -func (m *RelayGroupNSQOptions) XXX_Size() int { - return xxx_messageInfo_RelayGroupNSQOptions.Size(m) -} -func (m *RelayGroupNSQOptions) XXX_DiscardUnknown() { - xxx_messageInfo_RelayGroupNSQOptions.DiscardUnknown(m) + +func (*RelayGroupNSQOptions) ProtoMessage() {} + +func (x *RelayGroupNSQOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_relay_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RelayGroupNSQOptions proto.InternalMessageInfo +// Deprecated: Use RelayGroupNSQOptions.ProtoReflect.Descriptor instead. +func (*RelayGroupNSQOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_relay_proto_rawDescGZIP(), []int{5} +} -func (m *RelayGroupNSQOptions) GetXConn() *args.NSQConn { - if m != nil { - return m.XConn +func (x *RelayGroupNSQOptions) GetXConn() *args.NSQConn { + if x != nil { + return x.XConn } return nil } -func (m *RelayGroupNSQOptions) GetArgs() *args.NSQReadArgs { - if m != nil { - return m.Args +func (x *RelayGroupNSQOptions) GetArgs() *args.NSQReadArgs { + if x != nil { + return x.Args } return nil } type RelayGroupPostgresOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.PostgresConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.PostgresReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.PostgresReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *RelayGroupPostgresOptions) Reset() { *m = RelayGroupPostgresOptions{} } -func (m *RelayGroupPostgresOptions) String() string { return proto.CompactTextString(m) } -func (*RelayGroupPostgresOptions) ProtoMessage() {} -func (*RelayGroupPostgresOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_8864927d5e1ac547, []int{6} +func (x *RelayGroupPostgresOptions) Reset() { + *x = RelayGroupPostgresOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_relay_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RelayGroupPostgresOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RelayGroupPostgresOptions.Unmarshal(m, b) -} -func (m *RelayGroupPostgresOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RelayGroupPostgresOptions.Marshal(b, m, deterministic) -} -func (m *RelayGroupPostgresOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_RelayGroupPostgresOptions.Merge(m, src) +func (x *RelayGroupPostgresOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RelayGroupPostgresOptions) XXX_Size() int { - return xxx_messageInfo_RelayGroupPostgresOptions.Size(m) -} -func (m *RelayGroupPostgresOptions) XXX_DiscardUnknown() { - xxx_messageInfo_RelayGroupPostgresOptions.DiscardUnknown(m) + +func (*RelayGroupPostgresOptions) ProtoMessage() {} + +func (x *RelayGroupPostgresOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_relay_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RelayGroupPostgresOptions proto.InternalMessageInfo +// Deprecated: Use RelayGroupPostgresOptions.ProtoReflect.Descriptor instead. +func (*RelayGroupPostgresOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_relay_proto_rawDescGZIP(), []int{6} +} -func (m *RelayGroupPostgresOptions) GetXConn() *args.PostgresConn { - if m != nil { - return m.XConn +func (x *RelayGroupPostgresOptions) GetXConn() *args.PostgresConn { + if x != nil { + return x.XConn } return nil } -func (m *RelayGroupPostgresOptions) GetArgs() *args.PostgresReadArgs { - if m != nil { - return m.Args +func (x *RelayGroupPostgresOptions) GetArgs() *args.PostgresReadArgs { + if x != nil { + return x.Args } return nil } type RelayGroupRabbitOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.RabbitConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.RabbitReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.RabbitReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *RelayGroupRabbitOptions) Reset() { *m = RelayGroupRabbitOptions{} } -func (m *RelayGroupRabbitOptions) String() string { return proto.CompactTextString(m) } -func (*RelayGroupRabbitOptions) ProtoMessage() {} -func (*RelayGroupRabbitOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_8864927d5e1ac547, []int{7} +func (x *RelayGroupRabbitOptions) Reset() { + *x = RelayGroupRabbitOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_relay_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RelayGroupRabbitOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RelayGroupRabbitOptions.Unmarshal(m, b) +func (x *RelayGroupRabbitOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RelayGroupRabbitOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RelayGroupRabbitOptions.Marshal(b, m, deterministic) -} -func (m *RelayGroupRabbitOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_RelayGroupRabbitOptions.Merge(m, src) -} -func (m *RelayGroupRabbitOptions) XXX_Size() int { - return xxx_messageInfo_RelayGroupRabbitOptions.Size(m) -} -func (m *RelayGroupRabbitOptions) XXX_DiscardUnknown() { - xxx_messageInfo_RelayGroupRabbitOptions.DiscardUnknown(m) + +func (*RelayGroupRabbitOptions) ProtoMessage() {} + +func (x *RelayGroupRabbitOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_relay_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RelayGroupRabbitOptions proto.InternalMessageInfo +// Deprecated: Use RelayGroupRabbitOptions.ProtoReflect.Descriptor instead. +func (*RelayGroupRabbitOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_relay_proto_rawDescGZIP(), []int{7} +} -func (m *RelayGroupRabbitOptions) GetXConn() *args.RabbitConn { - if m != nil { - return m.XConn +func (x *RelayGroupRabbitOptions) GetXConn() *args.RabbitConn { + if x != nil { + return x.XConn } return nil } -func (m *RelayGroupRabbitOptions) GetArgs() *args.RabbitReadArgs { - if m != nil { - return m.Args +func (x *RelayGroupRabbitOptions) GetArgs() *args.RabbitReadArgs { + if x != nil { + return x.Args } return nil } type RelayGroupRedisPubSubOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.RedisPubSubConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.RedisPubSubReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.RedisPubSubReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *RelayGroupRedisPubSubOptions) Reset() { *m = RelayGroupRedisPubSubOptions{} } -func (m *RelayGroupRedisPubSubOptions) String() string { return proto.CompactTextString(m) } -func (*RelayGroupRedisPubSubOptions) ProtoMessage() {} -func (*RelayGroupRedisPubSubOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_8864927d5e1ac547, []int{8} +func (x *RelayGroupRedisPubSubOptions) Reset() { + *x = RelayGroupRedisPubSubOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_relay_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RelayGroupRedisPubSubOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RelayGroupRedisPubSubOptions.Unmarshal(m, b) -} -func (m *RelayGroupRedisPubSubOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RelayGroupRedisPubSubOptions.Marshal(b, m, deterministic) +func (x *RelayGroupRedisPubSubOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RelayGroupRedisPubSubOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_RelayGroupRedisPubSubOptions.Merge(m, src) -} -func (m *RelayGroupRedisPubSubOptions) XXX_Size() int { - return xxx_messageInfo_RelayGroupRedisPubSubOptions.Size(m) -} -func (m *RelayGroupRedisPubSubOptions) XXX_DiscardUnknown() { - xxx_messageInfo_RelayGroupRedisPubSubOptions.DiscardUnknown(m) + +func (*RelayGroupRedisPubSubOptions) ProtoMessage() {} + +func (x *RelayGroupRedisPubSubOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_relay_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RelayGroupRedisPubSubOptions proto.InternalMessageInfo +// Deprecated: Use RelayGroupRedisPubSubOptions.ProtoReflect.Descriptor instead. +func (*RelayGroupRedisPubSubOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_relay_proto_rawDescGZIP(), []int{8} +} -func (m *RelayGroupRedisPubSubOptions) GetXConn() *args.RedisPubSubConn { - if m != nil { - return m.XConn +func (x *RelayGroupRedisPubSubOptions) GetXConn() *args.RedisPubSubConn { + if x != nil { + return x.XConn } return nil } -func (m *RelayGroupRedisPubSubOptions) GetArgs() *args.RedisPubSubReadArgs { - if m != nil { - return m.Args +func (x *RelayGroupRedisPubSubOptions) GetArgs() *args.RedisPubSubReadArgs { + if x != nil { + return x.Args } return nil } type RelayGroupRedisStreamsOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.RedisStreamsConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.RedisStreamsReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.RedisStreamsReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *RelayGroupRedisStreamsOptions) Reset() { *m = RelayGroupRedisStreamsOptions{} } -func (m *RelayGroupRedisStreamsOptions) String() string { return proto.CompactTextString(m) } -func (*RelayGroupRedisStreamsOptions) ProtoMessage() {} -func (*RelayGroupRedisStreamsOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_8864927d5e1ac547, []int{9} +func (x *RelayGroupRedisStreamsOptions) Reset() { + *x = RelayGroupRedisStreamsOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_relay_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RelayGroupRedisStreamsOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RelayGroupRedisStreamsOptions.Unmarshal(m, b) -} -func (m *RelayGroupRedisStreamsOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RelayGroupRedisStreamsOptions.Marshal(b, m, deterministic) -} -func (m *RelayGroupRedisStreamsOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_RelayGroupRedisStreamsOptions.Merge(m, src) -} -func (m *RelayGroupRedisStreamsOptions) XXX_Size() int { - return xxx_messageInfo_RelayGroupRedisStreamsOptions.Size(m) +func (x *RelayGroupRedisStreamsOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RelayGroupRedisStreamsOptions) XXX_DiscardUnknown() { - xxx_messageInfo_RelayGroupRedisStreamsOptions.DiscardUnknown(m) + +func (*RelayGroupRedisStreamsOptions) ProtoMessage() {} + +func (x *RelayGroupRedisStreamsOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_relay_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RelayGroupRedisStreamsOptions proto.InternalMessageInfo +// Deprecated: Use RelayGroupRedisStreamsOptions.ProtoReflect.Descriptor instead. +func (*RelayGroupRedisStreamsOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_relay_proto_rawDescGZIP(), []int{9} +} -func (m *RelayGroupRedisStreamsOptions) GetXConn() *args.RedisStreamsConn { - if m != nil { - return m.XConn +func (x *RelayGroupRedisStreamsOptions) GetXConn() *args.RedisStreamsConn { + if x != nil { + return x.XConn } return nil } -func (m *RelayGroupRedisStreamsOptions) GetArgs() *args.RedisStreamsReadArgs { - if m != nil { - return m.Args +func (x *RelayGroupRedisStreamsOptions) GetArgs() *args.RedisStreamsReadArgs { + if x != nil { + return x.Args } return nil } type RelayGroupAzureServiceBusOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.AzureServiceBusConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.AzureServiceBusReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.AzureServiceBusReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *RelayGroupAzureServiceBusOptions) Reset() { *m = RelayGroupAzureServiceBusOptions{} } -func (m *RelayGroupAzureServiceBusOptions) String() string { return proto.CompactTextString(m) } -func (*RelayGroupAzureServiceBusOptions) ProtoMessage() {} -func (*RelayGroupAzureServiceBusOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_8864927d5e1ac547, []int{10} +func (x *RelayGroupAzureServiceBusOptions) Reset() { + *x = RelayGroupAzureServiceBusOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_relay_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RelayGroupAzureServiceBusOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RelayGroupAzureServiceBusOptions.Unmarshal(m, b) -} -func (m *RelayGroupAzureServiceBusOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RelayGroupAzureServiceBusOptions.Marshal(b, m, deterministic) +func (x *RelayGroupAzureServiceBusOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RelayGroupAzureServiceBusOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_RelayGroupAzureServiceBusOptions.Merge(m, src) -} -func (m *RelayGroupAzureServiceBusOptions) XXX_Size() int { - return xxx_messageInfo_RelayGroupAzureServiceBusOptions.Size(m) -} -func (m *RelayGroupAzureServiceBusOptions) XXX_DiscardUnknown() { - xxx_messageInfo_RelayGroupAzureServiceBusOptions.DiscardUnknown(m) + +func (*RelayGroupAzureServiceBusOptions) ProtoMessage() {} + +func (x *RelayGroupAzureServiceBusOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_relay_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RelayGroupAzureServiceBusOptions proto.InternalMessageInfo +// Deprecated: Use RelayGroupAzureServiceBusOptions.ProtoReflect.Descriptor instead. +func (*RelayGroupAzureServiceBusOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_relay_proto_rawDescGZIP(), []int{10} +} -func (m *RelayGroupAzureServiceBusOptions) GetXConn() *args.AzureServiceBusConn { - if m != nil { - return m.XConn +func (x *RelayGroupAzureServiceBusOptions) GetXConn() *args.AzureServiceBusConn { + if x != nil { + return x.XConn } return nil } -func (m *RelayGroupAzureServiceBusOptions) GetArgs() *args.AzureServiceBusReadArgs { - if m != nil { - return m.Args +func (x *RelayGroupAzureServiceBusOptions) GetArgs() *args.AzureServiceBusReadArgs { + if x != nil { + return x.Args } return nil } type RelayGroupMQTTOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.MQTTConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.MQTTReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.MQTTReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *RelayGroupMQTTOptions) Reset() { *m = RelayGroupMQTTOptions{} } -func (m *RelayGroupMQTTOptions) String() string { return proto.CompactTextString(m) } -func (*RelayGroupMQTTOptions) ProtoMessage() {} -func (*RelayGroupMQTTOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_8864927d5e1ac547, []int{11} +func (x *RelayGroupMQTTOptions) Reset() { + *x = RelayGroupMQTTOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_relay_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RelayGroupMQTTOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RelayGroupMQTTOptions.Unmarshal(m, b) +func (x *RelayGroupMQTTOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RelayGroupMQTTOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RelayGroupMQTTOptions.Marshal(b, m, deterministic) -} -func (m *RelayGroupMQTTOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_RelayGroupMQTTOptions.Merge(m, src) -} -func (m *RelayGroupMQTTOptions) XXX_Size() int { - return xxx_messageInfo_RelayGroupMQTTOptions.Size(m) -} -func (m *RelayGroupMQTTOptions) XXX_DiscardUnknown() { - xxx_messageInfo_RelayGroupMQTTOptions.DiscardUnknown(m) + +func (*RelayGroupMQTTOptions) ProtoMessage() {} + +func (x *RelayGroupMQTTOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_relay_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RelayGroupMQTTOptions proto.InternalMessageInfo +// Deprecated: Use RelayGroupMQTTOptions.ProtoReflect.Descriptor instead. +func (*RelayGroupMQTTOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_relay_proto_rawDescGZIP(), []int{11} +} -func (m *RelayGroupMQTTOptions) GetXConn() *args.MQTTConn { - if m != nil { - return m.XConn +func (x *RelayGroupMQTTOptions) GetXConn() *args.MQTTConn { + if x != nil { + return x.XConn } return nil } -func (m *RelayGroupMQTTOptions) GetArgs() *args.MQTTReadArgs { - if m != nil { - return m.Args +func (x *RelayGroupMQTTOptions) GetArgs() *args.MQTTReadArgs { + if x != nil { + return x.Args } return nil } type RelayGroupGCPPubSubOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.GCPPubSubConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.GCPPubSubReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.GCPPubSubReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *RelayGroupGCPPubSubOptions) Reset() { *m = RelayGroupGCPPubSubOptions{} } -func (m *RelayGroupGCPPubSubOptions) String() string { return proto.CompactTextString(m) } -func (*RelayGroupGCPPubSubOptions) ProtoMessage() {} -func (*RelayGroupGCPPubSubOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_8864927d5e1ac547, []int{12} +func (x *RelayGroupGCPPubSubOptions) Reset() { + *x = RelayGroupGCPPubSubOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_relay_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RelayGroupGCPPubSubOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RelayGroupGCPPubSubOptions.Unmarshal(m, b) -} -func (m *RelayGroupGCPPubSubOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RelayGroupGCPPubSubOptions.Marshal(b, m, deterministic) +func (x *RelayGroupGCPPubSubOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RelayGroupGCPPubSubOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_RelayGroupGCPPubSubOptions.Merge(m, src) -} -func (m *RelayGroupGCPPubSubOptions) XXX_Size() int { - return xxx_messageInfo_RelayGroupGCPPubSubOptions.Size(m) -} -func (m *RelayGroupGCPPubSubOptions) XXX_DiscardUnknown() { - xxx_messageInfo_RelayGroupGCPPubSubOptions.DiscardUnknown(m) + +func (*RelayGroupGCPPubSubOptions) ProtoMessage() {} + +func (x *RelayGroupGCPPubSubOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_relay_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RelayGroupGCPPubSubOptions proto.InternalMessageInfo +// Deprecated: Use RelayGroupGCPPubSubOptions.ProtoReflect.Descriptor instead. +func (*RelayGroupGCPPubSubOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_relay_proto_rawDescGZIP(), []int{12} +} -func (m *RelayGroupGCPPubSubOptions) GetXConn() *args.GCPPubSubConn { - if m != nil { - return m.XConn +func (x *RelayGroupGCPPubSubOptions) GetXConn() *args.GCPPubSubConn { + if x != nil { + return x.XConn } return nil } -func (m *RelayGroupGCPPubSubOptions) GetArgs() *args.GCPPubSubReadArgs { - if m != nil { - return m.Args +func (x *RelayGroupGCPPubSubOptions) GetArgs() *args.GCPPubSubReadArgs { + if x != nil { + return x.Args } return nil } type RelayGroupKubeMQQueueOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.KubeMQQueueConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.KubeMQQueueReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.KubeMQQueueReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *RelayGroupKubeMQQueueOptions) Reset() { *m = RelayGroupKubeMQQueueOptions{} } -func (m *RelayGroupKubeMQQueueOptions) String() string { return proto.CompactTextString(m) } -func (*RelayGroupKubeMQQueueOptions) ProtoMessage() {} -func (*RelayGroupKubeMQQueueOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_8864927d5e1ac547, []int{13} +func (x *RelayGroupKubeMQQueueOptions) Reset() { + *x = RelayGroupKubeMQQueueOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_relay_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RelayGroupKubeMQQueueOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RelayGroupKubeMQQueueOptions.Unmarshal(m, b) -} -func (m *RelayGroupKubeMQQueueOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RelayGroupKubeMQQueueOptions.Marshal(b, m, deterministic) -} -func (m *RelayGroupKubeMQQueueOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_RelayGroupKubeMQQueueOptions.Merge(m, src) -} -func (m *RelayGroupKubeMQQueueOptions) XXX_Size() int { - return xxx_messageInfo_RelayGroupKubeMQQueueOptions.Size(m) +func (x *RelayGroupKubeMQQueueOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RelayGroupKubeMQQueueOptions) XXX_DiscardUnknown() { - xxx_messageInfo_RelayGroupKubeMQQueueOptions.DiscardUnknown(m) + +func (*RelayGroupKubeMQQueueOptions) ProtoMessage() {} + +func (x *RelayGroupKubeMQQueueOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_relay_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RelayGroupKubeMQQueueOptions proto.InternalMessageInfo +// Deprecated: Use RelayGroupKubeMQQueueOptions.ProtoReflect.Descriptor instead. +func (*RelayGroupKubeMQQueueOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_relay_proto_rawDescGZIP(), []int{13} +} -func (m *RelayGroupKubeMQQueueOptions) GetXConn() *args.KubeMQQueueConn { - if m != nil { - return m.XConn +func (x *RelayGroupKubeMQQueueOptions) GetXConn() *args.KubeMQQueueConn { + if x != nil { + return x.XConn } return nil } -func (m *RelayGroupKubeMQQueueOptions) GetArgs() *args.KubeMQQueueReadArgs { - if m != nil { - return m.Args +func (x *RelayGroupKubeMQQueueOptions) GetArgs() *args.KubeMQQueueReadArgs { + if x != nil { + return x.Args } return nil } type RelayGroupNatsOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.NatsConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.NatsReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.NatsReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *RelayGroupNatsOptions) Reset() { *m = RelayGroupNatsOptions{} } -func (m *RelayGroupNatsOptions) String() string { return proto.CompactTextString(m) } -func (*RelayGroupNatsOptions) ProtoMessage() {} -func (*RelayGroupNatsOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_8864927d5e1ac547, []int{14} +func (x *RelayGroupNatsOptions) Reset() { + *x = RelayGroupNatsOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_relay_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RelayGroupNatsOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RelayGroupNatsOptions.Unmarshal(m, b) -} -func (m *RelayGroupNatsOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RelayGroupNatsOptions.Marshal(b, m, deterministic) +func (x *RelayGroupNatsOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RelayGroupNatsOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_RelayGroupNatsOptions.Merge(m, src) -} -func (m *RelayGroupNatsOptions) XXX_Size() int { - return xxx_messageInfo_RelayGroupNatsOptions.Size(m) -} -func (m *RelayGroupNatsOptions) XXX_DiscardUnknown() { - xxx_messageInfo_RelayGroupNatsOptions.DiscardUnknown(m) + +func (*RelayGroupNatsOptions) ProtoMessage() {} + +func (x *RelayGroupNatsOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_relay_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RelayGroupNatsOptions proto.InternalMessageInfo +// Deprecated: Use RelayGroupNatsOptions.ProtoReflect.Descriptor instead. +func (*RelayGroupNatsOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_relay_proto_rawDescGZIP(), []int{14} +} -func (m *RelayGroupNatsOptions) GetXConn() *args.NatsConn { - if m != nil { - return m.XConn +func (x *RelayGroupNatsOptions) GetXConn() *args.NatsConn { + if x != nil { + return x.XConn } return nil } -func (m *RelayGroupNatsOptions) GetArgs() *args.NatsReadArgs { - if m != nil { - return m.Args +func (x *RelayGroupNatsOptions) GetArgs() *args.NatsReadArgs { + if x != nil { + return x.Args } return nil } type RelayGroupNatsStreamingOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.NatsStreamingConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.NatsStreamingReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.NatsStreamingReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *RelayGroupNatsStreamingOptions) Reset() { *m = RelayGroupNatsStreamingOptions{} } -func (m *RelayGroupNatsStreamingOptions) String() string { return proto.CompactTextString(m) } -func (*RelayGroupNatsStreamingOptions) ProtoMessage() {} -func (*RelayGroupNatsStreamingOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_8864927d5e1ac547, []int{15} +func (x *RelayGroupNatsStreamingOptions) Reset() { + *x = RelayGroupNatsStreamingOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_relay_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RelayGroupNatsStreamingOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RelayGroupNatsStreamingOptions.Unmarshal(m, b) -} -func (m *RelayGroupNatsStreamingOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RelayGroupNatsStreamingOptions.Marshal(b, m, deterministic) -} -func (m *RelayGroupNatsStreamingOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_RelayGroupNatsStreamingOptions.Merge(m, src) +func (x *RelayGroupNatsStreamingOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RelayGroupNatsStreamingOptions) XXX_Size() int { - return xxx_messageInfo_RelayGroupNatsStreamingOptions.Size(m) -} -func (m *RelayGroupNatsStreamingOptions) XXX_DiscardUnknown() { - xxx_messageInfo_RelayGroupNatsStreamingOptions.DiscardUnknown(m) + +func (*RelayGroupNatsStreamingOptions) ProtoMessage() {} + +func (x *RelayGroupNatsStreamingOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_relay_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RelayGroupNatsStreamingOptions proto.InternalMessageInfo +// Deprecated: Use RelayGroupNatsStreamingOptions.ProtoReflect.Descriptor instead. +func (*RelayGroupNatsStreamingOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_relay_proto_rawDescGZIP(), []int{15} +} -func (m *RelayGroupNatsStreamingOptions) GetXConn() *args.NatsStreamingConn { - if m != nil { - return m.XConn +func (x *RelayGroupNatsStreamingOptions) GetXConn() *args.NatsStreamingConn { + if x != nil { + return x.XConn } return nil } -func (m *RelayGroupNatsStreamingOptions) GetArgs() *args.NatsStreamingReadArgs { - if m != nil { - return m.Args +func (x *RelayGroupNatsStreamingOptions) GetArgs() *args.NatsStreamingReadArgs { + if x != nil { + return x.Args } return nil } type RelayGroupNatsJetStreamOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.NatsJetstreamConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.NatsJetstreamReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.NatsJetstreamReadArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *RelayGroupNatsJetStreamOptions) Reset() { *m = RelayGroupNatsJetStreamOptions{} } -func (m *RelayGroupNatsJetStreamOptions) String() string { return proto.CompactTextString(m) } -func (*RelayGroupNatsJetStreamOptions) ProtoMessage() {} -func (*RelayGroupNatsJetStreamOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_8864927d5e1ac547, []int{16} +func (x *RelayGroupNatsJetStreamOptions) Reset() { + *x = RelayGroupNatsJetStreamOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_relay_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RelayGroupNatsJetStreamOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RelayGroupNatsJetStreamOptions.Unmarshal(m, b) +func (x *RelayGroupNatsJetStreamOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RelayGroupNatsJetStreamOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RelayGroupNatsJetStreamOptions.Marshal(b, m, deterministic) -} -func (m *RelayGroupNatsJetStreamOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_RelayGroupNatsJetStreamOptions.Merge(m, src) -} -func (m *RelayGroupNatsJetStreamOptions) XXX_Size() int { - return xxx_messageInfo_RelayGroupNatsJetStreamOptions.Size(m) -} -func (m *RelayGroupNatsJetStreamOptions) XXX_DiscardUnknown() { - xxx_messageInfo_RelayGroupNatsJetStreamOptions.DiscardUnknown(m) + +func (*RelayGroupNatsJetStreamOptions) ProtoMessage() {} + +func (x *RelayGroupNatsJetStreamOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_relay_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RelayGroupNatsJetStreamOptions proto.InternalMessageInfo +// Deprecated: Use RelayGroupNatsJetStreamOptions.ProtoReflect.Descriptor instead. +func (*RelayGroupNatsJetStreamOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_relay_proto_rawDescGZIP(), []int{16} +} -func (m *RelayGroupNatsJetStreamOptions) GetXConn() *args.NatsJetstreamConn { - if m != nil { - return m.XConn +func (x *RelayGroupNatsJetStreamOptions) GetXConn() *args.NatsJetstreamConn { + if x != nil { + return x.XConn } return nil } -func (m *RelayGroupNatsJetStreamOptions) GetArgs() *args.NatsJetstreamReadArgs { - if m != nil { - return m.Args +func (x *RelayGroupNatsJetStreamOptions) GetArgs() *args.NatsJetstreamReadArgs { + if x != nil { + return x.Args } return nil } -func init() { - proto.RegisterType((*RelayCLIOptions)(nil), "protos.opts.RelayCLIOptions") - proto.RegisterType((*RelayOptions)(nil), "protos.opts.RelayOptions") - proto.RegisterType((*RelayGroupKafkaOptions)(nil), "protos.opts.RelayGroupKafkaOptions") - proto.RegisterType((*RelayGroupAWSSQSOptions)(nil), "protos.opts.RelayGroupAWSSQSOptions") - proto.RegisterType((*RelayGroupMongoOptions)(nil), "protos.opts.RelayGroupMongoOptions") - proto.RegisterType((*RelayGroupNSQOptions)(nil), "protos.opts.RelayGroupNSQOptions") - proto.RegisterType((*RelayGroupPostgresOptions)(nil), "protos.opts.RelayGroupPostgresOptions") - proto.RegisterType((*RelayGroupRabbitOptions)(nil), "protos.opts.RelayGroupRabbitOptions") - proto.RegisterType((*RelayGroupRedisPubSubOptions)(nil), "protos.opts.RelayGroupRedisPubSubOptions") - proto.RegisterType((*RelayGroupRedisStreamsOptions)(nil), "protos.opts.RelayGroupRedisStreamsOptions") - proto.RegisterType((*RelayGroupAzureServiceBusOptions)(nil), "protos.opts.RelayGroupAzureServiceBusOptions") - proto.RegisterType((*RelayGroupMQTTOptions)(nil), "protos.opts.RelayGroupMQTTOptions") - proto.RegisterType((*RelayGroupGCPPubSubOptions)(nil), "protos.opts.RelayGroupGCPPubSubOptions") - proto.RegisterType((*RelayGroupKubeMQQueueOptions)(nil), "protos.opts.RelayGroupKubeMQQueueOptions") - proto.RegisterType((*RelayGroupNatsOptions)(nil), "protos.opts.RelayGroupNatsOptions") - proto.RegisterType((*RelayGroupNatsStreamingOptions)(nil), "protos.opts.RelayGroupNatsStreamingOptions") - proto.RegisterType((*RelayGroupNatsJetStreamOptions)(nil), "protos.opts.RelayGroupNatsJetStreamOptions") -} - -func init() { proto.RegisterFile("opts/ps_opts_relay.proto", fileDescriptor_8864927d5e1ac547) } - -var fileDescriptor_8864927d5e1ac547 = []byte{ - // 1313 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x57, 0x5b, 0x4f, 0xdc, 0xc6, - 0x17, 0xd7, 0xfe, 0x03, 0x6c, 0x98, 0x85, 0x3f, 0xcd, 0x34, 0x81, 0x01, 0x42, 0x58, 0x36, 0x28, - 0x85, 0x24, 0xec, 0x36, 0xd0, 0xa0, 0xa2, 0x36, 0xaa, 0x80, 0xa6, 0x88, 0x14, 0x08, 0x6b, 0xaf, - 0x14, 0xb5, 0x2f, 0x96, 0x2f, 0x93, 0xc5, 0xc1, 0x6b, 0x7b, 0x67, 0xc6, 0xdc, 0x1e, 0x2a, 0xf5, - 0xa9, 0x52, 0xa5, 0xaa, 0x0f, 0xfd, 0x92, 0xbd, 0x7e, 0x87, 0x6a, 0x66, 0x6c, 0xe3, 0xf1, 0xae, - 0x0d, 0x7d, 0x61, 0xb5, 0xe7, 0xfc, 0x6e, 0xb6, 0xc7, 0xe7, 0x2c, 0x00, 0x05, 0x21, 0xa3, 0xad, - 0x90, 0x1a, 0xfc, 0xd3, 0x20, 0xd8, 0x33, 0x2f, 0x9b, 0x21, 0x09, 0x58, 0x00, 0x6b, 0xe2, 0x83, - 0x36, 0x79, 0x63, 0x6e, 0xce, 0x24, 0x5d, 0x01, 0xe3, 0x9f, 0x86, 0x79, 0x4e, 0x0d, 0xda, 0xa7, - 0x12, 0x38, 0xb7, 0xac, 0xf6, 0xae, 0x22, 0x82, 0x0d, 0x8a, 0xc9, 0x99, 0x6b, 0x63, 0xc3, 0x8a, - 0x12, 0xd4, 0x82, 0x82, 0xea, 0xda, 0xa1, 0x11, 0x46, 0x16, 0x8d, 0xac, 0xb8, 0x8d, 0x94, 0xf6, - 0xa9, 0xf9, 0xfe, 0xd4, 0x8c, 0x3b, 0x8b, 0x6a, 0x27, 0xb2, 0x70, 0xaf, 0x6f, 0xf4, 0x23, 0x1c, - 0xe1, 0xa1, 0xd4, 0x5e, 0xe0, 0x77, 0x83, 0xb8, 0x33, 0xa3, 0x76, 0xfa, 0x8c, 0x0d, 0x6d, 0xf8, - 0x26, 0x4b, 0x52, 0x2e, 0x0d, 0x34, 0x8c, 0x0f, 0x98, 0x51, 0x46, 0xb0, 0xd9, 0x2b, 0x86, 0xc8, - 0xbe, 0xeb, 0x77, 0x63, 0xc8, 0xb4, 0x0a, 0xa1, 0xfd, 0xb8, 0x3e, 0xaf, 0xd4, 0xc3, 0x80, 0xb2, - 0x2e, 0xc1, 0x89, 0xf5, 0xac, 0xd2, 0x24, 0xa6, 0x65, 0xb9, 0x6c, 0xe8, 0x2d, 0x20, 0xd8, 0x71, - 0xa9, 0x7a, 0xf7, 0xea, 0x43, 0x00, 0x32, 0x54, 0xac, 0xde, 0xd8, 0x06, 0x53, 0x1a, 0x7f, 0xb8, - 0xbb, 0x07, 0xfb, 0x6f, 0x43, 0xe6, 0x06, 0x3e, 0x85, 0x4d, 0xf0, 0xf1, 0x09, 0x63, 0xa1, 0xe1, - 0xb9, 0x94, 0x61, 0xdf, 0x30, 0x1d, 0x87, 0x60, 0x4a, 0x51, 0xa5, 0x5e, 0x59, 0x19, 0xd7, 0xee, - 0xf1, 0xd6, 0x81, 0xe8, 0x6c, 0xcb, 0x46, 0xe3, 0xd7, 0x49, 0x30, 0x21, 0x34, 0x12, 0x81, 0x55, - 0xf0, 0x91, 0x1d, 0x78, 0x1e, 0xb6, 0xf9, 0x57, 0x83, 0x05, 0xa7, 0xd8, 0x8f, 0xd9, 0x53, 0xd7, - 0xf5, 0x0e, 0x2f, 0xc3, 0x05, 0x00, 0x2c, 0x93, 0xd9, 0x27, 0x06, 0x75, 0xaf, 0x30, 0xfa, 0x5f, - 0xbd, 0xb2, 0x32, 0xaa, 0x8d, 0x8b, 0x8a, 0xee, 0x5e, 0x61, 0xf8, 0x04, 0x4c, 0xc9, 0x76, 0xcf, - 0xbc, 0x30, 0x08, 0x66, 0xe4, 0x12, 0xdd, 0x11, 0x98, 0x49, 0x51, 0x3e, 0x34, 0x2f, 0x34, 0x5e, - 0x84, 0x8f, 0xc1, 0xa4, 0x1d, 0xf8, 0x7e, 0xec, 0xe8, 0x3a, 0x68, 0x44, 0xd8, 0x4d, 0x5c, 0x17, - 0xf7, 0x1d, 0xb8, 0x08, 0x6a, 0x7e, 0xd4, 0x33, 0xce, 0x03, 0x72, 0x8a, 0x09, 0x45, 0xa3, 0x42, - 0x08, 0xf8, 0x51, 0xef, 0x9d, 0xac, 0xc0, 0x25, 0x30, 0x41, 0x19, 0x7f, 0x6e, 0xd8, 0x37, 0x2d, - 0x0f, 0xa3, 0xb1, 0x7a, 0x65, 0xe5, 0xae, 0x56, 0x13, 0xb5, 0xd7, 0xa2, 0x04, 0xb7, 0xc0, 0xac, - 0x84, 0x10, 0x1c, 0x06, 0x84, 0x19, 0xae, 0xcf, 0x30, 0x39, 0x33, 0x3d, 0x83, 0x62, 0x1b, 0x55, - 0x85, 0xe2, 0xb4, 0x00, 0x68, 0xa2, 0xbf, 0x1f, 0xb7, 0x75, 0x6c, 0x73, 0x7b, 0x07, 0x9b, 0x8e, - 0xe1, 0x61, 0xc6, 0x30, 0x41, 0x77, 0x85, 0x38, 0xe0, 0xa5, 0x03, 0x51, 0x81, 0x9b, 0x60, 0x26, - 0x7e, 0x38, 0x8e, 0xe9, 0x19, 0x5d, 0x12, 0xda, 0xe9, 0xbd, 0xff, 0xbd, 0x2a, 0xae, 0xe7, 0xbe, - 0x9e, 0xb4, 0xf7, 0x48, 0x68, 0xc7, 0xf7, 0x1f, 0xbe, 0x02, 0xf3, 0x79, 0x9e, 0xe3, 0x52, 0x1e, - 0xd7, 0x60, 0x1e, 0x45, 0x7f, 0x54, 0x85, 0xd3, 0x8c, 0xc2, 0xfd, 0x5a, 0x02, 0x3a, 0x1e, 0x85, - 0xaf, 0xc1, 0x62, 0x9e, 0xce, 0xdc, 0x1e, 0x0e, 0x22, 0xc6, 0x2f, 0x2a, 0xf0, 0x1d, 0x8a, 0xfe, - 0x94, 0x57, 0x36, 0xaf, 0x48, 0x74, 0x24, 0x48, 0x97, 0x18, 0x38, 0x0f, 0xc6, 0xe5, 0x98, 0xe0, - 0xb7, 0xff, 0x2f, 0x99, 0xb7, 0x2a, 0x8e, 0xc5, 0xbe, 0x03, 0xbf, 0x02, 0x13, 0x86, 0xed, 0xb9, - 0x7c, 0x98, 0xf0, 0x13, 0x82, 0xfe, 0xe6, 0xfd, 0xda, 0xfa, 0xc3, 0x66, 0x66, 0x96, 0x34, 0x73, - 0xe7, 0x50, 0x03, 0xbb, 0x9e, 0x9b, 0x1c, 0x29, 0x04, 0xaa, 0x86, 0x69, 0x33, 0xf7, 0x0c, 0xa3, - 0x7f, 0xe4, 0xf5, 0x8c, 0x6d, 0x8b, 0xaf, 0x70, 0x0b, 0x8c, 0x8a, 0xa9, 0x80, 0x1c, 0x21, 0xf9, - 0x78, 0x50, 0x72, 0x8f, 0x04, 0x51, 0xf8, 0x2d, 0xc7, 0x24, 0xca, 0x92, 0x01, 0x5f, 0x81, 0x6a, - 0x3c, 0xb1, 0x10, 0x16, 0xe4, 0xe5, 0x02, 0xf2, 0xf6, 0x3b, 0x5d, 0x6f, 0xeb, 0x09, 0x7b, 0xcc, - 0x3c, 0xa7, 0x7a, 0x9f, 0x72, 0x67, 0x31, 0x54, 0xd0, 0xfb, 0x52, 0xe7, 0x43, 0x8e, 0x49, 0x9d, - 0x05, 0x03, 0x6e, 0x80, 0x3b, 0x3e, 0xed, 0xa3, 0xae, 0x20, 0x2e, 0x15, 0x10, 0x8f, 0xf4, 0x76, - 0x42, 0xe3, 0x68, 0xf8, 0x25, 0x18, 0x93, 0x6f, 0x3f, 0x3a, 0x29, 0x4d, 0xab, 0x09, 0x50, 0x9a, - 0x56, 0x72, 0xe0, 0x26, 0x18, 0xe1, 0x83, 0x0e, 0xb9, 0x82, 0xdb, 0x28, 0x0a, 0xdb, 0xee, 0x74, - 0x12, 0xa6, 0xc0, 0xc3, 0xef, 0xc0, 0xbd, 0x81, 0xd1, 0x8d, 0x3e, 0x08, 0x91, 0xb5, 0xa2, 0xdb, - 0xc5, 0xf1, 0xba, 0x84, 0xef, 0x44, 0x34, 0xd1, 0x9b, 0x32, 0xd5, 0x3a, 0xfc, 0x06, 0x80, 0xeb, - 0x79, 0x8f, 0x4e, 0x85, 0xe6, 0x27, 0x05, 0x9a, 0x7b, 0xbb, 0xc7, 0xc7, 0x91, 0xa5, 0x47, 0x56, - 0xa2, 0x36, 0xde, 0xb5, 0xc3, 0x63, 0xc1, 0x84, 0x07, 0x60, 0x22, 0x3b, 0xfe, 0x91, 0x27, 0x94, - 0x56, 0x8b, 0x4e, 0x42, 0x64, 0xe1, 0xc3, 0x76, 0x9b, 0x23, 0x13, 0xad, 0x9a, 0xa4, 0x8b, 0x1a, - 0x57, 0xcb, 0x4e, 0x52, 0xd4, 0x2b, 0x55, 0xd3, 0x38, 0x54, 0x4d, 0x56, 0x23, 0x71, 0x8d, 0x67, - 0x7b, 0x0b, 0x26, 0x95, 0xb1, 0x8b, 0x02, 0x21, 0xf7, 0xb4, 0x4c, 0x4e, 0xbe, 0x66, 0xe9, 0x7d, - 0x93, 0x71, 0xe2, 0x22, 0xdc, 0x01, 0x77, 0x93, 0x05, 0x81, 0x42, 0xa1, 0xf5, 0xa4, 0x40, 0xeb, - 0x38, 0x86, 0x25, 0x3a, 0x29, 0x8f, 0x9f, 0x05, 0xbe, 0x9f, 0x50, 0xbf, 0xf4, 0x2c, 0x1c, 0x99, - 0x2c, 0xe5, 0x0a, 0x3c, 0xd4, 0xc0, 0xff, 0xd5, 0xbd, 0x86, 0x88, 0x50, 0x78, 0x56, 0xa2, 0xa0, - 0x27, 0xd8, 0x44, 0x6a, 0xd2, 0xcf, 0x56, 0x53, 0xcd, 0x74, 0x9d, 0x22, 0x7a, 0xa3, 0xe6, 0x1b, - 0xcc, 0xa4, 0x80, 0xa2, 0xf9, 0x26, 0x51, 0x68, 0x9c, 0x81, 0xe9, 0xe1, 0x6f, 0x3e, 0x7c, 0x06, - 0x46, 0x0d, 0xbe, 0x14, 0xc4, 0x3e, 0xaa, 0xad, 0x4f, 0x27, 0x26, 0x7c, 0x3f, 0x36, 0x05, 0x72, - 0x37, 0xf0, 0x7d, 0x6d, 0x84, 0xff, 0x85, 0x2d, 0x30, 0xc2, 0xeb, 0x62, 0x2d, 0xd5, 0xd6, 0xe7, - 0x07, 0xb1, 0xc2, 0x64, 0x9b, 0x74, 0xa9, 0x26, 0x80, 0x8d, 0x4b, 0x30, 0x53, 0x30, 0x34, 0xe0, - 0x73, 0xd5, 0x78, 0x46, 0x11, 0x93, 0xd0, 0x8c, 0xf3, 0xa7, 0x8a, 0xf3, 0xc3, 0x21, 0xe0, 0xbc, - 0x75, 0x94, 0xbd, 0xe4, 0xec, 0xc8, 0x29, 0xbf, 0x64, 0x81, 0xcc, 0x18, 0x37, 0x15, 0xe3, 0xb9, - 0x41, 0xac, 0x86, 0x4d, 0x27, 0x63, 0x1b, 0x80, 0xfb, 0xc3, 0x06, 0x16, 0x5c, 0x55, 0x4d, 0xef, - 0x2b, 0x42, 0x47, 0x7a, 0x3b, 0x63, 0xf9, 0x5c, 0xb1, 0x44, 0x79, 0x64, 0xce, 0xf0, 0x07, 0x30, - 0x5b, 0x78, 0xc2, 0x61, 0x53, 0x75, 0x9d, 0x55, 0xb4, 0x12, 0x70, 0xc6, 0xfa, 0x85, 0x62, 0xbd, - 0x30, 0x14, 0x9e, 0xf3, 0xbf, 0xc8, 0x3e, 0x62, 0x65, 0xd2, 0x96, 0x3f, 0x62, 0x09, 0xbd, 0xe5, - 0xe1, 0x92, 0xe0, 0x9c, 0xf3, 0x4f, 0x15, 0xf0, 0xb0, 0x6c, 0xee, 0xc0, 0x17, 0xaa, 0xbf, 0x7a, - 0x6a, 0x32, 0xf8, 0x4c, 0x88, 0xcf, 0x94, 0x10, 0xf5, 0x22, 0x46, 0x2e, 0xc9, 0xcf, 0x15, 0xb0, - 0x50, 0x3a, 0xb2, 0xe0, 0xba, 0x1a, 0x65, 0x61, 0x50, 0x38, 0x26, 0x64, 0xb2, 0xbc, 0x54, 0xb2, - 0x2c, 0x15, 0x52, 0x72, 0x61, 0x7e, 0xab, 0x80, 0xfa, 0x4d, 0xab, 0x07, 0xbe, 0x54, 0xf3, 0xa8, - 0x17, 0x9a, 0xe3, 0x64, 0x22, 0x7d, 0xae, 0x44, 0x5a, 0x2e, 0x63, 0xe5, 0x52, 0x11, 0xf0, 0x60, - 0xe8, 0x52, 0x85, 0x4f, 0xd5, 0x24, 0x0f, 0xd4, 0x37, 0xac, 0xdd, 0xe9, 0x64, 0xec, 0xd7, 0x14, - 0xfb, 0xd9, 0x01, 0x68, 0xce, 0xf3, 0xc7, 0x0a, 0x98, 0x2b, 0x5e, 0x98, 0xb0, 0xa5, 0x3a, 0xab, - 0xef, 0x76, 0x8a, 0xce, 0xd8, 0xaf, 0x2b, 0xf6, 0x8f, 0x86, 0xe3, 0x4b, 0x0f, 0xe9, 0xe0, 0xaa, - 0x2d, 0x3f, 0xa4, 0x19, 0xfc, 0x2d, 0x0f, 0x69, 0x86, 0x51, 0xf6, 0x04, 0x32, 0xab, 0xac, 0xfc, - 0x09, 0x70, 0xe0, 0x2d, 0x9f, 0xc0, 0x91, 0xf8, 0x95, 0xaf, 0x78, 0xfe, 0x52, 0x01, 0x8f, 0xca, - 0xb7, 0x1f, 0xdc, 0x50, 0xdd, 0x1f, 0x0d, 0x48, 0xa6, 0x8c, 0x4c, 0x8c, 0x4d, 0x25, 0x46, 0xa3, - 0x98, 0x73, 0x63, 0x9e, 0xfc, 0xe6, 0xbc, 0x39, 0x4f, 0xba, 0x55, 0xff, 0x43, 0x9e, 0x94, 0xa3, - 0xe6, 0xd9, 0xf9, 0xe2, 0xfb, 0xad, 0xae, 0xcb, 0x4e, 0x22, 0xab, 0x69, 0x07, 0xbd, 0x96, 0xf8, - 0x17, 0xce, 0x0e, 0x48, 0xd8, 0x0a, 0xbd, 0xa8, 0x67, 0x61, 0xb2, 0x46, 0xed, 0x13, 0xdc, 0x33, - 0x69, 0xcb, 0x8a, 0x5c, 0xcf, 0x69, 0x75, 0x83, 0x96, 0x14, 0x6e, 0xf1, 0x9f, 0x00, 0xd6, 0x98, - 0xf8, 0xb2, 0xf1, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3c, 0xe3, 0x8a, 0xf8, 0x9a, 0x10, 0x00, - 0x00, +var File_opts_ps_opts_relay_proto protoreflect.FileDescriptor + +var file_opts_ps_opts_relay_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x72, + 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x1a, 0x1f, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, + 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x5f, 0x72, 0x65, 0x6c, + 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, + 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x71, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x24, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, + 0x67, 0x73, 0x5f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x61, 0x72, 0x67, 0x73, + 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x67, 0x63, 0x70, 0x5f, 0x70, 0x75, 0x62, + 0x73, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x61, 0x72, 0x67, 0x73, 0x2f, + 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, + 0x73, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, 0x5f, 0x71, 0x75, 0x65, 0x75, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, + 0x67, 0x73, 0x5f, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, + 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6d, 0x71, 0x74, + 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, + 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x21, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, + 0x61, 0x74, 0x73, 0x5f, 0x6a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, + 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, + 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x73, 0x71, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, + 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x70, 0x6f, 0x73, + 0x74, 0x67, 0x72, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x61, 0x72, 0x67, + 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, + 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, + 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, + 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x41, 0x0a, 0x0f, 0x52, 0x65, 0x6c, + 0x61, 0x79, 0x43, 0x4c, 0x49, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2e, 0x0a, 0x13, + 0x68, 0x74, 0x74, 0x70, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x68, 0x74, 0x74, 0x70, 0x4c, + 0x69, 0x73, 0x74, 0x65, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0xfd, 0x0d, 0x0a, + 0x0c, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x29, 0x0a, + 0x10, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x61, 0x74, 0x63, + 0x68, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x62, 0x61, + 0x74, 0x63, 0x68, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x26, 0x0a, 0x0f, 0x62, 0x61, 0x74, 0x63, 0x68, + 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x65, 0x74, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x0d, 0x62, 0x61, 0x74, 0x63, 0x68, 0x4d, 0x61, 0x78, 0x52, 0x65, 0x74, 0x72, 0x79, 0x12, + 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x6e, 0x75, 0x6d, 0x5f, 0x77, 0x6f, 0x72, 0x6b, + 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x6e, 0x75, 0x6d, 0x57, 0x6f, + 0x72, 0x6b, 0x65, 0x72, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x74, 0x73, 0x5f, 0x65, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x73, 0x74, 0x61, + 0x74, 0x73, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x39, 0x0a, 0x19, 0x73, 0x74, 0x61, 0x74, + 0x73, 0x5f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, + 0x6c, 0x5f, 0x73, 0x65, 0x63, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x16, 0x73, 0x74, 0x61, + 0x74, 0x73, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, + 0x53, 0x65, 0x63, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x65, 0x61, 0x64, 0x5f, 0x6c, 0x65, 0x74, 0x74, + 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x61, 0x64, 0x4c, 0x65, + 0x74, 0x74, 0x65, 0x72, 0x12, 0x6c, 0x0a, 0x1d, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, + 0x6c, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x64, 0x61, 0x6c, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x1b, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, + 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, + 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0xe8, 0x07, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x47, + 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x3d, 0x0a, 0x1b, 0x5f, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x64, 0x69, + 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x74, 0x6c, 0x73, 0x18, 0xe9, 0x07, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x17, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x47, 0x72, 0x70, 0x63, 0x44, + 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x6c, 0x73, 0x12, 0x45, 0x0a, 0x1f, 0x5f, 0x73, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0xea, 0x07, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x1b, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x47, 0x72, + 0x70, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, + 0x12, 0x1b, 0x0a, 0x09, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x69, 0x64, 0x18, 0xeb, 0x07, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x12, 0x3f, 0x0a, + 0x0c, 0x5f, 0x63, 0x6c, 0x69, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xec, 0x07, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, + 0x74, 0x73, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x4c, 0x49, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x0a, 0x43, 0x6c, 0x69, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x18, + 0x0a, 0x07, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0xed, 0x07, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x06, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x39, 0x0a, 0x05, 0x6b, 0x61, 0x66, 0x6b, + 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x05, 0x6b, 0x61, + 0x66, 0x6b, 0x61, 0x12, 0x3d, 0x0a, 0x07, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x71, 0x73, 0x18, 0x65, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, + 0x74, 0x73, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x57, 0x53, + 0x53, 0x51, 0x53, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x61, 0x77, 0x73, 0x53, + 0x71, 0x73, 0x12, 0x39, 0x0a, 0x05, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x18, 0x66, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, + 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x6f, 0x6e, 0x67, 0x6f, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x05, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x12, 0x33, 0x0a, + 0x03, 0x6e, 0x73, 0x71, 0x18, 0x67, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x4e, 0x53, 0x51, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x03, 0x6e, + 0x73, 0x71, 0x12, 0x3c, 0x0a, 0x06, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x18, 0x68, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, + 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x61, 0x62, 0x62, 0x69, + 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, + 0x12, 0x36, 0x0a, 0x04, 0x6d, 0x71, 0x74, 0x74, 0x18, 0x69, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x6c, + 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x51, 0x54, 0x54, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x04, 0x6d, 0x71, 0x74, 0x74, 0x12, 0x59, 0x0a, 0x11, 0x61, 0x7a, 0x75, 0x72, + 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x62, 0x75, 0x73, 0x18, 0x6a, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, + 0x73, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x7a, 0x75, 0x72, + 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x0f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x42, 0x75, 0x73, 0x12, 0x46, 0x0a, 0x0a, 0x67, 0x63, 0x70, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, + 0x62, 0x18, 0x6b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x47, 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x09, 0x67, 0x63, 0x70, 0x50, 0x75, 0x62, 0x73, 0x75, 0x62, 0x12, 0x4c, 0x0a, 0x0c, 0x6b, + 0x75, 0x62, 0x65, 0x6d, 0x71, 0x5f, 0x71, 0x75, 0x65, 0x75, 0x65, 0x18, 0x6c, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x29, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, + 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4b, 0x75, 0x62, 0x65, 0x4d, 0x51, + 0x51, 0x75, 0x65, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0b, 0x6b, 0x75, + 0x62, 0x65, 0x6d, 0x71, 0x51, 0x75, 0x65, 0x75, 0x65, 0x12, 0x4c, 0x0a, 0x0c, 0x72, 0x65, 0x64, + 0x69, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x18, 0x6d, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x29, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, + 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, + 0x53, 0x75, 0x62, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0b, 0x72, 0x65, 0x64, 0x69, + 0x73, 0x50, 0x75, 0x62, 0x73, 0x75, 0x62, 0x12, 0x4f, 0x0a, 0x0d, 0x72, 0x65, 0x64, 0x69, 0x73, + 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x6f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x6c, + 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0c, 0x72, 0x65, 0x64, 0x69, + 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x42, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x74, + 0x67, 0x72, 0x65, 0x73, 0x18, 0x70, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x50, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x12, 0x36, 0x0a, 0x04, + 0x6e, 0x61, 0x74, 0x73, 0x18, 0x71, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x74, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x04, + 0x6e, 0x61, 0x74, 0x73, 0x12, 0x52, 0x0a, 0x0e, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x72, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, + 0x6e, 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0d, 0x6e, 0x61, 0x74, 0x73, 0x53, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x12, 0x52, 0x0a, 0x0e, 0x6e, 0x61, 0x74, 0x73, + 0x5f, 0x6a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18, 0x73, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, + 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, + 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0d, 0x6e, + 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x22, 0x76, 0x0a, 0x16, + 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2b, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, + 0x72, 0x67, 0x73, 0x2e, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, + 0x6f, 0x6e, 0x6e, 0x12, 0x2f, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, + 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, + 0x61, 0x72, 0x67, 0x73, 0x22, 0x79, 0x0a, 0x17, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x41, 0x57, 0x53, 0x53, 0x51, 0x53, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x2c, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, + 0x53, 0x51, 0x53, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x30, 0x0a, + 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x53, 0x51, 0x53, + 0x52, 0x65, 0x6c, 0x61, 0x79, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, + 0x75, 0x0a, 0x16, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x6f, 0x6e, + 0x67, 0x6f, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2b, 0x0a, 0x05, 0x5f, 0x63, 0x6f, + 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4d, 0x6f, 0x6e, 0x67, 0x6f, 0x43, 0x6f, 0x6e, 0x6e, + 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x2e, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, + 0x67, 0x73, 0x2e, 0x4d, 0x6f, 0x6e, 0x67, 0x6f, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, + 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x6f, 0x0a, 0x14, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x53, 0x51, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x29, + 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x53, 0x51, 0x43, + 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x2c, 0x0a, 0x04, 0x61, 0x72, 0x67, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x53, 0x51, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, + 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x7e, 0x0a, 0x19, 0x52, 0x65, 0x6c, 0x61, 0x79, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2e, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, + 0x73, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, + 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x31, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, + 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, + 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x78, 0x0a, 0x17, 0x52, 0x65, 0x6c, 0x61, 0x79, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x2c, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, + 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, + 0x12, 0x2f, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x61, 0x62, + 0x62, 0x69, 0x74, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, + 0x73, 0x22, 0x87, 0x01, 0x0a, 0x1c, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x52, 0x65, 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x31, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, + 0x52, 0x65, 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x43, 0x6f, 0x6e, 0x6e, 0x52, + 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x34, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, + 0x73, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x52, 0x65, 0x61, + 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x8a, 0x01, 0x0a, 0x1d, + 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x64, 0x69, 0x73, 0x53, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x32, 0x0a, + 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, + 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, + 0x6e, 0x12, 0x35, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x65, + 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, + 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x93, 0x01, 0x0a, 0x20, 0x52, 0x65, 0x6c, + 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x35, 0x0a, + 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x7a, 0x75, 0x72, 0x65, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, + 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x38, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, + 0x2e, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, + 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x72, + 0x0a, 0x15, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x51, 0x54, 0x54, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4d, 0x51, 0x54, 0x54, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, + 0x6f, 0x6e, 0x6e, 0x12, 0x2d, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, + 0x4d, 0x51, 0x54, 0x54, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, + 0x67, 0x73, 0x22, 0x81, 0x01, 0x0a, 0x1a, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x47, 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x2f, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x47, + 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, + 0x6e, 0x6e, 0x12, 0x32, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x47, + 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, + 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x87, 0x01, 0x0a, 0x1c, 0x52, 0x65, 0x6c, 0x61, 0x79, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4b, 0x75, 0x62, 0x65, 0x4d, 0x51, 0x51, 0x75, 0x65, 0x75, 0x65, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x31, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4b, 0x75, 0x62, 0x65, 0x4d, 0x51, 0x51, 0x75, 0x65, 0x75, 0x65, + 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x34, 0x0a, 0x04, 0x61, 0x72, + 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4b, 0x75, 0x62, 0x65, 0x4d, 0x51, 0x51, 0x75, 0x65, + 0x75, 0x65, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, + 0x22, 0x72, 0x0a, 0x15, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, + 0x74, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x5f, 0x63, 0x6f, + 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, + 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x2d, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, + 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, + 0x61, 0x72, 0x67, 0x73, 0x22, 0x8d, 0x01, 0x0a, 0x1e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x33, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, + 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x36, 0x0a, 0x04, + 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, + 0x61, 0x72, 0x67, 0x73, 0x22, 0x8d, 0x01, 0x0a, 0x1e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x33, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x36, 0x0a, 0x04, + 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, + 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x61, 0x64, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, + 0x61, 0x72, 0x67, 0x73, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, + 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x6f, 0x70, 0x74, + 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_opts_ps_opts_relay_proto_rawDescOnce sync.Once + file_opts_ps_opts_relay_proto_rawDescData = file_opts_ps_opts_relay_proto_rawDesc +) + +func file_opts_ps_opts_relay_proto_rawDescGZIP() []byte { + file_opts_ps_opts_relay_proto_rawDescOnce.Do(func() { + file_opts_ps_opts_relay_proto_rawDescData = protoimpl.X.CompressGZIP(file_opts_ps_opts_relay_proto_rawDescData) + }) + return file_opts_ps_opts_relay_proto_rawDescData +} + +var file_opts_ps_opts_relay_proto_msgTypes = make([]protoimpl.MessageInfo, 17) +var file_opts_ps_opts_relay_proto_goTypes = []interface{}{ + (*RelayCLIOptions)(nil), // 0: protos.opts.RelayCLIOptions + (*RelayOptions)(nil), // 1: protos.opts.RelayOptions + (*RelayGroupKafkaOptions)(nil), // 2: protos.opts.RelayGroupKafkaOptions + (*RelayGroupAWSSQSOptions)(nil), // 3: protos.opts.RelayGroupAWSSQSOptions + (*RelayGroupMongoOptions)(nil), // 4: protos.opts.RelayGroupMongoOptions + (*RelayGroupNSQOptions)(nil), // 5: protos.opts.RelayGroupNSQOptions + (*RelayGroupPostgresOptions)(nil), // 6: protos.opts.RelayGroupPostgresOptions + (*RelayGroupRabbitOptions)(nil), // 7: protos.opts.RelayGroupRabbitOptions + (*RelayGroupRedisPubSubOptions)(nil), // 8: protos.opts.RelayGroupRedisPubSubOptions + (*RelayGroupRedisStreamsOptions)(nil), // 9: protos.opts.RelayGroupRedisStreamsOptions + (*RelayGroupAzureServiceBusOptions)(nil), // 10: protos.opts.RelayGroupAzureServiceBusOptions + (*RelayGroupMQTTOptions)(nil), // 11: protos.opts.RelayGroupMQTTOptions + (*RelayGroupGCPPubSubOptions)(nil), // 12: protos.opts.RelayGroupGCPPubSubOptions + (*RelayGroupKubeMQQueueOptions)(nil), // 13: protos.opts.RelayGroupKubeMQQueueOptions + (*RelayGroupNatsOptions)(nil), // 14: protos.opts.RelayGroupNatsOptions + (*RelayGroupNatsStreamingOptions)(nil), // 15: protos.opts.RelayGroupNatsStreamingOptions + (*RelayGroupNatsJetStreamOptions)(nil), // 16: protos.opts.RelayGroupNatsJetStreamOptions + (*StreamdalIntegrationOptions)(nil), // 17: protos.opts.StreamdalIntegrationOptions + (*args.KafkaConn)(nil), // 18: protos.args.KafkaConn + (*args.KafkaRelayArgs)(nil), // 19: protos.args.KafkaRelayArgs + (*args.AWSSQSConn)(nil), // 20: protos.args.AWSSQSConn + (*args.AWSSQSRelayArgs)(nil), // 21: protos.args.AWSSQSRelayArgs + (*args.MongoConn)(nil), // 22: protos.args.MongoConn + (*args.MongoReadArgs)(nil), // 23: protos.args.MongoReadArgs + (*args.NSQConn)(nil), // 24: protos.args.NSQConn + (*args.NSQReadArgs)(nil), // 25: protos.args.NSQReadArgs + (*args.PostgresConn)(nil), // 26: protos.args.PostgresConn + (*args.PostgresReadArgs)(nil), // 27: protos.args.PostgresReadArgs + (*args.RabbitConn)(nil), // 28: protos.args.RabbitConn + (*args.RabbitReadArgs)(nil), // 29: protos.args.RabbitReadArgs + (*args.RedisPubSubConn)(nil), // 30: protos.args.RedisPubSubConn + (*args.RedisPubSubReadArgs)(nil), // 31: protos.args.RedisPubSubReadArgs + (*args.RedisStreamsConn)(nil), // 32: protos.args.RedisStreamsConn + (*args.RedisStreamsReadArgs)(nil), // 33: protos.args.RedisStreamsReadArgs + (*args.AzureServiceBusConn)(nil), // 34: protos.args.AzureServiceBusConn + (*args.AzureServiceBusReadArgs)(nil), // 35: protos.args.AzureServiceBusReadArgs + (*args.MQTTConn)(nil), // 36: protos.args.MQTTConn + (*args.MQTTReadArgs)(nil), // 37: protos.args.MQTTReadArgs + (*args.GCPPubSubConn)(nil), // 38: protos.args.GCPPubSubConn + (*args.GCPPubSubReadArgs)(nil), // 39: protos.args.GCPPubSubReadArgs + (*args.KubeMQQueueConn)(nil), // 40: protos.args.KubeMQQueueConn + (*args.KubeMQQueueReadArgs)(nil), // 41: protos.args.KubeMQQueueReadArgs + (*args.NatsConn)(nil), // 42: protos.args.NatsConn + (*args.NatsReadArgs)(nil), // 43: protos.args.NatsReadArgs + (*args.NatsStreamingConn)(nil), // 44: protos.args.NatsStreamingConn + (*args.NatsStreamingReadArgs)(nil), // 45: protos.args.NatsStreamingReadArgs + (*args.NatsJetstreamConn)(nil), // 46: protos.args.NatsJetstreamConn + (*args.NatsJetstreamReadArgs)(nil), // 47: protos.args.NatsJetstreamReadArgs +} +var file_opts_ps_opts_relay_proto_depIdxs = []int32{ + 17, // 0: protos.opts.RelayOptions.streamdal_integration_options:type_name -> protos.opts.StreamdalIntegrationOptions + 0, // 1: protos.opts.RelayOptions._cli_options:type_name -> protos.opts.RelayCLIOptions + 2, // 2: protos.opts.RelayOptions.kafka:type_name -> protos.opts.RelayGroupKafkaOptions + 3, // 3: protos.opts.RelayOptions.aws_sqs:type_name -> protos.opts.RelayGroupAWSSQSOptions + 4, // 4: protos.opts.RelayOptions.mongo:type_name -> protos.opts.RelayGroupMongoOptions + 5, // 5: protos.opts.RelayOptions.nsq:type_name -> protos.opts.RelayGroupNSQOptions + 7, // 6: protos.opts.RelayOptions.rabbit:type_name -> protos.opts.RelayGroupRabbitOptions + 11, // 7: protos.opts.RelayOptions.mqtt:type_name -> protos.opts.RelayGroupMQTTOptions + 10, // 8: protos.opts.RelayOptions.azure_service_bus:type_name -> protos.opts.RelayGroupAzureServiceBusOptions + 12, // 9: protos.opts.RelayOptions.gcp_pubsub:type_name -> protos.opts.RelayGroupGCPPubSubOptions + 13, // 10: protos.opts.RelayOptions.kubemq_queue:type_name -> protos.opts.RelayGroupKubeMQQueueOptions + 8, // 11: protos.opts.RelayOptions.redis_pubsub:type_name -> protos.opts.RelayGroupRedisPubSubOptions + 9, // 12: protos.opts.RelayOptions.redis_streams:type_name -> protos.opts.RelayGroupRedisStreamsOptions + 6, // 13: protos.opts.RelayOptions.postgres:type_name -> protos.opts.RelayGroupPostgresOptions + 14, // 14: protos.opts.RelayOptions.nats:type_name -> protos.opts.RelayGroupNatsOptions + 15, // 15: protos.opts.RelayOptions.nats_streaming:type_name -> protos.opts.RelayGroupNatsStreamingOptions + 16, // 16: protos.opts.RelayOptions.nats_jetstream:type_name -> protos.opts.RelayGroupNatsJetStreamOptions + 18, // 17: protos.opts.RelayGroupKafkaOptions._conn:type_name -> protos.args.KafkaConn + 19, // 18: protos.opts.RelayGroupKafkaOptions.args:type_name -> protos.args.KafkaRelayArgs + 20, // 19: protos.opts.RelayGroupAWSSQSOptions._conn:type_name -> protos.args.AWSSQSConn + 21, // 20: protos.opts.RelayGroupAWSSQSOptions.args:type_name -> protos.args.AWSSQSRelayArgs + 22, // 21: protos.opts.RelayGroupMongoOptions._conn:type_name -> protos.args.MongoConn + 23, // 22: protos.opts.RelayGroupMongoOptions.args:type_name -> protos.args.MongoReadArgs + 24, // 23: protos.opts.RelayGroupNSQOptions._conn:type_name -> protos.args.NSQConn + 25, // 24: protos.opts.RelayGroupNSQOptions.args:type_name -> protos.args.NSQReadArgs + 26, // 25: protos.opts.RelayGroupPostgresOptions._conn:type_name -> protos.args.PostgresConn + 27, // 26: protos.opts.RelayGroupPostgresOptions.args:type_name -> protos.args.PostgresReadArgs + 28, // 27: protos.opts.RelayGroupRabbitOptions._conn:type_name -> protos.args.RabbitConn + 29, // 28: protos.opts.RelayGroupRabbitOptions.args:type_name -> protos.args.RabbitReadArgs + 30, // 29: protos.opts.RelayGroupRedisPubSubOptions._conn:type_name -> protos.args.RedisPubSubConn + 31, // 30: protos.opts.RelayGroupRedisPubSubOptions.args:type_name -> protos.args.RedisPubSubReadArgs + 32, // 31: protos.opts.RelayGroupRedisStreamsOptions._conn:type_name -> protos.args.RedisStreamsConn + 33, // 32: protos.opts.RelayGroupRedisStreamsOptions.args:type_name -> protos.args.RedisStreamsReadArgs + 34, // 33: protos.opts.RelayGroupAzureServiceBusOptions._conn:type_name -> protos.args.AzureServiceBusConn + 35, // 34: protos.opts.RelayGroupAzureServiceBusOptions.args:type_name -> protos.args.AzureServiceBusReadArgs + 36, // 35: protos.opts.RelayGroupMQTTOptions._conn:type_name -> protos.args.MQTTConn + 37, // 36: protos.opts.RelayGroupMQTTOptions.args:type_name -> protos.args.MQTTReadArgs + 38, // 37: protos.opts.RelayGroupGCPPubSubOptions._conn:type_name -> protos.args.GCPPubSubConn + 39, // 38: protos.opts.RelayGroupGCPPubSubOptions.args:type_name -> protos.args.GCPPubSubReadArgs + 40, // 39: protos.opts.RelayGroupKubeMQQueueOptions._conn:type_name -> protos.args.KubeMQQueueConn + 41, // 40: protos.opts.RelayGroupKubeMQQueueOptions.args:type_name -> protos.args.KubeMQQueueReadArgs + 42, // 41: protos.opts.RelayGroupNatsOptions._conn:type_name -> protos.args.NatsConn + 43, // 42: protos.opts.RelayGroupNatsOptions.args:type_name -> protos.args.NatsReadArgs + 44, // 43: protos.opts.RelayGroupNatsStreamingOptions._conn:type_name -> protos.args.NatsStreamingConn + 45, // 44: protos.opts.RelayGroupNatsStreamingOptions.args:type_name -> protos.args.NatsStreamingReadArgs + 46, // 45: protos.opts.RelayGroupNatsJetStreamOptions._conn:type_name -> protos.args.NatsJetstreamConn + 47, // 46: protos.opts.RelayGroupNatsJetStreamOptions.args:type_name -> protos.args.NatsJetstreamReadArgs + 47, // [47:47] is the sub-list for method output_type + 47, // [47:47] is the sub-list for method input_type + 47, // [47:47] is the sub-list for extension type_name + 47, // [47:47] is the sub-list for extension extendee + 0, // [0:47] is the sub-list for field type_name +} + +func init() { file_opts_ps_opts_relay_proto_init() } +func file_opts_ps_opts_relay_proto_init() { + if File_opts_ps_opts_relay_proto != nil { + return + } + file_opts_ps_opts_manage_relay_proto_init() + if !protoimpl.UnsafeEnabled { + file_opts_ps_opts_relay_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayCLIOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_relay_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_relay_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayGroupKafkaOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_relay_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayGroupAWSSQSOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_relay_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayGroupMongoOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_relay_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayGroupNSQOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_relay_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayGroupPostgresOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_relay_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayGroupRabbitOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_relay_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayGroupRedisPubSubOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_relay_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayGroupRedisStreamsOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_relay_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayGroupAzureServiceBusOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_relay_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayGroupMQTTOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_relay_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayGroupGCPPubSubOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_relay_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayGroupKubeMQQueueOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_relay_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayGroupNatsOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_relay_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayGroupNatsStreamingOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_relay_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayGroupNatsJetStreamOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_opts_ps_opts_relay_proto_rawDesc, + NumEnums: 0, + NumMessages: 17, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_opts_ps_opts_relay_proto_goTypes, + DependencyIndexes: file_opts_ps_opts_relay_proto_depIdxs, + MessageInfos: file_opts_ps_opts_relay_proto_msgTypes, + }.Build() + File_opts_ps_opts_relay_proto = out.File + file_opts_ps_opts_relay_proto_rawDesc = nil + file_opts_ps_opts_relay_proto_goTypes = nil + file_opts_ps_opts_relay_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_server.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_server.pb.go index 2d59d2dc3..41c806c65 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_server.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_server.pb.go @@ -1,26 +1,30 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: opts/ps_opts_server.proto package opts import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type ServerOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"default=plumber1,help='Unique ID that identifies this plumber node',env='PLUMBER_SERVER_NODE_ID',required" NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty" kong:"default=plumber1,help='Unique ID that identifies this plumber node',env='PLUMBER_SERVER_NODE_ID',required"` // @gotags: kong:"default=aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,help='ID of the plumber cluster (has to be the same across all nodes)',env='PLUMBER_SERVER_CLUSTER_ID',required" @@ -56,202 +60,287 @@ type ServerOptions struct { // @gotags: kong:"help='Streamdal API token, needed to access remote control service',env='PLUMBER_REMOTE_CONTROL_API_TOKEN'" RemoteControlApiToken string `protobuf:"bytes,19,opt,name=remote_control_api_token,json=remoteControlApiToken,proto3" json:"remote_control_api_token,omitempty" kong:"help='Streamdal API token, needed to access remote control service',env='PLUMBER_REMOTE_CONTROL_API_TOKEN'"` // @gotags: kong:"help='Connect to remote control server without TLS',default=false" - RemoteControlDisableTls bool `protobuf:"varint,20,opt,name=remote_control_disable_tls,json=remoteControlDisableTls,proto3" json:"remote_control_disable_tls,omitempty" kong:"help='Connect to remote control server without TLS',default=false"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + RemoteControlDisableTls bool `protobuf:"varint,20,opt,name=remote_control_disable_tls,json=remoteControlDisableTls,proto3" json:"remote_control_disable_tls,omitempty" kong:"help='Connect to remote control server without TLS',default=false"` } -func (m *ServerOptions) Reset() { *m = ServerOptions{} } -func (m *ServerOptions) String() string { return proto.CompactTextString(m) } -func (*ServerOptions) ProtoMessage() {} -func (*ServerOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_72fba0b7ae2941aa, []int{0} +func (x *ServerOptions) Reset() { + *x = ServerOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_server_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ServerOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ServerOptions.Unmarshal(m, b) -} -func (m *ServerOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ServerOptions.Marshal(b, m, deterministic) +func (x *ServerOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ServerOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServerOptions.Merge(m, src) -} -func (m *ServerOptions) XXX_Size() int { - return xxx_messageInfo_ServerOptions.Size(m) -} -func (m *ServerOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ServerOptions.DiscardUnknown(m) + +func (*ServerOptions) ProtoMessage() {} + +func (x *ServerOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_server_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ServerOptions proto.InternalMessageInfo +// Deprecated: Use ServerOptions.ProtoReflect.Descriptor instead. +func (*ServerOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_server_proto_rawDescGZIP(), []int{0} +} -func (m *ServerOptions) GetNodeId() string { - if m != nil { - return m.NodeId +func (x *ServerOptions) GetNodeId() string { + if x != nil { + return x.NodeId } return "" } -func (m *ServerOptions) GetClusterId() string { - if m != nil { - return m.ClusterId +func (x *ServerOptions) GetClusterId() string { + if x != nil { + return x.ClusterId } return "" } -func (m *ServerOptions) GetGrpcListenAddress() string { - if m != nil { - return m.GrpcListenAddress +func (x *ServerOptions) GetGrpcListenAddress() string { + if x != nil { + return x.GrpcListenAddress } return "" } -func (m *ServerOptions) GetAuthToken() string { - if m != nil { - return m.AuthToken +func (x *ServerOptions) GetAuthToken() string { + if x != nil { + return x.AuthToken } return "" } -func (m *ServerOptions) GetNatsUrl() []string { - if m != nil { - return m.NatsUrl +func (x *ServerOptions) GetNatsUrl() []string { + if x != nil { + return x.NatsUrl } return nil } -func (m *ServerOptions) GetUseTls() bool { - if m != nil { - return m.UseTls +func (x *ServerOptions) GetUseTls() bool { + if x != nil { + return x.UseTls } return false } -func (m *ServerOptions) GetTlsCertFile() string { - if m != nil { - return m.TlsCertFile +func (x *ServerOptions) GetTlsCertFile() string { + if x != nil { + return x.TlsCertFile } return "" } -func (m *ServerOptions) GetTlsKeyFile() string { - if m != nil { - return m.TlsKeyFile +func (x *ServerOptions) GetTlsKeyFile() string { + if x != nil { + return x.TlsKeyFile } return "" } -func (m *ServerOptions) GetTlsCaFile() string { - if m != nil { - return m.TlsCaFile +func (x *ServerOptions) GetTlsCaFile() string { + if x != nil { + return x.TlsCaFile } return "" } -func (m *ServerOptions) GetTlsSkipVerify() bool { - if m != nil { - return m.TlsSkipVerify +func (x *ServerOptions) GetTlsSkipVerify() bool { + if x != nil { + return x.TlsSkipVerify } return false } -func (m *ServerOptions) GetEnableCluster() bool { - if m != nil { - return m.EnableCluster +func (x *ServerOptions) GetEnableCluster() bool { + if x != nil { + return x.EnableCluster } return false } -func (m *ServerOptions) GetStatsDatabasePath() string { - if m != nil { - return m.StatsDatabasePath +func (x *ServerOptions) GetStatsDatabasePath() string { + if x != nil { + return x.StatsDatabasePath } return "" } -func (m *ServerOptions) GetStatsFlushIntervalSeconds() int32 { - if m != nil { - return m.StatsFlushIntervalSeconds +func (x *ServerOptions) GetStatsFlushIntervalSeconds() int32 { + if x != nil { + return x.StatsFlushIntervalSeconds } return 0 } -func (m *ServerOptions) GetHttpListenAddress() string { - if m != nil { - return m.HttpListenAddress +func (x *ServerOptions) GetHttpListenAddress() string { + if x != nil { + return x.HttpListenAddress } return "" } -func (m *ServerOptions) GetRemoteControlEnabled() bool { - if m != nil { - return m.RemoteControlEnabled +func (x *ServerOptions) GetRemoteControlEnabled() bool { + if x != nil { + return x.RemoteControlEnabled } return false } -func (m *ServerOptions) GetRemoteControlAddress() string { - if m != nil { - return m.RemoteControlAddress +func (x *ServerOptions) GetRemoteControlAddress() string { + if x != nil { + return x.RemoteControlAddress } return "" } -func (m *ServerOptions) GetRemoteControlApiToken() string { - if m != nil { - return m.RemoteControlApiToken +func (x *ServerOptions) GetRemoteControlApiToken() string { + if x != nil { + return x.RemoteControlApiToken } return "" } -func (m *ServerOptions) GetRemoteControlDisableTls() bool { - if m != nil { - return m.RemoteControlDisableTls +func (x *ServerOptions) GetRemoteControlDisableTls() bool { + if x != nil { + return x.RemoteControlDisableTls } return false } -func init() { - proto.RegisterType((*ServerOptions)(nil), "protos.opts.ServerOptions") +var File_opts_ps_opts_server_proto protoreflect.FileDescriptor + +var file_opts_ps_opts_server_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x22, 0x89, 0x06, 0x0a, 0x0d, 0x53, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, + 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, + 0x65, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, + 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x13, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x65, + 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x11, 0x67, 0x72, 0x70, 0x63, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x61, 0x74, 0x73, 0x55, 0x72, 0x6c, 0x12, 0x18, 0x0a, 0x07, + 0x75, 0x73, 0x65, 0x5f, 0x74, 0x6c, 0x73, 0x18, 0xf4, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, + 0x75, 0x73, 0x65, 0x54, 0x6c, 0x73, 0x12, 0x22, 0x0a, 0x0d, 0x74, 0x6c, 0x73, 0x5f, 0x63, 0x65, + 0x72, 0x74, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x74, + 0x6c, 0x73, 0x43, 0x65, 0x72, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0c, 0x74, 0x6c, + 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x74, 0x6c, 0x73, 0x4b, 0x65, 0x79, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x1e, 0x0a, 0x0b, + 0x74, 0x6c, 0x73, 0x5f, 0x63, 0x61, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x74, 0x6c, 0x73, 0x43, 0x61, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x26, 0x0a, 0x0f, + 0x74, 0x6c, 0x73, 0x5f, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x18, + 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x74, 0x6c, 0x73, 0x53, 0x6b, 0x69, 0x70, 0x56, 0x65, + 0x72, 0x69, 0x66, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x63, + 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x65, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x2e, 0x0a, 0x13, 0x73, + 0x74, 0x61, 0x74, 0x73, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x70, 0x61, + 0x74, 0x68, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x73, 0x74, 0x61, 0x74, 0x73, 0x44, + 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x3f, 0x0a, 0x1c, 0x73, + 0x74, 0x61, 0x74, 0x73, 0x5f, 0x66, 0x6c, 0x75, 0x73, 0x68, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x76, 0x61, 0x6c, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x19, 0x73, 0x74, 0x61, 0x74, 0x73, 0x46, 0x6c, 0x75, 0x73, 0x68, 0x49, 0x6e, 0x74, + 0x65, 0x72, 0x76, 0x61, 0x6c, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x2e, 0x0a, 0x13, + 0x68, 0x74, 0x74, 0x70, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x68, 0x74, 0x74, 0x70, 0x4c, + 0x69, 0x73, 0x74, 0x65, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x34, 0x0a, 0x16, + 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x65, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x72, 0x65, + 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x64, 0x12, 0x34, 0x0a, 0x16, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x12, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x14, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x37, 0x0a, 0x18, 0x72, 0x65, 0x6d, 0x6f, + 0x74, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x61, 0x70, 0x69, 0x5f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x72, 0x65, 0x6d, 0x6f, + 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x41, 0x70, 0x69, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x12, 0x3b, 0x0a, 0x1a, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x5f, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x74, 0x6c, 0x73, 0x18, + 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x17, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x6c, 0x73, 0x4a, 0x04, + 0x08, 0x0b, 0x10, 0x0e, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, + 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x6f, 0x70, 0x74, + 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_opts_ps_opts_server_proto_rawDescOnce sync.Once + file_opts_ps_opts_server_proto_rawDescData = file_opts_ps_opts_server_proto_rawDesc +) + +func file_opts_ps_opts_server_proto_rawDescGZIP() []byte { + file_opts_ps_opts_server_proto_rawDescOnce.Do(func() { + file_opts_ps_opts_server_proto_rawDescData = protoimpl.X.CompressGZIP(file_opts_ps_opts_server_proto_rawDescData) + }) + return file_opts_ps_opts_server_proto_rawDescData } -func init() { proto.RegisterFile("opts/ps_opts_server.proto", fileDescriptor_72fba0b7ae2941aa) } - -var fileDescriptor_72fba0b7ae2941aa = []byte{ - // 525 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x93, 0x4f, 0x6f, 0x13, 0x3d, - 0x10, 0xc6, 0x95, 0xb7, 0x6d, 0xfe, 0x38, 0x6f, 0xd3, 0x76, 0x5b, 0xa8, 0x83, 0x00, 0x45, 0x95, - 0x40, 0xb9, 0x90, 0x3d, 0x80, 0x84, 0x50, 0x0f, 0x08, 0x52, 0x2a, 0x05, 0x90, 0x40, 0x49, 0xe0, - 0xc0, 0xc5, 0xf2, 0xee, 0x4e, 0xb2, 0x56, 0x9c, 0xb5, 0xe5, 0x99, 0x8d, 0x94, 0x8f, 0xc0, 0xf7, - 0xe5, 0x03, 0x20, 0xdb, 0xe9, 0x21, 0x11, 0x27, 0xcb, 0xf3, 0x7b, 0x9e, 0x19, 0x7b, 0x3c, 0x66, - 0x7d, 0x63, 0x09, 0x53, 0x8b, 0xc2, 0xaf, 0x02, 0xc1, 0x6d, 0xc0, 0x8d, 0xac, 0x33, 0x64, 0x92, - 0x6e, 0x58, 0x70, 0xe4, 0xc9, 0xcd, 0xef, 0x26, 0x3b, 0x9d, 0x05, 0xfa, 0xcd, 0x92, 0x32, 0x15, - 0x26, 0xd7, 0xac, 0x55, 0x99, 0x02, 0x84, 0x2a, 0x78, 0x63, 0xd0, 0x18, 0x76, 0xa6, 0x4d, 0xbf, - 0x9d, 0x14, 0xc9, 0x33, 0xc6, 0x72, 0x5d, 0x23, 0x81, 0xf3, 0xec, 0xbf, 0xc0, 0x3a, 0xbb, 0xc8, - 0xa4, 0x48, 0x46, 0xec, 0x72, 0xe9, 0x6c, 0x2e, 0xb4, 0x42, 0x82, 0x4a, 0xc8, 0xa2, 0x70, 0x80, - 0xc8, 0x8f, 0x82, 0xee, 0xc2, 0xa3, 0xaf, 0x81, 0x7c, 0x88, 0xc0, 0xa7, 0x93, 0x35, 0x95, 0x82, - 0xcc, 0x0a, 0x2a, 0x7e, 0x1c, 0xd3, 0xf9, 0xc8, 0xdc, 0x07, 0x92, 0x3e, 0x6b, 0x57, 0x92, 0x50, - 0xd4, 0x4e, 0xf3, 0x93, 0xc1, 0xd1, 0xb0, 0x33, 0x6d, 0xf9, 0xfd, 0x0f, 0xa7, 0x13, 0xce, 0x5a, - 0x35, 0x82, 0x20, 0x8d, 0xfc, 0x8f, 0x4f, 0xdf, 0x9e, 0x36, 0x6b, 0x84, 0xb9, 0xc6, 0xe4, 0x86, - 0x9d, 0x92, 0x46, 0x91, 0x83, 0x23, 0xb1, 0x50, 0x1a, 0x78, 0x33, 0xa4, 0xed, 0x92, 0xc6, 0x31, - 0x38, 0xba, 0x57, 0x1a, 0x92, 0x01, 0xfb, 0xdf, 0x6b, 0x56, 0xb0, 0x8d, 0x92, 0x56, 0x90, 0x30, - 0xd2, 0xf8, 0x05, 0xb6, 0x41, 0xf1, 0x9c, 0x75, 0x43, 0x16, 0x19, 0x05, 0xed, 0x78, 0x34, 0x9f, - 0x43, 0x06, 0xfe, 0x92, 0x9d, 0x79, 0x8e, 0x2b, 0x65, 0xc5, 0x06, 0x9c, 0x5a, 0x6c, 0x79, 0x27, - 0x1c, 0xc3, 0x17, 0x9f, 0xad, 0x94, 0xfd, 0x19, 0x82, 0xc9, 0x0b, 0xd6, 0x83, 0x4a, 0x66, 0x1a, - 0xc4, 0xae, 0x4b, 0x9c, 0x45, 0x59, 0x8c, 0x8e, 0x63, 0xd0, 0x37, 0x0e, 0xc9, 0x5f, 0xb5, 0x90, - 0x24, 0x33, 0x89, 0x20, 0xac, 0xa4, 0x92, 0xf7, 0x62, 0xe3, 0x02, 0xba, 0xdb, 0x91, 0xef, 0x92, - 0xca, 0xe4, 0x3d, 0x7b, 0x1a, 0xf5, 0x0b, 0x5d, 0x63, 0x29, 0x54, 0x45, 0xe0, 0x36, 0x52, 0x0b, - 0x84, 0xdc, 0x54, 0x05, 0xf2, 0xb3, 0x41, 0x63, 0x78, 0x32, 0xed, 0x07, 0xcd, 0xbd, 0x97, 0x4c, - 0x76, 0x8a, 0x59, 0x14, 0xf8, 0x82, 0x25, 0x91, 0x3d, 0x7c, 0xa9, 0xf3, 0x58, 0xd0, 0xa3, 0xfd, - 0x97, 0x7a, 0xc3, 0x1e, 0x3b, 0x58, 0x1b, 0x02, 0x91, 0x9b, 0x8a, 0x9c, 0xd1, 0x22, 0x5e, 0xa0, - 0xe0, 0x17, 0xe1, 0x3e, 0x57, 0x91, 0x8e, 0x23, 0xfc, 0x14, 0xd9, 0x3f, 0x5c, 0x0f, 0x85, 0x92, - 0x50, 0x68, 0xdf, 0xf5, 0x50, 0xeb, 0x2d, 0xe3, 0x87, 0x2e, 0xab, 0x76, 0x33, 0x72, 0x19, 0x7c, - 0x8f, 0xf6, 0x7d, 0x56, 0xc5, 0x79, 0xb9, 0x65, 0x4f, 0x0e, 0x8c, 0x85, 0xc2, 0xd0, 0x7c, 0x3f, - 0x27, 0x57, 0xe1, 0xa0, 0xd7, 0x7b, 0xd6, 0xbb, 0xc8, 0xe7, 0x1a, 0x3f, 0x1f, 0xb7, 0xbb, 0xe7, - 0xbd, 0x8f, 0xb7, 0xbf, 0xde, 0x2d, 0x15, 0x95, 0x75, 0x36, 0xca, 0xcd, 0x3a, 0xcd, 0x24, 0xe5, - 0x65, 0x6e, 0x9c, 0x4d, 0xad, 0xae, 0xd7, 0x19, 0xb8, 0x57, 0x98, 0x97, 0xb0, 0x96, 0x98, 0x66, - 0xb5, 0xd2, 0x45, 0xba, 0x34, 0x69, 0xfc, 0x48, 0xa9, 0xff, 0x48, 0x59, 0x33, 0x6c, 0x5e, 0xff, - 0x0d, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x42, 0xc4, 0xc9, 0x79, 0x03, 0x00, 0x00, +var file_opts_ps_opts_server_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_opts_ps_opts_server_proto_goTypes = []interface{}{ + (*ServerOptions)(nil), // 0: protos.opts.ServerOptions +} +var file_opts_ps_opts_server_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_opts_ps_opts_server_proto_init() } +func file_opts_ps_opts_server_proto_init() { + if File_opts_ps_opts_server_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_opts_ps_opts_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ServerOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_opts_ps_opts_server_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_opts_ps_opts_server_proto_goTypes, + DependencyIndexes: file_opts_ps_opts_server_proto_depIdxs, + MessageInfos: file_opts_ps_opts_server_proto_msgTypes, + }.Build() + File_opts_ps_opts_server_proto = out.File + file_opts_ps_opts_server_proto_rawDesc = nil + file_opts_ps_opts_server_proto_goTypes = nil + file_opts_ps_opts_server_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_streamdal.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_streamdal.pb.go index 4fc931258..50211efd8 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_streamdal.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_streamdal.pb.go @@ -1,24 +1,24 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: opts/ps_opts_streamdal.proto package opts import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type StreamdalOutputType int32 @@ -27,22 +27,43 @@ const ( StreamdalOutputType_JSON StreamdalOutputType = 1 ) -var StreamdalOutputType_name = map[int32]string{ - 0: "TABLE", - 1: "JSON", -} +// Enum value maps for StreamdalOutputType. +var ( + StreamdalOutputType_name = map[int32]string{ + 0: "TABLE", + 1: "JSON", + } + StreamdalOutputType_value = map[string]int32{ + "TABLE": 0, + "JSON": 1, + } +) -var StreamdalOutputType_value = map[string]int32{ - "TABLE": 0, - "JSON": 1, +func (x StreamdalOutputType) Enum() *StreamdalOutputType { + p := new(StreamdalOutputType) + *p = x + return p } func (x StreamdalOutputType) String() string { - return proto.EnumName(StreamdalOutputType_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (StreamdalOutputType) Descriptor() protoreflect.EnumDescriptor { + return file_opts_ps_opts_streamdal_proto_enumTypes[0].Descriptor() +} + +func (StreamdalOutputType) Type() protoreflect.EnumType { + return &file_opts_ps_opts_streamdal_proto_enumTypes[0] +} + +func (x StreamdalOutputType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) } +// Deprecated: Use StreamdalOutputType.Descriptor instead. func (StreamdalOutputType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_49b11ca9129ce8de, []int{0} + return file_opts_ps_opts_streamdal_proto_rawDescGZIP(), []int{0} } type StreamdalReplayType int32 @@ -52,25 +73,50 @@ const ( StreamdalReplayType_CONTINUOUS StreamdalReplayType = 1 ) -var StreamdalReplayType_name = map[int32]string{ - 0: "SINGLE", - 1: "CONTINUOUS", -} +// Enum value maps for StreamdalReplayType. +var ( + StreamdalReplayType_name = map[int32]string{ + 0: "SINGLE", + 1: "CONTINUOUS", + } + StreamdalReplayType_value = map[string]int32{ + "SINGLE": 0, + "CONTINUOUS": 1, + } +) -var StreamdalReplayType_value = map[string]int32{ - "SINGLE": 0, - "CONTINUOUS": 1, +func (x StreamdalReplayType) Enum() *StreamdalReplayType { + p := new(StreamdalReplayType) + *p = x + return p } func (x StreamdalReplayType) String() string { - return proto.EnumName(StreamdalReplayType_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (StreamdalReplayType) Descriptor() protoreflect.EnumDescriptor { + return file_opts_ps_opts_streamdal_proto_enumTypes[1].Descriptor() +} + +func (StreamdalReplayType) Type() protoreflect.EnumType { + return &file_opts_ps_opts_streamdal_proto_enumTypes[1] } +func (x StreamdalReplayType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use StreamdalReplayType.Descriptor instead. func (StreamdalReplayType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_49b11ca9129ce8de, []int{1} + return file_opts_ps_opts_streamdal_proto_rawDescGZIP(), []int{1} } type StreamdalOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='How to output results (options: table json)',default=table,type=pbenum,pbenum_lowercase" OutputType StreamdalOutputType `protobuf:"varint,1,opt,name=output_type,json=outputType,proto3,enum=protos.opts.StreamdalOutputType" json:"output_type,omitempty" kong:"help='How to output results (options: table json)',default=table,type=pbenum,pbenum_lowercase"` // @gotags: kong:"help='Alternative URL to use for Streamdal API',default='https://api.streamdal.com'" @@ -86,360 +132,426 @@ type StreamdalOptions struct { // @gotags: kong:"cmd,help='Search operations'" Search *StreamdalSearchOptions `protobuf:"bytes,7,opt,name=search,proto3" json:"search,omitempty" kong:"cmd,help='Search operations'"` // @gotags: kong:"cmd,help='Archive a resource'" - Archive *StreamdalArchiveOptions `protobuf:"bytes,8,opt,name=archive,proto3" json:"archive,omitempty" kong:"cmd,help='Archive a resource'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Archive *StreamdalArchiveOptions `protobuf:"bytes,8,opt,name=archive,proto3" json:"archive,omitempty" kong:"cmd,help='Archive a resource'"` } -func (m *StreamdalOptions) Reset() { *m = StreamdalOptions{} } -func (m *StreamdalOptions) String() string { return proto.CompactTextString(m) } -func (*StreamdalOptions) ProtoMessage() {} -func (*StreamdalOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_49b11ca9129ce8de, []int{0} +func (x *StreamdalOptions) Reset() { + *x = StreamdalOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *StreamdalOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StreamdalOptions.Unmarshal(m, b) -} -func (m *StreamdalOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StreamdalOptions.Marshal(b, m, deterministic) +func (x *StreamdalOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *StreamdalOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamdalOptions.Merge(m, src) -} -func (m *StreamdalOptions) XXX_Size() int { - return xxx_messageInfo_StreamdalOptions.Size(m) -} -func (m *StreamdalOptions) XXX_DiscardUnknown() { - xxx_messageInfo_StreamdalOptions.DiscardUnknown(m) + +func (*StreamdalOptions) ProtoMessage() {} + +func (x *StreamdalOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_StreamdalOptions proto.InternalMessageInfo +// Deprecated: Use StreamdalOptions.ProtoReflect.Descriptor instead. +func (*StreamdalOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_streamdal_proto_rawDescGZIP(), []int{0} +} -func (m *StreamdalOptions) GetOutputType() StreamdalOutputType { - if m != nil { - return m.OutputType +func (x *StreamdalOptions) GetOutputType() StreamdalOutputType { + if x != nil { + return x.OutputType } return StreamdalOutputType_TABLE } -func (m *StreamdalOptions) GetApiUrl() string { - if m != nil { - return m.ApiUrl +func (x *StreamdalOptions) GetApiUrl() string { + if x != nil { + return x.ApiUrl } return "" } -func (m *StreamdalOptions) GetLogin() *StreamdalLoginOptions { - if m != nil { - return m.Login +func (x *StreamdalOptions) GetLogin() *StreamdalLoginOptions { + if x != nil { + return x.Login } return nil } -func (m *StreamdalOptions) GetLogout() *StreamdalLogoutOptions { - if m != nil { - return m.Logout +func (x *StreamdalOptions) GetLogout() *StreamdalLogoutOptions { + if x != nil { + return x.Logout } return nil } -func (m *StreamdalOptions) GetList() *StreamdalListOptions { - if m != nil { - return m.List +func (x *StreamdalOptions) GetList() *StreamdalListOptions { + if x != nil { + return x.List } return nil } -func (m *StreamdalOptions) GetCreate() *StreamdalCreateOptions { - if m != nil { - return m.Create +func (x *StreamdalOptions) GetCreate() *StreamdalCreateOptions { + if x != nil { + return x.Create } return nil } -func (m *StreamdalOptions) GetSearch() *StreamdalSearchOptions { - if m != nil { - return m.Search +func (x *StreamdalOptions) GetSearch() *StreamdalSearchOptions { + if x != nil { + return x.Search } return nil } -func (m *StreamdalOptions) GetArchive() *StreamdalArchiveOptions { - if m != nil { - return m.Archive +func (x *StreamdalOptions) GetArchive() *StreamdalArchiveOptions { + if x != nil { + return x.Archive } return nil } type StreamdalLoginOptions struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } -func (m *StreamdalLoginOptions) Reset() { *m = StreamdalLoginOptions{} } -func (m *StreamdalLoginOptions) String() string { return proto.CompactTextString(m) } -func (*StreamdalLoginOptions) ProtoMessage() {} -func (*StreamdalLoginOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_49b11ca9129ce8de, []int{1} +func (x *StreamdalLoginOptions) Reset() { + *x = StreamdalLoginOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *StreamdalLoginOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StreamdalLoginOptions.Unmarshal(m, b) +func (x *StreamdalLoginOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *StreamdalLoginOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StreamdalLoginOptions.Marshal(b, m, deterministic) + +func (*StreamdalLoginOptions) ProtoMessage() {} + +func (x *StreamdalLoginOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StreamdalLoginOptions.ProtoReflect.Descriptor instead. +func (*StreamdalLoginOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_streamdal_proto_rawDescGZIP(), []int{1} } -func (m *StreamdalLoginOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamdalLoginOptions.Merge(m, src) + +type StreamdalLogoutOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } -func (m *StreamdalLoginOptions) XXX_Size() int { - return xxx_messageInfo_StreamdalLoginOptions.Size(m) + +func (x *StreamdalLogoutOptions) Reset() { + *x = StreamdalLogoutOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *StreamdalLoginOptions) XXX_DiscardUnknown() { - xxx_messageInfo_StreamdalLoginOptions.DiscardUnknown(m) + +func (x *StreamdalLogoutOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_StreamdalLoginOptions proto.InternalMessageInfo +func (*StreamdalLogoutOptions) ProtoMessage() {} -type StreamdalLogoutOptions struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (x *StreamdalLogoutOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func (m *StreamdalLogoutOptions) Reset() { *m = StreamdalLogoutOptions{} } -func (m *StreamdalLogoutOptions) String() string { return proto.CompactTextString(m) } -func (*StreamdalLogoutOptions) ProtoMessage() {} +// Deprecated: Use StreamdalLogoutOptions.ProtoReflect.Descriptor instead. func (*StreamdalLogoutOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_49b11ca9129ce8de, []int{2} + return file_opts_ps_opts_streamdal_proto_rawDescGZIP(), []int{2} } -func (m *StreamdalLogoutOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StreamdalLogoutOptions.Unmarshal(m, b) -} -func (m *StreamdalLogoutOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StreamdalLogoutOptions.Marshal(b, m, deterministic) -} -func (m *StreamdalLogoutOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamdalLogoutOptions.Merge(m, src) +type StreamdalListCollectionOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } -func (m *StreamdalLogoutOptions) XXX_Size() int { - return xxx_messageInfo_StreamdalLogoutOptions.Size(m) + +func (x *StreamdalListCollectionOptions) Reset() { + *x = StreamdalListCollectionOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *StreamdalLogoutOptions) XXX_DiscardUnknown() { - xxx_messageInfo_StreamdalLogoutOptions.DiscardUnknown(m) + +func (x *StreamdalListCollectionOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_StreamdalLogoutOptions proto.InternalMessageInfo +func (*StreamdalListCollectionOptions) ProtoMessage() {} -type StreamdalListCollectionOptions struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (x *StreamdalListCollectionOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func (m *StreamdalListCollectionOptions) Reset() { *m = StreamdalListCollectionOptions{} } -func (m *StreamdalListCollectionOptions) String() string { return proto.CompactTextString(m) } -func (*StreamdalListCollectionOptions) ProtoMessage() {} +// Deprecated: Use StreamdalListCollectionOptions.ProtoReflect.Descriptor instead. func (*StreamdalListCollectionOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_49b11ca9129ce8de, []int{3} + return file_opts_ps_opts_streamdal_proto_rawDescGZIP(), []int{3} } -func (m *StreamdalListCollectionOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StreamdalListCollectionOptions.Unmarshal(m, b) -} -func (m *StreamdalListCollectionOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StreamdalListCollectionOptions.Marshal(b, m, deterministic) -} -func (m *StreamdalListCollectionOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamdalListCollectionOptions.Merge(m, src) +type StreamdalListDestinationOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } -func (m *StreamdalListCollectionOptions) XXX_Size() int { - return xxx_messageInfo_StreamdalListCollectionOptions.Size(m) + +func (x *StreamdalListDestinationOptions) Reset() { + *x = StreamdalListDestinationOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *StreamdalListCollectionOptions) XXX_DiscardUnknown() { - xxx_messageInfo_StreamdalListCollectionOptions.DiscardUnknown(m) + +func (x *StreamdalListDestinationOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_StreamdalListCollectionOptions proto.InternalMessageInfo +func (*StreamdalListDestinationOptions) ProtoMessage() {} -type StreamdalListDestinationOptions struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (x *StreamdalListDestinationOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func (m *StreamdalListDestinationOptions) Reset() { *m = StreamdalListDestinationOptions{} } -func (m *StreamdalListDestinationOptions) String() string { return proto.CompactTextString(m) } -func (*StreamdalListDestinationOptions) ProtoMessage() {} +// Deprecated: Use StreamdalListDestinationOptions.ProtoReflect.Descriptor instead. func (*StreamdalListDestinationOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_49b11ca9129ce8de, []int{4} + return file_opts_ps_opts_streamdal_proto_rawDescGZIP(), []int{4} } -func (m *StreamdalListDestinationOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StreamdalListDestinationOptions.Unmarshal(m, b) -} -func (m *StreamdalListDestinationOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StreamdalListDestinationOptions.Marshal(b, m, deterministic) -} -func (m *StreamdalListDestinationOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamdalListDestinationOptions.Merge(m, src) +type StreamdalListSchemaOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } -func (m *StreamdalListDestinationOptions) XXX_Size() int { - return xxx_messageInfo_StreamdalListDestinationOptions.Size(m) + +func (x *StreamdalListSchemaOptions) Reset() { + *x = StreamdalListSchemaOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *StreamdalListDestinationOptions) XXX_DiscardUnknown() { - xxx_messageInfo_StreamdalListDestinationOptions.DiscardUnknown(m) + +func (x *StreamdalListSchemaOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_StreamdalListDestinationOptions proto.InternalMessageInfo +func (*StreamdalListSchemaOptions) ProtoMessage() {} -type StreamdalListSchemaOptions struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (x *StreamdalListSchemaOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func (m *StreamdalListSchemaOptions) Reset() { *m = StreamdalListSchemaOptions{} } -func (m *StreamdalListSchemaOptions) String() string { return proto.CompactTextString(m) } -func (*StreamdalListSchemaOptions) ProtoMessage() {} +// Deprecated: Use StreamdalListSchemaOptions.ProtoReflect.Descriptor instead. func (*StreamdalListSchemaOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_49b11ca9129ce8de, []int{5} + return file_opts_ps_opts_streamdal_proto_rawDescGZIP(), []int{5} } -func (m *StreamdalListSchemaOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StreamdalListSchemaOptions.Unmarshal(m, b) -} -func (m *StreamdalListSchemaOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StreamdalListSchemaOptions.Marshal(b, m, deterministic) -} -func (m *StreamdalListSchemaOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamdalListSchemaOptions.Merge(m, src) +type StreamdalListReplayOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } -func (m *StreamdalListSchemaOptions) XXX_Size() int { - return xxx_messageInfo_StreamdalListSchemaOptions.Size(m) + +func (x *StreamdalListReplayOptions) Reset() { + *x = StreamdalListReplayOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *StreamdalListSchemaOptions) XXX_DiscardUnknown() { - xxx_messageInfo_StreamdalListSchemaOptions.DiscardUnknown(m) + +func (x *StreamdalListReplayOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_StreamdalListSchemaOptions proto.InternalMessageInfo +func (*StreamdalListReplayOptions) ProtoMessage() {} -type StreamdalListReplayOptions struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (x *StreamdalListReplayOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func (m *StreamdalListReplayOptions) Reset() { *m = StreamdalListReplayOptions{} } -func (m *StreamdalListReplayOptions) String() string { return proto.CompactTextString(m) } -func (*StreamdalListReplayOptions) ProtoMessage() {} +// Deprecated: Use StreamdalListReplayOptions.ProtoReflect.Descriptor instead. func (*StreamdalListReplayOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_49b11ca9129ce8de, []int{6} -} - -func (m *StreamdalListReplayOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StreamdalListReplayOptions.Unmarshal(m, b) -} -func (m *StreamdalListReplayOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StreamdalListReplayOptions.Marshal(b, m, deterministic) -} -func (m *StreamdalListReplayOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamdalListReplayOptions.Merge(m, src) -} -func (m *StreamdalListReplayOptions) XXX_Size() int { - return xxx_messageInfo_StreamdalListReplayOptions.Size(m) -} -func (m *StreamdalListReplayOptions) XXX_DiscardUnknown() { - xxx_messageInfo_StreamdalListReplayOptions.DiscardUnknown(m) + return file_opts_ps_opts_streamdal_proto_rawDescGZIP(), []int{6} } -var xxx_messageInfo_StreamdalListReplayOptions proto.InternalMessageInfo - type StreamdalArchiveOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed,cmd,help='Archive a replay'" - Replay *StreamdalArchiveReplayOptions `protobuf:"bytes,1,opt,name=replay,proto3" json:"replay,omitempty" kong:"embed,cmd,help='Archive a replay'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Replay *StreamdalArchiveReplayOptions `protobuf:"bytes,1,opt,name=replay,proto3" json:"replay,omitempty" kong:"embed,cmd,help='Archive a replay'"` } -func (m *StreamdalArchiveOptions) Reset() { *m = StreamdalArchiveOptions{} } -func (m *StreamdalArchiveOptions) String() string { return proto.CompactTextString(m) } -func (*StreamdalArchiveOptions) ProtoMessage() {} -func (*StreamdalArchiveOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_49b11ca9129ce8de, []int{7} +func (x *StreamdalArchiveOptions) Reset() { + *x = StreamdalArchiveOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *StreamdalArchiveOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StreamdalArchiveOptions.Unmarshal(m, b) -} -func (m *StreamdalArchiveOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StreamdalArchiveOptions.Marshal(b, m, deterministic) -} -func (m *StreamdalArchiveOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamdalArchiveOptions.Merge(m, src) +func (x *StreamdalArchiveOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *StreamdalArchiveOptions) XXX_Size() int { - return xxx_messageInfo_StreamdalArchiveOptions.Size(m) -} -func (m *StreamdalArchiveOptions) XXX_DiscardUnknown() { - xxx_messageInfo_StreamdalArchiveOptions.DiscardUnknown(m) + +func (*StreamdalArchiveOptions) ProtoMessage() {} + +func (x *StreamdalArchiveOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_StreamdalArchiveOptions proto.InternalMessageInfo +// Deprecated: Use StreamdalArchiveOptions.ProtoReflect.Descriptor instead. +func (*StreamdalArchiveOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_streamdal_proto_rawDescGZIP(), []int{7} +} -func (m *StreamdalArchiveOptions) GetReplay() *StreamdalArchiveReplayOptions { - if m != nil { - return m.Replay +func (x *StreamdalArchiveOptions) GetReplay() *StreamdalArchiveReplayOptions { + if x != nil { + return x.Replay } return nil } type StreamdalArchiveReplayOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Replay ID to archive',required" - ReplayId string `protobuf:"bytes,1,opt,name=replay_id,json=replayId,proto3" json:"replay_id,omitempty" kong:"help='Replay ID to archive',required"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ReplayId string `protobuf:"bytes,1,opt,name=replay_id,json=replayId,proto3" json:"replay_id,omitempty" kong:"help='Replay ID to archive',required"` } -func (m *StreamdalArchiveReplayOptions) Reset() { *m = StreamdalArchiveReplayOptions{} } -func (m *StreamdalArchiveReplayOptions) String() string { return proto.CompactTextString(m) } -func (*StreamdalArchiveReplayOptions) ProtoMessage() {} -func (*StreamdalArchiveReplayOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_49b11ca9129ce8de, []int{8} +func (x *StreamdalArchiveReplayOptions) Reset() { + *x = StreamdalArchiveReplayOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *StreamdalArchiveReplayOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StreamdalArchiveReplayOptions.Unmarshal(m, b) +func (x *StreamdalArchiveReplayOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *StreamdalArchiveReplayOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StreamdalArchiveReplayOptions.Marshal(b, m, deterministic) -} -func (m *StreamdalArchiveReplayOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamdalArchiveReplayOptions.Merge(m, src) -} -func (m *StreamdalArchiveReplayOptions) XXX_Size() int { - return xxx_messageInfo_StreamdalArchiveReplayOptions.Size(m) -} -func (m *StreamdalArchiveReplayOptions) XXX_DiscardUnknown() { - xxx_messageInfo_StreamdalArchiveReplayOptions.DiscardUnknown(m) + +func (*StreamdalArchiveReplayOptions) ProtoMessage() {} + +func (x *StreamdalArchiveReplayOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_StreamdalArchiveReplayOptions proto.InternalMessageInfo +// Deprecated: Use StreamdalArchiveReplayOptions.ProtoReflect.Descriptor instead. +func (*StreamdalArchiveReplayOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_streamdal_proto_rawDescGZIP(), []int{8} +} -func (m *StreamdalArchiveReplayOptions) GetReplayId() string { - if m != nil { - return m.ReplayId +func (x *StreamdalArchiveReplayOptions) GetReplayId() string { + if x != nil { + return x.ReplayId } return "" } type StreamdalListOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"cmd,help='List all collections'" Collection *StreamdalListCollectionOptions `protobuf:"bytes,1,opt,name=collection,proto3" json:"collection,omitempty" kong:"cmd,help='List all collections'"` // @gotags: kong:"cmd,help='List all destinations'" @@ -447,182 +559,206 @@ type StreamdalListOptions struct { // @gotags: kong:"cmd,help='List all replays'" Replay *StreamdalListReplayOptions `protobuf:"bytes,3,opt,name=replay,proto3" json:"replay,omitempty" kong:"cmd,help='List all replays'"` // @gotags: kong:"cmd,help='List all schemas'" - Schema *StreamdalListSchemaOptions `protobuf:"bytes,4,opt,name=schema,proto3" json:"schema,omitempty" kong:"cmd,help='List all schemas'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Schema *StreamdalListSchemaOptions `protobuf:"bytes,4,opt,name=schema,proto3" json:"schema,omitempty" kong:"cmd,help='List all schemas'"` } -func (m *StreamdalListOptions) Reset() { *m = StreamdalListOptions{} } -func (m *StreamdalListOptions) String() string { return proto.CompactTextString(m) } -func (*StreamdalListOptions) ProtoMessage() {} -func (*StreamdalListOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_49b11ca9129ce8de, []int{9} +func (x *StreamdalListOptions) Reset() { + *x = StreamdalListOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *StreamdalListOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StreamdalListOptions.Unmarshal(m, b) -} -func (m *StreamdalListOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StreamdalListOptions.Marshal(b, m, deterministic) +func (x *StreamdalListOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *StreamdalListOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamdalListOptions.Merge(m, src) -} -func (m *StreamdalListOptions) XXX_Size() int { - return xxx_messageInfo_StreamdalListOptions.Size(m) -} -func (m *StreamdalListOptions) XXX_DiscardUnknown() { - xxx_messageInfo_StreamdalListOptions.DiscardUnknown(m) + +func (*StreamdalListOptions) ProtoMessage() {} + +func (x *StreamdalListOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_StreamdalListOptions proto.InternalMessageInfo +// Deprecated: Use StreamdalListOptions.ProtoReflect.Descriptor instead. +func (*StreamdalListOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_streamdal_proto_rawDescGZIP(), []int{9} +} -func (m *StreamdalListOptions) GetCollection() *StreamdalListCollectionOptions { - if m != nil { - return m.Collection +func (x *StreamdalListOptions) GetCollection() *StreamdalListCollectionOptions { + if x != nil { + return x.Collection } return nil } -func (m *StreamdalListOptions) GetDestination() *StreamdalListDestinationOptions { - if m != nil { - return m.Destination +func (x *StreamdalListOptions) GetDestination() *StreamdalListDestinationOptions { + if x != nil { + return x.Destination } return nil } -func (m *StreamdalListOptions) GetReplay() *StreamdalListReplayOptions { - if m != nil { - return m.Replay +func (x *StreamdalListOptions) GetReplay() *StreamdalListReplayOptions { + if x != nil { + return x.Replay } return nil } -func (m *StreamdalListOptions) GetSchema() *StreamdalListSchemaOptions { - if m != nil { - return m.Schema +func (x *StreamdalListOptions) GetSchema() *StreamdalListSchemaOptions { + if x != nil { + return x.Schema } return nil } type StreamdalCreateOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"cmd,help='Create a collection'" Collection *StreamdalCreateCollectionOptions `protobuf:"bytes,1,opt,name=collection,proto3" json:"collection,omitempty" kong:"cmd,help='Create a collection'"` // @gotags: kong:"cmd,help='Create a replay'" Replay *StreamdalCreateReplayOptions `protobuf:"bytes,2,opt,name=replay,proto3" json:"replay,omitempty" kong:"cmd,help='Create a replay'"` // @gotags: kong:"cmd,help='Create a destination'" - Destination *StreamdalCreateDestinationOptions `protobuf:"bytes,3,opt,name=destination,proto3" json:"destination,omitempty" kong:"cmd,help='Create a destination'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Destination *StreamdalCreateDestinationOptions `protobuf:"bytes,3,opt,name=destination,proto3" json:"destination,omitempty" kong:"cmd,help='Create a destination'"` } -func (m *StreamdalCreateOptions) Reset() { *m = StreamdalCreateOptions{} } -func (m *StreamdalCreateOptions) String() string { return proto.CompactTextString(m) } -func (*StreamdalCreateOptions) ProtoMessage() {} -func (*StreamdalCreateOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_49b11ca9129ce8de, []int{10} +func (x *StreamdalCreateOptions) Reset() { + *x = StreamdalCreateOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *StreamdalCreateOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StreamdalCreateOptions.Unmarshal(m, b) -} -func (m *StreamdalCreateOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StreamdalCreateOptions.Marshal(b, m, deterministic) -} -func (m *StreamdalCreateOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamdalCreateOptions.Merge(m, src) +func (x *StreamdalCreateOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *StreamdalCreateOptions) XXX_Size() int { - return xxx_messageInfo_StreamdalCreateOptions.Size(m) -} -func (m *StreamdalCreateOptions) XXX_DiscardUnknown() { - xxx_messageInfo_StreamdalCreateOptions.DiscardUnknown(m) + +func (*StreamdalCreateOptions) ProtoMessage() {} + +func (x *StreamdalCreateOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_StreamdalCreateOptions proto.InternalMessageInfo +// Deprecated: Use StreamdalCreateOptions.ProtoReflect.Descriptor instead. +func (*StreamdalCreateOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_streamdal_proto_rawDescGZIP(), []int{10} +} -func (m *StreamdalCreateOptions) GetCollection() *StreamdalCreateCollectionOptions { - if m != nil { - return m.Collection +func (x *StreamdalCreateOptions) GetCollection() *StreamdalCreateCollectionOptions { + if x != nil { + return x.Collection } return nil } -func (m *StreamdalCreateOptions) GetReplay() *StreamdalCreateReplayOptions { - if m != nil { - return m.Replay +func (x *StreamdalCreateOptions) GetReplay() *StreamdalCreateReplayOptions { + if x != nil { + return x.Replay } return nil } -func (m *StreamdalCreateOptions) GetDestination() *StreamdalCreateDestinationOptions { - if m != nil { - return m.Destination +func (x *StreamdalCreateOptions) GetDestination() *StreamdalCreateDestinationOptions { + if x != nil { + return x.Destination } return nil } type StreamdalSearchOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Query to perform',default='*'" Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty" kong:"help='Query to perform',default='*'"` // @gotags: kong:"help='Collection id to query',required" CollectionId string `protobuf:"bytes,2,opt,name=collection_id,json=collectionId,proto3" json:"collection_id,omitempty" kong:"help='Collection id to query',required"` // @gotags: kong:"help='Which page to display',default=1" - Page int32 `protobuf:"varint,3,opt,name=page,proto3" json:"page,omitempty" kong:"help='Which page to display',default=1"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Page int32 `protobuf:"varint,3,opt,name=page,proto3" json:"page,omitempty" kong:"help='Which page to display',default=1"` } -func (m *StreamdalSearchOptions) Reset() { *m = StreamdalSearchOptions{} } -func (m *StreamdalSearchOptions) String() string { return proto.CompactTextString(m) } -func (*StreamdalSearchOptions) ProtoMessage() {} -func (*StreamdalSearchOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_49b11ca9129ce8de, []int{11} +func (x *StreamdalSearchOptions) Reset() { + *x = StreamdalSearchOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *StreamdalSearchOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StreamdalSearchOptions.Unmarshal(m, b) -} -func (m *StreamdalSearchOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StreamdalSearchOptions.Marshal(b, m, deterministic) -} -func (m *StreamdalSearchOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamdalSearchOptions.Merge(m, src) -} -func (m *StreamdalSearchOptions) XXX_Size() int { - return xxx_messageInfo_StreamdalSearchOptions.Size(m) +func (x *StreamdalSearchOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *StreamdalSearchOptions) XXX_DiscardUnknown() { - xxx_messageInfo_StreamdalSearchOptions.DiscardUnknown(m) + +func (*StreamdalSearchOptions) ProtoMessage() {} + +func (x *StreamdalSearchOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_StreamdalSearchOptions proto.InternalMessageInfo +// Deprecated: Use StreamdalSearchOptions.ProtoReflect.Descriptor instead. +func (*StreamdalSearchOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_streamdal_proto_rawDescGZIP(), []int{11} +} -func (m *StreamdalSearchOptions) GetQuery() string { - if m != nil { - return m.Query +func (x *StreamdalSearchOptions) GetQuery() string { + if x != nil { + return x.Query } return "" } -func (m *StreamdalSearchOptions) GetCollectionId() string { - if m != nil { - return m.CollectionId +func (x *StreamdalSearchOptions) GetCollectionId() string { + if x != nil { + return x.CollectionId } return "" } -func (m *StreamdalSearchOptions) GetPage() int32 { - if m != nil { - return m.Page +func (x *StreamdalSearchOptions) GetPage() int32 { + if x != nil { + return x.Page } return 0 } type StreamdalCreateCollectionOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Friendly name for the collection',required" Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty" kong:"help='Friendly name for the collection',required"` // @gotags: kong:"help='Schema the collection will use (can be obtained running _plumber streamdal list schema_)',required" @@ -636,87 +772,95 @@ type StreamdalCreateCollectionOptions struct { // @gotags: kong:"help='(Shallow Envelope Protobuf Schemas Only) Payload Message Name (Ex: events.ShallowPayload)'" PayloadFieldMessage string `protobuf:"bytes,6,opt,name=payload_field_message,json=payloadFieldMessage,proto3" json:"payload_field_message,omitempty" kong:"help='(Shallow Envelope Protobuf Schemas Only) Payload Message Name (Ex: events.ShallowPayload)'"` // @gotags: kong:"help='(Shallow Envelope Protobuf Schemas Only) Field ID containing the message encoded with Payload Message'" - PayloadFieldId string `protobuf:"bytes,7,opt,name=payload_field_id,json=payloadFieldId,proto3" json:"payload_field_id,omitempty" kong:"help='(Shallow Envelope Protobuf Schemas Only) Field ID containing the message encoded with Payload Message'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + PayloadFieldId string `protobuf:"bytes,7,opt,name=payload_field_id,json=payloadFieldId,proto3" json:"payload_field_id,omitempty" kong:"help='(Shallow Envelope Protobuf Schemas Only) Field ID containing the message encoded with Payload Message'"` } -func (m *StreamdalCreateCollectionOptions) Reset() { *m = StreamdalCreateCollectionOptions{} } -func (m *StreamdalCreateCollectionOptions) String() string { return proto.CompactTextString(m) } -func (*StreamdalCreateCollectionOptions) ProtoMessage() {} -func (*StreamdalCreateCollectionOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_49b11ca9129ce8de, []int{12} +func (x *StreamdalCreateCollectionOptions) Reset() { + *x = StreamdalCreateCollectionOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *StreamdalCreateCollectionOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StreamdalCreateCollectionOptions.Unmarshal(m, b) -} -func (m *StreamdalCreateCollectionOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StreamdalCreateCollectionOptions.Marshal(b, m, deterministic) +func (x *StreamdalCreateCollectionOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *StreamdalCreateCollectionOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamdalCreateCollectionOptions.Merge(m, src) -} -func (m *StreamdalCreateCollectionOptions) XXX_Size() int { - return xxx_messageInfo_StreamdalCreateCollectionOptions.Size(m) -} -func (m *StreamdalCreateCollectionOptions) XXX_DiscardUnknown() { - xxx_messageInfo_StreamdalCreateCollectionOptions.DiscardUnknown(m) + +func (*StreamdalCreateCollectionOptions) ProtoMessage() {} + +func (x *StreamdalCreateCollectionOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_StreamdalCreateCollectionOptions proto.InternalMessageInfo +// Deprecated: Use StreamdalCreateCollectionOptions.ProtoReflect.Descriptor instead. +func (*StreamdalCreateCollectionOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_streamdal_proto_rawDescGZIP(), []int{12} +} -func (m *StreamdalCreateCollectionOptions) GetName() string { - if m != nil { - return m.Name +func (x *StreamdalCreateCollectionOptions) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *StreamdalCreateCollectionOptions) GetSchemaId() string { - if m != nil { - return m.SchemaId +func (x *StreamdalCreateCollectionOptions) GetSchemaId() string { + if x != nil { + return x.SchemaId } return "" } -func (m *StreamdalCreateCollectionOptions) GetNotes() string { - if m != nil { - return m.Notes +func (x *StreamdalCreateCollectionOptions) GetNotes() string { + if x != nil { + return x.Notes } return "" } -func (m *StreamdalCreateCollectionOptions) GetEnvelopeType() string { - if m != nil { - return m.EnvelopeType +func (x *StreamdalCreateCollectionOptions) GetEnvelopeType() string { + if x != nil { + return x.EnvelopeType } return "" } -func (m *StreamdalCreateCollectionOptions) GetEnvelopeRootMessage() string { - if m != nil { - return m.EnvelopeRootMessage +func (x *StreamdalCreateCollectionOptions) GetEnvelopeRootMessage() string { + if x != nil { + return x.EnvelopeRootMessage } return "" } -func (m *StreamdalCreateCollectionOptions) GetPayloadFieldMessage() string { - if m != nil { - return m.PayloadFieldMessage +func (x *StreamdalCreateCollectionOptions) GetPayloadFieldMessage() string { + if x != nil { + return x.PayloadFieldMessage } return "" } -func (m *StreamdalCreateCollectionOptions) GetPayloadFieldId() string { - if m != nil { - return m.PayloadFieldId +func (x *StreamdalCreateCollectionOptions) GetPayloadFieldId() string { + if x != nil { + return x.PayloadFieldId } return "" } type StreamdalCreateReplayOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Friendly name to assign to the replay',required" Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty" kong:"help='Friendly name to assign to the replay',required"` // @gotags: kong:"help='One-time/single or continuous replay (options: single, continuous)',type=pbenum,pbenum_lowercase,default=single" @@ -732,94 +876,102 @@ type StreamdalCreateReplayOptions struct { // @gotags: kong:"help='Where to begin search (RFC3339 timestamp)',required" FromTimestamp string `protobuf:"bytes,7,opt,name=from_timestamp,json=fromTimestamp,proto3" json:"from_timestamp,omitempty" kong:"help='Where to begin search (RFC3339 timestamp)',required"` // @gotags: kong:"help='Where to end search (RFC3339 timestamp)',required" - ToTimestamp string `protobuf:"bytes,8,opt,name=to_timestamp,json=toTimestamp,proto3" json:"to_timestamp,omitempty" kong:"help='Where to end search (RFC3339 timestamp)',required"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ToTimestamp string `protobuf:"bytes,8,opt,name=to_timestamp,json=toTimestamp,proto3" json:"to_timestamp,omitempty" kong:"help='Where to end search (RFC3339 timestamp)',required"` } -func (m *StreamdalCreateReplayOptions) Reset() { *m = StreamdalCreateReplayOptions{} } -func (m *StreamdalCreateReplayOptions) String() string { return proto.CompactTextString(m) } -func (*StreamdalCreateReplayOptions) ProtoMessage() {} -func (*StreamdalCreateReplayOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_49b11ca9129ce8de, []int{13} +func (x *StreamdalCreateReplayOptions) Reset() { + *x = StreamdalCreateReplayOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *StreamdalCreateReplayOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StreamdalCreateReplayOptions.Unmarshal(m, b) -} -func (m *StreamdalCreateReplayOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StreamdalCreateReplayOptions.Marshal(b, m, deterministic) -} -func (m *StreamdalCreateReplayOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamdalCreateReplayOptions.Merge(m, src) +func (x *StreamdalCreateReplayOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *StreamdalCreateReplayOptions) XXX_Size() int { - return xxx_messageInfo_StreamdalCreateReplayOptions.Size(m) -} -func (m *StreamdalCreateReplayOptions) XXX_DiscardUnknown() { - xxx_messageInfo_StreamdalCreateReplayOptions.DiscardUnknown(m) + +func (*StreamdalCreateReplayOptions) ProtoMessage() {} + +func (x *StreamdalCreateReplayOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_StreamdalCreateReplayOptions proto.InternalMessageInfo +// Deprecated: Use StreamdalCreateReplayOptions.ProtoReflect.Descriptor instead. +func (*StreamdalCreateReplayOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_streamdal_proto_rawDescGZIP(), []int{13} +} -func (m *StreamdalCreateReplayOptions) GetName() string { - if m != nil { - return m.Name +func (x *StreamdalCreateReplayOptions) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *StreamdalCreateReplayOptions) GetType() StreamdalReplayType { - if m != nil { - return m.Type +func (x *StreamdalCreateReplayOptions) GetType() StreamdalReplayType { + if x != nil { + return x.Type } return StreamdalReplayType_SINGLE } -func (m *StreamdalCreateReplayOptions) GetNotes() string { - if m != nil { - return m.Notes +func (x *StreamdalCreateReplayOptions) GetNotes() string { + if x != nil { + return x.Notes } return "" } -func (m *StreamdalCreateReplayOptions) GetCollectionId() string { - if m != nil { - return m.CollectionId +func (x *StreamdalCreateReplayOptions) GetCollectionId() string { + if x != nil { + return x.CollectionId } return "" } -func (m *StreamdalCreateReplayOptions) GetDestinationId() string { - if m != nil { - return m.DestinationId +func (x *StreamdalCreateReplayOptions) GetDestinationId() string { + if x != nil { + return x.DestinationId } return "" } -func (m *StreamdalCreateReplayOptions) GetQuery() string { - if m != nil { - return m.Query +func (x *StreamdalCreateReplayOptions) GetQuery() string { + if x != nil { + return x.Query } return "" } -func (m *StreamdalCreateReplayOptions) GetFromTimestamp() string { - if m != nil { - return m.FromTimestamp +func (x *StreamdalCreateReplayOptions) GetFromTimestamp() string { + if x != nil { + return x.FromTimestamp } return "" } -func (m *StreamdalCreateReplayOptions) GetToTimestamp() string { - if m != nil { - return m.ToTimestamp +func (x *StreamdalCreateReplayOptions) GetToTimestamp() string { + if x != nil { + return x.ToTimestamp } return "" } type StreamdalCreateDestinationOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Friendly name to assign to the destination',required" Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty" kong:"help='Friendly name to assign to the destination',required"` // @gotags: kong:"help='Any notes to include with the destination'" @@ -836,233 +988,628 @@ type StreamdalCreateDestinationOptions struct { // @gotags: kong:"cmd,help='AWS Simple Queue System'" AwsSqs *WriteGroupAWSSQSOptions `protobuf:"bytes,103,opt,name=aws_sqs,json=awsSqs,proto3" json:"aws_sqs,omitempty" kong:"cmd,help='AWS Simple Queue System'"` // @gotags: kong:"cmd,help='HTTP Destination (POST)'" - Http *HTTPDestination `protobuf:"bytes,104,opt,name=http,proto3" json:"http,omitempty" kong:"cmd,help='HTTP Destination (POST)'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Http *HTTPDestination `protobuf:"bytes,104,opt,name=http,proto3" json:"http,omitempty" kong:"cmd,help='HTTP Destination (POST)'"` } -func (m *StreamdalCreateDestinationOptions) Reset() { *m = StreamdalCreateDestinationOptions{} } -func (m *StreamdalCreateDestinationOptions) String() string { return proto.CompactTextString(m) } -func (*StreamdalCreateDestinationOptions) ProtoMessage() {} -func (*StreamdalCreateDestinationOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_49b11ca9129ce8de, []int{14} +func (x *StreamdalCreateDestinationOptions) Reset() { + *x = StreamdalCreateDestinationOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *StreamdalCreateDestinationOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StreamdalCreateDestinationOptions.Unmarshal(m, b) +func (x *StreamdalCreateDestinationOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *StreamdalCreateDestinationOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StreamdalCreateDestinationOptions.Marshal(b, m, deterministic) -} -func (m *StreamdalCreateDestinationOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamdalCreateDestinationOptions.Merge(m, src) -} -func (m *StreamdalCreateDestinationOptions) XXX_Size() int { - return xxx_messageInfo_StreamdalCreateDestinationOptions.Size(m) -} -func (m *StreamdalCreateDestinationOptions) XXX_DiscardUnknown() { - xxx_messageInfo_StreamdalCreateDestinationOptions.DiscardUnknown(m) + +func (*StreamdalCreateDestinationOptions) ProtoMessage() {} + +func (x *StreamdalCreateDestinationOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_StreamdalCreateDestinationOptions proto.InternalMessageInfo +// Deprecated: Use StreamdalCreateDestinationOptions.ProtoReflect.Descriptor instead. +func (*StreamdalCreateDestinationOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_streamdal_proto_rawDescGZIP(), []int{14} +} -func (m *StreamdalCreateDestinationOptions) GetName() string { - if m != nil { - return m.Name +func (x *StreamdalCreateDestinationOptions) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *StreamdalCreateDestinationOptions) GetNotes() string { - if m != nil { - return m.Notes +func (x *StreamdalCreateDestinationOptions) GetNotes() string { + if x != nil { + return x.Notes } return "" } -func (m *StreamdalCreateDestinationOptions) GetXApiDestinationType() string { - if m != nil { - return m.XApiDestinationType +func (x *StreamdalCreateDestinationOptions) GetXApiDestinationType() string { + if x != nil { + return x.XApiDestinationType } return "" } -func (m *StreamdalCreateDestinationOptions) GetKafka() *WriteGroupKafkaOptions { - if m != nil { - return m.Kafka +func (x *StreamdalCreateDestinationOptions) GetKafka() *WriteGroupKafkaOptions { + if x != nil { + return x.Kafka } return nil } -func (m *StreamdalCreateDestinationOptions) GetRabbit() *WriteGroupRabbitOptions { - if m != nil { - return m.Rabbit +func (x *StreamdalCreateDestinationOptions) GetRabbit() *WriteGroupRabbitOptions { + if x != nil { + return x.Rabbit } return nil } -func (m *StreamdalCreateDestinationOptions) GetKubemqQueue() *WriteGroupKubeMQQueueOptions { - if m != nil { - return m.KubemqQueue +func (x *StreamdalCreateDestinationOptions) GetKubemqQueue() *WriteGroupKubeMQQueueOptions { + if x != nil { + return x.KubemqQueue } return nil } -func (m *StreamdalCreateDestinationOptions) GetAwsSqs() *WriteGroupAWSSQSOptions { - if m != nil { - return m.AwsSqs +func (x *StreamdalCreateDestinationOptions) GetAwsSqs() *WriteGroupAWSSQSOptions { + if x != nil { + return x.AwsSqs } return nil } -func (m *StreamdalCreateDestinationOptions) GetHttp() *HTTPDestination { - if m != nil { - return m.Http +func (x *StreamdalCreateDestinationOptions) GetHttp() *HTTPDestination { + if x != nil { + return x.Http } return nil } type HTTPDestination struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Full URL to HTTP server (ex: https://example.com/some/path)',required" Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty" kong:"help='Full URL to HTTP server (ex: https://example.com/some/path)',required"` // @gotags: kong:"help='Optional map of headers to pass on replay (--headers key1=value1,key2=value2..)'" - Headers map[string]string `protobuf:"bytes,2,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" kong:"help='Optional map of headers to pass on replay (--headers key1=value1,key2=value2..)'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Headers map[string]string `protobuf:"bytes,2,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" kong:"help='Optional map of headers to pass on replay (--headers key1=value1,key2=value2..)'"` } -func (m *HTTPDestination) Reset() { *m = HTTPDestination{} } -func (m *HTTPDestination) String() string { return proto.CompactTextString(m) } -func (*HTTPDestination) ProtoMessage() {} -func (*HTTPDestination) Descriptor() ([]byte, []int) { - return fileDescriptor_49b11ca9129ce8de, []int{15} +func (x *HTTPDestination) Reset() { + *x = HTTPDestination{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *HTTPDestination) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HTTPDestination.Unmarshal(m, b) -} -func (m *HTTPDestination) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HTTPDestination.Marshal(b, m, deterministic) +func (x *HTTPDestination) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *HTTPDestination) XXX_Merge(src proto.Message) { - xxx_messageInfo_HTTPDestination.Merge(m, src) -} -func (m *HTTPDestination) XXX_Size() int { - return xxx_messageInfo_HTTPDestination.Size(m) -} -func (m *HTTPDestination) XXX_DiscardUnknown() { - xxx_messageInfo_HTTPDestination.DiscardUnknown(m) + +func (*HTTPDestination) ProtoMessage() {} + +func (x *HTTPDestination) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_streamdal_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_HTTPDestination proto.InternalMessageInfo +// Deprecated: Use HTTPDestination.ProtoReflect.Descriptor instead. +func (*HTTPDestination) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_streamdal_proto_rawDescGZIP(), []int{15} +} -func (m *HTTPDestination) GetUrl() string { - if m != nil { - return m.Url +func (x *HTTPDestination) GetUrl() string { + if x != nil { + return x.Url } return "" } -func (m *HTTPDestination) GetHeaders() map[string]string { - if m != nil { - return m.Headers +func (x *HTTPDestination) GetHeaders() map[string]string { + if x != nil { + return x.Headers } return nil } -func init() { - proto.RegisterEnum("protos.opts.StreamdalOutputType", StreamdalOutputType_name, StreamdalOutputType_value) - proto.RegisterEnum("protos.opts.StreamdalReplayType", StreamdalReplayType_name, StreamdalReplayType_value) - proto.RegisterType((*StreamdalOptions)(nil), "protos.opts.StreamdalOptions") - proto.RegisterType((*StreamdalLoginOptions)(nil), "protos.opts.StreamdalLoginOptions") - proto.RegisterType((*StreamdalLogoutOptions)(nil), "protos.opts.StreamdalLogoutOptions") - proto.RegisterType((*StreamdalListCollectionOptions)(nil), "protos.opts.StreamdalListCollectionOptions") - proto.RegisterType((*StreamdalListDestinationOptions)(nil), "protos.opts.StreamdalListDestinationOptions") - proto.RegisterType((*StreamdalListSchemaOptions)(nil), "protos.opts.StreamdalListSchemaOptions") - proto.RegisterType((*StreamdalListReplayOptions)(nil), "protos.opts.StreamdalListReplayOptions") - proto.RegisterType((*StreamdalArchiveOptions)(nil), "protos.opts.StreamdalArchiveOptions") - proto.RegisterType((*StreamdalArchiveReplayOptions)(nil), "protos.opts.StreamdalArchiveReplayOptions") - proto.RegisterType((*StreamdalListOptions)(nil), "protos.opts.StreamdalListOptions") - proto.RegisterType((*StreamdalCreateOptions)(nil), "protos.opts.StreamdalCreateOptions") - proto.RegisterType((*StreamdalSearchOptions)(nil), "protos.opts.StreamdalSearchOptions") - proto.RegisterType((*StreamdalCreateCollectionOptions)(nil), "protos.opts.StreamdalCreateCollectionOptions") - proto.RegisterType((*StreamdalCreateReplayOptions)(nil), "protos.opts.StreamdalCreateReplayOptions") - proto.RegisterType((*StreamdalCreateDestinationOptions)(nil), "protos.opts.StreamdalCreateDestinationOptions") - proto.RegisterType((*HTTPDestination)(nil), "protos.opts.HTTPDestination") - proto.RegisterMapType((map[string]string)(nil), "protos.opts.HTTPDestination.HeadersEntry") -} - -func init() { proto.RegisterFile("opts/ps_opts_streamdal.proto", fileDescriptor_49b11ca9129ce8de) } - -var fileDescriptor_49b11ca9129ce8de = []byte{ - // 1070 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x56, 0xdd, 0x6e, 0xe3, 0x44, - 0x14, 0x26, 0x69, 0x92, 0x36, 0x27, 0x6d, 0x89, 0x66, 0xb7, 0xd4, 0x2a, 0x05, 0x52, 0x2f, 0x2b, - 0x4a, 0x61, 0x13, 0x08, 0x20, 0xed, 0x1f, 0xa0, 0xb4, 0x2c, 0xbb, 0x61, 0xfb, 0xb3, 0xb5, 0x53, - 0xad, 0x84, 0x84, 0xac, 0x49, 0x3c, 0x4d, 0xac, 0xda, 0x19, 0xc7, 0x33, 0x6e, 0x95, 0xb7, 0xe1, - 0x82, 0x2b, 0xee, 0xb9, 0xe0, 0x45, 0x78, 0x06, 0x1e, 0x82, 0x0b, 0x34, 0x33, 0xb6, 0x63, 0x6f, - 0x1d, 0xf7, 0xca, 0xf6, 0x9c, 0xef, 0x3b, 0x3f, 0xdf, 0x39, 0x33, 0x63, 0xd8, 0xa5, 0x3e, 0x67, - 0x1d, 0x9f, 0x59, 0xe2, 0x69, 0x31, 0x1e, 0x10, 0xec, 0xd9, 0xd8, 0x6d, 0xfb, 0x01, 0xe5, 0x14, - 0x35, 0xe4, 0x83, 0xb5, 0x85, 0x71, 0x47, 0xcb, 0x40, 0x6f, 0x02, 0x87, 0x13, 0x05, 0xd3, 0xff, - 0x59, 0x81, 0xa6, 0x19, 0x53, 0xcf, 0x7c, 0xee, 0xd0, 0x29, 0x43, 0x3d, 0x68, 0xd0, 0x90, 0xfb, - 0x21, 0xb7, 0xf8, 0xdc, 0x27, 0x5a, 0xa9, 0x55, 0xda, 0xdf, 0xec, 0xb6, 0xda, 0x29, 0x8f, 0xed, - 0x05, 0x47, 0x02, 0x07, 0x73, 0x9f, 0x18, 0x40, 0x93, 0x77, 0xb4, 0x0d, 0xab, 0xd8, 0x77, 0xac, - 0x30, 0x70, 0xb5, 0x72, 0xab, 0xb4, 0x5f, 0x37, 0x6a, 0xd8, 0x77, 0x2e, 0x02, 0x17, 0x3d, 0x86, - 0xaa, 0x4b, 0xc7, 0xce, 0x54, 0x5b, 0x69, 0x95, 0xf6, 0x1b, 0x5d, 0x3d, 0xdf, 0xeb, 0xb1, 0x80, - 0x44, 0xe9, 0x18, 0x8a, 0x80, 0x9e, 0x41, 0xcd, 0xa5, 0x63, 0x1a, 0x72, 0xad, 0x22, 0xa9, 0x0f, - 0x96, 0x52, 0x69, 0xc8, 0x63, 0x6e, 0x44, 0x41, 0xdf, 0x41, 0xc5, 0x75, 0x18, 0xd7, 0xaa, 0x92, - 0xba, 0xb7, 0x84, 0xea, 0xb0, 0x84, 0x28, 0xe1, 0x22, 0xe6, 0x28, 0x20, 0x98, 0x13, 0xad, 0x56, - 0x14, 0xf3, 0x48, 0x62, 0x92, 0x98, 0x8a, 0x22, 0xc8, 0x8c, 0xe0, 0x60, 0x34, 0xd1, 0x56, 0x8b, - 0xc8, 0xa6, 0xc4, 0x24, 0x64, 0x45, 0x41, 0x3f, 0xc0, 0xaa, 0x78, 0x3a, 0xd7, 0x44, 0x5b, 0x93, - 0xec, 0x4f, 0xf3, 0xd9, 0x3d, 0x05, 0x8a, 0xe9, 0x31, 0x49, 0xdf, 0x86, 0xad, 0x5c, 0x35, 0x75, - 0x0d, 0x3e, 0xc8, 0xd7, 0x4a, 0x6f, 0xc1, 0xc7, 0x19, 0x29, 0x8e, 0xa8, 0xeb, 0x92, 0x91, 0xb0, - 0xc5, 0x88, 0x3d, 0xf8, 0x24, 0x83, 0xf8, 0x89, 0x30, 0xee, 0x4c, 0x71, 0x1a, 0xb2, 0x0b, 0x3b, - 0x19, 0x88, 0x39, 0x9a, 0x10, 0x0f, 0x2f, 0xb3, 0x1a, 0xc4, 0x77, 0xf1, 0x3c, 0xb6, 0xfe, 0x06, - 0xdb, 0x4b, 0xea, 0x42, 0x87, 0x50, 0x0b, 0x24, 0x56, 0x4e, 0x63, 0xa3, 0x7b, 0x50, 0xa8, 0x46, - 0xc6, 0xad, 0x11, 0x31, 0xf5, 0xe7, 0xf0, 0x51, 0x21, 0x10, 0x7d, 0x08, 0x75, 0x05, 0xb5, 0x1c, - 0x5b, 0xc6, 0xa9, 0x1b, 0x6b, 0x6a, 0xa1, 0x6f, 0xeb, 0x7f, 0x95, 0xe1, 0x7e, 0xde, 0xa4, 0xa0, - 0xd7, 0x00, 0xa3, 0x44, 0xa9, 0x28, 0xbd, 0x2f, 0x96, 0x0f, 0xd8, 0x2d, 0x55, 0x8d, 0x14, 0x1d, - 0x9d, 0x42, 0xc3, 0x5e, 0x88, 0x2a, 0xf7, 0x4e, 0xa3, 0xfb, 0xe5, 0x72, 0x6f, 0xb7, 0x3b, 0x60, - 0xa4, 0x1d, 0xa0, 0x1f, 0x13, 0xdd, 0xd4, 0x7e, 0xfb, 0x6c, 0xb9, 0xab, 0x5c, 0xd1, 0x84, 0x03, - 0x26, 0x5b, 0x18, 0xed, 0xba, 0x02, 0x07, 0x99, 0x56, 0x1b, 0x11, 0x4d, 0xff, 0xaf, 0x94, 0x1a, - 0xb8, 0xcc, 0x46, 0x41, 0x27, 0x39, 0xca, 0x3d, 0x2a, 0xda, 0x61, 0xc5, 0xda, 0xf5, 0x92, 0x5a, - 0x95, 0x6c, 0x9f, 0x17, 0xb9, 0xca, 0xaf, 0xf6, 0x4d, 0x56, 0x7e, 0xa5, 0x59, 0xbb, 0xc8, 0xcf, - 0x1d, 0x0d, 0xd0, 0xc7, 0xa9, 0xea, 0x33, 0x3b, 0x1d, 0xdd, 0x87, 0xea, 0x2c, 0x24, 0xc1, 0x3c, - 0x9a, 0x34, 0xf5, 0x81, 0x1e, 0xc0, 0xc6, 0xa2, 0x24, 0x31, 0x87, 0xea, 0xf8, 0x5c, 0x5f, 0x2c, - 0xf6, 0x6d, 0x84, 0xa0, 0xe2, 0xe3, 0x31, 0x91, 0xf9, 0x55, 0x0d, 0xf9, 0xae, 0xff, 0x5e, 0x86, - 0xd6, 0x5d, 0x72, 0x09, 0xe2, 0x14, 0x7b, 0x24, 0x0a, 0x29, 0xdf, 0xc5, 0xd4, 0xab, 0x56, 0x2d, - 0xa2, 0xad, 0xa9, 0x85, 0xbe, 0x2d, 0x92, 0x9c, 0x52, 0x4e, 0x98, 0x0c, 0x55, 0x37, 0xd4, 0x87, - 0x48, 0x92, 0x4c, 0xaf, 0x89, 0x4b, 0x7d, 0xa2, 0xae, 0x88, 0x8a, 0x4a, 0x32, 0x5e, 0x94, 0x57, - 0x40, 0x17, 0xb6, 0x12, 0x50, 0x40, 0x29, 0xb7, 0x3c, 0xc2, 0x98, 0xc8, 0xba, 0x2a, 0xc1, 0xf7, - 0x62, 0xa3, 0x41, 0x29, 0x3f, 0x51, 0x26, 0xc1, 0xf1, 0xf1, 0xdc, 0xa5, 0xd8, 0xb6, 0x2e, 0x1d, - 0xe2, 0xda, 0x09, 0xa7, 0xa6, 0x38, 0x91, 0xf1, 0x67, 0x61, 0x8b, 0x39, 0xfb, 0xd0, 0xcc, 0x72, - 0x1c, 0x5b, 0x1e, 0xb8, 0x75, 0x63, 0x33, 0x0d, 0xef, 0xdb, 0xfa, 0x9f, 0x65, 0xd8, 0x2d, 0x1a, - 0x83, 0x5c, 0x79, 0xbe, 0x85, 0x8a, 0x2c, 0xb1, 0x5c, 0x74, 0x0b, 0x2a, 0x37, 0xf2, 0x16, 0x94, - 0xe8, 0xe5, 0xba, 0x65, 0x9b, 0x5b, 0xc9, 0x69, 0xee, 0x43, 0xd8, 0x4c, 0x0d, 0x90, 0x40, 0x29, - 0xc1, 0x36, 0x52, 0xab, 0xaa, 0x33, 0x6a, 0x7c, 0x6a, 0xe9, 0xf1, 0x79, 0x08, 0x9b, 0x97, 0x01, - 0xf5, 0x2c, 0xee, 0x78, 0x84, 0x71, 0xec, 0xf9, 0x91, 0x14, 0x1b, 0x62, 0x75, 0x10, 0x2f, 0xa2, - 0x3d, 0x58, 0xe7, 0x34, 0x05, 0x5a, 0x93, 0xa0, 0x06, 0xa7, 0x09, 0x44, 0xff, 0x7b, 0x05, 0xf6, - 0xee, 0x9c, 0xf5, 0x5c, 0xc5, 0x92, 0xda, 0xcb, 0xe9, 0xda, 0xbb, 0xb0, 0x65, 0x89, 0x5f, 0x82, - 0x74, 0x6d, 0x52, 0xd8, 0x7f, 0x55, 0x86, 0xa8, 0xe7, 0x3b, 0xa9, 0x00, 0x72, 0x84, 0x9e, 0x40, - 0xf5, 0x0a, 0x5f, 0x5e, 0x61, 0xcd, 0xce, 0xb9, 0x40, 0xdf, 0x8a, 0xdf, 0x98, 0x97, 0x01, 0x0d, - 0xfd, 0xd7, 0x02, 0x93, 0xfc, 0x2d, 0x48, 0x06, 0x7a, 0x0e, 0xb5, 0x00, 0x0f, 0x87, 0x0e, 0xd7, - 0x48, 0xce, 0xf5, 0xb9, 0xe0, 0x1a, 0x12, 0xb4, 0x38, 0x07, 0xe4, 0x27, 0x3a, 0x86, 0xf5, 0xab, - 0x70, 0x48, 0xbc, 0x99, 0x35, 0x0b, 0x49, 0x48, 0xb4, 0xcb, 0x9c, 0x03, 0x25, 0x15, 0x3f, 0x1c, - 0x92, 0x93, 0xf3, 0x73, 0x81, 0x4c, 0xce, 0x00, 0x45, 0x97, 0x6b, 0xe8, 0x7b, 0x58, 0xc5, 0x37, - 0xcc, 0x62, 0x33, 0xa6, 0x8d, 0x0b, 0x93, 0xe9, 0xbd, 0x35, 0xcd, 0x73, 0x33, 0x49, 0x06, 0xdf, - 0x30, 0x73, 0xc6, 0xd0, 0x57, 0x50, 0x99, 0x70, 0xee, 0x6b, 0x13, 0xc9, 0xdd, 0xcd, 0x70, 0x5f, - 0x0d, 0x06, 0x6f, 0x52, 0xaa, 0x19, 0x12, 0xa9, 0xff, 0x51, 0x82, 0xf7, 0xdf, 0xb1, 0xa0, 0x26, - 0xac, 0x88, 0xbf, 0x31, 0xd5, 0x28, 0xf1, 0x8a, 0x8e, 0x60, 0x75, 0x42, 0xb0, 0x4d, 0x02, 0xd1, - 0xa9, 0x95, 0x5b, 0xf5, 0xbd, 0xe3, 0xa0, 0xfd, 0x4a, 0x61, 0x5f, 0x4c, 0x79, 0x30, 0x37, 0x62, - 0xe6, 0xce, 0x53, 0x58, 0x4f, 0x1b, 0x44, 0x98, 0x2b, 0x12, 0x9f, 0x69, 0xe2, 0x55, 0x8c, 0xc3, - 0x35, 0x76, 0x43, 0x12, 0x8f, 0x83, 0xfc, 0x78, 0x5a, 0x7e, 0x5c, 0x3a, 0x38, 0x80, 0x7b, 0x39, - 0xff, 0x91, 0xa8, 0x0e, 0xd5, 0x41, 0xef, 0xf0, 0xf8, 0x45, 0xf3, 0x3d, 0xb4, 0x06, 0x95, 0x5f, - 0xcc, 0xb3, 0xd3, 0x66, 0xe9, 0xe0, 0xeb, 0x14, 0x76, 0xb1, 0xdb, 0x10, 0x40, 0xcd, 0xec, 0x9f, - 0xbe, 0x94, 0xe0, 0x4d, 0x80, 0xa3, 0xb3, 0xd3, 0x41, 0xff, 0xf4, 0xe2, 0xec, 0xc2, 0x6c, 0x96, - 0x0e, 0x9f, 0xfd, 0xfa, 0x64, 0xec, 0xf0, 0x49, 0x38, 0x6c, 0x8f, 0xa8, 0xd7, 0x19, 0x62, 0x3e, - 0x9a, 0x8c, 0x68, 0xe0, 0x77, 0x7c, 0x37, 0xf4, 0x86, 0x24, 0x78, 0xa4, 0x0e, 0x39, 0xd6, 0x19, - 0x86, 0x8e, 0x6b, 0x77, 0xc6, 0xb4, 0xa3, 0xaa, 0xef, 0x88, 0xea, 0x87, 0x35, 0xf9, 0xf1, 0xcd, - 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x39, 0xcd, 0xbf, 0x54, 0x66, 0x0b, 0x00, 0x00, +var File_opts_ps_opts_streamdal_proto protoreflect.FileDescriptor + +var file_opts_ps_opts_streamdal_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x1a, 0x18, 0x6f, 0x70, 0x74, + 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd6, 0x03, 0x0a, 0x10, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x64, 0x61, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x0a, 0x0b, 0x6f, 0x75, + 0x74, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x53, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x54, 0x79, 0x70, + 0x65, 0x52, 0x0a, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, + 0x07, 0x61, 0x70, 0x69, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x61, 0x70, 0x69, 0x55, 0x72, 0x6c, 0x12, 0x38, 0x0a, 0x05, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, + 0x70, 0x74, 0x73, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x4c, 0x6f, 0x67, + 0x69, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x05, 0x6c, 0x6f, 0x67, 0x69, 0x6e, + 0x12, 0x3b, 0x0a, 0x06, 0x6c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x53, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x6c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x12, 0x35, 0x0a, + 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x64, 0x61, 0x6c, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x04, + 0x6c, 0x69, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x06, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, + 0x74, 0x73, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, + 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x3e, + 0x0a, 0x07, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x53, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x22, 0x17, + 0x0a, 0x15, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x18, 0x0a, 0x16, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x64, 0x61, 0x6c, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x22, 0x20, 0x0a, 0x1e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x4c, 0x69, + 0x73, 0x74, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x22, 0x21, 0x0a, 0x1f, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, + 0x4c, 0x69, 0x73, 0x74, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x1c, 0x0a, 0x1a, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x64, 0x61, 0x6c, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x1c, 0x0a, 0x1a, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, + 0x6c, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x79, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x22, 0x5d, 0x0a, 0x17, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x41, + 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x42, 0x0a, + 0x06, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x53, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x52, 0x65, 0x70, 0x6c, + 0x61, 0x79, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6c, 0x61, + 0x79, 0x22, 0x3c, 0x0a, 0x1d, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x41, 0x72, + 0x63, 0x68, 0x69, 0x76, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x79, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x22, + 0xb5, 0x02, 0x0a, 0x14, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x4c, 0x69, 0x73, + 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x4b, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x64, 0x61, 0x6c, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4e, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, + 0x61, 0x6c, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x79, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, + 0x70, 0x74, 0x73, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x4c, 0x69, 0x73, + 0x74, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x79, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, + 0x72, 0x65, 0x70, 0x6c, 0x61, 0x79, 0x12, 0x3f, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x4c, 0x69, + 0x73, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0xfc, 0x01, 0x0a, 0x16, 0x53, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x4d, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x41, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x29, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, + 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x70, 0x6c, 0x61, 0x79, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x72, 0x65, + 0x70, 0x6c, 0x61, 0x79, 0x12, 0x50, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, + 0x6c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, + 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x67, 0x0a, 0x16, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x64, 0x61, 0x6c, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, + 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x70, + 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x22, + 0xa0, 0x02, 0x0a, 0x20, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x74, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6e, 0x6f, 0x74, 0x65, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x65, + 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0c, 0x65, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x32, 0x0a, 0x15, 0x65, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x5f, 0x72, 0x6f, 0x6f, + 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x13, 0x65, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x12, 0x32, 0x0a, 0x15, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x13, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x65, 0x6c, + 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x70, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x49, 0x64, 0x22, 0xaa, 0x02, 0x0a, 0x1c, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x79, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x34, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, + 0x70, 0x74, 0x73, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x52, 0x65, 0x70, + 0x6c, 0x61, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x6e, 0x6f, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6e, 0x6f, + 0x74, 0x65, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6c, 0x6c, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x65, 0x73, 0x74, + 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0d, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, + 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x66, + 0x72, 0x6f, 0x6d, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x21, 0x0a, 0x0c, + 0x74, 0x6f, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0b, 0x74, 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, + 0xb9, 0x03, 0x0a, 0x21, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x74, + 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6e, 0x6f, 0x74, 0x65, 0x73, 0x12, + 0x32, 0x0a, 0x15, 0x5f, 0x61, 0x70, 0x69, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x12, 0x41, 0x70, 0x69, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x39, 0x0a, 0x05, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x18, 0x64, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, + 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4b, 0x61, 0x66, 0x6b, 0x61, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x05, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x12, 0x3c, + 0x0a, 0x06, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x57, 0x72, 0x69, + 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x12, 0x4c, 0x0a, 0x0c, + 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, 0x5f, 0x71, 0x75, 0x65, 0x75, 0x65, 0x18, 0x66, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, + 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4b, 0x75, 0x62, 0x65, 0x4d, + 0x51, 0x51, 0x75, 0x65, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0b, 0x6b, + 0x75, 0x62, 0x65, 0x6d, 0x71, 0x51, 0x75, 0x65, 0x75, 0x65, 0x12, 0x3d, 0x0a, 0x07, 0x61, 0x77, + 0x73, 0x5f, 0x73, 0x71, 0x73, 0x18, 0x67, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x41, 0x57, 0x53, 0x53, 0x51, 0x53, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x06, 0x61, 0x77, 0x73, 0x53, 0x71, 0x73, 0x12, 0x30, 0x0a, 0x04, 0x68, 0x74, 0x74, + 0x70, 0x18, 0x68, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x68, 0x74, 0x74, 0x70, 0x22, 0xa4, 0x01, 0x0a, 0x0f, + 0x48, 0x54, 0x54, 0x50, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, + 0x6c, 0x12, 0x43, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, + 0x2e, 0x48, 0x54, 0x54, 0x50, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x1a, 0x3a, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, + 0x38, 0x01, 0x2a, 0x2a, 0x0a, 0x13, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x4f, + 0x75, 0x74, 0x70, 0x75, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x41, 0x42, + 0x4c, 0x45, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x4a, 0x53, 0x4f, 0x4e, 0x10, 0x01, 0x2a, 0x31, + 0x0a, 0x13, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x61, + 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x49, 0x4e, 0x47, 0x4c, 0x45, 0x10, + 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x43, 0x4f, 0x4e, 0x54, 0x49, 0x4e, 0x55, 0x4f, 0x55, 0x53, 0x10, + 0x01, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, + 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x6f, 0x70, 0x74, 0x73, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_opts_ps_opts_streamdal_proto_rawDescOnce sync.Once + file_opts_ps_opts_streamdal_proto_rawDescData = file_opts_ps_opts_streamdal_proto_rawDesc +) + +func file_opts_ps_opts_streamdal_proto_rawDescGZIP() []byte { + file_opts_ps_opts_streamdal_proto_rawDescOnce.Do(func() { + file_opts_ps_opts_streamdal_proto_rawDescData = protoimpl.X.CompressGZIP(file_opts_ps_opts_streamdal_proto_rawDescData) + }) + return file_opts_ps_opts_streamdal_proto_rawDescData +} + +var file_opts_ps_opts_streamdal_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_opts_ps_opts_streamdal_proto_msgTypes = make([]protoimpl.MessageInfo, 17) +var file_opts_ps_opts_streamdal_proto_goTypes = []interface{}{ + (StreamdalOutputType)(0), // 0: protos.opts.StreamdalOutputType + (StreamdalReplayType)(0), // 1: protos.opts.StreamdalReplayType + (*StreamdalOptions)(nil), // 2: protos.opts.StreamdalOptions + (*StreamdalLoginOptions)(nil), // 3: protos.opts.StreamdalLoginOptions + (*StreamdalLogoutOptions)(nil), // 4: protos.opts.StreamdalLogoutOptions + (*StreamdalListCollectionOptions)(nil), // 5: protos.opts.StreamdalListCollectionOptions + (*StreamdalListDestinationOptions)(nil), // 6: protos.opts.StreamdalListDestinationOptions + (*StreamdalListSchemaOptions)(nil), // 7: protos.opts.StreamdalListSchemaOptions + (*StreamdalListReplayOptions)(nil), // 8: protos.opts.StreamdalListReplayOptions + (*StreamdalArchiveOptions)(nil), // 9: protos.opts.StreamdalArchiveOptions + (*StreamdalArchiveReplayOptions)(nil), // 10: protos.opts.StreamdalArchiveReplayOptions + (*StreamdalListOptions)(nil), // 11: protos.opts.StreamdalListOptions + (*StreamdalCreateOptions)(nil), // 12: protos.opts.StreamdalCreateOptions + (*StreamdalSearchOptions)(nil), // 13: protos.opts.StreamdalSearchOptions + (*StreamdalCreateCollectionOptions)(nil), // 14: protos.opts.StreamdalCreateCollectionOptions + (*StreamdalCreateReplayOptions)(nil), // 15: protos.opts.StreamdalCreateReplayOptions + (*StreamdalCreateDestinationOptions)(nil), // 16: protos.opts.StreamdalCreateDestinationOptions + (*HTTPDestination)(nil), // 17: protos.opts.HTTPDestination + nil, // 18: protos.opts.HTTPDestination.HeadersEntry + (*WriteGroupKafkaOptions)(nil), // 19: protos.opts.WriteGroupKafkaOptions + (*WriteGroupRabbitOptions)(nil), // 20: protos.opts.WriteGroupRabbitOptions + (*WriteGroupKubeMQQueueOptions)(nil), // 21: protos.opts.WriteGroupKubeMQQueueOptions + (*WriteGroupAWSSQSOptions)(nil), // 22: protos.opts.WriteGroupAWSSQSOptions +} +var file_opts_ps_opts_streamdal_proto_depIdxs = []int32{ + 0, // 0: protos.opts.StreamdalOptions.output_type:type_name -> protos.opts.StreamdalOutputType + 3, // 1: protos.opts.StreamdalOptions.login:type_name -> protos.opts.StreamdalLoginOptions + 4, // 2: protos.opts.StreamdalOptions.logout:type_name -> protos.opts.StreamdalLogoutOptions + 11, // 3: protos.opts.StreamdalOptions.list:type_name -> protos.opts.StreamdalListOptions + 12, // 4: protos.opts.StreamdalOptions.create:type_name -> protos.opts.StreamdalCreateOptions + 13, // 5: protos.opts.StreamdalOptions.search:type_name -> protos.opts.StreamdalSearchOptions + 9, // 6: protos.opts.StreamdalOptions.archive:type_name -> protos.opts.StreamdalArchiveOptions + 10, // 7: protos.opts.StreamdalArchiveOptions.replay:type_name -> protos.opts.StreamdalArchiveReplayOptions + 5, // 8: protos.opts.StreamdalListOptions.collection:type_name -> protos.opts.StreamdalListCollectionOptions + 6, // 9: protos.opts.StreamdalListOptions.destination:type_name -> protos.opts.StreamdalListDestinationOptions + 8, // 10: protos.opts.StreamdalListOptions.replay:type_name -> protos.opts.StreamdalListReplayOptions + 7, // 11: protos.opts.StreamdalListOptions.schema:type_name -> protos.opts.StreamdalListSchemaOptions + 14, // 12: protos.opts.StreamdalCreateOptions.collection:type_name -> protos.opts.StreamdalCreateCollectionOptions + 15, // 13: protos.opts.StreamdalCreateOptions.replay:type_name -> protos.opts.StreamdalCreateReplayOptions + 16, // 14: protos.opts.StreamdalCreateOptions.destination:type_name -> protos.opts.StreamdalCreateDestinationOptions + 1, // 15: protos.opts.StreamdalCreateReplayOptions.type:type_name -> protos.opts.StreamdalReplayType + 19, // 16: protos.opts.StreamdalCreateDestinationOptions.kafka:type_name -> protos.opts.WriteGroupKafkaOptions + 20, // 17: protos.opts.StreamdalCreateDestinationOptions.rabbit:type_name -> protos.opts.WriteGroupRabbitOptions + 21, // 18: protos.opts.StreamdalCreateDestinationOptions.kubemq_queue:type_name -> protos.opts.WriteGroupKubeMQQueueOptions + 22, // 19: protos.opts.StreamdalCreateDestinationOptions.aws_sqs:type_name -> protos.opts.WriteGroupAWSSQSOptions + 17, // 20: protos.opts.StreamdalCreateDestinationOptions.http:type_name -> protos.opts.HTTPDestination + 18, // 21: protos.opts.HTTPDestination.headers:type_name -> protos.opts.HTTPDestination.HeadersEntry + 22, // [22:22] is the sub-list for method output_type + 22, // [22:22] is the sub-list for method input_type + 22, // [22:22] is the sub-list for extension type_name + 22, // [22:22] is the sub-list for extension extendee + 0, // [0:22] is the sub-list for field type_name +} + +func init() { file_opts_ps_opts_streamdal_proto_init() } +func file_opts_ps_opts_streamdal_proto_init() { + if File_opts_ps_opts_streamdal_proto != nil { + return + } + file_opts_ps_opts_write_proto_init() + if !protoimpl.UnsafeEnabled { + file_opts_ps_opts_streamdal_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamdalOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_streamdal_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamdalLoginOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_streamdal_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamdalLogoutOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_streamdal_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamdalListCollectionOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_streamdal_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamdalListDestinationOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_streamdal_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamdalListSchemaOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_streamdal_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamdalListReplayOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_streamdal_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamdalArchiveOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_streamdal_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamdalArchiveReplayOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_streamdal_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamdalListOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_streamdal_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamdalCreateOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_streamdal_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamdalSearchOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_streamdal_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamdalCreateCollectionOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_streamdal_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamdalCreateReplayOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_streamdal_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamdalCreateDestinationOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_streamdal_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HTTPDestination); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_opts_ps_opts_streamdal_proto_rawDesc, + NumEnums: 2, + NumMessages: 17, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_opts_ps_opts_streamdal_proto_goTypes, + DependencyIndexes: file_opts_ps_opts_streamdal_proto_depIdxs, + EnumInfos: file_opts_ps_opts_streamdal_proto_enumTypes, + MessageInfos: file_opts_ps_opts_streamdal_proto_msgTypes, + }.Build() + File_opts_ps_opts_streamdal_proto = out.File + file_opts_ps_opts_streamdal_proto_rawDesc = nil + file_opts_ps_opts_streamdal_proto_goTypes = nil + file_opts_ps_opts_streamdal_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_tunnel.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_tunnel.pb.go index 9ba958d4b..64cb967c5 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_tunnel.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_tunnel.pb.go @@ -1,27 +1,31 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: opts/ps_opts_tunnel.proto package opts import ( - fmt "fmt" args "github.com/batchcorp/plumber-schemas/build/go/protos/args" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type TunnelOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='API token to use for tunnel (create here: https://console.streamdal.com/account/security)',required" ApiToken string `protobuf:"bytes,1,opt,name=api_token,json=apiToken,proto3" json:"api_token,omitempty" kong:"help='API token to use for tunnel (create here: https://console.streamdal.com/account/security)',required"` // @gotags: kong:"-" @@ -81,1322 +85,2120 @@ type TunnelOptions struct { // @gotags: kong:"cmd,help='AWS Kinesis Streams'" AwsKinesis *TunnelGroupAWSKinesisOptions `protobuf:"bytes,118,opt,name=aws_kinesis,json=awsKinesis,proto3" json:"aws_kinesis,omitempty" kong:"cmd,help='AWS Kinesis Streams'"` // @gotags: kong:"cmd,help='Memphis'" - Memphis *TunnelGroupMemphisOptions `protobuf:"bytes,119,opt,name=memphis,proto3" json:"memphis,omitempty" kong:"cmd,help='Memphis'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Memphis *TunnelGroupMemphisOptions `protobuf:"bytes,119,opt,name=memphis,proto3" json:"memphis,omitempty" kong:"cmd,help='Memphis'"` } -func (m *TunnelOptions) Reset() { *m = TunnelOptions{} } -func (m *TunnelOptions) String() string { return proto.CompactTextString(m) } -func (*TunnelOptions) ProtoMessage() {} -func (*TunnelOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_7ce1637d1f7d7036, []int{0} +func (x *TunnelOptions) Reset() { + *x = TunnelOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TunnelOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TunnelOptions.Unmarshal(m, b) -} -func (m *TunnelOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TunnelOptions.Marshal(b, m, deterministic) -} -func (m *TunnelOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_TunnelOptions.Merge(m, src) -} -func (m *TunnelOptions) XXX_Size() int { - return xxx_messageInfo_TunnelOptions.Size(m) +func (x *TunnelOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TunnelOptions) XXX_DiscardUnknown() { - xxx_messageInfo_TunnelOptions.DiscardUnknown(m) + +func (*TunnelOptions) ProtoMessage() {} + +func (x *TunnelOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TunnelOptions proto.InternalMessageInfo +// Deprecated: Use TunnelOptions.ProtoReflect.Descriptor instead. +func (*TunnelOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_tunnel_proto_rawDescGZIP(), []int{0} +} -func (m *TunnelOptions) GetApiToken() string { - if m != nil { - return m.ApiToken +func (x *TunnelOptions) GetApiToken() string { + if x != nil { + return x.ApiToken } return "" } -func (m *TunnelOptions) GetConnectionId() string { - if m != nil { - return m.ConnectionId +func (x *TunnelOptions) GetConnectionId() string { + if x != nil { + return x.ConnectionId } return "" } -func (m *TunnelOptions) GetXGrpcAddress() string { - if m != nil { - return m.XGrpcAddress +func (x *TunnelOptions) GetXGrpcAddress() string { + if x != nil { + return x.XGrpcAddress } return "" } -func (m *TunnelOptions) GetXGrpcTimeoutSeconds() uint32 { - if m != nil { - return m.XGrpcTimeoutSeconds +func (x *TunnelOptions) GetXGrpcTimeoutSeconds() uint32 { + if x != nil { + return x.XGrpcTimeoutSeconds } return 0 } -func (m *TunnelOptions) GetXGrpcInsecure() bool { - if m != nil { - return m.XGrpcInsecure +func (x *TunnelOptions) GetXGrpcInsecure() bool { + if x != nil { + return x.XGrpcInsecure } return false } -func (m *TunnelOptions) GetName() string { - if m != nil { - return m.Name +func (x *TunnelOptions) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *TunnelOptions) GetXTunnelId() string { - if m != nil { - return m.XTunnelId +func (x *TunnelOptions) GetXTunnelId() string { + if x != nil { + return x.XTunnelId } return "" } -func (m *TunnelOptions) GetXActive() bool { - if m != nil { - return m.XActive +func (x *TunnelOptions) GetXActive() bool { + if x != nil { + return x.XActive } return false } -func (m *TunnelOptions) GetKafka() *TunnelGroupKafkaOptions { - if m != nil { - return m.Kafka +func (x *TunnelOptions) GetKafka() *TunnelGroupKafkaOptions { + if x != nil { + return x.Kafka } return nil } -func (m *TunnelOptions) GetActivemq() *TunnelGroupActiveMQOptions { - if m != nil { - return m.Activemq +func (x *TunnelOptions) GetActivemq() *TunnelGroupActiveMQOptions { + if x != nil { + return x.Activemq } return nil } -func (m *TunnelOptions) GetAwsSqs() *TunnelGroupAWSSQSOptions { - if m != nil { - return m.AwsSqs +func (x *TunnelOptions) GetAwsSqs() *TunnelGroupAWSSQSOptions { + if x != nil { + return x.AwsSqs } return nil } -func (m *TunnelOptions) GetAwsSns() *TunnelGroupAWSSNSOptions { - if m != nil { - return m.AwsSns +func (x *TunnelOptions) GetAwsSns() *TunnelGroupAWSSNSOptions { + if x != nil { + return x.AwsSns } return nil } -func (m *TunnelOptions) GetNats() *TunnelGroupNatsOptions { - if m != nil { - return m.Nats +func (x *TunnelOptions) GetNats() *TunnelGroupNatsOptions { + if x != nil { + return x.Nats } return nil } -func (m *TunnelOptions) GetNatsStreaming() *TunnelGroupNatsStreamingOptions { - if m != nil { - return m.NatsStreaming +func (x *TunnelOptions) GetNatsStreaming() *TunnelGroupNatsStreamingOptions { + if x != nil { + return x.NatsStreaming } return nil } -func (m *TunnelOptions) GetNsq() *TunnelGroupNSQOptions { - if m != nil { - return m.Nsq +func (x *TunnelOptions) GetNsq() *TunnelGroupNSQOptions { + if x != nil { + return x.Nsq } return nil } -func (m *TunnelOptions) GetRabbit() *TunnelGroupRabbitOptions { - if m != nil { - return m.Rabbit +func (x *TunnelOptions) GetRabbit() *TunnelGroupRabbitOptions { + if x != nil { + return x.Rabbit } return nil } -func (m *TunnelOptions) GetMqtt() *TunnelGroupMQTTOptions { - if m != nil { - return m.Mqtt +func (x *TunnelOptions) GetMqtt() *TunnelGroupMQTTOptions { + if x != nil { + return x.Mqtt } return nil } -func (m *TunnelOptions) GetAzureServiceBus() *TunnelGroupAzureServiceBusOptions { - if m != nil { - return m.AzureServiceBus +func (x *TunnelOptions) GetAzureServiceBus() *TunnelGroupAzureServiceBusOptions { + if x != nil { + return x.AzureServiceBus } return nil } -func (m *TunnelOptions) GetAzureEventHub() *TunnelGroupAzureEventHubOptions { - if m != nil { - return m.AzureEventHub +func (x *TunnelOptions) GetAzureEventHub() *TunnelGroupAzureEventHubOptions { + if x != nil { + return x.AzureEventHub } return nil } -func (m *TunnelOptions) GetGcpPubsub() *TunnelGroupGCPPubSubOptions { - if m != nil { - return m.GcpPubsub +func (x *TunnelOptions) GetGcpPubsub() *TunnelGroupGCPPubSubOptions { + if x != nil { + return x.GcpPubsub } return nil } -func (m *TunnelOptions) GetKubemqQueue() *TunnelGroupKubeMQQueueOptions { - if m != nil { - return m.KubemqQueue +func (x *TunnelOptions) GetKubemqQueue() *TunnelGroupKubeMQQueueOptions { + if x != nil { + return x.KubemqQueue } return nil } -func (m *TunnelOptions) GetRedisPubsub() *TunnelGroupRedisPubSubOptions { - if m != nil { - return m.RedisPubsub +func (x *TunnelOptions) GetRedisPubsub() *TunnelGroupRedisPubSubOptions { + if x != nil { + return x.RedisPubsub } return nil } -func (m *TunnelOptions) GetRedisStreams() *TunnelGroupRedisStreamsOptions { - if m != nil { - return m.RedisStreams +func (x *TunnelOptions) GetRedisStreams() *TunnelGroupRedisStreamsOptions { + if x != nil { + return x.RedisStreams } return nil } -func (m *TunnelOptions) GetPulsar() *TunnelGroupPulsarOptions { - if m != nil { - return m.Pulsar +func (x *TunnelOptions) GetPulsar() *TunnelGroupPulsarOptions { + if x != nil { + return x.Pulsar } return nil } -func (m *TunnelOptions) GetRabbitStreams() *TunnelGroupRabbitStreamsOptions { - if m != nil { - return m.RabbitStreams +func (x *TunnelOptions) GetRabbitStreams() *TunnelGroupRabbitStreamsOptions { + if x != nil { + return x.RabbitStreams } return nil } -func (m *TunnelOptions) GetNatsJetstream() *TunnelGroupNatsJetstreamOptions { - if m != nil { - return m.NatsJetstream +func (x *TunnelOptions) GetNatsJetstream() *TunnelGroupNatsJetstreamOptions { + if x != nil { + return x.NatsJetstream } return nil } -func (m *TunnelOptions) GetAwsKinesis() *TunnelGroupAWSKinesisOptions { - if m != nil { - return m.AwsKinesis +func (x *TunnelOptions) GetAwsKinesis() *TunnelGroupAWSKinesisOptions { + if x != nil { + return x.AwsKinesis } return nil } -func (m *TunnelOptions) GetMemphis() *TunnelGroupMemphisOptions { - if m != nil { - return m.Memphis +func (x *TunnelOptions) GetMemphis() *TunnelGroupMemphisOptions { + if x != nil { + return x.Memphis } return nil } type TunnelGroupKafkaOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.KafkaConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.KafkaWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.KafkaWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *TunnelGroupKafkaOptions) Reset() { *m = TunnelGroupKafkaOptions{} } -func (m *TunnelGroupKafkaOptions) String() string { return proto.CompactTextString(m) } -func (*TunnelGroupKafkaOptions) ProtoMessage() {} -func (*TunnelGroupKafkaOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_7ce1637d1f7d7036, []int{1} +func (x *TunnelGroupKafkaOptions) Reset() { + *x = TunnelGroupKafkaOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TunnelGroupKafkaOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TunnelGroupKafkaOptions.Unmarshal(m, b) -} -func (m *TunnelGroupKafkaOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TunnelGroupKafkaOptions.Marshal(b, m, deterministic) -} -func (m *TunnelGroupKafkaOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_TunnelGroupKafkaOptions.Merge(m, src) -} -func (m *TunnelGroupKafkaOptions) XXX_Size() int { - return xxx_messageInfo_TunnelGroupKafkaOptions.Size(m) +func (x *TunnelGroupKafkaOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TunnelGroupKafkaOptions) XXX_DiscardUnknown() { - xxx_messageInfo_TunnelGroupKafkaOptions.DiscardUnknown(m) + +func (*TunnelGroupKafkaOptions) ProtoMessage() {} + +func (x *TunnelGroupKafkaOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TunnelGroupKafkaOptions proto.InternalMessageInfo +// Deprecated: Use TunnelGroupKafkaOptions.ProtoReflect.Descriptor instead. +func (*TunnelGroupKafkaOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_tunnel_proto_rawDescGZIP(), []int{1} +} -func (m *TunnelGroupKafkaOptions) GetXConn() *args.KafkaConn { - if m != nil { - return m.XConn +func (x *TunnelGroupKafkaOptions) GetXConn() *args.KafkaConn { + if x != nil { + return x.XConn } return nil } -func (m *TunnelGroupKafkaOptions) GetArgs() *args.KafkaWriteArgs { - if m != nil { - return m.Args +func (x *TunnelGroupKafkaOptions) GetArgs() *args.KafkaWriteArgs { + if x != nil { + return x.Args } return nil } type TunnelGroupActiveMQOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.ActiveMQConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.ActiveMQWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.ActiveMQWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *TunnelGroupActiveMQOptions) Reset() { *m = TunnelGroupActiveMQOptions{} } -func (m *TunnelGroupActiveMQOptions) String() string { return proto.CompactTextString(m) } -func (*TunnelGroupActiveMQOptions) ProtoMessage() {} -func (*TunnelGroupActiveMQOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_7ce1637d1f7d7036, []int{2} +func (x *TunnelGroupActiveMQOptions) Reset() { + *x = TunnelGroupActiveMQOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TunnelGroupActiveMQOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TunnelGroupActiveMQOptions.Unmarshal(m, b) -} -func (m *TunnelGroupActiveMQOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TunnelGroupActiveMQOptions.Marshal(b, m, deterministic) -} -func (m *TunnelGroupActiveMQOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_TunnelGroupActiveMQOptions.Merge(m, src) -} -func (m *TunnelGroupActiveMQOptions) XXX_Size() int { - return xxx_messageInfo_TunnelGroupActiveMQOptions.Size(m) +func (x *TunnelGroupActiveMQOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TunnelGroupActiveMQOptions) XXX_DiscardUnknown() { - xxx_messageInfo_TunnelGroupActiveMQOptions.DiscardUnknown(m) + +func (*TunnelGroupActiveMQOptions) ProtoMessage() {} + +func (x *TunnelGroupActiveMQOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TunnelGroupActiveMQOptions proto.InternalMessageInfo +// Deprecated: Use TunnelGroupActiveMQOptions.ProtoReflect.Descriptor instead. +func (*TunnelGroupActiveMQOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_tunnel_proto_rawDescGZIP(), []int{2} +} -func (m *TunnelGroupActiveMQOptions) GetXConn() *args.ActiveMQConn { - if m != nil { - return m.XConn +func (x *TunnelGroupActiveMQOptions) GetXConn() *args.ActiveMQConn { + if x != nil { + return x.XConn } return nil } -func (m *TunnelGroupActiveMQOptions) GetArgs() *args.ActiveMQWriteArgs { - if m != nil { - return m.Args +func (x *TunnelGroupActiveMQOptions) GetArgs() *args.ActiveMQWriteArgs { + if x != nil { + return x.Args } return nil } type TunnelGroupAWSSQSOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.AWSSQSConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.AWSSQSWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.AWSSQSWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *TunnelGroupAWSSQSOptions) Reset() { *m = TunnelGroupAWSSQSOptions{} } -func (m *TunnelGroupAWSSQSOptions) String() string { return proto.CompactTextString(m) } -func (*TunnelGroupAWSSQSOptions) ProtoMessage() {} -func (*TunnelGroupAWSSQSOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_7ce1637d1f7d7036, []int{3} +func (x *TunnelGroupAWSSQSOptions) Reset() { + *x = TunnelGroupAWSSQSOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TunnelGroupAWSSQSOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TunnelGroupAWSSQSOptions.Unmarshal(m, b) +func (x *TunnelGroupAWSSQSOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TunnelGroupAWSSQSOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TunnelGroupAWSSQSOptions.Marshal(b, m, deterministic) -} -func (m *TunnelGroupAWSSQSOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_TunnelGroupAWSSQSOptions.Merge(m, src) -} -func (m *TunnelGroupAWSSQSOptions) XXX_Size() int { - return xxx_messageInfo_TunnelGroupAWSSQSOptions.Size(m) -} -func (m *TunnelGroupAWSSQSOptions) XXX_DiscardUnknown() { - xxx_messageInfo_TunnelGroupAWSSQSOptions.DiscardUnknown(m) + +func (*TunnelGroupAWSSQSOptions) ProtoMessage() {} + +func (x *TunnelGroupAWSSQSOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TunnelGroupAWSSQSOptions proto.InternalMessageInfo +// Deprecated: Use TunnelGroupAWSSQSOptions.ProtoReflect.Descriptor instead. +func (*TunnelGroupAWSSQSOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_tunnel_proto_rawDescGZIP(), []int{3} +} -func (m *TunnelGroupAWSSQSOptions) GetXConn() *args.AWSSQSConn { - if m != nil { - return m.XConn +func (x *TunnelGroupAWSSQSOptions) GetXConn() *args.AWSSQSConn { + if x != nil { + return x.XConn } return nil } -func (m *TunnelGroupAWSSQSOptions) GetArgs() *args.AWSSQSWriteArgs { - if m != nil { - return m.Args +func (x *TunnelGroupAWSSQSOptions) GetArgs() *args.AWSSQSWriteArgs { + if x != nil { + return x.Args } return nil } type TunnelGroupAWSSNSOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.AWSSNSConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.AWSSNSWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.AWSSNSWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *TunnelGroupAWSSNSOptions) Reset() { *m = TunnelGroupAWSSNSOptions{} } -func (m *TunnelGroupAWSSNSOptions) String() string { return proto.CompactTextString(m) } -func (*TunnelGroupAWSSNSOptions) ProtoMessage() {} -func (*TunnelGroupAWSSNSOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_7ce1637d1f7d7036, []int{4} +func (x *TunnelGroupAWSSNSOptions) Reset() { + *x = TunnelGroupAWSSNSOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TunnelGroupAWSSNSOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TunnelGroupAWSSNSOptions.Unmarshal(m, b) -} -func (m *TunnelGroupAWSSNSOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TunnelGroupAWSSNSOptions.Marshal(b, m, deterministic) -} -func (m *TunnelGroupAWSSNSOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_TunnelGroupAWSSNSOptions.Merge(m, src) -} -func (m *TunnelGroupAWSSNSOptions) XXX_Size() int { - return xxx_messageInfo_TunnelGroupAWSSNSOptions.Size(m) +func (x *TunnelGroupAWSSNSOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TunnelGroupAWSSNSOptions) XXX_DiscardUnknown() { - xxx_messageInfo_TunnelGroupAWSSNSOptions.DiscardUnknown(m) + +func (*TunnelGroupAWSSNSOptions) ProtoMessage() {} + +func (x *TunnelGroupAWSSNSOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TunnelGroupAWSSNSOptions proto.InternalMessageInfo +// Deprecated: Use TunnelGroupAWSSNSOptions.ProtoReflect.Descriptor instead. +func (*TunnelGroupAWSSNSOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_tunnel_proto_rawDescGZIP(), []int{4} +} -func (m *TunnelGroupAWSSNSOptions) GetXConn() *args.AWSSNSConn { - if m != nil { - return m.XConn +func (x *TunnelGroupAWSSNSOptions) GetXConn() *args.AWSSNSConn { + if x != nil { + return x.XConn } return nil } -func (m *TunnelGroupAWSSNSOptions) GetArgs() *args.AWSSNSWriteArgs { - if m != nil { - return m.Args +func (x *TunnelGroupAWSSNSOptions) GetArgs() *args.AWSSNSWriteArgs { + if x != nil { + return x.Args } return nil } type TunnelGroupNatsOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.NatsConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.NatsWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.NatsWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *TunnelGroupNatsOptions) Reset() { *m = TunnelGroupNatsOptions{} } -func (m *TunnelGroupNatsOptions) String() string { return proto.CompactTextString(m) } -func (*TunnelGroupNatsOptions) ProtoMessage() {} -func (*TunnelGroupNatsOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_7ce1637d1f7d7036, []int{5} +func (x *TunnelGroupNatsOptions) Reset() { + *x = TunnelGroupNatsOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TunnelGroupNatsOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TunnelGroupNatsOptions.Unmarshal(m, b) -} -func (m *TunnelGroupNatsOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TunnelGroupNatsOptions.Marshal(b, m, deterministic) -} -func (m *TunnelGroupNatsOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_TunnelGroupNatsOptions.Merge(m, src) -} -func (m *TunnelGroupNatsOptions) XXX_Size() int { - return xxx_messageInfo_TunnelGroupNatsOptions.Size(m) +func (x *TunnelGroupNatsOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TunnelGroupNatsOptions) XXX_DiscardUnknown() { - xxx_messageInfo_TunnelGroupNatsOptions.DiscardUnknown(m) + +func (*TunnelGroupNatsOptions) ProtoMessage() {} + +func (x *TunnelGroupNatsOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TunnelGroupNatsOptions proto.InternalMessageInfo +// Deprecated: Use TunnelGroupNatsOptions.ProtoReflect.Descriptor instead. +func (*TunnelGroupNatsOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_tunnel_proto_rawDescGZIP(), []int{5} +} -func (m *TunnelGroupNatsOptions) GetXConn() *args.NatsConn { - if m != nil { - return m.XConn +func (x *TunnelGroupNatsOptions) GetXConn() *args.NatsConn { + if x != nil { + return x.XConn } return nil } -func (m *TunnelGroupNatsOptions) GetArgs() *args.NatsWriteArgs { - if m != nil { - return m.Args +func (x *TunnelGroupNatsOptions) GetArgs() *args.NatsWriteArgs { + if x != nil { + return x.Args } return nil } type TunnelGroupNatsJetstreamOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.NatsJetstreamConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.NatsJetstreamWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.NatsJetstreamWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *TunnelGroupNatsJetstreamOptions) Reset() { *m = TunnelGroupNatsJetstreamOptions{} } -func (m *TunnelGroupNatsJetstreamOptions) String() string { return proto.CompactTextString(m) } -func (*TunnelGroupNatsJetstreamOptions) ProtoMessage() {} -func (*TunnelGroupNatsJetstreamOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_7ce1637d1f7d7036, []int{6} +func (x *TunnelGroupNatsJetstreamOptions) Reset() { + *x = TunnelGroupNatsJetstreamOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TunnelGroupNatsJetstreamOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TunnelGroupNatsJetstreamOptions.Unmarshal(m, b) -} -func (m *TunnelGroupNatsJetstreamOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TunnelGroupNatsJetstreamOptions.Marshal(b, m, deterministic) -} -func (m *TunnelGroupNatsJetstreamOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_TunnelGroupNatsJetstreamOptions.Merge(m, src) -} -func (m *TunnelGroupNatsJetstreamOptions) XXX_Size() int { - return xxx_messageInfo_TunnelGroupNatsJetstreamOptions.Size(m) +func (x *TunnelGroupNatsJetstreamOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TunnelGroupNatsJetstreamOptions) XXX_DiscardUnknown() { - xxx_messageInfo_TunnelGroupNatsJetstreamOptions.DiscardUnknown(m) + +func (*TunnelGroupNatsJetstreamOptions) ProtoMessage() {} + +func (x *TunnelGroupNatsJetstreamOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TunnelGroupNatsJetstreamOptions proto.InternalMessageInfo +// Deprecated: Use TunnelGroupNatsJetstreamOptions.ProtoReflect.Descriptor instead. +func (*TunnelGroupNatsJetstreamOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_tunnel_proto_rawDescGZIP(), []int{6} +} -func (m *TunnelGroupNatsJetstreamOptions) GetXConn() *args.NatsJetstreamConn { - if m != nil { - return m.XConn +func (x *TunnelGroupNatsJetstreamOptions) GetXConn() *args.NatsJetstreamConn { + if x != nil { + return x.XConn } return nil } -func (m *TunnelGroupNatsJetstreamOptions) GetArgs() *args.NatsJetstreamWriteArgs { - if m != nil { - return m.Args +func (x *TunnelGroupNatsJetstreamOptions) GetArgs() *args.NatsJetstreamWriteArgs { + if x != nil { + return x.Args } return nil } type TunnelGroupNatsStreamingOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.NatsStreamingConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.NatsStreamingWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.NatsStreamingWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *TunnelGroupNatsStreamingOptions) Reset() { *m = TunnelGroupNatsStreamingOptions{} } -func (m *TunnelGroupNatsStreamingOptions) String() string { return proto.CompactTextString(m) } -func (*TunnelGroupNatsStreamingOptions) ProtoMessage() {} -func (*TunnelGroupNatsStreamingOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_7ce1637d1f7d7036, []int{7} +func (x *TunnelGroupNatsStreamingOptions) Reset() { + *x = TunnelGroupNatsStreamingOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TunnelGroupNatsStreamingOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TunnelGroupNatsStreamingOptions.Unmarshal(m, b) +func (x *TunnelGroupNatsStreamingOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TunnelGroupNatsStreamingOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TunnelGroupNatsStreamingOptions.Marshal(b, m, deterministic) -} -func (m *TunnelGroupNatsStreamingOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_TunnelGroupNatsStreamingOptions.Merge(m, src) -} -func (m *TunnelGroupNatsStreamingOptions) XXX_Size() int { - return xxx_messageInfo_TunnelGroupNatsStreamingOptions.Size(m) -} -func (m *TunnelGroupNatsStreamingOptions) XXX_DiscardUnknown() { - xxx_messageInfo_TunnelGroupNatsStreamingOptions.DiscardUnknown(m) + +func (*TunnelGroupNatsStreamingOptions) ProtoMessage() {} + +func (x *TunnelGroupNatsStreamingOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TunnelGroupNatsStreamingOptions proto.InternalMessageInfo +// Deprecated: Use TunnelGroupNatsStreamingOptions.ProtoReflect.Descriptor instead. +func (*TunnelGroupNatsStreamingOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_tunnel_proto_rawDescGZIP(), []int{7} +} -func (m *TunnelGroupNatsStreamingOptions) GetXConn() *args.NatsStreamingConn { - if m != nil { - return m.XConn +func (x *TunnelGroupNatsStreamingOptions) GetXConn() *args.NatsStreamingConn { + if x != nil { + return x.XConn } return nil } -func (m *TunnelGroupNatsStreamingOptions) GetArgs() *args.NatsStreamingWriteArgs { - if m != nil { - return m.Args +func (x *TunnelGroupNatsStreamingOptions) GetArgs() *args.NatsStreamingWriteArgs { + if x != nil { + return x.Args } return nil } type TunnelGroupNSQOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.NSQConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.NSQWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.NSQWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *TunnelGroupNSQOptions) Reset() { *m = TunnelGroupNSQOptions{} } -func (m *TunnelGroupNSQOptions) String() string { return proto.CompactTextString(m) } -func (*TunnelGroupNSQOptions) ProtoMessage() {} -func (*TunnelGroupNSQOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_7ce1637d1f7d7036, []int{8} +func (x *TunnelGroupNSQOptions) Reset() { + *x = TunnelGroupNSQOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TunnelGroupNSQOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TunnelGroupNSQOptions.Unmarshal(m, b) +func (x *TunnelGroupNSQOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TunnelGroupNSQOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TunnelGroupNSQOptions.Marshal(b, m, deterministic) -} -func (m *TunnelGroupNSQOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_TunnelGroupNSQOptions.Merge(m, src) -} -func (m *TunnelGroupNSQOptions) XXX_Size() int { - return xxx_messageInfo_TunnelGroupNSQOptions.Size(m) -} -func (m *TunnelGroupNSQOptions) XXX_DiscardUnknown() { - xxx_messageInfo_TunnelGroupNSQOptions.DiscardUnknown(m) + +func (*TunnelGroupNSQOptions) ProtoMessage() {} + +func (x *TunnelGroupNSQOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TunnelGroupNSQOptions proto.InternalMessageInfo +// Deprecated: Use TunnelGroupNSQOptions.ProtoReflect.Descriptor instead. +func (*TunnelGroupNSQOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_tunnel_proto_rawDescGZIP(), []int{8} +} -func (m *TunnelGroupNSQOptions) GetXConn() *args.NSQConn { - if m != nil { - return m.XConn +func (x *TunnelGroupNSQOptions) GetXConn() *args.NSQConn { + if x != nil { + return x.XConn } return nil } -func (m *TunnelGroupNSQOptions) GetArgs() *args.NSQWriteArgs { - if m != nil { - return m.Args +func (x *TunnelGroupNSQOptions) GetArgs() *args.NSQWriteArgs { + if x != nil { + return x.Args } return nil } type TunnelGroupRabbitOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.RabbitConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.RabbitWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.RabbitWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *TunnelGroupRabbitOptions) Reset() { *m = TunnelGroupRabbitOptions{} } -func (m *TunnelGroupRabbitOptions) String() string { return proto.CompactTextString(m) } -func (*TunnelGroupRabbitOptions) ProtoMessage() {} -func (*TunnelGroupRabbitOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_7ce1637d1f7d7036, []int{9} +func (x *TunnelGroupRabbitOptions) Reset() { + *x = TunnelGroupRabbitOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TunnelGroupRabbitOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TunnelGroupRabbitOptions.Unmarshal(m, b) +func (x *TunnelGroupRabbitOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TunnelGroupRabbitOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TunnelGroupRabbitOptions.Marshal(b, m, deterministic) -} -func (m *TunnelGroupRabbitOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_TunnelGroupRabbitOptions.Merge(m, src) -} -func (m *TunnelGroupRabbitOptions) XXX_Size() int { - return xxx_messageInfo_TunnelGroupRabbitOptions.Size(m) -} -func (m *TunnelGroupRabbitOptions) XXX_DiscardUnknown() { - xxx_messageInfo_TunnelGroupRabbitOptions.DiscardUnknown(m) + +func (*TunnelGroupRabbitOptions) ProtoMessage() {} + +func (x *TunnelGroupRabbitOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TunnelGroupRabbitOptions proto.InternalMessageInfo +// Deprecated: Use TunnelGroupRabbitOptions.ProtoReflect.Descriptor instead. +func (*TunnelGroupRabbitOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_tunnel_proto_rawDescGZIP(), []int{9} +} -func (m *TunnelGroupRabbitOptions) GetXConn() *args.RabbitConn { - if m != nil { - return m.XConn +func (x *TunnelGroupRabbitOptions) GetXConn() *args.RabbitConn { + if x != nil { + return x.XConn } return nil } -func (m *TunnelGroupRabbitOptions) GetArgs() *args.RabbitWriteArgs { - if m != nil { - return m.Args +func (x *TunnelGroupRabbitOptions) GetArgs() *args.RabbitWriteArgs { + if x != nil { + return x.Args } return nil } type TunnelGroupRabbitStreamsOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.RabbitStreamsConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.RabbitStreamsWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.RabbitStreamsWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *TunnelGroupRabbitStreamsOptions) Reset() { *m = TunnelGroupRabbitStreamsOptions{} } -func (m *TunnelGroupRabbitStreamsOptions) String() string { return proto.CompactTextString(m) } -func (*TunnelGroupRabbitStreamsOptions) ProtoMessage() {} -func (*TunnelGroupRabbitStreamsOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_7ce1637d1f7d7036, []int{10} +func (x *TunnelGroupRabbitStreamsOptions) Reset() { + *x = TunnelGroupRabbitStreamsOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TunnelGroupRabbitStreamsOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TunnelGroupRabbitStreamsOptions.Unmarshal(m, b) -} -func (m *TunnelGroupRabbitStreamsOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TunnelGroupRabbitStreamsOptions.Marshal(b, m, deterministic) -} -func (m *TunnelGroupRabbitStreamsOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_TunnelGroupRabbitStreamsOptions.Merge(m, src) -} -func (m *TunnelGroupRabbitStreamsOptions) XXX_Size() int { - return xxx_messageInfo_TunnelGroupRabbitStreamsOptions.Size(m) +func (x *TunnelGroupRabbitStreamsOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TunnelGroupRabbitStreamsOptions) XXX_DiscardUnknown() { - xxx_messageInfo_TunnelGroupRabbitStreamsOptions.DiscardUnknown(m) + +func (*TunnelGroupRabbitStreamsOptions) ProtoMessage() {} + +func (x *TunnelGroupRabbitStreamsOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TunnelGroupRabbitStreamsOptions proto.InternalMessageInfo +// Deprecated: Use TunnelGroupRabbitStreamsOptions.ProtoReflect.Descriptor instead. +func (*TunnelGroupRabbitStreamsOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_tunnel_proto_rawDescGZIP(), []int{10} +} -func (m *TunnelGroupRabbitStreamsOptions) GetXConn() *args.RabbitStreamsConn { - if m != nil { - return m.XConn +func (x *TunnelGroupRabbitStreamsOptions) GetXConn() *args.RabbitStreamsConn { + if x != nil { + return x.XConn } return nil } -func (m *TunnelGroupRabbitStreamsOptions) GetArgs() *args.RabbitStreamsWriteArgs { - if m != nil { - return m.Args +func (x *TunnelGroupRabbitStreamsOptions) GetArgs() *args.RabbitStreamsWriteArgs { + if x != nil { + return x.Args } return nil } type TunnelGroupRedisPubSubOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.RedisPubSubConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.RedisPubSubWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.RedisPubSubWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *TunnelGroupRedisPubSubOptions) Reset() { *m = TunnelGroupRedisPubSubOptions{} } -func (m *TunnelGroupRedisPubSubOptions) String() string { return proto.CompactTextString(m) } -func (*TunnelGroupRedisPubSubOptions) ProtoMessage() {} -func (*TunnelGroupRedisPubSubOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_7ce1637d1f7d7036, []int{11} +func (x *TunnelGroupRedisPubSubOptions) Reset() { + *x = TunnelGroupRedisPubSubOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TunnelGroupRedisPubSubOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TunnelGroupRedisPubSubOptions.Unmarshal(m, b) +func (x *TunnelGroupRedisPubSubOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TunnelGroupRedisPubSubOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TunnelGroupRedisPubSubOptions.Marshal(b, m, deterministic) -} -func (m *TunnelGroupRedisPubSubOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_TunnelGroupRedisPubSubOptions.Merge(m, src) -} -func (m *TunnelGroupRedisPubSubOptions) XXX_Size() int { - return xxx_messageInfo_TunnelGroupRedisPubSubOptions.Size(m) -} -func (m *TunnelGroupRedisPubSubOptions) XXX_DiscardUnknown() { - xxx_messageInfo_TunnelGroupRedisPubSubOptions.DiscardUnknown(m) + +func (*TunnelGroupRedisPubSubOptions) ProtoMessage() {} + +func (x *TunnelGroupRedisPubSubOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TunnelGroupRedisPubSubOptions proto.InternalMessageInfo +// Deprecated: Use TunnelGroupRedisPubSubOptions.ProtoReflect.Descriptor instead. +func (*TunnelGroupRedisPubSubOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_tunnel_proto_rawDescGZIP(), []int{11} +} -func (m *TunnelGroupRedisPubSubOptions) GetXConn() *args.RedisPubSubConn { - if m != nil { - return m.XConn +func (x *TunnelGroupRedisPubSubOptions) GetXConn() *args.RedisPubSubConn { + if x != nil { + return x.XConn } return nil } -func (m *TunnelGroupRedisPubSubOptions) GetArgs() *args.RedisPubSubWriteArgs { - if m != nil { - return m.Args +func (x *TunnelGroupRedisPubSubOptions) GetArgs() *args.RedisPubSubWriteArgs { + if x != nil { + return x.Args } return nil } type TunnelGroupRedisStreamsOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.RedisStreamsConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.RedisStreamsWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.RedisStreamsWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *TunnelGroupRedisStreamsOptions) Reset() { *m = TunnelGroupRedisStreamsOptions{} } -func (m *TunnelGroupRedisStreamsOptions) String() string { return proto.CompactTextString(m) } -func (*TunnelGroupRedisStreamsOptions) ProtoMessage() {} -func (*TunnelGroupRedisStreamsOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_7ce1637d1f7d7036, []int{12} +func (x *TunnelGroupRedisStreamsOptions) Reset() { + *x = TunnelGroupRedisStreamsOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TunnelGroupRedisStreamsOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TunnelGroupRedisStreamsOptions.Unmarshal(m, b) +func (x *TunnelGroupRedisStreamsOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TunnelGroupRedisStreamsOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TunnelGroupRedisStreamsOptions.Marshal(b, m, deterministic) -} -func (m *TunnelGroupRedisStreamsOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_TunnelGroupRedisStreamsOptions.Merge(m, src) -} -func (m *TunnelGroupRedisStreamsOptions) XXX_Size() int { - return xxx_messageInfo_TunnelGroupRedisStreamsOptions.Size(m) -} -func (m *TunnelGroupRedisStreamsOptions) XXX_DiscardUnknown() { - xxx_messageInfo_TunnelGroupRedisStreamsOptions.DiscardUnknown(m) + +func (*TunnelGroupRedisStreamsOptions) ProtoMessage() {} + +func (x *TunnelGroupRedisStreamsOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TunnelGroupRedisStreamsOptions proto.InternalMessageInfo +// Deprecated: Use TunnelGroupRedisStreamsOptions.ProtoReflect.Descriptor instead. +func (*TunnelGroupRedisStreamsOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_tunnel_proto_rawDescGZIP(), []int{12} +} -func (m *TunnelGroupRedisStreamsOptions) GetXConn() *args.RedisStreamsConn { - if m != nil { - return m.XConn +func (x *TunnelGroupRedisStreamsOptions) GetXConn() *args.RedisStreamsConn { + if x != nil { + return x.XConn } return nil } -func (m *TunnelGroupRedisStreamsOptions) GetArgs() *args.RedisStreamsWriteArgs { - if m != nil { - return m.Args +func (x *TunnelGroupRedisStreamsOptions) GetArgs() *args.RedisStreamsWriteArgs { + if x != nil { + return x.Args } return nil } type TunnelGroupAzureEventHubOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.AzureEventHubConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.AzureEventHubWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.AzureEventHubWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *TunnelGroupAzureEventHubOptions) Reset() { *m = TunnelGroupAzureEventHubOptions{} } -func (m *TunnelGroupAzureEventHubOptions) String() string { return proto.CompactTextString(m) } -func (*TunnelGroupAzureEventHubOptions) ProtoMessage() {} -func (*TunnelGroupAzureEventHubOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_7ce1637d1f7d7036, []int{13} +func (x *TunnelGroupAzureEventHubOptions) Reset() { + *x = TunnelGroupAzureEventHubOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TunnelGroupAzureEventHubOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TunnelGroupAzureEventHubOptions.Unmarshal(m, b) +func (x *TunnelGroupAzureEventHubOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TunnelGroupAzureEventHubOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TunnelGroupAzureEventHubOptions.Marshal(b, m, deterministic) -} -func (m *TunnelGroupAzureEventHubOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_TunnelGroupAzureEventHubOptions.Merge(m, src) -} -func (m *TunnelGroupAzureEventHubOptions) XXX_Size() int { - return xxx_messageInfo_TunnelGroupAzureEventHubOptions.Size(m) -} -func (m *TunnelGroupAzureEventHubOptions) XXX_DiscardUnknown() { - xxx_messageInfo_TunnelGroupAzureEventHubOptions.DiscardUnknown(m) + +func (*TunnelGroupAzureEventHubOptions) ProtoMessage() {} + +func (x *TunnelGroupAzureEventHubOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TunnelGroupAzureEventHubOptions proto.InternalMessageInfo +// Deprecated: Use TunnelGroupAzureEventHubOptions.ProtoReflect.Descriptor instead. +func (*TunnelGroupAzureEventHubOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_tunnel_proto_rawDescGZIP(), []int{13} +} -func (m *TunnelGroupAzureEventHubOptions) GetXConn() *args.AzureEventHubConn { - if m != nil { - return m.XConn +func (x *TunnelGroupAzureEventHubOptions) GetXConn() *args.AzureEventHubConn { + if x != nil { + return x.XConn } return nil } -func (m *TunnelGroupAzureEventHubOptions) GetArgs() *args.AzureEventHubWriteArgs { - if m != nil { - return m.Args +func (x *TunnelGroupAzureEventHubOptions) GetArgs() *args.AzureEventHubWriteArgs { + if x != nil { + return x.Args } return nil } type TunnelGroupAzureServiceBusOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed"{ XConn *args.AzureServiceBusConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.AzureServiceBusWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.AzureServiceBusWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *TunnelGroupAzureServiceBusOptions) Reset() { *m = TunnelGroupAzureServiceBusOptions{} } -func (m *TunnelGroupAzureServiceBusOptions) String() string { return proto.CompactTextString(m) } -func (*TunnelGroupAzureServiceBusOptions) ProtoMessage() {} -func (*TunnelGroupAzureServiceBusOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_7ce1637d1f7d7036, []int{14} +func (x *TunnelGroupAzureServiceBusOptions) Reset() { + *x = TunnelGroupAzureServiceBusOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TunnelGroupAzureServiceBusOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TunnelGroupAzureServiceBusOptions.Unmarshal(m, b) -} -func (m *TunnelGroupAzureServiceBusOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TunnelGroupAzureServiceBusOptions.Marshal(b, m, deterministic) +func (x *TunnelGroupAzureServiceBusOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TunnelGroupAzureServiceBusOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_TunnelGroupAzureServiceBusOptions.Merge(m, src) -} -func (m *TunnelGroupAzureServiceBusOptions) XXX_Size() int { - return xxx_messageInfo_TunnelGroupAzureServiceBusOptions.Size(m) -} -func (m *TunnelGroupAzureServiceBusOptions) XXX_DiscardUnknown() { - xxx_messageInfo_TunnelGroupAzureServiceBusOptions.DiscardUnknown(m) + +func (*TunnelGroupAzureServiceBusOptions) ProtoMessage() {} + +func (x *TunnelGroupAzureServiceBusOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TunnelGroupAzureServiceBusOptions proto.InternalMessageInfo +// Deprecated: Use TunnelGroupAzureServiceBusOptions.ProtoReflect.Descriptor instead. +func (*TunnelGroupAzureServiceBusOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_tunnel_proto_rawDescGZIP(), []int{14} +} -func (m *TunnelGroupAzureServiceBusOptions) GetXConn() *args.AzureServiceBusConn { - if m != nil { - return m.XConn +func (x *TunnelGroupAzureServiceBusOptions) GetXConn() *args.AzureServiceBusConn { + if x != nil { + return x.XConn } return nil } -func (m *TunnelGroupAzureServiceBusOptions) GetArgs() *args.AzureServiceBusWriteArgs { - if m != nil { - return m.Args +func (x *TunnelGroupAzureServiceBusOptions) GetArgs() *args.AzureServiceBusWriteArgs { + if x != nil { + return x.Args } return nil } type TunnelGroupMQTTOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.MQTTConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.MQTTWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.MQTTWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *TunnelGroupMQTTOptions) Reset() { *m = TunnelGroupMQTTOptions{} } -func (m *TunnelGroupMQTTOptions) String() string { return proto.CompactTextString(m) } -func (*TunnelGroupMQTTOptions) ProtoMessage() {} -func (*TunnelGroupMQTTOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_7ce1637d1f7d7036, []int{15} +func (x *TunnelGroupMQTTOptions) Reset() { + *x = TunnelGroupMQTTOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TunnelGroupMQTTOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TunnelGroupMQTTOptions.Unmarshal(m, b) +func (x *TunnelGroupMQTTOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TunnelGroupMQTTOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TunnelGroupMQTTOptions.Marshal(b, m, deterministic) -} -func (m *TunnelGroupMQTTOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_TunnelGroupMQTTOptions.Merge(m, src) -} -func (m *TunnelGroupMQTTOptions) XXX_Size() int { - return xxx_messageInfo_TunnelGroupMQTTOptions.Size(m) -} -func (m *TunnelGroupMQTTOptions) XXX_DiscardUnknown() { - xxx_messageInfo_TunnelGroupMQTTOptions.DiscardUnknown(m) + +func (*TunnelGroupMQTTOptions) ProtoMessage() {} + +func (x *TunnelGroupMQTTOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TunnelGroupMQTTOptions proto.InternalMessageInfo +// Deprecated: Use TunnelGroupMQTTOptions.ProtoReflect.Descriptor instead. +func (*TunnelGroupMQTTOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_tunnel_proto_rawDescGZIP(), []int{15} +} -func (m *TunnelGroupMQTTOptions) GetXConn() *args.MQTTConn { - if m != nil { - return m.XConn +func (x *TunnelGroupMQTTOptions) GetXConn() *args.MQTTConn { + if x != nil { + return x.XConn } return nil } -func (m *TunnelGroupMQTTOptions) GetArgs() *args.MQTTWriteArgs { - if m != nil { - return m.Args +func (x *TunnelGroupMQTTOptions) GetArgs() *args.MQTTWriteArgs { + if x != nil { + return x.Args } return nil } type TunnelGroupGCPPubSubOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.GCPPubSubConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.GCPPubSubWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.GCPPubSubWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *TunnelGroupGCPPubSubOptions) Reset() { *m = TunnelGroupGCPPubSubOptions{} } -func (m *TunnelGroupGCPPubSubOptions) String() string { return proto.CompactTextString(m) } -func (*TunnelGroupGCPPubSubOptions) ProtoMessage() {} -func (*TunnelGroupGCPPubSubOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_7ce1637d1f7d7036, []int{16} +func (x *TunnelGroupGCPPubSubOptions) Reset() { + *x = TunnelGroupGCPPubSubOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TunnelGroupGCPPubSubOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TunnelGroupGCPPubSubOptions.Unmarshal(m, b) +func (x *TunnelGroupGCPPubSubOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TunnelGroupGCPPubSubOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TunnelGroupGCPPubSubOptions.Marshal(b, m, deterministic) -} -func (m *TunnelGroupGCPPubSubOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_TunnelGroupGCPPubSubOptions.Merge(m, src) -} -func (m *TunnelGroupGCPPubSubOptions) XXX_Size() int { - return xxx_messageInfo_TunnelGroupGCPPubSubOptions.Size(m) -} -func (m *TunnelGroupGCPPubSubOptions) XXX_DiscardUnknown() { - xxx_messageInfo_TunnelGroupGCPPubSubOptions.DiscardUnknown(m) + +func (*TunnelGroupGCPPubSubOptions) ProtoMessage() {} + +func (x *TunnelGroupGCPPubSubOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TunnelGroupGCPPubSubOptions proto.InternalMessageInfo +// Deprecated: Use TunnelGroupGCPPubSubOptions.ProtoReflect.Descriptor instead. +func (*TunnelGroupGCPPubSubOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_tunnel_proto_rawDescGZIP(), []int{16} +} -func (m *TunnelGroupGCPPubSubOptions) GetXConn() *args.GCPPubSubConn { - if m != nil { - return m.XConn +func (x *TunnelGroupGCPPubSubOptions) GetXConn() *args.GCPPubSubConn { + if x != nil { + return x.XConn } return nil } -func (m *TunnelGroupGCPPubSubOptions) GetArgs() *args.GCPPubSubWriteArgs { - if m != nil { - return m.Args +func (x *TunnelGroupGCPPubSubOptions) GetArgs() *args.GCPPubSubWriteArgs { + if x != nil { + return x.Args } return nil } type TunnelGroupKubeMQQueueOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.KubeMQQueueConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.KubeMQQueueWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.KubeMQQueueWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *TunnelGroupKubeMQQueueOptions) Reset() { *m = TunnelGroupKubeMQQueueOptions{} } -func (m *TunnelGroupKubeMQQueueOptions) String() string { return proto.CompactTextString(m) } -func (*TunnelGroupKubeMQQueueOptions) ProtoMessage() {} -func (*TunnelGroupKubeMQQueueOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_7ce1637d1f7d7036, []int{17} +func (x *TunnelGroupKubeMQQueueOptions) Reset() { + *x = TunnelGroupKubeMQQueueOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TunnelGroupKubeMQQueueOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TunnelGroupKubeMQQueueOptions.Unmarshal(m, b) +func (x *TunnelGroupKubeMQQueueOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TunnelGroupKubeMQQueueOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TunnelGroupKubeMQQueueOptions.Marshal(b, m, deterministic) -} -func (m *TunnelGroupKubeMQQueueOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_TunnelGroupKubeMQQueueOptions.Merge(m, src) -} -func (m *TunnelGroupKubeMQQueueOptions) XXX_Size() int { - return xxx_messageInfo_TunnelGroupKubeMQQueueOptions.Size(m) -} -func (m *TunnelGroupKubeMQQueueOptions) XXX_DiscardUnknown() { - xxx_messageInfo_TunnelGroupKubeMQQueueOptions.DiscardUnknown(m) + +func (*TunnelGroupKubeMQQueueOptions) ProtoMessage() {} + +func (x *TunnelGroupKubeMQQueueOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TunnelGroupKubeMQQueueOptions proto.InternalMessageInfo +// Deprecated: Use TunnelGroupKubeMQQueueOptions.ProtoReflect.Descriptor instead. +func (*TunnelGroupKubeMQQueueOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_tunnel_proto_rawDescGZIP(), []int{17} +} -func (m *TunnelGroupKubeMQQueueOptions) GetXConn() *args.KubeMQQueueConn { - if m != nil { - return m.XConn +func (x *TunnelGroupKubeMQQueueOptions) GetXConn() *args.KubeMQQueueConn { + if x != nil { + return x.XConn } return nil } -func (m *TunnelGroupKubeMQQueueOptions) GetArgs() *args.KubeMQQueueWriteArgs { - if m != nil { - return m.Args +func (x *TunnelGroupKubeMQQueueOptions) GetArgs() *args.KubeMQQueueWriteArgs { + if x != nil { + return x.Args } return nil } type TunnelGroupPulsarOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.PulsarConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.PulsarWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.PulsarWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *TunnelGroupPulsarOptions) Reset() { *m = TunnelGroupPulsarOptions{} } -func (m *TunnelGroupPulsarOptions) String() string { return proto.CompactTextString(m) } -func (*TunnelGroupPulsarOptions) ProtoMessage() {} -func (*TunnelGroupPulsarOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_7ce1637d1f7d7036, []int{18} +func (x *TunnelGroupPulsarOptions) Reset() { + *x = TunnelGroupPulsarOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TunnelGroupPulsarOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TunnelGroupPulsarOptions.Unmarshal(m, b) -} -func (m *TunnelGroupPulsarOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TunnelGroupPulsarOptions.Marshal(b, m, deterministic) -} -func (m *TunnelGroupPulsarOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_TunnelGroupPulsarOptions.Merge(m, src) -} -func (m *TunnelGroupPulsarOptions) XXX_Size() int { - return xxx_messageInfo_TunnelGroupPulsarOptions.Size(m) +func (x *TunnelGroupPulsarOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TunnelGroupPulsarOptions) XXX_DiscardUnknown() { - xxx_messageInfo_TunnelGroupPulsarOptions.DiscardUnknown(m) + +func (*TunnelGroupPulsarOptions) ProtoMessage() {} + +func (x *TunnelGroupPulsarOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TunnelGroupPulsarOptions proto.InternalMessageInfo +// Deprecated: Use TunnelGroupPulsarOptions.ProtoReflect.Descriptor instead. +func (*TunnelGroupPulsarOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_tunnel_proto_rawDescGZIP(), []int{18} +} -func (m *TunnelGroupPulsarOptions) GetXConn() *args.PulsarConn { - if m != nil { - return m.XConn +func (x *TunnelGroupPulsarOptions) GetXConn() *args.PulsarConn { + if x != nil { + return x.XConn } return nil } -func (m *TunnelGroupPulsarOptions) GetArgs() *args.PulsarWriteArgs { - if m != nil { - return m.Args +func (x *TunnelGroupPulsarOptions) GetArgs() *args.PulsarWriteArgs { + if x != nil { + return x.Args } return nil } type TunnelGroupAWSKinesisOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.AWSKinesisConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.AWSKinesisWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.AWSKinesisWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *TunnelGroupAWSKinesisOptions) Reset() { *m = TunnelGroupAWSKinesisOptions{} } -func (m *TunnelGroupAWSKinesisOptions) String() string { return proto.CompactTextString(m) } -func (*TunnelGroupAWSKinesisOptions) ProtoMessage() {} -func (*TunnelGroupAWSKinesisOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_7ce1637d1f7d7036, []int{19} +func (x *TunnelGroupAWSKinesisOptions) Reset() { + *x = TunnelGroupAWSKinesisOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TunnelGroupAWSKinesisOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TunnelGroupAWSKinesisOptions.Unmarshal(m, b) +func (x *TunnelGroupAWSKinesisOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TunnelGroupAWSKinesisOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TunnelGroupAWSKinesisOptions.Marshal(b, m, deterministic) -} -func (m *TunnelGroupAWSKinesisOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_TunnelGroupAWSKinesisOptions.Merge(m, src) -} -func (m *TunnelGroupAWSKinesisOptions) XXX_Size() int { - return xxx_messageInfo_TunnelGroupAWSKinesisOptions.Size(m) -} -func (m *TunnelGroupAWSKinesisOptions) XXX_DiscardUnknown() { - xxx_messageInfo_TunnelGroupAWSKinesisOptions.DiscardUnknown(m) + +func (*TunnelGroupAWSKinesisOptions) ProtoMessage() {} + +func (x *TunnelGroupAWSKinesisOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TunnelGroupAWSKinesisOptions proto.InternalMessageInfo +// Deprecated: Use TunnelGroupAWSKinesisOptions.ProtoReflect.Descriptor instead. +func (*TunnelGroupAWSKinesisOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_tunnel_proto_rawDescGZIP(), []int{19} +} -func (m *TunnelGroupAWSKinesisOptions) GetXConn() *args.AWSKinesisConn { - if m != nil { - return m.XConn +func (x *TunnelGroupAWSKinesisOptions) GetXConn() *args.AWSKinesisConn { + if x != nil { + return x.XConn } return nil } -func (m *TunnelGroupAWSKinesisOptions) GetArgs() *args.AWSKinesisWriteArgs { - if m != nil { - return m.Args +func (x *TunnelGroupAWSKinesisOptions) GetArgs() *args.AWSKinesisWriteArgs { + if x != nil { + return x.Args } return nil } type TunnelGroupMemphisOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.MemphisConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.MemphisWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.MemphisWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *TunnelGroupMemphisOptions) Reset() { *m = TunnelGroupMemphisOptions{} } -func (m *TunnelGroupMemphisOptions) String() string { return proto.CompactTextString(m) } -func (*TunnelGroupMemphisOptions) ProtoMessage() {} -func (*TunnelGroupMemphisOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_7ce1637d1f7d7036, []int{20} +func (x *TunnelGroupMemphisOptions) Reset() { + *x = TunnelGroupMemphisOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TunnelGroupMemphisOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TunnelGroupMemphisOptions.Unmarshal(m, b) -} -func (m *TunnelGroupMemphisOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TunnelGroupMemphisOptions.Marshal(b, m, deterministic) -} -func (m *TunnelGroupMemphisOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_TunnelGroupMemphisOptions.Merge(m, src) -} -func (m *TunnelGroupMemphisOptions) XXX_Size() int { - return xxx_messageInfo_TunnelGroupMemphisOptions.Size(m) +func (x *TunnelGroupMemphisOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TunnelGroupMemphisOptions) XXX_DiscardUnknown() { - xxx_messageInfo_TunnelGroupMemphisOptions.DiscardUnknown(m) + +func (*TunnelGroupMemphisOptions) ProtoMessage() {} + +func (x *TunnelGroupMemphisOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_tunnel_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TunnelGroupMemphisOptions proto.InternalMessageInfo +// Deprecated: Use TunnelGroupMemphisOptions.ProtoReflect.Descriptor instead. +func (*TunnelGroupMemphisOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_tunnel_proto_rawDescGZIP(), []int{20} +} -func (m *TunnelGroupMemphisOptions) GetXConn() *args.MemphisConn { - if m != nil { - return m.XConn +func (x *TunnelGroupMemphisOptions) GetXConn() *args.MemphisConn { + if x != nil { + return x.XConn } return nil } -func (m *TunnelGroupMemphisOptions) GetArgs() *args.MemphisWriteArgs { - if m != nil { - return m.Args +func (x *TunnelGroupMemphisOptions) GetArgs() *args.MemphisWriteArgs { + if x != nil { + return x.Args } return nil } -func init() { - proto.RegisterType((*TunnelOptions)(nil), "protos.opts.TunnelOptions") - proto.RegisterType((*TunnelGroupKafkaOptions)(nil), "protos.opts.TunnelGroupKafkaOptions") - proto.RegisterType((*TunnelGroupActiveMQOptions)(nil), "protos.opts.TunnelGroupActiveMQOptions") - proto.RegisterType((*TunnelGroupAWSSQSOptions)(nil), "protos.opts.TunnelGroupAWSSQSOptions") - proto.RegisterType((*TunnelGroupAWSSNSOptions)(nil), "protos.opts.TunnelGroupAWSSNSOptions") - proto.RegisterType((*TunnelGroupNatsOptions)(nil), "protos.opts.TunnelGroupNatsOptions") - proto.RegisterType((*TunnelGroupNatsJetstreamOptions)(nil), "protos.opts.TunnelGroupNatsJetstreamOptions") - proto.RegisterType((*TunnelGroupNatsStreamingOptions)(nil), "protos.opts.TunnelGroupNatsStreamingOptions") - proto.RegisterType((*TunnelGroupNSQOptions)(nil), "protos.opts.TunnelGroupNSQOptions") - proto.RegisterType((*TunnelGroupRabbitOptions)(nil), "protos.opts.TunnelGroupRabbitOptions") - proto.RegisterType((*TunnelGroupRabbitStreamsOptions)(nil), "protos.opts.TunnelGroupRabbitStreamsOptions") - proto.RegisterType((*TunnelGroupRedisPubSubOptions)(nil), "protos.opts.TunnelGroupRedisPubSubOptions") - proto.RegisterType((*TunnelGroupRedisStreamsOptions)(nil), "protos.opts.TunnelGroupRedisStreamsOptions") - proto.RegisterType((*TunnelGroupAzureEventHubOptions)(nil), "protos.opts.TunnelGroupAzureEventHubOptions") - proto.RegisterType((*TunnelGroupAzureServiceBusOptions)(nil), "protos.opts.TunnelGroupAzureServiceBusOptions") - proto.RegisterType((*TunnelGroupMQTTOptions)(nil), "protos.opts.TunnelGroupMQTTOptions") - proto.RegisterType((*TunnelGroupGCPPubSubOptions)(nil), "protos.opts.TunnelGroupGCPPubSubOptions") - proto.RegisterType((*TunnelGroupKubeMQQueueOptions)(nil), "protos.opts.TunnelGroupKubeMQQueueOptions") - proto.RegisterType((*TunnelGroupPulsarOptions)(nil), "protos.opts.TunnelGroupPulsarOptions") - proto.RegisterType((*TunnelGroupAWSKinesisOptions)(nil), "protos.opts.TunnelGroupAWSKinesisOptions") - proto.RegisterType((*TunnelGroupMemphisOptions)(nil), "protos.opts.TunnelGroupMemphisOptions") -} - -func init() { proto.RegisterFile("opts/ps_opts_tunnel.proto", fileDescriptor_7ce1637d1f7d7036) } - -var fileDescriptor_7ce1637d1f7d7036 = []byte{ - // 1318 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0x7f, 0x4f, 0xdb, 0x46, - 0x18, 0x96, 0x57, 0x0a, 0xe5, 0x42, 0x5a, 0xed, 0x34, 0xe0, 0x80, 0x02, 0x21, 0xd0, 0x8d, 0xfe, - 0x20, 0x29, 0xd0, 0xae, 0xea, 0xa6, 0x4d, 0xa3, 0x68, 0x62, 0xb4, 0x82, 0x41, 0x12, 0xa9, 0x52, - 0xff, 0xb1, 0x6c, 0xe7, 0x9a, 0xb8, 0x10, 0xdb, 0xf1, 0x9d, 0x41, 0xaa, 0x34, 0x69, 0xd2, 0xa4, - 0x49, 0x93, 0x26, 0xed, 0xaf, 0x7d, 0x99, 0x7d, 0xa2, 0xed, 0x5b, 0x4c, 0x77, 0x67, 0x1b, 0xbf, - 0x8e, 0x7d, 0x49, 0xff, 0x21, 0xe4, 0xde, 0xe7, 0x79, 0xde, 0x27, 0xef, 0xdd, 0xfb, 0xde, 0xa1, - 0x25, 0x3f, 0xe0, 0xac, 0x19, 0x30, 0x53, 0x7c, 0x9a, 0x3c, 0xf2, 0x3c, 0x7a, 0xd9, 0x08, 0x42, - 0x9f, 0xfb, 0xb8, 0x22, 0x3f, 0x58, 0x43, 0x44, 0x96, 0x57, 0xac, 0xb0, 0x27, 0x71, 0xe2, 0xd3, - 0xb4, 0x1c, 0xee, 0x5e, 0xd1, 0xc1, 0x50, 0x21, 0x97, 0xd7, 0x60, 0xf0, 0x9a, 0x99, 0x17, 0xae, - 0x47, 0x99, 0xcb, 0xe2, 0xf8, 0xf2, 0x48, 0x9c, 0x79, 0x9a, 0xd8, 0x30, 0x89, 0xd5, 0x61, 0xec, - 0x63, 0x14, 0x52, 0x93, 0x5e, 0x51, 0x8f, 0x9b, 0xfd, 0xc8, 0x8e, 0x31, 0x5b, 0x05, 0x18, 0x46, - 0xc3, 0x2b, 0xd7, 0xa1, 0xa6, 0x1d, 0x25, 0x4a, 0xab, 0x00, 0xd5, 0x73, 0x02, 0x33, 0x88, 0x6c, - 0x96, 0x8a, 0x10, 0x10, 0xbe, 0xb0, 0xde, 0x5f, 0x58, 0x71, 0x64, 0x1d, 0x46, 0x22, 0x9b, 0x0e, - 0x86, 0xe6, 0x30, 0xa2, 0x11, 0x2d, 0xf4, 0x3f, 0xa0, 0x83, 0xa0, 0x9f, 0xfe, 0xee, 0x45, 0x18, - 0x1b, 0x72, 0x5e, 0x18, 0xf0, 0x2c, 0x9e, 0x30, 0x36, 0x46, 0x02, 0xe6, 0x07, 0xca, 0x19, 0x0f, - 0xa9, 0x35, 0x28, 0x87, 0xa8, 0xb8, 0xeb, 0xf5, 0x62, 0xc8, 0x02, 0x84, 0xb0, 0x64, 0x9f, 0x96, - 0xc0, 0x7a, 0x10, 0x5d, 0x32, 0x2b, 0x2c, 0x0c, 0x85, 0x96, 0x6d, 0xbb, 0xbc, 0x30, 0xa1, 0x0a, - 0xc5, 0x29, 0x59, 0x61, 0x95, 0x42, 0xda, 0x75, 0x19, 0x2c, 0x70, 0xad, 0x00, 0x00, 0x24, 0xea, - 0xff, 0x54, 0x51, 0xb5, 0x23, 0x8f, 0xdf, 0xcf, 0x01, 0x77, 0x7d, 0x8f, 0xe1, 0x15, 0x34, 0x6b, - 0x05, 0xae, 0xc9, 0xfd, 0x0b, 0xea, 0x11, 0xa3, 0x66, 0x6c, 0xcf, 0xb6, 0xee, 0x58, 0x81, 0xdb, - 0x11, 0xdf, 0xf1, 0x26, 0xaa, 0x3a, 0xbe, 0xe7, 0x51, 0x47, 0x60, 0x4d, 0xb7, 0x4b, 0x3e, 0x93, - 0x80, 0xb9, 0x9b, 0xc5, 0xe3, 0x2e, 0xae, 0xa3, 0xaa, 0xd9, 0x0b, 0x03, 0xc7, 0xb4, 0xba, 0xdd, - 0x90, 0x32, 0x46, 0x6e, 0x49, 0x50, 0xe5, 0x28, 0x0c, 0x9c, 0x03, 0xb5, 0x84, 0x77, 0xd1, 0xbc, - 0xc2, 0x70, 0x77, 0x40, 0xfd, 0x88, 0x9b, 0x8c, 0x3a, 0xbe, 0xd7, 0x65, 0x64, 0xaa, 0x66, 0x6c, - 0x57, 0x5b, 0x58, 0x60, 0x3b, 0x2a, 0xd4, 0x56, 0x11, 0xbc, 0x85, 0xee, 0x2a, 0x8a, 0xeb, 0x31, - 0xea, 0x44, 0x21, 0x25, 0xb7, 0x6b, 0xc6, 0xf6, 0x9d, 0xd6, 0x9c, 0xc0, 0x1e, 0xc7, 0x6b, 0x18, - 0xa3, 0x29, 0xcf, 0x1a, 0x50, 0x32, 0x2d, 0x73, 0xca, 0xff, 0xf1, 0x2a, 0x42, 0x71, 0x8f, 0x09, - 0xcb, 0xff, 0xce, 0xa8, 0x1f, 0xa5, 0x7e, 0xf6, 0x71, 0x17, 0x13, 0x34, 0x13, 0xb7, 0x16, 0xf9, - 0x6f, 0x46, 0x4a, 0x4e, 0x1f, 0xc8, 0xaf, 0xf8, 0x1b, 0x74, 0x5b, 0x9e, 0x4a, 0xd2, 0xad, 0x19, - 0xdb, 0x95, 0xbd, 0xad, 0x46, 0xa6, 0x37, 0x1b, 0x8a, 0x7f, 0x14, 0xfa, 0x51, 0xf0, 0x46, 0x80, - 0xe2, 0x02, 0xb6, 0x14, 0x05, 0x1f, 0xa2, 0x3b, 0x49, 0xbf, 0x12, 0x2a, 0xe9, 0x5f, 0x95, 0xd1, - 0x55, 0xb6, 0x93, 0xf3, 0x44, 0x21, 0x25, 0xe2, 0xef, 0xd1, 0x4c, 0xdc, 0x9b, 0xe4, 0xbd, 0xd4, - 0x78, 0x50, 0xaa, 0xf1, 0xb6, 0xdd, 0x3e, 0x6f, 0x27, 0x0a, 0xd3, 0xd6, 0x35, 0x6b, 0x0f, 0x59, - 0xca, 0xf7, 0x18, 0xe9, 0x8d, 0xe7, 0x9f, 0x42, 0xbe, 0xc7, 0xf0, 0x0b, 0x51, 0x4d, 0xce, 0x48, - 0x5f, 0x92, 0x37, 0xcb, 0xc8, 0xa7, 0x16, 0x67, 0x09, 0x55, 0x12, 0x70, 0x1b, 0xdd, 0x85, 0x3d, - 0x42, 0x5c, 0x29, 0xf1, 0x44, 0x27, 0xd1, 0x4e, 0xc0, 0x89, 0x56, 0xd5, 0xcb, 0xae, 0xe2, 0x67, - 0xe8, 0x96, 0xc7, 0x86, 0xe4, 0x83, 0x54, 0xaa, 0x97, 0x2a, 0xb5, 0xd3, 0x42, 0x0a, 0x38, 0xfe, - 0x0e, 0x4d, 0xab, 0xee, 0x21, 0x17, 0xfa, 0x12, 0xb4, 0x24, 0x2a, 0x2d, 0x81, 0x22, 0x89, 0x12, - 0x88, 0x11, 0x42, 0x2e, 0xf5, 0x25, 0x38, 0x39, 0xef, 0x74, 0xd2, 0x12, 0x08, 0x02, 0x7e, 0x87, - 0x3e, 0x1f, 0x99, 0x8b, 0x64, 0x20, 0x55, 0x1a, 0xa5, 0xbb, 0x20, 0x08, 0x6d, 0x85, 0x7f, 0x15, - 0xa5, 0x35, 0xbd, 0x67, 0xc1, 0x75, 0xdc, 0x41, 0xf7, 0x72, 0x73, 0x99, 0x78, 0xfa, 0xfa, 0x4a, - 0xe5, 0x1f, 0x05, 0xfa, 0xa7, 0xc8, 0x4e, 0xeb, 0x6b, 0x65, 0x57, 0xf1, 0x11, 0x42, 0x37, 0x33, - 0x9a, 0xf8, 0x52, 0x70, 0xbb, 0x4c, 0xf0, 0xe8, 0xf0, 0xec, 0x2c, 0xb2, 0xdb, 0x37, 0x62, 0xb3, - 0x3d, 0x27, 0x38, 0x93, 0x54, 0x7c, 0x82, 0xe6, 0xb2, 0x33, 0x9b, 0x04, 0x52, 0xea, 0x51, 0x69, - 0xfb, 0x44, 0x36, 0x3d, 0x39, 0x3f, 0x17, 0xd0, 0x44, 0xac, 0xa2, 0xf8, 0x72, 0x4d, 0xc8, 0x65, - 0x87, 0x1b, 0x19, 0xea, 0xe5, 0x5a, 0x02, 0x0b, 0xbd, 0x55, 0xc2, 0x78, 0x4d, 0xb8, 0x3b, 0x43, - 0x55, 0x30, 0x0a, 0x49, 0x28, 0xf5, 0x1e, 0x6b, 0xf5, 0xd4, 0x29, 0x4c, 0x77, 0x44, 0x19, 0x8a, - 0x17, 0xc5, 0x11, 0x53, 0x63, 0x9d, 0x30, 0xfd, 0x11, 0x3b, 0x93, 0xa8, 0xf4, 0x88, 0x29, 0x92, - 0x68, 0x16, 0x38, 0xdf, 0x09, 0xd7, 0x6f, 0xa6, 0x3a, 0xa9, 0x39, 0x4b, 0xd5, 0x30, 0xbb, 0x9a, - 0x76, 0x60, 0x7a, 0x91, 0x91, 0x68, 0x7c, 0x07, 0xbe, 0x4e, 0xc0, 0xa0, 0x03, 0xd3, 0x55, 0xfc, - 0x1a, 0x55, 0x32, 0xef, 0x0c, 0x72, 0x25, 0x15, 0x1f, 0x6a, 0x66, 0xca, 0x1b, 0x85, 0x4c, 0xe4, - 0x90, 0x75, 0xcd, 0xe2, 0x25, 0xfc, 0x03, 0x9a, 0x89, 0xef, 0x6d, 0x72, 0x2d, 0x75, 0xbe, 0x2c, - 0xed, 0x2d, 0x05, 0x4b, 0x44, 0x12, 0x5a, 0xfd, 0x1a, 0x2d, 0x96, 0x0c, 0x61, 0xfc, 0x18, 0xdd, - 0x36, 0xc5, 0xa5, 0x24, 0x6f, 0xb0, 0xca, 0xde, 0x42, 0x22, 0x2d, 0x2e, 0xc2, 0x86, 0x44, 0x1e, - 0xfa, 0x9e, 0xd7, 0x9a, 0x12, 0x7f, 0x71, 0x13, 0x4d, 0x89, 0x75, 0x79, 0x99, 0x55, 0xf6, 0x56, - 0x46, 0xb1, 0x6f, 0x43, 0x97, 0xd3, 0x83, 0xb0, 0xc7, 0x5a, 0x12, 0x58, 0xff, 0xd5, 0x40, 0xcb, - 0xe5, 0xf3, 0x1b, 0x37, 0x60, 0xf2, 0x25, 0x20, 0x98, 0x80, 0x33, 0xf9, 0xf7, 0x40, 0xfe, 0xb5, - 0x42, 0x78, 0xde, 0xc2, 0x47, 0x44, 0xca, 0xa6, 0x3f, 0x7e, 0x02, 0xf3, 0x2f, 0x42, 0x41, 0x09, - 0xcd, 0x64, 0x7f, 0x0a, 0xb2, 0xdf, 0x2f, 0x00, 0x8f, 0xcf, 0x7d, 0x3a, 0x79, 0xee, 0xd3, 0x4f, - 0xc9, 0x7d, 0x3a, 0x92, 0x9b, 0xa3, 0x85, 0xe2, 0x8b, 0x07, 0x3f, 0x82, 0x99, 0xe7, 0x81, 0x98, - 0x00, 0x66, 0xf2, 0x36, 0x40, 0xde, 0xe5, 0x11, 0x68, 0x3e, 0xeb, 0x5f, 0x06, 0x5a, 0x1f, 0xd3, - 0x2a, 0x78, 0x1f, 0xe6, 0x5f, 0x1b, 0x11, 0x4d, 0x19, 0x19, 0x23, 0x2f, 0x80, 0x91, 0xcd, 0x72, - 0xce, 0x04, 0x8e, 0xf2, 0xd7, 0xe7, 0x78, 0x47, 0x29, 0xe3, 0x13, 0x1c, 0xa5, 0x9c, 0xbc, 0xa3, - 0x21, 0x9a, 0x2f, 0xbc, 0x85, 0xf1, 0x43, 0x68, 0xe3, 0x0b, 0x28, 0xd9, 0xce, 0x76, 0xc2, 0x0e, - 0x48, 0xbe, 0x94, 0x47, 0xea, 0x0f, 0x22, 0xb8, 0xbf, 0xf5, 0x07, 0x51, 0x41, 0x27, 0x3c, 0x88, - 0x0a, 0x3c, 0x66, 0x03, 0x8a, 0x46, 0xb2, 0x7e, 0x03, 0x00, 0x63, 0xc2, 0x0d, 0x00, 0x9c, 0xbc, - 0xa3, 0x3f, 0x0c, 0xb4, 0xaa, 0xbd, 0x06, 0xf1, 0x2e, 0xf4, 0x93, 0xfb, 0x99, 0x37, 0xf8, 0x8c, - 0x9b, 0xe7, 0xc0, 0xcd, 0x46, 0x19, 0x23, 0xef, 0xe5, 0x4f, 0x03, 0xad, 0xe9, 0xaf, 0x50, 0xbc, - 0x07, 0xcd, 0xac, 0x8e, 0x4a, 0x8f, 0xd6, 0xe6, 0x6b, 0xe0, 0xa6, 0x5e, 0x4a, 0x19, 0xb3, 0x59, - 0x45, 0x8f, 0x21, 0xfd, 0x66, 0x01, 0xc6, 0x84, 0x9b, 0x05, 0x38, 0x79, 0x47, 0x7f, 0x1b, 0x68, - 0x63, 0xec, 0xc3, 0x0f, 0x3f, 0x87, 0x9e, 0x6a, 0xa3, 0xfa, 0x37, 0x9c, 0x8c, 0xab, 0x97, 0xc0, - 0xd5, 0x03, 0x1d, 0x4b, 0x3f, 0x5f, 0x33, 0xaf, 0x5a, 0xfd, 0x7c, 0x15, 0xc0, 0x09, 0xe7, 0xab, - 0x80, 0xe6, 0xb3, 0xfe, 0x66, 0xa0, 0x15, 0xcd, 0xdb, 0x12, 0x37, 0x61, 0x6e, 0x28, 0x98, 0xa2, - 0x33, 0x06, 0xf6, 0x81, 0x81, 0xf5, 0x62, 0xfc, 0x98, 0x06, 0x1a, 0x7d, 0x96, 0xea, 0x1b, 0x28, - 0x83, 0x9f, 0xb0, 0x81, 0x32, 0x0c, 0xfd, 0x68, 0x03, 0xef, 0x46, 0xfd, 0x68, 0x53, 0xd0, 0x09, - 0x47, 0x9b, 0x02, 0xe7, 0x73, 0xff, 0x6e, 0xa0, 0xfb, 0xba, 0x67, 0x1c, 0x7e, 0x0a, 0x0d, 0xac, - 0xe4, 0xef, 0xed, 0x18, 0x9e, 0x31, 0xf1, 0x0c, 0x98, 0xa8, 0x95, 0x10, 0xf2, 0x46, 0x7e, 0x41, - 0x4b, 0xa5, 0xcf, 0x40, 0xbc, 0x03, 0x4d, 0x10, 0x78, 0xc8, 0x14, 0x36, 0xe3, 0x60, 0x17, 0x38, - 0x58, 0x2d, 0x42, 0xe7, 0xd2, 0xbf, 0xfa, 0xf6, 0xdd, 0xcb, 0x9e, 0xcb, 0xfb, 0x91, 0xdd, 0x70, - 0xfc, 0x41, 0xd3, 0xb6, 0xb8, 0xd3, 0x77, 0xfc, 0x30, 0x68, 0x06, 0x97, 0xd1, 0xc0, 0xa6, 0xe1, - 0x0e, 0x73, 0xfa, 0x74, 0x60, 0xb1, 0xa6, 0x1d, 0xb9, 0x97, 0xdd, 0x66, 0xcf, 0x6f, 0x2a, 0xcd, - 0xa6, 0x78, 0xbf, 0xda, 0xd3, 0xf2, 0xcb, 0xfe, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xce, 0x8f, - 0x9a, 0x49, 0xeb, 0x13, 0x00, 0x00, +var File_opts_ps_opts_tunnel_proto protoreflect.FileDescriptor + +var file_opts_ps_opts_tunnel_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x74, + 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x1a, 0x1b, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, + 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x6d, 0x71, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, + 0x72, 0x67, 0x73, 0x5f, 0x61, 0x77, 0x73, 0x5f, 0x6b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, + 0x72, 0x67, 0x73, 0x5f, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x1a, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, + 0x61, 0x77, 0x73, 0x5f, 0x73, 0x71, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x22, 0x61, + 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x7a, 0x75, 0x72, + 0x65, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x24, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, + 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x62, 0x75, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, + 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x67, 0x63, 0x70, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, + 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1f, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6b, + 0x75, 0x62, 0x65, 0x6d, 0x71, 0x5f, 0x71, 0x75, 0x65, 0x75, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x1a, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, + 0x6d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x61, + 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6d, 0x71, 0x74, 0x74, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, + 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x21, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, + 0x74, 0x73, 0x5f, 0x6a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x21, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, + 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, + 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x73, 0x71, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x61, + 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x70, 0x75, 0x6c, 0x73, + 0x61, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, + 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, + 0x73, 0x5f, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, + 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, + 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, + 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xba, 0x0d, 0x0a, 0x0d, 0x54, 0x75, + 0x6e, 0x6e, 0x65, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x61, + 0x70, 0x69, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x61, 0x70, 0x69, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x22, 0x0a, + 0x0d, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x47, 0x72, 0x70, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x12, 0x31, 0x0a, 0x15, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, + 0x75, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x12, 0x47, 0x72, 0x70, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x53, 0x65, 0x63, + 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x24, 0x0a, 0x0e, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x69, 0x6e, + 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x47, 0x72, + 0x70, 0x63, 0x49, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, + 0x0a, 0x0a, 0x5f, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0xe8, 0x07, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x12, 0x18, 0x0a, + 0x07, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0xe9, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x06, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x3a, 0x0a, 0x05, 0x6b, 0x61, 0x66, 0x6b, 0x61, + 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x05, 0x6b, 0x61, + 0x66, 0x6b, 0x61, 0x12, 0x43, 0x0a, 0x08, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x6d, 0x71, 0x18, + 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, + 0x70, 0x74, 0x73, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, + 0x63, 0x74, 0x69, 0x76, 0x65, 0x4d, 0x51, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x08, + 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x6d, 0x71, 0x12, 0x3e, 0x0a, 0x07, 0x61, 0x77, 0x73, 0x5f, + 0x73, 0x71, 0x73, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x41, 0x57, 0x53, 0x53, 0x51, 0x53, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x06, 0x61, 0x77, 0x73, 0x53, 0x71, 0x73, 0x12, 0x3e, 0x0a, 0x07, 0x61, 0x77, 0x73, 0x5f, + 0x73, 0x6e, 0x73, 0x18, 0x67, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x41, 0x57, 0x53, 0x53, 0x4e, 0x53, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x06, 0x61, 0x77, 0x73, 0x53, 0x6e, 0x73, 0x12, 0x37, 0x0a, 0x04, 0x6e, 0x61, 0x74, 0x73, + 0x18, 0x68, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x4e, 0x61, 0x74, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x04, 0x6e, 0x61, 0x74, + 0x73, 0x12, 0x53, 0x0a, 0x0e, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x69, 0x6e, 0x67, 0x18, 0x69, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0d, 0x6e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x12, 0x34, 0x0a, 0x03, 0x6e, 0x73, 0x71, 0x18, 0x6a, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, + 0x73, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x53, 0x51, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x03, 0x6e, 0x73, 0x71, 0x12, 0x3d, 0x0a, 0x06, + 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x18, 0x6b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, + 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x12, 0x37, 0x0a, 0x04, 0x6d, + 0x71, 0x74, 0x74, 0x18, 0x6c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x4d, 0x51, 0x54, 0x54, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x04, + 0x6d, 0x71, 0x74, 0x74, 0x12, 0x5a, 0x0a, 0x11, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x62, 0x75, 0x73, 0x18, 0x6d, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x54, 0x75, + 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x0f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, + 0x12, 0x54, 0x0a, 0x0f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, + 0x68, 0x75, 0x62, 0x18, 0x6e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x75, 0x62, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0d, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x48, 0x75, 0x62, 0x12, 0x47, 0x0a, 0x0a, 0x67, 0x63, 0x70, 0x5f, 0x70, 0x75, + 0x62, 0x73, 0x75, 0x62, 0x18, 0x6f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x47, 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x09, 0x67, 0x63, 0x70, 0x50, 0x75, 0x62, 0x73, 0x75, 0x62, 0x12, + 0x4d, 0x0a, 0x0c, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, 0x5f, 0x71, 0x75, 0x65, 0x75, 0x65, 0x18, + 0x70, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, + 0x70, 0x74, 0x73, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4b, + 0x75, 0x62, 0x65, 0x4d, 0x51, 0x51, 0x75, 0x65, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x0b, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, 0x51, 0x75, 0x65, 0x75, 0x65, 0x12, 0x4d, + 0x0a, 0x0c, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x18, 0x71, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, + 0x74, 0x73, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, + 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x0b, 0x72, 0x65, 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, 0x73, 0x75, 0x62, 0x12, 0x50, 0x0a, + 0x0d, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x72, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, + 0x74, 0x73, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, + 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x0c, 0x72, 0x65, 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, + 0x3d, 0x0a, 0x06, 0x70, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x18, 0x73, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x25, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x54, 0x75, + 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x70, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x12, 0x53, + 0x0a, 0x0e, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, + 0x18, 0x74, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0d, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x73, 0x12, 0x53, 0x0a, 0x0e, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x6a, 0x65, 0x74, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18, 0x75, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0d, 0x6e, 0x61, 0x74, 0x73, 0x4a, + 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x4a, 0x0a, 0x0b, 0x61, 0x77, 0x73, 0x5f, + 0x6b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x18, 0x76, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x54, 0x75, 0x6e, 0x6e, + 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x57, 0x53, 0x4b, 0x69, 0x6e, 0x65, 0x73, 0x69, + 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0a, 0x61, 0x77, 0x73, 0x4b, 0x69, 0x6e, + 0x65, 0x73, 0x69, 0x73, 0x12, 0x40, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x18, + 0x77, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, + 0x70, 0x74, 0x73, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, + 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6d, + 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x22, 0x77, 0x0a, 0x17, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x2b, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4b, + 0x61, 0x66, 0x6b, 0x61, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x2f, + 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4b, 0x61, 0x66, 0x6b, 0x61, + 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, + 0x80, 0x01, 0x0a, 0x1a, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, + 0x63, 0x74, 0x69, 0x76, 0x65, 0x4d, 0x51, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2e, + 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x63, 0x74, 0x69, + 0x76, 0x65, 0x4d, 0x51, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x32, + 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x76, + 0x65, 0x4d, 0x51, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, + 0x67, 0x73, 0x22, 0x7a, 0x0a, 0x18, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x41, 0x57, 0x53, 0x53, 0x51, 0x53, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2c, + 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x53, + 0x51, 0x53, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x30, 0x0a, 0x04, + 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x53, 0x51, 0x53, 0x57, + 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x7a, + 0x0a, 0x18, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x57, 0x53, + 0x53, 0x4e, 0x53, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2c, 0x0a, 0x05, 0x5f, 0x63, + 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x53, 0x4e, 0x53, 0x43, 0x6f, + 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x30, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x53, 0x4e, 0x53, 0x57, 0x72, 0x69, 0x74, 0x65, + 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x74, 0x0a, 0x16, 0x54, 0x75, + 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x74, 0x73, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, + 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, + 0x12, 0x2e, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, + 0x73, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, + 0x22, 0x8f, 0x01, 0x0a, 0x1f, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x4e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x33, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, + 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, + 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x37, 0x0a, 0x04, 0x61, 0x72, 0x67, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, + 0x67, 0x73, 0x22, 0x8f, 0x01, 0x0a, 0x1f, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x33, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, + 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, + 0x67, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x37, 0x0a, 0x04, 0x61, + 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, + 0x61, 0x72, 0x67, 0x73, 0x22, 0x71, 0x0a, 0x15, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x4e, 0x53, 0x51, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x29, 0x0a, + 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x53, 0x51, 0x43, 0x6f, + 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x2d, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x53, 0x51, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, + 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x7a, 0x0a, 0x18, 0x54, 0x75, 0x6e, 0x6e, 0x65, + 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x2c, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, + 0x2e, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, + 0x6e, 0x12, 0x30, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x61, + 0x62, 0x62, 0x69, 0x74, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, + 0x72, 0x67, 0x73, 0x22, 0x8f, 0x01, 0x0a, 0x1f, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x33, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x37, 0x0a, 0x04, + 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, + 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x89, 0x01, 0x0a, 0x1d, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x31, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, + 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x35, 0x0a, 0x04, 0x61, 0x72, + 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, 0x53, + 0x75, 0x62, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, + 0x73, 0x22, 0x8c, 0x01, 0x0a, 0x1e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x52, 0x65, 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x32, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, + 0x73, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x43, 0x6f, + 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x36, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x73, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, + 0x22, 0x8f, 0x01, 0x0a, 0x1f, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x41, 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x75, 0x62, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x33, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, + 0x73, 0x2e, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x75, 0x62, 0x43, + 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x37, 0x0a, 0x04, 0x61, 0x72, 0x67, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x48, 0x75, 0x62, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, + 0x67, 0x73, 0x22, 0x95, 0x01, 0x0a, 0x21, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, + 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x35, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x42, 0x75, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, + 0x39, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x7a, 0x75, 0x72, + 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, 0x57, 0x72, 0x69, 0x74, 0x65, + 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x74, 0x0a, 0x16, 0x54, 0x75, + 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x51, 0x54, 0x54, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, + 0x73, 0x2e, 0x4d, 0x51, 0x54, 0x54, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, + 0x12, 0x2e, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4d, 0x51, 0x54, + 0x54, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, + 0x22, 0x83, 0x01, 0x0a, 0x1b, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x47, 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x2f, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x47, 0x43, + 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, + 0x6e, 0x12, 0x33, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x47, 0x43, + 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, + 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x89, 0x01, 0x0a, 0x1d, 0x54, 0x75, 0x6e, 0x6e, 0x65, + 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4b, 0x75, 0x62, 0x65, 0x4d, 0x51, 0x51, 0x75, 0x65, 0x75, + 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x31, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4b, 0x75, 0x62, 0x65, 0x4d, 0x51, 0x51, 0x75, 0x65, 0x75, + 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x35, 0x0a, 0x04, 0x61, + 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4b, 0x75, 0x62, 0x65, 0x4d, 0x51, 0x51, 0x75, + 0x65, 0x75, 0x65, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, + 0x67, 0x73, 0x22, 0x7a, 0x0a, 0x18, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x50, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2c, + 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x50, 0x75, 0x6c, 0x73, + 0x61, 0x72, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x30, 0x0a, 0x04, + 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x50, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x57, + 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x86, + 0x01, 0x0a, 0x1c, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x57, + 0x53, 0x4b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x30, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, + 0x4b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, + 0x6e, 0x12, 0x34, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, + 0x53, 0x4b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, + 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x7d, 0x0a, 0x19, 0x54, 0x75, 0x6e, 0x6e, 0x65, + 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2d, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, + 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, + 0x6f, 0x6e, 0x6e, 0x12, 0x31, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, + 0x4d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, + 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, + 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, + 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x6f, + 0x70, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_opts_ps_opts_tunnel_proto_rawDescOnce sync.Once + file_opts_ps_opts_tunnel_proto_rawDescData = file_opts_ps_opts_tunnel_proto_rawDesc +) + +func file_opts_ps_opts_tunnel_proto_rawDescGZIP() []byte { + file_opts_ps_opts_tunnel_proto_rawDescOnce.Do(func() { + file_opts_ps_opts_tunnel_proto_rawDescData = protoimpl.X.CompressGZIP(file_opts_ps_opts_tunnel_proto_rawDescData) + }) + return file_opts_ps_opts_tunnel_proto_rawDescData +} + +var file_opts_ps_opts_tunnel_proto_msgTypes = make([]protoimpl.MessageInfo, 21) +var file_opts_ps_opts_tunnel_proto_goTypes = []interface{}{ + (*TunnelOptions)(nil), // 0: protos.opts.TunnelOptions + (*TunnelGroupKafkaOptions)(nil), // 1: protos.opts.TunnelGroupKafkaOptions + (*TunnelGroupActiveMQOptions)(nil), // 2: protos.opts.TunnelGroupActiveMQOptions + (*TunnelGroupAWSSQSOptions)(nil), // 3: protos.opts.TunnelGroupAWSSQSOptions + (*TunnelGroupAWSSNSOptions)(nil), // 4: protos.opts.TunnelGroupAWSSNSOptions + (*TunnelGroupNatsOptions)(nil), // 5: protos.opts.TunnelGroupNatsOptions + (*TunnelGroupNatsJetstreamOptions)(nil), // 6: protos.opts.TunnelGroupNatsJetstreamOptions + (*TunnelGroupNatsStreamingOptions)(nil), // 7: protos.opts.TunnelGroupNatsStreamingOptions + (*TunnelGroupNSQOptions)(nil), // 8: protos.opts.TunnelGroupNSQOptions + (*TunnelGroupRabbitOptions)(nil), // 9: protos.opts.TunnelGroupRabbitOptions + (*TunnelGroupRabbitStreamsOptions)(nil), // 10: protos.opts.TunnelGroupRabbitStreamsOptions + (*TunnelGroupRedisPubSubOptions)(nil), // 11: protos.opts.TunnelGroupRedisPubSubOptions + (*TunnelGroupRedisStreamsOptions)(nil), // 12: protos.opts.TunnelGroupRedisStreamsOptions + (*TunnelGroupAzureEventHubOptions)(nil), // 13: protos.opts.TunnelGroupAzureEventHubOptions + (*TunnelGroupAzureServiceBusOptions)(nil), // 14: protos.opts.TunnelGroupAzureServiceBusOptions + (*TunnelGroupMQTTOptions)(nil), // 15: protos.opts.TunnelGroupMQTTOptions + (*TunnelGroupGCPPubSubOptions)(nil), // 16: protos.opts.TunnelGroupGCPPubSubOptions + (*TunnelGroupKubeMQQueueOptions)(nil), // 17: protos.opts.TunnelGroupKubeMQQueueOptions + (*TunnelGroupPulsarOptions)(nil), // 18: protos.opts.TunnelGroupPulsarOptions + (*TunnelGroupAWSKinesisOptions)(nil), // 19: protos.opts.TunnelGroupAWSKinesisOptions + (*TunnelGroupMemphisOptions)(nil), // 20: protos.opts.TunnelGroupMemphisOptions + (*args.KafkaConn)(nil), // 21: protos.args.KafkaConn + (*args.KafkaWriteArgs)(nil), // 22: protos.args.KafkaWriteArgs + (*args.ActiveMQConn)(nil), // 23: protos.args.ActiveMQConn + (*args.ActiveMQWriteArgs)(nil), // 24: protos.args.ActiveMQWriteArgs + (*args.AWSSQSConn)(nil), // 25: protos.args.AWSSQSConn + (*args.AWSSQSWriteArgs)(nil), // 26: protos.args.AWSSQSWriteArgs + (*args.AWSSNSConn)(nil), // 27: protos.args.AWSSNSConn + (*args.AWSSNSWriteArgs)(nil), // 28: protos.args.AWSSNSWriteArgs + (*args.NatsConn)(nil), // 29: protos.args.NatsConn + (*args.NatsWriteArgs)(nil), // 30: protos.args.NatsWriteArgs + (*args.NatsJetstreamConn)(nil), // 31: protos.args.NatsJetstreamConn + (*args.NatsJetstreamWriteArgs)(nil), // 32: protos.args.NatsJetstreamWriteArgs + (*args.NatsStreamingConn)(nil), // 33: protos.args.NatsStreamingConn + (*args.NatsStreamingWriteArgs)(nil), // 34: protos.args.NatsStreamingWriteArgs + (*args.NSQConn)(nil), // 35: protos.args.NSQConn + (*args.NSQWriteArgs)(nil), // 36: protos.args.NSQWriteArgs + (*args.RabbitConn)(nil), // 37: protos.args.RabbitConn + (*args.RabbitWriteArgs)(nil), // 38: protos.args.RabbitWriteArgs + (*args.RabbitStreamsConn)(nil), // 39: protos.args.RabbitStreamsConn + (*args.RabbitStreamsWriteArgs)(nil), // 40: protos.args.RabbitStreamsWriteArgs + (*args.RedisPubSubConn)(nil), // 41: protos.args.RedisPubSubConn + (*args.RedisPubSubWriteArgs)(nil), // 42: protos.args.RedisPubSubWriteArgs + (*args.RedisStreamsConn)(nil), // 43: protos.args.RedisStreamsConn + (*args.RedisStreamsWriteArgs)(nil), // 44: protos.args.RedisStreamsWriteArgs + (*args.AzureEventHubConn)(nil), // 45: protos.args.AzureEventHubConn + (*args.AzureEventHubWriteArgs)(nil), // 46: protos.args.AzureEventHubWriteArgs + (*args.AzureServiceBusConn)(nil), // 47: protos.args.AzureServiceBusConn + (*args.AzureServiceBusWriteArgs)(nil), // 48: protos.args.AzureServiceBusWriteArgs + (*args.MQTTConn)(nil), // 49: protos.args.MQTTConn + (*args.MQTTWriteArgs)(nil), // 50: protos.args.MQTTWriteArgs + (*args.GCPPubSubConn)(nil), // 51: protos.args.GCPPubSubConn + (*args.GCPPubSubWriteArgs)(nil), // 52: protos.args.GCPPubSubWriteArgs + (*args.KubeMQQueueConn)(nil), // 53: protos.args.KubeMQQueueConn + (*args.KubeMQQueueWriteArgs)(nil), // 54: protos.args.KubeMQQueueWriteArgs + (*args.PulsarConn)(nil), // 55: protos.args.PulsarConn + (*args.PulsarWriteArgs)(nil), // 56: protos.args.PulsarWriteArgs + (*args.AWSKinesisConn)(nil), // 57: protos.args.AWSKinesisConn + (*args.AWSKinesisWriteArgs)(nil), // 58: protos.args.AWSKinesisWriteArgs + (*args.MemphisConn)(nil), // 59: protos.args.MemphisConn + (*args.MemphisWriteArgs)(nil), // 60: protos.args.MemphisWriteArgs +} +var file_opts_ps_opts_tunnel_proto_depIdxs = []int32{ + 1, // 0: protos.opts.TunnelOptions.kafka:type_name -> protos.opts.TunnelGroupKafkaOptions + 2, // 1: protos.opts.TunnelOptions.activemq:type_name -> protos.opts.TunnelGroupActiveMQOptions + 3, // 2: protos.opts.TunnelOptions.aws_sqs:type_name -> protos.opts.TunnelGroupAWSSQSOptions + 4, // 3: protos.opts.TunnelOptions.aws_sns:type_name -> protos.opts.TunnelGroupAWSSNSOptions + 5, // 4: protos.opts.TunnelOptions.nats:type_name -> protos.opts.TunnelGroupNatsOptions + 7, // 5: protos.opts.TunnelOptions.nats_streaming:type_name -> protos.opts.TunnelGroupNatsStreamingOptions + 8, // 6: protos.opts.TunnelOptions.nsq:type_name -> protos.opts.TunnelGroupNSQOptions + 9, // 7: protos.opts.TunnelOptions.rabbit:type_name -> protos.opts.TunnelGroupRabbitOptions + 15, // 8: protos.opts.TunnelOptions.mqtt:type_name -> protos.opts.TunnelGroupMQTTOptions + 14, // 9: protos.opts.TunnelOptions.azure_service_bus:type_name -> protos.opts.TunnelGroupAzureServiceBusOptions + 13, // 10: protos.opts.TunnelOptions.azure_event_hub:type_name -> protos.opts.TunnelGroupAzureEventHubOptions + 16, // 11: protos.opts.TunnelOptions.gcp_pubsub:type_name -> protos.opts.TunnelGroupGCPPubSubOptions + 17, // 12: protos.opts.TunnelOptions.kubemq_queue:type_name -> protos.opts.TunnelGroupKubeMQQueueOptions + 11, // 13: protos.opts.TunnelOptions.redis_pubsub:type_name -> protos.opts.TunnelGroupRedisPubSubOptions + 12, // 14: protos.opts.TunnelOptions.redis_streams:type_name -> protos.opts.TunnelGroupRedisStreamsOptions + 18, // 15: protos.opts.TunnelOptions.pulsar:type_name -> protos.opts.TunnelGroupPulsarOptions + 10, // 16: protos.opts.TunnelOptions.rabbit_streams:type_name -> protos.opts.TunnelGroupRabbitStreamsOptions + 6, // 17: protos.opts.TunnelOptions.nats_jetstream:type_name -> protos.opts.TunnelGroupNatsJetstreamOptions + 19, // 18: protos.opts.TunnelOptions.aws_kinesis:type_name -> protos.opts.TunnelGroupAWSKinesisOptions + 20, // 19: protos.opts.TunnelOptions.memphis:type_name -> protos.opts.TunnelGroupMemphisOptions + 21, // 20: protos.opts.TunnelGroupKafkaOptions._conn:type_name -> protos.args.KafkaConn + 22, // 21: protos.opts.TunnelGroupKafkaOptions.args:type_name -> protos.args.KafkaWriteArgs + 23, // 22: protos.opts.TunnelGroupActiveMQOptions._conn:type_name -> protos.args.ActiveMQConn + 24, // 23: protos.opts.TunnelGroupActiveMQOptions.args:type_name -> protos.args.ActiveMQWriteArgs + 25, // 24: protos.opts.TunnelGroupAWSSQSOptions._conn:type_name -> protos.args.AWSSQSConn + 26, // 25: protos.opts.TunnelGroupAWSSQSOptions.args:type_name -> protos.args.AWSSQSWriteArgs + 27, // 26: protos.opts.TunnelGroupAWSSNSOptions._conn:type_name -> protos.args.AWSSNSConn + 28, // 27: protos.opts.TunnelGroupAWSSNSOptions.args:type_name -> protos.args.AWSSNSWriteArgs + 29, // 28: protos.opts.TunnelGroupNatsOptions._conn:type_name -> protos.args.NatsConn + 30, // 29: protos.opts.TunnelGroupNatsOptions.args:type_name -> protos.args.NatsWriteArgs + 31, // 30: protos.opts.TunnelGroupNatsJetstreamOptions._conn:type_name -> protos.args.NatsJetstreamConn + 32, // 31: protos.opts.TunnelGroupNatsJetstreamOptions.args:type_name -> protos.args.NatsJetstreamWriteArgs + 33, // 32: protos.opts.TunnelGroupNatsStreamingOptions._conn:type_name -> protos.args.NatsStreamingConn + 34, // 33: protos.opts.TunnelGroupNatsStreamingOptions.args:type_name -> protos.args.NatsStreamingWriteArgs + 35, // 34: protos.opts.TunnelGroupNSQOptions._conn:type_name -> protos.args.NSQConn + 36, // 35: protos.opts.TunnelGroupNSQOptions.args:type_name -> protos.args.NSQWriteArgs + 37, // 36: protos.opts.TunnelGroupRabbitOptions._conn:type_name -> protos.args.RabbitConn + 38, // 37: protos.opts.TunnelGroupRabbitOptions.args:type_name -> protos.args.RabbitWriteArgs + 39, // 38: protos.opts.TunnelGroupRabbitStreamsOptions._conn:type_name -> protos.args.RabbitStreamsConn + 40, // 39: protos.opts.TunnelGroupRabbitStreamsOptions.args:type_name -> protos.args.RabbitStreamsWriteArgs + 41, // 40: protos.opts.TunnelGroupRedisPubSubOptions._conn:type_name -> protos.args.RedisPubSubConn + 42, // 41: protos.opts.TunnelGroupRedisPubSubOptions.args:type_name -> protos.args.RedisPubSubWriteArgs + 43, // 42: protos.opts.TunnelGroupRedisStreamsOptions._conn:type_name -> protos.args.RedisStreamsConn + 44, // 43: protos.opts.TunnelGroupRedisStreamsOptions.args:type_name -> protos.args.RedisStreamsWriteArgs + 45, // 44: protos.opts.TunnelGroupAzureEventHubOptions._conn:type_name -> protos.args.AzureEventHubConn + 46, // 45: protos.opts.TunnelGroupAzureEventHubOptions.args:type_name -> protos.args.AzureEventHubWriteArgs + 47, // 46: protos.opts.TunnelGroupAzureServiceBusOptions._conn:type_name -> protos.args.AzureServiceBusConn + 48, // 47: protos.opts.TunnelGroupAzureServiceBusOptions.args:type_name -> protos.args.AzureServiceBusWriteArgs + 49, // 48: protos.opts.TunnelGroupMQTTOptions._conn:type_name -> protos.args.MQTTConn + 50, // 49: protos.opts.TunnelGroupMQTTOptions.args:type_name -> protos.args.MQTTWriteArgs + 51, // 50: protos.opts.TunnelGroupGCPPubSubOptions._conn:type_name -> protos.args.GCPPubSubConn + 52, // 51: protos.opts.TunnelGroupGCPPubSubOptions.args:type_name -> protos.args.GCPPubSubWriteArgs + 53, // 52: protos.opts.TunnelGroupKubeMQQueueOptions._conn:type_name -> protos.args.KubeMQQueueConn + 54, // 53: protos.opts.TunnelGroupKubeMQQueueOptions.args:type_name -> protos.args.KubeMQQueueWriteArgs + 55, // 54: protos.opts.TunnelGroupPulsarOptions._conn:type_name -> protos.args.PulsarConn + 56, // 55: protos.opts.TunnelGroupPulsarOptions.args:type_name -> protos.args.PulsarWriteArgs + 57, // 56: protos.opts.TunnelGroupAWSKinesisOptions._conn:type_name -> protos.args.AWSKinesisConn + 58, // 57: protos.opts.TunnelGroupAWSKinesisOptions.args:type_name -> protos.args.AWSKinesisWriteArgs + 59, // 58: protos.opts.TunnelGroupMemphisOptions._conn:type_name -> protos.args.MemphisConn + 60, // 59: protos.opts.TunnelGroupMemphisOptions.args:type_name -> protos.args.MemphisWriteArgs + 60, // [60:60] is the sub-list for method output_type + 60, // [60:60] is the sub-list for method input_type + 60, // [60:60] is the sub-list for extension type_name + 60, // [60:60] is the sub-list for extension extendee + 0, // [0:60] is the sub-list for field type_name +} + +func init() { file_opts_ps_opts_tunnel_proto_init() } +func file_opts_ps_opts_tunnel_proto_init() { + if File_opts_ps_opts_tunnel_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_opts_ps_opts_tunnel_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TunnelOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_tunnel_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TunnelGroupKafkaOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_tunnel_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TunnelGroupActiveMQOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_tunnel_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TunnelGroupAWSSQSOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_tunnel_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TunnelGroupAWSSNSOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_tunnel_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TunnelGroupNatsOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_tunnel_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TunnelGroupNatsJetstreamOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_tunnel_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TunnelGroupNatsStreamingOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_tunnel_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TunnelGroupNSQOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_tunnel_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TunnelGroupRabbitOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_tunnel_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TunnelGroupRabbitStreamsOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_tunnel_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TunnelGroupRedisPubSubOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_tunnel_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TunnelGroupRedisStreamsOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_tunnel_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TunnelGroupAzureEventHubOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_tunnel_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TunnelGroupAzureServiceBusOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_tunnel_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TunnelGroupMQTTOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_tunnel_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TunnelGroupGCPPubSubOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_tunnel_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TunnelGroupKubeMQQueueOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_tunnel_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TunnelGroupPulsarOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_tunnel_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TunnelGroupAWSKinesisOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_tunnel_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TunnelGroupMemphisOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_opts_ps_opts_tunnel_proto_rawDesc, + NumEnums: 0, + NumMessages: 21, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_opts_ps_opts_tunnel_proto_goTypes, + DependencyIndexes: file_opts_ps_opts_tunnel_proto_depIdxs, + MessageInfos: file_opts_ps_opts_tunnel_proto_msgTypes, + }.Build() + File_opts_ps_opts_tunnel_proto = out.File + file_opts_ps_opts_tunnel_proto_rawDesc = nil + file_opts_ps_opts_tunnel_proto_goTypes = nil + file_opts_ps_opts_tunnel_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_write.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_write.pb.go index 8822f83df..02642f366 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_write.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_write.pb.go @@ -1,82 +1,90 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: opts/ps_opts_write.proto package opts import ( - fmt "fmt" args "github.com/batchcorp/plumber-schemas/build/go/protos/args" encoding "github.com/batchcorp/plumber-schemas/build/go/protos/encoding" records "github.com/batchcorp/plumber-schemas/build/go/protos/records" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type WriteCLIOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"help='Write data from input file',existingfile,xor=input" InputFile string `protobuf:"bytes,1,opt,name=input_file,json=inputFile,proto3" json:"input_file,omitempty" kong:"help='Write data from input file',existingfile,xor=input"` // @gotags: kong:"help='Treat input as JSON array - each array element will be written as a separate message'" InputAsJsonArray bool `protobuf:"varint,2,opt,name=input_as_json_array,json=inputAsJsonArray,proto3" json:"input_as_json_array,omitempty" kong:"help='Treat input as JSON array - each array element will be written as a separate message'"` // @gotags: kong:"-" - InputStdin []string `protobuf:"bytes,3,rep,name=input_stdin,json=inputStdin,proto3" json:"input_stdin,omitempty" kong:"-"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + InputStdin []string `protobuf:"bytes,3,rep,name=input_stdin,json=inputStdin,proto3" json:"input_stdin,omitempty" kong:"-"` } -func (m *WriteCLIOptions) Reset() { *m = WriteCLIOptions{} } -func (m *WriteCLIOptions) String() string { return proto.CompactTextString(m) } -func (*WriteCLIOptions) ProtoMessage() {} -func (*WriteCLIOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_c48ba9642d1e9ac6, []int{0} +func (x *WriteCLIOptions) Reset() { + *x = WriteCLIOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_write_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *WriteCLIOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteCLIOptions.Unmarshal(m, b) -} -func (m *WriteCLIOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteCLIOptions.Marshal(b, m, deterministic) -} -func (m *WriteCLIOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteCLIOptions.Merge(m, src) -} -func (m *WriteCLIOptions) XXX_Size() int { - return xxx_messageInfo_WriteCLIOptions.Size(m) +func (x *WriteCLIOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WriteCLIOptions) XXX_DiscardUnknown() { - xxx_messageInfo_WriteCLIOptions.DiscardUnknown(m) + +func (*WriteCLIOptions) ProtoMessage() {} + +func (x *WriteCLIOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_write_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WriteCLIOptions proto.InternalMessageInfo +// Deprecated: Use WriteCLIOptions.ProtoReflect.Descriptor instead. +func (*WriteCLIOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_write_proto_rawDescGZIP(), []int{0} +} -func (m *WriteCLIOptions) GetInputFile() string { - if m != nil { - return m.InputFile +func (x *WriteCLIOptions) GetInputFile() string { + if x != nil { + return x.InputFile } return "" } -func (m *WriteCLIOptions) GetInputAsJsonArray() bool { - if m != nil { - return m.InputAsJsonArray +func (x *WriteCLIOptions) GetInputAsJsonArray() bool { + if x != nil { + return x.InputAsJsonArray } return false } -func (m *WriteCLIOptions) GetInputStdin() []string { - if m != nil { - return m.InputStdin +func (x *WriteCLIOptions) GetInputStdin() []string { + if x != nil { + return x.InputStdin } return nil } @@ -84,6 +92,10 @@ func (m *WriteCLIOptions) GetInputStdin() []string { // Write is the structure that backends accept for facilitating a write. // NOTE: _conn is only used by the CLI - desktop does not need to set it. type WriteOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Required for desktop; ignored in CLI. // @gotags: kong:"-" ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" kong:"-"` @@ -133,1297 +145,2117 @@ type WriteOptions struct { // @gotags: kong:"cmd,help='AWS Kinesis Streams'" AwsKinesis *WriteGroupAWSKinesisOptions `protobuf:"bytes,118,opt,name=aws_kinesis,json=awsKinesis,proto3" json:"aws_kinesis,omitempty" kong:"cmd,help='AWS Kinesis Streams'"` // @gotags: kong:"cmd,help='Memphis'" - Memphis *WriteGroupMemphisOptions `protobuf:"bytes,119,opt,name=memphis,proto3" json:"memphis,omitempty" kong:"cmd,help='Memphis'"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Memphis *WriteGroupMemphisOptions `protobuf:"bytes,119,opt,name=memphis,proto3" json:"memphis,omitempty" kong:"cmd,help='Memphis'"` } -func (m *WriteOptions) Reset() { *m = WriteOptions{} } -func (m *WriteOptions) String() string { return proto.CompactTextString(m) } -func (*WriteOptions) ProtoMessage() {} -func (*WriteOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_c48ba9642d1e9ac6, []int{1} +func (x *WriteOptions) Reset() { + *x = WriteOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_write_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *WriteOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteOptions.Unmarshal(m, b) +func (x *WriteOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WriteOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteOptions.Marshal(b, m, deterministic) -} -func (m *WriteOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteOptions.Merge(m, src) -} -func (m *WriteOptions) XXX_Size() int { - return xxx_messageInfo_WriteOptions.Size(m) -} -func (m *WriteOptions) XXX_DiscardUnknown() { - xxx_messageInfo_WriteOptions.DiscardUnknown(m) + +func (*WriteOptions) ProtoMessage() {} + +func (x *WriteOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_write_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WriteOptions proto.InternalMessageInfo +// Deprecated: Use WriteOptions.ProtoReflect.Descriptor instead. +func (*WriteOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_write_proto_rawDescGZIP(), []int{1} +} -func (m *WriteOptions) GetConnectionId() string { - if m != nil { - return m.ConnectionId +func (x *WriteOptions) GetConnectionId() string { + if x != nil { + return x.ConnectionId } return "" } -func (m *WriteOptions) GetRecord() *records.WriteRecord { - if m != nil { - return m.Record +func (x *WriteOptions) GetRecord() *records.WriteRecord { + if x != nil { + return x.Record } return nil } -func (m *WriteOptions) GetEncodeOptions() *encoding.EncodeOptions { - if m != nil { - return m.EncodeOptions +func (x *WriteOptions) GetEncodeOptions() *encoding.EncodeOptions { + if x != nil { + return x.EncodeOptions } return nil } -func (m *WriteOptions) GetXCliOptions() *WriteCLIOptions { - if m != nil { - return m.XCliOptions +func (x *WriteOptions) GetXCliOptions() *WriteCLIOptions { + if x != nil { + return x.XCliOptions } return nil } -func (m *WriteOptions) GetKafka() *WriteGroupKafkaOptions { - if m != nil { - return m.Kafka +func (x *WriteOptions) GetKafka() *WriteGroupKafkaOptions { + if x != nil { + return x.Kafka } return nil } -func (m *WriteOptions) GetActivemq() *WriteGroupActiveMQOptions { - if m != nil { - return m.Activemq +func (x *WriteOptions) GetActivemq() *WriteGroupActiveMQOptions { + if x != nil { + return x.Activemq } return nil } -func (m *WriteOptions) GetAwsSqs() *WriteGroupAWSSQSOptions { - if m != nil { - return m.AwsSqs +func (x *WriteOptions) GetAwsSqs() *WriteGroupAWSSQSOptions { + if x != nil { + return x.AwsSqs } return nil } -func (m *WriteOptions) GetAwsSns() *WriteGroupAWSSNSOptions { - if m != nil { - return m.AwsSns +func (x *WriteOptions) GetAwsSns() *WriteGroupAWSSNSOptions { + if x != nil { + return x.AwsSns } return nil } -func (m *WriteOptions) GetNats() *WriteGroupNatsOptions { - if m != nil { - return m.Nats +func (x *WriteOptions) GetNats() *WriteGroupNatsOptions { + if x != nil { + return x.Nats } return nil } -func (m *WriteOptions) GetNatsStreaming() *WriteGroupNatsStreamingOptions { - if m != nil { - return m.NatsStreaming +func (x *WriteOptions) GetNatsStreaming() *WriteGroupNatsStreamingOptions { + if x != nil { + return x.NatsStreaming } return nil } -func (m *WriteOptions) GetNsq() *WriteGroupNSQOptions { - if m != nil { - return m.Nsq +func (x *WriteOptions) GetNsq() *WriteGroupNSQOptions { + if x != nil { + return x.Nsq } return nil } -func (m *WriteOptions) GetPulsar() *WriteGroupPulsarOptions { - if m != nil { - return m.Pulsar +func (x *WriteOptions) GetPulsar() *WriteGroupPulsarOptions { + if x != nil { + return x.Pulsar } return nil } -func (m *WriteOptions) GetRabbit() *WriteGroupRabbitOptions { - if m != nil { - return m.Rabbit +func (x *WriteOptions) GetRabbit() *WriteGroupRabbitOptions { + if x != nil { + return x.Rabbit } return nil } -func (m *WriteOptions) GetRabbitStreams() *WriteGroupRabbitStreamsOptions { - if m != nil { - return m.RabbitStreams +func (x *WriteOptions) GetRabbitStreams() *WriteGroupRabbitStreamsOptions { + if x != nil { + return x.RabbitStreams } return nil } -func (m *WriteOptions) GetMqtt() *WriteGroupMQTTOptions { - if m != nil { - return m.Mqtt +func (x *WriteOptions) GetMqtt() *WriteGroupMQTTOptions { + if x != nil { + return x.Mqtt } return nil } -func (m *WriteOptions) GetAzureServiceBus() *WriteGroupAzureServiceBusOptions { - if m != nil { - return m.AzureServiceBus +func (x *WriteOptions) GetAzureServiceBus() *WriteGroupAzureServiceBusOptions { + if x != nil { + return x.AzureServiceBus } return nil } -func (m *WriteOptions) GetAzureEventHub() *WriteGroupAzureEventHubOptions { - if m != nil { - return m.AzureEventHub +func (x *WriteOptions) GetAzureEventHub() *WriteGroupAzureEventHubOptions { + if x != nil { + return x.AzureEventHub } return nil } -func (m *WriteOptions) GetGcpPubsub() *WriteGroupGCPPubSubOptions { - if m != nil { - return m.GcpPubsub +func (x *WriteOptions) GetGcpPubsub() *WriteGroupGCPPubSubOptions { + if x != nil { + return x.GcpPubsub } return nil } -func (m *WriteOptions) GetKubemqQueue() *WriteGroupKubeMQQueueOptions { - if m != nil { - return m.KubemqQueue +func (x *WriteOptions) GetKubemqQueue() *WriteGroupKubeMQQueueOptions { + if x != nil { + return x.KubemqQueue } return nil } -func (m *WriteOptions) GetRedisPubsub() *WriteGroupRedisPubSubOptions { - if m != nil { - return m.RedisPubsub +func (x *WriteOptions) GetRedisPubsub() *WriteGroupRedisPubSubOptions { + if x != nil { + return x.RedisPubsub } return nil } -func (m *WriteOptions) GetRedisStreams() *WriteGroupRedisStreamsOptions { - if m != nil { - return m.RedisStreams +func (x *WriteOptions) GetRedisStreams() *WriteGroupRedisStreamsOptions { + if x != nil { + return x.RedisStreams } return nil } -func (m *WriteOptions) GetNatsJetstream() *WriteGroupNatsJetstreamOptions { - if m != nil { - return m.NatsJetstream +func (x *WriteOptions) GetNatsJetstream() *WriteGroupNatsJetstreamOptions { + if x != nil { + return x.NatsJetstream } return nil } -func (m *WriteOptions) GetAwsKinesis() *WriteGroupAWSKinesisOptions { - if m != nil { - return m.AwsKinesis +func (x *WriteOptions) GetAwsKinesis() *WriteGroupAWSKinesisOptions { + if x != nil { + return x.AwsKinesis } return nil } -func (m *WriteOptions) GetMemphis() *WriteGroupMemphisOptions { - if m != nil { - return m.Memphis +func (x *WriteOptions) GetMemphis() *WriteGroupMemphisOptions { + if x != nil { + return x.Memphis } return nil } type WriteGroupKafkaOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.KafkaConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.KafkaWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.KafkaWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *WriteGroupKafkaOptions) Reset() { *m = WriteGroupKafkaOptions{} } -func (m *WriteGroupKafkaOptions) String() string { return proto.CompactTextString(m) } -func (*WriteGroupKafkaOptions) ProtoMessage() {} -func (*WriteGroupKafkaOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_c48ba9642d1e9ac6, []int{2} +func (x *WriteGroupKafkaOptions) Reset() { + *x = WriteGroupKafkaOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_write_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *WriteGroupKafkaOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteGroupKafkaOptions.Unmarshal(m, b) -} -func (m *WriteGroupKafkaOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteGroupKafkaOptions.Marshal(b, m, deterministic) +func (x *WriteGroupKafkaOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WriteGroupKafkaOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteGroupKafkaOptions.Merge(m, src) -} -func (m *WriteGroupKafkaOptions) XXX_Size() int { - return xxx_messageInfo_WriteGroupKafkaOptions.Size(m) -} -func (m *WriteGroupKafkaOptions) XXX_DiscardUnknown() { - xxx_messageInfo_WriteGroupKafkaOptions.DiscardUnknown(m) + +func (*WriteGroupKafkaOptions) ProtoMessage() {} + +func (x *WriteGroupKafkaOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_write_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WriteGroupKafkaOptions proto.InternalMessageInfo +// Deprecated: Use WriteGroupKafkaOptions.ProtoReflect.Descriptor instead. +func (*WriteGroupKafkaOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_write_proto_rawDescGZIP(), []int{2} +} -func (m *WriteGroupKafkaOptions) GetXConn() *args.KafkaConn { - if m != nil { - return m.XConn +func (x *WriteGroupKafkaOptions) GetXConn() *args.KafkaConn { + if x != nil { + return x.XConn } return nil } -func (m *WriteGroupKafkaOptions) GetArgs() *args.KafkaWriteArgs { - if m != nil { - return m.Args +func (x *WriteGroupKafkaOptions) GetArgs() *args.KafkaWriteArgs { + if x != nil { + return x.Args } return nil } type WriteGroupActiveMQOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.ActiveMQConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.ActiveMQWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.ActiveMQWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *WriteGroupActiveMQOptions) Reset() { *m = WriteGroupActiveMQOptions{} } -func (m *WriteGroupActiveMQOptions) String() string { return proto.CompactTextString(m) } -func (*WriteGroupActiveMQOptions) ProtoMessage() {} -func (*WriteGroupActiveMQOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_c48ba9642d1e9ac6, []int{3} +func (x *WriteGroupActiveMQOptions) Reset() { + *x = WriteGroupActiveMQOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_write_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *WriteGroupActiveMQOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteGroupActiveMQOptions.Unmarshal(m, b) -} -func (m *WriteGroupActiveMQOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteGroupActiveMQOptions.Marshal(b, m, deterministic) +func (x *WriteGroupActiveMQOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WriteGroupActiveMQOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteGroupActiveMQOptions.Merge(m, src) -} -func (m *WriteGroupActiveMQOptions) XXX_Size() int { - return xxx_messageInfo_WriteGroupActiveMQOptions.Size(m) -} -func (m *WriteGroupActiveMQOptions) XXX_DiscardUnknown() { - xxx_messageInfo_WriteGroupActiveMQOptions.DiscardUnknown(m) + +func (*WriteGroupActiveMQOptions) ProtoMessage() {} + +func (x *WriteGroupActiveMQOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_write_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WriteGroupActiveMQOptions proto.InternalMessageInfo +// Deprecated: Use WriteGroupActiveMQOptions.ProtoReflect.Descriptor instead. +func (*WriteGroupActiveMQOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_write_proto_rawDescGZIP(), []int{3} +} -func (m *WriteGroupActiveMQOptions) GetXConn() *args.ActiveMQConn { - if m != nil { - return m.XConn +func (x *WriteGroupActiveMQOptions) GetXConn() *args.ActiveMQConn { + if x != nil { + return x.XConn } return nil } -func (m *WriteGroupActiveMQOptions) GetArgs() *args.ActiveMQWriteArgs { - if m != nil { - return m.Args +func (x *WriteGroupActiveMQOptions) GetArgs() *args.ActiveMQWriteArgs { + if x != nil { + return x.Args } return nil } type WriteGroupAWSSQSOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.AWSSQSConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.AWSSQSWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.AWSSQSWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *WriteGroupAWSSQSOptions) Reset() { *m = WriteGroupAWSSQSOptions{} } -func (m *WriteGroupAWSSQSOptions) String() string { return proto.CompactTextString(m) } -func (*WriteGroupAWSSQSOptions) ProtoMessage() {} -func (*WriteGroupAWSSQSOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_c48ba9642d1e9ac6, []int{4} +func (x *WriteGroupAWSSQSOptions) Reset() { + *x = WriteGroupAWSSQSOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_write_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *WriteGroupAWSSQSOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteGroupAWSSQSOptions.Unmarshal(m, b) -} -func (m *WriteGroupAWSSQSOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteGroupAWSSQSOptions.Marshal(b, m, deterministic) -} -func (m *WriteGroupAWSSQSOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteGroupAWSSQSOptions.Merge(m, src) +func (x *WriteGroupAWSSQSOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WriteGroupAWSSQSOptions) XXX_Size() int { - return xxx_messageInfo_WriteGroupAWSSQSOptions.Size(m) -} -func (m *WriteGroupAWSSQSOptions) XXX_DiscardUnknown() { - xxx_messageInfo_WriteGroupAWSSQSOptions.DiscardUnknown(m) + +func (*WriteGroupAWSSQSOptions) ProtoMessage() {} + +func (x *WriteGroupAWSSQSOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_write_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WriteGroupAWSSQSOptions proto.InternalMessageInfo +// Deprecated: Use WriteGroupAWSSQSOptions.ProtoReflect.Descriptor instead. +func (*WriteGroupAWSSQSOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_write_proto_rawDescGZIP(), []int{4} +} -func (m *WriteGroupAWSSQSOptions) GetXConn() *args.AWSSQSConn { - if m != nil { - return m.XConn +func (x *WriteGroupAWSSQSOptions) GetXConn() *args.AWSSQSConn { + if x != nil { + return x.XConn } return nil } -func (m *WriteGroupAWSSQSOptions) GetArgs() *args.AWSSQSWriteArgs { - if m != nil { - return m.Args +func (x *WriteGroupAWSSQSOptions) GetArgs() *args.AWSSQSWriteArgs { + if x != nil { + return x.Args } return nil } type WriteGroupAWSSNSOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.AWSSNSConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.AWSSNSWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.AWSSNSWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *WriteGroupAWSSNSOptions) Reset() { *m = WriteGroupAWSSNSOptions{} } -func (m *WriteGroupAWSSNSOptions) String() string { return proto.CompactTextString(m) } -func (*WriteGroupAWSSNSOptions) ProtoMessage() {} -func (*WriteGroupAWSSNSOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_c48ba9642d1e9ac6, []int{5} +func (x *WriteGroupAWSSNSOptions) Reset() { + *x = WriteGroupAWSSNSOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_write_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *WriteGroupAWSSNSOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteGroupAWSSNSOptions.Unmarshal(m, b) -} -func (m *WriteGroupAWSSNSOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteGroupAWSSNSOptions.Marshal(b, m, deterministic) -} -func (m *WriteGroupAWSSNSOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteGroupAWSSNSOptions.Merge(m, src) +func (x *WriteGroupAWSSNSOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WriteGroupAWSSNSOptions) XXX_Size() int { - return xxx_messageInfo_WriteGroupAWSSNSOptions.Size(m) -} -func (m *WriteGroupAWSSNSOptions) XXX_DiscardUnknown() { - xxx_messageInfo_WriteGroupAWSSNSOptions.DiscardUnknown(m) + +func (*WriteGroupAWSSNSOptions) ProtoMessage() {} + +func (x *WriteGroupAWSSNSOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_write_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WriteGroupAWSSNSOptions proto.InternalMessageInfo +// Deprecated: Use WriteGroupAWSSNSOptions.ProtoReflect.Descriptor instead. +func (*WriteGroupAWSSNSOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_write_proto_rawDescGZIP(), []int{5} +} -func (m *WriteGroupAWSSNSOptions) GetXConn() *args.AWSSNSConn { - if m != nil { - return m.XConn +func (x *WriteGroupAWSSNSOptions) GetXConn() *args.AWSSNSConn { + if x != nil { + return x.XConn } return nil } -func (m *WriteGroupAWSSNSOptions) GetArgs() *args.AWSSNSWriteArgs { - if m != nil { - return m.Args +func (x *WriteGroupAWSSNSOptions) GetArgs() *args.AWSSNSWriteArgs { + if x != nil { + return x.Args } return nil } type WriteGroupNatsOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.NatsConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.NatsWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.NatsWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *WriteGroupNatsOptions) Reset() { *m = WriteGroupNatsOptions{} } -func (m *WriteGroupNatsOptions) String() string { return proto.CompactTextString(m) } -func (*WriteGroupNatsOptions) ProtoMessage() {} -func (*WriteGroupNatsOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_c48ba9642d1e9ac6, []int{6} +func (x *WriteGroupNatsOptions) Reset() { + *x = WriteGroupNatsOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_write_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *WriteGroupNatsOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteGroupNatsOptions.Unmarshal(m, b) -} -func (m *WriteGroupNatsOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteGroupNatsOptions.Marshal(b, m, deterministic) -} -func (m *WriteGroupNatsOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteGroupNatsOptions.Merge(m, src) -} -func (m *WriteGroupNatsOptions) XXX_Size() int { - return xxx_messageInfo_WriteGroupNatsOptions.Size(m) +func (x *WriteGroupNatsOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WriteGroupNatsOptions) XXX_DiscardUnknown() { - xxx_messageInfo_WriteGroupNatsOptions.DiscardUnknown(m) + +func (*WriteGroupNatsOptions) ProtoMessage() {} + +func (x *WriteGroupNatsOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_write_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WriteGroupNatsOptions proto.InternalMessageInfo +// Deprecated: Use WriteGroupNatsOptions.ProtoReflect.Descriptor instead. +func (*WriteGroupNatsOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_write_proto_rawDescGZIP(), []int{6} +} -func (m *WriteGroupNatsOptions) GetXConn() *args.NatsConn { - if m != nil { - return m.XConn +func (x *WriteGroupNatsOptions) GetXConn() *args.NatsConn { + if x != nil { + return x.XConn } return nil } -func (m *WriteGroupNatsOptions) GetArgs() *args.NatsWriteArgs { - if m != nil { - return m.Args +func (x *WriteGroupNatsOptions) GetArgs() *args.NatsWriteArgs { + if x != nil { + return x.Args } return nil } type WriteGroupNatsJetstreamOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.NatsJetstreamConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.NatsJetstreamWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.NatsJetstreamWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *WriteGroupNatsJetstreamOptions) Reset() { *m = WriteGroupNatsJetstreamOptions{} } -func (m *WriteGroupNatsJetstreamOptions) String() string { return proto.CompactTextString(m) } -func (*WriteGroupNatsJetstreamOptions) ProtoMessage() {} -func (*WriteGroupNatsJetstreamOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_c48ba9642d1e9ac6, []int{7} +func (x *WriteGroupNatsJetstreamOptions) Reset() { + *x = WriteGroupNatsJetstreamOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_write_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *WriteGroupNatsJetstreamOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteGroupNatsJetstreamOptions.Unmarshal(m, b) +func (x *WriteGroupNatsJetstreamOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WriteGroupNatsJetstreamOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteGroupNatsJetstreamOptions.Marshal(b, m, deterministic) -} -func (m *WriteGroupNatsJetstreamOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteGroupNatsJetstreamOptions.Merge(m, src) -} -func (m *WriteGroupNatsJetstreamOptions) XXX_Size() int { - return xxx_messageInfo_WriteGroupNatsJetstreamOptions.Size(m) -} -func (m *WriteGroupNatsJetstreamOptions) XXX_DiscardUnknown() { - xxx_messageInfo_WriteGroupNatsJetstreamOptions.DiscardUnknown(m) + +func (*WriteGroupNatsJetstreamOptions) ProtoMessage() {} + +func (x *WriteGroupNatsJetstreamOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_write_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WriteGroupNatsJetstreamOptions proto.InternalMessageInfo +// Deprecated: Use WriteGroupNatsJetstreamOptions.ProtoReflect.Descriptor instead. +func (*WriteGroupNatsJetstreamOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_write_proto_rawDescGZIP(), []int{7} +} -func (m *WriteGroupNatsJetstreamOptions) GetXConn() *args.NatsJetstreamConn { - if m != nil { - return m.XConn +func (x *WriteGroupNatsJetstreamOptions) GetXConn() *args.NatsJetstreamConn { + if x != nil { + return x.XConn } return nil } -func (m *WriteGroupNatsJetstreamOptions) GetArgs() *args.NatsJetstreamWriteArgs { - if m != nil { - return m.Args +func (x *WriteGroupNatsJetstreamOptions) GetArgs() *args.NatsJetstreamWriteArgs { + if x != nil { + return x.Args } return nil } type WriteGroupNatsStreamingOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.NatsStreamingConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.NatsStreamingWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.NatsStreamingWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *WriteGroupNatsStreamingOptions) Reset() { *m = WriteGroupNatsStreamingOptions{} } -func (m *WriteGroupNatsStreamingOptions) String() string { return proto.CompactTextString(m) } -func (*WriteGroupNatsStreamingOptions) ProtoMessage() {} -func (*WriteGroupNatsStreamingOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_c48ba9642d1e9ac6, []int{8} +func (x *WriteGroupNatsStreamingOptions) Reset() { + *x = WriteGroupNatsStreamingOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_write_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *WriteGroupNatsStreamingOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteGroupNatsStreamingOptions.Unmarshal(m, b) +func (x *WriteGroupNatsStreamingOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WriteGroupNatsStreamingOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteGroupNatsStreamingOptions.Marshal(b, m, deterministic) -} -func (m *WriteGroupNatsStreamingOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteGroupNatsStreamingOptions.Merge(m, src) -} -func (m *WriteGroupNatsStreamingOptions) XXX_Size() int { - return xxx_messageInfo_WriteGroupNatsStreamingOptions.Size(m) -} -func (m *WriteGroupNatsStreamingOptions) XXX_DiscardUnknown() { - xxx_messageInfo_WriteGroupNatsStreamingOptions.DiscardUnknown(m) + +func (*WriteGroupNatsStreamingOptions) ProtoMessage() {} + +func (x *WriteGroupNatsStreamingOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_write_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WriteGroupNatsStreamingOptions proto.InternalMessageInfo +// Deprecated: Use WriteGroupNatsStreamingOptions.ProtoReflect.Descriptor instead. +func (*WriteGroupNatsStreamingOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_write_proto_rawDescGZIP(), []int{8} +} -func (m *WriteGroupNatsStreamingOptions) GetXConn() *args.NatsStreamingConn { - if m != nil { - return m.XConn +func (x *WriteGroupNatsStreamingOptions) GetXConn() *args.NatsStreamingConn { + if x != nil { + return x.XConn } return nil } -func (m *WriteGroupNatsStreamingOptions) GetArgs() *args.NatsStreamingWriteArgs { - if m != nil { - return m.Args +func (x *WriteGroupNatsStreamingOptions) GetArgs() *args.NatsStreamingWriteArgs { + if x != nil { + return x.Args } return nil } type WriteGroupNSQOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.NSQConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.NSQWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.NSQWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *WriteGroupNSQOptions) Reset() { *m = WriteGroupNSQOptions{} } -func (m *WriteGroupNSQOptions) String() string { return proto.CompactTextString(m) } -func (*WriteGroupNSQOptions) ProtoMessage() {} -func (*WriteGroupNSQOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_c48ba9642d1e9ac6, []int{9} +func (x *WriteGroupNSQOptions) Reset() { + *x = WriteGroupNSQOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_write_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *WriteGroupNSQOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteGroupNSQOptions.Unmarshal(m, b) -} -func (m *WriteGroupNSQOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteGroupNSQOptions.Marshal(b, m, deterministic) +func (x *WriteGroupNSQOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WriteGroupNSQOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteGroupNSQOptions.Merge(m, src) -} -func (m *WriteGroupNSQOptions) XXX_Size() int { - return xxx_messageInfo_WriteGroupNSQOptions.Size(m) -} -func (m *WriteGroupNSQOptions) XXX_DiscardUnknown() { - xxx_messageInfo_WriteGroupNSQOptions.DiscardUnknown(m) + +func (*WriteGroupNSQOptions) ProtoMessage() {} + +func (x *WriteGroupNSQOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_write_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WriteGroupNSQOptions proto.InternalMessageInfo +// Deprecated: Use WriteGroupNSQOptions.ProtoReflect.Descriptor instead. +func (*WriteGroupNSQOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_write_proto_rawDescGZIP(), []int{9} +} -func (m *WriteGroupNSQOptions) GetXConn() *args.NSQConn { - if m != nil { - return m.XConn +func (x *WriteGroupNSQOptions) GetXConn() *args.NSQConn { + if x != nil { + return x.XConn } return nil } -func (m *WriteGroupNSQOptions) GetArgs() *args.NSQWriteArgs { - if m != nil { - return m.Args +func (x *WriteGroupNSQOptions) GetArgs() *args.NSQWriteArgs { + if x != nil { + return x.Args } return nil } type WriteGroupPulsarOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.PulsarConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.PulsarWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.PulsarWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *WriteGroupPulsarOptions) Reset() { *m = WriteGroupPulsarOptions{} } -func (m *WriteGroupPulsarOptions) String() string { return proto.CompactTextString(m) } -func (*WriteGroupPulsarOptions) ProtoMessage() {} -func (*WriteGroupPulsarOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_c48ba9642d1e9ac6, []int{10} +func (x *WriteGroupPulsarOptions) Reset() { + *x = WriteGroupPulsarOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_write_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *WriteGroupPulsarOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteGroupPulsarOptions.Unmarshal(m, b) -} -func (m *WriteGroupPulsarOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteGroupPulsarOptions.Marshal(b, m, deterministic) +func (x *WriteGroupPulsarOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WriteGroupPulsarOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteGroupPulsarOptions.Merge(m, src) -} -func (m *WriteGroupPulsarOptions) XXX_Size() int { - return xxx_messageInfo_WriteGroupPulsarOptions.Size(m) -} -func (m *WriteGroupPulsarOptions) XXX_DiscardUnknown() { - xxx_messageInfo_WriteGroupPulsarOptions.DiscardUnknown(m) + +func (*WriteGroupPulsarOptions) ProtoMessage() {} + +func (x *WriteGroupPulsarOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_write_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WriteGroupPulsarOptions proto.InternalMessageInfo +// Deprecated: Use WriteGroupPulsarOptions.ProtoReflect.Descriptor instead. +func (*WriteGroupPulsarOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_write_proto_rawDescGZIP(), []int{10} +} -func (m *WriteGroupPulsarOptions) GetXConn() *args.PulsarConn { - if m != nil { - return m.XConn +func (x *WriteGroupPulsarOptions) GetXConn() *args.PulsarConn { + if x != nil { + return x.XConn } return nil } -func (m *WriteGroupPulsarOptions) GetArgs() *args.PulsarWriteArgs { - if m != nil { - return m.Args +func (x *WriteGroupPulsarOptions) GetArgs() *args.PulsarWriteArgs { + if x != nil { + return x.Args } return nil } type WriteGroupRabbitOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.RabbitConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.RabbitWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.RabbitWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *WriteGroupRabbitOptions) Reset() { *m = WriteGroupRabbitOptions{} } -func (m *WriteGroupRabbitOptions) String() string { return proto.CompactTextString(m) } -func (*WriteGroupRabbitOptions) ProtoMessage() {} -func (*WriteGroupRabbitOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_c48ba9642d1e9ac6, []int{11} +func (x *WriteGroupRabbitOptions) Reset() { + *x = WriteGroupRabbitOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_write_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *WriteGroupRabbitOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteGroupRabbitOptions.Unmarshal(m, b) -} -func (m *WriteGroupRabbitOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteGroupRabbitOptions.Marshal(b, m, deterministic) +func (x *WriteGroupRabbitOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WriteGroupRabbitOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteGroupRabbitOptions.Merge(m, src) -} -func (m *WriteGroupRabbitOptions) XXX_Size() int { - return xxx_messageInfo_WriteGroupRabbitOptions.Size(m) -} -func (m *WriteGroupRabbitOptions) XXX_DiscardUnknown() { - xxx_messageInfo_WriteGroupRabbitOptions.DiscardUnknown(m) + +func (*WriteGroupRabbitOptions) ProtoMessage() {} + +func (x *WriteGroupRabbitOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_write_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WriteGroupRabbitOptions proto.InternalMessageInfo +// Deprecated: Use WriteGroupRabbitOptions.ProtoReflect.Descriptor instead. +func (*WriteGroupRabbitOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_write_proto_rawDescGZIP(), []int{11} +} -func (m *WriteGroupRabbitOptions) GetXConn() *args.RabbitConn { - if m != nil { - return m.XConn +func (x *WriteGroupRabbitOptions) GetXConn() *args.RabbitConn { + if x != nil { + return x.XConn } return nil } -func (m *WriteGroupRabbitOptions) GetArgs() *args.RabbitWriteArgs { - if m != nil { - return m.Args +func (x *WriteGroupRabbitOptions) GetArgs() *args.RabbitWriteArgs { + if x != nil { + return x.Args } return nil } type WriteGroupRabbitStreamsOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.RabbitStreamsConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.RabbitStreamsWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.RabbitStreamsWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *WriteGroupRabbitStreamsOptions) Reset() { *m = WriteGroupRabbitStreamsOptions{} } -func (m *WriteGroupRabbitStreamsOptions) String() string { return proto.CompactTextString(m) } -func (*WriteGroupRabbitStreamsOptions) ProtoMessage() {} -func (*WriteGroupRabbitStreamsOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_c48ba9642d1e9ac6, []int{12} +func (x *WriteGroupRabbitStreamsOptions) Reset() { + *x = WriteGroupRabbitStreamsOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_write_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *WriteGroupRabbitStreamsOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteGroupRabbitStreamsOptions.Unmarshal(m, b) -} -func (m *WriteGroupRabbitStreamsOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteGroupRabbitStreamsOptions.Marshal(b, m, deterministic) -} -func (m *WriteGroupRabbitStreamsOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteGroupRabbitStreamsOptions.Merge(m, src) +func (x *WriteGroupRabbitStreamsOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WriteGroupRabbitStreamsOptions) XXX_Size() int { - return xxx_messageInfo_WriteGroupRabbitStreamsOptions.Size(m) -} -func (m *WriteGroupRabbitStreamsOptions) XXX_DiscardUnknown() { - xxx_messageInfo_WriteGroupRabbitStreamsOptions.DiscardUnknown(m) + +func (*WriteGroupRabbitStreamsOptions) ProtoMessage() {} + +func (x *WriteGroupRabbitStreamsOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_write_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WriteGroupRabbitStreamsOptions proto.InternalMessageInfo +// Deprecated: Use WriteGroupRabbitStreamsOptions.ProtoReflect.Descriptor instead. +func (*WriteGroupRabbitStreamsOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_write_proto_rawDescGZIP(), []int{12} +} -func (m *WriteGroupRabbitStreamsOptions) GetXConn() *args.RabbitStreamsConn { - if m != nil { - return m.XConn +func (x *WriteGroupRabbitStreamsOptions) GetXConn() *args.RabbitStreamsConn { + if x != nil { + return x.XConn } return nil } -func (m *WriteGroupRabbitStreamsOptions) GetArgs() *args.RabbitStreamsWriteArgs { - if m != nil { - return m.Args +func (x *WriteGroupRabbitStreamsOptions) GetArgs() *args.RabbitStreamsWriteArgs { + if x != nil { + return x.Args } return nil } type WriteGroupRedisPubSubOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.RedisPubSubConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.RedisPubSubWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.RedisPubSubWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *WriteGroupRedisPubSubOptions) Reset() { *m = WriteGroupRedisPubSubOptions{} } -func (m *WriteGroupRedisPubSubOptions) String() string { return proto.CompactTextString(m) } -func (*WriteGroupRedisPubSubOptions) ProtoMessage() {} -func (*WriteGroupRedisPubSubOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_c48ba9642d1e9ac6, []int{13} +func (x *WriteGroupRedisPubSubOptions) Reset() { + *x = WriteGroupRedisPubSubOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_write_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *WriteGroupRedisPubSubOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteGroupRedisPubSubOptions.Unmarshal(m, b) -} -func (m *WriteGroupRedisPubSubOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteGroupRedisPubSubOptions.Marshal(b, m, deterministic) -} -func (m *WriteGroupRedisPubSubOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteGroupRedisPubSubOptions.Merge(m, src) -} -func (m *WriteGroupRedisPubSubOptions) XXX_Size() int { - return xxx_messageInfo_WriteGroupRedisPubSubOptions.Size(m) +func (x *WriteGroupRedisPubSubOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WriteGroupRedisPubSubOptions) XXX_DiscardUnknown() { - xxx_messageInfo_WriteGroupRedisPubSubOptions.DiscardUnknown(m) + +func (*WriteGroupRedisPubSubOptions) ProtoMessage() {} + +func (x *WriteGroupRedisPubSubOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_write_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WriteGroupRedisPubSubOptions proto.InternalMessageInfo +// Deprecated: Use WriteGroupRedisPubSubOptions.ProtoReflect.Descriptor instead. +func (*WriteGroupRedisPubSubOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_write_proto_rawDescGZIP(), []int{13} +} -func (m *WriteGroupRedisPubSubOptions) GetXConn() *args.RedisPubSubConn { - if m != nil { - return m.XConn +func (x *WriteGroupRedisPubSubOptions) GetXConn() *args.RedisPubSubConn { + if x != nil { + return x.XConn } return nil } -func (m *WriteGroupRedisPubSubOptions) GetArgs() *args.RedisPubSubWriteArgs { - if m != nil { - return m.Args +func (x *WriteGroupRedisPubSubOptions) GetArgs() *args.RedisPubSubWriteArgs { + if x != nil { + return x.Args } return nil } type WriteGroupRedisStreamsOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.RedisStreamsConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.RedisStreamsWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.RedisStreamsWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *WriteGroupRedisStreamsOptions) Reset() { *m = WriteGroupRedisStreamsOptions{} } -func (m *WriteGroupRedisStreamsOptions) String() string { return proto.CompactTextString(m) } -func (*WriteGroupRedisStreamsOptions) ProtoMessage() {} -func (*WriteGroupRedisStreamsOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_c48ba9642d1e9ac6, []int{14} +func (x *WriteGroupRedisStreamsOptions) Reset() { + *x = WriteGroupRedisStreamsOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_write_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *WriteGroupRedisStreamsOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteGroupRedisStreamsOptions.Unmarshal(m, b) -} -func (m *WriteGroupRedisStreamsOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteGroupRedisStreamsOptions.Marshal(b, m, deterministic) -} -func (m *WriteGroupRedisStreamsOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteGroupRedisStreamsOptions.Merge(m, src) -} -func (m *WriteGroupRedisStreamsOptions) XXX_Size() int { - return xxx_messageInfo_WriteGroupRedisStreamsOptions.Size(m) +func (x *WriteGroupRedisStreamsOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WriteGroupRedisStreamsOptions) XXX_DiscardUnknown() { - xxx_messageInfo_WriteGroupRedisStreamsOptions.DiscardUnknown(m) + +func (*WriteGroupRedisStreamsOptions) ProtoMessage() {} + +func (x *WriteGroupRedisStreamsOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_write_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WriteGroupRedisStreamsOptions proto.InternalMessageInfo +// Deprecated: Use WriteGroupRedisStreamsOptions.ProtoReflect.Descriptor instead. +func (*WriteGroupRedisStreamsOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_write_proto_rawDescGZIP(), []int{14} +} -func (m *WriteGroupRedisStreamsOptions) GetXConn() *args.RedisStreamsConn { - if m != nil { - return m.XConn +func (x *WriteGroupRedisStreamsOptions) GetXConn() *args.RedisStreamsConn { + if x != nil { + return x.XConn } return nil } -func (m *WriteGroupRedisStreamsOptions) GetArgs() *args.RedisStreamsWriteArgs { - if m != nil { - return m.Args +func (x *WriteGroupRedisStreamsOptions) GetArgs() *args.RedisStreamsWriteArgs { + if x != nil { + return x.Args } return nil } type WriteGroupAzureEventHubOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.AzureEventHubConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.AzureEventHubWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.AzureEventHubWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *WriteGroupAzureEventHubOptions) Reset() { *m = WriteGroupAzureEventHubOptions{} } -func (m *WriteGroupAzureEventHubOptions) String() string { return proto.CompactTextString(m) } -func (*WriteGroupAzureEventHubOptions) ProtoMessage() {} -func (*WriteGroupAzureEventHubOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_c48ba9642d1e9ac6, []int{15} +func (x *WriteGroupAzureEventHubOptions) Reset() { + *x = WriteGroupAzureEventHubOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_write_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *WriteGroupAzureEventHubOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteGroupAzureEventHubOptions.Unmarshal(m, b) -} -func (m *WriteGroupAzureEventHubOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteGroupAzureEventHubOptions.Marshal(b, m, deterministic) -} -func (m *WriteGroupAzureEventHubOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteGroupAzureEventHubOptions.Merge(m, src) -} -func (m *WriteGroupAzureEventHubOptions) XXX_Size() int { - return xxx_messageInfo_WriteGroupAzureEventHubOptions.Size(m) +func (x *WriteGroupAzureEventHubOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WriteGroupAzureEventHubOptions) XXX_DiscardUnknown() { - xxx_messageInfo_WriteGroupAzureEventHubOptions.DiscardUnknown(m) + +func (*WriteGroupAzureEventHubOptions) ProtoMessage() {} + +func (x *WriteGroupAzureEventHubOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_write_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WriteGroupAzureEventHubOptions proto.InternalMessageInfo +// Deprecated: Use WriteGroupAzureEventHubOptions.ProtoReflect.Descriptor instead. +func (*WriteGroupAzureEventHubOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_write_proto_rawDescGZIP(), []int{15} +} -func (m *WriteGroupAzureEventHubOptions) GetXConn() *args.AzureEventHubConn { - if m != nil { - return m.XConn +func (x *WriteGroupAzureEventHubOptions) GetXConn() *args.AzureEventHubConn { + if x != nil { + return x.XConn } return nil } -func (m *WriteGroupAzureEventHubOptions) GetArgs() *args.AzureEventHubWriteArgs { - if m != nil { - return m.Args +func (x *WriteGroupAzureEventHubOptions) GetArgs() *args.AzureEventHubWriteArgs { + if x != nil { + return x.Args } return nil } type WriteGroupAzureServiceBusOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed"{ XConn *args.AzureServiceBusConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.AzureServiceBusWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.AzureServiceBusWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *WriteGroupAzureServiceBusOptions) Reset() { *m = WriteGroupAzureServiceBusOptions{} } -func (m *WriteGroupAzureServiceBusOptions) String() string { return proto.CompactTextString(m) } -func (*WriteGroupAzureServiceBusOptions) ProtoMessage() {} -func (*WriteGroupAzureServiceBusOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_c48ba9642d1e9ac6, []int{16} +func (x *WriteGroupAzureServiceBusOptions) Reset() { + *x = WriteGroupAzureServiceBusOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_write_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *WriteGroupAzureServiceBusOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteGroupAzureServiceBusOptions.Unmarshal(m, b) -} -func (m *WriteGroupAzureServiceBusOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteGroupAzureServiceBusOptions.Marshal(b, m, deterministic) -} -func (m *WriteGroupAzureServiceBusOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteGroupAzureServiceBusOptions.Merge(m, src) -} -func (m *WriteGroupAzureServiceBusOptions) XXX_Size() int { - return xxx_messageInfo_WriteGroupAzureServiceBusOptions.Size(m) +func (x *WriteGroupAzureServiceBusOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WriteGroupAzureServiceBusOptions) XXX_DiscardUnknown() { - xxx_messageInfo_WriteGroupAzureServiceBusOptions.DiscardUnknown(m) + +func (*WriteGroupAzureServiceBusOptions) ProtoMessage() {} + +func (x *WriteGroupAzureServiceBusOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_write_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WriteGroupAzureServiceBusOptions proto.InternalMessageInfo +// Deprecated: Use WriteGroupAzureServiceBusOptions.ProtoReflect.Descriptor instead. +func (*WriteGroupAzureServiceBusOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_write_proto_rawDescGZIP(), []int{16} +} -func (m *WriteGroupAzureServiceBusOptions) GetXConn() *args.AzureServiceBusConn { - if m != nil { - return m.XConn +func (x *WriteGroupAzureServiceBusOptions) GetXConn() *args.AzureServiceBusConn { + if x != nil { + return x.XConn } return nil } -func (m *WriteGroupAzureServiceBusOptions) GetArgs() *args.AzureServiceBusWriteArgs { - if m != nil { - return m.Args +func (x *WriteGroupAzureServiceBusOptions) GetArgs() *args.AzureServiceBusWriteArgs { + if x != nil { + return x.Args } return nil } type WriteGroupMQTTOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.MQTTConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.MQTTWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.MQTTWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *WriteGroupMQTTOptions) Reset() { *m = WriteGroupMQTTOptions{} } -func (m *WriteGroupMQTTOptions) String() string { return proto.CompactTextString(m) } -func (*WriteGroupMQTTOptions) ProtoMessage() {} -func (*WriteGroupMQTTOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_c48ba9642d1e9ac6, []int{17} +func (x *WriteGroupMQTTOptions) Reset() { + *x = WriteGroupMQTTOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_write_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *WriteGroupMQTTOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteGroupMQTTOptions.Unmarshal(m, b) +func (x *WriteGroupMQTTOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WriteGroupMQTTOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteGroupMQTTOptions.Marshal(b, m, deterministic) -} -func (m *WriteGroupMQTTOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteGroupMQTTOptions.Merge(m, src) -} -func (m *WriteGroupMQTTOptions) XXX_Size() int { - return xxx_messageInfo_WriteGroupMQTTOptions.Size(m) -} -func (m *WriteGroupMQTTOptions) XXX_DiscardUnknown() { - xxx_messageInfo_WriteGroupMQTTOptions.DiscardUnknown(m) + +func (*WriteGroupMQTTOptions) ProtoMessage() {} + +func (x *WriteGroupMQTTOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_write_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WriteGroupMQTTOptions proto.InternalMessageInfo +// Deprecated: Use WriteGroupMQTTOptions.ProtoReflect.Descriptor instead. +func (*WriteGroupMQTTOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_write_proto_rawDescGZIP(), []int{17} +} -func (m *WriteGroupMQTTOptions) GetXConn() *args.MQTTConn { - if m != nil { - return m.XConn +func (x *WriteGroupMQTTOptions) GetXConn() *args.MQTTConn { + if x != nil { + return x.XConn } return nil } -func (m *WriteGroupMQTTOptions) GetArgs() *args.MQTTWriteArgs { - if m != nil { - return m.Args +func (x *WriteGroupMQTTOptions) GetArgs() *args.MQTTWriteArgs { + if x != nil { + return x.Args } return nil } type WriteGroupGCPPubSubOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.GCPPubSubConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.GCPPubSubWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.GCPPubSubWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *WriteGroupGCPPubSubOptions) Reset() { *m = WriteGroupGCPPubSubOptions{} } -func (m *WriteGroupGCPPubSubOptions) String() string { return proto.CompactTextString(m) } -func (*WriteGroupGCPPubSubOptions) ProtoMessage() {} -func (*WriteGroupGCPPubSubOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_c48ba9642d1e9ac6, []int{18} +func (x *WriteGroupGCPPubSubOptions) Reset() { + *x = WriteGroupGCPPubSubOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_write_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *WriteGroupGCPPubSubOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteGroupGCPPubSubOptions.Unmarshal(m, b) -} -func (m *WriteGroupGCPPubSubOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteGroupGCPPubSubOptions.Marshal(b, m, deterministic) +func (x *WriteGroupGCPPubSubOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WriteGroupGCPPubSubOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteGroupGCPPubSubOptions.Merge(m, src) -} -func (m *WriteGroupGCPPubSubOptions) XXX_Size() int { - return xxx_messageInfo_WriteGroupGCPPubSubOptions.Size(m) -} -func (m *WriteGroupGCPPubSubOptions) XXX_DiscardUnknown() { - xxx_messageInfo_WriteGroupGCPPubSubOptions.DiscardUnknown(m) + +func (*WriteGroupGCPPubSubOptions) ProtoMessage() {} + +func (x *WriteGroupGCPPubSubOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_write_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WriteGroupGCPPubSubOptions proto.InternalMessageInfo +// Deprecated: Use WriteGroupGCPPubSubOptions.ProtoReflect.Descriptor instead. +func (*WriteGroupGCPPubSubOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_write_proto_rawDescGZIP(), []int{18} +} -func (m *WriteGroupGCPPubSubOptions) GetXConn() *args.GCPPubSubConn { - if m != nil { - return m.XConn +func (x *WriteGroupGCPPubSubOptions) GetXConn() *args.GCPPubSubConn { + if x != nil { + return x.XConn } return nil } -func (m *WriteGroupGCPPubSubOptions) GetArgs() *args.GCPPubSubWriteArgs { - if m != nil { - return m.Args +func (x *WriteGroupGCPPubSubOptions) GetArgs() *args.GCPPubSubWriteArgs { + if x != nil { + return x.Args } return nil } type WriteGroupKubeMQQueueOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.KubeMQQueueConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.KubeMQQueueWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.KubeMQQueueWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *WriteGroupKubeMQQueueOptions) Reset() { *m = WriteGroupKubeMQQueueOptions{} } -func (m *WriteGroupKubeMQQueueOptions) String() string { return proto.CompactTextString(m) } -func (*WriteGroupKubeMQQueueOptions) ProtoMessage() {} -func (*WriteGroupKubeMQQueueOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_c48ba9642d1e9ac6, []int{19} +func (x *WriteGroupKubeMQQueueOptions) Reset() { + *x = WriteGroupKubeMQQueueOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_write_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *WriteGroupKubeMQQueueOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteGroupKubeMQQueueOptions.Unmarshal(m, b) -} -func (m *WriteGroupKubeMQQueueOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteGroupKubeMQQueueOptions.Marshal(b, m, deterministic) +func (x *WriteGroupKubeMQQueueOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WriteGroupKubeMQQueueOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteGroupKubeMQQueueOptions.Merge(m, src) -} -func (m *WriteGroupKubeMQQueueOptions) XXX_Size() int { - return xxx_messageInfo_WriteGroupKubeMQQueueOptions.Size(m) -} -func (m *WriteGroupKubeMQQueueOptions) XXX_DiscardUnknown() { - xxx_messageInfo_WriteGroupKubeMQQueueOptions.DiscardUnknown(m) + +func (*WriteGroupKubeMQQueueOptions) ProtoMessage() {} + +func (x *WriteGroupKubeMQQueueOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_write_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WriteGroupKubeMQQueueOptions proto.InternalMessageInfo +// Deprecated: Use WriteGroupKubeMQQueueOptions.ProtoReflect.Descriptor instead. +func (*WriteGroupKubeMQQueueOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_write_proto_rawDescGZIP(), []int{19} +} -func (m *WriteGroupKubeMQQueueOptions) GetXConn() *args.KubeMQQueueConn { - if m != nil { - return m.XConn +func (x *WriteGroupKubeMQQueueOptions) GetXConn() *args.KubeMQQueueConn { + if x != nil { + return x.XConn } return nil } -func (m *WriteGroupKubeMQQueueOptions) GetArgs() *args.KubeMQQueueWriteArgs { - if m != nil { - return m.Args +func (x *WriteGroupKubeMQQueueOptions) GetArgs() *args.KubeMQQueueWriteArgs { + if x != nil { + return x.Args } return nil } type WriteGroupAWSKinesisOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.AWSKinesisConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.AWSKinesisWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.AWSKinesisWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *WriteGroupAWSKinesisOptions) Reset() { *m = WriteGroupAWSKinesisOptions{} } -func (m *WriteGroupAWSKinesisOptions) String() string { return proto.CompactTextString(m) } -func (*WriteGroupAWSKinesisOptions) ProtoMessage() {} -func (*WriteGroupAWSKinesisOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_c48ba9642d1e9ac6, []int{20} +func (x *WriteGroupAWSKinesisOptions) Reset() { + *x = WriteGroupAWSKinesisOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_write_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *WriteGroupAWSKinesisOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteGroupAWSKinesisOptions.Unmarshal(m, b) -} -func (m *WriteGroupAWSKinesisOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteGroupAWSKinesisOptions.Marshal(b, m, deterministic) -} -func (m *WriteGroupAWSKinesisOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteGroupAWSKinesisOptions.Merge(m, src) +func (x *WriteGroupAWSKinesisOptions) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *WriteGroupAWSKinesisOptions) XXX_Size() int { - return xxx_messageInfo_WriteGroupAWSKinesisOptions.Size(m) -} -func (m *WriteGroupAWSKinesisOptions) XXX_DiscardUnknown() { - xxx_messageInfo_WriteGroupAWSKinesisOptions.DiscardUnknown(m) + +func (*WriteGroupAWSKinesisOptions) ProtoMessage() {} + +func (x *WriteGroupAWSKinesisOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_write_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_WriteGroupAWSKinesisOptions proto.InternalMessageInfo +// Deprecated: Use WriteGroupAWSKinesisOptions.ProtoReflect.Descriptor instead. +func (*WriteGroupAWSKinesisOptions) Descriptor() ([]byte, []int) { + return file_opts_ps_opts_write_proto_rawDescGZIP(), []int{20} +} -func (m *WriteGroupAWSKinesisOptions) GetXConn() *args.AWSKinesisConn { - if m != nil { - return m.XConn +func (x *WriteGroupAWSKinesisOptions) GetXConn() *args.AWSKinesisConn { + if x != nil { + return x.XConn } return nil } -func (m *WriteGroupAWSKinesisOptions) GetArgs() *args.AWSKinesisWriteArgs { - if m != nil { - return m.Args +func (x *WriteGroupAWSKinesisOptions) GetArgs() *args.AWSKinesisWriteArgs { + if x != nil { + return x.Args } return nil } type WriteGroupMemphisOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // @gotags: kong:"embed" XConn *args.MemphisConn `protobuf:"bytes,1,opt,name=_conn,json=Conn,proto3" json:"_conn,omitempty" kong:"embed"` // @gotags: kong:"embed" - Args *args.MemphisWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Args *args.MemphisWriteArgs `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty" kong:"embed"` } -func (m *WriteGroupMemphisOptions) Reset() { *m = WriteGroupMemphisOptions{} } -func (m *WriteGroupMemphisOptions) String() string { return proto.CompactTextString(m) } -func (*WriteGroupMemphisOptions) ProtoMessage() {} +func (x *WriteGroupMemphisOptions) Reset() { + *x = WriteGroupMemphisOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_opts_ps_opts_write_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WriteGroupMemphisOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WriteGroupMemphisOptions) ProtoMessage() {} + +func (x *WriteGroupMemphisOptions) ProtoReflect() protoreflect.Message { + mi := &file_opts_ps_opts_write_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WriteGroupMemphisOptions.ProtoReflect.Descriptor instead. func (*WriteGroupMemphisOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_c48ba9642d1e9ac6, []int{21} -} - -func (m *WriteGroupMemphisOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteGroupMemphisOptions.Unmarshal(m, b) -} -func (m *WriteGroupMemphisOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteGroupMemphisOptions.Marshal(b, m, deterministic) -} -func (m *WriteGroupMemphisOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteGroupMemphisOptions.Merge(m, src) -} -func (m *WriteGroupMemphisOptions) XXX_Size() int { - return xxx_messageInfo_WriteGroupMemphisOptions.Size(m) -} -func (m *WriteGroupMemphisOptions) XXX_DiscardUnknown() { - xxx_messageInfo_WriteGroupMemphisOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_WriteGroupMemphisOptions proto.InternalMessageInfo - -func (m *WriteGroupMemphisOptions) GetXConn() *args.MemphisConn { - if m != nil { - return m.XConn - } - return nil -} - -func (m *WriteGroupMemphisOptions) GetArgs() *args.MemphisWriteArgs { - if m != nil { - return m.Args - } - return nil -} - -func init() { - proto.RegisterType((*WriteCLIOptions)(nil), "protos.opts.WriteCLIOptions") - proto.RegisterType((*WriteOptions)(nil), "protos.opts.WriteOptions") - proto.RegisterType((*WriteGroupKafkaOptions)(nil), "protos.opts.WriteGroupKafkaOptions") - proto.RegisterType((*WriteGroupActiveMQOptions)(nil), "protos.opts.WriteGroupActiveMQOptions") - proto.RegisterType((*WriteGroupAWSSQSOptions)(nil), "protos.opts.WriteGroupAWSSQSOptions") - proto.RegisterType((*WriteGroupAWSSNSOptions)(nil), "protos.opts.WriteGroupAWSSNSOptions") - proto.RegisterType((*WriteGroupNatsOptions)(nil), "protos.opts.WriteGroupNatsOptions") - proto.RegisterType((*WriteGroupNatsJetstreamOptions)(nil), "protos.opts.WriteGroupNatsJetstreamOptions") - proto.RegisterType((*WriteGroupNatsStreamingOptions)(nil), "protos.opts.WriteGroupNatsStreamingOptions") - proto.RegisterType((*WriteGroupNSQOptions)(nil), "protos.opts.WriteGroupNSQOptions") - proto.RegisterType((*WriteGroupPulsarOptions)(nil), "protos.opts.WriteGroupPulsarOptions") - proto.RegisterType((*WriteGroupRabbitOptions)(nil), "protos.opts.WriteGroupRabbitOptions") - proto.RegisterType((*WriteGroupRabbitStreamsOptions)(nil), "protos.opts.WriteGroupRabbitStreamsOptions") - proto.RegisterType((*WriteGroupRedisPubSubOptions)(nil), "protos.opts.WriteGroupRedisPubSubOptions") - proto.RegisterType((*WriteGroupRedisStreamsOptions)(nil), "protos.opts.WriteGroupRedisStreamsOptions") - proto.RegisterType((*WriteGroupAzureEventHubOptions)(nil), "protos.opts.WriteGroupAzureEventHubOptions") - proto.RegisterType((*WriteGroupAzureServiceBusOptions)(nil), "protos.opts.WriteGroupAzureServiceBusOptions") - proto.RegisterType((*WriteGroupMQTTOptions)(nil), "protos.opts.WriteGroupMQTTOptions") - proto.RegisterType((*WriteGroupGCPPubSubOptions)(nil), "protos.opts.WriteGroupGCPPubSubOptions") - proto.RegisterType((*WriteGroupKubeMQQueueOptions)(nil), "protos.opts.WriteGroupKubeMQQueueOptions") - proto.RegisterType((*WriteGroupAWSKinesisOptions)(nil), "protos.opts.WriteGroupAWSKinesisOptions") - proto.RegisterType((*WriteGroupMemphisOptions)(nil), "protos.opts.WriteGroupMemphisOptions") -} - -func init() { proto.RegisterFile("opts/ps_opts_write.proto", fileDescriptor_c48ba9642d1e9ac6) } - -var fileDescriptor_c48ba9642d1e9ac6 = []byte{ - // 1348 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xef, 0x6f, 0xd3, 0x46, - 0x18, 0x56, 0x56, 0x28, 0xf4, 0xd2, 0xc2, 0x76, 0xe3, 0xc7, 0xb5, 0x25, 0x25, 0x04, 0xd8, 0x0a, - 0xac, 0x09, 0xb4, 0x83, 0xa9, 0xda, 0x26, 0xd4, 0x56, 0x85, 0x15, 0x68, 0x69, 0x1d, 0x24, 0xb4, - 0x7d, 0xb1, 0x6c, 0xe7, 0x9a, 0xb8, 0x4d, 0x6c, 0xc7, 0x67, 0xb7, 0x62, 0x9a, 0xb4, 0x69, 0xd2, - 0xa4, 0x49, 0x93, 0xf6, 0x69, 0x7f, 0xe4, 0xfe, 0x87, 0x7d, 0x99, 0xee, 0xce, 0xe7, 0xf8, 0x75, - 0xec, 0x4b, 0xf8, 0xd2, 0xd4, 0xf7, 0x3e, 0xcf, 0xf3, 0x3e, 0xf7, 0xeb, 0x7d, 0x0f, 0x11, 0x3f, - 0x88, 0x58, 0x2b, 0x60, 0x26, 0xff, 0x35, 0xcf, 0x43, 0x37, 0xa2, 0xcd, 0x20, 0xf4, 0x23, 0x1f, - 0x57, 0xc5, 0x0f, 0x6b, 0xf2, 0xc0, 0xd2, 0xb2, 0x15, 0x76, 0x05, 0x8c, 0xff, 0x9a, 0x96, 0x13, - 0xb9, 0x67, 0x74, 0x30, 0x94, 0xc8, 0xa5, 0x15, 0x18, 0x3c, 0x67, 0xe6, 0xa9, 0xeb, 0x51, 0xe6, - 0xb2, 0x24, 0xbe, 0x34, 0x16, 0x67, 0x9e, 0x26, 0x36, 0x54, 0xb1, 0x06, 0x8c, 0xfd, 0x1c, 0x87, - 0xd4, 0xa4, 0x67, 0xd4, 0x8b, 0xcc, 0x5e, 0x6c, 0x27, 0x98, 0x7b, 0x05, 0x18, 0x46, 0xc3, 0x33, - 0xd7, 0xa1, 0xa6, 0x1d, 0x2b, 0xa5, 0x1a, 0x40, 0x75, 0x9d, 0xc0, 0x0c, 0x62, 0x9b, 0xa5, 0x22, - 0x04, 0x84, 0x4f, 0xad, 0xe3, 0x53, 0x2b, 0x89, 0xdc, 0x86, 0x91, 0xd8, 0xa6, 0x83, 0xa1, 0x39, - 0x8c, 0x69, 0x4c, 0x0b, 0xfd, 0x0f, 0xe8, 0x20, 0xe8, 0xa5, 0xf3, 0xbe, 0x09, 0x63, 0xc3, 0x28, - 0x2a, 0x0c, 0x78, 0x56, 0xa4, 0x18, 0x77, 0xc6, 0x02, 0xe6, 0x09, 0x8d, 0x58, 0x14, 0x52, 0x6b, - 0x50, 0x0e, 0x91, 0x71, 0xd7, 0xeb, 0x26, 0x90, 0x1b, 0x10, 0xc2, 0xd4, 0x3e, 0x2d, 0x82, 0xf1, - 0x20, 0xee, 0x33, 0x2b, 0x2c, 0x0c, 0x85, 0x96, 0x6d, 0xbb, 0x51, 0x61, 0x42, 0x19, 0x4a, 0x52, - 0xb2, 0xc2, 0x55, 0x0a, 0x69, 0xc7, 0x65, 0x70, 0x81, 0xeb, 0x05, 0x00, 0x28, 0xd1, 0xa0, 0x9e, - 0xe3, 0x77, 0x5c, 0xaf, 0xcb, 0x51, 0xea, 0x7f, 0x7e, 0x28, 0x5d, 0x3f, 0x3d, 0x2b, 0xb5, 0x90, - 0x3a, 0x7e, 0xd8, 0x11, 0x42, 0xc9, 0xbf, 0xa6, 0x6d, 0xb1, 0x64, 0x2b, 0x1a, 0xbf, 0x55, 0xd0, - 0xd5, 0xf7, 0xfc, 0x00, 0xef, 0xbc, 0xd9, 0x7b, 0x2b, 0x89, 0xb8, 0x86, 0x90, 0xeb, 0x05, 0x71, - 0x64, 0x1e, 0xbb, 0x7d, 0x4a, 0x2a, 0xf5, 0xca, 0xea, 0x9c, 0x31, 0x27, 0x46, 0x5e, 0xb8, 0x7d, - 0x8a, 0xd7, 0xd0, 0xe7, 0x32, 0x6c, 0x31, 0xf3, 0x84, 0xf9, 0x9e, 0x69, 0x85, 0xa1, 0xf5, 0x81, - 0x7c, 0x52, 0xaf, 0xac, 0x5e, 0x36, 0x3e, 0x15, 0xa1, 0x2d, 0xf6, 0x8a, 0xf9, 0xde, 0x16, 0x1f, - 0xc7, 0xb7, 0x51, 0x55, 0xc2, 0x59, 0xd4, 0x71, 0x3d, 0x32, 0x53, 0x9f, 0x59, 0x9d, 0x33, 0x64, - 0x82, 0x36, 0x1f, 0x69, 0xfc, 0x37, 0x8f, 0xe6, 0x85, 0x05, 0x95, 0xff, 0x2e, 0x5a, 0x70, 0x7c, - 0xcf, 0xa3, 0x0e, 0xff, 0x34, 0xdd, 0x4e, 0x62, 0x61, 0x7e, 0x34, 0xb8, 0xd7, 0xc1, 0x1b, 0x68, - 0x56, 0x4e, 0x47, 0x24, 0xae, 0xae, 0x2f, 0x37, 0x93, 0xab, 0x97, 0x4c, 0xb2, 0x29, 0x24, 0x0d, - 0xf1, 0x61, 0x24, 0x50, 0xbc, 0x8b, 0xae, 0x88, 0x65, 0xa2, 0x6a, 0x91, 0xc8, 0x8c, 0x20, 0xaf, - 0x28, 0xb2, 0x5a, 0xc4, 0xe6, 0xae, 0x80, 0x25, 0x8e, 0x8c, 0x05, 0x9a, 0xfd, 0xc4, 0xcf, 0xd1, - 0xbc, 0xe9, 0xf4, 0xdd, 0x54, 0xe4, 0xdf, 0x4b, 0x42, 0xe5, 0x56, 0x33, 0x73, 0xfb, 0x9b, 0xb9, - 0x55, 0x35, 0xd0, 0x4e, 0xdf, 0x55, 0x02, 0x9b, 0xe8, 0xa2, 0xb8, 0x30, 0xa4, 0x23, 0x88, 0x77, - 0xc7, 0x89, 0x2f, 0x43, 0x3f, 0x0e, 0x5e, 0x73, 0x8c, 0xe2, 0x4b, 0x06, 0xde, 0x46, 0x97, 0x55, - 0x25, 0x21, 0x54, 0xb0, 0xbf, 0x28, 0x61, 0x6f, 0x09, 0xd8, 0xfe, 0x91, 0x12, 0x48, 0x79, 0xf8, - 0x7b, 0x74, 0x29, 0x29, 0x1a, 0xe4, 0x58, 0x48, 0xdc, 0x2b, 0x93, 0x78, 0xdf, 0x6e, 0x1f, 0xb5, - 0x95, 0xc0, 0xac, 0x75, 0xce, 0xda, 0x43, 0x96, 0xd2, 0x3d, 0x46, 0xba, 0x13, 0xe9, 0x07, 0x90, - 0xee, 0x31, 0xfc, 0x0c, 0x5d, 0xe0, 0x37, 0x90, 0xf4, 0x04, 0xb7, 0x51, 0xc2, 0x3d, 0xb0, 0x22, - 0xa6, 0x98, 0x02, 0x8f, 0x0d, 0x74, 0x05, 0xde, 0x5c, 0xe2, 0x0a, 0x85, 0x47, 0x1a, 0x85, 0xb6, - 0xc2, 0xa6, 0x3b, 0xe9, 0x65, 0x47, 0xf1, 0x06, 0x9a, 0xf1, 0xd8, 0x90, 0x9c, 0x08, 0xa1, 0x3b, - 0x65, 0x42, 0xed, 0x74, 0x0d, 0x39, 0x1a, 0x7f, 0x87, 0x66, 0x65, 0x1d, 0x20, 0xa7, 0xda, 0xe9, - 0x1f, 0x0a, 0x50, 0x3a, 0x7d, 0xc9, 0xe1, 0x6c, 0x59, 0x0f, 0x48, 0x5f, 0xcb, 0x36, 0x04, 0x28, - 0x65, 0x4b, 0x0e, 0x5f, 0x04, 0x58, 0x4d, 0xc8, 0x40, 0xbb, 0x08, 0x52, 0x45, 0x4e, 0x38, 0x5d, - 0xcf, 0x85, 0x30, 0x3b, 0xca, 0x37, 0x84, 0xd7, 0x59, 0xe2, 0x69, 0x37, 0x64, 0xff, 0xe8, 0xdd, - 0xbb, 0x74, 0x43, 0x38, 0x1e, 0xff, 0x88, 0x3e, 0x1b, 0xeb, 0x1d, 0xc4, 0x17, 0x22, 0x6b, 0x65, - 0x27, 0x82, 0xe3, 0xdb, 0x12, 0xbe, 0x1d, 0xa7, 0x86, 0xae, 0x5a, 0x70, 0x1c, 0xb7, 0xd1, 0xd5, - 0x5c, 0xeb, 0x22, 0x81, 0x76, 0x9e, 0x42, 0x78, 0x97, 0x83, 0x7f, 0x88, 0xed, 0x74, 0x9e, 0x56, - 0x76, 0x14, 0xbf, 0x40, 0x68, 0xd4, 0xc5, 0xc8, 0x50, 0xe8, 0x7d, 0x59, 0xa2, 0xf7, 0x72, 0xe7, - 0xf0, 0x30, 0xb6, 0xdb, 0x23, 0xad, 0xb9, 0xae, 0x13, 0x1c, 0x0a, 0x26, 0x7e, 0x83, 0xe6, 0xb3, - 0x4d, 0x8d, 0x84, 0x42, 0xe9, 0x41, 0xd9, 0x25, 0x8e, 0x6d, 0xba, 0x7f, 0x74, 0xc4, 0x91, 0x4a, - 0xab, 0x2a, 0xe9, 0x62, 0x8c, 0xab, 0x65, 0x8b, 0x3f, 0x61, 0x5a, 0x35, 0x83, 0x43, 0xa1, 0xb3, - 0x6a, 0x98, 0x8c, 0x71, 0x6f, 0x6f, 0xd1, 0x02, 0xe8, 0x14, 0x24, 0x12, 0x72, 0x0f, 0x75, 0x72, - 0xb9, 0xd3, 0x21, 0xed, 0xa8, 0xc3, 0xa1, 0x6e, 0x5d, 0xda, 0x52, 0x49, 0x3c, 0xf1, 0xd6, 0xbd, - 0x52, 0x58, 0x70, 0xeb, 0xd2, 0x51, 0xbc, 0x87, 0xaa, 0x99, 0x07, 0x0f, 0x39, 0x13, 0x82, 0xab, - 0xe5, 0x45, 0xe4, 0xb5, 0x04, 0xa6, 0x95, 0xd4, 0x3a, 0x67, 0xc9, 0x10, 0x7e, 0x8e, 0x2e, 0x25, - 0xef, 0x07, 0x72, 0x2e, 0x64, 0xee, 0x97, 0x1d, 0x5f, 0x89, 0x52, 0x1a, 0x8a, 0xd5, 0x38, 0x43, - 0x37, 0x8a, 0x0b, 0x2e, 0x7e, 0x84, 0x2e, 0x9a, 0xbc, 0xe5, 0x88, 0xf6, 0x53, 0x5d, 0xbf, 0xa1, - 0x84, 0x79, 0x3b, 0x6e, 0x0a, 0xe4, 0x8e, 0xef, 0x79, 0xc6, 0x05, 0xfe, 0x17, 0xb7, 0xd0, 0x05, - 0x3e, 0x9e, 0x6f, 0x46, 0x23, 0xac, 0x48, 0xb2, 0x15, 0x76, 0x99, 0x21, 0x80, 0x8d, 0x5f, 0xd1, - 0x62, 0x69, 0xa9, 0xc6, 0x4d, 0x98, 0x7a, 0x11, 0xc8, 0x29, 0x70, 0x26, 0xfb, 0x3a, 0xc8, 0xbe, - 0x52, 0x08, 0xcf, 0x1b, 0xf8, 0x80, 0x6e, 0x96, 0x14, 0x7a, 0xfc, 0x15, 0x4c, 0x7f, 0x13, 0xea, - 0x09, 0x68, 0x26, 0xf9, 0x63, 0x90, 0xfc, 0x56, 0x01, 0x78, 0x62, 0xea, 0x83, 0xe9, 0x53, 0x1f, - 0x7c, 0x4c, 0xea, 0x83, 0xb1, 0xd4, 0x0c, 0x5d, 0x2f, 0xec, 0x31, 0xf8, 0x21, 0x4c, 0x7c, 0x1d, - 0x68, 0x71, 0x60, 0x26, 0x6d, 0x13, 0xa4, 0x5d, 0x1a, 0x83, 0xe6, 0x93, 0xfe, 0x5d, 0x41, 0x2b, - 0xfa, 0x1b, 0x82, 0x37, 0x60, 0xfa, 0x95, 0x31, 0xcd, 0x94, 0x91, 0xf1, 0xf1, 0x0d, 0xf0, 0x71, - 0xb7, 0x9c, 0x33, 0xd9, 0x50, 0xbe, 0x51, 0x4e, 0x36, 0x94, 0x32, 0x3e, 0xc2, 0x50, 0xca, 0xc9, - 0x1b, 0x0a, 0xd0, 0xb5, 0xa2, 0x7e, 0x8b, 0x1f, 0x40, 0x17, 0xd7, 0xa0, 0x62, 0x3b, 0x7b, 0x07, - 0xd6, 0x40, 0xee, 0xc5, 0x3c, 0x52, 0x7b, 0x06, 0x41, 0xa7, 0xd6, 0x9f, 0x41, 0x09, 0x9d, 0xf2, - 0x0c, 0x4a, 0xb0, 0x36, 0x35, 0x68, 0xf3, 0xfa, 0xd4, 0x12, 0x3a, 0x65, 0x6a, 0x09, 0xd6, 0x6f, - 0x7c, 0xd1, 0xe3, 0x40, 0xbf, 0xf1, 0x80, 0x31, 0xe5, 0xc6, 0x03, 0x4e, 0xde, 0xd0, 0x9f, 0x15, - 0x74, 0x4b, 0xd7, 0xdd, 0xf0, 0x13, 0x68, 0x27, 0x37, 0xc9, 0x11, 0x3e, 0x63, 0xe6, 0x29, 0x30, - 0x73, 0xa7, 0x8c, 0x91, 0xb7, 0xf2, 0x57, 0x05, 0xd5, 0xb4, 0x9d, 0x11, 0xaf, 0x43, 0x2f, 0xb5, - 0x71, 0xe5, 0xf1, 0x95, 0x79, 0x06, 0xcc, 0x34, 0x4a, 0x29, 0xfa, 0x9d, 0x2a, 0x7a, 0xde, 0xe8, - 0x77, 0x0a, 0x30, 0xa6, 0xdc, 0x29, 0xc0, 0xc9, 0x1b, 0xfa, 0xa7, 0x82, 0xea, 0x93, 0x1e, 0x72, - 0xf8, 0x29, 0xb4, 0x54, 0x1f, 0x97, 0x1f, 0x71, 0x32, 0xa6, 0x36, 0x81, 0xa9, 0xfb, 0x3a, 0x96, - 0xb6, 0xa0, 0x67, 0xde, 0xa8, 0xfa, 0x82, 0xce, 0x81, 0x53, 0x16, 0x74, 0x0e, 0xcd, 0x27, 0xfd, - 0xbd, 0x82, 0x96, 0xca, 0xdf, 0x8a, 0xb8, 0x05, 0x53, 0x43, 0xbd, 0x14, 0x9d, 0xc9, 0xbf, 0x01, - 0xf2, 0xdf, 0x2e, 0xc6, 0xeb, 0xaf, 0xce, 0xf8, 0x33, 0x53, 0x7f, 0x75, 0x32, 0xf8, 0x29, 0xaf, - 0x4e, 0x86, 0x91, 0xb7, 0xf2, 0x47, 0x05, 0x2d, 0x6b, 0x5e, 0x6c, 0xf8, 0x31, 0x74, 0xb2, 0x9c, - 0x6f, 0xd4, 0x09, 0x3c, 0x63, 0xe4, 0x6b, 0x60, 0xa4, 0x5e, 0x42, 0xc8, 0xfb, 0xf8, 0x05, 0x91, - 0xb2, 0x17, 0x1f, 0x5e, 0x83, 0x1e, 0x08, 0xdc, 0x64, 0x89, 0xcd, 0x18, 0x78, 0x02, 0x0c, 0xd4, - 0x8a, 0xd0, 0xb9, 0xec, 0xdb, 0xdf, 0xfe, 0xb4, 0xd9, 0x75, 0xa3, 0x5e, 0x6c, 0x37, 0x1d, 0x7f, - 0xd0, 0xb2, 0xad, 0xc8, 0xe9, 0x39, 0x7e, 0x18, 0xb4, 0x82, 0x7e, 0x3c, 0xb0, 0x69, 0xb8, 0xc6, - 0x9c, 0x1e, 0x1d, 0x58, 0xac, 0x65, 0xc7, 0x6e, 0xbf, 0xd3, 0xea, 0xfa, 0x2d, 0xa9, 0xd9, 0xe2, - 0x2f, 0x55, 0x7b, 0x56, 0x7c, 0x6c, 0xfc, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x59, 0x5d, 0xb3, 0x0f, - 0x5c, 0x14, 0x00, 0x00, + return file_opts_ps_opts_write_proto_rawDescGZIP(), []int{21} +} + +func (x *WriteGroupMemphisOptions) GetXConn() *args.MemphisConn { + if x != nil { + return x.XConn + } + return nil +} + +func (x *WriteGroupMemphisOptions) GetArgs() *args.MemphisWriteArgs { + if x != nil { + return x.Args + } + return nil +} + +var File_opts_ps_opts_write_proto protoreflect.FileDescriptor + +var file_opts_ps_opts_write_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x77, + 0x72, 0x69, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x1a, 0x1b, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, + 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x6d, 0x71, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, + 0x67, 0x73, 0x5f, 0x61, 0x77, 0x73, 0x5f, 0x6b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, + 0x67, 0x73, 0x5f, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1a, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, + 0x77, 0x73, 0x5f, 0x73, 0x71, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x22, 0x61, 0x72, + 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x7a, 0x75, 0x72, 0x65, + 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x24, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, + 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x62, 0x75, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, + 0x61, 0x72, 0x67, 0x73, 0x5f, 0x67, 0x63, 0x70, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, + 0x72, 0x67, 0x73, 0x5f, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x1f, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6b, 0x75, + 0x62, 0x65, 0x6d, 0x71, 0x5f, 0x71, 0x75, 0x65, 0x75, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1a, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6d, + 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x61, 0x72, + 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6d, 0x71, 0x74, 0x74, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, + 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, + 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, 0x74, + 0x73, 0x5f, 0x6a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x21, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, + 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, + 0x67, 0x73, 0x5f, 0x6e, 0x73, 0x71, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x61, 0x72, + 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x70, 0x75, 0x6c, 0x73, 0x61, + 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, + 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x21, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, + 0x5f, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, + 0x72, 0x67, 0x73, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, + 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x22, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, + 0x6e, 0x67, 0x2f, 0x70, 0x73, 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x72, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, + 0x5f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x80, 0x01, 0x0a, 0x0f, + 0x57, 0x72, 0x69, 0x74, 0x65, 0x43, 0x4c, 0x49, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x1d, 0x0a, 0x0a, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x2d, + 0x0a, 0x13, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x61, 0x73, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, + 0x61, 0x72, 0x72, 0x61, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x69, 0x6e, 0x70, + 0x75, 0x74, 0x41, 0x73, 0x4a, 0x73, 0x6f, 0x6e, 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x1f, 0x0a, + 0x0b, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x73, 0x74, 0x64, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x53, 0x74, 0x64, 0x69, 0x6e, 0x22, 0xfb, + 0x0c, 0x0a, 0x0c, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x33, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x45, 0x0a, 0x0e, 0x65, 0x6e, 0x63, + 0x6f, 0x64, 0x65, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x65, 0x6e, 0x63, 0x6f, 0x64, + 0x69, 0x6e, 0x67, 0x2e, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x0d, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x3f, 0x0a, 0x0c, 0x5f, 0x63, 0x6c, 0x69, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x43, 0x4c, 0x49, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0a, 0x43, 0x6c, 0x69, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x39, 0x0a, 0x05, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x57, + 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x05, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x12, 0x42, 0x0a, 0x08, + 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x6d, 0x71, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x57, 0x72, 0x69, + 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4d, 0x51, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x08, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x6d, 0x71, + 0x12, 0x3d, 0x0a, 0x07, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x71, 0x73, 0x18, 0x66, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, + 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x57, 0x53, 0x53, 0x51, 0x53, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x61, 0x77, 0x73, 0x53, 0x71, 0x73, 0x12, + 0x3d, 0x0a, 0x07, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x6e, 0x73, 0x18, 0x67, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x57, + 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x57, 0x53, 0x53, 0x4e, 0x53, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x61, 0x77, 0x73, 0x53, 0x6e, 0x73, 0x12, 0x36, + 0x0a, 0x04, 0x6e, 0x61, 0x74, 0x73, 0x18, 0x68, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x74, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x04, 0x6e, 0x61, 0x74, 0x73, 0x12, 0x52, 0x0a, 0x0e, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x69, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x57, 0x72, 0x69, + 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0d, 0x6e, 0x61, 0x74, + 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x12, 0x33, 0x0a, 0x03, 0x6e, 0x73, + 0x71, 0x18, 0x6a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x4e, 0x53, 0x51, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x03, 0x6e, 0x73, 0x71, 0x12, + 0x3c, 0x0a, 0x06, 0x70, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x18, 0x6b, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x57, 0x72, + 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x70, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x12, 0x3c, 0x0a, + 0x06, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x18, 0x6c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x57, 0x72, 0x69, 0x74, + 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x12, 0x52, 0x0a, 0x0e, 0x72, + 0x61, 0x62, 0x62, 0x69, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x6d, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, + 0x73, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x61, 0x62, 0x62, + 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x0d, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, + 0x36, 0x0a, 0x04, 0x6d, 0x71, 0x74, 0x74, 0x18, 0x6e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x57, 0x72, 0x69, 0x74, + 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x51, 0x54, 0x54, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x04, 0x6d, 0x71, 0x74, 0x74, 0x12, 0x59, 0x0a, 0x11, 0x61, 0x7a, 0x75, 0x72, 0x65, + 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x62, 0x75, 0x73, 0x18, 0x6f, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, + 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x7a, 0x75, 0x72, 0x65, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x0f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, + 0x75, 0x73, 0x12, 0x53, 0x0a, 0x0f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x65, 0x76, 0x65, 0x6e, + 0x74, 0x5f, 0x68, 0x75, 0x62, 0x18, 0x70, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x75, + 0x62, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0d, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x48, 0x75, 0x62, 0x12, 0x46, 0x0a, 0x0a, 0x67, 0x63, 0x70, 0x5f, 0x70, + 0x75, 0x62, 0x73, 0x75, 0x62, 0x18, 0x71, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x47, 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x09, 0x67, 0x63, 0x70, 0x50, 0x75, 0x62, 0x73, 0x75, 0x62, 0x12, + 0x4c, 0x0a, 0x0c, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, 0x5f, 0x71, 0x75, 0x65, 0x75, 0x65, 0x18, + 0x72, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, + 0x70, 0x74, 0x73, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4b, 0x75, + 0x62, 0x65, 0x4d, 0x51, 0x51, 0x75, 0x65, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x0b, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, 0x51, 0x75, 0x65, 0x75, 0x65, 0x12, 0x4c, 0x0a, + 0x0c, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x18, 0x73, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, + 0x73, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x64, 0x69, + 0x73, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0b, + 0x72, 0x65, 0x64, 0x69, 0x73, 0x50, 0x75, 0x62, 0x73, 0x75, 0x62, 0x12, 0x4f, 0x0a, 0x0d, 0x72, + 0x65, 0x64, 0x69, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x74, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, + 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x64, 0x69, 0x73, + 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0c, + 0x72, 0x65, 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x52, 0x0a, 0x0e, + 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x6a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18, 0x75, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, + 0x74, 0x73, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x74, + 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x0d, 0x6e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x12, 0x49, 0x0a, 0x0b, 0x61, 0x77, 0x73, 0x5f, 0x6b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x18, + 0x76, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, + 0x70, 0x74, 0x73, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x57, + 0x53, 0x4b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x0a, 0x61, 0x77, 0x73, 0x4b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x12, 0x3f, 0x0a, 0x07, 0x6d, + 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x18, 0x77, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x22, 0x76, 0x0a, 0x16, + 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2b, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, + 0x72, 0x67, 0x73, 0x2e, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, + 0x6f, 0x6e, 0x6e, 0x12, 0x2f, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, + 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, + 0x61, 0x72, 0x67, 0x73, 0x22, 0x7f, 0x0a, 0x19, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4d, 0x51, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x2e, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, + 0x63, 0x74, 0x69, 0x76, 0x65, 0x4d, 0x51, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, + 0x6e, 0x12, 0x32, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x63, + 0x74, 0x69, 0x76, 0x65, 0x4d, 0x51, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, + 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x79, 0x0a, 0x17, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x41, 0x57, 0x53, 0x53, 0x51, 0x53, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x2c, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, + 0x53, 0x53, 0x51, 0x53, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x30, + 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x53, 0x51, + 0x53, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, + 0x22, 0x79, 0x0a, 0x17, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x57, + 0x53, 0x53, 0x4e, 0x53, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2c, 0x0a, 0x05, 0x5f, + 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x53, 0x4e, 0x53, 0x43, + 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x30, 0x0a, 0x04, 0x61, 0x72, 0x67, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x53, 0x4e, 0x53, 0x57, 0x72, 0x69, 0x74, + 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x73, 0x0a, 0x15, 0x57, + 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x74, 0x73, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, + 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, + 0x12, 0x2e, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, + 0x73, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, + 0x22, 0x8e, 0x01, 0x0a, 0x1e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, + 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x33, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, + 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6f, + 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x37, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, + 0x73, 0x22, 0x8e, 0x01, 0x0a, 0x1e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x33, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, + 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x43, + 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x37, 0x0a, 0x04, 0x61, 0x72, 0x67, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x69, 0x6e, 0x67, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, + 0x67, 0x73, 0x22, 0x70, 0x0a, 0x14, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x4e, 0x53, 0x51, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x29, 0x0a, 0x05, 0x5f, 0x63, + 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4e, 0x53, 0x51, 0x43, 0x6f, 0x6e, 0x6e, 0x52, + 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x2d, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, + 0x73, 0x2e, 0x4e, 0x53, 0x51, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, + 0x61, 0x72, 0x67, 0x73, 0x22, 0x79, 0x0a, 0x17, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x50, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x2c, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x50, 0x75, 0x6c, + 0x73, 0x61, 0x72, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x30, 0x0a, + 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x50, 0x75, 0x6c, 0x73, 0x61, 0x72, + 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, + 0x79, 0x0a, 0x17, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x61, 0x62, + 0x62, 0x69, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2c, 0x0a, 0x05, 0x5f, 0x63, + 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x43, 0x6f, + 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x30, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x57, 0x72, 0x69, 0x74, 0x65, + 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x8e, 0x01, 0x0a, 0x1e, 0x57, + 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x33, 0x0a, + 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x61, 0x62, 0x62, 0x69, + 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, + 0x6e, 0x6e, 0x12, 0x37, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, + 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x57, 0x72, 0x69, 0x74, + 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x88, 0x01, 0x0a, 0x1c, + 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x64, 0x69, 0x73, 0x50, + 0x75, 0x62, 0x53, 0x75, 0x62, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x31, 0x0a, 0x05, + 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, 0x50, + 0x75, 0x62, 0x53, 0x75, 0x62, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, + 0x35, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x65, 0x64, 0x69, + 0x73, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, + 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x8b, 0x01, 0x0a, 0x1d, 0x57, 0x72, 0x69, 0x74, 0x65, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x32, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x36, 0x0a, 0x04, + 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, 0x53, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x73, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, + 0x61, 0x72, 0x67, 0x73, 0x22, 0x8e, 0x01, 0x0a, 0x1e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x75, 0x62, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x33, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, + 0x75, 0x62, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x37, 0x0a, 0x04, + 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x48, 0x75, 0x62, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, + 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x94, 0x01, 0x0a, 0x20, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x42, 0x75, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x35, 0x0a, 0x05, 0x5f, 0x63, + 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, + 0x6e, 0x12, 0x39, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x25, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, 0x7a, + 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, 0x57, 0x72, 0x69, + 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x73, 0x0a, 0x15, + 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x51, 0x54, 0x54, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, + 0x67, 0x73, 0x2e, 0x4d, 0x51, 0x54, 0x54, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, + 0x6e, 0x12, 0x2e, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4d, 0x51, + 0x54, 0x54, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, + 0x73, 0x22, 0x82, 0x01, 0x0a, 0x1a, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x47, 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x2f, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x47, 0x43, + 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, + 0x6e, 0x12, 0x33, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x47, 0x43, + 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, + 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x88, 0x01, 0x0a, 0x1c, 0x57, 0x72, 0x69, 0x74, 0x65, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4b, 0x75, 0x62, 0x65, 0x4d, 0x51, 0x51, 0x75, 0x65, 0x75, 0x65, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x31, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4b, 0x75, 0x62, 0x65, 0x4d, 0x51, 0x51, 0x75, 0x65, 0x75, 0x65, + 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x35, 0x0a, 0x04, 0x61, 0x72, + 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x4b, 0x75, 0x62, 0x65, 0x4d, 0x51, 0x51, 0x75, 0x65, + 0x75, 0x65, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, + 0x73, 0x22, 0x85, 0x01, 0x0a, 0x1b, 0x57, 0x72, 0x69, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x41, 0x57, 0x53, 0x4b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x30, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, 0x41, + 0x57, 0x53, 0x4b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, 0x43, + 0x6f, 0x6e, 0x6e, 0x12, 0x34, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, 0x2e, + 0x41, 0x57, 0x53, 0x4b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, + 0x72, 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x7c, 0x0a, 0x18, 0x57, 0x72, 0x69, + 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2d, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, + 0x67, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x52, 0x04, + 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x31, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x72, 0x67, 0x73, + 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, + 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, + 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, + 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, + 0x6f, 0x70, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_opts_ps_opts_write_proto_rawDescOnce sync.Once + file_opts_ps_opts_write_proto_rawDescData = file_opts_ps_opts_write_proto_rawDesc +) + +func file_opts_ps_opts_write_proto_rawDescGZIP() []byte { + file_opts_ps_opts_write_proto_rawDescOnce.Do(func() { + file_opts_ps_opts_write_proto_rawDescData = protoimpl.X.CompressGZIP(file_opts_ps_opts_write_proto_rawDescData) + }) + return file_opts_ps_opts_write_proto_rawDescData +} + +var file_opts_ps_opts_write_proto_msgTypes = make([]protoimpl.MessageInfo, 22) +var file_opts_ps_opts_write_proto_goTypes = []interface{}{ + (*WriteCLIOptions)(nil), // 0: protos.opts.WriteCLIOptions + (*WriteOptions)(nil), // 1: protos.opts.WriteOptions + (*WriteGroupKafkaOptions)(nil), // 2: protos.opts.WriteGroupKafkaOptions + (*WriteGroupActiveMQOptions)(nil), // 3: protos.opts.WriteGroupActiveMQOptions + (*WriteGroupAWSSQSOptions)(nil), // 4: protos.opts.WriteGroupAWSSQSOptions + (*WriteGroupAWSSNSOptions)(nil), // 5: protos.opts.WriteGroupAWSSNSOptions + (*WriteGroupNatsOptions)(nil), // 6: protos.opts.WriteGroupNatsOptions + (*WriteGroupNatsJetstreamOptions)(nil), // 7: protos.opts.WriteGroupNatsJetstreamOptions + (*WriteGroupNatsStreamingOptions)(nil), // 8: protos.opts.WriteGroupNatsStreamingOptions + (*WriteGroupNSQOptions)(nil), // 9: protos.opts.WriteGroupNSQOptions + (*WriteGroupPulsarOptions)(nil), // 10: protos.opts.WriteGroupPulsarOptions + (*WriteGroupRabbitOptions)(nil), // 11: protos.opts.WriteGroupRabbitOptions + (*WriteGroupRabbitStreamsOptions)(nil), // 12: protos.opts.WriteGroupRabbitStreamsOptions + (*WriteGroupRedisPubSubOptions)(nil), // 13: protos.opts.WriteGroupRedisPubSubOptions + (*WriteGroupRedisStreamsOptions)(nil), // 14: protos.opts.WriteGroupRedisStreamsOptions + (*WriteGroupAzureEventHubOptions)(nil), // 15: protos.opts.WriteGroupAzureEventHubOptions + (*WriteGroupAzureServiceBusOptions)(nil), // 16: protos.opts.WriteGroupAzureServiceBusOptions + (*WriteGroupMQTTOptions)(nil), // 17: protos.opts.WriteGroupMQTTOptions + (*WriteGroupGCPPubSubOptions)(nil), // 18: protos.opts.WriteGroupGCPPubSubOptions + (*WriteGroupKubeMQQueueOptions)(nil), // 19: protos.opts.WriteGroupKubeMQQueueOptions + (*WriteGroupAWSKinesisOptions)(nil), // 20: protos.opts.WriteGroupAWSKinesisOptions + (*WriteGroupMemphisOptions)(nil), // 21: protos.opts.WriteGroupMemphisOptions + (*records.WriteRecord)(nil), // 22: protos.records.WriteRecord + (*encoding.EncodeOptions)(nil), // 23: protos.encoding.EncodeOptions + (*args.KafkaConn)(nil), // 24: protos.args.KafkaConn + (*args.KafkaWriteArgs)(nil), // 25: protos.args.KafkaWriteArgs + (*args.ActiveMQConn)(nil), // 26: protos.args.ActiveMQConn + (*args.ActiveMQWriteArgs)(nil), // 27: protos.args.ActiveMQWriteArgs + (*args.AWSSQSConn)(nil), // 28: protos.args.AWSSQSConn + (*args.AWSSQSWriteArgs)(nil), // 29: protos.args.AWSSQSWriteArgs + (*args.AWSSNSConn)(nil), // 30: protos.args.AWSSNSConn + (*args.AWSSNSWriteArgs)(nil), // 31: protos.args.AWSSNSWriteArgs + (*args.NatsConn)(nil), // 32: protos.args.NatsConn + (*args.NatsWriteArgs)(nil), // 33: protos.args.NatsWriteArgs + (*args.NatsJetstreamConn)(nil), // 34: protos.args.NatsJetstreamConn + (*args.NatsJetstreamWriteArgs)(nil), // 35: protos.args.NatsJetstreamWriteArgs + (*args.NatsStreamingConn)(nil), // 36: protos.args.NatsStreamingConn + (*args.NatsStreamingWriteArgs)(nil), // 37: protos.args.NatsStreamingWriteArgs + (*args.NSQConn)(nil), // 38: protos.args.NSQConn + (*args.NSQWriteArgs)(nil), // 39: protos.args.NSQWriteArgs + (*args.PulsarConn)(nil), // 40: protos.args.PulsarConn + (*args.PulsarWriteArgs)(nil), // 41: protos.args.PulsarWriteArgs + (*args.RabbitConn)(nil), // 42: protos.args.RabbitConn + (*args.RabbitWriteArgs)(nil), // 43: protos.args.RabbitWriteArgs + (*args.RabbitStreamsConn)(nil), // 44: protos.args.RabbitStreamsConn + (*args.RabbitStreamsWriteArgs)(nil), // 45: protos.args.RabbitStreamsWriteArgs + (*args.RedisPubSubConn)(nil), // 46: protos.args.RedisPubSubConn + (*args.RedisPubSubWriteArgs)(nil), // 47: protos.args.RedisPubSubWriteArgs + (*args.RedisStreamsConn)(nil), // 48: protos.args.RedisStreamsConn + (*args.RedisStreamsWriteArgs)(nil), // 49: protos.args.RedisStreamsWriteArgs + (*args.AzureEventHubConn)(nil), // 50: protos.args.AzureEventHubConn + (*args.AzureEventHubWriteArgs)(nil), // 51: protos.args.AzureEventHubWriteArgs + (*args.AzureServiceBusConn)(nil), // 52: protos.args.AzureServiceBusConn + (*args.AzureServiceBusWriteArgs)(nil), // 53: protos.args.AzureServiceBusWriteArgs + (*args.MQTTConn)(nil), // 54: protos.args.MQTTConn + (*args.MQTTWriteArgs)(nil), // 55: protos.args.MQTTWriteArgs + (*args.GCPPubSubConn)(nil), // 56: protos.args.GCPPubSubConn + (*args.GCPPubSubWriteArgs)(nil), // 57: protos.args.GCPPubSubWriteArgs + (*args.KubeMQQueueConn)(nil), // 58: protos.args.KubeMQQueueConn + (*args.KubeMQQueueWriteArgs)(nil), // 59: protos.args.KubeMQQueueWriteArgs + (*args.AWSKinesisConn)(nil), // 60: protos.args.AWSKinesisConn + (*args.AWSKinesisWriteArgs)(nil), // 61: protos.args.AWSKinesisWriteArgs + (*args.MemphisConn)(nil), // 62: protos.args.MemphisConn + (*args.MemphisWriteArgs)(nil), // 63: protos.args.MemphisWriteArgs +} +var file_opts_ps_opts_write_proto_depIdxs = []int32{ + 22, // 0: protos.opts.WriteOptions.record:type_name -> protos.records.WriteRecord + 23, // 1: protos.opts.WriteOptions.encode_options:type_name -> protos.encoding.EncodeOptions + 0, // 2: protos.opts.WriteOptions._cli_options:type_name -> protos.opts.WriteCLIOptions + 2, // 3: protos.opts.WriteOptions.kafka:type_name -> protos.opts.WriteGroupKafkaOptions + 3, // 4: protos.opts.WriteOptions.activemq:type_name -> protos.opts.WriteGroupActiveMQOptions + 4, // 5: protos.opts.WriteOptions.aws_sqs:type_name -> protos.opts.WriteGroupAWSSQSOptions + 5, // 6: protos.opts.WriteOptions.aws_sns:type_name -> protos.opts.WriteGroupAWSSNSOptions + 6, // 7: protos.opts.WriteOptions.nats:type_name -> protos.opts.WriteGroupNatsOptions + 8, // 8: protos.opts.WriteOptions.nats_streaming:type_name -> protos.opts.WriteGroupNatsStreamingOptions + 9, // 9: protos.opts.WriteOptions.nsq:type_name -> protos.opts.WriteGroupNSQOptions + 10, // 10: protos.opts.WriteOptions.pulsar:type_name -> protos.opts.WriteGroupPulsarOptions + 11, // 11: protos.opts.WriteOptions.rabbit:type_name -> protos.opts.WriteGroupRabbitOptions + 12, // 12: protos.opts.WriteOptions.rabbit_streams:type_name -> protos.opts.WriteGroupRabbitStreamsOptions + 17, // 13: protos.opts.WriteOptions.mqtt:type_name -> protos.opts.WriteGroupMQTTOptions + 16, // 14: protos.opts.WriteOptions.azure_service_bus:type_name -> protos.opts.WriteGroupAzureServiceBusOptions + 15, // 15: protos.opts.WriteOptions.azure_event_hub:type_name -> protos.opts.WriteGroupAzureEventHubOptions + 18, // 16: protos.opts.WriteOptions.gcp_pubsub:type_name -> protos.opts.WriteGroupGCPPubSubOptions + 19, // 17: protos.opts.WriteOptions.kubemq_queue:type_name -> protos.opts.WriteGroupKubeMQQueueOptions + 13, // 18: protos.opts.WriteOptions.redis_pubsub:type_name -> protos.opts.WriteGroupRedisPubSubOptions + 14, // 19: protos.opts.WriteOptions.redis_streams:type_name -> protos.opts.WriteGroupRedisStreamsOptions + 7, // 20: protos.opts.WriteOptions.nats_jetstream:type_name -> protos.opts.WriteGroupNatsJetstreamOptions + 20, // 21: protos.opts.WriteOptions.aws_kinesis:type_name -> protos.opts.WriteGroupAWSKinesisOptions + 21, // 22: protos.opts.WriteOptions.memphis:type_name -> protos.opts.WriteGroupMemphisOptions + 24, // 23: protos.opts.WriteGroupKafkaOptions._conn:type_name -> protos.args.KafkaConn + 25, // 24: protos.opts.WriteGroupKafkaOptions.args:type_name -> protos.args.KafkaWriteArgs + 26, // 25: protos.opts.WriteGroupActiveMQOptions._conn:type_name -> protos.args.ActiveMQConn + 27, // 26: protos.opts.WriteGroupActiveMQOptions.args:type_name -> protos.args.ActiveMQWriteArgs + 28, // 27: protos.opts.WriteGroupAWSSQSOptions._conn:type_name -> protos.args.AWSSQSConn + 29, // 28: protos.opts.WriteGroupAWSSQSOptions.args:type_name -> protos.args.AWSSQSWriteArgs + 30, // 29: protos.opts.WriteGroupAWSSNSOptions._conn:type_name -> protos.args.AWSSNSConn + 31, // 30: protos.opts.WriteGroupAWSSNSOptions.args:type_name -> protos.args.AWSSNSWriteArgs + 32, // 31: protos.opts.WriteGroupNatsOptions._conn:type_name -> protos.args.NatsConn + 33, // 32: protos.opts.WriteGroupNatsOptions.args:type_name -> protos.args.NatsWriteArgs + 34, // 33: protos.opts.WriteGroupNatsJetstreamOptions._conn:type_name -> protos.args.NatsJetstreamConn + 35, // 34: protos.opts.WriteGroupNatsJetstreamOptions.args:type_name -> protos.args.NatsJetstreamWriteArgs + 36, // 35: protos.opts.WriteGroupNatsStreamingOptions._conn:type_name -> protos.args.NatsStreamingConn + 37, // 36: protos.opts.WriteGroupNatsStreamingOptions.args:type_name -> protos.args.NatsStreamingWriteArgs + 38, // 37: protos.opts.WriteGroupNSQOptions._conn:type_name -> protos.args.NSQConn + 39, // 38: protos.opts.WriteGroupNSQOptions.args:type_name -> protos.args.NSQWriteArgs + 40, // 39: protos.opts.WriteGroupPulsarOptions._conn:type_name -> protos.args.PulsarConn + 41, // 40: protos.opts.WriteGroupPulsarOptions.args:type_name -> protos.args.PulsarWriteArgs + 42, // 41: protos.opts.WriteGroupRabbitOptions._conn:type_name -> protos.args.RabbitConn + 43, // 42: protos.opts.WriteGroupRabbitOptions.args:type_name -> protos.args.RabbitWriteArgs + 44, // 43: protos.opts.WriteGroupRabbitStreamsOptions._conn:type_name -> protos.args.RabbitStreamsConn + 45, // 44: protos.opts.WriteGroupRabbitStreamsOptions.args:type_name -> protos.args.RabbitStreamsWriteArgs + 46, // 45: protos.opts.WriteGroupRedisPubSubOptions._conn:type_name -> protos.args.RedisPubSubConn + 47, // 46: protos.opts.WriteGroupRedisPubSubOptions.args:type_name -> protos.args.RedisPubSubWriteArgs + 48, // 47: protos.opts.WriteGroupRedisStreamsOptions._conn:type_name -> protos.args.RedisStreamsConn + 49, // 48: protos.opts.WriteGroupRedisStreamsOptions.args:type_name -> protos.args.RedisStreamsWriteArgs + 50, // 49: protos.opts.WriteGroupAzureEventHubOptions._conn:type_name -> protos.args.AzureEventHubConn + 51, // 50: protos.opts.WriteGroupAzureEventHubOptions.args:type_name -> protos.args.AzureEventHubWriteArgs + 52, // 51: protos.opts.WriteGroupAzureServiceBusOptions._conn:type_name -> protos.args.AzureServiceBusConn + 53, // 52: protos.opts.WriteGroupAzureServiceBusOptions.args:type_name -> protos.args.AzureServiceBusWriteArgs + 54, // 53: protos.opts.WriteGroupMQTTOptions._conn:type_name -> protos.args.MQTTConn + 55, // 54: protos.opts.WriteGroupMQTTOptions.args:type_name -> protos.args.MQTTWriteArgs + 56, // 55: protos.opts.WriteGroupGCPPubSubOptions._conn:type_name -> protos.args.GCPPubSubConn + 57, // 56: protos.opts.WriteGroupGCPPubSubOptions.args:type_name -> protos.args.GCPPubSubWriteArgs + 58, // 57: protos.opts.WriteGroupKubeMQQueueOptions._conn:type_name -> protos.args.KubeMQQueueConn + 59, // 58: protos.opts.WriteGroupKubeMQQueueOptions.args:type_name -> protos.args.KubeMQQueueWriteArgs + 60, // 59: protos.opts.WriteGroupAWSKinesisOptions._conn:type_name -> protos.args.AWSKinesisConn + 61, // 60: protos.opts.WriteGroupAWSKinesisOptions.args:type_name -> protos.args.AWSKinesisWriteArgs + 62, // 61: protos.opts.WriteGroupMemphisOptions._conn:type_name -> protos.args.MemphisConn + 63, // 62: protos.opts.WriteGroupMemphisOptions.args:type_name -> protos.args.MemphisWriteArgs + 63, // [63:63] is the sub-list for method output_type + 63, // [63:63] is the sub-list for method input_type + 63, // [63:63] is the sub-list for extension type_name + 63, // [63:63] is the sub-list for extension extendee + 0, // [0:63] is the sub-list for field type_name +} + +func init() { file_opts_ps_opts_write_proto_init() } +func file_opts_ps_opts_write_proto_init() { + if File_opts_ps_opts_write_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_opts_ps_opts_write_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteCLIOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_write_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_write_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteGroupKafkaOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_write_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteGroupActiveMQOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_write_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteGroupAWSSQSOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_write_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteGroupAWSSNSOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_write_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteGroupNatsOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_write_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteGroupNatsJetstreamOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_write_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteGroupNatsStreamingOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_write_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteGroupNSQOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_write_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteGroupPulsarOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_write_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteGroupRabbitOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_write_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteGroupRabbitStreamsOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_write_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteGroupRedisPubSubOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_write_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteGroupRedisStreamsOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_write_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteGroupAzureEventHubOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_write_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteGroupAzureServiceBusOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_write_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteGroupMQTTOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_write_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteGroupGCPPubSubOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_write_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteGroupKubeMQQueueOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_write_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteGroupAWSKinesisOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_opts_ps_opts_write_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteGroupMemphisOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_opts_ps_opts_write_proto_rawDesc, + NumEnums: 0, + NumMessages: 22, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_opts_ps_opts_write_proto_goTypes, + DependencyIndexes: file_opts_ps_opts_write_proto_depIdxs, + MessageInfos: file_opts_ps_opts_write_proto_msgTypes, + }.Build() + File_opts_ps_opts_write_proto = out.File + file_opts_ps_opts_write_proto_rawDesc = nil + file_opts_ps_opts_write_proto_goTypes = nil + file_opts_ps_opts_write_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_base.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_base.pb.go index ce0904bfb..56a911a84 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_base.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_base.pb.go @@ -1,875 +1,258 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_base.proto package protos import ( - context "context" - fmt "fmt" - proto "github.com/golang/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -func init() { proto.RegisterFile("ps_base.proto", fileDescriptor_ef931efdbd582aee) } - -var fileDescriptor_ef931efdbd582aee = []byte{ - // 497 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x95, 0x5f, 0x8b, 0xd3, 0x40, - 0x14, 0xc5, 0xdf, 0x44, 0xc7, 0xed, 0xba, 0xce, 0x8b, 0x9a, 0xad, 0xee, 0xfa, 0x01, 0x6c, 0x40, - 0xc5, 0x37, 0xc1, 0xb5, 0x62, 0x10, 0x84, 0x95, 0x6e, 0x0b, 0xe2, 0x4b, 0x48, 0xd2, 0x4b, 0x5b, - 0x98, 0x64, 0xc6, 0xdc, 0x89, 0xe0, 0xc7, 0xf4, 0x1b, 0x49, 0x73, 0x27, 0x9d, 0x7f, 0xc9, 0x3e, - 0x95, 0x9e, 0x73, 0xe7, 0xc7, 0xc9, 0x9c, 0xc9, 0x84, 0xcd, 0x14, 0xe6, 0x65, 0x81, 0xb0, 0x50, - 0xad, 0xd4, 0x92, 0x3f, 0xe8, 0x7f, 0x30, 0xb9, 0x50, 0x98, 0x57, 0xb2, 0x69, 0xa0, 0xd2, 0xe4, - 0x24, 0xe7, 0x0a, 0xf3, 0x16, 0x44, 0xf1, 0xd7, 0xfc, 0x7f, 0xa2, 0x30, 0x47, 0x68, 0xff, 0x40, - 0xeb, 0x08, 0xba, 0x6b, 0x1a, 0x10, 0x24, 0xbc, 0xfd, 0x77, 0xc6, 0x66, 0x3f, 0x44, 0x57, 0x97, - 0xd0, 0xde, 0xf5, 0x83, 0xfc, 0x27, 0x7b, 0x9a, 0x81, 0xbe, 0x11, 0x62, 0x49, 0xe8, 0x83, 0x6c, - 0x90, 0x5f, 0xd3, 0x38, 0x2e, 0x22, 0x6b, 0x05, 0xbf, 0x3b, 0x40, 0x9d, 0xbc, 0xbe, 0x67, 0x02, - 0x95, 0x6c, 0x10, 0xf8, 0x77, 0x36, 0xcb, 0x40, 0x5b, 0x87, 0xcf, 0x9d, 0x35, 0x56, 0x1e, 0x88, - 0x2f, 0x27, 0x5c, 0x43, 0xdb, 0xb0, 0x8b, 0x65, 0x0b, 0x85, 0x06, 0x07, 0x78, 0x35, 0x2c, 0x09, - 0x9d, 0x81, 0x79, 0x3d, 0x3d, 0x60, 0xb0, 0xb7, 0xec, 0x7c, 0x0d, 0xe8, 0xa6, 0x3c, 0xe5, 0xf0, - 0xf5, 0x01, 0xf9, 0x6a, 0xca, 0xb6, 0x39, 0x37, 0x6a, 0x3b, 0x91, 0x33, 0x74, 0xa2, 0x9c, 0xf1, - 0x80, 0xc5, 0x7e, 0x01, 0x01, 0xe3, 0xd8, 0xd0, 0x89, 0xb0, 0xf1, 0x80, 0xc1, 0x7e, 0x63, 0x67, - 0x54, 0xe0, 0xea, 0x78, 0x8c, 0x90, 0x5f, 0xfa, 0xb5, 0x92, 0x3a, 0xe0, 0xe6, 0xe3, 0xa6, 0x41, - 0x7d, 0x64, 0x0f, 0x33, 0xd0, 0xbd, 0xc8, 0x9f, 0x39, 0x93, 0xbd, 0x32, 0x20, 0x9e, 0xc7, 0x86, - 0x59, 0xfe, 0x95, 0x3d, 0xa6, 0x92, 0x88, 0x90, 0xf8, 0xcd, 0x79, 0x90, 0xcb, 0x51, 0xcf, 0x72, - 0x68, 0x13, 0x03, 0x8e, 0x23, 0x46, 0x1c, 0xcf, 0xb3, 0x9c, 0x15, 0x60, 0x57, 0x87, 0x1c, 0x47, - 0x8c, 0x38, 0x9e, 0x67, 0x38, 0x9f, 0xd8, 0xa3, 0x3b, 0x2d, 0x15, 0x51, 0x4e, 0x8f, 0x7f, 0x92, - 0x06, 0xc6, 0x8b, 0x11, 0xc7, 0x26, 0xa1, 0xfe, 0x82, 0x24, 0x8e, 0x18, 0x25, 0xf1, 0x3c, 0x9b, - 0x24, 0x03, 0xbd, 0xee, 0xaf, 0x03, 0xee, 0x16, 0x41, 0x52, 0x94, 0xc4, 0x71, 0xbc, 0x37, 0xfa, - 0x46, 0x08, 0xd2, 0x91, 0x07, 0x27, 0xc2, 0xc8, 0x63, 0x6f, 0xb4, 0xeb, 0xda, 0xb3, 0x47, 0x05, - 0x9a, 0x48, 0x41, 0xad, 0x7e, 0xaa, 0xf9, 0xb8, 0x69, 0x50, 0x4b, 0xc6, 0x8e, 0xfb, 0x66, 0x40, - 0xde, 0x5e, 0xfa, 0x98, 0x64, 0xcc, 0xb2, 0x79, 0xa8, 0xc0, 0x30, 0x8f, 0xab, 0x46, 0x79, 0x7c, - 0xd3, 0xa2, 0xe8, 0x4c, 0x85, 0x28, 0x57, 0x8d, 0x50, 0xbe, 0x69, 0x51, 0x54, 0x66, 0x88, 0x72, - 0xd5, 0x08, 0xe5, 0x9b, 0xf6, 0x0e, 0xc9, 0x40, 0xd3, 0xbd, 0x7f, 0xab, 0xe8, 0xa6, 0xbf, 0x72, - 0x3a, 0xf2, 0x9c, 0xe8, 0x0e, 0x89, 0x07, 0x08, 0xfb, 0xf9, 0xc3, 0xaf, 0xf7, 0xbb, 0x83, 0xde, - 0x77, 0xe5, 0xa2, 0x92, 0x75, 0x5a, 0x16, 0xba, 0xda, 0x57, 0xb2, 0x55, 0xa9, 0xa2, 0xef, 0xcc, - 0x1b, 0xac, 0xf6, 0x50, 0x17, 0x98, 0x96, 0xdd, 0x41, 0x6c, 0xd3, 0x9d, 0x4c, 0x09, 0x58, 0xd2, - 0x77, 0xed, 0xdd, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4b, 0x41, 0x19, 0x8b, 0xef, 0x06, 0x00, - 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// PlumberServerClient is the client API for PlumberServer service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type PlumberServerClient interface { - // List configured/known connections - GetAllConnections(ctx context.Context, in *GetAllConnectionsRequest, opts ...grpc.CallOption) (*GetAllConnectionsResponse, error) - // Fetch a specific connection by ID - GetConnection(ctx context.Context, in *GetConnectionRequest, opts ...grpc.CallOption) (*GetConnectionResponse, error) - // Create a connection in plumber - CreateConnection(ctx context.Context, in *CreateConnectionRequest, opts ...grpc.CallOption) (*CreateConnectionResponse, error) - // Test a connection before saving its configuration - TestConnection(ctx context.Context, in *TestConnectionRequest, opts ...grpc.CallOption) (*TestConnectionResponse, error) - // Any active connections will be restarted - UpdateConnection(ctx context.Context, in *UpdateConnectionRequest, opts ...grpc.CallOption) (*UpdateConnectionResponse, error) - // If there are any active connections, delete will cause them to get closed - DeleteConnection(ctx context.Context, in *DeleteConnectionRequest, opts ...grpc.CallOption) (*DeleteConnectionResponse, error) - GetAllRelays(ctx context.Context, in *GetAllRelaysRequest, opts ...grpc.CallOption) (*GetAllRelaysResponse, error) - GetRelay(ctx context.Context, in *GetRelayRequest, opts ...grpc.CallOption) (*GetRelayResponse, error) - CreateRelay(ctx context.Context, in *CreateRelayRequest, opts ...grpc.CallOption) (*CreateRelayResponse, error) - UpdateRelay(ctx context.Context, in *UpdateRelayRequest, opts ...grpc.CallOption) (*UpdateRelayResponse, error) - ResumeRelay(ctx context.Context, in *ResumeRelayRequest, opts ...grpc.CallOption) (*ResumeRelayResponse, error) - StopRelay(ctx context.Context, in *StopRelayRequest, opts ...grpc.CallOption) (*StopRelayResponse, error) - DeleteRelay(ctx context.Context, in *DeleteRelayRequest, opts ...grpc.CallOption) (*DeleteRelayResponse, error) - GetTunnel(ctx context.Context, in *GetTunnelRequest, opts ...grpc.CallOption) (*GetTunnelResponse, error) - GetAllTunnels(ctx context.Context, in *GetAllTunnelsRequest, opts ...grpc.CallOption) (*GetAllTunnelsResponse, error) - CreateTunnel(ctx context.Context, in *CreateTunnelRequest, opts ...grpc.CallOption) (*CreateTunnelResponse, error) - StopTunnel(ctx context.Context, in *StopTunnelRequest, opts ...grpc.CallOption) (*StopTunnelResponse, error) - ResumeTunnel(ctx context.Context, in *ResumeTunnelRequest, opts ...grpc.CallOption) (*ResumeTunnelResponse, error) - UpdateTunnel(ctx context.Context, in *UpdateTunnelRequest, opts ...grpc.CallOption) (*UpdateTunnelResponse, error) - DeleteTunnel(ctx context.Context, in *DeleteTunnelRequest, opts ...grpc.CallOption) (*DeleteTunnelResponse, error) - GetServerOptions(ctx context.Context, in *GetServerOptionsRequest, opts ...grpc.CallOption) (*GetServerOptionsResponse, error) -} - -type plumberServerClient struct { - cc *grpc.ClientConn -} - -func NewPlumberServerClient(cc *grpc.ClientConn) PlumberServerClient { - return &plumberServerClient{cc} -} - -func (c *plumberServerClient) GetAllConnections(ctx context.Context, in *GetAllConnectionsRequest, opts ...grpc.CallOption) (*GetAllConnectionsResponse, error) { - out := new(GetAllConnectionsResponse) - err := c.cc.Invoke(ctx, "/protos.PlumberServer/GetAllConnections", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *plumberServerClient) GetConnection(ctx context.Context, in *GetConnectionRequest, opts ...grpc.CallOption) (*GetConnectionResponse, error) { - out := new(GetConnectionResponse) - err := c.cc.Invoke(ctx, "/protos.PlumberServer/GetConnection", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *plumberServerClient) CreateConnection(ctx context.Context, in *CreateConnectionRequest, opts ...grpc.CallOption) (*CreateConnectionResponse, error) { - out := new(CreateConnectionResponse) - err := c.cc.Invoke(ctx, "/protos.PlumberServer/CreateConnection", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *plumberServerClient) TestConnection(ctx context.Context, in *TestConnectionRequest, opts ...grpc.CallOption) (*TestConnectionResponse, error) { - out := new(TestConnectionResponse) - err := c.cc.Invoke(ctx, "/protos.PlumberServer/TestConnection", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *plumberServerClient) UpdateConnection(ctx context.Context, in *UpdateConnectionRequest, opts ...grpc.CallOption) (*UpdateConnectionResponse, error) { - out := new(UpdateConnectionResponse) - err := c.cc.Invoke(ctx, "/protos.PlumberServer/UpdateConnection", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *plumberServerClient) DeleteConnection(ctx context.Context, in *DeleteConnectionRequest, opts ...grpc.CallOption) (*DeleteConnectionResponse, error) { - out := new(DeleteConnectionResponse) - err := c.cc.Invoke(ctx, "/protos.PlumberServer/DeleteConnection", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *plumberServerClient) GetAllRelays(ctx context.Context, in *GetAllRelaysRequest, opts ...grpc.CallOption) (*GetAllRelaysResponse, error) { - out := new(GetAllRelaysResponse) - err := c.cc.Invoke(ctx, "/protos.PlumberServer/GetAllRelays", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *plumberServerClient) GetRelay(ctx context.Context, in *GetRelayRequest, opts ...grpc.CallOption) (*GetRelayResponse, error) { - out := new(GetRelayResponse) - err := c.cc.Invoke(ctx, "/protos.PlumberServer/GetRelay", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *plumberServerClient) CreateRelay(ctx context.Context, in *CreateRelayRequest, opts ...grpc.CallOption) (*CreateRelayResponse, error) { - out := new(CreateRelayResponse) - err := c.cc.Invoke(ctx, "/protos.PlumberServer/CreateRelay", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *plumberServerClient) UpdateRelay(ctx context.Context, in *UpdateRelayRequest, opts ...grpc.CallOption) (*UpdateRelayResponse, error) { - out := new(UpdateRelayResponse) - err := c.cc.Invoke(ctx, "/protos.PlumberServer/UpdateRelay", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *plumberServerClient) ResumeRelay(ctx context.Context, in *ResumeRelayRequest, opts ...grpc.CallOption) (*ResumeRelayResponse, error) { - out := new(ResumeRelayResponse) - err := c.cc.Invoke(ctx, "/protos.PlumberServer/ResumeRelay", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *plumberServerClient) StopRelay(ctx context.Context, in *StopRelayRequest, opts ...grpc.CallOption) (*StopRelayResponse, error) { - out := new(StopRelayResponse) - err := c.cc.Invoke(ctx, "/protos.PlumberServer/StopRelay", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *plumberServerClient) DeleteRelay(ctx context.Context, in *DeleteRelayRequest, opts ...grpc.CallOption) (*DeleteRelayResponse, error) { - out := new(DeleteRelayResponse) - err := c.cc.Invoke(ctx, "/protos.PlumberServer/DeleteRelay", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *plumberServerClient) GetTunnel(ctx context.Context, in *GetTunnelRequest, opts ...grpc.CallOption) (*GetTunnelResponse, error) { - out := new(GetTunnelResponse) - err := c.cc.Invoke(ctx, "/protos.PlumberServer/GetTunnel", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *plumberServerClient) GetAllTunnels(ctx context.Context, in *GetAllTunnelsRequest, opts ...grpc.CallOption) (*GetAllTunnelsResponse, error) { - out := new(GetAllTunnelsResponse) - err := c.cc.Invoke(ctx, "/protos.PlumberServer/GetAllTunnels", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *plumberServerClient) CreateTunnel(ctx context.Context, in *CreateTunnelRequest, opts ...grpc.CallOption) (*CreateTunnelResponse, error) { - out := new(CreateTunnelResponse) - err := c.cc.Invoke(ctx, "/protos.PlumberServer/CreateTunnel", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *plumberServerClient) StopTunnel(ctx context.Context, in *StopTunnelRequest, opts ...grpc.CallOption) (*StopTunnelResponse, error) { - out := new(StopTunnelResponse) - err := c.cc.Invoke(ctx, "/protos.PlumberServer/StopTunnel", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *plumberServerClient) ResumeTunnel(ctx context.Context, in *ResumeTunnelRequest, opts ...grpc.CallOption) (*ResumeTunnelResponse, error) { - out := new(ResumeTunnelResponse) - err := c.cc.Invoke(ctx, "/protos.PlumberServer/ResumeTunnel", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *plumberServerClient) UpdateTunnel(ctx context.Context, in *UpdateTunnelRequest, opts ...grpc.CallOption) (*UpdateTunnelResponse, error) { - out := new(UpdateTunnelResponse) - err := c.cc.Invoke(ctx, "/protos.PlumberServer/UpdateTunnel", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *plumberServerClient) DeleteTunnel(ctx context.Context, in *DeleteTunnelRequest, opts ...grpc.CallOption) (*DeleteTunnelResponse, error) { - out := new(DeleteTunnelResponse) - err := c.cc.Invoke(ctx, "/protos.PlumberServer/DeleteTunnel", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *plumberServerClient) GetServerOptions(ctx context.Context, in *GetServerOptionsRequest, opts ...grpc.CallOption) (*GetServerOptionsResponse, error) { - out := new(GetServerOptionsResponse) - err := c.cc.Invoke(ctx, "/protos.PlumberServer/GetServerOptions", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// PlumberServerServer is the server API for PlumberServer service. -type PlumberServerServer interface { - // List configured/known connections - GetAllConnections(context.Context, *GetAllConnectionsRequest) (*GetAllConnectionsResponse, error) - // Fetch a specific connection by ID - GetConnection(context.Context, *GetConnectionRequest) (*GetConnectionResponse, error) - // Create a connection in plumber - CreateConnection(context.Context, *CreateConnectionRequest) (*CreateConnectionResponse, error) - // Test a connection before saving its configuration - TestConnection(context.Context, *TestConnectionRequest) (*TestConnectionResponse, error) - // Any active connections will be restarted - UpdateConnection(context.Context, *UpdateConnectionRequest) (*UpdateConnectionResponse, error) - // If there are any active connections, delete will cause them to get closed - DeleteConnection(context.Context, *DeleteConnectionRequest) (*DeleteConnectionResponse, error) - GetAllRelays(context.Context, *GetAllRelaysRequest) (*GetAllRelaysResponse, error) - GetRelay(context.Context, *GetRelayRequest) (*GetRelayResponse, error) - CreateRelay(context.Context, *CreateRelayRequest) (*CreateRelayResponse, error) - UpdateRelay(context.Context, *UpdateRelayRequest) (*UpdateRelayResponse, error) - ResumeRelay(context.Context, *ResumeRelayRequest) (*ResumeRelayResponse, error) - StopRelay(context.Context, *StopRelayRequest) (*StopRelayResponse, error) - DeleteRelay(context.Context, *DeleteRelayRequest) (*DeleteRelayResponse, error) - GetTunnel(context.Context, *GetTunnelRequest) (*GetTunnelResponse, error) - GetAllTunnels(context.Context, *GetAllTunnelsRequest) (*GetAllTunnelsResponse, error) - CreateTunnel(context.Context, *CreateTunnelRequest) (*CreateTunnelResponse, error) - StopTunnel(context.Context, *StopTunnelRequest) (*StopTunnelResponse, error) - ResumeTunnel(context.Context, *ResumeTunnelRequest) (*ResumeTunnelResponse, error) - UpdateTunnel(context.Context, *UpdateTunnelRequest) (*UpdateTunnelResponse, error) - DeleteTunnel(context.Context, *DeleteTunnelRequest) (*DeleteTunnelResponse, error) - GetServerOptions(context.Context, *GetServerOptionsRequest) (*GetServerOptionsResponse, error) -} - -// UnimplementedPlumberServerServer can be embedded to have forward compatible implementations. -type UnimplementedPlumberServerServer struct { -} - -func (*UnimplementedPlumberServerServer) GetAllConnections(ctx context.Context, req *GetAllConnectionsRequest) (*GetAllConnectionsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAllConnections not implemented") -} -func (*UnimplementedPlumberServerServer) GetConnection(ctx context.Context, req *GetConnectionRequest) (*GetConnectionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetConnection not implemented") -} -func (*UnimplementedPlumberServerServer) CreateConnection(ctx context.Context, req *CreateConnectionRequest) (*CreateConnectionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateConnection not implemented") -} -func (*UnimplementedPlumberServerServer) TestConnection(ctx context.Context, req *TestConnectionRequest) (*TestConnectionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method TestConnection not implemented") -} -func (*UnimplementedPlumberServerServer) UpdateConnection(ctx context.Context, req *UpdateConnectionRequest) (*UpdateConnectionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateConnection not implemented") -} -func (*UnimplementedPlumberServerServer) DeleteConnection(ctx context.Context, req *DeleteConnectionRequest) (*DeleteConnectionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteConnection not implemented") -} -func (*UnimplementedPlumberServerServer) GetAllRelays(ctx context.Context, req *GetAllRelaysRequest) (*GetAllRelaysResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAllRelays not implemented") -} -func (*UnimplementedPlumberServerServer) GetRelay(ctx context.Context, req *GetRelayRequest) (*GetRelayResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetRelay not implemented") -} -func (*UnimplementedPlumberServerServer) CreateRelay(ctx context.Context, req *CreateRelayRequest) (*CreateRelayResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateRelay not implemented") -} -func (*UnimplementedPlumberServerServer) UpdateRelay(ctx context.Context, req *UpdateRelayRequest) (*UpdateRelayResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateRelay not implemented") -} -func (*UnimplementedPlumberServerServer) ResumeRelay(ctx context.Context, req *ResumeRelayRequest) (*ResumeRelayResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ResumeRelay not implemented") -} -func (*UnimplementedPlumberServerServer) StopRelay(ctx context.Context, req *StopRelayRequest) (*StopRelayResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method StopRelay not implemented") -} -func (*UnimplementedPlumberServerServer) DeleteRelay(ctx context.Context, req *DeleteRelayRequest) (*DeleteRelayResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteRelay not implemented") -} -func (*UnimplementedPlumberServerServer) GetTunnel(ctx context.Context, req *GetTunnelRequest) (*GetTunnelResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetTunnel not implemented") -} -func (*UnimplementedPlumberServerServer) GetAllTunnels(ctx context.Context, req *GetAllTunnelsRequest) (*GetAllTunnelsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAllTunnels not implemented") -} -func (*UnimplementedPlumberServerServer) CreateTunnel(ctx context.Context, req *CreateTunnelRequest) (*CreateTunnelResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateTunnel not implemented") -} -func (*UnimplementedPlumberServerServer) StopTunnel(ctx context.Context, req *StopTunnelRequest) (*StopTunnelResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method StopTunnel not implemented") -} -func (*UnimplementedPlumberServerServer) ResumeTunnel(ctx context.Context, req *ResumeTunnelRequest) (*ResumeTunnelResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ResumeTunnel not implemented") -} -func (*UnimplementedPlumberServerServer) UpdateTunnel(ctx context.Context, req *UpdateTunnelRequest) (*UpdateTunnelResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateTunnel not implemented") -} -func (*UnimplementedPlumberServerServer) DeleteTunnel(ctx context.Context, req *DeleteTunnelRequest) (*DeleteTunnelResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteTunnel not implemented") -} -func (*UnimplementedPlumberServerServer) GetServerOptions(ctx context.Context, req *GetServerOptionsRequest) (*GetServerOptionsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetServerOptions not implemented") -} - -func RegisterPlumberServerServer(s *grpc.Server, srv PlumberServerServer) { - s.RegisterService(&_PlumberServer_serviceDesc, srv) -} - -func _PlumberServer_GetAllConnections_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetAllConnectionsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlumberServerServer).GetAllConnections(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.PlumberServer/GetAllConnections", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlumberServerServer).GetAllConnections(ctx, req.(*GetAllConnectionsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _PlumberServer_GetConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetConnectionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlumberServerServer).GetConnection(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.PlumberServer/GetConnection", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlumberServerServer).GetConnection(ctx, req.(*GetConnectionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _PlumberServer_CreateConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateConnectionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlumberServerServer).CreateConnection(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.PlumberServer/CreateConnection", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlumberServerServer).CreateConnection(ctx, req.(*CreateConnectionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _PlumberServer_TestConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(TestConnectionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlumberServerServer).TestConnection(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.PlumberServer/TestConnection", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlumberServerServer).TestConnection(ctx, req.(*TestConnectionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _PlumberServer_UpdateConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateConnectionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlumberServerServer).UpdateConnection(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.PlumberServer/UpdateConnection", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlumberServerServer).UpdateConnection(ctx, req.(*UpdateConnectionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _PlumberServer_DeleteConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteConnectionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlumberServerServer).DeleteConnection(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.PlumberServer/DeleteConnection", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlumberServerServer).DeleteConnection(ctx, req.(*DeleteConnectionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _PlumberServer_GetAllRelays_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetAllRelaysRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlumberServerServer).GetAllRelays(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.PlumberServer/GetAllRelays", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlumberServerServer).GetAllRelays(ctx, req.(*GetAllRelaysRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _PlumberServer_GetRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetRelayRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlumberServerServer).GetRelay(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.PlumberServer/GetRelay", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlumberServerServer).GetRelay(ctx, req.(*GetRelayRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _PlumberServer_CreateRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateRelayRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlumberServerServer).CreateRelay(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.PlumberServer/CreateRelay", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlumberServerServer).CreateRelay(ctx, req.(*CreateRelayRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _PlumberServer_UpdateRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateRelayRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlumberServerServer).UpdateRelay(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.PlumberServer/UpdateRelay", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlumberServerServer).UpdateRelay(ctx, req.(*UpdateRelayRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _PlumberServer_ResumeRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ResumeRelayRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlumberServerServer).ResumeRelay(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.PlumberServer/ResumeRelay", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlumberServerServer).ResumeRelay(ctx, req.(*ResumeRelayRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _PlumberServer_StopRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StopRelayRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlumberServerServer).StopRelay(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.PlumberServer/StopRelay", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlumberServerServer).StopRelay(ctx, req.(*StopRelayRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _PlumberServer_DeleteRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteRelayRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlumberServerServer).DeleteRelay(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.PlumberServer/DeleteRelay", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlumberServerServer).DeleteRelay(ctx, req.(*DeleteRelayRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _PlumberServer_GetTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetTunnelRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlumberServerServer).GetTunnel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.PlumberServer/GetTunnel", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlumberServerServer).GetTunnel(ctx, req.(*GetTunnelRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _PlumberServer_GetAllTunnels_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetAllTunnelsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlumberServerServer).GetAllTunnels(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.PlumberServer/GetAllTunnels", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlumberServerServer).GetAllTunnels(ctx, req.(*GetAllTunnelsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _PlumberServer_CreateTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateTunnelRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlumberServerServer).CreateTunnel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.PlumberServer/CreateTunnel", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlumberServerServer).CreateTunnel(ctx, req.(*CreateTunnelRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _PlumberServer_StopTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StopTunnelRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlumberServerServer).StopTunnel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.PlumberServer/StopTunnel", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlumberServerServer).StopTunnel(ctx, req.(*StopTunnelRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _PlumberServer_ResumeTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ResumeTunnelRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlumberServerServer).ResumeTunnel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.PlumberServer/ResumeTunnel", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlumberServerServer).ResumeTunnel(ctx, req.(*ResumeTunnelRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _PlumberServer_UpdateTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateTunnelRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlumberServerServer).UpdateTunnel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.PlumberServer/UpdateTunnel", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlumberServerServer).UpdateTunnel(ctx, req.(*UpdateTunnelRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _PlumberServer_DeleteTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteTunnelRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlumberServerServer).DeleteTunnel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.PlumberServer/DeleteTunnel", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlumberServerServer).DeleteTunnel(ctx, req.(*DeleteTunnelRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _PlumberServer_GetServerOptions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetServerOptionsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlumberServerServer).GetServerOptions(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.PlumberServer/GetServerOptions", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlumberServerServer).GetServerOptions(ctx, req.(*GetServerOptionsRequest)) - } - return interceptor(ctx, in, info, handler) -} +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -var _PlumberServer_serviceDesc = grpc.ServiceDesc{ - ServiceName: "protos.PlumberServer", - HandlerType: (*PlumberServerServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetAllConnections", - Handler: _PlumberServer_GetAllConnections_Handler, - }, - { - MethodName: "GetConnection", - Handler: _PlumberServer_GetConnection_Handler, - }, - { - MethodName: "CreateConnection", - Handler: _PlumberServer_CreateConnection_Handler, - }, - { - MethodName: "TestConnection", - Handler: _PlumberServer_TestConnection_Handler, - }, - { - MethodName: "UpdateConnection", - Handler: _PlumberServer_UpdateConnection_Handler, - }, - { - MethodName: "DeleteConnection", - Handler: _PlumberServer_DeleteConnection_Handler, - }, - { - MethodName: "GetAllRelays", - Handler: _PlumberServer_GetAllRelays_Handler, - }, - { - MethodName: "GetRelay", - Handler: _PlumberServer_GetRelay_Handler, - }, - { - MethodName: "CreateRelay", - Handler: _PlumberServer_CreateRelay_Handler, - }, - { - MethodName: "UpdateRelay", - Handler: _PlumberServer_UpdateRelay_Handler, - }, - { - MethodName: "ResumeRelay", - Handler: _PlumberServer_ResumeRelay_Handler, - }, - { - MethodName: "StopRelay", - Handler: _PlumberServer_StopRelay_Handler, - }, - { - MethodName: "DeleteRelay", - Handler: _PlumberServer_DeleteRelay_Handler, - }, - { - MethodName: "GetTunnel", - Handler: _PlumberServer_GetTunnel_Handler, - }, - { - MethodName: "GetAllTunnels", - Handler: _PlumberServer_GetAllTunnels_Handler, - }, - { - MethodName: "CreateTunnel", - Handler: _PlumberServer_CreateTunnel_Handler, - }, - { - MethodName: "StopTunnel", - Handler: _PlumberServer_StopTunnel_Handler, - }, - { - MethodName: "ResumeTunnel", - Handler: _PlumberServer_ResumeTunnel_Handler, - }, - { - MethodName: "UpdateTunnel", - Handler: _PlumberServer_UpdateTunnel_Handler, - }, - { - MethodName: "DeleteTunnel", - Handler: _PlumberServer_DeleteTunnel_Handler, - }, - { - MethodName: "GetServerOptions", - Handler: _PlumberServer_GetServerOptions_Handler, +var File_ps_base_proto protoreflect.FileDescriptor + +var file_ps_base_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x70, 0x73, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x1a, 0x10, 0x70, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0e, 0x70, 0x73, 0x5f, 0x72, 0x65, + 0x6c, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x70, 0x73, 0x5f, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x70, 0x73, 0x5f, 0x74, + 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xd1, 0x0c, 0x0a, 0x0d, + 0x50, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x58, 0x0a, + 0x11, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x41, + 0x6c, 0x6c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, + 0x74, 0x41, 0x6c, 0x6c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x43, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x0e, + 0x54, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, + 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0c, 0x47, + 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x1b, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x61, 0x79, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3d, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, + 0x61, 0x79, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x52, + 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x6c, 0x61, 0x79, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, + 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x1a, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x6c, 0x61, + 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x0b, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x52, + 0x65, 0x6c, 0x61, 0x79, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x52, 0x65, + 0x73, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, + 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, + 0x09, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, + 0x6f, 0x70, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x46, 0x0a, 0x0b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x1a, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, + 0x6c, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x54, 0x75, + 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, + 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, + 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x0d, 0x47, 0x65, 0x74, + 0x41, 0x6c, 0x6c, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x12, 0x1c, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x43, 0x0a, 0x0a, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, + 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x75, + 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x75, 0x6d, + 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x52, 0x65, + 0x73, 0x75, 0x6d, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, + 0x65, 0x6c, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, + 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, + 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x1b, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x75, 0x6e, + 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x53, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1f, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, + 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, + 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var file_ps_base_proto_goTypes = []interface{}{ + (*GetAllConnectionsRequest)(nil), // 0: protos.GetAllConnectionsRequest + (*GetConnectionRequest)(nil), // 1: protos.GetConnectionRequest + (*CreateConnectionRequest)(nil), // 2: protos.CreateConnectionRequest + (*TestConnectionRequest)(nil), // 3: protos.TestConnectionRequest + (*UpdateConnectionRequest)(nil), // 4: protos.UpdateConnectionRequest + (*DeleteConnectionRequest)(nil), // 5: protos.DeleteConnectionRequest + (*GetAllRelaysRequest)(nil), // 6: protos.GetAllRelaysRequest + (*GetRelayRequest)(nil), // 7: protos.GetRelayRequest + (*CreateRelayRequest)(nil), // 8: protos.CreateRelayRequest + (*UpdateRelayRequest)(nil), // 9: protos.UpdateRelayRequest + (*ResumeRelayRequest)(nil), // 10: protos.ResumeRelayRequest + (*StopRelayRequest)(nil), // 11: protos.StopRelayRequest + (*DeleteRelayRequest)(nil), // 12: protos.DeleteRelayRequest + (*GetTunnelRequest)(nil), // 13: protos.GetTunnelRequest + (*GetAllTunnelsRequest)(nil), // 14: protos.GetAllTunnelsRequest + (*CreateTunnelRequest)(nil), // 15: protos.CreateTunnelRequest + (*StopTunnelRequest)(nil), // 16: protos.StopTunnelRequest + (*ResumeTunnelRequest)(nil), // 17: protos.ResumeTunnelRequest + (*UpdateTunnelRequest)(nil), // 18: protos.UpdateTunnelRequest + (*DeleteTunnelRequest)(nil), // 19: protos.DeleteTunnelRequest + (*GetServerOptionsRequest)(nil), // 20: protos.GetServerOptionsRequest + (*GetAllConnectionsResponse)(nil), // 21: protos.GetAllConnectionsResponse + (*GetConnectionResponse)(nil), // 22: protos.GetConnectionResponse + (*CreateConnectionResponse)(nil), // 23: protos.CreateConnectionResponse + (*TestConnectionResponse)(nil), // 24: protos.TestConnectionResponse + (*UpdateConnectionResponse)(nil), // 25: protos.UpdateConnectionResponse + (*DeleteConnectionResponse)(nil), // 26: protos.DeleteConnectionResponse + (*GetAllRelaysResponse)(nil), // 27: protos.GetAllRelaysResponse + (*GetRelayResponse)(nil), // 28: protos.GetRelayResponse + (*CreateRelayResponse)(nil), // 29: protos.CreateRelayResponse + (*UpdateRelayResponse)(nil), // 30: protos.UpdateRelayResponse + (*ResumeRelayResponse)(nil), // 31: protos.ResumeRelayResponse + (*StopRelayResponse)(nil), // 32: protos.StopRelayResponse + (*DeleteRelayResponse)(nil), // 33: protos.DeleteRelayResponse + (*GetTunnelResponse)(nil), // 34: protos.GetTunnelResponse + (*GetAllTunnelsResponse)(nil), // 35: protos.GetAllTunnelsResponse + (*CreateTunnelResponse)(nil), // 36: protos.CreateTunnelResponse + (*StopTunnelResponse)(nil), // 37: protos.StopTunnelResponse + (*ResumeTunnelResponse)(nil), // 38: protos.ResumeTunnelResponse + (*UpdateTunnelResponse)(nil), // 39: protos.UpdateTunnelResponse + (*DeleteTunnelResponse)(nil), // 40: protos.DeleteTunnelResponse + (*GetServerOptionsResponse)(nil), // 41: protos.GetServerOptionsResponse +} +var file_ps_base_proto_depIdxs = []int32{ + 0, // 0: protos.PlumberServer.GetAllConnections:input_type -> protos.GetAllConnectionsRequest + 1, // 1: protos.PlumberServer.GetConnection:input_type -> protos.GetConnectionRequest + 2, // 2: protos.PlumberServer.CreateConnection:input_type -> protos.CreateConnectionRequest + 3, // 3: protos.PlumberServer.TestConnection:input_type -> protos.TestConnectionRequest + 4, // 4: protos.PlumberServer.UpdateConnection:input_type -> protos.UpdateConnectionRequest + 5, // 5: protos.PlumberServer.DeleteConnection:input_type -> protos.DeleteConnectionRequest + 6, // 6: protos.PlumberServer.GetAllRelays:input_type -> protos.GetAllRelaysRequest + 7, // 7: protos.PlumberServer.GetRelay:input_type -> protos.GetRelayRequest + 8, // 8: protos.PlumberServer.CreateRelay:input_type -> protos.CreateRelayRequest + 9, // 9: protos.PlumberServer.UpdateRelay:input_type -> protos.UpdateRelayRequest + 10, // 10: protos.PlumberServer.ResumeRelay:input_type -> protos.ResumeRelayRequest + 11, // 11: protos.PlumberServer.StopRelay:input_type -> protos.StopRelayRequest + 12, // 12: protos.PlumberServer.DeleteRelay:input_type -> protos.DeleteRelayRequest + 13, // 13: protos.PlumberServer.GetTunnel:input_type -> protos.GetTunnelRequest + 14, // 14: protos.PlumberServer.GetAllTunnels:input_type -> protos.GetAllTunnelsRequest + 15, // 15: protos.PlumberServer.CreateTunnel:input_type -> protos.CreateTunnelRequest + 16, // 16: protos.PlumberServer.StopTunnel:input_type -> protos.StopTunnelRequest + 17, // 17: protos.PlumberServer.ResumeTunnel:input_type -> protos.ResumeTunnelRequest + 18, // 18: protos.PlumberServer.UpdateTunnel:input_type -> protos.UpdateTunnelRequest + 19, // 19: protos.PlumberServer.DeleteTunnel:input_type -> protos.DeleteTunnelRequest + 20, // 20: protos.PlumberServer.GetServerOptions:input_type -> protos.GetServerOptionsRequest + 21, // 21: protos.PlumberServer.GetAllConnections:output_type -> protos.GetAllConnectionsResponse + 22, // 22: protos.PlumberServer.GetConnection:output_type -> protos.GetConnectionResponse + 23, // 23: protos.PlumberServer.CreateConnection:output_type -> protos.CreateConnectionResponse + 24, // 24: protos.PlumberServer.TestConnection:output_type -> protos.TestConnectionResponse + 25, // 25: protos.PlumberServer.UpdateConnection:output_type -> protos.UpdateConnectionResponse + 26, // 26: protos.PlumberServer.DeleteConnection:output_type -> protos.DeleteConnectionResponse + 27, // 27: protos.PlumberServer.GetAllRelays:output_type -> protos.GetAllRelaysResponse + 28, // 28: protos.PlumberServer.GetRelay:output_type -> protos.GetRelayResponse + 29, // 29: protos.PlumberServer.CreateRelay:output_type -> protos.CreateRelayResponse + 30, // 30: protos.PlumberServer.UpdateRelay:output_type -> protos.UpdateRelayResponse + 31, // 31: protos.PlumberServer.ResumeRelay:output_type -> protos.ResumeRelayResponse + 32, // 32: protos.PlumberServer.StopRelay:output_type -> protos.StopRelayResponse + 33, // 33: protos.PlumberServer.DeleteRelay:output_type -> protos.DeleteRelayResponse + 34, // 34: protos.PlumberServer.GetTunnel:output_type -> protos.GetTunnelResponse + 35, // 35: protos.PlumberServer.GetAllTunnels:output_type -> protos.GetAllTunnelsResponse + 36, // 36: protos.PlumberServer.CreateTunnel:output_type -> protos.CreateTunnelResponse + 37, // 37: protos.PlumberServer.StopTunnel:output_type -> protos.StopTunnelResponse + 38, // 38: protos.PlumberServer.ResumeTunnel:output_type -> protos.ResumeTunnelResponse + 39, // 39: protos.PlumberServer.UpdateTunnel:output_type -> protos.UpdateTunnelResponse + 40, // 40: protos.PlumberServer.DeleteTunnel:output_type -> protos.DeleteTunnelResponse + 41, // 41: protos.PlumberServer.GetServerOptions:output_type -> protos.GetServerOptionsResponse + 21, // [21:42] is the sub-list for method output_type + 0, // [0:21] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_ps_base_proto_init() } +func file_ps_base_proto_init() { + if File_ps_base_proto != nil { + return + } + file_ps_connect_proto_init() + file_ps_relay_proto_init() + file_ps_server_proto_init() + file_ps_tunnel_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_base_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 1, }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "ps_base.proto", + GoTypes: file_ps_base_proto_goTypes, + DependencyIndexes: file_ps_base_proto_depIdxs, + }.Build() + File_ps_base_proto = out.File + file_ps_base_proto_rawDesc = nil + file_ps_base_proto_goTypes = nil + file_ps_base_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_base_grpc.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_base_grpc.pb.go new file mode 100644 index 000000000..20e148f14 --- /dev/null +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_base_grpc.pb.go @@ -0,0 +1,835 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.6 +// source: ps_base.proto + +package protos + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// PlumberServerClient is the client API for PlumberServer service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type PlumberServerClient interface { + // List configured/known connections + GetAllConnections(ctx context.Context, in *GetAllConnectionsRequest, opts ...grpc.CallOption) (*GetAllConnectionsResponse, error) + // Fetch a specific connection by ID + GetConnection(ctx context.Context, in *GetConnectionRequest, opts ...grpc.CallOption) (*GetConnectionResponse, error) + // Create a connection in plumber + CreateConnection(ctx context.Context, in *CreateConnectionRequest, opts ...grpc.CallOption) (*CreateConnectionResponse, error) + // Test a connection before saving its configuration + TestConnection(ctx context.Context, in *TestConnectionRequest, opts ...grpc.CallOption) (*TestConnectionResponse, error) + // Any active connections will be restarted + UpdateConnection(ctx context.Context, in *UpdateConnectionRequest, opts ...grpc.CallOption) (*UpdateConnectionResponse, error) + // If there are any active connections, delete will cause them to get closed + DeleteConnection(ctx context.Context, in *DeleteConnectionRequest, opts ...grpc.CallOption) (*DeleteConnectionResponse, error) + GetAllRelays(ctx context.Context, in *GetAllRelaysRequest, opts ...grpc.CallOption) (*GetAllRelaysResponse, error) + GetRelay(ctx context.Context, in *GetRelayRequest, opts ...grpc.CallOption) (*GetRelayResponse, error) + CreateRelay(ctx context.Context, in *CreateRelayRequest, opts ...grpc.CallOption) (*CreateRelayResponse, error) + UpdateRelay(ctx context.Context, in *UpdateRelayRequest, opts ...grpc.CallOption) (*UpdateRelayResponse, error) + ResumeRelay(ctx context.Context, in *ResumeRelayRequest, opts ...grpc.CallOption) (*ResumeRelayResponse, error) + StopRelay(ctx context.Context, in *StopRelayRequest, opts ...grpc.CallOption) (*StopRelayResponse, error) + DeleteRelay(ctx context.Context, in *DeleteRelayRequest, opts ...grpc.CallOption) (*DeleteRelayResponse, error) + GetTunnel(ctx context.Context, in *GetTunnelRequest, opts ...grpc.CallOption) (*GetTunnelResponse, error) + GetAllTunnels(ctx context.Context, in *GetAllTunnelsRequest, opts ...grpc.CallOption) (*GetAllTunnelsResponse, error) + CreateTunnel(ctx context.Context, in *CreateTunnelRequest, opts ...grpc.CallOption) (*CreateTunnelResponse, error) + StopTunnel(ctx context.Context, in *StopTunnelRequest, opts ...grpc.CallOption) (*StopTunnelResponse, error) + ResumeTunnel(ctx context.Context, in *ResumeTunnelRequest, opts ...grpc.CallOption) (*ResumeTunnelResponse, error) + UpdateTunnel(ctx context.Context, in *UpdateTunnelRequest, opts ...grpc.CallOption) (*UpdateTunnelResponse, error) + DeleteTunnel(ctx context.Context, in *DeleteTunnelRequest, opts ...grpc.CallOption) (*DeleteTunnelResponse, error) + GetServerOptions(ctx context.Context, in *GetServerOptionsRequest, opts ...grpc.CallOption) (*GetServerOptionsResponse, error) +} + +type plumberServerClient struct { + cc grpc.ClientConnInterface +} + +func NewPlumberServerClient(cc grpc.ClientConnInterface) PlumberServerClient { + return &plumberServerClient{cc} +} + +func (c *plumberServerClient) GetAllConnections(ctx context.Context, in *GetAllConnectionsRequest, opts ...grpc.CallOption) (*GetAllConnectionsResponse, error) { + out := new(GetAllConnectionsResponse) + err := c.cc.Invoke(ctx, "/protos.PlumberServer/GetAllConnections", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plumberServerClient) GetConnection(ctx context.Context, in *GetConnectionRequest, opts ...grpc.CallOption) (*GetConnectionResponse, error) { + out := new(GetConnectionResponse) + err := c.cc.Invoke(ctx, "/protos.PlumberServer/GetConnection", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plumberServerClient) CreateConnection(ctx context.Context, in *CreateConnectionRequest, opts ...grpc.CallOption) (*CreateConnectionResponse, error) { + out := new(CreateConnectionResponse) + err := c.cc.Invoke(ctx, "/protos.PlumberServer/CreateConnection", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plumberServerClient) TestConnection(ctx context.Context, in *TestConnectionRequest, opts ...grpc.CallOption) (*TestConnectionResponse, error) { + out := new(TestConnectionResponse) + err := c.cc.Invoke(ctx, "/protos.PlumberServer/TestConnection", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plumberServerClient) UpdateConnection(ctx context.Context, in *UpdateConnectionRequest, opts ...grpc.CallOption) (*UpdateConnectionResponse, error) { + out := new(UpdateConnectionResponse) + err := c.cc.Invoke(ctx, "/protos.PlumberServer/UpdateConnection", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plumberServerClient) DeleteConnection(ctx context.Context, in *DeleteConnectionRequest, opts ...grpc.CallOption) (*DeleteConnectionResponse, error) { + out := new(DeleteConnectionResponse) + err := c.cc.Invoke(ctx, "/protos.PlumberServer/DeleteConnection", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plumberServerClient) GetAllRelays(ctx context.Context, in *GetAllRelaysRequest, opts ...grpc.CallOption) (*GetAllRelaysResponse, error) { + out := new(GetAllRelaysResponse) + err := c.cc.Invoke(ctx, "/protos.PlumberServer/GetAllRelays", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plumberServerClient) GetRelay(ctx context.Context, in *GetRelayRequest, opts ...grpc.CallOption) (*GetRelayResponse, error) { + out := new(GetRelayResponse) + err := c.cc.Invoke(ctx, "/protos.PlumberServer/GetRelay", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plumberServerClient) CreateRelay(ctx context.Context, in *CreateRelayRequest, opts ...grpc.CallOption) (*CreateRelayResponse, error) { + out := new(CreateRelayResponse) + err := c.cc.Invoke(ctx, "/protos.PlumberServer/CreateRelay", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plumberServerClient) UpdateRelay(ctx context.Context, in *UpdateRelayRequest, opts ...grpc.CallOption) (*UpdateRelayResponse, error) { + out := new(UpdateRelayResponse) + err := c.cc.Invoke(ctx, "/protos.PlumberServer/UpdateRelay", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plumberServerClient) ResumeRelay(ctx context.Context, in *ResumeRelayRequest, opts ...grpc.CallOption) (*ResumeRelayResponse, error) { + out := new(ResumeRelayResponse) + err := c.cc.Invoke(ctx, "/protos.PlumberServer/ResumeRelay", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plumberServerClient) StopRelay(ctx context.Context, in *StopRelayRequest, opts ...grpc.CallOption) (*StopRelayResponse, error) { + out := new(StopRelayResponse) + err := c.cc.Invoke(ctx, "/protos.PlumberServer/StopRelay", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plumberServerClient) DeleteRelay(ctx context.Context, in *DeleteRelayRequest, opts ...grpc.CallOption) (*DeleteRelayResponse, error) { + out := new(DeleteRelayResponse) + err := c.cc.Invoke(ctx, "/protos.PlumberServer/DeleteRelay", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plumberServerClient) GetTunnel(ctx context.Context, in *GetTunnelRequest, opts ...grpc.CallOption) (*GetTunnelResponse, error) { + out := new(GetTunnelResponse) + err := c.cc.Invoke(ctx, "/protos.PlumberServer/GetTunnel", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plumberServerClient) GetAllTunnels(ctx context.Context, in *GetAllTunnelsRequest, opts ...grpc.CallOption) (*GetAllTunnelsResponse, error) { + out := new(GetAllTunnelsResponse) + err := c.cc.Invoke(ctx, "/protos.PlumberServer/GetAllTunnels", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plumberServerClient) CreateTunnel(ctx context.Context, in *CreateTunnelRequest, opts ...grpc.CallOption) (*CreateTunnelResponse, error) { + out := new(CreateTunnelResponse) + err := c.cc.Invoke(ctx, "/protos.PlumberServer/CreateTunnel", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plumberServerClient) StopTunnel(ctx context.Context, in *StopTunnelRequest, opts ...grpc.CallOption) (*StopTunnelResponse, error) { + out := new(StopTunnelResponse) + err := c.cc.Invoke(ctx, "/protos.PlumberServer/StopTunnel", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plumberServerClient) ResumeTunnel(ctx context.Context, in *ResumeTunnelRequest, opts ...grpc.CallOption) (*ResumeTunnelResponse, error) { + out := new(ResumeTunnelResponse) + err := c.cc.Invoke(ctx, "/protos.PlumberServer/ResumeTunnel", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plumberServerClient) UpdateTunnel(ctx context.Context, in *UpdateTunnelRequest, opts ...grpc.CallOption) (*UpdateTunnelResponse, error) { + out := new(UpdateTunnelResponse) + err := c.cc.Invoke(ctx, "/protos.PlumberServer/UpdateTunnel", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plumberServerClient) DeleteTunnel(ctx context.Context, in *DeleteTunnelRequest, opts ...grpc.CallOption) (*DeleteTunnelResponse, error) { + out := new(DeleteTunnelResponse) + err := c.cc.Invoke(ctx, "/protos.PlumberServer/DeleteTunnel", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plumberServerClient) GetServerOptions(ctx context.Context, in *GetServerOptionsRequest, opts ...grpc.CallOption) (*GetServerOptionsResponse, error) { + out := new(GetServerOptionsResponse) + err := c.cc.Invoke(ctx, "/protos.PlumberServer/GetServerOptions", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// PlumberServerServer is the server API for PlumberServer service. +// All implementations should embed UnimplementedPlumberServerServer +// for forward compatibility +type PlumberServerServer interface { + // List configured/known connections + GetAllConnections(context.Context, *GetAllConnectionsRequest) (*GetAllConnectionsResponse, error) + // Fetch a specific connection by ID + GetConnection(context.Context, *GetConnectionRequest) (*GetConnectionResponse, error) + // Create a connection in plumber + CreateConnection(context.Context, *CreateConnectionRequest) (*CreateConnectionResponse, error) + // Test a connection before saving its configuration + TestConnection(context.Context, *TestConnectionRequest) (*TestConnectionResponse, error) + // Any active connections will be restarted + UpdateConnection(context.Context, *UpdateConnectionRequest) (*UpdateConnectionResponse, error) + // If there are any active connections, delete will cause them to get closed + DeleteConnection(context.Context, *DeleteConnectionRequest) (*DeleteConnectionResponse, error) + GetAllRelays(context.Context, *GetAllRelaysRequest) (*GetAllRelaysResponse, error) + GetRelay(context.Context, *GetRelayRequest) (*GetRelayResponse, error) + CreateRelay(context.Context, *CreateRelayRequest) (*CreateRelayResponse, error) + UpdateRelay(context.Context, *UpdateRelayRequest) (*UpdateRelayResponse, error) + ResumeRelay(context.Context, *ResumeRelayRequest) (*ResumeRelayResponse, error) + StopRelay(context.Context, *StopRelayRequest) (*StopRelayResponse, error) + DeleteRelay(context.Context, *DeleteRelayRequest) (*DeleteRelayResponse, error) + GetTunnel(context.Context, *GetTunnelRequest) (*GetTunnelResponse, error) + GetAllTunnels(context.Context, *GetAllTunnelsRequest) (*GetAllTunnelsResponse, error) + CreateTunnel(context.Context, *CreateTunnelRequest) (*CreateTunnelResponse, error) + StopTunnel(context.Context, *StopTunnelRequest) (*StopTunnelResponse, error) + ResumeTunnel(context.Context, *ResumeTunnelRequest) (*ResumeTunnelResponse, error) + UpdateTunnel(context.Context, *UpdateTunnelRequest) (*UpdateTunnelResponse, error) + DeleteTunnel(context.Context, *DeleteTunnelRequest) (*DeleteTunnelResponse, error) + GetServerOptions(context.Context, *GetServerOptionsRequest) (*GetServerOptionsResponse, error) +} + +// UnimplementedPlumberServerServer should be embedded to have forward compatible implementations. +type UnimplementedPlumberServerServer struct { +} + +func (UnimplementedPlumberServerServer) GetAllConnections(context.Context, *GetAllConnectionsRequest) (*GetAllConnectionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAllConnections not implemented") +} +func (UnimplementedPlumberServerServer) GetConnection(context.Context, *GetConnectionRequest) (*GetConnectionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetConnection not implemented") +} +func (UnimplementedPlumberServerServer) CreateConnection(context.Context, *CreateConnectionRequest) (*CreateConnectionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateConnection not implemented") +} +func (UnimplementedPlumberServerServer) TestConnection(context.Context, *TestConnectionRequest) (*TestConnectionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TestConnection not implemented") +} +func (UnimplementedPlumberServerServer) UpdateConnection(context.Context, *UpdateConnectionRequest) (*UpdateConnectionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateConnection not implemented") +} +func (UnimplementedPlumberServerServer) DeleteConnection(context.Context, *DeleteConnectionRequest) (*DeleteConnectionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteConnection not implemented") +} +func (UnimplementedPlumberServerServer) GetAllRelays(context.Context, *GetAllRelaysRequest) (*GetAllRelaysResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAllRelays not implemented") +} +func (UnimplementedPlumberServerServer) GetRelay(context.Context, *GetRelayRequest) (*GetRelayResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRelay not implemented") +} +func (UnimplementedPlumberServerServer) CreateRelay(context.Context, *CreateRelayRequest) (*CreateRelayResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateRelay not implemented") +} +func (UnimplementedPlumberServerServer) UpdateRelay(context.Context, *UpdateRelayRequest) (*UpdateRelayResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateRelay not implemented") +} +func (UnimplementedPlumberServerServer) ResumeRelay(context.Context, *ResumeRelayRequest) (*ResumeRelayResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ResumeRelay not implemented") +} +func (UnimplementedPlumberServerServer) StopRelay(context.Context, *StopRelayRequest) (*StopRelayResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StopRelay not implemented") +} +func (UnimplementedPlumberServerServer) DeleteRelay(context.Context, *DeleteRelayRequest) (*DeleteRelayResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteRelay not implemented") +} +func (UnimplementedPlumberServerServer) GetTunnel(context.Context, *GetTunnelRequest) (*GetTunnelResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetTunnel not implemented") +} +func (UnimplementedPlumberServerServer) GetAllTunnels(context.Context, *GetAllTunnelsRequest) (*GetAllTunnelsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAllTunnels not implemented") +} +func (UnimplementedPlumberServerServer) CreateTunnel(context.Context, *CreateTunnelRequest) (*CreateTunnelResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateTunnel not implemented") +} +func (UnimplementedPlumberServerServer) StopTunnel(context.Context, *StopTunnelRequest) (*StopTunnelResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StopTunnel not implemented") +} +func (UnimplementedPlumberServerServer) ResumeTunnel(context.Context, *ResumeTunnelRequest) (*ResumeTunnelResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ResumeTunnel not implemented") +} +func (UnimplementedPlumberServerServer) UpdateTunnel(context.Context, *UpdateTunnelRequest) (*UpdateTunnelResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateTunnel not implemented") +} +func (UnimplementedPlumberServerServer) DeleteTunnel(context.Context, *DeleteTunnelRequest) (*DeleteTunnelResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteTunnel not implemented") +} +func (UnimplementedPlumberServerServer) GetServerOptions(context.Context, *GetServerOptionsRequest) (*GetServerOptionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetServerOptions not implemented") +} + +// UnsafePlumberServerServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to PlumberServerServer will +// result in compilation errors. +type UnsafePlumberServerServer interface { + mustEmbedUnimplementedPlumberServerServer() +} + +func RegisterPlumberServerServer(s grpc.ServiceRegistrar, srv PlumberServerServer) { + s.RegisterService(&PlumberServer_ServiceDesc, srv) +} + +func _PlumberServer_GetAllConnections_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAllConnectionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlumberServerServer).GetAllConnections(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.PlumberServer/GetAllConnections", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlumberServerServer).GetAllConnections(ctx, req.(*GetAllConnectionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlumberServer_GetConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetConnectionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlumberServerServer).GetConnection(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.PlumberServer/GetConnection", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlumberServerServer).GetConnection(ctx, req.(*GetConnectionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlumberServer_CreateConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateConnectionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlumberServerServer).CreateConnection(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.PlumberServer/CreateConnection", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlumberServerServer).CreateConnection(ctx, req.(*CreateConnectionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlumberServer_TestConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TestConnectionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlumberServerServer).TestConnection(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.PlumberServer/TestConnection", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlumberServerServer).TestConnection(ctx, req.(*TestConnectionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlumberServer_UpdateConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateConnectionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlumberServerServer).UpdateConnection(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.PlumberServer/UpdateConnection", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlumberServerServer).UpdateConnection(ctx, req.(*UpdateConnectionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlumberServer_DeleteConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteConnectionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlumberServerServer).DeleteConnection(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.PlumberServer/DeleteConnection", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlumberServerServer).DeleteConnection(ctx, req.(*DeleteConnectionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlumberServer_GetAllRelays_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAllRelaysRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlumberServerServer).GetAllRelays(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.PlumberServer/GetAllRelays", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlumberServerServer).GetAllRelays(ctx, req.(*GetAllRelaysRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlumberServer_GetRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRelayRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlumberServerServer).GetRelay(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.PlumberServer/GetRelay", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlumberServerServer).GetRelay(ctx, req.(*GetRelayRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlumberServer_CreateRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateRelayRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlumberServerServer).CreateRelay(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.PlumberServer/CreateRelay", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlumberServerServer).CreateRelay(ctx, req.(*CreateRelayRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlumberServer_UpdateRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateRelayRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlumberServerServer).UpdateRelay(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.PlumberServer/UpdateRelay", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlumberServerServer).UpdateRelay(ctx, req.(*UpdateRelayRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlumberServer_ResumeRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ResumeRelayRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlumberServerServer).ResumeRelay(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.PlumberServer/ResumeRelay", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlumberServerServer).ResumeRelay(ctx, req.(*ResumeRelayRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlumberServer_StopRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StopRelayRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlumberServerServer).StopRelay(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.PlumberServer/StopRelay", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlumberServerServer).StopRelay(ctx, req.(*StopRelayRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlumberServer_DeleteRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRelayRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlumberServerServer).DeleteRelay(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.PlumberServer/DeleteRelay", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlumberServerServer).DeleteRelay(ctx, req.(*DeleteRelayRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlumberServer_GetTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetTunnelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlumberServerServer).GetTunnel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.PlumberServer/GetTunnel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlumberServerServer).GetTunnel(ctx, req.(*GetTunnelRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlumberServer_GetAllTunnels_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAllTunnelsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlumberServerServer).GetAllTunnels(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.PlumberServer/GetAllTunnels", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlumberServerServer).GetAllTunnels(ctx, req.(*GetAllTunnelsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlumberServer_CreateTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateTunnelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlumberServerServer).CreateTunnel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.PlumberServer/CreateTunnel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlumberServerServer).CreateTunnel(ctx, req.(*CreateTunnelRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlumberServer_StopTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StopTunnelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlumberServerServer).StopTunnel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.PlumberServer/StopTunnel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlumberServerServer).StopTunnel(ctx, req.(*StopTunnelRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlumberServer_ResumeTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ResumeTunnelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlumberServerServer).ResumeTunnel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.PlumberServer/ResumeTunnel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlumberServerServer).ResumeTunnel(ctx, req.(*ResumeTunnelRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlumberServer_UpdateTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateTunnelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlumberServerServer).UpdateTunnel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.PlumberServer/UpdateTunnel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlumberServerServer).UpdateTunnel(ctx, req.(*UpdateTunnelRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlumberServer_DeleteTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteTunnelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlumberServerServer).DeleteTunnel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.PlumberServer/DeleteTunnel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlumberServerServer).DeleteTunnel(ctx, req.(*DeleteTunnelRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlumberServer_GetServerOptions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetServerOptionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlumberServerServer).GetServerOptions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.PlumberServer/GetServerOptions", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlumberServerServer).GetServerOptions(ctx, req.(*GetServerOptionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// PlumberServer_ServiceDesc is the grpc.ServiceDesc for PlumberServer service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var PlumberServer_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "protos.PlumberServer", + HandlerType: (*PlumberServerServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetAllConnections", + Handler: _PlumberServer_GetAllConnections_Handler, + }, + { + MethodName: "GetConnection", + Handler: _PlumberServer_GetConnection_Handler, + }, + { + MethodName: "CreateConnection", + Handler: _PlumberServer_CreateConnection_Handler, + }, + { + MethodName: "TestConnection", + Handler: _PlumberServer_TestConnection_Handler, + }, + { + MethodName: "UpdateConnection", + Handler: _PlumberServer_UpdateConnection_Handler, + }, + { + MethodName: "DeleteConnection", + Handler: _PlumberServer_DeleteConnection_Handler, + }, + { + MethodName: "GetAllRelays", + Handler: _PlumberServer_GetAllRelays_Handler, + }, + { + MethodName: "GetRelay", + Handler: _PlumberServer_GetRelay_Handler, + }, + { + MethodName: "CreateRelay", + Handler: _PlumberServer_CreateRelay_Handler, + }, + { + MethodName: "UpdateRelay", + Handler: _PlumberServer_UpdateRelay_Handler, + }, + { + MethodName: "ResumeRelay", + Handler: _PlumberServer_ResumeRelay_Handler, + }, + { + MethodName: "StopRelay", + Handler: _PlumberServer_StopRelay_Handler, + }, + { + MethodName: "DeleteRelay", + Handler: _PlumberServer_DeleteRelay_Handler, + }, + { + MethodName: "GetTunnel", + Handler: _PlumberServer_GetTunnel_Handler, + }, + { + MethodName: "GetAllTunnels", + Handler: _PlumberServer_GetAllTunnels_Handler, + }, + { + MethodName: "CreateTunnel", + Handler: _PlumberServer_CreateTunnel_Handler, + }, + { + MethodName: "StopTunnel", + Handler: _PlumberServer_StopTunnel_Handler, + }, + { + MethodName: "ResumeTunnel", + Handler: _PlumberServer_ResumeTunnel_Handler, + }, + { + MethodName: "UpdateTunnel", + Handler: _PlumberServer_UpdateTunnel_Handler, + }, + { + MethodName: "DeleteTunnel", + Handler: _PlumberServer_DeleteTunnel_Handler, + }, + { + MethodName: "GetServerOptions", + Handler: _PlumberServer_GetServerOptions_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "ps_base.proto", +} diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_connect.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_connect.pb.go index b92caf22e..682b462da 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_connect.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_connect.pb.go @@ -1,591 +1,954 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_connect.proto package protos import ( - fmt "fmt" common "github.com/batchcorp/plumber-schemas/build/go/protos/common" opts "github.com/batchcorp/plumber-schemas/build/go/protos/opts" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type GetAllConnectionsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Every gRPC request must have a valid auth config - Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` } -func (m *GetAllConnectionsRequest) Reset() { *m = GetAllConnectionsRequest{} } -func (m *GetAllConnectionsRequest) String() string { return proto.CompactTextString(m) } -func (*GetAllConnectionsRequest) ProtoMessage() {} -func (*GetAllConnectionsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb90b631f082347, []int{0} +func (x *GetAllConnectionsRequest) Reset() { + *x = GetAllConnectionsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_connect_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GetAllConnectionsRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetAllConnectionsRequest.Unmarshal(m, b) +func (x *GetAllConnectionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GetAllConnectionsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetAllConnectionsRequest.Marshal(b, m, deterministic) -} -func (m *GetAllConnectionsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAllConnectionsRequest.Merge(m, src) -} -func (m *GetAllConnectionsRequest) XXX_Size() int { - return xxx_messageInfo_GetAllConnectionsRequest.Size(m) -} -func (m *GetAllConnectionsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetAllConnectionsRequest.DiscardUnknown(m) + +func (*GetAllConnectionsRequest) ProtoMessage() {} + +func (x *GetAllConnectionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_connect_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_GetAllConnectionsRequest proto.InternalMessageInfo +// Deprecated: Use GetAllConnectionsRequest.ProtoReflect.Descriptor instead. +func (*GetAllConnectionsRequest) Descriptor() ([]byte, []int) { + return file_ps_connect_proto_rawDescGZIP(), []int{0} +} -func (m *GetAllConnectionsRequest) GetAuth() *common.Auth { - if m != nil { - return m.Auth +func (x *GetAllConnectionsRequest) GetAuth() *common.Auth { + if x != nil { + return x.Auth } return nil } type GetAllConnectionsResponse struct { - Options []*opts.ConnectionOptions `protobuf:"bytes,1,rep,name=options,proto3" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *GetAllConnectionsResponse) Reset() { *m = GetAllConnectionsResponse{} } -func (m *GetAllConnectionsResponse) String() string { return proto.CompactTextString(m) } -func (*GetAllConnectionsResponse) ProtoMessage() {} -func (*GetAllConnectionsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb90b631f082347, []int{1} + Options []*opts.ConnectionOptions `protobuf:"bytes,1,rep,name=options,proto3" json:"options,omitempty"` } -func (m *GetAllConnectionsResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetAllConnectionsResponse.Unmarshal(m, b) -} -func (m *GetAllConnectionsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetAllConnectionsResponse.Marshal(b, m, deterministic) -} -func (m *GetAllConnectionsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAllConnectionsResponse.Merge(m, src) +func (x *GetAllConnectionsResponse) Reset() { + *x = GetAllConnectionsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_connect_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GetAllConnectionsResponse) XXX_Size() int { - return xxx_messageInfo_GetAllConnectionsResponse.Size(m) + +func (x *GetAllConnectionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GetAllConnectionsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetAllConnectionsResponse.DiscardUnknown(m) + +func (*GetAllConnectionsResponse) ProtoMessage() {} + +func (x *GetAllConnectionsResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_connect_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_GetAllConnectionsResponse proto.InternalMessageInfo +// Deprecated: Use GetAllConnectionsResponse.ProtoReflect.Descriptor instead. +func (*GetAllConnectionsResponse) Descriptor() ([]byte, []int) { + return file_ps_connect_proto_rawDescGZIP(), []int{1} +} -func (m *GetAllConnectionsResponse) GetOptions() []*opts.ConnectionOptions { - if m != nil { - return m.Options +func (x *GetAllConnectionsResponse) GetOptions() []*opts.ConnectionOptions { + if x != nil { + return x.Options } return nil } type GetConnectionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Every gRPC request must have a valid auth config - Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` - ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` + ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` } -func (m *GetConnectionRequest) Reset() { *m = GetConnectionRequest{} } -func (m *GetConnectionRequest) String() string { return proto.CompactTextString(m) } -func (*GetConnectionRequest) ProtoMessage() {} -func (*GetConnectionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb90b631f082347, []int{2} +func (x *GetConnectionRequest) Reset() { + *x = GetConnectionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_connect_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GetConnectionRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetConnectionRequest.Unmarshal(m, b) +func (x *GetConnectionRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GetConnectionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetConnectionRequest.Marshal(b, m, deterministic) -} -func (m *GetConnectionRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetConnectionRequest.Merge(m, src) -} -func (m *GetConnectionRequest) XXX_Size() int { - return xxx_messageInfo_GetConnectionRequest.Size(m) -} -func (m *GetConnectionRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetConnectionRequest.DiscardUnknown(m) + +func (*GetConnectionRequest) ProtoMessage() {} + +func (x *GetConnectionRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_connect_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_GetConnectionRequest proto.InternalMessageInfo +// Deprecated: Use GetConnectionRequest.ProtoReflect.Descriptor instead. +func (*GetConnectionRequest) Descriptor() ([]byte, []int) { + return file_ps_connect_proto_rawDescGZIP(), []int{2} +} -func (m *GetConnectionRequest) GetAuth() *common.Auth { - if m != nil { - return m.Auth +func (x *GetConnectionRequest) GetAuth() *common.Auth { + if x != nil { + return x.Auth } return nil } -func (m *GetConnectionRequest) GetConnectionId() string { - if m != nil { - return m.ConnectionId +func (x *GetConnectionRequest) GetConnectionId() string { + if x != nil { + return x.ConnectionId } return "" } type GetConnectionResponse struct { - Options *opts.ConnectionOptions `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *GetConnectionResponse) Reset() { *m = GetConnectionResponse{} } -func (m *GetConnectionResponse) String() string { return proto.CompactTextString(m) } -func (*GetConnectionResponse) ProtoMessage() {} -func (*GetConnectionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb90b631f082347, []int{3} + Options *opts.ConnectionOptions `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` } -func (m *GetConnectionResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetConnectionResponse.Unmarshal(m, b) -} -func (m *GetConnectionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetConnectionResponse.Marshal(b, m, deterministic) -} -func (m *GetConnectionResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetConnectionResponse.Merge(m, src) +func (x *GetConnectionResponse) Reset() { + *x = GetConnectionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_connect_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GetConnectionResponse) XXX_Size() int { - return xxx_messageInfo_GetConnectionResponse.Size(m) + +func (x *GetConnectionResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GetConnectionResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetConnectionResponse.DiscardUnknown(m) + +func (*GetConnectionResponse) ProtoMessage() {} + +func (x *GetConnectionResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_connect_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_GetConnectionResponse proto.InternalMessageInfo +// Deprecated: Use GetConnectionResponse.ProtoReflect.Descriptor instead. +func (*GetConnectionResponse) Descriptor() ([]byte, []int) { + return file_ps_connect_proto_rawDescGZIP(), []int{3} +} -func (m *GetConnectionResponse) GetOptions() *opts.ConnectionOptions { - if m != nil { - return m.Options +func (x *GetConnectionResponse) GetOptions() *opts.ConnectionOptions { + if x != nil { + return x.Options } return nil } type CreateConnectionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Every gRPC request must have a valid auth config - Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` - Options *opts.ConnectionOptions `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` + Options *opts.ConnectionOptions `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` } -func (m *CreateConnectionRequest) Reset() { *m = CreateConnectionRequest{} } -func (m *CreateConnectionRequest) String() string { return proto.CompactTextString(m) } -func (*CreateConnectionRequest) ProtoMessage() {} -func (*CreateConnectionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb90b631f082347, []int{4} +func (x *CreateConnectionRequest) Reset() { + *x = CreateConnectionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_connect_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *CreateConnectionRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateConnectionRequest.Unmarshal(m, b) -} -func (m *CreateConnectionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateConnectionRequest.Marshal(b, m, deterministic) -} -func (m *CreateConnectionRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateConnectionRequest.Merge(m, src) -} -func (m *CreateConnectionRequest) XXX_Size() int { - return xxx_messageInfo_CreateConnectionRequest.Size(m) +func (x *CreateConnectionRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CreateConnectionRequest) XXX_DiscardUnknown() { - xxx_messageInfo_CreateConnectionRequest.DiscardUnknown(m) + +func (*CreateConnectionRequest) ProtoMessage() {} + +func (x *CreateConnectionRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_connect_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_CreateConnectionRequest proto.InternalMessageInfo +// Deprecated: Use CreateConnectionRequest.ProtoReflect.Descriptor instead. +func (*CreateConnectionRequest) Descriptor() ([]byte, []int) { + return file_ps_connect_proto_rawDescGZIP(), []int{4} +} -func (m *CreateConnectionRequest) GetAuth() *common.Auth { - if m != nil { - return m.Auth +func (x *CreateConnectionRequest) GetAuth() *common.Auth { + if x != nil { + return x.Auth } return nil } -func (m *CreateConnectionRequest) GetOptions() *opts.ConnectionOptions { - if m != nil { - return m.Options +func (x *CreateConnectionRequest) GetOptions() *opts.ConnectionOptions { + if x != nil { + return x.Options } return nil } type CreateConnectionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Set with uuid that represents connection if create is successful - ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` } -func (m *CreateConnectionResponse) Reset() { *m = CreateConnectionResponse{} } -func (m *CreateConnectionResponse) String() string { return proto.CompactTextString(m) } -func (*CreateConnectionResponse) ProtoMessage() {} -func (*CreateConnectionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb90b631f082347, []int{5} +func (x *CreateConnectionResponse) Reset() { + *x = CreateConnectionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_connect_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *CreateConnectionResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateConnectionResponse.Unmarshal(m, b) -} -func (m *CreateConnectionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateConnectionResponse.Marshal(b, m, deterministic) +func (x *CreateConnectionResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CreateConnectionResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateConnectionResponse.Merge(m, src) -} -func (m *CreateConnectionResponse) XXX_Size() int { - return xxx_messageInfo_CreateConnectionResponse.Size(m) -} -func (m *CreateConnectionResponse) XXX_DiscardUnknown() { - xxx_messageInfo_CreateConnectionResponse.DiscardUnknown(m) + +func (*CreateConnectionResponse) ProtoMessage() {} + +func (x *CreateConnectionResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_connect_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_CreateConnectionResponse proto.InternalMessageInfo +// Deprecated: Use CreateConnectionResponse.ProtoReflect.Descriptor instead. +func (*CreateConnectionResponse) Descriptor() ([]byte, []int) { + return file_ps_connect_proto_rawDescGZIP(), []int{5} +} -func (m *CreateConnectionResponse) GetConnectionId() string { - if m != nil { - return m.ConnectionId +func (x *CreateConnectionResponse) GetConnectionId() string { + if x != nil { + return x.ConnectionId } return "" } type TestConnectionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Every gRPC request must have a valid auth config - Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` - Options *opts.ConnectionOptions `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` + Options *opts.ConnectionOptions `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` } -func (m *TestConnectionRequest) Reset() { *m = TestConnectionRequest{} } -func (m *TestConnectionRequest) String() string { return proto.CompactTextString(m) } -func (*TestConnectionRequest) ProtoMessage() {} -func (*TestConnectionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb90b631f082347, []int{6} +func (x *TestConnectionRequest) Reset() { + *x = TestConnectionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_connect_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TestConnectionRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TestConnectionRequest.Unmarshal(m, b) -} -func (m *TestConnectionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TestConnectionRequest.Marshal(b, m, deterministic) -} -func (m *TestConnectionRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_TestConnectionRequest.Merge(m, src) -} -func (m *TestConnectionRequest) XXX_Size() int { - return xxx_messageInfo_TestConnectionRequest.Size(m) +func (x *TestConnectionRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TestConnectionRequest) XXX_DiscardUnknown() { - xxx_messageInfo_TestConnectionRequest.DiscardUnknown(m) + +func (*TestConnectionRequest) ProtoMessage() {} + +func (x *TestConnectionRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_connect_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TestConnectionRequest proto.InternalMessageInfo +// Deprecated: Use TestConnectionRequest.ProtoReflect.Descriptor instead. +func (*TestConnectionRequest) Descriptor() ([]byte, []int) { + return file_ps_connect_proto_rawDescGZIP(), []int{6} +} -func (m *TestConnectionRequest) GetAuth() *common.Auth { - if m != nil { - return m.Auth +func (x *TestConnectionRequest) GetAuth() *common.Auth { + if x != nil { + return x.Auth } return nil } -func (m *TestConnectionRequest) GetOptions() *opts.ConnectionOptions { - if m != nil { - return m.Options +func (x *TestConnectionRequest) GetOptions() *opts.ConnectionOptions { + if x != nil { + return x.Options } return nil } type TestConnectionResponse struct { - Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *TestConnectionResponse) Reset() { *m = TestConnectionResponse{} } -func (m *TestConnectionResponse) String() string { return proto.CompactTextString(m) } -func (*TestConnectionResponse) ProtoMessage() {} -func (*TestConnectionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb90b631f082347, []int{7} + Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` } -func (m *TestConnectionResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TestConnectionResponse.Unmarshal(m, b) -} -func (m *TestConnectionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TestConnectionResponse.Marshal(b, m, deterministic) -} -func (m *TestConnectionResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_TestConnectionResponse.Merge(m, src) +func (x *TestConnectionResponse) Reset() { + *x = TestConnectionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_connect_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TestConnectionResponse) XXX_Size() int { - return xxx_messageInfo_TestConnectionResponse.Size(m) + +func (x *TestConnectionResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TestConnectionResponse) XXX_DiscardUnknown() { - xxx_messageInfo_TestConnectionResponse.DiscardUnknown(m) + +func (*TestConnectionResponse) ProtoMessage() {} + +func (x *TestConnectionResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_connect_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_TestConnectionResponse proto.InternalMessageInfo +// Deprecated: Use TestConnectionResponse.ProtoReflect.Descriptor instead. +func (*TestConnectionResponse) Descriptor() ([]byte, []int) { + return file_ps_connect_proto_rawDescGZIP(), []int{7} +} -func (m *TestConnectionResponse) GetStatus() *common.Status { - if m != nil { - return m.Status +func (x *TestConnectionResponse) GetStatus() *common.Status { + if x != nil { + return x.Status } return nil } type UpdateConnectionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Every gRPC request must have a valid auth config - Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` - ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` - Options *opts.ConnectionOptions `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` + ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` + Options *opts.ConnectionOptions `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` } -func (m *UpdateConnectionRequest) Reset() { *m = UpdateConnectionRequest{} } -func (m *UpdateConnectionRequest) String() string { return proto.CompactTextString(m) } -func (*UpdateConnectionRequest) ProtoMessage() {} -func (*UpdateConnectionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb90b631f082347, []int{8} +func (x *UpdateConnectionRequest) Reset() { + *x = UpdateConnectionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_connect_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *UpdateConnectionRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UpdateConnectionRequest.Unmarshal(m, b) -} -func (m *UpdateConnectionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UpdateConnectionRequest.Marshal(b, m, deterministic) -} -func (m *UpdateConnectionRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_UpdateConnectionRequest.Merge(m, src) -} -func (m *UpdateConnectionRequest) XXX_Size() int { - return xxx_messageInfo_UpdateConnectionRequest.Size(m) +func (x *UpdateConnectionRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *UpdateConnectionRequest) XXX_DiscardUnknown() { - xxx_messageInfo_UpdateConnectionRequest.DiscardUnknown(m) + +func (*UpdateConnectionRequest) ProtoMessage() {} + +func (x *UpdateConnectionRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_connect_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_UpdateConnectionRequest proto.InternalMessageInfo +// Deprecated: Use UpdateConnectionRequest.ProtoReflect.Descriptor instead. +func (*UpdateConnectionRequest) Descriptor() ([]byte, []int) { + return file_ps_connect_proto_rawDescGZIP(), []int{8} +} -func (m *UpdateConnectionRequest) GetAuth() *common.Auth { - if m != nil { - return m.Auth +func (x *UpdateConnectionRequest) GetAuth() *common.Auth { + if x != nil { + return x.Auth } return nil } -func (m *UpdateConnectionRequest) GetConnectionId() string { - if m != nil { - return m.ConnectionId +func (x *UpdateConnectionRequest) GetConnectionId() string { + if x != nil { + return x.ConnectionId } return "" } -func (m *UpdateConnectionRequest) GetOptions() *opts.ConnectionOptions { - if m != nil { - return m.Options +func (x *UpdateConnectionRequest) GetOptions() *opts.ConnectionOptions { + if x != nil { + return x.Options } return nil } type UpdateConnectionResponse struct { - Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *UpdateConnectionResponse) Reset() { *m = UpdateConnectionResponse{} } -func (m *UpdateConnectionResponse) String() string { return proto.CompactTextString(m) } -func (*UpdateConnectionResponse) ProtoMessage() {} -func (*UpdateConnectionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb90b631f082347, []int{9} + Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` } -func (m *UpdateConnectionResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UpdateConnectionResponse.Unmarshal(m, b) -} -func (m *UpdateConnectionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UpdateConnectionResponse.Marshal(b, m, deterministic) -} -func (m *UpdateConnectionResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_UpdateConnectionResponse.Merge(m, src) +func (x *UpdateConnectionResponse) Reset() { + *x = UpdateConnectionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_connect_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *UpdateConnectionResponse) XXX_Size() int { - return xxx_messageInfo_UpdateConnectionResponse.Size(m) + +func (x *UpdateConnectionResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *UpdateConnectionResponse) XXX_DiscardUnknown() { - xxx_messageInfo_UpdateConnectionResponse.DiscardUnknown(m) + +func (*UpdateConnectionResponse) ProtoMessage() {} + +func (x *UpdateConnectionResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_connect_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_UpdateConnectionResponse proto.InternalMessageInfo +// Deprecated: Use UpdateConnectionResponse.ProtoReflect.Descriptor instead. +func (*UpdateConnectionResponse) Descriptor() ([]byte, []int) { + return file_ps_connect_proto_rawDescGZIP(), []int{9} +} -func (m *UpdateConnectionResponse) GetStatus() *common.Status { - if m != nil { - return m.Status +func (x *UpdateConnectionResponse) GetStatus() *common.Status { + if x != nil { + return x.Status } return nil } type DeleteConnectionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Every gRPC request must have a valid auth config - Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` - ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` + ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` } -func (m *DeleteConnectionRequest) Reset() { *m = DeleteConnectionRequest{} } -func (m *DeleteConnectionRequest) String() string { return proto.CompactTextString(m) } -func (*DeleteConnectionRequest) ProtoMessage() {} -func (*DeleteConnectionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb90b631f082347, []int{10} +func (x *DeleteConnectionRequest) Reset() { + *x = DeleteConnectionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_connect_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *DeleteConnectionRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeleteConnectionRequest.Unmarshal(m, b) -} -func (m *DeleteConnectionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeleteConnectionRequest.Marshal(b, m, deterministic) -} -func (m *DeleteConnectionRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteConnectionRequest.Merge(m, src) +func (x *DeleteConnectionRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *DeleteConnectionRequest) XXX_Size() int { - return xxx_messageInfo_DeleteConnectionRequest.Size(m) -} -func (m *DeleteConnectionRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteConnectionRequest.DiscardUnknown(m) + +func (*DeleteConnectionRequest) ProtoMessage() {} + +func (x *DeleteConnectionRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_connect_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_DeleteConnectionRequest proto.InternalMessageInfo +// Deprecated: Use DeleteConnectionRequest.ProtoReflect.Descriptor instead. +func (*DeleteConnectionRequest) Descriptor() ([]byte, []int) { + return file_ps_connect_proto_rawDescGZIP(), []int{10} +} -func (m *DeleteConnectionRequest) GetAuth() *common.Auth { - if m != nil { - return m.Auth +func (x *DeleteConnectionRequest) GetAuth() *common.Auth { + if x != nil { + return x.Auth } return nil } -func (m *DeleteConnectionRequest) GetConnectionId() string { - if m != nil { - return m.ConnectionId +func (x *DeleteConnectionRequest) GetConnectionId() string { + if x != nil { + return x.ConnectionId } return "" } type DeleteConnectionResponse struct { - Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *DeleteConnectionResponse) Reset() { *m = DeleteConnectionResponse{} } -func (m *DeleteConnectionResponse) String() string { return proto.CompactTextString(m) } -func (*DeleteConnectionResponse) ProtoMessage() {} -func (*DeleteConnectionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb90b631f082347, []int{11} + Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` } -func (m *DeleteConnectionResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeleteConnectionResponse.Unmarshal(m, b) -} -func (m *DeleteConnectionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeleteConnectionResponse.Marshal(b, m, deterministic) -} -func (m *DeleteConnectionResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteConnectionResponse.Merge(m, src) +func (x *DeleteConnectionResponse) Reset() { + *x = DeleteConnectionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_connect_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *DeleteConnectionResponse) XXX_Size() int { - return xxx_messageInfo_DeleteConnectionResponse.Size(m) + +func (x *DeleteConnectionResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *DeleteConnectionResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteConnectionResponse.DiscardUnknown(m) + +func (*DeleteConnectionResponse) ProtoMessage() {} + +func (x *DeleteConnectionResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_connect_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_DeleteConnectionResponse proto.InternalMessageInfo +// Deprecated: Use DeleteConnectionResponse.ProtoReflect.Descriptor instead. +func (*DeleteConnectionResponse) Descriptor() ([]byte, []int) { + return file_ps_connect_proto_rawDescGZIP(), []int{11} +} -func (m *DeleteConnectionResponse) GetStatus() *common.Status { - if m != nil { - return m.Status +func (x *DeleteConnectionResponse) GetStatus() *common.Status { + if x != nil { + return x.Status } return nil } -func init() { - proto.RegisterType((*GetAllConnectionsRequest)(nil), "protos.GetAllConnectionsRequest") - proto.RegisterType((*GetAllConnectionsResponse)(nil), "protos.GetAllConnectionsResponse") - proto.RegisterType((*GetConnectionRequest)(nil), "protos.GetConnectionRequest") - proto.RegisterType((*GetConnectionResponse)(nil), "protos.GetConnectionResponse") - proto.RegisterType((*CreateConnectionRequest)(nil), "protos.CreateConnectionRequest") - proto.RegisterType((*CreateConnectionResponse)(nil), "protos.CreateConnectionResponse") - proto.RegisterType((*TestConnectionRequest)(nil), "protos.TestConnectionRequest") - proto.RegisterType((*TestConnectionResponse)(nil), "protos.TestConnectionResponse") - proto.RegisterType((*UpdateConnectionRequest)(nil), "protos.UpdateConnectionRequest") - proto.RegisterType((*UpdateConnectionResponse)(nil), "protos.UpdateConnectionResponse") - proto.RegisterType((*DeleteConnectionRequest)(nil), "protos.DeleteConnectionRequest") - proto.RegisterType((*DeleteConnectionResponse)(nil), "protos.DeleteConnectionResponse") -} - -func init() { proto.RegisterFile("ps_connect.proto", fileDescriptor_dcb90b631f082347) } - -var fileDescriptor_dcb90b631f082347 = []byte{ - // 383 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x94, 0xcf, 0x4a, 0xeb, 0x40, - 0x18, 0xc5, 0xc9, 0xbd, 0x97, 0x96, 0xfb, 0x55, 0x41, 0xa2, 0xb5, 0xb1, 0xa2, 0x94, 0xb8, 0xc9, - 0xc6, 0x04, 0xaa, 0x88, 0x3b, 0xa9, 0x2d, 0x54, 0x5d, 0x28, 0x46, 0xbb, 0x71, 0x53, 0xf2, 0x67, - 0x68, 0x02, 0x49, 0x66, 0xcc, 0x7c, 0x59, 0x89, 0xcf, 0xe0, 0x3b, 0xf8, 0x74, 0x3e, 0x86, 0x4c, - 0xa6, 0x31, 0xd2, 0x74, 0xd1, 0x3f, 0x88, 0xab, 0x09, 0x73, 0xce, 0x7c, 0xe7, 0x77, 0x26, 0x21, - 0xb0, 0xc5, 0xf8, 0xd8, 0xa3, 0x49, 0x42, 0x3c, 0x34, 0x59, 0x4a, 0x91, 0xaa, 0xb5, 0x7c, 0xe1, - 0xed, 0x7d, 0x8f, 0xc6, 0x31, 0x4d, 0xac, 0xdc, 0x20, 0x9e, 0xc6, 0x4e, 0x86, 0x81, 0x34, 0xb5, - 0x0f, 0x2a, 0x22, 0x47, 0x07, 0x33, 0x5e, 0xc8, 0x94, 0x21, 0x17, 0xa2, 0x58, 0x8b, 0xf9, 0x21, - 0x4d, 0xa4, 0xac, 0x0f, 0x40, 0x1b, 0x12, 0xec, 0x45, 0x51, 0xff, 0x4b, 0xe1, 0x36, 0x79, 0xce, - 0x08, 0x47, 0xd5, 0x80, 0x7f, 0x22, 0x47, 0x7b, 0xbb, 0xed, 0x28, 0x46, 0xa3, 0xbb, 0x2d, 0x8f, - 0x70, 0x53, 0xc6, 0x98, 0xbd, 0x0c, 0x03, 0x3b, 0x77, 0xe8, 0x23, 0xd8, 0x9b, 0x33, 0x85, 0x33, - 0x9a, 0x70, 0xa2, 0x9e, 0x43, 0x9d, 0xb2, 0x7c, 0x4b, 0x53, 0x3a, 0x7f, 0x8d, 0x46, 0xf7, 0xb0, - 0x18, 0x24, 0x90, 0xcc, 0xf2, 0xc8, 0x9d, 0x74, 0xd9, 0x85, 0x5d, 0x27, 0xb0, 0x33, 0x24, 0x58, - 0x1a, 0x96, 0x06, 0x53, 0x8f, 0x60, 0xb3, 0xac, 0x3c, 0x0e, 0x7d, 0x4d, 0xe9, 0x28, 0xc6, 0x7f, - 0x7b, 0xa3, 0xdc, 0xbc, 0xf6, 0xf5, 0x7b, 0x68, 0xce, 0xc4, 0xcc, 0x23, 0x57, 0x96, 0x21, 0x7f, - 0x85, 0x56, 0x3f, 0x25, 0x0e, 0x92, 0x75, 0xe0, 0x57, 0x8f, 0xbf, 0x00, 0xad, 0x1a, 0x3f, 0x2d, - 0xb5, 0xd0, 0x95, 0xbc, 0x40, 0xf3, 0x91, 0x70, 0xfc, 0x1d, 0xfa, 0x2b, 0xd8, 0x9d, 0x0d, 0x9f, - 0xb2, 0x9b, 0x50, 0x93, 0x1f, 0xb7, 0xf6, 0x51, 0xcf, 0x67, 0x36, 0x67, 0xf2, 0x1f, 0x72, 0xd5, - 0x9e, 0xba, 0xf4, 0x77, 0x05, 0x5a, 0x23, 0xe6, 0xaf, 0xf9, 0x1e, 0x16, 0xb9, 0xb1, 0xef, 0x75, - 0xff, 0x2c, 0x57, 0xf7, 0x06, 0xb4, 0x2a, 0xe3, 0x8a, 0x85, 0x03, 0x68, 0x0d, 0x48, 0x44, 0x7e, - 0xbe, 0xaf, 0xa0, 0xae, 0x26, 0xad, 0x46, 0x7d, 0x79, 0xf6, 0x74, 0x3a, 0x09, 0x31, 0xc8, 0x5c, - 0xa1, 0x5b, 0xae, 0x83, 0x5e, 0xe0, 0xd1, 0x94, 0x59, 0x2c, 0xca, 0x62, 0x97, 0xa4, 0xc7, 0xdc, - 0x0b, 0x48, 0xec, 0x70, 0xcb, 0xcd, 0xc2, 0xc8, 0xb7, 0x26, 0xd4, 0x92, 0xd3, 0x5c, 0xf9, 0x7f, - 0x3c, 0xf9, 0x0c, 0x00, 0x00, 0xff, 0xff, 0xbf, 0x34, 0xb0, 0x3a, 0x3a, 0x05, 0x00, 0x00, +var File_ps_connect_proto protoreflect.FileDescriptor + +var file_ps_connect_proto_rawDesc = []byte{ + 0x0a, 0x10, 0x70, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x1a, 0x1b, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2f, 0x70, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x61, 0x75, 0x74, + 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, + 0x70, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, + 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x44, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x43, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x28, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x68, 0x18, 0x8f, 0x4e, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x04, 0x61, 0x75, 0x74, 0x68, 0x22, 0x55, 0x0a, 0x19, 0x47, + 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x22, 0x65, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x61, 0x75, + 0x74, 0x68, 0x18, 0x8f, 0x4e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x04, + 0x61, 0x75, 0x74, 0x68, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x51, 0x0a, 0x15, 0x47, 0x65, 0x74, + 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, + 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x7d, 0x0a, 0x17, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x68, 0x18, + 0x8f, 0x4e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x04, 0x61, 0x75, 0x74, + 0x68, 0x12, 0x38, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, + 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x3f, 0x0a, 0x18, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x7b, 0x0a, 0x15, + 0x54, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x68, 0x18, 0x8f, 0x4e, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x04, 0x61, 0x75, 0x74, 0x68, 0x12, + 0x38, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x43, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x48, 0x0a, 0x16, 0x54, 0x65, 0x73, + 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0xe8, 0x07, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x22, 0xa2, 0x01, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x28, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x68, 0x18, 0x8f, 0x4e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, + 0x75, 0x74, 0x68, 0x52, 0x04, 0x61, 0x75, 0x74, 0x68, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x38, + 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x43, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x4a, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0xe8, + 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x22, 0x68, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x28, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x68, 0x18, 0x8f, 0x4e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, + 0x75, 0x74, 0x68, 0x52, 0x04, 0x61, 0x75, 0x74, 0x68, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x4a, + 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, + 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ps_connect_proto_rawDescOnce sync.Once + file_ps_connect_proto_rawDescData = file_ps_connect_proto_rawDesc +) + +func file_ps_connect_proto_rawDescGZIP() []byte { + file_ps_connect_proto_rawDescOnce.Do(func() { + file_ps_connect_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_connect_proto_rawDescData) + }) + return file_ps_connect_proto_rawDescData +} + +var file_ps_connect_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_ps_connect_proto_goTypes = []interface{}{ + (*GetAllConnectionsRequest)(nil), // 0: protos.GetAllConnectionsRequest + (*GetAllConnectionsResponse)(nil), // 1: protos.GetAllConnectionsResponse + (*GetConnectionRequest)(nil), // 2: protos.GetConnectionRequest + (*GetConnectionResponse)(nil), // 3: protos.GetConnectionResponse + (*CreateConnectionRequest)(nil), // 4: protos.CreateConnectionRequest + (*CreateConnectionResponse)(nil), // 5: protos.CreateConnectionResponse + (*TestConnectionRequest)(nil), // 6: protos.TestConnectionRequest + (*TestConnectionResponse)(nil), // 7: protos.TestConnectionResponse + (*UpdateConnectionRequest)(nil), // 8: protos.UpdateConnectionRequest + (*UpdateConnectionResponse)(nil), // 9: protos.UpdateConnectionResponse + (*DeleteConnectionRequest)(nil), // 10: protos.DeleteConnectionRequest + (*DeleteConnectionResponse)(nil), // 11: protos.DeleteConnectionResponse + (*common.Auth)(nil), // 12: protos.common.Auth + (*opts.ConnectionOptions)(nil), // 13: protos.opts.ConnectionOptions + (*common.Status)(nil), // 14: protos.common.Status +} +var file_ps_connect_proto_depIdxs = []int32{ + 12, // 0: protos.GetAllConnectionsRequest.auth:type_name -> protos.common.Auth + 13, // 1: protos.GetAllConnectionsResponse.options:type_name -> protos.opts.ConnectionOptions + 12, // 2: protos.GetConnectionRequest.auth:type_name -> protos.common.Auth + 13, // 3: protos.GetConnectionResponse.options:type_name -> protos.opts.ConnectionOptions + 12, // 4: protos.CreateConnectionRequest.auth:type_name -> protos.common.Auth + 13, // 5: protos.CreateConnectionRequest.options:type_name -> protos.opts.ConnectionOptions + 12, // 6: protos.TestConnectionRequest.auth:type_name -> protos.common.Auth + 13, // 7: protos.TestConnectionRequest.options:type_name -> protos.opts.ConnectionOptions + 14, // 8: protos.TestConnectionResponse.status:type_name -> protos.common.Status + 12, // 9: protos.UpdateConnectionRequest.auth:type_name -> protos.common.Auth + 13, // 10: protos.UpdateConnectionRequest.options:type_name -> protos.opts.ConnectionOptions + 14, // 11: protos.UpdateConnectionResponse.status:type_name -> protos.common.Status + 12, // 12: protos.DeleteConnectionRequest.auth:type_name -> protos.common.Auth + 14, // 13: protos.DeleteConnectionResponse.status:type_name -> protos.common.Status + 14, // [14:14] is the sub-list for method output_type + 14, // [14:14] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name +} + +func init() { file_ps_connect_proto_init() } +func file_ps_connect_proto_init() { + if File_ps_connect_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_connect_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAllConnectionsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_connect_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAllConnectionsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_connect_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetConnectionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_connect_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetConnectionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_connect_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateConnectionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_connect_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateConnectionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_connect_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestConnectionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_connect_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestConnectionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_connect_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateConnectionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_connect_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateConnectionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_connect_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteConnectionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_connect_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteConnectionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_connect_proto_rawDesc, + NumEnums: 0, + NumMessages: 12, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_connect_proto_goTypes, + DependencyIndexes: file_ps_connect_proto_depIdxs, + MessageInfos: file_ps_connect_proto_msgTypes, + }.Build() + File_ps_connect_proto = out.File + file_ps_connect_proto_rawDesc = nil + file_ps_connect_proto_goTypes = nil + file_ps_connect_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_foreman_client.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_foreman_client.pb.go index 56d1150eb..94e179b84 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_foreman_client.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_foreman_client.pb.go @@ -1,30 +1,30 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_foreman_client.proto package protos import ( - context "context" - fmt "fmt" - proto "github.com/golang/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +type ForemanRegisterRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -type RegisterRequest struct { // API token obtained from https://console.streamdal.com/account/security ApiToken string `protobuf:"bytes,1,opt,name=api_token,json=apiToken,proto3" json:"api_token,omitempty"` // Plumber cluster ID @@ -34,221 +34,233 @@ type RegisterRequest struct { // All requests back to plumber need to provide this token PlumberToken string `protobuf:"bytes,3,opt,name=plumber_token,json=plumberToken,proto3" json:"plumber_token,omitempty"` // Individual plumber instance ID - NodeId string `protobuf:"bytes,4,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + NodeId string `protobuf:"bytes,4,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` } -func (m *RegisterRequest) Reset() { *m = RegisterRequest{} } -func (m *RegisterRequest) String() string { return proto.CompactTextString(m) } -func (*RegisterRequest) ProtoMessage() {} -func (*RegisterRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e8b3f3eaace7db4c, []int{0} +func (x *ForemanRegisterRequest) Reset() { + *x = ForemanRegisterRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_foreman_client_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RegisterRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RegisterRequest.Unmarshal(m, b) -} -func (m *RegisterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RegisterRequest.Marshal(b, m, deterministic) -} -func (m *RegisterRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_RegisterRequest.Merge(m, src) -} -func (m *RegisterRequest) XXX_Size() int { - return xxx_messageInfo_RegisterRequest.Size(m) +func (x *ForemanRegisterRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RegisterRequest) XXX_DiscardUnknown() { - xxx_messageInfo_RegisterRequest.DiscardUnknown(m) + +func (*ForemanRegisterRequest) ProtoMessage() {} + +func (x *ForemanRegisterRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_foreman_client_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RegisterRequest proto.InternalMessageInfo +// Deprecated: Use ForemanRegisterRequest.ProtoReflect.Descriptor instead. +func (*ForemanRegisterRequest) Descriptor() ([]byte, []int) { + return file_ps_foreman_client_proto_rawDescGZIP(), []int{0} +} -func (m *RegisterRequest) GetApiToken() string { - if m != nil { - return m.ApiToken +func (x *ForemanRegisterRequest) GetApiToken() string { + if x != nil { + return x.ApiToken } return "" } -func (m *RegisterRequest) GetClusterId() string { - if m != nil { - return m.ClusterId +func (x *ForemanRegisterRequest) GetClusterId() string { + if x != nil { + return x.ClusterId } return "" } -func (m *RegisterRequest) GetPlumberToken() string { - if m != nil { - return m.PlumberToken +func (x *ForemanRegisterRequest) GetPlumberToken() string { + if x != nil { + return x.PlumberToken } return "" } -func (m *RegisterRequest) GetNodeId() string { - if m != nil { - return m.NodeId +func (x *ForemanRegisterRequest) GetNodeId() string { + if x != nil { + return x.NodeId } return "" } -type RegisterResponse struct { +type ForemanRegisterResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Authorized or not Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // Error message if any // Will be empty on success - Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` } -func (m *RegisterResponse) Reset() { *m = RegisterResponse{} } -func (m *RegisterResponse) String() string { return proto.CompactTextString(m) } -func (*RegisterResponse) ProtoMessage() {} -func (*RegisterResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e8b3f3eaace7db4c, []int{1} -} - -func (m *RegisterResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RegisterResponse.Unmarshal(m, b) -} -func (m *RegisterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RegisterResponse.Marshal(b, m, deterministic) -} -func (m *RegisterResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_RegisterResponse.Merge(m, src) -} -func (m *RegisterResponse) XXX_Size() int { - return xxx_messageInfo_RegisterResponse.Size(m) -} -func (m *RegisterResponse) XXX_DiscardUnknown() { - xxx_messageInfo_RegisterResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_RegisterResponse proto.InternalMessageInfo - -func (m *RegisterResponse) GetSuccess() bool { - if m != nil { - return m.Success +func (x *ForemanRegisterResponse) Reset() { + *x = ForemanRegisterResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_foreman_client_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return false } -func (m *RegisterResponse) GetMessage() string { - if m != nil { - return m.Message - } - return "" -} - -func init() { - proto.RegisterType((*RegisterRequest)(nil), "protos.RegisterRequest") - proto.RegisterType((*RegisterResponse)(nil), "protos.RegisterResponse") -} - -func init() { proto.RegisterFile("ps_foreman_client.proto", fileDescriptor_e8b3f3eaace7db4c) } - -var fileDescriptor_e8b3f3eaace7db4c = []byte{ - // 269 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0x41, 0x4b, 0xc4, 0x30, - 0x10, 0x85, 0xa9, 0xca, 0x6e, 0x3b, 0xb8, 0x28, 0xb9, 0xb4, 0x28, 0x82, 0xac, 0x17, 0x2f, 0xb6, - 0xa0, 0xe2, 0xcd, 0x8b, 0xc2, 0xc2, 0x5e, 0x3c, 0x14, 0x4f, 0x5e, 0x4a, 0x9a, 0x8e, 0x6d, 0xb0, - 0x6d, 0x62, 0x27, 0xf9, 0x15, 0xfe, 0x69, 0x69, 0x92, 0x22, 0xb8, 0xa7, 0xf0, 0xe6, 0x4d, 0x1e, - 0xef, 0x1b, 0x48, 0x35, 0x55, 0x9f, 0x6a, 0xc2, 0x81, 0x8f, 0x95, 0xe8, 0x25, 0x8e, 0x26, 0xd7, - 0x93, 0x32, 0x8a, 0xad, 0xdc, 0x43, 0xdb, 0x9f, 0x08, 0xce, 0x4a, 0x6c, 0x25, 0x19, 0x9c, 0x4a, - 0xfc, 0xb6, 0x48, 0x86, 0x5d, 0x42, 0xc2, 0xb5, 0xac, 0x8c, 0xfa, 0xc2, 0x31, 0x8b, 0xae, 0xa3, - 0xdb, 0xa4, 0x8c, 0xb9, 0x96, 0xef, 0xb3, 0x66, 0x57, 0x00, 0xa2, 0xb7, 0xf3, 0x7a, 0x25, 0x9b, - 0xec, 0xc8, 0xb9, 0x49, 0x98, 0xec, 0x1b, 0x76, 0x03, 0x1b, 0xdd, 0xdb, 0xa1, 0xc6, 0x29, 0xfc, - 0x3f, 0x76, 0x1b, 0xa7, 0x61, 0xe8, 0x33, 0x52, 0x58, 0x8f, 0xaa, 0xc1, 0x39, 0xe0, 0xc4, 0xd9, - 0xab, 0x59, 0xee, 0x9b, 0xed, 0x0e, 0xce, 0xff, 0xca, 0x90, 0x56, 0x23, 0x21, 0xcb, 0x60, 0x4d, - 0x56, 0x08, 0x24, 0x72, 0x5d, 0xe2, 0x72, 0x91, 0xb3, 0x33, 0x20, 0x11, 0x6f, 0x31, 0xf4, 0x58, - 0xe4, 0xfd, 0x1b, 0x6c, 0x76, 0x9e, 0xfa, 0xd5, 0x41, 0xb3, 0x67, 0x88, 0x97, 0x60, 0x96, 0xfa, - 0x13, 0x50, 0xfe, 0x8f, 0xfb, 0x22, 0x3b, 0x34, 0x7c, 0x87, 0x97, 0xa7, 0x8f, 0xc7, 0x56, 0x9a, - 0xce, 0xd6, 0xb9, 0x50, 0x43, 0x51, 0x73, 0x23, 0x3a, 0xa1, 0x26, 0x5d, 0x04, 0xaa, 0x3b, 0x12, - 0x1d, 0x0e, 0x9c, 0x8a, 0xda, 0xca, 0xbe, 0x29, 0x5a, 0x55, 0xf8, 0xa0, 0xda, 0x5f, 0xf9, 0xe1, - 0x37, 0x00, 0x00, 0xff, 0xff, 0x75, 0xdd, 0x99, 0xe4, 0x87, 0x01, 0x00, 0x00, +func (x *ForemanRegisterResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 +func (*ForemanRegisterResponse) ProtoMessage() {} -// ForemanClientClient is the client API for ForemanClient service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ForemanClientClient interface { - // Used by plumber to connect to Foreman and announce its presence. - Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterResponse, error) +func (x *ForemanRegisterResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_foreman_client_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -type foremanClientClient struct { - cc *grpc.ClientConn +// Deprecated: Use ForemanRegisterResponse.ProtoReflect.Descriptor instead. +func (*ForemanRegisterResponse) Descriptor() ([]byte, []int) { + return file_ps_foreman_client_proto_rawDescGZIP(), []int{1} } -func NewForemanClientClient(cc *grpc.ClientConn) ForemanClientClient { - return &foremanClientClient{cc} +func (x *ForemanRegisterResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false } -func (c *foremanClientClient) Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterResponse, error) { - out := new(RegisterResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanClient/Register", in, out, opts...) - if err != nil { - return nil, err +func (x *ForemanRegisterResponse) GetMessage() string { + if x != nil { + return x.Message } - return out, nil + return "" } -// ForemanClientServer is the server API for ForemanClient service. -type ForemanClientServer interface { - // Used by plumber to connect to Foreman and announce its presence. - Register(context.Context, *RegisterRequest) (*RegisterResponse, error) -} +var File_ps_foreman_client_proto protoreflect.FileDescriptor + +var file_ps_foreman_client_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x70, 0x73, 0x5f, 0x66, 0x6f, 0x72, 0x65, 0x6d, 0x61, 0x6e, 0x5f, 0x63, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x22, 0x92, 0x01, 0x0a, 0x16, 0x46, 0x6f, 0x72, 0x65, 0x6d, 0x61, 0x6e, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, + 0x61, 0x70, 0x69, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x61, 0x70, 0x69, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x75, + 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, + 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x6c, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0c, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x17, 0x0a, + 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x22, 0x4d, 0x0a, 0x17, 0x46, 0x6f, 0x72, 0x65, 0x6d, 0x61, + 0x6e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x5c, 0x0a, 0x0d, 0x46, 0x6f, 0x72, 0x65, 0x6d, 0x61, 0x6e, + 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x46, 0x6f, 0x72, 0x65, + 0x6d, 0x61, 0x6e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x46, 0x6f, 0x72, 0x65, + 0x6d, 0x61, 0x6e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, + 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_ps_foreman_client_proto_rawDescOnce sync.Once + file_ps_foreman_client_proto_rawDescData = file_ps_foreman_client_proto_rawDesc +) -// UnimplementedForemanClientServer can be embedded to have forward compatible implementations. -type UnimplementedForemanClientServer struct { +func file_ps_foreman_client_proto_rawDescGZIP() []byte { + file_ps_foreman_client_proto_rawDescOnce.Do(func() { + file_ps_foreman_client_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_foreman_client_proto_rawDescData) + }) + return file_ps_foreman_client_proto_rawDescData } -func (*UnimplementedForemanClientServer) Register(ctx context.Context, req *RegisterRequest) (*RegisterResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Register not implemented") +var file_ps_foreman_client_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_ps_foreman_client_proto_goTypes = []interface{}{ + (*ForemanRegisterRequest)(nil), // 0: protos.ForemanRegisterRequest + (*ForemanRegisterResponse)(nil), // 1: protos.ForemanRegisterResponse } - -func RegisterForemanClientServer(s *grpc.Server, srv ForemanClientServer) { - s.RegisterService(&_ForemanClient_serviceDesc, srv) +var file_ps_foreman_client_proto_depIdxs = []int32{ + 0, // 0: protos.ForemanClient.Register:input_type -> protos.ForemanRegisterRequest + 1, // 1: protos.ForemanClient.Register:output_type -> protos.ForemanRegisterResponse + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } -func _ForemanClient_Register_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RegisterRequest) - if err := dec(in); err != nil { - return nil, err +func init() { file_ps_foreman_client_proto_init() } +func file_ps_foreman_client_proto_init() { + if File_ps_foreman_client_proto != nil { + return } - if interceptor == nil { - return srv.(ForemanClientServer).Register(ctx, in) + if !protoimpl.UnsafeEnabled { + file_ps_foreman_client_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ForemanRegisterRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_foreman_client_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ForemanRegisterResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanClient/Register", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanClientServer).Register(ctx, req.(*RegisterRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _ForemanClient_serviceDesc = grpc.ServiceDesc{ - ServiceName: "protos.ForemanClient", - HandlerType: (*ForemanClientServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Register", - Handler: _ForemanClient_Register_Handler, + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_foreman_client_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "ps_foreman_client.proto", + GoTypes: file_ps_foreman_client_proto_goTypes, + DependencyIndexes: file_ps_foreman_client_proto_depIdxs, + MessageInfos: file_ps_foreman_client_proto_msgTypes, + }.Build() + File_ps_foreman_client_proto = out.File + file_ps_foreman_client_proto_rawDesc = nil + file_ps_foreman_client_proto_goTypes = nil + file_ps_foreman_client_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_foreman_client_grpc.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_foreman_client_grpc.pb.go new file mode 100644 index 000000000..525300db9 --- /dev/null +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_foreman_client_grpc.pb.go @@ -0,0 +1,105 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.6 +// source: ps_foreman_client.proto + +package protos + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// ForemanClientClient is the client API for ForemanClient service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ForemanClientClient interface { + // Used by plumber to connect to Foreman and announce its presence. + Register(ctx context.Context, in *ForemanRegisterRequest, opts ...grpc.CallOption) (*ForemanRegisterResponse, error) +} + +type foremanClientClient struct { + cc grpc.ClientConnInterface +} + +func NewForemanClientClient(cc grpc.ClientConnInterface) ForemanClientClient { + return &foremanClientClient{cc} +} + +func (c *foremanClientClient) Register(ctx context.Context, in *ForemanRegisterRequest, opts ...grpc.CallOption) (*ForemanRegisterResponse, error) { + out := new(ForemanRegisterResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanClient/Register", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ForemanClientServer is the server API for ForemanClient service. +// All implementations should embed UnimplementedForemanClientServer +// for forward compatibility +type ForemanClientServer interface { + // Used by plumber to connect to Foreman and announce its presence. + Register(context.Context, *ForemanRegisterRequest) (*ForemanRegisterResponse, error) +} + +// UnimplementedForemanClientServer should be embedded to have forward compatible implementations. +type UnimplementedForemanClientServer struct { +} + +func (UnimplementedForemanClientServer) Register(context.Context, *ForemanRegisterRequest) (*ForemanRegisterResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Register not implemented") +} + +// UnsafeForemanClientServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ForemanClientServer will +// result in compilation errors. +type UnsafeForemanClientServer interface { + mustEmbedUnimplementedForemanClientServer() +} + +func RegisterForemanClientServer(s grpc.ServiceRegistrar, srv ForemanClientServer) { + s.RegisterService(&ForemanClient_ServiceDesc, srv) +} + +func _ForemanClient_Register_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ForemanRegisterRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanClientServer).Register(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanClient/Register", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanClientServer).Register(ctx, req.(*ForemanRegisterRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ForemanClient_ServiceDesc is the grpc.ServiceDesc for ForemanClient service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ForemanClient_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "protos.ForemanClient", + HandlerType: (*ForemanClientServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Register", + Handler: _ForemanClient_Register_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "ps_foreman_client.proto", +} diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_foreman_server.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_foreman_server.pb.go index adc31d4e1..e8a485a57 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_foreman_server.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_foreman_server.pb.go @@ -1,1065 +1,497 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_foreman_server.proto package protos import ( - context "context" - fmt "fmt" - proto "github.com/golang/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type PlumberInfo struct { - TeamId string `protobuf:"bytes,1,opt,name=team_id,json=teamId,proto3" json:"team_id,omitempty"` - ClusterId string `protobuf:"bytes,2,opt,name=cluster_id,json=clusterId,proto3" json:"cluster_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *PlumberInfo) Reset() { *m = PlumberInfo{} } -func (m *PlumberInfo) String() string { return proto.CompactTextString(m) } -func (*PlumberInfo) ProtoMessage() {} -func (*PlumberInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_f45a754b4dc96eaa, []int{0} -} - -func (m *PlumberInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PlumberInfo.Unmarshal(m, b) -} -func (m *PlumberInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PlumberInfo.Marshal(b, m, deterministic) -} -func (m *PlumberInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_PlumberInfo.Merge(m, src) -} -func (m *PlumberInfo) XXX_Size() int { - return xxx_messageInfo_PlumberInfo.Size(m) + TeamId string `protobuf:"bytes,1,opt,name=team_id,json=teamId,proto3" json:"team_id,omitempty"` + ClusterId string `protobuf:"bytes,2,opt,name=cluster_id,json=clusterId,proto3" json:"cluster_id,omitempty"` } -func (m *PlumberInfo) XXX_DiscardUnknown() { - xxx_messageInfo_PlumberInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_PlumberInfo proto.InternalMessageInfo -func (m *PlumberInfo) GetTeamId() string { - if m != nil { - return m.TeamId +func (x *PlumberInfo) Reset() { + *x = PlumberInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_foreman_server_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return "" } -func (m *PlumberInfo) GetClusterId() string { - if m != nil { - return m.ClusterId - } - return "" +func (x *PlumberInfo) String() string { + return protoimpl.X.MessageStringOf(x) } -type ListPlumbersRequest struct { - // Authenticate between ui-bff and Foreman - AuthToken string `protobuf:"bytes,1,opt,name=auth_token,json=authToken,proto3" json:"auth_token,omitempty"` - // Team ID to list connected plumbers for - TeamId string `protobuf:"bytes,2,opt,name=team_id,json=teamId,proto3" json:"team_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} +func (*PlumberInfo) ProtoMessage() {} -func (m *ListPlumbersRequest) Reset() { *m = ListPlumbersRequest{} } -func (m *ListPlumbersRequest) String() string { return proto.CompactTextString(m) } -func (*ListPlumbersRequest) ProtoMessage() {} -func (*ListPlumbersRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f45a754b4dc96eaa, []int{1} +func (x *PlumberInfo) ProtoReflect() protoreflect.Message { + mi := &file_ps_foreman_server_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func (m *ListPlumbersRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ListPlumbersRequest.Unmarshal(m, b) -} -func (m *ListPlumbersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ListPlumbersRequest.Marshal(b, m, deterministic) -} -func (m *ListPlumbersRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListPlumbersRequest.Merge(m, src) -} -func (m *ListPlumbersRequest) XXX_Size() int { - return xxx_messageInfo_ListPlumbersRequest.Size(m) -} -func (m *ListPlumbersRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ListPlumbersRequest.DiscardUnknown(m) +// Deprecated: Use PlumberInfo.ProtoReflect.Descriptor instead. +func (*PlumberInfo) Descriptor() ([]byte, []int) { + return file_ps_foreman_server_proto_rawDescGZIP(), []int{0} } -var xxx_messageInfo_ListPlumbersRequest proto.InternalMessageInfo - -func (m *ListPlumbersRequest) GetAuthToken() string { - if m != nil { - return m.AuthToken +func (x *PlumberInfo) GetTeamId() string { + if x != nil { + return x.TeamId } return "" } -func (m *ListPlumbersRequest) GetTeamId() string { - if m != nil { - return m.TeamId +func (x *PlumberInfo) GetClusterId() string { + if x != nil { + return x.ClusterId } return "" } -type ListPlumbersResponse struct { - // List of plumbers - Plumbers []*PlumberInfo `protobuf:"bytes,1,rep,name=plumbers,proto3" json:"plumbers,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ListPlumbersResponse) Reset() { *m = ListPlumbersResponse{} } -func (m *ListPlumbersResponse) String() string { return proto.CompactTextString(m) } -func (*ListPlumbersResponse) ProtoMessage() {} -func (*ListPlumbersResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f45a754b4dc96eaa, []int{2} -} - -func (m *ListPlumbersResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ListPlumbersResponse.Unmarshal(m, b) -} -func (m *ListPlumbersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ListPlumbersResponse.Marshal(b, m, deterministic) -} -func (m *ListPlumbersResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListPlumbersResponse.Merge(m, src) -} -func (m *ListPlumbersResponse) XXX_Size() int { - return xxx_messageInfo_ListPlumbersResponse.Size(m) -} -func (m *ListPlumbersResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ListPlumbersResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ListPlumbersResponse proto.InternalMessageInfo - -func (m *ListPlumbersResponse) GetPlumbers() []*PlumberInfo { - if m != nil { - return m.Plumbers - } - return nil -} - -func init() { - proto.RegisterType((*PlumberInfo)(nil), "protos.PlumberInfo") - proto.RegisterType((*ListPlumbersRequest)(nil), "protos.ListPlumbersRequest") - proto.RegisterType((*ListPlumbersResponse)(nil), "protos.ListPlumbersResponse") -} - -func init() { proto.RegisterFile("ps_foreman_server.proto", fileDescriptor_f45a754b4dc96eaa) } - -var fileDescriptor_f45a754b4dc96eaa = []byte{ - // 625 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x96, 0x5f, 0x6f, 0xd3, 0x30, - 0x14, 0xc5, 0xd5, 0x21, 0x8d, 0xd5, 0x5d, 0xc7, 0xc8, 0x90, 0x5a, 0xba, 0x8e, 0x95, 0x3e, 0xed, - 0x85, 0x46, 0x1a, 0x88, 0x37, 0x24, 0x46, 0x61, 0x51, 0xa5, 0xa1, 0xa1, 0xae, 0x93, 0x10, 0x2f, - 0x51, 0x9a, 0xde, 0xad, 0x15, 0x49, 0x6c, 0x62, 0x07, 0x89, 0xef, 0xc2, 0x87, 0x45, 0xc9, 0x75, - 0xea, 0x7f, 0x29, 0x4f, 0x55, 0xce, 0xb9, 0xf7, 0x97, 0x13, 0x5f, 0xc7, 0x29, 0xe9, 0x31, 0x1e, - 0x3e, 0xd0, 0x1c, 0xd2, 0x28, 0x0b, 0x39, 0xe4, 0xbf, 0x21, 0x9f, 0xb0, 0x9c, 0x0a, 0xea, 0xed, - 0x57, 0x3f, 0x7c, 0x70, 0xcc, 0x78, 0x18, 0xd3, 0x2c, 0x83, 0x58, 0xa0, 0x33, 0x38, 0x62, 0x3c, - 0xcc, 0x21, 0x89, 0xfe, 0xc8, 0xeb, 0x67, 0x8c, 0x1b, 0xad, 0x95, 0x20, 0x8a, 0x2c, 0x83, 0x04, - 0x85, 0xf1, 0x17, 0xd2, 0xf9, 0x96, 0x14, 0xe9, 0x12, 0xf2, 0x59, 0xf6, 0x40, 0xbd, 0x1e, 0x79, - 0x2a, 0x20, 0x4a, 0xc3, 0xcd, 0xaa, 0xdf, 0x1a, 0xb5, 0x2e, 0xda, 0xf3, 0xfd, 0xf2, 0x72, 0xb6, - 0xf2, 0xce, 0x08, 0x89, 0x93, 0x82, 0x0b, 0xc8, 0x4b, 0x6f, 0xaf, 0xf2, 0xda, 0x52, 0x99, 0xad, - 0xc6, 0x5f, 0xc9, 0xc9, 0xcd, 0x86, 0x0b, 0x89, 0xe2, 0x73, 0xf8, 0x55, 0x00, 0x17, 0x65, 0x57, - 0x54, 0x88, 0x75, 0x28, 0xe8, 0x4f, 0xc8, 0x24, 0xb1, 0x5d, 0x2a, 0x8b, 0x52, 0xd0, 0xef, 0xb6, - 0xa7, 0xdf, 0x6d, 0x1c, 0x90, 0x17, 0x26, 0x8e, 0x33, 0x9a, 0x71, 0xf0, 0x7c, 0x72, 0xc0, 0xa4, - 0xd6, 0x6f, 0x8d, 0x9e, 0x5c, 0x74, 0x2e, 0x4f, 0xf0, 0x39, 0xf8, 0x44, 0x7b, 0x8a, 0xf9, 0xb6, - 0xe8, 0xf2, 0x6f, 0x97, 0x74, 0xaf, 0x71, 0x0d, 0xef, 0xaa, 0x75, 0xf0, 0x66, 0xe4, 0x50, 0x47, - 0x7b, 0xa7, 0x35, 0xa0, 0x21, 0xff, 0x60, 0xd8, 0x6c, 0xca, 0x34, 0xdf, 0xc9, 0xf3, 0x00, 0xc4, - 0x55, 0x92, 0x4c, 0x71, 0x08, 0x1b, 0x9a, 0x71, 0x6f, 0x54, 0xb7, 0x38, 0x56, 0x0d, 0x7d, 0xfd, - 0x9f, 0x0a, 0x49, 0xbe, 0x21, 0xdd, 0x00, 0x84, 0x72, 0xbc, 0xa1, 0xd6, 0xa3, 0xe4, 0x9a, 0x78, - 0xb6, 0xc3, 0x95, 0xb4, 0x7b, 0x72, 0x3c, 0xcd, 0x21, 0x12, 0xa0, 0x01, 0xcf, 0xeb, 0x16, 0xdb, - 0xa9, 0x99, 0xa3, 0xdd, 0x05, 0x12, 0x7b, 0x4b, 0x8e, 0x16, 0xc0, 0xf5, 0x94, 0xdb, 0x1c, 0xa6, - 0x5e, 0x23, 0x5f, 0xed, 0xb2, 0x55, 0xce, 0x7b, 0xb6, 0xda, 0x91, 0xd3, 0x76, 0x9c, 0x9c, 0x6e, - 0x81, 0xc2, 0x7e, 0x86, 0x04, 0x9a, 0xb1, 0xb6, 0xe3, 0x60, 0xdd, 0x02, 0x89, 0x9d, 0x91, 0x43, - 0x1c, 0xe0, 0xbc, 0x7c, 0xe1, 0xb4, 0x8d, 0xa4, 0xab, 0xce, 0x46, 0x32, 0x4d, 0x89, 0xfa, 0x40, - 0x0e, 0x02, 0x10, 0x95, 0xe8, 0xf5, 0xb4, 0xca, 0x4a, 0xa9, 0x11, 0x7d, 0xd7, 0x90, 0xed, 0xd7, - 0xa4, 0x83, 0x43, 0x42, 0xc2, 0xc0, 0x9c, 0x9c, 0x01, 0x39, 0x6d, 0xf4, 0x14, 0x07, 0x17, 0xd1, - 0xe2, 0x68, 0xa2, 0xc3, 0x31, 0x3c, 0xc5, 0x99, 0x03, 0x2f, 0x52, 0x9b, 0xa3, 0x89, 0x0e, 0xc7, - 0xf0, 0x24, 0xe7, 0x23, 0x69, 0xdf, 0x09, 0xca, 0x90, 0xb2, 0x7d, 0xfc, 0xad, 0x54, 0x33, 0x5e, - 0x36, 0x38, 0x2a, 0x09, 0xce, 0xcf, 0x4a, 0xa2, 0x89, 0x4e, 0x12, 0xc3, 0x53, 0x49, 0x02, 0x10, - 0x8b, 0xea, 0xe0, 0xf4, 0xf4, 0x41, 0xa0, 0xe4, 0x24, 0xd1, 0x1c, 0xe3, 0x8d, 0xbe, 0x4a, 0x12, - 0xd4, 0xb9, 0x67, 0xed, 0x08, 0x29, 0x37, 0xbd, 0xd1, 0xba, 0xab, 0xf6, 0x1e, 0x0e, 0x50, 0x46, - 0xb2, 0xc6, 0x6a, 0xa6, 0x1a, 0x36, 0x9b, 0x12, 0x35, 0x25, 0xa4, 0x5c, 0x37, 0x09, 0x32, 0xd6, - 0xd2, 0xc4, 0x0c, 0x9a, 0x2c, 0x95, 0x07, 0x07, 0x68, 0xe7, 0xd1, 0x55, 0x27, 0x8f, 0x69, 0x2a, - 0x14, 0xee, 0x29, 0x1b, 0xa5, 0xab, 0x0e, 0xca, 0x34, 0x15, 0x0a, 0x87, 0x69, 0xa3, 0x74, 0xd5, - 0x41, 0x99, 0xa6, 0x3a, 0x43, 0x02, 0x10, 0xf8, 0x09, 0xb9, 0x65, 0x78, 0xd2, 0x9f, 0x6b, 0x33, - 0x32, 0x1c, 0xe7, 0x0c, 0x71, 0x0b, 0x10, 0xfb, 0xe9, 0xfd, 0x8f, 0x77, 0x8f, 0x1b, 0xb1, 0x2e, - 0x96, 0x93, 0x98, 0xa6, 0xfe, 0x32, 0x12, 0xf1, 0x3a, 0xa6, 0x39, 0xf3, 0xe5, 0xf7, 0xeb, 0x0d, - 0x8f, 0xd7, 0x90, 0x46, 0xdc, 0x5f, 0x16, 0x9b, 0x64, 0xe5, 0x3f, 0x52, 0x1f, 0x81, 0x4b, 0xfc, - 0x07, 0xf0, 0xf6, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x71, 0xb8, 0x8b, 0x00, 0x23, 0x08, 0x00, - 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// ForemanServerClient is the client API for ForemanServer service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ForemanServerClient interface { - // ListPlumbers is called by ui-bff, received by Foreman - // It returns all connected plumber instances for a given team - ListPlumbers(ctx context.Context, in *ListPlumbersRequest, opts ...grpc.CallOption) (*ListPlumbersResponse, error) - // List configured/known connections - GetAllConnections(ctx context.Context, in *GetAllConnectionsRequest, opts ...grpc.CallOption) (*GetAllConnectionsResponse, error) - // Fetch a specific connection by ID - GetConnection(ctx context.Context, in *GetConnectionRequest, opts ...grpc.CallOption) (*GetConnectionResponse, error) - // Create a connection in plumber - CreateConnection(ctx context.Context, in *CreateConnectionRequest, opts ...grpc.CallOption) (*CreateConnectionResponse, error) - // Test a connection before saving its configuration - TestConnection(ctx context.Context, in *TestConnectionRequest, opts ...grpc.CallOption) (*TestConnectionResponse, error) - // Any active connections will be restarted - UpdateConnection(ctx context.Context, in *UpdateConnectionRequest, opts ...grpc.CallOption) (*UpdateConnectionResponse, error) - // If there are any active connections, delete will cause them to get closed - DeleteConnection(ctx context.Context, in *DeleteConnectionRequest, opts ...grpc.CallOption) (*DeleteConnectionResponse, error) - GetAllRelays(ctx context.Context, in *GetAllRelaysRequest, opts ...grpc.CallOption) (*GetAllRelaysResponse, error) - GetRelay(ctx context.Context, in *GetRelayRequest, opts ...grpc.CallOption) (*GetRelayResponse, error) - CreateRelay(ctx context.Context, in *CreateRelayRequest, opts ...grpc.CallOption) (*CreateRelayResponse, error) - UpdateRelay(ctx context.Context, in *UpdateRelayRequest, opts ...grpc.CallOption) (*UpdateRelayResponse, error) - ResumeRelay(ctx context.Context, in *ResumeRelayRequest, opts ...grpc.CallOption) (*ResumeRelayResponse, error) - StopRelay(ctx context.Context, in *StopRelayRequest, opts ...grpc.CallOption) (*StopRelayResponse, error) - DeleteRelay(ctx context.Context, in *DeleteRelayRequest, opts ...grpc.CallOption) (*DeleteRelayResponse, error) - GetTunnel(ctx context.Context, in *GetTunnelRequest, opts ...grpc.CallOption) (*GetTunnelResponse, error) - GetAllTunnels(ctx context.Context, in *GetAllTunnelsRequest, opts ...grpc.CallOption) (*GetAllTunnelsResponse, error) - CreateTunnel(ctx context.Context, in *CreateTunnelRequest, opts ...grpc.CallOption) (*CreateTunnelResponse, error) - StopTunnel(ctx context.Context, in *StopTunnelRequest, opts ...grpc.CallOption) (*StopTunnelResponse, error) - ResumeTunnel(ctx context.Context, in *ResumeTunnelRequest, opts ...grpc.CallOption) (*ResumeTunnelResponse, error) - UpdateTunnel(ctx context.Context, in *UpdateTunnelRequest, opts ...grpc.CallOption) (*UpdateTunnelResponse, error) - DeleteTunnel(ctx context.Context, in *DeleteTunnelRequest, opts ...grpc.CallOption) (*DeleteTunnelResponse, error) - GetServerOptions(ctx context.Context, in *GetServerOptionsRequest, opts ...grpc.CallOption) (*GetServerOptionsResponse, error) -} - -type foremanServerClient struct { - cc *grpc.ClientConn -} - -func NewForemanServerClient(cc *grpc.ClientConn) ForemanServerClient { - return &foremanServerClient{cc} -} - -func (c *foremanServerClient) ListPlumbers(ctx context.Context, in *ListPlumbersRequest, opts ...grpc.CallOption) (*ListPlumbersResponse, error) { - out := new(ListPlumbersResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanServer/ListPlumbers", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *foremanServerClient) GetAllConnections(ctx context.Context, in *GetAllConnectionsRequest, opts ...grpc.CallOption) (*GetAllConnectionsResponse, error) { - out := new(GetAllConnectionsResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanServer/GetAllConnections", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *foremanServerClient) GetConnection(ctx context.Context, in *GetConnectionRequest, opts ...grpc.CallOption) (*GetConnectionResponse, error) { - out := new(GetConnectionResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanServer/GetConnection", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *foremanServerClient) CreateConnection(ctx context.Context, in *CreateConnectionRequest, opts ...grpc.CallOption) (*CreateConnectionResponse, error) { - out := new(CreateConnectionResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanServer/CreateConnection", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *foremanServerClient) TestConnection(ctx context.Context, in *TestConnectionRequest, opts ...grpc.CallOption) (*TestConnectionResponse, error) { - out := new(TestConnectionResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanServer/TestConnection", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *foremanServerClient) UpdateConnection(ctx context.Context, in *UpdateConnectionRequest, opts ...grpc.CallOption) (*UpdateConnectionResponse, error) { - out := new(UpdateConnectionResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanServer/UpdateConnection", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *foremanServerClient) DeleteConnection(ctx context.Context, in *DeleteConnectionRequest, opts ...grpc.CallOption) (*DeleteConnectionResponse, error) { - out := new(DeleteConnectionResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanServer/DeleteConnection", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *foremanServerClient) GetAllRelays(ctx context.Context, in *GetAllRelaysRequest, opts ...grpc.CallOption) (*GetAllRelaysResponse, error) { - out := new(GetAllRelaysResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanServer/GetAllRelays", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *foremanServerClient) GetRelay(ctx context.Context, in *GetRelayRequest, opts ...grpc.CallOption) (*GetRelayResponse, error) { - out := new(GetRelayResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanServer/GetRelay", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *foremanServerClient) CreateRelay(ctx context.Context, in *CreateRelayRequest, opts ...grpc.CallOption) (*CreateRelayResponse, error) { - out := new(CreateRelayResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanServer/CreateRelay", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *foremanServerClient) UpdateRelay(ctx context.Context, in *UpdateRelayRequest, opts ...grpc.CallOption) (*UpdateRelayResponse, error) { - out := new(UpdateRelayResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanServer/UpdateRelay", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *foremanServerClient) ResumeRelay(ctx context.Context, in *ResumeRelayRequest, opts ...grpc.CallOption) (*ResumeRelayResponse, error) { - out := new(ResumeRelayResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanServer/ResumeRelay", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *foremanServerClient) StopRelay(ctx context.Context, in *StopRelayRequest, opts ...grpc.CallOption) (*StopRelayResponse, error) { - out := new(StopRelayResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanServer/StopRelay", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *foremanServerClient) DeleteRelay(ctx context.Context, in *DeleteRelayRequest, opts ...grpc.CallOption) (*DeleteRelayResponse, error) { - out := new(DeleteRelayResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanServer/DeleteRelay", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *foremanServerClient) GetTunnel(ctx context.Context, in *GetTunnelRequest, opts ...grpc.CallOption) (*GetTunnelResponse, error) { - out := new(GetTunnelResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanServer/GetTunnel", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *foremanServerClient) GetAllTunnels(ctx context.Context, in *GetAllTunnelsRequest, opts ...grpc.CallOption) (*GetAllTunnelsResponse, error) { - out := new(GetAllTunnelsResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanServer/GetAllTunnels", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *foremanServerClient) CreateTunnel(ctx context.Context, in *CreateTunnelRequest, opts ...grpc.CallOption) (*CreateTunnelResponse, error) { - out := new(CreateTunnelResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanServer/CreateTunnel", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *foremanServerClient) StopTunnel(ctx context.Context, in *StopTunnelRequest, opts ...grpc.CallOption) (*StopTunnelResponse, error) { - out := new(StopTunnelResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanServer/StopTunnel", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *foremanServerClient) ResumeTunnel(ctx context.Context, in *ResumeTunnelRequest, opts ...grpc.CallOption) (*ResumeTunnelResponse, error) { - out := new(ResumeTunnelResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanServer/ResumeTunnel", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *foremanServerClient) UpdateTunnel(ctx context.Context, in *UpdateTunnelRequest, opts ...grpc.CallOption) (*UpdateTunnelResponse, error) { - out := new(UpdateTunnelResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanServer/UpdateTunnel", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *foremanServerClient) DeleteTunnel(ctx context.Context, in *DeleteTunnelRequest, opts ...grpc.CallOption) (*DeleteTunnelResponse, error) { - out := new(DeleteTunnelResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanServer/DeleteTunnel", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *foremanServerClient) GetServerOptions(ctx context.Context, in *GetServerOptionsRequest, opts ...grpc.CallOption) (*GetServerOptionsResponse, error) { - out := new(GetServerOptionsResponse) - err := c.cc.Invoke(ctx, "/protos.ForemanServer/GetServerOptions", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ForemanServerServer is the server API for ForemanServer service. -type ForemanServerServer interface { - // ListPlumbers is called by ui-bff, received by Foreman - // It returns all connected plumber instances for a given team - ListPlumbers(context.Context, *ListPlumbersRequest) (*ListPlumbersResponse, error) - // List configured/known connections - GetAllConnections(context.Context, *GetAllConnectionsRequest) (*GetAllConnectionsResponse, error) - // Fetch a specific connection by ID - GetConnection(context.Context, *GetConnectionRequest) (*GetConnectionResponse, error) - // Create a connection in plumber - CreateConnection(context.Context, *CreateConnectionRequest) (*CreateConnectionResponse, error) - // Test a connection before saving its configuration - TestConnection(context.Context, *TestConnectionRequest) (*TestConnectionResponse, error) - // Any active connections will be restarted - UpdateConnection(context.Context, *UpdateConnectionRequest) (*UpdateConnectionResponse, error) - // If there are any active connections, delete will cause them to get closed - DeleteConnection(context.Context, *DeleteConnectionRequest) (*DeleteConnectionResponse, error) - GetAllRelays(context.Context, *GetAllRelaysRequest) (*GetAllRelaysResponse, error) - GetRelay(context.Context, *GetRelayRequest) (*GetRelayResponse, error) - CreateRelay(context.Context, *CreateRelayRequest) (*CreateRelayResponse, error) - UpdateRelay(context.Context, *UpdateRelayRequest) (*UpdateRelayResponse, error) - ResumeRelay(context.Context, *ResumeRelayRequest) (*ResumeRelayResponse, error) - StopRelay(context.Context, *StopRelayRequest) (*StopRelayResponse, error) - DeleteRelay(context.Context, *DeleteRelayRequest) (*DeleteRelayResponse, error) - GetTunnel(context.Context, *GetTunnelRequest) (*GetTunnelResponse, error) - GetAllTunnels(context.Context, *GetAllTunnelsRequest) (*GetAllTunnelsResponse, error) - CreateTunnel(context.Context, *CreateTunnelRequest) (*CreateTunnelResponse, error) - StopTunnel(context.Context, *StopTunnelRequest) (*StopTunnelResponse, error) - ResumeTunnel(context.Context, *ResumeTunnelRequest) (*ResumeTunnelResponse, error) - UpdateTunnel(context.Context, *UpdateTunnelRequest) (*UpdateTunnelResponse, error) - DeleteTunnel(context.Context, *DeleteTunnelRequest) (*DeleteTunnelResponse, error) - GetServerOptions(context.Context, *GetServerOptionsRequest) (*GetServerOptionsResponse, error) -} - -// UnimplementedForemanServerServer can be embedded to have forward compatible implementations. -type UnimplementedForemanServerServer struct { -} - -func (*UnimplementedForemanServerServer) ListPlumbers(ctx context.Context, req *ListPlumbersRequest) (*ListPlumbersResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListPlumbers not implemented") -} -func (*UnimplementedForemanServerServer) GetAllConnections(ctx context.Context, req *GetAllConnectionsRequest) (*GetAllConnectionsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAllConnections not implemented") -} -func (*UnimplementedForemanServerServer) GetConnection(ctx context.Context, req *GetConnectionRequest) (*GetConnectionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetConnection not implemented") -} -func (*UnimplementedForemanServerServer) CreateConnection(ctx context.Context, req *CreateConnectionRequest) (*CreateConnectionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateConnection not implemented") -} -func (*UnimplementedForemanServerServer) TestConnection(ctx context.Context, req *TestConnectionRequest) (*TestConnectionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method TestConnection not implemented") -} -func (*UnimplementedForemanServerServer) UpdateConnection(ctx context.Context, req *UpdateConnectionRequest) (*UpdateConnectionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateConnection not implemented") -} -func (*UnimplementedForemanServerServer) DeleteConnection(ctx context.Context, req *DeleteConnectionRequest) (*DeleteConnectionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteConnection not implemented") -} -func (*UnimplementedForemanServerServer) GetAllRelays(ctx context.Context, req *GetAllRelaysRequest) (*GetAllRelaysResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAllRelays not implemented") -} -func (*UnimplementedForemanServerServer) GetRelay(ctx context.Context, req *GetRelayRequest) (*GetRelayResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetRelay not implemented") -} -func (*UnimplementedForemanServerServer) CreateRelay(ctx context.Context, req *CreateRelayRequest) (*CreateRelayResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateRelay not implemented") -} -func (*UnimplementedForemanServerServer) UpdateRelay(ctx context.Context, req *UpdateRelayRequest) (*UpdateRelayResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateRelay not implemented") -} -func (*UnimplementedForemanServerServer) ResumeRelay(ctx context.Context, req *ResumeRelayRequest) (*ResumeRelayResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ResumeRelay not implemented") -} -func (*UnimplementedForemanServerServer) StopRelay(ctx context.Context, req *StopRelayRequest) (*StopRelayResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method StopRelay not implemented") -} -func (*UnimplementedForemanServerServer) DeleteRelay(ctx context.Context, req *DeleteRelayRequest) (*DeleteRelayResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteRelay not implemented") -} -func (*UnimplementedForemanServerServer) GetTunnel(ctx context.Context, req *GetTunnelRequest) (*GetTunnelResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetTunnel not implemented") -} -func (*UnimplementedForemanServerServer) GetAllTunnels(ctx context.Context, req *GetAllTunnelsRequest) (*GetAllTunnelsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAllTunnels not implemented") -} -func (*UnimplementedForemanServerServer) CreateTunnel(ctx context.Context, req *CreateTunnelRequest) (*CreateTunnelResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateTunnel not implemented") -} -func (*UnimplementedForemanServerServer) StopTunnel(ctx context.Context, req *StopTunnelRequest) (*StopTunnelResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method StopTunnel not implemented") -} -func (*UnimplementedForemanServerServer) ResumeTunnel(ctx context.Context, req *ResumeTunnelRequest) (*ResumeTunnelResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ResumeTunnel not implemented") -} -func (*UnimplementedForemanServerServer) UpdateTunnel(ctx context.Context, req *UpdateTunnelRequest) (*UpdateTunnelResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateTunnel not implemented") -} -func (*UnimplementedForemanServerServer) DeleteTunnel(ctx context.Context, req *DeleteTunnelRequest) (*DeleteTunnelResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteTunnel not implemented") -} -func (*UnimplementedForemanServerServer) GetServerOptions(ctx context.Context, req *GetServerOptionsRequest) (*GetServerOptionsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetServerOptions not implemented") -} - -func RegisterForemanServerServer(s *grpc.Server, srv ForemanServerServer) { - s.RegisterService(&_ForemanServer_serviceDesc, srv) -} - -func _ForemanServer_ListPlumbers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListPlumbersRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ForemanServerServer).ListPlumbers(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanServer/ListPlumbers", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanServerServer).ListPlumbers(ctx, req.(*ListPlumbersRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ForemanServer_GetAllConnections_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetAllConnectionsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ForemanServerServer).GetAllConnections(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanServer/GetAllConnections", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanServerServer).GetAllConnections(ctx, req.(*GetAllConnectionsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ForemanServer_GetConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetConnectionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ForemanServerServer).GetConnection(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanServer/GetConnection", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanServerServer).GetConnection(ctx, req.(*GetConnectionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ForemanServer_CreateConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateConnectionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ForemanServerServer).CreateConnection(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanServer/CreateConnection", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanServerServer).CreateConnection(ctx, req.(*CreateConnectionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ForemanServer_TestConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(TestConnectionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ForemanServerServer).TestConnection(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanServer/TestConnection", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanServerServer).TestConnection(ctx, req.(*TestConnectionRequest)) - } - return interceptor(ctx, in, info, handler) -} +type ListPlumbersRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func _ForemanServer_UpdateConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateConnectionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ForemanServerServer).UpdateConnection(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanServer/UpdateConnection", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanServerServer).UpdateConnection(ctx, req.(*UpdateConnectionRequest)) - } - return interceptor(ctx, in, info, handler) + // Authenticate between ui-bff and Foreman + AuthToken string `protobuf:"bytes,1,opt,name=auth_token,json=authToken,proto3" json:"auth_token,omitempty"` + // Team ID to list connected plumbers for + TeamId string `protobuf:"bytes,2,opt,name=team_id,json=teamId,proto3" json:"team_id,omitempty"` } -func _ForemanServer_DeleteConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteConnectionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ForemanServerServer).DeleteConnection(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanServer/DeleteConnection", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanServerServer).DeleteConnection(ctx, req.(*DeleteConnectionRequest)) +func (x *ListPlumbersRequest) Reset() { + *x = ListPlumbersRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_foreman_server_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return interceptor(ctx, in, info, handler) } -func _ForemanServer_GetAllRelays_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetAllRelaysRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ForemanServerServer).GetAllRelays(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanServer/GetAllRelays", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanServerServer).GetAllRelays(ctx, req.(*GetAllRelaysRequest)) - } - return interceptor(ctx, in, info, handler) +func (x *ListPlumbersRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func _ForemanServer_GetRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetRelayRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ForemanServerServer).GetRelay(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanServer/GetRelay", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanServerServer).GetRelay(ctx, req.(*GetRelayRequest)) - } - return interceptor(ctx, in, info, handler) -} +func (*ListPlumbersRequest) ProtoMessage() {} -func _ForemanServer_CreateRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateRelayRequest) - if err := dec(in); err != nil { - return nil, err +func (x *ListPlumbersRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_foreman_server_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - if interceptor == nil { - return srv.(ForemanServerServer).CreateRelay(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanServer/CreateRelay", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanServerServer).CreateRelay(ctx, req.(*CreateRelayRequest)) - } - return interceptor(ctx, in, info, handler) + return mi.MessageOf(x) } -func _ForemanServer_UpdateRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateRelayRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ForemanServerServer).UpdateRelay(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanServer/UpdateRelay", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanServerServer).UpdateRelay(ctx, req.(*UpdateRelayRequest)) - } - return interceptor(ctx, in, info, handler) +// Deprecated: Use ListPlumbersRequest.ProtoReflect.Descriptor instead. +func (*ListPlumbersRequest) Descriptor() ([]byte, []int) { + return file_ps_foreman_server_proto_rawDescGZIP(), []int{1} } -func _ForemanServer_ResumeRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ResumeRelayRequest) - if err := dec(in); err != nil { - return nil, err +func (x *ListPlumbersRequest) GetAuthToken() string { + if x != nil { + return x.AuthToken } - if interceptor == nil { - return srv.(ForemanServerServer).ResumeRelay(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanServer/ResumeRelay", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanServerServer).ResumeRelay(ctx, req.(*ResumeRelayRequest)) - } - return interceptor(ctx, in, info, handler) + return "" } -func _ForemanServer_StopRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StopRelayRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ForemanServerServer).StopRelay(ctx, in) +func (x *ListPlumbersRequest) GetTeamId() string { + if x != nil { + return x.TeamId } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanServer/StopRelay", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanServerServer).StopRelay(ctx, req.(*StopRelayRequest)) - } - return interceptor(ctx, in, info, handler) + return "" } -func _ForemanServer_DeleteRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteRelayRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ForemanServerServer).DeleteRelay(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanServer/DeleteRelay", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanServerServer).DeleteRelay(ctx, req.(*DeleteRelayRequest)) - } - return interceptor(ctx, in, info, handler) -} +type ListPlumbersResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func _ForemanServer_GetTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetTunnelRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ForemanServerServer).GetTunnel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanServer/GetTunnel", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanServerServer).GetTunnel(ctx, req.(*GetTunnelRequest)) - } - return interceptor(ctx, in, info, handler) + // List of plumbers + Plumbers []*PlumberInfo `protobuf:"bytes,1,rep,name=plumbers,proto3" json:"plumbers,omitempty"` } -func _ForemanServer_GetAllTunnels_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetAllTunnelsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ForemanServerServer).GetAllTunnels(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanServer/GetAllTunnels", +func (x *ListPlumbersResponse) Reset() { + *x = ListPlumbersResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_foreman_server_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanServerServer).GetAllTunnels(ctx, req.(*GetAllTunnelsRequest)) - } - return interceptor(ctx, in, info, handler) } -func _ForemanServer_CreateTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateTunnelRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ForemanServerServer).CreateTunnel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanServer/CreateTunnel", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanServerServer).CreateTunnel(ctx, req.(*CreateTunnelRequest)) - } - return interceptor(ctx, in, info, handler) +func (x *ListPlumbersResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func _ForemanServer_StopTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StopTunnelRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ForemanServerServer).StopTunnel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanServer/StopTunnel", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanServerServer).StopTunnel(ctx, req.(*StopTunnelRequest)) - } - return interceptor(ctx, in, info, handler) -} +func (*ListPlumbersResponse) ProtoMessage() {} -func _ForemanServer_ResumeTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ResumeTunnelRequest) - if err := dec(in); err != nil { - return nil, err +func (x *ListPlumbersResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_foreman_server_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - if interceptor == nil { - return srv.(ForemanServerServer).ResumeTunnel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanServer/ResumeTunnel", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanServerServer).ResumeTunnel(ctx, req.(*ResumeTunnelRequest)) - } - return interceptor(ctx, in, info, handler) + return mi.MessageOf(x) } -func _ForemanServer_UpdateTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateTunnelRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ForemanServerServer).UpdateTunnel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanServer/UpdateTunnel", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanServerServer).UpdateTunnel(ctx, req.(*UpdateTunnelRequest)) - } - return interceptor(ctx, in, info, handler) +// Deprecated: Use ListPlumbersResponse.ProtoReflect.Descriptor instead. +func (*ListPlumbersResponse) Descriptor() ([]byte, []int) { + return file_ps_foreman_server_proto_rawDescGZIP(), []int{2} } -func _ForemanServer_DeleteTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteTunnelRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ForemanServerServer).DeleteTunnel(ctx, in) +func (x *ListPlumbersResponse) GetPlumbers() []*PlumberInfo { + if x != nil { + return x.Plumbers } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanServer/DeleteTunnel", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanServerServer).DeleteTunnel(ctx, req.(*DeleteTunnelRequest)) - } - return interceptor(ctx, in, info, handler) + return nil } -func _ForemanServer_GetServerOptions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetServerOptionsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ForemanServerServer).GetServerOptions(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/protos.ForemanServer/GetServerOptions", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ForemanServerServer).GetServerOptions(ctx, req.(*GetServerOptionsRequest)) - } - return interceptor(ctx, in, info, handler) -} +var File_ps_foreman_server_proto protoreflect.FileDescriptor + +var file_ps_foreman_server_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x70, 0x73, 0x5f, 0x66, 0x6f, 0x72, 0x65, 0x6d, 0x61, 0x6e, 0x5f, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x1a, 0x10, 0x70, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x0e, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x70, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x70, 0x73, 0x5f, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x45, 0x0a, 0x0b, 0x50, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x65, 0x61, 0x6d, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x12, 0x1d, 0x0a, + 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x22, 0x4d, 0x0a, 0x13, + 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x65, 0x61, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x22, 0x47, 0x0a, 0x14, 0x4c, + 0x69, 0x73, 0x74, 0x50, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x08, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x50, + 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x70, 0x6c, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x73, 0x32, 0x9c, 0x0d, 0x0a, 0x0d, 0x46, 0x6f, 0x72, 0x65, 0x6d, 0x61, 0x6e, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x49, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6c, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x50, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x58, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x0d, 0x47, + 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x10, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x4f, 0x0a, 0x0e, 0x54, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x54, 0x65, 0x73, 0x74, + 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x43, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x55, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x49, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, + 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, + 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x61, + 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3d, 0x0a, 0x08, 0x47, 0x65, + 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x0b, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x46, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, + 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x6c, 0x61, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x0b, 0x52, 0x65, 0x73, + 0x75, 0x6d, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x52, 0x65, + 0x73, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x40, 0x0a, 0x09, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x18, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x6c, 0x61, + 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x0b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x6c, + 0x61, 0x79, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, + 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x09, 0x47, + 0x65, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x54, + 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, + 0x0d, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x12, 0x1c, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x54, 0x75, + 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x54, 0x75, 0x6e, 0x6e, + 0x65, 0x6c, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0c, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x1b, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, + 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x0a, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x75, + 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, + 0x6f, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x75, 0x6e, + 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0c, 0x52, + 0x65, 0x73, 0x75, 0x6d, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x1b, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, + 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x49, 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, + 0x6c, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x75, + 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x10, + 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, + 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_ps_foreman_server_proto_rawDescOnce sync.Once + file_ps_foreman_server_proto_rawDescData = file_ps_foreman_server_proto_rawDesc +) -var _ForemanServer_serviceDesc = grpc.ServiceDesc{ - ServiceName: "protos.ForemanServer", - HandlerType: (*ForemanServerServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ListPlumbers", - Handler: _ForemanServer_ListPlumbers_Handler, - }, - { - MethodName: "GetAllConnections", - Handler: _ForemanServer_GetAllConnections_Handler, - }, - { - MethodName: "GetConnection", - Handler: _ForemanServer_GetConnection_Handler, - }, - { - MethodName: "CreateConnection", - Handler: _ForemanServer_CreateConnection_Handler, - }, - { - MethodName: "TestConnection", - Handler: _ForemanServer_TestConnection_Handler, - }, - { - MethodName: "UpdateConnection", - Handler: _ForemanServer_UpdateConnection_Handler, - }, - { - MethodName: "DeleteConnection", - Handler: _ForemanServer_DeleteConnection_Handler, - }, - { - MethodName: "GetAllRelays", - Handler: _ForemanServer_GetAllRelays_Handler, - }, - { - MethodName: "GetRelay", - Handler: _ForemanServer_GetRelay_Handler, - }, - { - MethodName: "CreateRelay", - Handler: _ForemanServer_CreateRelay_Handler, - }, - { - MethodName: "UpdateRelay", - Handler: _ForemanServer_UpdateRelay_Handler, - }, - { - MethodName: "ResumeRelay", - Handler: _ForemanServer_ResumeRelay_Handler, - }, - { - MethodName: "StopRelay", - Handler: _ForemanServer_StopRelay_Handler, - }, - { - MethodName: "DeleteRelay", - Handler: _ForemanServer_DeleteRelay_Handler, - }, - { - MethodName: "GetTunnel", - Handler: _ForemanServer_GetTunnel_Handler, - }, - { - MethodName: "GetAllTunnels", - Handler: _ForemanServer_GetAllTunnels_Handler, - }, - { - MethodName: "CreateTunnel", - Handler: _ForemanServer_CreateTunnel_Handler, - }, - { - MethodName: "StopTunnel", - Handler: _ForemanServer_StopTunnel_Handler, - }, - { - MethodName: "ResumeTunnel", - Handler: _ForemanServer_ResumeTunnel_Handler, - }, - { - MethodName: "UpdateTunnel", - Handler: _ForemanServer_UpdateTunnel_Handler, - }, - { - MethodName: "DeleteTunnel", - Handler: _ForemanServer_DeleteTunnel_Handler, - }, - { - MethodName: "GetServerOptions", - Handler: _ForemanServer_GetServerOptions_Handler, +func file_ps_foreman_server_proto_rawDescGZIP() []byte { + file_ps_foreman_server_proto_rawDescOnce.Do(func() { + file_ps_foreman_server_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_foreman_server_proto_rawDescData) + }) + return file_ps_foreman_server_proto_rawDescData +} + +var file_ps_foreman_server_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_ps_foreman_server_proto_goTypes = []interface{}{ + (*PlumberInfo)(nil), // 0: protos.PlumberInfo + (*ListPlumbersRequest)(nil), // 1: protos.ListPlumbersRequest + (*ListPlumbersResponse)(nil), // 2: protos.ListPlumbersResponse + (*GetAllConnectionsRequest)(nil), // 3: protos.GetAllConnectionsRequest + (*GetConnectionRequest)(nil), // 4: protos.GetConnectionRequest + (*CreateConnectionRequest)(nil), // 5: protos.CreateConnectionRequest + (*TestConnectionRequest)(nil), // 6: protos.TestConnectionRequest + (*UpdateConnectionRequest)(nil), // 7: protos.UpdateConnectionRequest + (*DeleteConnectionRequest)(nil), // 8: protos.DeleteConnectionRequest + (*GetAllRelaysRequest)(nil), // 9: protos.GetAllRelaysRequest + (*GetRelayRequest)(nil), // 10: protos.GetRelayRequest + (*CreateRelayRequest)(nil), // 11: protos.CreateRelayRequest + (*UpdateRelayRequest)(nil), // 12: protos.UpdateRelayRequest + (*ResumeRelayRequest)(nil), // 13: protos.ResumeRelayRequest + (*StopRelayRequest)(nil), // 14: protos.StopRelayRequest + (*DeleteRelayRequest)(nil), // 15: protos.DeleteRelayRequest + (*GetTunnelRequest)(nil), // 16: protos.GetTunnelRequest + (*GetAllTunnelsRequest)(nil), // 17: protos.GetAllTunnelsRequest + (*CreateTunnelRequest)(nil), // 18: protos.CreateTunnelRequest + (*StopTunnelRequest)(nil), // 19: protos.StopTunnelRequest + (*ResumeTunnelRequest)(nil), // 20: protos.ResumeTunnelRequest + (*UpdateTunnelRequest)(nil), // 21: protos.UpdateTunnelRequest + (*DeleteTunnelRequest)(nil), // 22: protos.DeleteTunnelRequest + (*GetServerOptionsRequest)(nil), // 23: protos.GetServerOptionsRequest + (*GetAllConnectionsResponse)(nil), // 24: protos.GetAllConnectionsResponse + (*GetConnectionResponse)(nil), // 25: protos.GetConnectionResponse + (*CreateConnectionResponse)(nil), // 26: protos.CreateConnectionResponse + (*TestConnectionResponse)(nil), // 27: protos.TestConnectionResponse + (*UpdateConnectionResponse)(nil), // 28: protos.UpdateConnectionResponse + (*DeleteConnectionResponse)(nil), // 29: protos.DeleteConnectionResponse + (*GetAllRelaysResponse)(nil), // 30: protos.GetAllRelaysResponse + (*GetRelayResponse)(nil), // 31: protos.GetRelayResponse + (*CreateRelayResponse)(nil), // 32: protos.CreateRelayResponse + (*UpdateRelayResponse)(nil), // 33: protos.UpdateRelayResponse + (*ResumeRelayResponse)(nil), // 34: protos.ResumeRelayResponse + (*StopRelayResponse)(nil), // 35: protos.StopRelayResponse + (*DeleteRelayResponse)(nil), // 36: protos.DeleteRelayResponse + (*GetTunnelResponse)(nil), // 37: protos.GetTunnelResponse + (*GetAllTunnelsResponse)(nil), // 38: protos.GetAllTunnelsResponse + (*CreateTunnelResponse)(nil), // 39: protos.CreateTunnelResponse + (*StopTunnelResponse)(nil), // 40: protos.StopTunnelResponse + (*ResumeTunnelResponse)(nil), // 41: protos.ResumeTunnelResponse + (*UpdateTunnelResponse)(nil), // 42: protos.UpdateTunnelResponse + (*DeleteTunnelResponse)(nil), // 43: protos.DeleteTunnelResponse + (*GetServerOptionsResponse)(nil), // 44: protos.GetServerOptionsResponse +} +var file_ps_foreman_server_proto_depIdxs = []int32{ + 0, // 0: protos.ListPlumbersResponse.plumbers:type_name -> protos.PlumberInfo + 1, // 1: protos.ForemanServer.ListPlumbers:input_type -> protos.ListPlumbersRequest + 3, // 2: protos.ForemanServer.GetAllConnections:input_type -> protos.GetAllConnectionsRequest + 4, // 3: protos.ForemanServer.GetConnection:input_type -> protos.GetConnectionRequest + 5, // 4: protos.ForemanServer.CreateConnection:input_type -> protos.CreateConnectionRequest + 6, // 5: protos.ForemanServer.TestConnection:input_type -> protos.TestConnectionRequest + 7, // 6: protos.ForemanServer.UpdateConnection:input_type -> protos.UpdateConnectionRequest + 8, // 7: protos.ForemanServer.DeleteConnection:input_type -> protos.DeleteConnectionRequest + 9, // 8: protos.ForemanServer.GetAllRelays:input_type -> protos.GetAllRelaysRequest + 10, // 9: protos.ForemanServer.GetRelay:input_type -> protos.GetRelayRequest + 11, // 10: protos.ForemanServer.CreateRelay:input_type -> protos.CreateRelayRequest + 12, // 11: protos.ForemanServer.UpdateRelay:input_type -> protos.UpdateRelayRequest + 13, // 12: protos.ForemanServer.ResumeRelay:input_type -> protos.ResumeRelayRequest + 14, // 13: protos.ForemanServer.StopRelay:input_type -> protos.StopRelayRequest + 15, // 14: protos.ForemanServer.DeleteRelay:input_type -> protos.DeleteRelayRequest + 16, // 15: protos.ForemanServer.GetTunnel:input_type -> protos.GetTunnelRequest + 17, // 16: protos.ForemanServer.GetAllTunnels:input_type -> protos.GetAllTunnelsRequest + 18, // 17: protos.ForemanServer.CreateTunnel:input_type -> protos.CreateTunnelRequest + 19, // 18: protos.ForemanServer.StopTunnel:input_type -> protos.StopTunnelRequest + 20, // 19: protos.ForemanServer.ResumeTunnel:input_type -> protos.ResumeTunnelRequest + 21, // 20: protos.ForemanServer.UpdateTunnel:input_type -> protos.UpdateTunnelRequest + 22, // 21: protos.ForemanServer.DeleteTunnel:input_type -> protos.DeleteTunnelRequest + 23, // 22: protos.ForemanServer.GetServerOptions:input_type -> protos.GetServerOptionsRequest + 2, // 23: protos.ForemanServer.ListPlumbers:output_type -> protos.ListPlumbersResponse + 24, // 24: protos.ForemanServer.GetAllConnections:output_type -> protos.GetAllConnectionsResponse + 25, // 25: protos.ForemanServer.GetConnection:output_type -> protos.GetConnectionResponse + 26, // 26: protos.ForemanServer.CreateConnection:output_type -> protos.CreateConnectionResponse + 27, // 27: protos.ForemanServer.TestConnection:output_type -> protos.TestConnectionResponse + 28, // 28: protos.ForemanServer.UpdateConnection:output_type -> protos.UpdateConnectionResponse + 29, // 29: protos.ForemanServer.DeleteConnection:output_type -> protos.DeleteConnectionResponse + 30, // 30: protos.ForemanServer.GetAllRelays:output_type -> protos.GetAllRelaysResponse + 31, // 31: protos.ForemanServer.GetRelay:output_type -> protos.GetRelayResponse + 32, // 32: protos.ForemanServer.CreateRelay:output_type -> protos.CreateRelayResponse + 33, // 33: protos.ForemanServer.UpdateRelay:output_type -> protos.UpdateRelayResponse + 34, // 34: protos.ForemanServer.ResumeRelay:output_type -> protos.ResumeRelayResponse + 35, // 35: protos.ForemanServer.StopRelay:output_type -> protos.StopRelayResponse + 36, // 36: protos.ForemanServer.DeleteRelay:output_type -> protos.DeleteRelayResponse + 37, // 37: protos.ForemanServer.GetTunnel:output_type -> protos.GetTunnelResponse + 38, // 38: protos.ForemanServer.GetAllTunnels:output_type -> protos.GetAllTunnelsResponse + 39, // 39: protos.ForemanServer.CreateTunnel:output_type -> protos.CreateTunnelResponse + 40, // 40: protos.ForemanServer.StopTunnel:output_type -> protos.StopTunnelResponse + 41, // 41: protos.ForemanServer.ResumeTunnel:output_type -> protos.ResumeTunnelResponse + 42, // 42: protos.ForemanServer.UpdateTunnel:output_type -> protos.UpdateTunnelResponse + 43, // 43: protos.ForemanServer.DeleteTunnel:output_type -> protos.DeleteTunnelResponse + 44, // 44: protos.ForemanServer.GetServerOptions:output_type -> protos.GetServerOptionsResponse + 23, // [23:45] is the sub-list for method output_type + 1, // [1:23] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_ps_foreman_server_proto_init() } +func file_ps_foreman_server_proto_init() { + if File_ps_foreman_server_proto != nil { + return + } + file_ps_connect_proto_init() + file_ps_relay_proto_init() + file_ps_server_proto_init() + file_ps_tunnel_proto_init() + if !protoimpl.UnsafeEnabled { + file_ps_foreman_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PlumberInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_foreman_server_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListPlumbersRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_foreman_server_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListPlumbersResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_foreman_server_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "ps_foreman_server.proto", + GoTypes: file_ps_foreman_server_proto_goTypes, + DependencyIndexes: file_ps_foreman_server_proto_depIdxs, + MessageInfos: file_ps_foreman_server_proto_msgTypes, + }.Build() + File_ps_foreman_server_proto = out.File + file_ps_foreman_server_proto_rawDesc = nil + file_ps_foreman_server_proto_goTypes = nil + file_ps_foreman_server_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_foreman_server_grpc.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_foreman_server_grpc.pb.go new file mode 100644 index 000000000..2715fd733 --- /dev/null +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_foreman_server_grpc.pb.go @@ -0,0 +1,875 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.6 +// source: ps_foreman_server.proto + +package protos + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// ForemanServerClient is the client API for ForemanServer service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ForemanServerClient interface { + // ListPlumbers is called by ui-bff, received by Foreman + // It returns all connected plumber instances for a given team + ListPlumbers(ctx context.Context, in *ListPlumbersRequest, opts ...grpc.CallOption) (*ListPlumbersResponse, error) + // List configured/known connections + GetAllConnections(ctx context.Context, in *GetAllConnectionsRequest, opts ...grpc.CallOption) (*GetAllConnectionsResponse, error) + // Fetch a specific connection by ID + GetConnection(ctx context.Context, in *GetConnectionRequest, opts ...grpc.CallOption) (*GetConnectionResponse, error) + // Create a connection in plumber + CreateConnection(ctx context.Context, in *CreateConnectionRequest, opts ...grpc.CallOption) (*CreateConnectionResponse, error) + // Test a connection before saving its configuration + TestConnection(ctx context.Context, in *TestConnectionRequest, opts ...grpc.CallOption) (*TestConnectionResponse, error) + // Any active connections will be restarted + UpdateConnection(ctx context.Context, in *UpdateConnectionRequest, opts ...grpc.CallOption) (*UpdateConnectionResponse, error) + // If there are any active connections, delete will cause them to get closed + DeleteConnection(ctx context.Context, in *DeleteConnectionRequest, opts ...grpc.CallOption) (*DeleteConnectionResponse, error) + GetAllRelays(ctx context.Context, in *GetAllRelaysRequest, opts ...grpc.CallOption) (*GetAllRelaysResponse, error) + GetRelay(ctx context.Context, in *GetRelayRequest, opts ...grpc.CallOption) (*GetRelayResponse, error) + CreateRelay(ctx context.Context, in *CreateRelayRequest, opts ...grpc.CallOption) (*CreateRelayResponse, error) + UpdateRelay(ctx context.Context, in *UpdateRelayRequest, opts ...grpc.CallOption) (*UpdateRelayResponse, error) + ResumeRelay(ctx context.Context, in *ResumeRelayRequest, opts ...grpc.CallOption) (*ResumeRelayResponse, error) + StopRelay(ctx context.Context, in *StopRelayRequest, opts ...grpc.CallOption) (*StopRelayResponse, error) + DeleteRelay(ctx context.Context, in *DeleteRelayRequest, opts ...grpc.CallOption) (*DeleteRelayResponse, error) + GetTunnel(ctx context.Context, in *GetTunnelRequest, opts ...grpc.CallOption) (*GetTunnelResponse, error) + GetAllTunnels(ctx context.Context, in *GetAllTunnelsRequest, opts ...grpc.CallOption) (*GetAllTunnelsResponse, error) + CreateTunnel(ctx context.Context, in *CreateTunnelRequest, opts ...grpc.CallOption) (*CreateTunnelResponse, error) + StopTunnel(ctx context.Context, in *StopTunnelRequest, opts ...grpc.CallOption) (*StopTunnelResponse, error) + ResumeTunnel(ctx context.Context, in *ResumeTunnelRequest, opts ...grpc.CallOption) (*ResumeTunnelResponse, error) + UpdateTunnel(ctx context.Context, in *UpdateTunnelRequest, opts ...grpc.CallOption) (*UpdateTunnelResponse, error) + DeleteTunnel(ctx context.Context, in *DeleteTunnelRequest, opts ...grpc.CallOption) (*DeleteTunnelResponse, error) + GetServerOptions(ctx context.Context, in *GetServerOptionsRequest, opts ...grpc.CallOption) (*GetServerOptionsResponse, error) +} + +type foremanServerClient struct { + cc grpc.ClientConnInterface +} + +func NewForemanServerClient(cc grpc.ClientConnInterface) ForemanServerClient { + return &foremanServerClient{cc} +} + +func (c *foremanServerClient) ListPlumbers(ctx context.Context, in *ListPlumbersRequest, opts ...grpc.CallOption) (*ListPlumbersResponse, error) { + out := new(ListPlumbersResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanServer/ListPlumbers", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *foremanServerClient) GetAllConnections(ctx context.Context, in *GetAllConnectionsRequest, opts ...grpc.CallOption) (*GetAllConnectionsResponse, error) { + out := new(GetAllConnectionsResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanServer/GetAllConnections", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *foremanServerClient) GetConnection(ctx context.Context, in *GetConnectionRequest, opts ...grpc.CallOption) (*GetConnectionResponse, error) { + out := new(GetConnectionResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanServer/GetConnection", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *foremanServerClient) CreateConnection(ctx context.Context, in *CreateConnectionRequest, opts ...grpc.CallOption) (*CreateConnectionResponse, error) { + out := new(CreateConnectionResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanServer/CreateConnection", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *foremanServerClient) TestConnection(ctx context.Context, in *TestConnectionRequest, opts ...grpc.CallOption) (*TestConnectionResponse, error) { + out := new(TestConnectionResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanServer/TestConnection", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *foremanServerClient) UpdateConnection(ctx context.Context, in *UpdateConnectionRequest, opts ...grpc.CallOption) (*UpdateConnectionResponse, error) { + out := new(UpdateConnectionResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanServer/UpdateConnection", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *foremanServerClient) DeleteConnection(ctx context.Context, in *DeleteConnectionRequest, opts ...grpc.CallOption) (*DeleteConnectionResponse, error) { + out := new(DeleteConnectionResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanServer/DeleteConnection", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *foremanServerClient) GetAllRelays(ctx context.Context, in *GetAllRelaysRequest, opts ...grpc.CallOption) (*GetAllRelaysResponse, error) { + out := new(GetAllRelaysResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanServer/GetAllRelays", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *foremanServerClient) GetRelay(ctx context.Context, in *GetRelayRequest, opts ...grpc.CallOption) (*GetRelayResponse, error) { + out := new(GetRelayResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanServer/GetRelay", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *foremanServerClient) CreateRelay(ctx context.Context, in *CreateRelayRequest, opts ...grpc.CallOption) (*CreateRelayResponse, error) { + out := new(CreateRelayResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanServer/CreateRelay", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *foremanServerClient) UpdateRelay(ctx context.Context, in *UpdateRelayRequest, opts ...grpc.CallOption) (*UpdateRelayResponse, error) { + out := new(UpdateRelayResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanServer/UpdateRelay", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *foremanServerClient) ResumeRelay(ctx context.Context, in *ResumeRelayRequest, opts ...grpc.CallOption) (*ResumeRelayResponse, error) { + out := new(ResumeRelayResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanServer/ResumeRelay", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *foremanServerClient) StopRelay(ctx context.Context, in *StopRelayRequest, opts ...grpc.CallOption) (*StopRelayResponse, error) { + out := new(StopRelayResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanServer/StopRelay", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *foremanServerClient) DeleteRelay(ctx context.Context, in *DeleteRelayRequest, opts ...grpc.CallOption) (*DeleteRelayResponse, error) { + out := new(DeleteRelayResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanServer/DeleteRelay", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *foremanServerClient) GetTunnel(ctx context.Context, in *GetTunnelRequest, opts ...grpc.CallOption) (*GetTunnelResponse, error) { + out := new(GetTunnelResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanServer/GetTunnel", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *foremanServerClient) GetAllTunnels(ctx context.Context, in *GetAllTunnelsRequest, opts ...grpc.CallOption) (*GetAllTunnelsResponse, error) { + out := new(GetAllTunnelsResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanServer/GetAllTunnels", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *foremanServerClient) CreateTunnel(ctx context.Context, in *CreateTunnelRequest, opts ...grpc.CallOption) (*CreateTunnelResponse, error) { + out := new(CreateTunnelResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanServer/CreateTunnel", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *foremanServerClient) StopTunnel(ctx context.Context, in *StopTunnelRequest, opts ...grpc.CallOption) (*StopTunnelResponse, error) { + out := new(StopTunnelResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanServer/StopTunnel", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *foremanServerClient) ResumeTunnel(ctx context.Context, in *ResumeTunnelRequest, opts ...grpc.CallOption) (*ResumeTunnelResponse, error) { + out := new(ResumeTunnelResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanServer/ResumeTunnel", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *foremanServerClient) UpdateTunnel(ctx context.Context, in *UpdateTunnelRequest, opts ...grpc.CallOption) (*UpdateTunnelResponse, error) { + out := new(UpdateTunnelResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanServer/UpdateTunnel", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *foremanServerClient) DeleteTunnel(ctx context.Context, in *DeleteTunnelRequest, opts ...grpc.CallOption) (*DeleteTunnelResponse, error) { + out := new(DeleteTunnelResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanServer/DeleteTunnel", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *foremanServerClient) GetServerOptions(ctx context.Context, in *GetServerOptionsRequest, opts ...grpc.CallOption) (*GetServerOptionsResponse, error) { + out := new(GetServerOptionsResponse) + err := c.cc.Invoke(ctx, "/protos.ForemanServer/GetServerOptions", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ForemanServerServer is the server API for ForemanServer service. +// All implementations should embed UnimplementedForemanServerServer +// for forward compatibility +type ForemanServerServer interface { + // ListPlumbers is called by ui-bff, received by Foreman + // It returns all connected plumber instances for a given team + ListPlumbers(context.Context, *ListPlumbersRequest) (*ListPlumbersResponse, error) + // List configured/known connections + GetAllConnections(context.Context, *GetAllConnectionsRequest) (*GetAllConnectionsResponse, error) + // Fetch a specific connection by ID + GetConnection(context.Context, *GetConnectionRequest) (*GetConnectionResponse, error) + // Create a connection in plumber + CreateConnection(context.Context, *CreateConnectionRequest) (*CreateConnectionResponse, error) + // Test a connection before saving its configuration + TestConnection(context.Context, *TestConnectionRequest) (*TestConnectionResponse, error) + // Any active connections will be restarted + UpdateConnection(context.Context, *UpdateConnectionRequest) (*UpdateConnectionResponse, error) + // If there are any active connections, delete will cause them to get closed + DeleteConnection(context.Context, *DeleteConnectionRequest) (*DeleteConnectionResponse, error) + GetAllRelays(context.Context, *GetAllRelaysRequest) (*GetAllRelaysResponse, error) + GetRelay(context.Context, *GetRelayRequest) (*GetRelayResponse, error) + CreateRelay(context.Context, *CreateRelayRequest) (*CreateRelayResponse, error) + UpdateRelay(context.Context, *UpdateRelayRequest) (*UpdateRelayResponse, error) + ResumeRelay(context.Context, *ResumeRelayRequest) (*ResumeRelayResponse, error) + StopRelay(context.Context, *StopRelayRequest) (*StopRelayResponse, error) + DeleteRelay(context.Context, *DeleteRelayRequest) (*DeleteRelayResponse, error) + GetTunnel(context.Context, *GetTunnelRequest) (*GetTunnelResponse, error) + GetAllTunnels(context.Context, *GetAllTunnelsRequest) (*GetAllTunnelsResponse, error) + CreateTunnel(context.Context, *CreateTunnelRequest) (*CreateTunnelResponse, error) + StopTunnel(context.Context, *StopTunnelRequest) (*StopTunnelResponse, error) + ResumeTunnel(context.Context, *ResumeTunnelRequest) (*ResumeTunnelResponse, error) + UpdateTunnel(context.Context, *UpdateTunnelRequest) (*UpdateTunnelResponse, error) + DeleteTunnel(context.Context, *DeleteTunnelRequest) (*DeleteTunnelResponse, error) + GetServerOptions(context.Context, *GetServerOptionsRequest) (*GetServerOptionsResponse, error) +} + +// UnimplementedForemanServerServer should be embedded to have forward compatible implementations. +type UnimplementedForemanServerServer struct { +} + +func (UnimplementedForemanServerServer) ListPlumbers(context.Context, *ListPlumbersRequest) (*ListPlumbersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListPlumbers not implemented") +} +func (UnimplementedForemanServerServer) GetAllConnections(context.Context, *GetAllConnectionsRequest) (*GetAllConnectionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAllConnections not implemented") +} +func (UnimplementedForemanServerServer) GetConnection(context.Context, *GetConnectionRequest) (*GetConnectionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetConnection not implemented") +} +func (UnimplementedForemanServerServer) CreateConnection(context.Context, *CreateConnectionRequest) (*CreateConnectionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateConnection not implemented") +} +func (UnimplementedForemanServerServer) TestConnection(context.Context, *TestConnectionRequest) (*TestConnectionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TestConnection not implemented") +} +func (UnimplementedForemanServerServer) UpdateConnection(context.Context, *UpdateConnectionRequest) (*UpdateConnectionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateConnection not implemented") +} +func (UnimplementedForemanServerServer) DeleteConnection(context.Context, *DeleteConnectionRequest) (*DeleteConnectionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteConnection not implemented") +} +func (UnimplementedForemanServerServer) GetAllRelays(context.Context, *GetAllRelaysRequest) (*GetAllRelaysResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAllRelays not implemented") +} +func (UnimplementedForemanServerServer) GetRelay(context.Context, *GetRelayRequest) (*GetRelayResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRelay not implemented") +} +func (UnimplementedForemanServerServer) CreateRelay(context.Context, *CreateRelayRequest) (*CreateRelayResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateRelay not implemented") +} +func (UnimplementedForemanServerServer) UpdateRelay(context.Context, *UpdateRelayRequest) (*UpdateRelayResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateRelay not implemented") +} +func (UnimplementedForemanServerServer) ResumeRelay(context.Context, *ResumeRelayRequest) (*ResumeRelayResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ResumeRelay not implemented") +} +func (UnimplementedForemanServerServer) StopRelay(context.Context, *StopRelayRequest) (*StopRelayResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StopRelay not implemented") +} +func (UnimplementedForemanServerServer) DeleteRelay(context.Context, *DeleteRelayRequest) (*DeleteRelayResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteRelay not implemented") +} +func (UnimplementedForemanServerServer) GetTunnel(context.Context, *GetTunnelRequest) (*GetTunnelResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetTunnel not implemented") +} +func (UnimplementedForemanServerServer) GetAllTunnels(context.Context, *GetAllTunnelsRequest) (*GetAllTunnelsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAllTunnels not implemented") +} +func (UnimplementedForemanServerServer) CreateTunnel(context.Context, *CreateTunnelRequest) (*CreateTunnelResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateTunnel not implemented") +} +func (UnimplementedForemanServerServer) StopTunnel(context.Context, *StopTunnelRequest) (*StopTunnelResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StopTunnel not implemented") +} +func (UnimplementedForemanServerServer) ResumeTunnel(context.Context, *ResumeTunnelRequest) (*ResumeTunnelResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ResumeTunnel not implemented") +} +func (UnimplementedForemanServerServer) UpdateTunnel(context.Context, *UpdateTunnelRequest) (*UpdateTunnelResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateTunnel not implemented") +} +func (UnimplementedForemanServerServer) DeleteTunnel(context.Context, *DeleteTunnelRequest) (*DeleteTunnelResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteTunnel not implemented") +} +func (UnimplementedForemanServerServer) GetServerOptions(context.Context, *GetServerOptionsRequest) (*GetServerOptionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetServerOptions not implemented") +} + +// UnsafeForemanServerServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ForemanServerServer will +// result in compilation errors. +type UnsafeForemanServerServer interface { + mustEmbedUnimplementedForemanServerServer() +} + +func RegisterForemanServerServer(s grpc.ServiceRegistrar, srv ForemanServerServer) { + s.RegisterService(&ForemanServer_ServiceDesc, srv) +} + +func _ForemanServer_ListPlumbers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListPlumbersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanServerServer).ListPlumbers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanServer/ListPlumbers", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanServerServer).ListPlumbers(ctx, req.(*ListPlumbersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ForemanServer_GetAllConnections_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAllConnectionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanServerServer).GetAllConnections(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanServer/GetAllConnections", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanServerServer).GetAllConnections(ctx, req.(*GetAllConnectionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ForemanServer_GetConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetConnectionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanServerServer).GetConnection(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanServer/GetConnection", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanServerServer).GetConnection(ctx, req.(*GetConnectionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ForemanServer_CreateConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateConnectionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanServerServer).CreateConnection(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanServer/CreateConnection", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanServerServer).CreateConnection(ctx, req.(*CreateConnectionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ForemanServer_TestConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TestConnectionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanServerServer).TestConnection(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanServer/TestConnection", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanServerServer).TestConnection(ctx, req.(*TestConnectionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ForemanServer_UpdateConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateConnectionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanServerServer).UpdateConnection(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanServer/UpdateConnection", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanServerServer).UpdateConnection(ctx, req.(*UpdateConnectionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ForemanServer_DeleteConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteConnectionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanServerServer).DeleteConnection(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanServer/DeleteConnection", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanServerServer).DeleteConnection(ctx, req.(*DeleteConnectionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ForemanServer_GetAllRelays_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAllRelaysRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanServerServer).GetAllRelays(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanServer/GetAllRelays", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanServerServer).GetAllRelays(ctx, req.(*GetAllRelaysRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ForemanServer_GetRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRelayRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanServerServer).GetRelay(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanServer/GetRelay", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanServerServer).GetRelay(ctx, req.(*GetRelayRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ForemanServer_CreateRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateRelayRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanServerServer).CreateRelay(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanServer/CreateRelay", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanServerServer).CreateRelay(ctx, req.(*CreateRelayRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ForemanServer_UpdateRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateRelayRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanServerServer).UpdateRelay(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanServer/UpdateRelay", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanServerServer).UpdateRelay(ctx, req.(*UpdateRelayRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ForemanServer_ResumeRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ResumeRelayRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanServerServer).ResumeRelay(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanServer/ResumeRelay", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanServerServer).ResumeRelay(ctx, req.(*ResumeRelayRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ForemanServer_StopRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StopRelayRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanServerServer).StopRelay(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanServer/StopRelay", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanServerServer).StopRelay(ctx, req.(*StopRelayRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ForemanServer_DeleteRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRelayRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanServerServer).DeleteRelay(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanServer/DeleteRelay", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanServerServer).DeleteRelay(ctx, req.(*DeleteRelayRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ForemanServer_GetTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetTunnelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanServerServer).GetTunnel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanServer/GetTunnel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanServerServer).GetTunnel(ctx, req.(*GetTunnelRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ForemanServer_GetAllTunnels_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAllTunnelsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanServerServer).GetAllTunnels(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanServer/GetAllTunnels", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanServerServer).GetAllTunnels(ctx, req.(*GetAllTunnelsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ForemanServer_CreateTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateTunnelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanServerServer).CreateTunnel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanServer/CreateTunnel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanServerServer).CreateTunnel(ctx, req.(*CreateTunnelRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ForemanServer_StopTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StopTunnelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanServerServer).StopTunnel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanServer/StopTunnel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanServerServer).StopTunnel(ctx, req.(*StopTunnelRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ForemanServer_ResumeTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ResumeTunnelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanServerServer).ResumeTunnel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanServer/ResumeTunnel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanServerServer).ResumeTunnel(ctx, req.(*ResumeTunnelRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ForemanServer_UpdateTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateTunnelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanServerServer).UpdateTunnel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanServer/UpdateTunnel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanServerServer).UpdateTunnel(ctx, req.(*UpdateTunnelRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ForemanServer_DeleteTunnel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteTunnelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanServerServer).DeleteTunnel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanServer/DeleteTunnel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanServerServer).DeleteTunnel(ctx, req.(*DeleteTunnelRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ForemanServer_GetServerOptions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetServerOptionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ForemanServerServer).GetServerOptions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.ForemanServer/GetServerOptions", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ForemanServerServer).GetServerOptions(ctx, req.(*GetServerOptionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ForemanServer_ServiceDesc is the grpc.ServiceDesc for ForemanServer service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ForemanServer_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "protos.ForemanServer", + HandlerType: (*ForemanServerServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListPlumbers", + Handler: _ForemanServer_ListPlumbers_Handler, + }, + { + MethodName: "GetAllConnections", + Handler: _ForemanServer_GetAllConnections_Handler, + }, + { + MethodName: "GetConnection", + Handler: _ForemanServer_GetConnection_Handler, + }, + { + MethodName: "CreateConnection", + Handler: _ForemanServer_CreateConnection_Handler, + }, + { + MethodName: "TestConnection", + Handler: _ForemanServer_TestConnection_Handler, + }, + { + MethodName: "UpdateConnection", + Handler: _ForemanServer_UpdateConnection_Handler, + }, + { + MethodName: "DeleteConnection", + Handler: _ForemanServer_DeleteConnection_Handler, + }, + { + MethodName: "GetAllRelays", + Handler: _ForemanServer_GetAllRelays_Handler, + }, + { + MethodName: "GetRelay", + Handler: _ForemanServer_GetRelay_Handler, + }, + { + MethodName: "CreateRelay", + Handler: _ForemanServer_CreateRelay_Handler, + }, + { + MethodName: "UpdateRelay", + Handler: _ForemanServer_UpdateRelay_Handler, + }, + { + MethodName: "ResumeRelay", + Handler: _ForemanServer_ResumeRelay_Handler, + }, + { + MethodName: "StopRelay", + Handler: _ForemanServer_StopRelay_Handler, + }, + { + MethodName: "DeleteRelay", + Handler: _ForemanServer_DeleteRelay_Handler, + }, + { + MethodName: "GetTunnel", + Handler: _ForemanServer_GetTunnel_Handler, + }, + { + MethodName: "GetAllTunnels", + Handler: _ForemanServer_GetAllTunnels_Handler, + }, + { + MethodName: "CreateTunnel", + Handler: _ForemanServer_CreateTunnel_Handler, + }, + { + MethodName: "StopTunnel", + Handler: _ForemanServer_StopTunnel_Handler, + }, + { + MethodName: "ResumeTunnel", + Handler: _ForemanServer_ResumeTunnel_Handler, + }, + { + MethodName: "UpdateTunnel", + Handler: _ForemanServer_UpdateTunnel_Handler, + }, + { + MethodName: "DeleteTunnel", + Handler: _ForemanServer_DeleteTunnel_Handler, + }, + { + MethodName: "GetServerOptions", + Handler: _ForemanServer_GetServerOptions_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "ps_foreman_server.proto", +} diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_relay.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_relay.pb.go index 811ab38b7..dd17b5fa8 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_relay.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_relay.pb.go @@ -1,710 +1,1124 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_relay.proto package protos import ( - fmt "fmt" common "github.com/batchcorp/plumber-schemas/build/go/protos/common" opts "github.com/batchcorp/plumber-schemas/build/go/protos/opts" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type GetAllRelaysRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Every gRPC request must have a valid auth config - Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` } -func (m *GetAllRelaysRequest) Reset() { *m = GetAllRelaysRequest{} } -func (m *GetAllRelaysRequest) String() string { return proto.CompactTextString(m) } -func (*GetAllRelaysRequest) ProtoMessage() {} -func (*GetAllRelaysRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f65d9222ef263882, []int{0} +func (x *GetAllRelaysRequest) Reset() { + *x = GetAllRelaysRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_relay_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GetAllRelaysRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetAllRelaysRequest.Unmarshal(m, b) -} -func (m *GetAllRelaysRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetAllRelaysRequest.Marshal(b, m, deterministic) +func (x *GetAllRelaysRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GetAllRelaysRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAllRelaysRequest.Merge(m, src) -} -func (m *GetAllRelaysRequest) XXX_Size() int { - return xxx_messageInfo_GetAllRelaysRequest.Size(m) -} -func (m *GetAllRelaysRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetAllRelaysRequest.DiscardUnknown(m) + +func (*GetAllRelaysRequest) ProtoMessage() {} + +func (x *GetAllRelaysRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_relay_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_GetAllRelaysRequest proto.InternalMessageInfo +// Deprecated: Use GetAllRelaysRequest.ProtoReflect.Descriptor instead. +func (*GetAllRelaysRequest) Descriptor() ([]byte, []int) { + return file_ps_relay_proto_rawDescGZIP(), []int{0} +} -func (m *GetAllRelaysRequest) GetAuth() *common.Auth { - if m != nil { - return m.Auth +func (x *GetAllRelaysRequest) GetAuth() *common.Auth { + if x != nil { + return x.Auth } return nil } type GetAllRelaysResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` // Will be set as empty []Relay if no relays are configured - Opts []*opts.RelayOptions `protobuf:"bytes,1,rep,name=opts,proto3" json:"opts,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Opts []*opts.RelayOptions `protobuf:"bytes,1,rep,name=opts,proto3" json:"opts,omitempty"` } -func (m *GetAllRelaysResponse) Reset() { *m = GetAllRelaysResponse{} } -func (m *GetAllRelaysResponse) String() string { return proto.CompactTextString(m) } -func (*GetAllRelaysResponse) ProtoMessage() {} -func (*GetAllRelaysResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f65d9222ef263882, []int{1} +func (x *GetAllRelaysResponse) Reset() { + *x = GetAllRelaysResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_relay_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GetAllRelaysResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetAllRelaysResponse.Unmarshal(m, b) +func (x *GetAllRelaysResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GetAllRelaysResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetAllRelaysResponse.Marshal(b, m, deterministic) -} -func (m *GetAllRelaysResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAllRelaysResponse.Merge(m, src) -} -func (m *GetAllRelaysResponse) XXX_Size() int { - return xxx_messageInfo_GetAllRelaysResponse.Size(m) -} -func (m *GetAllRelaysResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetAllRelaysResponse.DiscardUnknown(m) + +func (*GetAllRelaysResponse) ProtoMessage() {} + +func (x *GetAllRelaysResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_relay_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_GetAllRelaysResponse proto.InternalMessageInfo +// Deprecated: Use GetAllRelaysResponse.ProtoReflect.Descriptor instead. +func (*GetAllRelaysResponse) Descriptor() ([]byte, []int) { + return file_ps_relay_proto_rawDescGZIP(), []int{1} +} -func (m *GetAllRelaysResponse) GetStatus() *common.Status { - if m != nil { - return m.Status +func (x *GetAllRelaysResponse) GetStatus() *common.Status { + if x != nil { + return x.Status } return nil } -func (m *GetAllRelaysResponse) GetOpts() []*opts.RelayOptions { - if m != nil { - return m.Opts +func (x *GetAllRelaysResponse) GetOpts() []*opts.RelayOptions { + if x != nil { + return x.Opts } return nil } type GetRelayRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Every gRPC request must have a valid auth config - Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` - RelayId string `protobuf:"bytes,1,opt,name=relay_id,json=relayId,proto3" json:"relay_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` + RelayId string `protobuf:"bytes,1,opt,name=relay_id,json=relayId,proto3" json:"relay_id,omitempty"` } -func (m *GetRelayRequest) Reset() { *m = GetRelayRequest{} } -func (m *GetRelayRequest) String() string { return proto.CompactTextString(m) } -func (*GetRelayRequest) ProtoMessage() {} -func (*GetRelayRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f65d9222ef263882, []int{2} +func (x *GetRelayRequest) Reset() { + *x = GetRelayRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_relay_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GetRelayRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetRelayRequest.Unmarshal(m, b) -} -func (m *GetRelayRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetRelayRequest.Marshal(b, m, deterministic) -} -func (m *GetRelayRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRelayRequest.Merge(m, src) +func (x *GetRelayRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GetRelayRequest) XXX_Size() int { - return xxx_messageInfo_GetRelayRequest.Size(m) -} -func (m *GetRelayRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetRelayRequest.DiscardUnknown(m) + +func (*GetRelayRequest) ProtoMessage() {} + +func (x *GetRelayRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_relay_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_GetRelayRequest proto.InternalMessageInfo +// Deprecated: Use GetRelayRequest.ProtoReflect.Descriptor instead. +func (*GetRelayRequest) Descriptor() ([]byte, []int) { + return file_ps_relay_proto_rawDescGZIP(), []int{2} +} -func (m *GetRelayRequest) GetAuth() *common.Auth { - if m != nil { - return m.Auth +func (x *GetRelayRequest) GetAuth() *common.Auth { + if x != nil { + return x.Auth } return nil } -func (m *GetRelayRequest) GetRelayId() string { - if m != nil { - return m.RelayId +func (x *GetRelayRequest) GetRelayId() string { + if x != nil { + return x.RelayId } return "" } type GetRelayResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` // Set only if status is OK - Opts *opts.RelayOptions `protobuf:"bytes,1,opt,name=opts,proto3" json:"opts,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Opts *opts.RelayOptions `protobuf:"bytes,1,opt,name=opts,proto3" json:"opts,omitempty"` } -func (m *GetRelayResponse) Reset() { *m = GetRelayResponse{} } -func (m *GetRelayResponse) String() string { return proto.CompactTextString(m) } -func (*GetRelayResponse) ProtoMessage() {} -func (*GetRelayResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f65d9222ef263882, []int{3} +func (x *GetRelayResponse) Reset() { + *x = GetRelayResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_relay_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GetRelayResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetRelayResponse.Unmarshal(m, b) -} -func (m *GetRelayResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetRelayResponse.Marshal(b, m, deterministic) -} -func (m *GetRelayResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRelayResponse.Merge(m, src) -} -func (m *GetRelayResponse) XXX_Size() int { - return xxx_messageInfo_GetRelayResponse.Size(m) +func (x *GetRelayResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GetRelayResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetRelayResponse.DiscardUnknown(m) + +func (*GetRelayResponse) ProtoMessage() {} + +func (x *GetRelayResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_relay_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_GetRelayResponse proto.InternalMessageInfo +// Deprecated: Use GetRelayResponse.ProtoReflect.Descriptor instead. +func (*GetRelayResponse) Descriptor() ([]byte, []int) { + return file_ps_relay_proto_rawDescGZIP(), []int{3} +} -func (m *GetRelayResponse) GetStatus() *common.Status { - if m != nil { - return m.Status +func (x *GetRelayResponse) GetStatus() *common.Status { + if x != nil { + return x.Status } return nil } -func (m *GetRelayResponse) GetOpts() *opts.RelayOptions { - if m != nil { - return m.Opts +func (x *GetRelayResponse) GetOpts() *opts.RelayOptions { + if x != nil { + return x.Opts } return nil } type CreateRelayRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Every gRPC request must have a valid auth config - Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` - Opts *opts.RelayOptions `protobuf:"bytes,1,opt,name=opts,proto3" json:"opts,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` + Opts *opts.RelayOptions `protobuf:"bytes,1,opt,name=opts,proto3" json:"opts,omitempty"` } -func (m *CreateRelayRequest) Reset() { *m = CreateRelayRequest{} } -func (m *CreateRelayRequest) String() string { return proto.CompactTextString(m) } -func (*CreateRelayRequest) ProtoMessage() {} -func (*CreateRelayRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f65d9222ef263882, []int{4} +func (x *CreateRelayRequest) Reset() { + *x = CreateRelayRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_relay_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *CreateRelayRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateRelayRequest.Unmarshal(m, b) -} -func (m *CreateRelayRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateRelayRequest.Marshal(b, m, deterministic) -} -func (m *CreateRelayRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateRelayRequest.Merge(m, src) -} -func (m *CreateRelayRequest) XXX_Size() int { - return xxx_messageInfo_CreateRelayRequest.Size(m) +func (x *CreateRelayRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CreateRelayRequest) XXX_DiscardUnknown() { - xxx_messageInfo_CreateRelayRequest.DiscardUnknown(m) + +func (*CreateRelayRequest) ProtoMessage() {} + +func (x *CreateRelayRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_relay_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_CreateRelayRequest proto.InternalMessageInfo +// Deprecated: Use CreateRelayRequest.ProtoReflect.Descriptor instead. +func (*CreateRelayRequest) Descriptor() ([]byte, []int) { + return file_ps_relay_proto_rawDescGZIP(), []int{4} +} -func (m *CreateRelayRequest) GetAuth() *common.Auth { - if m != nil { - return m.Auth +func (x *CreateRelayRequest) GetAuth() *common.Auth { + if x != nil { + return x.Auth } return nil } -func (m *CreateRelayRequest) GetOpts() *opts.RelayOptions { - if m != nil { - return m.Opts +func (x *CreateRelayRequest) GetOpts() *opts.RelayOptions { + if x != nil { + return x.Opts } return nil } type CreateRelayResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` // ID of the created relay entry - RelayId string `protobuf:"bytes,1,opt,name=relay_id,json=relayId,proto3" json:"relay_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + RelayId string `protobuf:"bytes,1,opt,name=relay_id,json=relayId,proto3" json:"relay_id,omitempty"` } -func (m *CreateRelayResponse) Reset() { *m = CreateRelayResponse{} } -func (m *CreateRelayResponse) String() string { return proto.CompactTextString(m) } -func (*CreateRelayResponse) ProtoMessage() {} -func (*CreateRelayResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f65d9222ef263882, []int{5} +func (x *CreateRelayResponse) Reset() { + *x = CreateRelayResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_relay_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *CreateRelayResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateRelayResponse.Unmarshal(m, b) -} -func (m *CreateRelayResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateRelayResponse.Marshal(b, m, deterministic) -} -func (m *CreateRelayResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateRelayResponse.Merge(m, src) +func (x *CreateRelayResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CreateRelayResponse) XXX_Size() int { - return xxx_messageInfo_CreateRelayResponse.Size(m) -} -func (m *CreateRelayResponse) XXX_DiscardUnknown() { - xxx_messageInfo_CreateRelayResponse.DiscardUnknown(m) + +func (*CreateRelayResponse) ProtoMessage() {} + +func (x *CreateRelayResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_relay_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_CreateRelayResponse proto.InternalMessageInfo +// Deprecated: Use CreateRelayResponse.ProtoReflect.Descriptor instead. +func (*CreateRelayResponse) Descriptor() ([]byte, []int) { + return file_ps_relay_proto_rawDescGZIP(), []int{5} +} -func (m *CreateRelayResponse) GetStatus() *common.Status { - if m != nil { - return m.Status +func (x *CreateRelayResponse) GetStatus() *common.Status { + if x != nil { + return x.Status } return nil } -func (m *CreateRelayResponse) GetRelayId() string { - if m != nil { - return m.RelayId +func (x *CreateRelayResponse) GetRelayId() string { + if x != nil { + return x.RelayId } return "" } // WARNING: Any in-progress relay will be interrupted/restarted type UpdateRelayRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Every gRPC request must have a valid auth config - Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` - RelayId string `protobuf:"bytes,1,opt,name=relay_id,json=relayId,proto3" json:"relay_id,omitempty"` - Opts *opts.RelayOptions `protobuf:"bytes,2,opt,name=opts,proto3" json:"opts,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` + RelayId string `protobuf:"bytes,1,opt,name=relay_id,json=relayId,proto3" json:"relay_id,omitempty"` + Opts *opts.RelayOptions `protobuf:"bytes,2,opt,name=opts,proto3" json:"opts,omitempty"` } -func (m *UpdateRelayRequest) Reset() { *m = UpdateRelayRequest{} } -func (m *UpdateRelayRequest) String() string { return proto.CompactTextString(m) } -func (*UpdateRelayRequest) ProtoMessage() {} -func (*UpdateRelayRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f65d9222ef263882, []int{6} +func (x *UpdateRelayRequest) Reset() { + *x = UpdateRelayRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_relay_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *UpdateRelayRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UpdateRelayRequest.Unmarshal(m, b) -} -func (m *UpdateRelayRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UpdateRelayRequest.Marshal(b, m, deterministic) +func (x *UpdateRelayRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *UpdateRelayRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_UpdateRelayRequest.Merge(m, src) -} -func (m *UpdateRelayRequest) XXX_Size() int { - return xxx_messageInfo_UpdateRelayRequest.Size(m) -} -func (m *UpdateRelayRequest) XXX_DiscardUnknown() { - xxx_messageInfo_UpdateRelayRequest.DiscardUnknown(m) + +func (*UpdateRelayRequest) ProtoMessage() {} + +func (x *UpdateRelayRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_relay_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_UpdateRelayRequest proto.InternalMessageInfo +// Deprecated: Use UpdateRelayRequest.ProtoReflect.Descriptor instead. +func (*UpdateRelayRequest) Descriptor() ([]byte, []int) { + return file_ps_relay_proto_rawDescGZIP(), []int{6} +} -func (m *UpdateRelayRequest) GetAuth() *common.Auth { - if m != nil { - return m.Auth +func (x *UpdateRelayRequest) GetAuth() *common.Auth { + if x != nil { + return x.Auth } return nil } -func (m *UpdateRelayRequest) GetRelayId() string { - if m != nil { - return m.RelayId +func (x *UpdateRelayRequest) GetRelayId() string { + if x != nil { + return x.RelayId } return "" } -func (m *UpdateRelayRequest) GetOpts() *opts.RelayOptions { - if m != nil { - return m.Opts +func (x *UpdateRelayRequest) GetOpts() *opts.RelayOptions { + if x != nil { + return x.Opts } return nil } type UpdateRelayResponse struct { - Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *UpdateRelayResponse) Reset() { *m = UpdateRelayResponse{} } -func (m *UpdateRelayResponse) String() string { return proto.CompactTextString(m) } -func (*UpdateRelayResponse) ProtoMessage() {} -func (*UpdateRelayResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f65d9222ef263882, []int{7} + Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` } -func (m *UpdateRelayResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UpdateRelayResponse.Unmarshal(m, b) -} -func (m *UpdateRelayResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UpdateRelayResponse.Marshal(b, m, deterministic) -} -func (m *UpdateRelayResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_UpdateRelayResponse.Merge(m, src) +func (x *UpdateRelayResponse) Reset() { + *x = UpdateRelayResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_relay_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *UpdateRelayResponse) XXX_Size() int { - return xxx_messageInfo_UpdateRelayResponse.Size(m) + +func (x *UpdateRelayResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *UpdateRelayResponse) XXX_DiscardUnknown() { - xxx_messageInfo_UpdateRelayResponse.DiscardUnknown(m) + +func (*UpdateRelayResponse) ProtoMessage() {} + +func (x *UpdateRelayResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_relay_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_UpdateRelayResponse proto.InternalMessageInfo +// Deprecated: Use UpdateRelayResponse.ProtoReflect.Descriptor instead. +func (*UpdateRelayResponse) Descriptor() ([]byte, []int) { + return file_ps_relay_proto_rawDescGZIP(), []int{7} +} -func (m *UpdateRelayResponse) GetStatus() *common.Status { - if m != nil { - return m.Status +func (x *UpdateRelayResponse) GetStatus() *common.Status { + if x != nil { + return x.Status } return nil } // Resume a paused relay type ResumeRelayRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Every gRPC request must have a valid auth config - Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` - RelayId string `protobuf:"bytes,1,opt,name=relay_id,json=relayId,proto3" json:"relay_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` + RelayId string `protobuf:"bytes,1,opt,name=relay_id,json=relayId,proto3" json:"relay_id,omitempty"` } -func (m *ResumeRelayRequest) Reset() { *m = ResumeRelayRequest{} } -func (m *ResumeRelayRequest) String() string { return proto.CompactTextString(m) } -func (*ResumeRelayRequest) ProtoMessage() {} -func (*ResumeRelayRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f65d9222ef263882, []int{8} +func (x *ResumeRelayRequest) Reset() { + *x = ResumeRelayRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_relay_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ResumeRelayRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ResumeRelayRequest.Unmarshal(m, b) -} -func (m *ResumeRelayRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ResumeRelayRequest.Marshal(b, m, deterministic) -} -func (m *ResumeRelayRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResumeRelayRequest.Merge(m, src) +func (x *ResumeRelayRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ResumeRelayRequest) XXX_Size() int { - return xxx_messageInfo_ResumeRelayRequest.Size(m) -} -func (m *ResumeRelayRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ResumeRelayRequest.DiscardUnknown(m) + +func (*ResumeRelayRequest) ProtoMessage() {} + +func (x *ResumeRelayRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_relay_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ResumeRelayRequest proto.InternalMessageInfo +// Deprecated: Use ResumeRelayRequest.ProtoReflect.Descriptor instead. +func (*ResumeRelayRequest) Descriptor() ([]byte, []int) { + return file_ps_relay_proto_rawDescGZIP(), []int{8} +} -func (m *ResumeRelayRequest) GetAuth() *common.Auth { - if m != nil { - return m.Auth +func (x *ResumeRelayRequest) GetAuth() *common.Auth { + if x != nil { + return x.Auth } return nil } -func (m *ResumeRelayRequest) GetRelayId() string { - if m != nil { - return m.RelayId +func (x *ResumeRelayRequest) GetRelayId() string { + if x != nil { + return x.RelayId } return "" } type ResumeRelayResponse struct { - Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *ResumeRelayResponse) Reset() { *m = ResumeRelayResponse{} } -func (m *ResumeRelayResponse) String() string { return proto.CompactTextString(m) } -func (*ResumeRelayResponse) ProtoMessage() {} -func (*ResumeRelayResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f65d9222ef263882, []int{9} + Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` } -func (m *ResumeRelayResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ResumeRelayResponse.Unmarshal(m, b) -} -func (m *ResumeRelayResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ResumeRelayResponse.Marshal(b, m, deterministic) -} -func (m *ResumeRelayResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResumeRelayResponse.Merge(m, src) +func (x *ResumeRelayResponse) Reset() { + *x = ResumeRelayResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_relay_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ResumeRelayResponse) XXX_Size() int { - return xxx_messageInfo_ResumeRelayResponse.Size(m) + +func (x *ResumeRelayResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ResumeRelayResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ResumeRelayResponse.DiscardUnknown(m) + +func (*ResumeRelayResponse) ProtoMessage() {} + +func (x *ResumeRelayResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_relay_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ResumeRelayResponse proto.InternalMessageInfo +// Deprecated: Use ResumeRelayResponse.ProtoReflect.Descriptor instead. +func (*ResumeRelayResponse) Descriptor() ([]byte, []int) { + return file_ps_relay_proto_rawDescGZIP(), []int{9} +} -func (m *ResumeRelayResponse) GetStatus() *common.Status { - if m != nil { - return m.Status +func (x *ResumeRelayResponse) GetStatus() *common.Status { + if x != nil { + return x.Status } return nil } // Temporarily stop/pause a relay type StopRelayRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Every gRPC request must have a valid auth config - Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` - RelayId string `protobuf:"bytes,1,opt,name=relay_id,json=relayId,proto3" json:"relay_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` + RelayId string `protobuf:"bytes,1,opt,name=relay_id,json=relayId,proto3" json:"relay_id,omitempty"` } -func (m *StopRelayRequest) Reset() { *m = StopRelayRequest{} } -func (m *StopRelayRequest) String() string { return proto.CompactTextString(m) } -func (*StopRelayRequest) ProtoMessage() {} -func (*StopRelayRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f65d9222ef263882, []int{10} +func (x *StopRelayRequest) Reset() { + *x = StopRelayRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_relay_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *StopRelayRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StopRelayRequest.Unmarshal(m, b) -} -func (m *StopRelayRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StopRelayRequest.Marshal(b, m, deterministic) +func (x *StopRelayRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *StopRelayRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_StopRelayRequest.Merge(m, src) -} -func (m *StopRelayRequest) XXX_Size() int { - return xxx_messageInfo_StopRelayRequest.Size(m) -} -func (m *StopRelayRequest) XXX_DiscardUnknown() { - xxx_messageInfo_StopRelayRequest.DiscardUnknown(m) + +func (*StopRelayRequest) ProtoMessage() {} + +func (x *StopRelayRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_relay_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_StopRelayRequest proto.InternalMessageInfo +// Deprecated: Use StopRelayRequest.ProtoReflect.Descriptor instead. +func (*StopRelayRequest) Descriptor() ([]byte, []int) { + return file_ps_relay_proto_rawDescGZIP(), []int{10} +} -func (m *StopRelayRequest) GetAuth() *common.Auth { - if m != nil { - return m.Auth +func (x *StopRelayRequest) GetAuth() *common.Auth { + if x != nil { + return x.Auth } return nil } -func (m *StopRelayRequest) GetRelayId() string { - if m != nil { - return m.RelayId +func (x *StopRelayRequest) GetRelayId() string { + if x != nil { + return x.RelayId } return "" } type StopRelayResponse struct { - Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *StopRelayResponse) Reset() { *m = StopRelayResponse{} } -func (m *StopRelayResponse) String() string { return proto.CompactTextString(m) } -func (*StopRelayResponse) ProtoMessage() {} -func (*StopRelayResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f65d9222ef263882, []int{11} + Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` } -func (m *StopRelayResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StopRelayResponse.Unmarshal(m, b) -} -func (m *StopRelayResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StopRelayResponse.Marshal(b, m, deterministic) -} -func (m *StopRelayResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_StopRelayResponse.Merge(m, src) +func (x *StopRelayResponse) Reset() { + *x = StopRelayResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_relay_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *StopRelayResponse) XXX_Size() int { - return xxx_messageInfo_StopRelayResponse.Size(m) + +func (x *StopRelayResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *StopRelayResponse) XXX_DiscardUnknown() { - xxx_messageInfo_StopRelayResponse.DiscardUnknown(m) + +func (*StopRelayResponse) ProtoMessage() {} + +func (x *StopRelayResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_relay_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_StopRelayResponse proto.InternalMessageInfo +// Deprecated: Use StopRelayResponse.ProtoReflect.Descriptor instead. +func (*StopRelayResponse) Descriptor() ([]byte, []int) { + return file_ps_relay_proto_rawDescGZIP(), []int{11} +} -func (m *StopRelayResponse) GetStatus() *common.Status { - if m != nil { - return m.Status +func (x *StopRelayResponse) GetStatus() *common.Status { + if x != nil { + return x.Status } return nil } type DeleteRelayRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Every gRPC request must have a valid auth config - Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` - RelayId string `protobuf:"bytes,1,opt,name=relay_id,json=relayId,proto3" json:"relay_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` + RelayId string `protobuf:"bytes,1,opt,name=relay_id,json=relayId,proto3" json:"relay_id,omitempty"` } -func (m *DeleteRelayRequest) Reset() { *m = DeleteRelayRequest{} } -func (m *DeleteRelayRequest) String() string { return proto.CompactTextString(m) } -func (*DeleteRelayRequest) ProtoMessage() {} -func (*DeleteRelayRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f65d9222ef263882, []int{12} +func (x *DeleteRelayRequest) Reset() { + *x = DeleteRelayRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_relay_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *DeleteRelayRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeleteRelayRequest.Unmarshal(m, b) -} -func (m *DeleteRelayRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeleteRelayRequest.Marshal(b, m, deterministic) -} -func (m *DeleteRelayRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteRelayRequest.Merge(m, src) +func (x *DeleteRelayRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *DeleteRelayRequest) XXX_Size() int { - return xxx_messageInfo_DeleteRelayRequest.Size(m) -} -func (m *DeleteRelayRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteRelayRequest.DiscardUnknown(m) + +func (*DeleteRelayRequest) ProtoMessage() {} + +func (x *DeleteRelayRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_relay_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_DeleteRelayRequest proto.InternalMessageInfo +// Deprecated: Use DeleteRelayRequest.ProtoReflect.Descriptor instead. +func (*DeleteRelayRequest) Descriptor() ([]byte, []int) { + return file_ps_relay_proto_rawDescGZIP(), []int{12} +} -func (m *DeleteRelayRequest) GetAuth() *common.Auth { - if m != nil { - return m.Auth +func (x *DeleteRelayRequest) GetAuth() *common.Auth { + if x != nil { + return x.Auth } return nil } -func (m *DeleteRelayRequest) GetRelayId() string { - if m != nil { - return m.RelayId +func (x *DeleteRelayRequest) GetRelayId() string { + if x != nil { + return x.RelayId } return "" } type DeleteRelayResponse struct { - Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *DeleteRelayResponse) Reset() { *m = DeleteRelayResponse{} } -func (m *DeleteRelayResponse) String() string { return proto.CompactTextString(m) } -func (*DeleteRelayResponse) ProtoMessage() {} -func (*DeleteRelayResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f65d9222ef263882, []int{13} + Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` } -func (m *DeleteRelayResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeleteRelayResponse.Unmarshal(m, b) -} -func (m *DeleteRelayResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeleteRelayResponse.Marshal(b, m, deterministic) -} -func (m *DeleteRelayResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteRelayResponse.Merge(m, src) +func (x *DeleteRelayResponse) Reset() { + *x = DeleteRelayResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_relay_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *DeleteRelayResponse) XXX_Size() int { - return xxx_messageInfo_DeleteRelayResponse.Size(m) + +func (x *DeleteRelayResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *DeleteRelayResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteRelayResponse.DiscardUnknown(m) + +func (*DeleteRelayResponse) ProtoMessage() {} + +func (x *DeleteRelayResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_relay_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_DeleteRelayResponse proto.InternalMessageInfo +// Deprecated: Use DeleteRelayResponse.ProtoReflect.Descriptor instead. +func (*DeleteRelayResponse) Descriptor() ([]byte, []int) { + return file_ps_relay_proto_rawDescGZIP(), []int{13} +} -func (m *DeleteRelayResponse) GetStatus() *common.Status { - if m != nil { - return m.Status +func (x *DeleteRelayResponse) GetStatus() *common.Status { + if x != nil { + return x.Status } return nil } -func init() { - proto.RegisterType((*GetAllRelaysRequest)(nil), "protos.GetAllRelaysRequest") - proto.RegisterType((*GetAllRelaysResponse)(nil), "protos.GetAllRelaysResponse") - proto.RegisterType((*GetRelayRequest)(nil), "protos.GetRelayRequest") - proto.RegisterType((*GetRelayResponse)(nil), "protos.GetRelayResponse") - proto.RegisterType((*CreateRelayRequest)(nil), "protos.CreateRelayRequest") - proto.RegisterType((*CreateRelayResponse)(nil), "protos.CreateRelayResponse") - proto.RegisterType((*UpdateRelayRequest)(nil), "protos.UpdateRelayRequest") - proto.RegisterType((*UpdateRelayResponse)(nil), "protos.UpdateRelayResponse") - proto.RegisterType((*ResumeRelayRequest)(nil), "protos.ResumeRelayRequest") - proto.RegisterType((*ResumeRelayResponse)(nil), "protos.ResumeRelayResponse") - proto.RegisterType((*StopRelayRequest)(nil), "protos.StopRelayRequest") - proto.RegisterType((*StopRelayResponse)(nil), "protos.StopRelayResponse") - proto.RegisterType((*DeleteRelayRequest)(nil), "protos.DeleteRelayRequest") - proto.RegisterType((*DeleteRelayResponse)(nil), "protos.DeleteRelayResponse") -} - -func init() { proto.RegisterFile("ps_relay.proto", fileDescriptor_f65d9222ef263882) } - -var fileDescriptor_f65d9222ef263882 = []byte{ - // 385 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0xcf, 0x4a, 0xf3, 0x40, - 0x14, 0xc5, 0xc9, 0xf7, 0x95, 0x56, 0x6f, 0x41, 0xeb, 0x44, 0x21, 0xad, 0x08, 0x25, 0xab, 0x6c, - 0x9a, 0x40, 0x15, 0xb7, 0x52, 0xab, 0x14, 0x37, 0x0a, 0x29, 0x2a, 0xba, 0x89, 0xf9, 0x33, 0x34, - 0x81, 0xa4, 0x33, 0xcd, 0xcc, 0x2c, 0x7c, 0x03, 0x77, 0xbe, 0xa6, 0x8f, 0x21, 0x33, 0xa9, 0xda, - 0x28, 0x4a, 0x1b, 0xeb, 0x6a, 0x92, 0x39, 0x87, 0xdf, 0x3d, 0xe7, 0x2e, 0x06, 0xb6, 0x28, 0xf3, - 0x72, 0x9c, 0xfa, 0x8f, 0x36, 0xcd, 0x09, 0x27, 0xa8, 0xae, 0x0e, 0xd6, 0xd9, 0x0f, 0x49, 0x96, - 0x91, 0xa9, 0x43, 0x99, 0x57, 0x7c, 0x79, 0xbe, 0xe0, 0x71, 0x61, 0xea, 0x1c, 0x7c, 0x11, 0x19, - 0xf7, 0xb9, 0x60, 0x73, 0xd9, 0x20, 0x94, 0x33, 0x29, 0xca, 0x73, 0x91, 0x6e, 0x9e, 0x80, 0x3e, - 0xc2, 0x7c, 0x90, 0xa6, 0xae, 0xbc, 0x64, 0x2e, 0x9e, 0x09, 0xcc, 0x38, 0xb2, 0xa0, 0x26, 0xe9, - 0xc6, 0xf3, 0x65, 0x57, 0xb3, 0x9a, 0x7d, 0xbd, 0x70, 0x33, 0xbb, 0x80, 0xdb, 0x03, 0xc1, 0x63, - 0x57, 0x39, 0x4c, 0x01, 0xbb, 0x65, 0x00, 0xa3, 0x64, 0xca, 0x30, 0xb2, 0xa1, 0x5e, 0x44, 0x30, - 0x5e, 0x1a, 0x8a, 0xb1, 0xf7, 0x89, 0x31, 0x56, 0xaa, 0x3b, 0x77, 0xa1, 0x1e, 0xd4, 0x64, 0x38, - 0x43, 0xeb, 0xfe, 0xb7, 0x9a, 0xfd, 0xf6, 0x9b, 0x59, 0xde, 0xd9, 0x0a, 0x7d, 0x45, 0x79, 0x42, - 0xa6, 0xcc, 0x55, 0x36, 0xf3, 0x06, 0xb6, 0x47, 0x98, 0x2b, 0x61, 0xe5, 0xcc, 0xa8, 0x0d, 0x1b, - 0x6a, 0x07, 0x5e, 0x12, 0x19, 0x5a, 0x57, 0xb3, 0x36, 0xdd, 0x86, 0xfa, 0xbf, 0x88, 0xcc, 0x19, - 0xb4, 0x3e, 0xb8, 0xbf, 0xae, 0xa2, 0x2d, 0x53, 0x25, 0x03, 0x34, 0xcc, 0xb1, 0xcf, 0x71, 0xc5, - 0x36, 0x2b, 0x8e, 0x7b, 0x00, 0xbd, 0x34, 0xae, 0x62, 0xc9, 0x1f, 0x76, 0xf8, 0xa4, 0x01, 0xba, - 0xa6, 0x51, 0xf5, 0x46, 0xdf, 0xb3, 0xdf, 0xcb, 0xfe, 0x5b, 0xae, 0xec, 0x39, 0xe8, 0xa5, 0x24, - 0xd5, 0xca, 0x9a, 0x77, 0x80, 0x5c, 0xcc, 0x44, 0xb6, 0xfe, 0x42, 0x32, 0x61, 0x09, 0x5d, 0x31, - 0xe1, 0x2d, 0xb4, 0xc6, 0x9c, 0xd0, 0xf5, 0xe7, 0x1b, 0xc2, 0xce, 0x02, 0xb8, 0xfa, 0xfe, 0xce, - 0x70, 0x8a, 0xf9, 0xdf, 0xec, 0xaf, 0x84, 0xae, 0x96, 0xf0, 0xf4, 0xf8, 0xfe, 0x68, 0x92, 0xf0, - 0x58, 0x04, 0x52, 0x77, 0x02, 0x9f, 0x87, 0x71, 0x48, 0x72, 0xea, 0xd0, 0x54, 0x64, 0x01, 0xce, - 0x7b, 0x2c, 0x8c, 0x71, 0xe6, 0x33, 0x27, 0x10, 0x49, 0x1a, 0x39, 0x13, 0xe2, 0x14, 0xb4, 0xa0, - 0x78, 0x9d, 0x0f, 0x5f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x84, 0xaa, 0x8c, 0x4e, 0xb6, 0x05, 0x00, - 0x00, +var File_ps_relay_proto protoreflect.FileDescriptor + +var file_ps_relay_proto_rawDesc = []byte{ + 0x0a, 0x0e, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x1a, 0x1b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x2f, 0x70, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x73, + 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, 0x70, + 0x74, 0x73, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3f, + 0x0a, 0x13, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x68, 0x18, 0x8f, 0x4e, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x04, 0x61, 0x75, 0x74, 0x68, 0x22, + 0x75, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2d, 0x0a, 0x04, 0x6f, 0x70, 0x74, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, + 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x04, 0x6f, 0x70, 0x74, 0x73, 0x22, 0x56, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, + 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x61, 0x75, 0x74, + 0x68, 0x18, 0x8f, 0x4e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x04, 0x61, + 0x75, 0x74, 0x68, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x22, 0x71, + 0x0a, 0x10, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0xe8, 0x07, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x12, 0x2d, 0x0a, 0x04, 0x6f, 0x70, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, + 0x65, 0x6c, 0x61, 0x79, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x04, 0x6f, 0x70, 0x74, + 0x73, 0x22, 0x6d, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x68, 0x18, + 0x8f, 0x4e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x04, 0x61, 0x75, 0x74, + 0x68, 0x12, 0x2d, 0x0a, 0x04, 0x6f, 0x70, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, + 0x6c, 0x61, 0x79, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x04, 0x6f, 0x70, 0x74, 0x73, + 0x22, 0x60, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x79, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x6c, 0x61, 0x79, + 0x49, 0x64, 0x22, 0x88, 0x01, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x6c, + 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x61, 0x75, 0x74, + 0x68, 0x18, 0x8f, 0x4e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x04, 0x61, + 0x75, 0x74, 0x68, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x12, 0x2d, + 0x0a, 0x04, 0x6f, 0x70, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x04, 0x6f, 0x70, 0x74, 0x73, 0x22, 0x45, 0x0a, + 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0xe8, + 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x22, 0x59, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x52, 0x65, + 0x6c, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x61, 0x75, + 0x74, 0x68, 0x18, 0x8f, 0x4e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x04, + 0x61, 0x75, 0x74, 0x68, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x22, + 0x45, 0x0a, 0x13, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x57, 0x0a, 0x10, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, + 0x6c, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x61, 0x75, + 0x74, 0x68, 0x18, 0x8f, 0x4e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x04, + 0x61, 0x75, 0x74, 0x68, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x22, + 0x43, 0x0a, 0x11, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0xe8, + 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x22, 0x59, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, + 0x6c, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x61, 0x75, + 0x74, 0x68, 0x18, 0x8f, 0x4e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x04, + 0x61, 0x75, 0x74, 0x68, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x22, + 0x45, 0x0a, 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, + 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, + 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ps_relay_proto_rawDescOnce sync.Once + file_ps_relay_proto_rawDescData = file_ps_relay_proto_rawDesc +) + +func file_ps_relay_proto_rawDescGZIP() []byte { + file_ps_relay_proto_rawDescOnce.Do(func() { + file_ps_relay_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_relay_proto_rawDescData) + }) + return file_ps_relay_proto_rawDescData +} + +var file_ps_relay_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_ps_relay_proto_goTypes = []interface{}{ + (*GetAllRelaysRequest)(nil), // 0: protos.GetAllRelaysRequest + (*GetAllRelaysResponse)(nil), // 1: protos.GetAllRelaysResponse + (*GetRelayRequest)(nil), // 2: protos.GetRelayRequest + (*GetRelayResponse)(nil), // 3: protos.GetRelayResponse + (*CreateRelayRequest)(nil), // 4: protos.CreateRelayRequest + (*CreateRelayResponse)(nil), // 5: protos.CreateRelayResponse + (*UpdateRelayRequest)(nil), // 6: protos.UpdateRelayRequest + (*UpdateRelayResponse)(nil), // 7: protos.UpdateRelayResponse + (*ResumeRelayRequest)(nil), // 8: protos.ResumeRelayRequest + (*ResumeRelayResponse)(nil), // 9: protos.ResumeRelayResponse + (*StopRelayRequest)(nil), // 10: protos.StopRelayRequest + (*StopRelayResponse)(nil), // 11: protos.StopRelayResponse + (*DeleteRelayRequest)(nil), // 12: protos.DeleteRelayRequest + (*DeleteRelayResponse)(nil), // 13: protos.DeleteRelayResponse + (*common.Auth)(nil), // 14: protos.common.Auth + (*common.Status)(nil), // 15: protos.common.Status + (*opts.RelayOptions)(nil), // 16: protos.opts.RelayOptions +} +var file_ps_relay_proto_depIdxs = []int32{ + 14, // 0: protos.GetAllRelaysRequest.auth:type_name -> protos.common.Auth + 15, // 1: protos.GetAllRelaysResponse.status:type_name -> protos.common.Status + 16, // 2: protos.GetAllRelaysResponse.opts:type_name -> protos.opts.RelayOptions + 14, // 3: protos.GetRelayRequest.auth:type_name -> protos.common.Auth + 15, // 4: protos.GetRelayResponse.status:type_name -> protos.common.Status + 16, // 5: protos.GetRelayResponse.opts:type_name -> protos.opts.RelayOptions + 14, // 6: protos.CreateRelayRequest.auth:type_name -> protos.common.Auth + 16, // 7: protos.CreateRelayRequest.opts:type_name -> protos.opts.RelayOptions + 15, // 8: protos.CreateRelayResponse.status:type_name -> protos.common.Status + 14, // 9: protos.UpdateRelayRequest.auth:type_name -> protos.common.Auth + 16, // 10: protos.UpdateRelayRequest.opts:type_name -> protos.opts.RelayOptions + 15, // 11: protos.UpdateRelayResponse.status:type_name -> protos.common.Status + 14, // 12: protos.ResumeRelayRequest.auth:type_name -> protos.common.Auth + 15, // 13: protos.ResumeRelayResponse.status:type_name -> protos.common.Status + 14, // 14: protos.StopRelayRequest.auth:type_name -> protos.common.Auth + 15, // 15: protos.StopRelayResponse.status:type_name -> protos.common.Status + 14, // 16: protos.DeleteRelayRequest.auth:type_name -> protos.common.Auth + 15, // 17: protos.DeleteRelayResponse.status:type_name -> protos.common.Status + 18, // [18:18] is the sub-list for method output_type + 18, // [18:18] is the sub-list for method input_type + 18, // [18:18] is the sub-list for extension type_name + 18, // [18:18] is the sub-list for extension extendee + 0, // [0:18] is the sub-list for field type_name +} + +func init() { file_ps_relay_proto_init() } +func file_ps_relay_proto_init() { + if File_ps_relay_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_relay_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAllRelaysRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_relay_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAllRelaysResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_relay_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRelayRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_relay_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRelayResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_relay_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateRelayRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_relay_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateRelayResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_relay_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateRelayRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_relay_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateRelayResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_relay_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResumeRelayRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_relay_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResumeRelayResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_relay_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StopRelayRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_relay_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StopRelayResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_relay_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteRelayRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_relay_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteRelayResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_relay_proto_rawDesc, + NumEnums: 0, + NumMessages: 14, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_relay_proto_goTypes, + DependencyIndexes: file_ps_relay_proto_depIdxs, + MessageInfos: file_ps_relay_proto_msgTypes, + }.Build() + File_ps_relay_proto = out.File + file_ps_relay_proto_rawDesc = nil + file_ps_relay_proto_goTypes = nil + file_ps_relay_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_server.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_server.pb.go index 70d3490aa..5293c837a 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_server.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_server.pb.go @@ -1,128 +1,223 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_server.proto package protos import ( - fmt "fmt" common "github.com/batchcorp/plumber-schemas/build/go/protos/common" opts "github.com/batchcorp/plumber-schemas/build/go/protos/opts" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type GetServerOptionsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Every gRPC request must have a valid auth config - Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` } -func (m *GetServerOptionsRequest) Reset() { *m = GetServerOptionsRequest{} } -func (m *GetServerOptionsRequest) String() string { return proto.CompactTextString(m) } -func (*GetServerOptionsRequest) ProtoMessage() {} -func (*GetServerOptionsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_99cda3bcaff1a15a, []int{0} +func (x *GetServerOptionsRequest) Reset() { + *x = GetServerOptionsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_server_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GetServerOptionsRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetServerOptionsRequest.Unmarshal(m, b) -} -func (m *GetServerOptionsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetServerOptionsRequest.Marshal(b, m, deterministic) -} -func (m *GetServerOptionsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetServerOptionsRequest.Merge(m, src) +func (x *GetServerOptionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GetServerOptionsRequest) XXX_Size() int { - return xxx_messageInfo_GetServerOptionsRequest.Size(m) -} -func (m *GetServerOptionsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetServerOptionsRequest.DiscardUnknown(m) + +func (*GetServerOptionsRequest) ProtoMessage() {} + +func (x *GetServerOptionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_server_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_GetServerOptionsRequest proto.InternalMessageInfo +// Deprecated: Use GetServerOptionsRequest.ProtoReflect.Descriptor instead. +func (*GetServerOptionsRequest) Descriptor() ([]byte, []int) { + return file_ps_server_proto_rawDescGZIP(), []int{0} +} -func (m *GetServerOptionsRequest) GetAuth() *common.Auth { - if m != nil { - return m.Auth +func (x *GetServerOptionsRequest) GetAuth() *common.Auth { + if x != nil { + return x.Auth } return nil } type GetServerOptionsResponse struct { - ServerOptions *opts.ServerOptions `protobuf:"bytes,1,opt,name=server_options,json=serverOptions,proto3" json:"server_options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *GetServerOptionsResponse) Reset() { *m = GetServerOptionsResponse{} } -func (m *GetServerOptionsResponse) String() string { return proto.CompactTextString(m) } -func (*GetServerOptionsResponse) ProtoMessage() {} -func (*GetServerOptionsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_99cda3bcaff1a15a, []int{1} + ServerOptions *opts.ServerOptions `protobuf:"bytes,1,opt,name=server_options,json=serverOptions,proto3" json:"server_options,omitempty"` } -func (m *GetServerOptionsResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetServerOptionsResponse.Unmarshal(m, b) -} -func (m *GetServerOptionsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetServerOptionsResponse.Marshal(b, m, deterministic) -} -func (m *GetServerOptionsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetServerOptionsResponse.Merge(m, src) +func (x *GetServerOptionsResponse) Reset() { + *x = GetServerOptionsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_server_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GetServerOptionsResponse) XXX_Size() int { - return xxx_messageInfo_GetServerOptionsResponse.Size(m) + +func (x *GetServerOptionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GetServerOptionsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetServerOptionsResponse.DiscardUnknown(m) + +func (*GetServerOptionsResponse) ProtoMessage() {} + +func (x *GetServerOptionsResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_server_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_GetServerOptionsResponse proto.InternalMessageInfo +// Deprecated: Use GetServerOptionsResponse.ProtoReflect.Descriptor instead. +func (*GetServerOptionsResponse) Descriptor() ([]byte, []int) { + return file_ps_server_proto_rawDescGZIP(), []int{1} +} -func (m *GetServerOptionsResponse) GetServerOptions() *opts.ServerOptions { - if m != nil { - return m.ServerOptions +func (x *GetServerOptionsResponse) GetServerOptions() *opts.ServerOptions { + if x != nil { + return x.ServerOptions } return nil } -func init() { - proto.RegisterType((*GetServerOptionsRequest)(nil), "protos.GetServerOptionsRequest") - proto.RegisterType((*GetServerOptionsResponse)(nil), "protos.GetServerOptionsResponse") -} - -func init() { proto.RegisterFile("ps_server.proto", fileDescriptor_99cda3bcaff1a15a) } - -var fileDescriptor_99cda3bcaff1a15a = []byte{ - // 230 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0xc1, 0x4a, 0x03, 0x31, - 0x10, 0x86, 0x29, 0x88, 0x87, 0x88, 0x0a, 0xeb, 0xc1, 0x75, 0x45, 0x90, 0x9e, 0x7a, 0x71, 0x03, - 0x2a, 0xde, 0xab, 0x07, 0x6f, 0x0a, 0xf5, 0x26, 0xc8, 0x92, 0xc4, 0xa1, 0x59, 0x68, 0x76, 0xc6, - 0xcc, 0xc4, 0xd7, 0xf0, 0x95, 0x25, 0x89, 0x42, 0x4b, 0x4f, 0x93, 0xe4, 0x9f, 0xf9, 0xbe, 0x30, - 0xea, 0x94, 0x78, 0x60, 0x88, 0xdf, 0x10, 0x7b, 0x8a, 0x28, 0xd8, 0x1c, 0x96, 0xc2, 0xdd, 0xa5, - 0xc3, 0x10, 0x70, 0xd2, 0xc4, 0x43, 0x3d, 0x0d, 0x26, 0x89, 0xaf, 0x4d, 0xdd, 0xd5, 0x5e, 0xc8, - 0x62, 0x24, 0xf1, 0x5f, 0x7c, 0x81, 0x24, 0x9c, 0xc3, 0x5c, 0x77, 0xf0, 0xf3, 0x27, 0x75, 0xfe, - 0x0c, 0xf2, 0x56, 0x9e, 0x5e, 0x49, 0x46, 0x9c, 0x78, 0x05, 0x5f, 0x09, 0x58, 0x9a, 0x85, 0x3a, - 0xc8, 0x8a, 0xf6, 0xe7, 0xe5, 0x7a, 0xb6, 0x38, 0xba, 0x3d, 0xab, 0x13, 0xdc, 0x57, 0x43, 0xbf, - 0x4c, 0xe2, 0x57, 0xa5, 0x63, 0xfe, 0xa1, 0xda, 0x7d, 0x08, 0x13, 0x4e, 0x0c, 0xcd, 0x52, 0x9d, - 0x54, 0x61, 0x96, 0xe7, 0xa4, 0x9d, 0x15, 0x5c, 0xf7, 0x8f, 0xcb, 0x7f, 0xea, 0x77, 0x67, 0x8f, - 0x79, 0xfb, 0xfa, 0xf8, 0xf0, 0x7e, 0xbf, 0x1e, 0xc5, 0x27, 0x9b, 0xd5, 0xda, 0x1a, 0x71, 0xde, - 0x61, 0x24, 0x4d, 0x9b, 0x14, 0x2c, 0xc4, 0x1b, 0x76, 0x1e, 0x82, 0x61, 0x6d, 0xd3, 0xb8, 0xf9, - 0xd4, 0x6b, 0xd4, 0x95, 0x6c, 0xeb, 0xea, 0xee, 0x7e, 0x03, 0x00, 0x00, 0xff, 0xff, 0x9f, 0x3d, - 0xb6, 0xa3, 0x54, 0x01, 0x00, 0x00, +var File_ps_server_proto protoreflect.FileDescriptor + +var file_ps_server_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x70, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x1a, 0x1b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2f, 0x70, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x61, 0x75, 0x74, 0x68, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, + 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x43, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, + 0x61, 0x75, 0x74, 0x68, 0x18, 0x8f, 0x4e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, 0x75, 0x74, 0x68, + 0x52, 0x04, 0x61, 0x75, 0x74, 0x68, 0x22, 0x5d, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, + 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ps_server_proto_rawDescOnce sync.Once + file_ps_server_proto_rawDescData = file_ps_server_proto_rawDesc +) + +func file_ps_server_proto_rawDescGZIP() []byte { + file_ps_server_proto_rawDescOnce.Do(func() { + file_ps_server_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_server_proto_rawDescData) + }) + return file_ps_server_proto_rawDescData +} + +var file_ps_server_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_ps_server_proto_goTypes = []interface{}{ + (*GetServerOptionsRequest)(nil), // 0: protos.GetServerOptionsRequest + (*GetServerOptionsResponse)(nil), // 1: protos.GetServerOptionsResponse + (*common.Auth)(nil), // 2: protos.common.Auth + (*opts.ServerOptions)(nil), // 3: protos.opts.ServerOptions +} +var file_ps_server_proto_depIdxs = []int32{ + 2, // 0: protos.GetServerOptionsRequest.auth:type_name -> protos.common.Auth + 3, // 1: protos.GetServerOptionsResponse.server_options:type_name -> protos.opts.ServerOptions + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_ps_server_proto_init() } +func file_ps_server_proto_init() { + if File_ps_server_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetServerOptionsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_server_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetServerOptionsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_server_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_server_proto_goTypes, + DependencyIndexes: file_ps_server_proto_depIdxs, + MessageInfos: file_ps_server_proto_msgTypes, + }.Build() + File_ps_server_proto = out.File + file_ps_server_proto_rawDesc = nil + file_ps_server_proto_goTypes = nil + file_ps_server_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_tunnel.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_tunnel.pb.go index a1279ce9a..422b3f116 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_tunnel.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/ps_tunnel.pb.go @@ -1,710 +1,1126 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: ps_tunnel.proto package protos import ( - fmt "fmt" common "github.com/batchcorp/plumber-schemas/build/go/protos/common" opts "github.com/batchcorp/plumber-schemas/build/go/protos/opts" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type GetAllTunnelsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Every gRPC request must have a valid auth config - Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` } -func (m *GetAllTunnelsRequest) Reset() { *m = GetAllTunnelsRequest{} } -func (m *GetAllTunnelsRequest) String() string { return proto.CompactTextString(m) } -func (*GetAllTunnelsRequest) ProtoMessage() {} -func (*GetAllTunnelsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_bf3c50f7df99c3c1, []int{0} +func (x *GetAllTunnelsRequest) Reset() { + *x = GetAllTunnelsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_tunnel_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GetAllTunnelsRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetAllTunnelsRequest.Unmarshal(m, b) -} -func (m *GetAllTunnelsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetAllTunnelsRequest.Marshal(b, m, deterministic) +func (x *GetAllTunnelsRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GetAllTunnelsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAllTunnelsRequest.Merge(m, src) -} -func (m *GetAllTunnelsRequest) XXX_Size() int { - return xxx_messageInfo_GetAllTunnelsRequest.Size(m) -} -func (m *GetAllTunnelsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetAllTunnelsRequest.DiscardUnknown(m) + +func (*GetAllTunnelsRequest) ProtoMessage() {} + +func (x *GetAllTunnelsRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_tunnel_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_GetAllTunnelsRequest proto.InternalMessageInfo +// Deprecated: Use GetAllTunnelsRequest.ProtoReflect.Descriptor instead. +func (*GetAllTunnelsRequest) Descriptor() ([]byte, []int) { + return file_ps_tunnel_proto_rawDescGZIP(), []int{0} +} -func (m *GetAllTunnelsRequest) GetAuth() *common.Auth { - if m != nil { - return m.Auth +func (x *GetAllTunnelsRequest) GetAuth() *common.Auth { + if x != nil { + return x.Auth } return nil } type GetAllTunnelsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` // Will be set as empty []Tunnel if no tunnels are configured - Opts []*opts.TunnelOptions `protobuf:"bytes,1,rep,name=opts,proto3" json:"opts,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Opts []*opts.TunnelOptions `protobuf:"bytes,1,rep,name=opts,proto3" json:"opts,omitempty"` } -func (m *GetAllTunnelsResponse) Reset() { *m = GetAllTunnelsResponse{} } -func (m *GetAllTunnelsResponse) String() string { return proto.CompactTextString(m) } -func (*GetAllTunnelsResponse) ProtoMessage() {} -func (*GetAllTunnelsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_bf3c50f7df99c3c1, []int{1} +func (x *GetAllTunnelsResponse) Reset() { + *x = GetAllTunnelsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_tunnel_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GetAllTunnelsResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetAllTunnelsResponse.Unmarshal(m, b) +func (x *GetAllTunnelsResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GetAllTunnelsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetAllTunnelsResponse.Marshal(b, m, deterministic) -} -func (m *GetAllTunnelsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAllTunnelsResponse.Merge(m, src) -} -func (m *GetAllTunnelsResponse) XXX_Size() int { - return xxx_messageInfo_GetAllTunnelsResponse.Size(m) -} -func (m *GetAllTunnelsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetAllTunnelsResponse.DiscardUnknown(m) + +func (*GetAllTunnelsResponse) ProtoMessage() {} + +func (x *GetAllTunnelsResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_tunnel_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_GetAllTunnelsResponse proto.InternalMessageInfo +// Deprecated: Use GetAllTunnelsResponse.ProtoReflect.Descriptor instead. +func (*GetAllTunnelsResponse) Descriptor() ([]byte, []int) { + return file_ps_tunnel_proto_rawDescGZIP(), []int{1} +} -func (m *GetAllTunnelsResponse) GetStatus() *common.Status { - if m != nil { - return m.Status +func (x *GetAllTunnelsResponse) GetStatus() *common.Status { + if x != nil { + return x.Status } return nil } -func (m *GetAllTunnelsResponse) GetOpts() []*opts.TunnelOptions { - if m != nil { - return m.Opts +func (x *GetAllTunnelsResponse) GetOpts() []*opts.TunnelOptions { + if x != nil { + return x.Opts } return nil } type GetTunnelRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Every gRPC request must have a valid auth config - Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` - TunnelId string `protobuf:"bytes,1,opt,name=tunnel_id,json=tunnelId,proto3" json:"tunnel_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` + TunnelId string `protobuf:"bytes,1,opt,name=tunnel_id,json=tunnelId,proto3" json:"tunnel_id,omitempty"` } -func (m *GetTunnelRequest) Reset() { *m = GetTunnelRequest{} } -func (m *GetTunnelRequest) String() string { return proto.CompactTextString(m) } -func (*GetTunnelRequest) ProtoMessage() {} -func (*GetTunnelRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_bf3c50f7df99c3c1, []int{2} +func (x *GetTunnelRequest) Reset() { + *x = GetTunnelRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_tunnel_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GetTunnelRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetTunnelRequest.Unmarshal(m, b) -} -func (m *GetTunnelRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetTunnelRequest.Marshal(b, m, deterministic) -} -func (m *GetTunnelRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetTunnelRequest.Merge(m, src) +func (x *GetTunnelRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GetTunnelRequest) XXX_Size() int { - return xxx_messageInfo_GetTunnelRequest.Size(m) -} -func (m *GetTunnelRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetTunnelRequest.DiscardUnknown(m) + +func (*GetTunnelRequest) ProtoMessage() {} + +func (x *GetTunnelRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_tunnel_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_GetTunnelRequest proto.InternalMessageInfo +// Deprecated: Use GetTunnelRequest.ProtoReflect.Descriptor instead. +func (*GetTunnelRequest) Descriptor() ([]byte, []int) { + return file_ps_tunnel_proto_rawDescGZIP(), []int{2} +} -func (m *GetTunnelRequest) GetAuth() *common.Auth { - if m != nil { - return m.Auth +func (x *GetTunnelRequest) GetAuth() *common.Auth { + if x != nil { + return x.Auth } return nil } -func (m *GetTunnelRequest) GetTunnelId() string { - if m != nil { - return m.TunnelId +func (x *GetTunnelRequest) GetTunnelId() string { + if x != nil { + return x.TunnelId } return "" } type GetTunnelResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` // Set only if status is OK - Opts *opts.TunnelOptions `protobuf:"bytes,1,opt,name=opts,proto3" json:"opts,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Opts *opts.TunnelOptions `protobuf:"bytes,1,opt,name=opts,proto3" json:"opts,omitempty"` } -func (m *GetTunnelResponse) Reset() { *m = GetTunnelResponse{} } -func (m *GetTunnelResponse) String() string { return proto.CompactTextString(m) } -func (*GetTunnelResponse) ProtoMessage() {} -func (*GetTunnelResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_bf3c50f7df99c3c1, []int{3} +func (x *GetTunnelResponse) Reset() { + *x = GetTunnelResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_tunnel_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GetTunnelResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetTunnelResponse.Unmarshal(m, b) -} -func (m *GetTunnelResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetTunnelResponse.Marshal(b, m, deterministic) -} -func (m *GetTunnelResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetTunnelResponse.Merge(m, src) -} -func (m *GetTunnelResponse) XXX_Size() int { - return xxx_messageInfo_GetTunnelResponse.Size(m) +func (x *GetTunnelResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GetTunnelResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetTunnelResponse.DiscardUnknown(m) + +func (*GetTunnelResponse) ProtoMessage() {} + +func (x *GetTunnelResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_tunnel_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_GetTunnelResponse proto.InternalMessageInfo +// Deprecated: Use GetTunnelResponse.ProtoReflect.Descriptor instead. +func (*GetTunnelResponse) Descriptor() ([]byte, []int) { + return file_ps_tunnel_proto_rawDescGZIP(), []int{3} +} -func (m *GetTunnelResponse) GetStatus() *common.Status { - if m != nil { - return m.Status +func (x *GetTunnelResponse) GetStatus() *common.Status { + if x != nil { + return x.Status } return nil } -func (m *GetTunnelResponse) GetOpts() *opts.TunnelOptions { - if m != nil { - return m.Opts +func (x *GetTunnelResponse) GetOpts() *opts.TunnelOptions { + if x != nil { + return x.Opts } return nil } type CreateTunnelRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Every gRPC request must have a valid auth config - Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` - Opts *opts.TunnelOptions `protobuf:"bytes,1,opt,name=opts,proto3" json:"opts,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` + Opts *opts.TunnelOptions `protobuf:"bytes,1,opt,name=opts,proto3" json:"opts,omitempty"` } -func (m *CreateTunnelRequest) Reset() { *m = CreateTunnelRequest{} } -func (m *CreateTunnelRequest) String() string { return proto.CompactTextString(m) } -func (*CreateTunnelRequest) ProtoMessage() {} -func (*CreateTunnelRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_bf3c50f7df99c3c1, []int{4} +func (x *CreateTunnelRequest) Reset() { + *x = CreateTunnelRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_tunnel_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *CreateTunnelRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateTunnelRequest.Unmarshal(m, b) -} -func (m *CreateTunnelRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateTunnelRequest.Marshal(b, m, deterministic) -} -func (m *CreateTunnelRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateTunnelRequest.Merge(m, src) -} -func (m *CreateTunnelRequest) XXX_Size() int { - return xxx_messageInfo_CreateTunnelRequest.Size(m) +func (x *CreateTunnelRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CreateTunnelRequest) XXX_DiscardUnknown() { - xxx_messageInfo_CreateTunnelRequest.DiscardUnknown(m) + +func (*CreateTunnelRequest) ProtoMessage() {} + +func (x *CreateTunnelRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_tunnel_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_CreateTunnelRequest proto.InternalMessageInfo +// Deprecated: Use CreateTunnelRequest.ProtoReflect.Descriptor instead. +func (*CreateTunnelRequest) Descriptor() ([]byte, []int) { + return file_ps_tunnel_proto_rawDescGZIP(), []int{4} +} -func (m *CreateTunnelRequest) GetAuth() *common.Auth { - if m != nil { - return m.Auth +func (x *CreateTunnelRequest) GetAuth() *common.Auth { + if x != nil { + return x.Auth } return nil } -func (m *CreateTunnelRequest) GetOpts() *opts.TunnelOptions { - if m != nil { - return m.Opts +func (x *CreateTunnelRequest) GetOpts() *opts.TunnelOptions { + if x != nil { + return x.Opts } return nil } type CreateTunnelResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` // ID of the created tunnel entry - TunnelId string `protobuf:"bytes,1,opt,name=tunnel_id,json=tunnelId,proto3" json:"tunnel_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + TunnelId string `protobuf:"bytes,1,opt,name=tunnel_id,json=tunnelId,proto3" json:"tunnel_id,omitempty"` } -func (m *CreateTunnelResponse) Reset() { *m = CreateTunnelResponse{} } -func (m *CreateTunnelResponse) String() string { return proto.CompactTextString(m) } -func (*CreateTunnelResponse) ProtoMessage() {} -func (*CreateTunnelResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_bf3c50f7df99c3c1, []int{5} +func (x *CreateTunnelResponse) Reset() { + *x = CreateTunnelResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_tunnel_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *CreateTunnelResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateTunnelResponse.Unmarshal(m, b) -} -func (m *CreateTunnelResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateTunnelResponse.Marshal(b, m, deterministic) -} -func (m *CreateTunnelResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateTunnelResponse.Merge(m, src) +func (x *CreateTunnelResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CreateTunnelResponse) XXX_Size() int { - return xxx_messageInfo_CreateTunnelResponse.Size(m) -} -func (m *CreateTunnelResponse) XXX_DiscardUnknown() { - xxx_messageInfo_CreateTunnelResponse.DiscardUnknown(m) + +func (*CreateTunnelResponse) ProtoMessage() {} + +func (x *CreateTunnelResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_tunnel_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_CreateTunnelResponse proto.InternalMessageInfo +// Deprecated: Use CreateTunnelResponse.ProtoReflect.Descriptor instead. +func (*CreateTunnelResponse) Descriptor() ([]byte, []int) { + return file_ps_tunnel_proto_rawDescGZIP(), []int{5} +} -func (m *CreateTunnelResponse) GetStatus() *common.Status { - if m != nil { - return m.Status +func (x *CreateTunnelResponse) GetStatus() *common.Status { + if x != nil { + return x.Status } return nil } -func (m *CreateTunnelResponse) GetTunnelId() string { - if m != nil { - return m.TunnelId +func (x *CreateTunnelResponse) GetTunnelId() string { + if x != nil { + return x.TunnelId } return "" } // WARNING: Updating a destination that is in-use can result in missing data during replay type UpdateTunnelRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Every gRPC request must have a valid auth config - Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` - TunnelId string `protobuf:"bytes,1,opt,name=tunnel_id,json=tunnelId,proto3" json:"tunnel_id,omitempty"` - Opts *opts.TunnelOptions `protobuf:"bytes,2,opt,name=opts,proto3" json:"opts,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` + TunnelId string `protobuf:"bytes,1,opt,name=tunnel_id,json=tunnelId,proto3" json:"tunnel_id,omitempty"` + Opts *opts.TunnelOptions `protobuf:"bytes,2,opt,name=opts,proto3" json:"opts,omitempty"` } -func (m *UpdateTunnelRequest) Reset() { *m = UpdateTunnelRequest{} } -func (m *UpdateTunnelRequest) String() string { return proto.CompactTextString(m) } -func (*UpdateTunnelRequest) ProtoMessage() {} -func (*UpdateTunnelRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_bf3c50f7df99c3c1, []int{6} +func (x *UpdateTunnelRequest) Reset() { + *x = UpdateTunnelRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_tunnel_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *UpdateTunnelRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UpdateTunnelRequest.Unmarshal(m, b) -} -func (m *UpdateTunnelRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UpdateTunnelRequest.Marshal(b, m, deterministic) +func (x *UpdateTunnelRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *UpdateTunnelRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_UpdateTunnelRequest.Merge(m, src) -} -func (m *UpdateTunnelRequest) XXX_Size() int { - return xxx_messageInfo_UpdateTunnelRequest.Size(m) -} -func (m *UpdateTunnelRequest) XXX_DiscardUnknown() { - xxx_messageInfo_UpdateTunnelRequest.DiscardUnknown(m) + +func (*UpdateTunnelRequest) ProtoMessage() {} + +func (x *UpdateTunnelRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_tunnel_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_UpdateTunnelRequest proto.InternalMessageInfo +// Deprecated: Use UpdateTunnelRequest.ProtoReflect.Descriptor instead. +func (*UpdateTunnelRequest) Descriptor() ([]byte, []int) { + return file_ps_tunnel_proto_rawDescGZIP(), []int{6} +} -func (m *UpdateTunnelRequest) GetAuth() *common.Auth { - if m != nil { - return m.Auth +func (x *UpdateTunnelRequest) GetAuth() *common.Auth { + if x != nil { + return x.Auth } return nil } -func (m *UpdateTunnelRequest) GetTunnelId() string { - if m != nil { - return m.TunnelId +func (x *UpdateTunnelRequest) GetTunnelId() string { + if x != nil { + return x.TunnelId } return "" } -func (m *UpdateTunnelRequest) GetOpts() *opts.TunnelOptions { - if m != nil { - return m.Opts +func (x *UpdateTunnelRequest) GetOpts() *opts.TunnelOptions { + if x != nil { + return x.Opts } return nil } type UpdateTunnelResponse struct { - Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *UpdateTunnelResponse) Reset() { *m = UpdateTunnelResponse{} } -func (m *UpdateTunnelResponse) String() string { return proto.CompactTextString(m) } -func (*UpdateTunnelResponse) ProtoMessage() {} -func (*UpdateTunnelResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_bf3c50f7df99c3c1, []int{7} + Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` } -func (m *UpdateTunnelResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UpdateTunnelResponse.Unmarshal(m, b) -} -func (m *UpdateTunnelResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UpdateTunnelResponse.Marshal(b, m, deterministic) -} -func (m *UpdateTunnelResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_UpdateTunnelResponse.Merge(m, src) +func (x *UpdateTunnelResponse) Reset() { + *x = UpdateTunnelResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_tunnel_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *UpdateTunnelResponse) XXX_Size() int { - return xxx_messageInfo_UpdateTunnelResponse.Size(m) + +func (x *UpdateTunnelResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *UpdateTunnelResponse) XXX_DiscardUnknown() { - xxx_messageInfo_UpdateTunnelResponse.DiscardUnknown(m) + +func (*UpdateTunnelResponse) ProtoMessage() {} + +func (x *UpdateTunnelResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_tunnel_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_UpdateTunnelResponse proto.InternalMessageInfo +// Deprecated: Use UpdateTunnelResponse.ProtoReflect.Descriptor instead. +func (*UpdateTunnelResponse) Descriptor() ([]byte, []int) { + return file_ps_tunnel_proto_rawDescGZIP(), []int{7} +} -func (m *UpdateTunnelResponse) GetStatus() *common.Status { - if m != nil { - return m.Status +func (x *UpdateTunnelResponse) GetStatus() *common.Status { + if x != nil { + return x.Status } return nil } // Resume a paused relay type ResumeTunnelRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Every gRPC request must have a valid auth config - Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` - TunnelId string `protobuf:"bytes,1,opt,name=tunnel_id,json=tunnelId,proto3" json:"tunnel_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` + TunnelId string `protobuf:"bytes,1,opt,name=tunnel_id,json=tunnelId,proto3" json:"tunnel_id,omitempty"` } -func (m *ResumeTunnelRequest) Reset() { *m = ResumeTunnelRequest{} } -func (m *ResumeTunnelRequest) String() string { return proto.CompactTextString(m) } -func (*ResumeTunnelRequest) ProtoMessage() {} -func (*ResumeTunnelRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_bf3c50f7df99c3c1, []int{8} +func (x *ResumeTunnelRequest) Reset() { + *x = ResumeTunnelRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_tunnel_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ResumeTunnelRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ResumeTunnelRequest.Unmarshal(m, b) -} -func (m *ResumeTunnelRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ResumeTunnelRequest.Marshal(b, m, deterministic) -} -func (m *ResumeTunnelRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResumeTunnelRequest.Merge(m, src) +func (x *ResumeTunnelRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ResumeTunnelRequest) XXX_Size() int { - return xxx_messageInfo_ResumeTunnelRequest.Size(m) -} -func (m *ResumeTunnelRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ResumeTunnelRequest.DiscardUnknown(m) + +func (*ResumeTunnelRequest) ProtoMessage() {} + +func (x *ResumeTunnelRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_tunnel_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ResumeTunnelRequest proto.InternalMessageInfo +// Deprecated: Use ResumeTunnelRequest.ProtoReflect.Descriptor instead. +func (*ResumeTunnelRequest) Descriptor() ([]byte, []int) { + return file_ps_tunnel_proto_rawDescGZIP(), []int{8} +} -func (m *ResumeTunnelRequest) GetAuth() *common.Auth { - if m != nil { - return m.Auth +func (x *ResumeTunnelRequest) GetAuth() *common.Auth { + if x != nil { + return x.Auth } return nil } -func (m *ResumeTunnelRequest) GetTunnelId() string { - if m != nil { - return m.TunnelId +func (x *ResumeTunnelRequest) GetTunnelId() string { + if x != nil { + return x.TunnelId } return "" } type ResumeTunnelResponse struct { - Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *ResumeTunnelResponse) Reset() { *m = ResumeTunnelResponse{} } -func (m *ResumeTunnelResponse) String() string { return proto.CompactTextString(m) } -func (*ResumeTunnelResponse) ProtoMessage() {} -func (*ResumeTunnelResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_bf3c50f7df99c3c1, []int{9} + Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` } -func (m *ResumeTunnelResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ResumeTunnelResponse.Unmarshal(m, b) -} -func (m *ResumeTunnelResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ResumeTunnelResponse.Marshal(b, m, deterministic) -} -func (m *ResumeTunnelResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResumeTunnelResponse.Merge(m, src) +func (x *ResumeTunnelResponse) Reset() { + *x = ResumeTunnelResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_tunnel_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ResumeTunnelResponse) XXX_Size() int { - return xxx_messageInfo_ResumeTunnelResponse.Size(m) + +func (x *ResumeTunnelResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ResumeTunnelResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ResumeTunnelResponse.DiscardUnknown(m) + +func (*ResumeTunnelResponse) ProtoMessage() {} + +func (x *ResumeTunnelResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_tunnel_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ResumeTunnelResponse proto.InternalMessageInfo +// Deprecated: Use ResumeTunnelResponse.ProtoReflect.Descriptor instead. +func (*ResumeTunnelResponse) Descriptor() ([]byte, []int) { + return file_ps_tunnel_proto_rawDescGZIP(), []int{9} +} -func (m *ResumeTunnelResponse) GetStatus() *common.Status { - if m != nil { - return m.Status +func (x *ResumeTunnelResponse) GetStatus() *common.Status { + if x != nil { + return x.Status } return nil } // Temporarily stop/pause a relay type StopTunnelRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Every gRPC request must have a valid auth config - Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` - TunnelId string `protobuf:"bytes,1,opt,name=tunnel_id,json=tunnelId,proto3" json:"tunnel_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` + TunnelId string `protobuf:"bytes,1,opt,name=tunnel_id,json=tunnelId,proto3" json:"tunnel_id,omitempty"` } -func (m *StopTunnelRequest) Reset() { *m = StopTunnelRequest{} } -func (m *StopTunnelRequest) String() string { return proto.CompactTextString(m) } -func (*StopTunnelRequest) ProtoMessage() {} -func (*StopTunnelRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_bf3c50f7df99c3c1, []int{10} +func (x *StopTunnelRequest) Reset() { + *x = StopTunnelRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_tunnel_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *StopTunnelRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StopTunnelRequest.Unmarshal(m, b) -} -func (m *StopTunnelRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StopTunnelRequest.Marshal(b, m, deterministic) +func (x *StopTunnelRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *StopTunnelRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_StopTunnelRequest.Merge(m, src) -} -func (m *StopTunnelRequest) XXX_Size() int { - return xxx_messageInfo_StopTunnelRequest.Size(m) -} -func (m *StopTunnelRequest) XXX_DiscardUnknown() { - xxx_messageInfo_StopTunnelRequest.DiscardUnknown(m) + +func (*StopTunnelRequest) ProtoMessage() {} + +func (x *StopTunnelRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_tunnel_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_StopTunnelRequest proto.InternalMessageInfo +// Deprecated: Use StopTunnelRequest.ProtoReflect.Descriptor instead. +func (*StopTunnelRequest) Descriptor() ([]byte, []int) { + return file_ps_tunnel_proto_rawDescGZIP(), []int{10} +} -func (m *StopTunnelRequest) GetAuth() *common.Auth { - if m != nil { - return m.Auth +func (x *StopTunnelRequest) GetAuth() *common.Auth { + if x != nil { + return x.Auth } return nil } -func (m *StopTunnelRequest) GetTunnelId() string { - if m != nil { - return m.TunnelId +func (x *StopTunnelRequest) GetTunnelId() string { + if x != nil { + return x.TunnelId } return "" } type StopTunnelResponse struct { - Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *StopTunnelResponse) Reset() { *m = StopTunnelResponse{} } -func (m *StopTunnelResponse) String() string { return proto.CompactTextString(m) } -func (*StopTunnelResponse) ProtoMessage() {} -func (*StopTunnelResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_bf3c50f7df99c3c1, []int{11} + Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` } -func (m *StopTunnelResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StopTunnelResponse.Unmarshal(m, b) -} -func (m *StopTunnelResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StopTunnelResponse.Marshal(b, m, deterministic) -} -func (m *StopTunnelResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_StopTunnelResponse.Merge(m, src) +func (x *StopTunnelResponse) Reset() { + *x = StopTunnelResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_tunnel_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *StopTunnelResponse) XXX_Size() int { - return xxx_messageInfo_StopTunnelResponse.Size(m) + +func (x *StopTunnelResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *StopTunnelResponse) XXX_DiscardUnknown() { - xxx_messageInfo_StopTunnelResponse.DiscardUnknown(m) + +func (*StopTunnelResponse) ProtoMessage() {} + +func (x *StopTunnelResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_tunnel_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_StopTunnelResponse proto.InternalMessageInfo +// Deprecated: Use StopTunnelResponse.ProtoReflect.Descriptor instead. +func (*StopTunnelResponse) Descriptor() ([]byte, []int) { + return file_ps_tunnel_proto_rawDescGZIP(), []int{11} +} -func (m *StopTunnelResponse) GetStatus() *common.Status { - if m != nil { - return m.Status +func (x *StopTunnelResponse) GetStatus() *common.Status { + if x != nil { + return x.Status } return nil } type DeleteTunnelRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Every gRPC request must have a valid auth config - Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` - TunnelId string `protobuf:"bytes,1,opt,name=tunnel_id,json=tunnelId,proto3" json:"tunnel_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Auth *common.Auth `protobuf:"bytes,9999,opt,name=auth,proto3" json:"auth,omitempty"` + TunnelId string `protobuf:"bytes,1,opt,name=tunnel_id,json=tunnelId,proto3" json:"tunnel_id,omitempty"` } -func (m *DeleteTunnelRequest) Reset() { *m = DeleteTunnelRequest{} } -func (m *DeleteTunnelRequest) String() string { return proto.CompactTextString(m) } -func (*DeleteTunnelRequest) ProtoMessage() {} -func (*DeleteTunnelRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_bf3c50f7df99c3c1, []int{12} +func (x *DeleteTunnelRequest) Reset() { + *x = DeleteTunnelRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_tunnel_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *DeleteTunnelRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeleteTunnelRequest.Unmarshal(m, b) -} -func (m *DeleteTunnelRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeleteTunnelRequest.Marshal(b, m, deterministic) -} -func (m *DeleteTunnelRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteTunnelRequest.Merge(m, src) +func (x *DeleteTunnelRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *DeleteTunnelRequest) XXX_Size() int { - return xxx_messageInfo_DeleteTunnelRequest.Size(m) -} -func (m *DeleteTunnelRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteTunnelRequest.DiscardUnknown(m) + +func (*DeleteTunnelRequest) ProtoMessage() {} + +func (x *DeleteTunnelRequest) ProtoReflect() protoreflect.Message { + mi := &file_ps_tunnel_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_DeleteTunnelRequest proto.InternalMessageInfo +// Deprecated: Use DeleteTunnelRequest.ProtoReflect.Descriptor instead. +func (*DeleteTunnelRequest) Descriptor() ([]byte, []int) { + return file_ps_tunnel_proto_rawDescGZIP(), []int{12} +} -func (m *DeleteTunnelRequest) GetAuth() *common.Auth { - if m != nil { - return m.Auth +func (x *DeleteTunnelRequest) GetAuth() *common.Auth { + if x != nil { + return x.Auth } return nil } -func (m *DeleteTunnelRequest) GetTunnelId() string { - if m != nil { - return m.TunnelId +func (x *DeleteTunnelRequest) GetTunnelId() string { + if x != nil { + return x.TunnelId } return "" } type DeleteTunnelResponse struct { - Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *DeleteTunnelResponse) Reset() { *m = DeleteTunnelResponse{} } -func (m *DeleteTunnelResponse) String() string { return proto.CompactTextString(m) } -func (*DeleteTunnelResponse) ProtoMessage() {} -func (*DeleteTunnelResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_bf3c50f7df99c3c1, []int{13} + Status *common.Status `protobuf:"bytes,1000,opt,name=status,proto3" json:"status,omitempty"` } -func (m *DeleteTunnelResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeleteTunnelResponse.Unmarshal(m, b) -} -func (m *DeleteTunnelResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeleteTunnelResponse.Marshal(b, m, deterministic) -} -func (m *DeleteTunnelResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteTunnelResponse.Merge(m, src) +func (x *DeleteTunnelResponse) Reset() { + *x = DeleteTunnelResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ps_tunnel_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *DeleteTunnelResponse) XXX_Size() int { - return xxx_messageInfo_DeleteTunnelResponse.Size(m) + +func (x *DeleteTunnelResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *DeleteTunnelResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteTunnelResponse.DiscardUnknown(m) + +func (*DeleteTunnelResponse) ProtoMessage() {} + +func (x *DeleteTunnelResponse) ProtoReflect() protoreflect.Message { + mi := &file_ps_tunnel_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_DeleteTunnelResponse proto.InternalMessageInfo +// Deprecated: Use DeleteTunnelResponse.ProtoReflect.Descriptor instead. +func (*DeleteTunnelResponse) Descriptor() ([]byte, []int) { + return file_ps_tunnel_proto_rawDescGZIP(), []int{13} +} -func (m *DeleteTunnelResponse) GetStatus() *common.Status { - if m != nil { - return m.Status +func (x *DeleteTunnelResponse) GetStatus() *common.Status { + if x != nil { + return x.Status } return nil } -func init() { - proto.RegisterType((*GetAllTunnelsRequest)(nil), "protos.GetAllTunnelsRequest") - proto.RegisterType((*GetAllTunnelsResponse)(nil), "protos.GetAllTunnelsResponse") - proto.RegisterType((*GetTunnelRequest)(nil), "protos.GetTunnelRequest") - proto.RegisterType((*GetTunnelResponse)(nil), "protos.GetTunnelResponse") - proto.RegisterType((*CreateTunnelRequest)(nil), "protos.CreateTunnelRequest") - proto.RegisterType((*CreateTunnelResponse)(nil), "protos.CreateTunnelResponse") - proto.RegisterType((*UpdateTunnelRequest)(nil), "protos.UpdateTunnelRequest") - proto.RegisterType((*UpdateTunnelResponse)(nil), "protos.UpdateTunnelResponse") - proto.RegisterType((*ResumeTunnelRequest)(nil), "protos.ResumeTunnelRequest") - proto.RegisterType((*ResumeTunnelResponse)(nil), "protos.ResumeTunnelResponse") - proto.RegisterType((*StopTunnelRequest)(nil), "protos.StopTunnelRequest") - proto.RegisterType((*StopTunnelResponse)(nil), "protos.StopTunnelResponse") - proto.RegisterType((*DeleteTunnelRequest)(nil), "protos.DeleteTunnelRequest") - proto.RegisterType((*DeleteTunnelResponse)(nil), "protos.DeleteTunnelResponse") -} - -func init() { proto.RegisterFile("ps_tunnel.proto", fileDescriptor_bf3c50f7df99c3c1) } - -var fileDescriptor_bf3c50f7df99c3c1 = []byte{ - // 386 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0x4f, 0x8b, 0xda, 0x50, - 0x14, 0xc5, 0x49, 0x2b, 0xb6, 0x5e, 0x17, 0xad, 0x89, 0x42, 0xaa, 0x14, 0x24, 0xab, 0x6c, 0x9a, - 0x80, 0x2d, 0x5d, 0xd7, 0x56, 0x2a, 0xdd, 0xb4, 0x10, 0x3b, 0x8b, 0x91, 0x81, 0x90, 0x3f, 0x0f, - 0x13, 0x48, 0xf2, 0xde, 0xe4, 0xde, 0xc7, 0x7c, 0x89, 0x81, 0xf9, 0x9a, 0xf3, 0x31, 0x86, 0xe4, - 0x39, 0x83, 0x71, 0x40, 0x34, 0xe2, 0xea, 0x85, 0x7b, 0x0e, 0xbf, 0x7b, 0xce, 0x5d, 0x04, 0x3e, - 0x08, 0xf4, 0x49, 0x16, 0x05, 0xcb, 0x1c, 0x51, 0x72, 0xe2, 0x7a, 0xb7, 0x7e, 0x70, 0x3c, 0x89, - 0x78, 0x9e, 0xf3, 0xc2, 0x15, 0xe8, 0xab, 0x2f, 0x3f, 0x90, 0x94, 0x28, 0xd3, 0xf8, 0xf3, 0x2b, - 0x11, 0x29, 0x20, 0x89, 0x5b, 0xf9, 0x13, 0x17, 0x84, 0x95, 0x58, 0xbd, 0x0d, 0xbc, 0xf5, 0x03, - 0x86, 0x4b, 0x46, 0xf3, 0x2c, 0xfb, 0x5f, 0x4f, 0xd1, 0x63, 0xb7, 0x92, 0x21, 0xe9, 0x36, 0x74, - 0x2a, 0xbe, 0xf9, 0xf0, 0x77, 0xaa, 0xd9, 0xfd, 0x99, 0xa1, 0xec, 0xe8, 0x28, 0xbc, 0x33, 0x97, - 0x94, 0x78, 0xb5, 0xc3, 0xba, 0x83, 0xd1, 0x1e, 0x01, 0x05, 0x2f, 0x90, 0xe9, 0x0e, 0x74, 0x55, - 0x0a, 0xf3, 0xf1, 0x5d, 0x0d, 0x19, 0xed, 0x41, 0x56, 0xb5, 0xea, 0x6d, 0x5d, 0xba, 0x03, 0x9d, - 0x2a, 0x9f, 0xa9, 0x4d, 0xdf, 0xda, 0xfd, 0xd9, 0xf8, 0xd9, 0x5c, 0xcd, 0x1c, 0xc5, 0xfe, 0x27, - 0x28, 0xe5, 0x05, 0x7a, 0xb5, 0xcf, 0xba, 0x86, 0x8f, 0x4b, 0x46, 0x4a, 0x39, 0x39, 0xb6, 0x3e, - 0x81, 0x9e, 0x3a, 0x84, 0x9f, 0xc6, 0xa6, 0x36, 0xd5, 0xec, 0x9e, 0xf7, 0x5e, 0x0d, 0xfe, 0xc4, - 0x16, 0xc2, 0x60, 0x07, 0x7d, 0x76, 0x1f, 0xed, 0xa8, 0x3e, 0x1c, 0x8c, 0x5f, 0x25, 0x0b, 0x88, - 0xb5, 0xad, 0x74, 0xea, 0xc2, 0x08, 0x86, 0xcd, 0x85, 0x2d, 0x8b, 0x1e, 0x3c, 0xe5, 0xbd, 0x06, - 0xc6, 0x95, 0x88, 0xcf, 0xa8, 0x75, 0x08, 0xff, 0xd2, 0xf9, 0xcd, 0x91, 0x9d, 0x7f, 0xc3, 0xb0, - 0x99, 0xa6, 0x5d, 0x67, 0xeb, 0x06, 0x0c, 0x8f, 0xa1, 0xcc, 0x2f, 0xd2, 0xaa, 0x4a, 0xd9, 0xa4, - 0xb7, 0x4c, 0xb9, 0x86, 0xc1, 0x8a, 0xb8, 0xb8, 0x48, 0xc6, 0x05, 0xe8, 0xbb, 0xec, 0xf6, 0x77, - 0x5c, 0xb0, 0x8c, 0xd1, 0xc5, 0xee, 0xd8, 0xa4, 0xb7, 0x4b, 0xf9, 0xf3, 0xfb, 0xfa, 0xdb, 0x26, - 0xa5, 0x44, 0x86, 0x95, 0xee, 0x86, 0x01, 0x45, 0x49, 0xc4, 0x4b, 0xe1, 0x8a, 0x4c, 0xe6, 0x21, - 0x2b, 0xbf, 0x60, 0x94, 0xb0, 0x3c, 0x40, 0x37, 0x94, 0x69, 0x16, 0xbb, 0x1b, 0xee, 0x2a, 0x5a, - 0xa8, 0x7e, 0xde, 0x5f, 0x9f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x23, 0x56, 0x8d, 0x6e, 0xd6, 0x05, - 0x00, 0x00, +var File_ps_tunnel_proto protoreflect.FileDescriptor + +var file_ps_tunnel_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x70, 0x73, 0x5f, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x1a, 0x1b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2f, 0x70, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x61, 0x75, 0x74, 0x68, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, + 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, + 0x70, 0x74, 0x73, 0x5f, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x40, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x68, + 0x18, 0x8f, 0x4e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x04, 0x61, 0x75, + 0x74, 0x68, 0x22, 0x77, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x54, 0x75, 0x6e, 0x6e, + 0x65, 0x6c, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2e, 0x0a, 0x04, 0x6f, + 0x70, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x04, 0x6f, 0x70, 0x74, 0x73, 0x22, 0x59, 0x0a, 0x10, 0x47, + 0x65, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x28, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x68, 0x18, 0x8f, 0x4e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, + 0x75, 0x74, 0x68, 0x52, 0x04, 0x61, 0x75, 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x75, 0x6e, + 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x75, + 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x22, 0x73, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x54, 0x75, 0x6e, + 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2e, 0x0a, 0x04, 0x6f, + 0x70, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x04, 0x6f, 0x70, 0x74, 0x73, 0x22, 0x6f, 0x0a, 0x13, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x68, 0x18, 0x8f, 0x4e, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x04, 0x61, 0x75, 0x74, 0x68, 0x12, 0x2e, 0x0a, 0x04, + 0x6f, 0x70, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x04, 0x6f, 0x70, 0x74, 0x73, 0x22, 0x63, 0x0a, 0x14, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0xe8, + 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, + 0x64, 0x22, 0x8c, 0x01, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, + 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x61, 0x75, 0x74, + 0x68, 0x18, 0x8f, 0x4e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x04, 0x61, + 0x75, 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, + 0x12, 0x2e, 0x0a, 0x04, 0x6f, 0x70, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x54, 0x75, 0x6e, + 0x6e, 0x65, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x04, 0x6f, 0x70, 0x74, 0x73, + 0x22, 0x46, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x5c, 0x0a, 0x13, 0x52, 0x65, 0x73, 0x75, + 0x6d, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x28, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x68, 0x18, 0x8f, 0x4e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, + 0x75, 0x74, 0x68, 0x52, 0x04, 0x61, 0x75, 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x75, 0x6e, + 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x75, + 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x22, 0x46, 0x0a, 0x14, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, + 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, + 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x5a, + 0x0a, 0x11, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x68, 0x18, 0x8f, 0x4e, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x04, 0x61, 0x75, 0x74, 0x68, 0x12, 0x1b, 0x0a, + 0x09, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x22, 0x44, 0x0a, 0x12, 0x53, 0x74, + 0x6f, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x22, 0x5c, 0x0a, 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x68, 0x18, + 0x8f, 0x4e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x04, 0x61, 0x75, 0x74, + 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x22, 0x46, + 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, + 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, + 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ps_tunnel_proto_rawDescOnce sync.Once + file_ps_tunnel_proto_rawDescData = file_ps_tunnel_proto_rawDesc +) + +func file_ps_tunnel_proto_rawDescGZIP() []byte { + file_ps_tunnel_proto_rawDescOnce.Do(func() { + file_ps_tunnel_proto_rawDescData = protoimpl.X.CompressGZIP(file_ps_tunnel_proto_rawDescData) + }) + return file_ps_tunnel_proto_rawDescData +} + +var file_ps_tunnel_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_ps_tunnel_proto_goTypes = []interface{}{ + (*GetAllTunnelsRequest)(nil), // 0: protos.GetAllTunnelsRequest + (*GetAllTunnelsResponse)(nil), // 1: protos.GetAllTunnelsResponse + (*GetTunnelRequest)(nil), // 2: protos.GetTunnelRequest + (*GetTunnelResponse)(nil), // 3: protos.GetTunnelResponse + (*CreateTunnelRequest)(nil), // 4: protos.CreateTunnelRequest + (*CreateTunnelResponse)(nil), // 5: protos.CreateTunnelResponse + (*UpdateTunnelRequest)(nil), // 6: protos.UpdateTunnelRequest + (*UpdateTunnelResponse)(nil), // 7: protos.UpdateTunnelResponse + (*ResumeTunnelRequest)(nil), // 8: protos.ResumeTunnelRequest + (*ResumeTunnelResponse)(nil), // 9: protos.ResumeTunnelResponse + (*StopTunnelRequest)(nil), // 10: protos.StopTunnelRequest + (*StopTunnelResponse)(nil), // 11: protos.StopTunnelResponse + (*DeleteTunnelRequest)(nil), // 12: protos.DeleteTunnelRequest + (*DeleteTunnelResponse)(nil), // 13: protos.DeleteTunnelResponse + (*common.Auth)(nil), // 14: protos.common.Auth + (*common.Status)(nil), // 15: protos.common.Status + (*opts.TunnelOptions)(nil), // 16: protos.opts.TunnelOptions +} +var file_ps_tunnel_proto_depIdxs = []int32{ + 14, // 0: protos.GetAllTunnelsRequest.auth:type_name -> protos.common.Auth + 15, // 1: protos.GetAllTunnelsResponse.status:type_name -> protos.common.Status + 16, // 2: protos.GetAllTunnelsResponse.opts:type_name -> protos.opts.TunnelOptions + 14, // 3: protos.GetTunnelRequest.auth:type_name -> protos.common.Auth + 15, // 4: protos.GetTunnelResponse.status:type_name -> protos.common.Status + 16, // 5: protos.GetTunnelResponse.opts:type_name -> protos.opts.TunnelOptions + 14, // 6: protos.CreateTunnelRequest.auth:type_name -> protos.common.Auth + 16, // 7: protos.CreateTunnelRequest.opts:type_name -> protos.opts.TunnelOptions + 15, // 8: protos.CreateTunnelResponse.status:type_name -> protos.common.Status + 14, // 9: protos.UpdateTunnelRequest.auth:type_name -> protos.common.Auth + 16, // 10: protos.UpdateTunnelRequest.opts:type_name -> protos.opts.TunnelOptions + 15, // 11: protos.UpdateTunnelResponse.status:type_name -> protos.common.Status + 14, // 12: protos.ResumeTunnelRequest.auth:type_name -> protos.common.Auth + 15, // 13: protos.ResumeTunnelResponse.status:type_name -> protos.common.Status + 14, // 14: protos.StopTunnelRequest.auth:type_name -> protos.common.Auth + 15, // 15: protos.StopTunnelResponse.status:type_name -> protos.common.Status + 14, // 16: protos.DeleteTunnelRequest.auth:type_name -> protos.common.Auth + 15, // 17: protos.DeleteTunnelResponse.status:type_name -> protos.common.Status + 18, // [18:18] is the sub-list for method output_type + 18, // [18:18] is the sub-list for method input_type + 18, // [18:18] is the sub-list for extension type_name + 18, // [18:18] is the sub-list for extension extendee + 0, // [0:18] is the sub-list for field type_name +} + +func init() { file_ps_tunnel_proto_init() } +func file_ps_tunnel_proto_init() { + if File_ps_tunnel_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ps_tunnel_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAllTunnelsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_tunnel_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAllTunnelsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_tunnel_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetTunnelRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_tunnel_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetTunnelResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_tunnel_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateTunnelRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_tunnel_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateTunnelResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_tunnel_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateTunnelRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_tunnel_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateTunnelResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_tunnel_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResumeTunnelRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_tunnel_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResumeTunnelResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_tunnel_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StopTunnelRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_tunnel_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StopTunnelResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_tunnel_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteTunnelRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ps_tunnel_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteTunnelResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ps_tunnel_proto_rawDesc, + NumEnums: 0, + NumMessages: 14, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ps_tunnel_proto_goTypes, + DependencyIndexes: file_ps_tunnel_proto_depIdxs, + MessageInfos: file_ps_tunnel_proto_msgTypes, + }.Build() + File_ps_tunnel_proto = out.File + file_ps_tunnel_proto_rawDesc = nil + file_ps_tunnel_proto_goTypes = nil + file_ps_tunnel_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_activemq.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_activemq.pb.go index 2f9178a0e..408203937 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_activemq.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_activemq.pb.go @@ -1,117 +1,187 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: records/ps_records_activemq.proto package records import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type ActiveMQ struct { - Destination string `protobuf:"bytes,1,opt,name=destination,proto3" json:"destination,omitempty"` - ContentType string `protobuf:"bytes,2,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` - SubscriptionId string `protobuf:"bytes,3,opt,name=subscription_id,json=subscriptionId,proto3" json:"subscription_id,omitempty"` - Timestamp int64 `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Value []byte `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Destination string `protobuf:"bytes,1,opt,name=destination,proto3" json:"destination,omitempty"` + ContentType string `protobuf:"bytes,2,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` + SubscriptionId string `protobuf:"bytes,3,opt,name=subscription_id,json=subscriptionId,proto3" json:"subscription_id,omitempty"` + Timestamp int64 `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Value []byte `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"` } -func (m *ActiveMQ) Reset() { *m = ActiveMQ{} } -func (m *ActiveMQ) String() string { return proto.CompactTextString(m) } -func (*ActiveMQ) ProtoMessage() {} -func (*ActiveMQ) Descriptor() ([]byte, []int) { - return fileDescriptor_8000da1c2b98da6e, []int{0} +func (x *ActiveMQ) Reset() { + *x = ActiveMQ{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_activemq_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ActiveMQ) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ActiveMQ.Unmarshal(m, b) -} -func (m *ActiveMQ) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ActiveMQ.Marshal(b, m, deterministic) -} -func (m *ActiveMQ) XXX_Merge(src proto.Message) { - xxx_messageInfo_ActiveMQ.Merge(m, src) +func (x *ActiveMQ) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ActiveMQ) XXX_Size() int { - return xxx_messageInfo_ActiveMQ.Size(m) -} -func (m *ActiveMQ) XXX_DiscardUnknown() { - xxx_messageInfo_ActiveMQ.DiscardUnknown(m) + +func (*ActiveMQ) ProtoMessage() {} + +func (x *ActiveMQ) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_activemq_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ActiveMQ proto.InternalMessageInfo +// Deprecated: Use ActiveMQ.ProtoReflect.Descriptor instead. +func (*ActiveMQ) Descriptor() ([]byte, []int) { + return file_records_ps_records_activemq_proto_rawDescGZIP(), []int{0} +} -func (m *ActiveMQ) GetDestination() string { - if m != nil { - return m.Destination +func (x *ActiveMQ) GetDestination() string { + if x != nil { + return x.Destination } return "" } -func (m *ActiveMQ) GetContentType() string { - if m != nil { - return m.ContentType +func (x *ActiveMQ) GetContentType() string { + if x != nil { + return x.ContentType } return "" } -func (m *ActiveMQ) GetSubscriptionId() string { - if m != nil { - return m.SubscriptionId +func (x *ActiveMQ) GetSubscriptionId() string { + if x != nil { + return x.SubscriptionId } return "" } -func (m *ActiveMQ) GetTimestamp() int64 { - if m != nil { - return m.Timestamp +func (x *ActiveMQ) GetTimestamp() int64 { + if x != nil { + return x.Timestamp } return 0 } -func (m *ActiveMQ) GetValue() []byte { - if m != nil { - return m.Value +func (x *ActiveMQ) GetValue() []byte { + if x != nil { + return x.Value } return nil } -func init() { - proto.RegisterType((*ActiveMQ)(nil), "protos.records.ActiveMQ") +var File_records_ps_records_activemq_proto protoreflect.FileDescriptor + +var file_records_ps_records_activemq_proto_rawDesc = []byte{ + 0x0a, 0x21, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x6d, 0x71, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, + 0x72, 0x64, 0x73, 0x22, 0xac, 0x01, 0x0a, 0x08, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4d, 0x51, + 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, + 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1c, + 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, + 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_records_ps_records_activemq_proto_rawDescOnce sync.Once + file_records_ps_records_activemq_proto_rawDescData = file_records_ps_records_activemq_proto_rawDesc +) + +func file_records_ps_records_activemq_proto_rawDescGZIP() []byte { + file_records_ps_records_activemq_proto_rawDescOnce.Do(func() { + file_records_ps_records_activemq_proto_rawDescData = protoimpl.X.CompressGZIP(file_records_ps_records_activemq_proto_rawDescData) + }) + return file_records_ps_records_activemq_proto_rawDescData +} + +var file_records_ps_records_activemq_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_records_ps_records_activemq_proto_goTypes = []interface{}{ + (*ActiveMQ)(nil), // 0: protos.records.ActiveMQ +} +var file_records_ps_records_activemq_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } -func init() { proto.RegisterFile("records/ps_records_activemq.proto", fileDescriptor_8000da1c2b98da6e) } - -var fileDescriptor_8000da1c2b98da6e = []byte{ - // 237 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x8f, 0x3d, 0x4f, 0xc3, 0x30, - 0x10, 0x86, 0x65, 0x4a, 0x11, 0x35, 0x55, 0x91, 0x2c, 0x06, 0x0f, 0x0c, 0x29, 0x0b, 0x5d, 0x88, - 0x07, 0x56, 0x84, 0x04, 0x1b, 0x03, 0x03, 0x11, 0x13, 0x4b, 0xe4, 0x8f, 0x53, 0x63, 0x29, 0x8e, - 0x8d, 0xef, 0x5c, 0xa9, 0xff, 0x89, 0x1f, 0x89, 0x48, 0x22, 0xd1, 0xe9, 0xee, 0x7d, 0xee, 0xb9, - 0xe1, 0xe5, 0xdb, 0x0c, 0x36, 0x66, 0x87, 0x2a, 0x61, 0x3b, 0xaf, 0xad, 0xb6, 0xe4, 0x0f, 0x10, - 0xbe, 0xeb, 0x94, 0x23, 0x45, 0xb1, 0x19, 0x07, 0xd6, 0xf3, 0xf9, 0xee, 0x87, 0xf1, 0xcb, 0x97, - 0x51, 0x79, 0xff, 0x10, 0x15, 0xbf, 0x72, 0x80, 0xe4, 0x07, 0x4d, 0x3e, 0x0e, 0x92, 0x55, 0x6c, - 0xb7, 0x6a, 0x4e, 0x91, 0xd8, 0xf2, 0xb5, 0x8d, 0x03, 0xc1, 0x40, 0x2d, 0x1d, 0x13, 0xc8, 0xb3, - 0x49, 0x99, 0xd9, 0xe7, 0x31, 0x81, 0xb8, 0xe7, 0xd7, 0x58, 0x0c, 0xda, 0xec, 0xd3, 0xdf, 0x4b, - 0xeb, 0x9d, 0x5c, 0x8c, 0xd6, 0xe6, 0x14, 0xbf, 0x39, 0x71, 0xcb, 0x57, 0xe4, 0x03, 0x20, 0xe9, - 0x90, 0xe4, 0x79, 0xc5, 0x76, 0x8b, 0xe6, 0x1f, 0x88, 0x1b, 0xbe, 0x3c, 0xe8, 0xbe, 0x80, 0x5c, - 0x56, 0x6c, 0xb7, 0x6e, 0xa6, 0xf0, 0xfa, 0xfc, 0xf5, 0xb4, 0xf7, 0xd4, 0x15, 0x53, 0xdb, 0x18, - 0x94, 0xd1, 0x64, 0x3b, 0x1b, 0x73, 0x52, 0xa9, 0x2f, 0xc1, 0x40, 0x7e, 0x40, 0xdb, 0x41, 0xd0, - 0xa8, 0x4c, 0xf1, 0xbd, 0x53, 0xfb, 0xa8, 0xa6, 0xba, 0x6a, 0xae, 0x6b, 0x2e, 0xc6, 0xfc, 0xf8, - 0x1b, 0x00, 0x00, 0xff, 0xff, 0xcb, 0x13, 0x81, 0x77, 0x2a, 0x01, 0x00, 0x00, +func init() { file_records_ps_records_activemq_proto_init() } +func file_records_ps_records_activemq_proto_init() { + if File_records_ps_records_activemq_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_records_ps_records_activemq_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ActiveMQ); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_records_ps_records_activemq_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_records_ps_records_activemq_proto_goTypes, + DependencyIndexes: file_records_ps_records_activemq_proto_depIdxs, + MessageInfos: file_records_ps_records_activemq_proto_msgTypes, + }.Build() + File_records_ps_records_activemq_proto = out.File + file_records_ps_records_activemq_proto_rawDesc = nil + file_records_ps_records_activemq_proto_goTypes = nil + file_records_ps_records_activemq_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_aws_kinesis.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_aws_kinesis.pb.go index 544a81c5e..c0acb0ddd 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_aws_kinesis.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_aws_kinesis.pb.go @@ -1,120 +1,188 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: records/ps_records_aws_kinesis.proto package records import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type AWSKinesis struct { - PartitionKey string `protobuf:"bytes,1,opt,name=partition_key,json=partitionKey,proto3" json:"partition_key,omitempty"` - SequenceNumber string `protobuf:"bytes,2,opt,name=sequence_number,json=sequenceNumber,proto3" json:"sequence_number,omitempty"` - EncryptionType string `protobuf:"bytes,3,opt,name=encryption_type,json=encryptionType,proto3" json:"encryption_type,omitempty"` - ShardId string `protobuf:"bytes,4,opt,name=shard_id,json=shardId,proto3" json:"shard_id,omitempty"` - Value []byte `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PartitionKey string `protobuf:"bytes,1,opt,name=partition_key,json=partitionKey,proto3" json:"partition_key,omitempty"` + SequenceNumber string `protobuf:"bytes,2,opt,name=sequence_number,json=sequenceNumber,proto3" json:"sequence_number,omitempty"` + EncryptionType string `protobuf:"bytes,3,opt,name=encryption_type,json=encryptionType,proto3" json:"encryption_type,omitempty"` + ShardId string `protobuf:"bytes,4,opt,name=shard_id,json=shardId,proto3" json:"shard_id,omitempty"` + Value []byte `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"` } -func (m *AWSKinesis) Reset() { *m = AWSKinesis{} } -func (m *AWSKinesis) String() string { return proto.CompactTextString(m) } -func (*AWSKinesis) ProtoMessage() {} -func (*AWSKinesis) Descriptor() ([]byte, []int) { - return fileDescriptor_2175e9a738d05407, []int{0} +func (x *AWSKinesis) Reset() { + *x = AWSKinesis{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_aws_kinesis_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AWSKinesis) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AWSKinesis.Unmarshal(m, b) -} -func (m *AWSKinesis) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AWSKinesis.Marshal(b, m, deterministic) +func (x *AWSKinesis) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AWSKinesis) XXX_Merge(src proto.Message) { - xxx_messageInfo_AWSKinesis.Merge(m, src) -} -func (m *AWSKinesis) XXX_Size() int { - return xxx_messageInfo_AWSKinesis.Size(m) -} -func (m *AWSKinesis) XXX_DiscardUnknown() { - xxx_messageInfo_AWSKinesis.DiscardUnknown(m) + +func (*AWSKinesis) ProtoMessage() {} + +func (x *AWSKinesis) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_aws_kinesis_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AWSKinesis proto.InternalMessageInfo +// Deprecated: Use AWSKinesis.ProtoReflect.Descriptor instead. +func (*AWSKinesis) Descriptor() ([]byte, []int) { + return file_records_ps_records_aws_kinesis_proto_rawDescGZIP(), []int{0} +} -func (m *AWSKinesis) GetPartitionKey() string { - if m != nil { - return m.PartitionKey +func (x *AWSKinesis) GetPartitionKey() string { + if x != nil { + return x.PartitionKey } return "" } -func (m *AWSKinesis) GetSequenceNumber() string { - if m != nil { - return m.SequenceNumber +func (x *AWSKinesis) GetSequenceNumber() string { + if x != nil { + return x.SequenceNumber } return "" } -func (m *AWSKinesis) GetEncryptionType() string { - if m != nil { - return m.EncryptionType +func (x *AWSKinesis) GetEncryptionType() string { + if x != nil { + return x.EncryptionType } return "" } -func (m *AWSKinesis) GetShardId() string { - if m != nil { - return m.ShardId +func (x *AWSKinesis) GetShardId() string { + if x != nil { + return x.ShardId } return "" } -func (m *AWSKinesis) GetValue() []byte { - if m != nil { - return m.Value +func (x *AWSKinesis) GetValue() []byte { + if x != nil { + return x.Value } return nil } -func init() { - proto.RegisterType((*AWSKinesis)(nil), "protos.records.AWSKinesis") +var File_records_ps_records_aws_kinesis_proto protoreflect.FileDescriptor + +var file_records_ps_records_aws_kinesis_proto_rawDesc = []byte{ + 0x0a, 0x24, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x61, 0x77, 0x73, 0x5f, 0x6b, 0x69, 0x6e, 0x65, 0x73, 0x69, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, + 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0xb4, 0x01, 0x0a, 0x0a, 0x41, 0x57, 0x53, 0x4b, 0x69, + 0x6e, 0x65, 0x73, 0x69, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x61, + 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x65, + 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x65, 0x6e, + 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x08, + 0x73, 0x68, 0x61, 0x72, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x73, 0x68, 0x61, 0x72, 0x64, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x3e, 0x5a, + 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, + 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func init() { - proto.RegisterFile("records/ps_records_aws_kinesis.proto", fileDescriptor_2175e9a738d05407) +var ( + file_records_ps_records_aws_kinesis_proto_rawDescOnce sync.Once + file_records_ps_records_aws_kinesis_proto_rawDescData = file_records_ps_records_aws_kinesis_proto_rawDesc +) + +func file_records_ps_records_aws_kinesis_proto_rawDescGZIP() []byte { + file_records_ps_records_aws_kinesis_proto_rawDescOnce.Do(func() { + file_records_ps_records_aws_kinesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_records_ps_records_aws_kinesis_proto_rawDescData) + }) + return file_records_ps_records_aws_kinesis_proto_rawDescData } -var fileDescriptor_2175e9a738d05407 = []byte{ - // 244 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x8f, 0x4d, 0x4b, 0x03, 0x31, - 0x10, 0x86, 0x59, 0xb5, 0x7e, 0x84, 0x5a, 0x21, 0x78, 0x88, 0xb7, 0xa2, 0x82, 0xbd, 0xd8, 0x1c, - 0xbc, 0x8a, 0xa0, 0x37, 0x29, 0x78, 0xa8, 0x82, 0xe0, 0x25, 0xe4, 0x63, 0xe8, 0x86, 0xee, 0x26, - 0x31, 0x93, 0x28, 0xf9, 0x5f, 0xfe, 0x40, 0x31, 0xbb, 0xea, 0x69, 0xe6, 0x7d, 0x78, 0x98, 0xe1, - 0x25, 0x97, 0x11, 0xb4, 0x8f, 0x06, 0x79, 0x40, 0x31, 0xae, 0x42, 0x7e, 0xa2, 0xd8, 0x5a, 0x07, - 0x68, 0x71, 0x19, 0xa2, 0x4f, 0x9e, 0xce, 0xea, 0xc0, 0xe5, 0x68, 0x9c, 0x7f, 0x35, 0x84, 0xdc, - 0xbf, 0x3e, 0xaf, 0x06, 0x89, 0x5e, 0x90, 0xe3, 0x20, 0x63, 0xb2, 0xc9, 0x7a, 0x27, 0xb6, 0x50, - 0x58, 0x33, 0x6f, 0x16, 0x47, 0xeb, 0xe9, 0x1f, 0x5c, 0x41, 0xa1, 0x57, 0xe4, 0x04, 0xe1, 0x3d, - 0x83, 0xd3, 0x20, 0x5c, 0xee, 0x15, 0x44, 0xb6, 0x53, 0xb5, 0xd9, 0x2f, 0x7e, 0xaa, 0xf4, 0x47, - 0x04, 0xa7, 0x63, 0x09, 0xf5, 0x5c, 0x2a, 0x01, 0xd8, 0xee, 0x20, 0xfe, 0xe3, 0x97, 0x12, 0x80, - 0x9e, 0x91, 0x43, 0x6c, 0x65, 0x34, 0xc2, 0x1a, 0xb6, 0x57, 0x8d, 0x83, 0x9a, 0x1f, 0x0d, 0x3d, - 0x25, 0x93, 0x0f, 0xd9, 0x65, 0x60, 0x93, 0x79, 0xb3, 0x98, 0xae, 0x87, 0xf0, 0x70, 0xf7, 0x76, - 0xbb, 0xb1, 0xa9, 0xcd, 0x6a, 0xa9, 0x7d, 0xcf, 0x95, 0x4c, 0xba, 0xd5, 0x3e, 0x06, 0x1e, 0xba, - 0xfa, 0xf9, 0x1a, 0x75, 0x0b, 0xbd, 0x44, 0xae, 0xb2, 0xed, 0x0c, 0xdf, 0x78, 0x3e, 0xd4, 0xe6, - 0x63, 0x6d, 0xb5, 0x5f, 0xf3, 0xcd, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x74, 0x18, 0xe4, 0xfa, - 0x35, 0x01, 0x00, 0x00, +var file_records_ps_records_aws_kinesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_records_ps_records_aws_kinesis_proto_goTypes = []interface{}{ + (*AWSKinesis)(nil), // 0: protos.records.AWSKinesis +} +var file_records_ps_records_aws_kinesis_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_records_ps_records_aws_kinesis_proto_init() } +func file_records_ps_records_aws_kinesis_proto_init() { + if File_records_ps_records_aws_kinesis_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_records_ps_records_aws_kinesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AWSKinesis); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_records_ps_records_aws_kinesis_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_records_ps_records_aws_kinesis_proto_goTypes, + DependencyIndexes: file_records_ps_records_aws_kinesis_proto_depIdxs, + MessageInfos: file_records_ps_records_aws_kinesis_proto_msgTypes, + }.Build() + File_records_ps_records_aws_kinesis_proto = out.File + file_records_ps_records_aws_kinesis_proto_rawDesc = nil + file_records_ps_records_aws_kinesis_proto_goTypes = nil + file_records_ps_records_aws_kinesis_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_aws_sqs.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_aws_sqs.pb.go index f0f3115f8..f172c8ece 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_aws_sqs.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_aws_sqs.pb.go @@ -1,121 +1,194 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: records/ps_records_aws_sqs.proto package records import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type AWSSQS struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - RecipientHandle string `protobuf:"bytes,3,opt,name=recipient_handle,json=recipientHandle,proto3" json:"recipient_handle,omitempty"` - Attributes map[string]string `protobuf:"bytes,4,rep,name=attributes,proto3" json:"attributes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Value []byte `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + RecipientHandle string `protobuf:"bytes,3,opt,name=recipient_handle,json=recipientHandle,proto3" json:"recipient_handle,omitempty"` + Attributes map[string]string `protobuf:"bytes,4,rep,name=attributes,proto3" json:"attributes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Value []byte `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"` } -func (m *AWSSQS) Reset() { *m = AWSSQS{} } -func (m *AWSSQS) String() string { return proto.CompactTextString(m) } -func (*AWSSQS) ProtoMessage() {} -func (*AWSSQS) Descriptor() ([]byte, []int) { - return fileDescriptor_5c74c4ca597ada00, []int{0} +func (x *AWSSQS) Reset() { + *x = AWSSQS{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_aws_sqs_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AWSSQS) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AWSSQS.Unmarshal(m, b) -} -func (m *AWSSQS) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AWSSQS.Marshal(b, m, deterministic) -} -func (m *AWSSQS) XXX_Merge(src proto.Message) { - xxx_messageInfo_AWSSQS.Merge(m, src) +func (x *AWSSQS) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AWSSQS) XXX_Size() int { - return xxx_messageInfo_AWSSQS.Size(m) -} -func (m *AWSSQS) XXX_DiscardUnknown() { - xxx_messageInfo_AWSSQS.DiscardUnknown(m) + +func (*AWSSQS) ProtoMessage() {} + +func (x *AWSSQS) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_aws_sqs_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AWSSQS proto.InternalMessageInfo +// Deprecated: Use AWSSQS.ProtoReflect.Descriptor instead. +func (*AWSSQS) Descriptor() ([]byte, []int) { + return file_records_ps_records_aws_sqs_proto_rawDescGZIP(), []int{0} +} -func (m *AWSSQS) GetId() string { - if m != nil { - return m.Id +func (x *AWSSQS) GetId() string { + if x != nil { + return x.Id } return "" } -func (m *AWSSQS) GetTimestamp() int64 { - if m != nil { - return m.Timestamp +func (x *AWSSQS) GetTimestamp() int64 { + if x != nil { + return x.Timestamp } return 0 } -func (m *AWSSQS) GetRecipientHandle() string { - if m != nil { - return m.RecipientHandle +func (x *AWSSQS) GetRecipientHandle() string { + if x != nil { + return x.RecipientHandle } return "" } -func (m *AWSSQS) GetAttributes() map[string]string { - if m != nil { - return m.Attributes +func (x *AWSSQS) GetAttributes() map[string]string { + if x != nil { + return x.Attributes } return nil } -func (m *AWSSQS) GetValue() []byte { - if m != nil { - return m.Value +func (x *AWSSQS) GetValue() []byte { + if x != nil { + return x.Value } return nil } -func init() { - proto.RegisterType((*AWSSQS)(nil), "protos.records.AWSSQS") - proto.RegisterMapType((map[string]string)(nil), "protos.records.AWSSQS.AttributesEntry") +var File_records_ps_records_aws_sqs_proto protoreflect.FileDescriptor + +var file_records_ps_records_aws_sqs_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x71, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x73, 0x22, 0xfe, 0x01, 0x0a, 0x06, 0x41, 0x57, 0x53, 0x53, 0x51, 0x53, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, + 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x29, 0x0a, 0x10, 0x72, + 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, + 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x46, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x53, + 0x51, 0x53, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x3d, 0x0a, 0x0f, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, + 0x02, 0x38, 0x01, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, + 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x72, 0x65, 0x63, 0x6f, + 0x72, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_records_ps_records_aws_sqs_proto_rawDescOnce sync.Once + file_records_ps_records_aws_sqs_proto_rawDescData = file_records_ps_records_aws_sqs_proto_rawDesc +) + +func file_records_ps_records_aws_sqs_proto_rawDescGZIP() []byte { + file_records_ps_records_aws_sqs_proto_rawDescOnce.Do(func() { + file_records_ps_records_aws_sqs_proto_rawDescData = protoimpl.X.CompressGZIP(file_records_ps_records_aws_sqs_proto_rawDescData) + }) + return file_records_ps_records_aws_sqs_proto_rawDescData +} + +var file_records_ps_records_aws_sqs_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_records_ps_records_aws_sqs_proto_goTypes = []interface{}{ + (*AWSSQS)(nil), // 0: protos.records.AWSSQS + nil, // 1: protos.records.AWSSQS.AttributesEntry +} +var file_records_ps_records_aws_sqs_proto_depIdxs = []int32{ + 1, // 0: protos.records.AWSSQS.attributes:type_name -> protos.records.AWSSQS.AttributesEntry + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } -func init() { proto.RegisterFile("records/ps_records_aws_sqs.proto", fileDescriptor_5c74c4ca597ada00) } - -var fileDescriptor_5c74c4ca597ada00 = []byte{ - // 273 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x8f, 0xc1, 0x4b, 0xc3, 0x30, - 0x1c, 0x85, 0x49, 0xeb, 0x06, 0x8b, 0xb2, 0x8d, 0xe0, 0xa1, 0x88, 0x87, 0xe2, 0x41, 0xea, 0xc1, - 0x04, 0xf4, 0x22, 0xa2, 0xc2, 0x04, 0xc5, 0xab, 0xed, 0x41, 0xf0, 0x52, 0x92, 0x34, 0xac, 0xc1, - 0xb6, 0x89, 0xc9, 0xaf, 0xca, 0xfe, 0x79, 0x11, 0xd3, 0xb2, 0xa9, 0xa7, 0xbc, 0xf7, 0x92, 0x0f, - 0xbe, 0xe0, 0xd4, 0x29, 0x69, 0x5c, 0xe5, 0x99, 0xf5, 0xe5, 0x18, 0x4b, 0xfe, 0xe9, 0x4b, 0xff, - 0xee, 0xa9, 0x75, 0x06, 0x0c, 0x99, 0x87, 0xc3, 0xd3, 0xf1, 0xf6, 0xe4, 0x0b, 0xe1, 0xe9, 0xea, - 0xa5, 0x28, 0x9e, 0x0b, 0x32, 0xc7, 0x91, 0xae, 0x12, 0x94, 0xa2, 0x6c, 0x96, 0x47, 0xba, 0x22, - 0xc7, 0x78, 0x06, 0xba, 0x55, 0x1e, 0x78, 0x6b, 0x93, 0x28, 0x45, 0x59, 0x9c, 0xef, 0x06, 0x72, - 0x86, 0x97, 0x4e, 0x49, 0x6d, 0xb5, 0xea, 0xa0, 0xac, 0x79, 0x57, 0x35, 0x2a, 0x89, 0x03, 0xbb, - 0xd8, 0xee, 0x4f, 0x61, 0x26, 0x8f, 0x18, 0x73, 0x00, 0xa7, 0x45, 0x0f, 0xca, 0x27, 0x7b, 0x69, - 0x9c, 0xed, 0x5f, 0x9c, 0xd2, 0xbf, 0x22, 0x74, 0x90, 0xa0, 0xab, 0xed, 0xc3, 0x87, 0x0e, 0xdc, - 0x26, 0xff, 0x45, 0x92, 0x43, 0x3c, 0xf9, 0xe0, 0x4d, 0xaf, 0x92, 0x49, 0x8a, 0xb2, 0x83, 0x7c, - 0x28, 0x47, 0xb7, 0x78, 0xf1, 0x0f, 0x22, 0x4b, 0x1c, 0xbf, 0xa9, 0xcd, 0xf8, 0x95, 0x9f, 0xb8, - 0x43, 0xa3, 0xb0, 0x0d, 0xe5, 0x3a, 0xba, 0x42, 0xf7, 0x77, 0xaf, 0x37, 0x6b, 0x0d, 0x75, 0x2f, - 0xa8, 0x34, 0x2d, 0x13, 0x1c, 0x64, 0x2d, 0x8d, 0xb3, 0xcc, 0x36, 0x7d, 0x2b, 0x94, 0x3b, 0xf7, - 0xb2, 0x56, 0x2d, 0xf7, 0x4c, 0xf4, 0xba, 0xa9, 0xd8, 0xda, 0xb0, 0xc1, 0x9b, 0x8d, 0xde, 0x62, - 0x1a, 0xfa, 0xe5, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xad, 0xbc, 0x5a, 0x64, 0x7b, 0x01, 0x00, - 0x00, +func init() { file_records_ps_records_aws_sqs_proto_init() } +func file_records_ps_records_aws_sqs_proto_init() { + if File_records_ps_records_aws_sqs_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_records_ps_records_aws_sqs_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AWSSQS); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_records_ps_records_aws_sqs_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_records_ps_records_aws_sqs_proto_goTypes, + DependencyIndexes: file_records_ps_records_aws_sqs_proto_depIdxs, + MessageInfos: file_records_ps_records_aws_sqs_proto_msgTypes, + }.Build() + File_records_ps_records_aws_sqs_proto = out.File + file_records_ps_records_aws_sqs_proto_rawDesc = nil + file_records_ps_records_aws_sqs_proto_goTypes = nil + file_records_ps_records_aws_sqs_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_azure_event_hub.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_azure_event_hub.pb.go index fe5e029fb..94b0d59ac 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_azure_event_hub.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_azure_event_hub.pb.go @@ -1,114 +1,186 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: records/ps_records_azure_event_hub.proto package records import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type AzureEventHub struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - SystemProperties map[string]string `protobuf:"bytes,2,rep,name=system_properties,json=systemProperties,proto3" json:"system_properties,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Value []byte `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *AzureEventHub) Reset() { *m = AzureEventHub{} } -func (m *AzureEventHub) String() string { return proto.CompactTextString(m) } -func (*AzureEventHub) ProtoMessage() {} -func (*AzureEventHub) Descriptor() ([]byte, []int) { - return fileDescriptor_bd202db3b2694390, []int{0} + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + SystemProperties map[string]string `protobuf:"bytes,2,rep,name=system_properties,json=systemProperties,proto3" json:"system_properties,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Value []byte `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` } -func (m *AzureEventHub) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AzureEventHub.Unmarshal(m, b) -} -func (m *AzureEventHub) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AzureEventHub.Marshal(b, m, deterministic) -} -func (m *AzureEventHub) XXX_Merge(src proto.Message) { - xxx_messageInfo_AzureEventHub.Merge(m, src) +func (x *AzureEventHub) Reset() { + *x = AzureEventHub{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_azure_event_hub_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AzureEventHub) XXX_Size() int { - return xxx_messageInfo_AzureEventHub.Size(m) + +func (x *AzureEventHub) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AzureEventHub) XXX_DiscardUnknown() { - xxx_messageInfo_AzureEventHub.DiscardUnknown(m) + +func (*AzureEventHub) ProtoMessage() {} + +func (x *AzureEventHub) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_azure_event_hub_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AzureEventHub proto.InternalMessageInfo +// Deprecated: Use AzureEventHub.ProtoReflect.Descriptor instead. +func (*AzureEventHub) Descriptor() ([]byte, []int) { + return file_records_ps_records_azure_event_hub_proto_rawDescGZIP(), []int{0} +} -func (m *AzureEventHub) GetId() string { - if m != nil { - return m.Id +func (x *AzureEventHub) GetId() string { + if x != nil { + return x.Id } return "" } -func (m *AzureEventHub) GetSystemProperties() map[string]string { - if m != nil { - return m.SystemProperties +func (x *AzureEventHub) GetSystemProperties() map[string]string { + if x != nil { + return x.SystemProperties } return nil } -func (m *AzureEventHub) GetTimestamp() int64 { - if m != nil { - return m.Timestamp +func (x *AzureEventHub) GetTimestamp() int64 { + if x != nil { + return x.Timestamp } return 0 } -func (m *AzureEventHub) GetValue() []byte { - if m != nil { - return m.Value +func (x *AzureEventHub) GetValue() []byte { + if x != nil { + return x.Value } return nil } -func init() { - proto.RegisterType((*AzureEventHub)(nil), "protos.records.AzureEventHub") - proto.RegisterMapType((map[string]string)(nil), "protos.records.AzureEventHub.SystemPropertiesEntry") +var File_records_ps_records_azure_event_hub_proto protoreflect.FileDescriptor + +var file_records_ps_records_azure_event_hub_proto_rawDesc = []byte{ + 0x0a, 0x28, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, + 0x5f, 0x68, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0xfa, 0x01, 0x0a, 0x0d, 0x41, + 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x75, 0x62, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x60, 0x0a, 0x11, + 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x48, 0x75, 0x62, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72, 0x6f, + 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x10, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x1c, + 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x1a, 0x43, 0x0a, 0x15, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72, 0x6f, 0x70, + 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, + 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, + 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, + 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_records_ps_records_azure_event_hub_proto_rawDescOnce sync.Once + file_records_ps_records_azure_event_hub_proto_rawDescData = file_records_ps_records_azure_event_hub_proto_rawDesc +) + +func file_records_ps_records_azure_event_hub_proto_rawDescGZIP() []byte { + file_records_ps_records_azure_event_hub_proto_rawDescOnce.Do(func() { + file_records_ps_records_azure_event_hub_proto_rawDescData = protoimpl.X.CompressGZIP(file_records_ps_records_azure_event_hub_proto_rawDescData) + }) + return file_records_ps_records_azure_event_hub_proto_rawDescData } -func init() { - proto.RegisterFile("records/ps_records_azure_event_hub.proto", fileDescriptor_bd202db3b2694390) +var file_records_ps_records_azure_event_hub_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_records_ps_records_azure_event_hub_proto_goTypes = []interface{}{ + (*AzureEventHub)(nil), // 0: protos.records.AzureEventHub + nil, // 1: protos.records.AzureEventHub.SystemPropertiesEntry +} +var file_records_ps_records_azure_event_hub_proto_depIdxs = []int32{ + 1, // 0: protos.records.AzureEventHub.system_properties:type_name -> protos.records.AzureEventHub.SystemPropertiesEntry + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } -var fileDescriptor_bd202db3b2694390 = []byte{ - // 270 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xcf, 0x4b, 0xfc, 0x30, - 0x10, 0xc5, 0x49, 0xfb, 0xfd, 0x0a, 0x1b, 0x75, 0x59, 0x83, 0x42, 0x11, 0x0f, 0xc5, 0x53, 0x2f, - 0x36, 0xe0, 0x5e, 0x44, 0x44, 0x50, 0x59, 0xf0, 0x28, 0xf5, 0xe6, 0xa5, 0x36, 0xe9, 0xb0, 0x0d, - 0x36, 0x9b, 0x90, 0x49, 0x16, 0xea, 0x9f, 0xee, 0x49, 0xfa, 0x03, 0x97, 0x15, 0x4f, 0x99, 0xf7, - 0x78, 0xf3, 0x21, 0x6f, 0x68, 0xe6, 0x40, 0x1a, 0x57, 0x23, 0xb7, 0x58, 0x4e, 0x63, 0x59, 0x7d, - 0x06, 0x07, 0x25, 0x6c, 0x61, 0xe3, 0xcb, 0x26, 0x88, 0xdc, 0x3a, 0xe3, 0x0d, 0x9b, 0x0f, 0x0f, - 0xe6, 0x53, 0xea, 0xf2, 0x8b, 0xd0, 0xe3, 0x87, 0x3e, 0xb9, 0xea, 0x83, 0xcf, 0x41, 0xb0, 0x39, - 0x8d, 0x54, 0x9d, 0x90, 0x94, 0x64, 0xb3, 0x22, 0x52, 0x35, 0x7b, 0xa7, 0x27, 0xd8, 0xa1, 0x07, - 0x5d, 0x5a, 0x67, 0x2c, 0x38, 0xaf, 0x00, 0x93, 0x28, 0x8d, 0xb3, 0xc3, 0xeb, 0x65, 0xbe, 0x4f, - 0xcb, 0xf7, 0x48, 0xf9, 0xeb, 0xb0, 0xf6, 0xf2, 0xb3, 0xb5, 0xda, 0x78, 0xd7, 0x15, 0x0b, 0xfc, - 0x65, 0xb3, 0x0b, 0x3a, 0xf3, 0x4a, 0x03, 0xfa, 0x4a, 0xdb, 0x24, 0x4e, 0x49, 0x16, 0x17, 0x3b, - 0x83, 0x9d, 0xd2, 0xff, 0xdb, 0xaa, 0x0d, 0x90, 0xfc, 0x4b, 0x49, 0x76, 0x54, 0x8c, 0xe2, 0xfc, - 0x89, 0x9e, 0xfd, 0x89, 0x67, 0x0b, 0x1a, 0x7f, 0x40, 0x37, 0xfd, 0xbf, 0x1f, 0x77, 0x80, 0x68, - 0xf0, 0x46, 0x71, 0x1b, 0xdd, 0x90, 0xc7, 0xfb, 0xb7, 0xbb, 0xb5, 0xf2, 0xfd, 0x71, 0xa4, 0xd1, - 0x5c, 0x54, 0x5e, 0x36, 0xd2, 0x38, 0xcb, 0x6d, 0x1b, 0xb4, 0x00, 0x77, 0x85, 0xb2, 0x01, 0x5d, - 0x21, 0x17, 0x41, 0xb5, 0x35, 0x5f, 0x1b, 0x3e, 0xd6, 0xe5, 0x53, 0x5d, 0x71, 0x30, 0xe8, 0xe5, - 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x39, 0xe6, 0xdd, 0x3e, 0x7f, 0x01, 0x00, 0x00, +func init() { file_records_ps_records_azure_event_hub_proto_init() } +func file_records_ps_records_azure_event_hub_proto_init() { + if File_records_ps_records_azure_event_hub_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_records_ps_records_azure_event_hub_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AzureEventHub); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_records_ps_records_azure_event_hub_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_records_ps_records_azure_event_hub_proto_goTypes, + DependencyIndexes: file_records_ps_records_azure_event_hub_proto_depIdxs, + MessageInfos: file_records_ps_records_azure_event_hub_proto_msgTypes, + }.Build() + File_records_ps_records_azure_event_hub_proto = out.File + file_records_ps_records_azure_event_hub_proto_rawDesc = nil + file_records_ps_records_azure_event_hub_proto_goTypes = nil + file_records_ps_records_azure_event_hub_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_azure_service_bus.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_azure_service_bus.pb.go index 62d68dfd0..fb63cf609 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_azure_service_bus.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_azure_service_bus.pb.go @@ -1,185 +1,197 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: records/ps_records_azure_service_bus.proto package records import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type AzureServiceBus struct { - ContentType string `protobuf:"bytes,1,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` - CorrelationId string `protobuf:"bytes,2,opt,name=correlation_id,json=correlationId,proto3" json:"correlation_id,omitempty"` - Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` - DeliveryCount uint32 `protobuf:"varint,4,opt,name=delivery_count,json=deliveryCount,proto3" json:"delivery_count,omitempty"` - SessionId string `protobuf:"bytes,5,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` - GroupSequence uint32 `protobuf:"varint,6,opt,name=group_sequence,json=groupSequence,proto3" json:"group_sequence,omitempty"` - Id string `protobuf:"bytes,7,opt,name=id,proto3" json:"id,omitempty"` - Label string `protobuf:"bytes,8,opt,name=label,proto3" json:"label,omitempty"` - ReplyTo string `protobuf:"bytes,9,opt,name=reply_to,json=replyTo,proto3" json:"reply_to,omitempty"` - ReplyToGroupId string `protobuf:"bytes,10,opt,name=reply_to_group_id,json=replyToGroupId,proto3" json:"reply_to_group_id,omitempty"` - To string `protobuf:"bytes,11,opt,name=to,proto3" json:"to,omitempty"` - Ttl int64 `protobuf:"varint,12,opt,name=ttl,proto3" json:"ttl,omitempty"` - LockToken string `protobuf:"bytes,13,opt,name=lock_token,json=lockToken,proto3" json:"lock_token,omitempty"` - SystemProperties *AzureSystemProperties `protobuf:"bytes,14,opt,name=system_properties,json=systemProperties,proto3" json:"system_properties,omitempty"` - UserProperties map[string]string `protobuf:"bytes,15,rep,name=user_properties,json=userProperties,proto3" json:"user_properties,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Format uint32 `protobuf:"varint,16,opt,name=format,proto3" json:"format,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AzureServiceBus) Reset() { *m = AzureServiceBus{} } -func (m *AzureServiceBus) String() string { return proto.CompactTextString(m) } -func (*AzureServiceBus) ProtoMessage() {} -func (*AzureServiceBus) Descriptor() ([]byte, []int) { - return fileDescriptor_80dbb0d7b16b8548, []int{0} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ContentType string `protobuf:"bytes,1,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` + CorrelationId string `protobuf:"bytes,2,opt,name=correlation_id,json=correlationId,proto3" json:"correlation_id,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + DeliveryCount uint32 `protobuf:"varint,4,opt,name=delivery_count,json=deliveryCount,proto3" json:"delivery_count,omitempty"` + SessionId string `protobuf:"bytes,5,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + GroupSequence uint32 `protobuf:"varint,6,opt,name=group_sequence,json=groupSequence,proto3" json:"group_sequence,omitempty"` + Id string `protobuf:"bytes,7,opt,name=id,proto3" json:"id,omitempty"` + Label string `protobuf:"bytes,8,opt,name=label,proto3" json:"label,omitempty"` + ReplyTo string `protobuf:"bytes,9,opt,name=reply_to,json=replyTo,proto3" json:"reply_to,omitempty"` + ReplyToGroupId string `protobuf:"bytes,10,opt,name=reply_to_group_id,json=replyToGroupId,proto3" json:"reply_to_group_id,omitempty"` + To string `protobuf:"bytes,11,opt,name=to,proto3" json:"to,omitempty"` + Ttl int64 `protobuf:"varint,12,opt,name=ttl,proto3" json:"ttl,omitempty"` + LockToken string `protobuf:"bytes,13,opt,name=lock_token,json=lockToken,proto3" json:"lock_token,omitempty"` + SystemProperties *AzureSystemProperties `protobuf:"bytes,14,opt,name=system_properties,json=systemProperties,proto3" json:"system_properties,omitempty"` + UserProperties map[string]string `protobuf:"bytes,15,rep,name=user_properties,json=userProperties,proto3" json:"user_properties,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Format uint32 `protobuf:"varint,16,opt,name=format,proto3" json:"format,omitempty"` +} + +func (x *AzureServiceBus) Reset() { + *x = AzureServiceBus{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_azure_service_bus_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AzureServiceBus) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AzureServiceBus.Unmarshal(m, b) -} -func (m *AzureServiceBus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AzureServiceBus.Marshal(b, m, deterministic) -} -func (m *AzureServiceBus) XXX_Merge(src proto.Message) { - xxx_messageInfo_AzureServiceBus.Merge(m, src) -} -func (m *AzureServiceBus) XXX_Size() int { - return xxx_messageInfo_AzureServiceBus.Size(m) +func (x *AzureServiceBus) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AzureServiceBus) XXX_DiscardUnknown() { - xxx_messageInfo_AzureServiceBus.DiscardUnknown(m) + +func (*AzureServiceBus) ProtoMessage() {} + +func (x *AzureServiceBus) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_azure_service_bus_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AzureServiceBus proto.InternalMessageInfo +// Deprecated: Use AzureServiceBus.ProtoReflect.Descriptor instead. +func (*AzureServiceBus) Descriptor() ([]byte, []int) { + return file_records_ps_records_azure_service_bus_proto_rawDescGZIP(), []int{0} +} -func (m *AzureServiceBus) GetContentType() string { - if m != nil { - return m.ContentType +func (x *AzureServiceBus) GetContentType() string { + if x != nil { + return x.ContentType } return "" } -func (m *AzureServiceBus) GetCorrelationId() string { - if m != nil { - return m.CorrelationId +func (x *AzureServiceBus) GetCorrelationId() string { + if x != nil { + return x.CorrelationId } return "" } -func (m *AzureServiceBus) GetValue() []byte { - if m != nil { - return m.Value +func (x *AzureServiceBus) GetValue() []byte { + if x != nil { + return x.Value } return nil } -func (m *AzureServiceBus) GetDeliveryCount() uint32 { - if m != nil { - return m.DeliveryCount +func (x *AzureServiceBus) GetDeliveryCount() uint32 { + if x != nil { + return x.DeliveryCount } return 0 } -func (m *AzureServiceBus) GetSessionId() string { - if m != nil { - return m.SessionId +func (x *AzureServiceBus) GetSessionId() string { + if x != nil { + return x.SessionId } return "" } -func (m *AzureServiceBus) GetGroupSequence() uint32 { - if m != nil { - return m.GroupSequence +func (x *AzureServiceBus) GetGroupSequence() uint32 { + if x != nil { + return x.GroupSequence } return 0 } -func (m *AzureServiceBus) GetId() string { - if m != nil { - return m.Id +func (x *AzureServiceBus) GetId() string { + if x != nil { + return x.Id } return "" } -func (m *AzureServiceBus) GetLabel() string { - if m != nil { - return m.Label +func (x *AzureServiceBus) GetLabel() string { + if x != nil { + return x.Label } return "" } -func (m *AzureServiceBus) GetReplyTo() string { - if m != nil { - return m.ReplyTo +func (x *AzureServiceBus) GetReplyTo() string { + if x != nil { + return x.ReplyTo } return "" } -func (m *AzureServiceBus) GetReplyToGroupId() string { - if m != nil { - return m.ReplyToGroupId +func (x *AzureServiceBus) GetReplyToGroupId() string { + if x != nil { + return x.ReplyToGroupId } return "" } -func (m *AzureServiceBus) GetTo() string { - if m != nil { - return m.To +func (x *AzureServiceBus) GetTo() string { + if x != nil { + return x.To } return "" } -func (m *AzureServiceBus) GetTtl() int64 { - if m != nil { - return m.Ttl +func (x *AzureServiceBus) GetTtl() int64 { + if x != nil { + return x.Ttl } return 0 } -func (m *AzureServiceBus) GetLockToken() string { - if m != nil { - return m.LockToken +func (x *AzureServiceBus) GetLockToken() string { + if x != nil { + return x.LockToken } return "" } -func (m *AzureServiceBus) GetSystemProperties() *AzureSystemProperties { - if m != nil { - return m.SystemProperties +func (x *AzureServiceBus) GetSystemProperties() *AzureSystemProperties { + if x != nil { + return x.SystemProperties } return nil } -func (m *AzureServiceBus) GetUserProperties() map[string]string { - if m != nil { - return m.UserProperties +func (x *AzureServiceBus) GetUserProperties() map[string]string { + if x != nil { + return x.UserProperties } return nil } -func (m *AzureServiceBus) GetFormat() uint32 { - if m != nil { - return m.Format +func (x *AzureServiceBus) GetFormat() uint32 { + if x != nil { + return x.Format } return 0 } type AzureSystemProperties struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + LockedUntil int64 `protobuf:"varint,1,opt,name=locked_until,json=lockedUntil,proto3" json:"locked_until,omitempty"` SequenceNumber int64 `protobuf:"varint,2,opt,name=sequence_number,json=sequenceNumber,proto3" json:"sequence_number,omitempty"` PartitionId int32 `protobuf:"varint,3,opt,name=partition_id,json=partitionId,proto3" json:"partition_id,omitempty"` @@ -190,160 +202,278 @@ type AzureSystemProperties struct { EnqueuedSequenceNumber int64 `protobuf:"varint,8,opt,name=enqueued_sequence_number,json=enqueuedSequenceNumber,proto3" json:"enqueued_sequence_number,omitempty"` ViaPartitionKey string `protobuf:"bytes,9,opt,name=via_partition_key,json=viaPartitionKey,proto3" json:"via_partition_key,omitempty"` Annotations map[string]string `protobuf:"bytes,10,rep,name=annotations,proto3" json:"annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` } -func (m *AzureSystemProperties) Reset() { *m = AzureSystemProperties{} } -func (m *AzureSystemProperties) String() string { return proto.CompactTextString(m) } -func (*AzureSystemProperties) ProtoMessage() {} -func (*AzureSystemProperties) Descriptor() ([]byte, []int) { - return fileDescriptor_80dbb0d7b16b8548, []int{1} +func (x *AzureSystemProperties) Reset() { + *x = AzureSystemProperties{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_azure_service_bus_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *AzureSystemProperties) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AzureSystemProperties.Unmarshal(m, b) -} -func (m *AzureSystemProperties) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AzureSystemProperties.Marshal(b, m, deterministic) -} -func (m *AzureSystemProperties) XXX_Merge(src proto.Message) { - xxx_messageInfo_AzureSystemProperties.Merge(m, src) -} -func (m *AzureSystemProperties) XXX_Size() int { - return xxx_messageInfo_AzureSystemProperties.Size(m) +func (x *AzureSystemProperties) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *AzureSystemProperties) XXX_DiscardUnknown() { - xxx_messageInfo_AzureSystemProperties.DiscardUnknown(m) + +func (*AzureSystemProperties) ProtoMessage() {} + +func (x *AzureSystemProperties) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_azure_service_bus_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_AzureSystemProperties proto.InternalMessageInfo +// Deprecated: Use AzureSystemProperties.ProtoReflect.Descriptor instead. +func (*AzureSystemProperties) Descriptor() ([]byte, []int) { + return file_records_ps_records_azure_service_bus_proto_rawDescGZIP(), []int{1} +} -func (m *AzureSystemProperties) GetLockedUntil() int64 { - if m != nil { - return m.LockedUntil +func (x *AzureSystemProperties) GetLockedUntil() int64 { + if x != nil { + return x.LockedUntil } return 0 } -func (m *AzureSystemProperties) GetSequenceNumber() int64 { - if m != nil { - return m.SequenceNumber +func (x *AzureSystemProperties) GetSequenceNumber() int64 { + if x != nil { + return x.SequenceNumber } return 0 } -func (m *AzureSystemProperties) GetPartitionId() int32 { - if m != nil { - return m.PartitionId +func (x *AzureSystemProperties) GetPartitionId() int32 { + if x != nil { + return x.PartitionId } return 0 } -func (m *AzureSystemProperties) GetPartitionKey() string { - if m != nil { - return m.PartitionKey +func (x *AzureSystemProperties) GetPartitionKey() string { + if x != nil { + return x.PartitionKey } return "" } -func (m *AzureSystemProperties) GetEnqueuedTime() int64 { - if m != nil { - return m.EnqueuedTime +func (x *AzureSystemProperties) GetEnqueuedTime() int64 { + if x != nil { + return x.EnqueuedTime } return 0 } -func (m *AzureSystemProperties) GetDeadLetterSource() string { - if m != nil { - return m.DeadLetterSource +func (x *AzureSystemProperties) GetDeadLetterSource() string { + if x != nil { + return x.DeadLetterSource } return "" } -func (m *AzureSystemProperties) GetScheduledEnqueueTime() int64 { - if m != nil { - return m.ScheduledEnqueueTime +func (x *AzureSystemProperties) GetScheduledEnqueueTime() int64 { + if x != nil { + return x.ScheduledEnqueueTime } return 0 } -func (m *AzureSystemProperties) GetEnqueuedSequenceNumber() int64 { - if m != nil { - return m.EnqueuedSequenceNumber +func (x *AzureSystemProperties) GetEnqueuedSequenceNumber() int64 { + if x != nil { + return x.EnqueuedSequenceNumber } return 0 } -func (m *AzureSystemProperties) GetViaPartitionKey() string { - if m != nil { - return m.ViaPartitionKey +func (x *AzureSystemProperties) GetViaPartitionKey() string { + if x != nil { + return x.ViaPartitionKey } return "" } -func (m *AzureSystemProperties) GetAnnotations() map[string]string { - if m != nil { - return m.Annotations +func (x *AzureSystemProperties) GetAnnotations() map[string]string { + if x != nil { + return x.Annotations } return nil } -func init() { - proto.RegisterType((*AzureServiceBus)(nil), "protos.records.AzureServiceBus") - proto.RegisterMapType((map[string]string)(nil), "protos.records.AzureServiceBus.UserPropertiesEntry") - proto.RegisterType((*AzureSystemProperties)(nil), "protos.records.AzureSystemProperties") - proto.RegisterMapType((map[string]string)(nil), "protos.records.AzureSystemProperties.AnnotationsEntry") -} - -func init() { - proto.RegisterFile("records/ps_records_azure_service_bus.proto", fileDescriptor_80dbb0d7b16b8548) -} - -var fileDescriptor_80dbb0d7b16b8548 = []byte{ - // 686 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x7b, 0x6b, 0x13, 0x4f, - 0x14, 0x25, 0x49, 0xd3, 0x36, 0x93, 0x67, 0xe7, 0xd7, 0x5f, 0x19, 0x0b, 0x42, 0xac, 0x14, 0x63, - 0xd1, 0x04, 0x5a, 0x91, 0x22, 0x52, 0x68, 0xa5, 0x48, 0x50, 0xa4, 0x6c, 0x52, 0x10, 0x11, 0x86, - 0xcd, 0xce, 0xb5, 0x1d, 0xba, 0xbb, 0xb3, 0x9d, 0x47, 0x60, 0xfd, 0x24, 0x7e, 0x10, 0x3f, 0xa0, - 0xcc, 0xcc, 0x6e, 0x1e, 0xa5, 0x7f, 0xe8, 0x5f, 0x99, 0x7b, 0xee, 0xb9, 0xe7, 0x3e, 0x72, 0x16, - 0x1d, 0x49, 0x88, 0x84, 0x64, 0x6a, 0x94, 0x29, 0x5a, 0x3c, 0x69, 0xf8, 0xd3, 0x48, 0xa0, 0x0a, - 0xe4, 0x9c, 0x47, 0x40, 0x67, 0x46, 0x0d, 0x33, 0x29, 0xb4, 0xc0, 0x1d, 0xf7, 0xa3, 0x86, 0x05, - 0xef, 0xe0, 0x57, 0x1d, 0x75, 0xcf, 0x2d, 0x77, 0xe2, 0xa9, 0x17, 0x46, 0xe1, 0x67, 0xa8, 0x15, - 0x89, 0x54, 0x43, 0xaa, 0xa9, 0xce, 0x33, 0x20, 0x95, 0x7e, 0x65, 0xd0, 0x08, 0x9a, 0x05, 0x36, - 0xcd, 0x33, 0xc0, 0x87, 0xa8, 0x13, 0x09, 0x29, 0x21, 0x0e, 0x35, 0x17, 0x29, 0xe5, 0x8c, 0x54, - 0x1d, 0xa9, 0xbd, 0x82, 0x8e, 0x19, 0xde, 0x45, 0xf5, 0x79, 0x18, 0x1b, 0x20, 0xb5, 0x7e, 0x65, - 0xd0, 0x0a, 0x7c, 0x60, 0x8b, 0x19, 0xc4, 0x7c, 0x0e, 0x32, 0xa7, 0x91, 0x30, 0xa9, 0x26, 0x1b, - 0xfd, 0xca, 0xa0, 0x1d, 0xb4, 0x4b, 0xf4, 0x83, 0x05, 0xf1, 0x53, 0x84, 0x14, 0x28, 0x55, 0xe8, - 0xd7, 0x9d, 0x7e, 0xa3, 0x40, 0xc6, 0xcc, 0xaa, 0xdc, 0x48, 0x61, 0x32, 0xaa, 0xe0, 0xde, 0x40, - 0x1a, 0x01, 0xd9, 0xf4, 0x2a, 0x0e, 0x9d, 0x14, 0x20, 0xee, 0xa0, 0x2a, 0x67, 0x64, 0xcb, 0x55, - 0x57, 0xb9, 0x1b, 0x29, 0x0e, 0x67, 0x10, 0x93, 0x6d, 0x07, 0xf9, 0x00, 0x3f, 0x41, 0xdb, 0x12, - 0xb2, 0x38, 0xa7, 0x5a, 0x90, 0x86, 0x4b, 0x6c, 0xb9, 0x78, 0x2a, 0xf0, 0x4b, 0xb4, 0x53, 0xa6, - 0xa8, 0x6f, 0xc8, 0x19, 0x41, 0x8e, 0xd3, 0x29, 0x38, 0x1f, 0x2d, 0x3c, 0x66, 0xb6, 0x97, 0x16, - 0xa4, 0xe9, 0x7b, 0x69, 0x81, 0x7b, 0xa8, 0xa6, 0x75, 0x4c, 0x5a, 0xfd, 0xca, 0xa0, 0x16, 0xd8, - 0xa7, 0xdd, 0x29, 0x16, 0xd1, 0x1d, 0xd5, 0xe2, 0x0e, 0x52, 0xd2, 0xf6, 0x3b, 0x59, 0x64, 0x6a, - 0x01, 0x1c, 0xa0, 0x1d, 0x95, 0x2b, 0x0d, 0x09, 0xcd, 0xa4, 0xc8, 0x40, 0x6a, 0x0e, 0x8a, 0x74, - 0xfa, 0x95, 0x41, 0xf3, 0xf8, 0x70, 0xb8, 0xfe, 0xcf, 0x0d, 0xfd, 0xbf, 0xe6, 0xd8, 0x57, 0x0b, - 0x72, 0xd0, 0x53, 0x0f, 0x10, 0xfc, 0x1d, 0x75, 0x8d, 0x02, 0xb9, 0xaa, 0xd8, 0xed, 0xd7, 0x06, - 0xcd, 0xe3, 0x93, 0xc7, 0x15, 0x17, 0x3e, 0x18, 0x5e, 0x2b, 0x90, 0x4b, 0xa1, 0xcb, 0x54, 0xcb, - 0x3c, 0xe8, 0x98, 0x35, 0x10, 0xef, 0xa1, 0xcd, 0x1f, 0x42, 0x26, 0xa1, 0x26, 0x3d, 0x77, 0xfd, - 0x22, 0xda, 0x3f, 0x47, 0xff, 0x3d, 0x52, 0x6e, 0x2f, 0x72, 0x07, 0x79, 0xe1, 0x28, 0xfb, 0x5c, - 0x5a, 0xc4, 0x1b, 0xc8, 0x07, 0xef, 0xaa, 0xa7, 0x95, 0x83, 0xdf, 0x1b, 0xe8, 0xff, 0x47, 0x97, - 0xb4, 0x06, 0xb5, 0x37, 0x03, 0x46, 0x4d, 0xaa, 0x79, 0xec, 0xe4, 0x6a, 0x41, 0xd3, 0x63, 0xd7, - 0x16, 0xc2, 0x2f, 0x50, 0xb7, 0xf4, 0x05, 0x4d, 0x4d, 0x32, 0x03, 0xe9, 0x1a, 0xd4, 0x82, 0x4e, - 0x09, 0x7f, 0x71, 0xa8, 0xd5, 0xca, 0x42, 0xa9, 0x79, 0xe9, 0x63, 0xeb, 0xd4, 0x7a, 0xd0, 0x5c, - 0x60, 0x63, 0x86, 0x9f, 0xa3, 0xf6, 0x92, 0x62, 0xc7, 0xdf, 0x70, 0xa3, 0x2e, 0xeb, 0x3e, 0x41, - 0x6e, 0x49, 0x90, 0xde, 0x1b, 0x30, 0xc0, 0xa8, 0xe6, 0x09, 0x38, 0xc3, 0xd6, 0x82, 0x56, 0x09, - 0x4e, 0x79, 0x02, 0xf8, 0x15, 0xc2, 0x0c, 0x42, 0x46, 0x63, 0xd0, 0x1a, 0x24, 0x55, 0xc2, 0xc8, - 0xc2, 0xb7, 0x8d, 0xa0, 0x67, 0x33, 0x9f, 0x5d, 0x62, 0xe2, 0x70, 0xfc, 0x06, 0xed, 0xa9, 0xe8, - 0x16, 0x98, 0x89, 0x81, 0xd1, 0x42, 0xc7, 0x6b, 0x6f, 0x39, 0xed, 0xdd, 0x45, 0xf6, 0xd2, 0x27, - 0x5d, 0x8f, 0x53, 0x44, 0x16, 0x83, 0x3c, 0x3c, 0xc1, 0xb6, 0xab, 0xdb, 0x2b, 0xf3, 0x93, 0xf5, - 0x53, 0x1c, 0xa1, 0x9d, 0x39, 0x0f, 0xe9, 0xfa, 0xae, 0xfe, 0x6b, 0xe8, 0xce, 0x79, 0x78, 0xb5, - 0xba, 0xee, 0x57, 0xd4, 0x0c, 0xd3, 0x54, 0x68, 0xf7, 0xa5, 0x2b, 0x82, 0x9c, 0xa3, 0xde, 0xfe, - 0x95, 0x47, 0x87, 0xe7, 0xcb, 0x42, 0x6f, 0xaa, 0x55, 0xa9, 0xfd, 0x33, 0xd4, 0x7b, 0x48, 0xf8, - 0x17, 0xdb, 0x5c, 0x9c, 0x7d, 0x7b, 0x7f, 0xc3, 0xf5, 0xad, 0x99, 0x0d, 0x23, 0x91, 0x8c, 0x66, - 0xa1, 0x8e, 0x6e, 0x23, 0x21, 0xb3, 0x51, 0x16, 0xbb, 0x2d, 0x5f, 0xdb, 0xa3, 0x25, 0xa1, 0x1a, - 0xcd, 0x0c, 0x8f, 0xd9, 0xe8, 0x46, 0x8c, 0xfc, 0xcc, 0xa3, 0x62, 0xe6, 0xd9, 0xa6, 0x8b, 0x4f, - 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0x75, 0xde, 0x8d, 0x84, 0x56, 0x05, 0x00, 0x00, +var File_records_ps_records_azure_service_bus_proto protoreflect.FileDescriptor + +var file_records_ps_records_azure_service_bus_proto_rawDesc = []byte{ + 0x0a, 0x2a, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0x98, 0x05, 0x0a, + 0x0f, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, + 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x72, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x72, + 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, + 0x72, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, + 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, + 0x67, 0x72, 0x6f, 0x75, 0x70, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, + 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x61, + 0x62, 0x65, 0x6c, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x5f, 0x74, 0x6f, 0x18, + 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x12, 0x29, + 0x0a, 0x11, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x5f, 0x74, 0x6f, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x5f, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6c, 0x79, + 0x54, 0x6f, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x74, 0x6f, 0x18, + 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x74, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, + 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x6c, + 0x6f, 0x63, 0x6b, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x52, 0x0a, 0x11, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, + 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, + 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x52, 0x10, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x5c, + 0x0a, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, + 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f, + 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0e, 0x75, 0x73, + 0x65, 0x72, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, + 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x66, 0x6f, + 0x72, 0x6d, 0x61, 0x74, 0x1a, 0x41, 0x0a, 0x13, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x70, + 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xb4, 0x04, 0x0a, 0x15, 0x41, 0x7a, 0x75, 0x72, + 0x65, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, + 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x5f, 0x75, 0x6e, 0x74, 0x69, + 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x55, + 0x6e, 0x74, 0x69, 0x6c, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, + 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x73, + 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x21, 0x0a, + 0x0c, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, + 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, + 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x6e, 0x71, 0x75, 0x65, 0x75, 0x65, + 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x65, 0x6e, + 0x71, 0x75, 0x65, 0x75, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x64, 0x65, + 0x61, 0x64, 0x5f, 0x6c, 0x65, 0x74, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x64, 0x65, 0x61, 0x64, 0x4c, 0x65, 0x74, 0x74, + 0x65, 0x72, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x34, 0x0a, 0x16, 0x73, 0x63, 0x68, 0x65, + 0x64, 0x75, 0x6c, 0x65, 0x64, 0x5f, 0x65, 0x6e, 0x71, 0x75, 0x65, 0x75, 0x65, 0x5f, 0x74, 0x69, + 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x14, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, + 0x6c, 0x65, 0x64, 0x45, 0x6e, 0x71, 0x75, 0x65, 0x75, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x38, + 0x0a, 0x18, 0x65, 0x6e, 0x71, 0x75, 0x65, 0x75, 0x65, 0x64, 0x5f, 0x73, 0x65, 0x71, 0x75, 0x65, + 0x6e, 0x63, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x16, 0x65, 0x6e, 0x71, 0x75, 0x65, 0x75, 0x65, 0x64, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, + 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x11, 0x76, 0x69, 0x61, 0x5f, + 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0f, 0x76, 0x69, 0x61, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x58, 0x0a, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x41, 0x7a, 0x75, 0x72, 0x65, + 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, + 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x52, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x3e, + 0x0a, 0x10, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x3e, + 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, + 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_records_ps_records_azure_service_bus_proto_rawDescOnce sync.Once + file_records_ps_records_azure_service_bus_proto_rawDescData = file_records_ps_records_azure_service_bus_proto_rawDesc +) + +func file_records_ps_records_azure_service_bus_proto_rawDescGZIP() []byte { + file_records_ps_records_azure_service_bus_proto_rawDescOnce.Do(func() { + file_records_ps_records_azure_service_bus_proto_rawDescData = protoimpl.X.CompressGZIP(file_records_ps_records_azure_service_bus_proto_rawDescData) + }) + return file_records_ps_records_azure_service_bus_proto_rawDescData +} + +var file_records_ps_records_azure_service_bus_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_records_ps_records_azure_service_bus_proto_goTypes = []interface{}{ + (*AzureServiceBus)(nil), // 0: protos.records.AzureServiceBus + (*AzureSystemProperties)(nil), // 1: protos.records.AzureSystemProperties + nil, // 2: protos.records.AzureServiceBus.UserPropertiesEntry + nil, // 3: protos.records.AzureSystemProperties.AnnotationsEntry +} +var file_records_ps_records_azure_service_bus_proto_depIdxs = []int32{ + 1, // 0: protos.records.AzureServiceBus.system_properties:type_name -> protos.records.AzureSystemProperties + 2, // 1: protos.records.AzureServiceBus.user_properties:type_name -> protos.records.AzureServiceBus.UserPropertiesEntry + 3, // 2: protos.records.AzureSystemProperties.annotations:type_name -> protos.records.AzureSystemProperties.AnnotationsEntry + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_records_ps_records_azure_service_bus_proto_init() } +func file_records_ps_records_azure_service_bus_proto_init() { + if File_records_ps_records_azure_service_bus_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_records_ps_records_azure_service_bus_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AzureServiceBus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_records_ps_records_azure_service_bus_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AzureSystemProperties); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_records_ps_records_azure_service_bus_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_records_ps_records_azure_service_bus_proto_goTypes, + DependencyIndexes: file_records_ps_records_azure_service_bus_proto_depIdxs, + MessageInfos: file_records_ps_records_azure_service_bus_proto_msgTypes, + }.Build() + File_records_ps_records_azure_service_bus_proto = out.File + file_records_ps_records_azure_service_bus_proto_rawDesc = nil + file_records_ps_records_azure_service_bus_proto_goTypes = nil + file_records_ps_records_azure_service_bus_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_base.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_base.pb.go index a30c82767..6a5a29ca0 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_base.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_base.pb.go @@ -1,27 +1,33 @@ +// Records contain types for read, write and relay operations. + // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: records/ps_records_base.proto package records import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) // Returned for read requests (server & cli) type ReadRecord struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Unique id automatically created by plumber MessageId string `protobuf:"bytes,1,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` // Plumber counts the number of messages it reads; this number represents @@ -42,7 +48,8 @@ type ReadRecord struct { // whether decoding options were specified for a read. // _This_ is what both CLI and desktop should display for the payload. Payload []byte `protobuf:"bytes,99,opt,name=payload,proto3" json:"payload,omitempty"` - // Types that are valid to be assigned to Record: + // Types that are assignable to Record: + // // *ReadRecord_Kafka // *ReadRecord_Rabbit // *ReadRecord_Activemq @@ -69,72 +76,244 @@ type ReadRecord struct { // In most cases, you should use the oneof record instead of the raw message. XRaw []byte `protobuf:"bytes,1000,opt,name=_raw,json=Raw,proto3" json:"_raw,omitempty"` // Identifies which plumber instance received the event (set outside the backend) - XPlumberId string `protobuf:"bytes,1001,opt,name=_plumber_id,json=PlumberId,proto3" json:"_plumber_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + XPlumberId string `protobuf:"bytes,1001,opt,name=_plumber_id,json=PlumberId,proto3" json:"_plumber_id,omitempty"` } -func (m *ReadRecord) Reset() { *m = ReadRecord{} } -func (m *ReadRecord) String() string { return proto.CompactTextString(m) } -func (*ReadRecord) ProtoMessage() {} -func (*ReadRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_79a95b759e1a93f6, []int{0} +func (x *ReadRecord) Reset() { + *x = ReadRecord{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_base_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ReadRecord) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadRecord.Unmarshal(m, b) -} -func (m *ReadRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadRecord.Marshal(b, m, deterministic) -} -func (m *ReadRecord) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadRecord.Merge(m, src) -} -func (m *ReadRecord) XXX_Size() int { - return xxx_messageInfo_ReadRecord.Size(m) +func (x *ReadRecord) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadRecord) XXX_DiscardUnknown() { - xxx_messageInfo_ReadRecord.DiscardUnknown(m) + +func (*ReadRecord) ProtoMessage() {} + +func (x *ReadRecord) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_base_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_ReadRecord proto.InternalMessageInfo +// Deprecated: Use ReadRecord.ProtoReflect.Descriptor instead. +func (*ReadRecord) Descriptor() ([]byte, []int) { + return file_records_ps_records_base_proto_rawDescGZIP(), []int{0} +} -func (m *ReadRecord) GetMessageId() string { - if m != nil { - return m.MessageId +func (x *ReadRecord) GetMessageId() string { + if x != nil { + return x.MessageId } return "" } -func (m *ReadRecord) GetNum() int64 { - if m != nil { - return m.Num +func (x *ReadRecord) GetNum() int64 { + if x != nil { + return x.Num } return 0 } -func (m *ReadRecord) GetMetadata() map[string]string { - if m != nil { - return m.Metadata +func (x *ReadRecord) GetMetadata() map[string]string { + if x != nil { + return x.Metadata } return nil } -func (m *ReadRecord) GetReceivedAtUnixTsUtc() int64 { - if m != nil { - return m.ReceivedAtUnixTsUtc +func (x *ReadRecord) GetReceivedAtUnixTsUtc() int64 { + if x != nil { + return x.ReceivedAtUnixTsUtc } return 0 } -func (m *ReadRecord) GetPayload() []byte { +func (x *ReadRecord) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +func (m *ReadRecord) GetRecord() isReadRecord_Record { if m != nil { - return m.Payload + return m.Record + } + return nil +} + +func (x *ReadRecord) GetKafka() *Kafka { + if x, ok := x.GetRecord().(*ReadRecord_Kafka); ok { + return x.Kafka } return nil } +func (x *ReadRecord) GetRabbit() *Rabbit { + if x, ok := x.GetRecord().(*ReadRecord_Rabbit); ok { + return x.Rabbit + } + return nil +} + +func (x *ReadRecord) GetActivemq() *ActiveMQ { + if x, ok := x.GetRecord().(*ReadRecord_Activemq); ok { + return x.Activemq + } + return nil +} + +func (x *ReadRecord) GetAwsSqs() *AWSSQS { + if x, ok := x.GetRecord().(*ReadRecord_AwsSqs); ok { + return x.AwsSqs + } + return nil +} + +func (x *ReadRecord) GetAzureEventHub() *AzureEventHub { + if x, ok := x.GetRecord().(*ReadRecord_AzureEventHub); ok { + return x.AzureEventHub + } + return nil +} + +func (x *ReadRecord) GetAzureServiceBus() *AzureServiceBus { + if x, ok := x.GetRecord().(*ReadRecord_AzureServiceBus); ok { + return x.AzureServiceBus + } + return nil +} + +func (x *ReadRecord) GetGcpPubsub() *GCPPubSub { + if x, ok := x.GetRecord().(*ReadRecord_GcpPubsub); ok { + return x.GcpPubsub + } + return nil +} + +func (x *ReadRecord) GetKubemq() *KubeMQ { + if x, ok := x.GetRecord().(*ReadRecord_Kubemq); ok { + return x.Kubemq + } + return nil +} + +func (x *ReadRecord) GetMongo() *Mongo { + if x, ok := x.GetRecord().(*ReadRecord_Mongo); ok { + return x.Mongo + } + return nil +} + +func (x *ReadRecord) GetMqtt() *MQTT { + if x, ok := x.GetRecord().(*ReadRecord_Mqtt); ok { + return x.Mqtt + } + return nil +} + +func (x *ReadRecord) GetNats() *Nats { + if x, ok := x.GetRecord().(*ReadRecord_Nats); ok { + return x.Nats + } + return nil +} + +func (x *ReadRecord) GetNatsStreaming() *NatsStreaming { + if x, ok := x.GetRecord().(*ReadRecord_NatsStreaming); ok { + return x.NatsStreaming + } + return nil +} + +func (x *ReadRecord) GetNsq() *NSQ { + if x, ok := x.GetRecord().(*ReadRecord_Nsq); ok { + return x.Nsq + } + return nil +} + +func (x *ReadRecord) GetPostgres() *Postgres { + if x, ok := x.GetRecord().(*ReadRecord_Postgres); ok { + return x.Postgres + } + return nil +} + +func (x *ReadRecord) GetPulsar() *Pulsar { + if x, ok := x.GetRecord().(*ReadRecord_Pulsar); ok { + return x.Pulsar + } + return nil +} + +func (x *ReadRecord) GetRabbitStreams() *RabbitStreams { + if x, ok := x.GetRecord().(*ReadRecord_RabbitStreams); ok { + return x.RabbitStreams + } + return nil +} + +func (x *ReadRecord) GetRedisPubsub() *RedisPubsub { + if x, ok := x.GetRecord().(*ReadRecord_RedisPubsub); ok { + return x.RedisPubsub + } + return nil +} + +func (x *ReadRecord) GetRedisStreams() *RedisStreams { + if x, ok := x.GetRecord().(*ReadRecord_RedisStreams); ok { + return x.RedisStreams + } + return nil +} + +func (x *ReadRecord) GetNatsJetstream() *NatsJetstream { + if x, ok := x.GetRecord().(*ReadRecord_NatsJetstream); ok { + return x.NatsJetstream + } + return nil +} + +func (x *ReadRecord) GetAwsKinesis() *AWSKinesis { + if x, ok := x.GetRecord().(*ReadRecord_AwsKinesis); ok { + return x.AwsKinesis + } + return nil +} + +func (x *ReadRecord) GetMemphis() *Memphis { + if x, ok := x.GetRecord().(*ReadRecord_Memphis); ok { + return x.Memphis + } + return nil +} + +func (x *ReadRecord) GetXRaw() []byte { + if x != nil { + return x.XRaw + } + return nil +} + +func (x *ReadRecord) GetXPlumberId() string { + if x != nil { + return x.XPlumberId + } + return "" +} + type isReadRecord_Record interface { isReadRecord_Record() } @@ -265,177 +444,452 @@ func (*ReadRecord_AwsKinesis) isReadRecord_Record() {} func (*ReadRecord_Memphis) isReadRecord_Record() {} -func (m *ReadRecord) GetRecord() isReadRecord_Record { - if m != nil { - return m.Record - } - return nil -} - -func (m *ReadRecord) GetKafka() *Kafka { - if x, ok := m.GetRecord().(*ReadRecord_Kafka); ok { - return x.Kafka - } - return nil -} - -func (m *ReadRecord) GetRabbit() *Rabbit { - if x, ok := m.GetRecord().(*ReadRecord_Rabbit); ok { - return x.Rabbit - } - return nil -} - -func (m *ReadRecord) GetActivemq() *ActiveMQ { - if x, ok := m.GetRecord().(*ReadRecord_Activemq); ok { - return x.Activemq - } - return nil -} - -func (m *ReadRecord) GetAwsSqs() *AWSSQS { - if x, ok := m.GetRecord().(*ReadRecord_AwsSqs); ok { - return x.AwsSqs - } - return nil -} +// Used as an arg for write requests (server & cli) +type WriteRecord struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *ReadRecord) GetAzureEventHub() *AzureEventHub { - if x, ok := m.GetRecord().(*ReadRecord_AzureEventHub); ok { - return x.AzureEventHub - } - return nil + // If encoding options are provided, this value will be updated by plumber + // to contain the encoded payload _before_ passing it to the backend. + // @gotags: kong:"help='Input string',name=input,xor=input,default" + Input string `protobuf:"bytes,1,opt,name=input,proto3" json:"input,omitempty" kong:"help='Input string',name=input,xor=input,default"` + // @gotags: kong:"help='Optional metadata a backend may use (key1=value,key2=value,etc)',name=input-metadata" + InputMetadata map[string]string `protobuf:"bytes,2,rep,name=input_metadata,json=inputMetadata,proto3" json:"input_metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" kong:"help='Optional metadata a backend may use (key1=value,key2=value,etc)',name=input-metadata"` } -func (m *ReadRecord) GetAzureServiceBus() *AzureServiceBus { - if x, ok := m.GetRecord().(*ReadRecord_AzureServiceBus); ok { - return x.AzureServiceBus +func (x *WriteRecord) Reset() { + *x = WriteRecord{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_base_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return nil } -func (m *ReadRecord) GetGcpPubsub() *GCPPubSub { - if x, ok := m.GetRecord().(*ReadRecord_GcpPubsub); ok { - return x.GcpPubsub - } - return nil +func (x *WriteRecord) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadRecord) GetKubemq() *KubeMQ { - if x, ok := m.GetRecord().(*ReadRecord_Kubemq); ok { - return x.Kubemq - } - return nil -} +func (*WriteRecord) ProtoMessage() {} -func (m *ReadRecord) GetMongo() *Mongo { - if x, ok := m.GetRecord().(*ReadRecord_Mongo); ok { - return x.Mongo +func (x *WriteRecord) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_base_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return nil + return mi.MessageOf(x) } -func (m *ReadRecord) GetMqtt() *MQTT { - if x, ok := m.GetRecord().(*ReadRecord_Mqtt); ok { - return x.Mqtt - } - return nil +// Deprecated: Use WriteRecord.ProtoReflect.Descriptor instead. +func (*WriteRecord) Descriptor() ([]byte, []int) { + return file_records_ps_records_base_proto_rawDescGZIP(), []int{1} } -func (m *ReadRecord) GetNats() *Nats { - if x, ok := m.GetRecord().(*ReadRecord_Nats); ok { - return x.Nats +func (x *WriteRecord) GetInput() string { + if x != nil { + return x.Input } - return nil + return "" } -func (m *ReadRecord) GetNatsStreaming() *NatsStreaming { - if x, ok := m.GetRecord().(*ReadRecord_NatsStreaming); ok { - return x.NatsStreaming +func (x *WriteRecord) GetInputMetadata() map[string]string { + if x != nil { + return x.InputMetadata } return nil } -func (m *ReadRecord) GetNsq() *NSQ { - if x, ok := m.GetRecord().(*ReadRecord_Nsq); ok { - return x.Nsq - } - return nil -} +// Used for communicating errors that occur during a read, write, relay, etc. +type ErrorRecord struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *ReadRecord) GetPostgres() *Postgres { - if x, ok := m.GetRecord().(*ReadRecord_Postgres); ok { - return x.Postgres - } - return nil + OccurredAtUnixTsUtc int64 `protobuf:"varint,1,opt,name=occurred_at_unix_ts_utc,json=occurredAtUnixTsUtc,proto3" json:"occurred_at_unix_ts_utc,omitempty"` + Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` + Metadata map[string][]byte `protobuf:"bytes,3,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } -func (m *ReadRecord) GetPulsar() *Pulsar { - if x, ok := m.GetRecord().(*ReadRecord_Pulsar); ok { - return x.Pulsar +func (x *ErrorRecord) Reset() { + *x = ErrorRecord{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_base_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return nil } -func (m *ReadRecord) GetRabbitStreams() *RabbitStreams { - if x, ok := m.GetRecord().(*ReadRecord_RabbitStreams); ok { - return x.RabbitStreams - } - return nil +func (x *ErrorRecord) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ReadRecord) GetRedisPubsub() *RedisPubsub { - if x, ok := m.GetRecord().(*ReadRecord_RedisPubsub); ok { - return x.RedisPubsub - } - return nil -} +func (*ErrorRecord) ProtoMessage() {} -func (m *ReadRecord) GetRedisStreams() *RedisStreams { - if x, ok := m.GetRecord().(*ReadRecord_RedisStreams); ok { - return x.RedisStreams +func (x *ErrorRecord) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_base_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return nil + return mi.MessageOf(x) } -func (m *ReadRecord) GetNatsJetstream() *NatsJetstream { - if x, ok := m.GetRecord().(*ReadRecord_NatsJetstream); ok { - return x.NatsJetstream - } - return nil +// Deprecated: Use ErrorRecord.ProtoReflect.Descriptor instead. +func (*ErrorRecord) Descriptor() ([]byte, []int) { + return file_records_ps_records_base_proto_rawDescGZIP(), []int{2} } -func (m *ReadRecord) GetAwsKinesis() *AWSKinesis { - if x, ok := m.GetRecord().(*ReadRecord_AwsKinesis); ok { - return x.AwsKinesis +func (x *ErrorRecord) GetOccurredAtUnixTsUtc() int64 { + if x != nil { + return x.OccurredAtUnixTsUtc } - return nil + return 0 } -func (m *ReadRecord) GetMemphis() *Memphis { - if x, ok := m.GetRecord().(*ReadRecord_Memphis); ok { - return x.Memphis +func (x *ErrorRecord) GetError() string { + if x != nil { + return x.Error } - return nil + return "" } -func (m *ReadRecord) GetXRaw() []byte { - if m != nil { - return m.XRaw +func (x *ErrorRecord) GetMetadata() map[string][]byte { + if x != nil { + return x.Metadata } return nil } -func (m *ReadRecord) GetXPlumberId() string { - if m != nil { - return m.XPlumberId - } - return "" -} +var File_records_ps_records_base_proto protoreflect.FileDescriptor + +var file_records_ps_records_base_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x1a, + 0x21, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, 0x6f, + 0x72, 0x64, 0x73, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x6d, 0x71, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x24, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, + 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x61, 0x77, 0x73, 0x5f, 0x6b, 0x69, 0x6e, 0x65, 0x73, + 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x61, 0x77, 0x73, + 0x5f, 0x73, 0x71, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x28, 0x72, 0x65, 0x63, 0x6f, + 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x61, + 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x75, 0x62, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, + 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x23, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x67, 0x63, 0x70, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, + 0x73, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, + 0x73, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, + 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x6d, 0x65, 0x6d, 0x70, 0x68, + 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x6d, 0x6f, 0x6e, + 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x6d, 0x71, 0x74, + 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, + 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x27, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, + 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x5f, + 0x6a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x27, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, 0x6f, + 0x72, 0x64, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, + 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x6e, 0x73, 0x71, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, + 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x70, 0x6f, 0x73, 0x74, 0x67, + 0x72, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x72, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x70, 0x75, + 0x6c, 0x73, 0x61, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x72, 0x65, 0x63, 0x6f, + 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x72, + 0x61, 0x62, 0x62, 0x69, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x27, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x5f, + 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x25, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, + 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x70, + 0x75, 0x62, 0x73, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x26, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x5f, + 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0x8e, 0x0c, 0x0a, 0x0a, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x63, 0x6f, + 0x72, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, + 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x75, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, + 0x6e, 0x75, 0x6d, 0x12, 0x44, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, + 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, + 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x34, 0x0a, 0x17, 0x72, 0x65, 0x63, + 0x65, 0x69, 0x76, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x5f, 0x75, 0x6e, 0x69, 0x78, 0x5f, 0x74, 0x73, + 0x5f, 0x75, 0x74, 0x63, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x13, 0x72, 0x65, 0x63, 0x65, + 0x69, 0x76, 0x65, 0x64, 0x41, 0x74, 0x55, 0x6e, 0x69, 0x78, 0x54, 0x73, 0x55, 0x74, 0x63, 0x12, + 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x63, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x2d, 0x0a, 0x05, 0x6b, 0x61, 0x66, + 0x6b, 0x61, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x48, + 0x00, 0x52, 0x05, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x12, 0x30, 0x0a, 0x06, 0x72, 0x61, 0x62, 0x62, + 0x69, 0x74, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, + 0x48, 0x00, 0x52, 0x06, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x12, 0x36, 0x0a, 0x08, 0x61, 0x63, + 0x74, 0x69, 0x76, 0x65, 0x6d, 0x71, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x41, 0x63, + 0x74, 0x69, 0x76, 0x65, 0x4d, 0x51, 0x48, 0x00, 0x52, 0x08, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, + 0x6d, 0x71, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x71, 0x73, 0x18, 0x67, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x53, 0x51, 0x53, 0x48, 0x00, 0x52, 0x06, 0x61, + 0x77, 0x73, 0x53, 0x71, 0x73, 0x12, 0x47, 0x0a, 0x0f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x65, + 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x75, 0x62, 0x18, 0x68, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, + 0x41, 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x75, 0x62, 0x48, 0x00, 0x52, + 0x0d, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x75, 0x62, 0x12, 0x4d, + 0x0a, 0x11, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, + 0x62, 0x75, 0x73, 0x18, 0x69, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x41, 0x7a, 0x75, 0x72, 0x65, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, 0x48, 0x00, 0x52, 0x0f, 0x61, 0x7a, + 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x75, 0x73, 0x12, 0x3a, 0x0a, + 0x0a, 0x67, 0x63, 0x70, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x18, 0x6a, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x73, 0x2e, 0x47, 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x48, 0x00, 0x52, 0x09, + 0x67, 0x63, 0x70, 0x50, 0x75, 0x62, 0x73, 0x75, 0x62, 0x12, 0x30, 0x0a, 0x06, 0x6b, 0x75, 0x62, + 0x65, 0x6d, 0x71, 0x18, 0x6b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x4b, 0x75, 0x62, 0x65, 0x4d, + 0x51, 0x48, 0x00, 0x52, 0x06, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, 0x12, 0x2d, 0x0a, 0x05, 0x6d, + 0x6f, 0x6e, 0x67, 0x6f, 0x18, 0x6c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x4d, 0x6f, 0x6e, 0x67, + 0x6f, 0x48, 0x00, 0x52, 0x05, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x12, 0x2a, 0x0a, 0x04, 0x6d, 0x71, + 0x74, 0x74, 0x18, 0x6d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x4d, 0x51, 0x54, 0x54, 0x48, 0x00, + 0x52, 0x04, 0x6d, 0x71, 0x74, 0x74, 0x12, 0x2a, 0x0a, 0x04, 0x6e, 0x61, 0x74, 0x73, 0x18, 0x6e, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, + 0x74, 0x73, 0x12, 0x46, 0x0a, 0x0e, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x6f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, + 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x0d, 0x6e, 0x61, 0x74, + 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x12, 0x27, 0x0a, 0x03, 0x6e, 0x73, + 0x71, 0x18, 0x70, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x4e, 0x53, 0x51, 0x48, 0x00, 0x52, 0x03, + 0x6e, 0x73, 0x71, 0x12, 0x36, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x18, + 0x71, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, + 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x48, + 0x00, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x12, 0x30, 0x0a, 0x06, 0x70, + 0x75, 0x6c, 0x73, 0x61, 0x72, 0x18, 0x72, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x50, 0x75, 0x6c, + 0x73, 0x61, 0x72, 0x48, 0x00, 0x52, 0x06, 0x70, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x12, 0x46, 0x0a, + 0x0e, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, + 0x73, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, + 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x73, 0x48, 0x00, 0x52, 0x0d, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x40, 0x0a, 0x0c, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x70, + 0x75, 0x62, 0x73, 0x75, 0x62, 0x18, 0x74, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x52, 0x65, 0x64, + 0x69, 0x73, 0x50, 0x75, 0x62, 0x73, 0x75, 0x62, 0x48, 0x00, 0x52, 0x0b, 0x72, 0x65, 0x64, 0x69, + 0x73, 0x50, 0x75, 0x62, 0x73, 0x75, 0x62, 0x12, 0x43, 0x0a, 0x0d, 0x72, 0x65, 0x64, 0x69, 0x73, + 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x75, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, + 0x52, 0x65, 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x48, 0x00, 0x52, 0x0c, + 0x72, 0x65, 0x64, 0x69, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x46, 0x0a, 0x0e, + 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x6a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18, 0x76, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x4e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x48, 0x00, 0x52, 0x0d, 0x6e, 0x61, 0x74, 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x12, 0x3d, 0x0a, 0x0b, 0x61, 0x77, 0x73, 0x5f, 0x6b, 0x69, 0x6e, 0x65, + 0x73, 0x69, 0x73, 0x18, 0x77, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x4b, 0x69, + 0x6e, 0x65, 0x73, 0x69, 0x73, 0x48, 0x00, 0x52, 0x0a, 0x61, 0x77, 0x73, 0x4b, 0x69, 0x6e, 0x65, + 0x73, 0x69, 0x73, 0x12, 0x33, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x18, 0x78, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x48, 0x00, 0x52, + 0x07, 0x6d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x5f, 0x72, 0x61, 0x77, + 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x52, 0x61, 0x77, 0x12, 0x1f, 0x0a, 0x0b, + 0x5f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0xe9, 0x07, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x50, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x64, 0x1a, 0x3b, 0x0a, + 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x52, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x22, 0xbc, 0x01, 0x0a, 0x0b, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x55, 0x0a, 0x0e, 0x69, 0x6e, + 0x70, 0x75, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, + 0x72, 0x64, 0x73, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, + 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x52, 0x0d, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x1a, 0x40, 0x0a, 0x12, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, + 0x02, 0x38, 0x01, 0x22, 0xdd, 0x01, 0x0a, 0x0b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x12, 0x34, 0x0a, 0x17, 0x6f, 0x63, 0x63, 0x75, 0x72, 0x72, 0x65, 0x64, 0x5f, + 0x61, 0x74, 0x5f, 0x75, 0x6e, 0x69, 0x78, 0x5f, 0x74, 0x73, 0x5f, 0x75, 0x74, 0x63, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x13, 0x6f, 0x63, 0x63, 0x75, 0x72, 0x72, 0x65, 0x64, 0x41, 0x74, + 0x55, 0x6e, 0x69, 0x78, 0x54, 0x73, 0x55, 0x74, 0x63, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, + 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, + 0x45, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x29, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x73, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, + 0x02, 0x38, 0x01, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, + 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x72, 0x65, 0x63, 0x6f, + 0x72, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_records_ps_records_base_proto_rawDescOnce sync.Once + file_records_ps_records_base_proto_rawDescData = file_records_ps_records_base_proto_rawDesc +) -// XXX_OneofWrappers is for the internal use of the proto package. -func (*ReadRecord) XXX_OneofWrappers() []interface{} { - return []interface{}{ +func file_records_ps_records_base_proto_rawDescGZIP() []byte { + file_records_ps_records_base_proto_rawDescOnce.Do(func() { + file_records_ps_records_base_proto_rawDescData = protoimpl.X.CompressGZIP(file_records_ps_records_base_proto_rawDescData) + }) + return file_records_ps_records_base_proto_rawDescData +} + +var file_records_ps_records_base_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_records_ps_records_base_proto_goTypes = []interface{}{ + (*ReadRecord)(nil), // 0: protos.records.ReadRecord + (*WriteRecord)(nil), // 1: protos.records.WriteRecord + (*ErrorRecord)(nil), // 2: protos.records.ErrorRecord + nil, // 3: protos.records.ReadRecord.MetadataEntry + nil, // 4: protos.records.WriteRecord.InputMetadataEntry + nil, // 5: protos.records.ErrorRecord.MetadataEntry + (*Kafka)(nil), // 6: protos.records.Kafka + (*Rabbit)(nil), // 7: protos.records.Rabbit + (*ActiveMQ)(nil), // 8: protos.records.ActiveMQ + (*AWSSQS)(nil), // 9: protos.records.AWSSQS + (*AzureEventHub)(nil), // 10: protos.records.AzureEventHub + (*AzureServiceBus)(nil), // 11: protos.records.AzureServiceBus + (*GCPPubSub)(nil), // 12: protos.records.GCPPubSub + (*KubeMQ)(nil), // 13: protos.records.KubeMQ + (*Mongo)(nil), // 14: protos.records.Mongo + (*MQTT)(nil), // 15: protos.records.MQTT + (*Nats)(nil), // 16: protos.records.Nats + (*NatsStreaming)(nil), // 17: protos.records.NatsStreaming + (*NSQ)(nil), // 18: protos.records.NSQ + (*Postgres)(nil), // 19: protos.records.Postgres + (*Pulsar)(nil), // 20: protos.records.Pulsar + (*RabbitStreams)(nil), // 21: protos.records.RabbitStreams + (*RedisPubsub)(nil), // 22: protos.records.RedisPubsub + (*RedisStreams)(nil), // 23: protos.records.RedisStreams + (*NatsJetstream)(nil), // 24: protos.records.NatsJetstream + (*AWSKinesis)(nil), // 25: protos.records.AWSKinesis + (*Memphis)(nil), // 26: protos.records.Memphis +} +var file_records_ps_records_base_proto_depIdxs = []int32{ + 3, // 0: protos.records.ReadRecord.metadata:type_name -> protos.records.ReadRecord.MetadataEntry + 6, // 1: protos.records.ReadRecord.kafka:type_name -> protos.records.Kafka + 7, // 2: protos.records.ReadRecord.rabbit:type_name -> protos.records.Rabbit + 8, // 3: protos.records.ReadRecord.activemq:type_name -> protos.records.ActiveMQ + 9, // 4: protos.records.ReadRecord.aws_sqs:type_name -> protos.records.AWSSQS + 10, // 5: protos.records.ReadRecord.azure_event_hub:type_name -> protos.records.AzureEventHub + 11, // 6: protos.records.ReadRecord.azure_service_bus:type_name -> protos.records.AzureServiceBus + 12, // 7: protos.records.ReadRecord.gcp_pubsub:type_name -> protos.records.GCPPubSub + 13, // 8: protos.records.ReadRecord.kubemq:type_name -> protos.records.KubeMQ + 14, // 9: protos.records.ReadRecord.mongo:type_name -> protos.records.Mongo + 15, // 10: protos.records.ReadRecord.mqtt:type_name -> protos.records.MQTT + 16, // 11: protos.records.ReadRecord.nats:type_name -> protos.records.Nats + 17, // 12: protos.records.ReadRecord.nats_streaming:type_name -> protos.records.NatsStreaming + 18, // 13: protos.records.ReadRecord.nsq:type_name -> protos.records.NSQ + 19, // 14: protos.records.ReadRecord.postgres:type_name -> protos.records.Postgres + 20, // 15: protos.records.ReadRecord.pulsar:type_name -> protos.records.Pulsar + 21, // 16: protos.records.ReadRecord.rabbit_streams:type_name -> protos.records.RabbitStreams + 22, // 17: protos.records.ReadRecord.redis_pubsub:type_name -> protos.records.RedisPubsub + 23, // 18: protos.records.ReadRecord.redis_streams:type_name -> protos.records.RedisStreams + 24, // 19: protos.records.ReadRecord.nats_jetstream:type_name -> protos.records.NatsJetstream + 25, // 20: protos.records.ReadRecord.aws_kinesis:type_name -> protos.records.AWSKinesis + 26, // 21: protos.records.ReadRecord.memphis:type_name -> protos.records.Memphis + 4, // 22: protos.records.WriteRecord.input_metadata:type_name -> protos.records.WriteRecord.InputMetadataEntry + 5, // 23: protos.records.ErrorRecord.metadata:type_name -> protos.records.ErrorRecord.MetadataEntry + 24, // [24:24] is the sub-list for method output_type + 24, // [24:24] is the sub-list for method input_type + 24, // [24:24] is the sub-list for extension type_name + 24, // [24:24] is the sub-list for extension extendee + 0, // [0:24] is the sub-list for field type_name +} + +func init() { file_records_ps_records_base_proto_init() } +func file_records_ps_records_base_proto_init() { + if File_records_ps_records_base_proto != nil { + return + } + file_records_ps_records_activemq_proto_init() + file_records_ps_records_aws_kinesis_proto_init() + file_records_ps_records_aws_sqs_proto_init() + file_records_ps_records_azure_event_hub_proto_init() + file_records_ps_records_azure_service_bus_proto_init() + file_records_ps_records_gcp_pubsub_proto_init() + file_records_ps_records_kafka_proto_init() + file_records_ps_records_kubemq_proto_init() + file_records_ps_records_memphis_proto_init() + file_records_ps_records_mongo_proto_init() + file_records_ps_records_mqtt_proto_init() + file_records_ps_records_nats_proto_init() + file_records_ps_records_nats_jetstream_proto_init() + file_records_ps_records_nats_streaming_proto_init() + file_records_ps_records_nsq_proto_init() + file_records_ps_records_postgres_proto_init() + file_records_ps_records_pulsar_proto_init() + file_records_ps_records_rabbit_proto_init() + file_records_ps_records_rabbit_streams_proto_init() + file_records_ps_records_redis_pubsub_proto_init() + file_records_ps_records_redis_streams_proto_init() + if !protoimpl.UnsafeEnabled { + file_records_ps_records_base_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadRecord); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_records_ps_records_base_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteRecord); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_records_ps_records_base_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ErrorRecord); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_records_ps_records_base_proto_msgTypes[0].OneofWrappers = []interface{}{ (*ReadRecord_Kafka)(nil), (*ReadRecord_Rabbit)(nil), (*ReadRecord_Activemq)(nil), @@ -458,192 +912,22 @@ func (*ReadRecord) XXX_OneofWrappers() []interface{} { (*ReadRecord_AwsKinesis)(nil), (*ReadRecord_Memphis)(nil), } -} - -// Used as an arg for write requests (server & cli) -type WriteRecord struct { - // If encoding options are provided, this value will be updated by plumber - // to contain the encoded payload _before_ passing it to the backend. - // @gotags: kong:"help='Input string',name=input,xor=input,default" - Input string `protobuf:"bytes,1,opt,name=input,proto3" json:"input,omitempty" kong:"help='Input string',name=input,xor=input,default"` - // @gotags: kong:"help='Optional metadata a backend may use (key1=value,key2=value,etc)',name=input-metadata" - InputMetadata map[string]string `protobuf:"bytes,2,rep,name=input_metadata,json=inputMetadata,proto3" json:"input_metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" kong:"help='Optional metadata a backend may use (key1=value,key2=value,etc)',name=input-metadata"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *WriteRecord) Reset() { *m = WriteRecord{} } -func (m *WriteRecord) String() string { return proto.CompactTextString(m) } -func (*WriteRecord) ProtoMessage() {} -func (*WriteRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_79a95b759e1a93f6, []int{1} -} - -func (m *WriteRecord) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteRecord.Unmarshal(m, b) -} -func (m *WriteRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteRecord.Marshal(b, m, deterministic) -} -func (m *WriteRecord) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteRecord.Merge(m, src) -} -func (m *WriteRecord) XXX_Size() int { - return xxx_messageInfo_WriteRecord.Size(m) -} -func (m *WriteRecord) XXX_DiscardUnknown() { - xxx_messageInfo_WriteRecord.DiscardUnknown(m) -} - -var xxx_messageInfo_WriteRecord proto.InternalMessageInfo - -func (m *WriteRecord) GetInput() string { - if m != nil { - return m.Input - } - return "" -} - -func (m *WriteRecord) GetInputMetadata() map[string]string { - if m != nil { - return m.InputMetadata - } - return nil -} - -// Used for communicating errors that occur during a read, write, relay, etc. -type ErrorRecord struct { - OccurredAtUnixTsUtc int64 `protobuf:"varint,1,opt,name=occurred_at_unix_ts_utc,json=occurredAtUnixTsUtc,proto3" json:"occurred_at_unix_ts_utc,omitempty"` - Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` - Metadata map[string][]byte `protobuf:"bytes,3,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ErrorRecord) Reset() { *m = ErrorRecord{} } -func (m *ErrorRecord) String() string { return proto.CompactTextString(m) } -func (*ErrorRecord) ProtoMessage() {} -func (*ErrorRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_79a95b759e1a93f6, []int{2} -} - -func (m *ErrorRecord) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ErrorRecord.Unmarshal(m, b) -} -func (m *ErrorRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ErrorRecord.Marshal(b, m, deterministic) -} -func (m *ErrorRecord) XXX_Merge(src proto.Message) { - xxx_messageInfo_ErrorRecord.Merge(m, src) -} -func (m *ErrorRecord) XXX_Size() int { - return xxx_messageInfo_ErrorRecord.Size(m) -} -func (m *ErrorRecord) XXX_DiscardUnknown() { - xxx_messageInfo_ErrorRecord.DiscardUnknown(m) -} - -var xxx_messageInfo_ErrorRecord proto.InternalMessageInfo - -func (m *ErrorRecord) GetOccurredAtUnixTsUtc() int64 { - if m != nil { - return m.OccurredAtUnixTsUtc - } - return 0 -} - -func (m *ErrorRecord) GetError() string { - if m != nil { - return m.Error - } - return "" -} - -func (m *ErrorRecord) GetMetadata() map[string][]byte { - if m != nil { - return m.Metadata - } - return nil -} - -func init() { - proto.RegisterType((*ReadRecord)(nil), "protos.records.ReadRecord") - proto.RegisterMapType((map[string]string)(nil), "protos.records.ReadRecord.MetadataEntry") - proto.RegisterType((*WriteRecord)(nil), "protos.records.WriteRecord") - proto.RegisterMapType((map[string]string)(nil), "protos.records.WriteRecord.InputMetadataEntry") - proto.RegisterType((*ErrorRecord)(nil), "protos.records.ErrorRecord") - proto.RegisterMapType((map[string][]byte)(nil), "protos.records.ErrorRecord.MetadataEntry") -} - -func init() { proto.RegisterFile("records/ps_records_base.proto", fileDescriptor_79a95b759e1a93f6) } - -var fileDescriptor_79a95b759e1a93f6 = []byte{ - // 1037 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x96, 0x6b, 0x6f, 0x1b, 0x45, - 0x17, 0xc7, 0xed, 0x38, 0xd7, 0x71, 0x9c, 0xe7, 0x61, 0x1a, 0xc8, 0x60, 0x1a, 0x62, 0xc2, 0xa5, - 0xa6, 0x52, 0x6d, 0x68, 0x2b, 0x84, 0xca, 0x45, 0x4d, 0x4b, 0xe8, 0x86, 0x28, 0xc8, 0x59, 0x27, - 0xaa, 0xc4, 0x9b, 0xd5, 0xec, 0xee, 0xd4, 0xde, 0xda, 0x7b, 0xf1, 0x5c, 0xec, 0x84, 0x0f, 0xc1, - 0x27, 0xe2, 0xab, 0xf0, 0x1e, 0xbe, 0x05, 0x9a, 0xcb, 0xda, 0x6b, 0x7b, 0x1c, 0xd4, 0x57, 0xd9, - 0x99, 0xf3, 0x3b, 0x67, 0xce, 0x99, 0x33, 0xfe, 0x9f, 0x80, 0x43, 0x4a, 0x82, 0x94, 0x86, 0xac, - 0x9d, 0x31, 0xcf, 0x7c, 0x7a, 0x3e, 0x66, 0xa4, 0x95, 0xd1, 0x94, 0xa7, 0x70, 0x4f, 0xfd, 0x61, - 0x2d, 0x63, 0xaa, 0x7f, 0x62, 0xc1, 0x71, 0xc0, 0xa3, 0x31, 0x89, 0x47, 0xda, 0xa5, 0xfe, 0x99, - 0x0d, 0x99, 0x30, 0x6f, 0x10, 0x25, 0x84, 0x45, 0xcc, 0x50, 0x8d, 0x15, 0x14, 0x1b, 0xe5, 0x44, - 0xd3, 0x46, 0xfc, 0x2e, 0x28, 0xf1, 0xc8, 0x98, 0x24, 0xdc, 0xeb, 0x0b, 0xdf, 0x90, 0x0f, 0x57, - 0x92, 0x8c, 0xd0, 0x71, 0x14, 0x10, 0xcf, 0x17, 0x79, 0xd4, 0x4f, 0x2d, 0x6c, 0x2f, 0xc8, 0xbc, - 0x4c, 0xf8, 0x6c, 0x1a, 0xf0, 0x63, 0x0b, 0x34, 0xc0, 0x6f, 0x06, 0xd8, 0xd8, 0x8f, 0x6c, 0x76, - 0xe1, 0xcf, 0xee, 0xc0, 0x56, 0x5d, 0x4c, 0xe2, 0xac, 0x3f, 0xad, 0xdf, 0x76, 0x44, 0x9c, 0x26, - 0xbd, 0xd4, 0xd8, 0x6d, 0x7d, 0x89, 0x47, 0x9c, 0xdf, 0x61, 0x4e, 0x30, 0xcf, 0xa3, 0x3f, 0x58, - 0x61, 0xf6, 0xde, 0x12, 0xce, 0x38, 0x25, 0x38, 0xfe, 0x2f, 0x50, 0x53, 0x51, 0xd2, 0x33, 0xe0, - 0x7d, 0x1b, 0xc8, 0xf2, 0x7a, 0x6d, 0xcf, 0x22, 0x4b, 0x19, 0xef, 0x51, 0xc2, 0xee, 0xb8, 0xb3, - 0x4c, 0x0c, 0x19, 0xa6, 0x77, 0x00, 0x14, 0xfb, 0x7e, 0xc4, 0xef, 0xc8, 0x55, 0x03, 0x26, 0xdb, - 0xfc, 0xa8, 0xcf, 0x6d, 0x20, 0x09, 0x23, 0x36, 0xdf, 0xe5, 0x2f, 0x56, 0x62, 0x73, 0xe1, 0x8e, - 0xff, 0xd8, 0x05, 0xc0, 0x25, 0x38, 0x74, 0x15, 0x03, 0x0f, 0x01, 0x88, 0x09, 0x63, 0xb8, 0x47, - 0xbc, 0x28, 0x44, 0xe5, 0x46, 0xb9, 0xb9, 0xe3, 0xee, 0x98, 0x9d, 0xb3, 0x10, 0xfe, 0x1f, 0x54, - 0x12, 0x11, 0xa3, 0x4a, 0xa3, 0xdc, 0xac, 0xb8, 0xf2, 0x13, 0xfe, 0x04, 0xb6, 0x63, 0xc2, 0x71, - 0x88, 0x39, 0x46, 0xeb, 0x8d, 0x4a, 0xb3, 0xfa, 0xb8, 0xd9, 0x9a, 0xff, 0x59, 0xb5, 0x66, 0xe1, - 0x5b, 0x17, 0x06, 0x3d, 0x4d, 0x38, 0xbd, 0x75, 0xa7, 0x9e, 0xf0, 0x29, 0x38, 0xa0, 0x24, 0x20, - 0xd1, 0x98, 0x84, 0x1e, 0xe6, 0x9e, 0x48, 0xa2, 0x1b, 0x8f, 0x33, 0x4f, 0xf0, 0x00, 0x6d, 0xaa, - 0xb3, 0xee, 0xe5, 0xe6, 0x13, 0x7e, 0x9d, 0x44, 0x37, 0x57, 0xec, 0x9a, 0x07, 0x10, 0x81, 0xad, - 0x0c, 0xdf, 0x0e, 0x53, 0x1c, 0xa2, 0xa0, 0x51, 0x6e, 0xee, 0xba, 0xf9, 0x12, 0x3e, 0x02, 0x1b, - 0xea, 0x49, 0xa3, 0xb0, 0x51, 0x6e, 0x56, 0x1f, 0xbf, 0xbf, 0x98, 0xd2, 0xb9, 0x34, 0x3a, 0x25, - 0x57, 0x53, 0xf0, 0x2b, 0xb0, 0xa9, 0xef, 0x1a, 0x11, 0xc5, 0x7f, 0xb0, 0x54, 0x82, 0xb2, 0x3a, - 0x25, 0xd7, 0x70, 0xf0, 0x1b, 0xb0, 0x9d, 0x2b, 0x03, 0x7a, 0xa3, 0x7c, 0xd0, 0xa2, 0xcf, 0x89, - 0xb2, 0x5f, 0x5c, 0x3a, 0x25, 0x77, 0xca, 0xc2, 0xaf, 0xc1, 0x96, 0x11, 0x02, 0xd4, 0xb3, 0x1f, - 0x75, 0xf2, 0xba, 0xdb, 0xbd, 0xec, 0xca, 0xa3, 0xf0, 0x84, 0x75, 0x47, 0x0c, 0xbe, 0x02, 0xff, - 0x5b, 0x50, 0x06, 0xd4, 0x57, 0xae, 0x87, 0x4b, 0xae, 0x12, 0x3b, 0x95, 0x94, 0x23, 0x7c, 0xa7, - 0xe4, 0xd6, 0x70, 0x71, 0x03, 0x5e, 0x80, 0xf7, 0x96, 0x84, 0x03, 0x45, 0x2a, 0xd4, 0x91, 0x35, - 0x54, 0x57, 0x73, 0x2f, 0x04, 0x73, 0x4a, 0xae, 0x4e, 0x62, 0xb6, 0x05, 0x9f, 0x01, 0x30, 0xd3, - 0x16, 0xf4, 0x56, 0xc5, 0xf9, 0x70, 0x31, 0xce, 0xab, 0x97, 0x9d, 0x8e, 0xf0, 0xbb, 0x2a, 0x9d, - 0x9d, 0x5e, 0x90, 0x75, 0x14, 0x2d, 0x2f, 0x5c, 0x4b, 0x0a, 0x1a, 0xd8, 0x6f, 0xe1, 0x5c, 0xf8, - 0xfa, 0xea, 0x0c, 0x27, 0x3b, 0xaa, 0x14, 0x04, 0x0d, 0xed, 0x1d, 0xbd, 0x90, 0x46, 0xd9, 0x51, - 0x45, 0xc1, 0x87, 0x60, 0x5d, 0x0a, 0x0a, 0x8a, 0x15, 0xbd, 0xbf, 0x44, 0x5f, 0x5e, 0x5d, 0x39, - 0x25, 0x57, 0x31, 0x92, 0x95, 0xaa, 0x80, 0x12, 0x3b, 0xfb, 0x2b, 0xe6, 0xb2, 0x7e, 0xc5, 0xc0, - 0x9f, 0xc1, 0xde, 0xbc, 0x82, 0xa0, 0xd4, 0xde, 0x0b, 0xe9, 0xd5, 0xcd, 0x21, 0xd9, 0x8b, 0xa4, - 0xb8, 0x01, 0x1f, 0x80, 0x4a, 0xc2, 0x46, 0x28, 0x53, 0xce, 0xf7, 0x96, 0x9c, 0xbb, 0xb2, 0x74, - 0x49, 0xc8, 0x87, 0x96, 0x6b, 0x0d, 0x1a, 0xd9, 0x1f, 0x5a, 0xc7, 0xd8, 0xe5, 0x43, 0xcb, 0x59, - 0x79, 0xc3, 0x5a, 0x80, 0x10, 0xb5, 0xdf, 0x70, 0x47, 0x59, 0xe5, 0x0d, 0x6b, 0x4e, 0x96, 0x36, - 0x2f, 0x38, 0x88, 0xd9, 0x4b, 0xd3, 0x3f, 0x06, 0x5d, 0x8b, 0x3c, 0xb4, 0x46, 0x8b, 0x1b, 0xf0, - 0x39, 0xd8, 0x2d, 0xea, 0x11, 0xe2, 0x2a, 0xca, 0x47, 0xcb, 0xaa, 0x10, 0x46, 0x4c, 0x3f, 0x07, - 0xa7, 0xe4, 0x56, 0xe9, 0x6c, 0x09, 0x5f, 0x82, 0xda, 0x9c, 0x54, 0x21, 0xa1, 0x42, 0xdc, 0xb7, - 0x86, 0x98, 0xe5, 0xa1, 0x8f, 0xcd, 0xd3, 0xc8, 0x3b, 0x35, 0x1d, 0x0a, 0x68, 0xbc, 0xba, 0x53, - 0xbf, 0xe4, 0x50, 0xde, 0xa9, 0xe9, 0x06, 0xfc, 0x01, 0x54, 0x0b, 0x03, 0x1e, 0x4d, 0x54, 0x90, - 0xba, 0xe5, 0x57, 0x7b, 0xae, 0x09, 0xa7, 0xe4, 0x02, 0x3c, 0x61, 0x66, 0x05, 0x9f, 0x80, 0x2d, - 0x33, 0x1b, 0xd1, 0x8d, 0x72, 0x3d, 0x58, 0x7a, 0x8b, 0xda, 0xec, 0x94, 0xdc, 0x9c, 0x84, 0x10, - 0xac, 0x7b, 0x14, 0x4f, 0xd0, 0xdf, 0x5b, 0x4a, 0xd6, 0x2a, 0x2e, 0x9e, 0xc0, 0x23, 0x50, 0xf5, - 0xb2, 0xa1, 0x88, 0x7d, 0x42, 0xa5, 0x34, 0xff, 0xb3, 0xa5, 0xb5, 0xb9, 0xa3, 0xb7, 0xce, 0xc2, - 0xfa, 0x77, 0xa0, 0x36, 0x27, 0xaf, 0x52, 0xac, 0x07, 0xe4, 0xd6, 0x88, 0xb8, 0xfc, 0x84, 0xfb, - 0x60, 0x63, 0x8c, 0x87, 0x82, 0xa0, 0x35, 0xb5, 0xa7, 0x17, 0xcf, 0xd6, 0xbe, 0x2d, 0xbf, 0xd8, - 0x06, 0x9b, 0x5a, 0xa2, 0x8f, 0xff, 0x2c, 0x83, 0xea, 0x6b, 0x1a, 0x71, 0x62, 0x26, 0xc2, 0x3e, - 0xd8, 0x88, 0x92, 0x4c, 0x70, 0x13, 0x47, 0x2f, 0xe0, 0x35, 0xd8, 0x53, 0x1f, 0xde, 0x54, 0xfc, - 0xd7, 0x94, 0xf8, 0xb7, 0x16, 0xab, 0x2b, 0x84, 0x6a, 0x9d, 0x49, 0x8f, 0xf9, 0x11, 0x50, 0x8b, - 0x8a, 0x7b, 0xf5, 0xe7, 0x00, 0x2e, 0x43, 0xef, 0x52, 0xc8, 0xf1, 0x5f, 0x65, 0x50, 0x3d, 0xa5, - 0x34, 0xa5, 0x26, 0xfd, 0xa7, 0xe0, 0x20, 0x0d, 0x02, 0x41, 0xe9, 0xf2, 0x64, 0x29, 0xeb, 0xc9, - 0x92, 0x9b, 0x8b, 0x93, 0x65, 0x1f, 0x6c, 0x10, 0x19, 0x24, 0x8f, 0xaf, 0x16, 0xf0, 0xb4, 0x30, - 0xeb, 0x2a, 0xaa, 0xdc, 0x2f, 0x17, 0xcb, 0x2d, 0x1c, 0xbd, 0x6a, 0xd8, 0xbd, 0x73, 0xa3, 0x76, - 0x8b, 0x8d, 0xfa, 0xf1, 0xb7, 0xef, 0x7b, 0x11, 0x97, 0xff, 0x1e, 0x06, 0x69, 0xdc, 0xf6, 0x31, - 0x0f, 0xfa, 0x41, 0x4a, 0xb3, 0xb6, 0x79, 0x1a, 0x8f, 0x58, 0xd0, 0x27, 0x31, 0x66, 0x6d, 0x5f, - 0x44, 0xc3, 0xb0, 0xdd, 0x4b, 0xdb, 0x3a, 0xc1, 0xb6, 0x49, 0xd0, 0xdf, 0x54, 0xeb, 0x27, 0xff, - 0x06, 0x00, 0x00, 0xff, 0xff, 0x1f, 0x9b, 0x97, 0x55, 0x1b, 0x0b, 0x00, 0x00, + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_records_ps_records_base_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_records_ps_records_base_proto_goTypes, + DependencyIndexes: file_records_ps_records_base_proto_depIdxs, + MessageInfos: file_records_ps_records_base_proto_msgTypes, + }.Build() + File_records_ps_records_base_proto = out.File + file_records_ps_records_base_proto_rawDesc = nil + file_records_ps_records_base_proto_goTypes = nil + file_records_ps_records_base_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_gcp_pubsub.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_gcp_pubsub.pb.go index c3a1b9f21..dcbe1fa08 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_gcp_pubsub.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_gcp_pubsub.pb.go @@ -1,133 +1,205 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: records/ps_records_gcp_pubsub.proto package records import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type GCPPubSub struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - Attributes map[string]string `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - PublishTime int64 `protobuf:"varint,4,opt,name=publish_time,json=publishTime,proto3" json:"publish_time,omitempty"` - DeliveryAttempt int32 `protobuf:"varint,5,opt,name=delivery_attempt,json=deliveryAttempt,proto3" json:"delivery_attempt,omitempty"` - OrderingKey string `protobuf:"bytes,6,opt,name=ordering_key,json=orderingKey,proto3" json:"ordering_key,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GCPPubSub) Reset() { *m = GCPPubSub{} } -func (m *GCPPubSub) String() string { return proto.CompactTextString(m) } -func (*GCPPubSub) ProtoMessage() {} -func (*GCPPubSub) Descriptor() ([]byte, []int) { - return fileDescriptor_dedd412ecdc9a877, []int{0} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Attributes map[string]string `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + PublishTime int64 `protobuf:"varint,4,opt,name=publish_time,json=publishTime,proto3" json:"publish_time,omitempty"` + DeliveryAttempt int32 `protobuf:"varint,5,opt,name=delivery_attempt,json=deliveryAttempt,proto3" json:"delivery_attempt,omitempty"` + OrderingKey string `protobuf:"bytes,6,opt,name=ordering_key,json=orderingKey,proto3" json:"ordering_key,omitempty"` +} + +func (x *GCPPubSub) Reset() { + *x = GCPPubSub{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_gcp_pubsub_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *GCPPubSub) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GCPPubSub.Unmarshal(m, b) -} -func (m *GCPPubSub) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GCPPubSub.Marshal(b, m, deterministic) -} -func (m *GCPPubSub) XXX_Merge(src proto.Message) { - xxx_messageInfo_GCPPubSub.Merge(m, src) +func (x *GCPPubSub) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *GCPPubSub) XXX_Size() int { - return xxx_messageInfo_GCPPubSub.Size(m) -} -func (m *GCPPubSub) XXX_DiscardUnknown() { - xxx_messageInfo_GCPPubSub.DiscardUnknown(m) + +func (*GCPPubSub) ProtoMessage() {} + +func (x *GCPPubSub) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_gcp_pubsub_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_GCPPubSub proto.InternalMessageInfo +// Deprecated: Use GCPPubSub.ProtoReflect.Descriptor instead. +func (*GCPPubSub) Descriptor() ([]byte, []int) { + return file_records_ps_records_gcp_pubsub_proto_rawDescGZIP(), []int{0} +} -func (m *GCPPubSub) GetId() string { - if m != nil { - return m.Id +func (x *GCPPubSub) GetId() string { + if x != nil { + return x.Id } return "" } -func (m *GCPPubSub) GetValue() []byte { - if m != nil { - return m.Value +func (x *GCPPubSub) GetValue() []byte { + if x != nil { + return x.Value } return nil } -func (m *GCPPubSub) GetAttributes() map[string]string { - if m != nil { - return m.Attributes +func (x *GCPPubSub) GetAttributes() map[string]string { + if x != nil { + return x.Attributes } return nil } -func (m *GCPPubSub) GetPublishTime() int64 { - if m != nil { - return m.PublishTime +func (x *GCPPubSub) GetPublishTime() int64 { + if x != nil { + return x.PublishTime } return 0 } -func (m *GCPPubSub) GetDeliveryAttempt() int32 { - if m != nil { - return m.DeliveryAttempt +func (x *GCPPubSub) GetDeliveryAttempt() int32 { + if x != nil { + return x.DeliveryAttempt } return 0 } -func (m *GCPPubSub) GetOrderingKey() string { - if m != nil { - return m.OrderingKey +func (x *GCPPubSub) GetOrderingKey() string { + if x != nil { + return x.OrderingKey } return "" } -func init() { - proto.RegisterType((*GCPPubSub)(nil), "protos.records.GCPPubSub") - proto.RegisterMapType((map[string]string)(nil), "protos.records.GCPPubSub.AttributesEntry") -} - -func init() { - proto.RegisterFile("records/ps_records_gcp_pubsub.proto", fileDescriptor_dedd412ecdc9a877) -} - -var fileDescriptor_dedd412ecdc9a877 = []byte{ - // 306 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0x4f, 0x4b, 0xc3, 0x30, - 0x18, 0xc6, 0x69, 0xeb, 0x06, 0xcb, 0xc6, 0x36, 0x82, 0x87, 0xe2, 0xa9, 0xea, 0xa5, 0x3b, 0xd8, - 0x80, 0x5e, 0x44, 0x54, 0x98, 0x22, 0x22, 0x5e, 0x46, 0xf5, 0xe4, 0xa5, 0x34, 0xc9, 0x4b, 0x1b, - 0x6c, 0x96, 0x90, 0x3f, 0x83, 0x7e, 0x27, 0x3f, 0xa4, 0x6c, 0xed, 0x86, 0xf3, 0x94, 0xf7, 0x7d, - 0x78, 0xf2, 0xf0, 0xfe, 0x1e, 0x74, 0x69, 0x80, 0x29, 0xc3, 0x2d, 0xd1, 0xb6, 0xe8, 0xc7, 0xa2, - 0x62, 0xba, 0xd0, 0x9e, 0x5a, 0x4f, 0x33, 0x6d, 0x94, 0x53, 0x78, 0xba, 0x7b, 0x6c, 0xd6, 0x1b, - 0x2e, 0x7e, 0x42, 0x34, 0x7a, 0x7d, 0x5e, 0xad, 0x3c, 0xfd, 0xf0, 0x14, 0x4f, 0x51, 0x28, 0x78, - 0x1c, 0x24, 0x41, 0x3a, 0xca, 0x43, 0xc1, 0xf1, 0x29, 0x1a, 0x6c, 0xca, 0xc6, 0x43, 0x1c, 0x26, - 0x41, 0x3a, 0xc9, 0xbb, 0x05, 0xbf, 0x21, 0x54, 0x3a, 0x67, 0x04, 0xf5, 0x0e, 0x6c, 0x1c, 0x25, - 0x51, 0x3a, 0xbe, 0x5e, 0x64, 0xc7, 0xc1, 0xd9, 0x21, 0x34, 0x5b, 0x1e, 0xbc, 0x2f, 0x6b, 0x67, - 0xda, 0xfc, 0xcf, 0x67, 0x7c, 0x8e, 0x26, 0xda, 0xd3, 0x46, 0xd8, 0xba, 0x70, 0x42, 0x42, 0x7c, - 0x92, 0x04, 0x69, 0x94, 0x8f, 0x7b, 0xed, 0x53, 0x48, 0xc0, 0x0b, 0x34, 0xe7, 0xd0, 0x88, 0x0d, - 0x98, 0xb6, 0x28, 0x9d, 0x03, 0xa9, 0x5d, 0x3c, 0x48, 0x82, 0x74, 0x90, 0xcf, 0xf6, 0xfa, 0xb2, - 0x93, 0xb7, 0x69, 0xca, 0x70, 0x30, 0x62, 0x5d, 0x15, 0xdf, 0xd0, 0xc6, 0xc3, 0x1d, 0xc8, 0x78, - 0xaf, 0xbd, 0x43, 0x7b, 0xf6, 0x80, 0x66, 0xff, 0xee, 0xc1, 0x73, 0x14, 0x6d, 0xcd, 0x1d, 0xf5, - 0x76, 0x3c, 0xc6, 0x1e, 0xf5, 0xd8, 0x77, 0xe1, 0x6d, 0xf0, 0xf4, 0xf8, 0x75, 0x5f, 0x09, 0x57, - 0x7b, 0x9a, 0x31, 0x25, 0x09, 0x2d, 0x1d, 0xab, 0x99, 0x32, 0x9a, 0xe8, 0xc6, 0x4b, 0x0a, 0xe6, - 0xca, 0xb2, 0x1a, 0x64, 0x69, 0x09, 0xf5, 0xa2, 0xe1, 0xa4, 0x52, 0xa4, 0x6b, 0x85, 0xf4, 0xad, - 0xd0, 0xe1, 0x6e, 0xbf, 0xf9, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x8b, 0x1e, 0xfb, 0x7b, 0xac, 0x01, - 0x00, 0x00, +var File_records_ps_records_gcp_pubsub_proto protoreflect.FileDescriptor + +var file_records_ps_records_gcp_pubsub_proto_rawDesc = []byte{ + 0x0a, 0x23, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x67, 0x63, 0x70, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0xac, 0x02, 0x0a, 0x09, 0x47, 0x43, 0x50, 0x50, 0x75, 0x62, + 0x53, 0x75, 0x62, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x49, 0x0a, 0x0a, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x47, + 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x5f, + 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x70, 0x75, 0x62, 0x6c, + 0x69, 0x73, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x64, 0x65, 0x6c, 0x69, 0x76, + 0x65, 0x72, 0x79, 0x5f, 0x61, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x0f, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x41, 0x74, 0x74, 0x65, 0x6d, + 0x70, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6b, + 0x65, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x69, + 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x1a, 0x3d, 0x0a, 0x0f, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, + 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_records_ps_records_gcp_pubsub_proto_rawDescOnce sync.Once + file_records_ps_records_gcp_pubsub_proto_rawDescData = file_records_ps_records_gcp_pubsub_proto_rawDesc +) + +func file_records_ps_records_gcp_pubsub_proto_rawDescGZIP() []byte { + file_records_ps_records_gcp_pubsub_proto_rawDescOnce.Do(func() { + file_records_ps_records_gcp_pubsub_proto_rawDescData = protoimpl.X.CompressGZIP(file_records_ps_records_gcp_pubsub_proto_rawDescData) + }) + return file_records_ps_records_gcp_pubsub_proto_rawDescData +} + +var file_records_ps_records_gcp_pubsub_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_records_ps_records_gcp_pubsub_proto_goTypes = []interface{}{ + (*GCPPubSub)(nil), // 0: protos.records.GCPPubSub + nil, // 1: protos.records.GCPPubSub.AttributesEntry +} +var file_records_ps_records_gcp_pubsub_proto_depIdxs = []int32{ + 1, // 0: protos.records.GCPPubSub.attributes:type_name -> protos.records.GCPPubSub.AttributesEntry + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_records_ps_records_gcp_pubsub_proto_init() } +func file_records_ps_records_gcp_pubsub_proto_init() { + if File_records_ps_records_gcp_pubsub_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_records_ps_records_gcp_pubsub_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GCPPubSub); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_records_ps_records_gcp_pubsub_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_records_ps_records_gcp_pubsub_proto_goTypes, + DependencyIndexes: file_records_ps_records_gcp_pubsub_proto_depIdxs, + MessageInfos: file_records_ps_records_gcp_pubsub_proto_msgTypes, + }.Build() + File_records_ps_records_gcp_pubsub_proto = out.File + file_records_ps_records_gcp_pubsub_proto_rawDesc = nil + file_records_ps_records_gcp_pubsub_proto_goTypes = nil + file_records_ps_records_gcp_pubsub_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_kafka.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_kafka.pb.go index 058301683..fb5624a7c 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_kafka.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_kafka.pb.go @@ -1,183 +1,278 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: records/ps_records_kafka.proto package records import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type KafkaHeader struct { - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *KafkaHeader) Reset() { *m = KafkaHeader{} } -func (m *KafkaHeader) String() string { return proto.CompactTextString(m) } -func (*KafkaHeader) ProtoMessage() {} -func (*KafkaHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_47b9f8fc5ac029c9, []int{0} + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` } -func (m *KafkaHeader) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_KafkaHeader.Unmarshal(m, b) -} -func (m *KafkaHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_KafkaHeader.Marshal(b, m, deterministic) -} -func (m *KafkaHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_KafkaHeader.Merge(m, src) +func (x *KafkaHeader) Reset() { + *x = KafkaHeader{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_kafka_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *KafkaHeader) XXX_Size() int { - return xxx_messageInfo_KafkaHeader.Size(m) + +func (x *KafkaHeader) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *KafkaHeader) XXX_DiscardUnknown() { - xxx_messageInfo_KafkaHeader.DiscardUnknown(m) + +func (*KafkaHeader) ProtoMessage() {} + +func (x *KafkaHeader) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_kafka_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_KafkaHeader proto.InternalMessageInfo +// Deprecated: Use KafkaHeader.ProtoReflect.Descriptor instead. +func (*KafkaHeader) Descriptor() ([]byte, []int) { + return file_records_ps_records_kafka_proto_rawDescGZIP(), []int{0} +} -func (m *KafkaHeader) GetKey() string { - if m != nil { - return m.Key +func (x *KafkaHeader) GetKey() string { + if x != nil { + return x.Key } return "" } -func (m *KafkaHeader) GetValue() string { - if m != nil { - return m.Value +func (x *KafkaHeader) GetValue() string { + if x != nil { + return x.Value } return "" } type Kafka struct { - Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"` - Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` - Timestamp int64 `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Offset int64 `protobuf:"varint,5,opt,name=offset,proto3" json:"offset,omitempty"` - Partition int32 `protobuf:"varint,6,opt,name=partition,proto3" json:"partition,omitempty"` - Headers []*KafkaHeader `protobuf:"bytes,7,rep,name=headers,proto3" json:"headers,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Kafka) Reset() { *m = Kafka{} } -func (m *Kafka) String() string { return proto.CompactTextString(m) } -func (*Kafka) ProtoMessage() {} -func (*Kafka) Descriptor() ([]byte, []int) { - return fileDescriptor_47b9f8fc5ac029c9, []int{1} -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *Kafka) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Kafka.Unmarshal(m, b) -} -func (m *Kafka) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Kafka.Marshal(b, m, deterministic) + Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + Timestamp int64 `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Offset int64 `protobuf:"varint,5,opt,name=offset,proto3" json:"offset,omitempty"` + Partition int32 `protobuf:"varint,6,opt,name=partition,proto3" json:"partition,omitempty"` + Headers []*KafkaHeader `protobuf:"bytes,7,rep,name=headers,proto3" json:"headers,omitempty"` } -func (m *Kafka) XXX_Merge(src proto.Message) { - xxx_messageInfo_Kafka.Merge(m, src) + +func (x *Kafka) Reset() { + *x = Kafka{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_kafka_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Kafka) XXX_Size() int { - return xxx_messageInfo_Kafka.Size(m) + +func (x *Kafka) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Kafka) XXX_DiscardUnknown() { - xxx_messageInfo_Kafka.DiscardUnknown(m) + +func (*Kafka) ProtoMessage() {} + +func (x *Kafka) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_kafka_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_Kafka proto.InternalMessageInfo +// Deprecated: Use Kafka.ProtoReflect.Descriptor instead. +func (*Kafka) Descriptor() ([]byte, []int) { + return file_records_ps_records_kafka_proto_rawDescGZIP(), []int{1} +} -func (m *Kafka) GetTopic() string { - if m != nil { - return m.Topic +func (x *Kafka) GetTopic() string { + if x != nil { + return x.Topic } return "" } -func (m *Kafka) GetKey() []byte { - if m != nil { - return m.Key +func (x *Kafka) GetKey() []byte { + if x != nil { + return x.Key } return nil } -func (m *Kafka) GetValue() []byte { - if m != nil { - return m.Value +func (x *Kafka) GetValue() []byte { + if x != nil { + return x.Value } return nil } -func (m *Kafka) GetTimestamp() int64 { - if m != nil { - return m.Timestamp +func (x *Kafka) GetTimestamp() int64 { + if x != nil { + return x.Timestamp } return 0 } -func (m *Kafka) GetOffset() int64 { - if m != nil { - return m.Offset +func (x *Kafka) GetOffset() int64 { + if x != nil { + return x.Offset } return 0 } -func (m *Kafka) GetPartition() int32 { - if m != nil { - return m.Partition +func (x *Kafka) GetPartition() int32 { + if x != nil { + return x.Partition } return 0 } -func (m *Kafka) GetHeaders() []*KafkaHeader { - if m != nil { - return m.Headers +func (x *Kafka) GetHeaders() []*KafkaHeader { + if x != nil { + return x.Headers } return nil } -func init() { - proto.RegisterType((*KafkaHeader)(nil), "protos.records.KafkaHeader") - proto.RegisterType((*Kafka)(nil), "protos.records.Kafka") -} - -func init() { proto.RegisterFile("records/ps_records_kafka.proto", fileDescriptor_47b9f8fc5ac029c9) } - -var fileDescriptor_47b9f8fc5ac029c9 = []byte{ - // 263 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x8f, 0xc1, 0x4a, 0xf4, 0x30, - 0x1c, 0xc4, 0xc9, 0xd7, 0xaf, 0x5d, 0x36, 0x2b, 0x22, 0x41, 0x24, 0xa0, 0x48, 0xd9, 0x53, 0x2f, - 0x26, 0xa0, 0xec, 0x4d, 0x3c, 0x78, 0x12, 0xbc, 0xf5, 0xe8, 0x65, 0x49, 0xd2, 0x74, 0x1b, 0xda, - 0x98, 0x90, 0xa4, 0x82, 0x6f, 0xe9, 0x23, 0x49, 0xd2, 0x2c, 0xab, 0x9e, 0xf2, 0xff, 0xcd, 0x64, - 0x06, 0x06, 0xde, 0x3a, 0x29, 0x8c, 0xeb, 0x3c, 0xb5, 0x7e, 0x9f, 0xcf, 0xfd, 0xc8, 0xfa, 0x91, - 0x11, 0xeb, 0x4c, 0x30, 0xe8, 0x3c, 0x3d, 0x9e, 0x64, 0x6f, 0xbb, 0x83, 0x9b, 0xd7, 0x68, 0xbf, - 0x48, 0xd6, 0x49, 0x87, 0x2e, 0x60, 0x31, 0xca, 0x4f, 0x0c, 0x6a, 0xd0, 0xac, 0xdb, 0x78, 0xa2, - 0x4b, 0x58, 0x7e, 0xb0, 0x69, 0x96, 0xf8, 0x5f, 0xd2, 0x16, 0xd8, 0x7e, 0x01, 0x58, 0xa6, 0x5c, - 0xf4, 0x83, 0xb1, 0x4a, 0xe4, 0xcc, 0x02, 0xc7, 0x9e, 0x98, 0x39, 0xfb, 0xd3, 0x53, 0x24, 0x6d, - 0x01, 0x74, 0x03, 0xd7, 0x41, 0x69, 0xe9, 0x03, 0xd3, 0x16, 0xff, 0xaf, 0x41, 0x53, 0xb4, 0x27, - 0x01, 0x5d, 0xc1, 0xca, 0xf4, 0xbd, 0x97, 0x01, 0x97, 0xc9, 0xca, 0x14, 0x53, 0x96, 0xb9, 0xa0, - 0x82, 0x32, 0xef, 0xb8, 0xaa, 0x41, 0x53, 0xb6, 0x27, 0x01, 0xed, 0xe0, 0x6a, 0x48, 0x6b, 0x3c, - 0x5e, 0xd5, 0x45, 0xb3, 0xb9, 0xbf, 0x26, 0xbf, 0x47, 0x93, 0x1f, 0x8b, 0xdb, 0xe3, 0xdf, 0xe7, - 0xa7, 0xb7, 0xc7, 0x83, 0x0a, 0xc3, 0xcc, 0x89, 0x30, 0x9a, 0x72, 0x16, 0xc4, 0x20, 0x8c, 0xb3, - 0xd4, 0x4e, 0xb3, 0xe6, 0xd2, 0xdd, 0x79, 0x31, 0x48, 0xcd, 0x3c, 0xe5, 0xb3, 0x9a, 0x3a, 0x7a, - 0x30, 0x74, 0x29, 0xa5, 0xb9, 0x94, 0x57, 0x89, 0x1f, 0xbe, 0x03, 0x00, 0x00, 0xff, 0xff, 0x79, - 0x84, 0x8b, 0x95, 0x82, 0x01, 0x00, 0x00, +var File_records_ps_records_kafka_proto protoreflect.FileDescriptor + +var file_records_ps_records_kafka_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, + 0x22, 0x35, 0x0a, 0x0b, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xd0, 0x01, 0x0a, 0x05, 0x4b, 0x61, 0x66, 0x6b, + 0x61, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, + 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x16, 0x0a, + 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x35, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x07, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, + 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_records_ps_records_kafka_proto_rawDescOnce sync.Once + file_records_ps_records_kafka_proto_rawDescData = file_records_ps_records_kafka_proto_rawDesc +) + +func file_records_ps_records_kafka_proto_rawDescGZIP() []byte { + file_records_ps_records_kafka_proto_rawDescOnce.Do(func() { + file_records_ps_records_kafka_proto_rawDescData = protoimpl.X.CompressGZIP(file_records_ps_records_kafka_proto_rawDescData) + }) + return file_records_ps_records_kafka_proto_rawDescData +} + +var file_records_ps_records_kafka_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_records_ps_records_kafka_proto_goTypes = []interface{}{ + (*KafkaHeader)(nil), // 0: protos.records.KafkaHeader + (*Kafka)(nil), // 1: protos.records.Kafka +} +var file_records_ps_records_kafka_proto_depIdxs = []int32{ + 0, // 0: protos.records.Kafka.headers:type_name -> protos.records.KafkaHeader + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_records_ps_records_kafka_proto_init() } +func file_records_ps_records_kafka_proto_init() { + if File_records_ps_records_kafka_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_records_ps_records_kafka_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KafkaHeader); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_records_ps_records_kafka_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Kafka); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_records_ps_records_kafka_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_records_ps_records_kafka_proto_goTypes, + DependencyIndexes: file_records_ps_records_kafka_proto_depIdxs, + MessageInfos: file_records_ps_records_kafka_proto_msgTypes, + }.Build() + File_records_ps_records_kafka_proto = out.File + file_records_ps_records_kafka_proto_rawDesc = nil + file_records_ps_records_kafka_proto_goTypes = nil + file_records_ps_records_kafka_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_kubemq.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_kubemq.pb.go index 23a44d7a6..76100d15a 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_kubemq.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_kubemq.pb.go @@ -1,125 +1,194 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: records/ps_records_kubemq.proto package records import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type KubeMQ struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` - Channel string `protobuf:"bytes,3,opt,name=channel,proto3" json:"channel,omitempty"` - Value []byte `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` - Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Sequence int64 `protobuf:"varint,6,opt,name=sequence,proto3" json:"sequence,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *KubeMQ) Reset() { *m = KubeMQ{} } -func (m *KubeMQ) String() string { return proto.CompactTextString(m) } -func (*KubeMQ) ProtoMessage() {} -func (*KubeMQ) Descriptor() ([]byte, []int) { - return fileDescriptor_6d0acba9d30f7b86, []int{0} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + Channel string `protobuf:"bytes,3,opt,name=channel,proto3" json:"channel,omitempty"` + Value []byte `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` + Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Sequence int64 `protobuf:"varint,6,opt,name=sequence,proto3" json:"sequence,omitempty"` } -func (m *KubeMQ) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_KubeMQ.Unmarshal(m, b) -} -func (m *KubeMQ) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_KubeMQ.Marshal(b, m, deterministic) -} -func (m *KubeMQ) XXX_Merge(src proto.Message) { - xxx_messageInfo_KubeMQ.Merge(m, src) +func (x *KubeMQ) Reset() { + *x = KubeMQ{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_kubemq_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *KubeMQ) XXX_Size() int { - return xxx_messageInfo_KubeMQ.Size(m) + +func (x *KubeMQ) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *KubeMQ) XXX_DiscardUnknown() { - xxx_messageInfo_KubeMQ.DiscardUnknown(m) + +func (*KubeMQ) ProtoMessage() {} + +func (x *KubeMQ) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_kubemq_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_KubeMQ proto.InternalMessageInfo +// Deprecated: Use KubeMQ.ProtoReflect.Descriptor instead. +func (*KubeMQ) Descriptor() ([]byte, []int) { + return file_records_ps_records_kubemq_proto_rawDescGZIP(), []int{0} +} -func (m *KubeMQ) GetId() string { - if m != nil { - return m.Id +func (x *KubeMQ) GetId() string { + if x != nil { + return x.Id } return "" } -func (m *KubeMQ) GetClientId() string { - if m != nil { - return m.ClientId +func (x *KubeMQ) GetClientId() string { + if x != nil { + return x.ClientId } return "" } -func (m *KubeMQ) GetChannel() string { - if m != nil { - return m.Channel +func (x *KubeMQ) GetChannel() string { + if x != nil { + return x.Channel } return "" } -func (m *KubeMQ) GetValue() []byte { - if m != nil { - return m.Value +func (x *KubeMQ) GetValue() []byte { + if x != nil { + return x.Value } return nil } -func (m *KubeMQ) GetTimestamp() int64 { - if m != nil { - return m.Timestamp +func (x *KubeMQ) GetTimestamp() int64 { + if x != nil { + return x.Timestamp } return 0 } -func (m *KubeMQ) GetSequence() int64 { - if m != nil { - return m.Sequence +func (x *KubeMQ) GetSequence() int64 { + if x != nil { + return x.Sequence } return 0 } -func init() { - proto.RegisterType((*KubeMQ)(nil), "protos.records.KubeMQ") -} - -func init() { proto.RegisterFile("records/ps_records_kubemq.proto", fileDescriptor_6d0acba9d30f7b86) } - -var fileDescriptor_6d0acba9d30f7b86 = []byte{ - // 229 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x8f, 0x3f, 0x4b, 0xc5, 0x30, - 0x14, 0x47, 0x49, 0x9f, 0xaf, 0xbe, 0x06, 0x79, 0x43, 0x70, 0x08, 0x2a, 0x58, 0x9c, 0xba, 0xd8, - 0x0c, 0xae, 0xe2, 0xe0, 0x26, 0xe2, 0x60, 0x47, 0x97, 0x92, 0x3f, 0x97, 0xd7, 0x60, 0xd2, 0xa4, - 0xf9, 0xe3, 0xd7, 0xf1, 0xab, 0x0a, 0x69, 0xd5, 0xe9, 0xde, 0x73, 0xce, 0xf4, 0xc3, 0xb7, 0x01, - 0xa4, 0x0b, 0x2a, 0x32, 0x1f, 0xc7, 0xed, 0x1d, 0x3f, 0xb3, 0x00, 0xbb, 0xf4, 0x3e, 0xb8, 0xe4, - 0xc8, 0xb1, 0x9c, 0xd8, 0x6f, 0xf1, 0xee, 0x1b, 0xe1, 0xfa, 0x35, 0x0b, 0x78, 0x7b, 0x27, 0x47, - 0x5c, 0x69, 0x45, 0x51, 0x8b, 0xba, 0x66, 0xa8, 0xb4, 0x22, 0xd7, 0xb8, 0x91, 0x46, 0xc3, 0x9c, - 0x46, 0xad, 0x68, 0x55, 0xf4, 0x61, 0x15, 0x2f, 0x8a, 0x50, 0x7c, 0x2e, 0x27, 0x3e, 0xcf, 0x60, - 0xe8, 0xae, 0xa4, 0x5f, 0x24, 0x97, 0x78, 0xff, 0xc5, 0x4d, 0x06, 0x7a, 0xd6, 0xa2, 0xee, 0x62, - 0x58, 0x81, 0xdc, 0xe0, 0x26, 0x69, 0x0b, 0x31, 0x71, 0xeb, 0xe9, 0xbe, 0x45, 0xdd, 0x6e, 0xf8, - 0x17, 0xe4, 0x0a, 0x1f, 0x22, 0x2c, 0x19, 0x66, 0x09, 0xb4, 0x2e, 0xf1, 0x8f, 0x9f, 0x9f, 0x3e, - 0x1e, 0x4f, 0x3a, 0x4d, 0x59, 0xf4, 0xd2, 0x59, 0x26, 0x78, 0x92, 0x93, 0x74, 0xc1, 0x33, 0x6f, - 0xb2, 0x15, 0x10, 0xee, 0xa3, 0x9c, 0xc0, 0xf2, 0xc8, 0x44, 0xd6, 0x46, 0xb1, 0x93, 0x63, 0xeb, - 0x42, 0xb6, 0x2d, 0x14, 0x75, 0xe1, 0x87, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x32, 0xc8, 0x87, - 0xa6, 0x1b, 0x01, 0x00, 0x00, +var File_records_ps_records_kubemq_proto protoreflect.FileDescriptor + +var file_records_ps_records_kubemq_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x73, 0x22, 0x9f, 0x01, 0x0a, 0x06, 0x4b, 0x75, 0x62, 0x65, 0x4d, 0x51, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x09, + 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, + 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, + 0x6e, 0x65, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, + 0x6e, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, + 0x6e, 0x63, 0x65, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, + 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x72, 0x65, 0x63, 0x6f, + 0x72, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_records_ps_records_kubemq_proto_rawDescOnce sync.Once + file_records_ps_records_kubemq_proto_rawDescData = file_records_ps_records_kubemq_proto_rawDesc +) + +func file_records_ps_records_kubemq_proto_rawDescGZIP() []byte { + file_records_ps_records_kubemq_proto_rawDescOnce.Do(func() { + file_records_ps_records_kubemq_proto_rawDescData = protoimpl.X.CompressGZIP(file_records_ps_records_kubemq_proto_rawDescData) + }) + return file_records_ps_records_kubemq_proto_rawDescData +} + +var file_records_ps_records_kubemq_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_records_ps_records_kubemq_proto_goTypes = []interface{}{ + (*KubeMQ)(nil), // 0: protos.records.KubeMQ +} +var file_records_ps_records_kubemq_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_records_ps_records_kubemq_proto_init() } +func file_records_ps_records_kubemq_proto_init() { + if File_records_ps_records_kubemq_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_records_ps_records_kubemq_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KubeMQ); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_records_ps_records_kubemq_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_records_ps_records_kubemq_proto_goTypes, + DependencyIndexes: file_records_ps_records_kubemq_proto_depIdxs, + MessageInfos: file_records_ps_records_kubemq_proto_msgTypes, + }.Build() + File_records_ps_records_kubemq_proto = out.File + file_records_ps_records_kubemq_proto_rawDesc = nil + file_records_ps_records_kubemq_proto_goTypes = nil + file_records_ps_records_kubemq_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_memphis.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_memphis.pb.go index e14b73eff..59cff4b11 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_memphis.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_memphis.pb.go @@ -1,89 +1,156 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: records/ps_records_memphis.proto package records import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type Memphis struct { - Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` - Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *Memphis) Reset() { *m = Memphis{} } -func (m *Memphis) String() string { return proto.CompactTextString(m) } -func (*Memphis) ProtoMessage() {} -func (*Memphis) Descriptor() ([]byte, []int) { - return fileDescriptor_a46e1af7e3cd2587, []int{0} + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` } -func (m *Memphis) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Memphis.Unmarshal(m, b) -} -func (m *Memphis) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Memphis.Marshal(b, m, deterministic) -} -func (m *Memphis) XXX_Merge(src proto.Message) { - xxx_messageInfo_Memphis.Merge(m, src) +func (x *Memphis) Reset() { + *x = Memphis{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_memphis_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Memphis) XXX_Size() int { - return xxx_messageInfo_Memphis.Size(m) + +func (x *Memphis) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Memphis) XXX_DiscardUnknown() { - xxx_messageInfo_Memphis.DiscardUnknown(m) + +func (*Memphis) ProtoMessage() {} + +func (x *Memphis) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_memphis_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_Memphis proto.InternalMessageInfo +// Deprecated: Use Memphis.ProtoReflect.Descriptor instead. +func (*Memphis) Descriptor() ([]byte, []int) { + return file_records_ps_records_memphis_proto_rawDescGZIP(), []int{0} +} -func (m *Memphis) GetValue() []byte { - if m != nil { - return m.Value +func (x *Memphis) GetValue() []byte { + if x != nil { + return x.Value } return nil } -func (m *Memphis) GetTimestamp() int64 { - if m != nil { - return m.Timestamp +func (x *Memphis) GetTimestamp() int64 { + if x != nil { + return x.Timestamp } return 0 } -func init() { - proto.RegisterType((*Memphis)(nil), "protos.records.Memphis") +var File_records_ps_records_memphis_proto protoreflect.FileDescriptor + +var file_records_ps_records_memphis_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x6d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x73, 0x22, 0x3d, 0x0a, 0x07, 0x4d, 0x65, 0x6d, 0x70, 0x68, 0x69, 0x73, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, + 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_records_ps_records_memphis_proto_rawDescOnce sync.Once + file_records_ps_records_memphis_proto_rawDescData = file_records_ps_records_memphis_proto_rawDesc +) + +func file_records_ps_records_memphis_proto_rawDescGZIP() []byte { + file_records_ps_records_memphis_proto_rawDescOnce.Do(func() { + file_records_ps_records_memphis_proto_rawDescData = protoimpl.X.CompressGZIP(file_records_ps_records_memphis_proto_rawDescData) + }) + return file_records_ps_records_memphis_proto_rawDescData } -func init() { proto.RegisterFile("records/ps_records_memphis.proto", fileDescriptor_a46e1af7e3cd2587) } - -var fileDescriptor_a46e1af7e3cd2587 = []byte{ - // 167 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x8d, 0x31, 0x0b, 0xc2, 0x30, - 0x10, 0x85, 0xa9, 0xa2, 0x62, 0x10, 0x87, 0xe2, 0xd0, 0xc1, 0xa1, 0x38, 0x75, 0xb1, 0x37, 0xb8, - 0xaa, 0x83, 0xbb, 0x4b, 0x47, 0x97, 0x92, 0xa4, 0xa1, 0x09, 0xf4, 0xc8, 0x91, 0x4b, 0xfc, 0xfd, - 0x42, 0x1b, 0x70, 0xba, 0xfb, 0xde, 0x7b, 0xf0, 0x89, 0x3a, 0x18, 0xed, 0xc3, 0xc0, 0x40, 0xdc, - 0xe7, 0xb7, 0x47, 0x83, 0x64, 0x1d, 0xb7, 0x14, 0x7c, 0xf4, 0xe5, 0x71, 0x3e, 0xdc, 0xe6, 0xf6, - 0xf2, 0x10, 0xbb, 0xf7, 0x32, 0x28, 0x4f, 0x62, 0xf3, 0x95, 0x53, 0x32, 0x55, 0x51, 0x17, 0xcd, - 0xa1, 0x5b, 0xa0, 0x3c, 0x8b, 0x7d, 0x74, 0x68, 0x38, 0x4a, 0xa4, 0x6a, 0x55, 0x17, 0xcd, 0xba, - 0xfb, 0x07, 0xaf, 0xe7, 0xe7, 0x3e, 0xba, 0x68, 0x93, 0x6a, 0xb5, 0x47, 0x50, 0x32, 0x6a, 0xab, - 0x7d, 0x20, 0xa0, 0x29, 0xa1, 0x32, 0xe1, 0xca, 0xda, 0x1a, 0x94, 0x0c, 0x2a, 0xb9, 0x69, 0x80, - 0xd1, 0xc3, 0xa2, 0x87, 0xac, 0x57, 0xdb, 0x99, 0x6f, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xda, - 0xcc, 0x6a, 0x9f, 0xb9, 0x00, 0x00, 0x00, +var file_records_ps_records_memphis_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_records_ps_records_memphis_proto_goTypes = []interface{}{ + (*Memphis)(nil), // 0: protos.records.Memphis +} +var file_records_ps_records_memphis_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_records_ps_records_memphis_proto_init() } +func file_records_ps_records_memphis_proto_init() { + if File_records_ps_records_memphis_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_records_ps_records_memphis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Memphis); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_records_ps_records_memphis_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_records_ps_records_memphis_proto_goTypes, + DependencyIndexes: file_records_ps_records_memphis_proto_depIdxs, + MessageInfos: file_records_ps_records_memphis_proto_msgTypes, + }.Build() + File_records_ps_records_memphis_proto = out.File + file_records_ps_records_memphis_proto_rawDesc = nil + file_records_ps_records_memphis_proto_goTypes = nil + file_records_ps_records_memphis_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_mongo.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_mongo.pb.go index a7387d06c..428169dfc 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_mongo.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_mongo.pb.go @@ -1,89 +1,156 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: records/ps_records_mongo.proto package records import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type Mongo struct { - Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` - Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *Mongo) Reset() { *m = Mongo{} } -func (m *Mongo) String() string { return proto.CompactTextString(m) } -func (*Mongo) ProtoMessage() {} -func (*Mongo) Descriptor() ([]byte, []int) { - return fileDescriptor_05f9254b78f1b7a5, []int{0} + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` } -func (m *Mongo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Mongo.Unmarshal(m, b) -} -func (m *Mongo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Mongo.Marshal(b, m, deterministic) -} -func (m *Mongo) XXX_Merge(src proto.Message) { - xxx_messageInfo_Mongo.Merge(m, src) +func (x *Mongo) Reset() { + *x = Mongo{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_mongo_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Mongo) XXX_Size() int { - return xxx_messageInfo_Mongo.Size(m) + +func (x *Mongo) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Mongo) XXX_DiscardUnknown() { - xxx_messageInfo_Mongo.DiscardUnknown(m) + +func (*Mongo) ProtoMessage() {} + +func (x *Mongo) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_mongo_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_Mongo proto.InternalMessageInfo +// Deprecated: Use Mongo.ProtoReflect.Descriptor instead. +func (*Mongo) Descriptor() ([]byte, []int) { + return file_records_ps_records_mongo_proto_rawDescGZIP(), []int{0} +} -func (m *Mongo) GetValue() []byte { - if m != nil { - return m.Value +func (x *Mongo) GetValue() []byte { + if x != nil { + return x.Value } return nil } -func (m *Mongo) GetTimestamp() int64 { - if m != nil { - return m.Timestamp +func (x *Mongo) GetTimestamp() int64 { + if x != nil { + return x.Timestamp } return 0 } -func init() { - proto.RegisterType((*Mongo)(nil), "protos.records.Mongo") +var File_records_ps_records_mongo_proto protoreflect.FileDescriptor + +var file_records_ps_records_mongo_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, + 0x22, 0x3b, 0x0a, 0x05, 0x4d, 0x6f, 0x6e, 0x67, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, + 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x3e, 0x5a, + 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, + 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_records_ps_records_mongo_proto_rawDescOnce sync.Once + file_records_ps_records_mongo_proto_rawDescData = file_records_ps_records_mongo_proto_rawDesc +) + +func file_records_ps_records_mongo_proto_rawDescGZIP() []byte { + file_records_ps_records_mongo_proto_rawDescOnce.Do(func() { + file_records_ps_records_mongo_proto_rawDescData = protoimpl.X.CompressGZIP(file_records_ps_records_mongo_proto_rawDescData) + }) + return file_records_ps_records_mongo_proto_rawDescData } -func init() { proto.RegisterFile("records/ps_records_mongo.proto", fileDescriptor_05f9254b78f1b7a5) } - -var fileDescriptor_05f9254b78f1b7a5 = []byte{ - // 165 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0x4a, 0x4d, 0xce, - 0x2f, 0x4a, 0x29, 0xd6, 0x2f, 0x28, 0x8e, 0x87, 0x32, 0xe3, 0x73, 0xf3, 0xf3, 0xd2, 0xf3, 0xf5, - 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0xf8, 0xc0, 0x54, 0xb1, 0x1e, 0x54, 0x4e, 0xc9, 0x9a, 0x8b, - 0xd5, 0x17, 0x24, 0x2d, 0x24, 0xc2, 0xc5, 0x5a, 0x96, 0x98, 0x53, 0x9a, 0x2a, 0xc1, 0xa8, 0xc0, - 0xa8, 0xc1, 0x13, 0x04, 0xe1, 0x08, 0xc9, 0x70, 0x71, 0x96, 0x64, 0xe6, 0xa6, 0x16, 0x97, 0x24, - 0xe6, 0x16, 0x48, 0x30, 0x29, 0x30, 0x6a, 0x30, 0x07, 0x21, 0x04, 0x9c, 0xec, 0xa2, 0x6c, 0xd2, - 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x93, 0x12, 0x4b, 0x92, 0x33, 0x92, - 0xf3, 0x8b, 0x0a, 0xf4, 0x0b, 0x72, 0x4a, 0x73, 0x93, 0x52, 0x8b, 0x74, 0x8b, 0x93, 0x33, 0x52, - 0x73, 0x13, 0x8b, 0xf5, 0x93, 0x4a, 0x33, 0x73, 0x52, 0xf4, 0xd3, 0xf3, 0xf5, 0x21, 0x96, 0xeb, - 0x43, 0x2d, 0x4f, 0x62, 0x03, 0xf3, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x40, 0x5f, 0x25, - 0x21, 0xb5, 0x00, 0x00, 0x00, +var file_records_ps_records_mongo_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_records_ps_records_mongo_proto_goTypes = []interface{}{ + (*Mongo)(nil), // 0: protos.records.Mongo +} +var file_records_ps_records_mongo_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_records_ps_records_mongo_proto_init() } +func file_records_ps_records_mongo_proto_init() { + if File_records_ps_records_mongo_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_records_ps_records_mongo_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Mongo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_records_ps_records_mongo_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_records_ps_records_mongo_proto_goTypes, + DependencyIndexes: file_records_ps_records_mongo_proto_depIdxs, + MessageInfos: file_records_ps_records_mongo_proto_msgTypes, + }.Build() + File_records_ps_records_mongo_proto = out.File + file_records_ps_records_mongo_proto_rawDesc = nil + file_records_ps_records_mongo_proto_goTypes = nil + file_records_ps_records_mongo_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_mqtt.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_mqtt.pb.go index 7674f44ce..290229e0f 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_mqtt.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_mqtt.pb.go @@ -1,133 +1,203 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: records/ps_records_mqtt.proto package records import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type MQTT struct { - Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Topic string `protobuf:"bytes,2,opt,name=topic,proto3" json:"topic,omitempty"` - Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` - Duplicate bool `protobuf:"varint,4,opt,name=duplicate,proto3" json:"duplicate,omitempty"` - Retained bool `protobuf:"varint,5,opt,name=retained,proto3" json:"retained,omitempty"` - Qos uint32 `protobuf:"varint,6,opt,name=qos,proto3" json:"qos,omitempty"` - Timestamp int64 `protobuf:"varint,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MQTT) Reset() { *m = MQTT{} } -func (m *MQTT) String() string { return proto.CompactTextString(m) } -func (*MQTT) ProtoMessage() {} -func (*MQTT) Descriptor() ([]byte, []int) { - return fileDescriptor_baf607082456384a, []int{0} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Topic string `protobuf:"bytes,2,opt,name=topic,proto3" json:"topic,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + Duplicate bool `protobuf:"varint,4,opt,name=duplicate,proto3" json:"duplicate,omitempty"` + Retained bool `protobuf:"varint,5,opt,name=retained,proto3" json:"retained,omitempty"` + Qos uint32 `protobuf:"varint,6,opt,name=qos,proto3" json:"qos,omitempty"` + Timestamp int64 `protobuf:"varint,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"` +} + +func (x *MQTT) Reset() { + *x = MQTT{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_mqtt_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *MQTT) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MQTT.Unmarshal(m, b) -} -func (m *MQTT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MQTT.Marshal(b, m, deterministic) -} -func (m *MQTT) XXX_Merge(src proto.Message) { - xxx_messageInfo_MQTT.Merge(m, src) +func (x *MQTT) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MQTT) XXX_Size() int { - return xxx_messageInfo_MQTT.Size(m) -} -func (m *MQTT) XXX_DiscardUnknown() { - xxx_messageInfo_MQTT.DiscardUnknown(m) + +func (*MQTT) ProtoMessage() {} + +func (x *MQTT) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_mqtt_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_MQTT proto.InternalMessageInfo +// Deprecated: Use MQTT.ProtoReflect.Descriptor instead. +func (*MQTT) Descriptor() ([]byte, []int) { + return file_records_ps_records_mqtt_proto_rawDescGZIP(), []int{0} +} -func (m *MQTT) GetId() uint32 { - if m != nil { - return m.Id +func (x *MQTT) GetId() uint32 { + if x != nil { + return x.Id } return 0 } -func (m *MQTT) GetTopic() string { - if m != nil { - return m.Topic +func (x *MQTT) GetTopic() string { + if x != nil { + return x.Topic } return "" } -func (m *MQTT) GetValue() []byte { - if m != nil { - return m.Value +func (x *MQTT) GetValue() []byte { + if x != nil { + return x.Value } return nil } -func (m *MQTT) GetDuplicate() bool { - if m != nil { - return m.Duplicate +func (x *MQTT) GetDuplicate() bool { + if x != nil { + return x.Duplicate } return false } -func (m *MQTT) GetRetained() bool { - if m != nil { - return m.Retained +func (x *MQTT) GetRetained() bool { + if x != nil { + return x.Retained } return false } -func (m *MQTT) GetQos() uint32 { - if m != nil { - return m.Qos +func (x *MQTT) GetQos() uint32 { + if x != nil { + return x.Qos } return 0 } -func (m *MQTT) GetTimestamp() int64 { - if m != nil { - return m.Timestamp +func (x *MQTT) GetTimestamp() int64 { + if x != nil { + return x.Timestamp } return 0 } -func init() { - proto.RegisterType((*MQTT)(nil), "protos.records.MQTT") -} - -func init() { proto.RegisterFile("records/ps_records_mqtt.proto", fileDescriptor_baf607082456384a) } - -var fileDescriptor_baf607082456384a = []byte{ - // 235 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x8f, 0x3d, 0x4b, 0x43, 0x31, - 0x18, 0x85, 0xc9, 0xbd, 0x6d, 0x6d, 0x83, 0x16, 0x09, 0x0e, 0x41, 0x14, 0x82, 0x53, 0x16, 0x6f, - 0x06, 0x57, 0x71, 0x70, 0x77, 0x30, 0x74, 0x72, 0x29, 0xf9, 0xa2, 0x37, 0x70, 0x63, 0xd2, 0xe4, - 0x8d, 0xbf, 0xca, 0x1f, 0x29, 0xf7, 0x03, 0x3b, 0xe5, 0x3c, 0xcf, 0x81, 0xbc, 0x1c, 0xfc, 0x98, - 0x9d, 0x89, 0xd9, 0x16, 0x91, 0xca, 0x71, 0x89, 0xc7, 0x70, 0x06, 0xe8, 0x52, 0x8e, 0x10, 0xc9, - 0x7e, 0x7a, 0x4a, 0xb7, 0x54, 0x4f, 0xbf, 0x08, 0xaf, 0x3e, 0x3e, 0x0f, 0x07, 0xb2, 0xc7, 0x8d, - 0xb7, 0x14, 0x31, 0xc4, 0x6f, 0x64, 0xe3, 0x2d, 0xb9, 0xc3, 0x6b, 0x88, 0xc9, 0x1b, 0xda, 0x30, - 0xc4, 0x77, 0x72, 0x86, 0xd1, 0xfe, 0xa8, 0xa1, 0x3a, 0xda, 0x32, 0xc4, 0xaf, 0xe5, 0x0c, 0xe4, - 0x01, 0xef, 0x6c, 0x4d, 0x83, 0x37, 0x0a, 0x1c, 0x5d, 0x31, 0xc4, 0xb7, 0xf2, 0x22, 0xc8, 0x3d, - 0xde, 0x66, 0x07, 0xca, 0x7f, 0x3b, 0x4b, 0xd7, 0x53, 0xf9, 0xcf, 0xe4, 0x16, 0xb7, 0xe7, 0x58, - 0xe8, 0x66, 0x3a, 0x3b, 0xc6, 0xf1, 0x2f, 0xf0, 0xc1, 0x15, 0x50, 0x21, 0xd1, 0x2b, 0x86, 0x78, - 0x2b, 0x2f, 0xe2, 0xfd, 0xed, 0xeb, 0xf5, 0xe4, 0xa1, 0xaf, 0xba, 0x33, 0x31, 0x08, 0xad, 0xc0, - 0xf4, 0x26, 0xe6, 0x24, 0xd2, 0x50, 0x83, 0x76, 0xf9, 0xb9, 0x98, 0xde, 0x05, 0x55, 0x84, 0xae, - 0x7e, 0xb0, 0xe2, 0x14, 0xc5, 0x3c, 0x57, 0x2c, 0x73, 0xf5, 0x66, 0xe2, 0x97, 0xbf, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xed, 0xff, 0x61, 0x51, 0x26, 0x01, 0x00, 0x00, +var File_records_ps_records_mqtt_proto protoreflect.FileDescriptor + +var file_records_ps_records_mqtt_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x6d, 0x71, 0x74, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, + 0xac, 0x01, 0x0a, 0x04, 0x4d, 0x51, 0x54, 0x54, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, + 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x64, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x64, 0x12, 0x10, + 0x0a, 0x03, 0x71, 0x6f, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x71, 0x6f, 0x73, + 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x3e, + 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, + 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_records_ps_records_mqtt_proto_rawDescOnce sync.Once + file_records_ps_records_mqtt_proto_rawDescData = file_records_ps_records_mqtt_proto_rawDesc +) + +func file_records_ps_records_mqtt_proto_rawDescGZIP() []byte { + file_records_ps_records_mqtt_proto_rawDescOnce.Do(func() { + file_records_ps_records_mqtt_proto_rawDescData = protoimpl.X.CompressGZIP(file_records_ps_records_mqtt_proto_rawDescData) + }) + return file_records_ps_records_mqtt_proto_rawDescData +} + +var file_records_ps_records_mqtt_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_records_ps_records_mqtt_proto_goTypes = []interface{}{ + (*MQTT)(nil), // 0: protos.records.MQTT +} +var file_records_ps_records_mqtt_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_records_ps_records_mqtt_proto_init() } +func file_records_ps_records_mqtt_proto_init() { + if File_records_ps_records_mqtt_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_records_ps_records_mqtt_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MQTT); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_records_ps_records_mqtt_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_records_ps_records_mqtt_proto_goTypes, + DependencyIndexes: file_records_ps_records_mqtt_proto_depIdxs, + MessageInfos: file_records_ps_records_mqtt_proto_msgTypes, + }.Build() + File_records_ps_records_mqtt_proto = out.File + file_records_ps_records_mqtt_proto_rawDesc = nil + file_records_ps_records_mqtt_proto_goTypes = nil + file_records_ps_records_mqtt_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_nats.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_nats.pb.go index 2f0e6a2ba..c98e7a91e 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_nats.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_nats.pb.go @@ -1,89 +1,155 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: records/ps_records_nats.proto package records import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type Nats struct { - Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"` - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *Nats) Reset() { *m = Nats{} } -func (m *Nats) String() string { return proto.CompactTextString(m) } -func (*Nats) ProtoMessage() {} -func (*Nats) Descriptor() ([]byte, []int) { - return fileDescriptor_e0b1682b2af02543, []int{0} + Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` } -func (m *Nats) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Nats.Unmarshal(m, b) -} -func (m *Nats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Nats.Marshal(b, m, deterministic) -} -func (m *Nats) XXX_Merge(src proto.Message) { - xxx_messageInfo_Nats.Merge(m, src) +func (x *Nats) Reset() { + *x = Nats{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_nats_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Nats) XXX_Size() int { - return xxx_messageInfo_Nats.Size(m) + +func (x *Nats) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Nats) XXX_DiscardUnknown() { - xxx_messageInfo_Nats.DiscardUnknown(m) + +func (*Nats) ProtoMessage() {} + +func (x *Nats) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_nats_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_Nats proto.InternalMessageInfo +// Deprecated: Use Nats.ProtoReflect.Descriptor instead. +func (*Nats) Descriptor() ([]byte, []int) { + return file_records_ps_records_nats_proto_rawDescGZIP(), []int{0} +} -func (m *Nats) GetSubject() string { - if m != nil { - return m.Subject +func (x *Nats) GetSubject() string { + if x != nil { + return x.Subject } return "" } -func (m *Nats) GetValue() []byte { - if m != nil { - return m.Value +func (x *Nats) GetValue() []byte { + if x != nil { + return x.Value } return nil } -func init() { - proto.RegisterType((*Nats)(nil), "protos.records.Nats") +var File_records_ps_records_nats_proto protoreflect.FileDescriptor + +var file_records_ps_records_nats_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, + 0x36, 0x0a, 0x04, 0x4e, 0x61, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, + 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, + 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, + 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_records_ps_records_nats_proto_rawDescOnce sync.Once + file_records_ps_records_nats_proto_rawDescData = file_records_ps_records_nats_proto_rawDesc +) + +func file_records_ps_records_nats_proto_rawDescGZIP() []byte { + file_records_ps_records_nats_proto_rawDescOnce.Do(func() { + file_records_ps_records_nats_proto_rawDescData = protoimpl.X.CompressGZIP(file_records_ps_records_nats_proto_rawDescData) + }) + return file_records_ps_records_nats_proto_rawDescData } -func init() { proto.RegisterFile("records/ps_records_nats.proto", fileDescriptor_e0b1682b2af02543) } - -var fileDescriptor_e0b1682b2af02543 = []byte{ - // 163 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2d, 0x4a, 0x4d, 0xce, - 0x2f, 0x4a, 0x29, 0xd6, 0x2f, 0x28, 0x8e, 0x87, 0x32, 0xe3, 0xf3, 0x12, 0x4b, 0x8a, 0xf5, 0x0a, - 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0xf8, 0xc0, 0x54, 0xb1, 0x1e, 0x54, 0x4a, 0xc9, 0x8c, 0x8b, 0xc5, - 0x2f, 0xb1, 0xa4, 0x58, 0x48, 0x82, 0x8b, 0xbd, 0xb8, 0x34, 0x29, 0x2b, 0x35, 0xb9, 0x44, 0x82, - 0x51, 0x81, 0x51, 0x83, 0x33, 0x08, 0xc6, 0x15, 0x12, 0xe1, 0x62, 0x2d, 0x4b, 0xcc, 0x29, 0x4d, - 0x95, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x09, 0x82, 0x70, 0x9c, 0xec, 0xa2, 0x6c, 0xd2, 0x33, 0x4b, - 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x93, 0x12, 0x4b, 0x92, 0x33, 0x92, 0xf3, 0x8b, - 0x0a, 0xf4, 0x0b, 0x72, 0x4a, 0x73, 0x93, 0x52, 0x8b, 0x74, 0x8b, 0x93, 0x33, 0x52, 0x73, 0x13, - 0x8b, 0xf5, 0x93, 0x4a, 0x33, 0x73, 0x52, 0xf4, 0xd3, 0xf3, 0xf5, 0x21, 0xf6, 0xea, 0x43, 0xed, - 0x4d, 0x62, 0x03, 0xf3, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xae, 0xd0, 0xd5, 0x87, 0xaf, - 0x00, 0x00, 0x00, +var file_records_ps_records_nats_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_records_ps_records_nats_proto_goTypes = []interface{}{ + (*Nats)(nil), // 0: protos.records.Nats +} +var file_records_ps_records_nats_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_records_ps_records_nats_proto_init() } +func file_records_ps_records_nats_proto_init() { + if File_records_ps_records_nats_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_records_ps_records_nats_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Nats); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_records_ps_records_nats_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_records_ps_records_nats_proto_goTypes, + DependencyIndexes: file_records_ps_records_nats_proto_depIdxs, + MessageInfos: file_records_ps_records_nats_proto_msgTypes, + }.Build() + File_records_ps_records_nats_proto = out.File + file_records_ps_records_nats_proto_rawDesc = nil + file_records_ps_records_nats_proto_goTypes = nil + file_records_ps_records_nats_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_nats_jetstream.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_nats_jetstream.pb.go index 13d12c14f..b3ba0d698 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_nats_jetstream.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_nats_jetstream.pb.go @@ -1,110 +1,177 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: records/ps_records_nats_jetstream.proto package records import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type NatsJetstream struct { - Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - ConsumerName string `protobuf:"bytes,3,opt,name=consumer_name,json=consumerName,proto3" json:"consumer_name,omitempty"` - Sequence int64 `protobuf:"varint,4,opt,name=sequence,proto3" json:"sequence,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *NatsJetstream) Reset() { *m = NatsJetstream{} } -func (m *NatsJetstream) String() string { return proto.CompactTextString(m) } -func (*NatsJetstream) ProtoMessage() {} -func (*NatsJetstream) Descriptor() ([]byte, []int) { - return fileDescriptor_2fb39dca56fdde41, []int{0} + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + ConsumerName string `protobuf:"bytes,3,opt,name=consumer_name,json=consumerName,proto3" json:"consumer_name,omitempty"` + Sequence int64 `protobuf:"varint,4,opt,name=sequence,proto3" json:"sequence,omitempty"` } -func (m *NatsJetstream) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NatsJetstream.Unmarshal(m, b) -} -func (m *NatsJetstream) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NatsJetstream.Marshal(b, m, deterministic) -} -func (m *NatsJetstream) XXX_Merge(src proto.Message) { - xxx_messageInfo_NatsJetstream.Merge(m, src) +func (x *NatsJetstream) Reset() { + *x = NatsJetstream{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_nats_jetstream_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *NatsJetstream) XXX_Size() int { - return xxx_messageInfo_NatsJetstream.Size(m) + +func (x *NatsJetstream) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *NatsJetstream) XXX_DiscardUnknown() { - xxx_messageInfo_NatsJetstream.DiscardUnknown(m) + +func (*NatsJetstream) ProtoMessage() {} + +func (x *NatsJetstream) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_nats_jetstream_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_NatsJetstream proto.InternalMessageInfo +// Deprecated: Use NatsJetstream.ProtoReflect.Descriptor instead. +func (*NatsJetstream) Descriptor() ([]byte, []int) { + return file_records_ps_records_nats_jetstream_proto_rawDescGZIP(), []int{0} +} -func (m *NatsJetstream) GetStream() string { - if m != nil { - return m.Stream +func (x *NatsJetstream) GetStream() string { + if x != nil { + return x.Stream } return "" } -func (m *NatsJetstream) GetValue() []byte { - if m != nil { - return m.Value +func (x *NatsJetstream) GetValue() []byte { + if x != nil { + return x.Value } return nil } -func (m *NatsJetstream) GetConsumerName() string { - if m != nil { - return m.ConsumerName +func (x *NatsJetstream) GetConsumerName() string { + if x != nil { + return x.ConsumerName } return "" } -func (m *NatsJetstream) GetSequence() int64 { - if m != nil { - return m.Sequence +func (x *NatsJetstream) GetSequence() int64 { + if x != nil { + return x.Sequence } return 0 } -func init() { - proto.RegisterType((*NatsJetstream)(nil), "protos.records.NatsJetstream") +var File_records_ps_records_nats_jetstream_proto protoreflect.FileDescriptor + +var file_records_ps_records_nats_jetstream_proto_rawDesc = []byte{ + 0x0a, 0x27, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x6a, 0x65, 0x74, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0x7e, 0x0a, 0x0d, 0x4e, 0x61, 0x74, + 0x73, 0x4a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x73, + 0x75, 0x6d, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0c, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, + 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, + 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, + 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_records_ps_records_nats_jetstream_proto_rawDescOnce sync.Once + file_records_ps_records_nats_jetstream_proto_rawDescData = file_records_ps_records_nats_jetstream_proto_rawDesc +) + +func file_records_ps_records_nats_jetstream_proto_rawDescGZIP() []byte { + file_records_ps_records_nats_jetstream_proto_rawDescOnce.Do(func() { + file_records_ps_records_nats_jetstream_proto_rawDescData = protoimpl.X.CompressGZIP(file_records_ps_records_nats_jetstream_proto_rawDescData) + }) + return file_records_ps_records_nats_jetstream_proto_rawDescData } -func init() { - proto.RegisterFile("records/ps_records_nats_jetstream.proto", fileDescriptor_2fb39dca56fdde41) +var file_records_ps_records_nats_jetstream_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_records_ps_records_nats_jetstream_proto_goTypes = []interface{}{ + (*NatsJetstream)(nil), // 0: protos.records.NatsJetstream +} +var file_records_ps_records_nats_jetstream_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } -var fileDescriptor_2fb39dca56fdde41 = []byte{ - // 212 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0x8e, 0xbf, 0x4f, 0xc3, 0x30, - 0x10, 0x85, 0x65, 0x0a, 0x15, 0x58, 0x2d, 0x83, 0x85, 0x90, 0xc5, 0x14, 0xc1, 0x40, 0x16, 0xe2, - 0x81, 0x15, 0x31, 0x30, 0x32, 0x74, 0xc8, 0xc8, 0x62, 0x9d, 0xdd, 0x53, 0x13, 0x14, 0xff, 0xc0, - 0x67, 0x33, 0xf2, 0xb7, 0x23, 0x25, 0x4e, 0xa7, 0x7b, 0xdf, 0xe9, 0x3d, 0xe9, 0xe3, 0xcf, 0x09, - 0x6d, 0x48, 0x47, 0x52, 0x91, 0x74, 0x8d, 0xda, 0x43, 0x26, 0xfd, 0x8d, 0x99, 0x72, 0x42, 0x70, - 0x5d, 0x4c, 0x21, 0x07, 0x71, 0x3b, 0x1f, 0xea, 0x6a, 0xe9, 0xf1, 0x8f, 0xef, 0x0f, 0x90, 0xe9, - 0x73, 0xad, 0x89, 0x7b, 0xbe, 0x5d, 0x92, 0x64, 0x0d, 0x6b, 0x6f, 0xfa, 0x4a, 0xe2, 0x8e, 0x5f, - 0xfd, 0xc2, 0x54, 0x50, 0x5e, 0x34, 0xac, 0xdd, 0xf5, 0x0b, 0x88, 0x27, 0xbe, 0xb7, 0xc1, 0x53, - 0x71, 0x98, 0xb4, 0x07, 0x87, 0x72, 0x33, 0x8f, 0x76, 0xeb, 0xf3, 0x00, 0x0e, 0xc5, 0x03, 0xbf, - 0x26, 0xfc, 0x29, 0xe8, 0x2d, 0xca, 0xcb, 0x86, 0xb5, 0x9b, 0xfe, 0xcc, 0x1f, 0xef, 0x5f, 0x6f, - 0xa7, 0x31, 0x0f, 0xc5, 0x74, 0x36, 0x38, 0x65, 0x20, 0xdb, 0xc1, 0x86, 0x14, 0x55, 0x9c, 0x8a, - 0x33, 0x98, 0x5e, 0xc8, 0x0e, 0xe8, 0x80, 0x94, 0x29, 0xe3, 0x74, 0x54, 0xa7, 0xa0, 0x16, 0x7f, - 0x55, 0xfd, 0xcd, 0x76, 0xe6, 0xd7, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb7, 0xeb, 0x84, 0x09, - 0x01, 0x01, 0x00, 0x00, +func init() { file_records_ps_records_nats_jetstream_proto_init() } +func file_records_ps_records_nats_jetstream_proto_init() { + if File_records_ps_records_nats_jetstream_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_records_ps_records_nats_jetstream_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NatsJetstream); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_records_ps_records_nats_jetstream_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_records_ps_records_nats_jetstream_proto_goTypes, + DependencyIndexes: file_records_ps_records_nats_jetstream_proto_depIdxs, + MessageInfos: file_records_ps_records_nats_jetstream_proto_msgTypes, + }.Build() + File_records_ps_records_nats_jetstream_proto = out.File + file_records_ps_records_nats_jetstream_proto_rawDesc = nil + file_records_ps_records_nats_jetstream_proto_goTypes = nil + file_records_ps_records_nats_jetstream_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_nats_streaming.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_nats_streaming.pb.go index dbcde0e7c..6d38385c4 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_nats_streaming.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_nats_streaming.pb.go @@ -1,105 +1,175 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: records/ps_records_nats_streaming.proto package records import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type NatsStreaming struct { - Metadata map[string]string `protobuf:"bytes,1,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *NatsStreaming) Reset() { *m = NatsStreaming{} } -func (m *NatsStreaming) String() string { return proto.CompactTextString(m) } -func (*NatsStreaming) ProtoMessage() {} -func (*NatsStreaming) Descriptor() ([]byte, []int) { - return fileDescriptor_404f61145e3dc1e4, []int{0} + Metadata map[string]string `protobuf:"bytes,1,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` } -func (m *NatsStreaming) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NatsStreaming.Unmarshal(m, b) -} -func (m *NatsStreaming) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NatsStreaming.Marshal(b, m, deterministic) -} -func (m *NatsStreaming) XXX_Merge(src proto.Message) { - xxx_messageInfo_NatsStreaming.Merge(m, src) +func (x *NatsStreaming) Reset() { + *x = NatsStreaming{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_nats_streaming_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *NatsStreaming) XXX_Size() int { - return xxx_messageInfo_NatsStreaming.Size(m) + +func (x *NatsStreaming) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *NatsStreaming) XXX_DiscardUnknown() { - xxx_messageInfo_NatsStreaming.DiscardUnknown(m) + +func (*NatsStreaming) ProtoMessage() {} + +func (x *NatsStreaming) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_nats_streaming_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_NatsStreaming proto.InternalMessageInfo +// Deprecated: Use NatsStreaming.ProtoReflect.Descriptor instead. +func (*NatsStreaming) Descriptor() ([]byte, []int) { + return file_records_ps_records_nats_streaming_proto_rawDescGZIP(), []int{0} +} -func (m *NatsStreaming) GetMetadata() map[string]string { - if m != nil { - return m.Metadata +func (x *NatsStreaming) GetMetadata() map[string]string { + if x != nil { + return x.Metadata } return nil } -func (m *NatsStreaming) GetValue() []byte { - if m != nil { - return m.Value +func (x *NatsStreaming) GetValue() []byte { + if x != nil { + return x.Value } return nil } -func (m *NatsStreaming) GetTimestamp() int64 { - if m != nil { - return m.Timestamp +func (x *NatsStreaming) GetTimestamp() int64 { + if x != nil { + return x.Timestamp } return 0 } -func init() { - proto.RegisterType((*NatsStreaming)(nil), "protos.records.NatsStreaming") - proto.RegisterMapType((map[string]string)(nil), "protos.records.NatsStreaming.MetadataEntry") +var File_records_ps_records_nats_streaming_proto protoreflect.FileDescriptor + +var file_records_ps_records_nats_streaming_proto_rawDesc = []byte{ + 0x0a, 0x27, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0xc9, 0x01, 0x0a, 0x0d, 0x4e, 0x61, + 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x12, 0x47, 0x0a, 0x08, 0x6d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x4e, + 0x61, 0x74, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x2e, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, + 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x72, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_records_ps_records_nats_streaming_proto_rawDescOnce sync.Once + file_records_ps_records_nats_streaming_proto_rawDescData = file_records_ps_records_nats_streaming_proto_rawDesc +) + +func file_records_ps_records_nats_streaming_proto_rawDescGZIP() []byte { + file_records_ps_records_nats_streaming_proto_rawDescOnce.Do(func() { + file_records_ps_records_nats_streaming_proto_rawDescData = protoimpl.X.CompressGZIP(file_records_ps_records_nats_streaming_proto_rawDescData) + }) + return file_records_ps_records_nats_streaming_proto_rawDescData } -func init() { - proto.RegisterFile("records/ps_records_nats_streaming.proto", fileDescriptor_404f61145e3dc1e4) +var file_records_ps_records_nats_streaming_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_records_ps_records_nats_streaming_proto_goTypes = []interface{}{ + (*NatsStreaming)(nil), // 0: protos.records.NatsStreaming + nil, // 1: protos.records.NatsStreaming.MetadataEntry +} +var file_records_ps_records_nats_streaming_proto_depIdxs = []int32{ + 1, // 0: protos.records.NatsStreaming.metadata:type_name -> protos.records.NatsStreaming.MetadataEntry + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } -var fileDescriptor_404f61145e3dc1e4 = []byte{ - // 243 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x8f, 0x41, 0x4b, 0xc4, 0x30, - 0x10, 0x85, 0xc9, 0x16, 0xc5, 0x8d, 0xae, 0x48, 0xf0, 0x50, 0xc4, 0x43, 0xf1, 0x62, 0x41, 0x4c, - 0x40, 0x2f, 0xa2, 0xe2, 0x41, 0x10, 0x4f, 0x7a, 0xa8, 0x37, 0x2f, 0x65, 0x92, 0x86, 0xb6, 0xd8, - 0x34, 0x21, 0x33, 0x15, 0xf6, 0x27, 0xfa, 0xaf, 0xc4, 0xdd, 0xa8, 0xf4, 0x34, 0xef, 0x0d, 0xef, - 0x7d, 0xf0, 0xf8, 0x79, 0xb4, 0xc6, 0xc7, 0x06, 0x55, 0xc0, 0x3a, 0xc9, 0x7a, 0x04, 0xc2, 0x1a, - 0x29, 0x5a, 0x70, 0xfd, 0xd8, 0xca, 0x10, 0x3d, 0x79, 0x71, 0xb8, 0x39, 0x28, 0x53, 0xe8, 0xec, - 0x8b, 0xf1, 0xd5, 0x2b, 0x10, 0xbe, 0xfd, 0xe6, 0xc4, 0x33, 0xdf, 0x73, 0x96, 0xa0, 0x01, 0x82, - 0x9c, 0x15, 0x59, 0xb9, 0x7f, 0x75, 0x21, 0xe7, 0x25, 0x39, 0x2b, 0xc8, 0x97, 0x94, 0x7e, 0x1a, - 0x29, 0xae, 0xab, 0xbf, 0xb2, 0x38, 0xe6, 0x3b, 0x9f, 0x30, 0x4c, 0x36, 0x5f, 0x14, 0xac, 0x3c, - 0xa8, 0xb6, 0x46, 0x9c, 0xf2, 0x25, 0xf5, 0xce, 0x22, 0x81, 0x0b, 0x79, 0x56, 0xb0, 0x32, 0xab, - 0xfe, 0x1f, 0x27, 0x77, 0x7c, 0x35, 0xc3, 0x89, 0x23, 0x9e, 0x7d, 0xd8, 0x75, 0xce, 0x0a, 0x56, - 0x2e, 0xab, 0x1f, 0x39, 0xc7, 0x2e, 0x13, 0xf6, 0x76, 0x71, 0xc3, 0x1e, 0x1f, 0xde, 0xef, 0xdb, - 0x9e, 0xba, 0x49, 0x4b, 0xe3, 0x9d, 0xd2, 0x40, 0xa6, 0x33, 0x3e, 0x06, 0x15, 0x86, 0xc9, 0x69, - 0x1b, 0x2f, 0xd1, 0x74, 0xd6, 0x01, 0x2a, 0x3d, 0xf5, 0x43, 0xa3, 0x5a, 0xaf, 0xb6, 0xb3, 0x54, - 0x9a, 0xa5, 0x77, 0x37, 0xfe, 0xfa, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xd1, 0x3b, 0x9f, 0x4c, 0x4d, - 0x01, 0x00, 0x00, +func init() { file_records_ps_records_nats_streaming_proto_init() } +func file_records_ps_records_nats_streaming_proto_init() { + if File_records_ps_records_nats_streaming_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_records_ps_records_nats_streaming_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NatsStreaming); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_records_ps_records_nats_streaming_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_records_ps_records_nats_streaming_proto_goTypes, + DependencyIndexes: file_records_ps_records_nats_streaming_proto_depIdxs, + MessageInfos: file_records_ps_records_nats_streaming_proto_msgTypes, + }.Build() + File_records_ps_records_nats_streaming_proto = out.File + file_records_ps_records_nats_streaming_proto_rawDesc = nil + file_records_ps_records_nats_streaming_proto_goTypes = nil + file_records_ps_records_nats_streaming_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_nsq.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_nsq.pb.go index 2f8919bd5..9ede80d78 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_nsq.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_nsq.pb.go @@ -1,134 +1,204 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: records/ps_records_nsq.proto package records import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type NSQ struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Topic string `protobuf:"bytes,2,opt,name=topic,proto3" json:"topic,omitempty"` - Channel string `protobuf:"bytes,3,opt,name=channel,proto3" json:"channel,omitempty"` - Attempts int32 `protobuf:"varint,4,opt,name=attempts,proto3" json:"attempts,omitempty"` - NsqdAddress string `protobuf:"bytes,5,opt,name=nsqd_address,json=nsqdAddress,proto3" json:"nsqd_address,omitempty"` - Value []byte `protobuf:"bytes,6,opt,name=value,proto3" json:"value,omitempty"` - Timestamp int64 `protobuf:"varint,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *NSQ) Reset() { *m = NSQ{} } -func (m *NSQ) String() string { return proto.CompactTextString(m) } -func (*NSQ) ProtoMessage() {} -func (*NSQ) Descriptor() ([]byte, []int) { - return fileDescriptor_0733f38f551f19cf, []int{0} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Topic string `protobuf:"bytes,2,opt,name=topic,proto3" json:"topic,omitempty"` + Channel string `protobuf:"bytes,3,opt,name=channel,proto3" json:"channel,omitempty"` + Attempts int32 `protobuf:"varint,4,opt,name=attempts,proto3" json:"attempts,omitempty"` + NsqdAddress string `protobuf:"bytes,5,opt,name=nsqd_address,json=nsqdAddress,proto3" json:"nsqd_address,omitempty"` + Value []byte `protobuf:"bytes,6,opt,name=value,proto3" json:"value,omitempty"` + Timestamp int64 `protobuf:"varint,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"` +} + +func (x *NSQ) Reset() { + *x = NSQ{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_nsq_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *NSQ) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NSQ.Unmarshal(m, b) -} -func (m *NSQ) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NSQ.Marshal(b, m, deterministic) -} -func (m *NSQ) XXX_Merge(src proto.Message) { - xxx_messageInfo_NSQ.Merge(m, src) +func (x *NSQ) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *NSQ) XXX_Size() int { - return xxx_messageInfo_NSQ.Size(m) -} -func (m *NSQ) XXX_DiscardUnknown() { - xxx_messageInfo_NSQ.DiscardUnknown(m) + +func (*NSQ) ProtoMessage() {} + +func (x *NSQ) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_nsq_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_NSQ proto.InternalMessageInfo +// Deprecated: Use NSQ.ProtoReflect.Descriptor instead. +func (*NSQ) Descriptor() ([]byte, []int) { + return file_records_ps_records_nsq_proto_rawDescGZIP(), []int{0} +} -func (m *NSQ) GetId() string { - if m != nil { - return m.Id +func (x *NSQ) GetId() string { + if x != nil { + return x.Id } return "" } -func (m *NSQ) GetTopic() string { - if m != nil { - return m.Topic +func (x *NSQ) GetTopic() string { + if x != nil { + return x.Topic } return "" } -func (m *NSQ) GetChannel() string { - if m != nil { - return m.Channel +func (x *NSQ) GetChannel() string { + if x != nil { + return x.Channel } return "" } -func (m *NSQ) GetAttempts() int32 { - if m != nil { - return m.Attempts +func (x *NSQ) GetAttempts() int32 { + if x != nil { + return x.Attempts } return 0 } -func (m *NSQ) GetNsqdAddress() string { - if m != nil { - return m.NsqdAddress +func (x *NSQ) GetNsqdAddress() string { + if x != nil { + return x.NsqdAddress } return "" } -func (m *NSQ) GetValue() []byte { - if m != nil { - return m.Value +func (x *NSQ) GetValue() []byte { + if x != nil { + return x.Value } return nil } -func (m *NSQ) GetTimestamp() int64 { - if m != nil { - return m.Timestamp +func (x *NSQ) GetTimestamp() int64 { + if x != nil { + return x.Timestamp } return 0 } -func init() { - proto.RegisterType((*NSQ)(nil), "protos.records.NSQ") -} - -func init() { proto.RegisterFile("records/ps_records_nsq.proto", fileDescriptor_0733f38f551f19cf) } - -var fileDescriptor_0733f38f551f19cf = []byte{ - // 243 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x8f, 0xbd, 0x4e, 0xec, 0x30, - 0x10, 0x85, 0xe5, 0xe4, 0x66, 0xf7, 0xae, 0x59, 0x6d, 0x61, 0x51, 0x58, 0x68, 0x8b, 0x40, 0x95, - 0x86, 0xb8, 0xa0, 0x45, 0x48, 0xf0, 0x00, 0x48, 0x84, 0x8e, 0x26, 0xf2, 0x9f, 0x36, 0x96, 0xe2, - 0xd8, 0xeb, 0x99, 0xf0, 0x6c, 0x3c, 0x1e, 0x5a, 0x27, 0x40, 0x35, 0xf3, 0x7d, 0xa3, 0xd1, 0xd1, - 0xa1, 0xc7, 0x64, 0x75, 0x48, 0x06, 0x44, 0x84, 0x7e, 0x5d, 0xfb, 0x09, 0xce, 0x6d, 0x4c, 0x01, - 0x03, 0x3b, 0xe4, 0x01, 0xed, 0x7a, 0xb9, 0xfb, 0x22, 0xb4, 0x7c, 0x7d, 0x7f, 0x63, 0x07, 0x5a, - 0x38, 0xc3, 0x49, 0x4d, 0x9a, 0x5d, 0x57, 0x38, 0xc3, 0xae, 0x69, 0x85, 0x21, 0x3a, 0xcd, 0x8b, - 0xac, 0x16, 0x60, 0x9c, 0x6e, 0xf5, 0x20, 0xa7, 0xc9, 0x8e, 0xbc, 0xcc, 0xfe, 0x07, 0xd9, 0x0d, - 0xfd, 0x2f, 0x11, 0xad, 0x8f, 0x08, 0xfc, 0x5f, 0x4d, 0x9a, 0xaa, 0xfb, 0x65, 0x76, 0x4b, 0xf7, - 0x13, 0x9c, 0x4d, 0x2f, 0x8d, 0x49, 0x16, 0x80, 0x57, 0xf9, 0xf5, 0xea, 0xe2, 0x9e, 0x17, 0x75, - 0x89, 0xfb, 0x94, 0xe3, 0x6c, 0xf9, 0xa6, 0x26, 0xcd, 0xbe, 0x5b, 0x80, 0x1d, 0xe9, 0x0e, 0x9d, - 0xb7, 0x80, 0xd2, 0x47, 0xbe, 0xad, 0x49, 0x53, 0x76, 0x7f, 0xe2, 0xe5, 0xe9, 0xe3, 0xf1, 0xe4, - 0x70, 0x98, 0x55, 0xab, 0x83, 0x17, 0x4a, 0xa2, 0x1e, 0x74, 0x48, 0x51, 0xc4, 0x71, 0xf6, 0xca, - 0xa6, 0x7b, 0xd0, 0x83, 0xf5, 0x12, 0x84, 0x9a, 0xdd, 0x68, 0xc4, 0x29, 0x88, 0xa5, 0xba, 0x58, - 0xab, 0xab, 0x4d, 0xe6, 0x87, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7e, 0xce, 0x6c, 0x86, 0x31, - 0x01, 0x00, 0x00, +var File_records_ps_records_nsq_proto protoreflect.FileDescriptor + +var file_records_ps_records_nsq_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x6e, 0x73, 0x71, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0xb8, + 0x01, 0x0a, 0x03, 0x4e, 0x53, 0x51, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x18, 0x0a, 0x07, + 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, + 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x74, 0x74, 0x65, 0x6d, 0x70, + 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x61, 0x74, 0x74, 0x65, 0x6d, 0x70, + 0x74, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6e, 0x73, 0x71, 0x64, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6e, 0x73, 0x71, 0x64, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, + 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, + 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, + 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_records_ps_records_nsq_proto_rawDescOnce sync.Once + file_records_ps_records_nsq_proto_rawDescData = file_records_ps_records_nsq_proto_rawDesc +) + +func file_records_ps_records_nsq_proto_rawDescGZIP() []byte { + file_records_ps_records_nsq_proto_rawDescOnce.Do(func() { + file_records_ps_records_nsq_proto_rawDescData = protoimpl.X.CompressGZIP(file_records_ps_records_nsq_proto_rawDescData) + }) + return file_records_ps_records_nsq_proto_rawDescData +} + +var file_records_ps_records_nsq_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_records_ps_records_nsq_proto_goTypes = []interface{}{ + (*NSQ)(nil), // 0: protos.records.NSQ +} +var file_records_ps_records_nsq_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_records_ps_records_nsq_proto_init() } +func file_records_ps_records_nsq_proto_init() { + if File_records_ps_records_nsq_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_records_ps_records_nsq_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NSQ); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_records_ps_records_nsq_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_records_ps_records_nsq_proto_goTypes, + DependencyIndexes: file_records_ps_records_nsq_proto_depIdxs, + MessageInfos: file_records_ps_records_nsq_proto_msgTypes, + }.Build() + File_records_ps_records_nsq_proto = out.File + file_records_ps_records_nsq_proto_rawDesc = nil + file_records_ps_records_nsq_proto_goTypes = nil + file_records_ps_records_nsq_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_postgres.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_postgres.pb.go index f3002dc37..19c04382b 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_postgres.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_postgres.pb.go @@ -1,102 +1,174 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: records/ps_records_postgres.proto package records import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type Postgres struct { - Metadata map[string]string `protobuf:"bytes,1,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *Postgres) Reset() { *m = Postgres{} } -func (m *Postgres) String() string { return proto.CompactTextString(m) } -func (*Postgres) ProtoMessage() {} -func (*Postgres) Descriptor() ([]byte, []int) { - return fileDescriptor_060be6784fc7daeb, []int{0} + Metadata map[string]string `protobuf:"bytes,1,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` } -func (m *Postgres) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Postgres.Unmarshal(m, b) -} -func (m *Postgres) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Postgres.Marshal(b, m, deterministic) -} -func (m *Postgres) XXX_Merge(src proto.Message) { - xxx_messageInfo_Postgres.Merge(m, src) +func (x *Postgres) Reset() { + *x = Postgres{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_postgres_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Postgres) XXX_Size() int { - return xxx_messageInfo_Postgres.Size(m) + +func (x *Postgres) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Postgres) XXX_DiscardUnknown() { - xxx_messageInfo_Postgres.DiscardUnknown(m) + +func (*Postgres) ProtoMessage() {} + +func (x *Postgres) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_postgres_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_Postgres proto.InternalMessageInfo +// Deprecated: Use Postgres.ProtoReflect.Descriptor instead. +func (*Postgres) Descriptor() ([]byte, []int) { + return file_records_ps_records_postgres_proto_rawDescGZIP(), []int{0} +} -func (m *Postgres) GetMetadata() map[string]string { - if m != nil { - return m.Metadata +func (x *Postgres) GetMetadata() map[string]string { + if x != nil { + return x.Metadata } return nil } -func (m *Postgres) GetTimestamp() int64 { - if m != nil { - return m.Timestamp +func (x *Postgres) GetTimestamp() int64 { + if x != nil { + return x.Timestamp } return 0 } -func (m *Postgres) GetValue() []byte { - if m != nil { - return m.Value +func (x *Postgres) GetValue() []byte { + if x != nil { + return x.Value } return nil } -func init() { - proto.RegisterType((*Postgres)(nil), "protos.records.Postgres") - proto.RegisterMapType((map[string]string)(nil), "protos.records.Postgres.MetadataEntry") +var File_records_ps_records_postgres_proto protoreflect.FileDescriptor + +var file_records_ps_records_postgres_proto_rawDesc = []byte{ + 0x0a, 0x21, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, + 0x72, 0x64, 0x73, 0x22, 0xbf, 0x01, 0x0a, 0x08, 0x50, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, + 0x12, 0x42, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, + 0x72, 0x64, 0x73, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x2e, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, + 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x72, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_records_ps_records_postgres_proto_rawDescOnce sync.Once + file_records_ps_records_postgres_proto_rawDescData = file_records_ps_records_postgres_proto_rawDesc +) + +func file_records_ps_records_postgres_proto_rawDescGZIP() []byte { + file_records_ps_records_postgres_proto_rawDescOnce.Do(func() { + file_records_ps_records_postgres_proto_rawDescData = protoimpl.X.CompressGZIP(file_records_ps_records_postgres_proto_rawDescData) + }) + return file_records_ps_records_postgres_proto_rawDescData } -func init() { proto.RegisterFile("records/ps_records_postgres.proto", fileDescriptor_060be6784fc7daeb) } - -var fileDescriptor_060be6784fc7daeb = []byte{ - // 237 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x8f, 0x4f, 0x4b, 0xc4, 0x30, - 0x14, 0xc4, 0x49, 0x8b, 0xb2, 0x1b, 0xff, 0x20, 0xc1, 0x43, 0x11, 0x0f, 0xd5, 0x83, 0xf4, 0x62, - 0x02, 0x7a, 0x11, 0x15, 0x0f, 0x0b, 0x1e, 0x05, 0xe9, 0xd1, 0xcb, 0x92, 0xa4, 0x8f, 0xb6, 0xd8, - 0x98, 0x90, 0xf7, 0x2a, 0xec, 0xa7, 0xf3, 0xab, 0x89, 0x6d, 0xdc, 0x65, 0x4f, 0x99, 0x99, 0xfc, - 0xe6, 0xc1, 0xf0, 0xab, 0x08, 0xd6, 0xc7, 0x06, 0x55, 0xc0, 0x75, 0x92, 0xeb, 0xe0, 0x91, 0xda, - 0x08, 0x28, 0x43, 0xf4, 0xe4, 0xc5, 0xe9, 0xf4, 0xa0, 0x4c, 0xdf, 0xd7, 0x3f, 0x8c, 0x2f, 0xde, - 0x13, 0x22, 0x56, 0x7c, 0xe1, 0x80, 0x74, 0xa3, 0x49, 0x17, 0xac, 0xcc, 0xab, 0xa3, 0xbb, 0x1b, - 0xb9, 0xcf, 0xcb, 0x7f, 0x56, 0xbe, 0x25, 0xf0, 0xf5, 0x8b, 0xe2, 0xa6, 0xde, 0xf6, 0xc4, 0x25, - 0x5f, 0x52, 0xef, 0x00, 0x49, 0xbb, 0x50, 0x64, 0x25, 0xab, 0xf2, 0x7a, 0x17, 0x88, 0x73, 0x7e, - 0xf0, 0xad, 0x87, 0x11, 0x8a, 0xbc, 0x64, 0xd5, 0x71, 0x3d, 0x9b, 0x8b, 0x27, 0x7e, 0xb2, 0x77, - 0x4e, 0x9c, 0xf1, 0xfc, 0x13, 0x36, 0x05, 0x2b, 0x59, 0xb5, 0xac, 0xff, 0xe4, 0xae, 0x98, 0x4d, - 0xd9, 0x6c, 0x1e, 0xb3, 0x07, 0xb6, 0x7a, 0xf9, 0x78, 0x6e, 0x7b, 0xea, 0x46, 0x23, 0xad, 0x77, - 0xca, 0x68, 0xb2, 0x9d, 0xf5, 0x31, 0xa8, 0x30, 0x8c, 0xce, 0x40, 0xbc, 0x45, 0xdb, 0x81, 0xd3, - 0xa8, 0xcc, 0xd8, 0x0f, 0x8d, 0x6a, 0xbd, 0x9a, 0x17, 0xa9, 0xb4, 0xc8, 0x1c, 0x4e, 0xfe, 0xfe, - 0x37, 0x00, 0x00, 0xff, 0xff, 0x7d, 0x55, 0x77, 0x75, 0x3d, 0x01, 0x00, 0x00, +var file_records_ps_records_postgres_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_records_ps_records_postgres_proto_goTypes = []interface{}{ + (*Postgres)(nil), // 0: protos.records.Postgres + nil, // 1: protos.records.Postgres.MetadataEntry +} +var file_records_ps_records_postgres_proto_depIdxs = []int32{ + 1, // 0: protos.records.Postgres.metadata:type_name -> protos.records.Postgres.MetadataEntry + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_records_ps_records_postgres_proto_init() } +func file_records_ps_records_postgres_proto_init() { + if File_records_ps_records_postgres_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_records_ps_records_postgres_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Postgres); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_records_ps_records_postgres_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_records_ps_records_postgres_proto_goTypes, + DependencyIndexes: file_records_ps_records_postgres_proto_depIdxs, + MessageInfos: file_records_ps_records_postgres_proto_msgTypes, + }.Build() + File_records_ps_records_postgres_proto = out.File + file_records_ps_records_postgres_proto_rawDesc = nil + file_records_ps_records_postgres_proto_goTypes = nil + file_records_ps_records_postgres_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_pulsar.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_pulsar.pb.go index f8942538c..65d579952 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_pulsar.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_pulsar.pb.go @@ -1,184 +1,264 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: records/ps_records_pulsar.proto package records import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type Pulsar struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - Topic string `protobuf:"bytes,3,opt,name=topic,proto3" json:"topic,omitempty"` - Properties map[string]string `protobuf:"bytes,4,rep,name=properties,proto3" json:"properties,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - RedeliveryCount uint32 `protobuf:"varint,5,opt,name=redelivery_count,json=redeliveryCount,proto3" json:"redelivery_count,omitempty"` - EventTime string `protobuf:"bytes,6,opt,name=event_time,json=eventTime,proto3" json:"event_time,omitempty"` - IsReplicated bool `protobuf:"varint,7,opt,name=is_replicated,json=isReplicated,proto3" json:"is_replicated,omitempty"` - OrderingKey string `protobuf:"bytes,8,opt,name=ordering_key,json=orderingKey,proto3" json:"ordering_key,omitempty"` - ProducerName string `protobuf:"bytes,9,opt,name=producer_name,json=producerName,proto3" json:"producer_name,omitempty"` - PublishTime string `protobuf:"bytes,10,opt,name=publish_time,json=publishTime,proto3" json:"publish_time,omitempty"` - Timestamp int64 `protobuf:"varint,11,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Value []byte `protobuf:"bytes,12,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Pulsar) Reset() { *m = Pulsar{} } -func (m *Pulsar) String() string { return proto.CompactTextString(m) } -func (*Pulsar) ProtoMessage() {} -func (*Pulsar) Descriptor() ([]byte, []int) { - return fileDescriptor_8b4bacb20b099b7e, []int{0} -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *Pulsar) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Pulsar.Unmarshal(m, b) + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Topic string `protobuf:"bytes,3,opt,name=topic,proto3" json:"topic,omitempty"` + Properties map[string]string `protobuf:"bytes,4,rep,name=properties,proto3" json:"properties,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + RedeliveryCount uint32 `protobuf:"varint,5,opt,name=redelivery_count,json=redeliveryCount,proto3" json:"redelivery_count,omitempty"` + EventTime string `protobuf:"bytes,6,opt,name=event_time,json=eventTime,proto3" json:"event_time,omitempty"` + IsReplicated bool `protobuf:"varint,7,opt,name=is_replicated,json=isReplicated,proto3" json:"is_replicated,omitempty"` + OrderingKey string `protobuf:"bytes,8,opt,name=ordering_key,json=orderingKey,proto3" json:"ordering_key,omitempty"` + ProducerName string `protobuf:"bytes,9,opt,name=producer_name,json=producerName,proto3" json:"producer_name,omitempty"` + PublishTime string `protobuf:"bytes,10,opt,name=publish_time,json=publishTime,proto3" json:"publish_time,omitempty"` + Timestamp int64 `protobuf:"varint,11,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Value []byte `protobuf:"bytes,12,opt,name=value,proto3" json:"value,omitempty"` } -func (m *Pulsar) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Pulsar.Marshal(b, m, deterministic) -} -func (m *Pulsar) XXX_Merge(src proto.Message) { - xxx_messageInfo_Pulsar.Merge(m, src) + +func (x *Pulsar) Reset() { + *x = Pulsar{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_pulsar_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Pulsar) XXX_Size() int { - return xxx_messageInfo_Pulsar.Size(m) + +func (x *Pulsar) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Pulsar) XXX_DiscardUnknown() { - xxx_messageInfo_Pulsar.DiscardUnknown(m) + +func (*Pulsar) ProtoMessage() {} + +func (x *Pulsar) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_pulsar_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_Pulsar proto.InternalMessageInfo +// Deprecated: Use Pulsar.ProtoReflect.Descriptor instead. +func (*Pulsar) Descriptor() ([]byte, []int) { + return file_records_ps_records_pulsar_proto_rawDescGZIP(), []int{0} +} -func (m *Pulsar) GetId() string { - if m != nil { - return m.Id +func (x *Pulsar) GetId() string { + if x != nil { + return x.Id } return "" } -func (m *Pulsar) GetKey() string { - if m != nil { - return m.Key +func (x *Pulsar) GetKey() string { + if x != nil { + return x.Key } return "" } -func (m *Pulsar) GetTopic() string { - if m != nil { - return m.Topic +func (x *Pulsar) GetTopic() string { + if x != nil { + return x.Topic } return "" } -func (m *Pulsar) GetProperties() map[string]string { - if m != nil { - return m.Properties +func (x *Pulsar) GetProperties() map[string]string { + if x != nil { + return x.Properties } return nil } -func (m *Pulsar) GetRedeliveryCount() uint32 { - if m != nil { - return m.RedeliveryCount +func (x *Pulsar) GetRedeliveryCount() uint32 { + if x != nil { + return x.RedeliveryCount } return 0 } -func (m *Pulsar) GetEventTime() string { - if m != nil { - return m.EventTime +func (x *Pulsar) GetEventTime() string { + if x != nil { + return x.EventTime } return "" } -func (m *Pulsar) GetIsReplicated() bool { - if m != nil { - return m.IsReplicated +func (x *Pulsar) GetIsReplicated() bool { + if x != nil { + return x.IsReplicated } return false } -func (m *Pulsar) GetOrderingKey() string { - if m != nil { - return m.OrderingKey +func (x *Pulsar) GetOrderingKey() string { + if x != nil { + return x.OrderingKey } return "" } -func (m *Pulsar) GetProducerName() string { - if m != nil { - return m.ProducerName +func (x *Pulsar) GetProducerName() string { + if x != nil { + return x.ProducerName } return "" } -func (m *Pulsar) GetPublishTime() string { - if m != nil { - return m.PublishTime +func (x *Pulsar) GetPublishTime() string { + if x != nil { + return x.PublishTime } return "" } -func (m *Pulsar) GetTimestamp() int64 { - if m != nil { - return m.Timestamp +func (x *Pulsar) GetTimestamp() int64 { + if x != nil { + return x.Timestamp } return 0 } -func (m *Pulsar) GetValue() []byte { - if m != nil { - return m.Value +func (x *Pulsar) GetValue() []byte { + if x != nil { + return x.Value } return nil } -func init() { - proto.RegisterType((*Pulsar)(nil), "protos.records.Pulsar") - proto.RegisterMapType((map[string]string)(nil), "protos.records.Pulsar.PropertiesEntry") -} - -func init() { proto.RegisterFile("records/ps_records_pulsar.proto", fileDescriptor_8b4bacb20b099b7e) } - -var fileDescriptor_8b4bacb20b099b7e = []byte{ - // 386 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x91, 0x4f, 0x8b, 0xd4, 0x30, - 0x18, 0xc6, 0xc9, 0xd4, 0x1d, 0x77, 0x32, 0xdd, 0x3f, 0x04, 0x0f, 0x41, 0x14, 0xab, 0x82, 0xd4, - 0x83, 0x2d, 0xe8, 0x45, 0x44, 0x3d, 0x28, 0x7a, 0x11, 0x64, 0x29, 0x9e, 0xbc, 0x94, 0x34, 0x79, - 0x99, 0x09, 0x36, 0x4d, 0xc8, 0x9f, 0x81, 0x7e, 0x50, 0xbf, 0x8f, 0x24, 0xe9, 0xec, 0x3a, 0x7b, - 0x4a, 0x9e, 0x5f, 0xde, 0x3c, 0x79, 0xf3, 0x3e, 0xf8, 0x99, 0x05, 0xae, 0xad, 0x70, 0xad, 0x71, - 0xfd, 0xb2, 0xed, 0x4d, 0x18, 0x1d, 0xb3, 0x8d, 0xb1, 0xda, 0x6b, 0x72, 0x99, 0x16, 0xd7, 0x2c, - 0x87, 0x2f, 0xfe, 0x16, 0x78, 0x7d, 0x93, 0x0a, 0xc8, 0x25, 0x5e, 0x49, 0x41, 0x51, 0x85, 0xea, - 0x4d, 0xb7, 0x92, 0x82, 0x5c, 0xe3, 0xe2, 0x0f, 0xcc, 0x74, 0x95, 0x40, 0xdc, 0x92, 0x47, 0xf8, - 0xcc, 0x6b, 0x23, 0x39, 0x2d, 0x12, 0xcb, 0x82, 0x7c, 0xc7, 0xd8, 0x58, 0x6d, 0xc0, 0x7a, 0x09, - 0x8e, 0x3e, 0xa8, 0x8a, 0x7a, 0xfb, 0xf6, 0x55, 0x73, 0xfa, 0x4e, 0x93, 0xdf, 0x68, 0x6e, 0x6e, - 0x0b, 0xbf, 0x4d, 0xde, 0xce, 0xdd, 0x7f, 0x37, 0xc9, 0x6b, 0x7c, 0x6d, 0x41, 0xc0, 0x28, 0x0f, - 0x60, 0xe7, 0x9e, 0xeb, 0x30, 0x79, 0x7a, 0x56, 0xa1, 0xfa, 0xa2, 0xbb, 0xba, 0xe3, 0x5f, 0x23, - 0x26, 0x4f, 0x31, 0x86, 0x03, 0x4c, 0xbe, 0xf7, 0x52, 0x01, 0x5d, 0xa7, 0x6e, 0x36, 0x89, 0xfc, - 0x92, 0x0a, 0xc8, 0x4b, 0x7c, 0x21, 0xe3, 0xff, 0xcd, 0x28, 0x39, 0xf3, 0x20, 0xe8, 0xc3, 0x0a, - 0xd5, 0xe7, 0x5d, 0x29, 0x5d, 0x77, 0xcb, 0xc8, 0x73, 0x5c, 0x6a, 0x2b, 0xc0, 0xca, 0x69, 0xd7, - 0xc7, 0x7f, 0x9e, 0x27, 0x97, 0xed, 0x91, 0xfd, 0x80, 0x39, 0xfa, 0x18, 0xab, 0x45, 0xe0, 0x60, - 0xfb, 0x89, 0x29, 0xa0, 0x9b, 0x54, 0x53, 0x1e, 0xe1, 0x4f, 0xa6, 0x20, 0xfa, 0x98, 0x30, 0x8c, - 0xd2, 0xed, 0x73, 0x37, 0x38, 0xfb, 0x2c, 0x2c, 0xf5, 0xf3, 0x04, 0x6f, 0xe2, 0x91, 0xf3, 0x4c, - 0x19, 0xba, 0xad, 0x50, 0x5d, 0x74, 0x77, 0x20, 0x4e, 0xf5, 0xc0, 0xc6, 0x00, 0xb4, 0xac, 0x50, - 0x5d, 0x76, 0x59, 0x3c, 0xfe, 0x84, 0xaf, 0xee, 0x0d, 0xeb, 0x18, 0x08, 0x3a, 0x09, 0x24, 0x5f, - 0xcd, 0x21, 0x65, 0xf1, 0x61, 0xf5, 0x1e, 0x7d, 0xf9, 0xfc, 0xfb, 0xe3, 0x4e, 0xfa, 0x7d, 0x18, - 0x1a, 0xae, 0x55, 0x3b, 0x30, 0xcf, 0xf7, 0x5c, 0x5b, 0xd3, 0x9a, 0x31, 0xa8, 0x01, 0xec, 0x1b, - 0xc7, 0xf7, 0xa0, 0x98, 0x6b, 0x87, 0x20, 0x47, 0xd1, 0xee, 0x74, 0x9b, 0xf3, 0x6a, 0x97, 0xbc, - 0x86, 0x75, 0xd2, 0xef, 0xfe, 0x05, 0x00, 0x00, 0xff, 0xff, 0xee, 0x0e, 0x48, 0xee, 0x51, 0x02, - 0x00, 0x00, +var File_records_ps_records_pulsar_proto protoreflect.FileDescriptor + +var file_records_ps_records_pulsar_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x70, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x73, 0x22, 0xd5, 0x03, 0x0a, 0x06, 0x50, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, + 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, + 0x6f, 0x70, 0x69, 0x63, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, + 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x50, 0x75, 0x6c, 0x73, 0x61, 0x72, + 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x29, 0x0a, 0x10, + 0x72, 0x65, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x72, 0x65, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, + 0x72, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, + 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x69, 0x73, 0x5f, 0x72, 0x65, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, + 0x73, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x6f, + 0x72, 0x64, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x23, + 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x72, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x5f, 0x74, + 0x69, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x75, 0x62, 0x6c, 0x69, + 0x73, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0c, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x3d, 0x0a, 0x0f, 0x50, 0x72, + 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, + 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, + 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_records_ps_records_pulsar_proto_rawDescOnce sync.Once + file_records_ps_records_pulsar_proto_rawDescData = file_records_ps_records_pulsar_proto_rawDesc +) + +func file_records_ps_records_pulsar_proto_rawDescGZIP() []byte { + file_records_ps_records_pulsar_proto_rawDescOnce.Do(func() { + file_records_ps_records_pulsar_proto_rawDescData = protoimpl.X.CompressGZIP(file_records_ps_records_pulsar_proto_rawDescData) + }) + return file_records_ps_records_pulsar_proto_rawDescData +} + +var file_records_ps_records_pulsar_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_records_ps_records_pulsar_proto_goTypes = []interface{}{ + (*Pulsar)(nil), // 0: protos.records.Pulsar + nil, // 1: protos.records.Pulsar.PropertiesEntry +} +var file_records_ps_records_pulsar_proto_depIdxs = []int32{ + 1, // 0: protos.records.Pulsar.properties:type_name -> protos.records.Pulsar.PropertiesEntry + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_records_ps_records_pulsar_proto_init() } +func file_records_ps_records_pulsar_proto_init() { + if File_records_ps_records_pulsar_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_records_ps_records_pulsar_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Pulsar); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_records_ps_records_pulsar_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_records_ps_records_pulsar_proto_goTypes, + DependencyIndexes: file_records_ps_records_pulsar_proto_depIdxs, + MessageInfos: file_records_ps_records_pulsar_proto_msgTypes, + }.Build() + File_records_ps_records_pulsar_proto = out.File + file_records_ps_records_pulsar_proto_rawDesc = nil + file_records_ps_records_pulsar_proto_goTypes = nil + file_records_ps_records_pulsar_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_rabbit.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_rabbit.pb.go index b5064bb5b..1b99d7d48 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_rabbit.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_rabbit.pb.go @@ -1,256 +1,359 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: records/ps_records_rabbit.proto package records import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type RabbitHeader struct { - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *RabbitHeader) Reset() { *m = RabbitHeader{} } -func (m *RabbitHeader) String() string { return proto.CompactTextString(m) } -func (*RabbitHeader) ProtoMessage() {} -func (*RabbitHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_d786d860e4447439, []int{0} + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` } -func (m *RabbitHeader) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RabbitHeader.Unmarshal(m, b) -} -func (m *RabbitHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RabbitHeader.Marshal(b, m, deterministic) -} -func (m *RabbitHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_RabbitHeader.Merge(m, src) +func (x *RabbitHeader) Reset() { + *x = RabbitHeader{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_rabbit_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RabbitHeader) XXX_Size() int { - return xxx_messageInfo_RabbitHeader.Size(m) + +func (x *RabbitHeader) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RabbitHeader) XXX_DiscardUnknown() { - xxx_messageInfo_RabbitHeader.DiscardUnknown(m) + +func (*RabbitHeader) ProtoMessage() {} + +func (x *RabbitHeader) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_rabbit_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RabbitHeader proto.InternalMessageInfo +// Deprecated: Use RabbitHeader.ProtoReflect.Descriptor instead. +func (*RabbitHeader) Descriptor() ([]byte, []int) { + return file_records_ps_records_rabbit_proto_rawDescGZIP(), []int{0} +} -func (m *RabbitHeader) GetKey() string { - if m != nil { - return m.Key +func (x *RabbitHeader) GetKey() string { + if x != nil { + return x.Key } return "" } -func (m *RabbitHeader) GetValue() string { - if m != nil { - return m.Value +func (x *RabbitHeader) GetValue() string { + if x != nil { + return x.Value } return "" } type Rabbit struct { - Body []byte `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` - Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` - Exchange string `protobuf:"bytes,4,opt,name=exchange,proto3" json:"exchange,omitempty"` - RoutingKey string `protobuf:"bytes,5,opt,name=routing_key,json=routingKey,proto3" json:"routing_key,omitempty"` - ContentType string `protobuf:"bytes,6,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` - ContentEncoding string `protobuf:"bytes,7,opt,name=content_encoding,json=contentEncoding,proto3" json:"content_encoding,omitempty"` - Priority int32 `protobuf:"varint,8,opt,name=priority,proto3" json:"priority,omitempty"` - Expiration string `protobuf:"bytes,9,opt,name=expiration,proto3" json:"expiration,omitempty"` - MessageId string `protobuf:"bytes,10,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` - UserId string `protobuf:"bytes,11,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` - AppId string `protobuf:"bytes,12,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"` - ReplyTo string `protobuf:"bytes,13,opt,name=reply_to,json=replyTo,proto3" json:"reply_to,omitempty"` - CorrelationId string `protobuf:"bytes,14,opt,name=correlation_id,json=correlationId,proto3" json:"correlation_id,omitempty"` - Headers []*RabbitHeader `protobuf:"bytes,15,rep,name=headers,proto3" json:"headers,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Rabbit) Reset() { *m = Rabbit{} } -func (m *Rabbit) String() string { return proto.CompactTextString(m) } -func (*Rabbit) ProtoMessage() {} -func (*Rabbit) Descriptor() ([]byte, []int) { - return fileDescriptor_d786d860e4447439, []int{1} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Body []byte `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` + Exchange string `protobuf:"bytes,4,opt,name=exchange,proto3" json:"exchange,omitempty"` + RoutingKey string `protobuf:"bytes,5,opt,name=routing_key,json=routingKey,proto3" json:"routing_key,omitempty"` + ContentType string `protobuf:"bytes,6,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` + ContentEncoding string `protobuf:"bytes,7,opt,name=content_encoding,json=contentEncoding,proto3" json:"content_encoding,omitempty"` + Priority int32 `protobuf:"varint,8,opt,name=priority,proto3" json:"priority,omitempty"` + Expiration string `protobuf:"bytes,9,opt,name=expiration,proto3" json:"expiration,omitempty"` + MessageId string `protobuf:"bytes,10,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` + UserId string `protobuf:"bytes,11,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + AppId string `protobuf:"bytes,12,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"` + ReplyTo string `protobuf:"bytes,13,opt,name=reply_to,json=replyTo,proto3" json:"reply_to,omitempty"` + CorrelationId string `protobuf:"bytes,14,opt,name=correlation_id,json=correlationId,proto3" json:"correlation_id,omitempty"` + Headers []*RabbitHeader `protobuf:"bytes,15,rep,name=headers,proto3" json:"headers,omitempty"` +} + +func (x *Rabbit) Reset() { + *x = Rabbit{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_rabbit_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Rabbit) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Rabbit.Unmarshal(m, b) -} -func (m *Rabbit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Rabbit.Marshal(b, m, deterministic) +func (x *Rabbit) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Rabbit) XXX_Merge(src proto.Message) { - xxx_messageInfo_Rabbit.Merge(m, src) -} -func (m *Rabbit) XXX_Size() int { - return xxx_messageInfo_Rabbit.Size(m) -} -func (m *Rabbit) XXX_DiscardUnknown() { - xxx_messageInfo_Rabbit.DiscardUnknown(m) + +func (*Rabbit) ProtoMessage() {} + +func (x *Rabbit) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_rabbit_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_Rabbit proto.InternalMessageInfo +// Deprecated: Use Rabbit.ProtoReflect.Descriptor instead. +func (*Rabbit) Descriptor() ([]byte, []int) { + return file_records_ps_records_rabbit_proto_rawDescGZIP(), []int{1} +} -func (m *Rabbit) GetBody() []byte { - if m != nil { - return m.Body +func (x *Rabbit) GetBody() []byte { + if x != nil { + return x.Body } return nil } -func (m *Rabbit) GetTimestamp() int64 { - if m != nil { - return m.Timestamp +func (x *Rabbit) GetTimestamp() int64 { + if x != nil { + return x.Timestamp } return 0 } -func (m *Rabbit) GetType() string { - if m != nil { - return m.Type +func (x *Rabbit) GetType() string { + if x != nil { + return x.Type } return "" } -func (m *Rabbit) GetExchange() string { - if m != nil { - return m.Exchange +func (x *Rabbit) GetExchange() string { + if x != nil { + return x.Exchange } return "" } -func (m *Rabbit) GetRoutingKey() string { - if m != nil { - return m.RoutingKey +func (x *Rabbit) GetRoutingKey() string { + if x != nil { + return x.RoutingKey } return "" } -func (m *Rabbit) GetContentType() string { - if m != nil { - return m.ContentType +func (x *Rabbit) GetContentType() string { + if x != nil { + return x.ContentType } return "" } -func (m *Rabbit) GetContentEncoding() string { - if m != nil { - return m.ContentEncoding +func (x *Rabbit) GetContentEncoding() string { + if x != nil { + return x.ContentEncoding } return "" } -func (m *Rabbit) GetPriority() int32 { - if m != nil { - return m.Priority +func (x *Rabbit) GetPriority() int32 { + if x != nil { + return x.Priority } return 0 } -func (m *Rabbit) GetExpiration() string { - if m != nil { - return m.Expiration +func (x *Rabbit) GetExpiration() string { + if x != nil { + return x.Expiration } return "" } -func (m *Rabbit) GetMessageId() string { - if m != nil { - return m.MessageId +func (x *Rabbit) GetMessageId() string { + if x != nil { + return x.MessageId } return "" } -func (m *Rabbit) GetUserId() string { - if m != nil { - return m.UserId +func (x *Rabbit) GetUserId() string { + if x != nil { + return x.UserId } return "" } -func (m *Rabbit) GetAppId() string { - if m != nil { - return m.AppId +func (x *Rabbit) GetAppId() string { + if x != nil { + return x.AppId } return "" } -func (m *Rabbit) GetReplyTo() string { - if m != nil { - return m.ReplyTo +func (x *Rabbit) GetReplyTo() string { + if x != nil { + return x.ReplyTo } return "" } -func (m *Rabbit) GetCorrelationId() string { - if m != nil { - return m.CorrelationId +func (x *Rabbit) GetCorrelationId() string { + if x != nil { + return x.CorrelationId } return "" } -func (m *Rabbit) GetHeaders() []*RabbitHeader { - if m != nil { - return m.Headers +func (x *Rabbit) GetHeaders() []*RabbitHeader { + if x != nil { + return x.Headers } return nil } -func init() { - proto.RegisterType((*RabbitHeader)(nil), "protos.records.RabbitHeader") - proto.RegisterType((*Rabbit)(nil), "protos.records.Rabbit") -} - -func init() { proto.RegisterFile("records/ps_records_rabbit.proto", fileDescriptor_d786d860e4447439) } - -var fileDescriptor_d786d860e4447439 = []byte{ - // 415 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x92, 0x5f, 0x8b, 0xd4, 0x30, - 0x14, 0xc5, 0x59, 0xbb, 0xd3, 0x99, 0xb9, 0x33, 0x3b, 0xbb, 0x04, 0xc5, 0x28, 0xab, 0x3b, 0x2e, - 0x08, 0xe3, 0x83, 0x2d, 0x28, 0xec, 0x93, 0xf8, 0x20, 0x08, 0x0e, 0xbe, 0x95, 0x7d, 0xf2, 0xa5, - 0xa4, 0xc9, 0xa5, 0x0d, 0xb6, 0x4d, 0x48, 0x52, 0xd9, 0x7e, 0x59, 0x3f, 0x8b, 0xe4, 0xb6, 0xfb, - 0xc7, 0xa7, 0xde, 0xf3, 0x3b, 0xf7, 0x9c, 0x86, 0xa6, 0x70, 0xe5, 0x50, 0x1a, 0xa7, 0x7c, 0x6e, - 0x7d, 0x39, 0x8f, 0xa5, 0x13, 0x55, 0xa5, 0x43, 0x66, 0x9d, 0x09, 0x86, 0xed, 0xe8, 0xe1, 0xb3, - 0xd9, 0xbc, 0xbe, 0x81, 0x6d, 0x41, 0xfe, 0x0f, 0x14, 0x0a, 0x1d, 0xbb, 0x80, 0xe4, 0x37, 0x8e, - 0xfc, 0x64, 0x7f, 0x72, 0x58, 0x17, 0x71, 0x64, 0xcf, 0x61, 0xf1, 0x47, 0xb4, 0x03, 0xf2, 0x67, - 0xc4, 0x26, 0x71, 0xfd, 0x37, 0x81, 0x74, 0x0a, 0x32, 0x06, 0xa7, 0x95, 0x51, 0x53, 0x66, 0x5b, - 0xd0, 0xcc, 0x2e, 0x61, 0x1d, 0x74, 0x87, 0x3e, 0x88, 0xce, 0x52, 0x30, 0x29, 0x1e, 0x41, 0x4c, - 0x84, 0xd1, 0x22, 0x4f, 0xa8, 0x91, 0x66, 0xf6, 0x1a, 0x56, 0x78, 0x27, 0x1b, 0xd1, 0xd7, 0xc8, - 0x4f, 0x89, 0x3f, 0x68, 0x76, 0x05, 0x1b, 0x67, 0x86, 0xa0, 0xfb, 0xba, 0x8c, 0x87, 0x5b, 0x90, - 0x0d, 0x33, 0xfa, 0x89, 0x23, 0x7b, 0x07, 0x5b, 0x69, 0xfa, 0x80, 0x7d, 0x28, 0xa9, 0x38, 0xa5, - 0x8d, 0xcd, 0xcc, 0x6e, 0x63, 0xff, 0x07, 0xb8, 0xb8, 0x5f, 0xc1, 0x5e, 0x1a, 0xa5, 0xfb, 0x9a, - 0x2f, 0x69, 0xed, 0x7c, 0xe6, 0xdf, 0x67, 0x1c, 0x8f, 0x62, 0x9d, 0x36, 0x4e, 0x87, 0x91, 0xaf, - 0xf6, 0x27, 0x87, 0x45, 0xf1, 0xa0, 0xd9, 0x5b, 0x00, 0xbc, 0xb3, 0xda, 0x89, 0xa0, 0x4d, 0xcf, - 0xd7, 0xd3, 0x49, 0x1e, 0x09, 0x7b, 0x03, 0xd0, 0xa1, 0xf7, 0xa2, 0xc6, 0x52, 0x2b, 0x0e, 0xe4, - 0xaf, 0x67, 0x72, 0x54, 0xec, 0x25, 0x2c, 0x07, 0x8f, 0x2e, 0x7a, 0x1b, 0xf2, 0xd2, 0x28, 0x8f, - 0x8a, 0xbd, 0x80, 0x54, 0x58, 0x1b, 0xf9, 0x76, 0xfa, 0xcc, 0xc2, 0xda, 0xa3, 0x62, 0xaf, 0x60, - 0xe5, 0xd0, 0xb6, 0x63, 0x19, 0x0c, 0x3f, 0x23, 0x63, 0x49, 0xfa, 0xd6, 0xb0, 0xf7, 0xb0, 0x93, - 0xc6, 0x39, 0x6c, 0xe9, 0xc5, 0x31, 0xb9, 0xa3, 0x85, 0xb3, 0x27, 0xf4, 0xa8, 0xd8, 0x0d, 0x2c, - 0x1b, 0xba, 0x5a, 0xcf, 0xcf, 0xf7, 0xc9, 0x61, 0xf3, 0xe9, 0x32, 0xfb, 0xff, 0x17, 0xc8, 0x9e, - 0xde, 0x7f, 0x71, 0xbf, 0xfc, 0xed, 0xeb, 0xaf, 0x2f, 0xb5, 0x0e, 0xcd, 0x50, 0x65, 0xd2, 0x74, - 0x79, 0x25, 0x82, 0x6c, 0xa4, 0x71, 0x36, 0xb7, 0xed, 0xd0, 0x55, 0xe8, 0x3e, 0x7a, 0xd9, 0x60, - 0x27, 0x7c, 0x5e, 0x0d, 0xba, 0x55, 0x79, 0x6d, 0xf2, 0xa9, 0x35, 0x9f, 0x5b, 0xab, 0x94, 0xf4, - 0xe7, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x30, 0x1b, 0xbb, 0xe5, 0x92, 0x02, 0x00, 0x00, +var File_records_ps_records_rabbit_proto protoreflect.FileDescriptor + +var file_records_ps_records_rabbit_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x73, 0x22, 0x36, 0x0a, 0x0c, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xde, 0x03, 0x0a, 0x06, 0x52, 0x61, + 0x62, 0x62, 0x69, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x78, + 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x78, + 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x6f, 0x75, 0x74, 0x69, 0x6e, + 0x67, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x6f, 0x75, + 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x45, 0x6e, 0x63, + 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, + 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x61, 0x70, 0x70, + 0x5f, 0x69, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, + 0x12, 0x19, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x5f, 0x74, 0x6f, 0x18, 0x0d, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x12, 0x25, 0x0a, 0x0e, 0x63, + 0x6f, 0x72, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x0e, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x72, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x49, 0x64, 0x12, 0x36, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x0f, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, + 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_records_ps_records_rabbit_proto_rawDescOnce sync.Once + file_records_ps_records_rabbit_proto_rawDescData = file_records_ps_records_rabbit_proto_rawDesc +) + +func file_records_ps_records_rabbit_proto_rawDescGZIP() []byte { + file_records_ps_records_rabbit_proto_rawDescOnce.Do(func() { + file_records_ps_records_rabbit_proto_rawDescData = protoimpl.X.CompressGZIP(file_records_ps_records_rabbit_proto_rawDescData) + }) + return file_records_ps_records_rabbit_proto_rawDescData +} + +var file_records_ps_records_rabbit_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_records_ps_records_rabbit_proto_goTypes = []interface{}{ + (*RabbitHeader)(nil), // 0: protos.records.RabbitHeader + (*Rabbit)(nil), // 1: protos.records.Rabbit +} +var file_records_ps_records_rabbit_proto_depIdxs = []int32{ + 0, // 0: protos.records.Rabbit.headers:type_name -> protos.records.RabbitHeader + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_records_ps_records_rabbit_proto_init() } +func file_records_ps_records_rabbit_proto_init() { + if File_records_ps_records_rabbit_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_records_ps_records_rabbit_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RabbitHeader); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_records_ps_records_rabbit_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Rabbit); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_records_ps_records_rabbit_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_records_ps_records_rabbit_proto_goTypes, + DependencyIndexes: file_records_ps_records_rabbit_proto_depIdxs, + MessageInfos: file_records_ps_records_rabbit_proto_msgTypes, + }.Build() + File_records_ps_records_rabbit_proto = out.File + file_records_ps_records_rabbit_proto_rawDesc = nil + file_records_ps_records_rabbit_proto_goTypes = nil + file_records_ps_records_rabbit_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_rabbit_streams.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_rabbit_streams.pb.go index 970d7df26..156b4557a 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_rabbit_streams.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_rabbit_streams.pb.go @@ -1,229 +1,334 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: records/ps_records_rabbit_streams.proto package records import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type RabbitStreams struct { - DeliveryTag string `protobuf:"bytes,1,opt,name=delivery_tag,json=deliveryTag,proto3" json:"delivery_tag,omitempty"` - Format uint32 `protobuf:"varint,2,opt,name=format,proto3" json:"format,omitempty"` - Header *RabbitStreamsHeader `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` - DeliveryAnnotations map[string]string `protobuf:"bytes,4,rep,name=delivery_annotations,json=deliveryAnnotations,proto3" json:"delivery_annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - SendSettled bool `protobuf:"varint,5,opt,name=send_settled,json=sendSettled,proto3" json:"send_settled,omitempty"` - StreamName string `protobuf:"bytes,6,opt,name=stream_name,json=streamName,proto3" json:"stream_name,omitempty"` - Timestamp int64 `protobuf:"varint,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Value []byte `protobuf:"bytes,8,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RabbitStreams) Reset() { *m = RabbitStreams{} } -func (m *RabbitStreams) String() string { return proto.CompactTextString(m) } -func (*RabbitStreams) ProtoMessage() {} -func (*RabbitStreams) Descriptor() ([]byte, []int) { - return fileDescriptor_250c2fd462ce0029, []int{0} -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *RabbitStreams) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RabbitStreams.Unmarshal(m, b) -} -func (m *RabbitStreams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RabbitStreams.Marshal(b, m, deterministic) + DeliveryTag string `protobuf:"bytes,1,opt,name=delivery_tag,json=deliveryTag,proto3" json:"delivery_tag,omitempty"` + Format uint32 `protobuf:"varint,2,opt,name=format,proto3" json:"format,omitempty"` + Header *RabbitStreamsHeader `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` + DeliveryAnnotations map[string]string `protobuf:"bytes,4,rep,name=delivery_annotations,json=deliveryAnnotations,proto3" json:"delivery_annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + SendSettled bool `protobuf:"varint,5,opt,name=send_settled,json=sendSettled,proto3" json:"send_settled,omitempty"` + StreamName string `protobuf:"bytes,6,opt,name=stream_name,json=streamName,proto3" json:"stream_name,omitempty"` + Timestamp int64 `protobuf:"varint,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Value []byte `protobuf:"bytes,8,opt,name=value,proto3" json:"value,omitempty"` } -func (m *RabbitStreams) XXX_Merge(src proto.Message) { - xxx_messageInfo_RabbitStreams.Merge(m, src) + +func (x *RabbitStreams) Reset() { + *x = RabbitStreams{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_rabbit_streams_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RabbitStreams) XXX_Size() int { - return xxx_messageInfo_RabbitStreams.Size(m) + +func (x *RabbitStreams) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RabbitStreams) XXX_DiscardUnknown() { - xxx_messageInfo_RabbitStreams.DiscardUnknown(m) + +func (*RabbitStreams) ProtoMessage() {} + +func (x *RabbitStreams) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_rabbit_streams_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RabbitStreams proto.InternalMessageInfo +// Deprecated: Use RabbitStreams.ProtoReflect.Descriptor instead. +func (*RabbitStreams) Descriptor() ([]byte, []int) { + return file_records_ps_records_rabbit_streams_proto_rawDescGZIP(), []int{0} +} -func (m *RabbitStreams) GetDeliveryTag() string { - if m != nil { - return m.DeliveryTag +func (x *RabbitStreams) GetDeliveryTag() string { + if x != nil { + return x.DeliveryTag } return "" } -func (m *RabbitStreams) GetFormat() uint32 { - if m != nil { - return m.Format +func (x *RabbitStreams) GetFormat() uint32 { + if x != nil { + return x.Format } return 0 } -func (m *RabbitStreams) GetHeader() *RabbitStreamsHeader { - if m != nil { - return m.Header +func (x *RabbitStreams) GetHeader() *RabbitStreamsHeader { + if x != nil { + return x.Header } return nil } -func (m *RabbitStreams) GetDeliveryAnnotations() map[string]string { - if m != nil { - return m.DeliveryAnnotations +func (x *RabbitStreams) GetDeliveryAnnotations() map[string]string { + if x != nil { + return x.DeliveryAnnotations } return nil } -func (m *RabbitStreams) GetSendSettled() bool { - if m != nil { - return m.SendSettled +func (x *RabbitStreams) GetSendSettled() bool { + if x != nil { + return x.SendSettled } return false } -func (m *RabbitStreams) GetStreamName() string { - if m != nil { - return m.StreamName +func (x *RabbitStreams) GetStreamName() string { + if x != nil { + return x.StreamName } return "" } -func (m *RabbitStreams) GetTimestamp() int64 { - if m != nil { - return m.Timestamp +func (x *RabbitStreams) GetTimestamp() int64 { + if x != nil { + return x.Timestamp } return 0 } -func (m *RabbitStreams) GetValue() []byte { - if m != nil { - return m.Value +func (x *RabbitStreams) GetValue() []byte { + if x != nil { + return x.Value } return nil } type RabbitStreamsHeader struct { - Durable bool `protobuf:"varint,1,opt,name=durable,proto3" json:"durable,omitempty"` - Priority uint32 `protobuf:"varint,2,opt,name=priority,proto3" json:"priority,omitempty"` - Ttl int64 `protobuf:"varint,3,opt,name=ttl,proto3" json:"ttl,omitempty"` - FirstAcquirer bool `protobuf:"varint,4,opt,name=first_acquirer,json=firstAcquirer,proto3" json:"first_acquirer,omitempty"` - DeliveryCount uint32 `protobuf:"varint,5,opt,name=delivery_count,json=deliveryCount,proto3" json:"delivery_count,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RabbitStreamsHeader) Reset() { *m = RabbitStreamsHeader{} } -func (m *RabbitStreamsHeader) String() string { return proto.CompactTextString(m) } -func (*RabbitStreamsHeader) ProtoMessage() {} -func (*RabbitStreamsHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_250c2fd462ce0029, []int{1} -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *RabbitStreamsHeader) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RabbitStreamsHeader.Unmarshal(m, b) -} -func (m *RabbitStreamsHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RabbitStreamsHeader.Marshal(b, m, deterministic) + Durable bool `protobuf:"varint,1,opt,name=durable,proto3" json:"durable,omitempty"` + Priority uint32 `protobuf:"varint,2,opt,name=priority,proto3" json:"priority,omitempty"` + Ttl int64 `protobuf:"varint,3,opt,name=ttl,proto3" json:"ttl,omitempty"` + FirstAcquirer bool `protobuf:"varint,4,opt,name=first_acquirer,json=firstAcquirer,proto3" json:"first_acquirer,omitempty"` + DeliveryCount uint32 `protobuf:"varint,5,opt,name=delivery_count,json=deliveryCount,proto3" json:"delivery_count,omitempty"` } -func (m *RabbitStreamsHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_RabbitStreamsHeader.Merge(m, src) + +func (x *RabbitStreamsHeader) Reset() { + *x = RabbitStreamsHeader{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_rabbit_streams_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RabbitStreamsHeader) XXX_Size() int { - return xxx_messageInfo_RabbitStreamsHeader.Size(m) + +func (x *RabbitStreamsHeader) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RabbitStreamsHeader) XXX_DiscardUnknown() { - xxx_messageInfo_RabbitStreamsHeader.DiscardUnknown(m) + +func (*RabbitStreamsHeader) ProtoMessage() {} + +func (x *RabbitStreamsHeader) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_rabbit_streams_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RabbitStreamsHeader proto.InternalMessageInfo +// Deprecated: Use RabbitStreamsHeader.ProtoReflect.Descriptor instead. +func (*RabbitStreamsHeader) Descriptor() ([]byte, []int) { + return file_records_ps_records_rabbit_streams_proto_rawDescGZIP(), []int{1} +} -func (m *RabbitStreamsHeader) GetDurable() bool { - if m != nil { - return m.Durable +func (x *RabbitStreamsHeader) GetDurable() bool { + if x != nil { + return x.Durable } return false } -func (m *RabbitStreamsHeader) GetPriority() uint32 { - if m != nil { - return m.Priority +func (x *RabbitStreamsHeader) GetPriority() uint32 { + if x != nil { + return x.Priority } return 0 } -func (m *RabbitStreamsHeader) GetTtl() int64 { - if m != nil { - return m.Ttl +func (x *RabbitStreamsHeader) GetTtl() int64 { + if x != nil { + return x.Ttl } return 0 } -func (m *RabbitStreamsHeader) GetFirstAcquirer() bool { - if m != nil { - return m.FirstAcquirer +func (x *RabbitStreamsHeader) GetFirstAcquirer() bool { + if x != nil { + return x.FirstAcquirer } return false } -func (m *RabbitStreamsHeader) GetDeliveryCount() uint32 { - if m != nil { - return m.DeliveryCount +func (x *RabbitStreamsHeader) GetDeliveryCount() uint32 { + if x != nil { + return x.DeliveryCount } return 0 } -func init() { - proto.RegisterType((*RabbitStreams)(nil), "protos.records.RabbitStreams") - proto.RegisterMapType((map[string]string)(nil), "protos.records.RabbitStreams.DeliveryAnnotationsEntry") - proto.RegisterType((*RabbitStreamsHeader)(nil), "protos.records.RabbitStreamsHeader") -} - -func init() { - proto.RegisterFile("records/ps_records_rabbit_streams.proto", fileDescriptor_250c2fd462ce0029) -} - -var fileDescriptor_250c2fd462ce0029 = []byte{ - // 435 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xcd, 0x6b, 0xd4, 0x40, - 0x18, 0xc6, 0x99, 0x4d, 0xbb, 0xdd, 0x4e, 0x9a, 0x22, 0xd3, 0x22, 0x43, 0x11, 0x8c, 0x15, 0x31, - 0x17, 0x13, 0xa8, 0x20, 0xa2, 0x22, 0xd4, 0x2f, 0x3c, 0x79, 0x98, 0x7a, 0xf2, 0x12, 0x26, 0xc9, - 0xdb, 0xdd, 0xc1, 0x4c, 0x26, 0xce, 0xbc, 0x29, 0xec, 0xdf, 0xe4, 0xcd, 0xbf, 0x50, 0x32, 0x99, - 0xdd, 0x65, 0xf1, 0xe3, 0x94, 0xf7, 0xf9, 0xe5, 0xfd, 0x48, 0x9e, 0x87, 0x3e, 0xb5, 0x50, 0x1b, - 0xdb, 0xb8, 0xa2, 0x77, 0x65, 0x28, 0x4b, 0x2b, 0xab, 0x4a, 0x61, 0xe9, 0xd0, 0x82, 0xd4, 0x2e, - 0xef, 0xad, 0x41, 0xc3, 0x4e, 0xfd, 0xc3, 0xe5, 0xa1, 0xe9, 0xf2, 0x57, 0x44, 0x13, 0xe1, 0x1b, - 0x6f, 0xa6, 0x3e, 0xf6, 0x88, 0x9e, 0x34, 0xd0, 0xaa, 0x3b, 0xb0, 0xeb, 0x12, 0xe5, 0x92, 0x93, - 0x94, 0x64, 0xc7, 0x22, 0xde, 0xb0, 0xaf, 0x72, 0xc9, 0xee, 0xd3, 0xf9, 0xad, 0xb1, 0x5a, 0x22, - 0x9f, 0xa5, 0x24, 0x4b, 0x44, 0x50, 0xec, 0x35, 0x9d, 0xaf, 0x40, 0x36, 0x60, 0x79, 0x94, 0x92, - 0x2c, 0xbe, 0x7a, 0x9c, 0xef, 0x5f, 0xcb, 0xf7, 0x2e, 0x7d, 0xf6, 0xad, 0x22, 0x8c, 0x30, 0x45, - 0xcf, 0xb7, 0x77, 0x65, 0xd7, 0x19, 0x94, 0xa8, 0x4c, 0xe7, 0xf8, 0x41, 0x1a, 0x65, 0xf1, 0xd5, - 0x8b, 0xff, 0xae, 0xca, 0x3f, 0x84, 0xc9, 0xeb, 0xdd, 0xe0, 0xc7, 0x0e, 0xed, 0x5a, 0x9c, 0x35, - 0x7f, 0xbe, 0x19, 0x7f, 0xd1, 0x41, 0xd7, 0x94, 0x0e, 0x10, 0x5b, 0x68, 0xf8, 0x61, 0x4a, 0xb2, - 0x85, 0x88, 0x47, 0x76, 0x33, 0x21, 0xf6, 0x90, 0xc6, 0x93, 0x71, 0x65, 0x27, 0x35, 0xf0, 0xb9, - 0x37, 0x81, 0x4e, 0xe8, 0x8b, 0xd4, 0xc0, 0x1e, 0xd0, 0x63, 0x54, 0x1a, 0x1c, 0x4a, 0xdd, 0xf3, - 0xa3, 0x94, 0x64, 0x91, 0xd8, 0x01, 0x76, 0x4e, 0x0f, 0xef, 0x64, 0x3b, 0x00, 0x5f, 0xa4, 0x24, - 0x3b, 0x11, 0x93, 0xb8, 0xf8, 0x44, 0xf9, 0xbf, 0x3e, 0x94, 0xdd, 0xa3, 0xd1, 0x77, 0x58, 0x07, - 0xb7, 0xc7, 0x72, 0xb7, 0x63, 0xe6, 0xd9, 0x24, 0x5e, 0xcd, 0x5e, 0x92, 0xcb, 0x9f, 0x84, 0x9e, - 0xfd, 0xc5, 0x4a, 0xc6, 0xe9, 0x51, 0x33, 0x58, 0x59, 0xb5, 0xe0, 0xf7, 0x2c, 0xc4, 0x46, 0xb2, - 0x0b, 0xba, 0xe8, 0xad, 0x32, 0x56, 0xe1, 0x3a, 0x64, 0xb6, 0xd5, 0xe3, 0x65, 0xc4, 0xd6, 0x47, - 0x16, 0x89, 0xb1, 0x64, 0x4f, 0xe8, 0xe9, 0xad, 0xb2, 0x0e, 0x4b, 0x59, 0xff, 0x18, 0x94, 0x05, - 0xcb, 0x0f, 0xfc, 0xba, 0xc4, 0xd3, 0xeb, 0x00, 0xc7, 0xb6, 0x6d, 0x62, 0xb5, 0x19, 0x3a, 0xf4, - 0x46, 0x26, 0x22, 0xd9, 0xd0, 0xf7, 0x23, 0x7c, 0xf7, 0xf6, 0xdb, 0x9b, 0xa5, 0xc2, 0xd5, 0x50, - 0xe5, 0xb5, 0xd1, 0x45, 0x25, 0xb1, 0x5e, 0xd5, 0xc6, 0xf6, 0x45, 0xdf, 0x0e, 0xba, 0x02, 0xfb, - 0xcc, 0xd5, 0x2b, 0xd0, 0xd2, 0x15, 0xd5, 0xa0, 0xda, 0xa6, 0x58, 0x9a, 0x62, 0x4a, 0xba, 0x08, - 0x49, 0x57, 0x73, 0xaf, 0x9f, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xed, 0x68, 0x1e, 0x6f, 0xe4, - 0x02, 0x00, 0x00, +var File_records_ps_records_rabbit_streams_proto protoreflect.FileDescriptor + +var file_records_ps_records_rabbit_streams_proto_rawDesc = []byte{ + 0x0a, 0x27, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0xb2, 0x03, 0x0a, 0x0d, 0x52, 0x61, + 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x64, + 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x54, 0x61, 0x67, 0x12, 0x16, + 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, + 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x3b, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x73, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x12, 0x69, 0x0a, 0x14, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x5f, + 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x36, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x73, 0x2e, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, + 0x2e, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x13, 0x64, 0x65, 0x6c, 0x69, 0x76, + 0x65, 0x72, 0x79, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x21, + 0x0a, 0x0c, 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x6c, 0x65, 0x64, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x73, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x74, 0x74, 0x6c, 0x65, + 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x46, 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, + 0x72, 0x79, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xab, + 0x01, 0x0a, 0x13, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x75, 0x72, 0x61, 0x62, 0x6c, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x64, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, + 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x74, 0x74, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x25, + 0x0a, 0x0e, 0x66, 0x69, 0x72, 0x73, 0x74, 0x5f, 0x61, 0x63, 0x71, 0x75, 0x69, 0x72, 0x65, 0x72, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x66, 0x69, 0x72, 0x73, 0x74, 0x41, 0x63, 0x71, + 0x75, 0x69, 0x72, 0x65, 0x72, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, + 0x79, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x64, + 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x3e, 0x5a, 0x3c, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, + 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_records_ps_records_rabbit_streams_proto_rawDescOnce sync.Once + file_records_ps_records_rabbit_streams_proto_rawDescData = file_records_ps_records_rabbit_streams_proto_rawDesc +) + +func file_records_ps_records_rabbit_streams_proto_rawDescGZIP() []byte { + file_records_ps_records_rabbit_streams_proto_rawDescOnce.Do(func() { + file_records_ps_records_rabbit_streams_proto_rawDescData = protoimpl.X.CompressGZIP(file_records_ps_records_rabbit_streams_proto_rawDescData) + }) + return file_records_ps_records_rabbit_streams_proto_rawDescData +} + +var file_records_ps_records_rabbit_streams_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_records_ps_records_rabbit_streams_proto_goTypes = []interface{}{ + (*RabbitStreams)(nil), // 0: protos.records.RabbitStreams + (*RabbitStreamsHeader)(nil), // 1: protos.records.RabbitStreamsHeader + nil, // 2: protos.records.RabbitStreams.DeliveryAnnotationsEntry +} +var file_records_ps_records_rabbit_streams_proto_depIdxs = []int32{ + 1, // 0: protos.records.RabbitStreams.header:type_name -> protos.records.RabbitStreamsHeader + 2, // 1: protos.records.RabbitStreams.delivery_annotations:type_name -> protos.records.RabbitStreams.DeliveryAnnotationsEntry + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_records_ps_records_rabbit_streams_proto_init() } +func file_records_ps_records_rabbit_streams_proto_init() { + if File_records_ps_records_rabbit_streams_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_records_ps_records_rabbit_streams_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RabbitStreams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_records_ps_records_rabbit_streams_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RabbitStreamsHeader); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_records_ps_records_rabbit_streams_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_records_ps_records_rabbit_streams_proto_goTypes, + DependencyIndexes: file_records_ps_records_rabbit_streams_proto_depIdxs, + MessageInfos: file_records_ps_records_rabbit_streams_proto_msgTypes, + }.Build() + File_records_ps_records_rabbit_streams_proto = out.File + file_records_ps_records_rabbit_streams_proto_rawDesc = nil + file_records_ps_records_rabbit_streams_proto_goTypes = nil + file_records_ps_records_rabbit_streams_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_redis_pubsub.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_redis_pubsub.pb.go index 057eccc23..1786613f3 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_redis_pubsub.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_redis_pubsub.pb.go @@ -1,105 +1,175 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: records/ps_records_redis_pubsub.proto package records import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type RedisPubsub struct { - Metadata map[string]string `protobuf:"bytes,1,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *RedisPubsub) Reset() { *m = RedisPubsub{} } -func (m *RedisPubsub) String() string { return proto.CompactTextString(m) } -func (*RedisPubsub) ProtoMessage() {} -func (*RedisPubsub) Descriptor() ([]byte, []int) { - return fileDescriptor_50fca510af804137, []int{0} + Metadata map[string]string `protobuf:"bytes,1,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` } -func (m *RedisPubsub) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RedisPubsub.Unmarshal(m, b) -} -func (m *RedisPubsub) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RedisPubsub.Marshal(b, m, deterministic) -} -func (m *RedisPubsub) XXX_Merge(src proto.Message) { - xxx_messageInfo_RedisPubsub.Merge(m, src) +func (x *RedisPubsub) Reset() { + *x = RedisPubsub{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_redis_pubsub_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RedisPubsub) XXX_Size() int { - return xxx_messageInfo_RedisPubsub.Size(m) + +func (x *RedisPubsub) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RedisPubsub) XXX_DiscardUnknown() { - xxx_messageInfo_RedisPubsub.DiscardUnknown(m) + +func (*RedisPubsub) ProtoMessage() {} + +func (x *RedisPubsub) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_redis_pubsub_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RedisPubsub proto.InternalMessageInfo +// Deprecated: Use RedisPubsub.ProtoReflect.Descriptor instead. +func (*RedisPubsub) Descriptor() ([]byte, []int) { + return file_records_ps_records_redis_pubsub_proto_rawDescGZIP(), []int{0} +} -func (m *RedisPubsub) GetMetadata() map[string]string { - if m != nil { - return m.Metadata +func (x *RedisPubsub) GetMetadata() map[string]string { + if x != nil { + return x.Metadata } return nil } -func (m *RedisPubsub) GetValue() []byte { - if m != nil { - return m.Value +func (x *RedisPubsub) GetValue() []byte { + if x != nil { + return x.Value } return nil } -func (m *RedisPubsub) GetTimestamp() int64 { - if m != nil { - return m.Timestamp +func (x *RedisPubsub) GetTimestamp() int64 { + if x != nil { + return x.Timestamp } return 0 } -func init() { - proto.RegisterType((*RedisPubsub)(nil), "protos.records.RedisPubsub") - proto.RegisterMapType((map[string]string)(nil), "protos.records.RedisPubsub.MetadataEntry") +var File_records_ps_records_redis_pubsub_proto protoreflect.FileDescriptor + +var file_records_ps_records_redis_pubsub_proto_rawDesc = []byte{ + 0x0a, 0x25, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, + 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0xc5, 0x01, 0x0a, 0x0b, 0x52, 0x65, 0x64, 0x69, + 0x73, 0x50, 0x75, 0x62, 0x73, 0x75, 0x62, 0x12, 0x45, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, + 0x50, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, + 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, + 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_records_ps_records_redis_pubsub_proto_rawDescOnce sync.Once + file_records_ps_records_redis_pubsub_proto_rawDescData = file_records_ps_records_redis_pubsub_proto_rawDesc +) + +func file_records_ps_records_redis_pubsub_proto_rawDescGZIP() []byte { + file_records_ps_records_redis_pubsub_proto_rawDescOnce.Do(func() { + file_records_ps_records_redis_pubsub_proto_rawDescData = protoimpl.X.CompressGZIP(file_records_ps_records_redis_pubsub_proto_rawDescData) + }) + return file_records_ps_records_redis_pubsub_proto_rawDescData } -func init() { - proto.RegisterFile("records/ps_records_redis_pubsub.proto", fileDescriptor_50fca510af804137) +var file_records_ps_records_redis_pubsub_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_records_ps_records_redis_pubsub_proto_goTypes = []interface{}{ + (*RedisPubsub)(nil), // 0: protos.records.RedisPubsub + nil, // 1: protos.records.RedisPubsub.MetadataEntry +} +var file_records_ps_records_redis_pubsub_proto_depIdxs = []int32{ + 1, // 0: protos.records.RedisPubsub.metadata:type_name -> protos.records.RedisPubsub.MetadataEntry + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } -var fileDescriptor_50fca510af804137 = []byte{ - // 241 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x8f, 0x41, 0x4b, 0xc4, 0x30, - 0x14, 0x84, 0xc9, 0x16, 0xc5, 0x66, 0x55, 0x24, 0x78, 0x28, 0xe2, 0xa1, 0x08, 0x42, 0x3d, 0x98, - 0x80, 0x5e, 0x44, 0xc5, 0x83, 0xb0, 0x47, 0x41, 0x72, 0xf4, 0x52, 0x92, 0x34, 0x6c, 0x8b, 0x8d, - 0x09, 0x79, 0x2f, 0xc2, 0xfe, 0x40, 0xff, 0x97, 0x6c, 0x37, 0xe8, 0xf6, 0xf4, 0x66, 0x1e, 0xdf, - 0x0c, 0x0c, 0xbd, 0x8e, 0xd6, 0xf8, 0xd8, 0x81, 0x08, 0xd0, 0x66, 0xd9, 0x46, 0xdb, 0x0d, 0xd0, - 0x86, 0xa4, 0x21, 0x69, 0x1e, 0xa2, 0x47, 0xcf, 0x4e, 0xa7, 0x03, 0x3c, 0x23, 0x57, 0x3f, 0x84, - 0x2e, 0xe5, 0x16, 0x7b, 0x9f, 0x28, 0xb6, 0xa2, 0x47, 0xce, 0xa2, 0xea, 0x14, 0xaa, 0x8a, 0xd4, - 0x45, 0xb3, 0xbc, 0xbb, 0xe1, 0xf3, 0x08, 0xdf, 0xc3, 0xf9, 0x5b, 0x66, 0x57, 0x5f, 0x18, 0x37, - 0xf2, 0x2f, 0xca, 0xce, 0xe9, 0xc1, 0xb7, 0x1a, 0x93, 0xad, 0x16, 0x35, 0x69, 0x8e, 0xe5, 0xce, - 0xb0, 0x4b, 0x5a, 0xe2, 0xe0, 0x2c, 0xa0, 0x72, 0xa1, 0x2a, 0x6a, 0xd2, 0x14, 0xf2, 0xff, 0x71, - 0xf1, 0x44, 0x4f, 0x66, 0x75, 0xec, 0x8c, 0x16, 0x9f, 0x76, 0x53, 0x91, 0x9a, 0x34, 0xa5, 0xdc, - 0xca, 0x79, 0x6d, 0x99, 0x6b, 0x1f, 0x17, 0x0f, 0xe4, 0xf5, 0xe5, 0xe3, 0x79, 0x3d, 0x60, 0x9f, - 0x34, 0x37, 0xde, 0x09, 0xad, 0xd0, 0xf4, 0xc6, 0xc7, 0x20, 0xc2, 0x98, 0x9c, 0xb6, 0xf1, 0x16, - 0x4c, 0x6f, 0x9d, 0x02, 0xa1, 0xd3, 0x30, 0x76, 0x62, 0xed, 0xc5, 0x6e, 0x94, 0xc8, 0xa3, 0xf4, - 0xe1, 0xe4, 0xef, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x8d, 0xac, 0xee, 0xd8, 0x47, 0x01, 0x00, - 0x00, +func init() { file_records_ps_records_redis_pubsub_proto_init() } +func file_records_ps_records_redis_pubsub_proto_init() { + if File_records_ps_records_redis_pubsub_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_records_ps_records_redis_pubsub_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RedisPubsub); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_records_ps_records_redis_pubsub_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_records_ps_records_redis_pubsub_proto_goTypes, + DependencyIndexes: file_records_ps_records_redis_pubsub_proto_depIdxs, + MessageInfos: file_records_ps_records_redis_pubsub_proto_msgTypes, + }.Build() + File_records_ps_records_redis_pubsub_proto = out.File + file_records_ps_records_redis_pubsub_proto_rawDesc = nil + file_records_ps_records_redis_pubsub_proto_goTypes = nil + file_records_ps_records_redis_pubsub_proto_depIdxs = nil } diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_redis_streams.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_redis_streams.pb.go index 3cf0ff217..ca7968225 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_redis_streams.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/records/ps_records_redis_streams.pb.go @@ -1,117 +1,184 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 // source: records/ps_records_redis_streams.proto package records import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type RedisStreams struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` - Stream string `protobuf:"bytes,4,opt,name=stream,proto3" json:"stream,omitempty"` - Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + Stream string `protobuf:"bytes,4,opt,name=stream,proto3" json:"stream,omitempty"` + Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"` } -func (m *RedisStreams) Reset() { *m = RedisStreams{} } -func (m *RedisStreams) String() string { return proto.CompactTextString(m) } -func (*RedisStreams) ProtoMessage() {} -func (*RedisStreams) Descriptor() ([]byte, []int) { - return fileDescriptor_2fd4676fadf52d73, []int{0} +func (x *RedisStreams) Reset() { + *x = RedisStreams{} + if protoimpl.UnsafeEnabled { + mi := &file_records_ps_records_redis_streams_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RedisStreams) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RedisStreams.Unmarshal(m, b) -} -func (m *RedisStreams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RedisStreams.Marshal(b, m, deterministic) +func (x *RedisStreams) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RedisStreams) XXX_Merge(src proto.Message) { - xxx_messageInfo_RedisStreams.Merge(m, src) -} -func (m *RedisStreams) XXX_Size() int { - return xxx_messageInfo_RedisStreams.Size(m) -} -func (m *RedisStreams) XXX_DiscardUnknown() { - xxx_messageInfo_RedisStreams.DiscardUnknown(m) + +func (*RedisStreams) ProtoMessage() {} + +func (x *RedisStreams) ProtoReflect() protoreflect.Message { + mi := &file_records_ps_records_redis_streams_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_RedisStreams proto.InternalMessageInfo +// Deprecated: Use RedisStreams.ProtoReflect.Descriptor instead. +func (*RedisStreams) Descriptor() ([]byte, []int) { + return file_records_ps_records_redis_streams_proto_rawDescGZIP(), []int{0} +} -func (m *RedisStreams) GetId() string { - if m != nil { - return m.Id +func (x *RedisStreams) GetId() string { + if x != nil { + return x.Id } return "" } -func (m *RedisStreams) GetKey() string { - if m != nil { - return m.Key +func (x *RedisStreams) GetKey() string { + if x != nil { + return x.Key } return "" } -func (m *RedisStreams) GetValue() string { - if m != nil { - return m.Value +func (x *RedisStreams) GetValue() string { + if x != nil { + return x.Value } return "" } -func (m *RedisStreams) GetStream() string { - if m != nil { - return m.Stream +func (x *RedisStreams) GetStream() string { + if x != nil { + return x.Stream } return "" } -func (m *RedisStreams) GetTimestamp() int64 { - if m != nil { - return m.Timestamp +func (x *RedisStreams) GetTimestamp() int64 { + if x != nil { + return x.Timestamp } return 0 } -func init() { - proto.RegisterType((*RedisStreams)(nil), "protos.records.RedisStreams") +var File_records_ps_records_redis_streams_proto protoreflect.FileDescriptor + +var file_records_ps_records_redis_streams_proto_rawDesc = []byte{ + 0x0a, 0x26, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0x7c, 0x0a, 0x0c, 0x52, 0x65, 0x64, 0x69, + 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, + 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, + 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x72, + 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func init() { - proto.RegisterFile("records/ps_records_redis_streams.proto", fileDescriptor_2fd4676fadf52d73) +var ( + file_records_ps_records_redis_streams_proto_rawDescOnce sync.Once + file_records_ps_records_redis_streams_proto_rawDescData = file_records_ps_records_redis_streams_proto_rawDesc +) + +func file_records_ps_records_redis_streams_proto_rawDescGZIP() []byte { + file_records_ps_records_redis_streams_proto_rawDescOnce.Do(func() { + file_records_ps_records_redis_streams_proto_rawDescData = protoimpl.X.CompressGZIP(file_records_ps_records_redis_streams_proto_rawDescData) + }) + return file_records_ps_records_redis_streams_proto_rawDescData } -var fileDescriptor_2fd4676fadf52d73 = []byte{ - // 207 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x8e, 0x3f, 0x4b, 0xc5, 0x30, - 0x14, 0xc5, 0x69, 0xeb, 0x7b, 0xf0, 0x82, 0x14, 0x09, 0x22, 0x19, 0x1c, 0x8a, 0x83, 0x74, 0xb1, - 0x19, 0x5c, 0xc5, 0xc1, 0x8f, 0x50, 0x37, 0x97, 0x92, 0x3f, 0x97, 0x36, 0xd8, 0x90, 0x90, 0x9b, - 0x08, 0x82, 0x1f, 0x5e, 0x9a, 0x04, 0xde, 0x74, 0xcf, 0xf9, 0xf1, 0x83, 0x7b, 0xc8, 0x73, 0x00, - 0xe5, 0x82, 0x46, 0xee, 0x71, 0xa9, 0x71, 0x09, 0xa0, 0x0d, 0x2e, 0x18, 0x03, 0x08, 0x8b, 0x93, - 0x0f, 0x2e, 0x3a, 0xda, 0xe7, 0x83, 0x53, 0x75, 0x9e, 0xfe, 0xc8, 0xed, 0x7c, 0x68, 0x9f, 0xc5, - 0xa2, 0x3d, 0x69, 0x8d, 0x66, 0xcd, 0xd0, 0x8c, 0x97, 0xb9, 0x35, 0x9a, 0xde, 0x91, 0xee, 0x1b, - 0x7e, 0x59, 0x9b, 0xc1, 0x11, 0xe9, 0x3d, 0x39, 0xfd, 0x88, 0x3d, 0x01, 0xeb, 0x32, 0x2b, 0x85, - 0x3e, 0x90, 0x73, 0x79, 0xc4, 0x6e, 0x32, 0xae, 0x8d, 0x3e, 0x92, 0x4b, 0x34, 0x16, 0x30, 0x0a, - 0xeb, 0xd9, 0x69, 0x68, 0xc6, 0x6e, 0xbe, 0x82, 0x8f, 0xf7, 0xaf, 0xb7, 0xd5, 0xc4, 0x2d, 0xc9, - 0x49, 0x39, 0xcb, 0xa5, 0x88, 0x6a, 0x53, 0x2e, 0x78, 0xee, 0xf7, 0x64, 0x25, 0x84, 0x17, 0x54, - 0x1b, 0x58, 0x81, 0x5c, 0x26, 0xb3, 0x6b, 0xbe, 0x3a, 0x5e, 0xd6, 0xf3, 0xba, 0x5e, 0x9e, 0x73, - 0x7f, 0xfd, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x48, 0x07, 0x76, 0xfe, 0x00, 0x00, 0x00, +var file_records_ps_records_redis_streams_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_records_ps_records_redis_streams_proto_goTypes = []interface{}{ + (*RedisStreams)(nil), // 0: protos.records.RedisStreams +} +var file_records_ps_records_redis_streams_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_records_ps_records_redis_streams_proto_init() } +func file_records_ps_records_redis_streams_proto_init() { + if File_records_ps_records_redis_streams_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_records_ps_records_redis_streams_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RedisStreams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_records_ps_records_redis_streams_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_records_ps_records_redis_streams_proto_goTypes, + DependencyIndexes: file_records_ps_records_redis_streams_proto_depIdxs, + MessageInfos: file_records_ps_records_redis_streams_proto_msgTypes, + }.Build() + File_records_ps_records_redis_streams_proto = out.File + file_records_ps_records_redis_streams_proto_rawDesc = nil + file_records_ps_records_redis_streams_proto_goTypes = nil + file_records_ps_records_redis_streams_proto_depIdxs = nil } From b95d5e79761ef460ef233de77ee31e4c22034106 Mon Sep 17 00:00:00 2001 From: Daniel Selans Date: Wed, 13 Mar 2024 20:27:01 -0700 Subject: [PATCH 2/9] SDK support Kafka --- backends/kafka/relay.go | 37 + go.mod | 50 +- go.sum | 54 + plumber/cli_manage_relay.go | 3 - relay/relay.go | 11 +- util/util.go | 26 + .../go/compute/internal/version.go | 2 +- vendor/cloud.google.com/go/iam/CHANGES.md | 21 + .../go/iam/apiv1/iampb/iam_policy.pb.go | 2 +- .../go/iam/apiv1/iampb/options.pb.go | 2 +- .../go/iam/apiv1/iampb/policy.pb.go | 2 +- .../go/protos/args/ps_args_gcp_pubsub.pb.go | 41 +- .../opts/batch_connection_options.pb.go | 176 +- .../build/go/protos/opts/ps_opts_relay.pb.go | 62 +- .../golang/protobuf/jsonpb/decode.go | 1 + .../golang/protobuf/jsonpb/encode.go | 1 + .../protoc-gen-go/descriptor/descriptor.pb.go | 128 +- .../protoc-gen-go/plugin/plugin.pb.go | 1 + .../github.com/golang/protobuf/ptypes/any.go | 7 +- .../github.com/google/go-cmp/cmp/compare.go | 38 +- .../google/go-cmp/cmp/export_panic.go | 16 - .../google/go-cmp/cmp/export_unsafe.go | 36 - .../cmp/internal/value/pointer_purego.go | 34 - .../cmp/internal/value/pointer_unsafe.go | 37 - .../github.com/google/go-cmp/cmp/options.go | 84 +- vendor/github.com/google/go-cmp/cmp/path.go | 46 +- .../google/go-cmp/cmp/report_reflect.go | 2 +- vendor/github.com/google/s2a-go/README.md | 7 +- .../internal/handshaker/service/service.go | 53 +- .../s2a-go/internal/record/ticketsender.go | 8 +- .../google/s2a-go/internal/v2/s2av2.go | 105 +- vendor/github.com/google/s2a-go/s2a.go | 47 +- .../github.com/google/s2a-go/s2a_options.go | 7 + vendor/github.com/google/uuid/CHANGELOG.md | 18 + vendor/github.com/google/uuid/CONTRIBUTING.md | 2 +- vendor/github.com/google/uuid/time.go | 21 +- vendor/github.com/google/uuid/uuid.go | 79 +- .../client/client.go | 42 +- .../client/util/util.go | 9 + vendor/github.com/onsi/gomega/.gitignore | 2 + vendor/github.com/onsi/gomega/CHANGELOG.md | 273 ++ vendor/github.com/onsi/gomega/RELEASING.md | 8 +- .../github.com/onsi/gomega/format/format.go | 88 +- vendor/github.com/onsi/gomega/gomega_dsl.go | 200 +- .../onsi/gomega/internal/assertion.go | 8 +- .../onsi/gomega/internal/async_assertion.go | 574 +++- .../onsi/gomega/internal/duration_bundle.go | 16 +- .../github.com/onsi/gomega/internal/gomega.go | 67 +- vendor/github.com/onsi/gomega/matchers.go | 583 ++-- .../onsi/gomega/matchers/be_a_directory.go | 2 +- .../onsi/gomega/matchers/be_a_regular_file.go | 2 +- .../gomega/matchers/be_an_existing_file.go | 4 +- .../onsi/gomega/matchers/be_false_matcher.go | 13 +- .../onsi/gomega/matchers/be_true_matcher.go | 13 +- .../onsi/gomega/matchers/consist_of.go | 29 +- .../gomega/matchers/have_http_body_matcher.go | 9 +- .../gomega/matchers/have_occurred_matcher.go | 2 +- .../gomega/matchers/match_error_matcher.go | 37 +- .../onsi/gomega/matchers/succeed_matcher.go | 11 +- vendor/github.com/onsi/gomega/tools | 8 - vendor/github.com/onsi/gomega/types/types.go | 20 +- .../x/mod/internal/lazyregexp/lazyre.go | 2 +- vendor/golang.org/x/mod/module/module.go | 30 +- vendor/golang.org/x/mod/module/pseudo.go | 2 +- vendor/golang.org/x/mod/semver/semver.go | 6 +- vendor/golang.org/x/net/html/token.go | 12 +- vendor/golang.org/x/net/http2/databuffer.go | 59 +- vendor/golang.org/x/net/http2/frame.go | 11 +- vendor/golang.org/x/net/http2/go111.go | 30 - vendor/golang.org/x/net/http2/go115.go | 27 - vendor/golang.org/x/net/http2/go118.go | 17 - vendor/golang.org/x/net/http2/not_go111.go | 21 - vendor/golang.org/x/net/http2/not_go115.go | 31 - vendor/golang.org/x/net/http2/not_go118.go | 17 - vendor/golang.org/x/net/http2/server.go | 90 +- vendor/golang.org/x/net/http2/transport.go | 33 +- vendor/golang.org/x/net/idna/go118.go | 1 - vendor/golang.org/x/net/idna/idna10.0.0.go | 1 - vendor/golang.org/x/net/idna/idna9.0.0.go | 1 - vendor/golang.org/x/net/idna/pre_go118.go | 1 - vendor/golang.org/x/net/idna/tables10.0.0.go | 1 - vendor/golang.org/x/net/idna/tables11.0.0.go | 1 - vendor/golang.org/x/net/idna/tables12.0.0.go | 1 - vendor/golang.org/x/net/idna/tables13.0.0.go | 1 - vendor/golang.org/x/net/idna/tables15.0.0.go | 1 - vendor/golang.org/x/net/idna/tables9.0.0.go | 1 - vendor/golang.org/x/net/idna/trie12.0.0.go | 1 - vendor/golang.org/x/net/idna/trie13.0.0.go | 1 - vendor/golang.org/x/sync/errgroup/errgroup.go | 3 + vendor/golang.org/x/sync/errgroup/go120.go | 1 - .../golang.org/x/sync/errgroup/pre_go120.go | 1 - vendor/golang.org/x/sys/execabs/execabs.go | 102 - .../golang.org/x/sys/execabs/execabs_go118.go | 17 - .../golang.org/x/sys/execabs/execabs_go119.go | 20 - vendor/golang.org/x/sys/unix/mkerrors.sh | 2 +- vendor/golang.org/x/sys/unix/zerrors_linux.go | 36 +- .../x/sys/unix/zerrors_linux_386.go | 3 + .../x/sys/unix/zerrors_linux_amd64.go | 3 + .../x/sys/unix/zerrors_linux_arm.go | 3 + .../x/sys/unix/zerrors_linux_arm64.go | 3 + .../x/sys/unix/zerrors_linux_loong64.go | 3 + .../x/sys/unix/zerrors_linux_mips.go | 3 + .../x/sys/unix/zerrors_linux_mips64.go | 3 + .../x/sys/unix/zerrors_linux_mips64le.go | 3 + .../x/sys/unix/zerrors_linux_mipsle.go | 3 + .../x/sys/unix/zerrors_linux_ppc.go | 3 + .../x/sys/unix/zerrors_linux_ppc64.go | 3 + .../x/sys/unix/zerrors_linux_ppc64le.go | 3 + .../x/sys/unix/zerrors_linux_riscv64.go | 3 + .../x/sys/unix/zerrors_linux_s390x.go | 3 + .../x/sys/unix/zerrors_linux_sparc64.go | 3 + .../x/sys/unix/zsysnum_linux_386.go | 4 + .../x/sys/unix/zsysnum_linux_amd64.go | 3 + .../x/sys/unix/zsysnum_linux_arm.go | 4 + .../x/sys/unix/zsysnum_linux_arm64.go | 4 + .../x/sys/unix/zsysnum_linux_loong64.go | 4 + .../x/sys/unix/zsysnum_linux_mips.go | 4 + .../x/sys/unix/zsysnum_linux_mips64.go | 4 + .../x/sys/unix/zsysnum_linux_mips64le.go | 4 + .../x/sys/unix/zsysnum_linux_mipsle.go | 4 + .../x/sys/unix/zsysnum_linux_ppc.go | 4 + .../x/sys/unix/zsysnum_linux_ppc64.go | 4 + .../x/sys/unix/zsysnum_linux_ppc64le.go | 4 + .../x/sys/unix/zsysnum_linux_riscv64.go | 4 + .../x/sys/unix/zsysnum_linux_s390x.go | 4 + .../x/sys/unix/zsysnum_linux_sparc64.go | 4 + vendor/golang.org/x/sys/unix/ztypes_linux.go | 125 +- .../golang.org/x/sys/windows/env_windows.go | 17 +- .../x/sys/windows/syscall_windows.go | 3 +- .../x/tools/go/ast/astutil/enclosing.go | 8 +- .../x/tools/go/ast/astutil/rewrite.go | 8 +- .../x/tools/go/gcexportdata/gcexportdata.go | 11 +- .../tools/go/internal/packagesdriver/sizes.go | 24 +- vendor/golang.org/x/tools/go/packages/doc.go | 36 +- .../x/tools/go/packages/external.go | 2 +- .../golang.org/x/tools/go/packages/golist.go | 118 +- .../x/tools/go/packages/golist_overlay.go | 492 --- .../x/tools/go/packages/packages.go | 197 +- .../x/tools/go/types/typeutil/callee.go | 2 +- .../x/tools/go/types/typeutil/map.go | 20 +- vendor/golang.org/x/tools/imports/forward.go | 4 +- .../x/tools/internal/fastwalk/fastwalk.go | 196 -- .../internal/fastwalk/fastwalk_darwin.go | 119 - .../fastwalk/fastwalk_dirent_fileno.go | 14 - .../internal/fastwalk/fastwalk_dirent_ino.go | 15 - .../fastwalk/fastwalk_dirent_namlen_bsd.go | 14 - .../fastwalk/fastwalk_dirent_namlen_linux.go | 29 - .../internal/fastwalk/fastwalk_portable.go | 38 - .../tools/internal/fastwalk/fastwalk_unix.go | 153 - .../x/tools/internal/gcimporter/bexport.go | 852 ----- .../x/tools/internal/gcimporter/bimport.go | 907 +----- .../x/tools/internal/gcimporter/gcimporter.go | 30 +- .../x/tools/internal/gcimporter/iexport.go | 229 +- .../x/tools/internal/gcimporter/iimport.go | 228 +- .../tools/internal/gcimporter/ureader_yes.go | 50 +- .../x/tools/internal/gocommand/invoke.go | 173 +- .../x/tools/internal/gocommand/version.go | 18 +- .../x/tools/internal/gopathwalk/walk.go | 237 +- .../x/tools/internal/imports/fix.go | 103 +- .../x/tools/internal/imports/imports.go | 9 +- .../x/tools/internal/imports/mod.go | 17 +- .../x/tools/internal/imports/mod_cache.go | 2 +- .../x/tools/internal/imports/zstdlib.go | 230 ++ .../internal/packagesinternal/packages.go | 8 - .../internal/tokeninternal/tokeninternal.go | 92 + .../x/tools/internal/typeparams/common.go | 51 +- .../x/tools/internal/typeparams/coretype.go | 16 +- .../internal/typeparams/enabled_go117.go | 12 - .../internal/typeparams/enabled_go118.go | 15 - .../x/tools/internal/typeparams/normalize.go | 20 +- .../x/tools/internal/typeparams/termlist.go | 2 +- .../internal/typeparams/typeparams_go117.go | 197 -- .../internal/typeparams/typeparams_go118.go | 151 - .../x/tools/internal/typeparams/typeterm.go | 9 +- vendor/google.golang.org/api/internal/cba.go | 40 +- .../google.golang.org/api/internal/creds.go | 5 +- vendor/google.golang.org/api/internal/s2a.go | 2 +- .../api/internal/settings.go | 17 + .../google.golang.org/api/internal/version.go | 2 +- .../option/internaloption/internaloption.go | 13 + .../api/transport/grpc/dial.go | 9 - .../api/transport/grpc/dial_appengine.go | 32 - .../api/transport/http/dial.go | 17 +- .../api/transport/http/dial_appengine.go | 21 - .../internal/socket/socket_service.pb.go | 2822 ----------------- .../internal/socket/socket_service.proto | 460 --- .../google.golang.org/appengine/socket/doc.go | 10 - .../appengine/socket/socket_classic.go | 291 -- .../appengine/socket/socket_vm.go | 64 - vendor/google.golang.org/grpc/README.md | 60 +- .../grpc/attributes/attributes.go | 35 +- .../grpc/balancer/balancer.go | 62 +- .../grpc/balancer/base/balancer.go | 22 +- .../grpclb/grpc_lb_v1/load_balancer.pb.go | 2 +- .../grpc/balancer/grpclb/grpclb.go | 81 +- .../grpc/balancer/grpclb/grpclb_picker.go | 9 - .../balancer/grpclb/grpclb_remote_balancer.go | 71 +- .../grpc/balancer/grpclb/grpclb_util.go | 113 +- .../grpc/balancer_conn_wrappers.go | 459 --- .../grpc_binarylog_v1/binarylog.pb.go | 2 +- vendor/google.golang.org/grpc/call.go | 11 +- vendor/google.golang.org/grpc/clientconn.go | 593 ++-- vendor/google.golang.org/grpc/codec.go | 8 +- vendor/google.golang.org/grpc/codes/codes.go | 8 +- .../grpc/credentials/alts/alts.go | 2 +- .../internal/proto/grpc_gcp/altscontext.pb.go | 2 +- .../internal/proto/grpc_gcp/handshaker.pb.go | 2 +- .../grpc_gcp/transport_security_common.pb.go | 2 +- .../google.golang.org/grpc/credentials/tls.go | 75 +- vendor/google.golang.org/grpc/dialoptions.go | 65 +- .../grpc/encoding/encoding.go | 17 +- .../grpc/encoding/proto/proto.go | 4 +- .../grpc/grpclog/component.go | 40 +- .../google.golang.org/grpc/grpclog/grpclog.go | 30 +- .../google.golang.org/grpc/grpclog/logger.go | 30 +- .../grpc/grpclog/loggerv2.go | 56 +- vendor/google.golang.org/grpc/idle.go | 287 -- vendor/google.golang.org/grpc/interceptor.go | 12 +- .../grpc/internal/backoff/backoff.go | 36 + .../balancer/gracefulswitch/gracefulswitch.go | 59 +- .../grpc/internal/balancerload/load.go | 4 +- .../grpc/internal/binarylog/method_logger.go | 4 +- .../grpc/internal/buffer/unbounded.go | 57 +- .../grpc/internal/channelz/funcs.go | 76 +- .../grpc/internal/channelz/logging.go | 12 +- .../grpc/internal/channelz/types.go | 5 + .../grpc/internal/channelz/util_linux.go | 2 +- .../grpc/internal/channelz/util_nonlinux.go | 2 +- .../grpc/internal/credentials/credentials.go | 8 +- .../grpc/internal/envconfig/envconfig.go | 8 +- .../grpc/internal/envconfig/xds.go | 39 - .../grpc/internal/grpclog/grpclog.go | 40 +- .../grpc/internal/grpclog/prefixLogger.go | 8 +- .../internal/grpcsync/callback_serializer.go | 75 +- .../grpc/internal/grpcsync/pubsub.go | 43 +- .../grpc/internal/internal.go | 58 +- .../grpc/internal/metadata/metadata.go | 2 +- .../grpc/internal/pretty/pretty.go | 2 +- .../grpc/internal/resolver/config_selector.go | 4 +- .../internal/resolver/dns/dns_resolver.go | 69 +- .../grpc/internal/status/status.go | 36 +- .../grpc/internal/transport/controlbuf.go | 16 +- .../grpc/internal/transport/handler_server.go | 76 +- .../grpc/internal/transport/http2_client.go | 68 +- .../grpc/internal/transport/http2_server.go | 132 +- .../grpc/internal/transport/http_util.go | 77 +- .../grpc/internal/transport/proxy.go | 14 +- .../grpc/internal/transport/transport.go | 39 +- .../grpc/metadata/metadata.go | 18 +- vendor/google.golang.org/grpc/peer/peer.go | 2 + .../google.golang.org/grpc/picker_wrapper.go | 53 +- vendor/google.golang.org/grpc/pickfirst.go | 76 +- vendor/google.golang.org/grpc/preloader.go | 2 +- vendor/google.golang.org/grpc/resolver/map.go | 123 +- .../grpc/resolver/resolver.go | 86 +- .../grpc/resolver_conn_wrapper.go | 239 -- vendor/google.golang.org/grpc/rpc_util.go | 17 +- vendor/google.golang.org/grpc/server.go | 478 +-- .../grpc/shared_buffer_pool.go | 4 +- vendor/google.golang.org/grpc/stats/stats.go | 14 +- .../google.golang.org/grpc/status/status.go | 14 +- vendor/google.golang.org/grpc/stream.go | 126 +- vendor/google.golang.org/grpc/tap/tap.go | 6 + vendor/google.golang.org/grpc/trace.go | 6 +- vendor/google.golang.org/grpc/version.go | 2 +- vendor/google.golang.org/grpc/vet.sh | 174 +- .../protobuf/encoding/protojson/decode.go | 38 +- .../protobuf/encoding/protojson/doc.go | 2 +- .../protobuf/encoding/protojson/encode.go | 39 +- .../encoding/protojson/well_known_types.go | 59 +- .../protobuf/encoding/prototext/decode.go | 8 +- .../protobuf/encoding/prototext/encode.go | 4 +- .../protobuf/encoding/protowire/wire.go | 28 +- .../protobuf/internal/descfmt/stringer.go | 183 +- .../protobuf/internal/encoding/json/decode.go | 2 +- .../protobuf/internal/filedesc/desc.go | 102 +- .../protobuf/internal/filedesc/desc_init.go | 52 + .../protobuf/internal/filedesc/desc_lazy.go | 28 + .../protobuf/internal/genid/descriptor_gen.go | 364 ++- .../protobuf/internal/genid/struct_gen.go | 5 + .../protobuf/internal/genid/type_gen.go | 38 + .../protobuf/internal/impl/codec_extension.go | 22 +- .../protobuf/internal/impl/codec_gen.go | 113 +- .../protobuf/internal/impl/codec_tables.go | 2 +- .../protobuf/internal/impl/legacy_message.go | 19 +- .../protobuf/internal/impl/message.go | 17 +- .../internal/impl/message_reflect_field.go | 2 +- .../protobuf/internal/impl/pointer_reflect.go | 36 + .../protobuf/internal/impl/pointer_unsafe.go | 40 + .../protobuf/internal/strs/strings.go | 2 +- .../protobuf/internal/strs/strings_unsafe.go | 95 - .../protobuf/internal/version/version.go | 2 +- .../protobuf/proto/decode.go | 2 +- .../google.golang.org/protobuf/proto/doc.go | 58 +- .../protobuf/proto/encode.go | 2 +- .../protobuf/proto/extension.go | 2 +- .../google.golang.org/protobuf/proto/merge.go | 2 +- .../google.golang.org/protobuf/proto/proto.go | 18 +- .../protobuf/reflect/protodesc/desc.go | 29 +- .../protobuf/reflect/protodesc/desc_init.go | 56 + .../reflect/protodesc/desc_resolve.go | 4 +- .../reflect/protodesc/desc_validate.go | 6 +- .../protobuf/reflect/protodesc/proto.go | 18 +- .../protobuf/reflect/protoreflect/proto.go | 85 +- .../reflect/protoreflect/source_gen.go | 64 +- .../protobuf/reflect/protoreflect/type.go | 44 +- .../protobuf/reflect/protoreflect/value.go | 24 +- .../reflect/protoreflect/value_equal.go | 8 +- .../reflect/protoreflect/value_union.go | 44 +- .../reflect/protoreflect/value_unsafe.go | 99 - .../reflect/protoregistry/registry.go | 24 +- .../types/descriptorpb/descriptor.pb.go | 2475 ++++++++++----- .../protobuf/types/dynamicpb/dynamic.go | 43 +- .../protobuf/types/dynamicpb/types.go | 25 +- .../protobuf/types/known/anypb/any.pb.go | 3 +- .../protobuf/types/pluginpb/plugin.pb.go | 158 +- vendor/modules.txt | 135 +- 317 files changed, 9344 insertions(+), 13138 deletions(-) delete mode 100644 vendor/github.com/google/go-cmp/cmp/export_panic.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/export_unsafe.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go delete mode 100644 vendor/github.com/onsi/gomega/tools delete mode 100644 vendor/golang.org/x/net/http2/go111.go delete mode 100644 vendor/golang.org/x/net/http2/go115.go delete mode 100644 vendor/golang.org/x/net/http2/go118.go delete mode 100644 vendor/golang.org/x/net/http2/not_go111.go delete mode 100644 vendor/golang.org/x/net/http2/not_go115.go delete mode 100644 vendor/golang.org/x/net/http2/not_go118.go delete mode 100644 vendor/golang.org/x/sys/execabs/execabs.go delete mode 100644 vendor/golang.org/x/sys/execabs/execabs_go118.go delete mode 100644 vendor/golang.org/x/sys/execabs/execabs_go119.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_darwin.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_fileno.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_ino.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_bsd.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_portable.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go delete mode 100644 vendor/golang.org/x/tools/internal/gcimporter/bexport.go delete mode 100644 vendor/golang.org/x/tools/internal/typeparams/enabled_go117.go delete mode 100644 vendor/golang.org/x/tools/internal/typeparams/enabled_go118.go delete mode 100644 vendor/golang.org/x/tools/internal/typeparams/typeparams_go117.go delete mode 100644 vendor/golang.org/x/tools/internal/typeparams/typeparams_go118.go delete mode 100644 vendor/google.golang.org/api/transport/grpc/dial_appengine.go delete mode 100644 vendor/google.golang.org/api/transport/http/dial_appengine.go delete mode 100644 vendor/google.golang.org/appengine/internal/socket/socket_service.pb.go delete mode 100644 vendor/google.golang.org/appengine/internal/socket/socket_service.proto delete mode 100644 vendor/google.golang.org/appengine/socket/doc.go delete mode 100644 vendor/google.golang.org/appengine/socket/socket_classic.go delete mode 100644 vendor/google.golang.org/appengine/socket/socket_vm.go delete mode 100644 vendor/google.golang.org/grpc/balancer_conn_wrappers.go delete mode 100644 vendor/google.golang.org/grpc/idle.go delete mode 100644 vendor/google.golang.org/grpc/resolver_conn_wrapper.go delete mode 100644 vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe.go diff --git a/backends/kafka/relay.go b/backends/kafka/relay.go index 3ec0abfe2..651510b7d 100644 --- a/backends/kafka/relay.go +++ b/backends/kafka/relay.go @@ -14,6 +14,8 @@ import ( "github.com/streamdal/plumber/prometheus" "github.com/streamdal/plumber/util" "github.com/streamdal/plumber/validate" + + sdk "github.com/streamdal/streamdal/sdks/go" ) const ( @@ -33,6 +35,15 @@ func (k *Kafka) Relay(ctx context.Context, relayOpts *opts.RelayOptions, relayCh defer reader.Close() + // streamdal sdk BEGIN + sc, err := util.SetupStreamdalSDK(relayOpts, k.log) + if err != nil { + return errors.Wrap(err, "kafka.Relay(): unable to create new streamdal client") + } + // TODO: defer sc.Close() ? Why is there no .Close() in the SDK? + // + // streamdal sdk END + llog := k.log.WithField("relay-id", relayOpts.XRelayId) for { @@ -59,6 +70,32 @@ func (k *Kafka) Relay(ctx context.Context, relayOpts *opts.RelayOptions, relayCh prometheus.Incr("kafka-relay-consumer", 1) + // streamdal sdk BEGIN + // If streamdal integration is enabled, process message via sdk + if sc != nil { + k.log.Debug("Processing message via streamdal SDK") + + resp := sc.Process(ctx, &sdk.ProcessRequest{ + ComponentName: "kafka", + OperationType: sdk.OperationTypeConsumer, + OperationName: "relay", + Data: msg.Value, + }) + + if resp.Status == sdk.ExecStatusError { + wrappedErr := fmt.Errorf("unable to process message via streamdal: %v", resp.StatusMessage) + + prometheus.IncrPromCounter("plumber_sdk_errors", 1) + util.WriteError(llog, errorCh, wrappedErr) + + continue + } + + // Update msg value with processed data + msg.Value = resp.Data + } + // streamdal sdk END + k.log.Debugf("Writing Kafka message to relay channel: %s", msg.Value) relayCh <- &types.RelayMessage{ diff --git a/go.mod b/go.mod index ce5d5dda7..e706b3c39 100644 --- a/go.mod +++ b/go.mod @@ -14,14 +14,14 @@ require ( github.com/batchcorp/collector-schemas v0.0.22 github.com/batchcorp/kong v0.2.17-batch-fix github.com/batchcorp/natty v0.0.16 - github.com/batchcorp/plumber-schemas v0.0.180 + github.com/batchcorp/plumber-schemas v0.0.185 github.com/batchcorp/rabbit v0.1.17 github.com/batchcorp/thrifty v0.0.10 github.com/eclipse/paho.mqtt.golang v1.2.0 github.com/go-redis/redis/v8 v8.11.4 github.com/go-stomp/stomp v2.1.4+incompatible - github.com/golang/protobuf v1.5.3 - github.com/google/uuid v1.3.1 + github.com/golang/protobuf v1.5.4 + github.com/google/uuid v1.5.0 github.com/hokaccha/go-prettyjson v0.0.0-20210113012101-fb4e108d2519 github.com/imdario/mergo v0.3.13 github.com/jackc/pgx v3.6.2+incompatible @@ -42,7 +42,7 @@ require ( github.com/nsqio/go-nsq v1.0.8 github.com/olekukonko/tablewriter v0.0.5 github.com/onsi/ginkgo v1.16.5 - github.com/onsi/gomega v1.20.2 + github.com/onsi/gomega v1.30.0 github.com/pkg/errors v0.9.1 github.com/posthog/posthog-go v0.0.0-20220817142604-0b0bbf0f9c0f github.com/prometheus/client_golang v1.11.1 @@ -55,10 +55,10 @@ require ( github.com/streamdal/pgoutput v0.3.3 github.com/tidwall/gjson v1.9.3 go.mongodb.org/mongo-driver v1.7.3 - golang.org/x/crypto v0.18.0 - google.golang.org/api v0.128.0 - google.golang.org/grpc v1.57.0 - google.golang.org/protobuf v1.31.0 + golang.org/x/crypto v0.19.0 + google.golang.org/api v0.149.0 + google.golang.org/grpc v1.60.1 + google.golang.org/protobuf v1.33.0 ) require ( @@ -66,13 +66,14 @@ require ( github.com/cloudevents/sdk-go/protocol/kafka_sarama/v2 v2.13.0 github.com/cloudevents/sdk-go/protocol/nats/v2 v2.13.0 github.com/cloudevents/sdk-go/v2 v2.13.0 + github.com/streamdal/streamdal/sdks/go v0.1.12 ) require ( - cloud.google.com/go v0.110.8 // indirect - cloud.google.com/go/compute v1.23.0 // indirect + cloud.google.com/go v0.111.0 // indirect + cloud.google.com/go/compute v1.23.3 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v1.1.2 // indirect + cloud.google.com/go/iam v1.1.5 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect github.com/AthenZ/athenz v1.10.39 // indirect @@ -112,9 +113,9 @@ require ( github.com/golang-jwt/jwt v3.2.1+incompatible // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/snappy v0.0.4 // indirect - github.com/google/go-cmp v0.5.9 // indirect - github.com/google/s2a-go v0.1.4 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.2.4 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/google/s2a-go v0.1.7 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.0 // indirect github.com/graph-gophers/graphql-go v1.4.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect @@ -152,6 +153,8 @@ require ( github.com/rogpeppe/go-internal v1.9.0 // indirect github.com/santhosh-tekuri/jsonschema/v5 v5.1.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect + github.com/streamdal/streamdal/libs/protos v0.1.29 // indirect + github.com/tetratelabs/wazero v1.6.0 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.0 // indirect github.com/v2pro/plz v0.0.0-20200805122259-422184e41b6e // indirect @@ -169,18 +172,19 @@ require ( go.uber.org/multierr v1.1.0 // indirect go.uber.org/thriftrw v1.29.2 // indirect go.uber.org/zap v1.10.0 // indirect - golang.org/x/mod v0.8.0 // indirect - golang.org/x/net v0.16.0 // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/net v0.21.0 // indirect golang.org/x/oauth2 v0.13.0 // indirect - golang.org/x/sync v0.4.0 // indirect - golang.org/x/sys v0.16.0 // indirect - golang.org/x/term v0.16.0 // indirect + golang.org/x/sync v0.6.0 // indirect + golang.org/x/sys v0.17.0 // indirect + golang.org/x/term v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect - golang.org/x/tools v0.6.0 // indirect + golang.org/x/time v0.5.0 // indirect + golang.org/x/tools v0.17.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect + google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.7 // indirect diff --git a/go.sum b/go.sum index f4b6e55bd..a2c2e02e2 100644 --- a/go.sum +++ b/go.sum @@ -7,15 +7,21 @@ cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTj cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= cloud.google.com/go v0.110.8 h1:tyNdfIxjzaWctIiLYOTalaLKZ17SI44SKFW26QbOhME= cloud.google.com/go v0.110.8/go.mod h1:Iz8AkXJf1qmxC3Oxoep8R1T36w8B92yU29PcBhHO5fk= +cloud.google.com/go v0.111.0 h1:YHLKNupSD1KqjDbQ3+LVdQ81h/UJbJyZG203cEfnQgM= +cloud.google.com/go v0.111.0/go.mod h1:0mibmpKP1TyOOFYQY5izo0LnT+ecvOQ0Sg3OdmMiNRU= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= +cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= +cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/iam v1.1.2 h1:gacbrBdWcoVmGLozRuStX45YKvJtzIjJdAolzUs1sm4= cloud.google.com/go/iam v1.1.2/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= +cloud.google.com/go/iam v1.1.5 h1:1jTsCu4bcsNsE4iiqNT5SHwrDRCfRmIaaaVFhRveTJI= +cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXEbzv8= cloud.google.com/go/kms v1.15.2 h1:lh6qra6oC4AyWe5fUUUBe/S27k12OHAleOOOw6KakdE= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.33.0 h1:6SPCPvWav64tj0sVX/+npCBKhUi/UjJehy9op/V3p2g= @@ -116,6 +122,8 @@ github.com/batchcorp/natty v0.0.16 h1:RN20W2rlA1GtPzY3ioYIjqY0UlIFnH9Rs2c1nWajxc github.com/batchcorp/natty v0.0.16/go.mod h1:9vbgoZghKr/2FtueAquAlRacCSnEgfgTSA2eX2gpO54= github.com/batchcorp/plumber-schemas v0.0.180 h1:eIGaZVMQm/O50KE9eVCX4If3Hyf5Ts/N4ACLvhyiXvM= github.com/batchcorp/plumber-schemas v0.0.180/go.mod h1:0g9lX0S7Ec7JVa0kzAkJC3gWAFbwIUcK3/VJ0n68KhA= +github.com/batchcorp/plumber-schemas v0.0.185 h1:9fMpw1pr1nVgQW1FIrGNPxK83nizgIE3E/H3pEJiG30= +github.com/batchcorp/plumber-schemas v0.0.185/go.mod h1:gs6JhcCX29FLplmxzqEMns9g4ks+avrIbEzuW4uZHGI= github.com/batchcorp/plz v0.9.2 h1:bPqb+sn7OUrpHjeTEI9YO4BJS9IQ7AstDDz2gn+tcn8= github.com/batchcorp/plz v0.9.2/go.mod h1:3gacX+hQo+xvl0vtLqCMufzxuNCwt4geAVOMt2LQYfE= github.com/batchcorp/rabbit v0.1.17 h1:dui1W7FLTrNxyVlDN+G+6d8LXz8HBhVAcUethXql9vQ= @@ -318,6 +326,8 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -339,6 +349,8 @@ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8 github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -347,11 +359,17 @@ github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLe github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= +github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= +github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= +github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.2.4 h1:uGy6JWR/uMIILU8wbf+OkstIrNiMjGpEIyhx8f6W7s4= github.com/googleapis/enterprise-certificate-proxy v0.2.4/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= +github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= +github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= @@ -600,6 +618,8 @@ github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9 github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= github.com/onsi/gomega v1.20.2 h1:8uQq0zMgLEfa0vRrrBgaJF2gyW9Da9BmfGV+OyUzfkY= github.com/onsi/gomega v1.20.2/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc= +github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= +github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= @@ -704,6 +724,10 @@ github.com/streadway/amqp v1.0.0 h1:kuuDrUJFZL1QYL9hUNuCxNObNzB0bV/ZG5jV3RWAQgo= github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streamdal/pgoutput v0.3.3 h1:4XLuGQFzmMFQd4U/zy1X5lMICXduHp8vG7FlbYpUFn0= github.com/streamdal/pgoutput v0.3.3/go.mod h1:19V8kXi7a88guhXqvNpL2HH7sbnCYk0i93H4Q2i5iUA= +github.com/streamdal/streamdal/libs/protos v0.1.29 h1:0kMKUB+r85Z+vqXqkamezL+cMP4Y5mGkeXEdBwHaUG0= +github.com/streamdal/streamdal/libs/protos v0.1.29/go.mod h1:1rQ250ydoKeRoJftIV9qGrR28Iqdb9+7Jcnoxber/eQ= +github.com/streamdal/streamdal/sdks/go v0.1.12 h1:+ThTwfcwb3foBDDce56KBGedpBSs+ZsOo10IVR98g3A= +github.com/streamdal/streamdal/sdks/go v0.1.12/go.mod h1:kxKv5WKSjEFDMAa/z1ni/m3RonHGLEmOggpEXvoVZ+c= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= @@ -721,6 +745,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tetratelabs/wazero v1.6.0 h1:z0H1iikCdP8t+q341xqepY4EWvHEw8Es7tlqiVzlP3g= +github.com/tetratelabs/wazero v1.6.0/go.mod h1:0U0G41+ochRKoPKCJlh0jMg1CHkyfK8kDqiirMmKY8A= github.com/tidwall/gjson v1.9.3 h1:hqzS9wAHMO+KVBBkLxYdkEeeFHuqr95GfClRLKlgK0E= github.com/tidwall/gjson v1.9.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= @@ -809,6 +835,8 @@ golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= +golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -835,6 +863,8 @@ golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2 golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -874,6 +904,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220725212005-46097bf591d3/go.mod h1:AaygXjzTFtRAg2ttMY5RMuhpJ3cNnI0XpyFJD1iQRSM= golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos= golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -894,6 +926,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -949,10 +983,14 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= +golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -969,6 +1007,8 @@ golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1007,6 +1047,8 @@ golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= +golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1018,6 +1060,8 @@ google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEn google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/api v0.128.0 h1:RjPESny5CnQRn9V6siglged+DZCgfu9l6mO9dkX9VOg= google.golang.org/api v0.128.0/go.mod h1:Y611qgqaE92On/7g65MQgxYul3c0rEB894kniWLY750= +google.golang.org/api v0.149.0 h1:b2CqT6kG+zqJIVKRQ3ELJVLN1PwHZ6DJ3dW8yl82rgY= +google.golang.org/api v0.149.0/go.mod h1:Mwn1B7JTXrzXtnvmzQE2BD6bYZQ8DShKZDZbeN9I7qI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1037,10 +1081,16 @@ google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 h1:SeZZZx0cP0fqUyA+oRzP9k7cSwJlvDFiROO72uwD6i0= google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97/go.mod h1:t1VqOqqvce95G3hIDCT5FeO3YUc6Q4Oe24L/+rNMxRk= +google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 h1:nz5NESFLZbJGPFxDT/HCn+V1mZ8JGNoY4nUpmW/Y2eg= +google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917/go.mod h1:pZqR+glSb11aJ+JQcczCvgf47+duRuzNSKqE8YAQnV0= google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1:W18sezcAYs+3tDZX4F80yctqa12jcP1PUS2gQu1zTPU= google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0= +google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 h1:s1w3X6gQxwrLEpxnLd/qXTVLgQE2yXwaOaoa6IlY/+o= +google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0/go.mod h1:CAny0tYF+0/9rmDB9fahA9YLzX3+AEVl1qXbv5hhj6c= google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac h1:nUQEQmH/csSvFECKYRv6HWEyypysidKl2I6Qpsglq/0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -1055,6 +1105,8 @@ google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9K google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= +google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= +google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1074,6 +1126,8 @@ google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/plumber/cli_manage_relay.go b/plumber/cli_manage_relay.go index 87e1078c7..b612be3da 100644 --- a/plumber/cli_manage_relay.go +++ b/plumber/cli_manage_relay.go @@ -2,7 +2,6 @@ package plumber import ( "context" - "fmt" "strings" "github.com/pkg/errors" @@ -181,8 +180,6 @@ func (p *Plumber) HandleCreateRelayCmd(ctx context.Context, client protos.Plumbe return errors.Wrap(err, "failed to generate relay options") } - fmt.Printf("Would pass this to grpc api: %+v\n", relayOpts) - resp, err := client.CreateRelay(ctx, &protos.CreateRelayRequest{ Auth: &common.Auth{ Token: p.CLIOptions.Manage.GlobalOptions.ManageToken, diff --git a/relay/relay.go b/relay/relay.go index 524716feb..2d3a5ec91 100644 --- a/relay/relay.go +++ b/relay/relay.go @@ -10,6 +10,7 @@ import ( "github.com/pkg/errors" "github.com/sirupsen/logrus" + sdk "github.com/streamdal/streamdal/sdks/go" "google.golang.org/grpc" "google.golang.org/grpc/credentials" "google.golang.org/grpc/metadata" @@ -61,7 +62,6 @@ var ( ErrMissingConfig = errors.New("Relay config cannot be nil") ErrMissingToken = errors.New("Token cannot be empty") ErrMissingServiceShutdownCtx = errors.New("ServiceShutdownCtx cannot be nil") - ErrMissingGRPCAddress = errors.New("GRPCAddress cannot be empty") ErrMissingRelayCh = errors.New("RelayCh cannot be nil") ErrMissingMessage = errors.New("msg cannot be nil") ErrMissingMessageValue = errors.New("msg.Value cannot be nil") @@ -74,9 +74,10 @@ type IRelayBackend interface { type Relay struct { *Config - Workers map[int32]struct{} - WorkersMutex *sync.RWMutex - log *logrus.Entry + Workers map[int32]struct{} + WorkersMutex *sync.RWMutex + StreamdalClient *sdk.Streamdal + log *logrus.Entry } type Config struct { @@ -268,7 +269,7 @@ func (r *Relay) Run(id int32, conn *grpc.ClientConn, outboundCtx, shutdownCtx co queue := make([]interface{}, 0) - // This functions as an escape-vale -- if we are pumping messages *REALLY* + // This functions as an escape-valve -- if we are pumping messages *REALLY* // fast - we will hit max queue size; if we are pumping messages slowly, // the ticker will be hit and the queue will be flushed, regardless of size. flushTicker := time.NewTicker(QueueFlushInterval) diff --git a/util/util.go b/util/util.go index dcfc0fd7b..9ddf5d2ff 100644 --- a/util/util.go +++ b/util/util.go @@ -15,10 +15,12 @@ import ( "strings" "time" + "github.com/batchcorp/plumber-schemas/build/go/protos/opts" "github.com/nats-io/nats.go" "github.com/nats-io/nkeys" "github.com/pkg/errors" "github.com/sirupsen/logrus" + sdk "github.com/streamdal/streamdal/sdks/go" "github.com/batchcorp/plumber-schemas/build/go/protos/records" ) @@ -112,6 +114,30 @@ func WriteError(l *logrus.Entry, errorCh chan<- *records.ErrorRecord, err error) } } +// SetupStreamdalSDK creates a new Streamdal client if the integration is enabled. +// If integration opts are nil or if integration is not enabled, return nil. +func SetupStreamdalSDK(relayOpts *opts.RelayOptions, l *logrus.Entry) (*sdk.Streamdal, error) { + // Either no StreamIntegrationOptions or integration is disabled + if relayOpts == nil || relayOpts.StreamdalIntegrationOptions == nil || !relayOpts.StreamdalIntegrationOptions.StreamdalIntegrationEnable { + return nil, nil + } + + // Integration is enabled; create client + sc, err := sdk.New(&sdk.Config{ + ServerURL: relayOpts.StreamdalIntegrationOptions.StreamdalIntegrationServerAddress, + ServerToken: relayOpts.StreamdalIntegrationOptions.StreamdalIntegrationAuthToken, + ServiceName: relayOpts.StreamdalIntegrationOptions.StreamdalIntegrationServiceName, + Logger: l, + ClientType: sdk.ClientTypeSDK, + }) + + if err != nil { + return nil, errors.Wrap(err, "unable to create new streamdal client") + } + + return sc, nil +} + func MapInterfaceToString(input map[string]interface{}) map[string]string { out := make(map[string]string) diff --git a/vendor/cloud.google.com/go/compute/internal/version.go b/vendor/cloud.google.com/go/compute/internal/version.go index 639553700..540ad16ac 100644 --- a/vendor/cloud.google.com/go/compute/internal/version.go +++ b/vendor/cloud.google.com/go/compute/internal/version.go @@ -15,4 +15,4 @@ package internal // Version is the current tagged release of the library. -const Version = "1.23.0" +const Version = "1.23.3" diff --git a/vendor/cloud.google.com/go/iam/CHANGES.md b/vendor/cloud.google.com/go/iam/CHANGES.md index b8a244178..c4cacb03f 100644 --- a/vendor/cloud.google.com/go/iam/CHANGES.md +++ b/vendor/cloud.google.com/go/iam/CHANGES.md @@ -1,6 +1,27 @@ # Changes +## [1.1.5](https://github.com/googleapis/google-cloud-go/compare/iam/v1.1.4...iam/v1.1.5) (2023-11-01) + + +### Bug Fixes + +* **iam:** Bump google.golang.org/api to v0.149.0 ([8d2ab9f](https://github.com/googleapis/google-cloud-go/commit/8d2ab9f320a86c1c0fab90513fc05861561d0880)) + +## [1.1.4](https://github.com/googleapis/google-cloud-go/compare/iam/v1.1.3...iam/v1.1.4) (2023-10-26) + + +### Bug Fixes + +* **iam:** Update grpc-go to v1.59.0 ([81a97b0](https://github.com/googleapis/google-cloud-go/commit/81a97b06cb28b25432e4ece595c55a9857e960b7)) + +## [1.1.3](https://github.com/googleapis/google-cloud-go/compare/iam/v1.1.2...iam/v1.1.3) (2023-10-12) + + +### Bug Fixes + +* **iam:** Update golang.org/x/net to v0.17.0 ([174da47](https://github.com/googleapis/google-cloud-go/commit/174da47254fefb12921bbfc65b7829a453af6f5d)) + ## [1.1.2](https://github.com/googleapis/google-cloud-go/compare/iam/v1.1.1...iam/v1.1.2) (2023-08-08) diff --git a/vendor/cloud.google.com/go/iam/apiv1/iampb/iam_policy.pb.go b/vendor/cloud.google.com/go/iam/apiv1/iampb/iam_policy.pb.go index 3d3e76323..85346a891 100644 --- a/vendor/cloud.google.com/go/iam/apiv1/iampb/iam_policy.pb.go +++ b/vendor/cloud.google.com/go/iam/apiv1/iampb/iam_policy.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 +// protoc-gen-go v1.31.0 // protoc v4.23.2 // source: google/iam/v1/iam_policy.proto diff --git a/vendor/cloud.google.com/go/iam/apiv1/iampb/options.pb.go b/vendor/cloud.google.com/go/iam/apiv1/iampb/options.pb.go index adc445b07..68f8d761f 100644 --- a/vendor/cloud.google.com/go/iam/apiv1/iampb/options.pb.go +++ b/vendor/cloud.google.com/go/iam/apiv1/iampb/options.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 +// protoc-gen-go v1.31.0 // protoc v4.23.2 // source: google/iam/v1/options.proto diff --git a/vendor/cloud.google.com/go/iam/apiv1/iampb/policy.pb.go b/vendor/cloud.google.com/go/iam/apiv1/iampb/policy.pb.go index de7995434..eefd1d0e5 100644 --- a/vendor/cloud.google.com/go/iam/apiv1/iampb/policy.pb.go +++ b/vendor/cloud.google.com/go/iam/apiv1/iampb/policy.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 +// protoc-gen-go v1.31.0 // protoc v4.23.2 // source: google/iam/v1/policy.proto diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_gcp_pubsub.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_gcp_pubsub.pb.go index af59a6da1..0ea855841 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_gcp_pubsub.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/args/ps_args_gcp_pubsub.pb.go @@ -95,8 +95,6 @@ type GCPPubSubReadArgs struct { SubscriptionId string `protobuf:"bytes,1,opt,name=subscription_id,json=subscriptionId,proto3" json:"subscription_id,omitempty" kong:"help='Subscription ID',env='PLUMBER_RELAY_GCP_SUBSCRIPTION_ID',required"` // @gotags: kong:"help='Whether to acknowledge message receive',env='PLUMBER_RELAY_GCP_ACK_MESSAGE',default=true" AckMessages bool `protobuf:"varint,2,opt,name=ack_messages,json=ackMessages,proto3" json:"ack_messages,omitempty" kong:"help='Whether to acknowledge message receive',env='PLUMBER_RELAY_GCP_ACK_MESSAGE',default=true"` - // @gotags: kong:"help='Testing new field'" - AnotherField string `protobuf:"bytes,3,opt,name=another_field,json=anotherField,proto3" json:"another_field,omitempty" kong:"help='Testing new field'"` } func (x *GCPPubSubReadArgs) Reset() { @@ -145,13 +143,6 @@ func (x *GCPPubSubReadArgs) GetAckMessages() bool { return false } -func (x *GCPPubSubReadArgs) GetAnotherField() string { - if x != nil { - return x.AnotherField - } - return "" -} - type GCPPubSubWriteArgs struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -213,23 +204,21 @@ var file_ps_args_gcp_pubsub_proto_rawDesc = []byte{ 0x28, 0x09, 0x52, 0x0f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x4a, 0x73, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, - 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x46, 0x69, 0x6c, 0x65, 0x22, 0x84, - 0x01, 0x0a, 0x11, 0x47, 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x52, 0x65, 0x61, 0x64, - 0x41, 0x72, 0x67, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, - 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x21, 0x0a, - 0x0c, 0x61, 0x63, 0x6b, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x0b, 0x61, 0x63, 0x6b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, - 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x65, 0x6c, - 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, - 0x46, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x2f, 0x0a, 0x12, 0x47, 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, - 0x75, 0x62, 0x57, 0x72, 0x69, 0x74, 0x65, 0x41, 0x72, 0x67, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x74, - 0x6f, 0x70, 0x69, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, - 0x6f, 0x70, 0x69, 0x63, 0x49, 0x64, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, - 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, - 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x61, - 0x72, 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x46, 0x69, 0x6c, 0x65, 0x22, 0x5f, + 0x0a, 0x11, 0x47, 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x52, 0x65, 0x61, 0x64, 0x41, + 0x72, 0x67, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, + 0x61, 0x63, 0x6b, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x0b, 0x61, 0x63, 0x6b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x22, + 0x2f, 0x0a, 0x12, 0x47, 0x43, 0x50, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x57, 0x72, 0x69, 0x74, + 0x65, 0x41, 0x72, 0x67, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x49, 0x64, + 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, + 0x61, 0x74, 0x63, 0x68, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x70, 0x6c, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x2d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, + 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x61, 0x72, 0x67, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/batch_connection_options.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/batch_connection_options.pb.go index ef1128903..a31dce09a 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/batch_connection_options.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/batch_connection_options.pb.go @@ -8,203 +8,203 @@ import ( func GenerateConnOpts(backend string, connArgs interface{}) (IsConnectionOptions_Conn, bool) { switch backend { - case "azureservicebus": - asserted, ok := connArgs.(args.AzureServiceBusConn) + case "memphis": + asserted, ok := connArgs.(args.MemphisConn) if !ok { return nil, false } - return &ConnectionOptions_AzureServiceBus{ - AzureServiceBus: &asserted, + return &ConnectionOptions_Memphis{ + Memphis: &asserted, }, true - case "mqtt": - asserted, ok := connArgs.(args.MQTTConn) + case "awssns": + asserted, ok := connArgs.(args.AWSSNSConn) if !ok { return nil, false } - return &ConnectionOptions_Mqtt{ - Mqtt: &asserted, + return &ConnectionOptions_AwsSns{ + AwsSns: &asserted, }, true - case "kafka": - asserted, ok := connArgs.(args.KafkaConn) + case "nsq": + asserted, ok := connArgs.(args.NSQConn) if !ok { return nil, false } - return &ConnectionOptions_Kafka{ - Kafka: &asserted, + return &ConnectionOptions_Nsq{ + Nsq: &asserted, }, true - case "activemq": - asserted, ok := connArgs.(args.ActiveMQConn) + case "rabbitstreams": + asserted, ok := connArgs.(args.RabbitStreamsConn) if !ok { return nil, false } - return &ConnectionOptions_ActiveMq{ - ActiveMq: &asserted, + return &ConnectionOptions_RabbitStreams{ + RabbitStreams: &asserted, }, true - case "postgres": - asserted, ok := connArgs.(args.PostgresConn) + case "azureeventhub": + asserted, ok := connArgs.(args.AzureEventHubConn) if !ok { return nil, false } - return &ConnectionOptions_Postgres{ - Postgres: &asserted, + return &ConnectionOptions_AzureEventHub{ + AzureEventHub: &asserted, }, true - case "pulsar": - asserted, ok := connArgs.(args.PulsarConn) + case "azureservicebus": + asserted, ok := connArgs.(args.AzureServiceBusConn) if !ok { return nil, false } - return &ConnectionOptions_Pulsar{ - Pulsar: &asserted, + return &ConnectionOptions_AzureServiceBus{ + AzureServiceBus: &asserted, }, true - case "rabbit": - asserted, ok := connArgs.(args.RabbitConn) + case "natsjetstream": + asserted, ok := connArgs.(args.NatsJetstreamConn) if !ok { return nil, false } - return &ConnectionOptions_Rabbit{ - Rabbit: &asserted, + return &ConnectionOptions_NatsJetstream{ + NatsJetstream: &asserted, }, true - case "azureeventhub": - asserted, ok := connArgs.(args.AzureEventHubConn) + case "mongo": + asserted, ok := connArgs.(args.MongoConn) if !ok { return nil, false } - return &ConnectionOptions_AzureEventHub{ - AzureEventHub: &asserted, + return &ConnectionOptions_Mongo{ + Mongo: &asserted, }, true - case "gcppubsub": - asserted, ok := connArgs.(args.GCPPubSubConn) + case "natsstreaming": + asserted, ok := connArgs.(args.NatsStreamingConn) if !ok { return nil, false } - return &ConnectionOptions_GcpPubsub{ - GcpPubsub: &asserted, + return &ConnectionOptions_NatsStreaming{ + NatsStreaming: &asserted, }, true - case "awskinesis": - asserted, ok := connArgs.(args.AWSKinesisConn) + case "redisstreams": + asserted, ok := connArgs.(args.RedisStreamsConn) if !ok { return nil, false } - return &ConnectionOptions_AwsKinesis{ - AwsKinesis: &asserted, + return &ConnectionOptions_RedisStreams{ + RedisStreams: &asserted, }, true - case "memphis": - asserted, ok := connArgs.(args.MemphisConn) + case "kubemqqueue": + asserted, ok := connArgs.(args.KubeMQQueueConn) if !ok { return nil, false } - return &ConnectionOptions_Memphis{ - Memphis: &asserted, + return &ConnectionOptions_KubemqQueue{ + KubemqQueue: &asserted, }, true - case "awssqs": - asserted, ok := connArgs.(args.AWSSQSConn) + case "gcppubsub": + asserted, ok := connArgs.(args.GCPPubSubConn) if !ok { return nil, false } - return &ConnectionOptions_AwsSqs{ - AwsSqs: &asserted, + return &ConnectionOptions_GcpPubsub{ + GcpPubsub: &asserted, }, true - case "mongo": - asserted, ok := connArgs.(args.MongoConn) + case "kafka": + asserted, ok := connArgs.(args.KafkaConn) if !ok { return nil, false } - return &ConnectionOptions_Mongo{ - Mongo: &asserted, + return &ConnectionOptions_Kafka{ + Kafka: &asserted, }, true - case "nats": - asserted, ok := connArgs.(args.NatsConn) + case "activemq": + asserted, ok := connArgs.(args.ActiveMQConn) if !ok { return nil, false } - return &ConnectionOptions_Nats{ - Nats: &asserted, + return &ConnectionOptions_ActiveMq{ + ActiveMq: &asserted, }, true - case "redispubsub": - asserted, ok := connArgs.(args.RedisPubSubConn) + case "postgres": + asserted, ok := connArgs.(args.PostgresConn) if !ok { return nil, false } - return &ConnectionOptions_RedisPubsub{ - RedisPubsub: &asserted, + return &ConnectionOptions_Postgres{ + Postgres: &asserted, }, true - case "kubemqqueue": - asserted, ok := connArgs.(args.KubeMQQueueConn) + case "redispubsub": + asserted, ok := connArgs.(args.RedisPubSubConn) if !ok { return nil, false } - return &ConnectionOptions_KubemqQueue{ - KubemqQueue: &asserted, + return &ConnectionOptions_RedisPubsub{ + RedisPubsub: &asserted, }, true - case "natsjetstream": - asserted, ok := connArgs.(args.NatsJetstreamConn) + case "mqtt": + asserted, ok := connArgs.(args.MQTTConn) if !ok { return nil, false } - return &ConnectionOptions_NatsJetstream{ - NatsJetstream: &asserted, + return &ConnectionOptions_Mqtt{ + Mqtt: &asserted, }, true - case "natsstreaming": - asserted, ok := connArgs.(args.NatsStreamingConn) + case "awssqs": + asserted, ok := connArgs.(args.AWSSQSConn) if !ok { return nil, false } - return &ConnectionOptions_NatsStreaming{ - NatsStreaming: &asserted, + return &ConnectionOptions_AwsSqs{ + AwsSqs: &asserted, }, true - case "nsq": - asserted, ok := connArgs.(args.NSQConn) + case "nats": + asserted, ok := connArgs.(args.NatsConn) if !ok { return nil, false } - return &ConnectionOptions_Nsq{ - Nsq: &asserted, + return &ConnectionOptions_Nats{ + Nats: &asserted, }, true - case "awssns": - asserted, ok := connArgs.(args.AWSSNSConn) + case "pulsar": + asserted, ok := connArgs.(args.PulsarConn) if !ok { return nil, false } - return &ConnectionOptions_AwsSns{ - AwsSns: &asserted, + return &ConnectionOptions_Pulsar{ + Pulsar: &asserted, }, true - case "rabbitstreams": - asserted, ok := connArgs.(args.RabbitStreamsConn) + case "rabbit": + asserted, ok := connArgs.(args.RabbitConn) if !ok { return nil, false } - return &ConnectionOptions_RabbitStreams{ - RabbitStreams: &asserted, + return &ConnectionOptions_Rabbit{ + Rabbit: &asserted, }, true - case "redisstreams": - asserted, ok := connArgs.(args.RedisStreamsConn) + case "awskinesis": + asserted, ok := connArgs.(args.AWSKinesisConn) if !ok { return nil, false } - return &ConnectionOptions_RedisStreams{ - RedisStreams: &asserted, + return &ConnectionOptions_AwsKinesis{ + AwsKinesis: &asserted, }, true default: return nil, false diff --git a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_relay.pb.go b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_relay.pb.go index ac4b60435..7d80a8eb0 100644 --- a/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_relay.pb.go +++ b/vendor/github.com/batchcorp/plumber-schemas/build/go/protos/opts/ps_opts_relay.pb.go @@ -1243,37 +1243,37 @@ var File_opts_ps_opts_relay_proto protoreflect.FileDescriptor var file_opts_ps_opts_relay_proto_rawDesc = []byte{ 0x0a, 0x18, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x1a, 0x1f, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, 0x73, - 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x5f, 0x72, 0x65, 0x6c, - 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, - 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x71, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x24, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, - 0x67, 0x73, 0x5f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x61, 0x72, 0x67, 0x73, - 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x67, 0x63, 0x70, 0x5f, 0x70, 0x75, 0x62, - 0x73, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x61, 0x72, 0x67, 0x73, 0x2f, - 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, - 0x73, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, 0x5f, 0x71, 0x75, 0x65, 0x75, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, - 0x67, 0x73, 0x5f, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, - 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6d, 0x71, 0x74, - 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, - 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x21, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, - 0x61, 0x74, 0x73, 0x5f, 0x6a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, - 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, - 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x73, 0x71, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, - 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x70, 0x6f, 0x73, - 0x74, 0x67, 0x72, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x61, 0x72, 0x67, - 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, - 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, - 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, - 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x41, 0x0a, 0x0f, 0x52, 0x65, 0x6c, + 0x6f, 0x73, 0x2e, 0x6f, 0x70, 0x74, 0x73, 0x1a, 0x1a, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, + 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x61, 0x77, 0x73, 0x5f, 0x73, 0x71, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x24, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, + 0x73, 0x5f, 0x61, 0x7a, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, + 0x62, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x61, 0x72, 0x67, 0x73, 0x2f, + 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x67, 0x63, 0x70, 0x5f, 0x70, 0x75, 0x62, 0x73, + 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, + 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1f, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, + 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x6d, 0x71, 0x5f, 0x71, 0x75, 0x65, 0x75, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, + 0x73, 0x5f, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x61, + 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6d, 0x71, 0x74, 0x74, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, + 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x21, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x61, + 0x74, 0x73, 0x5f, 0x6a, 0x65, 0x74, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x21, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, + 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, + 0x72, 0x67, 0x73, 0x5f, 0x6e, 0x73, 0x71, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x61, + 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x70, 0x6f, 0x73, 0x74, + 0x67, 0x72, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x61, 0x72, 0x67, 0x73, + 0x2f, 0x70, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, 0x61, + 0x72, 0x67, 0x73, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x61, 0x72, 0x67, 0x73, 0x2f, 0x70, 0x73, 0x5f, + 0x61, 0x72, 0x67, 0x73, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x6f, 0x70, 0x74, 0x73, 0x2f, 0x70, + 0x73, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x5f, 0x72, 0x65, + 0x6c, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x41, 0x0a, 0x0f, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x4c, 0x49, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x68, 0x74, 0x74, 0x70, 0x4c, diff --git a/vendor/github.com/golang/protobuf/jsonpb/decode.go b/vendor/github.com/golang/protobuf/jsonpb/decode.go index 6c16c255f..c6f66f103 100644 --- a/vendor/github.com/golang/protobuf/jsonpb/decode.go +++ b/vendor/github.com/golang/protobuf/jsonpb/decode.go @@ -56,6 +56,7 @@ type Unmarshaler struct { // implement JSONPBMarshaler so that the custom format can be produced. // // The JSON unmarshaling must follow the JSON to proto specification: +// // https://developers.google.com/protocol-buffers/docs/proto3#json // // Deprecated: Custom types should implement protobuf reflection instead. diff --git a/vendor/github.com/golang/protobuf/jsonpb/encode.go b/vendor/github.com/golang/protobuf/jsonpb/encode.go index 685c80a62..e9438a93f 100644 --- a/vendor/github.com/golang/protobuf/jsonpb/encode.go +++ b/vendor/github.com/golang/protobuf/jsonpb/encode.go @@ -55,6 +55,7 @@ type Marshaler struct { // implement JSONPBUnmarshaler so that the custom format can be parsed. // // The JSON marshaling must follow the proto to JSON specification: +// // https://developers.google.com/protocol-buffers/docs/proto3#json // // Deprecated: Custom types should implement protobuf reflection instead. diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go index 63dc05785..a5a138613 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go @@ -12,6 +12,31 @@ import ( // Symbols defined in public import of google/protobuf/descriptor.proto. +type Edition = descriptorpb.Edition + +const Edition_EDITION_UNKNOWN = descriptorpb.Edition_EDITION_UNKNOWN +const Edition_EDITION_PROTO2 = descriptorpb.Edition_EDITION_PROTO2 +const Edition_EDITION_PROTO3 = descriptorpb.Edition_EDITION_PROTO3 +const Edition_EDITION_2023 = descriptorpb.Edition_EDITION_2023 +const Edition_EDITION_2024 = descriptorpb.Edition_EDITION_2024 +const Edition_EDITION_1_TEST_ONLY = descriptorpb.Edition_EDITION_1_TEST_ONLY +const Edition_EDITION_2_TEST_ONLY = descriptorpb.Edition_EDITION_2_TEST_ONLY +const Edition_EDITION_99997_TEST_ONLY = descriptorpb.Edition_EDITION_99997_TEST_ONLY +const Edition_EDITION_99998_TEST_ONLY = descriptorpb.Edition_EDITION_99998_TEST_ONLY +const Edition_EDITION_99999_TEST_ONLY = descriptorpb.Edition_EDITION_99999_TEST_ONLY +const Edition_EDITION_MAX = descriptorpb.Edition_EDITION_MAX + +var Edition_name = descriptorpb.Edition_name +var Edition_value = descriptorpb.Edition_value + +type ExtensionRangeOptions_VerificationState = descriptorpb.ExtensionRangeOptions_VerificationState + +const ExtensionRangeOptions_DECLARATION = descriptorpb.ExtensionRangeOptions_DECLARATION +const ExtensionRangeOptions_UNVERIFIED = descriptorpb.ExtensionRangeOptions_UNVERIFIED + +var ExtensionRangeOptions_VerificationState_name = descriptorpb.ExtensionRangeOptions_VerificationState_name +var ExtensionRangeOptions_VerificationState_value = descriptorpb.ExtensionRangeOptions_VerificationState_value + type FieldDescriptorProto_Type = descriptorpb.FieldDescriptorProto_Type const FieldDescriptorProto_TYPE_DOUBLE = descriptorpb.FieldDescriptorProto_TYPE_DOUBLE @@ -39,8 +64,8 @@ var FieldDescriptorProto_Type_value = descriptorpb.FieldDescriptorProto_Type_val type FieldDescriptorProto_Label = descriptorpb.FieldDescriptorProto_Label const FieldDescriptorProto_LABEL_OPTIONAL = descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL -const FieldDescriptorProto_LABEL_REQUIRED = descriptorpb.FieldDescriptorProto_LABEL_REQUIRED const FieldDescriptorProto_LABEL_REPEATED = descriptorpb.FieldDescriptorProto_LABEL_REPEATED +const FieldDescriptorProto_LABEL_REQUIRED = descriptorpb.FieldDescriptorProto_LABEL_REQUIRED var FieldDescriptorProto_Label_name = descriptorpb.FieldDescriptorProto_Label_name var FieldDescriptorProto_Label_value = descriptorpb.FieldDescriptorProto_Label_value @@ -72,6 +97,31 @@ const FieldOptions_JS_NUMBER = descriptorpb.FieldOptions_JS_NUMBER var FieldOptions_JSType_name = descriptorpb.FieldOptions_JSType_name var FieldOptions_JSType_value = descriptorpb.FieldOptions_JSType_value +type FieldOptions_OptionRetention = descriptorpb.FieldOptions_OptionRetention + +const FieldOptions_RETENTION_UNKNOWN = descriptorpb.FieldOptions_RETENTION_UNKNOWN +const FieldOptions_RETENTION_RUNTIME = descriptorpb.FieldOptions_RETENTION_RUNTIME +const FieldOptions_RETENTION_SOURCE = descriptorpb.FieldOptions_RETENTION_SOURCE + +var FieldOptions_OptionRetention_name = descriptorpb.FieldOptions_OptionRetention_name +var FieldOptions_OptionRetention_value = descriptorpb.FieldOptions_OptionRetention_value + +type FieldOptions_OptionTargetType = descriptorpb.FieldOptions_OptionTargetType + +const FieldOptions_TARGET_TYPE_UNKNOWN = descriptorpb.FieldOptions_TARGET_TYPE_UNKNOWN +const FieldOptions_TARGET_TYPE_FILE = descriptorpb.FieldOptions_TARGET_TYPE_FILE +const FieldOptions_TARGET_TYPE_EXTENSION_RANGE = descriptorpb.FieldOptions_TARGET_TYPE_EXTENSION_RANGE +const FieldOptions_TARGET_TYPE_MESSAGE = descriptorpb.FieldOptions_TARGET_TYPE_MESSAGE +const FieldOptions_TARGET_TYPE_FIELD = descriptorpb.FieldOptions_TARGET_TYPE_FIELD +const FieldOptions_TARGET_TYPE_ONEOF = descriptorpb.FieldOptions_TARGET_TYPE_ONEOF +const FieldOptions_TARGET_TYPE_ENUM = descriptorpb.FieldOptions_TARGET_TYPE_ENUM +const FieldOptions_TARGET_TYPE_ENUM_ENTRY = descriptorpb.FieldOptions_TARGET_TYPE_ENUM_ENTRY +const FieldOptions_TARGET_TYPE_SERVICE = descriptorpb.FieldOptions_TARGET_TYPE_SERVICE +const FieldOptions_TARGET_TYPE_METHOD = descriptorpb.FieldOptions_TARGET_TYPE_METHOD + +var FieldOptions_OptionTargetType_name = descriptorpb.FieldOptions_OptionTargetType_name +var FieldOptions_OptionTargetType_value = descriptorpb.FieldOptions_OptionTargetType_value + type MethodOptions_IdempotencyLevel = descriptorpb.MethodOptions_IdempotencyLevel const MethodOptions_IDEMPOTENCY_UNKNOWN = descriptorpb.MethodOptions_IDEMPOTENCY_UNKNOWN @@ -81,10 +131,77 @@ const MethodOptions_IDEMPOTENT = descriptorpb.MethodOptions_IDEMPOTENT var MethodOptions_IdempotencyLevel_name = descriptorpb.MethodOptions_IdempotencyLevel_name var MethodOptions_IdempotencyLevel_value = descriptorpb.MethodOptions_IdempotencyLevel_value +type FeatureSet_FieldPresence = descriptorpb.FeatureSet_FieldPresence + +const FeatureSet_FIELD_PRESENCE_UNKNOWN = descriptorpb.FeatureSet_FIELD_PRESENCE_UNKNOWN +const FeatureSet_EXPLICIT = descriptorpb.FeatureSet_EXPLICIT +const FeatureSet_IMPLICIT = descriptorpb.FeatureSet_IMPLICIT +const FeatureSet_LEGACY_REQUIRED = descriptorpb.FeatureSet_LEGACY_REQUIRED + +var FeatureSet_FieldPresence_name = descriptorpb.FeatureSet_FieldPresence_name +var FeatureSet_FieldPresence_value = descriptorpb.FeatureSet_FieldPresence_value + +type FeatureSet_EnumType = descriptorpb.FeatureSet_EnumType + +const FeatureSet_ENUM_TYPE_UNKNOWN = descriptorpb.FeatureSet_ENUM_TYPE_UNKNOWN +const FeatureSet_OPEN = descriptorpb.FeatureSet_OPEN +const FeatureSet_CLOSED = descriptorpb.FeatureSet_CLOSED + +var FeatureSet_EnumType_name = descriptorpb.FeatureSet_EnumType_name +var FeatureSet_EnumType_value = descriptorpb.FeatureSet_EnumType_value + +type FeatureSet_RepeatedFieldEncoding = descriptorpb.FeatureSet_RepeatedFieldEncoding + +const FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN = descriptorpb.FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN +const FeatureSet_PACKED = descriptorpb.FeatureSet_PACKED +const FeatureSet_EXPANDED = descriptorpb.FeatureSet_EXPANDED + +var FeatureSet_RepeatedFieldEncoding_name = descriptorpb.FeatureSet_RepeatedFieldEncoding_name +var FeatureSet_RepeatedFieldEncoding_value = descriptorpb.FeatureSet_RepeatedFieldEncoding_value + +type FeatureSet_Utf8Validation = descriptorpb.FeatureSet_Utf8Validation + +const FeatureSet_UTF8_VALIDATION_UNKNOWN = descriptorpb.FeatureSet_UTF8_VALIDATION_UNKNOWN +const FeatureSet_VERIFY = descriptorpb.FeatureSet_VERIFY +const FeatureSet_NONE = descriptorpb.FeatureSet_NONE + +var FeatureSet_Utf8Validation_name = descriptorpb.FeatureSet_Utf8Validation_name +var FeatureSet_Utf8Validation_value = descriptorpb.FeatureSet_Utf8Validation_value + +type FeatureSet_MessageEncoding = descriptorpb.FeatureSet_MessageEncoding + +const FeatureSet_MESSAGE_ENCODING_UNKNOWN = descriptorpb.FeatureSet_MESSAGE_ENCODING_UNKNOWN +const FeatureSet_LENGTH_PREFIXED = descriptorpb.FeatureSet_LENGTH_PREFIXED +const FeatureSet_DELIMITED = descriptorpb.FeatureSet_DELIMITED + +var FeatureSet_MessageEncoding_name = descriptorpb.FeatureSet_MessageEncoding_name +var FeatureSet_MessageEncoding_value = descriptorpb.FeatureSet_MessageEncoding_value + +type FeatureSet_JsonFormat = descriptorpb.FeatureSet_JsonFormat + +const FeatureSet_JSON_FORMAT_UNKNOWN = descriptorpb.FeatureSet_JSON_FORMAT_UNKNOWN +const FeatureSet_ALLOW = descriptorpb.FeatureSet_ALLOW +const FeatureSet_LEGACY_BEST_EFFORT = descriptorpb.FeatureSet_LEGACY_BEST_EFFORT + +var FeatureSet_JsonFormat_name = descriptorpb.FeatureSet_JsonFormat_name +var FeatureSet_JsonFormat_value = descriptorpb.FeatureSet_JsonFormat_value + +type GeneratedCodeInfo_Annotation_Semantic = descriptorpb.GeneratedCodeInfo_Annotation_Semantic + +const GeneratedCodeInfo_Annotation_NONE = descriptorpb.GeneratedCodeInfo_Annotation_NONE +const GeneratedCodeInfo_Annotation_SET = descriptorpb.GeneratedCodeInfo_Annotation_SET +const GeneratedCodeInfo_Annotation_ALIAS = descriptorpb.GeneratedCodeInfo_Annotation_ALIAS + +var GeneratedCodeInfo_Annotation_Semantic_name = descriptorpb.GeneratedCodeInfo_Annotation_Semantic_name +var GeneratedCodeInfo_Annotation_Semantic_value = descriptorpb.GeneratedCodeInfo_Annotation_Semantic_value + type FileDescriptorSet = descriptorpb.FileDescriptorSet type FileDescriptorProto = descriptorpb.FileDescriptorProto type DescriptorProto = descriptorpb.DescriptorProto type ExtensionRangeOptions = descriptorpb.ExtensionRangeOptions + +const Default_ExtensionRangeOptions_Verification = descriptorpb.Default_ExtensionRangeOptions_Verification + type FieldDescriptorProto = descriptorpb.FieldDescriptorProto type OneofDescriptorProto = descriptorpb.OneofDescriptorProto type EnumDescriptorProto = descriptorpb.EnumDescriptorProto @@ -103,7 +220,6 @@ const Default_FileOptions_OptimizeFor = descriptorpb.Default_FileOptions_Optimiz const Default_FileOptions_CcGenericServices = descriptorpb.Default_FileOptions_CcGenericServices const Default_FileOptions_JavaGenericServices = descriptorpb.Default_FileOptions_JavaGenericServices const Default_FileOptions_PyGenericServices = descriptorpb.Default_FileOptions_PyGenericServices -const Default_FileOptions_PhpGenericServices = descriptorpb.Default_FileOptions_PhpGenericServices const Default_FileOptions_Deprecated = descriptorpb.Default_FileOptions_Deprecated const Default_FileOptions_CcEnableArenas = descriptorpb.Default_FileOptions_CcEnableArenas @@ -118,8 +234,10 @@ type FieldOptions = descriptorpb.FieldOptions const Default_FieldOptions_Ctype = descriptorpb.Default_FieldOptions_Ctype const Default_FieldOptions_Jstype = descriptorpb.Default_FieldOptions_Jstype const Default_FieldOptions_Lazy = descriptorpb.Default_FieldOptions_Lazy +const Default_FieldOptions_UnverifiedLazy = descriptorpb.Default_FieldOptions_UnverifiedLazy const Default_FieldOptions_Deprecated = descriptorpb.Default_FieldOptions_Deprecated const Default_FieldOptions_Weak = descriptorpb.Default_FieldOptions_Weak +const Default_FieldOptions_DebugRedact = descriptorpb.Default_FieldOptions_DebugRedact type OneofOptions = descriptorpb.OneofOptions type EnumOptions = descriptorpb.EnumOptions @@ -129,6 +247,7 @@ const Default_EnumOptions_Deprecated = descriptorpb.Default_EnumOptions_Deprecat type EnumValueOptions = descriptorpb.EnumValueOptions const Default_EnumValueOptions_Deprecated = descriptorpb.Default_EnumValueOptions_Deprecated +const Default_EnumValueOptions_DebugRedact = descriptorpb.Default_EnumValueOptions_DebugRedact type ServiceOptions = descriptorpb.ServiceOptions @@ -140,12 +259,17 @@ const Default_MethodOptions_Deprecated = descriptorpb.Default_MethodOptions_Depr const Default_MethodOptions_IdempotencyLevel = descriptorpb.Default_MethodOptions_IdempotencyLevel type UninterpretedOption = descriptorpb.UninterpretedOption +type FeatureSet = descriptorpb.FeatureSet +type FeatureSetDefaults = descriptorpb.FeatureSetDefaults type SourceCodeInfo = descriptorpb.SourceCodeInfo type GeneratedCodeInfo = descriptorpb.GeneratedCodeInfo type DescriptorProto_ExtensionRange = descriptorpb.DescriptorProto_ExtensionRange type DescriptorProto_ReservedRange = descriptorpb.DescriptorProto_ReservedRange +type ExtensionRangeOptions_Declaration = descriptorpb.ExtensionRangeOptions_Declaration type EnumDescriptorProto_EnumReservedRange = descriptorpb.EnumDescriptorProto_EnumReservedRange +type FieldOptions_EditionDefault = descriptorpb.FieldOptions_EditionDefault type UninterpretedOption_NamePart = descriptorpb.UninterpretedOption_NamePart +type FeatureSetDefaults_FeatureSetEditionDefault = descriptorpb.FeatureSetDefaults_FeatureSetEditionDefault type SourceCodeInfo_Location = descriptorpb.SourceCodeInfo_Location type GeneratedCodeInfo_Annotation = descriptorpb.GeneratedCodeInfo_Annotation diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.go index b7b4a2f94..04561b858 100644 --- a/vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.go +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.go @@ -16,6 +16,7 @@ type CodeGeneratorResponse_Feature = pluginpb.CodeGeneratorResponse_Feature const CodeGeneratorResponse_FEATURE_NONE = pluginpb.CodeGeneratorResponse_FEATURE_NONE const CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL = pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL +const CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS = pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS var CodeGeneratorResponse_Feature_name = pluginpb.CodeGeneratorResponse_Feature_name var CodeGeneratorResponse_Feature_value = pluginpb.CodeGeneratorResponse_Feature_value diff --git a/vendor/github.com/golang/protobuf/ptypes/any.go b/vendor/github.com/golang/protobuf/ptypes/any.go index 85f9f5736..fdff3fdb4 100644 --- a/vendor/github.com/golang/protobuf/ptypes/any.go +++ b/vendor/github.com/golang/protobuf/ptypes/any.go @@ -127,9 +127,10 @@ func Is(any *anypb.Any, m proto.Message) bool { // The allocated message is stored in the embedded proto.Message. // // Example: -// var x ptypes.DynamicAny -// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... } -// fmt.Printf("unmarshaled message: %v", x.Message) +// +// var x ptypes.DynamicAny +// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... } +// fmt.Printf("unmarshaled message: %v", x.Message) // // Deprecated: Use the any.UnmarshalNew method instead to unmarshal // the any message contents into a new instance of the underlying message. diff --git a/vendor/github.com/google/go-cmp/cmp/compare.go b/vendor/github.com/google/go-cmp/cmp/compare.go index 087320da7..0f5b8a48c 100644 --- a/vendor/github.com/google/go-cmp/cmp/compare.go +++ b/vendor/github.com/google/go-cmp/cmp/compare.go @@ -5,7 +5,7 @@ // Package cmp determines equality of values. // // This package is intended to be a more powerful and safer alternative to -// reflect.DeepEqual for comparing whether two values are semantically equal. +// [reflect.DeepEqual] for comparing whether two values are semantically equal. // It is intended to only be used in tests, as performance is not a goal and // it may panic if it cannot compare the values. Its propensity towards // panicking means that its unsuitable for production environments where a @@ -18,16 +18,17 @@ // For example, an equality function may report floats as equal so long as // they are within some tolerance of each other. // -// - Types with an Equal method may use that method to determine equality. -// This allows package authors to determine the equality operation -// for the types that they define. +// - Types with an Equal method (e.g., [time.Time.Equal]) may use that method +// to determine equality. This allows package authors to determine +// the equality operation for the types that they define. // // - If no custom equality functions are used and no Equal method is defined, // equality is determined by recursively comparing the primitive kinds on -// both values, much like reflect.DeepEqual. Unlike reflect.DeepEqual, +// both values, much like [reflect.DeepEqual]. Unlike [reflect.DeepEqual], // unexported fields are not compared by default; they result in panics -// unless suppressed by using an Ignore option (see cmpopts.IgnoreUnexported) -// or explicitly compared using the Exporter option. +// unless suppressed by using an [Ignore] option +// (see [github.com/google/go-cmp/cmp/cmpopts.IgnoreUnexported]) +// or explicitly compared using the [Exporter] option. package cmp import ( @@ -45,14 +46,14 @@ import ( // Equal reports whether x and y are equal by recursively applying the // following rules in the given order to x and y and all of their sub-values: // -// - Let S be the set of all Ignore, Transformer, and Comparer options that +// - Let S be the set of all [Ignore], [Transformer], and [Comparer] options that // remain after applying all path filters, value filters, and type filters. -// If at least one Ignore exists in S, then the comparison is ignored. -// If the number of Transformer and Comparer options in S is non-zero, +// If at least one [Ignore] exists in S, then the comparison is ignored. +// If the number of [Transformer] and [Comparer] options in S is non-zero, // then Equal panics because it is ambiguous which option to use. -// If S contains a single Transformer, then use that to transform +// If S contains a single [Transformer], then use that to transform // the current values and recursively call Equal on the output values. -// If S contains a single Comparer, then use that to compare the current values. +// If S contains a single [Comparer], then use that to compare the current values. // Otherwise, evaluation proceeds to the next rule. // // - If the values have an Equal method of the form "(T) Equal(T) bool" or @@ -66,21 +67,22 @@ import ( // Functions are only equal if they are both nil, otherwise they are unequal. // // Structs are equal if recursively calling Equal on all fields report equal. -// If a struct contains unexported fields, Equal panics unless an Ignore option -// (e.g., cmpopts.IgnoreUnexported) ignores that field or the Exporter option -// explicitly permits comparing the unexported field. +// If a struct contains unexported fields, Equal panics unless an [Ignore] option +// (e.g., [github.com/google/go-cmp/cmp/cmpopts.IgnoreUnexported]) ignores that field +// or the [Exporter] option explicitly permits comparing the unexported field. // // Slices are equal if they are both nil or both non-nil, where recursively // calling Equal on all non-ignored slice or array elements report equal. // Empty non-nil slices and nil slices are not equal; to equate empty slices, -// consider using cmpopts.EquateEmpty. +// consider using [github.com/google/go-cmp/cmp/cmpopts.EquateEmpty]. // // Maps are equal if they are both nil or both non-nil, where recursively // calling Equal on all non-ignored map entries report equal. // Map keys are equal according to the == operator. -// To use custom comparisons for map keys, consider using cmpopts.SortMaps. +// To use custom comparisons for map keys, consider using +// [github.com/google/go-cmp/cmp/cmpopts.SortMaps]. // Empty non-nil maps and nil maps are not equal; to equate empty maps, -// consider using cmpopts.EquateEmpty. +// consider using [github.com/google/go-cmp/cmp/cmpopts.EquateEmpty]. // // Pointers and interfaces are equal if they are both nil or both non-nil, // where they have the same underlying concrete type and recursively diff --git a/vendor/github.com/google/go-cmp/cmp/export_panic.go b/vendor/github.com/google/go-cmp/cmp/export_panic.go deleted file mode 100644 index ae851fe53..000000000 --- a/vendor/github.com/google/go-cmp/cmp/export_panic.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build purego -// +build purego - -package cmp - -import "reflect" - -const supportExporters = false - -func retrieveUnexportedField(reflect.Value, reflect.StructField, bool) reflect.Value { - panic("no support for forcibly accessing unexported fields") -} diff --git a/vendor/github.com/google/go-cmp/cmp/export_unsafe.go b/vendor/github.com/google/go-cmp/cmp/export_unsafe.go deleted file mode 100644 index e2c0f74e8..000000000 --- a/vendor/github.com/google/go-cmp/cmp/export_unsafe.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !purego -// +build !purego - -package cmp - -import ( - "reflect" - "unsafe" -) - -const supportExporters = true - -// retrieveUnexportedField uses unsafe to forcibly retrieve any field from -// a struct such that the value has read-write permissions. -// -// The parent struct, v, must be addressable, while f must be a StructField -// describing the field to retrieve. If addr is false, -// then the returned value will be shallowed copied to be non-addressable. -func retrieveUnexportedField(v reflect.Value, f reflect.StructField, addr bool) reflect.Value { - ve := reflect.NewAt(f.Type, unsafe.Pointer(uintptr(unsafe.Pointer(v.UnsafeAddr()))+f.Offset)).Elem() - if !addr { - // A field is addressable if and only if the struct is addressable. - // If the original parent value was not addressable, shallow copy the - // value to make it non-addressable to avoid leaking an implementation - // detail of how forcibly exporting a field works. - if ve.Kind() == reflect.Interface && ve.IsNil() { - return reflect.Zero(f.Type) - } - return reflect.ValueOf(ve.Interface()).Convert(f.Type) - } - return ve -} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go b/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go deleted file mode 100644 index 1a71bfcbd..000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2018, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build purego -// +build purego - -package value - -import "reflect" - -// Pointer is an opaque typed pointer and is guaranteed to be comparable. -type Pointer struct { - p uintptr - t reflect.Type -} - -// PointerOf returns a Pointer from v, which must be a -// reflect.Ptr, reflect.Slice, or reflect.Map. -func PointerOf(v reflect.Value) Pointer { - // NOTE: Storing a pointer as an uintptr is technically incorrect as it - // assumes that the GC implementation does not use a moving collector. - return Pointer{v.Pointer(), v.Type()} -} - -// IsNil reports whether the pointer is nil. -func (p Pointer) IsNil() bool { - return p.p == 0 -} - -// Uintptr returns the pointer as a uintptr. -func (p Pointer) Uintptr() uintptr { - return p.p -} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go b/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go deleted file mode 100644 index 16e6860af..000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2018, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !purego -// +build !purego - -package value - -import ( - "reflect" - "unsafe" -) - -// Pointer is an opaque typed pointer and is guaranteed to be comparable. -type Pointer struct { - p unsafe.Pointer - t reflect.Type -} - -// PointerOf returns a Pointer from v, which must be a -// reflect.Ptr, reflect.Slice, or reflect.Map. -func PointerOf(v reflect.Value) Pointer { - // The proper representation of a pointer is unsafe.Pointer, - // which is necessary if the GC ever uses a moving collector. - return Pointer{unsafe.Pointer(v.Pointer()), v.Type()} -} - -// IsNil reports whether the pointer is nil. -func (p Pointer) IsNil() bool { - return p.p == nil -} - -// Uintptr returns the pointer as a uintptr. -func (p Pointer) Uintptr() uintptr { - return uintptr(p.p) -} diff --git a/vendor/github.com/google/go-cmp/cmp/options.go b/vendor/github.com/google/go-cmp/cmp/options.go index 1f9ca9c48..754496f3b 100644 --- a/vendor/github.com/google/go-cmp/cmp/options.go +++ b/vendor/github.com/google/go-cmp/cmp/options.go @@ -13,15 +13,15 @@ import ( "github.com/google/go-cmp/cmp/internal/function" ) -// Option configures for specific behavior of Equal and Diff. In particular, -// the fundamental Option functions (Ignore, Transformer, and Comparer), +// Option configures for specific behavior of [Equal] and [Diff]. In particular, +// the fundamental Option functions ([Ignore], [Transformer], and [Comparer]), // configure how equality is determined. // -// The fundamental options may be composed with filters (FilterPath and -// FilterValues) to control the scope over which they are applied. +// The fundamental options may be composed with filters ([FilterPath] and +// [FilterValues]) to control the scope over which they are applied. // -// The cmp/cmpopts package provides helper functions for creating options that -// may be used with Equal and Diff. +// The [github.com/google/go-cmp/cmp/cmpopts] package provides helper functions +// for creating options that may be used with [Equal] and [Diff]. type Option interface { // filter applies all filters and returns the option that remains. // Each option may only read s.curPath and call s.callTTBFunc. @@ -56,9 +56,9 @@ type core struct{} func (core) isCore() {} -// Options is a list of Option values that also satisfies the Option interface. +// Options is a list of [Option] values that also satisfies the [Option] interface. // Helper comparison packages may return an Options value when packing multiple -// Option values into a single Option. When this package processes an Options, +// [Option] values into a single [Option]. When this package processes an Options, // it will be implicitly expanded into a flat list. // // Applying a filter on an Options is equivalent to applying that same filter @@ -105,16 +105,16 @@ func (opts Options) String() string { return fmt.Sprintf("Options{%s}", strings.Join(ss, ", ")) } -// FilterPath returns a new Option where opt is only evaluated if filter f -// returns true for the current Path in the value tree. +// FilterPath returns a new [Option] where opt is only evaluated if filter f +// returns true for the current [Path] in the value tree. // // This filter is called even if a slice element or map entry is missing and // provides an opportunity to ignore such cases. The filter function must be // symmetric such that the filter result is identical regardless of whether the // missing value is from x or y. // -// The option passed in may be an Ignore, Transformer, Comparer, Options, or -// a previously filtered Option. +// The option passed in may be an [Ignore], [Transformer], [Comparer], [Options], or +// a previously filtered [Option]. func FilterPath(f func(Path) bool, opt Option) Option { if f == nil { panic("invalid path filter function") @@ -142,7 +142,7 @@ func (f pathFilter) String() string { return fmt.Sprintf("FilterPath(%s, %v)", function.NameOf(reflect.ValueOf(f.fnc)), f.opt) } -// FilterValues returns a new Option where opt is only evaluated if filter f, +// FilterValues returns a new [Option] where opt is only evaluated if filter f, // which is a function of the form "func(T, T) bool", returns true for the // current pair of values being compared. If either value is invalid or // the type of the values is not assignable to T, then this filter implicitly @@ -154,8 +154,8 @@ func (f pathFilter) String() string { // If T is an interface, it is possible that f is called with two values with // different concrete types that both implement T. // -// The option passed in may be an Ignore, Transformer, Comparer, Options, or -// a previously filtered Option. +// The option passed in may be an [Ignore], [Transformer], [Comparer], [Options], or +// a previously filtered [Option]. func FilterValues(f interface{}, opt Option) Option { v := reflect.ValueOf(f) if !function.IsType(v.Type(), function.ValueFilter) || v.IsNil() { @@ -192,9 +192,9 @@ func (f valuesFilter) String() string { return fmt.Sprintf("FilterValues(%s, %v)", function.NameOf(f.fnc), f.opt) } -// Ignore is an Option that causes all comparisons to be ignored. -// This value is intended to be combined with FilterPath or FilterValues. -// It is an error to pass an unfiltered Ignore option to Equal. +// Ignore is an [Option] that causes all comparisons to be ignored. +// This value is intended to be combined with [FilterPath] or [FilterValues]. +// It is an error to pass an unfiltered Ignore option to [Equal]. func Ignore() Option { return ignore{} } type ignore struct{ core } @@ -234,6 +234,8 @@ func (validator) apply(s *state, vx, vy reflect.Value) { name = fmt.Sprintf("%q.%v", t.PkgPath(), t.Name()) // e.g., "path/to/package".MyType if _, ok := reflect.New(t).Interface().(error); ok { help = "consider using cmpopts.EquateErrors to compare error values" + } else if t.Comparable() { + help = "consider using cmpopts.EquateComparable to compare comparable Go types" } } else { // Unnamed type with unexported fields. Derive PkgPath from field. @@ -254,7 +256,7 @@ const identRx = `[_\p{L}][_\p{L}\p{N}]*` var identsRx = regexp.MustCompile(`^` + identRx + `(\.` + identRx + `)*$`) -// Transformer returns an Option that applies a transformation function that +// Transformer returns an [Option] that applies a transformation function that // converts values of a certain type into that of another. // // The transformer f must be a function "func(T) R" that converts values of @@ -265,13 +267,14 @@ var identsRx = regexp.MustCompile(`^` + identRx + `(\.` + identRx + `)*$`) // same transform to the output of itself (e.g., in the case where the // input and output types are the same), an implicit filter is added such that // a transformer is applicable only if that exact transformer is not already -// in the tail of the Path since the last non-Transform step. +// in the tail of the [Path] since the last non-[Transform] step. // For situations where the implicit filter is still insufficient, -// consider using cmpopts.AcyclicTransformer, which adds a filter -// to prevent the transformer from being recursively applied upon itself. +// consider using [github.com/google/go-cmp/cmp/cmpopts.AcyclicTransformer], +// which adds a filter to prevent the transformer from +// being recursively applied upon itself. // -// The name is a user provided label that is used as the Transform.Name in the -// transformation PathStep (and eventually shown in the Diff output). +// The name is a user provided label that is used as the [Transform.Name] in the +// transformation [PathStep] (and eventually shown in the [Diff] output). // The name must be a valid identifier or qualified identifier in Go syntax. // If empty, an arbitrary name is used. func Transformer(name string, f interface{}) Option { @@ -329,7 +332,7 @@ func (tr transformer) String() string { return fmt.Sprintf("Transformer(%s, %s)", tr.name, function.NameOf(tr.fnc)) } -// Comparer returns an Option that determines whether two values are equal +// Comparer returns an [Option] that determines whether two values are equal // to each other. // // The comparer f must be a function "func(T, T) bool" and is implicitly @@ -377,35 +380,32 @@ func (cm comparer) String() string { return fmt.Sprintf("Comparer(%s)", function.NameOf(cm.fnc)) } -// Exporter returns an Option that specifies whether Equal is allowed to +// Exporter returns an [Option] that specifies whether [Equal] is allowed to // introspect into the unexported fields of certain struct types. // // Users of this option must understand that comparing on unexported fields // from external packages is not safe since changes in the internal -// implementation of some external package may cause the result of Equal +// implementation of some external package may cause the result of [Equal] // to unexpectedly change. However, it may be valid to use this option on types // defined in an internal package where the semantic meaning of an unexported // field is in the control of the user. // -// In many cases, a custom Comparer should be used instead that defines +// In many cases, a custom [Comparer] should be used instead that defines // equality as a function of the public API of a type rather than the underlying // unexported implementation. // -// For example, the reflect.Type documentation defines equality to be determined +// For example, the [reflect.Type] documentation defines equality to be determined // by the == operator on the interface (essentially performing a shallow pointer -// comparison) and most attempts to compare *regexp.Regexp types are interested +// comparison) and most attempts to compare *[regexp.Regexp] types are interested // in only checking that the regular expression strings are equal. -// Both of these are accomplished using Comparers: +// Both of these are accomplished using [Comparer] options: // // Comparer(func(x, y reflect.Type) bool { return x == y }) // Comparer(func(x, y *regexp.Regexp) bool { return x.String() == y.String() }) // -// In other cases, the cmpopts.IgnoreUnexported option can be used to ignore -// all unexported fields on specified struct types. +// In other cases, the [github.com/google/go-cmp/cmp/cmpopts.IgnoreUnexported] +// option can be used to ignore all unexported fields on specified struct types. func Exporter(f func(reflect.Type) bool) Option { - if !supportExporters { - panic("Exporter is not supported on purego builds") - } return exporter(f) } @@ -415,10 +415,10 @@ func (exporter) filter(_ *state, _ reflect.Type, _, _ reflect.Value) applicableO panic("not implemented") } -// AllowUnexported returns an Options that allows Equal to forcibly introspect +// AllowUnexported returns an [Option] that allows [Equal] to forcibly introspect // unexported fields of the specified struct types. // -// See Exporter for the proper use of this option. +// See [Exporter] for the proper use of this option. func AllowUnexported(types ...interface{}) Option { m := make(map[reflect.Type]bool) for _, typ := range types { @@ -432,7 +432,7 @@ func AllowUnexported(types ...interface{}) Option { } // Result represents the comparison result for a single node and -// is provided by cmp when calling Report (see Reporter). +// is provided by cmp when calling Report (see [Reporter]). type Result struct { _ [0]func() // Make Result incomparable flags resultFlags @@ -445,7 +445,7 @@ func (r Result) Equal() bool { } // ByIgnore reports whether the node is equal because it was ignored. -// This never reports true if Equal reports false. +// This never reports true if [Result.Equal] reports false. func (r Result) ByIgnore() bool { return r.flags&reportByIgnore != 0 } @@ -455,7 +455,7 @@ func (r Result) ByMethod() bool { return r.flags&reportByMethod != 0 } -// ByFunc reports whether a Comparer function determined equality. +// ByFunc reports whether a [Comparer] function determined equality. func (r Result) ByFunc() bool { return r.flags&reportByFunc != 0 } @@ -478,7 +478,7 @@ const ( reportByCycle ) -// Reporter is an Option that can be passed to Equal. When Equal traverses +// Reporter is an [Option] that can be passed to [Equal]. When [Equal] traverses // the value trees, it calls PushStep as it descends into each node in the // tree and PopStep as it ascend out of the node. The leaves of the tree are // either compared (determined to be equal or not equal) or ignored and reported diff --git a/vendor/github.com/google/go-cmp/cmp/path.go b/vendor/github.com/google/go-cmp/cmp/path.go index a0a588502..c3c145642 100644 --- a/vendor/github.com/google/go-cmp/cmp/path.go +++ b/vendor/github.com/google/go-cmp/cmp/path.go @@ -14,9 +14,9 @@ import ( "github.com/google/go-cmp/cmp/internal/value" ) -// Path is a list of PathSteps describing the sequence of operations to get +// Path is a list of [PathStep] describing the sequence of operations to get // from some root type to the current position in the value tree. -// The first Path element is always an operation-less PathStep that exists +// The first Path element is always an operation-less [PathStep] that exists // simply to identify the initial type. // // When traversing structs with embedded structs, the embedded struct will @@ -29,8 +29,13 @@ type Path []PathStep // a value's tree structure. Users of this package never need to implement // these types as values of this type will be returned by this package. // -// Implementations of this interface are -// StructField, SliceIndex, MapIndex, Indirect, TypeAssertion, and Transform. +// Implementations of this interface: +// - [StructField] +// - [SliceIndex] +// - [MapIndex] +// - [Indirect] +// - [TypeAssertion] +// - [Transform] type PathStep interface { String() string @@ -70,8 +75,9 @@ func (pa *Path) pop() { *pa = (*pa)[:len(*pa)-1] } -// Last returns the last PathStep in the Path. -// If the path is empty, this returns a non-nil PathStep that reports a nil Type. +// Last returns the last [PathStep] in the Path. +// If the path is empty, this returns a non-nil [PathStep] +// that reports a nil [PathStep.Type]. func (pa Path) Last() PathStep { return pa.Index(-1) } @@ -79,7 +85,8 @@ func (pa Path) Last() PathStep { // Index returns the ith step in the Path and supports negative indexing. // A negative index starts counting from the tail of the Path such that -1 // refers to the last step, -2 refers to the second-to-last step, and so on. -// If index is invalid, this returns a non-nil PathStep that reports a nil Type. +// If index is invalid, this returns a non-nil [PathStep] +// that reports a nil [PathStep.Type]. func (pa Path) Index(i int) PathStep { if i < 0 { i = len(pa) + i @@ -168,7 +175,8 @@ func (ps pathStep) String() string { return fmt.Sprintf("{%s}", s) } -// StructField represents a struct field access on a field called Name. +// StructField is a [PathStep] that represents a struct field access +// on a field called [StructField.Name]. type StructField struct{ *structField } type structField struct { pathStep @@ -204,10 +212,11 @@ func (sf StructField) String() string { return fmt.Sprintf(".%s", sf.name) } func (sf StructField) Name() string { return sf.name } // Index is the index of the field in the parent struct type. -// See reflect.Type.Field. +// See [reflect.Type.Field]. func (sf StructField) Index() int { return sf.idx } -// SliceIndex is an index operation on a slice or array at some index Key. +// SliceIndex is a [PathStep] that represents an index operation on +// a slice or array at some index [SliceIndex.Key]. type SliceIndex struct{ *sliceIndex } type sliceIndex struct { pathStep @@ -247,12 +256,12 @@ func (si SliceIndex) Key() int { // all of the indexes to be shifted. If an index is -1, then that // indicates that the element does not exist in the associated slice. // -// Key is guaranteed to return -1 if and only if the indexes returned -// by SplitKeys are not the same. SplitKeys will never return -1 for +// [SliceIndex.Key] is guaranteed to return -1 if and only if the indexes +// returned by SplitKeys are not the same. SplitKeys will never return -1 for // both indexes. func (si SliceIndex) SplitKeys() (ix, iy int) { return si.xkey, si.ykey } -// MapIndex is an index operation on a map at some index Key. +// MapIndex is a [PathStep] that represents an index operation on a map at some index Key. type MapIndex struct{ *mapIndex } type mapIndex struct { pathStep @@ -266,7 +275,7 @@ func (mi MapIndex) String() string { return fmt.Sprintf("[%#v]", // Key is the value of the map key. func (mi MapIndex) Key() reflect.Value { return mi.key } -// Indirect represents pointer indirection on the parent type. +// Indirect is a [PathStep] that represents pointer indirection on the parent type. type Indirect struct{ *indirect } type indirect struct { pathStep @@ -276,7 +285,7 @@ func (in Indirect) Type() reflect.Type { return in.typ } func (in Indirect) Values() (vx, vy reflect.Value) { return in.vx, in.vy } func (in Indirect) String() string { return "*" } -// TypeAssertion represents a type assertion on an interface. +// TypeAssertion is a [PathStep] that represents a type assertion on an interface. type TypeAssertion struct{ *typeAssertion } type typeAssertion struct { pathStep @@ -286,7 +295,8 @@ func (ta TypeAssertion) Type() reflect.Type { return ta.typ } func (ta TypeAssertion) Values() (vx, vy reflect.Value) { return ta.vx, ta.vy } func (ta TypeAssertion) String() string { return fmt.Sprintf(".(%v)", value.TypeString(ta.typ, false)) } -// Transform is a transformation from the parent type to the current type. +// Transform is a [PathStep] that represents a transformation +// from the parent type to the current type. type Transform struct{ *transform } type transform struct { pathStep @@ -297,13 +307,13 @@ func (tf Transform) Type() reflect.Type { return tf.typ } func (tf Transform) Values() (vx, vy reflect.Value) { return tf.vx, tf.vy } func (tf Transform) String() string { return fmt.Sprintf("%s()", tf.trans.name) } -// Name is the name of the Transformer. +// Name is the name of the [Transformer]. func (tf Transform) Name() string { return tf.trans.name } // Func is the function pointer to the transformer function. func (tf Transform) Func() reflect.Value { return tf.trans.fnc } -// Option returns the originally constructed Transformer option. +// Option returns the originally constructed [Transformer] option. // The == operator can be used to detect the exact option used. func (tf Transform) Option() Option { return tf.trans } diff --git a/vendor/github.com/google/go-cmp/cmp/report_reflect.go b/vendor/github.com/google/go-cmp/cmp/report_reflect.go index 2ab41fad3..e39f42284 100644 --- a/vendor/github.com/google/go-cmp/cmp/report_reflect.go +++ b/vendor/github.com/google/go-cmp/cmp/report_reflect.go @@ -199,7 +199,7 @@ func (opts formatOptions) FormatValue(v reflect.Value, parentKind reflect.Kind, break } sf := t.Field(i) - if supportExporters && !isExported(sf.Name) { + if !isExported(sf.Name) { vv = retrieveUnexportedField(v, sf, true) } s := opts.WithTypeMode(autoType).FormatValue(vv, t.Kind(), ptrs) diff --git a/vendor/github.com/google/s2a-go/README.md b/vendor/github.com/google/s2a-go/README.md index d566950f3..fe0f5c1da 100644 --- a/vendor/github.com/google/s2a-go/README.md +++ b/vendor/github.com/google/s2a-go/README.md @@ -10,8 +10,5 @@ Session Agent during the TLS handshake, and to encrypt traffic to the peer after the TLS handshake is complete. This repository contains the source code for the Secure Session Agent's Go -client libraries, which allow gRPC-Go applications to use the Secure Session -Agent. This repository supports the Bazel and Golang build systems. - -All code in this repository is experimental and subject to change. We do not -guarantee API stability at this time. +client libraries, which allow gRPC and HTTP Go applications to use the Secure Session +Agent. diff --git a/vendor/github.com/google/s2a-go/internal/handshaker/service/service.go b/vendor/github.com/google/s2a-go/internal/handshaker/service/service.go index 49573af88..ed4496537 100644 --- a/vendor/github.com/google/s2a-go/internal/handshaker/service/service.go +++ b/vendor/github.com/google/s2a-go/internal/handshaker/service/service.go @@ -21,50 +21,27 @@ package service import ( "context" - "net" - "os" - "strings" "sync" - "time" - "google.golang.org/appengine" - "google.golang.org/appengine/socket" grpc "google.golang.org/grpc" - "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" ) -// An environment variable, if true, opportunistically use AppEngine-specific dialer to call S2A. -const enableAppEngineDialerEnv = "S2A_ENABLE_APP_ENGINE_DIALER" - var ( - // appEngineDialerHook is an AppEngine-specific dial option that is set - // during init time. If nil, then the application is not running on Google - // AppEngine. - appEngineDialerHook func(context.Context) grpc.DialOption // mu guards hsConnMap and hsDialer. mu sync.Mutex // hsConnMap represents a mapping from an S2A handshaker service address // to a corresponding connection to an S2A handshaker service instance. hsConnMap = make(map[string]*grpc.ClientConn) // hsDialer will be reassigned in tests. - hsDialer = grpc.Dial + hsDialer = grpc.DialContext ) -func init() { - if !appengine.IsAppEngine() && !appengine.IsDevAppServer() { - return - } - appEngineDialerHook = func(ctx context.Context) grpc.DialOption { - return grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) { - return socket.DialTimeout(ctx, "tcp", addr, timeout) - }) - } -} - // Dial dials the S2A handshaker service. If a connection has already been // established, this function returns it. Otherwise, a new connection is // created. -func Dial(handshakerServiceAddress string) (*grpc.ClientConn, error) { +func Dial(ctx context.Context, handshakerServiceAddress string, transportCreds credentials.TransportCredentials) (*grpc.ClientConn, error) { mu.Lock() defer mu.Unlock() @@ -72,17 +49,14 @@ func Dial(handshakerServiceAddress string) (*grpc.ClientConn, error) { if !ok { // Create a new connection to the S2A handshaker service. Note that // this connection stays open until the application is closed. - grpcOpts := []grpc.DialOption{ - grpc.WithInsecure(), - } - if enableAppEngineDialer() && appEngineDialerHook != nil { - if grpclog.V(1) { - grpclog.Info("Using AppEngine-specific dialer to talk to S2A.") - } - grpcOpts = append(grpcOpts, appEngineDialerHook(context.Background())) + var grpcOpts []grpc.DialOption + if transportCreds != nil { + grpcOpts = append(grpcOpts, grpc.WithTransportCredentials(transportCreds)) + } else { + grpcOpts = append(grpcOpts, grpc.WithTransportCredentials(insecure.NewCredentials())) } var err error - hsConn, err = hsDialer(handshakerServiceAddress, grpcOpts...) + hsConn, err = hsDialer(ctx, handshakerServiceAddress, grpcOpts...) if err != nil { return nil, err } @@ -90,10 +64,3 @@ func Dial(handshakerServiceAddress string) (*grpc.ClientConn, error) { } return hsConn, nil } - -func enableAppEngineDialer() bool { - if strings.ToLower(os.Getenv(enableAppEngineDialerEnv)) == "true" { - return true - } - return false -} diff --git a/vendor/github.com/google/s2a-go/internal/record/ticketsender.go b/vendor/github.com/google/s2a-go/internal/record/ticketsender.go index 33fa3c55d..e51199ab3 100644 --- a/vendor/github.com/google/s2a-go/internal/record/ticketsender.go +++ b/vendor/github.com/google/s2a-go/internal/record/ticketsender.go @@ -83,13 +83,15 @@ func (t *ticketSender) sendTicketsToS2A(sessionTickets [][]byte, callComplete ch t.ensureProcessSessionTickets.Done() } }() - hsConn, err := service.Dial(t.hsAddr) + ctx, cancel := context.WithTimeout(context.Background(), sessionTimeout) + defer cancel() + // The transportCreds only needs to be set when talking to S2AV2 and also + // if mTLS is required. + hsConn, err := service.Dial(ctx, t.hsAddr, nil) if err != nil { return err } client := s2apb.NewS2AServiceClient(hsConn) - ctx, cancel := context.WithTimeout(context.Background(), sessionTimeout) - defer cancel() session, err := client.SetUpSession(ctx) if err != nil { return err diff --git a/vendor/github.com/google/s2a-go/internal/v2/s2av2.go b/vendor/github.com/google/s2a-go/internal/v2/s2av2.go index ff172883f..85a8379d8 100644 --- a/vendor/github.com/google/s2a-go/internal/v2/s2av2.go +++ b/vendor/github.com/google/s2a-go/internal/v2/s2av2.go @@ -33,6 +33,7 @@ import ( "github.com/google/s2a-go/internal/handshaker/service" "github.com/google/s2a-go/internal/tokenmanager" "github.com/google/s2a-go/internal/v2/tlsconfigstore" + "github.com/google/s2a-go/retry" "github.com/google/s2a-go/stream" "google.golang.org/grpc" "google.golang.org/grpc/credentials" @@ -44,18 +45,19 @@ import ( const ( s2aSecurityProtocol = "tls" - defaultS2ATimeout = 3 * time.Second + defaultS2ATimeout = 6 * time.Second ) // An environment variable, which sets the timeout enforced on the connection to the S2A service for handshake. const s2aTimeoutEnv = "S2A_TIMEOUT" type s2av2TransportCreds struct { - info *credentials.ProtocolInfo - isClient bool - serverName string - s2av2Address string - tokenManager *tokenmanager.AccessTokenManager + info *credentials.ProtocolInfo + isClient bool + serverName string + s2av2Address string + transportCreds credentials.TransportCredentials + tokenManager *tokenmanager.AccessTokenManager // localIdentity should only be used by the client. localIdentity *commonpbv1.Identity // localIdentities should only be used by the server. @@ -68,7 +70,7 @@ type s2av2TransportCreds struct { // NewClientCreds returns a client-side transport credentials object that uses // the S2Av2 to establish a secure connection with a server. -func NewClientCreds(s2av2Address string, localIdentity *commonpbv1.Identity, verificationMode s2av2pb.ValidatePeerCertificateChainReq_VerificationMode, fallbackClientHandshakeFunc fallback.ClientHandshake, getS2AStream func(ctx context.Context, s2av2Address string) (stream.S2AStream, error), serverAuthorizationPolicy []byte) (credentials.TransportCredentials, error) { +func NewClientCreds(s2av2Address string, transportCreds credentials.TransportCredentials, localIdentity *commonpbv1.Identity, verificationMode s2av2pb.ValidatePeerCertificateChainReq_VerificationMode, fallbackClientHandshakeFunc fallback.ClientHandshake, getS2AStream func(ctx context.Context, s2av2Address string) (stream.S2AStream, error), serverAuthorizationPolicy []byte) (credentials.TransportCredentials, error) { // Create an AccessTokenManager instance to use to authenticate to S2Av2. accessTokenManager, err := tokenmanager.NewSingleTokenAccessTokenManager() @@ -79,6 +81,7 @@ func NewClientCreds(s2av2Address string, localIdentity *commonpbv1.Identity, ver isClient: true, serverName: "", s2av2Address: s2av2Address, + transportCreds: transportCreds, localIdentity: localIdentity, verificationMode: verificationMode, fallbackClientHandshake: fallbackClientHandshakeFunc, @@ -98,7 +101,7 @@ func NewClientCreds(s2av2Address string, localIdentity *commonpbv1.Identity, ver // NewServerCreds returns a server-side transport credentials object that uses // the S2Av2 to establish a secure connection with a client. -func NewServerCreds(s2av2Address string, localIdentities []*commonpbv1.Identity, verificationMode s2av2pb.ValidatePeerCertificateChainReq_VerificationMode, getS2AStream func(ctx context.Context, s2av2Address string) (stream.S2AStream, error)) (credentials.TransportCredentials, error) { +func NewServerCreds(s2av2Address string, transportCreds credentials.TransportCredentials, localIdentities []*commonpbv1.Identity, verificationMode s2av2pb.ValidatePeerCertificateChainReq_VerificationMode, getS2AStream func(ctx context.Context, s2av2Address string) (stream.S2AStream, error)) (credentials.TransportCredentials, error) { // Create an AccessTokenManager instance to use to authenticate to S2Av2. accessTokenManager, err := tokenmanager.NewSingleTokenAccessTokenManager() creds := &s2av2TransportCreds{ @@ -107,6 +110,7 @@ func NewServerCreds(s2av2Address string, localIdentities []*commonpbv1.Identity, }, isClient: false, s2av2Address: s2av2Address, + transportCreds: transportCreds, localIdentities: localIdentities, verificationMode: verificationMode, getS2AStream: getS2AStream, @@ -131,7 +135,13 @@ func (c *s2av2TransportCreds) ClientHandshake(ctx context.Context, serverAuthori serverName := removeServerNamePort(serverAuthority) timeoutCtx, cancel := context.WithTimeout(ctx, GetS2ATimeout()) defer cancel() - s2AStream, err := createStream(timeoutCtx, c.s2av2Address, c.getS2AStream) + var s2AStream stream.S2AStream + var err error + retry.Run(timeoutCtx, + func() error { + s2AStream, err = createStream(timeoutCtx, c.s2av2Address, c.transportCreds, c.getS2AStream) + return err + }) if err != nil { grpclog.Infof("Failed to connect to S2Av2: %v", err) if c.fallbackClientHandshake != nil { @@ -152,31 +162,34 @@ func (c *s2av2TransportCreds) ClientHandshake(ctx context.Context, serverAuthori tokenManager = *c.tokenManager } - if c.serverName == "" { - config, err = tlsconfigstore.GetTLSConfigurationForClient(serverName, s2AStream, tokenManager, c.localIdentity, c.verificationMode, c.serverAuthorizationPolicy) - if err != nil { - grpclog.Info("Failed to get client TLS config from S2Av2: %v", err) - if c.fallbackClientHandshake != nil { - return c.fallbackClientHandshake(ctx, serverAuthority, rawConn, err) - } - return nil, nil, err - } - } else { - config, err = tlsconfigstore.GetTLSConfigurationForClient(c.serverName, s2AStream, tokenManager, c.localIdentity, c.verificationMode, c.serverAuthorizationPolicy) - if err != nil { - grpclog.Info("Failed to get client TLS config from S2Av2: %v", err) - if c.fallbackClientHandshake != nil { - return c.fallbackClientHandshake(ctx, serverAuthority, rawConn, err) - } - return nil, nil, err + sn := serverName + if c.serverName != "" { + sn = c.serverName + } + retry.Run(timeoutCtx, + func() error { + config, err = tlsconfigstore.GetTLSConfigurationForClient(sn, s2AStream, tokenManager, c.localIdentity, c.verificationMode, c.serverAuthorizationPolicy) + return err + }) + if err != nil { + grpclog.Info("Failed to get client TLS config from S2Av2: %v", err) + if c.fallbackClientHandshake != nil { + return c.fallbackClientHandshake(ctx, serverAuthority, rawConn, err) } + return nil, nil, err } if grpclog.V(1) { grpclog.Infof("Got client TLS config from S2Av2.") } - creds := credentials.NewTLS(config) - conn, authInfo, err := creds.ClientHandshake(ctx, serverName, rawConn) + creds := credentials.NewTLS(config) + var conn net.Conn + var authInfo credentials.AuthInfo + retry.Run(timeoutCtx, + func() error { + conn, authInfo, err = creds.ClientHandshake(timeoutCtx, serverName, rawConn) + return err + }) if err != nil { grpclog.Infof("Failed to do client handshake using S2Av2: %v", err) if c.fallbackClientHandshake != nil { @@ -196,7 +209,13 @@ func (c *s2av2TransportCreds) ServerHandshake(rawConn net.Conn) (net.Conn, crede } ctx, cancel := context.WithTimeout(context.Background(), GetS2ATimeout()) defer cancel() - s2AStream, err := createStream(ctx, c.s2av2Address, c.getS2AStream) + var s2AStream stream.S2AStream + var err error + retry.Run(ctx, + func() error { + s2AStream, err = createStream(ctx, c.s2av2Address, c.transportCreds, c.getS2AStream) + return err + }) if err != nil { grpclog.Infof("Failed to connect to S2Av2: %v", err) return nil, nil, err @@ -213,7 +232,12 @@ func (c *s2av2TransportCreds) ServerHandshake(rawConn net.Conn) (net.Conn, crede tokenManager = *c.tokenManager } - config, err := tlsconfigstore.GetTLSConfigurationForServer(s2AStream, tokenManager, c.localIdentities, c.verificationMode) + var config *tls.Config + retry.Run(ctx, + func() error { + config, err = tlsconfigstore.GetTLSConfigurationForServer(s2AStream, tokenManager, c.localIdentities, c.verificationMode) + return err + }) if err != nil { grpclog.Infof("Failed to get server TLS config from S2Av2: %v", err) return nil, nil, err @@ -221,8 +245,20 @@ func (c *s2av2TransportCreds) ServerHandshake(rawConn net.Conn) (net.Conn, crede if grpclog.V(1) { grpclog.Infof("Got server TLS config from S2Av2.") } + creds := credentials.NewTLS(config) - return creds.ServerHandshake(rawConn) + var conn net.Conn + var authInfo credentials.AuthInfo + retry.Run(ctx, + func() error { + conn, authInfo, err = creds.ServerHandshake(rawConn) + return err + }) + if err != nil { + grpclog.Infof("Failed to do server handshake using S2Av2: %v", err) + return nil, nil, err + } + return conn, authInfo, err } // Info returns protocol info of s2av2TransportCreds. @@ -278,11 +314,12 @@ func (c *s2av2TransportCreds) Clone() credentials.TransportCredentials { func NewClientTLSConfig( ctx context.Context, s2av2Address string, + transportCreds credentials.TransportCredentials, tokenManager tokenmanager.AccessTokenManager, verificationMode s2av2pb.ValidatePeerCertificateChainReq_VerificationMode, serverName string, serverAuthorizationPolicy []byte) (*tls.Config, error) { - s2AStream, err := createStream(ctx, s2av2Address, nil) + s2AStream, err := createStream(ctx, s2av2Address, transportCreds, nil) if err != nil { grpclog.Infof("Failed to connect to S2Av2: %v", err) return nil, err @@ -325,12 +362,12 @@ func (x s2AGrpcStream) CloseSend() error { return x.stream.CloseSend() } -func createStream(ctx context.Context, s2av2Address string, getS2AStream func(ctx context.Context, s2av2Address string) (stream.S2AStream, error)) (stream.S2AStream, error) { +func createStream(ctx context.Context, s2av2Address string, transportCreds credentials.TransportCredentials, getS2AStream func(ctx context.Context, s2av2Address string) (stream.S2AStream, error)) (stream.S2AStream, error) { if getS2AStream != nil { return getS2AStream(ctx, s2av2Address) } // TODO(rmehta19): Consider whether to close the connection to S2Av2. - conn, err := service.Dial(s2av2Address) + conn, err := service.Dial(ctx, s2av2Address, transportCreds) if err != nil { return nil, err } diff --git a/vendor/github.com/google/s2a-go/s2a.go b/vendor/github.com/google/s2a-go/s2a.go index 1c1349de4..5ecb06f93 100644 --- a/vendor/github.com/google/s2a-go/s2a.go +++ b/vendor/github.com/google/s2a-go/s2a.go @@ -35,6 +35,7 @@ import ( "github.com/google/s2a-go/internal/handshaker/service" "github.com/google/s2a-go/internal/tokenmanager" "github.com/google/s2a-go/internal/v2" + "github.com/google/s2a-go/retry" "google.golang.org/grpc/credentials" "google.golang.org/grpc/grpclog" @@ -111,7 +112,7 @@ func NewClientCreds(opts *ClientOptions) (credentials.TransportCredentials, erro if opts.FallbackOpts != nil && opts.FallbackOpts.FallbackClientHandshakeFunc != nil { fallbackFunc = opts.FallbackOpts.FallbackClientHandshakeFunc } - return v2.NewClientCreds(opts.S2AAddress, localIdentity, verificationMode, fallbackFunc, opts.getS2AStream, opts.serverAuthorizationPolicy) + return v2.NewClientCreds(opts.S2AAddress, opts.TransportCreds, localIdentity, verificationMode, fallbackFunc, opts.getS2AStream, opts.serverAuthorizationPolicy) } // NewServerCreds returns a server-side transport credentials object that uses @@ -146,7 +147,7 @@ func NewServerCreds(opts *ServerOptions) (credentials.TransportCredentials, erro }, nil } verificationMode := getVerificationMode(opts.VerificationMode) - return v2.NewServerCreds(opts.S2AAddress, localIdentities, verificationMode, opts.getS2AStream) + return v2.NewServerCreds(opts.S2AAddress, opts.TransportCreds, localIdentities, verificationMode, opts.getS2AStream) } // ClientHandshake initiates a client-side TLS handshake using the S2A. @@ -155,17 +156,17 @@ func (c *s2aTransportCreds) ClientHandshake(ctx context.Context, serverAuthority return nil, nil, errors.New("client handshake called using server transport credentials") } + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + // Connect to the S2A. - hsConn, err := service.Dial(c.s2aAddr) + hsConn, err := service.Dial(ctx, c.s2aAddr, nil) if err != nil { grpclog.Infof("Failed to connect to S2A: %v", err) return nil, nil, err } - var cancel context.CancelFunc - ctx, cancel = context.WithCancel(ctx) - defer cancel() - opts := &handshaker.ClientHandshakerOptions{ MinTLSVersion: c.minTLSVersion, MaxTLSVersion: c.maxTLSVersion, @@ -203,16 +204,16 @@ func (c *s2aTransportCreds) ServerHandshake(rawConn net.Conn) (net.Conn, credent return nil, nil, errors.New("server handshake called using client transport credentials") } + ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout) + defer cancel() + // Connect to the S2A. - hsConn, err := service.Dial(c.s2aAddr) + hsConn, err := service.Dial(ctx, c.s2aAddr, nil) if err != nil { grpclog.Infof("Failed to connect to S2A: %v", err) return nil, nil, err } - ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout) - defer cancel() - opts := &handshaker.ServerHandshakerOptions{ MinTLSVersion: c.minTLSVersion, MaxTLSVersion: c.maxTLSVersion, @@ -312,6 +313,7 @@ func NewTLSClientConfigFactory(opts *ClientOptions) (TLSClientConfigFactory, err grpclog.Infof("Access token manager not initialized: %v", err) return &s2aTLSClientConfigFactory{ s2av2Address: opts.S2AAddress, + transportCreds: opts.TransportCreds, tokenManager: nil, verificationMode: getVerificationMode(opts.VerificationMode), serverAuthorizationPolicy: opts.serverAuthorizationPolicy, @@ -319,6 +321,7 @@ func NewTLSClientConfigFactory(opts *ClientOptions) (TLSClientConfigFactory, err } return &s2aTLSClientConfigFactory{ s2av2Address: opts.S2AAddress, + transportCreds: opts.TransportCreds, tokenManager: tokenManager, verificationMode: getVerificationMode(opts.VerificationMode), serverAuthorizationPolicy: opts.serverAuthorizationPolicy, @@ -327,6 +330,7 @@ func NewTLSClientConfigFactory(opts *ClientOptions) (TLSClientConfigFactory, err type s2aTLSClientConfigFactory struct { s2av2Address string + transportCreds credentials.TransportCredentials tokenManager tokenmanager.AccessTokenManager verificationMode s2av2pb.ValidatePeerCertificateChainReq_VerificationMode serverAuthorizationPolicy []byte @@ -338,7 +342,7 @@ func (f *s2aTLSClientConfigFactory) Build( if opts != nil && opts.ServerName != "" { serverName = opts.ServerName } - return v2.NewClientTLSConfig(ctx, f.s2av2Address, f.tokenManager, f.verificationMode, serverName, f.serverAuthorizationPolicy) + return v2.NewClientTLSConfig(ctx, f.s2av2Address, f.transportCreds, f.tokenManager, f.verificationMode, serverName, f.serverAuthorizationPolicy) } func getVerificationMode(verificationMode VerificationModeType) s2av2pb.ValidatePeerCertificateChainReq_VerificationMode { @@ -390,9 +394,15 @@ func NewS2ADialTLSContextFunc(opts *ClientOptions) func(ctx context.Context, net } timeoutCtx, cancel := context.WithTimeout(ctx, v2.GetS2ATimeout()) defer cancel() - s2aTLSConfig, err := factory.Build(timeoutCtx, &TLSClientConfigOptions{ - ServerName: serverName, - }) + + var s2aTLSConfig *tls.Config + retry.Run(timeoutCtx, + func() error { + s2aTLSConfig, err = factory.Build(timeoutCtx, &TLSClientConfigOptions{ + ServerName: serverName, + }) + return err + }) if err != nil { grpclog.Infof("error building S2A TLS config: %v", err) return fallback(err) @@ -401,7 +411,12 @@ func NewS2ADialTLSContextFunc(opts *ClientOptions) func(ctx context.Context, net s2aDialer := &tls.Dialer{ Config: s2aTLSConfig, } - c, err := s2aDialer.DialContext(ctx, network, addr) + var c net.Conn + retry.Run(timeoutCtx, + func() error { + c, err = s2aDialer.DialContext(timeoutCtx, network, addr) + return err + }) if err != nil { grpclog.Infof("error dialing with S2A to %s: %v", addr, err) return fallback(err) diff --git a/vendor/github.com/google/s2a-go/s2a_options.go b/vendor/github.com/google/s2a-go/s2a_options.go index 94feafb9c..fcdbc1621 100644 --- a/vendor/github.com/google/s2a-go/s2a_options.go +++ b/vendor/github.com/google/s2a-go/s2a_options.go @@ -26,6 +26,7 @@ import ( "github.com/google/s2a-go/fallback" "github.com/google/s2a-go/stream" + "google.golang.org/grpc/credentials" s2apb "github.com/google/s2a-go/internal/proto/common_go_proto" ) @@ -92,6 +93,9 @@ type ClientOptions struct { LocalIdentity Identity // S2AAddress is the address of the S2A. S2AAddress string + // Optional transport credentials. + // If set, this will be used for the gRPC connection to the S2A server. + TransportCreds credentials.TransportCredentials // EnsureProcessSessionTickets waits for all session tickets to be sent to // S2A before a process completes. // @@ -173,6 +177,9 @@ type ServerOptions struct { LocalIdentities []Identity // S2AAddress is the address of the S2A. S2AAddress string + // Optional transport credentials. + // If set, this will be used for the gRPC connection to the S2A server. + TransportCreds credentials.TransportCredentials // If true, enables the use of legacy S2Av1. EnableLegacyMode bool // VerificationMode specifies the mode that S2A must use to verify the diff --git a/vendor/github.com/google/uuid/CHANGELOG.md b/vendor/github.com/google/uuid/CHANGELOG.md index 2bd78667a..c9fb829dc 100644 --- a/vendor/github.com/google/uuid/CHANGELOG.md +++ b/vendor/github.com/google/uuid/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## [1.5.0](https://github.com/google/uuid/compare/v1.4.0...v1.5.0) (2023-12-12) + + +### Features + +* Validate UUID without creating new UUID ([#141](https://github.com/google/uuid/issues/141)) ([9ee7366](https://github.com/google/uuid/commit/9ee7366e66c9ad96bab89139418a713dc584ae29)) + +## [1.4.0](https://github.com/google/uuid/compare/v1.3.1...v1.4.0) (2023-10-26) + + +### Features + +* UUIDs slice type with Strings() convenience method ([#133](https://github.com/google/uuid/issues/133)) ([cd5fbbd](https://github.com/google/uuid/commit/cd5fbbdd02f3e3467ac18940e07e062be1f864b4)) + +### Fixes + +* Clarify that Parse's job is to parse but not necessarily validate strings. (Documents current behavior) + ## [1.3.1](https://github.com/google/uuid/compare/v1.3.0...v1.3.1) (2023-08-18) diff --git a/vendor/github.com/google/uuid/CONTRIBUTING.md b/vendor/github.com/google/uuid/CONTRIBUTING.md index 556688872..a502fdc51 100644 --- a/vendor/github.com/google/uuid/CONTRIBUTING.md +++ b/vendor/github.com/google/uuid/CONTRIBUTING.md @@ -11,7 +11,7 @@ please explain why in the pull request description. ### Releasing -Commits that would precipitate a SemVer change, as desrcibed in the Conventional +Commits that would precipitate a SemVer change, as described in the Conventional Commits Specification, will trigger [`release-please`](https://github.com/google-github-actions/release-please-action) to create a release candidate pull request. Once submitted, `release-please` will create a release. diff --git a/vendor/github.com/google/uuid/time.go b/vendor/github.com/google/uuid/time.go index e6ef06cdc..c35112927 100644 --- a/vendor/github.com/google/uuid/time.go +++ b/vendor/github.com/google/uuid/time.go @@ -108,12 +108,23 @@ func setClockSequence(seq int) { } // Time returns the time in 100s of nanoseconds since 15 Oct 1582 encoded in -// uuid. The time is only defined for version 1 and 2 UUIDs. +// uuid. The time is only defined for version 1, 2, 6 and 7 UUIDs. func (uuid UUID) Time() Time { - time := int64(binary.BigEndian.Uint32(uuid[0:4])) - time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32 - time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48 - return Time(time) + var t Time + switch uuid.Version() { + case 6: + time := binary.BigEndian.Uint64(uuid[:8]) // Ignore uuid[6] version b0110 + t = Time(time) + case 7: + time := binary.BigEndian.Uint64(uuid[:8]) + t = Time((time>>16)*10000 + g1582ns100) + default: // forward compatible + time := int64(binary.BigEndian.Uint32(uuid[0:4])) + time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32 + time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48 + t = Time(time) + } + return t } // ClockSequence returns the clock sequence encoded in uuid. diff --git a/vendor/github.com/google/uuid/uuid.go b/vendor/github.com/google/uuid/uuid.go index a56138cc4..5232b4867 100644 --- a/vendor/github.com/google/uuid/uuid.go +++ b/vendor/github.com/google/uuid/uuid.go @@ -56,11 +56,15 @@ func IsInvalidLengthError(err error) bool { return ok } -// Parse decodes s into a UUID or returns an error. Both the standard UUID -// forms of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and -// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded as well as the -// Microsoft encoding {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} and the raw hex -// encoding: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. +// Parse decodes s into a UUID or returns an error if it cannot be parsed. Both +// the standard UUID forms defined in RFC 4122 +// (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and +// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) are decoded. In addition, +// Parse accepts non-standard strings such as the raw hex encoding +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx and 38 byte "Microsoft style" encodings, +// e.g. {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}. Only the middle 36 bytes are +// examined in the latter case. Parse should not be used to validate strings as +// it parses non-standard encodings as indicated above. func Parse(s string) (UUID, error) { var uuid UUID switch len(s) { @@ -182,6 +186,59 @@ func Must(uuid UUID, err error) UUID { return uuid } +// Validate returns an error if s is not a properly formatted UUID in one of the following formats: +// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} +// It returns an error if the format is invalid, otherwise nil. +func Validate(s string) error { + switch len(s) { + // Standard UUID format + case 36: + + // UUID with "urn:uuid:" prefix + case 36 + 9: + if !strings.EqualFold(s[:9], "urn:uuid:") { + return fmt.Errorf("invalid urn prefix: %q", s[:9]) + } + s = s[9:] + + // UUID enclosed in braces + case 36 + 2: + if s[0] != '{' || s[len(s)-1] != '}' { + return fmt.Errorf("invalid bracketed UUID format") + } + s = s[1 : len(s)-1] + + // UUID without hyphens + case 32: + for i := 0; i < len(s); i += 2 { + _, ok := xtob(s[i], s[i+1]) + if !ok { + return errors.New("invalid UUID format") + } + } + + default: + return invalidLengthError{len(s)} + } + + // Check for standard UUID format + if len(s) == 36 { + if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { + return errors.New("invalid UUID format") + } + for _, x := range []int{0, 2, 4, 6, 9, 11, 14, 16, 19, 21, 24, 26, 28, 30, 32, 34} { + if _, ok := xtob(s[x], s[x+1]); !ok { + return errors.New("invalid UUID format") + } + } + } + + return nil +} + // String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx // , or "" if uuid is invalid. func (uuid UUID) String() string { @@ -294,3 +351,15 @@ func DisableRandPool() { poolMu.Lock() poolPos = randPoolSize } + +// UUIDs is a slice of UUID types. +type UUIDs []UUID + +// Strings returns a string slice containing the string form of each UUID in uuids. +func (uuids UUIDs) Strings() []string { + var uuidStrs = make([]string, len(uuids)) + for i, uuid := range uuids { + uuidStrs[i] = uuid.String() + } + return uuidStrs +} diff --git a/vendor/github.com/googleapis/enterprise-certificate-proxy/client/client.go b/vendor/github.com/googleapis/enterprise-certificate-proxy/client/client.go index b3283b815..ea5beb5aa 100644 --- a/vendor/github.com/googleapis/enterprise-certificate-proxy/client/client.go +++ b/vendor/github.com/googleapis/enterprise-certificate-proxy/client/client.go @@ -35,6 +35,8 @@ import ( const signAPI = "EnterpriseCertSigner.Sign" const certificateChainAPI = "EnterpriseCertSigner.CertificateChain" const publicKeyAPI = "EnterpriseCertSigner.Public" +const encryptAPI = "EnterpriseCertSigner.Encrypt" +const decryptAPI = "EnterpriseCertSigner.Decrypt" // A Connection wraps a pair of unidirectional streams as an io.ReadWriteCloser. type Connection struct { @@ -54,13 +56,28 @@ func (c *Connection) Close() error { func init() { gob.Register(crypto.SHA256) + gob.Register(crypto.SHA384) + gob.Register(crypto.SHA512) gob.Register(&rsa.PSSOptions{}) + gob.Register(&rsa.OAEPOptions{}) } -// SignArgs contains arguments to a crypto Signer.Sign method. +// SignArgs contains arguments for a Sign API call. type SignArgs struct { Digest []byte // The content to sign. - Opts crypto.SignerOpts // Options for signing, such as Hash identifier. + Opts crypto.SignerOpts // Options for signing. Must implement HashFunc(). +} + +// EncryptArgs contains arguments for an Encrypt API call. +type EncryptArgs struct { + Plaintext []byte // The plaintext to encrypt. + Opts any // Options for encryption. Ex: an instance of crypto.Hash. +} + +// DecryptArgs contains arguments to for a Decrypt API call. +type DecryptArgs struct { + Ciphertext []byte // The ciphertext to decrypt. + Opts crypto.DecrypterOpts // Options for decryption. Ex: an instance of *rsa.OAEPOptions. } // Key implements credential.Credential by holding the executed signer subprocess. @@ -98,7 +115,7 @@ func (k *Key) Public() crypto.PublicKey { return k.publicKey } -// Sign signs a message digest, using the specified signer options. +// Sign signs a message digest, using the specified signer opts. Implements crypto.Signer interface. func (k *Key) Sign(_ io.Reader, digest []byte, opts crypto.SignerOpts) (signed []byte, err error) { if opts != nil && opts.HashFunc() != 0 && len(digest) != opts.HashFunc().Size() { return nil, fmt.Errorf("Digest length of %v bytes does not match Hash function size of %v bytes", len(digest), opts.HashFunc().Size()) @@ -107,6 +124,18 @@ func (k *Key) Sign(_ io.Reader, digest []byte, opts crypto.SignerOpts) (signed [ return } +// Encrypt encrypts a plaintext msg into ciphertext, using the specified encrypt opts. +func (k *Key) Encrypt(_ io.Reader, msg []byte, opts any) (ciphertext []byte, err error) { + err = k.client.Call(encryptAPI, EncryptArgs{Plaintext: msg, Opts: opts}, &ciphertext) + return +} + +// Decrypt decrypts a ciphertext msg into plaintext, using the specified decrypter opts. Implements crypto.Decrypter interface. +func (k *Key) Decrypt(_ io.Reader, msg []byte, opts crypto.DecrypterOpts) (plaintext []byte, err error) { + err = k.client.Call(decryptAPI, DecryptArgs{Ciphertext: msg, Opts: opts}, &plaintext) + return +} + // ErrCredUnavailable is a sentinel error that indicates ECP Cred is unavailable, // possibly due to missing config or missing binary path. var ErrCredUnavailable = errors.New("Cred is unavailable") @@ -120,7 +149,12 @@ var ErrCredUnavailable = errors.New("Cred is unavailable") // The config file also specifies which certificate the signer should use. func Cred(configFilePath string) (*Key, error) { if configFilePath == "" { - configFilePath = util.GetDefaultConfigFilePath() + envFilePath := util.GetConfigFilePathFromEnv() + if envFilePath != "" { + configFilePath = envFilePath + } else { + configFilePath = util.GetDefaultConfigFilePath() + } } enterpriseCertSignerPath, err := util.LoadSignerBinaryPath(configFilePath) if err != nil { diff --git a/vendor/github.com/googleapis/enterprise-certificate-proxy/client/util/util.go b/vendor/github.com/googleapis/enterprise-certificate-proxy/client/util/util.go index 1640ec1c9..f374a7f55 100644 --- a/vendor/github.com/googleapis/enterprise-certificate-proxy/client/util/util.go +++ b/vendor/github.com/googleapis/enterprise-certificate-proxy/client/util/util.go @@ -22,6 +22,7 @@ import ( "os/user" "path/filepath" "runtime" + "strings" ) const configFileName = "certificate_config.json" @@ -63,6 +64,9 @@ func LoadSignerBinaryPath(configFilePath string) (path string, err error) { if signerBinaryPath == "" { return "", ErrConfigUnavailable } + + signerBinaryPath = strings.ReplaceAll(signerBinaryPath, "~", guessHomeDir()) + signerBinaryPath = strings.ReplaceAll(signerBinaryPath, "$HOME", guessHomeDir()) return signerBinaryPath, nil } @@ -89,3 +93,8 @@ func getDefaultConfigFileDirectory() (directory string) { func GetDefaultConfigFilePath() (path string) { return filepath.Join(getDefaultConfigFileDirectory(), configFileName) } + +// GetConfigFilePathFromEnv returns the path associated with environment variable GOOGLE_API_CERTIFICATE_CONFIG +func GetConfigFilePathFromEnv() (path string) { + return os.Getenv("GOOGLE_API_CERTIFICATE_CONFIG") +} diff --git a/vendor/github.com/onsi/gomega/.gitignore b/vendor/github.com/onsi/gomega/.gitignore index 720c13cba..425d0a509 100644 --- a/vendor/github.com/onsi/gomega/.gitignore +++ b/vendor/github.com/onsi/gomega/.gitignore @@ -3,3 +3,5 @@ . .idea gomega.iml +TODO +.vscode \ No newline at end of file diff --git a/vendor/github.com/onsi/gomega/CHANGELOG.md b/vendor/github.com/onsi/gomega/CHANGELOG.md index 06065866b..fe72a7b18 100644 --- a/vendor/github.com/onsi/gomega/CHANGELOG.md +++ b/vendor/github.com/onsi/gomega/CHANGELOG.md @@ -1,3 +1,276 @@ +## 1.30.0 + +### Features +- BeTrueBecause and BeFalseBecause allow for better failure messages [4da4c7f] + +### Maintenance +- Bump actions/checkout from 3 to 4 (#694) [6ca6e97] +- doc: fix type on gleak go doc [f1b8343] + +## 1.29.0 + +### Features +- MatchError can now take an optional func(error) bool + description [2b39142] + +## 1.28.1 + +### Maintenance +- Bump github.com/onsi/ginkgo/v2 from 2.12.0 to 2.13.0 [635d196] +- Bump github.com/google/go-cmp from 0.5.9 to 0.6.0 [14f8859] +- Bump golang.org/x/net from 0.14.0 to 0.17.0 [d8a6508] +- #703 doc(matchers): HaveEach() doc comment updated [2705bdb] +- Minor typos (#699) [375648c] + +## 1.28.0 + +### Features +- Add VerifyHost handler to ghttp (#698) [0b03b36] + +### Fixes +- Read Body for Newer Responses in HaveHTTPBodyMatcher (#686) [18d6673] + +### Maintenance +- Bump github.com/onsi/ginkgo/v2 from 2.11.0 to 2.12.0 (#693) [55a33f3] +- Typo in matchers.go (#691) [de68e8f] +- Bump commonmarker from 0.23.9 to 0.23.10 in /docs (#690) [ab17f5e] +- chore: update test matrix for Go 1.21 (#689) [5069017] +- Bump golang.org/x/net from 0.12.0 to 0.14.0 (#688) [babe25f] + +## 1.27.10 + +### Fixes +- fix: go 1.21 adding goroutine ID to creator+location (#685) [bdc7803] + +## 1.27.9 + +### Fixes +- Prevent nil-dereference in format.Object for boxed nil error (#681) [3b31fc3] + +### Maintenance +- Bump golang.org/x/net from 0.11.0 to 0.12.0 (#679) [360849b] +- chore: use String() instead of fmt.Sprintf (#678) [86f3659] +- Bump golang.org/x/net from 0.10.0 to 0.11.0 (#674) [642ead0] +- chore: unnecessary use of fmt.Sprintf (#677) [ceb9ca6] +- Bump github.com/onsi/ginkgo/v2 from 2.10.0 to 2.11.0 (#675) [a2087d8] +- docs: fix ContainSubstring references (#673) [fc9a89f] +- Bump github.com/onsi/ginkgo/v2 from 2.9.7 to 2.10.0 (#671) [9076019] + +## 1.27.8 + +### Fixes +- HaveExactElement should not call FailureMessage if a submatcher returned an error [096f392] + +### Maintenance +- Bump github.com/onsi/ginkgo/v2 from 2.9.5 to 2.9.7 (#669) [8884bee] + +## 1.27.7 + +### Fixes +- fix: gcustom.MakeMatcher accepts nil as actual value (#666) [57054d5] + +### Maintenance +- update gitignore [05c1bc6] +- Bump github.com/onsi/ginkgo/v2 from 2.9.4 to 2.9.5 (#663) [7cadcf6] +- Bump golang.org/x/net from 0.9.0 to 0.10.0 (#662) [b524839] +- Bump github.com/onsi/ginkgo/v2 from 2.9.2 to 2.9.4 (#661) [5f44694] +- Bump commonmarker from 0.23.8 to 0.23.9 in /docs (#657) [05dc99a] +- Bump nokogiri from 1.14.1 to 1.14.3 in /docs (#658) [3a033d1] +- Replace deprecated NewGomegaWithT with NewWithT (#659) [a19238f] +- Bump golang.org/x/net from 0.8.0 to 0.9.0 (#656) [29ed041] +- Bump actions/setup-go from 3 to 4 (#651) [11b2080] + +## 1.27.6 + +### Fixes +- Allow collections matchers to work correctly when expected has nil elements [60e7cf3] + +### Maintenance +- updates MatchError godoc comment to also accept a Gomega matcher (#654) [67b869d] + +## 1.27.5 + +### Maintenance +- Bump github.com/onsi/ginkgo/v2 from 2.9.1 to 2.9.2 (#653) [a215021] +- Bump github.com/go-task/slim-sprig (#652) [a26fed8] + +## 1.27.4 + +### Fixes +- improve error formatting and remove duplication of error message in Eventually/Consistently [854f075] + +### Maintenance +- Bump github.com/onsi/ginkgo/v2 from 2.9.0 to 2.9.1 (#650) [ccebd9b] + +## 1.27.3 + +### Fixes +- format.Object now always includes err.Error() when passed an error [86d97ef] +- Fix HaveExactElements to work inside ContainElement or other collection matchers (#648) [636757e] + +### Maintenance +- Bump github.com/golang/protobuf from 1.5.2 to 1.5.3 (#649) [cc16689] +- Bump github.com/onsi/ginkgo/v2 from 2.8.4 to 2.9.0 (#646) [e783366] + +## 1.27.2 + +### Fixes +- improve poll progress message when polling a consistently that has been passing [28a319b] + +### Maintenance +- bump ginkgo +- remove tools.go hack as Ginkgo 2.8.2 automatically pulls in the cli dependencies [81443b3] + +## 1.27.1 + +### Maintenance + +- Bump golang.org/x/net from 0.6.0 to 0.7.0 (#640) [bc686cd] + +## 1.27.0 + +### Features +- Add HaveExactElements matcher (#634) [9d50783] +- update Gomega docs to discuss GinkgoHelper() [be32774] + +### Maintenance +- Bump github.com/onsi/ginkgo/v2 from 2.8.0 to 2.8.1 (#639) [296a68b] +- Bump golang.org/x/net from 0.5.0 to 0.6.0 (#638) [c2b098b] +- Bump github-pages from 227 to 228 in /docs (#636) [a9069ab] +- test: update matrix for Go 1.20 (#635) [6bd25c8] +- Bump github.com/onsi/ginkgo/v2 from 2.7.0 to 2.8.0 (#631) [5445f8b] +- Bump webrick from 1.7.0 to 1.8.1 in /docs (#630) [03e93bb] +- codeql: add ruby language (#626) [63c7d21] +- dependabot: add bundler package-ecosystem for docs (#625) [d92f963] + +## 1.26.0 + +### Features +- When a polled function returns an error, keep track of the actual and report on the matcher state of the last non-errored actual [21f3090] +- improve eventually failure message output [c530fb3] + +### Fixes +- fix several documentation spelling issues [e2eff1f] + + +## 1.25.0 + +### Features +- add `MustPassRepeatedly(int)` to asyncAssertion (#619) [4509f72] +- compare unwrapped errors using DeepEqual (#617) [aaeaa5d] + +### Maintenance +- Bump golang.org/x/net from 0.4.0 to 0.5.0 (#614) [c7cfea4] +- Bump github.com/onsi/ginkgo/v2 from 2.6.1 to 2.7.0 (#615) [71b8adb] +- Docs: Fix typo "MUltiple" -> "Multiple" (#616) [9351dda] +- clean up go.sum [cd1dc1d] + +## 1.24.2 + +### Fixes +- Correctly handle assertion failure panics for eventually/consistnetly "g Gomega"s in a goroutine [78f1660] +- docs:Fix typo "you an" -> "you can" (#607) [3187c1f] +- fixes issue #600 (#606) [808d192] + +### Maintenance +- Bump golang.org/x/net from 0.2.0 to 0.4.0 (#611) [6ebc0bf] +- Bump nokogiri from 1.13.9 to 1.13.10 in /docs (#612) [258cfc8] +- Bump github.com/onsi/ginkgo/v2 from 2.5.0 to 2.5.1 (#609) [e6c3eb9] + +## 1.24.1 + +### Fixes +- maintain backward compatibility for Eventually and Consisntetly's signatures [4c7df5e] +- fix small typo (#601) [ea0ebe6] + +### Maintenance +- Bump golang.org/x/net from 0.1.0 to 0.2.0 (#603) [1ba8372] +- Bump github.com/onsi/ginkgo/v2 from 2.4.0 to 2.5.0 (#602) [f9426cb] +- fix label-filter in test.yml [d795db6] +- stop running flakey tests and rely on external network dependencies in CI [7133290] + +## 1.24.0 + +### Features + +Introducting [gcustom](https://onsi.github.io/gomega/#gcustom-a-convenient-mechanism-for-buildling-custom-matchers) - a convenient mechanism for building custom matchers. + +This is an RC release for `gcustom`. The external API may be tweaked in response to feedback however it is expected to remain mostly stable. + +### Maintenance + +- Update BeComparableTo documentation [756eaa0] + +## 1.23.0 + +### Features +- Custom formatting on a per-type basis can be provided using `format.RegisterCustomFormatter()` -- see the docs [here](https://onsi.github.io/gomega/#adjusting-output) + +- Substantial improvement have been made to `StopTrying()`: + - Users can now use `StopTrying().Wrap(err)` to wrap errors and `StopTrying().Attach(description, object)` to attach arbitrary objects to the `StopTrying()` error + - `StopTrying()` is now always interpreted as a failure. If you are an early adopter of `StopTrying()` you may need to change your code as the prior version would match against the returned value even if `StopTrying()` was returned. Going forward the `StopTrying()` api should remain stable. + - `StopTrying()` and `StopTrying().Now()` can both be used in matchers - not just polled functions. + +- `TryAgainAfter(duration)` is used like `StopTrying()` but instructs `Eventually` and `Consistently` that the poll should be tried again after the specified duration. This allows you to dynamically adjust the polling duration. + +- `ctx` can now be passed-in as the first argument to `Eventually` and `Consistently`. + +## Maintenance + +- Bump github.com/onsi/ginkgo/v2 from 2.3.0 to 2.3.1 (#597) [afed901] +- Bump nokogiri from 1.13.8 to 1.13.9 in /docs (#599) [7c691b3] +- Bump github.com/google/go-cmp from 0.5.8 to 0.5.9 (#587) [ff22665] + +## 1.22.1 + +## Fixes +- When passed a context and no explicit timeout, Eventually will only timeout when the context is cancelled [e5105cf] +- Allow StopTrying() to be wrapped [bf3cba9] + +## Maintenance +- bump to ginkgo v2.3.0 [c5d5c39] + +## 1.22.0 + +### Features + +Several improvements have been made to `Eventually` and `Consistently` in this and the most recent releases: + +- Eventually and Consistently can take a context.Context [65c01bc] + This enables integration with Ginkgo 2.3.0's interruptible nodes and node timeouts. +- Eventually and Consistently that are passed a SpecContext can provide reports when an interrupt occurs [0d063c9] +- Eventually/Consistently will forward an attached context to functions that ask for one [e2091c5] +- Eventually/Consistently supports passing arguments to functions via WithArguments() [a2dc7c3] +- Eventually and Consistently can now be stopped early with StopTrying(message) and StopTrying(message).Now() [52976bb] + +These improvements are all documented in [Gomega's docs](https://onsi.github.io/gomega/#making-asynchronous-assertions) + +## Fixes + +## Maintenance + +## 1.21.1 + +### Features +- Eventually and Consistently that are passed a SpecContext can provide reports when an interrupt occurs [0d063c9] + +## 1.21.0 + +### Features +- Eventually and Consistently can take a context.Context [65c01bc] + This enables integration with Ginkgo 2.3.0's interruptible nodes and node timeouts. +- Introduces Eventually.Within.ProbeEvery with tests and documentation (#591) [f633800] +- New BeKeyOf matcher with documentation and unit tests (#590) [fb586b3] + +## Fixes +- Cover the entire gmeasure suite with leak detection [8c54344] +- Fix gmeasure leak [119d4ce] +- Ignore new Ginkgo ProgressSignal goroutine in gleak [ba548e2] + +## Maintenance + +- Fixes crashes on newer Ruby 3 installations by upgrading github-pages gem dependency (#596) [12469a0] + + ## 1.20.2 ## Fixes diff --git a/vendor/github.com/onsi/gomega/RELEASING.md b/vendor/github.com/onsi/gomega/RELEASING.md index 2d30d9992..9973fff49 100644 --- a/vendor/github.com/onsi/gomega/RELEASING.md +++ b/vendor/github.com/onsi/gomega/RELEASING.md @@ -1,7 +1,13 @@ A Gomega release is a tagged sha and a GitHub release. To cut a release: 1. Ensure CHANGELOG.md is up to date. - - Use `git log --pretty=format:'- %s [%h]' HEAD...vX.X.X` to list all the commits since the last release + - Use + ```bash + LAST_VERSION=$(git tag --sort=version:refname | tail -n1) + CHANGES=$(git log --pretty=format:'- %s [%h]' HEAD...$LAST_VERSION) + echo -e "## NEXT\n\n$CHANGES\n\n### Features\n\n### Fixes\n\n### Maintenance\n\n$(cat CHANGELOG.md)" > CHANGELOG.md + ``` + to update the changelog - Categorize the changes into - Breaking Changes (requires a major version) - New Features (minor version) diff --git a/vendor/github.com/onsi/gomega/format/format.go b/vendor/github.com/onsi/gomega/format/format.go index 6e78c391d..6c1680638 100644 --- a/vendor/github.com/onsi/gomega/format/format.go +++ b/vendor/github.com/onsi/gomega/format/format.go @@ -52,7 +52,7 @@ var CharactersAroundMismatchToInclude uint = 5 var contextType = reflect.TypeOf((*context.Context)(nil)).Elem() var timeType = reflect.TypeOf(time.Time{}) -//The default indentation string emitted by the format package +// The default indentation string emitted by the format package var Indent = " " var longFormThreshold = 20 @@ -65,6 +65,52 @@ type GomegaStringer interface { GomegaString() string } +/* +CustomFormatters can be registered with Gomega via RegisterCustomFormatter() +Any value to be rendered by Gomega is passed to each registered CustomFormatters. +The CustomFormatter signals that it will handle formatting the value by returning (formatted-string, true) +If the CustomFormatter does not want to handle the object it should return ("", false) + +Strings returned by CustomFormatters are not truncated +*/ +type CustomFormatter func(value interface{}) (string, bool) +type CustomFormatterKey uint + +var customFormatterKey CustomFormatterKey = 1 + +type customFormatterKeyPair struct { + CustomFormatter + CustomFormatterKey +} + +/* +RegisterCustomFormatter registers a CustomFormatter and returns a CustomFormatterKey + +You can call UnregisterCustomFormatter with the returned key to unregister the associated CustomFormatter +*/ +func RegisterCustomFormatter(customFormatter CustomFormatter) CustomFormatterKey { + key := customFormatterKey + customFormatterKey += 1 + customFormatters = append(customFormatters, customFormatterKeyPair{customFormatter, key}) + return key +} + +/* +UnregisterCustomFormatter unregisters a previously registered CustomFormatter. You should pass in the key returned by RegisterCustomFormatter +*/ +func UnregisterCustomFormatter(key CustomFormatterKey) { + formatters := []customFormatterKeyPair{} + for _, f := range customFormatters { + if f.CustomFormatterKey == key { + continue + } + formatters = append(formatters, f) + } + customFormatters = formatters +} + +var customFormatters = []customFormatterKeyPair{} + /* Generates a formatted matcher success/failure message of the form: @@ -212,24 +258,35 @@ Set PrintContextObjects to true to print the content of objects implementing con func Object(object interface{}, indentation uint) string { indent := strings.Repeat(Indent, int(indentation)) value := reflect.ValueOf(object) - return fmt.Sprintf("%s<%s>: %s", indent, formatType(value), formatValue(value, indentation)) + commonRepresentation := "" + if err, ok := object.(error); ok && !isNilValue(value) { // isNilValue check needed here to avoid nil deref due to boxed nil + commonRepresentation += "\n" + IndentString(err.Error(), indentation) + "\n" + indent + } + return fmt.Sprintf("%s<%s>: %s%s", indent, formatType(value), commonRepresentation, formatValue(value, indentation)) } /* IndentString takes a string and indents each line by the specified amount. */ func IndentString(s string, indentation uint) string { + return indentString(s, indentation, true) +} + +func indentString(s string, indentation uint, indentFirstLine bool) string { + result := &strings.Builder{} components := strings.Split(s, "\n") - result := "" indent := strings.Repeat(Indent, int(indentation)) for i, component := range components { - result += indent + component + if i > 0 || indentFirstLine { + result.WriteString(indent) + } + result.WriteString(component) if i < len(components)-1 { - result += "\n" + result.WriteString("\n") } } - return result + return result.String() } func formatType(v reflect.Value) string { @@ -245,7 +302,7 @@ func formatType(v reflect.Value) string { case reflect.Map: return fmt.Sprintf("%s | len:%d", v.Type(), v.Len()) default: - return fmt.Sprintf("%s", v.Type()) + return v.Type().String() } } @@ -261,18 +318,27 @@ func formatValue(value reflect.Value, indentation uint) string { if value.CanInterface() { obj := value.Interface() + // if a CustomFormatter handles this values, we'll go with that + for _, customFormatter := range customFormatters { + formatted, handled := customFormatter.CustomFormatter(obj) + // do not truncate a user-provided CustomFormatter() + if handled { + return indentString(formatted, indentation+1, false) + } + } + // GomegaStringer will take precedence to other representations and disregards UseStringerRepresentation if x, ok := obj.(GomegaStringer); ok { - // do not truncate a user-defined GoMegaString() value - return x.GomegaString() + // do not truncate a user-defined GomegaString() value + return indentString(x.GomegaString(), indentation+1, false) } if UseStringerRepresentation { switch x := obj.(type) { case fmt.GoStringer: - return truncateLongStrings(x.GoString()) + return indentString(truncateLongStrings(x.GoString()), indentation+1, false) case fmt.Stringer: - return truncateLongStrings(x.String()) + return indentString(truncateLongStrings(x.String()), indentation+1, false) } } } diff --git a/vendor/github.com/onsi/gomega/gomega_dsl.go b/vendor/github.com/onsi/gomega/gomega_dsl.go index 60b1687ed..c271a366a 100644 --- a/vendor/github.com/onsi/gomega/gomega_dsl.go +++ b/vendor/github.com/onsi/gomega/gomega_dsl.go @@ -22,7 +22,7 @@ import ( "github.com/onsi/gomega/types" ) -const GOMEGA_VERSION = "1.20.2" +const GOMEGA_VERSION = "1.30.0" const nilGomegaPanic = `You are trying to make an assertion, but haven't registered Gomega's fail handler. If you're using Ginkgo then you probably forgot to put your assertion in an It(). @@ -86,12 +86,12 @@ func internalGomega(g Gomega) *internal.Gomega { // NewWithT takes a *testing.T and returns a `gomega.WithT` allowing you to use `Expect`, `Eventually`, and `Consistently` along with // Gomega's rich ecosystem of matchers in standard `testing` test suits. // -// func TestFarmHasCow(t *testing.T) { -// g := gomega.NewWithT(t) +// func TestFarmHasCow(t *testing.T) { +// g := gomega.NewWithT(t) // -// f := farm.New([]string{"Cow", "Horse"}) -// g.Expect(f.HasCow()).To(BeTrue(), "Farm should have cow") -// } +// f := farm.New([]string{"Cow", "Horse"}) +// g.Expect(f.HasCow()).To(BeTrue(), "Farm should have cow") +// } func NewWithT(t types.GomegaTestingT) *WithT { return internal.NewGomega(internalGomega(Default).DurationBundle).ConfigureWithT(t) } @@ -171,7 +171,8 @@ func ensureDefaultGomegaIsConfigured() { } // Ī© wraps an actual value allowing assertions to be made on it: -// Ī©("foo").Should(Equal("foo")) +// +// Ī©("foo").Should(Equal("foo")) // // If Ī© is passed more than one argument it will pass the *first* argument to the matcher. // All subsequent arguments will be required to be nil/zero. @@ -180,10 +181,13 @@ func ensureDefaultGomegaIsConfigured() { // a value and an error - a common patter in Go. // // For example, given a function with signature: -// func MyAmazingThing() (int, error) +// +// func MyAmazingThing() (int, error) // // Then: -// Ī©(MyAmazingThing()).Should(Equal(3)) +// +// Ī©(MyAmazingThing()).Should(Equal(3)) +// // Will succeed only if `MyAmazingThing()` returns `(3, nil)` // // Ī© and Expect are identical @@ -193,19 +197,23 @@ func Ī©(actual interface{}, extra ...interface{}) Assertion { } // Expect wraps an actual value allowing assertions to be made on it: -// Expect("foo").To(Equal("foo")) +// +// Expect("foo").To(Equal("foo")) // // If Expect is passed more than one argument it will pass the *first* argument to the matcher. // All subsequent arguments will be required to be nil/zero. // // This is convenient if you want to make an assertion on a method/function that returns -// a value and an error - a common patter in Go. +// a value and an error - a common pattern in Go. // // For example, given a function with signature: -// func MyAmazingThing() (int, error) +// +// func MyAmazingThing() (int, error) // // Then: -// Expect(MyAmazingThing()).Should(Equal(3)) +// +// Expect(MyAmazingThing()).Should(Equal(3)) +// // Will succeed only if `MyAmazingThing()` returns `(3, nil)` // // Expect and Ī© are identical @@ -215,7 +223,8 @@ func Expect(actual interface{}, extra ...interface{}) Assertion { } // ExpectWithOffset wraps an actual value allowing assertions to be made on it: -// ExpectWithOffset(1, "foo").To(Equal("foo")) +// +// ExpectWithOffset(1, "foo").To(Equal("foo")) // // Unlike `Expect` and `Ī©`, `ExpectWithOffset` takes an additional integer argument // that is used to modify the call-stack offset when computing line numbers. It is @@ -233,7 +242,7 @@ func ExpectWithOffset(offset int, actual interface{}, extra ...interface{}) Asse Eventually enables making assertions on asynchronous behavior. Eventually checks that an assertion *eventually* passes. Eventually blocks when called and attempts an assertion periodically until it passes or a timeout occurs. Both the timeout and polling interval are configurable as optional arguments. -The first optional argument is the timeout (which defaults to 1s), the second is the polling interval (which defaults to 10ms). Both intervals can be specified as time.Duration, parsable duration strings or floats/integers (in which case they are interpreted as seconds). +The first optional argument is the timeout (which defaults to 1s), the second is the polling interval (which defaults to 10ms). Both intervals can be specified as time.Duration, parsable duration strings or floats/integers (in which case they are interpreted as seconds). In addition an optional context.Context can be passed in - Eventually will keep trying until either the timeout expires or the context is cancelled, whichever comes first. Eventually works with any Gomega compatible matcher and supports making assertions against three categories of actual value: @@ -241,15 +250,15 @@ Eventually works with any Gomega compatible matcher and supports making assertio There are several examples of values that can change over time. These can be passed in to Eventually and will be passed to the matcher repeatedly until a match occurs. For example: - c := make(chan bool) - go DoStuff(c) - Eventually(c, "50ms").Should(BeClosed()) + c := make(chan bool) + go DoStuff(c) + Eventually(c, "50ms").Should(BeClosed()) will poll the channel repeatedly until it is closed. In this example `Eventually` will block until either the specified timeout of 50ms has elapsed or the channel is closed, whichever comes first. Several Gomega libraries allow you to use Eventually in this way. For example, the gomega/gexec package allows you to block until a *gexec.Session exits successfully via: - Eventually(session).Should(gexec.Exit(0)) + Eventually(session).Should(gexec.Exit(0)) And the gomega/gbytes package allows you to monitor a streaming *gbytes.Buffer until a given string is seen: @@ -266,27 +275,51 @@ this will trigger Go's race detector as the goroutine polling via Eventually wil **Category 2: Make Eventually assertions on functions** -Eventually can be passed functions that **take no arguments** and **return at least one value**. When configured this way, Eventually will poll the function repeatedly and pass the first returned value to the matcher. +Eventually can be passed functions that **return at least one value**. When configured this way, Eventually will poll the function repeatedly and pass the first returned value to the matcher. For example: - Eventually(func() int { - return client.FetchCount() - }).Should(BeNumerically(">=", 17)) + Eventually(func() int { + return client.FetchCount() + }).Should(BeNumerically(">=", 17)) - will repeatedly poll client.FetchCount until the BeNumerically matcher is satisfied. (Note that this example could have been written as Eventually(client.FetchCount).Should(BeNumerically(">=", 17))) + will repeatedly poll client.FetchCount until the BeNumerically matcher is satisfied. (Note that this example could have been written as Eventually(client.FetchCount).Should(BeNumerically(">=", 17))) If multiple values are returned by the function, Eventually will pass the first value to the matcher and require that all others are zero-valued. This allows you to pass Eventually a function that returns a value and an error - a common pattern in Go. For example, consider a method that returns a value and an error: - func FetchFromDB() (string, error) + + func FetchFromDB() (string, error) Then - Eventually(FetchFromDB).Should(Equal("got it")) + + Eventually(FetchFromDB).Should(Equal("got it")) will pass only if and when the returned error is nil *and* the returned string satisfies the matcher. -It is important to note that the function passed into Eventually is invoked *synchronously* when polled. Eventually does not (in fact, it cannot) kill the function if it takes longer to return than Eventually's configured timeout. You should design your functions with this in mind. +Eventually can also accept functions that take arguments, however you must provide those arguments using .WithArguments(). For example, consider a function that takes a user-id and makes a network request to fetch a full name: + + func FetchFullName(userId int) (string, error) + +You can poll this function like so: + + Eventually(FetchFullName).WithArguments(1138).Should(Equal("Wookie")) + +It is important to note that the function passed into Eventually is invoked *synchronously* when polled. Eventually does not (in fact, it cannot) kill the function if it takes longer to return than Eventually's configured timeout. A common practice here is to use a context. Here's an example that combines Ginkgo's spec timeout support with Eventually: + + It("fetches the correct count", func(ctx SpecContext) { + Eventually(ctx, func() int { + return client.FetchCount(ctx, "/users") + }).Should(BeNumerically(">=", 17)) + }, SpecTimeout(time.Second)) + +you an also use Eventually().WithContext(ctx) to pass in the context. Passed-in contexts play nicely with passed-in arguments as long as the context appears first. You can rewrite the above example as: + + It("fetches the correct count", func(ctx SpecContext) { + Eventually(client.FetchCount).WithContext(ctx).WithArguments("/users").Should(BeNumerically(">=", 17)) + }, SpecTimeout(time.Second)) + +Either way the context passd to Eventually is also passed to the underlying function. Now, when Ginkgo cancels the context both the FetchCount client and Gomega will be informed and can exit. **Category 3: Making assertions _in_ the function passed into Eventually** @@ -306,22 +339,48 @@ will pass only if all the assertions in the polled function pass and the return Eventually also supports a special case polling function that takes a single Gomega argument and returns no values. Eventually assumes such a function is making assertions and is designed to work with the Succeed matcher to validate that all assertions have passed. For example: - Eventually(func(g Gomega) { - model, err := client.Find(1138) - g.Expect(err).NotTo(HaveOccurred()) - g.Expect(model.Reticulate()).To(Succeed()) - g.Expect(model.IsReticulated()).To(BeTrue()) - g.Expect(model.Save()).To(Succeed()) - }).Should(Succeed()) + Eventually(func(g Gomega) { + model, err := client.Find(1138) + g.Expect(err).NotTo(HaveOccurred()) + g.Expect(model.Reticulate()).To(Succeed()) + g.Expect(model.IsReticulated()).To(BeTrue()) + g.Expect(model.Save()).To(Succeed()) + }).Should(Succeed()) will rerun the function until all assertions pass. -`Eventually` specifying a timeout interval (and an optional polling interval) are -the same as `Eventually(...).WithTimeout` or `Eventually(...).WithTimeout(...).WithPolling`. +You can also pass additional arguments to functions that take a Gomega. The only rule is that the Gomega argument must be first. If you also want to pass the context attached to Eventually you must ensure that is the second argument. For example: + + Eventually(func(g Gomega, ctx context.Context, path string, expected ...string){ + tok, err := client.GetToken(ctx) + g.Expect(err).NotTo(HaveOccurred()) + + elements, err := client.Fetch(ctx, tok, path) + g.Expect(err).NotTo(HaveOccurred()) + g.Expect(elements).To(ConsistOf(expected)) + }).WithContext(ctx).WithArguments("/names", "Joe", "Jane", "Sam").Should(Succeed()) + +You can ensure that you get a number of consecutive successful tries before succeeding using `MustPassRepeatedly(int)`. For Example: + + int count := 0 + Eventually(func() bool { + count++ + return count > 2 + }).MustPassRepeatedly(2).Should(BeTrue()) + // Because we had to wait for 2 calls that returned true + Expect(count).To(Equal(3)) + +Finally, in addition to passing timeouts and a context to Eventually you can be more explicit with Eventually's chaining configuration methods: + + Eventually(..., "1s", "2s", ctx).Should(...) + +is equivalent to + + Eventually(...).WithTimeout(time.Second).WithPolling(2*time.Second).WithContext(ctx).Should(...) */ -func Eventually(actual interface{}, intervals ...interface{}) AsyncAssertion { +func Eventually(actualOrCtx interface{}, args ...interface{}) AsyncAssertion { ensureDefaultGomegaIsConfigured() - return Default.Eventually(actual, intervals...) + return Default.Eventually(actualOrCtx, args...) } // EventuallyWithOffset operates like Eventually but takes an additional @@ -333,9 +392,9 @@ func Eventually(actual interface{}, intervals ...interface{}) AsyncAssertion { // `EventuallyWithOffset` specifying a timeout interval (and an optional polling interval) are // the same as `Eventually(...).WithOffset(...).WithTimeout` or // `Eventually(...).WithOffset(...).WithTimeout(...).WithPolling`. -func EventuallyWithOffset(offset int, actual interface{}, intervals ...interface{}) AsyncAssertion { +func EventuallyWithOffset(offset int, actualOrCtx interface{}, args ...interface{}) AsyncAssertion { ensureDefaultGomegaIsConfigured() - return Default.EventuallyWithOffset(offset, actual, intervals...) + return Default.EventuallyWithOffset(offset, actualOrCtx, args...) } /* @@ -343,19 +402,19 @@ Consistently, like Eventually, enables making assertions on asynchronous behavio Consistently blocks when called for a specified duration. During that duration Consistently repeatedly polls its matcher and ensures that it is satisfied. If the matcher is consistently satisfied, then Consistently will pass. Otherwise Consistently will fail. -Both the total waiting duration and the polling interval are configurable as optional arguments. The first optional argument is the duration that Consistently will run for (defaults to 100ms), and the second argument is the polling interval (defaults to 10ms). As with Eventually, these intervals can be passed in as time.Duration, parsable duration strings or an integer or float number of seconds. +Both the total waiting duration and the polling interval are configurable as optional arguments. The first optional argument is the duration that Consistently will run for (defaults to 100ms), and the second argument is the polling interval (defaults to 10ms). As with Eventually, these intervals can be passed in as time.Duration, parsable duration strings or an integer or float number of seconds. You can also pass in an optional context.Context - Consistently will exit early (with a failure) if the context is cancelled before the waiting duration expires. Consistently accepts the same three categories of actual as Eventually, check the Eventually docs to learn more. Consistently is useful in cases where you want to assert that something *does not happen* for a period of time. For example, you may want to assert that a goroutine does *not* send data down a channel. In this case you could write: - Consistently(channel, "200ms").ShouldNot(Receive()) + Consistently(channel, "200ms").ShouldNot(Receive()) This will block for 200 milliseconds and repeatedly check the channel and ensure nothing has been received. */ -func Consistently(actual interface{}, intervals ...interface{}) AsyncAssertion { +func Consistently(actualOrCtx interface{}, args ...interface{}) AsyncAssertion { ensureDefaultGomegaIsConfigured() - return Default.Consistently(actual, intervals...) + return Default.Consistently(actualOrCtx, args...) } // ConsistentlyWithOffset operates like Consistently but takes an additional @@ -364,11 +423,54 @@ func Consistently(actual interface{}, intervals ...interface{}) AsyncAssertion { // // `ConsistentlyWithOffset` is the same as `Consistently(...).WithOffset` and // optional `WithTimeout` and `WithPolling`. -func ConsistentlyWithOffset(offset int, actual interface{}, intervals ...interface{}) AsyncAssertion { +func ConsistentlyWithOffset(offset int, actualOrCtx interface{}, args ...interface{}) AsyncAssertion { ensureDefaultGomegaIsConfigured() - return Default.ConsistentlyWithOffset(offset, actual, intervals...) + return Default.ConsistentlyWithOffset(offset, actualOrCtx, args...) } +/* +StopTrying can be used to signal to Eventually and Consistentlythat they should abort and stop trying. This always results in a failure of the assertion - and the failure message is the content of the StopTrying signal. + +You can send the StopTrying signal by either returning StopTrying("message") as an error from your passed-in function _or_ by calling StopTrying("message").Now() to trigger a panic and end execution. + +You can also wrap StopTrying around an error with `StopTrying("message").Wrap(err)` and can attach additional objects via `StopTrying("message").Attach("description", object). When rendered, the signal will include the wrapped error and any attached objects rendered using Gomega's default formatting. + +Here are a couple of examples. This is how you might use StopTrying() as an error to signal that Eventually should stop: + + playerIndex, numPlayers := 0, 11 + Eventually(func() (string, error) { + if playerIndex == numPlayers { + return "", StopTrying("no more players left") + } + name := client.FetchPlayer(playerIndex) + playerIndex += 1 + return name, nil + }).Should(Equal("Patrick Mahomes")) + +And here's an example where `StopTrying().Now()` is called to halt execution immediately: + + Eventually(func() []string { + names, err := client.FetchAllPlayers() + if err == client.IRRECOVERABLE_ERROR { + StopTrying("Irrecoverable error occurred").Wrap(err).Now() + } + return names + }).Should(ContainElement("Patrick Mahomes")) +*/ +var StopTrying = internal.StopTrying + +/* +TryAgainAfter() allows you to adjust the polling interval for the _next_ iteration of `Eventually` or `Consistently`. Like `StopTrying` you can either return `TryAgainAfter` as an error or trigger it immedieately with `.Now()` + +When `TryAgainAfter(` is triggered `Eventually` and `Consistently` will wait for that duration. If a timeout occurs before the next poll is triggered both `Eventually` and `Consistently` will always fail with the content of the TryAgainAfter message. As with StopTrying you can `.Wrap()` and error and `.Attach()` additional objects to `TryAgainAfter`. +*/ +var TryAgainAfter = internal.TryAgainAfter + +/* +PollingSignalError is the error returned by StopTrying() and TryAgainAfter() +*/ +type PollingSignalError = internal.PollingSignalError + // SetDefaultEventuallyTimeout sets the default timeout duration for Eventually. Eventually will repeatedly poll your condition until it succeeds, or until this timeout elapses. func SetDefaultEventuallyTimeout(t time.Duration) { Default.SetDefaultEventuallyTimeout(t) @@ -402,8 +504,8 @@ func SetDefaultConsistentlyPollingInterval(t time.Duration) { // // Example: // -// Eventually(myChannel).Should(Receive(), "Something should have come down the pipe.") -// Consistently(myChannel).ShouldNot(Receive(), func() string { return "Nothing should have come down the pipe." }) +// Eventually(myChannel).Should(Receive(), "Something should have come down the pipe.") +// Consistently(myChannel).ShouldNot(Receive(), func() string { return "Nothing should have come down the pipe." }) type AsyncAssertion = types.AsyncAssertion // GomegaAsyncAssertion is deprecated in favor of AsyncAssertion, which does not stutter. @@ -425,7 +527,7 @@ type GomegaAsyncAssertion = types.AsyncAssertion // // Example: // -// Ī©(farm.HasCow()).Should(BeTrue(), "Farm %v should have a cow", farm) +// Ī©(farm.HasCow()).Should(BeTrue(), "Farm %v should have a cow", farm) type Assertion = types.Assertion // GomegaAssertion is deprecated in favor of Assertion, which does not stutter. diff --git a/vendor/github.com/onsi/gomega/internal/assertion.go b/vendor/github.com/onsi/gomega/internal/assertion.go index 7b7bdd149..08356a610 100644 --- a/vendor/github.com/onsi/gomega/internal/assertion.go +++ b/vendor/github.com/onsi/gomega/internal/assertion.go @@ -4,6 +4,7 @@ import ( "fmt" "reflect" + "github.com/onsi/gomega/format" "github.com/onsi/gomega/types" ) @@ -146,7 +147,12 @@ func vetActuals(actuals []interface{}, skipIndex int) (bool, string) { if actual != nil { zeroValue := reflect.Zero(reflect.TypeOf(actual)).Interface() if !reflect.DeepEqual(zeroValue, actual) { - message := fmt.Sprintf("Unexpected non-nil/non-zero argument at index %d:\n\t<%T>: %#v", i, actual, actual) + var message string + if err, ok := actual.(error); ok { + message = fmt.Sprintf("Unexpected error: %s\n%s", err, format.Object(err, 1)) + } else { + message = fmt.Sprintf("Unexpected non-nil/non-zero argument at index %d:\n\t<%T>: %#v", i, actual, actual) + } return false, message } } diff --git a/vendor/github.com/onsi/gomega/internal/async_assertion.go b/vendor/github.com/onsi/gomega/internal/async_assertion.go index 126bbcb3f..1188b0bce 100644 --- a/vendor/github.com/onsi/gomega/internal/async_assertion.go +++ b/vendor/github.com/onsi/gomega/internal/async_assertion.go @@ -1,15 +1,53 @@ package internal import ( + "context" "errors" "fmt" "reflect" "runtime" + "sync" "time" + "github.com/onsi/gomega/format" "github.com/onsi/gomega/types" ) +var errInterface = reflect.TypeOf((*error)(nil)).Elem() +var gomegaType = reflect.TypeOf((*types.Gomega)(nil)).Elem() +var contextType = reflect.TypeOf(new(context.Context)).Elem() + +type formattedGomegaError interface { + FormattedGomegaError() string +} + +type asyncPolledActualError struct { + message string +} + +func (err *asyncPolledActualError) Error() string { + return err.message +} + +func (err *asyncPolledActualError) FormattedGomegaError() string { + return err.message +} + +type contextWithAttachProgressReporter interface { + AttachProgressReporter(func() string) func() +} + +type asyncGomegaHaltExecutionError struct{} + +func (a asyncGomegaHaltExecutionError) GinkgoRecoverShouldIgnoreThisPanic() {} +func (a asyncGomegaHaltExecutionError) Error() string { + return `An assertion has failed in a goroutine. You should call + + defer GinkgoRecover() + +at the top of the goroutine that caused this panic. This will allow Ginkgo and Gomega to correctly capture and manage this panic.` +} + type AsyncAssertionType uint const ( @@ -17,71 +55,45 @@ const ( AsyncAssertionTypeConsistently ) +func (at AsyncAssertionType) String() string { + switch at { + case AsyncAssertionTypeEventually: + return "Eventually" + case AsyncAssertionTypeConsistently: + return "Consistently" + } + return "INVALID ASYNC ASSERTION TYPE" +} + type AsyncAssertion struct { asyncType AsyncAssertionType - actualIsFunc bool - actualValue interface{} - actualFunc func() ([]reflect.Value, error) + actualIsFunc bool + actual interface{} + argsToForward []interface{} - timeoutInterval time.Duration - pollingInterval time.Duration - offset int - g *Gomega + timeoutInterval time.Duration + pollingInterval time.Duration + mustPassRepeatedly int + ctx context.Context + offset int + g *Gomega } -func NewAsyncAssertion(asyncType AsyncAssertionType, actualInput interface{}, g *Gomega, timeoutInterval time.Duration, pollingInterval time.Duration, offset int) *AsyncAssertion { +func NewAsyncAssertion(asyncType AsyncAssertionType, actualInput interface{}, g *Gomega, timeoutInterval time.Duration, pollingInterval time.Duration, mustPassRepeatedly int, ctx context.Context, offset int) *AsyncAssertion { out := &AsyncAssertion{ - asyncType: asyncType, - timeoutInterval: timeoutInterval, - pollingInterval: pollingInterval, - offset: offset, - g: g, + asyncType: asyncType, + timeoutInterval: timeoutInterval, + pollingInterval: pollingInterval, + mustPassRepeatedly: mustPassRepeatedly, + offset: offset, + ctx: ctx, + g: g, } - switch actualType := reflect.TypeOf(actualInput); { - case actualInput == nil || actualType.Kind() != reflect.Func: - out.actualValue = actualInput - case actualType.NumIn() == 0 && actualType.NumOut() > 0: + out.actual = actualInput + if actualInput != nil && reflect.TypeOf(actualInput).Kind() == reflect.Func { out.actualIsFunc = true - out.actualFunc = func() ([]reflect.Value, error) { - return reflect.ValueOf(actualInput).Call([]reflect.Value{}), nil - } - case actualType.NumIn() == 1 && actualType.In(0).Implements(reflect.TypeOf((*types.Gomega)(nil)).Elem()): - out.actualIsFunc = true - out.actualFunc = func() (values []reflect.Value, err error) { - var assertionFailure error - assertionCapturingGomega := NewGomega(g.DurationBundle).ConfigureWithFailHandler(func(message string, callerSkip ...int) { - skip := 0 - if len(callerSkip) > 0 { - skip = callerSkip[0] - } - _, file, line, _ := runtime.Caller(skip + 1) - assertionFailure = fmt.Errorf("Assertion in callback at %s:%d failed:\n%s", file, line, message) - panic("stop execution") - }) - - defer func() { - if actualType.NumOut() == 0 { - if assertionFailure == nil { - values = []reflect.Value{reflect.Zero(reflect.TypeOf((*error)(nil)).Elem())} - } else { - values = []reflect.Value{reflect.ValueOf(assertionFailure)} - } - } else { - err = assertionFailure - } - if e := recover(); e != nil && assertionFailure == nil { - panic(e) - } - }() - - values = reflect.ValueOf(actualInput).Call([]reflect.Value{reflect.ValueOf(assertionCapturingGomega)}) - return - } - default: - msg := fmt.Sprintf("The function passed to Gomega's async assertions should either take no arguments and return values, or take a single Gomega interface that it can use to make assertions within the body of the function. When taking a Gomega interface the function can optionally return values or return nothing. The function you passed takes %d arguments and returns %d values.", actualType.NumIn(), actualType.NumOut()) - g.Fail(msg, offset+4) } return out @@ -102,6 +114,31 @@ func (assertion *AsyncAssertion) WithPolling(interval time.Duration) types.Async return assertion } +func (assertion *AsyncAssertion) Within(timeout time.Duration) types.AsyncAssertion { + assertion.timeoutInterval = timeout + return assertion +} + +func (assertion *AsyncAssertion) ProbeEvery(interval time.Duration) types.AsyncAssertion { + assertion.pollingInterval = interval + return assertion +} + +func (assertion *AsyncAssertion) WithContext(ctx context.Context) types.AsyncAssertion { + assertion.ctx = ctx + return assertion +} + +func (assertion *AsyncAssertion) WithArguments(argsToForward ...interface{}) types.AsyncAssertion { + assertion.argsToForward = argsToForward + return assertion +} + +func (assertion *AsyncAssertion) MustPassRepeatedly(count int) types.AsyncAssertion { + assertion.mustPassRepeatedly = count + return assertion +} + func (assertion *AsyncAssertion) Should(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { assertion.g.THelper() vetOptionalDescription("Asynchronous assertion", optionalDescription...) @@ -126,112 +163,409 @@ func (assertion *AsyncAssertion) buildDescription(optionalDescription ...interfa return fmt.Sprintf(optionalDescription[0].(string), optionalDescription[1:]...) + "\n" } -func (assertion *AsyncAssertion) pollActual() (interface{}, error) { +func (assertion *AsyncAssertion) processReturnValues(values []reflect.Value) (interface{}, error) { + if len(values) == 0 { + return nil, &asyncPolledActualError{ + message: fmt.Sprintf("The function passed to %s did not return any values", assertion.asyncType), + } + } + + actual := values[0].Interface() + if _, ok := AsPollingSignalError(actual); ok { + return actual, actual.(error) + } + + var err error + for i, extraValue := range values[1:] { + extra := extraValue.Interface() + if extra == nil { + continue + } + if _, ok := AsPollingSignalError(extra); ok { + return actual, extra.(error) + } + extraType := reflect.TypeOf(extra) + zero := reflect.Zero(extraType).Interface() + if reflect.DeepEqual(extra, zero) { + continue + } + if i == len(values)-2 && extraType.Implements(errInterface) { + err = extra.(error) + } + if err == nil { + err = &asyncPolledActualError{ + message: fmt.Sprintf("The function passed to %s had an unexpected non-nil/non-zero return value at index %d:\n%s", assertion.asyncType, i+1, format.Object(extra, 1)), + } + } + } + + return actual, err +} + +func (assertion *AsyncAssertion) invalidFunctionError(t reflect.Type) error { + return fmt.Errorf(`The function passed to %s had an invalid signature of %s. Functions passed to %s must either: + + (a) have return values or + (b) take a Gomega interface as their first argument and use that Gomega instance to make assertions. + +You can learn more at https://onsi.github.io/gomega/#eventually +`, assertion.asyncType, t, assertion.asyncType) +} + +func (assertion *AsyncAssertion) noConfiguredContextForFunctionError() error { + return fmt.Errorf(`The function passed to %s requested a context.Context, but no context has been provided. Please pass one in using %s().WithContext(). + +You can learn more at https://onsi.github.io/gomega/#eventually +`, assertion.asyncType, assertion.asyncType) +} + +func (assertion *AsyncAssertion) argumentMismatchError(t reflect.Type, numProvided int) error { + have := "have" + if numProvided == 1 { + have = "has" + } + return fmt.Errorf(`The function passed to %s has signature %s takes %d arguments but %d %s been provided. Please use %s().WithArguments() to pass the corect set of arguments. + +You can learn more at https://onsi.github.io/gomega/#eventually +`, assertion.asyncType, t, t.NumIn(), numProvided, have, assertion.asyncType) +} + +func (assertion *AsyncAssertion) invalidMustPassRepeatedlyError(reason string) error { + return fmt.Errorf(`Invalid use of MustPassRepeatedly with %s %s + +You can learn more at https://onsi.github.io/gomega/#eventually +`, assertion.asyncType, reason) +} + +func (assertion *AsyncAssertion) buildActualPoller() (func() (interface{}, error), error) { if !assertion.actualIsFunc { - return assertion.actualValue, nil + return func() (interface{}, error) { return assertion.actual, nil }, nil } + actualValue := reflect.ValueOf(assertion.actual) + actualType := reflect.TypeOf(assertion.actual) + numIn, numOut, isVariadic := actualType.NumIn(), actualType.NumOut(), actualType.IsVariadic() - values, err := assertion.actualFunc() - if err != nil { - return nil, err + if numIn == 0 && numOut == 0 { + return nil, assertion.invalidFunctionError(actualType) } - extras := []interface{}{nil} - for _, value := range values[1:] { - extras = append(extras, value.Interface()) + takesGomega, takesContext := false, false + if numIn > 0 { + takesGomega, takesContext = actualType.In(0).Implements(gomegaType), actualType.In(0).Implements(contextType) } - success, message := vetActuals(extras, 0) - if !success { - return nil, errors.New(message) + if takesGomega && numIn > 1 && actualType.In(1).Implements(contextType) { + takesContext = true + } + if takesContext && len(assertion.argsToForward) > 0 && reflect.TypeOf(assertion.argsToForward[0]).Implements(contextType) { + takesContext = false + } + if !takesGomega && numOut == 0 { + return nil, assertion.invalidFunctionError(actualType) + } + if takesContext && assertion.ctx == nil { + return nil, assertion.noConfiguredContextForFunctionError() + } + + var assertionFailure error + inValues := []reflect.Value{} + if takesGomega { + inValues = append(inValues, reflect.ValueOf(NewGomega(assertion.g.DurationBundle).ConfigureWithFailHandler(func(message string, callerSkip ...int) { + skip := 0 + if len(callerSkip) > 0 { + skip = callerSkip[0] + } + _, file, line, _ := runtime.Caller(skip + 1) + assertionFailure = &asyncPolledActualError{ + message: fmt.Sprintf("The function passed to %s failed at %s:%d with:\n%s", assertion.asyncType, file, line, message), + } + // we throw an asyncGomegaHaltExecutionError so that defer GinkgoRecover() can catch this error if the user makes an assertion in a goroutine + panic(asyncGomegaHaltExecutionError{}) + }))) + } + if takesContext { + inValues = append(inValues, reflect.ValueOf(assertion.ctx)) + } + for _, arg := range assertion.argsToForward { + inValues = append(inValues, reflect.ValueOf(arg)) + } + + if !isVariadic && numIn != len(inValues) { + return nil, assertion.argumentMismatchError(actualType, len(inValues)) + } else if isVariadic && len(inValues) < numIn-1 { + return nil, assertion.argumentMismatchError(actualType, len(inValues)) } - return values[0].Interface(), nil + if assertion.mustPassRepeatedly != 1 && assertion.asyncType != AsyncAssertionTypeEventually { + return nil, assertion.invalidMustPassRepeatedlyError("it can only be used with Eventually") + } + if assertion.mustPassRepeatedly < 1 { + return nil, assertion.invalidMustPassRepeatedlyError("parameter can't be < 1") + } + + return func() (actual interface{}, err error) { + var values []reflect.Value + assertionFailure = nil + defer func() { + if numOut == 0 && takesGomega { + actual = assertionFailure + } else { + actual, err = assertion.processReturnValues(values) + _, isAsyncError := AsPollingSignalError(err) + if assertionFailure != nil && !isAsyncError { + err = assertionFailure + } + } + if e := recover(); e != nil { + if _, isAsyncError := AsPollingSignalError(e); isAsyncError { + err = e.(error) + } else if assertionFailure == nil { + panic(e) + } + } + }() + values = actualValue.Call(inValues) + return + }, nil +} + +func (assertion *AsyncAssertion) afterTimeout() <-chan time.Time { + if assertion.timeoutInterval >= 0 { + return time.After(assertion.timeoutInterval) + } + + if assertion.asyncType == AsyncAssertionTypeConsistently { + return time.After(assertion.g.DurationBundle.ConsistentlyDuration) + } else { + if assertion.ctx == nil { + return time.After(assertion.g.DurationBundle.EventuallyTimeout) + } else { + return nil + } + } } -func (assertion *AsyncAssertion) matcherMayChange(matcher types.GomegaMatcher, value interface{}) bool { - if assertion.actualIsFunc { - return true +func (assertion *AsyncAssertion) afterPolling() <-chan time.Time { + if assertion.pollingInterval >= 0 { + return time.After(assertion.pollingInterval) } - return types.MatchMayChangeInTheFuture(matcher, value) + if assertion.asyncType == AsyncAssertionTypeConsistently { + return time.After(assertion.g.DurationBundle.ConsistentlyPollingInterval) + } else { + return time.After(assertion.g.DurationBundle.EventuallyPollingInterval) + } +} + +func (assertion *AsyncAssertion) matcherSaysStopTrying(matcher types.GomegaMatcher, value interface{}) bool { + if assertion.actualIsFunc || types.MatchMayChangeInTheFuture(matcher, value) { + return false + } + return true +} + +func (assertion *AsyncAssertion) pollMatcher(matcher types.GomegaMatcher, value interface{}) (matches bool, err error) { + defer func() { + if e := recover(); e != nil { + if _, isAsyncError := AsPollingSignalError(e); isAsyncError { + err = e.(error) + } else { + panic(e) + } + } + }() + + matches, err = matcher.Match(value) + + return } func (assertion *AsyncAssertion) match(matcher types.GomegaMatcher, desiredMatch bool, optionalDescription ...interface{}) bool { timer := time.Now() - timeout := time.After(assertion.timeoutInterval) + timeout := assertion.afterTimeout() + lock := sync.Mutex{} - var matches bool - var err error - mayChange := true - value, err := assertion.pollActual() - if err == nil { - mayChange = assertion.matcherMayChange(matcher, value) - matches, err = matcher.Match(value) - } + var matches, hasLastValidActual bool + var actual, lastValidActual interface{} + var actualErr, matcherErr error + var oracleMatcherSaysStop bool assertion.g.THelper() - fail := func(preamble string) { - errMsg := "" + pollActual, buildActualPollerErr := assertion.buildActualPoller() + if buildActualPollerErr != nil { + assertion.g.Fail(buildActualPollerErr.Error(), 2+assertion.offset) + return false + } + + actual, actualErr = pollActual() + if actualErr == nil { + lastValidActual = actual + hasLastValidActual = true + oracleMatcherSaysStop = assertion.matcherSaysStopTrying(matcher, actual) + matches, matcherErr = assertion.pollMatcher(matcher, actual) + } + + renderError := func(preamble string, err error) string { message := "" - if err != nil { - errMsg = "Error: " + err.Error() + if pollingSignalErr, ok := AsPollingSignalError(err); ok { + message = err.Error() + for _, attachment := range pollingSignalErr.Attachments { + message += fmt.Sprintf("\n%s:\n", attachment.Description) + message += format.Object(attachment.Object, 1) + } } else { - if desiredMatch { - message = matcher.FailureMessage(value) + message = preamble + "\n" + format.Object(err, 1) + } + return message + } + + messageGenerator := func() string { + // can be called out of band by Ginkgo if the user requests a progress report + lock.Lock() + defer lock.Unlock() + message := "" + + if actualErr == nil { + if matcherErr == nil { + if desiredMatch != matches { + if desiredMatch { + message += matcher.FailureMessage(actual) + } else { + message += matcher.NegatedFailureMessage(actual) + } + } else { + if assertion.asyncType == AsyncAssertionTypeConsistently { + message += "There is no failure as the matcher passed to Consistently has not yet failed" + } else { + message += "There is no failure as the matcher passed to Eventually succeeded on its most recent iteration" + } + } } else { - message = matcher.NegatedFailureMessage(value) + var fgErr formattedGomegaError + if errors.As(actualErr, &fgErr) { + message += fgErr.FormattedGomegaError() + "\n" + } else { + message += renderError(fmt.Sprintf("The matcher passed to %s returned the following error:", assertion.asyncType), matcherErr) + } + } + } else { + var fgErr formattedGomegaError + if errors.As(actualErr, &fgErr) { + message += fgErr.FormattedGomegaError() + "\n" + } else { + message += renderError(fmt.Sprintf("The function passed to %s returned the following error:", assertion.asyncType), actualErr) + } + if hasLastValidActual { + message += fmt.Sprintf("\nAt one point, however, the function did return successfully.\nYet, %s failed because", assertion.asyncType) + _, e := matcher.Match(lastValidActual) + if e != nil { + message += renderError(" the matcher returned the following error:", e) + } else { + message += " the matcher was not satisfied:\n" + if desiredMatch { + message += matcher.FailureMessage(lastValidActual) + } else { + message += matcher.NegatedFailureMessage(lastValidActual) + } + } } } - assertion.g.THelper() + description := assertion.buildDescription(optionalDescription...) - assertion.g.Fail(fmt.Sprintf("%s after %.3fs.\n%s%s%s", preamble, time.Since(timer).Seconds(), description, message, errMsg), 3+assertion.offset) + return fmt.Sprintf("%s%s", description, message) } - if assertion.asyncType == AsyncAssertionTypeEventually { - for { - if err == nil && matches == desiredMatch { - return true - } + fail := func(preamble string) { + assertion.g.THelper() + assertion.g.Fail(fmt.Sprintf("%s after %.3fs.\n%s", preamble, time.Since(timer).Seconds(), messageGenerator()), 3+assertion.offset) + } - if !mayChange { - fail("No future change is possible. Bailing out early") - return false - } + var contextDone <-chan struct{} + if assertion.ctx != nil { + contextDone = assertion.ctx.Done() + if v, ok := assertion.ctx.Value("GINKGO_SPEC_CONTEXT").(contextWithAttachProgressReporter); ok { + detach := v.AttachProgressReporter(messageGenerator) + defer detach() + } + } - select { - case <-time.After(assertion.pollingInterval): - value, err = assertion.pollActual() - if err == nil { - mayChange = assertion.matcherMayChange(matcher, value) - matches, err = matcher.Match(value) + // Used to count the number of times in a row a step passed + passedRepeatedlyCount := 0 + for { + var nextPoll <-chan time.Time = nil + var isTryAgainAfterError = false + + for _, err := range []error{actualErr, matcherErr} { + if pollingSignalErr, ok := AsPollingSignalError(err); ok { + if pollingSignalErr.IsStopTrying() { + fail("Told to stop trying") + return false + } + if pollingSignalErr.IsTryAgainAfter() { + nextPoll = time.After(pollingSignalErr.TryAgainDuration()) + isTryAgainAfterError = true } - case <-timeout: - fail("Timed out") - return false } } - } else if assertion.asyncType == AsyncAssertionTypeConsistently { - for { - if !(err == nil && matches == desiredMatch) { + + if actualErr == nil && matcherErr == nil && matches == desiredMatch { + if assertion.asyncType == AsyncAssertionTypeEventually { + passedRepeatedlyCount += 1 + if passedRepeatedlyCount == assertion.mustPassRepeatedly { + return true + } + } + } else if !isTryAgainAfterError { + if assertion.asyncType == AsyncAssertionTypeConsistently { fail("Failed") return false } + // Reset the consecutive pass count + passedRepeatedlyCount = 0 + } - if !mayChange { + if oracleMatcherSaysStop { + if assertion.asyncType == AsyncAssertionTypeEventually { + fail("No future change is possible. Bailing out early") + return false + } else { return true } + } + + if nextPoll == nil { + nextPoll = assertion.afterPolling() + } - select { - case <-time.After(assertion.pollingInterval): - value, err = assertion.pollActual() - if err == nil { - mayChange = assertion.matcherMayChange(matcher, value) - matches, err = matcher.Match(value) + select { + case <-nextPoll: + a, e := pollActual() + lock.Lock() + actual, actualErr = a, e + lock.Unlock() + if actualErr == nil { + lock.Lock() + lastValidActual = actual + hasLastValidActual = true + lock.Unlock() + oracleMatcherSaysStop = assertion.matcherSaysStopTrying(matcher, actual) + m, e := assertion.pollMatcher(matcher, actual) + lock.Lock() + matches, matcherErr = m, e + lock.Unlock() + } + case <-contextDone: + fail("Context was cancelled") + return false + case <-timeout: + if assertion.asyncType == AsyncAssertionTypeEventually { + fail("Timed out") + return false + } else { + if isTryAgainAfterError { + fail("Timed out while waiting on TryAgainAfter") + return false } - case <-timeout: return true } } } - - return false } diff --git a/vendor/github.com/onsi/gomega/internal/duration_bundle.go b/vendor/github.com/onsi/gomega/internal/duration_bundle.go index af8d989fa..6e0d90d3a 100644 --- a/vendor/github.com/onsi/gomega/internal/duration_bundle.go +++ b/vendor/github.com/onsi/gomega/internal/duration_bundle.go @@ -44,28 +44,28 @@ func durationFromEnv(key string, defaultDuration time.Duration) time.Duration { return duration } -func toDuration(input interface{}) time.Duration { +func toDuration(input interface{}) (time.Duration, error) { duration, ok := input.(time.Duration) if ok { - return duration + return duration, nil } value := reflect.ValueOf(input) kind := reflect.TypeOf(input).Kind() if reflect.Int <= kind && kind <= reflect.Int64 { - return time.Duration(value.Int()) * time.Second + return time.Duration(value.Int()) * time.Second, nil } else if reflect.Uint <= kind && kind <= reflect.Uint64 { - return time.Duration(value.Uint()) * time.Second + return time.Duration(value.Uint()) * time.Second, nil } else if reflect.Float32 <= kind && kind <= reflect.Float64 { - return time.Duration(value.Float() * float64(time.Second)) + return time.Duration(value.Float() * float64(time.Second)), nil } else if reflect.String == kind { duration, err := time.ParseDuration(value.String()) if err != nil { - panic(fmt.Sprintf("%#v is not a valid parsable duration string.", input)) + return 0, fmt.Errorf("%#v is not a valid parsable duration string: %w", input, err) } - return duration + return duration, nil } - panic(fmt.Sprintf("%v is not a valid interval. Must be time.Duration, parsable duration string or a number.", input)) + return 0, fmt.Errorf("%#v is not a valid interval. Must be a time.Duration, a parsable duration string, or a number.", input) } diff --git a/vendor/github.com/onsi/gomega/internal/gomega.go b/vendor/github.com/onsi/gomega/internal/gomega.go index d26a67485..de1f4f336 100644 --- a/vendor/github.com/onsi/gomega/internal/gomega.go +++ b/vendor/github.com/onsi/gomega/internal/gomega.go @@ -1,6 +1,7 @@ package internal import ( + "context" "time" "github.com/onsi/gomega/types" @@ -51,38 +52,64 @@ func (g *Gomega) ExpectWithOffset(offset int, actual interface{}, extra ...inter return NewAssertion(actual, g, offset, extra...) } -func (g *Gomega) Eventually(actual interface{}, intervals ...interface{}) types.AsyncAssertion { - return g.EventuallyWithOffset(0, actual, intervals...) +func (g *Gomega) Eventually(actualOrCtx interface{}, args ...interface{}) types.AsyncAssertion { + return g.makeAsyncAssertion(AsyncAssertionTypeEventually, 0, actualOrCtx, args...) } -func (g *Gomega) EventuallyWithOffset(offset int, actual interface{}, intervals ...interface{}) types.AsyncAssertion { - timeoutInterval := g.DurationBundle.EventuallyTimeout - pollingInterval := g.DurationBundle.EventuallyPollingInterval - if len(intervals) > 0 { - timeoutInterval = toDuration(intervals[0]) - } - if len(intervals) > 1 { - pollingInterval = toDuration(intervals[1]) - } +func (g *Gomega) EventuallyWithOffset(offset int, actualOrCtx interface{}, args ...interface{}) types.AsyncAssertion { + return g.makeAsyncAssertion(AsyncAssertionTypeEventually, offset, actualOrCtx, args...) +} - return NewAsyncAssertion(AsyncAssertionTypeEventually, actual, g, timeoutInterval, pollingInterval, offset) +func (g *Gomega) Consistently(actualOrCtx interface{}, args ...interface{}) types.AsyncAssertion { + return g.makeAsyncAssertion(AsyncAssertionTypeConsistently, 0, actualOrCtx, args...) } -func (g *Gomega) Consistently(actual interface{}, intervals ...interface{}) types.AsyncAssertion { - return g.ConsistentlyWithOffset(0, actual, intervals...) +func (g *Gomega) ConsistentlyWithOffset(offset int, actualOrCtx interface{}, args ...interface{}) types.AsyncAssertion { + return g.makeAsyncAssertion(AsyncAssertionTypeConsistently, offset, actualOrCtx, args...) } -func (g *Gomega) ConsistentlyWithOffset(offset int, actual interface{}, intervals ...interface{}) types.AsyncAssertion { - timeoutInterval := g.DurationBundle.ConsistentlyDuration - pollingInterval := g.DurationBundle.ConsistentlyPollingInterval +func (g *Gomega) makeAsyncAssertion(asyncAssertionType AsyncAssertionType, offset int, actualOrCtx interface{}, args ...interface{}) types.AsyncAssertion { + baseOffset := 3 + timeoutInterval := -time.Duration(1) + pollingInterval := -time.Duration(1) + intervals := []interface{}{} + var ctx context.Context + + actual := actualOrCtx + startingIndex := 0 + if _, isCtx := actualOrCtx.(context.Context); isCtx && len(args) > 0 { + // the first argument is a context, we should accept it as the context _only if_ it is **not** the only argumnent **and** the second argument is not a parseable duration + // this is due to an unfortunate ambiguity in early version of Gomega in which multi-type durations are allowed after the actual + if _, err := toDuration(args[0]); err != nil { + ctx = actualOrCtx.(context.Context) + actual = args[0] + startingIndex = 1 + } + } + + for _, arg := range args[startingIndex:] { + switch v := arg.(type) { + case context.Context: + ctx = v + default: + intervals = append(intervals, arg) + } + } + var err error if len(intervals) > 0 { - timeoutInterval = toDuration(intervals[0]) + timeoutInterval, err = toDuration(intervals[0]) + if err != nil { + g.Fail(err.Error(), offset+baseOffset) + } } if len(intervals) > 1 { - pollingInterval = toDuration(intervals[1]) + pollingInterval, err = toDuration(intervals[1]) + if err != nil { + g.Fail(err.Error(), offset+baseOffset) + } } - return NewAsyncAssertion(AsyncAssertionTypeConsistently, actual, g, timeoutInterval, pollingInterval, offset) + return NewAsyncAssertion(asyncAssertionType, actual, g, timeoutInterval, pollingInterval, 1, ctx, offset) } func (g *Gomega) SetDefaultEventuallyTimeout(t time.Duration) { diff --git a/vendor/github.com/onsi/gomega/matchers.go b/vendor/github.com/onsi/gomega/matchers.go index d6a099060..43f994374 100644 --- a/vendor/github.com/onsi/gomega/matchers.go +++ b/vendor/github.com/onsi/gomega/matchers.go @@ -1,6 +1,7 @@ package gomega import ( + "fmt" "time" "github.com/google/go-cmp/cmp" @@ -8,27 +9,28 @@ import ( "github.com/onsi/gomega/types" ) -//Equal uses reflect.DeepEqual to compare actual with expected. Equal is strict about -//types when performing comparisons. -//It is an error for both actual and expected to be nil. Use BeNil() instead. +// Equal uses reflect.DeepEqual to compare actual with expected. Equal is strict about +// types when performing comparisons. +// It is an error for both actual and expected to be nil. Use BeNil() instead. func Equal(expected interface{}) types.GomegaMatcher { return &matchers.EqualMatcher{ Expected: expected, } } -//BeEquivalentTo is more lax than Equal, allowing equality between different types. -//This is done by converting actual to have the type of expected before -//attempting equality with reflect.DeepEqual. -//It is an error for actual and expected to be nil. Use BeNil() instead. +// BeEquivalentTo is more lax than Equal, allowing equality between different types. +// This is done by converting actual to have the type of expected before +// attempting equality with reflect.DeepEqual. +// It is an error for actual and expected to be nil. Use BeNil() instead. func BeEquivalentTo(expected interface{}) types.GomegaMatcher { return &matchers.BeEquivalentToMatcher{ Expected: expected, } } -//BeComparableTo uses gocmp.Equal to compare. You can pass cmp.Option as options. -//It is an error for actual and expected to be nil. Use BeNil() instead. +// BeComparableTo uses gocmp.Equal from github.com/google/go-cmp (instead of reflect.DeepEqual) to perform a deep comparison. +// You can pass cmp.Option as options. +// It is an error for actual and expected to be nil. Use BeNil() instead. func BeComparableTo(expected interface{}, opts ...cmp.Option) types.GomegaMatcher { return &matchers.BeComparableToMatcher{ Expected: expected, @@ -36,116 +38,168 @@ func BeComparableTo(expected interface{}, opts ...cmp.Option) types.GomegaMatche } } -//BeIdenticalTo uses the == operator to compare actual with expected. -//BeIdenticalTo is strict about types when performing comparisons. -//It is an error for both actual and expected to be nil. Use BeNil() instead. +// BeIdenticalTo uses the == operator to compare actual with expected. +// BeIdenticalTo is strict about types when performing comparisons. +// It is an error for both actual and expected to be nil. Use BeNil() instead. func BeIdenticalTo(expected interface{}) types.GomegaMatcher { return &matchers.BeIdenticalToMatcher{ Expected: expected, } } -//BeNil succeeds if actual is nil +// BeNil succeeds if actual is nil func BeNil() types.GomegaMatcher { return &matchers.BeNilMatcher{} } -//BeTrue succeeds if actual is true +// BeTrue succeeds if actual is true +// +// In general, it's better to use `BeTrueBecause(reason)` to provide a more useful error message if a true check fails. func BeTrue() types.GomegaMatcher { return &matchers.BeTrueMatcher{} } -//BeFalse succeeds if actual is false +// BeFalse succeeds if actual is false +// +// In general, it's better to use `BeFalseBecause(reason)` to provide a more useful error message if a false check fails. func BeFalse() types.GomegaMatcher { return &matchers.BeFalseMatcher{} } -//HaveOccurred succeeds if actual is a non-nil error -//The typical Go error checking pattern looks like: -// err := SomethingThatMightFail() -// Expect(err).ShouldNot(HaveOccurred()) +// BeTrueBecause succeeds if actual is true and displays the provided reason if it is false +// fmt.Sprintf is used to render the reason +func BeTrueBecause(format string, args ...any) types.GomegaMatcher { + return &matchers.BeTrueMatcher{Reason: fmt.Sprintf(format, args...)} +} + +// BeFalseBecause succeeds if actual is false and displays the provided reason if it is true. +// fmt.Sprintf is used to render the reason +func BeFalseBecause(format string, args ...any) types.GomegaMatcher { + return &matchers.BeFalseMatcher{Reason: fmt.Sprintf(format, args...)} +} + +// HaveOccurred succeeds if actual is a non-nil error +// The typical Go error checking pattern looks like: +// +// err := SomethingThatMightFail() +// Expect(err).ShouldNot(HaveOccurred()) func HaveOccurred() types.GomegaMatcher { return &matchers.HaveOccurredMatcher{} } -//Succeed passes if actual is a nil error -//Succeed is intended to be used with functions that return a single error value. Instead of -// err := SomethingThatMightFail() -// Expect(err).ShouldNot(HaveOccurred()) +// Succeed passes if actual is a nil error +// Succeed is intended to be used with functions that return a single error value. Instead of +// +// err := SomethingThatMightFail() +// Expect(err).ShouldNot(HaveOccurred()) // -//You can write: -// Expect(SomethingThatMightFail()).Should(Succeed()) +// You can write: // -//It is a mistake to use Succeed with a function that has multiple return values. Gomega's Ī© and Expect -//functions automatically trigger failure if any return values after the first return value are non-zero/non-nil. -//This means that Ī©(MultiReturnFunc()).ShouldNot(Succeed()) can never pass. +// Expect(SomethingThatMightFail()).Should(Succeed()) +// +// It is a mistake to use Succeed with a function that has multiple return values. Gomega's Ī© and Expect +// functions automatically trigger failure if any return values after the first return value are non-zero/non-nil. +// This means that Ī©(MultiReturnFunc()).ShouldNot(Succeed()) can never pass. func Succeed() types.GomegaMatcher { return &matchers.SucceedMatcher{} } -//MatchError succeeds if actual is a non-nil error that matches the passed in string/error. +// MatchError succeeds if actual is a non-nil error that matches the passed in +// string, error, function, or matcher. +// +// These are valid use-cases: +// +// When passed a string: +// +// Expect(err).To(MatchError("an error")) +// +// asserts that err.Error() == "an error" +// +// When passed an error: +// +// Expect(err).To(MatchError(SomeError)) // -//These are valid use-cases: -// Expect(err).Should(MatchError("an error")) //asserts that err.Error() == "an error" -// Expect(err).Should(MatchError(SomeError)) //asserts that err == SomeError (via reflect.DeepEqual) +// First checks if errors.Is(err, SomeError). +// If that fails then it checks if reflect.DeepEqual(err, SomeError) repeatedly for err and any errors wrapped by err // -//It is an error for err to be nil or an object that does not implement the Error interface -func MatchError(expected interface{}) types.GomegaMatcher { +// When passed a matcher: +// +// Expect(err).To(MatchError(ContainSubstring("sprocket not found"))) +// +// the matcher is passed err.Error(). In this case it asserts that err.Error() contains substring "sprocket not found" +// +// When passed a func(err) bool and a description: +// +// Expect(err).To(MatchError(os.IsNotExist, "IsNotExist")) +// +// the function is passed err and matches if the return value is true. The description is required to allow Gomega +// to print a useful error message. +// +// It is an error for err to be nil or an object that does not implement the +// Error interface +// +// The optional second argument is a description of the error function, if used. This is required when passing a function but is ignored in all other cases. +func MatchError(expected interface{}, functionErrorDescription ...any) types.GomegaMatcher { return &matchers.MatchErrorMatcher{ - Expected: expected, + Expected: expected, + FuncErrDescription: functionErrorDescription, } } -//BeClosed succeeds if actual is a closed channel. -//It is an error to pass a non-channel to BeClosed, it is also an error to pass nil +// BeClosed succeeds if actual is a closed channel. +// It is an error to pass a non-channel to BeClosed, it is also an error to pass nil // -//In order to check whether or not the channel is closed, Gomega must try to read from the channel -//(even in the `ShouldNot(BeClosed())` case). You should keep this in mind if you wish to make subsequent assertions about -//values coming down the channel. +// In order to check whether or not the channel is closed, Gomega must try to read from the channel +// (even in the `ShouldNot(BeClosed())` case). You should keep this in mind if you wish to make subsequent assertions about +// values coming down the channel. // -//Also, if you are testing that a *buffered* channel is closed you must first read all values out of the channel before -//asserting that it is closed (it is not possible to detect that a buffered-channel has been closed until all its buffered values are read). +// Also, if you are testing that a *buffered* channel is closed you must first read all values out of the channel before +// asserting that it is closed (it is not possible to detect that a buffered-channel has been closed until all its buffered values are read). // -//Finally, as a corollary: it is an error to check whether or not a send-only channel is closed. +// Finally, as a corollary: it is an error to check whether or not a send-only channel is closed. func BeClosed() types.GomegaMatcher { return &matchers.BeClosedMatcher{} } -//Receive succeeds if there is a value to be received on actual. -//Actual must be a channel (and cannot be a send-only channel) -- anything else is an error. +// Receive succeeds if there is a value to be received on actual. +// Actual must be a channel (and cannot be a send-only channel) -- anything else is an error. +// +// Receive returns immediately and never blocks: +// +// - If there is nothing on the channel `c` then Expect(c).Should(Receive()) will fail and Ī©(c).ShouldNot(Receive()) will pass. +// +// - If the channel `c` is closed then Expect(c).Should(Receive()) will fail and Ī©(c).ShouldNot(Receive()) will pass. // -//Receive returns immediately and never blocks: +// - If there is something on the channel `c` ready to be read, then Expect(c).Should(Receive()) will pass and Ī©(c).ShouldNot(Receive()) will fail. // -//- If there is nothing on the channel `c` then Expect(c).Should(Receive()) will fail and Ī©(c).ShouldNot(Receive()) will pass. +// If you have a go-routine running in the background that will write to channel `c` you can: // -//- If the channel `c` is closed then Expect(c).Should(Receive()) will fail and Ī©(c).ShouldNot(Receive()) will pass. +// Eventually(c).Should(Receive()) // -//- If there is something on the channel `c` ready to be read, then Expect(c).Should(Receive()) will pass and Ī©(c).ShouldNot(Receive()) will fail. +// This will timeout if nothing gets sent to `c` (you can modify the timeout interval as you normally do with `Eventually`) // -//If you have a go-routine running in the background that will write to channel `c` you can: -// Eventually(c).Should(Receive()) +// A similar use-case is to assert that no go-routine writes to a channel (for a period of time). You can do this with `Consistently`: // -//This will timeout if nothing gets sent to `c` (you can modify the timeout interval as you normally do with `Eventually`) +// Consistently(c).ShouldNot(Receive()) // -//A similar use-case is to assert that no go-routine writes to a channel (for a period of time). You can do this with `Consistently`: -// Consistently(c).ShouldNot(Receive()) +// You can pass `Receive` a matcher. If you do so, it will match the received object against the matcher. For example: // -//You can pass `Receive` a matcher. If you do so, it will match the received object against the matcher. For example: -// Expect(c).Should(Receive(Equal("foo"))) +// Expect(c).Should(Receive(Equal("foo"))) // -//When given a matcher, `Receive` will always fail if there is nothing to be received on the channel. +// When given a matcher, `Receive` will always fail if there is nothing to be received on the channel. // -//Passing Receive a matcher is especially useful when paired with Eventually: +// Passing Receive a matcher is especially useful when paired with Eventually: // -// Eventually(c).Should(Receive(ContainSubstring("bar"))) +// Eventually(c).Should(Receive(ContainSubstring("bar"))) // -//will repeatedly attempt to pull values out of `c` until a value matching "bar" is received. +// will repeatedly attempt to pull values out of `c` until a value matching "bar" is received. // -//Finally, if you want to have a reference to the value *sent* to the channel you can pass the `Receive` matcher a pointer to a variable of the appropriate type: -// var myThing thing -// Eventually(thingChan).Should(Receive(&myThing)) -// Expect(myThing.Sprocket).Should(Equal("foo")) -// Expect(myThing.IsValid()).Should(BeTrue()) +// Finally, if you want to have a reference to the value *sent* to the channel you can pass the `Receive` matcher a pointer to a variable of the appropriate type: +// +// var myThing thing +// Eventually(thingChan).Should(Receive(&myThing)) +// Expect(myThing.Sprocket).Should(Equal("foo")) +// Expect(myThing.IsValid()).Should(BeTrue()) func Receive(args ...interface{}) types.GomegaMatcher { var arg interface{} if len(args) > 0 { @@ -157,27 +211,27 @@ func Receive(args ...interface{}) types.GomegaMatcher { } } -//BeSent succeeds if a value can be sent to actual. -//Actual must be a channel (and cannot be a receive-only channel) that can sent the type of the value passed into BeSent -- anything else is an error. -//In addition, actual must not be closed. +// BeSent succeeds if a value can be sent to actual. +// Actual must be a channel (and cannot be a receive-only channel) that can sent the type of the value passed into BeSent -- anything else is an error. +// In addition, actual must not be closed. // -//BeSent never blocks: +// BeSent never blocks: // -//- If the channel `c` is not ready to receive then Expect(c).Should(BeSent("foo")) will fail immediately -//- If the channel `c` is eventually ready to receive then Eventually(c).Should(BeSent("foo")) will succeed.. presuming the channel becomes ready to receive before Eventually's timeout -//- If the channel `c` is closed then Expect(c).Should(BeSent("foo")) and Ī©(c).ShouldNot(BeSent("foo")) will both fail immediately +// - If the channel `c` is not ready to receive then Expect(c).Should(BeSent("foo")) will fail immediately +// - If the channel `c` is eventually ready to receive then Eventually(c).Should(BeSent("foo")) will succeed.. presuming the channel becomes ready to receive before Eventually's timeout +// - If the channel `c` is closed then Expect(c).Should(BeSent("foo")) and Ī©(c).ShouldNot(BeSent("foo")) will both fail immediately // -//Of course, the value is actually sent to the channel. The point of `BeSent` is less to make an assertion about the availability of the channel (which is typically an implementation detail that your test should not be concerned with). -//Rather, the point of `BeSent` is to make it possible to easily and expressively write tests that can timeout on blocked channel sends. +// Of course, the value is actually sent to the channel. The point of `BeSent` is less to make an assertion about the availability of the channel (which is typically an implementation detail that your test should not be concerned with). +// Rather, the point of `BeSent` is to make it possible to easily and expressively write tests that can timeout on blocked channel sends. func BeSent(arg interface{}) types.GomegaMatcher { return &matchers.BeSentMatcher{ Arg: arg, } } -//MatchRegexp succeeds if actual is a string or stringer that matches the -//passed-in regexp. Optional arguments can be provided to construct a regexp -//via fmt.Sprintf(). +// MatchRegexp succeeds if actual is a string or stringer that matches the +// passed-in regexp. Optional arguments can be provided to construct a regexp +// via fmt.Sprintf(). func MatchRegexp(regexp string, args ...interface{}) types.GomegaMatcher { return &matchers.MatchRegexpMatcher{ Regexp: regexp, @@ -185,9 +239,9 @@ func MatchRegexp(regexp string, args ...interface{}) types.GomegaMatcher { } } -//ContainSubstring succeeds if actual is a string or stringer that contains the -//passed-in substring. Optional arguments can be provided to construct the substring -//via fmt.Sprintf(). +// ContainSubstring succeeds if actual is a string or stringer that contains the +// passed-in substring. Optional arguments can be provided to construct the substring +// via fmt.Sprintf(). func ContainSubstring(substr string, args ...interface{}) types.GomegaMatcher { return &matchers.ContainSubstringMatcher{ Substr: substr, @@ -195,9 +249,9 @@ func ContainSubstring(substr string, args ...interface{}) types.GomegaMatcher { } } -//HavePrefix succeeds if actual is a string or stringer that contains the -//passed-in string as a prefix. Optional arguments can be provided to construct -//via fmt.Sprintf(). +// HavePrefix succeeds if actual is a string or stringer that contains the +// passed-in string as a prefix. Optional arguments can be provided to construct +// via fmt.Sprintf(). func HavePrefix(prefix string, args ...interface{}) types.GomegaMatcher { return &matchers.HavePrefixMatcher{ Prefix: prefix, @@ -205,9 +259,9 @@ func HavePrefix(prefix string, args ...interface{}) types.GomegaMatcher { } } -//HaveSuffix succeeds if actual is a string or stringer that contains the -//passed-in string as a suffix. Optional arguments can be provided to construct -//via fmt.Sprintf(). +// HaveSuffix succeeds if actual is a string or stringer that contains the +// passed-in string as a suffix. Optional arguments can be provided to construct +// via fmt.Sprintf(). func HaveSuffix(suffix string, args ...interface{}) types.GomegaMatcher { return &matchers.HaveSuffixMatcher{ Suffix: suffix, @@ -215,73 +269,74 @@ func HaveSuffix(suffix string, args ...interface{}) types.GomegaMatcher { } } -//MatchJSON succeeds if actual is a string or stringer of JSON that matches -//the expected JSON. The JSONs are decoded and the resulting objects are compared via -//reflect.DeepEqual so things like key-ordering and whitespace shouldn't matter. +// MatchJSON succeeds if actual is a string or stringer of JSON that matches +// the expected JSON. The JSONs are decoded and the resulting objects are compared via +// reflect.DeepEqual so things like key-ordering and whitespace shouldn't matter. func MatchJSON(json interface{}) types.GomegaMatcher { return &matchers.MatchJSONMatcher{ JSONToMatch: json, } } -//MatchXML succeeds if actual is a string or stringer of XML that matches -//the expected XML. The XMLs are decoded and the resulting objects are compared via -//reflect.DeepEqual so things like whitespaces shouldn't matter. +// MatchXML succeeds if actual is a string or stringer of XML that matches +// the expected XML. The XMLs are decoded and the resulting objects are compared via +// reflect.DeepEqual so things like whitespaces shouldn't matter. func MatchXML(xml interface{}) types.GomegaMatcher { return &matchers.MatchXMLMatcher{ XMLToMatch: xml, } } -//MatchYAML succeeds if actual is a string or stringer of YAML that matches -//the expected YAML. The YAML's are decoded and the resulting objects are compared via -//reflect.DeepEqual so things like key-ordering and whitespace shouldn't matter. +// MatchYAML succeeds if actual is a string or stringer of YAML that matches +// the expected YAML. The YAML's are decoded and the resulting objects are compared via +// reflect.DeepEqual so things like key-ordering and whitespace shouldn't matter. func MatchYAML(yaml interface{}) types.GomegaMatcher { return &matchers.MatchYAMLMatcher{ YAMLToMatch: yaml, } } -//BeEmpty succeeds if actual is empty. Actual must be of type string, array, map, chan, or slice. +// BeEmpty succeeds if actual is empty. Actual must be of type string, array, map, chan, or slice. func BeEmpty() types.GomegaMatcher { return &matchers.BeEmptyMatcher{} } -//HaveLen succeeds if actual has the passed-in length. Actual must be of type string, array, map, chan, or slice. +// HaveLen succeeds if actual has the passed-in length. Actual must be of type string, array, map, chan, or slice. func HaveLen(count int) types.GomegaMatcher { return &matchers.HaveLenMatcher{ Count: count, } } -//HaveCap succeeds if actual has the passed-in capacity. Actual must be of type array, chan, or slice. +// HaveCap succeeds if actual has the passed-in capacity. Actual must be of type array, chan, or slice. func HaveCap(count int) types.GomegaMatcher { return &matchers.HaveCapMatcher{ Count: count, } } -//BeZero succeeds if actual is the zero value for its type or if actual is nil. +// BeZero succeeds if actual is the zero value for its type or if actual is nil. func BeZero() types.GomegaMatcher { return &matchers.BeZeroMatcher{} } -//ContainElement succeeds if actual contains the passed in element. By default -//ContainElement() uses Equal() to perform the match, however a matcher can be -//passed in instead: -// Expect([]string{"Foo", "FooBar"}).Should(ContainElement(ContainSubstring("Bar"))) +// ContainElement succeeds if actual contains the passed in element. By default +// ContainElement() uses Equal() to perform the match, however a matcher can be +// passed in instead: +// +// Expect([]string{"Foo", "FooBar"}).Should(ContainElement(ContainSubstring("Bar"))) // -//Actual must be an array, slice or map. For maps, ContainElement searches -//through the map's values. +// Actual must be an array, slice or map. For maps, ContainElement searches +// through the map's values. // -//If you want to have a copy of the matching element(s) found you can pass a -//pointer to a variable of the appropriate type. If the variable isn't a slice -//or map, then exactly one match will be expected and returned. If the variable -//is a slice or map, then at least one match is expected and all matches will be -//stored in the variable. +// If you want to have a copy of the matching element(s) found you can pass a +// pointer to a variable of the appropriate type. If the variable isn't a slice +// or map, then exactly one match will be expected and returned. If the variable +// is a slice or map, then at least one match is expected and all matches will be +// stored in the variable. // -// var findings []string -// Expect([]string{"Foo", "FooBar"}).Should(ContainElement(ContainSubString("Bar", &findings))) +// var findings []string +// Expect([]string{"Foo", "FooBar"}).Should(ContainElement(ContainSubString("Bar", &findings))) func ContainElement(element interface{}, result ...interface{}) types.GomegaMatcher { return &matchers.ContainElementMatcher{ Element: element, @@ -289,86 +344,116 @@ func ContainElement(element interface{}, result ...interface{}) types.GomegaMatc } } -//BeElementOf succeeds if actual is contained in the passed in elements. -//BeElementOf() always uses Equal() to perform the match. -//When the passed in elements are comprised of a single element that is either an Array or Slice, BeElementOf() behaves -//as the reverse of ContainElement() that operates with Equal() to perform the match. -// Expect(2).Should(BeElementOf([]int{1, 2})) -// Expect(2).Should(BeElementOf([2]int{1, 2})) -//Otherwise, BeElementOf() provides a syntactic sugar for Or(Equal(_), Equal(_), ...): -// Expect(2).Should(BeElementOf(1, 2)) +// BeElementOf succeeds if actual is contained in the passed in elements. +// BeElementOf() always uses Equal() to perform the match. +// When the passed in elements are comprised of a single element that is either an Array or Slice, BeElementOf() behaves +// as the reverse of ContainElement() that operates with Equal() to perform the match. +// +// Expect(2).Should(BeElementOf([]int{1, 2})) +// Expect(2).Should(BeElementOf([2]int{1, 2})) // -//Actual must be typed. +// Otherwise, BeElementOf() provides a syntactic sugar for Or(Equal(_), Equal(_), ...): +// +// Expect(2).Should(BeElementOf(1, 2)) +// +// Actual must be typed. func BeElementOf(elements ...interface{}) types.GomegaMatcher { return &matchers.BeElementOfMatcher{ Elements: elements, } } -//ConsistOf succeeds if actual contains precisely the elements passed into the matcher. The ordering of the elements does not matter. -//By default ConsistOf() uses Equal() to match the elements, however custom matchers can be passed in instead. Here are some examples: +// BeKeyOf succeeds if actual is contained in the keys of the passed in map. +// BeKeyOf() always uses Equal() to perform the match between actual and the map keys. // -// Expect([]string{"Foo", "FooBar"}).Should(ConsistOf("FooBar", "Foo")) -// Expect([]string{"Foo", "FooBar"}).Should(ConsistOf(ContainSubstring("Bar"), "Foo")) -// Expect([]string{"Foo", "FooBar"}).Should(ConsistOf(ContainSubstring("Foo"), ContainSubstring("Foo"))) +// Expect("foo").Should(BeKeyOf(map[string]bool{"foo": true, "bar": false})) +func BeKeyOf(element interface{}) types.GomegaMatcher { + return &matchers.BeKeyOfMatcher{ + Map: element, + } +} + +// ConsistOf succeeds if actual contains precisely the elements passed into the matcher. The ordering of the elements does not matter. +// By default ConsistOf() uses Equal() to match the elements, however custom matchers can be passed in instead. Here are some examples: +// +// Expect([]string{"Foo", "FooBar"}).Should(ConsistOf("FooBar", "Foo")) +// Expect([]string{"Foo", "FooBar"}).Should(ConsistOf(ContainSubstring("Bar"), "Foo")) +// Expect([]string{"Foo", "FooBar"}).Should(ConsistOf(ContainSubstring("Foo"), ContainSubstring("Foo"))) // -//Actual must be an array, slice or map. For maps, ConsistOf matches against the map's values. +// Actual must be an array, slice or map. For maps, ConsistOf matches against the map's values. // -//You typically pass variadic arguments to ConsistOf (as in the examples above). However, if you need to pass in a slice you can provided that it -//is the only element passed in to ConsistOf: +// You typically pass variadic arguments to ConsistOf (as in the examples above). However, if you need to pass in a slice you can provided that it +// is the only element passed in to ConsistOf: // -// Expect([]string{"Foo", "FooBar"}).Should(ConsistOf([]string{"FooBar", "Foo"})) +// Expect([]string{"Foo", "FooBar"}).Should(ConsistOf([]string{"FooBar", "Foo"})) // -//Note that Go's type system does not allow you to write this as ConsistOf([]string{"FooBar", "Foo"}...) as []string and []interface{} are different types - hence the need for this special rule. +// Note that Go's type system does not allow you to write this as ConsistOf([]string{"FooBar", "Foo"}...) as []string and []interface{} are different types - hence the need for this special rule. func ConsistOf(elements ...interface{}) types.GomegaMatcher { return &matchers.ConsistOfMatcher{ Elements: elements, } } -//ContainElements succeeds if actual contains the passed in elements. The ordering of the elements does not matter. -//By default ContainElements() uses Equal() to match the elements, however custom matchers can be passed in instead. Here are some examples: +// HaveExactElemets succeeds if actual contains elements that precisely match the elemets passed into the matcher. The ordering of the elements does matter. +// By default HaveExactElements() uses Equal() to match the elements, however custom matchers can be passed in instead. Here are some examples: +// +// Expect([]string{"Foo", "FooBar"}).Should(HaveExactElements("Foo", "FooBar")) +// Expect([]string{"Foo", "FooBar"}).Should(HaveExactElements("Foo", ContainSubstring("Bar"))) +// Expect([]string{"Foo", "FooBar"}).Should(HaveExactElements(ContainSubstring("Foo"), ContainSubstring("Foo"))) +// +// Actual must be an array or slice. +func HaveExactElements(elements ...interface{}) types.GomegaMatcher { + return &matchers.HaveExactElementsMatcher{ + Elements: elements, + } +} + +// ContainElements succeeds if actual contains the passed in elements. The ordering of the elements does not matter. +// By default ContainElements() uses Equal() to match the elements, however custom matchers can be passed in instead. Here are some examples: // -// Expect([]string{"Foo", "FooBar"}).Should(ContainElements("FooBar")) -// Expect([]string{"Foo", "FooBar"}).Should(ContainElements(ContainSubstring("Bar"), "Foo")) +// Expect([]string{"Foo", "FooBar"}).Should(ContainElements("FooBar")) +// Expect([]string{"Foo", "FooBar"}).Should(ContainElements(ContainSubstring("Bar"), "Foo")) // -//Actual must be an array, slice or map. -//For maps, ContainElements searches through the map's values. +// Actual must be an array, slice or map. +// For maps, ContainElements searches through the map's values. func ContainElements(elements ...interface{}) types.GomegaMatcher { return &matchers.ContainElementsMatcher{ Elements: elements, } } -//HaveEach succeeds if actual solely contains elements that match the passed in element. -//Please note that if actual is empty, HaveEach always will succeed. -//By default HaveEach() uses Equal() to perform the match, however a -//matcher can be passed in instead: -// Expect([]string{"Foo", "FooBar"}).Should(HaveEach(ContainSubstring("Foo"))) +// HaveEach succeeds if actual solely contains elements that match the passed in element. +// Please note that if actual is empty, HaveEach always will fail. +// By default HaveEach() uses Equal() to perform the match, however a +// matcher can be passed in instead: +// +// Expect([]string{"Foo", "FooBar"}).Should(HaveEach(ContainSubstring("Foo"))) // -//Actual must be an array, slice or map. -//For maps, HaveEach searches through the map's values. +// Actual must be an array, slice or map. +// For maps, HaveEach searches through the map's values. func HaveEach(element interface{}) types.GomegaMatcher { return &matchers.HaveEachMatcher{ Element: element, } } -//HaveKey succeeds if actual is a map with the passed in key. -//By default HaveKey uses Equal() to perform the match, however a -//matcher can be passed in instead: -// Expect(map[string]string{"Foo": "Bar", "BazFoo": "Duck"}).Should(HaveKey(MatchRegexp(`.+Foo$`))) +// HaveKey succeeds if actual is a map with the passed in key. +// By default HaveKey uses Equal() to perform the match, however a +// matcher can be passed in instead: +// +// Expect(map[string]string{"Foo": "Bar", "BazFoo": "Duck"}).Should(HaveKey(MatchRegexp(`.+Foo$`))) func HaveKey(key interface{}) types.GomegaMatcher { return &matchers.HaveKeyMatcher{ Key: key, } } -//HaveKeyWithValue succeeds if actual is a map with the passed in key and value. -//By default HaveKeyWithValue uses Equal() to perform the match, however a -//matcher can be passed in instead: -// Expect(map[string]string{"Foo": "Bar", "BazFoo": "Duck"}).Should(HaveKeyWithValue("Foo", "Bar")) -// Expect(map[string]string{"Foo": "Bar", "BazFoo": "Duck"}).Should(HaveKeyWithValue(MatchRegexp(`.+Foo$`), "Bar")) +// HaveKeyWithValue succeeds if actual is a map with the passed in key and value. +// By default HaveKeyWithValue uses Equal() to perform the match, however a +// matcher can be passed in instead: +// +// Expect(map[string]string{"Foo": "Bar", "BazFoo": "Duck"}).Should(HaveKeyWithValue("Foo", "Bar")) +// Expect(map[string]string{"Foo": "Bar", "BazFoo": "Duck"}).Should(HaveKeyWithValue(MatchRegexp(`.+Foo$`), "Bar")) func HaveKeyWithValue(key interface{}, value interface{}) types.GomegaMatcher { return &matchers.HaveKeyWithValueMatcher{ Key: key, @@ -376,27 +461,27 @@ func HaveKeyWithValue(key interface{}, value interface{}) types.GomegaMatcher { } } -//HaveField succeeds if actual is a struct and the value at the passed in field -//matches the passed in matcher. By default HaveField used Equal() to perform the match, -//however a matcher can be passed in in stead. -// -//The field must be a string that resolves to the name of a field in the struct. Structs can be traversed -//using the '.' delimiter. If the field ends with '()' a method named field is assumed to exist on the struct and is invoked. -//Such methods must take no arguments and return a single value: -// -// type Book struct { -// Title string -// Author Person -// } -// type Person struct { -// FirstName string -// LastName string -// DOB time.Time -// } -// Expect(book).To(HaveField("Title", "Les Miserables")) -// Expect(book).To(HaveField("Title", ContainSubstring("Les")) -// Expect(book).To(HaveField("Author.FirstName", Equal("Victor")) -// Expect(book).To(HaveField("Author.DOB.Year()", BeNumerically("<", 1900)) +// HaveField succeeds if actual is a struct and the value at the passed in field +// matches the passed in matcher. By default HaveField used Equal() to perform the match, +// however a matcher can be passed in in stead. +// +// The field must be a string that resolves to the name of a field in the struct. Structs can be traversed +// using the '.' delimiter. If the field ends with '()' a method named field is assumed to exist on the struct and is invoked. +// Such methods must take no arguments and return a single value: +// +// type Book struct { +// Title string +// Author Person +// } +// type Person struct { +// FirstName string +// LastName string +// DOB time.Time +// } +// Expect(book).To(HaveField("Title", "Les Miserables")) +// Expect(book).To(HaveField("Title", ContainSubstring("Les")) +// Expect(book).To(HaveField("Author.FirstName", Equal("Victor")) +// Expect(book).To(HaveField("Author.DOB.Year()", BeNumerically("<", 1900)) func HaveField(field string, expected interface{}) types.GomegaMatcher { return &matchers.HaveFieldMatcher{ Field: field, @@ -410,7 +495,7 @@ func HaveField(field string, expected interface{}) types.GomegaMatcher { // HaveExistingField can be combined with HaveField in order to cover use cases // with optional fields. HaveField alone would trigger an error in such situations. // -// Expect(MrHarmless).NotTo(And(HaveExistingField("Title"), HaveField("Title", "Supervillain"))) +// Expect(MrHarmless).NotTo(And(HaveExistingField("Title"), HaveField("Title", "Supervillain"))) func HaveExistingField(field string) types.GomegaMatcher { return &matchers.HaveExistingFieldMatcher{ Field: field, @@ -428,26 +513,27 @@ func HaveExistingField(field string) types.GomegaMatcher { // be a pointer (as gstruct.PointTo does) but instead also accepts non-pointer // and even interface values. // -// actual := 42 -// Expect(actual).To(HaveValue(42)) -// Expect(&actual).To(HaveValue(42)) +// actual := 42 +// Expect(actual).To(HaveValue(42)) +// Expect(&actual).To(HaveValue(42)) func HaveValue(matcher types.GomegaMatcher) types.GomegaMatcher { return &matchers.HaveValueMatcher{ Matcher: matcher, } } -//BeNumerically performs numerical assertions in a type-agnostic way. -//Actual and expected should be numbers, though the specific type of -//number is irrelevant (float32, float64, uint8, etc...). +// BeNumerically performs numerical assertions in a type-agnostic way. +// Actual and expected should be numbers, though the specific type of +// number is irrelevant (float32, float64, uint8, etc...). +// +// There are six, self-explanatory, supported comparators: // -//There are six, self-explanatory, supported comparators: -// Expect(1.0).Should(BeNumerically("==", 1)) -// Expect(1.0).Should(BeNumerically("~", 0.999, 0.01)) -// Expect(1.0).Should(BeNumerically(">", 0.9)) -// Expect(1.0).Should(BeNumerically(">=", 1.0)) -// Expect(1.0).Should(BeNumerically("<", 3)) -// Expect(1.0).Should(BeNumerically("<=", 1.0)) +// Expect(1.0).Should(BeNumerically("==", 1)) +// Expect(1.0).Should(BeNumerically("~", 0.999, 0.01)) +// Expect(1.0).Should(BeNumerically(">", 0.9)) +// Expect(1.0).Should(BeNumerically(">=", 1.0)) +// Expect(1.0).Should(BeNumerically("<", 3)) +// Expect(1.0).Should(BeNumerically("<=", 1.0)) func BeNumerically(comparator string, compareTo ...interface{}) types.GomegaMatcher { return &matchers.BeNumericallyMatcher{ Comparator: comparator, @@ -455,10 +541,11 @@ func BeNumerically(comparator string, compareTo ...interface{}) types.GomegaMatc } } -//BeTemporally compares time.Time's like BeNumerically -//Actual and expected must be time.Time. The comparators are the same as for BeNumerically -// Expect(time.Now()).Should(BeTemporally(">", time.Time{})) -// Expect(time.Now()).Should(BeTemporally("~", time.Now(), time.Second)) +// BeTemporally compares time.Time's like BeNumerically +// Actual and expected must be time.Time. The comparators are the same as for BeNumerically +// +// Expect(time.Now()).Should(BeTemporally(">", time.Time{})) +// Expect(time.Now()).Should(BeTemporally("~", time.Now(), time.Second)) func BeTemporally(comparator string, compareTo time.Time, threshold ...time.Duration) types.GomegaMatcher { return &matchers.BeTemporallyMatcher{ Comparator: comparator, @@ -467,58 +554,61 @@ func BeTemporally(comparator string, compareTo time.Time, threshold ...time.Dura } } -//BeAssignableToTypeOf succeeds if actual is assignable to the type of expected. -//It will return an error when one of the values is nil. -// Expect(0).Should(BeAssignableToTypeOf(0)) // Same values -// Expect(5).Should(BeAssignableToTypeOf(-1)) // different values same type -// Expect("foo").Should(BeAssignableToTypeOf("bar")) // different values same type -// Expect(struct{ Foo string }{}).Should(BeAssignableToTypeOf(struct{ Foo string }{})) +// BeAssignableToTypeOf succeeds if actual is assignable to the type of expected. +// It will return an error when one of the values is nil. +// +// Expect(0).Should(BeAssignableToTypeOf(0)) // Same values +// Expect(5).Should(BeAssignableToTypeOf(-1)) // different values same type +// Expect("foo").Should(BeAssignableToTypeOf("bar")) // different values same type +// Expect(struct{ Foo string }{}).Should(BeAssignableToTypeOf(struct{ Foo string }{})) func BeAssignableToTypeOf(expected interface{}) types.GomegaMatcher { return &matchers.AssignableToTypeOfMatcher{ Expected: expected, } } -//Panic succeeds if actual is a function that, when invoked, panics. -//Actual must be a function that takes no arguments and returns no results. +// Panic succeeds if actual is a function that, when invoked, panics. +// Actual must be a function that takes no arguments and returns no results. func Panic() types.GomegaMatcher { return &matchers.PanicMatcher{} } -//PanicWith succeeds if actual is a function that, when invoked, panics with a specific value. -//Actual must be a function that takes no arguments and returns no results. +// PanicWith succeeds if actual is a function that, when invoked, panics with a specific value. +// Actual must be a function that takes no arguments and returns no results. // -//By default PanicWith uses Equal() to perform the match, however a -//matcher can be passed in instead: -// Expect(fn).Should(PanicWith(MatchRegexp(`.+Foo$`))) +// By default PanicWith uses Equal() to perform the match, however a +// matcher can be passed in instead: +// +// Expect(fn).Should(PanicWith(MatchRegexp(`.+Foo$`))) func PanicWith(expected interface{}) types.GomegaMatcher { return &matchers.PanicMatcher{Expected: expected} } -//BeAnExistingFile succeeds if a file exists. -//Actual must be a string representing the abs path to the file being checked. +// BeAnExistingFile succeeds if a file exists. +// Actual must be a string representing the abs path to the file being checked. func BeAnExistingFile() types.GomegaMatcher { return &matchers.BeAnExistingFileMatcher{} } -//BeARegularFile succeeds if a file exists and is a regular file. -//Actual must be a string representing the abs path to the file being checked. +// BeARegularFile succeeds if a file exists and is a regular file. +// Actual must be a string representing the abs path to the file being checked. func BeARegularFile() types.GomegaMatcher { return &matchers.BeARegularFileMatcher{} } -//BeADirectory succeeds if a file exists and is a directory. -//Actual must be a string representing the abs path to the file being checked. +// BeADirectory succeeds if a file exists and is a directory. +// Actual must be a string representing the abs path to the file being checked. func BeADirectory() types.GomegaMatcher { return &matchers.BeADirectoryMatcher{} } -//HaveHTTPStatus succeeds if the Status or StatusCode field of an HTTP response matches. -//Actual must be either a *http.Response or *httptest.ResponseRecorder. -//Expected must be either an int or a string. -// Expect(resp).Should(HaveHTTPStatus(http.StatusOK)) // asserts that resp.StatusCode == 200 -// Expect(resp).Should(HaveHTTPStatus("404 Not Found")) // asserts that resp.Status == "404 Not Found" -// Expect(resp).Should(HaveHTTPStatus(http.StatusOK, http.StatusNoContent)) // asserts that resp.StatusCode == 200 || resp.StatusCode == 204 +// HaveHTTPStatus succeeds if the Status or StatusCode field of an HTTP response matches. +// Actual must be either a *http.Response or *httptest.ResponseRecorder. +// Expected must be either an int or a string. +// +// Expect(resp).Should(HaveHTTPStatus(http.StatusOK)) // asserts that resp.StatusCode == 200 +// Expect(resp).Should(HaveHTTPStatus("404 Not Found")) // asserts that resp.Status == "404 Not Found" +// Expect(resp).Should(HaveHTTPStatus(http.StatusOK, http.StatusNoContent)) // asserts that resp.StatusCode == 200 || resp.StatusCode == 204 func HaveHTTPStatus(expected ...interface{}) types.GomegaMatcher { return &matchers.HaveHTTPStatusMatcher{Expected: expected} } @@ -541,63 +631,70 @@ func HaveHTTPBody(expected interface{}) types.GomegaMatcher { return &matchers.HaveHTTPBodyMatcher{Expected: expected} } -//And succeeds only if all of the given matchers succeed. -//The matchers are tried in order, and will fail-fast if one doesn't succeed. -// Expect("hi").To(And(HaveLen(2), Equal("hi")) +// And succeeds only if all of the given matchers succeed. +// The matchers are tried in order, and will fail-fast if one doesn't succeed. // -//And(), Or(), Not() and WithTransform() allow matchers to be composed into complex expressions. +// Expect("hi").To(And(HaveLen(2), Equal("hi")) +// +// And(), Or(), Not() and WithTransform() allow matchers to be composed into complex expressions. func And(ms ...types.GomegaMatcher) types.GomegaMatcher { return &matchers.AndMatcher{Matchers: ms} } -//SatisfyAll is an alias for And(). -// Expect("hi").Should(SatisfyAll(HaveLen(2), Equal("hi"))) +// SatisfyAll is an alias for And(). +// +// Expect("hi").Should(SatisfyAll(HaveLen(2), Equal("hi"))) func SatisfyAll(matchers ...types.GomegaMatcher) types.GomegaMatcher { return And(matchers...) } -//Or succeeds if any of the given matchers succeed. -//The matchers are tried in order and will return immediately upon the first successful match. -// Expect("hi").To(Or(HaveLen(3), HaveLen(2)) +// Or succeeds if any of the given matchers succeed. +// The matchers are tried in order and will return immediately upon the first successful match. // -//And(), Or(), Not() and WithTransform() allow matchers to be composed into complex expressions. +// Expect("hi").To(Or(HaveLen(3), HaveLen(2)) +// +// And(), Or(), Not() and WithTransform() allow matchers to be composed into complex expressions. func Or(ms ...types.GomegaMatcher) types.GomegaMatcher { return &matchers.OrMatcher{Matchers: ms} } -//SatisfyAny is an alias for Or(). -// Expect("hi").SatisfyAny(Or(HaveLen(3), HaveLen(2)) +// SatisfyAny is an alias for Or(). +// +// Expect("hi").SatisfyAny(Or(HaveLen(3), HaveLen(2)) func SatisfyAny(matchers ...types.GomegaMatcher) types.GomegaMatcher { return Or(matchers...) } -//Not negates the given matcher; it succeeds if the given matcher fails. -// Expect(1).To(Not(Equal(2)) +// Not negates the given matcher; it succeeds if the given matcher fails. // -//And(), Or(), Not() and WithTransform() allow matchers to be composed into complex expressions. +// Expect(1).To(Not(Equal(2)) +// +// And(), Or(), Not() and WithTransform() allow matchers to be composed into complex expressions. func Not(matcher types.GomegaMatcher) types.GomegaMatcher { return &matchers.NotMatcher{Matcher: matcher} } -//WithTransform applies the `transform` to the actual value and matches it against `matcher`. -//The given transform must be either a function of one parameter that returns one value or a +// WithTransform applies the `transform` to the actual value and matches it against `matcher`. +// The given transform must be either a function of one parameter that returns one value or a // function of one parameter that returns two values, where the second value must be of the // error type. -// var plus1 = func(i int) int { return i + 1 } -// Expect(1).To(WithTransform(plus1, Equal(2)) // -// var failingplus1 = func(i int) (int, error) { return 42, "this does not compute" } -// Expect(1).To(WithTransform(failingplus1, Equal(2))) +// var plus1 = func(i int) int { return i + 1 } +// Expect(1).To(WithTransform(plus1, Equal(2)) +// +// var failingplus1 = func(i int) (int, error) { return 42, "this does not compute" } +// Expect(1).To(WithTransform(failingplus1, Equal(2))) // -//And(), Or(), Not() and WithTransform() allow matchers to be composed into complex expressions. +// And(), Or(), Not() and WithTransform() allow matchers to be composed into complex expressions. func WithTransform(transform interface{}, matcher types.GomegaMatcher) types.GomegaMatcher { return matchers.NewWithTransformMatcher(transform, matcher) } -//Satisfy matches the actual value against the `predicate` function. -//The given predicate must be a function of one paramter that returns bool. -// var isEven = func(i int) bool { return i%2 == 0 } -// Expect(2).To(Satisfy(isEven)) +// Satisfy matches the actual value against the `predicate` function. +// The given predicate must be a function of one paramter that returns bool. +// +// var isEven = func(i int) bool { return i%2 == 0 } +// Expect(2).To(Satisfy(isEven)) func Satisfy(predicate interface{}) types.GomegaMatcher { return matchers.NewSatisfyMatcher(predicate) } diff --git a/vendor/github.com/onsi/gomega/matchers/be_a_directory.go b/vendor/github.com/onsi/gomega/matchers/be_a_directory.go index acffc8570..93d4497c7 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_a_directory.go +++ b/vendor/github.com/onsi/gomega/matchers/be_a_directory.go @@ -52,5 +52,5 @@ func (matcher *BeADirectoryMatcher) FailureMessage(actual interface{}) (message } func (matcher *BeADirectoryMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, fmt.Sprintf("not be a directory")) + return format.Message(actual, "not be a directory") } diff --git a/vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go b/vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go index 89441c800..8fefc4deb 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go +++ b/vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go @@ -52,5 +52,5 @@ func (matcher *BeARegularFileMatcher) FailureMessage(actual interface{}) (messag } func (matcher *BeARegularFileMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, fmt.Sprintf("not be a regular file")) + return format.Message(actual, "not be a regular file") } diff --git a/vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go b/vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go index ec6506b00..e2bdd2811 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go +++ b/vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go @@ -32,9 +32,9 @@ func (matcher *BeAnExistingFileMatcher) Match(actual interface{}) (success bool, } func (matcher *BeAnExistingFileMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, fmt.Sprintf("to exist")) + return format.Message(actual, "to exist") } func (matcher *BeAnExistingFileMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, fmt.Sprintf("not to exist")) + return format.Message(actual, "not to exist") } diff --git a/vendor/github.com/onsi/gomega/matchers/be_false_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_false_matcher.go index e326c0157..8ee2b1c51 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_false_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_false_matcher.go @@ -9,6 +9,7 @@ import ( ) type BeFalseMatcher struct { + Reason string } func (matcher *BeFalseMatcher) Match(actual interface{}) (success bool, err error) { @@ -20,9 +21,17 @@ func (matcher *BeFalseMatcher) Match(actual interface{}) (success bool, err erro } func (matcher *BeFalseMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, "to be false") + if matcher.Reason == "" { + return format.Message(actual, "to be false") + } else { + return matcher.Reason + } } func (matcher *BeFalseMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to be false") + if matcher.Reason == "" { + return format.Message(actual, "not to be false") + } else { + return fmt.Sprintf(`Expected not false but got false\nNegation of "%s" failed`, matcher.Reason) + } } diff --git a/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go index 60bc1e3fa..3576aac88 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go @@ -9,6 +9,7 @@ import ( ) type BeTrueMatcher struct { + Reason string } func (matcher *BeTrueMatcher) Match(actual interface{}) (success bool, err error) { @@ -20,9 +21,17 @@ func (matcher *BeTrueMatcher) Match(actual interface{}) (success bool, err error } func (matcher *BeTrueMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, "to be true") + if matcher.Reason == "" { + return format.Message(actual, "to be true") + } else { + return matcher.Reason + } } func (matcher *BeTrueMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to be true") + if matcher.Reason == "" { + return format.Message(actual, "not to be true") + } else { + return fmt.Sprintf(`Expected not true but got true\nNegation of "%s" failed`, matcher.Reason) + } } diff --git a/vendor/github.com/onsi/gomega/matchers/consist_of.go b/vendor/github.com/onsi/gomega/matchers/consist_of.go index e8ef0dee1..f69037a4f 100644 --- a/vendor/github.com/onsi/gomega/matchers/consist_of.go +++ b/vendor/github.com/onsi/gomega/matchers/consist_of.go @@ -48,11 +48,13 @@ func neighbours(value, matcher interface{}) (bool, error) { func equalMatchersToElements(matchers []interface{}) (elements []interface{}) { for _, matcher := range matchers { - equalMatcher, ok := matcher.(*EqualMatcher) - if ok { - matcher = equalMatcher.Expected + if equalMatcher, ok := matcher.(*EqualMatcher); ok { + elements = append(elements, equalMatcher.Expected) + } else if _, ok := matcher.(*BeNilMatcher); ok { + elements = append(elements, nil) + } else { + elements = append(elements, matcher) } - elements = append(elements, matcher) } return } @@ -72,11 +74,13 @@ func flatten(elems []interface{}) []interface{} { func matchers(expectedElems []interface{}) (matchers []interface{}) { for _, e := range flatten(expectedElems) { - matcher, isMatcher := e.(omegaMatcher) - if !isMatcher { - matcher = &EqualMatcher{Expected: e} + if e == nil { + matchers = append(matchers, &BeNilMatcher{}) + } else if matcher, isMatcher := e.(omegaMatcher); isMatcher { + matchers = append(matchers, matcher) + } else { + matchers = append(matchers, &EqualMatcher{Expected: e}) } - matchers = append(matchers, matcher) } return } @@ -89,9 +93,14 @@ func presentable(elems []interface{}) interface{} { } sv := reflect.ValueOf(elems) - tt := sv.Index(0).Elem().Type() + firstEl := sv.Index(0) + if firstEl.IsNil() { + return elems + } + tt := firstEl.Elem().Type() for i := 1; i < sv.Len(); i++ { - if sv.Index(i).Elem().Type() != tt { + el := sv.Index(i) + if el.IsNil() || (sv.Index(i).Elem().Type() != tt) { return elems } } diff --git a/vendor/github.com/onsi/gomega/matchers/have_http_body_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_http_body_matcher.go index 6a3dcdc35..d14d9e5fc 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_http_body_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_http_body_matcher.go @@ -11,8 +11,9 @@ import ( ) type HaveHTTPBodyMatcher struct { - Expected interface{} - cachedBody []byte + Expected interface{} + cachedResponse interface{} + cachedBody []byte } func (matcher *HaveHTTPBodyMatcher) Match(actual interface{}) (bool, error) { @@ -73,7 +74,7 @@ func (matcher *HaveHTTPBodyMatcher) NegatedFailureMessage(actual interface{}) (m // the Reader is closed and it is not readable again in FailureMessage() // or NegatedFailureMessage() func (matcher *HaveHTTPBodyMatcher) body(actual interface{}) ([]byte, error) { - if matcher.cachedBody != nil { + if matcher.cachedResponse == actual && matcher.cachedBody != nil { return matcher.cachedBody, nil } @@ -91,8 +92,10 @@ func (matcher *HaveHTTPBodyMatcher) body(actual interface{}) ([]byte, error) { switch a := actual.(type) { case *http.Response: + matcher.cachedResponse = a return body(a) case *httptest.ResponseRecorder: + matcher.cachedResponse = a return body(a.Result()) default: return nil, fmt.Errorf("HaveHTTPBody matcher expects *http.Response or *httptest.ResponseRecorder. Got:\n%s", format.Object(actual, 1)) diff --git a/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go index 5bcfdd2ad..22a1b6730 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go @@ -31,5 +31,5 @@ func (matcher *HaveOccurredMatcher) FailureMessage(actual interface{}) (message } func (matcher *HaveOccurredMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return fmt.Sprintf("Unexpected error:\n%s\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1), "occurred") + return fmt.Sprintf("Unexpected error:\n%s\n%s", format.Object(actual, 1), "occurred") } diff --git a/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go index c8993a86d..c539dd389 100644 --- a/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go @@ -9,10 +9,14 @@ import ( ) type MatchErrorMatcher struct { - Expected interface{} + Expected any + FuncErrDescription []any + isFunc bool } -func (matcher *MatchErrorMatcher) Match(actual interface{}) (success bool, err error) { +func (matcher *MatchErrorMatcher) Match(actual any) (success bool, err error) { + matcher.isFunc = false + if isNil(actual) { return false, fmt.Errorf("Expected an error, got nil") } @@ -25,13 +29,34 @@ func (matcher *MatchErrorMatcher) Match(actual interface{}) (success bool, err e expected := matcher.Expected if isError(expected) { - return reflect.DeepEqual(actualErr, expected) || errors.Is(actualErr, expected.(error)), nil + // first try the built-in errors.Is + if errors.Is(actualErr, expected.(error)) { + return true, nil + } + // if not, try DeepEqual along the error chain + for unwrapped := actualErr; unwrapped != nil; unwrapped = errors.Unwrap(unwrapped) { + if reflect.DeepEqual(unwrapped, expected) { + return true, nil + } + } + return false, nil } if isString(expected) { return actualErr.Error() == expected, nil } + v := reflect.ValueOf(expected) + t := v.Type() + errorInterface := reflect.TypeOf((*error)(nil)).Elem() + if t.Kind() == reflect.Func && t.NumIn() == 1 && t.In(0).Implements(errorInterface) && t.NumOut() == 1 && t.Out(0).Kind() == reflect.Bool { + if len(matcher.FuncErrDescription) == 0 { + return false, fmt.Errorf("MatchError requires an additional description when passed a function") + } + matcher.isFunc = true + return v.Call([]reflect.Value{reflect.ValueOf(actualErr)})[0].Bool(), nil + } + var subMatcher omegaMatcher var hasSubMatcher bool if expected != nil { @@ -47,9 +72,15 @@ func (matcher *MatchErrorMatcher) Match(actual interface{}) (success bool, err e } func (matcher *MatchErrorMatcher) FailureMessage(actual interface{}) (message string) { + if matcher.isFunc { + return format.Message(actual, fmt.Sprintf("to match error function %s", matcher.FuncErrDescription[0])) + } return format.Message(actual, "to match error", matcher.Expected) } func (matcher *MatchErrorMatcher) NegatedFailureMessage(actual interface{}) (message string) { + if matcher.isFunc { + return format.Message(actual, fmt.Sprintf("not to match error function %s", matcher.FuncErrDescription[0])) + } return format.Message(actual, "not to match error", matcher.Expected) } diff --git a/vendor/github.com/onsi/gomega/matchers/succeed_matcher.go b/vendor/github.com/onsi/gomega/matchers/succeed_matcher.go index 721ed5529..327350f7b 100644 --- a/vendor/github.com/onsi/gomega/matchers/succeed_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/succeed_matcher.go @@ -1,11 +1,16 @@ package matchers import ( + "errors" "fmt" "github.com/onsi/gomega/format" ) +type formattedGomegaError interface { + FormattedGomegaError() string +} + type SucceedMatcher struct { } @@ -25,7 +30,11 @@ func (matcher *SucceedMatcher) Match(actual interface{}) (success bool, err erro } func (matcher *SucceedMatcher) FailureMessage(actual interface{}) (message string) { - return fmt.Sprintf("Expected success, but got an error:\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1)) + var fgErr formattedGomegaError + if errors.As(actual.(error), &fgErr) { + return fgErr.FormattedGomegaError() + } + return fmt.Sprintf("Expected success, but got an error:\n%s", format.Object(actual, 1)) } func (matcher *SucceedMatcher) NegatedFailureMessage(actual interface{}) (message string) { diff --git a/vendor/github.com/onsi/gomega/tools b/vendor/github.com/onsi/gomega/tools deleted file mode 100644 index e4195cf36..000000000 --- a/vendor/github.com/onsi/gomega/tools +++ /dev/null @@ -1,8 +0,0 @@ -//go:build tools -// +build tools - -package main - -import ( - _ "github.com/onsi/ginkgo/v2/ginkgo" -) diff --git a/vendor/github.com/onsi/gomega/types/types.go b/vendor/github.com/onsi/gomega/types/types.go index c315ef065..7c7adb941 100644 --- a/vendor/github.com/onsi/gomega/types/types.go +++ b/vendor/github.com/onsi/gomega/types/types.go @@ -1,12 +1,13 @@ package types import ( + "context" "time" ) type GomegaFailHandler func(message string, callerSkip ...int) -//A simple *testing.T interface wrapper +// A simple *testing.T interface wrapper type GomegaTestingT interface { Helper() Fatalf(format string, args ...interface{}) @@ -18,11 +19,11 @@ type Gomega interface { Expect(actual interface{}, extra ...interface{}) Assertion ExpectWithOffset(offset int, actual interface{}, extra ...interface{}) Assertion - Eventually(actual interface{}, intervals ...interface{}) AsyncAssertion - EventuallyWithOffset(offset int, actual interface{}, intervals ...interface{}) AsyncAssertion + Eventually(actualOrCtx interface{}, args ...interface{}) AsyncAssertion + EventuallyWithOffset(offset int, actualOrCtx interface{}, args ...interface{}) AsyncAssertion - Consistently(actual interface{}, intervals ...interface{}) AsyncAssertion - ConsistentlyWithOffset(offset int, actual interface{}, intervals ...interface{}) AsyncAssertion + Consistently(actualOrCtx interface{}, args ...interface{}) AsyncAssertion + ConsistentlyWithOffset(offset int, actualOrCtx interface{}, args ...interface{}) AsyncAssertion SetDefaultEventuallyTimeout(time.Duration) SetDefaultEventuallyPollingInterval(time.Duration) @@ -30,9 +31,9 @@ type Gomega interface { SetDefaultConsistentlyPollingInterval(time.Duration) } -//All Gomega matchers must implement the GomegaMatcher interface +// All Gomega matchers must implement the GomegaMatcher interface // -//For details on writing custom matchers, check out: http://onsi.github.io/gomega/#adding-your-own-matchers +// For details on writing custom matchers, check out: http://onsi.github.io/gomega/#adding-your-own-matchers type GomegaMatcher interface { Match(actual interface{}) (success bool, err error) FailureMessage(actual interface{}) (message string) @@ -70,6 +71,11 @@ type AsyncAssertion interface { WithOffset(offset int) AsyncAssertion WithTimeout(interval time.Duration) AsyncAssertion WithPolling(interval time.Duration) AsyncAssertion + Within(timeout time.Duration) AsyncAssertion + ProbeEvery(interval time.Duration) AsyncAssertion + WithContext(ctx context.Context) AsyncAssertion + WithArguments(argsToForward ...interface{}) AsyncAssertion + MustPassRepeatedly(count int) AsyncAssertion } // Assertions are returned by Ī© and Expect and enable assertions against Gomega matchers diff --git a/vendor/golang.org/x/mod/internal/lazyregexp/lazyre.go b/vendor/golang.org/x/mod/internal/lazyregexp/lazyre.go index 2681af35a..150f887e7 100644 --- a/vendor/golang.org/x/mod/internal/lazyregexp/lazyre.go +++ b/vendor/golang.org/x/mod/internal/lazyregexp/lazyre.go @@ -13,7 +13,7 @@ import ( "sync" ) -// Regexp is a wrapper around regexp.Regexp, where the underlying regexp will be +// Regexp is a wrapper around [regexp.Regexp], where the underlying regexp will be // compiled the first time it is needed. type Regexp struct { str string diff --git a/vendor/golang.org/x/mod/module/module.go b/vendor/golang.org/x/mod/module/module.go index e9dec6e61..2a364b229 100644 --- a/vendor/golang.org/x/mod/module/module.go +++ b/vendor/golang.org/x/mod/module/module.go @@ -4,7 +4,7 @@ // Package module defines the module.Version type along with support code. // -// The module.Version type is a simple Path, Version pair: +// The [module.Version] type is a simple Path, Version pair: // // type Version struct { // Path string @@ -12,7 +12,7 @@ // } // // There are no restrictions imposed directly by use of this structure, -// but additional checking functions, most notably Check, verify that +// but additional checking functions, most notably [Check], verify that // a particular path, version pair is valid. // // # Escaped Paths @@ -140,7 +140,7 @@ type ModuleError struct { Err error } -// VersionError returns a ModuleError derived from a Version and error, +// VersionError returns a [ModuleError] derived from a [Version] and error, // or err itself if it is already such an error. func VersionError(v Version, err error) error { var mErr *ModuleError @@ -169,7 +169,7 @@ func (e *ModuleError) Unwrap() error { return e.Err } // An InvalidVersionError indicates an error specific to a version, with the // module path unknown or specified externally. // -// A ModuleError may wrap an InvalidVersionError, but an InvalidVersionError +// A [ModuleError] may wrap an InvalidVersionError, but an InvalidVersionError // must not wrap a ModuleError. type InvalidVersionError struct { Version string @@ -193,8 +193,8 @@ func (e *InvalidVersionError) Error() string { func (e *InvalidVersionError) Unwrap() error { return e.Err } // An InvalidPathError indicates a module, import, or file path doesn't -// satisfy all naming constraints. See CheckPath, CheckImportPath, -// and CheckFilePath for specific restrictions. +// satisfy all naming constraints. See [CheckPath], [CheckImportPath], +// and [CheckFilePath] for specific restrictions. type InvalidPathError struct { Kind string // "module", "import", or "file" Path string @@ -294,7 +294,7 @@ func fileNameOK(r rune) bool { } // CheckPath checks that a module path is valid. -// A valid module path is a valid import path, as checked by CheckImportPath, +// A valid module path is a valid import path, as checked by [CheckImportPath], // with three additional constraints. // First, the leading path element (up to the first slash, if any), // by convention a domain name, must contain only lower-case ASCII letters, @@ -380,7 +380,7 @@ const ( // checkPath returns an error describing why the path is not valid. // Because these checks apply to module, import, and file paths, // and because other checks may be applied, the caller is expected to wrap -// this error with InvalidPathError. +// this error with [InvalidPathError]. func checkPath(path string, kind pathKind) error { if !utf8.ValidString(path) { return fmt.Errorf("invalid UTF-8") @@ -532,7 +532,7 @@ var badWindowsNames = []string{ // they require ".vN" instead of "/vN", and for all N, not just N >= 2. // SplitPathVersion returns with ok = false when presented with // a path whose last path element does not satisfy the constraints -// applied by CheckPath, such as "example.com/pkg/v1" or "example.com/pkg/v1.2". +// applied by [CheckPath], such as "example.com/pkg/v1" or "example.com/pkg/v1.2". func SplitPathVersion(path string) (prefix, pathMajor string, ok bool) { if strings.HasPrefix(path, "gopkg.in/") { return splitGopkgIn(path) @@ -582,7 +582,7 @@ func splitGopkgIn(path string) (prefix, pathMajor string, ok bool) { // MatchPathMajor reports whether the semantic version v // matches the path major version pathMajor. // -// MatchPathMajor returns true if and only if CheckPathMajor returns nil. +// MatchPathMajor returns true if and only if [CheckPathMajor] returns nil. func MatchPathMajor(v, pathMajor string) bool { return CheckPathMajor(v, pathMajor) == nil } @@ -622,7 +622,7 @@ func CheckPathMajor(v, pathMajor string) error { // PathMajorPrefix returns the major-version tag prefix implied by pathMajor. // An empty PathMajorPrefix allows either v0 or v1. // -// Note that MatchPathMajor may accept some versions that do not actually begin +// Note that [MatchPathMajor] may accept some versions that do not actually begin // with this prefix: namely, it accepts a 'v0.0.0-' prefix for a '.v1' // pathMajor, even though that pathMajor implies 'v1' tagging. func PathMajorPrefix(pathMajor string) string { @@ -643,7 +643,7 @@ func PathMajorPrefix(pathMajor string) string { } // CanonicalVersion returns the canonical form of the version string v. -// It is the same as semver.Canonical(v) except that it preserves the special build suffix "+incompatible". +// It is the same as [semver.Canonical] except that it preserves the special build suffix "+incompatible". func CanonicalVersion(v string) string { cv := semver.Canonical(v) if semver.Build(v) == "+incompatible" { @@ -652,8 +652,8 @@ func CanonicalVersion(v string) string { return cv } -// Sort sorts the list by Path, breaking ties by comparing Version fields. -// The Version fields are interpreted as semantic versions (using semver.Compare) +// Sort sorts the list by Path, breaking ties by comparing [Version] fields. +// The Version fields are interpreted as semantic versions (using [semver.Compare]) // optionally followed by a tie-breaking suffix introduced by a slash character, // like in "v0.0.1/go.mod". func Sort(list []Version) { @@ -793,7 +793,7 @@ func unescapeString(escaped string) (string, bool) { } // MatchPrefixPatterns reports whether any path prefix of target matches one of -// the glob patterns (as defined by path.Match) in the comma-separated globs +// the glob patterns (as defined by [path.Match]) in the comma-separated globs // list. This implements the algorithm used when matching a module path to the // GOPRIVATE environment variable, as described by 'go help module-private'. // diff --git a/vendor/golang.org/x/mod/module/pseudo.go b/vendor/golang.org/x/mod/module/pseudo.go index f04ad3788..9cf19d325 100644 --- a/vendor/golang.org/x/mod/module/pseudo.go +++ b/vendor/golang.org/x/mod/module/pseudo.go @@ -125,7 +125,7 @@ func IsPseudoVersion(v string) bool { } // IsZeroPseudoVersion returns whether v is a pseudo-version with a zero base, -// timestamp, and revision, as returned by ZeroPseudoVersion. +// timestamp, and revision, as returned by [ZeroPseudoVersion]. func IsZeroPseudoVersion(v string) bool { return v == ZeroPseudoVersion(semver.Major(v)) } diff --git a/vendor/golang.org/x/mod/semver/semver.go b/vendor/golang.org/x/mod/semver/semver.go index a30a22bf2..9a2dfd33a 100644 --- a/vendor/golang.org/x/mod/semver/semver.go +++ b/vendor/golang.org/x/mod/semver/semver.go @@ -140,7 +140,7 @@ func Compare(v, w string) int { // Max canonicalizes its arguments and then returns the version string // that compares greater. // -// Deprecated: use Compare instead. In most cases, returning a canonicalized +// Deprecated: use [Compare] instead. In most cases, returning a canonicalized // version is not expected or desired. func Max(v, w string) string { v = Canonical(v) @@ -151,7 +151,7 @@ func Max(v, w string) string { return w } -// ByVersion implements sort.Interface for sorting semantic version strings. +// ByVersion implements [sort.Interface] for sorting semantic version strings. type ByVersion []string func (vs ByVersion) Len() int { return len(vs) } @@ -164,7 +164,7 @@ func (vs ByVersion) Less(i, j int) bool { return vs[i] < vs[j] } -// Sort sorts a list of semantic version strings using ByVersion. +// Sort sorts a list of semantic version strings using [ByVersion]. func Sort(list []string) { sort.Sort(ByVersion(list)) } diff --git a/vendor/golang.org/x/net/html/token.go b/vendor/golang.org/x/net/html/token.go index de67f938a..3c57880d6 100644 --- a/vendor/golang.org/x/net/html/token.go +++ b/vendor/golang.org/x/net/html/token.go @@ -910,9 +910,6 @@ func (z *Tokenizer) readTagAttrKey() { return } switch c { - case ' ', '\n', '\r', '\t', '\f', '/': - z.pendingAttr[0].end = z.raw.end - 1 - return case '=': if z.pendingAttr[0].start+1 == z.raw.end { // WHATWG 13.2.5.32, if we see an equals sign before the attribute name @@ -920,7 +917,9 @@ func (z *Tokenizer) readTagAttrKey() { continue } fallthrough - case '>': + case ' ', '\n', '\r', '\t', '\f', '/', '>': + // WHATWG 13.2.5.33 Attribute name state + // We need to reconsume the char in the after attribute name state to support the / character z.raw.end-- z.pendingAttr[0].end = z.raw.end return @@ -939,6 +938,11 @@ func (z *Tokenizer) readTagAttrVal() { if z.err != nil { return } + if c == '/' { + // WHATWG 13.2.5.34 After attribute name state + // U+002F SOLIDUS (/) - Switch to the self-closing start tag state. + return + } if c != '=' { z.raw.end-- return diff --git a/vendor/golang.org/x/net/http2/databuffer.go b/vendor/golang.org/x/net/http2/databuffer.go index a3067f8de..e6f55cbd1 100644 --- a/vendor/golang.org/x/net/http2/databuffer.go +++ b/vendor/golang.org/x/net/http2/databuffer.go @@ -20,41 +20,44 @@ import ( // TODO: Benchmark to determine if the pools are necessary. The GC may have // improved enough that we can instead allocate chunks like this: // make([]byte, max(16<<10, expectedBytesRemaining)) -var ( - dataChunkSizeClasses = []int{ - 1 << 10, - 2 << 10, - 4 << 10, - 8 << 10, - 16 << 10, - } - dataChunkPools = [...]sync.Pool{ - {New: func() interface{} { return make([]byte, 1<<10) }}, - {New: func() interface{} { return make([]byte, 2<<10) }}, - {New: func() interface{} { return make([]byte, 4<<10) }}, - {New: func() interface{} { return make([]byte, 8<<10) }}, - {New: func() interface{} { return make([]byte, 16<<10) }}, - } -) +var dataChunkPools = [...]sync.Pool{ + {New: func() interface{} { return new([1 << 10]byte) }}, + {New: func() interface{} { return new([2 << 10]byte) }}, + {New: func() interface{} { return new([4 << 10]byte) }}, + {New: func() interface{} { return new([8 << 10]byte) }}, + {New: func() interface{} { return new([16 << 10]byte) }}, +} func getDataBufferChunk(size int64) []byte { - i := 0 - for ; i < len(dataChunkSizeClasses)-1; i++ { - if size <= int64(dataChunkSizeClasses[i]) { - break - } + switch { + case size <= 1<<10: + return dataChunkPools[0].Get().(*[1 << 10]byte)[:] + case size <= 2<<10: + return dataChunkPools[1].Get().(*[2 << 10]byte)[:] + case size <= 4<<10: + return dataChunkPools[2].Get().(*[4 << 10]byte)[:] + case size <= 8<<10: + return dataChunkPools[3].Get().(*[8 << 10]byte)[:] + default: + return dataChunkPools[4].Get().(*[16 << 10]byte)[:] } - return dataChunkPools[i].Get().([]byte) } func putDataBufferChunk(p []byte) { - for i, n := range dataChunkSizeClasses { - if len(p) == n { - dataChunkPools[i].Put(p) - return - } + switch len(p) { + case 1 << 10: + dataChunkPools[0].Put((*[1 << 10]byte)(p)) + case 2 << 10: + dataChunkPools[1].Put((*[2 << 10]byte)(p)) + case 4 << 10: + dataChunkPools[2].Put((*[4 << 10]byte)(p)) + case 8 << 10: + dataChunkPools[3].Put((*[8 << 10]byte)(p)) + case 16 << 10: + dataChunkPools[4].Put((*[16 << 10]byte)(p)) + default: + panic(fmt.Sprintf("unexpected buffer len=%v", len(p))) } - panic(fmt.Sprintf("unexpected buffer len=%v", len(p))) } // dataBuffer is an io.ReadWriter backed by a list of data chunks. diff --git a/vendor/golang.org/x/net/http2/frame.go b/vendor/golang.org/x/net/http2/frame.go index c1f6b90dc..e2b298d85 100644 --- a/vendor/golang.org/x/net/http2/frame.go +++ b/vendor/golang.org/x/net/http2/frame.go @@ -1510,13 +1510,12 @@ func (mh *MetaHeadersFrame) checkPseudos() error { } func (fr *Framer) maxHeaderStringLen() int { - v := fr.maxHeaderListSize() - if uint32(int(v)) == v { - return int(v) + v := int(fr.maxHeaderListSize()) + if v < 0 { + // If maxHeaderListSize overflows an int, use no limit (0). + return 0 } - // They had a crazy big number for MaxHeaderBytes anyway, - // so give them unlimited header lengths: - return 0 + return v } // readMetaFrame returns 0 or more CONTINUATION frames from fr and diff --git a/vendor/golang.org/x/net/http2/go111.go b/vendor/golang.org/x/net/http2/go111.go deleted file mode 100644 index 5bf62b032..000000000 --- a/vendor/golang.org/x/net/http2/go111.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build go1.11 -// +build go1.11 - -package http2 - -import ( - "net/http/httptrace" - "net/textproto" -) - -func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool { - return trace != nil && trace.WroteHeaderField != nil -} - -func traceWroteHeaderField(trace *httptrace.ClientTrace, k, v string) { - if trace != nil && trace.WroteHeaderField != nil { - trace.WroteHeaderField(k, []string{v}) - } -} - -func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error { - if trace != nil { - return trace.Got1xxResponse - } - return nil -} diff --git a/vendor/golang.org/x/net/http2/go115.go b/vendor/golang.org/x/net/http2/go115.go deleted file mode 100644 index 908af1ab9..000000000 --- a/vendor/golang.org/x/net/http2/go115.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build go1.15 -// +build go1.15 - -package http2 - -import ( - "context" - "crypto/tls" -) - -// dialTLSWithContext uses tls.Dialer, added in Go 1.15, to open a TLS -// connection. -func (t *Transport) dialTLSWithContext(ctx context.Context, network, addr string, cfg *tls.Config) (*tls.Conn, error) { - dialer := &tls.Dialer{ - Config: cfg, - } - cn, err := dialer.DialContext(ctx, network, addr) - if err != nil { - return nil, err - } - tlsCn := cn.(*tls.Conn) // DialContext comment promises this will always succeed - return tlsCn, nil -} diff --git a/vendor/golang.org/x/net/http2/go118.go b/vendor/golang.org/x/net/http2/go118.go deleted file mode 100644 index aca4b2b31..000000000 --- a/vendor/golang.org/x/net/http2/go118.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build go1.18 -// +build go1.18 - -package http2 - -import ( - "crypto/tls" - "net" -) - -func tlsUnderlyingConn(tc *tls.Conn) net.Conn { - return tc.NetConn() -} diff --git a/vendor/golang.org/x/net/http2/not_go111.go b/vendor/golang.org/x/net/http2/not_go111.go deleted file mode 100644 index cc0baa819..000000000 --- a/vendor/golang.org/x/net/http2/not_go111.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !go1.11 -// +build !go1.11 - -package http2 - -import ( - "net/http/httptrace" - "net/textproto" -) - -func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool { return false } - -func traceWroteHeaderField(trace *httptrace.ClientTrace, k, v string) {} - -func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error { - return nil -} diff --git a/vendor/golang.org/x/net/http2/not_go115.go b/vendor/golang.org/x/net/http2/not_go115.go deleted file mode 100644 index e6c04cf7a..000000000 --- a/vendor/golang.org/x/net/http2/not_go115.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !go1.15 -// +build !go1.15 - -package http2 - -import ( - "context" - "crypto/tls" -) - -// dialTLSWithContext opens a TLS connection. -func (t *Transport) dialTLSWithContext(ctx context.Context, network, addr string, cfg *tls.Config) (*tls.Conn, error) { - cn, err := tls.Dial(network, addr, cfg) - if err != nil { - return nil, err - } - if err := cn.Handshake(); err != nil { - return nil, err - } - if cfg.InsecureSkipVerify { - return cn, nil - } - if err := cn.VerifyHostname(cfg.ServerName); err != nil { - return nil, err - } - return cn, nil -} diff --git a/vendor/golang.org/x/net/http2/not_go118.go b/vendor/golang.org/x/net/http2/not_go118.go deleted file mode 100644 index eab532c96..000000000 --- a/vendor/golang.org/x/net/http2/not_go118.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !go1.18 -// +build !go1.18 - -package http2 - -import ( - "crypto/tls" - "net" -) - -func tlsUnderlyingConn(tc *tls.Conn) net.Conn { - return nil -} diff --git a/vendor/golang.org/x/net/http2/server.go b/vendor/golang.org/x/net/http2/server.go index de60fa88f..ae94c6408 100644 --- a/vendor/golang.org/x/net/http2/server.go +++ b/vendor/golang.org/x/net/http2/server.go @@ -581,9 +581,11 @@ type serverConn struct { advMaxStreams uint32 // our SETTINGS_MAX_CONCURRENT_STREAMS advertised the client curClientStreams uint32 // number of open streams initiated by the client curPushedStreams uint32 // number of open streams initiated by server push + curHandlers uint32 // number of running handler goroutines maxClientStreamID uint32 // max ever seen from client (odd), or 0 if there have been no client requests maxPushPromiseID uint32 // ID of the last push promise (even), or 0 if there have been no pushes streams map[uint32]*stream + unstartedHandlers []unstartedHandler initialStreamSendWindowSize int32 maxFrameSize int32 peerMaxHeaderListSize uint32 // zero means unknown (default) @@ -981,6 +983,8 @@ func (sc *serverConn) serve() { return case gracefulShutdownMsg: sc.startGracefulShutdownInternal() + case handlerDoneMsg: + sc.handlerDone() default: panic("unknown timer") } @@ -1020,6 +1024,7 @@ var ( idleTimerMsg = new(serverMessage) shutdownTimerMsg = new(serverMessage) gracefulShutdownMsg = new(serverMessage) + handlerDoneMsg = new(serverMessage) ) func (sc *serverConn) onSettingsTimer() { sc.sendServeMsg(settingsTimerMsg) } @@ -2017,8 +2022,7 @@ func (sc *serverConn) processHeaders(f *MetaHeadersFrame) error { st.readDeadline = time.AfterFunc(sc.hs.ReadTimeout, st.onReadTimeout) } - go sc.runHandler(rw, req, handler) - return nil + return sc.scheduleHandler(id, rw, req, handler) } func (sc *serverConn) upgradeRequest(req *http.Request) { @@ -2038,6 +2042,10 @@ func (sc *serverConn) upgradeRequest(req *http.Request) { sc.conn.SetReadDeadline(time.Time{}) } + // This is the first request on the connection, + // so start the handler directly rather than going + // through scheduleHandler. + sc.curHandlers++ go sc.runHandler(rw, req, sc.handler.ServeHTTP) } @@ -2278,8 +2286,62 @@ func (sc *serverConn) newResponseWriter(st *stream, req *http.Request) *response return &responseWriter{rws: rws} } +type unstartedHandler struct { + streamID uint32 + rw *responseWriter + req *http.Request + handler func(http.ResponseWriter, *http.Request) +} + +// scheduleHandler starts a handler goroutine, +// or schedules one to start as soon as an existing handler finishes. +func (sc *serverConn) scheduleHandler(streamID uint32, rw *responseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) error { + sc.serveG.check() + maxHandlers := sc.advMaxStreams + if sc.curHandlers < maxHandlers { + sc.curHandlers++ + go sc.runHandler(rw, req, handler) + return nil + } + if len(sc.unstartedHandlers) > int(4*sc.advMaxStreams) { + return sc.countError("too_many_early_resets", ConnectionError(ErrCodeEnhanceYourCalm)) + } + sc.unstartedHandlers = append(sc.unstartedHandlers, unstartedHandler{ + streamID: streamID, + rw: rw, + req: req, + handler: handler, + }) + return nil +} + +func (sc *serverConn) handlerDone() { + sc.serveG.check() + sc.curHandlers-- + i := 0 + maxHandlers := sc.advMaxStreams + for ; i < len(sc.unstartedHandlers); i++ { + u := sc.unstartedHandlers[i] + if sc.streams[u.streamID] == nil { + // This stream was reset before its goroutine had a chance to start. + continue + } + if sc.curHandlers >= maxHandlers { + break + } + sc.curHandlers++ + go sc.runHandler(u.rw, u.req, u.handler) + sc.unstartedHandlers[i] = unstartedHandler{} // don't retain references + } + sc.unstartedHandlers = sc.unstartedHandlers[i:] + if len(sc.unstartedHandlers) == 0 { + sc.unstartedHandlers = nil + } +} + // Run on its own goroutine. func (sc *serverConn) runHandler(rw *responseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) { + defer sc.sendServeMsg(handlerDoneMsg) didPanic := true defer func() { rw.rws.stream.cancelCtx() @@ -2487,7 +2549,6 @@ type responseWriterState struct { wroteHeader bool // WriteHeader called (explicitly or implicitly). Not necessarily sent to user yet. sentHeader bool // have we sent the header frame? handlerDone bool // handler has finished - dirty bool // a Write failed; don't reuse this responseWriterState sentContentLen int64 // non-zero if handler set a Content-Length header wroteBytes int64 @@ -2607,7 +2668,6 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) { date: date, }) if err != nil { - rws.dirty = true return 0, err } if endStream { @@ -2628,7 +2688,6 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) { if len(p) > 0 || endStream { // only send a 0 byte DATA frame if we're ending the stream. if err := rws.conn.writeDataFromHandler(rws.stream, p, endStream); err != nil { - rws.dirty = true return 0, err } } @@ -2640,9 +2699,6 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) { trailers: rws.trailers, endStream: true, }) - if err != nil { - rws.dirty = true - } return len(p), err } return len(p), nil @@ -2858,14 +2914,12 @@ func (rws *responseWriterState) writeHeader(code int) { h.Del("Transfer-Encoding") } - if rws.conn.writeHeaders(rws.stream, &writeResHeaders{ + rws.conn.writeHeaders(rws.stream, &writeResHeaders{ streamID: rws.stream.id, httpResCode: code, h: h, endStream: rws.handlerDone && !rws.hasTrailers(), - }) != nil { - rws.dirty = true - } + }) return } @@ -2930,19 +2984,10 @@ func (w *responseWriter) write(lenData int, dataB []byte, dataS string) (n int, func (w *responseWriter) handlerDone() { rws := w.rws - dirty := rws.dirty rws.handlerDone = true w.Flush() w.rws = nil - if !dirty { - // Only recycle the pool if all prior Write calls to - // the serverConn goroutine completed successfully. If - // they returned earlier due to resets from the peer - // there might still be write goroutines outstanding - // from the serverConn referencing the rws memory. See - // issue 20704. - responseWriterStatePool.Put(rws) - } + responseWriterStatePool.Put(rws) } // Push errors. @@ -3125,6 +3170,7 @@ func (sc *serverConn) startPush(msg *startPushRequest) { panic(fmt.Sprintf("newWriterAndRequestNoBody(%+v): %v", msg.url, err)) } + sc.curHandlers++ go sc.runHandler(rw, req, sc.handler.ServeHTTP) return promisedID, nil } diff --git a/vendor/golang.org/x/net/http2/transport.go b/vendor/golang.org/x/net/http2/transport.go index 4515b22c4..df578b86c 100644 --- a/vendor/golang.org/x/net/http2/transport.go +++ b/vendor/golang.org/x/net/http2/transport.go @@ -1018,7 +1018,7 @@ func (cc *ClientConn) forceCloseConn() { if !ok { return } - if nc := tlsUnderlyingConn(tc); nc != nil { + if nc := tc.NetConn(); nc != nil { nc.Close() } } @@ -3201,3 +3201,34 @@ func traceFirstResponseByte(trace *httptrace.ClientTrace) { trace.GotFirstResponseByte() } } + +func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool { + return trace != nil && trace.WroteHeaderField != nil +} + +func traceWroteHeaderField(trace *httptrace.ClientTrace, k, v string) { + if trace != nil && trace.WroteHeaderField != nil { + trace.WroteHeaderField(k, []string{v}) + } +} + +func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error { + if trace != nil { + return trace.Got1xxResponse + } + return nil +} + +// dialTLSWithContext uses tls.Dialer, added in Go 1.15, to open a TLS +// connection. +func (t *Transport) dialTLSWithContext(ctx context.Context, network, addr string, cfg *tls.Config) (*tls.Conn, error) { + dialer := &tls.Dialer{ + Config: cfg, + } + cn, err := dialer.DialContext(ctx, network, addr) + if err != nil { + return nil, err + } + tlsCn := cn.(*tls.Conn) // DialContext comment promises this will always succeed + return tlsCn, nil +} diff --git a/vendor/golang.org/x/net/idna/go118.go b/vendor/golang.org/x/net/idna/go118.go index c5c4338db..712f1ad83 100644 --- a/vendor/golang.org/x/net/idna/go118.go +++ b/vendor/golang.org/x/net/idna/go118.go @@ -5,7 +5,6 @@ // license that can be found in the LICENSE file. //go:build go1.18 -// +build go1.18 package idna diff --git a/vendor/golang.org/x/net/idna/idna10.0.0.go b/vendor/golang.org/x/net/idna/idna10.0.0.go index 64ccf85fe..7b3717884 100644 --- a/vendor/golang.org/x/net/idna/idna10.0.0.go +++ b/vendor/golang.org/x/net/idna/idna10.0.0.go @@ -5,7 +5,6 @@ // license that can be found in the LICENSE file. //go:build go1.10 -// +build go1.10 // Package idna implements IDNA2008 using the compatibility processing // defined by UTS (Unicode Technical Standard) #46, which defines a standard to diff --git a/vendor/golang.org/x/net/idna/idna9.0.0.go b/vendor/golang.org/x/net/idna/idna9.0.0.go index ee1698cef..cc6a892a4 100644 --- a/vendor/golang.org/x/net/idna/idna9.0.0.go +++ b/vendor/golang.org/x/net/idna/idna9.0.0.go @@ -5,7 +5,6 @@ // license that can be found in the LICENSE file. //go:build !go1.10 -// +build !go1.10 // Package idna implements IDNA2008 using the compatibility processing // defined by UTS (Unicode Technical Standard) #46, which defines a standard to diff --git a/vendor/golang.org/x/net/idna/pre_go118.go b/vendor/golang.org/x/net/idna/pre_go118.go index 3aaccab1c..40e74bb3d 100644 --- a/vendor/golang.org/x/net/idna/pre_go118.go +++ b/vendor/golang.org/x/net/idna/pre_go118.go @@ -5,7 +5,6 @@ // license that can be found in the LICENSE file. //go:build !go1.18 -// +build !go1.18 package idna diff --git a/vendor/golang.org/x/net/idna/tables10.0.0.go b/vendor/golang.org/x/net/idna/tables10.0.0.go index d1d62ef45..c6c2bf10a 100644 --- a/vendor/golang.org/x/net/idna/tables10.0.0.go +++ b/vendor/golang.org/x/net/idna/tables10.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.10 && !go1.13 -// +build go1.10,!go1.13 package idna diff --git a/vendor/golang.org/x/net/idna/tables11.0.0.go b/vendor/golang.org/x/net/idna/tables11.0.0.go index 167efba71..76789393c 100644 --- a/vendor/golang.org/x/net/idna/tables11.0.0.go +++ b/vendor/golang.org/x/net/idna/tables11.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.13 && !go1.14 -// +build go1.13,!go1.14 package idna diff --git a/vendor/golang.org/x/net/idna/tables12.0.0.go b/vendor/golang.org/x/net/idna/tables12.0.0.go index ab40f7bcc..0600cd2ae 100644 --- a/vendor/golang.org/x/net/idna/tables12.0.0.go +++ b/vendor/golang.org/x/net/idna/tables12.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.14 && !go1.16 -// +build go1.14,!go1.16 package idna diff --git a/vendor/golang.org/x/net/idna/tables13.0.0.go b/vendor/golang.org/x/net/idna/tables13.0.0.go index 66701eadf..2fb768ef6 100644 --- a/vendor/golang.org/x/net/idna/tables13.0.0.go +++ b/vendor/golang.org/x/net/idna/tables13.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.16 && !go1.21 -// +build go1.16,!go1.21 package idna diff --git a/vendor/golang.org/x/net/idna/tables15.0.0.go b/vendor/golang.org/x/net/idna/tables15.0.0.go index 40033778f..5ff05fe1a 100644 --- a/vendor/golang.org/x/net/idna/tables15.0.0.go +++ b/vendor/golang.org/x/net/idna/tables15.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build go1.21 -// +build go1.21 package idna diff --git a/vendor/golang.org/x/net/idna/tables9.0.0.go b/vendor/golang.org/x/net/idna/tables9.0.0.go index 4074b5332..0f25e84ca 100644 --- a/vendor/golang.org/x/net/idna/tables9.0.0.go +++ b/vendor/golang.org/x/net/idna/tables9.0.0.go @@ -1,7 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. //go:build !go1.10 -// +build !go1.10 package idna diff --git a/vendor/golang.org/x/net/idna/trie12.0.0.go b/vendor/golang.org/x/net/idna/trie12.0.0.go index bb63f904b..8a75b9667 100644 --- a/vendor/golang.org/x/net/idna/trie12.0.0.go +++ b/vendor/golang.org/x/net/idna/trie12.0.0.go @@ -5,7 +5,6 @@ // license that can be found in the LICENSE file. //go:build !go1.16 -// +build !go1.16 package idna diff --git a/vendor/golang.org/x/net/idna/trie13.0.0.go b/vendor/golang.org/x/net/idna/trie13.0.0.go index 7d68a8dc1..fa45bb907 100644 --- a/vendor/golang.org/x/net/idna/trie13.0.0.go +++ b/vendor/golang.org/x/net/idna/trie13.0.0.go @@ -5,7 +5,6 @@ // license that can be found in the LICENSE file. //go:build go1.16 -// +build go1.16 package idna diff --git a/vendor/golang.org/x/sync/errgroup/errgroup.go b/vendor/golang.org/x/sync/errgroup/errgroup.go index b18efb743..948a3ee63 100644 --- a/vendor/golang.org/x/sync/errgroup/errgroup.go +++ b/vendor/golang.org/x/sync/errgroup/errgroup.go @@ -4,6 +4,9 @@ // Package errgroup provides synchronization, error propagation, and Context // cancelation for groups of goroutines working on subtasks of a common task. +// +// [errgroup.Group] is related to [sync.WaitGroup] but adds handling of tasks +// returning errors. package errgroup import ( diff --git a/vendor/golang.org/x/sync/errgroup/go120.go b/vendor/golang.org/x/sync/errgroup/go120.go index 7d419d376..f93c740b6 100644 --- a/vendor/golang.org/x/sync/errgroup/go120.go +++ b/vendor/golang.org/x/sync/errgroup/go120.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build go1.20 -// +build go1.20 package errgroup diff --git a/vendor/golang.org/x/sync/errgroup/pre_go120.go b/vendor/golang.org/x/sync/errgroup/pre_go120.go index 1795c18ac..88ce33434 100644 --- a/vendor/golang.org/x/sync/errgroup/pre_go120.go +++ b/vendor/golang.org/x/sync/errgroup/pre_go120.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !go1.20 -// +build !go1.20 package errgroup diff --git a/vendor/golang.org/x/sys/execabs/execabs.go b/vendor/golang.org/x/sys/execabs/execabs.go deleted file mode 100644 index 3bf40fdfe..000000000 --- a/vendor/golang.org/x/sys/execabs/execabs.go +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package execabs is a drop-in replacement for os/exec -// that requires PATH lookups to find absolute paths. -// That is, execabs.Command("cmd") runs the same PATH lookup -// as exec.Command("cmd"), but if the result is a path -// which is relative, the Run and Start methods will report -// an error instead of running the executable. -// -// See https://blog.golang.org/path-security for more information -// about when it may be necessary or appropriate to use this package. -package execabs - -import ( - "context" - "fmt" - "os/exec" - "path/filepath" - "reflect" - "unsafe" -) - -// ErrNotFound is the error resulting if a path search failed to find an executable file. -// It is an alias for exec.ErrNotFound. -var ErrNotFound = exec.ErrNotFound - -// Cmd represents an external command being prepared or run. -// It is an alias for exec.Cmd. -type Cmd = exec.Cmd - -// Error is returned by LookPath when it fails to classify a file as an executable. -// It is an alias for exec.Error. -type Error = exec.Error - -// An ExitError reports an unsuccessful exit by a command. -// It is an alias for exec.ExitError. -type ExitError = exec.ExitError - -func relError(file, path string) error { - return fmt.Errorf("%s resolves to executable in current directory (.%c%s)", file, filepath.Separator, path) -} - -// LookPath searches for an executable named file in the directories -// named by the PATH environment variable. If file contains a slash, -// it is tried directly and the PATH is not consulted. The result will be -// an absolute path. -// -// LookPath differs from exec.LookPath in its handling of PATH lookups, -// which are used for file names without slashes. If exec.LookPath's -// PATH lookup would have returned an executable from the current directory, -// LookPath instead returns an error. -func LookPath(file string) (string, error) { - path, err := exec.LookPath(file) - if err != nil && !isGo119ErrDot(err) { - return "", err - } - if filepath.Base(file) == file && !filepath.IsAbs(path) { - return "", relError(file, path) - } - return path, nil -} - -func fixCmd(name string, cmd *exec.Cmd) { - if filepath.Base(name) == name && !filepath.IsAbs(cmd.Path) && !isGo119ErrFieldSet(cmd) { - // exec.Command was called with a bare binary name and - // exec.LookPath returned a path which is not absolute. - // Set cmd.lookPathErr and clear cmd.Path so that it - // cannot be run. - lookPathErr := (*error)(unsafe.Pointer(reflect.ValueOf(cmd).Elem().FieldByName("lookPathErr").Addr().Pointer())) - if *lookPathErr == nil { - *lookPathErr = relError(name, cmd.Path) - } - cmd.Path = "" - } -} - -// CommandContext is like Command but includes a context. -// -// The provided context is used to kill the process (by calling os.Process.Kill) -// if the context becomes done before the command completes on its own. -func CommandContext(ctx context.Context, name string, arg ...string) *exec.Cmd { - cmd := exec.CommandContext(ctx, name, arg...) - fixCmd(name, cmd) - return cmd - -} - -// Command returns the Cmd struct to execute the named program with the given arguments. -// See exec.Command for most details. -// -// Command differs from exec.Command in its handling of PATH lookups, -// which are used when the program name contains no slashes. -// If exec.Command would have returned an exec.Cmd configured to run an -// executable from the current directory, Command instead -// returns an exec.Cmd that will return an error from Start or Run. -func Command(name string, arg ...string) *exec.Cmd { - cmd := exec.Command(name, arg...) - fixCmd(name, cmd) - return cmd -} diff --git a/vendor/golang.org/x/sys/execabs/execabs_go118.go b/vendor/golang.org/x/sys/execabs/execabs_go118.go deleted file mode 100644 index 5627d70e3..000000000 --- a/vendor/golang.org/x/sys/execabs/execabs_go118.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2022 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !go1.19 - -package execabs - -import "os/exec" - -func isGo119ErrDot(err error) bool { - return false -} - -func isGo119ErrFieldSet(cmd *exec.Cmd) bool { - return false -} diff --git a/vendor/golang.org/x/sys/execabs/execabs_go119.go b/vendor/golang.org/x/sys/execabs/execabs_go119.go deleted file mode 100644 index d60ab1b41..000000000 --- a/vendor/golang.org/x/sys/execabs/execabs_go119.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build go1.19 - -package execabs - -import ( - "errors" - "os/exec" -) - -func isGo119ErrDot(err error) bool { - return errors.Is(err, exec.ErrDot) -} - -func isGo119ErrFieldSet(cmd *exec.Cmd) bool { - return cmd.Err != nil -} diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index c6492020e..fdcaa974d 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -584,7 +584,7 @@ ccflags="$@" $2 ~ /^KEY_(SPEC|REQKEY_DEFL)_/ || $2 ~ /^KEYCTL_/ || $2 ~ /^PERF_/ || - $2 ~ /^SECCOMP_MODE_/ || + $2 ~ /^SECCOMP_/ || $2 ~ /^SEEK_/ || $2 ~ /^SCHED_/ || $2 ~ /^SPLICE_/ || diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go index a5d3ff8df..36bf8399f 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -1785,6 +1785,8 @@ const ( LANDLOCK_ACCESS_FS_REMOVE_FILE = 0x20 LANDLOCK_ACCESS_FS_TRUNCATE = 0x4000 LANDLOCK_ACCESS_FS_WRITE_FILE = 0x2 + LANDLOCK_ACCESS_NET_BIND_TCP = 0x1 + LANDLOCK_ACCESS_NET_CONNECT_TCP = 0x2 LANDLOCK_CREATE_RULESET_VERSION = 0x1 LINUX_REBOOT_CMD_CAD_OFF = 0x0 LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef @@ -2465,6 +2467,7 @@ const ( PR_MCE_KILL_GET = 0x22 PR_MCE_KILL_LATE = 0x0 PR_MCE_KILL_SET = 0x1 + PR_MDWE_NO_INHERIT = 0x2 PR_MDWE_REFUSE_EXEC_GAIN = 0x1 PR_MPX_DISABLE_MANAGEMENT = 0x2c PR_MPX_ENABLE_MANAGEMENT = 0x2b @@ -2669,8 +2672,9 @@ const ( RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 - RTAX_FEATURE_MASK = 0xf + RTAX_FEATURE_MASK = 0x1f RTAX_FEATURE_SACK = 0x2 + RTAX_FEATURE_TCP_USEC_TS = 0x10 RTAX_FEATURE_TIMESTAMP = 0x4 RTAX_HOPLIMIT = 0xa RTAX_INITCWND = 0xb @@ -2913,9 +2917,38 @@ const ( SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x1d SC_LOG_FLUSH = 0x100000 + SECCOMP_ADDFD_FLAG_SEND = 0x2 + SECCOMP_ADDFD_FLAG_SETFD = 0x1 + SECCOMP_FILTER_FLAG_LOG = 0x2 + SECCOMP_FILTER_FLAG_NEW_LISTENER = 0x8 + SECCOMP_FILTER_FLAG_SPEC_ALLOW = 0x4 + SECCOMP_FILTER_FLAG_TSYNC = 0x1 + SECCOMP_FILTER_FLAG_TSYNC_ESRCH = 0x10 + SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV = 0x20 + SECCOMP_GET_ACTION_AVAIL = 0x2 + SECCOMP_GET_NOTIF_SIZES = 0x3 + SECCOMP_IOCTL_NOTIF_RECV = 0xc0502100 + SECCOMP_IOCTL_NOTIF_SEND = 0xc0182101 + SECCOMP_IOC_MAGIC = '!' SECCOMP_MODE_DISABLED = 0x0 SECCOMP_MODE_FILTER = 0x2 SECCOMP_MODE_STRICT = 0x1 + SECCOMP_RET_ACTION = 0x7fff0000 + SECCOMP_RET_ACTION_FULL = 0xffff0000 + SECCOMP_RET_ALLOW = 0x7fff0000 + SECCOMP_RET_DATA = 0xffff + SECCOMP_RET_ERRNO = 0x50000 + SECCOMP_RET_KILL = 0x0 + SECCOMP_RET_KILL_PROCESS = 0x80000000 + SECCOMP_RET_KILL_THREAD = 0x0 + SECCOMP_RET_LOG = 0x7ffc0000 + SECCOMP_RET_TRACE = 0x7ff00000 + SECCOMP_RET_TRAP = 0x30000 + SECCOMP_RET_USER_NOTIF = 0x7fc00000 + SECCOMP_SET_MODE_FILTER = 0x1 + SECCOMP_SET_MODE_STRICT = 0x0 + SECCOMP_USER_NOTIF_FD_SYNC_WAKE_UP = 0x1 + SECCOMP_USER_NOTIF_FLAG_CONTINUE = 0x1 SECRETMEM_MAGIC = 0x5345434d SECURITYFS_MAGIC = 0x73636673 SEEK_CUR = 0x1 @@ -3075,6 +3108,7 @@ const ( SOL_TIPC = 0x10f SOL_TLS = 0x11a SOL_UDP = 0x11 + SOL_VSOCK = 0x11f SOL_X25 = 0x106 SOL_XDP = 0x11b SOMAXCONN = 0x1000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index 4920821cf..42ff8c3c1 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -281,6 +281,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x40082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x40082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x800 SIOCATMARK = 0x8905 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index a0c1e4112..dca436004 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -282,6 +282,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x40082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x40082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x800 SIOCATMARK = 0x8905 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index c63985560..5cca668ac 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -288,6 +288,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x40082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x40082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x800 SIOCATMARK = 0x8905 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index 47cc62e25..d8cae6d15 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -278,6 +278,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x40082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x40082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x800 SIOCATMARK = 0x8905 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go index 27ac4a09e..28e39afdc 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go @@ -275,6 +275,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x40082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x40082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x800 SIOCATMARK = 0x8905 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index 54694642a..cd66e92cb 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -281,6 +281,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x80 SIOCATMARK = 0x40047307 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index 3adb81d75..c1595eba7 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -281,6 +281,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x80 SIOCATMARK = 0x40047307 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index 2dfe98f0d..ee9456b0d 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -281,6 +281,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x80 SIOCATMARK = 0x40047307 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index f5398f84f..8cfca81e1 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -281,6 +281,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x80 SIOCATMARK = 0x40047307 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go index c54f152d6..60b0deb3a 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go @@ -336,6 +336,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x800 SIOCATMARK = 0x8905 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index 76057dc72..f90aa7281 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -340,6 +340,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x800 SIOCATMARK = 0x8905 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index e0c3725e2..ba9e01503 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -340,6 +340,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x800 SIOCATMARK = 0x8905 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index 18f2813ed..07cdfd6e9 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -272,6 +272,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x40082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x40082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x800 SIOCATMARK = 0x8905 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index 11619d4ec..2f1dd214a 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -344,6 +344,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x40082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x40082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x800 SIOCATMARK = 0x8905 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index 396d994da..f40519d90 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -335,6 +335,9 @@ const ( SCM_TIMESTAMPNS = 0x21 SCM_TXTIME = 0x3f SCM_WIFI_STATUS = 0x25 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104 SFD_CLOEXEC = 0x400000 SFD_NONBLOCK = 0x4000 SF_FP = 0x38 diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go index fcf3ecbdd..0cc3ce496 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go @@ -448,4 +448,8 @@ const ( SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 + SYS_FUTEX_WAKE = 454 + SYS_FUTEX_WAIT = 455 + SYS_FUTEX_REQUEUE = 456 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go index f56dc2504..856d92d69 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go @@ -371,4 +371,7 @@ const ( SYS_CACHESTAT = 451 SYS_FCHMODAT2 = 452 SYS_MAP_SHADOW_STACK = 453 + SYS_FUTEX_WAKE = 454 + SYS_FUTEX_WAIT = 455 + SYS_FUTEX_REQUEUE = 456 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go index 974bf2467..8d467094c 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go @@ -412,4 +412,8 @@ const ( SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 + SYS_FUTEX_WAKE = 454 + SYS_FUTEX_WAIT = 455 + SYS_FUTEX_REQUEUE = 456 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go index 39a2739e2..edc173244 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go @@ -315,4 +315,8 @@ const ( SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 + SYS_FUTEX_WAKE = 454 + SYS_FUTEX_WAIT = 455 + SYS_FUTEX_REQUEUE = 456 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go index cf9c9d77e..445eba206 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go @@ -309,4 +309,8 @@ const ( SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 + SYS_FUTEX_WAKE = 454 + SYS_FUTEX_WAIT = 455 + SYS_FUTEX_REQUEUE = 456 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go index 10b7362ef..adba01bca 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go @@ -432,4 +432,8 @@ const ( SYS_SET_MEMPOLICY_HOME_NODE = 4450 SYS_CACHESTAT = 4451 SYS_FCHMODAT2 = 4452 + SYS_MAP_SHADOW_STACK = 4453 + SYS_FUTEX_WAKE = 4454 + SYS_FUTEX_WAIT = 4455 + SYS_FUTEX_REQUEUE = 4456 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go index cd4d8b4fd..014c4e9c7 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go @@ -362,4 +362,8 @@ const ( SYS_SET_MEMPOLICY_HOME_NODE = 5450 SYS_CACHESTAT = 5451 SYS_FCHMODAT2 = 5452 + SYS_MAP_SHADOW_STACK = 5453 + SYS_FUTEX_WAKE = 5454 + SYS_FUTEX_WAIT = 5455 + SYS_FUTEX_REQUEUE = 5456 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go index 2c0efca81..ccc97d74d 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go @@ -362,4 +362,8 @@ const ( SYS_SET_MEMPOLICY_HOME_NODE = 5450 SYS_CACHESTAT = 5451 SYS_FCHMODAT2 = 5452 + SYS_MAP_SHADOW_STACK = 5453 + SYS_FUTEX_WAKE = 5454 + SYS_FUTEX_WAIT = 5455 + SYS_FUTEX_REQUEUE = 5456 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go index a72e31d39..ec2b64a95 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go @@ -432,4 +432,8 @@ const ( SYS_SET_MEMPOLICY_HOME_NODE = 4450 SYS_CACHESTAT = 4451 SYS_FCHMODAT2 = 4452 + SYS_MAP_SHADOW_STACK = 4453 + SYS_FUTEX_WAKE = 4454 + SYS_FUTEX_WAIT = 4455 + SYS_FUTEX_REQUEUE = 4456 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go index c7d1e3747..21a839e33 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go @@ -439,4 +439,8 @@ const ( SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 + SYS_FUTEX_WAKE = 454 + SYS_FUTEX_WAIT = 455 + SYS_FUTEX_REQUEUE = 456 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go index f4d4838c8..c11121ec3 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go @@ -411,4 +411,8 @@ const ( SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 + SYS_FUTEX_WAKE = 454 + SYS_FUTEX_WAIT = 455 + SYS_FUTEX_REQUEUE = 456 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go index b64f0e591..909b631fc 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go @@ -411,4 +411,8 @@ const ( SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 + SYS_FUTEX_WAKE = 454 + SYS_FUTEX_WAIT = 455 + SYS_FUTEX_REQUEUE = 456 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go index 95711195a..e49bed16e 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go @@ -316,4 +316,8 @@ const ( SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 + SYS_FUTEX_WAKE = 454 + SYS_FUTEX_WAIT = 455 + SYS_FUTEX_REQUEUE = 456 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go index f94e943bc..66017d2d3 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go @@ -377,4 +377,8 @@ const ( SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 + SYS_FUTEX_WAKE = 454 + SYS_FUTEX_WAIT = 455 + SYS_FUTEX_REQUEUE = 456 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go index ba0c2bc51..47bab18dc 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go @@ -390,4 +390,8 @@ const ( SYS_SET_MEMPOLICY_HOME_NODE = 450 SYS_CACHESTAT = 451 SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 + SYS_FUTEX_WAKE = 454 + SYS_FUTEX_WAIT = 455 + SYS_FUTEX_REQUEUE = 456 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go index bbf8399ff..dc0c955ee 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -174,7 +174,8 @@ type FscryptPolicyV2 struct { Contents_encryption_mode uint8 Filenames_encryption_mode uint8 Flags uint8 - _ [4]uint8 + Log2_data_unit_size uint8 + _ [3]uint8 Master_key_identifier [16]uint8 } @@ -455,60 +456,63 @@ type Ucred struct { } type TCPInfo struct { - State uint8 - Ca_state uint8 - Retransmits uint8 - Probes uint8 - Backoff uint8 - Options uint8 - Rto uint32 - Ato uint32 - Snd_mss uint32 - Rcv_mss uint32 - Unacked uint32 - Sacked uint32 - Lost uint32 - Retrans uint32 - Fackets uint32 - Last_data_sent uint32 - Last_ack_sent uint32 - Last_data_recv uint32 - Last_ack_recv uint32 - Pmtu uint32 - Rcv_ssthresh uint32 - Rtt uint32 - Rttvar uint32 - Snd_ssthresh uint32 - Snd_cwnd uint32 - Advmss uint32 - Reordering uint32 - Rcv_rtt uint32 - Rcv_space uint32 - Total_retrans uint32 - Pacing_rate uint64 - Max_pacing_rate uint64 - Bytes_acked uint64 - Bytes_received uint64 - Segs_out uint32 - Segs_in uint32 - Notsent_bytes uint32 - Min_rtt uint32 - Data_segs_in uint32 - Data_segs_out uint32 - Delivery_rate uint64 - Busy_time uint64 - Rwnd_limited uint64 - Sndbuf_limited uint64 - Delivered uint32 - Delivered_ce uint32 - Bytes_sent uint64 - Bytes_retrans uint64 - Dsack_dups uint32 - Reord_seen uint32 - Rcv_ooopack uint32 - Snd_wnd uint32 - Rcv_wnd uint32 - Rehash uint32 + State uint8 + Ca_state uint8 + Retransmits uint8 + Probes uint8 + Backoff uint8 + Options uint8 + Rto uint32 + Ato uint32 + Snd_mss uint32 + Rcv_mss uint32 + Unacked uint32 + Sacked uint32 + Lost uint32 + Retrans uint32 + Fackets uint32 + Last_data_sent uint32 + Last_ack_sent uint32 + Last_data_recv uint32 + Last_ack_recv uint32 + Pmtu uint32 + Rcv_ssthresh uint32 + Rtt uint32 + Rttvar uint32 + Snd_ssthresh uint32 + Snd_cwnd uint32 + Advmss uint32 + Reordering uint32 + Rcv_rtt uint32 + Rcv_space uint32 + Total_retrans uint32 + Pacing_rate uint64 + Max_pacing_rate uint64 + Bytes_acked uint64 + Bytes_received uint64 + Segs_out uint32 + Segs_in uint32 + Notsent_bytes uint32 + Min_rtt uint32 + Data_segs_in uint32 + Data_segs_out uint32 + Delivery_rate uint64 + Busy_time uint64 + Rwnd_limited uint64 + Sndbuf_limited uint64 + Delivered uint32 + Delivered_ce uint32 + Bytes_sent uint64 + Bytes_retrans uint64 + Dsack_dups uint32 + Reord_seen uint32 + Rcv_ooopack uint32 + Snd_wnd uint32 + Rcv_wnd uint32 + Rehash uint32 + Total_rto uint16 + Total_rto_recoveries uint16 + Total_rto_time uint32 } type CanFilter struct { @@ -551,7 +555,7 @@ const ( SizeofIPv6MTUInfo = 0x20 SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc - SizeofTCPInfo = 0xf0 + SizeofTCPInfo = 0xf8 SizeofCanFilter = 0x8 SizeofTCPRepairOpt = 0x8 ) @@ -3399,7 +3403,7 @@ const ( DEVLINK_PORT_FN_ATTR_STATE = 0x2 DEVLINK_PORT_FN_ATTR_OPSTATE = 0x3 DEVLINK_PORT_FN_ATTR_CAPS = 0x4 - DEVLINK_PORT_FUNCTION_ATTR_MAX = 0x4 + DEVLINK_PORT_FUNCTION_ATTR_MAX = 0x5 ) type FsverityDigest struct { @@ -4183,7 +4187,8 @@ const ( ) type LandlockRulesetAttr struct { - Access_fs uint64 + Access_fs uint64 + Access_net uint64 } type LandlockPathBeneathAttr struct { @@ -5134,7 +5139,7 @@ const ( NL80211_FREQUENCY_ATTR_GO_CONCURRENT = 0xf NL80211_FREQUENCY_ATTR_INDOOR_ONLY = 0xe NL80211_FREQUENCY_ATTR_IR_CONCURRENT = 0xf - NL80211_FREQUENCY_ATTR_MAX = 0x1b + NL80211_FREQUENCY_ATTR_MAX = 0x1c NL80211_FREQUENCY_ATTR_MAX_TX_POWER = 0x6 NL80211_FREQUENCY_ATTR_NO_10MHZ = 0x11 NL80211_FREQUENCY_ATTR_NO_160MHZ = 0xc @@ -5547,7 +5552,7 @@ const ( NL80211_REGDOM_TYPE_CUSTOM_WORLD = 0x2 NL80211_REGDOM_TYPE_INTERSECTION = 0x3 NL80211_REGDOM_TYPE_WORLD = 0x1 - NL80211_REG_RULE_ATTR_MAX = 0x7 + NL80211_REG_RULE_ATTR_MAX = 0x8 NL80211_REKEY_DATA_AKM = 0x4 NL80211_REKEY_DATA_KCK = 0x2 NL80211_REKEY_DATA_KEK = 0x1 diff --git a/vendor/golang.org/x/sys/windows/env_windows.go b/vendor/golang.org/x/sys/windows/env_windows.go index b8ad19250..d4577a423 100644 --- a/vendor/golang.org/x/sys/windows/env_windows.go +++ b/vendor/golang.org/x/sys/windows/env_windows.go @@ -37,14 +37,17 @@ func (token Token) Environ(inheritExisting bool) (env []string, err error) { return nil, err } defer DestroyEnvironmentBlock(block) - blockp := unsafe.Pointer(block) - for { - entry := UTF16PtrToString((*uint16)(blockp)) - if len(entry) == 0 { - break + size := unsafe.Sizeof(*block) + for *block != 0 { + // find NUL terminator + end := unsafe.Pointer(block) + for *(*uint16)(end) != 0 { + end = unsafe.Add(end, size) } - env = append(env, entry) - blockp = unsafe.Add(blockp, 2*(len(entry)+1)) + + entry := unsafe.Slice(block, (uintptr(end)-uintptr(unsafe.Pointer(block)))/size) + env = append(env, UTF16ToString(entry)) + block = (*uint16)(unsafe.Add(end, size)) } return env, nil } diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go index ffb8708cc..6395a031d 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -125,8 +125,7 @@ func UTF16PtrToString(p *uint16) string { for ptr := unsafe.Pointer(p); *(*uint16)(ptr) != 0; n++ { ptr = unsafe.Pointer(uintptr(ptr) + unsafe.Sizeof(*p)) } - - return string(utf16.Decode(unsafe.Slice(p, n))) + return UTF16ToString(unsafe.Slice(p, n)) } func Getpagesize() int { return 4096 } diff --git a/vendor/golang.org/x/tools/go/ast/astutil/enclosing.go b/vendor/golang.org/x/tools/go/ast/astutil/enclosing.go index 9fa5aa192..2c4c4e232 100644 --- a/vendor/golang.org/x/tools/go/ast/astutil/enclosing.go +++ b/vendor/golang.org/x/tools/go/ast/astutil/enclosing.go @@ -11,8 +11,6 @@ import ( "go/ast" "go/token" "sort" - - "golang.org/x/tools/internal/typeparams" ) // PathEnclosingInterval returns the node that encloses the source @@ -322,7 +320,7 @@ func childrenOf(n ast.Node) []ast.Node { children = append(children, n.Recv) } children = append(children, n.Name) - if tparams := typeparams.ForFuncType(n.Type); tparams != nil { + if tparams := n.Type.TypeParams; tparams != nil { children = append(children, tparams) } if n.Type.Params != nil { @@ -377,7 +375,7 @@ func childrenOf(n ast.Node) []ast.Node { tok(n.Lbrack, len("[")), tok(n.Rbrack, len("]"))) - case *typeparams.IndexListExpr: + case *ast.IndexListExpr: children = append(children, tok(n.Lbrack, len("[")), tok(n.Rbrack, len("]"))) @@ -588,7 +586,7 @@ func NodeDescription(n ast.Node) string { return "decrement statement" case *ast.IndexExpr: return "index expression" - case *typeparams.IndexListExpr: + case *ast.IndexListExpr: return "index list expression" case *ast.InterfaceType: return "interface type" diff --git a/vendor/golang.org/x/tools/go/ast/astutil/rewrite.go b/vendor/golang.org/x/tools/go/ast/astutil/rewrite.go index f430b21b9..58934f766 100644 --- a/vendor/golang.org/x/tools/go/ast/astutil/rewrite.go +++ b/vendor/golang.org/x/tools/go/ast/astutil/rewrite.go @@ -9,8 +9,6 @@ import ( "go/ast" "reflect" "sort" - - "golang.org/x/tools/internal/typeparams" ) // An ApplyFunc is invoked by Apply for each node n, even if n is nil, @@ -252,7 +250,7 @@ func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast. a.apply(n, "X", nil, n.X) a.apply(n, "Index", nil, n.Index) - case *typeparams.IndexListExpr: + case *ast.IndexListExpr: a.apply(n, "X", nil, n.X) a.applyList(n, "Indices") @@ -293,7 +291,7 @@ func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast. a.apply(n, "Fields", nil, n.Fields) case *ast.FuncType: - if tparams := typeparams.ForFuncType(n); tparams != nil { + if tparams := n.TypeParams; tparams != nil { a.apply(n, "TypeParams", nil, tparams) } a.apply(n, "Params", nil, n.Params) @@ -408,7 +406,7 @@ func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast. case *ast.TypeSpec: a.apply(n, "Doc", nil, n.Doc) a.apply(n, "Name", nil, n.Name) - if tparams := typeparams.ForTypeSpec(n); tparams != nil { + if tparams := n.TypeParams; tparams != nil { a.apply(n, "TypeParams", nil, tparams) } a.apply(n, "Type", nil, n.Type) diff --git a/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go b/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go index 165ede0f8..03543bd4b 100644 --- a/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go +++ b/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go @@ -128,15 +128,14 @@ func Read(in io.Reader, fset *token.FileSet, imports map[string]*types.Package, // (from "version"). Select appropriate importer. if len(data) > 0 { switch data[0] { - case 'i': - _, pkg, err := gcimporter.IImportData(fset, imports, data[1:], path) - return pkg, err + case 'v', 'c', 'd': // binary, till go1.10 + return nil, fmt.Errorf("binary (%c) import format is no longer supported", data[0]) - case 'v', 'c', 'd': - _, pkg, err := gcimporter.BImportData(fset, imports, data, path) + case 'i': // indexed, till go1.19 + _, pkg, err := gcimporter.IImportData(fset, imports, data[1:], path) return pkg, err - case 'u': + case 'u': // unified, from go1.20 _, pkg, err := gcimporter.UImportData(fset, imports, data[1:], path) return pkg, err diff --git a/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go b/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go index 18a002f82..333676b7c 100644 --- a/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go +++ b/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go @@ -8,42 +8,46 @@ package packagesdriver import ( "context" "fmt" - "go/types" "strings" "golang.org/x/tools/internal/gocommand" ) -var debug = false - -func GetSizesGolist(ctx context.Context, inv gocommand.Invocation, gocmdRunner *gocommand.Runner) (types.Sizes, error) { +func GetSizesForArgsGolist(ctx context.Context, inv gocommand.Invocation, gocmdRunner *gocommand.Runner) (string, string, error) { inv.Verb = "list" inv.Args = []string{"-f", "{{context.GOARCH}} {{context.Compiler}}", "--", "unsafe"} stdout, stderr, friendlyErr, rawErr := gocmdRunner.RunRaw(ctx, inv) var goarch, compiler string if rawErr != nil { - if rawErrMsg := rawErr.Error(); strings.Contains(rawErrMsg, "cannot find main module") || strings.Contains(rawErrMsg, "go.mod file not found") { - // User's running outside of a module. All bets are off. Get GOARCH and guess compiler is gc. + rawErrMsg := rawErr.Error() + if strings.Contains(rawErrMsg, "cannot find main module") || + strings.Contains(rawErrMsg, "go.mod file not found") { + // User's running outside of a module. + // All bets are off. Get GOARCH and guess compiler is gc. // TODO(matloob): Is this a problem in practice? inv.Verb = "env" inv.Args = []string{"GOARCH"} envout, enverr := gocmdRunner.Run(ctx, inv) if enverr != nil { - return nil, enverr + return "", "", enverr } goarch = strings.TrimSpace(envout.String()) compiler = "gc" + } else if friendlyErr != nil { + return "", "", friendlyErr } else { - return nil, friendlyErr + // This should be unreachable, but be defensive + // in case RunRaw's error results are inconsistent. + return "", "", rawErr } } else { fields := strings.Fields(stdout.String()) if len(fields) < 2 { - return nil, fmt.Errorf("could not parse GOARCH and Go compiler in format \" \":\nstdout: <<%s>>\nstderr: <<%s>>", + return "", "", fmt.Errorf("could not parse GOARCH and Go compiler in format \" \":\nstdout: <<%s>>\nstderr: <<%s>>", stdout.String(), stderr.String()) } goarch = fields[0] compiler = fields[1] } - return types.SizesFor(compiler, goarch), nil + return compiler, goarch, nil } diff --git a/vendor/golang.org/x/tools/go/packages/doc.go b/vendor/golang.org/x/tools/go/packages/doc.go index da4ab89fe..b2a0b7c6a 100644 --- a/vendor/golang.org/x/tools/go/packages/doc.go +++ b/vendor/golang.org/x/tools/go/packages/doc.go @@ -5,12 +5,32 @@ /* Package packages loads Go packages for inspection and analysis. -The Load function takes as input a list of patterns and return a list of Package -structs describing individual packages matched by those patterns. -The LoadMode controls the amount of detail in the loaded packages. - -Load passes most patterns directly to the underlying build tool, -but all patterns with the prefix "query=", where query is a +The [Load] function takes as input a list of patterns and returns a +list of [Package] values describing individual packages matched by those +patterns. +A [Config] specifies configuration options, the most important of which is +the [LoadMode], which controls the amount of detail in the loaded packages. + +Load passes most patterns directly to the underlying build tool. +The default build tool is the go command. +Its supported patterns are described at +https://pkg.go.dev/cmd/go#hdr-Package_lists_and_patterns. + +Load may be used in Go projects that use alternative build systems, by +installing an appropriate "driver" program for the build system and +specifying its location in the GOPACKAGESDRIVER environment variable. +For example, +https://github.com/bazelbuild/rules_go/wiki/Editor-and-tool-integration +explains how to use the driver for Bazel. +The driver program is responsible for interpreting patterns in its +preferred notation and reporting information about the packages that +they identify. +(See driverRequest and driverResponse types for the JSON +schema used by the protocol. +Though the protocol is supported, these types are currently unexported; +see #64608 for a proposal to publish them.) + +Regardless of driver, all patterns with the prefix "query=", where query is a non-empty string of letters from [a-z], are reserved and may be interpreted as query operators. @@ -35,7 +55,7 @@ The Package struct provides basic information about the package, including - Imports, a map from source import strings to the Packages they name; - Types, the type information for the package's exported symbols; - Syntax, the parsed syntax trees for the package's source code; and - - TypeInfo, the result of a complete type-check of the package syntax trees. + - TypesInfo, the result of a complete type-check of the package syntax trees. (See the documentation for type Package for the complete list of fields and more detailed descriptions.) @@ -64,7 +84,7 @@ reported about the loaded packages. See the documentation for type LoadMode for details. Most tools should pass their command-line arguments (after any flags) -uninterpreted to the loader, so that the loader can interpret them +uninterpreted to [Load], so that it can interpret them according to the conventions of the underlying build system. See the Example function for typical usage. */ diff --git a/vendor/golang.org/x/tools/go/packages/external.go b/vendor/golang.org/x/tools/go/packages/external.go index 7242a0a7d..7db1d1293 100644 --- a/vendor/golang.org/x/tools/go/packages/external.go +++ b/vendor/golang.org/x/tools/go/packages/external.go @@ -12,8 +12,8 @@ import ( "bytes" "encoding/json" "fmt" - exec "golang.org/x/sys/execabs" "os" + "os/exec" "strings" ) diff --git a/vendor/golang.org/x/tools/go/packages/golist.go b/vendor/golang.org/x/tools/go/packages/golist.go index 6bb7168d2..cd375fbc3 100644 --- a/vendor/golang.org/x/tools/go/packages/golist.go +++ b/vendor/golang.org/x/tools/go/packages/golist.go @@ -9,10 +9,9 @@ import ( "context" "encoding/json" "fmt" - "go/types" - "io/ioutil" "log" "os" + "os/exec" "path" "path/filepath" "reflect" @@ -22,7 +21,6 @@ import ( "sync" "unicode" - exec "golang.org/x/sys/execabs" "golang.org/x/tools/go/internal/packagesdriver" "golang.org/x/tools/internal/gocommand" "golang.org/x/tools/internal/packagesinternal" @@ -153,10 +151,10 @@ func goListDriver(cfg *Config, patterns ...string) (*driverResponse, error) { if cfg.Mode&NeedTypesSizes != 0 || cfg.Mode&NeedTypes != 0 { sizeswg.Add(1) go func() { - var sizes types.Sizes - sizes, sizeserr = packagesdriver.GetSizesGolist(ctx, state.cfgInvocation(), cfg.gocmdRunner) - // types.SizesFor always returns nil or a *types.StdSizes. - response.dr.Sizes, _ = sizes.(*types.StdSizes) + compiler, arch, err := packagesdriver.GetSizesForArgsGolist(ctx, state.cfgInvocation(), cfg.gocmdRunner) + sizeserr = err + response.dr.Compiler = compiler + response.dr.Arch = arch sizeswg.Done() }() } @@ -210,62 +208,6 @@ extractQueries: } } - // Only use go/packages' overlay processing if we're using a Go version - // below 1.16. Otherwise, go list handles it. - if goVersion, err := state.getGoVersion(); err == nil && goVersion < 16 { - modifiedPkgs, needPkgs, err := state.processGolistOverlay(response) - if err != nil { - return nil, err - } - - var containsCandidates []string - if len(containFiles) > 0 { - containsCandidates = append(containsCandidates, modifiedPkgs...) - containsCandidates = append(containsCandidates, needPkgs...) - } - if err := state.addNeededOverlayPackages(response, needPkgs); err != nil { - return nil, err - } - // Check candidate packages for containFiles. - if len(containFiles) > 0 { - for _, id := range containsCandidates { - pkg, ok := response.seenPackages[id] - if !ok { - response.addPackage(&Package{ - ID: id, - Errors: []Error{{ - Kind: ListError, - Msg: fmt.Sprintf("package %s expected but not seen", id), - }}, - }) - continue - } - for _, f := range containFiles { - for _, g := range pkg.GoFiles { - if sameFile(f, g) { - response.addRoot(id) - } - } - } - } - } - // Add root for any package that matches a pattern. This applies only to - // packages that are modified by overlays, since they are not added as - // roots automatically. - for _, pattern := range restPatterns { - match := matchPattern(pattern) - for _, pkgID := range modifiedPkgs { - pkg, ok := response.seenPackages[pkgID] - if !ok { - continue - } - if match(pkg.PkgPath) { - response.addRoot(pkg.ID) - } - } - } - } - sizeswg.Wait() if sizeserr != nil { return nil, sizeserr @@ -273,24 +215,6 @@ extractQueries: return response.dr, nil } -func (state *golistState) addNeededOverlayPackages(response *responseDeduper, pkgs []string) error { - if len(pkgs) == 0 { - return nil - } - dr, err := state.createDriverResponse(pkgs...) - if err != nil { - return err - } - for _, pkg := range dr.Packages { - response.addPackage(pkg) - } - _, needPkgs, err := state.processGolistOverlay(response) - if err != nil { - return err - } - return state.addNeededOverlayPackages(response, needPkgs) -} - func (state *golistState) runContainsQueries(response *responseDeduper, queries []string) error { for _, query := range queries { // TODO(matloob): Do only one query per directory. @@ -625,7 +549,12 @@ func (state *golistState) createDriverResponse(words ...string) (*driverResponse } if pkg.PkgPath == "unsafe" { - pkg.GoFiles = nil // ignore fake unsafe.go file + pkg.CompiledGoFiles = nil // ignore fake unsafe.go file (#59929) + } else if len(pkg.CompiledGoFiles) == 0 { + // Work around for pre-go.1.11 versions of go list. + // TODO(matloob): they should be handled by the fallback. + // Can we delete this? + pkg.CompiledGoFiles = pkg.GoFiles } // Assume go list emits only absolute paths for Dir. @@ -663,16 +592,12 @@ func (state *golistState) createDriverResponse(words ...string) (*driverResponse response.Roots = append(response.Roots, pkg.ID) } - // Work around for pre-go.1.11 versions of go list. - // TODO(matloob): they should be handled by the fallback. - // Can we delete this? - if len(pkg.CompiledGoFiles) == 0 { - pkg.CompiledGoFiles = pkg.GoFiles - } - // Temporary work-around for golang/go#39986. Parse filenames out of // error messages. This happens if there are unrecoverable syntax // errors in the source, so we can't match on a specific error message. + // + // TODO(rfindley): remove this heuristic, in favor of considering + // InvalidGoFiles from the list driver. if err := p.Error; err != nil && state.shouldAddFilenameFromError(p) { addFilenameFromPos := func(pos string) bool { split := strings.Split(pos, ":") @@ -891,6 +816,15 @@ func golistargs(cfg *Config, words []string, goVersion int) []string { // probably because you'd just get the TestMain. fmt.Sprintf("-find=%t", !cfg.Tests && cfg.Mode&findFlags == 0 && !usesExportData(cfg)), } + + // golang/go#60456: with go1.21 and later, go list serves pgo variants, which + // can be costly to compute and may result in redundant processing for the + // caller. Disable these variants. If someone wants to add e.g. a NeedPGO + // mode flag, that should be a separate proposal. + if goVersion >= 21 { + fullargs = append(fullargs, "-pgo=off") + } + fullargs = append(fullargs, cfg.BuildFlags...) fullargs = append(fullargs, "--") fullargs = append(fullargs, words...) @@ -1100,7 +1034,7 @@ func (state *golistState) writeOverlays() (filename string, cleanup func(), err if len(state.cfg.Overlay) == 0 { return "", func() {}, nil } - dir, err := ioutil.TempDir("", "gopackages-*") + dir, err := os.MkdirTemp("", "gopackages-*") if err != nil { return "", nil, err } @@ -1119,7 +1053,7 @@ func (state *golistState) writeOverlays() (filename string, cleanup func(), err // Create a unique filename for the overlaid files, to avoid // creating nested directories. noSeparator := strings.Join(strings.Split(filepath.ToSlash(k), "/"), "") - f, err := ioutil.TempFile(dir, fmt.Sprintf("*-%s", noSeparator)) + f, err := os.CreateTemp(dir, fmt.Sprintf("*-%s", noSeparator)) if err != nil { return "", func() {}, err } @@ -1137,7 +1071,7 @@ func (state *golistState) writeOverlays() (filename string, cleanup func(), err } // Write out the overlay file that contains the filepath mappings. filename = filepath.Join(dir, "overlay.json") - if err := ioutil.WriteFile(filename, b, 0665); err != nil { + if err := os.WriteFile(filename, b, 0665); err != nil { return "", func() {}, err } return filename, cleanup, nil diff --git a/vendor/golang.org/x/tools/go/packages/golist_overlay.go b/vendor/golang.org/x/tools/go/packages/golist_overlay.go index 9576b472f..d823c474a 100644 --- a/vendor/golang.org/x/tools/go/packages/golist_overlay.go +++ b/vendor/golang.org/x/tools/go/packages/golist_overlay.go @@ -6,314 +6,11 @@ package packages import ( "encoding/json" - "fmt" - "go/parser" - "go/token" - "os" "path/filepath" - "regexp" - "sort" - "strconv" - "strings" "golang.org/x/tools/internal/gocommand" ) -// processGolistOverlay provides rudimentary support for adding -// files that don't exist on disk to an overlay. The results can be -// sometimes incorrect. -// TODO(matloob): Handle unsupported cases, including the following: -// - determining the correct package to add given a new import path -func (state *golistState) processGolistOverlay(response *responseDeduper) (modifiedPkgs, needPkgs []string, err error) { - havePkgs := make(map[string]string) // importPath -> non-test package ID - needPkgsSet := make(map[string]bool) - modifiedPkgsSet := make(map[string]bool) - - pkgOfDir := make(map[string][]*Package) - for _, pkg := range response.dr.Packages { - // This is an approximation of import path to id. This can be - // wrong for tests, vendored packages, and a number of other cases. - havePkgs[pkg.PkgPath] = pkg.ID - dir, err := commonDir(pkg.GoFiles) - if err != nil { - return nil, nil, err - } - if dir != "" { - pkgOfDir[dir] = append(pkgOfDir[dir], pkg) - } - } - - // If no new imports are added, it is safe to avoid loading any needPkgs. - // Otherwise, it's hard to tell which package is actually being loaded - // (due to vendoring) and whether any modified package will show up - // in the transitive set of dependencies (because new imports are added, - // potentially modifying the transitive set of dependencies). - var overlayAddsImports bool - - // If both a package and its test package are created by the overlay, we - // need the real package first. Process all non-test files before test - // files, and make the whole process deterministic while we're at it. - var overlayFiles []string - for opath := range state.cfg.Overlay { - overlayFiles = append(overlayFiles, opath) - } - sort.Slice(overlayFiles, func(i, j int) bool { - iTest := strings.HasSuffix(overlayFiles[i], "_test.go") - jTest := strings.HasSuffix(overlayFiles[j], "_test.go") - if iTest != jTest { - return !iTest // non-tests are before tests. - } - return overlayFiles[i] < overlayFiles[j] - }) - for _, opath := range overlayFiles { - contents := state.cfg.Overlay[opath] - base := filepath.Base(opath) - dir := filepath.Dir(opath) - var pkg *Package // if opath belongs to both a package and its test variant, this will be the test variant - var testVariantOf *Package // if opath is a test file, this is the package it is testing - var fileExists bool - isTestFile := strings.HasSuffix(opath, "_test.go") - pkgName, ok := extractPackageName(opath, contents) - if !ok { - // Don't bother adding a file that doesn't even have a parsable package statement - // to the overlay. - continue - } - // If all the overlay files belong to a different package, change the - // package name to that package. - maybeFixPackageName(pkgName, isTestFile, pkgOfDir[dir]) - nextPackage: - for _, p := range response.dr.Packages { - if pkgName != p.Name && p.ID != "command-line-arguments" { - continue - } - for _, f := range p.GoFiles { - if !sameFile(filepath.Dir(f), dir) { - continue - } - // Make sure to capture information on the package's test variant, if needed. - if isTestFile && !hasTestFiles(p) { - // TODO(matloob): Are there packages other than the 'production' variant - // of a package that this can match? This shouldn't match the test main package - // because the file is generated in another directory. - testVariantOf = p - continue nextPackage - } else if !isTestFile && hasTestFiles(p) { - // We're examining a test variant, but the overlaid file is - // a non-test file. Because the overlay implementation - // (currently) only adds a file to one package, skip this - // package, so that we can add the file to the production - // variant of the package. (https://golang.org/issue/36857 - // tracks handling overlays on both the production and test - // variant of a package). - continue nextPackage - } - if pkg != nil && p != pkg && pkg.PkgPath == p.PkgPath { - // We have already seen the production version of the - // for which p is a test variant. - if hasTestFiles(p) { - testVariantOf = pkg - } - } - pkg = p - if filepath.Base(f) == base { - fileExists = true - } - } - } - // The overlay could have included an entirely new package or an - // ad-hoc package. An ad-hoc package is one that we have manually - // constructed from inadequate `go list` results for a file= query. - // It will have the ID command-line-arguments. - if pkg == nil || pkg.ID == "command-line-arguments" { - // Try to find the module or gopath dir the file is contained in. - // Then for modules, add the module opath to the beginning. - pkgPath, ok, err := state.getPkgPath(dir) - if err != nil { - return nil, nil, err - } - if !ok { - break - } - var forTest string // only set for x tests - isXTest := strings.HasSuffix(pkgName, "_test") - if isXTest { - forTest = pkgPath - pkgPath += "_test" - } - id := pkgPath - if isTestFile { - if isXTest { - id = fmt.Sprintf("%s [%s.test]", pkgPath, forTest) - } else { - id = fmt.Sprintf("%s [%s.test]", pkgPath, pkgPath) - } - } - if pkg != nil { - // TODO(rstambler): We should change the package's path and ID - // here. The only issue is that this messes with the roots. - } else { - // Try to reclaim a package with the same ID, if it exists in the response. - for _, p := range response.dr.Packages { - if reclaimPackage(p, id, opath, contents) { - pkg = p - break - } - } - // Otherwise, create a new package. - if pkg == nil { - pkg = &Package{ - PkgPath: pkgPath, - ID: id, - Name: pkgName, - Imports: make(map[string]*Package), - } - response.addPackage(pkg) - havePkgs[pkg.PkgPath] = id - // Add the production package's sources for a test variant. - if isTestFile && !isXTest && testVariantOf != nil { - pkg.GoFiles = append(pkg.GoFiles, testVariantOf.GoFiles...) - pkg.CompiledGoFiles = append(pkg.CompiledGoFiles, testVariantOf.CompiledGoFiles...) - // Add the package under test and its imports to the test variant. - pkg.forTest = testVariantOf.PkgPath - for k, v := range testVariantOf.Imports { - pkg.Imports[k] = &Package{ID: v.ID} - } - } - if isXTest { - pkg.forTest = forTest - } - } - } - } - if !fileExists { - pkg.GoFiles = append(pkg.GoFiles, opath) - // TODO(matloob): Adding the file to CompiledGoFiles can exhibit the wrong behavior - // if the file will be ignored due to its build tags. - pkg.CompiledGoFiles = append(pkg.CompiledGoFiles, opath) - modifiedPkgsSet[pkg.ID] = true - } - imports, err := extractImports(opath, contents) - if err != nil { - // Let the parser or type checker report errors later. - continue - } - for _, imp := range imports { - // TODO(rstambler): If the package is an x test and the import has - // a test variant, make sure to replace it. - if _, found := pkg.Imports[imp]; found { - continue - } - overlayAddsImports = true - id, ok := havePkgs[imp] - if !ok { - var err error - id, err = state.resolveImport(dir, imp) - if err != nil { - return nil, nil, err - } - } - pkg.Imports[imp] = &Package{ID: id} - // Add dependencies to the non-test variant version of this package as well. - if testVariantOf != nil { - testVariantOf.Imports[imp] = &Package{ID: id} - } - } - } - - // toPkgPath guesses the package path given the id. - toPkgPath := func(sourceDir, id string) (string, error) { - if i := strings.IndexByte(id, ' '); i >= 0 { - return state.resolveImport(sourceDir, id[:i]) - } - return state.resolveImport(sourceDir, id) - } - - // Now that new packages have been created, do another pass to determine - // the new set of missing packages. - for _, pkg := range response.dr.Packages { - for _, imp := range pkg.Imports { - if len(pkg.GoFiles) == 0 { - return nil, nil, fmt.Errorf("cannot resolve imports for package %q with no Go files", pkg.PkgPath) - } - pkgPath, err := toPkgPath(filepath.Dir(pkg.GoFiles[0]), imp.ID) - if err != nil { - return nil, nil, err - } - if _, ok := havePkgs[pkgPath]; !ok { - needPkgsSet[pkgPath] = true - } - } - } - - if overlayAddsImports { - needPkgs = make([]string, 0, len(needPkgsSet)) - for pkg := range needPkgsSet { - needPkgs = append(needPkgs, pkg) - } - } - modifiedPkgs = make([]string, 0, len(modifiedPkgsSet)) - for pkg := range modifiedPkgsSet { - modifiedPkgs = append(modifiedPkgs, pkg) - } - return modifiedPkgs, needPkgs, err -} - -// resolveImport finds the ID of a package given its import path. -// In particular, it will find the right vendored copy when in GOPATH mode. -func (state *golistState) resolveImport(sourceDir, importPath string) (string, error) { - env, err := state.getEnv() - if err != nil { - return "", err - } - if env["GOMOD"] != "" { - return importPath, nil - } - - searchDir := sourceDir - for { - vendorDir := filepath.Join(searchDir, "vendor") - exists, ok := state.vendorDirs[vendorDir] - if !ok { - info, err := os.Stat(vendorDir) - exists = err == nil && info.IsDir() - state.vendorDirs[vendorDir] = exists - } - - if exists { - vendoredPath := filepath.Join(vendorDir, importPath) - if info, err := os.Stat(vendoredPath); err == nil && info.IsDir() { - // We should probably check for .go files here, but shame on anyone who fools us. - path, ok, err := state.getPkgPath(vendoredPath) - if err != nil { - return "", err - } - if ok { - return path, nil - } - } - } - - // We know we've hit the top of the filesystem when we Dir / and get /, - // or C:\ and get C:\, etc. - next := filepath.Dir(searchDir) - if next == searchDir { - break - } - searchDir = next - } - return importPath, nil -} - -func hasTestFiles(p *Package) bool { - for _, f := range p.GoFiles { - if strings.HasSuffix(f, "_test.go") { - return true - } - } - return false -} - // determineRootDirs returns a mapping from absolute directories that could // contain code to their corresponding import path prefixes. func (state *golistState) determineRootDirs() (map[string]string, error) { @@ -384,192 +81,3 @@ func (state *golistState) determineRootDirsGOPATH() (map[string]string, error) { } return m, nil } - -func extractImports(filename string, contents []byte) ([]string, error) { - f, err := parser.ParseFile(token.NewFileSet(), filename, contents, parser.ImportsOnly) // TODO(matloob): reuse fileset? - if err != nil { - return nil, err - } - var res []string - for _, imp := range f.Imports { - quotedPath := imp.Path.Value - path, err := strconv.Unquote(quotedPath) - if err != nil { - return nil, err - } - res = append(res, path) - } - return res, nil -} - -// reclaimPackage attempts to reuse a package that failed to load in an overlay. -// -// If the package has errors and has no Name, GoFiles, or Imports, -// then it's possible that it doesn't yet exist on disk. -func reclaimPackage(pkg *Package, id string, filename string, contents []byte) bool { - // TODO(rstambler): Check the message of the actual error? - // It differs between $GOPATH and module mode. - if pkg.ID != id { - return false - } - if len(pkg.Errors) != 1 { - return false - } - if pkg.Name != "" || pkg.ExportFile != "" { - return false - } - if len(pkg.GoFiles) > 0 || len(pkg.CompiledGoFiles) > 0 || len(pkg.OtherFiles) > 0 { - return false - } - if len(pkg.Imports) > 0 { - return false - } - pkgName, ok := extractPackageName(filename, contents) - if !ok { - return false - } - pkg.Name = pkgName - pkg.Errors = nil - return true -} - -func extractPackageName(filename string, contents []byte) (string, bool) { - // TODO(rstambler): Check the message of the actual error? - // It differs between $GOPATH and module mode. - f, err := parser.ParseFile(token.NewFileSet(), filename, contents, parser.PackageClauseOnly) // TODO(matloob): reuse fileset? - if err != nil { - return "", false - } - return f.Name.Name, true -} - -// commonDir returns the directory that all files are in, "" if files is empty, -// or an error if they aren't in the same directory. -func commonDir(files []string) (string, error) { - seen := make(map[string]bool) - for _, f := range files { - seen[filepath.Dir(f)] = true - } - if len(seen) > 1 { - return "", fmt.Errorf("files (%v) are in more than one directory: %v", files, seen) - } - for k := range seen { - // seen has only one element; return it. - return k, nil - } - return "", nil // no files -} - -// It is possible that the files in the disk directory dir have a different package -// name from newName, which is deduced from the overlays. If they all have a different -// package name, and they all have the same package name, then that name becomes -// the package name. -// It returns true if it changes the package name, false otherwise. -func maybeFixPackageName(newName string, isTestFile bool, pkgsOfDir []*Package) { - names := make(map[string]int) - for _, p := range pkgsOfDir { - names[p.Name]++ - } - if len(names) != 1 { - // some files are in different packages - return - } - var oldName string - for k := range names { - oldName = k - } - if newName == oldName { - return - } - // We might have a case where all of the package names in the directory are - // the same, but the overlay file is for an x test, which belongs to its - // own package. If the x test does not yet exist on disk, we may not yet - // have its package name on disk, but we should not rename the packages. - // - // We use a heuristic to determine if this file belongs to an x test: - // The test file should have a package name whose package name has a _test - // suffix or looks like "newName_test". - maybeXTest := strings.HasPrefix(oldName+"_test", newName) || strings.HasSuffix(newName, "_test") - if isTestFile && maybeXTest { - return - } - for _, p := range pkgsOfDir { - p.Name = newName - } -} - -// This function is copy-pasted from -// https://github.com/golang/go/blob/9706f510a5e2754595d716bd64be8375997311fb/src/cmd/go/internal/search/search.go#L360. -// It should be deleted when we remove support for overlays from go/packages. -// -// NOTE: This does not handle any ./... or ./ style queries, as this function -// doesn't know the working directory. -// -// matchPattern(pattern)(name) reports whether -// name matches pattern. Pattern is a limited glob -// pattern in which '...' means 'any string' and there -// is no other special syntax. -// Unfortunately, there are two special cases. Quoting "go help packages": -// -// First, /... at the end of the pattern can match an empty string, -// so that net/... matches both net and packages in its subdirectories, like net/http. -// Second, any slash-separated pattern element containing a wildcard never -// participates in a match of the "vendor" element in the path of a vendored -// package, so that ./... does not match packages in subdirectories of -// ./vendor or ./mycode/vendor, but ./vendor/... and ./mycode/vendor/... do. -// Note, however, that a directory named vendor that itself contains code -// is not a vendored package: cmd/vendor would be a command named vendor, -// and the pattern cmd/... matches it. -func matchPattern(pattern string) func(name string) bool { - // Convert pattern to regular expression. - // The strategy for the trailing /... is to nest it in an explicit ? expression. - // The strategy for the vendor exclusion is to change the unmatchable - // vendor strings to a disallowed code point (vendorChar) and to use - // "(anything but that codepoint)*" as the implementation of the ... wildcard. - // This is a bit complicated but the obvious alternative, - // namely a hand-written search like in most shell glob matchers, - // is too easy to make accidentally exponential. - // Using package regexp guarantees linear-time matching. - - const vendorChar = "\x00" - - if strings.Contains(pattern, vendorChar) { - return func(name string) bool { return false } - } - - re := regexp.QuoteMeta(pattern) - re = replaceVendor(re, vendorChar) - switch { - case strings.HasSuffix(re, `/`+vendorChar+`/\.\.\.`): - re = strings.TrimSuffix(re, `/`+vendorChar+`/\.\.\.`) + `(/vendor|/` + vendorChar + `/\.\.\.)` - case re == vendorChar+`/\.\.\.`: - re = `(/vendor|/` + vendorChar + `/\.\.\.)` - case strings.HasSuffix(re, `/\.\.\.`): - re = strings.TrimSuffix(re, `/\.\.\.`) + `(/\.\.\.)?` - } - re = strings.ReplaceAll(re, `\.\.\.`, `[^`+vendorChar+`]*`) - - reg := regexp.MustCompile(`^` + re + `$`) - - return func(name string) bool { - if strings.Contains(name, vendorChar) { - return false - } - return reg.MatchString(replaceVendor(name, vendorChar)) - } -} - -// replaceVendor returns the result of replacing -// non-trailing vendor path elements in x with repl. -func replaceVendor(x, repl string) string { - if !strings.Contains(x, "vendor") { - return x - } - elem := strings.Split(x, "/") - for i := 0; i < len(elem)-1; i++ { - if elem[i] == "vendor" { - elem[i] = repl - } - } - return strings.Join(elem, "/") -} diff --git a/vendor/golang.org/x/tools/go/packages/packages.go b/vendor/golang.org/x/tools/go/packages/packages.go index 0f1505b80..81e9e6a72 100644 --- a/vendor/golang.org/x/tools/go/packages/packages.go +++ b/vendor/golang.org/x/tools/go/packages/packages.go @@ -16,7 +16,6 @@ import ( "go/token" "go/types" "io" - "io/ioutil" "log" "os" "path/filepath" @@ -28,8 +27,8 @@ import ( "golang.org/x/tools/go/gcexportdata" "golang.org/x/tools/internal/gocommand" "golang.org/x/tools/internal/packagesinternal" - "golang.org/x/tools/internal/typeparams" "golang.org/x/tools/internal/typesinternal" + "golang.org/x/tools/internal/versions" ) // A LoadMode controls the amount of detail to return when loading. @@ -220,8 +219,10 @@ type driverResponse struct { // lists of multiple drivers, go/packages will fall back to the next driver. NotHandled bool - // Sizes, if not nil, is the types.Sizes to use when type checking. - Sizes *types.StdSizes + // Compiler and Arch are the arguments pass of types.SizesFor + // to get a types.Sizes to use when type checking. + Compiler string + Arch string // Roots is the set of package IDs that make up the root packages. // We have to encode this separately because when we encode a single package @@ -257,31 +258,52 @@ type driverResponse struct { // proceeding with further analysis. The PrintErrors function is // provided for convenient display of all errors. func Load(cfg *Config, patterns ...string) ([]*Package, error) { - l := newLoader(cfg) - response, err := defaultDriver(&l.Config, patterns...) + ld := newLoader(cfg) + response, external, err := defaultDriver(&ld.Config, patterns...) if err != nil { return nil, err } - l.sizes = response.Sizes - return l.refine(response) + + ld.sizes = types.SizesFor(response.Compiler, response.Arch) + if ld.sizes == nil && ld.Config.Mode&(NeedTypes|NeedTypesSizes|NeedTypesInfo) != 0 { + // Type size information is needed but unavailable. + if external { + // An external driver may fail to populate the Compiler/GOARCH fields, + // especially since they are relatively new (see #63700). + // Provide a sensible fallback in this case. + ld.sizes = types.SizesFor("gc", runtime.GOARCH) + if ld.sizes == nil { // gccgo-only arch + ld.sizes = types.SizesFor("gc", "amd64") + } + } else { + // Go list should never fail to deliver accurate size information. + // Reject the whole Load since the error is the same for every package. + return nil, fmt.Errorf("can't determine type sizes for compiler %q on GOARCH %q", + response.Compiler, response.Arch) + } + } + + return ld.refine(response) } // defaultDriver is a driver that implements go/packages' fallback behavior. // It will try to request to an external driver, if one exists. If there's // no external driver, or the driver returns a response with NotHandled set, // defaultDriver will fall back to the go list driver. -func defaultDriver(cfg *Config, patterns ...string) (*driverResponse, error) { - driver := findExternalDriver(cfg) - if driver == nil { - driver = goListDriver - } - response, err := driver(cfg, patterns...) - if err != nil { - return response, err - } else if response.NotHandled { - return goListDriver(cfg, patterns...) +// The boolean result indicates that an external driver handled the request. +func defaultDriver(cfg *Config, patterns ...string) (*driverResponse, bool, error) { + if driver := findExternalDriver(cfg); driver != nil { + response, err := driver(cfg, patterns...) + if err != nil { + return nil, false, err + } else if !response.NotHandled { + return response, true, nil + } + // (fall through) } - return response, nil + + response, err := goListDriver(cfg, patterns...) + return response, false, err } // A Package describes a loaded Go package. @@ -308,6 +330,9 @@ type Package struct { TypeErrors []types.Error // GoFiles lists the absolute file paths of the package's Go source files. + // It may include files that should not be compiled, for example because + // they contain non-matching build tags, are documentary pseudo-files such as + // unsafe/unsafe.go or builtin/builtin.go, or are subject to cgo preprocessing. GoFiles []string // CompiledGoFiles lists the absolute file paths of the package's source @@ -407,12 +432,6 @@ func init() { packagesinternal.GetDepsErrors = func(p interface{}) []*packagesinternal.PackageError { return p.(*Package).depsErrors } - packagesinternal.GetGoCmdRunner = func(config interface{}) *gocommand.Runner { - return config.(*Config).gocmdRunner - } - packagesinternal.SetGoCmdRunner = func(config interface{}, runner *gocommand.Runner) { - config.(*Config).gocmdRunner = runner - } packagesinternal.SetModFile = func(config interface{}, value string) { config.(*Config).modFile = value } @@ -549,7 +568,7 @@ type loaderPackage struct { type loader struct { pkgs map[string]*loaderPackage Config - sizes types.Sizes + sizes types.Sizes // non-nil if needed by mode parseCache map[string]*parseValue parseCacheMu sync.Mutex exportMu sync.Mutex // enforces mutual exclusion of exportdata operations @@ -627,7 +646,7 @@ func newLoader(cfg *Config) *loader { return ld } -// refine connects the supplied packages into a graph and then adds type and +// refine connects the supplied packages into a graph and then adds type // and syntax information as requested by the LoadMode. func (ld *loader) refine(response *driverResponse) ([]*Package, error) { roots := response.Roots @@ -674,39 +693,38 @@ func (ld *loader) refine(response *driverResponse) ([]*Package, error) { } } - // Materialize the import graph. - - const ( - white = 0 // new - grey = 1 // in progress - black = 2 // complete - ) - - // visit traverses the import graph, depth-first, - // and materializes the graph as Packages.Imports. - // - // Valid imports are saved in the Packages.Import map. - // Invalid imports (cycles and missing nodes) are saved in the importErrors map. - // Thus, even in the presence of both kinds of errors, the Import graph remains a DAG. - // - // visit returns whether the package needs src or has a transitive - // dependency on a package that does. These are the only packages - // for which we load source code. - var stack []*loaderPackage - var visit func(lpkg *loaderPackage) bool - var srcPkgs []*loaderPackage - visit = func(lpkg *loaderPackage) bool { - switch lpkg.color { - case black: - return lpkg.needsrc - case grey: - panic("internal error: grey node") - } - lpkg.color = grey - stack = append(stack, lpkg) // push - stubs := lpkg.Imports // the structure form has only stubs with the ID in the Imports - // If NeedImports isn't set, the imports fields will all be zeroed out. - if ld.Mode&NeedImports != 0 { + if ld.Mode&NeedImports != 0 { + // Materialize the import graph. + + const ( + white = 0 // new + grey = 1 // in progress + black = 2 // complete + ) + + // visit traverses the import graph, depth-first, + // and materializes the graph as Packages.Imports. + // + // Valid imports are saved in the Packages.Import map. + // Invalid imports (cycles and missing nodes) are saved in the importErrors map. + // Thus, even in the presence of both kinds of errors, + // the Import graph remains a DAG. + // + // visit returns whether the package needs src or has a transitive + // dependency on a package that does. These are the only packages + // for which we load source code. + var stack []*loaderPackage + var visit func(lpkg *loaderPackage) bool + visit = func(lpkg *loaderPackage) bool { + switch lpkg.color { + case black: + return lpkg.needsrc + case grey: + panic("internal error: grey node") + } + lpkg.color = grey + stack = append(stack, lpkg) // push + stubs := lpkg.Imports // the structure form has only stubs with the ID in the Imports lpkg.Imports = make(map[string]*Package, len(stubs)) for importPath, ipkg := range stubs { var importErr error @@ -730,40 +748,39 @@ func (ld *loader) refine(response *driverResponse) ([]*Package, error) { } lpkg.Imports[importPath] = imp.Package } - } - if lpkg.needsrc { - srcPkgs = append(srcPkgs, lpkg) - } - if ld.Mode&NeedTypesSizes != 0 { - lpkg.TypesSizes = ld.sizes - } - stack = stack[:len(stack)-1] // pop - lpkg.color = black - return lpkg.needsrc - } + // Complete type information is required for the + // immediate dependencies of each source package. + if lpkg.needsrc && ld.Mode&NeedTypes != 0 { + for _, ipkg := range lpkg.Imports { + ld.pkgs[ipkg.ID].needtypes = true + } + } - if ld.Mode&NeedImports == 0 { - // We do this to drop the stub import packages that we are not even going to try to resolve. - for _, lpkg := range initial { - lpkg.Imports = nil + // NeedTypeSizes causes TypeSizes to be set even + // on packages for which types aren't needed. + if ld.Mode&NeedTypesSizes != 0 { + lpkg.TypesSizes = ld.sizes + } + stack = stack[:len(stack)-1] // pop + lpkg.color = black + + return lpkg.needsrc } - } else { + // For each initial package, create its import DAG. for _, lpkg := range initial { visit(lpkg) } - } - if ld.Mode&NeedImports != 0 && ld.Mode&NeedTypes != 0 { - for _, lpkg := range srcPkgs { - // Complete type information is required for the - // immediate dependencies of each source package. - for _, ipkg := range lpkg.Imports { - imp := ld.pkgs[ipkg.ID] - imp.needtypes = true - } + + } else { + // !NeedImports: drop the stub (ID-only) import packages + // that we are not even going to try to resolve. + for _, lpkg := range initial { + lpkg.Imports = nil } } + // Load type data and syntax if needed, starting at // the initial packages (roots of the import DAG). if ld.Mode&NeedTypes != 0 || ld.Mode&NeedSyntax != 0 { @@ -997,10 +1014,11 @@ func (ld *loader) loadPackage(lpkg *loaderPackage) { Defs: make(map[*ast.Ident]types.Object), Uses: make(map[*ast.Ident]types.Object), Implicits: make(map[ast.Node]types.Object), + Instances: make(map[*ast.Ident]types.Instance), Scopes: make(map[ast.Node]*types.Scope), Selections: make(map[*ast.SelectorExpr]*types.Selection), } - typeparams.InitInstanceInfo(lpkg.TypesInfo) + versions.InitFileVersions(lpkg.TypesInfo) lpkg.TypesSizes = ld.sizes importer := importerFunc(func(path string) (*types.Package, error) { @@ -1038,7 +1056,10 @@ func (ld *loader) loadPackage(lpkg *loaderPackage) { IgnoreFuncBodies: ld.Mode&NeedDeps == 0 && !lpkg.initial, Error: appendError, - Sizes: ld.sizes, + Sizes: ld.sizes, // may be nil + } + if lpkg.Module != nil && lpkg.Module.GoVersion != "" { + typesinternal.SetGoVersion(tc, "go"+lpkg.Module.GoVersion) } if (ld.Mode & typecheckCgo) != 0 { if !typesinternal.SetUsesCgo(tc) { @@ -1119,7 +1140,7 @@ func (ld *loader) parseFile(filename string) (*ast.File, error) { var err error if src == nil { ioLimit <- true // wait - src, err = ioutil.ReadFile(filename) + src, err = os.ReadFile(filename) <-ioLimit // signal } if err != nil { diff --git a/vendor/golang.org/x/tools/go/types/typeutil/callee.go b/vendor/golang.org/x/tools/go/types/typeutil/callee.go index 90b3ab0e2..90dc541ad 100644 --- a/vendor/golang.org/x/tools/go/types/typeutil/callee.go +++ b/vendor/golang.org/x/tools/go/types/typeutil/callee.go @@ -22,7 +22,7 @@ func Callee(info *types.Info, call *ast.CallExpr) types.Object { // Look through type instantiation if necessary. isInstance := false switch fun.(type) { - case *ast.IndexExpr, *typeparams.IndexListExpr: + case *ast.IndexExpr, *ast.IndexListExpr: // When extracting the callee from an *IndexExpr, we need to check that // it is a *types.Func and not a *types.Var. // Example: Don't match a slice m within the expression `m[0]()`. diff --git a/vendor/golang.org/x/tools/go/types/typeutil/map.go b/vendor/golang.org/x/tools/go/types/typeutil/map.go index 7bd2fdb38..544246dac 100644 --- a/vendor/golang.org/x/tools/go/types/typeutil/map.go +++ b/vendor/golang.org/x/tools/go/types/typeutil/map.go @@ -219,7 +219,7 @@ type Hasher struct { // generic types or functions, and instantiated signatures do not have type // parameter lists, we should never encounter a second non-empty type // parameter list when hashing a generic signature. - sigTParams *typeparams.TypeParamList + sigTParams *types.TypeParamList } // MakeHasher returns a new Hasher instance. @@ -297,7 +297,7 @@ func (h Hasher) hashFor(t types.Type) uint32 { // We should never encounter a generic signature while hashing another // generic signature, but defensively set sigTParams only if h.mask is // unset. - tparams := typeparams.ForSignature(t) + tparams := t.TypeParams() if h.sigTParams == nil && tparams.Len() != 0 { h = Hasher{ // There may be something more efficient than discarding the existing @@ -318,7 +318,7 @@ func (h Hasher) hashFor(t types.Type) uint32 { return hash + 3*h.hashTuple(t.Params()) + 5*h.hashTuple(t.Results()) - case *typeparams.Union: + case *types.Union: return h.hashUnion(t) case *types.Interface: @@ -354,14 +354,14 @@ func (h Hasher) hashFor(t types.Type) uint32 { case *types.Named: hash := h.hashPtr(t.Obj()) - targs := typeparams.NamedTypeArgs(t) + targs := t.TypeArgs() for i := 0; i < targs.Len(); i++ { targ := targs.At(i) hash += 2 * h.Hash(targ) } return hash - case *typeparams.TypeParam: + case *types.TypeParam: return h.hashTypeParam(t) case *types.Tuple: @@ -381,7 +381,7 @@ func (h Hasher) hashTuple(tuple *types.Tuple) uint32 { return hash } -func (h Hasher) hashUnion(t *typeparams.Union) uint32 { +func (h Hasher) hashUnion(t *types.Union) uint32 { // Hash type restrictions. terms, err := typeparams.UnionTermSet(t) // if err != nil t has invalid type restrictions. Fall back on a non-zero @@ -392,7 +392,7 @@ func (h Hasher) hashUnion(t *typeparams.Union) uint32 { return h.hashTermSet(terms) } -func (h Hasher) hashTermSet(terms []*typeparams.Term) uint32 { +func (h Hasher) hashTermSet(terms []*types.Term) uint32 { hash := 9157 + 2*uint32(len(terms)) for _, term := range terms { // term order is not significant. @@ -416,7 +416,7 @@ func (h Hasher) hashTermSet(terms []*typeparams.Term) uint32 { // are not identical. // // Otherwise the hash of t depends only on t's pointer identity. -func (h Hasher) hashTypeParam(t *typeparams.TypeParam) uint32 { +func (h Hasher) hashTypeParam(t *types.TypeParam) uint32 { if h.sigTParams != nil { i := t.Index() if i >= 0 && i < h.sigTParams.Len() && t == h.sigTParams.At(i) { @@ -489,7 +489,7 @@ func (h Hasher) shallowHash(t types.Type) uint32 { case *types.Pointer: return 4393139 - case *typeparams.Union: + case *types.Union: return 562448657 case *types.Interface: @@ -504,7 +504,7 @@ func (h Hasher) shallowHash(t types.Type) uint32 { case *types.Named: return h.hashPtr(t.Obj()) - case *typeparams.TypeParam: + case *types.TypeParam: return h.hashPtr(t.Obj()) } panic(fmt.Sprintf("shallowHash: %T: %v", t, t)) diff --git a/vendor/golang.org/x/tools/imports/forward.go b/vendor/golang.org/x/tools/imports/forward.go index d2547c743..cb6db8893 100644 --- a/vendor/golang.org/x/tools/imports/forward.go +++ b/vendor/golang.org/x/tools/imports/forward.go @@ -7,8 +7,8 @@ package imports // import "golang.org/x/tools/imports" import ( - "io/ioutil" "log" + "os" "golang.org/x/tools/internal/gocommand" intimp "golang.org/x/tools/internal/imports" @@ -44,7 +44,7 @@ var LocalPrefix string func Process(filename string, src []byte, opt *Options) ([]byte, error) { var err error if src == nil { - src, err = ioutil.ReadFile(filename) + src, err = os.ReadFile(filename) if err != nil { return nil, err } diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go deleted file mode 100644 index 798fe599b..000000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package fastwalk provides a faster version of filepath.Walk for file system -// scanning tools. -package fastwalk - -import ( - "errors" - "os" - "path/filepath" - "runtime" - "sync" -) - -// ErrTraverseLink is used as a return value from WalkFuncs to indicate that the -// symlink named in the call may be traversed. -var ErrTraverseLink = errors.New("fastwalk: traverse symlink, assuming target is a directory") - -// ErrSkipFiles is a used as a return value from WalkFuncs to indicate that the -// callback should not be called for any other files in the current directory. -// Child directories will still be traversed. -var ErrSkipFiles = errors.New("fastwalk: skip remaining files in directory") - -// Walk is a faster implementation of filepath.Walk. -// -// filepath.Walk's design necessarily calls os.Lstat on each file, -// even if the caller needs less info. -// Many tools need only the type of each file. -// On some platforms, this information is provided directly by the readdir -// system call, avoiding the need to stat each file individually. -// fastwalk_unix.go contains a fork of the syscall routines. -// -// See golang.org/issue/16399 -// -// Walk walks the file tree rooted at root, calling walkFn for -// each file or directory in the tree, including root. -// -// If fastWalk returns filepath.SkipDir, the directory is skipped. -// -// Unlike filepath.Walk: -// - file stat calls must be done by the user. -// The only provided metadata is the file type, which does not include -// any permission bits. -// - multiple goroutines stat the filesystem concurrently. The provided -// walkFn must be safe for concurrent use. -// - fastWalk can follow symlinks if walkFn returns the TraverseLink -// sentinel error. It is the walkFn's responsibility to prevent -// fastWalk from going into symlink cycles. -func Walk(root string, walkFn func(path string, typ os.FileMode) error) error { - // TODO(bradfitz): make numWorkers configurable? We used a - // minimum of 4 to give the kernel more info about multiple - // things we want, in hopes its I/O scheduling can take - // advantage of that. Hopefully most are in cache. Maybe 4 is - // even too low of a minimum. Profile more. - numWorkers := 4 - if n := runtime.NumCPU(); n > numWorkers { - numWorkers = n - } - - // Make sure to wait for all workers to finish, otherwise - // walkFn could still be called after returning. This Wait call - // runs after close(e.donec) below. - var wg sync.WaitGroup - defer wg.Wait() - - w := &walker{ - fn: walkFn, - enqueuec: make(chan walkItem, numWorkers), // buffered for performance - workc: make(chan walkItem, numWorkers), // buffered for performance - donec: make(chan struct{}), - - // buffered for correctness & not leaking goroutines: - resc: make(chan error, numWorkers), - } - defer close(w.donec) - - for i := 0; i < numWorkers; i++ { - wg.Add(1) - go w.doWork(&wg) - } - todo := []walkItem{{dir: root}} - out := 0 - for { - workc := w.workc - var workItem walkItem - if len(todo) == 0 { - workc = nil - } else { - workItem = todo[len(todo)-1] - } - select { - case workc <- workItem: - todo = todo[:len(todo)-1] - out++ - case it := <-w.enqueuec: - todo = append(todo, it) - case err := <-w.resc: - out-- - if err != nil { - return err - } - if out == 0 && len(todo) == 0 { - // It's safe to quit here, as long as the buffered - // enqueue channel isn't also readable, which might - // happen if the worker sends both another unit of - // work and its result before the other select was - // scheduled and both w.resc and w.enqueuec were - // readable. - select { - case it := <-w.enqueuec: - todo = append(todo, it) - default: - return nil - } - } - } - } -} - -// doWork reads directories as instructed (via workc) and runs the -// user's callback function. -func (w *walker) doWork(wg *sync.WaitGroup) { - defer wg.Done() - for { - select { - case <-w.donec: - return - case it := <-w.workc: - select { - case <-w.donec: - return - case w.resc <- w.walk(it.dir, !it.callbackDone): - } - } - } -} - -type walker struct { - fn func(path string, typ os.FileMode) error - - donec chan struct{} // closed on fastWalk's return - workc chan walkItem // to workers - enqueuec chan walkItem // from workers - resc chan error // from workers -} - -type walkItem struct { - dir string - callbackDone bool // callback already called; don't do it again -} - -func (w *walker) enqueue(it walkItem) { - select { - case w.enqueuec <- it: - case <-w.donec: - } -} - -func (w *walker) onDirEnt(dirName, baseName string, typ os.FileMode) error { - joined := dirName + string(os.PathSeparator) + baseName - if typ == os.ModeDir { - w.enqueue(walkItem{dir: joined}) - return nil - } - - err := w.fn(joined, typ) - if typ == os.ModeSymlink { - if err == ErrTraverseLink { - // Set callbackDone so we don't call it twice for both the - // symlink-as-symlink and the symlink-as-directory later: - w.enqueue(walkItem{dir: joined, callbackDone: true}) - return nil - } - if err == filepath.SkipDir { - // Permit SkipDir on symlinks too. - return nil - } - } - return err -} - -func (w *walker) walk(root string, runUserCallback bool) error { - if runUserCallback { - err := w.fn(root, os.ModeDir) - if err == filepath.SkipDir { - return nil - } - if err != nil { - return err - } - } - - return readDir(root, w.onDirEnt) -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_darwin.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_darwin.go deleted file mode 100644 index 0ca55e0d5..000000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_darwin.go +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright 2022 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build darwin && cgo -// +build darwin,cgo - -package fastwalk - -/* -#include - -// fastwalk_readdir_r wraps readdir_r so that we don't have to pass a dirent** -// result pointer which triggers CGO's "Go pointer to Go pointer" check unless -// we allocat the result dirent* with malloc. -// -// fastwalk_readdir_r returns 0 on success, -1 upon reaching the end of the -// directory, or a positive error number to indicate failure. -static int fastwalk_readdir_r(DIR *fd, struct dirent *entry) { - struct dirent *result; - int ret = readdir_r(fd, entry, &result); - if (ret == 0 && result == NULL) { - ret = -1; // EOF - } - return ret; -} -*/ -import "C" - -import ( - "os" - "syscall" - "unsafe" -) - -func readDir(dirName string, fn func(dirName, entName string, typ os.FileMode) error) error { - fd, err := openDir(dirName) - if err != nil { - return &os.PathError{Op: "opendir", Path: dirName, Err: err} - } - defer C.closedir(fd) - - skipFiles := false - var dirent syscall.Dirent - for { - ret := int(C.fastwalk_readdir_r(fd, (*C.struct_dirent)(unsafe.Pointer(&dirent)))) - if ret != 0 { - if ret == -1 { - break // EOF - } - if ret == int(syscall.EINTR) { - continue - } - return &os.PathError{Op: "readdir", Path: dirName, Err: syscall.Errno(ret)} - } - if dirent.Ino == 0 { - continue - } - typ := dtToType(dirent.Type) - if skipFiles && typ.IsRegular() { - continue - } - name := (*[len(syscall.Dirent{}.Name)]byte)(unsafe.Pointer(&dirent.Name))[:] - name = name[:dirent.Namlen] - for i, c := range name { - if c == 0 { - name = name[:i] - break - } - } - // Check for useless names before allocating a string. - if string(name) == "." || string(name) == ".." { - continue - } - if err := fn(dirName, string(name), typ); err != nil { - if err != ErrSkipFiles { - return err - } - skipFiles = true - } - } - - return nil -} - -func dtToType(typ uint8) os.FileMode { - switch typ { - case syscall.DT_BLK: - return os.ModeDevice - case syscall.DT_CHR: - return os.ModeDevice | os.ModeCharDevice - case syscall.DT_DIR: - return os.ModeDir - case syscall.DT_FIFO: - return os.ModeNamedPipe - case syscall.DT_LNK: - return os.ModeSymlink - case syscall.DT_REG: - return 0 - case syscall.DT_SOCK: - return os.ModeSocket - } - return ^os.FileMode(0) -} - -// openDir wraps opendir(3) and handles any EINTR errors. The returned *DIR -// needs to be closed with closedir(3). -func openDir(path string) (*C.DIR, error) { - name, err := syscall.BytePtrFromString(path) - if err != nil { - return nil, err - } - for { - fd, err := C.opendir((*C.char)(unsafe.Pointer(name))) - if err != syscall.EINTR { - return fd, err - } - } -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_fileno.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_fileno.go deleted file mode 100644 index d58595dbd..000000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_fileno.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build freebsd || openbsd || netbsd -// +build freebsd openbsd netbsd - -package fastwalk - -import "syscall" - -func direntInode(dirent *syscall.Dirent) uint64 { - return uint64(dirent.Fileno) -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_ino.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_ino.go deleted file mode 100644 index d3922890b..000000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_ino.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build (linux || (darwin && !cgo)) && !appengine -// +build linux darwin,!cgo -// +build !appengine - -package fastwalk - -import "syscall" - -func direntInode(dirent *syscall.Dirent) uint64 { - return dirent.Ino -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_bsd.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_bsd.go deleted file mode 100644 index 38a4db6af..000000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_bsd.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build (darwin && !cgo) || freebsd || openbsd || netbsd -// +build darwin,!cgo freebsd openbsd netbsd - -package fastwalk - -import "syscall" - -func direntNamlen(dirent *syscall.Dirent) uint64 { - return uint64(dirent.Namlen) -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux.go deleted file mode 100644 index c82e57df8..000000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build linux && !appengine -// +build linux,!appengine - -package fastwalk - -import ( - "bytes" - "syscall" - "unsafe" -) - -func direntNamlen(dirent *syscall.Dirent) uint64 { - const fixedHdr = uint16(unsafe.Offsetof(syscall.Dirent{}.Name)) - nameBuf := (*[unsafe.Sizeof(dirent.Name)]byte)(unsafe.Pointer(&dirent.Name[0])) - const nameBufLen = uint16(len(nameBuf)) - limit := dirent.Reclen - fixedHdr - if limit > nameBufLen { - limit = nameBufLen - } - nameLen := bytes.IndexByte(nameBuf[:limit], 0) - if nameLen < 0 { - panic("failed to find terminating 0 byte in dirent") - } - return uint64(nameLen) -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_portable.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_portable.go deleted file mode 100644 index 085d31160..000000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_portable.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build appengine || (!linux && !darwin && !freebsd && !openbsd && !netbsd) -// +build appengine !linux,!darwin,!freebsd,!openbsd,!netbsd - -package fastwalk - -import ( - "io/ioutil" - "os" -) - -// readDir calls fn for each directory entry in dirName. -// It does not descend into directories or follow symlinks. -// If fn returns a non-nil error, readDir returns with that error -// immediately. -func readDir(dirName string, fn func(dirName, entName string, typ os.FileMode) error) error { - fis, err := ioutil.ReadDir(dirName) - if err != nil { - return err - } - skipFiles := false - for _, fi := range fis { - if fi.Mode().IsRegular() && skipFiles { - continue - } - if err := fn(dirName, fi.Name(), fi.Mode()&os.ModeType); err != nil { - if err == ErrSkipFiles { - skipFiles = true - continue - } - return err - } - } - return nil -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go deleted file mode 100644 index f12f1a734..000000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build (linux || freebsd || openbsd || netbsd || (darwin && !cgo)) && !appengine -// +build linux freebsd openbsd netbsd darwin,!cgo -// +build !appengine - -package fastwalk - -import ( - "fmt" - "os" - "syscall" - "unsafe" -) - -const blockSize = 8 << 10 - -// unknownFileMode is a sentinel (and bogus) os.FileMode -// value used to represent a syscall.DT_UNKNOWN Dirent.Type. -const unknownFileMode os.FileMode = os.ModeNamedPipe | os.ModeSocket | os.ModeDevice - -func readDir(dirName string, fn func(dirName, entName string, typ os.FileMode) error) error { - fd, err := open(dirName, 0, 0) - if err != nil { - return &os.PathError{Op: "open", Path: dirName, Err: err} - } - defer syscall.Close(fd) - - // The buffer must be at least a block long. - buf := make([]byte, blockSize) // stack-allocated; doesn't escape - bufp := 0 // starting read position in buf - nbuf := 0 // end valid data in buf - skipFiles := false - for { - if bufp >= nbuf { - bufp = 0 - nbuf, err = readDirent(fd, buf) - if err != nil { - return os.NewSyscallError("readdirent", err) - } - if nbuf <= 0 { - return nil - } - } - consumed, name, typ := parseDirEnt(buf[bufp:nbuf]) - bufp += consumed - if name == "" || name == "." || name == ".." { - continue - } - // Fallback for filesystems (like old XFS) that don't - // support Dirent.Type and have DT_UNKNOWN (0) there - // instead. - if typ == unknownFileMode { - fi, err := os.Lstat(dirName + "/" + name) - if err != nil { - // It got deleted in the meantime. - if os.IsNotExist(err) { - continue - } - return err - } - typ = fi.Mode() & os.ModeType - } - if skipFiles && typ.IsRegular() { - continue - } - if err := fn(dirName, name, typ); err != nil { - if err == ErrSkipFiles { - skipFiles = true - continue - } - return err - } - } -} - -func parseDirEnt(buf []byte) (consumed int, name string, typ os.FileMode) { - // golang.org/issue/37269 - dirent := &syscall.Dirent{} - copy((*[unsafe.Sizeof(syscall.Dirent{})]byte)(unsafe.Pointer(dirent))[:], buf) - if v := unsafe.Offsetof(dirent.Reclen) + unsafe.Sizeof(dirent.Reclen); uintptr(len(buf)) < v { - panic(fmt.Sprintf("buf size of %d smaller than dirent header size %d", len(buf), v)) - } - if len(buf) < int(dirent.Reclen) { - panic(fmt.Sprintf("buf size %d < record length %d", len(buf), dirent.Reclen)) - } - consumed = int(dirent.Reclen) - if direntInode(dirent) == 0 { // File absent in directory. - return - } - switch dirent.Type { - case syscall.DT_REG: - typ = 0 - case syscall.DT_DIR: - typ = os.ModeDir - case syscall.DT_LNK: - typ = os.ModeSymlink - case syscall.DT_BLK: - typ = os.ModeDevice - case syscall.DT_FIFO: - typ = os.ModeNamedPipe - case syscall.DT_SOCK: - typ = os.ModeSocket - case syscall.DT_UNKNOWN: - typ = unknownFileMode - default: - // Skip weird things. - // It's probably a DT_WHT (http://lwn.net/Articles/325369/) - // or something. Revisit if/when this package is moved outside - // of goimports. goimports only cares about regular files, - // symlinks, and directories. - return - } - - nameBuf := (*[unsafe.Sizeof(dirent.Name)]byte)(unsafe.Pointer(&dirent.Name[0])) - nameLen := direntNamlen(dirent) - - // Special cases for common things: - if nameLen == 1 && nameBuf[0] == '.' { - name = "." - } else if nameLen == 2 && nameBuf[0] == '.' && nameBuf[1] == '.' { - name = ".." - } else { - name = string(nameBuf[:nameLen]) - } - return -} - -// According to https://golang.org/doc/go1.14#runtime -// A consequence of the implementation of preemption is that on Unix systems, including Linux and macOS -// systems, programs built with Go 1.14 will receive more signals than programs built with earlier releases. -// -// This causes syscall.Open and syscall.ReadDirent sometimes fail with EINTR errors. -// We need to retry in this case. -func open(path string, mode int, perm uint32) (fd int, err error) { - for { - fd, err := syscall.Open(path, mode, perm) - if err != syscall.EINTR { - return fd, err - } - } -} - -func readDirent(fd int, buf []byte) (n int, err error) { - for { - nbuf, err := syscall.ReadDirent(fd, buf) - if err != syscall.EINTR { - return nbuf, err - } - } -} diff --git a/vendor/golang.org/x/tools/internal/gcimporter/bexport.go b/vendor/golang.org/x/tools/internal/gcimporter/bexport.go deleted file mode 100644 index 30582ed6d..000000000 --- a/vendor/golang.org/x/tools/internal/gcimporter/bexport.go +++ /dev/null @@ -1,852 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Binary package export. -// This file was derived from $GOROOT/src/cmd/compile/internal/gc/bexport.go; -// see that file for specification of the format. - -package gcimporter - -import ( - "bytes" - "encoding/binary" - "fmt" - "go/constant" - "go/token" - "go/types" - "math" - "math/big" - "sort" - "strings" -) - -// If debugFormat is set, each integer and string value is preceded by a marker -// and position information in the encoding. This mechanism permits an importer -// to recognize immediately when it is out of sync. The importer recognizes this -// mode automatically (i.e., it can import export data produced with debugging -// support even if debugFormat is not set at the time of import). This mode will -// lead to massively larger export data (by a factor of 2 to 3) and should only -// be enabled during development and debugging. -// -// NOTE: This flag is the first flag to enable if importing dies because of -// (suspected) format errors, and whenever a change is made to the format. -const debugFormat = false // default: false - -// Current export format version. Increase with each format change. -// -// Note: The latest binary (non-indexed) export format is at version 6. -// This exporter is still at level 4, but it doesn't matter since -// the binary importer can handle older versions just fine. -// -// 6: package height (CL 105038) -- NOT IMPLEMENTED HERE -// 5: improved position encoding efficiency (issue 20080, CL 41619) -- NOT IMPLEMENTED HERE -// 4: type name objects support type aliases, uses aliasTag -// 3: Go1.8 encoding (same as version 2, aliasTag defined but never used) -// 2: removed unused bool in ODCL export (compiler only) -// 1: header format change (more regular), export package for _ struct fields -// 0: Go1.7 encoding -const exportVersion = 4 - -// trackAllTypes enables cycle tracking for all types, not just named -// types. The existing compiler invariants assume that unnamed types -// that are not completely set up are not used, or else there are spurious -// errors. -// If disabled, only named types are tracked, possibly leading to slightly -// less efficient encoding in rare cases. It also prevents the export of -// some corner-case type declarations (but those are not handled correctly -// with with the textual export format either). -// TODO(gri) enable and remove once issues caused by it are fixed -const trackAllTypes = false - -type exporter struct { - fset *token.FileSet - out bytes.Buffer - - // object -> index maps, indexed in order of serialization - strIndex map[string]int - pkgIndex map[*types.Package]int - typIndex map[types.Type]int - - // position encoding - posInfoFormat bool - prevFile string - prevLine int - - // debugging support - written int // bytes written - indent int // for trace -} - -// internalError represents an error generated inside this package. -type internalError string - -func (e internalError) Error() string { return "gcimporter: " + string(e) } - -func internalErrorf(format string, args ...interface{}) error { - return internalError(fmt.Sprintf(format, args...)) -} - -// BExportData returns binary export data for pkg. -// If no file set is provided, position info will be missing. -func BExportData(fset *token.FileSet, pkg *types.Package) (b []byte, err error) { - if !debug { - defer func() { - if e := recover(); e != nil { - if ierr, ok := e.(internalError); ok { - err = ierr - return - } - // Not an internal error; panic again. - panic(e) - } - }() - } - - p := exporter{ - fset: fset, - strIndex: map[string]int{"": 0}, // empty string is mapped to 0 - pkgIndex: make(map[*types.Package]int), - typIndex: make(map[types.Type]int), - posInfoFormat: true, // TODO(gri) might become a flag, eventually - } - - // write version info - // The version string must start with "version %d" where %d is the version - // number. Additional debugging information may follow after a blank; that - // text is ignored by the importer. - p.rawStringln(fmt.Sprintf("version %d", exportVersion)) - var debug string - if debugFormat { - debug = "debug" - } - p.rawStringln(debug) // cannot use p.bool since it's affected by debugFormat; also want to see this clearly - p.bool(trackAllTypes) - p.bool(p.posInfoFormat) - - // --- generic export data --- - - // populate type map with predeclared "known" types - for index, typ := range predeclared() { - p.typIndex[typ] = index - } - if len(p.typIndex) != len(predeclared()) { - return nil, internalError("duplicate entries in type map?") - } - - // write package data - p.pkg(pkg, true) - if trace { - p.tracef("\n") - } - - // write objects - objcount := 0 - scope := pkg.Scope() - for _, name := range scope.Names() { - if !token.IsExported(name) { - continue - } - if trace { - p.tracef("\n") - } - p.obj(scope.Lookup(name)) - objcount++ - } - - // indicate end of list - if trace { - p.tracef("\n") - } - p.tag(endTag) - - // for self-verification only (redundant) - p.int(objcount) - - if trace { - p.tracef("\n") - } - - // --- end of export data --- - - return p.out.Bytes(), nil -} - -func (p *exporter) pkg(pkg *types.Package, emptypath bool) { - if pkg == nil { - panic(internalError("unexpected nil pkg")) - } - - // if we saw the package before, write its index (>= 0) - if i, ok := p.pkgIndex[pkg]; ok { - p.index('P', i) - return - } - - // otherwise, remember the package, write the package tag (< 0) and package data - if trace { - p.tracef("P%d = { ", len(p.pkgIndex)) - defer p.tracef("} ") - } - p.pkgIndex[pkg] = len(p.pkgIndex) - - p.tag(packageTag) - p.string(pkg.Name()) - if emptypath { - p.string("") - } else { - p.string(pkg.Path()) - } -} - -func (p *exporter) obj(obj types.Object) { - switch obj := obj.(type) { - case *types.Const: - p.tag(constTag) - p.pos(obj) - p.qualifiedName(obj) - p.typ(obj.Type()) - p.value(obj.Val()) - - case *types.TypeName: - if obj.IsAlias() { - p.tag(aliasTag) - p.pos(obj) - p.qualifiedName(obj) - } else { - p.tag(typeTag) - } - p.typ(obj.Type()) - - case *types.Var: - p.tag(varTag) - p.pos(obj) - p.qualifiedName(obj) - p.typ(obj.Type()) - - case *types.Func: - p.tag(funcTag) - p.pos(obj) - p.qualifiedName(obj) - sig := obj.Type().(*types.Signature) - p.paramList(sig.Params(), sig.Variadic()) - p.paramList(sig.Results(), false) - - default: - panic(internalErrorf("unexpected object %v (%T)", obj, obj)) - } -} - -func (p *exporter) pos(obj types.Object) { - if !p.posInfoFormat { - return - } - - file, line := p.fileLine(obj) - if file == p.prevFile { - // common case: write line delta - // delta == 0 means different file or no line change - delta := line - p.prevLine - p.int(delta) - if delta == 0 { - p.int(-1) // -1 means no file change - } - } else { - // different file - p.int(0) - // Encode filename as length of common prefix with previous - // filename, followed by (possibly empty) suffix. Filenames - // frequently share path prefixes, so this can save a lot - // of space and make export data size less dependent on file - // path length. The suffix is unlikely to be empty because - // file names tend to end in ".go". - n := commonPrefixLen(p.prevFile, file) - p.int(n) // n >= 0 - p.string(file[n:]) // write suffix only - p.prevFile = file - p.int(line) - } - p.prevLine = line -} - -func (p *exporter) fileLine(obj types.Object) (file string, line int) { - if p.fset != nil { - pos := p.fset.Position(obj.Pos()) - file = pos.Filename - line = pos.Line - } - return -} - -func commonPrefixLen(a, b string) int { - if len(a) > len(b) { - a, b = b, a - } - // len(a) <= len(b) - i := 0 - for i < len(a) && a[i] == b[i] { - i++ - } - return i -} - -func (p *exporter) qualifiedName(obj types.Object) { - p.string(obj.Name()) - p.pkg(obj.Pkg(), false) -} - -func (p *exporter) typ(t types.Type) { - if t == nil { - panic(internalError("nil type")) - } - - // Possible optimization: Anonymous pointer types *T where - // T is a named type are common. We could canonicalize all - // such types *T to a single type PT = *T. This would lead - // to at most one *T entry in typIndex, and all future *T's - // would be encoded as the respective index directly. Would - // save 1 byte (pointerTag) per *T and reduce the typIndex - // size (at the cost of a canonicalization map). We can do - // this later, without encoding format change. - - // if we saw the type before, write its index (>= 0) - if i, ok := p.typIndex[t]; ok { - p.index('T', i) - return - } - - // otherwise, remember the type, write the type tag (< 0) and type data - if trackAllTypes { - if trace { - p.tracef("T%d = {>\n", len(p.typIndex)) - defer p.tracef("<\n} ") - } - p.typIndex[t] = len(p.typIndex) - } - - switch t := t.(type) { - case *types.Named: - if !trackAllTypes { - // if we don't track all types, track named types now - p.typIndex[t] = len(p.typIndex) - } - - p.tag(namedTag) - p.pos(t.Obj()) - p.qualifiedName(t.Obj()) - p.typ(t.Underlying()) - if !types.IsInterface(t) { - p.assocMethods(t) - } - - case *types.Array: - p.tag(arrayTag) - p.int64(t.Len()) - p.typ(t.Elem()) - - case *types.Slice: - p.tag(sliceTag) - p.typ(t.Elem()) - - case *dddSlice: - p.tag(dddTag) - p.typ(t.elem) - - case *types.Struct: - p.tag(structTag) - p.fieldList(t) - - case *types.Pointer: - p.tag(pointerTag) - p.typ(t.Elem()) - - case *types.Signature: - p.tag(signatureTag) - p.paramList(t.Params(), t.Variadic()) - p.paramList(t.Results(), false) - - case *types.Interface: - p.tag(interfaceTag) - p.iface(t) - - case *types.Map: - p.tag(mapTag) - p.typ(t.Key()) - p.typ(t.Elem()) - - case *types.Chan: - p.tag(chanTag) - p.int(int(3 - t.Dir())) // hack - p.typ(t.Elem()) - - default: - panic(internalErrorf("unexpected type %T: %s", t, t)) - } -} - -func (p *exporter) assocMethods(named *types.Named) { - // Sort methods (for determinism). - var methods []*types.Func - for i := 0; i < named.NumMethods(); i++ { - methods = append(methods, named.Method(i)) - } - sort.Sort(methodsByName(methods)) - - p.int(len(methods)) - - if trace && methods != nil { - p.tracef("associated methods {>\n") - } - - for i, m := range methods { - if trace && i > 0 { - p.tracef("\n") - } - - p.pos(m) - name := m.Name() - p.string(name) - if !exported(name) { - p.pkg(m.Pkg(), false) - } - - sig := m.Type().(*types.Signature) - p.paramList(types.NewTuple(sig.Recv()), false) - p.paramList(sig.Params(), sig.Variadic()) - p.paramList(sig.Results(), false) - p.int(0) // dummy value for go:nointerface pragma - ignored by importer - } - - if trace && methods != nil { - p.tracef("<\n} ") - } -} - -type methodsByName []*types.Func - -func (x methodsByName) Len() int { return len(x) } -func (x methodsByName) Swap(i, j int) { x[i], x[j] = x[j], x[i] } -func (x methodsByName) Less(i, j int) bool { return x[i].Name() < x[j].Name() } - -func (p *exporter) fieldList(t *types.Struct) { - if trace && t.NumFields() > 0 { - p.tracef("fields {>\n") - defer p.tracef("<\n} ") - } - - p.int(t.NumFields()) - for i := 0; i < t.NumFields(); i++ { - if trace && i > 0 { - p.tracef("\n") - } - p.field(t.Field(i)) - p.string(t.Tag(i)) - } -} - -func (p *exporter) field(f *types.Var) { - if !f.IsField() { - panic(internalError("field expected")) - } - - p.pos(f) - p.fieldName(f) - p.typ(f.Type()) -} - -func (p *exporter) iface(t *types.Interface) { - // TODO(gri): enable importer to load embedded interfaces, - // then emit Embeddeds and ExplicitMethods separately here. - p.int(0) - - n := t.NumMethods() - if trace && n > 0 { - p.tracef("methods {>\n") - defer p.tracef("<\n} ") - } - p.int(n) - for i := 0; i < n; i++ { - if trace && i > 0 { - p.tracef("\n") - } - p.method(t.Method(i)) - } -} - -func (p *exporter) method(m *types.Func) { - sig := m.Type().(*types.Signature) - if sig.Recv() == nil { - panic(internalError("method expected")) - } - - p.pos(m) - p.string(m.Name()) - if m.Name() != "_" && !token.IsExported(m.Name()) { - p.pkg(m.Pkg(), false) - } - - // interface method; no need to encode receiver. - p.paramList(sig.Params(), sig.Variadic()) - p.paramList(sig.Results(), false) -} - -func (p *exporter) fieldName(f *types.Var) { - name := f.Name() - - if f.Anonymous() { - // anonymous field - we distinguish between 3 cases: - // 1) field name matches base type name and is exported - // 2) field name matches base type name and is not exported - // 3) field name doesn't match base type name (alias name) - bname := basetypeName(f.Type()) - if name == bname { - if token.IsExported(name) { - name = "" // 1) we don't need to know the field name or package - } else { - name = "?" // 2) use unexported name "?" to force package export - } - } else { - // 3) indicate alias and export name as is - // (this requires an extra "@" but this is a rare case) - p.string("@") - } - } - - p.string(name) - if name != "" && !token.IsExported(name) { - p.pkg(f.Pkg(), false) - } -} - -func basetypeName(typ types.Type) string { - switch typ := deref(typ).(type) { - case *types.Basic: - return typ.Name() - case *types.Named: - return typ.Obj().Name() - default: - return "" // unnamed type - } -} - -func (p *exporter) paramList(params *types.Tuple, variadic bool) { - // use negative length to indicate unnamed parameters - // (look at the first parameter only since either all - // names are present or all are absent) - n := params.Len() - if n > 0 && params.At(0).Name() == "" { - n = -n - } - p.int(n) - for i := 0; i < params.Len(); i++ { - q := params.At(i) - t := q.Type() - if variadic && i == params.Len()-1 { - t = &dddSlice{t.(*types.Slice).Elem()} - } - p.typ(t) - if n > 0 { - name := q.Name() - p.string(name) - if name != "_" { - p.pkg(q.Pkg(), false) - } - } - p.string("") // no compiler-specific info - } -} - -func (p *exporter) value(x constant.Value) { - if trace { - p.tracef("= ") - } - - switch x.Kind() { - case constant.Bool: - tag := falseTag - if constant.BoolVal(x) { - tag = trueTag - } - p.tag(tag) - - case constant.Int: - if v, exact := constant.Int64Val(x); exact { - // common case: x fits into an int64 - use compact encoding - p.tag(int64Tag) - p.int64(v) - return - } - // uncommon case: large x - use float encoding - // (powers of 2 will be encoded efficiently with exponent) - p.tag(floatTag) - p.float(constant.ToFloat(x)) - - case constant.Float: - p.tag(floatTag) - p.float(x) - - case constant.Complex: - p.tag(complexTag) - p.float(constant.Real(x)) - p.float(constant.Imag(x)) - - case constant.String: - p.tag(stringTag) - p.string(constant.StringVal(x)) - - case constant.Unknown: - // package contains type errors - p.tag(unknownTag) - - default: - panic(internalErrorf("unexpected value %v (%T)", x, x)) - } -} - -func (p *exporter) float(x constant.Value) { - if x.Kind() != constant.Float { - panic(internalErrorf("unexpected constant %v, want float", x)) - } - // extract sign (there is no -0) - sign := constant.Sign(x) - if sign == 0 { - // x == 0 - p.int(0) - return - } - // x != 0 - - var f big.Float - if v, exact := constant.Float64Val(x); exact { - // float64 - f.SetFloat64(v) - } else if num, denom := constant.Num(x), constant.Denom(x); num.Kind() == constant.Int { - // TODO(gri): add big.Rat accessor to constant.Value. - r := valueToRat(num) - f.SetRat(r.Quo(r, valueToRat(denom))) - } else { - // Value too large to represent as a fraction => inaccessible. - // TODO(gri): add big.Float accessor to constant.Value. - f.SetFloat64(math.MaxFloat64) // FIXME - } - - // extract exponent such that 0.5 <= m < 1.0 - var m big.Float - exp := f.MantExp(&m) - - // extract mantissa as *big.Int - // - set exponent large enough so mant satisfies mant.IsInt() - // - get *big.Int from mant - m.SetMantExp(&m, int(m.MinPrec())) - mant, acc := m.Int(nil) - if acc != big.Exact { - panic(internalError("internal error")) - } - - p.int(sign) - p.int(exp) - p.string(string(mant.Bytes())) -} - -func valueToRat(x constant.Value) *big.Rat { - // Convert little-endian to big-endian. - // I can't believe this is necessary. - bytes := constant.Bytes(x) - for i := 0; i < len(bytes)/2; i++ { - bytes[i], bytes[len(bytes)-1-i] = bytes[len(bytes)-1-i], bytes[i] - } - return new(big.Rat).SetInt(new(big.Int).SetBytes(bytes)) -} - -func (p *exporter) bool(b bool) bool { - if trace { - p.tracef("[") - defer p.tracef("= %v] ", b) - } - - x := 0 - if b { - x = 1 - } - p.int(x) - return b -} - -// ---------------------------------------------------------------------------- -// Low-level encoders - -func (p *exporter) index(marker byte, index int) { - if index < 0 { - panic(internalError("invalid index < 0")) - } - if debugFormat { - p.marker('t') - } - if trace { - p.tracef("%c%d ", marker, index) - } - p.rawInt64(int64(index)) -} - -func (p *exporter) tag(tag int) { - if tag >= 0 { - panic(internalError("invalid tag >= 0")) - } - if debugFormat { - p.marker('t') - } - if trace { - p.tracef("%s ", tagString[-tag]) - } - p.rawInt64(int64(tag)) -} - -func (p *exporter) int(x int) { - p.int64(int64(x)) -} - -func (p *exporter) int64(x int64) { - if debugFormat { - p.marker('i') - } - if trace { - p.tracef("%d ", x) - } - p.rawInt64(x) -} - -func (p *exporter) string(s string) { - if debugFormat { - p.marker('s') - } - if trace { - p.tracef("%q ", s) - } - // if we saw the string before, write its index (>= 0) - // (the empty string is mapped to 0) - if i, ok := p.strIndex[s]; ok { - p.rawInt64(int64(i)) - return - } - // otherwise, remember string and write its negative length and bytes - p.strIndex[s] = len(p.strIndex) - p.rawInt64(-int64(len(s))) - for i := 0; i < len(s); i++ { - p.rawByte(s[i]) - } -} - -// marker emits a marker byte and position information which makes -// it easy for a reader to detect if it is "out of sync". Used for -// debugFormat format only. -func (p *exporter) marker(m byte) { - p.rawByte(m) - // Enable this for help tracking down the location - // of an incorrect marker when running in debugFormat. - if false && trace { - p.tracef("#%d ", p.written) - } - p.rawInt64(int64(p.written)) -} - -// rawInt64 should only be used by low-level encoders. -func (p *exporter) rawInt64(x int64) { - var tmp [binary.MaxVarintLen64]byte - n := binary.PutVarint(tmp[:], x) - for i := 0; i < n; i++ { - p.rawByte(tmp[i]) - } -} - -// rawStringln should only be used to emit the initial version string. -func (p *exporter) rawStringln(s string) { - for i := 0; i < len(s); i++ { - p.rawByte(s[i]) - } - p.rawByte('\n') -} - -// rawByte is the bottleneck interface to write to p.out. -// rawByte escapes b as follows (any encoding does that -// hides '$'): -// -// '$' => '|' 'S' -// '|' => '|' '|' -// -// Necessary so other tools can find the end of the -// export data by searching for "$$". -// rawByte should only be used by low-level encoders. -func (p *exporter) rawByte(b byte) { - switch b { - case '$': - // write '$' as '|' 'S' - b = 'S' - fallthrough - case '|': - // write '|' as '|' '|' - p.out.WriteByte('|') - p.written++ - } - p.out.WriteByte(b) - p.written++ -} - -// tracef is like fmt.Printf but it rewrites the format string -// to take care of indentation. -func (p *exporter) tracef(format string, args ...interface{}) { - if strings.ContainsAny(format, "<>\n") { - var buf bytes.Buffer - for i := 0; i < len(format); i++ { - // no need to deal with runes - ch := format[i] - switch ch { - case '>': - p.indent++ - continue - case '<': - p.indent-- - continue - } - buf.WriteByte(ch) - if ch == '\n' { - for j := p.indent; j > 0; j-- { - buf.WriteString(". ") - } - } - } - format = buf.String() - } - fmt.Printf(format, args...) -} - -// Debugging support. -// (tagString is only used when tracing is enabled) -var tagString = [...]string{ - // Packages - -packageTag: "package", - - // Types - -namedTag: "named type", - -arrayTag: "array", - -sliceTag: "slice", - -dddTag: "ddd", - -structTag: "struct", - -pointerTag: "pointer", - -signatureTag: "signature", - -interfaceTag: "interface", - -mapTag: "map", - -chanTag: "chan", - - // Values - -falseTag: "false", - -trueTag: "true", - -int64Tag: "int64", - -floatTag: "float", - -fractionTag: "fraction", - -complexTag: "complex", - -stringTag: "string", - -unknownTag: "unknown", - - // Type aliases - -aliasTag: "alias", -} diff --git a/vendor/golang.org/x/tools/internal/gcimporter/bimport.go b/vendor/golang.org/x/tools/internal/gcimporter/bimport.go index b85de0147..d98b0db2a 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/bimport.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/bimport.go @@ -2,340 +2,24 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// This file is a copy of $GOROOT/src/go/internal/gcimporter/bimport.go. +// This file contains the remaining vestiges of +// $GOROOT/src/go/internal/gcimporter/bimport.go. package gcimporter import ( - "encoding/binary" "fmt" - "go/constant" "go/token" "go/types" - "sort" - "strconv" - "strings" "sync" - "unicode" - "unicode/utf8" ) -type importer struct { - imports map[string]*types.Package - data []byte - importpath string - buf []byte // for reading strings - version int // export format version - - // object lists - strList []string // in order of appearance - pathList []string // in order of appearance - pkgList []*types.Package // in order of appearance - typList []types.Type // in order of appearance - interfaceList []*types.Interface // for delayed completion only - trackAllTypes bool - - // position encoding - posInfoFormat bool - prevFile string - prevLine int - fake fakeFileSet - - // debugging support - debugFormat bool - read int // bytes read -} - -// BImportData imports a package from the serialized package data -// and returns the number of bytes consumed and a reference to the package. -// If the export data version is not recognized or the format is otherwise -// compromised, an error is returned. -func BImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (_ int, pkg *types.Package, err error) { - // catch panics and return them as errors - const currentVersion = 6 - version := -1 // unknown version - defer func() { - if e := recover(); e != nil { - // Return a (possibly nil or incomplete) package unchanged (see #16088). - if version > currentVersion { - err = fmt.Errorf("cannot import %q (%v), export data is newer version - update tool", path, e) - } else { - err = fmt.Errorf("cannot import %q (%v), possibly version skew - reinstall package", path, e) - } - } - }() - - p := importer{ - imports: imports, - data: data, - importpath: path, - version: version, - strList: []string{""}, // empty string is mapped to 0 - pathList: []string{""}, // empty string is mapped to 0 - fake: fakeFileSet{ - fset: fset, - files: make(map[string]*fileInfo), - }, - } - defer p.fake.setLines() // set lines for files in fset - - // read version info - var versionstr string - if b := p.rawByte(); b == 'c' || b == 'd' { - // Go1.7 encoding; first byte encodes low-level - // encoding format (compact vs debug). - // For backward-compatibility only (avoid problems with - // old installed packages). Newly compiled packages use - // the extensible format string. - // TODO(gri) Remove this support eventually; after Go1.8. - if b == 'd' { - p.debugFormat = true - } - p.trackAllTypes = p.rawByte() == 'a' - p.posInfoFormat = p.int() != 0 - versionstr = p.string() - if versionstr == "v1" { - version = 0 - } - } else { - // Go1.8 extensible encoding - // read version string and extract version number (ignore anything after the version number) - versionstr = p.rawStringln(b) - if s := strings.SplitN(versionstr, " ", 3); len(s) >= 2 && s[0] == "version" { - if v, err := strconv.Atoi(s[1]); err == nil && v > 0 { - version = v - } - } - } - p.version = version - - // read version specific flags - extend as necessary - switch p.version { - // case currentVersion: - // ... - // fallthrough - case currentVersion, 5, 4, 3, 2, 1: - p.debugFormat = p.rawStringln(p.rawByte()) == "debug" - p.trackAllTypes = p.int() != 0 - p.posInfoFormat = p.int() != 0 - case 0: - // Go1.7 encoding format - nothing to do here - default: - errorf("unknown bexport format version %d (%q)", p.version, versionstr) - } - - // --- generic export data --- - - // populate typList with predeclared "known" types - p.typList = append(p.typList, predeclared()...) - - // read package data - pkg = p.pkg() - - // read objects of phase 1 only (see cmd/compile/internal/gc/bexport.go) - objcount := 0 - for { - tag := p.tagOrIndex() - if tag == endTag { - break - } - p.obj(tag) - objcount++ - } - - // self-verification - if count := p.int(); count != objcount { - errorf("got %d objects; want %d", objcount, count) - } - - // ignore compiler-specific import data - - // complete interfaces - // TODO(gri) re-investigate if we still need to do this in a delayed fashion - for _, typ := range p.interfaceList { - typ.Complete() - } - - // record all referenced packages as imports - list := append(([]*types.Package)(nil), p.pkgList[1:]...) - sort.Sort(byPath(list)) - pkg.SetImports(list) - - // package was imported completely and without errors - pkg.MarkComplete() - - return p.read, pkg, nil -} - func errorf(format string, args ...interface{}) { panic(fmt.Sprintf(format, args...)) } -func (p *importer) pkg() *types.Package { - // if the package was seen before, i is its index (>= 0) - i := p.tagOrIndex() - if i >= 0 { - return p.pkgList[i] - } - - // otherwise, i is the package tag (< 0) - if i != packageTag { - errorf("unexpected package tag %d version %d", i, p.version) - } - - // read package data - name := p.string() - var path string - if p.version >= 5 { - path = p.path() - } else { - path = p.string() - } - if p.version >= 6 { - p.int() // package height; unused by go/types - } - - // we should never see an empty package name - if name == "" { - errorf("empty package name in import") - } - - // an empty path denotes the package we are currently importing; - // it must be the first package we see - if (path == "") != (len(p.pkgList) == 0) { - errorf("package path %q for pkg index %d", path, len(p.pkgList)) - } - - // if the package was imported before, use that one; otherwise create a new one - if path == "" { - path = p.importpath - } - pkg := p.imports[path] - if pkg == nil { - pkg = types.NewPackage(path, name) - p.imports[path] = pkg - } else if pkg.Name() != name { - errorf("conflicting names %s and %s for package %q", pkg.Name(), name, path) - } - p.pkgList = append(p.pkgList, pkg) - - return pkg -} - -// objTag returns the tag value for each object kind. -func objTag(obj types.Object) int { - switch obj.(type) { - case *types.Const: - return constTag - case *types.TypeName: - return typeTag - case *types.Var: - return varTag - case *types.Func: - return funcTag - default: - errorf("unexpected object: %v (%T)", obj, obj) // panics - panic("unreachable") - } -} - -func sameObj(a, b types.Object) bool { - // Because unnamed types are not canonicalized, we cannot simply compare types for - // (pointer) identity. - // Ideally we'd check equality of constant values as well, but this is good enough. - return objTag(a) == objTag(b) && types.Identical(a.Type(), b.Type()) -} - -func (p *importer) declare(obj types.Object) { - pkg := obj.Pkg() - if alt := pkg.Scope().Insert(obj); alt != nil { - // This can only trigger if we import a (non-type) object a second time. - // Excluding type aliases, this cannot happen because 1) we only import a package - // once; and b) we ignore compiler-specific export data which may contain - // functions whose inlined function bodies refer to other functions that - // were already imported. - // However, type aliases require reexporting the original type, so we need - // to allow it (see also the comment in cmd/compile/internal/gc/bimport.go, - // method importer.obj, switch case importing functions). - // TODO(gri) review/update this comment once the gc compiler handles type aliases. - if !sameObj(obj, alt) { - errorf("inconsistent import:\n\t%v\npreviously imported as:\n\t%v\n", obj, alt) - } - } -} - -func (p *importer) obj(tag int) { - switch tag { - case constTag: - pos := p.pos() - pkg, name := p.qualifiedName() - typ := p.typ(nil, nil) - val := p.value() - p.declare(types.NewConst(pos, pkg, name, typ, val)) - - case aliasTag: - // TODO(gri) verify type alias hookup is correct - pos := p.pos() - pkg, name := p.qualifiedName() - typ := p.typ(nil, nil) - p.declare(types.NewTypeName(pos, pkg, name, typ)) - - case typeTag: - p.typ(nil, nil) - - case varTag: - pos := p.pos() - pkg, name := p.qualifiedName() - typ := p.typ(nil, nil) - p.declare(types.NewVar(pos, pkg, name, typ)) - - case funcTag: - pos := p.pos() - pkg, name := p.qualifiedName() - params, isddd := p.paramList() - result, _ := p.paramList() - sig := types.NewSignature(nil, params, result, isddd) - p.declare(types.NewFunc(pos, pkg, name, sig)) - - default: - errorf("unexpected object tag %d", tag) - } -} - const deltaNewFile = -64 // see cmd/compile/internal/gc/bexport.go -func (p *importer) pos() token.Pos { - if !p.posInfoFormat { - return token.NoPos - } - - file := p.prevFile - line := p.prevLine - delta := p.int() - line += delta - if p.version >= 5 { - if delta == deltaNewFile { - if n := p.int(); n >= 0 { - // file changed - file = p.path() - line = n - } - } - } else { - if delta == 0 { - if n := p.int(); n >= 0 { - // file changed - file = p.prevFile[:n] + p.string() - line = p.int() - } - } - } - p.prevFile = file - p.prevLine = line - - return p.fake.pos(file, line, 0) -} - // Synthesize a token.Pos type fakeFileSet struct { fset *token.FileSet @@ -389,205 +73,6 @@ var ( fakeLinesOnce sync.Once ) -func (p *importer) qualifiedName() (pkg *types.Package, name string) { - name = p.string() - pkg = p.pkg() - return -} - -func (p *importer) record(t types.Type) { - p.typList = append(p.typList, t) -} - -// A dddSlice is a types.Type representing ...T parameters. -// It only appears for parameter types and does not escape -// the importer. -type dddSlice struct { - elem types.Type -} - -func (t *dddSlice) Underlying() types.Type { return t } -func (t *dddSlice) String() string { return "..." + t.elem.String() } - -// parent is the package which declared the type; parent == nil means -// the package currently imported. The parent package is needed for -// exported struct fields and interface methods which don't contain -// explicit package information in the export data. -// -// A non-nil tname is used as the "owner" of the result type; i.e., -// the result type is the underlying type of tname. tname is used -// to give interface methods a named receiver type where possible. -func (p *importer) typ(parent *types.Package, tname *types.Named) types.Type { - // if the type was seen before, i is its index (>= 0) - i := p.tagOrIndex() - if i >= 0 { - return p.typList[i] - } - - // otherwise, i is the type tag (< 0) - switch i { - case namedTag: - // read type object - pos := p.pos() - parent, name := p.qualifiedName() - scope := parent.Scope() - obj := scope.Lookup(name) - - // if the object doesn't exist yet, create and insert it - if obj == nil { - obj = types.NewTypeName(pos, parent, name, nil) - scope.Insert(obj) - } - - if _, ok := obj.(*types.TypeName); !ok { - errorf("pkg = %s, name = %s => %s", parent, name, obj) - } - - // associate new named type with obj if it doesn't exist yet - t0 := types.NewNamed(obj.(*types.TypeName), nil, nil) - - // but record the existing type, if any - tname := obj.Type().(*types.Named) // tname is either t0 or the existing type - p.record(tname) - - // read underlying type - t0.SetUnderlying(p.typ(parent, t0)) - - // interfaces don't have associated methods - if types.IsInterface(t0) { - return tname - } - - // read associated methods - for i := p.int(); i > 0; i-- { - // TODO(gri) replace this with something closer to fieldName - pos := p.pos() - name := p.string() - if !exported(name) { - p.pkg() - } - - recv, _ := p.paramList() // TODO(gri) do we need a full param list for the receiver? - params, isddd := p.paramList() - result, _ := p.paramList() - p.int() // go:nointerface pragma - discarded - - sig := types.NewSignature(recv.At(0), params, result, isddd) - t0.AddMethod(types.NewFunc(pos, parent, name, sig)) - } - - return tname - - case arrayTag: - t := new(types.Array) - if p.trackAllTypes { - p.record(t) - } - - n := p.int64() - *t = *types.NewArray(p.typ(parent, nil), n) - return t - - case sliceTag: - t := new(types.Slice) - if p.trackAllTypes { - p.record(t) - } - - *t = *types.NewSlice(p.typ(parent, nil)) - return t - - case dddTag: - t := new(dddSlice) - if p.trackAllTypes { - p.record(t) - } - - t.elem = p.typ(parent, nil) - return t - - case structTag: - t := new(types.Struct) - if p.trackAllTypes { - p.record(t) - } - - *t = *types.NewStruct(p.fieldList(parent)) - return t - - case pointerTag: - t := new(types.Pointer) - if p.trackAllTypes { - p.record(t) - } - - *t = *types.NewPointer(p.typ(parent, nil)) - return t - - case signatureTag: - t := new(types.Signature) - if p.trackAllTypes { - p.record(t) - } - - params, isddd := p.paramList() - result, _ := p.paramList() - *t = *types.NewSignature(nil, params, result, isddd) - return t - - case interfaceTag: - // Create a dummy entry in the type list. This is safe because we - // cannot expect the interface type to appear in a cycle, as any - // such cycle must contain a named type which would have been - // first defined earlier. - // TODO(gri) Is this still true now that we have type aliases? - // See issue #23225. - n := len(p.typList) - if p.trackAllTypes { - p.record(nil) - } - - var embeddeds []types.Type - for n := p.int(); n > 0; n-- { - p.pos() - embeddeds = append(embeddeds, p.typ(parent, nil)) - } - - t := newInterface(p.methodList(parent, tname), embeddeds) - p.interfaceList = append(p.interfaceList, t) - if p.trackAllTypes { - p.typList[n] = t - } - return t - - case mapTag: - t := new(types.Map) - if p.trackAllTypes { - p.record(t) - } - - key := p.typ(parent, nil) - val := p.typ(parent, nil) - *t = *types.NewMap(key, val) - return t - - case chanTag: - t := new(types.Chan) - if p.trackAllTypes { - p.record(t) - } - - dir := chanDir(p.int()) - val := p.typ(parent, nil) - *t = *types.NewChan(dir, val) - return t - - default: - errorf("unexpected type tag %d", i) // panics - panic("unreachable") - } -} - func chanDir(d int) types.ChanDir { // tag values must match the constants in cmd/compile/internal/gc/go.go switch d { @@ -603,394 +88,6 @@ func chanDir(d int) types.ChanDir { } } -func (p *importer) fieldList(parent *types.Package) (fields []*types.Var, tags []string) { - if n := p.int(); n > 0 { - fields = make([]*types.Var, n) - tags = make([]string, n) - for i := range fields { - fields[i], tags[i] = p.field(parent) - } - } - return -} - -func (p *importer) field(parent *types.Package) (*types.Var, string) { - pos := p.pos() - pkg, name, alias := p.fieldName(parent) - typ := p.typ(parent, nil) - tag := p.string() - - anonymous := false - if name == "" { - // anonymous field - typ must be T or *T and T must be a type name - switch typ := deref(typ).(type) { - case *types.Basic: // basic types are named types - pkg = nil // // objects defined in Universe scope have no package - name = typ.Name() - case *types.Named: - name = typ.Obj().Name() - default: - errorf("named base type expected") - } - anonymous = true - } else if alias { - // anonymous field: we have an explicit name because it's an alias - anonymous = true - } - - return types.NewField(pos, pkg, name, typ, anonymous), tag -} - -func (p *importer) methodList(parent *types.Package, baseType *types.Named) (methods []*types.Func) { - if n := p.int(); n > 0 { - methods = make([]*types.Func, n) - for i := range methods { - methods[i] = p.method(parent, baseType) - } - } - return -} - -func (p *importer) method(parent *types.Package, baseType *types.Named) *types.Func { - pos := p.pos() - pkg, name, _ := p.fieldName(parent) - // If we don't have a baseType, use a nil receiver. - // A receiver using the actual interface type (which - // we don't know yet) will be filled in when we call - // types.Interface.Complete. - var recv *types.Var - if baseType != nil { - recv = types.NewVar(token.NoPos, parent, "", baseType) - } - params, isddd := p.paramList() - result, _ := p.paramList() - sig := types.NewSignature(recv, params, result, isddd) - return types.NewFunc(pos, pkg, name, sig) -} - -func (p *importer) fieldName(parent *types.Package) (pkg *types.Package, name string, alias bool) { - name = p.string() - pkg = parent - if pkg == nil { - // use the imported package instead - pkg = p.pkgList[0] - } - if p.version == 0 && name == "_" { - // version 0 didn't export a package for _ fields - return - } - switch name { - case "": - // 1) field name matches base type name and is exported: nothing to do - case "?": - // 2) field name matches base type name and is not exported: need package - name = "" - pkg = p.pkg() - case "@": - // 3) field name doesn't match type name (alias) - name = p.string() - alias = true - fallthrough - default: - if !exported(name) { - pkg = p.pkg() - } - } - return -} - -func (p *importer) paramList() (*types.Tuple, bool) { - n := p.int() - if n == 0 { - return nil, false - } - // negative length indicates unnamed parameters - named := true - if n < 0 { - n = -n - named = false - } - // n > 0 - params := make([]*types.Var, n) - isddd := false - for i := range params { - params[i], isddd = p.param(named) - } - return types.NewTuple(params...), isddd -} - -func (p *importer) param(named bool) (*types.Var, bool) { - t := p.typ(nil, nil) - td, isddd := t.(*dddSlice) - if isddd { - t = types.NewSlice(td.elem) - } - - var pkg *types.Package - var name string - if named { - name = p.string() - if name == "" { - errorf("expected named parameter") - } - if name != "_" { - pkg = p.pkg() - } - if i := strings.Index(name, "Ā·"); i > 0 { - name = name[:i] // cut off gc-specific parameter numbering - } - } - - // read and discard compiler-specific info - p.string() - - return types.NewVar(token.NoPos, pkg, name, t), isddd -} - -func exported(name string) bool { - ch, _ := utf8.DecodeRuneInString(name) - return unicode.IsUpper(ch) -} - -func (p *importer) value() constant.Value { - switch tag := p.tagOrIndex(); tag { - case falseTag: - return constant.MakeBool(false) - case trueTag: - return constant.MakeBool(true) - case int64Tag: - return constant.MakeInt64(p.int64()) - case floatTag: - return p.float() - case complexTag: - re := p.float() - im := p.float() - return constant.BinaryOp(re, token.ADD, constant.MakeImag(im)) - case stringTag: - return constant.MakeString(p.string()) - case unknownTag: - return constant.MakeUnknown() - default: - errorf("unexpected value tag %d", tag) // panics - panic("unreachable") - } -} - -func (p *importer) float() constant.Value { - sign := p.int() - if sign == 0 { - return constant.MakeInt64(0) - } - - exp := p.int() - mant := []byte(p.string()) // big endian - - // remove leading 0's if any - for len(mant) > 0 && mant[0] == 0 { - mant = mant[1:] - } - - // convert to little endian - // TODO(gri) go/constant should have a more direct conversion function - // (e.g., once it supports a big.Float based implementation) - for i, j := 0, len(mant)-1; i < j; i, j = i+1, j-1 { - mant[i], mant[j] = mant[j], mant[i] - } - - // adjust exponent (constant.MakeFromBytes creates an integer value, - // but mant represents the mantissa bits such that 0.5 <= mant < 1.0) - exp -= len(mant) << 3 - if len(mant) > 0 { - for msd := mant[len(mant)-1]; msd&0x80 == 0; msd <<= 1 { - exp++ - } - } - - x := constant.MakeFromBytes(mant) - switch { - case exp < 0: - d := constant.Shift(constant.MakeInt64(1), token.SHL, uint(-exp)) - x = constant.BinaryOp(x, token.QUO, d) - case exp > 0: - x = constant.Shift(x, token.SHL, uint(exp)) - } - - if sign < 0 { - x = constant.UnaryOp(token.SUB, x, 0) - } - return x -} - -// ---------------------------------------------------------------------------- -// Low-level decoders - -func (p *importer) tagOrIndex() int { - if p.debugFormat { - p.marker('t') - } - - return int(p.rawInt64()) -} - -func (p *importer) int() int { - x := p.int64() - if int64(int(x)) != x { - errorf("exported integer too large") - } - return int(x) -} - -func (p *importer) int64() int64 { - if p.debugFormat { - p.marker('i') - } - - return p.rawInt64() -} - -func (p *importer) path() string { - if p.debugFormat { - p.marker('p') - } - // if the path was seen before, i is its index (>= 0) - // (the empty string is at index 0) - i := p.rawInt64() - if i >= 0 { - return p.pathList[i] - } - // otherwise, i is the negative path length (< 0) - a := make([]string, -i) - for n := range a { - a[n] = p.string() - } - s := strings.Join(a, "/") - p.pathList = append(p.pathList, s) - return s -} - -func (p *importer) string() string { - if p.debugFormat { - p.marker('s') - } - // if the string was seen before, i is its index (>= 0) - // (the empty string is at index 0) - i := p.rawInt64() - if i >= 0 { - return p.strList[i] - } - // otherwise, i is the negative string length (< 0) - if n := int(-i); n <= cap(p.buf) { - p.buf = p.buf[:n] - } else { - p.buf = make([]byte, n) - } - for i := range p.buf { - p.buf[i] = p.rawByte() - } - s := string(p.buf) - p.strList = append(p.strList, s) - return s -} - -func (p *importer) marker(want byte) { - if got := p.rawByte(); got != want { - errorf("incorrect marker: got %c; want %c (pos = %d)", got, want, p.read) - } - - pos := p.read - if n := int(p.rawInt64()); n != pos { - errorf("incorrect position: got %d; want %d", n, pos) - } -} - -// rawInt64 should only be used by low-level decoders. -func (p *importer) rawInt64() int64 { - i, err := binary.ReadVarint(p) - if err != nil { - errorf("read error: %v", err) - } - return i -} - -// rawStringln should only be used to read the initial version string. -func (p *importer) rawStringln(b byte) string { - p.buf = p.buf[:0] - for b != '\n' { - p.buf = append(p.buf, b) - b = p.rawByte() - } - return string(p.buf) -} - -// needed for binary.ReadVarint in rawInt64 -func (p *importer) ReadByte() (byte, error) { - return p.rawByte(), nil -} - -// byte is the bottleneck interface for reading p.data. -// It unescapes '|' 'S' to '$' and '|' '|' to '|'. -// rawByte should only be used by low-level decoders. -func (p *importer) rawByte() byte { - b := p.data[0] - r := 1 - if b == '|' { - b = p.data[1] - r = 2 - switch b { - case 'S': - b = '$' - case '|': - // nothing to do - default: - errorf("unexpected escape sequence in export data") - } - } - p.data = p.data[r:] - p.read += r - return b - -} - -// ---------------------------------------------------------------------------- -// Export format - -// Tags. Must be < 0. -const ( - // Objects - packageTag = -(iota + 1) - constTag - typeTag - varTag - funcTag - endTag - - // Types - namedTag - arrayTag - sliceTag - dddTag - structTag - pointerTag - signatureTag - interfaceTag - mapTag - chanTag - - // Values - falseTag - trueTag - int64Tag - floatTag - fractionTag // not used by gc - complexTag - stringTag - nilTag // only used by gc (appears in exported inlined function bodies) - unknownTag // not used by gc (only appears in packages with errors) - - // Type aliases - aliasTag -) - var predeclOnce sync.Once var predecl []types.Type // initialized lazily diff --git a/vendor/golang.org/x/tools/internal/gcimporter/gcimporter.go b/vendor/golang.org/x/tools/internal/gcimporter/gcimporter.go index 0372fb3a6..2d078ccb1 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/gcimporter.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/gcimporter.go @@ -7,6 +7,18 @@ // Package gcimporter provides various functions for reading // gc-generated object files that can be used to implement the // Importer interface defined by the Go 1.5 standard library package. +// +// The encoding is deterministic: if the encoder is applied twice to +// the same types.Package data structure, both encodings are equal. +// This property may be important to avoid spurious changes in +// applications such as build systems. +// +// However, the encoder is not necessarily idempotent. Importing an +// exported package may yield a types.Package that, while it +// represents the same set of Go types as the original, may differ in +// the details of its internal representation. Because of these +// differences, re-encoding the imported package may yield a +// different, but equally valid, encoding of the package. package gcimporter // import "golang.org/x/tools/internal/gcimporter" import ( @@ -17,7 +29,6 @@ import ( "go/token" "go/types" "io" - "io/ioutil" "os" "os/exec" "path/filepath" @@ -209,7 +220,7 @@ func Import(packages map[string]*types.Package, path, srcDir string, lookup func switch hdr { case "$$B\n": var data []byte - data, err = ioutil.ReadAll(buf) + data, err = io.ReadAll(buf) if err != nil { break } @@ -218,20 +229,17 @@ func Import(packages map[string]*types.Package, path, srcDir string, lookup func // Or, define a new standard go/types/gcexportdata package. fset := token.NewFileSet() - // The indexed export format starts with an 'i'; the older - // binary export format starts with a 'c', 'd', or 'v' - // (from "version"). Select appropriate importer. + // Select appropriate importer. if len(data) > 0 { switch data[0] { - case 'i': - _, pkg, err := IImportData(fset, packages, data[1:], id) - return pkg, err + case 'v', 'c', 'd': // binary, till go1.10 + return nil, fmt.Errorf("binary (%c) import format is no longer supported", data[0]) - case 'v', 'c', 'd': - _, pkg, err := BImportData(fset, packages, data, id) + case 'i': // indexed, till go1.19 + _, pkg, err := IImportData(fset, packages, data[1:], id) return pkg, err - case 'u': + case 'u': // unified, from go1.20 _, pkg, err := UImportData(fset, packages, data[1:size], id) return pkg, err diff --git a/vendor/golang.org/x/tools/internal/gcimporter/iexport.go b/vendor/golang.org/x/tools/internal/gcimporter/iexport.go index ba53cdcdd..2ee8c7016 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/iexport.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/iexport.go @@ -22,17 +22,22 @@ import ( "strconv" "strings" + "golang.org/x/tools/go/types/objectpath" "golang.org/x/tools/internal/tokeninternal" - "golang.org/x/tools/internal/typeparams" ) // IExportShallow encodes "shallow" export data for the specified package. // -// No promises are made about the encoding other than that it can be -// decoded by the same version of IIExportShallow. If you plan to save -// export data in the file system, be sure to include a cryptographic -// digest of the executable in the key to avoid version skew. -func IExportShallow(fset *token.FileSet, pkg *types.Package) ([]byte, error) { +// No promises are made about the encoding other than that it can be decoded by +// the same version of IIExportShallow. If you plan to save export data in the +// file system, be sure to include a cryptographic digest of the executable in +// the key to avoid version skew. +// +// If the provided reportf func is non-nil, it will be used for reporting bugs +// encountered during export. +// TODO(rfindley): remove reportf when we are confident enough in the new +// objectpath encoding. +func IExportShallow(fset *token.FileSet, pkg *types.Package, reportf ReportFunc) ([]byte, error) { // In principle this operation can only fail if out.Write fails, // but that's impossible for bytes.Buffer---and as a matter of // fact iexportCommon doesn't even check for I/O errors. @@ -44,22 +49,30 @@ func IExportShallow(fset *token.FileSet, pkg *types.Package) ([]byte, error) { return out.Bytes(), err } -// IImportShallow decodes "shallow" types.Package data encoded by IExportShallow -// in the same executable. This function cannot import data from +// IImportShallow decodes "shallow" types.Package data encoded by +// IExportShallow in the same executable. This function cannot import data from // cmd/compile or gcexportdata.Write. -func IImportShallow(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string, insert InsertType) (*types.Package, error) { +// +// The importer calls getPackages to obtain package symbols for all +// packages mentioned in the export data, including the one being +// decoded. +// +// If the provided reportf func is non-nil, it will be used for reporting bugs +// encountered during import. +// TODO(rfindley): remove reportf when we are confident enough in the new +// objectpath encoding. +func IImportShallow(fset *token.FileSet, getPackages GetPackagesFunc, data []byte, path string, reportf ReportFunc) (*types.Package, error) { const bundle = false - pkgs, err := iimportCommon(fset, imports, data, bundle, path, insert) + const shallow = true + pkgs, err := iimportCommon(fset, getPackages, data, bundle, path, shallow, reportf) if err != nil { return nil, err } return pkgs[0], nil } -// InsertType is the type of a function that creates a types.TypeName -// object for a named type and inserts it into the scope of the -// specified Package. -type InsertType = func(pkg *types.Package, name string) +// ReportFunc is the type of a function used to report formatted bugs. +type ReportFunc = func(string, ...interface{}) // Current bundled export format version. Increase with each format change. // 0: initial implementation @@ -313,8 +326,9 @@ type iexporter struct { out *bytes.Buffer version int - shallow bool // don't put types from other packages in the index - localpkg *types.Package // (nil in bundle mode) + shallow bool // don't put types from other packages in the index + objEncoder *objectpath.Encoder // encodes objects from other packages in shallow mode; lazily allocated + localpkg *types.Package // (nil in bundle mode) // allPkgs tracks all packages that have been referenced by // the export data, so we can ensure to include them in the @@ -354,6 +368,17 @@ func (p *iexporter) trace(format string, args ...interface{}) { fmt.Printf(strings.Repeat("..", p.indent)+format+"\n", args...) } +// objectpathEncoder returns the lazily allocated objectpath.Encoder to use +// when encoding objects in other packages during shallow export. +// +// Using a shared Encoder amortizes some of cost of objectpath search. +func (p *iexporter) objectpathEncoder() *objectpath.Encoder { + if p.objEncoder == nil { + p.objEncoder = new(objectpath.Encoder) + } + return p.objEncoder +} + // stringOff returns the offset of s within the string section. // If not already present, it's added to the end. func (p *iexporter) stringOff(s string) uint64 { @@ -413,7 +438,6 @@ type exportWriter struct { p *iexporter data intWriter - currPkg *types.Package prevFile string prevLine int64 prevColumn int64 @@ -436,7 +460,6 @@ func (p *iexporter) doDecl(obj types.Object) { }() } w := p.newWriter() - w.setPkg(obj.Pkg(), false) switch obj := obj.(type) { case *types.Var: @@ -457,7 +480,7 @@ func (p *iexporter) doDecl(obj types.Object) { } // Function. - if typeparams.ForSignature(sig).Len() == 0 { + if sig.TypeParams().Len() == 0 { w.tag('F') } else { w.tag('G') @@ -470,7 +493,7 @@ func (p *iexporter) doDecl(obj types.Object) { // // While importing the type parameters, tparamList computes and records // their export name, so that it can be later used when writing the index. - if tparams := typeparams.ForSignature(sig); tparams.Len() > 0 { + if tparams := sig.TypeParams(); tparams.Len() > 0 { w.tparamList(obj.Name(), tparams, obj.Pkg()) } w.signature(sig) @@ -483,14 +506,14 @@ func (p *iexporter) doDecl(obj types.Object) { case *types.TypeName: t := obj.Type() - if tparam, ok := t.(*typeparams.TypeParam); ok { + if tparam, ok := t.(*types.TypeParam); ok { w.tag('P') w.pos(obj.Pos()) constraint := tparam.Constraint() if p.version >= iexportVersionGo1_18 { implicit := false if iface, _ := constraint.(*types.Interface); iface != nil { - implicit = typeparams.IsImplicit(iface) + implicit = iface.IsImplicit() } w.bool(implicit) } @@ -511,17 +534,17 @@ func (p *iexporter) doDecl(obj types.Object) { panic(internalErrorf("%s is not a defined type", t)) } - if typeparams.ForNamed(named).Len() == 0 { + if named.TypeParams().Len() == 0 { w.tag('T') } else { w.tag('U') } w.pos(obj.Pos()) - if typeparams.ForNamed(named).Len() > 0 { + if named.TypeParams().Len() > 0 { // While importing the type parameters, tparamList computes and records // their export name, so that it can be later used when writing the index. - w.tparamList(obj.Name(), typeparams.ForNamed(named), obj.Pkg()) + w.tparamList(obj.Name(), named.TypeParams(), obj.Pkg()) } underlying := obj.Type().Underlying() @@ -541,7 +564,7 @@ func (p *iexporter) doDecl(obj types.Object) { // Receiver type parameters are type arguments of the receiver type, so // their name must be qualified before exporting recv. - if rparams := typeparams.RecvTypeParams(sig); rparams.Len() > 0 { + if rparams := sig.RecvTypeParams(); rparams.Len() > 0 { prefix := obj.Name() + "." + m.Name() for i := 0; i < rparams.Len(); i++ { rparam := rparams.At(i) @@ -673,6 +696,9 @@ func (w *exportWriter) qualifiedType(obj *types.TypeName) { w.pkg(obj.Pkg()) } +// TODO(rfindley): what does 'pkg' even mean here? It would be better to pass +// it in explicitly into signatures and structs that may use it for +// constructing fields. func (w *exportWriter) typ(t types.Type, pkg *types.Package) { w.data.uint64(w.p.typOff(t, pkg)) } @@ -713,19 +739,19 @@ func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) { } switch t := t.(type) { case *types.Named: - if targs := typeparams.NamedTypeArgs(t); targs.Len() > 0 { + if targs := t.TypeArgs(); targs.Len() > 0 { w.startType(instanceType) // TODO(rfindley): investigate if this position is correct, and if it // matters. w.pos(t.Obj().Pos()) w.typeList(targs, pkg) - w.typ(typeparams.NamedTypeOrigin(t), pkg) + w.typ(t.Origin(), pkg) return } w.startType(definedType) w.qualifiedType(t.Obj()) - case *typeparams.TypeParam: + case *types.TypeParam: w.startType(typeParamType) w.qualifiedType(t.Obj()) @@ -764,30 +790,53 @@ func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) { case *types.Signature: w.startType(signatureType) - w.setPkg(pkg, true) + w.pkg(pkg) w.signature(t) case *types.Struct: w.startType(structType) n := t.NumFields() + // Even for struct{} we must emit some qualifying package, because that's + // what the compiler does, and thus that's what the importer expects. + fieldPkg := pkg if n > 0 { - w.setPkg(t.Field(0).Pkg(), true) // qualifying package for field objects - } else { - w.setPkg(pkg, true) + fieldPkg = t.Field(0).Pkg() + } + if fieldPkg == nil { + // TODO(rfindley): improve this very hacky logic. + // + // The importer expects a package to be set for all struct types, even + // those with no fields. A better encoding might be to set NumFields + // before pkg. setPkg panics with a nil package, which may be possible + // to reach with invalid packages (and perhaps valid packages, too?), so + // (arbitrarily) set the localpkg if available. + // + // Alternatively, we may be able to simply guarantee that pkg != nil, by + // reconsidering the encoding of constant values. + if w.p.shallow { + fieldPkg = w.p.localpkg + } else { + panic(internalErrorf("no package to set for empty struct")) + } } + w.pkg(fieldPkg) w.uint64(uint64(n)) + for i := 0; i < n; i++ { f := t.Field(i) + if w.p.shallow { + w.objectPath(f) + } w.pos(f.Pos()) w.string(f.Name()) // unexported fields implicitly qualified by prior setPkg - w.typ(f.Type(), pkg) + w.typ(f.Type(), fieldPkg) w.bool(f.Anonymous()) w.string(t.Tag(i)) // note (or tag) } case *types.Interface: w.startType(interfaceType) - w.setPkg(pkg, true) + w.pkg(pkg) n := t.NumEmbeddeds() w.uint64(uint64(n)) @@ -802,17 +851,23 @@ func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) { w.typ(ft, tPkg) } + // See comment for struct fields. In shallow mode we change the encoding + // for interface methods that are promoted from other packages. + n = t.NumExplicitMethods() w.uint64(uint64(n)) for i := 0; i < n; i++ { m := t.ExplicitMethod(i) + if w.p.shallow { + w.objectPath(m) + } w.pos(m.Pos()) w.string(m.Name()) sig, _ := m.Type().(*types.Signature) w.signature(sig) } - case *typeparams.Union: + case *types.Union: w.startType(unionType) nt := t.Len() w.uint64(uint64(nt)) @@ -827,12 +882,61 @@ func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) { } } -func (w *exportWriter) setPkg(pkg *types.Package, write bool) { - if write { - w.pkg(pkg) +// objectPath writes the package and objectPath to use to look up obj in a +// different package, when encoding in "shallow" mode. +// +// When doing a shallow import, the importer creates only the local package, +// and requests package symbols for dependencies from the client. +// However, certain types defined in the local package may hold objects defined +// (perhaps deeply) within another package. +// +// For example, consider the following: +// +// package a +// func F() chan * map[string] struct { X int } +// +// package b +// import "a" +// var B = a.F() +// +// In this example, the type of b.B holds fields defined in package a. +// In order to have the correct canonical objects for the field defined in the +// type of B, they are encoded as objectPaths and later looked up in the +// importer. The same problem applies to interface methods. +func (w *exportWriter) objectPath(obj types.Object) { + if obj.Pkg() == nil || obj.Pkg() == w.p.localpkg { + // obj.Pkg() may be nil for the builtin error.Error. + // In this case, or if obj is declared in the local package, no need to + // encode. + w.string("") + return } - - w.currPkg = pkg + objectPath, err := w.p.objectpathEncoder().For(obj) + if err != nil { + // Fall back to the empty string, which will cause the importer to create a + // new object, which matches earlier behavior. Creating a new object is + // sufficient for many purposes (such as type checking), but causes certain + // references algorithms to fail (golang/go#60819). However, we didn't + // notice this problem during months of gopls@v0.12.0 testing. + // + // TODO(golang/go#61674): this workaround is insufficient, as in the case + // where the field forwarded from an instantiated type that may not appear + // in the export data of the original package: + // + // // package a + // type A[P any] struct{ F P } + // + // // package b + // type B a.A[int] + // + // We need to update references algorithms not to depend on this + // de-duplication, at which point we may want to simply remove the + // workaround here. + w.string("") + return + } + w.string(string(objectPath)) + w.pkg(obj.Pkg()) } func (w *exportWriter) signature(sig *types.Signature) { @@ -843,14 +947,14 @@ func (w *exportWriter) signature(sig *types.Signature) { } } -func (w *exportWriter) typeList(ts *typeparams.TypeList, pkg *types.Package) { +func (w *exportWriter) typeList(ts *types.TypeList, pkg *types.Package) { w.uint64(uint64(ts.Len())) for i := 0; i < ts.Len(); i++ { w.typ(ts.At(i), pkg) } } -func (w *exportWriter) tparamList(prefix string, list *typeparams.TypeParamList, pkg *types.Package) { +func (w *exportWriter) tparamList(prefix string, list *types.TypeParamList, pkg *types.Package) { ll := uint64(list.Len()) w.uint64(ll) for i := 0; i < list.Len(); i++ { @@ -868,7 +972,7 @@ const blankMarker = "$" // differs from its actual object name: it is prefixed with a qualifier, and // blank type parameter names are disambiguated by their index in the type // parameter list. -func tparamExportName(prefix string, tparam *typeparams.TypeParam) string { +func tparamExportName(prefix string, tparam *types.TypeParam) string { assert(prefix != "") name := tparam.Obj().Name() if name == "_" { @@ -913,6 +1017,17 @@ func (w *exportWriter) value(typ types.Type, v constant.Value) { w.int64(int64(v.Kind())) } + if v.Kind() == constant.Unknown { + // golang/go#60605: treat unknown constant values as if they have invalid type + // + // This loses some fidelity over the package type-checked from source, but that + // is acceptable. + // + // TODO(rfindley): we should switch on the recorded constant kind rather + // than the constant type + return + } + switch b := typ.Underlying().(*types.Basic); b.Info() & types.IsConstType { case types.IsBoolean: w.bool(constant.BoolVal(v)) @@ -969,6 +1084,16 @@ func constantToFloat(x constant.Value) *big.Float { return &f } +func valueToRat(x constant.Value) *big.Rat { + // Convert little-endian to big-endian. + // I can't believe this is necessary. + bytes := constant.Bytes(x) + for i := 0; i < len(bytes)/2; i++ { + bytes[i], bytes[len(bytes)-1-i] = bytes[len(bytes)-1-i], bytes[i] + } + return new(big.Rat).SetInt(new(big.Int).SetBytes(bytes)) +} + // mpint exports a multi-precision integer. // // For unsigned types, small values are written out as a single @@ -1178,3 +1303,19 @@ func (q *objQueue) popHead() types.Object { q.head++ return obj } + +// internalError represents an error generated inside this package. +type internalError string + +func (e internalError) Error() string { return "gcimporter: " + string(e) } + +// TODO(adonovan): make this call panic, so that it's symmetric with errorf. +// Otherwise it's easy to forget to do anything with the error. +// +// TODO(adonovan): also, consider switching the names "errorf" and +// "internalErrorf" as the former is used for bugs, whose cause is +// internal inconsistency, whereas the latter is used for ordinary +// situations like bad input, whose cause is external. +func internalErrorf(format string, args ...interface{}) error { + return internalError(fmt.Sprintf(format, args...)) +} diff --git a/vendor/golang.org/x/tools/internal/gcimporter/iimport.go b/vendor/golang.org/x/tools/internal/gcimporter/iimport.go index 448f903e8..9bde15e3b 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/iimport.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/iimport.go @@ -21,7 +21,7 @@ import ( "sort" "strings" - "golang.org/x/tools/internal/typeparams" + "golang.org/x/tools/go/types/objectpath" ) type intReader struct { @@ -85,7 +85,7 @@ const ( // If the export data version is not recognized or the format is otherwise // compromised, an error is returned. func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (int, *types.Package, error) { - pkgs, err := iimportCommon(fset, imports, data, false, path, nil) + pkgs, err := iimportCommon(fset, GetPackagesFromMap(imports), data, false, path, false, nil) if err != nil { return 0, nil, err } @@ -94,10 +94,49 @@ func IImportData(fset *token.FileSet, imports map[string]*types.Package, data [] // IImportBundle imports a set of packages from the serialized package bundle. func IImportBundle(fset *token.FileSet, imports map[string]*types.Package, data []byte) ([]*types.Package, error) { - return iimportCommon(fset, imports, data, true, "", nil) + return iimportCommon(fset, GetPackagesFromMap(imports), data, true, "", false, nil) } -func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data []byte, bundle bool, path string, insert InsertType) (pkgs []*types.Package, err error) { +// A GetPackagesFunc function obtains the non-nil symbols for a set of +// packages, creating and recursively importing them as needed. An +// implementation should store each package symbol is in the Pkg +// field of the items array. +// +// Any error causes importing to fail. This can be used to quickly read +// the import manifest of an export data file without fully decoding it. +type GetPackagesFunc = func(items []GetPackagesItem) error + +// A GetPackagesItem is a request from the importer for the package +// symbol of the specified name and path. +type GetPackagesItem struct { + Name, Path string + Pkg *types.Package // to be filled in by GetPackagesFunc call + + // private importer state + pathOffset uint64 + nameIndex map[string]uint64 +} + +// GetPackagesFromMap returns a GetPackagesFunc that retrieves +// packages from the given map of package path to package. +// +// The returned function may mutate m: each requested package that is not +// found is created with types.NewPackage and inserted into m. +func GetPackagesFromMap(m map[string]*types.Package) GetPackagesFunc { + return func(items []GetPackagesItem) error { + for i, item := range items { + pkg, ok := m[item.Path] + if !ok { + pkg = types.NewPackage(item.Path, item.Name) + m[item.Path] = pkg + } + items[i].Pkg = pkg + } + return nil + } +} + +func iimportCommon(fset *token.FileSet, getPackages GetPackagesFunc, data []byte, bundle bool, path string, shallow bool, reportf ReportFunc) (pkgs []*types.Package, err error) { const currentVersion = iexportVersionCurrent version := int64(-1) if !debug { @@ -108,7 +147,7 @@ func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data } else if version > currentVersion { err = fmt.Errorf("cannot import %q (%v), export data is newer version - update tool", path, e) } else { - err = fmt.Errorf("cannot import %q (%v), possibly version skew - reinstall package", path, e) + err = fmt.Errorf("internal error while importing %q (%v); please report an issue", path, e) } } }() @@ -117,11 +156,8 @@ func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data r := &intReader{bytes.NewReader(data), path} if bundle { - bundleVersion := r.uint64() - switch bundleVersion { - case bundleVersion: - default: - errorf("unknown bundle format version %d", bundleVersion) + if v := r.uint64(); v != bundleVersion { + errorf("unknown bundle format version %d", v) } } @@ -139,7 +175,7 @@ func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data sLen := int64(r.uint64()) var fLen int64 var fileOffset []uint64 - if insert != nil { + if shallow { // Shallow mode uses a different position encoding. fLen = int64(r.uint64()) fileOffset = make([]uint64, r.uint64()) @@ -158,7 +194,8 @@ func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data p := iimporter{ version: int(version), ipath: path, - insert: insert, + shallow: shallow, + reportf: reportf, stringData: stringData, stringCache: make(map[uint64]string), @@ -185,8 +222,9 @@ func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data p.typCache[uint64(i)] = pt } - pkgList := make([]*types.Package, r.uint64()) - for i := range pkgList { + // Gather the relevant packages from the manifest. + items := make([]GetPackagesItem, r.uint64()) + for i := range items { pkgPathOff := r.uint64() pkgPath := p.stringAt(pkgPathOff) pkgName := p.stringAt(r.uint64()) @@ -195,30 +233,42 @@ func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data if pkgPath == "" { pkgPath = path } - pkg := imports[pkgPath] - if pkg == nil { - pkg = types.NewPackage(pkgPath, pkgName) - imports[pkgPath] = pkg - } else if pkg.Name() != pkgName { - errorf("conflicting names %s and %s for package %q", pkg.Name(), pkgName, path) - } - if i == 0 && !bundle { - p.localpkg = pkg - } - - p.pkgCache[pkgPathOff] = pkg + items[i].Name = pkgName + items[i].Path = pkgPath + items[i].pathOffset = pkgPathOff // Read index for package. nameIndex := make(map[string]uint64) nSyms := r.uint64() - // In shallow mode we don't expect an index for other packages. - assert(nSyms == 0 || p.localpkg == pkg || p.insert == nil) + // In shallow mode, only the current package (i=0) has an index. + assert(!(shallow && i > 0 && nSyms != 0)) for ; nSyms > 0; nSyms-- { name := p.stringAt(r.uint64()) nameIndex[name] = r.uint64() } - p.pkgIndex[pkg] = nameIndex + items[i].nameIndex = nameIndex + } + + // Request packages all at once from the client, + // enabling a parallel implementation. + if err := getPackages(items); err != nil { + return nil, err // don't wrap this error + } + + // Check the results and complete the index. + pkgList := make([]*types.Package, len(items)) + for i, item := range items { + pkg := item.Pkg + if pkg == nil { + errorf("internal error: getPackages returned nil package for %q", item.Path) + } else if pkg.Path() != item.Path { + errorf("internal error: getPackages returned wrong path %q, want %q", pkg.Path(), item.Path) + } else if pkg.Name() != item.Name { + errorf("internal error: getPackages returned wrong name %s for package %q, want %s", pkg.Name(), item.Path, item.Name) + } + p.pkgCache[item.pathOffset] = pkg + p.pkgIndex[pkg] = item.nameIndex pkgList[i] = pkg } @@ -270,18 +320,25 @@ func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data // Therefore, we defer calling SetConstraint there, and call it here instead // after all types are complete. for _, d := range p.later { - typeparams.SetTypeParamConstraint(d.t, d.constraint) + d.t.SetConstraint(d.constraint) } for _, typ := range p.interfaceList { typ.Complete() } + // Workaround for golang/go#61561. See the doc for instanceList for details. + for _, typ := range p.instanceList { + if iface, _ := typ.Underlying().(*types.Interface); iface != nil { + iface.Complete() + } + } + return pkgs, nil } type setConstraintArgs struct { - t *typeparams.TypeParam + t *types.TypeParam constraint types.Type } @@ -289,8 +346,8 @@ type iimporter struct { version int ipath string - localpkg *types.Package - insert func(pkg *types.Package, name string) // "shallow" mode only + shallow bool + reportf ReportFunc // if non-nil, used to report bugs stringData []byte stringCache map[uint64]string @@ -307,6 +364,12 @@ type iimporter struct { fake fakeFileSet interfaceList []*types.Interface + // Workaround for the go/types bug golang/go#61561: instances produced during + // instantiation may contain incomplete interfaces. Here we only complete the + // underlying type of the instance, which is the most common case but doesn't + // handle parameterized interface literals defined deeper in the type. + instanceList []types.Type // instances for later completion (see golang/go#61561) + // Arguments for calls to SetConstraint that are deferred due to recursive types later []setConstraintArgs @@ -338,13 +401,9 @@ func (p *iimporter) doDecl(pkg *types.Package, name string) { off, ok := p.pkgIndex[pkg][name] if !ok { - // In "shallow" mode, call back to the application to - // find the object and insert it into the package scope. - if p.insert != nil { - assert(pkg != p.localpkg) - p.insert(pkg, name) // "can't fail" - return - } + // In deep mode, the index should be complete. In shallow + // mode, we should have already recursively loaded necessary + // dependencies so the above Lookup succeeds. errorf("%v.%v not in index", pkg, name) } @@ -489,7 +548,7 @@ func (r *importReader) obj(name string) { r.declare(types.NewConst(pos, r.currPkg, name, typ, val)) case 'F', 'G': - var tparams []*typeparams.TypeParam + var tparams []*types.TypeParam if tag == 'G' { tparams = r.tparamList() } @@ -506,7 +565,7 @@ func (r *importReader) obj(name string) { r.declare(obj) if tag == 'U' { tparams := r.tparamList() - typeparams.SetForNamed(named, tparams) + named.SetTypeParams(tparams) } underlying := r.p.typAt(r.uint64(), named).Underlying() @@ -523,12 +582,12 @@ func (r *importReader) obj(name string) { // typeparams being used in the method sig/body). base := baseType(recv.Type()) assert(base != nil) - targs := typeparams.NamedTypeArgs(base) - var rparams []*typeparams.TypeParam + targs := base.TypeArgs() + var rparams []*types.TypeParam if targs.Len() > 0 { - rparams = make([]*typeparams.TypeParam, targs.Len()) + rparams = make([]*types.TypeParam, targs.Len()) for i := range rparams { - rparams[i] = targs.At(i).(*typeparams.TypeParam) + rparams[i] = targs.At(i).(*types.TypeParam) } } msig := r.signature(recv, rparams, nil) @@ -546,7 +605,7 @@ func (r *importReader) obj(name string) { } name0 := tparamName(name) tn := types.NewTypeName(pos, r.currPkg, name0, nil) - t := typeparams.NewTypeParam(tn, nil) + t := types.NewTypeParam(tn, nil) // To handle recursive references to the typeparam within its // bound, save the partial type in tparamIndex before reading the bounds. @@ -562,7 +621,7 @@ func (r *importReader) obj(name string) { if iface == nil { errorf("non-interface constraint marked implicit") } - typeparams.MarkImplicit(iface) + iface.MarkImplicit() } // The constraint type may not be complete, if we // are in the middle of a type recursion involving type @@ -711,7 +770,8 @@ func (r *importReader) qualifiedIdent() (*types.Package, string) { } func (r *importReader) pos() token.Pos { - if r.p.insert != nil { // shallow mode + if r.p.shallow { + // precise offsets are encoded only in shallow mode return r.posv2() } if r.p.version >= iexportVersionPosCol { @@ -812,13 +872,28 @@ func (r *importReader) doType(base *types.Named) (res types.Type) { fields := make([]*types.Var, r.uint64()) tags := make([]string, len(fields)) for i := range fields { + var field *types.Var + if r.p.shallow { + field, _ = r.objectPathObject().(*types.Var) + } + fpos := r.pos() fname := r.ident() ftyp := r.typ() emb := r.bool() tag := r.string() - fields[i] = types.NewField(fpos, r.currPkg, fname, ftyp, emb) + // Either this is not a shallow import, the field is local, or the + // encoded objectPath failed to produce an object (a bug). + // + // Even in this last, buggy case, fall back on creating a new field. As + // discussed in iexport.go, this is not correct, but mostly works and is + // preferable to failing (for now at least). + if field == nil { + field = types.NewField(fpos, r.currPkg, fname, ftyp, emb) + } + + fields[i] = field tags[i] = tag } return types.NewStruct(fields, tags) @@ -834,6 +909,11 @@ func (r *importReader) doType(base *types.Named) (res types.Type) { methods := make([]*types.Func, r.uint64()) for i := range methods { + var method *types.Func + if r.p.shallow { + method, _ = r.objectPathObject().(*types.Func) + } + mpos := r.pos() mname := r.ident() @@ -843,9 +923,12 @@ func (r *importReader) doType(base *types.Named) (res types.Type) { if base != nil { recv = types.NewVar(token.NoPos, r.currPkg, "", base) } - msig := r.signature(recv, nil, nil) - methods[i] = types.NewFunc(mpos, r.currPkg, mname, msig) + + if method == nil { + method = types.NewFunc(mpos, r.currPkg, mname, msig) + } + methods[i] = method } typ := newInterface(methods, embeddeds) @@ -882,18 +965,21 @@ func (r *importReader) doType(base *types.Named) (res types.Type) { // The imported instantiated type doesn't include any methods, so // we must always use the methods of the base (orig) type. // TODO provide a non-nil *Environment - t, _ := typeparams.Instantiate(nil, baseType, targs, false) + t, _ := types.Instantiate(nil, baseType, targs, false) + + // Workaround for golang/go#61561. See the doc for instanceList for details. + r.p.instanceList = append(r.p.instanceList, t) return t case unionType: if r.p.version < iexportVersionGenerics { errorf("unexpected instantiation type") } - terms := make([]*typeparams.Term, r.uint64()) + terms := make([]*types.Term, r.uint64()) for i := range terms { - terms[i] = typeparams.NewTerm(r.bool(), r.typ()) + terms[i] = types.NewTerm(r.bool(), r.typ()) } - return typeparams.NewUnion(terms) + return types.NewUnion(terms) } } @@ -901,23 +987,43 @@ func (r *importReader) kind() itag { return itag(r.uint64()) } -func (r *importReader) signature(recv *types.Var, rparams []*typeparams.TypeParam, tparams []*typeparams.TypeParam) *types.Signature { +// objectPathObject is the inverse of exportWriter.objectPath. +// +// In shallow mode, certain fields and methods may need to be looked up in an +// imported package. See the doc for exportWriter.objectPath for a full +// explanation. +func (r *importReader) objectPathObject() types.Object { + objPath := objectpath.Path(r.string()) + if objPath == "" { + return nil + } + pkg := r.pkg() + obj, err := objectpath.Object(pkg, objPath) + if err != nil { + if r.p.reportf != nil { + r.p.reportf("failed to find object for objectPath %q: %v", objPath, err) + } + } + return obj +} + +func (r *importReader) signature(recv *types.Var, rparams []*types.TypeParam, tparams []*types.TypeParam) *types.Signature { params := r.paramList() results := r.paramList() variadic := params.Len() > 0 && r.bool() - return typeparams.NewSignatureType(recv, rparams, tparams, params, results, variadic) + return types.NewSignatureType(recv, rparams, tparams, params, results, variadic) } -func (r *importReader) tparamList() []*typeparams.TypeParam { +func (r *importReader) tparamList() []*types.TypeParam { n := r.uint64() if n == 0 { return nil } - xs := make([]*typeparams.TypeParam, n) + xs := make([]*types.TypeParam, n) for i := range xs { // Note: the standard library importer is tolerant of nil types here, // though would panic in SetTypeParams. - xs[i] = r.typ().(*typeparams.TypeParam) + xs[i] = r.typ().(*types.TypeParam) } return xs } diff --git a/vendor/golang.org/x/tools/internal/gcimporter/ureader_yes.go b/vendor/golang.org/x/tools/internal/gcimporter/ureader_yes.go index b285a11ce..b977435f6 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/ureader_yes.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/ureader_yes.go @@ -10,8 +10,10 @@ package gcimporter import ( + "fmt" "go/token" "go/types" + "sort" "strings" "golang.org/x/tools/internal/pkgbits" @@ -62,6 +64,14 @@ type typeInfo struct { } func UImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (_ int, pkg *types.Package, err error) { + if !debug { + defer func() { + if x := recover(); x != nil { + err = fmt.Errorf("internal error in importing %q (%v); please report an issue", path, x) + } + }() + } + s := string(data) s = s[:strings.LastIndex(s, "\n$$\n")] input := pkgbits.NewPkgDecoder(path, s) @@ -121,6 +131,16 @@ func readUnifiedPackage(fset *token.FileSet, ctxt *types.Context, imports map[st iface.Complete() } + // Imports() of pkg are all of the transitive packages that were loaded. + var imps []*types.Package + for _, imp := range pr.pkgs { + if imp != nil && imp != pkg { + imps = append(imps, imp) + } + } + sort.Sort(byPath(imps)) + pkg.SetImports(imps) + pkg.MarkComplete() return pkg } @@ -260,39 +280,9 @@ func (r *reader) doPkg() *types.Package { pkg := types.NewPackage(path, name) r.p.imports[path] = pkg - imports := make([]*types.Package, r.Len()) - for i := range imports { - imports[i] = r.pkg() - } - pkg.SetImports(flattenImports(imports)) - return pkg } -// flattenImports returns the transitive closure of all imported -// packages rooted from pkgs. -func flattenImports(pkgs []*types.Package) []*types.Package { - var res []*types.Package - seen := make(map[*types.Package]struct{}) - for _, pkg := range pkgs { - if _, ok := seen[pkg]; ok { - continue - } - seen[pkg] = struct{}{} - res = append(res, pkg) - - // pkg.Imports() is already flattened. - for _, pkg := range pkg.Imports() { - if _, ok := seen[pkg]; ok { - continue - } - seen[pkg] = struct{}{} - res = append(res, pkg) - } - } - return res -} - // @@@ Types func (r *reader) typ() types.Type { diff --git a/vendor/golang.org/x/tools/internal/gocommand/invoke.go b/vendor/golang.org/x/tools/internal/gocommand/invoke.go index d50551693..55312522d 100644 --- a/vendor/golang.org/x/tools/internal/gocommand/invoke.go +++ b/vendor/golang.org/x/tools/internal/gocommand/invoke.go @@ -8,10 +8,13 @@ package gocommand import ( "bytes" "context" + "errors" "fmt" "io" "log" "os" + "os/exec" + "reflect" "regexp" "runtime" "strconv" @@ -19,9 +22,10 @@ import ( "sync" "time" - exec "golang.org/x/sys/execabs" - "golang.org/x/tools/internal/event" + "golang.org/x/tools/internal/event/keys" + "golang.org/x/tools/internal/event/label" + "golang.org/x/tools/internal/event/tag" ) // An Runner will run go command invocations and serialize @@ -51,9 +55,19 @@ func (runner *Runner) initialize() { // 1.14: go: updating go.mod: existing contents have changed since last read var modConcurrencyError = regexp.MustCompile(`go:.*go.mod.*contents have changed`) +// verb is an event label for the go command verb. +var verb = keys.NewString("verb", "go command verb") + +func invLabels(inv Invocation) []label.Label { + return []label.Label{verb.Of(inv.Verb), tag.Directory.Of(inv.WorkingDir)} +} + // Run is a convenience wrapper around RunRaw. // It returns only stdout and a "friendly" error. func (runner *Runner) Run(ctx context.Context, inv Invocation) (*bytes.Buffer, error) { + ctx, done := event.Start(ctx, "gocommand.Runner.Run", invLabels(inv)...) + defer done() + stdout, _, friendly, _ := runner.RunRaw(ctx, inv) return stdout, friendly } @@ -61,13 +75,19 @@ func (runner *Runner) Run(ctx context.Context, inv Invocation) (*bytes.Buffer, e // RunPiped runs the invocation serially, always waiting for any concurrent // invocations to complete first. func (runner *Runner) RunPiped(ctx context.Context, inv Invocation, stdout, stderr io.Writer) error { + ctx, done := event.Start(ctx, "gocommand.Runner.RunPiped", invLabels(inv)...) + defer done() + _, err := runner.runPiped(ctx, inv, stdout, stderr) return err } // RunRaw runs the invocation, serializing requests only if they fight over // go.mod changes. +// Postcondition: both error results have same nilness. func (runner *Runner) RunRaw(ctx context.Context, inv Invocation) (*bytes.Buffer, *bytes.Buffer, error, error) { + ctx, done := event.Start(ctx, "gocommand.Runner.RunRaw", invLabels(inv)...) + defer done() // Make sure the runner is always initialized. runner.initialize() @@ -75,23 +95,24 @@ func (runner *Runner) RunRaw(ctx context.Context, inv Invocation) (*bytes.Buffer stdout, stderr, friendlyErr, err := runner.runConcurrent(ctx, inv) // If we encounter a load concurrency error, we need to retry serially. - if friendlyErr == nil || !modConcurrencyError.MatchString(friendlyErr.Error()) { - return stdout, stderr, friendlyErr, err + if friendlyErr != nil && modConcurrencyError.MatchString(friendlyErr.Error()) { + event.Error(ctx, "Load concurrency error, will retry serially", err) + + // Run serially by calling runPiped. + stdout.Reset() + stderr.Reset() + friendlyErr, err = runner.runPiped(ctx, inv, stdout, stderr) } - event.Error(ctx, "Load concurrency error, will retry serially", err) - // Run serially by calling runPiped. - stdout.Reset() - stderr.Reset() - friendlyErr, err = runner.runPiped(ctx, inv, stdout, stderr) return stdout, stderr, friendlyErr, err } +// Postcondition: both error results have same nilness. func (runner *Runner) runConcurrent(ctx context.Context, inv Invocation) (*bytes.Buffer, *bytes.Buffer, error, error) { // Wait for 1 worker to become available. select { case <-ctx.Done(): - return nil, nil, nil, ctx.Err() + return nil, nil, ctx.Err(), ctx.Err() case runner.inFlight <- struct{}{}: defer func() { <-runner.inFlight }() } @@ -101,6 +122,7 @@ func (runner *Runner) runConcurrent(ctx context.Context, inv Invocation) (*bytes return stdout, stderr, friendlyErr, err } +// Postcondition: both error results have same nilness. func (runner *Runner) runPiped(ctx context.Context, inv Invocation, stdout, stderr io.Writer) (error, error) { // Make sure the runner is always initialized. runner.initialize() @@ -109,7 +131,7 @@ func (runner *Runner) runPiped(ctx context.Context, inv Invocation, stdout, stde // runPiped commands. select { case <-ctx.Done(): - return nil, ctx.Err() + return ctx.Err(), ctx.Err() case runner.serialized <- struct{}{}: defer func() { <-runner.serialized }() } @@ -119,7 +141,7 @@ func (runner *Runner) runPiped(ctx context.Context, inv Invocation, stdout, stde for i := 0; i < maxInFlight; i++ { select { case <-ctx.Done(): - return nil, ctx.Err() + return ctx.Err(), ctx.Err() case runner.inFlight <- struct{}{}: // Make sure we always "return" any workers we took. defer func() { <-runner.inFlight }() @@ -152,6 +174,7 @@ type Invocation struct { Logf func(format string, args ...interface{}) } +// Postcondition: both error results have same nilness. func (i *Invocation) runWithFriendlyError(ctx context.Context, stdout, stderr io.Writer) (friendlyError error, rawError error) { rawError = i.run(ctx, stdout, stderr) if rawError != nil { @@ -215,6 +238,18 @@ func (i *Invocation) run(ctx context.Context, stdout, stderr io.Writer) error { cmd := exec.Command("go", goArgs...) cmd.Stdout = stdout cmd.Stderr = stderr + + // cmd.WaitDelay was added only in go1.20 (see #50436). + if waitDelay := reflect.ValueOf(cmd).Elem().FieldByName("WaitDelay"); waitDelay.IsValid() { + // https://go.dev/issue/59541: don't wait forever copying stderr + // after the command has exited. + // After CL 484741 we copy stdout manually, so we we'll stop reading that as + // soon as ctx is done. However, we also don't want to wait around forever + // for stderr. Give a much-longer-than-reasonable delay and then assume that + // something has wedged in the kernel or runtime. + waitDelay.Set(reflect.ValueOf(30 * time.Second)) + } + // On darwin the cwd gets resolved to the real path, which breaks anything that // expects the working directory to keep the original path, including the // go command when dealing with modules. @@ -229,6 +264,7 @@ func (i *Invocation) run(ctx context.Context, stdout, stderr io.Writer) error { cmd.Env = append(cmd.Env, "PWD="+i.WorkingDir) cmd.Dir = i.WorkingDir } + defer func(start time.Time) { log("%s for %v", time.Since(start), cmdDebugStr(cmd)) }(time.Now()) return runCmdContext(ctx, cmd) @@ -242,10 +278,85 @@ var DebugHangingGoCommands = false // runCmdContext is like exec.CommandContext except it sends os.Interrupt // before os.Kill. -func runCmdContext(ctx context.Context, cmd *exec.Cmd) error { - if err := cmd.Start(); err != nil { +func runCmdContext(ctx context.Context, cmd *exec.Cmd) (err error) { + // If cmd.Stdout is not an *os.File, the exec package will create a pipe and + // copy it to the Writer in a goroutine until the process has finished and + // either the pipe reaches EOF or command's WaitDelay expires. + // + // However, the output from 'go list' can be quite large, and we don't want to + // keep reading (and allocating buffers) if we've already decided we don't + // care about the output. We don't want to wait for the process to finish, and + // we don't wait to wait for the WaitDelay to expire either. + // + // Instead, if cmd.Stdout requires a copying goroutine we explicitly replace + // it with a pipe (which is an *os.File), which we can close in order to stop + // copying output as soon as we realize we don't care about it. + var stdoutW *os.File + if cmd.Stdout != nil { + if _, ok := cmd.Stdout.(*os.File); !ok { + var stdoutR *os.File + stdoutR, stdoutW, err = os.Pipe() + if err != nil { + return err + } + prevStdout := cmd.Stdout + cmd.Stdout = stdoutW + + stdoutErr := make(chan error, 1) + go func() { + _, err := io.Copy(prevStdout, stdoutR) + if err != nil { + err = fmt.Errorf("copying stdout: %w", err) + } + stdoutErr <- err + }() + defer func() { + // We started a goroutine to copy a stdout pipe. + // Wait for it to finish, or terminate it if need be. + var err2 error + select { + case err2 = <-stdoutErr: + stdoutR.Close() + case <-ctx.Done(): + stdoutR.Close() + // Per https://pkg.go.dev/os#File.Close, the call to stdoutR.Close + // should cause the Read call in io.Copy to unblock and return + // immediately, but we still need to receive from stdoutErr to confirm + // that it has happened. + <-stdoutErr + err2 = ctx.Err() + } + if err == nil { + err = err2 + } + }() + + // Per https://pkg.go.dev/os/exec#Cmd, ā€œIf Stdout and Stderr are the + // same writer, and have a type that can be compared with ==, at most + // one goroutine at a time will call Write.ā€ + // + // Since we're starting a goroutine that writes to cmd.Stdout, we must + // also update cmd.Stderr so that it still holds. + func() { + defer func() { recover() }() + if cmd.Stderr == prevStdout { + cmd.Stderr = cmd.Stdout + } + }() + } + } + + err = cmd.Start() + if stdoutW != nil { + // The child process has inherited the pipe file, + // so close the copy held in this process. + stdoutW.Close() + stdoutW = nil + } + if err != nil { return err } + resChan := make(chan error, 1) go func() { resChan <- cmd.Wait() @@ -253,11 +364,14 @@ func runCmdContext(ctx context.Context, cmd *exec.Cmd) error { // If we're interested in debugging hanging Go commands, stop waiting after a // minute and panic with interesting information. - if DebugHangingGoCommands { + debug := DebugHangingGoCommands + if debug { + timer := time.NewTimer(1 * time.Minute) + defer timer.Stop() select { case err := <-resChan: return err - case <-time.After(1 * time.Minute): + case <-timer.C: HandleHangingGoCommand(cmd.Process) case <-ctx.Done(): } @@ -270,30 +384,25 @@ func runCmdContext(ctx context.Context, cmd *exec.Cmd) error { } // Cancelled. Interrupt and see if it ends voluntarily. - cmd.Process.Signal(os.Interrupt) - select { - case err := <-resChan: - return err - case <-time.After(time.Second): + if err := cmd.Process.Signal(os.Interrupt); err == nil { + // (We used to wait only 1s but this proved + // fragile on loaded builder machines.) + timer := time.NewTimer(5 * time.Second) + defer timer.Stop() + select { + case err := <-resChan: + return err + case <-timer.C: + } } // Didn't shut down in response to interrupt. Kill it hard. // TODO(rfindley): per advice from bcmills@, it may be better to send SIGQUIT // on certain platforms, such as unix. - if err := cmd.Process.Kill(); err != nil && DebugHangingGoCommands { - // Don't panic here as this reliably fails on windows with EINVAL. + if err := cmd.Process.Kill(); err != nil && !errors.Is(err, os.ErrProcessDone) && debug { log.Printf("error killing the Go command: %v", err) } - // See above: don't wait indefinitely if we're debugging hanging Go commands. - if DebugHangingGoCommands { - select { - case err := <-resChan: - return err - case <-time.After(10 * time.Second): // a shorter wait as resChan should return quickly following Kill - HandleHangingGoCommand(cmd.Process) - } - } return <-resChan } diff --git a/vendor/golang.org/x/tools/internal/gocommand/version.go b/vendor/golang.org/x/tools/internal/gocommand/version.go index 307a76d47..446c5846a 100644 --- a/vendor/golang.org/x/tools/internal/gocommand/version.go +++ b/vendor/golang.org/x/tools/internal/gocommand/version.go @@ -23,21 +23,11 @@ import ( func GoVersion(ctx context.Context, inv Invocation, r *Runner) (int, error) { inv.Verb = "list" inv.Args = []string{"-e", "-f", `{{context.ReleaseTags}}`, `--`, `unsafe`} - inv.Env = append(append([]string{}, inv.Env...), "GO111MODULE=off") - // Unset any unneeded flags, and remove them from BuildFlags, if they're - // present. - inv.ModFile = "" + inv.BuildFlags = nil // This is not a build command. inv.ModFlag = "" - var buildFlags []string - for _, flag := range inv.BuildFlags { - // Flags can be prefixed by one or two dashes. - f := strings.TrimPrefix(strings.TrimPrefix(flag, "-"), "-") - if strings.HasPrefix(f, "mod=") || strings.HasPrefix(f, "modfile=") { - continue - } - buildFlags = append(buildFlags, flag) - } - inv.BuildFlags = buildFlags + inv.ModFile = "" + inv.Env = append(inv.Env[:len(inv.Env):len(inv.Env)], "GO111MODULE=off") + stdoutBytes, err := r.Run(ctx, inv) if err != nil { return 0, err diff --git a/vendor/golang.org/x/tools/internal/gopathwalk/walk.go b/vendor/golang.org/x/tools/internal/gopathwalk/walk.go index 168405322..52f74e643 100644 --- a/vendor/golang.org/x/tools/internal/gopathwalk/walk.go +++ b/vendor/golang.org/x/tools/internal/gopathwalk/walk.go @@ -9,15 +9,12 @@ package gopathwalk import ( "bufio" "bytes" - "fmt" - "io/ioutil" + "io/fs" "log" "os" "path/filepath" "strings" "time" - - "golang.org/x/tools/internal/fastwalk" ) // Options controls the behavior of a Walk call. @@ -47,21 +44,18 @@ type Root struct { } // Walk walks Go source directories ($GOROOT, $GOPATH, etc) to find packages. -// For each package found, add will be called (concurrently) with the absolute +// For each package found, add will be called with the absolute // paths of the containing source directory and the package directory. -// add will be called concurrently. func Walk(roots []Root, add func(root Root, dir string), opts Options) { WalkSkip(roots, add, func(Root, string) bool { return false }, opts) } // WalkSkip walks Go source directories ($GOROOT, $GOPATH, etc) to find packages. -// For each package found, add will be called (concurrently) with the absolute +// For each package found, add will be called with the absolute // paths of the containing source directory and the package directory. -// For each directory that will be scanned, skip will be called (concurrently) +// For each directory that will be scanned, skip will be called // with the absolute paths of the containing source directory and the directory. // If skip returns false on a directory it will be processed. -// add will be called concurrently. -// skip will be called concurrently. func WalkSkip(roots []Root, add func(root Root, dir string), skip func(root Root, dir string) bool, opts Options) { for _, root := range roots { walkDir(root, add, skip, opts) @@ -78,21 +72,36 @@ func walkDir(root Root, add func(Root, string), skip func(root Root, dir string) } start := time.Now() if opts.Logf != nil { - opts.Logf("gopathwalk: scanning %s", root.Path) + opts.Logf("scanning %s", root.Path) } + w := &walker{ - root: root, - add: add, - skip: skip, - opts: opts, + root: root, + add: add, + skip: skip, + opts: opts, + added: make(map[string]bool), } w.init() - if err := fastwalk.Walk(root.Path, w.walk); err != nil { - log.Printf("gopathwalk: scanning directory %v: %v", root.Path, err) + + // Add a trailing path separator to cause filepath.WalkDir to traverse symlinks. + path := root.Path + if len(path) == 0 { + path = "." + string(filepath.Separator) + } else if !os.IsPathSeparator(path[len(path)-1]) { + path = path + string(filepath.Separator) + } + + if err := filepath.WalkDir(path, w.walk); err != nil { + logf := opts.Logf + if logf == nil { + logf = log.Printf + } + logf("scanning directory %v: %v", root.Path, err) } if opts.Logf != nil { - opts.Logf("gopathwalk: scanned %s in %v", root.Path, time.Since(start)) + opts.Logf("scanned %s in %v", root.Path, time.Since(start)) } } @@ -103,7 +112,10 @@ type walker struct { skip func(Root, string) bool // The callback that will be invoked for every dir. dir is skipped if it returns true. opts Options // Options passed to Walk by the user. - ignoredDirs []os.FileInfo // The ignored directories, loaded from .goimportsignore files. + pathSymlinks []os.FileInfo + ignoredDirs []string + + added map[string]bool } // init initializes the walker based on its Options @@ -119,13 +131,9 @@ func (w *walker) init() { for _, p := range ignoredPaths { full := filepath.Join(w.root.Path, p) - if fi, err := os.Stat(full); err == nil { - w.ignoredDirs = append(w.ignoredDirs, fi) - if w.opts.Logf != nil { - w.opts.Logf("Directory added to ignore list: %s", full) - } - } else if w.opts.Logf != nil { - w.opts.Logf("Error statting ignored directory: %v", err) + w.ignoredDirs = append(w.ignoredDirs, full) + if w.opts.Logf != nil { + w.opts.Logf("Directory added to ignore list: %s", full) } } } @@ -135,7 +143,7 @@ func (w *walker) init() { // The provided path is one of the $GOPATH entries with "src" appended. func (w *walker) getIgnoredDirs(path string) []string { file := filepath.Join(path, ".goimportsignore") - slurp, err := ioutil.ReadFile(file) + slurp, err := os.ReadFile(file) if w.opts.Logf != nil { if err != nil { w.opts.Logf("%v", err) @@ -160,9 +168,9 @@ func (w *walker) getIgnoredDirs(path string) []string { } // shouldSkipDir reports whether the file should be skipped or not. -func (w *walker) shouldSkipDir(fi os.FileInfo, dir string) bool { +func (w *walker) shouldSkipDir(dir string) bool { for _, ignoredDir := range w.ignoredDirs { - if os.SameFile(fi, ignoredDir) { + if dir == ignoredDir { return true } } @@ -174,81 +182,150 @@ func (w *walker) shouldSkipDir(fi os.FileInfo, dir string) bool { } // walk walks through the given path. -func (w *walker) walk(path string, typ os.FileMode) error { - if typ.IsRegular() { +// +// Errors are logged if w.opts.Logf is non-nil, but otherwise ignored: +// walk returns only nil or fs.SkipDir. +func (w *walker) walk(path string, d fs.DirEntry, err error) error { + if err != nil { + // We have no way to report errors back through Walk or WalkSkip, + // so just log and ignore them. + if w.opts.Logf != nil { + w.opts.Logf("%v", err) + } + if d == nil { + // Nothing more to do: the error prevents us from knowing + // what path even represents. + return nil + } + } + + if d.Type().IsRegular() { + if !strings.HasSuffix(path, ".go") { + return nil + } + dir := filepath.Dir(path) if dir == w.root.Path && (w.root.Type == RootGOROOT || w.root.Type == RootGOPATH) { // Doesn't make sense to have regular files // directly in your $GOPATH/src or $GOROOT/src. - return fastwalk.ErrSkipFiles - } - if !strings.HasSuffix(path, ".go") { return nil } - w.add(w.root, dir) - return fastwalk.ErrSkipFiles + if !w.added[dir] { + w.add(w.root, dir) + w.added[dir] = true + } + return nil } - if typ == os.ModeDir { + + if d.IsDir() { base := filepath.Base(path) if base == "" || base[0] == '.' || base[0] == '_' || base == "testdata" || (w.root.Type == RootGOROOT && w.opts.ModulesEnabled && base == "vendor") || (!w.opts.ModulesEnabled && base == "node_modules") { - return filepath.SkipDir + return fs.SkipDir } - fi, err := os.Lstat(path) - if err == nil && w.shouldSkipDir(fi, path) { - return filepath.SkipDir + if w.shouldSkipDir(path) { + return fs.SkipDir } return nil } - if typ == os.ModeSymlink { - base := filepath.Base(path) - if strings.HasPrefix(base, ".#") { - // Emacs noise. - return nil + + if d.Type()&os.ModeSymlink != 0 { + // TODO(bcmills): 'go list all' itself ignores symlinks within GOROOT/src + // and GOPATH/src. Do we really need to traverse them here? If so, why? + + fi, err := os.Stat(path) + if err != nil || !fi.IsDir() { + // Not a directory. Just walk the file (or broken link) and be done. + return w.walk(path, fs.FileInfoToDirEntry(fi), err) } - if w.shouldTraverse(path) { - return fastwalk.ErrTraverseLink + + // Avoid walking symlink cycles: if we have already followed a symlink to + // this directory as a parent of itself, don't follow it again. + // + // This doesn't catch the first time through a cycle, but it also minimizes + // the number of extra stat calls we make if we *don't* encounter a cycle. + // Since we don't actually expect to encounter symlink cycles in practice, + // this seems like the right tradeoff. + for _, parent := range w.pathSymlinks { + if os.SameFile(fi, parent) { + return nil + } } - } - return nil -} -// shouldTraverse reports whether the symlink fi, found in dir, -// should be followed. It makes sure symlinks were never visited -// before to avoid symlink loops. -func (w *walker) shouldTraverse(path string) bool { - ts, err := os.Stat(path) - if err != nil { - fmt.Fprintln(os.Stderr, err) - return false - } - if !ts.IsDir() { - return false - } - if w.shouldSkipDir(ts, filepath.Dir(path)) { - return false - } - // Check for symlink loops by statting each directory component - // and seeing if any are the same file as ts. - for { - parent := filepath.Dir(path) - if parent == path { - // Made it to the root without seeing a cycle. - // Use this symlink. - return true + w.pathSymlinks = append(w.pathSymlinks, fi) + defer func() { + w.pathSymlinks = w.pathSymlinks[:len(w.pathSymlinks)-1] + }() + + // On some platforms the OS (or the Go os package) sometimes fails to + // resolve directory symlinks before a trailing slash + // (even though POSIX requires it to do so). + // + // On macOS that failure may be caused by a known libc/kernel bug; + // see https://go.dev/issue/59586. + // + // On Windows before Go 1.21, it may be caused by a bug in + // os.Lstat (fixed in https://go.dev/cl/463177). + // + // Since we need to handle this explicitly on broken platforms anyway, + // it is simplest to just always do that and not rely on POSIX pathname + // resolution to walk the directory (such as by calling WalkDir with + // a trailing slash appended to the path). + // + // Instead, we make a sequence of walk calls ā€” directly and through + // recursive calls to filepath.WalkDir ā€” simulating what WalkDir would do + // if the symlink were a regular directory. + + // First we call walk on the path as a directory + // (instead of a symlink). + err = w.walk(path, fs.FileInfoToDirEntry(fi), nil) + if err == fs.SkipDir { + return nil + } else if err != nil { + // This should be impossible, but handle it anyway in case + // walk is changed to return other errors. + return err } - parentInfo, err := os.Stat(parent) + + // Now read the directory and walk its entries. + ents, err := os.ReadDir(path) if err != nil { - return false + // Report the ReadDir error, as filepath.WalkDir would do. + err = w.walk(path, fs.FileInfoToDirEntry(fi), err) + if err == fs.SkipDir { + return nil + } else if err != nil { + return err // Again, should be impossible. + } + // Fall through and iterate over whatever entries we did manage to get. } - if os.SameFile(ts, parentInfo) { - // Cycle. Don't traverse. - return false + + for _, d := range ents { + nextPath := filepath.Join(path, d.Name()) + if d.IsDir() { + // We want to walk the whole directory tree rooted at nextPath, + // not just the single entry for the directory. + err := filepath.WalkDir(nextPath, w.walk) + if err != nil && w.opts.Logf != nil { + w.opts.Logf("%v", err) + } + } else { + err := w.walk(nextPath, d, nil) + if err == fs.SkipDir { + // Skip the rest of the entries in the parent directory of nextPath + // (that is, path itself). + break + } else if err != nil { + return err // Again, should be impossible. + } + } } - path = parent + return nil } + // Not a file, regular directory, or symlink; skip. + return nil } diff --git a/vendor/golang.org/x/tools/internal/imports/fix.go b/vendor/golang.org/x/tools/internal/imports/fix.go index 642a5ac2d..dd369c072 100644 --- a/vendor/golang.org/x/tools/internal/imports/fix.go +++ b/vendor/golang.org/x/tools/internal/imports/fix.go @@ -13,6 +13,7 @@ import ( "go/build" "go/parser" "go/token" + "io/fs" "io/ioutil" "os" "path" @@ -26,6 +27,7 @@ import ( "unicode/utf8" "golang.org/x/tools/go/ast/astutil" + "golang.org/x/tools/internal/event" "golang.org/x/tools/internal/gocommand" "golang.org/x/tools/internal/gopathwalk" ) @@ -106,7 +108,7 @@ func parseOtherFiles(fset *token.FileSet, srcDir, filename string) []*ast.File { considerTests := strings.HasSuffix(filename, "_test.go") fileBase := filepath.Base(filename) - packageFileInfos, err := ioutil.ReadDir(srcDir) + packageFileInfos, err := os.ReadDir(srcDir) if err != nil { return nil } @@ -252,7 +254,7 @@ type pass struct { otherFiles []*ast.File // sibling files. // Intermediate state, generated by load. - existingImports map[string]*ImportInfo + existingImports map[string][]*ImportInfo allRefs references missingRefs references @@ -317,7 +319,7 @@ func (p *pass) importIdentifier(imp *ImportInfo) string { func (p *pass) load() ([]*ImportFix, bool) { p.knownPackages = map[string]*packageInfo{} p.missingRefs = references{} - p.existingImports = map[string]*ImportInfo{} + p.existingImports = map[string][]*ImportInfo{} // Load basic information about the file in question. p.allRefs = collectReferences(p.f) @@ -348,7 +350,7 @@ func (p *pass) load() ([]*ImportFix, bool) { } } for _, imp := range imports { - p.existingImports[p.importIdentifier(imp)] = imp + p.existingImports[p.importIdentifier(imp)] = append(p.existingImports[p.importIdentifier(imp)], imp) } // Find missing references. @@ -387,36 +389,45 @@ func (p *pass) fix() ([]*ImportFix, bool) { // Found everything, or giving up. Add the new imports and remove any unused. var fixes []*ImportFix - for _, imp := range p.existingImports { - // We deliberately ignore globals here, because we can't be sure - // they're in the same package. People do things like put multiple - // main packages in the same directory, and we don't want to - // remove imports if they happen to have the same name as a var in - // a different package. - if _, ok := p.allRefs[p.importIdentifier(imp)]; !ok { - fixes = append(fixes, &ImportFix{ - StmtInfo: *imp, - IdentName: p.importIdentifier(imp), - FixType: DeleteImport, - }) - continue - } + for _, identifierImports := range p.existingImports { + for _, imp := range identifierImports { + // We deliberately ignore globals here, because we can't be sure + // they're in the same package. People do things like put multiple + // main packages in the same directory, and we don't want to + // remove imports if they happen to have the same name as a var in + // a different package. + if _, ok := p.allRefs[p.importIdentifier(imp)]; !ok { + fixes = append(fixes, &ImportFix{ + StmtInfo: *imp, + IdentName: p.importIdentifier(imp), + FixType: DeleteImport, + }) + continue + } - // An existing import may need to update its import name to be correct. - if name := p.importSpecName(imp); name != imp.Name { - fixes = append(fixes, &ImportFix{ - StmtInfo: ImportInfo{ - Name: name, - ImportPath: imp.ImportPath, - }, - IdentName: p.importIdentifier(imp), - FixType: SetImportName, - }) + // An existing import may need to update its import name to be correct. + if name := p.importSpecName(imp); name != imp.Name { + fixes = append(fixes, &ImportFix{ + StmtInfo: ImportInfo{ + Name: name, + ImportPath: imp.ImportPath, + }, + IdentName: p.importIdentifier(imp), + FixType: SetImportName, + }) + } } } + // Collecting fixes involved map iteration, so sort for stability. See + // golang/go#59976. + sortFixes(fixes) + // collect selected fixes in a separate slice, so that it can be sorted + // separately. Note that these fixes must occur after fixes to existing + // imports. TODO(rfindley): figure out why. + var selectedFixes []*ImportFix for _, imp := range selected { - fixes = append(fixes, &ImportFix{ + selectedFixes = append(selectedFixes, &ImportFix{ StmtInfo: ImportInfo{ Name: p.importSpecName(imp), ImportPath: imp.ImportPath, @@ -425,8 +436,25 @@ func (p *pass) fix() ([]*ImportFix, bool) { FixType: AddImport, }) } + sortFixes(selectedFixes) - return fixes, true + return append(fixes, selectedFixes...), true +} + +func sortFixes(fixes []*ImportFix) { + sort.Slice(fixes, func(i, j int) bool { + fi, fj := fixes[i], fixes[j] + if fi.StmtInfo.ImportPath != fj.StmtInfo.ImportPath { + return fi.StmtInfo.ImportPath < fj.StmtInfo.ImportPath + } + if fi.StmtInfo.Name != fj.StmtInfo.Name { + return fi.StmtInfo.Name < fj.StmtInfo.Name + } + if fi.IdentName != fj.IdentName { + return fi.IdentName < fj.IdentName + } + return fi.FixType < fj.FixType + }) } // importSpecName gets the import name of imp in the import spec. @@ -519,7 +547,7 @@ func (p *pass) addCandidate(imp *ImportInfo, pkg *packageInfo) { var fixImports = fixImportsDefault func fixImportsDefault(fset *token.FileSet, f *ast.File, filename string, env *ProcessEnv) error { - fixes, err := getFixes(fset, f, filename, env) + fixes, err := getFixes(context.Background(), fset, f, filename, env) if err != nil { return err } @@ -529,7 +557,7 @@ func fixImportsDefault(fset *token.FileSet, f *ast.File, filename string, env *P // getFixes gets the import fixes that need to be made to f in order to fix the imports. // It does not modify the ast. -func getFixes(fset *token.FileSet, f *ast.File, filename string, env *ProcessEnv) ([]*ImportFix, error) { +func getFixes(ctx context.Context, fset *token.FileSet, f *ast.File, filename string, env *ProcessEnv) ([]*ImportFix, error) { abs, err := filepath.Abs(filename) if err != nil { return nil, err @@ -583,7 +611,7 @@ func getFixes(fset *token.FileSet, f *ast.File, filename string, env *ProcessEnv // Go look for candidates in $GOPATH, etc. We don't necessarily load // the real exports of sibling imports, so keep assuming their contents. - if err := addExternalCandidates(p, p.missingRefs, filename); err != nil { + if err := addExternalCandidates(ctx, p, p.missingRefs, filename); err != nil { return nil, err } @@ -1031,7 +1059,10 @@ type scanCallback struct { exportsLoaded func(pkg *pkg, exports []string) } -func addExternalCandidates(pass *pass, refs references, filename string) error { +func addExternalCandidates(ctx context.Context, pass *pass, refs references, filename string) error { + ctx, done := event.Start(ctx, "imports.addExternalCandidates") + defer done() + var mu sync.Mutex found := make(map[string][]pkgDistance) callback := &scanCallback{ @@ -1441,11 +1472,11 @@ func VendorlessPath(ipath string) string { func loadExportsFromFiles(ctx context.Context, env *ProcessEnv, dir string, includeTest bool) (string, []string, error) { // Look for non-test, buildable .go files which could provide exports. - all, err := ioutil.ReadDir(dir) + all, err := os.ReadDir(dir) if err != nil { return "", nil, err } - var files []os.FileInfo + var files []fs.DirEntry for _, fi := range all { name := fi.Name() if !strings.HasSuffix(name, ".go") || (!includeTest && strings.HasSuffix(name, "_test.go")) { diff --git a/vendor/golang.org/x/tools/internal/imports/imports.go b/vendor/golang.org/x/tools/internal/imports/imports.go index 95a88383a..58e637b90 100644 --- a/vendor/golang.org/x/tools/internal/imports/imports.go +++ b/vendor/golang.org/x/tools/internal/imports/imports.go @@ -11,6 +11,7 @@ package imports import ( "bufio" "bytes" + "context" "fmt" "go/ast" "go/format" @@ -23,6 +24,7 @@ import ( "strings" "golang.org/x/tools/go/ast/astutil" + "golang.org/x/tools/internal/event" ) // Options is golang.org/x/tools/imports.Options with extra internal-only options. @@ -66,14 +68,17 @@ func Process(filename string, src []byte, opt *Options) (formatted []byte, err e // // Note that filename's directory influences which imports can be chosen, // so it is important that filename be accurate. -func FixImports(filename string, src []byte, opt *Options) (fixes []*ImportFix, err error) { +func FixImports(ctx context.Context, filename string, src []byte, opt *Options) (fixes []*ImportFix, err error) { + ctx, done := event.Start(ctx, "imports.FixImports") + defer done() + fileSet := token.NewFileSet() file, _, err := parse(fileSet, filename, src, opt) if err != nil { return nil, err } - return getFixes(fileSet, file, filename, opt.Env) + return getFixes(ctx, fileSet, file, filename, opt.Env) } // ApplyFixes applies all of the fixes to the file and formats it. extraMode diff --git a/vendor/golang.org/x/tools/internal/imports/mod.go b/vendor/golang.org/x/tools/internal/imports/mod.go index 7d99d04ca..5f4d435d3 100644 --- a/vendor/golang.org/x/tools/internal/imports/mod.go +++ b/vendor/golang.org/x/tools/internal/imports/mod.go @@ -9,7 +9,6 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" "os" "path" "path/filepath" @@ -19,6 +18,7 @@ import ( "strings" "golang.org/x/mod/module" + "golang.org/x/tools/internal/event" "golang.org/x/tools/internal/gocommand" "golang.org/x/tools/internal/gopathwalk" ) @@ -37,7 +37,7 @@ type ModuleResolver struct { mains []*gocommand.ModuleJSON mainByDir map[string]*gocommand.ModuleJSON modsByModPath []*gocommand.ModuleJSON // All modules, ordered by # of path components in module Path... - modsByDir []*gocommand.ModuleJSON // ...or Dir. + modsByDir []*gocommand.ModuleJSON // ...or number of path components in their Dir. // moduleCacheCache stores information about the module cache. moduleCacheCache *dirInfoCache @@ -123,7 +123,7 @@ func (r *ModuleResolver) init() error { }) sort.Slice(r.modsByDir, func(i, j int) bool { count := func(x int) int { - return strings.Count(r.modsByDir[x].Dir, "/") + return strings.Count(r.modsByDir[x].Dir, string(filepath.Separator)) } return count(j) < count(i) // descending order }) @@ -264,7 +264,7 @@ func (r *ModuleResolver) findPackage(importPath string) (*gocommand.ModuleJSON, } // Not cached. Read the filesystem. - pkgFiles, err := ioutil.ReadDir(pkgDir) + pkgFiles, err := os.ReadDir(pkgDir) if err != nil { continue } @@ -327,6 +327,10 @@ func (r *ModuleResolver) findModuleByDir(dir string) *gocommand.ModuleJSON { // - in /vendor/ in -mod=vendor mode. // - nested module? Dunno. // Rumor has it that replace targets cannot contain other replace targets. + // + // Note that it is critical here that modsByDir is sorted to have deeper dirs + // first. This ensures that findModuleByDir finds the innermost module. + // See also golang/go#56291. for _, m := range r.modsByDir { if !strings.HasPrefix(dir, m.Dir) { continue @@ -365,7 +369,7 @@ func (r *ModuleResolver) dirIsNestedModule(dir string, mod *gocommand.ModuleJSON func (r *ModuleResolver) modInfo(dir string) (modDir string, modName string) { readModName := func(modFile string) string { - modBytes, err := ioutil.ReadFile(modFile) + modBytes, err := os.ReadFile(modFile) if err != nil { return "" } @@ -424,6 +428,9 @@ func (r *ModuleResolver) loadPackageNames(importPaths []string, srcDir string) ( } func (r *ModuleResolver) scan(ctx context.Context, callback *scanCallback) error { + ctx, done := event.Start(ctx, "imports.ModuleResolver.scan") + defer done() + if err := r.init(); err != nil { return err } diff --git a/vendor/golang.org/x/tools/internal/imports/mod_cache.go b/vendor/golang.org/x/tools/internal/imports/mod_cache.go index 18dada495..45690abbb 100644 --- a/vendor/golang.org/x/tools/internal/imports/mod_cache.go +++ b/vendor/golang.org/x/tools/internal/imports/mod_cache.go @@ -12,7 +12,7 @@ import ( "golang.org/x/tools/internal/gopathwalk" ) -// To find packages to import, the resolver needs to know about all of the +// To find packages to import, the resolver needs to know about all of // the packages that could be imported. This includes packages that are // already in modules that are in (1) the current module, (2) replace targets, // and (3) packages in the module cache. Packages in (1) and (2) may change over diff --git a/vendor/golang.org/x/tools/internal/imports/zstdlib.go b/vendor/golang.org/x/tools/internal/imports/zstdlib.go index 31a75949c..9f992c2be 100644 --- a/vendor/golang.org/x/tools/internal/imports/zstdlib.go +++ b/vendor/golang.org/x/tools/internal/imports/zstdlib.go @@ -93,6 +93,7 @@ var stdlib = map[string][]string{ "Compare", "Contains", "ContainsAny", + "ContainsFunc", "ContainsRune", "Count", "Cut", @@ -147,6 +148,11 @@ var stdlib = map[string][]string{ "TrimSpace", "TrimSuffix", }, + "cmp": { + "Compare", + "Less", + "Ordered", + }, "compress/bzip2": { "NewReader", "StructuralError", @@ -228,6 +234,7 @@ var stdlib = map[string][]string{ "Ring", }, "context": { + "AfterFunc", "Background", "CancelCauseFunc", "CancelFunc", @@ -239,8 +246,11 @@ var stdlib = map[string][]string{ "WithCancel", "WithCancelCause", "WithDeadline", + "WithDeadlineCause", "WithTimeout", + "WithTimeoutCause", "WithValue", + "WithoutCancel", }, "crypto": { "BLAKE2b_256", @@ -445,6 +455,7 @@ var stdlib = map[string][]string{ "XORBytes", }, "crypto/tls": { + "AlertError", "Certificate", "CertificateRequestInfo", "CertificateVerificationError", @@ -476,6 +487,7 @@ var stdlib = map[string][]string{ "LoadX509KeyPair", "NewLRUClientSessionCache", "NewListener", + "NewResumptionState", "NoClientCert", "PKCS1WithSHA1", "PKCS1WithSHA256", @@ -484,6 +496,27 @@ var stdlib = map[string][]string{ "PSSWithSHA256", "PSSWithSHA384", "PSSWithSHA512", + "ParseSessionState", + "QUICClient", + "QUICConfig", + "QUICConn", + "QUICEncryptionLevel", + "QUICEncryptionLevelApplication", + "QUICEncryptionLevelEarly", + "QUICEncryptionLevelHandshake", + "QUICEncryptionLevelInitial", + "QUICEvent", + "QUICEventKind", + "QUICHandshakeDone", + "QUICNoEvent", + "QUICRejectedEarlyData", + "QUICServer", + "QUICSessionTicketOptions", + "QUICSetReadSecret", + "QUICSetWriteSecret", + "QUICTransportParameters", + "QUICTransportParametersRequired", + "QUICWriteData", "RecordHeaderError", "RenegotiateFreelyAsClient", "RenegotiateNever", @@ -493,6 +526,7 @@ var stdlib = map[string][]string{ "RequireAndVerifyClientCert", "RequireAnyClientCert", "Server", + "SessionState", "SignatureScheme", "TLS_AES_128_GCM_SHA256", "TLS_AES_256_GCM_SHA384", @@ -523,6 +557,7 @@ var stdlib = map[string][]string{ "TLS_RSA_WITH_AES_256_GCM_SHA384", "TLS_RSA_WITH_RC4_128_SHA", "VerifyClientCertIfGiven", + "VersionName", "VersionSSL30", "VersionTLS10", "VersionTLS11", @@ -618,6 +653,7 @@ var stdlib = map[string][]string{ "PureEd25519", "RSA", "RevocationList", + "RevocationListEntry", "SHA1WithRSA", "SHA256WithRSA", "SHA256WithRSAPSS", @@ -1002,10 +1038,42 @@ var stdlib = map[string][]string{ "COMPRESS_LOOS", "COMPRESS_LOPROC", "COMPRESS_ZLIB", + "COMPRESS_ZSTD", "Chdr32", "Chdr64", "Class", "CompressionType", + "DF_1_CONFALT", + "DF_1_DIRECT", + "DF_1_DISPRELDNE", + "DF_1_DISPRELPND", + "DF_1_EDITED", + "DF_1_ENDFILTEE", + "DF_1_GLOBAL", + "DF_1_GLOBAUDIT", + "DF_1_GROUP", + "DF_1_IGNMULDEF", + "DF_1_INITFIRST", + "DF_1_INTERPOSE", + "DF_1_KMOD", + "DF_1_LOADFLTR", + "DF_1_NOCOMMON", + "DF_1_NODEFLIB", + "DF_1_NODELETE", + "DF_1_NODIRECT", + "DF_1_NODUMP", + "DF_1_NOHDR", + "DF_1_NOKSYMS", + "DF_1_NOOPEN", + "DF_1_NORELOC", + "DF_1_NOW", + "DF_1_ORIGIN", + "DF_1_PIE", + "DF_1_SINGLETON", + "DF_1_STUB", + "DF_1_SYMINTPOSE", + "DF_1_TRANS", + "DF_1_WEAKFILTER", "DF_BIND_NOW", "DF_ORIGIN", "DF_STATIC_TLS", @@ -1144,6 +1212,7 @@ var stdlib = map[string][]string{ "Dyn32", "Dyn64", "DynFlag", + "DynFlag1", "DynTag", "EI_ABIVERSION", "EI_CLASS", @@ -2111,6 +2180,7 @@ var stdlib = map[string][]string{ "R_PPC64_REL16_LO", "R_PPC64_REL24", "R_PPC64_REL24_NOTOC", + "R_PPC64_REL24_P9NOTOC", "R_PPC64_REL30", "R_PPC64_REL32", "R_PPC64_REL64", @@ -2848,6 +2918,7 @@ var stdlib = map[string][]string{ "MaxVarintLen16", "MaxVarintLen32", "MaxVarintLen64", + "NativeEndian", "PutUvarint", "PutVarint", "Read", @@ -2963,6 +3034,7 @@ var stdlib = map[string][]string{ }, "errors": { "As", + "ErrUnsupported", "Is", "Join", "New", @@ -2989,6 +3061,7 @@ var stdlib = map[string][]string{ "Arg", "Args", "Bool", + "BoolFunc", "BoolVar", "CommandLine", "ContinueOnError", @@ -3119,6 +3192,7 @@ var stdlib = map[string][]string{ "Inspect", "InterfaceType", "IsExported", + "IsGenerated", "KeyValueExpr", "LabeledStmt", "Lbl", @@ -3169,6 +3243,7 @@ var stdlib = map[string][]string{ "ArchChar", "Context", "Default", + "Directive", "FindOnly", "IgnoreVendor", "Import", @@ -3184,6 +3259,7 @@ var stdlib = map[string][]string{ "go/build/constraint": { "AndExpr", "Expr", + "GoVersion", "IsGoBuild", "IsPlusBuild", "NotExpr", @@ -3626,6 +3702,7 @@ var stdlib = map[string][]string{ "ErrBadHTML", "ErrBranchEnd", "ErrEndContext", + "ErrJSTemplate", "ErrNoSuchTemplate", "ErrOutputContext", "ErrPartialCharset", @@ -3870,6 +3947,8 @@ var stdlib = map[string][]string{ "FileInfo", "FileInfoToDirEntry", "FileMode", + "FormatDirEntry", + "FormatFileInfo", "Glob", "GlobFS", "ModeAppend", @@ -3942,6 +4021,78 @@ var stdlib = map[string][]string{ "SetPrefix", "Writer", }, + "log/slog": { + "Any", + "AnyValue", + "Attr", + "Bool", + "BoolValue", + "Debug", + "DebugContext", + "Default", + "Duration", + "DurationValue", + "Error", + "ErrorContext", + "Float64", + "Float64Value", + "Group", + "GroupValue", + "Handler", + "HandlerOptions", + "Info", + "InfoContext", + "Int", + "Int64", + "Int64Value", + "IntValue", + "JSONHandler", + "Kind", + "KindAny", + "KindBool", + "KindDuration", + "KindFloat64", + "KindGroup", + "KindInt64", + "KindLogValuer", + "KindString", + "KindTime", + "KindUint64", + "Level", + "LevelDebug", + "LevelError", + "LevelInfo", + "LevelKey", + "LevelVar", + "LevelWarn", + "Leveler", + "Log", + "LogAttrs", + "LogValuer", + "Logger", + "MessageKey", + "New", + "NewJSONHandler", + "NewLogLogger", + "NewRecord", + "NewTextHandler", + "Record", + "SetDefault", + "Source", + "SourceKey", + "String", + "StringValue", + "TextHandler", + "Time", + "TimeKey", + "TimeValue", + "Uint64", + "Uint64Value", + "Value", + "Warn", + "WarnContext", + "With", + }, "log/syslog": { "Dial", "LOG_ALERT", @@ -3977,6 +4128,13 @@ var stdlib = map[string][]string{ "Priority", "Writer", }, + "maps": { + "Clone", + "Copy", + "DeleteFunc", + "Equal", + "EqualFunc", + }, "math": { "Abs", "Acos", @@ -4371,6 +4529,7 @@ var stdlib = map[string][]string{ "ErrNoLocation", "ErrNotMultipart", "ErrNotSupported", + "ErrSchemeMismatch", "ErrServerClosed", "ErrShortBody", "ErrSkipAltProtocol", @@ -5084,6 +5243,8 @@ var stdlib = map[string][]string{ "NumCPU", "NumCgoCall", "NumGoroutine", + "PanicNilError", + "Pinner", "ReadMemStats", "ReadTrace", "SetBlockProfileRate", @@ -5172,6 +5333,37 @@ var stdlib = map[string][]string{ "Task", "WithRegion", }, + "slices": { + "BinarySearch", + "BinarySearchFunc", + "Clip", + "Clone", + "Compact", + "CompactFunc", + "Compare", + "CompareFunc", + "Contains", + "ContainsFunc", + "Delete", + "DeleteFunc", + "Equal", + "EqualFunc", + "Grow", + "Index", + "IndexFunc", + "Insert", + "IsSorted", + "IsSortedFunc", + "Max", + "MaxFunc", + "Min", + "MinFunc", + "Replace", + "Reverse", + "Sort", + "SortFunc", + "SortStableFunc", + }, "sort": { "Find", "Float64Slice", @@ -5242,6 +5434,7 @@ var stdlib = map[string][]string{ "Compare", "Contains", "ContainsAny", + "ContainsFunc", "ContainsRune", "Count", "Cut", @@ -5299,6 +5492,9 @@ var stdlib = map[string][]string{ "Mutex", "NewCond", "Once", + "OnceFunc", + "OnceValue", + "OnceValues", "Pool", "RWMutex", "WaitGroup", @@ -9135,10 +9331,12 @@ var stdlib = map[string][]string{ "SYS_AIO_CANCEL", "SYS_AIO_ERROR", "SYS_AIO_FSYNC", + "SYS_AIO_MLOCK", "SYS_AIO_READ", "SYS_AIO_RETURN", "SYS_AIO_SUSPEND", "SYS_AIO_SUSPEND_NOCANCEL", + "SYS_AIO_WAITCOMPLETE", "SYS_AIO_WRITE", "SYS_ALARM", "SYS_ARCH_PRCTL", @@ -9368,6 +9566,7 @@ var stdlib = map[string][]string{ "SYS_GET_MEMPOLICY", "SYS_GET_ROBUST_LIST", "SYS_GET_THREAD_AREA", + "SYS_GSSD_SYSCALL", "SYS_GTTY", "SYS_IDENTITYSVC", "SYS_IDLE", @@ -9411,8 +9610,24 @@ var stdlib = map[string][]string{ "SYS_KLDSYM", "SYS_KLDUNLOAD", "SYS_KLDUNLOADF", + "SYS_KMQ_NOTIFY", + "SYS_KMQ_OPEN", + "SYS_KMQ_SETATTR", + "SYS_KMQ_TIMEDRECEIVE", + "SYS_KMQ_TIMEDSEND", + "SYS_KMQ_UNLINK", "SYS_KQUEUE", "SYS_KQUEUE1", + "SYS_KSEM_CLOSE", + "SYS_KSEM_DESTROY", + "SYS_KSEM_GETVALUE", + "SYS_KSEM_INIT", + "SYS_KSEM_OPEN", + "SYS_KSEM_POST", + "SYS_KSEM_TIMEDWAIT", + "SYS_KSEM_TRYWAIT", + "SYS_KSEM_UNLINK", + "SYS_KSEM_WAIT", "SYS_KTIMER_CREATE", "SYS_KTIMER_DELETE", "SYS_KTIMER_GETOVERRUN", @@ -9504,11 +9719,14 @@ var stdlib = map[string][]string{ "SYS_NFSSVC", "SYS_NFSTAT", "SYS_NICE", + "SYS_NLM_SYSCALL", "SYS_NLSTAT", "SYS_NMOUNT", "SYS_NSTAT", "SYS_NTP_ADJTIME", "SYS_NTP_GETTIME", + "SYS_NUMA_GETAFFINITY", + "SYS_NUMA_SETAFFINITY", "SYS_OABI_SYSCALL_BASE", "SYS_OBREAK", "SYS_OLDFSTAT", @@ -9891,6 +10109,7 @@ var stdlib = map[string][]string{ "SYS___ACL_SET_FD", "SYS___ACL_SET_FILE", "SYS___ACL_SET_LINK", + "SYS___CAP_RIGHTS_GET", "SYS___CLONE", "SYS___DISABLE_THREADSIGNAL", "SYS___GETCWD", @@ -10574,6 +10793,7 @@ var stdlib = map[string][]string{ "Short", "T", "TB", + "Testing", "Verbose", }, "testing/fstest": { @@ -10603,6 +10823,9 @@ var stdlib = map[string][]string{ "SetupError", "Value", }, + "testing/slogtest": { + "TestHandler", + }, "text/scanner": { "Char", "Comment", @@ -10826,6 +11049,7 @@ var stdlib = map[string][]string{ "Cs", "Cuneiform", "Cypriot", + "Cypro_Minoan", "Cyrillic", "Dash", "Deprecated", @@ -10889,6 +11113,7 @@ var stdlib = map[string][]string{ "Kaithi", "Kannada", "Katakana", + "Kawi", "Kayah_Li", "Kharoshthi", "Khitan_Small_Script", @@ -10943,6 +11168,7 @@ var stdlib = map[string][]string{ "Myanmar", "N", "Nabataean", + "Nag_Mundari", "Nandinagari", "Nd", "New_Tai_Lue", @@ -10964,6 +11190,7 @@ var stdlib = map[string][]string{ "Old_Sogdian", "Old_South_Arabian", "Old_Turkic", + "Old_Uyghur", "Oriya", "Osage", "Osmanya", @@ -11038,6 +11265,7 @@ var stdlib = map[string][]string{ "Tai_Viet", "Takri", "Tamil", + "Tangsa", "Tangut", "Telugu", "Terminal_Punctuation", @@ -11052,6 +11280,7 @@ var stdlib = map[string][]string{ "ToLower", "ToTitle", "ToUpper", + "Toto", "TurkishCase", "Ugaritic", "Unified_Ideograph", @@ -11061,6 +11290,7 @@ var stdlib = map[string][]string{ "Vai", "Variation_Selector", "Version", + "Vithkuqi", "Wancho", "Warang_Citi", "White_Space", diff --git a/vendor/golang.org/x/tools/internal/packagesinternal/packages.go b/vendor/golang.org/x/tools/internal/packagesinternal/packages.go index d9950b1f0..44719de17 100644 --- a/vendor/golang.org/x/tools/internal/packagesinternal/packages.go +++ b/vendor/golang.org/x/tools/internal/packagesinternal/packages.go @@ -5,10 +5,6 @@ // Package packagesinternal exposes internal-only fields from go/packages. package packagesinternal -import ( - "golang.org/x/tools/internal/gocommand" -) - var GetForTest = func(p interface{}) string { return "" } var GetDepsErrors = func(p interface{}) []*PackageError { return nil } @@ -18,10 +14,6 @@ type PackageError struct { Err string // the error itself } -var GetGoCmdRunner = func(config interface{}) *gocommand.Runner { return nil } - -var SetGoCmdRunner = func(config interface{}, runner *gocommand.Runner) {} - var TypecheckCgo int var DepsErrors int // must be set as a LoadMode to call GetDepsErrors var ForTest int // must be set as a LoadMode to call GetForTest diff --git a/vendor/golang.org/x/tools/internal/tokeninternal/tokeninternal.go b/vendor/golang.org/x/tools/internal/tokeninternal/tokeninternal.go index a3fb2d4f2..7e638ec24 100644 --- a/vendor/golang.org/x/tools/internal/tokeninternal/tokeninternal.go +++ b/vendor/golang.org/x/tools/internal/tokeninternal/tokeninternal.go @@ -7,7 +7,9 @@ package tokeninternal import ( + "fmt" "go/token" + "sort" "sync" "unsafe" ) @@ -57,3 +59,93 @@ func GetLines(file *token.File) []int { panic("unexpected token.File size") } } + +// AddExistingFiles adds the specified files to the FileSet if they +// are not already present. It panics if any pair of files in the +// resulting FileSet would overlap. +func AddExistingFiles(fset *token.FileSet, files []*token.File) { + // Punch through the FileSet encapsulation. + type tokenFileSet struct { + // This type remained essentially consistent from go1.16 to go1.21. + mutex sync.RWMutex + base int + files []*token.File + _ *token.File // changed to atomic.Pointer[token.File] in go1.19 + } + + // If the size of token.FileSet changes, this will fail to compile. + const delta = int64(unsafe.Sizeof(tokenFileSet{})) - int64(unsafe.Sizeof(token.FileSet{})) + var _ [-delta * delta]int + + type uP = unsafe.Pointer + var ptr *tokenFileSet + *(*uP)(uP(&ptr)) = uP(fset) + ptr.mutex.Lock() + defer ptr.mutex.Unlock() + + // Merge and sort. + newFiles := append(ptr.files, files...) + sort.Slice(newFiles, func(i, j int) bool { + return newFiles[i].Base() < newFiles[j].Base() + }) + + // Reject overlapping files. + // Discard adjacent identical files. + out := newFiles[:0] + for i, file := range newFiles { + if i > 0 { + prev := newFiles[i-1] + if file == prev { + continue + } + if prev.Base()+prev.Size()+1 > file.Base() { + panic(fmt.Sprintf("file %s (%d-%d) overlaps with file %s (%d-%d)", + prev.Name(), prev.Base(), prev.Base()+prev.Size(), + file.Name(), file.Base(), file.Base()+file.Size())) + } + } + out = append(out, file) + } + newFiles = out + + ptr.files = newFiles + + // Advance FileSet.Base(). + if len(newFiles) > 0 { + last := newFiles[len(newFiles)-1] + newBase := last.Base() + last.Size() + 1 + if ptr.base < newBase { + ptr.base = newBase + } + } +} + +// FileSetFor returns a new FileSet containing a sequence of new Files with +// the same base, size, and line as the input files, for use in APIs that +// require a FileSet. +// +// Precondition: the input files must be non-overlapping, and sorted in order +// of their Base. +func FileSetFor(files ...*token.File) *token.FileSet { + fset := token.NewFileSet() + for _, f := range files { + f2 := fset.AddFile(f.Name(), f.Base(), f.Size()) + lines := GetLines(f) + f2.SetLines(lines) + } + return fset +} + +// CloneFileSet creates a new FileSet holding all files in fset. It does not +// create copies of the token.Files in fset: they are added to the resulting +// FileSet unmodified. +func CloneFileSet(fset *token.FileSet) *token.FileSet { + var files []*token.File + fset.Iterate(func(f *token.File) bool { + files = append(files, f) + return true + }) + newFileSet := token.NewFileSet() + AddExistingFiles(newFileSet, files) + return newFileSet +} diff --git a/vendor/golang.org/x/tools/internal/typeparams/common.go b/vendor/golang.org/x/tools/internal/typeparams/common.go index 25a1426d3..cdab98853 100644 --- a/vendor/golang.org/x/tools/internal/typeparams/common.go +++ b/vendor/golang.org/x/tools/internal/typeparams/common.go @@ -23,6 +23,7 @@ package typeparams import ( + "fmt" "go/ast" "go/token" "go/types" @@ -41,7 +42,7 @@ func UnpackIndexExpr(n ast.Node) (x ast.Expr, lbrack token.Pos, indices []ast.Ex switch e := n.(type) { case *ast.IndexExpr: return e.X, e.Lbrack, []ast.Expr{e.Index}, e.Rbrack - case *IndexListExpr: + case *ast.IndexListExpr: return e.X, e.Lbrack, e.Indices, e.Rbrack } return nil, token.NoPos, nil, token.NoPos @@ -62,7 +63,7 @@ func PackIndexExpr(x ast.Expr, lbrack token.Pos, indices []ast.Expr, rbrack toke Rbrack: rbrack, } default: - return &IndexListExpr{ + return &ast.IndexListExpr{ X: x, Lbrack: lbrack, Indices: indices, @@ -73,7 +74,7 @@ func PackIndexExpr(x ast.Expr, lbrack token.Pos, indices []ast.Expr, rbrack toke // IsTypeParam reports whether t is a type parameter. func IsTypeParam(t types.Type) bool { - _, ok := t.(*TypeParam) + _, ok := t.(*types.TypeParam) return ok } @@ -87,7 +88,6 @@ func IsTypeParam(t types.Type) bool { func OriginMethod(fn *types.Func) *types.Func { recv := fn.Type().(*types.Signature).Recv() if recv == nil { - return fn } base := recv.Type() @@ -100,12 +100,37 @@ func OriginMethod(fn *types.Func) *types.Func { // Receiver is a *types.Interface. return fn } - if ForNamed(named).Len() == 0 { + if named.TypeParams().Len() == 0 { // Receiver base has no type parameters, so we can avoid the lookup below. return fn } - orig := NamedTypeOrigin(named) + orig := named.Origin() gfn, _, _ := types.LookupFieldOrMethod(orig, true, fn.Pkg(), fn.Name()) + + // This is a fix for a gopls crash (#60628) due to a go/types bug (#60634). In: + // package p + // type T *int + // func (*T) f() {} + // LookupFieldOrMethod(T, true, p, f)=nil, but NewMethodSet(*T)={(*T).f}. + // Here we make them consistent by force. + // (The go/types bug is general, but this workaround is reached only + // for generic T thanks to the early return above.) + if gfn == nil { + mset := types.NewMethodSet(types.NewPointer(orig)) + for i := 0; i < mset.Len(); i++ { + m := mset.At(i) + if m.Obj().Id() == fn.Id() { + gfn = m.Obj() + break + } + } + } + + // In golang/go#61196, we observe another crash, this time inexplicable. + if gfn == nil { + panic(fmt.Sprintf("missing origin method for %s.%s; named == origin: %t, named.NumMethods(): %d, origin.NumMethods(): %d", named, fn, named == orig, named.NumMethods(), orig.NumMethods())) + } + return gfn.(*types.Func) } @@ -132,7 +157,7 @@ func OriginMethod(fn *types.Func) *types.Func { // // In this case, GenericAssignableTo reports that instantiations of Container // are assignable to the corresponding instantiation of Interface. -func GenericAssignableTo(ctxt *Context, V, T types.Type) bool { +func GenericAssignableTo(ctxt *types.Context, V, T types.Type) bool { // If V and T are not both named, or do not have matching non-empty type // parameter lists, fall back on types.AssignableTo. @@ -142,9 +167,9 @@ func GenericAssignableTo(ctxt *Context, V, T types.Type) bool { return types.AssignableTo(V, T) } - vtparams := ForNamed(VN) - ttparams := ForNamed(TN) - if vtparams.Len() == 0 || vtparams.Len() != ttparams.Len() || NamedTypeArgs(VN).Len() != 0 || NamedTypeArgs(TN).Len() != 0 { + vtparams := VN.TypeParams() + ttparams := TN.TypeParams() + if vtparams.Len() == 0 || vtparams.Len() != ttparams.Len() || VN.TypeArgs().Len() != 0 || TN.TypeArgs().Len() != 0 { return types.AssignableTo(V, T) } @@ -157,7 +182,7 @@ func GenericAssignableTo(ctxt *Context, V, T types.Type) bool { // Minor optimization: ensure we share a context across the two // instantiations below. if ctxt == nil { - ctxt = NewContext() + ctxt = types.NewContext() } var targs []types.Type @@ -165,12 +190,12 @@ func GenericAssignableTo(ctxt *Context, V, T types.Type) bool { targs = append(targs, vtparams.At(i)) } - vinst, err := Instantiate(ctxt, V, targs, true) + vinst, err := types.Instantiate(ctxt, V, targs, true) if err != nil { panic("type parameters should satisfy their own constraints") } - tinst, err := Instantiate(ctxt, T, targs, true) + tinst, err := types.Instantiate(ctxt, T, targs, true) if err != nil { return false } diff --git a/vendor/golang.org/x/tools/internal/typeparams/coretype.go b/vendor/golang.org/x/tools/internal/typeparams/coretype.go index 993135ec9..7ea8840ea 100644 --- a/vendor/golang.org/x/tools/internal/typeparams/coretype.go +++ b/vendor/golang.org/x/tools/internal/typeparams/coretype.go @@ -81,13 +81,13 @@ func CoreType(T types.Type) types.Type { // restrictions may be arbitrarily complex. For example, consider the // following: // -// type A interface{ ~string|~[]byte } +// type A interface{ ~string|~[]byte } // -// type B interface{ int|string } +// type B interface{ int|string } // -// type C interface { ~string|~int } +// type C interface { ~string|~int } // -// type T[P interface{ A|B; C }] int +// type T[P interface{ A|B; C }] int // // In this example, the structural type restriction of P is ~string|int: A|B // expands to ~string|~[]byte|int|string, which reduces to ~string|~[]byte|int, @@ -108,15 +108,15 @@ func CoreType(T types.Type) types.Type { // // _NormalTerms makes no guarantees about the order of terms, except that it // is deterministic. -func _NormalTerms(typ types.Type) ([]*Term, error) { +func _NormalTerms(typ types.Type) ([]*types.Term, error) { switch typ := typ.(type) { - case *TypeParam: + case *types.TypeParam: return StructuralTerms(typ) - case *Union: + case *types.Union: return UnionTermSet(typ) case *types.Interface: return InterfaceTermSet(typ) default: - return []*Term{NewTerm(false, typ)}, nil + return []*types.Term{types.NewTerm(false, typ)}, nil } } diff --git a/vendor/golang.org/x/tools/internal/typeparams/enabled_go117.go b/vendor/golang.org/x/tools/internal/typeparams/enabled_go117.go deleted file mode 100644 index 18212390e..000000000 --- a/vendor/golang.org/x/tools/internal/typeparams/enabled_go117.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !go1.18 -// +build !go1.18 - -package typeparams - -// Enabled reports whether type parameters are enabled in the current build -// environment. -const Enabled = false diff --git a/vendor/golang.org/x/tools/internal/typeparams/enabled_go118.go b/vendor/golang.org/x/tools/internal/typeparams/enabled_go118.go deleted file mode 100644 index d67148823..000000000 --- a/vendor/golang.org/x/tools/internal/typeparams/enabled_go118.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build go1.18 -// +build go1.18 - -package typeparams - -// Note: this constant is in a separate file as this is the only acceptable -// diff between the <1.18 API of this package and the 1.18 API. - -// Enabled reports whether type parameters are enabled in the current build -// environment. -const Enabled = true diff --git a/vendor/golang.org/x/tools/internal/typeparams/normalize.go b/vendor/golang.org/x/tools/internal/typeparams/normalize.go index 9c631b651..93c80fdc9 100644 --- a/vendor/golang.org/x/tools/internal/typeparams/normalize.go +++ b/vendor/golang.org/x/tools/internal/typeparams/normalize.go @@ -60,7 +60,7 @@ var ErrEmptyTypeSet = errors.New("empty type set") // // StructuralTerms makes no guarantees about the order of terms, except that it // is deterministic. -func StructuralTerms(tparam *TypeParam) ([]*Term, error) { +func StructuralTerms(tparam *types.TypeParam) ([]*types.Term, error) { constraint := tparam.Constraint() if constraint == nil { return nil, fmt.Errorf("%s has nil constraint", tparam) @@ -78,7 +78,7 @@ func StructuralTerms(tparam *TypeParam) ([]*Term, error) { // // See the documentation of StructuralTerms for more information on // normalization. -func InterfaceTermSet(iface *types.Interface) ([]*Term, error) { +func InterfaceTermSet(iface *types.Interface) ([]*types.Term, error) { return computeTermSet(iface) } @@ -88,11 +88,11 @@ func InterfaceTermSet(iface *types.Interface) ([]*Term, error) { // // See the documentation of StructuralTerms for more information on // normalization. -func UnionTermSet(union *Union) ([]*Term, error) { +func UnionTermSet(union *types.Union) ([]*types.Term, error) { return computeTermSet(union) } -func computeTermSet(typ types.Type) ([]*Term, error) { +func computeTermSet(typ types.Type) ([]*types.Term, error) { tset, err := computeTermSetInternal(typ, make(map[types.Type]*termSet), 0) if err != nil { return nil, err @@ -103,9 +103,9 @@ func computeTermSet(typ types.Type) ([]*Term, error) { if tset.terms.isAll() { return nil, nil } - var terms []*Term + var terms []*types.Term for _, term := range tset.terms { - terms = append(terms, NewTerm(term.tilde, term.typ)) + terms = append(terms, types.NewTerm(term.tilde, term.typ)) } return terms, nil } @@ -162,7 +162,7 @@ func computeTermSetInternal(t types.Type, seen map[types.Type]*termSet, depth in tset.terms = allTermlist for i := 0; i < u.NumEmbeddeds(); i++ { embedded := u.EmbeddedType(i) - if _, ok := embedded.Underlying().(*TypeParam); ok { + if _, ok := embedded.Underlying().(*types.TypeParam); ok { return nil, fmt.Errorf("invalid embedded type %T", embedded) } tset2, err := computeTermSetInternal(embedded, seen, depth+1) @@ -171,7 +171,7 @@ func computeTermSetInternal(t types.Type, seen map[types.Type]*termSet, depth in } tset.terms = tset.terms.intersect(tset2.terms) } - case *Union: + case *types.Union: // The term set of a union is the union of term sets of its terms. tset.terms = nil for i := 0; i < u.Len(); i++ { @@ -184,7 +184,7 @@ func computeTermSetInternal(t types.Type, seen map[types.Type]*termSet, depth in return nil, err } terms = tset2.terms - case *TypeParam, *Union: + case *types.TypeParam, *types.Union: // A stand-alone type parameter or union is not permitted as union // term. return nil, fmt.Errorf("invalid union term %T", t) @@ -199,7 +199,7 @@ func computeTermSetInternal(t types.Type, seen map[types.Type]*termSet, depth in return nil, fmt.Errorf("exceeded max term count %d", maxTermCount) } } - case *TypeParam: + case *types.TypeParam: panic("unreachable") default: // For all other types, the term set is just a single non-tilde term diff --git a/vendor/golang.org/x/tools/internal/typeparams/termlist.go b/vendor/golang.org/x/tools/internal/typeparams/termlist.go index 933106a23..cbd12f801 100644 --- a/vendor/golang.org/x/tools/internal/typeparams/termlist.go +++ b/vendor/golang.org/x/tools/internal/typeparams/termlist.go @@ -30,7 +30,7 @@ func (xl termlist) String() string { var buf bytes.Buffer for i, x := range xl { if i > 0 { - buf.WriteString(" āˆŖ ") + buf.WriteString(" | ") } buf.WriteString(x.String()) } diff --git a/vendor/golang.org/x/tools/internal/typeparams/typeparams_go117.go b/vendor/golang.org/x/tools/internal/typeparams/typeparams_go117.go deleted file mode 100644 index b4788978f..000000000 --- a/vendor/golang.org/x/tools/internal/typeparams/typeparams_go117.go +++ /dev/null @@ -1,197 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !go1.18 -// +build !go1.18 - -package typeparams - -import ( - "go/ast" - "go/token" - "go/types" -) - -func unsupported() { - panic("type parameters are unsupported at this go version") -} - -// IndexListExpr is a placeholder type, as type parameters are not supported at -// this Go version. Its methods panic on use. -type IndexListExpr struct { - ast.Expr - X ast.Expr // expression - Lbrack token.Pos // position of "[" - Indices []ast.Expr // index expressions - Rbrack token.Pos // position of "]" -} - -// ForTypeSpec returns an empty field list, as type parameters on not supported -// at this Go version. -func ForTypeSpec(*ast.TypeSpec) *ast.FieldList { - return nil -} - -// ForFuncType returns an empty field list, as type parameters are not -// supported at this Go version. -func ForFuncType(*ast.FuncType) *ast.FieldList { - return nil -} - -// TypeParam is a placeholder type, as type parameters are not supported at -// this Go version. Its methods panic on use. -type TypeParam struct{ types.Type } - -func (*TypeParam) Index() int { unsupported(); return 0 } -func (*TypeParam) Constraint() types.Type { unsupported(); return nil } -func (*TypeParam) Obj() *types.TypeName { unsupported(); return nil } - -// TypeParamList is a placeholder for an empty type parameter list. -type TypeParamList struct{} - -func (*TypeParamList) Len() int { return 0 } -func (*TypeParamList) At(int) *TypeParam { unsupported(); return nil } - -// TypeList is a placeholder for an empty type list. -type TypeList struct{} - -func (*TypeList) Len() int { return 0 } -func (*TypeList) At(int) types.Type { unsupported(); return nil } - -// NewTypeParam is unsupported at this Go version, and panics. -func NewTypeParam(name *types.TypeName, constraint types.Type) *TypeParam { - unsupported() - return nil -} - -// SetTypeParamConstraint is unsupported at this Go version, and panics. -func SetTypeParamConstraint(tparam *TypeParam, constraint types.Type) { - unsupported() -} - -// NewSignatureType calls types.NewSignature, panicking if recvTypeParams or -// typeParams is non-empty. -func NewSignatureType(recv *types.Var, recvTypeParams, typeParams []*TypeParam, params, results *types.Tuple, variadic bool) *types.Signature { - if len(recvTypeParams) != 0 || len(typeParams) != 0 { - panic("signatures cannot have type parameters at this Go version") - } - return types.NewSignature(recv, params, results, variadic) -} - -// ForSignature returns an empty slice. -func ForSignature(*types.Signature) *TypeParamList { - return nil -} - -// RecvTypeParams returns a nil slice. -func RecvTypeParams(sig *types.Signature) *TypeParamList { - return nil -} - -// IsComparable returns false, as no interfaces are type-restricted at this Go -// version. -func IsComparable(*types.Interface) bool { - return false -} - -// IsMethodSet returns true, as no interfaces are type-restricted at this Go -// version. -func IsMethodSet(*types.Interface) bool { - return true -} - -// IsImplicit returns false, as no interfaces are implicit at this Go version. -func IsImplicit(*types.Interface) bool { - return false -} - -// MarkImplicit does nothing, because this Go version does not have implicit -// interfaces. -func MarkImplicit(*types.Interface) {} - -// ForNamed returns an empty type parameter list, as type parameters are not -// supported at this Go version. -func ForNamed(*types.Named) *TypeParamList { - return nil -} - -// SetForNamed panics if tparams is non-empty. -func SetForNamed(_ *types.Named, tparams []*TypeParam) { - if len(tparams) > 0 { - unsupported() - } -} - -// NamedTypeArgs returns nil. -func NamedTypeArgs(*types.Named) *TypeList { - return nil -} - -// NamedTypeOrigin is the identity method at this Go version. -func NamedTypeOrigin(named *types.Named) types.Type { - return named -} - -// Term holds information about a structural type restriction. -type Term struct { - tilde bool - typ types.Type -} - -func (m *Term) Tilde() bool { return m.tilde } -func (m *Term) Type() types.Type { return m.typ } -func (m *Term) String() string { - pre := "" - if m.tilde { - pre = "~" - } - return pre + m.typ.String() -} - -// NewTerm is unsupported at this Go version, and panics. -func NewTerm(tilde bool, typ types.Type) *Term { - return &Term{tilde, typ} -} - -// Union is a placeholder type, as type parameters are not supported at this Go -// version. Its methods panic on use. -type Union struct{ types.Type } - -func (*Union) Len() int { return 0 } -func (*Union) Term(i int) *Term { unsupported(); return nil } - -// NewUnion is unsupported at this Go version, and panics. -func NewUnion(terms []*Term) *Union { - unsupported() - return nil -} - -// InitInstanceInfo is a noop at this Go version. -func InitInstanceInfo(*types.Info) {} - -// Instance is a placeholder type, as type parameters are not supported at this -// Go version. -type Instance struct { - TypeArgs *TypeList - Type types.Type -} - -// GetInstances returns a nil map, as type parameters are not supported at this -// Go version. -func GetInstances(info *types.Info) map[*ast.Ident]Instance { return nil } - -// Context is a placeholder type, as type parameters are not supported at -// this Go version. -type Context struct{} - -// NewContext returns a placeholder Context instance. -func NewContext() *Context { - return &Context{} -} - -// Instantiate is unsupported on this Go version, and panics. -func Instantiate(ctxt *Context, typ types.Type, targs []types.Type, validate bool) (types.Type, error) { - unsupported() - return nil, nil -} diff --git a/vendor/golang.org/x/tools/internal/typeparams/typeparams_go118.go b/vendor/golang.org/x/tools/internal/typeparams/typeparams_go118.go deleted file mode 100644 index 114a36b86..000000000 --- a/vendor/golang.org/x/tools/internal/typeparams/typeparams_go118.go +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build go1.18 -// +build go1.18 - -package typeparams - -import ( - "go/ast" - "go/types" -) - -// IndexListExpr is an alias for ast.IndexListExpr. -type IndexListExpr = ast.IndexListExpr - -// ForTypeSpec returns n.TypeParams. -func ForTypeSpec(n *ast.TypeSpec) *ast.FieldList { - if n == nil { - return nil - } - return n.TypeParams -} - -// ForFuncType returns n.TypeParams. -func ForFuncType(n *ast.FuncType) *ast.FieldList { - if n == nil { - return nil - } - return n.TypeParams -} - -// TypeParam is an alias for types.TypeParam -type TypeParam = types.TypeParam - -// TypeParamList is an alias for types.TypeParamList -type TypeParamList = types.TypeParamList - -// TypeList is an alias for types.TypeList -type TypeList = types.TypeList - -// NewTypeParam calls types.NewTypeParam. -func NewTypeParam(name *types.TypeName, constraint types.Type) *TypeParam { - return types.NewTypeParam(name, constraint) -} - -// SetTypeParamConstraint calls tparam.SetConstraint(constraint). -func SetTypeParamConstraint(tparam *TypeParam, constraint types.Type) { - tparam.SetConstraint(constraint) -} - -// NewSignatureType calls types.NewSignatureType. -func NewSignatureType(recv *types.Var, recvTypeParams, typeParams []*TypeParam, params, results *types.Tuple, variadic bool) *types.Signature { - return types.NewSignatureType(recv, recvTypeParams, typeParams, params, results, variadic) -} - -// ForSignature returns sig.TypeParams() -func ForSignature(sig *types.Signature) *TypeParamList { - return sig.TypeParams() -} - -// RecvTypeParams returns sig.RecvTypeParams(). -func RecvTypeParams(sig *types.Signature) *TypeParamList { - return sig.RecvTypeParams() -} - -// IsComparable calls iface.IsComparable(). -func IsComparable(iface *types.Interface) bool { - return iface.IsComparable() -} - -// IsMethodSet calls iface.IsMethodSet(). -func IsMethodSet(iface *types.Interface) bool { - return iface.IsMethodSet() -} - -// IsImplicit calls iface.IsImplicit(). -func IsImplicit(iface *types.Interface) bool { - return iface.IsImplicit() -} - -// MarkImplicit calls iface.MarkImplicit(). -func MarkImplicit(iface *types.Interface) { - iface.MarkImplicit() -} - -// ForNamed extracts the (possibly empty) type parameter object list from -// named. -func ForNamed(named *types.Named) *TypeParamList { - return named.TypeParams() -} - -// SetForNamed sets the type params tparams on n. Each tparam must be of -// dynamic type *types.TypeParam. -func SetForNamed(n *types.Named, tparams []*TypeParam) { - n.SetTypeParams(tparams) -} - -// NamedTypeArgs returns named.TypeArgs(). -func NamedTypeArgs(named *types.Named) *TypeList { - return named.TypeArgs() -} - -// NamedTypeOrigin returns named.Orig(). -func NamedTypeOrigin(named *types.Named) types.Type { - return named.Origin() -} - -// Term is an alias for types.Term. -type Term = types.Term - -// NewTerm calls types.NewTerm. -func NewTerm(tilde bool, typ types.Type) *Term { - return types.NewTerm(tilde, typ) -} - -// Union is an alias for types.Union -type Union = types.Union - -// NewUnion calls types.NewUnion. -func NewUnion(terms []*Term) *Union { - return types.NewUnion(terms) -} - -// InitInstanceInfo initializes info to record information about type and -// function instances. -func InitInstanceInfo(info *types.Info) { - info.Instances = make(map[*ast.Ident]types.Instance) -} - -// Instance is an alias for types.Instance. -type Instance = types.Instance - -// GetInstances returns info.Instances. -func GetInstances(info *types.Info) map[*ast.Ident]Instance { - return info.Instances -} - -// Context is an alias for types.Context. -type Context = types.Context - -// NewContext calls types.NewContext. -func NewContext() *Context { - return types.NewContext() -} - -// Instantiate calls types.Instantiate. -func Instantiate(ctxt *Context, typ types.Type, targs []types.Type, validate bool) (types.Type, error) { - return types.Instantiate(ctxt, typ, targs, validate) -} diff --git a/vendor/golang.org/x/tools/internal/typeparams/typeterm.go b/vendor/golang.org/x/tools/internal/typeparams/typeterm.go index 7ddee28d9..7350bb702 100644 --- a/vendor/golang.org/x/tools/internal/typeparams/typeterm.go +++ b/vendor/golang.org/x/tools/internal/typeparams/typeterm.go @@ -10,11 +10,10 @@ import "go/types" // A term describes elementary type sets: // -// āˆ…: (*term)(nil) == āˆ… // set of no types (empty set) -// š“¤: &term{} == š“¤ // set of all types (š“¤niverse) -// T: &term{false, T} == {T} // set of type T -// ~t: &term{true, t} == {t' | under(t') == t} // set of types with underlying type t -// +// āˆ…: (*term)(nil) == āˆ… // set of no types (empty set) +// š“¤: &term{} == š“¤ // set of all types (š“¤niverse) +// T: &term{false, T} == {T} // set of type T +// ~t: &term{true, t} == {t' | under(t') == t} // set of types with underlying type t type term struct { tilde bool // valid if typ != nil typ types.Type diff --git a/vendor/google.golang.org/api/internal/cba.go b/vendor/google.golang.org/api/internal/cba.go index cecbb9ba1..829383f55 100644 --- a/vendor/google.golang.org/api/internal/cba.go +++ b/vendor/google.golang.org/api/internal/cba.go @@ -91,16 +91,10 @@ func getTransportConfig(settings *DialSettings) (*transportConfig, error) { s2aMTLSEndpoint: "", } - // Check the env to determine whether to use S2A. - if !isGoogleS2AEnabled() { + if !shouldUseS2A(clientCertSource, settings) { return &defaultTransportConfig, nil } - // If client cert is found, use that over S2A. - // If MTLS is not enabled for the endpoint, skip S2A. - if clientCertSource != nil || !mtlsEndpointEnabledForS2A() { - return &defaultTransportConfig, nil - } s2aMTLSEndpoint := settings.DefaultMTLSEndpoint // If there is endpoint override, honor it. if settings.Endpoint != "" { @@ -118,10 +112,6 @@ func getTransportConfig(settings *DialSettings) (*transportConfig, error) { }, nil } -func isGoogleS2AEnabled() bool { - return strings.ToLower(os.Getenv(googleAPIUseS2AEnv)) == "true" -} - // getClientCertificateSource returns a default client certificate source, if // not provided by the user. // @@ -275,8 +265,36 @@ func GetHTTPTransportConfigAndEndpoint(settings *DialSettings) (cert.Source, fun return nil, dialTLSContextFunc, config.s2aMTLSEndpoint, nil } +func shouldUseS2A(clientCertSource cert.Source, settings *DialSettings) bool { + // If client cert is found, use that over S2A. + if clientCertSource != nil { + return false + } + // If EXPERIMENTAL_GOOGLE_API_USE_S2A is not set to true, skip S2A. + if !isGoogleS2AEnabled() { + return false + } + // If DefaultMTLSEndpoint is not set and no endpoint override, skip S2A. + if settings.DefaultMTLSEndpoint == "" && settings.Endpoint == "" { + return false + } + // If MTLS is not enabled for this endpoint, skip S2A. + if !mtlsEndpointEnabledForS2A() { + return false + } + // If custom HTTP client is provided, skip S2A. + if settings.HTTPClient != nil { + return false + } + return true +} + // mtlsEndpointEnabledForS2A checks if the endpoint is indeed MTLS-enabled, so that we can use S2A for MTLS connection. var mtlsEndpointEnabledForS2A = func() bool { // TODO(xmenxk): determine this via discovery config. return true } + +func isGoogleS2AEnabled() bool { + return strings.ToLower(os.Getenv(googleAPIUseS2AEnv)) == "true" +} diff --git a/vendor/google.golang.org/api/internal/creds.go b/vendor/google.golang.org/api/internal/creds.go index 92b3acf6e..05165f333 100644 --- a/vendor/google.golang.org/api/internal/creds.go +++ b/vendor/google.golang.org/api/internal/creds.go @@ -78,9 +78,8 @@ const ( // met: // // (1) At least one of the following is true: -// (a) No scope is provided -// (b) Scope for self-signed JWT flow is enabled -// (c) Audiences are explicitly provided by users +// (a) Scope for self-signed JWT flow is enabled +// (b) Audiences are explicitly provided by users // (2) No service account impersontation // // - Otherwise, executes standard OAuth 2.0 flow diff --git a/vendor/google.golang.org/api/internal/s2a.go b/vendor/google.golang.org/api/internal/s2a.go index c5b421f55..c70f2419b 100644 --- a/vendor/google.golang.org/api/internal/s2a.go +++ b/vendor/google.golang.org/api/internal/s2a.go @@ -13,7 +13,7 @@ import ( "cloud.google.com/go/compute/metadata" ) -const configEndpointSuffix = "googleAutoMtlsConfiguration" +const configEndpointSuffix = "instance/platform-security/auto-mtls-configuration" // The period an MTLS config can be reused before needing refresh. var configExpiry = time.Hour diff --git a/vendor/google.golang.org/api/internal/settings.go b/vendor/google.golang.org/api/internal/settings.go index 3a3874df1..84f9302dc 100644 --- a/vendor/google.golang.org/api/internal/settings.go +++ b/vendor/google.golang.org/api/internal/settings.go @@ -9,6 +9,8 @@ import ( "crypto/tls" "errors" "net/http" + "os" + "strconv" "golang.org/x/oauth2" "golang.org/x/oauth2/google" @@ -16,6 +18,10 @@ import ( "google.golang.org/grpc" ) +const ( + newAuthLibEnVar = "GOOGLE_API_GO_EXPERIMENTAL_USE_NEW_AUTH_LIB" +) + // DialSettings holds information needed to establish a connection with a // Google API service. type DialSettings struct { @@ -47,6 +53,7 @@ type DialSettings struct { ImpersonationConfig *impersonate.Config EnableDirectPath bool EnableDirectPathXds bool + EnableNewAuthLibrary bool AllowNonDefaultServiceAccount bool // Google API system parameters. For more information please read: @@ -77,6 +84,16 @@ func (ds *DialSettings) HasCustomAudience() bool { return len(ds.Audiences) > 0 } +func (ds *DialSettings) IsNewAuthLibraryEnabled() bool { + if ds.EnableNewAuthLibrary { + return true + } + if b, err := strconv.ParseBool(os.Getenv(newAuthLibEnVar)); err == nil { + return b + } + return false +} + // Validate reports an error if ds is invalid. func (ds *DialSettings) Validate() error { if ds.SkipValidation { diff --git a/vendor/google.golang.org/api/internal/version.go b/vendor/google.golang.org/api/internal/version.go index 54d30ef66..0674cb4f6 100644 --- a/vendor/google.golang.org/api/internal/version.go +++ b/vendor/google.golang.org/api/internal/version.go @@ -5,4 +5,4 @@ package internal // Version is the current tagged release of the library. -const Version = "0.128.0" +const Version = "0.149.0" diff --git a/vendor/google.golang.org/api/option/internaloption/internaloption.go b/vendor/google.golang.org/api/option/internaloption/internaloption.go index 3b8461d1d..b2b249eec 100644 --- a/vendor/google.golang.org/api/option/internaloption/internaloption.go +++ b/vendor/google.golang.org/api/option/internaloption/internaloption.go @@ -150,6 +150,19 @@ func (w *withCreds) Apply(o *internal.DialSettings) { o.InternalCredentials = (*google.Credentials)(w) } +// EnableNewAuthLibrary returns a ClientOption that specifies if libraries in this +// module to delegate auth to our new library. This option will be removed in +// the future once all clients have been moved to the new auth layer. +func EnableNewAuthLibrary() option.ClientOption { + return enableNewAuthLibrary(true) +} + +type enableNewAuthLibrary bool + +func (w enableNewAuthLibrary) Apply(o *internal.DialSettings) { + o.EnableNewAuthLibrary = bool(w) +} + // EmbeddableAdapter is a no-op option.ClientOption that allow libraries to // create their own client options by embedding this type into their own // client-specific option wrapper. See example for usage. diff --git a/vendor/google.golang.org/api/transport/grpc/dial.go b/vendor/google.golang.org/api/transport/grpc/dial.go index e1403e08e..e36d7589e 100644 --- a/vendor/google.golang.org/api/transport/grpc/dial.go +++ b/vendor/google.golang.org/api/transport/grpc/dial.go @@ -35,9 +35,6 @@ const disableDirectPath = "GOOGLE_CLOUD_DISABLE_DIRECT_PATH" // Check env to decide if using google-c2p resolver for DirectPath traffic. const enableDirectPathXds = "GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS" -// Set at init time by dial_appengine.go. If nil, we're not on App Engine. -var appengineDialerHook func(context.Context) grpc.DialOption - // Set at init time by dial_socketopt.go. If nil, socketopt is not supported. var timeoutDialerOption grpc.DialOption @@ -186,12 +183,6 @@ func dial(ctx context.Context, insecure bool, o *internal.DialSettings) (*grpc.C } } - if appengineDialerHook != nil { - // Use the Socket API on App Engine. - // appengine dialer will override socketopt dialer - grpcOpts = append(grpcOpts, appengineDialerHook(ctx)) - } - // Add tracing, but before the other options, so that clients can override the // gRPC stats handler. // This assumes that gRPC options are processed in order, left to right. diff --git a/vendor/google.golang.org/api/transport/grpc/dial_appengine.go b/vendor/google.golang.org/api/transport/grpc/dial_appengine.go deleted file mode 100644 index fd3dc0565..000000000 --- a/vendor/google.golang.org/api/transport/grpc/dial_appengine.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2016 Google LLC. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build appengine -// +build appengine - -package grpc - -import ( - "context" - "net" - "time" - - "google.golang.org/appengine" - "google.golang.org/appengine/socket" - "google.golang.org/grpc" -) - -func init() { - // NOTE: dev_appserver doesn't currently support SSL. - // When it does, this code can be removed. - if appengine.IsDevAppServer() { - return - } - - appengineDialerHook = func(ctx context.Context) grpc.DialOption { - return grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) { - return socket.DialTimeout(ctx, "tcp", addr, timeout) - }) - } -} diff --git a/vendor/google.golang.org/api/transport/http/dial.go b/vendor/google.golang.org/api/transport/http/dial.go index eca0c3ba7..a07362ffd 100644 --- a/vendor/google.golang.org/api/transport/http/dial.go +++ b/vendor/google.golang.org/api/transport/http/dial.go @@ -145,22 +145,13 @@ func (t *parameterTransport) RoundTrip(req *http.Request) (*http.Response, error return rt.RoundTrip(&newReq) } -// Set at init time by dial_appengine.go. If nil, we're not on App Engine. -var appengineUrlfetchHook func(context.Context) http.RoundTripper - -// defaultBaseTransport returns the base HTTP transport. -// On App Engine, this is urlfetch.Transport. -// Otherwise, use a default transport, taking most defaults from -// http.DefaultTransport. +// defaultBaseTransport returns the base HTTP transport. It uses a default +// transport, taking most defaults from http.DefaultTransport. // If TLSCertificate is available, set TLSClientConfig as well. func defaultBaseTransport(ctx context.Context, clientCertSource cert.Source, dialTLSContext func(context.Context, string, string) (net.Conn, error)) http.RoundTripper { - if appengineUrlfetchHook != nil { - return appengineUrlfetchHook(ctx) - } - // Copy http.DefaultTransport except for MaxIdleConnsPerHost setting, - // which is increased due to reported performance issues under load in the GCS - // client. Transport.Clone is only available in Go 1.13 and up. + // which is increased due to reported performance issues under load in the + // GCS client. Transport.Clone is only available in Go 1.13 and up. trans := clonedTransport(http.DefaultTransport) if trans == nil { trans = fallbackBaseTransport() diff --git a/vendor/google.golang.org/api/transport/http/dial_appengine.go b/vendor/google.golang.org/api/transport/http/dial_appengine.go deleted file mode 100644 index f064e133f..000000000 --- a/vendor/google.golang.org/api/transport/http/dial_appengine.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 Google LLC. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build appengine -// +build appengine - -package http - -import ( - "context" - "net/http" - - "google.golang.org/appengine/urlfetch" -) - -func init() { - appengineUrlfetchHook = func(ctx context.Context) http.RoundTripper { - return &urlfetch.Transport{Context: ctx} - } -} diff --git a/vendor/google.golang.org/appengine/internal/socket/socket_service.pb.go b/vendor/google.golang.org/appengine/internal/socket/socket_service.pb.go deleted file mode 100644 index 4ec872e46..000000000 --- a/vendor/google.golang.org/appengine/internal/socket/socket_service.pb.go +++ /dev/null @@ -1,2822 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: google.golang.org/appengine/internal/socket/socket_service.proto - -package socket - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type RemoteSocketServiceError_ErrorCode int32 - -const ( - RemoteSocketServiceError_SYSTEM_ERROR RemoteSocketServiceError_ErrorCode = 1 - RemoteSocketServiceError_GAI_ERROR RemoteSocketServiceError_ErrorCode = 2 - RemoteSocketServiceError_FAILURE RemoteSocketServiceError_ErrorCode = 4 - RemoteSocketServiceError_PERMISSION_DENIED RemoteSocketServiceError_ErrorCode = 5 - RemoteSocketServiceError_INVALID_REQUEST RemoteSocketServiceError_ErrorCode = 6 - RemoteSocketServiceError_SOCKET_CLOSED RemoteSocketServiceError_ErrorCode = 7 -) - -var RemoteSocketServiceError_ErrorCode_name = map[int32]string{ - 1: "SYSTEM_ERROR", - 2: "GAI_ERROR", - 4: "FAILURE", - 5: "PERMISSION_DENIED", - 6: "INVALID_REQUEST", - 7: "SOCKET_CLOSED", -} -var RemoteSocketServiceError_ErrorCode_value = map[string]int32{ - "SYSTEM_ERROR": 1, - "GAI_ERROR": 2, - "FAILURE": 4, - "PERMISSION_DENIED": 5, - "INVALID_REQUEST": 6, - "SOCKET_CLOSED": 7, -} - -func (x RemoteSocketServiceError_ErrorCode) Enum() *RemoteSocketServiceError_ErrorCode { - p := new(RemoteSocketServiceError_ErrorCode) - *p = x - return p -} -func (x RemoteSocketServiceError_ErrorCode) String() string { - return proto.EnumName(RemoteSocketServiceError_ErrorCode_name, int32(x)) -} -func (x *RemoteSocketServiceError_ErrorCode) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(RemoteSocketServiceError_ErrorCode_value, data, "RemoteSocketServiceError_ErrorCode") - if err != nil { - return err - } - *x = RemoteSocketServiceError_ErrorCode(value) - return nil -} -func (RemoteSocketServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{0, 0} -} - -type RemoteSocketServiceError_SystemError int32 - -const ( - RemoteSocketServiceError_SYS_SUCCESS RemoteSocketServiceError_SystemError = 0 - RemoteSocketServiceError_SYS_EPERM RemoteSocketServiceError_SystemError = 1 - RemoteSocketServiceError_SYS_ENOENT RemoteSocketServiceError_SystemError = 2 - RemoteSocketServiceError_SYS_ESRCH RemoteSocketServiceError_SystemError = 3 - RemoteSocketServiceError_SYS_EINTR RemoteSocketServiceError_SystemError = 4 - RemoteSocketServiceError_SYS_EIO RemoteSocketServiceError_SystemError = 5 - RemoteSocketServiceError_SYS_ENXIO RemoteSocketServiceError_SystemError = 6 - RemoteSocketServiceError_SYS_E2BIG RemoteSocketServiceError_SystemError = 7 - RemoteSocketServiceError_SYS_ENOEXEC RemoteSocketServiceError_SystemError = 8 - RemoteSocketServiceError_SYS_EBADF RemoteSocketServiceError_SystemError = 9 - RemoteSocketServiceError_SYS_ECHILD RemoteSocketServiceError_SystemError = 10 - RemoteSocketServiceError_SYS_EAGAIN RemoteSocketServiceError_SystemError = 11 - RemoteSocketServiceError_SYS_EWOULDBLOCK RemoteSocketServiceError_SystemError = 11 - RemoteSocketServiceError_SYS_ENOMEM RemoteSocketServiceError_SystemError = 12 - RemoteSocketServiceError_SYS_EACCES RemoteSocketServiceError_SystemError = 13 - RemoteSocketServiceError_SYS_EFAULT RemoteSocketServiceError_SystemError = 14 - RemoteSocketServiceError_SYS_ENOTBLK RemoteSocketServiceError_SystemError = 15 - RemoteSocketServiceError_SYS_EBUSY RemoteSocketServiceError_SystemError = 16 - RemoteSocketServiceError_SYS_EEXIST RemoteSocketServiceError_SystemError = 17 - RemoteSocketServiceError_SYS_EXDEV RemoteSocketServiceError_SystemError = 18 - RemoteSocketServiceError_SYS_ENODEV RemoteSocketServiceError_SystemError = 19 - RemoteSocketServiceError_SYS_ENOTDIR RemoteSocketServiceError_SystemError = 20 - RemoteSocketServiceError_SYS_EISDIR RemoteSocketServiceError_SystemError = 21 - RemoteSocketServiceError_SYS_EINVAL RemoteSocketServiceError_SystemError = 22 - RemoteSocketServiceError_SYS_ENFILE RemoteSocketServiceError_SystemError = 23 - RemoteSocketServiceError_SYS_EMFILE RemoteSocketServiceError_SystemError = 24 - RemoteSocketServiceError_SYS_ENOTTY RemoteSocketServiceError_SystemError = 25 - RemoteSocketServiceError_SYS_ETXTBSY RemoteSocketServiceError_SystemError = 26 - RemoteSocketServiceError_SYS_EFBIG RemoteSocketServiceError_SystemError = 27 - RemoteSocketServiceError_SYS_ENOSPC RemoteSocketServiceError_SystemError = 28 - RemoteSocketServiceError_SYS_ESPIPE RemoteSocketServiceError_SystemError = 29 - RemoteSocketServiceError_SYS_EROFS RemoteSocketServiceError_SystemError = 30 - RemoteSocketServiceError_SYS_EMLINK RemoteSocketServiceError_SystemError = 31 - RemoteSocketServiceError_SYS_EPIPE RemoteSocketServiceError_SystemError = 32 - RemoteSocketServiceError_SYS_EDOM RemoteSocketServiceError_SystemError = 33 - RemoteSocketServiceError_SYS_ERANGE RemoteSocketServiceError_SystemError = 34 - RemoteSocketServiceError_SYS_EDEADLK RemoteSocketServiceError_SystemError = 35 - RemoteSocketServiceError_SYS_EDEADLOCK RemoteSocketServiceError_SystemError = 35 - RemoteSocketServiceError_SYS_ENAMETOOLONG RemoteSocketServiceError_SystemError = 36 - RemoteSocketServiceError_SYS_ENOLCK RemoteSocketServiceError_SystemError = 37 - RemoteSocketServiceError_SYS_ENOSYS RemoteSocketServiceError_SystemError = 38 - RemoteSocketServiceError_SYS_ENOTEMPTY RemoteSocketServiceError_SystemError = 39 - RemoteSocketServiceError_SYS_ELOOP RemoteSocketServiceError_SystemError = 40 - RemoteSocketServiceError_SYS_ENOMSG RemoteSocketServiceError_SystemError = 42 - RemoteSocketServiceError_SYS_EIDRM RemoteSocketServiceError_SystemError = 43 - RemoteSocketServiceError_SYS_ECHRNG RemoteSocketServiceError_SystemError = 44 - RemoteSocketServiceError_SYS_EL2NSYNC RemoteSocketServiceError_SystemError = 45 - RemoteSocketServiceError_SYS_EL3HLT RemoteSocketServiceError_SystemError = 46 - RemoteSocketServiceError_SYS_EL3RST RemoteSocketServiceError_SystemError = 47 - RemoteSocketServiceError_SYS_ELNRNG RemoteSocketServiceError_SystemError = 48 - RemoteSocketServiceError_SYS_EUNATCH RemoteSocketServiceError_SystemError = 49 - RemoteSocketServiceError_SYS_ENOCSI RemoteSocketServiceError_SystemError = 50 - RemoteSocketServiceError_SYS_EL2HLT RemoteSocketServiceError_SystemError = 51 - RemoteSocketServiceError_SYS_EBADE RemoteSocketServiceError_SystemError = 52 - RemoteSocketServiceError_SYS_EBADR RemoteSocketServiceError_SystemError = 53 - RemoteSocketServiceError_SYS_EXFULL RemoteSocketServiceError_SystemError = 54 - RemoteSocketServiceError_SYS_ENOANO RemoteSocketServiceError_SystemError = 55 - RemoteSocketServiceError_SYS_EBADRQC RemoteSocketServiceError_SystemError = 56 - RemoteSocketServiceError_SYS_EBADSLT RemoteSocketServiceError_SystemError = 57 - RemoteSocketServiceError_SYS_EBFONT RemoteSocketServiceError_SystemError = 59 - RemoteSocketServiceError_SYS_ENOSTR RemoteSocketServiceError_SystemError = 60 - RemoteSocketServiceError_SYS_ENODATA RemoteSocketServiceError_SystemError = 61 - RemoteSocketServiceError_SYS_ETIME RemoteSocketServiceError_SystemError = 62 - RemoteSocketServiceError_SYS_ENOSR RemoteSocketServiceError_SystemError = 63 - RemoteSocketServiceError_SYS_ENONET RemoteSocketServiceError_SystemError = 64 - RemoteSocketServiceError_SYS_ENOPKG RemoteSocketServiceError_SystemError = 65 - RemoteSocketServiceError_SYS_EREMOTE RemoteSocketServiceError_SystemError = 66 - RemoteSocketServiceError_SYS_ENOLINK RemoteSocketServiceError_SystemError = 67 - RemoteSocketServiceError_SYS_EADV RemoteSocketServiceError_SystemError = 68 - RemoteSocketServiceError_SYS_ESRMNT RemoteSocketServiceError_SystemError = 69 - RemoteSocketServiceError_SYS_ECOMM RemoteSocketServiceError_SystemError = 70 - RemoteSocketServiceError_SYS_EPROTO RemoteSocketServiceError_SystemError = 71 - RemoteSocketServiceError_SYS_EMULTIHOP RemoteSocketServiceError_SystemError = 72 - RemoteSocketServiceError_SYS_EDOTDOT RemoteSocketServiceError_SystemError = 73 - RemoteSocketServiceError_SYS_EBADMSG RemoteSocketServiceError_SystemError = 74 - RemoteSocketServiceError_SYS_EOVERFLOW RemoteSocketServiceError_SystemError = 75 - RemoteSocketServiceError_SYS_ENOTUNIQ RemoteSocketServiceError_SystemError = 76 - RemoteSocketServiceError_SYS_EBADFD RemoteSocketServiceError_SystemError = 77 - RemoteSocketServiceError_SYS_EREMCHG RemoteSocketServiceError_SystemError = 78 - RemoteSocketServiceError_SYS_ELIBACC RemoteSocketServiceError_SystemError = 79 - RemoteSocketServiceError_SYS_ELIBBAD RemoteSocketServiceError_SystemError = 80 - RemoteSocketServiceError_SYS_ELIBSCN RemoteSocketServiceError_SystemError = 81 - RemoteSocketServiceError_SYS_ELIBMAX RemoteSocketServiceError_SystemError = 82 - RemoteSocketServiceError_SYS_ELIBEXEC RemoteSocketServiceError_SystemError = 83 - RemoteSocketServiceError_SYS_EILSEQ RemoteSocketServiceError_SystemError = 84 - RemoteSocketServiceError_SYS_ERESTART RemoteSocketServiceError_SystemError = 85 - RemoteSocketServiceError_SYS_ESTRPIPE RemoteSocketServiceError_SystemError = 86 - RemoteSocketServiceError_SYS_EUSERS RemoteSocketServiceError_SystemError = 87 - RemoteSocketServiceError_SYS_ENOTSOCK RemoteSocketServiceError_SystemError = 88 - RemoteSocketServiceError_SYS_EDESTADDRREQ RemoteSocketServiceError_SystemError = 89 - RemoteSocketServiceError_SYS_EMSGSIZE RemoteSocketServiceError_SystemError = 90 - RemoteSocketServiceError_SYS_EPROTOTYPE RemoteSocketServiceError_SystemError = 91 - RemoteSocketServiceError_SYS_ENOPROTOOPT RemoteSocketServiceError_SystemError = 92 - RemoteSocketServiceError_SYS_EPROTONOSUPPORT RemoteSocketServiceError_SystemError = 93 - RemoteSocketServiceError_SYS_ESOCKTNOSUPPORT RemoteSocketServiceError_SystemError = 94 - RemoteSocketServiceError_SYS_EOPNOTSUPP RemoteSocketServiceError_SystemError = 95 - RemoteSocketServiceError_SYS_ENOTSUP RemoteSocketServiceError_SystemError = 95 - RemoteSocketServiceError_SYS_EPFNOSUPPORT RemoteSocketServiceError_SystemError = 96 - RemoteSocketServiceError_SYS_EAFNOSUPPORT RemoteSocketServiceError_SystemError = 97 - RemoteSocketServiceError_SYS_EADDRINUSE RemoteSocketServiceError_SystemError = 98 - RemoteSocketServiceError_SYS_EADDRNOTAVAIL RemoteSocketServiceError_SystemError = 99 - RemoteSocketServiceError_SYS_ENETDOWN RemoteSocketServiceError_SystemError = 100 - RemoteSocketServiceError_SYS_ENETUNREACH RemoteSocketServiceError_SystemError = 101 - RemoteSocketServiceError_SYS_ENETRESET RemoteSocketServiceError_SystemError = 102 - RemoteSocketServiceError_SYS_ECONNABORTED RemoteSocketServiceError_SystemError = 103 - RemoteSocketServiceError_SYS_ECONNRESET RemoteSocketServiceError_SystemError = 104 - RemoteSocketServiceError_SYS_ENOBUFS RemoteSocketServiceError_SystemError = 105 - RemoteSocketServiceError_SYS_EISCONN RemoteSocketServiceError_SystemError = 106 - RemoteSocketServiceError_SYS_ENOTCONN RemoteSocketServiceError_SystemError = 107 - RemoteSocketServiceError_SYS_ESHUTDOWN RemoteSocketServiceError_SystemError = 108 - RemoteSocketServiceError_SYS_ETOOMANYREFS RemoteSocketServiceError_SystemError = 109 - RemoteSocketServiceError_SYS_ETIMEDOUT RemoteSocketServiceError_SystemError = 110 - RemoteSocketServiceError_SYS_ECONNREFUSED RemoteSocketServiceError_SystemError = 111 - RemoteSocketServiceError_SYS_EHOSTDOWN RemoteSocketServiceError_SystemError = 112 - RemoteSocketServiceError_SYS_EHOSTUNREACH RemoteSocketServiceError_SystemError = 113 - RemoteSocketServiceError_SYS_EALREADY RemoteSocketServiceError_SystemError = 114 - RemoteSocketServiceError_SYS_EINPROGRESS RemoteSocketServiceError_SystemError = 115 - RemoteSocketServiceError_SYS_ESTALE RemoteSocketServiceError_SystemError = 116 - RemoteSocketServiceError_SYS_EUCLEAN RemoteSocketServiceError_SystemError = 117 - RemoteSocketServiceError_SYS_ENOTNAM RemoteSocketServiceError_SystemError = 118 - RemoteSocketServiceError_SYS_ENAVAIL RemoteSocketServiceError_SystemError = 119 - RemoteSocketServiceError_SYS_EISNAM RemoteSocketServiceError_SystemError = 120 - RemoteSocketServiceError_SYS_EREMOTEIO RemoteSocketServiceError_SystemError = 121 - RemoteSocketServiceError_SYS_EDQUOT RemoteSocketServiceError_SystemError = 122 - RemoteSocketServiceError_SYS_ENOMEDIUM RemoteSocketServiceError_SystemError = 123 - RemoteSocketServiceError_SYS_EMEDIUMTYPE RemoteSocketServiceError_SystemError = 124 - RemoteSocketServiceError_SYS_ECANCELED RemoteSocketServiceError_SystemError = 125 - RemoteSocketServiceError_SYS_ENOKEY RemoteSocketServiceError_SystemError = 126 - RemoteSocketServiceError_SYS_EKEYEXPIRED RemoteSocketServiceError_SystemError = 127 - RemoteSocketServiceError_SYS_EKEYREVOKED RemoteSocketServiceError_SystemError = 128 - RemoteSocketServiceError_SYS_EKEYREJECTED RemoteSocketServiceError_SystemError = 129 - RemoteSocketServiceError_SYS_EOWNERDEAD RemoteSocketServiceError_SystemError = 130 - RemoteSocketServiceError_SYS_ENOTRECOVERABLE RemoteSocketServiceError_SystemError = 131 - RemoteSocketServiceError_SYS_ERFKILL RemoteSocketServiceError_SystemError = 132 -) - -var RemoteSocketServiceError_SystemError_name = map[int32]string{ - 0: "SYS_SUCCESS", - 1: "SYS_EPERM", - 2: "SYS_ENOENT", - 3: "SYS_ESRCH", - 4: "SYS_EINTR", - 5: "SYS_EIO", - 6: "SYS_ENXIO", - 7: "SYS_E2BIG", - 8: "SYS_ENOEXEC", - 9: "SYS_EBADF", - 10: "SYS_ECHILD", - 11: "SYS_EAGAIN", - // Duplicate value: 11: "SYS_EWOULDBLOCK", - 12: "SYS_ENOMEM", - 13: "SYS_EACCES", - 14: "SYS_EFAULT", - 15: "SYS_ENOTBLK", - 16: "SYS_EBUSY", - 17: "SYS_EEXIST", - 18: "SYS_EXDEV", - 19: "SYS_ENODEV", - 20: "SYS_ENOTDIR", - 21: "SYS_EISDIR", - 22: "SYS_EINVAL", - 23: "SYS_ENFILE", - 24: "SYS_EMFILE", - 25: "SYS_ENOTTY", - 26: "SYS_ETXTBSY", - 27: "SYS_EFBIG", - 28: "SYS_ENOSPC", - 29: "SYS_ESPIPE", - 30: "SYS_EROFS", - 31: "SYS_EMLINK", - 32: "SYS_EPIPE", - 33: "SYS_EDOM", - 34: "SYS_ERANGE", - 35: "SYS_EDEADLK", - // Duplicate value: 35: "SYS_EDEADLOCK", - 36: "SYS_ENAMETOOLONG", - 37: "SYS_ENOLCK", - 38: "SYS_ENOSYS", - 39: "SYS_ENOTEMPTY", - 40: "SYS_ELOOP", - 42: "SYS_ENOMSG", - 43: "SYS_EIDRM", - 44: "SYS_ECHRNG", - 45: "SYS_EL2NSYNC", - 46: "SYS_EL3HLT", - 47: "SYS_EL3RST", - 48: "SYS_ELNRNG", - 49: "SYS_EUNATCH", - 50: "SYS_ENOCSI", - 51: "SYS_EL2HLT", - 52: "SYS_EBADE", - 53: "SYS_EBADR", - 54: "SYS_EXFULL", - 55: "SYS_ENOANO", - 56: "SYS_EBADRQC", - 57: "SYS_EBADSLT", - 59: "SYS_EBFONT", - 60: "SYS_ENOSTR", - 61: "SYS_ENODATA", - 62: "SYS_ETIME", - 63: "SYS_ENOSR", - 64: "SYS_ENONET", - 65: "SYS_ENOPKG", - 66: "SYS_EREMOTE", - 67: "SYS_ENOLINK", - 68: "SYS_EADV", - 69: "SYS_ESRMNT", - 70: "SYS_ECOMM", - 71: "SYS_EPROTO", - 72: "SYS_EMULTIHOP", - 73: "SYS_EDOTDOT", - 74: "SYS_EBADMSG", - 75: "SYS_EOVERFLOW", - 76: "SYS_ENOTUNIQ", - 77: "SYS_EBADFD", - 78: "SYS_EREMCHG", - 79: "SYS_ELIBACC", - 80: "SYS_ELIBBAD", - 81: "SYS_ELIBSCN", - 82: "SYS_ELIBMAX", - 83: "SYS_ELIBEXEC", - 84: "SYS_EILSEQ", - 85: "SYS_ERESTART", - 86: "SYS_ESTRPIPE", - 87: "SYS_EUSERS", - 88: "SYS_ENOTSOCK", - 89: "SYS_EDESTADDRREQ", - 90: "SYS_EMSGSIZE", - 91: "SYS_EPROTOTYPE", - 92: "SYS_ENOPROTOOPT", - 93: "SYS_EPROTONOSUPPORT", - 94: "SYS_ESOCKTNOSUPPORT", - 95: "SYS_EOPNOTSUPP", - // Duplicate value: 95: "SYS_ENOTSUP", - 96: "SYS_EPFNOSUPPORT", - 97: "SYS_EAFNOSUPPORT", - 98: "SYS_EADDRINUSE", - 99: "SYS_EADDRNOTAVAIL", - 100: "SYS_ENETDOWN", - 101: "SYS_ENETUNREACH", - 102: "SYS_ENETRESET", - 103: "SYS_ECONNABORTED", - 104: "SYS_ECONNRESET", - 105: "SYS_ENOBUFS", - 106: "SYS_EISCONN", - 107: "SYS_ENOTCONN", - 108: "SYS_ESHUTDOWN", - 109: "SYS_ETOOMANYREFS", - 110: "SYS_ETIMEDOUT", - 111: "SYS_ECONNREFUSED", - 112: "SYS_EHOSTDOWN", - 113: "SYS_EHOSTUNREACH", - 114: "SYS_EALREADY", - 115: "SYS_EINPROGRESS", - 116: "SYS_ESTALE", - 117: "SYS_EUCLEAN", - 118: "SYS_ENOTNAM", - 119: "SYS_ENAVAIL", - 120: "SYS_EISNAM", - 121: "SYS_EREMOTEIO", - 122: "SYS_EDQUOT", - 123: "SYS_ENOMEDIUM", - 124: "SYS_EMEDIUMTYPE", - 125: "SYS_ECANCELED", - 126: "SYS_ENOKEY", - 127: "SYS_EKEYEXPIRED", - 128: "SYS_EKEYREVOKED", - 129: "SYS_EKEYREJECTED", - 130: "SYS_EOWNERDEAD", - 131: "SYS_ENOTRECOVERABLE", - 132: "SYS_ERFKILL", -} -var RemoteSocketServiceError_SystemError_value = map[string]int32{ - "SYS_SUCCESS": 0, - "SYS_EPERM": 1, - "SYS_ENOENT": 2, - "SYS_ESRCH": 3, - "SYS_EINTR": 4, - "SYS_EIO": 5, - "SYS_ENXIO": 6, - "SYS_E2BIG": 7, - "SYS_ENOEXEC": 8, - "SYS_EBADF": 9, - "SYS_ECHILD": 10, - "SYS_EAGAIN": 11, - "SYS_EWOULDBLOCK": 11, - "SYS_ENOMEM": 12, - "SYS_EACCES": 13, - "SYS_EFAULT": 14, - "SYS_ENOTBLK": 15, - "SYS_EBUSY": 16, - "SYS_EEXIST": 17, - "SYS_EXDEV": 18, - "SYS_ENODEV": 19, - "SYS_ENOTDIR": 20, - "SYS_EISDIR": 21, - "SYS_EINVAL": 22, - "SYS_ENFILE": 23, - "SYS_EMFILE": 24, - "SYS_ENOTTY": 25, - "SYS_ETXTBSY": 26, - "SYS_EFBIG": 27, - "SYS_ENOSPC": 28, - "SYS_ESPIPE": 29, - "SYS_EROFS": 30, - "SYS_EMLINK": 31, - "SYS_EPIPE": 32, - "SYS_EDOM": 33, - "SYS_ERANGE": 34, - "SYS_EDEADLK": 35, - "SYS_EDEADLOCK": 35, - "SYS_ENAMETOOLONG": 36, - "SYS_ENOLCK": 37, - "SYS_ENOSYS": 38, - "SYS_ENOTEMPTY": 39, - "SYS_ELOOP": 40, - "SYS_ENOMSG": 42, - "SYS_EIDRM": 43, - "SYS_ECHRNG": 44, - "SYS_EL2NSYNC": 45, - "SYS_EL3HLT": 46, - "SYS_EL3RST": 47, - "SYS_ELNRNG": 48, - "SYS_EUNATCH": 49, - "SYS_ENOCSI": 50, - "SYS_EL2HLT": 51, - "SYS_EBADE": 52, - "SYS_EBADR": 53, - "SYS_EXFULL": 54, - "SYS_ENOANO": 55, - "SYS_EBADRQC": 56, - "SYS_EBADSLT": 57, - "SYS_EBFONT": 59, - "SYS_ENOSTR": 60, - "SYS_ENODATA": 61, - "SYS_ETIME": 62, - "SYS_ENOSR": 63, - "SYS_ENONET": 64, - "SYS_ENOPKG": 65, - "SYS_EREMOTE": 66, - "SYS_ENOLINK": 67, - "SYS_EADV": 68, - "SYS_ESRMNT": 69, - "SYS_ECOMM": 70, - "SYS_EPROTO": 71, - "SYS_EMULTIHOP": 72, - "SYS_EDOTDOT": 73, - "SYS_EBADMSG": 74, - "SYS_EOVERFLOW": 75, - "SYS_ENOTUNIQ": 76, - "SYS_EBADFD": 77, - "SYS_EREMCHG": 78, - "SYS_ELIBACC": 79, - "SYS_ELIBBAD": 80, - "SYS_ELIBSCN": 81, - "SYS_ELIBMAX": 82, - "SYS_ELIBEXEC": 83, - "SYS_EILSEQ": 84, - "SYS_ERESTART": 85, - "SYS_ESTRPIPE": 86, - "SYS_EUSERS": 87, - "SYS_ENOTSOCK": 88, - "SYS_EDESTADDRREQ": 89, - "SYS_EMSGSIZE": 90, - "SYS_EPROTOTYPE": 91, - "SYS_ENOPROTOOPT": 92, - "SYS_EPROTONOSUPPORT": 93, - "SYS_ESOCKTNOSUPPORT": 94, - "SYS_EOPNOTSUPP": 95, - "SYS_ENOTSUP": 95, - "SYS_EPFNOSUPPORT": 96, - "SYS_EAFNOSUPPORT": 97, - "SYS_EADDRINUSE": 98, - "SYS_EADDRNOTAVAIL": 99, - "SYS_ENETDOWN": 100, - "SYS_ENETUNREACH": 101, - "SYS_ENETRESET": 102, - "SYS_ECONNABORTED": 103, - "SYS_ECONNRESET": 104, - "SYS_ENOBUFS": 105, - "SYS_EISCONN": 106, - "SYS_ENOTCONN": 107, - "SYS_ESHUTDOWN": 108, - "SYS_ETOOMANYREFS": 109, - "SYS_ETIMEDOUT": 110, - "SYS_ECONNREFUSED": 111, - "SYS_EHOSTDOWN": 112, - "SYS_EHOSTUNREACH": 113, - "SYS_EALREADY": 114, - "SYS_EINPROGRESS": 115, - "SYS_ESTALE": 116, - "SYS_EUCLEAN": 117, - "SYS_ENOTNAM": 118, - "SYS_ENAVAIL": 119, - "SYS_EISNAM": 120, - "SYS_EREMOTEIO": 121, - "SYS_EDQUOT": 122, - "SYS_ENOMEDIUM": 123, - "SYS_EMEDIUMTYPE": 124, - "SYS_ECANCELED": 125, - "SYS_ENOKEY": 126, - "SYS_EKEYEXPIRED": 127, - "SYS_EKEYREVOKED": 128, - "SYS_EKEYREJECTED": 129, - "SYS_EOWNERDEAD": 130, - "SYS_ENOTRECOVERABLE": 131, - "SYS_ERFKILL": 132, -} - -func (x RemoteSocketServiceError_SystemError) Enum() *RemoteSocketServiceError_SystemError { - p := new(RemoteSocketServiceError_SystemError) - *p = x - return p -} -func (x RemoteSocketServiceError_SystemError) String() string { - return proto.EnumName(RemoteSocketServiceError_SystemError_name, int32(x)) -} -func (x *RemoteSocketServiceError_SystemError) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(RemoteSocketServiceError_SystemError_value, data, "RemoteSocketServiceError_SystemError") - if err != nil { - return err - } - *x = RemoteSocketServiceError_SystemError(value) - return nil -} -func (RemoteSocketServiceError_SystemError) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{0, 1} -} - -type CreateSocketRequest_SocketFamily int32 - -const ( - CreateSocketRequest_IPv4 CreateSocketRequest_SocketFamily = 1 - CreateSocketRequest_IPv6 CreateSocketRequest_SocketFamily = 2 -) - -var CreateSocketRequest_SocketFamily_name = map[int32]string{ - 1: "IPv4", - 2: "IPv6", -} -var CreateSocketRequest_SocketFamily_value = map[string]int32{ - "IPv4": 1, - "IPv6": 2, -} - -func (x CreateSocketRequest_SocketFamily) Enum() *CreateSocketRequest_SocketFamily { - p := new(CreateSocketRequest_SocketFamily) - *p = x - return p -} -func (x CreateSocketRequest_SocketFamily) String() string { - return proto.EnumName(CreateSocketRequest_SocketFamily_name, int32(x)) -} -func (x *CreateSocketRequest_SocketFamily) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(CreateSocketRequest_SocketFamily_value, data, "CreateSocketRequest_SocketFamily") - if err != nil { - return err - } - *x = CreateSocketRequest_SocketFamily(value) - return nil -} -func (CreateSocketRequest_SocketFamily) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{2, 0} -} - -type CreateSocketRequest_SocketProtocol int32 - -const ( - CreateSocketRequest_TCP CreateSocketRequest_SocketProtocol = 1 - CreateSocketRequest_UDP CreateSocketRequest_SocketProtocol = 2 -) - -var CreateSocketRequest_SocketProtocol_name = map[int32]string{ - 1: "TCP", - 2: "UDP", -} -var CreateSocketRequest_SocketProtocol_value = map[string]int32{ - "TCP": 1, - "UDP": 2, -} - -func (x CreateSocketRequest_SocketProtocol) Enum() *CreateSocketRequest_SocketProtocol { - p := new(CreateSocketRequest_SocketProtocol) - *p = x - return p -} -func (x CreateSocketRequest_SocketProtocol) String() string { - return proto.EnumName(CreateSocketRequest_SocketProtocol_name, int32(x)) -} -func (x *CreateSocketRequest_SocketProtocol) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(CreateSocketRequest_SocketProtocol_value, data, "CreateSocketRequest_SocketProtocol") - if err != nil { - return err - } - *x = CreateSocketRequest_SocketProtocol(value) - return nil -} -func (CreateSocketRequest_SocketProtocol) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{2, 1} -} - -type SocketOption_SocketOptionLevel int32 - -const ( - SocketOption_SOCKET_SOL_IP SocketOption_SocketOptionLevel = 0 - SocketOption_SOCKET_SOL_SOCKET SocketOption_SocketOptionLevel = 1 - SocketOption_SOCKET_SOL_TCP SocketOption_SocketOptionLevel = 6 - SocketOption_SOCKET_SOL_UDP SocketOption_SocketOptionLevel = 17 -) - -var SocketOption_SocketOptionLevel_name = map[int32]string{ - 0: "SOCKET_SOL_IP", - 1: "SOCKET_SOL_SOCKET", - 6: "SOCKET_SOL_TCP", - 17: "SOCKET_SOL_UDP", -} -var SocketOption_SocketOptionLevel_value = map[string]int32{ - "SOCKET_SOL_IP": 0, - "SOCKET_SOL_SOCKET": 1, - "SOCKET_SOL_TCP": 6, - "SOCKET_SOL_UDP": 17, -} - -func (x SocketOption_SocketOptionLevel) Enum() *SocketOption_SocketOptionLevel { - p := new(SocketOption_SocketOptionLevel) - *p = x - return p -} -func (x SocketOption_SocketOptionLevel) String() string { - return proto.EnumName(SocketOption_SocketOptionLevel_name, int32(x)) -} -func (x *SocketOption_SocketOptionLevel) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(SocketOption_SocketOptionLevel_value, data, "SocketOption_SocketOptionLevel") - if err != nil { - return err - } - *x = SocketOption_SocketOptionLevel(value) - return nil -} -func (SocketOption_SocketOptionLevel) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{10, 0} -} - -type SocketOption_SocketOptionName int32 - -const ( - SocketOption_SOCKET_SO_DEBUG SocketOption_SocketOptionName = 1 - SocketOption_SOCKET_SO_REUSEADDR SocketOption_SocketOptionName = 2 - SocketOption_SOCKET_SO_TYPE SocketOption_SocketOptionName = 3 - SocketOption_SOCKET_SO_ERROR SocketOption_SocketOptionName = 4 - SocketOption_SOCKET_SO_DONTROUTE SocketOption_SocketOptionName = 5 - SocketOption_SOCKET_SO_BROADCAST SocketOption_SocketOptionName = 6 - SocketOption_SOCKET_SO_SNDBUF SocketOption_SocketOptionName = 7 - SocketOption_SOCKET_SO_RCVBUF SocketOption_SocketOptionName = 8 - SocketOption_SOCKET_SO_KEEPALIVE SocketOption_SocketOptionName = 9 - SocketOption_SOCKET_SO_OOBINLINE SocketOption_SocketOptionName = 10 - SocketOption_SOCKET_SO_LINGER SocketOption_SocketOptionName = 13 - SocketOption_SOCKET_SO_RCVTIMEO SocketOption_SocketOptionName = 20 - SocketOption_SOCKET_SO_SNDTIMEO SocketOption_SocketOptionName = 21 - SocketOption_SOCKET_IP_TOS SocketOption_SocketOptionName = 1 - SocketOption_SOCKET_IP_TTL SocketOption_SocketOptionName = 2 - SocketOption_SOCKET_IP_HDRINCL SocketOption_SocketOptionName = 3 - SocketOption_SOCKET_IP_OPTIONS SocketOption_SocketOptionName = 4 - SocketOption_SOCKET_TCP_NODELAY SocketOption_SocketOptionName = 1 - SocketOption_SOCKET_TCP_MAXSEG SocketOption_SocketOptionName = 2 - SocketOption_SOCKET_TCP_CORK SocketOption_SocketOptionName = 3 - SocketOption_SOCKET_TCP_KEEPIDLE SocketOption_SocketOptionName = 4 - SocketOption_SOCKET_TCP_KEEPINTVL SocketOption_SocketOptionName = 5 - SocketOption_SOCKET_TCP_KEEPCNT SocketOption_SocketOptionName = 6 - SocketOption_SOCKET_TCP_SYNCNT SocketOption_SocketOptionName = 7 - SocketOption_SOCKET_TCP_LINGER2 SocketOption_SocketOptionName = 8 - SocketOption_SOCKET_TCP_DEFER_ACCEPT SocketOption_SocketOptionName = 9 - SocketOption_SOCKET_TCP_WINDOW_CLAMP SocketOption_SocketOptionName = 10 - SocketOption_SOCKET_TCP_INFO SocketOption_SocketOptionName = 11 - SocketOption_SOCKET_TCP_QUICKACK SocketOption_SocketOptionName = 12 -) - -var SocketOption_SocketOptionName_name = map[int32]string{ - 1: "SOCKET_SO_DEBUG", - 2: "SOCKET_SO_REUSEADDR", - 3: "SOCKET_SO_TYPE", - 4: "SOCKET_SO_ERROR", - 5: "SOCKET_SO_DONTROUTE", - 6: "SOCKET_SO_BROADCAST", - 7: "SOCKET_SO_SNDBUF", - 8: "SOCKET_SO_RCVBUF", - 9: "SOCKET_SO_KEEPALIVE", - 10: "SOCKET_SO_OOBINLINE", - 13: "SOCKET_SO_LINGER", - 20: "SOCKET_SO_RCVTIMEO", - 21: "SOCKET_SO_SNDTIMEO", - // Duplicate value: 1: "SOCKET_IP_TOS", - // Duplicate value: 2: "SOCKET_IP_TTL", - // Duplicate value: 3: "SOCKET_IP_HDRINCL", - // Duplicate value: 4: "SOCKET_IP_OPTIONS", - // Duplicate value: 1: "SOCKET_TCP_NODELAY", - // Duplicate value: 2: "SOCKET_TCP_MAXSEG", - // Duplicate value: 3: "SOCKET_TCP_CORK", - // Duplicate value: 4: "SOCKET_TCP_KEEPIDLE", - // Duplicate value: 5: "SOCKET_TCP_KEEPINTVL", - // Duplicate value: 6: "SOCKET_TCP_KEEPCNT", - // Duplicate value: 7: "SOCKET_TCP_SYNCNT", - // Duplicate value: 8: "SOCKET_TCP_LINGER2", - // Duplicate value: 9: "SOCKET_TCP_DEFER_ACCEPT", - // Duplicate value: 10: "SOCKET_TCP_WINDOW_CLAMP", - 11: "SOCKET_TCP_INFO", - 12: "SOCKET_TCP_QUICKACK", -} -var SocketOption_SocketOptionName_value = map[string]int32{ - "SOCKET_SO_DEBUG": 1, - "SOCKET_SO_REUSEADDR": 2, - "SOCKET_SO_TYPE": 3, - "SOCKET_SO_ERROR": 4, - "SOCKET_SO_DONTROUTE": 5, - "SOCKET_SO_BROADCAST": 6, - "SOCKET_SO_SNDBUF": 7, - "SOCKET_SO_RCVBUF": 8, - "SOCKET_SO_KEEPALIVE": 9, - "SOCKET_SO_OOBINLINE": 10, - "SOCKET_SO_LINGER": 13, - "SOCKET_SO_RCVTIMEO": 20, - "SOCKET_SO_SNDTIMEO": 21, - "SOCKET_IP_TOS": 1, - "SOCKET_IP_TTL": 2, - "SOCKET_IP_HDRINCL": 3, - "SOCKET_IP_OPTIONS": 4, - "SOCKET_TCP_NODELAY": 1, - "SOCKET_TCP_MAXSEG": 2, - "SOCKET_TCP_CORK": 3, - "SOCKET_TCP_KEEPIDLE": 4, - "SOCKET_TCP_KEEPINTVL": 5, - "SOCKET_TCP_KEEPCNT": 6, - "SOCKET_TCP_SYNCNT": 7, - "SOCKET_TCP_LINGER2": 8, - "SOCKET_TCP_DEFER_ACCEPT": 9, - "SOCKET_TCP_WINDOW_CLAMP": 10, - "SOCKET_TCP_INFO": 11, - "SOCKET_TCP_QUICKACK": 12, -} - -func (x SocketOption_SocketOptionName) Enum() *SocketOption_SocketOptionName { - p := new(SocketOption_SocketOptionName) - *p = x - return p -} -func (x SocketOption_SocketOptionName) String() string { - return proto.EnumName(SocketOption_SocketOptionName_name, int32(x)) -} -func (x *SocketOption_SocketOptionName) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(SocketOption_SocketOptionName_value, data, "SocketOption_SocketOptionName") - if err != nil { - return err - } - *x = SocketOption_SocketOptionName(value) - return nil -} -func (SocketOption_SocketOptionName) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{10, 1} -} - -type ShutDownRequest_How int32 - -const ( - ShutDownRequest_SOCKET_SHUT_RD ShutDownRequest_How = 1 - ShutDownRequest_SOCKET_SHUT_WR ShutDownRequest_How = 2 - ShutDownRequest_SOCKET_SHUT_RDWR ShutDownRequest_How = 3 -) - -var ShutDownRequest_How_name = map[int32]string{ - 1: "SOCKET_SHUT_RD", - 2: "SOCKET_SHUT_WR", - 3: "SOCKET_SHUT_RDWR", -} -var ShutDownRequest_How_value = map[string]int32{ - "SOCKET_SHUT_RD": 1, - "SOCKET_SHUT_WR": 2, - "SOCKET_SHUT_RDWR": 3, -} - -func (x ShutDownRequest_How) Enum() *ShutDownRequest_How { - p := new(ShutDownRequest_How) - *p = x - return p -} -func (x ShutDownRequest_How) String() string { - return proto.EnumName(ShutDownRequest_How_name, int32(x)) -} -func (x *ShutDownRequest_How) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(ShutDownRequest_How_value, data, "ShutDownRequest_How") - if err != nil { - return err - } - *x = ShutDownRequest_How(value) - return nil -} -func (ShutDownRequest_How) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{21, 0} -} - -type ReceiveRequest_Flags int32 - -const ( - ReceiveRequest_MSG_OOB ReceiveRequest_Flags = 1 - ReceiveRequest_MSG_PEEK ReceiveRequest_Flags = 2 -) - -var ReceiveRequest_Flags_name = map[int32]string{ - 1: "MSG_OOB", - 2: "MSG_PEEK", -} -var ReceiveRequest_Flags_value = map[string]int32{ - "MSG_OOB": 1, - "MSG_PEEK": 2, -} - -func (x ReceiveRequest_Flags) Enum() *ReceiveRequest_Flags { - p := new(ReceiveRequest_Flags) - *p = x - return p -} -func (x ReceiveRequest_Flags) String() string { - return proto.EnumName(ReceiveRequest_Flags_name, int32(x)) -} -func (x *ReceiveRequest_Flags) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(ReceiveRequest_Flags_value, data, "ReceiveRequest_Flags") - if err != nil { - return err - } - *x = ReceiveRequest_Flags(value) - return nil -} -func (ReceiveRequest_Flags) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{27, 0} -} - -type PollEvent_PollEventFlag int32 - -const ( - PollEvent_SOCKET_POLLNONE PollEvent_PollEventFlag = 0 - PollEvent_SOCKET_POLLIN PollEvent_PollEventFlag = 1 - PollEvent_SOCKET_POLLPRI PollEvent_PollEventFlag = 2 - PollEvent_SOCKET_POLLOUT PollEvent_PollEventFlag = 4 - PollEvent_SOCKET_POLLERR PollEvent_PollEventFlag = 8 - PollEvent_SOCKET_POLLHUP PollEvent_PollEventFlag = 16 - PollEvent_SOCKET_POLLNVAL PollEvent_PollEventFlag = 32 - PollEvent_SOCKET_POLLRDNORM PollEvent_PollEventFlag = 64 - PollEvent_SOCKET_POLLRDBAND PollEvent_PollEventFlag = 128 - PollEvent_SOCKET_POLLWRNORM PollEvent_PollEventFlag = 256 - PollEvent_SOCKET_POLLWRBAND PollEvent_PollEventFlag = 512 - PollEvent_SOCKET_POLLMSG PollEvent_PollEventFlag = 1024 - PollEvent_SOCKET_POLLREMOVE PollEvent_PollEventFlag = 4096 - PollEvent_SOCKET_POLLRDHUP PollEvent_PollEventFlag = 8192 -) - -var PollEvent_PollEventFlag_name = map[int32]string{ - 0: "SOCKET_POLLNONE", - 1: "SOCKET_POLLIN", - 2: "SOCKET_POLLPRI", - 4: "SOCKET_POLLOUT", - 8: "SOCKET_POLLERR", - 16: "SOCKET_POLLHUP", - 32: "SOCKET_POLLNVAL", - 64: "SOCKET_POLLRDNORM", - 128: "SOCKET_POLLRDBAND", - 256: "SOCKET_POLLWRNORM", - 512: "SOCKET_POLLWRBAND", - 1024: "SOCKET_POLLMSG", - 4096: "SOCKET_POLLREMOVE", - 8192: "SOCKET_POLLRDHUP", -} -var PollEvent_PollEventFlag_value = map[string]int32{ - "SOCKET_POLLNONE": 0, - "SOCKET_POLLIN": 1, - "SOCKET_POLLPRI": 2, - "SOCKET_POLLOUT": 4, - "SOCKET_POLLERR": 8, - "SOCKET_POLLHUP": 16, - "SOCKET_POLLNVAL": 32, - "SOCKET_POLLRDNORM": 64, - "SOCKET_POLLRDBAND": 128, - "SOCKET_POLLWRNORM": 256, - "SOCKET_POLLWRBAND": 512, - "SOCKET_POLLMSG": 1024, - "SOCKET_POLLREMOVE": 4096, - "SOCKET_POLLRDHUP": 8192, -} - -func (x PollEvent_PollEventFlag) Enum() *PollEvent_PollEventFlag { - p := new(PollEvent_PollEventFlag) - *p = x - return p -} -func (x PollEvent_PollEventFlag) String() string { - return proto.EnumName(PollEvent_PollEventFlag_name, int32(x)) -} -func (x *PollEvent_PollEventFlag) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(PollEvent_PollEventFlag_value, data, "PollEvent_PollEventFlag") - if err != nil { - return err - } - *x = PollEvent_PollEventFlag(value) - return nil -} -func (PollEvent_PollEventFlag) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{29, 0} -} - -type ResolveReply_ErrorCode int32 - -const ( - ResolveReply_SOCKET_EAI_ADDRFAMILY ResolveReply_ErrorCode = 1 - ResolveReply_SOCKET_EAI_AGAIN ResolveReply_ErrorCode = 2 - ResolveReply_SOCKET_EAI_BADFLAGS ResolveReply_ErrorCode = 3 - ResolveReply_SOCKET_EAI_FAIL ResolveReply_ErrorCode = 4 - ResolveReply_SOCKET_EAI_FAMILY ResolveReply_ErrorCode = 5 - ResolveReply_SOCKET_EAI_MEMORY ResolveReply_ErrorCode = 6 - ResolveReply_SOCKET_EAI_NODATA ResolveReply_ErrorCode = 7 - ResolveReply_SOCKET_EAI_NONAME ResolveReply_ErrorCode = 8 - ResolveReply_SOCKET_EAI_SERVICE ResolveReply_ErrorCode = 9 - ResolveReply_SOCKET_EAI_SOCKTYPE ResolveReply_ErrorCode = 10 - ResolveReply_SOCKET_EAI_SYSTEM ResolveReply_ErrorCode = 11 - ResolveReply_SOCKET_EAI_BADHINTS ResolveReply_ErrorCode = 12 - ResolveReply_SOCKET_EAI_PROTOCOL ResolveReply_ErrorCode = 13 - ResolveReply_SOCKET_EAI_OVERFLOW ResolveReply_ErrorCode = 14 - ResolveReply_SOCKET_EAI_MAX ResolveReply_ErrorCode = 15 -) - -var ResolveReply_ErrorCode_name = map[int32]string{ - 1: "SOCKET_EAI_ADDRFAMILY", - 2: "SOCKET_EAI_AGAIN", - 3: "SOCKET_EAI_BADFLAGS", - 4: "SOCKET_EAI_FAIL", - 5: "SOCKET_EAI_FAMILY", - 6: "SOCKET_EAI_MEMORY", - 7: "SOCKET_EAI_NODATA", - 8: "SOCKET_EAI_NONAME", - 9: "SOCKET_EAI_SERVICE", - 10: "SOCKET_EAI_SOCKTYPE", - 11: "SOCKET_EAI_SYSTEM", - 12: "SOCKET_EAI_BADHINTS", - 13: "SOCKET_EAI_PROTOCOL", - 14: "SOCKET_EAI_OVERFLOW", - 15: "SOCKET_EAI_MAX", -} -var ResolveReply_ErrorCode_value = map[string]int32{ - "SOCKET_EAI_ADDRFAMILY": 1, - "SOCKET_EAI_AGAIN": 2, - "SOCKET_EAI_BADFLAGS": 3, - "SOCKET_EAI_FAIL": 4, - "SOCKET_EAI_FAMILY": 5, - "SOCKET_EAI_MEMORY": 6, - "SOCKET_EAI_NODATA": 7, - "SOCKET_EAI_NONAME": 8, - "SOCKET_EAI_SERVICE": 9, - "SOCKET_EAI_SOCKTYPE": 10, - "SOCKET_EAI_SYSTEM": 11, - "SOCKET_EAI_BADHINTS": 12, - "SOCKET_EAI_PROTOCOL": 13, - "SOCKET_EAI_OVERFLOW": 14, - "SOCKET_EAI_MAX": 15, -} - -func (x ResolveReply_ErrorCode) Enum() *ResolveReply_ErrorCode { - p := new(ResolveReply_ErrorCode) - *p = x - return p -} -func (x ResolveReply_ErrorCode) String() string { - return proto.EnumName(ResolveReply_ErrorCode_name, int32(x)) -} -func (x *ResolveReply_ErrorCode) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(ResolveReply_ErrorCode_value, data, "ResolveReply_ErrorCode") - if err != nil { - return err - } - *x = ResolveReply_ErrorCode(value) - return nil -} -func (ResolveReply_ErrorCode) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{33, 0} -} - -type RemoteSocketServiceError struct { - SystemError *int32 `protobuf:"varint,1,opt,name=system_error,json=systemError,def=0" json:"system_error,omitempty"` - ErrorDetail *string `protobuf:"bytes,2,opt,name=error_detail,json=errorDetail" json:"error_detail,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RemoteSocketServiceError) Reset() { *m = RemoteSocketServiceError{} } -func (m *RemoteSocketServiceError) String() string { return proto.CompactTextString(m) } -func (*RemoteSocketServiceError) ProtoMessage() {} -func (*RemoteSocketServiceError) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{0} -} -func (m *RemoteSocketServiceError) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RemoteSocketServiceError.Unmarshal(m, b) -} -func (m *RemoteSocketServiceError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RemoteSocketServiceError.Marshal(b, m, deterministic) -} -func (dst *RemoteSocketServiceError) XXX_Merge(src proto.Message) { - xxx_messageInfo_RemoteSocketServiceError.Merge(dst, src) -} -func (m *RemoteSocketServiceError) XXX_Size() int { - return xxx_messageInfo_RemoteSocketServiceError.Size(m) -} -func (m *RemoteSocketServiceError) XXX_DiscardUnknown() { - xxx_messageInfo_RemoteSocketServiceError.DiscardUnknown(m) -} - -var xxx_messageInfo_RemoteSocketServiceError proto.InternalMessageInfo - -const Default_RemoteSocketServiceError_SystemError int32 = 0 - -func (m *RemoteSocketServiceError) GetSystemError() int32 { - if m != nil && m.SystemError != nil { - return *m.SystemError - } - return Default_RemoteSocketServiceError_SystemError -} - -func (m *RemoteSocketServiceError) GetErrorDetail() string { - if m != nil && m.ErrorDetail != nil { - return *m.ErrorDetail - } - return "" -} - -type AddressPort struct { - Port *int32 `protobuf:"varint,1,req,name=port" json:"port,omitempty"` - PackedAddress []byte `protobuf:"bytes,2,opt,name=packed_address,json=packedAddress" json:"packed_address,omitempty"` - HostnameHint *string `protobuf:"bytes,3,opt,name=hostname_hint,json=hostnameHint" json:"hostname_hint,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AddressPort) Reset() { *m = AddressPort{} } -func (m *AddressPort) String() string { return proto.CompactTextString(m) } -func (*AddressPort) ProtoMessage() {} -func (*AddressPort) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{1} -} -func (m *AddressPort) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AddressPort.Unmarshal(m, b) -} -func (m *AddressPort) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AddressPort.Marshal(b, m, deterministic) -} -func (dst *AddressPort) XXX_Merge(src proto.Message) { - xxx_messageInfo_AddressPort.Merge(dst, src) -} -func (m *AddressPort) XXX_Size() int { - return xxx_messageInfo_AddressPort.Size(m) -} -func (m *AddressPort) XXX_DiscardUnknown() { - xxx_messageInfo_AddressPort.DiscardUnknown(m) -} - -var xxx_messageInfo_AddressPort proto.InternalMessageInfo - -func (m *AddressPort) GetPort() int32 { - if m != nil && m.Port != nil { - return *m.Port - } - return 0 -} - -func (m *AddressPort) GetPackedAddress() []byte { - if m != nil { - return m.PackedAddress - } - return nil -} - -func (m *AddressPort) GetHostnameHint() string { - if m != nil && m.HostnameHint != nil { - return *m.HostnameHint - } - return "" -} - -type CreateSocketRequest struct { - Family *CreateSocketRequest_SocketFamily `protobuf:"varint,1,req,name=family,enum=appengine.CreateSocketRequest_SocketFamily" json:"family,omitempty"` - Protocol *CreateSocketRequest_SocketProtocol `protobuf:"varint,2,req,name=protocol,enum=appengine.CreateSocketRequest_SocketProtocol" json:"protocol,omitempty"` - SocketOptions []*SocketOption `protobuf:"bytes,3,rep,name=socket_options,json=socketOptions" json:"socket_options,omitempty"` - ProxyExternalIp *AddressPort `protobuf:"bytes,4,opt,name=proxy_external_ip,json=proxyExternalIp" json:"proxy_external_ip,omitempty"` - ListenBacklog *int32 `protobuf:"varint,5,opt,name=listen_backlog,json=listenBacklog,def=0" json:"listen_backlog,omitempty"` - RemoteIp *AddressPort `protobuf:"bytes,6,opt,name=remote_ip,json=remoteIp" json:"remote_ip,omitempty"` - AppId *string `protobuf:"bytes,9,opt,name=app_id,json=appId" json:"app_id,omitempty"` - ProjectId *int64 `protobuf:"varint,10,opt,name=project_id,json=projectId" json:"project_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CreateSocketRequest) Reset() { *m = CreateSocketRequest{} } -func (m *CreateSocketRequest) String() string { return proto.CompactTextString(m) } -func (*CreateSocketRequest) ProtoMessage() {} -func (*CreateSocketRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{2} -} -func (m *CreateSocketRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateSocketRequest.Unmarshal(m, b) -} -func (m *CreateSocketRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateSocketRequest.Marshal(b, m, deterministic) -} -func (dst *CreateSocketRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateSocketRequest.Merge(dst, src) -} -func (m *CreateSocketRequest) XXX_Size() int { - return xxx_messageInfo_CreateSocketRequest.Size(m) -} -func (m *CreateSocketRequest) XXX_DiscardUnknown() { - xxx_messageInfo_CreateSocketRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_CreateSocketRequest proto.InternalMessageInfo - -const Default_CreateSocketRequest_ListenBacklog int32 = 0 - -func (m *CreateSocketRequest) GetFamily() CreateSocketRequest_SocketFamily { - if m != nil && m.Family != nil { - return *m.Family - } - return CreateSocketRequest_IPv4 -} - -func (m *CreateSocketRequest) GetProtocol() CreateSocketRequest_SocketProtocol { - if m != nil && m.Protocol != nil { - return *m.Protocol - } - return CreateSocketRequest_TCP -} - -func (m *CreateSocketRequest) GetSocketOptions() []*SocketOption { - if m != nil { - return m.SocketOptions - } - return nil -} - -func (m *CreateSocketRequest) GetProxyExternalIp() *AddressPort { - if m != nil { - return m.ProxyExternalIp - } - return nil -} - -func (m *CreateSocketRequest) GetListenBacklog() int32 { - if m != nil && m.ListenBacklog != nil { - return *m.ListenBacklog - } - return Default_CreateSocketRequest_ListenBacklog -} - -func (m *CreateSocketRequest) GetRemoteIp() *AddressPort { - if m != nil { - return m.RemoteIp - } - return nil -} - -func (m *CreateSocketRequest) GetAppId() string { - if m != nil && m.AppId != nil { - return *m.AppId - } - return "" -} - -func (m *CreateSocketRequest) GetProjectId() int64 { - if m != nil && m.ProjectId != nil { - return *m.ProjectId - } - return 0 -} - -type CreateSocketReply struct { - SocketDescriptor *string `protobuf:"bytes,1,opt,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` - ServerAddress *AddressPort `protobuf:"bytes,3,opt,name=server_address,json=serverAddress" json:"server_address,omitempty"` - ProxyExternalIp *AddressPort `protobuf:"bytes,4,opt,name=proxy_external_ip,json=proxyExternalIp" json:"proxy_external_ip,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CreateSocketReply) Reset() { *m = CreateSocketReply{} } -func (m *CreateSocketReply) String() string { return proto.CompactTextString(m) } -func (*CreateSocketReply) ProtoMessage() {} -func (*CreateSocketReply) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{3} -} - -var extRange_CreateSocketReply = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*CreateSocketReply) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_CreateSocketReply -} -func (m *CreateSocketReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateSocketReply.Unmarshal(m, b) -} -func (m *CreateSocketReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateSocketReply.Marshal(b, m, deterministic) -} -func (dst *CreateSocketReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateSocketReply.Merge(dst, src) -} -func (m *CreateSocketReply) XXX_Size() int { - return xxx_messageInfo_CreateSocketReply.Size(m) -} -func (m *CreateSocketReply) XXX_DiscardUnknown() { - xxx_messageInfo_CreateSocketReply.DiscardUnknown(m) -} - -var xxx_messageInfo_CreateSocketReply proto.InternalMessageInfo - -func (m *CreateSocketReply) GetSocketDescriptor() string { - if m != nil && m.SocketDescriptor != nil { - return *m.SocketDescriptor - } - return "" -} - -func (m *CreateSocketReply) GetServerAddress() *AddressPort { - if m != nil { - return m.ServerAddress - } - return nil -} - -func (m *CreateSocketReply) GetProxyExternalIp() *AddressPort { - if m != nil { - return m.ProxyExternalIp - } - return nil -} - -type BindRequest struct { - SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` - ProxyExternalIp *AddressPort `protobuf:"bytes,2,req,name=proxy_external_ip,json=proxyExternalIp" json:"proxy_external_ip,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BindRequest) Reset() { *m = BindRequest{} } -func (m *BindRequest) String() string { return proto.CompactTextString(m) } -func (*BindRequest) ProtoMessage() {} -func (*BindRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{4} -} -func (m *BindRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BindRequest.Unmarshal(m, b) -} -func (m *BindRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BindRequest.Marshal(b, m, deterministic) -} -func (dst *BindRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_BindRequest.Merge(dst, src) -} -func (m *BindRequest) XXX_Size() int { - return xxx_messageInfo_BindRequest.Size(m) -} -func (m *BindRequest) XXX_DiscardUnknown() { - xxx_messageInfo_BindRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_BindRequest proto.InternalMessageInfo - -func (m *BindRequest) GetSocketDescriptor() string { - if m != nil && m.SocketDescriptor != nil { - return *m.SocketDescriptor - } - return "" -} - -func (m *BindRequest) GetProxyExternalIp() *AddressPort { - if m != nil { - return m.ProxyExternalIp - } - return nil -} - -type BindReply struct { - ProxyExternalIp *AddressPort `protobuf:"bytes,1,opt,name=proxy_external_ip,json=proxyExternalIp" json:"proxy_external_ip,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BindReply) Reset() { *m = BindReply{} } -func (m *BindReply) String() string { return proto.CompactTextString(m) } -func (*BindReply) ProtoMessage() {} -func (*BindReply) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{5} -} -func (m *BindReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BindReply.Unmarshal(m, b) -} -func (m *BindReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BindReply.Marshal(b, m, deterministic) -} -func (dst *BindReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_BindReply.Merge(dst, src) -} -func (m *BindReply) XXX_Size() int { - return xxx_messageInfo_BindReply.Size(m) -} -func (m *BindReply) XXX_DiscardUnknown() { - xxx_messageInfo_BindReply.DiscardUnknown(m) -} - -var xxx_messageInfo_BindReply proto.InternalMessageInfo - -func (m *BindReply) GetProxyExternalIp() *AddressPort { - if m != nil { - return m.ProxyExternalIp - } - return nil -} - -type GetSocketNameRequest struct { - SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetSocketNameRequest) Reset() { *m = GetSocketNameRequest{} } -func (m *GetSocketNameRequest) String() string { return proto.CompactTextString(m) } -func (*GetSocketNameRequest) ProtoMessage() {} -func (*GetSocketNameRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{6} -} -func (m *GetSocketNameRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetSocketNameRequest.Unmarshal(m, b) -} -func (m *GetSocketNameRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetSocketNameRequest.Marshal(b, m, deterministic) -} -func (dst *GetSocketNameRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetSocketNameRequest.Merge(dst, src) -} -func (m *GetSocketNameRequest) XXX_Size() int { - return xxx_messageInfo_GetSocketNameRequest.Size(m) -} -func (m *GetSocketNameRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetSocketNameRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetSocketNameRequest proto.InternalMessageInfo - -func (m *GetSocketNameRequest) GetSocketDescriptor() string { - if m != nil && m.SocketDescriptor != nil { - return *m.SocketDescriptor - } - return "" -} - -type GetSocketNameReply struct { - ProxyExternalIp *AddressPort `protobuf:"bytes,2,opt,name=proxy_external_ip,json=proxyExternalIp" json:"proxy_external_ip,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetSocketNameReply) Reset() { *m = GetSocketNameReply{} } -func (m *GetSocketNameReply) String() string { return proto.CompactTextString(m) } -func (*GetSocketNameReply) ProtoMessage() {} -func (*GetSocketNameReply) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{7} -} -func (m *GetSocketNameReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetSocketNameReply.Unmarshal(m, b) -} -func (m *GetSocketNameReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetSocketNameReply.Marshal(b, m, deterministic) -} -func (dst *GetSocketNameReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetSocketNameReply.Merge(dst, src) -} -func (m *GetSocketNameReply) XXX_Size() int { - return xxx_messageInfo_GetSocketNameReply.Size(m) -} -func (m *GetSocketNameReply) XXX_DiscardUnknown() { - xxx_messageInfo_GetSocketNameReply.DiscardUnknown(m) -} - -var xxx_messageInfo_GetSocketNameReply proto.InternalMessageInfo - -func (m *GetSocketNameReply) GetProxyExternalIp() *AddressPort { - if m != nil { - return m.ProxyExternalIp - } - return nil -} - -type GetPeerNameRequest struct { - SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetPeerNameRequest) Reset() { *m = GetPeerNameRequest{} } -func (m *GetPeerNameRequest) String() string { return proto.CompactTextString(m) } -func (*GetPeerNameRequest) ProtoMessage() {} -func (*GetPeerNameRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{8} -} -func (m *GetPeerNameRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetPeerNameRequest.Unmarshal(m, b) -} -func (m *GetPeerNameRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetPeerNameRequest.Marshal(b, m, deterministic) -} -func (dst *GetPeerNameRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetPeerNameRequest.Merge(dst, src) -} -func (m *GetPeerNameRequest) XXX_Size() int { - return xxx_messageInfo_GetPeerNameRequest.Size(m) -} -func (m *GetPeerNameRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetPeerNameRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetPeerNameRequest proto.InternalMessageInfo - -func (m *GetPeerNameRequest) GetSocketDescriptor() string { - if m != nil && m.SocketDescriptor != nil { - return *m.SocketDescriptor - } - return "" -} - -type GetPeerNameReply struct { - PeerIp *AddressPort `protobuf:"bytes,2,opt,name=peer_ip,json=peerIp" json:"peer_ip,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetPeerNameReply) Reset() { *m = GetPeerNameReply{} } -func (m *GetPeerNameReply) String() string { return proto.CompactTextString(m) } -func (*GetPeerNameReply) ProtoMessage() {} -func (*GetPeerNameReply) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{9} -} -func (m *GetPeerNameReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetPeerNameReply.Unmarshal(m, b) -} -func (m *GetPeerNameReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetPeerNameReply.Marshal(b, m, deterministic) -} -func (dst *GetPeerNameReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetPeerNameReply.Merge(dst, src) -} -func (m *GetPeerNameReply) XXX_Size() int { - return xxx_messageInfo_GetPeerNameReply.Size(m) -} -func (m *GetPeerNameReply) XXX_DiscardUnknown() { - xxx_messageInfo_GetPeerNameReply.DiscardUnknown(m) -} - -var xxx_messageInfo_GetPeerNameReply proto.InternalMessageInfo - -func (m *GetPeerNameReply) GetPeerIp() *AddressPort { - if m != nil { - return m.PeerIp - } - return nil -} - -type SocketOption struct { - Level *SocketOption_SocketOptionLevel `protobuf:"varint,1,req,name=level,enum=appengine.SocketOption_SocketOptionLevel" json:"level,omitempty"` - Option *SocketOption_SocketOptionName `protobuf:"varint,2,req,name=option,enum=appengine.SocketOption_SocketOptionName" json:"option,omitempty"` - Value []byte `protobuf:"bytes,3,req,name=value" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SocketOption) Reset() { *m = SocketOption{} } -func (m *SocketOption) String() string { return proto.CompactTextString(m) } -func (*SocketOption) ProtoMessage() {} -func (*SocketOption) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{10} -} -func (m *SocketOption) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SocketOption.Unmarshal(m, b) -} -func (m *SocketOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SocketOption.Marshal(b, m, deterministic) -} -func (dst *SocketOption) XXX_Merge(src proto.Message) { - xxx_messageInfo_SocketOption.Merge(dst, src) -} -func (m *SocketOption) XXX_Size() int { - return xxx_messageInfo_SocketOption.Size(m) -} -func (m *SocketOption) XXX_DiscardUnknown() { - xxx_messageInfo_SocketOption.DiscardUnknown(m) -} - -var xxx_messageInfo_SocketOption proto.InternalMessageInfo - -func (m *SocketOption) GetLevel() SocketOption_SocketOptionLevel { - if m != nil && m.Level != nil { - return *m.Level - } - return SocketOption_SOCKET_SOL_IP -} - -func (m *SocketOption) GetOption() SocketOption_SocketOptionName { - if m != nil && m.Option != nil { - return *m.Option - } - return SocketOption_SOCKET_SO_DEBUG -} - -func (m *SocketOption) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -type SetSocketOptionsRequest struct { - SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` - Options []*SocketOption `protobuf:"bytes,2,rep,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SetSocketOptionsRequest) Reset() { *m = SetSocketOptionsRequest{} } -func (m *SetSocketOptionsRequest) String() string { return proto.CompactTextString(m) } -func (*SetSocketOptionsRequest) ProtoMessage() {} -func (*SetSocketOptionsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{11} -} -func (m *SetSocketOptionsRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SetSocketOptionsRequest.Unmarshal(m, b) -} -func (m *SetSocketOptionsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SetSocketOptionsRequest.Marshal(b, m, deterministic) -} -func (dst *SetSocketOptionsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SetSocketOptionsRequest.Merge(dst, src) -} -func (m *SetSocketOptionsRequest) XXX_Size() int { - return xxx_messageInfo_SetSocketOptionsRequest.Size(m) -} -func (m *SetSocketOptionsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SetSocketOptionsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SetSocketOptionsRequest proto.InternalMessageInfo - -func (m *SetSocketOptionsRequest) GetSocketDescriptor() string { - if m != nil && m.SocketDescriptor != nil { - return *m.SocketDescriptor - } - return "" -} - -func (m *SetSocketOptionsRequest) GetOptions() []*SocketOption { - if m != nil { - return m.Options - } - return nil -} - -type SetSocketOptionsReply struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SetSocketOptionsReply) Reset() { *m = SetSocketOptionsReply{} } -func (m *SetSocketOptionsReply) String() string { return proto.CompactTextString(m) } -func (*SetSocketOptionsReply) ProtoMessage() {} -func (*SetSocketOptionsReply) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{12} -} -func (m *SetSocketOptionsReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SetSocketOptionsReply.Unmarshal(m, b) -} -func (m *SetSocketOptionsReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SetSocketOptionsReply.Marshal(b, m, deterministic) -} -func (dst *SetSocketOptionsReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_SetSocketOptionsReply.Merge(dst, src) -} -func (m *SetSocketOptionsReply) XXX_Size() int { - return xxx_messageInfo_SetSocketOptionsReply.Size(m) -} -func (m *SetSocketOptionsReply) XXX_DiscardUnknown() { - xxx_messageInfo_SetSocketOptionsReply.DiscardUnknown(m) -} - -var xxx_messageInfo_SetSocketOptionsReply proto.InternalMessageInfo - -type GetSocketOptionsRequest struct { - SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` - Options []*SocketOption `protobuf:"bytes,2,rep,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetSocketOptionsRequest) Reset() { *m = GetSocketOptionsRequest{} } -func (m *GetSocketOptionsRequest) String() string { return proto.CompactTextString(m) } -func (*GetSocketOptionsRequest) ProtoMessage() {} -func (*GetSocketOptionsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{13} -} -func (m *GetSocketOptionsRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetSocketOptionsRequest.Unmarshal(m, b) -} -func (m *GetSocketOptionsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetSocketOptionsRequest.Marshal(b, m, deterministic) -} -func (dst *GetSocketOptionsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetSocketOptionsRequest.Merge(dst, src) -} -func (m *GetSocketOptionsRequest) XXX_Size() int { - return xxx_messageInfo_GetSocketOptionsRequest.Size(m) -} -func (m *GetSocketOptionsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetSocketOptionsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetSocketOptionsRequest proto.InternalMessageInfo - -func (m *GetSocketOptionsRequest) GetSocketDescriptor() string { - if m != nil && m.SocketDescriptor != nil { - return *m.SocketDescriptor - } - return "" -} - -func (m *GetSocketOptionsRequest) GetOptions() []*SocketOption { - if m != nil { - return m.Options - } - return nil -} - -type GetSocketOptionsReply struct { - Options []*SocketOption `protobuf:"bytes,2,rep,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetSocketOptionsReply) Reset() { *m = GetSocketOptionsReply{} } -func (m *GetSocketOptionsReply) String() string { return proto.CompactTextString(m) } -func (*GetSocketOptionsReply) ProtoMessage() {} -func (*GetSocketOptionsReply) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{14} -} -func (m *GetSocketOptionsReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetSocketOptionsReply.Unmarshal(m, b) -} -func (m *GetSocketOptionsReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetSocketOptionsReply.Marshal(b, m, deterministic) -} -func (dst *GetSocketOptionsReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetSocketOptionsReply.Merge(dst, src) -} -func (m *GetSocketOptionsReply) XXX_Size() int { - return xxx_messageInfo_GetSocketOptionsReply.Size(m) -} -func (m *GetSocketOptionsReply) XXX_DiscardUnknown() { - xxx_messageInfo_GetSocketOptionsReply.DiscardUnknown(m) -} - -var xxx_messageInfo_GetSocketOptionsReply proto.InternalMessageInfo - -func (m *GetSocketOptionsReply) GetOptions() []*SocketOption { - if m != nil { - return m.Options - } - return nil -} - -type ConnectRequest struct { - SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` - RemoteIp *AddressPort `protobuf:"bytes,2,req,name=remote_ip,json=remoteIp" json:"remote_ip,omitempty"` - TimeoutSeconds *float64 `protobuf:"fixed64,3,opt,name=timeout_seconds,json=timeoutSeconds,def=-1" json:"timeout_seconds,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ConnectRequest) Reset() { *m = ConnectRequest{} } -func (m *ConnectRequest) String() string { return proto.CompactTextString(m) } -func (*ConnectRequest) ProtoMessage() {} -func (*ConnectRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{15} -} -func (m *ConnectRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ConnectRequest.Unmarshal(m, b) -} -func (m *ConnectRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ConnectRequest.Marshal(b, m, deterministic) -} -func (dst *ConnectRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ConnectRequest.Merge(dst, src) -} -func (m *ConnectRequest) XXX_Size() int { - return xxx_messageInfo_ConnectRequest.Size(m) -} -func (m *ConnectRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ConnectRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ConnectRequest proto.InternalMessageInfo - -const Default_ConnectRequest_TimeoutSeconds float64 = -1 - -func (m *ConnectRequest) GetSocketDescriptor() string { - if m != nil && m.SocketDescriptor != nil { - return *m.SocketDescriptor - } - return "" -} - -func (m *ConnectRequest) GetRemoteIp() *AddressPort { - if m != nil { - return m.RemoteIp - } - return nil -} - -func (m *ConnectRequest) GetTimeoutSeconds() float64 { - if m != nil && m.TimeoutSeconds != nil { - return *m.TimeoutSeconds - } - return Default_ConnectRequest_TimeoutSeconds -} - -type ConnectReply struct { - ProxyExternalIp *AddressPort `protobuf:"bytes,1,opt,name=proxy_external_ip,json=proxyExternalIp" json:"proxy_external_ip,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ConnectReply) Reset() { *m = ConnectReply{} } -func (m *ConnectReply) String() string { return proto.CompactTextString(m) } -func (*ConnectReply) ProtoMessage() {} -func (*ConnectReply) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{16} -} - -var extRange_ConnectReply = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*ConnectReply) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_ConnectReply -} -func (m *ConnectReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ConnectReply.Unmarshal(m, b) -} -func (m *ConnectReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ConnectReply.Marshal(b, m, deterministic) -} -func (dst *ConnectReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_ConnectReply.Merge(dst, src) -} -func (m *ConnectReply) XXX_Size() int { - return xxx_messageInfo_ConnectReply.Size(m) -} -func (m *ConnectReply) XXX_DiscardUnknown() { - xxx_messageInfo_ConnectReply.DiscardUnknown(m) -} - -var xxx_messageInfo_ConnectReply proto.InternalMessageInfo - -func (m *ConnectReply) GetProxyExternalIp() *AddressPort { - if m != nil { - return m.ProxyExternalIp - } - return nil -} - -type ListenRequest struct { - SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` - Backlog *int32 `protobuf:"varint,2,req,name=backlog" json:"backlog,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ListenRequest) Reset() { *m = ListenRequest{} } -func (m *ListenRequest) String() string { return proto.CompactTextString(m) } -func (*ListenRequest) ProtoMessage() {} -func (*ListenRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{17} -} -func (m *ListenRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ListenRequest.Unmarshal(m, b) -} -func (m *ListenRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ListenRequest.Marshal(b, m, deterministic) -} -func (dst *ListenRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListenRequest.Merge(dst, src) -} -func (m *ListenRequest) XXX_Size() int { - return xxx_messageInfo_ListenRequest.Size(m) -} -func (m *ListenRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ListenRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ListenRequest proto.InternalMessageInfo - -func (m *ListenRequest) GetSocketDescriptor() string { - if m != nil && m.SocketDescriptor != nil { - return *m.SocketDescriptor - } - return "" -} - -func (m *ListenRequest) GetBacklog() int32 { - if m != nil && m.Backlog != nil { - return *m.Backlog - } - return 0 -} - -type ListenReply struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ListenReply) Reset() { *m = ListenReply{} } -func (m *ListenReply) String() string { return proto.CompactTextString(m) } -func (*ListenReply) ProtoMessage() {} -func (*ListenReply) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{18} -} -func (m *ListenReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ListenReply.Unmarshal(m, b) -} -func (m *ListenReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ListenReply.Marshal(b, m, deterministic) -} -func (dst *ListenReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListenReply.Merge(dst, src) -} -func (m *ListenReply) XXX_Size() int { - return xxx_messageInfo_ListenReply.Size(m) -} -func (m *ListenReply) XXX_DiscardUnknown() { - xxx_messageInfo_ListenReply.DiscardUnknown(m) -} - -var xxx_messageInfo_ListenReply proto.InternalMessageInfo - -type AcceptRequest struct { - SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` - TimeoutSeconds *float64 `protobuf:"fixed64,2,opt,name=timeout_seconds,json=timeoutSeconds,def=-1" json:"timeout_seconds,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AcceptRequest) Reset() { *m = AcceptRequest{} } -func (m *AcceptRequest) String() string { return proto.CompactTextString(m) } -func (*AcceptRequest) ProtoMessage() {} -func (*AcceptRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{19} -} -func (m *AcceptRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AcceptRequest.Unmarshal(m, b) -} -func (m *AcceptRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AcceptRequest.Marshal(b, m, deterministic) -} -func (dst *AcceptRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AcceptRequest.Merge(dst, src) -} -func (m *AcceptRequest) XXX_Size() int { - return xxx_messageInfo_AcceptRequest.Size(m) -} -func (m *AcceptRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AcceptRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_AcceptRequest proto.InternalMessageInfo - -const Default_AcceptRequest_TimeoutSeconds float64 = -1 - -func (m *AcceptRequest) GetSocketDescriptor() string { - if m != nil && m.SocketDescriptor != nil { - return *m.SocketDescriptor - } - return "" -} - -func (m *AcceptRequest) GetTimeoutSeconds() float64 { - if m != nil && m.TimeoutSeconds != nil { - return *m.TimeoutSeconds - } - return Default_AcceptRequest_TimeoutSeconds -} - -type AcceptReply struct { - NewSocketDescriptor []byte `protobuf:"bytes,2,opt,name=new_socket_descriptor,json=newSocketDescriptor" json:"new_socket_descriptor,omitempty"` - RemoteAddress *AddressPort `protobuf:"bytes,3,opt,name=remote_address,json=remoteAddress" json:"remote_address,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AcceptReply) Reset() { *m = AcceptReply{} } -func (m *AcceptReply) String() string { return proto.CompactTextString(m) } -func (*AcceptReply) ProtoMessage() {} -func (*AcceptReply) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{20} -} -func (m *AcceptReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AcceptReply.Unmarshal(m, b) -} -func (m *AcceptReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AcceptReply.Marshal(b, m, deterministic) -} -func (dst *AcceptReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_AcceptReply.Merge(dst, src) -} -func (m *AcceptReply) XXX_Size() int { - return xxx_messageInfo_AcceptReply.Size(m) -} -func (m *AcceptReply) XXX_DiscardUnknown() { - xxx_messageInfo_AcceptReply.DiscardUnknown(m) -} - -var xxx_messageInfo_AcceptReply proto.InternalMessageInfo - -func (m *AcceptReply) GetNewSocketDescriptor() []byte { - if m != nil { - return m.NewSocketDescriptor - } - return nil -} - -func (m *AcceptReply) GetRemoteAddress() *AddressPort { - if m != nil { - return m.RemoteAddress - } - return nil -} - -type ShutDownRequest struct { - SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` - How *ShutDownRequest_How `protobuf:"varint,2,req,name=how,enum=appengine.ShutDownRequest_How" json:"how,omitempty"` - SendOffset *int64 `protobuf:"varint,3,req,name=send_offset,json=sendOffset" json:"send_offset,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ShutDownRequest) Reset() { *m = ShutDownRequest{} } -func (m *ShutDownRequest) String() string { return proto.CompactTextString(m) } -func (*ShutDownRequest) ProtoMessage() {} -func (*ShutDownRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{21} -} -func (m *ShutDownRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ShutDownRequest.Unmarshal(m, b) -} -func (m *ShutDownRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ShutDownRequest.Marshal(b, m, deterministic) -} -func (dst *ShutDownRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ShutDownRequest.Merge(dst, src) -} -func (m *ShutDownRequest) XXX_Size() int { - return xxx_messageInfo_ShutDownRequest.Size(m) -} -func (m *ShutDownRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ShutDownRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ShutDownRequest proto.InternalMessageInfo - -func (m *ShutDownRequest) GetSocketDescriptor() string { - if m != nil && m.SocketDescriptor != nil { - return *m.SocketDescriptor - } - return "" -} - -func (m *ShutDownRequest) GetHow() ShutDownRequest_How { - if m != nil && m.How != nil { - return *m.How - } - return ShutDownRequest_SOCKET_SHUT_RD -} - -func (m *ShutDownRequest) GetSendOffset() int64 { - if m != nil && m.SendOffset != nil { - return *m.SendOffset - } - return 0 -} - -type ShutDownReply struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ShutDownReply) Reset() { *m = ShutDownReply{} } -func (m *ShutDownReply) String() string { return proto.CompactTextString(m) } -func (*ShutDownReply) ProtoMessage() {} -func (*ShutDownReply) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{22} -} -func (m *ShutDownReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ShutDownReply.Unmarshal(m, b) -} -func (m *ShutDownReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ShutDownReply.Marshal(b, m, deterministic) -} -func (dst *ShutDownReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_ShutDownReply.Merge(dst, src) -} -func (m *ShutDownReply) XXX_Size() int { - return xxx_messageInfo_ShutDownReply.Size(m) -} -func (m *ShutDownReply) XXX_DiscardUnknown() { - xxx_messageInfo_ShutDownReply.DiscardUnknown(m) -} - -var xxx_messageInfo_ShutDownReply proto.InternalMessageInfo - -type CloseRequest struct { - SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` - SendOffset *int64 `protobuf:"varint,2,opt,name=send_offset,json=sendOffset,def=-1" json:"send_offset,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CloseRequest) Reset() { *m = CloseRequest{} } -func (m *CloseRequest) String() string { return proto.CompactTextString(m) } -func (*CloseRequest) ProtoMessage() {} -func (*CloseRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{23} -} -func (m *CloseRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CloseRequest.Unmarshal(m, b) -} -func (m *CloseRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CloseRequest.Marshal(b, m, deterministic) -} -func (dst *CloseRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_CloseRequest.Merge(dst, src) -} -func (m *CloseRequest) XXX_Size() int { - return xxx_messageInfo_CloseRequest.Size(m) -} -func (m *CloseRequest) XXX_DiscardUnknown() { - xxx_messageInfo_CloseRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_CloseRequest proto.InternalMessageInfo - -const Default_CloseRequest_SendOffset int64 = -1 - -func (m *CloseRequest) GetSocketDescriptor() string { - if m != nil && m.SocketDescriptor != nil { - return *m.SocketDescriptor - } - return "" -} - -func (m *CloseRequest) GetSendOffset() int64 { - if m != nil && m.SendOffset != nil { - return *m.SendOffset - } - return Default_CloseRequest_SendOffset -} - -type CloseReply struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CloseReply) Reset() { *m = CloseReply{} } -func (m *CloseReply) String() string { return proto.CompactTextString(m) } -func (*CloseReply) ProtoMessage() {} -func (*CloseReply) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{24} -} -func (m *CloseReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CloseReply.Unmarshal(m, b) -} -func (m *CloseReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CloseReply.Marshal(b, m, deterministic) -} -func (dst *CloseReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_CloseReply.Merge(dst, src) -} -func (m *CloseReply) XXX_Size() int { - return xxx_messageInfo_CloseReply.Size(m) -} -func (m *CloseReply) XXX_DiscardUnknown() { - xxx_messageInfo_CloseReply.DiscardUnknown(m) -} - -var xxx_messageInfo_CloseReply proto.InternalMessageInfo - -type SendRequest struct { - SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` - Data []byte `protobuf:"bytes,2,req,name=data" json:"data,omitempty"` - StreamOffset *int64 `protobuf:"varint,3,req,name=stream_offset,json=streamOffset" json:"stream_offset,omitempty"` - Flags *int32 `protobuf:"varint,4,opt,name=flags,def=0" json:"flags,omitempty"` - SendTo *AddressPort `protobuf:"bytes,5,opt,name=send_to,json=sendTo" json:"send_to,omitempty"` - TimeoutSeconds *float64 `protobuf:"fixed64,6,opt,name=timeout_seconds,json=timeoutSeconds,def=-1" json:"timeout_seconds,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SendRequest) Reset() { *m = SendRequest{} } -func (m *SendRequest) String() string { return proto.CompactTextString(m) } -func (*SendRequest) ProtoMessage() {} -func (*SendRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{25} -} -func (m *SendRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SendRequest.Unmarshal(m, b) -} -func (m *SendRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SendRequest.Marshal(b, m, deterministic) -} -func (dst *SendRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SendRequest.Merge(dst, src) -} -func (m *SendRequest) XXX_Size() int { - return xxx_messageInfo_SendRequest.Size(m) -} -func (m *SendRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SendRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SendRequest proto.InternalMessageInfo - -const Default_SendRequest_Flags int32 = 0 -const Default_SendRequest_TimeoutSeconds float64 = -1 - -func (m *SendRequest) GetSocketDescriptor() string { - if m != nil && m.SocketDescriptor != nil { - return *m.SocketDescriptor - } - return "" -} - -func (m *SendRequest) GetData() []byte { - if m != nil { - return m.Data - } - return nil -} - -func (m *SendRequest) GetStreamOffset() int64 { - if m != nil && m.StreamOffset != nil { - return *m.StreamOffset - } - return 0 -} - -func (m *SendRequest) GetFlags() int32 { - if m != nil && m.Flags != nil { - return *m.Flags - } - return Default_SendRequest_Flags -} - -func (m *SendRequest) GetSendTo() *AddressPort { - if m != nil { - return m.SendTo - } - return nil -} - -func (m *SendRequest) GetTimeoutSeconds() float64 { - if m != nil && m.TimeoutSeconds != nil { - return *m.TimeoutSeconds - } - return Default_SendRequest_TimeoutSeconds -} - -type SendReply struct { - DataSent *int32 `protobuf:"varint,1,opt,name=data_sent,json=dataSent" json:"data_sent,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SendReply) Reset() { *m = SendReply{} } -func (m *SendReply) String() string { return proto.CompactTextString(m) } -func (*SendReply) ProtoMessage() {} -func (*SendReply) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{26} -} -func (m *SendReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SendReply.Unmarshal(m, b) -} -func (m *SendReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SendReply.Marshal(b, m, deterministic) -} -func (dst *SendReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_SendReply.Merge(dst, src) -} -func (m *SendReply) XXX_Size() int { - return xxx_messageInfo_SendReply.Size(m) -} -func (m *SendReply) XXX_DiscardUnknown() { - xxx_messageInfo_SendReply.DiscardUnknown(m) -} - -var xxx_messageInfo_SendReply proto.InternalMessageInfo - -func (m *SendReply) GetDataSent() int32 { - if m != nil && m.DataSent != nil { - return *m.DataSent - } - return 0 -} - -type ReceiveRequest struct { - SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` - DataSize *int32 `protobuf:"varint,2,req,name=data_size,json=dataSize" json:"data_size,omitempty"` - Flags *int32 `protobuf:"varint,3,opt,name=flags,def=0" json:"flags,omitempty"` - TimeoutSeconds *float64 `protobuf:"fixed64,5,opt,name=timeout_seconds,json=timeoutSeconds,def=-1" json:"timeout_seconds,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ReceiveRequest) Reset() { *m = ReceiveRequest{} } -func (m *ReceiveRequest) String() string { return proto.CompactTextString(m) } -func (*ReceiveRequest) ProtoMessage() {} -func (*ReceiveRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{27} -} -func (m *ReceiveRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReceiveRequest.Unmarshal(m, b) -} -func (m *ReceiveRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReceiveRequest.Marshal(b, m, deterministic) -} -func (dst *ReceiveRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReceiveRequest.Merge(dst, src) -} -func (m *ReceiveRequest) XXX_Size() int { - return xxx_messageInfo_ReceiveRequest.Size(m) -} -func (m *ReceiveRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ReceiveRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ReceiveRequest proto.InternalMessageInfo - -const Default_ReceiveRequest_Flags int32 = 0 -const Default_ReceiveRequest_TimeoutSeconds float64 = -1 - -func (m *ReceiveRequest) GetSocketDescriptor() string { - if m != nil && m.SocketDescriptor != nil { - return *m.SocketDescriptor - } - return "" -} - -func (m *ReceiveRequest) GetDataSize() int32 { - if m != nil && m.DataSize != nil { - return *m.DataSize - } - return 0 -} - -func (m *ReceiveRequest) GetFlags() int32 { - if m != nil && m.Flags != nil { - return *m.Flags - } - return Default_ReceiveRequest_Flags -} - -func (m *ReceiveRequest) GetTimeoutSeconds() float64 { - if m != nil && m.TimeoutSeconds != nil { - return *m.TimeoutSeconds - } - return Default_ReceiveRequest_TimeoutSeconds -} - -type ReceiveReply struct { - StreamOffset *int64 `protobuf:"varint,2,opt,name=stream_offset,json=streamOffset" json:"stream_offset,omitempty"` - Data []byte `protobuf:"bytes,3,opt,name=data" json:"data,omitempty"` - ReceivedFrom *AddressPort `protobuf:"bytes,4,opt,name=received_from,json=receivedFrom" json:"received_from,omitempty"` - BufferSize *int32 `protobuf:"varint,5,opt,name=buffer_size,json=bufferSize" json:"buffer_size,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ReceiveReply) Reset() { *m = ReceiveReply{} } -func (m *ReceiveReply) String() string { return proto.CompactTextString(m) } -func (*ReceiveReply) ProtoMessage() {} -func (*ReceiveReply) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{28} -} -func (m *ReceiveReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReceiveReply.Unmarshal(m, b) -} -func (m *ReceiveReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReceiveReply.Marshal(b, m, deterministic) -} -func (dst *ReceiveReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReceiveReply.Merge(dst, src) -} -func (m *ReceiveReply) XXX_Size() int { - return xxx_messageInfo_ReceiveReply.Size(m) -} -func (m *ReceiveReply) XXX_DiscardUnknown() { - xxx_messageInfo_ReceiveReply.DiscardUnknown(m) -} - -var xxx_messageInfo_ReceiveReply proto.InternalMessageInfo - -func (m *ReceiveReply) GetStreamOffset() int64 { - if m != nil && m.StreamOffset != nil { - return *m.StreamOffset - } - return 0 -} - -func (m *ReceiveReply) GetData() []byte { - if m != nil { - return m.Data - } - return nil -} - -func (m *ReceiveReply) GetReceivedFrom() *AddressPort { - if m != nil { - return m.ReceivedFrom - } - return nil -} - -func (m *ReceiveReply) GetBufferSize() int32 { - if m != nil && m.BufferSize != nil { - return *m.BufferSize - } - return 0 -} - -type PollEvent struct { - SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` - RequestedEvents *int32 `protobuf:"varint,2,req,name=requested_events,json=requestedEvents" json:"requested_events,omitempty"` - ObservedEvents *int32 `protobuf:"varint,3,req,name=observed_events,json=observedEvents" json:"observed_events,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PollEvent) Reset() { *m = PollEvent{} } -func (m *PollEvent) String() string { return proto.CompactTextString(m) } -func (*PollEvent) ProtoMessage() {} -func (*PollEvent) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{29} -} -func (m *PollEvent) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PollEvent.Unmarshal(m, b) -} -func (m *PollEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PollEvent.Marshal(b, m, deterministic) -} -func (dst *PollEvent) XXX_Merge(src proto.Message) { - xxx_messageInfo_PollEvent.Merge(dst, src) -} -func (m *PollEvent) XXX_Size() int { - return xxx_messageInfo_PollEvent.Size(m) -} -func (m *PollEvent) XXX_DiscardUnknown() { - xxx_messageInfo_PollEvent.DiscardUnknown(m) -} - -var xxx_messageInfo_PollEvent proto.InternalMessageInfo - -func (m *PollEvent) GetSocketDescriptor() string { - if m != nil && m.SocketDescriptor != nil { - return *m.SocketDescriptor - } - return "" -} - -func (m *PollEvent) GetRequestedEvents() int32 { - if m != nil && m.RequestedEvents != nil { - return *m.RequestedEvents - } - return 0 -} - -func (m *PollEvent) GetObservedEvents() int32 { - if m != nil && m.ObservedEvents != nil { - return *m.ObservedEvents - } - return 0 -} - -type PollRequest struct { - Events []*PollEvent `protobuf:"bytes,1,rep,name=events" json:"events,omitempty"` - TimeoutSeconds *float64 `protobuf:"fixed64,2,opt,name=timeout_seconds,json=timeoutSeconds,def=-1" json:"timeout_seconds,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PollRequest) Reset() { *m = PollRequest{} } -func (m *PollRequest) String() string { return proto.CompactTextString(m) } -func (*PollRequest) ProtoMessage() {} -func (*PollRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{30} -} -func (m *PollRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PollRequest.Unmarshal(m, b) -} -func (m *PollRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PollRequest.Marshal(b, m, deterministic) -} -func (dst *PollRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_PollRequest.Merge(dst, src) -} -func (m *PollRequest) XXX_Size() int { - return xxx_messageInfo_PollRequest.Size(m) -} -func (m *PollRequest) XXX_DiscardUnknown() { - xxx_messageInfo_PollRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_PollRequest proto.InternalMessageInfo - -const Default_PollRequest_TimeoutSeconds float64 = -1 - -func (m *PollRequest) GetEvents() []*PollEvent { - if m != nil { - return m.Events - } - return nil -} - -func (m *PollRequest) GetTimeoutSeconds() float64 { - if m != nil && m.TimeoutSeconds != nil { - return *m.TimeoutSeconds - } - return Default_PollRequest_TimeoutSeconds -} - -type PollReply struct { - Events []*PollEvent `protobuf:"bytes,2,rep,name=events" json:"events,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PollReply) Reset() { *m = PollReply{} } -func (m *PollReply) String() string { return proto.CompactTextString(m) } -func (*PollReply) ProtoMessage() {} -func (*PollReply) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{31} -} -func (m *PollReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PollReply.Unmarshal(m, b) -} -func (m *PollReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PollReply.Marshal(b, m, deterministic) -} -func (dst *PollReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_PollReply.Merge(dst, src) -} -func (m *PollReply) XXX_Size() int { - return xxx_messageInfo_PollReply.Size(m) -} -func (m *PollReply) XXX_DiscardUnknown() { - xxx_messageInfo_PollReply.DiscardUnknown(m) -} - -var xxx_messageInfo_PollReply proto.InternalMessageInfo - -func (m *PollReply) GetEvents() []*PollEvent { - if m != nil { - return m.Events - } - return nil -} - -type ResolveRequest struct { - Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` - AddressFamilies []CreateSocketRequest_SocketFamily `protobuf:"varint,2,rep,name=address_families,json=addressFamilies,enum=appengine.CreateSocketRequest_SocketFamily" json:"address_families,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ResolveRequest) Reset() { *m = ResolveRequest{} } -func (m *ResolveRequest) String() string { return proto.CompactTextString(m) } -func (*ResolveRequest) ProtoMessage() {} -func (*ResolveRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{32} -} -func (m *ResolveRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ResolveRequest.Unmarshal(m, b) -} -func (m *ResolveRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ResolveRequest.Marshal(b, m, deterministic) -} -func (dst *ResolveRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResolveRequest.Merge(dst, src) -} -func (m *ResolveRequest) XXX_Size() int { - return xxx_messageInfo_ResolveRequest.Size(m) -} -func (m *ResolveRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ResolveRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ResolveRequest proto.InternalMessageInfo - -func (m *ResolveRequest) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *ResolveRequest) GetAddressFamilies() []CreateSocketRequest_SocketFamily { - if m != nil { - return m.AddressFamilies - } - return nil -} - -type ResolveReply struct { - PackedAddress [][]byte `protobuf:"bytes,2,rep,name=packed_address,json=packedAddress" json:"packed_address,omitempty"` - CanonicalName *string `protobuf:"bytes,3,opt,name=canonical_name,json=canonicalName" json:"canonical_name,omitempty"` - Aliases []string `protobuf:"bytes,4,rep,name=aliases" json:"aliases,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ResolveReply) Reset() { *m = ResolveReply{} } -func (m *ResolveReply) String() string { return proto.CompactTextString(m) } -func (*ResolveReply) ProtoMessage() {} -func (*ResolveReply) Descriptor() ([]byte, []int) { - return fileDescriptor_socket_service_b5f8f233dc327808, []int{33} -} -func (m *ResolveReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ResolveReply.Unmarshal(m, b) -} -func (m *ResolveReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ResolveReply.Marshal(b, m, deterministic) -} -func (dst *ResolveReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResolveReply.Merge(dst, src) -} -func (m *ResolveReply) XXX_Size() int { - return xxx_messageInfo_ResolveReply.Size(m) -} -func (m *ResolveReply) XXX_DiscardUnknown() { - xxx_messageInfo_ResolveReply.DiscardUnknown(m) -} - -var xxx_messageInfo_ResolveReply proto.InternalMessageInfo - -func (m *ResolveReply) GetPackedAddress() [][]byte { - if m != nil { - return m.PackedAddress - } - return nil -} - -func (m *ResolveReply) GetCanonicalName() string { - if m != nil && m.CanonicalName != nil { - return *m.CanonicalName - } - return "" -} - -func (m *ResolveReply) GetAliases() []string { - if m != nil { - return m.Aliases - } - return nil -} - -func init() { - proto.RegisterType((*RemoteSocketServiceError)(nil), "appengine.RemoteSocketServiceError") - proto.RegisterType((*AddressPort)(nil), "appengine.AddressPort") - proto.RegisterType((*CreateSocketRequest)(nil), "appengine.CreateSocketRequest") - proto.RegisterType((*CreateSocketReply)(nil), "appengine.CreateSocketReply") - proto.RegisterType((*BindRequest)(nil), "appengine.BindRequest") - proto.RegisterType((*BindReply)(nil), "appengine.BindReply") - proto.RegisterType((*GetSocketNameRequest)(nil), "appengine.GetSocketNameRequest") - proto.RegisterType((*GetSocketNameReply)(nil), "appengine.GetSocketNameReply") - proto.RegisterType((*GetPeerNameRequest)(nil), "appengine.GetPeerNameRequest") - proto.RegisterType((*GetPeerNameReply)(nil), "appengine.GetPeerNameReply") - proto.RegisterType((*SocketOption)(nil), "appengine.SocketOption") - proto.RegisterType((*SetSocketOptionsRequest)(nil), "appengine.SetSocketOptionsRequest") - proto.RegisterType((*SetSocketOptionsReply)(nil), "appengine.SetSocketOptionsReply") - proto.RegisterType((*GetSocketOptionsRequest)(nil), "appengine.GetSocketOptionsRequest") - proto.RegisterType((*GetSocketOptionsReply)(nil), "appengine.GetSocketOptionsReply") - proto.RegisterType((*ConnectRequest)(nil), "appengine.ConnectRequest") - proto.RegisterType((*ConnectReply)(nil), "appengine.ConnectReply") - proto.RegisterType((*ListenRequest)(nil), "appengine.ListenRequest") - proto.RegisterType((*ListenReply)(nil), "appengine.ListenReply") - proto.RegisterType((*AcceptRequest)(nil), "appengine.AcceptRequest") - proto.RegisterType((*AcceptReply)(nil), "appengine.AcceptReply") - proto.RegisterType((*ShutDownRequest)(nil), "appengine.ShutDownRequest") - proto.RegisterType((*ShutDownReply)(nil), "appengine.ShutDownReply") - proto.RegisterType((*CloseRequest)(nil), "appengine.CloseRequest") - proto.RegisterType((*CloseReply)(nil), "appengine.CloseReply") - proto.RegisterType((*SendRequest)(nil), "appengine.SendRequest") - proto.RegisterType((*SendReply)(nil), "appengine.SendReply") - proto.RegisterType((*ReceiveRequest)(nil), "appengine.ReceiveRequest") - proto.RegisterType((*ReceiveReply)(nil), "appengine.ReceiveReply") - proto.RegisterType((*PollEvent)(nil), "appengine.PollEvent") - proto.RegisterType((*PollRequest)(nil), "appengine.PollRequest") - proto.RegisterType((*PollReply)(nil), "appengine.PollReply") - proto.RegisterType((*ResolveRequest)(nil), "appengine.ResolveRequest") - proto.RegisterType((*ResolveReply)(nil), "appengine.ResolveReply") -} - -func init() { - proto.RegisterFile("google.golang.org/appengine/internal/socket/socket_service.proto", fileDescriptor_socket_service_b5f8f233dc327808) -} - -var fileDescriptor_socket_service_b5f8f233dc327808 = []byte{ - // 3088 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0x5f, 0x77, 0xe3, 0xc6, - 0x75, 0x37, 0x48, 0xfd, 0xe3, 0x90, 0x94, 0xee, 0x62, 0xa5, 0x5d, 0x25, 0x6e, 0x12, 0x05, 0x8e, - 0x1b, 0x25, 0x8e, 0x77, 0x6d, 0x39, 0x4d, 0x9b, 0xa4, 0x49, 0x16, 0x04, 0x86, 0x24, 0x4c, 0x00, - 0x03, 0xcd, 0x0c, 0x25, 0xd1, 0x6d, 0x8a, 0xd0, 0x22, 0xa4, 0x65, 0x4c, 0x11, 0x0c, 0xc9, 0xdd, - 0xf5, 0xba, 0x69, 0xaa, 0xfe, 0x39, 0xfd, 0x12, 0x7d, 0xe8, 0x73, 0x3f, 0x43, 0x4f, 0x4f, 0x5f, - 0xfa, 0xec, 0xc7, 0x7e, 0x84, 0x9e, 0xbe, 0xb4, 0x9f, 0xa1, 0x67, 0x06, 0xe0, 0x60, 0xc8, 0xd5, - 0xae, 0x77, 0x75, 0x72, 0x4e, 0x9e, 0xa4, 0xfb, 0xbb, 0x77, 0xee, 0xff, 0x99, 0xb9, 0x03, 0xa2, - 0x47, 0x97, 0x69, 0x7a, 0x39, 0x4a, 0x1e, 0x5c, 0xa6, 0xa3, 0xfe, 0xf8, 0xf2, 0x41, 0x3a, 0xbd, - 0x7c, 0xd8, 0x9f, 0x4c, 0x92, 0xf1, 0xe5, 0x70, 0x9c, 0x3c, 0x1c, 0x8e, 0xe7, 0xc9, 0x74, 0xdc, - 0x1f, 0x3d, 0x9c, 0xa5, 0xe7, 0x9f, 0x25, 0xf3, 0xfc, 0x4f, 0x3c, 0x4b, 0xa6, 0x4f, 0x87, 0xe7, - 0xc9, 0x83, 0xc9, 0x34, 0x9d, 0xa7, 0x66, 0x45, 0xc9, 0x5b, 0xff, 0xbc, 0x8b, 0xf6, 0x69, 0x72, - 0x95, 0xce, 0x13, 0x26, 0x25, 0x59, 0x26, 0x88, 0xa7, 0xd3, 0x74, 0x6a, 0x7e, 0x07, 0xd5, 0x66, - 0xcf, 0x67, 0xf3, 0xe4, 0x2a, 0x4e, 0x04, 0xbd, 0x6f, 0x1c, 0x18, 0x87, 0xeb, 0x3f, 0x31, 0x3e, - 0xa0, 0xd5, 0x0c, 0xce, 0xa4, 0xbe, 0x8d, 0x6a, 0x92, 0x1d, 0x0f, 0x92, 0x79, 0x7f, 0x38, 0xda, - 0x2f, 0x1d, 0x18, 0x87, 0x15, 0x5a, 0x95, 0x98, 0x2b, 0x21, 0xeb, 0x73, 0x54, 0x91, 0xb2, 0x4e, - 0x3a, 0x48, 0x4c, 0x40, 0x35, 0xd6, 0x63, 0x1c, 0x07, 0x31, 0xa6, 0x94, 0x50, 0x30, 0xcc, 0x3a, - 0xaa, 0xb4, 0x6c, 0x2f, 0x27, 0x4b, 0x66, 0x15, 0x6d, 0x36, 0x6d, 0xcf, 0xef, 0x52, 0x0c, 0x6b, - 0xe6, 0x1e, 0xba, 0x13, 0x61, 0x1a, 0x78, 0x8c, 0x79, 0x24, 0x8c, 0x5d, 0x1c, 0x7a, 0xd8, 0x85, - 0x75, 0xf3, 0x2e, 0xda, 0xf1, 0xc2, 0x13, 0xdb, 0xf7, 0xdc, 0x98, 0xe2, 0xe3, 0x2e, 0x66, 0x1c, - 0x36, 0xcc, 0x3b, 0xa8, 0xce, 0x88, 0xd3, 0xc1, 0x3c, 0x76, 0x7c, 0xc2, 0xb0, 0x0b, 0x9b, 0xd6, - 0xbf, 0x99, 0xa8, 0xca, 0x34, 0x67, 0x77, 0x50, 0x95, 0xf5, 0x58, 0xcc, 0xba, 0x8e, 0x83, 0x19, - 0x83, 0xb7, 0x84, 0x6d, 0x01, 0x60, 0x61, 0x04, 0x0c, 0x73, 0x1b, 0x21, 0x49, 0x86, 0x04, 0x87, - 0x1c, 0x4a, 0x8a, 0xcd, 0xa8, 0xd3, 0x86, 0xb2, 0x22, 0xbd, 0x90, 0x53, 0x58, 0x13, 0x9e, 0x66, - 0x24, 0x81, 0x75, 0xc5, 0x0b, 0xcf, 0x3c, 0x02, 0x1b, 0x8a, 0x3c, 0x6a, 0x78, 0x2d, 0xd8, 0x5c, - 0x18, 0x16, 0x8a, 0xcf, 0xb0, 0x03, 0x5b, 0x8a, 0xdf, 0xb0, 0xdd, 0x26, 0x54, 0x94, 0x61, 0xa7, - 0xed, 0xf9, 0x2e, 0x20, 0x45, 0xdb, 0x2d, 0xdb, 0x0b, 0xa1, 0x2a, 0x02, 0x96, 0xf4, 0x29, 0xe9, - 0xfa, 0x6e, 0xc3, 0x27, 0x4e, 0x07, 0xaa, 0x9a, 0xb7, 0x01, 0x0e, 0xa0, 0x56, 0x2c, 0x12, 0xd1, - 0x41, 0x5d, 0xd1, 0x4d, 0xbb, 0xeb, 0x73, 0xd8, 0xd6, 0x9c, 0xe0, 0x0d, 0xbf, 0x03, 0x3b, 0x85, - 0x13, 0x5d, 0xd6, 0x03, 0x50, 0xf2, 0xf8, 0xcc, 0x63, 0x1c, 0xee, 0x28, 0xf6, 0x99, 0x8b, 0x4f, - 0xc0, 0xd4, 0xcc, 0x09, 0xfa, 0xae, 0xae, 0xce, 0xf5, 0x28, 0xec, 0x2a, 0x01, 0x8f, 0x09, 0x7a, - 0xaf, 0xa0, 0x45, 0xa9, 0xe0, 0x5e, 0xa1, 0xa0, 0xe9, 0xf9, 0x18, 0xee, 0x2b, 0x3a, 0x90, 0xf4, - 0xbe, 0x66, 0x80, 0xf3, 0x1e, 0x7c, 0x4d, 0x19, 0xe0, 0x67, 0xbc, 0xc1, 0x7a, 0xf0, 0x75, 0xe5, - 0x50, 0x53, 0x24, 0xf5, 0x6d, 0x4d, 0x9e, 0x45, 0x0e, 0xfc, 0x91, 0xa2, 0x59, 0xe4, 0x45, 0x18, - 0xbe, 0xa1, 0xc4, 0x29, 0x69, 0x32, 0xf8, 0x66, 0x61, 0xce, 0xf7, 0xc2, 0x0e, 0x7c, 0xab, 0xa8, - 0xbd, 0x90, 0x3e, 0x30, 0x6b, 0x68, 0x4b, 0x92, 0x2e, 0x09, 0xe0, 0xdb, 0x4a, 0x98, 0xda, 0x61, - 0x0b, 0x83, 0xa5, 0x7c, 0x71, 0xb1, 0xed, 0xfa, 0x1d, 0x78, 0x47, 0x76, 0x9b, 0x02, 0x44, 0x3d, - 0xde, 0x31, 0x77, 0x11, 0x64, 0xfe, 0xd8, 0x01, 0xe6, 0x84, 0xf8, 0x24, 0x6c, 0xc1, 0x77, 0x34, - 0x2f, 0x7d, 0xa7, 0x03, 0xef, 0xea, 0x5e, 0xf7, 0x18, 0xfc, 0xb1, 0x52, 0x14, 0x12, 0x8e, 0x83, - 0x88, 0xf7, 0xe0, 0xbb, 0xca, 0x33, 0x9f, 0x90, 0x08, 0x0e, 0xf5, 0x3a, 0xb3, 0x16, 0x7c, 0xbf, - 0x68, 0x43, 0x97, 0x06, 0xf0, 0x9e, 0xd6, 0x3b, 0x34, 0x6c, 0xc1, 0x0f, 0xf2, 0x1d, 0x16, 0x63, - 0xff, 0x28, 0x64, 0xbd, 0xd0, 0x81, 0xf7, 0x95, 0x84, 0xff, 0x51, 0xdb, 0xe7, 0xf0, 0x40, 0xa3, - 0x29, 0xe3, 0xf0, 0xb0, 0xa0, 0x43, 0xa1, 0xe1, 0x03, 0x15, 0x6c, 0x37, 0xb4, 0xb9, 0xd3, 0x86, - 0x0f, 0x35, 0x0f, 0x1c, 0xe6, 0xc1, 0x51, 0xb1, 0xe0, 0x48, 0x28, 0xfc, 0x48, 0xef, 0x66, 0x0c, - 0x3f, 0xd4, 0x49, 0x0a, 0x7f, 0xa2, 0xa4, 0xcf, 0x9a, 0x5d, 0xdf, 0x87, 0x1f, 0x69, 0xda, 0xec, - 0x90, 0xc0, 0x9f, 0x2a, 0x73, 0x42, 0xfc, 0xd8, 0x81, 0x3f, 0xd3, 0x01, 0xe6, 0x73, 0xf8, 0xb1, - 0x5a, 0xd1, 0x68, 0x92, 0x90, 0xc3, 0x4f, 0xf5, 0x1c, 0x72, 0x0a, 0x7f, 0xae, 0xb5, 0xa2, 0x6b, - 0x73, 0x1b, 0x7e, 0xa6, 0x3c, 0xe0, 0x5e, 0x80, 0xe1, 0xe7, 0xc5, 0xe6, 0x24, 0x8c, 0xc2, 0x2f, - 0xb4, 0xe5, 0x21, 0xe6, 0xf0, 0x48, 0xa3, 0xa3, 0x4e, 0x0b, 0x6c, 0xa5, 0x8e, 0xe2, 0x80, 0x70, - 0x0c, 0x0d, 0x4d, 0xbf, 0xec, 0x1d, 0x47, 0x35, 0x8b, 0xed, 0x9e, 0x80, 0x5b, 0x34, 0x1e, 0x0d, - 0x42, 0x0e, 0x58, 0x99, 0x73, 0x48, 0x10, 0x40, 0x53, 0xb1, 0x23, 0x4a, 0x38, 0x81, 0x96, 0xaa, - 0x78, 0xd0, 0xf5, 0xb9, 0xd7, 0x26, 0x11, 0xb4, 0x8b, 0xf6, 0x22, 0xdc, 0x25, 0x1c, 0x3c, 0x3d, - 0x05, 0xa2, 0xe8, 0x1f, 0xab, 0x45, 0xe4, 0x04, 0xd3, 0xa6, 0x4f, 0x4e, 0xa1, 0xa3, 0x0a, 0x1d, - 0x12, 0xde, 0x0d, 0xbd, 0x63, 0xf0, 0x8b, 0x3c, 0xd9, 0x6e, 0xd3, 0x85, 0x40, 0x0f, 0xc4, 0x69, - 0xb7, 0x20, 0x54, 0x80, 0xef, 0x35, 0x6c, 0xc7, 0x01, 0xa2, 0x03, 0x0d, 0xdb, 0x85, 0x48, 0x07, - 0x98, 0x13, 0xc2, 0xb1, 0x0e, 0x04, 0xf6, 0x19, 0xd0, 0xa2, 0xbf, 0xbc, 0x86, 0x3c, 0xcc, 0x58, - 0xb1, 0xd1, 0x7d, 0x86, 0x8f, 0x81, 0x2b, 0x09, 0x8a, 0x19, 0xb7, 0x29, 0x87, 0xae, 0x42, 0x18, - 0xa7, 0x72, 0xbb, 0x9d, 0xa8, 0x35, 0x5d, 0x86, 0x29, 0x83, 0x53, 0x3d, 0x18, 0x71, 0x8a, 0xc3, - 0x99, 0xda, 0x4e, 0xae, 0xd0, 0xe2, 0xba, 0x94, 0xe2, 0x63, 0xe8, 0x29, 0xb9, 0x80, 0xb5, 0x98, - 0xf7, 0x09, 0x86, 0x4f, 0x4c, 0x13, 0x6d, 0x17, 0xe9, 0xe5, 0xbd, 0x08, 0xc3, 0x5f, 0xa8, 0xf3, - 0x32, 0x24, 0x12, 0x25, 0x11, 0x87, 0xbf, 0x34, 0xef, 0xa3, 0xbb, 0x85, 0x60, 0x48, 0x58, 0x37, - 0x8a, 0x08, 0xe5, 0xf0, 0x4b, 0xc5, 0x10, 0x86, 0x79, 0xc1, 0xf8, 0x2b, 0xa5, 0x9a, 0x44, 0xc2, - 0xad, 0x6e, 0x14, 0x41, 0xac, 0x1f, 0x7b, 0xac, 0x2b, 0x80, 0x85, 0x9f, 0x51, 0xb3, 0x58, 0xfa, - 0x2b, 0x85, 0xda, 0x1a, 0xda, 0x57, 0x0a, 0x45, 0x3c, 0x5e, 0xd8, 0x65, 0x18, 0x3e, 0x15, 0x77, - 0x9c, 0xc2, 0x42, 0xc2, 0xed, 0x13, 0xdb, 0xf3, 0xe1, 0xbc, 0x48, 0x08, 0xe6, 0x2e, 0x39, 0x0d, - 0x61, 0x50, 0x04, 0x85, 0x79, 0x37, 0xa4, 0xd8, 0x76, 0xda, 0x90, 0x14, 0xc7, 0x07, 0xe6, 0x14, - 0x33, 0xcc, 0xe1, 0x42, 0x99, 0x76, 0x48, 0x18, 0xda, 0x0d, 0x42, 0x39, 0x76, 0xe1, 0x52, 0x99, - 0x16, 0x68, 0x26, 0xf9, 0x58, 0x8b, 0xa5, 0xd1, 0x6d, 0x32, 0x18, 0x2a, 0xc0, 0x63, 0x42, 0x0c, - 0x7e, 0xad, 0x97, 0x45, 0x22, 0x9f, 0x29, 0x83, 0xac, 0xdd, 0xcd, 0x1c, 0x1b, 0x29, 0x83, 0x9c, - 0x90, 0xc0, 0x0e, 0x7b, 0x14, 0x37, 0x19, 0x5c, 0x29, 0x41, 0xb1, 0x07, 0x5d, 0xd2, 0xe5, 0x30, - 0x5e, 0xf2, 0x8c, 0xe2, 0x66, 0x57, 0xdc, 0xd2, 0xa9, 0x12, 0x6c, 0x13, 0x96, 0x69, 0x9c, 0x28, - 0x41, 0x01, 0x2d, 0x62, 0xfd, 0x8d, 0x72, 0xc6, 0xf6, 0x29, 0xb6, 0xdd, 0x1e, 0x4c, 0x55, 0x4a, - 0xbc, 0x30, 0xa2, 0xa4, 0x45, 0xc5, 0xa5, 0x3e, 0x2b, 0xb6, 0x23, 0xb7, 0x7d, 0x0c, 0xf3, 0xe2, - 0x38, 0x73, 0x7c, 0x6c, 0x87, 0xf0, 0x44, 0x2f, 0x61, 0x68, 0x07, 0xf0, 0xb4, 0x00, 0xb2, 0xe4, - 0x3f, 0xd3, 0xae, 0x32, 0x21, 0xf0, 0xb9, 0x72, 0x31, 0x3b, 0x11, 0x3c, 0x02, 0xcf, 0x95, 0x88, - 0x7b, 0xdc, 0x25, 0x1c, 0xbe, 0xd0, 0xce, 0xf1, 0x00, 0xbb, 0x5e, 0x37, 0x80, 0xbf, 0x56, 0xde, - 0x65, 0x80, 0x6c, 0xcd, 0xdf, 0x2a, 0x39, 0xc7, 0x0e, 0x1d, 0xec, 0x63, 0x17, 0xfe, 0x46, 0x3b, - 0x7f, 0x3a, 0xb8, 0x07, 0xbf, 0x53, 0xeb, 0x3a, 0xb8, 0x87, 0xcf, 0x22, 0x8f, 0x62, 0x17, 0xfe, - 0xd6, 0xdc, 0x2d, 0x40, 0x8a, 0x4f, 0x48, 0x07, 0xbb, 0x70, 0x6d, 0x98, 0x7b, 0x79, 0xa2, 0x24, - 0xfa, 0x31, 0x76, 0x44, 0xad, 0xff, 0xce, 0x30, 0xef, 0x2e, 0x1a, 0xf7, 0x34, 0xc4, 0x54, 0x5c, - 0x51, 0xf0, 0xf7, 0x86, 0xb9, 0x9f, 0xb7, 0x79, 0x48, 0x38, 0xc5, 0x8e, 0x38, 0x48, 0xec, 0x86, - 0x8f, 0xe1, 0x1f, 0x0c, 0x13, 0x16, 0xe7, 0x44, 0xb3, 0xe3, 0xf9, 0x3e, 0xfc, 0xa3, 0xf1, 0xf5, - 0x12, 0x18, 0xd6, 0x15, 0xaa, 0xda, 0x83, 0xc1, 0x34, 0x99, 0xcd, 0xa2, 0x74, 0x3a, 0x37, 0x4d, - 0xb4, 0x36, 0x49, 0xa7, 0xf3, 0x7d, 0xe3, 0xa0, 0x74, 0xb8, 0x4e, 0xe5, 0xff, 0xe6, 0xbb, 0x68, - 0x7b, 0xd2, 0x3f, 0xff, 0x2c, 0x19, 0xc4, 0xfd, 0x4c, 0x52, 0xce, 0x7f, 0x35, 0x5a, 0xcf, 0xd0, - 0x7c, 0xb9, 0xf9, 0x0e, 0xaa, 0x3f, 0x4e, 0x67, 0xf3, 0x71, 0xff, 0x2a, 0x89, 0x1f, 0x0f, 0xc7, - 0xf3, 0xfd, 0xb2, 0x9c, 0x12, 0x6b, 0x0b, 0xb0, 0x3d, 0x1c, 0xcf, 0xad, 0x7f, 0x5a, 0x43, 0x77, - 0x9d, 0x69, 0xd2, 0x5f, 0x0c, 0xa3, 0x34, 0xf9, 0xcd, 0x93, 0x64, 0x36, 0x37, 0x1d, 0xb4, 0x71, - 0xd1, 0xbf, 0x1a, 0x8e, 0x9e, 0x4b, 0xcb, 0xdb, 0x47, 0xef, 0x3d, 0x50, 0x03, 0xec, 0x83, 0x1b, - 0xe4, 0x1f, 0x64, 0x54, 0x53, 0x2e, 0xa1, 0xf9, 0x52, 0xd3, 0x43, 0x5b, 0x72, 0xfa, 0x3d, 0x4f, - 0xc5, 0x88, 0x2a, 0xd4, 0xbc, 0xff, 0x5a, 0x6a, 0xa2, 0x7c, 0x11, 0x55, 0xcb, 0xcd, 0x9f, 0xa3, - 0xed, 0x7c, 0xae, 0x4e, 0x27, 0xf3, 0x61, 0x3a, 0x9e, 0xed, 0x97, 0x0f, 0xca, 0x87, 0xd5, 0xa3, - 0xfb, 0x9a, 0xc2, 0x6c, 0x31, 0x91, 0x7c, 0x5a, 0x9f, 0x69, 0xd4, 0xcc, 0x6c, 0xa0, 0x3b, 0x93, - 0x69, 0xfa, 0xf9, 0xf3, 0x38, 0xf9, 0x3c, 0x9b, 0xd6, 0xe3, 0xe1, 0x64, 0x7f, 0xed, 0xc0, 0x38, - 0xac, 0x1e, 0xdd, 0xd3, 0x54, 0x68, 0xa9, 0xa7, 0x3b, 0x72, 0x01, 0xce, 0xe5, 0xbd, 0x89, 0x79, - 0x88, 0xb6, 0x47, 0xc3, 0xd9, 0x3c, 0x19, 0xc7, 0x9f, 0xf6, 0xcf, 0x3f, 0x1b, 0xa5, 0x97, 0xfb, - 0xeb, 0x8b, 0xe9, 0xbc, 0x9e, 0x31, 0x1a, 0x19, 0x6e, 0x7e, 0x84, 0x2a, 0x53, 0x39, 0xe1, 0x0b, - 0x2b, 0x1b, 0xaf, 0xb4, 0xb2, 0x95, 0x09, 0x7a, 0x13, 0x73, 0x0f, 0x6d, 0xf4, 0x27, 0x93, 0x78, - 0x38, 0xd8, 0xaf, 0xc8, 0x42, 0xad, 0xf7, 0x27, 0x13, 0x6f, 0x60, 0x7e, 0x03, 0xa1, 0xc9, 0x34, - 0xfd, 0x75, 0x72, 0x3e, 0x17, 0x2c, 0x74, 0x60, 0x1c, 0x96, 0x69, 0x25, 0x47, 0xbc, 0x81, 0x65, - 0xa1, 0x9a, 0x9e, 0x7b, 0x73, 0x0b, 0xad, 0x79, 0xd1, 0xd3, 0x1f, 0x82, 0x91, 0xff, 0xf7, 0x23, - 0x28, 0x59, 0x16, 0xda, 0x5e, 0x4e, 0xac, 0xb9, 0x89, 0xca, 0xdc, 0x89, 0xc0, 0x10, 0xff, 0x74, - 0xdd, 0x08, 0x4a, 0xd6, 0x97, 0x06, 0xba, 0xb3, 0x5c, 0x91, 0xc9, 0xe8, 0xb9, 0xf9, 0x1e, 0xba, - 0x93, 0xa7, 0x7d, 0x90, 0xcc, 0xce, 0xa7, 0xc3, 0xc9, 0x3c, 0x7f, 0x93, 0x54, 0x28, 0x64, 0x0c, - 0x57, 0xe1, 0xe6, 0xcf, 0xd0, 0xb6, 0x78, 0xf4, 0x24, 0x53, 0xd5, 0x97, 0xe5, 0x57, 0x86, 0x5e, - 0xcf, 0xa4, 0x17, 0xfd, 0xfa, 0x7b, 0x28, 0xd1, 0xf7, 0x2b, 0x5b, 0xff, 0xb3, 0x09, 0xd7, 0xd7, - 0xd7, 0xd7, 0x25, 0xeb, 0x77, 0xa8, 0xda, 0x18, 0x8e, 0x07, 0x8b, 0x86, 0x7e, 0x49, 0x24, 0xa5, - 0x1b, 0x23, 0xb9, 0xd1, 0x15, 0xd1, 0xc1, 0xaf, 0xef, 0x8a, 0x45, 0x50, 0x25, 0xb3, 0x2f, 0xf2, - 0x78, 0xa3, 0x42, 0xe3, 0x8d, 0x62, 0xb3, 0x1c, 0xb4, 0xdb, 0x4a, 0xe6, 0x59, 0x75, 0xc2, 0xfe, - 0x55, 0x72, 0x9b, 0xc8, 0xac, 0x33, 0x64, 0xae, 0x28, 0x79, 0xa9, 0x7b, 0xa5, 0x37, 0x73, 0xcf, - 0x96, 0x9a, 0xa3, 0x24, 0x99, 0xde, 0xda, 0x39, 0x07, 0xc1, 0x92, 0x0a, 0xe1, 0xda, 0x43, 0xb4, - 0x39, 0x49, 0x92, 0xe9, 0x57, 0x3b, 0xb4, 0x21, 0xc4, 0xbc, 0x89, 0xf5, 0xe5, 0xe6, 0x62, 0x47, - 0x64, 0x7b, 0xdf, 0xfc, 0x05, 0x5a, 0x1f, 0x25, 0x4f, 0x93, 0x51, 0x7e, 0x92, 0x7d, 0xef, 0x25, - 0x27, 0xc6, 0x12, 0xe1, 0x8b, 0x05, 0x34, 0x5b, 0x67, 0x3e, 0x42, 0x1b, 0xd9, 0xa1, 0x93, 0x1f, - 0x62, 0x87, 0xaf, 0xa3, 0x41, 0x46, 0x90, 0xaf, 0x33, 0x77, 0xd1, 0xfa, 0xd3, 0xfe, 0xe8, 0x49, - 0xb2, 0x5f, 0x3e, 0x28, 0x1d, 0xd6, 0x68, 0x46, 0x58, 0x09, 0xba, 0xf3, 0x82, 0x4d, 0xed, 0x41, - 0xcd, 0x88, 0x1f, 0x7b, 0x11, 0xbc, 0x25, 0x67, 0x95, 0x02, 0xca, 0xfe, 0x05, 0x43, 0xce, 0x16, - 0x05, 0x2c, 0xb6, 0xf3, 0xc6, 0x0a, 0x26, 0x76, 0xf6, 0x1d, 0xeb, 0xdf, 0xd7, 0x11, 0xac, 0x7a, - 0x26, 0x6f, 0xbb, 0x85, 0x60, 0xec, 0xe2, 0x46, 0xb7, 0x05, 0x86, 0x1c, 0xc9, 0x14, 0x48, 0xc5, - 0x94, 0x28, 0xc6, 0x23, 0x28, 0x2d, 0xa9, 0x8d, 0xe5, 0x95, 0x5a, 0x5e, 0xd6, 0x90, 0x7d, 0x47, - 0x58, 0x5b, 0xd6, 0xe0, 0x92, 0x90, 0x53, 0xd2, 0xe5, 0x18, 0xd6, 0x97, 0x19, 0x0d, 0x4a, 0x6c, - 0xd7, 0xb1, 0xe5, 0x07, 0x04, 0x31, 0x74, 0x28, 0x06, 0x0b, 0xdd, 0x46, 0xb7, 0x09, 0x9b, 0xcb, - 0x28, 0x75, 0x4e, 0x04, 0xba, 0xb5, 0xac, 0xa4, 0x83, 0x71, 0x64, 0xfb, 0xde, 0x09, 0x86, 0xca, - 0x32, 0x83, 0x90, 0x86, 0x17, 0xfa, 0x5e, 0x88, 0x01, 0x2d, 0xeb, 0xf1, 0xbd, 0xb0, 0x85, 0x29, - 0xd4, 0xcd, 0x7b, 0xc8, 0x5c, 0xd2, 0x2e, 0x86, 0x25, 0x02, 0xbb, 0xcb, 0x38, 0x0b, 0xdd, 0x0c, - 0xdf, 0xd3, 0x6a, 0xe2, 0x45, 0x31, 0x27, 0x0c, 0x8c, 0x15, 0x88, 0xfb, 0x50, 0xd2, 0xca, 0xe4, - 0x45, 0x71, 0x5b, 0x8c, 0x9a, 0x8e, 0x0f, 0xe5, 0x65, 0x98, 0x44, 0xdc, 0x23, 0x21, 0x83, 0x35, - 0xcd, 0x16, 0x77, 0xa2, 0x58, 0x3c, 0xef, 0x7d, 0xbb, 0x07, 0x86, 0x26, 0x2e, 0xf0, 0xc0, 0x3e, - 0x63, 0xb8, 0x05, 0x25, 0x2d, 0xdb, 0x02, 0x76, 0x08, 0xed, 0x40, 0x59, 0x0b, 0x5b, 0x80, 0x22, - 0x21, 0x9e, 0xeb, 0x63, 0x58, 0x33, 0xf7, 0xd1, 0xee, 0x2a, 0x23, 0xe4, 0x27, 0x3e, 0xac, 0xaf, - 0x98, 0x15, 0x1c, 0x27, 0x14, 0x65, 0x58, 0x36, 0x2b, 0x9e, 0xb0, 0x21, 0x87, 0xcd, 0x15, 0xf1, - 0x2c, 0x81, 0x47, 0xb0, 0x65, 0xbe, 0x8d, 0xee, 0x6b, 0xb8, 0x8b, 0x9b, 0x98, 0xc6, 0xb6, 0xe3, - 0xe0, 0x88, 0x43, 0x65, 0x85, 0x79, 0xea, 0x85, 0x2e, 0x39, 0x8d, 0x1d, 0xdf, 0x0e, 0x22, 0x40, - 0x2b, 0x81, 0x78, 0x61, 0x93, 0x40, 0x75, 0x25, 0x90, 0xe3, 0xae, 0xe7, 0x74, 0x6c, 0xa7, 0x03, - 0x35, 0x39, 0x11, 0x3d, 0x47, 0xf7, 0xd9, 0xe2, 0xc8, 0xca, 0xaf, 0xf3, 0x5b, 0x1d, 0xea, 0x1f, - 0xa2, 0xcd, 0xc5, 0xec, 0x50, 0x7a, 0xf5, 0xec, 0xb0, 0x90, 0xb3, 0xee, 0xa3, 0xbd, 0x17, 0x4d, - 0x4f, 0x46, 0xcf, 0x85, 0x4f, 0xad, 0x3f, 0x90, 0x4f, 0x1f, 0xa3, 0xbd, 0xd6, 0x4d, 0x3e, 0xdd, - 0x46, 0xd7, 0xbf, 0x18, 0x68, 0xdb, 0x49, 0xc7, 0xe3, 0xe4, 0x7c, 0x7e, 0x2b, 0xf7, 0x97, 0xe6, - 0x9c, 0x57, 0xdf, 0x8f, 0xc5, 0x9c, 0xf3, 0x1e, 0xda, 0x99, 0x0f, 0xaf, 0x92, 0xf4, 0xc9, 0x3c, - 0x9e, 0x25, 0xe7, 0xe9, 0x78, 0x90, 0xcd, 0x09, 0xc6, 0x4f, 0x4a, 0xef, 0x7f, 0x48, 0xb7, 0x73, - 0x16, 0xcb, 0x38, 0xd6, 0x2f, 0x51, 0x4d, 0x39, 0xf8, 0x7b, 0xba, 0x48, 0xf5, 0x21, 0xe1, 0x04, - 0xd5, 0x7d, 0x39, 0xb9, 0xdd, 0x2a, 0xfc, 0x7d, 0xb4, 0xb9, 0x98, 0x04, 0x4b, 0x72, 0x3e, 0x5f, - 0x90, 0x56, 0x1d, 0x55, 0x17, 0x7a, 0x45, 0xbb, 0x0c, 0x51, 0xdd, 0x3e, 0x3f, 0x4f, 0x26, 0xb7, - 0xcb, 0xf2, 0x0d, 0x09, 0x2b, 0xbd, 0x34, 0x61, 0xd7, 0x06, 0xaa, 0x2e, 0x6c, 0x89, 0x84, 0x1d, - 0xa1, 0xbd, 0x71, 0xf2, 0x2c, 0x7e, 0xd1, 0x5a, 0xf6, 0x66, 0xb8, 0x3b, 0x4e, 0x9e, 0xb1, 0x1b, - 0x06, 0xb9, 0xbc, 0xac, 0xaf, 0x39, 0xc8, 0x65, 0xd2, 0x39, 0x64, 0xfd, 0x97, 0x81, 0x76, 0xd8, - 0xe3, 0x27, 0x73, 0x37, 0x7d, 0x76, 0xbb, 0xbc, 0x7e, 0x80, 0xca, 0x8f, 0xd3, 0x67, 0xf9, 0x6d, - 0xfb, 0x4d, 0xbd, 0x8b, 0x97, 0xb5, 0x3e, 0x68, 0xa7, 0xcf, 0xa8, 0x10, 0x35, 0xbf, 0x85, 0xaa, - 0xb3, 0x64, 0x3c, 0x88, 0xd3, 0x8b, 0x8b, 0x59, 0x32, 0x97, 0xd7, 0x6c, 0x99, 0x22, 0x01, 0x11, - 0x89, 0x58, 0x0e, 0x2a, 0xb7, 0xd3, 0x67, 0xfa, 0x45, 0xd6, 0xee, 0xf2, 0x98, 0xba, 0xcb, 0xf7, - 0xa8, 0xc0, 0x4e, 0xc5, 0x85, 0xa7, 0xdd, 0x1b, 0x99, 0xdc, 0x29, 0x85, 0xb2, 0xb5, 0x83, 0xea, - 0x85, 0x07, 0xa2, 0xae, 0xbf, 0x42, 0x35, 0x67, 0x94, 0xce, 0x6e, 0x35, 0xed, 0x98, 0xef, 0x2c, - 0xfb, 0x2c, 0xea, 0x51, 0x96, 0x25, 0xd5, 0xfd, 0xae, 0x21, 0x94, 0x5b, 0x10, 0xf6, 0xfe, 0xcf, - 0x40, 0x55, 0x96, 0xdc, 0x72, 0xa8, 0xbd, 0x87, 0xd6, 0x06, 0xfd, 0x79, 0x5f, 0xa6, 0xb5, 0xd6, - 0x28, 0x6d, 0x19, 0x54, 0xd2, 0xe2, 0x9d, 0x38, 0x9b, 0x4f, 0x93, 0xfe, 0xd5, 0x72, 0xf6, 0x6a, - 0x19, 0x98, 0xf9, 0x61, 0xde, 0x47, 0xeb, 0x17, 0xa3, 0xfe, 0xe5, 0x4c, 0x0e, 0xe4, 0xf2, 0xc9, - 0x93, 0xd1, 0x62, 0x3e, 0x93, 0x51, 0xcc, 0x53, 0xf9, 0x1a, 0x7a, 0xc5, 0x7c, 0x26, 0xc4, 0x78, - 0x7a, 0x53, 0x37, 0x6f, 0xbc, 0xb4, 0x9b, 0x0f, 0x51, 0x25, 0x8b, 0x57, 0xb4, 0xf2, 0xdb, 0xa8, - 0x22, 0x1c, 0x8e, 0x67, 0xc9, 0x78, 0x9e, 0xfd, 0x30, 0x42, 0xb7, 0x04, 0xc0, 0x92, 0xf1, 0xdc, - 0xfa, 0x4f, 0x03, 0x6d, 0xd3, 0xe4, 0x3c, 0x19, 0x3e, 0xbd, 0x5d, 0x35, 0x94, 0xf2, 0xe1, 0x17, - 0x49, 0xbe, 0x9b, 0x33, 0xe5, 0xc3, 0x2f, 0x92, 0x22, 0xfa, 0xf2, 0x4a, 0xf4, 0x37, 0x04, 0xb3, - 0xfe, 0xd2, 0x60, 0x2c, 0xb4, 0xde, 0x94, 0xab, 0xaa, 0x68, 0x33, 0x60, 0x2d, 0x31, 0xa8, 0x80, - 0x61, 0xd6, 0xd0, 0x96, 0x20, 0x22, 0x8c, 0x3b, 0x50, 0xb2, 0xfe, 0xd5, 0x40, 0x35, 0x15, 0x86, - 0x08, 0xfa, 0x85, 0xea, 0xc8, 0x3e, 0x59, 0xa9, 0xce, 0xa2, 0xb4, 0xc2, 0x3d, 0xbd, 0xb4, 0x3f, - 0x45, 0xf5, 0x69, 0xa6, 0x6c, 0x10, 0x5f, 0x4c, 0xd3, 0xab, 0xaf, 0x78, 0x4e, 0xd5, 0x16, 0xc2, - 0xcd, 0x69, 0x7a, 0x25, 0xf6, 0xd4, 0xa7, 0x4f, 0x2e, 0x2e, 0x92, 0x69, 0x96, 0x13, 0xf9, 0xd6, - 0xa5, 0x28, 0x83, 0x44, 0x56, 0xac, 0x2f, 0xcb, 0xa8, 0x12, 0xa5, 0xa3, 0x11, 0x7e, 0x9a, 0x8c, - 0xdf, 0x30, 0xdb, 0xdf, 0x43, 0x30, 0xcd, 0xaa, 0x94, 0x0c, 0xe2, 0x44, 0xac, 0x9f, 0xe5, 0x49, - 0xdf, 0x51, 0xb8, 0x54, 0x3b, 0x33, 0xbf, 0x8b, 0x76, 0xd2, 0x4f, 0xe5, 0x4b, 0x51, 0x49, 0x96, - 0xa5, 0xe4, 0xf6, 0x02, 0xce, 0x04, 0xad, 0xff, 0x28, 0xa1, 0xba, 0x72, 0x47, 0x24, 0x5a, 0x9b, - 0x35, 0x22, 0xe2, 0xfb, 0x21, 0x09, 0x31, 0xbc, 0xa5, 0x4d, 0x6e, 0x02, 0xf4, 0xc2, 0xa5, 0x13, - 0x40, 0x40, 0x11, 0xf5, 0x96, 0x46, 0x5e, 0x81, 0x91, 0x2e, 0x87, 0xb5, 0x15, 0x0c, 0x53, 0x0a, - 0x5b, 0x2b, 0x58, 0xbb, 0x1b, 0x01, 0xac, 0xda, 0x3d, 0xb1, 0x7d, 0x38, 0xd0, 0x26, 0x2c, 0x01, - 0x52, 0x37, 0x24, 0x34, 0x80, 0x47, 0xe6, 0xbd, 0x15, 0xb8, 0x61, 0x87, 0xf2, 0x1b, 0xd3, 0x32, - 0x7e, 0x4a, 0xa5, 0xf8, 0x75, 0xe9, 0x05, 0x3c, 0x93, 0x5f, 0x93, 0x1f, 0x9f, 0x0a, 0x3c, 0x60, - 0x2d, 0xb8, 0xde, 0x5a, 0x55, 0x8e, 0x03, 0x72, 0x82, 0xe1, 0xfa, 0x40, 0x7e, 0xc0, 0xd2, 0x8d, - 0x0a, 0xb7, 0xaf, 0x1f, 0x59, 0x8f, 0x51, 0x55, 0x24, 0x70, 0xb1, 0x7f, 0x7e, 0x80, 0x36, 0xf2, - 0x84, 0x1b, 0x72, 0x9e, 0xd8, 0xd5, 0xda, 0x46, 0x25, 0x9a, 0xe6, 0x32, 0x6f, 0x76, 0x4b, 0xfd, - 0x38, 0xeb, 0x9c, 0xac, 0xc5, 0x0b, 0x3b, 0xa5, 0xaf, 0xb6, 0x63, 0xfd, 0x56, 0xec, 0xf3, 0x59, - 0x3a, 0x2a, 0xf6, 0xb9, 0x89, 0xd6, 0xc6, 0xfd, 0xab, 0x24, 0x6f, 0x36, 0xf9, 0xbf, 0x79, 0x82, - 0x20, 0xbf, 0xbb, 0x62, 0xf9, 0x31, 0x6a, 0x98, 0x64, 0xda, 0xdf, 0xf0, 0x4b, 0xd6, 0x4e, 0xae, - 0xa4, 0x99, 0xeb, 0xb0, 0xfe, 0xbb, 0x2c, 0xf6, 0x67, 0x6e, 0x5e, 0x38, 0x7f, 0xd3, 0xc7, 0xb8, - 0xf2, 0x8b, 0x1f, 0xe3, 0xde, 0x45, 0xdb, 0xe7, 0xfd, 0x71, 0x3a, 0x1e, 0x9e, 0xf7, 0x47, 0xb1, - 0xf4, 0x36, 0xfb, 0x1a, 0x57, 0x57, 0xa8, 0x7c, 0x96, 0xed, 0xa3, 0xcd, 0xfe, 0x68, 0xd8, 0x9f, - 0x25, 0xe2, 0xa0, 0x2d, 0x1f, 0x56, 0xe8, 0x82, 0xb4, 0xfe, 0xb7, 0xa4, 0xff, 0xa0, 0xfb, 0x35, - 0xb4, 0x97, 0x17, 0x10, 0xdb, 0x5e, 0x2c, 0x5e, 0x69, 0x4d, 0x3b, 0xf0, 0x7c, 0xf1, 0x80, 0x28, - 0xae, 0x2e, 0xc9, 0x92, 0xbf, 0x65, 0x96, 0xb4, 0x09, 0x5b, 0xa0, 0x0d, 0xdb, 0x6d, 0xfa, 0x76, - 0x8b, 0x2d, 0x3d, 0xe3, 0x04, 0xa3, 0x69, 0x7b, 0x7e, 0xf6, 0x0b, 0xf0, 0x12, 0x28, 0x55, 0xaf, - 0xaf, 0xc0, 0x01, 0x0e, 0x08, 0xed, 0x2d, 0xbd, 0x1d, 0x04, 0x9c, 0xff, 0x1c, 0xb4, 0xf9, 0x02, - 0x1c, 0xda, 0x01, 0x86, 0x2d, 0xed, 0x49, 0x21, 0x60, 0x86, 0xe9, 0x89, 0xe7, 0x2c, 0xbf, 0xe1, - 0x24, 0x4e, 0x9c, 0x8e, 0x7c, 0x68, 0xa2, 0x15, 0x3d, 0xd9, 0xef, 0xd8, 0x4b, 0x6f, 0x86, 0x3c, - 0xa2, 0xb6, 0x17, 0x72, 0x06, 0xb5, 0x15, 0x86, 0xfc, 0xdd, 0xc1, 0x21, 0x3e, 0xd4, 0x57, 0x18, - 0xea, 0x37, 0x9d, 0x6d, 0x6d, 0x0f, 0xcb, 0xb8, 0xec, 0x33, 0xd8, 0x69, 0x6c, 0x7d, 0xb2, 0x91, - 0x9d, 0x5a, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x31, 0x03, 0x4e, 0xbd, 0xfd, 0x1f, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/appengine/internal/socket/socket_service.proto b/vendor/google.golang.org/appengine/internal/socket/socket_service.proto deleted file mode 100644 index 2fcc7953d..000000000 --- a/vendor/google.golang.org/appengine/internal/socket/socket_service.proto +++ /dev/null @@ -1,460 +0,0 @@ -syntax = "proto2"; -option go_package = "socket"; - -package appengine; - -message RemoteSocketServiceError { - enum ErrorCode { - SYSTEM_ERROR = 1; - GAI_ERROR = 2; - FAILURE = 4; - PERMISSION_DENIED = 5; - INVALID_REQUEST = 6; - SOCKET_CLOSED = 7; - } - - enum SystemError { - option allow_alias = true; - - SYS_SUCCESS = 0; - SYS_EPERM = 1; - SYS_ENOENT = 2; - SYS_ESRCH = 3; - SYS_EINTR = 4; - SYS_EIO = 5; - SYS_ENXIO = 6; - SYS_E2BIG = 7; - SYS_ENOEXEC = 8; - SYS_EBADF = 9; - SYS_ECHILD = 10; - SYS_EAGAIN = 11; - SYS_EWOULDBLOCK = 11; - SYS_ENOMEM = 12; - SYS_EACCES = 13; - SYS_EFAULT = 14; - SYS_ENOTBLK = 15; - SYS_EBUSY = 16; - SYS_EEXIST = 17; - SYS_EXDEV = 18; - SYS_ENODEV = 19; - SYS_ENOTDIR = 20; - SYS_EISDIR = 21; - SYS_EINVAL = 22; - SYS_ENFILE = 23; - SYS_EMFILE = 24; - SYS_ENOTTY = 25; - SYS_ETXTBSY = 26; - SYS_EFBIG = 27; - SYS_ENOSPC = 28; - SYS_ESPIPE = 29; - SYS_EROFS = 30; - SYS_EMLINK = 31; - SYS_EPIPE = 32; - SYS_EDOM = 33; - SYS_ERANGE = 34; - SYS_EDEADLK = 35; - SYS_EDEADLOCK = 35; - SYS_ENAMETOOLONG = 36; - SYS_ENOLCK = 37; - SYS_ENOSYS = 38; - SYS_ENOTEMPTY = 39; - SYS_ELOOP = 40; - SYS_ENOMSG = 42; - SYS_EIDRM = 43; - SYS_ECHRNG = 44; - SYS_EL2NSYNC = 45; - SYS_EL3HLT = 46; - SYS_EL3RST = 47; - SYS_ELNRNG = 48; - SYS_EUNATCH = 49; - SYS_ENOCSI = 50; - SYS_EL2HLT = 51; - SYS_EBADE = 52; - SYS_EBADR = 53; - SYS_EXFULL = 54; - SYS_ENOANO = 55; - SYS_EBADRQC = 56; - SYS_EBADSLT = 57; - SYS_EBFONT = 59; - SYS_ENOSTR = 60; - SYS_ENODATA = 61; - SYS_ETIME = 62; - SYS_ENOSR = 63; - SYS_ENONET = 64; - SYS_ENOPKG = 65; - SYS_EREMOTE = 66; - SYS_ENOLINK = 67; - SYS_EADV = 68; - SYS_ESRMNT = 69; - SYS_ECOMM = 70; - SYS_EPROTO = 71; - SYS_EMULTIHOP = 72; - SYS_EDOTDOT = 73; - SYS_EBADMSG = 74; - SYS_EOVERFLOW = 75; - SYS_ENOTUNIQ = 76; - SYS_EBADFD = 77; - SYS_EREMCHG = 78; - SYS_ELIBACC = 79; - SYS_ELIBBAD = 80; - SYS_ELIBSCN = 81; - SYS_ELIBMAX = 82; - SYS_ELIBEXEC = 83; - SYS_EILSEQ = 84; - SYS_ERESTART = 85; - SYS_ESTRPIPE = 86; - SYS_EUSERS = 87; - SYS_ENOTSOCK = 88; - SYS_EDESTADDRREQ = 89; - SYS_EMSGSIZE = 90; - SYS_EPROTOTYPE = 91; - SYS_ENOPROTOOPT = 92; - SYS_EPROTONOSUPPORT = 93; - SYS_ESOCKTNOSUPPORT = 94; - SYS_EOPNOTSUPP = 95; - SYS_ENOTSUP = 95; - SYS_EPFNOSUPPORT = 96; - SYS_EAFNOSUPPORT = 97; - SYS_EADDRINUSE = 98; - SYS_EADDRNOTAVAIL = 99; - SYS_ENETDOWN = 100; - SYS_ENETUNREACH = 101; - SYS_ENETRESET = 102; - SYS_ECONNABORTED = 103; - SYS_ECONNRESET = 104; - SYS_ENOBUFS = 105; - SYS_EISCONN = 106; - SYS_ENOTCONN = 107; - SYS_ESHUTDOWN = 108; - SYS_ETOOMANYREFS = 109; - SYS_ETIMEDOUT = 110; - SYS_ECONNREFUSED = 111; - SYS_EHOSTDOWN = 112; - SYS_EHOSTUNREACH = 113; - SYS_EALREADY = 114; - SYS_EINPROGRESS = 115; - SYS_ESTALE = 116; - SYS_EUCLEAN = 117; - SYS_ENOTNAM = 118; - SYS_ENAVAIL = 119; - SYS_EISNAM = 120; - SYS_EREMOTEIO = 121; - SYS_EDQUOT = 122; - SYS_ENOMEDIUM = 123; - SYS_EMEDIUMTYPE = 124; - SYS_ECANCELED = 125; - SYS_ENOKEY = 126; - SYS_EKEYEXPIRED = 127; - SYS_EKEYREVOKED = 128; - SYS_EKEYREJECTED = 129; - SYS_EOWNERDEAD = 130; - SYS_ENOTRECOVERABLE = 131; - SYS_ERFKILL = 132; - } - - optional int32 system_error = 1 [default=0]; - optional string error_detail = 2; -} - -message AddressPort { - required int32 port = 1; - optional bytes packed_address = 2; - - optional string hostname_hint = 3; -} - - - -message CreateSocketRequest { - enum SocketFamily { - IPv4 = 1; - IPv6 = 2; - } - - enum SocketProtocol { - TCP = 1; - UDP = 2; - } - - required SocketFamily family = 1; - required SocketProtocol protocol = 2; - - repeated SocketOption socket_options = 3; - - optional AddressPort proxy_external_ip = 4; - - optional int32 listen_backlog = 5 [default=0]; - - optional AddressPort remote_ip = 6; - - optional string app_id = 9; - - optional int64 project_id = 10; -} - -message CreateSocketReply { - optional string socket_descriptor = 1; - - optional AddressPort server_address = 3; - - optional AddressPort proxy_external_ip = 4; - - extensions 1000 to max; -} - - - -message BindRequest { - required string socket_descriptor = 1; - required AddressPort proxy_external_ip = 2; -} - -message BindReply { - optional AddressPort proxy_external_ip = 1; -} - - - -message GetSocketNameRequest { - required string socket_descriptor = 1; -} - -message GetSocketNameReply { - optional AddressPort proxy_external_ip = 2; -} - - - -message GetPeerNameRequest { - required string socket_descriptor = 1; -} - -message GetPeerNameReply { - optional AddressPort peer_ip = 2; -} - - -message SocketOption { - - enum SocketOptionLevel { - SOCKET_SOL_IP = 0; - SOCKET_SOL_SOCKET = 1; - SOCKET_SOL_TCP = 6; - SOCKET_SOL_UDP = 17; - } - - enum SocketOptionName { - option allow_alias = true; - - SOCKET_SO_DEBUG = 1; - SOCKET_SO_REUSEADDR = 2; - SOCKET_SO_TYPE = 3; - SOCKET_SO_ERROR = 4; - SOCKET_SO_DONTROUTE = 5; - SOCKET_SO_BROADCAST = 6; - SOCKET_SO_SNDBUF = 7; - SOCKET_SO_RCVBUF = 8; - SOCKET_SO_KEEPALIVE = 9; - SOCKET_SO_OOBINLINE = 10; - SOCKET_SO_LINGER = 13; - SOCKET_SO_RCVTIMEO = 20; - SOCKET_SO_SNDTIMEO = 21; - - SOCKET_IP_TOS = 1; - SOCKET_IP_TTL = 2; - SOCKET_IP_HDRINCL = 3; - SOCKET_IP_OPTIONS = 4; - - SOCKET_TCP_NODELAY = 1; - SOCKET_TCP_MAXSEG = 2; - SOCKET_TCP_CORK = 3; - SOCKET_TCP_KEEPIDLE = 4; - SOCKET_TCP_KEEPINTVL = 5; - SOCKET_TCP_KEEPCNT = 6; - SOCKET_TCP_SYNCNT = 7; - SOCKET_TCP_LINGER2 = 8; - SOCKET_TCP_DEFER_ACCEPT = 9; - SOCKET_TCP_WINDOW_CLAMP = 10; - SOCKET_TCP_INFO = 11; - SOCKET_TCP_QUICKACK = 12; - } - - required SocketOptionLevel level = 1; - required SocketOptionName option = 2; - required bytes value = 3; -} - - -message SetSocketOptionsRequest { - required string socket_descriptor = 1; - repeated SocketOption options = 2; -} - -message SetSocketOptionsReply { -} - -message GetSocketOptionsRequest { - required string socket_descriptor = 1; - repeated SocketOption options = 2; -} - -message GetSocketOptionsReply { - repeated SocketOption options = 2; -} - - -message ConnectRequest { - required string socket_descriptor = 1; - required AddressPort remote_ip = 2; - optional double timeout_seconds = 3 [default=-1]; -} - -message ConnectReply { - optional AddressPort proxy_external_ip = 1; - - extensions 1000 to max; -} - - -message ListenRequest { - required string socket_descriptor = 1; - required int32 backlog = 2; -} - -message ListenReply { -} - - -message AcceptRequest { - required string socket_descriptor = 1; - optional double timeout_seconds = 2 [default=-1]; -} - -message AcceptReply { - optional bytes new_socket_descriptor = 2; - optional AddressPort remote_address = 3; -} - - - -message ShutDownRequest { - enum How { - SOCKET_SHUT_RD = 1; - SOCKET_SHUT_WR = 2; - SOCKET_SHUT_RDWR = 3; - } - required string socket_descriptor = 1; - required How how = 2; - required int64 send_offset = 3; -} - -message ShutDownReply { -} - - - -message CloseRequest { - required string socket_descriptor = 1; - optional int64 send_offset = 2 [default=-1]; -} - -message CloseReply { -} - - - -message SendRequest { - required string socket_descriptor = 1; - required bytes data = 2 [ctype=CORD]; - required int64 stream_offset = 3; - optional int32 flags = 4 [default=0]; - optional AddressPort send_to = 5; - optional double timeout_seconds = 6 [default=-1]; -} - -message SendReply { - optional int32 data_sent = 1; -} - - -message ReceiveRequest { - enum Flags { - MSG_OOB = 1; - MSG_PEEK = 2; - } - required string socket_descriptor = 1; - required int32 data_size = 2; - optional int32 flags = 3 [default=0]; - optional double timeout_seconds = 5 [default=-1]; -} - -message ReceiveReply { - optional int64 stream_offset = 2; - optional bytes data = 3 [ctype=CORD]; - optional AddressPort received_from = 4; - optional int32 buffer_size = 5; -} - - - -message PollEvent { - - enum PollEventFlag { - SOCKET_POLLNONE = 0; - SOCKET_POLLIN = 1; - SOCKET_POLLPRI = 2; - SOCKET_POLLOUT = 4; - SOCKET_POLLERR = 8; - SOCKET_POLLHUP = 16; - SOCKET_POLLNVAL = 32; - SOCKET_POLLRDNORM = 64; - SOCKET_POLLRDBAND = 128; - SOCKET_POLLWRNORM = 256; - SOCKET_POLLWRBAND = 512; - SOCKET_POLLMSG = 1024; - SOCKET_POLLREMOVE = 4096; - SOCKET_POLLRDHUP = 8192; - }; - - required string socket_descriptor = 1; - required int32 requested_events = 2; - required int32 observed_events = 3; -} - -message PollRequest { - repeated PollEvent events = 1; - optional double timeout_seconds = 2 [default=-1]; -} - -message PollReply { - repeated PollEvent events = 2; -} - -message ResolveRequest { - required string name = 1; - repeated CreateSocketRequest.SocketFamily address_families = 2; -} - -message ResolveReply { - enum ErrorCode { - SOCKET_EAI_ADDRFAMILY = 1; - SOCKET_EAI_AGAIN = 2; - SOCKET_EAI_BADFLAGS = 3; - SOCKET_EAI_FAIL = 4; - SOCKET_EAI_FAMILY = 5; - SOCKET_EAI_MEMORY = 6; - SOCKET_EAI_NODATA = 7; - SOCKET_EAI_NONAME = 8; - SOCKET_EAI_SERVICE = 9; - SOCKET_EAI_SOCKTYPE = 10; - SOCKET_EAI_SYSTEM = 11; - SOCKET_EAI_BADHINTS = 12; - SOCKET_EAI_PROTOCOL = 13; - SOCKET_EAI_OVERFLOW = 14; - SOCKET_EAI_MAX = 15; - }; - - repeated bytes packed_address = 2; - optional string canonical_name = 3; - repeated string aliases = 4; -} diff --git a/vendor/google.golang.org/appengine/socket/doc.go b/vendor/google.golang.org/appengine/socket/doc.go deleted file mode 100644 index 3de46df82..000000000 --- a/vendor/google.golang.org/appengine/socket/doc.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2012 Google Inc. All rights reserved. -// Use of this source code is governed by the Apache 2.0 -// license that can be found in the LICENSE file. - -// Package socket provides outbound network sockets. -// -// This package is only required in the classic App Engine environment. -// Applications running only in App Engine "flexible environment" should -// use the standard library's net package. -package socket diff --git a/vendor/google.golang.org/appengine/socket/socket_classic.go b/vendor/google.golang.org/appengine/socket/socket_classic.go deleted file mode 100644 index 20e594052..000000000 --- a/vendor/google.golang.org/appengine/socket/socket_classic.go +++ /dev/null @@ -1,291 +0,0 @@ -// Copyright 2012 Google Inc. All rights reserved. -// Use of this source code is governed by the Apache 2.0 -// license that can be found in the LICENSE file. - -//go:build appengine -// +build appengine - -package socket - -import ( - "context" - "fmt" - "io" - "net" - "strconv" - "time" - - "github.com/golang/protobuf/proto" - "google.golang.org/appengine/internal" - - pb "google.golang.org/appengine/internal/socket" -) - -// Dial connects to the address addr on the network protocol. -// The address format is host:port, where host may be a hostname or an IP address. -// Known protocols are "tcp" and "udp". -// The returned connection satisfies net.Conn, and is valid while ctx is valid; -// if the connection is to be used after ctx becomes invalid, invoke SetContext -// with the new context. -func Dial(ctx context.Context, protocol, addr string) (*Conn, error) { - return DialTimeout(ctx, protocol, addr, 0) -} - -var ipFamilies = []pb.CreateSocketRequest_SocketFamily{ - pb.CreateSocketRequest_IPv4, - pb.CreateSocketRequest_IPv6, -} - -// DialTimeout is like Dial but takes a timeout. -// The timeout includes name resolution, if required. -func DialTimeout(ctx context.Context, protocol, addr string, timeout time.Duration) (*Conn, error) { - dialCtx := ctx // Used for dialing and name resolution, but not stored in the *Conn. - if timeout > 0 { - var cancel context.CancelFunc - dialCtx, cancel = context.WithTimeout(ctx, timeout) - defer cancel() - } - - host, portStr, err := net.SplitHostPort(addr) - if err != nil { - return nil, err - } - port, err := strconv.Atoi(portStr) - if err != nil { - return nil, fmt.Errorf("socket: bad port %q: %v", portStr, err) - } - - var prot pb.CreateSocketRequest_SocketProtocol - switch protocol { - case "tcp": - prot = pb.CreateSocketRequest_TCP - case "udp": - prot = pb.CreateSocketRequest_UDP - default: - return nil, fmt.Errorf("socket: unknown protocol %q", protocol) - } - - packedAddrs, resolved, err := resolve(dialCtx, ipFamilies, host) - if err != nil { - return nil, fmt.Errorf("socket: failed resolving %q: %v", host, err) - } - if len(packedAddrs) == 0 { - return nil, fmt.Errorf("no addresses for %q", host) - } - - packedAddr := packedAddrs[0] // use first address - fam := pb.CreateSocketRequest_IPv4 - if len(packedAddr) == net.IPv6len { - fam = pb.CreateSocketRequest_IPv6 - } - - req := &pb.CreateSocketRequest{ - Family: fam.Enum(), - Protocol: prot.Enum(), - RemoteIp: &pb.AddressPort{ - Port: proto.Int32(int32(port)), - PackedAddress: packedAddr, - }, - } - if resolved { - req.RemoteIp.HostnameHint = &host - } - res := &pb.CreateSocketReply{} - if err := internal.Call(dialCtx, "remote_socket", "CreateSocket", req, res); err != nil { - return nil, err - } - - return &Conn{ - ctx: ctx, - desc: res.GetSocketDescriptor(), - prot: prot, - local: res.ProxyExternalIp, - remote: req.RemoteIp, - }, nil -} - -// LookupIP returns the given host's IP addresses. -func LookupIP(ctx context.Context, host string) (addrs []net.IP, err error) { - packedAddrs, _, err := resolve(ctx, ipFamilies, host) - if err != nil { - return nil, fmt.Errorf("socket: failed resolving %q: %v", host, err) - } - addrs = make([]net.IP, len(packedAddrs)) - for i, pa := range packedAddrs { - addrs[i] = net.IP(pa) - } - return addrs, nil -} - -func resolve(ctx context.Context, fams []pb.CreateSocketRequest_SocketFamily, host string) ([][]byte, bool, error) { - // Check if it's an IP address. - if ip := net.ParseIP(host); ip != nil { - if ip := ip.To4(); ip != nil { - return [][]byte{ip}, false, nil - } - return [][]byte{ip}, false, nil - } - - req := &pb.ResolveRequest{ - Name: &host, - AddressFamilies: fams, - } - res := &pb.ResolveReply{} - if err := internal.Call(ctx, "remote_socket", "Resolve", req, res); err != nil { - // XXX: need to map to pb.ResolveReply_ErrorCode? - return nil, false, err - } - return res.PackedAddress, true, nil -} - -// withDeadline is like context.WithDeadline, except it ignores the zero deadline. -func withDeadline(parent context.Context, deadline time.Time) (context.Context, context.CancelFunc) { - if deadline.IsZero() { - return parent, func() {} - } - return context.WithDeadline(parent, deadline) -} - -// Conn represents a socket connection. -// It implements net.Conn. -type Conn struct { - ctx context.Context - desc string - offset int64 - - prot pb.CreateSocketRequest_SocketProtocol - local, remote *pb.AddressPort - - readDeadline, writeDeadline time.Time // optional -} - -// SetContext sets the context that is used by this Conn. -// It is usually used only when using a Conn that was created in a different context, -// such as when a connection is created during a warmup request but used while -// servicing a user request. -func (cn *Conn) SetContext(ctx context.Context) { - cn.ctx = ctx -} - -func (cn *Conn) Read(b []byte) (n int, err error) { - const maxRead = 1 << 20 - if len(b) > maxRead { - b = b[:maxRead] - } - - req := &pb.ReceiveRequest{ - SocketDescriptor: &cn.desc, - DataSize: proto.Int32(int32(len(b))), - } - res := &pb.ReceiveReply{} - if !cn.readDeadline.IsZero() { - req.TimeoutSeconds = proto.Float64(cn.readDeadline.Sub(time.Now()).Seconds()) - } - ctx, cancel := withDeadline(cn.ctx, cn.readDeadline) - defer cancel() - if err := internal.Call(ctx, "remote_socket", "Receive", req, res); err != nil { - return 0, err - } - if len(res.Data) == 0 { - return 0, io.EOF - } - if len(res.Data) > len(b) { - return 0, fmt.Errorf("socket: internal error: read too much data: %d > %d", len(res.Data), len(b)) - } - return copy(b, res.Data), nil -} - -func (cn *Conn) Write(b []byte) (n int, err error) { - const lim = 1 << 20 // max per chunk - - for n < len(b) { - chunk := b[n:] - if len(chunk) > lim { - chunk = chunk[:lim] - } - - req := &pb.SendRequest{ - SocketDescriptor: &cn.desc, - Data: chunk, - StreamOffset: &cn.offset, - } - res := &pb.SendReply{} - if !cn.writeDeadline.IsZero() { - req.TimeoutSeconds = proto.Float64(cn.writeDeadline.Sub(time.Now()).Seconds()) - } - ctx, cancel := withDeadline(cn.ctx, cn.writeDeadline) - defer cancel() - if err = internal.Call(ctx, "remote_socket", "Send", req, res); err != nil { - // assume zero bytes were sent in this RPC - break - } - n += int(res.GetDataSent()) - cn.offset += int64(res.GetDataSent()) - } - - return -} - -func (cn *Conn) Close() error { - req := &pb.CloseRequest{ - SocketDescriptor: &cn.desc, - } - res := &pb.CloseReply{} - if err := internal.Call(cn.ctx, "remote_socket", "Close", req, res); err != nil { - return err - } - cn.desc = "CLOSED" - return nil -} - -func addr(prot pb.CreateSocketRequest_SocketProtocol, ap *pb.AddressPort) net.Addr { - if ap == nil { - return nil - } - switch prot { - case pb.CreateSocketRequest_TCP: - return &net.TCPAddr{ - IP: net.IP(ap.PackedAddress), - Port: int(*ap.Port), - } - case pb.CreateSocketRequest_UDP: - return &net.UDPAddr{ - IP: net.IP(ap.PackedAddress), - Port: int(*ap.Port), - } - } - panic("unknown protocol " + prot.String()) -} - -func (cn *Conn) LocalAddr() net.Addr { return addr(cn.prot, cn.local) } -func (cn *Conn) RemoteAddr() net.Addr { return addr(cn.prot, cn.remote) } - -func (cn *Conn) SetDeadline(t time.Time) error { - cn.readDeadline = t - cn.writeDeadline = t - return nil -} - -func (cn *Conn) SetReadDeadline(t time.Time) error { - cn.readDeadline = t - return nil -} - -func (cn *Conn) SetWriteDeadline(t time.Time) error { - cn.writeDeadline = t - return nil -} - -// KeepAlive signals that the connection is still in use. -// It may be called to prevent the socket being closed due to inactivity. -func (cn *Conn) KeepAlive() error { - req := &pb.GetSocketNameRequest{ - SocketDescriptor: &cn.desc, - } - res := &pb.GetSocketNameReply{} - return internal.Call(cn.ctx, "remote_socket", "GetSocketName", req, res) -} - -func init() { - internal.RegisterErrorCodeMap("remote_socket", pb.RemoteSocketServiceError_ErrorCode_name) -} diff --git a/vendor/google.golang.org/appengine/socket/socket_vm.go b/vendor/google.golang.org/appengine/socket/socket_vm.go deleted file mode 100644 index fa0ec8386..000000000 --- a/vendor/google.golang.org/appengine/socket/socket_vm.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2015 Google Inc. All rights reserved. -// Use of this source code is governed by the Apache 2.0 -// license that can be found in the LICENSE file. - -//go:build !appengine -// +build !appengine - -package socket - -import ( - "context" - "net" - "time" -) - -// Dial connects to the address addr on the network protocol. -// The address format is host:port, where host may be a hostname or an IP address. -// Known protocols are "tcp" and "udp". -// The returned connection satisfies net.Conn, and is valid while ctx is valid; -// if the connection is to be used after ctx becomes invalid, invoke SetContext -// with the new context. -func Dial(ctx context.Context, protocol, addr string) (*Conn, error) { - conn, err := net.Dial(protocol, addr) - if err != nil { - return nil, err - } - return &Conn{conn}, nil -} - -// DialTimeout is like Dial but takes a timeout. -// The timeout includes name resolution, if required. -func DialTimeout(ctx context.Context, protocol, addr string, timeout time.Duration) (*Conn, error) { - conn, err := net.DialTimeout(protocol, addr, timeout) - if err != nil { - return nil, err - } - return &Conn{conn}, nil -} - -// LookupIP returns the given host's IP addresses. -func LookupIP(ctx context.Context, host string) (addrs []net.IP, err error) { - return net.LookupIP(host) -} - -// Conn represents a socket connection. -// It implements net.Conn. -type Conn struct { - net.Conn -} - -// SetContext sets the context that is used by this Conn. -// It is usually used only when using a Conn that was created in a different context, -// such as when a connection is created during a warmup request but used while -// servicing a user request. -func (cn *Conn) SetContext(ctx context.Context) { - // This function is not required in App Engine "flexible environment". -} - -// KeepAlive signals that the connection is still in use. -// It may be called to prevent the socket being closed due to inactivity. -func (cn *Conn) KeepAlive() error { - // This function is not required in App Engine "flexible environment". - return nil -} diff --git a/vendor/google.golang.org/grpc/README.md b/vendor/google.golang.org/grpc/README.md index 0e6ae69a5..ab0fbb79b 100644 --- a/vendor/google.golang.org/grpc/README.md +++ b/vendor/google.golang.org/grpc/README.md @@ -1,8 +1,8 @@ # gRPC-Go -[![Build Status](https://travis-ci.org/grpc/grpc-go.svg)](https://travis-ci.org/grpc/grpc-go) [![GoDoc](https://pkg.go.dev/badge/google.golang.org/grpc)][API] [![GoReportCard](https://goreportcard.com/badge/grpc/grpc-go)](https://goreportcard.com/report/github.com/grpc/grpc-go) +[![codecov](https://codecov.io/gh/grpc/grpc-go/graph/badge.svg)](https://codecov.io/gh/grpc/grpc-go) The [Go][] implementation of [gRPC][]: A high performance, open source, general RPC framework that puts mobile and HTTP/2 first. For more information see the @@ -14,21 +14,14 @@ RPC framework that puts mobile and HTTP/2 first. For more information see the ## Installation -With [Go module][] support (Go 1.11+), simply add the following import +Simply add the following import to your code, and then `go [build|run|test]` +will automatically fetch the necessary dependencies: + ```go import "google.golang.org/grpc" ``` -to your code, and then `go [build|run|test]` will automatically fetch the -necessary dependencies. - -Otherwise, to install the `grpc-go` package, run the following command: - -```console -$ go get -u google.golang.org/grpc -``` - > **Note:** If you are trying to access `grpc-go` from **China**, see the > [FAQ](#FAQ) below. @@ -56,15 +49,6 @@ To build Go code, there are several options: - Set up a VPN and access google.golang.org through that. -- Without Go module support: `git clone` the repo manually: - - ```sh - git clone https://github.com/grpc/grpc-go.git $GOPATH/src/google.golang.org/grpc - ``` - - You will need to do the same for all of grpc's dependencies in `golang.org`, - e.g. `golang.org/x/net`. - - With Go module support: it is possible to use the `replace` feature of `go mod` to create aliases for golang.org packages. In your project's directory: @@ -76,33 +60,13 @@ To build Go code, there are several options: ``` Again, this will need to be done for all transitive dependencies hosted on - golang.org as well. For details, refer to [golang/go issue #28652](https://github.com/golang/go/issues/28652). + golang.org as well. For details, refer to [golang/go issue + #28652](https://github.com/golang/go/issues/28652). ### Compiling error, undefined: grpc.SupportPackageIsVersion -#### If you are using Go modules: - -Ensure your gRPC-Go version is `require`d at the appropriate version in -the same module containing the generated `.pb.go` files. For example, -`SupportPackageIsVersion6` needs `v1.27.0`, so in your `go.mod` file: - -```go -module - -require ( - google.golang.org/grpc v1.27.0 -) -``` - -#### If you are *not* using Go modules: - -Update the `proto` package, gRPC package, and rebuild the `.proto` files: - -```sh -go get -u github.com/golang/protobuf/{proto,protoc-gen-go} -go get -u google.golang.org/grpc -protoc --go_out=plugins=grpc:. *.proto -``` +Please update to the latest version of gRPC-Go using +`go get google.golang.org/grpc`. ### How to turn on logging @@ -121,9 +85,11 @@ possible reasons, including: 1. mis-configured transport credentials, connection failed on handshaking 1. bytes disrupted, possibly by a proxy in between 1. server shutdown - 1. Keepalive parameters caused connection shutdown, for example if you have configured - your server to terminate connections regularly to [trigger DNS lookups](https://github.com/grpc/grpc-go/issues/3170#issuecomment-552517779). - If this is the case, you may want to increase your [MaxConnectionAgeGrace](https://pkg.go.dev/google.golang.org/grpc/keepalive?tab=doc#ServerParameters), + 1. Keepalive parameters caused connection shutdown, for example if you have + configured your server to terminate connections regularly to [trigger DNS + lookups](https://github.com/grpc/grpc-go/issues/3170#issuecomment-552517779). + If this is the case, you may want to increase your + [MaxConnectionAgeGrace](https://pkg.go.dev/google.golang.org/grpc/keepalive?tab=doc#ServerParameters), to allow longer RPC calls to finish. It can be tricky to debug this because the error happens on the client side but diff --git a/vendor/google.golang.org/grpc/attributes/attributes.go b/vendor/google.golang.org/grpc/attributes/attributes.go index 49712aca3..52d530d7a 100644 --- a/vendor/google.golang.org/grpc/attributes/attributes.go +++ b/vendor/google.golang.org/grpc/attributes/attributes.go @@ -34,26 +34,26 @@ import ( // key/value pairs. Keys must be hashable, and users should define their own // types for keys. Values should not be modified after they are added to an // Attributes or if they were received from one. If values implement 'Equal(o -// interface{}) bool', it will be called by (*Attributes).Equal to determine -// whether two values with the same key should be considered equal. +// any) bool', it will be called by (*Attributes).Equal to determine whether +// two values with the same key should be considered equal. type Attributes struct { - m map[interface{}]interface{} + m map[any]any } // New returns a new Attributes containing the key/value pair. -func New(key, value interface{}) *Attributes { - return &Attributes{m: map[interface{}]interface{}{key: value}} +func New(key, value any) *Attributes { + return &Attributes{m: map[any]any{key: value}} } // WithValue returns a new Attributes containing the previous keys and values // and the new key/value pair. If the same key appears multiple times, the // last value overwrites all previous values for that key. To remove an // existing key, use a nil value. value should not be modified later. -func (a *Attributes) WithValue(key, value interface{}) *Attributes { +func (a *Attributes) WithValue(key, value any) *Attributes { if a == nil { return New(key, value) } - n := &Attributes{m: make(map[interface{}]interface{}, len(a.m)+1)} + n := &Attributes{m: make(map[any]any, len(a.m)+1)} for k, v := range a.m { n.m[k] = v } @@ -63,20 +63,19 @@ func (a *Attributes) WithValue(key, value interface{}) *Attributes { // Value returns the value associated with these attributes for key, or nil if // no value is associated with key. The returned value should not be modified. -func (a *Attributes) Value(key interface{}) interface{} { +func (a *Attributes) Value(key any) any { if a == nil { return nil } return a.m[key] } -// Equal returns whether a and o are equivalent. If 'Equal(o interface{}) -// bool' is implemented for a value in the attributes, it is called to -// determine if the value matches the one stored in the other attributes. If -// Equal is not implemented, standard equality is used to determine if the two -// values are equal. Note that some types (e.g. maps) aren't comparable by -// default, so they must be wrapped in a struct, or in an alias type, with Equal -// defined. +// Equal returns whether a and o are equivalent. If 'Equal(o any) bool' is +// implemented for a value in the attributes, it is called to determine if the +// value matches the one stored in the other attributes. If Equal is not +// implemented, standard equality is used to determine if the two values are +// equal. Note that some types (e.g. maps) aren't comparable by default, so +// they must be wrapped in a struct, or in an alias type, with Equal defined. func (a *Attributes) Equal(o *Attributes) bool { if a == nil && o == nil { return true @@ -93,7 +92,7 @@ func (a *Attributes) Equal(o *Attributes) bool { // o missing element of a return false } - if eq, ok := v.(interface{ Equal(o interface{}) bool }); ok { + if eq, ok := v.(interface{ Equal(o any) bool }); ok { if !eq.Equal(ov) { return false } @@ -122,9 +121,9 @@ func (a *Attributes) String() string { return sb.String() } -func str(x interface{}) string { +func str(x any) (s string) { if v, ok := x.(fmt.Stringer); ok { - return v.String() + return fmt.Sprint(v) } else if v, ok := x.(string); ok { return v } diff --git a/vendor/google.golang.org/grpc/balancer/balancer.go b/vendor/google.golang.org/grpc/balancer/balancer.go index 8f00523c0..d79560a2e 100644 --- a/vendor/google.golang.org/grpc/balancer/balancer.go +++ b/vendor/google.golang.org/grpc/balancer/balancer.go @@ -30,6 +30,7 @@ import ( "google.golang.org/grpc/channelz" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal" "google.golang.org/grpc/metadata" "google.golang.org/grpc/resolver" @@ -39,6 +40,8 @@ import ( var ( // m is a map from name to balancer builder. m = make(map[string]Builder) + + logger = grpclog.Component("balancer") ) // Register registers the balancer builder to the balancer map. b.Name @@ -51,6 +54,12 @@ var ( // an init() function), and is not thread-safe. If multiple Balancers are // registered with the same name, the one registered last will take effect. func Register(b Builder) { + if strings.ToLower(b.Name()) != b.Name() { + // TODO: Skip the use of strings.ToLower() to index the map after v1.59 + // is released to switch to case sensitive balancer registry. Also, + // remove this warning and update the docstrings for Register and Get. + logger.Warningf("Balancer registered with name %q. grpc-go will be switching to case sensitive balancer registries soon", b.Name()) + } m[strings.ToLower(b.Name())] = b } @@ -70,6 +79,12 @@ func init() { // Note that the compare is done in a case-insensitive fashion. // If no builder is register with the name, nil will be returned. func Get(name string) Builder { + if strings.ToLower(name) != name { + // TODO: Skip the use of strings.ToLower() to index the map after v1.59 + // is released to switch to case sensitive balancer registry. Also, + // remove this warning and update the docstrings for Register and Get. + logger.Warningf("Balancer retrieved for name %q. grpc-go will be switching to case sensitive balancer registries soon", name) + } if b, ok := m[strings.ToLower(name)]; ok { return b } @@ -105,8 +120,8 @@ type SubConn interface { // // This will trigger a state transition for the SubConn. // - // Deprecated: This method is now part of the ClientConn interface and will - // eventually be removed from here. + // Deprecated: this method will be removed. Create new SubConns for new + // addresses instead. UpdateAddresses([]resolver.Address) // Connect starts the connecting for this SubConn. Connect() @@ -115,6 +130,13 @@ type SubConn interface { // creates a new one and returns it. Returns a close function which must // be called when the Producer is no longer needed. GetOrBuildProducer(ProducerBuilder) (p Producer, close func()) + // Shutdown shuts down the SubConn gracefully. Any started RPCs will be + // allowed to complete. No future calls should be made on the SubConn. + // One final state update will be delivered to the StateListener (or + // UpdateSubConnState; deprecated) with ConnectivityState of Shutdown to + // indicate the shutdown operation. This may be delivered before + // in-progress RPCs are complete and the actual connection is closed. + Shutdown() } // NewSubConnOptions contains options to create new SubConn. @@ -129,6 +151,11 @@ type NewSubConnOptions struct { // HealthCheckEnabled indicates whether health check service should be // enabled on this SubConn HealthCheckEnabled bool + // StateListener is called when the state of the subconn changes. If nil, + // Balancer.UpdateSubConnState will be called instead. Will never be + // invoked until after Connect() is called on the SubConn created with + // these options. + StateListener func(SubConnState) } // State contains the balancer's state relevant to the gRPC ClientConn. @@ -150,16 +177,24 @@ type ClientConn interface { // NewSubConn is called by balancer to create a new SubConn. // It doesn't block and wait for the connections to be established. // Behaviors of the SubConn can be controlled by options. + // + // Deprecated: please be aware that in a future version, SubConns will only + // support one address per SubConn. NewSubConn([]resolver.Address, NewSubConnOptions) (SubConn, error) // RemoveSubConn removes the SubConn from ClientConn. // The SubConn will be shutdown. + // + // Deprecated: use SubConn.Shutdown instead. RemoveSubConn(SubConn) // UpdateAddresses updates the addresses used in the passed in SubConn. // gRPC checks if the currently connected address is still in the new list. // If so, the connection will be kept. Else, the connection will be // gracefully closed, and a new connection will be created. // - // This will trigger a state transition for the SubConn. + // This may trigger a state transition for the SubConn. + // + // Deprecated: this method will be removed. Create new SubConns for new + // addresses instead. UpdateAddresses(SubConn, []resolver.Address) // UpdateState notifies gRPC that the balancer's internal state has @@ -250,7 +285,7 @@ type DoneInfo struct { // trailing metadata. // // The only supported type now is *orca_v3.LoadReport. - ServerLoad interface{} + ServerLoad any } var ( @@ -343,9 +378,13 @@ type Balancer interface { ResolverError(error) // UpdateSubConnState is called by gRPC when the state of a SubConn // changes. + // + // Deprecated: Use NewSubConnOptions.StateListener when creating the + // SubConn instead. UpdateSubConnState(SubConn, SubConnState) - // Close closes the balancer. The balancer is not required to call - // ClientConn.RemoveSubConn for its existing SubConns. + // Close closes the balancer. The balancer is not currently required to + // call SubConn.Shutdown for its existing SubConns; however, this will be + // required in a future release, so it is recommended. Close() } @@ -390,15 +429,14 @@ var ErrBadResolverState = errors.New("bad resolver state") type ProducerBuilder interface { // Build creates a Producer. The first parameter is always a // grpc.ClientConnInterface (a type to allow creating RPCs/streams on the - // associated SubConn), but is declared as interface{} to avoid a - // dependency cycle. Should also return a close function that will be - // called when all references to the Producer have been given up. - Build(grpcClientConnInterface interface{}) (p Producer, close func()) + // associated SubConn), but is declared as `any` to avoid a dependency + // cycle. Should also return a close function that will be called when all + // references to the Producer have been given up. + Build(grpcClientConnInterface any) (p Producer, close func()) } // A Producer is a type shared among potentially many consumers. It is // associated with a SubConn, and an implementation will typically contain // other methods to provide additional functionality, e.g. configuration or // subscription registration. -type Producer interface { -} +type Producer any diff --git a/vendor/google.golang.org/grpc/balancer/base/balancer.go b/vendor/google.golang.org/grpc/balancer/base/balancer.go index 3929c26d3..a7f1eeec8 100644 --- a/vendor/google.golang.org/grpc/balancer/base/balancer.go +++ b/vendor/google.golang.org/grpc/balancer/base/balancer.go @@ -105,7 +105,12 @@ func (b *baseBalancer) UpdateClientConnState(s balancer.ClientConnState) error { addrsSet.Set(a, nil) if _, ok := b.subConns.Get(a); !ok { // a is a new address (not existing in b.subConns). - sc, err := b.cc.NewSubConn([]resolver.Address{a}, balancer.NewSubConnOptions{HealthCheckEnabled: b.config.HealthCheck}) + var sc balancer.SubConn + opts := balancer.NewSubConnOptions{ + HealthCheckEnabled: b.config.HealthCheck, + StateListener: func(scs balancer.SubConnState) { b.updateSubConnState(sc, scs) }, + } + sc, err := b.cc.NewSubConn([]resolver.Address{a}, opts) if err != nil { logger.Warningf("base.baseBalancer: failed to create new SubConn: %v", err) continue @@ -121,10 +126,10 @@ func (b *baseBalancer) UpdateClientConnState(s balancer.ClientConnState) error { sc := sci.(balancer.SubConn) // a was removed by resolver. if _, ok := addrsSet.Get(a); !ok { - b.cc.RemoveSubConn(sc) + sc.Shutdown() b.subConns.Delete(a) // Keep the state of this sc in b.scStates until sc's state becomes Shutdown. - // The entry will be deleted in UpdateSubConnState. + // The entry will be deleted in updateSubConnState. } } // If resolver state contains no addresses, return an error so ClientConn @@ -177,7 +182,12 @@ func (b *baseBalancer) regeneratePicker() { b.picker = b.pickerBuilder.Build(PickerBuildInfo{ReadySCs: readySCs}) } +// UpdateSubConnState is a nop because a StateListener is always set in NewSubConn. func (b *baseBalancer) UpdateSubConnState(sc balancer.SubConn, state balancer.SubConnState) { + logger.Errorf("base.baseBalancer: UpdateSubConnState(%v, %+v) called unexpectedly", sc, state) +} + +func (b *baseBalancer) updateSubConnState(sc balancer.SubConn, state balancer.SubConnState) { s := state.ConnectivityState if logger.V(2) { logger.Infof("base.baseBalancer: handle SubConn state change: %p, %v", sc, s) @@ -204,8 +214,8 @@ func (b *baseBalancer) UpdateSubConnState(sc balancer.SubConn, state balancer.Su case connectivity.Idle: sc.Connect() case connectivity.Shutdown: - // When an address was removed by resolver, b called RemoveSubConn but - // kept the sc's state in scStates. Remove state for this sc here. + // When an address was removed by resolver, b called Shutdown but kept + // the sc's state in scStates. Remove state for this sc here. delete(b.scStates, sc) case connectivity.TransientFailure: // Save error to be reported via picker. @@ -226,7 +236,7 @@ func (b *baseBalancer) UpdateSubConnState(sc balancer.SubConn, state balancer.Su } // Close is a nop because base balancer doesn't have internal state to clean up, -// and it doesn't need to call RemoveSubConn for the SubConns. +// and it doesn't need to call Shutdown for the SubConns. func (b *baseBalancer) Close() { } diff --git a/vendor/google.golang.org/grpc/balancer/grpclb/grpc_lb_v1/load_balancer.pb.go b/vendor/google.golang.org/grpc/balancer/grpclb/grpc_lb_v1/load_balancer.pb.go index f070878bd..f35453028 100644 --- a/vendor/google.golang.org/grpc/balancer/grpclb/grpc_lb_v1/load_balancer.pb.go +++ b/vendor/google.golang.org/grpc/balancer/grpclb/grpc_lb_v1/load_balancer.pb.go @@ -19,7 +19,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 +// protoc-gen-go v1.31.0 // protoc v4.22.0 // source: grpc/lb/v1/load_balancer.proto diff --git a/vendor/google.golang.org/grpc/balancer/grpclb/grpclb.go b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb.go index 6d698229a..86ba65be4 100644 --- a/vendor/google.golang.org/grpc/balancer/grpclb/grpclb.go +++ b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb.go @@ -32,14 +32,18 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/balancer" + "google.golang.org/grpc/balancer/base" grpclbstate "google.golang.org/grpc/balancer/grpclb/state" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/credentials" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal" "google.golang.org/grpc/internal/backoff" + internalgrpclog "google.golang.org/grpc/internal/grpclog" + "google.golang.org/grpc/internal/pretty" "google.golang.org/grpc/internal/resolver/dns" "google.golang.org/grpc/resolver" + "google.golang.org/grpc/resolver/manual" durationpb "github.com/golang/protobuf/ptypes/duration" lbpb "google.golang.org/grpc/balancer/grpclb/grpc_lb_v1" @@ -132,7 +136,11 @@ func (b *lbBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) bal // This generates a manual resolver builder with a fixed scheme. This // scheme will be used to dial to remote LB, so we can send filtered // address updates to remote LB ClientConn using this manual resolver. - r := &lbManualResolver{scheme: "grpclb-internal", ccb: cc} + mr := manual.NewBuilderWithScheme("grpclb-internal") + // ResolveNow() on this manual resolver is forwarded to the parent + // ClientConn, so when grpclb client loses contact with the remote balancer, + // the parent ClientConn's resolver will re-resolve. + mr.ResolveNowCallback = cc.ResolveNow lb := &lbBalancer{ cc: newLBCacheClientConn(cc), @@ -142,23 +150,24 @@ func (b *lbBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) bal fallbackTimeout: b.fallbackTimeout, doneCh: make(chan struct{}), - manualResolver: r, + manualResolver: mr, subConns: make(map[resolver.Address]balancer.SubConn), scStates: make(map[balancer.SubConn]connectivity.State), - picker: &errPicker{err: balancer.ErrNoSubConnAvailable}, + picker: base.NewErrPicker(balancer.ErrNoSubConnAvailable), clientStats: newRPCStats(), backoff: backoff.DefaultExponential, // TODO: make backoff configurable. } + lb.logger = internalgrpclog.NewPrefixLogger(logger, fmt.Sprintf("[grpclb %p] ", lb)) var err error if opt.CredsBundle != nil { lb.grpclbClientConnCreds, err = opt.CredsBundle.NewWithMode(internal.CredsBundleModeBalancer) if err != nil { - logger.Warningf("lbBalancer: client connection creds NewWithMode failed: %v", err) + lb.logger.Warningf("Failed to create credentials used for connecting to grpclb: %v", err) } lb.grpclbBackendCreds, err = opt.CredsBundle.NewWithMode(internal.CredsBundleModeBackendFromBalancer) if err != nil { - logger.Warningf("lbBalancer: backend creds NewWithMode failed: %v", err) + lb.logger.Warningf("Failed to create credentials used for connecting to backends returned by grpclb: %v", err) } } @@ -170,6 +179,7 @@ type lbBalancer struct { dialTarget string // user's dial target target string // same as dialTarget unless overridden in service config opt balancer.BuildOptions + logger *internalgrpclog.PrefixLogger usePickFirst bool @@ -188,7 +198,7 @@ type lbBalancer struct { // manualResolver is used in the remote LB ClientConn inside grpclb. When // resolved address updates are received by grpclb, filtered updates will be // send to remote LB ClientConn through this resolver. - manualResolver *lbManualResolver + manualResolver *manual.Resolver // The ClientConn to talk to the remote balancer. ccRemoteLB *remoteBalancerCCWrapper // backoff for calling remote balancer. @@ -213,7 +223,7 @@ type lbBalancer struct { backendAddrsWithoutMetadata []resolver.Address // Roundrobin functionalities. state connectivity.State - subConns map[resolver.Address]balancer.SubConn // Used to new/remove SubConn. + subConns map[resolver.Address]balancer.SubConn // Used to new/shutdown SubConn. scStates map[balancer.SubConn]connectivity.State // Used to filter READY SubConns. picker balancer.Picker // Support fallback to resolved backend addresses if there's no response @@ -236,12 +246,12 @@ type lbBalancer struct { // Caller must hold lb.mu. func (lb *lbBalancer) regeneratePicker(resetDrop bool) { if lb.state == connectivity.TransientFailure { - lb.picker = &errPicker{err: fmt.Errorf("all SubConns are in TransientFailure, last connection error: %v", lb.connErr)} + lb.picker = base.NewErrPicker(fmt.Errorf("all SubConns are in TransientFailure, last connection error: %v", lb.connErr)) return } if lb.state == connectivity.Connecting { - lb.picker = &errPicker{err: balancer.ErrNoSubConnAvailable} + lb.picker = base.NewErrPicker(balancer.ErrNoSubConnAvailable) return } @@ -268,7 +278,7 @@ func (lb *lbBalancer) regeneratePicker(resetDrop bool) { // // This doesn't seem to be necessary after the connecting check above. // Kept for safety. - lb.picker = &errPicker{err: balancer.ErrNoSubConnAvailable} + lb.picker = base.NewErrPicker(balancer.ErrNoSubConnAvailable) return } if lb.inFallback { @@ -290,7 +300,7 @@ func (lb *lbBalancer) regeneratePicker(resetDrop bool) { // aggregateSubConnStats calculate the aggregated state of SubConns in // lb.SubConns. These SubConns are subconns in use (when switching between // fallback and grpclb). lb.scState contains states for all SubConns, including -// those in cache (SubConns are cached for 10 seconds after remove). +// those in cache (SubConns are cached for 10 seconds after shutdown). // // The aggregated state is: // - If at least one SubConn in Ready, the aggregated state is Ready; @@ -319,18 +329,24 @@ func (lb *lbBalancer) aggregateSubConnStates() connectivity.State { return connectivity.TransientFailure } +// UpdateSubConnState is unused; NewSubConn's options always specifies +// updateSubConnState as the listener. func (lb *lbBalancer) UpdateSubConnState(sc balancer.SubConn, scs balancer.SubConnState) { + lb.logger.Errorf("UpdateSubConnState(%v, %+v) called unexpectedly", sc, scs) +} + +func (lb *lbBalancer) updateSubConnState(sc balancer.SubConn, scs balancer.SubConnState) { s := scs.ConnectivityState - if logger.V(2) { - logger.Infof("lbBalancer: handle SubConn state change: %p, %v", sc, s) + if lb.logger.V(2) { + lb.logger.Infof("SubConn state change: %p, %v", sc, s) } lb.mu.Lock() defer lb.mu.Unlock() oldS, ok := lb.scStates[sc] if !ok { - if logger.V(2) { - logger.Infof("lbBalancer: got state changes for an unknown SubConn: %p, %v", sc, s) + if lb.logger.V(2) { + lb.logger.Infof("Received state change for an unknown SubConn: %p, %v", sc, s) } return } @@ -339,8 +355,8 @@ func (lb *lbBalancer) UpdateSubConnState(sc balancer.SubConn, scs balancer.SubCo case connectivity.Idle: sc.Connect() case connectivity.Shutdown: - // When an address was removed by resolver, b called RemoveSubConn but - // kept the sc's state in scStates. Remove state for this sc here. + // When an address was removed by resolver, b called Shutdown but kept + // the sc's state in scStates. Remove state for this sc here. delete(lb.scStates, sc) case connectivity.TransientFailure: lb.connErr = scs.ConnectionError @@ -373,8 +389,13 @@ func (lb *lbBalancer) updateStateAndPicker(forceRegeneratePicker bool, resetDrop if forceRegeneratePicker || (lb.state != oldAggrState) { lb.regeneratePicker(resetDrop) } + var cc balancer.ClientConn = lb.cc + if lb.usePickFirst { + // Bypass the caching layer that would wrap the picker. + cc = lb.cc.ClientConn + } - lb.cc.UpdateState(balancer.State{ConnectivityState: lb.state, Picker: lb.picker}) + cc.UpdateState(balancer.State{ConnectivityState: lb.state, Picker: lb.picker}) } // fallbackToBackendsAfter blocks for fallbackTimeout and falls back to use @@ -430,8 +451,8 @@ func (lb *lbBalancer) handleServiceConfig(gc *grpclbServiceConfig) { if lb.usePickFirst == newUsePickFirst { return } - if logger.V(2) { - logger.Infof("lbBalancer: switching mode, new usePickFirst: %+v", newUsePickFirst) + if lb.logger.V(2) { + lb.logger.Infof("Switching mode. Is pick_first used for backends? %v", newUsePickFirst) } lb.refreshSubConns(lb.backendAddrs, lb.inFallback, newUsePickFirst) } @@ -442,23 +463,15 @@ func (lb *lbBalancer) ResolverError(error) { } func (lb *lbBalancer) UpdateClientConnState(ccs balancer.ClientConnState) error { - if logger.V(2) { - logger.Infof("lbBalancer: UpdateClientConnState: %+v", ccs) + if lb.logger.V(2) { + lb.logger.Infof("UpdateClientConnState: %s", pretty.ToJSON(ccs)) } gc, _ := ccs.BalancerConfig.(*grpclbServiceConfig) lb.handleServiceConfig(gc) - addrs := ccs.ResolverState.Addresses + backendAddrs := ccs.ResolverState.Addresses - var remoteBalancerAddrs, backendAddrs []resolver.Address - for _, a := range addrs { - if a.Type == resolver.GRPCLB { - a.Type = resolver.Backend - remoteBalancerAddrs = append(remoteBalancerAddrs, a) - } else { - backendAddrs = append(backendAddrs, a) - } - } + var remoteBalancerAddrs []resolver.Address if sd := grpclbstate.Get(ccs.ResolverState); sd != nil { // Override any balancer addresses provided via // ccs.ResolverState.Addresses. @@ -479,7 +492,9 @@ func (lb *lbBalancer) UpdateClientConnState(ccs balancer.ClientConnState) error } else if lb.ccRemoteLB == nil { // First time receiving resolved addresses, create a cc to remote // balancers. - lb.newRemoteBalancerCCWrapper() + if err := lb.newRemoteBalancerCCWrapper(); err != nil { + return err + } // Start the fallback goroutine. go lb.fallbackToBackendsAfter(lb.fallbackTimeout) } diff --git a/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_picker.go b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_picker.go index 39bc5cc71..20c5f2ec3 100644 --- a/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_picker.go +++ b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_picker.go @@ -98,15 +98,6 @@ func (s *rpcStats) knownReceived() { atomic.AddInt64(&s.numCallsFinished, 1) } -type errPicker struct { - // Pick always returns this err. - err error -} - -func (p *errPicker) Pick(balancer.PickInfo) (balancer.PickResult, error) { - return balancer.PickResult{}, p.err -} - // rrPicker does roundrobin on subConns. It's typically used when there's no // response from remote balancer, and grpclb falls back to the resolved // backends. diff --git a/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_remote_balancer.go b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_remote_balancer.go index e56006d71..c8fe1edd8 100644 --- a/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_remote_balancer.go +++ b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_remote_balancer.go @@ -27,11 +27,8 @@ import ( "time" "github.com/golang/protobuf/proto" - timestamppb "github.com/golang/protobuf/ptypes/timestamp" - "github.com/google/go-cmp/cmp" "google.golang.org/grpc" "google.golang.org/grpc/balancer" - lbpb "google.golang.org/grpc/balancer/grpclb/grpc_lb_v1" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/internal/backoff" @@ -39,13 +36,28 @@ import ( "google.golang.org/grpc/keepalive" "google.golang.org/grpc/metadata" "google.golang.org/grpc/resolver" + + timestamppb "github.com/golang/protobuf/ptypes/timestamp" + lbpb "google.golang.org/grpc/balancer/grpclb/grpc_lb_v1" ) +func serverListEqual(a, b []*lbpb.Server) bool { + if len(a) != len(b) { + return false + } + for i := 0; i < len(a); i++ { + if !proto.Equal(a[i], b[i]) { + return false + } + } + return true +} + // processServerList updates balancer's internal state, create/remove SubConns // and regenerates picker using the received serverList. func (lb *lbBalancer) processServerList(l *lbpb.ServerList) { - if logger.V(2) { - logger.Infof("lbBalancer: processing server list: %+v", l) + if lb.logger.V(2) { + lb.logger.Infof("Processing server list: %#v", l) } lb.mu.Lock() defer lb.mu.Unlock() @@ -55,9 +67,9 @@ func (lb *lbBalancer) processServerList(l *lbpb.ServerList) { lb.serverListReceived = true // If the new server list == old server list, do nothing. - if cmp.Equal(lb.fullServerList, l.Servers, cmp.Comparer(proto.Equal)) { - if logger.V(2) { - logger.Infof("lbBalancer: new serverlist same as the previous one, ignoring") + if serverListEqual(lb.fullServerList, l.Servers) { + if lb.logger.V(2) { + lb.logger.Infof("Ignoring new server list as it is the same as the previous one") } return } @@ -78,9 +90,8 @@ func (lb *lbBalancer) processServerList(l *lbpb.ServerList) { ipStr = fmt.Sprintf("[%s]", ipStr) } addr := imetadata.Set(resolver.Address{Addr: fmt.Sprintf("%s:%d", ipStr, s.Port)}, md) - if logger.V(2) { - logger.Infof("lbBalancer: server list entry[%d]: ipStr:|%s|, port:|%d|, load balancer token:|%v|", - i, ipStr, s.Port, s.LoadBalanceToken) + if lb.logger.V(2) { + lb.logger.Infof("Server list entry:|%d|, ipStr:|%s|, port:|%d|, load balancer token:|%v|", i, ipStr, s.Port, s.LoadBalanceToken) } backendAddrs = append(backendAddrs, addr) } @@ -113,7 +124,6 @@ func (lb *lbBalancer) refreshSubConns(backendAddrs []resolver.Address, fallback } balancingPolicyChanged := lb.usePickFirst != pickFirst - oldUsePickFirst := lb.usePickFirst lb.usePickFirst = pickFirst if fallbackModeChanged || balancingPolicyChanged { @@ -123,13 +133,7 @@ func (lb *lbBalancer) refreshSubConns(backendAddrs []resolver.Address, fallback // For fallback mode switching with pickfirst, we want to recreate the // SubConn because the creds could be different. for a, sc := range lb.subConns { - if oldUsePickFirst { - // If old SubConn were created for pickfirst, bypass cache and - // remove directly. - lb.cc.cc.RemoveSubConn(sc) - } else { - lb.cc.RemoveSubConn(sc) - } + sc.Shutdown() delete(lb.subConns, a) } } @@ -144,18 +148,19 @@ func (lb *lbBalancer) refreshSubConns(backendAddrs []resolver.Address, fallback } if sc != nil { if len(backendAddrs) == 0 { - lb.cc.cc.RemoveSubConn(sc) + sc.Shutdown() delete(lb.subConns, scKey) return } - lb.cc.cc.UpdateAddresses(sc, backendAddrs) + lb.cc.ClientConn.UpdateAddresses(sc, backendAddrs) sc.Connect() return } + opts.StateListener = func(scs balancer.SubConnState) { lb.updateSubConnState(sc, scs) } // This bypasses the cc wrapper with SubConn cache. - sc, err := lb.cc.cc.NewSubConn(backendAddrs, opts) + sc, err := lb.cc.ClientConn.NewSubConn(backendAddrs, opts) if err != nil { - logger.Warningf("grpclb: failed to create new SubConn: %v", err) + lb.logger.Warningf("Failed to create new SubConn: %v", err) return } sc.Connect() @@ -176,9 +181,11 @@ func (lb *lbBalancer) refreshSubConns(backendAddrs []resolver.Address, fallback if _, ok := lb.subConns[addrWithoutAttrs]; !ok { // Use addrWithMD to create the SubConn. + var sc balancer.SubConn + opts.StateListener = func(scs balancer.SubConnState) { lb.updateSubConnState(sc, scs) } sc, err := lb.cc.NewSubConn([]resolver.Address{addr}, opts) if err != nil { - logger.Warningf("grpclb: failed to create new SubConn: %v", err) + lb.logger.Warningf("Failed to create new SubConn: %v", err) continue } lb.subConns[addrWithoutAttrs] = sc // Use the addr without MD as key for the map. @@ -194,7 +201,7 @@ func (lb *lbBalancer) refreshSubConns(backendAddrs []resolver.Address, fallback for a, sc := range lb.subConns { // a was removed by resolver. if _, ok := addrsSet[a]; !ok { - lb.cc.RemoveSubConn(sc) + sc.Shutdown() delete(lb.subConns, a) // Keep the state of this sc in b.scStates until sc's state becomes Shutdown. // The entry will be deleted in UpdateSubConnState. @@ -221,7 +228,7 @@ type remoteBalancerCCWrapper struct { wg sync.WaitGroup } -func (lb *lbBalancer) newRemoteBalancerCCWrapper() { +func (lb *lbBalancer) newRemoteBalancerCCWrapper() error { var dopts []grpc.DialOption if creds := lb.opt.DialCreds; creds != nil { dopts = append(dopts, grpc.WithTransportCredentials(creds)) @@ -252,9 +259,10 @@ func (lb *lbBalancer) newRemoteBalancerCCWrapper() { // // The grpclb server addresses will set field ServerName, and creds will // receive ServerName as authority. - cc, err := grpc.DialContext(context.Background(), lb.manualResolver.Scheme()+":///grpclb.subClientConn", dopts...) + target := lb.manualResolver.Scheme() + ":///grpclb.subClientConn" + cc, err := grpc.Dial(target, dopts...) if err != nil { - logger.Fatalf("failed to dial: %v", err) + return fmt.Errorf("grpc.Dial(%s): %v", target, err) } ccw := &remoteBalancerCCWrapper{ cc: cc, @@ -265,6 +273,7 @@ func (lb *lbBalancer) newRemoteBalancerCCWrapper() { lb.ccRemoteLB = ccw ccw.wg.Add(1) go ccw.watchRemoteBalancer() + return nil } // close closed the ClientConn to remote balancer, and waits until all @@ -412,14 +421,14 @@ func (ccw *remoteBalancerCCWrapper) watchRemoteBalancer() { default: if err != nil { if err == errServerTerminatedConnection { - logger.Info(err) + ccw.lb.logger.Infof("Call to remote balancer failed: %v", err) } else { - logger.Warning(err) + ccw.lb.logger.Warningf("Call to remote balancer failed: %v", err) } } } // Trigger a re-resolve when the stream errors. - ccw.lb.cc.cc.ResolveNow(resolver.ResolveNowOptions{}) + ccw.lb.cc.ClientConn.ResolveNow(resolver.ResolveNowOptions{}) ccw.lb.mu.Lock() ccw.lb.remoteBalancerConnected = false diff --git a/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_util.go b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_util.go index 373f04b98..c0f762c0c 100644 --- a/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_util.go +++ b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_util.go @@ -27,75 +27,15 @@ import ( "google.golang.org/grpc/resolver" ) -// The parent ClientConn should re-resolve when grpclb loses connection to the -// remote balancer. When the ClientConn inside grpclb gets a TransientFailure, -// it calls lbManualResolver.ResolveNow(), which calls parent ClientConn's -// ResolveNow, and eventually results in re-resolve happening in parent -// ClientConn's resolver (DNS for example). -// -// parent -// ClientConn -// +-----------------------------------------------------------------+ -// | parent +---------------------------------+ | -// | DNS ClientConn | grpclb | | -// | resolver balancerWrapper | | | -// | + + | grpclb grpclb | | -// | | | | ManualResolver ClientConn | | -// | | | | + + | | -// | | | | | | Transient | | -// | | | | | | Failure | | -// | | | | | <--------- | | | -// | | | <--------------- | ResolveNow | | | -// | | <--------- | ResolveNow | | | | | -// | | ResolveNow | | | | | | -// | | | | | | | | -// | + + | + + | | -// | +---------------------------------+ | -// +-----------------------------------------------------------------+ - -// lbManualResolver is used by the ClientConn inside grpclb. It's a manual -// resolver with a special ResolveNow() function. -// -// When ResolveNow() is called, it calls ResolveNow() on the parent ClientConn, -// so when grpclb client lose contact with remote balancers, the parent -// ClientConn's resolver will re-resolve. -type lbManualResolver struct { - scheme string - ccr resolver.ClientConn - - ccb balancer.ClientConn -} - -func (r *lbManualResolver) Build(_ resolver.Target, cc resolver.ClientConn, _ resolver.BuildOptions) (resolver.Resolver, error) { - r.ccr = cc - return r, nil -} - -func (r *lbManualResolver) Scheme() string { - return r.scheme -} - -// ResolveNow calls resolveNow on the parent ClientConn. -func (r *lbManualResolver) ResolveNow(o resolver.ResolveNowOptions) { - r.ccb.ResolveNow(o) -} - -// Close is a noop for Resolver. -func (*lbManualResolver) Close() {} - -// UpdateState calls cc.UpdateState. -func (r *lbManualResolver) UpdateState(s resolver.State) { - r.ccr.UpdateState(s) -} - const subConnCacheTime = time.Second * 10 // lbCacheClientConn is a wrapper balancer.ClientConn with a SubConn cache. -// SubConns will be kept in cache for subConnCacheTime before being removed. +// SubConns will be kept in cache for subConnCacheTime before being shut down. // -// Its new and remove methods are updated to do cache first. +// Its NewSubconn and SubConn.Shutdown methods are updated to do cache first. type lbCacheClientConn struct { - cc balancer.ClientConn + balancer.ClientConn + timeout time.Duration mu sync.Mutex @@ -113,7 +53,7 @@ type subConnCacheEntry struct { func newLBCacheClientConn(cc balancer.ClientConn) *lbCacheClientConn { return &lbCacheClientConn{ - cc: cc, + ClientConn: cc, timeout: subConnCacheTime, subConnCache: make(map[resolver.Address]*subConnCacheEntry), subConnToAddr: make(map[balancer.SubConn]resolver.Address), @@ -137,16 +77,27 @@ func (ccc *lbCacheClientConn) NewSubConn(addrs []resolver.Address, opts balancer return entry.sc, nil } - scNew, err := ccc.cc.NewSubConn(addrs, opts) + scNew, err := ccc.ClientConn.NewSubConn(addrs, opts) if err != nil { return nil, err } + scNew = &lbCacheSubConn{SubConn: scNew, ccc: ccc} ccc.subConnToAddr[scNew] = addrWithoutAttrs return scNew, nil } func (ccc *lbCacheClientConn) RemoveSubConn(sc balancer.SubConn) { + logger.Errorf("RemoveSubConn(%v) called unexpectedly", sc) +} + +type lbCacheSubConn struct { + balancer.SubConn + ccc *lbCacheClientConn +} + +func (sc *lbCacheSubConn) Shutdown() { + ccc := sc.ccc ccc.mu.Lock() defer ccc.mu.Unlock() addr, ok := ccc.subConnToAddr[sc] @@ -156,11 +107,11 @@ func (ccc *lbCacheClientConn) RemoveSubConn(sc balancer.SubConn) { if entry, ok := ccc.subConnCache[addr]; ok { if entry.sc != sc { - // This could happen if NewSubConn was called multiple times for the - // same address, and those SubConns are all removed. We remove sc - // immediately here. + // This could happen if NewSubConn was called multiple times for + // the same address, and those SubConns are all shut down. We + // remove sc immediately here. delete(ccc.subConnToAddr, sc) - ccc.cc.RemoveSubConn(sc) + sc.SubConn.Shutdown() } return } @@ -176,7 +127,7 @@ func (ccc *lbCacheClientConn) RemoveSubConn(sc balancer.SubConn) { if entry.abortDeleting { return } - ccc.cc.RemoveSubConn(sc) + sc.SubConn.Shutdown() delete(ccc.subConnToAddr, sc) delete(ccc.subConnCache, addr) }) @@ -195,14 +146,28 @@ func (ccc *lbCacheClientConn) RemoveSubConn(sc balancer.SubConn) { } func (ccc *lbCacheClientConn) UpdateState(s balancer.State) { - ccc.cc.UpdateState(s) + s.Picker = &lbCachePicker{Picker: s.Picker} + ccc.ClientConn.UpdateState(s) } func (ccc *lbCacheClientConn) close() { ccc.mu.Lock() - // Only cancel all existing timers. There's no need to remove SubConns. + defer ccc.mu.Unlock() + // Only cancel all existing timers. There's no need to shut down SubConns. for _, entry := range ccc.subConnCache { entry.cancel() } - ccc.mu.Unlock() +} + +type lbCachePicker struct { + balancer.Picker +} + +func (cp *lbCachePicker) Pick(i balancer.PickInfo) (balancer.PickResult, error) { + res, err := cp.Picker.Pick(i) + if err != nil { + return res, err + } + res.SubConn = res.SubConn.(*lbCacheSubConn).SubConn + return res, nil } diff --git a/vendor/google.golang.org/grpc/balancer_conn_wrappers.go b/vendor/google.golang.org/grpc/balancer_conn_wrappers.go deleted file mode 100644 index 04b9ad411..000000000 --- a/vendor/google.golang.org/grpc/balancer_conn_wrappers.go +++ /dev/null @@ -1,459 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package grpc - -import ( - "context" - "fmt" - "strings" - "sync" - - "google.golang.org/grpc/balancer" - "google.golang.org/grpc/connectivity" - "google.golang.org/grpc/internal/balancer/gracefulswitch" - "google.golang.org/grpc/internal/channelz" - "google.golang.org/grpc/internal/grpcsync" - "google.golang.org/grpc/resolver" -) - -type ccbMode int - -const ( - ccbModeActive = iota - ccbModeIdle - ccbModeClosed - ccbModeExitingIdle -) - -// ccBalancerWrapper sits between the ClientConn and the Balancer. -// -// ccBalancerWrapper implements methods corresponding to the ones on the -// balancer.Balancer interface. The ClientConn is free to call these methods -// concurrently and the ccBalancerWrapper ensures that calls from the ClientConn -// to the Balancer happen synchronously and in order. -// -// ccBalancerWrapper also implements the balancer.ClientConn interface and is -// passed to the Balancer implementations. It invokes unexported methods on the -// ClientConn to handle these calls from the Balancer. -// -// It uses the gracefulswitch.Balancer internally to ensure that balancer -// switches happen in a graceful manner. -type ccBalancerWrapper struct { - // The following fields are initialized when the wrapper is created and are - // read-only afterwards, and therefore can be accessed without a mutex. - cc *ClientConn - opts balancer.BuildOptions - - // Outgoing (gRPC --> balancer) calls are guaranteed to execute in a - // mutually exclusive manner as they are scheduled in the serializer. Fields - // accessed *only* in these serializer callbacks, can therefore be accessed - // without a mutex. - balancer *gracefulswitch.Balancer - curBalancerName string - - // mu guards access to the below fields. Access to the serializer and its - // cancel function needs to be mutex protected because they are overwritten - // when the wrapper exits idle mode. - mu sync.Mutex - serializer *grpcsync.CallbackSerializer // To serialize all outoing calls. - serializerCancel context.CancelFunc // To close the seralizer at close/enterIdle time. - mode ccbMode // Tracks the current mode of the wrapper. -} - -// newCCBalancerWrapper creates a new balancer wrapper. The underlying balancer -// is not created until the switchTo() method is invoked. -func newCCBalancerWrapper(cc *ClientConn, bopts balancer.BuildOptions) *ccBalancerWrapper { - ctx, cancel := context.WithCancel(context.Background()) - ccb := &ccBalancerWrapper{ - cc: cc, - opts: bopts, - serializer: grpcsync.NewCallbackSerializer(ctx), - serializerCancel: cancel, - } - ccb.balancer = gracefulswitch.NewBalancer(ccb, bopts) - return ccb -} - -// updateClientConnState is invoked by grpc to push a ClientConnState update to -// the underlying balancer. -func (ccb *ccBalancerWrapper) updateClientConnState(ccs *balancer.ClientConnState) error { - ccb.mu.Lock() - errCh := make(chan error, 1) - // Here and everywhere else where Schedule() is called, it is done with the - // lock held. But the lock guards only the scheduling part. The actual - // callback is called asynchronously without the lock being held. - ok := ccb.serializer.Schedule(func(_ context.Context) { - // If the addresses specified in the update contain addresses of type - // "grpclb" and the selected LB policy is not "grpclb", these addresses - // will be filtered out and ccs will be modified with the updated - // address list. - if ccb.curBalancerName != grpclbName { - var addrs []resolver.Address - for _, addr := range ccs.ResolverState.Addresses { - if addr.Type == resolver.GRPCLB { - continue - } - addrs = append(addrs, addr) - } - ccs.ResolverState.Addresses = addrs - } - errCh <- ccb.balancer.UpdateClientConnState(*ccs) - }) - if !ok { - // If we are unable to schedule a function with the serializer, it - // indicates that it has been closed. A serializer is only closed when - // the wrapper is closed or is in idle. - ccb.mu.Unlock() - return fmt.Errorf("grpc: cannot send state update to a closed or idle balancer") - } - ccb.mu.Unlock() - - // We get here only if the above call to Schedule succeeds, in which case it - // is guaranteed that the scheduled function will run. Therefore it is safe - // to block on this channel. - err := <-errCh - if logger.V(2) && err != nil { - logger.Infof("error from balancer.UpdateClientConnState: %v", err) - } - return err -} - -// updateSubConnState is invoked by grpc to push a subConn state update to the -// underlying balancer. -func (ccb *ccBalancerWrapper) updateSubConnState(sc balancer.SubConn, s connectivity.State, err error) { - ccb.mu.Lock() - ccb.serializer.Schedule(func(_ context.Context) { - ccb.balancer.UpdateSubConnState(sc, balancer.SubConnState{ConnectivityState: s, ConnectionError: err}) - }) - ccb.mu.Unlock() -} - -func (ccb *ccBalancerWrapper) resolverError(err error) { - ccb.mu.Lock() - ccb.serializer.Schedule(func(_ context.Context) { - ccb.balancer.ResolverError(err) - }) - ccb.mu.Unlock() -} - -// switchTo is invoked by grpc to instruct the balancer wrapper to switch to the -// LB policy identified by name. -// -// ClientConn calls newCCBalancerWrapper() at creation time. Upon receipt of the -// first good update from the name resolver, it determines the LB policy to use -// and invokes the switchTo() method. Upon receipt of every subsequent update -// from the name resolver, it invokes this method. -// -// the ccBalancerWrapper keeps track of the current LB policy name, and skips -// the graceful balancer switching process if the name does not change. -func (ccb *ccBalancerWrapper) switchTo(name string) { - ccb.mu.Lock() - ccb.serializer.Schedule(func(_ context.Context) { - // TODO: Other languages use case-sensitive balancer registries. We should - // switch as well. See: https://github.com/grpc/grpc-go/issues/5288. - if strings.EqualFold(ccb.curBalancerName, name) { - return - } - ccb.buildLoadBalancingPolicy(name) - }) - ccb.mu.Unlock() -} - -// buildLoadBalancingPolicy performs the following: -// - retrieve a balancer builder for the given name. Use the default LB -// policy, pick_first, if no LB policy with name is found in the registry. -// - instruct the gracefulswitch balancer to switch to the above builder. This -// will actually build the new balancer. -// - update the `curBalancerName` field -// -// Must be called from a serializer callback. -func (ccb *ccBalancerWrapper) buildLoadBalancingPolicy(name string) { - builder := balancer.Get(name) - if builder == nil { - channelz.Warningf(logger, ccb.cc.channelzID, "Channel switches to new LB policy %q, since the specified LB policy %q was not registered", PickFirstBalancerName, name) - builder = newPickfirstBuilder() - } else { - channelz.Infof(logger, ccb.cc.channelzID, "Channel switches to new LB policy %q", name) - } - - if err := ccb.balancer.SwitchTo(builder); err != nil { - channelz.Errorf(logger, ccb.cc.channelzID, "Channel failed to build new LB policy %q: %v", name, err) - return - } - ccb.curBalancerName = builder.Name() -} - -func (ccb *ccBalancerWrapper) close() { - channelz.Info(logger, ccb.cc.channelzID, "ccBalancerWrapper: closing") - ccb.closeBalancer(ccbModeClosed) -} - -// enterIdleMode is invoked by grpc when the channel enters idle mode upon -// expiry of idle_timeout. This call blocks until the balancer is closed. -func (ccb *ccBalancerWrapper) enterIdleMode() { - channelz.Info(logger, ccb.cc.channelzID, "ccBalancerWrapper: entering idle mode") - ccb.closeBalancer(ccbModeIdle) -} - -// closeBalancer is invoked when the channel is being closed or when it enters -// idle mode upon expiry of idle_timeout. -func (ccb *ccBalancerWrapper) closeBalancer(m ccbMode) { - ccb.mu.Lock() - if ccb.mode == ccbModeClosed || ccb.mode == ccbModeIdle { - ccb.mu.Unlock() - return - } - - ccb.mode = m - done := ccb.serializer.Done - b := ccb.balancer - ok := ccb.serializer.Schedule(func(_ context.Context) { - // Close the serializer to ensure that no more calls from gRPC are sent - // to the balancer. - ccb.serializerCancel() - // Empty the current balancer name because we don't have a balancer - // anymore and also so that we act on the next call to switchTo by - // creating a new balancer specified by the new resolver. - ccb.curBalancerName = "" - }) - if !ok { - ccb.mu.Unlock() - return - } - ccb.mu.Unlock() - - // Give enqueued callbacks a chance to finish. - <-done - // Spawn a goroutine to close the balancer (since it may block trying to - // cleanup all allocated resources) and return early. - go b.Close() -} - -// exitIdleMode is invoked by grpc when the channel exits idle mode either -// because of an RPC or because of an invocation of the Connect() API. This -// recreates the balancer that was closed previously when entering idle mode. -// -// If the channel is not in idle mode, we know for a fact that we are here as a -// result of the user calling the Connect() method on the ClientConn. In this -// case, we can simply forward the call to the underlying balancer, instructing -// it to reconnect to the backends. -func (ccb *ccBalancerWrapper) exitIdleMode() { - ccb.mu.Lock() - if ccb.mode == ccbModeClosed { - // Request to exit idle is a no-op when wrapper is already closed. - ccb.mu.Unlock() - return - } - - if ccb.mode == ccbModeIdle { - // Recreate the serializer which was closed when we entered idle. - ctx, cancel := context.WithCancel(context.Background()) - ccb.serializer = grpcsync.NewCallbackSerializer(ctx) - ccb.serializerCancel = cancel - } - - // The ClientConn guarantees that mutual exclusion between close() and - // exitIdleMode(), and since we just created a new serializer, we can be - // sure that the below function will be scheduled. - done := make(chan struct{}) - ccb.serializer.Schedule(func(_ context.Context) { - defer close(done) - - ccb.mu.Lock() - defer ccb.mu.Unlock() - - if ccb.mode != ccbModeIdle { - ccb.balancer.ExitIdle() - return - } - - // Gracefulswitch balancer does not support a switchTo operation after - // being closed. Hence we need to create a new one here. - ccb.balancer = gracefulswitch.NewBalancer(ccb, ccb.opts) - ccb.mode = ccbModeActive - channelz.Info(logger, ccb.cc.channelzID, "ccBalancerWrapper: exiting idle mode") - - }) - ccb.mu.Unlock() - - <-done -} - -func (ccb *ccBalancerWrapper) isIdleOrClosed() bool { - ccb.mu.Lock() - defer ccb.mu.Unlock() - return ccb.mode == ccbModeIdle || ccb.mode == ccbModeClosed -} - -func (ccb *ccBalancerWrapper) NewSubConn(addrs []resolver.Address, opts balancer.NewSubConnOptions) (balancer.SubConn, error) { - if ccb.isIdleOrClosed() { - return nil, fmt.Errorf("grpc: cannot create SubConn when balancer is closed or idle") - } - - if len(addrs) == 0 { - return nil, fmt.Errorf("grpc: cannot create SubConn with empty address list") - } - ac, err := ccb.cc.newAddrConn(addrs, opts) - if err != nil { - channelz.Warningf(logger, ccb.cc.channelzID, "acBalancerWrapper: NewSubConn: failed to newAddrConn: %v", err) - return nil, err - } - acbw := &acBalancerWrapper{ac: ac, producers: make(map[balancer.ProducerBuilder]*refCountedProducer)} - ac.acbw = acbw - return acbw, nil -} - -func (ccb *ccBalancerWrapper) RemoveSubConn(sc balancer.SubConn) { - if ccb.isIdleOrClosed() { - // It it safe to ignore this call when the balancer is closed or in idle - // because the ClientConn takes care of closing the connections. - // - // Not returning early from here when the balancer is closed or in idle - // leads to a deadlock though, because of the following sequence of - // calls when holding cc.mu: - // cc.exitIdleMode --> ccb.enterIdleMode --> gsw.Close --> - // ccb.RemoveAddrConn --> cc.removeAddrConn - return - } - - acbw, ok := sc.(*acBalancerWrapper) - if !ok { - return - } - ccb.cc.removeAddrConn(acbw.ac, errConnDrain) -} - -func (ccb *ccBalancerWrapper) UpdateAddresses(sc balancer.SubConn, addrs []resolver.Address) { - if ccb.isIdleOrClosed() { - return - } - - acbw, ok := sc.(*acBalancerWrapper) - if !ok { - return - } - acbw.UpdateAddresses(addrs) -} - -func (ccb *ccBalancerWrapper) UpdateState(s balancer.State) { - if ccb.isIdleOrClosed() { - return - } - - // Update picker before updating state. Even though the ordering here does - // not matter, it can lead to multiple calls of Pick in the common start-up - // case where we wait for ready and then perform an RPC. If the picker is - // updated later, we could call the "connecting" picker when the state is - // updated, and then call the "ready" picker after the picker gets updated. - ccb.cc.blockingpicker.updatePicker(s.Picker) - ccb.cc.csMgr.updateState(s.ConnectivityState) -} - -func (ccb *ccBalancerWrapper) ResolveNow(o resolver.ResolveNowOptions) { - if ccb.isIdleOrClosed() { - return - } - - ccb.cc.resolveNow(o) -} - -func (ccb *ccBalancerWrapper) Target() string { - return ccb.cc.target -} - -// acBalancerWrapper is a wrapper on top of ac for balancers. -// It implements balancer.SubConn interface. -type acBalancerWrapper struct { - ac *addrConn // read-only - - mu sync.Mutex - producers map[balancer.ProducerBuilder]*refCountedProducer -} - -func (acbw *acBalancerWrapper) String() string { - return fmt.Sprintf("SubConn(id:%d)", acbw.ac.channelzID.Int()) -} - -func (acbw *acBalancerWrapper) UpdateAddresses(addrs []resolver.Address) { - acbw.ac.updateAddrs(addrs) -} - -func (acbw *acBalancerWrapper) Connect() { - go acbw.ac.connect() -} - -// NewStream begins a streaming RPC on the addrConn. If the addrConn is not -// ready, blocks until it is or ctx expires. Returns an error when the context -// expires or the addrConn is shut down. -func (acbw *acBalancerWrapper) NewStream(ctx context.Context, desc *StreamDesc, method string, opts ...CallOption) (ClientStream, error) { - transport, err := acbw.ac.getTransport(ctx) - if err != nil { - return nil, err - } - return newNonRetryClientStream(ctx, desc, method, transport, acbw.ac, opts...) -} - -// Invoke performs a unary RPC. If the addrConn is not ready, returns -// errSubConnNotReady. -func (acbw *acBalancerWrapper) Invoke(ctx context.Context, method string, args interface{}, reply interface{}, opts ...CallOption) error { - cs, err := acbw.NewStream(ctx, unaryStreamDesc, method, opts...) - if err != nil { - return err - } - if err := cs.SendMsg(args); err != nil { - return err - } - return cs.RecvMsg(reply) -} - -type refCountedProducer struct { - producer balancer.Producer - refs int // number of current refs to the producer - close func() // underlying producer's close function -} - -func (acbw *acBalancerWrapper) GetOrBuildProducer(pb balancer.ProducerBuilder) (balancer.Producer, func()) { - acbw.mu.Lock() - defer acbw.mu.Unlock() - - // Look up existing producer from this builder. - pData := acbw.producers[pb] - if pData == nil { - // Not found; create a new one and add it to the producers map. - p, close := pb.Build(acbw) - pData = &refCountedProducer{producer: p, close: close} - acbw.producers[pb] = pData - } - // Account for this new reference. - pData.refs++ - - // Return a cleanup function wrapped in a OnceFunc to remove this reference - // and delete the refCountedProducer from the map if the total reference - // count goes to zero. - unref := func() { - acbw.mu.Lock() - pData.refs-- - if pData.refs == 0 { - defer pData.close() // Run outside the acbw mutex - delete(acbw.producers, pb) - } - acbw.mu.Unlock() - } - return pData.producer, grpcsync.OnceFunc(unref) -} diff --git a/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go b/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go index ec2c2fa14..595480112 100644 --- a/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go +++ b/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go @@ -18,7 +18,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 +// protoc-gen-go v1.31.0 // protoc v4.22.0 // source: grpc/binlog/v1/binarylog.proto diff --git a/vendor/google.golang.org/grpc/call.go b/vendor/google.golang.org/grpc/call.go index e6a1dc5d7..788c89c16 100644 --- a/vendor/google.golang.org/grpc/call.go +++ b/vendor/google.golang.org/grpc/call.go @@ -26,12 +26,7 @@ import ( // received. This is typically called by generated code. // // All errors returned by Invoke are compatible with the status package. -func (cc *ClientConn) Invoke(ctx context.Context, method string, args, reply interface{}, opts ...CallOption) error { - if err := cc.idlenessMgr.onCallBegin(); err != nil { - return err - } - defer cc.idlenessMgr.onCallEnd() - +func (cc *ClientConn) Invoke(ctx context.Context, method string, args, reply any, opts ...CallOption) error { // allow interceptor to see all applicable call options, which means those // configured as defaults from dial option as well as per-call options opts = combine(cc.dopts.callOptions, opts) @@ -61,13 +56,13 @@ func combine(o1 []CallOption, o2 []CallOption) []CallOption { // received. This is typically called by generated code. // // DEPRECATED: Use ClientConn.Invoke instead. -func Invoke(ctx context.Context, method string, args, reply interface{}, cc *ClientConn, opts ...CallOption) error { +func Invoke(ctx context.Context, method string, args, reply any, cc *ClientConn, opts ...CallOption) error { return cc.Invoke(ctx, method, args, reply, opts...) } var unaryStreamDesc = &StreamDesc{ServerStreams: false, ClientStreams: false} -func invoke(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, opts ...CallOption) error { +func invoke(ctx context.Context, method string, req, reply any, cc *ClientConn, opts ...CallOption) error { cs, err := newClientStream(ctx, unaryStreamDesc, cc, method, opts...) if err != nil { return err diff --git a/vendor/google.golang.org/grpc/clientconn.go b/vendor/google.golang.org/grpc/clientconn.go index bfd7555a8..e6f2625b6 100644 --- a/vendor/google.golang.org/grpc/clientconn.go +++ b/vendor/google.golang.org/grpc/clientconn.go @@ -33,10 +33,10 @@ import ( "google.golang.org/grpc/balancer/base" "google.golang.org/grpc/codes" "google.golang.org/grpc/connectivity" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/internal/backoff" + "google.golang.org/grpc/internal" "google.golang.org/grpc/internal/channelz" "google.golang.org/grpc/internal/grpcsync" + "google.golang.org/grpc/internal/idle" "google.golang.org/grpc/internal/pretty" iresolver "google.golang.org/grpc/internal/resolver" "google.golang.org/grpc/internal/transport" @@ -46,16 +46,14 @@ import ( "google.golang.org/grpc/status" _ "google.golang.org/grpc/balancer/roundrobin" // To register roundrobin. - _ "google.golang.org/grpc/internal/resolver/dns" // To register dns resolver. _ "google.golang.org/grpc/internal/resolver/passthrough" // To register passthrough resolver. _ "google.golang.org/grpc/internal/resolver/unix" // To register unix resolver. + _ "google.golang.org/grpc/resolver/dns" // To register dns resolver. ) const ( // minimum time to give a connection to complete minConnectTimeout = 20 * time.Second - // must match grpclbName in grpclb/grpclb.go - grpclbName = "grpclb" ) var ( @@ -119,48 +117,20 @@ func (dcs *defaultConfigSelector) SelectConfig(rpcInfo iresolver.RPCInfo) (*ires }, nil } -// DialContext creates a client connection to the given target. By default, it's -// a non-blocking dial (the function won't wait for connections to be -// established, and connecting happens in the background). To make it a blocking -// dial, use WithBlock() dial option. -// -// In the non-blocking case, the ctx does not act against the connection. It -// only controls the setup steps. -// -// In the blocking case, ctx can be used to cancel or expire the pending -// connection. Once this function returns, the cancellation and expiration of -// ctx will be noop. Users should call ClientConn.Close to terminate all the -// pending operations after this function returns. -// -// The target name syntax is defined in -// https://github.com/grpc/grpc/blob/master/doc/naming.md. -// e.g. to use dns resolver, a "dns:///" prefix should be applied to the target. -func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *ClientConn, err error) { +// newClient returns a new client in idle mode. +func newClient(target string, opts ...DialOption) (conn *ClientConn, err error) { cc := &ClientConn{ target: target, - csMgr: &connectivityStateManager{}, conns: make(map[*addrConn]struct{}), dopts: defaultDialOptions(), czData: new(channelzData), } - // We start the channel off in idle mode, but kick it out of idle at the end - // of this method, instead of waiting for the first RPC. Other gRPC - // implementations do wait for the first RPC to kick the channel out of - // idle. But doing so would be a major behavior change for our users who are - // used to seeing the channel active after Dial. - // - // Taking this approach of kicking it out of idle at the end of this method - // allows us to share the code between channel creation and exiting idle - // mode. This will also make it easy for us to switch to starting the - // channel off in idle, if at all we ever get to do that. - cc.idlenessState = ccIdlenessStateIdle - cc.retryThrottler.Store((*retryThrottler)(nil)) cc.safeConfigSelector.UpdateConfigSelector(&defaultConfigSelector{nil}) cc.ctx, cc.cancel = context.WithCancel(context.Background()) - cc.exitIdleCond = sync.NewCond(&cc.mu) + // Apply dial options. disableGlobalOpts := false for _, opt := range opts { if _, ok := opt.(*disableGlobalDialOptions); ok { @@ -178,19 +148,9 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * for _, opt := range opts { opt.apply(&cc.dopts) } - chainUnaryClientInterceptors(cc) chainStreamClientInterceptors(cc) - defer func() { - if err != nil { - cc.Close() - } - }() - - // Register ClientConn with channelz. - cc.channelzRegistration(target) - if err := cc.validateTransportCredentials(); err != nil { return nil, err } @@ -204,10 +164,80 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * } cc.mkp = cc.dopts.copts.KeepaliveParams - if cc.dopts.copts.UserAgent != "" { - cc.dopts.copts.UserAgent += " " + grpcUA - } else { - cc.dopts.copts.UserAgent = grpcUA + // Register ClientConn with channelz. + cc.channelzRegistration(target) + + // TODO: Ideally it should be impossible to error from this function after + // channelz registration. This will require removing some channelz logs + // from the following functions that can error. Errors can be returned to + // the user, and successful logs can be emitted here, after the checks have + // passed and channelz is subsequently registered. + + // Determine the resolver to use. + if err := cc.parseTargetAndFindResolver(); err != nil { + channelz.RemoveEntry(cc.channelzID) + return nil, err + } + if err = cc.determineAuthority(); err != nil { + channelz.RemoveEntry(cc.channelzID) + return nil, err + } + + cc.csMgr = newConnectivityStateManager(cc.ctx, cc.channelzID) + cc.pickerWrapper = newPickerWrapper(cc.dopts.copts.StatsHandlers) + + cc.initIdleStateLocked() // Safe to call without the lock, since nothing else has a reference to cc. + cc.idlenessMgr = idle.NewManager((*idler)(cc), cc.dopts.idleTimeout) + return cc, nil +} + +// DialContext creates a client connection to the given target. By default, it's +// a non-blocking dial (the function won't wait for connections to be +// established, and connecting happens in the background). To make it a blocking +// dial, use WithBlock() dial option. +// +// In the non-blocking case, the ctx does not act against the connection. It +// only controls the setup steps. +// +// In the blocking case, ctx can be used to cancel or expire the pending +// connection. Once this function returns, the cancellation and expiration of +// ctx will be noop. Users should call ClientConn.Close to terminate all the +// pending operations after this function returns. +// +// The target name syntax is defined in +// https://github.com/grpc/grpc/blob/master/doc/naming.md. +// e.g. to use dns resolver, a "dns:///" prefix should be applied to the target. +func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *ClientConn, err error) { + cc, err := newClient(target, opts...) + if err != nil { + return nil, err + } + + // We start the channel off in idle mode, but kick it out of idle now, + // instead of waiting for the first RPC. Other gRPC implementations do wait + // for the first RPC to kick the channel out of idle. But doing so would be + // a major behavior change for our users who are used to seeing the channel + // active after Dial. + // + // Taking this approach of kicking it out of idle at the end of this method + // allows us to share the code between channel creation and exiting idle + // mode. This will also make it easy for us to switch to starting the + // channel off in idle, i.e. by making newClient exported. + + defer func() { + if err != nil { + cc.Close() + } + }() + + // This creates the name resolver, load balancer, etc. + if err := cc.idlenessMgr.ExitIdleMode(); err != nil { + return nil, err + } + + // Return now for non-blocking dials. + if !cc.dopts.block { + return cc, nil } if cc.dopts.timeout > 0 { @@ -230,49 +260,6 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * } }() - if cc.dopts.bs == nil { - cc.dopts.bs = backoff.DefaultExponential - } - - // Determine the resolver to use. - if err := cc.parseTargetAndFindResolver(); err != nil { - return nil, err - } - if err = cc.determineAuthority(); err != nil { - return nil, err - } - - if cc.dopts.scChan != nil { - // Blocking wait for the initial service config. - select { - case sc, ok := <-cc.dopts.scChan: - if ok { - cc.sc = &sc - cc.safeConfigSelector.UpdateConfigSelector(&defaultConfigSelector{&sc}) - } - case <-ctx.Done(): - return nil, ctx.Err() - } - } - if cc.dopts.scChan != nil { - go cc.scWatcher() - } - - // This creates the name resolver, load balancer, blocking picker etc. - if err := cc.exitIdleMode(); err != nil { - return nil, err - } - - // Configure idleness support with configured idle timeout or default idle - // timeout duration. Idleness can be explicitly disabled by the user, by - // setting the dial option to 0. - cc.idlenessMgr = newIdlenessManager(cc, cc.dopts.idleTimeout) - - // Return early for non-blocking dials. - if !cc.dopts.block { - return cc, nil - } - // A blocking dial blocks until the clientConn is ready. for { s := cc.GetState() @@ -317,117 +304,82 @@ func (cc *ClientConn) addTraceEvent(msg string) { channelz.AddTraceEvent(logger, cc.channelzID, 0, ted) } +type idler ClientConn + +func (i *idler) EnterIdleMode() { + (*ClientConn)(i).enterIdleMode() +} + +func (i *idler) ExitIdleMode() error { + return (*ClientConn)(i).exitIdleMode() +} + // exitIdleMode moves the channel out of idle mode by recreating the name -// resolver and load balancer. -func (cc *ClientConn) exitIdleMode() error { +// resolver and load balancer. This should never be called directly; use +// cc.idlenessMgr.ExitIdleMode instead. +func (cc *ClientConn) exitIdleMode() (err error) { cc.mu.Lock() if cc.conns == nil { cc.mu.Unlock() return errConnClosing } - if cc.idlenessState != ccIdlenessStateIdle { - cc.mu.Unlock() - logger.Info("ClientConn asked to exit idle mode when not in idle mode") - return nil - } - - defer func() { - // When Close() and exitIdleMode() race against each other, one of the - // following two can happen: - // - Close() wins the race and runs first. exitIdleMode() runs after, and - // sees that the ClientConn is already closed and hence returns early. - // - exitIdleMode() wins the race and runs first and recreates the balancer - // and releases the lock before recreating the resolver. If Close() runs - // in this window, it will wait for exitIdleMode to complete. - // - // We achieve this synchronization using the below condition variable. - cc.mu.Lock() - cc.idlenessState = ccIdlenessStateActive - cc.exitIdleCond.Signal() - cc.mu.Unlock() - }() - - cc.idlenessState = ccIdlenessStateExitingIdle - exitedIdle := false - if cc.blockingpicker == nil { - cc.blockingpicker = newPickerWrapper() - } else { - cc.blockingpicker.exitIdleMode() - exitedIdle = true - } - - var credsClone credentials.TransportCredentials - if creds := cc.dopts.copts.TransportCredentials; creds != nil { - credsClone = creds.Clone() - } - if cc.balancerWrapper == nil { - cc.balancerWrapper = newCCBalancerWrapper(cc, balancer.BuildOptions{ - DialCreds: credsClone, - CredsBundle: cc.dopts.copts.CredsBundle, - Dialer: cc.dopts.copts.Dialer, - Authority: cc.authority, - CustomUserAgent: cc.dopts.copts.UserAgent, - ChannelzParentID: cc.channelzID, - Target: cc.parsedTarget, - }) - } else { - cc.balancerWrapper.exitIdleMode() - } - cc.firstResolveEvent = grpcsync.NewEvent() cc.mu.Unlock() // This needs to be called without cc.mu because this builds a new resolver - // which might update state or report error inline which needs to be handled - // by cc.updateResolverState() which also grabs cc.mu. - if err := cc.initResolverWrapper(credsClone); err != nil { + // which might update state or report error inline, which would then need to + // acquire cc.mu. + if err := cc.resolverWrapper.start(); err != nil { return err } - if exitedIdle { - cc.addTraceEvent("exiting idle mode") - } + cc.addTraceEvent("exiting idle mode") return nil } +// initIdleStateLocked initializes common state to how it should be while idle. +func (cc *ClientConn) initIdleStateLocked() { + cc.resolverWrapper = newCCResolverWrapper(cc) + cc.balancerWrapper = newCCBalancerWrapper(cc) + cc.firstResolveEvent = grpcsync.NewEvent() + // cc.conns == nil is a proxy for the ClientConn being closed. So, instead + // of setting it to nil here, we recreate the map. This also means that we + // don't have to do this when exiting idle mode. + cc.conns = make(map[*addrConn]struct{}) +} + // enterIdleMode puts the channel in idle mode, and as part of it shuts down the -// name resolver, load balancer and any subchannels. -func (cc *ClientConn) enterIdleMode() error { +// name resolver, load balancer, and any subchannels. This should never be +// called directly; use cc.idlenessMgr.EnterIdleMode instead. +func (cc *ClientConn) enterIdleMode() { cc.mu.Lock() + if cc.conns == nil { cc.mu.Unlock() - return ErrClientConnClosing - } - if cc.idlenessState != ccIdlenessStateActive { - logger.Error("ClientConn asked to enter idle mode when not active") - return nil + return } - // cc.conns == nil is a proxy for the ClientConn being closed. So, instead - // of setting it to nil here, we recreate the map. This also means that we - // don't have to do this when exiting idle mode. conns := cc.conns - cc.conns = make(map[*addrConn]struct{}) - // TODO: Currently, we close the resolver wrapper upon entering idle mode - // and create a new one upon exiting idle mode. This means that the - // `cc.resolverWrapper` field would be overwritten everytime we exit idle - // mode. While this means that we need to hold `cc.mu` when accessing - // `cc.resolverWrapper`, it makes the code simpler in the wrapper. We should - // try to do the same for the balancer and picker wrappers too. - cc.resolverWrapper.close() - cc.blockingpicker.enterIdleMode() - cc.balancerWrapper.enterIdleMode() + rWrapper := cc.resolverWrapper + rWrapper.close() + cc.pickerWrapper.reset() + bWrapper := cc.balancerWrapper + bWrapper.close() cc.csMgr.updateState(connectivity.Idle) - cc.idlenessState = ccIdlenessStateIdle + cc.addTraceEvent("entering idle mode") + + cc.initIdleStateLocked() + cc.mu.Unlock() - go func() { - cc.addTraceEvent("entering idle mode") - for ac := range conns { - ac.tearDown(errConnIdling) - } - }() - return nil + // Block until the name resolver and LB policy are closed. + <-rWrapper.serializer.Done() + <-bWrapper.serializer.Done() + + // Close all subchannels after the LB policy is closed. + for ac := range conns { + ac.tearDown(errConnIdling) + } } // validateTransportCredentials performs a series of checks on the configured @@ -475,7 +427,6 @@ func (cc *ClientConn) validateTransportCredentials() error { func (cc *ClientConn) channelzRegistration(target string) { cc.channelzID = channelz.RegisterChannel(&channelzChannel{cc}, cc.dopts.channelzParentID, target) cc.addTraceEvent("created") - cc.csMgr.channelzID = cc.channelzID } // chainUnaryClientInterceptors chains all unary client interceptors into one. @@ -492,7 +443,7 @@ func chainUnaryClientInterceptors(cc *ClientConn) { } else if len(interceptors) == 1 { chainedInt = interceptors[0] } else { - chainedInt = func(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, invoker UnaryInvoker, opts ...CallOption) error { + chainedInt = func(ctx context.Context, method string, req, reply any, cc *ClientConn, invoker UnaryInvoker, opts ...CallOption) error { return interceptors[0](ctx, method, req, reply, cc, getChainUnaryInvoker(interceptors, 0, invoker), opts...) } } @@ -504,7 +455,7 @@ func getChainUnaryInvoker(interceptors []UnaryClientInterceptor, curr int, final if curr == len(interceptors)-1 { return finalInvoker } - return func(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, opts ...CallOption) error { + return func(ctx context.Context, method string, req, reply any, cc *ClientConn, opts ...CallOption) error { return interceptors[curr+1](ctx, method, req, reply, cc, getChainUnaryInvoker(interceptors, curr+1, finalInvoker), opts...) } } @@ -540,13 +491,27 @@ func getChainStreamer(interceptors []StreamClientInterceptor, curr int, finalStr } } +// newConnectivityStateManager creates an connectivityStateManager with +// the specified id. +func newConnectivityStateManager(ctx context.Context, id *channelz.Identifier) *connectivityStateManager { + return &connectivityStateManager{ + channelzID: id, + pubSub: grpcsync.NewPubSub(ctx), + } +} + // connectivityStateManager keeps the connectivity.State of ClientConn. // This struct will eventually be exported so the balancers can access it. +// +// TODO: If possible, get rid of the `connectivityStateManager` type, and +// provide this functionality using the `PubSub`, to avoid keeping track of +// the connectivity state at two places. type connectivityStateManager struct { mu sync.Mutex state connectivity.State notifyChan chan struct{} channelzID *channelz.Identifier + pubSub *grpcsync.PubSub } // updateState updates the connectivity.State of ClientConn. @@ -562,6 +527,8 @@ func (csm *connectivityStateManager) updateState(state connectivity.State) { return } csm.state = state + csm.pubSub.Publish(state) + channelz.Infof(logger, csm.channelzID, "Channel Connectivity change to %v", state) if csm.notifyChan != nil { // There are other goroutines waiting on this channel. @@ -591,7 +558,7 @@ func (csm *connectivityStateManager) getNotifyChan() <-chan struct{} { type ClientConnInterface interface { // Invoke performs a unary RPC and returns after the response is received // into reply. - Invoke(ctx context.Context, method string, args interface{}, reply interface{}, opts ...CallOption) error + Invoke(ctx context.Context, method string, args any, reply any, opts ...CallOption) error // NewStream begins a streaming RPC. NewStream(ctx context.Context, desc *StreamDesc, method string, opts ...CallOption) (ClientStream, error) } @@ -622,53 +589,35 @@ type ClientConn struct { dopts dialOptions // Default and user specified dial options. channelzID *channelz.Identifier // Channelz identifier for the channel. resolverBuilder resolver.Builder // See parseTargetAndFindResolver(). - balancerWrapper *ccBalancerWrapper // Uses gracefulswitch.balancer underneath. - idlenessMgr idlenessManager + idlenessMgr *idle.Manager // The following provide their own synchronization, and therefore don't // require cc.mu to be held to access them. csMgr *connectivityStateManager - blockingpicker *pickerWrapper + pickerWrapper *pickerWrapper safeConfigSelector iresolver.SafeConfigSelector czData *channelzData retryThrottler atomic.Value // Updated from service config. - // firstResolveEvent is used to track whether the name resolver sent us at - // least one update. RPCs block on this event. - firstResolveEvent *grpcsync.Event - // mu protects the following fields. // TODO: split mu so the same mutex isn't used for everything. mu sync.RWMutex - resolverWrapper *ccResolverWrapper // Initialized in Dial; cleared in Close. + resolverWrapper *ccResolverWrapper // Always recreated whenever entering idle to simplify Close. + balancerWrapper *ccBalancerWrapper // Always recreated whenever entering idle to simplify Close. sc *ServiceConfig // Latest service config received from the resolver. conns map[*addrConn]struct{} // Set to nil on close. mkp keepalive.ClientParameters // May be updated upon receipt of a GoAway. - idlenessState ccIdlenessState // Tracks idleness state of the channel. - exitIdleCond *sync.Cond // Signalled when channel exits idle. + // firstResolveEvent is used to track whether the name resolver sent us at + // least one update. RPCs block on this event. May be accessed without mu + // if we know we cannot be asked to enter idle mode while accessing it (e.g. + // when the idle manager has already been closed, or if we are already + // entering idle mode). + firstResolveEvent *grpcsync.Event lceMu sync.Mutex // protects lastConnectionError lastConnectionError error } -// ccIdlenessState tracks the idleness state of the channel. -// -// Channels start off in `active` and move to `idle` after a period of -// inactivity. When moving back to `active` upon an incoming RPC, they -// transition through `exiting_idle`. This state is useful for synchronization -// with Close(). -// -// This state tracking is mostly for self-protection. The idlenessManager is -// expected to keep track of the state as well, and is expected not to call into -// the ClientConn unnecessarily. -type ccIdlenessState int8 - -const ( - ccIdlenessStateActive ccIdlenessState = iota - ccIdlenessStateIdle - ccIdlenessStateExitingIdle -) - // WaitForStateChange waits until the connectivity.State of ClientConn changes from sourceState or // ctx expires. A true value is returned in former case and false in latter. // @@ -708,29 +657,15 @@ func (cc *ClientConn) GetState() connectivity.State { // Notice: This API is EXPERIMENTAL and may be changed or removed in a later // release. func (cc *ClientConn) Connect() { - cc.exitIdleMode() + if err := cc.idlenessMgr.ExitIdleMode(); err != nil { + cc.addTraceEvent(err.Error()) + return + } // If the ClientConn was not in idle mode, we need to call ExitIdle on the // LB policy so that connections can be created. - cc.balancerWrapper.exitIdleMode() -} - -func (cc *ClientConn) scWatcher() { - for { - select { - case sc, ok := <-cc.dopts.scChan: - if !ok { - return - } - cc.mu.Lock() - // TODO: load balance policy runtime change is ignored. - // We may revisit this decision in the future. - cc.sc = &sc - cc.safeConfigSelector.UpdateConfigSelector(&defaultConfigSelector{&sc}) - cc.mu.Unlock() - case <-cc.ctx.Done(): - return - } - } + cc.mu.Lock() + cc.balancerWrapper.exitIdle() + cc.mu.Unlock() } // waitForResolvedAddrs blocks until the resolver has provided addresses or the @@ -760,6 +695,16 @@ func init() { panic(fmt.Sprintf("impossible error parsing empty service config: %v", cfg.Err)) } emptyServiceConfig = cfg.Config.(*ServiceConfig) + + internal.SubscribeToConnectivityStateChanges = func(cc *ClientConn, s grpcsync.Subscriber) func() { + return cc.csMgr.pubSub.Subscribe(s) + } + internal.EnterIdleModeForTesting = func(cc *ClientConn) { + cc.idlenessMgr.EnterIdleModeForTesting() + } + internal.ExitIdleModeForTesting = func(cc *ClientConn) error { + return cc.idlenessMgr.ExitIdleMode() + } } func (cc *ClientConn) maybeApplyDefaultServiceConfig(addrs []resolver.Address) { @@ -774,9 +719,8 @@ func (cc *ClientConn) maybeApplyDefaultServiceConfig(addrs []resolver.Address) { } } -func (cc *ClientConn) updateResolverState(s resolver.State, err error) error { +func (cc *ClientConn) updateResolverStateAndUnlock(s resolver.State, err error) error { defer cc.firstResolveEvent.Fire() - cc.mu.Lock() // Check if the ClientConn is already closed. Some fields (e.g. // balancerWrapper) are set to nil when closing the ClientConn, and could // cause nil pointer panic if we don't have this check. @@ -822,7 +766,7 @@ func (cc *ClientConn) updateResolverState(s resolver.State, err error) error { if cc.sc == nil { // Apply the failing LB only if we haven't received valid service config // from the name resolver in the past. - cc.applyFailingLB(s.ServiceConfig) + cc.applyFailingLBLocked(s.ServiceConfig) cc.mu.Unlock() return ret } @@ -844,15 +788,13 @@ func (cc *ClientConn) updateResolverState(s resolver.State, err error) error { return ret } -// applyFailingLB is akin to configuring an LB policy on the channel which +// applyFailingLBLocked is akin to configuring an LB policy on the channel which // always fails RPCs. Here, an actual LB policy is not configured, but an always // erroring picker is configured, which returns errors with information about // what was invalid in the received service config. A config selector with no // service config is configured, and the connectivity state of the channel is // set to TransientFailure. -// -// Caller must hold cc.mu. -func (cc *ClientConn) applyFailingLB(sc *serviceconfig.ParseResult) { +func (cc *ClientConn) applyFailingLBLocked(sc *serviceconfig.ParseResult) { var err error if sc.Err != nil { err = status.Errorf(codes.Unavailable, "error parsing service config: %v", sc.Err) @@ -860,14 +802,10 @@ func (cc *ClientConn) applyFailingLB(sc *serviceconfig.ParseResult) { err = status.Errorf(codes.Unavailable, "illegal service config type: %T", sc.Config) } cc.safeConfigSelector.UpdateConfigSelector(&defaultConfigSelector{nil}) - cc.blockingpicker.updatePicker(base.NewErrPicker(err)) + cc.pickerWrapper.updatePicker(base.NewErrPicker(err)) cc.csMgr.updateState(connectivity.TransientFailure) } -func (cc *ClientConn) handleSubConnStateChange(sc balancer.SubConn, s connectivity.State, err error) { - cc.balancerWrapper.updateSubConnState(sc, s, err) -} - // Makes a copy of the input addresses slice and clears out the balancer // attributes field. Addresses are passed during subconn creation and address // update operations. In both cases, we will clear the balancer attributes by @@ -882,10 +820,14 @@ func copyAddressesWithoutBalancerAttributes(in []resolver.Address) []resolver.Ad return out } -// newAddrConn creates an addrConn for addrs and adds it to cc.conns. +// newAddrConnLocked creates an addrConn for addrs and adds it to cc.conns. // // Caller needs to make sure len(addrs) > 0. -func (cc *ClientConn) newAddrConn(addrs []resolver.Address, opts balancer.NewSubConnOptions) (*addrConn, error) { +func (cc *ClientConn) newAddrConnLocked(addrs []resolver.Address, opts balancer.NewSubConnOptions) (*addrConn, error) { + if cc.conns == nil { + return nil, ErrClientConnClosing + } + ac := &addrConn{ state: connectivity.Idle, cc: cc, @@ -897,12 +839,6 @@ func (cc *ClientConn) newAddrConn(addrs []resolver.Address, opts balancer.NewSub stateChan: make(chan struct{}), } ac.ctx, ac.cancel = context.WithCancel(cc.ctx) - // Track ac in cc. This needs to be done before any getTransport(...) is called. - cc.mu.Lock() - defer cc.mu.Unlock() - if cc.conns == nil { - return nil, ErrClientConnClosing - } var err error ac.channelzID, err = channelz.RegisterSubChannel(ac, cc.channelzID, "") @@ -918,6 +854,7 @@ func (cc *ClientConn) newAddrConn(addrs []resolver.Address, opts balancer.NewSub }, }) + // Track ac in cc. This needs to be done before any getTransport(...) is called. cc.conns[ac] = struct{}{} return ac, nil } @@ -1047,8 +984,8 @@ func (ac *addrConn) updateAddrs(addrs []resolver.Address) { ac.cancel() ac.ctx, ac.cancel = context.WithCancel(ac.cc.ctx) - // We have to defer here because GracefulClose => Close => onClose, which - // requires locking ac.mu. + // We have to defer here because GracefulClose => onClose, which requires + // locking ac.mu. if ac.transport != nil { defer ac.transport.GracefulClose() ac.transport = nil @@ -1124,7 +1061,7 @@ func (cc *ClientConn) healthCheckConfig() *healthCheckConfig { } func (cc *ClientConn) getTransport(ctx context.Context, failfast bool, method string) (transport.ClientTransport, balancer.PickResult, error) { - return cc.blockingpicker.pick(ctx, failfast, balancer.PickInfo{ + return cc.pickerWrapper.pick(ctx, failfast, balancer.PickInfo{ Ctx: ctx, FullMethodName: method, }) @@ -1153,35 +1090,25 @@ func (cc *ClientConn) applyServiceConfigAndBalancer(sc *ServiceConfig, configSel } var newBalancerName string - if cc.sc != nil && cc.sc.lbConfig != nil { + if cc.sc == nil || (cc.sc.lbConfig == nil && cc.sc.LB == nil) { + // No service config or no LB policy specified in config. + newBalancerName = PickFirstBalancerName + } else if cc.sc.lbConfig != nil { newBalancerName = cc.sc.lbConfig.name - } else { - var isGRPCLB bool - for _, a := range addrs { - if a.Type == resolver.GRPCLB { - isGRPCLB = true - break - } - } - if isGRPCLB { - newBalancerName = grpclbName - } else if cc.sc != nil && cc.sc.LB != nil { - newBalancerName = *cc.sc.LB - } else { - newBalancerName = PickFirstBalancerName - } + } else { // cc.sc.LB != nil + newBalancerName = *cc.sc.LB } cc.balancerWrapper.switchTo(newBalancerName) } func (cc *ClientConn) resolveNow(o resolver.ResolveNowOptions) { cc.mu.RLock() - r := cc.resolverWrapper + cc.resolverWrapper.resolveNow(o) cc.mu.RUnlock() - if r == nil { - return - } - go r.resolveNow(o) +} + +func (cc *ClientConn) resolveNowLocked(o resolver.ResolveNowOptions) { + cc.resolverWrapper.resolveNow(o) } // ResetConnectBackoff wakes up all subchannels in transient failure and causes @@ -1208,7 +1135,14 @@ func (cc *ClientConn) ResetConnectBackoff() { // Close tears down the ClientConn and all underlying connections. func (cc *ClientConn) Close() error { - defer cc.cancel() + defer func() { + cc.cancel() + <-cc.csMgr.pubSub.Done() + }() + + // Prevent calls to enter/exit idle immediately, and ensure we are not + // currently entering/exiting idle mode. + cc.idlenessMgr.Close() cc.mu.Lock() if cc.conns == nil { @@ -1216,34 +1150,22 @@ func (cc *ClientConn) Close() error { return ErrClientConnClosing } - for cc.idlenessState == ccIdlenessStateExitingIdle { - cc.exitIdleCond.Wait() - } - conns := cc.conns cc.conns = nil cc.csMgr.updateState(connectivity.Shutdown) - pWrapper := cc.blockingpicker - rWrapper := cc.resolverWrapper - bWrapper := cc.balancerWrapper - idlenessMgr := cc.idlenessMgr + // We can safely unlock and continue to access all fields now as + // cc.conns==nil, preventing any further operations on cc. cc.mu.Unlock() + cc.resolverWrapper.close() // The order of closing matters here since the balancer wrapper assumes the // picker is closed before it is closed. - if pWrapper != nil { - pWrapper.close() - } - if bWrapper != nil { - bWrapper.close() - } - if rWrapper != nil { - rWrapper.close() - } - if idlenessMgr != nil { - idlenessMgr.close() - } + cc.pickerWrapper.close() + cc.balancerWrapper.close() + + <-cc.resolverWrapper.serializer.Done() + <-cc.balancerWrapper.serializer.Done() for ac := range conns { ac.tearDown(ErrClientConnClosing) @@ -1264,7 +1186,7 @@ type addrConn struct { cc *ClientConn dopts dialOptions - acbw balancer.SubConn + acbw *acBalancerWrapper scopts balancer.NewSubConnOptions // transport is set when there's a viable transport (note: ac state may not be READY as LB channel @@ -1302,7 +1224,7 @@ func (ac *addrConn) updateConnectivityState(s connectivity.State, lastErr error) } else { channelz.Infof(logger, ac.channelzID, "Subchannel Connectivity change to %v, last error: %s", s, lastErr) } - ac.cc.handleSubConnStateChange(ac.acbw, s, lastErr) + ac.acbw.updateState(s, lastErr) } // adjustParams updates parameters used to create transports upon @@ -1352,12 +1274,14 @@ func (ac *addrConn) resetTransport() { if err := ac.tryAllAddrs(acCtx, addrs, connectDeadline); err != nil { ac.cc.resolveNow(resolver.ResolveNowOptions{}) - // After exhausting all addresses, the addrConn enters - // TRANSIENT_FAILURE. + ac.mu.Lock() if acCtx.Err() != nil { + // addrConn was torn down. + ac.mu.Unlock() return } - ac.mu.Lock() + // After exhausting all addresses, the addrConn enters + // TRANSIENT_FAILURE. ac.updateConnectivityState(connectivity.TransientFailure, err) // Backoff. @@ -1553,7 +1477,7 @@ func (ac *addrConn) startHealthCheck(ctx context.Context) { // Set up the health check helper functions. currentTr := ac.transport - newStream := func(method string) (interface{}, error) { + newStream := func(method string) (any, error) { ac.mu.Lock() if ac.transport != currentTr { ac.mu.Unlock() @@ -1641,16 +1565,7 @@ func (ac *addrConn) tearDown(err error) { ac.updateConnectivityState(connectivity.Shutdown, nil) ac.cancel() ac.curAddr = resolver.Address{} - if err == errConnDrain && curTr != nil { - // GracefulClose(...) may be executed multiple times when - // i) receiving multiple GoAway frames from the server; or - // ii) there are concurrent name resolver/Balancer triggered - // address removal and GoAway. - // We have to unlock and re-lock here because GracefulClose => Close => onClose, which requires locking ac.mu. - ac.mu.Unlock() - curTr.GracefulClose() - ac.mu.Lock() - } + channelz.AddTraceEvent(logger, ac.channelzID, 0, &channelz.TraceEventDesc{ Desc: "Subchannel deleted", Severity: channelz.CtInfo, @@ -1664,6 +1579,29 @@ func (ac *addrConn) tearDown(err error) { // being deleted right away. channelz.RemoveEntry(ac.channelzID) ac.mu.Unlock() + + // We have to release the lock before the call to GracefulClose/Close here + // because both of them call onClose(), which requires locking ac.mu. + if curTr != nil { + if err == errConnDrain { + // Close the transport gracefully when the subConn is being shutdown. + // + // GracefulClose() may be executed multiple times if: + // - multiple GoAway frames are received from the server + // - there are concurrent name resolver or balancer triggered + // address removal and GoAway + curTr.GracefulClose() + } else { + // Hard close the transport when the channel is entering idle or is + // being shutdown. In the case where the channel is being shutdown, + // closing of transports is also taken care of by cancelation of cc.ctx. + // But in the case where the channel is entering idle, we need to + // explicitly close the transports here. Instead of distinguishing + // between these two cases, it is simpler to close the transport + // unconditionally here. + curTr.Close(err) + } + } } func (ac *addrConn) getState() connectivity.State { @@ -1790,7 +1728,7 @@ func (cc *ClientConn) parseTargetAndFindResolver() error { if err != nil { channelz.Infof(logger, cc.channelzID, "dial target %q parse failed: %v", cc.target, err) } else { - channelz.Infof(logger, cc.channelzID, "parsed dial target is: %+v", parsedTarget) + channelz.Infof(logger, cc.channelzID, "parsed dial target is: %#v", parsedTarget) rb = cc.getResolver(parsedTarget.URL.Scheme) if rb != nil { cc.parsedTarget = parsedTarget @@ -1948,32 +1886,3 @@ func (cc *ClientConn) determineAuthority() error { channelz.Infof(logger, cc.channelzID, "Channel authority set to %q", cc.authority) return nil } - -// initResolverWrapper creates a ccResolverWrapper, which builds the name -// resolver. This method grabs the lock to assign the newly built resolver -// wrapper to the cc.resolverWrapper field. -func (cc *ClientConn) initResolverWrapper(creds credentials.TransportCredentials) error { - rw, err := newCCResolverWrapper(cc, ccResolverWrapperOpts{ - target: cc.parsedTarget, - builder: cc.resolverBuilder, - bOpts: resolver.BuildOptions{ - DisableServiceConfig: cc.dopts.disableServiceConfig, - DialCreds: creds, - CredsBundle: cc.dopts.copts.CredsBundle, - Dialer: cc.dopts.copts.Dialer, - }, - channelzID: cc.channelzID, - }) - if err != nil { - return fmt.Errorf("failed to build resolver: %v", err) - } - // Resolver implementations may report state update or error inline when - // built (or right after), and this is handled in cc.updateResolverState. - // Also, an error from the resolver might lead to a re-resolution request - // from the balancer, which is handled in resolveNow() where - // `cc.resolverWrapper` is accessed. Hence, we need to hold the lock here. - cc.mu.Lock() - cc.resolverWrapper = rw - cc.mu.Unlock() - return nil -} diff --git a/vendor/google.golang.org/grpc/codec.go b/vendor/google.golang.org/grpc/codec.go index 129776547..411e3dfd4 100644 --- a/vendor/google.golang.org/grpc/codec.go +++ b/vendor/google.golang.org/grpc/codec.go @@ -27,8 +27,8 @@ import ( // omits the name/string, which vary between the two and are not needed for // anything besides the registry in the encoding package. type baseCodec interface { - Marshal(v interface{}) ([]byte, error) - Unmarshal(data []byte, v interface{}) error + Marshal(v any) ([]byte, error) + Unmarshal(data []byte, v any) error } var _ baseCodec = Codec(nil) @@ -41,9 +41,9 @@ var _ baseCodec = encoding.Codec(nil) // Deprecated: use encoding.Codec instead. type Codec interface { // Marshal returns the wire format of v. - Marshal(v interface{}) ([]byte, error) + Marshal(v any) ([]byte, error) // Unmarshal parses the wire format into v. - Unmarshal(data []byte, v interface{}) error + Unmarshal(data []byte, v any) error // String returns the name of the Codec implementation. This is unused by // gRPC. String() string diff --git a/vendor/google.golang.org/grpc/codes/codes.go b/vendor/google.golang.org/grpc/codes/codes.go index 11b106182..08476ad1f 100644 --- a/vendor/google.golang.org/grpc/codes/codes.go +++ b/vendor/google.golang.org/grpc/codes/codes.go @@ -25,7 +25,13 @@ import ( "strconv" ) -// A Code is an unsigned 32-bit error code as defined in the gRPC spec. +// A Code is a status code defined according to the [gRPC documentation]. +// +// Only the codes defined as consts in this package are valid codes. Do not use +// other code values. Behavior of other codes is implementation-specific and +// interoperability between implementations is not guaranteed. +// +// [gRPC documentation]: https://github.com/grpc/grpc/blob/master/doc/statuscodes.md type Code uint32 const ( diff --git a/vendor/google.golang.org/grpc/credentials/alts/alts.go b/vendor/google.golang.org/grpc/credentials/alts/alts.go index 579adf210..afcdb8a0d 100644 --- a/vendor/google.golang.org/grpc/credentials/alts/alts.go +++ b/vendor/google.golang.org/grpc/credentials/alts/alts.go @@ -43,7 +43,7 @@ import ( const ( // hypervisorHandshakerServiceAddress represents the default ALTS gRPC // handshaker service address in the hypervisor. - hypervisorHandshakerServiceAddress = "metadata.google.internal.:8080" + hypervisorHandshakerServiceAddress = "dns:///metadata.google.internal.:8080" // defaultTimeout specifies the server handshake timeout. defaultTimeout = 30.0 * time.Second // The following constants specify the minimum and maximum acceptable diff --git a/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/altscontext.pb.go b/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/altscontext.pb.go index 83e3bae37..c7cf1810a 100644 --- a/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/altscontext.pb.go +++ b/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/altscontext.pb.go @@ -17,7 +17,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 +// protoc-gen-go v1.31.0 // protoc v4.22.0 // source: grpc/gcp/altscontext.proto diff --git a/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/handshaker.pb.go b/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/handshaker.pb.go index 0b0093328..81d0f1140 100644 --- a/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/handshaker.pb.go +++ b/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/handshaker.pb.go @@ -17,7 +17,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 +// protoc-gen-go v1.31.0 // protoc v4.22.0 // source: grpc/gcp/handshaker.proto diff --git a/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/transport_security_common.pb.go b/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/transport_security_common.pb.go index c2e564c7d..69f094758 100644 --- a/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/transport_security_common.pb.go +++ b/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/transport_security_common.pb.go @@ -17,7 +17,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 +// protoc-gen-go v1.31.0 // protoc v4.22.0 // source: grpc/gcp/transport_security_common.proto diff --git a/vendor/google.golang.org/grpc/credentials/tls.go b/vendor/google.golang.org/grpc/credentials/tls.go index 877b7cd21..5dafd34ed 100644 --- a/vendor/google.golang.org/grpc/credentials/tls.go +++ b/vendor/google.golang.org/grpc/credentials/tls.go @@ -44,10 +44,25 @@ func (t TLSInfo) AuthType() string { return "tls" } +// cipherSuiteLookup returns the string version of a TLS cipher suite ID. +func cipherSuiteLookup(cipherSuiteID uint16) string { + for _, s := range tls.CipherSuites() { + if s.ID == cipherSuiteID { + return s.Name + } + } + for _, s := range tls.InsecureCipherSuites() { + if s.ID == cipherSuiteID { + return s.Name + } + } + return fmt.Sprintf("unknown ID: %v", cipherSuiteID) +} + // GetSecurityValue returns security info requested by channelz. func (t TLSInfo) GetSecurityValue() ChannelzSecurityValue { v := &TLSChannelzSecurityValue{ - StandardName: cipherSuiteLookup[t.State.CipherSuite], + StandardName: cipherSuiteLookup(t.State.CipherSuite), } // Currently there's no way to get LocalCertificate info from tls package. if len(t.State.PeerCertificates) > 0 { @@ -138,10 +153,39 @@ func (c *tlsCreds) OverrideServerName(serverNameOverride string) error { return nil } +// The following cipher suites are forbidden for use with HTTP/2 by +// https://datatracker.ietf.org/doc/html/rfc7540#appendix-A +var tls12ForbiddenCipherSuites = map[uint16]struct{}{ + tls.TLS_RSA_WITH_AES_128_CBC_SHA: {}, + tls.TLS_RSA_WITH_AES_256_CBC_SHA: {}, + tls.TLS_RSA_WITH_AES_128_GCM_SHA256: {}, + tls.TLS_RSA_WITH_AES_256_GCM_SHA384: {}, + tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA: {}, + tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA: {}, + tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA: {}, + tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: {}, +} + // NewTLS uses c to construct a TransportCredentials based on TLS. func NewTLS(c *tls.Config) TransportCredentials { tc := &tlsCreds{credinternal.CloneTLSConfig(c)} tc.config.NextProtos = credinternal.AppendH2ToNextProtos(tc.config.NextProtos) + // If the user did not configure a MinVersion and did not configure a + // MaxVersion < 1.2, use MinVersion=1.2, which is required by + // https://datatracker.ietf.org/doc/html/rfc7540#section-9.2 + if tc.config.MinVersion == 0 && (tc.config.MaxVersion == 0 || tc.config.MaxVersion >= tls.VersionTLS12) { + tc.config.MinVersion = tls.VersionTLS12 + } + // If the user did not configure CipherSuites, use all "secure" cipher + // suites reported by the TLS package, but remove some explicitly forbidden + // by https://datatracker.ietf.org/doc/html/rfc7540#appendix-A + if tc.config.CipherSuites == nil { + for _, cs := range tls.CipherSuites() { + if _, ok := tls12ForbiddenCipherSuites[cs.ID]; !ok { + tc.config.CipherSuites = append(tc.config.CipherSuites, cs.ID) + } + } + } return tc } @@ -205,32 +249,3 @@ type TLSChannelzSecurityValue struct { LocalCertificate []byte RemoteCertificate []byte } - -var cipherSuiteLookup = map[uint16]string{ - tls.TLS_RSA_WITH_RC4_128_SHA: "TLS_RSA_WITH_RC4_128_SHA", - tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA: "TLS_RSA_WITH_3DES_EDE_CBC_SHA", - tls.TLS_RSA_WITH_AES_128_CBC_SHA: "TLS_RSA_WITH_AES_128_CBC_SHA", - tls.TLS_RSA_WITH_AES_256_CBC_SHA: "TLS_RSA_WITH_AES_256_CBC_SHA", - tls.TLS_RSA_WITH_AES_128_GCM_SHA256: "TLS_RSA_WITH_AES_128_GCM_SHA256", - tls.TLS_RSA_WITH_AES_256_GCM_SHA384: "TLS_RSA_WITH_AES_256_GCM_SHA384", - tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA: "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", - tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA: "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", - tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA: "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", - tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA: "TLS_ECDHE_RSA_WITH_RC4_128_SHA", - tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA: "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", - tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA: "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", - tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", - tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256: "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", - tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256: "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", - tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384: "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", - tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384: "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", - tls.TLS_FALLBACK_SCSV: "TLS_FALLBACK_SCSV", - tls.TLS_RSA_WITH_AES_128_CBC_SHA256: "TLS_RSA_WITH_AES_128_CBC_SHA256", - tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256: "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256", - tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256: "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", - tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305: "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305", - tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305: "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305", - tls.TLS_AES_128_GCM_SHA256: "TLS_AES_128_GCM_SHA256", - tls.TLS_AES_256_GCM_SHA384: "TLS_AES_256_GCM_SHA384", - tls.TLS_CHACHA20_POLY1305_SHA256: "TLS_CHACHA20_POLY1305_SHA256", -} diff --git a/vendor/google.golang.org/grpc/dialoptions.go b/vendor/google.golang.org/grpc/dialoptions.go index 23ea95237..ba2426180 100644 --- a/vendor/google.golang.org/grpc/dialoptions.go +++ b/vendor/google.golang.org/grpc/dialoptions.go @@ -46,6 +46,7 @@ func init() { internal.WithBinaryLogger = withBinaryLogger internal.JoinDialOptions = newJoinDialOption internal.DisableGlobalDialOptions = newDisableGlobalDialOptions + internal.WithRecvBufferPool = withRecvBufferPool } // dialOptions configure a Dial call. dialOptions are set by the DialOption @@ -63,7 +64,6 @@ type dialOptions struct { block bool returnLastError bool timeout time.Duration - scChan <-chan ServiceConfig authority string binaryLogger binarylog.Logger copts transport.ConnectOptions @@ -139,6 +139,20 @@ func newJoinDialOption(opts ...DialOption) DialOption { return &joinDialOption{opts: opts} } +// WithSharedWriteBuffer allows reusing per-connection transport write buffer. +// If this option is set to true every connection will release the buffer after +// flushing the data on the wire. +// +// # Experimental +// +// Notice: This API is EXPERIMENTAL and may be changed or removed in a +// later release. +func WithSharedWriteBuffer(val bool) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.copts.SharedWriteBuffer = val + }) +} + // WithWriteBufferSize determines how much data can be batched before doing a // write on the wire. The corresponding memory allocation for this buffer will // be twice the size to keep syscalls low. The default value for this buffer is @@ -236,19 +250,6 @@ func WithDecompressor(dc Decompressor) DialOption { }) } -// WithServiceConfig returns a DialOption which has a channel to read the -// service configuration. -// -// Deprecated: service config should be received through name resolver or via -// WithDefaultServiceConfig, as specified at -// https://github.com/grpc/grpc/blob/master/doc/service_config.md. Will be -// removed in a future 1.x release. -func WithServiceConfig(c <-chan ServiceConfig) DialOption { - return newFuncDialOption(func(o *dialOptions) { - o.scChan = c - }) -} - // WithConnectParams configures the ClientConn to use the provided ConnectParams // for creating and maintaining connections to servers. // @@ -399,6 +400,17 @@ func WithTimeout(d time.Duration) DialOption { // connections. If FailOnNonTempDialError() is set to true, and an error is // returned by f, gRPC checks the error's Temporary() method to decide if it // should try to reconnect to the network address. +// +// Note: All supported releases of Go (as of December 2023) override the OS +// defaults for TCP keepalive time and interval to 15s. To enable TCP keepalive +// with OS defaults for keepalive time and interval, use a net.Dialer that sets +// the KeepAlive field to a negative value, and sets the SO_KEEPALIVE socket +// option to true from the Control field. For a concrete example of how to do +// this, see internal.NetDialerWithTCPKeepalive(). +// +// For more information, please see [issue 23459] in the Go github repo. +// +// [issue 23459]: https://github.com/golang/go/issues/23459 func WithContextDialer(f func(context.Context, string) (net.Conn, error)) DialOption { return newFuncDialOption(func(o *dialOptions) { o.copts.Dialer = f @@ -473,7 +485,7 @@ func FailOnNonTempDialError(f bool) DialOption { // the RPCs. func WithUserAgent(s string) DialOption { return newFuncDialOption(func(o *dialOptions) { - o.copts.UserAgent = s + o.copts.UserAgent = s + " " + grpcUA }) } @@ -623,13 +635,16 @@ func withHealthCheckFunc(f internal.HealthChecker) DialOption { func defaultDialOptions() dialOptions { return dialOptions{ - healthCheckFunc: internal.HealthCheckFunc, copts: transport.ConnectOptions{ - WriteBufferSize: defaultWriteBufSize, ReadBufferSize: defaultReadBufSize, + WriteBufferSize: defaultWriteBufSize, UseProxy: true, + UserAgent: grpcUA, }, - recvBufferPool: nopBufferPool{}, + bs: internalbackoff.DefaultExponential, + healthCheckFunc: internal.HealthCheckFunc, + idleTimeout: 30 * time.Minute, + recvBufferPool: nopBufferPool{}, } } @@ -666,8 +681,8 @@ func WithResolvers(rs ...resolver.Builder) DialOption { // channel will exit idle mode when the Connect() method is called or when an // RPC is initiated. // -// By default this feature is disabled, which can also be explicitly configured -// by passing zero to this function. +// A default timeout of 30 minutes will be used if this dial option is not set +// at dial time and idleness can be disabled by passing a timeout of zero. // // # Experimental // @@ -690,11 +705,13 @@ func WithIdleTimeout(d time.Duration) DialOption { // options are used: WithStatsHandler, EnableTracing, or binary logging. In such // cases, the shared buffer pool will be ignored. // -// # Experimental -// -// Notice: This API is EXPERIMENTAL and may be changed or removed in a -// later release. +// Deprecated: use experimental.WithRecvBufferPool instead. Will be deleted in +// v1.60.0 or later. func WithRecvBufferPool(bufferPool SharedBufferPool) DialOption { + return withRecvBufferPool(bufferPool) +} + +func withRecvBufferPool(bufferPool SharedBufferPool) DialOption { return newFuncDialOption(func(o *dialOptions) { o.recvBufferPool = bufferPool }) diff --git a/vendor/google.golang.org/grpc/encoding/encoding.go b/vendor/google.golang.org/grpc/encoding/encoding.go index 07a586135..5ebf88d71 100644 --- a/vendor/google.golang.org/grpc/encoding/encoding.go +++ b/vendor/google.golang.org/grpc/encoding/encoding.go @@ -38,6 +38,10 @@ const Identity = "identity" // Compressor is used for compressing and decompressing when sending or // receiving messages. +// +// If a Compressor implements `DecompressedSize(compressedBytes []byte) int`, +// gRPC will invoke it to determine the size of the buffer allocated for the +// result of decompression. A return value of -1 indicates unknown size. type Compressor interface { // Compress writes the data written to wc to w after compressing it. If an // error occurs while initializing the compressor, that error is returned @@ -51,15 +55,6 @@ type Compressor interface { // coding header. The result must be static; the result cannot change // between calls. Name() string - // If a Compressor implements - // DecompressedSize(compressedBytes []byte) int, gRPC will call it - // to determine the size of the buffer allocated for the result of decompression. - // Return -1 to indicate unknown size. - // - // Experimental - // - // Notice: This API is EXPERIMENTAL and may be changed or removed in a - // later release. } var registeredCompressor = make(map[string]Compressor) @@ -90,9 +85,9 @@ func GetCompressor(name string) Compressor { // methods can be called from concurrent goroutines. type Codec interface { // Marshal returns the wire format of v. - Marshal(v interface{}) ([]byte, error) + Marshal(v any) ([]byte, error) // Unmarshal parses the wire format into v. - Unmarshal(data []byte, v interface{}) error + Unmarshal(data []byte, v any) error // Name returns the name of the Codec implementation. The returned string // will be used as part of content type in transmission. The result must be // static; the result cannot change between calls. diff --git a/vendor/google.golang.org/grpc/encoding/proto/proto.go b/vendor/google.golang.org/grpc/encoding/proto/proto.go index 3009b35af..0ee3d3bae 100644 --- a/vendor/google.golang.org/grpc/encoding/proto/proto.go +++ b/vendor/google.golang.org/grpc/encoding/proto/proto.go @@ -37,7 +37,7 @@ func init() { // codec is a Codec implementation with protobuf. It is the default codec for gRPC. type codec struct{} -func (codec) Marshal(v interface{}) ([]byte, error) { +func (codec) Marshal(v any) ([]byte, error) { vv, ok := v.(proto.Message) if !ok { return nil, fmt.Errorf("failed to marshal, message is %T, want proto.Message", v) @@ -45,7 +45,7 @@ func (codec) Marshal(v interface{}) ([]byte, error) { return proto.Marshal(vv) } -func (codec) Unmarshal(data []byte, v interface{}) error { +func (codec) Unmarshal(data []byte, v any) error { vv, ok := v.(proto.Message) if !ok { return fmt.Errorf("failed to unmarshal, message is %T, want proto.Message", v) diff --git a/vendor/google.golang.org/grpc/grpclog/component.go b/vendor/google.golang.org/grpc/grpclog/component.go index 8358dd6e2..ac73c9ced 100644 --- a/vendor/google.golang.org/grpc/grpclog/component.go +++ b/vendor/google.golang.org/grpc/grpclog/component.go @@ -31,71 +31,71 @@ type componentData struct { var cache = map[string]*componentData{} -func (c *componentData) InfoDepth(depth int, args ...interface{}) { - args = append([]interface{}{"[" + string(c.name) + "]"}, args...) +func (c *componentData) InfoDepth(depth int, args ...any) { + args = append([]any{"[" + string(c.name) + "]"}, args...) grpclog.InfoDepth(depth+1, args...) } -func (c *componentData) WarningDepth(depth int, args ...interface{}) { - args = append([]interface{}{"[" + string(c.name) + "]"}, args...) +func (c *componentData) WarningDepth(depth int, args ...any) { + args = append([]any{"[" + string(c.name) + "]"}, args...) grpclog.WarningDepth(depth+1, args...) } -func (c *componentData) ErrorDepth(depth int, args ...interface{}) { - args = append([]interface{}{"[" + string(c.name) + "]"}, args...) +func (c *componentData) ErrorDepth(depth int, args ...any) { + args = append([]any{"[" + string(c.name) + "]"}, args...) grpclog.ErrorDepth(depth+1, args...) } -func (c *componentData) FatalDepth(depth int, args ...interface{}) { - args = append([]interface{}{"[" + string(c.name) + "]"}, args...) +func (c *componentData) FatalDepth(depth int, args ...any) { + args = append([]any{"[" + string(c.name) + "]"}, args...) grpclog.FatalDepth(depth+1, args...) } -func (c *componentData) Info(args ...interface{}) { +func (c *componentData) Info(args ...any) { c.InfoDepth(1, args...) } -func (c *componentData) Warning(args ...interface{}) { +func (c *componentData) Warning(args ...any) { c.WarningDepth(1, args...) } -func (c *componentData) Error(args ...interface{}) { +func (c *componentData) Error(args ...any) { c.ErrorDepth(1, args...) } -func (c *componentData) Fatal(args ...interface{}) { +func (c *componentData) Fatal(args ...any) { c.FatalDepth(1, args...) } -func (c *componentData) Infof(format string, args ...interface{}) { +func (c *componentData) Infof(format string, args ...any) { c.InfoDepth(1, fmt.Sprintf(format, args...)) } -func (c *componentData) Warningf(format string, args ...interface{}) { +func (c *componentData) Warningf(format string, args ...any) { c.WarningDepth(1, fmt.Sprintf(format, args...)) } -func (c *componentData) Errorf(format string, args ...interface{}) { +func (c *componentData) Errorf(format string, args ...any) { c.ErrorDepth(1, fmt.Sprintf(format, args...)) } -func (c *componentData) Fatalf(format string, args ...interface{}) { +func (c *componentData) Fatalf(format string, args ...any) { c.FatalDepth(1, fmt.Sprintf(format, args...)) } -func (c *componentData) Infoln(args ...interface{}) { +func (c *componentData) Infoln(args ...any) { c.InfoDepth(1, args...) } -func (c *componentData) Warningln(args ...interface{}) { +func (c *componentData) Warningln(args ...any) { c.WarningDepth(1, args...) } -func (c *componentData) Errorln(args ...interface{}) { +func (c *componentData) Errorln(args ...any) { c.ErrorDepth(1, args...) } -func (c *componentData) Fatalln(args ...interface{}) { +func (c *componentData) Fatalln(args ...any) { c.FatalDepth(1, args...) } diff --git a/vendor/google.golang.org/grpc/grpclog/grpclog.go b/vendor/google.golang.org/grpc/grpclog/grpclog.go index c8bb2be34..16928c9cb 100644 --- a/vendor/google.golang.org/grpc/grpclog/grpclog.go +++ b/vendor/google.golang.org/grpc/grpclog/grpclog.go @@ -42,53 +42,53 @@ func V(l int) bool { } // Info logs to the INFO log. -func Info(args ...interface{}) { +func Info(args ...any) { grpclog.Logger.Info(args...) } // Infof logs to the INFO log. Arguments are handled in the manner of fmt.Printf. -func Infof(format string, args ...interface{}) { +func Infof(format string, args ...any) { grpclog.Logger.Infof(format, args...) } // Infoln logs to the INFO log. Arguments are handled in the manner of fmt.Println. -func Infoln(args ...interface{}) { +func Infoln(args ...any) { grpclog.Logger.Infoln(args...) } // Warning logs to the WARNING log. -func Warning(args ...interface{}) { +func Warning(args ...any) { grpclog.Logger.Warning(args...) } // Warningf logs to the WARNING log. Arguments are handled in the manner of fmt.Printf. -func Warningf(format string, args ...interface{}) { +func Warningf(format string, args ...any) { grpclog.Logger.Warningf(format, args...) } // Warningln logs to the WARNING log. Arguments are handled in the manner of fmt.Println. -func Warningln(args ...interface{}) { +func Warningln(args ...any) { grpclog.Logger.Warningln(args...) } // Error logs to the ERROR log. -func Error(args ...interface{}) { +func Error(args ...any) { grpclog.Logger.Error(args...) } // Errorf logs to the ERROR log. Arguments are handled in the manner of fmt.Printf. -func Errorf(format string, args ...interface{}) { +func Errorf(format string, args ...any) { grpclog.Logger.Errorf(format, args...) } // Errorln logs to the ERROR log. Arguments are handled in the manner of fmt.Println. -func Errorln(args ...interface{}) { +func Errorln(args ...any) { grpclog.Logger.Errorln(args...) } // Fatal logs to the FATAL log. Arguments are handled in the manner of fmt.Print. // It calls os.Exit() with exit code 1. -func Fatal(args ...interface{}) { +func Fatal(args ...any) { grpclog.Logger.Fatal(args...) // Make sure fatal logs will exit. os.Exit(1) @@ -96,7 +96,7 @@ func Fatal(args ...interface{}) { // Fatalf logs to the FATAL log. Arguments are handled in the manner of fmt.Printf. // It calls os.Exit() with exit code 1. -func Fatalf(format string, args ...interface{}) { +func Fatalf(format string, args ...any) { grpclog.Logger.Fatalf(format, args...) // Make sure fatal logs will exit. os.Exit(1) @@ -104,7 +104,7 @@ func Fatalf(format string, args ...interface{}) { // Fatalln logs to the FATAL log. Arguments are handled in the manner of fmt.Println. // It calle os.Exit()) with exit code 1. -func Fatalln(args ...interface{}) { +func Fatalln(args ...any) { grpclog.Logger.Fatalln(args...) // Make sure fatal logs will exit. os.Exit(1) @@ -113,20 +113,20 @@ func Fatalln(args ...interface{}) { // Print prints to the logger. Arguments are handled in the manner of fmt.Print. // // Deprecated: use Info. -func Print(args ...interface{}) { +func Print(args ...any) { grpclog.Logger.Info(args...) } // Printf prints to the logger. Arguments are handled in the manner of fmt.Printf. // // Deprecated: use Infof. -func Printf(format string, args ...interface{}) { +func Printf(format string, args ...any) { grpclog.Logger.Infof(format, args...) } // Println prints to the logger. Arguments are handled in the manner of fmt.Println. // // Deprecated: use Infoln. -func Println(args ...interface{}) { +func Println(args ...any) { grpclog.Logger.Infoln(args...) } diff --git a/vendor/google.golang.org/grpc/grpclog/logger.go b/vendor/google.golang.org/grpc/grpclog/logger.go index ef06a4822..b1674d826 100644 --- a/vendor/google.golang.org/grpc/grpclog/logger.go +++ b/vendor/google.golang.org/grpc/grpclog/logger.go @@ -24,12 +24,12 @@ import "google.golang.org/grpc/internal/grpclog" // // Deprecated: use LoggerV2. type Logger interface { - Fatal(args ...interface{}) - Fatalf(format string, args ...interface{}) - Fatalln(args ...interface{}) - Print(args ...interface{}) - Printf(format string, args ...interface{}) - Println(args ...interface{}) + Fatal(args ...any) + Fatalf(format string, args ...any) + Fatalln(args ...any) + Print(args ...any) + Printf(format string, args ...any) + Println(args ...any) } // SetLogger sets the logger that is used in grpc. Call only from @@ -45,39 +45,39 @@ type loggerWrapper struct { Logger } -func (g *loggerWrapper) Info(args ...interface{}) { +func (g *loggerWrapper) Info(args ...any) { g.Logger.Print(args...) } -func (g *loggerWrapper) Infoln(args ...interface{}) { +func (g *loggerWrapper) Infoln(args ...any) { g.Logger.Println(args...) } -func (g *loggerWrapper) Infof(format string, args ...interface{}) { +func (g *loggerWrapper) Infof(format string, args ...any) { g.Logger.Printf(format, args...) } -func (g *loggerWrapper) Warning(args ...interface{}) { +func (g *loggerWrapper) Warning(args ...any) { g.Logger.Print(args...) } -func (g *loggerWrapper) Warningln(args ...interface{}) { +func (g *loggerWrapper) Warningln(args ...any) { g.Logger.Println(args...) } -func (g *loggerWrapper) Warningf(format string, args ...interface{}) { +func (g *loggerWrapper) Warningf(format string, args ...any) { g.Logger.Printf(format, args...) } -func (g *loggerWrapper) Error(args ...interface{}) { +func (g *loggerWrapper) Error(args ...any) { g.Logger.Print(args...) } -func (g *loggerWrapper) Errorln(args ...interface{}) { +func (g *loggerWrapper) Errorln(args ...any) { g.Logger.Println(args...) } -func (g *loggerWrapper) Errorf(format string, args ...interface{}) { +func (g *loggerWrapper) Errorf(format string, args ...any) { g.Logger.Printf(format, args...) } diff --git a/vendor/google.golang.org/grpc/grpclog/loggerv2.go b/vendor/google.golang.org/grpc/grpclog/loggerv2.go index 5de66e40d..ecfd36d71 100644 --- a/vendor/google.golang.org/grpc/grpclog/loggerv2.go +++ b/vendor/google.golang.org/grpc/grpclog/loggerv2.go @@ -33,35 +33,35 @@ import ( // LoggerV2 does underlying logging work for grpclog. type LoggerV2 interface { // Info logs to INFO log. Arguments are handled in the manner of fmt.Print. - Info(args ...interface{}) + Info(args ...any) // Infoln logs to INFO log. Arguments are handled in the manner of fmt.Println. - Infoln(args ...interface{}) + Infoln(args ...any) // Infof logs to INFO log. Arguments are handled in the manner of fmt.Printf. - Infof(format string, args ...interface{}) + Infof(format string, args ...any) // Warning logs to WARNING log. Arguments are handled in the manner of fmt.Print. - Warning(args ...interface{}) + Warning(args ...any) // Warningln logs to WARNING log. Arguments are handled in the manner of fmt.Println. - Warningln(args ...interface{}) + Warningln(args ...any) // Warningf logs to WARNING log. Arguments are handled in the manner of fmt.Printf. - Warningf(format string, args ...interface{}) + Warningf(format string, args ...any) // Error logs to ERROR log. Arguments are handled in the manner of fmt.Print. - Error(args ...interface{}) + Error(args ...any) // Errorln logs to ERROR log. Arguments are handled in the manner of fmt.Println. - Errorln(args ...interface{}) + Errorln(args ...any) // Errorf logs to ERROR log. Arguments are handled in the manner of fmt.Printf. - Errorf(format string, args ...interface{}) + Errorf(format string, args ...any) // Fatal logs to ERROR log. Arguments are handled in the manner of fmt.Print. // gRPC ensures that all Fatal logs will exit with os.Exit(1). // Implementations may also call os.Exit() with a non-zero exit code. - Fatal(args ...interface{}) + Fatal(args ...any) // Fatalln logs to ERROR log. Arguments are handled in the manner of fmt.Println. // gRPC ensures that all Fatal logs will exit with os.Exit(1). // Implementations may also call os.Exit() with a non-zero exit code. - Fatalln(args ...interface{}) + Fatalln(args ...any) // Fatalf logs to ERROR log. Arguments are handled in the manner of fmt.Printf. // gRPC ensures that all Fatal logs will exit with os.Exit(1). // Implementations may also call os.Exit() with a non-zero exit code. - Fatalf(format string, args ...interface{}) + Fatalf(format string, args ...any) // V reports whether verbosity level l is at least the requested verbose level. V(l int) bool } @@ -182,53 +182,53 @@ func (g *loggerT) output(severity int, s string) { g.m[severity].Output(2, string(b)) } -func (g *loggerT) Info(args ...interface{}) { +func (g *loggerT) Info(args ...any) { g.output(infoLog, fmt.Sprint(args...)) } -func (g *loggerT) Infoln(args ...interface{}) { +func (g *loggerT) Infoln(args ...any) { g.output(infoLog, fmt.Sprintln(args...)) } -func (g *loggerT) Infof(format string, args ...interface{}) { +func (g *loggerT) Infof(format string, args ...any) { g.output(infoLog, fmt.Sprintf(format, args...)) } -func (g *loggerT) Warning(args ...interface{}) { +func (g *loggerT) Warning(args ...any) { g.output(warningLog, fmt.Sprint(args...)) } -func (g *loggerT) Warningln(args ...interface{}) { +func (g *loggerT) Warningln(args ...any) { g.output(warningLog, fmt.Sprintln(args...)) } -func (g *loggerT) Warningf(format string, args ...interface{}) { +func (g *loggerT) Warningf(format string, args ...any) { g.output(warningLog, fmt.Sprintf(format, args...)) } -func (g *loggerT) Error(args ...interface{}) { +func (g *loggerT) Error(args ...any) { g.output(errorLog, fmt.Sprint(args...)) } -func (g *loggerT) Errorln(args ...interface{}) { +func (g *loggerT) Errorln(args ...any) { g.output(errorLog, fmt.Sprintln(args...)) } -func (g *loggerT) Errorf(format string, args ...interface{}) { +func (g *loggerT) Errorf(format string, args ...any) { g.output(errorLog, fmt.Sprintf(format, args...)) } -func (g *loggerT) Fatal(args ...interface{}) { +func (g *loggerT) Fatal(args ...any) { g.output(fatalLog, fmt.Sprint(args...)) os.Exit(1) } -func (g *loggerT) Fatalln(args ...interface{}) { +func (g *loggerT) Fatalln(args ...any) { g.output(fatalLog, fmt.Sprintln(args...)) os.Exit(1) } -func (g *loggerT) Fatalf(format string, args ...interface{}) { +func (g *loggerT) Fatalf(format string, args ...any) { g.output(fatalLog, fmt.Sprintf(format, args...)) os.Exit(1) } @@ -248,11 +248,11 @@ func (g *loggerT) V(l int) bool { type DepthLoggerV2 interface { LoggerV2 // InfoDepth logs to INFO log at the specified depth. Arguments are handled in the manner of fmt.Println. - InfoDepth(depth int, args ...interface{}) + InfoDepth(depth int, args ...any) // WarningDepth logs to WARNING log at the specified depth. Arguments are handled in the manner of fmt.Println. - WarningDepth(depth int, args ...interface{}) + WarningDepth(depth int, args ...any) // ErrorDepth logs to ERROR log at the specified depth. Arguments are handled in the manner of fmt.Println. - ErrorDepth(depth int, args ...interface{}) + ErrorDepth(depth int, args ...any) // FatalDepth logs to FATAL log at the specified depth. Arguments are handled in the manner of fmt.Println. - FatalDepth(depth int, args ...interface{}) + FatalDepth(depth int, args ...any) } diff --git a/vendor/google.golang.org/grpc/idle.go b/vendor/google.golang.org/grpc/idle.go deleted file mode 100644 index dc3dc72f6..000000000 --- a/vendor/google.golang.org/grpc/idle.go +++ /dev/null @@ -1,287 +0,0 @@ -/* - * - * Copyright 2023 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package grpc - -import ( - "fmt" - "math" - "sync" - "sync/atomic" - "time" -) - -// For overriding in unit tests. -var timeAfterFunc = func(d time.Duration, f func()) *time.Timer { - return time.AfterFunc(d, f) -} - -// idlenessEnforcer is the functionality provided by grpc.ClientConn to enter -// and exit from idle mode. -type idlenessEnforcer interface { - exitIdleMode() error - enterIdleMode() error -} - -// idlenessManager defines the functionality required to track RPC activity on a -// channel. -type idlenessManager interface { - onCallBegin() error - onCallEnd() - close() -} - -type noopIdlenessManager struct{} - -func (noopIdlenessManager) onCallBegin() error { return nil } -func (noopIdlenessManager) onCallEnd() {} -func (noopIdlenessManager) close() {} - -// idlenessManagerImpl implements the idlenessManager interface. It uses atomic -// operations to synchronize access to shared state and a mutex to guarantee -// mutual exclusion in a critical section. -type idlenessManagerImpl struct { - // State accessed atomically. - lastCallEndTime int64 // Unix timestamp in nanos; time when the most recent RPC completed. - activeCallsCount int32 // Count of active RPCs; -math.MaxInt32 means channel is idle or is trying to get there. - activeSinceLastTimerCheck int32 // Boolean; True if there was an RPC since the last timer callback. - closed int32 // Boolean; True when the manager is closed. - - // Can be accessed without atomics or mutex since these are set at creation - // time and read-only after that. - enforcer idlenessEnforcer // Functionality provided by grpc.ClientConn. - timeout int64 // Idle timeout duration nanos stored as an int64. - - // idleMu is used to guarantee mutual exclusion in two scenarios: - // - Opposing intentions: - // - a: Idle timeout has fired and handleIdleTimeout() is trying to put - // the channel in idle mode because the channel has been inactive. - // - b: At the same time an RPC is made on the channel, and onCallBegin() - // is trying to prevent the channel from going idle. - // - Competing intentions: - // - The channel is in idle mode and there are multiple RPCs starting at - // the same time, all trying to move the channel out of idle. Only one - // of them should succeed in doing so, while the other RPCs should - // piggyback on the first one and be successfully handled. - idleMu sync.RWMutex - actuallyIdle bool - timer *time.Timer -} - -// newIdlenessManager creates a new idleness manager implementation for the -// given idle timeout. -func newIdlenessManager(enforcer idlenessEnforcer, idleTimeout time.Duration) idlenessManager { - if idleTimeout == 0 { - return noopIdlenessManager{} - } - - i := &idlenessManagerImpl{ - enforcer: enforcer, - timeout: int64(idleTimeout), - } - i.timer = timeAfterFunc(idleTimeout, i.handleIdleTimeout) - return i -} - -// resetIdleTimer resets the idle timer to the given duration. This method -// should only be called from the timer callback. -func (i *idlenessManagerImpl) resetIdleTimer(d time.Duration) { - i.idleMu.Lock() - defer i.idleMu.Unlock() - - if i.timer == nil { - // Only close sets timer to nil. We are done. - return - } - - // It is safe to ignore the return value from Reset() because this method is - // only ever called from the timer callback, which means the timer has - // already fired. - i.timer.Reset(d) -} - -// handleIdleTimeout is the timer callback that is invoked upon expiry of the -// configured idle timeout. The channel is considered inactive if there are no -// ongoing calls and no RPC activity since the last time the timer fired. -func (i *idlenessManagerImpl) handleIdleTimeout() { - if i.isClosed() { - return - } - - if atomic.LoadInt32(&i.activeCallsCount) > 0 { - i.resetIdleTimer(time.Duration(i.timeout)) - return - } - - // There has been activity on the channel since we last got here. Reset the - // timer and return. - if atomic.LoadInt32(&i.activeSinceLastTimerCheck) == 1 { - // Set the timer to fire after a duration of idle timeout, calculated - // from the time the most recent RPC completed. - atomic.StoreInt32(&i.activeSinceLastTimerCheck, 0) - i.resetIdleTimer(time.Duration(atomic.LoadInt64(&i.lastCallEndTime) + i.timeout - time.Now().UnixNano())) - return - } - - // This CAS operation is extremely likely to succeed given that there has - // been no activity since the last time we were here. Setting the - // activeCallsCount to -math.MaxInt32 indicates to onCallBegin() that the - // channel is either in idle mode or is trying to get there. - if !atomic.CompareAndSwapInt32(&i.activeCallsCount, 0, -math.MaxInt32) { - // This CAS operation can fail if an RPC started after we checked for - // activity at the top of this method, or one was ongoing from before - // the last time we were here. In both case, reset the timer and return. - i.resetIdleTimer(time.Duration(i.timeout)) - return - } - - // Now that we've set the active calls count to -math.MaxInt32, it's time to - // actually move to idle mode. - if i.tryEnterIdleMode() { - // Successfully entered idle mode. No timer needed until we exit idle. - return - } - - // Failed to enter idle mode due to a concurrent RPC that kept the channel - // active, or because of an error from the channel. Undo the attempt to - // enter idle, and reset the timer to try again later. - atomic.AddInt32(&i.activeCallsCount, math.MaxInt32) - i.resetIdleTimer(time.Duration(i.timeout)) -} - -// tryEnterIdleMode instructs the channel to enter idle mode. But before -// that, it performs a last minute check to ensure that no new RPC has come in, -// making the channel active. -// -// Return value indicates whether or not the channel moved to idle mode. -// -// Holds idleMu which ensures mutual exclusion with exitIdleMode. -func (i *idlenessManagerImpl) tryEnterIdleMode() bool { - i.idleMu.Lock() - defer i.idleMu.Unlock() - - if atomic.LoadInt32(&i.activeCallsCount) != -math.MaxInt32 { - // We raced and lost to a new RPC. Very rare, but stop entering idle. - return false - } - if atomic.LoadInt32(&i.activeSinceLastTimerCheck) == 1 { - // An very short RPC could have come in (and also finished) after we - // checked for calls count and activity in handleIdleTimeout(), but - // before the CAS operation. So, we need to check for activity again. - return false - } - - // No new RPCs have come in since we last set the active calls count value - // -math.MaxInt32 in the timer callback. And since we have the lock, it is - // safe to enter idle mode now. - if err := i.enforcer.enterIdleMode(); err != nil { - logger.Errorf("Failed to enter idle mode: %v", err) - return false - } - - // Successfully entered idle mode. - i.actuallyIdle = true - return true -} - -// onCallBegin is invoked at the start of every RPC. -func (i *idlenessManagerImpl) onCallBegin() error { - if i.isClosed() { - return nil - } - - if atomic.AddInt32(&i.activeCallsCount, 1) > 0 { - // Channel is not idle now. Set the activity bit and allow the call. - atomic.StoreInt32(&i.activeSinceLastTimerCheck, 1) - return nil - } - - // Channel is either in idle mode or is in the process of moving to idle - // mode. Attempt to exit idle mode to allow this RPC. - if err := i.exitIdleMode(); err != nil { - // Undo the increment to calls count, and return an error causing the - // RPC to fail. - atomic.AddInt32(&i.activeCallsCount, -1) - return err - } - - atomic.StoreInt32(&i.activeSinceLastTimerCheck, 1) - return nil -} - -// exitIdleMode instructs the channel to exit idle mode. -// -// Holds idleMu which ensures mutual exclusion with tryEnterIdleMode. -func (i *idlenessManagerImpl) exitIdleMode() error { - i.idleMu.Lock() - defer i.idleMu.Unlock() - - if !i.actuallyIdle { - // This can happen in two scenarios: - // - handleIdleTimeout() set the calls count to -math.MaxInt32 and called - // tryEnterIdleMode(). But before the latter could grab the lock, an RPC - // came in and onCallBegin() noticed that the calls count is negative. - // - Channel is in idle mode, and multiple new RPCs come in at the same - // time, all of them notice a negative calls count in onCallBegin and get - // here. The first one to get the lock would got the channel to exit idle. - // - // Either way, nothing to do here. - return nil - } - - if err := i.enforcer.exitIdleMode(); err != nil { - return fmt.Errorf("channel failed to exit idle mode: %v", err) - } - - // Undo the idle entry process. This also respects any new RPC attempts. - atomic.AddInt32(&i.activeCallsCount, math.MaxInt32) - i.actuallyIdle = false - - // Start a new timer to fire after the configured idle timeout. - i.timer = timeAfterFunc(time.Duration(i.timeout), i.handleIdleTimeout) - return nil -} - -// onCallEnd is invoked at the end of every RPC. -func (i *idlenessManagerImpl) onCallEnd() { - if i.isClosed() { - return - } - - // Record the time at which the most recent call finished. - atomic.StoreInt64(&i.lastCallEndTime, time.Now().UnixNano()) - - // Decrement the active calls count. This count can temporarily go negative - // when the timer callback is in the process of moving the channel to idle - // mode, but one or more RPCs come in and complete before the timer callback - // can get done with the process of moving to idle mode. - atomic.AddInt32(&i.activeCallsCount, -1) -} - -func (i *idlenessManagerImpl) isClosed() bool { - return atomic.LoadInt32(&i.closed) == 1 -} - -func (i *idlenessManagerImpl) close() { - atomic.StoreInt32(&i.closed, 1) - - i.idleMu.Lock() - i.timer.Stop() - i.timer = nil - i.idleMu.Unlock() -} diff --git a/vendor/google.golang.org/grpc/interceptor.go b/vendor/google.golang.org/grpc/interceptor.go index bb96ef57b..877d78fc3 100644 --- a/vendor/google.golang.org/grpc/interceptor.go +++ b/vendor/google.golang.org/grpc/interceptor.go @@ -23,7 +23,7 @@ import ( ) // UnaryInvoker is called by UnaryClientInterceptor to complete RPCs. -type UnaryInvoker func(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, opts ...CallOption) error +type UnaryInvoker func(ctx context.Context, method string, req, reply any, cc *ClientConn, opts ...CallOption) error // UnaryClientInterceptor intercepts the execution of a unary RPC on the client. // Unary interceptors can be specified as a DialOption, using @@ -40,7 +40,7 @@ type UnaryInvoker func(ctx context.Context, method string, req, reply interface{ // defaults from the ClientConn as well as per-call options. // // The returned error must be compatible with the status package. -type UnaryClientInterceptor func(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, invoker UnaryInvoker, opts ...CallOption) error +type UnaryClientInterceptor func(ctx context.Context, method string, req, reply any, cc *ClientConn, invoker UnaryInvoker, opts ...CallOption) error // Streamer is called by StreamClientInterceptor to create a ClientStream. type Streamer func(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (ClientStream, error) @@ -66,7 +66,7 @@ type StreamClientInterceptor func(ctx context.Context, desc *StreamDesc, cc *Cli // server side. All per-rpc information may be mutated by the interceptor. type UnaryServerInfo struct { // Server is the service implementation the user provides. This is read-only. - Server interface{} + Server any // FullMethod is the full RPC method string, i.e., /package.service/method. FullMethod string } @@ -78,13 +78,13 @@ type UnaryServerInfo struct { // status package, or be one of the context errors. Otherwise, gRPC will use // codes.Unknown as the status code and err.Error() as the status message of the // RPC. -type UnaryHandler func(ctx context.Context, req interface{}) (interface{}, error) +type UnaryHandler func(ctx context.Context, req any) (any, error) // UnaryServerInterceptor provides a hook to intercept the execution of a unary RPC on the server. info // contains all the information of this RPC the interceptor can operate on. And handler is the wrapper // of the service method implementation. It is the responsibility of the interceptor to invoke handler // to complete the RPC. -type UnaryServerInterceptor func(ctx context.Context, req interface{}, info *UnaryServerInfo, handler UnaryHandler) (resp interface{}, err error) +type UnaryServerInterceptor func(ctx context.Context, req any, info *UnaryServerInfo, handler UnaryHandler) (resp any, err error) // StreamServerInfo consists of various information about a streaming RPC on // server side. All per-rpc information may be mutated by the interceptor. @@ -101,4 +101,4 @@ type StreamServerInfo struct { // info contains all the information of this RPC the interceptor can operate on. And handler is the // service method implementation. It is the responsibility of the interceptor to invoke handler to // complete the RPC. -type StreamServerInterceptor func(srv interface{}, ss ServerStream, info *StreamServerInfo, handler StreamHandler) error +type StreamServerInterceptor func(srv any, ss ServerStream, info *StreamServerInfo, handler StreamHandler) error diff --git a/vendor/google.golang.org/grpc/internal/backoff/backoff.go b/vendor/google.golang.org/grpc/internal/backoff/backoff.go index 5fc0ee3da..fed1c011a 100644 --- a/vendor/google.golang.org/grpc/internal/backoff/backoff.go +++ b/vendor/google.golang.org/grpc/internal/backoff/backoff.go @@ -23,6 +23,8 @@ package backoff import ( + "context" + "errors" "time" grpcbackoff "google.golang.org/grpc/backoff" @@ -71,3 +73,37 @@ func (bc Exponential) Backoff(retries int) time.Duration { } return time.Duration(backoff) } + +// ErrResetBackoff is the error to be returned by the function executed by RunF, +// to instruct the latter to reset its backoff state. +var ErrResetBackoff = errors.New("reset backoff state") + +// RunF provides a convenient way to run a function f repeatedly until the +// context expires or f returns a non-nil error that is not ErrResetBackoff. +// When f returns ErrResetBackoff, RunF continues to run f, but resets its +// backoff state before doing so. backoff accepts an integer representing the +// number of retries, and returns the amount of time to backoff. +func RunF(ctx context.Context, f func() error, backoff func(int) time.Duration) { + attempt := 0 + timer := time.NewTimer(0) + for ctx.Err() == nil { + select { + case <-timer.C: + case <-ctx.Done(): + timer.Stop() + return + } + + err := f() + if errors.Is(err, ErrResetBackoff) { + timer.Reset(0) + attempt = 0 + continue + } + if err != nil { + return + } + timer.Reset(backoff(attempt)) + attempt++ + } +} diff --git a/vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/gracefulswitch.go b/vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/gracefulswitch.go index 08666f62a..3c594e6e4 100644 --- a/vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/gracefulswitch.go +++ b/vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/gracefulswitch.go @@ -200,8 +200,8 @@ func (gsb *Balancer) ExitIdle() { } } -// UpdateSubConnState forwards the update to the appropriate child. -func (gsb *Balancer) UpdateSubConnState(sc balancer.SubConn, state balancer.SubConnState) { +// updateSubConnState forwards the update to the appropriate child. +func (gsb *Balancer) updateSubConnState(sc balancer.SubConn, state balancer.SubConnState, cb func(balancer.SubConnState)) { gsb.currentMu.Lock() defer gsb.currentMu.Unlock() gsb.mu.Lock() @@ -214,13 +214,26 @@ func (gsb *Balancer) UpdateSubConnState(sc balancer.SubConn, state balancer.SubC } else if gsb.balancerPending != nil && gsb.balancerPending.subconns[sc] { balToUpdate = gsb.balancerPending } - gsb.mu.Unlock() if balToUpdate == nil { // SubConn belonged to a stale lb policy that has not yet fully closed, // or the balancer was already closed. + gsb.mu.Unlock() return } - balToUpdate.UpdateSubConnState(sc, state) + if state.ConnectivityState == connectivity.Shutdown { + delete(balToUpdate.subconns, sc) + } + gsb.mu.Unlock() + if cb != nil { + cb(state) + } else { + balToUpdate.UpdateSubConnState(sc, state) + } +} + +// UpdateSubConnState forwards the update to the appropriate child. +func (gsb *Balancer) UpdateSubConnState(sc balancer.SubConn, state balancer.SubConnState) { + gsb.updateSubConnState(sc, state, nil) } // Close closes any active child balancers. @@ -242,7 +255,7 @@ func (gsb *Balancer) Close() { // // It implements the balancer.ClientConn interface and is passed down in that // capacity to the wrapped balancer. It maintains a set of subConns created by -// the wrapped balancer and calls from the latter to create/update/remove +// the wrapped balancer and calls from the latter to create/update/shutdown // SubConns update this set before being forwarded to the parent ClientConn. // State updates from the wrapped balancer can result in invocation of the // graceful switch logic. @@ -254,21 +267,10 @@ type balancerWrapper struct { subconns map[balancer.SubConn]bool // subconns created by this balancer } -func (bw *balancerWrapper) UpdateSubConnState(sc balancer.SubConn, state balancer.SubConnState) { - if state.ConnectivityState == connectivity.Shutdown { - bw.gsb.mu.Lock() - delete(bw.subconns, sc) - bw.gsb.mu.Unlock() - } - // There is no need to protect this read with a mutex, as the write to the - // Balancer field happens in SwitchTo, which completes before this can be - // called. - bw.Balancer.UpdateSubConnState(sc, state) -} - -// Close closes the underlying LB policy and removes the subconns it created. bw -// must not be referenced via balancerCurrent or balancerPending in gsb when -// called. gsb.mu must not be held. Does not panic with a nil receiver. +// Close closes the underlying LB policy and shuts down the subconns it +// created. bw must not be referenced via balancerCurrent or balancerPending in +// gsb when called. gsb.mu must not be held. Does not panic with a nil +// receiver. func (bw *balancerWrapper) Close() { // before Close is called. if bw == nil { @@ -281,7 +283,7 @@ func (bw *balancerWrapper) Close() { bw.Balancer.Close() bw.gsb.mu.Lock() for sc := range bw.subconns { - bw.gsb.cc.RemoveSubConn(sc) + sc.Shutdown() } bw.gsb.mu.Unlock() } @@ -335,13 +337,16 @@ func (bw *balancerWrapper) NewSubConn(addrs []resolver.Address, opts balancer.Ne } bw.gsb.mu.Unlock() + var sc balancer.SubConn + oldListener := opts.StateListener + opts.StateListener = func(state balancer.SubConnState) { bw.gsb.updateSubConnState(sc, state, oldListener) } sc, err := bw.gsb.cc.NewSubConn(addrs, opts) if err != nil { return nil, err } bw.gsb.mu.Lock() if !bw.gsb.balancerCurrentOrPending(bw) { // balancer was closed during this call - bw.gsb.cc.RemoveSubConn(sc) + sc.Shutdown() bw.gsb.mu.Unlock() return nil, fmt.Errorf("%T at address %p that called NewSubConn is deleted", bw, bw) } @@ -360,13 +365,9 @@ func (bw *balancerWrapper) ResolveNow(opts resolver.ResolveNowOptions) { } func (bw *balancerWrapper) RemoveSubConn(sc balancer.SubConn) { - bw.gsb.mu.Lock() - if !bw.gsb.balancerCurrentOrPending(bw) { - bw.gsb.mu.Unlock() - return - } - bw.gsb.mu.Unlock() - bw.gsb.cc.RemoveSubConn(sc) + // Note: existing third party balancers may call this, so it must remain + // until RemoveSubConn is fully removed. + sc.Shutdown() } func (bw *balancerWrapper) UpdateAddresses(sc balancer.SubConn, addrs []resolver.Address) { diff --git a/vendor/google.golang.org/grpc/internal/balancerload/load.go b/vendor/google.golang.org/grpc/internal/balancerload/load.go index 3a905d966..94a08d687 100644 --- a/vendor/google.golang.org/grpc/internal/balancerload/load.go +++ b/vendor/google.golang.org/grpc/internal/balancerload/load.go @@ -25,7 +25,7 @@ import ( // Parser converts loads from metadata into a concrete type. type Parser interface { // Parse parses loads from metadata. - Parse(md metadata.MD) interface{} + Parse(md metadata.MD) any } var parser Parser @@ -38,7 +38,7 @@ func SetParser(lr Parser) { } // Parse calls parser.Read(). -func Parse(md metadata.MD) interface{} { +func Parse(md metadata.MD) any { if parser == nil { return nil } diff --git a/vendor/google.golang.org/grpc/internal/binarylog/method_logger.go b/vendor/google.golang.org/grpc/internal/binarylog/method_logger.go index 6c3f63221..0f31274a3 100644 --- a/vendor/google.golang.org/grpc/internal/binarylog/method_logger.go +++ b/vendor/google.golang.org/grpc/internal/binarylog/method_logger.go @@ -230,7 +230,7 @@ type ClientMessage struct { OnClientSide bool // Message can be a proto.Message or []byte. Other messages formats are not // supported. - Message interface{} + Message any } func (c *ClientMessage) toProto() *binlogpb.GrpcLogEntry { @@ -270,7 +270,7 @@ type ServerMessage struct { OnClientSide bool // Message can be a proto.Message or []byte. Other messages formats are not // supported. - Message interface{} + Message any } func (c *ServerMessage) toProto() *binlogpb.GrpcLogEntry { diff --git a/vendor/google.golang.org/grpc/internal/buffer/unbounded.go b/vendor/google.golang.org/grpc/internal/buffer/unbounded.go index 81c2f5fd7..11f91668a 100644 --- a/vendor/google.golang.org/grpc/internal/buffer/unbounded.go +++ b/vendor/google.golang.org/grpc/internal/buffer/unbounded.go @@ -18,7 +18,10 @@ // Package buffer provides an implementation of an unbounded buffer. package buffer -import "sync" +import ( + "errors" + "sync" +) // Unbounded is an implementation of an unbounded buffer which does not use // extra goroutines. This is typically used for passing updates from one entity @@ -28,49 +31,50 @@ import "sync" // the underlying mutex used for synchronization. // // Unbounded supports values of any type to be stored in it by using a channel -// of `interface{}`. This means that a call to Put() incurs an extra memory -// allocation, and also that users need a type assertion while reading. For -// performance critical code paths, using Unbounded is strongly discouraged and -// defining a new type specific implementation of this buffer is preferred. See +// of `any`. This means that a call to Put() incurs an extra memory allocation, +// and also that users need a type assertion while reading. For performance +// critical code paths, using Unbounded is strongly discouraged and defining a +// new type specific implementation of this buffer is preferred. See // internal/transport/transport.go for an example of this. type Unbounded struct { - c chan interface{} + c chan any closed bool + closing bool mu sync.Mutex - backlog []interface{} + backlog []any } // NewUnbounded returns a new instance of Unbounded. func NewUnbounded() *Unbounded { - return &Unbounded{c: make(chan interface{}, 1)} + return &Unbounded{c: make(chan any, 1)} } +var errBufferClosed = errors.New("Put called on closed buffer.Unbounded") + // Put adds t to the unbounded buffer. -func (b *Unbounded) Put(t interface{}) { +func (b *Unbounded) Put(t any) error { b.mu.Lock() defer b.mu.Unlock() - if b.closed { - return + if b.closing { + return errBufferClosed } if len(b.backlog) == 0 { select { case b.c <- t: - return + return nil default: } } b.backlog = append(b.backlog, t) + return nil } -// Load sends the earliest buffered data, if any, onto the read channel -// returned by Get(). Users are expected to call this every time they read a +// Load sends the earliest buffered data, if any, onto the read channel returned +// by Get(). Users are expected to call this every time they successfully read a // value from the read channel. func (b *Unbounded) Load() { b.mu.Lock() defer b.mu.Unlock() - if b.closed { - return - } if len(b.backlog) > 0 { select { case b.c <- b.backlog[0]: @@ -78,6 +82,8 @@ func (b *Unbounded) Load() { b.backlog = b.backlog[1:] default: } + } else if b.closing && !b.closed { + close(b.c) } } @@ -88,18 +94,23 @@ func (b *Unbounded) Load() { // send the next buffered value onto the channel if there is any. // // If the unbounded buffer is closed, the read channel returned by this method -// is closed. -func (b *Unbounded) Get() <-chan interface{} { +// is closed after all data is drained. +func (b *Unbounded) Get() <-chan any { return b.c } -// Close closes the unbounded buffer. +// Close closes the unbounded buffer. No subsequent data may be Put(), and the +// channel returned from Get() will be closed after all the data is read and +// Load() is called for the final time. func (b *Unbounded) Close() { b.mu.Lock() defer b.mu.Unlock() - if b.closed { + if b.closing { return } - b.closed = true - close(b.c) + b.closing = true + if len(b.backlog) == 0 { + b.closed = true + close(b.c) + } } diff --git a/vendor/google.golang.org/grpc/internal/channelz/funcs.go b/vendor/google.golang.org/grpc/internal/channelz/funcs.go index 777cbcd79..fc094f344 100644 --- a/vendor/google.golang.org/grpc/internal/channelz/funcs.go +++ b/vendor/google.golang.org/grpc/internal/channelz/funcs.go @@ -24,15 +24,14 @@ package channelz import ( - "context" "errors" - "fmt" "sort" "sync" "sync/atomic" "time" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal" ) const ( @@ -40,8 +39,11 @@ const ( ) var ( - db dbWrapper - idGen idGenerator + // IDGen is the global channelz entity ID generator. It should not be used + // outside this package except by tests. + IDGen IDGenerator + + db dbWrapper // EntryPerPage defines the number of channelz entries to be shown on a web page. EntryPerPage = int64(50) curState int32 @@ -52,14 +54,20 @@ var ( func TurnOn() { if !IsOn() { db.set(newChannelMap()) - idGen.reset() + IDGen.Reset() atomic.StoreInt32(&curState, 1) } } +func init() { + internal.ChannelzTurnOffForTesting = func() { + atomic.StoreInt32(&curState, 0) + } +} + // IsOn returns whether channelz data collection is on. func IsOn() bool { - return atomic.CompareAndSwapInt32(&curState, 1, 1) + return atomic.LoadInt32(&curState) == 1 } // SetMaxTraceEntry sets maximum number of trace entry per entity (i.e. channel/subchannel). @@ -97,43 +105,6 @@ func (d *dbWrapper) get() *channelMap { return d.DB } -// NewChannelzStorageForTesting initializes channelz data storage and id -// generator for testing purposes. -// -// Returns a cleanup function to be invoked by the test, which waits for up to -// 10s for all channelz state to be reset by the grpc goroutines when those -// entities get closed. This cleanup function helps with ensuring that tests -// don't mess up each other. -func NewChannelzStorageForTesting() (cleanup func() error) { - db.set(newChannelMap()) - idGen.reset() - - return func() error { - cm := db.get() - if cm == nil { - return nil - } - - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) - defer cancel() - ticker := time.NewTicker(10 * time.Millisecond) - defer ticker.Stop() - for { - cm.mu.RLock() - topLevelChannels, servers, channels, subChannels, listenSockets, normalSockets := len(cm.topLevelChannels), len(cm.servers), len(cm.channels), len(cm.subChannels), len(cm.listenSockets), len(cm.normalSockets) - cm.mu.RUnlock() - - if err := ctx.Err(); err != nil { - return fmt.Errorf("after 10s the channelz map has not been cleaned up yet, topchannels: %d, servers: %d, channels: %d, subchannels: %d, listen sockets: %d, normal sockets: %d", topLevelChannels, servers, channels, subChannels, listenSockets, normalSockets) - } - if topLevelChannels == 0 && servers == 0 && channels == 0 && subChannels == 0 && listenSockets == 0 && normalSockets == 0 { - return nil - } - <-ticker.C - } - } -} - // GetTopChannels returns a slice of top channel's ChannelMetric, along with a // boolean indicating whether there's more top channels to be queried for. // @@ -193,7 +164,7 @@ func GetServer(id int64) *ServerMetric { // // If channelz is not turned ON, the channelz database is not mutated. func RegisterChannel(c Channel, pid *Identifier, ref string) *Identifier { - id := idGen.genID() + id := IDGen.genID() var parent int64 isTopChannel := true if pid != nil { @@ -229,7 +200,7 @@ func RegisterSubChannel(c Channel, pid *Identifier, ref string) (*Identifier, er if pid == nil { return nil, errors.New("a SubChannel's parent id cannot be nil") } - id := idGen.genID() + id := IDGen.genID() if !IsOn() { return newIdentifer(RefSubChannel, id, pid), nil } @@ -251,7 +222,7 @@ func RegisterSubChannel(c Channel, pid *Identifier, ref string) (*Identifier, er // // If channelz is not turned ON, the channelz database is not mutated. func RegisterServer(s Server, ref string) *Identifier { - id := idGen.genID() + id := IDGen.genID() if !IsOn() { return newIdentifer(RefServer, id, nil) } @@ -277,7 +248,7 @@ func RegisterListenSocket(s Socket, pid *Identifier, ref string) (*Identifier, e if pid == nil { return nil, errors.New("a ListenSocket's parent id cannot be 0") } - id := idGen.genID() + id := IDGen.genID() if !IsOn() { return newIdentifer(RefListenSocket, id, pid), nil } @@ -297,7 +268,7 @@ func RegisterNormalSocket(s Socket, pid *Identifier, ref string) (*Identifier, e if pid == nil { return nil, errors.New("a NormalSocket's parent id cannot be 0") } - id := idGen.genID() + id := IDGen.genID() if !IsOn() { return newIdentifer(RefNormalSocket, id, pid), nil } @@ -776,14 +747,17 @@ func (c *channelMap) GetServer(id int64) *ServerMetric { return sm } -type idGenerator struct { +// IDGenerator is an incrementing atomic that tracks IDs for channelz entities. +type IDGenerator struct { id int64 } -func (i *idGenerator) reset() { +// Reset resets the generated ID back to zero. Should only be used at +// initialization or by tests sensitive to the ID number. +func (i *IDGenerator) Reset() { atomic.StoreInt64(&i.id, 0) } -func (i *idGenerator) genID() int64 { +func (i *IDGenerator) genID() int64 { return atomic.AddInt64(&i.id, 1) } diff --git a/vendor/google.golang.org/grpc/internal/channelz/logging.go b/vendor/google.golang.org/grpc/internal/channelz/logging.go index 8e13a3d2c..f89e6f77b 100644 --- a/vendor/google.golang.org/grpc/internal/channelz/logging.go +++ b/vendor/google.golang.org/grpc/internal/channelz/logging.go @@ -31,7 +31,7 @@ func withParens(id *Identifier) string { } // Info logs and adds a trace event if channelz is on. -func Info(l grpclog.DepthLoggerV2, id *Identifier, args ...interface{}) { +func Info(l grpclog.DepthLoggerV2, id *Identifier, args ...any) { AddTraceEvent(l, id, 1, &TraceEventDesc{ Desc: fmt.Sprint(args...), Severity: CtInfo, @@ -39,7 +39,7 @@ func Info(l grpclog.DepthLoggerV2, id *Identifier, args ...interface{}) { } // Infof logs and adds a trace event if channelz is on. -func Infof(l grpclog.DepthLoggerV2, id *Identifier, format string, args ...interface{}) { +func Infof(l grpclog.DepthLoggerV2, id *Identifier, format string, args ...any) { AddTraceEvent(l, id, 1, &TraceEventDesc{ Desc: fmt.Sprintf(format, args...), Severity: CtInfo, @@ -47,7 +47,7 @@ func Infof(l grpclog.DepthLoggerV2, id *Identifier, format string, args ...inter } // Warning logs and adds a trace event if channelz is on. -func Warning(l grpclog.DepthLoggerV2, id *Identifier, args ...interface{}) { +func Warning(l grpclog.DepthLoggerV2, id *Identifier, args ...any) { AddTraceEvent(l, id, 1, &TraceEventDesc{ Desc: fmt.Sprint(args...), Severity: CtWarning, @@ -55,7 +55,7 @@ func Warning(l grpclog.DepthLoggerV2, id *Identifier, args ...interface{}) { } // Warningf logs and adds a trace event if channelz is on. -func Warningf(l grpclog.DepthLoggerV2, id *Identifier, format string, args ...interface{}) { +func Warningf(l grpclog.DepthLoggerV2, id *Identifier, format string, args ...any) { AddTraceEvent(l, id, 1, &TraceEventDesc{ Desc: fmt.Sprintf(format, args...), Severity: CtWarning, @@ -63,7 +63,7 @@ func Warningf(l grpclog.DepthLoggerV2, id *Identifier, format string, args ...in } // Error logs and adds a trace event if channelz is on. -func Error(l grpclog.DepthLoggerV2, id *Identifier, args ...interface{}) { +func Error(l grpclog.DepthLoggerV2, id *Identifier, args ...any) { AddTraceEvent(l, id, 1, &TraceEventDesc{ Desc: fmt.Sprint(args...), Severity: CtError, @@ -71,7 +71,7 @@ func Error(l grpclog.DepthLoggerV2, id *Identifier, args ...interface{}) { } // Errorf logs and adds a trace event if channelz is on. -func Errorf(l grpclog.DepthLoggerV2, id *Identifier, format string, args ...interface{}) { +func Errorf(l grpclog.DepthLoggerV2, id *Identifier, format string, args ...any) { AddTraceEvent(l, id, 1, &TraceEventDesc{ Desc: fmt.Sprintf(format, args...), Severity: CtError, diff --git a/vendor/google.golang.org/grpc/internal/channelz/types.go b/vendor/google.golang.org/grpc/internal/channelz/types.go index 7b2f350e2..1d4020f53 100644 --- a/vendor/google.golang.org/grpc/internal/channelz/types.go +++ b/vendor/google.golang.org/grpc/internal/channelz/types.go @@ -628,6 +628,7 @@ type tracedChannel interface { type channelTrace struct { cm *channelMap + clearCalled bool createdTime time.Time eventCount int64 mu sync.Mutex @@ -656,6 +657,10 @@ func (c *channelTrace) append(e *TraceEvent) { } func (c *channelTrace) clear() { + if c.clearCalled { + return + } + c.clearCalled = true c.mu.Lock() for _, e := range c.events { if e.RefID != 0 { diff --git a/vendor/google.golang.org/grpc/internal/channelz/util_linux.go b/vendor/google.golang.org/grpc/internal/channelz/util_linux.go index 8d194e44e..98288c3f8 100644 --- a/vendor/google.golang.org/grpc/internal/channelz/util_linux.go +++ b/vendor/google.golang.org/grpc/internal/channelz/util_linux.go @@ -23,7 +23,7 @@ import ( ) // GetSocketOption gets the socket option info of the conn. -func GetSocketOption(socket interface{}) *SocketOptionData { +func GetSocketOption(socket any) *SocketOptionData { c, ok := socket.(syscall.Conn) if !ok { return nil diff --git a/vendor/google.golang.org/grpc/internal/channelz/util_nonlinux.go b/vendor/google.golang.org/grpc/internal/channelz/util_nonlinux.go index 837ddc402..b5568b22e 100644 --- a/vendor/google.golang.org/grpc/internal/channelz/util_nonlinux.go +++ b/vendor/google.golang.org/grpc/internal/channelz/util_nonlinux.go @@ -22,6 +22,6 @@ package channelz // GetSocketOption gets the socket option info of the conn. -func GetSocketOption(c interface{}) *SocketOptionData { +func GetSocketOption(c any) *SocketOptionData { return nil } diff --git a/vendor/google.golang.org/grpc/internal/credentials/credentials.go b/vendor/google.golang.org/grpc/internal/credentials/credentials.go index 32c9b5903..9deee7f65 100644 --- a/vendor/google.golang.org/grpc/internal/credentials/credentials.go +++ b/vendor/google.golang.org/grpc/internal/credentials/credentials.go @@ -25,12 +25,12 @@ import ( type requestInfoKey struct{} // NewRequestInfoContext creates a context with ri. -func NewRequestInfoContext(ctx context.Context, ri interface{}) context.Context { +func NewRequestInfoContext(ctx context.Context, ri any) context.Context { return context.WithValue(ctx, requestInfoKey{}, ri) } // RequestInfoFromContext extracts the RequestInfo from ctx. -func RequestInfoFromContext(ctx context.Context) interface{} { +func RequestInfoFromContext(ctx context.Context) any { return ctx.Value(requestInfoKey{}) } @@ -39,11 +39,11 @@ func RequestInfoFromContext(ctx context.Context) interface{} { type clientHandshakeInfoKey struct{} // ClientHandshakeInfoFromContext extracts the ClientHandshakeInfo from ctx. -func ClientHandshakeInfoFromContext(ctx context.Context) interface{} { +func ClientHandshakeInfoFromContext(ctx context.Context) any { return ctx.Value(clientHandshakeInfoKey{}) } // NewClientHandshakeInfoContext creates a context with chi. -func NewClientHandshakeInfoContext(ctx context.Context, chi interface{}) context.Context { +func NewClientHandshakeInfoContext(ctx context.Context, chi any) context.Context { return context.WithValue(ctx, clientHandshakeInfoKey{}, chi) } diff --git a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go index 77c2c0b89..685a3cb41 100644 --- a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go +++ b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go @@ -36,10 +36,10 @@ var ( // "GRPC_RING_HASH_CAP". This does not override the default bounds // checking which NACKs configs specifying ring sizes > 8*1024*1024 (~8M). RingHashCap = uint64FromEnv("GRPC_RING_HASH_CAP", 4096, 1, 8*1024*1024) - // PickFirstLBConfig is set if we should support configuration of the - // pick_first LB policy, which can be enabled by setting the environment - // variable "GRPC_EXPERIMENTAL_PICKFIRST_LB_CONFIG" to "true". - PickFirstLBConfig = boolFromEnv("GRPC_EXPERIMENTAL_PICKFIRST_LB_CONFIG", false) + // LeastRequestLB is set if we should support the least_request_experimental + // LB policy, which can be enabled by setting the environment variable + // "GRPC_EXPERIMENTAL_ENABLE_LEAST_REQUEST" to "true". + LeastRequestLB = boolFromEnv("GRPC_EXPERIMENTAL_ENABLE_LEAST_REQUEST", false) // ALTSMaxConcurrentHandshakes is the maximum number of concurrent ALTS // handshakes that can be performed. ALTSMaxConcurrentHandshakes = uint64FromEnv("GRPC_ALTS_MAX_CONCURRENT_HANDSHAKES", 100, 1, 100) diff --git a/vendor/google.golang.org/grpc/internal/envconfig/xds.go b/vendor/google.golang.org/grpc/internal/envconfig/xds.go index 02b4b6a1c..29f234acb 100644 --- a/vendor/google.golang.org/grpc/internal/envconfig/xds.go +++ b/vendor/google.golang.org/grpc/internal/envconfig/xds.go @@ -50,46 +50,7 @@ var ( // // When both bootstrap FileName and FileContent are set, FileName is used. XDSBootstrapFileContent = os.Getenv(XDSBootstrapFileContentEnv) - // XDSRingHash indicates whether ring hash support is enabled, which can be - // disabled by setting the environment variable - // "GRPC_XDS_EXPERIMENTAL_ENABLE_RING_HASH" to "false". - XDSRingHash = boolFromEnv("GRPC_XDS_EXPERIMENTAL_ENABLE_RING_HASH", true) - // XDSClientSideSecurity is used to control processing of security - // configuration on the client-side. - // - // Note that there is no env var protection for the server-side because we - // have a brand new API on the server-side and users explicitly need to use - // the new API to get security integration on the server. - XDSClientSideSecurity = boolFromEnv("GRPC_XDS_EXPERIMENTAL_SECURITY_SUPPORT", true) - // XDSAggregateAndDNS indicates whether processing of aggregated cluster and - // DNS cluster is enabled, which can be disabled by setting the environment - // variable "GRPC_XDS_EXPERIMENTAL_ENABLE_AGGREGATE_AND_LOGICAL_DNS_CLUSTER" - // to "false". - XDSAggregateAndDNS = boolFromEnv("GRPC_XDS_EXPERIMENTAL_ENABLE_AGGREGATE_AND_LOGICAL_DNS_CLUSTER", true) - - // XDSRBAC indicates whether xDS configured RBAC HTTP Filter is enabled, - // which can be disabled by setting the environment variable - // "GRPC_XDS_EXPERIMENTAL_RBAC" to "false". - XDSRBAC = boolFromEnv("GRPC_XDS_EXPERIMENTAL_RBAC", true) - // XDSOutlierDetection indicates whether outlier detection support is - // enabled, which can be disabled by setting the environment variable - // "GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION" to "false". - XDSOutlierDetection = boolFromEnv("GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION", true) - // XDSFederation indicates whether federation support is enabled, which can - // be enabled by setting the environment variable - // "GRPC_EXPERIMENTAL_XDS_FEDERATION" to "true". - XDSFederation = boolFromEnv("GRPC_EXPERIMENTAL_XDS_FEDERATION", true) - - // XDSRLS indicates whether processing of Cluster Specifier plugins and - // support for the RLS CLuster Specifier is enabled, which can be disabled by - // setting the environment variable "GRPC_EXPERIMENTAL_XDS_RLS_LB" to - // "false". - XDSRLS = boolFromEnv("GRPC_EXPERIMENTAL_XDS_RLS_LB", true) // C2PResolverTestOnlyTrafficDirectorURI is the TD URI for testing. C2PResolverTestOnlyTrafficDirectorURI = os.Getenv("GRPC_TEST_ONLY_GOOGLE_C2P_RESOLVER_TRAFFIC_DIRECTOR_URI") - // XDSCustomLBPolicy indicates whether Custom LB Policies are enabled, which - // can be disabled by setting the environment variable - // "GRPC_EXPERIMENTAL_XDS_CUSTOM_LB_CONFIG" to "false". - XDSCustomLBPolicy = boolFromEnv("GRPC_EXPERIMENTAL_XDS_CUSTOM_LB_CONFIG", true) ) diff --git a/vendor/google.golang.org/grpc/internal/grpclog/grpclog.go b/vendor/google.golang.org/grpc/internal/grpclog/grpclog.go index b68e26a36..bfc45102a 100644 --- a/vendor/google.golang.org/grpc/internal/grpclog/grpclog.go +++ b/vendor/google.golang.org/grpc/internal/grpclog/grpclog.go @@ -30,7 +30,7 @@ var Logger LoggerV2 var DepthLogger DepthLoggerV2 // InfoDepth logs to the INFO log at the specified depth. -func InfoDepth(depth int, args ...interface{}) { +func InfoDepth(depth int, args ...any) { if DepthLogger != nil { DepthLogger.InfoDepth(depth, args...) } else { @@ -39,7 +39,7 @@ func InfoDepth(depth int, args ...interface{}) { } // WarningDepth logs to the WARNING log at the specified depth. -func WarningDepth(depth int, args ...interface{}) { +func WarningDepth(depth int, args ...any) { if DepthLogger != nil { DepthLogger.WarningDepth(depth, args...) } else { @@ -48,7 +48,7 @@ func WarningDepth(depth int, args ...interface{}) { } // ErrorDepth logs to the ERROR log at the specified depth. -func ErrorDepth(depth int, args ...interface{}) { +func ErrorDepth(depth int, args ...any) { if DepthLogger != nil { DepthLogger.ErrorDepth(depth, args...) } else { @@ -57,7 +57,7 @@ func ErrorDepth(depth int, args ...interface{}) { } // FatalDepth logs to the FATAL log at the specified depth. -func FatalDepth(depth int, args ...interface{}) { +func FatalDepth(depth int, args ...any) { if DepthLogger != nil { DepthLogger.FatalDepth(depth, args...) } else { @@ -71,35 +71,35 @@ func FatalDepth(depth int, args ...interface{}) { // is defined here to avoid a circular dependency. type LoggerV2 interface { // Info logs to INFO log. Arguments are handled in the manner of fmt.Print. - Info(args ...interface{}) + Info(args ...any) // Infoln logs to INFO log. Arguments are handled in the manner of fmt.Println. - Infoln(args ...interface{}) + Infoln(args ...any) // Infof logs to INFO log. Arguments are handled in the manner of fmt.Printf. - Infof(format string, args ...interface{}) + Infof(format string, args ...any) // Warning logs to WARNING log. Arguments are handled in the manner of fmt.Print. - Warning(args ...interface{}) + Warning(args ...any) // Warningln logs to WARNING log. Arguments are handled in the manner of fmt.Println. - Warningln(args ...interface{}) + Warningln(args ...any) // Warningf logs to WARNING log. Arguments are handled in the manner of fmt.Printf. - Warningf(format string, args ...interface{}) + Warningf(format string, args ...any) // Error logs to ERROR log. Arguments are handled in the manner of fmt.Print. - Error(args ...interface{}) + Error(args ...any) // Errorln logs to ERROR log. Arguments are handled in the manner of fmt.Println. - Errorln(args ...interface{}) + Errorln(args ...any) // Errorf logs to ERROR log. Arguments are handled in the manner of fmt.Printf. - Errorf(format string, args ...interface{}) + Errorf(format string, args ...any) // Fatal logs to ERROR log. Arguments are handled in the manner of fmt.Print. // gRPC ensures that all Fatal logs will exit with os.Exit(1). // Implementations may also call os.Exit() with a non-zero exit code. - Fatal(args ...interface{}) + Fatal(args ...any) // Fatalln logs to ERROR log. Arguments are handled in the manner of fmt.Println. // gRPC ensures that all Fatal logs will exit with os.Exit(1). // Implementations may also call os.Exit() with a non-zero exit code. - Fatalln(args ...interface{}) + Fatalln(args ...any) // Fatalf logs to ERROR log. Arguments are handled in the manner of fmt.Printf. // gRPC ensures that all Fatal logs will exit with os.Exit(1). // Implementations may also call os.Exit() with a non-zero exit code. - Fatalf(format string, args ...interface{}) + Fatalf(format string, args ...any) // V reports whether verbosity level l is at least the requested verbose level. V(l int) bool } @@ -116,11 +116,11 @@ type LoggerV2 interface { // later release. type DepthLoggerV2 interface { // InfoDepth logs to INFO log at the specified depth. Arguments are handled in the manner of fmt.Println. - InfoDepth(depth int, args ...interface{}) + InfoDepth(depth int, args ...any) // WarningDepth logs to WARNING log at the specified depth. Arguments are handled in the manner of fmt.Println. - WarningDepth(depth int, args ...interface{}) + WarningDepth(depth int, args ...any) // ErrorDepth logs to ERROR log at the specified depth. Arguments are handled in the manner of fmt.Println. - ErrorDepth(depth int, args ...interface{}) + ErrorDepth(depth int, args ...any) // FatalDepth logs to FATAL log at the specified depth. Arguments are handled in the manner of fmt.Println. - FatalDepth(depth int, args ...interface{}) + FatalDepth(depth int, args ...any) } diff --git a/vendor/google.golang.org/grpc/internal/grpclog/prefixLogger.go b/vendor/google.golang.org/grpc/internal/grpclog/prefixLogger.go index 02224b42c..faa998de7 100644 --- a/vendor/google.golang.org/grpc/internal/grpclog/prefixLogger.go +++ b/vendor/google.golang.org/grpc/internal/grpclog/prefixLogger.go @@ -31,7 +31,7 @@ type PrefixLogger struct { } // Infof does info logging. -func (pl *PrefixLogger) Infof(format string, args ...interface{}) { +func (pl *PrefixLogger) Infof(format string, args ...any) { if pl != nil { // Handle nil, so the tests can pass in a nil logger. format = pl.prefix + format @@ -42,7 +42,7 @@ func (pl *PrefixLogger) Infof(format string, args ...interface{}) { } // Warningf does warning logging. -func (pl *PrefixLogger) Warningf(format string, args ...interface{}) { +func (pl *PrefixLogger) Warningf(format string, args ...any) { if pl != nil { format = pl.prefix + format pl.logger.WarningDepth(1, fmt.Sprintf(format, args...)) @@ -52,7 +52,7 @@ func (pl *PrefixLogger) Warningf(format string, args ...interface{}) { } // Errorf does error logging. -func (pl *PrefixLogger) Errorf(format string, args ...interface{}) { +func (pl *PrefixLogger) Errorf(format string, args ...any) { if pl != nil { format = pl.prefix + format pl.logger.ErrorDepth(1, fmt.Sprintf(format, args...)) @@ -62,7 +62,7 @@ func (pl *PrefixLogger) Errorf(format string, args ...interface{}) { } // Debugf does info logging at verbose level 2. -func (pl *PrefixLogger) Debugf(format string, args ...interface{}) { +func (pl *PrefixLogger) Debugf(format string, args ...any) { // TODO(6044): Refactor interfaces LoggerV2 and DepthLogger, and maybe // rewrite PrefixLogger a little to ensure that we don't use the global // `Logger` here, and instead use the `logger` field. diff --git a/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go b/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go index 37b8d4117..f7f40a16a 100644 --- a/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go +++ b/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go @@ -20,7 +20,6 @@ package grpcsync import ( "context" - "sync" "google.golang.org/grpc/internal/buffer" ) @@ -32,14 +31,12 @@ import ( // // This type is safe for concurrent access. type CallbackSerializer struct { - // Done is closed once the serializer is shut down completely, i.e all + // done is closed once the serializer is shut down completely, i.e all // scheduled callbacks are executed and the serializer has deallocated all // its resources. - Done chan struct{} + done chan struct{} callbacks *buffer.Unbounded - closedMu sync.Mutex - closed bool } // NewCallbackSerializer returns a new CallbackSerializer instance. The provided @@ -48,12 +45,12 @@ type CallbackSerializer struct { // callbacks will be added once this context is canceled, and any pending un-run // callbacks will be executed before the serializer is shut down. func NewCallbackSerializer(ctx context.Context) *CallbackSerializer { - t := &CallbackSerializer{ - Done: make(chan struct{}), + cs := &CallbackSerializer{ + done: make(chan struct{}), callbacks: buffer.NewUnbounded(), } - go t.run(ctx) - return t + go cs.run(ctx) + return cs } // Schedule adds a callback to be scheduled after existing callbacks are run. @@ -64,56 +61,40 @@ func NewCallbackSerializer(ctx context.Context) *CallbackSerializer { // Return value indicates if the callback was successfully added to the list of // callbacks to be executed by the serializer. It is not possible to add // callbacks once the context passed to NewCallbackSerializer is cancelled. -func (t *CallbackSerializer) Schedule(f func(ctx context.Context)) bool { - t.closedMu.Lock() - defer t.closedMu.Unlock() - - if t.closed { - return false - } - t.callbacks.Put(f) - return true +func (cs *CallbackSerializer) Schedule(f func(ctx context.Context)) bool { + return cs.callbacks.Put(f) == nil } -func (t *CallbackSerializer) run(ctx context.Context) { - var backlog []func(context.Context) +func (cs *CallbackSerializer) run(ctx context.Context) { + defer close(cs.done) - defer close(t.Done) + // TODO: when Go 1.21 is the oldest supported version, this loop and Close + // can be replaced with: + // + // context.AfterFunc(ctx, cs.callbacks.Close) for ctx.Err() == nil { select { case <-ctx.Done(): // Do nothing here. Next iteration of the for loop will not happen, // since ctx.Err() would be non-nil. - case callback, ok := <-t.callbacks.Get(): - if !ok { - return - } - t.callbacks.Load() - callback.(func(ctx context.Context))(ctx) + case cb := <-cs.callbacks.Get(): + cs.callbacks.Load() + cb.(func(context.Context))(ctx) } } - // Fetch pending callbacks if any, and execute them before returning from - // this method and closing t.Done. - t.closedMu.Lock() - t.closed = true - backlog = t.fetchPendingCallbacks() - t.callbacks.Close() - t.closedMu.Unlock() - for _, b := range backlog { - b(ctx) + // Close the buffer to prevent new callbacks from being added. + cs.callbacks.Close() + + // Run all pending callbacks. + for cb := range cs.callbacks.Get() { + cs.callbacks.Load() + cb.(func(context.Context))(ctx) } } -func (t *CallbackSerializer) fetchPendingCallbacks() []func(context.Context) { - var backlog []func(context.Context) - for { - select { - case b := <-t.callbacks.Get(): - backlog = append(backlog, b.(func(context.Context))) - t.callbacks.Load() - default: - return backlog - } - } +// Done returns a channel that is closed after the context passed to +// NewCallbackSerializer is canceled and all callbacks have been executed. +func (cs *CallbackSerializer) Done() <-chan struct{} { + return cs.done } diff --git a/vendor/google.golang.org/grpc/internal/grpcsync/pubsub.go b/vendor/google.golang.org/grpc/internal/grpcsync/pubsub.go index f58b5ffa6..aef8cec1a 100644 --- a/vendor/google.golang.org/grpc/internal/grpcsync/pubsub.go +++ b/vendor/google.golang.org/grpc/internal/grpcsync/pubsub.go @@ -29,7 +29,7 @@ import ( type Subscriber interface { // OnMessage is invoked when a new message is published. Implementations // must not block in this method. - OnMessage(msg interface{}) + OnMessage(msg any) } // PubSub is a simple one-to-many publish-subscribe system that supports @@ -40,25 +40,23 @@ type Subscriber interface { // subscribers interested in receiving these messages register a callback // via the Subscribe() method. // -// Once a PubSub is stopped, no more messages can be published, and -// it is guaranteed that no more subscriber callback will be invoked. +// Once a PubSub is stopped, no more messages can be published, but any pending +// published messages will be delivered to the subscribers. Done may be used +// to determine when all published messages have been delivered. type PubSub struct { - cs *CallbackSerializer - cancel context.CancelFunc + cs *CallbackSerializer // Access to the below fields are guarded by this mutex. mu sync.Mutex - msg interface{} + msg any subscribers map[Subscriber]bool - stopped bool } -// NewPubSub returns a new PubSub instance. -func NewPubSub() *PubSub { - ctx, cancel := context.WithCancel(context.Background()) +// NewPubSub returns a new PubSub instance. Users should cancel the +// provided context to shutdown the PubSub. +func NewPubSub(ctx context.Context) *PubSub { return &PubSub{ cs: NewCallbackSerializer(ctx), - cancel: cancel, subscribers: map[Subscriber]bool{}, } } @@ -75,10 +73,6 @@ func (ps *PubSub) Subscribe(sub Subscriber) (cancel func()) { ps.mu.Lock() defer ps.mu.Unlock() - if ps.stopped { - return func() {} - } - ps.subscribers[sub] = true if ps.msg != nil { @@ -102,14 +96,10 @@ func (ps *PubSub) Subscribe(sub Subscriber) (cancel func()) { // Publish publishes the provided message to the PubSub, and invokes // callbacks registered by subscribers asynchronously. -func (ps *PubSub) Publish(msg interface{}) { +func (ps *PubSub) Publish(msg any) { ps.mu.Lock() defer ps.mu.Unlock() - if ps.stopped { - return - } - ps.msg = msg for sub := range ps.subscribers { s := sub @@ -124,13 +114,8 @@ func (ps *PubSub) Publish(msg interface{}) { } } -// Stop shuts down the PubSub and releases any resources allocated by it. -// It is guaranteed that no subscriber callbacks would be invoked once this -// method returns. -func (ps *PubSub) Stop() { - ps.mu.Lock() - defer ps.mu.Unlock() - ps.stopped = true - - ps.cancel() +// Done returns a channel that is closed after the context passed to NewPubSub +// is canceled and all updates have been sent to subscribers. +func (ps *PubSub) Done() <-chan struct{} { + return ps.cs.Done() } diff --git a/vendor/google.golang.org/grpc/internal/internal.go b/vendor/google.golang.org/grpc/internal/internal.go index 42ff39c84..2549fe8e3 100644 --- a/vendor/google.golang.org/grpc/internal/internal.go +++ b/vendor/google.golang.org/grpc/internal/internal.go @@ -30,7 +30,7 @@ import ( var ( // WithHealthCheckFunc is set by dialoptions.go - WithHealthCheckFunc interface{} // func (HealthChecker) DialOption + WithHealthCheckFunc any // func (HealthChecker) DialOption // HealthCheckFunc is used to provide client-side LB channel health checking HealthCheckFunc HealthChecker // BalancerUnregister is exported by package balancer to unregister a balancer. @@ -38,8 +38,12 @@ var ( // KeepaliveMinPingTime is the minimum ping interval. This must be 10s by // default, but tests may wish to set it lower for convenience. KeepaliveMinPingTime = 10 * time.Second + // KeepaliveMinServerPingTime is the minimum ping interval for servers. + // This must be 1s by default, but tests may wish to set it lower for + // convenience. + KeepaliveMinServerPingTime = time.Second // ParseServiceConfig parses a JSON representation of the service config. - ParseServiceConfig interface{} // func(string) *serviceconfig.ParseResult + ParseServiceConfig any // func(string) *serviceconfig.ParseResult // EqualServiceConfigForTesting is for testing service config generation and // parsing. Both a and b should be returned by ParseServiceConfig. // This function compares the config without rawJSON stripped, in case the @@ -49,33 +53,38 @@ var ( // given name. This is set by package certprovider for use from xDS // bootstrap code while parsing certificate provider configs in the // bootstrap file. - GetCertificateProviderBuilder interface{} // func(string) certprovider.Builder + GetCertificateProviderBuilder any // func(string) certprovider.Builder // GetXDSHandshakeInfoForTesting returns a pointer to the xds.HandshakeInfo // stored in the passed in attributes. This is set by // credentials/xds/xds.go. - GetXDSHandshakeInfoForTesting interface{} // func (*attributes.Attributes) *xds.HandshakeInfo + GetXDSHandshakeInfoForTesting any // func (*attributes.Attributes) *xds.HandshakeInfo // GetServerCredentials returns the transport credentials configured on a // gRPC server. An xDS-enabled server needs to know what type of credentials // is configured on the underlying gRPC server. This is set by server.go. - GetServerCredentials interface{} // func (*grpc.Server) credentials.TransportCredentials + GetServerCredentials any // func (*grpc.Server) credentials.TransportCredentials // CanonicalString returns the canonical string of the code defined here: // https://github.com/grpc/grpc/blob/master/doc/statuscodes.md. // // This is used in the 1.0 release of gcp/observability, and thus must not be // deleted or changed. - CanonicalString interface{} // func (codes.Code) string + CanonicalString any // func (codes.Code) string // DrainServerTransports initiates a graceful close of existing connections // on a gRPC server accepted on the provided listener address. An // xDS-enabled server invokes this method on a grpc.Server when a particular // listener moves to "not-serving" mode. - DrainServerTransports interface{} // func(*grpc.Server, string) + DrainServerTransports any // func(*grpc.Server, string) + // IsRegisteredMethod returns whether the passed in method is registered as + // a method on the server. + IsRegisteredMethod any // func(*grpc.Server, string) bool + // ServerFromContext returns the server from the context. + ServerFromContext any // func(context.Context) *grpc.Server // AddGlobalServerOptions adds an array of ServerOption that will be // effective globally for newly created servers. The priority will be: 1. // user-provided; 2. this method; 3. default values. // // This is used in the 1.0 release of gcp/observability, and thus must not be // deleted or changed. - AddGlobalServerOptions interface{} // func(opt ...ServerOption) + AddGlobalServerOptions any // func(opt ...ServerOption) // ClearGlobalServerOptions clears the array of extra ServerOption. This // method is useful in testing and benchmarking. // @@ -88,14 +97,14 @@ var ( // // This is used in the 1.0 release of gcp/observability, and thus must not be // deleted or changed. - AddGlobalDialOptions interface{} // func(opt ...DialOption) + AddGlobalDialOptions any // func(opt ...DialOption) // DisableGlobalDialOptions returns a DialOption that prevents the // ClientConn from applying the global DialOptions (set via // AddGlobalDialOptions). // // This is used in the 1.0 release of gcp/observability, and thus must not be // deleted or changed. - DisableGlobalDialOptions interface{} // func() grpc.DialOption + DisableGlobalDialOptions any // func() grpc.DialOption // ClearGlobalDialOptions clears the array of extra DialOption. This // method is useful in testing and benchmarking. // @@ -104,23 +113,26 @@ var ( ClearGlobalDialOptions func() // JoinDialOptions combines the dial options passed as arguments into a // single dial option. - JoinDialOptions interface{} // func(...grpc.DialOption) grpc.DialOption + JoinDialOptions any // func(...grpc.DialOption) grpc.DialOption // JoinServerOptions combines the server options passed as arguments into a // single server option. - JoinServerOptions interface{} // func(...grpc.ServerOption) grpc.ServerOption + JoinServerOptions any // func(...grpc.ServerOption) grpc.ServerOption // WithBinaryLogger returns a DialOption that specifies the binary logger // for a ClientConn. // // This is used in the 1.0 release of gcp/observability, and thus must not be // deleted or changed. - WithBinaryLogger interface{} // func(binarylog.Logger) grpc.DialOption + WithBinaryLogger any // func(binarylog.Logger) grpc.DialOption // BinaryLogger returns a ServerOption that can set the binary logger for a // server. // // This is used in the 1.0 release of gcp/observability, and thus must not be // deleted or changed. - BinaryLogger interface{} // func(binarylog.Logger) grpc.ServerOption + BinaryLogger any // func(binarylog.Logger) grpc.ServerOption + + // SubscribeToConnectivityStateChanges adds a grpcsync.Subscriber to a provided grpc.ClientConn + SubscribeToConnectivityStateChanges any // func(*grpc.ClientConn, grpcsync.Subscriber) // NewXDSResolverWithConfigForTesting creates a new xds resolver builder using // the provided xds bootstrap config instead of the global configuration from @@ -131,7 +143,7 @@ var ( // // This function should ONLY be used for testing and may not work with some // other features, including the CSDS service. - NewXDSResolverWithConfigForTesting interface{} // func([]byte) (resolver.Builder, error) + NewXDSResolverWithConfigForTesting any // func([]byte) (resolver.Builder, error) // RegisterRLSClusterSpecifierPluginForTesting registers the RLS Cluster // Specifier Plugin for testing purposes, regardless of the XDSRLS environment @@ -163,7 +175,19 @@ var ( UnregisterRBACHTTPFilterForTesting func() // ORCAAllowAnyMinReportingInterval is for examples/orca use ONLY. - ORCAAllowAnyMinReportingInterval interface{} // func(so *orca.ServiceOptions) + ORCAAllowAnyMinReportingInterval any // func(so *orca.ServiceOptions) + + // GRPCResolverSchemeExtraMetadata determines when gRPC will add extra + // metadata to RPCs. + GRPCResolverSchemeExtraMetadata string = "xds" + + // EnterIdleModeForTesting gets the ClientConn to enter IDLE mode. + EnterIdleModeForTesting any // func(*grpc.ClientConn) + + // ExitIdleModeForTesting gets the ClientConn to exit IDLE mode. + ExitIdleModeForTesting any // func(*grpc.ClientConn) error + + ChannelzTurnOffForTesting func() ) // HealthChecker defines the signature of the client-side LB channel health checking function. @@ -174,7 +198,7 @@ var ( // // The health checking protocol is defined at: // https://github.com/grpc/grpc/blob/master/doc/health-checking.md -type HealthChecker func(ctx context.Context, newStream func(string) (interface{}, error), setConnectivityState func(connectivity.State, error), serviceName string) error +type HealthChecker func(ctx context.Context, newStream func(string) (any, error), setConnectivityState func(connectivity.State, error), serviceName string) error const ( // CredsBundleModeFallback switches GoogleDefaultCreds to fallback mode. diff --git a/vendor/google.golang.org/grpc/internal/metadata/metadata.go b/vendor/google.golang.org/grpc/internal/metadata/metadata.go index c82e608e0..900bfb716 100644 --- a/vendor/google.golang.org/grpc/internal/metadata/metadata.go +++ b/vendor/google.golang.org/grpc/internal/metadata/metadata.go @@ -35,7 +35,7 @@ const mdKey = mdKeyType("grpc.internal.address.metadata") type mdValue metadata.MD -func (m mdValue) Equal(o interface{}) bool { +func (m mdValue) Equal(o any) bool { om, ok := o.(mdValue) if !ok { return false diff --git a/vendor/google.golang.org/grpc/internal/pretty/pretty.go b/vendor/google.golang.org/grpc/internal/pretty/pretty.go index 0177af4b5..703319137 100644 --- a/vendor/google.golang.org/grpc/internal/pretty/pretty.go +++ b/vendor/google.golang.org/grpc/internal/pretty/pretty.go @@ -35,7 +35,7 @@ const jsonIndent = " " // ToJSON marshals the input into a json string. // // If marshal fails, it falls back to fmt.Sprintf("%+v"). -func ToJSON(e interface{}) string { +func ToJSON(e any) string { switch ee := e.(type) { case protov1.Message: mm := jsonpb.Marshaler{Indent: jsonIndent} diff --git a/vendor/google.golang.org/grpc/internal/resolver/config_selector.go b/vendor/google.golang.org/grpc/internal/resolver/config_selector.go index c7a18a948..f0603871c 100644 --- a/vendor/google.golang.org/grpc/internal/resolver/config_selector.go +++ b/vendor/google.golang.org/grpc/internal/resolver/config_selector.go @@ -92,7 +92,7 @@ type ClientStream interface { // calling RecvMsg on the same stream at the same time, but it is not safe // to call SendMsg on the same stream in different goroutines. It is also // not safe to call CloseSend concurrently with SendMsg. - SendMsg(m interface{}) error + SendMsg(m any) error // RecvMsg blocks until it receives a message into m or the stream is // done. It returns io.EOF when the stream completes successfully. On // any other error, the stream is aborted and the error contains the RPC @@ -101,7 +101,7 @@ type ClientStream interface { // It is safe to have a goroutine calling SendMsg and another goroutine // calling RecvMsg on the same stream at the same time, but it is not // safe to call RecvMsg on the same stream in different goroutines. - RecvMsg(m interface{}) error + RecvMsg(m any) error } // ClientInterceptor is an interceptor for gRPC client streams. diff --git a/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go b/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go index 99e1e5b36..b66dcb213 100644 --- a/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go +++ b/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go @@ -23,7 +23,6 @@ package dns import ( "context" "encoding/json" - "errors" "fmt" "net" "os" @@ -37,6 +36,7 @@ import ( "google.golang.org/grpc/internal/backoff" "google.golang.org/grpc/internal/envconfig" "google.golang.org/grpc/internal/grpcrand" + "google.golang.org/grpc/internal/resolver/dns/internal" "google.golang.org/grpc/resolver" "google.golang.org/grpc/serviceconfig" ) @@ -47,15 +47,11 @@ var EnableSRVLookups = false var logger = grpclog.Component("dns") -// Globals to stub out in tests. TODO: Perhaps these two can be combined into a -// single variable for testing the resolver? -var ( - newTimer = time.NewTimer - newTimerDNSResRate = time.NewTimer -) - func init() { resolver.Register(NewBuilder()) + internal.TimeAfterFunc = time.After + internal.NewNetResolver = newNetResolver + internal.AddressDialer = addressDialer } const ( @@ -70,23 +66,6 @@ const ( txtAttribute = "grpc_config=" ) -var ( - errMissingAddr = errors.New("dns resolver: missing address") - - // Addresses ending with a colon that is supposed to be the separator - // between host and port is not allowed. E.g. "::" is a valid address as - // it is an IPv6 address (host only) and "[::]:" is invalid as it ends with - // a colon as the host and port separator - errEndsWithColon = errors.New("dns resolver: missing port after port-separator colon") -) - -var ( - defaultResolver netResolver = net.DefaultResolver - // To prevent excessive re-resolution, we enforce a rate limit on DNS - // resolution requests. - minDNSResRate = 30 * time.Second -) - var addressDialer = func(address string) func(context.Context, string, string) (net.Conn, error) { return func(ctx context.Context, network, _ string) (net.Conn, error) { var dialer net.Dialer @@ -94,7 +73,11 @@ var addressDialer = func(address string) func(context.Context, string, string) ( } } -var newNetResolver = func(authority string) (netResolver, error) { +var newNetResolver = func(authority string) (internal.NetResolver, error) { + if authority == "" { + return net.DefaultResolver, nil + } + host, port, err := parseTarget(authority, defaultDNSSvrPort) if err != nil { return nil, err @@ -104,7 +87,7 @@ var newNetResolver = func(authority string) (netResolver, error) { return &net.Resolver{ PreferGo: true, - Dial: addressDialer(authorityWithPort), + Dial: internal.AddressDialer(authorityWithPort), }, nil } @@ -142,13 +125,9 @@ func (b *dnsBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts disableServiceConfig: opts.DisableServiceConfig, } - if target.URL.Host == "" { - d.resolver = defaultResolver - } else { - d.resolver, err = newNetResolver(target.URL.Host) - if err != nil { - return nil, err - } + d.resolver, err = internal.NewNetResolver(target.URL.Host) + if err != nil { + return nil, err } d.wg.Add(1) @@ -161,12 +140,6 @@ func (b *dnsBuilder) Scheme() string { return "dns" } -type netResolver interface { - LookupHost(ctx context.Context, host string) (addrs []string, err error) - LookupSRV(ctx context.Context, service, proto, name string) (cname string, addrs []*net.SRV, err error) - LookupTXT(ctx context.Context, name string) (txts []string, err error) -} - // deadResolver is a resolver that does nothing. type deadResolver struct{} @@ -178,7 +151,7 @@ func (deadResolver) Close() {} type dnsResolver struct { host string port string - resolver netResolver + resolver internal.NetResolver ctx context.Context cancel context.CancelFunc cc resolver.ClientConn @@ -223,29 +196,27 @@ func (d *dnsResolver) watcher() { err = d.cc.UpdateState(*state) } - var timer *time.Timer + var waitTime time.Duration if err == nil { // Success resolving, wait for the next ResolveNow. However, also wait 30 // seconds at the very least to prevent constantly re-resolving. backoffIndex = 1 - timer = newTimerDNSResRate(minDNSResRate) + waitTime = internal.MinResolutionRate select { case <-d.ctx.Done(): - timer.Stop() return case <-d.rn: } } else { // Poll on an error found in DNS Resolver or an error received from // ClientConn. - timer = newTimer(backoff.DefaultExponential.Backoff(backoffIndex)) + waitTime = backoff.DefaultExponential.Backoff(backoffIndex) backoffIndex++ } select { case <-d.ctx.Done(): - timer.Stop() return - case <-timer.C: + case <-internal.TimeAfterFunc(waitTime): } } } @@ -387,7 +358,7 @@ func formatIP(addr string) (addrIP string, ok bool) { // target: ":80" defaultPort: "443" returns host: "localhost", port: "80" func parseTarget(target, defaultPort string) (host, port string, err error) { if target == "" { - return "", "", errMissingAddr + return "", "", internal.ErrMissingAddr } if ip := net.ParseIP(target); ip != nil { // target is an IPv4 or IPv6(without brackets) address @@ -397,7 +368,7 @@ func parseTarget(target, defaultPort string) (host, port string, err error) { if port == "" { // If the port field is empty (target ends with colon), e.g. "[::1]:", // this is an error. - return "", "", errEndsWithColon + return "", "", internal.ErrEndsWithColon } // target has port, i.e ipv4-host:port, [ipv6-host]:port, host-name:port if host == "" { diff --git a/vendor/google.golang.org/grpc/internal/status/status.go b/vendor/google.golang.org/grpc/internal/status/status.go index b0ead4f54..03ef2fedd 100644 --- a/vendor/google.golang.org/grpc/internal/status/status.go +++ b/vendor/google.golang.org/grpc/internal/status/status.go @@ -43,13 +43,41 @@ type Status struct { s *spb.Status } +// NewWithProto returns a new status including details from statusProto. This +// is meant to be used by the gRPC library only. +func NewWithProto(code codes.Code, message string, statusProto []string) *Status { + if len(statusProto) != 1 { + // No grpc-status-details bin header, or multiple; just ignore. + return &Status{s: &spb.Status{Code: int32(code), Message: message}} + } + st := &spb.Status{} + if err := proto.Unmarshal([]byte(statusProto[0]), st); err != nil { + // Probably not a google.rpc.Status proto; do not provide details. + return &Status{s: &spb.Status{Code: int32(code), Message: message}} + } + if st.Code == int32(code) { + // The codes match between the grpc-status header and the + // grpc-status-details-bin header; use the full details proto. + return &Status{s: st} + } + return &Status{ + s: &spb.Status{ + Code: int32(codes.Internal), + Message: fmt.Sprintf( + "grpc-status-details-bin mismatch: grpc-status=%v, grpc-message=%q, grpc-status-details-bin=%+v", + code, message, st, + ), + }, + } +} + // New returns a Status representing c and msg. func New(c codes.Code, msg string) *Status { return &Status{s: &spb.Status{Code: int32(c), Message: msg}} } // Newf returns New(c, fmt.Sprintf(format, a...)). -func Newf(c codes.Code, format string, a ...interface{}) *Status { +func Newf(c codes.Code, format string, a ...any) *Status { return New(c, fmt.Sprintf(format, a...)) } @@ -64,7 +92,7 @@ func Err(c codes.Code, msg string) error { } // Errorf returns Error(c, fmt.Sprintf(format, a...)). -func Errorf(c codes.Code, format string, a ...interface{}) error { +func Errorf(c codes.Code, format string, a ...any) error { return Err(c, fmt.Sprintf(format, a...)) } @@ -120,11 +148,11 @@ func (s *Status) WithDetails(details ...proto.Message) (*Status, error) { // Details returns a slice of details messages attached to the status. // If a detail cannot be decoded, the error is returned in place of the detail. -func (s *Status) Details() []interface{} { +func (s *Status) Details() []any { if s == nil || s.s == nil { return nil } - details := make([]interface{}, 0, len(s.s.Details)) + details := make([]any, 0, len(s.s.Details)) for _, any := range s.s.Details { detail := &ptypes.DynamicAny{} if err := ptypes.UnmarshalAny(any, detail); err != nil { diff --git a/vendor/google.golang.org/grpc/internal/transport/controlbuf.go b/vendor/google.golang.org/grpc/internal/transport/controlbuf.go index be5a9c81e..b330ccedc 100644 --- a/vendor/google.golang.org/grpc/internal/transport/controlbuf.go +++ b/vendor/google.golang.org/grpc/internal/transport/controlbuf.go @@ -40,7 +40,7 @@ var updateHeaderTblSize = func(e *hpack.Encoder, v uint32) { } type itemNode struct { - it interface{} + it any next *itemNode } @@ -49,7 +49,7 @@ type itemList struct { tail *itemNode } -func (il *itemList) enqueue(i interface{}) { +func (il *itemList) enqueue(i any) { n := &itemNode{it: i} if il.tail == nil { il.head, il.tail = n, n @@ -61,11 +61,11 @@ func (il *itemList) enqueue(i interface{}) { // peek returns the first item in the list without removing it from the // list. -func (il *itemList) peek() interface{} { +func (il *itemList) peek() any { return il.head.it } -func (il *itemList) dequeue() interface{} { +func (il *itemList) dequeue() any { if il.head == nil { return nil } @@ -336,7 +336,7 @@ func (c *controlBuffer) put(it cbItem) error { return err } -func (c *controlBuffer) executeAndPut(f func(it interface{}) bool, it cbItem) (bool, error) { +func (c *controlBuffer) executeAndPut(f func(it any) bool, it cbItem) (bool, error) { var wakeUp bool c.mu.Lock() if c.err != nil { @@ -373,7 +373,7 @@ func (c *controlBuffer) executeAndPut(f func(it interface{}) bool, it cbItem) (b } // Note argument f should never be nil. -func (c *controlBuffer) execute(f func(it interface{}) bool, it interface{}) (bool, error) { +func (c *controlBuffer) execute(f func(it any) bool, it any) (bool, error) { c.mu.Lock() if c.err != nil { c.mu.Unlock() @@ -387,7 +387,7 @@ func (c *controlBuffer) execute(f func(it interface{}) bool, it interface{}) (bo return true, nil } -func (c *controlBuffer) get(block bool) (interface{}, error) { +func (c *controlBuffer) get(block bool) (any, error) { for { c.mu.Lock() if c.err != nil { @@ -830,7 +830,7 @@ func (l *loopyWriter) goAwayHandler(g *goAway) error { return nil } -func (l *loopyWriter) handle(i interface{}) error { +func (l *loopyWriter) handle(i any) error { switch i := i.(type) { case *incomingWindowUpdate: l.incomingWindowUpdateHandler(i) diff --git a/vendor/google.golang.org/grpc/internal/transport/handler_server.go b/vendor/google.golang.org/grpc/internal/transport/handler_server.go index 98f80e3fa..a9d70e2a1 100644 --- a/vendor/google.golang.org/grpc/internal/transport/handler_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/handler_server.go @@ -75,11 +75,25 @@ func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats []s return nil, errors.New(msg) } + var localAddr net.Addr + if la := r.Context().Value(http.LocalAddrContextKey); la != nil { + localAddr, _ = la.(net.Addr) + } + var authInfo credentials.AuthInfo + if r.TLS != nil { + authInfo = credentials.TLSInfo{State: *r.TLS, CommonAuthInfo: credentials.CommonAuthInfo{SecurityLevel: credentials.PrivacyAndIntegrity}} + } + p := peer.Peer{ + Addr: strAddr(r.RemoteAddr), + LocalAddr: localAddr, + AuthInfo: authInfo, + } st := &serverHandlerTransport{ rw: w, req: r, closedCh: make(chan struct{}), writes: make(chan func()), + peer: p, contentType: contentType, contentSubtype: contentSubtype, stats: stats, @@ -134,6 +148,8 @@ type serverHandlerTransport struct { headerMD metadata.MD + peer peer.Peer + closeOnce sync.Once closedCh chan struct{} // closed on Close @@ -165,7 +181,13 @@ func (ht *serverHandlerTransport) Close(err error) { }) } -func (ht *serverHandlerTransport) RemoteAddr() net.Addr { return strAddr(ht.req.RemoteAddr) } +func (ht *serverHandlerTransport) Peer() *peer.Peer { + return &peer.Peer{ + Addr: ht.peer.Addr, + LocalAddr: ht.peer.LocalAddr, + AuthInfo: ht.peer.AuthInfo, + } +} // strAddr is a net.Addr backed by either a TCP "ip:port" string, or // the empty string if unknown. @@ -220,18 +242,20 @@ func (ht *serverHandlerTransport) WriteStatus(s *Stream, st *status.Status) erro h.Set("Grpc-Message", encodeGrpcMessage(m)) } + s.hdrMu.Lock() if p := st.Proto(); p != nil && len(p.Details) > 0 { + delete(s.trailer, grpcStatusDetailsBinHeader) stBytes, err := proto.Marshal(p) if err != nil { // TODO: return error instead, when callers are able to handle it. panic(err) } - h.Set("Grpc-Status-Details-Bin", encodeBinHeader(stBytes)) + h.Set(grpcStatusDetailsBinHeader, encodeBinHeader(stBytes)) } - if md := s.Trailer(); len(md) > 0 { - for k, vv := range md { + if len(s.trailer) > 0 { + for k, vv := range s.trailer { // Clients don't tolerate reading restricted headers after some non restricted ones were sent. if isReservedHeader(k) { continue @@ -243,6 +267,7 @@ func (ht *serverHandlerTransport) WriteStatus(s *Stream, st *status.Status) erro } } } + s.hdrMu.Unlock() }) if err == nil { // transport has not been closed @@ -287,7 +312,7 @@ func (ht *serverHandlerTransport) writeCommonHeaders(s *Stream) { } // writeCustomHeaders sets custom headers set on the stream via SetHeader -// on the first write call (Write, WriteHeader, or WriteStatus). +// on the first write call (Write, WriteHeader, or WriteStatus) func (ht *serverHandlerTransport) writeCustomHeaders(s *Stream) { h := ht.rw.Header() @@ -344,10 +369,8 @@ func (ht *serverHandlerTransport) WriteHeader(s *Stream, md metadata.MD) error { return err } -func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), traceCtx func(context.Context, string) context.Context) { +func (ht *serverHandlerTransport) HandleStreams(ctx context.Context, startStream func(*Stream)) { // With this transport type there will be exactly 1 stream: this HTTP request. - - ctx := ht.req.Context() var cancel context.CancelFunc if ht.timeoutSet { ctx, cancel = context.WithTimeout(ctx, ht.timeout) @@ -367,34 +390,19 @@ func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), trace ht.Close(errors.New("request is done processing")) }() + ctx = metadata.NewIncomingContext(ctx, ht.headerMD) req := ht.req - s := &Stream{ - id: 0, // irrelevant - requestRead: func(int) {}, - cancel: cancel, - buf: newRecvBuffer(), - st: ht, - method: req.URL.Path, - recvCompress: req.Header.Get("grpc-encoding"), - contentSubtype: ht.contentSubtype, - } - pr := &peer.Peer{ - Addr: ht.RemoteAddr(), - } - if req.TLS != nil { - pr.AuthInfo = credentials.TLSInfo{State: *req.TLS, CommonAuthInfo: credentials.CommonAuthInfo{SecurityLevel: credentials.PrivacyAndIntegrity}} - } - ctx = metadata.NewIncomingContext(ctx, ht.headerMD) - s.ctx = peer.NewContext(ctx, pr) - for _, sh := range ht.stats { - s.ctx = sh.TagRPC(s.ctx, &stats.RPCTagInfo{FullMethodName: s.method}) - inHeader := &stats.InHeader{ - FullMethod: s.method, - RemoteAddr: ht.RemoteAddr(), - Compression: s.recvCompress, - } - sh.HandleRPC(s.ctx, inHeader) + id: 0, // irrelevant + ctx: ctx, + requestRead: func(int) {}, + cancel: cancel, + buf: newRecvBuffer(), + st: ht, + method: req.URL.Path, + recvCompress: req.Header.Get("grpc-encoding"), + contentSubtype: ht.contentSubtype, + headerWireLength: 0, // won't have access to header wire length until golang/go#18997. } s.trReader = &transportReader{ reader: &recvBufferReader{ctx: s.ctx, ctxDone: s.ctx.Done(), recv: s.buf, freeBuffer: func(*bytes.Buffer) {}}, diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_client.go b/vendor/google.golang.org/grpc/internal/transport/http2_client.go index 326bf0848..59f67655a 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_client.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_client.go @@ -36,6 +36,7 @@ import ( "golang.org/x/net/http2/hpack" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/internal" "google.golang.org/grpc/internal/channelz" icredentials "google.golang.org/grpc/internal/credentials" "google.golang.org/grpc/internal/grpclog" @@ -43,7 +44,7 @@ import ( "google.golang.org/grpc/internal/grpcutil" imetadata "google.golang.org/grpc/internal/metadata" istatus "google.golang.org/grpc/internal/status" - "google.golang.org/grpc/internal/syscall" + isyscall "google.golang.org/grpc/internal/syscall" "google.golang.org/grpc/internal/transport/networktype" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/metadata" @@ -176,7 +177,7 @@ func dial(ctx context.Context, fn func(context.Context, string) (net.Conn, error if networkType == "tcp" && useProxy { return proxyDial(ctx, address, grpcUA) } - return (&net.Dialer{}).DialContext(ctx, networkType, address) + return internal.NetDialerWithTCPKeepalive().DialContext(ctx, networkType, address) } func isTemporary(err error) bool { @@ -262,7 +263,7 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts } keepaliveEnabled := false if kp.Time != infinity { - if err = syscall.SetTCPUserTimeout(conn, kp.Timeout); err != nil { + if err = isyscall.SetTCPUserTimeout(conn, kp.Timeout); err != nil { return nil, connectionErrorf(false, err, "transport: failed to set TCP_USER_TIMEOUT: %v", err) } keepaliveEnabled = true @@ -330,7 +331,7 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts readerDone: make(chan struct{}), writerDone: make(chan struct{}), goAway: make(chan struct{}), - framer: newFramer(conn, writeBufSize, readBufSize, maxHeaderListSize), + framer: newFramer(conn, writeBufSize, readBufSize, opts.SharedWriteBuffer, maxHeaderListSize), fc: &trInFlow{limit: uint32(icwz)}, scheme: scheme, activeStreams: make(map[uint32]*Stream), @@ -493,8 +494,9 @@ func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr) *Stream { func (t *http2Client) getPeer() *peer.Peer { return &peer.Peer{ - Addr: t.remoteAddr, - AuthInfo: t.authInfo, // Can be nil + Addr: t.remoteAddr, + AuthInfo: t.authInfo, // Can be nil + LocalAddr: t.localAddr, } } @@ -762,7 +764,7 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*Stream, firstTry := true var ch chan struct{} transportDrainRequired := false - checkForStreamQuota := func(it interface{}) bool { + checkForStreamQuota := func(it any) bool { if t.streamQuota <= 0 { // Can go negative if server decreases it. if firstTry { t.waitingStreams++ @@ -800,7 +802,7 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*Stream, return true } var hdrListSizeErr error - checkForHeaderListSize := func(it interface{}) bool { + checkForHeaderListSize := func(it any) bool { if t.maxSendHeaderListSize == nil { return true } @@ -815,7 +817,7 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*Stream, return true } for { - success, err := t.controlBuf.executeAndPut(func(it interface{}) bool { + success, err := t.controlBuf.executeAndPut(func(it any) bool { return checkForHeaderListSize(it) && checkForStreamQuota(it) }, hdr) if err != nil { @@ -927,7 +929,7 @@ func (t *http2Client) closeStream(s *Stream, err error, rst bool, rstCode http2. rst: rst, rstCode: rstCode, } - addBackStreamQuota := func(interface{}) bool { + addBackStreamQuota := func(any) bool { t.streamQuota++ if t.streamQuota > 0 && t.waitingStreams > 0 { select { @@ -1080,7 +1082,7 @@ func (t *http2Client) updateWindow(s *Stream, n uint32) { // for the transport and the stream based on the current bdp // estimation. func (t *http2Client) updateFlowControl(n uint32) { - updateIWS := func(interface{}) bool { + updateIWS := func(any) bool { t.initialWindowSize = int32(n) t.mu.Lock() for _, s := range t.activeStreams { @@ -1233,7 +1235,7 @@ func (t *http2Client) handleSettings(f *http2.SettingsFrame, isFirst bool) { } updateFuncs = append(updateFuncs, updateStreamQuota) } - t.controlBuf.executeAndPut(func(interface{}) bool { + t.controlBuf.executeAndPut(func(any) bool { for _, f := range updateFuncs { f() } @@ -1399,7 +1401,6 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { mdata = make(map[string][]string) contentTypeErr = "malformed header: missing HTTP content-type" grpcMessage string - statusGen *status.Status recvCompress string httpStatusCode *int httpStatusErr string @@ -1434,12 +1435,6 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { rawStatusCode = codes.Code(uint32(code)) case "grpc-message": grpcMessage = decodeGrpcMessage(hf.Value) - case "grpc-status-details-bin": - var err error - statusGen, err = decodeGRPCStatusDetails(hf.Value) - if err != nil { - headerError = fmt.Sprintf("transport: malformed grpc-status-details-bin: %v", err) - } case ":status": if hf.Value == "200" { httpStatusErr = "" @@ -1505,14 +1500,15 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { return } - isHeader := false - - // If headerChan hasn't been closed yet - if atomic.CompareAndSwapUint32(&s.headerChanClosed, 0, 1) { - s.headerValid = true - if !endStream { - // HEADERS frame block carries a Response-Headers. - isHeader = true + // For headers, set them in s.header and close headerChan. For trailers or + // trailers-only, closeStream will set the trailers and close headerChan as + // needed. + if !endStream { + // If headerChan hasn't been closed yet (expected, given we checked it + // above, but something else could have potentially closed the whole + // stream). + if atomic.CompareAndSwapUint32(&s.headerChanClosed, 0, 1) { + s.headerValid = true // These values can be set without any synchronization because // stream goroutine will read it only after seeing a closed // headerChan which we'll close after setting this. @@ -1520,15 +1516,12 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { if len(mdata) > 0 { s.header = mdata } - } else { - // HEADERS frame block carries a Trailers-Only. - s.noHeaders = true + close(s.headerChan) } - close(s.headerChan) } for _, sh := range t.statsHandlers { - if isHeader { + if !endStream { inHeader := &stats.InHeader{ Client: true, WireLength: int(frame.Header().Length), @@ -1550,13 +1543,12 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { return } - if statusGen == nil { - statusGen = status.New(rawStatusCode, grpcMessage) - } + status := istatus.NewWithProto(rawStatusCode, grpcMessage, mdata[grpcStatusDetailsBinHeader]) - // if client received END_STREAM from server while stream was still active, send RST_STREAM - rst := s.getState() == streamActive - t.closeStream(s, io.EOF, rst, http2.ErrCodeNo, statusGen, mdata, true) + // If client received END_STREAM from server while stream was still active, + // send RST_STREAM. + rstStream := s.getState() == streamActive + t.closeStream(s, io.EOF, rstStream, http2.ErrCodeNo, status, mdata, true) } // readServerPreface reads and handles the initial settings frame from the diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_server.go b/vendor/google.golang.org/grpc/internal/transport/http2_server.go index f96064012..680c9eba0 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_server.go @@ -68,18 +68,15 @@ var serverConnectionCounter uint64 // http2Server implements the ServerTransport interface with HTTP2. type http2Server struct { - lastRead int64 // Keep this field 64-bit aligned. Accessed atomically. - ctx context.Context - done chan struct{} - conn net.Conn - loopy *loopyWriter - readerDone chan struct{} // sync point to enable testing. - writerDone chan struct{} // sync point to enable testing. - remoteAddr net.Addr - localAddr net.Addr - authInfo credentials.AuthInfo // auth info about the connection - inTapHandle tap.ServerInHandle - framer *framer + lastRead int64 // Keep this field 64-bit aligned. Accessed atomically. + done chan struct{} + conn net.Conn + loopy *loopyWriter + readerDone chan struct{} // sync point to enable testing. + loopyWriterDone chan struct{} + peer peer.Peer + inTapHandle tap.ServerInHandle + framer *framer // The max number of concurrent streams. maxStreams uint32 // controlBuf delivers all the control related tasks (e.g., window @@ -165,21 +162,16 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport, if config.MaxHeaderListSize != nil { maxHeaderListSize = *config.MaxHeaderListSize } - framer := newFramer(conn, writeBufSize, readBufSize, maxHeaderListSize) + framer := newFramer(conn, writeBufSize, readBufSize, config.SharedWriteBuffer, maxHeaderListSize) // Send initial settings as connection preface to client. isettings := []http2.Setting{{ ID: http2.SettingMaxFrameSize, Val: http2MaxFrameLen, }} - // TODO(zhaoq): Have a better way to signal "no limit" because 0 is - // permitted in the HTTP2 spec. - maxStreams := config.MaxStreams - if maxStreams == 0 { - maxStreams = math.MaxUint32 - } else { + if config.MaxStreams != math.MaxUint32 { isettings = append(isettings, http2.Setting{ ID: http2.SettingMaxConcurrentStreams, - Val: maxStreams, + Val: config.MaxStreams, }) } dynamicWindow := true @@ -248,17 +240,19 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport, } done := make(chan struct{}) + peer := peer.Peer{ + Addr: conn.RemoteAddr(), + LocalAddr: conn.LocalAddr(), + AuthInfo: authInfo, + } t := &http2Server{ - ctx: setConnection(context.Background(), rawConn), done: done, conn: conn, - remoteAddr: conn.RemoteAddr(), - localAddr: conn.LocalAddr(), - authInfo: authInfo, + peer: peer, framer: framer, readerDone: make(chan struct{}), - writerDone: make(chan struct{}), - maxStreams: maxStreams, + loopyWriterDone: make(chan struct{}), + maxStreams: config.MaxStreams, inTapHandle: config.InTapHandle, fc: &trInFlow{limit: uint32(icwz)}, state: reachable, @@ -272,8 +266,6 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport, bufferPool: newBufferPool(), } t.logger = prefixLoggerForServerTransport(t) - // Add peer information to the http2server context. - t.ctx = peer.NewContext(t.ctx, t.getPeer()) t.controlBuf = newControlBuffer(t.done) if dynamicWindow { @@ -282,15 +274,7 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport, updateFlowControl: t.updateFlowControl, } } - for _, sh := range t.stats { - t.ctx = sh.TagConn(t.ctx, &stats.ConnTagInfo{ - RemoteAddr: t.remoteAddr, - LocalAddr: t.localAddr, - }) - connBegin := &stats.ConnBegin{} - sh.HandleConn(t.ctx, connBegin) - } - t.channelzID, err = channelz.RegisterNormalSocket(t, config.ChannelzParentID, fmt.Sprintf("%s -> %s", t.remoteAddr, t.localAddr)) + t.channelzID, err = channelz.RegisterNormalSocket(t, config.ChannelzParentID, fmt.Sprintf("%s -> %s", t.peer.Addr, t.peer.LocalAddr)) if err != nil { return nil, err } @@ -339,7 +323,7 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport, t.loopy = newLoopyWriter(serverSide, t.framer, t.controlBuf, t.bdpEst, t.conn, t.logger) t.loopy.ssGoAwayHandler = t.outgoingGoAwayHandler t.loopy.run() - close(t.writerDone) + close(t.loopyWriterDone) }() go t.keepalive() return t, nil @@ -347,7 +331,7 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport, // operateHeaders takes action on the decoded headers. Returns an error if fatal // error encountered and transport needs to close, otherwise returns nil. -func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(*Stream), traceCtx func(context.Context, string) context.Context) error { +func (t *http2Server) operateHeaders(ctx context.Context, frame *http2.MetaHeadersFrame, handle func(*Stream)) error { // Acquire max stream ID lock for entire duration t.maxStreamMu.Lock() defer t.maxStreamMu.Unlock() @@ -374,10 +358,11 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( buf := newRecvBuffer() s := &Stream{ - id: streamID, - st: t, - buf: buf, - fc: &inFlow{limit: uint32(t.initialWindowSize)}, + id: streamID, + st: t, + buf: buf, + fc: &inFlow{limit: uint32(t.initialWindowSize)}, + headerWireLength: int(frame.Header().Length), } var ( // if false, content-type was missing or invalid @@ -516,9 +501,9 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( s.state = streamReadDone } if timeoutSet { - s.ctx, s.cancel = context.WithTimeout(t.ctx, timeout) + s.ctx, s.cancel = context.WithTimeout(ctx, timeout) } else { - s.ctx, s.cancel = context.WithCancel(t.ctx) + s.ctx, s.cancel = context.WithCancel(ctx) } // Attach the received metadata to the context. @@ -566,7 +551,7 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( } if t.inTapHandle != nil { var err error - if s.ctx, err = t.inTapHandle(s.ctx, &tap.Info{FullMethodName: s.method}); err != nil { + if s.ctx, err = t.inTapHandle(s.ctx, &tap.Info{FullMethodName: s.method, Header: mdata}); err != nil { t.mu.Unlock() if t.logger.V(logLevel) { t.logger.Infof("Aborting the stream early due to InTapHandle failure: %v", err) @@ -597,19 +582,6 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( s.requestRead = func(n int) { t.adjustWindow(s, uint32(n)) } - s.ctx = traceCtx(s.ctx, s.method) - for _, sh := range t.stats { - s.ctx = sh.TagRPC(s.ctx, &stats.RPCTagInfo{FullMethodName: s.method}) - inHeader := &stats.InHeader{ - FullMethod: s.method, - RemoteAddr: t.remoteAddr, - LocalAddr: t.localAddr, - Compression: s.recvCompress, - WireLength: int(frame.Header().Length), - Header: mdata.Copy(), - } - sh.HandleRPC(s.ctx, inHeader) - } s.ctxDone = s.ctx.Done() s.wq = newWriteQuota(defaultWriteQuota, s.ctxDone) s.trReader = &transportReader{ @@ -635,8 +607,11 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( // HandleStreams receives incoming streams using the given handler. This is // typically run in a separate goroutine. // traceCtx attaches trace to ctx and returns the new context. -func (t *http2Server) HandleStreams(handle func(*Stream), traceCtx func(context.Context, string) context.Context) { - defer close(t.readerDone) +func (t *http2Server) HandleStreams(ctx context.Context, handle func(*Stream)) { + defer func() { + <-t.loopyWriterDone + close(t.readerDone) + }() for { t.controlBuf.throttle() frame, err := t.framer.fr.ReadFrame() @@ -670,7 +645,7 @@ func (t *http2Server) HandleStreams(handle func(*Stream), traceCtx func(context. } switch frame := frame.(type) { case *http2.MetaHeadersFrame: - if err := t.operateHeaders(frame, handle, traceCtx); err != nil { + if err := t.operateHeaders(ctx, frame, handle); err != nil { t.Close(err) break } @@ -855,7 +830,7 @@ func (t *http2Server) handleSettings(f *http2.SettingsFrame) { } return nil }) - t.controlBuf.executeAndPut(func(interface{}) bool { + t.controlBuf.executeAndPut(func(any) bool { for _, f := range updateFuncs { f() } @@ -939,7 +914,7 @@ func appendHeaderFieldsFromMD(headerFields []hpack.HeaderField, md metadata.MD) return headerFields } -func (t *http2Server) checkForHeaderListSize(it interface{}) bool { +func (t *http2Server) checkForHeaderListSize(it any) bool { if t.maxSendHeaderListSize == nil { return true } @@ -1058,12 +1033,15 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error { headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-message", Value: encodeGrpcMessage(st.Message())}) if p := st.Proto(); p != nil && len(p.Details) > 0 { + // Do not use the user's grpc-status-details-bin (if present) if we are + // even attempting to set our own. + delete(s.trailer, grpcStatusDetailsBinHeader) stBytes, err := proto.Marshal(p) if err != nil { // TODO: return error instead, when callers are able to handle it. t.logger.Errorf("Failed to marshal rpc status: %s, error: %v", pretty.ToJSON(p), err) } else { - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-status-details-bin", Value: encodeBinHeader(stBytes)}) + headerFields = append(headerFields, hpack.HeaderField{Name: grpcStatusDetailsBinHeader, Value: encodeBinHeader(stBytes)}) } } @@ -1245,10 +1223,6 @@ func (t *http2Server) Close(err error) { for _, s := range streams { s.cancel() } - for _, sh := range t.stats { - connEnd := &stats.ConnEnd{} - sh.HandleConn(t.ctx, connEnd) - } } // deleteStream deletes the stream s from transport's active streams. @@ -1314,10 +1288,6 @@ func (t *http2Server) closeStream(s *Stream, rst bool, rstCode http2.ErrCode, eo }) } -func (t *http2Server) RemoteAddr() net.Addr { - return t.remoteAddr -} - func (t *http2Server) Drain(debugData string) { t.mu.Lock() defer t.mu.Unlock() @@ -1400,11 +1370,11 @@ func (t *http2Server) ChannelzMetric() *channelz.SocketInternalMetric { LastMessageReceivedTimestamp: time.Unix(0, atomic.LoadInt64(&t.czData.lastMsgRecvTime)), LocalFlowControlWindow: int64(t.fc.getSize()), SocketOptions: channelz.GetSocketOption(t.conn), - LocalAddr: t.localAddr, - RemoteAddr: t.remoteAddr, + LocalAddr: t.peer.LocalAddr, + RemoteAddr: t.peer.Addr, // RemoteName : } - if au, ok := t.authInfo.(credentials.ChannelzSecurityInfo); ok { + if au, ok := t.peer.AuthInfo.(credentials.ChannelzSecurityInfo); ok { s.Security = au.GetSecurityValue() } s.RemoteFlowControlWindow = t.getOutFlowWindow() @@ -1436,10 +1406,12 @@ func (t *http2Server) getOutFlowWindow() int64 { } } -func (t *http2Server) getPeer() *peer.Peer { +// Peer returns the peer of the transport. +func (t *http2Server) Peer() *peer.Peer { return &peer.Peer{ - Addr: t.remoteAddr, - AuthInfo: t.authInfo, // Can be nil + Addr: t.peer.Addr, + LocalAddr: t.peer.LocalAddr, + AuthInfo: t.peer.AuthInfo, // Can be nil } } @@ -1464,6 +1436,6 @@ func GetConnection(ctx context.Context) net.Conn { // SetConnection adds the connection to the context to be able to get // information about the destination ip and port for an incoming RPC. This also // allows any unary or streaming interceptors to see the connection. -func setConnection(ctx context.Context, conn net.Conn) context.Context { +func SetConnection(ctx context.Context, conn net.Conn) context.Context { return context.WithValue(ctx, connectionKey{}, conn) } diff --git a/vendor/google.golang.org/grpc/internal/transport/http_util.go b/vendor/google.golang.org/grpc/internal/transport/http_util.go index 19cbb18f5..dc29d590e 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http_util.go +++ b/vendor/google.golang.org/grpc/internal/transport/http_util.go @@ -30,15 +30,13 @@ import ( "net/url" "strconv" "strings" + "sync" "time" "unicode/utf8" - "github.com/golang/protobuf/proto" "golang.org/x/net/http2" "golang.org/x/net/http2/hpack" - spb "google.golang.org/genproto/googleapis/rpc/status" "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) const ( @@ -87,6 +85,8 @@ var ( } ) +var grpcStatusDetailsBinHeader = "grpc-status-details-bin" + // isReservedHeader checks whether hdr belongs to HTTP2 headers // reserved by gRPC protocol. Any other headers are classified as the // user-specified metadata. @@ -102,7 +102,6 @@ func isReservedHeader(hdr string) bool { "grpc-message", "grpc-status", "grpc-timeout", - "grpc-status-details-bin", // Intentionally exclude grpc-previous-rpc-attempts and // grpc-retry-pushback-ms, which are "reserved", but their API // intentionally works via metadata. @@ -153,18 +152,6 @@ func decodeMetadataHeader(k, v string) (string, error) { return v, nil } -func decodeGRPCStatusDetails(rawDetails string) (*status.Status, error) { - v, err := decodeBinHeader(rawDetails) - if err != nil { - return nil, err - } - st := &spb.Status{} - if err = proto.Unmarshal(v, st); err != nil { - return nil, err - } - return status.FromProto(st), nil -} - type timeoutUnit uint8 const ( @@ -309,6 +296,7 @@ func decodeGrpcMessageUnchecked(msg string) string { } type bufWriter struct { + pool *sync.Pool buf []byte offset int batchSize int @@ -316,12 +304,17 @@ type bufWriter struct { err error } -func newBufWriter(conn net.Conn, batchSize int) *bufWriter { - return &bufWriter{ - buf: make([]byte, batchSize*2), +func newBufWriter(conn net.Conn, batchSize int, pool *sync.Pool) *bufWriter { + w := &bufWriter{ batchSize: batchSize, conn: conn, + pool: pool, + } + // this indicates that we should use non shared buf + if pool == nil { + w.buf = make([]byte, batchSize) } + return w } func (w *bufWriter) Write(b []byte) (n int, err error) { @@ -332,19 +325,34 @@ func (w *bufWriter) Write(b []byte) (n int, err error) { n, err = w.conn.Write(b) return n, toIOError(err) } + if w.buf == nil { + b := w.pool.Get().(*[]byte) + w.buf = *b + } for len(b) > 0 { nn := copy(w.buf[w.offset:], b) b = b[nn:] w.offset += nn n += nn if w.offset >= w.batchSize { - err = w.Flush() + err = w.flushKeepBuffer() } } return n, err } func (w *bufWriter) Flush() error { + err := w.flushKeepBuffer() + // Only release the buffer if we are in a "shared" mode + if w.buf != nil && w.pool != nil { + b := w.buf + w.pool.Put(&b) + w.buf = nil + } + return err +} + +func (w *bufWriter) flushKeepBuffer() error { if w.err != nil { return w.err } @@ -381,7 +389,10 @@ type framer struct { fr *http2.Framer } -func newFramer(conn net.Conn, writeBufferSize, readBufferSize int, maxHeaderListSize uint32) *framer { +var writeBufferPoolMap map[int]*sync.Pool = make(map[int]*sync.Pool) +var writeBufferMutex sync.Mutex + +func newFramer(conn net.Conn, writeBufferSize, readBufferSize int, sharedWriteBuffer bool, maxHeaderListSize uint32) *framer { if writeBufferSize < 0 { writeBufferSize = 0 } @@ -389,7 +400,11 @@ func newFramer(conn net.Conn, writeBufferSize, readBufferSize int, maxHeaderList if readBufferSize > 0 { r = bufio.NewReaderSize(r, readBufferSize) } - w := newBufWriter(conn, writeBufferSize) + var pool *sync.Pool + if sharedWriteBuffer { + pool = getWriteBufferPool(writeBufferSize) + } + w := newBufWriter(conn, writeBufferSize, pool) f := &framer{ writer: w, fr: http2.NewFramer(w, r), @@ -403,6 +418,24 @@ func newFramer(conn net.Conn, writeBufferSize, readBufferSize int, maxHeaderList return f } +func getWriteBufferPool(writeBufferSize int) *sync.Pool { + writeBufferMutex.Lock() + defer writeBufferMutex.Unlock() + size := writeBufferSize * 2 + pool, ok := writeBufferPoolMap[size] + if ok { + return pool + } + pool = &sync.Pool{ + New: func() any { + b := make([]byte, size) + return &b + }, + } + writeBufferPoolMap[size] = pool + return pool +} + // parseDialTarget returns the network and address to pass to dialer. func parseDialTarget(target string) (string, string) { net := "tcp" diff --git a/vendor/google.golang.org/grpc/internal/transport/proxy.go b/vendor/google.golang.org/grpc/internal/transport/proxy.go index 415961987..24fa10325 100644 --- a/vendor/google.golang.org/grpc/internal/transport/proxy.go +++ b/vendor/google.golang.org/grpc/internal/transport/proxy.go @@ -28,6 +28,8 @@ import ( "net/http" "net/http/httputil" "net/url" + + "google.golang.org/grpc/internal" ) const proxyAuthHeaderKey = "Proxy-Authorization" @@ -112,7 +114,7 @@ func doHTTPConnectHandshake(ctx context.Context, conn net.Conn, backendAddr stri // proxyDial dials, connecting to a proxy first if necessary. Checks if a proxy // is necessary, dials, does the HTTP CONNECT handshake, and returns the // connection. -func proxyDial(ctx context.Context, addr string, grpcUA string) (conn net.Conn, err error) { +func proxyDial(ctx context.Context, addr string, grpcUA string) (net.Conn, error) { newAddr := addr proxyURL, err := mapAddress(addr) if err != nil { @@ -122,15 +124,15 @@ func proxyDial(ctx context.Context, addr string, grpcUA string) (conn net.Conn, newAddr = proxyURL.Host } - conn, err = (&net.Dialer{}).DialContext(ctx, "tcp", newAddr) + conn, err := internal.NetDialerWithTCPKeepalive().DialContext(ctx, "tcp", newAddr) if err != nil { - return + return nil, err } - if proxyURL != nil { + if proxyURL == nil { // proxy is disabled if proxyURL is nil. - conn, err = doHTTPConnectHandshake(ctx, conn, addr, proxyURL, grpcUA) + return conn, err } - return + return doHTTPConnectHandshake(ctx, conn, addr, proxyURL, grpcUA) } func sendHTTPRequest(ctx context.Context, req *http.Request, conn net.Conn) error { diff --git a/vendor/google.golang.org/grpc/internal/transport/transport.go b/vendor/google.golang.org/grpc/internal/transport/transport.go index aa1c89659..b7b8fec18 100644 --- a/vendor/google.golang.org/grpc/internal/transport/transport.go +++ b/vendor/google.golang.org/grpc/internal/transport/transport.go @@ -37,16 +37,13 @@ import ( "google.golang.org/grpc/internal/channelz" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/metadata" + "google.golang.org/grpc/peer" "google.golang.org/grpc/resolver" "google.golang.org/grpc/stats" "google.golang.org/grpc/status" "google.golang.org/grpc/tap" ) -// ErrNoHeaders is used as a signal that a trailers only response was received, -// and is not a real error. -var ErrNoHeaders = errors.New("stream has no headers") - const logLevel = 2 type bufferPool struct { @@ -56,7 +53,7 @@ type bufferPool struct { func newBufferPool() *bufferPool { return &bufferPool{ pool: sync.Pool{ - New: func() interface{} { + New: func() any { return new(bytes.Buffer) }, }, @@ -269,7 +266,8 @@ type Stream struct { // headerValid indicates whether a valid header was received. Only // meaningful after headerChan is closed (always call waitOnHeader() before // reading its value). Not valid on server side. - headerValid bool + headerValid bool + headerWireLength int // Only set on server side. // hdrMu protects header and trailer metadata on the server-side. hdrMu sync.Mutex @@ -390,14 +388,10 @@ func (s *Stream) Header() (metadata.MD, error) { } s.waitOnHeader() - if !s.headerValid { + if !s.headerValid || s.noHeaders { return nil, s.status.Err() } - if s.noHeaders { - return nil, ErrNoHeaders - } - return s.header.Copy(), nil } @@ -433,6 +427,12 @@ func (s *Stream) Context() context.Context { return s.ctx } +// SetContext sets the context of the stream. This will be deleted once the +// stats handler callouts all move to gRPC layer. +func (s *Stream) SetContext(ctx context.Context) { + s.ctx = ctx +} + // Method returns the method for the stream. func (s *Stream) Method() string { return s.method @@ -445,6 +445,12 @@ func (s *Stream) Status() *status.Status { return s.status } +// HeaderWireLength returns the size of the headers of the stream as received +// from the wire. Valid only on the server. +func (s *Stream) HeaderWireLength() int { + return s.headerWireLength +} + // SetHeader sets the header metadata. This can be called multiple times. // Server side only. // This should not be called in parallel to other data writes. @@ -559,6 +565,7 @@ type ServerConfig struct { InitialConnWindowSize int32 WriteBufferSize int ReadBufferSize int + SharedWriteBuffer bool ChannelzParentID *channelz.Identifier MaxHeaderListSize *uint32 HeaderTableSize *uint32 @@ -592,6 +599,8 @@ type ConnectOptions struct { WriteBufferSize int // ReadBufferSize sets the size of read buffer, which in turn determines how much data can be read at most for one read syscall. ReadBufferSize int + // SharedWriteBuffer indicates whether connections should reuse write buffer + SharedWriteBuffer bool // ChannelzParentID sets the addrConn id which initiate the creation of this client transport. ChannelzParentID *channelz.Identifier // MaxHeaderListSize sets the max (uncompressed) size of header list that is prepared to be received. @@ -703,7 +712,7 @@ type ClientTransport interface { // Write methods for a given Stream will be called serially. type ServerTransport interface { // HandleStreams receives incoming streams using the given handler. - HandleStreams(func(*Stream), func(context.Context, string) context.Context) + HandleStreams(context.Context, func(*Stream)) // WriteHeader sends the header metadata for the given stream. // WriteHeader may not be called on all streams. @@ -722,8 +731,8 @@ type ServerTransport interface { // handlers will be terminated asynchronously. Close(err error) - // RemoteAddr returns the remote network address. - RemoteAddr() net.Addr + // Peer returns the peer of the server transport. + Peer() *peer.Peer // Drain notifies the client this ServerTransport stops accepting new RPCs. Drain(debugData string) @@ -736,7 +745,7 @@ type ServerTransport interface { } // connectionErrorf creates an ConnectionError with the specified error description. -func connectionErrorf(temp bool, e error, format string, a ...interface{}) ConnectionError { +func connectionErrorf(temp bool, e error, format string, a ...any) ConnectionError { return ConnectionError{ Desc: fmt.Sprintf(format, a...), temp: temp, diff --git a/vendor/google.golang.org/grpc/metadata/metadata.go b/vendor/google.golang.org/grpc/metadata/metadata.go index a2cdcaf12..494468257 100644 --- a/vendor/google.golang.org/grpc/metadata/metadata.go +++ b/vendor/google.golang.org/grpc/metadata/metadata.go @@ -153,14 +153,16 @@ func Join(mds ...MD) MD { type mdIncomingKey struct{} type mdOutgoingKey struct{} -// NewIncomingContext creates a new context with incoming md attached. +// NewIncomingContext creates a new context with incoming md attached. md must +// not be modified after calling this function. func NewIncomingContext(ctx context.Context, md MD) context.Context { return context.WithValue(ctx, mdIncomingKey{}, md) } // NewOutgoingContext creates a new context with outgoing md attached. If used // in conjunction with AppendToOutgoingContext, NewOutgoingContext will -// overwrite any previously-appended metadata. +// overwrite any previously-appended metadata. md must not be modified after +// calling this function. func NewOutgoingContext(ctx context.Context, md MD) context.Context { return context.WithValue(ctx, mdOutgoingKey{}, rawMD{md: md}) } @@ -203,7 +205,8 @@ func FromIncomingContext(ctx context.Context) (MD, bool) { } // ValueFromIncomingContext returns the metadata value corresponding to the metadata -// key from the incoming metadata if it exists. Key must be lower-case. +// key from the incoming metadata if it exists. Keys are matched in a case insensitive +// manner. // // # Experimental // @@ -219,17 +222,16 @@ func ValueFromIncomingContext(ctx context.Context, key string) []string { return copyOf(v) } for k, v := range md { - // We need to manually convert all keys to lower case, because MD is a - // map, and there's no guarantee that the MD attached to the context is - // created using our helper functions. - if strings.ToLower(k) == key { + // Case insenitive comparison: MD is a map, and there's no guarantee + // that the MD attached to the context is created using our helper + // functions. + if strings.EqualFold(k, key) { return copyOf(v) } } return nil } -// the returned slice must not be modified in place func copyOf(v []string) []string { vals := make([]string, len(v)) copy(vals, v) diff --git a/vendor/google.golang.org/grpc/peer/peer.go b/vendor/google.golang.org/grpc/peer/peer.go index e01d219ff..a821ff9b2 100644 --- a/vendor/google.golang.org/grpc/peer/peer.go +++ b/vendor/google.golang.org/grpc/peer/peer.go @@ -32,6 +32,8 @@ import ( type Peer struct { // Addr is the peer address. Addr net.Addr + // LocalAddr is the local address. + LocalAddr net.Addr // AuthInfo is the authentication information of the transport. // It is nil if there is no transport security being used. AuthInfo credentials.AuthInfo diff --git a/vendor/google.golang.org/grpc/picker_wrapper.go b/vendor/google.golang.org/grpc/picker_wrapper.go index 02f975951..bf56faa76 100644 --- a/vendor/google.golang.org/grpc/picker_wrapper.go +++ b/vendor/google.golang.org/grpc/picker_wrapper.go @@ -28,31 +28,31 @@ import ( "google.golang.org/grpc/internal/channelz" istatus "google.golang.org/grpc/internal/status" "google.golang.org/grpc/internal/transport" + "google.golang.org/grpc/stats" "google.golang.org/grpc/status" ) // pickerWrapper is a wrapper of balancer.Picker. It blocks on certain pick // actions and unblock when there's a picker update. type pickerWrapper struct { - mu sync.Mutex - done bool - idle bool - blockingCh chan struct{} - picker balancer.Picker + mu sync.Mutex + done bool + blockingCh chan struct{} + picker balancer.Picker + statsHandlers []stats.Handler // to record blocking picker calls } -func newPickerWrapper() *pickerWrapper { - return &pickerWrapper{blockingCh: make(chan struct{})} +func newPickerWrapper(statsHandlers []stats.Handler) *pickerWrapper { + return &pickerWrapper{ + blockingCh: make(chan struct{}), + statsHandlers: statsHandlers, + } } // updatePicker is called by UpdateBalancerState. It unblocks all blocked pick. func (pw *pickerWrapper) updatePicker(p balancer.Picker) { pw.mu.Lock() - if pw.done || pw.idle { - // There is a small window where a picker update from the LB policy can - // race with the channel going to idle mode. If the picker is idle here, - // it is because the channel asked it to do so, and therefore it is sage - // to ignore the update from the LB policy. + if pw.done { pw.mu.Unlock() return } @@ -95,6 +95,7 @@ func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer. var ch chan struct{} var lastPickErr error + for { pw.mu.Lock() if pw.done { @@ -129,6 +130,20 @@ func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer. continue } + // If the channel is set, it means that the pick call had to wait for a + // new picker at some point. Either it's the first iteration and this + // function received the first picker, or a picker errored with + // ErrNoSubConnAvailable or errored with failfast set to false, which + // will trigger a continue to the next iteration. In the first case this + // conditional will hit if this call had to block (the channel is set). + // In the second case, the only way it will get to this conditional is + // if there is a new picker. + if ch != nil { + for _, sh := range pw.statsHandlers { + sh.HandleRPC(ctx, &stats.PickerUpdated{}) + } + } + ch = pw.blockingCh p := pw.picker pw.mu.Unlock() @@ -190,23 +205,15 @@ func (pw *pickerWrapper) close() { close(pw.blockingCh) } -func (pw *pickerWrapper) enterIdleMode() { - pw.mu.Lock() - defer pw.mu.Unlock() - if pw.done { - return - } - pw.idle = true -} - -func (pw *pickerWrapper) exitIdleMode() { +// reset clears the pickerWrapper and prepares it for being used again when idle +// mode is exited. +func (pw *pickerWrapper) reset() { pw.mu.Lock() defer pw.mu.Unlock() if pw.done { return } pw.blockingCh = make(chan struct{}) - pw.idle = false } // dropError is a wrapper error that indicates the LB policy wishes to drop the diff --git a/vendor/google.golang.org/grpc/pickfirst.go b/vendor/google.golang.org/grpc/pickfirst.go index abe266b02..5128f9364 100644 --- a/vendor/google.golang.org/grpc/pickfirst.go +++ b/vendor/google.golang.org/grpc/pickfirst.go @@ -25,13 +25,18 @@ import ( "google.golang.org/grpc/balancer" "google.golang.org/grpc/connectivity" - "google.golang.org/grpc/internal/envconfig" + internalgrpclog "google.golang.org/grpc/internal/grpclog" "google.golang.org/grpc/internal/grpcrand" + "google.golang.org/grpc/internal/pretty" + "google.golang.org/grpc/resolver" "google.golang.org/grpc/serviceconfig" ) -// PickFirstBalancerName is the name of the pick_first balancer. -const PickFirstBalancerName = "pick_first" +const ( + // PickFirstBalancerName is the name of the pick_first balancer. + PickFirstBalancerName = "pick_first" + logPrefix = "[pick-first-lb %p] " +) func newPickfirstBuilder() balancer.Builder { return &pickfirstBuilder{} @@ -40,7 +45,9 @@ func newPickfirstBuilder() balancer.Builder { type pickfirstBuilder struct{} func (*pickfirstBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) balancer.Balancer { - return &pickfirstBalancer{cc: cc} + b := &pickfirstBalancer{cc: cc} + b.logger = internalgrpclog.NewPrefixLogger(logger, fmt.Sprintf(logPrefix, b)) + return b } func (*pickfirstBuilder) Name() string { @@ -57,23 +64,23 @@ type pfConfig struct { } func (*pickfirstBuilder) ParseConfig(js json.RawMessage) (serviceconfig.LoadBalancingConfig, error) { - cfg := &pfConfig{} - if err := json.Unmarshal(js, cfg); err != nil { + var cfg pfConfig + if err := json.Unmarshal(js, &cfg); err != nil { return nil, fmt.Errorf("pickfirst: unable to unmarshal LB policy config: %s, error: %v", string(js), err) } return cfg, nil } type pickfirstBalancer struct { + logger *internalgrpclog.PrefixLogger state connectivity.State cc balancer.ClientConn subConn balancer.SubConn - cfg *pfConfig } func (b *pickfirstBalancer) ResolverError(err error) { - if logger.V(2) { - logger.Infof("pickfirstBalancer: ResolverError called with error: %v", err) + if b.logger.V(2) { + b.logger.Infof("Received error from the name resolver: %v", err) } if b.subConn == nil { b.state = connectivity.TransientFailure @@ -96,35 +103,44 @@ func (b *pickfirstBalancer) UpdateClientConnState(state balancer.ClientConnState // The resolver reported an empty address list. Treat it like an error by // calling b.ResolverError. if b.subConn != nil { - // Remove the old subConn. All addresses were removed, so it is no longer - // valid. - b.cc.RemoveSubConn(b.subConn) + // Shut down the old subConn. All addresses were removed, so it is + // no longer valid. + b.subConn.Shutdown() b.subConn = nil } b.ResolverError(errors.New("produced zero addresses")) return balancer.ErrBadResolverState } - if state.BalancerConfig != nil { - cfg, ok := state.BalancerConfig.(*pfConfig) - if !ok { - return fmt.Errorf("pickfirstBalancer: received nil or illegal BalancerConfig (type %T): %v", state.BalancerConfig, state.BalancerConfig) - } - b.cfg = cfg + // We don't have to guard this block with the env var because ParseConfig + // already does so. + cfg, ok := state.BalancerConfig.(pfConfig) + if state.BalancerConfig != nil && !ok { + return fmt.Errorf("pickfirst: received illegal BalancerConfig (type %T): %v", state.BalancerConfig, state.BalancerConfig) } - - if envconfig.PickFirstLBConfig && b.cfg != nil && b.cfg.ShuffleAddressList { + if cfg.ShuffleAddressList { + addrs = append([]resolver.Address{}, addrs...) grpcrand.Shuffle(len(addrs), func(i, j int) { addrs[i], addrs[j] = addrs[j], addrs[i] }) } + + if b.logger.V(2) { + b.logger.Infof("Received new config %s, resolver state %s", pretty.ToJSON(cfg), pretty.ToJSON(state.ResolverState)) + } + if b.subConn != nil { b.cc.UpdateAddresses(b.subConn, addrs) return nil } - subConn, err := b.cc.NewSubConn(addrs, balancer.NewSubConnOptions{}) + var subConn balancer.SubConn + subConn, err := b.cc.NewSubConn(addrs, balancer.NewSubConnOptions{ + StateListener: func(state balancer.SubConnState) { + b.updateSubConnState(subConn, state) + }, + }) if err != nil { - if logger.V(2) { - logger.Errorf("pickfirstBalancer: failed to NewSubConn: %v", err) + if b.logger.V(2) { + b.logger.Infof("Failed to create new SubConn: %v", err) } b.state = connectivity.TransientFailure b.cc.UpdateState(balancer.State{ @@ -143,13 +159,19 @@ func (b *pickfirstBalancer) UpdateClientConnState(state balancer.ClientConnState return nil } +// UpdateSubConnState is unused as a StateListener is always registered when +// creating SubConns. func (b *pickfirstBalancer) UpdateSubConnState(subConn balancer.SubConn, state balancer.SubConnState) { - if logger.V(2) { - logger.Infof("pickfirstBalancer: UpdateSubConnState: %p, %v", subConn, state) + b.logger.Errorf("UpdateSubConnState(%v, %+v) called unexpectedly", subConn, state) +} + +func (b *pickfirstBalancer) updateSubConnState(subConn balancer.SubConn, state balancer.SubConnState) { + if b.logger.V(2) { + b.logger.Infof("Received SubConn state update: %p, %+v", subConn, state) } if b.subConn != subConn { - if logger.V(2) { - logger.Infof("pickfirstBalancer: ignored state change because subConn is not recognized") + if b.logger.V(2) { + b.logger.Infof("Ignored state change because subConn is not recognized") } return } diff --git a/vendor/google.golang.org/grpc/preloader.go b/vendor/google.golang.org/grpc/preloader.go index cd4554785..73bd63364 100644 --- a/vendor/google.golang.org/grpc/preloader.go +++ b/vendor/google.golang.org/grpc/preloader.go @@ -37,7 +37,7 @@ type PreparedMsg struct { } // Encode marshalls and compresses the message using the codec and compressor for the stream. -func (p *PreparedMsg) Encode(s Stream, msg interface{}) error { +func (p *PreparedMsg) Encode(s Stream, msg any) error { ctx := s.Context() rpcInfo, ok := rpcInfoFromContext(ctx) if !ok { diff --git a/vendor/google.golang.org/grpc/resolver/map.go b/vendor/google.golang.org/grpc/resolver/map.go index efcb7f3ef..ada5b9bb7 100644 --- a/vendor/google.golang.org/grpc/resolver/map.go +++ b/vendor/google.golang.org/grpc/resolver/map.go @@ -20,7 +20,7 @@ package resolver type addressMapEntry struct { addr Address - value interface{} + value any } // AddressMap is a map of addresses to arbitrary values taking into account @@ -69,7 +69,7 @@ func (l addressMapEntryList) find(addr Address) int { } // Get returns the value for the address in the map, if present. -func (a *AddressMap) Get(addr Address) (value interface{}, ok bool) { +func (a *AddressMap) Get(addr Address) (value any, ok bool) { addrKey := toMapKey(&addr) entryList := a.m[addrKey] if entry := entryList.find(addr); entry != -1 { @@ -79,7 +79,7 @@ func (a *AddressMap) Get(addr Address) (value interface{}, ok bool) { } // Set updates or adds the value to the address in the map. -func (a *AddressMap) Set(addr Address, value interface{}) { +func (a *AddressMap) Set(addr Address, value any) { addrKey := toMapKey(&addr) entryList := a.m[addrKey] if entry := entryList.find(addr); entry != -1 { @@ -127,8 +127,8 @@ func (a *AddressMap) Keys() []Address { } // Values returns a slice of all current map values. -func (a *AddressMap) Values() []interface{} { - ret := make([]interface{}, 0, a.Len()) +func (a *AddressMap) Values() []any { + ret := make([]any, 0, a.Len()) for _, entryList := range a.m { for _, entry := range entryList { ret = append(ret, entry.value) @@ -136,3 +136,116 @@ func (a *AddressMap) Values() []interface{} { } return ret } + +type endpointNode struct { + addrs map[string]struct{} +} + +// Equal returns whether the unordered set of addrs are the same between the +// endpoint nodes. +func (en *endpointNode) Equal(en2 *endpointNode) bool { + if len(en.addrs) != len(en2.addrs) { + return false + } + for addr := range en.addrs { + if _, ok := en2.addrs[addr]; !ok { + return false + } + } + return true +} + +func toEndpointNode(endpoint Endpoint) endpointNode { + en := make(map[string]struct{}) + for _, addr := range endpoint.Addresses { + en[addr.Addr] = struct{}{} + } + return endpointNode{ + addrs: en, + } +} + +// EndpointMap is a map of endpoints to arbitrary values keyed on only the +// unordered set of address strings within an endpoint. This map is not thread +// safe, thus it is unsafe to access concurrently. Must be created via +// NewEndpointMap; do not construct directly. +type EndpointMap struct { + endpoints map[*endpointNode]any +} + +// NewEndpointMap creates a new EndpointMap. +func NewEndpointMap() *EndpointMap { + return &EndpointMap{ + endpoints: make(map[*endpointNode]any), + } +} + +// Get returns the value for the address in the map, if present. +func (em *EndpointMap) Get(e Endpoint) (value any, ok bool) { + en := toEndpointNode(e) + if endpoint := em.find(en); endpoint != nil { + return em.endpoints[endpoint], true + } + return nil, false +} + +// Set updates or adds the value to the address in the map. +func (em *EndpointMap) Set(e Endpoint, value any) { + en := toEndpointNode(e) + if endpoint := em.find(en); endpoint != nil { + em.endpoints[endpoint] = value + return + } + em.endpoints[&en] = value +} + +// Len returns the number of entries in the map. +func (em *EndpointMap) Len() int { + return len(em.endpoints) +} + +// Keys returns a slice of all current map keys, as endpoints specifying the +// addresses present in the endpoint keys, in which uniqueness is determined by +// the unordered set of addresses. Thus, endpoint information returned is not +// the full endpoint data (drops duplicated addresses and attributes) but can be +// used for EndpointMap accesses. +func (em *EndpointMap) Keys() []Endpoint { + ret := make([]Endpoint, 0, len(em.endpoints)) + for en := range em.endpoints { + var endpoint Endpoint + for addr := range en.addrs { + endpoint.Addresses = append(endpoint.Addresses, Address{Addr: addr}) + } + ret = append(ret, endpoint) + } + return ret +} + +// Values returns a slice of all current map values. +func (em *EndpointMap) Values() []any { + ret := make([]any, 0, len(em.endpoints)) + for _, val := range em.endpoints { + ret = append(ret, val) + } + return ret +} + +// find returns a pointer to the endpoint node in em if the endpoint node is +// already present. If not found, nil is returned. The comparisons are done on +// the unordered set of addresses within an endpoint. +func (em EndpointMap) find(e endpointNode) *endpointNode { + for endpoint := range em.endpoints { + if e.Equal(endpoint) { + return endpoint + } + } + return nil +} + +// Delete removes the specified endpoint from the map. +func (em *EndpointMap) Delete(e Endpoint) { + en := toEndpointNode(e) + if entry := em.find(en); entry != nil { + delete(em.endpoints, entry) + } +} diff --git a/vendor/google.golang.org/grpc/resolver/resolver.go b/vendor/google.golang.org/grpc/resolver/resolver.go index d8db6f5d3..bd1c7d01b 100644 --- a/vendor/google.golang.org/grpc/resolver/resolver.go +++ b/vendor/google.golang.org/grpc/resolver/resolver.go @@ -77,25 +77,6 @@ func GetDefaultScheme() string { return defaultScheme } -// AddressType indicates the address type returned by name resolution. -// -// Deprecated: use Attributes in Address instead. -type AddressType uint8 - -const ( - // Backend indicates the address is for a backend server. - // - // Deprecated: use Attributes in Address instead. - Backend AddressType = iota - // GRPCLB indicates the address is for a grpclb load balancer. - // - // Deprecated: to select the GRPCLB load balancing policy, use a service - // config with a corresponding loadBalancingConfig. To supply balancer - // addresses to the GRPCLB load balancing policy, set State.Attributes - // using balancer/grpclb/state.Set. - GRPCLB -) - // Address represents a server the client connects to. // // # Experimental @@ -111,9 +92,6 @@ type Address struct { // the address, instead of the hostname from the Dial target string. In most cases, // this should not be set. // - // If Type is GRPCLB, ServerName should be the name of the remote load - // balancer, not the name of the backend. - // // WARNING: ServerName must only be populated with trusted values. It // is insecure to populate it with data from untrusted inputs since untrusted // values could be used to bypass the authority checks performed by TLS. @@ -126,18 +104,16 @@ type Address struct { // BalancerAttributes contains arbitrary data about this address intended // for consumption by the LB policy. These attributes do not affect SubConn // creation, connection establishment, handshaking, etc. - BalancerAttributes *attributes.Attributes - - // Type is the type of this address. // - // Deprecated: use Attributes instead. - Type AddressType + // Deprecated: when an Address is inside an Endpoint, this field should not + // be used, and it will eventually be removed entirely. + BalancerAttributes *attributes.Attributes // Metadata is the information associated with Addr, which may be used // to make load balancing decision. // // Deprecated: use Attributes instead. - Metadata interface{} + Metadata any } // Equal returns whether a and o are identical. Metadata is compared directly, @@ -150,7 +126,7 @@ func (a Address) Equal(o Address) bool { return a.Addr == o.Addr && a.ServerName == o.ServerName && a.Attributes.Equal(o.Attributes) && a.BalancerAttributes.Equal(o.BalancerAttributes) && - a.Type == o.Type && a.Metadata == o.Metadata + a.Metadata == o.Metadata } // String returns JSON formatted string representation of the address. @@ -194,11 +170,37 @@ type BuildOptions struct { Dialer func(context.Context, string) (net.Conn, error) } +// An Endpoint is one network endpoint, or server, which may have multiple +// addresses with which it can be accessed. +type Endpoint struct { + // Addresses contains a list of addresses used to access this endpoint. + Addresses []Address + + // Attributes contains arbitrary data about this endpoint intended for + // consumption by the LB policy. + Attributes *attributes.Attributes +} + // State contains the current Resolver state relevant to the ClientConn. type State struct { // Addresses is the latest set of resolved addresses for the target. + // + // If a resolver sets Addresses but does not set Endpoints, one Endpoint + // will be created for each Address before the State is passed to the LB + // policy. The BalancerAttributes of each entry in Addresses will be set + // in Endpoints.Attributes, and be cleared in the Endpoint's Address's + // BalancerAttributes. + // + // Soon, Addresses will be deprecated and replaced fully by Endpoints. Addresses []Address + // Endpoints is the latest set of resolved endpoints for the target. + // + // If a resolver produces a State containing Endpoints but not Addresses, + // it must take care to ensure the LB policies it selects will support + // Endpoints. + Endpoints []Endpoint + // ServiceConfig contains the result from parsing the latest service // config. If it is nil, it indicates no service config is present or the // resolver does not provide service configs. @@ -238,11 +240,6 @@ type ClientConn interface { // // Deprecated: Use UpdateState instead. NewAddress(addresses []Address) - // NewServiceConfig is called by resolver to notify ClientConn a new - // service config. The service config should be provided as a json string. - // - // Deprecated: Use UpdateState instead. - NewServiceConfig(serviceConfig string) // ParseServiceConfig parses the provided service config and returns an // object that provides the parsed config. ParseServiceConfig(serviceConfigJSON string) *serviceconfig.ParseResult @@ -258,15 +255,6 @@ type ClientConn interface { // target does not contain a scheme or if the parsed scheme is not registered // (i.e. no corresponding resolver available to resolve the endpoint), we will // apply the default scheme, and will attempt to reparse it. -// -// Examples: -// -// - "dns://some_authority/foo.bar" -// Target{Scheme: "dns", Authority: "some_authority", Endpoint: "foo.bar"} -// - "foo.bar" -// Target{Scheme: resolver.GetDefaultScheme(), Endpoint: "foo.bar"} -// - "unknown_scheme://authority/endpoint" -// Target{Scheme: resolver.GetDefaultScheme(), Endpoint: "unknown_scheme://authority/endpoint"} type Target struct { // URL contains the parsed dial target with an optional default scheme added // to it if the original dial target contained no scheme or contained an @@ -293,6 +281,11 @@ func (t Target) Endpoint() string { return strings.TrimPrefix(endpoint, "/") } +// String returns a string representation of Target. +func (t Target) String() string { + return t.URL.String() +} + // Builder creates a resolver that will be used to watch name resolution updates. type Builder interface { // Build creates a new resolver for the given target. @@ -321,10 +314,3 @@ type Resolver interface { // Close closes the resolver. Close() } - -// UnregisterForTesting removes the resolver builder with the given scheme from the -// resolver map. -// This function is for testing only. -func UnregisterForTesting(scheme string) { - delete(m, scheme) -} diff --git a/vendor/google.golang.org/grpc/resolver_conn_wrapper.go b/vendor/google.golang.org/grpc/resolver_conn_wrapper.go deleted file mode 100644 index b408b3688..000000000 --- a/vendor/google.golang.org/grpc/resolver_conn_wrapper.go +++ /dev/null @@ -1,239 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package grpc - -import ( - "context" - "strings" - "sync" - - "google.golang.org/grpc/balancer" - "google.golang.org/grpc/internal/channelz" - "google.golang.org/grpc/internal/grpcsync" - "google.golang.org/grpc/internal/pretty" - "google.golang.org/grpc/resolver" - "google.golang.org/grpc/serviceconfig" -) - -// resolverStateUpdater wraps the single method used by ccResolverWrapper to -// report a state update from the actual resolver implementation. -type resolverStateUpdater interface { - updateResolverState(s resolver.State, err error) error -} - -// ccResolverWrapper is a wrapper on top of cc for resolvers. -// It implements resolver.ClientConn interface. -type ccResolverWrapper struct { - // The following fields are initialized when the wrapper is created and are - // read-only afterwards, and therefore can be accessed without a mutex. - cc resolverStateUpdater - channelzID *channelz.Identifier - ignoreServiceConfig bool - opts ccResolverWrapperOpts - serializer *grpcsync.CallbackSerializer // To serialize all incoming calls. - serializerCancel context.CancelFunc // To close the serializer, accessed only from close(). - - // All incoming (resolver --> gRPC) calls are guaranteed to execute in a - // mutually exclusive manner as they are scheduled on the serializer. - // Fields accessed *only* in these serializer callbacks, can therefore be - // accessed without a mutex. - curState resolver.State - - // mu guards access to the below fields. - mu sync.Mutex - closed bool - resolver resolver.Resolver // Accessed only from outgoing calls. -} - -// ccResolverWrapperOpts wraps the arguments to be passed when creating a new -// ccResolverWrapper. -type ccResolverWrapperOpts struct { - target resolver.Target // User specified dial target to resolve. - builder resolver.Builder // Resolver builder to use. - bOpts resolver.BuildOptions // Resolver build options to use. - channelzID *channelz.Identifier // Channelz identifier for the channel. -} - -// newCCResolverWrapper uses the resolver.Builder to build a Resolver and -// returns a ccResolverWrapper object which wraps the newly built resolver. -func newCCResolverWrapper(cc resolverStateUpdater, opts ccResolverWrapperOpts) (*ccResolverWrapper, error) { - ctx, cancel := context.WithCancel(context.Background()) - ccr := &ccResolverWrapper{ - cc: cc, - channelzID: opts.channelzID, - ignoreServiceConfig: opts.bOpts.DisableServiceConfig, - opts: opts, - serializer: grpcsync.NewCallbackSerializer(ctx), - serializerCancel: cancel, - } - - // Cannot hold the lock at build time because the resolver can send an - // update or error inline and these incoming calls grab the lock to schedule - // a callback in the serializer. - r, err := opts.builder.Build(opts.target, ccr, opts.bOpts) - if err != nil { - cancel() - return nil, err - } - - // Any error reported by the resolver at build time that leads to a - // re-resolution request from the balancer is dropped by grpc until we - // return from this function. So, we don't have to handle pending resolveNow - // requests here. - ccr.mu.Lock() - ccr.resolver = r - ccr.mu.Unlock() - - return ccr, nil -} - -func (ccr *ccResolverWrapper) resolveNow(o resolver.ResolveNowOptions) { - ccr.mu.Lock() - defer ccr.mu.Unlock() - - // ccr.resolver field is set only after the call to Build() returns. But in - // the process of building, the resolver may send an error update which when - // propagated to the balancer may result in a re-resolution request. - if ccr.closed || ccr.resolver == nil { - return - } - ccr.resolver.ResolveNow(o) -} - -func (ccr *ccResolverWrapper) close() { - ccr.mu.Lock() - if ccr.closed { - ccr.mu.Unlock() - return - } - - channelz.Info(logger, ccr.channelzID, "Closing the name resolver") - - // Close the serializer to ensure that no more calls from the resolver are - // handled, before actually closing the resolver. - ccr.serializerCancel() - ccr.closed = true - r := ccr.resolver - ccr.mu.Unlock() - - // Give enqueued callbacks a chance to finish. - <-ccr.serializer.Done - - // Spawn a goroutine to close the resolver (since it may block trying to - // cleanup all allocated resources) and return early. - go r.Close() -} - -// serializerScheduleLocked is a convenience method to schedule a function to be -// run on the serializer while holding ccr.mu. -func (ccr *ccResolverWrapper) serializerScheduleLocked(f func(context.Context)) { - ccr.mu.Lock() - ccr.serializer.Schedule(f) - ccr.mu.Unlock() -} - -// UpdateState is called by resolver implementations to report new state to gRPC -// which includes addresses and service config. -func (ccr *ccResolverWrapper) UpdateState(s resolver.State) error { - errCh := make(chan error, 1) - ok := ccr.serializer.Schedule(func(context.Context) { - ccr.addChannelzTraceEvent(s) - ccr.curState = s - if err := ccr.cc.updateResolverState(ccr.curState, nil); err == balancer.ErrBadResolverState { - errCh <- balancer.ErrBadResolverState - return - } - errCh <- nil - }) - if !ok { - // The only time when Schedule() fail to add the callback to the - // serializer is when the serializer is closed, and this happens only - // when the resolver wrapper is closed. - return nil - } - return <-errCh -} - -// ReportError is called by resolver implementations to report errors -// encountered during name resolution to gRPC. -func (ccr *ccResolverWrapper) ReportError(err error) { - ccr.serializerScheduleLocked(func(_ context.Context) { - channelz.Warningf(logger, ccr.channelzID, "ccResolverWrapper: reporting error to cc: %v", err) - ccr.cc.updateResolverState(resolver.State{}, err) - }) -} - -// NewAddress is called by the resolver implementation to send addresses to -// gRPC. -func (ccr *ccResolverWrapper) NewAddress(addrs []resolver.Address) { - ccr.serializerScheduleLocked(func(_ context.Context) { - ccr.addChannelzTraceEvent(resolver.State{Addresses: addrs, ServiceConfig: ccr.curState.ServiceConfig}) - ccr.curState.Addresses = addrs - ccr.cc.updateResolverState(ccr.curState, nil) - }) -} - -// NewServiceConfig is called by the resolver implementation to send service -// configs to gRPC. -func (ccr *ccResolverWrapper) NewServiceConfig(sc string) { - ccr.serializerScheduleLocked(func(_ context.Context) { - channelz.Infof(logger, ccr.channelzID, "ccResolverWrapper: got new service config: %s", sc) - if ccr.ignoreServiceConfig { - channelz.Info(logger, ccr.channelzID, "Service config lookups disabled; ignoring config") - return - } - scpr := parseServiceConfig(sc) - if scpr.Err != nil { - channelz.Warningf(logger, ccr.channelzID, "ccResolverWrapper: error parsing service config: %v", scpr.Err) - return - } - ccr.addChannelzTraceEvent(resolver.State{Addresses: ccr.curState.Addresses, ServiceConfig: scpr}) - ccr.curState.ServiceConfig = scpr - ccr.cc.updateResolverState(ccr.curState, nil) - }) -} - -// ParseServiceConfig is called by resolver implementations to parse a JSON -// representation of the service config. -func (ccr *ccResolverWrapper) ParseServiceConfig(scJSON string) *serviceconfig.ParseResult { - return parseServiceConfig(scJSON) -} - -// addChannelzTraceEvent adds a channelz trace event containing the new -// state received from resolver implementations. -func (ccr *ccResolverWrapper) addChannelzTraceEvent(s resolver.State) { - var updates []string - var oldSC, newSC *ServiceConfig - var oldOK, newOK bool - if ccr.curState.ServiceConfig != nil { - oldSC, oldOK = ccr.curState.ServiceConfig.Config.(*ServiceConfig) - } - if s.ServiceConfig != nil { - newSC, newOK = s.ServiceConfig.Config.(*ServiceConfig) - } - if oldOK != newOK || (oldOK && newOK && oldSC.rawJSONString != newSC.rawJSONString) { - updates = append(updates, "service config updated") - } - if len(ccr.curState.Addresses) > 0 && len(s.Addresses) == 0 { - updates = append(updates, "resolver returned an empty address list") - } else if len(ccr.curState.Addresses) == 0 && len(s.Addresses) > 0 { - updates = append(updates, "resolver returned new addresses") - } - channelz.Infof(logger, ccr.channelzID, "Resolver state updated: %s (%v)", pretty.ToJSON(s), strings.Join(updates, "; ")) -} diff --git a/vendor/google.golang.org/grpc/rpc_util.go b/vendor/google.golang.org/grpc/rpc_util.go index a844d28f4..b7723aa09 100644 --- a/vendor/google.golang.org/grpc/rpc_util.go +++ b/vendor/google.golang.org/grpc/rpc_util.go @@ -75,7 +75,7 @@ func NewGZIPCompressorWithLevel(level int) (Compressor, error) { } return &gzipCompressor{ pool: sync.Pool{ - New: func() interface{} { + New: func() any { w, err := gzip.NewWriterLevel(io.Discard, level) if err != nil { panic(err) @@ -626,7 +626,7 @@ func (p *parser) recvMsg(maxReceiveMessageSize int) (pf payloadFormat, msg []byt // encode serializes msg and returns a buffer containing the message, or an // error if it is too large to be transmitted by grpc. If msg is nil, it // generates an empty message. -func encode(c baseCodec, msg interface{}) ([]byte, error) { +func encode(c baseCodec, msg any) ([]byte, error) { if msg == nil { // NOTE: typed nils will not be caught by this check return nil, nil } @@ -693,7 +693,7 @@ func msgHeader(data, compData []byte) (hdr []byte, payload []byte) { return hdr, data } -func outPayload(client bool, msg interface{}, data, payload []byte, t time.Time) *stats.OutPayload { +func outPayload(client bool, msg any, data, payload []byte, t time.Time) *stats.OutPayload { return &stats.OutPayload{ Client: client, Payload: msg, @@ -792,7 +792,7 @@ func decompress(compressor encoding.Compressor, d []byte, maxReceiveMessageSize // For the two compressor parameters, both should not be set, but if they are, // dc takes precedence over compressor. // TODO(dfawley): wrap the old compressor/decompressor using the new API? -func recv(p *parser, c baseCodec, s *transport.Stream, dc Decompressor, m interface{}, maxReceiveMessageSize int, payInfo *payloadInfo, compressor encoding.Compressor) error { +func recv(p *parser, c baseCodec, s *transport.Stream, dc Decompressor, m any, maxReceiveMessageSize int, payInfo *payloadInfo, compressor encoding.Compressor) error { buf, err := recvAndDecompress(p, s, dc, maxReceiveMessageSize, payInfo, compressor) if err != nil { return err @@ -863,19 +863,22 @@ func ErrorDesc(err error) string { // Errorf returns nil if c is OK. // // Deprecated: use status.Errorf instead. -func Errorf(c codes.Code, format string, a ...interface{}) error { +func Errorf(c codes.Code, format string, a ...any) error { return status.Errorf(c, format, a...) } +var errContextCanceled = status.Error(codes.Canceled, context.Canceled.Error()) +var errContextDeadline = status.Error(codes.DeadlineExceeded, context.DeadlineExceeded.Error()) + // toRPCErr converts an error into an error from the status package. func toRPCErr(err error) error { switch err { case nil, io.EOF: return err case context.DeadlineExceeded: - return status.Error(codes.DeadlineExceeded, err.Error()) + return errContextDeadline case context.Canceled: - return status.Error(codes.Canceled, err.Error()) + return errContextCanceled case io.ErrUnexpectedEOF: return status.Error(codes.Internal, err.Error()) } diff --git a/vendor/google.golang.org/grpc/server.go b/vendor/google.golang.org/grpc/server.go index e076ec714..682fa1831 100644 --- a/vendor/google.golang.org/grpc/server.go +++ b/vendor/google.golang.org/grpc/server.go @@ -70,6 +70,10 @@ func init() { internal.GetServerCredentials = func(srv *Server) credentials.TransportCredentials { return srv.opts.creds } + internal.IsRegisteredMethod = func(srv *Server, method string) bool { + return srv.isRegisteredMethod(method) + } + internal.ServerFromContext = serverFromContext internal.DrainServerTransports = func(srv *Server, addr string) { srv.drainServerTransports(addr) } @@ -81,12 +85,13 @@ func init() { } internal.BinaryLogger = binaryLogger internal.JoinServerOptions = newJoinServerOption + internal.RecvBufferPool = recvBufferPool } var statusOK = status.New(codes.OK, "") var logger = grpclog.Component("core") -type methodHandler func(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor UnaryServerInterceptor) (interface{}, error) +type methodHandler func(srv any, ctx context.Context, dec func(any) error, interceptor UnaryServerInterceptor) (any, error) // MethodDesc represents an RPC service's method specification. type MethodDesc struct { @@ -99,26 +104,20 @@ type ServiceDesc struct { ServiceName string // The pointer to the service interface. Used to check whether the user // provided implementation satisfies the interface requirements. - HandlerType interface{} + HandlerType any Methods []MethodDesc Streams []StreamDesc - Metadata interface{} + Metadata any } // serviceInfo wraps information about a service. It is very similar to // ServiceDesc and is constructed from it for internal purposes. type serviceInfo struct { // Contains the implementation for the methods in this service. - serviceImpl interface{} + serviceImpl any methods map[string]*MethodDesc streams map[string]*StreamDesc - mdata interface{} -} - -type serverWorkerData struct { - st transport.ServerTransport - wg *sync.WaitGroup - stream *transport.Stream + mdata any } // Server is a gRPC server to serve RPC requests. @@ -145,7 +144,8 @@ type Server struct { channelzID *channelz.Identifier czData *channelzData - serverWorkerChannel chan *serverWorkerData + serverWorkerChannel chan func() + serverWorkerChannelClose func() } type serverOptions struct { @@ -170,6 +170,7 @@ type serverOptions struct { initialConnWindowSize int32 writeBufferSize int readBufferSize int + sharedWriteBuffer bool connectionTimeout time.Duration maxHeaderListSize *uint32 headerTableSize *uint32 @@ -178,6 +179,7 @@ type serverOptions struct { } var defaultServerOptions = serverOptions{ + maxConcurrentStreams: math.MaxUint32, maxReceiveMessageSize: defaultServerMaxReceiveMessageSize, maxSendMessageSize: defaultServerMaxSendMessageSize, connectionTimeout: 120 * time.Second, @@ -235,6 +237,20 @@ func newJoinServerOption(opts ...ServerOption) ServerOption { return &joinServerOption{opts: opts} } +// SharedWriteBuffer allows reusing per-connection transport write buffer. +// If this option is set to true every connection will release the buffer after +// flushing the data on the wire. +// +// # Experimental +// +// Notice: This API is EXPERIMENTAL and may be changed or removed in a +// later release. +func SharedWriteBuffer(val bool) ServerOption { + return newFuncServerOption(func(o *serverOptions) { + o.sharedWriteBuffer = val + }) +} + // WriteBufferSize determines how much data can be batched before doing a write // on the wire. The corresponding memory allocation for this buffer will be // twice the size to keep syscalls low. The default value for this buffer is @@ -275,9 +291,9 @@ func InitialConnWindowSize(s int32) ServerOption { // KeepaliveParams returns a ServerOption that sets keepalive and max-age parameters for the server. func KeepaliveParams(kp keepalive.ServerParameters) ServerOption { - if kp.Time > 0 && kp.Time < time.Second { + if kp.Time > 0 && kp.Time < internal.KeepaliveMinServerPingTime { logger.Warning("Adjusting keepalive ping interval to minimum period of 1s") - kp.Time = time.Second + kp.Time = internal.KeepaliveMinServerPingTime } return newFuncServerOption(func(o *serverOptions) { @@ -389,6 +405,9 @@ func MaxSendMsgSize(m int) ServerOption { // MaxConcurrentStreams returns a ServerOption that will apply a limit on the number // of concurrent streams to each ServerTransport. func MaxConcurrentStreams(n uint32) ServerOption { + if n == 0 { + n = math.MaxUint32 + } return newFuncServerOption(func(o *serverOptions) { o.maxConcurrentStreams = n }) @@ -565,11 +584,13 @@ func NumStreamWorkers(numServerWorkers uint32) ServerOption { // options are used: StatsHandler, EnableTracing, or binary logging. In such // cases, the shared buffer pool will be ignored. // -// # Experimental -// -// Notice: This API is EXPERIMENTAL and may be changed or removed in a -// later release. +// Deprecated: use experimental.WithRecvBufferPool instead. Will be deleted in +// v1.60.0 or later. func RecvBufferPool(bufferPool SharedBufferPool) ServerOption { + return recvBufferPool(bufferPool) +} + +func recvBufferPool(bufferPool SharedBufferPool) ServerOption { return newFuncServerOption(func(o *serverOptions) { o.recvBufferPool = bufferPool }) @@ -590,33 +611,27 @@ const serverWorkerResetThreshold = 1 << 16 // [1] https://github.com/golang/go/issues/18138 func (s *Server) serverWorker() { for completed := 0; completed < serverWorkerResetThreshold; completed++ { - data, ok := <-s.serverWorkerChannel + f, ok := <-s.serverWorkerChannel if !ok { return } - s.handleSingleStream(data) + f() } go s.serverWorker() } -func (s *Server) handleSingleStream(data *serverWorkerData) { - defer data.wg.Done() - s.handleStream(data.st, data.stream, s.traceInfo(data.st, data.stream)) -} - // initServerWorkers creates worker goroutines and a channel to process incoming // connections to reduce the time spent overall on runtime.morestack. func (s *Server) initServerWorkers() { - s.serverWorkerChannel = make(chan *serverWorkerData) + s.serverWorkerChannel = make(chan func()) + s.serverWorkerChannelClose = grpcsync.OnceFunc(func() { + close(s.serverWorkerChannel) + }) for i := uint32(0); i < s.opts.numServerWorkers; i++ { go s.serverWorker() } } -func (s *Server) stopServerWorkers() { - close(s.serverWorkerChannel) -} - // NewServer creates a gRPC server which has no service registered and has not // started to accept requests yet. func NewServer(opt ...ServerOption) *Server { @@ -655,7 +670,7 @@ func NewServer(opt ...ServerOption) *Server { // printf records an event in s's event log, unless s has been stopped. // REQUIRES s.mu is held. -func (s *Server) printf(format string, a ...interface{}) { +func (s *Server) printf(format string, a ...any) { if s.events != nil { s.events.Printf(format, a...) } @@ -663,7 +678,7 @@ func (s *Server) printf(format string, a ...interface{}) { // errorf records an error in s's event log, unless s has been stopped. // REQUIRES s.mu is held. -func (s *Server) errorf(format string, a ...interface{}) { +func (s *Server) errorf(format string, a ...any) { if s.events != nil { s.events.Errorf(format, a...) } @@ -678,14 +693,14 @@ type ServiceRegistrar interface { // once the server has started serving. // desc describes the service and its methods and handlers. impl is the // service implementation which is passed to the method handlers. - RegisterService(desc *ServiceDesc, impl interface{}) + RegisterService(desc *ServiceDesc, impl any) } // RegisterService registers a service and its implementation to the gRPC // server. It is called from the IDL generated code. This must be called before // invoking Serve. If ss is non-nil (for legacy code), its type is checked to // ensure it implements sd.HandlerType. -func (s *Server) RegisterService(sd *ServiceDesc, ss interface{}) { +func (s *Server) RegisterService(sd *ServiceDesc, ss any) { if ss != nil { ht := reflect.TypeOf(sd.HandlerType).Elem() st := reflect.TypeOf(ss) @@ -696,7 +711,7 @@ func (s *Server) RegisterService(sd *ServiceDesc, ss interface{}) { s.register(sd, ss) } -func (s *Server) register(sd *ServiceDesc, ss interface{}) { +func (s *Server) register(sd *ServiceDesc, ss any) { s.mu.Lock() defer s.mu.Unlock() s.printf("RegisterService(%q)", sd.ServiceName) @@ -737,7 +752,7 @@ type MethodInfo struct { type ServiceInfo struct { Methods []MethodInfo // Metadata is the metadata specified in ServiceDesc when registering service. - Metadata interface{} + Metadata any } // GetServiceInfo returns a map from service names to ServiceInfo. @@ -798,6 +813,18 @@ func (l *listenSocket) Close() error { // Serve returns when lis.Accept fails with fatal errors. lis will be closed when // this method returns. // Serve will return a non-nil error unless Stop or GracefulStop is called. +// +// Note: All supported releases of Go (as of December 2023) override the OS +// defaults for TCP keepalive time and interval to 15s. To enable TCP keepalive +// with OS defaults for keepalive time and interval, callers need to do the +// following two things: +// - pass a net.Listener created by calling the Listen method on a +// net.ListenConfig with the `KeepAlive` field set to a negative value. This +// will result in the Go standard library not overriding OS defaults for TCP +// keepalive interval and time. But this will also result in the Go standard +// library not enabling TCP keepalives by default. +// - override the Accept method on the passed in net.Listener and set the +// SO_KEEPALIVE socket option to enable TCP keepalives, with OS defaults. func (s *Server) Serve(lis net.Listener) error { s.mu.Lock() s.printf("serving") @@ -909,7 +936,7 @@ func (s *Server) handleRawConn(lisAddr string, rawConn net.Conn) { return } go func() { - s.serveStreams(st) + s.serveStreams(context.Background(), st, rawConn) s.removeConn(lisAddr, st) }() } @@ -938,6 +965,7 @@ func (s *Server) newHTTP2Transport(c net.Conn) transport.ServerTransport { InitialConnWindowSize: s.opts.initialConnWindowSize, WriteBufferSize: s.opts.writeBufferSize, ReadBufferSize: s.opts.readBufferSize, + SharedWriteBuffer: s.opts.sharedWriteBuffer, ChannelzParentID: s.channelzID, MaxHeaderListSize: s.opts.maxHeaderListSize, HeaderTableSize: s.opts.headerTableSize, @@ -962,33 +990,42 @@ func (s *Server) newHTTP2Transport(c net.Conn) transport.ServerTransport { return st } -func (s *Server) serveStreams(st transport.ServerTransport) { - defer st.Close(errors.New("finished serving streams for the server transport")) - var wg sync.WaitGroup +func (s *Server) serveStreams(ctx context.Context, st transport.ServerTransport, rawConn net.Conn) { + ctx = transport.SetConnection(ctx, rawConn) + ctx = peer.NewContext(ctx, st.Peer()) + for _, sh := range s.opts.statsHandlers { + ctx = sh.TagConn(ctx, &stats.ConnTagInfo{ + RemoteAddr: st.Peer().Addr, + LocalAddr: st.Peer().LocalAddr, + }) + sh.HandleConn(ctx, &stats.ConnBegin{}) + } + + defer func() { + st.Close(errors.New("finished serving streams for the server transport")) + for _, sh := range s.opts.statsHandlers { + sh.HandleConn(ctx, &stats.ConnEnd{}) + } + }() + + streamQuota := newHandlerQuota(s.opts.maxConcurrentStreams) + st.HandleStreams(ctx, func(stream *transport.Stream) { + streamQuota.acquire() + f := func() { + defer streamQuota.release() + s.handleStream(st, stream) + } - st.HandleStreams(func(stream *transport.Stream) { - wg.Add(1) if s.opts.numServerWorkers > 0 { - data := &serverWorkerData{st: st, wg: &wg, stream: stream} select { - case s.serverWorkerChannel <- data: + case s.serverWorkerChannel <- f: return default: // If all stream workers are busy, fallback to the default code path. } } - go func() { - defer wg.Done() - s.handleStream(st, stream, s.traceInfo(st, stream)) - }() - }, func(ctx context.Context, method string) context.Context { - if !EnableTracing { - return ctx - } - tr := trace.New("grpc.Recv."+methodFamily(method), method) - return trace.NewContext(ctx, tr) + go f() }) - wg.Wait() } var _ http.Handler = (*Server)(nil) @@ -1032,31 +1069,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } defer s.removeConn(listenerAddressForServeHTTP, st) - s.serveStreams(st) -} - -// traceInfo returns a traceInfo and associates it with stream, if tracing is enabled. -// If tracing is not enabled, it returns nil. -func (s *Server) traceInfo(st transport.ServerTransport, stream *transport.Stream) (trInfo *traceInfo) { - if !EnableTracing { - return nil - } - tr, ok := trace.FromContext(stream.Context()) - if !ok { - return nil - } - - trInfo = &traceInfo{ - tr: tr, - firstLine: firstLine{ - client: false, - remoteAddr: st.RemoteAddr(), - }, - } - if dl, ok := stream.Context().Deadline(); ok { - trInfo.firstLine.deadline = time.Until(dl) - } - return trInfo + s.serveStreams(r.Context(), st, nil) } func (s *Server) addConn(addr string, st transport.ServerTransport) bool { @@ -1119,7 +1132,7 @@ func (s *Server) incrCallsFailed() { atomic.AddInt64(&s.czData.callsFailed, 1) } -func (s *Server) sendResponse(t transport.ServerTransport, stream *transport.Stream, msg interface{}, cp Compressor, opts *transport.Options, comp encoding.Compressor) error { +func (s *Server) sendResponse(ctx context.Context, t transport.ServerTransport, stream *transport.Stream, msg any, cp Compressor, opts *transport.Options, comp encoding.Compressor) error { data, err := encode(s.getCodec(stream.ContentSubtype()), msg) if err != nil { channelz.Error(logger, s.channelzID, "grpc: server failed to encode response: ", err) @@ -1138,7 +1151,7 @@ func (s *Server) sendResponse(t transport.ServerTransport, stream *transport.Str err = t.Write(stream, hdr, payload, opts) if err == nil { for _, sh := range s.opts.statsHandlers { - sh.HandleRPC(stream.Context(), outPayload(false, msg, data, payload, time.Now())) + sh.HandleRPC(ctx, outPayload(false, msg, data, payload, time.Now())) } } return err @@ -1166,7 +1179,7 @@ func chainUnaryServerInterceptors(s *Server) { } func chainUnaryInterceptors(interceptors []UnaryServerInterceptor) UnaryServerInterceptor { - return func(ctx context.Context, req interface{}, info *UnaryServerInfo, handler UnaryHandler) (interface{}, error) { + return func(ctx context.Context, req any, info *UnaryServerInfo, handler UnaryHandler) (any, error) { return interceptors[0](ctx, req, info, getChainUnaryHandler(interceptors, 0, info, handler)) } } @@ -1175,12 +1188,12 @@ func getChainUnaryHandler(interceptors []UnaryServerInterceptor, curr int, info if curr == len(interceptors)-1 { return finalHandler } - return func(ctx context.Context, req interface{}) (interface{}, error) { + return func(ctx context.Context, req any) (any, error) { return interceptors[curr+1](ctx, req, info, getChainUnaryHandler(interceptors, curr+1, info, finalHandler)) } } -func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.Stream, info *serviceInfo, md *MethodDesc, trInfo *traceInfo) (err error) { +func (s *Server) processUnaryRPC(ctx context.Context, t transport.ServerTransport, stream *transport.Stream, info *serviceInfo, md *MethodDesc, trInfo *traceInfo) (err error) { shs := s.opts.statsHandlers if len(shs) != 0 || trInfo != nil || channelz.IsOn() { if channelz.IsOn() { @@ -1194,7 +1207,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. IsClientStream: false, IsServerStream: false, } - sh.HandleRPC(stream.Context(), statsBegin) + sh.HandleRPC(ctx, statsBegin) } if trInfo != nil { trInfo.tr.LazyLog(&trInfo.firstLine, false) @@ -1212,7 +1225,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. defer func() { if trInfo != nil { if err != nil && err != io.EOF { - trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) + trInfo.tr.LazyLog(&fmtStringer{"%v", []any{err}}, true) trInfo.tr.SetError() } trInfo.tr.Finish() @@ -1226,7 +1239,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. if err != nil && err != io.EOF { end.Error = toRPCErr(err) } - sh.HandleRPC(stream.Context(), end) + sh.HandleRPC(ctx, end) } if channelz.IsOn() { @@ -1248,7 +1261,6 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. } } if len(binlogs) != 0 { - ctx := stream.Context() md, _ := metadata.FromIncomingContext(ctx) logEntry := &binarylog.ClientHeader{ Header: md, @@ -1329,12 +1341,12 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. if channelz.IsOn() { t.IncrMsgRecv() } - df := func(v interface{}) error { + df := func(v any) error { if err := s.getCodec(stream.ContentSubtype()).Unmarshal(d, v); err != nil { return status.Errorf(codes.Internal, "grpc: error unmarshalling request: %v", err) } for _, sh := range shs { - sh.HandleRPC(stream.Context(), &stats.InPayload{ + sh.HandleRPC(ctx, &stats.InPayload{ RecvTime: time.Now(), Payload: v, Length: len(d), @@ -1348,7 +1360,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. Message: d, } for _, binlog := range binlogs { - binlog.Log(stream.Context(), cm) + binlog.Log(ctx, cm) } } if trInfo != nil { @@ -1356,7 +1368,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. } return nil } - ctx := NewContextWithServerTransportStream(stream.Context(), stream) + ctx = NewContextWithServerTransportStream(ctx, stream) reply, appErr := md.Handler(info.serviceImpl, ctx, df, s.opts.unaryInt) if appErr != nil { appStatus, ok := status.FromError(appErr) @@ -1381,7 +1393,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. Header: h, } for _, binlog := range binlogs { - binlog.Log(stream.Context(), sh) + binlog.Log(ctx, sh) } } st := &binarylog.ServerTrailer{ @@ -1389,7 +1401,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. Err: appErr, } for _, binlog := range binlogs { - binlog.Log(stream.Context(), st) + binlog.Log(ctx, st) } } return appErr @@ -1404,7 +1416,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. if stream.SendCompress() != sendCompressorName { comp = encoding.GetCompressor(stream.SendCompress()) } - if err := s.sendResponse(t, stream, reply, cp, opts, comp); err != nil { + if err := s.sendResponse(ctx, t, stream, reply, cp, opts, comp); err != nil { if err == io.EOF { // The entire stream is done (for unary RPC only). return err @@ -1431,8 +1443,8 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. Err: appErr, } for _, binlog := range binlogs { - binlog.Log(stream.Context(), sh) - binlog.Log(stream.Context(), st) + binlog.Log(ctx, sh) + binlog.Log(ctx, st) } } return err @@ -1446,8 +1458,8 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. Message: reply, } for _, binlog := range binlogs { - binlog.Log(stream.Context(), sh) - binlog.Log(stream.Context(), sm) + binlog.Log(ctx, sh) + binlog.Log(ctx, sm) } } if channelz.IsOn() { @@ -1465,7 +1477,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. Err: appErr, } for _, binlog := range binlogs { - binlog.Log(stream.Context(), st) + binlog.Log(ctx, st) } } return t.WriteStatus(stream, statusOK) @@ -1493,7 +1505,7 @@ func chainStreamServerInterceptors(s *Server) { } func chainStreamInterceptors(interceptors []StreamServerInterceptor) StreamServerInterceptor { - return func(srv interface{}, ss ServerStream, info *StreamServerInfo, handler StreamHandler) error { + return func(srv any, ss ServerStream, info *StreamServerInfo, handler StreamHandler) error { return interceptors[0](srv, ss, info, getChainStreamHandler(interceptors, 0, info, handler)) } } @@ -1502,12 +1514,12 @@ func getChainStreamHandler(interceptors []StreamServerInterceptor, curr int, inf if curr == len(interceptors)-1 { return finalHandler } - return func(srv interface{}, stream ServerStream) error { + return func(srv any, stream ServerStream) error { return interceptors[curr+1](srv, stream, info, getChainStreamHandler(interceptors, curr+1, info, finalHandler)) } } -func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transport.Stream, info *serviceInfo, sd *StreamDesc, trInfo *traceInfo) (err error) { +func (s *Server) processStreamingRPC(ctx context.Context, t transport.ServerTransport, stream *transport.Stream, info *serviceInfo, sd *StreamDesc, trInfo *traceInfo) (err error) { if channelz.IsOn() { s.incrCallsStarted() } @@ -1521,10 +1533,10 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp IsServerStream: sd.ServerStreams, } for _, sh := range shs { - sh.HandleRPC(stream.Context(), statsBegin) + sh.HandleRPC(ctx, statsBegin) } } - ctx := NewContextWithServerTransportStream(stream.Context(), stream) + ctx = NewContextWithServerTransportStream(ctx, stream) ss := &serverStream{ ctx: ctx, t: t, @@ -1543,7 +1555,7 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp if trInfo != nil { ss.mu.Lock() if err != nil && err != io.EOF { - ss.trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) + ss.trInfo.tr.LazyLog(&fmtStringer{"%v", []any{err}}, true) ss.trInfo.tr.SetError() } ss.trInfo.tr.Finish() @@ -1560,7 +1572,7 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp end.Error = toRPCErr(err) } for _, sh := range shs { - sh.HandleRPC(stream.Context(), end) + sh.HandleRPC(ctx, end) } } @@ -1602,7 +1614,7 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp logEntry.PeerAddr = peer.Addr } for _, binlog := range ss.binlogs { - binlog.Log(stream.Context(), logEntry) + binlog.Log(ctx, logEntry) } } @@ -1646,7 +1658,7 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp trInfo.tr.LazyLog(&trInfo.firstLine, false) } var appErr error - var server interface{} + var server any if info != nil { server = info.serviceImpl } @@ -1680,7 +1692,7 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp Err: appErr, } for _, binlog := range ss.binlogs { - binlog.Log(stream.Context(), st) + binlog.Log(ctx, st) } } t.WriteStatus(ss.s, appStatus) @@ -1698,53 +1710,87 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp Err: appErr, } for _, binlog := range ss.binlogs { - binlog.Log(stream.Context(), st) + binlog.Log(ctx, st) } } return t.WriteStatus(ss.s, statusOK) } -func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Stream, trInfo *traceInfo) { +func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Stream) { + ctx := stream.Context() + ctx = contextWithServer(ctx, s) + var ti *traceInfo + if EnableTracing { + tr := trace.New("grpc.Recv."+methodFamily(stream.Method()), stream.Method()) + ctx = trace.NewContext(ctx, tr) + ti = &traceInfo{ + tr: tr, + firstLine: firstLine{ + client: false, + remoteAddr: t.Peer().Addr, + }, + } + if dl, ok := ctx.Deadline(); ok { + ti.firstLine.deadline = time.Until(dl) + } + } + sm := stream.Method() if sm != "" && sm[0] == '/' { sm = sm[1:] } pos := strings.LastIndex(sm, "/") if pos == -1 { - if trInfo != nil { - trInfo.tr.LazyLog(&fmtStringer{"Malformed method name %q", []interface{}{sm}}, true) - trInfo.tr.SetError() + if ti != nil { + ti.tr.LazyLog(&fmtStringer{"Malformed method name %q", []any{sm}}, true) + ti.tr.SetError() } errDesc := fmt.Sprintf("malformed method name: %q", stream.Method()) if err := t.WriteStatus(stream, status.New(codes.Unimplemented, errDesc)); err != nil { - if trInfo != nil { - trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) - trInfo.tr.SetError() + if ti != nil { + ti.tr.LazyLog(&fmtStringer{"%v", []any{err}}, true) + ti.tr.SetError() } channelz.Warningf(logger, s.channelzID, "grpc: Server.handleStream failed to write status: %v", err) } - if trInfo != nil { - trInfo.tr.Finish() + if ti != nil { + ti.tr.Finish() } return } service := sm[:pos] method := sm[pos+1:] + md, _ := metadata.FromIncomingContext(ctx) + for _, sh := range s.opts.statsHandlers { + ctx = sh.TagRPC(ctx, &stats.RPCTagInfo{FullMethodName: stream.Method()}) + sh.HandleRPC(ctx, &stats.InHeader{ + FullMethod: stream.Method(), + RemoteAddr: t.Peer().Addr, + LocalAddr: t.Peer().LocalAddr, + Compression: stream.RecvCompress(), + WireLength: stream.HeaderWireLength(), + Header: md, + }) + } + // To have calls in stream callouts work. Will delete once all stats handler + // calls come from the gRPC layer. + stream.SetContext(ctx) + srv, knownService := s.services[service] if knownService { if md, ok := srv.methods[method]; ok { - s.processUnaryRPC(t, stream, srv, md, trInfo) + s.processUnaryRPC(ctx, t, stream, srv, md, ti) return } if sd, ok := srv.streams[method]; ok { - s.processStreamingRPC(t, stream, srv, sd, trInfo) + s.processStreamingRPC(ctx, t, stream, srv, sd, ti) return } } // Unknown service, or known server unknown method. if unknownDesc := s.opts.unknownStreamDesc; unknownDesc != nil { - s.processStreamingRPC(t, stream, nil, unknownDesc, trInfo) + s.processStreamingRPC(ctx, t, stream, nil, unknownDesc, ti) return } var errDesc string @@ -1753,19 +1799,19 @@ func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Str } else { errDesc = fmt.Sprintf("unknown method %v for service %v", method, service) } - if trInfo != nil { - trInfo.tr.LazyPrintf("%s", errDesc) - trInfo.tr.SetError() + if ti != nil { + ti.tr.LazyPrintf("%s", errDesc) + ti.tr.SetError() } if err := t.WriteStatus(stream, status.New(codes.Unimplemented, errDesc)); err != nil { - if trInfo != nil { - trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) - trInfo.tr.SetError() + if ti != nil { + ti.tr.LazyLog(&fmtStringer{"%v", []any{err}}, true) + ti.tr.SetError() } channelz.Warningf(logger, s.channelzID, "grpc: Server.handleStream failed to write status: %v", err) } - if trInfo != nil { - trInfo.tr.Finish() + if ti != nil { + ti.tr.Finish() } } @@ -1820,62 +1866,68 @@ func ServerTransportStreamFromContext(ctx context.Context) ServerTransportStream // pending RPCs on the client side will get notified by connection // errors. func (s *Server) Stop() { - s.quit.Fire() + s.stop(false) +} - defer func() { - s.serveWG.Wait() - s.done.Fire() - }() +// GracefulStop stops the gRPC server gracefully. It stops the server from +// accepting new connections and RPCs and blocks until all the pending RPCs are +// finished. +func (s *Server) GracefulStop() { + s.stop(true) +} + +func (s *Server) stop(graceful bool) { + s.quit.Fire() + defer s.done.Fire() s.channelzRemoveOnce.Do(func() { channelz.RemoveEntry(s.channelzID) }) s.mu.Lock() - listeners := s.lis - s.lis = nil - conns := s.conns - s.conns = nil - // interrupt GracefulStop if Stop and GracefulStop are called concurrently. - s.cv.Broadcast() + s.closeListenersLocked() + // Wait for serving threads to be ready to exit. Only then can we be sure no + // new conns will be created. s.mu.Unlock() + s.serveWG.Wait() - for lis := range listeners { - lis.Close() + s.mu.Lock() + defer s.mu.Unlock() + + if graceful { + s.drainAllServerTransportsLocked() + } else { + s.closeServerTransportsLocked() } - for _, cs := range conns { - for st := range cs { - st.Close(errors.New("Server.Stop called")) - } + + for len(s.conns) != 0 { + s.cv.Wait() } + s.conns = nil + if s.opts.numServerWorkers > 0 { - s.stopServerWorkers() + // Closing the channel (only once, via grpcsync.OnceFunc) after all the + // connections have been closed above ensures that there are no + // goroutines executing the callback passed to st.HandleStreams (where + // the channel is written to). + s.serverWorkerChannelClose() } - s.mu.Lock() if s.events != nil { s.events.Finish() s.events = nil } - s.mu.Unlock() } -// GracefulStop stops the gRPC server gracefully. It stops the server from -// accepting new connections and RPCs and blocks until all the pending RPCs are -// finished. -func (s *Server) GracefulStop() { - s.quit.Fire() - defer s.done.Fire() - - s.channelzRemoveOnce.Do(func() { channelz.RemoveEntry(s.channelzID) }) - s.mu.Lock() - if s.conns == nil { - s.mu.Unlock() - return +// s.mu must be held by the caller. +func (s *Server) closeServerTransportsLocked() { + for _, conns := range s.conns { + for st := range conns { + st.Close(errors.New("Server.Stop called")) + } } +} - for lis := range s.lis { - lis.Close() - } - s.lis = nil +// s.mu must be held by the caller. +func (s *Server) drainAllServerTransportsLocked() { if !s.drain { for _, conns := range s.conns { for st := range conns { @@ -1884,22 +1936,14 @@ func (s *Server) GracefulStop() { } s.drain = true } +} - // Wait for serving threads to be ready to exit. Only then can we be sure no - // new conns will be created. - s.mu.Unlock() - s.serveWG.Wait() - s.mu.Lock() - - for len(s.conns) != 0 { - s.cv.Wait() - } - s.conns = nil - if s.events != nil { - s.events.Finish() - s.events = nil +// s.mu must be held by the caller. +func (s *Server) closeListenersLocked() { + for lis := range s.lis { + lis.Close() } - s.mu.Unlock() + s.lis = nil } // contentSubtype must be lowercase @@ -1913,11 +1957,50 @@ func (s *Server) getCodec(contentSubtype string) baseCodec { } codec := encoding.GetCodec(contentSubtype) if codec == nil { + logger.Warningf("Unsupported codec %q. Defaulting to %q for now. This will start to fail in future releases.", contentSubtype, proto.Name) return encoding.GetCodec(proto.Name) } return codec } +type serverKey struct{} + +// serverFromContext gets the Server from the context. +func serverFromContext(ctx context.Context) *Server { + s, _ := ctx.Value(serverKey{}).(*Server) + return s +} + +// contextWithServer sets the Server in the context. +func contextWithServer(ctx context.Context, server *Server) context.Context { + return context.WithValue(ctx, serverKey{}, server) +} + +// isRegisteredMethod returns whether the passed in method is registered as a +// method on the server. /service/method and service/method will match if the +// service and method are registered on the server. +func (s *Server) isRegisteredMethod(serviceMethod string) bool { + if serviceMethod != "" && serviceMethod[0] == '/' { + serviceMethod = serviceMethod[1:] + } + pos := strings.LastIndex(serviceMethod, "/") + if pos == -1 { // Invalid method name syntax. + return false + } + service := serviceMethod[:pos] + method := serviceMethod[pos+1:] + srv, knownService := s.services[service] + if knownService { + if _, ok := srv.methods[method]; ok { + return true + } + if _, ok := srv.streams[method]; ok { + return true + } + } + return false +} + // SetHeader sets the header metadata to be sent from the server to the client. // The context provided must be the context passed to the server's handler. // @@ -2075,3 +2158,34 @@ func validateSendCompressor(name, clientCompressors string) error { } return fmt.Errorf("client does not support compressor %q", name) } + +// atomicSemaphore implements a blocking, counting semaphore. acquire should be +// called synchronously; release may be called asynchronously. +type atomicSemaphore struct { + n atomic.Int64 + wait chan struct{} +} + +func (q *atomicSemaphore) acquire() { + if q.n.Add(-1) < 0 { + // We ran out of quota. Block until a release happens. + <-q.wait + } +} + +func (q *atomicSemaphore) release() { + // N.B. the "<= 0" check below should allow for this to work with multiple + // concurrent calls to acquire, but also note that with synchronous calls to + // acquire, as our system does, n will never be less than -1. There are + // fairness issues (queuing) to consider if this was to be generalized. + if q.n.Add(1) <= 0 { + // An acquire was waiting on us. Unblock it. + q.wait <- struct{}{} + } +} + +func newHandlerQuota(n uint32) *atomicSemaphore { + a := &atomicSemaphore{wait: make(chan struct{}, 1)} + a.n.Store(int64(n)) + return a +} diff --git a/vendor/google.golang.org/grpc/shared_buffer_pool.go b/vendor/google.golang.org/grpc/shared_buffer_pool.go index c3a5a9ac1..48a64cfe8 100644 --- a/vendor/google.golang.org/grpc/shared_buffer_pool.go +++ b/vendor/google.golang.org/grpc/shared_buffer_pool.go @@ -109,7 +109,7 @@ const ( type simpleSharedBufferChildPool interface { Get(size int) []byte - Put(interface{}) + Put(any) } type bufferPool struct { @@ -133,7 +133,7 @@ func (p *bufferPool) Get(size int) []byte { func newBytesPool(size int) simpleSharedBufferChildPool { return &bufferPool{ Pool: sync.Pool{ - New: func() interface{} { + New: func() any { bs := make([]byte, size) return &bs }, diff --git a/vendor/google.golang.org/grpc/stats/stats.go b/vendor/google.golang.org/grpc/stats/stats.go index 7a552a9b7..4ab70e2d4 100644 --- a/vendor/google.golang.org/grpc/stats/stats.go +++ b/vendor/google.golang.org/grpc/stats/stats.go @@ -59,12 +59,22 @@ func (s *Begin) IsClient() bool { return s.Client } func (s *Begin) isRPCStats() {} +// PickerUpdated indicates that the LB policy provided a new picker while the +// RPC was waiting for one. +type PickerUpdated struct{} + +// IsClient indicates if the stats information is from client side. Only Client +// Side interfaces with a Picker, thus always returns true. +func (*PickerUpdated) IsClient() bool { return true } + +func (*PickerUpdated) isRPCStats() {} + // InPayload contains the information for an incoming payload. type InPayload struct { // Client is true if this InPayload is from client side. Client bool // Payload is the payload with original type. - Payload interface{} + Payload any // Data is the serialized message payload. Data []byte @@ -134,7 +144,7 @@ type OutPayload struct { // Client is true if this OutPayload is from client side. Client bool // Payload is the payload with original type. - Payload interface{} + Payload any // Data is the serialized message payload. Data []byte // Length is the size of the uncompressed payload data. Does not include any diff --git a/vendor/google.golang.org/grpc/status/status.go b/vendor/google.golang.org/grpc/status/status.go index bcf2e4d81..a93360efb 100644 --- a/vendor/google.golang.org/grpc/status/status.go +++ b/vendor/google.golang.org/grpc/status/status.go @@ -50,7 +50,7 @@ func New(c codes.Code, msg string) *Status { } // Newf returns New(c, fmt.Sprintf(format, a...)). -func Newf(c codes.Code, format string, a ...interface{}) *Status { +func Newf(c codes.Code, format string, a ...any) *Status { return New(c, fmt.Sprintf(format, a...)) } @@ -60,7 +60,7 @@ func Error(c codes.Code, msg string) error { } // Errorf returns Error(c, fmt.Sprintf(format, a...)). -func Errorf(c codes.Code, format string, a ...interface{}) error { +func Errorf(c codes.Code, format string, a ...any) error { return Error(c, fmt.Sprintf(format, a...)) } @@ -99,25 +99,27 @@ func FromError(err error) (s *Status, ok bool) { } type grpcstatus interface{ GRPCStatus() *Status } if gs, ok := err.(grpcstatus); ok { - if gs.GRPCStatus() == nil { + grpcStatus := gs.GRPCStatus() + if grpcStatus == nil { // Error has status nil, which maps to codes.OK. There // is no sensible behavior for this, so we turn it into // an error with codes.Unknown and discard the existing // status. return New(codes.Unknown, err.Error()), false } - return gs.GRPCStatus(), true + return grpcStatus, true } var gs grpcstatus if errors.As(err, &gs) { - if gs.GRPCStatus() == nil { + grpcStatus := gs.GRPCStatus() + if grpcStatus == nil { // Error wraps an error that has status nil, which maps // to codes.OK. There is no sensible behavior for this, // so we turn it into an error with codes.Unknown and // discard the existing status. return New(codes.Unknown, err.Error()), false } - p := gs.GRPCStatus().Proto() + p := grpcStatus.Proto() p.Message = err.Error() return status.FromProto(p), true } diff --git a/vendor/google.golang.org/grpc/stream.go b/vendor/google.golang.org/grpc/stream.go index de32a7597..b14b2fbea 100644 --- a/vendor/google.golang.org/grpc/stream.go +++ b/vendor/google.golang.org/grpc/stream.go @@ -31,6 +31,7 @@ import ( "google.golang.org/grpc/balancer" "google.golang.org/grpc/codes" "google.golang.org/grpc/encoding" + "google.golang.org/grpc/internal" "google.golang.org/grpc/internal/balancerload" "google.golang.org/grpc/internal/binarylog" "google.golang.org/grpc/internal/channelz" @@ -54,7 +55,7 @@ import ( // status package, or be one of the context errors. Otherwise, gRPC will use // codes.Unknown as the status code and err.Error() as the status message of the // RPC. -type StreamHandler func(srv interface{}, stream ServerStream) error +type StreamHandler func(srv any, stream ServerStream) error // StreamDesc represents a streaming RPC service's method specification. Used // on the server when registering services and on the client when initiating @@ -79,9 +80,9 @@ type Stream interface { // Deprecated: See ClientStream and ServerStream documentation instead. Context() context.Context // Deprecated: See ClientStream and ServerStream documentation instead. - SendMsg(m interface{}) error + SendMsg(m any) error // Deprecated: See ClientStream and ServerStream documentation instead. - RecvMsg(m interface{}) error + RecvMsg(m any) error } // ClientStream defines the client-side behavior of a streaming RPC. @@ -90,7 +91,9 @@ type Stream interface { // status package. type ClientStream interface { // Header returns the header metadata received from the server if there - // is any. It blocks if the metadata is not ready to read. + // is any. It blocks if the metadata is not ready to read. If the metadata + // is nil and the error is also nil, then the stream was terminated without + // headers, and the status can be discovered by calling RecvMsg. Header() (metadata.MD, error) // Trailer returns the trailer metadata from the server, if there is any. // It must only be called after stream.CloseAndRecv has returned, or @@ -126,7 +129,7 @@ type ClientStream interface { // // It is not safe to modify the message after calling SendMsg. Tracing // libraries and stats handlers may use the message lazily. - SendMsg(m interface{}) error + SendMsg(m any) error // RecvMsg blocks until it receives a message into m or the stream is // done. It returns io.EOF when the stream completes successfully. On // any other error, the stream is aborted and the error contains the RPC @@ -135,7 +138,7 @@ type ClientStream interface { // It is safe to have a goroutine calling SendMsg and another goroutine // calling RecvMsg on the same stream at the same time, but it is not // safe to call RecvMsg on the same stream in different goroutines. - RecvMsg(m interface{}) error + RecvMsg(m any) error } // NewStream creates a new Stream for the client side. This is typically @@ -155,11 +158,6 @@ type ClientStream interface { // If none of the above happen, a goroutine and a context will be leaked, and grpc // will not call the optionally-configured stats handler with a stats.End message. func (cc *ClientConn) NewStream(ctx context.Context, desc *StreamDesc, method string, opts ...CallOption) (ClientStream, error) { - if err := cc.idlenessMgr.onCallBegin(); err != nil { - return nil, err - } - defer cc.idlenessMgr.onCallEnd() - // allow interceptor to see all applicable call options, which means those // configured as defaults from dial option as well as per-call options opts = combine(cc.dopts.callOptions, opts) @@ -176,6 +174,16 @@ func NewClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth } func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (_ ClientStream, err error) { + // Start tracking the RPC for idleness purposes. This is where a stream is + // created for both streaming and unary RPCs, and hence is a good place to + // track active RPC count. + if err := cc.idlenessMgr.OnCallBegin(); err != nil { + return nil, err + } + // Add a calloption, to decrement the active call count, that gets executed + // when the RPC completes. + opts = append([]CallOption{OnFinish(func(error) { cc.idlenessMgr.OnCallEnd() })}, opts...) + if md, added, ok := metadata.FromOutgoingContextRaw(ctx); ok { // validate md if err := imetadata.Validate(md); err != nil { @@ -433,7 +441,7 @@ func (cs *clientStream) newAttemptLocked(isTransparent bool) (*csAttempt, error) ctx = trace.NewContext(ctx, trInfo.tr) } - if cs.cc.parsedTarget.URL.Scheme == "xds" { + if cs.cc.parsedTarget.URL.Scheme == internal.GRPCResolverSchemeExtraMetadata { // Add extra metadata (metadata that will be added by transport) to context // so the balancer can see them. ctx = grpcutil.WithExtraMetadata(ctx, metadata.Pairs( @@ -788,23 +796,24 @@ func (cs *clientStream) withRetry(op func(a *csAttempt) error, onSuccess func()) func (cs *clientStream) Header() (metadata.MD, error) { var m metadata.MD - noHeader := false err := cs.withRetry(func(a *csAttempt) error { var err error m, err = a.s.Header() - if err == transport.ErrNoHeaders { - noHeader = true - return nil - } return toRPCErr(err) }, cs.commitAttemptLocked) + if m == nil && err == nil { + // The stream ended with success. Finish the clientStream. + err = io.EOF + } + if err != nil { cs.finish(err) - return nil, err + // Do not return the error. The user should get it by calling Recv(). + return nil, nil } - if len(cs.binlogs) != 0 && !cs.serverHeaderBinlogged && !noHeader { + if len(cs.binlogs) != 0 && !cs.serverHeaderBinlogged && m != nil { // Only log if binary log is on and header has not been logged, and // there is actually headers to log. logEntry := &binarylog.ServerHeader{ @@ -820,6 +829,7 @@ func (cs *clientStream) Header() (metadata.MD, error) { binlog.Log(cs.ctx, logEntry) } } + return m, nil } @@ -860,7 +870,7 @@ func (cs *clientStream) bufferForRetryLocked(sz int, op func(a *csAttempt) error cs.buffer = append(cs.buffer, op) } -func (cs *clientStream) SendMsg(m interface{}) (err error) { +func (cs *clientStream) SendMsg(m any) (err error) { defer func() { if err != nil && err != io.EOF { // Call finish on the client stream for errors generated by this SendMsg @@ -904,7 +914,7 @@ func (cs *clientStream) SendMsg(m interface{}) (err error) { return err } -func (cs *clientStream) RecvMsg(m interface{}) error { +func (cs *clientStream) RecvMsg(m any) error { if len(cs.binlogs) != 0 && !cs.serverHeaderBinlogged { // Call Header() to binary log header if it's not already logged. cs.Header() @@ -928,24 +938,6 @@ func (cs *clientStream) RecvMsg(m interface{}) error { if err != nil || !cs.desc.ServerStreams { // err != nil or non-server-streaming indicates end of stream. cs.finish(err) - - if len(cs.binlogs) != 0 { - // finish will not log Trailer. Log Trailer here. - logEntry := &binarylog.ServerTrailer{ - OnClientSide: true, - Trailer: cs.Trailer(), - Err: err, - } - if logEntry.Err == io.EOF { - logEntry.Err = nil - } - if peer, ok := peer.FromContext(cs.Context()); ok { - logEntry.PeerAddr = peer.Addr - } - for _, binlog := range cs.binlogs { - binlog.Log(cs.ctx, logEntry) - } - } } return err } @@ -1001,18 +993,30 @@ func (cs *clientStream) finish(err error) { } } } + cs.mu.Unlock() - // For binary logging. only log cancel in finish (could be caused by RPC ctx - // canceled or ClientConn closed). Trailer will be logged in RecvMsg. - // - // Only one of cancel or trailer needs to be logged. In the cases where - // users don't call RecvMsg, users must have already canceled the RPC. - if len(cs.binlogs) != 0 && status.Code(err) == codes.Canceled { - c := &binarylog.Cancel{ - OnClientSide: true, - } - for _, binlog := range cs.binlogs { - binlog.Log(cs.ctx, c) + // Only one of cancel or trailer needs to be logged. + if len(cs.binlogs) != 0 { + switch err { + case errContextCanceled, errContextDeadline, ErrClientConnClosing: + c := &binarylog.Cancel{ + OnClientSide: true, + } + for _, binlog := range cs.binlogs { + binlog.Log(cs.ctx, c) + } + default: + logEntry := &binarylog.ServerTrailer{ + OnClientSide: true, + Trailer: cs.Trailer(), + Err: err, + } + if peer, ok := peer.FromContext(cs.Context()); ok { + logEntry.PeerAddr = peer.Addr + } + for _, binlog := range cs.binlogs { + binlog.Log(cs.ctx, logEntry) + } } } if err == nil { @@ -1028,7 +1032,7 @@ func (cs *clientStream) finish(err error) { cs.cancel() } -func (a *csAttempt) sendMsg(m interface{}, hdr, payld, data []byte) error { +func (a *csAttempt) sendMsg(m any, hdr, payld, data []byte) error { cs := a.cs if a.trInfo != nil { a.mu.Lock() @@ -1055,7 +1059,7 @@ func (a *csAttempt) sendMsg(m interface{}, hdr, payld, data []byte) error { return nil } -func (a *csAttempt) recvMsg(m interface{}, payInfo *payloadInfo) (err error) { +func (a *csAttempt) recvMsg(m any, payInfo *payloadInfo) (err error) { cs := a.cs if len(a.statsHandlers) != 0 && payInfo == nil { payInfo = &payloadInfo{} @@ -1348,7 +1352,7 @@ func (as *addrConnStream) Context() context.Context { return as.s.Context() } -func (as *addrConnStream) SendMsg(m interface{}) (err error) { +func (as *addrConnStream) SendMsg(m any) (err error) { defer func() { if err != nil && err != io.EOF { // Call finish on the client stream for errors generated by this SendMsg @@ -1393,7 +1397,7 @@ func (as *addrConnStream) SendMsg(m interface{}) (err error) { return nil } -func (as *addrConnStream) RecvMsg(m interface{}) (err error) { +func (as *addrConnStream) RecvMsg(m any) (err error) { defer func() { if err != nil || !as.desc.ServerStreams { // err != nil or non-server-streaming indicates end of stream. @@ -1512,7 +1516,7 @@ type ServerStream interface { // // It is not safe to modify the message after calling SendMsg. Tracing // libraries and stats handlers may use the message lazily. - SendMsg(m interface{}) error + SendMsg(m any) error // RecvMsg blocks until it receives a message into m or the stream is // done. It returns io.EOF when the client has performed a CloseSend. On // any non-EOF error, the stream is aborted and the error contains the @@ -1521,7 +1525,7 @@ type ServerStream interface { // It is safe to have a goroutine calling SendMsg and another goroutine // calling RecvMsg on the same stream at the same time, but it is not // safe to call RecvMsg on the same stream in different goroutines. - RecvMsg(m interface{}) error + RecvMsg(m any) error } // serverStream implements a server side Stream. @@ -1602,7 +1606,7 @@ func (ss *serverStream) SetTrailer(md metadata.MD) { ss.s.SetTrailer(md) } -func (ss *serverStream) SendMsg(m interface{}) (err error) { +func (ss *serverStream) SendMsg(m any) (err error) { defer func() { if ss.trInfo != nil { ss.mu.Lock() @@ -1610,7 +1614,7 @@ func (ss *serverStream) SendMsg(m interface{}) (err error) { if err == nil { ss.trInfo.tr.LazyLog(&payload{sent: true, msg: m}, true) } else { - ss.trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) + ss.trInfo.tr.LazyLog(&fmtStringer{"%v", []any{err}}, true) ss.trInfo.tr.SetError() } } @@ -1677,7 +1681,7 @@ func (ss *serverStream) SendMsg(m interface{}) (err error) { return nil } -func (ss *serverStream) RecvMsg(m interface{}) (err error) { +func (ss *serverStream) RecvMsg(m any) (err error) { defer func() { if ss.trInfo != nil { ss.mu.Lock() @@ -1685,7 +1689,7 @@ func (ss *serverStream) RecvMsg(m interface{}) (err error) { if err == nil { ss.trInfo.tr.LazyLog(&payload{sent: false, msg: m}, true) } else if err != io.EOF { - ss.trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) + ss.trInfo.tr.LazyLog(&fmtStringer{"%v", []any{err}}, true) ss.trInfo.tr.SetError() } } @@ -1757,7 +1761,7 @@ func MethodFromServerStream(stream ServerStream) (string, bool) { // prepareMsg returns the hdr, payload and data // using the compressors passed or using the // passed preparedmsg -func prepareMsg(m interface{}, codec baseCodec, cp Compressor, comp encoding.Compressor) (hdr, payload, data []byte, err error) { +func prepareMsg(m any, codec baseCodec, cp Compressor, comp encoding.Compressor) (hdr, payload, data []byte, err error) { if preparedMsg, ok := m.(*PreparedMsg); ok { return preparedMsg.hdr, preparedMsg.payload, preparedMsg.encodedData, nil } diff --git a/vendor/google.golang.org/grpc/tap/tap.go b/vendor/google.golang.org/grpc/tap/tap.go index bfa5dfa40..07f012576 100644 --- a/vendor/google.golang.org/grpc/tap/tap.go +++ b/vendor/google.golang.org/grpc/tap/tap.go @@ -27,6 +27,8 @@ package tap import ( "context" + + "google.golang.org/grpc/metadata" ) // Info defines the relevant information needed by the handles. @@ -34,6 +36,10 @@ type Info struct { // FullMethodName is the string of grpc method (in the format of // /package.service/method). FullMethodName string + + // Header contains the header metadata received. + Header metadata.MD + // TODO: More to be added. } diff --git a/vendor/google.golang.org/grpc/trace.go b/vendor/google.golang.org/grpc/trace.go index 07a2d26b3..9ded79321 100644 --- a/vendor/google.golang.org/grpc/trace.go +++ b/vendor/google.golang.org/grpc/trace.go @@ -97,8 +97,8 @@ func truncate(x string, l int) string { // payload represents an RPC request or response payload. type payload struct { - sent bool // whether this is an outgoing payload - msg interface{} // e.g. a proto.Message + sent bool // whether this is an outgoing payload + msg any // e.g. a proto.Message // TODO(dsymonds): add stringifying info to codec, and limit how much we hold here? } @@ -111,7 +111,7 @@ func (p payload) String() string { type fmtStringer struct { format string - a []interface{} + a []any } func (f *fmtStringer) String() string { diff --git a/vendor/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go index 353cfd528..dc2cea59c 100644 --- a/vendor/google.golang.org/grpc/version.go +++ b/vendor/google.golang.org/grpc/version.go @@ -19,4 +19,4 @@ package grpc // Version is the current grpc version. -const Version = "1.57.0" +const Version = "1.60.1" diff --git a/vendor/google.golang.org/grpc/vet.sh b/vendor/google.golang.org/grpc/vet.sh index a8e4732b3..896dc38f5 100644 --- a/vendor/google.golang.org/grpc/vet.sh +++ b/vendor/google.golang.org/grpc/vet.sh @@ -35,7 +35,6 @@ if [[ "$1" = "-install" ]]; then # Install the pinned versions as defined in module tools. pushd ./test/tools go install \ - golang.org/x/lint/golint \ golang.org/x/tools/cmd/goimports \ honnef.co/go/tools/cmd/staticcheck \ github.com/client9/misspell/cmd/misspell @@ -77,12 +76,19 @@ fi not grep 'func Test[^(]' *_test.go not grep 'func Test[^(]' test/*.go +# - Check for typos in test function names +git grep 'func (s) ' -- "*_test.go" | not grep -v 'func (s) Test' +git grep 'func [A-Z]' -- "*_test.go" | not grep -v 'func Test\|Benchmark\|Example' + # - Do not import x/net/context. not git grep -l 'x/net/context' -- "*.go" # - Do not import math/rand for real library code. Use internal/grpcrand for # thread safety. -git grep -l '"math/rand"' -- "*.go" 2>&1 | not grep -v '^examples\|^stress\|grpcrand\|^benchmark\|wrr_test' +git grep -l '"math/rand"' -- "*.go" 2>&1 | not grep -v '^examples\|^interop/stress\|grpcrand\|^benchmark\|wrr_test' + +# - Do not use "interface{}"; use "any" instead. +git grep -l 'interface{}' -- "*.go" 2>&1 | not grep -v '\.pb\.go\|protoc-gen-go-grpc' # - Do not call grpclog directly. Use grpclog.Component instead. git grep -l -e 'grpclog.I' --or -e 'grpclog.W' --or -e 'grpclog.E' --or -e 'grpclog.F' --or -e 'grpclog.V' -- "*.go" | not grep -v '^grpclog/component.go\|^internal/grpctest/tlogger_test.go' @@ -90,13 +96,15 @@ git grep -l -e 'grpclog.I' --or -e 'grpclog.W' --or -e 'grpclog.E' --or -e 'grpc # - Ensure all ptypes proto packages are renamed when importing. not git grep "\(import \|^\s*\)\"github.com/golang/protobuf/ptypes/" -- "*.go" +# - Ensure all usages of grpc_testing package are renamed when importing. +not git grep "\(import \|^\s*\)\"google.golang.org/grpc/interop/grpc_testing" -- "*.go" + # - Ensure all xds proto imports are renamed to *pb or *grpc. git grep '"github.com/envoyproxy/go-control-plane/envoy' -- '*.go' ':(exclude)*.pb.go' | not grep -v 'pb "\|grpc "' misspell -error . -# - gofmt, goimports, golint (with exceptions for generated code), go vet, -# go mod tidy. +# - gofmt, goimports, go vet, go mod tidy. # Perform these checks on each module inside gRPC. for MOD_FILE in $(find . -name 'go.mod'); do MOD_DIR=$(dirname ${MOD_FILE}) @@ -104,105 +112,81 @@ for MOD_FILE in $(find . -name 'go.mod'); do go vet -all ./... | fail_on_output gofmt -s -d -l . 2>&1 | fail_on_output goimports -l . 2>&1 | not grep -vE "\.pb\.go" - golint ./... 2>&1 | not grep -vE "/grpc_testing_not_regenerate/.*\.pb\.go:" - go mod tidy -compat=1.17 + go mod tidy -compat=1.19 git status --porcelain 2>&1 | fail_on_output || \ (git status; git --no-pager diff; exit 1) popd done # - Collection of static analysis checks -# -# TODO(dfawley): don't use deprecated functions in examples or first-party -# plugins. -# TODO(dfawley): enable ST1019 (duplicate imports) but allow for protobufs. SC_OUT="$(mktemp)" -staticcheck -go 1.19 -checks 'inherit,-ST1015,-ST1019,-SA1019' ./... > "${SC_OUT}" || true -# Error if anything other than deprecation warnings are printed. -not grep -v "is deprecated:.*SA1019" "${SC_OUT}" -# Only ignore the following deprecated types/fields/functions. -not grep -Fv '.CredsBundle -.HeaderMap -.Metadata is deprecated: use Attributes -.NewAddress -.NewServiceConfig -.Type is deprecated: use Attributes -BuildVersion is deprecated -balancer.ErrTransientFailure -balancer.Picker -extDesc.Filename is deprecated -github.com/golang/protobuf/jsonpb is deprecated -grpc.CallCustomCodec -grpc.Code -grpc.Compressor -grpc.CustomCodec -grpc.Decompressor -grpc.MaxMsgSize -grpc.MethodConfig -grpc.NewGZIPCompressor -grpc.NewGZIPDecompressor -grpc.RPCCompressor -grpc.RPCDecompressor -grpc.ServiceConfig -grpc.WithCompressor -grpc.WithDecompressor -grpc.WithDialer -grpc.WithMaxMsgSize -grpc.WithServiceConfig -grpc.WithTimeout -http.CloseNotifier -info.SecurityVersion -proto is deprecated -proto.InternalMessageInfo is deprecated -proto.EnumName is deprecated -proto.ErrInternalBadWireType is deprecated -proto.FileDescriptor is deprecated -proto.Marshaler is deprecated -proto.MessageType is deprecated -proto.RegisterEnum is deprecated -proto.RegisterFile is deprecated -proto.RegisterType is deprecated -proto.RegisterExtension is deprecated -proto.RegisteredExtension is deprecated -proto.RegisteredExtensions is deprecated -proto.RegisterMapType is deprecated -proto.Unmarshaler is deprecated -resolver.Backend -resolver.GRPCLB +staticcheck -go 1.19 -checks 'all' ./... > "${SC_OUT}" || true + +# Error for anything other than checks that need exclusions. +grep -v "(ST1000)" "${SC_OUT}" | grep -v "(SA1019)" | grep -v "(ST1003)" | not grep -v "(ST1019)\|\(other import of\)" + +# Exclude underscore checks for generated code. +grep "(ST1003)" "${SC_OUT}" | not grep -v '\(.pb.go:\)\|\(code_string_test.go:\)' + +# Error for duplicate imports not including grpc protos. +grep "(ST1019)\|\(other import of\)" "${SC_OUT}" | not grep -Fv 'XXXXX PleaseIgnoreUnused +channelz/grpc_channelz_v1" +go-control-plane/envoy +grpclb/grpc_lb_v1" +health/grpc_health_v1" +interop/grpc_testing" +orca/v3" +proto/grpc_gcp" +proto/grpc_lookup_v1" +reflection/grpc_reflection_v1" +reflection/grpc_reflection_v1alpha" +XXXXX PleaseIgnoreUnused' + +# Error for any package comments not in generated code. +grep "(ST1000)" "${SC_OUT}" | not grep -v "\.pb\.go:" + +# Only ignore the following deprecated types/fields/functions and exclude +# generated code. +grep "(SA1019)" "${SC_OUT}" | not grep -Fv 'XXXXX PleaseIgnoreUnused +XXXXX Protobuf related deprecation errors: +"github.com/golang/protobuf +.pb.go: +: ptypes. +proto.RegisterType +XXXXX gRPC internal usage deprecation errors: +"google.golang.org/grpc +: grpc. +: v1alpha. +: v1alphareflectionpb. +BalancerAttributes is deprecated: +CredsBundle is deprecated: +Metadata is deprecated: use Attributes instead. +NewSubConn is deprecated: +OverrideServerName is deprecated: +RemoveSubConn is deprecated: +SecurityVersion is deprecated: Target is deprecated: Use the Target field in the BuildOptions instead. -xxx_messageInfo_ -' "${SC_OUT}" - -# - special golint on package comments. -lint_package_comment_per_package() { - # Number of files in this go package. - fileCount=$(go list -f '{{len .GoFiles}}' $1) - if [ ${fileCount} -eq 0 ]; then - return 0 - fi - # Number of package errors generated by golint. - lintPackageCommentErrorsCount=$(golint --min_confidence 0 $1 | grep -c "should have a package comment") - # golint complains about every file that's missing the package comment. If the - # number of files for this package is greater than the number of errors, there's - # at least one file with package comment, good. Otherwise, fail. - if [ ${fileCount} -le ${lintPackageCommentErrorsCount} ]; then - echo "Package $1 (with ${fileCount} files) is missing package comment" - return 1 - fi -} -lint_package_comment() { - set +ex - - count=0 - for i in $(go list ./...); do - lint_package_comment_per_package "$i" - ((count += $?)) - done - - set -ex - return $count -} -lint_package_comment +UpdateAddresses is deprecated: +UpdateSubConnState is deprecated: +balancer.ErrTransientFailure is deprecated: +grpc/reflection/v1alpha/reflection.proto +XXXXX xDS deprecated fields we support +.ExactMatch +.PrefixMatch +.SafeRegexMatch +.SuffixMatch +GetContainsMatch +GetExactMatch +GetMatchSubjectAltNames +GetPrefixMatch +GetSafeRegexMatch +GetSuffixMatch +GetTlsCertificateCertificateProviderInstance +GetValidationContextCertificateProviderInstance +XXXXX TODO: Remove the below deprecation usages: +CloseNotifier +Roots.Subjects +XXXXX PleaseIgnoreUnused' echo SUCCESS diff --git a/vendor/google.golang.org/protobuf/encoding/protojson/decode.go b/vendor/google.golang.org/protobuf/encoding/protojson/decode.go index 5f28148d8..f47902371 100644 --- a/vendor/google.golang.org/protobuf/encoding/protojson/decode.go +++ b/vendor/google.golang.org/protobuf/encoding/protojson/decode.go @@ -11,6 +11,7 @@ import ( "strconv" "strings" + "google.golang.org/protobuf/encoding/protowire" "google.golang.org/protobuf/internal/encoding/json" "google.golang.org/protobuf/internal/encoding/messageset" "google.golang.org/protobuf/internal/errors" @@ -23,7 +24,7 @@ import ( "google.golang.org/protobuf/reflect/protoregistry" ) -// Unmarshal reads the given []byte into the given proto.Message. +// Unmarshal reads the given []byte into the given [proto.Message]. // The provided message must be mutable (e.g., a non-nil pointer to a message). func Unmarshal(b []byte, m proto.Message) error { return UnmarshalOptions{}.Unmarshal(b, m) @@ -37,7 +38,7 @@ type UnmarshalOptions struct { // required fields will not return an error. AllowPartial bool - // If DiscardUnknown is set, unknown fields are ignored. + // If DiscardUnknown is set, unknown fields and enum name values are ignored. DiscardUnknown bool // Resolver is used for looking up types when unmarshaling @@ -47,9 +48,13 @@ type UnmarshalOptions struct { protoregistry.MessageTypeResolver protoregistry.ExtensionTypeResolver } + + // RecursionLimit limits how deeply messages may be nested. + // If zero, a default limit is applied. + RecursionLimit int } -// Unmarshal reads the given []byte and populates the given proto.Message +// Unmarshal reads the given []byte and populates the given [proto.Message] // using options in the UnmarshalOptions object. // It will clear the message first before setting the fields. // If it returns an error, the given message may be partially set. @@ -67,6 +72,9 @@ func (o UnmarshalOptions) unmarshal(b []byte, m proto.Message) error { if o.Resolver == nil { o.Resolver = protoregistry.GlobalTypes } + if o.RecursionLimit == 0 { + o.RecursionLimit = protowire.DefaultRecursionLimit + } dec := decoder{json.NewDecoder(b), o} if err := dec.unmarshalMessage(m.ProtoReflect(), false); err != nil { @@ -114,6 +122,10 @@ func (d decoder) syntaxError(pos int, f string, x ...interface{}) error { // unmarshalMessage unmarshals a message into the given protoreflect.Message. func (d decoder) unmarshalMessage(m protoreflect.Message, skipTypeURL bool) error { + d.opts.RecursionLimit-- + if d.opts.RecursionLimit < 0 { + return errors.New("exceeded max recursion depth") + } if unmarshal := wellKnownTypeUnmarshaler(m.Descriptor().FullName()); unmarshal != nil { return unmarshal(d, m) } @@ -266,7 +278,9 @@ func (d decoder) unmarshalSingular(m protoreflect.Message, fd protoreflect.Field if err != nil { return err } - m.Set(fd, val) + if val.IsValid() { + m.Set(fd, val) + } return nil } @@ -329,7 +343,7 @@ func (d decoder) unmarshalScalar(fd protoreflect.FieldDescriptor) (protoreflect. } case protoreflect.EnumKind: - if v, ok := unmarshalEnum(tok, fd); ok { + if v, ok := unmarshalEnum(tok, fd, d.opts.DiscardUnknown); ok { return v, nil } @@ -474,7 +488,7 @@ func unmarshalBytes(tok json.Token) (protoreflect.Value, bool) { return protoreflect.ValueOfBytes(b), true } -func unmarshalEnum(tok json.Token, fd protoreflect.FieldDescriptor) (protoreflect.Value, bool) { +func unmarshalEnum(tok json.Token, fd protoreflect.FieldDescriptor, discardUnknown bool) (protoreflect.Value, bool) { switch tok.Kind() { case json.String: // Lookup EnumNumber based on name. @@ -482,6 +496,9 @@ func unmarshalEnum(tok json.Token, fd protoreflect.FieldDescriptor) (protoreflec if enumVal := fd.Enum().Values().ByName(protoreflect.Name(s)); enumVal != nil { return protoreflect.ValueOfEnum(enumVal.Number()), true } + if discardUnknown { + return protoreflect.Value{}, true + } case json.Number: if n, ok := tok.Int(32); ok { @@ -542,7 +559,9 @@ func (d decoder) unmarshalList(list protoreflect.List, fd protoreflect.FieldDesc if err != nil { return err } - list.Append(val) + if val.IsValid() { + list.Append(val) + } } } @@ -609,8 +628,9 @@ Loop: if err != nil { return err } - - mmap.Set(pkey, pval) + if pval.IsValid() { + mmap.Set(pkey, pval) + } } return nil diff --git a/vendor/google.golang.org/protobuf/encoding/protojson/doc.go b/vendor/google.golang.org/protobuf/encoding/protojson/doc.go index 21d5d2cb1..ae71007c1 100644 --- a/vendor/google.golang.org/protobuf/encoding/protojson/doc.go +++ b/vendor/google.golang.org/protobuf/encoding/protojson/doc.go @@ -6,6 +6,6 @@ // format. It follows the guide at // https://protobuf.dev/programming-guides/proto3#json. // -// This package produces a different output than the standard "encoding/json" +// This package produces a different output than the standard [encoding/json] // package, which does not operate correctly on protocol buffer messages. package protojson diff --git a/vendor/google.golang.org/protobuf/encoding/protojson/encode.go b/vendor/google.golang.org/protobuf/encoding/protojson/encode.go index 66b95870e..3f75098b6 100644 --- a/vendor/google.golang.org/protobuf/encoding/protojson/encode.go +++ b/vendor/google.golang.org/protobuf/encoding/protojson/encode.go @@ -31,7 +31,7 @@ func Format(m proto.Message) string { return MarshalOptions{Multiline: true}.Format(m) } -// Marshal writes the given proto.Message in JSON format using default options. +// Marshal writes the given [proto.Message] in JSON format using default options. // Do not depend on the output being stable. It may change over time across // different versions of the program. func Marshal(m proto.Message) ([]byte, error) { @@ -81,6 +81,25 @@ type MarshalOptions struct { // ā•šā•ā•ā•ā•ā•ā•ā•ā•§ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā• EmitUnpopulated bool + // EmitDefaultValues specifies whether to emit default-valued primitive fields, + // empty lists, and empty maps. The fields affected are as follows: + // ā•”ā•ā•ā•ā•ā•ā•ā•ā•¤ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•— + // ā•‘ JSON ā”‚ Protobuf field ā•‘ + // ā• ā•ā•ā•ā•ā•ā•ā•ā•Ŗā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•£ + // ā•‘ false ā”‚ non-optional scalar boolean fields ā•‘ + // ā•‘ 0 ā”‚ non-optional scalar numeric fields ā•‘ + // ā•‘ "" ā”‚ non-optional scalar string/byte fields ā•‘ + // ā•‘ [] ā”‚ empty repeated fields ā•‘ + // ā•‘ {} ā”‚ empty map fields ā•‘ + // ā•šā•ā•ā•ā•ā•ā•ā•ā•§ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā• + // + // Behaves similarly to EmitUnpopulated, but does not emit "null"-value fields, + // i.e. presence-sensing fields that are omitted will remain omitted to preserve + // presence-sensing. + // EmitUnpopulated takes precedence over EmitDefaultValues since the former generates + // a strict superset of the latter. + EmitDefaultValues bool + // Resolver is used for looking up types when expanding google.protobuf.Any // messages. If nil, this defaults to using protoregistry.GlobalTypes. Resolver interface { @@ -102,7 +121,7 @@ func (o MarshalOptions) Format(m proto.Message) string { return string(b) } -// Marshal marshals the given proto.Message in the JSON format using options in +// Marshal marshals the given [proto.Message] in the JSON format using options in // MarshalOptions. Do not depend on the output being stable. It may change over // time across different versions of the program. func (o MarshalOptions) Marshal(m proto.Message) ([]byte, error) { @@ -178,7 +197,11 @@ func (m typeURLFieldRanger) Range(f func(protoreflect.FieldDescriptor, protorefl // unpopulatedFieldRanger wraps a protoreflect.Message and modifies its Range // method to additionally iterate over unpopulated fields. -type unpopulatedFieldRanger struct{ protoreflect.Message } +type unpopulatedFieldRanger struct { + protoreflect.Message + + skipNull bool +} func (m unpopulatedFieldRanger) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { fds := m.Descriptor().Fields() @@ -192,6 +215,9 @@ func (m unpopulatedFieldRanger) Range(f func(protoreflect.FieldDescriptor, proto isProto2Scalar := fd.Syntax() == protoreflect.Proto2 && fd.Default().IsValid() isSingularMessage := fd.Cardinality() != protoreflect.Repeated && fd.Message() != nil if isProto2Scalar || isSingularMessage { + if m.skipNull { + continue + } v = protoreflect.Value{} // use invalid value to emit null } if !f(fd, v) { @@ -217,8 +243,11 @@ func (e encoder) marshalMessage(m protoreflect.Message, typeURL string) error { defer e.EndObject() var fields order.FieldRanger = m - if e.opts.EmitUnpopulated { - fields = unpopulatedFieldRanger{m} + switch { + case e.opts.EmitUnpopulated: + fields = unpopulatedFieldRanger{Message: m, skipNull: false} + case e.opts.EmitDefaultValues: + fields = unpopulatedFieldRanger{Message: m, skipNull: true} } if typeURL != "" { fields = typeURLFieldRanger{fields, typeURL} diff --git a/vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.go b/vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.go index 6c37d4174..4b177c820 100644 --- a/vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.go +++ b/vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.go @@ -176,7 +176,7 @@ func (d decoder) unmarshalAny(m protoreflect.Message) error { // Use another decoder to parse the unread bytes for @type field. This // avoids advancing a read from current decoder because the current JSON // object may contain the fields of the embedded type. - dec := decoder{d.Clone(), UnmarshalOptions{}} + dec := decoder{d.Clone(), UnmarshalOptions{RecursionLimit: d.opts.RecursionLimit}} tok, err := findTypeURL(dec) switch err { case errEmptyObject: @@ -308,48 +308,29 @@ Loop: // array) in order to advance the read to the next JSON value. It relies on // the decoder returning an error if the types are not in valid sequence. func (d decoder) skipJSONValue() error { - tok, err := d.Read() - if err != nil { - return err - } - // Only need to continue reading for objects and arrays. - switch tok.Kind() { - case json.ObjectOpen: - for { - tok, err := d.Read() - if err != nil { - return err - } - switch tok.Kind() { - case json.ObjectClose: - return nil - case json.Name: - // Skip object field value. - if err := d.skipJSONValue(); err != nil { - return err - } - } + var open int + for { + tok, err := d.Read() + if err != nil { + return err } - - case json.ArrayOpen: - for { - tok, err := d.Peek() - if err != nil { - return err - } - switch tok.Kind() { - case json.ArrayClose: - d.Read() - return nil - default: - // Skip array item. - if err := d.skipJSONValue(); err != nil { - return err - } + switch tok.Kind() { + case json.ObjectClose, json.ArrayClose: + open-- + case json.ObjectOpen, json.ArrayOpen: + open++ + if open > d.opts.RecursionLimit { + return errors.New("exceeded max recursion depth") } + case json.EOF: + // This can only happen if there's a bug in Decoder.Read. + // Avoid an infinite loop if this does happen. + return errors.New("unexpected EOF") + } + if open == 0 { + return nil } } - return nil } // unmarshalAnyValue unmarshals the given custom-type message from the JSON diff --git a/vendor/google.golang.org/protobuf/encoding/prototext/decode.go b/vendor/google.golang.org/protobuf/encoding/prototext/decode.go index 4921b2d4a..a45f112bc 100644 --- a/vendor/google.golang.org/protobuf/encoding/prototext/decode.go +++ b/vendor/google.golang.org/protobuf/encoding/prototext/decode.go @@ -21,7 +21,7 @@ import ( "google.golang.org/protobuf/reflect/protoregistry" ) -// Unmarshal reads the given []byte into the given proto.Message. +// Unmarshal reads the given []byte into the given [proto.Message]. // The provided message must be mutable (e.g., a non-nil pointer to a message). func Unmarshal(b []byte, m proto.Message) error { return UnmarshalOptions{}.Unmarshal(b, m) @@ -51,7 +51,7 @@ type UnmarshalOptions struct { } } -// Unmarshal reads the given []byte and populates the given proto.Message +// Unmarshal reads the given []byte and populates the given [proto.Message] // using options in the UnmarshalOptions object. // The provided message must be mutable (e.g., a non-nil pointer to a message). func (o UnmarshalOptions) Unmarshal(b []byte, m proto.Message) error { @@ -739,7 +739,9 @@ func (d decoder) skipValue() error { case text.ListClose: return nil case text.MessageOpen: - return d.skipMessageValue() + if err := d.skipMessageValue(); err != nil { + return err + } default: // Skip items. This will not validate whether skipped values are // of the same type or not, same behavior as C++ diff --git a/vendor/google.golang.org/protobuf/encoding/prototext/encode.go b/vendor/google.golang.org/protobuf/encoding/prototext/encode.go index 722a7b41d..95967e811 100644 --- a/vendor/google.golang.org/protobuf/encoding/prototext/encode.go +++ b/vendor/google.golang.org/protobuf/encoding/prototext/encode.go @@ -33,7 +33,7 @@ func Format(m proto.Message) string { return MarshalOptions{Multiline: true}.Format(m) } -// Marshal writes the given proto.Message in textproto format using default +// Marshal writes the given [proto.Message] in textproto format using default // options. Do not depend on the output being stable. It may change over time // across different versions of the program. func Marshal(m proto.Message) ([]byte, error) { @@ -97,7 +97,7 @@ func (o MarshalOptions) Format(m proto.Message) string { return string(b) } -// Marshal writes the given proto.Message in textproto format using options in +// Marshal writes the given [proto.Message] in textproto format using options in // MarshalOptions object. Do not depend on the output being stable. It may // change over time across different versions of the program. func (o MarshalOptions) Marshal(m proto.Message) ([]byte, error) { diff --git a/vendor/google.golang.org/protobuf/encoding/protowire/wire.go b/vendor/google.golang.org/protobuf/encoding/protowire/wire.go index f4b4686cf..e942bc983 100644 --- a/vendor/google.golang.org/protobuf/encoding/protowire/wire.go +++ b/vendor/google.golang.org/protobuf/encoding/protowire/wire.go @@ -6,7 +6,7 @@ // See https://protobuf.dev/programming-guides/encoding. // // For marshaling and unmarshaling entire protobuf messages, -// use the "google.golang.org/protobuf/proto" package instead. +// use the [google.golang.org/protobuf/proto] package instead. package protowire import ( @@ -87,7 +87,7 @@ func ParseError(n int) error { // ConsumeField parses an entire field record (both tag and value) and returns // the field number, the wire type, and the total length. -// This returns a negative length upon an error (see ParseError). +// This returns a negative length upon an error (see [ParseError]). // // The total length includes the tag header and the end group marker (if the // field is a group). @@ -104,8 +104,8 @@ func ConsumeField(b []byte) (Number, Type, int) { } // ConsumeFieldValue parses a field value and returns its length. -// This assumes that the field Number and wire Type have already been parsed. -// This returns a negative length upon an error (see ParseError). +// This assumes that the field [Number] and wire [Type] have already been parsed. +// This returns a negative length upon an error (see [ParseError]). // // When parsing a group, the length includes the end group marker and // the end group is verified to match the starting field number. @@ -164,7 +164,7 @@ func AppendTag(b []byte, num Number, typ Type) []byte { } // ConsumeTag parses b as a varint-encoded tag, reporting its length. -// This returns a negative length upon an error (see ParseError). +// This returns a negative length upon an error (see [ParseError]). func ConsumeTag(b []byte) (Number, Type, int) { v, n := ConsumeVarint(b) if n < 0 { @@ -263,7 +263,7 @@ func AppendVarint(b []byte, v uint64) []byte { } // ConsumeVarint parses b as a varint-encoded uint64, reporting its length. -// This returns a negative length upon an error (see ParseError). +// This returns a negative length upon an error (see [ParseError]). func ConsumeVarint(b []byte) (v uint64, n int) { var y uint64 if len(b) <= 0 { @@ -384,7 +384,7 @@ func AppendFixed32(b []byte, v uint32) []byte { } // ConsumeFixed32 parses b as a little-endian uint32, reporting its length. -// This returns a negative length upon an error (see ParseError). +// This returns a negative length upon an error (see [ParseError]). func ConsumeFixed32(b []byte) (v uint32, n int) { if len(b) < 4 { return 0, errCodeTruncated @@ -412,7 +412,7 @@ func AppendFixed64(b []byte, v uint64) []byte { } // ConsumeFixed64 parses b as a little-endian uint64, reporting its length. -// This returns a negative length upon an error (see ParseError). +// This returns a negative length upon an error (see [ParseError]). func ConsumeFixed64(b []byte) (v uint64, n int) { if len(b) < 8 { return 0, errCodeTruncated @@ -432,7 +432,7 @@ func AppendBytes(b []byte, v []byte) []byte { } // ConsumeBytes parses b as a length-prefixed bytes value, reporting its length. -// This returns a negative length upon an error (see ParseError). +// This returns a negative length upon an error (see [ParseError]). func ConsumeBytes(b []byte) (v []byte, n int) { m, n := ConsumeVarint(b) if n < 0 { @@ -456,7 +456,7 @@ func AppendString(b []byte, v string) []byte { } // ConsumeString parses b as a length-prefixed bytes value, reporting its length. -// This returns a negative length upon an error (see ParseError). +// This returns a negative length upon an error (see [ParseError]). func ConsumeString(b []byte) (v string, n int) { bb, n := ConsumeBytes(b) return string(bb), n @@ -471,7 +471,7 @@ func AppendGroup(b []byte, num Number, v []byte) []byte { // ConsumeGroup parses b as a group value until the trailing end group marker, // and verifies that the end marker matches the provided num. The value v // does not contain the end marker, while the length does contain the end marker. -// This returns a negative length upon an error (see ParseError). +// This returns a negative length upon an error (see [ParseError]). func ConsumeGroup(num Number, b []byte) (v []byte, n int) { n = ConsumeFieldValue(num, StartGroupType, b) if n < 0 { @@ -495,8 +495,8 @@ func SizeGroup(num Number, n int) int { return n + SizeTag(num) } -// DecodeTag decodes the field Number and wire Type from its unified form. -// The Number is -1 if the decoded field number overflows int32. +// DecodeTag decodes the field [Number] and wire [Type] from its unified form. +// The [Number] is -1 if the decoded field number overflows int32. // Other than overflow, this does not check for field number validity. func DecodeTag(x uint64) (Number, Type) { // NOTE: MessageSet allows for larger field numbers than normal. @@ -506,7 +506,7 @@ func DecodeTag(x uint64) (Number, Type) { return Number(x >> 3), Type(x & 7) } -// EncodeTag encodes the field Number and wire Type into its unified form. +// EncodeTag encodes the field [Number] and wire [Type] into its unified form. func EncodeTag(num Number, typ Type) uint64 { return uint64(num)<<3 | uint64(typ&7) } diff --git a/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go b/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go index db5248e1b..a45625c8d 100644 --- a/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go +++ b/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go @@ -83,7 +83,13 @@ func formatListOpt(vs list, isRoot, allowMulti bool) string { case protoreflect.FileImports: for i := 0; i < vs.Len(); i++ { var rs records - rs.Append(reflect.ValueOf(vs.Get(i)), "Path", "Package", "IsPublic", "IsWeak") + rv := reflect.ValueOf(vs.Get(i)) + rs.Append(rv, []methodAndName{ + {rv.MethodByName("Path"), "Path"}, + {rv.MethodByName("Package"), "Package"}, + {rv.MethodByName("IsPublic"), "IsPublic"}, + {rv.MethodByName("IsWeak"), "IsWeak"}, + }...) ss = append(ss, "{"+rs.Join()+"}") } return start + joinStrings(ss, allowMulti) + end @@ -92,34 +98,26 @@ func formatListOpt(vs list, isRoot, allowMulti bool) string { for i := 0; i < vs.Len(); i++ { m := reflect.ValueOf(vs).MethodByName("Get") v := m.Call([]reflect.Value{reflect.ValueOf(i)})[0].Interface() - ss = append(ss, formatDescOpt(v.(protoreflect.Descriptor), false, allowMulti && !isEnumValue)) + ss = append(ss, formatDescOpt(v.(protoreflect.Descriptor), false, allowMulti && !isEnumValue, nil)) } return start + joinStrings(ss, allowMulti && isEnumValue) + end } } -// descriptorAccessors is a list of accessors to print for each descriptor. -// -// Do not print all accessors since some contain redundant information, -// while others are pointers that we do not want to follow since the descriptor -// is actually a cyclic graph. -// -// Using a list allows us to print the accessors in a sensible order. -var descriptorAccessors = map[reflect.Type][]string{ - reflect.TypeOf((*protoreflect.FileDescriptor)(nil)).Elem(): {"Path", "Package", "Imports", "Messages", "Enums", "Extensions", "Services"}, - reflect.TypeOf((*protoreflect.MessageDescriptor)(nil)).Elem(): {"IsMapEntry", "Fields", "Oneofs", "ReservedNames", "ReservedRanges", "RequiredNumbers", "ExtensionRanges", "Messages", "Enums", "Extensions"}, - reflect.TypeOf((*protoreflect.FieldDescriptor)(nil)).Elem(): {"Number", "Cardinality", "Kind", "HasJSONName", "JSONName", "HasPresence", "IsExtension", "IsPacked", "IsWeak", "IsList", "IsMap", "MapKey", "MapValue", "HasDefault", "Default", "ContainingOneof", "ContainingMessage", "Message", "Enum"}, - reflect.TypeOf((*protoreflect.OneofDescriptor)(nil)).Elem(): {"Fields"}, // not directly used; must keep in sync with formatDescOpt - reflect.TypeOf((*protoreflect.EnumDescriptor)(nil)).Elem(): {"Values", "ReservedNames", "ReservedRanges"}, - reflect.TypeOf((*protoreflect.EnumValueDescriptor)(nil)).Elem(): {"Number"}, - reflect.TypeOf((*protoreflect.ServiceDescriptor)(nil)).Elem(): {"Methods"}, - reflect.TypeOf((*protoreflect.MethodDescriptor)(nil)).Elem(): {"Input", "Output", "IsStreamingClient", "IsStreamingServer"}, +type methodAndName struct { + method reflect.Value + name string } func FormatDesc(s fmt.State, r rune, t protoreflect.Descriptor) { - io.WriteString(s, formatDescOpt(t, true, r == 'v' && (s.Flag('+') || s.Flag('#')))) + io.WriteString(s, formatDescOpt(t, true, r == 'v' && (s.Flag('+') || s.Flag('#')), nil)) } -func formatDescOpt(t protoreflect.Descriptor, isRoot, allowMulti bool) string { + +func InternalFormatDescOptForTesting(t protoreflect.Descriptor, isRoot, allowMulti bool, record func(string)) string { + return formatDescOpt(t, isRoot, allowMulti, record) +} + +func formatDescOpt(t protoreflect.Descriptor, isRoot, allowMulti bool, record func(string)) string { rv := reflect.ValueOf(t) rt := rv.MethodByName("ProtoType").Type().In(0) @@ -129,26 +127,60 @@ func formatDescOpt(t protoreflect.Descriptor, isRoot, allowMulti bool) string { } _, isFile := t.(protoreflect.FileDescriptor) - rs := records{allowMulti: allowMulti} + rs := records{ + allowMulti: allowMulti, + record: record, + } if t.IsPlaceholder() { if isFile { - rs.Append(rv, "Path", "Package", "IsPlaceholder") + rs.Append(rv, []methodAndName{ + {rv.MethodByName("Path"), "Path"}, + {rv.MethodByName("Package"), "Package"}, + {rv.MethodByName("IsPlaceholder"), "IsPlaceholder"}, + }...) } else { - rs.Append(rv, "FullName", "IsPlaceholder") + rs.Append(rv, []methodAndName{ + {rv.MethodByName("FullName"), "FullName"}, + {rv.MethodByName("IsPlaceholder"), "IsPlaceholder"}, + }...) } } else { switch { case isFile: - rs.Append(rv, "Syntax") + rs.Append(rv, methodAndName{rv.MethodByName("Syntax"), "Syntax"}) case isRoot: - rs.Append(rv, "Syntax", "FullName") + rs.Append(rv, []methodAndName{ + {rv.MethodByName("Syntax"), "Syntax"}, + {rv.MethodByName("FullName"), "FullName"}, + }...) default: - rs.Append(rv, "Name") + rs.Append(rv, methodAndName{rv.MethodByName("Name"), "Name"}) } switch t := t.(type) { case protoreflect.FieldDescriptor: - for _, s := range descriptorAccessors[rt] { - switch s { + accessors := []methodAndName{ + {rv.MethodByName("Number"), "Number"}, + {rv.MethodByName("Cardinality"), "Cardinality"}, + {rv.MethodByName("Kind"), "Kind"}, + {rv.MethodByName("HasJSONName"), "HasJSONName"}, + {rv.MethodByName("JSONName"), "JSONName"}, + {rv.MethodByName("HasPresence"), "HasPresence"}, + {rv.MethodByName("IsExtension"), "IsExtension"}, + {rv.MethodByName("IsPacked"), "IsPacked"}, + {rv.MethodByName("IsWeak"), "IsWeak"}, + {rv.MethodByName("IsList"), "IsList"}, + {rv.MethodByName("IsMap"), "IsMap"}, + {rv.MethodByName("MapKey"), "MapKey"}, + {rv.MethodByName("MapValue"), "MapValue"}, + {rv.MethodByName("HasDefault"), "HasDefault"}, + {rv.MethodByName("Default"), "Default"}, + {rv.MethodByName("ContainingOneof"), "ContainingOneof"}, + {rv.MethodByName("ContainingMessage"), "ContainingMessage"}, + {rv.MethodByName("Message"), "Message"}, + {rv.MethodByName("Enum"), "Enum"}, + } + for _, s := range accessors { + switch s.name { case "MapKey": if k := t.MapKey(); k != nil { rs.recs = append(rs.recs, [2]string{"MapKey", k.Kind().String()}) @@ -157,20 +189,20 @@ func formatDescOpt(t protoreflect.Descriptor, isRoot, allowMulti bool) string { if v := t.MapValue(); v != nil { switch v.Kind() { case protoreflect.EnumKind: - rs.recs = append(rs.recs, [2]string{"MapValue", string(v.Enum().FullName())}) + rs.AppendRecs("MapValue", [2]string{"MapValue", string(v.Enum().FullName())}) case protoreflect.MessageKind, protoreflect.GroupKind: - rs.recs = append(rs.recs, [2]string{"MapValue", string(v.Message().FullName())}) + rs.AppendRecs("MapValue", [2]string{"MapValue", string(v.Message().FullName())}) default: - rs.recs = append(rs.recs, [2]string{"MapValue", v.Kind().String()}) + rs.AppendRecs("MapValue", [2]string{"MapValue", v.Kind().String()}) } } case "ContainingOneof": if od := t.ContainingOneof(); od != nil { - rs.recs = append(rs.recs, [2]string{"Oneof", string(od.Name())}) + rs.AppendRecs("ContainingOneof", [2]string{"Oneof", string(od.Name())}) } case "ContainingMessage": if t.IsExtension() { - rs.recs = append(rs.recs, [2]string{"Extendee", string(t.ContainingMessage().FullName())}) + rs.AppendRecs("ContainingMessage", [2]string{"Extendee", string(t.ContainingMessage().FullName())}) } case "Message": if !t.IsMap() { @@ -187,13 +219,61 @@ func formatDescOpt(t protoreflect.Descriptor, isRoot, allowMulti bool) string { ss = append(ss, string(fs.Get(i).Name())) } if len(ss) > 0 { - rs.recs = append(rs.recs, [2]string{"Fields", "[" + joinStrings(ss, false) + "]"}) + rs.AppendRecs("Fields", [2]string{"Fields", "[" + joinStrings(ss, false) + "]"}) } - default: - rs.Append(rv, descriptorAccessors[rt]...) + + case protoreflect.FileDescriptor: + rs.Append(rv, []methodAndName{ + {rv.MethodByName("Path"), "Path"}, + {rv.MethodByName("Package"), "Package"}, + {rv.MethodByName("Imports"), "Imports"}, + {rv.MethodByName("Messages"), "Messages"}, + {rv.MethodByName("Enums"), "Enums"}, + {rv.MethodByName("Extensions"), "Extensions"}, + {rv.MethodByName("Services"), "Services"}, + }...) + + case protoreflect.MessageDescriptor: + rs.Append(rv, []methodAndName{ + {rv.MethodByName("IsMapEntry"), "IsMapEntry"}, + {rv.MethodByName("Fields"), "Fields"}, + {rv.MethodByName("Oneofs"), "Oneofs"}, + {rv.MethodByName("ReservedNames"), "ReservedNames"}, + {rv.MethodByName("ReservedRanges"), "ReservedRanges"}, + {rv.MethodByName("RequiredNumbers"), "RequiredNumbers"}, + {rv.MethodByName("ExtensionRanges"), "ExtensionRanges"}, + {rv.MethodByName("Messages"), "Messages"}, + {rv.MethodByName("Enums"), "Enums"}, + {rv.MethodByName("Extensions"), "Extensions"}, + }...) + + case protoreflect.EnumDescriptor: + rs.Append(rv, []methodAndName{ + {rv.MethodByName("Values"), "Values"}, + {rv.MethodByName("ReservedNames"), "ReservedNames"}, + {rv.MethodByName("ReservedRanges"), "ReservedRanges"}, + }...) + + case protoreflect.EnumValueDescriptor: + rs.Append(rv, []methodAndName{ + {rv.MethodByName("Number"), "Number"}, + }...) + + case protoreflect.ServiceDescriptor: + rs.Append(rv, []methodAndName{ + {rv.MethodByName("Methods"), "Methods"}, + }...) + + case protoreflect.MethodDescriptor: + rs.Append(rv, []methodAndName{ + {rv.MethodByName("Input"), "Input"}, + {rv.MethodByName("Output"), "Output"}, + {rv.MethodByName("IsStreamingClient"), "IsStreamingClient"}, + {rv.MethodByName("IsStreamingServer"), "IsStreamingServer"}, + }...) } - if rv.MethodByName("GoType").IsValid() { - rs.Append(rv, "GoType") + if m := rv.MethodByName("GoType"); m.IsValid() { + rs.Append(rv, methodAndName{m, "GoType"}) } } return start + rs.Join() + end @@ -202,19 +282,34 @@ func formatDescOpt(t protoreflect.Descriptor, isRoot, allowMulti bool) string { type records struct { recs [][2]string allowMulti bool + + // record is a function that will be called for every Append() or + // AppendRecs() call, to be used for testing with the + // InternalFormatDescOptForTesting function. + record func(string) } -func (rs *records) Append(v reflect.Value, accessors ...string) { +func (rs *records) AppendRecs(fieldName string, newRecs [2]string) { + if rs.record != nil { + rs.record(fieldName) + } + rs.recs = append(rs.recs, newRecs) +} + +func (rs *records) Append(v reflect.Value, accessors ...methodAndName) { for _, a := range accessors { + if rs.record != nil { + rs.record(a.name) + } var rv reflect.Value - if m := v.MethodByName(a); m.IsValid() { - rv = m.Call(nil)[0] + if a.method.IsValid() { + rv = a.method.Call(nil)[0] } if v.Kind() == reflect.Struct && !rv.IsValid() { - rv = v.FieldByName(a) + rv = v.FieldByName(a.name) } if !rv.IsValid() { - panic(fmt.Sprintf("unknown accessor: %v.%s", v.Type(), a)) + panic(fmt.Sprintf("unknown accessor: %v.%s", v.Type(), a.name)) } if _, ok := rv.Interface().(protoreflect.Value); ok { rv = rv.MethodByName("Interface").Call(nil)[0] @@ -261,7 +356,7 @@ func (rs *records) Append(v reflect.Value, accessors ...string) { default: s = fmt.Sprint(v) } - rs.recs = append(rs.recs, [2]string{a, s}) + rs.recs = append(rs.recs, [2]string{a.name, s}) } } diff --git a/vendor/google.golang.org/protobuf/internal/encoding/json/decode.go b/vendor/google.golang.org/protobuf/internal/encoding/json/decode.go index d043a6ebe..d2b3ac031 100644 --- a/vendor/google.golang.org/protobuf/internal/encoding/json/decode.go +++ b/vendor/google.golang.org/protobuf/internal/encoding/json/decode.go @@ -121,7 +121,7 @@ func (d *Decoder) Read() (Token, error) { case ObjectClose: if len(d.openStack) == 0 || - d.lastToken.kind == comma || + d.lastToken.kind&(Name|comma) != 0 || d.openStack[len(d.openStack)-1] != ObjectOpen { return Token{}, d.newSyntaxError(tok.pos, unexpectedFmt, tok.RawString()) } diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc.go index 7c3689bae..8826bcf40 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc.go @@ -21,11 +21,26 @@ import ( "google.golang.org/protobuf/reflect/protoregistry" ) +// Edition is an Enum for proto2.Edition +type Edition int32 + +// These values align with the value of Enum in descriptor.proto which allows +// direct conversion between the proto enum and this enum. +const ( + EditionUnknown Edition = 0 + EditionProto2 Edition = 998 + EditionProto3 Edition = 999 + Edition2023 Edition = 1000 + EditionUnsupported Edition = 100000 +) + // The types in this file may have a suffix: // ā€¢ L0: Contains fields common to all descriptors (except File) and // must be initialized up front. // ā€¢ L1: Contains fields specific to a descriptor and -// must be initialized up front. +// must be initialized up front. If the associated proto uses Editions, the +// Editions features must always be resolved. If not explicitly set, the +// appropriate default must be resolved and set. // ā€¢ L2: Contains fields that are lazily initialized when constructing // from the raw file descriptor. When constructing as a literal, the L2 // fields must be initialized up front. @@ -44,6 +59,7 @@ type ( } FileL1 struct { Syntax protoreflect.Syntax + Edition Edition // Only used if Syntax == Editions Path string Package protoreflect.FullName @@ -51,12 +67,41 @@ type ( Messages Messages Extensions Extensions Services Services + + EditionFeatures EditionFeatures } FileL2 struct { Options func() protoreflect.ProtoMessage Imports FileImports Locations SourceLocations } + + EditionFeatures struct { + // IsFieldPresence is true if field_presence is EXPLICIT + // https://protobuf.dev/editions/features/#field_presence + IsFieldPresence bool + // IsFieldPresence is true if field_presence is LEGACY_REQUIRED + // https://protobuf.dev/editions/features/#field_presence + IsLegacyRequired bool + // IsOpenEnum is true if enum_type is OPEN + // https://protobuf.dev/editions/features/#enum_type + IsOpenEnum bool + // IsPacked is true if repeated_field_encoding is PACKED + // https://protobuf.dev/editions/features/#repeated_field_encoding + IsPacked bool + // IsUTF8Validated is true if utf_validation is VERIFY + // https://protobuf.dev/editions/features/#utf8_validation + IsUTF8Validated bool + // IsDelimitedEncoded is true if message_encoding is DELIMITED + // https://protobuf.dev/editions/features/#message_encoding + IsDelimitedEncoded bool + // IsJSONCompliant is true if json_format is ALLOW + // https://protobuf.dev/editions/features/#json_format + IsJSONCompliant bool + // GenerateLegacyUnmarshalJSON determines if the plugin generates the + // UnmarshalJSON([]byte) error method for enums. + GenerateLegacyUnmarshalJSON bool + } ) func (fd *File) ParentFile() protoreflect.FileDescriptor { return fd } @@ -117,6 +162,8 @@ type ( } EnumL1 struct { eagerValues bool // controls whether EnumL2.Values is already populated + + EditionFeatures EditionFeatures } EnumL2 struct { Options func() protoreflect.ProtoMessage @@ -178,6 +225,8 @@ type ( Extensions Extensions IsMapEntry bool // promoted from google.protobuf.MessageOptions IsMessageSet bool // promoted from google.protobuf.MessageOptions + + EditionFeatures EditionFeatures } MessageL2 struct { Options func() protoreflect.ProtoMessage @@ -210,6 +259,8 @@ type ( ContainingOneof protoreflect.OneofDescriptor // must be consistent with Message.Oneofs.Fields Enum protoreflect.EnumDescriptor Message protoreflect.MessageDescriptor + + EditionFeatures EditionFeatures } Oneof struct { @@ -219,6 +270,8 @@ type ( OneofL1 struct { Options func() protoreflect.ProtoMessage Fields OneofFields // must be consistent with Message.Fields.ContainingOneof + + EditionFeatures EditionFeatures } ) @@ -268,23 +321,36 @@ func (fd *Field) Options() protoreflect.ProtoMessage { } func (fd *Field) Number() protoreflect.FieldNumber { return fd.L1.Number } func (fd *Field) Cardinality() protoreflect.Cardinality { return fd.L1.Cardinality } -func (fd *Field) Kind() protoreflect.Kind { return fd.L1.Kind } -func (fd *Field) HasJSONName() bool { return fd.L1.StringName.hasJSON } -func (fd *Field) JSONName() string { return fd.L1.StringName.getJSON(fd) } -func (fd *Field) TextName() string { return fd.L1.StringName.getText(fd) } +func (fd *Field) Kind() protoreflect.Kind { + return fd.L1.Kind +} +func (fd *Field) HasJSONName() bool { return fd.L1.StringName.hasJSON } +func (fd *Field) JSONName() string { return fd.L1.StringName.getJSON(fd) } +func (fd *Field) TextName() string { return fd.L1.StringName.getText(fd) } func (fd *Field) HasPresence() bool { - return fd.L1.Cardinality != protoreflect.Repeated && (fd.L0.ParentFile.L1.Syntax == protoreflect.Proto2 || fd.L1.Message != nil || fd.L1.ContainingOneof != nil) + if fd.L1.Cardinality == protoreflect.Repeated { + return false + } + explicitFieldPresence := fd.Syntax() == protoreflect.Editions && fd.L1.EditionFeatures.IsFieldPresence + return fd.Syntax() == protoreflect.Proto2 || explicitFieldPresence || fd.L1.Message != nil || fd.L1.ContainingOneof != nil } func (fd *Field) HasOptionalKeyword() bool { return (fd.L0.ParentFile.L1.Syntax == protoreflect.Proto2 && fd.L1.Cardinality == protoreflect.Optional && fd.L1.ContainingOneof == nil) || fd.L1.IsProto3Optional } func (fd *Field) IsPacked() bool { - if !fd.L1.HasPacked && fd.L0.ParentFile.L1.Syntax != protoreflect.Proto2 && fd.L1.Cardinality == protoreflect.Repeated { - switch fd.L1.Kind { - case protoreflect.StringKind, protoreflect.BytesKind, protoreflect.MessageKind, protoreflect.GroupKind: - default: - return true - } + if fd.L1.Cardinality != protoreflect.Repeated { + return false + } + switch fd.L1.Kind { + case protoreflect.StringKind, protoreflect.BytesKind, protoreflect.MessageKind, protoreflect.GroupKind: + return false + } + if fd.L0.ParentFile.L1.Syntax == protoreflect.Editions { + return fd.L1.EditionFeatures.IsPacked + } + if fd.L0.ParentFile.L1.Syntax == protoreflect.Proto3 { + // proto3 repeated fields are packed by default. + return !fd.L1.HasPacked || fd.L1.IsPacked } return fd.L1.IsPacked } @@ -333,6 +399,9 @@ func (fd *Field) ProtoType(protoreflect.FieldDescriptor) {} // WARNING: This method is exempt from the compatibility promise and may be // removed in the future without warning. func (fd *Field) EnforceUTF8() bool { + if fd.L0.ParentFile.L1.Syntax == protoreflect.Editions { + return fd.L1.EditionFeatures.IsUTF8Validated + } if fd.L1.HasEnforceUTF8 { return fd.L1.EnforceUTF8 } @@ -359,10 +428,11 @@ type ( L2 *ExtensionL2 // protected by fileDesc.once } ExtensionL1 struct { - Number protoreflect.FieldNumber - Extendee protoreflect.MessageDescriptor - Cardinality protoreflect.Cardinality - Kind protoreflect.Kind + Number protoreflect.FieldNumber + Extendee protoreflect.MessageDescriptor + Cardinality protoreflect.Cardinality + Kind protoreflect.Kind + EditionFeatures EditionFeatures } ExtensionL2 struct { Options func() protoreflect.ProtoMessage diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go index 4a1584c9d..237e64fd2 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go @@ -5,6 +5,7 @@ package filedesc import ( + "fmt" "sync" "google.golang.org/protobuf/encoding/protowire" @@ -98,6 +99,7 @@ func (fd *File) unmarshalSeed(b []byte) { var prevField protoreflect.FieldNumber var numEnums, numMessages, numExtensions, numServices int var posEnums, posMessages, posExtensions, posServices int + var options []byte b0 := b for len(b) > 0 { num, typ, n := protowire.ConsumeTag(b) @@ -113,6 +115,8 @@ func (fd *File) unmarshalSeed(b []byte) { fd.L1.Syntax = protoreflect.Proto2 case "proto3": fd.L1.Syntax = protoreflect.Proto3 + case "editions": + fd.L1.Syntax = protoreflect.Editions default: panic("invalid syntax") } @@ -120,6 +124,8 @@ func (fd *File) unmarshalSeed(b []byte) { fd.L1.Path = sb.MakeString(v) case genid.FileDescriptorProto_Package_field_number: fd.L1.Package = protoreflect.FullName(sb.MakeString(v)) + case genid.FileDescriptorProto_Options_field_number: + options = v case genid.FileDescriptorProto_EnumType_field_number: if prevField != genid.FileDescriptorProto_EnumType_field_number { if numEnums > 0 { @@ -154,6 +160,13 @@ func (fd *File) unmarshalSeed(b []byte) { numServices++ } prevField = num + case protowire.VarintType: + v, m := protowire.ConsumeVarint(b) + b = b[m:] + switch num { + case genid.FileDescriptorProto_Edition_field_number: + fd.L1.Edition = Edition(v) + } default: m := protowire.ConsumeFieldValue(num, typ, b) b = b[m:] @@ -166,6 +179,15 @@ func (fd *File) unmarshalSeed(b []byte) { fd.L1.Syntax = protoreflect.Proto2 } + if fd.L1.Syntax == protoreflect.Editions { + fd.L1.EditionFeatures = getFeaturesFor(fd.L1.Edition) + } + + // Parse editions features from options if any + if options != nil { + fd.unmarshalSeedOptions(options) + } + // Must allocate all declarations before parsing each descriptor type // to ensure we handled all descriptors in "flattened ordering". if numEnums > 0 { @@ -219,6 +241,28 @@ func (fd *File) unmarshalSeed(b []byte) { } } +func (fd *File) unmarshalSeedOptions(b []byte) { + for b := b; len(b) > 0; { + num, typ, n := protowire.ConsumeTag(b) + b = b[n:] + switch typ { + case protowire.BytesType: + v, m := protowire.ConsumeBytes(b) + b = b[m:] + switch num { + case genid.FileOptions_Features_field_number: + if fd.Syntax() != protoreflect.Editions { + panic(fmt.Sprintf("invalid descriptor: using edition features in a proto with syntax %s", fd.Syntax())) + } + fd.L1.EditionFeatures = unmarshalFeatureSet(v, fd.L1.EditionFeatures) + } + default: + m := protowire.ConsumeFieldValue(num, typ, b) + b = b[m:] + } + } +} + func (ed *Enum) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) { ed.L0.ParentFile = pf ed.L0.Parent = pd @@ -275,6 +319,7 @@ func (md *Message) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protor md.L0.ParentFile = pf md.L0.Parent = pd md.L0.Index = i + md.L1.EditionFeatures = featuresFromParentDesc(md.Parent()) var prevField protoreflect.FieldNumber var numEnums, numMessages, numExtensions int @@ -380,6 +425,13 @@ func (md *Message) unmarshalSeedOptions(b []byte) { case genid.MessageOptions_MessageSetWireFormat_field_number: md.L1.IsMessageSet = protowire.DecodeBool(v) } + case protowire.BytesType: + v, m := protowire.ConsumeBytes(b) + b = b[m:] + switch num { + case genid.MessageOptions_Features_field_number: + md.L1.EditionFeatures = unmarshalFeatureSet(v, md.L1.EditionFeatures) + } default: m := protowire.ConsumeFieldValue(num, typ, b) b = b[m:] diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go index 736a19a75..482a61cc1 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go @@ -414,6 +414,7 @@ func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoref fd.L0.ParentFile = pf fd.L0.Parent = pd fd.L0.Index = i + fd.L1.EditionFeatures = featuresFromParentDesc(fd.Parent()) var rawTypeName []byte var rawOptions []byte @@ -465,6 +466,12 @@ func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoref b = b[m:] } } + if fd.Syntax() == protoreflect.Editions && fd.L1.Kind == protoreflect.MessageKind && fd.L1.EditionFeatures.IsDelimitedEncoded { + fd.L1.Kind = protoreflect.GroupKind + } + if fd.Syntax() == protoreflect.Editions && fd.L1.EditionFeatures.IsLegacyRequired { + fd.L1.Cardinality = protoreflect.Required + } if rawTypeName != nil { name := makeFullName(sb, rawTypeName) switch fd.L1.Kind { @@ -497,6 +504,13 @@ func (fd *Field) unmarshalOptions(b []byte) { fd.L1.HasEnforceUTF8 = true fd.L1.EnforceUTF8 = protowire.DecodeBool(v) } + case protowire.BytesType: + v, m := protowire.ConsumeBytes(b) + b = b[m:] + switch num { + case genid.FieldOptions_Features_field_number: + fd.L1.EditionFeatures = unmarshalFeatureSet(v, fd.L1.EditionFeatures) + } default: m := protowire.ConsumeFieldValue(num, typ, b) b = b[m:] @@ -534,6 +548,7 @@ func (od *Oneof) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoref func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) { var rawTypeName []byte var rawOptions []byte + xd.L1.EditionFeatures = featuresFromParentDesc(xd.L1.Extendee) xd.L2 = new(ExtensionL2) for len(b) > 0 { num, typ, n := protowire.ConsumeTag(b) @@ -565,6 +580,12 @@ func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) { b = b[m:] } } + if xd.Syntax() == protoreflect.Editions && xd.L1.Kind == protoreflect.MessageKind && xd.L1.EditionFeatures.IsDelimitedEncoded { + xd.L1.Kind = protoreflect.GroupKind + } + if xd.Syntax() == protoreflect.Editions && xd.L1.EditionFeatures.IsLegacyRequired { + xd.L1.Cardinality = protoreflect.Required + } if rawTypeName != nil { name := makeFullName(sb, rawTypeName) switch xd.L1.Kind { @@ -589,6 +610,13 @@ func (xd *Extension) unmarshalOptions(b []byte) { case genid.FieldOptions_Packed_field_number: xd.L2.IsPacked = protowire.DecodeBool(v) } + case protowire.BytesType: + v, m := protowire.ConsumeBytes(b) + b = b[m:] + switch num { + case genid.FieldOptions_Features_field_number: + xd.L1.EditionFeatures = unmarshalFeatureSet(v, xd.L1.EditionFeatures) + } default: m := protowire.ConsumeFieldValue(num, typ, b) b = b[m:] diff --git a/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go b/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go index 136f1b215..40272c893 100644 --- a/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go +++ b/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go @@ -12,6 +12,27 @@ import ( const File_google_protobuf_descriptor_proto = "google/protobuf/descriptor.proto" +// Full and short names for google.protobuf.Edition. +const ( + Edition_enum_fullname = "google.protobuf.Edition" + Edition_enum_name = "Edition" +) + +// Enum values for google.protobuf.Edition. +const ( + Edition_EDITION_UNKNOWN_enum_value = 0 + Edition_EDITION_PROTO2_enum_value = 998 + Edition_EDITION_PROTO3_enum_value = 999 + Edition_EDITION_2023_enum_value = 1000 + Edition_EDITION_2024_enum_value = 1001 + Edition_EDITION_1_TEST_ONLY_enum_value = 1 + Edition_EDITION_2_TEST_ONLY_enum_value = 2 + Edition_EDITION_99997_TEST_ONLY_enum_value = 99997 + Edition_EDITION_99998_TEST_ONLY_enum_value = 99998 + Edition_EDITION_99999_TEST_ONLY_enum_value = 99999 + Edition_EDITION_MAX_enum_value = 2147483647 +) + // Names for google.protobuf.FileDescriptorSet. const ( FileDescriptorSet_message_name protoreflect.Name = "FileDescriptorSet" @@ -81,7 +102,7 @@ const ( FileDescriptorProto_Options_field_number protoreflect.FieldNumber = 8 FileDescriptorProto_SourceCodeInfo_field_number protoreflect.FieldNumber = 9 FileDescriptorProto_Syntax_field_number protoreflect.FieldNumber = 12 - FileDescriptorProto_Edition_field_number protoreflect.FieldNumber = 13 + FileDescriptorProto_Edition_field_number protoreflect.FieldNumber = 14 ) // Names for google.protobuf.DescriptorProto. @@ -184,10 +205,12 @@ const ( const ( ExtensionRangeOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" ExtensionRangeOptions_Declaration_field_name protoreflect.Name = "declaration" + ExtensionRangeOptions_Features_field_name protoreflect.Name = "features" ExtensionRangeOptions_Verification_field_name protoreflect.Name = "verification" ExtensionRangeOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.uninterpreted_option" ExtensionRangeOptions_Declaration_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.declaration" + ExtensionRangeOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.features" ExtensionRangeOptions_Verification_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.verification" ) @@ -195,6 +218,7 @@ const ( const ( ExtensionRangeOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 ExtensionRangeOptions_Declaration_field_number protoreflect.FieldNumber = 2 + ExtensionRangeOptions_Features_field_number protoreflect.FieldNumber = 50 ExtensionRangeOptions_Verification_field_number protoreflect.FieldNumber = 3 ) @@ -204,6 +228,12 @@ const ( ExtensionRangeOptions_VerificationState_enum_name = "VerificationState" ) +// Enum values for google.protobuf.ExtensionRangeOptions.VerificationState. +const ( + ExtensionRangeOptions_DECLARATION_enum_value = 0 + ExtensionRangeOptions_UNVERIFIED_enum_value = 1 +) + // Names for google.protobuf.ExtensionRangeOptions.Declaration. const ( ExtensionRangeOptions_Declaration_message_name protoreflect.Name = "Declaration" @@ -212,29 +242,26 @@ const ( // Field names for google.protobuf.ExtensionRangeOptions.Declaration. const ( - ExtensionRangeOptions_Declaration_Number_field_name protoreflect.Name = "number" - ExtensionRangeOptions_Declaration_FullName_field_name protoreflect.Name = "full_name" - ExtensionRangeOptions_Declaration_Type_field_name protoreflect.Name = "type" - ExtensionRangeOptions_Declaration_IsRepeated_field_name protoreflect.Name = "is_repeated" - ExtensionRangeOptions_Declaration_Reserved_field_name protoreflect.Name = "reserved" - ExtensionRangeOptions_Declaration_Repeated_field_name protoreflect.Name = "repeated" + ExtensionRangeOptions_Declaration_Number_field_name protoreflect.Name = "number" + ExtensionRangeOptions_Declaration_FullName_field_name protoreflect.Name = "full_name" + ExtensionRangeOptions_Declaration_Type_field_name protoreflect.Name = "type" + ExtensionRangeOptions_Declaration_Reserved_field_name protoreflect.Name = "reserved" + ExtensionRangeOptions_Declaration_Repeated_field_name protoreflect.Name = "repeated" - ExtensionRangeOptions_Declaration_Number_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.number" - ExtensionRangeOptions_Declaration_FullName_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.full_name" - ExtensionRangeOptions_Declaration_Type_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.type" - ExtensionRangeOptions_Declaration_IsRepeated_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.is_repeated" - ExtensionRangeOptions_Declaration_Reserved_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.reserved" - ExtensionRangeOptions_Declaration_Repeated_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.repeated" + ExtensionRangeOptions_Declaration_Number_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.number" + ExtensionRangeOptions_Declaration_FullName_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.full_name" + ExtensionRangeOptions_Declaration_Type_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.type" + ExtensionRangeOptions_Declaration_Reserved_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.reserved" + ExtensionRangeOptions_Declaration_Repeated_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.repeated" ) // Field numbers for google.protobuf.ExtensionRangeOptions.Declaration. const ( - ExtensionRangeOptions_Declaration_Number_field_number protoreflect.FieldNumber = 1 - ExtensionRangeOptions_Declaration_FullName_field_number protoreflect.FieldNumber = 2 - ExtensionRangeOptions_Declaration_Type_field_number protoreflect.FieldNumber = 3 - ExtensionRangeOptions_Declaration_IsRepeated_field_number protoreflect.FieldNumber = 4 - ExtensionRangeOptions_Declaration_Reserved_field_number protoreflect.FieldNumber = 5 - ExtensionRangeOptions_Declaration_Repeated_field_number protoreflect.FieldNumber = 6 + ExtensionRangeOptions_Declaration_Number_field_number protoreflect.FieldNumber = 1 + ExtensionRangeOptions_Declaration_FullName_field_number protoreflect.FieldNumber = 2 + ExtensionRangeOptions_Declaration_Type_field_number protoreflect.FieldNumber = 3 + ExtensionRangeOptions_Declaration_Reserved_field_number protoreflect.FieldNumber = 5 + ExtensionRangeOptions_Declaration_Repeated_field_number protoreflect.FieldNumber = 6 ) // Names for google.protobuf.FieldDescriptorProto. @@ -291,12 +318,41 @@ const ( FieldDescriptorProto_Type_enum_name = "Type" ) +// Enum values for google.protobuf.FieldDescriptorProto.Type. +const ( + FieldDescriptorProto_TYPE_DOUBLE_enum_value = 1 + FieldDescriptorProto_TYPE_FLOAT_enum_value = 2 + FieldDescriptorProto_TYPE_INT64_enum_value = 3 + FieldDescriptorProto_TYPE_UINT64_enum_value = 4 + FieldDescriptorProto_TYPE_INT32_enum_value = 5 + FieldDescriptorProto_TYPE_FIXED64_enum_value = 6 + FieldDescriptorProto_TYPE_FIXED32_enum_value = 7 + FieldDescriptorProto_TYPE_BOOL_enum_value = 8 + FieldDescriptorProto_TYPE_STRING_enum_value = 9 + FieldDescriptorProto_TYPE_GROUP_enum_value = 10 + FieldDescriptorProto_TYPE_MESSAGE_enum_value = 11 + FieldDescriptorProto_TYPE_BYTES_enum_value = 12 + FieldDescriptorProto_TYPE_UINT32_enum_value = 13 + FieldDescriptorProto_TYPE_ENUM_enum_value = 14 + FieldDescriptorProto_TYPE_SFIXED32_enum_value = 15 + FieldDescriptorProto_TYPE_SFIXED64_enum_value = 16 + FieldDescriptorProto_TYPE_SINT32_enum_value = 17 + FieldDescriptorProto_TYPE_SINT64_enum_value = 18 +) + // Full and short names for google.protobuf.FieldDescriptorProto.Label. const ( FieldDescriptorProto_Label_enum_fullname = "google.protobuf.FieldDescriptorProto.Label" FieldDescriptorProto_Label_enum_name = "Label" ) +// Enum values for google.protobuf.FieldDescriptorProto.Label. +const ( + FieldDescriptorProto_LABEL_OPTIONAL_enum_value = 1 + FieldDescriptorProto_LABEL_REPEATED_enum_value = 3 + FieldDescriptorProto_LABEL_REQUIRED_enum_value = 2 +) + // Names for google.protobuf.OneofDescriptorProto. const ( OneofDescriptorProto_message_name protoreflect.Name = "OneofDescriptorProto" @@ -468,7 +524,6 @@ const ( FileOptions_CcGenericServices_field_name protoreflect.Name = "cc_generic_services" FileOptions_JavaGenericServices_field_name protoreflect.Name = "java_generic_services" FileOptions_PyGenericServices_field_name protoreflect.Name = "py_generic_services" - FileOptions_PhpGenericServices_field_name protoreflect.Name = "php_generic_services" FileOptions_Deprecated_field_name protoreflect.Name = "deprecated" FileOptions_CcEnableArenas_field_name protoreflect.Name = "cc_enable_arenas" FileOptions_ObjcClassPrefix_field_name protoreflect.Name = "objc_class_prefix" @@ -478,6 +533,7 @@ const ( FileOptions_PhpNamespace_field_name protoreflect.Name = "php_namespace" FileOptions_PhpMetadataNamespace_field_name protoreflect.Name = "php_metadata_namespace" FileOptions_RubyPackage_field_name protoreflect.Name = "ruby_package" + FileOptions_Features_field_name protoreflect.Name = "features" FileOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" FileOptions_JavaPackage_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.java_package" @@ -490,7 +546,6 @@ const ( FileOptions_CcGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.cc_generic_services" FileOptions_JavaGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.java_generic_services" FileOptions_PyGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.py_generic_services" - FileOptions_PhpGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.php_generic_services" FileOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.deprecated" FileOptions_CcEnableArenas_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.cc_enable_arenas" FileOptions_ObjcClassPrefix_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.objc_class_prefix" @@ -500,6 +555,7 @@ const ( FileOptions_PhpNamespace_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.php_namespace" FileOptions_PhpMetadataNamespace_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.php_metadata_namespace" FileOptions_RubyPackage_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.ruby_package" + FileOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.features" FileOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.uninterpreted_option" ) @@ -515,7 +571,6 @@ const ( FileOptions_CcGenericServices_field_number protoreflect.FieldNumber = 16 FileOptions_JavaGenericServices_field_number protoreflect.FieldNumber = 17 FileOptions_PyGenericServices_field_number protoreflect.FieldNumber = 18 - FileOptions_PhpGenericServices_field_number protoreflect.FieldNumber = 42 FileOptions_Deprecated_field_number protoreflect.FieldNumber = 23 FileOptions_CcEnableArenas_field_number protoreflect.FieldNumber = 31 FileOptions_ObjcClassPrefix_field_number protoreflect.FieldNumber = 36 @@ -525,6 +580,7 @@ const ( FileOptions_PhpNamespace_field_number protoreflect.FieldNumber = 41 FileOptions_PhpMetadataNamespace_field_number protoreflect.FieldNumber = 44 FileOptions_RubyPackage_field_number protoreflect.FieldNumber = 45 + FileOptions_Features_field_number protoreflect.FieldNumber = 50 FileOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 ) @@ -534,6 +590,13 @@ const ( FileOptions_OptimizeMode_enum_name = "OptimizeMode" ) +// Enum values for google.protobuf.FileOptions.OptimizeMode. +const ( + FileOptions_SPEED_enum_value = 1 + FileOptions_CODE_SIZE_enum_value = 2 + FileOptions_LITE_RUNTIME_enum_value = 3 +) + // Names for google.protobuf.MessageOptions. const ( MessageOptions_message_name protoreflect.Name = "MessageOptions" @@ -547,6 +610,7 @@ const ( MessageOptions_Deprecated_field_name protoreflect.Name = "deprecated" MessageOptions_MapEntry_field_name protoreflect.Name = "map_entry" MessageOptions_DeprecatedLegacyJsonFieldConflicts_field_name protoreflect.Name = "deprecated_legacy_json_field_conflicts" + MessageOptions_Features_field_name protoreflect.Name = "features" MessageOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" MessageOptions_MessageSetWireFormat_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.message_set_wire_format" @@ -554,6 +618,7 @@ const ( MessageOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.deprecated" MessageOptions_MapEntry_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.map_entry" MessageOptions_DeprecatedLegacyJsonFieldConflicts_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.deprecated_legacy_json_field_conflicts" + MessageOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.features" MessageOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.uninterpreted_option" ) @@ -564,6 +629,7 @@ const ( MessageOptions_Deprecated_field_number protoreflect.FieldNumber = 3 MessageOptions_MapEntry_field_number protoreflect.FieldNumber = 7 MessageOptions_DeprecatedLegacyJsonFieldConflicts_field_number protoreflect.FieldNumber = 11 + MessageOptions_Features_field_number protoreflect.FieldNumber = 12 MessageOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 ) @@ -584,8 +650,9 @@ const ( FieldOptions_Weak_field_name protoreflect.Name = "weak" FieldOptions_DebugRedact_field_name protoreflect.Name = "debug_redact" FieldOptions_Retention_field_name protoreflect.Name = "retention" - FieldOptions_Target_field_name protoreflect.Name = "target" FieldOptions_Targets_field_name protoreflect.Name = "targets" + FieldOptions_EditionDefaults_field_name protoreflect.Name = "edition_defaults" + FieldOptions_Features_field_name protoreflect.Name = "features" FieldOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" FieldOptions_Ctype_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.ctype" @@ -597,8 +664,9 @@ const ( FieldOptions_Weak_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.weak" FieldOptions_DebugRedact_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.debug_redact" FieldOptions_Retention_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.retention" - FieldOptions_Target_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.target" FieldOptions_Targets_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.targets" + FieldOptions_EditionDefaults_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.edition_defaults" + FieldOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.features" FieldOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.uninterpreted_option" ) @@ -613,8 +681,9 @@ const ( FieldOptions_Weak_field_number protoreflect.FieldNumber = 10 FieldOptions_DebugRedact_field_number protoreflect.FieldNumber = 16 FieldOptions_Retention_field_number protoreflect.FieldNumber = 17 - FieldOptions_Target_field_number protoreflect.FieldNumber = 18 FieldOptions_Targets_field_number protoreflect.FieldNumber = 19 + FieldOptions_EditionDefaults_field_number protoreflect.FieldNumber = 20 + FieldOptions_Features_field_number protoreflect.FieldNumber = 21 FieldOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 ) @@ -624,24 +693,80 @@ const ( FieldOptions_CType_enum_name = "CType" ) +// Enum values for google.protobuf.FieldOptions.CType. +const ( + FieldOptions_STRING_enum_value = 0 + FieldOptions_CORD_enum_value = 1 + FieldOptions_STRING_PIECE_enum_value = 2 +) + // Full and short names for google.protobuf.FieldOptions.JSType. const ( FieldOptions_JSType_enum_fullname = "google.protobuf.FieldOptions.JSType" FieldOptions_JSType_enum_name = "JSType" ) +// Enum values for google.protobuf.FieldOptions.JSType. +const ( + FieldOptions_JS_NORMAL_enum_value = 0 + FieldOptions_JS_STRING_enum_value = 1 + FieldOptions_JS_NUMBER_enum_value = 2 +) + // Full and short names for google.protobuf.FieldOptions.OptionRetention. const ( FieldOptions_OptionRetention_enum_fullname = "google.protobuf.FieldOptions.OptionRetention" FieldOptions_OptionRetention_enum_name = "OptionRetention" ) +// Enum values for google.protobuf.FieldOptions.OptionRetention. +const ( + FieldOptions_RETENTION_UNKNOWN_enum_value = 0 + FieldOptions_RETENTION_RUNTIME_enum_value = 1 + FieldOptions_RETENTION_SOURCE_enum_value = 2 +) + // Full and short names for google.protobuf.FieldOptions.OptionTargetType. const ( FieldOptions_OptionTargetType_enum_fullname = "google.protobuf.FieldOptions.OptionTargetType" FieldOptions_OptionTargetType_enum_name = "OptionTargetType" ) +// Enum values for google.protobuf.FieldOptions.OptionTargetType. +const ( + FieldOptions_TARGET_TYPE_UNKNOWN_enum_value = 0 + FieldOptions_TARGET_TYPE_FILE_enum_value = 1 + FieldOptions_TARGET_TYPE_EXTENSION_RANGE_enum_value = 2 + FieldOptions_TARGET_TYPE_MESSAGE_enum_value = 3 + FieldOptions_TARGET_TYPE_FIELD_enum_value = 4 + FieldOptions_TARGET_TYPE_ONEOF_enum_value = 5 + FieldOptions_TARGET_TYPE_ENUM_enum_value = 6 + FieldOptions_TARGET_TYPE_ENUM_ENTRY_enum_value = 7 + FieldOptions_TARGET_TYPE_SERVICE_enum_value = 8 + FieldOptions_TARGET_TYPE_METHOD_enum_value = 9 +) + +// Names for google.protobuf.FieldOptions.EditionDefault. +const ( + FieldOptions_EditionDefault_message_name protoreflect.Name = "EditionDefault" + FieldOptions_EditionDefault_message_fullname protoreflect.FullName = "google.protobuf.FieldOptions.EditionDefault" +) + +// Field names for google.protobuf.FieldOptions.EditionDefault. +const ( + FieldOptions_EditionDefault_Edition_field_name protoreflect.Name = "edition" + FieldOptions_EditionDefault_Value_field_name protoreflect.Name = "value" + + FieldOptions_EditionDefault_Edition_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.EditionDefault.edition" + FieldOptions_EditionDefault_Value_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.EditionDefault.value" +) + +// Field numbers for google.protobuf.FieldOptions.EditionDefault. +const ( + FieldOptions_EditionDefault_Edition_field_number protoreflect.FieldNumber = 3 + FieldOptions_EditionDefault_Value_field_number protoreflect.FieldNumber = 2 +) + // Names for google.protobuf.OneofOptions. const ( OneofOptions_message_name protoreflect.Name = "OneofOptions" @@ -650,13 +775,16 @@ const ( // Field names for google.protobuf.OneofOptions. const ( + OneofOptions_Features_field_name protoreflect.Name = "features" OneofOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" + OneofOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.OneofOptions.features" OneofOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.OneofOptions.uninterpreted_option" ) // Field numbers for google.protobuf.OneofOptions. const ( + OneofOptions_Features_field_number protoreflect.FieldNumber = 1 OneofOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 ) @@ -671,11 +799,13 @@ const ( EnumOptions_AllowAlias_field_name protoreflect.Name = "allow_alias" EnumOptions_Deprecated_field_name protoreflect.Name = "deprecated" EnumOptions_DeprecatedLegacyJsonFieldConflicts_field_name protoreflect.Name = "deprecated_legacy_json_field_conflicts" + EnumOptions_Features_field_name protoreflect.Name = "features" EnumOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" EnumOptions_AllowAlias_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.allow_alias" EnumOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.deprecated" EnumOptions_DeprecatedLegacyJsonFieldConflicts_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.deprecated_legacy_json_field_conflicts" + EnumOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.features" EnumOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.uninterpreted_option" ) @@ -684,6 +814,7 @@ const ( EnumOptions_AllowAlias_field_number protoreflect.FieldNumber = 2 EnumOptions_Deprecated_field_number protoreflect.FieldNumber = 3 EnumOptions_DeprecatedLegacyJsonFieldConflicts_field_number protoreflect.FieldNumber = 6 + EnumOptions_Features_field_number protoreflect.FieldNumber = 7 EnumOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 ) @@ -696,15 +827,21 @@ const ( // Field names for google.protobuf.EnumValueOptions. const ( EnumValueOptions_Deprecated_field_name protoreflect.Name = "deprecated" + EnumValueOptions_Features_field_name protoreflect.Name = "features" + EnumValueOptions_DebugRedact_field_name protoreflect.Name = "debug_redact" EnumValueOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" EnumValueOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.deprecated" + EnumValueOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.features" + EnumValueOptions_DebugRedact_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.debug_redact" EnumValueOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.uninterpreted_option" ) // Field numbers for google.protobuf.EnumValueOptions. const ( EnumValueOptions_Deprecated_field_number protoreflect.FieldNumber = 1 + EnumValueOptions_Features_field_number protoreflect.FieldNumber = 2 + EnumValueOptions_DebugRedact_field_number protoreflect.FieldNumber = 3 EnumValueOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 ) @@ -716,15 +853,18 @@ const ( // Field names for google.protobuf.ServiceOptions. const ( + ServiceOptions_Features_field_name protoreflect.Name = "features" ServiceOptions_Deprecated_field_name protoreflect.Name = "deprecated" ServiceOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" + ServiceOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.ServiceOptions.features" ServiceOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.ServiceOptions.deprecated" ServiceOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.ServiceOptions.uninterpreted_option" ) // Field numbers for google.protobuf.ServiceOptions. const ( + ServiceOptions_Features_field_number protoreflect.FieldNumber = 34 ServiceOptions_Deprecated_field_number protoreflect.FieldNumber = 33 ServiceOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 ) @@ -739,10 +879,12 @@ const ( const ( MethodOptions_Deprecated_field_name protoreflect.Name = "deprecated" MethodOptions_IdempotencyLevel_field_name protoreflect.Name = "idempotency_level" + MethodOptions_Features_field_name protoreflect.Name = "features" MethodOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" MethodOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.deprecated" MethodOptions_IdempotencyLevel_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.idempotency_level" + MethodOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.features" MethodOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.uninterpreted_option" ) @@ -750,6 +892,7 @@ const ( const ( MethodOptions_Deprecated_field_number protoreflect.FieldNumber = 33 MethodOptions_IdempotencyLevel_field_number protoreflect.FieldNumber = 34 + MethodOptions_Features_field_number protoreflect.FieldNumber = 35 MethodOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 ) @@ -759,6 +902,13 @@ const ( MethodOptions_IdempotencyLevel_enum_name = "IdempotencyLevel" ) +// Enum values for google.protobuf.MethodOptions.IdempotencyLevel. +const ( + MethodOptions_IDEMPOTENCY_UNKNOWN_enum_value = 0 + MethodOptions_NO_SIDE_EFFECTS_enum_value = 1 + MethodOptions_IDEMPOTENT_enum_value = 2 +) + // Names for google.protobuf.UninterpretedOption. const ( UninterpretedOption_message_name protoreflect.Name = "UninterpretedOption" @@ -816,6 +966,163 @@ const ( UninterpretedOption_NamePart_IsExtension_field_number protoreflect.FieldNumber = 2 ) +// Names for google.protobuf.FeatureSet. +const ( + FeatureSet_message_name protoreflect.Name = "FeatureSet" + FeatureSet_message_fullname protoreflect.FullName = "google.protobuf.FeatureSet" +) + +// Field names for google.protobuf.FeatureSet. +const ( + FeatureSet_FieldPresence_field_name protoreflect.Name = "field_presence" + FeatureSet_EnumType_field_name protoreflect.Name = "enum_type" + FeatureSet_RepeatedFieldEncoding_field_name protoreflect.Name = "repeated_field_encoding" + FeatureSet_Utf8Validation_field_name protoreflect.Name = "utf8_validation" + FeatureSet_MessageEncoding_field_name protoreflect.Name = "message_encoding" + FeatureSet_JsonFormat_field_name protoreflect.Name = "json_format" + + FeatureSet_FieldPresence_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.field_presence" + FeatureSet_EnumType_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.enum_type" + FeatureSet_RepeatedFieldEncoding_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.repeated_field_encoding" + FeatureSet_Utf8Validation_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.utf8_validation" + FeatureSet_MessageEncoding_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.message_encoding" + FeatureSet_JsonFormat_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.json_format" +) + +// Field numbers for google.protobuf.FeatureSet. +const ( + FeatureSet_FieldPresence_field_number protoreflect.FieldNumber = 1 + FeatureSet_EnumType_field_number protoreflect.FieldNumber = 2 + FeatureSet_RepeatedFieldEncoding_field_number protoreflect.FieldNumber = 3 + FeatureSet_Utf8Validation_field_number protoreflect.FieldNumber = 4 + FeatureSet_MessageEncoding_field_number protoreflect.FieldNumber = 5 + FeatureSet_JsonFormat_field_number protoreflect.FieldNumber = 6 +) + +// Full and short names for google.protobuf.FeatureSet.FieldPresence. +const ( + FeatureSet_FieldPresence_enum_fullname = "google.protobuf.FeatureSet.FieldPresence" + FeatureSet_FieldPresence_enum_name = "FieldPresence" +) + +// Enum values for google.protobuf.FeatureSet.FieldPresence. +const ( + FeatureSet_FIELD_PRESENCE_UNKNOWN_enum_value = 0 + FeatureSet_EXPLICIT_enum_value = 1 + FeatureSet_IMPLICIT_enum_value = 2 + FeatureSet_LEGACY_REQUIRED_enum_value = 3 +) + +// Full and short names for google.protobuf.FeatureSet.EnumType. +const ( + FeatureSet_EnumType_enum_fullname = "google.protobuf.FeatureSet.EnumType" + FeatureSet_EnumType_enum_name = "EnumType" +) + +// Enum values for google.protobuf.FeatureSet.EnumType. +const ( + FeatureSet_ENUM_TYPE_UNKNOWN_enum_value = 0 + FeatureSet_OPEN_enum_value = 1 + FeatureSet_CLOSED_enum_value = 2 +) + +// Full and short names for google.protobuf.FeatureSet.RepeatedFieldEncoding. +const ( + FeatureSet_RepeatedFieldEncoding_enum_fullname = "google.protobuf.FeatureSet.RepeatedFieldEncoding" + FeatureSet_RepeatedFieldEncoding_enum_name = "RepeatedFieldEncoding" +) + +// Enum values for google.protobuf.FeatureSet.RepeatedFieldEncoding. +const ( + FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN_enum_value = 0 + FeatureSet_PACKED_enum_value = 1 + FeatureSet_EXPANDED_enum_value = 2 +) + +// Full and short names for google.protobuf.FeatureSet.Utf8Validation. +const ( + FeatureSet_Utf8Validation_enum_fullname = "google.protobuf.FeatureSet.Utf8Validation" + FeatureSet_Utf8Validation_enum_name = "Utf8Validation" +) + +// Enum values for google.protobuf.FeatureSet.Utf8Validation. +const ( + FeatureSet_UTF8_VALIDATION_UNKNOWN_enum_value = 0 + FeatureSet_VERIFY_enum_value = 2 + FeatureSet_NONE_enum_value = 3 +) + +// Full and short names for google.protobuf.FeatureSet.MessageEncoding. +const ( + FeatureSet_MessageEncoding_enum_fullname = "google.protobuf.FeatureSet.MessageEncoding" + FeatureSet_MessageEncoding_enum_name = "MessageEncoding" +) + +// Enum values for google.protobuf.FeatureSet.MessageEncoding. +const ( + FeatureSet_MESSAGE_ENCODING_UNKNOWN_enum_value = 0 + FeatureSet_LENGTH_PREFIXED_enum_value = 1 + FeatureSet_DELIMITED_enum_value = 2 +) + +// Full and short names for google.protobuf.FeatureSet.JsonFormat. +const ( + FeatureSet_JsonFormat_enum_fullname = "google.protobuf.FeatureSet.JsonFormat" + FeatureSet_JsonFormat_enum_name = "JsonFormat" +) + +// Enum values for google.protobuf.FeatureSet.JsonFormat. +const ( + FeatureSet_JSON_FORMAT_UNKNOWN_enum_value = 0 + FeatureSet_ALLOW_enum_value = 1 + FeatureSet_LEGACY_BEST_EFFORT_enum_value = 2 +) + +// Names for google.protobuf.FeatureSetDefaults. +const ( + FeatureSetDefaults_message_name protoreflect.Name = "FeatureSetDefaults" + FeatureSetDefaults_message_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults" +) + +// Field names for google.protobuf.FeatureSetDefaults. +const ( + FeatureSetDefaults_Defaults_field_name protoreflect.Name = "defaults" + FeatureSetDefaults_MinimumEdition_field_name protoreflect.Name = "minimum_edition" + FeatureSetDefaults_MaximumEdition_field_name protoreflect.Name = "maximum_edition" + + FeatureSetDefaults_Defaults_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.defaults" + FeatureSetDefaults_MinimumEdition_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.minimum_edition" + FeatureSetDefaults_MaximumEdition_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.maximum_edition" +) + +// Field numbers for google.protobuf.FeatureSetDefaults. +const ( + FeatureSetDefaults_Defaults_field_number protoreflect.FieldNumber = 1 + FeatureSetDefaults_MinimumEdition_field_number protoreflect.FieldNumber = 4 + FeatureSetDefaults_MaximumEdition_field_number protoreflect.FieldNumber = 5 +) + +// Names for google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault. +const ( + FeatureSetDefaults_FeatureSetEditionDefault_message_name protoreflect.Name = "FeatureSetEditionDefault" + FeatureSetDefaults_FeatureSetEditionDefault_message_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault" +) + +// Field names for google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault. +const ( + FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_name protoreflect.Name = "edition" + FeatureSetDefaults_FeatureSetEditionDefault_Features_field_name protoreflect.Name = "features" + + FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.edition" + FeatureSetDefaults_FeatureSetEditionDefault_Features_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features" +) + +// Field numbers for google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault. +const ( + FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_number protoreflect.FieldNumber = 3 + FeatureSetDefaults_FeatureSetEditionDefault_Features_field_number protoreflect.FieldNumber = 2 +) + // Names for google.protobuf.SourceCodeInfo. const ( SourceCodeInfo_message_name protoreflect.Name = "SourceCodeInfo" @@ -917,3 +1224,10 @@ const ( GeneratedCodeInfo_Annotation_Semantic_enum_fullname = "google.protobuf.GeneratedCodeInfo.Annotation.Semantic" GeneratedCodeInfo_Annotation_Semantic_enum_name = "Semantic" ) + +// Enum values for google.protobuf.GeneratedCodeInfo.Annotation.Semantic. +const ( + GeneratedCodeInfo_Annotation_NONE_enum_value = 0 + GeneratedCodeInfo_Annotation_SET_enum_value = 1 + GeneratedCodeInfo_Annotation_ALIAS_enum_value = 2 +) diff --git a/vendor/google.golang.org/protobuf/internal/genid/struct_gen.go b/vendor/google.golang.org/protobuf/internal/genid/struct_gen.go index 1a38944b2..ad6f80c46 100644 --- a/vendor/google.golang.org/protobuf/internal/genid/struct_gen.go +++ b/vendor/google.golang.org/protobuf/internal/genid/struct_gen.go @@ -18,6 +18,11 @@ const ( NullValue_enum_name = "NullValue" ) +// Enum values for google.protobuf.NullValue. +const ( + NullValue_NULL_VALUE_enum_value = 0 +) + // Names for google.protobuf.Struct. const ( Struct_message_name protoreflect.Name = "Struct" diff --git a/vendor/google.golang.org/protobuf/internal/genid/type_gen.go b/vendor/google.golang.org/protobuf/internal/genid/type_gen.go index e0f75fea0..49bc73e25 100644 --- a/vendor/google.golang.org/protobuf/internal/genid/type_gen.go +++ b/vendor/google.golang.org/protobuf/internal/genid/type_gen.go @@ -18,6 +18,13 @@ const ( Syntax_enum_name = "Syntax" ) +// Enum values for google.protobuf.Syntax. +const ( + Syntax_SYNTAX_PROTO2_enum_value = 0 + Syntax_SYNTAX_PROTO3_enum_value = 1 + Syntax_SYNTAX_EDITIONS_enum_value = 2 +) + // Names for google.protobuf.Type. const ( Type_message_name protoreflect.Name = "Type" @@ -105,12 +112,43 @@ const ( Field_Kind_enum_name = "Kind" ) +// Enum values for google.protobuf.Field.Kind. +const ( + Field_TYPE_UNKNOWN_enum_value = 0 + Field_TYPE_DOUBLE_enum_value = 1 + Field_TYPE_FLOAT_enum_value = 2 + Field_TYPE_INT64_enum_value = 3 + Field_TYPE_UINT64_enum_value = 4 + Field_TYPE_INT32_enum_value = 5 + Field_TYPE_FIXED64_enum_value = 6 + Field_TYPE_FIXED32_enum_value = 7 + Field_TYPE_BOOL_enum_value = 8 + Field_TYPE_STRING_enum_value = 9 + Field_TYPE_GROUP_enum_value = 10 + Field_TYPE_MESSAGE_enum_value = 11 + Field_TYPE_BYTES_enum_value = 12 + Field_TYPE_UINT32_enum_value = 13 + Field_TYPE_ENUM_enum_value = 14 + Field_TYPE_SFIXED32_enum_value = 15 + Field_TYPE_SFIXED64_enum_value = 16 + Field_TYPE_SINT32_enum_value = 17 + Field_TYPE_SINT64_enum_value = 18 +) + // Full and short names for google.protobuf.Field.Cardinality. const ( Field_Cardinality_enum_fullname = "google.protobuf.Field.Cardinality" Field_Cardinality_enum_name = "Cardinality" ) +// Enum values for google.protobuf.Field.Cardinality. +const ( + Field_CARDINALITY_UNKNOWN_enum_value = 0 + Field_CARDINALITY_OPTIONAL_enum_value = 1 + Field_CARDINALITY_REQUIRED_enum_value = 2 + Field_CARDINALITY_REPEATED_enum_value = 3 +) + // Names for google.protobuf.Enum. const ( Enum_message_name protoreflect.Name = "Enum" diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go b/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go index e74cefdc5..2b8f122c2 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go @@ -21,26 +21,18 @@ type extensionFieldInfo struct { validation validationInfo } -var legacyExtensionFieldInfoCache sync.Map // map[protoreflect.ExtensionType]*extensionFieldInfo - func getExtensionFieldInfo(xt protoreflect.ExtensionType) *extensionFieldInfo { if xi, ok := xt.(*ExtensionInfo); ok { xi.lazyInit() return xi.info } - return legacyLoadExtensionFieldInfo(xt) -} - -// legacyLoadExtensionFieldInfo dynamically loads a *ExtensionInfo for xt. -func legacyLoadExtensionFieldInfo(xt protoreflect.ExtensionType) *extensionFieldInfo { - if xi, ok := legacyExtensionFieldInfoCache.Load(xt); ok { - return xi.(*extensionFieldInfo) - } - e := makeExtensionFieldInfo(xt.TypeDescriptor()) - if e, ok := legacyMessageTypeCache.LoadOrStore(xt, e); ok { - return e.(*extensionFieldInfo) - } - return e + // Ideally we'd cache the resulting *extensionFieldInfo so we don't have to + // recompute this metadata repeatedly. But without support for something like + // weak references, such a cache would pin temporary values (like dynamic + // extension types, constructed for the duration of a user request) to the + // heap forever, causing memory usage of the cache to grow unbounded. + // See discussion in https://github.com/golang/protobuf/issues/1521. + return makeExtensionFieldInfo(xt.TypeDescriptor()) } func makeExtensionFieldInfo(xd protoreflect.ExtensionDescriptor) *extensionFieldInfo { diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_gen.go b/vendor/google.golang.org/protobuf/internal/impl/codec_gen.go index 1a509b63e..f55dc01e3 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_gen.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_gen.go @@ -162,11 +162,20 @@ func appendBoolSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions func consumeBoolSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.BoolSlice() if wtyp == protowire.BytesType { - s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { return out, errDecode } + count := 0 + for _, v := range b { + if v < 0x80 { + count++ + } + } + if count > 0 { + p.growBoolSlice(count) + } + s := *sp for len(b) > 0 { var v uint64 var n int @@ -732,11 +741,20 @@ func appendInt32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOption func consumeInt32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Int32Slice() if wtyp == protowire.BytesType { - s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { return out, errDecode } + count := 0 + for _, v := range b { + if v < 0x80 { + count++ + } + } + if count > 0 { + p.growInt32Slice(count) + } + s := *sp for len(b) > 0 { var v uint64 var n int @@ -1138,11 +1156,20 @@ func appendSint32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptio func consumeSint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Int32Slice() if wtyp == protowire.BytesType { - s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { return out, errDecode } + count := 0 + for _, v := range b { + if v < 0x80 { + count++ + } + } + if count > 0 { + p.growInt32Slice(count) + } + s := *sp for len(b) > 0 { var v uint64 var n int @@ -1544,11 +1571,20 @@ func appendUint32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptio func consumeUint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Uint32Slice() if wtyp == protowire.BytesType { - s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { return out, errDecode } + count := 0 + for _, v := range b { + if v < 0x80 { + count++ + } + } + if count > 0 { + p.growUint32Slice(count) + } + s := *sp for len(b) > 0 { var v uint64 var n int @@ -1950,11 +1986,20 @@ func appendInt64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOption func consumeInt64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Int64Slice() if wtyp == protowire.BytesType { - s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { return out, errDecode } + count := 0 + for _, v := range b { + if v < 0x80 { + count++ + } + } + if count > 0 { + p.growInt64Slice(count) + } + s := *sp for len(b) > 0 { var v uint64 var n int @@ -2356,11 +2401,20 @@ func appendSint64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptio func consumeSint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Int64Slice() if wtyp == protowire.BytesType { - s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { return out, errDecode } + count := 0 + for _, v := range b { + if v < 0x80 { + count++ + } + } + if count > 0 { + p.growInt64Slice(count) + } + s := *sp for len(b) > 0 { var v uint64 var n int @@ -2762,11 +2816,20 @@ func appendUint64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptio func consumeUint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Uint64Slice() if wtyp == protowire.BytesType { - s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { return out, errDecode } + count := 0 + for _, v := range b { + if v < 0x80 { + count++ + } + } + if count > 0 { + p.growUint64Slice(count) + } + s := *sp for len(b) > 0 { var v uint64 var n int @@ -3145,11 +3208,15 @@ func appendSfixed32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOpt func consumeSfixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Int32Slice() if wtyp == protowire.BytesType { - s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { return out, errDecode } + count := len(b) / protowire.SizeFixed32() + if count > 0 { + p.growInt32Slice(count) + } + s := *sp for len(b) > 0 { v, n := protowire.ConsumeFixed32(b) if n < 0 { @@ -3461,11 +3528,15 @@ func appendFixed32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOpti func consumeFixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Uint32Slice() if wtyp == protowire.BytesType { - s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { return out, errDecode } + count := len(b) / protowire.SizeFixed32() + if count > 0 { + p.growUint32Slice(count) + } + s := *sp for len(b) > 0 { v, n := protowire.ConsumeFixed32(b) if n < 0 { @@ -3777,11 +3848,15 @@ func appendFloatSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOption func consumeFloatSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Float32Slice() if wtyp == protowire.BytesType { - s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { return out, errDecode } + count := len(b) / protowire.SizeFixed32() + if count > 0 { + p.growFloat32Slice(count) + } + s := *sp for len(b) > 0 { v, n := protowire.ConsumeFixed32(b) if n < 0 { @@ -4093,11 +4168,15 @@ func appendSfixed64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOpt func consumeSfixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Int64Slice() if wtyp == protowire.BytesType { - s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { return out, errDecode } + count := len(b) / protowire.SizeFixed64() + if count > 0 { + p.growInt64Slice(count) + } + s := *sp for len(b) > 0 { v, n := protowire.ConsumeFixed64(b) if n < 0 { @@ -4409,11 +4488,15 @@ func appendFixed64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOpti func consumeFixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Uint64Slice() if wtyp == protowire.BytesType { - s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { return out, errDecode } + count := len(b) / protowire.SizeFixed64() + if count > 0 { + p.growUint64Slice(count) + } + s := *sp for len(b) > 0 { v, n := protowire.ConsumeFixed64(b) if n < 0 { @@ -4725,11 +4808,15 @@ func appendDoubleSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptio func consumeDoubleSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Float64Slice() if wtyp == protowire.BytesType { - s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { return out, errDecode } + count := len(b) / protowire.SizeFixed64() + if count > 0 { + p.growFloat64Slice(count) + } + s := *sp for len(b) > 0 { v, n := protowire.ConsumeFixed64(b) if n < 0 { diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_tables.go b/vendor/google.golang.org/protobuf/internal/impl/codec_tables.go index 576dcf3aa..13077751e 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_tables.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_tables.go @@ -197,7 +197,7 @@ func fieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) (*MessageInfo, return getMessageInfo(ft), makeMessageFieldCoder(fd, ft) case fd.Kind() == protoreflect.GroupKind: return getMessageInfo(ft), makeGroupFieldCoder(fd, ft) - case fd.Syntax() == protoreflect.Proto3 && fd.ContainingOneof() == nil: + case !fd.HasPresence() && fd.ContainingOneof() == nil: // Populated oneof fields always encode even if set to the zero value, // which normally are not encoded in proto3. switch fd.Kind() { diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go index 61c483fac..2ab2c6297 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go +++ b/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go @@ -206,13 +206,18 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name protoreflect.FullName // Obtain a list of oneof wrapper types. var oneofWrappers []reflect.Type - for _, method := range []string{"XXX_OneofFuncs", "XXX_OneofWrappers"} { - if fn, ok := t.MethodByName(method); ok { - for _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) { - if vs, ok := v.Interface().([]interface{}); ok { - for _, v := range vs { - oneofWrappers = append(oneofWrappers, reflect.TypeOf(v)) - } + methods := make([]reflect.Method, 0, 2) + if m, ok := t.MethodByName("XXX_OneofFuncs"); ok { + methods = append(methods, m) + } + if m, ok := t.MethodByName("XXX_OneofWrappers"); ok { + methods = append(methods, m) + } + for _, fn := range methods { + for _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) { + if vs, ok := v.Interface().([]interface{}); ok { + for _, v := range vs { + oneofWrappers = append(oneofWrappers, reflect.TypeOf(v)) } } } diff --git a/vendor/google.golang.org/protobuf/internal/impl/message.go b/vendor/google.golang.org/protobuf/internal/impl/message.go index 4f5fb67a0..629bacdce 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/message.go +++ b/vendor/google.golang.org/protobuf/internal/impl/message.go @@ -192,12 +192,17 @@ fieldLoop: // Derive a mapping of oneof wrappers to fields. oneofWrappers := mi.OneofWrappers - for _, method := range []string{"XXX_OneofFuncs", "XXX_OneofWrappers"} { - if fn, ok := reflect.PtrTo(t).MethodByName(method); ok { - for _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) { - if vs, ok := v.Interface().([]interface{}); ok { - oneofWrappers = vs - } + methods := make([]reflect.Method, 0, 2) + if m, ok := reflect.PtrTo(t).MethodByName("XXX_OneofFuncs"); ok { + methods = append(methods, m) + } + if m, ok := reflect.PtrTo(t).MethodByName("XXX_OneofWrappers"); ok { + methods = append(methods, m) + } + for _, fn := range methods { + for _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) { + if vs, ok := v.Interface().([]interface{}); ok { + oneofWrappers = vs } } } diff --git a/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go b/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go index 5e736c60e..986322b19 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go +++ b/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go @@ -538,6 +538,6 @@ func isZero(v reflect.Value) bool { } return true default: - panic(&reflect.ValueError{"reflect.Value.IsZero", v.Kind()}) + panic(&reflect.ValueError{Method: "reflect.Value.IsZero", Kind: v.Kind()}) } } diff --git a/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go b/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go index 4c491bdf4..517e94434 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go +++ b/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go @@ -159,6 +159,42 @@ func (p pointer) SetPointer(v pointer) { p.v.Elem().Set(v.v) } +func growSlice(p pointer, addCap int) { + // TODO: Once we only support Go 1.20 and newer, use reflect.Grow. + in := p.v.Elem() + out := reflect.MakeSlice(in.Type(), in.Len(), in.Len()+addCap) + reflect.Copy(out, in) + p.v.Elem().Set(out) +} + +func (p pointer) growBoolSlice(addCap int) { + growSlice(p, addCap) +} + +func (p pointer) growInt32Slice(addCap int) { + growSlice(p, addCap) +} + +func (p pointer) growUint32Slice(addCap int) { + growSlice(p, addCap) +} + +func (p pointer) growInt64Slice(addCap int) { + growSlice(p, addCap) +} + +func (p pointer) growUint64Slice(addCap int) { + growSlice(p, addCap) +} + +func (p pointer) growFloat64Slice(addCap int) { + growSlice(p, addCap) +} + +func (p pointer) growFloat32Slice(addCap int) { + growSlice(p, addCap) +} + func (Export) MessageStateOf(p Pointer) *messageState { panic("not supported") } func (ms *messageState) pointer() pointer { panic("not supported") } func (ms *messageState) messageInfo() *MessageInfo { panic("not supported") } diff --git a/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go b/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go index ee0e0573e..4b020e311 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go +++ b/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go @@ -138,6 +138,46 @@ func (p pointer) SetPointer(v pointer) { *(*unsafe.Pointer)(p.p) = (unsafe.Pointer)(v.p) } +func (p pointer) growBoolSlice(addCap int) { + sp := p.BoolSlice() + s := make([]bool, 0, addCap+len(*sp)) + s = s[:len(*sp)] + copy(s, *sp) + *sp = s +} + +func (p pointer) growInt32Slice(addCap int) { + sp := p.Int32Slice() + s := make([]int32, 0, addCap+len(*sp)) + s = s[:len(*sp)] + copy(s, *sp) + *sp = s +} + +func (p pointer) growUint32Slice(addCap int) { + p.growInt32Slice(addCap) +} + +func (p pointer) growFloat32Slice(addCap int) { + p.growInt32Slice(addCap) +} + +func (p pointer) growInt64Slice(addCap int) { + sp := p.Int64Slice() + s := make([]int64, 0, addCap+len(*sp)) + s = s[:len(*sp)] + copy(s, *sp) + *sp = s +} + +func (p pointer) growUint64Slice(addCap int) { + p.growInt64Slice(addCap) +} + +func (p pointer) growFloat64Slice(addCap int) { + p.growInt64Slice(addCap) +} + // Static check that MessageState does not exceed the size of a pointer. const _ = uint(unsafe.Sizeof(unsafe.Pointer(nil)) - unsafe.Sizeof(MessageState{})) diff --git a/vendor/google.golang.org/protobuf/internal/strs/strings.go b/vendor/google.golang.org/protobuf/internal/strs/strings.go index 0b74e7658..a6e7df244 100644 --- a/vendor/google.golang.org/protobuf/internal/strs/strings.go +++ b/vendor/google.golang.org/protobuf/internal/strs/strings.go @@ -17,7 +17,7 @@ import ( // EnforceUTF8 reports whether to enforce strict UTF-8 validation. func EnforceUTF8(fd protoreflect.FieldDescriptor) bool { - if flags.ProtoLegacy { + if flags.ProtoLegacy || fd.Syntax() == protoreflect.Editions { if fd, ok := fd.(interface{ EnforceUTF8() bool }); ok { return fd.EnforceUTF8() } diff --git a/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go b/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go deleted file mode 100644 index 61a84d341..000000000 --- a/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !purego && !appengine -// +build !purego,!appengine - -package strs - -import ( - "unsafe" - - "google.golang.org/protobuf/reflect/protoreflect" -) - -type ( - stringHeader struct { - Data unsafe.Pointer - Len int - } - sliceHeader struct { - Data unsafe.Pointer - Len int - Cap int - } -) - -// UnsafeString returns an unsafe string reference of b. -// The caller must treat the input slice as immutable. -// -// WARNING: Use carefully. The returned result must not leak to the end user -// unless the input slice is provably immutable. -func UnsafeString(b []byte) (s string) { - src := (*sliceHeader)(unsafe.Pointer(&b)) - dst := (*stringHeader)(unsafe.Pointer(&s)) - dst.Data = src.Data - dst.Len = src.Len - return s -} - -// UnsafeBytes returns an unsafe bytes slice reference of s. -// The caller must treat returned slice as immutable. -// -// WARNING: Use carefully. The returned result must not leak to the end user. -func UnsafeBytes(s string) (b []byte) { - src := (*stringHeader)(unsafe.Pointer(&s)) - dst := (*sliceHeader)(unsafe.Pointer(&b)) - dst.Data = src.Data - dst.Len = src.Len - dst.Cap = src.Len - return b -} - -// Builder builds a set of strings with shared lifetime. -// This differs from strings.Builder, which is for building a single string. -type Builder struct { - buf []byte -} - -// AppendFullName is equivalent to protoreflect.FullName.Append, -// but optimized for large batches where each name has a shared lifetime. -func (sb *Builder) AppendFullName(prefix protoreflect.FullName, name protoreflect.Name) protoreflect.FullName { - n := len(prefix) + len(".") + len(name) - if len(prefix) == 0 { - n -= len(".") - } - sb.grow(n) - sb.buf = append(sb.buf, prefix...) - sb.buf = append(sb.buf, '.') - sb.buf = append(sb.buf, name...) - return protoreflect.FullName(sb.last(n)) -} - -// MakeString is equivalent to string(b), but optimized for large batches -// with a shared lifetime. -func (sb *Builder) MakeString(b []byte) string { - sb.grow(len(b)) - sb.buf = append(sb.buf, b...) - return sb.last(len(b)) -} - -func (sb *Builder) grow(n int) { - if cap(sb.buf)-len(sb.buf) >= n { - return - } - - // Unlike strings.Builder, we do not need to copy over the contents - // of the old buffer since our builder provides no API for - // retrieving previously created strings. - sb.buf = make([]byte, 0, 2*(cap(sb.buf)+n)) -} - -func (sb *Builder) last(n int) string { - return UnsafeString(sb.buf[len(sb.buf)-n:]) -} diff --git a/vendor/google.golang.org/protobuf/internal/version/version.go b/vendor/google.golang.org/protobuf/internal/version/version.go index 0999f29d5..a50fcfb49 100644 --- a/vendor/google.golang.org/protobuf/internal/version/version.go +++ b/vendor/google.golang.org/protobuf/internal/version/version.go @@ -51,7 +51,7 @@ import ( // 10. Send out the CL for review and submit it. const ( Major = 1 - Minor = 31 + Minor = 33 Patch = 0 PreRelease = "" ) diff --git a/vendor/google.golang.org/protobuf/proto/decode.go b/vendor/google.golang.org/protobuf/proto/decode.go index 48d47946b..e5b03b567 100644 --- a/vendor/google.golang.org/protobuf/proto/decode.go +++ b/vendor/google.golang.org/protobuf/proto/decode.go @@ -69,7 +69,7 @@ func (o UnmarshalOptions) Unmarshal(b []byte, m Message) error { // UnmarshalState parses a wire-format message and places the result in m. // // This method permits fine-grained control over the unmarshaler. -// Most users should use Unmarshal instead. +// Most users should use [Unmarshal] instead. func (o UnmarshalOptions) UnmarshalState(in protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { if o.RecursionLimit == 0 { o.RecursionLimit = protowire.DefaultRecursionLimit diff --git a/vendor/google.golang.org/protobuf/proto/doc.go b/vendor/google.golang.org/protobuf/proto/doc.go index ec71e717f..80ed16a0c 100644 --- a/vendor/google.golang.org/protobuf/proto/doc.go +++ b/vendor/google.golang.org/protobuf/proto/doc.go @@ -18,27 +18,27 @@ // This package contains functions to convert to and from the wire format, // an efficient binary serialization of protocol buffers. // -// ā€¢ Size reports the size of a message in the wire format. +// - [Size] reports the size of a message in the wire format. // -// ā€¢ Marshal converts a message to the wire format. -// The MarshalOptions type provides more control over wire marshaling. +// - [Marshal] converts a message to the wire format. +// The [MarshalOptions] type provides more control over wire marshaling. // -// ā€¢ Unmarshal converts a message from the wire format. -// The UnmarshalOptions type provides more control over wire unmarshaling. +// - [Unmarshal] converts a message from the wire format. +// The [UnmarshalOptions] type provides more control over wire unmarshaling. // // # Basic message operations // -// ā€¢ Clone makes a deep copy of a message. +// - [Clone] makes a deep copy of a message. // -// ā€¢ Merge merges the content of a message into another. +// - [Merge] merges the content of a message into another. // -// ā€¢ Equal compares two messages. For more control over comparisons -// and detailed reporting of differences, see package -// "google.golang.org/protobuf/testing/protocmp". +// - [Equal] compares two messages. For more control over comparisons +// and detailed reporting of differences, see package +// [google.golang.org/protobuf/testing/protocmp]. // -// ā€¢ Reset clears the content of a message. +// - [Reset] clears the content of a message. // -// ā€¢ CheckInitialized reports whether all required fields in a message are set. +// - [CheckInitialized] reports whether all required fields in a message are set. // // # Optional scalar constructors // @@ -46,9 +46,9 @@ // as pointers to a value. For example, an optional string field has the // Go type *string. // -// ā€¢ Bool, Int32, Int64, Uint32, Uint64, Float32, Float64, and String -// take a value and return a pointer to a new instance of it, -// to simplify construction of optional field values. +// - [Bool], [Int32], [Int64], [Uint32], [Uint64], [Float32], [Float64], and [String] +// take a value and return a pointer to a new instance of it, +// to simplify construction of optional field values. // // Generated enum types usually have an Enum method which performs the // same operation. @@ -57,29 +57,29 @@ // // # Extension accessors // -// ā€¢ HasExtension, GetExtension, SetExtension, and ClearExtension -// access extension field values in a protocol buffer message. +// - [HasExtension], [GetExtension], [SetExtension], and [ClearExtension] +// access extension field values in a protocol buffer message. // // Extension fields are only supported in proto2. // // # Related packages // -// ā€¢ Package "google.golang.org/protobuf/encoding/protojson" converts messages to -// and from JSON. +// - Package [google.golang.org/protobuf/encoding/protojson] converts messages to +// and from JSON. // -// ā€¢ Package "google.golang.org/protobuf/encoding/prototext" converts messages to -// and from the text format. +// - Package [google.golang.org/protobuf/encoding/prototext] converts messages to +// and from the text format. // -// ā€¢ Package "google.golang.org/protobuf/reflect/protoreflect" provides a -// reflection interface for protocol buffer data types. +// - Package [google.golang.org/protobuf/reflect/protoreflect] provides a +// reflection interface for protocol buffer data types. // -// ā€¢ Package "google.golang.org/protobuf/testing/protocmp" provides features -// to compare protocol buffer messages with the "github.com/google/go-cmp/cmp" -// package. +// - Package [google.golang.org/protobuf/testing/protocmp] provides features +// to compare protocol buffer messages with the [github.com/google/go-cmp/cmp] +// package. // -// ā€¢ Package "google.golang.org/protobuf/types/dynamicpb" provides a dynamic -// message type, suitable for working with messages where the protocol buffer -// type is only known at runtime. +// - Package [google.golang.org/protobuf/types/dynamicpb] provides a dynamic +// message type, suitable for working with messages where the protocol buffer +// type is only known at runtime. // // This module contains additional packages for more specialized use cases. // Consult the individual package documentation for details. diff --git a/vendor/google.golang.org/protobuf/proto/encode.go b/vendor/google.golang.org/protobuf/proto/encode.go index bf7f816d0..4fed202f9 100644 --- a/vendor/google.golang.org/protobuf/proto/encode.go +++ b/vendor/google.golang.org/protobuf/proto/encode.go @@ -129,7 +129,7 @@ func (o MarshalOptions) MarshalAppend(b []byte, m Message) ([]byte, error) { // MarshalState returns the wire-format encoding of a message. // // This method permits fine-grained control over the marshaler. -// Most users should use Marshal instead. +// Most users should use [Marshal] instead. func (o MarshalOptions) MarshalState(in protoiface.MarshalInput) (protoiface.MarshalOutput, error) { return o.marshal(in.Buf, in.Message) } diff --git a/vendor/google.golang.org/protobuf/proto/extension.go b/vendor/google.golang.org/protobuf/proto/extension.go index 5f293cda8..17899a3a7 100644 --- a/vendor/google.golang.org/protobuf/proto/extension.go +++ b/vendor/google.golang.org/protobuf/proto/extension.go @@ -26,7 +26,7 @@ func HasExtension(m Message, xt protoreflect.ExtensionType) bool { } // ClearExtension clears an extension field such that subsequent -// HasExtension calls return false. +// [HasExtension] calls return false. // It panics if m is invalid or if xt does not extend m. func ClearExtension(m Message, xt protoreflect.ExtensionType) { m.ProtoReflect().Clear(xt.TypeDescriptor()) diff --git a/vendor/google.golang.org/protobuf/proto/merge.go b/vendor/google.golang.org/protobuf/proto/merge.go index d761ab331..3c6fe5780 100644 --- a/vendor/google.golang.org/protobuf/proto/merge.go +++ b/vendor/google.golang.org/protobuf/proto/merge.go @@ -21,7 +21,7 @@ import ( // The unknown fields of src are appended to the unknown fields of dst. // // It is semantically equivalent to unmarshaling the encoded form of src -// into dst with the UnmarshalOptions.Merge option specified. +// into dst with the [UnmarshalOptions.Merge] option specified. func Merge(dst, src Message) { // TODO: Should nil src be treated as semantically equivalent to a // untyped, read-only, empty message? What about a nil dst? diff --git a/vendor/google.golang.org/protobuf/proto/proto.go b/vendor/google.golang.org/protobuf/proto/proto.go index 1f0d183b1..7543ee6b2 100644 --- a/vendor/google.golang.org/protobuf/proto/proto.go +++ b/vendor/google.golang.org/protobuf/proto/proto.go @@ -15,18 +15,20 @@ import ( // protobuf module that accept a Message, except where otherwise specified. // // This is the v2 interface definition for protobuf messages. -// The v1 interface definition is "github.com/golang/protobuf/proto".Message. +// The v1 interface definition is [github.com/golang/protobuf/proto.Message]. // -// To convert a v1 message to a v2 message, -// use "github.com/golang/protobuf/proto".MessageV2. -// To convert a v2 message to a v1 message, -// use "github.com/golang/protobuf/proto".MessageV1. +// - To convert a v1 message to a v2 message, +// use [google.golang.org/protobuf/protoadapt.MessageV2Of]. +// - To convert a v2 message to a v1 message, +// use [google.golang.org/protobuf/protoadapt.MessageV1Of]. type Message = protoreflect.ProtoMessage -// Error matches all errors produced by packages in the protobuf module. +// Error matches all errors produced by packages in the protobuf module +// according to [errors.Is]. // -// That is, errors.Is(err, Error) reports whether an error is produced -// by this module. +// Example usage: +// +// if errors.Is(err, proto.Error) { ... } var Error error func init() { diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go b/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go index e4dfb1205..baa0cc621 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go @@ -3,11 +3,11 @@ // license that can be found in the LICENSE file. // Package protodesc provides functionality for converting -// FileDescriptorProto messages to/from protoreflect.FileDescriptor values. +// FileDescriptorProto messages to/from [protoreflect.FileDescriptor] values. // // The google.protobuf.FileDescriptorProto is a protobuf message that describes // the type information for a .proto file in a form that is easily serializable. -// The protoreflect.FileDescriptor is a more structured representation of +// The [protoreflect.FileDescriptor] is a more structured representation of // the FileDescriptorProto message where references and remote dependencies // can be directly followed. package protodesc @@ -24,11 +24,11 @@ import ( "google.golang.org/protobuf/types/descriptorpb" ) -// Resolver is the resolver used by NewFile to resolve dependencies. +// Resolver is the resolver used by [NewFile] to resolve dependencies. // The enums and messages provided must belong to some parent file, // which is also registered. // -// It is implemented by protoregistry.Files. +// It is implemented by [protoregistry.Files]. type Resolver interface { FindFileByPath(string) (protoreflect.FileDescriptor, error) FindDescriptorByName(protoreflect.FullName) (protoreflect.Descriptor, error) @@ -61,19 +61,19 @@ type FileOptions struct { AllowUnresolvable bool } -// NewFile creates a new protoreflect.FileDescriptor from the provided -// file descriptor message. See FileOptions.New for more information. +// NewFile creates a new [protoreflect.FileDescriptor] from the provided +// file descriptor message. See [FileOptions.New] for more information. func NewFile(fd *descriptorpb.FileDescriptorProto, r Resolver) (protoreflect.FileDescriptor, error) { return FileOptions{}.New(fd, r) } -// NewFiles creates a new protoregistry.Files from the provided -// FileDescriptorSet message. See FileOptions.NewFiles for more information. +// NewFiles creates a new [protoregistry.Files] from the provided +// FileDescriptorSet message. See [FileOptions.NewFiles] for more information. func NewFiles(fd *descriptorpb.FileDescriptorSet) (*protoregistry.Files, error) { return FileOptions{}.NewFiles(fd) } -// New creates a new protoreflect.FileDescriptor from the provided +// New creates a new [protoreflect.FileDescriptor] from the provided // file descriptor message. The file must represent a valid proto file according // to protobuf semantics. The returned descriptor is a deep copy of the input. // @@ -93,9 +93,15 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot f.L1.Syntax = protoreflect.Proto2 case "proto3": f.L1.Syntax = protoreflect.Proto3 + case "editions": + f.L1.Syntax = protoreflect.Editions + f.L1.Edition = fromEditionProto(fd.GetEdition()) default: return nil, errors.New("invalid syntax: %q", fd.GetSyntax()) } + if f.L1.Syntax == protoreflect.Editions && (fd.GetEdition() < SupportedEditionsMinimum || fd.GetEdition() > SupportedEditionsMaximum) { + return nil, errors.New("use of edition %v not yet supported by the Go Protobuf runtime", fd.GetEdition()) + } f.L1.Path = fd.GetName() if f.L1.Path == "" { return nil, errors.New("file path must be populated") @@ -108,6 +114,9 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot opts = proto.Clone(opts).(*descriptorpb.FileOptions) f.L2.Options = func() protoreflect.ProtoMessage { return opts } } + if f.L1.Syntax == protoreflect.Editions { + initFileDescFromFeatureSet(f, fd.GetOptions().GetFeatures()) + } f.L2.Imports = make(filedesc.FileImports, len(fd.GetDependency())) for _, i := range fd.GetPublicDependency() { @@ -231,7 +240,7 @@ func (is importSet) importPublic(imps protoreflect.FileImports) { } } -// NewFiles creates a new protoregistry.Files from the provided +// NewFiles creates a new [protoregistry.Files] from the provided // FileDescriptorSet message. The descriptor set must include only // valid files according to protobuf semantics. The returned descriptors // are a deep copy of the input. diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go index 37efda1af..b3278163c 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go @@ -28,6 +28,7 @@ func (r descsByName) initEnumDeclarations(eds []*descriptorpb.EnumDescriptorProt opts = proto.Clone(opts).(*descriptorpb.EnumOptions) e.L2.Options = func() protoreflect.ProtoMessage { return opts } } + e.L1.EditionFeatures = mergeEditionFeatures(parent, ed.GetOptions().GetFeatures()) for _, s := range ed.GetReservedName() { e.L2.ReservedNames.List = append(e.L2.ReservedNames.List, protoreflect.Name(s)) } @@ -68,6 +69,9 @@ func (r descsByName) initMessagesDeclarations(mds []*descriptorpb.DescriptorProt if m.L0, err = r.makeBase(m, parent, md.GetName(), i, sb); err != nil { return nil, err } + if m.Base.L0.ParentFile.Syntax() == protoreflect.Editions { + m.L1.EditionFeatures = mergeEditionFeatures(parent, md.GetOptions().GetFeatures()) + } if opts := md.GetOptions(); opts != nil { opts = proto.Clone(opts).(*descriptorpb.MessageOptions) m.L2.Options = func() protoreflect.ProtoMessage { return opts } @@ -114,6 +118,27 @@ func (r descsByName) initMessagesDeclarations(mds []*descriptorpb.DescriptorProt return ms, nil } +// canBePacked returns whether the field can use packed encoding: +// https://protobuf.dev/programming-guides/encoding/#packed +func canBePacked(fd *descriptorpb.FieldDescriptorProto) bool { + if fd.GetLabel() != descriptorpb.FieldDescriptorProto_LABEL_REPEATED { + return false // not a repeated field + } + + switch protoreflect.Kind(fd.GetType()) { + case protoreflect.MessageKind, protoreflect.GroupKind: + return false // not a scalar type field + + case protoreflect.StringKind, protoreflect.BytesKind: + // string and bytes can explicitly not be declared as packed, + // see https://protobuf.dev/programming-guides/encoding/#packed + return false + + default: + return true + } +} + func (r descsByName) initFieldsFromDescriptorProto(fds []*descriptorpb.FieldDescriptorProto, parent protoreflect.Descriptor, sb *strs.Builder) (fs []filedesc.Field, err error) { fs = make([]filedesc.Field, len(fds)) // allocate up-front to ensure stable pointers for i, fd := range fds { @@ -137,6 +162,34 @@ func (r descsByName) initFieldsFromDescriptorProto(fds []*descriptorpb.FieldDesc if fd.JsonName != nil { f.L1.StringName.InitJSON(fd.GetJsonName()) } + + if f.Base.L0.ParentFile.Syntax() == protoreflect.Editions { + f.L1.EditionFeatures = mergeEditionFeatures(parent, fd.GetOptions().GetFeatures()) + + if f.L1.EditionFeatures.IsLegacyRequired { + f.L1.Cardinality = protoreflect.Required + } + // We reuse the existing field because the old option `[packed = + // true]` is mutually exclusive with the editions feature. + if canBePacked(fd) { + f.L1.HasPacked = true + f.L1.IsPacked = f.L1.EditionFeatures.IsPacked + } + + // We pretend this option is always explicitly set because the only + // use of HasEnforceUTF8 is to determine whether to use EnforceUTF8 + // or to return the appropriate default. + // When using editions we either parse the option or resolve the + // appropriate default here (instead of later when this option is + // requested from the descriptor). + // In proto2/proto3 syntax HasEnforceUTF8 might be false. + f.L1.HasEnforceUTF8 = true + f.L1.EnforceUTF8 = f.L1.EditionFeatures.IsUTF8Validated + + if f.L1.Kind == protoreflect.MessageKind && f.L1.EditionFeatures.IsDelimitedEncoded { + f.L1.Kind = protoreflect.GroupKind + } + } } return fs, nil } @@ -151,6 +204,9 @@ func (r descsByName) initOneofsFromDescriptorProto(ods []*descriptorpb.OneofDesc if opts := od.GetOptions(); opts != nil { opts = proto.Clone(opts).(*descriptorpb.OneofOptions) o.L1.Options = func() protoreflect.ProtoMessage { return opts } + if parent.Syntax() == protoreflect.Editions { + o.L1.EditionFeatures = mergeEditionFeatures(parent, opts.GetFeatures()) + } } } return os, nil diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go index 27d7e3501..254ca5854 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go @@ -276,8 +276,8 @@ func unmarshalDefault(s string, fd protoreflect.FieldDescriptor, allowUnresolvab } else if err != nil { return v, ev, err } - if fd.Syntax() == protoreflect.Proto3 { - return v, ev, errors.New("cannot be specified under proto3 semantics") + if !fd.HasPresence() { + return v, ev, errors.New("cannot be specified with implicit field presence") } if fd.Kind() == protoreflect.MessageKind || fd.Kind() == protoreflect.GroupKind || fd.Cardinality() == protoreflect.Repeated { return v, ev, errors.New("cannot be specified on composite types") diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go index 9af1d5648..e4dcaf876 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go @@ -107,7 +107,7 @@ func validateMessageDeclarations(ms []filedesc.Message, mds []*descriptorpb.Desc if isMessageSet && !flags.ProtoLegacy { return errors.New("message %q is a MessageSet, which is a legacy proto1 feature that is no longer supported", m.FullName()) } - if isMessageSet && (m.Syntax() != protoreflect.Proto2 || m.Fields().Len() > 0 || m.ExtensionRanges().Len() == 0) { + if isMessageSet && (m.Syntax() == protoreflect.Proto3 || m.Fields().Len() > 0 || m.ExtensionRanges().Len() == 0) { return errors.New("message %q is an invalid proto1 MessageSet", m.FullName()) } if m.Syntax() == protoreflect.Proto3 { @@ -314,8 +314,8 @@ func checkValidGroup(fd protoreflect.FieldDescriptor) error { switch { case fd.Kind() != protoreflect.GroupKind: return nil - case fd.Syntax() != protoreflect.Proto2: - return errors.New("invalid under proto2 semantics") + case fd.Syntax() == protoreflect.Proto3: + return errors.New("invalid under proto3 semantics") case md == nil || md.IsPlaceholder(): return errors.New("message must be resolvable") case fd.FullName().Parent() != md.FullName().Parent(): diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go b/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go index a7c5ceffc..9d6e05420 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go @@ -16,7 +16,7 @@ import ( "google.golang.org/protobuf/types/descriptorpb" ) -// ToFileDescriptorProto copies a protoreflect.FileDescriptor into a +// ToFileDescriptorProto copies a [protoreflect.FileDescriptor] into a // google.protobuf.FileDescriptorProto message. func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto { p := &descriptorpb.FileDescriptorProto{ @@ -70,13 +70,13 @@ func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileD for i, exts := 0, file.Extensions(); i < exts.Len(); i++ { p.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i))) } - if syntax := file.Syntax(); syntax != protoreflect.Proto2 { + if syntax := file.Syntax(); syntax != protoreflect.Proto2 && syntax.IsValid() { p.Syntax = proto.String(file.Syntax().String()) } return p } -// ToDescriptorProto copies a protoreflect.MessageDescriptor into a +// ToDescriptorProto copies a [protoreflect.MessageDescriptor] into a // google.protobuf.DescriptorProto message. func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto { p := &descriptorpb.DescriptorProto{ @@ -119,7 +119,7 @@ func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.Des return p } -// ToFieldDescriptorProto copies a protoreflect.FieldDescriptor into a +// ToFieldDescriptorProto copies a [protoreflect.FieldDescriptor] into a // google.protobuf.FieldDescriptorProto message. func ToFieldDescriptorProto(field protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto { p := &descriptorpb.FieldDescriptorProto{ @@ -168,7 +168,7 @@ func ToFieldDescriptorProto(field protoreflect.FieldDescriptor) *descriptorpb.Fi return p } -// ToOneofDescriptorProto copies a protoreflect.OneofDescriptor into a +// ToOneofDescriptorProto copies a [protoreflect.OneofDescriptor] into a // google.protobuf.OneofDescriptorProto message. func ToOneofDescriptorProto(oneof protoreflect.OneofDescriptor) *descriptorpb.OneofDescriptorProto { return &descriptorpb.OneofDescriptorProto{ @@ -177,7 +177,7 @@ func ToOneofDescriptorProto(oneof protoreflect.OneofDescriptor) *descriptorpb.On } } -// ToEnumDescriptorProto copies a protoreflect.EnumDescriptor into a +// ToEnumDescriptorProto copies a [protoreflect.EnumDescriptor] into a // google.protobuf.EnumDescriptorProto message. func ToEnumDescriptorProto(enum protoreflect.EnumDescriptor) *descriptorpb.EnumDescriptorProto { p := &descriptorpb.EnumDescriptorProto{ @@ -200,7 +200,7 @@ func ToEnumDescriptorProto(enum protoreflect.EnumDescriptor) *descriptorpb.EnumD return p } -// ToEnumValueDescriptorProto copies a protoreflect.EnumValueDescriptor into a +// ToEnumValueDescriptorProto copies a [protoreflect.EnumValueDescriptor] into a // google.protobuf.EnumValueDescriptorProto message. func ToEnumValueDescriptorProto(value protoreflect.EnumValueDescriptor) *descriptorpb.EnumValueDescriptorProto { return &descriptorpb.EnumValueDescriptorProto{ @@ -210,7 +210,7 @@ func ToEnumValueDescriptorProto(value protoreflect.EnumValueDescriptor) *descrip } } -// ToServiceDescriptorProto copies a protoreflect.ServiceDescriptor into a +// ToServiceDescriptorProto copies a [protoreflect.ServiceDescriptor] into a // google.protobuf.ServiceDescriptorProto message. func ToServiceDescriptorProto(service protoreflect.ServiceDescriptor) *descriptorpb.ServiceDescriptorProto { p := &descriptorpb.ServiceDescriptorProto{ @@ -223,7 +223,7 @@ func ToServiceDescriptorProto(service protoreflect.ServiceDescriptor) *descripto return p } -// ToMethodDescriptorProto copies a protoreflect.MethodDescriptor into a +// ToMethodDescriptorProto copies a [protoreflect.MethodDescriptor] into a // google.protobuf.MethodDescriptorProto message. func ToMethodDescriptorProto(method protoreflect.MethodDescriptor) *descriptorpb.MethodDescriptorProto { p := &descriptorpb.MethodDescriptorProto{ diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go index 55aa14922..00b01fbd8 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go @@ -10,46 +10,46 @@ // // # Protocol Buffer Descriptors // -// Protobuf descriptors (e.g., EnumDescriptor or MessageDescriptor) +// Protobuf descriptors (e.g., [EnumDescriptor] or [MessageDescriptor]) // are immutable objects that represent protobuf type information. // They are wrappers around the messages declared in descriptor.proto. // Protobuf descriptors alone lack any information regarding Go types. // -// Enums and messages generated by this module implement Enum and ProtoMessage, +// Enums and messages generated by this module implement [Enum] and [ProtoMessage], // where the Descriptor and ProtoReflect.Descriptor accessors respectively // return the protobuf descriptor for the values. // // The protobuf descriptor interfaces are not meant to be implemented by // user code since they might need to be extended in the future to support // additions to the protobuf language. -// The "google.golang.org/protobuf/reflect/protodesc" package converts between +// The [google.golang.org/protobuf/reflect/protodesc] package converts between // google.protobuf.DescriptorProto messages and protobuf descriptors. // // # Go Type Descriptors // -// A type descriptor (e.g., EnumType or MessageType) is a constructor for +// A type descriptor (e.g., [EnumType] or [MessageType]) is a constructor for // a concrete Go type that represents the associated protobuf descriptor. // There is commonly a one-to-one relationship between protobuf descriptors and // Go type descriptors, but it can potentially be a one-to-many relationship. // -// Enums and messages generated by this module implement Enum and ProtoMessage, +// Enums and messages generated by this module implement [Enum] and [ProtoMessage], // where the Type and ProtoReflect.Type accessors respectively // return the protobuf descriptor for the values. // -// The "google.golang.org/protobuf/types/dynamicpb" package can be used to +// The [google.golang.org/protobuf/types/dynamicpb] package can be used to // create Go type descriptors from protobuf descriptors. // // # Value Interfaces // -// The Enum and Message interfaces provide a reflective view over an +// The [Enum] and [Message] interfaces provide a reflective view over an // enum or message instance. For enums, it provides the ability to retrieve // the enum value number for any concrete enum type. For messages, it provides // the ability to access or manipulate fields of the message. // -// To convert a proto.Message to a protoreflect.Message, use the +// To convert a [google.golang.org/protobuf/proto.Message] to a [protoreflect.Message], use the // former's ProtoReflect method. Since the ProtoReflect method is new to the // v2 message interface, it may not be present on older message implementations. -// The "github.com/golang/protobuf/proto".MessageReflect function can be used +// The [github.com/golang/protobuf/proto.MessageReflect] function can be used // to obtain a reflective view on older messages. // // # Relationships @@ -71,12 +71,12 @@ // ā”‚ ā”‚ // ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ Type() ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ // -// ā€¢ An EnumType describes a concrete Go enum type. +// ā€¢ An [EnumType] describes a concrete Go enum type. // It has an EnumDescriptor and can construct an Enum instance. // -// ā€¢ An EnumDescriptor describes an abstract protobuf enum type. +// ā€¢ An [EnumDescriptor] describes an abstract protobuf enum type. // -// ā€¢ An Enum is a concrete enum instance. Generated enums implement Enum. +// ā€¢ An [Enum] is a concrete enum instance. Generated enums implement Enum. // // ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ New() ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” // ā”‚ ā”‚ @@ -90,24 +90,26 @@ // ā”‚ ā”‚ // ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ Type() ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ // -// ā€¢ A MessageType describes a concrete Go message type. -// It has a MessageDescriptor and can construct a Message instance. -// Just as how Go's reflect.Type is a reflective description of a Go type, -// a MessageType is a reflective description of a Go type for a protobuf message. +// ā€¢ A [MessageType] describes a concrete Go message type. +// It has a [MessageDescriptor] and can construct a [Message] instance. +// Just as how Go's [reflect.Type] is a reflective description of a Go type, +// a [MessageType] is a reflective description of a Go type for a protobuf message. // -// ā€¢ A MessageDescriptor describes an abstract protobuf message type. -// It has no understanding of Go types. In order to construct a MessageType -// from just a MessageDescriptor, you can consider looking up the message type -// in the global registry using protoregistry.GlobalTypes.FindMessageByName -// or constructing a dynamic MessageType using dynamicpb.NewMessageType. +// ā€¢ A [MessageDescriptor] describes an abstract protobuf message type. +// It has no understanding of Go types. In order to construct a [MessageType] +// from just a [MessageDescriptor], you can consider looking up the message type +// in the global registry using the FindMessageByName method on +// [google.golang.org/protobuf/reflect/protoregistry.GlobalTypes] +// or constructing a dynamic [MessageType] using +// [google.golang.org/protobuf/types/dynamicpb.NewMessageType]. // -// ā€¢ A Message is a reflective view over a concrete message instance. -// Generated messages implement ProtoMessage, which can convert to a Message. -// Just as how Go's reflect.Value is a reflective view over a Go value, -// a Message is a reflective view over a concrete protobuf message instance. -// Using Go reflection as an analogy, the ProtoReflect method is similar to -// calling reflect.ValueOf, and the Message.Interface method is similar to -// calling reflect.Value.Interface. +// ā€¢ A [Message] is a reflective view over a concrete message instance. +// Generated messages implement [ProtoMessage], which can convert to a [Message]. +// Just as how Go's [reflect.Value] is a reflective view over a Go value, +// a [Message] is a reflective view over a concrete protobuf message instance. +// Using Go reflection as an analogy, the [ProtoMessage.ProtoReflect] method is similar to +// calling [reflect.ValueOf], and the [Message.Interface] method is similar to +// calling [reflect.Value.Interface]. // // ā”Œā”€ā”€ TypeDescriptor() ā”€ā”€ā” ā”Œā”€ā”€ā”€ā”€ā”€ Descriptor() ā”€ā”€ā”€ā”€ā”€ā” // ā”‚ V ā”‚ V @@ -119,15 +121,15 @@ // ā”‚ ā”‚ // ā””ā”€ā”€ā”€ā”€ā”€ā”€ implements ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ // -// ā€¢ An ExtensionType describes a concrete Go implementation of an extension. -// It has an ExtensionTypeDescriptor and can convert to/from -// abstract Values and Go values. +// ā€¢ An [ExtensionType] describes a concrete Go implementation of an extension. +// It has an [ExtensionTypeDescriptor] and can convert to/from +// an abstract [Value] and a Go value. // -// ā€¢ An ExtensionTypeDescriptor is an ExtensionDescriptor -// which also has an ExtensionType. +// ā€¢ An [ExtensionTypeDescriptor] is an [ExtensionDescriptor] +// which also has an [ExtensionType]. // -// ā€¢ An ExtensionDescriptor describes an abstract protobuf extension field and -// may not always be an ExtensionTypeDescriptor. +// ā€¢ An [ExtensionDescriptor] describes an abstract protobuf extension field and +// may not always be an [ExtensionTypeDescriptor]. package protoreflect import ( @@ -142,7 +144,7 @@ type doNotImplement pragma.DoNotImplement // ProtoMessage is the top-level interface that all proto messages implement. // This is declared in the protoreflect package to avoid a cyclic dependency; -// use the proto.Message type instead, which aliases this type. +// use the [google.golang.org/protobuf/proto.Message] type instead, which aliases this type. type ProtoMessage interface{ ProtoReflect() Message } // Syntax is the language version of the proto file. @@ -151,8 +153,9 @@ type Syntax syntax type syntax int8 // keep exact type opaque as the int type may change const ( - Proto2 Syntax = 2 - Proto3 Syntax = 3 + Proto2 Syntax = 2 + Proto3 Syntax = 3 + Editions Syntax = 4 ) // IsValid reports whether the syntax is valid. @@ -172,6 +175,8 @@ func (s Syntax) String() string { return "proto2" case Proto3: return "proto3" + case Editions: + return "editions" default: return fmt.Sprintf("", s) } @@ -436,7 +441,7 @@ type Names interface { // FullName is a qualified name that uniquely identifies a proto declaration. // A qualified name is the concatenation of the proto package along with the // fully-declared name (i.e., name of parent preceding the name of the child), -// with a '.' delimiter placed between each Name. +// with a '.' delimiter placed between each [Name]. // // This should not have any leading or trailing dots. type FullName string // e.g., "google.protobuf.Field.Kind" @@ -480,7 +485,7 @@ func isLetterDigit(c byte) bool { } // Name returns the short name, which is the last identifier segment. -// A single segment FullName is the Name itself. +// A single segment FullName is the [Name] itself. func (n FullName) Name() Name { if i := strings.LastIndexByte(string(n), '.'); i >= 0 { return Name(n[i+1:]) diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go index 717b106f3..7dcc2ff09 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go @@ -35,7 +35,7 @@ func (p *SourcePath) appendFileDescriptorProto(b []byte) []byte { b = p.appendSingularField(b, "source_code_info", (*SourcePath).appendSourceCodeInfo) case 12: b = p.appendSingularField(b, "syntax", nil) - case 13: + case 14: b = p.appendSingularField(b, "edition", nil) } return b @@ -160,8 +160,6 @@ func (p *SourcePath) appendFileOptions(b []byte) []byte { b = p.appendSingularField(b, "java_generic_services", nil) case 18: b = p.appendSingularField(b, "py_generic_services", nil) - case 42: - b = p.appendSingularField(b, "php_generic_services", nil) case 23: b = p.appendSingularField(b, "deprecated", nil) case 31: @@ -180,6 +178,8 @@ func (p *SourcePath) appendFileOptions(b []byte) []byte { b = p.appendSingularField(b, "php_metadata_namespace", nil) case 45: b = p.appendSingularField(b, "ruby_package", nil) + case 50: + b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet) case 999: b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption) } @@ -240,6 +240,8 @@ func (p *SourcePath) appendMessageOptions(b []byte) []byte { b = p.appendSingularField(b, "map_entry", nil) case 11: b = p.appendSingularField(b, "deprecated_legacy_json_field_conflicts", nil) + case 12: + b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet) case 999: b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption) } @@ -285,6 +287,8 @@ func (p *SourcePath) appendEnumOptions(b []byte) []byte { b = p.appendSingularField(b, "deprecated", nil) case 6: b = p.appendSingularField(b, "deprecated_legacy_json_field_conflicts", nil) + case 7: + b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet) case 999: b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption) } @@ -330,6 +334,8 @@ func (p *SourcePath) appendServiceOptions(b []byte) []byte { return b } switch (*p)[0] { + case 34: + b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet) case 33: b = p.appendSingularField(b, "deprecated", nil) case 999: @@ -361,16 +367,39 @@ func (p *SourcePath) appendFieldOptions(b []byte) []byte { b = p.appendSingularField(b, "debug_redact", nil) case 17: b = p.appendSingularField(b, "retention", nil) - case 18: - b = p.appendSingularField(b, "target", nil) case 19: b = p.appendRepeatedField(b, "targets", nil) + case 20: + b = p.appendRepeatedField(b, "edition_defaults", (*SourcePath).appendFieldOptions_EditionDefault) + case 21: + b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet) case 999: b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption) } return b } +func (p *SourcePath) appendFeatureSet(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 1: + b = p.appendSingularField(b, "field_presence", nil) + case 2: + b = p.appendSingularField(b, "enum_type", nil) + case 3: + b = p.appendSingularField(b, "repeated_field_encoding", nil) + case 4: + b = p.appendSingularField(b, "utf8_validation", nil) + case 5: + b = p.appendSingularField(b, "message_encoding", nil) + case 6: + b = p.appendSingularField(b, "json_format", nil) + } + return b +} + func (p *SourcePath) appendUninterpretedOption(b []byte) []byte { if len(*p) == 0 { return b @@ -422,6 +451,8 @@ func (p *SourcePath) appendExtensionRangeOptions(b []byte) []byte { b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption) case 2: b = p.appendRepeatedField(b, "declaration", (*SourcePath).appendExtensionRangeOptions_Declaration) + case 50: + b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet) case 3: b = p.appendSingularField(b, "verification", nil) } @@ -433,6 +464,8 @@ func (p *SourcePath) appendOneofOptions(b []byte) []byte { return b } switch (*p)[0] { + case 1: + b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet) case 999: b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption) } @@ -446,6 +479,10 @@ func (p *SourcePath) appendEnumValueOptions(b []byte) []byte { switch (*p)[0] { case 1: b = p.appendSingularField(b, "deprecated", nil) + case 2: + b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet) + case 3: + b = p.appendSingularField(b, "debug_redact", nil) case 999: b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption) } @@ -461,12 +498,27 @@ func (p *SourcePath) appendMethodOptions(b []byte) []byte { b = p.appendSingularField(b, "deprecated", nil) case 34: b = p.appendSingularField(b, "idempotency_level", nil) + case 35: + b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet) case 999: b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption) } return b } +func (p *SourcePath) appendFieldOptions_EditionDefault(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 3: + b = p.appendSingularField(b, "edition", nil) + case 2: + b = p.appendSingularField(b, "value", nil) + } + return b +} + func (p *SourcePath) appendUninterpretedOption_NamePart(b []byte) []byte { if len(*p) == 0 { return b @@ -491,8 +543,6 @@ func (p *SourcePath) appendExtensionRangeOptions_Declaration(b []byte) []byte { b = p.appendSingularField(b, "full_name", nil) case 3: b = p.appendSingularField(b, "type", nil) - case 4: - b = p.appendSingularField(b, "is_repeated", nil) case 5: b = p.appendSingularField(b, "reserved", nil) case 6: diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go index 3867470d3..60ff62b4c 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go @@ -12,7 +12,7 @@ package protoreflect // exactly identical. However, it is possible for the same semantically // identical proto type to be represented by multiple type descriptors. // -// For example, suppose we have t1 and t2 which are both MessageDescriptors. +// For example, suppose we have t1 and t2 which are both an [MessageDescriptor]. // If t1 == t2, then the types are definitely equal and all accessors return // the same information. However, if t1 != t2, then it is still possible that // they still represent the same proto type (e.g., t1.FullName == t2.FullName). @@ -115,7 +115,7 @@ type Descriptor interface { // corresponds with the google.protobuf.FileDescriptorProto message. // // Top-level declarations: -// EnumDescriptor, MessageDescriptor, FieldDescriptor, and/or ServiceDescriptor. +// [EnumDescriptor], [MessageDescriptor], [FieldDescriptor], and/or [ServiceDescriptor]. type FileDescriptor interface { Descriptor // Descriptor.FullName is identical to Package @@ -180,8 +180,8 @@ type FileImport struct { // corresponds with the google.protobuf.DescriptorProto message. // // Nested declarations: -// FieldDescriptor, OneofDescriptor, FieldDescriptor, EnumDescriptor, -// and/or MessageDescriptor. +// [FieldDescriptor], [OneofDescriptor], [FieldDescriptor], [EnumDescriptor], +// and/or [MessageDescriptor]. type MessageDescriptor interface { Descriptor @@ -214,7 +214,7 @@ type MessageDescriptor interface { ExtensionRanges() FieldRanges // ExtensionRangeOptions returns the ith extension range options. // - // To avoid a dependency cycle, this method returns a proto.Message value, + // To avoid a dependency cycle, this method returns a proto.Message] value, // which always contains a google.protobuf.ExtensionRangeOptions message. // This method returns a typed nil-pointer if no options are present. // The caller must import the descriptorpb package to use this. @@ -231,9 +231,9 @@ type MessageDescriptor interface { } type isMessageDescriptor interface{ ProtoType(MessageDescriptor) } -// MessageType encapsulates a MessageDescriptor with a concrete Go implementation. +// MessageType encapsulates a [MessageDescriptor] with a concrete Go implementation. // It is recommended that implementations of this interface also implement the -// MessageFieldTypes interface. +// [MessageFieldTypes] interface. type MessageType interface { // New returns a newly allocated empty message. // It may return nil for synthetic messages representing a map entry. @@ -249,19 +249,19 @@ type MessageType interface { Descriptor() MessageDescriptor } -// MessageFieldTypes extends a MessageType by providing type information +// MessageFieldTypes extends a [MessageType] by providing type information // regarding enums and messages referenced by the message fields. type MessageFieldTypes interface { MessageType - // Enum returns the EnumType for the ith field in Descriptor.Fields. + // Enum returns the EnumType for the ith field in MessageDescriptor.Fields. // It returns nil if the ith field is not an enum kind. // It panics if out of bounds. // // Invariant: mt.Enum(i).Descriptor() == mt.Descriptor().Fields(i).Enum() Enum(i int) EnumType - // Message returns the MessageType for the ith field in Descriptor.Fields. + // Message returns the MessageType for the ith field in MessageDescriptor.Fields. // It returns nil if the ith field is not a message or group kind. // It panics if out of bounds. // @@ -286,8 +286,8 @@ type MessageDescriptors interface { // corresponds with the google.protobuf.FieldDescriptorProto message. // // It is used for both normal fields defined within the parent message -// (e.g., MessageDescriptor.Fields) and fields that extend some remote message -// (e.g., FileDescriptor.Extensions or MessageDescriptor.Extensions). +// (e.g., [MessageDescriptor.Fields]) and fields that extend some remote message +// (e.g., [FileDescriptor.Extensions] or [MessageDescriptor.Extensions]). type FieldDescriptor interface { Descriptor @@ -344,7 +344,7 @@ type FieldDescriptor interface { // IsMap reports whether this field represents a map, // where the value type for the associated field is a Map. // It is equivalent to checking whether Cardinality is Repeated, - // that the Kind is MessageKind, and that Message.IsMapEntry reports true. + // that the Kind is MessageKind, and that MessageDescriptor.IsMapEntry reports true. IsMap() bool // MapKey returns the field descriptor for the key in the map entry. @@ -419,7 +419,7 @@ type OneofDescriptor interface { // IsSynthetic reports whether this is a synthetic oneof created to support // proto3 optional semantics. If true, Fields contains exactly one field - // with HasOptionalKeyword specified. + // with FieldDescriptor.HasOptionalKeyword specified. IsSynthetic() bool // Fields is a list of fields belonging to this oneof. @@ -442,10 +442,10 @@ type OneofDescriptors interface { doNotImplement } -// ExtensionDescriptor is an alias of FieldDescriptor for documentation. +// ExtensionDescriptor is an alias of [FieldDescriptor] for documentation. type ExtensionDescriptor = FieldDescriptor -// ExtensionTypeDescriptor is an ExtensionDescriptor with an associated ExtensionType. +// ExtensionTypeDescriptor is an [ExtensionDescriptor] with an associated [ExtensionType]. type ExtensionTypeDescriptor interface { ExtensionDescriptor @@ -470,12 +470,12 @@ type ExtensionDescriptors interface { doNotImplement } -// ExtensionType encapsulates an ExtensionDescriptor with a concrete +// ExtensionType encapsulates an [ExtensionDescriptor] with a concrete // Go implementation. The nested field descriptor must be for a extension field. // // While a normal field is a member of the parent message that it is declared -// within (see Descriptor.Parent), an extension field is a member of some other -// target message (see ExtensionDescriptor.Extendee) and may have no +// within (see [Descriptor.Parent]), an extension field is a member of some other +// target message (see [FieldDescriptor.ContainingMessage]) and may have no // relationship with the parent. However, the full name of an extension field is // relative to the parent that it is declared within. // @@ -532,7 +532,7 @@ type ExtensionType interface { // corresponds with the google.protobuf.EnumDescriptorProto message. // // Nested declarations: -// EnumValueDescriptor. +// [EnumValueDescriptor]. type EnumDescriptor interface { Descriptor @@ -548,7 +548,7 @@ type EnumDescriptor interface { } type isEnumDescriptor interface{ ProtoType(EnumDescriptor) } -// EnumType encapsulates an EnumDescriptor with a concrete Go implementation. +// EnumType encapsulates an [EnumDescriptor] with a concrete Go implementation. type EnumType interface { // New returns an instance of this enum type with its value set to n. New(n EnumNumber) Enum @@ -610,7 +610,7 @@ type EnumValueDescriptors interface { // ServiceDescriptor describes a service and // corresponds with the google.protobuf.ServiceDescriptorProto message. // -// Nested declarations: MethodDescriptor. +// Nested declarations: [MethodDescriptor]. type ServiceDescriptor interface { Descriptor diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go index 37601b781..a7b0d06ff 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go @@ -27,16 +27,16 @@ type Enum interface { // Message is a reflective interface for a concrete message value, // encapsulating both type and value information for the message. // -// Accessor/mutators for individual fields are keyed by FieldDescriptor. +// Accessor/mutators for individual fields are keyed by [FieldDescriptor]. // For non-extension fields, the descriptor must exactly match the // field known by the parent message. -// For extension fields, the descriptor must implement ExtensionTypeDescriptor, -// extend the parent message (i.e., have the same message FullName), and +// For extension fields, the descriptor must implement [ExtensionTypeDescriptor], +// extend the parent message (i.e., have the same message [FullName]), and // be within the parent's extension range. // -// Each field Value can be a scalar or a composite type (Message, List, or Map). -// See Value for the Go types associated with a FieldDescriptor. -// Providing a Value that is invalid or of an incorrect type panics. +// Each field [Value] can be a scalar or a composite type ([Message], [List], or [Map]). +// See [Value] for the Go types associated with a [FieldDescriptor]. +// Providing a [Value] that is invalid or of an incorrect type panics. type Message interface { // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. @@ -152,7 +152,7 @@ type Message interface { // This method may return nil. // // The returned methods type is identical to - // "google.golang.org/protobuf/runtime/protoiface".Methods. + // google.golang.org/protobuf/runtime/protoiface.Methods. // Consult the protoiface package documentation for details. ProtoMethods() *methods } @@ -175,8 +175,8 @@ func (b RawFields) IsValid() bool { } // List is a zero-indexed, ordered list. -// The element Value type is determined by FieldDescriptor.Kind. -// Providing a Value that is invalid or of an incorrect type panics. +// The element [Value] type is determined by [FieldDescriptor.Kind]. +// Providing a [Value] that is invalid or of an incorrect type panics. type List interface { // Len reports the number of entries in the List. // Get, Set, and Truncate panic with out of bound indexes. @@ -226,9 +226,9 @@ type List interface { } // Map is an unordered, associative map. -// The entry MapKey type is determined by FieldDescriptor.MapKey.Kind. -// The entry Value type is determined by FieldDescriptor.MapValue.Kind. -// Providing a MapKey or Value that is invalid or of an incorrect type panics. +// The entry [MapKey] type is determined by [FieldDescriptor.MapKey].Kind. +// The entry [Value] type is determined by [FieldDescriptor.MapValue].Kind. +// Providing a [MapKey] or [Value] that is invalid or of an incorrect type panics. type Map interface { // Len reports the number of elements in the map. Len() int diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_equal.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_equal.go index 591652541..654599d44 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_equal.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_equal.go @@ -24,19 +24,19 @@ import ( // Unlike the == operator, a NaN is equal to another NaN. // // - Enums are equal if they contain the same number. -// Since Value does not contain an enum descriptor, +// Since [Value] does not contain an enum descriptor, // enum values do not consider the type of the enum. // // - Other scalar values are equal if they contain the same value. // -// - Message values are equal if they belong to the same message descriptor, +// - [Message] values are equal if they belong to the same message descriptor, // have the same set of populated known and extension field values, // and the same set of unknown fields values. // -// - Lists are equal if they are the same length and +// - [List] values are equal if they are the same length and // each corresponding element is equal. // -// - Maps are equal if they have the same set of keys and +// - [Map] values are equal if they have the same set of keys and // the corresponding value for each key is equal. func (v1 Value) Equal(v2 Value) bool { return equalValue(v1, v2) diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go index 08e5ef73f..160309731 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go @@ -11,7 +11,7 @@ import ( // Value is a union where only one Go type may be set at a time. // The Value is used to represent all possible values a field may take. -// The following shows which Go type is used to represent each proto Kind: +// The following shows which Go type is used to represent each proto [Kind]: // // ā•”ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•¤ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•— // ā•‘ Go type ā”‚ Protobuf kind ā•‘ @@ -31,22 +31,22 @@ import ( // // Multiple protobuf Kinds may be represented by a single Go type if the type // can losslessly represent the information for the proto kind. For example, -// Int64Kind, Sint64Kind, and Sfixed64Kind are all represented by int64, +// [Int64Kind], [Sint64Kind], and [Sfixed64Kind] are all represented by int64, // but use different integer encoding methods. // -// The List or Map types are used if the field cardinality is repeated. -// A field is a List if FieldDescriptor.IsList reports true. -// A field is a Map if FieldDescriptor.IsMap reports true. +// The [List] or [Map] types are used if the field cardinality is repeated. +// A field is a [List] if [FieldDescriptor.IsList] reports true. +// A field is a [Map] if [FieldDescriptor.IsMap] reports true. // // Converting to/from a Value and a concrete Go value panics on type mismatch. -// For example, ValueOf("hello").Int() panics because this attempts to +// For example, [ValueOf]("hello").Int() panics because this attempts to // retrieve an int64 from a string. // -// List, Map, and Message Values are called "composite" values. +// [List], [Map], and [Message] Values are called "composite" values. // // A composite Value may alias (reference) memory at some location, // such that changes to the Value updates the that location. -// A composite value acquired with a Mutable method, such as Message.Mutable, +// A composite value acquired with a Mutable method, such as [Message.Mutable], // always references the source object. // // For example: @@ -65,7 +65,7 @@ import ( // // appending to the List here may or may not modify the message. // list.Append(protoreflect.ValueOfInt32(0)) // -// Some operations, such as Message.Get, may return an "empty, read-only" +// Some operations, such as [Message.Get], may return an "empty, read-only" // composite Value. Modifying an empty, read-only value panics. type Value value @@ -306,7 +306,7 @@ func (v Value) Float() float64 { } } -// String returns v as a string. Since this method implements fmt.Stringer, +// String returns v as a string. Since this method implements [fmt.Stringer], // this returns the formatted string value for any non-string type. func (v Value) String() string { switch v.typ { @@ -327,7 +327,7 @@ func (v Value) Bytes() []byte { } } -// Enum returns v as a EnumNumber and panics if the type is not a EnumNumber. +// Enum returns v as a [EnumNumber] and panics if the type is not a [EnumNumber]. func (v Value) Enum() EnumNumber { switch v.typ { case enumType: @@ -337,7 +337,7 @@ func (v Value) Enum() EnumNumber { } } -// Message returns v as a Message and panics if the type is not a Message. +// Message returns v as a [Message] and panics if the type is not a [Message]. func (v Value) Message() Message { switch vi := v.getIface().(type) { case Message: @@ -347,7 +347,7 @@ func (v Value) Message() Message { } } -// List returns v as a List and panics if the type is not a List. +// List returns v as a [List] and panics if the type is not a [List]. func (v Value) List() List { switch vi := v.getIface().(type) { case List: @@ -357,7 +357,7 @@ func (v Value) List() List { } } -// Map returns v as a Map and panics if the type is not a Map. +// Map returns v as a [Map] and panics if the type is not a [Map]. func (v Value) Map() Map { switch vi := v.getIface().(type) { case Map: @@ -367,7 +367,7 @@ func (v Value) Map() Map { } } -// MapKey returns v as a MapKey and panics for invalid MapKey types. +// MapKey returns v as a [MapKey] and panics for invalid [MapKey] types. func (v Value) MapKey() MapKey { switch v.typ { case boolType, int32Type, int64Type, uint32Type, uint64Type, stringType: @@ -378,8 +378,8 @@ func (v Value) MapKey() MapKey { } // MapKey is used to index maps, where the Go type of the MapKey must match -// the specified key Kind (see MessageDescriptor.IsMapEntry). -// The following shows what Go type is used to represent each proto Kind: +// the specified key [Kind] (see [MessageDescriptor.IsMapEntry]). +// The following shows what Go type is used to represent each proto [Kind]: // // ā•”ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•¤ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•— // ā•‘ Go type ā”‚ Protobuf kind ā•‘ @@ -392,13 +392,13 @@ func (v Value) MapKey() MapKey { // ā•‘ string ā”‚ StringKind ā•‘ // ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•§ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā• // -// A MapKey is constructed and accessed through a Value: +// A MapKey is constructed and accessed through a [Value]: // // k := ValueOf("hash").MapKey() // convert string to MapKey // s := k.String() // convert MapKey to string // -// The MapKey is a strict subset of valid types used in Value; -// converting a Value to a MapKey with an invalid type panics. +// The MapKey is a strict subset of valid types used in [Value]; +// converting a [Value] to a MapKey with an invalid type panics. type MapKey value // IsValid reports whether k is populated with a value. @@ -426,13 +426,13 @@ func (k MapKey) Uint() uint64 { return Value(k).Uint() } -// String returns k as a string. Since this method implements fmt.Stringer, +// String returns k as a string. Since this method implements [fmt.Stringer], // this returns the formatted string value for any non-string type. func (k MapKey) String() string { return Value(k).String() } -// Value returns k as a Value. +// Value returns k as a [Value]. func (k MapKey) Value() Value { return Value(k) } diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe.go deleted file mode 100644 index 702ddf22a..000000000 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe.go +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !purego && !appengine -// +build !purego,!appengine - -package protoreflect - -import ( - "unsafe" - - "google.golang.org/protobuf/internal/pragma" -) - -type ( - stringHeader struct { - Data unsafe.Pointer - Len int - } - sliceHeader struct { - Data unsafe.Pointer - Len int - Cap int - } - ifaceHeader struct { - Type unsafe.Pointer - Data unsafe.Pointer - } -) - -var ( - nilType = typeOf(nil) - boolType = typeOf(*new(bool)) - int32Type = typeOf(*new(int32)) - int64Type = typeOf(*new(int64)) - uint32Type = typeOf(*new(uint32)) - uint64Type = typeOf(*new(uint64)) - float32Type = typeOf(*new(float32)) - float64Type = typeOf(*new(float64)) - stringType = typeOf(*new(string)) - bytesType = typeOf(*new([]byte)) - enumType = typeOf(*new(EnumNumber)) -) - -// typeOf returns a pointer to the Go type information. -// The pointer is comparable and equal if and only if the types are identical. -func typeOf(t interface{}) unsafe.Pointer { - return (*ifaceHeader)(unsafe.Pointer(&t)).Type -} - -// value is a union where only one type can be represented at a time. -// The struct is 24B large on 64-bit systems and requires the minimum storage -// necessary to represent each possible type. -// -// The Go GC needs to be able to scan variables containing pointers. -// As such, pointers and non-pointers cannot be intermixed. -type value struct { - pragma.DoNotCompare // 0B - - // typ stores the type of the value as a pointer to the Go type. - typ unsafe.Pointer // 8B - - // ptr stores the data pointer for a String, Bytes, or interface value. - ptr unsafe.Pointer // 8B - - // num stores a Bool, Int32, Int64, Uint32, Uint64, Float32, Float64, or - // Enum value as a raw uint64. - // - // It is also used to store the length of a String or Bytes value; - // the capacity is ignored. - num uint64 // 8B -} - -func valueOfString(v string) Value { - p := (*stringHeader)(unsafe.Pointer(&v)) - return Value{typ: stringType, ptr: p.Data, num: uint64(len(v))} -} -func valueOfBytes(v []byte) Value { - p := (*sliceHeader)(unsafe.Pointer(&v)) - return Value{typ: bytesType, ptr: p.Data, num: uint64(len(v))} -} -func valueOfIface(v interface{}) Value { - p := (*ifaceHeader)(unsafe.Pointer(&v)) - return Value{typ: p.Type, ptr: p.Data} -} - -func (v Value) getString() (x string) { - *(*stringHeader)(unsafe.Pointer(&x)) = stringHeader{Data: v.ptr, Len: int(v.num)} - return x -} -func (v Value) getBytes() (x []byte) { - *(*sliceHeader)(unsafe.Pointer(&x)) = sliceHeader{Data: v.ptr, Len: int(v.num), Cap: int(v.num)} - return x -} -func (v Value) getIface() (x interface{}) { - *(*ifaceHeader)(unsafe.Pointer(&x)) = ifaceHeader{Type: v.typ, Data: v.ptr} - return x -} diff --git a/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go b/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go index aeb559774..6267dc52a 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go +++ b/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go @@ -5,12 +5,12 @@ // Package protoregistry provides data structures to register and lookup // protobuf descriptor types. // -// The Files registry contains file descriptors and provides the ability +// The [Files] registry contains file descriptors and provides the ability // to iterate over the files or lookup a specific descriptor within the files. -// Files only contains protobuf descriptors and has no understanding of Go +// [Files] only contains protobuf descriptors and has no understanding of Go // type information that may be associated with each descriptor. // -// The Types registry contains descriptor types for which there is a known +// The [Types] registry contains descriptor types for which there is a known // Go type associated with that descriptor. It provides the ability to iterate // over the registered types or lookup a type by name. package protoregistry @@ -218,7 +218,7 @@ func (r *Files) checkGenProtoConflict(path string) { // FindDescriptorByName looks up a descriptor by the full name. // -// This returns (nil, NotFound) if not found. +// This returns (nil, [NotFound]) if not found. func (r *Files) FindDescriptorByName(name protoreflect.FullName) (protoreflect.Descriptor, error) { if r == nil { return nil, NotFound @@ -310,7 +310,7 @@ func (s *nameSuffix) Pop() (name protoreflect.Name) { // FindFileByPath looks up a file by the path. // -// This returns (nil, NotFound) if not found. +// This returns (nil, [NotFound]) if not found. // This returns an error if multiple files have the same path. func (r *Files) FindFileByPath(path string) (protoreflect.FileDescriptor, error) { if r == nil { @@ -431,7 +431,7 @@ func rangeTopLevelDescriptors(fd protoreflect.FileDescriptor, f func(protoreflec // A compliant implementation must deterministically return the same type // if no error is encountered. // -// The Types type implements this interface. +// The [Types] type implements this interface. type MessageTypeResolver interface { // FindMessageByName looks up a message by its full name. // E.g., "google.protobuf.Any" @@ -451,7 +451,7 @@ type MessageTypeResolver interface { // A compliant implementation must deterministically return the same type // if no error is encountered. // -// The Types type implements this interface. +// The [Types] type implements this interface. type ExtensionTypeResolver interface { // FindExtensionByName looks up a extension field by the field's full name. // Note that this is the full name of the field as determined by @@ -590,7 +590,7 @@ func (r *Types) register(kind string, desc protoreflect.Descriptor, typ interfac // FindEnumByName looks up an enum by its full name. // E.g., "google.protobuf.Field.Kind". // -// This returns (nil, NotFound) if not found. +// This returns (nil, [NotFound]) if not found. func (r *Types) FindEnumByName(enum protoreflect.FullName) (protoreflect.EnumType, error) { if r == nil { return nil, NotFound @@ -611,7 +611,7 @@ func (r *Types) FindEnumByName(enum protoreflect.FullName) (protoreflect.EnumTyp // FindMessageByName looks up a message by its full name, // e.g. "google.protobuf.Any". // -// This returns (nil, NotFound) if not found. +// This returns (nil, [NotFound]) if not found. func (r *Types) FindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error) { if r == nil { return nil, NotFound @@ -632,7 +632,7 @@ func (r *Types) FindMessageByName(message protoreflect.FullName) (protoreflect.M // FindMessageByURL looks up a message by a URL identifier. // See documentation on google.protobuf.Any.type_url for the URL format. // -// This returns (nil, NotFound) if not found. +// This returns (nil, [NotFound]) if not found. func (r *Types) FindMessageByURL(url string) (protoreflect.MessageType, error) { // This function is similar to FindMessageByName but // truncates anything before and including '/' in the URL. @@ -662,7 +662,7 @@ func (r *Types) FindMessageByURL(url string) (protoreflect.MessageType, error) { // where the extension is declared and is unrelated to the full name of the // message being extended. // -// This returns (nil, NotFound) if not found. +// This returns (nil, [NotFound]) if not found. func (r *Types) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) { if r == nil { return nil, NotFound @@ -703,7 +703,7 @@ func (r *Types) FindExtensionByName(field protoreflect.FullName) (protoreflect.E // FindExtensionByNumber looks up a extension field by the field number // within some parent message, identified by full name. // -// This returns (nil, NotFound) if not found. +// This returns (nil, [NotFound]) if not found. func (r *Types) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) { if r == nil { return nil, NotFound diff --git a/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go b/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go index 04c00f737..78624cf60 100644 --- a/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go +++ b/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go @@ -48,6 +48,103 @@ import ( sync "sync" ) +// The full set of known editions. +type Edition int32 + +const ( + // A placeholder for an unknown edition value. + Edition_EDITION_UNKNOWN Edition = 0 + // Legacy syntax "editions". These pre-date editions, but behave much like + // distinct editions. These can't be used to specify the edition of proto + // files, but feature definitions must supply proto2/proto3 defaults for + // backwards compatibility. + Edition_EDITION_PROTO2 Edition = 998 + Edition_EDITION_PROTO3 Edition = 999 + // Editions that have been released. The specific values are arbitrary and + // should not be depended on, but they will always be time-ordered for easy + // comparison. + Edition_EDITION_2023 Edition = 1000 + Edition_EDITION_2024 Edition = 1001 + // Placeholder editions for testing feature resolution. These should not be + // used or relyed on outside of tests. + Edition_EDITION_1_TEST_ONLY Edition = 1 + Edition_EDITION_2_TEST_ONLY Edition = 2 + Edition_EDITION_99997_TEST_ONLY Edition = 99997 + Edition_EDITION_99998_TEST_ONLY Edition = 99998 + Edition_EDITION_99999_TEST_ONLY Edition = 99999 + // Placeholder for specifying unbounded edition support. This should only + // ever be used by plugins that can expect to never require any changes to + // support a new edition. + Edition_EDITION_MAX Edition = 2147483647 +) + +// Enum value maps for Edition. +var ( + Edition_name = map[int32]string{ + 0: "EDITION_UNKNOWN", + 998: "EDITION_PROTO2", + 999: "EDITION_PROTO3", + 1000: "EDITION_2023", + 1001: "EDITION_2024", + 1: "EDITION_1_TEST_ONLY", + 2: "EDITION_2_TEST_ONLY", + 99997: "EDITION_99997_TEST_ONLY", + 99998: "EDITION_99998_TEST_ONLY", + 99999: "EDITION_99999_TEST_ONLY", + 2147483647: "EDITION_MAX", + } + Edition_value = map[string]int32{ + "EDITION_UNKNOWN": 0, + "EDITION_PROTO2": 998, + "EDITION_PROTO3": 999, + "EDITION_2023": 1000, + "EDITION_2024": 1001, + "EDITION_1_TEST_ONLY": 1, + "EDITION_2_TEST_ONLY": 2, + "EDITION_99997_TEST_ONLY": 99997, + "EDITION_99998_TEST_ONLY": 99998, + "EDITION_99999_TEST_ONLY": 99999, + "EDITION_MAX": 2147483647, + } +) + +func (x Edition) Enum() *Edition { + p := new(Edition) + *p = x + return p +} + +func (x Edition) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Edition) Descriptor() protoreflect.EnumDescriptor { + return file_google_protobuf_descriptor_proto_enumTypes[0].Descriptor() +} + +func (Edition) Type() protoreflect.EnumType { + return &file_google_protobuf_descriptor_proto_enumTypes[0] +} + +func (x Edition) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *Edition) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = Edition(num) + return nil +} + +// Deprecated: Use Edition.Descriptor instead. +func (Edition) EnumDescriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{0} +} + // The verification state of the extension range. type ExtensionRangeOptions_VerificationState int32 @@ -80,11 +177,11 @@ func (x ExtensionRangeOptions_VerificationState) String() string { } func (ExtensionRangeOptions_VerificationState) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[0].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[1].Descriptor() } func (ExtensionRangeOptions_VerificationState) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[0] + return &file_google_protobuf_descriptor_proto_enumTypes[1] } func (x ExtensionRangeOptions_VerificationState) Number() protoreflect.EnumNumber { @@ -125,9 +222,10 @@ const ( FieldDescriptorProto_TYPE_BOOL FieldDescriptorProto_Type = 8 FieldDescriptorProto_TYPE_STRING FieldDescriptorProto_Type = 9 // Tag-delimited aggregate. - // Group type is deprecated and not supported in proto3. However, Proto3 + // Group type is deprecated and not supported after google.protobuf. However, Proto3 // implementations should still be able to parse the group wire format and - // treat group fields as unknown fields. + // treat group fields as unknown fields. In Editions, the group wire format + // can be enabled via the `message_encoding` feature. FieldDescriptorProto_TYPE_GROUP FieldDescriptorProto_Type = 10 FieldDescriptorProto_TYPE_MESSAGE FieldDescriptorProto_Type = 11 // Length-delimited aggregate. // New in version 2. @@ -195,11 +293,11 @@ func (x FieldDescriptorProto_Type) String() string { } func (FieldDescriptorProto_Type) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[1].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[2].Descriptor() } func (FieldDescriptorProto_Type) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[1] + return &file_google_protobuf_descriptor_proto_enumTypes[2] } func (x FieldDescriptorProto_Type) Number() protoreflect.EnumNumber { @@ -226,21 +324,24 @@ type FieldDescriptorProto_Label int32 const ( // 0 is reserved for errors FieldDescriptorProto_LABEL_OPTIONAL FieldDescriptorProto_Label = 1 - FieldDescriptorProto_LABEL_REQUIRED FieldDescriptorProto_Label = 2 FieldDescriptorProto_LABEL_REPEATED FieldDescriptorProto_Label = 3 + // The required label is only allowed in google.protobuf. In proto3 and Editions + // it's explicitly prohibited. In Editions, the `field_presence` feature + // can be used to get this behavior. + FieldDescriptorProto_LABEL_REQUIRED FieldDescriptorProto_Label = 2 ) // Enum value maps for FieldDescriptorProto_Label. var ( FieldDescriptorProto_Label_name = map[int32]string{ 1: "LABEL_OPTIONAL", - 2: "LABEL_REQUIRED", 3: "LABEL_REPEATED", + 2: "LABEL_REQUIRED", } FieldDescriptorProto_Label_value = map[string]int32{ "LABEL_OPTIONAL": 1, - "LABEL_REQUIRED": 2, "LABEL_REPEATED": 3, + "LABEL_REQUIRED": 2, } ) @@ -255,11 +356,11 @@ func (x FieldDescriptorProto_Label) String() string { } func (FieldDescriptorProto_Label) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[2].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[3].Descriptor() } func (FieldDescriptorProto_Label) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[2] + return &file_google_protobuf_descriptor_proto_enumTypes[3] } func (x FieldDescriptorProto_Label) Number() protoreflect.EnumNumber { @@ -316,11 +417,11 @@ func (x FileOptions_OptimizeMode) String() string { } func (FileOptions_OptimizeMode) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[3].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[4].Descriptor() } func (FileOptions_OptimizeMode) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[3] + return &file_google_protobuf_descriptor_proto_enumTypes[4] } func (x FileOptions_OptimizeMode) Number() protoreflect.EnumNumber { @@ -382,11 +483,11 @@ func (x FieldOptions_CType) String() string { } func (FieldOptions_CType) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[4].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[5].Descriptor() } func (FieldOptions_CType) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[4] + return &file_google_protobuf_descriptor_proto_enumTypes[5] } func (x FieldOptions_CType) Number() protoreflect.EnumNumber { @@ -444,11 +545,11 @@ func (x FieldOptions_JSType) String() string { } func (FieldOptions_JSType) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[5].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[6].Descriptor() } func (FieldOptions_JSType) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[5] + return &file_google_protobuf_descriptor_proto_enumTypes[6] } func (x FieldOptions_JSType) Number() protoreflect.EnumNumber { @@ -506,11 +607,11 @@ func (x FieldOptions_OptionRetention) String() string { } func (FieldOptions_OptionRetention) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[6].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[7].Descriptor() } func (FieldOptions_OptionRetention) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[6] + return &file_google_protobuf_descriptor_proto_enumTypes[7] } func (x FieldOptions_OptionRetention) Number() protoreflect.EnumNumber { @@ -590,11 +691,11 @@ func (x FieldOptions_OptionTargetType) String() string { } func (FieldOptions_OptionTargetType) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[7].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[8].Descriptor() } func (FieldOptions_OptionTargetType) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[7] + return &file_google_protobuf_descriptor_proto_enumTypes[8] } func (x FieldOptions_OptionTargetType) Number() protoreflect.EnumNumber { @@ -652,11 +753,11 @@ func (x MethodOptions_IdempotencyLevel) String() string { } func (MethodOptions_IdempotencyLevel) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[8].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[9].Descriptor() } func (MethodOptions_IdempotencyLevel) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[8] + return &file_google_protobuf_descriptor_proto_enumTypes[9] } func (x MethodOptions_IdempotencyLevel) Number() protoreflect.EnumNumber { @@ -678,6 +779,363 @@ func (MethodOptions_IdempotencyLevel) EnumDescriptor() ([]byte, []int) { return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{17, 0} } +type FeatureSet_FieldPresence int32 + +const ( + FeatureSet_FIELD_PRESENCE_UNKNOWN FeatureSet_FieldPresence = 0 + FeatureSet_EXPLICIT FeatureSet_FieldPresence = 1 + FeatureSet_IMPLICIT FeatureSet_FieldPresence = 2 + FeatureSet_LEGACY_REQUIRED FeatureSet_FieldPresence = 3 +) + +// Enum value maps for FeatureSet_FieldPresence. +var ( + FeatureSet_FieldPresence_name = map[int32]string{ + 0: "FIELD_PRESENCE_UNKNOWN", + 1: "EXPLICIT", + 2: "IMPLICIT", + 3: "LEGACY_REQUIRED", + } + FeatureSet_FieldPresence_value = map[string]int32{ + "FIELD_PRESENCE_UNKNOWN": 0, + "EXPLICIT": 1, + "IMPLICIT": 2, + "LEGACY_REQUIRED": 3, + } +) + +func (x FeatureSet_FieldPresence) Enum() *FeatureSet_FieldPresence { + p := new(FeatureSet_FieldPresence) + *p = x + return p +} + +func (x FeatureSet_FieldPresence) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FeatureSet_FieldPresence) Descriptor() protoreflect.EnumDescriptor { + return file_google_protobuf_descriptor_proto_enumTypes[10].Descriptor() +} + +func (FeatureSet_FieldPresence) Type() protoreflect.EnumType { + return &file_google_protobuf_descriptor_proto_enumTypes[10] +} + +func (x FeatureSet_FieldPresence) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *FeatureSet_FieldPresence) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = FeatureSet_FieldPresence(num) + return nil +} + +// Deprecated: Use FeatureSet_FieldPresence.Descriptor instead. +func (FeatureSet_FieldPresence) EnumDescriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{19, 0} +} + +type FeatureSet_EnumType int32 + +const ( + FeatureSet_ENUM_TYPE_UNKNOWN FeatureSet_EnumType = 0 + FeatureSet_OPEN FeatureSet_EnumType = 1 + FeatureSet_CLOSED FeatureSet_EnumType = 2 +) + +// Enum value maps for FeatureSet_EnumType. +var ( + FeatureSet_EnumType_name = map[int32]string{ + 0: "ENUM_TYPE_UNKNOWN", + 1: "OPEN", + 2: "CLOSED", + } + FeatureSet_EnumType_value = map[string]int32{ + "ENUM_TYPE_UNKNOWN": 0, + "OPEN": 1, + "CLOSED": 2, + } +) + +func (x FeatureSet_EnumType) Enum() *FeatureSet_EnumType { + p := new(FeatureSet_EnumType) + *p = x + return p +} + +func (x FeatureSet_EnumType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FeatureSet_EnumType) Descriptor() protoreflect.EnumDescriptor { + return file_google_protobuf_descriptor_proto_enumTypes[11].Descriptor() +} + +func (FeatureSet_EnumType) Type() protoreflect.EnumType { + return &file_google_protobuf_descriptor_proto_enumTypes[11] +} + +func (x FeatureSet_EnumType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *FeatureSet_EnumType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = FeatureSet_EnumType(num) + return nil +} + +// Deprecated: Use FeatureSet_EnumType.Descriptor instead. +func (FeatureSet_EnumType) EnumDescriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{19, 1} +} + +type FeatureSet_RepeatedFieldEncoding int32 + +const ( + FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN FeatureSet_RepeatedFieldEncoding = 0 + FeatureSet_PACKED FeatureSet_RepeatedFieldEncoding = 1 + FeatureSet_EXPANDED FeatureSet_RepeatedFieldEncoding = 2 +) + +// Enum value maps for FeatureSet_RepeatedFieldEncoding. +var ( + FeatureSet_RepeatedFieldEncoding_name = map[int32]string{ + 0: "REPEATED_FIELD_ENCODING_UNKNOWN", + 1: "PACKED", + 2: "EXPANDED", + } + FeatureSet_RepeatedFieldEncoding_value = map[string]int32{ + "REPEATED_FIELD_ENCODING_UNKNOWN": 0, + "PACKED": 1, + "EXPANDED": 2, + } +) + +func (x FeatureSet_RepeatedFieldEncoding) Enum() *FeatureSet_RepeatedFieldEncoding { + p := new(FeatureSet_RepeatedFieldEncoding) + *p = x + return p +} + +func (x FeatureSet_RepeatedFieldEncoding) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FeatureSet_RepeatedFieldEncoding) Descriptor() protoreflect.EnumDescriptor { + return file_google_protobuf_descriptor_proto_enumTypes[12].Descriptor() +} + +func (FeatureSet_RepeatedFieldEncoding) Type() protoreflect.EnumType { + return &file_google_protobuf_descriptor_proto_enumTypes[12] +} + +func (x FeatureSet_RepeatedFieldEncoding) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *FeatureSet_RepeatedFieldEncoding) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = FeatureSet_RepeatedFieldEncoding(num) + return nil +} + +// Deprecated: Use FeatureSet_RepeatedFieldEncoding.Descriptor instead. +func (FeatureSet_RepeatedFieldEncoding) EnumDescriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{19, 2} +} + +type FeatureSet_Utf8Validation int32 + +const ( + FeatureSet_UTF8_VALIDATION_UNKNOWN FeatureSet_Utf8Validation = 0 + FeatureSet_VERIFY FeatureSet_Utf8Validation = 2 + FeatureSet_NONE FeatureSet_Utf8Validation = 3 +) + +// Enum value maps for FeatureSet_Utf8Validation. +var ( + FeatureSet_Utf8Validation_name = map[int32]string{ + 0: "UTF8_VALIDATION_UNKNOWN", + 2: "VERIFY", + 3: "NONE", + } + FeatureSet_Utf8Validation_value = map[string]int32{ + "UTF8_VALIDATION_UNKNOWN": 0, + "VERIFY": 2, + "NONE": 3, + } +) + +func (x FeatureSet_Utf8Validation) Enum() *FeatureSet_Utf8Validation { + p := new(FeatureSet_Utf8Validation) + *p = x + return p +} + +func (x FeatureSet_Utf8Validation) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FeatureSet_Utf8Validation) Descriptor() protoreflect.EnumDescriptor { + return file_google_protobuf_descriptor_proto_enumTypes[13].Descriptor() +} + +func (FeatureSet_Utf8Validation) Type() protoreflect.EnumType { + return &file_google_protobuf_descriptor_proto_enumTypes[13] +} + +func (x FeatureSet_Utf8Validation) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *FeatureSet_Utf8Validation) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = FeatureSet_Utf8Validation(num) + return nil +} + +// Deprecated: Use FeatureSet_Utf8Validation.Descriptor instead. +func (FeatureSet_Utf8Validation) EnumDescriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{19, 3} +} + +type FeatureSet_MessageEncoding int32 + +const ( + FeatureSet_MESSAGE_ENCODING_UNKNOWN FeatureSet_MessageEncoding = 0 + FeatureSet_LENGTH_PREFIXED FeatureSet_MessageEncoding = 1 + FeatureSet_DELIMITED FeatureSet_MessageEncoding = 2 +) + +// Enum value maps for FeatureSet_MessageEncoding. +var ( + FeatureSet_MessageEncoding_name = map[int32]string{ + 0: "MESSAGE_ENCODING_UNKNOWN", + 1: "LENGTH_PREFIXED", + 2: "DELIMITED", + } + FeatureSet_MessageEncoding_value = map[string]int32{ + "MESSAGE_ENCODING_UNKNOWN": 0, + "LENGTH_PREFIXED": 1, + "DELIMITED": 2, + } +) + +func (x FeatureSet_MessageEncoding) Enum() *FeatureSet_MessageEncoding { + p := new(FeatureSet_MessageEncoding) + *p = x + return p +} + +func (x FeatureSet_MessageEncoding) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FeatureSet_MessageEncoding) Descriptor() protoreflect.EnumDescriptor { + return file_google_protobuf_descriptor_proto_enumTypes[14].Descriptor() +} + +func (FeatureSet_MessageEncoding) Type() protoreflect.EnumType { + return &file_google_protobuf_descriptor_proto_enumTypes[14] +} + +func (x FeatureSet_MessageEncoding) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *FeatureSet_MessageEncoding) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = FeatureSet_MessageEncoding(num) + return nil +} + +// Deprecated: Use FeatureSet_MessageEncoding.Descriptor instead. +func (FeatureSet_MessageEncoding) EnumDescriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{19, 4} +} + +type FeatureSet_JsonFormat int32 + +const ( + FeatureSet_JSON_FORMAT_UNKNOWN FeatureSet_JsonFormat = 0 + FeatureSet_ALLOW FeatureSet_JsonFormat = 1 + FeatureSet_LEGACY_BEST_EFFORT FeatureSet_JsonFormat = 2 +) + +// Enum value maps for FeatureSet_JsonFormat. +var ( + FeatureSet_JsonFormat_name = map[int32]string{ + 0: "JSON_FORMAT_UNKNOWN", + 1: "ALLOW", + 2: "LEGACY_BEST_EFFORT", + } + FeatureSet_JsonFormat_value = map[string]int32{ + "JSON_FORMAT_UNKNOWN": 0, + "ALLOW": 1, + "LEGACY_BEST_EFFORT": 2, + } +) + +func (x FeatureSet_JsonFormat) Enum() *FeatureSet_JsonFormat { + p := new(FeatureSet_JsonFormat) + *p = x + return p +} + +func (x FeatureSet_JsonFormat) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FeatureSet_JsonFormat) Descriptor() protoreflect.EnumDescriptor { + return file_google_protobuf_descriptor_proto_enumTypes[15].Descriptor() +} + +func (FeatureSet_JsonFormat) Type() protoreflect.EnumType { + return &file_google_protobuf_descriptor_proto_enumTypes[15] +} + +func (x FeatureSet_JsonFormat) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *FeatureSet_JsonFormat) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = FeatureSet_JsonFormat(num) + return nil +} + +// Deprecated: Use FeatureSet_JsonFormat.Descriptor instead. +func (FeatureSet_JsonFormat) EnumDescriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{19, 5} +} + // Represents the identified object's effect on the element in the original // .proto file. type GeneratedCodeInfo_Annotation_Semantic int32 @@ -716,11 +1174,11 @@ func (x GeneratedCodeInfo_Annotation_Semantic) String() string { } func (GeneratedCodeInfo_Annotation_Semantic) Descriptor() protoreflect.EnumDescriptor { - return file_google_protobuf_descriptor_proto_enumTypes[9].Descriptor() + return file_google_protobuf_descriptor_proto_enumTypes[16].Descriptor() } func (GeneratedCodeInfo_Annotation_Semantic) Type() protoreflect.EnumType { - return &file_google_protobuf_descriptor_proto_enumTypes[9] + return &file_google_protobuf_descriptor_proto_enumTypes[16] } func (x GeneratedCodeInfo_Annotation_Semantic) Number() protoreflect.EnumNumber { @@ -739,7 +1197,7 @@ func (x *GeneratedCodeInfo_Annotation_Semantic) UnmarshalJSON(b []byte) error { // Deprecated: Use GeneratedCodeInfo_Annotation_Semantic.Descriptor instead. func (GeneratedCodeInfo_Annotation_Semantic) EnumDescriptor() ([]byte, []int) { - return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{20, 0, 0} + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{22, 0, 0} } // The protocol compiler can output a FileDescriptorSet containing the .proto @@ -822,8 +1280,8 @@ type FileDescriptorProto struct { // // If `edition` is present, this value must be "editions". Syntax *string `protobuf:"bytes,12,opt,name=syntax" json:"syntax,omitempty"` - // The edition of the proto file, which is an opaque string. - Edition *string `protobuf:"bytes,13,opt,name=edition" json:"edition,omitempty"` + // The edition of the proto file. + Edition *Edition `protobuf:"varint,14,opt,name=edition,enum=google.protobuf.Edition" json:"edition,omitempty"` } func (x *FileDescriptorProto) Reset() { @@ -942,11 +1400,11 @@ func (x *FileDescriptorProto) GetSyntax() string { return "" } -func (x *FileDescriptorProto) GetEdition() string { +func (x *FileDescriptorProto) GetEdition() Edition { if x != nil && x.Edition != nil { return *x.Edition } - return "" + return Edition_EDITION_UNKNOWN } // Describes a message type. @@ -1079,13 +1537,14 @@ type ExtensionRangeOptions struct { // The parser stores options it doesn't recognize here. See above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - // go/protobuf-stripping-extension-declarations - // Like Metadata, but we use a repeated field to hold all extension - // declarations. This should avoid the size increases of transforming a large - // extension range into small ranges in generated binaries. + // For external users: DO NOT USE. We are in the process of open sourcing + // extension declaration and executing internal cleanups before it can be + // used externally. Declaration []*ExtensionRangeOptions_Declaration `protobuf:"bytes,2,rep,name=declaration" json:"declaration,omitempty"` + // Any features defined in the specific edition. + Features *FeatureSet `protobuf:"bytes,50,opt,name=features" json:"features,omitempty"` // The verification state of the range. - // TODO(b/278783756): flip the default to DECLARATION once all empty ranges + // TODO: flip the default to DECLARATION once all empty ranges // are marked as UNVERIFIED. Verification *ExtensionRangeOptions_VerificationState `protobuf:"varint,3,opt,name=verification,enum=google.protobuf.ExtensionRangeOptions_VerificationState,def=1" json:"verification,omitempty"` } @@ -1141,6 +1600,13 @@ func (x *ExtensionRangeOptions) GetDeclaration() []*ExtensionRangeOptions_Declar return nil } +func (x *ExtensionRangeOptions) GetFeatures() *FeatureSet { + if x != nil { + return x.Features + } + return nil +} + func (x *ExtensionRangeOptions) GetVerification() ExtensionRangeOptions_VerificationState { if x != nil && x.Verification != nil { return *x.Verification @@ -1186,12 +1652,12 @@ type FieldDescriptorProto struct { // If true, this is a proto3 "optional". When a proto3 field is optional, it // tracks presence regardless of field type. // - // When proto3_optional is true, this field must be belong to a oneof to - // signal to old proto3 clients that presence is tracked for this field. This - // oneof is known as a "synthetic" oneof, and this field must be its sole - // member (each proto3 optional field gets its own synthetic oneof). Synthetic - // oneofs exist in the descriptor only, and do not generate any API. Synthetic - // oneofs must be ordered after all "real" oneofs. + // When proto3_optional is true, this field must belong to a oneof to signal + // to old proto3 clients that presence is tracked for this field. This oneof + // is known as a "synthetic" oneof, and this field must be its sole member + // (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + // exist in the descriptor only, and do not generate any API. Synthetic oneofs + // must be ordered after all "real" oneofs. // // For message fields, proto3_optional doesn't create any semantic change, // since non-repeated message fields always track presence. However it still @@ -1738,7 +2204,6 @@ type FileOptions struct { CcGenericServices *bool `protobuf:"varint,16,opt,name=cc_generic_services,json=ccGenericServices,def=0" json:"cc_generic_services,omitempty"` JavaGenericServices *bool `protobuf:"varint,17,opt,name=java_generic_services,json=javaGenericServices,def=0" json:"java_generic_services,omitempty"` PyGenericServices *bool `protobuf:"varint,18,opt,name=py_generic_services,json=pyGenericServices,def=0" json:"py_generic_services,omitempty"` - PhpGenericServices *bool `protobuf:"varint,42,opt,name=php_generic_services,json=phpGenericServices,def=0" json:"php_generic_services,omitempty"` // Is this file deprecated? // Depending on the target platform, this can emit Deprecated annotations // for everything in the file, or it will be completely ignored; in the very @@ -1772,6 +2237,8 @@ type FileOptions struct { // is empty. When this option is not set, the package name will be used for // determining the ruby package. RubyPackage *string `protobuf:"bytes,45,opt,name=ruby_package,json=rubyPackage" json:"ruby_package,omitempty"` + // Any features defined in the specific edition. + Features *FeatureSet `protobuf:"bytes,50,opt,name=features" json:"features,omitempty"` // The parser stores options it doesn't recognize here. // See the documentation for the "Options" section above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` @@ -1785,7 +2252,6 @@ const ( Default_FileOptions_CcGenericServices = bool(false) Default_FileOptions_JavaGenericServices = bool(false) Default_FileOptions_PyGenericServices = bool(false) - Default_FileOptions_PhpGenericServices = bool(false) Default_FileOptions_Deprecated = bool(false) Default_FileOptions_CcEnableArenas = bool(true) ) @@ -1893,13 +2359,6 @@ func (x *FileOptions) GetPyGenericServices() bool { return Default_FileOptions_PyGenericServices } -func (x *FileOptions) GetPhpGenericServices() bool { - if x != nil && x.PhpGenericServices != nil { - return *x.PhpGenericServices - } - return Default_FileOptions_PhpGenericServices -} - func (x *FileOptions) GetDeprecated() bool { if x != nil && x.Deprecated != nil { return *x.Deprecated @@ -1963,6 +2422,13 @@ func (x *FileOptions) GetRubyPackage() string { return "" } +func (x *FileOptions) GetFeatures() *FeatureSet { + if x != nil { + return x.Features + } + return nil +} + func (x *FileOptions) GetUninterpretedOption() []*UninterpretedOption { if x != nil { return x.UninterpretedOption @@ -2006,10 +2472,6 @@ type MessageOptions struct { // for the message, or it will be completely ignored; in the very least, // this is a formalization for deprecating messages. Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // NOTE: Do not set the option in .proto files. Always use the maps syntax - // instead. The option should only be implicitly set by the proto compiler - // parser. - // // Whether the message is an automatically generated map entry type for the // maps field. // @@ -2030,6 +2492,10 @@ type MessageOptions struct { // use a native map in the target language to hold the keys and values. // The reflection APIs in such implementations still need to work as // if the field is a repeated message field. + // + // NOTE: Do not set the option in .proto files. Always use the maps syntax + // instead. The option should only be implicitly set by the proto compiler + // parser. MapEntry *bool `protobuf:"varint,7,opt,name=map_entry,json=mapEntry" json:"map_entry,omitempty"` // Enable the legacy handling of JSON field name conflicts. This lowercases // and strips underscored from the fields before comparison in proto3 only. @@ -2039,11 +2505,13 @@ type MessageOptions struct { // This should only be used as a temporary measure against broken builds due // to the change in behavior for JSON field name conflicts. // - // TODO(b/261750190) This is legacy behavior we plan to remove once downstream + // TODO This is legacy behavior we plan to remove once downstream // teams have had time to migrate. // // Deprecated: Marked as deprecated in google/protobuf/descriptor.proto. DeprecatedLegacyJsonFieldConflicts *bool `protobuf:"varint,11,opt,name=deprecated_legacy_json_field_conflicts,json=deprecatedLegacyJsonFieldConflicts" json:"deprecated_legacy_json_field_conflicts,omitempty"` + // Any features defined in the specific edition. + Features *FeatureSet `protobuf:"bytes,12,opt,name=features" json:"features,omitempty"` // The parser stores options it doesn't recognize here. See above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` } @@ -2123,6 +2591,13 @@ func (x *MessageOptions) GetDeprecatedLegacyJsonFieldConflicts() bool { return false } +func (x *MessageOptions) GetFeatures() *FeatureSet { + if x != nil { + return x.Features + } + return nil +} + func (x *MessageOptions) GetUninterpretedOption() []*UninterpretedOption { if x != nil { return x.UninterpretedOption @@ -2147,7 +2622,9 @@ type FieldOptions struct { // a more efficient representation on the wire. Rather than repeatedly // writing the tag and type for each element, the entire array is encoded as // a single length-delimited blob. In proto3, only explicit setting it to - // false will avoid using packed encoding. + // false will avoid using packed encoding. This option is prohibited in + // Editions, but the `repeated_field_encoding` feature can be used to control + // the behavior. Packed *bool `protobuf:"varint,2,opt,name=packed" json:"packed,omitempty"` // The jstype option determines the JavaScript type used for values of the // field. The option is permitted only for 64 bit integral and fixed types @@ -2178,19 +2655,11 @@ type FieldOptions struct { // call from multiple threads concurrently, while non-const methods continue // to require exclusive access. // - // Note that implementations may choose not to check required fields within - // a lazy sub-message. That is, calling IsInitialized() on the outer message - // may return true even if the inner message has missing required fields. - // This is necessary because otherwise the inner message would have to be - // parsed in order to perform the check, defeating the purpose of lazy - // parsing. An implementation which chooses not to check required fields - // must be consistent about it. That is, for any particular sub-message, the - // implementation must either *always* check its required fields, or *never* - // check its required fields, regardless of whether or not the message has - // been parsed. - // - // As of May 2022, lazy verifies the contents of the byte stream during - // parsing. An invalid byte stream will cause the overall parsing to fail. + // Note that lazy message fields are still eagerly verified to check + // ill-formed wireformat or missing required fields. Calling IsInitialized() + // on the outer message would fail if the inner message has missing required + // fields. Failed verification would result in parsing failure (except when + // uninitialized messages are acceptable). Lazy *bool `protobuf:"varint,5,opt,name=lazy,def=0" json:"lazy,omitempty"` // unverified_lazy does no correctness checks on the byte stream. This should // only be used where lazy with verification is prohibitive for performance @@ -2205,11 +2674,12 @@ type FieldOptions struct { Weak *bool `protobuf:"varint,10,opt,name=weak,def=0" json:"weak,omitempty"` // Indicate that the field value should not be printed out when using debug // formats, e.g. when the field contains sensitive credentials. - DebugRedact *bool `protobuf:"varint,16,opt,name=debug_redact,json=debugRedact,def=0" json:"debug_redact,omitempty"` - Retention *FieldOptions_OptionRetention `protobuf:"varint,17,opt,name=retention,enum=google.protobuf.FieldOptions_OptionRetention" json:"retention,omitempty"` - // Deprecated: Marked as deprecated in google/protobuf/descriptor.proto. - Target *FieldOptions_OptionTargetType `protobuf:"varint,18,opt,name=target,enum=google.protobuf.FieldOptions_OptionTargetType" json:"target,omitempty"` - Targets []FieldOptions_OptionTargetType `protobuf:"varint,19,rep,name=targets,enum=google.protobuf.FieldOptions_OptionTargetType" json:"targets,omitempty"` + DebugRedact *bool `protobuf:"varint,16,opt,name=debug_redact,json=debugRedact,def=0" json:"debug_redact,omitempty"` + Retention *FieldOptions_OptionRetention `protobuf:"varint,17,opt,name=retention,enum=google.protobuf.FieldOptions_OptionRetention" json:"retention,omitempty"` + Targets []FieldOptions_OptionTargetType `protobuf:"varint,19,rep,name=targets,enum=google.protobuf.FieldOptions_OptionTargetType" json:"targets,omitempty"` + EditionDefaults []*FieldOptions_EditionDefault `protobuf:"bytes,20,rep,name=edition_defaults,json=editionDefaults" json:"edition_defaults,omitempty"` + // Any features defined in the specific edition. + Features *FeatureSet `protobuf:"bytes,21,opt,name=features" json:"features,omitempty"` // The parser stores options it doesn't recognize here. See above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` } @@ -2320,17 +2790,23 @@ func (x *FieldOptions) GetRetention() FieldOptions_OptionRetention { return FieldOptions_RETENTION_UNKNOWN } -// Deprecated: Marked as deprecated in google/protobuf/descriptor.proto. -func (x *FieldOptions) GetTarget() FieldOptions_OptionTargetType { - if x != nil && x.Target != nil { - return *x.Target +func (x *FieldOptions) GetTargets() []FieldOptions_OptionTargetType { + if x != nil { + return x.Targets } - return FieldOptions_TARGET_TYPE_UNKNOWN + return nil } -func (x *FieldOptions) GetTargets() []FieldOptions_OptionTargetType { +func (x *FieldOptions) GetEditionDefaults() []*FieldOptions_EditionDefault { if x != nil { - return x.Targets + return x.EditionDefaults + } + return nil +} + +func (x *FieldOptions) GetFeatures() *FeatureSet { + if x != nil { + return x.Features } return nil } @@ -2348,6 +2824,8 @@ type OneofOptions struct { unknownFields protoimpl.UnknownFields extensionFields protoimpl.ExtensionFields + // Any features defined in the specific edition. + Features *FeatureSet `protobuf:"bytes,1,opt,name=features" json:"features,omitempty"` // The parser stores options it doesn't recognize here. See above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` } @@ -2384,6 +2862,13 @@ func (*OneofOptions) Descriptor() ([]byte, []int) { return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{13} } +func (x *OneofOptions) GetFeatures() *FeatureSet { + if x != nil { + return x.Features + } + return nil +} + func (x *OneofOptions) GetUninterpretedOption() []*UninterpretedOption { if x != nil { return x.UninterpretedOption @@ -2409,11 +2894,13 @@ type EnumOptions struct { // and strips underscored from the fields before comparison in proto3 only. // The new behavior takes `json_name` into account and applies to proto2 as // well. - // TODO(b/261750190) Remove this legacy behavior once downstream teams have + // TODO Remove this legacy behavior once downstream teams have // had time to migrate. // // Deprecated: Marked as deprecated in google/protobuf/descriptor.proto. DeprecatedLegacyJsonFieldConflicts *bool `protobuf:"varint,6,opt,name=deprecated_legacy_json_field_conflicts,json=deprecatedLegacyJsonFieldConflicts" json:"deprecated_legacy_json_field_conflicts,omitempty"` + // Any features defined in the specific edition. + Features *FeatureSet `protobuf:"bytes,7,opt,name=features" json:"features,omitempty"` // The parser stores options it doesn't recognize here. See above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` } @@ -2477,6 +2964,13 @@ func (x *EnumOptions) GetDeprecatedLegacyJsonFieldConflicts() bool { return false } +func (x *EnumOptions) GetFeatures() *FeatureSet { + if x != nil { + return x.Features + } + return nil +} + func (x *EnumOptions) GetUninterpretedOption() []*UninterpretedOption { if x != nil { return x.UninterpretedOption @@ -2495,13 +2989,20 @@ type EnumValueOptions struct { // for the enum value, or it will be completely ignored; in the very least, // this is a formalization for deprecating enum values. Deprecated *bool `protobuf:"varint,1,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // Any features defined in the specific edition. + Features *FeatureSet `protobuf:"bytes,2,opt,name=features" json:"features,omitempty"` + // Indicate that fields annotated with this enum value should not be printed + // out when using debug formats, e.g. when the field contains sensitive + // credentials. + DebugRedact *bool `protobuf:"varint,3,opt,name=debug_redact,json=debugRedact,def=0" json:"debug_redact,omitempty"` // The parser stores options it doesn't recognize here. See above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` } // Default values for EnumValueOptions fields. const ( - Default_EnumValueOptions_Deprecated = bool(false) + Default_EnumValueOptions_Deprecated = bool(false) + Default_EnumValueOptions_DebugRedact = bool(false) ) func (x *EnumValueOptions) Reset() { @@ -2543,6 +3044,20 @@ func (x *EnumValueOptions) GetDeprecated() bool { return Default_EnumValueOptions_Deprecated } +func (x *EnumValueOptions) GetFeatures() *FeatureSet { + if x != nil { + return x.Features + } + return nil +} + +func (x *EnumValueOptions) GetDebugRedact() bool { + if x != nil && x.DebugRedact != nil { + return *x.DebugRedact + } + return Default_EnumValueOptions_DebugRedact +} + func (x *EnumValueOptions) GetUninterpretedOption() []*UninterpretedOption { if x != nil { return x.UninterpretedOption @@ -2556,6 +3071,8 @@ type ServiceOptions struct { unknownFields protoimpl.UnknownFields extensionFields protoimpl.ExtensionFields + // Any features defined in the specific edition. + Features *FeatureSet `protobuf:"bytes,34,opt,name=features" json:"features,omitempty"` // Is this service deprecated? // Depending on the target platform, this can emit Deprecated annotations // for the service, or it will be completely ignored; in the very least, @@ -2602,6 +3119,13 @@ func (*ServiceOptions) Descriptor() ([]byte, []int) { return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{16} } +func (x *ServiceOptions) GetFeatures() *FeatureSet { + if x != nil { + return x.Features + } + return nil +} + func (x *ServiceOptions) GetDeprecated() bool { if x != nil && x.Deprecated != nil { return *x.Deprecated @@ -2628,6 +3152,8 @@ type MethodOptions struct { // this is a formalization for deprecating methods. Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` IdempotencyLevel *MethodOptions_IdempotencyLevel `protobuf:"varint,34,opt,name=idempotency_level,json=idempotencyLevel,enum=google.protobuf.MethodOptions_IdempotencyLevel,def=0" json:"idempotency_level,omitempty"` + // Any features defined in the specific edition. + Features *FeatureSet `protobuf:"bytes,35,opt,name=features" json:"features,omitempty"` // The parser stores options it doesn't recognize here. See above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` } @@ -2684,6 +3210,13 @@ func (x *MethodOptions) GetIdempotencyLevel() MethodOptions_IdempotencyLevel { return Default_MethodOptions_IdempotencyLevel } +func (x *MethodOptions) GetFeatures() *FeatureSet { + if x != nil { + return x.Features + } + return nil +} + func (x *MethodOptions) GetUninterpretedOption() []*UninterpretedOption { if x != nil { return x.UninterpretedOption @@ -2770,28 +3303,193 @@ func (x *UninterpretedOption) GetNegativeIntValue() int64 { if x != nil && x.NegativeIntValue != nil { return *x.NegativeIntValue } - return 0 + return 0 +} + +func (x *UninterpretedOption) GetDoubleValue() float64 { + if x != nil && x.DoubleValue != nil { + return *x.DoubleValue + } + return 0 +} + +func (x *UninterpretedOption) GetStringValue() []byte { + if x != nil { + return x.StringValue + } + return nil +} + +func (x *UninterpretedOption) GetAggregateValue() string { + if x != nil && x.AggregateValue != nil { + return *x.AggregateValue + } + return "" +} + +// TODO Enums in C++ gencode (and potentially other languages) are +// not well scoped. This means that each of the feature enums below can clash +// with each other. The short names we've chosen maximize call-site +// readability, but leave us very open to this scenario. A future feature will +// be designed and implemented to handle this, hopefully before we ever hit a +// conflict here. +type FeatureSet struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + extensionFields protoimpl.ExtensionFields + + FieldPresence *FeatureSet_FieldPresence `protobuf:"varint,1,opt,name=field_presence,json=fieldPresence,enum=google.protobuf.FeatureSet_FieldPresence" json:"field_presence,omitempty"` + EnumType *FeatureSet_EnumType `protobuf:"varint,2,opt,name=enum_type,json=enumType,enum=google.protobuf.FeatureSet_EnumType" json:"enum_type,omitempty"` + RepeatedFieldEncoding *FeatureSet_RepeatedFieldEncoding `protobuf:"varint,3,opt,name=repeated_field_encoding,json=repeatedFieldEncoding,enum=google.protobuf.FeatureSet_RepeatedFieldEncoding" json:"repeated_field_encoding,omitempty"` + Utf8Validation *FeatureSet_Utf8Validation `protobuf:"varint,4,opt,name=utf8_validation,json=utf8Validation,enum=google.protobuf.FeatureSet_Utf8Validation" json:"utf8_validation,omitempty"` + MessageEncoding *FeatureSet_MessageEncoding `protobuf:"varint,5,opt,name=message_encoding,json=messageEncoding,enum=google.protobuf.FeatureSet_MessageEncoding" json:"message_encoding,omitempty"` + JsonFormat *FeatureSet_JsonFormat `protobuf:"varint,6,opt,name=json_format,json=jsonFormat,enum=google.protobuf.FeatureSet_JsonFormat" json:"json_format,omitempty"` +} + +func (x *FeatureSet) Reset() { + *x = FeatureSet{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FeatureSet) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FeatureSet) ProtoMessage() {} + +func (x *FeatureSet) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FeatureSet.ProtoReflect.Descriptor instead. +func (*FeatureSet) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{19} +} + +func (x *FeatureSet) GetFieldPresence() FeatureSet_FieldPresence { + if x != nil && x.FieldPresence != nil { + return *x.FieldPresence + } + return FeatureSet_FIELD_PRESENCE_UNKNOWN +} + +func (x *FeatureSet) GetEnumType() FeatureSet_EnumType { + if x != nil && x.EnumType != nil { + return *x.EnumType + } + return FeatureSet_ENUM_TYPE_UNKNOWN +} + +func (x *FeatureSet) GetRepeatedFieldEncoding() FeatureSet_RepeatedFieldEncoding { + if x != nil && x.RepeatedFieldEncoding != nil { + return *x.RepeatedFieldEncoding + } + return FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN +} + +func (x *FeatureSet) GetUtf8Validation() FeatureSet_Utf8Validation { + if x != nil && x.Utf8Validation != nil { + return *x.Utf8Validation + } + return FeatureSet_UTF8_VALIDATION_UNKNOWN +} + +func (x *FeatureSet) GetMessageEncoding() FeatureSet_MessageEncoding { + if x != nil && x.MessageEncoding != nil { + return *x.MessageEncoding + } + return FeatureSet_MESSAGE_ENCODING_UNKNOWN +} + +func (x *FeatureSet) GetJsonFormat() FeatureSet_JsonFormat { + if x != nil && x.JsonFormat != nil { + return *x.JsonFormat + } + return FeatureSet_JSON_FORMAT_UNKNOWN +} + +// A compiled specification for the defaults of a set of features. These +// messages are generated from FeatureSet extensions and can be used to seed +// feature resolution. The resolution with this object becomes a simple search +// for the closest matching edition, followed by proto merges. +type FeatureSetDefaults struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Defaults []*FeatureSetDefaults_FeatureSetEditionDefault `protobuf:"bytes,1,rep,name=defaults" json:"defaults,omitempty"` + // The minimum supported edition (inclusive) when this was constructed. + // Editions before this will not have defaults. + MinimumEdition *Edition `protobuf:"varint,4,opt,name=minimum_edition,json=minimumEdition,enum=google.protobuf.Edition" json:"minimum_edition,omitempty"` + // The maximum known edition (inclusive) when this was constructed. Editions + // after this will not have reliable defaults. + MaximumEdition *Edition `protobuf:"varint,5,opt,name=maximum_edition,json=maximumEdition,enum=google.protobuf.Edition" json:"maximum_edition,omitempty"` +} + +func (x *FeatureSetDefaults) Reset() { + *x = FeatureSetDefaults{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FeatureSetDefaults) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FeatureSetDefaults) ProtoMessage() {} + +func (x *FeatureSetDefaults) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func (x *UninterpretedOption) GetDoubleValue() float64 { - if x != nil && x.DoubleValue != nil { - return *x.DoubleValue - } - return 0 +// Deprecated: Use FeatureSetDefaults.ProtoReflect.Descriptor instead. +func (*FeatureSetDefaults) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{20} } -func (x *UninterpretedOption) GetStringValue() []byte { +func (x *FeatureSetDefaults) GetDefaults() []*FeatureSetDefaults_FeatureSetEditionDefault { if x != nil { - return x.StringValue + return x.Defaults } return nil } -func (x *UninterpretedOption) GetAggregateValue() string { - if x != nil && x.AggregateValue != nil { - return *x.AggregateValue +func (x *FeatureSetDefaults) GetMinimumEdition() Edition { + if x != nil && x.MinimumEdition != nil { + return *x.MinimumEdition } - return "" + return Edition_EDITION_UNKNOWN +} + +func (x *FeatureSetDefaults) GetMaximumEdition() Edition { + if x != nil && x.MaximumEdition != nil { + return *x.MaximumEdition + } + return Edition_EDITION_UNKNOWN } // Encapsulates information about the original source file from which a @@ -2855,7 +3553,7 @@ type SourceCodeInfo struct { func (x *SourceCodeInfo) Reset() { *x = SourceCodeInfo{} if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[19] + mi := &file_google_protobuf_descriptor_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2868,7 +3566,7 @@ func (x *SourceCodeInfo) String() string { func (*SourceCodeInfo) ProtoMessage() {} func (x *SourceCodeInfo) ProtoReflect() protoreflect.Message { - mi := &file_google_protobuf_descriptor_proto_msgTypes[19] + mi := &file_google_protobuf_descriptor_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2881,7 +3579,7 @@ func (x *SourceCodeInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use SourceCodeInfo.ProtoReflect.Descriptor instead. func (*SourceCodeInfo) Descriptor() ([]byte, []int) { - return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{19} + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{21} } func (x *SourceCodeInfo) GetLocation() []*SourceCodeInfo_Location { @@ -2907,7 +3605,7 @@ type GeneratedCodeInfo struct { func (x *GeneratedCodeInfo) Reset() { *x = GeneratedCodeInfo{} if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[20] + mi := &file_google_protobuf_descriptor_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2920,7 +3618,7 @@ func (x *GeneratedCodeInfo) String() string { func (*GeneratedCodeInfo) ProtoMessage() {} func (x *GeneratedCodeInfo) ProtoReflect() protoreflect.Message { - mi := &file_google_protobuf_descriptor_proto_msgTypes[20] + mi := &file_google_protobuf_descriptor_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2933,7 +3631,7 @@ func (x *GeneratedCodeInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use GeneratedCodeInfo.ProtoReflect.Descriptor instead. func (*GeneratedCodeInfo) Descriptor() ([]byte, []int) { - return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{20} + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{22} } func (x *GeneratedCodeInfo) GetAnnotation() []*GeneratedCodeInfo_Annotation { @@ -2956,7 +3654,7 @@ type DescriptorProto_ExtensionRange struct { func (x *DescriptorProto_ExtensionRange) Reset() { *x = DescriptorProto_ExtensionRange{} if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[21] + mi := &file_google_protobuf_descriptor_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2969,7 +3667,7 @@ func (x *DescriptorProto_ExtensionRange) String() string { func (*DescriptorProto_ExtensionRange) ProtoMessage() {} func (x *DescriptorProto_ExtensionRange) ProtoReflect() protoreflect.Message { - mi := &file_google_protobuf_descriptor_proto_msgTypes[21] + mi := &file_google_protobuf_descriptor_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3021,7 +3719,7 @@ type DescriptorProto_ReservedRange struct { func (x *DescriptorProto_ReservedRange) Reset() { *x = DescriptorProto_ReservedRange{} if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[22] + mi := &file_google_protobuf_descriptor_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3034,7 +3732,7 @@ func (x *DescriptorProto_ReservedRange) String() string { func (*DescriptorProto_ReservedRange) ProtoMessage() {} func (x *DescriptorProto_ReservedRange) ProtoReflect() protoreflect.Message { - mi := &file_google_protobuf_descriptor_proto_msgTypes[22] + mi := &file_google_protobuf_descriptor_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3078,10 +3776,6 @@ type ExtensionRangeOptions_Declaration struct { // Metadata.type, Declaration.type must have a leading dot for messages // and enums. Type *string `protobuf:"bytes,3,opt,name=type" json:"type,omitempty"` - // Deprecated. Please use "repeated". - // - // Deprecated: Marked as deprecated in google/protobuf/descriptor.proto. - IsRepeated *bool `protobuf:"varint,4,opt,name=is_repeated,json=isRepeated" json:"is_repeated,omitempty"` // If true, indicates that the number is reserved in the extension range, // and any extension field with the number will fail to compile. Set this // when a declared extension field is deleted. @@ -3094,7 +3788,7 @@ type ExtensionRangeOptions_Declaration struct { func (x *ExtensionRangeOptions_Declaration) Reset() { *x = ExtensionRangeOptions_Declaration{} if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[23] + mi := &file_google_protobuf_descriptor_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3107,7 +3801,7 @@ func (x *ExtensionRangeOptions_Declaration) String() string { func (*ExtensionRangeOptions_Declaration) ProtoMessage() {} func (x *ExtensionRangeOptions_Declaration) ProtoReflect() protoreflect.Message { - mi := &file_google_protobuf_descriptor_proto_msgTypes[23] + mi := &file_google_protobuf_descriptor_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3144,14 +3838,6 @@ func (x *ExtensionRangeOptions_Declaration) GetType() string { return "" } -// Deprecated: Marked as deprecated in google/protobuf/descriptor.proto. -func (x *ExtensionRangeOptions_Declaration) GetIsRepeated() bool { - if x != nil && x.IsRepeated != nil { - return *x.IsRepeated - } - return false -} - func (x *ExtensionRangeOptions_Declaration) GetReserved() bool { if x != nil && x.Reserved != nil { return *x.Reserved @@ -3184,7 +3870,7 @@ type EnumDescriptorProto_EnumReservedRange struct { func (x *EnumDescriptorProto_EnumReservedRange) Reset() { *x = EnumDescriptorProto_EnumReservedRange{} if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[24] + mi := &file_google_protobuf_descriptor_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3197,7 +3883,7 @@ func (x *EnumDescriptorProto_EnumReservedRange) String() string { func (*EnumDescriptorProto_EnumReservedRange) ProtoMessage() {} func (x *EnumDescriptorProto_EnumReservedRange) ProtoReflect() protoreflect.Message { - mi := &file_google_protobuf_descriptor_proto_msgTypes[24] + mi := &file_google_protobuf_descriptor_proto_msgTypes[26] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3227,6 +3913,61 @@ func (x *EnumDescriptorProto_EnumReservedRange) GetEnd() int32 { return 0 } +type FieldOptions_EditionDefault struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Edition *Edition `protobuf:"varint,3,opt,name=edition,enum=google.protobuf.Edition" json:"edition,omitempty"` + Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` // Textproto value. +} + +func (x *FieldOptions_EditionDefault) Reset() { + *x = FieldOptions_EditionDefault{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FieldOptions_EditionDefault) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FieldOptions_EditionDefault) ProtoMessage() {} + +func (x *FieldOptions_EditionDefault) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[27] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FieldOptions_EditionDefault.ProtoReflect.Descriptor instead. +func (*FieldOptions_EditionDefault) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{12, 0} +} + +func (x *FieldOptions_EditionDefault) GetEdition() Edition { + if x != nil && x.Edition != nil { + return *x.Edition + } + return Edition_EDITION_UNKNOWN +} + +func (x *FieldOptions_EditionDefault) GetValue() string { + if x != nil && x.Value != nil { + return *x.Value + } + return "" +} + // The name of the uninterpreted option. Each string represents a segment in // a dot-separated name. is_extension is true iff a segment represents an // extension (denoted with parentheses in options specs in .proto files). @@ -3244,7 +3985,7 @@ type UninterpretedOption_NamePart struct { func (x *UninterpretedOption_NamePart) Reset() { *x = UninterpretedOption_NamePart{} if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[25] + mi := &file_google_protobuf_descriptor_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3257,7 +3998,7 @@ func (x *UninterpretedOption_NamePart) String() string { func (*UninterpretedOption_NamePart) ProtoMessage() {} func (x *UninterpretedOption_NamePart) ProtoReflect() protoreflect.Message { - mi := &file_google_protobuf_descriptor_proto_msgTypes[25] + mi := &file_google_protobuf_descriptor_proto_msgTypes[28] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3287,6 +4028,65 @@ func (x *UninterpretedOption_NamePart) GetIsExtension() bool { return false } +// A map from every known edition with a unique set of defaults to its +// defaults. Not all editions may be contained here. For a given edition, +// the defaults at the closest matching edition ordered at or before it should +// be used. This field must be in strict ascending order by edition. +type FeatureSetDefaults_FeatureSetEditionDefault struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Edition *Edition `protobuf:"varint,3,opt,name=edition,enum=google.protobuf.Edition" json:"edition,omitempty"` + Features *FeatureSet `protobuf:"bytes,2,opt,name=features" json:"features,omitempty"` +} + +func (x *FeatureSetDefaults_FeatureSetEditionDefault) Reset() { + *x = FeatureSetDefaults_FeatureSetEditionDefault{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FeatureSetDefaults_FeatureSetEditionDefault) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FeatureSetDefaults_FeatureSetEditionDefault) ProtoMessage() {} + +func (x *FeatureSetDefaults_FeatureSetEditionDefault) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[29] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FeatureSetDefaults_FeatureSetEditionDefault.ProtoReflect.Descriptor instead. +func (*FeatureSetDefaults_FeatureSetEditionDefault) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{20, 0} +} + +func (x *FeatureSetDefaults_FeatureSetEditionDefault) GetEdition() Edition { + if x != nil && x.Edition != nil { + return *x.Edition + } + return Edition_EDITION_UNKNOWN +} + +func (x *FeatureSetDefaults_FeatureSetEditionDefault) GetFeatures() *FeatureSet { + if x != nil { + return x.Features + } + return nil +} + type SourceCodeInfo_Location struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3296,7 +4096,7 @@ type SourceCodeInfo_Location struct { // location. // // Each element is a field number or an index. They form a path from - // the root FileDescriptorProto to the place where the definition occurs. + // the root FileDescriptorProto to the place where the definition appears. // For example, this path: // // [ 4, 3, 2, 7, 1 ] @@ -3388,7 +4188,7 @@ type SourceCodeInfo_Location struct { func (x *SourceCodeInfo_Location) Reset() { *x = SourceCodeInfo_Location{} if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[26] + mi := &file_google_protobuf_descriptor_proto_msgTypes[30] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3401,7 +4201,7 @@ func (x *SourceCodeInfo_Location) String() string { func (*SourceCodeInfo_Location) ProtoMessage() {} func (x *SourceCodeInfo_Location) ProtoReflect() protoreflect.Message { - mi := &file_google_protobuf_descriptor_proto_msgTypes[26] + mi := &file_google_protobuf_descriptor_proto_msgTypes[30] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3414,7 +4214,7 @@ func (x *SourceCodeInfo_Location) ProtoReflect() protoreflect.Message { // Deprecated: Use SourceCodeInfo_Location.ProtoReflect.Descriptor instead. func (*SourceCodeInfo_Location) Descriptor() ([]byte, []int) { - return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{19, 0} + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{21, 0} } func (x *SourceCodeInfo_Location) GetPath() []int32 { @@ -3475,7 +4275,7 @@ type GeneratedCodeInfo_Annotation struct { func (x *GeneratedCodeInfo_Annotation) Reset() { *x = GeneratedCodeInfo_Annotation{} if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[27] + mi := &file_google_protobuf_descriptor_proto_msgTypes[31] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3488,7 +4288,7 @@ func (x *GeneratedCodeInfo_Annotation) String() string { func (*GeneratedCodeInfo_Annotation) ProtoMessage() {} func (x *GeneratedCodeInfo_Annotation) ProtoReflect() protoreflect.Message { - mi := &file_google_protobuf_descriptor_proto_msgTypes[27] + mi := &file_google_protobuf_descriptor_proto_msgTypes[31] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3501,7 +4301,7 @@ func (x *GeneratedCodeInfo_Annotation) ProtoReflect() protoreflect.Message { // Deprecated: Use GeneratedCodeInfo_Annotation.ProtoReflect.Descriptor instead. func (*GeneratedCodeInfo_Annotation) Descriptor() ([]byte, []int) { - return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{20, 0} + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{22, 0} } func (x *GeneratedCodeInfo_Annotation) GetPath() []int32 { @@ -3550,7 +4350,7 @@ var file_google_protobuf_descriptor_proto_rawDesc = []byte{ 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x04, 0x66, 0x69, - 0x6c, 0x65, 0x22, 0xfe, 0x04, 0x0a, 0x13, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, + 0x6c, 0x65, 0x22, 0x98, 0x05, 0x0a, 0x13, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, @@ -3588,250 +4388,250 @@ var file_google_protobuf_descriptor_proto_rawDesc = []byte{ 0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x18, 0x0c, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x64, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x64, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x22, 0xb9, 0x06, 0x0a, 0x0f, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x05, 0x66, - 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, - 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x43, 0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, - 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, - 0x0b, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0a, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x41, 0x0a, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x08, 0x65, 0x6e, 0x75, 0x6d, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x58, 0x0a, 0x0f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x67, + 0x09, 0x52, 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x12, 0x32, 0x0a, 0x07, 0x65, 0x64, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xb9, 0x06, + 0x0a, 0x0f, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x12, 0x43, 0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x09, 0x65, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x0b, 0x6e, 0x65, 0x73, 0x74, 0x65, + 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0e, 0x65, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x44, 0x0a, - 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x64, 0x65, 0x63, 0x6c, 0x18, 0x08, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x09, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x44, - 0x65, 0x63, 0x6c, 0x12, 0x39, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x55, - 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, - 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0a, + 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x09, 0x65, 0x6e, + 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x52, 0x08, 0x65, 0x6e, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x58, 0x0a, + 0x0f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, + 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, + 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, + 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x44, 0x0a, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, + 0x5f, 0x64, 0x65, 0x63, 0x6c, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, + 0x65, 0x6f, 0x66, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x52, 0x09, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65, 0x63, 0x6c, 0x12, 0x39, 0x0a, + 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x55, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x64, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x2e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, + 0x52, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, + 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, + 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x7a, 0x0a, 0x0e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, + 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x40, + 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x26, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x1a, 0x37, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0xcc, 0x04, 0x0a, 0x15, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, + 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, + 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x59, 0x0a, + 0x0b, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, + 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x6c, 0x61, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x03, 0x88, 0x01, 0x02, 0x52, 0x0b, 0x64, 0x65, 0x63, + 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x73, 0x18, 0x32, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x73, 0x12, 0x6d, 0x0a, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x38, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x3a, 0x0a, 0x55, 0x4e, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, 0x45, 0x44, 0x42, 0x03, 0x88, + 0x01, 0x02, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x1a, 0x94, 0x01, 0x0a, 0x0b, 0x44, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x75, 0x6c, 0x6c, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x75, 0x6c, + 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x22, 0x34, 0x0a, 0x11, 0x56, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f, 0x0a, 0x0b, + 0x44, 0x45, 0x43, 0x4c, 0x41, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x00, 0x12, 0x0e, 0x0a, + 0x0a, 0x55, 0x4e, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x01, 0x2a, 0x09, 0x08, + 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0xc1, 0x06, 0x0a, 0x14, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x41, 0x0a, + 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, + 0x12, 0x3e, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, + 0x08, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, + 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, + 0x0a, 0x0b, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, + 0x1b, 0x0a, 0x09, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x6a, 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x22, 0xb6, + 0x02, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x05, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x10, 0x07, 0x12, 0x0d, 0x0a, + 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x10, 0x08, 0x12, 0x0f, 0x0a, 0x0b, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x09, 0x12, 0x0e, 0x0a, + 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x0a, 0x12, 0x10, 0x0a, + 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x0b, 0x12, + 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x59, 0x54, 0x45, 0x53, 0x10, 0x0c, 0x12, + 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x0d, + 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x10, 0x0e, 0x12, + 0x11, 0x0a, 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, + 0x10, 0x0f, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, + 0x44, 0x36, 0x34, 0x10, 0x10, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, + 0x4e, 0x54, 0x33, 0x32, 0x10, 0x11, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, + 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x12, 0x22, 0x43, 0x0a, 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, + 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, + 0x41, 0x4c, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, + 0x50, 0x45, 0x41, 0x54, 0x45, 0x44, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, + 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x49, 0x52, 0x45, 0x44, 0x10, 0x02, 0x22, 0x63, 0x0a, 0x14, + 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, + 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x22, 0xe3, 0x02, 0x0a, 0x13, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3f, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, + 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x36, + 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x5d, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x64, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x36, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x7a, 0x0a, 0x0e, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x03, 0x65, 0x6e, 0x64, 0x12, 0x40, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x37, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, - 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, - 0xad, 0x04, 0x0a, 0x15, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, - 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, - 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, - 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x59, 0x0a, 0x0b, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x44, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x03, 0x88, 0x01, - 0x02, 0x52, 0x0b, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x68, - 0x0a, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x38, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x56, 0x65, 0x72, - 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x3a, 0x0a, - 0x55, 0x4e, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, 0x45, 0x44, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, - 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xb3, 0x01, 0x0a, 0x0b, 0x44, 0x65, 0x63, - 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, - 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, - 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x12, 0x23, 0x0a, 0x0b, 0x69, 0x73, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0a, 0x69, 0x73, 0x52, 0x65, - 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x22, 0x34, - 0x0a, 0x11, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x44, 0x45, 0x43, 0x4c, 0x41, 0x52, 0x41, 0x54, 0x49, - 0x4f, 0x4e, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x55, 0x4e, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x01, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, - 0xc1, 0x06, 0x0a, 0x14, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, - 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, - 0x6d, 0x62, 0x65, 0x72, 0x12, 0x41, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, - 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x3e, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x79, 0x70, - 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x79, 0x70, 0x65, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x79, 0x70, 0x65, - 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x65, - 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x69, - 0x6e, 0x64, 0x65, 0x78, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, - 0x66, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x09, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6a, 0x73, 0x6f, 0x6e, 0x4e, - 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x27, 0x0a, 0x0f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, - 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x22, 0xb6, 0x02, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, - 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x10, 0x01, 0x12, - 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x10, 0x02, 0x12, - 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x03, 0x12, - 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x04, - 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x05, - 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, - 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, - 0x33, 0x32, 0x10, 0x07, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x4f, 0x4f, - 0x4c, 0x10, 0x08, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, - 0x4e, 0x47, 0x10, 0x09, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x52, 0x4f, - 0x55, 0x50, 0x10, 0x0a, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, - 0x53, 0x41, 0x47, 0x45, 0x10, 0x0b, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, - 0x59, 0x54, 0x45, 0x53, 0x10, 0x0c, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, - 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x0d, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, - 0x45, 0x4e, 0x55, 0x4d, 0x10, 0x0e, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, - 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x10, 0x0f, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x10, 0x10, 0x12, 0x0f, 0x0a, 0x0b, - 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x11, 0x12, 0x0f, 0x0a, - 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x12, 0x22, 0x43, - 0x0a, 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, - 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x4c, - 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x49, 0x52, 0x45, 0x44, 0x10, 0x02, 0x12, - 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x50, 0x45, 0x41, 0x54, 0x45, - 0x44, 0x10, 0x03, 0x22, 0x63, 0x0a, 0x14, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x37, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, - 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xe3, 0x02, 0x0a, 0x13, 0x45, 0x6e, 0x75, - 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x36, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x5d, 0x0a, - 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, - 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6e, 0x75, 0x6d, - 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0d, 0x72, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, - 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x4e, 0x61, 0x6d, - 0x65, 0x1a, 0x3b, 0x0a, 0x11, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, - 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0x83, - 0x01, 0x0a, 0x18, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xa7, 0x01, 0x0a, 0x16, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x06, 0x6d, 0x65, 0x74, - 0x68, 0x6f, 0x64, 0x12, 0x39, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x89, - 0x02, 0x0a, 0x15, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x3b, 0x0a, 0x11, 0x45, 0x6e, + 0x75, 0x6d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, + 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0x83, 0x01, 0x0a, 0x18, 0x45, 0x6e, 0x75, 0x6d, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x12, 0x3b, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xa7, 0x01, + 0x0a, 0x16, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, - 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, - 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x38, 0x0a, 0x07, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x06, + 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, + 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x39, 0x0a, 0x07, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x30, 0x0a, 0x10, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, - 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, - 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x12, 0x30, 0x0a, 0x10, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x22, 0x91, 0x09, 0x0a, 0x0b, 0x46, - 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6a, 0x61, - 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0b, 0x6a, 0x61, 0x76, 0x61, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x30, 0x0a, - 0x14, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, - 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x6a, 0x61, 0x76, - 0x61, 0x4f, 0x75, 0x74, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x35, 0x0a, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, - 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, - 0x6c, 0x73, 0x65, 0x52, 0x11, 0x6a, 0x61, 0x76, 0x61, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, - 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x44, 0x0a, 0x1d, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x67, - 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x65, 0x71, 0x75, 0x61, 0x6c, 0x73, 0x5f, 0x61, - 0x6e, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, - 0x01, 0x52, 0x19, 0x6a, 0x61, 0x76, 0x61, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x45, - 0x71, 0x75, 0x61, 0x6c, 0x73, 0x41, 0x6e, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x3a, 0x0a, 0x16, - 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x68, 0x65, 0x63, - 0x6b, 0x5f, 0x75, 0x74, 0x66, 0x38, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, - 0x6c, 0x73, 0x65, 0x52, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x43, - 0x68, 0x65, 0x63, 0x6b, 0x55, 0x74, 0x66, 0x38, 0x12, 0x53, 0x0a, 0x0c, 0x6f, 0x70, 0x74, 0x69, - 0x6d, 0x69, 0x7a, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, - 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x3a, 0x05, 0x53, 0x50, 0x45, 0x45, 0x44, - 0x52, 0x0b, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x46, 0x6f, 0x72, 0x12, 0x1d, 0x0a, - 0x0a, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x67, 0x6f, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x35, 0x0a, 0x13, - 0x63, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, - 0x52, 0x11, 0x63, 0x63, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 0x12, 0x39, 0x0a, 0x15, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x67, 0x65, 0x6e, 0x65, - 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x11, 0x20, 0x01, - 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x47, - 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x35, - 0x0a, 0x13, 0x70, 0x79, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, - 0x73, 0x65, 0x52, 0x11, 0x70, 0x79, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x37, 0x0a, 0x14, 0x70, 0x68, 0x70, 0x5f, 0x67, 0x65, 0x6e, - 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x2a, 0x20, - 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x12, 0x70, 0x68, 0x70, 0x47, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x89, 0x02, 0x0a, 0x15, 0x4d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x75, 0x74, 0x70, 0x75, + 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x30, 0x0a, 0x10, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, + 0x52, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, + 0x67, 0x12, 0x30, 0x0a, 0x10, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, + 0x73, 0x65, 0x52, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x69, 0x6e, 0x67, 0x22, 0x97, 0x09, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, + 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6a, 0x61, 0x76, 0x61, 0x50, + 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, + 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x6a, 0x61, 0x76, 0x61, 0x4f, 0x75, 0x74, 0x65, 0x72, 0x43, + 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x13, 0x6a, 0x61, 0x76, 0x61, + 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x6a, 0x61, + 0x76, 0x61, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, + 0x44, 0x0a, 0x1d, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, + 0x5f, 0x65, 0x71, 0x75, 0x61, 0x6c, 0x73, 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, + 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x19, 0x6a, 0x61, 0x76, 0x61, + 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x45, 0x71, 0x75, 0x61, 0x6c, 0x73, 0x41, 0x6e, + 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x3a, 0x0a, 0x16, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x73, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x75, 0x74, 0x66, 0x38, 0x18, + 0x1b, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x13, 0x6a, 0x61, + 0x76, 0x61, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x74, 0x66, + 0x38, 0x12, 0x53, 0x0a, 0x0c, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x5f, 0x66, 0x6f, + 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, + 0x64, 0x65, 0x3a, 0x05, 0x53, 0x50, 0x45, 0x45, 0x44, 0x52, 0x0b, 0x6f, 0x70, 0x74, 0x69, 0x6d, + 0x69, 0x7a, 0x65, 0x46, 0x6f, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, + 0x6b, 0x61, 0x67, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x6f, 0x50, 0x61, + 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x35, 0x0a, 0x13, 0x63, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x65, + 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x10, 0x20, 0x01, + 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x63, 0x63, 0x47, 0x65, 0x6e, + 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x39, 0x0a, 0x15, + 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, + 0x73, 0x65, 0x52, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x35, 0x0a, 0x13, 0x70, 0x79, 0x5f, 0x67, 0x65, + 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x12, + 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x70, 0x79, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x17, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, @@ -3856,259 +4656,419 @@ var file_google_protobuf_descriptor_proto_rawDesc = []byte{ 0x70, 0x68, 0x70, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x75, 0x62, 0x79, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x2d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x75, 0x62, 0x79, - 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, - 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, - 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x22, 0x3a, 0x0a, 0x0c, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x64, - 0x65, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x50, 0x45, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, - 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x49, 0x5a, 0x45, 0x10, 0x02, 0x12, 0x10, 0x0a, 0x0c, 0x4c, - 0x49, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x03, 0x2a, 0x09, 0x08, - 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x26, 0x10, 0x27, 0x22, 0xbb, - 0x03, 0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x12, 0x3c, 0x0a, 0x17, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x74, - 0x5f, 0x77, 0x69, 0x72, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x14, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x53, 0x65, 0x74, 0x57, 0x69, 0x72, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, - 0x4c, 0x0a, 0x1f, 0x6e, 0x6f, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x5f, 0x64, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, - 0x1c, 0x6e, 0x6f, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x6f, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x12, 0x25, 0x0a, - 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, - 0x61, 0x74, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x65, 0x6e, 0x74, 0x72, - 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x12, 0x56, 0x0a, 0x26, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f, - 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x66, 0x69, 0x65, 0x6c, - 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, - 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x22, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, - 0x64, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, - 0x43, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, - 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, - 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, - 0x08, 0x04, 0x10, 0x05, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x4a, 0x04, 0x08, 0x06, 0x10, 0x07, - 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x4a, 0x04, 0x08, 0x09, 0x10, 0x0a, 0x22, 0x85, 0x09, 0x0a, - 0x0c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x0a, - 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x54, 0x79, 0x70, - 0x65, 0x3a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x52, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, - 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x06, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x47, 0x0a, 0x06, 0x6a, 0x73, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x09, - 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x52, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, - 0x65, 0x12, 0x19, 0x0a, 0x04, 0x6c, 0x61, 0x7a, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x3a, - 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x04, 0x6c, 0x61, 0x7a, 0x79, 0x12, 0x2e, 0x0a, 0x0f, - 0x75, 0x6e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x6c, 0x61, 0x7a, 0x79, 0x18, - 0x0f, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0e, 0x75, 0x6e, - 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x4c, 0x61, 0x7a, 0x79, 0x12, 0x25, 0x0a, 0x0a, + 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x73, 0x18, 0x32, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, + 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, + 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, + 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x0a, 0x0c, 0x4f, 0x70, + 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x50, + 0x45, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x49, + 0x5a, 0x45, 0x10, 0x02, 0x12, 0x10, 0x0a, 0x0c, 0x4c, 0x49, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4e, + 0x54, 0x49, 0x4d, 0x45, 0x10, 0x03, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, + 0x02, 0x4a, 0x04, 0x08, 0x2a, 0x10, 0x2b, 0x4a, 0x04, 0x08, 0x26, 0x10, 0x27, 0x22, 0xf4, 0x03, + 0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x3c, 0x0a, 0x17, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x5f, + 0x77, 0x69, 0x72, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x14, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x53, 0x65, 0x74, 0x57, 0x69, 0x72, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x4c, + 0x0a, 0x1f, 0x6e, 0x6f, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x5f, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, + 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x1c, + 0x6e, 0x6f, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x6f, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, - 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x04, 0x77, 0x65, 0x61, 0x6b, 0x18, 0x0a, 0x20, 0x01, 0x28, - 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x04, 0x77, 0x65, 0x61, 0x6b, 0x12, 0x28, - 0x0a, 0x0c, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x72, 0x65, 0x64, 0x61, 0x63, 0x74, 0x18, 0x10, - 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0b, 0x64, 0x65, 0x62, - 0x75, 0x67, 0x52, 0x65, 0x64, 0x61, 0x63, 0x74, 0x12, 0x4b, 0x0a, 0x09, 0x72, 0x65, 0x74, 0x65, - 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, - 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x72, 0x65, 0x74, 0x65, - 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4a, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, - 0x12, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x54, 0x79, 0x70, 0x65, 0x42, 0x02, 0x18, 0x01, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x12, 0x48, 0x0a, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, 0x13, 0x20, 0x03, - 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, - 0x70, 0x65, 0x52, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, - 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, - 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x2f, 0x0a, 0x05, 0x43, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, - 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x4f, - 0x52, 0x44, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x50, - 0x49, 0x45, 0x43, 0x45, 0x10, 0x02, 0x22, 0x35, 0x0a, 0x06, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x00, 0x12, - 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0d, - 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x02, 0x22, 0x55, 0x0a, - 0x0f, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x15, 0x0a, 0x11, 0x52, 0x45, 0x54, 0x45, 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, - 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x52, 0x45, 0x54, 0x45, 0x4e, - 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x14, - 0x0a, 0x10, 0x52, 0x45, 0x54, 0x45, 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4f, 0x55, 0x52, - 0x43, 0x45, 0x10, 0x02, 0x22, 0x8c, 0x02, 0x0a, 0x10, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52, - 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, - 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x54, 0x41, 0x52, 0x47, - 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x4e, 0x53, 0x49, 0x4f, - 0x4e, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52, - 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, - 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x46, 0x49, 0x45, 0x4c, 0x44, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x54, 0x41, 0x52, - 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4f, 0x4e, 0x45, 0x4f, 0x46, 0x10, 0x05, - 0x12, 0x14, 0x0a, 0x10, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, - 0x45, 0x4e, 0x55, 0x4d, 0x10, 0x06, 0x12, 0x1a, 0x0a, 0x16, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, - 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x4e, 0x54, 0x52, 0x59, - 0x10, 0x07, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x10, 0x08, 0x12, 0x16, 0x0a, 0x12, 0x54, - 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, - 0x44, 0x10, 0x09, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, - 0x08, 0x04, 0x10, 0x05, 0x22, 0x73, 0x0a, 0x0c, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, - 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, - 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, - 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x98, 0x02, 0x0a, 0x0b, 0x45, 0x6e, - 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, - 0x6f, 0x77, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, - 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, - 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, - 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, - 0x64, 0x12, 0x56, 0x0a, 0x26, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f, - 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x66, 0x69, 0x65, 0x6c, - 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x22, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, - 0x64, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, - 0x43, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, + 0x74, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x56, 0x0a, 0x26, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6c, + 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, + 0x42, 0x02, 0x18, 0x01, 0x52, 0x22, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, + 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, + 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, + 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, + 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, + 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x4a, 0x04, 0x08, 0x05, + 0x10, 0x06, 0x4a, 0x04, 0x08, 0x06, 0x10, 0x07, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x4a, 0x04, + 0x08, 0x09, 0x10, 0x0a, 0x22, 0xad, 0x0a, 0x0a, 0x0c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x0a, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, + 0x47, 0x52, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x63, 0x6b, + 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, + 0x12, 0x47, 0x0a, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, + 0x4c, 0x52, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x04, 0x6c, 0x61, 0x7a, + 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x04, + 0x6c, 0x61, 0x7a, 0x79, 0x12, 0x2e, 0x0a, 0x0f, 0x75, 0x6e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, + 0x65, 0x64, 0x5f, 0x6c, 0x61, 0x7a, 0x79, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, + 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0e, 0x75, 0x6e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, + 0x4c, 0x61, 0x7a, 0x79, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, + 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, + 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x04, 0x77, + 0x65, 0x61, 0x6b, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, + 0x52, 0x04, 0x77, 0x65, 0x61, 0x6b, 0x12, 0x28, 0x0a, 0x0c, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, + 0x72, 0x65, 0x64, 0x61, 0x63, 0x74, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, + 0x6c, 0x73, 0x65, 0x52, 0x0b, 0x64, 0x65, 0x62, 0x75, 0x67, 0x52, 0x65, 0x64, 0x61, 0x63, 0x74, + 0x12, 0x4b, 0x0a, 0x09, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x11, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x09, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a, + 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, 0x13, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x2e, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x12, 0x57, 0x0a, 0x10, 0x65, 0x64, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x14, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x2c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52, + 0x0f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, + 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x15, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, + 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, - 0x08, 0x05, 0x10, 0x06, 0x22, 0x9e, 0x01, 0x0a, 0x10, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, - 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, - 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, - 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, - 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, - 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, - 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x9c, 0x01, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, - 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, - 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, - 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, - 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, - 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, - 0x80, 0x80, 0x80, 0x02, 0x22, 0xe0, 0x02, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, - 0x61, 0x74, 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, - 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x71, 0x0a, - 0x11, 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x6c, 0x65, 0x76, - 0x65, 0x6c, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, - 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x3a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, - 0x4f, 0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x52, 0x10, - 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, - 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, - 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, - 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x50, 0x0a, 0x10, 0x49, 0x64, - 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x17, - 0x0a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, - 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4e, 0x4f, 0x5f, 0x53, 0x49, - 0x44, 0x45, 0x5f, 0x45, 0x46, 0x46, 0x45, 0x43, 0x54, 0x53, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, - 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x54, 0x10, 0x02, 0x2a, 0x09, 0x08, 0xe8, - 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x9a, 0x03, 0x0a, 0x13, 0x55, 0x6e, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x41, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, + 0x69, 0x6f, 0x6e, 0x1a, 0x5a, 0x0a, 0x0e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, + 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x32, 0x0a, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x2f, 0x0a, 0x05, 0x43, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, + 0x4e, 0x47, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x4f, 0x52, 0x44, 0x10, 0x01, 0x12, 0x10, + 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x49, 0x45, 0x43, 0x45, 0x10, 0x02, + 0x22, 0x35, 0x0a, 0x06, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x53, + 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f, + 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, + 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x02, 0x22, 0x55, 0x0a, 0x0f, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x15, 0x0a, 0x11, 0x52, 0x45, + 0x54, 0x45, 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, + 0x00, 0x12, 0x15, 0x0a, 0x11, 0x52, 0x45, 0x54, 0x45, 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, + 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x45, 0x54, 0x45, + 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x10, 0x02, 0x22, 0x8c, + 0x02, 0x0a, 0x10, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, + 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x4c, 0x45, + 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x4e, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x41, 0x4e, 0x47, + 0x45, 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, + 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x45, 0x4c, + 0x44, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x4f, 0x4e, 0x45, 0x4f, 0x46, 0x10, 0x05, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x41, + 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x10, 0x06, + 0x12, 0x1a, 0x0a, 0x16, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x4e, 0x54, 0x52, 0x59, 0x10, 0x07, 0x12, 0x17, 0x0a, 0x13, + 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x45, 0x52, 0x56, + 0x49, 0x43, 0x45, 0x10, 0x08, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, 0x10, 0x09, 0x2a, 0x09, 0x08, + 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x4a, 0x04, + 0x08, 0x12, 0x10, 0x13, 0x22, 0xac, 0x01, 0x0a, 0x0c, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, + 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x69, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, - 0x12, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x70, 0x6f, 0x73, 0x69, 0x74, - 0x69, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x6e, - 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, - 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x6f, 0x75, - 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, - 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, - 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, - 0x27, 0x0a, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, - 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x4a, 0x0a, 0x08, 0x4e, 0x61, 0x6d, 0x65, - 0x50, 0x61, 0x72, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x70, 0x61, 0x72, - 0x74, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, - 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x02, 0x20, 0x02, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xa7, 0x02, 0x0a, 0x0e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, - 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x44, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xce, 0x01, - 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, - 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, - 0x74, 0x68, 0x12, 0x16, 0x0a, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, - 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x6c, 0x65, - 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, - 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, - 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x10, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, - 0x74, 0x73, 0x12, 0x3a, 0x0a, 0x19, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, - 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, - 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x17, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x44, 0x65, - 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xd0, - 0x02, 0x0a, 0x11, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, - 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x4d, 0x0a, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, - 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, - 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x1a, 0xeb, 0x01, 0x0a, 0x0a, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, + 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, + 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, + 0x80, 0x80, 0x02, 0x22, 0xd1, 0x02, 0x0a, 0x0b, 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x61, 0x6c, 0x69, + 0x61, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x41, + 0x6c, 0x69, 0x61, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, + 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, + 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x56, 0x0a, 0x26, 0x64, + 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, + 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, + 0x6c, 0x69, 0x63, 0x74, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, + 0x22, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x4c, 0x65, 0x67, 0x61, 0x63, + 0x79, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x6c, 0x69, + 0x63, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, + 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14, + 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, + 0x02, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x22, 0x81, 0x02, 0x0a, 0x10, 0x45, 0x6e, 0x75, 0x6d, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, + 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, + 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, + 0x74, 0x65, 0x64, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, + 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x28, 0x0a, 0x0c, + 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x72, 0x65, 0x64, 0x61, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0b, 0x64, 0x65, 0x62, 0x75, 0x67, + 0x52, 0x65, 0x64, 0x61, 0x63, 0x74, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, + 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, + 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0xd5, 0x01, 0x0a, 0x0e, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x37, + 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, + 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, + 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, + 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58, + 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, + 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, + 0x80, 0x80, 0x02, 0x22, 0x99, 0x03, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, + 0x74, 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, + 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x71, 0x0a, 0x11, + 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x6c, 0x65, 0x76, 0x65, + 0x6c, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, + 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x3a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, + 0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x52, 0x10, 0x69, + 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, + 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x23, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, + 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, + 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x22, 0x50, 0x0a, 0x10, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, + 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x17, 0x0a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, + 0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, + 0x13, 0x0a, 0x0f, 0x4e, 0x4f, 0x5f, 0x53, 0x49, 0x44, 0x45, 0x5f, 0x45, 0x46, 0x46, 0x45, 0x43, + 0x54, 0x53, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, + 0x4e, 0x54, 0x10, 0x02, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, + 0x9a, 0x03, 0x0a, 0x13, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, + 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, + 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x61, 0x6d, 0x65, + 0x50, 0x61, 0x72, 0x74, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, + 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x10, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, + 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x10, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, + 0x67, 0x61, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x1a, 0x4a, 0x0a, 0x08, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x12, 0x1b, 0x0a, 0x09, + 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, + 0x08, 0x6e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x73, 0x5f, + 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x02, 0x28, 0x08, 0x52, + 0x0b, 0x69, 0x73, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x8c, 0x0a, 0x0a, + 0x0a, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x12, 0x8b, 0x01, 0x0a, 0x0e, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, + 0x74, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x42, + 0x39, 0x88, 0x01, 0x01, 0x98, 0x01, 0x04, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x45, + 0x58, 0x50, 0x4c, 0x49, 0x43, 0x49, 0x54, 0x18, 0xe6, 0x07, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x49, + 0x4d, 0x50, 0x4c, 0x49, 0x43, 0x49, 0x54, 0x18, 0xe7, 0x07, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x45, + 0x58, 0x50, 0x4c, 0x49, 0x43, 0x49, 0x54, 0x18, 0xe8, 0x07, 0x52, 0x0d, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x66, 0x0a, 0x09, 0x65, 0x6e, 0x75, + 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, + 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x54, 0x79, + 0x70, 0x65, 0x42, 0x23, 0x88, 0x01, 0x01, 0x98, 0x01, 0x06, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x0b, + 0x12, 0x06, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0x18, 0xe6, 0x07, 0xa2, 0x01, 0x09, 0x12, 0x04, + 0x4f, 0x50, 0x45, 0x4e, 0x18, 0xe7, 0x07, 0x52, 0x08, 0x65, 0x6e, 0x75, 0x6d, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x92, 0x01, 0x0a, 0x17, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, + 0x2e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, + 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x42, 0x27, 0x88, 0x01, 0x01, 0x98, 0x01, 0x04, 0x98, 0x01, + 0x01, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x45, 0x58, 0x50, 0x41, 0x4e, 0x44, 0x45, 0x44, 0x18, 0xe6, + 0x07, 0xa2, 0x01, 0x0b, 0x12, 0x06, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x44, 0x18, 0xe7, 0x07, 0x52, + 0x15, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, + 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x78, 0x0a, 0x0f, 0x75, 0x74, 0x66, 0x38, 0x5f, 0x76, + 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x2a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x55, 0x74, 0x66, + 0x38, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x23, 0x88, 0x01, 0x01, + 0x98, 0x01, 0x04, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x09, 0x12, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x18, + 0xe6, 0x07, 0xa2, 0x01, 0x0b, 0x12, 0x06, 0x56, 0x45, 0x52, 0x49, 0x46, 0x59, 0x18, 0xe7, 0x07, + 0x52, 0x0e, 0x75, 0x74, 0x66, 0x38, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x78, 0x0a, 0x10, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x65, 0x6e, 0x63, 0x6f, + 0x64, 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, + 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x42, 0x20, 0x88, 0x01, 0x01, 0x98, 0x01, 0x04, 0x98, + 0x01, 0x01, 0xa2, 0x01, 0x14, 0x12, 0x0f, 0x4c, 0x45, 0x4e, 0x47, 0x54, 0x48, 0x5f, 0x50, 0x52, + 0x45, 0x46, 0x49, 0x58, 0x45, 0x44, 0x18, 0xe6, 0x07, 0x52, 0x0f, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x7c, 0x0a, 0x0b, 0x6a, 0x73, + 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x26, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x4a, 0x73, 0x6f, + 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x42, 0x33, 0x88, 0x01, 0x01, 0x98, 0x01, 0x03, 0x98, + 0x01, 0x06, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x17, 0x12, 0x12, 0x4c, 0x45, 0x47, 0x41, 0x43, 0x59, + 0x5f, 0x42, 0x45, 0x53, 0x54, 0x5f, 0x45, 0x46, 0x46, 0x4f, 0x52, 0x54, 0x18, 0xe6, 0x07, 0xa2, + 0x01, 0x0a, 0x12, 0x05, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x18, 0xe7, 0x07, 0x52, 0x0a, 0x6a, 0x73, + 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, 0x5c, 0x0a, 0x0d, 0x46, 0x69, 0x65, 0x6c, + 0x64, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x46, 0x49, 0x45, + 0x4c, 0x44, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x43, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, + 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x45, 0x58, 0x50, 0x4c, 0x49, 0x43, 0x49, + 0x54, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x43, 0x49, 0x54, 0x10, + 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x45, 0x47, 0x41, 0x43, 0x59, 0x5f, 0x52, 0x45, 0x51, 0x55, + 0x49, 0x52, 0x45, 0x44, 0x10, 0x03, 0x22, 0x37, 0x0a, 0x08, 0x45, 0x6e, 0x75, 0x6d, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x4f, 0x50, 0x45, + 0x4e, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0x10, 0x02, 0x22, + 0x56, 0x0a, 0x15, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x23, 0x0a, 0x1f, 0x52, 0x45, 0x50, 0x45, + 0x41, 0x54, 0x45, 0x44, 0x5f, 0x46, 0x49, 0x45, 0x4c, 0x44, 0x5f, 0x45, 0x4e, 0x43, 0x4f, 0x44, + 0x49, 0x4e, 0x47, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, + 0x06, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x45, 0x58, 0x50, + 0x41, 0x4e, 0x44, 0x45, 0x44, 0x10, 0x02, 0x22, 0x43, 0x0a, 0x0e, 0x55, 0x74, 0x66, 0x38, 0x56, + 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x17, 0x55, 0x54, 0x46, + 0x38, 0x5f, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, + 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x56, 0x45, 0x52, 0x49, 0x46, 0x59, + 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x03, 0x22, 0x53, 0x0a, 0x0f, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, + 0x1c, 0x0a, 0x18, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f, 0x45, 0x4e, 0x43, 0x4f, 0x44, + 0x49, 0x4e, 0x47, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, + 0x0f, 0x4c, 0x45, 0x4e, 0x47, 0x54, 0x48, 0x5f, 0x50, 0x52, 0x45, 0x46, 0x49, 0x58, 0x45, 0x44, + 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x45, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x10, + 0x02, 0x22, 0x48, 0x0a, 0x0a, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, + 0x17, 0x0a, 0x13, 0x4a, 0x53, 0x4f, 0x4e, 0x5f, 0x46, 0x4f, 0x52, 0x4d, 0x41, 0x54, 0x5f, 0x55, + 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, 0x4c, 0x4f, + 0x57, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4c, 0x45, 0x47, 0x41, 0x43, 0x59, 0x5f, 0x42, 0x45, + 0x53, 0x54, 0x5f, 0x45, 0x46, 0x46, 0x4f, 0x52, 0x54, 0x10, 0x02, 0x2a, 0x06, 0x08, 0xe8, 0x07, + 0x10, 0xe9, 0x07, 0x2a, 0x06, 0x08, 0xe9, 0x07, 0x10, 0xea, 0x07, 0x2a, 0x06, 0x08, 0xea, 0x07, + 0x10, 0xeb, 0x07, 0x2a, 0x06, 0x08, 0x8b, 0x4e, 0x10, 0x90, 0x4e, 0x2a, 0x06, 0x08, 0x90, 0x4e, + 0x10, 0x91, 0x4e, 0x4a, 0x06, 0x08, 0xe7, 0x07, 0x10, 0xe8, 0x07, 0x22, 0xfe, 0x02, 0x0a, 0x12, + 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, + 0x74, 0x73, 0x12, 0x58, 0x0a, 0x08, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, + 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x53, 0x65, 0x74, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75, + 0x6c, 0x74, 0x52, 0x08, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x41, 0x0a, 0x0f, + 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x5f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x0e, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x41, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x5f, 0x65, 0x64, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x45, 0x64, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x1a, 0x87, 0x01, 0x0a, 0x18, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, + 0x74, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, + 0x32, 0x0a, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x65, 0x64, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, + 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x22, 0xa7, 0x02, 0x0a, + 0x0e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, + 0x44, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x28, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, + 0x66, 0x6f, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x6c, 0x6f, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xce, 0x01, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, - 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, - 0x65, 0x67, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x62, 0x65, 0x67, 0x69, - 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, - 0x65, 0x6e, 0x64, 0x12, 0x52, 0x0a, 0x08, 0x73, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x36, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, - 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x52, 0x08, 0x73, - 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x22, 0x28, 0x0a, 0x08, 0x53, 0x65, 0x6d, 0x61, 0x6e, - 0x74, 0x69, 0x63, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x07, 0x0a, - 0x03, 0x53, 0x45, 0x54, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, 0x49, 0x41, 0x53, 0x10, - 0x02, 0x42, 0x7e, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x48, 0x01, 0x5a, 0x2d, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x64, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2, 0x02, - 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1a, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x52, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, - 0x6e, + 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x04, 0x73, 0x70, + 0x61, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x73, 0x70, + 0x61, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, + 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x65, + 0x61, 0x64, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2b, 0x0a, + 0x11, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, + 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, + 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x3a, 0x0a, 0x19, 0x6c, 0x65, + 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x63, + 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x17, 0x6c, + 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x43, 0x6f, + 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xd0, 0x02, 0x0a, 0x11, 0x47, 0x65, 0x6e, 0x65, 0x72, + 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x4d, 0x0a, 0x0a, + 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, + 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xeb, 0x01, 0x0a, 0x0a, + 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, + 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, + 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, + 0x69, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x05, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x52, 0x0a, 0x08, 0x73, + 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x36, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, + 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6d, + 0x61, 0x6e, 0x74, 0x69, 0x63, 0x52, 0x08, 0x73, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x22, + 0x28, 0x0a, 0x08, 0x53, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x12, 0x08, 0x0a, 0x04, 0x4e, + 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x45, 0x54, 0x10, 0x01, 0x12, 0x09, + 0x0a, 0x05, 0x41, 0x4c, 0x49, 0x41, 0x53, 0x10, 0x02, 0x2a, 0x92, 0x02, 0x0a, 0x07, 0x45, 0x64, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, + 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0e, 0x45, 0x44, + 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x32, 0x10, 0xe6, 0x07, 0x12, + 0x13, 0x0a, 0x0e, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, + 0x33, 0x10, 0xe7, 0x07, 0x12, 0x11, 0x0a, 0x0c, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x32, 0x30, 0x32, 0x33, 0x10, 0xe8, 0x07, 0x12, 0x11, 0x0a, 0x0c, 0x45, 0x44, 0x49, 0x54, 0x49, + 0x4f, 0x4e, 0x5f, 0x32, 0x30, 0x32, 0x34, 0x10, 0xe9, 0x07, 0x12, 0x17, 0x0a, 0x13, 0x45, 0x44, + 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x31, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x5f, 0x4f, 0x4e, 0x4c, + 0x59, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x32, + 0x5f, 0x54, 0x45, 0x53, 0x54, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x02, 0x12, 0x1d, 0x0a, 0x17, + 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x39, 0x39, 0x39, 0x39, 0x37, 0x5f, 0x54, 0x45, + 0x53, 0x54, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x9d, 0x8d, 0x06, 0x12, 0x1d, 0x0a, 0x17, 0x45, + 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x39, 0x39, 0x39, 0x39, 0x38, 0x5f, 0x54, 0x45, 0x53, + 0x54, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x9e, 0x8d, 0x06, 0x12, 0x1d, 0x0a, 0x17, 0x45, 0x44, + 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x39, 0x39, 0x39, 0x39, 0x39, 0x5f, 0x54, 0x45, 0x53, 0x54, + 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x9f, 0x8d, 0x06, 0x12, 0x13, 0x0a, 0x0b, 0x45, 0x44, 0x49, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x41, 0x58, 0x10, 0xff, 0xff, 0xff, 0xff, 0x07, 0x42, 0x7e, + 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, + 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x48, 0x01, 0x5a, 0x2d, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x64, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, + 0x42, 0xaa, 0x02, 0x1a, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x52, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, } var ( @@ -4123,103 +5083,136 @@ func file_google_protobuf_descriptor_proto_rawDescGZIP() []byte { return file_google_protobuf_descriptor_proto_rawDescData } -var file_google_protobuf_descriptor_proto_enumTypes = make([]protoimpl.EnumInfo, 10) -var file_google_protobuf_descriptor_proto_msgTypes = make([]protoimpl.MessageInfo, 28) +var file_google_protobuf_descriptor_proto_enumTypes = make([]protoimpl.EnumInfo, 17) +var file_google_protobuf_descriptor_proto_msgTypes = make([]protoimpl.MessageInfo, 32) var file_google_protobuf_descriptor_proto_goTypes = []interface{}{ - (ExtensionRangeOptions_VerificationState)(0), // 0: google.protobuf.ExtensionRangeOptions.VerificationState - (FieldDescriptorProto_Type)(0), // 1: google.protobuf.FieldDescriptorProto.Type - (FieldDescriptorProto_Label)(0), // 2: google.protobuf.FieldDescriptorProto.Label - (FileOptions_OptimizeMode)(0), // 3: google.protobuf.FileOptions.OptimizeMode - (FieldOptions_CType)(0), // 4: google.protobuf.FieldOptions.CType - (FieldOptions_JSType)(0), // 5: google.protobuf.FieldOptions.JSType - (FieldOptions_OptionRetention)(0), // 6: google.protobuf.FieldOptions.OptionRetention - (FieldOptions_OptionTargetType)(0), // 7: google.protobuf.FieldOptions.OptionTargetType - (MethodOptions_IdempotencyLevel)(0), // 8: google.protobuf.MethodOptions.IdempotencyLevel - (GeneratedCodeInfo_Annotation_Semantic)(0), // 9: google.protobuf.GeneratedCodeInfo.Annotation.Semantic - (*FileDescriptorSet)(nil), // 10: google.protobuf.FileDescriptorSet - (*FileDescriptorProto)(nil), // 11: google.protobuf.FileDescriptorProto - (*DescriptorProto)(nil), // 12: google.protobuf.DescriptorProto - (*ExtensionRangeOptions)(nil), // 13: google.protobuf.ExtensionRangeOptions - (*FieldDescriptorProto)(nil), // 14: google.protobuf.FieldDescriptorProto - (*OneofDescriptorProto)(nil), // 15: google.protobuf.OneofDescriptorProto - (*EnumDescriptorProto)(nil), // 16: google.protobuf.EnumDescriptorProto - (*EnumValueDescriptorProto)(nil), // 17: google.protobuf.EnumValueDescriptorProto - (*ServiceDescriptorProto)(nil), // 18: google.protobuf.ServiceDescriptorProto - (*MethodDescriptorProto)(nil), // 19: google.protobuf.MethodDescriptorProto - (*FileOptions)(nil), // 20: google.protobuf.FileOptions - (*MessageOptions)(nil), // 21: google.protobuf.MessageOptions - (*FieldOptions)(nil), // 22: google.protobuf.FieldOptions - (*OneofOptions)(nil), // 23: google.protobuf.OneofOptions - (*EnumOptions)(nil), // 24: google.protobuf.EnumOptions - (*EnumValueOptions)(nil), // 25: google.protobuf.EnumValueOptions - (*ServiceOptions)(nil), // 26: google.protobuf.ServiceOptions - (*MethodOptions)(nil), // 27: google.protobuf.MethodOptions - (*UninterpretedOption)(nil), // 28: google.protobuf.UninterpretedOption - (*SourceCodeInfo)(nil), // 29: google.protobuf.SourceCodeInfo - (*GeneratedCodeInfo)(nil), // 30: google.protobuf.GeneratedCodeInfo - (*DescriptorProto_ExtensionRange)(nil), // 31: google.protobuf.DescriptorProto.ExtensionRange - (*DescriptorProto_ReservedRange)(nil), // 32: google.protobuf.DescriptorProto.ReservedRange - (*ExtensionRangeOptions_Declaration)(nil), // 33: google.protobuf.ExtensionRangeOptions.Declaration - (*EnumDescriptorProto_EnumReservedRange)(nil), // 34: google.protobuf.EnumDescriptorProto.EnumReservedRange - (*UninterpretedOption_NamePart)(nil), // 35: google.protobuf.UninterpretedOption.NamePart - (*SourceCodeInfo_Location)(nil), // 36: google.protobuf.SourceCodeInfo.Location - (*GeneratedCodeInfo_Annotation)(nil), // 37: google.protobuf.GeneratedCodeInfo.Annotation + (Edition)(0), // 0: google.protobuf.Edition + (ExtensionRangeOptions_VerificationState)(0), // 1: google.protobuf.ExtensionRangeOptions.VerificationState + (FieldDescriptorProto_Type)(0), // 2: google.protobuf.FieldDescriptorProto.Type + (FieldDescriptorProto_Label)(0), // 3: google.protobuf.FieldDescriptorProto.Label + (FileOptions_OptimizeMode)(0), // 4: google.protobuf.FileOptions.OptimizeMode + (FieldOptions_CType)(0), // 5: google.protobuf.FieldOptions.CType + (FieldOptions_JSType)(0), // 6: google.protobuf.FieldOptions.JSType + (FieldOptions_OptionRetention)(0), // 7: google.protobuf.FieldOptions.OptionRetention + (FieldOptions_OptionTargetType)(0), // 8: google.protobuf.FieldOptions.OptionTargetType + (MethodOptions_IdempotencyLevel)(0), // 9: google.protobuf.MethodOptions.IdempotencyLevel + (FeatureSet_FieldPresence)(0), // 10: google.protobuf.FeatureSet.FieldPresence + (FeatureSet_EnumType)(0), // 11: google.protobuf.FeatureSet.EnumType + (FeatureSet_RepeatedFieldEncoding)(0), // 12: google.protobuf.FeatureSet.RepeatedFieldEncoding + (FeatureSet_Utf8Validation)(0), // 13: google.protobuf.FeatureSet.Utf8Validation + (FeatureSet_MessageEncoding)(0), // 14: google.protobuf.FeatureSet.MessageEncoding + (FeatureSet_JsonFormat)(0), // 15: google.protobuf.FeatureSet.JsonFormat + (GeneratedCodeInfo_Annotation_Semantic)(0), // 16: google.protobuf.GeneratedCodeInfo.Annotation.Semantic + (*FileDescriptorSet)(nil), // 17: google.protobuf.FileDescriptorSet + (*FileDescriptorProto)(nil), // 18: google.protobuf.FileDescriptorProto + (*DescriptorProto)(nil), // 19: google.protobuf.DescriptorProto + (*ExtensionRangeOptions)(nil), // 20: google.protobuf.ExtensionRangeOptions + (*FieldDescriptorProto)(nil), // 21: google.protobuf.FieldDescriptorProto + (*OneofDescriptorProto)(nil), // 22: google.protobuf.OneofDescriptorProto + (*EnumDescriptorProto)(nil), // 23: google.protobuf.EnumDescriptorProto + (*EnumValueDescriptorProto)(nil), // 24: google.protobuf.EnumValueDescriptorProto + (*ServiceDescriptorProto)(nil), // 25: google.protobuf.ServiceDescriptorProto + (*MethodDescriptorProto)(nil), // 26: google.protobuf.MethodDescriptorProto + (*FileOptions)(nil), // 27: google.protobuf.FileOptions + (*MessageOptions)(nil), // 28: google.protobuf.MessageOptions + (*FieldOptions)(nil), // 29: google.protobuf.FieldOptions + (*OneofOptions)(nil), // 30: google.protobuf.OneofOptions + (*EnumOptions)(nil), // 31: google.protobuf.EnumOptions + (*EnumValueOptions)(nil), // 32: google.protobuf.EnumValueOptions + (*ServiceOptions)(nil), // 33: google.protobuf.ServiceOptions + (*MethodOptions)(nil), // 34: google.protobuf.MethodOptions + (*UninterpretedOption)(nil), // 35: google.protobuf.UninterpretedOption + (*FeatureSet)(nil), // 36: google.protobuf.FeatureSet + (*FeatureSetDefaults)(nil), // 37: google.protobuf.FeatureSetDefaults + (*SourceCodeInfo)(nil), // 38: google.protobuf.SourceCodeInfo + (*GeneratedCodeInfo)(nil), // 39: google.protobuf.GeneratedCodeInfo + (*DescriptorProto_ExtensionRange)(nil), // 40: google.protobuf.DescriptorProto.ExtensionRange + (*DescriptorProto_ReservedRange)(nil), // 41: google.protobuf.DescriptorProto.ReservedRange + (*ExtensionRangeOptions_Declaration)(nil), // 42: google.protobuf.ExtensionRangeOptions.Declaration + (*EnumDescriptorProto_EnumReservedRange)(nil), // 43: google.protobuf.EnumDescriptorProto.EnumReservedRange + (*FieldOptions_EditionDefault)(nil), // 44: google.protobuf.FieldOptions.EditionDefault + (*UninterpretedOption_NamePart)(nil), // 45: google.protobuf.UninterpretedOption.NamePart + (*FeatureSetDefaults_FeatureSetEditionDefault)(nil), // 46: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + (*SourceCodeInfo_Location)(nil), // 47: google.protobuf.SourceCodeInfo.Location + (*GeneratedCodeInfo_Annotation)(nil), // 48: google.protobuf.GeneratedCodeInfo.Annotation } var file_google_protobuf_descriptor_proto_depIdxs = []int32{ - 11, // 0: google.protobuf.FileDescriptorSet.file:type_name -> google.protobuf.FileDescriptorProto - 12, // 1: google.protobuf.FileDescriptorProto.message_type:type_name -> google.protobuf.DescriptorProto - 16, // 2: google.protobuf.FileDescriptorProto.enum_type:type_name -> google.protobuf.EnumDescriptorProto - 18, // 3: google.protobuf.FileDescriptorProto.service:type_name -> google.protobuf.ServiceDescriptorProto - 14, // 4: google.protobuf.FileDescriptorProto.extension:type_name -> google.protobuf.FieldDescriptorProto - 20, // 5: google.protobuf.FileDescriptorProto.options:type_name -> google.protobuf.FileOptions - 29, // 6: google.protobuf.FileDescriptorProto.source_code_info:type_name -> google.protobuf.SourceCodeInfo - 14, // 7: google.protobuf.DescriptorProto.field:type_name -> google.protobuf.FieldDescriptorProto - 14, // 8: google.protobuf.DescriptorProto.extension:type_name -> google.protobuf.FieldDescriptorProto - 12, // 9: google.protobuf.DescriptorProto.nested_type:type_name -> google.protobuf.DescriptorProto - 16, // 10: google.protobuf.DescriptorProto.enum_type:type_name -> google.protobuf.EnumDescriptorProto - 31, // 11: google.protobuf.DescriptorProto.extension_range:type_name -> google.protobuf.DescriptorProto.ExtensionRange - 15, // 12: google.protobuf.DescriptorProto.oneof_decl:type_name -> google.protobuf.OneofDescriptorProto - 21, // 13: google.protobuf.DescriptorProto.options:type_name -> google.protobuf.MessageOptions - 32, // 14: google.protobuf.DescriptorProto.reserved_range:type_name -> google.protobuf.DescriptorProto.ReservedRange - 28, // 15: google.protobuf.ExtensionRangeOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 33, // 16: google.protobuf.ExtensionRangeOptions.declaration:type_name -> google.protobuf.ExtensionRangeOptions.Declaration - 0, // 17: google.protobuf.ExtensionRangeOptions.verification:type_name -> google.protobuf.ExtensionRangeOptions.VerificationState - 2, // 18: google.protobuf.FieldDescriptorProto.label:type_name -> google.protobuf.FieldDescriptorProto.Label - 1, // 19: google.protobuf.FieldDescriptorProto.type:type_name -> google.protobuf.FieldDescriptorProto.Type - 22, // 20: google.protobuf.FieldDescriptorProto.options:type_name -> google.protobuf.FieldOptions - 23, // 21: google.protobuf.OneofDescriptorProto.options:type_name -> google.protobuf.OneofOptions - 17, // 22: google.protobuf.EnumDescriptorProto.value:type_name -> google.protobuf.EnumValueDescriptorProto - 24, // 23: google.protobuf.EnumDescriptorProto.options:type_name -> google.protobuf.EnumOptions - 34, // 24: google.protobuf.EnumDescriptorProto.reserved_range:type_name -> google.protobuf.EnumDescriptorProto.EnumReservedRange - 25, // 25: google.protobuf.EnumValueDescriptorProto.options:type_name -> google.protobuf.EnumValueOptions - 19, // 26: google.protobuf.ServiceDescriptorProto.method:type_name -> google.protobuf.MethodDescriptorProto - 26, // 27: google.protobuf.ServiceDescriptorProto.options:type_name -> google.protobuf.ServiceOptions - 27, // 28: google.protobuf.MethodDescriptorProto.options:type_name -> google.protobuf.MethodOptions - 3, // 29: google.protobuf.FileOptions.optimize_for:type_name -> google.protobuf.FileOptions.OptimizeMode - 28, // 30: google.protobuf.FileOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 28, // 31: google.protobuf.MessageOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 4, // 32: google.protobuf.FieldOptions.ctype:type_name -> google.protobuf.FieldOptions.CType - 5, // 33: google.protobuf.FieldOptions.jstype:type_name -> google.protobuf.FieldOptions.JSType - 6, // 34: google.protobuf.FieldOptions.retention:type_name -> google.protobuf.FieldOptions.OptionRetention - 7, // 35: google.protobuf.FieldOptions.target:type_name -> google.protobuf.FieldOptions.OptionTargetType - 7, // 36: google.protobuf.FieldOptions.targets:type_name -> google.protobuf.FieldOptions.OptionTargetType - 28, // 37: google.protobuf.FieldOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 28, // 38: google.protobuf.OneofOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 28, // 39: google.protobuf.EnumOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 28, // 40: google.protobuf.EnumValueOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 28, // 41: google.protobuf.ServiceOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 8, // 42: google.protobuf.MethodOptions.idempotency_level:type_name -> google.protobuf.MethodOptions.IdempotencyLevel - 28, // 43: google.protobuf.MethodOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 35, // 44: google.protobuf.UninterpretedOption.name:type_name -> google.protobuf.UninterpretedOption.NamePart - 36, // 45: google.protobuf.SourceCodeInfo.location:type_name -> google.protobuf.SourceCodeInfo.Location - 37, // 46: google.protobuf.GeneratedCodeInfo.annotation:type_name -> google.protobuf.GeneratedCodeInfo.Annotation - 13, // 47: google.protobuf.DescriptorProto.ExtensionRange.options:type_name -> google.protobuf.ExtensionRangeOptions - 9, // 48: google.protobuf.GeneratedCodeInfo.Annotation.semantic:type_name -> google.protobuf.GeneratedCodeInfo.Annotation.Semantic - 49, // [49:49] is the sub-list for method output_type - 49, // [49:49] is the sub-list for method input_type - 49, // [49:49] is the sub-list for extension type_name - 49, // [49:49] is the sub-list for extension extendee - 0, // [0:49] is the sub-list for field type_name + 18, // 0: google.protobuf.FileDescriptorSet.file:type_name -> google.protobuf.FileDescriptorProto + 19, // 1: google.protobuf.FileDescriptorProto.message_type:type_name -> google.protobuf.DescriptorProto + 23, // 2: google.protobuf.FileDescriptorProto.enum_type:type_name -> google.protobuf.EnumDescriptorProto + 25, // 3: google.protobuf.FileDescriptorProto.service:type_name -> google.protobuf.ServiceDescriptorProto + 21, // 4: google.protobuf.FileDescriptorProto.extension:type_name -> google.protobuf.FieldDescriptorProto + 27, // 5: google.protobuf.FileDescriptorProto.options:type_name -> google.protobuf.FileOptions + 38, // 6: google.protobuf.FileDescriptorProto.source_code_info:type_name -> google.protobuf.SourceCodeInfo + 0, // 7: google.protobuf.FileDescriptorProto.edition:type_name -> google.protobuf.Edition + 21, // 8: google.protobuf.DescriptorProto.field:type_name -> google.protobuf.FieldDescriptorProto + 21, // 9: google.protobuf.DescriptorProto.extension:type_name -> google.protobuf.FieldDescriptorProto + 19, // 10: google.protobuf.DescriptorProto.nested_type:type_name -> google.protobuf.DescriptorProto + 23, // 11: google.protobuf.DescriptorProto.enum_type:type_name -> google.protobuf.EnumDescriptorProto + 40, // 12: google.protobuf.DescriptorProto.extension_range:type_name -> google.protobuf.DescriptorProto.ExtensionRange + 22, // 13: google.protobuf.DescriptorProto.oneof_decl:type_name -> google.protobuf.OneofDescriptorProto + 28, // 14: google.protobuf.DescriptorProto.options:type_name -> google.protobuf.MessageOptions + 41, // 15: google.protobuf.DescriptorProto.reserved_range:type_name -> google.protobuf.DescriptorProto.ReservedRange + 35, // 16: google.protobuf.ExtensionRangeOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 42, // 17: google.protobuf.ExtensionRangeOptions.declaration:type_name -> google.protobuf.ExtensionRangeOptions.Declaration + 36, // 18: google.protobuf.ExtensionRangeOptions.features:type_name -> google.protobuf.FeatureSet + 1, // 19: google.protobuf.ExtensionRangeOptions.verification:type_name -> google.protobuf.ExtensionRangeOptions.VerificationState + 3, // 20: google.protobuf.FieldDescriptorProto.label:type_name -> google.protobuf.FieldDescriptorProto.Label + 2, // 21: google.protobuf.FieldDescriptorProto.type:type_name -> google.protobuf.FieldDescriptorProto.Type + 29, // 22: google.protobuf.FieldDescriptorProto.options:type_name -> google.protobuf.FieldOptions + 30, // 23: google.protobuf.OneofDescriptorProto.options:type_name -> google.protobuf.OneofOptions + 24, // 24: google.protobuf.EnumDescriptorProto.value:type_name -> google.protobuf.EnumValueDescriptorProto + 31, // 25: google.protobuf.EnumDescriptorProto.options:type_name -> google.protobuf.EnumOptions + 43, // 26: google.protobuf.EnumDescriptorProto.reserved_range:type_name -> google.protobuf.EnumDescriptorProto.EnumReservedRange + 32, // 27: google.protobuf.EnumValueDescriptorProto.options:type_name -> google.protobuf.EnumValueOptions + 26, // 28: google.protobuf.ServiceDescriptorProto.method:type_name -> google.protobuf.MethodDescriptorProto + 33, // 29: google.protobuf.ServiceDescriptorProto.options:type_name -> google.protobuf.ServiceOptions + 34, // 30: google.protobuf.MethodDescriptorProto.options:type_name -> google.protobuf.MethodOptions + 4, // 31: google.protobuf.FileOptions.optimize_for:type_name -> google.protobuf.FileOptions.OptimizeMode + 36, // 32: google.protobuf.FileOptions.features:type_name -> google.protobuf.FeatureSet + 35, // 33: google.protobuf.FileOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 36, // 34: google.protobuf.MessageOptions.features:type_name -> google.protobuf.FeatureSet + 35, // 35: google.protobuf.MessageOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 5, // 36: google.protobuf.FieldOptions.ctype:type_name -> google.protobuf.FieldOptions.CType + 6, // 37: google.protobuf.FieldOptions.jstype:type_name -> google.protobuf.FieldOptions.JSType + 7, // 38: google.protobuf.FieldOptions.retention:type_name -> google.protobuf.FieldOptions.OptionRetention + 8, // 39: google.protobuf.FieldOptions.targets:type_name -> google.protobuf.FieldOptions.OptionTargetType + 44, // 40: google.protobuf.FieldOptions.edition_defaults:type_name -> google.protobuf.FieldOptions.EditionDefault + 36, // 41: google.protobuf.FieldOptions.features:type_name -> google.protobuf.FeatureSet + 35, // 42: google.protobuf.FieldOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 36, // 43: google.protobuf.OneofOptions.features:type_name -> google.protobuf.FeatureSet + 35, // 44: google.protobuf.OneofOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 36, // 45: google.protobuf.EnumOptions.features:type_name -> google.protobuf.FeatureSet + 35, // 46: google.protobuf.EnumOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 36, // 47: google.protobuf.EnumValueOptions.features:type_name -> google.protobuf.FeatureSet + 35, // 48: google.protobuf.EnumValueOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 36, // 49: google.protobuf.ServiceOptions.features:type_name -> google.protobuf.FeatureSet + 35, // 50: google.protobuf.ServiceOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 9, // 51: google.protobuf.MethodOptions.idempotency_level:type_name -> google.protobuf.MethodOptions.IdempotencyLevel + 36, // 52: google.protobuf.MethodOptions.features:type_name -> google.protobuf.FeatureSet + 35, // 53: google.protobuf.MethodOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 45, // 54: google.protobuf.UninterpretedOption.name:type_name -> google.protobuf.UninterpretedOption.NamePart + 10, // 55: google.protobuf.FeatureSet.field_presence:type_name -> google.protobuf.FeatureSet.FieldPresence + 11, // 56: google.protobuf.FeatureSet.enum_type:type_name -> google.protobuf.FeatureSet.EnumType + 12, // 57: google.protobuf.FeatureSet.repeated_field_encoding:type_name -> google.protobuf.FeatureSet.RepeatedFieldEncoding + 13, // 58: google.protobuf.FeatureSet.utf8_validation:type_name -> google.protobuf.FeatureSet.Utf8Validation + 14, // 59: google.protobuf.FeatureSet.message_encoding:type_name -> google.protobuf.FeatureSet.MessageEncoding + 15, // 60: google.protobuf.FeatureSet.json_format:type_name -> google.protobuf.FeatureSet.JsonFormat + 46, // 61: google.protobuf.FeatureSetDefaults.defaults:type_name -> google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + 0, // 62: google.protobuf.FeatureSetDefaults.minimum_edition:type_name -> google.protobuf.Edition + 0, // 63: google.protobuf.FeatureSetDefaults.maximum_edition:type_name -> google.protobuf.Edition + 47, // 64: google.protobuf.SourceCodeInfo.location:type_name -> google.protobuf.SourceCodeInfo.Location + 48, // 65: google.protobuf.GeneratedCodeInfo.annotation:type_name -> google.protobuf.GeneratedCodeInfo.Annotation + 20, // 66: google.protobuf.DescriptorProto.ExtensionRange.options:type_name -> google.protobuf.ExtensionRangeOptions + 0, // 67: google.protobuf.FieldOptions.EditionDefault.edition:type_name -> google.protobuf.Edition + 0, // 68: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.edition:type_name -> google.protobuf.Edition + 36, // 69: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features:type_name -> google.protobuf.FeatureSet + 16, // 70: google.protobuf.GeneratedCodeInfo.Annotation.semantic:type_name -> google.protobuf.GeneratedCodeInfo.Annotation.Semantic + 71, // [71:71] is the sub-list for method output_type + 71, // [71:71] is the sub-list for method input_type + 71, // [71:71] is the sub-list for extension type_name + 71, // [71:71] is the sub-list for extension extendee + 0, // [0:71] is the sub-list for field type_name } func init() { file_google_protobuf_descriptor_proto_init() } @@ -4475,19 +5468,21 @@ func file_google_protobuf_descriptor_proto_init() { } } file_google_protobuf_descriptor_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SourceCodeInfo); i { + switch v := v.(*FeatureSet); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields + case 3: + return &v.extensionFields default: return nil } } file_google_protobuf_descriptor_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GeneratedCodeInfo); i { + switch v := v.(*FeatureSetDefaults); i { case 0: return &v.state case 1: @@ -4499,7 +5494,7 @@ func file_google_protobuf_descriptor_proto_init() { } } file_google_protobuf_descriptor_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DescriptorProto_ExtensionRange); i { + switch v := v.(*SourceCodeInfo); i { case 0: return &v.state case 1: @@ -4511,7 +5506,7 @@ func file_google_protobuf_descriptor_proto_init() { } } file_google_protobuf_descriptor_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DescriptorProto_ReservedRange); i { + switch v := v.(*GeneratedCodeInfo); i { case 0: return &v.state case 1: @@ -4523,7 +5518,7 @@ func file_google_protobuf_descriptor_proto_init() { } } file_google_protobuf_descriptor_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExtensionRangeOptions_Declaration); i { + switch v := v.(*DescriptorProto_ExtensionRange); i { case 0: return &v.state case 1: @@ -4535,7 +5530,7 @@ func file_google_protobuf_descriptor_proto_init() { } } file_google_protobuf_descriptor_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EnumDescriptorProto_EnumReservedRange); i { + switch v := v.(*DescriptorProto_ReservedRange); i { case 0: return &v.state case 1: @@ -4547,7 +5542,7 @@ func file_google_protobuf_descriptor_proto_init() { } } file_google_protobuf_descriptor_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UninterpretedOption_NamePart); i { + switch v := v.(*ExtensionRangeOptions_Declaration); i { case 0: return &v.state case 1: @@ -4559,7 +5554,7 @@ func file_google_protobuf_descriptor_proto_init() { } } file_google_protobuf_descriptor_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SourceCodeInfo_Location); i { + switch v := v.(*EnumDescriptorProto_EnumReservedRange); i { case 0: return &v.state case 1: @@ -4571,6 +5566,54 @@ func file_google_protobuf_descriptor_proto_init() { } } file_google_protobuf_descriptor_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FieldOptions_EditionDefault); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UninterpretedOption_NamePart); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FeatureSetDefaults_FeatureSetEditionDefault); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SourceCodeInfo_Location); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GeneratedCodeInfo_Annotation); i { case 0: return &v.state @@ -4588,8 +5631,8 @@ func file_google_protobuf_descriptor_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_google_protobuf_descriptor_proto_rawDesc, - NumEnums: 10, - NumMessages: 28, + NumEnums: 17, + NumMessages: 32, NumExtensions: 0, NumServices: 0, }, diff --git a/vendor/google.golang.org/protobuf/types/dynamicpb/dynamic.go b/vendor/google.golang.org/protobuf/types/dynamicpb/dynamic.go index f77ef0de1..39b024b46 100644 --- a/vendor/google.golang.org/protobuf/types/dynamicpb/dynamic.go +++ b/vendor/google.golang.org/protobuf/types/dynamicpb/dynamic.go @@ -49,12 +49,13 @@ type extensionType struct { // A Message is a dynamically constructed protocol buffer message. // -// Message implements the proto.Message interface, and may be used with all -// standard proto package functions such as Marshal, Unmarshal, and so forth. +// Message implements the [google.golang.org/protobuf/proto.Message] interface, +// and may be used with all standard proto package functions +// such as Marshal, Unmarshal, and so forth. // -// Message also implements the protoreflect.Message interface. See the protoreflect -// package documentation for that interface for how to get and set fields and -// otherwise interact with the contents of a Message. +// Message also implements the [protoreflect.Message] interface. +// See the [protoreflect] package documentation for that interface for how to +// get and set fields and otherwise interact with the contents of a Message. // // Reflection API functions which construct messages, such as NewField, // return new dynamic messages of the appropriate type. Functions which take @@ -87,7 +88,7 @@ func NewMessage(desc protoreflect.MessageDescriptor) *Message { // ProtoMessage implements the legacy message interface. func (m *Message) ProtoMessage() {} -// ProtoReflect implements the protoreflect.ProtoMessage interface. +// ProtoReflect implements the [protoreflect.ProtoMessage] interface. func (m *Message) ProtoReflect() protoreflect.Message { return m } @@ -115,25 +116,25 @@ func (m *Message) Type() protoreflect.MessageType { } // New returns a newly allocated empty message with the same descriptor. -// See protoreflect.Message for details. +// See [protoreflect.Message] for details. func (m *Message) New() protoreflect.Message { return m.Type().New() } // Interface returns the message. -// See protoreflect.Message for details. +// See [protoreflect.Message] for details. func (m *Message) Interface() protoreflect.ProtoMessage { return m } -// ProtoMethods is an internal detail of the protoreflect.Message interface. +// ProtoMethods is an internal detail of the [protoreflect.Message] interface. // Users should never call this directly. func (m *Message) ProtoMethods() *protoiface.Methods { return nil } // Range visits every populated field in undefined order. -// See protoreflect.Message for details. +// See [protoreflect.Message] for details. func (m *Message) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { for num, v := range m.known { fd := m.ext[num] @@ -150,7 +151,7 @@ func (m *Message) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) } // Has reports whether a field is populated. -// See protoreflect.Message for details. +// See [protoreflect.Message] for details. func (m *Message) Has(fd protoreflect.FieldDescriptor) bool { m.checkField(fd) if fd.IsExtension() && m.ext[fd.Number()] != fd { @@ -164,7 +165,7 @@ func (m *Message) Has(fd protoreflect.FieldDescriptor) bool { } // Clear clears a field. -// See protoreflect.Message for details. +// See [protoreflect.Message] for details. func (m *Message) Clear(fd protoreflect.FieldDescriptor) { m.checkField(fd) num := fd.Number() @@ -173,7 +174,7 @@ func (m *Message) Clear(fd protoreflect.FieldDescriptor) { } // Get returns the value of a field. -// See protoreflect.Message for details. +// See [protoreflect.Message] for details. func (m *Message) Get(fd protoreflect.FieldDescriptor) protoreflect.Value { m.checkField(fd) num := fd.Number() @@ -212,7 +213,7 @@ func (m *Message) Get(fd protoreflect.FieldDescriptor) protoreflect.Value { } // Mutable returns a mutable reference to a repeated, map, or message field. -// See protoreflect.Message for details. +// See [protoreflect.Message] for details. func (m *Message) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { m.checkField(fd) if !fd.IsMap() && !fd.IsList() && fd.Message() == nil { @@ -241,7 +242,7 @@ func (m *Message) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { } // Set stores a value in a field. -// See protoreflect.Message for details. +// See [protoreflect.Message] for details. func (m *Message) Set(fd protoreflect.FieldDescriptor, v protoreflect.Value) { m.checkField(fd) if m.known == nil { @@ -284,7 +285,7 @@ func (m *Message) clearOtherOneofFields(fd protoreflect.FieldDescriptor) { } // NewField returns a new value for assignable to the field of a given descriptor. -// See protoreflect.Message for details. +// See [protoreflect.Message] for details. func (m *Message) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { m.checkField(fd) switch { @@ -305,7 +306,7 @@ func (m *Message) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { } // WhichOneof reports which field in a oneof is populated, returning nil if none are populated. -// See protoreflect.Message for details. +// See [protoreflect.Message] for details. func (m *Message) WhichOneof(od protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { for i := 0; i < od.Fields().Len(); i++ { fd := od.Fields().Get(i) @@ -317,13 +318,13 @@ func (m *Message) WhichOneof(od protoreflect.OneofDescriptor) protoreflect.Field } // GetUnknown returns the raw unknown fields. -// See protoreflect.Message for details. +// See [protoreflect.Message] for details. func (m *Message) GetUnknown() protoreflect.RawFields { return m.unknown } // SetUnknown sets the raw unknown fields. -// See protoreflect.Message for details. +// See [protoreflect.Message] for details. func (m *Message) SetUnknown(r protoreflect.RawFields) { if m.known == nil { panic(errors.New("%v: modification of read-only message", m.typ.desc.FullName())) @@ -332,7 +333,7 @@ func (m *Message) SetUnknown(r protoreflect.RawFields) { } // IsValid reports whether the message is valid. -// See protoreflect.Message for details. +// See [protoreflect.Message] for details. func (m *Message) IsValid() bool { return m.known != nil } @@ -498,7 +499,7 @@ func isSet(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { return v.List().Len() > 0 case fd.ContainingOneof() != nil: return true - case fd.Syntax() == protoreflect.Proto3 && !fd.IsExtension(): + case !fd.HasPresence() && !fd.IsExtension(): switch fd.Kind() { case protoreflect.BoolKind: return v.Bool() diff --git a/vendor/google.golang.org/protobuf/types/dynamicpb/types.go b/vendor/google.golang.org/protobuf/types/dynamicpb/types.go index 5a8010f18..c432817bb 100644 --- a/vendor/google.golang.org/protobuf/types/dynamicpb/types.go +++ b/vendor/google.golang.org/protobuf/types/dynamicpb/types.go @@ -23,13 +23,20 @@ type extField struct { // A Types is a collection of dynamically constructed descriptors. // Its methods are safe for concurrent use. // -// Types implements protoregistry.MessageTypeResolver and protoregistry.ExtensionTypeResolver. -// A Types may be used as a proto.UnmarshalOptions.Resolver. +// Types implements [protoregistry.MessageTypeResolver] and [protoregistry.ExtensionTypeResolver]. +// A Types may be used as a [google.golang.org/protobuf/proto.UnmarshalOptions.Resolver]. type Types struct { + // atomicExtFiles is used with sync/atomic and hence must be the first word + // of the struct to guarantee 64-bit alignment. + // + // TODO(stapelberg): once we only support Go 1.19 and newer, switch this + // field to be of type atomic.Uint64 to guarantee alignment on + // stack-allocated values, too. + atomicExtFiles uint64 + extMu sync.Mutex + files *protoregistry.Files - extMu sync.Mutex - atomicExtFiles uint64 extensionsByMessage map[extField]protoreflect.ExtensionDescriptor } @@ -45,7 +52,7 @@ func NewTypes(f *protoregistry.Files) *Types { // FindEnumByName looks up an enum by its full name; // e.g., "google.protobuf.Field.Kind". // -// This returns (nil, protoregistry.NotFound) if not found. +// This returns (nil, [protoregistry.NotFound]) if not found. func (t *Types) FindEnumByName(name protoreflect.FullName) (protoreflect.EnumType, error) { d, err := t.files.FindDescriptorByName(name) if err != nil { @@ -63,7 +70,7 @@ func (t *Types) FindEnumByName(name protoreflect.FullName) (protoreflect.EnumTyp // where the extension is declared and is unrelated to the full name of the // message being extended. // -// This returns (nil, protoregistry.NotFound) if not found. +// This returns (nil, [protoregistry.NotFound]) if not found. func (t *Types) FindExtensionByName(name protoreflect.FullName) (protoreflect.ExtensionType, error) { d, err := t.files.FindDescriptorByName(name) if err != nil { @@ -79,7 +86,7 @@ func (t *Types) FindExtensionByName(name protoreflect.FullName) (protoreflect.Ex // FindExtensionByNumber looks up an extension field by the field number // within some parent message, identified by full name. // -// This returns (nil, protoregistry.NotFound) if not found. +// This returns (nil, [protoregistry.NotFound]) if not found. func (t *Types) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) { // Construct the extension number map lazily, since not every user will need it. // Update the map if new files are added to the registry. @@ -96,7 +103,7 @@ func (t *Types) FindExtensionByNumber(message protoreflect.FullName, field proto // FindMessageByName looks up a message by its full name; // e.g. "google.protobuf.Any". // -// This returns (nil, protoregistry.NotFound) if not found. +// This returns (nil, [protoregistry.NotFound]) if not found. func (t *Types) FindMessageByName(name protoreflect.FullName) (protoreflect.MessageType, error) { d, err := t.files.FindDescriptorByName(name) if err != nil { @@ -112,7 +119,7 @@ func (t *Types) FindMessageByName(name protoreflect.FullName) (protoreflect.Mess // FindMessageByURL looks up a message by a URL identifier. // See documentation on google.protobuf.Any.type_url for the URL format. // -// This returns (nil, protoregistry.NotFound) if not found. +// This returns (nil, [protoregistry.NotFound]) if not found. func (t *Types) FindMessageByURL(url string) (protoreflect.MessageType, error) { // This function is similar to FindMessageByName but // truncates anything before and including '/' in the URL. diff --git a/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go b/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go index 580b232f4..9de51be54 100644 --- a/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go +++ b/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go @@ -237,7 +237,8 @@ type Any struct { // // Note: this functionality is not currently available in the official // protobuf release, and it is not used for type URLs beginning with - // type.googleapis.com. + // type.googleapis.com. As of May 2023, there are no widely used type server + // implementations and no plans to implement one. // // Schemes other than `http`, `https` (or the empty scheme) might be // used with implementation specific semantics. diff --git a/vendor/google.golang.org/protobuf/types/pluginpb/plugin.pb.go b/vendor/google.golang.org/protobuf/types/pluginpb/plugin.pb.go index d0bb96a9d..620728f8c 100644 --- a/vendor/google.golang.org/protobuf/types/pluginpb/plugin.pb.go +++ b/vendor/google.golang.org/protobuf/types/pluginpb/plugin.pb.go @@ -1,32 +1,9 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd // Author: kenton@google.com (Kenton Varda) // @@ -58,8 +35,9 @@ import ( type CodeGeneratorResponse_Feature int32 const ( - CodeGeneratorResponse_FEATURE_NONE CodeGeneratorResponse_Feature = 0 - CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL CodeGeneratorResponse_Feature = 1 + CodeGeneratorResponse_FEATURE_NONE CodeGeneratorResponse_Feature = 0 + CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL CodeGeneratorResponse_Feature = 1 + CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS CodeGeneratorResponse_Feature = 2 ) // Enum value maps for CodeGeneratorResponse_Feature. @@ -67,10 +45,12 @@ var ( CodeGeneratorResponse_Feature_name = map[int32]string{ 0: "FEATURE_NONE", 1: "FEATURE_PROTO3_OPTIONAL", + 2: "FEATURE_SUPPORTS_EDITIONS", } CodeGeneratorResponse_Feature_value = map[string]int32{ - "FEATURE_NONE": 0, - "FEATURE_PROTO3_OPTIONAL": 1, + "FEATURE_NONE": 0, + "FEATURE_PROTO3_OPTIONAL": 1, + "FEATURE_SUPPORTS_EDITIONS": 2, } ) @@ -201,6 +181,11 @@ type CodeGeneratorRequest struct { // they import. The files will appear in topological order, so each file // appears before any file that imports it. // + // Note: the files listed in files_to_generate will include runtime-retention + // options only, but all other files will include source-retention options. + // The source_file_descriptors field below is available in case you need + // source-retention options for files_to_generate. + // // protoc guarantees that all proto_files will be written after // the fields above, even though this is not technically guaranteed by the // protobuf wire format. This theoretically could allow a plugin to stream @@ -212,6 +197,10 @@ type CodeGeneratorRequest struct { // Type names of fields and extensions in the FileDescriptorProto are always // fully qualified. ProtoFile []*descriptorpb.FileDescriptorProto `protobuf:"bytes,15,rep,name=proto_file,json=protoFile" json:"proto_file,omitempty"` + // File descriptors with all options, including source-retention options. + // These descriptors are only provided for the files listed in + // files_to_generate. + SourceFileDescriptors []*descriptorpb.FileDescriptorProto `protobuf:"bytes,17,rep,name=source_file_descriptors,json=sourceFileDescriptors" json:"source_file_descriptors,omitempty"` // The version number of protocol compiler. CompilerVersion *Version `protobuf:"bytes,3,opt,name=compiler_version,json=compilerVersion" json:"compiler_version,omitempty"` } @@ -269,6 +258,13 @@ func (x *CodeGeneratorRequest) GetProtoFile() []*descriptorpb.FileDescriptorProt return nil } +func (x *CodeGeneratorRequest) GetSourceFileDescriptors() []*descriptorpb.FileDescriptorProto { + if x != nil { + return x.SourceFileDescriptors + } + return nil +} + func (x *CodeGeneratorRequest) GetCompilerVersion() *Version { if x != nil { return x.CompilerVersion @@ -293,8 +289,18 @@ type CodeGeneratorResponse struct { Error *string `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` // A bitmask of supported features that the code generator supports. // This is a bitwise "or" of values from the Feature enum. - SupportedFeatures *uint64 `protobuf:"varint,2,opt,name=supported_features,json=supportedFeatures" json:"supported_features,omitempty"` - File []*CodeGeneratorResponse_File `protobuf:"bytes,15,rep,name=file" json:"file,omitempty"` + SupportedFeatures *uint64 `protobuf:"varint,2,opt,name=supported_features,json=supportedFeatures" json:"supported_features,omitempty"` + // The minimum edition this plugin supports. This will be treated as an + // Edition enum, but we want to allow unknown values. It should be specified + // according the edition enum value, *not* the edition number. Only takes + // effect for plugins that have FEATURE_SUPPORTS_EDITIONS set. + MinimumEdition *int32 `protobuf:"varint,3,opt,name=minimum_edition,json=minimumEdition" json:"minimum_edition,omitempty"` + // The maximum edition this plugin supports. This will be treated as an + // Edition enum, but we want to allow unknown values. It should be specified + // according the edition enum value, *not* the edition number. Only takes + // effect for plugins that have FEATURE_SUPPORTS_EDITIONS set. + MaximumEdition *int32 `protobuf:"varint,4,opt,name=maximum_edition,json=maximumEdition" json:"maximum_edition,omitempty"` + File []*CodeGeneratorResponse_File `protobuf:"bytes,15,rep,name=file" json:"file,omitempty"` } func (x *CodeGeneratorResponse) Reset() { @@ -343,6 +349,20 @@ func (x *CodeGeneratorResponse) GetSupportedFeatures() uint64 { return 0 } +func (x *CodeGeneratorResponse) GetMinimumEdition() int32 { + if x != nil && x.MinimumEdition != nil { + return *x.MinimumEdition + } + return 0 +} + +func (x *CodeGeneratorResponse) GetMaximumEdition() int32 { + if x != nil && x.MaximumEdition != nil { + return *x.MaximumEdition + } + return 0 +} + func (x *CodeGeneratorResponse) GetFile() []*CodeGeneratorResponse_File { if x != nil { return x.File @@ -493,7 +513,7 @@ var file_google_protobuf_compiler_plugin_proto_rawDesc = []byte{ 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x22, 0xf1, 0x01, 0x0a, 0x14, 0x43, 0x6f, 0x64, + 0x52, 0x06, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x22, 0xcf, 0x02, 0x0a, 0x14, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x10, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x74, 0x6f, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x66, 0x69, 0x6c, @@ -503,18 +523,29 @@ var file_google_protobuf_compiler_plugin_proto_rawDesc = []byte{ 0x74, 0x6f, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x4c, - 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, - 0x6c, 0x65, 0x72, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0f, 0x63, 0x6f, 0x6d, - 0x70, 0x69, 0x6c, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x94, 0x03, 0x0a, - 0x15, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x2d, 0x0a, 0x12, - 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x64, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x48, 0x0a, 0x04, 0x66, + 0x6f, 0x74, 0x6f, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x5c, + 0x0a, 0x17, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x11, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x15, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, + 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x4c, 0x0a, 0x10, + 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, + 0x72, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x69, + 0x6c, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x85, 0x04, 0x0a, 0x15, 0x43, + 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x2d, 0x0a, 0x12, 0x73, 0x75, + 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, + 0x64, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x6d, 0x69, 0x6e, + 0x69, 0x6d, 0x75, 0x6d, 0x5f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x0e, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x45, 0x64, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x5f, 0x65, 0x64, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x6d, 0x61, 0x78, + 0x69, 0x6d, 0x75, 0x6d, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, @@ -530,18 +561,20 @@ var file_google_protobuf_compiler_plugin_proto_rawDesc = []byte{ 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x11, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, - 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x38, 0x0a, 0x07, 0x46, 0x65, 0x61, + 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x57, 0x0a, 0x07, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x46, 0x45, 0x41, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x46, 0x45, 0x41, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x33, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x41, - 0x4c, 0x10, 0x01, 0x42, 0x72, 0x0a, 0x1c, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, - 0x6c, 0x65, 0x72, 0x42, 0x0c, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x73, 0x5a, 0x29, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, - 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x70, 0x62, 0xaa, 0x02, 0x18, 0x47, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x43, - 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, + 0x4c, 0x10, 0x01, 0x12, 0x1d, 0x0a, 0x19, 0x46, 0x45, 0x41, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x53, + 0x55, 0x50, 0x50, 0x4f, 0x52, 0x54, 0x53, 0x5f, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x53, + 0x10, 0x02, 0x42, 0x72, 0x0a, 0x1c, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, + 0x65, 0x72, 0x42, 0x0c, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x5a, 0x29, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, + 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x70, 0x62, 0xaa, 0x02, 0x18, 0x47, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x43, 0x6f, + 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, } var ( @@ -569,14 +602,15 @@ var file_google_protobuf_compiler_plugin_proto_goTypes = []interface{}{ } var file_google_protobuf_compiler_plugin_proto_depIdxs = []int32{ 5, // 0: google.protobuf.compiler.CodeGeneratorRequest.proto_file:type_name -> google.protobuf.FileDescriptorProto - 1, // 1: google.protobuf.compiler.CodeGeneratorRequest.compiler_version:type_name -> google.protobuf.compiler.Version - 4, // 2: google.protobuf.compiler.CodeGeneratorResponse.file:type_name -> google.protobuf.compiler.CodeGeneratorResponse.File - 6, // 3: google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info:type_name -> google.protobuf.GeneratedCodeInfo - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 5, // 1: google.protobuf.compiler.CodeGeneratorRequest.source_file_descriptors:type_name -> google.protobuf.FileDescriptorProto + 1, // 2: google.protobuf.compiler.CodeGeneratorRequest.compiler_version:type_name -> google.protobuf.compiler.Version + 4, // 3: google.protobuf.compiler.CodeGeneratorResponse.file:type_name -> google.protobuf.compiler.CodeGeneratorResponse.File + 6, // 4: google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info:type_name -> google.protobuf.GeneratedCodeInfo + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_google_protobuf_compiler_plugin_proto_init() } diff --git a/vendor/modules.txt b/vendor/modules.txt index 9b8ec713b..4f3f571dd 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,15 +1,15 @@ -# cloud.google.com/go v0.110.8 +# cloud.google.com/go v0.111.0 ## explicit; go 1.19 cloud.google.com/go/internal/detect cloud.google.com/go/internal/optional cloud.google.com/go/internal/pubsub -# cloud.google.com/go/compute v1.23.0 +# cloud.google.com/go/compute v1.23.3 ## explicit; go 1.19 cloud.google.com/go/compute/internal # cloud.google.com/go/compute/metadata v0.2.3 ## explicit; go 1.19 cloud.google.com/go/compute/metadata -# cloud.google.com/go/iam v1.1.2 +# cloud.google.com/go/iam v1.1.5 ## explicit; go 1.19 cloud.google.com/go/iam cloud.google.com/go/iam/apiv1/iampb @@ -175,7 +175,7 @@ github.com/batchcorp/kong # github.com/batchcorp/natty v0.0.16 ## explicit; go 1.16 github.com/batchcorp/natty -# github.com/batchcorp/plumber-schemas v0.0.180 +# github.com/batchcorp/plumber-schemas v0.0.185 ## explicit; go 1.16 github.com/batchcorp/plumber-schemas/build/go/protos github.com/batchcorp/plumber-schemas/build/go/protos/args @@ -312,8 +312,8 @@ github.com/golang-jwt/jwt # github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da ## explicit github.com/golang/groupcache/lru -# github.com/golang/protobuf v1.5.3 -## explicit; go 1.9 +# github.com/golang/protobuf v1.5.4 +## explicit; go 1.17 github.com/golang/protobuf/jsonpb github.com/golang/protobuf/proto github.com/golang/protobuf/protoc-gen-go/descriptor @@ -328,15 +328,15 @@ github.com/golang/protobuf/ptypes/wrappers # github.com/golang/snappy v0.0.4 ## explicit github.com/golang/snappy -# github.com/google/go-cmp v0.5.9 +# github.com/google/go-cmp v0.6.0 ## explicit; go 1.13 github.com/google/go-cmp/cmp github.com/google/go-cmp/cmp/internal/diff github.com/google/go-cmp/cmp/internal/flags github.com/google/go-cmp/cmp/internal/function github.com/google/go-cmp/cmp/internal/value -# github.com/google/s2a-go v0.1.4 -## explicit; go 1.16 +# github.com/google/s2a-go v0.1.7 +## explicit; go 1.19 github.com/google/s2a-go github.com/google/s2a-go/fallback github.com/google/s2a-go/internal/authinfo @@ -356,11 +356,12 @@ github.com/google/s2a-go/internal/v2 github.com/google/s2a-go/internal/v2/certverifier github.com/google/s2a-go/internal/v2/remotesigner github.com/google/s2a-go/internal/v2/tlsconfigstore +github.com/google/s2a-go/retry github.com/google/s2a-go/stream -# github.com/google/uuid v1.3.1 +# github.com/google/uuid v1.5.0 ## explicit github.com/google/uuid -# github.com/googleapis/enterprise-certificate-proxy v0.2.4 +# github.com/googleapis/enterprise-certificate-proxy v0.3.2 ## explicit; go 1.19 github.com/googleapis/enterprise-certificate-proxy/client github.com/googleapis/enterprise-certificate-proxy/client/util @@ -602,7 +603,7 @@ github.com/onsi/ginkgo/reporters/stenographer github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty github.com/onsi/ginkgo/types -# github.com/onsi/gomega v1.20.2 +# github.com/onsi/gomega v1.30.0 ## explicit; go 1.18 github.com/onsi/gomega github.com/onsi/gomega/format @@ -717,6 +718,64 @@ github.com/streadway/amqp # github.com/streamdal/pgoutput v0.3.3 ## explicit; go 1.15 github.com/streamdal/pgoutput +# github.com/streamdal/streamdal/libs/protos v0.1.29 +## explicit; go 1.20 +github.com/streamdal/streamdal/libs/protos/build/go/protos +github.com/streamdal/streamdal/libs/protos/build/go/protos/shared +github.com/streamdal/streamdal/libs/protos/build/go/protos/steps +# github.com/streamdal/streamdal/sdks/go v0.1.12 +## explicit; go 1.19 +github.com/streamdal/streamdal/sdks/go +github.com/streamdal/streamdal/sdks/go/helper +github.com/streamdal/streamdal/sdks/go/hostfunc +github.com/streamdal/streamdal/sdks/go/kv +github.com/streamdal/streamdal/sdks/go/logger +github.com/streamdal/streamdal/sdks/go/metrics +github.com/streamdal/streamdal/sdks/go/server +github.com/streamdal/streamdal/sdks/go/types +github.com/streamdal/streamdal/sdks/go/validate +# github.com/tetratelabs/wazero v1.6.0 +## explicit; go 1.19 +github.com/tetratelabs/wazero +github.com/tetratelabs/wazero/api +github.com/tetratelabs/wazero/experimental +github.com/tetratelabs/wazero/experimental/sys +github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1 +github.com/tetratelabs/wazero/internal/asm +github.com/tetratelabs/wazero/internal/asm/amd64 +github.com/tetratelabs/wazero/internal/asm/arm64 +github.com/tetratelabs/wazero/internal/bitpack +github.com/tetratelabs/wazero/internal/close +github.com/tetratelabs/wazero/internal/descriptor +github.com/tetratelabs/wazero/internal/engine/compiler +github.com/tetratelabs/wazero/internal/engine/interpreter +github.com/tetratelabs/wazero/internal/engine/wazevo +github.com/tetratelabs/wazero/internal/engine/wazevo/backend +github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64 +github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc +github.com/tetratelabs/wazero/internal/engine/wazevo/frontend +github.com/tetratelabs/wazero/internal/engine/wazevo/ssa +github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi +github.com/tetratelabs/wazero/internal/filecache +github.com/tetratelabs/wazero/internal/fsapi +github.com/tetratelabs/wazero/internal/ieee754 +github.com/tetratelabs/wazero/internal/internalapi +github.com/tetratelabs/wazero/internal/leb128 +github.com/tetratelabs/wazero/internal/moremath +github.com/tetratelabs/wazero/internal/platform +github.com/tetratelabs/wazero/internal/sock +github.com/tetratelabs/wazero/internal/sys +github.com/tetratelabs/wazero/internal/sysfs +github.com/tetratelabs/wazero/internal/u32 +github.com/tetratelabs/wazero/internal/u64 +github.com/tetratelabs/wazero/internal/version +github.com/tetratelabs/wazero/internal/wasip1 +github.com/tetratelabs/wazero/internal/wasm +github.com/tetratelabs/wazero/internal/wasm/binary +github.com/tetratelabs/wazero/internal/wasmdebug +github.com/tetratelabs/wazero/internal/wasmruntime +github.com/tetratelabs/wazero/internal/wazeroir +github.com/tetratelabs/wazero/sys # github.com/tidwall/gjson v1.9.3 ## explicit; go 1.12 github.com/tidwall/gjson @@ -842,7 +901,7 @@ go.uber.org/zap/internal/bufferpool go.uber.org/zap/internal/color go.uber.org/zap/internal/exit go.uber.org/zap/zapcore -# golang.org/x/crypto v0.18.0 +# golang.org/x/crypto v0.19.0 ## explicit; go 1.18 golang.org/x/crypto/chacha20 golang.org/x/crypto/chacha20poly1305 @@ -858,13 +917,13 @@ golang.org/x/crypto/pbkdf2 golang.org/x/crypto/pkcs12 golang.org/x/crypto/pkcs12/internal/rc2 golang.org/x/crypto/ssh/terminal -# golang.org/x/mod v0.8.0 -## explicit; go 1.17 +# golang.org/x/mod v0.14.0 +## explicit; go 1.18 golang.org/x/mod/internal/lazyregexp golang.org/x/mod/module golang.org/x/mod/semver -# golang.org/x/net v0.16.0 -## explicit; go 1.17 +# golang.org/x/net v0.21.0 +## explicit; go 1.18 golang.org/x/net/html golang.org/x/net/html/atom golang.org/x/net/html/charset @@ -888,18 +947,17 @@ golang.org/x/oauth2/google/internal/stsexchange golang.org/x/oauth2/internal golang.org/x/oauth2/jws golang.org/x/oauth2/jwt -# golang.org/x/sync v0.4.0 -## explicit; go 1.17 +# golang.org/x/sync v0.6.0 +## explicit; go 1.18 golang.org/x/sync/errgroup golang.org/x/sync/semaphore -# golang.org/x/sys v0.16.0 +# golang.org/x/sys v0.17.0 ## explicit; go 1.18 golang.org/x/sys/cpu -golang.org/x/sys/execabs golang.org/x/sys/plan9 golang.org/x/sys/unix golang.org/x/sys/windows -# golang.org/x/term v0.16.0 +# golang.org/x/term v0.17.0 ## explicit; go 1.18 golang.org/x/term # golang.org/x/text v0.14.0 @@ -928,19 +986,23 @@ golang.org/x/text/transform golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm golang.org/x/text/width -# golang.org/x/tools v0.6.0 +# golang.org/x/time v0.5.0 +## explicit; go 1.18 +golang.org/x/time/rate +# golang.org/x/tools v0.17.0 ## explicit; go 1.18 golang.org/x/tools/go/ast/astutil golang.org/x/tools/go/gcexportdata golang.org/x/tools/go/internal/packagesdriver golang.org/x/tools/go/packages +golang.org/x/tools/go/types/objectpath golang.org/x/tools/go/types/typeutil golang.org/x/tools/imports golang.org/x/tools/internal/event golang.org/x/tools/internal/event/core golang.org/x/tools/internal/event/keys golang.org/x/tools/internal/event/label -golang.org/x/tools/internal/fastwalk +golang.org/x/tools/internal/event/tag golang.org/x/tools/internal/gcimporter golang.org/x/tools/internal/gocommand golang.org/x/tools/internal/gopathwalk @@ -950,7 +1012,8 @@ golang.org/x/tools/internal/pkgbits golang.org/x/tools/internal/tokeninternal golang.org/x/tools/internal/typeparams golang.org/x/tools/internal/typesinternal -# google.golang.org/api v0.128.0 +golang.org/x/tools/internal/versions +# google.golang.org/api v0.149.0 ## explicit; go 1.19 google.golang.org/api/googleapi google.golang.org/api/googleapi/transport @@ -976,11 +1039,9 @@ google.golang.org/appengine/internal/datastore google.golang.org/appengine/internal/log google.golang.org/appengine/internal/modules google.golang.org/appengine/internal/remote_api -google.golang.org/appengine/internal/socket google.golang.org/appengine/internal/urlfetch -google.golang.org/appengine/socket google.golang.org/appengine/urlfetch -# google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 +# google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 ## explicit; go 1.19 google.golang.org/genproto/googleapis/type/expr google.golang.org/genproto/internal @@ -988,17 +1049,17 @@ google.golang.org/genproto/protobuf/api google.golang.org/genproto/protobuf/field_mask google.golang.org/genproto/protobuf/ptype google.golang.org/genproto/protobuf/source_context -# google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 +# google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 ## explicit; go 1.19 google.golang.org/genproto/googleapis/api google.golang.org/genproto/googleapis/api/annotations -# google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 +# google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac ## explicit; go 1.19 google.golang.org/genproto/googleapis/rpc/code google.golang.org/genproto/googleapis/rpc/errdetails google.golang.org/genproto/googleapis/rpc/status -# google.golang.org/grpc v1.57.0 -## explicit; go 1.17 +# google.golang.org/grpc v1.60.1 +## explicit; go 1.19 google.golang.org/grpc google.golang.org/grpc/attributes google.golang.org/grpc/backoff @@ -1040,10 +1101,12 @@ google.golang.org/grpc/internal/grpclog google.golang.org/grpc/internal/grpcrand google.golang.org/grpc/internal/grpcsync google.golang.org/grpc/internal/grpcutil +google.golang.org/grpc/internal/idle google.golang.org/grpc/internal/metadata google.golang.org/grpc/internal/pretty google.golang.org/grpc/internal/resolver google.golang.org/grpc/internal/resolver/dns +google.golang.org/grpc/internal/resolver/dns/internal google.golang.org/grpc/internal/resolver/passthrough google.golang.org/grpc/internal/resolver/unix google.golang.org/grpc/internal/serviceconfig @@ -1055,18 +1118,21 @@ google.golang.org/grpc/keepalive google.golang.org/grpc/metadata google.golang.org/grpc/peer google.golang.org/grpc/resolver +google.golang.org/grpc/resolver/dns +google.golang.org/grpc/resolver/manual google.golang.org/grpc/serviceconfig google.golang.org/grpc/stats google.golang.org/grpc/status google.golang.org/grpc/tap -# google.golang.org/protobuf v1.31.0 -## explicit; go 1.11 +# google.golang.org/protobuf v1.33.0 +## explicit; go 1.17 google.golang.org/protobuf/encoding/protojson google.golang.org/protobuf/encoding/prototext google.golang.org/protobuf/encoding/protowire google.golang.org/protobuf/internal/descfmt google.golang.org/protobuf/internal/descopts google.golang.org/protobuf/internal/detrand +google.golang.org/protobuf/internal/editiondefaults google.golang.org/protobuf/internal/encoding/defval google.golang.org/protobuf/internal/encoding/json google.golang.org/protobuf/internal/encoding/messageset @@ -1091,6 +1157,7 @@ google.golang.org/protobuf/runtime/protoiface google.golang.org/protobuf/runtime/protoimpl google.golang.org/protobuf/types/descriptorpb google.golang.org/protobuf/types/dynamicpb +google.golang.org/protobuf/types/gofeaturespb google.golang.org/protobuf/types/known/anypb google.golang.org/protobuf/types/known/apipb google.golang.org/protobuf/types/known/durationpb From ae395bbfbf161ff90ac6fbff0d3d3323e6a788f4 Mon Sep 17 00:00:00 2001 From: Daniel Selans Date: Wed, 13 Mar 2024 20:27:19 -0700 Subject: [PATCH 3/9] updates to various vendored libs --- vendor/github.com/google/go-cmp/cmp/export.go | 31 + .../go-cmp/cmp/internal/value/pointer.go | 34 + .../github.com/google/s2a-go/retry/retry.go | 144 + .../s2a-go/testdata/mds_client_cert.pem | 19 + .../google/s2a-go/testdata/mds_client_key.pem | 28 + .../google/s2a-go/testdata/mds_root_cert.pem | 21 + .../s2a-go/testdata/mds_server_cert.pem | 21 + .../google/s2a-go/testdata/mds_server_key.pem | 28 + .../s2a-go/testdata/self_signed_cert.pem | 19 + .../s2a-go/testdata/self_signed_key.pem | 28 + vendor/github.com/google/uuid/version6.go | 56 + vendor/github.com/google/uuid/version7.go | 75 + .../gomega/internal/polling_signal_error.go | 106 + .../onsi/gomega/matchers/be_key_of_matcher.go | 45 + .../gomega/matchers/have_exact_elements.go | 88 + .../streamdal/streamdal/libs/protos/LICENSE | 201 + .../build/go/protos/shared/sp_shared.pb.go | 161 + .../libs/protos/build/go/protos/sp_bus.pb.go | 511 ++ .../protos/build/go/protos/sp_command.pb.go | 523 ++ .../protos/build/go/protos/sp_common.pb.go | 1168 ++++ .../protos/build/go/protos/sp_external.pb.go | 3102 ++++++++++ .../build/go/protos/sp_external_grpc.pb.go | 1337 +++++ .../libs/protos/build/go/protos/sp_info.pb.go | 453 ++ .../protos/build/go/protos/sp_internal.pb.go | 1111 ++++ .../build/go/protos/sp_internal_grpc.pb.go | 462 ++ .../libs/protos/build/go/protos/sp_kv.pb.go | 515 ++ .../protos/build/go/protos/sp_notify.pb.go | 911 +++ .../protos/build/go/protos/sp_pipeline.pb.go | 1110 ++++ .../libs/protos/build/go/protos/sp_sdk.pb.go | 479 ++ .../libs/protos/build/go/protos/sp_wsm.pb.go | 498 ++ .../go/protos/steps/sp_steps_custom.pb.go | 147 + .../go/protos/steps/sp_steps_decode.pb.go | 147 + .../go/protos/steps/sp_steps_detective.pb.go | 700 +++ .../go/protos/steps/sp_steps_encode.pb.go | 147 + .../protos/steps/sp_steps_httprequest.pb.go | 425 ++ .../protos/steps/sp_steps_inferschema.pb.go | 151 + .../build/go/protos/steps/sp_steps_kv.pb.go | 413 ++ .../steps/sp_steps_schema_validation.pb.go | 455 ++ .../go/protos/steps/sp_steps_transform.pb.go | 892 +++ .../go/protos/steps/sp_steps_valid_json.pb.go | 136 + .../streamdal/streamdal/sdks/go/.gitignore | 6 + .../streamdal/streamdal/sdks/go/BENCHMARKS.md | 47 + .../streamdal/streamdal/sdks/go/LICENSE | 201 + .../streamdal/streamdal/sdks/go/Makefile | 42 + .../streamdal/streamdal/sdks/go/README.md | 118 + .../streamdal/streamdal/sdks/go/audience.go | 114 + .../streamdal/streamdal/sdks/go/function.go | 203 + .../streamdal/streamdal/sdks/go/go_sdk.go | 1020 ++++ .../streamdal/sdks/go/helper/helper.go | 81 + .../streamdal/sdks/go/hostfunc/hostfunc.go | 26 + .../streamdal/sdks/go/hostfunc/httprequest.go | 94 + .../streamdal/sdks/go/hostfunc/kv.go | 81 + .../streamdal/streamdal/sdks/go/init_wasm.sh | 30 + .../streamdal/streamdal/sdks/go/kv/kv.go | 159 + .../streamdal/sdks/go/logger/logger.go | 68 + .../streamdal/sdks/go/metrics/counter.go | 62 + .../streamdal/sdks/go/metrics/metrics.go | 386 ++ .../streamdal/streamdal/sdks/go/register.go | 286 + .../streamdal/streamdal/sdks/go/schema.go | 64 + .../streamdal/sdks/go/server/client.go | 246 + .../streamdal/streamdal/sdks/go/tail.go | 407 ++ .../streamdal/sdks/go/types/types.go | 27 + .../streamdal/sdks/go/validate/validate.go | 188 + .../tetratelabs/wazero/.editorconfig | 7 + .../tetratelabs/wazero/.gitattributes | 2 + .../github.com/tetratelabs/wazero/.gitignore | 44 + .../github.com/tetratelabs/wazero/.gitmodules | 3 + .../tetratelabs/wazero/CONTRIBUTING.md | 75 + vendor/github.com/tetratelabs/wazero/LICENSE | 201 + vendor/github.com/tetratelabs/wazero/Makefile | 356 ++ vendor/github.com/tetratelabs/wazero/NOTICE | 2 + .../tetratelabs/wazero/RATIONALE.md | 1582 +++++ .../github.com/tetratelabs/wazero/README.md | 135 + .../tetratelabs/wazero/api/features.go | 212 + .../github.com/tetratelabs/wazero/api/wasm.go | 756 +++ .../github.com/tetratelabs/wazero/builder.go | 352 ++ vendor/github.com/tetratelabs/wazero/cache.go | 116 + .../github.com/tetratelabs/wazero/codecov.yml | 9 + .../github.com/tetratelabs/wazero/config.go | 882 +++ .../tetratelabs/wazero/config_supported.go | 14 + .../tetratelabs/wazero/config_unsupported.go | 8 + .../wazero/examples/basic/testdata/add.wasm | Bin 0 -> 6093 bytes .../tetratelabs/wazero/experimental/close.go | 63 + .../wazero/experimental/experimental.go | 41 + .../wazero/experimental/listener.go | 322 + .../logging/testdata/listener.wasm | Bin 0 -> 318 bytes .../wazero/experimental/sys/dir.go | 92 + .../wazero/experimental/sys/errno.go | 98 + .../wazero/experimental/sys/error.go | 45 + .../wazero/experimental/sys/file.go | 317 + .../tetratelabs/wazero/experimental/sys/fs.go | 293 + .../wazero/experimental/sys/oflag.go | 70 + .../wazero/experimental/sys/syscall_errno.go | 106 + .../sys/syscall_errno_notwindows.go | 13 + .../sys/syscall_errno_unsupported.go | 7 + .../experimental/sys/syscall_errno_windows.go | 62 + .../wazero/experimental/sys/time.go | 10 + .../wazero/experimental/sys/unimplemented.go | 160 + .../github.com/tetratelabs/wazero/fsconfig.go | 215 + .../imports/wasi_snapshot_preview1/args.go | 97 + .../imports/wasi_snapshot_preview1/clock.go | 116 + .../imports/wasi_snapshot_preview1/environ.go | 100 + .../imports/wasi_snapshot_preview1/fs.go | 2013 +++++++ .../imports/wasi_snapshot_preview1/poll.go | 239 + .../imports/wasi_snapshot_preview1/proc.go | 44 + .../imports/wasi_snapshot_preview1/random.go | 55 + .../imports/wasi_snapshot_preview1/sched.go | 22 + .../imports/wasi_snapshot_preview1/sock.go | 188 + .../testdata/cargo-wasi/Cargo.toml | 11 + .../testdata/cargo-wasi/wasi.rs | 89 + .../testdata/cargo-wasi/wasi.wasm | Bin 0 -> 94484 bytes .../testdata/exit_on_start.wasm | Bin 0 -> 137 bytes .../testdata/exit_on_start.wat | 9 + .../testdata/exit_on_start_unstable.wasm | Bin 0 -> 128 bytes .../testdata/exit_on_start_unstable.wat | 10 + .../testdata/gotip/wasi.go | 309 + .../testdata/print_args.wasm | Bin 0 -> 219 bytes .../testdata/print_args.wat | 61 + .../testdata/print_prestat_dirname.wasm | Bin 0 -> 231 bytes .../testdata/print_prestat_dirname.wat | 42 + .../testdata/tinygo/wasi.go | 88 + .../testdata/tinygo/wasi.wasm | Bin 0 -> 109235 bytes .../testdata/zig-cc/wasi.c | 222 + .../testdata/zig-cc/wasi.wasm | Bin 0 -> 62102 bytes .../testdata/zig/build.zig | 16 + .../testdata/zig/wasi.wasm | Bin 0 -> 10787 bytes .../testdata/zig/wasi.zig | 50 + .../imports/wasi_snapshot_preview1/wasi.go | 314 + .../wazero/internal/asm/amd64/assembler.go | 98 + .../wazero/internal/asm/amd64/consts.go | 1248 ++++ .../wazero/internal/asm/amd64/impl.go | 2812 +++++++++ .../internal/asm/amd64/impl_staticconst.go | 181 + .../wazero/internal/asm/arm64/assembler.go | 115 + .../wazero/internal/asm/arm64/consts.go | 1476 +++++ .../wazero/internal/asm/arm64/impl.go | 3900 ++++++++++++ .../wazero/internal/asm/assembler.go | 209 + .../tetratelabs/wazero/internal/asm/buffer.go | 235 + .../tetratelabs/wazero/internal/asm/impl.go | 59 + .../wazero/internal/bitpack/offset_array.go | 224 + .../wazero/internal/close/close.go | 13 + .../wazero/internal/descriptor/table.go | 164 + .../internal/engine/compiler/RATIONALE.md | 112 + .../wazero/internal/engine/compiler/arch.go | 19 + .../internal/engine/compiler/arch_amd64.go | 35 + .../internal/engine/compiler/arch_amd64.s | 9 + .../internal/engine/compiler/arch_arm64.go | 70 + .../internal/engine/compiler/arch_arm64.s | 21 + .../internal/engine/compiler/arch_other.go | 26 + .../internal/engine/compiler/arch_other.s | 3 + .../internal/engine/compiler/compiler.go | 335 ++ .../internal/engine/compiler/compiler_drop.go | 126 + .../compiler/compiler_value_location.go | 425 ++ .../wazero/internal/engine/compiler/engine.go | 1595 +++++ .../internal/engine/compiler/engine_cache.go | 241 + .../internal/engine/compiler/impl_amd64.go | 5209 +++++++++++++++++ .../internal/engine/compiler/impl_arm64.go | 4329 ++++++++++++++ .../engine/compiler/impl_vec_amd64.go | 2812 +++++++++ .../engine/compiler/impl_vec_arm64.go | 1592 +++++ .../engine/interpreter/interpreter.go | 4147 +++++++++++++ .../wazero/internal/engine/wazevo/README.md | 2 + .../internal/engine/wazevo/backend/abi.go | 61 + .../internal/engine/wazevo/backend/backend.go | 3 + .../engine/wazevo/backend/compiler.go | 386 ++ .../engine/wazevo/backend/compiler_lower.go | 219 + .../engine/wazevo/backend/isa/arm64/abi.go | 421 ++ .../backend/isa/arm64/abi_entry_arm64.go | 9 + .../backend/isa/arm64/abi_entry_arm64.s | 29 + .../backend/isa/arm64/abi_entry_preamble.go | 231 + .../wazevo/backend/isa/arm64/abi_go_call.go | 454 ++ .../engine/wazevo/backend/isa/arm64/cond.go | 215 + .../engine/wazevo/backend/isa/arm64/instr.go | 2362 ++++++++ .../backend/isa/arm64/instr_encoding.go | 2218 +++++++ .../backend/isa/arm64/lower_constant.go | 290 + .../wazevo/backend/isa/arm64/lower_instr.go | 1995 +++++++ .../backend/isa/arm64/lower_instr_operands.go | 350 ++ .../wazevo/backend/isa/arm64/lower_mem.go | 510 ++ .../wazevo/backend/isa/arm64/machine.go | 628 ++ .../isa/arm64/machine_pro_epi_logue.go | 445 ++ .../backend/isa/arm64/machine_regalloc.go | 433 ++ .../backend/isa/arm64/machine_relocation.go | 28 + .../engine/wazevo/backend/isa/arm64/reg.go | 397 ++ .../wazevo/backend/isa/arm64/unwind_stack.go | 86 + .../internal/engine/wazevo/backend/machine.go | 113 + .../engine/wazevo/backend/regalloc/api.go | 124 + .../engine/wazevo/backend/regalloc/reg.go | 125 + .../wazevo/backend/regalloc/regalloc.go | 1021 ++++ .../engine/wazevo/backend/regalloc/regset.go | 98 + .../internal/engine/wazevo/backend/vdef.go | 43 + .../internal/engine/wazevo/call_engine.go | 517 ++ .../wazero/internal/engine/wazevo/engine.go | 765 +++ .../internal/engine/wazevo/engine_cache.go | 283 + .../engine/wazevo/entrypoint_arm64.go | 13 + .../engine/wazevo/entrypoint_others.go | 15 + .../engine/wazevo/frontend/frontend.go | 403 ++ .../internal/engine/wazevo/frontend/lower.go | 3947 +++++++++++++ .../internal/engine/wazevo/frontend/misc.go | 10 + .../internal/engine/wazevo/hostmodule.go | 83 + .../wazero/internal/engine/wazevo/machine.go | 35 + .../wazero/internal/engine/wazevo/memmove.go | 11 + .../internal/engine/wazevo/module_engine.go | 330 ++ .../internal/engine/wazevo/ssa/basic_block.go | 390 ++ .../internal/engine/wazevo/ssa/builder.go | 1066 ++++ .../wazero/internal/engine/wazevo/ssa/cmp.go | 107 + .../internal/engine/wazevo/ssa/funcref.go | 12 + .../engine/wazevo/ssa/instructions.go | 2838 +++++++++ .../wazero/internal/engine/wazevo/ssa/pass.go | 375 ++ .../internal/engine/wazevo/ssa/pass_cfg.go | 312 + .../internal/engine/wazevo/ssa/signature.go | 49 + .../wazero/internal/engine/wazevo/ssa/ssa.go | 14 + .../wazero/internal/engine/wazevo/ssa/type.go | 107 + .../wazero/internal/engine/wazevo/ssa/vs.go | 81 + .../engine/wazevo/wazevoapi/debug_options.go | 213 + .../engine/wazevo/wazevoapi/exitcode.go | 97 + .../engine/wazevo/wazevoapi/offsetdata.go | 198 + .../engine/wazevo/wazevoapi/perfmap.go | 96 + .../wazevo/wazevoapi/perfmap_disabled.go | 5 + .../wazevo/wazevoapi/perfmap_enabled.go | 5 + .../internal/engine/wazevo/wazevoapi/pool.go | 59 + .../internal/filecache/compilationcache.go | 42 + .../wazero/internal/filecache/file_cache.go | 107 + .../tetratelabs/wazero/internal/fsapi/file.go | 69 + .../tetratelabs/wazero/internal/fsapi/poll.go | 20 + .../wazero/internal/fsapi/unimplemented.go | 27 + .../wazero/internal/ieee754/ieee754.go | 29 + .../engine/testdata/infinite_loop.wasm | Bin 0 -> 48 bytes .../integration_test/vs/testdata/fac.wasm | Bin 0 -> 146 bytes .../vs/testdata/mem_grow.wasm | Bin 0 -> 59 bytes .../wazero/internal/internalapi/internal.go | 9 + .../wazero/internal/leb128/leb128.go | 285 + .../wazero/internal/moremath/moremath.go | 271 + .../wazero/internal/platform/cpuid_amd64.go | 79 + .../wazero/internal/platform/cpuid_amd64.s | 14 + .../wazero/internal/platform/crypto.go | 17 + .../wazero/internal/platform/mmap_linux.go | 76 + .../wazero/internal/platform/mmap_other.go | 18 + .../wazero/internal/platform/mmap_unix.go | 47 + .../internal/platform/mmap_unsupported.go | 26 + .../wazero/internal/platform/mmap_windows.go | 106 + .../wazero/internal/platform/mremap_other.go | 23 + .../wazero/internal/platform/mremap_unix.go | 21 + .../wazero/internal/platform/path.go | 6 + .../wazero/internal/platform/path_windows.go | 17 + .../wazero/internal/platform/platform.go | 90 + .../internal/platform/platform_amd64.go | 7 + .../internal/platform/platform_arm64.go | 7 + .../wazero/internal/platform/time.go | 76 + .../wazero/internal/platform/time_cgo.go | 11 + .../wazero/internal/platform/time_notcgo.go | 7 + .../wazero/internal/platform/time_windows.go | 40 + .../tetratelabs/wazero/internal/sock/sock.go | 89 + .../wazero/internal/sock/sock_supported.go | 11 + .../wazero/internal/sock/sock_unsupported.go | 10 + .../tetratelabs/wazero/internal/sys/fs.go | 474 ++ .../tetratelabs/wazero/internal/sys/lazy.go | 151 + .../tetratelabs/wazero/internal/sys/stdio.go | 128 + .../tetratelabs/wazero/internal/sys/sys.go | 228 + .../wazero/internal/sys/testdata/empty.txt | 0 .../internal/sys/testdata/sub/sub/test.txt | 1 + .../wazero/internal/sys/testdata/sub/test.txt | 1 + .../wazero/internal/sys/testdata/test.txt | 1 + .../wazero/internal/sysfs/adapter.go | 105 + .../wazero/internal/sysfs/datasync_linux.go | 14 + .../internal/sysfs/datasync_unsupported.go | 14 + .../tetratelabs/wazero/internal/sysfs/dir.go | 24 + .../wazero/internal/sysfs/dirfs.go | 131 + .../tetratelabs/wazero/internal/sysfs/file.go | 520 ++ .../wazero/internal/sysfs/file_test.go | 1136 ++++ .../wazero/internal/sysfs/file_unix.go | 39 + .../wazero/internal/sysfs/file_unsupported.go | 28 + .../wazero/internal/sysfs/file_windows.go | 88 + .../wazero/internal/sysfs/futimens.go | 37 + .../wazero/internal/sysfs/futimens_darwin.go | 51 + .../wazero/internal/sysfs/futimens_darwin.s | 8 + .../wazero/internal/sysfs/futimens_linux.go | 47 + .../internal/sysfs/futimens_unsupported.go | 18 + .../wazero/internal/sysfs/futimens_windows.go | 49 + .../tetratelabs/wazero/internal/sysfs/ino.go | 22 + .../wazero/internal/sysfs/ino_plan9.go | 15 + .../wazero/internal/sysfs/ino_windows.go | 28 + .../wazero/internal/sysfs/nonblock_plan9.go | 11 + .../wazero/internal/sysfs/nonblock_unix.go | 17 + .../wazero/internal/sysfs/nonblock_windows.go | 23 + .../wazero/internal/sysfs/oflag.go | 38 + .../wazero/internal/sysfs/open_file_darwin.go | 26 + .../internal/sysfs/open_file_freebsd.go | 24 + .../wazero/internal/sysfs/open_file_linux.go | 28 + .../internal/sysfs/open_file_notwindows.go | 20 + .../wazero/internal/sysfs/open_file_sun.go | 31 + .../internal/sysfs/open_file_unsupported.go | 18 + .../internal/sysfs/open_file_windows.go | 164 + .../wazero/internal/sysfs/osfile.go | 295 + .../tetratelabs/wazero/internal/sysfs/poll.go | 18 + .../wazero/internal/sysfs/poll_darwin.go | 55 + .../wazero/internal/sysfs/poll_darwin.s | 8 + .../wazero/internal/sysfs/poll_linux.go | 57 + .../wazero/internal/sysfs/poll_unsupported.go | 13 + .../wazero/internal/sysfs/poll_windows.go | 224 + .../wazero/internal/sysfs/readfs.go | 117 + .../wazero/internal/sysfs/rename.go | 16 + .../wazero/internal/sysfs/rename_plan9.go | 14 + .../wazero/internal/sysfs/rename_windows.go | 55 + .../tetratelabs/wazero/internal/sysfs/sock.go | 37 + .../wazero/internal/sysfs/sock_unix.go | 180 + .../wazero/internal/sysfs/sock_unsupported.go | 26 + .../wazero/internal/sysfs/sock_windows.go | 285 + .../tetratelabs/wazero/internal/sysfs/stat.go | 16 + .../wazero/internal/sysfs/stat_bsd.go | 37 + .../wazero/internal/sysfs/stat_linux.go | 40 + .../wazero/internal/sysfs/stat_unsupported.go | 40 + .../wazero/internal/sysfs/stat_windows.go | 120 + .../tetratelabs/wazero/internal/sysfs/sync.go | 13 + .../wazero/internal/sysfs/sync_windows.go | 20 + .../wazero/internal/sysfs/syscall6_darwin.go | 13 + .../wazero/internal/sysfs/sysfs.go | 6 + .../wazero/internal/sysfs/testdata/empty.txt | 0 .../wazero/internal/sysfs/testdata/wazero.txt | 1 + .../wazero/internal/sysfs/unlink.go | 17 + .../wazero/internal/sysfs/unlink_plan9.go | 12 + .../wazero/internal/sysfs/unlink_windows.go | 25 + .../tetratelabs/wazero/internal/u32/u32.go | 11 + .../tetratelabs/wazero/internal/u64/u64.go | 15 + .../wazero/internal/version/version.go | 52 + .../wazero/internal/wasip1/args.go | 6 + .../wazero/internal/wasip1/clock.go | 16 + .../wazero/internal/wasip1/environ.go | 6 + .../wazero/internal/wasip1/errno.go | 314 + .../tetratelabs/wazero/internal/wasip1/fs.go | 164 + .../wazero/internal/wasip1/poll.go | 15 + .../wazero/internal/wasip1/proc.go | 6 + .../wazero/internal/wasip1/random.go | 3 + .../wazero/internal/wasip1/rights.go | 148 + .../wazero/internal/wasip1/sched.go | 3 + .../wazero/internal/wasip1/sock.go | 71 + .../wazero/internal/wasip1/wasi.go | 26 + .../wazero/internal/wasm/binary/code.go | 100 + .../wazero/internal/wasm/binary/const_expr.go | 105 + .../wazero/internal/wasm/binary/custom.go | 22 + .../wazero/internal/wasm/binary/data.go | 79 + .../wazero/internal/wasm/binary/decoder.go | 193 + .../wazero/internal/wasm/binary/element.go | 272 + .../wazero/internal/wasm/binary/errors.go | 11 + .../wazero/internal/wasm/binary/export.go | 32 + .../wazero/internal/wasm/binary/function.go | 56 + .../wazero/internal/wasm/binary/global.go | 50 + .../wazero/internal/wasm/binary/header.go | 9 + .../wazero/internal/wasm/binary/import.go | 52 + .../wazero/internal/wasm/binary/limits.go | 42 + .../wazero/internal/wasm/binary/memory.go | 26 + .../wazero/internal/wasm/binary/names.go | 151 + .../wazero/internal/wasm/binary/section.go | 225 + .../wazero/internal/wasm/binary/table.go | 39 + .../wazero/internal/wasm/binary/value.go | 60 + .../wazero/internal/wasm/counts.go | 51 + .../wazero/internal/wasm/engine.go | 68 + .../wazero/internal/wasm/func_validation.go | 1954 +++++++ .../internal/wasm/function_definition.go | 188 + .../wazero/internal/wasm/global.go | 55 + .../wazero/internal/wasm/gofunc.go | 279 + .../tetratelabs/wazero/internal/wasm/host.go | 179 + .../wazero/internal/wasm/instruction.go | 1549 +++++ .../wazero/internal/wasm/memory.go | 279 + .../wazero/internal/wasm/memory_definition.go | 128 + .../wazero/internal/wasm/module.go | 1076 ++++ .../wazero/internal/wasm/module_instance.go | 247 + .../internal/wasm/module_instance_lookup.go | 73 + .../tetratelabs/wazero/internal/wasm/store.go | 641 ++ .../wazero/internal/wasm/store_module_list.go | 97 + .../tetratelabs/wazero/internal/wasm/table.go | 327 ++ .../wazero/internal/wasmdebug/debug.go | 157 + .../wazero/internal/wasmdebug/dwarf.go | 226 + .../wazero/internal/wasmruntime/errors.go | 44 + .../wazero/internal/wazeroir/compiler.go | 3068 ++++++++++ .../wazero/internal/wazeroir/format.go | 24 + .../wazero/internal/wazeroir/operations.go | 2567 ++++++++ .../wazero/internal/wazeroir/signature.go | 713 +++ .../wazero/internal/wazeroir/wazeroir.go | 8 + .../tetratelabs/wazero/netlify.toml | 15 + .../github.com/tetratelabs/wazero/runtime.go | 374 ++ .../tetratelabs/wazero/sys/clock.go | 26 + .../tetratelabs/wazero/sys/error.go | 83 + .../github.com/tetratelabs/wazero/sys/stat.go | 107 + .../tetratelabs/wazero/sys/stat_bsd.go | 29 + .../tetratelabs/wazero/sys/stat_linux.go | 32 + .../wazero/sys/stat_unsupported.go | 17 + .../tetratelabs/wazero/sys/stat_windows.go | 26 + .../tetratelabs/wazero/testdata/index.html | 2 + vendor/golang.org/x/time/LICENSE | 27 + vendor/golang.org/x/time/PATENTS | 22 + vendor/golang.org/x/time/rate/rate.go | 430 ++ vendor/golang.org/x/time/rate/sometimes.go | 67 + .../x/tools/go/types/objectpath/objectpath.go | 752 +++ .../x/tools/internal/event/keys/util.go | 21 + .../x/tools/internal/event/tag/tag.go | 59 + .../x/tools/internal/versions/gover.go | 172 + .../x/tools/internal/versions/types.go | 19 + .../x/tools/internal/versions/types_go121.go | 20 + .../x/tools/internal/versions/types_go122.go | 24 + .../x/tools/internal/versions/versions.go | 52 + .../grpc/balancer_wrapper.go | 380 ++ .../grpc/internal/experimental.go | 28 + .../grpc/internal/idle/idle.go | 278 + .../resolver/dns/internal/internal.go | 70 + .../grpc/internal/tcp_keepalive_nonunix.go | 29 + .../grpc/internal/tcp_keepalive_unix.go | 54 + .../grpc/resolver/dns/dns_resolver.go | 36 + .../grpc/resolver/manual/manual.go | 126 + .../grpc/resolver_wrapper.go | 197 + .../internal/editiondefaults/defaults.go | 12 + .../editiondefaults/editions_defaults.binpb | 4 + .../protobuf/internal/filedesc/editions.go | 142 + .../internal/genid/go_features_gen.go | 31 + .../internal/strs/strings_unsafe_go120.go | 95 + .../internal/strs/strings_unsafe_go121.go | 74 + .../protobuf/reflect/protodesc/editions.go | 148 + .../protoreflect/value_unsafe_go120.go | 99 + .../protoreflect/value_unsafe_go121.go | 87 + .../types/gofeaturespb/go_features.pb.go | 177 + .../types/gofeaturespb/go_features.proto | 28 + 418 files changed, 117215 insertions(+) create mode 100644 vendor/github.com/google/go-cmp/cmp/export.go create mode 100644 vendor/github.com/google/go-cmp/cmp/internal/value/pointer.go create mode 100644 vendor/github.com/google/s2a-go/retry/retry.go create mode 100644 vendor/github.com/google/s2a-go/testdata/mds_client_cert.pem create mode 100644 vendor/github.com/google/s2a-go/testdata/mds_client_key.pem create mode 100644 vendor/github.com/google/s2a-go/testdata/mds_root_cert.pem create mode 100644 vendor/github.com/google/s2a-go/testdata/mds_server_cert.pem create mode 100644 vendor/github.com/google/s2a-go/testdata/mds_server_key.pem create mode 100644 vendor/github.com/google/s2a-go/testdata/self_signed_cert.pem create mode 100644 vendor/github.com/google/s2a-go/testdata/self_signed_key.pem create mode 100644 vendor/github.com/google/uuid/version6.go create mode 100644 vendor/github.com/google/uuid/version7.go create mode 100644 vendor/github.com/onsi/gomega/internal/polling_signal_error.go create mode 100644 vendor/github.com/onsi/gomega/matchers/be_key_of_matcher.go create mode 100644 vendor/github.com/onsi/gomega/matchers/have_exact_elements.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/LICENSE create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/shared/sp_shared.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_bus.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_command.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_common.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_external.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_external_grpc.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_info.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_internal.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_internal_grpc.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_kv.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_notify.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_pipeline.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_sdk.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_wsm.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_custom.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_decode.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_detective.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_encode.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_httprequest.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_inferschema.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_kv.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_schema_validation.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_transform.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_valid_json.pb.go create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/.gitignore create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/BENCHMARKS.md create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/LICENSE create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/Makefile create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/README.md create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/audience.go create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/function.go create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/go_sdk.go create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/helper/helper.go create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/hostfunc/hostfunc.go create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/hostfunc/httprequest.go create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/hostfunc/kv.go create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/init_wasm.sh create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/kv/kv.go create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/logger/logger.go create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/metrics/counter.go create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/metrics/metrics.go create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/register.go create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/schema.go create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/server/client.go create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/tail.go create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/types/types.go create mode 100644 vendor/github.com/streamdal/streamdal/sdks/go/validate/validate.go create mode 100644 vendor/github.com/tetratelabs/wazero/.editorconfig create mode 100644 vendor/github.com/tetratelabs/wazero/.gitattributes create mode 100644 vendor/github.com/tetratelabs/wazero/.gitignore create mode 100644 vendor/github.com/tetratelabs/wazero/.gitmodules create mode 100644 vendor/github.com/tetratelabs/wazero/CONTRIBUTING.md create mode 100644 vendor/github.com/tetratelabs/wazero/LICENSE create mode 100644 vendor/github.com/tetratelabs/wazero/Makefile create mode 100644 vendor/github.com/tetratelabs/wazero/NOTICE create mode 100644 vendor/github.com/tetratelabs/wazero/RATIONALE.md create mode 100644 vendor/github.com/tetratelabs/wazero/README.md create mode 100644 vendor/github.com/tetratelabs/wazero/api/features.go create mode 100644 vendor/github.com/tetratelabs/wazero/api/wasm.go create mode 100644 vendor/github.com/tetratelabs/wazero/builder.go create mode 100644 vendor/github.com/tetratelabs/wazero/cache.go create mode 100644 vendor/github.com/tetratelabs/wazero/codecov.yml create mode 100644 vendor/github.com/tetratelabs/wazero/config.go create mode 100644 vendor/github.com/tetratelabs/wazero/config_supported.go create mode 100644 vendor/github.com/tetratelabs/wazero/config_unsupported.go create mode 100644 vendor/github.com/tetratelabs/wazero/examples/basic/testdata/add.wasm create mode 100644 vendor/github.com/tetratelabs/wazero/experimental/close.go create mode 100644 vendor/github.com/tetratelabs/wazero/experimental/experimental.go create mode 100644 vendor/github.com/tetratelabs/wazero/experimental/listener.go create mode 100644 vendor/github.com/tetratelabs/wazero/experimental/logging/testdata/listener.wasm create mode 100644 vendor/github.com/tetratelabs/wazero/experimental/sys/dir.go create mode 100644 vendor/github.com/tetratelabs/wazero/experimental/sys/errno.go create mode 100644 vendor/github.com/tetratelabs/wazero/experimental/sys/error.go create mode 100644 vendor/github.com/tetratelabs/wazero/experimental/sys/file.go create mode 100644 vendor/github.com/tetratelabs/wazero/experimental/sys/fs.go create mode 100644 vendor/github.com/tetratelabs/wazero/experimental/sys/oflag.go create mode 100644 vendor/github.com/tetratelabs/wazero/experimental/sys/syscall_errno.go create mode 100644 vendor/github.com/tetratelabs/wazero/experimental/sys/syscall_errno_notwindows.go create mode 100644 vendor/github.com/tetratelabs/wazero/experimental/sys/syscall_errno_unsupported.go create mode 100644 vendor/github.com/tetratelabs/wazero/experimental/sys/syscall_errno_windows.go create mode 100644 vendor/github.com/tetratelabs/wazero/experimental/sys/time.go create mode 100644 vendor/github.com/tetratelabs/wazero/experimental/sys/unimplemented.go create mode 100644 vendor/github.com/tetratelabs/wazero/fsconfig.go create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/args.go create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/clock.go create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/environ.go create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/fs.go create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/poll.go create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/proc.go create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/random.go create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/sched.go create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/sock.go create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/cargo-wasi/Cargo.toml create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/cargo-wasi/wasi.rs create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/cargo-wasi/wasi.wasm create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/exit_on_start.wasm create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/exit_on_start.wat create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/exit_on_start_unstable.wasm create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/exit_on_start_unstable.wat create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/gotip/wasi.go create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/print_args.wasm create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/print_args.wat create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/print_prestat_dirname.wasm create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/print_prestat_dirname.wat create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/tinygo/wasi.go create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/tinygo/wasi.wasm create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/zig-cc/wasi.c create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/zig-cc/wasi.wasm create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/zig/build.zig create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/zig/wasi.wasm create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/zig/wasi.zig create mode 100644 vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/wasi.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/asm/amd64/assembler.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/asm/amd64/consts.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/asm/amd64/impl.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/asm/amd64/impl_staticconst.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/asm/arm64/assembler.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/asm/arm64/consts.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/asm/arm64/impl.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/asm/assembler.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/asm/buffer.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/asm/impl.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/bitpack/offset_array.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/close/close.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/descriptor/table.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/compiler/RATIONALE.md create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/compiler/arch.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/compiler/arch_amd64.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/compiler/arch_amd64.s create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/compiler/arch_arm64.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/compiler/arch_arm64.s create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/compiler/arch_other.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/compiler/arch_other.s create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/compiler/compiler.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/compiler/compiler_drop.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/compiler/compiler_value_location.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/compiler/engine.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/compiler/engine_cache.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/compiler/impl_amd64.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/compiler/impl_arm64.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/compiler/impl_vec_amd64.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/compiler/impl_vec_arm64.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/interpreter/interpreter.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/README.md create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/abi.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/backend.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/compiler.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/compiler_lower.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/abi.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/abi_entry_arm64.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/abi_entry_arm64.s create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/abi_entry_preamble.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/abi_go_call.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/cond.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/instr.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/instr_encoding.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/lower_constant.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/lower_instr.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/lower_instr_operands.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/lower_mem.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/machine.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/machine_pro_epi_logue.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/machine_regalloc.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/machine_relocation.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/reg.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/unwind_stack.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/machine.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc/api.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc/reg.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc/regalloc.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc/regset.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/vdef.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/call_engine.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/engine.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/engine_cache.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/entrypoint_arm64.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/entrypoint_others.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/frontend/frontend.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/frontend/lower.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/frontend/misc.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/hostmodule.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/machine.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/memmove.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/module_engine.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/basic_block.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/builder.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/cmp.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/funcref.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/instructions.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/pass.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/pass_cfg.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/signature.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/ssa.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/type.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/vs.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/debug_options.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/exitcode.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/offsetdata.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/perfmap.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/perfmap_disabled.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/perfmap_enabled.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/pool.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/filecache/compilationcache.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/filecache/file_cache.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/fsapi/file.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/fsapi/poll.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/fsapi/unimplemented.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/ieee754/ieee754.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/integration_test/engine/testdata/infinite_loop.wasm create mode 100644 vendor/github.com/tetratelabs/wazero/internal/integration_test/vs/testdata/fac.wasm create mode 100644 vendor/github.com/tetratelabs/wazero/internal/integration_test/vs/testdata/mem_grow.wasm create mode 100644 vendor/github.com/tetratelabs/wazero/internal/internalapi/internal.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/leb128/leb128.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/moremath/moremath.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/platform/cpuid_amd64.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/platform/cpuid_amd64.s create mode 100644 vendor/github.com/tetratelabs/wazero/internal/platform/crypto.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/platform/mmap_linux.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/platform/mmap_other.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/platform/mmap_unix.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/platform/mmap_unsupported.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/platform/mmap_windows.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/platform/mremap_other.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/platform/mremap_unix.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/platform/path.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/platform/path_windows.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/platform/platform.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/platform/platform_amd64.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/platform/platform_arm64.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/platform/time.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/platform/time_cgo.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/platform/time_notcgo.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/platform/time_windows.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sock/sock.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sock/sock_supported.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sock/sock_unsupported.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sys/fs.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sys/lazy.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sys/stdio.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sys/sys.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sys/testdata/empty.txt create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sys/testdata/sub/sub/test.txt create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sys/testdata/sub/test.txt create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sys/testdata/test.txt create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/adapter.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/datasync_linux.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/datasync_unsupported.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/dir.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/dirfs.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/file.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/file_test.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/file_unix.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/file_unsupported.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/file_windows.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_darwin.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_darwin.s create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_linux.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_unsupported.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_windows.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/ino.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/ino_plan9.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/ino_windows.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/nonblock_plan9.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/nonblock_unix.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/nonblock_windows.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/oflag.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_darwin.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_freebsd.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_linux.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_notwindows.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_sun.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_unsupported.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_windows.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/osfile.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/poll.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/poll_darwin.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/poll_darwin.s create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/poll_linux.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/poll_unsupported.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/poll_windows.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/readfs.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/rename.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/rename_plan9.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/rename_windows.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/sock.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/sock_unix.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/sock_unsupported.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/sock_windows.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/stat.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/stat_bsd.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/stat_linux.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/stat_unsupported.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/stat_windows.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/sync.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/sync_windows.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/syscall6_darwin.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/sysfs.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/testdata/empty.txt create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/testdata/wazero.txt create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/unlink.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/unlink_plan9.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/sysfs/unlink_windows.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/u32/u32.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/u64/u64.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/version/version.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasip1/args.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasip1/clock.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasip1/environ.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasip1/errno.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasip1/fs.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasip1/poll.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasip1/proc.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasip1/random.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasip1/rights.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasip1/sched.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasip1/sock.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasip1/wasi.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/binary/code.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/binary/const_expr.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/binary/custom.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/binary/data.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/binary/decoder.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/binary/element.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/binary/errors.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/binary/export.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/binary/function.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/binary/global.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/binary/header.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/binary/import.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/binary/limits.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/binary/memory.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/binary/names.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/binary/section.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/binary/table.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/binary/value.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/counts.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/engine.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/func_validation.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/function_definition.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/global.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/gofunc.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/host.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/instruction.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/memory.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/memory_definition.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/module.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/module_instance.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/module_instance_lookup.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/store.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/store_module_list.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasm/table.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasmdebug/debug.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasmdebug/dwarf.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wasmruntime/errors.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wazeroir/compiler.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wazeroir/format.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wazeroir/operations.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wazeroir/signature.go create mode 100644 vendor/github.com/tetratelabs/wazero/internal/wazeroir/wazeroir.go create mode 100644 vendor/github.com/tetratelabs/wazero/netlify.toml create mode 100644 vendor/github.com/tetratelabs/wazero/runtime.go create mode 100644 vendor/github.com/tetratelabs/wazero/sys/clock.go create mode 100644 vendor/github.com/tetratelabs/wazero/sys/error.go create mode 100644 vendor/github.com/tetratelabs/wazero/sys/stat.go create mode 100644 vendor/github.com/tetratelabs/wazero/sys/stat_bsd.go create mode 100644 vendor/github.com/tetratelabs/wazero/sys/stat_linux.go create mode 100644 vendor/github.com/tetratelabs/wazero/sys/stat_unsupported.go create mode 100644 vendor/github.com/tetratelabs/wazero/sys/stat_windows.go create mode 100644 vendor/github.com/tetratelabs/wazero/testdata/index.html create mode 100644 vendor/golang.org/x/time/LICENSE create mode 100644 vendor/golang.org/x/time/PATENTS create mode 100644 vendor/golang.org/x/time/rate/rate.go create mode 100644 vendor/golang.org/x/time/rate/sometimes.go create mode 100644 vendor/golang.org/x/tools/go/types/objectpath/objectpath.go create mode 100644 vendor/golang.org/x/tools/internal/event/keys/util.go create mode 100644 vendor/golang.org/x/tools/internal/event/tag/tag.go create mode 100644 vendor/golang.org/x/tools/internal/versions/gover.go create mode 100644 vendor/golang.org/x/tools/internal/versions/types.go create mode 100644 vendor/golang.org/x/tools/internal/versions/types_go121.go create mode 100644 vendor/golang.org/x/tools/internal/versions/types_go122.go create mode 100644 vendor/golang.org/x/tools/internal/versions/versions.go create mode 100644 vendor/google.golang.org/grpc/balancer_wrapper.go create mode 100644 vendor/google.golang.org/grpc/internal/experimental.go create mode 100644 vendor/google.golang.org/grpc/internal/idle/idle.go create mode 100644 vendor/google.golang.org/grpc/internal/resolver/dns/internal/internal.go create mode 100644 vendor/google.golang.org/grpc/internal/tcp_keepalive_nonunix.go create mode 100644 vendor/google.golang.org/grpc/internal/tcp_keepalive_unix.go create mode 100644 vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go create mode 100644 vendor/google.golang.org/grpc/resolver/manual/manual.go create mode 100644 vendor/google.golang.org/grpc/resolver_wrapper.go create mode 100644 vendor/google.golang.org/protobuf/internal/editiondefaults/defaults.go create mode 100644 vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb create mode 100644 vendor/google.golang.org/protobuf/internal/filedesc/editions.go create mode 100644 vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go create mode 100644 vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go120.go create mode 100644 vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go create mode 100644 vendor/google.golang.org/protobuf/reflect/protodesc/editions.go create mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go create mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go create mode 100644 vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.pb.go create mode 100644 vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.proto diff --git a/vendor/github.com/google/go-cmp/cmp/export.go b/vendor/github.com/google/go-cmp/cmp/export.go new file mode 100644 index 000000000..29f82fe6b --- /dev/null +++ b/vendor/github.com/google/go-cmp/cmp/export.go @@ -0,0 +1,31 @@ +// Copyright 2017, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cmp + +import ( + "reflect" + "unsafe" +) + +// retrieveUnexportedField uses unsafe to forcibly retrieve any field from +// a struct such that the value has read-write permissions. +// +// The parent struct, v, must be addressable, while f must be a StructField +// describing the field to retrieve. If addr is false, +// then the returned value will be shallowed copied to be non-addressable. +func retrieveUnexportedField(v reflect.Value, f reflect.StructField, addr bool) reflect.Value { + ve := reflect.NewAt(f.Type, unsafe.Pointer(uintptr(unsafe.Pointer(v.UnsafeAddr()))+f.Offset)).Elem() + if !addr { + // A field is addressable if and only if the struct is addressable. + // If the original parent value was not addressable, shallow copy the + // value to make it non-addressable to avoid leaking an implementation + // detail of how forcibly exporting a field works. + if ve.Kind() == reflect.Interface && ve.IsNil() { + return reflect.Zero(f.Type) + } + return reflect.ValueOf(ve.Interface()).Convert(f.Type) + } + return ve +} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer.go b/vendor/github.com/google/go-cmp/cmp/internal/value/pointer.go new file mode 100644 index 000000000..e5dfff69a --- /dev/null +++ b/vendor/github.com/google/go-cmp/cmp/internal/value/pointer.go @@ -0,0 +1,34 @@ +// Copyright 2018, The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package value + +import ( + "reflect" + "unsafe" +) + +// Pointer is an opaque typed pointer and is guaranteed to be comparable. +type Pointer struct { + p unsafe.Pointer + t reflect.Type +} + +// PointerOf returns a Pointer from v, which must be a +// reflect.Ptr, reflect.Slice, or reflect.Map. +func PointerOf(v reflect.Value) Pointer { + // The proper representation of a pointer is unsafe.Pointer, + // which is necessary if the GC ever uses a moving collector. + return Pointer{unsafe.Pointer(v.Pointer()), v.Type()} +} + +// IsNil reports whether the pointer is nil. +func (p Pointer) IsNil() bool { + return p.p == nil +} + +// Uintptr returns the pointer as a uintptr. +func (p Pointer) Uintptr() uintptr { + return uintptr(p.p) +} diff --git a/vendor/github.com/google/s2a-go/retry/retry.go b/vendor/github.com/google/s2a-go/retry/retry.go new file mode 100644 index 000000000..f7e0a2377 --- /dev/null +++ b/vendor/github.com/google/s2a-go/retry/retry.go @@ -0,0 +1,144 @@ +/* + * + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package retry provides a retry helper for talking to S2A gRPC server. +// The implementation is modeled after +// https://github.com/googleapis/google-cloud-go/blob/main/compute/metadata/retry.go +package retry + +import ( + "context" + "math/rand" + "time" + + "google.golang.org/grpc/grpclog" +) + +const ( + maxRetryAttempts = 5 + maxRetryForLoops = 10 +) + +type defaultBackoff struct { + max time.Duration + mul float64 + cur time.Duration +} + +// Pause returns a duration, which is used as the backoff wait time +// before the next retry. +func (b *defaultBackoff) Pause() time.Duration { + d := time.Duration(1 + rand.Int63n(int64(b.cur))) + b.cur = time.Duration(float64(b.cur) * b.mul) + if b.cur > b.max { + b.cur = b.max + } + return d +} + +// Sleep will wait for the specified duration or return on context +// expiration. +func Sleep(ctx context.Context, d time.Duration) error { + t := time.NewTimer(d) + select { + case <-ctx.Done(): + t.Stop() + return ctx.Err() + case <-t.C: + return nil + } +} + +// NewRetryer creates an instance of S2ARetryer using the defaultBackoff +// implementation. +var NewRetryer = func() *S2ARetryer { + return &S2ARetryer{bo: &defaultBackoff{ + cur: 100 * time.Millisecond, + max: 30 * time.Second, + mul: 2, + }} +} + +type backoff interface { + Pause() time.Duration +} + +// S2ARetryer implements a retry helper for talking to S2A gRPC server. +type S2ARetryer struct { + bo backoff + attempts int +} + +// Attempts return the number of retries attempted. +func (r *S2ARetryer) Attempts() int { + return r.attempts +} + +// Retry returns a boolean indicating whether retry should be performed +// and the backoff duration. +func (r *S2ARetryer) Retry(err error) (time.Duration, bool) { + if err == nil { + return 0, false + } + if r.attempts >= maxRetryAttempts { + return 0, false + } + r.attempts++ + return r.bo.Pause(), true +} + +// Run uses S2ARetryer to execute the function passed in, until success or reaching +// max number of retry attempts. +func Run(ctx context.Context, f func() error) { + retryer := NewRetryer() + forLoopCnt := 0 + var err error + for { + err = f() + if bo, shouldRetry := retryer.Retry(err); shouldRetry { + if grpclog.V(1) { + grpclog.Infof("will attempt retry: %v", err) + } + if ctx.Err() != nil { + if grpclog.V(1) { + grpclog.Infof("exit retry loop due to context error: %v", ctx.Err()) + } + break + } + if errSleep := Sleep(ctx, bo); errSleep != nil { + if grpclog.V(1) { + grpclog.Infof("exit retry loop due to sleep error: %v", errSleep) + } + break + } + // This shouldn't happen, just make sure we are not stuck in the for loops. + forLoopCnt++ + if forLoopCnt > maxRetryForLoops { + if grpclog.V(1) { + grpclog.Infof("exit the for loop after too many retries") + } + break + } + continue + } + if grpclog.V(1) { + grpclog.Infof("retry conditions not met, exit the loop") + } + break + } +} diff --git a/vendor/github.com/google/s2a-go/testdata/mds_client_cert.pem b/vendor/github.com/google/s2a-go/testdata/mds_client_cert.pem new file mode 100644 index 000000000..60c4cf069 --- /dev/null +++ b/vendor/github.com/google/s2a-go/testdata/mds_client_cert.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDCDCCAfACFFlYsYCFit01ZpYmfjxpo7/6wMEbMA0GCSqGSIb3DQEBCwUAMEgx +CzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEPMA0GA1UECgwGR29vZ2xlMRswGQYD +VQQDDBJ0ZXN0LXMyYS1tdGxzLXJvb3QwHhcNMjMwODIyMTY0NTE4WhcNNDMwODIy +MTY0NTE4WjA5MQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExHTAbBgNVBAMMFHRl +c3QtczJhLW10bHMtY2xpZW50MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC +AQEAqrQQMyxNtmdCB+uY3szgRsfPrKC+TV9Fusnd8PfaCVuGTGcSBKM018nV2TDn +3IYFQ1HgLpGwGwOFDBb3y0o9i2/l2VJySriX1GSNX6nDmVasQlO1wuOLCP7/LRmO +7b6Kise5W0IFhYaptKyWnekn2pS0tAjimqpfn2w0U6FDGtQUqg/trQQmGtTSJHjb +A+OFd0EFC18KGP8Q+jOMaMkJRmpeEiAPyHPDoMhqQNT26RApv9j2Uzo4SuXzHH6T +cAdm1+zG+EXY/UZKX9oDkSbwIJvN+gCmNyORLalJ12gsGYOCjMd8K0mlXBqrmmbO +VHVbUm9062lhE7x59AA8DK4DoQIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQCPOvtL +dq2hxFHlIy0YUK8jp/DtwJZPwzx1id5FtWwd0CxBS1StIgmkHMxtkJGz1iyQLplI +je+Msd4sTsb5zZi/8kGKehi8Wj4lghp4oP30cpob41OvM68M9RC/wSOVk9igSww+ +l3zof6wKRIswsi5VHrL16ruIVVoDlyFbKr8yk+cp9OPOV8hNNN7ewY9xC8OgnTt8 +YtdaLe6uTplKBLW+j3GtshigRhyfkGJyPFYL4LAeDJCHlC1qmBnkyP0ijMp6vneM +E8TLavnMTMcpihWTWpyKeRkO6HDRsP4AofQAp7VAiAdSOplga+w2qgrVICV+m8MK +BTq2PBvc59T6OFLq +-----END CERTIFICATE----- diff --git a/vendor/github.com/google/s2a-go/testdata/mds_client_key.pem b/vendor/github.com/google/s2a-go/testdata/mds_client_key.pem new file mode 100644 index 000000000..9d112d1e9 --- /dev/null +++ b/vendor/github.com/google/s2a-go/testdata/mds_client_key.pem @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCqtBAzLE22Z0IH +65jezOBGx8+soL5NX0W6yd3w99oJW4ZMZxIEozTXydXZMOfchgVDUeAukbAbA4UM +FvfLSj2Lb+XZUnJKuJfUZI1fqcOZVqxCU7XC44sI/v8tGY7tvoqKx7lbQgWFhqm0 +rJad6SfalLS0COKaql+fbDRToUMa1BSqD+2tBCYa1NIkeNsD44V3QQULXwoY/xD6 +M4xoyQlGal4SIA/Ic8OgyGpA1PbpECm/2PZTOjhK5fMcfpNwB2bX7Mb4Rdj9Rkpf +2gORJvAgm836AKY3I5EtqUnXaCwZg4KMx3wrSaVcGquaZs5UdVtSb3TraWETvHn0 +ADwMrgOhAgMBAAECggEAUccupZ1ZY4OHTi0PkNk8rpwFwTFGyeFVEf2ofkr24RnA +NnUAXEllxOUUNlcoFOz9s3kTeavg3qgqgpa0QmdAIb9LMXg+ec6CKkW7trMpGho8 +LxBUWNfSoU4sKEqAvyPT0lWJVo9D/up6/avbAi6TIbOw+Djzel4ZrlHTpabxc3WT +EilXzn4q54b3MzxCQeQjcnzTieW4Q5semG2kLiXFToHIY2di01P/O8awUjgrD+uW +/Cb6H49MnHm9VPkqea1iwZeMQd6Gh5FrC7RezsBjdB1JBcfsv6PFt2ySInjB8SF+ +XR5Gr3Cc5sh9s0LfprZ9Dq0rlSWmwasPMI1COK6SswKBgQDczgeWd3erQ1JX9LEI +wollawqC9y7uJhEsw1hrPqA3uqZYiLUc7Nmi4laZ12mcGoXNDS3R3XmD58qGmGaU +lxEVTb8KDVWBgw450VoBKzSMQnCP6zn4nZxTYxeqMKjDGf6TRB6TZc843qsG3eRC +k91yxrCQ/0HV6PT48C+lieDzLwKBgQDF6aNKiyrswr457undBnM1H8q/Y6xC5ZlK +UtiQdhuyBnicvz0U8WPxBY/8gha0OXWuSnBqq/z77iFVNv/zT6p9K7kM7nBGd8cB +8KO6FNbyaHWFrhCI5zNzRTH4oha0hfvUOoti09vqavCtWD4L+D/63ba1wNLKPO9o +4gWbCnUCLwKBgQC/vus372csgrnvR761LLrEJ8BpGt7WUJh5luoht7DKtHvgRleB +Vu1oVcV+s2Iy/ZVUDC3OIdZ0hcWKPK5YOxfKuEk+IXYvke+4peTTPwHTC59UW6Fs +FPK8N0FFuhvT0a8RlAY5WiAp8rPysp6WcnHMSl7qi8BQUozp4Sp/RsziYQKBgBXv +r4mzoy5a53rEYGd/L4XT4EUWZyGDEVqLlDVu4eL5lKTLDZokp08vrqXuRVX0iHap +CYzJQ2EpI8iuL/BoBB2bmwcz5n3pCMXORld5t9lmeqA2it6hwbIlGUTVsm6P6zm6 +w3hQwy9YaxTLkxUAjxbfPEEo/jQsTNzzMGve3NlBAoGAbgJExpDyMDnaD2Vi5eyr +63b54BsqeLHqxJmADifyRCj7G1SJMm3zMKkNNOS0vsXgoiId973STFf1XQiojiv8 +Slbxyv5rczcY0n3LOuQYcM5OzsjzpNFZsT2dDnMfNRUF3rx3Geu/FuJ9scF1b00r +fVMrcL3jSf/W1Xh4TgtyoU8= +-----END PRIVATE KEY----- diff --git a/vendor/github.com/google/s2a-go/testdata/mds_root_cert.pem b/vendor/github.com/google/s2a-go/testdata/mds_root_cert.pem new file mode 100644 index 000000000..44e436f6e --- /dev/null +++ b/vendor/github.com/google/s2a-go/testdata/mds_root_cert.pem @@ -0,0 +1,21 @@ +-----BEGIN CERTIFICATE----- +MIIDcTCCAlmgAwIBAgIUDUkgI+2FZtuUHyUUi0ZBH7JvN00wDQYJKoZIhvcNAQEL +BQAwSDELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQ8wDQYDVQQKDAZHb29nbGUx +GzAZBgNVBAMMEnRlc3QtczJhLW10bHMtcm9vdDAeFw0yMzA4MjEyMTI5MTVaFw00 +MzA4MjEyMTI5MTVaMEgxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEPMA0GA1UE +CgwGR29vZ2xlMRswGQYDVQQDDBJ0ZXN0LXMyYS1tdGxzLXJvb3QwggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCbFEQfpvla27bATedrN4BAWsI9GSwSnJLW +QWzXcnAk6cKxQBAhnaKHRxHY8ttLhNTtxQeub894CLzJvHE/0xDhuMzjtCCCZ7i2 +r08tKZ1KcEzPJCPNlxlzAXPA45XU3LRlbGvju/PBPhm6n1hCEKTNI/KETJ5DEaYg +Cf2LcXVsl/zW20MwDZ+e2w/9a2a6n6DdpW1ekOR550hXAUOIxvmXRBeYeGLFvp1n +rQgZBhRaxP03UB+PQD2oMi/4mfsS96uGCXdzzX8qV46O8m132HUbnA/wagIwboEe +d7Bx237dERDyHw5GFnll7orgA0FOtoEufXdeQxWVvTjO0+PVPgsvAgMBAAGjUzBR +MB0GA1UdDgQWBBRyMtg/yutV8hw8vOq0i8x0eBQi7DAfBgNVHSMEGDAWgBRyMtg/ +yutV8hw8vOq0i8x0eBQi7DAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUA +A4IBAQArN/gdqWMxd5Rvq2eJMTp6I4RepJOT7Go4sMsRsy1caJqqcoS2EvREDZMN +XNEBcyQBB5kYd6TCcZGoLnEtWYXQ4jjEiXG1g7/+rWxyqw0ZYuP7FWzuHg3Uor/x +fApbEKwptP5ywVc+33h4qreGcqXkVCCn+sAcstGgrqubdGZW2T5gazUMyammOOuN +9IWL1PbvXmgEKD+80NUIrk09zanYyrElGdU/zw/kUbZ3Jf6WUBtJGhTzRQ1qZeKa +VnpCbLoG3vObEB8mxDUAlIzwAtfvw4U32BVIZA8xrocz6OOoAnSW1bTlo3EOIo/G +MTV7jmY9TBPtfhRuO/cG650+F+cw +-----END CERTIFICATE----- diff --git a/vendor/github.com/google/s2a-go/testdata/mds_server_cert.pem b/vendor/github.com/google/s2a-go/testdata/mds_server_cert.pem new file mode 100644 index 000000000..68c606134 --- /dev/null +++ b/vendor/github.com/google/s2a-go/testdata/mds_server_cert.pem @@ -0,0 +1,21 @@ +-----BEGIN CERTIFICATE----- +MIIDbjCCAlagAwIBAgIUbexZ5sZl86Al9dsI2PkOgtqKnkgwDQYJKoZIhvcNAQEL +BQAwSDELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQ8wDQYDVQQKDAZHb29nbGUx +GzAZBgNVBAMMEnRlc3QtczJhLW10bHMtcm9vdDAeFw0yMzA4MjIwMDMyMDRaFw00 +MzA4MjIwMDMyMDRaMDkxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEdMBsGA1UE +AwwUdGVzdC1zMmEtbXRscy1zZXJ2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw +ggEKAoIBAQCMEzybsGPqfh92GLwy43mt8kQDF3ztr8y06RwU1hVnY7QqYK4obpvh +HkJVnTz9gwNBF3n5nUalqRzactlf2PCydN9oSYNCO8svVmo7vw1CleKAKFAiV5Qn +H76QlqD15oJreh7nSM8R4qj5KukIHvt0cN0gD6CJQzIURDtsKJwkW3yQjYyT/FAK +GYtFrB6buDn3Eg3Hsw6z7uj7CzLBsSl7BIGrQILbpbI9nFNT3rUTUhXZKY/3UtJA +Ob66AjTmMbD16RGYZR4JsPx6CstheifJ6YSI79r5KgD37zX0jMXFWimvb2SmZmFe +LoohtC8K7uTyjm/dROx6nHXdDt5TQYXHAgMBAAGjXzBdMBsGA1UdEQQUMBKHEAAA +AAAAAAAAAAAAAAAAAAAwHQYDVR0OBBYEFI3i2+tIk6YYn0MIxC0q93jk1VsUMB8G +A1UdIwQYMBaAFHIy2D/K61XyHDy86rSLzHR4FCLsMA0GCSqGSIb3DQEBCwUAA4IB +AQAUhk+s/lrIAULBbU7E22C8f93AzTxE1mhyHGNlfPPJP3t1Dl+h4X4WkFpkz5gT +EcNXB//Vvoq99HbEK5/92sxsIPexKdJBdcggeHXIgLDkOrEZEb0Nnh9eaAuU2QDn +JW44hMB+aF6mEaJvOHE6DRkQw3hwFYFisFKKHtlQ3TyOhw5CHGzSExPZusdSFNIe +2E7V/0QzGPJEFnEFUNe9N8nTH2P385Paoi+5+Iizlp/nztVXfzv0Cj/i+qGgtDUs +HB+gBU2wxMw8eYyuNzACH70wqGR1Parj8/JoyYhx0S4+Gjzy3JH3CcAMaxyfH/dI +4Wcvfz/isxgmH1UqIt3oc6ad +-----END CERTIFICATE----- diff --git a/vendor/github.com/google/s2a-go/testdata/mds_server_key.pem b/vendor/github.com/google/s2a-go/testdata/mds_server_key.pem new file mode 100644 index 000000000..b14ad0f72 --- /dev/null +++ b/vendor/github.com/google/s2a-go/testdata/mds_server_key.pem @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCMEzybsGPqfh92 +GLwy43mt8kQDF3ztr8y06RwU1hVnY7QqYK4obpvhHkJVnTz9gwNBF3n5nUalqRza +ctlf2PCydN9oSYNCO8svVmo7vw1CleKAKFAiV5QnH76QlqD15oJreh7nSM8R4qj5 +KukIHvt0cN0gD6CJQzIURDtsKJwkW3yQjYyT/FAKGYtFrB6buDn3Eg3Hsw6z7uj7 +CzLBsSl7BIGrQILbpbI9nFNT3rUTUhXZKY/3UtJAOb66AjTmMbD16RGYZR4JsPx6 +CstheifJ6YSI79r5KgD37zX0jMXFWimvb2SmZmFeLoohtC8K7uTyjm/dROx6nHXd +Dt5TQYXHAgMBAAECggEAIB5zGdIG/yh/Z1GBqfuOFaxFGx5iJ5BVlLAVH9P9IXFz +yPnVRXEjbinFlSMSbqEBeIX9EpcVMXxHIPIP1RIGEy2IYr3kiqXyT771ahDDZh6/ +Spqz0UQatSPqyvW3H9uE0Uc12dvQm23JSCUmPRX5m7gbhDQBIChXzdzdcU4Yi59V +4xmJUvbsAcLw5CBM6kwV+1NGVH9+3mUdhrr9M6B6+sVB/xnaqMGEDfQGiwL8U7EY +QOuc46KXu3Pd/qCdVLn60IrdjSzDJKeC5UZZ+ejNAo+DfbtOovBj3qu3OCUg4XVy +0CDBJ1sTdLvUfF4Gb+crjPsd+qBbXcjVfqdadwhsoQKBgQDBF1Pys/NitW8okJwp +2fiDIASP3TiI+MthWHGyuoZGPvmXQ3H6iuLSm8c/iYI2WPTf53Xff1VcFm1GmQms +GCsYM8Ax94zCeO6Ei1sYYxwcBloEZfOeV37MPA4pjJF4Lt+n5nveNxP+lrsjksJz +wToSEgWPDT1b/xcdt4/5j9J85wKBgQC5tiLx+33mwH4DoaFRmSl0+VuSNYFw6DTQ +SQ+kWqWGH4NENc9wf4Dj2VUZQhpXNhXVSxj+aP2d/ck1NrTJAWqYEXCDtFQOGSa2 +cGPRr+Fhy5NIEaEvR7IXcMBZzx3koYmWVBHricyrXs5FvHrT3N14mGDUG8n24U3f +R799bau0IQKBgQC97UM+lHCPJCWNggiJRgSifcje9VtZp1btjoBvq/bNe74nYkjn +htsrC91Fiu1Qpdlfr50K1IXSyaB886VG6JLjAGxI+dUzqJ38M9LLvxj0G+9JKjsi +AbAQFfZcOg8QZxLJZPVsE0MQhZTXndC06VhEVAOxvPUg214Sde8hK61/+wKBgCRw +O10VhnePT2pw/VEgZ0T/ZFtEylgYB7zSiRIrgwzVBBGPKVueePC8BPmGwdpYz2Hh +cU8B1Ll6QU+Co2hJMdwSl+wPpup5PuJPHRbYlrV0lzpt0x2OyL/WrLcyb2Ab3f40 +EqwPhqwdVwXR3JvTW1U9OMqFhVQ+kuP7lPQMX8NhAoGBAJOgZ7Tokipc4Mi68Olw +SCaOPvjjy4sW2rTRuKyjc1wTAzy7SJ3vXHfGkkN99nTLJFwAyJhWUpnRdwAXGi+x +gyOa95ImsEfRSwEjbluWfF8/P0IU8GR+ZTqT4NnNCOsi8T/xst4Szd1ECJNnnZDe +1ChfPP1AH+/75MJCvu6wQBQv +-----END PRIVATE KEY----- diff --git a/vendor/github.com/google/s2a-go/testdata/self_signed_cert.pem b/vendor/github.com/google/s2a-go/testdata/self_signed_cert.pem new file mode 100644 index 000000000..ad1bad598 --- /dev/null +++ b/vendor/github.com/google/s2a-go/testdata/self_signed_cert.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDITCCAgkCFBS8mLoytMpMWBwpAtnRaq3eIKnsMA0GCSqGSIb3DQEBCwUAME0x +CzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UECgwEVGVzdDEiMCAGA1UE +AwwZdGVzdC1zMmEtbXRscy1zZWxmLXNpZ25lZDAeFw0yMzA4MjIyMTE2MDFaFw00 +MzA4MjIyMTE2MDFaME0xCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UE +CgwEVGVzdDEiMCAGA1UEAwwZdGVzdC1zMmEtbXRscy1zZWxmLXNpZ25lZDCCASIw +DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKFFPsYasKZeCFLEXl3RpE/ZOXFe +2lhutIalSpZvCmso+mQGoZ4cHK7At+kDjBi5CrnXkYcw7quQAhHgU0frhWdj7tsW +HUUtq7T8eaGWKBnVD9fl+MjtAl1BmhXwV9qRBbj4EesSKGDSGpKf66dOtzw83JbB +cU7XlPAH1c1zo2GXC1himcZ+SVGHVrOjn4NmeFs8g94/Dke8dWkHwv5YTMVugFK4 +5KxKgSOKkr4ka7PCBzgxCnW4wYSZNRHcxrqkiArO2HAQq0ACr7u+fVDYH//9mP2Z +ADo/zch7O5yhkiNbjXJIRrptDWEuVYMRloYDhT773h7bV/Q0Wo0NQGtasJ8CAwEA +ATANBgkqhkiG9w0BAQsFAAOCAQEAPjbH0TMyegF/MDvglkc0sXr6DqlmTxDCZZmG +lYPZ5Xy062+rxIHghMARbvO4BxepiG37KsP2agvOldm4TtU8nQ8LyswmSIFm4BQ+ +XQWwdsWyYyd8l0d5sXAdaN6AXwy50fvqCepmEqyreMY6dtLzlwo9gVCBFB7QuAPt +Nc14phpEUZt/KPNuY6cUlB7bz3tmnFbwxUrWj1p0KBEYsr7+KEVZxR+z0wtlU7S9 +ZBrmUvx0fq5Ef7JWtHW0w4ofg1op742sdYl+53C26GZ76ts4MmqVz2/94DScgRaU +gT0GLVuuCZXRDVeTXqTb4mditRCfzFPe9cCegYhGhSqBs8yh5A== +-----END CERTIFICATE----- diff --git a/vendor/github.com/google/s2a-go/testdata/self_signed_key.pem b/vendor/github.com/google/s2a-go/testdata/self_signed_key.pem new file mode 100644 index 000000000..bcf08e4f1 --- /dev/null +++ b/vendor/github.com/google/s2a-go/testdata/self_signed_key.pem @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQChRT7GGrCmXghS +xF5d0aRP2TlxXtpYbrSGpUqWbwprKPpkBqGeHByuwLfpA4wYuQq515GHMO6rkAIR +4FNH64VnY+7bFh1FLau0/HmhligZ1Q/X5fjI7QJdQZoV8FfakQW4+BHrEihg0hqS +n+unTrc8PNyWwXFO15TwB9XNc6NhlwtYYpnGfklRh1azo5+DZnhbPIPePw5HvHVp +B8L+WEzFboBSuOSsSoEjipK+JGuzwgc4MQp1uMGEmTUR3Ma6pIgKzthwEKtAAq+7 +vn1Q2B///Zj9mQA6P83IezucoZIjW41ySEa6bQ1hLlWDEZaGA4U++94e21f0NFqN +DUBrWrCfAgMBAAECggEAR8e8YwyqJ8KezcgdgIC5M9kp2i4v3UCZFX0or8CI0J2S +pUbWVLuKgLXCpfIwPyjNf15Vpei/spkMcsx4BQDthdFTFSzIpmvni0z9DlD5VFYj +ESOJElV7wepbHPy2/c+izmuL/ic81aturGiFyRgeMq+cN3WuaztFTXkPTrzzsZGF +p/Mx3gqm7Hoc3d2xlv+8L5GjCtEJPlQgZJV+s3ennBjOAd8CC7d9qJetE3Er46pn +r5jedV3bQRZYBzmooYNHjbAs26++wYac/jTE0/U6nKS17eWq4BQZUtlMXUw5N81B +7LKn7C03rj2KCn+Nf5uin9ALmoy888LXCDdvL/NZkQKBgQDduv1Heu+tOZuNYUdQ +Hswmd8sVNAAWGZxdxixHMv58zrgbLFXSX6K89X2l5Sj9XON8TH46MuSFdjSwwWw5 +fBrhVEhA5srcqpvVWIBE05yqPpt0s1NQktMWJKELWlG8jOhVKwM5OYDpdxtwehpz +1g70XJz+nF/LTV8RdTK+OWDDpQKBgQC6MhdbGHUz/56dY3gZpE5TXnN2hkNbZCgk +emr6z85VHhQflZbedhCzB9PUnZnCKWOGQHQdxRTtRfd46LVboZqCdYO1ZNQv6toP +ysS7dTpZZFy7CpQaW0Y6/jS65jW6xIDKR1W40vgltZ3sfpG37JaowpzWdw2WuOnw +Bg0rcJAf8wKBgQCqE+p/z97UwuF8eufWnyj9QNo382E1koOMspv4KTdnyLETtthF +vDH6O1wbykG8xmmASLRyM+NyNA+KnXNETNvZh2q8zctBpGRQK8iIAsGjHM7ln0AD +B/x+ea5GJQuZU4RK/+lDFca6TjBwAFkWDVX/PqL18kDQkxKfM4SuwRhmOQKBgDGh +eoJIsa0LnP787Z2AI3Srf4F/ZmLs/ppCm1OBotEjdF+64v0nYWonUvqgi8SqfaHi +elEZIGvis4ViGj1zhRjzNAlc+AZRxpBhDzGcnNIJI4Kj3jhsTfsZmXqcNIQ1LtM8 +Uogyi/yZPaA1WKg7Aym2vlGYaGHdplXZdxc2KOSrAoGABRkD9l2OVcwK7RyNgFxo +mjxx0tfUdDBhHIi2igih1FiHpeP9E+4/kE/K7PnU9DoDrL1jW1MTpXaYV4seOylk +k9z/9QfcRa9ePD2N4FqbHWSYp5n3aLoIcGq/9jyjTwayZbbIhWO+vNuHE9wIvecZ +8x3gNkxJRb4NaLIoNzAhCoo= +-----END PRIVATE KEY----- diff --git a/vendor/github.com/google/uuid/version6.go b/vendor/github.com/google/uuid/version6.go new file mode 100644 index 000000000..339a959a7 --- /dev/null +++ b/vendor/github.com/google/uuid/version6.go @@ -0,0 +1,56 @@ +// Copyright 2023 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import "encoding/binary" + +// UUID version 6 is a field-compatible version of UUIDv1, reordered for improved DB locality. +// It is expected that UUIDv6 will primarily be used in contexts where there are existing v1 UUIDs. +// Systems that do not involve legacy UUIDv1 SHOULD consider using UUIDv7 instead. +// +// see https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-03#uuidv6 +// +// NewV6 returns a Version 6 UUID based on the current NodeID and clock +// sequence, and the current time. If the NodeID has not been set by SetNodeID +// or SetNodeInterface then it will be set automatically. If the NodeID cannot +// be set NewV6 set NodeID is random bits automatically . If clock sequence has not been set by +// SetClockSequence then it will be set automatically. If GetTime fails to +// return the current NewV6 returns Nil and an error. +func NewV6() (UUID, error) { + var uuid UUID + now, seq, err := GetTime() + if err != nil { + return uuid, err + } + + /* + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | time_high | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | time_mid | time_low_and_version | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + |clk_seq_hi_res | clk_seq_low | node (0-1) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | node (2-5) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ + + binary.BigEndian.PutUint64(uuid[0:], uint64(now)) + binary.BigEndian.PutUint16(uuid[8:], seq) + + uuid[6] = 0x60 | (uuid[6] & 0x0F) + uuid[8] = 0x80 | (uuid[8] & 0x3F) + + nodeMu.Lock() + if nodeID == zeroID { + setNodeInterface("") + } + copy(uuid[10:], nodeID[:]) + nodeMu.Unlock() + + return uuid, nil +} diff --git a/vendor/github.com/google/uuid/version7.go b/vendor/github.com/google/uuid/version7.go new file mode 100644 index 000000000..ba9dd5eb6 --- /dev/null +++ b/vendor/github.com/google/uuid/version7.go @@ -0,0 +1,75 @@ +// Copyright 2023 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "io" +) + +// UUID version 7 features a time-ordered value field derived from the widely +// implemented and well known Unix Epoch timestamp source, +// the number of milliseconds seconds since midnight 1 Jan 1970 UTC, leap seconds excluded. +// As well as improved entropy characteristics over versions 1 or 6. +// +// see https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-03#name-uuid-version-7 +// +// Implementations SHOULD utilize UUID version 7 over UUID version 1 and 6 if possible. +// +// NewV7 returns a Version 7 UUID based on the current time(Unix Epoch). +// Uses the randomness pool if it was enabled with EnableRandPool. +// On error, NewV7 returns Nil and an error +func NewV7() (UUID, error) { + uuid, err := NewRandom() + if err != nil { + return uuid, err + } + makeV7(uuid[:]) + return uuid, nil +} + +// NewV7FromReader returns a Version 7 UUID based on the current time(Unix Epoch). +// it use NewRandomFromReader fill random bits. +// On error, NewV7FromReader returns Nil and an error. +func NewV7FromReader(r io.Reader) (UUID, error) { + uuid, err := NewRandomFromReader(r) + if err != nil { + return uuid, err + } + + makeV7(uuid[:]) + return uuid, nil +} + +// makeV7 fill 48 bits time (uuid[0] - uuid[5]), set version b0111 (uuid[6]) +// uuid[8] already has the right version number (Variant is 10) +// see function NewV7 and NewV7FromReader +func makeV7(uuid []byte) { + /* + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | unix_ts_ms | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | unix_ts_ms | ver | rand_a | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + |var| rand_b | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | rand_b | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ + _ = uuid[15] // bounds check + + t := timeNow().UnixMilli() + + uuid[0] = byte(t >> 40) + uuid[1] = byte(t >> 32) + uuid[2] = byte(t >> 24) + uuid[3] = byte(t >> 16) + uuid[4] = byte(t >> 8) + uuid[5] = byte(t) + + uuid[6] = 0x70 | (uuid[6] & 0x0F) + // uuid[8] has already has right version +} diff --git a/vendor/github.com/onsi/gomega/internal/polling_signal_error.go b/vendor/github.com/onsi/gomega/internal/polling_signal_error.go new file mode 100644 index 000000000..83b04b1a4 --- /dev/null +++ b/vendor/github.com/onsi/gomega/internal/polling_signal_error.go @@ -0,0 +1,106 @@ +package internal + +import ( + "errors" + "fmt" + "time" +) + +type PollingSignalErrorType int + +const ( + PollingSignalErrorTypeStopTrying PollingSignalErrorType = iota + PollingSignalErrorTypeTryAgainAfter +) + +type PollingSignalError interface { + error + Wrap(err error) PollingSignalError + Attach(description string, obj any) PollingSignalError + Now() +} + +var StopTrying = func(message string) PollingSignalError { + return &PollingSignalErrorImpl{ + message: message, + pollingSignalErrorType: PollingSignalErrorTypeStopTrying, + } +} + +var TryAgainAfter = func(duration time.Duration) PollingSignalError { + return &PollingSignalErrorImpl{ + message: fmt.Sprintf("told to try again after %s", duration), + duration: duration, + pollingSignalErrorType: PollingSignalErrorTypeTryAgainAfter, + } +} + +type PollingSignalErrorAttachment struct { + Description string + Object any +} + +type PollingSignalErrorImpl struct { + message string + wrappedErr error + pollingSignalErrorType PollingSignalErrorType + duration time.Duration + Attachments []PollingSignalErrorAttachment +} + +func (s *PollingSignalErrorImpl) Wrap(err error) PollingSignalError { + s.wrappedErr = err + return s +} + +func (s *PollingSignalErrorImpl) Attach(description string, obj any) PollingSignalError { + s.Attachments = append(s.Attachments, PollingSignalErrorAttachment{description, obj}) + return s +} + +func (s *PollingSignalErrorImpl) Error() string { + if s.wrappedErr == nil { + return s.message + } else { + return s.message + ": " + s.wrappedErr.Error() + } +} + +func (s *PollingSignalErrorImpl) Unwrap() error { + if s == nil { + return nil + } + return s.wrappedErr +} + +func (s *PollingSignalErrorImpl) Now() { + panic(s) +} + +func (s *PollingSignalErrorImpl) IsStopTrying() bool { + return s.pollingSignalErrorType == PollingSignalErrorTypeStopTrying +} + +func (s *PollingSignalErrorImpl) IsTryAgainAfter() bool { + return s.pollingSignalErrorType == PollingSignalErrorTypeTryAgainAfter +} + +func (s *PollingSignalErrorImpl) TryAgainDuration() time.Duration { + return s.duration +} + +func AsPollingSignalError(actual interface{}) (*PollingSignalErrorImpl, bool) { + if actual == nil { + return nil, false + } + if actualErr, ok := actual.(error); ok { + var target *PollingSignalErrorImpl + if errors.As(actualErr, &target) { + return target, true + } else { + return nil, false + } + } + + return nil, false +} diff --git a/vendor/github.com/onsi/gomega/matchers/be_key_of_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_key_of_matcher.go new file mode 100644 index 000000000..449a291ef --- /dev/null +++ b/vendor/github.com/onsi/gomega/matchers/be_key_of_matcher.go @@ -0,0 +1,45 @@ +package matchers + +import ( + "fmt" + "reflect" + + "github.com/onsi/gomega/format" +) + +type BeKeyOfMatcher struct { + Map interface{} +} + +func (matcher *BeKeyOfMatcher) Match(actual interface{}) (success bool, err error) { + if !isMap(matcher.Map) { + return false, fmt.Errorf("BeKeyOf matcher needs expected to be a map type") + } + + if reflect.TypeOf(actual) == nil { + return false, fmt.Errorf("BeKeyOf matcher expects actual to be typed") + } + + var lastError error + for _, key := range reflect.ValueOf(matcher.Map).MapKeys() { + matcher := &EqualMatcher{Expected: key.Interface()} + success, err := matcher.Match(actual) + if err != nil { + lastError = err + continue + } + if success { + return true, nil + } + } + + return false, lastError +} + +func (matcher *BeKeyOfMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to be a key of", presentable(valuesOf(matcher.Map))) +} + +func (matcher *BeKeyOfMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to be a key of", presentable(valuesOf(matcher.Map))) +} diff --git a/vendor/github.com/onsi/gomega/matchers/have_exact_elements.go b/vendor/github.com/onsi/gomega/matchers/have_exact_elements.go new file mode 100644 index 000000000..dca5b9446 --- /dev/null +++ b/vendor/github.com/onsi/gomega/matchers/have_exact_elements.go @@ -0,0 +1,88 @@ +package matchers + +import ( + "fmt" + + "github.com/onsi/gomega/format" +) + +type mismatchFailure struct { + failure string + index int +} + +type HaveExactElementsMatcher struct { + Elements []interface{} + mismatchFailures []mismatchFailure + missingIndex int + extraIndex int +} + +func (matcher *HaveExactElementsMatcher) Match(actual interface{}) (success bool, err error) { + matcher.resetState() + + if isMap(actual) { + return false, fmt.Errorf("error") + } + + matchers := matchers(matcher.Elements) + values := valuesOf(actual) + + lenMatchers := len(matchers) + lenValues := len(values) + + for i := 0; i < lenMatchers || i < lenValues; i++ { + if i >= lenMatchers { + matcher.extraIndex = i + continue + } + + if i >= lenValues { + matcher.missingIndex = i + return + } + + elemMatcher := matchers[i].(omegaMatcher) + match, err := elemMatcher.Match(values[i]) + if err != nil { + matcher.mismatchFailures = append(matcher.mismatchFailures, mismatchFailure{ + index: i, + failure: err.Error(), + }) + } else if !match { + matcher.mismatchFailures = append(matcher.mismatchFailures, mismatchFailure{ + index: i, + failure: elemMatcher.FailureMessage(values[i]), + }) + } + } + + return matcher.missingIndex+matcher.extraIndex+len(matcher.mismatchFailures) == 0, nil +} + +func (matcher *HaveExactElementsMatcher) FailureMessage(actual interface{}) (message string) { + message = format.Message(actual, "to have exact elements with", presentable(matcher.Elements)) + if matcher.missingIndex > 0 { + message = fmt.Sprintf("%s\nthe missing elements start from index %d", message, matcher.missingIndex) + } + if matcher.extraIndex > 0 { + message = fmt.Sprintf("%s\nthe extra elements start from index %d", message, matcher.extraIndex) + } + if len(matcher.mismatchFailures) != 0 { + message = fmt.Sprintf("%s\nthe mismatch indexes were:", message) + } + for _, mismatch := range matcher.mismatchFailures { + message = fmt.Sprintf("%s\n%d: %s", message, mismatch.index, mismatch.failure) + } + return +} + +func (matcher *HaveExactElementsMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to contain elements", presentable(matcher.Elements)) +} + +func (matcher *HaveExactElementsMatcher) resetState() { + matcher.mismatchFailures = nil + matcher.missingIndex = 0 + matcher.extraIndex = 0 +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/LICENSE b/vendor/github.com/streamdal/streamdal/libs/protos/LICENSE new file mode 100644 index 000000000..43b96d5ca --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/LICENSE @@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2023 Streamdal + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/shared/sp_shared.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/shared/sp_shared.pb.go new file mode 100644 index 000000000..83c20592a --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/shared/sp_shared.pb.go @@ -0,0 +1,161 @@ +// This has to be a separate pkg to avoid circular import problems with Go. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: shared/sp_shared.proto + +package shared + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// KVAction is a shared type that is used for protos.KVCommand and protos.KVStep. +// Note that only a subset of actions are used for protos.KVCommand (CREATE, +// UPDATE, DELETE, DELETE_ALL) while protos.KVStep uses most of them. +// +// protolint:disable:next ENUM_FIELD_NAMES_PREFIX +type KVAction int32 + +const ( + KVAction_KV_ACTION_UNSET KVAction = 0 + KVAction_KV_ACTION_GET KVAction = 1 + KVAction_KV_ACTION_CREATE KVAction = 2 + KVAction_KV_ACTION_UPDATE KVAction = 3 + KVAction_KV_ACTION_EXISTS KVAction = 4 + KVAction_KV_ACTION_DELETE KVAction = 5 + KVAction_KV_ACTION_DELETE_ALL KVAction = 6 +) + +// Enum value maps for KVAction. +var ( + KVAction_name = map[int32]string{ + 0: "KV_ACTION_UNSET", + 1: "KV_ACTION_GET", + 2: "KV_ACTION_CREATE", + 3: "KV_ACTION_UPDATE", + 4: "KV_ACTION_EXISTS", + 5: "KV_ACTION_DELETE", + 6: "KV_ACTION_DELETE_ALL", + } + KVAction_value = map[string]int32{ + "KV_ACTION_UNSET": 0, + "KV_ACTION_GET": 1, + "KV_ACTION_CREATE": 2, + "KV_ACTION_UPDATE": 3, + "KV_ACTION_EXISTS": 4, + "KV_ACTION_DELETE": 5, + "KV_ACTION_DELETE_ALL": 6, + } +) + +func (x KVAction) Enum() *KVAction { + p := new(KVAction) + *p = x + return p +} + +func (x KVAction) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (KVAction) Descriptor() protoreflect.EnumDescriptor { + return file_shared_sp_shared_proto_enumTypes[0].Descriptor() +} + +func (KVAction) Type() protoreflect.EnumType { + return &file_shared_sp_shared_proto_enumTypes[0] +} + +func (x KVAction) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use KVAction.Descriptor instead. +func (KVAction) EnumDescriptor() ([]byte, []int) { + return file_shared_sp_shared_proto_rawDescGZIP(), []int{0} +} + +var File_shared_sp_shared_proto protoreflect.FileDescriptor + +var file_shared_sp_shared_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x70, 0x5f, 0x73, 0x68, 0x61, 0x72, + 0x65, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2a, 0xa4, 0x01, 0x0a, 0x08, 0x4b, 0x56, 0x41, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x4b, 0x56, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, + 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x45, 0x54, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x4b, 0x56, 0x5f, + 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x47, 0x45, 0x54, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, + 0x4b, 0x56, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, + 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x4b, 0x56, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x03, 0x12, 0x14, 0x0a, 0x10, 0x4b, 0x56, 0x5f, 0x41, + 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x45, 0x58, 0x49, 0x53, 0x54, 0x53, 0x10, 0x04, 0x12, 0x14, + 0x0a, 0x10, 0x4b, 0x56, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x44, 0x45, 0x4c, 0x45, + 0x54, 0x45, 0x10, 0x05, 0x12, 0x18, 0x0a, 0x14, 0x4b, 0x56, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, + 0x4e, 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x5f, 0x41, 0x4c, 0x4c, 0x10, 0x06, 0x42, 0x43, + 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, + 0x2f, 0x6c, 0x69, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x62, 0x75, 0x69, + 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x73, 0x68, 0x61, + 0x72, 0x65, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_shared_sp_shared_proto_rawDescOnce sync.Once + file_shared_sp_shared_proto_rawDescData = file_shared_sp_shared_proto_rawDesc +) + +func file_shared_sp_shared_proto_rawDescGZIP() []byte { + file_shared_sp_shared_proto_rawDescOnce.Do(func() { + file_shared_sp_shared_proto_rawDescData = protoimpl.X.CompressGZIP(file_shared_sp_shared_proto_rawDescData) + }) + return file_shared_sp_shared_proto_rawDescData +} + +var file_shared_sp_shared_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_shared_sp_shared_proto_goTypes = []interface{}{ + (KVAction)(0), // 0: protos.shared.KVAction +} +var file_shared_sp_shared_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_shared_sp_shared_proto_init() } +func file_shared_sp_shared_proto_init() { + if File_shared_sp_shared_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_shared_sp_shared_proto_rawDesc, + NumEnums: 1, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_shared_sp_shared_proto_goTypes, + DependencyIndexes: file_shared_sp_shared_proto_depIdxs, + EnumInfos: file_shared_sp_shared_proto_enumTypes, + }.Build() + File_shared_sp_shared_proto = out.File + file_shared_sp_shared_proto_rawDesc = nil + file_shared_sp_shared_proto_goTypes = nil + file_shared_sp_shared_proto_depIdxs = nil +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_bus.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_bus.pb.go new file mode 100644 index 000000000..cabc64441 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_bus.pb.go @@ -0,0 +1,511 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: sp_bus.proto + +package protos + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Type used by `server` for broadcasting events to other nodes +type BusEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Source string `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"` + // This _should_ contain request messages - each server can determine + // how to interpret and handle the message. + // + // NOTE: The bus _should not_ be used for transmitting commands to SDKs. The + // consumer in each SDK should receive a request and potentially craft a new + // command to send to the appropriate SDK(s). + // + // Types that are assignable to Event: + // + // *BusEvent_RegisterRequest + // *BusEvent_DeregisterRequest + // *BusEvent_CreatePipelineRequest + // *BusEvent_DeletePipelineRequest + // *BusEvent_UpdatePipelineRequest + // *BusEvent_PausePipelineRequest + // *BusEvent_ResumePipelineRequest + // *BusEvent_MetricsRequest + // *BusEvent_KvRequest + // *BusEvent_DeleteAudienceRequest + // *BusEvent_NewAudienceRequest + // *BusEvent_TailRequest + // *BusEvent_TailResponse + // *BusEvent_SetPipelinesRequest + Event isBusEvent_Event `protobuf_oneof:"event"` + // All gRPC metadata is stored in ctx; when request goes outside of gRPC + // bounds, we will translate ctx metadata into this field. + // + // Example: + // 1. Request comes into server via external gRPC to set new pipeline + // 2. server has to send SetPipeline cmd to SDK via gRPC - it passes + // on original metadata in request. + // 3. server has to broadcast SetPipeline cmd to other services via bus + // 4. Since this is not a gRPC call, server translates ctx metadata to + // this field and includes it in the bus event. + XMetadata map[string]string `protobuf:"bytes,1000,rep,name=_metadata,json=Metadata,proto3" json:"_metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // protolint:disable:this FIELD_NAMES_LOWER_SNAKE_CASE +} + +func (x *BusEvent) Reset() { + *x = BusEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_bus_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BusEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BusEvent) ProtoMessage() {} + +func (x *BusEvent) ProtoReflect() protoreflect.Message { + mi := &file_sp_bus_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BusEvent.ProtoReflect.Descriptor instead. +func (*BusEvent) Descriptor() ([]byte, []int) { + return file_sp_bus_proto_rawDescGZIP(), []int{0} +} + +func (x *BusEvent) GetSource() string { + if x != nil { + return x.Source + } + return "" +} + +func (m *BusEvent) GetEvent() isBusEvent_Event { + if m != nil { + return m.Event + } + return nil +} + +func (x *BusEvent) GetRegisterRequest() *RegisterRequest { + if x, ok := x.GetEvent().(*BusEvent_RegisterRequest); ok { + return x.RegisterRequest + } + return nil +} + +func (x *BusEvent) GetDeregisterRequest() *DeregisterRequest { + if x, ok := x.GetEvent().(*BusEvent_DeregisterRequest); ok { + return x.DeregisterRequest + } + return nil +} + +func (x *BusEvent) GetCreatePipelineRequest() *CreatePipelineRequest { + if x, ok := x.GetEvent().(*BusEvent_CreatePipelineRequest); ok { + return x.CreatePipelineRequest + } + return nil +} + +func (x *BusEvent) GetDeletePipelineRequest() *DeletePipelineRequest { + if x, ok := x.GetEvent().(*BusEvent_DeletePipelineRequest); ok { + return x.DeletePipelineRequest + } + return nil +} + +func (x *BusEvent) GetUpdatePipelineRequest() *UpdatePipelineRequest { + if x, ok := x.GetEvent().(*BusEvent_UpdatePipelineRequest); ok { + return x.UpdatePipelineRequest + } + return nil +} + +func (x *BusEvent) GetPausePipelineRequest() *PausePipelineRequest { + if x, ok := x.GetEvent().(*BusEvent_PausePipelineRequest); ok { + return x.PausePipelineRequest + } + return nil +} + +func (x *BusEvent) GetResumePipelineRequest() *ResumePipelineRequest { + if x, ok := x.GetEvent().(*BusEvent_ResumePipelineRequest); ok { + return x.ResumePipelineRequest + } + return nil +} + +func (x *BusEvent) GetMetricsRequest() *MetricsRequest { + if x, ok := x.GetEvent().(*BusEvent_MetricsRequest); ok { + return x.MetricsRequest + } + return nil +} + +func (x *BusEvent) GetKvRequest() *KVRequest { + if x, ok := x.GetEvent().(*BusEvent_KvRequest); ok { + return x.KvRequest + } + return nil +} + +func (x *BusEvent) GetDeleteAudienceRequest() *DeleteAudienceRequest { + if x, ok := x.GetEvent().(*BusEvent_DeleteAudienceRequest); ok { + return x.DeleteAudienceRequest + } + return nil +} + +func (x *BusEvent) GetNewAudienceRequest() *NewAudienceRequest { + if x, ok := x.GetEvent().(*BusEvent_NewAudienceRequest); ok { + return x.NewAudienceRequest + } + return nil +} + +func (x *BusEvent) GetTailRequest() *TailRequest { + if x, ok := x.GetEvent().(*BusEvent_TailRequest); ok { + return x.TailRequest + } + return nil +} + +func (x *BusEvent) GetTailResponse() *TailResponse { + if x, ok := x.GetEvent().(*BusEvent_TailResponse); ok { + return x.TailResponse + } + return nil +} + +func (x *BusEvent) GetSetPipelinesRequest() *SetPipelinesRequest { + if x, ok := x.GetEvent().(*BusEvent_SetPipelinesRequest); ok { + return x.SetPipelinesRequest + } + return nil +} + +func (x *BusEvent) GetXMetadata() map[string]string { + if x != nil { + return x.XMetadata + } + return nil +} + +type isBusEvent_Event interface { + isBusEvent_Event() +} + +type BusEvent_RegisterRequest struct { + RegisterRequest *RegisterRequest `protobuf:"bytes,100,opt,name=register_request,json=registerRequest,proto3,oneof"` +} + +type BusEvent_DeregisterRequest struct { + DeregisterRequest *DeregisterRequest `protobuf:"bytes,101,opt,name=deregister_request,json=deregisterRequest,proto3,oneof"` +} + +type BusEvent_CreatePipelineRequest struct { + CreatePipelineRequest *CreatePipelineRequest `protobuf:"bytes,102,opt,name=create_pipeline_request,json=createPipelineRequest,proto3,oneof"` +} + +type BusEvent_DeletePipelineRequest struct { + DeletePipelineRequest *DeletePipelineRequest `protobuf:"bytes,103,opt,name=delete_pipeline_request,json=deletePipelineRequest,proto3,oneof"` +} + +type BusEvent_UpdatePipelineRequest struct { + UpdatePipelineRequest *UpdatePipelineRequest `protobuf:"bytes,104,opt,name=update_pipeline_request,json=updatePipelineRequest,proto3,oneof"` +} + +type BusEvent_PausePipelineRequest struct { + PausePipelineRequest *PausePipelineRequest `protobuf:"bytes,107,opt,name=pause_pipeline_request,json=pausePipelineRequest,proto3,oneof"` +} + +type BusEvent_ResumePipelineRequest struct { + ResumePipelineRequest *ResumePipelineRequest `protobuf:"bytes,108,opt,name=resume_pipeline_request,json=resumePipelineRequest,proto3,oneof"` +} + +type BusEvent_MetricsRequest struct { + MetricsRequest *MetricsRequest `protobuf:"bytes,109,opt,name=metrics_request,json=metricsRequest,proto3,oneof"` +} + +type BusEvent_KvRequest struct { + KvRequest *KVRequest `protobuf:"bytes,110,opt,name=kv_request,json=kvRequest,proto3,oneof"` +} + +type BusEvent_DeleteAudienceRequest struct { + DeleteAudienceRequest *DeleteAudienceRequest `protobuf:"bytes,111,opt,name=delete_audience_request,json=deleteAudienceRequest,proto3,oneof"` +} + +type BusEvent_NewAudienceRequest struct { + NewAudienceRequest *NewAudienceRequest `protobuf:"bytes,112,opt,name=new_audience_request,json=newAudienceRequest,proto3,oneof"` +} + +type BusEvent_TailRequest struct { + TailRequest *TailRequest `protobuf:"bytes,113,opt,name=tail_request,json=tailRequest,proto3,oneof"` +} + +type BusEvent_TailResponse struct { + TailResponse *TailResponse `protobuf:"bytes,114,opt,name=tail_response,json=tailResponse,proto3,oneof"` +} + +type BusEvent_SetPipelinesRequest struct { + SetPipelinesRequest *SetPipelinesRequest `protobuf:"bytes,115,opt,name=set_pipelines_request,json=setPipelinesRequest,proto3,oneof"` +} + +func (*BusEvent_RegisterRequest) isBusEvent_Event() {} + +func (*BusEvent_DeregisterRequest) isBusEvent_Event() {} + +func (*BusEvent_CreatePipelineRequest) isBusEvent_Event() {} + +func (*BusEvent_DeletePipelineRequest) isBusEvent_Event() {} + +func (*BusEvent_UpdatePipelineRequest) isBusEvent_Event() {} + +func (*BusEvent_PausePipelineRequest) isBusEvent_Event() {} + +func (*BusEvent_ResumePipelineRequest) isBusEvent_Event() {} + +func (*BusEvent_MetricsRequest) isBusEvent_Event() {} + +func (*BusEvent_KvRequest) isBusEvent_Event() {} + +func (*BusEvent_DeleteAudienceRequest) isBusEvent_Event() {} + +func (*BusEvent_NewAudienceRequest) isBusEvent_Event() {} + +func (*BusEvent_TailRequest) isBusEvent_Event() {} + +func (*BusEvent_TailResponse) isBusEvent_Event() {} + +func (*BusEvent_SetPipelinesRequest) isBusEvent_Event() {} + +var File_sp_bus_proto protoreflect.FileDescriptor + +var file_sp_bus_proto_rawDesc = []byte{ + 0x0a, 0x0c, 0x73, 0x70, 0x5f, 0x62, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x1a, 0x0f, 0x73, 0x70, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x73, 0x70, 0x5f, 0x65, 0x78, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x73, 0x70, 0x5f, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0b, 0x73, + 0x70, 0x5f, 0x6b, 0x76, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe8, 0x09, 0x0a, 0x08, 0x42, + 0x75, 0x73, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, + 0x44, 0x0a, 0x10, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x48, 0x00, 0x52, 0x0f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4a, 0x0a, 0x12, 0x64, 0x65, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x65, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x11, + 0x64, 0x65, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x57, 0x0a, 0x17, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x70, 0x69, 0x70, 0x65, + 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x66, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x48, 0x00, 0x52, 0x15, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x69, 0x70, 0x65, 0x6c, + 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x57, 0x0a, 0x17, 0x64, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x5f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x67, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x69, 0x70, 0x65, 0x6c, + 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x15, 0x64, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x57, 0x0a, 0x17, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x70, 0x69, + 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x68, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x15, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x69, 0x70, + 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x54, 0x0a, 0x16, + 0x70, 0x61, 0x75, 0x73, 0x65, 0x5f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x6b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x69, 0x70, 0x65, 0x6c, + 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x14, 0x70, 0x61, + 0x75, 0x73, 0x65, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x57, 0x0a, 0x17, 0x72, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x5f, 0x70, 0x69, 0x70, + 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x6c, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x52, 0x65, 0x73, + 0x75, 0x6d, 0x65, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x48, 0x00, 0x52, 0x15, 0x72, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x50, 0x69, 0x70, 0x65, + 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x41, 0x0a, 0x0f, 0x6d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x6d, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x0e, + 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x32, + 0x0a, 0x0a, 0x6b, 0x76, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x6e, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4b, 0x56, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x09, 0x6b, 0x76, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x57, 0x0a, 0x17, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x5f, 0x61, 0x75, 0x64, + 0x69, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x6f, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x48, 0x00, 0x52, 0x15, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x75, 0x64, 0x69, + 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4e, 0x0a, 0x14, 0x6e, + 0x65, 0x77, 0x5f, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x18, 0x70, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x4e, 0x65, 0x77, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x12, 0x6e, 0x65, 0x77, 0x41, 0x75, 0x64, 0x69, + 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x0c, 0x74, + 0x61, 0x69, 0x6c, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x71, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x54, 0x61, 0x69, 0x6c, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x0d, 0x74, 0x61, 0x69, 0x6c, 0x5f, 0x72, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x72, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x54, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x48, 0x00, 0x52, 0x0c, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x51, 0x0a, 0x15, 0x73, 0x65, 0x74, 0x5f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, + 0x6e, 0x65, 0x73, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x73, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x65, 0x74, 0x50, 0x69, + 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, + 0x52, 0x13, 0x73, 0x65, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3c, 0x0a, 0x09, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x18, 0xe8, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x42, 0x75, 0x73, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, + 0x42, 0x07, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x4a, 0x04, 0x08, 0x69, 0x10, 0x6a, 0x4a, + 0x04, 0x08, 0x6a, 0x10, 0x6b, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x73, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x6c, 0x69, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_sp_bus_proto_rawDescOnce sync.Once + file_sp_bus_proto_rawDescData = file_sp_bus_proto_rawDesc +) + +func file_sp_bus_proto_rawDescGZIP() []byte { + file_sp_bus_proto_rawDescOnce.Do(func() { + file_sp_bus_proto_rawDescData = protoimpl.X.CompressGZIP(file_sp_bus_proto_rawDescData) + }) + return file_sp_bus_proto_rawDescData +} + +var file_sp_bus_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_sp_bus_proto_goTypes = []interface{}{ + (*BusEvent)(nil), // 0: protos.BusEvent + nil, // 1: protos.BusEvent.MetadataEntry + (*RegisterRequest)(nil), // 2: protos.RegisterRequest + (*DeregisterRequest)(nil), // 3: protos.DeregisterRequest + (*CreatePipelineRequest)(nil), // 4: protos.CreatePipelineRequest + (*DeletePipelineRequest)(nil), // 5: protos.DeletePipelineRequest + (*UpdatePipelineRequest)(nil), // 6: protos.UpdatePipelineRequest + (*PausePipelineRequest)(nil), // 7: protos.PausePipelineRequest + (*ResumePipelineRequest)(nil), // 8: protos.ResumePipelineRequest + (*MetricsRequest)(nil), // 9: protos.MetricsRequest + (*KVRequest)(nil), // 10: protos.KVRequest + (*DeleteAudienceRequest)(nil), // 11: protos.DeleteAudienceRequest + (*NewAudienceRequest)(nil), // 12: protos.NewAudienceRequest + (*TailRequest)(nil), // 13: protos.TailRequest + (*TailResponse)(nil), // 14: protos.TailResponse + (*SetPipelinesRequest)(nil), // 15: protos.SetPipelinesRequest +} +var file_sp_bus_proto_depIdxs = []int32{ + 2, // 0: protos.BusEvent.register_request:type_name -> protos.RegisterRequest + 3, // 1: protos.BusEvent.deregister_request:type_name -> protos.DeregisterRequest + 4, // 2: protos.BusEvent.create_pipeline_request:type_name -> protos.CreatePipelineRequest + 5, // 3: protos.BusEvent.delete_pipeline_request:type_name -> protos.DeletePipelineRequest + 6, // 4: protos.BusEvent.update_pipeline_request:type_name -> protos.UpdatePipelineRequest + 7, // 5: protos.BusEvent.pause_pipeline_request:type_name -> protos.PausePipelineRequest + 8, // 6: protos.BusEvent.resume_pipeline_request:type_name -> protos.ResumePipelineRequest + 9, // 7: protos.BusEvent.metrics_request:type_name -> protos.MetricsRequest + 10, // 8: protos.BusEvent.kv_request:type_name -> protos.KVRequest + 11, // 9: protos.BusEvent.delete_audience_request:type_name -> protos.DeleteAudienceRequest + 12, // 10: protos.BusEvent.new_audience_request:type_name -> protos.NewAudienceRequest + 13, // 11: protos.BusEvent.tail_request:type_name -> protos.TailRequest + 14, // 12: protos.BusEvent.tail_response:type_name -> protos.TailResponse + 15, // 13: protos.BusEvent.set_pipelines_request:type_name -> protos.SetPipelinesRequest + 1, // 14: protos.BusEvent._metadata:type_name -> protos.BusEvent.MetadataEntry + 15, // [15:15] is the sub-list for method output_type + 15, // [15:15] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name +} + +func init() { file_sp_bus_proto_init() } +func file_sp_bus_proto_init() { + if File_sp_bus_proto != nil { + return + } + file_sp_common_proto_init() + file_sp_external_proto_init() + file_sp_internal_proto_init() + file_sp_kv_proto_init() + if !protoimpl.UnsafeEnabled { + file_sp_bus_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BusEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_sp_bus_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*BusEvent_RegisterRequest)(nil), + (*BusEvent_DeregisterRequest)(nil), + (*BusEvent_CreatePipelineRequest)(nil), + (*BusEvent_DeletePipelineRequest)(nil), + (*BusEvent_UpdatePipelineRequest)(nil), + (*BusEvent_PausePipelineRequest)(nil), + (*BusEvent_ResumePipelineRequest)(nil), + (*BusEvent_MetricsRequest)(nil), + (*BusEvent_KvRequest)(nil), + (*BusEvent_DeleteAudienceRequest)(nil), + (*BusEvent_NewAudienceRequest)(nil), + (*BusEvent_TailRequest)(nil), + (*BusEvent_TailResponse)(nil), + (*BusEvent_SetPipelinesRequest)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_sp_bus_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_sp_bus_proto_goTypes, + DependencyIndexes: file_sp_bus_proto_depIdxs, + MessageInfos: file_sp_bus_proto_msgTypes, + }.Build() + File_sp_bus_proto = out.File + file_sp_bus_proto_rawDesc = nil + file_sp_bus_proto_goTypes = nil + file_sp_bus_proto_depIdxs = nil +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_command.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_command.pb.go new file mode 100644 index 000000000..e8beabe0f --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_command.pb.go @@ -0,0 +1,523 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: sp_command.proto + +package protos + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Command is used by streamdal server for sending commands to SDKs +type Command struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Who is this command intended for? + // NOTE: Some commands (such as KeepAliveCommand, KVCommand) do NOT use audience and will ignore it + Audience *Audience `protobuf:"bytes,1,opt,name=audience,proto3" json:"audience,omitempty"` + // Types that are assignable to Command: + // + // *Command_SetPipelines + // *Command_KeepAlive + // *Command_Kv + // *Command_Tail + Command isCommand_Command `protobuf_oneof:"command"` +} + +func (x *Command) Reset() { + *x = Command{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_command_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Command) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Command) ProtoMessage() {} + +func (x *Command) ProtoReflect() protoreflect.Message { + mi := &file_sp_command_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Command.ProtoReflect.Descriptor instead. +func (*Command) Descriptor() ([]byte, []int) { + return file_sp_command_proto_rawDescGZIP(), []int{0} +} + +func (x *Command) GetAudience() *Audience { + if x != nil { + return x.Audience + } + return nil +} + +func (m *Command) GetCommand() isCommand_Command { + if m != nil { + return m.Command + } + return nil +} + +func (x *Command) GetSetPipelines() *SetPipelinesCommand { + if x, ok := x.GetCommand().(*Command_SetPipelines); ok { + return x.SetPipelines + } + return nil +} + +func (x *Command) GetKeepAlive() *KeepAliveCommand { + if x, ok := x.GetCommand().(*Command_KeepAlive); ok { + return x.KeepAlive + } + return nil +} + +func (x *Command) GetKv() *KVCommand { + if x, ok := x.GetCommand().(*Command_Kv); ok { + return x.Kv + } + return nil +} + +func (x *Command) GetTail() *TailCommand { + if x, ok := x.GetCommand().(*Command_Tail); ok { + return x.Tail + } + return nil +} + +type isCommand_Command interface { + isCommand_Command() +} + +type Command_SetPipelines struct { + // Emitted by server when a user makes a pause, resume, delete or update + // pipeline and set pipelines external grpc API call. + // NOTE: This was introduced during ordered pipeline updates. + SetPipelines *SetPipelinesCommand `protobuf:"bytes,100,opt,name=set_pipelines,json=setPipelines,proto3,oneof"` +} + +type Command_KeepAlive struct { + // Server sends this periodically to SDKs to keep the connection alive + KeepAlive *KeepAliveCommand `protobuf:"bytes,101,opt,name=keep_alive,json=keepAlive,proto3,oneof"` +} + +type Command_Kv struct { + // Server will emit this when a user makes changes to the KV store + // via the KV HTTP API. + Kv *KVCommand `protobuf:"bytes,102,opt,name=kv,proto3,oneof"` +} + +type Command_Tail struct { + // Emitted by server when a user makes a Tail() call + // Consumed by all server instances and by SDKs + Tail *TailCommand `protobuf:"bytes,103,opt,name=tail,proto3,oneof"` +} + +func (*Command_SetPipelines) isCommand_Command() {} + +func (*Command_KeepAlive) isCommand_Command() {} + +func (*Command_Kv) isCommand_Command() {} + +func (*Command_Tail) isCommand_Command() {} + +type SetPipelinesCommand struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pipelines []*Pipeline `protobuf:"bytes,1,rep,name=pipelines,proto3" json:"pipelines,omitempty"` +} + +func (x *SetPipelinesCommand) Reset() { + *x = SetPipelinesCommand{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_command_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetPipelinesCommand) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetPipelinesCommand) ProtoMessage() {} + +func (x *SetPipelinesCommand) ProtoReflect() protoreflect.Message { + mi := &file_sp_command_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetPipelinesCommand.ProtoReflect.Descriptor instead. +func (*SetPipelinesCommand) Descriptor() ([]byte, []int) { + return file_sp_command_proto_rawDescGZIP(), []int{1} +} + +func (x *SetPipelinesCommand) GetPipelines() []*Pipeline { + if x != nil { + return x.Pipelines + } + return nil +} + +type KeepAliveCommand struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *KeepAliveCommand) Reset() { + *x = KeepAliveCommand{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_command_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KeepAliveCommand) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeepAliveCommand) ProtoMessage() {} + +func (x *KeepAliveCommand) ProtoReflect() protoreflect.Message { + mi := &file_sp_command_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeepAliveCommand.ProtoReflect.Descriptor instead. +func (*KeepAliveCommand) Descriptor() ([]byte, []int) { + return file_sp_command_proto_rawDescGZIP(), []int{2} +} + +// Sent by server on Register channel(s) to live SDKs +type KVCommand struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Instructions []*KVInstruction `protobuf:"bytes,1,rep,name=instructions,proto3" json:"instructions,omitempty"` + // Create & Update specific setting that will cause the Create or Update to + // work as an upsert. + Overwrite bool `protobuf:"varint,2,opt,name=overwrite,proto3" json:"overwrite,omitempty"` +} + +func (x *KVCommand) Reset() { + *x = KVCommand{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_command_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KVCommand) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KVCommand) ProtoMessage() {} + +func (x *KVCommand) ProtoReflect() protoreflect.Message { + mi := &file_sp_command_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KVCommand.ProtoReflect.Descriptor instead. +func (*KVCommand) Descriptor() ([]byte, []int) { + return file_sp_command_proto_rawDescGZIP(), []int{3} +} + +func (x *KVCommand) GetInstructions() []*KVInstruction { + if x != nil { + return x.Instructions + } + return nil +} + +func (x *KVCommand) GetOverwrite() bool { + if x != nil { + return x.Overwrite + } + return false +} + +type TailCommand struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Request *TailRequest `protobuf:"bytes,2,opt,name=request,proto3" json:"request,omitempty"` +} + +func (x *TailCommand) Reset() { + *x = TailCommand{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_command_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TailCommand) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TailCommand) ProtoMessage() {} + +func (x *TailCommand) ProtoReflect() protoreflect.Message { + mi := &file_sp_command_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TailCommand.ProtoReflect.Descriptor instead. +func (*TailCommand) Descriptor() ([]byte, []int) { + return file_sp_command_proto_rawDescGZIP(), []int{4} +} + +func (x *TailCommand) GetRequest() *TailRequest { + if x != nil { + return x.Request + } + return nil +} + +var File_sp_command_proto protoreflect.FileDescriptor + +var file_sp_command_proto_rawDesc = []byte{ + 0x0a, 0x10, 0x73, 0x70, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x1a, 0x0f, 0x73, 0x70, 0x5f, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0b, 0x73, 0x70, 0x5f, + 0x6b, 0x76, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x73, 0x70, 0x5f, 0x70, 0x69, 0x70, + 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x91, 0x02, 0x0a, 0x07, + 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x2c, 0x0a, 0x08, 0x61, 0x75, 0x64, 0x69, 0x65, + 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x08, 0x61, 0x75, 0x64, + 0x69, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x42, 0x0a, 0x0d, 0x73, 0x65, 0x74, 0x5f, 0x70, 0x69, 0x70, + 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x65, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, + 0x65, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x48, 0x00, 0x52, 0x0c, 0x73, 0x65, 0x74, + 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x12, 0x39, 0x0a, 0x0a, 0x6b, 0x65, 0x65, + 0x70, 0x5f, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4b, 0x65, 0x65, 0x70, 0x41, 0x6c, 0x69, 0x76, 0x65, + 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x48, 0x00, 0x52, 0x09, 0x6b, 0x65, 0x65, 0x70, 0x41, + 0x6c, 0x69, 0x76, 0x65, 0x12, 0x23, 0x0a, 0x02, 0x6b, 0x76, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4b, 0x56, 0x43, 0x6f, 0x6d, 0x6d, + 0x61, 0x6e, 0x64, 0x48, 0x00, 0x52, 0x02, 0x6b, 0x76, 0x12, 0x29, 0x0a, 0x04, 0x74, 0x61, 0x69, + 0x6c, 0x18, 0x67, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x54, 0x61, 0x69, 0x6c, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x48, 0x00, 0x52, 0x04, + 0x74, 0x61, 0x69, 0x6c, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x22, + 0x45, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x43, + 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x2e, 0x0a, 0x09, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, + 0x6e, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x09, 0x70, 0x69, 0x70, + 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x22, 0x12, 0x0a, 0x10, 0x4b, 0x65, 0x65, 0x70, 0x41, 0x6c, + 0x69, 0x76, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x22, 0x64, 0x0a, 0x09, 0x4b, 0x56, + 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x39, 0x0a, 0x0c, 0x69, 0x6e, 0x73, 0x74, 0x72, + 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4b, 0x56, 0x49, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x69, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x6f, 0x76, 0x65, 0x72, 0x77, 0x72, 0x69, 0x74, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x6f, 0x76, 0x65, 0x72, 0x77, 0x72, 0x69, 0x74, 0x65, + 0x22, 0x3c, 0x0a, 0x0b, 0x54, 0x61, 0x69, 0x6c, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, + 0x2d, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x54, 0x61, 0x69, 0x6c, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x3c, + 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, + 0x2f, 0x6c, 0x69, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x62, 0x75, 0x69, + 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_sp_command_proto_rawDescOnce sync.Once + file_sp_command_proto_rawDescData = file_sp_command_proto_rawDesc +) + +func file_sp_command_proto_rawDescGZIP() []byte { + file_sp_command_proto_rawDescOnce.Do(func() { + file_sp_command_proto_rawDescData = protoimpl.X.CompressGZIP(file_sp_command_proto_rawDescData) + }) + return file_sp_command_proto_rawDescData +} + +var file_sp_command_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_sp_command_proto_goTypes = []interface{}{ + (*Command)(nil), // 0: protos.Command + (*SetPipelinesCommand)(nil), // 1: protos.SetPipelinesCommand + (*KeepAliveCommand)(nil), // 2: protos.KeepAliveCommand + (*KVCommand)(nil), // 3: protos.KVCommand + (*TailCommand)(nil), // 4: protos.TailCommand + (*Audience)(nil), // 5: protos.Audience + (*Pipeline)(nil), // 6: protos.Pipeline + (*KVInstruction)(nil), // 7: protos.KVInstruction + (*TailRequest)(nil), // 8: protos.TailRequest +} +var file_sp_command_proto_depIdxs = []int32{ + 5, // 0: protos.Command.audience:type_name -> protos.Audience + 1, // 1: protos.Command.set_pipelines:type_name -> protos.SetPipelinesCommand + 2, // 2: protos.Command.keep_alive:type_name -> protos.KeepAliveCommand + 3, // 3: protos.Command.kv:type_name -> protos.KVCommand + 4, // 4: protos.Command.tail:type_name -> protos.TailCommand + 6, // 5: protos.SetPipelinesCommand.pipelines:type_name -> protos.Pipeline + 7, // 6: protos.KVCommand.instructions:type_name -> protos.KVInstruction + 8, // 7: protos.TailCommand.request:type_name -> protos.TailRequest + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name +} + +func init() { file_sp_command_proto_init() } +func file_sp_command_proto_init() { + if File_sp_command_proto != nil { + return + } + file_sp_common_proto_init() + file_sp_kv_proto_init() + file_sp_pipeline_proto_init() + if !protoimpl.UnsafeEnabled { + file_sp_command_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Command); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_command_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetPipelinesCommand); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_command_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KeepAliveCommand); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_command_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KVCommand); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_command_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TailCommand); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_sp_command_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*Command_SetPipelines)(nil), + (*Command_KeepAlive)(nil), + (*Command_Kv)(nil), + (*Command_Tail)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_sp_command_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_sp_command_proto_goTypes, + DependencyIndexes: file_sp_command_proto_depIdxs, + MessageInfos: file_sp_command_proto_msgTypes, + }.Build() + File_sp_command_proto = out.File + file_sp_command_proto_rawDesc = nil + file_sp_command_proto_goTypes = nil + file_sp_command_proto_depIdxs = nil +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_common.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_common.pb.go new file mode 100644 index 000000000..21a143578 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_common.pb.go @@ -0,0 +1,1168 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: sp_common.proto + +package protos + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Common status codes used in gRPC method responses +type ResponseCode int32 + +const ( + ResponseCode_RESPONSE_CODE_UNSET ResponseCode = 0 + ResponseCode_RESPONSE_CODE_OK ResponseCode = 1 + ResponseCode_RESPONSE_CODE_BAD_REQUEST ResponseCode = 2 + ResponseCode_RESPONSE_CODE_NOT_FOUND ResponseCode = 3 + ResponseCode_RESPONSE_CODE_INTERNAL_SERVER_ERROR ResponseCode = 4 + ResponseCode_RESPONSE_CODE_GENERIC_ERROR ResponseCode = 5 +) + +// Enum value maps for ResponseCode. +var ( + ResponseCode_name = map[int32]string{ + 0: "RESPONSE_CODE_UNSET", + 1: "RESPONSE_CODE_OK", + 2: "RESPONSE_CODE_BAD_REQUEST", + 3: "RESPONSE_CODE_NOT_FOUND", + 4: "RESPONSE_CODE_INTERNAL_SERVER_ERROR", + 5: "RESPONSE_CODE_GENERIC_ERROR", + } + ResponseCode_value = map[string]int32{ + "RESPONSE_CODE_UNSET": 0, + "RESPONSE_CODE_OK": 1, + "RESPONSE_CODE_BAD_REQUEST": 2, + "RESPONSE_CODE_NOT_FOUND": 3, + "RESPONSE_CODE_INTERNAL_SERVER_ERROR": 4, + "RESPONSE_CODE_GENERIC_ERROR": 5, + } +) + +func (x ResponseCode) Enum() *ResponseCode { + p := new(ResponseCode) + *p = x + return p +} + +func (x ResponseCode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ResponseCode) Descriptor() protoreflect.EnumDescriptor { + return file_sp_common_proto_enumTypes[0].Descriptor() +} + +func (ResponseCode) Type() protoreflect.EnumType { + return &file_sp_common_proto_enumTypes[0] +} + +func (x ResponseCode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ResponseCode.Descriptor instead. +func (ResponseCode) EnumDescriptor() ([]byte, []int) { + return file_sp_common_proto_rawDescGZIP(), []int{0} +} + +// Each SDK client is a $service + $component + $operation_type +type OperationType int32 + +const ( + OperationType_OPERATION_TYPE_UNSET OperationType = 0 + OperationType_OPERATION_TYPE_CONSUMER OperationType = 1 + OperationType_OPERATION_TYPE_PRODUCER OperationType = 2 +) + +// Enum value maps for OperationType. +var ( + OperationType_name = map[int32]string{ + 0: "OPERATION_TYPE_UNSET", + 1: "OPERATION_TYPE_CONSUMER", + 2: "OPERATION_TYPE_PRODUCER", + } + OperationType_value = map[string]int32{ + "OPERATION_TYPE_UNSET": 0, + "OPERATION_TYPE_CONSUMER": 1, + "OPERATION_TYPE_PRODUCER": 2, + } +) + +func (x OperationType) Enum() *OperationType { + p := new(OperationType) + *p = x + return p +} + +func (x OperationType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (OperationType) Descriptor() protoreflect.EnumDescriptor { + return file_sp_common_proto_enumTypes[1].Descriptor() +} + +func (OperationType) Type() protoreflect.EnumType { + return &file_sp_common_proto_enumTypes[1] +} + +func (x OperationType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use OperationType.Descriptor instead. +func (OperationType) EnumDescriptor() ([]byte, []int) { + return file_sp_common_proto_rawDescGZIP(), []int{1} +} + +type TailResponseType int32 + +const ( + TailResponseType_TAIL_RESPONSE_TYPE_UNSET TailResponseType = 0 + TailResponseType_TAIL_RESPONSE_TYPE_PAYLOAD TailResponseType = 1 + TailResponseType_TAIL_RESPONSE_TYPE_ERROR TailResponseType = 2 +) + +// Enum value maps for TailResponseType. +var ( + TailResponseType_name = map[int32]string{ + 0: "TAIL_RESPONSE_TYPE_UNSET", + 1: "TAIL_RESPONSE_TYPE_PAYLOAD", + 2: "TAIL_RESPONSE_TYPE_ERROR", + } + TailResponseType_value = map[string]int32{ + "TAIL_RESPONSE_TYPE_UNSET": 0, + "TAIL_RESPONSE_TYPE_PAYLOAD": 1, + "TAIL_RESPONSE_TYPE_ERROR": 2, + } +) + +func (x TailResponseType) Enum() *TailResponseType { + p := new(TailResponseType) + *p = x + return p +} + +func (x TailResponseType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TailResponseType) Descriptor() protoreflect.EnumDescriptor { + return file_sp_common_proto_enumTypes[2].Descriptor() +} + +func (TailResponseType) Type() protoreflect.EnumType { + return &file_sp_common_proto_enumTypes[2] +} + +func (x TailResponseType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TailResponseType.Descriptor instead. +func (TailResponseType) EnumDescriptor() ([]byte, []int) { + return file_sp_common_proto_rawDescGZIP(), []int{2} +} + +type TailRequestType int32 + +const ( + TailRequestType_TAIL_REQUEST_TYPE_UNSET TailRequestType = 0 + TailRequestType_TAIL_REQUEST_TYPE_START TailRequestType = 1 + TailRequestType_TAIL_REQUEST_TYPE_STOP TailRequestType = 2 + TailRequestType_TAIL_REQUEST_TYPE_PAUSE TailRequestType = 3 + TailRequestType_TAIL_REQUEST_TYPE_RESUME TailRequestType = 4 +) + +// Enum value maps for TailRequestType. +var ( + TailRequestType_name = map[int32]string{ + 0: "TAIL_REQUEST_TYPE_UNSET", + 1: "TAIL_REQUEST_TYPE_START", + 2: "TAIL_REQUEST_TYPE_STOP", + 3: "TAIL_REQUEST_TYPE_PAUSE", + 4: "TAIL_REQUEST_TYPE_RESUME", + } + TailRequestType_value = map[string]int32{ + "TAIL_REQUEST_TYPE_UNSET": 0, + "TAIL_REQUEST_TYPE_START": 1, + "TAIL_REQUEST_TYPE_STOP": 2, + "TAIL_REQUEST_TYPE_PAUSE": 3, + "TAIL_REQUEST_TYPE_RESUME": 4, + } +) + +func (x TailRequestType) Enum() *TailRequestType { + p := new(TailRequestType) + *p = x + return p +} + +func (x TailRequestType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TailRequestType) Descriptor() protoreflect.EnumDescriptor { + return file_sp_common_proto_enumTypes[3].Descriptor() +} + +func (TailRequestType) Type() protoreflect.EnumType { + return &file_sp_common_proto_enumTypes[3] +} + +func (x TailRequestType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TailRequestType.Descriptor instead. +func (TailRequestType) EnumDescriptor() ([]byte, []int) { + return file_sp_common_proto_rawDescGZIP(), []int{3} +} + +// Common response message for many gRPC methods +type StandardResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Co-relation ID for the request / response + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Code ResponseCode `protobuf:"varint,2,opt,name=code,proto3,enum=protos.ResponseCode" json:"code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *StandardResponse) Reset() { + *x = StandardResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_common_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StandardResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StandardResponse) ProtoMessage() {} + +func (x *StandardResponse) ProtoReflect() protoreflect.Message { + mi := &file_sp_common_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StandardResponse.ProtoReflect.Descriptor instead. +func (*StandardResponse) Descriptor() ([]byte, []int) { + return file_sp_common_proto_rawDescGZIP(), []int{0} +} + +func (x *StandardResponse) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *StandardResponse) GetCode() ResponseCode { + if x != nil { + return x.Code + } + return ResponseCode_RESPONSE_CODE_UNSET +} + +func (x *StandardResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +// Used to indicate who a command is intended for +type Audience struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Name of the service -- let's include the service name on all calls, we can + // optimize later ~DS + ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` + // Name of the component the SDK is interacting with (ie. kafka-$topic-name) + ComponentName string `protobuf:"bytes,2,opt,name=component_name,json=componentName,proto3" json:"component_name,omitempty"` + // Consumer or Producer + OperationType OperationType `protobuf:"varint,3,opt,name=operation_type,json=operationType,proto3,enum=protos.OperationType" json:"operation_type,omitempty"` + // Name for the consumer or producer + OperationName string `protobuf:"bytes,4,opt,name=operation_name,json=operationName,proto3" json:"operation_name,omitempty"` +} + +func (x *Audience) Reset() { + *x = Audience{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_common_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Audience) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Audience) ProtoMessage() {} + +func (x *Audience) ProtoReflect() protoreflect.Message { + mi := &file_sp_common_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Audience.ProtoReflect.Descriptor instead. +func (*Audience) Descriptor() ([]byte, []int) { + return file_sp_common_proto_rawDescGZIP(), []int{1} +} + +func (x *Audience) GetServiceName() string { + if x != nil { + return x.ServiceName + } + return "" +} + +func (x *Audience) GetComponentName() string { + if x != nil { + return x.ComponentName + } + return "" +} + +func (x *Audience) GetOperationType() OperationType { + if x != nil { + return x.OperationType + } + return OperationType_OPERATION_TYPE_UNSET +} + +func (x *Audience) GetOperationName() string { + if x != nil { + return x.OperationName + } + return "" +} + +type Metric struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Labels map[string]string `protobuf:"bytes,2,rep,name=labels,proto3" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Value float64 `protobuf:"fixed64,3,opt,name=value,proto3" json:"value,omitempty"` + Audience *Audience `protobuf:"bytes,4,opt,name=audience,proto3" json:"audience,omitempty"` +} + +func (x *Metric) Reset() { + *x = Metric{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_common_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Metric) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Metric) ProtoMessage() {} + +func (x *Metric) ProtoReflect() protoreflect.Message { + mi := &file_sp_common_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Metric.ProtoReflect.Descriptor instead. +func (*Metric) Descriptor() ([]byte, []int) { + return file_sp_common_proto_rawDescGZIP(), []int{2} +} + +func (x *Metric) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Metric) GetLabels() map[string]string { + if x != nil { + return x.Labels + } + return nil +} + +func (x *Metric) GetValue() float64 { + if x != nil { + return x.Value + } + return 0 +} + +func (x *Metric) GetAudience() *Audience { + if x != nil { + return x.Audience + } + return nil +} + +type TailRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type TailRequestType `protobuf:"varint,1,opt,name=type,proto3,enum=protos.TailRequestType" json:"type,omitempty"` + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` + Audience *Audience `protobuf:"bytes,3,opt,name=audience,proto3" json:"audience,omitempty"` + // Deprecated: Marked as deprecated in sp_common.proto. + PipelineId *string `protobuf:"bytes,4,opt,name=pipeline_id,json=pipelineId,proto3,oneof" json:"pipeline_id,omitempty"` + SampleOptions *SampleOptions `protobuf:"bytes,5,opt,name=sample_options,json=sampleOptions,proto3" json:"sample_options,omitempty"` + XMetadata map[string]string `protobuf:"bytes,1000,rep,name=_metadata,json=Metadata,proto3" json:"_metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // protolint:disable:this FIELD_NAMES_LOWER_SNAKE_CASE +} + +func (x *TailRequest) Reset() { + *x = TailRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_common_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TailRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TailRequest) ProtoMessage() {} + +func (x *TailRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_common_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TailRequest.ProtoReflect.Descriptor instead. +func (*TailRequest) Descriptor() ([]byte, []int) { + return file_sp_common_proto_rawDescGZIP(), []int{3} +} + +func (x *TailRequest) GetType() TailRequestType { + if x != nil { + return x.Type + } + return TailRequestType_TAIL_REQUEST_TYPE_UNSET +} + +func (x *TailRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *TailRequest) GetAudience() *Audience { + if x != nil { + return x.Audience + } + return nil +} + +// Deprecated: Marked as deprecated in sp_common.proto. +func (x *TailRequest) GetPipelineId() string { + if x != nil && x.PipelineId != nil { + return *x.PipelineId + } + return "" +} + +func (x *TailRequest) GetSampleOptions() *SampleOptions { + if x != nil { + return x.SampleOptions + } + return nil +} + +func (x *TailRequest) GetXMetadata() map[string]string { + if x != nil { + return x.XMetadata + } + return nil +} + +// TailResponse originates in the SDK and then is sent to streamdal servers where +// it is forwarded to the correct frontend streaming gRPC connection +type TailResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type TailResponseType `protobuf:"varint,1,opt,name=type,proto3,enum=protos.TailResponseType" json:"type,omitempty"` + TailRequestId string `protobuf:"bytes,2,opt,name=tail_request_id,json=tailRequestId,proto3" json:"tail_request_id,omitempty"` + Audience *Audience `protobuf:"bytes,3,opt,name=audience,proto3" json:"audience,omitempty"` + PipelineId string `protobuf:"bytes,4,opt,name=pipeline_id,json=pipelineId,proto3" json:"pipeline_id,omitempty"` + SessionId string `protobuf:"bytes,5,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + // Timestamp in nanoseconds + TimestampNs int64 `protobuf:"varint,6,opt,name=timestamp_ns,json=timestampNs,proto3" json:"timestamp_ns,omitempty"` + // Payload data. For errors, this will be the error message + // For payloads, this will be JSON of the payload data, post processing + OriginalData []byte `protobuf:"bytes,7,opt,name=original_data,json=originalData,proto3" json:"original_data,omitempty"` + // For payloads, this will be the new data, post processing + NewData []byte `protobuf:"bytes,8,opt,name=new_data,json=newData,proto3" json:"new_data,omitempty"` + XMetadata map[string]string `protobuf:"bytes,1000,rep,name=_metadata,json=Metadata,proto3" json:"_metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // protolint:disable:this FIELD_NAMES_LOWER_SNAKE_CASE + // Set by server to indicate that the response is a keepalive message + XKeepalive *bool `protobuf:"varint,1001,opt,name=_keepalive,json=Keepalive,proto3,oneof" json:"_keepalive,omitempty"` // protolint:disable:this FIELD_NAMES_LOWER_SNAKE_CASE +} + +func (x *TailResponse) Reset() { + *x = TailResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_common_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TailResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TailResponse) ProtoMessage() {} + +func (x *TailResponse) ProtoReflect() protoreflect.Message { + mi := &file_sp_common_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TailResponse.ProtoReflect.Descriptor instead. +func (*TailResponse) Descriptor() ([]byte, []int) { + return file_sp_common_proto_rawDescGZIP(), []int{4} +} + +func (x *TailResponse) GetType() TailResponseType { + if x != nil { + return x.Type + } + return TailResponseType_TAIL_RESPONSE_TYPE_UNSET +} + +func (x *TailResponse) GetTailRequestId() string { + if x != nil { + return x.TailRequestId + } + return "" +} + +func (x *TailResponse) GetAudience() *Audience { + if x != nil { + return x.Audience + } + return nil +} + +func (x *TailResponse) GetPipelineId() string { + if x != nil { + return x.PipelineId + } + return "" +} + +func (x *TailResponse) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +func (x *TailResponse) GetTimestampNs() int64 { + if x != nil { + return x.TimestampNs + } + return 0 +} + +func (x *TailResponse) GetOriginalData() []byte { + if x != nil { + return x.OriginalData + } + return nil +} + +func (x *TailResponse) GetNewData() []byte { + if x != nil { + return x.NewData + } + return nil +} + +func (x *TailResponse) GetXMetadata() map[string]string { + if x != nil { + return x.XMetadata + } + return nil +} + +func (x *TailResponse) GetXKeepalive() bool { + if x != nil && x.XKeepalive != nil { + return *x.XKeepalive + } + return false +} + +type AudienceRate struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Bytes float64 `protobuf:"fixed64,1,opt,name=bytes,proto3" json:"bytes,omitempty"` + Processed float64 `protobuf:"fixed64,2,opt,name=processed,proto3" json:"processed,omitempty"` +} + +func (x *AudienceRate) Reset() { + *x = AudienceRate{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_common_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AudienceRate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AudienceRate) ProtoMessage() {} + +func (x *AudienceRate) ProtoReflect() protoreflect.Message { + mi := &file_sp_common_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AudienceRate.ProtoReflect.Descriptor instead. +func (*AudienceRate) Descriptor() ([]byte, []int) { + return file_sp_common_proto_rawDescGZIP(), []int{5} +} + +func (x *AudienceRate) GetBytes() float64 { + if x != nil { + return x.Bytes + } + return 0 +} + +func (x *AudienceRate) GetProcessed() float64 { + if x != nil { + return x.Processed + } + return 0 +} + +type Schema struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + JsonSchema []byte `protobuf:"bytes,1,opt,name=json_schema,json=jsonSchema,proto3" json:"json_schema,omitempty"` + XVersion int32 `protobuf:"varint,100,opt,name=_version,json=Version,proto3" json:"_version,omitempty"` // protolint:disable:this FIELD_NAMES_LOWER_SNAKE_CASE + XMetadata map[string]string `protobuf:"bytes,1000,rep,name=_metadata,json=Metadata,proto3" json:"_metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // protolint:disable:this FIELD_NAMES_LOWER_SNAKE_CASE +} + +func (x *Schema) Reset() { + *x = Schema{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_common_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Schema) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Schema) ProtoMessage() {} + +func (x *Schema) ProtoReflect() protoreflect.Message { + mi := &file_sp_common_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Schema.ProtoReflect.Descriptor instead. +func (*Schema) Descriptor() ([]byte, []int) { + return file_sp_common_proto_rawDescGZIP(), []int{6} +} + +func (x *Schema) GetJsonSchema() []byte { + if x != nil { + return x.JsonSchema + } + return nil +} + +func (x *Schema) GetXVersion() int32 { + if x != nil { + return x.XVersion + } + return 0 +} + +func (x *Schema) GetXMetadata() map[string]string { + if x != nil { + return x.XMetadata + } + return nil +} + +type SampleOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SampleRate uint32 `protobuf:"varint,1,opt,name=sample_rate,json=sampleRate,proto3" json:"sample_rate,omitempty"` + SampleIntervalSeconds uint32 `protobuf:"varint,2,opt,name=sample_interval_seconds,json=sampleIntervalSeconds,proto3" json:"sample_interval_seconds,omitempty"` +} + +func (x *SampleOptions) Reset() { + *x = SampleOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_common_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SampleOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SampleOptions) ProtoMessage() {} + +func (x *SampleOptions) ProtoReflect() protoreflect.Message { + mi := &file_sp_common_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SampleOptions.ProtoReflect.Descriptor instead. +func (*SampleOptions) Descriptor() ([]byte, []int) { + return file_sp_common_proto_rawDescGZIP(), []int{7} +} + +func (x *SampleOptions) GetSampleRate() uint32 { + if x != nil { + return x.SampleRate + } + return 0 +} + +func (x *SampleOptions) GetSampleIntervalSeconds() uint32 { + if x != nil { + return x.SampleIntervalSeconds + } + return 0 +} + +var File_sp_common_proto protoreflect.FileDescriptor + +var file_sp_common_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x73, 0x70, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x22, 0x66, 0x0a, 0x10, 0x53, 0x74, 0x61, + 0x6e, 0x64, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x28, 0x0a, + 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, + 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x22, 0xb9, 0x01, 0x0a, 0x08, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x21, + 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x6d, 0x70, 0x6f, + 0x6e, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x3c, 0x0a, 0x0e, 0x6f, 0x70, 0x65, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0d, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, + 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xcf, 0x01, + 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x32, 0x0a, 0x06, + 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x4c, 0x61, 0x62, + 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x08, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, + 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x08, 0x61, 0x75, 0x64, 0x69, + 0x65, 0x6e, 0x63, 0x65, 0x1a, 0x39, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, + 0xee, 0x02, 0x0a, 0x0b, 0x54, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x2b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x54, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2c, 0x0a, 0x08, + 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, + 0x52, 0x08, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x28, 0x0a, 0x0b, 0x70, 0x69, + 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x02, 0x18, 0x01, 0x48, 0x00, 0x52, 0x0a, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x49, + 0x64, 0x88, 0x01, 0x01, 0x12, 0x3c, 0x0a, 0x0e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x0d, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, + 0xe8, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x54, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, + 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x69, 0x64, + 0x22, 0xe8, 0x03, 0x0a, 0x0c, 0x54, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x2c, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x54, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, + 0x26, 0x0a, 0x0f, 0x74, 0x61, 0x69, 0x6c, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x08, 0x61, 0x75, 0x64, 0x69, 0x65, + 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x08, 0x61, 0x75, 0x64, + 0x69, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, + 0x65, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x69, 0x70, 0x65, + 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x5f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x4e, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x6f, 0x72, 0x69, 0x67, + 0x69, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x0c, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x12, 0x19, 0x0a, + 0x08, 0x6e, 0x65, 0x77, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x07, 0x6e, 0x65, 0x77, 0x44, 0x61, 0x74, 0x61, 0x12, 0x40, 0x0a, 0x09, 0x5f, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0xe8, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x54, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x23, 0x0a, 0x0a, 0x5f, 0x6b, + 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x18, 0xe9, 0x07, 0x20, 0x01, 0x28, 0x08, 0x48, + 0x00, 0x52, 0x09, 0x4b, 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x88, 0x01, 0x01, 0x1a, + 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x0d, 0x0a, 0x0b, + 0x58, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x22, 0x42, 0x0a, 0x0c, 0x41, + 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, + 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, + 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, + 0xbd, 0x01, 0x0a, 0x06, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1f, 0x0a, 0x0b, 0x6a, 0x73, + 0x6f, 0x6e, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x0a, 0x6a, 0x73, 0x6f, 0x6e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x19, 0x0a, 0x08, 0x5f, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x3a, 0x0a, 0x09, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x18, 0xe8, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, + 0x68, 0x0a, 0x0d, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x61, 0x74, + 0x65, 0x12, 0x36, 0x0a, 0x17, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x76, 0x61, 0x6c, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x15, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, + 0x61, 0x6c, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x2a, 0xc3, 0x01, 0x0a, 0x0c, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x0a, 0x13, 0x52, 0x45, + 0x53, 0x50, 0x4f, 0x4e, 0x53, 0x45, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x45, + 0x54, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x45, 0x53, 0x50, 0x4f, 0x4e, 0x53, 0x45, 0x5f, + 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x4f, 0x4b, 0x10, 0x01, 0x12, 0x1d, 0x0a, 0x19, 0x52, 0x45, 0x53, + 0x50, 0x4f, 0x4e, 0x53, 0x45, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x42, 0x41, 0x44, 0x5f, 0x52, + 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x02, 0x12, 0x1b, 0x0a, 0x17, 0x52, 0x45, 0x53, 0x50, + 0x4f, 0x4e, 0x53, 0x45, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, + 0x55, 0x4e, 0x44, 0x10, 0x03, 0x12, 0x27, 0x0a, 0x23, 0x52, 0x45, 0x53, 0x50, 0x4f, 0x4e, 0x53, + 0x45, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x5f, + 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x04, 0x12, 0x1f, + 0x0a, 0x1b, 0x52, 0x45, 0x53, 0x50, 0x4f, 0x4e, 0x53, 0x45, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, + 0x47, 0x45, 0x4e, 0x45, 0x52, 0x49, 0x43, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x05, 0x2a, + 0x63, 0x0a, 0x0d, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x18, 0x0a, 0x14, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x45, 0x54, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x4f, 0x50, + 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x4e, + 0x53, 0x55, 0x4d, 0x45, 0x52, 0x10, 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x4f, 0x50, 0x45, 0x52, 0x41, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x52, 0x4f, 0x44, 0x55, 0x43, + 0x45, 0x52, 0x10, 0x02, 0x2a, 0x6e, 0x0a, 0x10, 0x54, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x18, 0x54, 0x41, 0x49, 0x4c, + 0x5f, 0x52, 0x45, 0x53, 0x50, 0x4f, 0x4e, 0x53, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, + 0x4e, 0x53, 0x45, 0x54, 0x10, 0x00, 0x12, 0x1e, 0x0a, 0x1a, 0x54, 0x41, 0x49, 0x4c, 0x5f, 0x52, + 0x45, 0x53, 0x50, 0x4f, 0x4e, 0x53, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x41, 0x59, + 0x4c, 0x4f, 0x41, 0x44, 0x10, 0x01, 0x12, 0x1c, 0x0a, 0x18, 0x54, 0x41, 0x49, 0x4c, 0x5f, 0x52, + 0x45, 0x53, 0x50, 0x4f, 0x4e, 0x53, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x52, 0x52, + 0x4f, 0x52, 0x10, 0x02, 0x2a, 0xa2, 0x01, 0x0a, 0x0f, 0x54, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x54, 0x41, 0x49, 0x4c, + 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, + 0x53, 0x45, 0x54, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x54, 0x41, 0x49, 0x4c, 0x5f, 0x52, 0x45, + 0x51, 0x55, 0x45, 0x53, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x52, 0x54, + 0x10, 0x01, 0x12, 0x1a, 0x0a, 0x16, 0x54, 0x41, 0x49, 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, + 0x53, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x4f, 0x50, 0x10, 0x02, 0x12, 0x1b, + 0x0a, 0x17, 0x54, 0x41, 0x49, 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x50, 0x41, 0x55, 0x53, 0x45, 0x10, 0x03, 0x12, 0x1c, 0x0a, 0x18, 0x54, + 0x41, 0x49, 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x52, 0x45, 0x53, 0x55, 0x4d, 0x45, 0x10, 0x04, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, + 0x6c, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x6c, 0x69, 0x62, 0x73, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_sp_common_proto_rawDescOnce sync.Once + file_sp_common_proto_rawDescData = file_sp_common_proto_rawDesc +) + +func file_sp_common_proto_rawDescGZIP() []byte { + file_sp_common_proto_rawDescOnce.Do(func() { + file_sp_common_proto_rawDescData = protoimpl.X.CompressGZIP(file_sp_common_proto_rawDescData) + }) + return file_sp_common_proto_rawDescData +} + +var file_sp_common_proto_enumTypes = make([]protoimpl.EnumInfo, 4) +var file_sp_common_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_sp_common_proto_goTypes = []interface{}{ + (ResponseCode)(0), // 0: protos.ResponseCode + (OperationType)(0), // 1: protos.OperationType + (TailResponseType)(0), // 2: protos.TailResponseType + (TailRequestType)(0), // 3: protos.TailRequestType + (*StandardResponse)(nil), // 4: protos.StandardResponse + (*Audience)(nil), // 5: protos.Audience + (*Metric)(nil), // 6: protos.Metric + (*TailRequest)(nil), // 7: protos.TailRequest + (*TailResponse)(nil), // 8: protos.TailResponse + (*AudienceRate)(nil), // 9: protos.AudienceRate + (*Schema)(nil), // 10: protos.Schema + (*SampleOptions)(nil), // 11: protos.SampleOptions + nil, // 12: protos.Metric.LabelsEntry + nil, // 13: protos.TailRequest.MetadataEntry + nil, // 14: protos.TailResponse.MetadataEntry + nil, // 15: protos.Schema.MetadataEntry +} +var file_sp_common_proto_depIdxs = []int32{ + 0, // 0: protos.StandardResponse.code:type_name -> protos.ResponseCode + 1, // 1: protos.Audience.operation_type:type_name -> protos.OperationType + 12, // 2: protos.Metric.labels:type_name -> protos.Metric.LabelsEntry + 5, // 3: protos.Metric.audience:type_name -> protos.Audience + 3, // 4: protos.TailRequest.type:type_name -> protos.TailRequestType + 5, // 5: protos.TailRequest.audience:type_name -> protos.Audience + 11, // 6: protos.TailRequest.sample_options:type_name -> protos.SampleOptions + 13, // 7: protos.TailRequest._metadata:type_name -> protos.TailRequest.MetadataEntry + 2, // 8: protos.TailResponse.type:type_name -> protos.TailResponseType + 5, // 9: protos.TailResponse.audience:type_name -> protos.Audience + 14, // 10: protos.TailResponse._metadata:type_name -> protos.TailResponse.MetadataEntry + 15, // 11: protos.Schema._metadata:type_name -> protos.Schema.MetadataEntry + 12, // [12:12] is the sub-list for method output_type + 12, // [12:12] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name +} + +func init() { file_sp_common_proto_init() } +func file_sp_common_proto_init() { + if File_sp_common_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_sp_common_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StandardResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_common_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Audience); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_common_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Metric); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_common_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TailRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_common_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TailResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_common_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AudienceRate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_common_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Schema); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_common_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SampleOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_sp_common_proto_msgTypes[3].OneofWrappers = []interface{}{} + file_sp_common_proto_msgTypes[4].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_sp_common_proto_rawDesc, + NumEnums: 4, + NumMessages: 12, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_sp_common_proto_goTypes, + DependencyIndexes: file_sp_common_proto_depIdxs, + EnumInfos: file_sp_common_proto_enumTypes, + MessageInfos: file_sp_common_proto_msgTypes, + }.Build() + File_sp_common_proto = out.File + file_sp_common_proto_rawDesc = nil + file_sp_common_proto_goTypes = nil + file_sp_common_proto_depIdxs = nil +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_external.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_external.pb.go new file mode 100644 index 000000000..f225f1e06 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_external.pb.go @@ -0,0 +1,3102 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: sp_external.proto + +package protos + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type AppRegistrationStatusResponse_Status int32 + +const ( + AppRegistrationStatusResponse_STATUS_UNSET AppRegistrationStatusResponse_Status = 0 + // Submit means the user is not registered yet + AppRegistrationStatusResponse_STATUS_SUBMIT AppRegistrationStatusResponse_Status = 1 + // Verify means the user is registered but not verified yet + AppRegistrationStatusResponse_STATUS_VERIFY AppRegistrationStatusResponse_Status = 2 + // Done means the user is registered and verified + AppRegistrationStatusResponse_STATUS_DONE AppRegistrationStatusResponse_Status = 3 +) + +// Enum value maps for AppRegistrationStatusResponse_Status. +var ( + AppRegistrationStatusResponse_Status_name = map[int32]string{ + 0: "STATUS_UNSET", + 1: "STATUS_SUBMIT", + 2: "STATUS_VERIFY", + 3: "STATUS_DONE", + } + AppRegistrationStatusResponse_Status_value = map[string]int32{ + "STATUS_UNSET": 0, + "STATUS_SUBMIT": 1, + "STATUS_VERIFY": 2, + "STATUS_DONE": 3, + } +) + +func (x AppRegistrationStatusResponse_Status) Enum() *AppRegistrationStatusResponse_Status { + p := new(AppRegistrationStatusResponse_Status) + *p = x + return p +} + +func (x AppRegistrationStatusResponse_Status) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (AppRegistrationStatusResponse_Status) Descriptor() protoreflect.EnumDescriptor { + return file_sp_external_proto_enumTypes[0].Descriptor() +} + +func (AppRegistrationStatusResponse_Status) Type() protoreflect.EnumType { + return &file_sp_external_proto_enumTypes[0] +} + +func (x AppRegistrationStatusResponse_Status) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use AppRegistrationStatusResponse_Status.Descriptor instead. +func (AppRegistrationStatusResponse_Status) EnumDescriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{31, 0} +} + +type GetAllRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetAllRequest) Reset() { + *x = GetAllRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAllRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAllRequest) ProtoMessage() {} + +func (x *GetAllRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAllRequest.ProtoReflect.Descriptor instead. +func (*GetAllRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{0} +} + +type GetAllResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Clients currently connected to the server + Live []*LiveInfo `protobuf:"bytes,1,rep,name=live,proto3" json:"live,omitempty"` + // All of the audiences that are known to the server + Audiences []*Audience `protobuf:"bytes,2,rep,name=audiences,proto3" json:"audiences,omitempty"` + // All of the pipelines known to the server + pipeline <-> audience mappings + // key == pipeline_id; if "Audience" is not filled out - pipeline is not attached + // to any audience. + Pipelines map[string]*PipelineInfo `protobuf:"bytes,3,rep,name=pipelines,proto3" json:"pipelines,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // Audience to pipeline mapping config; key == $audience_as_string + Configs map[string]*PipelineConfigs `protobuf:"bytes,4,rep,name=configs,proto3" json:"configs,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // When was this response generated. This is useful for determining what is + // the latest update when using GetAllStream(). + GeneratedAtUnixTsNsUtc int64 `protobuf:"varint,100,opt,name=generated_at_unix_ts_ns_utc,json=generatedAtUnixTsNsUtc,proto3" json:"generated_at_unix_ts_ns_utc,omitempty"` + // Set by server to indicate that the response is a keepalive message + XKeepalive *bool `protobuf:"varint,1000,opt,name=_keepalive,json=Keepalive,proto3,oneof" json:"_keepalive,omitempty"` // protolint:disable:this FIELD_NAMES_LOWER_SNAKE_CASE +} + +func (x *GetAllResponse) Reset() { + *x = GetAllResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAllResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAllResponse) ProtoMessage() {} + +func (x *GetAllResponse) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAllResponse.ProtoReflect.Descriptor instead. +func (*GetAllResponse) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{1} +} + +func (x *GetAllResponse) GetLive() []*LiveInfo { + if x != nil { + return x.Live + } + return nil +} + +func (x *GetAllResponse) GetAudiences() []*Audience { + if x != nil { + return x.Audiences + } + return nil +} + +func (x *GetAllResponse) GetPipelines() map[string]*PipelineInfo { + if x != nil { + return x.Pipelines + } + return nil +} + +func (x *GetAllResponse) GetConfigs() map[string]*PipelineConfigs { + if x != nil { + return x.Configs + } + return nil +} + +func (x *GetAllResponse) GetGeneratedAtUnixTsNsUtc() int64 { + if x != nil { + return x.GeneratedAtUnixTsNsUtc + } + return 0 +} + +func (x *GetAllResponse) GetXKeepalive() bool { + if x != nil && x.XKeepalive != nil { + return *x.XKeepalive + } + return false +} + +type GetPipelinesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetPipelinesRequest) Reset() { + *x = GetPipelinesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPipelinesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPipelinesRequest) ProtoMessage() {} + +func (x *GetPipelinesRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetPipelinesRequest.ProtoReflect.Descriptor instead. +func (*GetPipelinesRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{2} +} + +// Array of pipeline definitions +type GetPipelinesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pipelines []*Pipeline `protobuf:"bytes,1,rep,name=pipelines,proto3" json:"pipelines,omitempty"` +} + +func (x *GetPipelinesResponse) Reset() { + *x = GetPipelinesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPipelinesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPipelinesResponse) ProtoMessage() {} + +func (x *GetPipelinesResponse) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetPipelinesResponse.ProtoReflect.Descriptor instead. +func (*GetPipelinesResponse) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{3} +} + +func (x *GetPipelinesResponse) GetPipelines() []*Pipeline { + if x != nil { + return x.Pipelines + } + return nil +} + +type GetPipelineRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PipelineId string `protobuf:"bytes,1,opt,name=pipeline_id,json=pipelineId,proto3" json:"pipeline_id,omitempty"` +} + +func (x *GetPipelineRequest) Reset() { + *x = GetPipelineRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPipelineRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPipelineRequest) ProtoMessage() {} + +func (x *GetPipelineRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetPipelineRequest.ProtoReflect.Descriptor instead. +func (*GetPipelineRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{4} +} + +func (x *GetPipelineRequest) GetPipelineId() string { + if x != nil { + return x.PipelineId + } + return "" +} + +type GetPipelineResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pipeline *Pipeline `protobuf:"bytes,1,opt,name=pipeline,proto3" json:"pipeline,omitempty"` +} + +func (x *GetPipelineResponse) Reset() { + *x = GetPipelineResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPipelineResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPipelineResponse) ProtoMessage() {} + +func (x *GetPipelineResponse) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetPipelineResponse.ProtoReflect.Descriptor instead. +func (*GetPipelineResponse) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{5} +} + +func (x *GetPipelineResponse) GetPipeline() *Pipeline { + if x != nil { + return x.Pipeline + } + return nil +} + +type CreatePipelineRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pipeline *Pipeline `protobuf:"bytes,1,opt,name=pipeline,proto3" json:"pipeline,omitempty"` +} + +func (x *CreatePipelineRequest) Reset() { + *x = CreatePipelineRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreatePipelineRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreatePipelineRequest) ProtoMessage() {} + +func (x *CreatePipelineRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreatePipelineRequest.ProtoReflect.Descriptor instead. +func (*CreatePipelineRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{6} +} + +func (x *CreatePipelineRequest) GetPipeline() *Pipeline { + if x != nil { + return x.Pipeline + } + return nil +} + +type CreatePipelineResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` + PipelineId string `protobuf:"bytes,2,opt,name=pipeline_id,json=pipelineId,proto3" json:"pipeline_id,omitempty"` +} + +func (x *CreatePipelineResponse) Reset() { + *x = CreatePipelineResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreatePipelineResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreatePipelineResponse) ProtoMessage() {} + +func (x *CreatePipelineResponse) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreatePipelineResponse.ProtoReflect.Descriptor instead. +func (*CreatePipelineResponse) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{7} +} + +func (x *CreatePipelineResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *CreatePipelineResponse) GetPipelineId() string { + if x != nil { + return x.PipelineId + } + return "" +} + +type UpdatePipelineRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pipeline *Pipeline `protobuf:"bytes,1,opt,name=pipeline,proto3" json:"pipeline,omitempty"` +} + +func (x *UpdatePipelineRequest) Reset() { + *x = UpdatePipelineRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdatePipelineRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdatePipelineRequest) ProtoMessage() {} + +func (x *UpdatePipelineRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdatePipelineRequest.ProtoReflect.Descriptor instead. +func (*UpdatePipelineRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{8} +} + +func (x *UpdatePipelineRequest) GetPipeline() *Pipeline { + if x != nil { + return x.Pipeline + } + return nil +} + +type DeletePipelineRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PipelineId string `protobuf:"bytes,1,opt,name=pipeline_id,json=pipelineId,proto3" json:"pipeline_id,omitempty"` + // This field is for internal usage only by the server. It is used to indicate + // to the bus handler who this pipeline was used by so the handler can decide + // who we need to emit a SetPipelines cmd to. + XAudiences []*Audience `protobuf:"bytes,1000,rep,name=_audiences,json=Audiences,proto3" json:"_audiences,omitempty"` // protolint:disable:this FIELD_NAMES_LOWER_SNAKE_CASE +} + +func (x *DeletePipelineRequest) Reset() { + *x = DeletePipelineRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeletePipelineRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeletePipelineRequest) ProtoMessage() {} + +func (x *DeletePipelineRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeletePipelineRequest.ProtoReflect.Descriptor instead. +func (*DeletePipelineRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{9} +} + +func (x *DeletePipelineRequest) GetPipelineId() string { + if x != nil { + return x.PipelineId + } + return "" +} + +func (x *DeletePipelineRequest) GetXAudiences() []*Audience { + if x != nil { + return x.XAudiences + } + return nil +} + +type SetPipelinesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PipelineIds []string `protobuf:"bytes,1,rep,name=pipeline_ids,json=pipelineIds,proto3" json:"pipeline_ids,omitempty"` + Audience *Audience `protobuf:"bytes,2,opt,name=audience,proto3" json:"audience,omitempty"` +} + +func (x *SetPipelinesRequest) Reset() { + *x = SetPipelinesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetPipelinesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetPipelinesRequest) ProtoMessage() {} + +func (x *SetPipelinesRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetPipelinesRequest.ProtoReflect.Descriptor instead. +func (*SetPipelinesRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{10} +} + +func (x *SetPipelinesRequest) GetPipelineIds() []string { + if x != nil { + return x.PipelineIds + } + return nil +} + +func (x *SetPipelinesRequest) GetAudience() *Audience { + if x != nil { + return x.Audience + } + return nil +} + +type PausePipelineRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PipelineId string `protobuf:"bytes,1,opt,name=pipeline_id,json=pipelineId,proto3" json:"pipeline_id,omitempty"` + Audience *Audience `protobuf:"bytes,2,opt,name=audience,proto3" json:"audience,omitempty"` +} + +func (x *PausePipelineRequest) Reset() { + *x = PausePipelineRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PausePipelineRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PausePipelineRequest) ProtoMessage() {} + +func (x *PausePipelineRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PausePipelineRequest.ProtoReflect.Descriptor instead. +func (*PausePipelineRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{11} +} + +func (x *PausePipelineRequest) GetPipelineId() string { + if x != nil { + return x.PipelineId + } + return "" +} + +func (x *PausePipelineRequest) GetAudience() *Audience { + if x != nil { + return x.Audience + } + return nil +} + +type ResumePipelineRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PipelineId string `protobuf:"bytes,1,opt,name=pipeline_id,json=pipelineId,proto3" json:"pipeline_id,omitempty"` + Audience *Audience `protobuf:"bytes,2,opt,name=audience,proto3" json:"audience,omitempty"` +} + +func (x *ResumePipelineRequest) Reset() { + *x = ResumePipelineRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ResumePipelineRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResumePipelineRequest) ProtoMessage() {} + +func (x *ResumePipelineRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResumePipelineRequest.ProtoReflect.Descriptor instead. +func (*ResumePipelineRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{12} +} + +func (x *ResumePipelineRequest) GetPipelineId() string { + if x != nil { + return x.PipelineId + } + return "" +} + +func (x *ResumePipelineRequest) GetAudience() *Audience { + if x != nil { + return x.Audience + } + return nil +} + +// Notifications +type CreateNotificationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Notification *NotificationConfig `protobuf:"bytes,1,opt,name=notification,proto3" json:"notification,omitempty"` +} + +func (x *CreateNotificationRequest) Reset() { + *x = CreateNotificationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateNotificationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateNotificationRequest) ProtoMessage() {} + +func (x *CreateNotificationRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateNotificationRequest.ProtoReflect.Descriptor instead. +func (*CreateNotificationRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{13} +} + +func (x *CreateNotificationRequest) GetNotification() *NotificationConfig { + if x != nil { + return x.Notification + } + return nil +} + +type UpdateNotificationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Notification *NotificationConfig `protobuf:"bytes,1,opt,name=notification,proto3" json:"notification,omitempty"` +} + +func (x *UpdateNotificationRequest) Reset() { + *x = UpdateNotificationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateNotificationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateNotificationRequest) ProtoMessage() {} + +func (x *UpdateNotificationRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateNotificationRequest.ProtoReflect.Descriptor instead. +func (*UpdateNotificationRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{14} +} + +func (x *UpdateNotificationRequest) GetNotification() *NotificationConfig { + if x != nil { + return x.Notification + } + return nil +} + +type DeleteNotificationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NotificationId string `protobuf:"bytes,1,opt,name=notification_id,json=notificationId,proto3" json:"notification_id,omitempty"` +} + +func (x *DeleteNotificationRequest) Reset() { + *x = DeleteNotificationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteNotificationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteNotificationRequest) ProtoMessage() {} + +func (x *DeleteNotificationRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteNotificationRequest.ProtoReflect.Descriptor instead. +func (*DeleteNotificationRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{15} +} + +func (x *DeleteNotificationRequest) GetNotificationId() string { + if x != nil { + return x.NotificationId + } + return "" +} + +type GetNotificationsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetNotificationsRequest) Reset() { + *x = GetNotificationsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetNotificationsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetNotificationsRequest) ProtoMessage() {} + +func (x *GetNotificationsRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetNotificationsRequest.ProtoReflect.Descriptor instead. +func (*GetNotificationsRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{16} +} + +type GetNotificationsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Key == id of the notification config + Notifications map[string]*NotificationConfig `protobuf:"bytes,1,rep,name=notifications,proto3" json:"notifications,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *GetNotificationsResponse) Reset() { + *x = GetNotificationsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetNotificationsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetNotificationsResponse) ProtoMessage() {} + +func (x *GetNotificationsResponse) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetNotificationsResponse.ProtoReflect.Descriptor instead. +func (*GetNotificationsResponse) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{17} +} + +func (x *GetNotificationsResponse) GetNotifications() map[string]*NotificationConfig { + if x != nil { + return x.Notifications + } + return nil +} + +type GetNotificationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NotificationId string `protobuf:"bytes,1,opt,name=notification_id,json=notificationId,proto3" json:"notification_id,omitempty"` +} + +func (x *GetNotificationRequest) Reset() { + *x = GetNotificationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetNotificationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetNotificationRequest) ProtoMessage() {} + +func (x *GetNotificationRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetNotificationRequest.ProtoReflect.Descriptor instead. +func (*GetNotificationRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{18} +} + +func (x *GetNotificationRequest) GetNotificationId() string { + if x != nil { + return x.NotificationId + } + return "" +} + +type GetNotificationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Notification *NotificationConfig `protobuf:"bytes,1,opt,name=notification,proto3" json:"notification,omitempty"` +} + +func (x *GetNotificationResponse) Reset() { + *x = GetNotificationResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetNotificationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetNotificationResponse) ProtoMessage() {} + +func (x *GetNotificationResponse) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetNotificationResponse.ProtoReflect.Descriptor instead. +func (*GetNotificationResponse) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{19} +} + +func (x *GetNotificationResponse) GetNotification() *NotificationConfig { + if x != nil { + return x.Notification + } + return nil +} + +// Deprecated: Marked as deprecated in sp_external.proto. +type AttachNotificationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NotificationId string `protobuf:"bytes,1,opt,name=notification_id,json=notificationId,proto3" json:"notification_id,omitempty"` + PipelineId string `protobuf:"bytes,2,opt,name=pipeline_id,json=pipelineId,proto3" json:"pipeline_id,omitempty"` +} + +func (x *AttachNotificationRequest) Reset() { + *x = AttachNotificationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AttachNotificationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AttachNotificationRequest) ProtoMessage() {} + +func (x *AttachNotificationRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AttachNotificationRequest.ProtoReflect.Descriptor instead. +func (*AttachNotificationRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{20} +} + +func (x *AttachNotificationRequest) GetNotificationId() string { + if x != nil { + return x.NotificationId + } + return "" +} + +func (x *AttachNotificationRequest) GetPipelineId() string { + if x != nil { + return x.PipelineId + } + return "" +} + +// Deprecated: Marked as deprecated in sp_external.proto. +type DetachNotificationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NotificationId string `protobuf:"bytes,1,opt,name=notification_id,json=notificationId,proto3" json:"notification_id,omitempty"` + PipelineId string `protobuf:"bytes,2,opt,name=pipeline_id,json=pipelineId,proto3" json:"pipeline_id,omitempty"` +} + +func (x *DetachNotificationRequest) Reset() { + *x = DetachNotificationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DetachNotificationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DetachNotificationRequest) ProtoMessage() {} + +func (x *DetachNotificationRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DetachNotificationRequest.ProtoReflect.Descriptor instead. +func (*DetachNotificationRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{21} +} + +func (x *DetachNotificationRequest) GetNotificationId() string { + if x != nil { + return x.NotificationId + } + return "" +} + +func (x *DetachNotificationRequest) GetPipelineId() string { + if x != nil { + return x.PipelineId + } + return "" +} + +type DeleteAudienceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Audience *Audience `protobuf:"bytes,1,opt,name=audience,proto3" json:"audience,omitempty"` + // If true, will also detach all pipelines from the audience (if it has any) + Force *bool `protobuf:"varint,2,opt,name=force,proto3,oneof" json:"force,omitempty"` +} + +func (x *DeleteAudienceRequest) Reset() { + *x = DeleteAudienceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteAudienceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteAudienceRequest) ProtoMessage() {} + +func (x *DeleteAudienceRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteAudienceRequest.ProtoReflect.Descriptor instead. +func (*DeleteAudienceRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{22} +} + +func (x *DeleteAudienceRequest) GetAudience() *Audience { + if x != nil { + return x.Audience + } + return nil +} + +func (x *DeleteAudienceRequest) GetForce() bool { + if x != nil && x.Force != nil { + return *x.Force + } + return false +} + +type DeleteServiceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` + Force *bool `protobuf:"varint,2,opt,name=force,proto3,oneof" json:"force,omitempty"` +} + +func (x *DeleteServiceRequest) Reset() { + *x = DeleteServiceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteServiceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteServiceRequest) ProtoMessage() {} + +func (x *DeleteServiceRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteServiceRequest.ProtoReflect.Descriptor instead. +func (*DeleteServiceRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{23} +} + +func (x *DeleteServiceRequest) GetServiceName() string { + if x != nil { + return x.ServiceName + } + return "" +} + +func (x *DeleteServiceRequest) GetForce() bool { + if x != nil && x.Force != nil { + return *x.Force + } + return false +} + +type GetMetricsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetMetricsRequest) Reset() { + *x = GetMetricsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetMetricsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMetricsRequest) ProtoMessage() {} + +func (x *GetMetricsRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMetricsRequest.ProtoReflect.Descriptor instead. +func (*GetMetricsRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{24} +} + +type GetMetricsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Metrics map[string]*Metric `protobuf:"bytes,1,rep,name=metrics,proto3" json:"metrics,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // Set by server to indicate that the response is a keepalive message + XKeepalive *bool `protobuf:"varint,1000,opt,name=_keepalive,json=Keepalive,proto3,oneof" json:"_keepalive,omitempty"` // protolint:disable:this FIELD_NAMES_LOWER_SNAKE_CASE +} + +func (x *GetMetricsResponse) Reset() { + *x = GetMetricsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetMetricsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMetricsResponse) ProtoMessage() {} + +func (x *GetMetricsResponse) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[25] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMetricsResponse.ProtoReflect.Descriptor instead. +func (*GetMetricsResponse) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{25} +} + +func (x *GetMetricsResponse) GetMetrics() map[string]*Metric { + if x != nil { + return x.Metrics + } + return nil +} + +func (x *GetMetricsResponse) GetXKeepalive() bool { + if x != nil && x.XKeepalive != nil { + return *x.XKeepalive + } + return false +} + +type GetAudienceRatesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetAudienceRatesRequest) Reset() { + *x = GetAudienceRatesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAudienceRatesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAudienceRatesRequest) ProtoMessage() {} + +func (x *GetAudienceRatesRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[26] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAudienceRatesRequest.ProtoReflect.Descriptor instead. +func (*GetAudienceRatesRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{26} +} + +type GetAudienceRatesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Rates map[string]*AudienceRate `protobuf:"bytes,1,rep,name=rates,proto3" json:"rates,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // Key is an audience string + // Set by server to indicate that the response is a keepalive message + XKeepalive *bool `protobuf:"varint,1000,opt,name=_keepalive,json=Keepalive,proto3,oneof" json:"_keepalive,omitempty"` // protolint:disable:this FIELD_NAMES_LOWER_SNAKE_CASE +} + +func (x *GetAudienceRatesResponse) Reset() { + *x = GetAudienceRatesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAudienceRatesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAudienceRatesResponse) ProtoMessage() {} + +func (x *GetAudienceRatesResponse) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[27] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAudienceRatesResponse.ProtoReflect.Descriptor instead. +func (*GetAudienceRatesResponse) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{27} +} + +func (x *GetAudienceRatesResponse) GetRates() map[string]*AudienceRate { + if x != nil { + return x.Rates + } + return nil +} + +func (x *GetAudienceRatesResponse) GetXKeepalive() bool { + if x != nil && x.XKeepalive != nil { + return *x.XKeepalive + } + return false +} + +type GetSchemaRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Audience *Audience `protobuf:"bytes,1,opt,name=audience,proto3" json:"audience,omitempty"` +} + +func (x *GetSchemaRequest) Reset() { + *x = GetSchemaRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSchemaRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSchemaRequest) ProtoMessage() {} + +func (x *GetSchemaRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSchemaRequest.ProtoReflect.Descriptor instead. +func (*GetSchemaRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{28} +} + +func (x *GetSchemaRequest) GetAudience() *Audience { + if x != nil { + return x.Audience + } + return nil +} + +type GetSchemaResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Schema *Schema `protobuf:"bytes,1,opt,name=schema,proto3" json:"schema,omitempty"` +} + +func (x *GetSchemaResponse) Reset() { + *x = GetSchemaResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSchemaResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSchemaResponse) ProtoMessage() {} + +func (x *GetSchemaResponse) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[29] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSchemaResponse.ProtoReflect.Descriptor instead. +func (*GetSchemaResponse) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{29} +} + +func (x *GetSchemaResponse) GetSchema() *Schema { + if x != nil { + return x.Schema + } + return nil +} + +type AppRegistrationStatusRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` +} + +func (x *AppRegistrationStatusRequest) Reset() { + *x = AppRegistrationStatusRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AppRegistrationStatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AppRegistrationStatusRequest) ProtoMessage() {} + +func (x *AppRegistrationStatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[30] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AppRegistrationStatusRequest.ProtoReflect.Descriptor instead. +func (*AppRegistrationStatusRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{30} +} + +func (x *AppRegistrationStatusRequest) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +type AppRegistrationStatusResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Status AppRegistrationStatusResponse_Status `protobuf:"varint,1,opt,name=status,proto3,enum=protos.AppRegistrationStatusResponse_Status" json:"status,omitempty"` +} + +func (x *AppRegistrationStatusResponse) Reset() { + *x = AppRegistrationStatusResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AppRegistrationStatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AppRegistrationStatusResponse) ProtoMessage() {} + +func (x *AppRegistrationStatusResponse) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[31] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AppRegistrationStatusResponse.ProtoReflect.Descriptor instead. +func (*AppRegistrationStatusResponse) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{31} +} + +func (x *AppRegistrationStatusResponse) GetStatus() AppRegistrationStatusResponse_Status { + if x != nil { + return x.Status + } + return AppRegistrationStatusResponse_STATUS_UNSET +} + +type AppRegistrationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` + ClusterId string `protobuf:"bytes,2,opt,name=cluster_id,json=clusterId,proto3" json:"cluster_id,omitempty"` + // Used for storage on ui-bff backend + XCode string `protobuf:"bytes,100,opt,name=_code,json=Code,proto3" json:"_code,omitempty"` // protolint:disable:this FIELD_NAMES_LOWER_SNAKE_CASE +} + +func (x *AppRegistrationRequest) Reset() { + *x = AppRegistrationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AppRegistrationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AppRegistrationRequest) ProtoMessage() {} + +func (x *AppRegistrationRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[32] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AppRegistrationRequest.ProtoReflect.Descriptor instead. +func (*AppRegistrationRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{32} +} + +func (x *AppRegistrationRequest) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *AppRegistrationRequest) GetClusterId() string { + if x != nil { + return x.ClusterId + } + return "" +} + +func (x *AppRegistrationRequest) GetXCode() string { + if x != nil { + return x.XCode + } + return "" +} + +type AppVerifyRegistrationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` + Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"` +} + +func (x *AppVerifyRegistrationRequest) Reset() { + *x = AppVerifyRegistrationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AppVerifyRegistrationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AppVerifyRegistrationRequest) ProtoMessage() {} + +func (x *AppVerifyRegistrationRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[33] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AppVerifyRegistrationRequest.ProtoReflect.Descriptor instead. +func (*AppVerifyRegistrationRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{33} +} + +func (x *AppVerifyRegistrationRequest) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *AppVerifyRegistrationRequest) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +type AppRegisterRejectRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ClusterId string `protobuf:"bytes,1,opt,name=cluster_id,json=clusterId,proto3" json:"cluster_id,omitempty"` +} + +func (x *AppRegisterRejectRequest) Reset() { + *x = AppRegisterRejectRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AppRegisterRejectRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AppRegisterRejectRequest) ProtoMessage() {} + +func (x *AppRegisterRejectRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[34] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AppRegisterRejectRequest.ProtoReflect.Descriptor instead. +func (*AppRegisterRejectRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{34} +} + +func (x *AppRegisterRejectRequest) GetClusterId() string { + if x != nil { + return x.ClusterId + } + return "" +} + +type PauseTailRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TailId string `protobuf:"bytes,1,opt,name=tail_id,json=tailId,proto3" json:"tail_id,omitempty"` +} + +func (x *PauseTailRequest) Reset() { + *x = PauseTailRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PauseTailRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PauseTailRequest) ProtoMessage() {} + +func (x *PauseTailRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[35] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PauseTailRequest.ProtoReflect.Descriptor instead. +func (*PauseTailRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{35} +} + +func (x *PauseTailRequest) GetTailId() string { + if x != nil { + return x.TailId + } + return "" +} + +type ResumeTailRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TailId string `protobuf:"bytes,1,opt,name=tail_id,json=tailId,proto3" json:"tail_id,omitempty"` +} + +func (x *ResumeTailRequest) Reset() { + *x = ResumeTailRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ResumeTailRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResumeTailRequest) ProtoMessage() {} + +func (x *ResumeTailRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[36] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResumeTailRequest.ProtoReflect.Descriptor instead. +func (*ResumeTailRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{36} +} + +func (x *ResumeTailRequest) GetTailId() string { + if x != nil { + return x.TailId + } + return "" +} + +type TestRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Input string `protobuf:"bytes,1,opt,name=input,proto3" json:"input,omitempty"` +} + +func (x *TestRequest) Reset() { + *x = TestRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestRequest) ProtoMessage() {} + +func (x *TestRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[37] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestRequest.ProtoReflect.Descriptor instead. +func (*TestRequest) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{37} +} + +func (x *TestRequest) GetInput() string { + if x != nil { + return x.Input + } + return "" +} + +type TestResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Output string `protobuf:"bytes,2,opt,name=output,proto3" json:"output,omitempty"` +} + +func (x *TestResponse) Reset() { + *x = TestResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_external_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestResponse) ProtoMessage() {} + +func (x *TestResponse) ProtoReflect() protoreflect.Message { + mi := &file_sp_external_proto_msgTypes[38] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestResponse.ProtoReflect.Descriptor instead. +func (*TestResponse) Descriptor() ([]byte, []int) { + return file_sp_external_proto_rawDescGZIP(), []int{38} +} + +func (x *TestResponse) GetOutput() string { + if x != nil { + return x.Output + } + return "" +} + +var File_sp_external_proto protoreflect.FileDescriptor + +var file_sp_external_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x73, 0x70, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x1a, 0x0f, 0x73, 0x70, 0x5f, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0d, 0x73, 0x70, + 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x73, 0x70, 0x5f, + 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x73, 0x70, + 0x5f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x0f, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x22, 0x84, 0x04, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x04, 0x6c, 0x69, 0x76, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4c, 0x69, 0x76, 0x65, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x6c, 0x69, 0x76, 0x65, 0x12, 0x2e, 0x0a, 0x09, 0x61, 0x75, 0x64, + 0x69, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x09, + 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x43, 0x0a, 0x09, 0x70, 0x69, 0x70, + 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x52, 0x09, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x12, 0x3d, + 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x3b, 0x0a, + 0x1b, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x5f, 0x75, 0x6e, + 0x69, 0x78, 0x5f, 0x74, 0x73, 0x5f, 0x6e, 0x73, 0x5f, 0x75, 0x74, 0x63, 0x18, 0x64, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x16, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x55, + 0x6e, 0x69, 0x78, 0x54, 0x73, 0x4e, 0x73, 0x55, 0x74, 0x63, 0x12, 0x23, 0x0a, 0x0a, 0x5f, 0x6b, + 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x08, 0x48, + 0x00, 0x52, 0x09, 0x4b, 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x88, 0x01, 0x01, 0x1a, + 0x52, 0x0a, 0x0e, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x50, 0x69, 0x70, 0x65, + 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, + 0x02, 0x38, 0x01, 0x1a, 0x53, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x50, 0x69, + 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x58, 0x5f, 0x6b, 0x65, + 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x22, 0x15, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x50, 0x69, + 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x46, + 0x0a, 0x14, 0x47, 0x65, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x09, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, + 0x6e, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x09, 0x70, 0x69, 0x70, + 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x22, 0x35, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x50, 0x69, 0x70, + 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, + 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x22, 0x43, 0x0a, + 0x13, 0x47, 0x65, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x08, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x08, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, + 0x6e, 0x65, 0x22, 0x45, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x69, 0x70, 0x65, + 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x70, + 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, + 0x08, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x22, 0x53, 0x0a, 0x16, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1f, 0x0a, + 0x0b, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x22, 0x45, + 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x70, 0x69, 0x70, 0x65, 0x6c, + 0x69, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x08, 0x70, 0x69, 0x70, + 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x22, 0x6a, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, + 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, + 0x0a, 0x0b, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x12, + 0x30, 0x0a, 0x0a, 0x5f, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x18, 0xe8, 0x07, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x75, + 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x09, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, + 0x73, 0x22, 0x66, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x69, 0x70, 0x65, + 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, + 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x73, 0x12, 0x2c, 0x0a, 0x08, 0x61, + 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, + 0x08, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x65, 0x0a, 0x14, 0x50, 0x61, 0x75, + 0x73, 0x65, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, + 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x08, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x75, + 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x08, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, + 0x22, 0x66, 0x0a, 0x15, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, + 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x69, 0x70, + 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x08, 0x61, 0x75, + 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x08, + 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x5b, 0x0a, 0x19, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, 0x0a, 0x0c, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0c, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x5b, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, + 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x3e, 0x0a, 0x0c, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0c, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x22, 0x44, 0x0a, 0x19, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, + 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x27, 0x0a, 0x0f, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x19, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x4e, + 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x22, 0xd3, 0x01, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x59, 0x0a, 0x0d, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0d, 0x6e, 0x6f, + 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x5c, 0x0a, 0x12, 0x4e, + 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x30, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4e, 0x6f, 0x74, 0x69, + 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x41, 0x0a, 0x16, 0x47, 0x65, 0x74, + 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6e, 0x6f, + 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x59, 0x0a, 0x17, + 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x0c, 0x6e, 0x6f, 0x74, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0c, 0x6e, 0x6f, 0x74, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x69, 0x0a, 0x19, 0x41, 0x74, 0x74, 0x61, 0x63, + 0x68, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6e, + 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1f, 0x0a, + 0x0b, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x3a, 0x02, + 0x18, 0x01, 0x22, 0x69, 0x0a, 0x19, 0x44, 0x65, 0x74, 0x61, 0x63, 0x68, 0x4e, 0x6f, 0x74, 0x69, + 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x27, 0x0a, 0x0f, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x69, 0x70, 0x65, + 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, + 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x6a, 0x0a, + 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x08, 0x61, 0x75, 0x64, 0x69, + 0x65, 0x6e, 0x63, 0x65, 0x12, 0x19, 0x0a, 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x88, 0x01, 0x01, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x22, 0x5e, 0x0a, 0x14, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x88, 0x01, 0x01, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x22, 0x13, 0x0a, 0x11, 0x47, 0x65, 0x74, + 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xd7, + 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x23, 0x0a, 0x0a, 0x5f, 0x6b, 0x65, 0x65, + 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, + 0x09, 0x4b, 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x88, 0x01, 0x01, 0x1a, 0x4a, 0x0a, + 0x0c, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x24, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x58, 0x5f, 0x6b, + 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x22, 0x19, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x41, + 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x22, 0xe1, 0x01, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x41, 0x75, 0x64, 0x69, 0x65, + 0x6e, 0x63, 0x65, 0x52, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x41, 0x0a, 0x05, 0x72, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x75, 0x64, 0x69, + 0x65, 0x6e, 0x63, 0x65, 0x52, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x72, 0x61, + 0x74, 0x65, 0x73, 0x12, 0x23, 0x0a, 0x0a, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, + 0x65, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x09, 0x4b, 0x65, 0x65, 0x70, + 0x61, 0x6c, 0x69, 0x76, 0x65, 0x88, 0x01, 0x01, 0x1a, 0x4e, 0x0a, 0x0a, 0x52, 0x61, 0x74, 0x65, + 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x61, 0x74, 0x65, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x58, 0x5f, 0x6b, 0x65, + 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x22, 0x40, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x53, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x61, + 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, + 0x08, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x3b, 0x0a, 0x11, 0x47, 0x65, 0x74, + 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, + 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x06, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0x34, 0x0a, 0x1c, 0x41, 0x70, 0x70, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x22, 0xb8, 0x01, 0x0a, + 0x1d, 0x41, 0x70, 0x70, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, + 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x22, 0x51, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x10, + 0x0a, 0x0c, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x45, 0x54, 0x10, 0x00, + 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x53, 0x55, 0x42, 0x4d, 0x49, + 0x54, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x56, 0x45, + 0x52, 0x49, 0x46, 0x59, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, + 0x5f, 0x44, 0x4f, 0x4e, 0x45, 0x10, 0x03, 0x22, 0x62, 0x0a, 0x16, 0x41, 0x70, 0x70, 0x52, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, + 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6c, 0x75, + 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x13, 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, + 0x64, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x48, 0x0a, 0x1c, 0x41, + 0x70, 0x70, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, + 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, + 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x39, 0x0a, 0x18, 0x41, 0x70, 0x70, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, + 0x22, 0x2b, 0x0a, 0x10, 0x50, 0x61, 0x75, 0x73, 0x65, 0x54, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x61, 0x69, 0x6c, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x69, 0x6c, 0x49, 0x64, 0x22, 0x2c, 0x0a, + 0x11, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x54, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x61, 0x69, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x69, 0x6c, 0x49, 0x64, 0x22, 0x23, 0x0a, 0x0b, 0x54, + 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, + 0x70, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, + 0x22, 0x26, 0x0a, 0x0c, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x32, 0xe8, 0x11, 0x0a, 0x08, 0x45, 0x78, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x12, 0x37, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x12, + 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, + 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x15, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, + 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, + 0x49, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x12, + 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x69, 0x70, 0x65, + 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, + 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x0b, 0x47, 0x65, + 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, + 0x65, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x69, 0x70, 0x65, + 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x69, 0x70, + 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, + 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, + 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, + 0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, + 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x0c, 0x53, 0x65, 0x74, + 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x53, 0x65, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x47, 0x0a, 0x0d, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, + 0x65, 0x12, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x50, 0x61, 0x75, 0x73, 0x65, + 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, + 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0e, 0x52, 0x65, 0x73, + 0x75, 0x6d, 0x65, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x1d, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x50, 0x69, 0x70, 0x65, 0x6c, + 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, + 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, + 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x12, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, + 0x6e, 0x64, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, + 0x10, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, + 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4e, + 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x52, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x12, 0x41, 0x74, 0x74, 0x61, + 0x63, 0x68, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68, 0x4e, 0x6f, + 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x6e, 0x64, + 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x88, 0x02, 0x01, + 0x12, 0x56, 0x0a, 0x12, 0x44, 0x65, 0x74, 0x61, 0x63, 0x68, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x44, 0x65, 0x74, 0x61, 0x63, 0x68, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x03, 0x88, 0x02, 0x01, 0x12, 0x49, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, + 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x6e, + 0x64, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x0a, + 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, + 0x65, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x30, 0x01, 0x12, 0x33, 0x0a, 0x04, 0x54, 0x61, 0x69, 0x6c, 0x12, 0x13, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x54, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x54, 0x61, 0x69, 0x6c, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x3f, 0x0a, 0x09, 0x50, 0x61, 0x75, 0x73, + 0x65, 0x54, 0x61, 0x69, 0x6c, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x50, + 0x61, 0x75, 0x73, 0x65, 0x54, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, + 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0a, 0x52, 0x65, 0x73, + 0x75, 0x6d, 0x65, 0x54, 0x61, 0x69, 0x6c, 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x54, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x6e, + 0x64, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, 0x10, + 0x47, 0x65, 0x74, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x61, 0x74, 0x65, 0x73, + 0x12, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x75, 0x64, + 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x75, + 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x40, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x53, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, 0x0a, 0x15, 0x41, 0x70, 0x70, 0x52, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x12, 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x41, 0x70, 0x70, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, + 0x0b, 0x41, 0x70, 0x70, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, 0x15, 0x41, 0x70, 0x70, 0x56, 0x65, 0x72, + 0x69, 0x66, 0x79, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x70, 0x56, 0x65, 0x72, 0x69, + 0x66, 0x79, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, + 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x4f, 0x0a, 0x11, 0x41, 0x70, 0x70, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, + 0x6a, 0x65, 0x63, 0x74, 0x12, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x70, + 0x70, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x31, 0x0a, 0x04, 0x54, 0x65, 0x73, 0x74, 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x73, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x6c, 0x69, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_sp_external_proto_rawDescOnce sync.Once + file_sp_external_proto_rawDescData = file_sp_external_proto_rawDesc +) + +func file_sp_external_proto_rawDescGZIP() []byte { + file_sp_external_proto_rawDescOnce.Do(func() { + file_sp_external_proto_rawDescData = protoimpl.X.CompressGZIP(file_sp_external_proto_rawDescData) + }) + return file_sp_external_proto_rawDescData +} + +var file_sp_external_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_sp_external_proto_msgTypes = make([]protoimpl.MessageInfo, 44) +var file_sp_external_proto_goTypes = []interface{}{ + (AppRegistrationStatusResponse_Status)(0), // 0: protos.AppRegistrationStatusResponse.Status + (*GetAllRequest)(nil), // 1: protos.GetAllRequest + (*GetAllResponse)(nil), // 2: protos.GetAllResponse + (*GetPipelinesRequest)(nil), // 3: protos.GetPipelinesRequest + (*GetPipelinesResponse)(nil), // 4: protos.GetPipelinesResponse + (*GetPipelineRequest)(nil), // 5: protos.GetPipelineRequest + (*GetPipelineResponse)(nil), // 6: protos.GetPipelineResponse + (*CreatePipelineRequest)(nil), // 7: protos.CreatePipelineRequest + (*CreatePipelineResponse)(nil), // 8: protos.CreatePipelineResponse + (*UpdatePipelineRequest)(nil), // 9: protos.UpdatePipelineRequest + (*DeletePipelineRequest)(nil), // 10: protos.DeletePipelineRequest + (*SetPipelinesRequest)(nil), // 11: protos.SetPipelinesRequest + (*PausePipelineRequest)(nil), // 12: protos.PausePipelineRequest + (*ResumePipelineRequest)(nil), // 13: protos.ResumePipelineRequest + (*CreateNotificationRequest)(nil), // 14: protos.CreateNotificationRequest + (*UpdateNotificationRequest)(nil), // 15: protos.UpdateNotificationRequest + (*DeleteNotificationRequest)(nil), // 16: protos.DeleteNotificationRequest + (*GetNotificationsRequest)(nil), // 17: protos.GetNotificationsRequest + (*GetNotificationsResponse)(nil), // 18: protos.GetNotificationsResponse + (*GetNotificationRequest)(nil), // 19: protos.GetNotificationRequest + (*GetNotificationResponse)(nil), // 20: protos.GetNotificationResponse + (*AttachNotificationRequest)(nil), // 21: protos.AttachNotificationRequest + (*DetachNotificationRequest)(nil), // 22: protos.DetachNotificationRequest + (*DeleteAudienceRequest)(nil), // 23: protos.DeleteAudienceRequest + (*DeleteServiceRequest)(nil), // 24: protos.DeleteServiceRequest + (*GetMetricsRequest)(nil), // 25: protos.GetMetricsRequest + (*GetMetricsResponse)(nil), // 26: protos.GetMetricsResponse + (*GetAudienceRatesRequest)(nil), // 27: protos.GetAudienceRatesRequest + (*GetAudienceRatesResponse)(nil), // 28: protos.GetAudienceRatesResponse + (*GetSchemaRequest)(nil), // 29: protos.GetSchemaRequest + (*GetSchemaResponse)(nil), // 30: protos.GetSchemaResponse + (*AppRegistrationStatusRequest)(nil), // 31: protos.AppRegistrationStatusRequest + (*AppRegistrationStatusResponse)(nil), // 32: protos.AppRegistrationStatusResponse + (*AppRegistrationRequest)(nil), // 33: protos.AppRegistrationRequest + (*AppVerifyRegistrationRequest)(nil), // 34: protos.AppVerifyRegistrationRequest + (*AppRegisterRejectRequest)(nil), // 35: protos.AppRegisterRejectRequest + (*PauseTailRequest)(nil), // 36: protos.PauseTailRequest + (*ResumeTailRequest)(nil), // 37: protos.ResumeTailRequest + (*TestRequest)(nil), // 38: protos.TestRequest + (*TestResponse)(nil), // 39: protos.TestResponse + nil, // 40: protos.GetAllResponse.PipelinesEntry + nil, // 41: protos.GetAllResponse.ConfigsEntry + nil, // 42: protos.GetNotificationsResponse.NotificationsEntry + nil, // 43: protos.GetMetricsResponse.MetricsEntry + nil, // 44: protos.GetAudienceRatesResponse.RatesEntry + (*LiveInfo)(nil), // 45: protos.LiveInfo + (*Audience)(nil), // 46: protos.Audience + (*Pipeline)(nil), // 47: protos.Pipeline + (*NotificationConfig)(nil), // 48: protos.NotificationConfig + (*Schema)(nil), // 49: protos.Schema + (*PipelineInfo)(nil), // 50: protos.PipelineInfo + (*PipelineConfigs)(nil), // 51: protos.PipelineConfigs + (*Metric)(nil), // 52: protos.Metric + (*AudienceRate)(nil), // 53: protos.AudienceRate + (*TailRequest)(nil), // 54: protos.TailRequest + (*StandardResponse)(nil), // 55: protos.StandardResponse + (*TailResponse)(nil), // 56: protos.TailResponse +} +var file_sp_external_proto_depIdxs = []int32{ + 45, // 0: protos.GetAllResponse.live:type_name -> protos.LiveInfo + 46, // 1: protos.GetAllResponse.audiences:type_name -> protos.Audience + 40, // 2: protos.GetAllResponse.pipelines:type_name -> protos.GetAllResponse.PipelinesEntry + 41, // 3: protos.GetAllResponse.configs:type_name -> protos.GetAllResponse.ConfigsEntry + 47, // 4: protos.GetPipelinesResponse.pipelines:type_name -> protos.Pipeline + 47, // 5: protos.GetPipelineResponse.pipeline:type_name -> protos.Pipeline + 47, // 6: protos.CreatePipelineRequest.pipeline:type_name -> protos.Pipeline + 47, // 7: protos.UpdatePipelineRequest.pipeline:type_name -> protos.Pipeline + 46, // 8: protos.DeletePipelineRequest._audiences:type_name -> protos.Audience + 46, // 9: protos.SetPipelinesRequest.audience:type_name -> protos.Audience + 46, // 10: protos.PausePipelineRequest.audience:type_name -> protos.Audience + 46, // 11: protos.ResumePipelineRequest.audience:type_name -> protos.Audience + 48, // 12: protos.CreateNotificationRequest.notification:type_name -> protos.NotificationConfig + 48, // 13: protos.UpdateNotificationRequest.notification:type_name -> protos.NotificationConfig + 42, // 14: protos.GetNotificationsResponse.notifications:type_name -> protos.GetNotificationsResponse.NotificationsEntry + 48, // 15: protos.GetNotificationResponse.notification:type_name -> protos.NotificationConfig + 46, // 16: protos.DeleteAudienceRequest.audience:type_name -> protos.Audience + 43, // 17: protos.GetMetricsResponse.metrics:type_name -> protos.GetMetricsResponse.MetricsEntry + 44, // 18: protos.GetAudienceRatesResponse.rates:type_name -> protos.GetAudienceRatesResponse.RatesEntry + 46, // 19: protos.GetSchemaRequest.audience:type_name -> protos.Audience + 49, // 20: protos.GetSchemaResponse.schema:type_name -> protos.Schema + 0, // 21: protos.AppRegistrationStatusResponse.status:type_name -> protos.AppRegistrationStatusResponse.Status + 50, // 22: protos.GetAllResponse.PipelinesEntry.value:type_name -> protos.PipelineInfo + 51, // 23: protos.GetAllResponse.ConfigsEntry.value:type_name -> protos.PipelineConfigs + 48, // 24: protos.GetNotificationsResponse.NotificationsEntry.value:type_name -> protos.NotificationConfig + 52, // 25: protos.GetMetricsResponse.MetricsEntry.value:type_name -> protos.Metric + 53, // 26: protos.GetAudienceRatesResponse.RatesEntry.value:type_name -> protos.AudienceRate + 1, // 27: protos.External.GetAll:input_type -> protos.GetAllRequest + 1, // 28: protos.External.GetAllStream:input_type -> protos.GetAllRequest + 3, // 29: protos.External.GetPipelines:input_type -> protos.GetPipelinesRequest + 5, // 30: protos.External.GetPipeline:input_type -> protos.GetPipelineRequest + 7, // 31: protos.External.CreatePipeline:input_type -> protos.CreatePipelineRequest + 9, // 32: protos.External.UpdatePipeline:input_type -> protos.UpdatePipelineRequest + 10, // 33: protos.External.DeletePipeline:input_type -> protos.DeletePipelineRequest + 11, // 34: protos.External.SetPipelines:input_type -> protos.SetPipelinesRequest + 12, // 35: protos.External.PausePipeline:input_type -> protos.PausePipelineRequest + 13, // 36: protos.External.ResumePipeline:input_type -> protos.ResumePipelineRequest + 14, // 37: protos.External.CreateNotification:input_type -> protos.CreateNotificationRequest + 15, // 38: protos.External.UpdateNotification:input_type -> protos.UpdateNotificationRequest + 16, // 39: protos.External.DeleteNotification:input_type -> protos.DeleteNotificationRequest + 17, // 40: protos.External.GetNotifications:input_type -> protos.GetNotificationsRequest + 19, // 41: protos.External.GetNotification:input_type -> protos.GetNotificationRequest + 21, // 42: protos.External.AttachNotification:input_type -> protos.AttachNotificationRequest + 22, // 43: protos.External.DetachNotification:input_type -> protos.DetachNotificationRequest + 23, // 44: protos.External.DeleteAudience:input_type -> protos.DeleteAudienceRequest + 24, // 45: protos.External.DeleteService:input_type -> protos.DeleteServiceRequest + 25, // 46: protos.External.GetMetrics:input_type -> protos.GetMetricsRequest + 54, // 47: protos.External.Tail:input_type -> protos.TailRequest + 36, // 48: protos.External.PauseTail:input_type -> protos.PauseTailRequest + 37, // 49: protos.External.ResumeTail:input_type -> protos.ResumeTailRequest + 27, // 50: protos.External.GetAudienceRates:input_type -> protos.GetAudienceRatesRequest + 29, // 51: protos.External.GetSchema:input_type -> protos.GetSchemaRequest + 31, // 52: protos.External.AppRegistrationStatus:input_type -> protos.AppRegistrationStatusRequest + 33, // 53: protos.External.AppRegister:input_type -> protos.AppRegistrationRequest + 34, // 54: protos.External.AppVerifyRegistration:input_type -> protos.AppVerifyRegistrationRequest + 35, // 55: protos.External.AppRegisterReject:input_type -> protos.AppRegisterRejectRequest + 38, // 56: protos.External.Test:input_type -> protos.TestRequest + 2, // 57: protos.External.GetAll:output_type -> protos.GetAllResponse + 2, // 58: protos.External.GetAllStream:output_type -> protos.GetAllResponse + 4, // 59: protos.External.GetPipelines:output_type -> protos.GetPipelinesResponse + 6, // 60: protos.External.GetPipeline:output_type -> protos.GetPipelineResponse + 8, // 61: protos.External.CreatePipeline:output_type -> protos.CreatePipelineResponse + 55, // 62: protos.External.UpdatePipeline:output_type -> protos.StandardResponse + 55, // 63: protos.External.DeletePipeline:output_type -> protos.StandardResponse + 55, // 64: protos.External.SetPipelines:output_type -> protos.StandardResponse + 55, // 65: protos.External.PausePipeline:output_type -> protos.StandardResponse + 55, // 66: protos.External.ResumePipeline:output_type -> protos.StandardResponse + 55, // 67: protos.External.CreateNotification:output_type -> protos.StandardResponse + 55, // 68: protos.External.UpdateNotification:output_type -> protos.StandardResponse + 55, // 69: protos.External.DeleteNotification:output_type -> protos.StandardResponse + 18, // 70: protos.External.GetNotifications:output_type -> protos.GetNotificationsResponse + 20, // 71: protos.External.GetNotification:output_type -> protos.GetNotificationResponse + 55, // 72: protos.External.AttachNotification:output_type -> protos.StandardResponse + 55, // 73: protos.External.DetachNotification:output_type -> protos.StandardResponse + 55, // 74: protos.External.DeleteAudience:output_type -> protos.StandardResponse + 55, // 75: protos.External.DeleteService:output_type -> protos.StandardResponse + 26, // 76: protos.External.GetMetrics:output_type -> protos.GetMetricsResponse + 56, // 77: protos.External.Tail:output_type -> protos.TailResponse + 55, // 78: protos.External.PauseTail:output_type -> protos.StandardResponse + 55, // 79: protos.External.ResumeTail:output_type -> protos.StandardResponse + 28, // 80: protos.External.GetAudienceRates:output_type -> protos.GetAudienceRatesResponse + 30, // 81: protos.External.GetSchema:output_type -> protos.GetSchemaResponse + 32, // 82: protos.External.AppRegistrationStatus:output_type -> protos.AppRegistrationStatusResponse + 55, // 83: protos.External.AppRegister:output_type -> protos.StandardResponse + 55, // 84: protos.External.AppVerifyRegistration:output_type -> protos.StandardResponse + 55, // 85: protos.External.AppRegisterReject:output_type -> protos.StandardResponse + 39, // 86: protos.External.Test:output_type -> protos.TestResponse + 57, // [57:87] is the sub-list for method output_type + 27, // [27:57] is the sub-list for method input_type + 27, // [27:27] is the sub-list for extension type_name + 27, // [27:27] is the sub-list for extension extendee + 0, // [0:27] is the sub-list for field type_name +} + +func init() { file_sp_external_proto_init() } +func file_sp_external_proto_init() { + if File_sp_external_proto != nil { + return + } + file_sp_common_proto_init() + file_sp_info_proto_init() + file_sp_notify_proto_init() + file_sp_pipeline_proto_init() + if !protoimpl.UnsafeEnabled { + file_sp_external_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAllRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAllResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetPipelinesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetPipelinesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetPipelineRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetPipelineResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreatePipelineRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreatePipelineResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdatePipelineRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeletePipelineRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetPipelinesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PausePipelineRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResumePipelineRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateNotificationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateNotificationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteNotificationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetNotificationsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetNotificationsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetNotificationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetNotificationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AttachNotificationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DetachNotificationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteAudienceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteServiceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetMetricsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetMetricsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAudienceRatesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAudienceRatesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSchemaRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSchemaResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AppRegistrationStatusRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AppRegistrationStatusResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AppRegistrationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AppVerifyRegistrationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AppRegisterRejectRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PauseTailRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResumeTailRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_external_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_sp_external_proto_msgTypes[1].OneofWrappers = []interface{}{} + file_sp_external_proto_msgTypes[22].OneofWrappers = []interface{}{} + file_sp_external_proto_msgTypes[23].OneofWrappers = []interface{}{} + file_sp_external_proto_msgTypes[25].OneofWrappers = []interface{}{} + file_sp_external_proto_msgTypes[27].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_sp_external_proto_rawDesc, + NumEnums: 1, + NumMessages: 44, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_sp_external_proto_goTypes, + DependencyIndexes: file_sp_external_proto_depIdxs, + EnumInfos: file_sp_external_proto_enumTypes, + MessageInfos: file_sp_external_proto_msgTypes, + }.Build() + File_sp_external_proto = out.File + file_sp_external_proto_rawDesc = nil + file_sp_external_proto_goTypes = nil + file_sp_external_proto_depIdxs = nil +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_external_grpc.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_external_grpc.pb.go new file mode 100644 index 000000000..1fa01adb7 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_external_grpc.pb.go @@ -0,0 +1,1337 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v3.21.12 +// source: sp_external.proto + +package protos + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + External_GetAll_FullMethodName = "/protos.External/GetAll" + External_GetAllStream_FullMethodName = "/protos.External/GetAllStream" + External_GetPipelines_FullMethodName = "/protos.External/GetPipelines" + External_GetPipeline_FullMethodName = "/protos.External/GetPipeline" + External_CreatePipeline_FullMethodName = "/protos.External/CreatePipeline" + External_UpdatePipeline_FullMethodName = "/protos.External/UpdatePipeline" + External_DeletePipeline_FullMethodName = "/protos.External/DeletePipeline" + External_SetPipelines_FullMethodName = "/protos.External/SetPipelines" + External_PausePipeline_FullMethodName = "/protos.External/PausePipeline" + External_ResumePipeline_FullMethodName = "/protos.External/ResumePipeline" + External_CreateNotification_FullMethodName = "/protos.External/CreateNotification" + External_UpdateNotification_FullMethodName = "/protos.External/UpdateNotification" + External_DeleteNotification_FullMethodName = "/protos.External/DeleteNotification" + External_GetNotifications_FullMethodName = "/protos.External/GetNotifications" + External_GetNotification_FullMethodName = "/protos.External/GetNotification" + External_AttachNotification_FullMethodName = "/protos.External/AttachNotification" + External_DetachNotification_FullMethodName = "/protos.External/DetachNotification" + External_DeleteAudience_FullMethodName = "/protos.External/DeleteAudience" + External_DeleteService_FullMethodName = "/protos.External/DeleteService" + External_GetMetrics_FullMethodName = "/protos.External/GetMetrics" + External_Tail_FullMethodName = "/protos.External/Tail" + External_PauseTail_FullMethodName = "/protos.External/PauseTail" + External_ResumeTail_FullMethodName = "/protos.External/ResumeTail" + External_GetAudienceRates_FullMethodName = "/protos.External/GetAudienceRates" + External_GetSchema_FullMethodName = "/protos.External/GetSchema" + External_AppRegistrationStatus_FullMethodName = "/protos.External/AppRegistrationStatus" + External_AppRegister_FullMethodName = "/protos.External/AppRegister" + External_AppVerifyRegistration_FullMethodName = "/protos.External/AppVerifyRegistration" + External_AppRegisterReject_FullMethodName = "/protos.External/AppRegisterReject" + External_Test_FullMethodName = "/protos.External/Test" +) + +// ExternalClient is the client API for External service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ExternalClient interface { + // Returns all data needed for UI; called on initial console load + GetAll(ctx context.Context, in *GetAllRequest, opts ...grpc.CallOption) (*GetAllResponse, error) + // Used by console to stream updates to UI; called after initial GetAll() + GetAllStream(ctx context.Context, in *GetAllRequest, opts ...grpc.CallOption) (External_GetAllStreamClient, error) + // Returns pipelines (_wasm_bytes field is stripped) + GetPipelines(ctx context.Context, in *GetPipelinesRequest, opts ...grpc.CallOption) (*GetPipelinesResponse, error) + // Returns a single pipeline (_wasm_bytes field is stripped) + GetPipeline(ctx context.Context, in *GetPipelineRequest, opts ...grpc.CallOption) (*GetPipelineResponse, error) + // Create a new pipeline; id must be left empty on create + CreatePipeline(ctx context.Context, in *CreatePipelineRequest, opts ...grpc.CallOption) (*CreatePipelineResponse, error) + // Update an existing pipeline; id must be set + UpdatePipeline(ctx context.Context, in *UpdatePipelineRequest, opts ...grpc.CallOption) (*StandardResponse, error) + // Delete a pipeline + DeletePipeline(ctx context.Context, in *DeletePipelineRequest, opts ...grpc.CallOption) (*StandardResponse, error) + SetPipelines(ctx context.Context, in *SetPipelinesRequest, opts ...grpc.CallOption) (*StandardResponse, error) + // Pause a pipeline; noop if pipeline is already paused + PausePipeline(ctx context.Context, in *PausePipelineRequest, opts ...grpc.CallOption) (*StandardResponse, error) + // Resume a pipeline; noop if pipeline is not paused + ResumePipeline(ctx context.Context, in *ResumePipelineRequest, opts ...grpc.CallOption) (*StandardResponse, error) + // Create a new notification config + CreateNotification(ctx context.Context, in *CreateNotificationRequest, opts ...grpc.CallOption) (*StandardResponse, error) + // Update an existing notification config + UpdateNotification(ctx context.Context, in *UpdateNotificationRequest, opts ...grpc.CallOption) (*StandardResponse, error) + // Delete a notification config + DeleteNotification(ctx context.Context, in *DeleteNotificationRequest, opts ...grpc.CallOption) (*StandardResponse, error) + // Returns all notification configs + GetNotifications(ctx context.Context, in *GetNotificationsRequest, opts ...grpc.CallOption) (*GetNotificationsResponse, error) + // Returns a single notification config + GetNotification(ctx context.Context, in *GetNotificationRequest, opts ...grpc.CallOption) (*GetNotificationResponse, error) + // Deprecated: Do not use. + // Attach a notification config to a pipeline + AttachNotification(ctx context.Context, in *AttachNotificationRequest, opts ...grpc.CallOption) (*StandardResponse, error) + // Deprecated: Do not use. + // Detach a notification config from a pipeline + DetachNotification(ctx context.Context, in *DetachNotificationRequest, opts ...grpc.CallOption) (*StandardResponse, error) + // Delete an audience + DeleteAudience(ctx context.Context, in *DeleteAudienceRequest, opts ...grpc.CallOption) (*StandardResponse, error) + // Delete a service and all associated audiences + DeleteService(ctx context.Context, in *DeleteServiceRequest, opts ...grpc.CallOption) (*StandardResponse, error) + // Returns all metric counters + GetMetrics(ctx context.Context, in *GetMetricsRequest, opts ...grpc.CallOption) (External_GetMetricsClient, error) + Tail(ctx context.Context, in *TailRequest, opts ...grpc.CallOption) (External_TailClient, error) + PauseTail(ctx context.Context, in *PauseTailRequest, opts ...grpc.CallOption) (*StandardResponse, error) + ResumeTail(ctx context.Context, in *ResumeTailRequest, opts ...grpc.CallOption) (*StandardResponse, error) + GetAudienceRates(ctx context.Context, in *GetAudienceRatesRequest, opts ...grpc.CallOption) (External_GetAudienceRatesClient, error) + GetSchema(ctx context.Context, in *GetSchemaRequest, opts ...grpc.CallOption) (*GetSchemaResponse, error) + AppRegistrationStatus(ctx context.Context, in *AppRegistrationStatusRequest, opts ...grpc.CallOption) (*AppRegistrationStatusResponse, error) + AppRegister(ctx context.Context, in *AppRegistrationRequest, opts ...grpc.CallOption) (*StandardResponse, error) + AppVerifyRegistration(ctx context.Context, in *AppVerifyRegistrationRequest, opts ...grpc.CallOption) (*StandardResponse, error) + AppRegisterReject(ctx context.Context, in *AppRegisterRejectRequest, opts ...grpc.CallOption) (*StandardResponse, error) + // Test method + Test(ctx context.Context, in *TestRequest, opts ...grpc.CallOption) (*TestResponse, error) +} + +type externalClient struct { + cc grpc.ClientConnInterface +} + +func NewExternalClient(cc grpc.ClientConnInterface) ExternalClient { + return &externalClient{cc} +} + +func (c *externalClient) GetAll(ctx context.Context, in *GetAllRequest, opts ...grpc.CallOption) (*GetAllResponse, error) { + out := new(GetAllResponse) + err := c.cc.Invoke(ctx, External_GetAll_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) GetAllStream(ctx context.Context, in *GetAllRequest, opts ...grpc.CallOption) (External_GetAllStreamClient, error) { + stream, err := c.cc.NewStream(ctx, &External_ServiceDesc.Streams[0], External_GetAllStream_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &externalGetAllStreamClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type External_GetAllStreamClient interface { + Recv() (*GetAllResponse, error) + grpc.ClientStream +} + +type externalGetAllStreamClient struct { + grpc.ClientStream +} + +func (x *externalGetAllStreamClient) Recv() (*GetAllResponse, error) { + m := new(GetAllResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *externalClient) GetPipelines(ctx context.Context, in *GetPipelinesRequest, opts ...grpc.CallOption) (*GetPipelinesResponse, error) { + out := new(GetPipelinesResponse) + err := c.cc.Invoke(ctx, External_GetPipelines_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) GetPipeline(ctx context.Context, in *GetPipelineRequest, opts ...grpc.CallOption) (*GetPipelineResponse, error) { + out := new(GetPipelineResponse) + err := c.cc.Invoke(ctx, External_GetPipeline_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) CreatePipeline(ctx context.Context, in *CreatePipelineRequest, opts ...grpc.CallOption) (*CreatePipelineResponse, error) { + out := new(CreatePipelineResponse) + err := c.cc.Invoke(ctx, External_CreatePipeline_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) UpdatePipeline(ctx context.Context, in *UpdatePipelineRequest, opts ...grpc.CallOption) (*StandardResponse, error) { + out := new(StandardResponse) + err := c.cc.Invoke(ctx, External_UpdatePipeline_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) DeletePipeline(ctx context.Context, in *DeletePipelineRequest, opts ...grpc.CallOption) (*StandardResponse, error) { + out := new(StandardResponse) + err := c.cc.Invoke(ctx, External_DeletePipeline_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) SetPipelines(ctx context.Context, in *SetPipelinesRequest, opts ...grpc.CallOption) (*StandardResponse, error) { + out := new(StandardResponse) + err := c.cc.Invoke(ctx, External_SetPipelines_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) PausePipeline(ctx context.Context, in *PausePipelineRequest, opts ...grpc.CallOption) (*StandardResponse, error) { + out := new(StandardResponse) + err := c.cc.Invoke(ctx, External_PausePipeline_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) ResumePipeline(ctx context.Context, in *ResumePipelineRequest, opts ...grpc.CallOption) (*StandardResponse, error) { + out := new(StandardResponse) + err := c.cc.Invoke(ctx, External_ResumePipeline_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) CreateNotification(ctx context.Context, in *CreateNotificationRequest, opts ...grpc.CallOption) (*StandardResponse, error) { + out := new(StandardResponse) + err := c.cc.Invoke(ctx, External_CreateNotification_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) UpdateNotification(ctx context.Context, in *UpdateNotificationRequest, opts ...grpc.CallOption) (*StandardResponse, error) { + out := new(StandardResponse) + err := c.cc.Invoke(ctx, External_UpdateNotification_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) DeleteNotification(ctx context.Context, in *DeleteNotificationRequest, opts ...grpc.CallOption) (*StandardResponse, error) { + out := new(StandardResponse) + err := c.cc.Invoke(ctx, External_DeleteNotification_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) GetNotifications(ctx context.Context, in *GetNotificationsRequest, opts ...grpc.CallOption) (*GetNotificationsResponse, error) { + out := new(GetNotificationsResponse) + err := c.cc.Invoke(ctx, External_GetNotifications_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) GetNotification(ctx context.Context, in *GetNotificationRequest, opts ...grpc.CallOption) (*GetNotificationResponse, error) { + out := new(GetNotificationResponse) + err := c.cc.Invoke(ctx, External_GetNotification_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Deprecated: Do not use. +func (c *externalClient) AttachNotification(ctx context.Context, in *AttachNotificationRequest, opts ...grpc.CallOption) (*StandardResponse, error) { + out := new(StandardResponse) + err := c.cc.Invoke(ctx, External_AttachNotification_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Deprecated: Do not use. +func (c *externalClient) DetachNotification(ctx context.Context, in *DetachNotificationRequest, opts ...grpc.CallOption) (*StandardResponse, error) { + out := new(StandardResponse) + err := c.cc.Invoke(ctx, External_DetachNotification_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) DeleteAudience(ctx context.Context, in *DeleteAudienceRequest, opts ...grpc.CallOption) (*StandardResponse, error) { + out := new(StandardResponse) + err := c.cc.Invoke(ctx, External_DeleteAudience_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) DeleteService(ctx context.Context, in *DeleteServiceRequest, opts ...grpc.CallOption) (*StandardResponse, error) { + out := new(StandardResponse) + err := c.cc.Invoke(ctx, External_DeleteService_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) GetMetrics(ctx context.Context, in *GetMetricsRequest, opts ...grpc.CallOption) (External_GetMetricsClient, error) { + stream, err := c.cc.NewStream(ctx, &External_ServiceDesc.Streams[1], External_GetMetrics_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &externalGetMetricsClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type External_GetMetricsClient interface { + Recv() (*GetMetricsResponse, error) + grpc.ClientStream +} + +type externalGetMetricsClient struct { + grpc.ClientStream +} + +func (x *externalGetMetricsClient) Recv() (*GetMetricsResponse, error) { + m := new(GetMetricsResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *externalClient) Tail(ctx context.Context, in *TailRequest, opts ...grpc.CallOption) (External_TailClient, error) { + stream, err := c.cc.NewStream(ctx, &External_ServiceDesc.Streams[2], External_Tail_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &externalTailClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type External_TailClient interface { + Recv() (*TailResponse, error) + grpc.ClientStream +} + +type externalTailClient struct { + grpc.ClientStream +} + +func (x *externalTailClient) Recv() (*TailResponse, error) { + m := new(TailResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *externalClient) PauseTail(ctx context.Context, in *PauseTailRequest, opts ...grpc.CallOption) (*StandardResponse, error) { + out := new(StandardResponse) + err := c.cc.Invoke(ctx, External_PauseTail_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) ResumeTail(ctx context.Context, in *ResumeTailRequest, opts ...grpc.CallOption) (*StandardResponse, error) { + out := new(StandardResponse) + err := c.cc.Invoke(ctx, External_ResumeTail_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) GetAudienceRates(ctx context.Context, in *GetAudienceRatesRequest, opts ...grpc.CallOption) (External_GetAudienceRatesClient, error) { + stream, err := c.cc.NewStream(ctx, &External_ServiceDesc.Streams[3], External_GetAudienceRates_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &externalGetAudienceRatesClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type External_GetAudienceRatesClient interface { + Recv() (*GetAudienceRatesResponse, error) + grpc.ClientStream +} + +type externalGetAudienceRatesClient struct { + grpc.ClientStream +} + +func (x *externalGetAudienceRatesClient) Recv() (*GetAudienceRatesResponse, error) { + m := new(GetAudienceRatesResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *externalClient) GetSchema(ctx context.Context, in *GetSchemaRequest, opts ...grpc.CallOption) (*GetSchemaResponse, error) { + out := new(GetSchemaResponse) + err := c.cc.Invoke(ctx, External_GetSchema_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) AppRegistrationStatus(ctx context.Context, in *AppRegistrationStatusRequest, opts ...grpc.CallOption) (*AppRegistrationStatusResponse, error) { + out := new(AppRegistrationStatusResponse) + err := c.cc.Invoke(ctx, External_AppRegistrationStatus_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) AppRegister(ctx context.Context, in *AppRegistrationRequest, opts ...grpc.CallOption) (*StandardResponse, error) { + out := new(StandardResponse) + err := c.cc.Invoke(ctx, External_AppRegister_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) AppVerifyRegistration(ctx context.Context, in *AppVerifyRegistrationRequest, opts ...grpc.CallOption) (*StandardResponse, error) { + out := new(StandardResponse) + err := c.cc.Invoke(ctx, External_AppVerifyRegistration_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) AppRegisterReject(ctx context.Context, in *AppRegisterRejectRequest, opts ...grpc.CallOption) (*StandardResponse, error) { + out := new(StandardResponse) + err := c.cc.Invoke(ctx, External_AppRegisterReject_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *externalClient) Test(ctx context.Context, in *TestRequest, opts ...grpc.CallOption) (*TestResponse, error) { + out := new(TestResponse) + err := c.cc.Invoke(ctx, External_Test_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ExternalServer is the server API for External service. +// All implementations must embed UnimplementedExternalServer +// for forward compatibility +type ExternalServer interface { + // Returns all data needed for UI; called on initial console load + GetAll(context.Context, *GetAllRequest) (*GetAllResponse, error) + // Used by console to stream updates to UI; called after initial GetAll() + GetAllStream(*GetAllRequest, External_GetAllStreamServer) error + // Returns pipelines (_wasm_bytes field is stripped) + GetPipelines(context.Context, *GetPipelinesRequest) (*GetPipelinesResponse, error) + // Returns a single pipeline (_wasm_bytes field is stripped) + GetPipeline(context.Context, *GetPipelineRequest) (*GetPipelineResponse, error) + // Create a new pipeline; id must be left empty on create + CreatePipeline(context.Context, *CreatePipelineRequest) (*CreatePipelineResponse, error) + // Update an existing pipeline; id must be set + UpdatePipeline(context.Context, *UpdatePipelineRequest) (*StandardResponse, error) + // Delete a pipeline + DeletePipeline(context.Context, *DeletePipelineRequest) (*StandardResponse, error) + SetPipelines(context.Context, *SetPipelinesRequest) (*StandardResponse, error) + // Pause a pipeline; noop if pipeline is already paused + PausePipeline(context.Context, *PausePipelineRequest) (*StandardResponse, error) + // Resume a pipeline; noop if pipeline is not paused + ResumePipeline(context.Context, *ResumePipelineRequest) (*StandardResponse, error) + // Create a new notification config + CreateNotification(context.Context, *CreateNotificationRequest) (*StandardResponse, error) + // Update an existing notification config + UpdateNotification(context.Context, *UpdateNotificationRequest) (*StandardResponse, error) + // Delete a notification config + DeleteNotification(context.Context, *DeleteNotificationRequest) (*StandardResponse, error) + // Returns all notification configs + GetNotifications(context.Context, *GetNotificationsRequest) (*GetNotificationsResponse, error) + // Returns a single notification config + GetNotification(context.Context, *GetNotificationRequest) (*GetNotificationResponse, error) + // Deprecated: Do not use. + // Attach a notification config to a pipeline + AttachNotification(context.Context, *AttachNotificationRequest) (*StandardResponse, error) + // Deprecated: Do not use. + // Detach a notification config from a pipeline + DetachNotification(context.Context, *DetachNotificationRequest) (*StandardResponse, error) + // Delete an audience + DeleteAudience(context.Context, *DeleteAudienceRequest) (*StandardResponse, error) + // Delete a service and all associated audiences + DeleteService(context.Context, *DeleteServiceRequest) (*StandardResponse, error) + // Returns all metric counters + GetMetrics(*GetMetricsRequest, External_GetMetricsServer) error + Tail(*TailRequest, External_TailServer) error + PauseTail(context.Context, *PauseTailRequest) (*StandardResponse, error) + ResumeTail(context.Context, *ResumeTailRequest) (*StandardResponse, error) + GetAudienceRates(*GetAudienceRatesRequest, External_GetAudienceRatesServer) error + GetSchema(context.Context, *GetSchemaRequest) (*GetSchemaResponse, error) + AppRegistrationStatus(context.Context, *AppRegistrationStatusRequest) (*AppRegistrationStatusResponse, error) + AppRegister(context.Context, *AppRegistrationRequest) (*StandardResponse, error) + AppVerifyRegistration(context.Context, *AppVerifyRegistrationRequest) (*StandardResponse, error) + AppRegisterReject(context.Context, *AppRegisterRejectRequest) (*StandardResponse, error) + // Test method + Test(context.Context, *TestRequest) (*TestResponse, error) + mustEmbedUnimplementedExternalServer() +} + +// UnimplementedExternalServer must be embedded to have forward compatible implementations. +type UnimplementedExternalServer struct { +} + +func (UnimplementedExternalServer) GetAll(context.Context, *GetAllRequest) (*GetAllResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAll not implemented") +} +func (UnimplementedExternalServer) GetAllStream(*GetAllRequest, External_GetAllStreamServer) error { + return status.Errorf(codes.Unimplemented, "method GetAllStream not implemented") +} +func (UnimplementedExternalServer) GetPipelines(context.Context, *GetPipelinesRequest) (*GetPipelinesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetPipelines not implemented") +} +func (UnimplementedExternalServer) GetPipeline(context.Context, *GetPipelineRequest) (*GetPipelineResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetPipeline not implemented") +} +func (UnimplementedExternalServer) CreatePipeline(context.Context, *CreatePipelineRequest) (*CreatePipelineResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreatePipeline not implemented") +} +func (UnimplementedExternalServer) UpdatePipeline(context.Context, *UpdatePipelineRequest) (*StandardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdatePipeline not implemented") +} +func (UnimplementedExternalServer) DeletePipeline(context.Context, *DeletePipelineRequest) (*StandardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeletePipeline not implemented") +} +func (UnimplementedExternalServer) SetPipelines(context.Context, *SetPipelinesRequest) (*StandardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetPipelines not implemented") +} +func (UnimplementedExternalServer) PausePipeline(context.Context, *PausePipelineRequest) (*StandardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PausePipeline not implemented") +} +func (UnimplementedExternalServer) ResumePipeline(context.Context, *ResumePipelineRequest) (*StandardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ResumePipeline not implemented") +} +func (UnimplementedExternalServer) CreateNotification(context.Context, *CreateNotificationRequest) (*StandardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateNotification not implemented") +} +func (UnimplementedExternalServer) UpdateNotification(context.Context, *UpdateNotificationRequest) (*StandardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateNotification not implemented") +} +func (UnimplementedExternalServer) DeleteNotification(context.Context, *DeleteNotificationRequest) (*StandardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteNotification not implemented") +} +func (UnimplementedExternalServer) GetNotifications(context.Context, *GetNotificationsRequest) (*GetNotificationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetNotifications not implemented") +} +func (UnimplementedExternalServer) GetNotification(context.Context, *GetNotificationRequest) (*GetNotificationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetNotification not implemented") +} +func (UnimplementedExternalServer) AttachNotification(context.Context, *AttachNotificationRequest) (*StandardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AttachNotification not implemented") +} +func (UnimplementedExternalServer) DetachNotification(context.Context, *DetachNotificationRequest) (*StandardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DetachNotification not implemented") +} +func (UnimplementedExternalServer) DeleteAudience(context.Context, *DeleteAudienceRequest) (*StandardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteAudience not implemented") +} +func (UnimplementedExternalServer) DeleteService(context.Context, *DeleteServiceRequest) (*StandardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteService not implemented") +} +func (UnimplementedExternalServer) GetMetrics(*GetMetricsRequest, External_GetMetricsServer) error { + return status.Errorf(codes.Unimplemented, "method GetMetrics not implemented") +} +func (UnimplementedExternalServer) Tail(*TailRequest, External_TailServer) error { + return status.Errorf(codes.Unimplemented, "method Tail not implemented") +} +func (UnimplementedExternalServer) PauseTail(context.Context, *PauseTailRequest) (*StandardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PauseTail not implemented") +} +func (UnimplementedExternalServer) ResumeTail(context.Context, *ResumeTailRequest) (*StandardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ResumeTail not implemented") +} +func (UnimplementedExternalServer) GetAudienceRates(*GetAudienceRatesRequest, External_GetAudienceRatesServer) error { + return status.Errorf(codes.Unimplemented, "method GetAudienceRates not implemented") +} +func (UnimplementedExternalServer) GetSchema(context.Context, *GetSchemaRequest) (*GetSchemaResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSchema not implemented") +} +func (UnimplementedExternalServer) AppRegistrationStatus(context.Context, *AppRegistrationStatusRequest) (*AppRegistrationStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AppRegistrationStatus not implemented") +} +func (UnimplementedExternalServer) AppRegister(context.Context, *AppRegistrationRequest) (*StandardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AppRegister not implemented") +} +func (UnimplementedExternalServer) AppVerifyRegistration(context.Context, *AppVerifyRegistrationRequest) (*StandardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AppVerifyRegistration not implemented") +} +func (UnimplementedExternalServer) AppRegisterReject(context.Context, *AppRegisterRejectRequest) (*StandardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AppRegisterReject not implemented") +} +func (UnimplementedExternalServer) Test(context.Context, *TestRequest) (*TestResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Test not implemented") +} +func (UnimplementedExternalServer) mustEmbedUnimplementedExternalServer() {} + +// UnsafeExternalServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ExternalServer will +// result in compilation errors. +type UnsafeExternalServer interface { + mustEmbedUnimplementedExternalServer() +} + +func RegisterExternalServer(s grpc.ServiceRegistrar, srv ExternalServer) { + s.RegisterService(&External_ServiceDesc, srv) +} + +func _External_GetAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAllRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).GetAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_GetAll_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).GetAll(ctx, req.(*GetAllRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_GetAllStream_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(GetAllRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ExternalServer).GetAllStream(m, &externalGetAllStreamServer{stream}) +} + +type External_GetAllStreamServer interface { + Send(*GetAllResponse) error + grpc.ServerStream +} + +type externalGetAllStreamServer struct { + grpc.ServerStream +} + +func (x *externalGetAllStreamServer) Send(m *GetAllResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _External_GetPipelines_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetPipelinesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).GetPipelines(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_GetPipelines_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).GetPipelines(ctx, req.(*GetPipelinesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_GetPipeline_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetPipelineRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).GetPipeline(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_GetPipeline_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).GetPipeline(ctx, req.(*GetPipelineRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_CreatePipeline_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreatePipelineRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).CreatePipeline(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_CreatePipeline_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).CreatePipeline(ctx, req.(*CreatePipelineRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_UpdatePipeline_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdatePipelineRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).UpdatePipeline(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_UpdatePipeline_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).UpdatePipeline(ctx, req.(*UpdatePipelineRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_DeletePipeline_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeletePipelineRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).DeletePipeline(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_DeletePipeline_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).DeletePipeline(ctx, req.(*DeletePipelineRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_SetPipelines_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetPipelinesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).SetPipelines(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_SetPipelines_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).SetPipelines(ctx, req.(*SetPipelinesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_PausePipeline_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PausePipelineRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).PausePipeline(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_PausePipeline_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).PausePipeline(ctx, req.(*PausePipelineRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_ResumePipeline_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ResumePipelineRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).ResumePipeline(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_ResumePipeline_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).ResumePipeline(ctx, req.(*ResumePipelineRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_CreateNotification_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateNotificationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).CreateNotification(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_CreateNotification_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).CreateNotification(ctx, req.(*CreateNotificationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_UpdateNotification_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateNotificationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).UpdateNotification(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_UpdateNotification_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).UpdateNotification(ctx, req.(*UpdateNotificationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_DeleteNotification_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteNotificationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).DeleteNotification(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_DeleteNotification_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).DeleteNotification(ctx, req.(*DeleteNotificationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_GetNotifications_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetNotificationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).GetNotifications(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_GetNotifications_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).GetNotifications(ctx, req.(*GetNotificationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_GetNotification_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetNotificationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).GetNotification(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_GetNotification_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).GetNotification(ctx, req.(*GetNotificationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_AttachNotification_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AttachNotificationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).AttachNotification(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_AttachNotification_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).AttachNotification(ctx, req.(*AttachNotificationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_DetachNotification_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DetachNotificationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).DetachNotification(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_DetachNotification_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).DetachNotification(ctx, req.(*DetachNotificationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_DeleteAudience_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteAudienceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).DeleteAudience(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_DeleteAudience_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).DeleteAudience(ctx, req.(*DeleteAudienceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_DeleteService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteServiceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).DeleteService(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_DeleteService_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).DeleteService(ctx, req.(*DeleteServiceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_GetMetrics_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(GetMetricsRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ExternalServer).GetMetrics(m, &externalGetMetricsServer{stream}) +} + +type External_GetMetricsServer interface { + Send(*GetMetricsResponse) error + grpc.ServerStream +} + +type externalGetMetricsServer struct { + grpc.ServerStream +} + +func (x *externalGetMetricsServer) Send(m *GetMetricsResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _External_Tail_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(TailRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ExternalServer).Tail(m, &externalTailServer{stream}) +} + +type External_TailServer interface { + Send(*TailResponse) error + grpc.ServerStream +} + +type externalTailServer struct { + grpc.ServerStream +} + +func (x *externalTailServer) Send(m *TailResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _External_PauseTail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PauseTailRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).PauseTail(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_PauseTail_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).PauseTail(ctx, req.(*PauseTailRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_ResumeTail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ResumeTailRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).ResumeTail(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_ResumeTail_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).ResumeTail(ctx, req.(*ResumeTailRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_GetAudienceRates_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(GetAudienceRatesRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ExternalServer).GetAudienceRates(m, &externalGetAudienceRatesServer{stream}) +} + +type External_GetAudienceRatesServer interface { + Send(*GetAudienceRatesResponse) error + grpc.ServerStream +} + +type externalGetAudienceRatesServer struct { + grpc.ServerStream +} + +func (x *externalGetAudienceRatesServer) Send(m *GetAudienceRatesResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _External_GetSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSchemaRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).GetSchema(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_GetSchema_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).GetSchema(ctx, req.(*GetSchemaRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_AppRegistrationStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AppRegistrationStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).AppRegistrationStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_AppRegistrationStatus_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).AppRegistrationStatus(ctx, req.(*AppRegistrationStatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_AppRegister_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AppRegistrationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).AppRegister(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_AppRegister_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).AppRegister(ctx, req.(*AppRegistrationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_AppVerifyRegistration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AppVerifyRegistrationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).AppVerifyRegistration(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_AppVerifyRegistration_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).AppVerifyRegistration(ctx, req.(*AppVerifyRegistrationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_AppRegisterReject_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AppRegisterRejectRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).AppRegisterReject(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_AppRegisterReject_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).AppRegisterReject(ctx, req.(*AppRegisterRejectRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _External_Test_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TestRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExternalServer).Test(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: External_Test_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExternalServer).Test(ctx, req.(*TestRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// External_ServiceDesc is the grpc.ServiceDesc for External service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var External_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "protos.External", + HandlerType: (*ExternalServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetAll", + Handler: _External_GetAll_Handler, + }, + { + MethodName: "GetPipelines", + Handler: _External_GetPipelines_Handler, + }, + { + MethodName: "GetPipeline", + Handler: _External_GetPipeline_Handler, + }, + { + MethodName: "CreatePipeline", + Handler: _External_CreatePipeline_Handler, + }, + { + MethodName: "UpdatePipeline", + Handler: _External_UpdatePipeline_Handler, + }, + { + MethodName: "DeletePipeline", + Handler: _External_DeletePipeline_Handler, + }, + { + MethodName: "SetPipelines", + Handler: _External_SetPipelines_Handler, + }, + { + MethodName: "PausePipeline", + Handler: _External_PausePipeline_Handler, + }, + { + MethodName: "ResumePipeline", + Handler: _External_ResumePipeline_Handler, + }, + { + MethodName: "CreateNotification", + Handler: _External_CreateNotification_Handler, + }, + { + MethodName: "UpdateNotification", + Handler: _External_UpdateNotification_Handler, + }, + { + MethodName: "DeleteNotification", + Handler: _External_DeleteNotification_Handler, + }, + { + MethodName: "GetNotifications", + Handler: _External_GetNotifications_Handler, + }, + { + MethodName: "GetNotification", + Handler: _External_GetNotification_Handler, + }, + { + MethodName: "AttachNotification", + Handler: _External_AttachNotification_Handler, + }, + { + MethodName: "DetachNotification", + Handler: _External_DetachNotification_Handler, + }, + { + MethodName: "DeleteAudience", + Handler: _External_DeleteAudience_Handler, + }, + { + MethodName: "DeleteService", + Handler: _External_DeleteService_Handler, + }, + { + MethodName: "PauseTail", + Handler: _External_PauseTail_Handler, + }, + { + MethodName: "ResumeTail", + Handler: _External_ResumeTail_Handler, + }, + { + MethodName: "GetSchema", + Handler: _External_GetSchema_Handler, + }, + { + MethodName: "AppRegistrationStatus", + Handler: _External_AppRegistrationStatus_Handler, + }, + { + MethodName: "AppRegister", + Handler: _External_AppRegister_Handler, + }, + { + MethodName: "AppVerifyRegistration", + Handler: _External_AppVerifyRegistration_Handler, + }, + { + MethodName: "AppRegisterReject", + Handler: _External_AppRegisterReject_Handler, + }, + { + MethodName: "Test", + Handler: _External_Test_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "GetAllStream", + Handler: _External_GetAllStream_Handler, + ServerStreams: true, + }, + { + StreamName: "GetMetrics", + Handler: _External_GetMetrics_Handler, + ServerStreams: true, + }, + { + StreamName: "Tail", + Handler: _External_Tail_Handler, + ServerStreams: true, + }, + { + StreamName: "GetAudienceRates", + Handler: _External_GetAudienceRates_Handler, + ServerStreams: true, + }, + }, + Metadata: "sp_external.proto", +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_info.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_info.pb.go new file mode 100644 index 000000000..ed440a3f6 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_info.pb.go @@ -0,0 +1,453 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: sp_info.proto + +package protos + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ClientType int32 + +const ( + ClientType_CLIENT_TYPE_UNSET ClientType = 0 + ClientType_CLIENT_TYPE_SDK ClientType = 1 + ClientType_CLIENT_TYPE_SHIM ClientType = 2 +) + +// Enum value maps for ClientType. +var ( + ClientType_name = map[int32]string{ + 0: "CLIENT_TYPE_UNSET", + 1: "CLIENT_TYPE_SDK", + 2: "CLIENT_TYPE_SHIM", + } + ClientType_value = map[string]int32{ + "CLIENT_TYPE_UNSET": 0, + "CLIENT_TYPE_SDK": 1, + "CLIENT_TYPE_SHIM": 2, + } +) + +func (x ClientType) Enum() *ClientType { + p := new(ClientType) + *p = x + return p +} + +func (x ClientType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ClientType) Descriptor() protoreflect.EnumDescriptor { + return file_sp_info_proto_enumTypes[0].Descriptor() +} + +func (ClientType) Type() protoreflect.EnumType { + return &file_sp_info_proto_enumTypes[0] +} + +func (x ClientType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ClientType.Descriptor instead. +func (ClientType) EnumDescriptor() ([]byte, []int) { + return file_sp_info_proto_rawDescGZIP(), []int{0} +} + +type LiveInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // If empty, client has not announced any audiences + Audiences []*Audience `protobuf:"bytes,1,rep,name=audiences,proto3" json:"audiences,omitempty"` + Client *ClientInfo `protobuf:"bytes,2,opt,name=client,proto3" json:"client,omitempty"` +} + +func (x *LiveInfo) Reset() { + *x = LiveInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_info_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LiveInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LiveInfo) ProtoMessage() {} + +func (x *LiveInfo) ProtoReflect() protoreflect.Message { + mi := &file_sp_info_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LiveInfo.ProtoReflect.Descriptor instead. +func (*LiveInfo) Descriptor() ([]byte, []int) { + return file_sp_info_proto_rawDescGZIP(), []int{0} +} + +func (x *LiveInfo) GetAudiences() []*Audience { + if x != nil { + return x.Audiences + } + return nil +} + +func (x *LiveInfo) GetClient() *ClientInfo { + if x != nil { + return x.Client + } + return nil +} + +type PipelineInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // What audience(s) this pipeline is attached to (none if empty) + Audiences []*Audience `protobuf:"bytes,1,rep,name=audiences,proto3" json:"audiences,omitempty"` + // Pipeline config + Pipeline *Pipeline `protobuf:"bytes,2,opt,name=pipeline,proto3" json:"pipeline,omitempty"` +} + +func (x *PipelineInfo) Reset() { + *x = PipelineInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_info_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PipelineInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PipelineInfo) ProtoMessage() {} + +func (x *PipelineInfo) ProtoReflect() protoreflect.Message { + mi := &file_sp_info_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PipelineInfo.ProtoReflect.Descriptor instead. +func (*PipelineInfo) Descriptor() ([]byte, []int) { + return file_sp_info_proto_rawDescGZIP(), []int{1} +} + +func (x *PipelineInfo) GetAudiences() []*Audience { + if x != nil { + return x.Audiences + } + return nil +} + +func (x *PipelineInfo) GetPipeline() *Pipeline { + if x != nil { + return x.Pipeline + } + return nil +} + +// Most of this is constructed by client SDKs and provided during Register call +type ClientInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ClientType ClientType `protobuf:"varint,1,opt,name=client_type,json=clientType,proto3,enum=protos.ClientType" json:"client_type,omitempty"` + LibraryName string `protobuf:"bytes,2,opt,name=library_name,json=libraryName,proto3" json:"library_name,omitempty"` + LibraryVersion string `protobuf:"bytes,3,opt,name=library_version,json=libraryVersion,proto3" json:"library_version,omitempty"` + Language string `protobuf:"bytes,4,opt,name=language,proto3" json:"language,omitempty"` + Arch string `protobuf:"bytes,5,opt,name=arch,proto3" json:"arch,omitempty"` + Os string `protobuf:"bytes,6,opt,name=os,proto3" json:"os,omitempty"` + // Filled out by server on GetAll() + XSessionId *string `protobuf:"bytes,7,opt,name=_session_id,json=SessionId,proto3,oneof" json:"_session_id,omitempty"` // protolint:disable:this FIELD_NAMES_LOWER_SNAKE_CASE + XServiceName *string `protobuf:"bytes,8,opt,name=_service_name,json=ServiceName,proto3,oneof" json:"_service_name,omitempty"` // protolint:disable:this FIELD_NAMES_LOWER_SNAKE_CASE + XNodeName *string `protobuf:"bytes,9,opt,name=_node_name,json=NodeName,proto3,oneof" json:"_node_name,omitempty"` // protolint:disable:this FIELD_NAMES_LOWER_SNAKE_CASE +} + +func (x *ClientInfo) Reset() { + *x = ClientInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_info_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClientInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClientInfo) ProtoMessage() {} + +func (x *ClientInfo) ProtoReflect() protoreflect.Message { + mi := &file_sp_info_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClientInfo.ProtoReflect.Descriptor instead. +func (*ClientInfo) Descriptor() ([]byte, []int) { + return file_sp_info_proto_rawDescGZIP(), []int{2} +} + +func (x *ClientInfo) GetClientType() ClientType { + if x != nil { + return x.ClientType + } + return ClientType_CLIENT_TYPE_UNSET +} + +func (x *ClientInfo) GetLibraryName() string { + if x != nil { + return x.LibraryName + } + return "" +} + +func (x *ClientInfo) GetLibraryVersion() string { + if x != nil { + return x.LibraryVersion + } + return "" +} + +func (x *ClientInfo) GetLanguage() string { + if x != nil { + return x.Language + } + return "" +} + +func (x *ClientInfo) GetArch() string { + if x != nil { + return x.Arch + } + return "" +} + +func (x *ClientInfo) GetOs() string { + if x != nil { + return x.Os + } + return "" +} + +func (x *ClientInfo) GetXSessionId() string { + if x != nil && x.XSessionId != nil { + return *x.XSessionId + } + return "" +} + +func (x *ClientInfo) GetXServiceName() string { + if x != nil && x.XServiceName != nil { + return *x.XServiceName + } + return "" +} + +func (x *ClientInfo) GetXNodeName() string { + if x != nil && x.XNodeName != nil { + return *x.XNodeName + } + return "" +} + +var File_sp_info_proto protoreflect.FileDescriptor + +var file_sp_info_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x73, 0x70, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x1a, 0x0f, 0x73, 0x70, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x73, 0x70, 0x5f, 0x70, 0x69, 0x70, + 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x66, 0x0a, 0x08, 0x4c, + 0x69, 0x76, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2e, 0x0a, 0x09, 0x61, 0x75, 0x64, 0x69, 0x65, + 0x6e, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x09, 0x61, 0x75, + 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x06, 0x63, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x63, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x22, 0x6c, 0x0a, 0x0c, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x49, + 0x6e, 0x66, 0x6f, 0x12, 0x2e, 0x0a, 0x09, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x09, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, + 0x63, 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x08, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x50, + 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x08, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, + 0x65, 0x22, 0xef, 0x02, 0x0a, 0x0a, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x33, 0x0a, 0x0b, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6c, 0x69, 0x62, + 0x72, 0x61, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x6c, 0x69, 0x62, 0x72, + 0x61, 0x72, 0x79, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0e, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, + 0x04, 0x61, 0x72, 0x63, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72, 0x63, + 0x68, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x6f, + 0x73, 0x12, 0x23, 0x0a, 0x0b, 0x5f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x09, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x27, 0x0a, 0x0d, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, + 0x0b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x21, 0x0a, 0x0a, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x88, + 0x01, 0x01, 0x42, 0x0e, 0x0a, 0x0c, 0x58, 0x5f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, + 0x69, 0x64, 0x42, 0x10, 0x0a, 0x0e, 0x58, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x0d, 0x0a, 0x0b, 0x58, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x2a, 0x4e, 0x0a, 0x0a, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x15, 0x0a, 0x11, 0x43, 0x4c, 0x49, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x55, 0x4e, 0x53, 0x45, 0x54, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x43, 0x4c, 0x49, 0x45, + 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x44, 0x4b, 0x10, 0x01, 0x12, 0x14, 0x0a, + 0x10, 0x43, 0x4c, 0x49, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x48, 0x49, + 0x4d, 0x10, 0x02, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x73, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x6c, 0x69, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_sp_info_proto_rawDescOnce sync.Once + file_sp_info_proto_rawDescData = file_sp_info_proto_rawDesc +) + +func file_sp_info_proto_rawDescGZIP() []byte { + file_sp_info_proto_rawDescOnce.Do(func() { + file_sp_info_proto_rawDescData = protoimpl.X.CompressGZIP(file_sp_info_proto_rawDescData) + }) + return file_sp_info_proto_rawDescData +} + +var file_sp_info_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_sp_info_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_sp_info_proto_goTypes = []interface{}{ + (ClientType)(0), // 0: protos.ClientType + (*LiveInfo)(nil), // 1: protos.LiveInfo + (*PipelineInfo)(nil), // 2: protos.PipelineInfo + (*ClientInfo)(nil), // 3: protos.ClientInfo + (*Audience)(nil), // 4: protos.Audience + (*Pipeline)(nil), // 5: protos.Pipeline +} +var file_sp_info_proto_depIdxs = []int32{ + 4, // 0: protos.LiveInfo.audiences:type_name -> protos.Audience + 3, // 1: protos.LiveInfo.client:type_name -> protos.ClientInfo + 4, // 2: protos.PipelineInfo.audiences:type_name -> protos.Audience + 5, // 3: protos.PipelineInfo.pipeline:type_name -> protos.Pipeline + 0, // 4: protos.ClientInfo.client_type:type_name -> protos.ClientType + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_sp_info_proto_init() } +func file_sp_info_proto_init() { + if File_sp_info_proto != nil { + return + } + file_sp_common_proto_init() + file_sp_pipeline_proto_init() + if !protoimpl.UnsafeEnabled { + file_sp_info_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LiveInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_info_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PipelineInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_info_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClientInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_sp_info_proto_msgTypes[2].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_sp_info_proto_rawDesc, + NumEnums: 1, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_sp_info_proto_goTypes, + DependencyIndexes: file_sp_info_proto_depIdxs, + EnumInfos: file_sp_info_proto_enumTypes, + MessageInfos: file_sp_info_proto_msgTypes, + }.Build() + File_sp_info_proto = out.File + file_sp_info_proto_rawDesc = nil + file_sp_info_proto_goTypes = nil + file_sp_info_proto_depIdxs = nil +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_internal.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_internal.pb.go new file mode 100644 index 000000000..3aa9043b3 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_internal.pb.go @@ -0,0 +1,1111 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: sp_internal.proto + +package protos + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This will be used to pull the condition type (true, false, error) from the pipeline step, +// so that we can include metadata, abort condition, etc., in the notification +// The condition will contain the notification configuration also. +type NotifyRequest_ConditionType int32 + +const ( + NotifyRequest_CONDITION_TYPE_UNSET NotifyRequest_ConditionType = 0 + NotifyRequest_CONDITION_TYPE_ON_TRUE NotifyRequest_ConditionType = 1 + NotifyRequest_CONDITION_TYPE_ON_FALSE NotifyRequest_ConditionType = 2 + NotifyRequest_CONDITION_TYPE_ON_ERROR NotifyRequest_ConditionType = 3 +) + +// Enum value maps for NotifyRequest_ConditionType. +var ( + NotifyRequest_ConditionType_name = map[int32]string{ + 0: "CONDITION_TYPE_UNSET", + 1: "CONDITION_TYPE_ON_TRUE", + 2: "CONDITION_TYPE_ON_FALSE", + 3: "CONDITION_TYPE_ON_ERROR", + } + NotifyRequest_ConditionType_value = map[string]int32{ + "CONDITION_TYPE_UNSET": 0, + "CONDITION_TYPE_ON_TRUE": 1, + "CONDITION_TYPE_ON_FALSE": 2, + "CONDITION_TYPE_ON_ERROR": 3, + } +) + +func (x NotifyRequest_ConditionType) Enum() *NotifyRequest_ConditionType { + p := new(NotifyRequest_ConditionType) + *p = x + return p +} + +func (x NotifyRequest_ConditionType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (NotifyRequest_ConditionType) Descriptor() protoreflect.EnumDescriptor { + return file_sp_internal_proto_enumTypes[0].Descriptor() +} + +func (NotifyRequest_ConditionType) Type() protoreflect.EnumType { + return &file_sp_internal_proto_enumTypes[0] +} + +func (x NotifyRequest_ConditionType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use NotifyRequest_ConditionType.Descriptor instead. +func (NotifyRequest_ConditionType) EnumDescriptor() ([]byte, []int) { + return file_sp_internal_proto_rawDescGZIP(), []int{2, 0} +} + +type NewAudienceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The session that is performing this call + SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + // Newly created audience. + Audience *Audience `protobuf:"bytes,2,opt,name=audience,proto3" json:"audience,omitempty"` +} + +func (x *NewAudienceRequest) Reset() { + *x = NewAudienceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_internal_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NewAudienceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NewAudienceRequest) ProtoMessage() {} + +func (x *NewAudienceRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_internal_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NewAudienceRequest.ProtoReflect.Descriptor instead. +func (*NewAudienceRequest) Descriptor() ([]byte, []int) { + return file_sp_internal_proto_rawDescGZIP(), []int{0} +} + +func (x *NewAudienceRequest) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +func (x *NewAudienceRequest) GetAudience() *Audience { + if x != nil { + return x.Audience + } + return nil +} + +// Each consumer and producer should send periodic heartbeats to the server +// to let the server know that they are still active. +type HeartbeatRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Session ID for this instance of the SDK. + SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + // Name of the service that is sending the heartbeat. Used for refreshing registration + ServiceName string `protobuf:"bytes,2,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` + // Used for refreshing live audience keys in the event that backing store + // connection is lost and TTLed audience keys are lost + Audiences []*Audience `protobuf:"bytes,3,rep,name=audiences,proto3" json:"audiences,omitempty"` + // Used for refreshing registration + ClientInfo *ClientInfo `protobuf:"bytes,4,opt,name=client_info,json=clientInfo,proto3" json:"client_info,omitempty"` +} + +func (x *HeartbeatRequest) Reset() { + *x = HeartbeatRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_internal_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HeartbeatRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeartbeatRequest) ProtoMessage() {} + +func (x *HeartbeatRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_internal_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HeartbeatRequest.ProtoReflect.Descriptor instead. +func (*HeartbeatRequest) Descriptor() ([]byte, []int) { + return file_sp_internal_proto_rawDescGZIP(), []int{1} +} + +func (x *HeartbeatRequest) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +func (x *HeartbeatRequest) GetServiceName() string { + if x != nil { + return x.ServiceName + } + return "" +} + +func (x *HeartbeatRequest) GetAudiences() []*Audience { + if x != nil { + return x.Audiences + } + return nil +} + +func (x *HeartbeatRequest) GetClientInfo() *ClientInfo { + if x != nil { + return x.ClientInfo + } + return nil +} + +type NotifyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ConditionType NotifyRequest_ConditionType `protobuf:"varint,1,opt,name=condition_type,json=conditionType,proto3,enum=protos.NotifyRequest_ConditionType" json:"condition_type,omitempty"` + // Used for pulling step name and any other info needed in the future + Step *PipelineStep `protobuf:"bytes,2,opt,name=step,proto3" json:"step,omitempty"` + // Included in notification + Audience *Audience `protobuf:"bytes,3,opt,name=audience,proto3" json:"audience,omitempty"` + // Included in notification + OccurredAtUnixTsUtc int64 `protobuf:"varint,4,opt,name=occurred_at_unix_ts_utc,json=occurredAtUnixTsUtc,proto3" json:"occurred_at_unix_ts_utc,omitempty"` + // Included in notification + PipelineId string `protobuf:"bytes,5,opt,name=pipeline_id,json=pipelineId,proto3" json:"pipeline_id,omitempty"` + // Included in notification + Payload []byte `protobuf:"bytes,6,opt,name=payload,proto3" json:"payload,omitempty"` +} + +func (x *NotifyRequest) Reset() { + *x = NotifyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_internal_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NotifyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NotifyRequest) ProtoMessage() {} + +func (x *NotifyRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_internal_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NotifyRequest.ProtoReflect.Descriptor instead. +func (*NotifyRequest) Descriptor() ([]byte, []int) { + return file_sp_internal_proto_rawDescGZIP(), []int{2} +} + +func (x *NotifyRequest) GetConditionType() NotifyRequest_ConditionType { + if x != nil { + return x.ConditionType + } + return NotifyRequest_CONDITION_TYPE_UNSET +} + +func (x *NotifyRequest) GetStep() *PipelineStep { + if x != nil { + return x.Step + } + return nil +} + +func (x *NotifyRequest) GetAudience() *Audience { + if x != nil { + return x.Audience + } + return nil +} + +func (x *NotifyRequest) GetOccurredAtUnixTsUtc() int64 { + if x != nil { + return x.OccurredAtUnixTsUtc + } + return 0 +} + +func (x *NotifyRequest) GetPipelineId() string { + if x != nil { + return x.PipelineId + } + return "" +} + +func (x *NotifyRequest) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +type MetricsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Metrics []*Metric `protobuf:"bytes,1,rep,name=metrics,proto3" json:"metrics,omitempty"` +} + +func (x *MetricsRequest) Reset() { + *x = MetricsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_internal_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MetricsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MetricsRequest) ProtoMessage() {} + +func (x *MetricsRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_internal_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MetricsRequest.ProtoReflect.Descriptor instead. +func (*MetricsRequest) Descriptor() ([]byte, []int) { + return file_sp_internal_proto_rawDescGZIP(), []int{3} +} + +func (x *MetricsRequest) GetMetrics() []*Metric { + if x != nil { + return x.Metrics + } + return nil +} + +type RegisterRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // REQUIRED -- Name of the service that is registering. + ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` + // REQUIRED -- Unique ID for this SDK instance. + // + // This should be generated every time the SDK is instantiated (oe. every + // time a NEW registration is performed). + SessionId string `protobuf:"bytes,2,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + // REQUIRED -- Info about the client (lib name, lang, os, arch, etc.) + ClientInfo *ClientInfo `protobuf:"bytes,3,opt,name=client_info,json=clientInfo,proto3" json:"client_info,omitempty"` + // OPTIONAL -- if these are defined, these will show up in the UI even if + // there is no active .Process() call from the SDK. + Audiences []*Audience `protobuf:"bytes,4,rep,name=audiences,proto3" json:"audiences,omitempty"` + // OPTIONAL -- If set, we know that any pipelines or steps executed in this + // SDK will NOT modify the input/output data. As in, the SDK will log what it + // _would_ do and always return the original data set. + DryRun bool `protobuf:"varint,5,opt,name=dry_run,json=dryRun,proto3" json:"dry_run,omitempty"` +} + +func (x *RegisterRequest) Reset() { + *x = RegisterRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_internal_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegisterRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegisterRequest) ProtoMessage() {} + +func (x *RegisterRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_internal_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RegisterRequest.ProtoReflect.Descriptor instead. +func (*RegisterRequest) Descriptor() ([]byte, []int) { + return file_sp_internal_proto_rawDescGZIP(), []int{4} +} + +func (x *RegisterRequest) GetServiceName() string { + if x != nil { + return x.ServiceName + } + return "" +} + +func (x *RegisterRequest) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +func (x *RegisterRequest) GetClientInfo() *ClientInfo { + if x != nil { + return x.ClientInfo + } + return nil +} + +func (x *RegisterRequest) GetAudiences() []*Audience { + if x != nil { + return x.Audiences + } + return nil +} + +func (x *RegisterRequest) GetDryRun() bool { + if x != nil { + return x.DryRun + } + return false +} + +// Same as RegisterRequest - used for broadcasting a deregistration event +type DeregisterRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` + SessionId string `protobuf:"bytes,2,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` +} + +func (x *DeregisterRequest) Reset() { + *x = DeregisterRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_internal_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeregisterRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeregisterRequest) ProtoMessage() {} + +func (x *DeregisterRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_internal_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeregisterRequest.ProtoReflect.Descriptor instead. +func (*DeregisterRequest) Descriptor() ([]byte, []int) { + return file_sp_internal_proto_rawDescGZIP(), []int{5} +} + +func (x *DeregisterRequest) GetServiceName() string { + if x != nil { + return x.ServiceName + } + return "" +} + +func (x *DeregisterRequest) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +// Method used by SDKs to fetch all SetPipelinesCommands for a given service name. +// The SDK may not know of all audiences yet so this method returns ALL +// SetPipelinesCommands that use the same same service name. SDKs should store +// the commands (or pipelines) in memory tied to an audience, so that if/when a +// .Process() call occurs with an audience - the SDK will already have the +// pipeline config in memory. +type GetSetPipelinesCommandsByServiceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` +} + +func (x *GetSetPipelinesCommandsByServiceRequest) Reset() { + *x = GetSetPipelinesCommandsByServiceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_internal_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSetPipelinesCommandsByServiceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSetPipelinesCommandsByServiceRequest) ProtoMessage() {} + +func (x *GetSetPipelinesCommandsByServiceRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_internal_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSetPipelinesCommandsByServiceRequest.ProtoReflect.Descriptor instead. +func (*GetSetPipelinesCommandsByServiceRequest) Descriptor() ([]byte, []int) { + return file_sp_internal_proto_rawDescGZIP(), []int{6} +} + +func (x *GetSetPipelinesCommandsByServiceRequest) GetServiceName() string { + if x != nil { + return x.ServiceName + } + return "" +} + +type GetSetPipelinesCommandsByServiceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // SetPipelinesCommands for all active pipelines + SetPipelineCommands []*Command `protobuf:"bytes,1,rep,name=set_pipeline_commands,json=setPipelineCommands,proto3" json:"set_pipeline_commands,omitempty"` + // ID = wasm ID + WasmModules map[string]*WasmModule `protobuf:"bytes,3,rep,name=wasm_modules,json=wasmModules,proto3" json:"wasm_modules,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *GetSetPipelinesCommandsByServiceResponse) Reset() { + *x = GetSetPipelinesCommandsByServiceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_internal_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSetPipelinesCommandsByServiceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSetPipelinesCommandsByServiceResponse) ProtoMessage() {} + +func (x *GetSetPipelinesCommandsByServiceResponse) ProtoReflect() protoreflect.Message { + mi := &file_sp_internal_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSetPipelinesCommandsByServiceResponse.ProtoReflect.Descriptor instead. +func (*GetSetPipelinesCommandsByServiceResponse) Descriptor() ([]byte, []int) { + return file_sp_internal_proto_rawDescGZIP(), []int{7} +} + +func (x *GetSetPipelinesCommandsByServiceResponse) GetSetPipelineCommands() []*Command { + if x != nil { + return x.SetPipelineCommands + } + return nil +} + +func (x *GetSetPipelinesCommandsByServiceResponse) GetWasmModules() map[string]*WasmModule { + if x != nil { + return x.WasmModules + } + return nil +} + +// WasmModule is used to ensure we only send the wasm module once per request +// instead of duplicated in every pipeline where it is used. This prevents +// over-sized payloads on SDK startup +type WasmModule struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // ID is a uuid(sha256(_wasm_bytes)) that is set by streamdal server + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // WASM module bytes (set by server) + Bytes []byte `protobuf:"bytes,2,opt,name=bytes,proto3" json:"bytes,omitempty"` + // WASM function name to execute (set by server) + Function string `protobuf:"bytes,3,opt,name=function,proto3" json:"function,omitempty"` +} + +func (x *WasmModule) Reset() { + *x = WasmModule{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_internal_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WasmModule) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WasmModule) ProtoMessage() {} + +func (x *WasmModule) ProtoReflect() protoreflect.Message { + mi := &file_sp_internal_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WasmModule.ProtoReflect.Descriptor instead. +func (*WasmModule) Descriptor() ([]byte, []int) { + return file_sp_internal_proto_rawDescGZIP(), []int{8} +} + +func (x *WasmModule) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *WasmModule) GetBytes() []byte { + if x != nil { + return x.Bytes + } + return nil +} + +func (x *WasmModule) GetFunction() string { + if x != nil { + return x.Function + } + return "" +} + +type SendSchemaRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Audience *Audience `protobuf:"bytes,1,opt,name=audience,proto3" json:"audience,omitempty"` + Schema *Schema `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` +} + +func (x *SendSchemaRequest) Reset() { + *x = SendSchemaRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_internal_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendSchemaRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendSchemaRequest) ProtoMessage() {} + +func (x *SendSchemaRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_internal_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendSchemaRequest.ProtoReflect.Descriptor instead. +func (*SendSchemaRequest) Descriptor() ([]byte, []int) { + return file_sp_internal_proto_rawDescGZIP(), []int{9} +} + +func (x *SendSchemaRequest) GetAudience() *Audience { + if x != nil { + return x.Audience + } + return nil +} + +func (x *SendSchemaRequest) GetSchema() *Schema { + if x != nil { + return x.Schema + } + return nil +} + +var File_sp_internal_proto protoreflect.FileDescriptor + +var file_sp_internal_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x73, 0x70, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x1a, 0x10, 0x73, 0x70, 0x5f, + 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x73, + 0x70, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0d, + 0x73, 0x70, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x73, + 0x70, 0x5f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x61, 0x0a, 0x12, 0x4e, 0x65, 0x77, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x08, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x08, 0x61, 0x75, 0x64, 0x69, 0x65, + 0x6e, 0x63, 0x65, 0x22, 0xb9, 0x01, 0x0a, 0x10, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2e, 0x0a, 0x09, 0x61, 0x75, + 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, + 0x09, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x33, 0x0a, 0x0b, 0x63, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x22, + 0xa5, 0x03, 0x0a, 0x0d, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x4a, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x2e, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0d, + 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x28, 0x0a, + 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x65, + 0x70, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x12, 0x2c, 0x0a, 0x08, 0x61, 0x75, 0x64, 0x69, 0x65, + 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x08, 0x61, 0x75, 0x64, + 0x69, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x34, 0x0a, 0x17, 0x6f, 0x63, 0x63, 0x75, 0x72, 0x72, 0x65, + 0x64, 0x5f, 0x61, 0x74, 0x5f, 0x75, 0x6e, 0x69, 0x78, 0x5f, 0x74, 0x73, 0x5f, 0x75, 0x74, 0x63, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x13, 0x6f, 0x63, 0x63, 0x75, 0x72, 0x72, 0x65, 0x64, + 0x41, 0x74, 0x55, 0x6e, 0x69, 0x78, 0x54, 0x73, 0x55, 0x74, 0x63, 0x12, 0x1f, 0x0a, 0x0b, 0x70, + 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, + 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, + 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x7f, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x14, 0x43, 0x4f, 0x4e, 0x44, 0x49, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x45, 0x54, 0x10, + 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x4f, 0x4e, 0x5f, 0x54, 0x52, 0x55, 0x45, 0x10, 0x01, 0x12, 0x1b, 0x0a, + 0x17, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x4c, 0x53, 0x45, 0x10, 0x02, 0x12, 0x1b, 0x0a, 0x17, 0x43, 0x4f, + 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4f, 0x4e, 0x5f, + 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x22, 0x3a, 0x0a, 0x0e, 0x4d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x07, 0x6d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x73, 0x22, 0xd1, 0x01, 0x0a, 0x0f, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x33, 0x0a, 0x0b, 0x63, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2e, + 0x0a, 0x09, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x65, + 0x6e, 0x63, 0x65, 0x52, 0x09, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x17, + 0x0a, 0x07, 0x64, 0x72, 0x79, 0x5f, 0x72, 0x75, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x06, 0x64, 0x72, 0x79, 0x52, 0x75, 0x6e, 0x22, 0x55, 0x0a, 0x11, 0x44, 0x65, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x4c, + 0x0a, 0x27, 0x47, 0x65, 0x74, 0x53, 0x65, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, + 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x42, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xa9, 0x02, 0x0a, + 0x28, 0x47, 0x65, 0x74, 0x53, 0x65, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, + 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x42, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x15, 0x73, 0x65, 0x74, + 0x5f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, + 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x13, 0x73, 0x65, 0x74, 0x50, 0x69, + 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x12, 0x64, + 0x0a, 0x0c, 0x77, 0x61, 0x73, 0x6d, 0x5f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, + 0x74, 0x53, 0x65, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x43, 0x6f, 0x6d, + 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x42, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x57, 0x61, 0x73, 0x6d, 0x4d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x77, 0x61, 0x73, 0x6d, 0x4d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x73, 0x1a, 0x52, 0x0a, 0x10, 0x57, 0x61, 0x73, 0x6d, 0x4d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x57, 0x61, 0x73, 0x6d, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x4e, 0x0a, 0x0a, 0x57, 0x61, 0x73, 0x6d, + 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, + 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x69, 0x0a, 0x11, 0x53, 0x65, 0x6e, 0x64, + 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, + 0x08, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, + 0x65, 0x52, 0x08, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x26, 0x0a, 0x06, 0x73, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x06, 0x73, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x32, 0xc9, 0x04, 0x0a, 0x08, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, + 0x12, 0x36, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x17, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, + 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x30, 0x01, 0x12, 0x43, 0x0a, 0x0b, 0x4e, 0x65, 0x77, 0x41, + 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x4e, 0x65, 0x77, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, + 0x6e, 0x64, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, + 0x09, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, + 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, + 0x0a, 0x06, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x12, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, + 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x07, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x73, 0x12, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x85, 0x01, 0x0a, 0x20, 0x47, 0x65, 0x74, 0x53, 0x65, + 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, + 0x64, 0x73, 0x42, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2f, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x74, 0x50, 0x69, 0x70, 0x65, 0x6c, + 0x69, 0x6e, 0x65, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x42, 0x79, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x74, 0x50, 0x69, 0x70, 0x65, + 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x42, 0x79, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, + 0x0a, 0x08, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x54, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, + 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x41, 0x0a, 0x0a, + 0x53, 0x65, 0x6e, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, + 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, + 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, + 0x6c, 0x2f, 0x6c, 0x69, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x62, 0x75, + 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_sp_internal_proto_rawDescOnce sync.Once + file_sp_internal_proto_rawDescData = file_sp_internal_proto_rawDesc +) + +func file_sp_internal_proto_rawDescGZIP() []byte { + file_sp_internal_proto_rawDescOnce.Do(func() { + file_sp_internal_proto_rawDescData = protoimpl.X.CompressGZIP(file_sp_internal_proto_rawDescData) + }) + return file_sp_internal_proto_rawDescData +} + +var file_sp_internal_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_sp_internal_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_sp_internal_proto_goTypes = []interface{}{ + (NotifyRequest_ConditionType)(0), // 0: protos.NotifyRequest.ConditionType + (*NewAudienceRequest)(nil), // 1: protos.NewAudienceRequest + (*HeartbeatRequest)(nil), // 2: protos.HeartbeatRequest + (*NotifyRequest)(nil), // 3: protos.NotifyRequest + (*MetricsRequest)(nil), // 4: protos.MetricsRequest + (*RegisterRequest)(nil), // 5: protos.RegisterRequest + (*DeregisterRequest)(nil), // 6: protos.DeregisterRequest + (*GetSetPipelinesCommandsByServiceRequest)(nil), // 7: protos.GetSetPipelinesCommandsByServiceRequest + (*GetSetPipelinesCommandsByServiceResponse)(nil), // 8: protos.GetSetPipelinesCommandsByServiceResponse + (*WasmModule)(nil), // 9: protos.WasmModule + (*SendSchemaRequest)(nil), // 10: protos.SendSchemaRequest + nil, // 11: protos.GetSetPipelinesCommandsByServiceResponse.WasmModulesEntry + (*Audience)(nil), // 12: protos.Audience + (*ClientInfo)(nil), // 13: protos.ClientInfo + (*PipelineStep)(nil), // 14: protos.PipelineStep + (*Metric)(nil), // 15: protos.Metric + (*Command)(nil), // 16: protos.Command + (*Schema)(nil), // 17: protos.Schema + (*TailResponse)(nil), // 18: protos.TailResponse + (*StandardResponse)(nil), // 19: protos.StandardResponse +} +var file_sp_internal_proto_depIdxs = []int32{ + 12, // 0: protos.NewAudienceRequest.audience:type_name -> protos.Audience + 12, // 1: protos.HeartbeatRequest.audiences:type_name -> protos.Audience + 13, // 2: protos.HeartbeatRequest.client_info:type_name -> protos.ClientInfo + 0, // 3: protos.NotifyRequest.condition_type:type_name -> protos.NotifyRequest.ConditionType + 14, // 4: protos.NotifyRequest.step:type_name -> protos.PipelineStep + 12, // 5: protos.NotifyRequest.audience:type_name -> protos.Audience + 15, // 6: protos.MetricsRequest.metrics:type_name -> protos.Metric + 13, // 7: protos.RegisterRequest.client_info:type_name -> protos.ClientInfo + 12, // 8: protos.RegisterRequest.audiences:type_name -> protos.Audience + 16, // 9: protos.GetSetPipelinesCommandsByServiceResponse.set_pipeline_commands:type_name -> protos.Command + 11, // 10: protos.GetSetPipelinesCommandsByServiceResponse.wasm_modules:type_name -> protos.GetSetPipelinesCommandsByServiceResponse.WasmModulesEntry + 12, // 11: protos.SendSchemaRequest.audience:type_name -> protos.Audience + 17, // 12: protos.SendSchemaRequest.schema:type_name -> protos.Schema + 9, // 13: protos.GetSetPipelinesCommandsByServiceResponse.WasmModulesEntry.value:type_name -> protos.WasmModule + 5, // 14: protos.Internal.Register:input_type -> protos.RegisterRequest + 1, // 15: protos.Internal.NewAudience:input_type -> protos.NewAudienceRequest + 2, // 16: protos.Internal.Heartbeat:input_type -> protos.HeartbeatRequest + 3, // 17: protos.Internal.Notify:input_type -> protos.NotifyRequest + 4, // 18: protos.Internal.Metrics:input_type -> protos.MetricsRequest + 7, // 19: protos.Internal.GetSetPipelinesCommandsByService:input_type -> protos.GetSetPipelinesCommandsByServiceRequest + 18, // 20: protos.Internal.SendTail:input_type -> protos.TailResponse + 10, // 21: protos.Internal.SendSchema:input_type -> protos.SendSchemaRequest + 16, // 22: protos.Internal.Register:output_type -> protos.Command + 19, // 23: protos.Internal.NewAudience:output_type -> protos.StandardResponse + 19, // 24: protos.Internal.Heartbeat:output_type -> protos.StandardResponse + 19, // 25: protos.Internal.Notify:output_type -> protos.StandardResponse + 19, // 26: protos.Internal.Metrics:output_type -> protos.StandardResponse + 8, // 27: protos.Internal.GetSetPipelinesCommandsByService:output_type -> protos.GetSetPipelinesCommandsByServiceResponse + 19, // 28: protos.Internal.SendTail:output_type -> protos.StandardResponse + 19, // 29: protos.Internal.SendSchema:output_type -> protos.StandardResponse + 22, // [22:30] is the sub-list for method output_type + 14, // [14:22] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name +} + +func init() { file_sp_internal_proto_init() } +func file_sp_internal_proto_init() { + if File_sp_internal_proto != nil { + return + } + file_sp_command_proto_init() + file_sp_common_proto_init() + file_sp_info_proto_init() + file_sp_pipeline_proto_init() + if !protoimpl.UnsafeEnabled { + file_sp_internal_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NewAudienceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_internal_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HeartbeatRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_internal_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NotifyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_internal_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MetricsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_internal_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegisterRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_internal_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeregisterRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_internal_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSetPipelinesCommandsByServiceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_internal_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSetPipelinesCommandsByServiceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_internal_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WasmModule); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_internal_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendSchemaRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_sp_internal_proto_rawDesc, + NumEnums: 1, + NumMessages: 11, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_sp_internal_proto_goTypes, + DependencyIndexes: file_sp_internal_proto_depIdxs, + EnumInfos: file_sp_internal_proto_enumTypes, + MessageInfos: file_sp_internal_proto_msgTypes, + }.Build() + File_sp_internal_proto = out.File + file_sp_internal_proto_rawDesc = nil + file_sp_internal_proto_goTypes = nil + file_sp_internal_proto_depIdxs = nil +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_internal_grpc.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_internal_grpc.pb.go new file mode 100644 index 000000000..91e8fffc5 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_internal_grpc.pb.go @@ -0,0 +1,462 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v3.21.12 +// source: sp_internal.proto + +package protos + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Internal_Register_FullMethodName = "/protos.Internal/Register" + Internal_NewAudience_FullMethodName = "/protos.Internal/NewAudience" + Internal_Heartbeat_FullMethodName = "/protos.Internal/Heartbeat" + Internal_Notify_FullMethodName = "/protos.Internal/Notify" + Internal_Metrics_FullMethodName = "/protos.Internal/Metrics" + Internal_GetSetPipelinesCommandsByService_FullMethodName = "/protos.Internal/GetSetPipelinesCommandsByService" + Internal_SendTail_FullMethodName = "/protos.Internal/SendTail" + Internal_SendSchema_FullMethodName = "/protos.Internal/SendSchema" +) + +// InternalClient is the client API for Internal service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type InternalClient interface { + // Initial method that an SDK should call to register itself with the server. + // The server will use this stream to send commands to the SDK via the + // `CommandResponse` message. Clients should continuously listen for + // CommandResponse messages and re-establish registration if the stream gets + // disconnected. + Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (Internal_RegisterClient, error) + // Declare a new audience that the SDK is able to accept commands for. + // An SDK would use this method when a new audience is declared by the user + // via `.Process()`. + NewAudience(ctx context.Context, in *NewAudienceRequest, opts ...grpc.CallOption) (*StandardResponse, error) + // SDK is responsible for sending heartbeats to the server to let the server + // know about active consumers and producers. + Heartbeat(ctx context.Context, in *HeartbeatRequest, opts ...grpc.CallOption) (*StandardResponse, error) + // Use this method when Notify condition has been triggered; the server will + // decide on what to do about the notification. + Notify(ctx context.Context, in *NotifyRequest, opts ...grpc.CallOption) (*StandardResponse, error) + // Send periodic metrics to the server + Metrics(ctx context.Context, in *MetricsRequest, opts ...grpc.CallOption) (*StandardResponse, error) + // Used to pull all pipeline configs for the service name in the SDK's constructor + // This is needed because Register() is async + GetSetPipelinesCommandsByService(ctx context.Context, in *GetSetPipelinesCommandsByServiceRequest, opts ...grpc.CallOption) (*GetSetPipelinesCommandsByServiceResponse, error) + SendTail(ctx context.Context, opts ...grpc.CallOption) (Internal_SendTailClient, error) + // Used by SDK to send a new schema to the server + SendSchema(ctx context.Context, in *SendSchemaRequest, opts ...grpc.CallOption) (*StandardResponse, error) +} + +type internalClient struct { + cc grpc.ClientConnInterface +} + +func NewInternalClient(cc grpc.ClientConnInterface) InternalClient { + return &internalClient{cc} +} + +func (c *internalClient) Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (Internal_RegisterClient, error) { + stream, err := c.cc.NewStream(ctx, &Internal_ServiceDesc.Streams[0], Internal_Register_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &internalRegisterClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Internal_RegisterClient interface { + Recv() (*Command, error) + grpc.ClientStream +} + +type internalRegisterClient struct { + grpc.ClientStream +} + +func (x *internalRegisterClient) Recv() (*Command, error) { + m := new(Command) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *internalClient) NewAudience(ctx context.Context, in *NewAudienceRequest, opts ...grpc.CallOption) (*StandardResponse, error) { + out := new(StandardResponse) + err := c.cc.Invoke(ctx, Internal_NewAudience_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *internalClient) Heartbeat(ctx context.Context, in *HeartbeatRequest, opts ...grpc.CallOption) (*StandardResponse, error) { + out := new(StandardResponse) + err := c.cc.Invoke(ctx, Internal_Heartbeat_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *internalClient) Notify(ctx context.Context, in *NotifyRequest, opts ...grpc.CallOption) (*StandardResponse, error) { + out := new(StandardResponse) + err := c.cc.Invoke(ctx, Internal_Notify_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *internalClient) Metrics(ctx context.Context, in *MetricsRequest, opts ...grpc.CallOption) (*StandardResponse, error) { + out := new(StandardResponse) + err := c.cc.Invoke(ctx, Internal_Metrics_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *internalClient) GetSetPipelinesCommandsByService(ctx context.Context, in *GetSetPipelinesCommandsByServiceRequest, opts ...grpc.CallOption) (*GetSetPipelinesCommandsByServiceResponse, error) { + out := new(GetSetPipelinesCommandsByServiceResponse) + err := c.cc.Invoke(ctx, Internal_GetSetPipelinesCommandsByService_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *internalClient) SendTail(ctx context.Context, opts ...grpc.CallOption) (Internal_SendTailClient, error) { + stream, err := c.cc.NewStream(ctx, &Internal_ServiceDesc.Streams[1], Internal_SendTail_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &internalSendTailClient{stream} + return x, nil +} + +type Internal_SendTailClient interface { + Send(*TailResponse) error + CloseAndRecv() (*StandardResponse, error) + grpc.ClientStream +} + +type internalSendTailClient struct { + grpc.ClientStream +} + +func (x *internalSendTailClient) Send(m *TailResponse) error { + return x.ClientStream.SendMsg(m) +} + +func (x *internalSendTailClient) CloseAndRecv() (*StandardResponse, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(StandardResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *internalClient) SendSchema(ctx context.Context, in *SendSchemaRequest, opts ...grpc.CallOption) (*StandardResponse, error) { + out := new(StandardResponse) + err := c.cc.Invoke(ctx, Internal_SendSchema_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// InternalServer is the server API for Internal service. +// All implementations must embed UnimplementedInternalServer +// for forward compatibility +type InternalServer interface { + // Initial method that an SDK should call to register itself with the server. + // The server will use this stream to send commands to the SDK via the + // `CommandResponse` message. Clients should continuously listen for + // CommandResponse messages and re-establish registration if the stream gets + // disconnected. + Register(*RegisterRequest, Internal_RegisterServer) error + // Declare a new audience that the SDK is able to accept commands for. + // An SDK would use this method when a new audience is declared by the user + // via `.Process()`. + NewAudience(context.Context, *NewAudienceRequest) (*StandardResponse, error) + // SDK is responsible for sending heartbeats to the server to let the server + // know about active consumers and producers. + Heartbeat(context.Context, *HeartbeatRequest) (*StandardResponse, error) + // Use this method when Notify condition has been triggered; the server will + // decide on what to do about the notification. + Notify(context.Context, *NotifyRequest) (*StandardResponse, error) + // Send periodic metrics to the server + Metrics(context.Context, *MetricsRequest) (*StandardResponse, error) + // Used to pull all pipeline configs for the service name in the SDK's constructor + // This is needed because Register() is async + GetSetPipelinesCommandsByService(context.Context, *GetSetPipelinesCommandsByServiceRequest) (*GetSetPipelinesCommandsByServiceResponse, error) + SendTail(Internal_SendTailServer) error + // Used by SDK to send a new schema to the server + SendSchema(context.Context, *SendSchemaRequest) (*StandardResponse, error) + mustEmbedUnimplementedInternalServer() +} + +// UnimplementedInternalServer must be embedded to have forward compatible implementations. +type UnimplementedInternalServer struct { +} + +func (UnimplementedInternalServer) Register(*RegisterRequest, Internal_RegisterServer) error { + return status.Errorf(codes.Unimplemented, "method Register not implemented") +} +func (UnimplementedInternalServer) NewAudience(context.Context, *NewAudienceRequest) (*StandardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NewAudience not implemented") +} +func (UnimplementedInternalServer) Heartbeat(context.Context, *HeartbeatRequest) (*StandardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Heartbeat not implemented") +} +func (UnimplementedInternalServer) Notify(context.Context, *NotifyRequest) (*StandardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Notify not implemented") +} +func (UnimplementedInternalServer) Metrics(context.Context, *MetricsRequest) (*StandardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Metrics not implemented") +} +func (UnimplementedInternalServer) GetSetPipelinesCommandsByService(context.Context, *GetSetPipelinesCommandsByServiceRequest) (*GetSetPipelinesCommandsByServiceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSetPipelinesCommandsByService not implemented") +} +func (UnimplementedInternalServer) SendTail(Internal_SendTailServer) error { + return status.Errorf(codes.Unimplemented, "method SendTail not implemented") +} +func (UnimplementedInternalServer) SendSchema(context.Context, *SendSchemaRequest) (*StandardResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SendSchema not implemented") +} +func (UnimplementedInternalServer) mustEmbedUnimplementedInternalServer() {} + +// UnsafeInternalServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to InternalServer will +// result in compilation errors. +type UnsafeInternalServer interface { + mustEmbedUnimplementedInternalServer() +} + +func RegisterInternalServer(s grpc.ServiceRegistrar, srv InternalServer) { + s.RegisterService(&Internal_ServiceDesc, srv) +} + +func _Internal_Register_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(RegisterRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(InternalServer).Register(m, &internalRegisterServer{stream}) +} + +type Internal_RegisterServer interface { + Send(*Command) error + grpc.ServerStream +} + +type internalRegisterServer struct { + grpc.ServerStream +} + +func (x *internalRegisterServer) Send(m *Command) error { + return x.ServerStream.SendMsg(m) +} + +func _Internal_NewAudience_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NewAudienceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InternalServer).NewAudience(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Internal_NewAudience_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InternalServer).NewAudience(ctx, req.(*NewAudienceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Internal_Heartbeat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HeartbeatRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InternalServer).Heartbeat(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Internal_Heartbeat_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InternalServer).Heartbeat(ctx, req.(*HeartbeatRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Internal_Notify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NotifyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InternalServer).Notify(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Internal_Notify_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InternalServer).Notify(ctx, req.(*NotifyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Internal_Metrics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MetricsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InternalServer).Metrics(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Internal_Metrics_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InternalServer).Metrics(ctx, req.(*MetricsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Internal_GetSetPipelinesCommandsByService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSetPipelinesCommandsByServiceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InternalServer).GetSetPipelinesCommandsByService(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Internal_GetSetPipelinesCommandsByService_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InternalServer).GetSetPipelinesCommandsByService(ctx, req.(*GetSetPipelinesCommandsByServiceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Internal_SendTail_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(InternalServer).SendTail(&internalSendTailServer{stream}) +} + +type Internal_SendTailServer interface { + SendAndClose(*StandardResponse) error + Recv() (*TailResponse, error) + grpc.ServerStream +} + +type internalSendTailServer struct { + grpc.ServerStream +} + +func (x *internalSendTailServer) SendAndClose(m *StandardResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *internalSendTailServer) Recv() (*TailResponse, error) { + m := new(TailResponse) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _Internal_SendSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SendSchemaRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InternalServer).SendSchema(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Internal_SendSchema_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InternalServer).SendSchema(ctx, req.(*SendSchemaRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Internal_ServiceDesc is the grpc.ServiceDesc for Internal service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Internal_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "protos.Internal", + HandlerType: (*InternalServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "NewAudience", + Handler: _Internal_NewAudience_Handler, + }, + { + MethodName: "Heartbeat", + Handler: _Internal_Heartbeat_Handler, + }, + { + MethodName: "Notify", + Handler: _Internal_Notify_Handler, + }, + { + MethodName: "Metrics", + Handler: _Internal_Metrics_Handler, + }, + { + MethodName: "GetSetPipelinesCommandsByService", + Handler: _Internal_GetSetPipelinesCommandsByService_Handler, + }, + { + MethodName: "SendSchema", + Handler: _Internal_SendSchema_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Register", + Handler: _Internal_Register_Handler, + ServerStreams: true, + }, + { + StreamName: "SendTail", + Handler: _Internal_SendTail_Handler, + ClientStreams: true, + }, + }, + Metadata: "sp_internal.proto", +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_kv.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_kv.pb.go new file mode 100644 index 000000000..1d55e024d --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_kv.pb.go @@ -0,0 +1,515 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: sp_kv.proto + +package protos + +import ( + shared "github.com/streamdal/streamdal/libs/protos/build/go/protos/shared" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// KVObject represents a single KV object used in protos.KVInstruction; this is +// constructed by server and broadcast out to other server nodes. +type KVObject struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Valid key regex: /^[a-zA-Z0-9_-:]+$/) + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // KV value + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + // When was this object created + CreatedAtUnixTsNanoUtc int64 `protobuf:"varint,3,opt,name=created_at_unix_ts_nano_utc,json=createdAtUnixTsNanoUtc,proto3" json:"created_at_unix_ts_nano_utc,omitempty"` + // Last time the object was updated + UpdatedAtUnixTsNanoUtc int64 `protobuf:"varint,4,opt,name=updated_at_unix_ts_nano_utc,json=updatedAtUnixTsNanoUtc,proto3" json:"updated_at_unix_ts_nano_utc,omitempty"` +} + +func (x *KVObject) Reset() { + *x = KVObject{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_kv_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KVObject) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KVObject) ProtoMessage() {} + +func (x *KVObject) ProtoReflect() protoreflect.Message { + mi := &file_sp_kv_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KVObject.ProtoReflect.Descriptor instead. +func (*KVObject) Descriptor() ([]byte, []int) { + return file_sp_kv_proto_rawDescGZIP(), []int{0} +} + +func (x *KVObject) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *KVObject) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *KVObject) GetCreatedAtUnixTsNanoUtc() int64 { + if x != nil { + return x.CreatedAtUnixTsNanoUtc + } + return 0 +} + +func (x *KVObject) GetUpdatedAtUnixTsNanoUtc() int64 { + if x != nil { + return x.UpdatedAtUnixTsNanoUtc + } + return 0 +} + +// Container for one or more KVObject's; server broadcasts KVCommand that +// contains one or more of these instructions when a "POST /api/v1/kv" request +// is made. +type KVInstruction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Unique ID for this instruction + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // What kind of an action is this? + Action shared.KVAction `protobuf:"varint,2,opt,name=action,proto3,enum=protos.shared.KVAction" json:"action,omitempty"` + // KV object + Object *KVObject `protobuf:"bytes,3,opt,name=object,proto3" json:"object,omitempty"` + // When this instruction was requested (usually will be the HTTP API request time) + RequestedAtUnixTsNanoUtc int64 `protobuf:"varint,4,opt,name=requested_at_unix_ts_nano_utc,json=requestedAtUnixTsNanoUtc,proto3" json:"requested_at_unix_ts_nano_utc,omitempty"` +} + +func (x *KVInstruction) Reset() { + *x = KVInstruction{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_kv_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KVInstruction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KVInstruction) ProtoMessage() {} + +func (x *KVInstruction) ProtoReflect() protoreflect.Message { + mi := &file_sp_kv_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KVInstruction.ProtoReflect.Descriptor instead. +func (*KVInstruction) Descriptor() ([]byte, []int) { + return file_sp_kv_proto_rawDescGZIP(), []int{1} +} + +func (x *KVInstruction) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *KVInstruction) GetAction() shared.KVAction { + if x != nil { + return x.Action + } + return shared.KVAction(0) +} + +func (x *KVInstruction) GetObject() *KVObject { + if x != nil { + return x.Object + } + return nil +} + +func (x *KVInstruction) GetRequestedAtUnixTsNanoUtc() int64 { + if x != nil { + return x.RequestedAtUnixTsNanoUtc + } + return 0 +} + +// Used for broadcasting KV instructions to other server nodes. +// NOTE: While this data structure is similar to KVCommand it makes sense to +// keep them separate. It would cause more confusion if we tried to re-use +// KVCommand for the purpose of broadcasting AND for sending SDK commands. ~DS +// +// This request structure is used for including all updates - create/update/delete. +type KVRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Instructions []*KVInstruction `protobuf:"bytes,1,rep,name=instructions,proto3" json:"instructions,omitempty"` + Overwrite bool `protobuf:"varint,2,opt,name=overwrite,proto3" json:"overwrite,omitempty"` +} + +func (x *KVRequest) Reset() { + *x = KVRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_kv_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KVRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KVRequest) ProtoMessage() {} + +func (x *KVRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_kv_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KVRequest.ProtoReflect.Descriptor instead. +func (*KVRequest) Descriptor() ([]byte, []int) { + return file_sp_kv_proto_rawDescGZIP(), []int{2} +} + +func (x *KVRequest) GetInstructions() []*KVInstruction { + if x != nil { + return x.Instructions + } + return nil +} + +func (x *KVRequest) GetOverwrite() bool { + if x != nil { + return x.Overwrite + } + return false +} + +// "POST /api/v1/kv" accepts JSON of this type for it's request payload. This is +// converted by BroadcastKV() to a KVCommand +type KVCreateHTTPRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Kvs []*KVObject `protobuf:"bytes,1,rep,name=kvs,proto3" json:"kvs,omitempty"` + // Whether to treat create as upsert -- ie. do not error if key already exists + Overwrite bool `protobuf:"varint,2,opt,name=overwrite,proto3" json:"overwrite,omitempty"` +} + +func (x *KVCreateHTTPRequest) Reset() { + *x = KVCreateHTTPRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_kv_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KVCreateHTTPRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KVCreateHTTPRequest) ProtoMessage() {} + +func (x *KVCreateHTTPRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_kv_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KVCreateHTTPRequest.ProtoReflect.Descriptor instead. +func (*KVCreateHTTPRequest) Descriptor() ([]byte, []int) { + return file_sp_kv_proto_rawDescGZIP(), []int{3} +} + +func (x *KVCreateHTTPRequest) GetKvs() []*KVObject { + if x != nil { + return x.Kvs + } + return nil +} + +func (x *KVCreateHTTPRequest) GetOverwrite() bool { + if x != nil { + return x.Overwrite + } + return false +} + +type KVUpdateHTTPRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Kvs []*KVObject `protobuf:"bytes,1,rep,name=kvs,proto3" json:"kvs,omitempty"` +} + +func (x *KVUpdateHTTPRequest) Reset() { + *x = KVUpdateHTTPRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_kv_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KVUpdateHTTPRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KVUpdateHTTPRequest) ProtoMessage() {} + +func (x *KVUpdateHTTPRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_kv_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KVUpdateHTTPRequest.ProtoReflect.Descriptor instead. +func (*KVUpdateHTTPRequest) Descriptor() ([]byte, []int) { + return file_sp_kv_proto_rawDescGZIP(), []int{4} +} + +func (x *KVUpdateHTTPRequest) GetKvs() []*KVObject { + if x != nil { + return x.Kvs + } + return nil +} + +var File_sp_kv_proto protoreflect.FileDescriptor + +var file_sp_kv_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x73, 0x70, 0x5f, 0x6b, 0x76, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x1a, 0x16, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x70, + 0x5f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xac, 0x01, + 0x0a, 0x08, 0x4b, 0x56, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x12, 0x3b, 0x0a, 0x1b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, + 0x5f, 0x75, 0x6e, 0x69, 0x78, 0x5f, 0x74, 0x73, 0x5f, 0x6e, 0x61, 0x6e, 0x6f, 0x5f, 0x75, 0x74, + 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x16, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x41, 0x74, 0x55, 0x6e, 0x69, 0x78, 0x54, 0x73, 0x4e, 0x61, 0x6e, 0x6f, 0x55, 0x74, 0x63, 0x12, + 0x3b, 0x0a, 0x1b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x5f, 0x75, 0x6e, + 0x69, 0x78, 0x5f, 0x74, 0x73, 0x5f, 0x6e, 0x61, 0x6e, 0x6f, 0x5f, 0x75, 0x74, 0x63, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x16, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x55, + 0x6e, 0x69, 0x78, 0x54, 0x73, 0x4e, 0x61, 0x6e, 0x6f, 0x55, 0x74, 0x63, 0x22, 0xbb, 0x01, 0x0a, + 0x0d, 0x4b, 0x56, 0x49, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2f, + 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x4b, + 0x56, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x28, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4b, 0x56, 0x4f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x3f, 0x0a, 0x1d, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x5f, 0x75, 0x6e, 0x69, 0x78, 0x5f, 0x74, + 0x73, 0x5f, 0x6e, 0x61, 0x6e, 0x6f, 0x5f, 0x75, 0x74, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x18, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, 0x41, 0x74, 0x55, 0x6e, 0x69, + 0x78, 0x54, 0x73, 0x4e, 0x61, 0x6e, 0x6f, 0x55, 0x74, 0x63, 0x22, 0x64, 0x0a, 0x09, 0x4b, 0x56, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x39, 0x0a, 0x0c, 0x69, 0x6e, 0x73, 0x74, 0x72, + 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4b, 0x56, 0x49, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x69, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x6f, 0x76, 0x65, 0x72, 0x77, 0x72, 0x69, 0x74, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x6f, 0x76, 0x65, 0x72, 0x77, 0x72, 0x69, 0x74, 0x65, + 0x22, 0x57, 0x0a, 0x13, 0x4b, 0x56, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x03, 0x6b, 0x76, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4b, 0x56, + 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x03, 0x6b, 0x76, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x6f, + 0x76, 0x65, 0x72, 0x77, 0x72, 0x69, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, + 0x6f, 0x76, 0x65, 0x72, 0x77, 0x72, 0x69, 0x74, 0x65, 0x22, 0x39, 0x0a, 0x13, 0x4b, 0x56, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x22, 0x0a, 0x03, 0x6b, 0x76, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4b, 0x56, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, + 0x03, 0x6b, 0x76, 0x73, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x6c, 0x69, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_sp_kv_proto_rawDescOnce sync.Once + file_sp_kv_proto_rawDescData = file_sp_kv_proto_rawDesc +) + +func file_sp_kv_proto_rawDescGZIP() []byte { + file_sp_kv_proto_rawDescOnce.Do(func() { + file_sp_kv_proto_rawDescData = protoimpl.X.CompressGZIP(file_sp_kv_proto_rawDescData) + }) + return file_sp_kv_proto_rawDescData +} + +var file_sp_kv_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_sp_kv_proto_goTypes = []interface{}{ + (*KVObject)(nil), // 0: protos.KVObject + (*KVInstruction)(nil), // 1: protos.KVInstruction + (*KVRequest)(nil), // 2: protos.KVRequest + (*KVCreateHTTPRequest)(nil), // 3: protos.KVCreateHTTPRequest + (*KVUpdateHTTPRequest)(nil), // 4: protos.KVUpdateHTTPRequest + (shared.KVAction)(0), // 5: protos.shared.KVAction +} +var file_sp_kv_proto_depIdxs = []int32{ + 5, // 0: protos.KVInstruction.action:type_name -> protos.shared.KVAction + 0, // 1: protos.KVInstruction.object:type_name -> protos.KVObject + 1, // 2: protos.KVRequest.instructions:type_name -> protos.KVInstruction + 0, // 3: protos.KVCreateHTTPRequest.kvs:type_name -> protos.KVObject + 0, // 4: protos.KVUpdateHTTPRequest.kvs:type_name -> protos.KVObject + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_sp_kv_proto_init() } +func file_sp_kv_proto_init() { + if File_sp_kv_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_sp_kv_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KVObject); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_kv_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KVInstruction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_kv_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KVRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_kv_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KVCreateHTTPRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_kv_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KVUpdateHTTPRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_sp_kv_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_sp_kv_proto_goTypes, + DependencyIndexes: file_sp_kv_proto_depIdxs, + MessageInfos: file_sp_kv_proto_msgTypes, + }.Build() + File_sp_kv_proto = out.File + file_sp_kv_proto_rawDesc = nil + file_sp_kv_proto_goTypes = nil + file_sp_kv_proto_depIdxs = nil +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_notify.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_notify.pb.go new file mode 100644 index 000000000..af455c111 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_notify.pb.go @@ -0,0 +1,911 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: sp_notify.proto + +package protos + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type NotificationType int32 + +const ( + NotificationType_NOTIFICATION_TYPE_UNSET NotificationType = 0 + NotificationType_NOTIFICATION_TYPE_SLACK NotificationType = 1 + NotificationType_NOTIFICATION_TYPE_EMAIL NotificationType = 2 + NotificationType_NOTIFICATION_TYPE_PAGERDUTY NotificationType = 3 +) + +// Enum value maps for NotificationType. +var ( + NotificationType_name = map[int32]string{ + 0: "NOTIFICATION_TYPE_UNSET", + 1: "NOTIFICATION_TYPE_SLACK", + 2: "NOTIFICATION_TYPE_EMAIL", + 3: "NOTIFICATION_TYPE_PAGERDUTY", + } + NotificationType_value = map[string]int32{ + "NOTIFICATION_TYPE_UNSET": 0, + "NOTIFICATION_TYPE_SLACK": 1, + "NOTIFICATION_TYPE_EMAIL": 2, + "NOTIFICATION_TYPE_PAGERDUTY": 3, + } +) + +func (x NotificationType) Enum() *NotificationType { + p := new(NotificationType) + *p = x + return p +} + +func (x NotificationType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (NotificationType) Descriptor() protoreflect.EnumDescriptor { + return file_sp_notify_proto_enumTypes[0].Descriptor() +} + +func (NotificationType) Type() protoreflect.EnumType { + return &file_sp_notify_proto_enumTypes[0] +} + +func (x NotificationType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use NotificationType.Descriptor instead. +func (NotificationType) EnumDescriptor() ([]byte, []int) { + return file_sp_notify_proto_rawDescGZIP(), []int{0} +} + +type NotificationEmail_Type int32 + +const ( + NotificationEmail_TYPE_UNSET NotificationEmail_Type = 0 + NotificationEmail_TYPE_SMTP NotificationEmail_Type = 1 + NotificationEmail_TYPE_SES NotificationEmail_Type = 2 +) + +// Enum value maps for NotificationEmail_Type. +var ( + NotificationEmail_Type_name = map[int32]string{ + 0: "TYPE_UNSET", + 1: "TYPE_SMTP", + 2: "TYPE_SES", + } + NotificationEmail_Type_value = map[string]int32{ + "TYPE_UNSET": 0, + "TYPE_SMTP": 1, + "TYPE_SES": 2, + } +) + +func (x NotificationEmail_Type) Enum() *NotificationEmail_Type { + p := new(NotificationEmail_Type) + *p = x + return p +} + +func (x NotificationEmail_Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (NotificationEmail_Type) Descriptor() protoreflect.EnumDescriptor { + return file_sp_notify_proto_enumTypes[1].Descriptor() +} + +func (NotificationEmail_Type) Type() protoreflect.EnumType { + return &file_sp_notify_proto_enumTypes[1] +} + +func (x NotificationEmail_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use NotificationEmail_Type.Descriptor instead. +func (NotificationEmail_Type) EnumDescriptor() ([]byte, []int) { + return file_sp_notify_proto_rawDescGZIP(), []int{2, 0} +} + +type NotificationPagerDuty_Urgency int32 + +const ( + NotificationPagerDuty_URGENCY_UNSET NotificationPagerDuty_Urgency = 0 + NotificationPagerDuty_URGENCY_LOW NotificationPagerDuty_Urgency = 1 + NotificationPagerDuty_URGENCY_HIGH NotificationPagerDuty_Urgency = 2 +) + +// Enum value maps for NotificationPagerDuty_Urgency. +var ( + NotificationPagerDuty_Urgency_name = map[int32]string{ + 0: "URGENCY_UNSET", + 1: "URGENCY_LOW", + 2: "URGENCY_HIGH", + } + NotificationPagerDuty_Urgency_value = map[string]int32{ + "URGENCY_UNSET": 0, + "URGENCY_LOW": 1, + "URGENCY_HIGH": 2, + } +) + +func (x NotificationPagerDuty_Urgency) Enum() *NotificationPagerDuty_Urgency { + p := new(NotificationPagerDuty_Urgency) + *p = x + return p +} + +func (x NotificationPagerDuty_Urgency) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (NotificationPagerDuty_Urgency) Descriptor() protoreflect.EnumDescriptor { + return file_sp_notify_proto_enumTypes[2].Descriptor() +} + +func (NotificationPagerDuty_Urgency) Type() protoreflect.EnumType { + return &file_sp_notify_proto_enumTypes[2] +} + +func (x NotificationPagerDuty_Urgency) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use NotificationPagerDuty_Urgency.Descriptor instead. +func (NotificationPagerDuty_Urgency) EnumDescriptor() ([]byte, []int) { + return file_sp_notify_proto_rawDescGZIP(), []int{5, 0} +} + +type NotificationConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id *string `protobuf:"bytes,1,opt,name=id,proto3,oneof" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Type NotificationType `protobuf:"varint,3,opt,name=type,proto3,enum=protos.NotificationType" json:"type,omitempty"` + // Types that are assignable to Config: + // + // *NotificationConfig_Slack + // *NotificationConfig_Email + // *NotificationConfig_Pagerduty + Config isNotificationConfig_Config `protobuf_oneof:"config"` +} + +func (x *NotificationConfig) Reset() { + *x = NotificationConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_notify_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NotificationConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NotificationConfig) ProtoMessage() {} + +func (x *NotificationConfig) ProtoReflect() protoreflect.Message { + mi := &file_sp_notify_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NotificationConfig.ProtoReflect.Descriptor instead. +func (*NotificationConfig) Descriptor() ([]byte, []int) { + return file_sp_notify_proto_rawDescGZIP(), []int{0} +} + +func (x *NotificationConfig) GetId() string { + if x != nil && x.Id != nil { + return *x.Id + } + return "" +} + +func (x *NotificationConfig) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NotificationConfig) GetType() NotificationType { + if x != nil { + return x.Type + } + return NotificationType_NOTIFICATION_TYPE_UNSET +} + +func (m *NotificationConfig) GetConfig() isNotificationConfig_Config { + if m != nil { + return m.Config + } + return nil +} + +func (x *NotificationConfig) GetSlack() *NotificationSlack { + if x, ok := x.GetConfig().(*NotificationConfig_Slack); ok { + return x.Slack + } + return nil +} + +func (x *NotificationConfig) GetEmail() *NotificationEmail { + if x, ok := x.GetConfig().(*NotificationConfig_Email); ok { + return x.Email + } + return nil +} + +func (x *NotificationConfig) GetPagerduty() *NotificationPagerDuty { + if x, ok := x.GetConfig().(*NotificationConfig_Pagerduty); ok { + return x.Pagerduty + } + return nil +} + +type isNotificationConfig_Config interface { + isNotificationConfig_Config() +} + +type NotificationConfig_Slack struct { + Slack *NotificationSlack `protobuf:"bytes,1000,opt,name=slack,proto3,oneof"` +} + +type NotificationConfig_Email struct { + Email *NotificationEmail `protobuf:"bytes,1001,opt,name=email,proto3,oneof"` +} + +type NotificationConfig_Pagerduty struct { + Pagerduty *NotificationPagerDuty `protobuf:"bytes,1002,opt,name=pagerduty,proto3,oneof"` +} + +func (*NotificationConfig_Slack) isNotificationConfig_Config() {} + +func (*NotificationConfig_Email) isNotificationConfig_Config() {} + +func (*NotificationConfig_Pagerduty) isNotificationConfig_Config() {} + +type NotificationSlack struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + BotToken string `protobuf:"bytes,1,opt,name=bot_token,json=botToken,proto3" json:"bot_token,omitempty"` + Channel string `protobuf:"bytes,2,opt,name=channel,proto3" json:"channel,omitempty"` +} + +func (x *NotificationSlack) Reset() { + *x = NotificationSlack{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_notify_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NotificationSlack) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NotificationSlack) ProtoMessage() {} + +func (x *NotificationSlack) ProtoReflect() protoreflect.Message { + mi := &file_sp_notify_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NotificationSlack.ProtoReflect.Descriptor instead. +func (*NotificationSlack) Descriptor() ([]byte, []int) { + return file_sp_notify_proto_rawDescGZIP(), []int{1} +} + +func (x *NotificationSlack) GetBotToken() string { + if x != nil { + return x.BotToken + } + return "" +} + +func (x *NotificationSlack) GetChannel() string { + if x != nil { + return x.Channel + } + return "" +} + +type NotificationEmail struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type NotificationEmail_Type `protobuf:"varint,1,opt,name=type,proto3,enum=protos.NotificationEmail_Type" json:"type,omitempty"` + Recipients []string `protobuf:"bytes,2,rep,name=recipients,proto3" json:"recipients,omitempty"` + FromAddress string `protobuf:"bytes,3,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + // Types that are assignable to Config: + // + // *NotificationEmail_Smtp + // *NotificationEmail_Ses + Config isNotificationEmail_Config `protobuf_oneof:"config"` +} + +func (x *NotificationEmail) Reset() { + *x = NotificationEmail{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_notify_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NotificationEmail) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NotificationEmail) ProtoMessage() {} + +func (x *NotificationEmail) ProtoReflect() protoreflect.Message { + mi := &file_sp_notify_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NotificationEmail.ProtoReflect.Descriptor instead. +func (*NotificationEmail) Descriptor() ([]byte, []int) { + return file_sp_notify_proto_rawDescGZIP(), []int{2} +} + +func (x *NotificationEmail) GetType() NotificationEmail_Type { + if x != nil { + return x.Type + } + return NotificationEmail_TYPE_UNSET +} + +func (x *NotificationEmail) GetRecipients() []string { + if x != nil { + return x.Recipients + } + return nil +} + +func (x *NotificationEmail) GetFromAddress() string { + if x != nil { + return x.FromAddress + } + return "" +} + +func (m *NotificationEmail) GetConfig() isNotificationEmail_Config { + if m != nil { + return m.Config + } + return nil +} + +func (x *NotificationEmail) GetSmtp() *NotificationEmailSMTP { + if x, ok := x.GetConfig().(*NotificationEmail_Smtp); ok { + return x.Smtp + } + return nil +} + +func (x *NotificationEmail) GetSes() *NotificationEmailSES { + if x, ok := x.GetConfig().(*NotificationEmail_Ses); ok { + return x.Ses + } + return nil +} + +type isNotificationEmail_Config interface { + isNotificationEmail_Config() +} + +type NotificationEmail_Smtp struct { + Smtp *NotificationEmailSMTP `protobuf:"bytes,1000,opt,name=smtp,proto3,oneof"` +} + +type NotificationEmail_Ses struct { + Ses *NotificationEmailSES `protobuf:"bytes,1001,opt,name=ses,proto3,oneof"` +} + +func (*NotificationEmail_Smtp) isNotificationEmail_Config() {} + +func (*NotificationEmail_Ses) isNotificationEmail_Config() {} + +type NotificationEmailSMTP struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` + Port int32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"` + User string `protobuf:"bytes,3,opt,name=user,proto3" json:"user,omitempty"` + Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"` + UseTls bool `protobuf:"varint,5,opt,name=use_tls,json=useTls,proto3" json:"use_tls,omitempty"` +} + +func (x *NotificationEmailSMTP) Reset() { + *x = NotificationEmailSMTP{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_notify_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NotificationEmailSMTP) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NotificationEmailSMTP) ProtoMessage() {} + +func (x *NotificationEmailSMTP) ProtoReflect() protoreflect.Message { + mi := &file_sp_notify_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NotificationEmailSMTP.ProtoReflect.Descriptor instead. +func (*NotificationEmailSMTP) Descriptor() ([]byte, []int) { + return file_sp_notify_proto_rawDescGZIP(), []int{3} +} + +func (x *NotificationEmailSMTP) GetHost() string { + if x != nil { + return x.Host + } + return "" +} + +func (x *NotificationEmailSMTP) GetPort() int32 { + if x != nil { + return x.Port + } + return 0 +} + +func (x *NotificationEmailSMTP) GetUser() string { + if x != nil { + return x.User + } + return "" +} + +func (x *NotificationEmailSMTP) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +func (x *NotificationEmailSMTP) GetUseTls() bool { + if x != nil { + return x.UseTls + } + return false +} + +type NotificationEmailSES struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SesRegion string `protobuf:"bytes,1,opt,name=ses_region,json=sesRegion,proto3" json:"ses_region,omitempty"` + SesAccessKeyId string `protobuf:"bytes,2,opt,name=ses_access_key_id,json=sesAccessKeyId,proto3" json:"ses_access_key_id,omitempty"` + SesSecretAccessKey string `protobuf:"bytes,3,opt,name=ses_secret_access_key,json=sesSecretAccessKey,proto3" json:"ses_secret_access_key,omitempty"` +} + +func (x *NotificationEmailSES) Reset() { + *x = NotificationEmailSES{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_notify_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NotificationEmailSES) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NotificationEmailSES) ProtoMessage() {} + +func (x *NotificationEmailSES) ProtoReflect() protoreflect.Message { + mi := &file_sp_notify_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NotificationEmailSES.ProtoReflect.Descriptor instead. +func (*NotificationEmailSES) Descriptor() ([]byte, []int) { + return file_sp_notify_proto_rawDescGZIP(), []int{4} +} + +func (x *NotificationEmailSES) GetSesRegion() string { + if x != nil { + return x.SesRegion + } + return "" +} + +func (x *NotificationEmailSES) GetSesAccessKeyId() string { + if x != nil { + return x.SesAccessKeyId + } + return "" +} + +func (x *NotificationEmailSES) GetSesSecretAccessKey() string { + if x != nil { + return x.SesSecretAccessKey + } + return "" +} + +type NotificationPagerDuty struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Auth token + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + // Must be a valid email for a PagerDuty user + Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` + // Must be a valid PagerDuty service + ServiceId string `protobuf:"bytes,3,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` + Urgency NotificationPagerDuty_Urgency `protobuf:"varint,4,opt,name=urgency,proto3,enum=protos.NotificationPagerDuty_Urgency" json:"urgency,omitempty"` +} + +func (x *NotificationPagerDuty) Reset() { + *x = NotificationPagerDuty{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_notify_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NotificationPagerDuty) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NotificationPagerDuty) ProtoMessage() {} + +func (x *NotificationPagerDuty) ProtoReflect() protoreflect.Message { + mi := &file_sp_notify_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NotificationPagerDuty.ProtoReflect.Descriptor instead. +func (*NotificationPagerDuty) Descriptor() ([]byte, []int) { + return file_sp_notify_proto_rawDescGZIP(), []int{5} +} + +func (x *NotificationPagerDuty) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *NotificationPagerDuty) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *NotificationPagerDuty) GetServiceId() string { + if x != nil { + return x.ServiceId + } + return "" +} + +func (x *NotificationPagerDuty) GetUrgency() NotificationPagerDuty_Urgency { + if x != nil { + return x.Urgency + } + return NotificationPagerDuty_URGENCY_UNSET +} + +var File_sp_notify_proto protoreflect.FileDescriptor + +var file_sp_notify_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x73, 0x70, 0x5f, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x22, 0xa4, 0x02, 0x0a, 0x12, 0x4e, 0x6f, + 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x12, 0x13, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x02, + 0x69, 0x64, 0x88, 0x01, 0x01, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, + 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x32, 0x0a, 0x05, 0x73, 0x6c, 0x61, 0x63, 0x6b, + 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x6c, 0x61, + 0x63, 0x6b, 0x48, 0x00, 0x52, 0x05, 0x73, 0x6c, 0x61, 0x63, 0x6b, 0x12, 0x32, 0x0a, 0x05, 0x65, + 0x6d, 0x61, 0x69, 0x6c, 0x18, 0xe9, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x48, 0x00, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, + 0x3e, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x72, 0x64, 0x75, 0x74, 0x79, 0x18, 0xea, 0x07, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4e, 0x6f, 0x74, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x67, 0x65, 0x72, 0x44, 0x75, + 0x74, 0x79, 0x48, 0x00, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x72, 0x64, 0x75, 0x74, 0x79, 0x42, + 0x08, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x05, 0x0a, 0x03, 0x5f, 0x69, 0x64, + 0x22, 0x4a, 0x0a, 0x11, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x6f, 0x74, 0x5f, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x6f, 0x74, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x22, 0xb2, 0x02, 0x0a, + 0x11, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6d, 0x61, + 0x69, 0x6c, 0x12, 0x32, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x2e, 0x54, 0x79, 0x70, 0x65, + 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, + 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x63, 0x69, + 0x70, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x66, 0x72, + 0x6f, 0x6d, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x34, 0x0a, 0x04, 0x73, 0x6d, 0x74, + 0x70, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6d, + 0x61, 0x69, 0x6c, 0x53, 0x4d, 0x54, 0x50, 0x48, 0x00, 0x52, 0x04, 0x73, 0x6d, 0x74, 0x70, 0x12, + 0x31, 0x0a, 0x03, 0x73, 0x65, 0x73, 0x18, 0xe9, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x53, 0x45, 0x53, 0x48, 0x00, 0x52, 0x03, 0x73, + 0x65, 0x73, 0x22, 0x33, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x45, 0x54, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x53, 0x4d, 0x54, 0x50, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x53, 0x45, 0x53, 0x10, 0x02, 0x42, 0x08, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x22, 0x88, 0x01, 0x0a, 0x15, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x53, 0x4d, 0x54, 0x50, 0x12, 0x12, 0x0a, 0x04, 0x68, + 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, + 0x6f, 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, + 0x6f, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, + 0x6f, 0x72, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x5f, 0x74, 0x6c, 0x73, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x75, 0x73, 0x65, 0x54, 0x6c, 0x73, 0x22, 0x93, 0x01, 0x0a, + 0x14, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6d, 0x61, + 0x69, 0x6c, 0x53, 0x45, 0x53, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x5f, 0x72, 0x65, 0x67, + 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x73, 0x52, 0x65, + 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x11, 0x73, 0x65, 0x73, 0x5f, 0x61, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0e, 0x73, 0x65, 0x73, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x12, + 0x31, 0x0a, 0x15, 0x73, 0x65, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x61, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, + 0x73, 0x65, 0x73, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, + 0x65, 0x79, 0x22, 0xe4, 0x01, 0x0a, 0x15, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x67, 0x65, 0x72, 0x44, 0x75, 0x74, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x3f, 0x0a, 0x07, 0x75, 0x72, 0x67, 0x65, 0x6e, + 0x63, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, + 0x67, 0x65, 0x72, 0x44, 0x75, 0x74, 0x79, 0x2e, 0x55, 0x72, 0x67, 0x65, 0x6e, 0x63, 0x79, 0x52, + 0x07, 0x75, 0x72, 0x67, 0x65, 0x6e, 0x63, 0x79, 0x22, 0x3f, 0x0a, 0x07, 0x55, 0x72, 0x67, 0x65, + 0x6e, 0x63, 0x79, 0x12, 0x11, 0x0a, 0x0d, 0x55, 0x52, 0x47, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, + 0x4e, 0x53, 0x45, 0x54, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x52, 0x47, 0x45, 0x4e, 0x43, + 0x59, 0x5f, 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x55, 0x52, 0x47, 0x45, 0x4e, + 0x43, 0x59, 0x5f, 0x48, 0x49, 0x47, 0x48, 0x10, 0x02, 0x2a, 0x8a, 0x01, 0x0a, 0x10, 0x4e, 0x6f, + 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b, + 0x0a, 0x17, 0x4e, 0x4f, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x45, 0x54, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x4e, + 0x4f, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x53, 0x4c, 0x41, 0x43, 0x4b, 0x10, 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x4e, 0x4f, 0x54, 0x49, + 0x46, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4d, + 0x41, 0x49, 0x4c, 0x10, 0x02, 0x12, 0x1f, 0x0a, 0x1b, 0x4e, 0x4f, 0x54, 0x49, 0x46, 0x49, 0x43, + 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x41, 0x47, 0x45, 0x52, + 0x44, 0x55, 0x54, 0x59, 0x10, 0x03, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x6c, 0x69, 0x62, 0x73, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_sp_notify_proto_rawDescOnce sync.Once + file_sp_notify_proto_rawDescData = file_sp_notify_proto_rawDesc +) + +func file_sp_notify_proto_rawDescGZIP() []byte { + file_sp_notify_proto_rawDescOnce.Do(func() { + file_sp_notify_proto_rawDescData = protoimpl.X.CompressGZIP(file_sp_notify_proto_rawDescData) + }) + return file_sp_notify_proto_rawDescData +} + +var file_sp_notify_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_sp_notify_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_sp_notify_proto_goTypes = []interface{}{ + (NotificationType)(0), // 0: protos.NotificationType + (NotificationEmail_Type)(0), // 1: protos.NotificationEmail.Type + (NotificationPagerDuty_Urgency)(0), // 2: protos.NotificationPagerDuty.Urgency + (*NotificationConfig)(nil), // 3: protos.NotificationConfig + (*NotificationSlack)(nil), // 4: protos.NotificationSlack + (*NotificationEmail)(nil), // 5: protos.NotificationEmail + (*NotificationEmailSMTP)(nil), // 6: protos.NotificationEmailSMTP + (*NotificationEmailSES)(nil), // 7: protos.NotificationEmailSES + (*NotificationPagerDuty)(nil), // 8: protos.NotificationPagerDuty +} +var file_sp_notify_proto_depIdxs = []int32{ + 0, // 0: protos.NotificationConfig.type:type_name -> protos.NotificationType + 4, // 1: protos.NotificationConfig.slack:type_name -> protos.NotificationSlack + 5, // 2: protos.NotificationConfig.email:type_name -> protos.NotificationEmail + 8, // 3: protos.NotificationConfig.pagerduty:type_name -> protos.NotificationPagerDuty + 1, // 4: protos.NotificationEmail.type:type_name -> protos.NotificationEmail.Type + 6, // 5: protos.NotificationEmail.smtp:type_name -> protos.NotificationEmailSMTP + 7, // 6: protos.NotificationEmail.ses:type_name -> protos.NotificationEmailSES + 2, // 7: protos.NotificationPagerDuty.urgency:type_name -> protos.NotificationPagerDuty.Urgency + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name +} + +func init() { file_sp_notify_proto_init() } +func file_sp_notify_proto_init() { + if File_sp_notify_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_sp_notify_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NotificationConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_notify_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NotificationSlack); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_notify_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NotificationEmail); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_notify_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NotificationEmailSMTP); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_notify_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NotificationEmailSES); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_notify_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NotificationPagerDuty); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_sp_notify_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*NotificationConfig_Slack)(nil), + (*NotificationConfig_Email)(nil), + (*NotificationConfig_Pagerduty)(nil), + } + file_sp_notify_proto_msgTypes[2].OneofWrappers = []interface{}{ + (*NotificationEmail_Smtp)(nil), + (*NotificationEmail_Ses)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_sp_notify_proto_rawDesc, + NumEnums: 3, + NumMessages: 6, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_sp_notify_proto_goTypes, + DependencyIndexes: file_sp_notify_proto_depIdxs, + EnumInfos: file_sp_notify_proto_enumTypes, + MessageInfos: file_sp_notify_proto_msgTypes, + }.Build() + File_sp_notify_proto = out.File + file_sp_notify_proto_rawDesc = nil + file_sp_notify_proto_goTypes = nil + file_sp_notify_proto_depIdxs = nil +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_pipeline.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_pipeline.pb.go new file mode 100644 index 000000000..e8ff77594 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_pipeline.pb.go @@ -0,0 +1,1110 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: sp_pipeline.proto + +package protos + +import ( + steps "github.com/streamdal/streamdal/libs/protos/build/go/protos/steps" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Defines the ways in which a pipeline can be aborted +type AbortCondition int32 + +const ( + AbortCondition_ABORT_CONDITION_UNSET AbortCondition = 0 + AbortCondition_ABORT_CONDITION_ABORT_CURRENT AbortCondition = 1 + AbortCondition_ABORT_CONDITION_ABORT_ALL AbortCondition = 2 +) + +// Enum value maps for AbortCondition. +var ( + AbortCondition_name = map[int32]string{ + 0: "ABORT_CONDITION_UNSET", + 1: "ABORT_CONDITION_ABORT_CURRENT", + 2: "ABORT_CONDITION_ABORT_ALL", + } + AbortCondition_value = map[string]int32{ + "ABORT_CONDITION_UNSET": 0, + "ABORT_CONDITION_ABORT_CURRENT": 1, + "ABORT_CONDITION_ABORT_ALL": 2, + } +) + +func (x AbortCondition) Enum() *AbortCondition { + p := new(AbortCondition) + *p = x + return p +} + +func (x AbortCondition) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (AbortCondition) Descriptor() protoreflect.EnumDescriptor { + return file_sp_pipeline_proto_enumTypes[0].Descriptor() +} + +func (AbortCondition) Type() protoreflect.EnumType { + return &file_sp_pipeline_proto_enumTypes[0] +} + +func (x AbortCondition) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use AbortCondition.Descriptor instead. +func (AbortCondition) EnumDescriptor() ([]byte, []int) { + return file_sp_pipeline_proto_rawDescGZIP(), []int{0} +} + +type PipelineStepNotification_PayloadType int32 + +const ( + // Same functionality as PAYLOAD_TYPE_EXCLUDE + PipelineStepNotification_PAYLOAD_TYPE_UNSET PipelineStepNotification_PayloadType = 0 + // Default. No payload data included in notification + PipelineStepNotification_PAYLOAD_TYPE_EXCLUDE PipelineStepNotification_PayloadType = 1 + // Entire payload content included in notification + PipelineStepNotification_PAYLOAD_TYPE_FULL_PAYLOAD PipelineStepNotification_PayloadType = 2 + // Only specified paths of payload content included in notification + // Only works on JSON. Plaintext payloads will be ignored. + PipelineStepNotification_PAYLOAD_TYPE_SELECT_PATHS PipelineStepNotification_PayloadType = 3 +) + +// Enum value maps for PipelineStepNotification_PayloadType. +var ( + PipelineStepNotification_PayloadType_name = map[int32]string{ + 0: "PAYLOAD_TYPE_UNSET", + 1: "PAYLOAD_TYPE_EXCLUDE", + 2: "PAYLOAD_TYPE_FULL_PAYLOAD", + 3: "PAYLOAD_TYPE_SELECT_PATHS", + } + PipelineStepNotification_PayloadType_value = map[string]int32{ + "PAYLOAD_TYPE_UNSET": 0, + "PAYLOAD_TYPE_EXCLUDE": 1, + "PAYLOAD_TYPE_FULL_PAYLOAD": 2, + "PAYLOAD_TYPE_SELECT_PATHS": 3, + } +) + +func (x PipelineStepNotification_PayloadType) Enum() *PipelineStepNotification_PayloadType { + p := new(PipelineStepNotification_PayloadType) + *p = x + return p +} + +func (x PipelineStepNotification_PayloadType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (PipelineStepNotification_PayloadType) Descriptor() protoreflect.EnumDescriptor { + return file_sp_pipeline_proto_enumTypes[1].Descriptor() +} + +func (PipelineStepNotification_PayloadType) Type() protoreflect.EnumType { + return &file_sp_pipeline_proto_enumTypes[1] +} + +func (x PipelineStepNotification_PayloadType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use PipelineStepNotification_PayloadType.Descriptor instead. +func (PipelineStepNotification_PayloadType) EnumDescriptor() ([]byte, []int) { + return file_sp_pipeline_proto_rawDescGZIP(), []int{2, 0} +} + +// Pipeline is a structure that holds one or more pipeline steps. This structure +// is intended to be immutable; clients are expected to generate WASMRequest's +// that contain a pipeline step. +type Pipeline struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // ID should NOT be set by external gRPC client on CreatePipelineRequest - it + // will be ignored; it _does_ need to be set on UpdatePipelineRequest. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Friendly name for the pipeline + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // One or more steps to execute + Steps []*PipelineStep `protobuf:"bytes,3,rep,name=steps,proto3" json:"steps,omitempty"` + // Notification configs for this pipeline. Only filled out in external API responses + // This is deprecated and the data has moved to PipelineStep + // + // Deprecated: Marked as deprecated in sp_pipeline.proto. + XNotificationConfigs []*NotificationConfig `protobuf:"bytes,4,rep,name=_notification_configs,json=NotificationConfigs,proto3" json:"_notification_configs,omitempty"` // protolint:disable:this FIELD_NAMES_LOWER_SNAKE_CASE + // Indicates whether the pipeline is paused or not. Used internally by server. + XPaused *bool `protobuf:"varint,1000,opt,name=_paused,json=Paused,proto3,oneof" json:"_paused,omitempty"` // protolint:disable:this FIELD_NAMES_LOWER_SNAKE_CASE +} + +func (x *Pipeline) Reset() { + *x = Pipeline{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_pipeline_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Pipeline) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Pipeline) ProtoMessage() {} + +func (x *Pipeline) ProtoReflect() protoreflect.Message { + mi := &file_sp_pipeline_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Pipeline.ProtoReflect.Descriptor instead. +func (*Pipeline) Descriptor() ([]byte, []int) { + return file_sp_pipeline_proto_rawDescGZIP(), []int{0} +} + +func (x *Pipeline) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Pipeline) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Pipeline) GetSteps() []*PipelineStep { + if x != nil { + return x.Steps + } + return nil +} + +// Deprecated: Marked as deprecated in sp_pipeline.proto. +func (x *Pipeline) GetXNotificationConfigs() []*NotificationConfig { + if x != nil { + return x.XNotificationConfigs + } + return nil +} + +func (x *Pipeline) GetXPaused() bool { + if x != nil && x.XPaused != nil { + return *x.XPaused + } + return false +} + +// Conditions define how the SDK should handle a Wasm response in a step. +// Should it continue executing the pipeline, should it abort, should it notify +// and on_error. +// TODO: de-pluralize this name +type PipelineStepConditions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Should we abort execution? + Abort AbortCondition `protobuf:"varint,1,opt,name=abort,proto3,enum=protos.AbortCondition" json:"abort,omitempty"` + // Deprecated: Marked as deprecated in sp_pipeline.proto. + Notify bool `protobuf:"varint,2,opt,name=notify,proto3" json:"notify,omitempty"` + // Should we include additional metadata that SDK should pass back to user? + Metadata map[string]string `protobuf:"bytes,3,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Notification *PipelineStepNotification `protobuf:"bytes,4,opt,name=notification,proto3" json:"notification,omitempty"` +} + +func (x *PipelineStepConditions) Reset() { + *x = PipelineStepConditions{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_pipeline_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PipelineStepConditions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PipelineStepConditions) ProtoMessage() {} + +func (x *PipelineStepConditions) ProtoReflect() protoreflect.Message { + mi := &file_sp_pipeline_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PipelineStepConditions.ProtoReflect.Descriptor instead. +func (*PipelineStepConditions) Descriptor() ([]byte, []int) { + return file_sp_pipeline_proto_rawDescGZIP(), []int{1} +} + +func (x *PipelineStepConditions) GetAbort() AbortCondition { + if x != nil { + return x.Abort + } + return AbortCondition_ABORT_CONDITION_UNSET +} + +// Deprecated: Marked as deprecated in sp_pipeline.proto. +func (x *PipelineStepConditions) GetNotify() bool { + if x != nil { + return x.Notify + } + return false +} + +func (x *PipelineStepConditions) GetMetadata() map[string]string { + if x != nil { + return x.Metadata + } + return nil +} + +func (x *PipelineStepConditions) GetNotification() *PipelineStepNotification { + if x != nil { + return x.Notification + } + return nil +} + +type PipelineStepNotification struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The UUIDs of the notification config to use + // This is kept separate to avoid having to configure slack/email settings + // every time and also because that config info is sensitive and is encrypted + NotificationConfigIds []string `protobuf:"bytes,1,rep,name=notification_config_ids,json=notificationConfigIds,proto3" json:"notification_config_ids,omitempty"` + PayloadType PipelineStepNotification_PayloadType `protobuf:"varint,2,opt,name=payload_type,json=payloadType,proto3,enum=protos.PipelineStepNotification_PayloadType" json:"payload_type,omitempty"` + // If type == paths, then we will look here for a list of json paths to include + // in the notification payload. + Paths []string `protobuf:"bytes,3,rep,name=paths,proto3" json:"paths,omitempty"` +} + +func (x *PipelineStepNotification) Reset() { + *x = PipelineStepNotification{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_pipeline_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PipelineStepNotification) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PipelineStepNotification) ProtoMessage() {} + +func (x *PipelineStepNotification) ProtoReflect() protoreflect.Message { + mi := &file_sp_pipeline_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PipelineStepNotification.ProtoReflect.Descriptor instead. +func (*PipelineStepNotification) Descriptor() ([]byte, []int) { + return file_sp_pipeline_proto_rawDescGZIP(), []int{2} +} + +func (x *PipelineStepNotification) GetNotificationConfigIds() []string { + if x != nil { + return x.NotificationConfigIds + } + return nil +} + +func (x *PipelineStepNotification) GetPayloadType() PipelineStepNotification_PayloadType { + if x != nil { + return x.PayloadType + } + return PipelineStepNotification_PAYLOAD_TYPE_UNSET +} + +func (x *PipelineStepNotification) GetPaths() []string { + if x != nil { + return x.Paths + } + return nil +} + +// A pipeline step is a single step in a pipeline. +type PipelineStep struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Friendly name for the step + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // SDKs should read this when Wasm returns 'true' to determine what to do next. + OnTrue *PipelineStepConditions `protobuf:"bytes,2,opt,name=on_true,json=onTrue,proto3" json:"on_true,omitempty"` + // SDKs should read this when Wasm returns 'false' to determine what to do next. + OnFalse *PipelineStepConditions `protobuf:"bytes,3,opt,name=on_false,json=onFalse,proto3" json:"on_false,omitempty"` + // Indicates whether to use the results from a previous step as input to this step + Dynamic bool `protobuf:"varint,4,opt,name=dynamic,proto3" json:"dynamic,omitempty"` + // SDKs should read this when Wasm returns 'error' to determine what to do next. + OnError *PipelineStepConditions `protobuf:"bytes,5,opt,name=on_error,json=onError,proto3" json:"on_error,omitempty"` + // Types that are assignable to Step: + // + // *PipelineStep_Detective + // *PipelineStep_Transform + // *PipelineStep_Encode + // *PipelineStep_Decode + // *PipelineStep_Custom + // *PipelineStep_HttpRequest + // *PipelineStep_Kv + // *PipelineStep_InferSchema + // *PipelineStep_ValidJson + // *PipelineStep_SchemaValidation + Step isPipelineStep_Step `protobuf_oneof:"step"` + // ID is a uuid(sha256(_wasm_bytes)) that is set by server + XWasmId *string `protobuf:"bytes,10000,opt,name=_wasm_id,json=WasmId,proto3,oneof" json:"_wasm_id,omitempty"` // protolint:disable:this FIELD_NAMES_LOWER_SNAKE_CASE + // WASM module bytes (set by server) + XWasmBytes []byte `protobuf:"bytes,10001,opt,name=_wasm_bytes,json=WasmBytes,proto3,oneof" json:"_wasm_bytes,omitempty"` // protolint:disable:this FIELD_NAMES_LOWER_SNAKE_CASE + // WASM function name to execute (set by server) + XWasmFunction *string `protobuf:"bytes,10002,opt,name=_wasm_function,json=WasmFunction,proto3,oneof" json:"_wasm_function,omitempty"` // protolint:disable:this FIELD_NAMES_LOWER_SNAKE_CASE +} + +func (x *PipelineStep) Reset() { + *x = PipelineStep{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_pipeline_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PipelineStep) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PipelineStep) ProtoMessage() {} + +func (x *PipelineStep) ProtoReflect() protoreflect.Message { + mi := &file_sp_pipeline_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PipelineStep.ProtoReflect.Descriptor instead. +func (*PipelineStep) Descriptor() ([]byte, []int) { + return file_sp_pipeline_proto_rawDescGZIP(), []int{3} +} + +func (x *PipelineStep) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *PipelineStep) GetOnTrue() *PipelineStepConditions { + if x != nil { + return x.OnTrue + } + return nil +} + +func (x *PipelineStep) GetOnFalse() *PipelineStepConditions { + if x != nil { + return x.OnFalse + } + return nil +} + +func (x *PipelineStep) GetDynamic() bool { + if x != nil { + return x.Dynamic + } + return false +} + +func (x *PipelineStep) GetOnError() *PipelineStepConditions { + if x != nil { + return x.OnError + } + return nil +} + +func (m *PipelineStep) GetStep() isPipelineStep_Step { + if m != nil { + return m.Step + } + return nil +} + +func (x *PipelineStep) GetDetective() *steps.DetectiveStep { + if x, ok := x.GetStep().(*PipelineStep_Detective); ok { + return x.Detective + } + return nil +} + +func (x *PipelineStep) GetTransform() *steps.TransformStep { + if x, ok := x.GetStep().(*PipelineStep_Transform); ok { + return x.Transform + } + return nil +} + +func (x *PipelineStep) GetEncode() *steps.EncodeStep { + if x, ok := x.GetStep().(*PipelineStep_Encode); ok { + return x.Encode + } + return nil +} + +func (x *PipelineStep) GetDecode() *steps.DecodeStep { + if x, ok := x.GetStep().(*PipelineStep_Decode); ok { + return x.Decode + } + return nil +} + +func (x *PipelineStep) GetCustom() *steps.CustomStep { + if x, ok := x.GetStep().(*PipelineStep_Custom); ok { + return x.Custom + } + return nil +} + +func (x *PipelineStep) GetHttpRequest() *steps.HttpRequestStep { + if x, ok := x.GetStep().(*PipelineStep_HttpRequest); ok { + return x.HttpRequest + } + return nil +} + +func (x *PipelineStep) GetKv() *steps.KVStep { + if x, ok := x.GetStep().(*PipelineStep_Kv); ok { + return x.Kv + } + return nil +} + +func (x *PipelineStep) GetInferSchema() *steps.InferSchemaStep { + if x, ok := x.GetStep().(*PipelineStep_InferSchema); ok { + return x.InferSchema + } + return nil +} + +func (x *PipelineStep) GetValidJson() *steps.ValidJSONStep { + if x, ok := x.GetStep().(*PipelineStep_ValidJson); ok { + return x.ValidJson + } + return nil +} + +func (x *PipelineStep) GetSchemaValidation() *steps.SchemaValidationStep { + if x, ok := x.GetStep().(*PipelineStep_SchemaValidation); ok { + return x.SchemaValidation + } + return nil +} + +func (x *PipelineStep) GetXWasmId() string { + if x != nil && x.XWasmId != nil { + return *x.XWasmId + } + return "" +} + +func (x *PipelineStep) GetXWasmBytes() []byte { + if x != nil { + return x.XWasmBytes + } + return nil +} + +func (x *PipelineStep) GetXWasmFunction() string { + if x != nil && x.XWasmFunction != nil { + return *x.XWasmFunction + } + return "" +} + +type isPipelineStep_Step interface { + isPipelineStep_Step() +} + +type PipelineStep_Detective struct { + Detective *steps.DetectiveStep `protobuf:"bytes,1000,opt,name=detective,proto3,oneof"` +} + +type PipelineStep_Transform struct { + Transform *steps.TransformStep `protobuf:"bytes,1001,opt,name=transform,proto3,oneof"` +} + +type PipelineStep_Encode struct { + Encode *steps.EncodeStep `protobuf:"bytes,1002,opt,name=encode,proto3,oneof"` +} + +type PipelineStep_Decode struct { + Decode *steps.DecodeStep `protobuf:"bytes,1003,opt,name=decode,proto3,oneof"` +} + +type PipelineStep_Custom struct { + Custom *steps.CustomStep `protobuf:"bytes,1004,opt,name=custom,proto3,oneof"` +} + +type PipelineStep_HttpRequest struct { + HttpRequest *steps.HttpRequestStep `protobuf:"bytes,1005,opt,name=http_request,json=httpRequest,proto3,oneof"` +} + +type PipelineStep_Kv struct { + Kv *steps.KVStep `protobuf:"bytes,1006,opt,name=kv,proto3,oneof"` +} + +type PipelineStep_InferSchema struct { + InferSchema *steps.InferSchemaStep `protobuf:"bytes,1007,opt,name=infer_schema,json=inferSchema,proto3,oneof"` +} + +type PipelineStep_ValidJson struct { + ValidJson *steps.ValidJSONStep `protobuf:"bytes,1008,opt,name=valid_json,json=validJson,proto3,oneof"` +} + +type PipelineStep_SchemaValidation struct { + SchemaValidation *steps.SchemaValidationStep `protobuf:"bytes,1009,opt,name=schema_validation,json=schemaValidation,proto3,oneof"` +} + +func (*PipelineStep_Detective) isPipelineStep_Step() {} + +func (*PipelineStep_Transform) isPipelineStep_Step() {} + +func (*PipelineStep_Encode) isPipelineStep_Step() {} + +func (*PipelineStep_Decode) isPipelineStep_Step() {} + +func (*PipelineStep_Custom) isPipelineStep_Step() {} + +func (*PipelineStep_HttpRequest) isPipelineStep_Step() {} + +func (*PipelineStep_Kv) isPipelineStep_Step() {} + +func (*PipelineStep_InferSchema) isPipelineStep_Step() {} + +func (*PipelineStep_ValidJson) isPipelineStep_Step() {} + +func (*PipelineStep_SchemaValidation) isPipelineStep_Step() {} + +// PipelineConfigs is stored encoded in redis:streamdal_audience:$audStr; it is +// also used in external.GetAllResponse:config. +type PipelineConfigs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Configs []*PipelineConfig `protobuf:"bytes,1,rep,name=configs,proto3" json:"configs,omitempty"` + // !!!!!!!! IMPORTANT !!!!!!!!!! + // + // For internal use only in server. We need this because marshalling/encoding + // an empty protobuf results in nil. If someone does a SetPipelines() with + // empty pipeline IDs - we will set this, so that the encoded protobuf gets + // written as the actual object and not nil. + XIsEmpty *bool `protobuf:"varint,1000,opt,name=_is_empty,json=IsEmpty,proto3,oneof" json:"_is_empty,omitempty"` // protolint:disable:this FIELD_NAMES_LOWER_SNAKE_CASE +} + +func (x *PipelineConfigs) Reset() { + *x = PipelineConfigs{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_pipeline_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PipelineConfigs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PipelineConfigs) ProtoMessage() {} + +func (x *PipelineConfigs) ProtoReflect() protoreflect.Message { + mi := &file_sp_pipeline_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PipelineConfigs.ProtoReflect.Descriptor instead. +func (*PipelineConfigs) Descriptor() ([]byte, []int) { + return file_sp_pipeline_proto_rawDescGZIP(), []int{4} +} + +func (x *PipelineConfigs) GetConfigs() []*PipelineConfig { + if x != nil { + return x.Configs + } + return nil +} + +func (x *PipelineConfigs) GetXIsEmpty() bool { + if x != nil && x.XIsEmpty != nil { + return *x.XIsEmpty + } + return false +} + +// PipelineConfig is structure used in protos.PipelineConfigs +type PipelineConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Paused bool `protobuf:"varint,2,opt,name=paused,proto3" json:"paused,omitempty"` + CreatedAtUnixTsUtc int64 `protobuf:"varint,3,opt,name=created_at_unix_ts_utc,json=createdAtUnixTsUtc,proto3" json:"created_at_unix_ts_utc,omitempty"` +} + +func (x *PipelineConfig) Reset() { + *x = PipelineConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_pipeline_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PipelineConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PipelineConfig) ProtoMessage() {} + +func (x *PipelineConfig) ProtoReflect() protoreflect.Message { + mi := &file_sp_pipeline_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PipelineConfig.ProtoReflect.Descriptor instead. +func (*PipelineConfig) Descriptor() ([]byte, []int) { + return file_sp_pipeline_proto_rawDescGZIP(), []int{5} +} + +func (x *PipelineConfig) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *PipelineConfig) GetPaused() bool { + if x != nil { + return x.Paused + } + return false +} + +func (x *PipelineConfig) GetCreatedAtUnixTsUtc() int64 { + if x != nil { + return x.CreatedAtUnixTsUtc + } + return 0 +} + +var File_sp_pipeline_proto protoreflect.FileDescriptor + +var file_sp_pipeline_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x73, 0x70, 0x5f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x1a, 0x0f, 0x73, 0x70, 0x5f, + 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x73, 0x74, + 0x65, 0x70, 0x73, 0x2f, 0x73, 0x70, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x73, 0x5f, 0x63, 0x75, 0x73, + 0x74, 0x6f, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x73, 0x74, 0x65, 0x70, 0x73, + 0x2f, 0x73, 0x70, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x73, 0x5f, 0x64, 0x65, 0x63, 0x6f, 0x64, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2f, 0x73, 0x70, + 0x5f, 0x73, 0x74, 0x65, 0x70, 0x73, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2f, 0x73, 0x70, + 0x5f, 0x73, 0x74, 0x65, 0x70, 0x73, 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2f, 0x73, 0x70, 0x5f, 0x73, 0x74, + 0x65, 0x70, 0x73, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2f, 0x73, 0x70, 0x5f, + 0x73, 0x74, 0x65, 0x70, 0x73, 0x5f, 0x69, 0x6e, 0x66, 0x65, 0x72, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2f, 0x73, + 0x70, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x73, 0x5f, 0x6b, 0x76, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x26, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2f, 0x73, 0x70, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x73, + 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2f, + 0x73, 0x70, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x73, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, + 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2f, + 0x73, 0x70, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x5f, 0x6a, + 0x73, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd9, 0x01, 0x0a, 0x08, 0x50, 0x69, + 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x73, 0x74, + 0x65, 0x70, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x65, 0x70, 0x52, + 0x05, 0x73, 0x74, 0x65, 0x70, 0x73, 0x12, 0x52, 0x0a, 0x15, 0x5f, 0x6e, 0x6f, 0x74, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, + 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x4e, + 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x42, 0x02, 0x18, 0x01, 0x52, 0x13, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x1d, 0x0a, 0x07, 0x5f, 0x70, + 0x61, 0x75, 0x73, 0x65, 0x64, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x06, + 0x50, 0x61, 0x75, 0x73, 0x65, 0x64, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x58, 0x5f, 0x70, + 0x61, 0x75, 0x73, 0x65, 0x64, 0x22, 0xaf, 0x02, 0x0a, 0x16, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, + 0x6e, 0x65, 0x53, 0x74, 0x65, 0x70, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x2c, 0x0a, 0x05, 0x61, 0x62, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x62, 0x6f, 0x72, 0x74, 0x43, 0x6f, + 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x61, 0x62, 0x6f, 0x72, 0x74, 0x12, 0x1a, + 0x0a, 0x06, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x42, 0x02, + 0x18, 0x01, 0x52, 0x06, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x12, 0x48, 0x0a, 0x08, 0x6d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74, + 0x65, 0x70, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x12, 0x44, 0x0a, 0x0c, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x65, 0x70, + 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x6e, 0x6f, + 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xb8, 0x02, 0x0a, 0x18, 0x50, 0x69, 0x70, 0x65, + 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x65, 0x70, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x36, 0x0a, 0x17, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x69, 0x64, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x15, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x49, 0x64, 0x73, 0x12, 0x4f, 0x0a, 0x0c, + 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x50, 0x69, 0x70, 0x65, + 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x65, 0x70, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x79, 0x70, 0x65, + 0x52, 0x0b, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x70, 0x61, + 0x74, 0x68, 0x73, 0x22, 0x7d, 0x0a, 0x0b, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x50, 0x41, 0x59, 0x4c, 0x4f, 0x41, 0x44, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x45, 0x54, 0x10, 0x00, 0x12, 0x18, 0x0a, 0x14, 0x50, 0x41, + 0x59, 0x4c, 0x4f, 0x41, 0x44, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x43, 0x4c, 0x55, + 0x44, 0x45, 0x10, 0x01, 0x12, 0x1d, 0x0a, 0x19, 0x50, 0x41, 0x59, 0x4c, 0x4f, 0x41, 0x44, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x55, 0x4c, 0x4c, 0x5f, 0x50, 0x41, 0x59, 0x4c, 0x4f, 0x41, + 0x44, 0x10, 0x02, 0x12, 0x1d, 0x0a, 0x19, 0x50, 0x41, 0x59, 0x4c, 0x4f, 0x41, 0x44, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x53, 0x45, 0x4c, 0x45, 0x43, 0x54, 0x5f, 0x50, 0x41, 0x54, 0x48, 0x53, + 0x10, 0x03, 0x22, 0xf6, 0x07, 0x0a, 0x0c, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x53, + 0x74, 0x65, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x6f, 0x6e, 0x5f, 0x74, 0x72, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x65, 0x70, 0x43, 0x6f, + 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x06, 0x6f, 0x6e, 0x54, 0x72, 0x75, 0x65, + 0x12, 0x39, 0x0a, 0x08, 0x6f, 0x6e, 0x5f, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x50, 0x69, 0x70, 0x65, + 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x65, 0x70, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x6e, 0x46, 0x61, 0x6c, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x64, + 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x64, 0x79, + 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x12, 0x39, 0x0a, 0x08, 0x6f, 0x6e, 0x5f, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x65, 0x70, 0x43, 0x6f, 0x6e, + 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, + 0x12, 0x3c, 0x0a, 0x09, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0xe8, 0x07, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, + 0x65, 0x70, 0x73, 0x2e, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x53, 0x74, 0x65, + 0x70, 0x48, 0x00, 0x52, 0x09, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x3c, + 0x0a, 0x09, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0xe9, 0x07, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, + 0x73, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x74, 0x65, 0x70, 0x48, + 0x00, 0x52, 0x09, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x33, 0x0a, 0x06, + 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x18, 0xea, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2e, 0x45, 0x6e, 0x63, + 0x6f, 0x64, 0x65, 0x53, 0x74, 0x65, 0x70, 0x48, 0x00, 0x52, 0x06, 0x65, 0x6e, 0x63, 0x6f, 0x64, + 0x65, 0x12, 0x33, 0x0a, 0x06, 0x64, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x18, 0xeb, 0x07, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, + 0x73, 0x2e, 0x44, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x65, 0x70, 0x48, 0x00, 0x52, 0x06, + 0x64, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, + 0x18, 0xec, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x53, 0x74, 0x65, + 0x70, 0x48, 0x00, 0x52, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x12, 0x43, 0x0a, 0x0c, 0x68, + 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0xed, 0x07, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, + 0x73, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x53, 0x74, 0x65, + 0x70, 0x48, 0x00, 0x52, 0x0b, 0x68, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x27, 0x0a, 0x02, 0x6b, 0x76, 0x18, 0xee, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2e, 0x4b, 0x56, 0x53, + 0x74, 0x65, 0x70, 0x48, 0x00, 0x52, 0x02, 0x6b, 0x76, 0x12, 0x43, 0x0a, 0x0c, 0x69, 0x6e, 0x66, + 0x65, 0x72, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0xef, 0x07, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2e, + 0x49, 0x6e, 0x66, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x53, 0x74, 0x65, 0x70, 0x48, + 0x00, 0x52, 0x0b, 0x69, 0x6e, 0x66, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x3d, + 0x0a, 0x0a, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x18, 0xf0, 0x07, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, + 0x70, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x74, 0x65, 0x70, + 0x48, 0x00, 0x52, 0x09, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x4a, 0x73, 0x6f, 0x6e, 0x12, 0x52, 0x0a, + 0x11, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0xf1, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x56, + 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x65, 0x70, 0x48, 0x00, 0x52, + 0x10, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x1e, 0x0a, 0x08, 0x5f, 0x77, 0x61, 0x73, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x90, 0x4e, + 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x06, 0x57, 0x61, 0x73, 0x6d, 0x49, 0x64, 0x88, 0x01, + 0x01, 0x12, 0x24, 0x0a, 0x0b, 0x5f, 0x77, 0x61, 0x73, 0x6d, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, + 0x18, 0x91, 0x4e, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x02, 0x52, 0x09, 0x57, 0x61, 0x73, 0x6d, 0x42, + 0x79, 0x74, 0x65, 0x73, 0x88, 0x01, 0x01, 0x12, 0x2a, 0x0a, 0x0e, 0x5f, 0x77, 0x61, 0x73, 0x6d, + 0x5f, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x92, 0x4e, 0x20, 0x01, 0x28, 0x09, + 0x48, 0x03, 0x52, 0x0c, 0x57, 0x61, 0x73, 0x6d, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x88, 0x01, 0x01, 0x42, 0x06, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x42, 0x0b, 0x0a, 0x09, 0x58, + 0x5f, 0x77, 0x61, 0x73, 0x6d, 0x5f, 0x69, 0x64, 0x42, 0x0e, 0x0a, 0x0c, 0x58, 0x5f, 0x77, 0x61, + 0x73, 0x6d, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x42, 0x11, 0x0a, 0x0f, 0x58, 0x5f, 0x77, 0x61, + 0x73, 0x6d, 0x5f, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x73, 0x0a, 0x0f, 0x50, + 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x30, + 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, + 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, + 0x12, 0x20, 0x0a, 0x09, 0x5f, 0x69, 0x73, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0xe8, 0x07, + 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x07, 0x49, 0x73, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x88, + 0x01, 0x01, 0x42, 0x0c, 0x0a, 0x0a, 0x58, 0x5f, 0x69, 0x73, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, + 0x22, 0x6c, 0x0a, 0x0e, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x75, 0x73, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x06, 0x70, 0x61, 0x75, 0x73, 0x65, 0x64, 0x12, 0x32, 0x0a, 0x16, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x5f, 0x75, 0x6e, 0x69, 0x78, 0x5f, 0x74, 0x73, + 0x5f, 0x75, 0x74, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x12, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x64, 0x41, 0x74, 0x55, 0x6e, 0x69, 0x78, 0x54, 0x73, 0x55, 0x74, 0x63, 0x2a, 0x6d, + 0x0a, 0x0e, 0x41, 0x62, 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x19, 0x0a, 0x15, 0x41, 0x42, 0x4f, 0x52, 0x54, 0x5f, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, + 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x45, 0x54, 0x10, 0x00, 0x12, 0x21, 0x0a, 0x1d, 0x41, + 0x42, 0x4f, 0x52, 0x54, 0x5f, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, + 0x42, 0x4f, 0x52, 0x54, 0x5f, 0x43, 0x55, 0x52, 0x52, 0x45, 0x4e, 0x54, 0x10, 0x01, 0x12, 0x1d, + 0x0a, 0x19, 0x41, 0x42, 0x4f, 0x52, 0x54, 0x5f, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, + 0x4e, 0x5f, 0x41, 0x42, 0x4f, 0x52, 0x54, 0x5f, 0x41, 0x4c, 0x4c, 0x10, 0x02, 0x42, 0x3c, 0x5a, + 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, + 0x6c, 0x69, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, + 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_sp_pipeline_proto_rawDescOnce sync.Once + file_sp_pipeline_proto_rawDescData = file_sp_pipeline_proto_rawDesc +) + +func file_sp_pipeline_proto_rawDescGZIP() []byte { + file_sp_pipeline_proto_rawDescOnce.Do(func() { + file_sp_pipeline_proto_rawDescData = protoimpl.X.CompressGZIP(file_sp_pipeline_proto_rawDescData) + }) + return file_sp_pipeline_proto_rawDescData +} + +var file_sp_pipeline_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_sp_pipeline_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_sp_pipeline_proto_goTypes = []interface{}{ + (AbortCondition)(0), // 0: protos.AbortCondition + (PipelineStepNotification_PayloadType)(0), // 1: protos.PipelineStepNotification.PayloadType + (*Pipeline)(nil), // 2: protos.Pipeline + (*PipelineStepConditions)(nil), // 3: protos.PipelineStepConditions + (*PipelineStepNotification)(nil), // 4: protos.PipelineStepNotification + (*PipelineStep)(nil), // 5: protos.PipelineStep + (*PipelineConfigs)(nil), // 6: protos.PipelineConfigs + (*PipelineConfig)(nil), // 7: protos.PipelineConfig + nil, // 8: protos.PipelineStepConditions.MetadataEntry + (*NotificationConfig)(nil), // 9: protos.NotificationConfig + (*steps.DetectiveStep)(nil), // 10: protos.steps.DetectiveStep + (*steps.TransformStep)(nil), // 11: protos.steps.TransformStep + (*steps.EncodeStep)(nil), // 12: protos.steps.EncodeStep + (*steps.DecodeStep)(nil), // 13: protos.steps.DecodeStep + (*steps.CustomStep)(nil), // 14: protos.steps.CustomStep + (*steps.HttpRequestStep)(nil), // 15: protos.steps.HttpRequestStep + (*steps.KVStep)(nil), // 16: protos.steps.KVStep + (*steps.InferSchemaStep)(nil), // 17: protos.steps.InferSchemaStep + (*steps.ValidJSONStep)(nil), // 18: protos.steps.ValidJSONStep + (*steps.SchemaValidationStep)(nil), // 19: protos.steps.SchemaValidationStep +} +var file_sp_pipeline_proto_depIdxs = []int32{ + 5, // 0: protos.Pipeline.steps:type_name -> protos.PipelineStep + 9, // 1: protos.Pipeline._notification_configs:type_name -> protos.NotificationConfig + 0, // 2: protos.PipelineStepConditions.abort:type_name -> protos.AbortCondition + 8, // 3: protos.PipelineStepConditions.metadata:type_name -> protos.PipelineStepConditions.MetadataEntry + 4, // 4: protos.PipelineStepConditions.notification:type_name -> protos.PipelineStepNotification + 1, // 5: protos.PipelineStepNotification.payload_type:type_name -> protos.PipelineStepNotification.PayloadType + 3, // 6: protos.PipelineStep.on_true:type_name -> protos.PipelineStepConditions + 3, // 7: protos.PipelineStep.on_false:type_name -> protos.PipelineStepConditions + 3, // 8: protos.PipelineStep.on_error:type_name -> protos.PipelineStepConditions + 10, // 9: protos.PipelineStep.detective:type_name -> protos.steps.DetectiveStep + 11, // 10: protos.PipelineStep.transform:type_name -> protos.steps.TransformStep + 12, // 11: protos.PipelineStep.encode:type_name -> protos.steps.EncodeStep + 13, // 12: protos.PipelineStep.decode:type_name -> protos.steps.DecodeStep + 14, // 13: protos.PipelineStep.custom:type_name -> protos.steps.CustomStep + 15, // 14: protos.PipelineStep.http_request:type_name -> protos.steps.HttpRequestStep + 16, // 15: protos.PipelineStep.kv:type_name -> protos.steps.KVStep + 17, // 16: protos.PipelineStep.infer_schema:type_name -> protos.steps.InferSchemaStep + 18, // 17: protos.PipelineStep.valid_json:type_name -> protos.steps.ValidJSONStep + 19, // 18: protos.PipelineStep.schema_validation:type_name -> protos.steps.SchemaValidationStep + 7, // 19: protos.PipelineConfigs.configs:type_name -> protos.PipelineConfig + 20, // [20:20] is the sub-list for method output_type + 20, // [20:20] is the sub-list for method input_type + 20, // [20:20] is the sub-list for extension type_name + 20, // [20:20] is the sub-list for extension extendee + 0, // [0:20] is the sub-list for field type_name +} + +func init() { file_sp_pipeline_proto_init() } +func file_sp_pipeline_proto_init() { + if File_sp_pipeline_proto != nil { + return + } + file_sp_notify_proto_init() + if !protoimpl.UnsafeEnabled { + file_sp_pipeline_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Pipeline); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_pipeline_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PipelineStepConditions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_pipeline_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PipelineStepNotification); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_pipeline_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PipelineStep); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_pipeline_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PipelineConfigs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_pipeline_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PipelineConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_sp_pipeline_proto_msgTypes[0].OneofWrappers = []interface{}{} + file_sp_pipeline_proto_msgTypes[3].OneofWrappers = []interface{}{ + (*PipelineStep_Detective)(nil), + (*PipelineStep_Transform)(nil), + (*PipelineStep_Encode)(nil), + (*PipelineStep_Decode)(nil), + (*PipelineStep_Custom)(nil), + (*PipelineStep_HttpRequest)(nil), + (*PipelineStep_Kv)(nil), + (*PipelineStep_InferSchema)(nil), + (*PipelineStep_ValidJson)(nil), + (*PipelineStep_SchemaValidation)(nil), + } + file_sp_pipeline_proto_msgTypes[4].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_sp_pipeline_proto_rawDesc, + NumEnums: 2, + NumMessages: 7, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_sp_pipeline_proto_goTypes, + DependencyIndexes: file_sp_pipeline_proto_depIdxs, + EnumInfos: file_sp_pipeline_proto_enumTypes, + MessageInfos: file_sp_pipeline_proto_msgTypes, + }.Build() + File_sp_pipeline_proto = out.File + file_sp_pipeline_proto_rawDesc = nil + file_sp_pipeline_proto_goTypes = nil + file_sp_pipeline_proto_depIdxs = nil +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_sdk.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_sdk.pb.go new file mode 100644 index 000000000..b7bccd388 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_sdk.pb.go @@ -0,0 +1,479 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: sp_sdk.proto + +package protos + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ExecStatus int32 + +const ( + // Unset status. This should never be returned by the SDK. If it does, it is + // probably a bug (and you should file an issue) + ExecStatus_EXEC_STATUS_UNSET ExecStatus = 0 + // Indicates that the step execution evaluated to "true" + ExecStatus_EXEC_STATUS_TRUE ExecStatus = 1 + // Indicates that the step execution evaluated to "false" + ExecStatus_EXEC_STATUS_FALSE ExecStatus = 2 + // Indicates that the SDK encountered an error while trying to process the + // request. Example error cases: SDK can't find the appropriate Wasm module, + // Wasm function cannot alloc or dealloc memory, etc. + ExecStatus_EXEC_STATUS_ERROR ExecStatus = 3 +) + +// Enum value maps for ExecStatus. +var ( + ExecStatus_name = map[int32]string{ + 0: "EXEC_STATUS_UNSET", + 1: "EXEC_STATUS_TRUE", + 2: "EXEC_STATUS_FALSE", + 3: "EXEC_STATUS_ERROR", + } + ExecStatus_value = map[string]int32{ + "EXEC_STATUS_UNSET": 0, + "EXEC_STATUS_TRUE": 1, + "EXEC_STATUS_FALSE": 2, + "EXEC_STATUS_ERROR": 3, + } +) + +func (x ExecStatus) Enum() *ExecStatus { + p := new(ExecStatus) + *p = x + return p +} + +func (x ExecStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ExecStatus) Descriptor() protoreflect.EnumDescriptor { + return file_sp_sdk_proto_enumTypes[0].Descriptor() +} + +func (ExecStatus) Type() protoreflect.EnumType { + return &file_sp_sdk_proto_enumTypes[0] +} + +func (x ExecStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ExecStatus.Descriptor instead. +func (ExecStatus) EnumDescriptor() ([]byte, []int) { + return file_sp_sdk_proto_rawDescGZIP(), []int{0} +} + +// Common return response used by all SDKs +type SDKResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Contains (potentially) modified input data + Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + // Execution status of the last step + Status ExecStatus `protobuf:"varint,2,opt,name=status,proto3,enum=protos.ExecStatus" json:"status,omitempty"` + // Optional message accompanying the exec status for the last step + StatusMessage *string `protobuf:"bytes,3,opt,name=status_message,json=statusMessage,proto3,oneof" json:"status_message,omitempty"` + // An array of pipelines that the SDK executed and the status of each step + PipelineStatus []*PipelineStatus `protobuf:"bytes,4,rep,name=pipeline_status,json=pipelineStatus,proto3" json:"pipeline_status,omitempty"` + // Includes any metadata that the step(s) may want to pass back to the user. + // + // NOTE: Metadata is aggregated across all steps in the pipeline, so if two + // steps both set a key "foo" to different values, the value of "foo" in the + // response will be the value set by the last step in the pipeline. + // + // To learn more about "metadata", see SDK Spec V2 doc "Pipeline Step & Error + // Behavior" section. + Metadata map[string]string `protobuf:"bytes,5,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *SDKResponse) Reset() { + *x = SDKResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_sdk_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SDKResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SDKResponse) ProtoMessage() {} + +func (x *SDKResponse) ProtoReflect() protoreflect.Message { + mi := &file_sp_sdk_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SDKResponse.ProtoReflect.Descriptor instead. +func (*SDKResponse) Descriptor() ([]byte, []int) { + return file_sp_sdk_proto_rawDescGZIP(), []int{0} +} + +func (x *SDKResponse) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +func (x *SDKResponse) GetStatus() ExecStatus { + if x != nil { + return x.Status + } + return ExecStatus_EXEC_STATUS_UNSET +} + +func (x *SDKResponse) GetStatusMessage() string { + if x != nil && x.StatusMessage != nil { + return *x.StatusMessage + } + return "" +} + +func (x *SDKResponse) GetPipelineStatus() []*PipelineStatus { + if x != nil { + return x.PipelineStatus + } + return nil +} + +func (x *SDKResponse) GetMetadata() map[string]string { + if x != nil { + return x.Metadata + } + return nil +} + +type PipelineStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // ID of the pipeline + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // The name of the pipeline + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The status of each step in the pipeline + StepStatus []*StepStatus `protobuf:"bytes,3,rep,name=step_status,json=stepStatus,proto3" json:"step_status,omitempty"` +} + +func (x *PipelineStatus) Reset() { + *x = PipelineStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_sdk_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PipelineStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PipelineStatus) ProtoMessage() {} + +func (x *PipelineStatus) ProtoReflect() protoreflect.Message { + mi := &file_sp_sdk_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PipelineStatus.ProtoReflect.Descriptor instead. +func (*PipelineStatus) Descriptor() ([]byte, []int) { + return file_sp_sdk_proto_rawDescGZIP(), []int{1} +} + +func (x *PipelineStatus) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *PipelineStatus) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *PipelineStatus) GetStepStatus() []*StepStatus { + if x != nil { + return x.StepStatus + } + return nil +} + +type StepStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the step + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Execution outcome status of the step + Status ExecStatus `protobuf:"varint,2,opt,name=status,proto3,enum=protos.ExecStatus" json:"status,omitempty"` + // Optional message accompanying the exec status + StatusMessage *string `protobuf:"bytes,3,opt,name=status_message,json=statusMessage,proto3,oneof" json:"status_message,omitempty"` + // Indicates if current or all future pipelines were aborted. + // + // IMPORTANT: The SDK running into an error does not automatically abort + // current or all future pipelines - the user must define the abort conditions + // for "on_error". + AbortCondition AbortCondition `protobuf:"varint,4,opt,name=abort_condition,json=abortCondition,proto3,enum=protos.AbortCondition" json:"abort_condition,omitempty"` +} + +func (x *StepStatus) Reset() { + *x = StepStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_sdk_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StepStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StepStatus) ProtoMessage() {} + +func (x *StepStatus) ProtoReflect() protoreflect.Message { + mi := &file_sp_sdk_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StepStatus.ProtoReflect.Descriptor instead. +func (*StepStatus) Descriptor() ([]byte, []int) { + return file_sp_sdk_proto_rawDescGZIP(), []int{2} +} + +func (x *StepStatus) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *StepStatus) GetStatus() ExecStatus { + if x != nil { + return x.Status + } + return ExecStatus_EXEC_STATUS_UNSET +} + +func (x *StepStatus) GetStatusMessage() string { + if x != nil && x.StatusMessage != nil { + return *x.StatusMessage + } + return "" +} + +func (x *StepStatus) GetAbortCondition() AbortCondition { + if x != nil { + return x.AbortCondition + } + return AbortCondition_ABORT_CONDITION_UNSET +} + +var File_sp_sdk_proto protoreflect.FileDescriptor + +var file_sp_sdk_proto_rawDesc = []byte{ + 0x0a, 0x0c, 0x73, 0x70, 0x5f, 0x73, 0x64, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x1a, 0x11, 0x73, 0x70, 0x5f, 0x70, 0x69, 0x70, 0x65, 0x6c, + 0x69, 0x6e, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc9, 0x02, 0x0a, 0x0b, 0x53, 0x44, + 0x4b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2a, 0x0a, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, 0x0a, 0x0e, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x00, 0x52, 0x0d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x88, 0x01, 0x01, 0x12, 0x3f, 0x0a, 0x0f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, + 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0e, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x3d, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x53, 0x44, 0x4b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, + 0x38, 0x01, 0x42, 0x11, 0x0a, 0x0f, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x69, 0x0a, 0x0e, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, + 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x33, 0x0a, 0x0b, 0x73, + 0x74, 0x65, 0x70, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x65, 0x70, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x52, 0x0a, 0x73, 0x74, 0x65, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x22, 0xcc, 0x01, 0x0a, 0x0a, 0x53, 0x74, 0x65, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x45, 0x78, 0x65, + 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, + 0x2a, 0x0a, 0x0e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0d, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x12, 0x3f, 0x0a, 0x0f, 0x61, + 0x62, 0x6f, 0x72, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x62, + 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x61, 0x62, + 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x11, 0x0a, 0x0f, + 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2a, + 0x67, 0x0a, 0x0a, 0x45, 0x78, 0x65, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x15, 0x0a, + 0x11, 0x45, 0x58, 0x45, 0x43, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, + 0x45, 0x54, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x45, 0x58, 0x45, 0x43, 0x5f, 0x53, 0x54, 0x41, + 0x54, 0x55, 0x53, 0x5f, 0x54, 0x52, 0x55, 0x45, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x45, 0x58, + 0x45, 0x43, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x46, 0x41, 0x4c, 0x53, 0x45, 0x10, + 0x02, 0x12, 0x15, 0x0a, 0x11, 0x45, 0x58, 0x45, 0x43, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, + 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, + 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x6c, 0x69, 0x62, 0x73, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_sp_sdk_proto_rawDescOnce sync.Once + file_sp_sdk_proto_rawDescData = file_sp_sdk_proto_rawDesc +) + +func file_sp_sdk_proto_rawDescGZIP() []byte { + file_sp_sdk_proto_rawDescOnce.Do(func() { + file_sp_sdk_proto_rawDescData = protoimpl.X.CompressGZIP(file_sp_sdk_proto_rawDescData) + }) + return file_sp_sdk_proto_rawDescData +} + +var file_sp_sdk_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_sp_sdk_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_sp_sdk_proto_goTypes = []interface{}{ + (ExecStatus)(0), // 0: protos.ExecStatus + (*SDKResponse)(nil), // 1: protos.SDKResponse + (*PipelineStatus)(nil), // 2: protos.PipelineStatus + (*StepStatus)(nil), // 3: protos.StepStatus + nil, // 4: protos.SDKResponse.MetadataEntry + (AbortCondition)(0), // 5: protos.AbortCondition +} +var file_sp_sdk_proto_depIdxs = []int32{ + 0, // 0: protos.SDKResponse.status:type_name -> protos.ExecStatus + 2, // 1: protos.SDKResponse.pipeline_status:type_name -> protos.PipelineStatus + 4, // 2: protos.SDKResponse.metadata:type_name -> protos.SDKResponse.MetadataEntry + 3, // 3: protos.PipelineStatus.step_status:type_name -> protos.StepStatus + 0, // 4: protos.StepStatus.status:type_name -> protos.ExecStatus + 5, // 5: protos.StepStatus.abort_condition:type_name -> protos.AbortCondition + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_sp_sdk_proto_init() } +func file_sp_sdk_proto_init() { + if File_sp_sdk_proto != nil { + return + } + file_sp_pipeline_proto_init() + if !protoimpl.UnsafeEnabled { + file_sp_sdk_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SDKResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_sdk_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PipelineStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_sdk_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StepStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_sp_sdk_proto_msgTypes[0].OneofWrappers = []interface{}{} + file_sp_sdk_proto_msgTypes[2].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_sp_sdk_proto_rawDesc, + NumEnums: 1, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_sp_sdk_proto_goTypes, + DependencyIndexes: file_sp_sdk_proto_depIdxs, + EnumInfos: file_sp_sdk_proto_enumTypes, + MessageInfos: file_sp_sdk_proto_msgTypes, + }.Build() + File_sp_sdk_proto = out.File + file_sp_sdk_proto_rawDesc = nil + file_sp_sdk_proto_goTypes = nil + file_sp_sdk_proto_depIdxs = nil +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_wsm.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_wsm.pb.go new file mode 100644 index 000000000..fd8f81bc5 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/sp_wsm.pb.go @@ -0,0 +1,498 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: sp_wsm.proto + +package protos + +import ( + steps "github.com/streamdal/streamdal/libs/protos/build/go/protos/steps" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Included in Wasm response; the SDK should use the WASMExitCode to determine +// what to do next - should it execute next step, should it notify or should it +// stop execution/abort the rest of the steps in current or all pipelines. +// +// Example: +// +// a. Wasm func returns WASM_EXIT_CODE_FALSE - read PipelineStep.on_false +// conditions to determine what to do next. +// +// b. Wasm func returns WASM_EXIT_CODE_TRUE - read PipelineStep.on_true +// conditions to determine what to do next. +// +// .. and so on. +// TODO: This might be a dupe - should Wasm use ExecStatus instead of this? +// protolint:disable:next ENUM_FIELD_NAMES_PREFIX +type WASMExitCode int32 + +const ( + WASMExitCode_WASM_EXIT_CODE_UNSET WASMExitCode = 0 + WASMExitCode_WASM_EXIT_CODE_TRUE WASMExitCode = 1 + WASMExitCode_WASM_EXIT_CODE_FALSE WASMExitCode = 2 + WASMExitCode_WASM_EXIT_CODE_ERROR WASMExitCode = 3 +) + +// Enum value maps for WASMExitCode. +var ( + WASMExitCode_name = map[int32]string{ + 0: "WASM_EXIT_CODE_UNSET", + 1: "WASM_EXIT_CODE_TRUE", + 2: "WASM_EXIT_CODE_FALSE", + 3: "WASM_EXIT_CODE_ERROR", + } + WASMExitCode_value = map[string]int32{ + "WASM_EXIT_CODE_UNSET": 0, + "WASM_EXIT_CODE_TRUE": 1, + "WASM_EXIT_CODE_FALSE": 2, + "WASM_EXIT_CODE_ERROR": 3, + } +) + +func (x WASMExitCode) Enum() *WASMExitCode { + p := new(WASMExitCode) + *p = x + return p +} + +func (x WASMExitCode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (WASMExitCode) Descriptor() protoreflect.EnumDescriptor { + return file_sp_wsm_proto_enumTypes[0].Descriptor() +} + +func (WASMExitCode) Type() protoreflect.EnumType { + return &file_sp_wsm_proto_enumTypes[0] +} + +func (x WASMExitCode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use WASMExitCode.Descriptor instead. +func (WASMExitCode) EnumDescriptor() ([]byte, []int) { + return file_sp_wsm_proto_rawDescGZIP(), []int{0} +} + +// SDK generates a WASM request and passes this to the WASM func +type WASMRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The actual step that the WASM func will operate on. This is the same step + // that is declared in protos.Pipeline. + Step *PipelineStep `protobuf:"bytes,1,opt,name=step,proto3" json:"step,omitempty"` + // Payload data that WASM func will operate on + InputPayload []byte `protobuf:"bytes,2,opt,name=input_payload,json=inputPayload,proto3" json:"input_payload,omitempty"` + // Potentially filled out result from previous step. If this is first step in + // the pipeline, it will be empty. + InputStep []byte `protobuf:"bytes,3,opt,name=input_step,json=inputStep,proto3,oneof" json:"input_step,omitempty"` + // Potential input from a previous step if `Step.Dynamic == true` + // This is used for communicating data between steps. + // For example, when trying to find email addresses in a payload and + // then passing on the results to a transform step to obfuscate them + InterStepResult *InterStepResult `protobuf:"bytes,4,opt,name=inter_step_result,json=interStepResult,proto3,oneof" json:"inter_step_result,omitempty"` +} + +func (x *WASMRequest) Reset() { + *x = WASMRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_wsm_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WASMRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WASMRequest) ProtoMessage() {} + +func (x *WASMRequest) ProtoReflect() protoreflect.Message { + mi := &file_sp_wsm_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WASMRequest.ProtoReflect.Descriptor instead. +func (*WASMRequest) Descriptor() ([]byte, []int) { + return file_sp_wsm_proto_rawDescGZIP(), []int{0} +} + +func (x *WASMRequest) GetStep() *PipelineStep { + if x != nil { + return x.Step + } + return nil +} + +func (x *WASMRequest) GetInputPayload() []byte { + if x != nil { + return x.InputPayload + } + return nil +} + +func (x *WASMRequest) GetInputStep() []byte { + if x != nil { + return x.InputStep + } + return nil +} + +func (x *WASMRequest) GetInterStepResult() *InterStepResult { + if x != nil { + return x.InterStepResult + } + return nil +} + +// Returned by all WASM functions +type WASMResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Potentially modified input payload. Concept: All WASM funcs accept an + // input_payload in WASMRequest, WASM func reads input payload, modifies it + // and writes the modified output to output_payload. + OutputPayload []byte `protobuf:"bytes,1,opt,name=output_payload,json=outputPayload,proto3" json:"output_payload,omitempty"` + // Exit code that the WASM func exited with; more info in WASMExitCode's comment + ExitCode WASMExitCode `protobuf:"varint,2,opt,name=exit_code,json=exitCode,proto3,enum=protos.WASMExitCode" json:"exit_code,omitempty"` + // Additional info about the reason a specific exit code was returned + ExitMsg string `protobuf:"bytes,3,opt,name=exit_msg,json=exitMsg,proto3" json:"exit_msg,omitempty"` + // Potential additional step output - ie. if a WASM func is an HTTPGet, + // output_step would contain the HTTP response body; if the WASM func is a + // KVGet, the output_step would be the value of the fetched key. + OutputStep []byte `protobuf:"bytes,4,opt,name=output_step,json=outputStep,proto3,oneof" json:"output_step,omitempty"` + // If `Step.Dynamic == true`, this field should be filled out by the WASM module + // This is used for communicating data between steps. + // For example, when trying to find email addresses in a payload and + // then passing on the results to a transform step to obfuscate them + InterStepResult *InterStepResult `protobuf:"bytes,5,opt,name=inter_step_result,json=interStepResult,proto3,oneof" json:"inter_step_result,omitempty"` +} + +func (x *WASMResponse) Reset() { + *x = WASMResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_wsm_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WASMResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WASMResponse) ProtoMessage() {} + +func (x *WASMResponse) ProtoReflect() protoreflect.Message { + mi := &file_sp_wsm_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WASMResponse.ProtoReflect.Descriptor instead. +func (*WASMResponse) Descriptor() ([]byte, []int) { + return file_sp_wsm_proto_rawDescGZIP(), []int{1} +} + +func (x *WASMResponse) GetOutputPayload() []byte { + if x != nil { + return x.OutputPayload + } + return nil +} + +func (x *WASMResponse) GetExitCode() WASMExitCode { + if x != nil { + return x.ExitCode + } + return WASMExitCode_WASM_EXIT_CODE_UNSET +} + +func (x *WASMResponse) GetExitMsg() string { + if x != nil { + return x.ExitMsg + } + return "" +} + +func (x *WASMResponse) GetOutputStep() []byte { + if x != nil { + return x.OutputStep + } + return nil +} + +func (x *WASMResponse) GetInterStepResult() *InterStepResult { + if x != nil { + return x.InterStepResult + } + return nil +} + +// Intended for communicating wasm results between steps. +// Currently only used for passing results from a Detective Step to a Transform step +type InterStepResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to InputFrom: + // + // *InterStepResult_DetectiveResult + InputFrom isInterStepResult_InputFrom `protobuf_oneof:"input_from"` +} + +func (x *InterStepResult) Reset() { + *x = InterStepResult{} + if protoimpl.UnsafeEnabled { + mi := &file_sp_wsm_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InterStepResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InterStepResult) ProtoMessage() {} + +func (x *InterStepResult) ProtoReflect() protoreflect.Message { + mi := &file_sp_wsm_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InterStepResult.ProtoReflect.Descriptor instead. +func (*InterStepResult) Descriptor() ([]byte, []int) { + return file_sp_wsm_proto_rawDescGZIP(), []int{2} +} + +func (m *InterStepResult) GetInputFrom() isInterStepResult_InputFrom { + if m != nil { + return m.InputFrom + } + return nil +} + +func (x *InterStepResult) GetDetectiveResult() *steps.DetectiveStepResult { + if x, ok := x.GetInputFrom().(*InterStepResult_DetectiveResult); ok { + return x.DetectiveResult + } + return nil +} + +type isInterStepResult_InputFrom interface { + isInterStepResult_InputFrom() +} + +type InterStepResult_DetectiveResult struct { + DetectiveResult *steps.DetectiveStepResult `protobuf:"bytes,1,opt,name=detective_result,json=detectiveResult,proto3,oneof"` +} + +func (*InterStepResult_DetectiveResult) isInterStepResult_InputFrom() {} + +var File_sp_wsm_proto protoreflect.FileDescriptor + +var file_sp_wsm_proto_rawDesc = []byte{ + 0x0a, 0x0c, 0x73, 0x70, 0x5f, 0x77, 0x73, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x1a, 0x11, 0x73, 0x70, 0x5f, 0x70, 0x69, 0x70, 0x65, 0x6c, + 0x69, 0x6e, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x73, 0x74, 0x65, 0x70, 0x73, + 0x2f, 0x73, 0x70, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x73, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, + 0x69, 0x76, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xef, 0x01, 0x0a, 0x0b, 0x57, 0x41, + 0x53, 0x4d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x73, 0x74, 0x65, + 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x65, 0x70, 0x52, 0x04, 0x73, + 0x74, 0x65, 0x70, 0x12, 0x23, 0x0a, 0x0d, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x70, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x69, 0x6e, 0x70, 0x75, + 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x22, 0x0a, 0x0a, 0x69, 0x6e, 0x70, 0x75, + 0x74, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x09, + 0x69, 0x6e, 0x70, 0x75, 0x74, 0x53, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x48, 0x0a, 0x11, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x53, 0x74, 0x65, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x48, 0x01, 0x52, 0x0f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x53, 0x74, 0x65, 0x70, 0x52, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x88, 0x01, 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, + 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x14, 0x0a, 0x12, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x5f, + 0x73, 0x74, 0x65, 0x70, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x99, 0x02, 0x0a, 0x0c, + 0x57, 0x41, 0x53, 0x4d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x0e, + 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x50, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x12, 0x31, 0x0a, 0x09, 0x65, 0x78, 0x69, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x57, 0x41, 0x53, 0x4d, 0x45, 0x78, 0x69, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x08, 0x65, 0x78, + 0x69, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x78, 0x69, 0x74, 0x5f, 0x6d, + 0x73, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x78, 0x69, 0x74, 0x4d, 0x73, + 0x67, 0x12, 0x24, 0x0a, 0x0b, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x73, 0x74, 0x65, 0x70, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x0a, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, + 0x53, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x48, 0x0a, 0x11, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x5f, 0x73, 0x74, 0x65, 0x70, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x65, + 0x72, 0x53, 0x74, 0x65, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x48, 0x01, 0x52, 0x0f, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x53, 0x74, 0x65, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x88, 0x01, + 0x01, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x73, 0x74, 0x65, + 0x70, 0x42, 0x14, 0x0a, 0x12, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x65, 0x70, + 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x6f, 0x0a, 0x0f, 0x49, 0x6e, 0x74, 0x65, 0x72, + 0x53, 0x74, 0x65, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x4e, 0x0a, 0x10, 0x64, 0x65, + 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, + 0x65, 0x70, 0x73, 0x2e, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x53, 0x74, 0x65, + 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x48, 0x00, 0x52, 0x0f, 0x64, 0x65, 0x74, 0x65, 0x63, + 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x0c, 0x0a, 0x0a, 0x69, 0x6e, + 0x70, 0x75, 0x74, 0x5f, 0x66, 0x72, 0x6f, 0x6d, 0x2a, 0x75, 0x0a, 0x0c, 0x57, 0x41, 0x53, 0x4d, + 0x45, 0x78, 0x69, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x14, 0x57, 0x41, 0x53, 0x4d, + 0x5f, 0x45, 0x58, 0x49, 0x54, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x45, 0x54, + 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x57, 0x41, 0x53, 0x4d, 0x5f, 0x45, 0x58, 0x49, 0x54, 0x5f, + 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x54, 0x52, 0x55, 0x45, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x57, + 0x41, 0x53, 0x4d, 0x5f, 0x45, 0x58, 0x49, 0x54, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x46, 0x41, + 0x4c, 0x53, 0x45, 0x10, 0x02, 0x12, 0x18, 0x0a, 0x14, 0x57, 0x41, 0x53, 0x4d, 0x5f, 0x45, 0x58, + 0x49, 0x54, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x42, + 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, + 0x6c, 0x2f, 0x6c, 0x69, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x62, 0x75, + 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_sp_wsm_proto_rawDescOnce sync.Once + file_sp_wsm_proto_rawDescData = file_sp_wsm_proto_rawDesc +) + +func file_sp_wsm_proto_rawDescGZIP() []byte { + file_sp_wsm_proto_rawDescOnce.Do(func() { + file_sp_wsm_proto_rawDescData = protoimpl.X.CompressGZIP(file_sp_wsm_proto_rawDescData) + }) + return file_sp_wsm_proto_rawDescData +} + +var file_sp_wsm_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_sp_wsm_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_sp_wsm_proto_goTypes = []interface{}{ + (WASMExitCode)(0), // 0: protos.WASMExitCode + (*WASMRequest)(nil), // 1: protos.WASMRequest + (*WASMResponse)(nil), // 2: protos.WASMResponse + (*InterStepResult)(nil), // 3: protos.InterStepResult + (*PipelineStep)(nil), // 4: protos.PipelineStep + (*steps.DetectiveStepResult)(nil), // 5: protos.steps.DetectiveStepResult +} +var file_sp_wsm_proto_depIdxs = []int32{ + 4, // 0: protos.WASMRequest.step:type_name -> protos.PipelineStep + 3, // 1: protos.WASMRequest.inter_step_result:type_name -> protos.InterStepResult + 0, // 2: protos.WASMResponse.exit_code:type_name -> protos.WASMExitCode + 3, // 3: protos.WASMResponse.inter_step_result:type_name -> protos.InterStepResult + 5, // 4: protos.InterStepResult.detective_result:type_name -> protos.steps.DetectiveStepResult + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_sp_wsm_proto_init() } +func file_sp_wsm_proto_init() { + if File_sp_wsm_proto != nil { + return + } + file_sp_pipeline_proto_init() + if !protoimpl.UnsafeEnabled { + file_sp_wsm_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WASMRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_wsm_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WASMResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sp_wsm_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InterStepResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_sp_wsm_proto_msgTypes[0].OneofWrappers = []interface{}{} + file_sp_wsm_proto_msgTypes[1].OneofWrappers = []interface{}{} + file_sp_wsm_proto_msgTypes[2].OneofWrappers = []interface{}{ + (*InterStepResult_DetectiveResult)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_sp_wsm_proto_rawDesc, + NumEnums: 1, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_sp_wsm_proto_goTypes, + DependencyIndexes: file_sp_wsm_proto_depIdxs, + EnumInfos: file_sp_wsm_proto_enumTypes, + MessageInfos: file_sp_wsm_proto_msgTypes, + }.Build() + File_sp_wsm_proto = out.File + file_sp_wsm_proto_rawDesc = nil + file_sp_wsm_proto_goTypes = nil + file_sp_wsm_proto_depIdxs = nil +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_custom.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_custom.pb.go new file mode 100644 index 000000000..7b6fb7375 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_custom.pb.go @@ -0,0 +1,147 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: steps/sp_steps_custom.proto + +package steps + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// WIP -- Custom WASM exec? +type CustomStep struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *CustomStep) Reset() { + *x = CustomStep{} + if protoimpl.UnsafeEnabled { + mi := &file_steps_sp_steps_custom_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CustomStep) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CustomStep) ProtoMessage() {} + +func (x *CustomStep) ProtoReflect() protoreflect.Message { + mi := &file_steps_sp_steps_custom_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CustomStep.ProtoReflect.Descriptor instead. +func (*CustomStep) Descriptor() ([]byte, []int) { + return file_steps_sp_steps_custom_proto_rawDescGZIP(), []int{0} +} + +func (x *CustomStep) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +var File_steps_sp_steps_custom_proto protoreflect.FileDescriptor + +var file_steps_sp_steps_custom_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2f, 0x73, 0x70, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x73, + 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x22, 0x1c, 0x0a, 0x0a, 0x43, + 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x53, 0x74, 0x65, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x42, 0x42, 0x5a, 0x40, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, + 0x6c, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x6c, 0x69, 0x62, 0x73, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x73, 0x74, 0x65, 0x70, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_steps_sp_steps_custom_proto_rawDescOnce sync.Once + file_steps_sp_steps_custom_proto_rawDescData = file_steps_sp_steps_custom_proto_rawDesc +) + +func file_steps_sp_steps_custom_proto_rawDescGZIP() []byte { + file_steps_sp_steps_custom_proto_rawDescOnce.Do(func() { + file_steps_sp_steps_custom_proto_rawDescData = protoimpl.X.CompressGZIP(file_steps_sp_steps_custom_proto_rawDescData) + }) + return file_steps_sp_steps_custom_proto_rawDescData +} + +var file_steps_sp_steps_custom_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_steps_sp_steps_custom_proto_goTypes = []interface{}{ + (*CustomStep)(nil), // 0: protos.steps.CustomStep +} +var file_steps_sp_steps_custom_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_steps_sp_steps_custom_proto_init() } +func file_steps_sp_steps_custom_proto_init() { + if File_steps_sp_steps_custom_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_steps_sp_steps_custom_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CustomStep); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_steps_sp_steps_custom_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_steps_sp_steps_custom_proto_goTypes, + DependencyIndexes: file_steps_sp_steps_custom_proto_depIdxs, + MessageInfos: file_steps_sp_steps_custom_proto_msgTypes, + }.Build() + File_steps_sp_steps_custom_proto = out.File + file_steps_sp_steps_custom_proto_rawDesc = nil + file_steps_sp_steps_custom_proto_goTypes = nil + file_steps_sp_steps_custom_proto_depIdxs = nil +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_decode.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_decode.pb.go new file mode 100644 index 000000000..8db3ec9a7 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_decode.pb.go @@ -0,0 +1,147 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: steps/sp_steps_decode.proto + +package steps + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// WIP +type DecodeStep struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *DecodeStep) Reset() { + *x = DecodeStep{} + if protoimpl.UnsafeEnabled { + mi := &file_steps_sp_steps_decode_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DecodeStep) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DecodeStep) ProtoMessage() {} + +func (x *DecodeStep) ProtoReflect() protoreflect.Message { + mi := &file_steps_sp_steps_decode_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DecodeStep.ProtoReflect.Descriptor instead. +func (*DecodeStep) Descriptor() ([]byte, []int) { + return file_steps_sp_steps_decode_proto_rawDescGZIP(), []int{0} +} + +func (x *DecodeStep) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +var File_steps_sp_steps_decode_proto protoreflect.FileDescriptor + +var file_steps_sp_steps_decode_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2f, 0x73, 0x70, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x73, + 0x5f, 0x64, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x22, 0x1c, 0x0a, 0x0a, 0x44, + 0x65, 0x63, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x65, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x42, 0x42, 0x5a, 0x40, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, + 0x6c, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x6c, 0x69, 0x62, 0x73, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x73, 0x74, 0x65, 0x70, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_steps_sp_steps_decode_proto_rawDescOnce sync.Once + file_steps_sp_steps_decode_proto_rawDescData = file_steps_sp_steps_decode_proto_rawDesc +) + +func file_steps_sp_steps_decode_proto_rawDescGZIP() []byte { + file_steps_sp_steps_decode_proto_rawDescOnce.Do(func() { + file_steps_sp_steps_decode_proto_rawDescData = protoimpl.X.CompressGZIP(file_steps_sp_steps_decode_proto_rawDescData) + }) + return file_steps_sp_steps_decode_proto_rawDescData +} + +var file_steps_sp_steps_decode_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_steps_sp_steps_decode_proto_goTypes = []interface{}{ + (*DecodeStep)(nil), // 0: protos.steps.DecodeStep +} +var file_steps_sp_steps_decode_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_steps_sp_steps_decode_proto_init() } +func file_steps_sp_steps_decode_proto_init() { + if File_steps_sp_steps_decode_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_steps_sp_steps_decode_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DecodeStep); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_steps_sp_steps_decode_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_steps_sp_steps_decode_proto_goTypes, + DependencyIndexes: file_steps_sp_steps_decode_proto_depIdxs, + MessageInfos: file_steps_sp_steps_decode_proto_msgTypes, + }.Build() + File_steps_sp_steps_decode_proto = out.File + file_steps_sp_steps_decode_proto_rawDesc = nil + file_steps_sp_steps_decode_proto_goTypes = nil + file_steps_sp_steps_decode_proto_depIdxs = nil +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_detective.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_detective.pb.go new file mode 100644 index 000000000..6b0362b4e --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_detective.pb.go @@ -0,0 +1,700 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: steps/sp_steps_detective.proto + +package steps + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type DetectiveType int32 + +const ( + DetectiveType_DETECTIVE_TYPE_UNKNOWN DetectiveType = 0 + DetectiveType_DETECTIVE_TYPE_IS_EMPTY DetectiveType = 1000 + DetectiveType_DETECTIVE_TYPE_HAS_FIELD DetectiveType = 1001 + DetectiveType_DETECTIVE_TYPE_IS_TYPE DetectiveType = 1002 + DetectiveType_DETECTIVE_TYPE_STRING_CONTAINS_ANY DetectiveType = 1003 + DetectiveType_DETECTIVE_TYPE_STRING_CONTAINS_ALL DetectiveType = 1004 + DetectiveType_DETECTIVE_TYPE_STRING_EQUAL DetectiveType = 1005 + DetectiveType_DETECTIVE_TYPE_IPV4_ADDRESS DetectiveType = 1006 + DetectiveType_DETECTIVE_TYPE_IPV6_ADDRESS DetectiveType = 1007 + DetectiveType_DETECTIVE_TYPE_MAC_ADDRESS DetectiveType = 1008 + DetectiveType_DETECTIVE_TYPE_REGEX DetectiveType = 1009 + DetectiveType_DETECTIVE_TYPE_TIMESTAMP_RFC3339 DetectiveType = 1010 + DetectiveType_DETECTIVE_TYPE_TIMESTAMP_UNIX_NANO DetectiveType = 1011 + DetectiveType_DETECTIVE_TYPE_TIMESTAMP_UNIX DetectiveType = 1012 + DetectiveType_DETECTIVE_TYPE_BOOLEAN_TRUE DetectiveType = 1013 + DetectiveType_DETECTIVE_TYPE_BOOLEAN_FALSE DetectiveType = 1014 + DetectiveType_DETECTIVE_TYPE_UUID DetectiveType = 1015 + DetectiveType_DETECTIVE_TYPE_URL DetectiveType = 1016 + DetectiveType_DETECTIVE_TYPE_HOSTNAME DetectiveType = 1017 + DetectiveType_DETECTIVE_TYPE_STRING_LENGTH_MIN DetectiveType = 1018 + DetectiveType_DETECTIVE_TYPE_STRING_LENGTH_MAX DetectiveType = 1019 + DetectiveType_DETECTIVE_TYPE_STRING_LENGTH_RANGE DetectiveType = 1020 + DetectiveType_DETECTIVE_TYPE_SEMVER DetectiveType = 1021 + // / Payloads containing values with any PII - runs all PII matchers + DetectiveType_DETECTIVE_TYPE_PII_ANY DetectiveType = 2000 + // Payloads containing values with a credit card number + DetectiveType_DETECTIVE_TYPE_PII_CREDIT_CARD DetectiveType = 2001 + // Payloads containing values with a social security number + DetectiveType_DETECTIVE_TYPE_PII_SSN DetectiveType = 2002 + // Payloads containing values with an email address + DetectiveType_DETECTIVE_TYPE_PII_EMAIL DetectiveType = 2003 + // Payloads containing values with a phone number + DetectiveType_DETECTIVE_TYPE_PII_PHONE DetectiveType = 2004 + // Payloads containing values with a driver's license + DetectiveType_DETECTIVE_TYPE_PII_DRIVER_LICENSE DetectiveType = 2005 + // Payloads containing values with a passport ID + DetectiveType_DETECTIVE_TYPE_PII_PASSPORT_ID DetectiveType = 2006 + // Payloads containing values with a VIN number + DetectiveType_DETECTIVE_TYPE_PII_VIN_NUMBER DetectiveType = 2007 + // Payloads containing values with various serial number formats + DetectiveType_DETECTIVE_TYPE_PII_SERIAL_NUMBER DetectiveType = 2008 + // Payloads containing fields named "login", "username", "user", "userid", "user_id", "user", "password", "pass", "passwd", "pwd" + DetectiveType_DETECTIVE_TYPE_PII_LOGIN DetectiveType = 2009 + // Payloads containing fields named "taxpayer_id", "tax_id", "taxpayerid", "taxid" + DetectiveType_DETECTIVE_TYPE_PII_TAXPAYER_ID DetectiveType = 2010 + // Payloads containing fields named "address", "street", "city", "state", "zip", "zipcode", "zip_code", "country" + DetectiveType_DETECTIVE_TYPE_PII_ADDRESS DetectiveType = 2011 + // Payloads containing fields named "signature", "signature_image", "signature_image_url", "signature_image_uri" + DetectiveType_DETECTIVE_TYPE_PII_SIGNATURE DetectiveType = 2012 + // Payloads containing values that contain GPS data or coordinates like "lat", "lon", "latitude", "longitude" + DetectiveType_DETECTIVE_TYPE_PII_GEOLOCATION DetectiveType = 2013 + // Payloads containing fields like "school", "university", "college", "education" + DetectiveType_DETECTIVE_TYPE_PII_EDUCATION DetectiveType = 2014 + // Payloads containing fields like "account", "bank", "credit", "debit", "financial", "finance" + DetectiveType_DETECTIVE_TYPE_PII_FINANCIAL DetectiveType = 2015 + // Payloads containing fields like "patient", "health", "healthcare", "health care", "medical" + DetectiveType_DETECTIVE_TYPE_PII_HEALTH DetectiveType = 2016 + DetectiveType_DETECTIVE_TYPE_PII_AWS_KEY_ID DetectiveType = 2017 + DetectiveType_DETECTIVE_TYPE_PII_RSA_KEY DetectiveType = 2018 + DetectiveType_DETECTIVE_TYPE_PII_TITLE DetectiveType = 2019 + DetectiveType_DETECTIVE_TYPE_PII_RELIGION DetectiveType = 2020 + DetectiveType_DETECTIVE_TYPE_PII_SLACK_TOKEN DetectiveType = 2021 + DetectiveType_DETECTIVE_TYPE_PII_STRIPE_KEY DetectiveType = 2022 + DetectiveType_DETECTIVE_TYPE_PII_IBAN DetectiveType = 2023 + DetectiveType_DETECTIVE_TYPE_PII_SWIFT_BIC DetectiveType = 2024 + DetectiveType_DETECTIVE_TYPE_PII_BANK_ROUTING_NUMBER DetectiveType = 2025 + DetectiveType_DETECTIVE_TYPE_PII_CRYPTO_ADDRESS DetectiveType = 2026 + DetectiveType_DETECTIVE_TYPE_PII_GITHUB_PAT DetectiveType = 2027 + DetectiveType_DETECTIVE_TYPE_NUMERIC_EQUAL_TO DetectiveType = 3000 + DetectiveType_DETECTIVE_TYPE_NUMERIC_GREATER_THAN DetectiveType = 3001 + DetectiveType_DETECTIVE_TYPE_NUMERIC_GREATER_EQUAL DetectiveType = 3002 + DetectiveType_DETECTIVE_TYPE_NUMERIC_LESS_THAN DetectiveType = 3003 + DetectiveType_DETECTIVE_TYPE_NUMERIC_LESS_EQUAL DetectiveType = 3004 + DetectiveType_DETECTIVE_TYPE_NUMERIC_RANGE DetectiveType = 3005 + DetectiveType_DETECTIVE_TYPE_NUMERIC_MIN DetectiveType = 3006 + DetectiveType_DETECTIVE_TYPE_NUMERIC_MAX DetectiveType = 3007 +) + +// Enum value maps for DetectiveType. +var ( + DetectiveType_name = map[int32]string{ + 0: "DETECTIVE_TYPE_UNKNOWN", + 1000: "DETECTIVE_TYPE_IS_EMPTY", + 1001: "DETECTIVE_TYPE_HAS_FIELD", + 1002: "DETECTIVE_TYPE_IS_TYPE", + 1003: "DETECTIVE_TYPE_STRING_CONTAINS_ANY", + 1004: "DETECTIVE_TYPE_STRING_CONTAINS_ALL", + 1005: "DETECTIVE_TYPE_STRING_EQUAL", + 1006: "DETECTIVE_TYPE_IPV4_ADDRESS", + 1007: "DETECTIVE_TYPE_IPV6_ADDRESS", + 1008: "DETECTIVE_TYPE_MAC_ADDRESS", + 1009: "DETECTIVE_TYPE_REGEX", + 1010: "DETECTIVE_TYPE_TIMESTAMP_RFC3339", + 1011: "DETECTIVE_TYPE_TIMESTAMP_UNIX_NANO", + 1012: "DETECTIVE_TYPE_TIMESTAMP_UNIX", + 1013: "DETECTIVE_TYPE_BOOLEAN_TRUE", + 1014: "DETECTIVE_TYPE_BOOLEAN_FALSE", + 1015: "DETECTIVE_TYPE_UUID", + 1016: "DETECTIVE_TYPE_URL", + 1017: "DETECTIVE_TYPE_HOSTNAME", + 1018: "DETECTIVE_TYPE_STRING_LENGTH_MIN", + 1019: "DETECTIVE_TYPE_STRING_LENGTH_MAX", + 1020: "DETECTIVE_TYPE_STRING_LENGTH_RANGE", + 1021: "DETECTIVE_TYPE_SEMVER", + 2000: "DETECTIVE_TYPE_PII_ANY", + 2001: "DETECTIVE_TYPE_PII_CREDIT_CARD", + 2002: "DETECTIVE_TYPE_PII_SSN", + 2003: "DETECTIVE_TYPE_PII_EMAIL", + 2004: "DETECTIVE_TYPE_PII_PHONE", + 2005: "DETECTIVE_TYPE_PII_DRIVER_LICENSE", + 2006: "DETECTIVE_TYPE_PII_PASSPORT_ID", + 2007: "DETECTIVE_TYPE_PII_VIN_NUMBER", + 2008: "DETECTIVE_TYPE_PII_SERIAL_NUMBER", + 2009: "DETECTIVE_TYPE_PII_LOGIN", + 2010: "DETECTIVE_TYPE_PII_TAXPAYER_ID", + 2011: "DETECTIVE_TYPE_PII_ADDRESS", + 2012: "DETECTIVE_TYPE_PII_SIGNATURE", + 2013: "DETECTIVE_TYPE_PII_GEOLOCATION", + 2014: "DETECTIVE_TYPE_PII_EDUCATION", + 2015: "DETECTIVE_TYPE_PII_FINANCIAL", + 2016: "DETECTIVE_TYPE_PII_HEALTH", + 2017: "DETECTIVE_TYPE_PII_AWS_KEY_ID", + 2018: "DETECTIVE_TYPE_PII_RSA_KEY", + 2019: "DETECTIVE_TYPE_PII_TITLE", + 2020: "DETECTIVE_TYPE_PII_RELIGION", + 2021: "DETECTIVE_TYPE_PII_SLACK_TOKEN", + 2022: "DETECTIVE_TYPE_PII_STRIPE_KEY", + 2023: "DETECTIVE_TYPE_PII_IBAN", + 2024: "DETECTIVE_TYPE_PII_SWIFT_BIC", + 2025: "DETECTIVE_TYPE_PII_BANK_ROUTING_NUMBER", + 2026: "DETECTIVE_TYPE_PII_CRYPTO_ADDRESS", + 2027: "DETECTIVE_TYPE_PII_GITHUB_PAT", + 3000: "DETECTIVE_TYPE_NUMERIC_EQUAL_TO", + 3001: "DETECTIVE_TYPE_NUMERIC_GREATER_THAN", + 3002: "DETECTIVE_TYPE_NUMERIC_GREATER_EQUAL", + 3003: "DETECTIVE_TYPE_NUMERIC_LESS_THAN", + 3004: "DETECTIVE_TYPE_NUMERIC_LESS_EQUAL", + 3005: "DETECTIVE_TYPE_NUMERIC_RANGE", + 3006: "DETECTIVE_TYPE_NUMERIC_MIN", + 3007: "DETECTIVE_TYPE_NUMERIC_MAX", + } + DetectiveType_value = map[string]int32{ + "DETECTIVE_TYPE_UNKNOWN": 0, + "DETECTIVE_TYPE_IS_EMPTY": 1000, + "DETECTIVE_TYPE_HAS_FIELD": 1001, + "DETECTIVE_TYPE_IS_TYPE": 1002, + "DETECTIVE_TYPE_STRING_CONTAINS_ANY": 1003, + "DETECTIVE_TYPE_STRING_CONTAINS_ALL": 1004, + "DETECTIVE_TYPE_STRING_EQUAL": 1005, + "DETECTIVE_TYPE_IPV4_ADDRESS": 1006, + "DETECTIVE_TYPE_IPV6_ADDRESS": 1007, + "DETECTIVE_TYPE_MAC_ADDRESS": 1008, + "DETECTIVE_TYPE_REGEX": 1009, + "DETECTIVE_TYPE_TIMESTAMP_RFC3339": 1010, + "DETECTIVE_TYPE_TIMESTAMP_UNIX_NANO": 1011, + "DETECTIVE_TYPE_TIMESTAMP_UNIX": 1012, + "DETECTIVE_TYPE_BOOLEAN_TRUE": 1013, + "DETECTIVE_TYPE_BOOLEAN_FALSE": 1014, + "DETECTIVE_TYPE_UUID": 1015, + "DETECTIVE_TYPE_URL": 1016, + "DETECTIVE_TYPE_HOSTNAME": 1017, + "DETECTIVE_TYPE_STRING_LENGTH_MIN": 1018, + "DETECTIVE_TYPE_STRING_LENGTH_MAX": 1019, + "DETECTIVE_TYPE_STRING_LENGTH_RANGE": 1020, + "DETECTIVE_TYPE_SEMVER": 1021, + "DETECTIVE_TYPE_PII_ANY": 2000, + "DETECTIVE_TYPE_PII_CREDIT_CARD": 2001, + "DETECTIVE_TYPE_PII_SSN": 2002, + "DETECTIVE_TYPE_PII_EMAIL": 2003, + "DETECTIVE_TYPE_PII_PHONE": 2004, + "DETECTIVE_TYPE_PII_DRIVER_LICENSE": 2005, + "DETECTIVE_TYPE_PII_PASSPORT_ID": 2006, + "DETECTIVE_TYPE_PII_VIN_NUMBER": 2007, + "DETECTIVE_TYPE_PII_SERIAL_NUMBER": 2008, + "DETECTIVE_TYPE_PII_LOGIN": 2009, + "DETECTIVE_TYPE_PII_TAXPAYER_ID": 2010, + "DETECTIVE_TYPE_PII_ADDRESS": 2011, + "DETECTIVE_TYPE_PII_SIGNATURE": 2012, + "DETECTIVE_TYPE_PII_GEOLOCATION": 2013, + "DETECTIVE_TYPE_PII_EDUCATION": 2014, + "DETECTIVE_TYPE_PII_FINANCIAL": 2015, + "DETECTIVE_TYPE_PII_HEALTH": 2016, + "DETECTIVE_TYPE_PII_AWS_KEY_ID": 2017, + "DETECTIVE_TYPE_PII_RSA_KEY": 2018, + "DETECTIVE_TYPE_PII_TITLE": 2019, + "DETECTIVE_TYPE_PII_RELIGION": 2020, + "DETECTIVE_TYPE_PII_SLACK_TOKEN": 2021, + "DETECTIVE_TYPE_PII_STRIPE_KEY": 2022, + "DETECTIVE_TYPE_PII_IBAN": 2023, + "DETECTIVE_TYPE_PII_SWIFT_BIC": 2024, + "DETECTIVE_TYPE_PII_BANK_ROUTING_NUMBER": 2025, + "DETECTIVE_TYPE_PII_CRYPTO_ADDRESS": 2026, + "DETECTIVE_TYPE_PII_GITHUB_PAT": 2027, + "DETECTIVE_TYPE_NUMERIC_EQUAL_TO": 3000, + "DETECTIVE_TYPE_NUMERIC_GREATER_THAN": 3001, + "DETECTIVE_TYPE_NUMERIC_GREATER_EQUAL": 3002, + "DETECTIVE_TYPE_NUMERIC_LESS_THAN": 3003, + "DETECTIVE_TYPE_NUMERIC_LESS_EQUAL": 3004, + "DETECTIVE_TYPE_NUMERIC_RANGE": 3005, + "DETECTIVE_TYPE_NUMERIC_MIN": 3006, + "DETECTIVE_TYPE_NUMERIC_MAX": 3007, + } +) + +func (x DetectiveType) Enum() *DetectiveType { + p := new(DetectiveType) + *p = x + return p +} + +func (x DetectiveType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (DetectiveType) Descriptor() protoreflect.EnumDescriptor { + return file_steps_sp_steps_detective_proto_enumTypes[0].Descriptor() +} + +func (DetectiveType) Type() protoreflect.EnumType { + return &file_steps_sp_steps_detective_proto_enumTypes[0] +} + +func (x DetectiveType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use DetectiveType.Descriptor instead. +func (DetectiveType) EnumDescriptor() ([]byte, []int) { + return file_steps_sp_steps_detective_proto_rawDescGZIP(), []int{0} +} + +type DetectiveStep struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Path *string `protobuf:"bytes,1,opt,name=path,proto3,oneof" json:"path,omitempty"` + Args []string `protobuf:"bytes,2,rep,name=args,proto3" json:"args,omitempty"` // args determined by match_type + Negate *bool `protobuf:"varint,3,opt,name=negate,proto3,oneof" json:"negate,omitempty"` + Type DetectiveType `protobuf:"varint,4,opt,name=type,proto3,enum=protos.steps.DetectiveType" json:"type,omitempty"` +} + +func (x *DetectiveStep) Reset() { + *x = DetectiveStep{} + if protoimpl.UnsafeEnabled { + mi := &file_steps_sp_steps_detective_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DetectiveStep) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DetectiveStep) ProtoMessage() {} + +func (x *DetectiveStep) ProtoReflect() protoreflect.Message { + mi := &file_steps_sp_steps_detective_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DetectiveStep.ProtoReflect.Descriptor instead. +func (*DetectiveStep) Descriptor() ([]byte, []int) { + return file_steps_sp_steps_detective_proto_rawDescGZIP(), []int{0} +} + +func (x *DetectiveStep) GetPath() string { + if x != nil && x.Path != nil { + return *x.Path + } + return "" +} + +func (x *DetectiveStep) GetArgs() []string { + if x != nil { + return x.Args + } + return nil +} + +func (x *DetectiveStep) GetNegate() bool { + if x != nil && x.Negate != nil { + return *x.Negate + } + return false +} + +func (x *DetectiveStep) GetType() DetectiveType { + if x != nil { + return x.Type + } + return DetectiveType_DETECTIVE_TYPE_UNKNOWN +} + +type DetectiveStepResultMatch struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type DetectiveType `protobuf:"varint,1,opt,name=type,proto3,enum=protos.steps.DetectiveType" json:"type,omitempty"` + // For JSON payloads, the path to the match + Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` + // Value of the match + Value []byte `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *DetectiveStepResultMatch) Reset() { + *x = DetectiveStepResultMatch{} + if protoimpl.UnsafeEnabled { + mi := &file_steps_sp_steps_detective_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DetectiveStepResultMatch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DetectiveStepResultMatch) ProtoMessage() {} + +func (x *DetectiveStepResultMatch) ProtoReflect() protoreflect.Message { + mi := &file_steps_sp_steps_detective_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DetectiveStepResultMatch.ProtoReflect.Descriptor instead. +func (*DetectiveStepResultMatch) Descriptor() ([]byte, []int) { + return file_steps_sp_steps_detective_proto_rawDescGZIP(), []int{1} +} + +func (x *DetectiveStepResultMatch) GetType() DetectiveType { + if x != nil { + return x.Type + } + return DetectiveType_DETECTIVE_TYPE_UNKNOWN +} + +func (x *DetectiveStepResultMatch) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *DetectiveStepResultMatch) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +type DetectiveStepResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Matches []*DetectiveStepResultMatch `protobuf:"bytes,1,rep,name=matches,proto3" json:"matches,omitempty"` +} + +func (x *DetectiveStepResult) Reset() { + *x = DetectiveStepResult{} + if protoimpl.UnsafeEnabled { + mi := &file_steps_sp_steps_detective_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DetectiveStepResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DetectiveStepResult) ProtoMessage() {} + +func (x *DetectiveStepResult) ProtoReflect() protoreflect.Message { + mi := &file_steps_sp_steps_detective_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DetectiveStepResult.ProtoReflect.Descriptor instead. +func (*DetectiveStepResult) Descriptor() ([]byte, []int) { + return file_steps_sp_steps_detective_proto_rawDescGZIP(), []int{2} +} + +func (x *DetectiveStepResult) GetMatches() []*DetectiveStepResultMatch { + if x != nil { + return x.Matches + } + return nil +} + +var File_steps_sp_steps_detective_proto protoreflect.FileDescriptor + +var file_steps_sp_steps_detective_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2f, 0x73, 0x70, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x73, + 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x0c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x22, 0x9e, + 0x01, 0x0a, 0x0d, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x53, 0x74, 0x65, 0x70, + 0x12, 0x17, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x88, 0x01, 0x01, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x67, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x12, 0x1b, 0x0a, + 0x06, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x48, 0x01, 0x52, + 0x06, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x65, 0x88, 0x01, 0x01, 0x12, 0x2f, 0x0a, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2e, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, + 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x5f, + 0x70, 0x61, 0x74, 0x68, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x65, 0x22, + 0x75, 0x0a, 0x18, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x53, 0x74, 0x65, 0x70, + 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x2f, 0x0a, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2e, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, + 0x76, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, + 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x57, 0x0a, 0x13, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, + 0x69, 0x76, 0x65, 0x53, 0x74, 0x65, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x40, 0x0a, + 0x07, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2e, 0x44, 0x65, + 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x53, 0x74, 0x65, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x52, 0x07, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x2a, + 0x96, 0x10, 0x0a, 0x0d, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x1c, 0x0a, + 0x17, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x49, 0x53, 0x5f, 0x45, 0x4d, 0x50, 0x54, 0x59, 0x10, 0xe8, 0x07, 0x12, 0x1d, 0x0a, 0x18, 0x44, + 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x48, 0x41, + 0x53, 0x5f, 0x46, 0x49, 0x45, 0x4c, 0x44, 0x10, 0xe9, 0x07, 0x12, 0x1b, 0x0a, 0x16, 0x44, 0x45, + 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x53, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x10, 0xea, 0x07, 0x12, 0x27, 0x0a, 0x22, 0x44, 0x45, 0x54, 0x45, 0x43, + 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, + 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x53, 0x5f, 0x41, 0x4e, 0x59, 0x10, 0xeb, 0x07, + 0x12, 0x27, 0x0a, 0x22, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, + 0x4e, 0x53, 0x5f, 0x41, 0x4c, 0x4c, 0x10, 0xec, 0x07, 0x12, 0x20, 0x0a, 0x1b, 0x44, 0x45, 0x54, + 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, + 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0xed, 0x07, 0x12, 0x20, 0x0a, 0x1b, 0x44, + 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x50, + 0x56, 0x34, 0x5f, 0x41, 0x44, 0x44, 0x52, 0x45, 0x53, 0x53, 0x10, 0xee, 0x07, 0x12, 0x20, 0x0a, + 0x1b, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x49, 0x50, 0x56, 0x36, 0x5f, 0x41, 0x44, 0x44, 0x52, 0x45, 0x53, 0x53, 0x10, 0xef, 0x07, 0x12, + 0x1f, 0x0a, 0x1a, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x4d, 0x41, 0x43, 0x5f, 0x41, 0x44, 0x44, 0x52, 0x45, 0x53, 0x53, 0x10, 0xf0, 0x07, + 0x12, 0x19, 0x0a, 0x14, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x52, 0x45, 0x47, 0x45, 0x58, 0x10, 0xf1, 0x07, 0x12, 0x25, 0x0a, 0x20, 0x44, + 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x49, + 0x4d, 0x45, 0x53, 0x54, 0x41, 0x4d, 0x50, 0x5f, 0x52, 0x46, 0x43, 0x33, 0x33, 0x33, 0x39, 0x10, + 0xf2, 0x07, 0x12, 0x27, 0x0a, 0x22, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x53, 0x54, 0x41, 0x4d, 0x50, 0x5f, 0x55, + 0x4e, 0x49, 0x58, 0x5f, 0x4e, 0x41, 0x4e, 0x4f, 0x10, 0xf3, 0x07, 0x12, 0x22, 0x0a, 0x1d, 0x44, + 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x49, + 0x4d, 0x45, 0x53, 0x54, 0x41, 0x4d, 0x50, 0x5f, 0x55, 0x4e, 0x49, 0x58, 0x10, 0xf4, 0x07, 0x12, + 0x20, 0x0a, 0x1b, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, 0x4e, 0x5f, 0x54, 0x52, 0x55, 0x45, 0x10, 0xf5, + 0x07, 0x12, 0x21, 0x0a, 0x1c, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x45, 0x41, 0x4e, 0x5f, 0x46, 0x41, 0x4c, 0x53, + 0x45, 0x10, 0xf6, 0x07, 0x12, 0x18, 0x0a, 0x13, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, + 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x55, 0x49, 0x44, 0x10, 0xf7, 0x07, 0x12, 0x17, + 0x0a, 0x12, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x55, 0x52, 0x4c, 0x10, 0xf8, 0x07, 0x12, 0x1c, 0x0a, 0x17, 0x44, 0x45, 0x54, 0x45, 0x43, + 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x48, 0x4f, 0x53, 0x54, 0x4e, 0x41, + 0x4d, 0x45, 0x10, 0xf9, 0x07, 0x12, 0x25, 0x0a, 0x20, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, + 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4c, + 0x45, 0x4e, 0x47, 0x54, 0x48, 0x5f, 0x4d, 0x49, 0x4e, 0x10, 0xfa, 0x07, 0x12, 0x25, 0x0a, 0x20, + 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, + 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4c, 0x45, 0x4e, 0x47, 0x54, 0x48, 0x5f, 0x4d, 0x41, 0x58, + 0x10, 0xfb, 0x07, 0x12, 0x27, 0x0a, 0x22, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, + 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4c, 0x45, 0x4e, + 0x47, 0x54, 0x48, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0xfc, 0x07, 0x12, 0x1a, 0x0a, 0x15, + 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, + 0x45, 0x4d, 0x56, 0x45, 0x52, 0x10, 0xfd, 0x07, 0x12, 0x1b, 0x0a, 0x16, 0x44, 0x45, 0x54, 0x45, + 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x49, 0x49, 0x5f, 0x41, + 0x4e, 0x59, 0x10, 0xd0, 0x0f, 0x12, 0x23, 0x0a, 0x1e, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, + 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x49, 0x49, 0x5f, 0x43, 0x52, 0x45, 0x44, + 0x49, 0x54, 0x5f, 0x43, 0x41, 0x52, 0x44, 0x10, 0xd1, 0x0f, 0x12, 0x1b, 0x0a, 0x16, 0x44, 0x45, + 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x49, 0x49, + 0x5f, 0x53, 0x53, 0x4e, 0x10, 0xd2, 0x0f, 0x12, 0x1d, 0x0a, 0x18, 0x44, 0x45, 0x54, 0x45, 0x43, + 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x49, 0x49, 0x5f, 0x45, 0x4d, + 0x41, 0x49, 0x4c, 0x10, 0xd3, 0x0f, 0x12, 0x1d, 0x0a, 0x18, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, + 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x49, 0x49, 0x5f, 0x50, 0x48, 0x4f, + 0x4e, 0x45, 0x10, 0xd4, 0x0f, 0x12, 0x26, 0x0a, 0x21, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, + 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x49, 0x49, 0x5f, 0x44, 0x52, 0x49, 0x56, + 0x45, 0x52, 0x5f, 0x4c, 0x49, 0x43, 0x45, 0x4e, 0x53, 0x45, 0x10, 0xd5, 0x0f, 0x12, 0x23, 0x0a, + 0x1e, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x50, 0x49, 0x49, 0x5f, 0x50, 0x41, 0x53, 0x53, 0x50, 0x4f, 0x52, 0x54, 0x5f, 0x49, 0x44, 0x10, + 0xd6, 0x0f, 0x12, 0x22, 0x0a, 0x1d, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x49, 0x49, 0x5f, 0x56, 0x49, 0x4e, 0x5f, 0x4e, 0x55, 0x4d, + 0x42, 0x45, 0x52, 0x10, 0xd7, 0x0f, 0x12, 0x25, 0x0a, 0x20, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, + 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x49, 0x49, 0x5f, 0x53, 0x45, 0x52, + 0x49, 0x41, 0x4c, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, 0xd8, 0x0f, 0x12, 0x1d, 0x0a, + 0x18, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x50, 0x49, 0x49, 0x5f, 0x4c, 0x4f, 0x47, 0x49, 0x4e, 0x10, 0xd9, 0x0f, 0x12, 0x23, 0x0a, 0x1e, + 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, + 0x49, 0x49, 0x5f, 0x54, 0x41, 0x58, 0x50, 0x41, 0x59, 0x45, 0x52, 0x5f, 0x49, 0x44, 0x10, 0xda, + 0x0f, 0x12, 0x1f, 0x0a, 0x1a, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x50, 0x49, 0x49, 0x5f, 0x41, 0x44, 0x44, 0x52, 0x45, 0x53, 0x53, 0x10, + 0xdb, 0x0f, 0x12, 0x21, 0x0a, 0x1c, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x49, 0x49, 0x5f, 0x53, 0x49, 0x47, 0x4e, 0x41, 0x54, 0x55, + 0x52, 0x45, 0x10, 0xdc, 0x0f, 0x12, 0x23, 0x0a, 0x1e, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, + 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x49, 0x49, 0x5f, 0x47, 0x45, 0x4f, 0x4c, + 0x4f, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0xdd, 0x0f, 0x12, 0x21, 0x0a, 0x1c, 0x44, 0x45, + 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x49, 0x49, + 0x5f, 0x45, 0x44, 0x55, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0xde, 0x0f, 0x12, 0x21, 0x0a, + 0x1c, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x50, 0x49, 0x49, 0x5f, 0x46, 0x49, 0x4e, 0x41, 0x4e, 0x43, 0x49, 0x41, 0x4c, 0x10, 0xdf, 0x0f, + 0x12, 0x1e, 0x0a, 0x19, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x50, 0x49, 0x49, 0x5f, 0x48, 0x45, 0x41, 0x4c, 0x54, 0x48, 0x10, 0xe0, 0x0f, + 0x12, 0x22, 0x0a, 0x1d, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x50, 0x49, 0x49, 0x5f, 0x41, 0x57, 0x53, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x49, + 0x44, 0x10, 0xe1, 0x0f, 0x12, 0x1f, 0x0a, 0x1a, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, + 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x49, 0x49, 0x5f, 0x52, 0x53, 0x41, 0x5f, 0x4b, + 0x45, 0x59, 0x10, 0xe2, 0x0f, 0x12, 0x1d, 0x0a, 0x18, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, + 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x49, 0x49, 0x5f, 0x54, 0x49, 0x54, 0x4c, + 0x45, 0x10, 0xe3, 0x0f, 0x12, 0x20, 0x0a, 0x1b, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, + 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x49, 0x49, 0x5f, 0x52, 0x45, 0x4c, 0x49, 0x47, + 0x49, 0x4f, 0x4e, 0x10, 0xe4, 0x0f, 0x12, 0x23, 0x0a, 0x1e, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, + 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x49, 0x49, 0x5f, 0x53, 0x4c, 0x41, + 0x43, 0x4b, 0x5f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x10, 0xe5, 0x0f, 0x12, 0x22, 0x0a, 0x1d, 0x44, + 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x49, + 0x49, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x50, 0x45, 0x5f, 0x4b, 0x45, 0x59, 0x10, 0xe6, 0x0f, 0x12, + 0x1c, 0x0a, 0x17, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x50, 0x49, 0x49, 0x5f, 0x49, 0x42, 0x41, 0x4e, 0x10, 0xe7, 0x0f, 0x12, 0x21, 0x0a, + 0x1c, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x50, 0x49, 0x49, 0x5f, 0x53, 0x57, 0x49, 0x46, 0x54, 0x5f, 0x42, 0x49, 0x43, 0x10, 0xe8, 0x0f, + 0x12, 0x2b, 0x0a, 0x26, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x50, 0x49, 0x49, 0x5f, 0x42, 0x41, 0x4e, 0x4b, 0x5f, 0x52, 0x4f, 0x55, 0x54, + 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, 0xe9, 0x0f, 0x12, 0x26, 0x0a, + 0x21, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x50, 0x49, 0x49, 0x5f, 0x43, 0x52, 0x59, 0x50, 0x54, 0x4f, 0x5f, 0x41, 0x44, 0x44, 0x52, 0x45, + 0x53, 0x53, 0x10, 0xea, 0x0f, 0x12, 0x22, 0x0a, 0x1d, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, + 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x49, 0x49, 0x5f, 0x47, 0x49, 0x54, 0x48, + 0x55, 0x42, 0x5f, 0x50, 0x41, 0x54, 0x10, 0xeb, 0x0f, 0x12, 0x24, 0x0a, 0x1f, 0x44, 0x45, 0x54, + 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4e, 0x55, 0x4d, 0x45, + 0x52, 0x49, 0x43, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x5f, 0x54, 0x4f, 0x10, 0xb8, 0x17, 0x12, + 0x28, 0x0a, 0x23, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x4e, 0x55, 0x4d, 0x45, 0x52, 0x49, 0x43, 0x5f, 0x47, 0x52, 0x45, 0x41, 0x54, 0x45, + 0x52, 0x5f, 0x54, 0x48, 0x41, 0x4e, 0x10, 0xb9, 0x17, 0x12, 0x29, 0x0a, 0x24, 0x44, 0x45, 0x54, + 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4e, 0x55, 0x4d, 0x45, + 0x52, 0x49, 0x43, 0x5f, 0x47, 0x52, 0x45, 0x41, 0x54, 0x45, 0x52, 0x5f, 0x45, 0x51, 0x55, 0x41, + 0x4c, 0x10, 0xba, 0x17, 0x12, 0x25, 0x0a, 0x20, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, + 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4e, 0x55, 0x4d, 0x45, 0x52, 0x49, 0x43, 0x5f, 0x4c, + 0x45, 0x53, 0x53, 0x5f, 0x54, 0x48, 0x41, 0x4e, 0x10, 0xbb, 0x17, 0x12, 0x26, 0x0a, 0x21, 0x44, + 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4e, 0x55, + 0x4d, 0x45, 0x52, 0x49, 0x43, 0x5f, 0x4c, 0x45, 0x53, 0x53, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, + 0x10, 0xbc, 0x17, 0x12, 0x21, 0x0a, 0x1c, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x49, 0x56, 0x45, + 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4e, 0x55, 0x4d, 0x45, 0x52, 0x49, 0x43, 0x5f, 0x52, 0x41, + 0x4e, 0x47, 0x45, 0x10, 0xbd, 0x17, 0x12, 0x1f, 0x0a, 0x1a, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, + 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4e, 0x55, 0x4d, 0x45, 0x52, 0x49, 0x43, + 0x5f, 0x4d, 0x49, 0x4e, 0x10, 0xbe, 0x17, 0x12, 0x1f, 0x0a, 0x1a, 0x44, 0x45, 0x54, 0x45, 0x43, + 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4e, 0x55, 0x4d, 0x45, 0x52, 0x49, + 0x43, 0x5f, 0x4d, 0x41, 0x58, 0x10, 0xbf, 0x17, 0x42, 0x42, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, + 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x6c, 0x69, 0x62, 0x73, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x73, 0x74, 0x65, 0x70, 0x73, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_steps_sp_steps_detective_proto_rawDescOnce sync.Once + file_steps_sp_steps_detective_proto_rawDescData = file_steps_sp_steps_detective_proto_rawDesc +) + +func file_steps_sp_steps_detective_proto_rawDescGZIP() []byte { + file_steps_sp_steps_detective_proto_rawDescOnce.Do(func() { + file_steps_sp_steps_detective_proto_rawDescData = protoimpl.X.CompressGZIP(file_steps_sp_steps_detective_proto_rawDescData) + }) + return file_steps_sp_steps_detective_proto_rawDescData +} + +var file_steps_sp_steps_detective_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_steps_sp_steps_detective_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_steps_sp_steps_detective_proto_goTypes = []interface{}{ + (DetectiveType)(0), // 0: protos.steps.DetectiveType + (*DetectiveStep)(nil), // 1: protos.steps.DetectiveStep + (*DetectiveStepResultMatch)(nil), // 2: protos.steps.DetectiveStepResultMatch + (*DetectiveStepResult)(nil), // 3: protos.steps.DetectiveStepResult +} +var file_steps_sp_steps_detective_proto_depIdxs = []int32{ + 0, // 0: protos.steps.DetectiveStep.type:type_name -> protos.steps.DetectiveType + 0, // 1: protos.steps.DetectiveStepResultMatch.type:type_name -> protos.steps.DetectiveType + 2, // 2: protos.steps.DetectiveStepResult.matches:type_name -> protos.steps.DetectiveStepResultMatch + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_steps_sp_steps_detective_proto_init() } +func file_steps_sp_steps_detective_proto_init() { + if File_steps_sp_steps_detective_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_steps_sp_steps_detective_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DetectiveStep); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_steps_sp_steps_detective_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DetectiveStepResultMatch); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_steps_sp_steps_detective_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DetectiveStepResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_steps_sp_steps_detective_proto_msgTypes[0].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_steps_sp_steps_detective_proto_rawDesc, + NumEnums: 1, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_steps_sp_steps_detective_proto_goTypes, + DependencyIndexes: file_steps_sp_steps_detective_proto_depIdxs, + EnumInfos: file_steps_sp_steps_detective_proto_enumTypes, + MessageInfos: file_steps_sp_steps_detective_proto_msgTypes, + }.Build() + File_steps_sp_steps_detective_proto = out.File + file_steps_sp_steps_detective_proto_rawDesc = nil + file_steps_sp_steps_detective_proto_goTypes = nil + file_steps_sp_steps_detective_proto_depIdxs = nil +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_encode.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_encode.pb.go new file mode 100644 index 000000000..addf6f4a1 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_encode.pb.go @@ -0,0 +1,147 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: steps/sp_steps_encode.proto + +package steps + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// WIP +type EncodeStep struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *EncodeStep) Reset() { + *x = EncodeStep{} + if protoimpl.UnsafeEnabled { + mi := &file_steps_sp_steps_encode_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EncodeStep) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EncodeStep) ProtoMessage() {} + +func (x *EncodeStep) ProtoReflect() protoreflect.Message { + mi := &file_steps_sp_steps_encode_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EncodeStep.ProtoReflect.Descriptor instead. +func (*EncodeStep) Descriptor() ([]byte, []int) { + return file_steps_sp_steps_encode_proto_rawDescGZIP(), []int{0} +} + +func (x *EncodeStep) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +var File_steps_sp_steps_encode_proto protoreflect.FileDescriptor + +var file_steps_sp_steps_encode_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2f, 0x73, 0x70, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x73, + 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x22, 0x1c, 0x0a, 0x0a, 0x45, + 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x65, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x42, 0x42, 0x5a, 0x40, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, + 0x6c, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x6c, 0x69, 0x62, 0x73, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x73, 0x74, 0x65, 0x70, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_steps_sp_steps_encode_proto_rawDescOnce sync.Once + file_steps_sp_steps_encode_proto_rawDescData = file_steps_sp_steps_encode_proto_rawDesc +) + +func file_steps_sp_steps_encode_proto_rawDescGZIP() []byte { + file_steps_sp_steps_encode_proto_rawDescOnce.Do(func() { + file_steps_sp_steps_encode_proto_rawDescData = protoimpl.X.CompressGZIP(file_steps_sp_steps_encode_proto_rawDescData) + }) + return file_steps_sp_steps_encode_proto_rawDescData +} + +var file_steps_sp_steps_encode_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_steps_sp_steps_encode_proto_goTypes = []interface{}{ + (*EncodeStep)(nil), // 0: protos.steps.EncodeStep +} +var file_steps_sp_steps_encode_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_steps_sp_steps_encode_proto_init() } +func file_steps_sp_steps_encode_proto_init() { + if File_steps_sp_steps_encode_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_steps_sp_steps_encode_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EncodeStep); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_steps_sp_steps_encode_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_steps_sp_steps_encode_proto_goTypes, + DependencyIndexes: file_steps_sp_steps_encode_proto_depIdxs, + MessageInfos: file_steps_sp_steps_encode_proto_msgTypes, + }.Build() + File_steps_sp_steps_encode_proto = out.File + file_steps_sp_steps_encode_proto_rawDesc = nil + file_steps_sp_steps_encode_proto_goTypes = nil + file_steps_sp_steps_encode_proto_depIdxs = nil +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_httprequest.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_httprequest.pb.go new file mode 100644 index 000000000..b44161c0d --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_httprequest.pb.go @@ -0,0 +1,425 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: steps/sp_steps_httprequest.proto + +package steps + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type HttpRequestMethod int32 + +const ( + HttpRequestMethod_HTTP_REQUEST_METHOD_UNSET HttpRequestMethod = 0 + HttpRequestMethod_HTTP_REQUEST_METHOD_GET HttpRequestMethod = 1 + HttpRequestMethod_HTTP_REQUEST_METHOD_POST HttpRequestMethod = 2 + HttpRequestMethod_HTTP_REQUEST_METHOD_PUT HttpRequestMethod = 3 + HttpRequestMethod_HTTP_REQUEST_METHOD_DELETE HttpRequestMethod = 4 + HttpRequestMethod_HTTP_REQUEST_METHOD_PATCH HttpRequestMethod = 5 + HttpRequestMethod_HTTP_REQUEST_METHOD_HEAD HttpRequestMethod = 6 + HttpRequestMethod_HTTP_REQUEST_METHOD_OPTIONS HttpRequestMethod = 7 +) + +// Enum value maps for HttpRequestMethod. +var ( + HttpRequestMethod_name = map[int32]string{ + 0: "HTTP_REQUEST_METHOD_UNSET", + 1: "HTTP_REQUEST_METHOD_GET", + 2: "HTTP_REQUEST_METHOD_POST", + 3: "HTTP_REQUEST_METHOD_PUT", + 4: "HTTP_REQUEST_METHOD_DELETE", + 5: "HTTP_REQUEST_METHOD_PATCH", + 6: "HTTP_REQUEST_METHOD_HEAD", + 7: "HTTP_REQUEST_METHOD_OPTIONS", + } + HttpRequestMethod_value = map[string]int32{ + "HTTP_REQUEST_METHOD_UNSET": 0, + "HTTP_REQUEST_METHOD_GET": 1, + "HTTP_REQUEST_METHOD_POST": 2, + "HTTP_REQUEST_METHOD_PUT": 3, + "HTTP_REQUEST_METHOD_DELETE": 4, + "HTTP_REQUEST_METHOD_PATCH": 5, + "HTTP_REQUEST_METHOD_HEAD": 6, + "HTTP_REQUEST_METHOD_OPTIONS": 7, + } +) + +func (x HttpRequestMethod) Enum() *HttpRequestMethod { + p := new(HttpRequestMethod) + *p = x + return p +} + +func (x HttpRequestMethod) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (HttpRequestMethod) Descriptor() protoreflect.EnumDescriptor { + return file_steps_sp_steps_httprequest_proto_enumTypes[0].Descriptor() +} + +func (HttpRequestMethod) Type() protoreflect.EnumType { + return &file_steps_sp_steps_httprequest_proto_enumTypes[0] +} + +func (x HttpRequestMethod) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use HttpRequestMethod.Descriptor instead. +func (HttpRequestMethod) EnumDescriptor() ([]byte, []int) { + return file_steps_sp_steps_httprequest_proto_rawDescGZIP(), []int{0} +} + +type HttpRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Method HttpRequestMethod `protobuf:"varint,1,opt,name=method,proto3,enum=protos.steps.HttpRequestMethod" json:"method,omitempty"` + Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` + Body []byte `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"` + Headers map[string]string `protobuf:"bytes,4,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *HttpRequest) Reset() { + *x = HttpRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_steps_sp_steps_httprequest_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HttpRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HttpRequest) ProtoMessage() {} + +func (x *HttpRequest) ProtoReflect() protoreflect.Message { + mi := &file_steps_sp_steps_httprequest_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HttpRequest.ProtoReflect.Descriptor instead. +func (*HttpRequest) Descriptor() ([]byte, []int) { + return file_steps_sp_steps_httprequest_proto_rawDescGZIP(), []int{0} +} + +func (x *HttpRequest) GetMethod() HttpRequestMethod { + if x != nil { + return x.Method + } + return HttpRequestMethod_HTTP_REQUEST_METHOD_UNSET +} + +func (x *HttpRequest) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *HttpRequest) GetBody() []byte { + if x != nil { + return x.Body + } + return nil +} + +func (x *HttpRequest) GetHeaders() map[string]string { + if x != nil { + return x.Headers + } + return nil +} + +type HttpResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` + Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` + Headers map[string]string `protobuf:"bytes,3,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *HttpResponse) Reset() { + *x = HttpResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_steps_sp_steps_httprequest_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HttpResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HttpResponse) ProtoMessage() {} + +func (x *HttpResponse) ProtoReflect() protoreflect.Message { + mi := &file_steps_sp_steps_httprequest_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HttpResponse.ProtoReflect.Descriptor instead. +func (*HttpResponse) Descriptor() ([]byte, []int) { + return file_steps_sp_steps_httprequest_proto_rawDescGZIP(), []int{1} +} + +func (x *HttpResponse) GetCode() int32 { + if x != nil { + return x.Code + } + return 0 +} + +func (x *HttpResponse) GetBody() []byte { + if x != nil { + return x.Body + } + return nil +} + +func (x *HttpResponse) GetHeaders() map[string]string { + if x != nil { + return x.Headers + } + return nil +} + +type HttpRequestStep struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Request *HttpRequest `protobuf:"bytes,1,opt,name=request,proto3" json:"request,omitempty"` +} + +func (x *HttpRequestStep) Reset() { + *x = HttpRequestStep{} + if protoimpl.UnsafeEnabled { + mi := &file_steps_sp_steps_httprequest_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HttpRequestStep) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HttpRequestStep) ProtoMessage() {} + +func (x *HttpRequestStep) ProtoReflect() protoreflect.Message { + mi := &file_steps_sp_steps_httprequest_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HttpRequestStep.ProtoReflect.Descriptor instead. +func (*HttpRequestStep) Descriptor() ([]byte, []int) { + return file_steps_sp_steps_httprequest_proto_rawDescGZIP(), []int{2} +} + +func (x *HttpRequestStep) GetRequest() *HttpRequest { + if x != nil { + return x.Request + } + return nil +} + +var File_steps_sp_steps_httprequest_proto protoreflect.FileDescriptor + +var file_steps_sp_steps_httprequest_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2f, 0x73, 0x70, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x73, + 0x5f, 0x68, 0x74, 0x74, 0x70, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x0c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, + 0x22, 0xea, 0x01, 0x0a, 0x0b, 0x48, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x37, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2e, + 0x48, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, + 0x40, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x26, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2e, + 0x48, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x73, 0x1a, 0x3a, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xb5, 0x01, + 0x0a, 0x0c, 0x48, 0x74, 0x74, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, + 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x41, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x1a, 0x3a, 0x0a, 0x0c, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x46, 0x0a, 0x0f, 0x48, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x53, 0x74, 0x65, 0x70, 0x12, 0x33, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2a, 0x88, 0x02, + 0x0a, 0x11, 0x48, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, + 0x68, 0x6f, 0x64, 0x12, 0x1d, 0x0a, 0x19, 0x48, 0x54, 0x54, 0x50, 0x5f, 0x52, 0x45, 0x51, 0x55, + 0x45, 0x53, 0x54, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, 0x5f, 0x55, 0x4e, 0x53, 0x45, 0x54, + 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x48, 0x54, 0x54, 0x50, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, + 0x53, 0x54, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, 0x5f, 0x47, 0x45, 0x54, 0x10, 0x01, 0x12, + 0x1c, 0x0a, 0x18, 0x48, 0x54, 0x54, 0x50, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x5f, + 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, 0x5f, 0x50, 0x4f, 0x53, 0x54, 0x10, 0x02, 0x12, 0x1b, 0x0a, + 0x17, 0x48, 0x54, 0x54, 0x50, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x5f, 0x4d, 0x45, + 0x54, 0x48, 0x4f, 0x44, 0x5f, 0x50, 0x55, 0x54, 0x10, 0x03, 0x12, 0x1e, 0x0a, 0x1a, 0x48, 0x54, + 0x54, 0x50, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, + 0x44, 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x04, 0x12, 0x1d, 0x0a, 0x19, 0x48, 0x54, + 0x54, 0x50, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, + 0x44, 0x5f, 0x50, 0x41, 0x54, 0x43, 0x48, 0x10, 0x05, 0x12, 0x1c, 0x0a, 0x18, 0x48, 0x54, 0x54, + 0x50, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, + 0x5f, 0x48, 0x45, 0x41, 0x44, 0x10, 0x06, 0x12, 0x1f, 0x0a, 0x1b, 0x48, 0x54, 0x54, 0x50, 0x5f, + 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, 0x5f, 0x4f, + 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x10, 0x07, 0x42, 0x42, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, + 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x6c, 0x69, 0x62, 0x73, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x73, 0x74, 0x65, 0x70, 0x73, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_steps_sp_steps_httprequest_proto_rawDescOnce sync.Once + file_steps_sp_steps_httprequest_proto_rawDescData = file_steps_sp_steps_httprequest_proto_rawDesc +) + +func file_steps_sp_steps_httprequest_proto_rawDescGZIP() []byte { + file_steps_sp_steps_httprequest_proto_rawDescOnce.Do(func() { + file_steps_sp_steps_httprequest_proto_rawDescData = protoimpl.X.CompressGZIP(file_steps_sp_steps_httprequest_proto_rawDescData) + }) + return file_steps_sp_steps_httprequest_proto_rawDescData +} + +var file_steps_sp_steps_httprequest_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_steps_sp_steps_httprequest_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_steps_sp_steps_httprequest_proto_goTypes = []interface{}{ + (HttpRequestMethod)(0), // 0: protos.steps.HttpRequestMethod + (*HttpRequest)(nil), // 1: protos.steps.HttpRequest + (*HttpResponse)(nil), // 2: protos.steps.HttpResponse + (*HttpRequestStep)(nil), // 3: protos.steps.HttpRequestStep + nil, // 4: protos.steps.HttpRequest.HeadersEntry + nil, // 5: protos.steps.HttpResponse.HeadersEntry +} +var file_steps_sp_steps_httprequest_proto_depIdxs = []int32{ + 0, // 0: protos.steps.HttpRequest.method:type_name -> protos.steps.HttpRequestMethod + 4, // 1: protos.steps.HttpRequest.headers:type_name -> protos.steps.HttpRequest.HeadersEntry + 5, // 2: protos.steps.HttpResponse.headers:type_name -> protos.steps.HttpResponse.HeadersEntry + 1, // 3: protos.steps.HttpRequestStep.request:type_name -> protos.steps.HttpRequest + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_steps_sp_steps_httprequest_proto_init() } +func file_steps_sp_steps_httprequest_proto_init() { + if File_steps_sp_steps_httprequest_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_steps_sp_steps_httprequest_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HttpRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_steps_sp_steps_httprequest_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HttpResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_steps_sp_steps_httprequest_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HttpRequestStep); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_steps_sp_steps_httprequest_proto_rawDesc, + NumEnums: 1, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_steps_sp_steps_httprequest_proto_goTypes, + DependencyIndexes: file_steps_sp_steps_httprequest_proto_depIdxs, + EnumInfos: file_steps_sp_steps_httprequest_proto_enumTypes, + MessageInfos: file_steps_sp_steps_httprequest_proto_msgTypes, + }.Build() + File_steps_sp_steps_httprequest_proto = out.File + file_steps_sp_steps_httprequest_proto_rawDesc = nil + file_steps_sp_steps_httprequest_proto_goTypes = nil + file_steps_sp_steps_httprequest_proto_depIdxs = nil +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_inferschema.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_inferschema.pb.go new file mode 100644 index 000000000..5856f2972 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_inferschema.pb.go @@ -0,0 +1,151 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: steps/sp_steps_inferschema.proto + +package steps + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// InferSchemaStep is a step that infers the schema of a payload. +// It is designed to be used directly by the SDK rather than in a pipeline, so that +// we can support schema inference without the need for pipelines to be created +type InferSchemaStep struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CurrentSchema []byte `protobuf:"bytes,1,opt,name=current_schema,json=currentSchema,proto3" json:"current_schema,omitempty"` +} + +func (x *InferSchemaStep) Reset() { + *x = InferSchemaStep{} + if protoimpl.UnsafeEnabled { + mi := &file_steps_sp_steps_inferschema_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InferSchemaStep) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InferSchemaStep) ProtoMessage() {} + +func (x *InferSchemaStep) ProtoReflect() protoreflect.Message { + mi := &file_steps_sp_steps_inferschema_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InferSchemaStep.ProtoReflect.Descriptor instead. +func (*InferSchemaStep) Descriptor() ([]byte, []int) { + return file_steps_sp_steps_inferschema_proto_rawDescGZIP(), []int{0} +} + +func (x *InferSchemaStep) GetCurrentSchema() []byte { + if x != nil { + return x.CurrentSchema + } + return nil +} + +var File_steps_sp_steps_inferschema_proto protoreflect.FileDescriptor + +var file_steps_sp_steps_inferschema_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2f, 0x73, 0x70, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x73, + 0x5f, 0x69, 0x6e, 0x66, 0x65, 0x72, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x0c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, + 0x22, 0x38, 0x0a, 0x0f, 0x49, 0x6e, 0x66, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x53, + 0x74, 0x65, 0x70, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x63, 0x75, 0x72, + 0x72, 0x65, 0x6e, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x42, 0x42, 0x5a, 0x40, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, + 0x61, 0x6c, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x6c, 0x69, 0x62, + 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, + 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x73, 0x74, 0x65, 0x70, 0x73, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_steps_sp_steps_inferschema_proto_rawDescOnce sync.Once + file_steps_sp_steps_inferschema_proto_rawDescData = file_steps_sp_steps_inferschema_proto_rawDesc +) + +func file_steps_sp_steps_inferschema_proto_rawDescGZIP() []byte { + file_steps_sp_steps_inferschema_proto_rawDescOnce.Do(func() { + file_steps_sp_steps_inferschema_proto_rawDescData = protoimpl.X.CompressGZIP(file_steps_sp_steps_inferschema_proto_rawDescData) + }) + return file_steps_sp_steps_inferschema_proto_rawDescData +} + +var file_steps_sp_steps_inferschema_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_steps_sp_steps_inferschema_proto_goTypes = []interface{}{ + (*InferSchemaStep)(nil), // 0: protos.steps.InferSchemaStep +} +var file_steps_sp_steps_inferschema_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_steps_sp_steps_inferschema_proto_init() } +func file_steps_sp_steps_inferschema_proto_init() { + if File_steps_sp_steps_inferschema_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_steps_sp_steps_inferschema_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InferSchemaStep); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_steps_sp_steps_inferschema_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_steps_sp_steps_inferschema_proto_goTypes, + DependencyIndexes: file_steps_sp_steps_inferschema_proto_depIdxs, + MessageInfos: file_steps_sp_steps_inferschema_proto_msgTypes, + }.Build() + File_steps_sp_steps_inferschema_proto = out.File + file_steps_sp_steps_inferschema_proto_rawDesc = nil + file_steps_sp_steps_inferschema_proto_goTypes = nil + file_steps_sp_steps_inferschema_proto_depIdxs = nil +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_kv.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_kv.pb.go new file mode 100644 index 000000000..c30dfd5a9 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_kv.pb.go @@ -0,0 +1,413 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: steps/sp_steps_kv.proto + +package steps + +import ( + shared "github.com/streamdal/streamdal/libs/protos/build/go/protos/shared" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Used by frontend when constructing a pipeline that contains a KV step that +// performs any KV request. The mode determines _what_ the contents of the +// key will be. Read comments about "static" vs "dynamic". +// protolint:disable:next ENUM_FIELD_NAMES_PREFIX +type KVMode int32 + +const ( + KVMode_KV_MODE_UNSET KVMode = 0 + // Will cause the KV lookup to use the key string as-is for the lookup + KVMode_KV_MODE_STATIC KVMode = 1 + // DYNAMIC mode will cause the KV lookup WASM to use the key to lookup the + // associated value and use the result for the key existence check. + // + // For example, if "key" in KVHostFuncRequest is set to "foo", KV WASM will do + // the following: + // + // 1. Lookup the value of "foo" in the payload (which is "bar") + // 2. Use "bar" as the "key" for the KV lookup + KVMode_KV_MODE_DYNAMIC KVMode = 2 +) + +// Enum value maps for KVMode. +var ( + KVMode_name = map[int32]string{ + 0: "KV_MODE_UNSET", + 1: "KV_MODE_STATIC", + 2: "KV_MODE_DYNAMIC", + } + KVMode_value = map[string]int32{ + "KV_MODE_UNSET": 0, + "KV_MODE_STATIC": 1, + "KV_MODE_DYNAMIC": 2, + } +) + +func (x KVMode) Enum() *KVMode { + p := new(KVMode) + *p = x + return p +} + +func (x KVMode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (KVMode) Descriptor() protoreflect.EnumDescriptor { + return file_steps_sp_steps_kv_proto_enumTypes[0].Descriptor() +} + +func (KVMode) Type() protoreflect.EnumType { + return &file_steps_sp_steps_kv_proto_enumTypes[0] +} + +func (x KVMode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use KVMode.Descriptor instead. +func (KVMode) EnumDescriptor() ([]byte, []int) { + return file_steps_sp_steps_kv_proto_rawDescGZIP(), []int{0} +} + +// Returned by KV host func and interpreted by KV WASM. +// protolint:disable:next ENUM_FIELD_NAMES_PREFIX +type KVStatus int32 + +const ( + KVStatus_KV_STATUS_UNSET KVStatus = 0 + KVStatus_KV_STATUS_SUCCESS KVStatus = 1 + KVStatus_KV_STATUS_FAILURE KVStatus = 2 + KVStatus_KV_STATUS_ERROR KVStatus = 3 +) + +// Enum value maps for KVStatus. +var ( + KVStatus_name = map[int32]string{ + 0: "KV_STATUS_UNSET", + 1: "KV_STATUS_SUCCESS", + 2: "KV_STATUS_FAILURE", + 3: "KV_STATUS_ERROR", + } + KVStatus_value = map[string]int32{ + "KV_STATUS_UNSET": 0, + "KV_STATUS_SUCCESS": 1, + "KV_STATUS_FAILURE": 2, + "KV_STATUS_ERROR": 3, + } +) + +func (x KVStatus) Enum() *KVStatus { + p := new(KVStatus) + *p = x + return p +} + +func (x KVStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (KVStatus) Descriptor() protoreflect.EnumDescriptor { + return file_steps_sp_steps_kv_proto_enumTypes[1].Descriptor() +} + +func (KVStatus) Type() protoreflect.EnumType { + return &file_steps_sp_steps_kv_proto_enumTypes[1] +} + +func (x KVStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use KVStatus.Descriptor instead. +func (KVStatus) EnumDescriptor() ([]byte, []int) { + return file_steps_sp_steps_kv_proto_rawDescGZIP(), []int{1} +} + +// Returned by SDK host func and interpreted by KV WASM. +type KVStepResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Status of the action; interpreted by KV WASM to so it can generate a protos.WASMResponse + Status KVStatus `protobuf:"varint,1,opt,name=status,proto3,enum=protos.steps.KVStatus" json:"status,omitempty"` + // Message containing info, debug or error details; included in protos.WASMResponse + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + // Optional because the only action that uses field is KV_ACTION_GET + // + // DS: Not sure how we'll use KV_ACTION_GET in steps yet but this is probably + // a good place to start. 09.06.2023. + Value []byte `protobuf:"bytes,3,opt,name=value,proto3,oneof" json:"value,omitempty"` +} + +func (x *KVStepResponse) Reset() { + *x = KVStepResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_steps_sp_steps_kv_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KVStepResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KVStepResponse) ProtoMessage() {} + +func (x *KVStepResponse) ProtoReflect() protoreflect.Message { + mi := &file_steps_sp_steps_kv_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KVStepResponse.ProtoReflect.Descriptor instead. +func (*KVStepResponse) Descriptor() ([]byte, []int) { + return file_steps_sp_steps_kv_proto_rawDescGZIP(), []int{0} +} + +func (x *KVStepResponse) GetStatus() KVStatus { + if x != nil { + return x.Status + } + return KVStatus_KV_STATUS_UNSET +} + +func (x *KVStepResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *KVStepResponse) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +// Used in PipelineSteps and passed to KV host func; constructed by frontend +type KVStep struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // What type of action this step should perform + Action shared.KVAction `protobuf:"varint,1,opt,name=action,proto3,enum=protos.shared.KVAction" json:"action,omitempty"` + // How the key field will be used to perform lookup + Mode KVMode `protobuf:"varint,2,opt,name=mode,proto3,enum=protos.steps.KVMode" json:"mode,omitempty"` + // The key the action is taking place on + Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` + // Optional because the only action that needs value is KV_ACTION_CREATE + Value []byte `protobuf:"bytes,4,opt,name=value,proto3,oneof" json:"value,omitempty"` +} + +func (x *KVStep) Reset() { + *x = KVStep{} + if protoimpl.UnsafeEnabled { + mi := &file_steps_sp_steps_kv_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KVStep) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KVStep) ProtoMessage() {} + +func (x *KVStep) ProtoReflect() protoreflect.Message { + mi := &file_steps_sp_steps_kv_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KVStep.ProtoReflect.Descriptor instead. +func (*KVStep) Descriptor() ([]byte, []int) { + return file_steps_sp_steps_kv_proto_rawDescGZIP(), []int{1} +} + +func (x *KVStep) GetAction() shared.KVAction { + if x != nil { + return x.Action + } + return shared.KVAction(0) +} + +func (x *KVStep) GetMode() KVMode { + if x != nil { + return x.Mode + } + return KVMode_KV_MODE_UNSET +} + +func (x *KVStep) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *KVStep) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +var File_steps_sp_steps_kv_proto protoreflect.FileDescriptor + +var file_steps_sp_steps_kv_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2f, 0x73, 0x70, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x73, + 0x5f, 0x6b, 0x76, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x1a, 0x16, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, + 0x73, 0x70, 0x5f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x7f, 0x0a, 0x0e, 0x4b, 0x56, 0x53, 0x74, 0x65, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, + 0x2e, 0x4b, 0x56, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x19, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x22, 0x9a, 0x01, 0x0a, 0x06, 0x4b, 0x56, 0x53, 0x74, 0x65, 0x70, 0x12, 0x2f, 0x0a, 0x06, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x4b, 0x56, 0x41, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x04, + 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2e, 0x4b, 0x56, 0x4d, 0x6f, 0x64, 0x65, + 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2a, 0x44, 0x0a, + 0x06, 0x4b, 0x56, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x11, 0x0a, 0x0d, 0x4b, 0x56, 0x5f, 0x4d, 0x4f, + 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x45, 0x54, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x4b, 0x56, + 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x49, 0x43, 0x10, 0x01, 0x12, 0x13, + 0x0a, 0x0f, 0x4b, 0x56, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x44, 0x59, 0x4e, 0x41, 0x4d, 0x49, + 0x43, 0x10, 0x02, 0x2a, 0x62, 0x0a, 0x08, 0x4b, 0x56, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, + 0x13, 0x0a, 0x0f, 0x4b, 0x56, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, + 0x45, 0x54, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x4b, 0x56, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, + 0x53, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x4b, + 0x56, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, + 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x4b, 0x56, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, + 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x42, 0x42, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, + 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x6c, 0x69, 0x62, 0x73, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x73, 0x74, 0x65, 0x70, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_steps_sp_steps_kv_proto_rawDescOnce sync.Once + file_steps_sp_steps_kv_proto_rawDescData = file_steps_sp_steps_kv_proto_rawDesc +) + +func file_steps_sp_steps_kv_proto_rawDescGZIP() []byte { + file_steps_sp_steps_kv_proto_rawDescOnce.Do(func() { + file_steps_sp_steps_kv_proto_rawDescData = protoimpl.X.CompressGZIP(file_steps_sp_steps_kv_proto_rawDescData) + }) + return file_steps_sp_steps_kv_proto_rawDescData +} + +var file_steps_sp_steps_kv_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_steps_sp_steps_kv_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_steps_sp_steps_kv_proto_goTypes = []interface{}{ + (KVMode)(0), // 0: protos.steps.KVMode + (KVStatus)(0), // 1: protos.steps.KVStatus + (*KVStepResponse)(nil), // 2: protos.steps.KVStepResponse + (*KVStep)(nil), // 3: protos.steps.KVStep + (shared.KVAction)(0), // 4: protos.shared.KVAction +} +var file_steps_sp_steps_kv_proto_depIdxs = []int32{ + 1, // 0: protos.steps.KVStepResponse.status:type_name -> protos.steps.KVStatus + 4, // 1: protos.steps.KVStep.action:type_name -> protos.shared.KVAction + 0, // 2: protos.steps.KVStep.mode:type_name -> protos.steps.KVMode + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_steps_sp_steps_kv_proto_init() } +func file_steps_sp_steps_kv_proto_init() { + if File_steps_sp_steps_kv_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_steps_sp_steps_kv_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KVStepResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_steps_sp_steps_kv_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KVStep); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_steps_sp_steps_kv_proto_msgTypes[0].OneofWrappers = []interface{}{} + file_steps_sp_steps_kv_proto_msgTypes[1].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_steps_sp_steps_kv_proto_rawDesc, + NumEnums: 2, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_steps_sp_steps_kv_proto_goTypes, + DependencyIndexes: file_steps_sp_steps_kv_proto_depIdxs, + EnumInfos: file_steps_sp_steps_kv_proto_enumTypes, + MessageInfos: file_steps_sp_steps_kv_proto_msgTypes, + }.Build() + File_steps_sp_steps_kv_proto = out.File + file_steps_sp_steps_kv_proto_rawDesc = nil + file_steps_sp_steps_kv_proto_goTypes = nil + file_steps_sp_steps_kv_proto_depIdxs = nil +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_schema_validation.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_schema_validation.pb.go new file mode 100644 index 000000000..01b3a0b01 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_schema_validation.pb.go @@ -0,0 +1,455 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: steps/sp_steps_schema_validation.proto + +package steps + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type SchemaValidationType int32 + +const ( + SchemaValidationType_SCHEMA_VALIDATION_TYPE_UNKNOWN SchemaValidationType = 0 + SchemaValidationType_SCHEMA_VALIDATION_TYPE_JSONSCHEMA SchemaValidationType = 1 +) + +// Enum value maps for SchemaValidationType. +var ( + SchemaValidationType_name = map[int32]string{ + 0: "SCHEMA_VALIDATION_TYPE_UNKNOWN", + 1: "SCHEMA_VALIDATION_TYPE_JSONSCHEMA", + } + SchemaValidationType_value = map[string]int32{ + "SCHEMA_VALIDATION_TYPE_UNKNOWN": 0, + "SCHEMA_VALIDATION_TYPE_JSONSCHEMA": 1, + } +) + +func (x SchemaValidationType) Enum() *SchemaValidationType { + p := new(SchemaValidationType) + *p = x + return p +} + +func (x SchemaValidationType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SchemaValidationType) Descriptor() protoreflect.EnumDescriptor { + return file_steps_sp_steps_schema_validation_proto_enumTypes[0].Descriptor() +} + +func (SchemaValidationType) Type() protoreflect.EnumType { + return &file_steps_sp_steps_schema_validation_proto_enumTypes[0] +} + +func (x SchemaValidationType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SchemaValidationType.Descriptor instead. +func (SchemaValidationType) EnumDescriptor() ([]byte, []int) { + return file_steps_sp_steps_schema_validation_proto_rawDescGZIP(), []int{0} +} + +type SchemaValidationCondition int32 + +const ( + SchemaValidationCondition_SCHEMA_VALIDATION_CONDITION_UNKNOWN SchemaValidationCondition = 0 + SchemaValidationCondition_SCHEMA_VALIDATION_CONDITION_MATCH SchemaValidationCondition = 1 + SchemaValidationCondition_SCHEMA_VALIDATION_CONDITION_NOT_MATCH SchemaValidationCondition = 2 +) + +// Enum value maps for SchemaValidationCondition. +var ( + SchemaValidationCondition_name = map[int32]string{ + 0: "SCHEMA_VALIDATION_CONDITION_UNKNOWN", + 1: "SCHEMA_VALIDATION_CONDITION_MATCH", + 2: "SCHEMA_VALIDATION_CONDITION_NOT_MATCH", + } + SchemaValidationCondition_value = map[string]int32{ + "SCHEMA_VALIDATION_CONDITION_UNKNOWN": 0, + "SCHEMA_VALIDATION_CONDITION_MATCH": 1, + "SCHEMA_VALIDATION_CONDITION_NOT_MATCH": 2, + } +) + +func (x SchemaValidationCondition) Enum() *SchemaValidationCondition { + p := new(SchemaValidationCondition) + *p = x + return p +} + +func (x SchemaValidationCondition) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SchemaValidationCondition) Descriptor() protoreflect.EnumDescriptor { + return file_steps_sp_steps_schema_validation_proto_enumTypes[1].Descriptor() +} + +func (SchemaValidationCondition) Type() protoreflect.EnumType { + return &file_steps_sp_steps_schema_validation_proto_enumTypes[1] +} + +func (x SchemaValidationCondition) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SchemaValidationCondition.Descriptor instead. +func (SchemaValidationCondition) EnumDescriptor() ([]byte, []int) { + return file_steps_sp_steps_schema_validation_proto_rawDescGZIP(), []int{1} +} + +type JSONSchemaDraft int32 + +const ( + // protolint:disable ENUM_FIELD_NAMES_UPPER_SNAKE_CASE + // protolint:disable ENUM_FIELD_NAMES_PREFIX + JSONSchemaDraft_JSONSCHEMA_DRAFT_UNKNOWN JSONSchemaDraft = 0 + JSONSchemaDraft_JSONSCHEMA_DRAFT_04 JSONSchemaDraft = 1 + JSONSchemaDraft_JSONSCHEMA_DRAFT_06 JSONSchemaDraft = 2 + JSONSchemaDraft_JSONSCHEMA_DRAFT_07 JSONSchemaDraft = 3 +) + +// Enum value maps for JSONSchemaDraft. +var ( + JSONSchemaDraft_name = map[int32]string{ + 0: "JSONSCHEMA_DRAFT_UNKNOWN", + 1: "JSONSCHEMA_DRAFT_04", + 2: "JSONSCHEMA_DRAFT_06", + 3: "JSONSCHEMA_DRAFT_07", + } + JSONSchemaDraft_value = map[string]int32{ + "JSONSCHEMA_DRAFT_UNKNOWN": 0, + "JSONSCHEMA_DRAFT_04": 1, + "JSONSCHEMA_DRAFT_06": 2, + "JSONSCHEMA_DRAFT_07": 3, + } +) + +func (x JSONSchemaDraft) Enum() *JSONSchemaDraft { + p := new(JSONSchemaDraft) + *p = x + return p +} + +func (x JSONSchemaDraft) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (JSONSchemaDraft) Descriptor() protoreflect.EnumDescriptor { + return file_steps_sp_steps_schema_validation_proto_enumTypes[2].Descriptor() +} + +func (JSONSchemaDraft) Type() protoreflect.EnumType { + return &file_steps_sp_steps_schema_validation_proto_enumTypes[2] +} + +func (x JSONSchemaDraft) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use JSONSchemaDraft.Descriptor instead. +func (JSONSchemaDraft) EnumDescriptor() ([]byte, []int) { + return file_steps_sp_steps_schema_validation_proto_rawDescGZIP(), []int{2} +} + +type SchemaValidationStep struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type SchemaValidationType `protobuf:"varint,1,opt,name=type,proto3,enum=protos.steps.SchemaValidationType" json:"type,omitempty"` + Condition SchemaValidationCondition `protobuf:"varint,2,opt,name=condition,proto3,enum=protos.steps.SchemaValidationCondition" json:"condition,omitempty"` + // Types that are assignable to Options: + // + // *SchemaValidationStep_JsonSchema + Options isSchemaValidationStep_Options `protobuf_oneof:"options"` +} + +func (x *SchemaValidationStep) Reset() { + *x = SchemaValidationStep{} + if protoimpl.UnsafeEnabled { + mi := &file_steps_sp_steps_schema_validation_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SchemaValidationStep) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SchemaValidationStep) ProtoMessage() {} + +func (x *SchemaValidationStep) ProtoReflect() protoreflect.Message { + mi := &file_steps_sp_steps_schema_validation_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SchemaValidationStep.ProtoReflect.Descriptor instead. +func (*SchemaValidationStep) Descriptor() ([]byte, []int) { + return file_steps_sp_steps_schema_validation_proto_rawDescGZIP(), []int{0} +} + +func (x *SchemaValidationStep) GetType() SchemaValidationType { + if x != nil { + return x.Type + } + return SchemaValidationType_SCHEMA_VALIDATION_TYPE_UNKNOWN +} + +func (x *SchemaValidationStep) GetCondition() SchemaValidationCondition { + if x != nil { + return x.Condition + } + return SchemaValidationCondition_SCHEMA_VALIDATION_CONDITION_UNKNOWN +} + +func (m *SchemaValidationStep) GetOptions() isSchemaValidationStep_Options { + if m != nil { + return m.Options + } + return nil +} + +func (x *SchemaValidationStep) GetJsonSchema() *SchemaValidationJSONSchema { + if x, ok := x.GetOptions().(*SchemaValidationStep_JsonSchema); ok { + return x.JsonSchema + } + return nil +} + +type isSchemaValidationStep_Options interface { + isSchemaValidationStep_Options() +} + +type SchemaValidationStep_JsonSchema struct { + JsonSchema *SchemaValidationJSONSchema `protobuf:"bytes,101,opt,name=json_schema,json=jsonSchema,proto3,oneof"` +} + +func (*SchemaValidationStep_JsonSchema) isSchemaValidationStep_Options() {} + +type SchemaValidationJSONSchema struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + JsonSchema []byte `protobuf:"bytes,1,opt,name=json_schema,json=jsonSchema,proto3" json:"json_schema,omitempty"` + Draft JSONSchemaDraft `protobuf:"varint,2,opt,name=draft,proto3,enum=protos.steps.JSONSchemaDraft" json:"draft,omitempty"` +} + +func (x *SchemaValidationJSONSchema) Reset() { + *x = SchemaValidationJSONSchema{} + if protoimpl.UnsafeEnabled { + mi := &file_steps_sp_steps_schema_validation_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SchemaValidationJSONSchema) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SchemaValidationJSONSchema) ProtoMessage() {} + +func (x *SchemaValidationJSONSchema) ProtoReflect() protoreflect.Message { + mi := &file_steps_sp_steps_schema_validation_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SchemaValidationJSONSchema.ProtoReflect.Descriptor instead. +func (*SchemaValidationJSONSchema) Descriptor() ([]byte, []int) { + return file_steps_sp_steps_schema_validation_proto_rawDescGZIP(), []int{1} +} + +func (x *SchemaValidationJSONSchema) GetJsonSchema() []byte { + if x != nil { + return x.JsonSchema + } + return nil +} + +func (x *SchemaValidationJSONSchema) GetDraft() JSONSchemaDraft { + if x != nil { + return x.Draft + } + return JSONSchemaDraft_JSONSCHEMA_DRAFT_UNKNOWN +} + +var File_steps_sp_steps_schema_validation_proto protoreflect.FileDescriptor + +var file_steps_sp_steps_schema_validation_proto_rawDesc = []byte{ + 0x0a, 0x26, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2f, 0x73, 0x70, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x73, + 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x22, 0xed, 0x01, 0x0a, 0x14, 0x53, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x65, 0x70, 0x12, + 0x36, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x22, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2e, 0x53, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, + 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x45, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, + 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4b, + 0x0a, 0x0b, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x65, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, + 0x70, 0x73, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, + 0x0a, 0x6a, 0x73, 0x6f, 0x6e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x42, 0x09, 0x0a, 0x07, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x72, 0x0a, 0x1a, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, + 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1f, 0x0a, 0x0b, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x73, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x6a, 0x73, 0x6f, 0x6e, 0x53, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x33, 0x0a, 0x05, 0x64, 0x72, 0x61, 0x66, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, + 0x65, 0x70, 0x73, 0x2e, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x44, 0x72, + 0x61, 0x66, 0x74, 0x52, 0x05, 0x64, 0x72, 0x61, 0x66, 0x74, 0x2a, 0x61, 0x0a, 0x14, 0x53, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x22, 0x0a, 0x1e, 0x53, 0x43, 0x48, 0x45, 0x4d, 0x41, 0x5f, 0x56, 0x41, 0x4c, + 0x49, 0x44, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, + 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x25, 0x0a, 0x21, 0x53, 0x43, 0x48, 0x45, 0x4d, 0x41, + 0x5f, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x43, 0x48, 0x45, 0x4d, 0x41, 0x10, 0x01, 0x2a, 0x96, 0x01, + 0x0a, 0x19, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x23, 0x53, + 0x43, 0x48, 0x45, 0x4d, 0x41, 0x5f, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x49, 0x4f, 0x4e, + 0x5f, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, + 0x57, 0x4e, 0x10, 0x00, 0x12, 0x25, 0x0a, 0x21, 0x53, 0x43, 0x48, 0x45, 0x4d, 0x41, 0x5f, 0x56, + 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, + 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x10, 0x01, 0x12, 0x29, 0x0a, 0x25, 0x53, + 0x43, 0x48, 0x45, 0x4d, 0x41, 0x5f, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x49, 0x4f, 0x4e, + 0x5f, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x4d, + 0x41, 0x54, 0x43, 0x48, 0x10, 0x02, 0x2a, 0x7a, 0x0a, 0x0f, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x44, 0x72, 0x61, 0x66, 0x74, 0x12, 0x1c, 0x0a, 0x18, 0x4a, 0x53, 0x4f, + 0x4e, 0x53, 0x43, 0x48, 0x45, 0x4d, 0x41, 0x5f, 0x44, 0x52, 0x41, 0x46, 0x54, 0x5f, 0x55, 0x4e, + 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x4a, 0x53, 0x4f, 0x4e, 0x53, + 0x43, 0x48, 0x45, 0x4d, 0x41, 0x5f, 0x44, 0x52, 0x41, 0x46, 0x54, 0x5f, 0x30, 0x34, 0x10, 0x01, + 0x12, 0x17, 0x0a, 0x13, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x43, 0x48, 0x45, 0x4d, 0x41, 0x5f, 0x44, + 0x52, 0x41, 0x46, 0x54, 0x5f, 0x30, 0x36, 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x4a, 0x53, 0x4f, + 0x4e, 0x53, 0x43, 0x48, 0x45, 0x4d, 0x41, 0x5f, 0x44, 0x52, 0x41, 0x46, 0x54, 0x5f, 0x30, 0x37, + 0x10, 0x03, 0x42, 0x42, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x6c, 0x69, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x2f, 0x73, 0x74, 0x65, 0x70, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_steps_sp_steps_schema_validation_proto_rawDescOnce sync.Once + file_steps_sp_steps_schema_validation_proto_rawDescData = file_steps_sp_steps_schema_validation_proto_rawDesc +) + +func file_steps_sp_steps_schema_validation_proto_rawDescGZIP() []byte { + file_steps_sp_steps_schema_validation_proto_rawDescOnce.Do(func() { + file_steps_sp_steps_schema_validation_proto_rawDescData = protoimpl.X.CompressGZIP(file_steps_sp_steps_schema_validation_proto_rawDescData) + }) + return file_steps_sp_steps_schema_validation_proto_rawDescData +} + +var file_steps_sp_steps_schema_validation_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_steps_sp_steps_schema_validation_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_steps_sp_steps_schema_validation_proto_goTypes = []interface{}{ + (SchemaValidationType)(0), // 0: protos.steps.SchemaValidationType + (SchemaValidationCondition)(0), // 1: protos.steps.SchemaValidationCondition + (JSONSchemaDraft)(0), // 2: protos.steps.JSONSchemaDraft + (*SchemaValidationStep)(nil), // 3: protos.steps.SchemaValidationStep + (*SchemaValidationJSONSchema)(nil), // 4: protos.steps.SchemaValidationJSONSchema +} +var file_steps_sp_steps_schema_validation_proto_depIdxs = []int32{ + 0, // 0: protos.steps.SchemaValidationStep.type:type_name -> protos.steps.SchemaValidationType + 1, // 1: protos.steps.SchemaValidationStep.condition:type_name -> protos.steps.SchemaValidationCondition + 4, // 2: protos.steps.SchemaValidationStep.json_schema:type_name -> protos.steps.SchemaValidationJSONSchema + 2, // 3: protos.steps.SchemaValidationJSONSchema.draft:type_name -> protos.steps.JSONSchemaDraft + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_steps_sp_steps_schema_validation_proto_init() } +func file_steps_sp_steps_schema_validation_proto_init() { + if File_steps_sp_steps_schema_validation_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_steps_sp_steps_schema_validation_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SchemaValidationStep); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_steps_sp_steps_schema_validation_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SchemaValidationJSONSchema); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_steps_sp_steps_schema_validation_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*SchemaValidationStep_JsonSchema)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_steps_sp_steps_schema_validation_proto_rawDesc, + NumEnums: 3, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_steps_sp_steps_schema_validation_proto_goTypes, + DependencyIndexes: file_steps_sp_steps_schema_validation_proto_depIdxs, + EnumInfos: file_steps_sp_steps_schema_validation_proto_enumTypes, + MessageInfos: file_steps_sp_steps_schema_validation_proto_msgTypes, + }.Build() + File_steps_sp_steps_schema_validation_proto = out.File + file_steps_sp_steps_schema_validation_proto_rawDesc = nil + file_steps_sp_steps_schema_validation_proto_goTypes = nil + file_steps_sp_steps_schema_validation_proto_depIdxs = nil +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_transform.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_transform.pb.go new file mode 100644 index 000000000..d0a57e7ae --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_transform.pb.go @@ -0,0 +1,892 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: steps/sp_steps_transform.proto + +package steps + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type TransformType int32 + +const ( + TransformType_TRANSFORM_TYPE_UNKNOWN TransformType = 0 + TransformType_TRANSFORM_TYPE_REPLACE_VALUE TransformType = 1 + TransformType_TRANSFORM_TYPE_DELETE_FIELD TransformType = 2 + TransformType_TRANSFORM_TYPE_OBFUSCATE_VALUE TransformType = 3 + TransformType_TRANSFORM_TYPE_MASK_VALUE TransformType = 4 + TransformType_TRANSFORM_TYPE_TRUNCATE_VALUE TransformType = 5 + TransformType_TRANSFORM_TYPE_EXTRACT TransformType = 6 +) + +// Enum value maps for TransformType. +var ( + TransformType_name = map[int32]string{ + 0: "TRANSFORM_TYPE_UNKNOWN", + 1: "TRANSFORM_TYPE_REPLACE_VALUE", + 2: "TRANSFORM_TYPE_DELETE_FIELD", + 3: "TRANSFORM_TYPE_OBFUSCATE_VALUE", + 4: "TRANSFORM_TYPE_MASK_VALUE", + 5: "TRANSFORM_TYPE_TRUNCATE_VALUE", + 6: "TRANSFORM_TYPE_EXTRACT", + } + TransformType_value = map[string]int32{ + "TRANSFORM_TYPE_UNKNOWN": 0, + "TRANSFORM_TYPE_REPLACE_VALUE": 1, + "TRANSFORM_TYPE_DELETE_FIELD": 2, + "TRANSFORM_TYPE_OBFUSCATE_VALUE": 3, + "TRANSFORM_TYPE_MASK_VALUE": 4, + "TRANSFORM_TYPE_TRUNCATE_VALUE": 5, + "TRANSFORM_TYPE_EXTRACT": 6, + } +) + +func (x TransformType) Enum() *TransformType { + p := new(TransformType) + *p = x + return p +} + +func (x TransformType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TransformType) Descriptor() protoreflect.EnumDescriptor { + return file_steps_sp_steps_transform_proto_enumTypes[0].Descriptor() +} + +func (TransformType) Type() protoreflect.EnumType { + return &file_steps_sp_steps_transform_proto_enumTypes[0] +} + +func (x TransformType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TransformType.Descriptor instead. +func (TransformType) EnumDescriptor() ([]byte, []int) { + return file_steps_sp_steps_transform_proto_rawDescGZIP(), []int{0} +} + +type TransformTruncateType int32 + +const ( + TransformTruncateType_TRANSFORM_TRUNCATE_TYPE_UNKNOWN TransformTruncateType = 0 + TransformTruncateType_TRANSFORM_TRUNCATE_TYPE_LENGTH TransformTruncateType = 1 + TransformTruncateType_TRANSFORM_TRUNCATE_TYPE_PERCENTAGE TransformTruncateType = 2 +) + +// Enum value maps for TransformTruncateType. +var ( + TransformTruncateType_name = map[int32]string{ + 0: "TRANSFORM_TRUNCATE_TYPE_UNKNOWN", + 1: "TRANSFORM_TRUNCATE_TYPE_LENGTH", + 2: "TRANSFORM_TRUNCATE_TYPE_PERCENTAGE", + } + TransformTruncateType_value = map[string]int32{ + "TRANSFORM_TRUNCATE_TYPE_UNKNOWN": 0, + "TRANSFORM_TRUNCATE_TYPE_LENGTH": 1, + "TRANSFORM_TRUNCATE_TYPE_PERCENTAGE": 2, + } +) + +func (x TransformTruncateType) Enum() *TransformTruncateType { + p := new(TransformTruncateType) + *p = x + return p +} + +func (x TransformTruncateType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TransformTruncateType) Descriptor() protoreflect.EnumDescriptor { + return file_steps_sp_steps_transform_proto_enumTypes[1].Descriptor() +} + +func (TransformTruncateType) Type() protoreflect.EnumType { + return &file_steps_sp_steps_transform_proto_enumTypes[1] +} + +func (x TransformTruncateType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TransformTruncateType.Descriptor instead. +func (TransformTruncateType) EnumDescriptor() ([]byte, []int) { + return file_steps_sp_steps_transform_proto_rawDescGZIP(), []int{1} +} + +type TransformStep struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Deprecated: Marked as deprecated in steps/sp_steps_transform.proto. + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + // Deprecated: Marked as deprecated in steps/sp_steps_transform.proto. + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` // Should this be bytes? ~DS + Type TransformType `protobuf:"varint,3,opt,name=type,proto3,enum=protos.steps.TransformType" json:"type,omitempty"` + // Types that are assignable to Options: + // + // *TransformStep_ReplaceValueOptions + // *TransformStep_DeleteFieldOptions + // *TransformStep_ObfuscateOptions + // *TransformStep_MaskOptions + // *TransformStep_TruncateOptions + // *TransformStep_ExtractOptions + Options isTransformStep_Options `protobuf_oneof:"options"` +} + +func (x *TransformStep) Reset() { + *x = TransformStep{} + if protoimpl.UnsafeEnabled { + mi := &file_steps_sp_steps_transform_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TransformStep) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TransformStep) ProtoMessage() {} + +func (x *TransformStep) ProtoReflect() protoreflect.Message { + mi := &file_steps_sp_steps_transform_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TransformStep.ProtoReflect.Descriptor instead. +func (*TransformStep) Descriptor() ([]byte, []int) { + return file_steps_sp_steps_transform_proto_rawDescGZIP(), []int{0} +} + +// Deprecated: Marked as deprecated in steps/sp_steps_transform.proto. +func (x *TransformStep) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +// Deprecated: Marked as deprecated in steps/sp_steps_transform.proto. +func (x *TransformStep) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +func (x *TransformStep) GetType() TransformType { + if x != nil { + return x.Type + } + return TransformType_TRANSFORM_TYPE_UNKNOWN +} + +func (m *TransformStep) GetOptions() isTransformStep_Options { + if m != nil { + return m.Options + } + return nil +} + +func (x *TransformStep) GetReplaceValueOptions() *TransformReplaceValueOptions { + if x, ok := x.GetOptions().(*TransformStep_ReplaceValueOptions); ok { + return x.ReplaceValueOptions + } + return nil +} + +func (x *TransformStep) GetDeleteFieldOptions() *TransformDeleteFieldOptions { + if x, ok := x.GetOptions().(*TransformStep_DeleteFieldOptions); ok { + return x.DeleteFieldOptions + } + return nil +} + +func (x *TransformStep) GetObfuscateOptions() *TransformObfuscateOptions { + if x, ok := x.GetOptions().(*TransformStep_ObfuscateOptions); ok { + return x.ObfuscateOptions + } + return nil +} + +func (x *TransformStep) GetMaskOptions() *TransformMaskOptions { + if x, ok := x.GetOptions().(*TransformStep_MaskOptions); ok { + return x.MaskOptions + } + return nil +} + +func (x *TransformStep) GetTruncateOptions() *TransformTruncateOptions { + if x, ok := x.GetOptions().(*TransformStep_TruncateOptions); ok { + return x.TruncateOptions + } + return nil +} + +func (x *TransformStep) GetExtractOptions() *TransformExtractOptions { + if x, ok := x.GetOptions().(*TransformStep_ExtractOptions); ok { + return x.ExtractOptions + } + return nil +} + +type isTransformStep_Options interface { + isTransformStep_Options() +} + +type TransformStep_ReplaceValueOptions struct { + // Replace the value of a field with a new value + ReplaceValueOptions *TransformReplaceValueOptions `protobuf:"bytes,101,opt,name=replace_value_options,json=replaceValueOptions,proto3,oneof"` +} + +type TransformStep_DeleteFieldOptions struct { + // Delete a field from a JSON payload + DeleteFieldOptions *TransformDeleteFieldOptions `protobuf:"bytes,102,opt,name=delete_field_options,json=deleteFieldOptions,proto3,oneof"` +} + +type TransformStep_ObfuscateOptions struct { + // Obfuscate hashes the value of a field with sha256 + ObfuscateOptions *TransformObfuscateOptions `protobuf:"bytes,103,opt,name=obfuscate_options,json=obfuscateOptions,proto3,oneof"` +} + +type TransformStep_MaskOptions struct { + // Mask part of a field's value with the given character + MaskOptions *TransformMaskOptions `protobuf:"bytes,104,opt,name=mask_options,json=maskOptions,proto3,oneof"` +} + +type TransformStep_TruncateOptions struct { + // Truncate the value of a field to a maximum number of characters, + // or to a percentage of characters based on the field length + TruncateOptions *TransformTruncateOptions `protobuf:"bytes,105,opt,name=truncate_options,json=truncateOptions,proto3,oneof"` +} + +type TransformStep_ExtractOptions struct { + // Extract one or multiple values from a payload + ExtractOptions *TransformExtractOptions `protobuf:"bytes,106,opt,name=extract_options,json=extractOptions,proto3,oneof"` +} + +func (*TransformStep_ReplaceValueOptions) isTransformStep_Options() {} + +func (*TransformStep_DeleteFieldOptions) isTransformStep_Options() {} + +func (*TransformStep_ObfuscateOptions) isTransformStep_Options() {} + +func (*TransformStep_MaskOptions) isTransformStep_Options() {} + +func (*TransformStep_TruncateOptions) isTransformStep_Options() {} + +func (*TransformStep_ExtractOptions) isTransformStep_Options() {} + +type TransformTruncateOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type TransformTruncateType `protobuf:"varint,1,opt,name=type,proto3,enum=protos.steps.TransformTruncateType" json:"type,omitempty"` + Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` + // Truncate after this many bytes or this percentage of the original value + Value int32 `protobuf:"varint,3,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *TransformTruncateOptions) Reset() { + *x = TransformTruncateOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_steps_sp_steps_transform_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TransformTruncateOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TransformTruncateOptions) ProtoMessage() {} + +func (x *TransformTruncateOptions) ProtoReflect() protoreflect.Message { + mi := &file_steps_sp_steps_transform_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TransformTruncateOptions.ProtoReflect.Descriptor instead. +func (*TransformTruncateOptions) Descriptor() ([]byte, []int) { + return file_steps_sp_steps_transform_proto_rawDescGZIP(), []int{1} +} + +func (x *TransformTruncateOptions) GetType() TransformTruncateType { + if x != nil { + return x.Type + } + return TransformTruncateType_TRANSFORM_TRUNCATE_TYPE_UNKNOWN +} + +func (x *TransformTruncateOptions) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *TransformTruncateOptions) GetValue() int32 { + if x != nil { + return x.Value + } + return 0 +} + +type TransformDeleteFieldOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Paths []string `protobuf:"bytes,1,rep,name=paths,proto3" json:"paths,omitempty"` +} + +func (x *TransformDeleteFieldOptions) Reset() { + *x = TransformDeleteFieldOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_steps_sp_steps_transform_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TransformDeleteFieldOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TransformDeleteFieldOptions) ProtoMessage() {} + +func (x *TransformDeleteFieldOptions) ProtoReflect() protoreflect.Message { + mi := &file_steps_sp_steps_transform_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TransformDeleteFieldOptions.ProtoReflect.Descriptor instead. +func (*TransformDeleteFieldOptions) Descriptor() ([]byte, []int) { + return file_steps_sp_steps_transform_proto_rawDescGZIP(), []int{2} +} + +func (x *TransformDeleteFieldOptions) GetPaths() []string { + if x != nil { + return x.Paths + } + return nil +} + +type TransformReplaceValueOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *TransformReplaceValueOptions) Reset() { + *x = TransformReplaceValueOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_steps_sp_steps_transform_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TransformReplaceValueOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TransformReplaceValueOptions) ProtoMessage() {} + +func (x *TransformReplaceValueOptions) ProtoReflect() protoreflect.Message { + mi := &file_steps_sp_steps_transform_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TransformReplaceValueOptions.ProtoReflect.Descriptor instead. +func (*TransformReplaceValueOptions) Descriptor() ([]byte, []int) { + return file_steps_sp_steps_transform_proto_rawDescGZIP(), []int{3} +} + +func (x *TransformReplaceValueOptions) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *TransformReplaceValueOptions) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +type TransformObfuscateOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` +} + +func (x *TransformObfuscateOptions) Reset() { + *x = TransformObfuscateOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_steps_sp_steps_transform_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TransformObfuscateOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TransformObfuscateOptions) ProtoMessage() {} + +func (x *TransformObfuscateOptions) ProtoReflect() protoreflect.Message { + mi := &file_steps_sp_steps_transform_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TransformObfuscateOptions.ProtoReflect.Descriptor instead. +func (*TransformObfuscateOptions) Descriptor() ([]byte, []int) { + return file_steps_sp_steps_transform_proto_rawDescGZIP(), []int{4} +} + +func (x *TransformObfuscateOptions) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +type TransformMaskOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + Mask string `protobuf:"bytes,2,opt,name=mask,proto3" json:"mask,omitempty"` +} + +func (x *TransformMaskOptions) Reset() { + *x = TransformMaskOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_steps_sp_steps_transform_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TransformMaskOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TransformMaskOptions) ProtoMessage() {} + +func (x *TransformMaskOptions) ProtoReflect() protoreflect.Message { + mi := &file_steps_sp_steps_transform_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TransformMaskOptions.ProtoReflect.Descriptor instead. +func (*TransformMaskOptions) Descriptor() ([]byte, []int) { + return file_steps_sp_steps_transform_proto_rawDescGZIP(), []int{5} +} + +func (x *TransformMaskOptions) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *TransformMaskOptions) GetMask() string { + if x != nil { + return x.Mask + } + return "" +} + +type TransformExtractOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Paths []string `protobuf:"bytes,1,rep,name=paths,proto3" json:"paths,omitempty"` + Flatten bool `protobuf:"varint,2,opt,name=flatten,proto3" json:"flatten,omitempty"` +} + +func (x *TransformExtractOptions) Reset() { + *x = TransformExtractOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_steps_sp_steps_transform_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TransformExtractOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TransformExtractOptions) ProtoMessage() {} + +func (x *TransformExtractOptions) ProtoReflect() protoreflect.Message { + mi := &file_steps_sp_steps_transform_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TransformExtractOptions.ProtoReflect.Descriptor instead. +func (*TransformExtractOptions) Descriptor() ([]byte, []int) { + return file_steps_sp_steps_transform_proto_rawDescGZIP(), []int{6} +} + +func (x *TransformExtractOptions) GetPaths() []string { + if x != nil { + return x.Paths + } + return nil +} + +func (x *TransformExtractOptions) GetFlatten() bool { + if x != nil { + return x.Flatten + } + return false +} + +var File_steps_sp_steps_transform_proto protoreflect.FileDescriptor + +var file_steps_sp_steps_transform_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2f, 0x73, 0x70, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x73, + 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x0c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x22, 0x86, + 0x05, 0x0a, 0x0d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x74, 0x65, 0x70, + 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x02, + 0x18, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x02, 0x18, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2e, + 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x12, 0x60, 0x0a, 0x15, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x5f, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x65, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, + 0x73, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x52, 0x65, 0x70, 0x6c, 0x61, + 0x63, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x00, + 0x52, 0x13, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x5d, 0x0a, 0x14, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x5f, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x66, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, + 0x70, 0x73, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x00, + 0x52, 0x12, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x56, 0x0a, 0x11, 0x6f, 0x62, 0x66, 0x75, 0x73, 0x63, 0x61, 0x74, + 0x65, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x67, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x27, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2e, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x4f, 0x62, 0x66, 0x75, 0x73, 0x63, 0x61, 0x74, + 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x10, 0x6f, 0x62, 0x66, 0x75, + 0x73, 0x63, 0x61, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x47, 0x0a, 0x0c, + 0x6d, 0x61, 0x73, 0x6b, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x68, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, + 0x73, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x4d, 0x61, 0x73, 0x6b, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x0b, 0x6d, 0x61, 0x73, 0x6b, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x53, 0x0a, 0x10, 0x74, 0x72, 0x75, 0x6e, 0x63, 0x61, 0x74, + 0x65, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x69, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x26, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2e, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x54, 0x72, 0x75, 0x6e, 0x63, 0x61, 0x74, 0x65, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x0f, 0x74, 0x72, 0x75, 0x6e, 0x63, + 0x61, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x50, 0x0a, 0x0f, 0x65, 0x78, + 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x6a, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, + 0x70, 0x73, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x45, 0x78, 0x74, 0x72, + 0x61, 0x63, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x0e, 0x65, 0x78, + 0x74, 0x72, 0x61, 0x63, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x09, 0x0a, 0x07, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x7d, 0x0a, 0x18, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x66, 0x6f, 0x72, 0x6d, 0x54, 0x72, 0x75, 0x6e, 0x63, 0x61, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x37, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, + 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x54, 0x72, 0x75, 0x6e, 0x63, 0x61, + 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, + 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x33, 0x0a, 0x1b, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, + 0x6f, 0x72, 0x6d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x22, 0x48, 0x0a, 0x1c, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70, + 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x2f, 0x0a, 0x19, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, + 0x72, 0x6d, 0x4f, 0x62, 0x66, 0x75, 0x73, 0x63, 0x61, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x3e, 0x0a, 0x14, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, + 0x6f, 0x72, 0x6d, 0x4d, 0x61, 0x73, 0x6b, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x12, + 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, + 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6d, 0x61, 0x73, 0x6b, 0x22, 0x49, 0x0a, 0x17, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, + 0x6f, 0x72, 0x6d, 0x45, 0x78, 0x74, 0x72, 0x61, 0x63, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x6c, 0x61, 0x74, 0x74, + 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, + 0x6e, 0x2a, 0xf0, 0x01, 0x0a, 0x0d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x46, 0x4f, 0x52, 0x4d, + 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, + 0x20, 0x0a, 0x1c, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x46, 0x4f, 0x52, 0x4d, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x52, 0x45, 0x50, 0x4c, 0x41, 0x43, 0x45, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x10, + 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x46, 0x4f, 0x52, 0x4d, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x5f, 0x46, 0x49, 0x45, 0x4c, 0x44, + 0x10, 0x02, 0x12, 0x22, 0x0a, 0x1e, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x46, 0x4f, 0x52, 0x4d, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4f, 0x42, 0x46, 0x55, 0x53, 0x43, 0x41, 0x54, 0x45, 0x5f, 0x56, + 0x41, 0x4c, 0x55, 0x45, 0x10, 0x03, 0x12, 0x1d, 0x0a, 0x19, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x46, + 0x4f, 0x52, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x41, 0x53, 0x4b, 0x5f, 0x56, 0x41, + 0x4c, 0x55, 0x45, 0x10, 0x04, 0x12, 0x21, 0x0a, 0x1d, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x46, 0x4f, + 0x52, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x52, 0x55, 0x4e, 0x43, 0x41, 0x54, 0x45, + 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x10, 0x05, 0x12, 0x1a, 0x0a, 0x16, 0x54, 0x52, 0x41, 0x4e, + 0x53, 0x46, 0x4f, 0x52, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x54, 0x52, 0x41, + 0x43, 0x54, 0x10, 0x06, 0x2a, 0x88, 0x01, 0x0a, 0x15, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, + 0x72, 0x6d, 0x54, 0x72, 0x75, 0x6e, 0x63, 0x61, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x23, + 0x0a, 0x1f, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x46, 0x4f, 0x52, 0x4d, 0x5f, 0x54, 0x52, 0x55, 0x4e, + 0x43, 0x41, 0x54, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, + 0x4e, 0x10, 0x00, 0x12, 0x22, 0x0a, 0x1e, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x46, 0x4f, 0x52, 0x4d, + 0x5f, 0x54, 0x52, 0x55, 0x4e, 0x43, 0x41, 0x54, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4c, + 0x45, 0x4e, 0x47, 0x54, 0x48, 0x10, 0x01, 0x12, 0x26, 0x0a, 0x22, 0x54, 0x52, 0x41, 0x4e, 0x53, + 0x46, 0x4f, 0x52, 0x4d, 0x5f, 0x54, 0x52, 0x55, 0x4e, 0x43, 0x41, 0x54, 0x45, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x50, 0x45, 0x52, 0x43, 0x45, 0x4e, 0x54, 0x41, 0x47, 0x45, 0x10, 0x02, 0x42, + 0x42, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, + 0x6c, 0x2f, 0x6c, 0x69, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x62, 0x75, + 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x73, 0x74, + 0x65, 0x70, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_steps_sp_steps_transform_proto_rawDescOnce sync.Once + file_steps_sp_steps_transform_proto_rawDescData = file_steps_sp_steps_transform_proto_rawDesc +) + +func file_steps_sp_steps_transform_proto_rawDescGZIP() []byte { + file_steps_sp_steps_transform_proto_rawDescOnce.Do(func() { + file_steps_sp_steps_transform_proto_rawDescData = protoimpl.X.CompressGZIP(file_steps_sp_steps_transform_proto_rawDescData) + }) + return file_steps_sp_steps_transform_proto_rawDescData +} + +var file_steps_sp_steps_transform_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_steps_sp_steps_transform_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_steps_sp_steps_transform_proto_goTypes = []interface{}{ + (TransformType)(0), // 0: protos.steps.TransformType + (TransformTruncateType)(0), // 1: protos.steps.TransformTruncateType + (*TransformStep)(nil), // 2: protos.steps.TransformStep + (*TransformTruncateOptions)(nil), // 3: protos.steps.TransformTruncateOptions + (*TransformDeleteFieldOptions)(nil), // 4: protos.steps.TransformDeleteFieldOptions + (*TransformReplaceValueOptions)(nil), // 5: protos.steps.TransformReplaceValueOptions + (*TransformObfuscateOptions)(nil), // 6: protos.steps.TransformObfuscateOptions + (*TransformMaskOptions)(nil), // 7: protos.steps.TransformMaskOptions + (*TransformExtractOptions)(nil), // 8: protos.steps.TransformExtractOptions +} +var file_steps_sp_steps_transform_proto_depIdxs = []int32{ + 0, // 0: protos.steps.TransformStep.type:type_name -> protos.steps.TransformType + 5, // 1: protos.steps.TransformStep.replace_value_options:type_name -> protos.steps.TransformReplaceValueOptions + 4, // 2: protos.steps.TransformStep.delete_field_options:type_name -> protos.steps.TransformDeleteFieldOptions + 6, // 3: protos.steps.TransformStep.obfuscate_options:type_name -> protos.steps.TransformObfuscateOptions + 7, // 4: protos.steps.TransformStep.mask_options:type_name -> protos.steps.TransformMaskOptions + 3, // 5: protos.steps.TransformStep.truncate_options:type_name -> protos.steps.TransformTruncateOptions + 8, // 6: protos.steps.TransformStep.extract_options:type_name -> protos.steps.TransformExtractOptions + 1, // 7: protos.steps.TransformTruncateOptions.type:type_name -> protos.steps.TransformTruncateType + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name +} + +func init() { file_steps_sp_steps_transform_proto_init() } +func file_steps_sp_steps_transform_proto_init() { + if File_steps_sp_steps_transform_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_steps_sp_steps_transform_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TransformStep); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_steps_sp_steps_transform_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TransformTruncateOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_steps_sp_steps_transform_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TransformDeleteFieldOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_steps_sp_steps_transform_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TransformReplaceValueOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_steps_sp_steps_transform_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TransformObfuscateOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_steps_sp_steps_transform_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TransformMaskOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_steps_sp_steps_transform_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TransformExtractOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_steps_sp_steps_transform_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*TransformStep_ReplaceValueOptions)(nil), + (*TransformStep_DeleteFieldOptions)(nil), + (*TransformStep_ObfuscateOptions)(nil), + (*TransformStep_MaskOptions)(nil), + (*TransformStep_TruncateOptions)(nil), + (*TransformStep_ExtractOptions)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_steps_sp_steps_transform_proto_rawDesc, + NumEnums: 2, + NumMessages: 7, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_steps_sp_steps_transform_proto_goTypes, + DependencyIndexes: file_steps_sp_steps_transform_proto_depIdxs, + EnumInfos: file_steps_sp_steps_transform_proto_enumTypes, + MessageInfos: file_steps_sp_steps_transform_proto_msgTypes, + }.Build() + File_steps_sp_steps_transform_proto = out.File + file_steps_sp_steps_transform_proto_rawDesc = nil + file_steps_sp_steps_transform_proto_goTypes = nil + file_steps_sp_steps_transform_proto_depIdxs = nil +} diff --git a/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_valid_json.pb.go b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_valid_json.pb.go new file mode 100644 index 000000000..edc842f87 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/libs/protos/build/go/protos/steps/sp_steps_valid_json.pb.go @@ -0,0 +1,136 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: steps/sp_steps_valid_json.proto + +package steps + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ValidJSONStep struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ValidJSONStep) Reset() { + *x = ValidJSONStep{} + if protoimpl.UnsafeEnabled { + mi := &file_steps_sp_steps_valid_json_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ValidJSONStep) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ValidJSONStep) ProtoMessage() {} + +func (x *ValidJSONStep) ProtoReflect() protoreflect.Message { + mi := &file_steps_sp_steps_valid_json_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ValidJSONStep.ProtoReflect.Descriptor instead. +func (*ValidJSONStep) Descriptor() ([]byte, []int) { + return file_steps_sp_steps_valid_json_proto_rawDescGZIP(), []int{0} +} + +var File_steps_sp_steps_valid_json_proto protoreflect.FileDescriptor + +var file_steps_sp_steps_valid_json_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x73, 0x74, 0x65, 0x70, 0x73, 0x2f, 0x73, 0x70, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x73, + 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x0c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x65, 0x70, 0x73, 0x22, + 0x0f, 0x0a, 0x0d, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x74, 0x65, 0x70, + 0x42, 0x42, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, 0x61, 0x6c, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x64, + 0x61, 0x6c, 0x2f, 0x6c, 0x69, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x62, + 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x73, + 0x74, 0x65, 0x70, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_steps_sp_steps_valid_json_proto_rawDescOnce sync.Once + file_steps_sp_steps_valid_json_proto_rawDescData = file_steps_sp_steps_valid_json_proto_rawDesc +) + +func file_steps_sp_steps_valid_json_proto_rawDescGZIP() []byte { + file_steps_sp_steps_valid_json_proto_rawDescOnce.Do(func() { + file_steps_sp_steps_valid_json_proto_rawDescData = protoimpl.X.CompressGZIP(file_steps_sp_steps_valid_json_proto_rawDescData) + }) + return file_steps_sp_steps_valid_json_proto_rawDescData +} + +var file_steps_sp_steps_valid_json_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_steps_sp_steps_valid_json_proto_goTypes = []interface{}{ + (*ValidJSONStep)(nil), // 0: protos.steps.ValidJSONStep +} +var file_steps_sp_steps_valid_json_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_steps_sp_steps_valid_json_proto_init() } +func file_steps_sp_steps_valid_json_proto_init() { + if File_steps_sp_steps_valid_json_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_steps_sp_steps_valid_json_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ValidJSONStep); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_steps_sp_steps_valid_json_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_steps_sp_steps_valid_json_proto_goTypes, + DependencyIndexes: file_steps_sp_steps_valid_json_proto_depIdxs, + MessageInfos: file_steps_sp_steps_valid_json_proto_msgTypes, + }.Build() + File_steps_sp_steps_valid_json_proto = out.File + file_steps_sp_steps_valid_json_proto_rawDesc = nil + file_steps_sp_steps_valid_json_proto_goTypes = nil + file_steps_sp_steps_valid_json_proto_depIdxs = nil +} diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/.gitignore b/vendor/github.com/streamdal/streamdal/sdks/go/.gitignore new file mode 100644 index 000000000..b51f3c93a --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/.gitignore @@ -0,0 +1,6 @@ +.idea +src/*.wasm +src/version.txt +c.out +test-assets/wasm/*.wasm +test-assets/wasm/version.txt \ No newline at end of file diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/BENCHMARKS.md b/vendor/github.com/streamdal/streamdal/sdks/go/BENCHMARKS.md new file mode 100644 index 000000000..e08bec512 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/BENCHMARKS.md @@ -0,0 +1,47 @@ +# WASM Benchmarks + +***Up to date as of 2023-10-30*** + +All benchmarks include marshal/unmarshal of `WASMRequest` and `WASMResponse` respectively + +*inferschema* + +```bash +go test -bench=. + +goos: darwin +goarch: arm64 +pkg: github.com/streamdal/go-sdk +BenchmarkInferSchema_FreshSchema/small.json-8 15450 77007 ns/op +BenchmarkInferSchema_FreshSchema/medium.json-8 2151 554466 ns/op +BenchmarkInferSchema_FreshSchema/large.json-8 256 4670424 ns/op +BenchmarkInferSchema_MatchExisting/small.json-8 13224 89757 ns/op +BenchmarkInferSchema_MatchExisting/medium.json-8 2082 567770 ns/op +BenchmarkInferSchema_MatchExisting/large.json-8 254 4711179 ns/op +``` + +*transform* + +```bash +go test -bench=. + +goos: darwin +goarch: arm64 +pkg: github.com/streamdal/go-sdk +BenchmarkTransform_Replace/small.json-8 110710 10787 ns/op +BenchmarkTransform_Replace/medium.json-8 15782 77025 ns/op +BenchmarkTransform_Replace/large.json-8 1756 671757 ns/op +``` + +*search/match field values* + +```bash +go test -bench=. + +goos: darwin +goarch: arm64 +pkg: github.com/streamdal/go-sdk +BenchmarkDetective/small.json-8 249192 4647 ns/op +BenchmarkDetective/medium.json-8 67258 18027 ns/op +BenchmarkDetective/large.json-8 7782 136151 ns/op +``` diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/LICENSE b/vendor/github.com/streamdal/streamdal/sdks/go/LICENSE new file mode 100644 index 000000000..43b96d5ca --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/LICENSE @@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2023 Streamdal + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/Makefile b/vendor/github.com/streamdal/streamdal/sdks/go/Makefile new file mode 100644 index 000000000..02b058b80 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/Makefile @@ -0,0 +1,42 @@ +# Pattern #1 example: "example : description = Description for example target" +# Pattern #2 example: "### Example separator text +help: HELP_SCRIPT = \ + if (/^([a-zA-Z0-9-\.\/]+).*?: description\s*=\s*(.+)/) { \ + printf "\033[34m%-40s\033[0m %s\n", $$1, $$2 \ + } elsif(/^\#\#\#\s*(.+)/) { \ + printf "\033[33m>> %s\033[0m\n", $$1 \ + } + +.PHONY: help +help: + @perl -ne '$(HELP_SCRIPT)' $(MAKEFILE_LIST) + +.PHONY: setup/darwin +setup/darwin: description = Install toolkit for building on macOS M1 +setup/darwin: + brew install tinygo wasmtime + +.PHONY: test +test: description = Run all tests +test: + bash ./init_wasm.sh + go test ./... -v + +.PHONY: test/fakes +test/fakes: description = Generate all fakes +test/fakes: + go generate ./... + + +.PHONY: test/coverage +test/coverage: description = Run all tests +test/coverage: + bash ./init_wasm.sh + go test -coverprofile=c.out `go list ./... | grep -v fake` + +.PHONY: test/benchmark +test/benchmark: description = Run all benchmarks +test/benchmark: + bash ./init_wasm.sh + go test -bench=. -run=^# + diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/README.md b/vendor/github.com/streamdal/streamdal/sdks/go/README.md new file mode 100644 index 000000000..f51671c9a --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/README.md @@ -0,0 +1,118 @@ +Streamdal Go SDK +================ +[![Release](https://github.com/streamdal/streamdal/actions/workflows/sdks-go-release.yml/badge.svg)](https://github.com/streamdal/streamdal/actions/workflows/sdks-go-release.yml) +[![Pull Request](https://github.com/streamdal/streamdal/actions/workflows/sdks-go-detective-pr.yml/badge.svg)](https://github.com/streamdal/streamdal/blob/main/.github/workflows/sdks-go-detective-pr.yml) +[![Discord](https://img.shields.io/badge/Community-Discord-4c57e8.svg)](https://discord.gg/streamdal) + + + + + + +_**Golang SDK for [Streamdal](https://streamdal.com).**_ + +For more details, see the main +[streamdal repo](https://github.com/streamdal/streamdal). + +--- + +### Documentation + +See https://docs.streamdal.com + +### Installation + +```bash +go get github.com/streamdal/streamdal/sdks/go +``` + +### Example Usage + +```go +package main + +import ( + "fmt" + "time" + + streamdal "github.com/streamdal/streamdal/sdks/go" +) + +func main() { + sc, _ := streamdal.New(&streamdal.Config{ + // Address of the streamdal server + gRPC API port + ServerURL: "streamdal-server-address:8082", + + // Token used for authenticating with the streamdal server + ServerToken: "1234", + + // Identify _this_ application/service ( + ServiceName: "billing-svc", + }) + + resp := sc.Process(context.Background(), &streamdal.ProcessRequest{ + OperationType: streamdal.OperationTypeConsumer, + OperationName: "new-order-topic", + ComponentName: "kafka", + Data: []byte(`{"object": {"field": true}}`), + }) + + // Check if the .Process() call completed + if resp.Status != streamdal.ExecStatusError { + fmt.Println("Successfully processed payload") + } + + // Or you can inspect each individual pipeline & step result + for _, pipeline := range resp.PipelineStatus { + fmt.Printf("Inspecting '%d' steps in pipeline '%s'...\n", len(resp.PipelineStatus), pipeline.Name) + + for _, step := range pipeline.StepStatus { + fmt.Printf("Step '%s' status: '%s'\n", step.Name, step.Status) + } + } + + // The SDK needs ~3 seconds to start up which will perform initial registration + // with server + pull pipelines. Since this is not a long running app, we + // want to prevent a fast exit. + time.Sleep(5 * time.Second) +} +``` + +### Configuration + +All configuration can be passed via `streamdal.Config{}`. Some values can be set via environment variables in +order to support 12-Factor and usage of this SDK inside shims where `streamdal.Config{}` cannot be set. + +| Config Parameter | Environment Variable | Description | Default | +|------------------|----------------------------|----------------------------------------------------------------------------------|---------------| +| ServerURL | STREAMDAL_URL | URL pointing to your instance of streamdal server's gRPC API. Ex: localhost:8082 | *empty* | +| ServerToken | STREAMDAL_TOKEN | API token set in streamdal server | *empty* | +| ServiceName | STREAMDAL_SERVICE_NAME | Identifies this service in the streamdal console | *empty* | +| PipelineTimeout | STREAMDAL_PIPELINE_TIMEOUT | Maximum time a pipeline can run before giving up | 100ms | +| StepTimeout | STREAMDAL_STEP_TIMEOUT | Maximum time a pipeline step can run before giving up | 10ms | +| DryRun | STREAMDAL_DRY_RUN | If true, no data will be modified | *false* | +| Logger | | An optional custom logger | | +| ClientType | | 1 = ClientTypeSDK, 2 = ClientTypeShim | ClientTypeSDK | +| ShutdownCtx | - | Your application's main context which will receive shutdown signals | | + +### Metrics + +Metrics are published to Streamdal server and are available in Prometheus format at http://streamdal_server_url:8081/metrics + +| Metric | Description | Labels | +|----------------------------------------------|--------------------------------------------------|-------------------------------------------------------------------------------| +| `streamdal_counter_consume_bytes` | Number of bytes consumed by the client | `service`, `component_name`, `operation_name`, `pipeline_id`, `pipeline_name` | +| `streamdal_counter_consume_errors` | Number of errors encountered while consuming payloads | `service`, `component_name`, `operation_name`, `pipeline_id`, `pipeline_name` | +| `streamdal_counter_consume_processed` | Number of payloads processed by the client | `service`, `component_name`, `operation_name`, `pipeline_id`, `pipeline_name` | +| `streamdal_counter_produce_bytes` | Number of bytes produced by the client | `service`, `component_name`, `operation_name`, `pipeline_id`, `pipeline_name` | +| `streamdal_counter_produce_errors` | Number of errors encountered while producing payloads | `service`, `component_name`, `operation_name`, `pipeline_id`, `pipeline_name` | +| `streamdal_counter_produce_processed` | Number of payloads processed by the client | `service`, `component_name`, `operation_name`, `pipeline_id`, `pipeline_name` | +| `streamdal_counter_notify` | Number of notifications sent to the server | `service`, `component_name`, `operation_name`, `pipeline_id`, `pipeline_name` | + +## Release + +Any push or merge to the `main` branch with any changes in `/sdks/go/*` +will automatically tag and release a new console version with `sdks/go/vX.Y.Z`. + +(1) If you'd like to skip running the release action on push/merge to `main`, +include `norelease` anywhere in the commit message. diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/audience.go b/vendor/github.com/streamdal/streamdal/sdks/go/audience.go new file mode 100644 index 000000000..e07d414eb --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/audience.go @@ -0,0 +1,114 @@ +package streamdal + +import ( + "context" + "fmt" + "strconv" + "strings" + + "github.com/streamdal/streamdal/libs/protos/build/go/protos" +) + +func (s *Streamdal) addAudience(ctx context.Context, aud *protos.Audience) { + // Don't need to add twice + if s.seenAudience(ctx, aud) { + return + } + + s.audiencesMtx.Lock() + + if s.audiences == nil { + s.audiences = make(map[string]struct{}) + } + + s.audiences[audToStr(aud)] = struct{}{} + s.audiencesMtx.Unlock() + + // Run as goroutine to avoid blocking processing + go func() { + if err := s.serverClient.NewAudience(ctx, aud, s.sessionID); err != nil { + s.config.Logger.Errorf("failed to add audience: %s", err) + } + }() +} + +// addAudiences is used for RE-adding audiences that may have timed out after +// a server reconnect. The method will re-add all known audiences to the server +// via internal gRPC NewAudience() endpoint. This is a non-blocking method. +func (s *Streamdal) addAudiences(ctx context.Context) { + s.audiencesMtx.RLock() + defer s.audiencesMtx.RUnlock() + + for audStr := range s.audiences { + aud := strToAud(audStr) + + if aud == nil { + s.config.Logger.Errorf("unexpected strToAud resulted in nil audience (audStr: %s)", audStr) + continue + } + + // Run as goroutine to avoid blocking processing + go func() { + if err := s.serverClient.NewAudience(ctx, aud, s.sessionID); err != nil { + s.config.Logger.Errorf("failed to add audience: %s", err) + } + }() + } +} + +func (s *Streamdal) seenAudience(_ context.Context, aud *protos.Audience) bool { + s.audiencesMtx.RLock() + defer s.audiencesMtx.RUnlock() + + if s.audiences == nil { + return false + } + + _, ok := s.audiences[audToStr(aud)] + return ok +} + +func (s *Streamdal) getCurrentAudiences() []*protos.Audience { + s.audiencesMtx.RLock() + defer s.audiencesMtx.RUnlock() + + auds := make([]*protos.Audience, 0) + for aud := range s.audiences { + auds = append(auds, strToAud(aud)) + } + + return auds +} + +func audToStr(aud *protos.Audience) string { + if aud == nil { + return "" + } + + return strings.ToLower(fmt.Sprintf("%s:%s:%d:%s", aud.ServiceName, aud.ComponentName, aud.OperationType, aud.OperationName)) +} + +func strToAud(str string) *protos.Audience { + if str == "" { + return nil + } + + str = strings.ToLower(str) + + parts := strings.Split(str, ":") + if len(parts) != 4 { + return nil + } + + opType, err := strconv.Atoi(parts[2]) + if err != nil { + return nil + } + + return &protos.Audience{ + ServiceName: parts[0], + ComponentName: parts[1], + OperationType: protos.OperationType(opType), + OperationName: parts[3], + } +} diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/function.go b/vendor/github.com/streamdal/streamdal/sdks/go/function.go new file mode 100644 index 000000000..16c8317fa --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/function.go @@ -0,0 +1,203 @@ +package streamdal + +import ( + "context" + "fmt" + "io" + "sync" + + "github.com/pkg/errors" + "github.com/tetratelabs/wazero" + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1" + + "github.com/streamdal/streamdal/libs/protos/build/go/protos" +) + +type function struct { + ID string + Inst api.Module + entry api.Function + alloc api.Function + dealloc api.Function + mtx *sync.Mutex +} + +func (f *function) Exec(ctx context.Context, req []byte) ([]byte, error) { + ptrLen := uint64(len(req)) + + inputPtr, err := f.alloc.Call(ctx, ptrLen) + if err != nil { + return nil, errors.Wrap(err, "unable to allocate memory") + } + + if len(inputPtr) == 0 { + return nil, errors.New("unable to allocate memory") + } + + ptrVal := inputPtr[0] + + if !f.Inst.Memory().Write(uint32(ptrVal), req) { + return nil, fmt.Errorf("Memory.Write(%d, %d) out of range of memory size %d", + ptrVal, len(req), f.Inst.Memory().Size()) + } + + result, err := f.entry.Call(ctx, ptrVal, ptrLen) + if err != nil { + // Clear mem on error + if _, err := f.dealloc.Call(ctx, ptrVal, ptrLen); err != nil { + return nil, errors.Wrap(err, "unable to deallocate memory") + } + return nil, errors.Wrap(err, "error during func call") + } + + resultPtr := uint32(result[0] >> 32) + resultSize := uint32(result[0]) + + // Dealloc request memory + if _, err := f.dealloc.Call(ctx, ptrVal, ptrLen); err != nil { + return nil, errors.Wrap(err, "unable to deallocate memory") + } + + // Read memory starting from result ptr + resBytes, err := f.readMemory(resultPtr, resultSize) + if err != nil { + // Dealloc response memory + if _, err := f.dealloc.Call(ctx, uint64(resultPtr), uint64(resultSize)); err != nil { + return nil, errors.Wrap(err, "unable to deallocate memory") + } + return nil, errors.Wrap(err, "unable to read memory") + } + + // Dealloc response memory + if _, err := f.dealloc.Call(ctx, uint64(resultPtr), uint64(resultSize)); err != nil { + return nil, errors.Wrap(err, "unable to deallocate memory") + } + + return resBytes, nil +} + +func (s *Streamdal) setFunctionCache(wasmID string, f *function) { + s.functionsMtx.Lock() + defer s.functionsMtx.Unlock() + + s.functions[wasmID] = f +} + +func (s *Streamdal) getFunction(_ context.Context, step *protos.PipelineStep) (*function, error) { + // check cache + fc, ok := s.getFunctionFromCache(step.GetXWasmId()) + if ok { + return fc, nil + } + + fi, err := s.createFunction(step) + if err != nil { + return nil, errors.Wrap(err, "failed to create function") + } + + // Cache function + s.setFunctionCache(step.GetXWasmId(), fi) + + return fi, nil +} + +func (s *Streamdal) getFunctionFromCache(wasmID string) (*function, bool) { + s.functionsMtx.RLock() + defer s.functionsMtx.RUnlock() + + f, ok := s.functions[wasmID] + return f, ok +} + +func (s *Streamdal) createFunction(step *protos.PipelineStep) (*function, error) { + inst, err := s.createWASMInstance(step.GetXWasmBytes()) + if err != nil { + return nil, errors.Wrap(err, "unable to create WASM instance") + } + + // This is the actual function we'll be executing + f := inst.ExportedFunction(step.GetXWasmFunction()) + if f == nil { + return nil, fmt.Errorf("unable to get exported function '%s'", step.GetXWasmFunction()) + } + + // alloc allows us to pre-allocate memory in order to pass data to the WASM module + alloc := inst.ExportedFunction("alloc") + if alloc == nil { + return nil, errors.New("unable to get alloc func") + } + + // dealloc allows us to free memory passed to the wasm module after we're done with it + dealloc := inst.ExportedFunction("dealloc") + if dealloc == nil { + return nil, errors.New("unable to get dealloc func") + } + + return &function{ + ID: step.GetXWasmId(), + Inst: inst, + entry: f, + alloc: alloc, + dealloc: dealloc, + mtx: &sync.Mutex{}, + }, nil +} + +func (s *Streamdal) createWASMInstance(wasmBytes []byte) (api.Module, error) { + if len(wasmBytes) == 0 { + return nil, errors.New("wasm data is empty") + } + + hostFuncs := map[string]func(_ context.Context, module api.Module, ptr, length int32) uint64{ + "kvExists": s.hf.KVExists, + "httpRequest": s.hf.HTTPRequest, + } + + rCfg := wazero.NewRuntimeConfig(). + WithMemoryLimitPages(1000) // 64MB (default is 1MB) + + ctx := context.Background() + r := wazero.NewRuntimeWithConfig(ctx, rCfg) + + wasi_snapshot_preview1.MustInstantiate(ctx, r) + + cfg := wazero.NewModuleConfig(). + WithStderr(io.Discard). + WithStdout(io.Discard). + WithSysNanotime(). + WithSysNanosleep(). + WithSysWalltime(). + WithStartFunctions("") // We don't need _start() to be called for our purposes + + builder := r.NewHostModuleBuilder("env") + + // This is how multiple host funcs are exported: + // https://github.com/tetratelabs/wazero/blob/b7e8191cceb83c7335d6b8922b40b957475beecf/examples/import-go/age-calculator.go#L41 + for name, fn := range hostFuncs { + builder = builder.NewFunctionBuilder(). + WithFunc(fn). + Export(name) + } + + if _, err := builder.Instantiate(ctx); err != nil { + return nil, errors.Wrap(err, "failed to instantiate module") + } + + mod, err := r.InstantiateWithConfig(ctx, wasmBytes, cfg) + if err != nil { + return nil, errors.Wrap(err, "failed to instantiate wasm module") + } + + return mod, nil +} + +func (f *function) readMemory(ptr, length uint32) ([]byte, error) { + mem, ok := f.Inst.Memory().Read(ptr, length) + if !ok { + return nil, fmt.Errorf("unable to read memory at '%d' with length '%d'", ptr, length) + } + + return mem, nil + +} diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/go_sdk.go b/vendor/github.com/streamdal/streamdal/sdks/go/go_sdk.go new file mode 100644 index 000000000..c44840ce8 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/go_sdk.go @@ -0,0 +1,1020 @@ +// Package streamdal is a library that allows running of Client data pipelines against data +// This package is designed to be included in golang message bus libraries. The only public +// method is Process() which is used to run pipelines against data. +// +// Use of this package requires a running instance of a streamdal serverĀ©. +// The server can be downloaded at https://github.com/streamdal/streamdal/tree/main/apps/server +// +// The following environment variables must be set: +// - STREAMDAL_URL: The address of the Client server +// - STREAMDAL_TOKEN: The token to use when connecting to the Client server +// - STREAMDAL_SERVICE_NAME: The name of the service to identify it in the streamdal console +// +// Optional parameters: +// - STREAMDAL_DRY_RUN: If true, rule hits will only be logged, no failure modes will be ran +package streamdal + +import ( + "context" + "fmt" + "os" + "strings" + "sync" + "time" + + "github.com/google/uuid" + "github.com/pkg/errors" + "github.com/relistan/go-director" + "google.golang.org/protobuf/proto" + + "github.com/streamdal/streamdal/libs/protos/build/go/protos" + + "github.com/streamdal/streamdal/sdks/go/hostfunc" + "github.com/streamdal/streamdal/sdks/go/kv" + "github.com/streamdal/streamdal/sdks/go/logger" + "github.com/streamdal/streamdal/sdks/go/metrics" + "github.com/streamdal/streamdal/sdks/go/server" + "github.com/streamdal/streamdal/sdks/go/types" +) + +// OperationType is used to indicate if the operation is a consumer or a producer +type OperationType int + +// ClientType is used to indicate if this library is being used by a shim or directly (as an SDK) +type ClientType int + +// ProcessResponse is the response struct from a Process() call +type ProcessResponse protos.SDKResponse + +const ( + // DefaultPipelineTimeoutDurationStr is the default timeout for a pipeline execution + DefaultPipelineTimeoutDurationStr = "100ms" + + // DefaultStepTimeoutDurationStr is the default timeout for a single step. + DefaultStepTimeoutDurationStr = "10ms" + + // ReconnectSleep determines the length of time to wait between reconnect attempts to streamdal serverĀ© + ReconnectSleep = time.Second * 5 + + // MaxWASMPayloadSize is the maximum size of data that can be sent to the WASM module + MaxWASMPayloadSize = 1024 * 1024 // 1Mi + + // ClientTypeSDK & ClientTypeShim are referenced by shims and SDKs to indicate + // in what context this SDK is being used. + ClientTypeSDK ClientType = 1 + ClientTypeShim ClientType = 2 + + // OperationTypeConsumer and OperationTypeProducer are used to indicate the + // type of operation the Process() call is performing. + OperationTypeConsumer OperationType = 1 + OperationTypeProducer OperationType = 2 + + AbortAllStr = "aborted all pipelines" + AbortCurrentStr = "aborted current pipeline" + AbortNoneStr = "no abort condition" + + // ExecStatusTrue ExecStatusFalse ExecStatusError are used to indicate + // the execution status of the _last_ step in the _last_ pipeline. + ExecStatusTrue = protos.ExecStatus_EXEC_STATUS_TRUE + ExecStatusFalse = protos.ExecStatus_EXEC_STATUS_FALSE + ExecStatusError = protos.ExecStatus_EXEC_STATUS_ERROR +) + +var ( + ErrEmptyConfig = errors.New("config cannot be empty") + ErrEmptyServiceName = errors.New("data source cannot be empty") + ErrEmptyOperationName = errors.New("operation name cannot be empty") + ErrInvalidOperationType = errors.New("operation type must be set to either OperationTypeConsumer or OperationTypeProducer") + ErrEmptyComponentName = errors.New("component name cannot be empty") + ErrEmptyCommand = errors.New("command cannot be empty") + ErrEmptyProcessRequest = errors.New("process request cannot be empty") + + // ErrMaxPayloadSizeExceeded is returned when the payload is bigger than MaxWASMPayloadSize + ErrMaxPayloadSizeExceeded = fmt.Errorf("payload size exceeds maximum of '%d' bytes", MaxWASMPayloadSize) + + // ErrPipelineTimeout is returned when a pipeline exceeds the configured timeout + ErrPipelineTimeout = errors.New("pipeline timeout exceeded") +) + +type IStreamdal interface { + // Process is used to run data pipelines against data + Process(ctx context.Context, req *ProcessRequest) *ProcessResponse +} + +// Streamdal is the main struct for this library +type Streamdal struct { + config *Config + functions map[string]*function + functionsMtx *sync.RWMutex + pipelines map[string][]*protos.Pipeline // k: audienceStr + pipelinesMtx *sync.RWMutex + serverClient server.IServerClient + metrics metrics.IMetrics + audiences map[string]struct{} // k: audienceStr + audiencesMtx *sync.RWMutex + sessionID string + kv kv.IKV + hf *hostfunc.HostFunc + tailsMtx *sync.RWMutex + tails map[string]map[string]*Tail // k1: audienceStr k2: tailID + pausedTailsMtx *sync.RWMutex + pausedTails map[string]map[string]*Tail // k1: audienceStr k2: tailID + schemas map[string]*protos.Schema // k: audienceStr + schemasMtx *sync.RWMutex +} + +type Config struct { + // ServerURL the hostname and port for the gRPC API of Streamdal Server + // If this value is left empty, the library will not attempt to connect to the server + // and New() will return nil + ServerURL string + + // ServerToken is the authentication token for the gRPC API of the Streamdal server + // If this value is left empty, the library will not attempt to connect to the server + // and New() will return nil + ServerToken string + + // ServiceName is the name that this library will identify as in the UI. Required + ServiceName string + + // PipelineTimeout defines how long this library will allow a pipeline to + // run. Optional; default: 100ms + PipelineTimeout time.Duration + + // StepTimeout defines how long this library will allow a single step to run. + // Optional; default: 10ms + StepTimeout time.Duration + + // IgnoreStartupError defines how to handle an error on initial startup via + // New(). If left as false, failure to complete startup (such as bad auth) + // will cause New() to return an error. If true, the library will block and + // continue trying to initialize. You may want to adjust this if you want + // your application to behave a certain way on startup when the server + // is unavailable. Optional; default: false + IgnoreStartupError bool + + // If specified, library will connect to the server but won't apply any + // pipelines. Optional; default: false + DryRun bool + + // ShutdownCtx is a context that the library will listen to for cancellation + // notices. Required + ShutdownCtx context.Context + + // Logger is a logger you can inject (such as logrus) to allow this library + // to log output. Optional; default: nil + Logger logger.Logger + + // Audiences is a list of audiences you can specify at registration time. + // This is useful if you know your audiences in advance and want to populate + // service groups in the Streamdal UI _before_ your code executes any .Process() + // calls. Optional; default: nil + Audiences []*Audience + + // ClientType specifies whether this of the SDK is used in a shim library or + // as a standalone SDK. This information is used for both debug info and to + // help the library determine whether ServerURL and ServerToken should be + // optional or required. Optional; default: ClientTypeSDK + ClientType ClientType +} + +// Audience is used to announce an audience to the Streamdal server on library initialization +// We use this to avoid end users having to import our protos +type Audience struct { + ComponentName string + OperationType OperationType + OperationName string +} + +// ProcessRequest is used to maintain a consistent API for the Process() call +type ProcessRequest struct { + ComponentName string + OperationType OperationType + OperationName string + Data []byte +} + +func New(cfg *Config) (*Streamdal, error) { + if err := validateConfig(cfg); err != nil { + return nil, errors.Wrap(err, "unable to validate config") + } + + // We instantiate this library based on whether we have a Client URL+token or not. + // If these are not provided, the wrapper library will not perform rule checks and + // will act as normal + if cfg.ServerURL == "" || cfg.ServerToken == "" { + return nil, nil + } + + serverClient, err := server.New(cfg.ServerURL, cfg.ServerToken) + if err != nil { + return nil, errors.Wrapf(err, "failed to connect to streamdal serverĀ© '%s'", cfg.ServerURL) + } + + m, err := metrics.New(&metrics.Config{ + ServerClient: serverClient, + ShutdownCtx: cfg.ShutdownCtx, + Log: cfg.Logger, + }) + if err != nil { + return nil, errors.Wrap(err, "failed to start metrics service") + } + + kvInstance, err := kv.New(&kv.Config{ + Logger: cfg.Logger, + }) + if err != nil { + return nil, errors.Wrap(err, "failed to start kv service") + } + + hf, err := hostfunc.New(kvInstance, cfg.Logger) + if err != nil { + return nil, errors.Wrap(err, "failed to create hostfunc instance") + } + + s := &Streamdal{ + functions: make(map[string]*function), + functionsMtx: &sync.RWMutex{}, + serverClient: serverClient, + pipelines: make(map[string][]*protos.Pipeline), + pipelinesMtx: &sync.RWMutex{}, + audiences: map[string]struct{}{}, + audiencesMtx: &sync.RWMutex{}, + config: cfg, + metrics: m, + sessionID: uuid.New().String(), + kv: kvInstance, + hf: hf, + tailsMtx: &sync.RWMutex{}, + tails: make(map[string]map[string]*Tail), + pausedTailsMtx: &sync.RWMutex{}, + pausedTails: make(map[string]map[string]*Tail), + schemasMtx: &sync.RWMutex{}, + schemas: make(map[string]*protos.Schema), + } + + if cfg.DryRun { + cfg.Logger.Warn("data pipelines running in dry run mode") + } + + if err := s.pullInitialPipelines(cfg.ShutdownCtx); err != nil { + return nil, err + } + + errCh := make(chan error) + + // Start register + go func() { + if err := s.register(director.NewFreeLooper(director.FOREVER, make(chan error, 1))); err != nil { + errCh <- errors.Wrap(err, "register error") + } + }() + + // Start heartbeat + go s.heartbeat(director.NewTimedLooper(director.FOREVER, time.Second, make(chan error, 1))) + + go s.watchForShutdown() + + // Make sure we were able to start without issues + select { + case err := <-errCh: + return nil, errors.Wrap(err, "received error on startup") + case <-time.After(time.Second * 5): + return s, nil + } +} + +func validateConfig(cfg *Config) error { + if cfg == nil { + return ErrEmptyConfig + } + + if cfg.ShutdownCtx == nil { + cfg.ShutdownCtx = context.Background() + } + + if cfg.ServiceName == "" { + cfg.ServiceName = os.Getenv("STREAMDAL_SERVICE_NAME") + if cfg.ServiceName == "" { + return ErrEmptyServiceName + } + } + + // Can be specified in config for lib use, or via envar for shim use + if cfg.ServerURL == "" { + cfg.ServerURL = os.Getenv("STREAMDAL_URL") + } + + // Can be specified in config for lib use, or via envar for shim use + if cfg.ServerToken == "" { + cfg.ServerToken = os.Getenv("STREAMDAL_TOKEN") + } + + // Can be specified in config for lib use, or via envar for shim use + if os.Getenv("STREAMDAL_DRY_RUN") == "true" { + cfg.DryRun = true + } + + // Can be specified in config for lib use, or via envar for shim use + if cfg.StepTimeout == 0 { + to := os.Getenv("STREAMDAL_STEP_TIMEOUT") + if to == "" { + to = DefaultStepTimeoutDurationStr + } + + timeout, err := time.ParseDuration(to) + if err != nil { + return errors.Wrapf(err, "unable to parse StepTimeout '%s'", to) + } + + cfg.StepTimeout = timeout + } + + // Can be specified in config for lib use, or via envar for shim use + if cfg.PipelineTimeout == 0 { + to := os.Getenv("STREAMDAL_PIPELINE_TIMEOUT") + if to == "" { + to = DefaultPipelineTimeoutDurationStr + } + + timeout, err := time.ParseDuration(to) + if err != nil { + return errors.Wrapf(err, "unable to parse PipelineTimeout '%s'", to) + } + + cfg.PipelineTimeout = timeout + } + + // Default to NOOP logger if none is provided + if cfg.Logger == nil { + cfg.Logger = &logger.TinyLogger{} + } + + // Default to ClientTypeSDK + if cfg.ClientType != ClientTypeShim && cfg.ClientType != ClientTypeSDK { + cfg.ClientType = ClientTypeSDK + } + + return nil +} + +func validateProcessRequest(req *ProcessRequest) error { + if req == nil { + return ErrEmptyProcessRequest + } + + if req.OperationName == "" { + return ErrEmptyOperationName + } + + if req.ComponentName == "" { + return ErrEmptyComponentName + } + + if req.OperationType != OperationTypeProducer && req.OperationType != OperationTypeConsumer { + return ErrInvalidOperationType + } + + return nil +} + +func (s *Streamdal) watchForShutdown() { + <-s.config.ShutdownCtx.Done() + + // Shut down all tails + s.tailsMtx.RLock() + defer s.tailsMtx.RUnlock() + for _, tails := range s.tails { + for reqID, tail := range tails { + s.config.Logger.Debugf("Shutting down tail '%s' for pipeline %s", reqID, tail.Request.GetTail().Request.PipelineId) + tail.CancelFunc() + } + } +} + +func (s *Streamdal) pullInitialPipelines(ctx context.Context) error { + cmds, err := s.serverClient.GetSetPipelinesCommandByService(ctx, s.config.ServiceName) + if err != nil { + return errors.Wrap(err, "unable to pull initial pipelines") + } + + // Commands won't include paused pipelines but we can check just in case + for _, cmd := range cmds.SetPipelineCommands { + for _, p := range cmd.GetSetPipelines().Pipelines { + s.config.Logger.Debugf("saving pipeline '%s' for audience '%s' to internal map", p.Name, audToStr(cmd.Audience)) + + // Fill in WASM data from the deduplication map + for _, step := range p.Steps { + wasmData, ok := cmds.WasmModules[step.GetXWasmId()] + if !ok { + return errors.Errorf("BUG: unable to find WASM data for step '%s'", step.Name) + } + + step.XWasmBytes = wasmData.Bytes + } + + if err := s.setPipelines(ctx, cmd); err != nil { + s.config.Logger.Errorf("failed to attach pipeline: %s", err) + } + } + } + + return nil +} + +func (s *Streamdal) heartbeat(loop *director.TimedLooper) { + var quit bool + loop.Loop(func() error { + if quit { + time.Sleep(time.Millisecond * 50) + return nil + } + + select { + case <-s.config.ShutdownCtx.Done(): + quit = true + loop.Quit() + return nil + default: + // NOOP + } + + hb := &protos.HeartbeatRequest{ + SessionId: s.sessionID, + Audiences: s.getCurrentAudiences(), + ClientInfo: s.genClientInfo(), + ServiceName: s.config.ServiceName, + } + + if err := s.serverClient.HeartBeat(s.config.ShutdownCtx, hb); err != nil { + if strings.Contains(err.Error(), "connection refused") { + // Streamdal server went away, log, sleep, and wait for reconnect + s.config.Logger.Warn("failed to send heartbeat, streamdal serverĀ© went away, waiting for reconnect") + time.Sleep(ReconnectSleep) + return nil + } + s.config.Logger.Errorf("failed to send heartbeat: %s", err) + } + + return nil + }) +} + +func (s *Streamdal) runStep(ctx context.Context, aud *protos.Audience, step *protos.PipelineStep, data []byte, isr *protos.InterStepResult) (*protos.WASMResponse, error) { + s.config.Logger.Debugf("Running step '%s'", step.Name) + + // Get WASM module + f, err := s.getFunction(ctx, step) + if err != nil { + return nil, errors.Wrap(err, "failed to get wasm data") + } + + f.mtx.Lock() + defer f.mtx.Unlock() + + // Don't need this anymore, and don't want to send it to the wasm function + step.XWasmBytes = nil + + req := &protos.WASMRequest{ + InputPayload: data, + Step: step, + InterStepResult: isr, + } + + reqBytes, err := proto.Marshal(req) + if err != nil { + return nil, errors.Wrap(err, "failed to marshal WASM request") + } + + timeoutCtx, cancel := context.WithTimeout(ctx, s.config.StepTimeout) + defer cancel() + + // Run WASM module + respBytes, err := f.Exec(timeoutCtx, reqBytes) + if err != nil { + return nil, errors.Wrap(err, "failed to execute wasm module") + } + + resp := &protos.WASMResponse{} + if err := proto.Unmarshal(respBytes, resp); err != nil { + return nil, errors.Wrap(err, "failed to unmarshal WASM response") + } + + // Don't use parent context here since it will be cancelled by the time + // the goroutine in handleSchema runs + s.handleSchema(context.Background(), aud, step, resp) + + return resp, nil +} + +func (s *Streamdal) getPipelines(ctx context.Context, aud *protos.Audience) []*protos.Pipeline { + s.pipelinesMtx.RLock() + defer s.pipelinesMtx.RUnlock() + + s.addAudience(ctx, aud) + + pipelines, ok := s.pipelines[audToStr(aud)] + if !ok { + return make([]*protos.Pipeline, 0) + } + + return pipelines +} + +func (s *Streamdal) getCounterLabels(req *ProcessRequest, pipeline *protos.Pipeline) map[string]string { + l := map[string]string{ + "service": s.config.ServiceName, + "component": req.ComponentName, + "operation": req.OperationName, + "pipeline_name": "", + "pipeline_id": "", + } + + if pipeline != nil { + l["pipeline_name"] = pipeline.Name + l["pipeline_id"] = pipeline.Id + } + + return l +} + +func newAudience(req *ProcessRequest, cfg *Config) *protos.Audience { + if req == nil || cfg == nil { + panic("BUG: newAudience() called with nil arguments") + } + + return &protos.Audience{ + ServiceName: cfg.ServiceName, + ComponentName: req.ComponentName, + OperationType: protos.OperationType(req.OperationType), + OperationName: req.OperationName, + } +} + +func (s *Streamdal) Process(ctx context.Context, req *ProcessRequest) *ProcessResponse { + resp := &ProcessResponse{ + PipelineStatus: make([]*protos.PipelineStatus, 0), + Metadata: make(map[string]string), + } + + if err := validateProcessRequest(req); err != nil { + resp.Status = protos.ExecStatus_EXEC_STATUS_ERROR + resp.StatusMessage = proto.String(err.Error()) + + return resp + } + + resp.Data = req.Data + + payloadSize := int64(len(resp.Data)) + aud := newAudience(req, s.config) + + // Always send tail output + defer func() { + s.sendTail(aud, "", req.Data, resp.Data) + }() + + // TODO: DRY this up + counterError := types.ConsumeErrorCount + counterProcessed := types.ConsumeProcessedCount + counterBytes := types.ConsumeBytes + rateBytes := types.ConsumeBytesRate + rateProcessed := types.ConsumeProcessedRate + + if req.OperationType == OperationTypeProducer { + counterError = types.ProduceErrorCount + counterProcessed = types.ProduceProcessedCount + counterBytes = types.ProduceBytes + rateBytes = types.ProduceBytesRate + rateProcessed = types.ProduceProcessedRate + } + + // Rate counters + _ = s.metrics.Incr(ctx, &types.CounterEntry{Name: rateBytes, Labels: map[string]string{}, Value: payloadSize, Audience: aud}) + _ = s.metrics.Incr(ctx, &types.CounterEntry{Name: rateProcessed, Labels: map[string]string{}, Value: 1, Audience: aud}) + + pipelines := s.getPipelines(ctx, aud) + + // WARNING: This case will (usually) only "hit" for the first <100ms of + // running the SDK - after that, the server will have sent us at least one, + // "hidden" pipeline - "infer schema". All of this happens asynchronously + // (to prevent Register() from blocking). + // + // This means that setting resp.StatusMessage here means that it will only + // survive for the first few messages - after that, StatusMessage might get + // updated by the infer schema pipeline step. + if len(pipelines) == 0 { + // No pipelines for this mode, nothing to do + resp.Status = protos.ExecStatus_EXEC_STATUS_TRUE + + return resp + } + + if payloadSize > MaxWASMPayloadSize { + _ = s.metrics.Incr(ctx, &types.CounterEntry{Name: counterError, Labels: s.getCounterLabels(req, nil), Value: 1, Audience: aud}) + s.config.Logger.Warn(ErrMaxPayloadSizeExceeded) + + resp.Status = protos.ExecStatus_EXEC_STATUS_ERROR + resp.StatusMessage = proto.String(ErrMaxPayloadSizeExceeded.Error()) + + return resp + } + + totalPipelines := len(pipelines) + var ( + pIndex int + sIndex int + ) + +PIPELINE: + for _, pipeline := range pipelines { + var isr *protos.InterStepResult + pIndex += 1 + + pipelineTimeoutCtx, pipelineTimeoutCxl := context.WithTimeout(ctx, s.config.PipelineTimeout) + + pipelineStatus := &protos.PipelineStatus{ + Id: pipeline.Id, + Name: pipeline.Name, + StepStatus: make([]*protos.StepStatus, 0), + } + + _ = s.metrics.Incr(ctx, &types.CounterEntry{Name: counterProcessed, Labels: s.getCounterLabels(req, pipeline), Value: 1, Audience: aud}) + _ = s.metrics.Incr(ctx, &types.CounterEntry{Name: counterBytes, Labels: s.getCounterLabels(req, pipeline), Value: payloadSize, Audience: aud}) + + totalSteps := len(pipeline.Steps) + + for _, step := range pipeline.Steps { + sIndex += 1 + + stepTimeoutCtx, stepTimeoutCxl := context.WithTimeout(ctx, s.config.StepTimeout) + + stepStatus := &protos.StepStatus{ + Name: step.Name, + } + + select { + case <-pipelineTimeoutCtx.Done(): + pipelineTimeoutCxl() + stepTimeoutCxl() + + stepStatus.Status = protos.ExecStatus_EXEC_STATUS_ERROR + stepStatus.StatusMessage = proto.String("Pipeline error: " + ErrPipelineTimeout.Error()) + + // Maybe notify, maybe include metadata + cond := s.handleCondition(ctx, req, resp, step.OnError, step, pipeline, aud, protos.NotifyRequest_CONDITION_TYPE_ON_ERROR) + + // Update the abort condition before we populate statuses in resp + stepStatus.AbortCondition = cond.abortCondition + + if cond.abortCurrent { + // Aborting CURRENT, LOCAL step & pipeline status needs to be updated + if pIndex == totalPipelines { + s.updateStatus(resp, pipelineStatus, stepStatus) + } else { + s.updateStatus(nil, pipelineStatus, stepStatus) + } + + s.config.Logger.Warnf("exceeded timeout for pipeline '%s' - aborting CURRENT pipeline", pipeline.Name) + + continue PIPELINE + } else if cond.abortAll { + s.config.Logger.Warnf("exceeded timeout for pipeline '%s' - aborting ALL pipelines", pipeline.Name) + + // Aborting ALL, RESP should have step & pipeline status updated + s.updateStatus(resp, pipelineStatus, stepStatus) + + return resp + } + + // NOT aborting, don't need to update step or pipeline status + s.config.Logger.Warnf("exceeded timeout for pipeline '%s' but no abort condition defined - continuing execution", step.Name) + default: + // NOOP + } + + // Pipeline timeout either has not occurred OR it occurred and execution was not aborted + + wasmResp, err := s.runStep(stepTimeoutCtx, aud, step, resp.Data, isr) + if err != nil { + stepTimeoutCxl() + + err = fmt.Errorf("wasm error during step '%s:%s': %s", pipeline.Name, step.Name, err) + + stepStatus.Status = protos.ExecStatus_EXEC_STATUS_ERROR + stepStatus.StatusMessage = proto.String("Wasm Error: " + err.Error()) + + // Maybe notify, maybe include metadata + cond := s.handleCondition(ctx, req, resp, step.OnError, step, pipeline, aud, protos.NotifyRequest_CONDITION_TYPE_ON_ERROR) + + // Update the abort condition before we populate statuses in resp + stepStatus.AbortCondition = cond.abortCondition + + if cond.abortCurrent { + pipelineTimeoutCxl() + + // Aborting CURRENT, update LOCAL step & pipeline status + // + // It is possible that resp won't have its status filled out IF the + // last pipeline AND last step has an abort condition. To get around + // that, all steps check to see if they are the last in line to exec + // and if they are, they will fill the response status. + if pIndex == totalPipelines && sIndex == totalSteps { + s.updateStatus(resp, pipelineStatus, stepStatus) + } else { + s.updateStatus(nil, pipelineStatus, stepStatus) + } + + s.config.Logger.Errorf(err.Error() + " (aborting CURRENT pipeline)") + + continue PIPELINE + } else if cond.abortAll { + pipelineTimeoutCxl() + + // Aborting ALL, update RESP step & pipeline status + s.updateStatus(resp, pipelineStatus, stepStatus) + + s.config.Logger.Errorf(err.Error() + " (aborting ALL pipelines)") + + return resp + } + + // NOT aborting, update LOCAL step & pipeline status + s.updateStatus(nil, pipelineStatus, stepStatus) + + s.config.Logger.Warnf("Step '%s:%s' failed (no abort condition defined - continuing step execution)", pipeline.Name, step.Name) + + continue // Move on to the next step in the pipeline + } + + // Only update working payload if one is returned + if len(wasmResp.OutputPayload) > 0 { + resp.Data = wasmResp.OutputPayload + } + + isr = wasmResp.InterStepResult // Pass inter-step result to next step + + var ( + stepCondStr string + stepConds *protos.PipelineStepConditions + stepExecStatus protos.ExecStatus + condType protos.NotifyRequest_ConditionType + ) + + // Execution worked - check wasm exit code + switch wasmResp.ExitCode { + case protos.WASMExitCode_WASM_EXIT_CODE_TRUE: + // Data was potentially modified + resp.Data = wasmResp.OutputPayload + + stepCondStr = "true" + stepConds = step.OnTrue + stepExecStatus = protos.ExecStatus_EXEC_STATUS_TRUE + condType = protos.NotifyRequest_CONDITION_TYPE_ON_TRUE + case protos.WASMExitCode_WASM_EXIT_CODE_FALSE: + // Data was potentially modified + resp.Data = wasmResp.OutputPayload + + stepCondStr = "false" + stepConds = step.OnFalse + stepExecStatus = protos.ExecStatus_EXEC_STATUS_FALSE + condType = protos.NotifyRequest_CONDITION_TYPE_ON_FALSE + case protos.WASMExitCode_WASM_EXIT_CODE_ERROR: + // Ran into an error - return original data + resp.Data = req.Data + + stepCondStr = "error" + stepConds = step.OnError + stepExecStatus = protos.ExecStatus_EXEC_STATUS_ERROR + condType = protos.NotifyRequest_CONDITION_TYPE_ON_ERROR + default: + _ = s.metrics.Incr(ctx, &types.CounterEntry{Name: counterError, Labels: s.getCounterLabels(req, pipeline), Value: 1, Audience: aud}) + s.config.Logger.Debugf("Step '%s:%s' returned unknown exit code %d", pipeline.Name, step.Name, wasmResp.ExitCode) + + // TODO: Is an unknown exit code considered an error? + } + + stepTimeoutCxl() + + statusMsg := fmt.Sprintf("step '%s:%s' returned %s: %s", pipeline.Name, step.Name, stepCondStr, wasmResp.ExitMsg) + + // Maybe notify, maybe include metadata + cond := s.handleCondition(ctx, req, resp, stepConds, step, pipeline, aud, condType) + + // Update step status bits + stepStatus.Status = stepExecStatus + stepStatus.StatusMessage = proto.String(statusMsg) + + stepStatus.AbortCondition = cond.abortCondition + + // Increase error metrics (if wasm returned err) + if stepExecStatus == protos.ExecStatus_EXEC_STATUS_ERROR { + _ = s.metrics.Incr(ctx, &types.CounterEntry{Name: counterError, Labels: s.getCounterLabels(req, pipeline), Value: 1, Audience: aud}) + } + + if cond.abortCurrent { + pipelineTimeoutCxl() + + // Aborting CURRENT, update LOCAL step & pipeline status + // + // It is possible that resp won't have its status filled out IF the + // last pipeline AND last step has an abort condition. To get around + // that, all steps check to see if they are the last in line to exec + // and if they are, they will fill the response status. + if pIndex == totalPipelines && sIndex == totalSteps { + s.updateStatus(resp, pipelineStatus, stepStatus) + } else { + s.updateStatus(nil, pipelineStatus, stepStatus) + } + + s.config.Logger.Debug(statusMsg + " (aborting CURRENT pipeline)") + + continue PIPELINE + } else if cond.abortAll { + pipelineTimeoutCxl() + + // Aborting ALL, update RESP step & pipeline status + s.updateStatus(resp, pipelineStatus, stepStatus) + + s.config.Logger.Debug(statusMsg + " (aborting ALL pipelines)") + + return resp + } + + // NO abort condition, update LOCAL step & pipeline status + s.updateStatus(nil, pipelineStatus, stepStatus) + + s.config.Logger.Debug(statusMsg + " (no abort condition defined - continuing execution)") + + // END step loop + } + + pipelineTimeoutCxl() + + // Pipeline completed, update RESP pipeline status (step status already updated) + s.updateStatus(resp, pipelineStatus, nil) + + // END pipeline loop + } + + // Dry run should not modify anything, but we must allow pipeline to + // mutate internal state in order to function properly + if s.config.DryRun { + resp.Data = req.Data + } + + return resp +} + +type condition struct { + abortCurrent bool + abortAll bool + + // This is here to make it easier to perform assignment in stepStatus + abortCondition protos.AbortCondition +} + +// handleCondition is a wrapper for inspecting the step condition and potentially +// performing a notification and injecting metadata back into the response. +// TODO: simplify these params +func (s *Streamdal) handleCondition( + ctx context.Context, + req *ProcessRequest, + resp *ProcessResponse, + stepCond *protos.PipelineStepConditions, + step *protos.PipelineStep, + pipeline *protos.Pipeline, + aud *protos.Audience, + condType protos.NotifyRequest_ConditionType, +) condition { + // If no condition is set, we don't need to do anything + if stepCond == nil { + return condition{} + } + + // Should we notify? + if stepCond.Notification != nil && !s.config.DryRun { + s.config.Logger.Debugf("Performing 'notify' condition for step '%s'", step.Name) + + if err := s.serverClient.Notify(ctx, pipeline, step, aud, resp.Data, condType); err != nil { + s.config.Logger.Errorf("failed to notify condition: %s", err) + } + + labels := map[string]string{ + "service": s.config.ServiceName, + "component": req.ComponentName, + "operation": req.OperationName, + "pipeline_name": pipeline.Name, + "pipeline_id": pipeline.Id, + } + _ = s.metrics.Incr(ctx, &types.CounterEntry{Name: types.NotifyCount, Labels: labels, Value: 1, Audience: aud}) + } + + // Should we pass back metadata? + if len(stepCond.Metadata) > 0 { + s.config.Logger.Debugf("Performing 'metadata' condition for step '%s'", step.Name) + s.populateMetadata(resp, stepCond.Metadata) + } + + // Should we abort current or ALL pipelines? + if stepCond.Abort == protos.AbortCondition_ABORT_CONDITION_ABORT_CURRENT { + s.config.Logger.Debugf("Abort condition set to 'current' for step '%s'", step.Name) + return condition{ + abortCurrent: true, + abortCondition: protos.AbortCondition_ABORT_CONDITION_ABORT_CURRENT, + } + } else if stepCond.Abort == protos.AbortCondition_ABORT_CONDITION_ABORT_ALL { + s.config.Logger.Debugf("Abort condition set to 'all' for step '%s'", step.Name) + return condition{ + abortAll: true, + abortCondition: protos.AbortCondition_ABORT_CONDITION_ABORT_ALL, + } + } + + s.config.Logger.Debugf("No abort conditions set for step '%s'", step.Name) + + // Don't abort anything - continue as-is + return condition{} +} + +func (s *Streamdal) populateMetadata(resp *ProcessResponse, metadata map[string]string) { + if resp == nil || metadata == nil { + return + } + + for k, v := range metadata { + if resp.Metadata == nil { + resp.Metadata = make(map[string]string) + } + + resp.Metadata[k] = v + } +} + +// updateStatus is a wrapper for updating step, pipeline and resp statuses. +// +// This method allows resp OR step status to be nil. This is because we are not +// always returning a final response - we are still going through more pipelines +// and steps. +// +// Similarly, step status can be nil because the FINAL response will only have +// a pipeline status and no step status. +func (s *Streamdal) updateStatus(resp *ProcessResponse, pipelineStatus *protos.PipelineStatus, stepStatus *protos.StepStatus) { + // Pipeline status is ALWAYS required + if pipelineStatus == nil { + s.config.Logger.Warn("BUG: pipelineStatus cannot be nil in updateStatus()") + } + + // If resp is nil, there should ALWAYS be a step and pipeline status + if resp == nil && (stepStatus == nil || pipelineStatus == nil) { + s.config.Logger.Warn("BUG: stepStatus and pipelineStatus cannot be nil when resp is nil in updateStatus()") + return + } + + if stepStatus != nil { + // When returning final response, we won't have a step status + pipelineStatus.StepStatus = append(pipelineStatus.StepStatus, stepStatus) + + // Prettify status message with abort info + var abortStatusStr string + + switch stepStatus.AbortCondition { + case protos.AbortCondition_ABORT_CONDITION_ABORT_CURRENT: + abortStatusStr = AbortCurrentStr + case protos.AbortCondition_ABORT_CONDITION_ABORT_ALL: + abortStatusStr = AbortAllStr + default: + abortStatusStr = AbortNoneStr + } + + // StepStatusMessage can be nil because it is optional + if stepStatus.StatusMessage != nil { + // If the message is NOT empty, we want to append the append abort status + if *stepStatus.StatusMessage != "" { + stepStatus.StatusMessage = proto.String(fmt.Sprintf("%s (%s)", *stepStatus.StatusMessage, abortStatusStr)) + } else { + // Otherwise, just display the abort status + stepStatus.StatusMessage = proto.String(abortStatusStr) + } + } + } + + // Response could be nil if we are NOT aborting all pipelines; resp will NOT + // be nil if this is the LAST pipeline and LAST step. + if resp != nil { + resp.PipelineStatus = append(resp.PipelineStatus, pipelineStatus) + + // Resp status should be the status of the LAST step + resp.Status = pipelineStatus.StepStatus[len(pipelineStatus.StepStatus)-1].Status + resp.StatusMessage = pipelineStatus.StepStatus[len(pipelineStatus.StepStatus)-1].StatusMessage + } +} + +func (a *Audience) toProto(serviceName string) *protos.Audience { + return &protos.Audience{ + ServiceName: strings.ToLower(serviceName), + ComponentName: strings.ToLower(a.ComponentName), + OperationType: protos.OperationType(a.OperationType), + OperationName: strings.ToLower(a.OperationName), + } +} diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/helper/helper.go b/vendor/github.com/streamdal/streamdal/sdks/go/helper/helper.go new file mode 100644 index 000000000..d21fdc5b8 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/helper/helper.go @@ -0,0 +1,81 @@ +// Package helper contains WASM-related helper functions and methods. +// This package is separate from `go-sdk` to avoid polluting +// go-sdk's public API. +package helper + +import ( + "context" + + "github.com/pkg/errors" + "github.com/tetratelabs/wazero/api" + "google.golang.org/protobuf/proto" +) + +// ReadRequestFromMemory is a helper function that reads raw memory starting at +// 'ptr' for 'length' bytes. Once read, it will attempt to unmarshal the data +// into the provided proto.Message. +func ReadRequestFromMemory(module api.Module, msg proto.Message, ptr, length int32) error { + if length <= 0 { + return errors.New("length must be greater than 0") + } + + if module == nil { + return errors.New("module cannot be nil") + } + + if msg == nil { + return errors.New("msg cannot be nil") + } + + data, ok := module.Memory().Read(uint32(ptr), uint32(length)) + if !ok { + return errors.New("unable to read memory") + } + + if err := proto.Unmarshal(data, msg); err != nil { + return errors.Wrap(err, "unable to unmarshal HttpRequest") + } + + return nil +} + +// WriteResponseToMemory is a helper function that marshals provided message to +// module memory, appends terminators and returns the pointer to the start of +// the message. +func WriteResponseToMemory(module api.Module, msg proto.Message) (uint64, error) { + if module == nil { + return 0, errors.New("module cannot be nil") + } + + if msg == nil { + return 0, errors.New("msg cannot be nil") + } + + data, err := proto.Marshal(msg) + if err != nil { + return 0, errors.Wrap(err, "unable to marshal response") + } + + alloc := module.ExportedFunction("alloc") + if alloc == nil { + return 0, errors.New("unable to get alloc func") + } + + // Allocate memory for response + allocRes, err := alloc.Call(context.Background(), uint64(len(data))) + if err != nil { + return 0, errors.Wrap(err, "unable to allocate memory") + } + + if len(allocRes) < 1 { + return 0, errors.New("alloc returned unexpected number of results") + } + + // Write memory to allocated space + ok := module.Memory().Write(uint32(allocRes[0]), data) + if !ok { + return 0, errors.New("unable to write host function results to memory") + } + + return (allocRes[0] << uint64(32)) | uint64(len(data)), nil +} diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/hostfunc/hostfunc.go b/vendor/github.com/streamdal/streamdal/sdks/go/hostfunc/hostfunc.go new file mode 100644 index 000000000..f4190fbe8 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/hostfunc/hostfunc.go @@ -0,0 +1,26 @@ +// Package hostfunc contains host function methods. They are separated from +// go-sdk in order to keep the public API clean. +package hostfunc + +import ( + "github.com/pkg/errors" + + "github.com/streamdal/streamdal/sdks/go/kv" + "github.com/streamdal/streamdal/sdks/go/logger" +) + +type HostFunc struct { + kv kv.IKV + log logger.Logger +} + +func New(kv kv.IKV, log logger.Logger) (*HostFunc, error) { + if kv == nil { + return nil, errors.New("kv cannot be nil") + } + + return &HostFunc{ + kv: kv, + log: log, + }, nil +} diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/hostfunc/httprequest.go b/vendor/github.com/streamdal/streamdal/sdks/go/hostfunc/httprequest.go new file mode 100644 index 000000000..fa61d89cf --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/hostfunc/httprequest.go @@ -0,0 +1,94 @@ +package hostfunc + +import ( + "bytes" + "context" + "io" + "net/http" + "strings" + + "github.com/pkg/errors" + "github.com/tetratelabs/wazero/api" + + "github.com/streamdal/streamdal/libs/protos/build/go/protos/steps" + + "github.com/streamdal/streamdal/sdks/go/helper" +) + +// HTTPRequest is function that is exported to and called from a Rust WASM module +func (h *HostFunc) HTTPRequest(_ context.Context, module api.Module, ptr, length int32) uint64 { + request := &steps.HttpRequest{} + + if err := helper.ReadRequestFromMemory(module, request, ptr, length); err != nil { + return httpRequestResponse(module, http.StatusInternalServerError, "unable to read HTTP request params: "+err.Error(), nil) + } + + httpReq, err := http.NewRequest(methodFromProto(request.Method), request.Url, bytes.NewReader(request.Body)) + if err != nil { + err = errors.Wrap(err, "unable to create http request") + return httpRequestResponse(module, http.StatusInternalServerError, err.Error(), nil) + } + + resp, err := http.DefaultClient.Do(httpReq) + if err != nil { + err = errors.Wrap(err, "unable to perform http request") + return httpRequestResponse(module, http.StatusInternalServerError, err.Error(), nil) + } + + defer resp.Body.Close() + body, err := io.ReadAll(resp.Body) + if err != nil { + return httpRequestResponse(module, http.StatusInternalServerError, err.Error(), nil) + } + + if resp.StatusCode > 299 { + return httpRequestResponse(module, resp.StatusCode, string(body), nil) + } + + // Get all headers from the response + headers := make(map[string]string) + for k, v := range resp.Header { + headers[k] = strings.Join(v, ", ") + } + + return httpRequestResponse(module, resp.StatusCode, string(body), headers) +} + +// httpRequestResponse is a helper for HostFuncHTTPRequest() +func httpRequestResponse(module api.Module, code int, body string, headers map[string]string) uint64 { + if headers == nil { + headers = make(map[string]string) + } + + resp := &steps.HttpResponse{ + Code: int32(code), + Body: []byte(body), + Headers: headers, + } + + addr, err := helper.WriteResponseToMemory(module, resp) + if err != nil { + panic("unable to write HTTP response to memory: " + err.Error()) + } + + return addr +} + +func methodFromProto(m steps.HttpRequestMethod) string { + switch m { + case steps.HttpRequestMethod_HTTP_REQUEST_METHOD_POST: + return http.MethodPost + case steps.HttpRequestMethod_HTTP_REQUEST_METHOD_PUT: + return http.MethodPut + case steps.HttpRequestMethod_HTTP_REQUEST_METHOD_DELETE: + return http.MethodDelete + case steps.HttpRequestMethod_HTTP_REQUEST_METHOD_PATCH: + return http.MethodPatch + case steps.HttpRequestMethod_HTTP_REQUEST_METHOD_HEAD: + return http.MethodHead + case steps.HttpRequestMethod_HTTP_REQUEST_METHOD_OPTIONS: + return http.MethodOptions + default: + return http.MethodGet + } +} diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/hostfunc/kv.go b/vendor/github.com/streamdal/streamdal/sdks/go/hostfunc/kv.go new file mode 100644 index 000000000..e057974c0 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/hostfunc/kv.go @@ -0,0 +1,81 @@ +package hostfunc + +import ( + "context" + "fmt" + + "github.com/pkg/errors" + "github.com/tetratelabs/wazero/api" + + "github.com/streamdal/streamdal/libs/protos/build/go/protos/steps" + + "github.com/streamdal/streamdal/sdks/go/helper" +) + +// KVExists is function that is exported to and called from a Rust WASM module +func (h *HostFunc) KVExists(_ context.Context, module api.Module, ptr, length int32) uint64 { + // Read request + request := &steps.KVStep{} + + if err := helper.ReadRequestFromMemory(module, request, ptr, length); err != nil { + return kvExistsResponse(module, "unable to read KVExistsRequest params: "+err.Error(), true, false) + } + + if err := validateKVStep(request); err != nil { + return kvExistsResponse(module, "unable to validate KVExistsRequest: "+err.Error(), true, false) + } + + // Perform operation + exists := h.kv.Exists(request.Key) + + msg := fmt.Sprintf("key '%s' does not exist", request.Key) + + if exists { + msg = fmt.Sprintf("key '%s' exists", request.Key) + } + + // Return response + return kvExistsResponse(module, msg, false, exists) +} + +// Generates a protobuf response, writes to mem, and returns ptr to mem +func kvExistsResponse(module api.Module, msg string, isError, exists bool) uint64 { + var status steps.KVStatus + + if exists { + status = steps.KVStatus_KV_STATUS_SUCCESS + } else { + status = steps.KVStatus_KV_STATUS_FAILURE + } + + if isError { + status = steps.KVStatus_KV_STATUS_ERROR + } + + resp := &steps.KVStepResponse{ + Status: status, + Message: msg, + Value: nil, // KVExists does not fill value + } + + addr, err := helper.WriteResponseToMemory(module, resp) + if err != nil { + panic("unable to write KVExistsResponse to memory: " + err.Error()) + } + + return addr +} + +func validateKVStep(request *steps.KVStep) error { + if request == nil { + return errors.New("request cannot be nil") + } + + if request.Key == "" { + return errors.New("request.Key cannot be empty") + } + + // TODO: Will eventually want to perform KVAction specific validations; good enough for now + + return nil +} diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/init_wasm.sh b/vendor/github.com/streamdal/streamdal/sdks/go/init_wasm.sh new file mode 100644 index 000000000..3081e1def --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/init_wasm.sh @@ -0,0 +1,30 @@ +#!/bin/bash -e + +mkdir -p test-assets/wasm + +# Step 1: Curl the GitHub API to get the latest release +latest_release=$(curl -s https://api.github.com/repos/streamdal/streamdal/releases) + +# Step 2: Extract the "browser_download_url" from the JSON response +download_url=$(echo "$latest_release" | grep -o 'https://.*/libs/wasm/.*/release\.zip' | head -1) + +if [ -z "$download_url" ]; then + echo "Error: Unable to find the download URL for the WASM artifact" + exit 1 +fi + +# Step 3: Add debug info +mkdir -p test-assets/wasm +version=$(echo $download_url | cut -d / -f10) +echo "WASM artifact version: ${version}" > test-assets/wasm/version.txt +echo "Last updated: $(date)" >> test-assets/wasm/version.txt + +# Step 4: Curl the download URL and save as release.zip +curl -L "$download_url" -o release.zip + +# Step 5: Unzip release.zip into the test-assets/wasm/ directory +unzip -o release.zip -d test-assets/wasm/ + +# Step 6: Clean up & info +rm release.zip +cat test-assets/wasm/version.txt diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/kv/kv.go b/vendor/github.com/streamdal/streamdal/sdks/go/kv/kv.go new file mode 100644 index 000000000..7f6a9d322 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/kv/kv.go @@ -0,0 +1,159 @@ +package kv + +import ( + "sync" + + "github.com/pkg/errors" + + "github.com/streamdal/streamdal/sdks/go/logger" +) + +var ( + ErrNilConfig = errors.New("config cannot be nil") +) + +type KV struct { + cfg *Config + kvs map[string]string + kvsMtx *sync.RWMutex + log logger.Logger +} + +//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . IKV +type IKV interface { + // Get gets a value from the KV store; bool indicates if value exists + Get(key string) (string, bool) + + // Set sets a key/value pair in the KV store; return bool indicates if key + // was overwritten + Set(key string, value string) bool + + // Delete will delete a key from the KV store; return bool indicates if + // key existed before deletion + Delete(key string) bool + + // Exists checks if a key exists in the KV store + Exists(key string) bool + + // Purge removes all keys from the KV store; return int indicates how many + // keys were removed. + Purge() int64 + + // Keys returns a slice of all keys in the KV store + Keys() []string + + // Items returns the number of keys in the KV store + Items() int64 +} + +type Config struct { + Logger logger.Logger +} + +func New(cfg *Config) (*KV, error) { + if err := validateConfig(cfg); err != nil { + return nil, errors.Wrap(err, "unable to validate config") + } + + return &KV{ + cfg: cfg, + kvs: make(map[string]string), + kvsMtx: &sync.RWMutex{}, + log: cfg.Logger, + }, nil +} + +func (k *KV) Get(key string) (string, bool) { + k.kvsMtx.RLock() + defer k.kvsMtx.RUnlock() + + if val, ok := k.kvs[key]; ok { + return val, true + } + + return "", false +} + +func (k *KV) Set(key string, value string) bool { + k.kvsMtx.Lock() + defer k.kvsMtx.Unlock() + + if _, ok := k.kvs[key]; ok { + k.kvs[key] = value + return true + } + + k.kvs[key] = value + return false +} + +func (k *KV) Delete(key string) bool { + k.kvsMtx.Lock() + defer k.kvsMtx.Unlock() + + exists := false + + if _, ok := k.kvs[key]; ok { + exists = true + } + + delete(k.kvs, key) + + return exists +} + +func (k *KV) Exists(key string) bool { + k.kvsMtx.RLock() + defer k.kvsMtx.RUnlock() + + if _, ok := k.kvs[key]; ok { + return true + } + + return false +} + +func (k *KV) Purge() int64 { + k.kvsMtx.Lock() + defer k.kvsMtx.Unlock() + + purged := int64(len(k.kvs)) + k.kvs = make(map[string]string) + + return purged +} + +func (k *KV) Keys() []string { + k.kvsMtx.RLock() + defer k.kvsMtx.RUnlock() + + keys := make([]string, len(k.kvs)) + + i := 0 + + for key := range k.kvs { + keys[i] = key + i++ + } + + return keys +} + +func (k *KV) Items() int64 { + k.kvsMtx.RLock() + defer k.kvsMtx.RUnlock() + + return int64(len(k.kvs)) +} + +func validateConfig(cfg *Config) error { + if cfg == nil { + return ErrNilConfig + } + + if cfg.Logger == nil { + cfg.Logger = &logger.TinyLogger{} + } + + return nil +} diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/logger/logger.go b/vendor/github.com/streamdal/streamdal/sdks/go/logger/logger.go new file mode 100644 index 000000000..c1a398c85 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/logger/logger.go @@ -0,0 +1,68 @@ +package logger + +import ( + "log" +) + +// Logger is the common interface for user-provided loggers. +// +//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . Logger +type Logger interface { + // Debug sends out a debug message with the given arguments to the logger. + Debug(args ...interface{}) + // Debugf formats a debug message using the given arguments and sends it to the logger. + Debugf(format string, args ...interface{}) + // Info sends out an informational message with the given arguments to the logger. + Info(args ...interface{}) + // Infof formats an informational message using the given arguments and sends it to the logger. + Infof(format string, args ...interface{}) + // Warn sends out a warning message with the given arguments to the logger. + Warn(args ...interface{}) + // Warnf formats a warning message using the given arguments and sends it to the logger. + Warnf(format string, args ...interface{}) + // Error sends out an error message with the given arguments to the logger. + Error(args ...interface{}) + // Errorf formats an error message using the given arguments and sends it to the logger. + Errorf(format string, args ...interface{}) +} + +// TinyLogger is an _almost_ no-op logger - if the user of the SDK does not +// inject their own logger, this logger will be used instead. This logger will +// print Warning and Error messages to STDOUT and will ignore Debug & Info. +type TinyLogger struct{} + +// Debug won't print anything. +func (l *TinyLogger) Debug(args ...interface{}) {} + +// Debugf is no-op implementation of Logger's Debugf. +func (l *TinyLogger) Debugf(format string, args ...interface{}) {} + +// Info is no-op implementation of Logger's Info. +func (l *TinyLogger) Info(args ...interface{}) {} + +// Infof is a no-op implementation of Logger's Infof. +func (l *TinyLogger) Infof(format string, args ...interface{}) {} + +// Warn will print the warn message to STDOUT. This will only be used if the +// user has NOT injected their own logger. +func (l *TinyLogger) Warn(args ...interface{}) { + log.Println(args...) +} + +// Warnf will print the warn message to STDOUT. This will only be used if the +// user has NOT injected their own logger. +func (l *TinyLogger) Warnf(format string, args ...interface{}) { + log.Printf(format, args...) +} + +// Error will print the error message to STDOUT. This will only be used if the +// user has NOT injected their own logger. +func (l *TinyLogger) Error(args ...interface{}) { + log.Println(args...) +} + +// Errorf will print the error message to STDOUT. This will only be used if the +// user has NOT injected their own logger. +func (l *TinyLogger) Errorf(format string, args ...interface{}) { + log.Printf(format, args...) +} diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/metrics/counter.go b/vendor/github.com/streamdal/streamdal/sdks/go/metrics/counter.go new file mode 100644 index 000000000..6501817b4 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/metrics/counter.go @@ -0,0 +1,62 @@ +package metrics + +import ( + "strings" + "sync" + "time" + + "github.com/streamdal/streamdal/sdks/go/types" +) + +type counter struct { + entry *types.CounterEntry + count int64 + countMutex *sync.RWMutex + lastUpdated time.Time +} + +// getValue increases the total for a getValue counter +func (c *counter) incr(entry *types.CounterEntry) { + c.countMutex.Lock() + defer c.countMutex.Unlock() + + c.count += entry.Value + c.lastUpdated = time.Now().UTC() +} + +func (c *counter) getLastUpdated() time.Time { + c.countMutex.RLock() + defer c.countMutex.RUnlock() + + return c.lastUpdated +} + +// getValue returns the total for a getValue counter +func (c *counter) getValue() int64 { + c.countMutex.RLock() + defer c.countMutex.RUnlock() + + return c.count +} + +func (c *counter) getEntry() types.CounterEntry { + e := c.entry + e.Value = c.getValue() + return *e +} + +func compositeID(e *types.CounterEntry) string { + labelVals := make([]string, 0) + labelVals = append(labelVals, string(e.Name)) + for _, v := range e.Labels { + labelVals = append(labelVals, v) + } + return strings.Join(labelVals, "-") +} + +func (c *counter) reset() { + c.countMutex.Lock() + defer c.countMutex.Unlock() + + c.count = 0 +} diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/metrics/metrics.go b/vendor/github.com/streamdal/streamdal/sdks/go/metrics/metrics.go new file mode 100644 index 000000000..d66dc0c8b --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/metrics/metrics.go @@ -0,0 +1,386 @@ +// Package metrics is responsible for tracking and publishing metrics to the Streamdal server. +package metrics + +import ( + "context" + "fmt" + "strings" + "sync" + "time" + + "github.com/pkg/errors" + "github.com/relistan/go-director" + + "github.com/streamdal/streamdal/sdks/go/logger" + "github.com/streamdal/streamdal/sdks/go/server" + "github.com/streamdal/streamdal/sdks/go/types" +) + +//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . IMetrics +type IMetrics interface { + // Incr increases a counter with the given entry. + // If a counter does not exist for this entry yet, one will be created. + Incr(ctx context.Context, entry *types.CounterEntry) error +} + +const ( + // defaultIncrInterval defines how often we process the increase queue + defaultIncrInterval = time.Second + + // defaultReaperInterval is how often the reaper goroutine will delete stale counters + // A stale counter is one with zero value and last updated time > ReaperTTL + defaultReaperInterval = 10 * time.Second + + // defaultReaperTTL is how long a counter can be stale before it is reaped + // A stale counter is one with zero value and last updated time > ReaperTTL + defaultReaperTTL = 10 * time.Second + + // defaultWorkerPoolSize is how many counter workers will be spun up. + // These workers are responsible for processing the counterIncrCh and counterPublishCh channels + defaultWorkerPoolSize = 10 + + // serverFlushTimeout is the maximum amount of time to wait before flushing metrics to the server + serverFlushTimeout = time.Second * 2 + + // serverFlushMaxBatchSize is the largest a batch of metrics will grow before being flushed to the server + serverFlushMaxBatchSize = 100 +) + +var ( + ErrMissingConfig = errors.New("config cannot be nil") + ErrMissingServerClient = errors.New("ServerClient cannot be nil") + ErrMissingEntry = errors.New("CounterEntry cannot be nil") + ErrEmptyName = errors.New("Name must be set") + ErrMissingShutdownCtx = errors.New("ShutdownCtx cannot be nil") +) + +type Metrics struct { + *Config + + wg *sync.WaitGroup + counterMapMutex *sync.RWMutex + counterTickerLooper director.Looper + counterReaperLooper director.Looper + counterMap map[string]*counter + counterIncrCh chan *types.CounterEntry + counterPublishCh chan *types.CounterEntry +} + +type Config struct { + IncrInterval time.Duration + ReaperInterval time.Duration + ReaperTTL time.Duration + WorkerPoolSize int + ServerClient server.IServerClient + ShutdownCtx context.Context + Log logger.Logger +} + +func New(cfg *Config) (*Metrics, error) { + if err := validateConfig(cfg); err != nil { + return nil, errors.Wrap(err, "unable to validate config") + } + + m := &Metrics{ + Config: cfg, + counterMap: make(map[string]*counter), + counterMapMutex: &sync.RWMutex{}, + counterTickerLooper: director.NewFreeLooper(director.FOREVER, make(chan error, 1)), + counterReaperLooper: director.NewFreeLooper(director.FOREVER, make(chan error, 1)), + counterIncrCh: make(chan *types.CounterEntry, 10000), + counterPublishCh: make(chan *types.CounterEntry, 10000), + wg: &sync.WaitGroup{}, + } + + // Launch counter worker pool + for i := 0; i < m.Config.WorkerPoolSize; i++ { + m.wg.Add(1) + go m.runCounterWorkerPool( + fmt.Sprintf("worker-%d", i), + director.NewFreeLooper(director.FOREVER, make(chan error, 1)), + ) + } + + // Launch counter ticker + m.wg.Add(1) + go m.runCounterTicker() + + // Launch counter reaper + m.wg.Add(1) + go m.runCounterReaper() + + return m, nil +} + +func validateConfig(cfg *Config) error { + if cfg == nil { + return ErrMissingConfig + } + + if cfg.ServerClient == nil { + return ErrMissingServerClient + } + + if cfg.ShutdownCtx == nil { + return ErrMissingShutdownCtx + } + + applyDefaults(cfg) + + return nil +} + +func applyDefaults(cfg *Config) { + if cfg.IncrInterval == 0 { + cfg.IncrInterval = defaultIncrInterval + } + + if cfg.ReaperInterval == 0 { + cfg.ReaperInterval = defaultReaperInterval + } + + if cfg.ReaperTTL == 0 { + cfg.ReaperTTL = defaultReaperTTL + } + + if cfg.WorkerPoolSize == 0 { + cfg.WorkerPoolSize = defaultWorkerPoolSize + } + + if cfg.Log == nil { + cfg.Log = &logger.TinyLogger{} + } +} + +func (m *Metrics) Incr(_ context.Context, entry *types.CounterEntry) error { + if err := validateCounterEntry(entry); err != nil { + return errors.Wrap(err, "unable to validate counter entry") + } + + // counterIncrCh is a buffered channel (10k by default) so Incr() shouldn't + // generally block. If it does, it is because the worker pool is lagging behind. + m.counterIncrCh <- entry + + return nil +} + +func validateCounterEntry(entry *types.CounterEntry) error { + if entry == nil { + return ErrMissingEntry + } + + if entry.Name == "" { + return ErrEmptyName + } + + return nil +} + +func (m *Metrics) newCounter(e *types.CounterEntry) *counter { + m.counterMapMutex.Lock() + defer m.counterMapMutex.Unlock() + + c := &counter{ + entry: e, + countMutex: &sync.RWMutex{}, + } + + m.counterMap[compositeID(e)] = c + + return c +} + +func (m *Metrics) getCounter(e *types.CounterEntry) (*counter, bool) { + m.counterMapMutex.RLock() + defer m.counterMapMutex.RUnlock() + + if counter, ok := m.counterMap[compositeID(e)]; ok { + return counter, true + } + + return nil, false +} + +// getCounters fetches active counters +func (m *Metrics) getCounters() map[string]*counter { + m.counterMapMutex.RLock() + defer m.counterMapMutex.RUnlock() + + localCounters := make(map[string]*counter) + + for counterID, counter := range m.counterMap { + localCounters[counterID] = counter + } + + return localCounters +} + +func (m *Metrics) incr(_ context.Context, entry *types.CounterEntry) error { + // No need to validate - no way to reach here without validate + c, ok := m.getCounter(entry) + if ok { + c.incr(entry) + return nil + } + + c = m.newCounter(entry) + c.incr(entry) + + return nil +} + +// runCounterWorkerPool is responsible for listening for Incr() requests and +// flush requests (from ticker runner). +func (m *Metrics) runCounterWorkerPool(_ string, looper director.Looper) { + defer m.wg.Done() + + var ( + err error + shutdown bool + ) + + // Batch metrics entries to send to server + metricsEntries := make([]*types.CounterEntry, 0) + lastFlush := time.Now().UTC() + + looper.Loop(func() error { + // Give looper a moment to catch up + if shutdown { + time.Sleep(100 * time.Millisecond) + return nil + } + + select { + case entry := <-m.counterIncrCh: // Coming from user doing Incr() // buffered chan + err = m.incr(context.Background(), entry) + case entry := <-m.counterPublishCh: // Coming from ticker runner + m.Log.Debugf("received publish for counter '%s', getValue: %d", entry.Name, entry.Value) + metricsEntries = append(metricsEntries, entry) + case <-m.ShutdownCtx.Done(): + m.Log.Debugf("received notice to shutdown") + looper.Quit() + shutdown = true + + return nil + } + + if err != nil { + m.Log.Errorf("worker pool error: %s", err) + } + + if len(metricsEntries) > serverFlushMaxBatchSize || time.Now().UTC().Sub(lastFlush) > serverFlushTimeout { + err = m.ServerClient.SendMetrics(context.Background(), metricsEntries) + + // Reset regardless of errors. We don't want to eat up memory or block channels + metricsEntries = make([]*types.CounterEntry, 0) + lastFlush = time.Now().UTC() + + if err != nil && strings.Contains(err.Error(), "connection refused") { + // Server went away, log, sleep, and wait for reconnect + m.Log.Warn("failed to send metrics, streamdal server went away, waiting for reconnect") + time.Sleep(time.Second * 5) + return nil + } + } + + return nil + }) + + m.Log.Debugf("exiting runCounterWorkerPool") +} + +func (m *Metrics) runCounterTicker() { + defer m.wg.Done() + + var shutdown bool + + ticker := time.NewTicker(m.Config.IncrInterval) + + m.counterTickerLooper.Loop(func() error { + // Give looper a moment to catch up + if shutdown { + time.Sleep(100 * time.Millisecond) + return nil + } + + select { + case <-ticker.C: + counters := m.getCounters() + + for _, counter := range counters { + counterValue := counter.getValue() + + // Do not publish zero values + if counterValue == 0 { + continue + } + + // Get CounterEntry w/ overwritten value + entry := counter.getEntry() + + // Reset counter back to 0 + counter.reset() + + // If this blocks, it indicates that worker pool is lagging behind + m.counterPublishCh <- &entry + } + case <-m.ShutdownCtx.Done(): + m.Log.Debugf("received notice to shutdown") + m.counterTickerLooper.Quit() + shutdown = true + } + + return nil + }) + + m.Log.Debugf("exiting runCounterTicker()") +} + +func (m *Metrics) runCounterReaper() { + defer m.wg.Done() + + var shutdown bool + + ticker := time.NewTicker(m.Config.ReaperInterval) + + m.counterReaperLooper.Loop(func() error { + if shutdown { + time.Sleep(100 * time.Millisecond) + return nil + } + + select { + case <-ticker.C: + counters := m.getCounters() + + for counterID, counter := range counters { + // Do not reap active counters + if counter.getValue() != 0 { + m.Log.Debugf("skipping reaping for zero counter '%s'", counter.entry) + continue + } + + if time.Now().Sub(counter.getLastUpdated()) < m.Config.ReaperTTL { + m.Log.Debugf("skipping reaping for non-stale counter '%s'", counter.entry) + continue + } + + m.Log.Debugf("reaped stale counter '%s'", counter.entry) + + m.counterMapMutex.Lock() + delete(m.counterMap, counterID) + m.counterMapMutex.Unlock() + } + case <-m.ShutdownCtx.Done(): + m.Log.Debugf("received notice to shutdown") + m.counterReaperLooper.Quit() + shutdown = true + + return nil + } + + return nil + }) + + m.Log.Debugf("exiting runCounterReaper()") +} diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/register.go b/vendor/github.com/streamdal/streamdal/sdks/go/register.go new file mode 100644 index 000000000..ebc3119a1 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/register.go @@ -0,0 +1,286 @@ +package streamdal + +import ( + "context" + "fmt" + "runtime" + "strings" + "time" + + "github.com/pkg/errors" + "github.com/relistan/go-director" + "github.com/streamdal/streamdal/libs/protos/build/go/protos" + "github.com/streamdal/streamdal/libs/protos/build/go/protos/shared" + + "github.com/streamdal/streamdal/sdks/go/validate" +) + +func (s *Streamdal) genClientInfo() *protos.ClientInfo { + return &protos.ClientInfo{ + ClientType: protos.ClientType(s.config.ClientType), + LibraryName: "go-sdk", + LibraryVersion: "0.1.12", + Language: "go", + Arch: runtime.GOARCH, + Os: runtime.GOOS, + } +} + +func (s *Streamdal) register(looper director.Looper) error { + req := &protos.RegisterRequest{ + ServiceName: s.config.ServiceName, + SessionId: s.sessionID, + ClientInfo: s.genClientInfo(), + Audiences: make([]*protos.Audience, 0), + DryRun: s.config.DryRun, + } + + s.audiencesMtx.Lock() + for _, aud := range s.config.Audiences { + pAud := aud.toProto(s.config.ServiceName) + req.Audiences = append(req.Audiences, pAud) + s.audiences[audToStr(pAud)] = struct{}{} + } + s.audiencesMtx.Unlock() + + var ( + stream protos.Internal_RegisterClient + err error + quit bool + initialRegister = true + initialRegisterErr error + ) + + // This might not error even if the handler returns an err - need to attempt + // to perform a recv to verify. + srv, err := s.serverClient.Register(s.config.ShutdownCtx, req) + if err != nil { + return errors.Wrap(err, "unable to complete initial registration with streamdal server") + } + + stream = srv + + looper.Loop(func() error { + if quit { + time.Sleep(time.Millisecond * 100) + return nil + } + + // This is here to enable reconnects; no way to hit this case for a + // "first register attempt" because "stream" won't be nil on initial launch. + if stream == nil { + s.config.Logger.Debug("stream is nil, attempting to register") + + if err := s.serverClient.Reconnect(); err != nil { + s.config.Logger.Errorf("Failed to reconnect with streamdal server: %s, retrying in '%s'", err, ReconnectSleep.String()) + time.Sleep(ReconnectSleep) + return nil + } + + s.config.Logger.Debug("successfully reconnected to streamdal server") + + newStream, err := s.serverClient.Register(s.config.ShutdownCtx, req) + if err != nil { + if strings.Contains(err.Error(), context.Canceled.Error()) { + s.config.Logger.Debug("context cancelled during connect") + quit = true + looper.Quit() + + return nil + } + + s.config.Logger.Errorf("Failed to re-register with streamdal server: %s, retrying in '%s'", err, ReconnectSleep.String()) + time.Sleep(ReconnectSleep) + + return nil + } + + s.config.Logger.Debug("successfully re-registered to streamdal server") + + stream = newStream + + // Re-announce audience (if we had any) - this is needed so that + // streamdal server repopulates live entry in live:* prefix (which is used + // for DetachPipeline()) + s.addAudiences(s.config.ShutdownCtx) + } + + // Blocks until something is received + cmd, err := stream.Recv() + if err != nil { + // This is the first registration attempt and it has failed. + // Depending on IgnoreStartupError, we may need to stop the loop + // and tell the caller that we failed to complete registration. + if initialRegister && !s.config.IgnoreStartupError { + initialRegisterErr = err + quit = true + looper.Quit() + + return nil + } + + if err.Error() == "rpc error: code = Canceled desc = context canceled" { + s.config.Logger.Errorf("context cancelled during recv: %s", err) + quit = true + looper.Quit() + return nil + } + + // Reset stream - cause re-register on error + stream = nil + + // Nicer reconnect messages + if strings.Contains(err.Error(), "reading from server: EOF") { + s.config.Logger.Warnf("streamdal server is unavailable, retrying in %s...", ReconnectSleep.String()) + } else if strings.Contains(err.Error(), "server shutting down") { + s.config.Logger.Warnf("streamdal server is shutting down, retrying in %s...", ReconnectSleep.String()) + } else { + s.config.Logger.Warnf("error receiving message, retrying in %s: %s", ReconnectSleep.String(), err) + } + + time.Sleep(ReconnectSleep) + + return nil + } + + // Initial registration has succeeded - no longer need to bail out if we + // encounter any errors + initialRegister = false + + if err := s.handleCommand(stream.Context(), cmd); err != nil { + s.config.Logger.Errorf("Failed to handle command: %s", cmd.Command) + return nil + } + + return nil + }) + + if initialRegister { + return errors.Wrap(initialRegisterErr, + "failed to complete initial registration with streamdal server (and IgnoreStartupError is set to 'false')", + ) + } + + return nil +} + +func (s *Streamdal) handleCommand(ctx context.Context, cmd *protos.Command) error { + if cmd == nil { + s.config.Logger.Debug("Received nil command, ignoring") + return nil + } + + if cmd.GetKeepAlive() != nil { + s.config.Logger.Debug("Received keep alive") + return nil + } + + if cmd.Audience != nil && cmd.Audience.ServiceName != s.config.ServiceName { + s.config.Logger.Debugf("Received command for different service name: %s, ignoring command", cmd.Audience.ServiceName) + return nil + } + + var err error + + switch cmd.Command.(type) { + case *protos.Command_SetPipelines: + s.config.Logger.Debug("Received set pipelines command") + err = s.setPipelines(ctx, cmd) + case *protos.Command_Kv: + s.config.Logger.Debug("Received kv command") + err = s.handleKVCommand(ctx, cmd.GetKv()) + case *protos.Command_Tail: + s.config.Logger.Debug("Received tail command") + err = s.handleTailCommand(ctx, cmd) + default: + err = fmt.Errorf("unknown command type: %+v", cmd.Command) + } + + return err +} + +func (s *Streamdal) handleTailCommand(_ context.Context, cmd *protos.Command) error { + tail := cmd.GetTail() + + if tail == nil { + s.config.Logger.Errorf("Received tail command with nil tail; full cmd: %+v", cmd) + return nil + } + + if tail.GetRequest() == nil { + s.config.Logger.Errorf("Received tail command with nil Request; full cmd: %+v", cmd) + return nil + } + + audStr := audToStr(tail.GetRequest().Audience) + + var err error + + switch tail.GetRequest().Type { + case protos.TailRequestType_TAIL_REQUEST_TYPE_START: + s.config.Logger.Debugf("Received start tail command for audience '%s'", audStr) + err = s.startTailHandler(context.Background(), cmd) + case protos.TailRequestType_TAIL_REQUEST_TYPE_STOP: + s.config.Logger.Debugf("Received stop tail command for audience '%s'", audStr) + err = s.stopTailHandler(context.Background(), cmd) + case protos.TailRequestType_TAIL_REQUEST_TYPE_PAUSE: + s.config.Logger.Debugf("Received pause tail command for audience '%s'", audStr) + err = s.pauseTailHandler(context.Background(), cmd) + case protos.TailRequestType_TAIL_REQUEST_TYPE_RESUME: + s.config.Logger.Debugf("Received resume tail command for audience '%s'", audStr) + err = s.resumeTailHandler(context.Background(), cmd) + default: + return fmt.Errorf("unknown tail command type: %s", tail.GetRequest().Type) + } + + return err +} + +func (s *Streamdal) handleKVCommand(_ context.Context, kv *protos.KVCommand) error { + if err := validate.KVCommand(kv); err != nil { + return errors.Wrap(err, "failed to validate kv command") + } + + for _, i := range kv.Instructions { + if err := validate.KVInstruction(i); err != nil { + s.config.Logger.Debugf("KV instruction '%s' failed validate: %s (skipping)", i.Action, err) + continue + } + + switch i.Action { + case shared.KVAction_KV_ACTION_CREATE, shared.KVAction_KV_ACTION_UPDATE: + s.config.Logger.Debugf("attempting to perform '%s' KV instruction for key '%s'", i.Action, i.Object.Key) + s.kv.Set(i.Object.Key, string(i.Object.Value)) + case shared.KVAction_KV_ACTION_DELETE: + s.config.Logger.Debugf("attempting to perform '%s' KV instruction for key '%s'", i.Action, i.Object.Key) + s.kv.Delete(i.Object.Key) + case shared.KVAction_KV_ACTION_DELETE_ALL: + s.config.Logger.Debugf("attempting to perform '%s' KV instruction", i.Action) + s.kv.Purge() + default: + s.config.Logger.Debugf("invalid KV action '%s' - skipping", i.Action) + continue + } + } + + return nil +} + +func (s *Streamdal) setPipelines(_ context.Context, cmd *protos.Command) error { + if cmd == nil { + return ErrEmptyCommand + } + + if err := validate.SetPipelinesCommand(cmd); err != nil { + return errors.Wrap(err, "failed to validate set pipelines command") + } + + s.pipelinesMtx.Lock() + defer s.pipelinesMtx.Unlock() + + s.pipelines[audToStr(cmd.Audience)] = cmd.GetSetPipelines().Pipelines + + s.config.Logger.Debugf("saved '%d' pipelines for audience '%s'", len(cmd.GetSetPipelines().Pipelines), audToStr(cmd.Audience)) + + return nil +} diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/schema.go b/vendor/github.com/streamdal/streamdal/sdks/go/schema.go new file mode 100644 index 000000000..3ae0dd34f --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/schema.go @@ -0,0 +1,64 @@ +package streamdal + +import ( + "context" + + "github.com/streamdal/streamdal/libs/protos/build/go/protos" +) + +func (s *Streamdal) getSchema(_ context.Context, aud *protos.Audience) []byte { + s.schemasMtx.RLock() + defer s.schemasMtx.RUnlock() + + schema, ok := s.schemas[audToStr(aud)] + if !ok { + return []byte(``) + } + + return schema.JsonSchema +} + +func (s *Streamdal) setSchema(_ context.Context, aud *protos.Audience, schema []byte) { + s.schemasMtx.Lock() + defer s.schemasMtx.Unlock() + + s.schemas[audToStr(aud)] = &protos.Schema{ + JsonSchema: schema, + } +} + +// handleSchema will handle the schema step in the pipeline, if necessary +func (s *Streamdal) handleSchema(ctx context.Context, aud *protos.Audience, step *protos.PipelineStep, resp *protos.WASMResponse) bool { + inferSchema := step.GetInferSchema() + + if inferSchema == nil { + // nothing to do + return false + } + + if resp.ExitCode != protos.WASMExitCode_WASM_EXIT_CODE_TRUE { + return false + } + + // Get existing schema for audience + existingSchema := s.getSchema(ctx, aud) + + if string(resp.OutputStep) == string(existingSchema) { + // Schema matches what we have in memory, nothing to do + return false + } + + // Schema is new or modified, update in memory and send to the server + s.setSchema(ctx, aud, resp.OutputStep) + + go func() { + err := s.serverClient.SendSchema(ctx, aud, resp.OutputStep) + if err != nil { + s.config.Logger.Errorf("failed to send schema: %s", err) + } + + s.config.Logger.Debugf("published schema for audience '%s'", audToStr(aud)) + }() + + return true +} diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/server/client.go b/vendor/github.com/streamdal/streamdal/sdks/go/server/client.go new file mode 100644 index 000000000..ff30974ad --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/server/client.go @@ -0,0 +1,246 @@ +// Package server is a wrapper for the Client gRPC API. +// It provides a simple interface to interact with and mock. +package server + +import ( + "context" + "strings" + "time" + + "github.com/pkg/errors" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/keepalive" + "google.golang.org/grpc/metadata" + + "github.com/streamdal/streamdal/libs/protos/build/go/protos" + + "github.com/streamdal/streamdal/sdks/go/types" +) + +//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . IServerClient +type IServerClient interface { + // GetSetPipelinesCommandByService is called in New() in order to get all AttachCommands in a synchronous manner + // before we allow the client to start processing. + GetSetPipelinesCommandByService(ctx context.Context, service string) (*protos.GetSetPipelinesCommandsByServiceResponse, error) + + // GetTailStream returns a gRPC client stream used to send TailResponses to the streamdal server + GetTailStream(ctx context.Context) (protos.Internal_SendTailClient, error) + + // HeartBeat sends a heartbeat to the streamdal server + HeartBeat(ctx context.Context, req *protos.HeartbeatRequest) error + + // NewAudience announces a new audience to the streamdal server + NewAudience(ctx context.Context, aud *protos.Audience, sessionID string) error + + // Notify calls to streamdal server to trigger the configured notification rules for the specified step + Notify(ctx context.Context, pipeline *protos.Pipeline, step *protos.PipelineStep, aud *protos.Audience, payload []byte, conditionType protos.NotifyRequest_ConditionType) error + + // Reconnect closes any open gRPC connection to the streamdal server and re-establishes a new connection + // This method won't perform retries as that should be determined by the caller + Reconnect() error + + // Register registers a new client with the streamdal server. + // This is ran in a goroutine and constantly listens for commands from the streamdal server + // such as AttachPipeline, DetachPipeline, etc + Register(ctx context.Context, req *protos.RegisterRequest) (protos.Internal_RegisterClient, error) + + // SendMetrics ships counter(s) to the server + SendMetrics(ctx context.Context, counters []*types.CounterEntry) error + + // SendSchema sends a schema to the streamdal server + SendSchema(ctx context.Context, aud *protos.Audience, jsonSchema []byte) error +} + +const ( + maxGRPCMessageRecvSize = 10 * 1024 * 1024 // 10MB + dialTimeout = time.Second * 5 +) + +type Client struct { + ServerAddr string + Token string + Conn *grpc.ClientConn + Server protos.InternalClient +} + +// New dials a streamdal GRPC server and returns IServerClient +func New(serverAddr, serverToken string) (*Client, error) { + conn, err := dialServer(serverAddr) + if err != nil { + return nil, errors.Wrap(err, "unable to dial streamdal server") + } + + return &Client{ + Conn: conn, + Server: protos.NewInternalClient(conn), + Token: serverToken, + ServerAddr: serverAddr, + }, nil +} + +func dialServer(serverAddr string) (*grpc.ClientConn, error) { + dialCtx, dialCancel := context.WithTimeout(context.Background(), dialTimeout) + defer dialCancel() + + opts := make([]grpc.DialOption, 0) + opts = append(opts, + grpc.WithKeepaliveParams(keepalive.ClientParameters{ + // Enable keepalive; ping every 10s + Time: 10 * time.Second, + + // Close stream if there is still no activity after 30s. + // + // NOTE: there should ALWAYS be activity on the streams because the + // server sends periodic heartbeats to the client AND the client + // sends periodic heartbeats to the server. If stream is disconnected, + // client will auto re-establish connectivity with the server. + Timeout: 30 * time.Second, + }), + grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxGRPCMessageRecvSize)), + grpc.WithTransportCredentials(insecure.NewCredentials()), + ) + + conn, err := grpc.DialContext(dialCtx, serverAddr, opts...) + if err != nil { + return nil, errors.Wrap(err, "could not dial GRPC server: %s") + } + + return conn, nil +} + +func (c *Client) Reconnect() error { + // Don't care about any error here, the connection might be open or closed + _ = c.Conn.Close() + + conn, err := dialServer(c.ServerAddr) + if err != nil { + return errors.Wrap(err, "unable to reconnect to streamdal server") + } + + c.Conn = conn + c.Server = protos.NewInternalClient(conn) + + return nil +} + +func (c *Client) Notify( + ctx context.Context, + pipeline *protos.Pipeline, + step *protos.PipelineStep, + aud *protos.Audience, + payload []byte, + conditionType protos.NotifyRequest_ConditionType, +) error { + ctx = metadata.NewOutgoingContext(ctx, metadata.Pairs("auth-token", c.Token)) + + req := &protos.NotifyRequest{ + PipelineId: pipeline.Id, + Audience: aud, + OccurredAtUnixTsUtc: time.Now().UTC().Unix(), + ConditionType: conditionType, + Step: step, + Payload: payload, + } + + if _, err := c.Server.Notify(ctx, req); err != nil { + return errors.Wrap(err, "unable to send rule notification") + } + + return nil +} + +func (c *Client) SendMetrics(ctx context.Context, counters []*types.CounterEntry) error { + ctx = metadata.NewOutgoingContext(ctx, metadata.Pairs("auth-token", c.Token)) + + req := &protos.MetricsRequest{ + Metrics: make([]*protos.Metric, 0), + } + + for _, counter := range counters { + labels := make(map[string]string) + for k, v := range counter.Labels { + labels[k] = v + } + + req.Metrics = append(req.Metrics, &protos.Metric{ + Name: string(counter.Name), + Audience: counter.Audience, + Value: float64(counter.Value), + Labels: labels, + }) + } + + if _, err := c.Server.Metrics(ctx, req); err != nil { + return errors.Wrap(err, "unable to send metrics") + } + + return nil +} + +func (c *Client) Register(ctx context.Context, req *protos.RegisterRequest) (protos.Internal_RegisterClient, error) { + ctx = metadata.NewOutgoingContext(ctx, metadata.Pairs("auth-token", c.Token)) + + return c.Server.Register(ctx, req) +} + +func (c *Client) NewAudience(ctx context.Context, aud *protos.Audience, sessionID string) error { + ctx = metadata.NewOutgoingContext(ctx, metadata.Pairs("auth-token", c.Token)) + + aud.ServiceName = strings.ToLower(aud.ServiceName) + aud.ComponentName = strings.ToLower(aud.ComponentName) + aud.OperationName = strings.ToLower(aud.OperationName) + + _, err := c.Server.NewAudience(ctx, &protos.NewAudienceRequest{ + Audience: aud, + SessionId: sessionID, + }) + return err +} + +func (c *Client) HeartBeat(ctx context.Context, req *protos.HeartbeatRequest) error { + ctx = metadata.NewOutgoingContext(ctx, metadata.Pairs("auth-token", c.Token)) + + _, err := c.Server.Heartbeat(ctx, req) + return err +} + +func (c *Client) GetSetPipelinesCommandByService(ctx context.Context, service string) (*protos.GetSetPipelinesCommandsByServiceResponse, error) { + ctx = metadata.NewOutgoingContext(ctx, metadata.Pairs("auth-token", c.Token)) + + resp, err := c.Server.GetSetPipelinesCommandsByService(ctx, &protos.GetSetPipelinesCommandsByServiceRequest{ServiceName: service}) + if err != nil { + return nil, errors.Wrap(err, "unable to get set pipeline commands by service") + } + + return resp, nil +} + +func (c *Client) GetTailStream(ctx context.Context) (protos.Internal_SendTailClient, error) { + ctx = metadata.NewOutgoingContext(ctx, metadata.Pairs("auth-token", c.Token)) + + srv, err := c.Server.SendTail(ctx) + if err != nil { + return nil, errors.Wrap(err, "unable to talk to streamdal server") + } + + return srv, nil +} + +func (c *Client) SendSchema(ctx context.Context, aud *protos.Audience, jsonSchema []byte) error { + ctx = metadata.NewOutgoingContext(ctx, metadata.Pairs("auth-token", c.Token)) + + req := &protos.SendSchemaRequest{ + Audience: aud, + Schema: &protos.Schema{ + JsonSchema: jsonSchema, + }, + } + + _, err := c.Server.SendSchema(ctx, req) + if err != nil { + return errors.Wrap(err, "unable to send schema") + } + + return nil +} diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/tail.go b/vendor/github.com/streamdal/streamdal/sdks/go/tail.go new file mode 100644 index 000000000..f6eb54ea5 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/tail.go @@ -0,0 +1,407 @@ +package streamdal + +import ( + "context" + "io" + "strings" + "time" + + "github.com/pkg/errors" + "github.com/relistan/go-director" + "golang.org/x/time/rate" + + "github.com/streamdal/streamdal/libs/protos/build/go/protos" + + "github.com/streamdal/streamdal/sdks/go/logger" + "github.com/streamdal/streamdal/sdks/go/metrics" + "github.com/streamdal/streamdal/sdks/go/server" + "github.com/streamdal/streamdal/sdks/go/types" + "github.com/streamdal/streamdal/sdks/go/validate" +) + +const ( + // NumTailWorkers is the number of tail workers to start for each tail request + // The workers are responsible for reading from the tail channel and streaming + // TailResponse messages to the server + NumTailWorkers = 2 + + // MinTailResponseIntervalMS is how often we send a TailResponse to the server + // If this rate is exceeded, we will drop messages rather than flooding the server + // This is an int to avoid a .Milliseconds() call + MinTailResponseIntervalMS = 10 +) + +type Tail struct { + Request *protos.Command + CancelFunc context.CancelFunc + + outboundCh chan *protos.TailResponse + streamdalServer server.IServerClient + metrics metrics.IMetrics + cancelCtx context.Context + lastMsg time.Time + log logger.Logger + active bool + limiter *rate.Limiter +} + +func (t *Tail) ShouldSend() bool { + // If no rate limit, allow all messages + if t.limiter == nil { + return true + } + + return t.limiter.Allow() +} + +func (s *Streamdal) sendTail(aud *protos.Audience, pipelineID string, originalData []byte, postPipelineData []byte) { + tails := s.getTailsForAudience(aud) + if len(tails) == 0 { + return + } + + for _, tail := range tails { + tailID := tail.Request.GetTail().Request.Id + + if !tail.active { + tail.log.Debugf("tail id '%s' is not active - starting workers", tailID) + + if err := tail.startWorkers(); err != nil { + tail.log.Errorf("error starting tail workers for request '%s': %s", err, tailID) + continue + } + + // Save tail state + tail.active = true + } + + if !tail.ShouldSend() { + continue + } + + tr := &protos.TailResponse{ + Type: protos.TailResponseType_TAIL_RESPONSE_TYPE_PAYLOAD, + TailRequestId: tailID, + Audience: aud, + PipelineId: pipelineID, + SessionId: s.sessionID, + TimestampNs: time.Now().UTC().UnixNano(), + OriginalData: originalData, + NewData: postPipelineData, + } + + tail.ShipResponse(tr) + } +} + +func (t *Tail) ShipResponse(tr *protos.TailResponse) { + // If we're sending too fast, drop the message + if time.Since(t.lastMsg).Milliseconds() < MinTailResponseIntervalMS { + _ = t.metrics.Incr(context.Background(), &types.CounterEntry{ + Name: types.DroppedTailMessages, + Labels: map[string]string{}, + Value: 1}) + + t.log.Warnf("sending tail responses too fast - dropping message for tail request id '%s'", tr.TailRequestId) + return + } + + t.outboundCh <- tr + t.lastMsg = time.Now() +} + +func (t *Tail) startWorkers() error { + for i := 0; i < NumTailWorkers; i++ { + // Start SDK -> Server streaming gRPC connection + stream, err := t.streamdalServer.GetTailStream(t.cancelCtx) + if err != nil { + return errors.Wrap(err, "error starting tail worker") + } + + looper := director.NewFreeLooper(director.FOREVER, make(chan error, 1)) + + go t.startWorker(looper, stream) + } + + return nil +} + +func (t *Tail) startWorker(looper director.Looper, stream protos.Internal_SendTailClient) { + if stream == nil { + t.log.Error("stream is nil, unable to start tail worker") + return + } + + // Always cancel the context regardless of how we exit so + // that getTailsForAudience() can remove the tail from the map + defer t.CancelFunc() + + var quit bool + + looper.Loop(func() error { + if quit { + time.Sleep(time.Millisecond * 50) + return nil + } + + select { + case <-t.cancelCtx.Done(): + t.log.Debug("tail worker cancelled") + quit = true + looper.Quit() + return nil + case <-stream.Context().Done(): + t.log.Debug("tail worker context terminated") + quit = true + looper.Quit() + return nil + case resp := <-t.outboundCh: + if err := stream.Send(resp); err != nil { + if strings.Contains(err.Error(), io.EOF.Error()) { + t.log.Debug("tail worker received EOF, exiting") + return nil + } + if strings.Contains(err.Error(), "connection refused") { + // Streamdal server went away, log, sleep, and wait for reconnect + t.log.Warn("failed to send tail response, streamdal server went away, waiting for reconnect") + time.Sleep(ReconnectSleep) + return nil + } + t.log.Errorf("error sending tail: %s", err) + } + } + return nil + }) +} + +// startTailHandler will record the start tail request in the main tail map. +// Starting of the tail workers is done in the sendTail() method which is called +// during .Process() calls. +func (s *Streamdal) startTailHandler(_ context.Context, cmd *protos.Command) error { + if err := validate.TailRequestStartCommand(cmd); err != nil { + return errors.Wrap(err, "invalid tail command") + } + + // Check if we have this audience + audStr := audToStr(cmd.Audience) + + // If this is a start that was given to us as part of an initial Register(), + // then we will probably not know about the audience(s) yet, so we should + // keep ALL StartTail requests in memory until we see the audience mentioned + // in a .Process(). + // + // Optimization for the future: TTL the tail request for 24h and refresh the + // the TTL when we see the audience in a .Process() call. This would prevent + // the tail map from growing indefinitely. ~DS + + s.config.Logger.Debugf("received tail command for audience '%s'; saving to tail map", audStr) + + ctx, cancel := context.WithCancel(s.config.ShutdownCtx) + + // Create entry in tail map + t := &Tail{ + Request: cmd, + outboundCh: make(chan *protos.TailResponse, 100), + cancelCtx: ctx, + CancelFunc: cancel, + streamdalServer: s.serverClient, + metrics: s.metrics, + log: s.config.Logger, + lastMsg: time.Now(), + active: false, + } + + // Convert sample interval from seconds to time.Duration + if sampleOpts := cmd.GetTail().Request.GetSampleOptions(); sampleOpts != nil { + // Convert seconds to nanoseconds + interval := time.Duration(sampleOpts.SampleIntervalSeconds) * time.Second + t.limiter = rate.NewLimiter(rate.Every(interval), int(sampleOpts.SampleRate)) + } + + // Save entry in tail map + s.setActiveTail(t) + + return nil +} + +func (s *Streamdal) stopTailHandler(_ context.Context, cmd *protos.Command) error { + if err := validate.TailRequestStopCommand(cmd); err != nil { + return errors.Wrap(err, "invalid tail request stop command") + } + + aud := cmd.GetTail().Request.Audience + tailID := cmd.GetTail().Request.Id + + tails := s.getTailsForAudience(aud) + if len(tails) == 0 { + s.config.Logger.Debugf("Received stop tail command for unknown tail: %s", tailID) + return nil + } + + if activeTail, ok := tails[tailID]; ok { + // Cancel workers + activeTail.CancelFunc() + } + + pausedTails := s.getPausedTailsForAudience(aud) + if pausedTail, ok := pausedTails[tailID]; ok { + // Cancel workers + pausedTail.CancelFunc() + } + + s.removeActiveTail(aud, tailID) + s.removePausedTail(aud, tailID) + + return nil +} + +// k: audience_as_str +func (s *Streamdal) getTailsForAudience(aud *protos.Audience) map[string]*Tail { + s.tailsMtx.RLock() + tails, ok := s.tails[audToStr(aud)] + s.tailsMtx.RUnlock() + + if ok { + return tails + } + + return nil +} + +func (s *Streamdal) getPausedTailsForAudience(aud *protos.Audience) map[string]*Tail { + s.pausedTailsMtx.RLock() + tails, ok := s.pausedTails[audToStr(aud)] + s.pausedTailsMtx.RUnlock() + + if ok { + return tails + } + + return nil +} + +func (s *Streamdal) removeActiveTail(aud *protos.Audience, tailID string) { + s.tailsMtx.Lock() + defer s.tailsMtx.Unlock() + + audStr := audToStr(aud) + + if _, ok := s.tails[audStr]; !ok { + return + } + + delete(s.tails[audStr], tailID) + + if len(s.tails[audStr]) == 0 { + delete(s.tails, audStr) + } +} + +func (s *Streamdal) removePausedTail(aud *protos.Audience, tailID string) { + s.pausedTailsMtx.Lock() + defer s.pausedTailsMtx.Unlock() + + audStr := audToStr(aud) + + if _, ok := s.pausedTails[audStr]; !ok { + return + } + + delete(s.pausedTails[audStr], tailID) + + if len(s.pausedTails[audStr]) == 0 { + delete(s.pausedTails, audStr) + } +} + +func (s *Streamdal) setActiveTail(tail *Tail) { + s.tailsMtx.Lock() + defer s.tailsMtx.Unlock() + + tr := tail.Request.GetTail().Request + + audStr := audToStr(tr.Audience) + + if _, ok := s.tails[audStr]; !ok { + s.tails[audStr] = make(map[string]*Tail) + } + + s.tails[audStr][tr.Id] = tail +} + +func (s *Streamdal) setPausedTail(tail *Tail) { + s.pausedTailsMtx.Lock() + defer s.pausedTailsMtx.Unlock() + + tr := tail.Request.GetTail().Request + + audStr := audToStr(tr.Audience) + + if _, ok := s.pausedTails[audStr]; !ok { + s.pausedTails[audStr] = make(map[string]*Tail) + } + + s.pausedTails[audStr][tr.Id] = tail +} + +func (s *Streamdal) pauseTailHandler(_ context.Context, cmd *protos.Command) error { + if err := validate.TailRequestPauseCommand(cmd); err != nil { + return errors.Wrap(err, "invalid tail request pause command") + } + + aud := cmd.GetTail().Request.Audience + tailID := cmd.GetTail().Request.Id + + tails := s.getTailsForAudience(aud) + if len(tails) == 0 { + s.config.Logger.Debugf("Received pause tail command for unknown tail: %s", tailID) + return nil + } + + tail, ok := tails[tailID] + if !ok { + s.config.Logger.Debugf("Received pause tail command for unknown tail: %s", tailID) + return nil + } + + // Remove from active tails + s.removeActiveTail(aud, tailID) + + // Mode to paused tails + s.setPausedTail(tail) + + s.config.Logger.Infof("Paused tail: %s", tailID) + + return nil +} + +func (s *Streamdal) resumeTailHandler(_ context.Context, cmd *protos.Command) error { + if err := validate.TailRequestResumeCommand(cmd); err != nil { + return errors.Wrap(err, "invalid tail request resume command") + } + + aud := cmd.GetTail().Request.Audience + tailID := cmd.GetTail().Request.Id + + tails := s.getPausedTailsForAudience(aud) + if len(tails) == 0 { + s.config.Logger.Debugf("Received resume tail command for unknown tail: %s", tailID) + return nil + } + + tail, ok := tails[tailID] + if !ok { + s.config.Logger.Debugf("Received resume tail command for unknown tail: %s", tailID) + return nil + } + + // Remove from paused tails + s.removePausedTail(aud, tailID) + + // Add to active tails + s.setActiveTail(tail) + + s.config.Logger.Infof("Resumed tail: %s", tailID) + + return nil +} diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/types/types.go b/vendor/github.com/streamdal/streamdal/sdks/go/types/types.go new file mode 100644 index 000000000..f15ad57d4 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/types/types.go @@ -0,0 +1,27 @@ +package types + +import "github.com/streamdal/streamdal/libs/protos/build/go/protos" + +type CounterName string + +const ( + ConsumeBytes CounterName = "counter_consume_bytes" + ProduceBytes CounterName = "counter_produce_bytes" + ConsumeProcessedCount CounterName = "counter_consume_processed" + ProduceProcessedCount CounterName = "counter_produce_processed" + ConsumeErrorCount CounterName = "counter_consume_errors" + ProduceErrorCount CounterName = "counter_produce_errors" + ConsumeBytesRate CounterName = "counter_consume_bytes_rate" + ProduceBytesRate CounterName = "counter_produce_bytes_rate" + ConsumeProcessedRate CounterName = "counter_consume_processed_rate" + ProduceProcessedRate CounterName = "counter_produce_processed_rate" + NotifyCount CounterName = "counter_notify" + DroppedTailMessages CounterName = "counter_dropped_tail_messages" +) + +type CounterEntry struct { + Name CounterName // counter name + Audience *protos.Audience + Labels map[string]string + Value int64 +} diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/validate/validate.go b/vendor/github.com/streamdal/streamdal/sdks/go/validate/validate.go new file mode 100644 index 000000000..e762604b3 --- /dev/null +++ b/vendor/github.com/streamdal/streamdal/sdks/go/validate/validate.go @@ -0,0 +1,188 @@ +package validate + +import ( + "github.com/pkg/errors" + + "github.com/streamdal/streamdal/libs/protos/build/go/protos" + "github.com/streamdal/streamdal/libs/protos/build/go/protos/shared" +) + +var ( + ErrNilInput = errors.New("request cannot be nil") +) + +func ErrEmptyField(field string) error { + return errors.Errorf("field '%s' cannot be empty", field) +} + +func ErrNilField(field string) error { + return errors.Errorf("field '%s' cannot be nil", field) +} + +func ErrUnsetEnum(field string) error { + return errors.Errorf("enum '%s' cannot be unset", field) +} + +func Audience(aud *protos.Audience) error { + if aud == nil { + return ErrNilInput + } + + if aud.ServiceName == "" { + return ErrEmptyField("service_name") + } + + if aud.ComponentName == "" { + return ErrEmptyField("component_name") + } + + if aud.OperationName == "" { + return ErrEmptyField("operation_name") + } + + if aud.OperationType == protos.OperationType_OPERATION_TYPE_UNSET { + return ErrUnsetEnum("operation_type") + } + + return nil +} + +func SetPipelinesCommand(cmd *protos.Command) error { + if cmd == nil { + return ErrNilInput + } + + if cmd.GetSetPipelines() == nil { + return errors.New("not a SetPipelines command") + } + + return nil +} + +func KVInstruction(i *protos.KVInstruction) error { + if i == nil { + return errors.New("KVInstruction cannot be nil") + } + + if i.Action == shared.KVAction_KV_ACTION_UNSET { + return errors.New("KVAction cannot be UNSET") + } + + if i.Action != shared.KVAction_KV_ACTION_DELETE_ALL && i.Object == nil { + return errors.New("KVInstruction.Object cannot be nil") + } + + return nil +} + +func TailRequestStartCommand(cmd *protos.Command) error { + if cmd == nil { + return ErrNilInput + } + + tail := cmd.GetTail() + if tail == nil { + return ErrNilField("Tail") + } + + req := tail.GetRequest() + if req == nil { + return ErrNilField("Request") + } + + if req.Id == "" { + return ErrEmptyField("Id") + } + + if err := Audience(req.Audience); err != nil { + return errors.Wrap(err, "invalid audience") + } + + return nil +} + +func TailRequestStopCommand(cmd *protos.Command) error { + if cmd == nil { + return ErrNilInput + } + + tail := cmd.GetTail() + if tail == nil { + return ErrNilField("Tail") + } + + req := tail.GetRequest() + if req == nil { + return ErrNilField("Request") + } + + if req.Id == "" { + return ErrEmptyField("Id") + } + + if err := Audience(req.Audience); err != nil { + return errors.Wrap(err, "invalid audience") + } + + return nil +} + +func TailRequestPauseCommand(cmd *protos.Command) error { + if cmd == nil { + return ErrNilInput + } + + tail := cmd.GetTail() + if tail == nil { + return ErrNilField("Tail") + } + + req := tail.GetRequest() + if req == nil { + return ErrNilField("Request") + } + + if req.Id == "" { + return ErrEmptyField("Id") + } + + if err := Audience(req.Audience); err != nil { + return errors.Wrap(err, "invalid audience") + } + + return nil +} + +func TailRequestResumeCommand(cmd *protos.Command) error { + if cmd == nil { + return ErrNilInput + } + + tail := cmd.GetTail() + if tail == nil { + return ErrNilField("Tail") + } + + req := tail.GetRequest() + if req == nil { + return ErrNilField("Request") + } + + if req.Id == "" { + return ErrEmptyField("Id") + } + + if err := Audience(req.Audience); err != nil { + return errors.Wrap(err, "invalid audience") + } + + return nil +} + +func KVCommand(kv *protos.KVCommand) error { + if kv == nil { + return ErrNilInput + } + + return nil +} diff --git a/vendor/github.com/tetratelabs/wazero/.editorconfig b/vendor/github.com/tetratelabs/wazero/.editorconfig new file mode 100644 index 000000000..f999431de --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/.editorconfig @@ -0,0 +1,7 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/vendor/github.com/tetratelabs/wazero/.gitattributes b/vendor/github.com/tetratelabs/wazero/.gitattributes new file mode 100644 index 000000000..3a08bc389 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/.gitattributes @@ -0,0 +1,2 @@ +# Improves experience of commands like `make format` on Windows +* text=auto eol=lf diff --git a/vendor/github.com/tetratelabs/wazero/.gitignore b/vendor/github.com/tetratelabs/wazero/.gitignore new file mode 100644 index 000000000..1d635c367 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/.gitignore @@ -0,0 +1,44 @@ +# If you prefer the allow list template instead of the deny list, see community template: +# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore +# +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib +/wazero +build +dist + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ + +# Go workspace file +go.work + +# Goland +.idea + +# AssemblyScript +node_modules +package-lock.json + +# codecov.io +/coverage.txt + +.vagrant + +zig-cache/ +zig-out/ + +.DS_Store + +# Ignore compiled stdlib test cases. +/internal/integration_test/stdlibs/testdata diff --git a/vendor/github.com/tetratelabs/wazero/.gitmodules b/vendor/github.com/tetratelabs/wazero/.gitmodules new file mode 100644 index 000000000..410c91f44 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/.gitmodules @@ -0,0 +1,3 @@ +[submodule "site/themes/hello-friend"] + path = site/themes/hello-friend + url = https://github.com/panr/hugo-theme-hello-friend.git diff --git a/vendor/github.com/tetratelabs/wazero/CONTRIBUTING.md b/vendor/github.com/tetratelabs/wazero/CONTRIBUTING.md new file mode 100644 index 000000000..8ab866f0e --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/CONTRIBUTING.md @@ -0,0 +1,75 @@ +# Contributing + +We welcome contributions from the community. Please read the following guidelines carefully to maximize the chances of your PR being merged. + +## Coding Style + +- To ensure your change passes format checks, run `make check`. To format your files, you can run `make format`. +- We follow standard Go table-driven tests and use an internal [testing library](./internal/testing/require) to assert correctness. To verify all tests pass, you can run `make test`. + +## DCO + +We require DCO signoff line in every commit to this repo. + +The sign-off is a simple line at the end of the explanation for the +patch, which certifies that you wrote it or otherwise have the right to +pass it on as an open-source patch. The rules are pretty simple: if you +can certify the below (from +[developercertificate.org](https://developercertificate.org/)): + +``` +Developer Certificate of Origin +Version 1.1 +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. +660 York Street, Suite 102, +San Francisco, CA 94110 USA +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. +Developer's Certificate of Origin 1.1 +By making a contribution to this project, I certify that: +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. +``` + +then you just add a line to every git commit message: + + Signed-off-by: Joe Smith + +using your real name (sorry, no pseudonyms or anonymous contributions.) + +You can add the sign off when creating the git commit via `git commit -s`. + +## Code Reviews + +* The pull request title should describe what the change does and not embed issue numbers. +The pull request should only be blank when the change is minor. Any feature should include +a description of the change and what motivated it. If the change or design changes through +review, please keep the title and description updated accordingly. +* A single approval is sufficient to merge. If a reviewer asks for +changes in a PR they should be addressed before the PR is merged, +even if another reviewer has already approved the PR. +* During the review, address the comments and commit the changes +_without_ squashing the commits. This facilitates incremental reviews +since the reviewer does not go through all the code again to find out +what has changed since the last review. When a change goes out of sync with main, +please rebase and force push, keeping the original commits where practical. +* Commits are squashed prior to merging a pull request, using the title +as commit message by default. Maintainers may request contributors to +edit the pull request tite to ensure that it remains descriptive as a +commit message. Alternatively, maintainers may change the commit message directly. diff --git a/vendor/github.com/tetratelabs/wazero/LICENSE b/vendor/github.com/tetratelabs/wazero/LICENSE new file mode 100644 index 000000000..e21d69958 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2020-2023 wazero authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/tetratelabs/wazero/Makefile b/vendor/github.com/tetratelabs/wazero/Makefile new file mode 100644 index 000000000..7afed6abc --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/Makefile @@ -0,0 +1,356 @@ + +gofumpt := mvdan.cc/gofumpt@v0.5.0 +gosimports := github.com/rinchsan/gosimports/cmd/gosimports@v0.3.8 +golangci_lint := github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2 +asmfmt := github.com/klauspost/asmfmt/cmd/asmfmt@v1.3.2 +# sync this with netlify.toml! +hugo := github.com/gohugoio/hugo@v0.115.2 + +# Make 3.81 doesn't support '**' globbing: Set explicitly instead of recursion. +all_sources := $(wildcard *.go */*.go */*/*.go */*/*/*.go */*/*/*.go */*/*/*/*.go) +all_testdata := $(wildcard testdata/* */testdata/* */*/testdata/* */*/testdata/*/* */*/*/testdata/*) +all_testing := $(wildcard internal/testing/* internal/testing/*/* internal/testing/*/*/*) +all_examples := $(wildcard examples/* examples/*/* examples/*/*/* */*/example/* */*/example/*/* */*/example/*/*/*) +all_it := $(wildcard internal/integration_test/* internal/integration_test/*/* internal/integration_test/*/*/*) +# main_sources exclude any test or example related code +main_sources := $(wildcard $(filter-out %_test.go $(all_testdata) $(all_testing) $(all_examples) $(all_it), $(all_sources))) +# main_packages collect the unique main source directories (sort will dedupe). +# Paths need to all start with ./, so we do that manually vs foreach which strips it. +main_packages := $(sort $(foreach f,$(dir $(main_sources)),$(if $(findstring ./,$(f)),./,./$(f)))) + +go_test_options ?= -timeout 300s + +ensureCompilerFastest := -ldflags '-X github.com/tetratelabs/wazero/internal/integration_test/vs.ensureCompilerFastest=true' +.PHONY: bench +bench: + @go test -run=NONE -benchmem -bench=. ./internal/engine/compiler/... + @go build ./internal/integration_test/bench/... + @# Don't use -test.benchmem as it isn't accurate when comparing against CGO libs + @for d in vs/time vs/wasmedge vs/wasmtime ; do \ + cd ./internal/integration_test/$$d ; \ + go test -bench=. . -tags='wasmedge' $(ensureCompilerFastest) ; \ + cd - ;\ + done + +bench_testdata_dir := internal/integration_test/bench/testdata +.PHONY: build.bench +build.bench: + @tinygo build -o $(bench_testdata_dir)/case.wasm -scheduler=none --no-debug -target=wasi $(bench_testdata_dir)/case.go + +.PHONY: test.examples +test.examples: + @go test $(go_test_options) ./examples/... ./imports/assemblyscript/example/... ./imports/emscripten/... ./experimental/gojs/example/... ./imports/wasi_snapshot_preview1/example/... + +.PHONY: build.examples.as +build.examples.as: + @cd ./imports/assemblyscript/example/testdata && npm install && npm run build + +%.wasm: %.zig + @(cd $(@D); zig build -Doptimize=ReleaseSmall) + @mv $(@D)/zig-out/*/$(@F) $(@D) + +.PHONY: build.examples.zig +build.examples.zig: examples/allocation/zig/testdata/greet.wasm imports/wasi_snapshot_preview1/example/testdata/zig/cat.wasm imports/wasi_snapshot_preview1/testdata/zig/wasi.wasm + @cd internal/testing/dwarftestdata/testdata/zig; zig build; mv zig-out/*/main.wasm ./ # Need DWARF custom sections. + +tinygo_sources := examples/basic/testdata/add.go examples/allocation/tinygo/testdata/greet.go examples/cli/testdata/cli.go imports/wasi_snapshot_preview1/example/testdata/tinygo/cat.go imports/wasi_snapshot_preview1/testdata/tinygo/wasi.go +.PHONY: build.examples.tinygo +build.examples.tinygo: $(tinygo_sources) + @for f in $^; do \ + tinygo build -o $$(echo $$f | sed -e 's/\.go/\.wasm/') -scheduler=none --no-debug --target=wasi $$f; \ + done + +# We use zig to build C as it is easy to install and embeds a copy of zig-cc. +# Note: Don't use "-Oz" as that breaks our wasi sock example. +c_sources := imports/wasi_snapshot_preview1/example/testdata/zig-cc/cat.c imports/wasi_snapshot_preview1/testdata/zig-cc/wasi.c internal/testing/dwarftestdata/testdata/zig-cc/main.c +.PHONY: build.examples.zig-cc +build.examples.zig-cc: $(c_sources) + @for f in $^; do \ + zig cc --target=wasm32-wasi -o $$(echo $$f | sed -e 's/\.c/\.wasm/') $$f; \ + done + +# Here are the emcc args we use: +# +# * `-Oz` - most optimization for code size. +# * `--profiling` - adds the name section. +# * `-s STANDALONE_WASM` - ensures wasm is built for a non-js runtime. +# * `-s EXPORTED_FUNCTIONS=_malloc,_free` - export allocation functions so that +# they can be used externally as "malloc" and "free". +# * `-s WARN_ON_UNDEFINED_SYMBOLS=0` - imports not defined in JavaScript error +# otherwise. See https://github.com/emscripten-core/emscripten/issues/13641 +# * `-s TOTAL_STACK=8KB -s TOTAL_MEMORY=64KB` - reduce memory default from 16MB +# to one page (64KB). To do this, we have to reduce the stack size. +# * `-s ALLOW_MEMORY_GROWTH` - allows "memory.grow" instructions to succeed, but +# requires a function import "emscripten_notify_memory_growth". +emscripten_sources := $(wildcard imports/emscripten/testdata/*.cc) +.PHONY: build.examples.emscripten +build.examples.emscripten: $(emscripten_sources) + @for f in $^; do \ + em++ -Oz --profiling \ + -s STANDALONE_WASM \ + -s EXPORTED_FUNCTIONS=_malloc,_free \ + -s WARN_ON_UNDEFINED_SYMBOLS=0 \ + -s TOTAL_STACK=8KB -s TOTAL_MEMORY=64KB \ + -s ALLOW_MEMORY_GROWTH \ + --std=c++17 -o $$(echo $$f | sed -e 's/\.cc/\.wasm/') $$f; \ + done + +%/greet.wasm : cargo_target := wasm32-unknown-unknown +%/cat.wasm : cargo_target := wasm32-wasi +%/wasi.wasm : cargo_target := wasm32-wasi + +.PHONY: build.examples.rust +build.examples.rust: examples/allocation/rust/testdata/greet.wasm imports/wasi_snapshot_preview1/example/testdata/cargo-wasi/cat.wasm imports/wasi_snapshot_preview1/testdata/cargo-wasi/wasi.wasm internal/testing/dwarftestdata/testdata/rust/main.wasm.xz + +# Normally, we build release because it is smaller. Testing dwarf requires the debug build. +internal/testing/dwarftestdata/testdata/rust/main.wasm.xz: + cd $(@D) && cargo wasi build + mv $(@D)/target/wasm32-wasi/debug/main.wasm $(@D) + cd $(@D) && xz -k -f ./main.wasm # Rust's DWARF section is huge, so compress it. + +# Builds rust using cargo normally, or cargo-wasi. +%.wasm: %.rs + @(cd $(@D); cargo $(if $(findstring wasi,$(cargo_target)),wasi build,build --target $(cargo_target)) --release) + @mv $(@D)/target/$(cargo_target)/release/$(@F) $(@D) + +spectest_base_dir := internal/integration_test/spectest +spectest_v1_dir := $(spectest_base_dir)/v1 +spectest_v1_testdata_dir := $(spectest_v1_dir)/testdata +spec_version_v1 := wg-1.0 +spectest_v2_dir := $(spectest_base_dir)/v2 +spectest_v2_testdata_dir := $(spectest_v2_dir)/testdata +# Latest draft state as of May 23, 2023. +spec_version_v2 := 2e8912e88a3118a46b90e8ccb659e24b4e8f3c23 + +.PHONY: build.spectest +build.spectest: + @$(MAKE) build.spectest.v1 + @$(MAKE) build.spectest.v2 + +.PHONY: build.spectest.v1 +build.spectest.v1: # Note: wabt by default uses >1.0 features, so wast2json flags might drift as they include more. See WebAssembly/wabt#1878 + @rm -rf $(spectest_v1_testdata_dir) + @mkdir -p $(spectest_v1_testdata_dir) + @cd $(spectest_v1_testdata_dir) \ + && curl -sSL 'https://api.github.com/repos/WebAssembly/spec/contents/test/core?ref=$(spec_version_v1)' | jq -r '.[]| .download_url' | grep -E ".wast" | xargs -Iurl curl -sJL url -O + @cd $(spectest_v1_testdata_dir) && for f in `find . -name '*.wast'`; do \ + perl -pi -e 's/\(assert_return_canonical_nan\s(\(invoke\s"f32.demote_f64"\s\((f[0-9]{2})\.const\s[a-z0-9.+:-]+\)\))\)/\(assert_return $$1 \(f32.const nan:canonical\)\)/g' $$f; \ + perl -pi -e 's/\(assert_return_arithmetic_nan\s(\(invoke\s"f32.demote_f64"\s\((f[0-9]{2})\.const\s[a-z0-9.+:-]+\)\))\)/\(assert_return $$1 \(f32.const nan:arithmetic\)\)/g' $$f; \ + perl -pi -e 's/\(assert_return_canonical_nan\s(\(invoke\s"f64\.promote_f32"\s\((f[0-9]{2})\.const\s[a-z0-9.+:-]+\)\))\)/\(assert_return $$1 \(f64.const nan:canonical\)\)/g' $$f; \ + perl -pi -e 's/\(assert_return_arithmetic_nan\s(\(invoke\s"f64\.promote_f32"\s\((f[0-9]{2})\.const\s[a-z0-9.+:-]+\)\))\)/\(assert_return $$1 \(f64.const nan:arithmetic\)\)/g' $$f; \ + perl -pi -e 's/\(assert_return_canonical_nan\s(\(invoke\s"[a-z._0-9]+"\s\((f[0-9]{2})\.const\s[a-z0-9.+:-]+\)\))\)/\(assert_return $$1 \($$2.const nan:canonical\)\)/g' $$f; \ + perl -pi -e 's/\(assert_return_arithmetic_nan\s(\(invoke\s"[a-z._0-9]+"\s\((f[0-9]{2})\.const\s[a-z0-9.+:-]+\)\))\)/\(assert_return $$1 \($$2.const nan:arithmetic\)\)/g' $$f; \ + perl -pi -e 's/\(assert_return_canonical_nan\s(\(invoke\s"[a-z._0-9]+"\s\((f[0-9]{2})\.const\s[a-z0-9.+:-]+\)\s\([a-z0-9.\s+-:]+\)\))\)/\(assert_return $$1 \($$2.const nan:canonical\)\)/g' $$f; \ + perl -pi -e 's/\(assert_return_arithmetic_nan\s(\(invoke\s"[a-z._0-9]+"\s\((f[0-9]{2})\.const\s[a-z0-9.+:-]+\)\s\([a-z0-9.\s+-:]+\)\))\)/\(assert_return $$1 \($$2.const nan:arithmetic\)\)/g' $$f; \ + perl -pi -e 's/\(assert_return_canonical_nan\s(\(invoke\s"[a-z._0-9]+"\s\((f[0-9]{2})\.const\s[a-z0-9.+:-]+\)\))\)/\(assert_return $$1 \($$2.const nan:canonical\)\)/g' $$f; \ + perl -pi -e 's/\(assert_return_arithmetic_nan\s(\(invoke\s"[a-z._0-9]+"\s\((f[0-9]{2})\.const\s[a-z0-9.+:-]+\)\))\)/\(assert_return $$1 \($$2.const nan:arithmetic\)\)/g' $$f; \ + wast2json \ + --disable-saturating-float-to-int \ + --disable-sign-extension \ + --disable-simd \ + --disable-multi-value \ + --disable-bulk-memory \ + --disable-reference-types \ + --debug-names $$f; \ + done + +.PHONY: build.spectest.v2 +build.spectest.v2: # Note: SIMD cases are placed in the "simd" subdirectory. + @mkdir -p $(spectest_v2_testdata_dir) + @cd $(spectest_v2_testdata_dir) \ + && curl -sSL 'https://api.github.com/repos/WebAssembly/spec/contents/test/core?ref=$(spec_version_v2)' | jq -r '.[]| .download_url' | grep -E ".wast" | xargs -Iurl curl -sJL url -O + @cd $(spectest_v2_testdata_dir) \ + && curl -sSL 'https://api.github.com/repos/WebAssembly/spec/contents/test/core/simd?ref=$(spec_version_v2)' | jq -r '.[]| .download_url' | grep -E ".wast" | xargs -Iurl curl -sJL url -O + @cd $(spectest_v2_testdata_dir) && for f in `find . -name '*.wast'`; do \ + wast2json --debug-names --no-check $$f; \ + done + +.PHONY: test +test: + @go test $(go_test_options) $$(go list ./... | grep -vE '$(spectest_v1_dir)|$(spectest_v2_dir)') + @cd internal/version/testdata && go test $(go_test_options) ./... + +.PHONY: coverage +# replace spaces with commas +coverpkg = $(shell echo $(main_packages) | tr ' ' ',') +coverage: ## Generate test coverage + @go test -coverprofile=coverage.txt -covermode=atomic --coverpkg=$(coverpkg) $(main_packages) + @go tool cover -func coverage.txt + +.PHONY: spectest +spectest: + @$(MAKE) spectest.v1 + @$(MAKE) spectest.v2 + +spectest.v1: + @go test $(go_test_options) $$(go list ./... | grep $(spectest_v1_dir)) + +spectest.v2: + @go test $(go_test_options) $$(go list ./... | grep $(spectest_v2_dir)) + +golangci_lint_path := $(shell go env GOPATH)/bin/golangci-lint + +$(golangci_lint_path): + @go install $(golangci_lint) + +golangci_lint_goarch ?= $(shell go env GOARCH) + +.PHONY: lint +lint: $(golangci_lint_path) + @GOARCH=$(golangci_lint_goarch) CGO_ENABLED=0 $(golangci_lint_path) run --timeout 5m + +.PHONY: format +format: + @go run $(gofumpt) -l -w . + @go run $(gosimports) -local github.com/tetratelabs/ -w $(shell find . -name '*.go' -type f) + @go run $(asmfmt) -w $(shell find . -name '*.s' -type f) + +.PHONY: check # Pre-flight check for pull requests +check: +# The following checks help ensure our platform-specific code used for system +# calls safely falls back on a platform unsupported by the compiler engine. +# This makes sure the intepreter can be used. Most often the package that can +# drift here is "platform" or "sysfs": +# +# Ensure we build on plan9. See #1578 + @GOARCH=amd64 GOOS=plan9 go build ./... +# Ensure we build on gojs. See #1526. + @GOARCH=wasm GOOS=js go build ./... +# Ensure we build on gojs. See #1526. + @GOARCH=wasm GOOS=wasip1 go build ./... +# Ensure we build on aix. See #1723 + @GOARCH=ppc64 GOOS=aix go build ./... +# Ensure we build on windows: + @GOARCH=amd64 GOOS=windows go build ./... +# Ensure we build on an arbitrary operating system: + @GOARCH=amd64 GOOS=dragonfly go build ./... +# Ensure we build on solaris/illumos: + @GOARCH=amd64 GOOS=illumos go build ./... + @GOARCH=amd64 GOOS=solaris go build ./... +# Ensure we build on linux arm for Dapr: +# gh release view -R dapr/dapr --json assets --jq 'first(.assets[] | select(.name = "daprd_linux_arm.tar.gz") | {url, downloadCount})' + @GOARCH=arm GOOS=linux go build ./... +# Ensure we build on linux 386 for Trivy: +# gh release view -R aquasecurity/trivy --json assets --jq 'first(.assets[] | select(.name| test("Linux-32bit.*tar.gz")) | {url, downloadCount})' + @GOARCH=386 GOOS=linux go build ./... +# Ensure we build on FreeBSD amd64 for Trivy: +# gh release view -R aquasecurity/trivy --json assets --jq 'first(.assets[] | select(.name| test("FreeBSD-64bit.*tar.gz")) | {url, downloadCount})' + @GOARCH=amd64 GOOS=freebsd go build ./... + @$(MAKE) lint golangci_lint_goarch=arm64 + @$(MAKE) lint golangci_lint_goarch=amd64 + @$(MAKE) format + @go mod tidy + @if [ ! -z "`git status -s`" ]; then \ + echo "The following differences will fail CI until committed:"; \ + git diff --exit-code; \ + fi + +.PHONY: site +site: ## Serve website content + @git submodule update --init + @cd site && go run $(hugo) server --minify --disableFastRender --baseURL localhost:1313 --cleanDestinationDir -D + +.PHONY: clean +clean: ## Ensure a clean build + @rm -rf dist build coverage.txt + @go clean -testcache + +fuzz_timeout_seconds ?= 10 +.PHONY: fuzz +fuzz: + @cd internal/integration_test/fuzz && cargo test + @cd internal/integration_test/fuzz && cargo fuzz run no_diff --sanitizer=none -- -rss_limit_mb=8192 -max_total_time=$(fuzz_timeout_seconds) + @cd internal/integration_test/fuzz && cargo fuzz run memory_no_diff --sanitizer=none -- -rss_limit_mb=8192 -max_total_time=$(fuzz_timeout_seconds) + @cd internal/integration_test/fuzz && cargo fuzz run validation --sanitizer=none -- -rss_limit_mb=8192 -max_total_time=$(fuzz_timeout_seconds) + +#### CLI release related #### + +VERSION ?= dev +# Default to a dummy version 0.0.1.1, which is always lower than a real release. +# Legal version values should look like 'x.x.x.x' where x is an integer from 0 to 65534. +# https://learn.microsoft.com/en-us/windows/win32/msi/productversion?redirectedfrom=MSDN +# https://stackoverflow.com/questions/9312221/msi-version-numbers +MSI_VERSION ?= 0.0.1.1 +non_windows_platforms := darwin_amd64 darwin_arm64 linux_amd64 linux_arm64 +non_windows_archives := $(non_windows_platforms:%=dist/wazero_$(VERSION)_%.tar.gz) +windows_platforms := windows_amd64 # TODO: add arm64 windows once we start testing on it. +windows_archives := $(windows_platforms:%=dist/wazero_$(VERSION)_%.zip) $(windows_platforms:%=dist/wazero_$(VERSION)_%.msi) +checksum_txt := dist/wazero_$(VERSION)_checksums.txt + +# define macros for multi-platform builds. these parse the filename being built +go-arch = $(if $(findstring amd64,$1),amd64,arm64) +go-os = $(if $(findstring .exe,$1),windows,$(if $(findstring linux,$1),linux,darwin)) +# msi-arch is a macro so we can detect it based on the file naming convention +msi-arch = $(if $(findstring amd64,$1),x64,arm64) + +build/wazero_%/wazero: + $(call go-build,$@,$<) + +build/wazero_%/wazero.exe: + $(call go-build,$@,$<) + +dist/wazero_$(VERSION)_%.tar.gz: build/wazero_%/wazero + @echo tar.gz "tarring $@" + @mkdir -p $(@D) +# On Windows, we pass the special flag `--mode='+rx' to ensure that we set the executable flag. +# This is only supported by GNU Tar, so we set it conditionally. + @tar -C $(> $(@F) + +dist: $(non_windows_archives) $(if $(findstring Windows_NT,$(OS)),$(windows_archives),) $(checksum_txt) diff --git a/vendor/github.com/tetratelabs/wazero/NOTICE b/vendor/github.com/tetratelabs/wazero/NOTICE new file mode 100644 index 000000000..2f5ea8ebf --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/NOTICE @@ -0,0 +1,2 @@ +wazero +Copyright 2020-2023 wazero authors diff --git a/vendor/github.com/tetratelabs/wazero/RATIONALE.md b/vendor/github.com/tetratelabs/wazero/RATIONALE.md new file mode 100644 index 000000000..94f5de251 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/RATIONALE.md @@ -0,0 +1,1582 @@ +# Notable rationale of wazero + +## Zero dependencies + +Wazero has zero dependencies to differentiate itself from other runtimes which +have heavy impact usually due to CGO. By avoiding CGO, wazero avoids +prerequisites such as shared libraries or libc, and lets users keep features +like cross compilation. + +Avoiding go.mod dependencies reduces interference on Go version support, and +size of a statically compiled binary. However, doing so brings some +responsibility into the project. + +Go's native platform support is good: We don't need platform-specific code to +get monotonic time, nor do we need much work to implement certain features +needed by our compiler such as `mmap`. That said, Go does not support all +common operating systems to the same degree. For example, Go 1.18 includes +`Mprotect` on Linux and Darwin, but not FreeBSD. + +The general tradeoff the project takes from a zero dependency policy is more +explicit support of platforms (in the compiler runtime), as well a larger and +more technically difficult codebase. + +At some point, we may allow extensions to supply their own platform-specific +hooks. Until then, one end user impact/tradeoff is some glitches trying +untested platforms (with the Compiler runtime). + +### Why do we use CGO to implement system calls on darwin? + +wazero is dependency and CGO free by design. In some cases, we have code that +can optionally use CGO, but retain a fallback for when that's disabled. The only +operating system (`GOOS`) we use CGO by default in is `darwin`. + +Unlike other operating systems, regardless of `CGO_ENABLED`, Go always uses +"CGO" mechanisms in the runtime layer of `darwin`. This is explained in +[Statically linked binaries on Mac OS X](https://developer.apple.com/library/archive/qa/qa1118/_index.html#//apple_ref/doc/uid/DTS10001666): + +> Apple does not support statically linked binaries on Mac OS X. A statically +> linked binary assumes binary compatibility at the kernel system call +> interface, and we do not make any guarantees on that front. Rather, we strive +> to ensure binary compatibility in each dynamically linked system library and +> framework. + +This plays to our advantage for system calls that aren't yet exposed in the Go +standard library, notably `futimens` for nanosecond-precision timestamp +manipulation. + +### Why not x/sys + +Going beyond Go's SDK limitations can be accomplished with their [x/sys library](https://pkg.go.dev/golang.org/x/sys/unix). +For example, this includes `zsyscall_freebsd_amd64.go` missing from the Go SDK. + +However, like all dependencies, x/sys is a source of conflict. For example, +x/sys had to be in order to upgrade to Go 1.18. + +If we depended on x/sys, we could get more precise functionality needed for +features such as clocks or more platform support for the compiler runtime. + +That said, formally supporting an operating system may still require testing as +even use of x/sys can require platform-specifics. For example, [mmap-go](https://github.com/edsrzf/mmap-go) +uses x/sys, but also mentions limitations, some not surmountable with x/sys +alone. + +Regardless, we may at some point introduce a separate go.mod for users to use +x/sys as a platform plugin without forcing all users to maintain that +dependency. + +## Project structure + +wazero uses internal packages extensively to balance API compatability desires for end users with the need to safely +share internals between compilers. + +End-user packages include `wazero`, with `Config` structs, `api`, with shared types, and the built-in `wasi` library. +Everything else is internal. + +We put the main program for wazero into a directory of the same name to match conventions used in `go install`, +notably the name of the folder becomes the binary name. We chose to use `cmd/wazero` as it is common practice +and less surprising than `wazero/wazero`. + +### Internal packages + +Most code in wazero is internal, and it is acknowledged that this prevents external implementation of facets such as +compilers or decoding. It also prevents splitting this code into separate repositories, resulting in a larger monorepo. +This also adds work as more code needs to be centrally reviewed. + +However, the alternative is neither secure nor viable. To allow external implementation would require exporting symbols +public, such as the `CodeSection`, which can easily create bugs. Moreover, there's a high drift risk for any attempt at +external implementations, compounded not just by wazero's code organization, but also the fast moving Wasm and WASI +specifications. + +For example, implementing a compiler correctly requires expertise in Wasm, Golang and assembly. This requires deep +insight into how internals are meant to be structured and the various tiers of testing required for `wazero` to result +in a high quality experience. Even if someone had these skills, supporting external code would introduce variables which +are constants in the central one. Supporting an external codebase is harder on the project team, and could starve time +from the already large burden on the central codebase. + +The tradeoffs of internal packages are a larger codebase and responsibility to implement all standard features. It also +implies thinking about extension more as forking is not viable for reasons above also. The primary mitigation of these +realities are friendly OSS licensing, high rigor and a collaborative spirit which aim to make contribution in the shared +codebase productive. + +### Avoiding cyclic dependencies + +wazero shares constants and interfaces with internal code by a sharing pattern described below: +* shared interfaces and constants go in one package under root: `api`. +* user APIs and structs depend on `api` and go into the root package `wazero`. + * e.g. `InstantiateModule` -> `/wasm.go` depends on the type `api.Module`. +* implementation code can also depend on `api` in a corresponding package under `/internal`. + * Ex package `wasm` -> `/internal/wasm/*.go` and can depend on the type `api.Module`. + +The above guarantees no cyclic dependencies at the cost of having to re-define symbols that exist in both packages. +For example, if `wasm.Store` is a type the user needs access to, it is narrowed by a cover type in the `wazero`: + +```go +type runtime struct { + s *wasm.Store +} +``` + +This is not as bad as it sounds as mutations are only available via configuration. This means exported functions are +limited to only a few functions. + +### Avoiding security bugs + +In order to avoid security flaws such as code insertion, nothing in the public API is permitted to write directly to any +mutable symbol in the internal package. For example, the package `api` is shared with internal code. To ensure +immutability, the `api` package cannot contain any mutable public symbol, such as a slice or a struct with an exported +field. + +In practice, this means shared functionality like memory mutation need to be implemented by interfaces. + +Here are some examples: +* `api.Memory` protects access by exposing functions like `WriteFloat64Le` instead of exporting a buffer (`[]byte`). +* There is no exported symbol for the `[]byte` representing the `CodeSection` + +Besides security, this practice prevents other bugs and allows centralization of validation logic such as decoding Wasm. + +## API Design + +### Why is `context.Context` inconsistent? + +It may seem strange that only certain API have an initial `context.Context` +parameter. We originally had a `context.Context` for anything that might be +traced, but it turned out to be only useful for lifecycle and host functions. + +For instruction-scoped aspects like memory updates, a context parameter is too +fine-grained and also invisible in practice. For example, most users will use +the compiler engine, and its memory, global or table access will never use go's +context. + +### Why does `api.ValueType` map to uint64? + +WebAssembly allows functions to be defined either by the guest or the host, +with signatures expressed as WebAssembly types. For example, `i32` is a 32-bit +type which might be interpreted as signed. Function signatures can have zero or +more parameters or results even if WebAssembly 1.0 allows up to one result. + +The guest can export functions, so that the host can call it. In the case of +wazero, the host is Go and an exported function can be called via +`api.Function`. `api.Function` allows users to supply parameters and read +results as a slice of uint64. For example, if there are no results, an empty +slice is returned. The user can learn the signature via `FunctionDescription`, +which returns the `api.ValueType` corresponding to each parameter or result. +`api.ValueType` defines the mapping of WebAssembly types to `uint64` values for +reason described in this section. The special case of `v128` is also mentioned +below. + +wazero maps each value type to a uint64 values because it holds the largest +type in WebAssembly 1.0 (i64). A slice allows you to express empty (e.g. a +nullary signature), for example a start function. + +Here's an example of calling a function, noting this syntax works for both a +signature `(param i32 i32) (result i32)` and `(param i64 i64) (result i64)` +```go +x, y := uint64(1), uint64(2) +results, err := mod.ExportedFunction("add").Call(ctx, x, y) +if err != nil { + log.Panicln(err) +} +fmt.Printf("%d + %d = %d\n", x, y, results[0]) +``` + +WebAssembly does not define an encoding strategy for host defined parameters or +results. This means the encoding rules above are defined by wazero instead. To +address this, we clarified mapping both in `api.ValueType` and added helper +functions like `api.EncodeF64`. This allows users conversions typical in Go +programming, and utilities to avoid ambiguity and edge cases around casting. + +Alternatively, we could have defined a byte buffer based approach and a binary +encoding of value types in and out. For example, an empty byte slice would mean +no values, while a non-empty could use a binary encoding for supported values. +This could work, but it is more difficult for the normal case of i32 and i64. +It also shares a struggle with the current approach, which is that value types +were added after WebAssembly 1.0 and not all of them have an encoding. More on +this below. + +In summary, wazero chose an approach for signature mapping because there was +none, and the one we chose biases towards simplicity with integers and handles +the rest with documentation and utilities. + +#### Post 1.0 value types + +Value types added after WebAssembly 1.0 stressed the current model, as some +have no encoding or are larger than 64 bits. While problematic, these value +types are not commonly used in exported (extern) functions. However, some +decisions were made and detailed below. + +For example `externref` has no guest representation. wazero chose to map +references to uint64 as that's the largest value needed to encode a pointer on +supported platforms. While there are two reference types, `externref` and +`functype`, the latter is an internal detail of function tables, and the former +is rarely if ever used in function signatures as of the end of 2022. + +The only value larger than 64 bits is used for SIMD (`v128`). Vectorizing via +host functions is not used as of the end of 2022. Even if it were, it would be +inefficient vs guest vectorization due to host function overhead. In other +words, the `v128` value type is unlikely to be in an exported function +signature. That it requires two uint64 values to encode is an internal detail +and not worth changing the exported function interface `api.Function`, as doing +so would break all users. + +### Interfaces, not structs + +All exported types in public packages, regardless of configuration vs runtime, are interfaces. The primary benefits are +internal flexibility and avoiding people accidentally mis-initializing by instantiating the types on their own vs using +the `NewXxx` constructor functions. In other words, there's less support load when things can't be done incorrectly. + +Here's an example: +```go +rt := &RuntimeConfig{} // not initialized properly (fields are nil which shouldn't be) +rt := RuntimeConfig{} // not initialized properly (should be a pointer) +rt := wazero.NewRuntimeConfig() // initialized properly +``` + +There are a few drawbacks to this, notably some work for maintainers. +* Interfaces are decoupled from the structs implementing them, which means the signature has to be repeated twice. +* Interfaces have to be documented and guarded at time of use, that 3rd party implementations aren't supported. +* As of Golang 1.21, interfaces are still [not well supported](https://github.com/golang/go/issues/5860) in godoc. + +## Config + +wazero configures scopes such as Runtime and Module using `XxxConfig` types. For example, `RuntimeConfig` configures +`Runtime` and `ModuleConfig` configure `Module` (instantiation). In all cases, config types begin defaults and can be +customized by a user, e.g., selecting features or a module name override. + +### Why don't we make each configuration setting return an error? +No config types create resources that would need to be closed, nor do they return errors on use. This helps reduce +resource leaks, and makes chaining easier. It makes it possible to parse configuration (ex by parsing yaml) independent +of validating it. + +Instead of: +``` +cfg, err = cfg.WithFS(fs) +if err != nil { + return err +} +cfg, err = cfg.WithName(name) +if err != nil { + return err +} +mod, err = rt.InstantiateModuleWithConfig(ctx, code, cfg) +if err != nil { + return err +} +``` + +There's only one call site to handle errors: +``` +cfg = cfg.WithFS(fs).WithName(name) +mod, err = rt.InstantiateModuleWithConfig(ctx, code, cfg) +if err != nil { + return err +} +``` + +This allows users one place to look for errors, and also the benefit that if anything internally opens a resource, but +errs, there's nothing they need to close. In other words, users don't need to track which resources need closing on +partial error, as that is handled internally by the only code that can read configuration fields. + +### Why are configuration immutable? +While it seems certain scopes like `Runtime` won't repeat within a process, they do, possibly in different goroutines. +For example, some users create a new runtime for each module, and some re-use the same base module configuration with +only small updates (ex the name) for each instantiation. Making configuration immutable allows them to be safely used in +any goroutine. + +Since config are immutable, changes apply via return val, similar to `append` in a slice. + +For example, both of these are the same sort of error: +```go +append(slice, element) // bug as only the return value has the updated slice. +cfg.WithName(next) // bug as only the return value has the updated name. +``` + +Here's an example of correct use: re-assigning explicitly or via chaining. +```go +cfg = cfg.WithName(name) // explicit + +mod, err = rt.InstantiateModuleWithConfig(ctx, code, cfg.WithName(name)) // implicit +if err != nil { + return err +} +``` + +### Why aren't configuration assigned with option types? +The option pattern is a familiar one in Go. For example, someone defines a type `func (x X) err` and uses it to update +the target. For example, you could imagine wazero could choose to make `ModuleConfig` from options vs chaining fields. + +Ex instead of: +```go +type ModuleConfig interface { + WithName(string) ModuleConfig + WithFS(fs.FS) ModuleConfig +} + +struct moduleConfig { + name string + fs fs.FS +} + +func (c *moduleConfig) WithName(name string) ModuleConfig { + ret := *c // copy + ret.name = name + return &ret +} + +func (c *moduleConfig) WithFS(fs fs.FS) ModuleConfig { + ret := *c // copy + ret.setFS("/", fs) + return &ret +} + +config := r.NewModuleConfig().WithFS(fs) +configDerived := config.WithName("name") +``` + +An option function could be defined, then refactor each config method into an name prefixed option function: +```go +type ModuleConfig interface { +} +struct moduleConfig { + name string + fs fs.FS +} + +type ModuleConfigOption func(c *moduleConfig) + +func ModuleConfigName(name string) ModuleConfigOption { + return func(c *moduleConfig) { + c.name = name + } +} + +func ModuleConfigFS(fs fs.FS) ModuleConfigOption { + return func(c *moduleConfig) { + c.fs = fs + } +} + +func (r *runtime) NewModuleConfig(opts ...ModuleConfigOption) ModuleConfig { + ret := newModuleConfig() // defaults + for _, opt := range opts { + opt(&ret.config) + } + return ret +} + +func (c *moduleConfig) WithOptions(opts ...ModuleConfigOption) ModuleConfig { + ret := *c // copy base config + for _, opt := range opts { + opt(&ret.config) + } + return ret +} + +config := r.NewModuleConfig(ModuleConfigFS(fs)) +configDerived := config.WithOptions(ModuleConfigName("name")) +``` + +wazero took the path of the former design primarily due to: +* interfaces provide natural namespaces for their methods, which is more direct than functions with name prefixes. +* parsing config into function callbacks is more direct vs parsing config into a slice of functions to do the same. +* in either case derived config is needed and the options pattern is more awkward to achieve that. + +There are other reasons such as test and debug being simpler without options: the above list is constrained to conserve +space. It is accepted that the options pattern is common in Go, which is the main reason for documenting this decision. + +### Why aren't config types deeply structured? +wazero's configuration types cover the two main scopes of WebAssembly use: +* `RuntimeConfig`: This is the broadest scope, so applies also to compilation + and instantiation. e.g. This controls the WebAssembly Specification Version. +* `ModuleConfig`: This affects modules instantiated after compilation and what + resources are allowed. e.g. This defines how or if STDOUT is captured. This + also allows sub-configuration of `FSConfig`. + +These default to a flat definition each, with lazy sub-configuration only after +proven to be necessary. A flat structure is easier to work with and is also +easy to discover. Unlike the option pattern described earlier, more +configuration in the interface doesn't taint the package namespace, only +`ModuleConfig`. + +We default to a flat structure to encourage simplicity. If we eagerly broke out +all possible configurations into sub-types (e.g. ClockConfig), it would be hard +to notice configuration sprawl. By keeping the config flat, it is easy to see +the cognitive load we may be adding to our users. + +In other words, discomfort adding more configuration is a feature, not a bug. +We should only add new configuration rarely, and before doing so, ensure it +will be used. In fact, this is why we support using context fields for +experimental configuration. By letting users practice, we can find out if a +configuration was a good idea or not before committing to it, and potentially +sprawling our types. + +In reflection, this approach worked well for the nearly 1.5 year period leading +to version 1.0. We've only had to create a single sub-configuration, `FSConfig`, +and it was well understood why when it occurred. + +## Why does `ModuleConfig.WithStartFunctions` default to `_start`? + +We formerly had functions like `StartWASICommand` that would verify +preconditions and start WASI's `_start` command. However, this caused confusion +because both many languages compiled a WASI dependency, and many did so +inconsistently. + +The conflict is that exported functions need to use features the language +runtime provides, such as garbage collection. There's a "chicken-egg problem" +where `_start` needs to complete in order for exported behavior to work. + +For example, unlike `GOOS=wasip1` in Go 1.21, TinyGo's "wasi" target supports +function exports. So, the only way to use FFI style is via the "wasi" target. +Not explicitly calling `_start` before an ABI such as wapc-go, would crash, due +to setup not happening (e.g. to implement `panic`). Other embedders such as +Envoy also called `_start` for the same reason. To avoid a common problem for +users unaware of WASI, and also to simplify normal use of WASI (e.g. `main`), +we added `_start` to `ModuleConfig.WithStartFunctions`. + +In cases of multiple initializers, such as in wapc-go, users can override this +to add the others *after* `_start`. Users who want to explicitly control +`_start`, such as some of our unit tests, can clear the start functions and +remove it. + +This decision was made in 2022, and holds true in 2023, even with the +introduction of "wasix". It holds because "wasix" is backwards compatible with +"wasip1". In the future, there will be other ways to start applications, and +may not be backwards compatible with "wasip1". + +Most notably WASI "Preview 2" is not implemented in a way compatible with +wasip1. Its start function is likely to be different, and defined in the +wasi-cli "world". When the design settles, and it is implemented by compilers, +wazero will attempt to support "wasip2". However, it won't do so in a way that +breaks existing compilers. + +In other words, we won't remove `_start` if "wasip2" continues a path of an +alternate function name. If we did, we'd break existing users despite our +compatibility promise saying we don't. The most likely case is that when we +build-in something incompatible with "wasip1", that start function will be +added to the start functions list in addition to `_start`. + +See http://wasix.org +See https://github.com/WebAssembly/wasi-cli + +## Runtime == Engine+Store +wazero defines a single user-type which combines the specification concept of `Store` with the unspecified `Engine` +which manages them. + +### Why not multi-store? +Multi-store isn't supported as the extra tier complicates lifecycle and locking. Moreover, in practice it is unusual for +there to be an engine that has multiple stores which have multiple modules. More often, it is the case that there is +either 1 engine with 1 store and multiple modules, or 1 engine with many stores, each having 1 non-host module. In worst +case, a user can use multiple runtimes until "multi-store" is better understood. + +If later, we have demand for multiple stores, that can be accomplished by overload. e.g. `Runtime.InstantiateInStore` or +`Runtime.Store(name) Store`. + +## wazeroir +wazero's intermediate representation (IR) is called `wazeroir`. Lowering into an IR provides us a faster interpreter +and a closer to assembly representation for used by our compiler. + +### Intermediate Representation (IR) design +`wazeroir`'s initial design borrowed heavily from the defunct `microwasm` format (a.k.a. LightbeamIR). Notably, +`wazeroir` doesn't have block operations: this simplifies the implementation. + +Note: `microwasm` was never specified formally, and only exists in a historical codebase of wasmtime: +https://github.com/bytecodealliance/wasmtime/blob/v0.29.0/crates/lightbeam/src/microwasm.rs + +## Exit + +### Why do we only return a `sys.ExitError` on a non-zero exit code? + +It is reasonable to think an exit error should be returned, even if the code is +success (zero). Even on success, the module is no longer functional. For +example, function exports would error later. However, wazero does not. The only +time `sys.ExitError` is on error (non-zero). + +This decision was to improve performance and ergonomics for guests that both +use WASI (have a `_start` function), and also allow custom exports. +Specifically, Rust, TinyGo and normal wasi-libc, don't exit the module during +`_start`. If they did, it would invalidate their function exports. This means +it is unlikely most compilers will change this behavior. + +`GOOS=waspi1` from Go 1.21 does exit during `_start`. However, it doesn't +support other exports besides `_start`, and `_start` is not defined to be +called multiple times anyway. + +Since `sys.ExitError` is not always returned, we added `Module.IsClosed` for +defensive checks. This helps integrators avoid calling functions which will +always fail. + +### Why panic with `sys.ExitError` after a host function exits? + +Currently, the only portable way to stop processing code is via panic. For +example, WebAssembly "trap" instructions, such as divide by zero, are +implemented via panic. This ensures code isn't executed after it. + +When code reaches the WASI `proc_exit` instruction, we need to stop processing. +Regardless of the exit code, any code invoked after exit would be in an +inconsistent state. This is likely why unreachable instructions are sometimes +inserted after exit: https://github.com/emscripten-core/emscripten/issues/12322 + +## WASI + +Unfortunately, (WASI Snapshot Preview 1)[https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md] is not formally defined enough, and has APIs with ambiguous semantics. +This section describes how Wazero interprets and implements the semantics of several WASI APIs that may be interpreted differently by different wasm runtimes. +Those APIs may affect the portability of a WASI application. + +### Why don't we attempt to pass wasi-testsuite on user-defined `fs.FS`? + +While most cases work fine on an `os.File` based implementation, we won't +promise wasi-testsuite compatibility on user defined wrappers of `os.DirFS`. +The only option for real systems is to use our `sysfs.FS`. + +There are a lot of areas where windows behaves differently, despite the +`os.File` abstraction. This goes well beyond file locking concerns (e.g. +`EBUSY` errors on open files). For example, errors like `ACCESS_DENIED` aren't +properly mapped to `EPERM`. There are trickier parts too. `FileInfo.Sys()` +doesn't return enough information to build inodes needed for WASI. To rebuild +them requires the full path to the underlying file, not just its directory +name, and there's no way for us to get that information. At one point we tried, +but in practice things became tangled and functionality such as read-only +wrappers became untenable. Finally, there are version-specific behaviors which +are difficult to maintain even in our own code. For example, go 1.20 opens +files in a different way than versions before it. + +### Why aren't WASI rules enforced? + +The [snapshot-01](https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md) version of WASI has a +number of rules for a "command module", but only the memory export rule is enforced. If a "_start" function exists, it +is enforced to be the correct signature and succeed, but the export itself isn't enforced. It follows that this means +exports are not required to be contained to a "_start" function invocation. Finally, the "__indirect_function_table" +export is also not enforced. + +The reason for the exceptions are that implementations aren't following the rules. For example, TinyGo doesn't export +"__indirect_function_table", so crashing on this would make wazero unable to run TinyGo modules. Similarly, modules +loaded by wapc-go don't always define a "_start" function. Since "snapshot-01" is not a proper version, and certainly +not a W3C recommendation, there's no sense in breaking users over matters like this. + +### Why is I/O configuration not coupled to WASI? + +WebAssembly System Interfaces (WASI) is a formalization of a practice that can be done anyway: Define a host function to +access a system interface, such as writing to STDOUT. WASI stalled at snapshot-01 and as of early 2023, is being +rewritten entirely. + +This instability implies a need to transition between WASI specs, which places wazero in a position that requires +decoupling. For example, if code uses two different functions to call `fd_write`, the underlying configuration must be +centralized and decoupled. Otherwise, calls using the same file descriptor number will end up writing to different +places. + +In short, wazero defined system configuration in `ModuleConfig`, not a WASI type. This allows end-users to switch from +one spec to another with minimal impact. This has other helpful benefits, as centralized resources are simpler to close +coherently (ex via `Module.Close`). + +In reflection, this worked well as more ABI became usable in wazero. For example, `GOOS=js GOARCH=wasm` code uses the +same `ModuleConfig` (and `FSConfig`) WASI uses, and in compatible ways. + +### Background on `ModuleConfig` design + +WebAssembly 1.0 (20191205) specifies some aspects to control isolation between modules ([sandboxing](https://en.wikipedia.org/wiki/Sandbox_(computer_security))). +For example, `wasm.Memory` has size constraints and each instance of it is isolated from each other. While `wasm.Memory` +can be shared, by exporting it, it is not exported by default. In fact a WebAssembly Module (Wasm) has no memory by +default. + +While memory is defined in WebAssembly 1.0 (20191205), many aspects are not. Let's use an example of `exec.Cmd` as for +example, a WebAssembly System Interfaces (WASI) command is implemented as a module with a `_start` function, and in many +ways acts similar to a process with a `main` function. + +To capture "hello world" written to the console (stdout a.k.a. file descriptor 1) in `exec.Cmd`, you would set the +`Stdout` field accordingly, perhaps to a buffer. In WebAssembly 1.0 (20191205), the only way to perform something like +this is via a host function (ex `HostModuleFunctionBuilder`) and internally copy memory corresponding to that string +to a buffer. + +WASI implements system interfaces with host functions. Concretely, to write to console, a WASI command `Module` imports +"fd_write" from "wasi_snapshot_preview1" and calls it with the `fd` parameter set to 1 (STDOUT). + +The [snapshot-01](https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md) version of WASI has no +means to declare configuration, although its function definitions imply configuration for example if fd 1 should exist, +and if so where should it write. Moreover, snapshot-01 was last updated in late 2020 and the specification is being +completely rewritten as of early 2022. This means WASI as defined by "snapshot-01" will not clarify aspects like which +file descriptors are required. While it is possible a subsequent version may, it is too early to tell as no version of +WASI has reached a stage near W3C recommendation. Even if it did, module authors are not required to only use WASI to +write to console, as they can define their own host functions, such as they did before WASI existed. + +wazero aims to serve Go developers as a primary function, and help them transition between WASI specifications. In +order to do this, we have to allow top-level configuration. To ensure isolation by default, `ModuleConfig` has WithXXX +that override defaults to no-op or empty. One `ModuleConfig` instance is used regardless of how many times the same WASI +functions are imported. The nil defaults allow safe concurrency in these situations, as well lower the cost when they +are never used. Finally, a one-to-one mapping with `Module` allows the module to close the `ModuleConfig` instead of +confusing users with another API to close. + +Naming, defaults and validation rules of aspects like `STDIN` and `Environ` are intentionally similar to other Go +libraries such as `exec.Cmd` or `syscall.SetEnv`, and differences called out where helpful. For example, there's no goal +to emulate any operating system primitive specific to Windows (such as a 'c:\' drive). Moreover, certain defaults +working with real system calls are neither relevant nor safe to inherit: For example, `exec.Cmd` defaults to read STDIN +from a real file descriptor ("/dev/null"). Defaulting to this, vs reading `io.EOF`, would be unsafe as it can exhaust +file descriptors if resources aren't managed properly. In other words, blind copying of defaults isn't wise as it can +violate isolation or endanger the embedding process. In summary, we try to be similar to normal Go code, but often need +act differently and document `ModuleConfig` is more about emulating, not necessarily performing real system calls. + +## File systems + +### Motivation on `sys.FS` + +The `sys.FS` abstraction in wazero was created because of limitations in +`fs.FS`, and `fs.File` in Go. Compilers targeting `wasip1` may access +functionality that writes new files. The ability to overcome this was requested +even before wazero was named this, via issue #21 in March 2021. + +A month later, golang/go#45757 was raised by someone else on the same topic. As +of July 2023, this has not resolved to a writeable file system abstraction. + +Over the next year more use cases accumulated, consolidated in March 2022 into +#390. This closed in January 2023 with a milestone of providing more +functionality, limited to users giving a real directory. This didn't yet expose +a file abstraction for general purpose use. Internally, this used `os.File`. +However, a wasm module instance is a virtual machine. Only supporting `os.File` +breaks sand-boxing use cases. Moreover, `os.File` is not an interface. Even +though this abstracts functionality, it does allow interception use cases. + +Hence, a few days later in January 2023, we had more issues asking to expose an +abstraction, #1013 and later #1532, on use cases like masking access to files. +In other words, the use case requests never stopped, and aren't solved by +exposing only real files. + +In summary, the primary motivation for exposing a replacement for `fs.FS` and +`fs.File` was around repetitive use case requests for years, around +interception and the ability to create new files, both virtual and real files. +While some use cases are solved with real files, not all are. Regardless, an +interface approach is necessary to ensure users can intercept I/O operations. + +### Why doesn't `sys.File` have a `Fd()` method? + +There are many features we could expose. We could make File expose underlying +file descriptors in case they are supported, for integration of system calls +that accept multiple ones, namely `poll` for multiplexing. This special case is +described in a subsequent section. + +As noted above, users have been asking for a file abstraction for over two +years, and a common answer was to wait. Making users wait is a problem, +especially so long. Good reasons to make people wait are stabilization. Edge +case features are not a great reason to hold abstractions from users. + +Another reason is implementation difficulty. Go did not attempt to abstract +file descriptors. For example, unlike `fs.ReadFile` there is no `fs.FdFile` +interface. Most likely, this is because file descriptors are an implementation +detail of common features. Programming languages, including Go, do not require +end users to know about file descriptors. Types such as `fs.File` can be used +without any knowledge of them. Implementations may or may not have file +descriptors. For example, in Go, `os.DirFS` has underlying file descriptors +while `embed.FS` does not. + +Despite this, some may want to expose a non-standard interface because +`os.File` has `Fd() uintptr` to return a file descriptor. Mainly, this is +handy to integrate with `syscall` package functions (on `GOOS` values that +declare them). Notice, though that `uintptr` is unsafe and not an abstraction. +Close inspection will find some `os.File` types internally use `poll.FD` +instead, yet this is not possible to use abstractly because that type is not +exposed. For example, `plan9` uses a different type than `poll.FD`. In other +words, even in real files, `Fd()` is not wholly portable, despite it being +useful on many operating systems with the `syscall` package. + +The reasons above, why Go doesn't abstract `FdFile` interface are a subset of +reasons why `sys.File` does not. If we exposed `File.Fd()` we not only would +have to declare all the edge cases that Go describes including impact of +finalizers, we would have to describe these in terms of virtualized files. +Then, we would have to reason with this value vs our existing virtualized +`sys.FileTable`, mapping whatever type we return to keys in that table, also +in consideration of garbage collection impact. The combination of issues like +this could lead down a path of not implementing a file system abstraction at +all, and instead a weak key mapped abstraction of the `syscall` package. Once +we finished with all the edge cases, we would have lost context of the original +reason why we started.. simply to allow file write access! + +When wazero attempts to do more than what the Go programming language team, it +has to be carefully evaluated, to: +* Be possible to implement at least for `os.File` backed files +* Not be confusing or cognitively hard for virtual file systems and normal use. +* Affordable: custom code is solely the responsible by the core team, a much + smaller group of individuals than who maintain the Go programming language. + +Due to problems well known in Go, consideration of the end users who constantly +ask for basic file system functionality, and the difficulty virtualizing file +descriptors at multiple levels, we don't expose `Fd()` and likely won't ever +expose `Fd()` on `sys.File`. + +### Why does `sys.File` have a `Poll()` method, while `sys.FS` does not? + +wazero exposes `File.Poll` which allows one-at-a-time poll use cases, +requested by multiple users. This not only includes abstract tests such as +Go 1.21 `GOOS=wasip1`, but real use cases including python and container2wasm +repls, as well listen sockets. The main use cases is non-blocking poll on a +single file. Being a single file, this has no risk of problems such as +head-of-line blocking, even when emulated. + +The main use case of multi-poll are bidirectional network services, something +not used in `GOOS=wasip1` standard libraries, but could be in the future. +Moving forward without a multi-poller allows wazero to expose its file system +abstraction instead of continuing to hold back it back for edge cases. We'll +continue discussion below regardless, as rationale was requested. + +You can loop through multiple `sys.File`, using `File.Poll` to see if an event +is ready, but there is a head-of-line blocking problem. If a long timeout is +used, bad luck could have a file that has nothing to read or write before one +that does. This could cause more blocking than necessary, even if you could +poll the others just after with a zero timeout. What's worse than this is if +unlimited blocking was used (`timeout=-1`). The host implementations could use +goroutines to avoid this, but interrupting a "forever" poll is problematic. All +of these are reasons to consider a multi-poll API, but do not require exporting +`File.Fd()`. + +Should multi-poll becomes critical, `sys.FS` could expose a `Poll` function +like below, despite it being the non-portable, complicated if possible to +implement on all platforms and virtual file systems. +```go +ready, errno := fs.Poll([]sys.PollFile{{f1, sys.POLLIN}, {f2, sys.POLLOUT}}, timeoutMillis) +``` + +A real filesystem could handle this by using an approach like the internal +`unix.Poll` function in Go, passing file descriptors on unix platforms, or +returning `sys.ENOSYS` for unsupported operating systems. Implementation for +virtual files could have a strategy around timeout to avoid the worst case of +head-of-line blocking (unlimited timeout). + +Let's remember that when designing abstractions, it is not best to add an +interface for everything. Certainly, Go doesn't, as evidenced by them not +exposing `poll.FD` in `os.File`! Such a multi-poll could be limited to +built-in filesystems in the wazero repository, avoiding complexity of trying to +support and test this abstractly. This would still permit multiplexing for CLI +users, and also permit single file polling as exists now. + +### Why doesn't wazero implement the working directory? + +An early design of wazero's API included a `WithWorkDirFS` which allowed +control over which file a relative path such as "./config.yml" resolved to, +independent of the root file system. This intended to help separate concerns +like mutability of files, but it didn't work and was removed. + +Compilers that target wasm act differently with regard to the working +directory. For example, while `GOOS=js` uses host functions to track the +working directory, WASI host functions do not. wasi-libc, used by TinyGo, +tracks working directory changes in compiled wasm instead: initially "/" until +code calls `chdir`. Zig assumes the first pre-opened file descriptor is the +working directory. + +The only place wazero can standardize a layered concern is via a host function. +Since WASI doesn't use host functions to track the working directory, we can't +standardize the storage and initial value of it. + +Meanwhile, code may be able to affect the working directory by compiling +`chdir` into their main function, using an argument or ENV for the initial +value (possibly `PWD`). Those unable to control the compiled code should only +use absolute paths in configuration. + +See +* https://github.com/golang/go/blob/go1.20/src/syscall/fs_js.go#L324 +* https://github.com/WebAssembly/wasi-libc/pull/214#issue-673090117 +* https://github.com/ziglang/zig/blob/53a9ee699a35a3d245ab6d1dac1f0687a4dcb42c/src/main.zig#L32 + +### Why ignore the error returned by io.Reader when n > 1? + +Per https://pkg.go.dev/io#Reader, if we receive an error, any bytes read should +be processed first. At the syscall abstraction (`fd_read`), the caller is the +processor, so we can't process the bytes inline and also return the error (as +`EIO`). + +Let's assume we want to return the bytes read on error to the caller. This +implies we at least temporarily ignore the error alongside them. The choice +remaining is whether to persist the error returned with the read until a +possible next call, or ignore the error. + +If we persist an error returned, it would be coupled to a file descriptor, but +effectively it is boolean as this case coerces to `EIO`. If we track a "last +error" on a file descriptor, it could be complicated for a couple reasons +including whether the error is transient or permanent, or if the error would +apply to any FD operation, or just read. Finally, there may never be a +subsequent read as perhaps the bytes leading up to the error are enough to +satisfy the processor. + +This decision boils down to whether or not to track an error bit per file +descriptor or not. If not, the assumption is that a subsequent operation would +also error, this time without reading any bytes. + +The current opinion is to go with the simplest path, which is to return the +bytes read and ignore the error the there were any. Assume a subsequent +operation will err if it needs to. This helps reduce the complexity of the code +in wazero and also accommodates the scenario where the bytes read are enough to +satisfy its processor. + +### File descriptor allocation strategy + +File descriptor allocation currently uses a strategy similar the one implemented +by unix systems: when opening a file, the lowest unused number is picked. + +The WASI standard documents that programs cannot expect that file descriptor +numbers will be allocated with a lowest-first strategy, and they should instead +assume the values will be random. Since _random_ is a very imprecise concept in +computers, we technically satisfying the implementation with the descriptor +allocation strategy we use in Wazero. We could imagine adding more _randomness_ +to the descriptor selection process, however this should never be used as a +security measure to prevent applications from guessing the next file number so +there are no strong incentives to complicate the logic. + +### Why does `FSConfig.WithDirMount` not match behaviour with `os.DirFS`? + +It may seem that we should require any feature that seems like a standard +library in Go, to behave the same way as the standard library. Doing so would +present least surprise to Go developers. In the case of how we handle +filesystems, we break from that as it is incompatible with the expectations of +WASI, the most commonly implemented filesystem ABI. + +The main reason is that `os.DirFS` is a virtual filesystem abstraction while +WASI is an abstraction over syscalls. For example, the signature of `fs.Open` +does not permit use of flags. This creates conflict on what default behaviors +to take when Go implemented `os.DirFS`. On the other hand, `path_open` can pass +flags, and in fact tests require them to be honored in specific ways. This +extends beyond WASI as even `GOOS=js GOARCH=wasm` compiled code requires +certain flags passed to `os.OpenFile` which are impossible to pass due to the +signature of `fs.FS`. + +This conflict requires us to choose what to be more compatible with, and which +type of user to surprise the least. We assume there will be more developers +compiling code to wasm than developers of custom filesystem plugins, and those +compiling code to wasm will be better served if we are compatible with WASI. +Hence on conflict, we prefer WASI behavior vs the behavior of `os.DirFS`. + +Meanwhile, it is possible that Go will one day compile to `GOOS=wasi` in +addition to `GOOS=js`. When there is shared stake in WASI, we expect gaps like +these to be easier to close. + +See https://github.com/WebAssembly/wasi-testsuite +See https://github.com/golang/go/issues/58141 + +## Why is our `Readdir` function more like Go's `os.File` than POSIX `readdir`? + +At one point we attempted to move from a bulk `Readdir` function to something +more like the POSIX `DIR` struct, exposing functions like `telldir`, `seekdir` +and `readdir`. However, we chose the design more like `os.File.Readdir`, +because it performs and fits wasip1 better. + +### wasip1/wasix + +`fd_readdir` in wasip1 (and so also wasix) is like `getdents` in Linux, not +`readdir` in POSIX. `getdents` is more like Go's `os.File.Readdir`. + +We currently have an internal type `sys.DirentCache` which only is used by +wasip1 or wasix. When `HostModuleBuilder` adds support for instantiation state, +we could move this to the `wasi_snapshot_preview1` package. Meanwhile, all +filesystem code is internal anyway, so this special-case is acceptable. + +### wasip2 + +`directory-entry-stream` in wasi-filesystem preview2 is defined in component +model, not an ABI, but in wasmtime it is a consuming iterator. A consuming +iterator is easy to support with anything (like `Readdir(1)`), even if it is +inefficient as you can neither bulk read nor skip. The implementation of the +preview1 adapter (uses preview2) confirms this. They use a dirent cache similar +in some ways to our `sysfs.DirentCache`. As there is no seek concept in +preview2, they interpret the cookie as numeric and read on repeat entries when +a cache wasn't available. Note: we currently do not skip-read like this as it +risks buffering large directories, and no user has requested entries before the +cache, yet. + +Regardless, wasip2 is not complete until the end of 2023. We can defer design +discussion until after it is stable and after the reference impl wasmtime +implements it. + +See + * https://github.com/WebAssembly/wasi-filesystem/blob/ef9fc87c07323a6827632edeb6a7388b31266c8e/example-world.md#directory_entry_stream + * https://github.com/bytecodealliance/wasmtime/blob/b741f7c79d72492d17ab8a29c8ffe4687715938e/crates/wasi/src/preview2/preview2/filesystem.rs#L286-L296 + * https://github.com/bytecodealliance/preview2-prototyping/blob/e4c04bcfbd11c42c27c28984948d501a3e168121/crates/wasi-preview1-component-adapter/src/lib.rs#L2131-L2137 + * https://github.com/bytecodealliance/preview2-prototyping/blob/e4c04bcfbd11c42c27c28984948d501a3e168121/crates/wasi-preview1-component-adapter/src/lib.rs#L936 + +### wasip3 + +`directory-entry-stream` is documented to change significantly in wasip3 moving +from synchronous to synchronous streams. This is dramatically different than +POSIX `readdir` which is synchronous. + +Regardless, wasip3 is not complete until after wasip2, which means 2024 or +later. We can defer design discussion until after it is stable and after the +reference impl wasmtime implements it. + +See + * https://github.com/WebAssembly/WASI/blob/ddfe3d1dda5d1473f37ecebc552ae20ce5fd319a/docs/WitInWasi.md#Streams + * https://docs.google.com/presentation/d/1MNVOZ8hdofO3tI0szg_i-Yoy0N2QPU2C--LzVuoGSlE/edit#slide=id.g1270ef7d5b6_0_662 + +### How do we implement `Pread` with an `fs.File`? + +`ReadAt` is the Go equivalent to `pread`: it does not affect, and is not +affected by, the underlying file offset. Unfortunately, `io.ReaderAt` is not +implemented by all `fs.File`. For example, as of Go 1.19, `embed.openFile` does +not. + +The initial implementation of `fd_pread` instead used `Seek`. To avoid a +regression, we fall back to `io.Seeker` when `io.ReaderAt` is not supported. + +This requires obtaining the initial file offset, seeking to the intended read +offset, and resetting the file offset the initial state. If this final seek +fails, the file offset is left in an undefined state. This is not thread-safe. + +While seeking per read seems expensive, the common case of `embed.openFile` is +only accessing a single int64 field, which is cheap. + +### Pre-opened files + +WASI includes `fd_prestat_get` and `fd_prestat_dir_name` functions used to +learn any directory paths for file descriptors open at initialization time. + +For example, `__wasilibc_register_preopened_fd` scans any file descriptors past +STDERR (1) and invokes `fd_prestat_dir_name` to learn any path prefixes they +correspond to. Zig's `preopensAlloc` does similar. These pre-open functions are +not used again after initialization. + +wazero supports stdio pre-opens followed by any mounts e.g `.:/`. The guest +path is a directory and its name, e.g. "/" is returned by `fd_prestat_dir_name` +for file descriptor 3 (STDERR+1). The first longest match wins on multiple +pre-opens, which allows a path like "/tmp" to match regardless of order vs "/". + +See + * https://github.com/WebAssembly/wasi-libc/blob/a02298043ff551ce1157bc2ee7ab74c3bffe7144/libc-bottom-half/sources/preopens.c + * https://github.com/ziglang/zig/blob/9cb06f3b8bf9ea6b5e5307711bc97328762d6a1d/lib/std/fs/wasi.zig#L50-L53 + +### fd_prestat_dir_name + +`fd_prestat_dir_name` is a WASI function to return the path of the pre-opened +directory of a file descriptor. It has the following three parameters, and the +third `path_len` has ambiguous semantics. + +* `fd`: a file descriptor +* `path`: the offset for the result path +* `path_len`: In wazero, `FdPrestatDirName` writes the result path string to + `path` offset for the exact length of `path_len`. + +Wasmer considers `path_len` to be the maximum length instead of the exact +length that should be written. +See https://github.com/wasmerio/wasmer/blob/3463c51268ed551933392a4063bd4f8e7498b0f6/lib/wasi/src/syscalls/mod.rs#L764 + +The semantics in wazero follows that of wasmtime. +See https://github.com/bytecodealliance/wasmtime/blob/2ca01ae9478f199337cf743a6ab543e8c3f3b238/crates/wasi-common/src/snapshots/preview_1.rs#L578-L582 + +Their semantics match when `path_len` == the length of `path`, so in practice +this difference won't matter match. + +## fd_readdir + +### Why does "wasi_snapshot_preview1" require dot entries when POSIX does not? + +In October 2019, WASI project knew requiring dot entries ("." and "..") was not +documented in preview1, not required by POSIX and problematic to synthesize. +For example, Windows runtimes backed by `FindNextFileW` could not return these. +A year later, the tag representing WASI preview 1 (`snapshot-01`) was made. +This did not include the requested change of making dot entries optional. + +The `phases/snapshot/docs.md` document was altered in subsequent years in +significant ways, often in lock-step with wasmtime or wasi-libc. In January +2022, `sock_accept` was added to `phases/snapshot/docs.md`, a document later +renamed to later renamed to `legacy/preview1/docs.md`. + +As a result, the ABI and behavior remained unstable: The `snapshot-01` tag was +not an effective basis of portability. A test suite was requested well before +this tag, in April 2019. Meanwhile, compliance had no meaning. Developers had +to track changes to the latest doc, while clarifying with wasi-libc or wasmtime +behavior. This lack of stability could have permitted a fix to the dot entries +problem, just as it permitted changes desired by other users. + +In November 2022, the wasi-testsuite project began and started solidifying +expectations. This quickly led to changes in runtimes and the spec doc. WASI +began importing tests from wasmtime as required behaviors for all runtimes. +Some changes implied changes to wasi-libc. For example, `readdir` began to +imply inode fan-outs, which caused performance regressions. Most notably a +test merged in January required dot entries. Tests were merged without running +against any runtime, and even when run ad-hoc only against Linux. Hence, +portability issues mentioned over three years earlier did not trigger any +failure until wazero (which tests Windows) noticed. + +In the same month, wazero requested to revert this change primarily because +Go does not return them from `os.ReadDir`, and materializing them is +complicated due to tests also requiring inodes. Moreover, they are discarded by +not just Go, but other common programming languages. This was rejected by the +WASI lead for preview1, but considered for the completely different ABI named +preview2. + +In February 2023, the WASI chair declared that new rule requiring preview1 to +return dot entries "was decided by the subgroup as a whole", citing meeting +notes. According to these notes, the WASI lead stated incorrectly that POSIX +conformance required returning dot entries, something it explicitly says are +optional. In other words, he said filtering them out would make Preview1 +non-conforming, and asked if anyone objects to this. The co-chair was noted to +say "Because there are existing P1 programs, we shouldnā€™t make changes like +this." No other were recorded to say anything. + +In summary, preview1 was changed retrospectively to require dot entries and +preview2 was changed to require their absence. This rule was reverse engineered +from wasmtime tests, and affirmed on two false premises: + +* POSIX compliance requires dot entries + * POSIX literally says these are optional +* WASI cannot make changes because there are existing P1 programs. + * Changes to Preview 1 happened before and after this topic. + +As of June 2023, wasi-testsuite still only runs on Linux, so compliance of this +rule on Windows is left to runtimes to decide to validate. The preview2 adapter +uses fake cookies zero and one to refer to dot dirents, uses a real inode for +the dot(".") entry and zero inode for dot-dot(".."). + +See https://github.com/WebAssembly/wasi-filesystem/issues/3 +See https://github.com/WebAssembly/WASI/tree/snapshot-01 +See https://github.com/WebAssembly/WASI/issues/9 +See https://github.com/WebAssembly/WASI/pull/458 +See https://github.com/WebAssembly/wasi-testsuite/pull/32 +See https://github.com/WebAssembly/wasi-libc/pull/345 +See https://github.com/WebAssembly/wasi-testsuite/issues/52 +See https://github.com/WebAssembly/WASI/pull/516 +See https://github.com/WebAssembly/meetings/blob/main/wasi/2023/WASI-02-09.md#should-preview1-fd_readdir-filter-out--and- +See https://github.com/bytecodealliance/preview2-prototyping/blob/e4c04bcfbd11c42c27c28984948d501a3e168121/crates/wasi-preview1-component-adapter/src/lib.rs#L1026-L1041 + +### Why are dot (".") and dot-dot ("..") entries problematic? + +When reading a directory, dot (".") and dot-dot ("..") entries are problematic. +For example, Go does not return them from `os.ReadDir`, and materializing them +is complicated (at least dot-dot is). + +A directory entry has stat information in it. The stat information includes +inode which is used for comparing file equivalence. In the simple case of dot, +we could materialize a special entry to expose the same info as stat on the fd +would return. However, doing this and not doing dot-dot would cause confusion, +and dot-dot is far more tricky. To back-fill inode information about a parent +directory would be costly and subtle. For example, the pre-open (mount) of the +directory may be different than its logical parent. This is easy to understand +when considering the common case of mounting "/" and "/tmp" as pre-opens. To +implement ".." from "/tmp" requires information from a separate pre-open, this +includes state to even know the difference. There are easier edge cases as +well, such as the decision to not return ".." from a root path. In any case, +this should start to explain that faking entries when underlying stdlib doesn't +return them is tricky and requires quite a lot of state. + +Another issue is around the `Dirent.Off` value of a directory entry, sometimes +called a "cookie" in Linux man pagers. When the host operating system or +library function does not return dot entries, to support functions such as +`seekdir`, you still need a value for `Dirent.Off`. Naively, you can synthesize +these by choosing sequential offsets zero and one. However, POSIX strictly says +offsets should be treated opaquely. The backing filesystem could use these to +represent real entries. For example, a directory with one entry could use zero +as the `Dirent.Off` value. If you also used zero for the "." dirent, there +would be a clash. This means if you synthesize `Dirent.Off` for any entry, you +need to synthesize this value for all entries. In practice, the simplest way is +using an incrementing number, such as done in the WASI preview2 adapter. + +Working around these issues causes expense to all users of wazero, so we'd +then look to see if that would be justified or not. However, the most common +compilers involved in end user questions, as of early 2023 are TinyGo, Rust and +Zig. All of these compile code which ignores dot and dot-dot entries. In other +words, faking these entries would not only cost our codebase with complexity, +but it would also add unnecessary overhead as the values aren't commonly used. + +The final reason why we might do this, is an end users or a specification +requiring us to. As of early 2023, no end user has raised concern over Go and +by extension wazero not returning dot and dot-dot. The snapshot-01 spec of WASI +does not mention anything on this point. Also, POSIX has the following to say, +which summarizes to "these are optional" + +> The readdir() function shall not return directory entries containing empty names. If entries for dot or dot-dot exist, one entry shall be returned for dot and one entry shall be returned for dot-dot; otherwise, they shall not be returned. + +Unfortunately, as described above, the WASI project decided in early 2023 to +require dot entries in both the spec and the wasi-testsuite. For only this +reason, wazero adds overhead to synthesize dot entries despite it being +unnecessary for most users. + +See https://pubs.opengroup.org/onlinepubs/9699919799/functions/readdir.html +See https://github.com/golang/go/blob/go1.20/src/os/dir_unix.go#L108-L110 +See https://github.com/bytecodealliance/preview2-prototyping/blob/e4c04bcfbd11c42c27c28984948d501a3e168121/crates/wasi-preview1-component-adapter/src/lib.rs#L1026-L1041 + +### Why don't we pre-populate an inode for the dot-dot ("..") entry? + +We only populate an inode for dot (".") because wasi-testsuite requires it, and +we likely already have it (because we cache it). We could attempt to populate +one for dot-dot (".."), but chose not to. + +Firstly, wasi-testsuite does not require the inode of dot-dot, possibly because +the wasip2 adapter doesn't populate it (but we don't really know why). + +The only other reason to populate it would be to avoid wasi-libc's stat fanout +when it is missing. However, wasi-libc explicitly doesn't fan-out to lstat on +the ".." entry on a zero ino. + +Fetching dot-dot's inode despite the above not only doesn't help wasi-libc, but +it also hurts languages that don't use it, such as Go. These languages would +pay a stat syscall penalty even if they don't need the inode. In fact, Go +discards both dot entries! + +In summary, there are no significant upsides in attempting to pre-fetch +dot-dot's inode, and there are downsides to doing it anyway. + +See + * https://github.com/WebAssembly/wasi-libc/blob/bd950eb128bff337153de217b11270f948d04bb4/libc-bottom-half/cloudlibc/src/libc/dirent/readdir.c#L87-L94 + * https://github.com/WebAssembly/wasi-testsuite/blob/main/tests/rust/src/bin/fd_readdir.rs#L108 + * https://github.com/bytecodealliance/preview2-prototyping/blob/e4c04bcfbd11c42c27c28984948d501a3e168121/crates/wasi-preview1-component-adapter/src/lib.rs#L1037 + +### Why don't we require inodes to be non-zero? + +We don't require a non-zero value for `Dirent.Ino` because doing so can prevent +a real one from resolving later via `Stat_t.Ino`. + +We define `Ino` like `d_ino` in POSIX which doesn't special-case zero. It can +be zero for a few reasons: + +* The file is not a regular file or directory. +* The underlying filesystem does not support inodes. e.g. embed:fs +* A directory doesn't include inodes, but a later stat can. e.g. Windows +* The backend is based on wasi-filesystem (a.k.a wasip2), which has + `directory_entry.inode` optional, and might remove it entirely. + +There are other downsides to returning a zero inode in widely used compilers: + +* File equivalence utilities, like `os.SameFile` will not work. +* wasi-libc's `wasip1` mode will call `lstat` and attempt to retrieve a + non-zero value (unless the entry is named ".."). + +A new compiler may accidentally skip a `Dirent` with a zero `Ino` if emulating +a non-POSIX function and re-using `Dirent.Ino` for `d_fileno`. + +* Linux `getdents` doesn't define `d_fileno` must be non-zero +* BSD `getdirentries` is implementation specific. For example, OpenBSD will + return dirents with a zero `d_fileno`, but Darwin will skip them. + +The above shouldn't be a problem, even in the case of BSD, because `wasip1` is +defined more in terms of `getdents` than `getdirentries`. The bottom half of +either should treat `wasip1` (or any similar ABI such as wasix or wasip2) as a +different operating system and either use different logic that doesn't skip, or +synthesize a fake non-zero `d_fileno` when `d_ino` is zero. + +However, this has been a problem. Go's `syscall.ParseDirent` utility is shared +for all `GOOS=unix`. For simplicity, this abstracts `direntIno` with data from +`d_fileno` or `d_ino`, and drops if either are zero, even if `d_fileno` is the +only field with zero explicitly defined. This led to a change to special case +`GOOS=wasip1` as otherwise virtual files would be unconditionally skipped. + +In practice, this problem is rather unique due to so many compilers relying on +wasi-libc, which tolerates a zero inode. For example, while issues were +reported about the performance regression when wasi-libc began doing a fan-out +on zero `Dirent.Ino`, no issues were reported about dirents being dropped as a +result. + +In summary, rather than complicating implementation and forcing non-zero inodes +for a rare case, we permit zero. We instead document this topic thoroughly, so +that emerging compilers can re-use the research and reference it on conflict. +We also document that `Ino` should be non-zero, so that users implementing that +field will attempt to get it. + +See + * https://github.com/WebAssembly/wasi-filesystem/pull/81 + * https://github.com/WebAssembly/wasi-libc/blob/bd950eb128bff337153de217b11270f948d04bb4/libc-bottom-half/cloudlibc/src/libc/dirent/readdir.c#L87-L94 + * https://linux.die.net/man/3/getdents + * https://www.unix.com/man-page/osx/2/getdirentries/ + * https://man.openbsd.org/OpenBSD-5.4/getdirentries.2 + * https://github.com/golang/go/blob/go1.20/src/syscall/dirent.go#L60-L102 + * https://go-review.googlesource.com/c/go/+/507915 + +## sys.Walltime and Nanotime + +The `sys` package has two function types, `Walltime` and `Nanotime` for real +and monotonic clock exports. The naming matches conventions used in Go. + +```go +func time_now() (sec int64, nsec int32, mono int64) { + sec, nsec = walltime() + return sec, nsec, nanotime() +} +``` + +Splitting functions for wall and clock time allow implementations to choose +whether to implement the clock once (as in Go), or split them out. + +Each can be configured with a `ClockResolution`, although is it usually +incorrect as detailed in a sub-heading below. The only reason for exposing this +is to satisfy WASI: + +See https://github.com/WebAssembly/wasi-clocks + +### Why default to fake time? + +WebAssembly has an implicit design pattern of capabilities based security. By +defaulting to a fake time, we reduce the chance of timing attacks, at the cost +of requiring configuration to opt-into real clocks. + +See https://gruss.cc/files/fantastictimers.pdf for an example attacks. + +### Why does fake time increase on reading? + +Both the fake nanotime and walltime increase by 1ms on reading. Particularly in +the case of nanotime, this prevents spinning. For example, when Go compiles +`time.Sleep` using `GOOS=js GOARCH=wasm`, nanotime is used in a loop. If that +never increases, the gouroutine is mistaken for being busy. This would be worse +if a compiler implement sleep using nanotime, yet doesn't check for spinning! + +### Why not `time.Clock`? + +wazero can't use `time.Clock` as a plugin for clock implementation as it is +only substitutable with build flags (`faketime`) and conflates wall and +monotonic time in the same call. + +Go's `time.Clock` was added monotonic time after the fact. For portability with +prior APIs, a decision was made to combine readings into the same API call. + +See https://go.googlesource.com/proposal/+/master/design/12914-monotonic.md + +WebAssembly time imports do not have the same concern. In fact even Go's +imports for clocks split walltime from nanotime readings. + +See https://github.com/golang/go/blob/go1.20/misc/wasm/wasm_exec.js#L243-L255 + +Finally, Go's clock is not an interface. WebAssembly users who want determinism +or security need to be able to substitute an alternative clock implementation +from the host process one. + +### `ClockResolution` + +A clock's resolution is hardware and OS dependent so requires a system call to retrieve an accurate value. +Go does not provide a function for getting resolution, so without CGO we don't have an easy way to get an actual +value. For now, we return fixed values of 1us for realtime and 1ns for monotonic, assuming that realtime clocks are +often lower precision than monotonic clocks. In the future, this could be improved by having OS+arch specific assembly +to make syscalls. + +For example, Go implements time.Now for linux-amd64 with this [assembly](https://github.com/golang/go/blob/go1.20/src/runtime/time_linux_amd64.s). +Because retrieving resolution is not generally called often, unlike getting time, it could be appropriate to only +implement the fallback logic that does not use VDSO (executing syscalls in user mode). The syscall for clock_getres +is 229 and should be usable. https://pkg.go.dev/syscall#pkg-constants. + +If implementing similar for Windows, [mingw](https://github.com/mirror/mingw-w64/blob/6a0e9165008f731bccadfc41a59719cf7c8efc02/mingw-w64-libraries/winpthreads/src/clock.c#L77 +) is often a good source to find the Windows API calls that correspond +to a POSIX method. + +Writing assembly would allow making syscalls without CGO, but comes with the cost that it will require implementations +across many combinations of OS and architecture. + +## sys.Nanosleep + +All major programming languages have a `sleep` mechanism to block for a +duration. Sleep is typically implemented by a WASI `poll_oneoff` relative clock +subscription. + +For example, the below ends up calling `wasi_snapshot_preview1.poll_oneoff`: + +```zig +const std = @import("std"); +pub fn main() !void { + std.time.sleep(std.time.ns_per_s * 5); +} +``` + +Besides Zig, this is also the case with TinyGo (`-target=wasi`) and Rust +(`--target wasm32-wasi`). This isn't the case with Go (`GOOS=js GOARCH=wasm`), +though. In the latter case, wasm loops on `sys.Nanotime`. + +We decided to expose `sys.Nanosleep` to allow overriding the implementation +used in the common case, even if it isn't used by Go, because this gives an +easy and efficient closure over a common program function. We also documented +`sys.Nanotime` to warn users that some compilers don't optimize sleep. + +## sys.Osyield + +We expose `sys.Osyield`, to allow users to control the behavior of WASI's +`sched_yield` without a new build of wazero. This is mainly for parity with +all other related features which we allow users to implement, including +`sys.Nanosleep`. Unlike others, we don't provide an out-of-box implementation +primarily because it will cause performance problems when accessed. + +For example, the below implementation uses CGO, which might result in a 1us +delay per invocation depending on the platform. + +See https://github.com/golang/go/issues/19409#issuecomment-284788196 +```go +//go:noescape +//go:linkname osyield runtime.osyield +func osyield() +``` + +In practice, a request to customize this is unlikely to happen until other +thread based functions are implemented. That said, as of early 2023, there are +a few signs of implementation interest and cross-referencing: + +See https://github.com/WebAssembly/stack-switching/discussions/38 +See https://github.com/WebAssembly/wasi-threads#what-can-be-skipped +See https://slinkydeveloper.com/Kubernetes-controllers-A-New-Hope/ + +## sys.Stat_t + +We expose `stat` information as `sys.Stat_t`, like `syscall.Stat_t` except +defined without build constraints. For example, you can use `sys.Stat_t` on +`GOOS=windows` which doesn't define `syscall.Stat_t`. + +The first use case of this is to return inodes from `fs.FileInfo` without +relying on platform-specifics. For example, a user could return `*sys.Stat_t` +from `info.Sys()` and define a non-zero inode for a virtual file, or map a +real inode to a virtual one. + +Notable choices per field are listed below, where `sys.Stat_t` is unlike +`syscall.Stat_t` on `GOOS=linux`, or needs clarification. One common issue +not repeated below is that numeric fields are 64-bit when at least one platform +defines it that large. Also, zero values are equivalent to nil or absent. + +* `Dev` and `Ino` (`Inode`) are both defined unsigned as they are defined + opaque, and most `syscall.Stat_t` also defined them unsigned. There are + separate sections in this document discussing the impact of zero in `Ino`. +* `Mode` is defined as a `fs.FileMode` even though that is not defined in POSIX + and will not map to all possible values. This is because the current use is + WASI, which doesn't define any types or features not already supported. By + using `fs.FileMode`, we can re-use routine experience in Go. +* `NLink` is unsigned because it is defined that way in `syscall.Stat_t`: there + can never be less than zero links to a file. We suggest defaulting to 1 in + conversions when information is not knowable because at least that many links + exist. +* `Size` is signed because it is defined that way in `syscall.Stat_t`: while + regular files and directories will always be non-negative, irregular files + are possibly negative or not defined. Notably sparse files are known to + return negative values. +* `Atim`, `Mtim` and `Ctim` are signed because they are defined that way in + `syscall.Stat_t`: Negative values are time before 1970. The resolution is + nanosecond because that's the maximum resolution currently supported in Go. + +### Why do we use `sys.EpochNanos` instead of `time.Time` or similar? + +To simplify documentation, we defined a type alias `sys.EpochNanos` for int64. +`time.Time` is a data structure, and we could have used this for +`syscall.Stat_t` time values. The most important reason we do not is conversion +penalty deriving time from common types. + +The most common ABI used in `wasip2`. This, and compatible ABI such as `wasix`, +encode timestamps in memory as a 64-bit number. If we used `time.Time`, we +would have to convert an underlying type like `syscall.Timespec` to `time.Time` +only to later have to call `.UnixNano()` to convert it back to a 64-bit number. + +In the future, the component model module "wasi-filesystem" may represent stat +timestamps with a type shared with "wasi-clocks", abstractly structured similar +to `time.Time`. However, component model intentionally does not define an ABI. +It is likely that the canonical ABI for timestamp will be in two parts, but it +is not required for it to be intermediately represented this way. A utility +like `syscall.NsecToTimespec` could split an int64 so that it could be written +to memory as 96 bytes (int64, int32), without allocating a struct. + +Finally, some may confuse epoch nanoseconds with 32-bit epoch seconds. While +32-bit epoch seconds has "The year 2038" problem, epoch nanoseconds has +"The Year 2262" problem, which is even less concerning for this library. If +the Go programming language and wazero exist in the 2200's, we can make a major +version increment to adjust the `sys.EpochNanos` approach. Meanwhile, we have +faster code. + +## poll_oneoff + +`poll_oneoff` is a WASI API for waiting for I/O events on multiple handles. +It is conceptually similar to the POSIX `poll(2)` syscall. +The name is not `poll`, because it references [ā€œthe fact that this function is not efficient +when used repeatedly with the same large set of handlesā€][poll_oneoff]. + +We chose to support this API in a handful of cases that work for regular files +and standard input. We currently do not support other types of file descriptors such +as socket handles. + +### Clock Subscriptions + +As detailed above in [sys.Nanosleep](#sysnanosleep), `poll_oneoff` handles +relative clock subscriptions. In our implementation we use `sys.Nanosleep()` +for this purpose in most cases, except when polling for interactive input +from `os.Stdin` (see more details below). + +### FdRead and FdWrite Subscriptions + +When subscribing a file descriptor (except `Stdin`) for reads or writes, +the implementation will generally return immediately with success, unless +the file descriptor is unknown. The file descriptor is not checked further +for new incoming data. Any timeout is cancelled, and the API call is able +to return, unless there are subscriptions to `Stdin`: these are handled +separately. + +### FdRead and FdWrite Subscription to Stdin + +Subscribing `Stdin` for reads (writes make no sense and cause an error), +requires extra care: wazero allows to configure a custom reader for `Stdin`. + +In general, if a custom reader is found, the behavior will be the same +as for regular file descriptors: data is assumed to be present and +a success is written back to the result buffer. + +However, if the reader is detected to read from `os.Stdin`, +a special code path is followed, invoking `sysfs.poll()`. + +`sysfs.poll()` is a wrapper for `poll(2)` on POSIX systems, +and it is emulated on Windows. + +### Poll on POSIX + +On POSIX systems, `poll(2)` allows to wait for incoming data on a file +descriptor, and block until either data becomes available or the timeout +expires. + +Usage of `syfs.poll()` is currently only reserved for standard input, because + +1. it is really only necessary to handle interactive input: otherwise, + there is no way in Go to peek from Standard Input without actually + reading (and thus consuming) from it; + +2. if `Stdin` is connected to a pipe, it is ok in most cases to return + with success immediately; + +3. `syfs.poll()` is currently a blocking call, irrespective of goroutines, + because the underlying syscall is; thus, it is better to limit its usage. + +So, if the subscription is for `os.Stdin` and the handle is detected +to correspond to an interactive session, then `sysfs.poll()` will be +invoked with a the `Stdin` handle *and* the timeout. + +This also means that in this specific case, the timeout is uninterruptible, +unless data becomes available on `Stdin` itself. + +### Select on Windows + +On Windows `sysfs.poll()` cannot be delegated to a single +syscall, because there is no single syscall to handle sockets, +pipes and regular files. + +Instead, we emulate its behavior for the cases that are currently +of interest. + +- For regular files, we _always_ report them as ready, as +[most operating systems do anyway][async-io-windows]. + +- For pipes, we invoke [`PeekNamedPipe`][peeknamedpipe] +for each file handle we detect is a pipe open for reading. +We currently ignore pipes open for writing. + +- Notably, we include also support for sockets using the [WinSock +implementation of `poll`][wsapoll], but instead +of relying on the timeout argument of the `WSAPoll` function, +we set a 0-duration timeout so that it behaves like a peek. + +This way, we can check for regular files all at once, +at the beginning of the function, then we poll pipes and +sockets periodically using a cancellable `time.Tick`, +which plays nicely with the rest of the Go runtime. + +### Impact of blocking + +Because this is a blocking syscall, it will also block the carrier thread of +the goroutine, preventing any means to support context cancellation directly. + +There are ways to obviate this issue. We outline here one idea, that is however +not currently implemented. A common approach to support context cancellation is +to add a signal file descriptor to the set, e.g. the read-end of a pipe or an +eventfd on Linux. When the context is canceled, we may unblock a Select call by +writing to the fd, causing it to return immediately. This however requires to +do a bit of housekeeping to hide the "special" FD from the end-user. + +[poll_oneoff]: https://github.com/WebAssembly/wasi-poll#why-is-the-function-called-poll_oneoff +[async-io-windows]: https://tinyclouds.org/iocp_links +[peeknamedpipe]: https://learn.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-peeknamedpipe +[wsapoll]: https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsapoll + +## Signed encoding of integer global constant initializers + +wazero treats integer global constant initializers signed as their interpretation is not known at declaration time. For +example, there is no signed integer [value type](https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#value-types%E2%91%A0). + +To get at the problem, let's use an example. +``` +(global (export "start_epoch") i64 (i64.const 1620216263544)) +``` + +In both signed and unsigned LEB128 encoding, this value is the same bit pattern. The problem is that some numbers are +not. For example, 16256 is `807f` encoded as unsigned, but `80ff00` encoded as signed. + +While the specification mentions uninterpreted integers are in abstract [unsigned values](https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#integers%E2%91%A0), +the binary encoding is clear that they are encoded [signed](https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#integers%E2%91%A4). + +For consistency, we go with signed encoding in the special case of global constant initializers. + +## Implementation limitations + +WebAssembly 1.0 (20191205) specification allows runtimes to [limit certain aspects of Wasm module or execution](https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#a2-implementation-limitations). + +wazero limitations are imposed pragmatically and described below. + +### Number of functions in a module + +The possible number of function instances in [a module](https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#module-instances%E2%91%A0) is not specified in the WebAssembly specifications since [`funcaddr`](https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#syntax-funcaddr) corresponding to a function instance in a store can be arbitrary number. +wazero limits the maximum function instances to 2^27 as even that number would occupy 1GB in function pointers. + +That is because not only we _believe_ that all use cases are fine with the limitation, but also we have no way to test wazero runtimes under these unusual circumstances. + +### Number of function types in a store + +There's no limitation on the number of function types in [a store](https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#store%E2%91%A0) according to the spec. In wazero implementation, we assign each function type to a unique ID, and choose to use `uint32` to represent the IDs. +Therefore the maximum number of function types a store can have is limited to 2^27 as even that number would occupy 512MB just to reference the function types. + +This is due to the same reason for the limitation on the number of functions above. + +### Number of values on the stack in a function + +While the the spec does not clarify a limitation of function stack values, wazero limits this to 2^27 = 134,217,728. +The reason is that we internally represent all the values as 64-bit integers regardless of its types (including f32, f64), and 2^27 values means +1 GiB = (2^30). 1 GiB is the reasonable for most applications [as we see a Goroutine has 250 MB as a limit on the stack for 32-bit arch](https://github.com/golang/go/blob/go1.20/src/runtime/proc.go#L152-L159), considering that WebAssembly is (currently) 32-bit environment. + +All the functions are statically analyzed at module instantiation phase, and if a function can potentially reach this limit, an error is returned. + +### Number of globals in a module + +Theoretically, a module can declare globals (including imports) up to 2^32 times. However, wazero limits this to 2^27(134,217,728) per module. +That is because internally we store globals in a slice with pointer types (meaning 8 bytes on 64-bit platforms), and therefore 2^27 globals +means that we have 1 GiB size of slice which seems large enough for most applications. + +### Number of tables in a module + +While the the spec says that a module can have up to 2^32 tables, wazero limits this to 2^27 = 134,217,728. +One of the reasons is even that number would occupy 1GB in the pointers tables alone. Not only that, we access tables slice by +table index by using 32-bit signed offset in the compiler implementation, which means that the table index of 2^27 can reach 2^27 * 8 (pointer size on 64-bit machines) = 2^30 offsets in bytes. + +We _believe_ that all use cases are fine with the limitation, but also note that we have no way to test wazero runtimes under these unusual circumstances. + +If a module reaches this limit, an error is returned at the compilation phase. + +## Compiler engine implementation + +See [compiler/RATIONALE.md](internal/engine/compiler/RATIONALE.md). + +## Golang patterns + +### Hammer tests +Code that uses concurrency primitives, such as locks or atomics, should include "hammer tests", which run large loops +inside a bounded amount of goroutines, run by half that many `GOMAXPROCS`. These are named consistently "hammer", so +they are easy to find. The name inherits from some existing tests in [golang/go](https://github.com/golang/go/search?q=hammer&type=code). + +Here is an annotated description of the key pieces of a hammer test: +1. `P` declares the count of goroutines to use, defaulting to 8 or 4 if `testing.Short`. + * Half this amount are the cores used, and 4 is less than a modern laptop's CPU. This allows multiple "hammer" tests to run in parallel. +2. `N` declares the scale of work (loop) per goroutine, defaulting to value that finishes in ~0.1s on a modern laptop. + * When in doubt, try 1000 or 100 if `testing.Short` + * Remember, there are multiple hammer tests and CI nodes are slow. Slower tests hurt feedback loops. +3. `defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(P/2))` makes goroutines switch cores, testing visibility of shared data. +4. To ensure goroutines execute at the same time, block them with `sync.WaitGroup`, initialized to `Add(P)`. + * `sync.WaitGroup` internally uses `runtime_Semacquire` not available in any other library. + * `sync.WaitGroup.Add` with a negative value can unblock many goroutines at the same time, e.g. without a for loop. +5. Track goroutines progress via `finished := make(chan int)` where each goroutine in `P` defers `finished <- 1`. + 1. Tests use `require.XXX`, so `recover()` into `t.Fail` in a `defer` function before `finished <- 1`. + * This makes it easier to spot larger concurrency problems as you see each failure, not just the first. + 2. After the `defer` function, await unblocked, then run the stateful function `N` times in a normal loop. + * This loop should trigger shared state problems as locks or atomics are contended by `P` goroutines. +6. After all `P` goroutines launch, atomically release all of them with `WaitGroup.Add(-P)`. +7. Block the runner on goroutine completion, by (`<-finished`) for each `P`. +8. When all goroutines complete, `return` if `t.Failed()`, otherwise perform follow-up state checks. + +This is implemented in wazero in [hammer.go](internal/testing/hammer/hammer.go) + +### Lock-free, cross-goroutine observations of updates + +How to achieve cross-goroutine reads of a variable are not explicitly defined in https://go.dev/ref/mem. wazero uses +atomics to implement this following unofficial practice. For example, a `Close` operation can be guarded to happen only +once via compare-and-swap (CAS) against a zero value. When we use this pattern, we consistently use atomics to both +read and update the same numeric field. + +In lieu of formal documentation, we infer this pattern works from other sources (besides tests): + * `sync.WaitGroup` by definition must support calling `Add` from other goroutines. Internally, it uses atomics. + * rsc in golang/go#5045 writes "atomics guarantee sequential consistency among the atomic variables". + +See https://github.com/golang/go/blob/go1.20/src/sync/waitgroup.go#L64 +See https://github.com/golang/go/issues/5045#issuecomment-252730563 +See https://www.youtube.com/watch?v=VmrEG-3bWyM diff --git a/vendor/github.com/tetratelabs/wazero/README.md b/vendor/github.com/tetratelabs/wazero/README.md new file mode 100644 index 000000000..f547d2257 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/README.md @@ -0,0 +1,135 @@ +# wazero: the zero dependency WebAssembly runtime for Go developers + +[![WebAssembly Core Specification Test](https://github.com/tetratelabs/wazero/actions/workflows/spectest.yaml/badge.svg)](https://github.com/tetratelabs/wazero/actions/workflows/spectest.yaml) [![Go Reference](https://pkg.go.dev/badge/github.com/tetratelabs/wazero.svg)](https://pkg.go.dev/github.com/tetratelabs/wazero) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) + +WebAssembly is a way to safely run code compiled in other languages. Runtimes +execute WebAssembly Modules (Wasm), which are most often binaries with a `.wasm` +extension. + +wazero is a WebAssembly Core Specification [1.0][1] and [2.0][2] compliant +runtime written in Go. It has *zero dependencies*, and doesn't rely on CGO. +This means you can run applications in other languages and still keep cross +compilation. + +Import wazero and extend your Go application with code written in any language! + +## Example + +The best way to learn wazero is by trying one of our [examples](examples/README.md). The +most [basic example](examples/basic) extends a Go application with an addition +function defined in WebAssembly. + +## Runtime + +There are two runtime configurations supported in wazero: _Compiler_ is default: + +By default, ex `wazero.NewRuntime(ctx)`, the Compiler is used if supported. You +can also force the interpreter like so: +```go +r := wazero.NewRuntimeWithConfig(ctx, wazero.NewRuntimeConfigInterpreter()) +``` + +### Interpreter +Interpreter is a naive interpreter-based implementation of Wasm virtual +machine. Its implementation doesn't have any platform (GOARCH, GOOS) specific +code, therefore _interpreter_ can be used for any compilation target available +for Go (such as `riscv64`). + +### Compiler +Compiler compiles WebAssembly modules into machine code ahead of time (AOT), +during `Runtime.CompileModule`. This means your WebAssembly functions execute +natively at runtime. Compiler is faster than Interpreter, often by order of +magnitude (10x) or more. This is done without host-specific dependencies. + +If interested, check out the [RATIONALE.md][8] and help us optimize further! + +### Conformance + +Both runtimes pass WebAssembly Core [1.0][7] and [2.0][14] specification tests +on supported platforms: + +| Runtime | Usage | amd64 | arm64 | others | +|:-----------:|:--------------------------------------:|:-----:|:-----:|:------:| +| Interpreter | `wazero.NewRuntimeConfigInterpreter()` | āœ… | āœ… | āœ… | +| Compiler | `wazero.NewRuntimeConfigCompiler()` | āœ… | āœ… | āŒ | + +## Support Policy + +The below support policy focuses on compatability concerns of those embedding +wazero into their Go applications. + +### wazero + +wazero's [1.0 release][15] happened in March 2023, and is [in use][16] by many +projects and production sites. + +We offer an API stability promise with semantic versioning. In other words, we +promise to not break any exported function signature without incrementing the +major version. This does not mean no innovation: New features and behaviors +happen with a minor version increment, e.g. 1.0.11 to 1.2.0. We also fix bugs +or change internal details with a patch version, e.g. 1.0.0 to 1.0.1. + +You can get the latest version of wazero like this. +```bash +go get github.com/tetratelabs/wazero@latest +``` + +Please give us a [star][17] if you end up using wazero! + +### Go + +wazero has no dependencies except Go, so the only source of conflict in your +project's use of wazero is the Go version. + +wazero follows the same version policy as Go's [Release Policy][10]: two +versions. wazero will ensure these versions work and bugs are valid if there's +an issue with a current Go version. + +Additionally, wazero intentionally delays usage of language or standard library +features one additional version. For example, when Go 1.29 is released, wazero +can use language features or standard libraries added in 1.27. This is a +convenience for embedders who have a slower version policy than Go. However, +only supported Go versions may be used to raise support issues. + +### Platform + +wazero has two runtime modes: Interpreter and Compiler. The only supported operating +systems are ones we test, but that doesn't necessarily mean other operating +system versions won't work. + +We currently test Linux (Ubuntu and scratch), MacOS and Windows as packaged by +[GitHub Actions][11], as well compilation of 32-bit Linux and 64-bit FreeBSD. + +* Interpreter + * Linux is tested on amd64 (native) as well arm64 and riscv64 via emulation. + * MacOS and Windows are only tested on amd64. +* Compiler + * Linux is tested on amd64 (native) as well arm64 via emulation. + * MacOS and Windows are only tested on amd64. + +wazero has no dependencies and doesn't require CGO. This means it can also be +embedded in an application that doesn't use an operating system. This is a main +differentiator between wazero and alternatives. + +We verify zero dependencies by running tests in Docker's [scratch image][12]. +This approach ensures compatibility with any parent image. + +----- +wazero is a registered trademark of Tetrate.io, Inc. in the United States and/or other countries + +[1]: https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/ +[2]: https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/ +[4]: https://github.com/WebAssembly/meetings/blob/main/process/subgroups.md +[5]: https://github.com/WebAssembly/WASI +[6]: https://pkg.go.dev/golang.org/x/sys/unix +[7]: https://github.com/WebAssembly/spec/tree/wg-1.0/test/core +[8]: internal/engine/compiler/RATIONALE.md +[9]: https://github.com/tetratelabs/wazero/issues/506 +[10]: https://go.dev/doc/devel/release +[11]: https://github.com/actions/virtual-environments +[12]: https://docs.docker.com/develop/develop-images/baseimages/#create-a-simple-parent-image-using-scratch +[13]: https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md +[14]: https://github.com/WebAssembly/spec/tree/d39195773112a22b245ffbe864bab6d1182ccb06/test/core +[15]: https://tetrate.io/blog/introducing-wazero-from-tetrate/ +[16]: https://wazero.io/community/users/ +[17]: https://github.com/tetratelabs/wazero/stargazers diff --git a/vendor/github.com/tetratelabs/wazero/api/features.go b/vendor/github.com/tetratelabs/wazero/api/features.go new file mode 100644 index 000000000..04d35e18f --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/api/features.go @@ -0,0 +1,212 @@ +package api + +import ( + "fmt" + "strings" +) + +// CoreFeatures is a bit flag of WebAssembly Core specification features. See +// https://github.com/WebAssembly/proposals for proposals and their status. +// +// Constants define individual features, such as CoreFeatureMultiValue, or +// groups of "finished" features, assigned to a WebAssembly Core Specification +// version, e.g. CoreFeaturesV1 or CoreFeaturesV2. +// +// Note: Numeric values are not intended to be interpreted except as bit flags. +type CoreFeatures uint64 + +// CoreFeaturesV1 are features included in the WebAssembly Core Specification +// 1.0. As of late 2022, this is the only version that is a Web Standard (W3C +// Recommendation). +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/ +const CoreFeaturesV1 = CoreFeatureMutableGlobal + +// CoreFeaturesV2 are features included in the WebAssembly Core Specification +// 2.0 (20220419). As of late 2022, version 2.0 is a W3C working draft, not yet +// a Web Standard (W3C Recommendation). +// +// See https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/appendix/changes.html#release-1-1 +const CoreFeaturesV2 = CoreFeaturesV1 | + CoreFeatureBulkMemoryOperations | + CoreFeatureMultiValue | + CoreFeatureNonTrappingFloatToIntConversion | + CoreFeatureReferenceTypes | + CoreFeatureSignExtensionOps | + CoreFeatureSIMD + +const ( + // CoreFeatureBulkMemoryOperations adds instructions modify ranges of + // memory or table entries ("bulk-memory-operations"). This is included in + // CoreFeaturesV2, but not CoreFeaturesV1. + // + // Here are the notable effects: + // - Adds `memory.fill`, `memory.init`, `memory.copy` and `data.drop` + // instructions. + // - Adds `table.init`, `table.copy` and `elem.drop` instructions. + // - Introduces a "passive" form of element and data segments. + // - Stops checking "active" element and data segment boundaries at + // compile-time, meaning they can error at runtime. + // + // Note: "bulk-memory-operations" is mixed with the "reference-types" + // proposal due to the WebAssembly Working Group merging them + // "mutually dependent". Therefore, enabling this feature requires enabling + // CoreFeatureReferenceTypes, and vice-versa. + // + // See https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/bulk-memory-operations/Overview.md + // https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/reference-types/Overview.md and + // https://github.com/WebAssembly/spec/pull/1287 + CoreFeatureBulkMemoryOperations CoreFeatures = 1 << iota + + // CoreFeatureMultiValue enables multiple values ("multi-value"). This is + // included in CoreFeaturesV2, but not CoreFeaturesV1. + // + // Here are the notable effects: + // - Function (`func`) types allow more than one result. + // - Block types (`block`, `loop` and `if`) can be arbitrary function + // types. + // + // See https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/multi-value/Overview.md + CoreFeatureMultiValue + + // CoreFeatureMutableGlobal allows globals to be mutable. This is included + // in both CoreFeaturesV1 and CoreFeaturesV2. + // + // When false, an api.Global can never be cast to an api.MutableGlobal, and + // any wasm that includes global vars will fail to parse. + CoreFeatureMutableGlobal + + // CoreFeatureNonTrappingFloatToIntConversion enables non-trapping + // float-to-int conversions ("nontrapping-float-to-int-conversion"). This + // is included in CoreFeaturesV2, but not CoreFeaturesV1. + // + // The only effect of enabling is allowing the following instructions, + // which return 0 on NaN instead of panicking. + // - `i32.trunc_sat_f32_s` + // - `i32.trunc_sat_f32_u` + // - `i32.trunc_sat_f64_s` + // - `i32.trunc_sat_f64_u` + // - `i64.trunc_sat_f32_s` + // - `i64.trunc_sat_f32_u` + // - `i64.trunc_sat_f64_s` + // - `i64.trunc_sat_f64_u` + // + // See https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/nontrapping-float-to-int-conversion/Overview.md + CoreFeatureNonTrappingFloatToIntConversion + + // CoreFeatureReferenceTypes enables various instructions and features + // related to table and new reference types. This is included in + // CoreFeaturesV2, but not CoreFeaturesV1. + // + // - Introduction of new value types: `funcref` and `externref`. + // - Support for the following new instructions: + // - `ref.null` + // - `ref.func` + // - `ref.is_null` + // - `table.fill` + // - `table.get` + // - `table.grow` + // - `table.set` + // - `table.size` + // - Support for multiple tables per module: + // - `call_indirect`, `table.init`, `table.copy` and `elem.drop` + // - Support for instructions can take non-zero table index. + // - Element segments can take non-zero table index. + // + // Note: "reference-types" is mixed with the "bulk-memory-operations" + // proposal due to the WebAssembly Working Group merging them + // "mutually dependent". Therefore, enabling this feature requires enabling + // CoreFeatureBulkMemoryOperations, and vice-versa. + // + // See https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/bulk-memory-operations/Overview.md + // https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/reference-types/Overview.md and + // https://github.com/WebAssembly/spec/pull/1287 + CoreFeatureReferenceTypes + + // CoreFeatureSignExtensionOps enables sign extension instructions + // ("sign-extension-ops"). This is included in CoreFeaturesV2, but not + // CoreFeaturesV1. + // + // Adds instructions: + // - `i32.extend8_s` + // - `i32.extend16_s` + // - `i64.extend8_s` + // - `i64.extend16_s` + // - `i64.extend32_s` + // + // See https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/sign-extension-ops/Overview.md + CoreFeatureSignExtensionOps + + // CoreFeatureSIMD enables the vector value type and vector instructions + // (aka SIMD). This is included in CoreFeaturesV2, but not CoreFeaturesV1. + // + // Note: The instruction list is too long to enumerate in godoc. + // See https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/simd/SIMD.md + CoreFeatureSIMD +) + +// SetEnabled enables or disables the feature or group of features. +func (f CoreFeatures) SetEnabled(feature CoreFeatures, val bool) CoreFeatures { + if val { + return f | feature + } + return f &^ feature +} + +// IsEnabled returns true if the feature (or group of features) is enabled. +func (f CoreFeatures) IsEnabled(feature CoreFeatures) bool { + return f&feature != 0 +} + +// RequireEnabled returns an error if the feature (or group of features) is not +// enabled. +func (f CoreFeatures) RequireEnabled(feature CoreFeatures) error { + if f&feature == 0 { + return fmt.Errorf("feature %q is disabled", feature) + } + return nil +} + +// String implements fmt.Stringer by returning each enabled feature. +func (f CoreFeatures) String() string { + var builder strings.Builder + for i := 0; i <= 63; i++ { // cycle through all bits to reduce code and maintenance + target := CoreFeatures(1 << i) + if f.IsEnabled(target) { + if name := featureName(target); name != "" { + if builder.Len() > 0 { + builder.WriteByte('|') + } + builder.WriteString(name) + } + } + } + return builder.String() +} + +func featureName(f CoreFeatures) string { + switch f { + case CoreFeatureMutableGlobal: + // match https://github.com/WebAssembly/mutable-global + return "mutable-global" + case CoreFeatureSignExtensionOps: + // match https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/sign-extension-ops/Overview.md + return "sign-extension-ops" + case CoreFeatureMultiValue: + // match https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/multi-value/Overview.md + return "multi-value" + case CoreFeatureNonTrappingFloatToIntConversion: + // match https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/nontrapping-float-to-int-conversion/Overview.md + return "nontrapping-float-to-int-conversion" + case CoreFeatureBulkMemoryOperations: + // match https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/bulk-memory-operations/Overview.md + return "bulk-memory-operations" + case CoreFeatureReferenceTypes: + // match https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/reference-types/Overview.md + return "reference-types" + case CoreFeatureSIMD: + // match https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/simd/SIMD.md + return "simd" + } + return "" +} diff --git a/vendor/github.com/tetratelabs/wazero/api/wasm.go b/vendor/github.com/tetratelabs/wazero/api/wasm.go new file mode 100644 index 000000000..d6a0d796a --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/api/wasm.go @@ -0,0 +1,756 @@ +// Package api includes constants and interfaces used by both end-users and internal implementations. +package api + +import ( + "context" + "fmt" + "math" + + "github.com/tetratelabs/wazero/internal/internalapi" +) + +// ExternType classifies imports and exports with their respective types. +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#external-types%E2%91%A0 +type ExternType = byte + +const ( + ExternTypeFunc ExternType = 0x00 + ExternTypeTable ExternType = 0x01 + ExternTypeMemory ExternType = 0x02 + ExternTypeGlobal ExternType = 0x03 +) + +// The below are exported to consolidate parsing behavior for external types. +const ( + // ExternTypeFuncName is the name of the WebAssembly 1.0 (20191205) Text Format field for ExternTypeFunc. + ExternTypeFuncName = "func" + // ExternTypeTableName is the name of the WebAssembly 1.0 (20191205) Text Format field for ExternTypeTable. + ExternTypeTableName = "table" + // ExternTypeMemoryName is the name of the WebAssembly 1.0 (20191205) Text Format field for ExternTypeMemory. + ExternTypeMemoryName = "memory" + // ExternTypeGlobalName is the name of the WebAssembly 1.0 (20191205) Text Format field for ExternTypeGlobal. + ExternTypeGlobalName = "global" +) + +// ExternTypeName returns the name of the WebAssembly 1.0 (20191205) Text Format field of the given type. +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#exports%E2%91%A4 +func ExternTypeName(et ExternType) string { + switch et { + case ExternTypeFunc: + return ExternTypeFuncName + case ExternTypeTable: + return ExternTypeTableName + case ExternTypeMemory: + return ExternTypeMemoryName + case ExternTypeGlobal: + return ExternTypeGlobalName + } + return fmt.Sprintf("%#x", et) +} + +// ValueType describes a parameter or result type mapped to a WebAssembly +// function signature. +// +// The following describes how to convert between Wasm and Golang types: +// +// - ValueTypeI32 - EncodeU32 DecodeU32 for uint32 / EncodeI32 DecodeI32 for int32 +// - ValueTypeI64 - uint64(int64) +// - ValueTypeF32 - EncodeF32 DecodeF32 from float32 +// - ValueTypeF64 - EncodeF64 DecodeF64 from float64 +// - ValueTypeExternref - unintptr(unsafe.Pointer(p)) where p is any pointer +// type in Go (e.g. *string) +// +// e.g. Given a Text Format type use (param i64) (result i64), no conversion is +// necessary. +// +// results, _ := fn(ctx, input) +// result := result[0] +// +// e.g. Given a Text Format type use (param f64) (result f64), conversion is +// necessary. +// +// results, _ := fn(ctx, api.EncodeF64(input)) +// result := api.DecodeF64(result[0]) +// +// Note: This is a type alias as it is easier to encode and decode in the +// binary format. +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-valtype +type ValueType = byte + +const ( + // ValueTypeI32 is a 32-bit integer. + ValueTypeI32 ValueType = 0x7f + // ValueTypeI64 is a 64-bit integer. + ValueTypeI64 ValueType = 0x7e + // ValueTypeF32 is a 32-bit floating point number. + ValueTypeF32 ValueType = 0x7d + // ValueTypeF64 is a 64-bit floating point number. + ValueTypeF64 ValueType = 0x7c + + // ValueTypeExternref is a externref type. + // + // Note: in wazero, externref type value are opaque raw 64-bit pointers, + // and the ValueTypeExternref type in the signature will be translated as + // uintptr in wazero's API level. + // + // For example, given the import function: + // (func (import "env" "f") (param externref) (result externref)) + // + // This can be defined in Go as: + // r.NewHostModuleBuilder("env"). + // NewFunctionBuilder(). + // WithFunc(func(context.Context, _ uintptr) (_ uintptr) { return }). + // Export("f") + // + // Note: The usage of this type is toggled with api.CoreFeatureBulkMemoryOperations. + ValueTypeExternref ValueType = 0x6f +) + +// ValueTypeName returns the type name of the given ValueType as a string. +// These type names match the names used in the WebAssembly text format. +// +// Note: This returns "unknown", if an undefined ValueType value is passed. +func ValueTypeName(t ValueType) string { + switch t { + case ValueTypeI32: + return "i32" + case ValueTypeI64: + return "i64" + case ValueTypeF32: + return "f32" + case ValueTypeF64: + return "f64" + case ValueTypeExternref: + return "externref" + } + return "unknown" +} + +// Module is a sandboxed, ready to execute Wasm module. This can be used to get exported functions, etc. +// +// In WebAssembly terminology, this corresponds to a "Module Instance", but wazero calls pre-instantiation module as +// "Compiled Module" as in wazero.CompiledModule, therefore we call this post-instantiation module simply "Module". +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#module-instances%E2%91%A0 +// +// # Notes +// +// - This is an interface for decoupling, not third-party implementations. +// All implementations are in wazero. +// - Closing the wazero.Runtime closes any Module it instantiated. +type Module interface { + fmt.Stringer + + // Name is the name this module was instantiated with. Exported functions can be imported with this name. + Name() string + + // Memory returns a memory defined in this module or nil if there are none wasn't. + Memory() Memory + + // ExportedFunction returns a function exported from this module or nil if it wasn't. + // + // Note: The default wazero.ModuleConfig attempts to invoke `_start`, which + // in rare cases can close the module. When in doubt, check IsClosed prior + // to invoking a function export after instantiation. + ExportedFunction(name string) Function + + // ExportedFunctionDefinitions returns all the exported function + // definitions in this module, keyed on export name. + ExportedFunctionDefinitions() map[string]FunctionDefinition + + // TODO: Table + + // ExportedMemory returns a memory exported from this module or nil if it wasn't. + // + // WASI modules require exporting a Memory named "memory". This means that a module successfully initialized + // as a WASI Command or Reactor will never return nil for this name. + // + // See https://github.com/WebAssembly/WASI/blob/snapshot-01/design/application-abi.md#current-unstable-abi + ExportedMemory(name string) Memory + + // ExportedMemoryDefinitions returns all the exported memory definitions + // in this module, keyed on export name. + // + // Note: As of WebAssembly Core Specification 2.0, there can be at most one + // memory. + ExportedMemoryDefinitions() map[string]MemoryDefinition + + // ExportedGlobal a global exported from this module or nil if it wasn't. + ExportedGlobal(name string) Global + + // CloseWithExitCode releases resources allocated for this Module. Use a non-zero exitCode parameter to indicate a + // failure to ExportedFunction callers. + // + // The error returned here, if present, is about resource de-allocation (such as I/O errors). Only the last error is + // returned, so a non-nil return means at least one error happened. Regardless of error, this Module will + // be removed, making its name available again. + // + // Calling this inside a host function is safe, and may cause ExportedFunction callers to receive a sys.ExitError + // with the exitCode. + CloseWithExitCode(ctx context.Context, exitCode uint32) error + + // Closer closes this module by delegating to CloseWithExitCode with an exit code of zero. + Closer + + // IsClosed returns true if the module is closed, so no longer usable. + // + // This can happen for the following reasons: + // - Closer was called directly. + // - A guest function called Closer indirectly, such as `_start` calling + // `proc_exit`, which internally closed the module. + // - wazero.RuntimeConfig `WithCloseOnContextDone` was enabled and a + // context completion closed the module. + // + // Where any of the above are possible, check this value before calling an + // ExportedFunction, even if you didn't formerly receive a sys.ExitError. + // sys.ExitError is only returned on non-zero code, something that closes + // the module successfully will not result it one. + IsClosed() bool + + internalapi.WazeroOnly +} + +// Closer closes a resource. +// +// # Notes +// +// - This is an interface for decoupling, not third-party implementations. +// All implementations are in wazero. +type Closer interface { + // Close closes the resource. + // + // Note: The context parameter is used for value lookup, such as for + // logging. A canceled or otherwise done context will not prevent Close + // from succeeding. + Close(context.Context) error +} + +// ExportDefinition is a WebAssembly type exported in a module +// (wazero.CompiledModule). +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#exports%E2%91%A0 +// +// # Notes +// +// - This is an interface for decoupling, not third-party implementations. +// All implementations are in wazero. +type ExportDefinition interface { + // ModuleName is the possibly empty name of the module defining this + // export. + // + // Note: This may be different from Module.Name, because a compiled module + // can be instantiated multiple times as different names. + ModuleName() string + + // Index is the position in the module's index, imports first. + Index() uint32 + + // Import returns true with the module and name when this was imported. + // Otherwise, it returns false. + // + // Note: Empty string is valid for both names in the WebAssembly Core + // Specification, so "" "" is possible. + Import() (moduleName, name string, isImport bool) + + // ExportNames include all exported names. + // + // Note: The empty name is allowed in the WebAssembly Core Specification, + // so "" is possible. + ExportNames() []string + + internalapi.WazeroOnly +} + +// MemoryDefinition is a WebAssembly memory exported in a module +// (wazero.CompiledModule). Units are in pages (64KB). +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#exports%E2%91%A0 +// +// # Notes +// +// - This is an interface for decoupling, not third-party implementations. +// All implementations are in wazero. +type MemoryDefinition interface { + ExportDefinition + + // Min returns the possibly zero initial count of 64KB pages. + Min() uint32 + + // Max returns the possibly zero max count of 64KB pages, or false if + // unbounded. + Max() (uint32, bool) + + internalapi.WazeroOnly +} + +// FunctionDefinition is a WebAssembly function exported in a module +// (wazero.CompiledModule). +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#exports%E2%91%A0 +// +// # Notes +// +// - This is an interface for decoupling, not third-party implementations. +// All implementations are in wazero. +type FunctionDefinition interface { + ExportDefinition + + // Name is the module-defined name of the function, which is not necessarily + // the same as its export name. + Name() string + + // DebugName identifies this function based on its Index or Name in the + // module. This is used for errors and stack traces. e.g. "env.abort". + // + // When the function name is empty, a substitute name is generated by + // prefixing '$' to its position in the index. Ex ".$0" is the + // first function (possibly imported) in an unnamed module. + // + // The format is dot-delimited module and function name, but there are no + // restrictions on the module and function name. This means either can be + // empty or include dots. e.g. "x.x.x" could mean module "x" and name "x.x", + // or it could mean module "x.x" and name "x". + // + // Note: This name is stable regardless of import or export. For example, + // if Import returns true, the value is still based on the Name or Index + // and not the imported function name. + DebugName() string + + // GoFunction is non-nil when implemented by the embedder instead of a wasm + // binary, e.g. via wazero.HostModuleBuilder + // + // The expected results are nil, GoFunction or GoModuleFunction. + GoFunction() interface{} + + // ParamTypes are the possibly empty sequence of value types accepted by a + // function with this signature. + // + // See ValueType documentation for encoding rules. + ParamTypes() []ValueType + + // ParamNames are index-correlated with ParamTypes or nil if not available + // for one or more parameters. + ParamNames() []string + + // ResultTypes are the results of the function. + // + // When WebAssembly 1.0 (20191205), there can be at most one result. + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#result-types%E2%91%A0 + // + // See ValueType documentation for encoding rules. + ResultTypes() []ValueType + + // ResultNames are index-correlated with ResultTypes or nil if not + // available for one or more results. + ResultNames() []string + + internalapi.WazeroOnly +} + +// Function is a WebAssembly function exported from an instantiated module +// (wazero.Runtime InstantiateModule). +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#syntax-func +// +// # Notes +// +// - This is an interface for decoupling, not third-party implementations. +// All implementations are in wazero. +type Function interface { + // Definition is metadata about this function from its defining module. + Definition() FunctionDefinition + + // Call invokes the function with the given parameters and returns any + // results or an error for any failure looking up or invoking the function. + // + // Encoding is described in Definition, and supplying an incorrect count of + // parameters vs FunctionDefinition.ParamTypes is an error. + // + // If the exporting Module was closed during this call, the error returned + // may be a sys.ExitError. See Module.CloseWithExitCode for details. + // + // Call is not goroutine-safe, therefore it is recommended to create + // another Function if you want to invoke the same function concurrently. + // On the other hand, sequential invocations of Call is allowed. + // However, this should not be called multiple times until the previous Call returns. + // + // To safely encode/decode params/results expressed as uint64, users are encouraged to + // use api.EncodeXXX or DecodeXXX functions. See the docs on api.ValueType. + // + // When RuntimeConfig.WithCloseOnContextDone is toggled, the invocation of this Call method is ensured to be closed + // whenever one of the three conditions is met. In the event of close, sys.ExitError will be returned and + // the api.Module from which this api.Function is derived will be made closed. See the documentation of + // WithCloseOnContextDone on wazero.RuntimeConfig for detail. See examples in context_done_example_test.go for + // the end-to-end demonstrations of how these terminations can be performed. + Call(ctx context.Context, params ...uint64) ([]uint64, error) + + // CallWithStack is an optimized variation of Call that saves memory + // allocations when the stack slice is reused across calls. + // + // Stack length must be at least the max of parameter or result length. + // The caller adds parameters in order to the stack, and reads any results + // in order from the stack, except in the error case. + // + // For example, the following reuses the same stack slice to call searchFn + // repeatedly saving one allocation per iteration: + // + // stack := make([]uint64, 4) + // for i, search := range searchParams { + // // copy the next params to the stack + // copy(stack, search) + // if err := searchFn.CallWithStack(ctx, stack); err != nil { + // return err + // } else if stack[0] == 1 { // found + // return i // searchParams[i] matched! + // } + // } + // + // # Notes + // + // - This is similar to GoModuleFunction, except for using calling functions + // instead of implementing them. Moreover, this is used regardless of + // whether the callee is a host or wasm defined function. + CallWithStack(ctx context.Context, stack []uint64) error + + internalapi.WazeroOnly +} + +// GoModuleFunction is a Function implemented in Go instead of a wasm binary. +// The Module parameter is the calling module, used to access memory or +// exported functions. See GoModuleFunc for an example. +// +// The stack is includes any parameters encoded according to their ValueType. +// Its length is the max of parameter or result length. When there are results, +// write them in order beginning at index zero. Do not use the stack after the +// function returns. +// +// Here's a typical way to read three parameters and write back one. +// +// // read parameters off the stack in index order +// argv, argvBuf := api.DecodeU32(stack[0]), api.DecodeU32(stack[1]) +// +// // write results back to the stack in index order +// stack[0] = api.EncodeU32(ErrnoSuccess) +// +// This function can be non-deterministic or cause side effects. It also +// has special properties not defined in the WebAssembly Core specification. +// Notably, this uses the caller's memory (via Module.Memory). See +// https://www.w3.org/TR/wasm-core-1/#host-functions%E2%91%A0 +// +// Most end users will not define functions directly with this, as they will +// use reflection or code generators instead. These approaches are more +// idiomatic as they can map go types to ValueType. This type is exposed for +// those willing to trade usability and safety for performance. +// +// To safely decode/encode values from/to the uint64 stack, users are encouraged to use +// api.EncodeXXX or api.DecodeXXX functions. See the docs on api.ValueType. +type GoModuleFunction interface { + Call(ctx context.Context, mod Module, stack []uint64) +} + +// GoModuleFunc is a convenience for defining an inlined function. +// +// For example, the following returns an uint32 value read from parameter zero: +// +// api.GoModuleFunc(func(ctx context.Context, mod api.Module, stack []uint64) { +// offset := api.DecodeU32(stack[0]) // read the parameter from the stack +// +// ret, ok := mod.Memory().ReadUint32Le(offset) +// if !ok { +// panic("out of memory") +// } +// +// stack[0] = api.EncodeU32(ret) // add the result back to the stack. +// }) +type GoModuleFunc func(ctx context.Context, mod Module, stack []uint64) + +// Call implements GoModuleFunction.Call. +func (f GoModuleFunc) Call(ctx context.Context, mod Module, stack []uint64) { + f(ctx, mod, stack) +} + +// GoFunction is an optimized form of GoModuleFunction which doesn't require +// the Module parameter. See GoFunc for an example. +// +// For example, this function does not need to use the importing module's +// memory or exported functions. +type GoFunction interface { + Call(ctx context.Context, stack []uint64) +} + +// GoFunc is a convenience for defining an inlined function. +// +// For example, the following returns the sum of two uint32 parameters: +// +// api.GoFunc(func(ctx context.Context, stack []uint64) { +// x, y := api.DecodeU32(stack[0]), api.DecodeU32(stack[1]) +// stack[0] = api.EncodeU32(x + y) +// }) +type GoFunc func(ctx context.Context, stack []uint64) + +// Call implements GoFunction.Call. +func (f GoFunc) Call(ctx context.Context, stack []uint64) { + f(ctx, stack) +} + +// Global is a WebAssembly 1.0 (20191205) global exported from an instantiated module (wazero.Runtime InstantiateModule). +// +// For example, if the value is not mutable, you can read it once: +// +// offset := module.ExportedGlobal("memory.offset").Get() +// +// Globals are allowed by specification to be mutable. However, this can be disabled by configuration. When in doubt, +// safe cast to find out if the value can change. Here's an example: +// +// offset := module.ExportedGlobal("memory.offset") +// if _, ok := offset.(api.MutableGlobal); ok { +// // value can change +// } else { +// // value is constant +// } +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#globals%E2%91%A0 +// +// # Notes +// +// - This is an interface for decoupling, not third-party implementations. +// All implementations are in wazero. +type Global interface { + fmt.Stringer + + // Type describes the numeric type of the global. + Type() ValueType + + // Get returns the last known value of this global. + // + // See Type for how to decode this value to a Go type. + Get() uint64 +} + +// MutableGlobal is a Global whose value can be updated at runtime (variable). +// +// # Notes +// +// - This is an interface for decoupling, not third-party implementations. +// All implementations are in wazero. +type MutableGlobal interface { + Global + + // Set updates the value of this global. + // + // See Global.Type for how to encode this value from a Go type. + Set(v uint64) + + internalapi.WazeroOnly +} + +// Memory allows restricted access to a module's memory. Notably, this does not allow growing. +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#storage%E2%91%A0 +// +// # Notes +// +// - This is an interface for decoupling, not third-party implementations. +// All implementations are in wazero. +// - This includes all value types available in WebAssembly 1.0 (20191205) and all are encoded little-endian. +type Memory interface { + // Definition is metadata about this memory from its defining module. + Definition() MemoryDefinition + + // Size returns the size in bytes available. e.g. If the underlying memory + // has 1 page: 65536 + // + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#-hrefsyntax-instr-memorymathsfmemorysize%E2%91%A0 + Size() uint32 + + // Grow increases memory by the delta in pages (65536 bytes per page). + // The return val is the previous memory size in pages, or false if the + // delta was ignored as it exceeds MemoryDefinition.Max. + // + // # Notes + // + // - This is the same as the "memory.grow" instruction defined in the + // WebAssembly Core Specification, except returns false instead of -1. + // - When this returns true, any shared views via Read must be refreshed. + // + // See MemorySizer Read and https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#grow-mem + Grow(deltaPages uint32) (previousPages uint32, ok bool) + + // ReadByte reads a single byte from the underlying buffer at the offset or returns false if out of range. + ReadByte(offset uint32) (byte, bool) + + // ReadUint16Le reads a uint16 in little-endian encoding from the underlying buffer at the offset in or returns + // false if out of range. + ReadUint16Le(offset uint32) (uint16, bool) + + // ReadUint32Le reads a uint32 in little-endian encoding from the underlying buffer at the offset in or returns + // false if out of range. + ReadUint32Le(offset uint32) (uint32, bool) + + // ReadFloat32Le reads a float32 from 32 IEEE 754 little-endian encoded bits in the underlying buffer at the offset + // or returns false if out of range. + // See math.Float32bits + ReadFloat32Le(offset uint32) (float32, bool) + + // ReadUint64Le reads a uint64 in little-endian encoding from the underlying buffer at the offset or returns false + // if out of range. + ReadUint64Le(offset uint32) (uint64, bool) + + // ReadFloat64Le reads a float64 from 64 IEEE 754 little-endian encoded bits in the underlying buffer at the offset + // or returns false if out of range. + // + // See math.Float64bits + ReadFloat64Le(offset uint32) (float64, bool) + + // Read reads byteCount bytes from the underlying buffer at the offset or + // returns false if out of range. + // + // For example, to search for a NUL-terminated string: + // buf, _ = memory.Read(offset, byteCount) + // n := bytes.IndexByte(buf, 0) + // if n < 0 { + // // Not found! + // } + // + // Write-through + // + // This returns a view of the underlying memory, not a copy. This means any + // writes to the slice returned are visible to Wasm, and any updates from + // Wasm are visible reading the returned slice. + // + // For example: + // buf, _ = memory.Read(offset, byteCount) + // buf[1] = 'a' // writes through to memory, meaning Wasm code see 'a'. + // + // If you don't intend-write through, make a copy of the returned slice. + // + // When to refresh Read + // + // The returned slice disconnects on any capacity change. For example, + // `buf = append(buf, 'a')` might result in a slice that is no longer + // shared. The same exists Wasm side. For example, if Wasm changes its + // memory capacity, ex via "memory.grow"), the host slice is no longer + // shared. Those who need a stable view must set Wasm memory min=max, or + // use wazero.RuntimeConfig WithMemoryCapacityPages to ensure max is always + // allocated. + Read(offset, byteCount uint32) ([]byte, bool) + + // WriteByte writes a single byte to the underlying buffer at the offset in or returns false if out of range. + WriteByte(offset uint32, v byte) bool + + // WriteUint16Le writes the value in little-endian encoding to the underlying buffer at the offset in or returns + // false if out of range. + WriteUint16Le(offset uint32, v uint16) bool + + // WriteUint32Le writes the value in little-endian encoding to the underlying buffer at the offset in or returns + // false if out of range. + WriteUint32Le(offset, v uint32) bool + + // WriteFloat32Le writes the value in 32 IEEE 754 little-endian encoded bits to the underlying buffer at the offset + // or returns false if out of range. + // + // See math.Float32bits + WriteFloat32Le(offset uint32, v float32) bool + + // WriteUint64Le writes the value in little-endian encoding to the underlying buffer at the offset in or returns + // false if out of range. + WriteUint64Le(offset uint32, v uint64) bool + + // WriteFloat64Le writes the value in 64 IEEE 754 little-endian encoded bits to the underlying buffer at the offset + // or returns false if out of range. + // + // See math.Float64bits + WriteFloat64Le(offset uint32, v float64) bool + + // Write writes the slice to the underlying buffer at the offset or returns false if out of range. + Write(offset uint32, v []byte) bool + + // WriteString writes the string to the underlying buffer at the offset or returns false if out of range. + WriteString(offset uint32, v string) bool + + internalapi.WazeroOnly +} + +// CustomSection contains the name and raw data of a custom section. +// +// # Notes +// +// - This is an interface for decoupling, not third-party implementations. +// All implementations are in wazero. +type CustomSection interface { + // Name is the name of the custom section + Name() string + // Data is the raw data of the custom section + Data() []byte + + internalapi.WazeroOnly +} + +// EncodeExternref encodes the input as a ValueTypeExternref. +// +// See DecodeExternref +func EncodeExternref(input uintptr) uint64 { + return uint64(input) +} + +// DecodeExternref decodes the input as a ValueTypeExternref. +// +// See EncodeExternref +func DecodeExternref(input uint64) uintptr { + return uintptr(input) +} + +// EncodeI32 encodes the input as a ValueTypeI32. +func EncodeI32(input int32) uint64 { + return uint64(uint32(input)) +} + +// DecodeI32 decodes the input as a ValueTypeI32. +func DecodeI32(input uint64) int32 { + return int32(input) +} + +// EncodeU32 encodes the input as a ValueTypeI32. +func EncodeU32(input uint32) uint64 { + return uint64(input) +} + +// DecodeU32 decodes the input as a ValueTypeI32. +func DecodeU32(input uint64) uint32 { + return uint32(input) +} + +// EncodeI64 encodes the input as a ValueTypeI64. +func EncodeI64(input int64) uint64 { + return uint64(input) +} + +// EncodeF32 encodes the input as a ValueTypeF32. +// +// See DecodeF32 +func EncodeF32(input float32) uint64 { + return uint64(math.Float32bits(input)) +} + +// DecodeF32 decodes the input as a ValueTypeF32. +// +// See EncodeF32 +func DecodeF32(input uint64) float32 { + return math.Float32frombits(uint32(input)) +} + +// EncodeF64 encodes the input as a ValueTypeF64. +// +// See EncodeF32 +func EncodeF64(input float64) uint64 { + return math.Float64bits(input) +} + +// DecodeF64 decodes the input as a ValueTypeF64. +// +// See EncodeF64 +func DecodeF64(input uint64) float64 { + return math.Float64frombits(input) +} diff --git a/vendor/github.com/tetratelabs/wazero/builder.go b/vendor/github.com/tetratelabs/wazero/builder.go new file mode 100644 index 000000000..f64afabdf --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/builder.go @@ -0,0 +1,352 @@ +package wazero + +import ( + "context" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/wasm" +) + +// HostFunctionBuilder defines a host function (in Go), so that a +// WebAssembly binary (e.g. %.wasm file) can import and use it. +// +// Here's an example of an addition function: +// +// hostModuleBuilder.NewFunctionBuilder(). +// WithFunc(func(cxt context.Context, x, y uint32) uint32 { +// return x + y +// }). +// Export("add") +// +// # Memory +// +// All host functions act on the importing api.Module, including any memory +// exported in its binary (%.wasm file). If you are reading or writing memory, +// it is sand-boxed Wasm memory defined by the guest. +// +// Below, `m` is the importing module, defined in Wasm. `fn` is a host function +// added via Export. This means that `x` was read from memory defined in Wasm, +// not arbitrary memory in the process. +// +// fn := func(ctx context.Context, m api.Module, offset uint32) uint32 { +// x, _ := m.Memory().ReadUint32Le(ctx, offset) +// return x +// } +// +// # Notes +// +// - This is an interface for decoupling, not third-party implementations. +// All implementations are in wazero. +type HostFunctionBuilder interface { + // WithGoFunction is an advanced feature for those who need higher + // performance than WithFunc at the cost of more complexity. + // + // Here's an example addition function: + // + // builder.WithGoFunction(api.GoFunc(func(ctx context.Context, stack []uint64) { + // x, y := api.DecodeI32(stack[0]), api.DecodeI32(stack[1]) + // sum := x + y + // stack[0] = api.EncodeI32(sum) + // }), []api.ValueType{api.ValueTypeI32, api.ValueTypeI32}, []api.ValueType{api.ValueTypeI32}) + // + // As you can see above, defining in this way implies knowledge of which + // WebAssembly api.ValueType is appropriate for each parameter and result. + // + // See WithGoModuleFunction if you also need to access the calling module. + WithGoFunction(fn api.GoFunction, params, results []api.ValueType) HostFunctionBuilder + + // WithGoModuleFunction is an advanced feature for those who need higher + // performance than WithFunc at the cost of more complexity. + // + // Here's an example addition function that loads operands from memory: + // + // builder.WithGoModuleFunction(api.GoModuleFunc(func(ctx context.Context, m api.Module, stack []uint64) { + // mem := m.Memory() + // offset := api.DecodeU32(stack[0]) + // + // x, _ := mem.ReadUint32Le(ctx, offset) + // y, _ := mem.ReadUint32Le(ctx, offset + 4) // 32 bits == 4 bytes! + // sum := x + y + // + // stack[0] = api.EncodeU32(sum) + // }), []api.ValueType{api.ValueTypeI32}, []api.ValueType{api.ValueTypeI32}) + // + // As you can see above, defining in this way implies knowledge of which + // WebAssembly api.ValueType is appropriate for each parameter and result. + // + // See WithGoFunction if you don't need access to the calling module. + WithGoModuleFunction(fn api.GoModuleFunction, params, results []api.ValueType) HostFunctionBuilder + + // WithFunc uses reflect.Value to map a go `func` to a WebAssembly + // compatible Signature. An input that isn't a `func` will fail to + // instantiate. + // + // Here's an example of an addition function: + // + // builder.WithFunc(func(cxt context.Context, x, y uint32) uint32 { + // return x + y + // }) + // + // # Defining a function + // + // Except for the context.Context and optional api.Module, all parameters + // or result types must map to WebAssembly numeric value types. This means + // uint32, int32, uint64, int64, float32 or float64. + // + // api.Module may be specified as the second parameter, usually to access + // memory. This is important because there are only numeric types in Wasm. + // The only way to share other data is via writing memory and sharing + // offsets. + // + // builder.WithFunc(func(ctx context.Context, m api.Module, offset uint32) uint32 { + // mem := m.Memory() + // x, _ := mem.ReadUint32Le(ctx, offset) + // y, _ := mem.ReadUint32Le(ctx, offset + 4) // 32 bits == 4 bytes! + // return x + y + // }) + // + // This example propagates context properly when calling other functions + // exported in the api.Module: + // + // builder.WithFunc(func(ctx context.Context, m api.Module, offset, byteCount uint32) uint32 { + // fn = m.ExportedFunction("__read") + // results, err := fn(ctx, offset, byteCount) + // --snip-- + WithFunc(interface{}) HostFunctionBuilder + + // WithName defines the optional module-local name of this function, e.g. + // "random_get" + // + // Note: This is not required to match the Export name. + WithName(name string) HostFunctionBuilder + + // WithParameterNames defines optional parameter names of the function + // signature, e.x. "buf", "buf_len" + // + // Note: When defined, names must be provided for all parameters. + WithParameterNames(names ...string) HostFunctionBuilder + + // WithResultNames defines optional result names of the function + // signature, e.x. "errno" + // + // Note: When defined, names must be provided for all results. + WithResultNames(names ...string) HostFunctionBuilder + + // Export exports this to the HostModuleBuilder as the given name, e.g. + // "random_get" + Export(name string) HostModuleBuilder +} + +// HostModuleBuilder is a way to define host functions (in Go), so that a +// WebAssembly binary (e.g. %.wasm file) can import and use them. +// +// Specifically, this implements the host side of an Application Binary +// Interface (ABI) like WASI or AssemblyScript. +// +// For example, this defines and instantiates a module named "env" with one +// function: +// +// ctx := context.Background() +// r := wazero.NewRuntime(ctx) +// defer r.Close(ctx) // This closes everything this Runtime created. +// +// hello := func() { +// println("hello!") +// } +// env, _ := r.NewHostModuleBuilder("env"). +// NewFunctionBuilder().WithFunc(hello).Export("hello"). +// Instantiate(ctx) +// +// If the same module may be instantiated multiple times, it is more efficient +// to separate steps. Here's an example: +// +// compiled, _ := r.NewHostModuleBuilder("env"). +// NewFunctionBuilder().WithFunc(getRandomString).Export("get_random_string"). +// Compile(ctx) +// +// env1, _ := r.InstantiateModule(ctx, compiled, wazero.NewModuleConfig().WithName("env.1")) +// env2, _ := r.InstantiateModule(ctx, compiled, wazero.NewModuleConfig().WithName("env.2")) +// +// See HostFunctionBuilder for valid host function signatures and other details. +// +// # Notes +// +// - This is an interface for decoupling, not third-party implementations. +// All implementations are in wazero. +// - HostModuleBuilder is mutable: each method returns the same instance for +// chaining. +// - methods do not return errors, to allow chaining. Any validation errors +// are deferred until Compile. +// - Functions are indexed in order of calls to NewFunctionBuilder as +// insertion ordering is needed by ABI such as Emscripten (invoke_*). +type HostModuleBuilder interface { + // Note: until golang/go#5860, we can't use example tests to embed code in interface godocs. + + // NewFunctionBuilder begins the definition of a host function. + NewFunctionBuilder() HostFunctionBuilder + + // Compile returns a CompiledModule that can be instantiated by Runtime. + Compile(context.Context) (CompiledModule, error) + + // Instantiate is a convenience that calls Compile, then Runtime.InstantiateModule. + // This can fail for reasons documented on Runtime.InstantiateModule. + // + // Here's an example: + // + // ctx := context.Background() + // r := wazero.NewRuntime(ctx) + // defer r.Close(ctx) // This closes everything this Runtime created. + // + // hello := func() { + // println("hello!") + // } + // env, _ := r.NewHostModuleBuilder("env"). + // NewFunctionBuilder().WithFunc(hello).Export("hello"). + // Instantiate(ctx) + // + // # Notes + // + // - Closing the Runtime has the same effect as closing the result. + // - Fields in the builder are copied during instantiation: Later changes do not affect the instantiated result. + // - To avoid using configuration defaults, use Compile instead. + Instantiate(context.Context) (api.Module, error) +} + +// hostModuleBuilder implements HostModuleBuilder +type hostModuleBuilder struct { + r *runtime + moduleName string + exportNames []string + nameToHostFunc map[string]*wasm.HostFunc +} + +// NewHostModuleBuilder implements Runtime.NewHostModuleBuilder +func (r *runtime) NewHostModuleBuilder(moduleName string) HostModuleBuilder { + return &hostModuleBuilder{ + r: r, + moduleName: moduleName, + nameToHostFunc: map[string]*wasm.HostFunc{}, + } +} + +// hostFunctionBuilder implements HostFunctionBuilder +type hostFunctionBuilder struct { + b *hostModuleBuilder + fn interface{} + name string + paramNames []string + resultNames []string +} + +// WithGoFunction implements HostFunctionBuilder.WithGoFunction +func (h *hostFunctionBuilder) WithGoFunction(fn api.GoFunction, params, results []api.ValueType) HostFunctionBuilder { + h.fn = &wasm.HostFunc{ParamTypes: params, ResultTypes: results, Code: wasm.Code{GoFunc: fn}} + return h +} + +// WithGoModuleFunction implements HostFunctionBuilder.WithGoModuleFunction +func (h *hostFunctionBuilder) WithGoModuleFunction(fn api.GoModuleFunction, params, results []api.ValueType) HostFunctionBuilder { + h.fn = &wasm.HostFunc{ParamTypes: params, ResultTypes: results, Code: wasm.Code{GoFunc: fn}} + return h +} + +// WithFunc implements HostFunctionBuilder.WithFunc +func (h *hostFunctionBuilder) WithFunc(fn interface{}) HostFunctionBuilder { + h.fn = fn + return h +} + +// WithName implements HostFunctionBuilder.WithName +func (h *hostFunctionBuilder) WithName(name string) HostFunctionBuilder { + h.name = name + return h +} + +// WithParameterNames implements HostFunctionBuilder.WithParameterNames +func (h *hostFunctionBuilder) WithParameterNames(names ...string) HostFunctionBuilder { + h.paramNames = names + return h +} + +// WithResultNames implements HostFunctionBuilder.WithResultNames +func (h *hostFunctionBuilder) WithResultNames(names ...string) HostFunctionBuilder { + h.resultNames = names + return h +} + +// Export implements HostFunctionBuilder.Export +func (h *hostFunctionBuilder) Export(exportName string) HostModuleBuilder { + var hostFn *wasm.HostFunc + if fn, ok := h.fn.(*wasm.HostFunc); ok { + hostFn = fn + } else { + hostFn = &wasm.HostFunc{Code: wasm.Code{GoFunc: h.fn}} + } + + // Assign any names from the builder + hostFn.ExportName = exportName + if h.name != "" { + hostFn.Name = h.name + } + if len(h.paramNames) != 0 { + hostFn.ParamNames = h.paramNames + } + if len(h.resultNames) != 0 { + hostFn.ResultNames = h.resultNames + } + + h.b.ExportHostFunc(hostFn) + return h.b +} + +// ExportHostFunc implements wasm.HostFuncExporter +func (b *hostModuleBuilder) ExportHostFunc(fn *wasm.HostFunc) { + if _, ok := b.nameToHostFunc[fn.ExportName]; !ok { // add a new name + b.exportNames = append(b.exportNames, fn.ExportName) + } + b.nameToHostFunc[fn.ExportName] = fn +} + +// NewFunctionBuilder implements HostModuleBuilder.NewFunctionBuilder +func (b *hostModuleBuilder) NewFunctionBuilder() HostFunctionBuilder { + return &hostFunctionBuilder{b: b} +} + +// Compile implements HostModuleBuilder.Compile +func (b *hostModuleBuilder) Compile(ctx context.Context) (CompiledModule, error) { + module, err := wasm.NewHostModule(b.moduleName, b.exportNames, b.nameToHostFunc, b.r.enabledFeatures) + if err != nil { + return nil, err + } else if err = module.Validate(b.r.enabledFeatures); err != nil { + return nil, err + } + + c := &compiledModule{module: module, compiledEngine: b.r.store.Engine} + listeners, err := buildFunctionListeners(ctx, module) + if err != nil { + return nil, err + } + + if err = b.r.store.Engine.CompileModule(ctx, module, listeners, false); err != nil { + return nil, err + } + + // typeIDs are static and compile-time known. + typeIDs, err := b.r.store.GetFunctionTypeIDs(module.TypeSection) + if err != nil { + return nil, err + } + c.typeIDs = typeIDs + + return c, nil +} + +// Instantiate implements HostModuleBuilder.Instantiate +func (b *hostModuleBuilder) Instantiate(ctx context.Context) (api.Module, error) { + if compiled, err := b.Compile(ctx); err != nil { + return nil, err + } else { + compiled.(*compiledModule).closeWithModule = true + return b.r.InstantiateModule(ctx, compiled, NewModuleConfig()) + } +} diff --git a/vendor/github.com/tetratelabs/wazero/cache.go b/vendor/github.com/tetratelabs/wazero/cache.go new file mode 100644 index 000000000..2d1b4e3b9 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/cache.go @@ -0,0 +1,116 @@ +package wazero + +import ( + "context" + "errors" + "fmt" + "os" + "path" + "path/filepath" + goruntime "runtime" + "sync" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/filecache" + "github.com/tetratelabs/wazero/internal/version" + "github.com/tetratelabs/wazero/internal/wasm" +) + +// CompilationCache reduces time spent compiling (Runtime.CompileModule) the same wasm module. +// +// # Notes +// +// - This is an interface for decoupling, not third-party implementations. +// All implementations are in wazero. +// - Instances of this can be reused across multiple runtimes, if configured +// via RuntimeConfig. +type CompilationCache interface{ api.Closer } + +// NewCompilationCache returns a new CompilationCache to be passed to RuntimeConfig. +// This configures only in-memory cache, and doesn't persist to the file system. See wazero.NewCompilationCacheWithDir for detail. +// +// The returned CompilationCache can be used to share the in-memory compilation results across multiple instances of wazero.Runtime. +func NewCompilationCache() CompilationCache { + return &cache{} +} + +// NewCompilationCacheWithDir is like wazero.NewCompilationCache except the result also writes +// state into the directory specified by `dirname` parameter. +// +// If the dirname doesn't exist, this creates it or returns an error. +// +// Those running wazero as a CLI or frequently restarting a process using the same wasm should +// use this feature to reduce time waiting to compile the same module a second time. +// +// The contents written into dirname are wazero-version specific, meaning different versions of +// wazero will duplicate entries for the same input wasm. +// +// Note: The embedder must safeguard this directory from external changes. +func NewCompilationCacheWithDir(dirname string) (CompilationCache, error) { + c := &cache{} + err := c.ensuresFileCache(dirname, version.GetWazeroVersion()) + return c, err +} + +// cache implements Cache interface. +type cache struct { + // eng is the engine for this cache. If the cache is configured, the engine is shared across multiple instances of + // Runtime, and its lifetime is not bound to them. Instead, the engine is alive until Cache.Close is called. + engs [engineKindCount]wasm.Engine + fileCache filecache.Cache + initOnces [engineKindCount]sync.Once +} + +func (c *cache) initEngine(ek engineKind, ne newEngine, ctx context.Context, features api.CoreFeatures) wasm.Engine { + c.initOnces[ek].Do(func() { c.engs[ek] = ne(ctx, features, c.fileCache) }) + return c.engs[ek] +} + +// Close implements the same method on the Cache interface. +func (c *cache) Close(_ context.Context) (err error) { + for _, eng := range c.engs { + if eng != nil { + if err = eng.Close(); err != nil { + return + } + } + } + return +} + +func (c *cache) ensuresFileCache(dir string, wazeroVersion string) error { + // Resolve a potentially relative directory into an absolute one. + var err error + dir, err = filepath.Abs(dir) + if err != nil { + return err + } + + // Ensure the user-supplied directory. + if err = mkdir(dir); err != nil { + return err + } + + // Create a version-specific directory to avoid conflicts. + dirname := path.Join(dir, "wazero-"+wazeroVersion+"-"+goruntime.GOARCH+"-"+goruntime.GOOS) + if err = mkdir(dirname); err != nil { + return err + } + + c.fileCache = filecache.New(dirname) + return nil +} + +func mkdir(dirname string) error { + if st, err := os.Stat(dirname); errors.Is(err, os.ErrNotExist) { + // If the directory not found, create the cache dir. + if err = os.MkdirAll(dirname, 0o700); err != nil { + return fmt.Errorf("create directory %s: %v", dirname, err) + } + } else if err != nil { + return err + } else if !st.IsDir() { + return fmt.Errorf("%s is not dir", dirname) + } + return nil +} diff --git a/vendor/github.com/tetratelabs/wazero/codecov.yml b/vendor/github.com/tetratelabs/wazero/codecov.yml new file mode 100644 index 000000000..cf9d94df4 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/codecov.yml @@ -0,0 +1,9 @@ +# Codecov for main is visible here https://app.codecov.io/gh/tetratelabs/wazero + +# We use codecov only as a UI, so we disable PR comments and commit status. +# See https://docs.codecov.com/docs/pull-request-comments +comment: false +coverage: + status: + project: off + patch: off diff --git a/vendor/github.com/tetratelabs/wazero/config.go b/vendor/github.com/tetratelabs/wazero/config.go new file mode 100644 index 000000000..00e223031 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/config.go @@ -0,0 +1,882 @@ +package wazero + +import ( + "context" + "errors" + "fmt" + "io" + "io/fs" + "math" + "net" + "time" + + "github.com/tetratelabs/wazero/api" + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/engine/compiler" + "github.com/tetratelabs/wazero/internal/engine/interpreter" + "github.com/tetratelabs/wazero/internal/engine/wazevo" + "github.com/tetratelabs/wazero/internal/filecache" + "github.com/tetratelabs/wazero/internal/internalapi" + "github.com/tetratelabs/wazero/internal/platform" + internalsock "github.com/tetratelabs/wazero/internal/sock" + internalsys "github.com/tetratelabs/wazero/internal/sys" + "github.com/tetratelabs/wazero/internal/wasm" + "github.com/tetratelabs/wazero/sys" +) + +// RuntimeConfig controls runtime behavior, with the default implementation as +// NewRuntimeConfig +// +// The example below explicitly limits to Wasm Core 1.0 features as opposed to +// relying on defaults: +// +// rConfig = wazero.NewRuntimeConfig().WithCoreFeatures(api.CoreFeaturesV1) +// +// # Notes +// +// - This is an interface for decoupling, not third-party implementations. +// All implementations are in wazero. +// - RuntimeConfig is immutable. Each WithXXX function returns a new instance +// including the corresponding change. +type RuntimeConfig interface { + // WithCoreFeatures sets the WebAssembly Core specification features this + // runtime supports. Defaults to api.CoreFeaturesV2. + // + // Example of disabling a specific feature: + // features := api.CoreFeaturesV2.SetEnabled(api.CoreFeatureMutableGlobal, false) + // rConfig = wazero.NewRuntimeConfig().WithCoreFeatures(features) + // + // # Why default to version 2.0? + // + // Many compilers that target WebAssembly require features after + // api.CoreFeaturesV1 by default. For example, TinyGo v0.24+ requires + // api.CoreFeatureBulkMemoryOperations. To avoid runtime errors, wazero + // defaults to api.CoreFeaturesV2, even though it is not yet a Web + // Standard (REC). + WithCoreFeatures(api.CoreFeatures) RuntimeConfig + + // WithMemoryLimitPages overrides the maximum pages allowed per memory. The + // default is 65536, allowing 4GB total memory per instance if the maximum is + // not encoded in a Wasm binary. Setting a value larger than default will panic. + // + // This example reduces the largest possible memory size from 4GB to 128KB: + // rConfig = wazero.NewRuntimeConfig().WithMemoryLimitPages(2) + // + // Note: Wasm has 32-bit memory and each page is 65536 (2^16) bytes. This + // implies a max of 65536 (2^16) addressable pages. + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#grow-mem + WithMemoryLimitPages(memoryLimitPages uint32) RuntimeConfig + + // WithMemoryCapacityFromMax eagerly allocates max memory, unless max is + // not defined. The default is false, which means minimum memory is + // allocated and any call to grow memory results in re-allocations. + // + // This example ensures any memory.grow instruction will never re-allocate: + // rConfig = wazero.NewRuntimeConfig().WithMemoryCapacityFromMax(true) + // + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#grow-mem + // + // Note: if the memory maximum is not encoded in a Wasm binary, this + // results in allocating 4GB. See the doc on WithMemoryLimitPages for detail. + WithMemoryCapacityFromMax(memoryCapacityFromMax bool) RuntimeConfig + + // WithDebugInfoEnabled toggles DWARF based stack traces in the face of + // runtime errors. Defaults to true. + // + // Those who wish to disable this, can like so: + // + // r := wazero.NewRuntimeWithConfig(wazero.NewRuntimeConfig().WithDebugInfoEnabled(false) + // + // When disabled, a stack trace message looks like: + // + // wasm stack trace: + // .runtime._panic(i32) + // .myFunc() + // .main.main() + // .runtime.run() + // ._start() + // + // When enabled, the stack trace includes source code information: + // + // wasm stack trace: + // .runtime._panic(i32) + // 0x16e2: /opt/homebrew/Cellar/tinygo/0.26.0/src/runtime/runtime_tinygowasm.go:73:6 + // .myFunc() + // 0x190b: /Users/XXXXX/wazero/internal/testing/dwarftestdata/testdata/main.go:19:7 + // .main.main() + // 0x18ed: /Users/XXXXX/wazero/internal/testing/dwarftestdata/testdata/main.go:4:3 + // .runtime.run() + // 0x18cc: /opt/homebrew/Cellar/tinygo/0.26.0/src/runtime/scheduler_none.go:26:10 + // ._start() + // 0x18b6: /opt/homebrew/Cellar/tinygo/0.26.0/src/runtime/runtime_wasm_wasi.go:22:5 + // + // Note: This only takes into effect when the original Wasm binary has the + // DWARF "custom sections" that are often stripped, depending on + // optimization flags passed to the compiler. + WithDebugInfoEnabled(bool) RuntimeConfig + + // WithCompilationCache configures how runtime caches the compiled modules. In the default configuration, compilation results are + // only in-memory until Runtime.Close is closed, and not shareable by multiple Runtime. + // + // Below defines the shared cache across multiple instances of Runtime: + // + // // Creates the new Cache and the runtime configuration with it. + // cache := wazero.NewCompilationCache() + // defer cache.Close() + // config := wazero.NewRuntimeConfig().WithCompilationCache(c) + // + // // Creates two runtimes while sharing compilation caches. + // foo := wazero.NewRuntimeWithConfig(context.Background(), config) + // bar := wazero.NewRuntimeWithConfig(context.Background(), config) + // + // # Cache Key + // + // Cached files are keyed on the version of wazero. This is obtained from go.mod of your application, + // and we use it to verify the compatibility of caches against the currently-running wazero. + // However, if you use this in tests of a package not named as `main`, then wazero cannot obtain the correct + // version of wazero due to the known issue of debug.BuildInfo function: https://github.com/golang/go/issues/33976. + // As a consequence, your cache won't contain the correct version information and always be treated as `dev` version. + // To avoid this issue, you can pass -ldflags "-X github.com/tetratelabs/wazero/internal/version.version=foo" when running tests. + WithCompilationCache(CompilationCache) RuntimeConfig + + // WithCustomSections toggles parsing of "custom sections". Defaults to false. + // + // When enabled, it is possible to retrieve custom sections from a CompiledModule: + // + // config := wazero.NewRuntimeConfig().WithCustomSections(true) + // r := wazero.NewRuntimeWithConfig(ctx, config) + // c, err := r.CompileModule(ctx, wasm) + // customSections := c.CustomSections() + WithCustomSections(bool) RuntimeConfig + + // WithCloseOnContextDone ensures the executions of functions to be closed under one of the following circumstances: + // + // - context.Context passed to the Call method of api.Function is canceled during execution. (i.e. ctx by context.WithCancel) + // - context.Context passed to the Call method of api.Function reaches timeout during execution. (i.e. ctx by context.WithTimeout or context.WithDeadline) + // - Close or CloseWithExitCode of api.Module is explicitly called during execution. + // + // This is especially useful when one wants to run untrusted Wasm binaries since otherwise, any invocation of + // api.Function can potentially block the corresponding Goroutine forever. Moreover, it might block the + // entire underlying OS thread which runs the api.Function call. See "Why it's safe to execute runtime-generated + // machine codes against async Goroutine preemption" section in internal/engine/compiler/RATIONALE.md for detail. + // + // Note that this comes with a bit of extra cost when enabled. The reason is that internally this forces + // interpreter and compiler runtimes to insert the periodical checks on the conditions above. For that reason, + // this is disabled by default. + // + // See examples in context_done_example_test.go for the end-to-end demonstrations. + // + // When the invocations of api.Function are closed due to this, sys.ExitError is raised to the callers and + // the api.Module from which the functions are derived is made closed. + WithCloseOnContextDone(bool) RuntimeConfig +} + +// NewRuntimeConfig returns a RuntimeConfig using the compiler if it is supported in this environment, +// or the interpreter otherwise. +func NewRuntimeConfig() RuntimeConfig { + return newRuntimeConfig() +} + +type newEngine func(context.Context, api.CoreFeatures, filecache.Cache) wasm.Engine + +type runtimeConfig struct { + enabledFeatures api.CoreFeatures + memoryLimitPages uint32 + memoryCapacityFromMax bool + engineKind engineKind + dwarfDisabled bool // negative as defaults to enabled + newEngine newEngine + cache CompilationCache + storeCustomSections bool + ensureTermination bool +} + +// EnableOptimizingCompiler implements experimental/opt/enabler.EnableOptimizingCompiler. +func (c *runtimeConfig) EnableOptimizingCompiler() { + c.newEngine = wazevo.NewEngine +} + +// engineLessConfig helps avoid copy/pasting the wrong defaults. +var engineLessConfig = &runtimeConfig{ + enabledFeatures: api.CoreFeaturesV2, + memoryLimitPages: wasm.MemoryLimitPages, + memoryCapacityFromMax: false, + dwarfDisabled: false, +} + +type engineKind int + +const ( + engineKindCompiler engineKind = iota + engineKindInterpreter + engineKindCount +) + +// NewRuntimeConfigCompiler compiles WebAssembly modules into +// runtime.GOARCH-specific assembly for optimal performance. +// +// The default implementation is AOT (Ahead of Time) compilation, applied at +// Runtime.CompileModule. This allows consistent runtime performance, as well +// the ability to reduce any first request penalty. +// +// Note: While this is technically AOT, this does not imply any action on your +// part. wazero automatically performs ahead-of-time compilation as needed when +// Runtime.CompileModule is invoked. +// +// Warning: This panics at runtime if the runtime.GOOS or runtime.GOARCH does not +// support Compiler. Use NewRuntimeConfig to safely detect and fallback to +// NewRuntimeConfigInterpreter if needed. +func NewRuntimeConfigCompiler() RuntimeConfig { + ret := engineLessConfig.clone() + ret.engineKind = engineKindCompiler + ret.newEngine = compiler.NewEngine + return ret +} + +// NewRuntimeConfigInterpreter interprets WebAssembly modules instead of compiling them into assembly. +func NewRuntimeConfigInterpreter() RuntimeConfig { + ret := engineLessConfig.clone() + ret.engineKind = engineKindInterpreter + ret.newEngine = interpreter.NewEngine + return ret +} + +// clone makes a deep copy of this runtime config. +func (c *runtimeConfig) clone() *runtimeConfig { + ret := *c // copy except maps which share a ref + return &ret +} + +// WithCoreFeatures implements RuntimeConfig.WithCoreFeatures +func (c *runtimeConfig) WithCoreFeatures(features api.CoreFeatures) RuntimeConfig { + ret := c.clone() + ret.enabledFeatures = features + return ret +} + +// WithCloseOnContextDone implements RuntimeConfig.WithCloseOnContextDone +func (c *runtimeConfig) WithCloseOnContextDone(ensure bool) RuntimeConfig { + ret := c.clone() + ret.ensureTermination = ensure + return ret +} + +// WithMemoryLimitPages implements RuntimeConfig.WithMemoryLimitPages +func (c *runtimeConfig) WithMemoryLimitPages(memoryLimitPages uint32) RuntimeConfig { + ret := c.clone() + // This panics instead of returning an error as it is unlikely. + if memoryLimitPages > wasm.MemoryLimitPages { + panic(fmt.Errorf("memoryLimitPages invalid: %d > %d", memoryLimitPages, wasm.MemoryLimitPages)) + } + ret.memoryLimitPages = memoryLimitPages + return ret +} + +// WithCompilationCache implements RuntimeConfig.WithCompilationCache +func (c *runtimeConfig) WithCompilationCache(ca CompilationCache) RuntimeConfig { + ret := c.clone() + ret.cache = ca + return ret +} + +// WithMemoryCapacityFromMax implements RuntimeConfig.WithMemoryCapacityFromMax +func (c *runtimeConfig) WithMemoryCapacityFromMax(memoryCapacityFromMax bool) RuntimeConfig { + ret := c.clone() + ret.memoryCapacityFromMax = memoryCapacityFromMax + return ret +} + +// WithDebugInfoEnabled implements RuntimeConfig.WithDebugInfoEnabled +func (c *runtimeConfig) WithDebugInfoEnabled(dwarfEnabled bool) RuntimeConfig { + ret := c.clone() + ret.dwarfDisabled = !dwarfEnabled + return ret +} + +// WithCustomSections implements RuntimeConfig.WithCustomSections +func (c *runtimeConfig) WithCustomSections(storeCustomSections bool) RuntimeConfig { + ret := c.clone() + ret.storeCustomSections = storeCustomSections + return ret +} + +// CompiledModule is a WebAssembly module ready to be instantiated (Runtime.InstantiateModule) as an api.Module. +// +// In WebAssembly terminology, this is a decoded, validated, and possibly also compiled module. wazero avoids using +// the name "Module" for both before and after instantiation as the name conflation has caused confusion. +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#semantic-phases%E2%91%A0 +// +// # Notes +// +// - This is an interface for decoupling, not third-party implementations. +// All implementations are in wazero. +// - Closing the wazero.Runtime closes any CompiledModule it compiled. +type CompiledModule interface { + // Name returns the module name encoded into the binary or empty if not. + Name() string + + // ImportedFunctions returns all the imported functions + // (api.FunctionDefinition) in this module or nil if there are none. + // + // Note: Unlike ExportedFunctions, there is no unique constraint on + // imports. + ImportedFunctions() []api.FunctionDefinition + + // ExportedFunctions returns all the exported functions + // (api.FunctionDefinition) in this module keyed on export name. + ExportedFunctions() map[string]api.FunctionDefinition + + // ImportedMemories returns all the imported memories + // (api.MemoryDefinition) in this module or nil if there are none. + // + // ## Notes + // - As of WebAssembly Core Specification 2.0, there can be at most one + // memory. + // - Unlike ExportedMemories, there is no unique constraint on imports. + ImportedMemories() []api.MemoryDefinition + + // ExportedMemories returns all the exported memories + // (api.MemoryDefinition) in this module keyed on export name. + // + // Note: As of WebAssembly Core Specification 2.0, there can be at most one + // memory. + ExportedMemories() map[string]api.MemoryDefinition + + // CustomSections returns all the custom sections + // (api.CustomSection) in this module keyed on the section name. + CustomSections() []api.CustomSection + + // Close releases all the allocated resources for this CompiledModule. + // + // Note: It is safe to call Close while having outstanding calls from an + // api.Module instantiated from this. + Close(context.Context) error +} + +// compile-time check to ensure compiledModule implements CompiledModule +var _ CompiledModule = &compiledModule{} + +type compiledModule struct { + module *wasm.Module + // compiledEngine holds an engine on which `module` is compiled. + compiledEngine wasm.Engine + // closeWithModule prevents leaking compiled code when a module is compiled implicitly. + closeWithModule bool + typeIDs []wasm.FunctionTypeID +} + +// Name implements CompiledModule.Name +func (c *compiledModule) Name() (moduleName string) { + if ns := c.module.NameSection; ns != nil { + moduleName = ns.ModuleName + } + return +} + +// Close implements CompiledModule.Close +func (c *compiledModule) Close(context.Context) error { + c.compiledEngine.DeleteCompiledModule(c.module) + // It is possible the underlying may need to return an error later, but in any case this matches api.Module.Close. + return nil +} + +// ImportedFunctions implements CompiledModule.ImportedFunctions +func (c *compiledModule) ImportedFunctions() []api.FunctionDefinition { + return c.module.ImportedFunctions() +} + +// ExportedFunctions implements CompiledModule.ExportedFunctions +func (c *compiledModule) ExportedFunctions() map[string]api.FunctionDefinition { + return c.module.ExportedFunctions() +} + +// ImportedMemories implements CompiledModule.ImportedMemories +func (c *compiledModule) ImportedMemories() []api.MemoryDefinition { + return c.module.ImportedMemories() +} + +// ExportedMemories implements CompiledModule.ExportedMemories +func (c *compiledModule) ExportedMemories() map[string]api.MemoryDefinition { + return c.module.ExportedMemories() +} + +// CustomSections implements CompiledModule.CustomSections +func (c *compiledModule) CustomSections() []api.CustomSection { + ret := make([]api.CustomSection, len(c.module.CustomSections)) + for i, d := range c.module.CustomSections { + ret[i] = &customSection{data: d.Data, name: d.Name} + } + return ret +} + +// customSection implements wasm.CustomSection +type customSection struct { + internalapi.WazeroOnlyType + name string + data []byte +} + +// Name implements wasm.CustomSection.Name +func (c *customSection) Name() string { + return c.name +} + +// Data implements wasm.CustomSection.Data +func (c *customSection) Data() []byte { + return c.data +} + +// ModuleConfig configures resources needed by functions that have low-level interactions with the host operating +// system. Using this, resources such as STDIN can be isolated, so that the same module can be safely instantiated +// multiple times. +// +// Here's an example: +// +// // Initialize base configuration: +// config := wazero.NewModuleConfig().WithStdout(buf).WithSysNanotime() +// +// // Assign different configuration on each instantiation +// mod, _ := r.InstantiateModule(ctx, compiled, config.WithName("rotate").WithArgs("rotate", "angle=90", "dir=cw")) +// +// While wazero supports Windows as a platform, host functions using ModuleConfig follow a UNIX dialect. +// See RATIONALE.md for design background and relationship to WebAssembly System Interfaces (WASI). +// +// # Notes +// +// - This is an interface for decoupling, not third-party implementations. +// All implementations are in wazero. +// - ModuleConfig is immutable. Each WithXXX function returns a new instance +// including the corresponding change. +type ModuleConfig interface { + // WithArgs assigns command-line arguments visible to an imported function that reads an arg vector (argv). Defaults to + // none. Runtime.InstantiateModule errs if any arg is empty. + // + // These values are commonly read by the functions like "args_get" in "wasi_snapshot_preview1" although they could be + // read by functions imported from other modules. + // + // Similar to os.Args and exec.Cmd Env, many implementations would expect a program name to be argv[0]. However, neither + // WebAssembly nor WebAssembly System Interfaces (WASI) define this. Regardless, you may choose to set the first + // argument to the same value set via WithName. + // + // Note: This does not default to os.Args as that violates sandboxing. + // + // See https://linux.die.net/man/3/argv and https://en.wikipedia.org/wiki/Null-terminated_string + WithArgs(...string) ModuleConfig + + // WithEnv sets an environment variable visible to a Module that imports functions. Defaults to none. + // Runtime.InstantiateModule errs if the key is empty or contains a NULL(0) or equals("") character. + // + // Validation is the same as os.Setenv on Linux and replaces any existing value. Unlike exec.Cmd Env, this does not + // default to the current process environment as that would violate sandboxing. This also does not preserve order. + // + // Environment variables are commonly read by the functions like "environ_get" in "wasi_snapshot_preview1" although + // they could be read by functions imported from other modules. + // + // While similar to process configuration, there are no assumptions that can be made about anything OS-specific. For + // example, neither WebAssembly nor WebAssembly System Interfaces (WASI) define concerns processes have, such as + // case-sensitivity on environment keys. For portability, define entries with case-insensitively unique keys. + // + // See https://linux.die.net/man/3/environ and https://en.wikipedia.org/wiki/Null-terminated_string + WithEnv(key, value string) ModuleConfig + + // WithFS is a convenience that calls WithFSConfig with an FSConfig of the + // input for the root ("/") guest path. + WithFS(fs.FS) ModuleConfig + + // WithFSConfig configures the filesystem available to each guest + // instantiated with this configuration. By default, no file access is + // allowed, so functions like `path_open` result in unsupported errors + // (e.g. syscall.ENOSYS). + WithFSConfig(FSConfig) ModuleConfig + + // WithName configures the module name. Defaults to what was decoded from + // the name section. Empty string ("") clears any name. + WithName(string) ModuleConfig + + // WithStartFunctions configures the functions to call after the module is + // instantiated. Defaults to "_start". + // + // Clearing the default is supported, via `WithStartFunctions()`. + // + // # Notes + // + // - If a start function doesn't exist, it is skipped. However, any that + // do exist are called in order. + // - Start functions are not intended to be called multiple times. + // Functions that should be called multiple times should be invoked + // manually via api.Module's `ExportedFunction` method. + // - Start functions commonly exit the module during instantiation, + // preventing use of any functions later. This is the case in "wasip1", + // which defines the default value "_start". + // - See /RATIONALE.md for motivation of this feature. + WithStartFunctions(...string) ModuleConfig + + // WithStderr configures where standard error (file descriptor 2) is written. Defaults to io.Discard. + // + // This writer is most commonly used by the functions like "fd_write" in "wasi_snapshot_preview1" although it could + // be used by functions imported from other modules. + // + // # Notes + // + // - The caller is responsible to close any io.Writer they supply: It is not closed on api.Module Close. + // - This does not default to os.Stderr as that both violates sandboxing and prevents concurrent modules. + // + // See https://linux.die.net/man/3/stderr + WithStderr(io.Writer) ModuleConfig + + // WithStdin configures where standard input (file descriptor 0) is read. Defaults to return io.EOF. + // + // This reader is most commonly used by the functions like "fd_read" in "wasi_snapshot_preview1" although it could + // be used by functions imported from other modules. + // + // # Notes + // + // - The caller is responsible to close any io.Reader they supply: It is not closed on api.Module Close. + // - This does not default to os.Stdin as that both violates sandboxing and prevents concurrent modules. + // + // See https://linux.die.net/man/3/stdin + WithStdin(io.Reader) ModuleConfig + + // WithStdout configures where standard output (file descriptor 1) is written. Defaults to io.Discard. + // + // This writer is most commonly used by the functions like "fd_write" in "wasi_snapshot_preview1" although it could + // be used by functions imported from other modules. + // + // # Notes + // + // - The caller is responsible to close any io.Writer they supply: It is not closed on api.Module Close. + // - This does not default to os.Stdout as that both violates sandboxing and prevents concurrent modules. + // + // See https://linux.die.net/man/3/stdout + WithStdout(io.Writer) ModuleConfig + + // WithWalltime configures the wall clock, sometimes referred to as the + // real time clock. sys.Walltime returns the current unix/epoch time, + // seconds since midnight UTC 1 January 1970, with a nanosecond fraction. + // This defaults to a fake result that increases by 1ms on each reading. + // + // Here's an example that uses a custom clock: + // moduleConfig = moduleConfig. + // WithWalltime(func(context.Context) (sec int64, nsec int32) { + // return clock.walltime() + // }, sys.ClockResolution(time.Microsecond.Nanoseconds())) + // + // # Notes: + // - This does not default to time.Now as that violates sandboxing. + // - This is used to implement host functions such as WASI + // `clock_time_get` with the `realtime` clock ID. + // - Use WithSysWalltime for a usable implementation. + WithWalltime(sys.Walltime, sys.ClockResolution) ModuleConfig + + // WithSysWalltime uses time.Now for sys.Walltime with a resolution of 1us + // (1000ns). + // + // See WithWalltime + WithSysWalltime() ModuleConfig + + // WithNanotime configures the monotonic clock, used to measure elapsed + // time in nanoseconds. Defaults to a fake result that increases by 1ms + // on each reading. + // + // Here's an example that uses a custom clock: + // moduleConfig = moduleConfig. + // WithNanotime(func(context.Context) int64 { + // return clock.nanotime() + // }, sys.ClockResolution(time.Microsecond.Nanoseconds())) + // + // # Notes: + // - This does not default to time.Since as that violates sandboxing. + // - This is used to implement host functions such as WASI + // `clock_time_get` with the `monotonic` clock ID. + // - Some compilers implement sleep by looping on sys.Nanotime (e.g. Go). + // - If you set this, you should probably set WithNanosleep also. + // - Use WithSysNanotime for a usable implementation. + WithNanotime(sys.Nanotime, sys.ClockResolution) ModuleConfig + + // WithSysNanotime uses time.Now for sys.Nanotime with a resolution of 1us. + // + // See WithNanotime + WithSysNanotime() ModuleConfig + + // WithNanosleep configures the how to pause the current goroutine for at + // least the configured nanoseconds. Defaults to return immediately. + // + // This example uses a custom sleep function: + // moduleConfig = moduleConfig. + // WithNanosleep(func(ns int64) { + // rel := unix.NsecToTimespec(ns) + // remain := unix.Timespec{} + // for { // loop until no more time remaining + // err := unix.ClockNanosleep(unix.CLOCK_MONOTONIC, 0, &rel, &remain) + // --snip-- + // + // # Notes: + // - This does not default to time.Sleep as that violates sandboxing. + // - This is used to implement host functions such as WASI `poll_oneoff`. + // - Some compilers implement sleep by looping on sys.Nanotime (e.g. Go). + // - If you set this, you should probably set WithNanotime also. + // - Use WithSysNanosleep for a usable implementation. + WithNanosleep(sys.Nanosleep) ModuleConfig + + // WithOsyield yields the processor, typically to implement spin-wait + // loops. Defaults to return immediately. + // + // # Notes: + // - This primarily supports `sched_yield` in WASI + // - This does not default to runtime.osyield as that violates sandboxing. + WithOsyield(sys.Osyield) ModuleConfig + + // WithSysNanosleep uses time.Sleep for sys.Nanosleep. + // + // See WithNanosleep + WithSysNanosleep() ModuleConfig + + // WithRandSource configures a source of random bytes. Defaults to return a + // deterministic source. You might override this with crypto/rand.Reader + // + // This reader is most commonly used by the functions like "random_get" in + // "wasi_snapshot_preview1", "seed" in AssemblyScript standard "env", and + // "getRandomData" when runtime.GOOS is "js". + // + // Note: The caller is responsible to close any io.Reader they supply: It + // is not closed on api.Module Close. + WithRandSource(io.Reader) ModuleConfig +} + +type moduleConfig struct { + name string + nameSet bool + startFunctions []string + stdin io.Reader + stdout io.Writer + stderr io.Writer + randSource io.Reader + walltime sys.Walltime + walltimeResolution sys.ClockResolution + nanotime sys.Nanotime + nanotimeResolution sys.ClockResolution + nanosleep sys.Nanosleep + osyield sys.Osyield + args [][]byte + // environ is pair-indexed to retain order similar to os.Environ. + environ [][]byte + // environKeys allow overwriting of existing values. + environKeys map[string]int + // fsConfig is the file system configuration for ABI like WASI. + fsConfig FSConfig + // sockConfig is the network listener configuration for ABI like WASI. + sockConfig *internalsock.Config +} + +// NewModuleConfig returns a ModuleConfig that can be used for configuring module instantiation. +func NewModuleConfig() ModuleConfig { + return &moduleConfig{ + startFunctions: []string{"_start"}, + environKeys: map[string]int{}, + } +} + +// clone makes a deep copy of this module config. +func (c *moduleConfig) clone() *moduleConfig { + ret := *c // copy except maps which share a ref + ret.environKeys = make(map[string]int, len(c.environKeys)) + for key, value := range c.environKeys { + ret.environKeys[key] = value + } + return &ret +} + +// WithArgs implements ModuleConfig.WithArgs +func (c *moduleConfig) WithArgs(args ...string) ModuleConfig { + ret := c.clone() + ret.args = toByteSlices(args) + return ret +} + +func toByteSlices(strings []string) (result [][]byte) { + if len(strings) == 0 { + return + } + result = make([][]byte, len(strings)) + for i, a := range strings { + result[i] = []byte(a) + } + return +} + +// WithEnv implements ModuleConfig.WithEnv +func (c *moduleConfig) WithEnv(key, value string) ModuleConfig { + ret := c.clone() + // Check to see if this key already exists and update it. + if i, ok := ret.environKeys[key]; ok { + ret.environ[i+1] = []byte(value) // environ is pair-indexed, so the value is 1 after the key. + } else { + ret.environKeys[key] = len(ret.environ) + ret.environ = append(ret.environ, []byte(key), []byte(value)) + } + return ret +} + +// WithFS implements ModuleConfig.WithFS +func (c *moduleConfig) WithFS(fs fs.FS) ModuleConfig { + var config FSConfig + if fs != nil { + config = NewFSConfig().WithFSMount(fs, "") + } + return c.WithFSConfig(config) +} + +// WithFSConfig implements ModuleConfig.WithFSConfig +func (c *moduleConfig) WithFSConfig(config FSConfig) ModuleConfig { + ret := c.clone() + ret.fsConfig = config + return ret +} + +// WithName implements ModuleConfig.WithName +func (c *moduleConfig) WithName(name string) ModuleConfig { + ret := c.clone() + ret.nameSet = true + ret.name = name + return ret +} + +// WithStartFunctions implements ModuleConfig.WithStartFunctions +func (c *moduleConfig) WithStartFunctions(startFunctions ...string) ModuleConfig { + ret := c.clone() + ret.startFunctions = startFunctions + return ret +} + +// WithStderr implements ModuleConfig.WithStderr +func (c *moduleConfig) WithStderr(stderr io.Writer) ModuleConfig { + ret := c.clone() + ret.stderr = stderr + return ret +} + +// WithStdin implements ModuleConfig.WithStdin +func (c *moduleConfig) WithStdin(stdin io.Reader) ModuleConfig { + ret := c.clone() + ret.stdin = stdin + return ret +} + +// WithStdout implements ModuleConfig.WithStdout +func (c *moduleConfig) WithStdout(stdout io.Writer) ModuleConfig { + ret := c.clone() + ret.stdout = stdout + return ret +} + +// WithWalltime implements ModuleConfig.WithWalltime +func (c *moduleConfig) WithWalltime(walltime sys.Walltime, resolution sys.ClockResolution) ModuleConfig { + ret := c.clone() + ret.walltime = walltime + ret.walltimeResolution = resolution + return ret +} + +// We choose arbitrary resolutions here because there's no perfect alternative. For example, according to the +// source in time.go, windows monotonic resolution can be 15ms. This chooses arbitrarily 1us for wall time and +// 1ns for monotonic. See RATIONALE.md for more context. + +// WithSysWalltime implements ModuleConfig.WithSysWalltime +func (c *moduleConfig) WithSysWalltime() ModuleConfig { + return c.WithWalltime(platform.Walltime, sys.ClockResolution(time.Microsecond.Nanoseconds())) +} + +// WithNanotime implements ModuleConfig.WithNanotime +func (c *moduleConfig) WithNanotime(nanotime sys.Nanotime, resolution sys.ClockResolution) ModuleConfig { + ret := c.clone() + ret.nanotime = nanotime + ret.nanotimeResolution = resolution + return ret +} + +// WithSysNanotime implements ModuleConfig.WithSysNanotime +func (c *moduleConfig) WithSysNanotime() ModuleConfig { + return c.WithNanotime(platform.Nanotime, sys.ClockResolution(1)) +} + +// WithNanosleep implements ModuleConfig.WithNanosleep +func (c *moduleConfig) WithNanosleep(nanosleep sys.Nanosleep) ModuleConfig { + ret := *c // copy + ret.nanosleep = nanosleep + return &ret +} + +// WithOsyield implements ModuleConfig.WithOsyield +func (c *moduleConfig) WithOsyield(osyield sys.Osyield) ModuleConfig { + ret := *c // copy + ret.osyield = osyield + return &ret +} + +// WithSysNanosleep implements ModuleConfig.WithSysNanosleep +func (c *moduleConfig) WithSysNanosleep() ModuleConfig { + return c.WithNanosleep(platform.Nanosleep) +} + +// WithRandSource implements ModuleConfig.WithRandSource +func (c *moduleConfig) WithRandSource(source io.Reader) ModuleConfig { + ret := c.clone() + ret.randSource = source + return ret +} + +// toSysContext creates a baseline wasm.Context configured by ModuleConfig. +func (c *moduleConfig) toSysContext() (sysCtx *internalsys.Context, err error) { + var environ [][]byte // Intentionally doesn't pre-allocate to reduce logic to default to nil. + // Same validation as syscall.Setenv for Linux + for i := 0; i < len(c.environ); i += 2 { + key, value := c.environ[i], c.environ[i+1] + keyLen := len(key) + if keyLen == 0 { + err = errors.New("environ invalid: empty key") + return + } + valueLen := len(value) + result := make([]byte, keyLen+valueLen+1) + j := 0 + for ; j < keyLen; j++ { + if k := key[j]; k == '=' { // NUL enforced in NewContext + err = errors.New("environ invalid: key contains '=' character") + return + } else { + result[j] = k + } + } + result[j] = '=' + copy(result[j+1:], value) + environ = append(environ, result) + } + + var fs []experimentalsys.FS + var guestPaths []string + if f, ok := c.fsConfig.(*fsConfig); ok { + fs, guestPaths = f.preopens() + } + + var listeners []*net.TCPListener + if n := c.sockConfig; n != nil { + if listeners, err = n.BuildTCPListeners(); err != nil { + return + } + } + + return internalsys.NewContext( + math.MaxUint32, + c.args, + environ, + c.stdin, + c.stdout, + c.stderr, + c.randSource, + c.walltime, c.walltimeResolution, + c.nanotime, c.nanotimeResolution, + c.nanosleep, c.osyield, + fs, guestPaths, + listeners, + ) +} diff --git a/vendor/github.com/tetratelabs/wazero/config_supported.go b/vendor/github.com/tetratelabs/wazero/config_supported.go new file mode 100644 index 000000000..eb31ab935 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/config_supported.go @@ -0,0 +1,14 @@ +// Note: The build constraints here are about the compiler, which is more +// narrow than the architectures supported by the assembler. +// +// Constraints here must match platform.CompilerSupported. +// +// Meanwhile, users who know their runtime.GOOS can operate with the compiler +// may choose to use NewRuntimeConfigCompiler explicitly. +//go:build (amd64 || arm64) && (darwin || linux || freebsd || windows) + +package wazero + +func newRuntimeConfig() RuntimeConfig { + return NewRuntimeConfigCompiler() +} diff --git a/vendor/github.com/tetratelabs/wazero/config_unsupported.go b/vendor/github.com/tetratelabs/wazero/config_unsupported.go new file mode 100644 index 000000000..3e5a53cda --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/config_unsupported.go @@ -0,0 +1,8 @@ +// This is the opposite constraint of config_supported.go +//go:build !(amd64 || arm64) || !(darwin || linux || freebsd || windows) + +package wazero + +func newRuntimeConfig() RuntimeConfig { + return NewRuntimeConfigInterpreter() +} diff --git a/vendor/github.com/tetratelabs/wazero/examples/basic/testdata/add.wasm b/vendor/github.com/tetratelabs/wazero/examples/basic/testdata/add.wasm new file mode 100644 index 0000000000000000000000000000000000000000..259ca4f00afac1d80527d7efd4694337a266b4fe GIT binary patch literal 6093 zcmbtYU1%KF6~6b*?9A@Yt~9n~dn3vA-HA%&x{@W?S;Zzax^85-ab1Td4}})w(e6mv zAMLJoM{-O9YsV?L5NK%f;6fkz&_W(k$U_RDc6-roJ-R%fU9YWP?$zUnG3&@-#)Ks-p0P6A;g%4YjKyuv zZCfzgwe1Y=a?8RT6Hb;7xVn1P_S~mjXDiz3^sWfzY=x~>r^@!)>%AyqV@}nKOKvYR zy~mu@ejN5n{xjs(4B zL)A=`b|r&qnC5v*UAtzhy}r%7{Y-sw)m8_52Oe?XQF-5GB=LGGF+*_ zDED1$jkXgoXgj?P0`1l{ds?u7t1s9Edx?f5*$6~MkfPhy?1p5g;X70R=G!X2g2^w~ z$~G`jZ$p^m6jyJ-1g>7YZu@MUlqiOIZ`AWG=Ka&=?m#kHapSr@>Z#9Pw&^))LF=zy zTC|w@5;J%(bB5Cdb{lOdd$*iXw_er;+GWd1fE7#9lJ*K*6J-v>6)$swTnaLAL}gqT7(TOSSKx`2wE(iRC~T$WEP?<5)GR?( zW|~MG?vEgTnWjQ60QDrmlG75d1l}e-A(!B)9TNZ`qyj7McuWc~=zT=9NI3zMT)hQ? zjZEi&kD$23IaLBC`9*{o)L=w%L7Ki*go*^(i@LAzwRZzy+*+nde@{9DTzaC2v>oQS zcbFwAFp01tr0D2??ka2B`x^GYPapvN6n85XOXKdHbz?Uk>DCUkP6(#smbBdX&_SJ_%jB|&0z~P`t?H;zG`utb0^&qkJM6xCc za6njm{tB}D1J-T^6eCJEOeU118Y&Yi119K&NhwTtg^7muDhGoQcZo0}?ucMTj3xE2 zY*B~YZx8`+9#(`8R2c%#6gx*%K{7u}<-UY2nn{|eh^%R_Hi3nj0yGsGs2%%sfhBFU zp=@AZq@|zHHoZfnrRC~<&13bhZm^H=4|&V*2iE%9+Qbyd-lKfKDLte?>-P^(f%35l zGXEy3`N99W&4l+4!SnZ_Qfi!Gbh2=2d?<7(!cJk*9mx$wHZ>0zuV6gtM`;&{0Td_7 zt|B*uKUoG#DVqo%0!_mtP&!eXEd9z-SyS5#96?rExMeheWRNl8zCOX|}q?i_2R9AHUQPf?cl?KX$-Svq=g3}AnBOQfMmpIP(9%@)=rB;;1ZiNn$4gqcBN^bCS65TGp{^g4rMs^^;wxC znrq2YP^buL`jbJnBBo?^xk$L@r7H_Edza!uqT)d}#e%Lu$VA-eH927<=t*u&8?q93 zBVwHBh**&akn7(Ls%BaOC`i*YUy@|}n z1J^6y1ZTCvGE_(Sr~7?}blVaK^- z1xB#o+aQ)pWo*Id2l z_i%dCA1&F7P+}3QFikvxJwKp*XeIiW@DdWPEMC-?AY5dK!URvk2kExpX+>=6>n*OF zW?|PfSGj3hv`MrHMtXEt zw~-5EQGiuBom6IRt|DIH$PuX1iyzoW22gW@Y{TNI0NME}vWj3Zf|6llWEj>%z=jQZ zB%42x-2BN}a6;0;*GLNnQvvpTgUcM9LSU3$j`;$;Br|iQ;gHTj1YR?Wn1lXNVJ|{N z_X>+xfgTc!*rO#&6yK8RPZHBnqs{)HuQdHBQy_HEZjwn@@^fk-{tId$`b%m-u{WuO zUy}5`l?-$`z0E03`sPEHYu|AXh2>@Z5k@9bNrcLGAb4+01Z9Y#4xR#@Y*HV=iw{Y^ zOFR9JdNAXCYQgRIsD(N2;usm0P_blQew+w@k_df78)oV64Q={;#kE)we0@!j}t4Dk>gejlVuz+A;2n%mJtQLWzJ&Lkomh6(rTJFY4cqnVX_+*=opxN`ie%L5b$X{| zyWUFm%UaZn*73BfQN3M@UX+QNUfAA<`mK63x^IS2`S<2Oc$u@?*q8pj!8xNb{j>2D z@R-rvRdrXL6Sa0b>#+dE-PjHEJ~VSn?)g0(Llw>q8XPWL(T z&pwb&Cas=Tab|BiuN}~{&QL+O2W0y(emC6FRIs}fS2x36wwO-n&xyG`>2NFTHNV^G z#Qpri>2z+RdIldOn@4By#W9Y&@rPf~sd{^{e# zH|p``&f09XvvoY`<4bqHUtd4oYVB^#V09y^#xk5+tcL5g@YMXtx$0W&RCHo-;lvZw z`6m_@)=n-|7EdlL%-0selSiEw>g_8l9cONK;mO%~_MK6Dyxxf7)%7Thcc9rmHoCPF yhik29W~0?v3tRnT``Vp$+zY#15O`+28&jb;=B@3tnlmQ%k7fJyjrL6RV*DQ!u2SIu literal 0 HcmV?d00001 diff --git a/vendor/github.com/tetratelabs/wazero/experimental/close.go b/vendor/github.com/tetratelabs/wazero/experimental/close.go new file mode 100644 index 000000000..1c37e8c03 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/experimental/close.go @@ -0,0 +1,63 @@ +package experimental + +import ( + "context" + + "github.com/tetratelabs/wazero/internal/close" +) + +// CloseNotifier is a notification hook, invoked when a module is closed. +// +// Note: This is experimental progress towards #1197, and likely to change. Do +// not expose this in shared libraries as it can cause version locks. +type CloseNotifier interface { + // CloseNotify is a notification that occurs *before* an api.Module is + // closed. `exitCode` is zero on success or in the case there was no exit + // code. + // + // Notes: + // - This does not return an error because the module will be closed + // unconditionally. + // - Do not panic from this function as it doing so could cause resource + // leaks. + // - While this is only called once per module, if configured for + // multiple modules, it will be called for each, e.g. on runtime close. + CloseNotify(ctx context.Context, exitCode uint32) +} + +// ^-- Note: This might need to be a part of the listener or become a part of +// host state implementation. For example, if this is used to implement state +// cleanup for host modules, possibly something like below would be better, as +// it could be implemented in a way that allows concurrent module use. +// +// // key is like a context key, stateFactory is invoked per instantiate and +// // is associated with the key (exposed as `Module.State` similar to go +// // context). Using a key is better than the module name because we can +// // de-dupe it for host modules that can be instantiated into different +// // names. Also, you can make the key package private. +// HostModuleBuilder.WithState(key any, stateFactory func() Cleanup)` +// +// Such a design could work to isolate state only needed for wasip1, for +// example the dirent cache. However, if end users use this for different +// things, we may need separate designs. +// +// In summary, the purpose of this iteration is to identify projects that +// would use something like this, and then we can figure out which way it +// should go. + +// CloseNotifyFunc is a convenience for defining inlining a CloseNotifier. +type CloseNotifyFunc func(ctx context.Context, exitCode uint32) + +// CloseNotify implements CloseNotifier.CloseNotify. +func (f CloseNotifyFunc) CloseNotify(ctx context.Context, exitCode uint32) { + f(ctx, exitCode) +} + +// WithCloseNotifier registers the given CloseNotifier into the given +// context.Context. +func WithCloseNotifier(ctx context.Context, notifier CloseNotifier) context.Context { + if notifier != nil { + return context.WithValue(ctx, close.NotifierKey{}, notifier) + } + return ctx +} diff --git a/vendor/github.com/tetratelabs/wazero/experimental/experimental.go b/vendor/github.com/tetratelabs/wazero/experimental/experimental.go new file mode 100644 index 000000000..63fd564da --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/experimental/experimental.go @@ -0,0 +1,41 @@ +// Package experimental includes features we aren't yet sure about. These are enabled with context.Context keys. +// +// Note: All features here may be changed or deleted at any time, so use with caution! +package experimental + +import ( + "github.com/tetratelabs/wazero/api" +) + +// InternalModule is an api.Module that exposes additional +// information. +type InternalModule interface { + api.Module + + // NumGlobal returns the count of all globals in the module. + NumGlobal() int + + // Global provides a read-only view for a given global index. + // + // The methods panics if i is out of bounds. + Global(i int) api.Global +} + +// ProgramCounter is an opaque value representing a specific execution point in +// a module. It is meant to be used with Function.SourceOffsetForPC and +// StackIterator. +type ProgramCounter uint64 + +// InternalFunction exposes some information about a function instance. +type InternalFunction interface { + // Definition provides introspection into the function's names and + // signature. + Definition() api.FunctionDefinition + + // SourceOffsetForPC resolves a program counter into its corresponding + // offset in the Code section of the module this function belongs to. + // The source offset is meant to help map the function calls to their + // location in the original source files. Returns 0 if the offset cannot + // be calculated. + SourceOffsetForPC(pc ProgramCounter) uint64 +} diff --git a/vendor/github.com/tetratelabs/wazero/experimental/listener.go b/vendor/github.com/tetratelabs/wazero/experimental/listener.go new file mode 100644 index 000000000..64d98e90a --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/experimental/listener.go @@ -0,0 +1,322 @@ +package experimental + +import ( + "context" + + "github.com/tetratelabs/wazero/api" +) + +// StackIterator allows iterating on each function of the call stack, starting +// from the top. At least one call to Next() is required to start the iteration. +// +// Note: The iterator provides a view of the call stack at the time of +// iteration. As a result, parameter values may be different than the ones their +// function was called with. +type StackIterator interface { + // Next moves the iterator to the next function in the stack. Returns + // false if it reached the bottom of the stack. + Next() bool + // Function describes the function called by the current frame. + Function() InternalFunction + // ProgramCounter returns the program counter associated with the + // function call. + ProgramCounter() ProgramCounter +} + +// FunctionListenerFactoryKey is a context.Context Value key. Its associated value should be a FunctionListenerFactory. +// +// See https://github.com/tetratelabs/wazero/issues/451 +type FunctionListenerFactoryKey struct{} + +// FunctionListenerFactory returns FunctionListeners to be notified when a +// function is called. +type FunctionListenerFactory interface { + // NewFunctionListener returns a FunctionListener for a defined function. + // If nil is returned, no listener will be notified. + NewFunctionListener(api.FunctionDefinition) FunctionListener + // ^^ A single instance can be returned to avoid instantiating a listener + // per function, especially as they may be thousands of functions. Shared + // listeners use their FunctionDefinition parameter to clarify. +} + +// FunctionListener can be registered for any function via +// FunctionListenerFactory to be notified when the function is called. +type FunctionListener interface { + // Before is invoked before a function is called. + // + // There is always one corresponding call to After or Abort for each call to + // Before. This guarantee allows the listener to maintain an internal stack + // to perform correlations between the entry and exit of functions. + // + // # Params + // + // - ctx: the context of the caller function which must be the same + // instance or parent of the result. + // - mod: the calling module. + // - def: the function definition. + // - params: api.ValueType encoded parameters. + // - stackIterator: iterator on the call stack. At least one entry is + // guaranteed (the called function), whose Args() will be equal to + // params. The iterator will be reused between calls to Before. + // + // Note: api.Memory is meant for inspection, not modification. + // mod can be cast to InternalModule to read non-exported globals. + Before(ctx context.Context, mod api.Module, def api.FunctionDefinition, params []uint64, stackIterator StackIterator) + + // After is invoked after a function is called. + // + // # Params + // + // - ctx: the context of the caller function. + // - mod: the calling module. + // - def: the function definition. + // - results: api.ValueType encoded results. + // + // # Notes + // + // - api.Memory is meant for inspection, not modification. + // - This is not called when a host function panics, or a guest function traps. + // See Abort for more details. + After(ctx context.Context, mod api.Module, def api.FunctionDefinition, results []uint64) + + // Abort is invoked when a function does not return due to a trap or panic. + // + // # Params + // + // - ctx: the context of the caller function. + // - mod: the calling module. + // - def: the function definition. + // - err: the error value representing the reason why the function aborted. + // + // # Notes + // + // - api.Memory is meant for inspection, not modification. + Abort(ctx context.Context, mod api.Module, def api.FunctionDefinition, err error) +} + +// FunctionListenerFunc is a function type implementing the FunctionListener +// interface, making it possible to use regular functions and methods as +// listeners of function invocation. +// +// The FunctionListener interface declares two methods (Before and After), +// but this type invokes its value only when Before is called. It is best +// suites for cases where the host does not need to perform correlation +// between the start and end of the function call. +type FunctionListenerFunc func(context.Context, api.Module, api.FunctionDefinition, []uint64, StackIterator) + +// Before satisfies the FunctionListener interface, calls f. +func (f FunctionListenerFunc) Before(ctx context.Context, mod api.Module, def api.FunctionDefinition, params []uint64, stackIterator StackIterator) { + f(ctx, mod, def, params, stackIterator) +} + +// After is declared to satisfy the FunctionListener interface, but it does +// nothing. +func (f FunctionListenerFunc) After(context.Context, api.Module, api.FunctionDefinition, []uint64) { +} + +// Abort is declared to satisfy the FunctionListener interface, but it does +// nothing. +func (f FunctionListenerFunc) Abort(context.Context, api.Module, api.FunctionDefinition, error) { +} + +// FunctionListenerFactoryFunc is a function type implementing the +// FunctionListenerFactory interface, making it possible to use regular +// functions and methods as factory of function listeners. +type FunctionListenerFactoryFunc func(api.FunctionDefinition) FunctionListener + +// NewFunctionListener satisfies the FunctionListenerFactory interface, calls f. +func (f FunctionListenerFactoryFunc) NewFunctionListener(def api.FunctionDefinition) FunctionListener { + return f(def) +} + +// MultiFunctionListenerFactory constructs a FunctionListenerFactory which +// combines the listeners created by each of the factories passed as arguments. +// +// This function is useful when multiple listeners need to be hooked to a module +// because the propagation mechanism based on installing a listener factory in +// the context.Context used when instantiating modules allows for a single +// listener to be installed. +// +// The stack iterator passed to the Before method is reset so that each listener +// can iterate the call stack independently without impacting the ability of +// other listeners to do so. +func MultiFunctionListenerFactory(factories ...FunctionListenerFactory) FunctionListenerFactory { + multi := make(multiFunctionListenerFactory, len(factories)) + copy(multi, factories) + return multi +} + +type multiFunctionListenerFactory []FunctionListenerFactory + +func (multi multiFunctionListenerFactory) NewFunctionListener(def api.FunctionDefinition) FunctionListener { + var lstns []FunctionListener + for _, factory := range multi { + if lstn := factory.NewFunctionListener(def); lstn != nil { + lstns = append(lstns, lstn) + } + } + switch len(lstns) { + case 0: + return nil + case 1: + return lstns[0] + default: + return &multiFunctionListener{lstns: lstns} + } +} + +type multiFunctionListener struct { + lstns []FunctionListener + stack stackIterator +} + +func (multi *multiFunctionListener) Before(ctx context.Context, mod api.Module, def api.FunctionDefinition, params []uint64, si StackIterator) { + multi.stack.base = si + for _, lstn := range multi.lstns { + multi.stack.index = -1 + lstn.Before(ctx, mod, def, params, &multi.stack) + } +} + +func (multi *multiFunctionListener) After(ctx context.Context, mod api.Module, def api.FunctionDefinition, results []uint64) { + for _, lstn := range multi.lstns { + lstn.After(ctx, mod, def, results) + } +} + +func (multi *multiFunctionListener) Abort(ctx context.Context, mod api.Module, def api.FunctionDefinition, err error) { + for _, lstn := range multi.lstns { + lstn.Abort(ctx, mod, def, err) + } +} + +type stackIterator struct { + base StackIterator + index int + pcs []uint64 + fns []InternalFunction +} + +func (si *stackIterator) Next() bool { + if si.base != nil { + si.pcs = si.pcs[:0] + si.fns = si.fns[:0] + + for si.base.Next() { + si.pcs = append(si.pcs, uint64(si.base.ProgramCounter())) + si.fns = append(si.fns, si.base.Function()) + } + + si.base = nil + } + si.index++ + return si.index < len(si.pcs) +} + +func (si *stackIterator) ProgramCounter() ProgramCounter { + return ProgramCounter(si.pcs[si.index]) +} + +func (si *stackIterator) Function() InternalFunction { + return si.fns[si.index] +} + +// StackFrame represents a frame on the call stack. +type StackFrame struct { + Function api.Function + Params []uint64 + Results []uint64 + PC uint64 + SourceOffset uint64 +} + +type internalFunction struct { + definition api.FunctionDefinition + sourceOffset uint64 +} + +func (f internalFunction) Definition() api.FunctionDefinition { + return f.definition +} + +func (f internalFunction) SourceOffsetForPC(pc ProgramCounter) uint64 { + return f.sourceOffset +} + +// stackFrameIterator is an implementation of the experimental.stackFrameIterator +// interface. +type stackFrameIterator struct { + index int + stack []StackFrame + fndef []api.FunctionDefinition +} + +func (si *stackFrameIterator) Next() bool { + si.index++ + return si.index < len(si.stack) +} + +func (si *stackFrameIterator) Function() InternalFunction { + return internalFunction{ + definition: si.fndef[si.index], + sourceOffset: si.stack[si.index].SourceOffset, + } +} + +func (si *stackFrameIterator) ProgramCounter() ProgramCounter { + return ProgramCounter(si.stack[si.index].PC) +} + +// NewStackIterator constructs a stack iterator from a list of stack frames. +// The top most frame is the last one. +func NewStackIterator(stack ...StackFrame) StackIterator { + si := &stackFrameIterator{ + index: -1, + stack: make([]StackFrame, len(stack)), + fndef: make([]api.FunctionDefinition, len(stack)), + } + for i := range stack { + si.stack[i] = stack[len(stack)-(i+1)] + } + // The size of function definition is only one pointer which should allow + // the compiler to optimize the conversion to api.FunctionDefinition; but + // the presence of internal.WazeroOnlyType, despite being defined as an + // empty struct, forces a heap allocation that we amortize by caching the + // result. + for i, frame := range stack { + si.fndef[i] = frame.Function.Definition() + } + return si +} + +// BenchmarkFunctionListener implements a benchmark for function listeners. +// +// The benchmark calls Before and After methods repeatedly using the provided +// module an stack frames to invoke the methods. +// +// The stack frame is a representation of the call stack that the Before method +// will be invoked with. The top of the stack is stored at index zero. The stack +// must contain at least one frame or the benchmark will fail. +func BenchmarkFunctionListener(n int, module api.Module, stack []StackFrame, listener FunctionListener) { + if len(stack) == 0 { + panic("cannot benchmark function listener with an empty stack") + } + + ctx := context.Background() + def := stack[0].Function.Definition() + params := stack[0].Params + results := stack[0].Results + stackIterator := &stackIterator{base: NewStackIterator(stack...)} + + for i := 0; i < n; i++ { + stackIterator.index = -1 + listener.Before(ctx, module, def, params, stackIterator) + listener.After(ctx, module, def, results) + } +} + +// TODO: the calls to Abort are not yet tested in internal/testing/enginetest, +// but they are validated indirectly in tests which exercise host logging, +// like Test_procExit in imports/wasi_snapshot_preview1. Eventually we should +// add dedicated tests to validate the behavior of the interpreter and compiler +// engines independently. diff --git a/vendor/github.com/tetratelabs/wazero/experimental/logging/testdata/listener.wasm b/vendor/github.com/tetratelabs/wazero/experimental/logging/testdata/listener.wasm new file mode 100644 index 0000000000000000000000000000000000000000..c514d5f5b2bc0a5aff988253531ca005ebd1a854 GIT binary patch literal 318 zcmZ{f&uYUk48}jn-r_WjbqspQq4c&}VS5Abvd2hM;%tWe!%iF6#n(Od?2NI~B+v&x z3F#AR-xC0O6ekXW!byf0Q7M4mc(>HvR(_}_|1r+h z#o5__gkWYVX@a_u6eCk4(+Y?@BWO_&Hcz~VCXJL^Dz!Xdi&CpY>^}fyaf?W}z!%A( z?hSI)SwEY>IC_z|Pfm}2zUXcRza}_eKS_PDp5|8xhB#kZ%3`THGf*ULL(+~{&nneK TMd6IUbo0^MPs0R}*pGYzZRk%u literal 0 HcmV?d00001 diff --git a/vendor/github.com/tetratelabs/wazero/experimental/sys/dir.go b/vendor/github.com/tetratelabs/wazero/experimental/sys/dir.go new file mode 100644 index 000000000..0b997cb8f --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/experimental/sys/dir.go @@ -0,0 +1,92 @@ +package sys + +import ( + "fmt" + "io/fs" + + "github.com/tetratelabs/wazero/sys" +) + +// FileType is fs.FileMode masked on fs.ModeType. For example, zero is a +// regular file, fs.ModeDir is a directory and fs.ModeIrregular is unknown. +// +// Note: This is defined by Linux, not POSIX. +type FileType = fs.FileMode + +// Dirent is an entry read from a directory via File.Readdir. +// +// # Notes +// +// - This extends `dirent` defined in POSIX with some fields defined by +// Linux. See https://man7.org/linux/man-pages/man3/readdir.3.html and +// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/dirent.h.html +// - This has a subset of fields defined in sys.Stat_t. Notably, there is no +// field corresponding to Stat_t.Dev because that value will be constant +// for all files in a directory. To get the Dev value, call File.Stat on +// the directory File.Readdir was called on. +type Dirent struct { + // Ino is the file serial number, or zero if not available. See Ino for + // more details including impact returning a zero value. + Ino sys.Inode + + // Name is the base name of the directory entry. Empty is invalid. + Name string + + // Type is fs.FileMode masked on fs.ModeType. For example, zero is a + // regular file, fs.ModeDir is a directory and fs.ModeIrregular is unknown. + // + // Note: This is defined by Linux, not POSIX. + Type fs.FileMode +} + +func (d *Dirent) String() string { + return fmt.Sprintf("name=%s, type=%v, ino=%d", d.Name, d.Type, d.Ino) +} + +// IsDir returns true if the Type is fs.ModeDir. +func (d *Dirent) IsDir() bool { + return d.Type == fs.ModeDir +} + +// DirFile is embeddable to reduce the amount of functions to implement a file. +type DirFile struct{} + +// IsAppend implements File.IsAppend +func (DirFile) IsAppend() bool { + return false +} + +// SetAppend implements File.SetAppend +func (DirFile) SetAppend(bool) Errno { + return EISDIR +} + +// IsDir implements File.IsDir +func (DirFile) IsDir() (bool, Errno) { + return true, 0 +} + +// Read implements File.Read +func (DirFile) Read([]byte) (int, Errno) { + return 0, EISDIR +} + +// Pread implements File.Pread +func (DirFile) Pread([]byte, int64) (int, Errno) { + return 0, EISDIR +} + +// Write implements File.Write +func (DirFile) Write([]byte) (int, Errno) { + return 0, EISDIR +} + +// Pwrite implements File.Pwrite +func (DirFile) Pwrite([]byte, int64) (int, Errno) { + return 0, EISDIR +} + +// Truncate implements File.Truncate +func (DirFile) Truncate(int64) Errno { + return EISDIR +} diff --git a/vendor/github.com/tetratelabs/wazero/experimental/sys/errno.go b/vendor/github.com/tetratelabs/wazero/experimental/sys/errno.go new file mode 100644 index 000000000..238949496 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/experimental/sys/errno.go @@ -0,0 +1,98 @@ +package sys + +import "strconv" + +// Errno is a subset of POSIX errno used by wazero interfaces. Zero is not an +// error. Other values should not be interpreted numerically, rather by constants +// prefixed with 'E'. +// +// See https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html +type Errno uint16 + +// ^-- Note: This will eventually move to the public /sys package. It is +// experimental until we audit the socket related APIs to ensure we have all +// the Errno it returns, and we export fs.FS. This is not in /internal/sys as +// that would introduce a package cycle. + +// This is a subset of errors to reduce implementation burden. `wasip1` defines +// almost all POSIX error numbers, but not all are used in practice. wazero +// will add ones needed in POSIX order, as needed by functions that explicitly +// document returning them. +// +// https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-errno-enumu16 +const ( + EACCES Errno = iota + 1 + EAGAIN + EBADF + EEXIST + EFAULT + EINTR + EINVAL + EIO + EISDIR + ELOOP + ENAMETOOLONG + ENOENT + ENOSYS + ENOTDIR + ERANGE + ENOTEMPTY + ENOTSOCK + ENOTSUP + EPERM + EROFS + + // NOTE ENOTCAPABLE is defined in wasip1, but not in POSIX. wasi-libc + // converts it to EBADF, ESPIPE or EINVAL depending on the call site. + // It isn't known if compilers who don't use ENOTCAPABLE would crash on it. +) + +// Error implements error +func (e Errno) Error() string { + switch e { + case 0: // not an error + return "success" + case EACCES: + return "permission denied" + case EAGAIN: + return "resource unavailable, try again" + case EBADF: + return "bad file descriptor" + case EEXIST: + return "file exists" + case EFAULT: + return "bad address" + case EINTR: + return "interrupted function" + case EINVAL: + return "invalid argument" + case EIO: + return "input/output error" + case EISDIR: + return "is a directory" + case ELOOP: + return "too many levels of symbolic links" + case ENAMETOOLONG: + return "filename too long" + case ENOENT: + return "no such file or directory" + case ENOSYS: + return "functionality not supported" + case ENOTDIR: + return "not a directory or a symbolic link to a directory" + case ERANGE: + return "result too large" + case ENOTEMPTY: + return "directory not empty" + case ENOTSOCK: + return "not a socket" + case ENOTSUP: + return "not supported (may be the same value as [EOPNOTSUPP])" + case EPERM: + return "operation not permitted" + case EROFS: + return "read-only file system" + default: + return "Errno(" + strconv.Itoa(int(e)) + ")" + } +} diff --git a/vendor/github.com/tetratelabs/wazero/experimental/sys/error.go b/vendor/github.com/tetratelabs/wazero/experimental/sys/error.go new file mode 100644 index 000000000..a0c76019a --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/experimental/sys/error.go @@ -0,0 +1,45 @@ +package sys + +import ( + "io" + "io/fs" + "os" +) + +// UnwrapOSError returns an Errno or zero if the input is nil. +func UnwrapOSError(err error) Errno { + if err == nil { + return 0 + } + err = underlyingError(err) + switch err { + case nil, io.EOF: + return 0 // EOF is not a Errno + case fs.ErrInvalid: + return EINVAL + case fs.ErrPermission: + return EPERM + case fs.ErrExist: + return EEXIST + case fs.ErrNotExist: + return ENOENT + case fs.ErrClosed: + return EBADF + } + return errorToErrno(err) +} + +// underlyingError returns the underlying error if a well-known OS error type. +// +// This impl is basically the same as os.underlyingError in os/error.go +func underlyingError(err error) error { + switch err := err.(type) { + case *os.PathError: + return err.Err + case *os.LinkError: + return err.Err + case *os.SyscallError: + return err.Err + } + return err +} diff --git a/vendor/github.com/tetratelabs/wazero/experimental/sys/file.go b/vendor/github.com/tetratelabs/wazero/experimental/sys/file.go new file mode 100644 index 000000000..f8f2e5b12 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/experimental/sys/file.go @@ -0,0 +1,317 @@ +package sys + +import "github.com/tetratelabs/wazero/sys" + +// File is a writeable fs.File bridge backed by syscall functions needed for ABI +// including WASI and runtime.GOOS=js. +// +// Implementations should embed UnimplementedFile for forward compatability. Any +// unsupported method or parameter should return ENOSYS. +// +// # Errors +// +// All methods that can return an error return a Errno, which is zero +// on success. +// +// Restricting to Errno matches current WebAssembly host functions, +// which are constrained to well-known error codes. For example, `GOOS=js` maps +// hard coded values and panics otherwise. More commonly, WASI maps syscall +// errors to u32 numeric values. +// +// # Notes +// +// - You must call Close to avoid file resource conflicts. For example, +// Windows cannot delete the underlying directory while a handle to it +// remains open. +// - A writable filesystem abstraction is not yet implemented as of Go 1.20. +// See https://github.com/golang/go/issues/45757 +type File interface { + // Dev returns the device ID (Stat_t.Dev) of this file, zero if unknown or + // an error retrieving it. + // + // # Errors + // + // Possible errors are those from Stat, except ENOSYS should not + // be returned. Zero should be returned if there is no implementation. + // + // # Notes + // + // - Implementations should cache this result. + // - This combined with Ino can implement os.SameFile. + Dev() (uint64, Errno) + + // Ino returns the serial number (Stat_t.Ino) of this file, zero if unknown + // or an error retrieving it. + // + // # Errors + // + // Possible errors are those from Stat, except ENOSYS should not + // be returned. Zero should be returned if there is no implementation. + // + // # Notes + // + // - Implementations should cache this result. + // - This combined with Dev can implement os.SameFile. + Ino() (sys.Inode, Errno) + + // IsDir returns true if this file is a directory or an error there was an + // error retrieving this information. + // + // # Errors + // + // Possible errors are those from Stat, except ENOSYS should not + // be returned. false should be returned if there is no implementation. + // + // # Notes + // + // - Implementations should cache this result. + IsDir() (bool, Errno) + + // IsAppend returns true if the file was opened with O_APPEND, or + // SetAppend was successfully enabled on this file. + // + // # Notes + // + // - This might not match the underlying state of the file descriptor if + // the file was not opened via OpenFile. + IsAppend() bool + + // SetAppend toggles the append mode (O_APPEND) of this file. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - EBADF: the file or directory was closed. + // + // # Notes + // + // - There is no `O_APPEND` for `fcntl` in POSIX, so implementations may + // have to re-open the underlying file to apply this. See + // https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html + SetAppend(enable bool) Errno + + // Stat is similar to syscall.Fstat. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - EBADF: the file or directory was closed. + // + // # Notes + // + // - This is like syscall.Fstat and `fstatat` with `AT_FDCWD` in POSIX. + // See https://pubs.opengroup.org/onlinepubs/9699919799/functions/stat.html + // - A fs.FileInfo backed implementation sets atim, mtim and ctim to the + // same value. + // - Windows allows you to stat a closed directory. + Stat() (sys.Stat_t, Errno) + + // Read attempts to read all bytes in the file into `buf`, and returns the + // count read even on error. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - EBADF: the file or directory was closed or not readable. + // - EISDIR: the file was a directory. + // + // # Notes + // + // - This is like io.Reader and `read` in POSIX, preferring semantics of + // io.Reader. See https://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html + // - Unlike io.Reader, there is no io.EOF returned on end-of-file. To + // read the file completely, the caller must repeat until `n` is zero. + Read(buf []byte) (n int, errno Errno) + + // Pread attempts to read all bytes in the file into `p`, starting at the + // offset `off`, and returns the count read even on error. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - EBADF: the file or directory was closed or not readable. + // - EINVAL: the offset was negative. + // - EISDIR: the file was a directory. + // + // # Notes + // + // - This is like io.ReaderAt and `pread` in POSIX, preferring semantics + // of io.ReaderAt. See https://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html + // - Unlike io.ReaderAt, there is no io.EOF returned on end-of-file. To + // read the file completely, the caller must repeat until `n` is zero. + Pread(buf []byte, off int64) (n int, errno Errno) + + // Seek attempts to set the next offset for Read or Write and returns the + // resulting absolute offset or an error. + // + // # Parameters + // + // The `offset` parameters is interpreted in terms of `whence`: + // - io.SeekStart: relative to the start of the file, e.g. offset=0 sets + // the next Read or Write to the beginning of the file. + // - io.SeekCurrent: relative to the current offset, e.g. offset=16 sets + // the next Read or Write 16 bytes past the prior. + // - io.SeekEnd: relative to the end of the file, e.g. offset=-1 sets the + // next Read or Write to the last byte in the file. + // + // # Behavior when a directory + // + // The only supported use case for a directory is seeking to `offset` zero + // (`whence` = io.SeekStart). This should have the same behavior as + // os.File, which resets any internal state used by Readdir. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - EBADF: the file or directory was closed or not readable. + // - EINVAL: the offset was negative. + // + // # Notes + // + // - This is like io.Seeker and `fseek` in POSIX, preferring semantics + // of io.Seeker. See https://pubs.opengroup.org/onlinepubs/9699919799/functions/fseek.html + Seek(offset int64, whence int) (newOffset int64, errno Errno) + + // Readdir reads the contents of the directory associated with file and + // returns a slice of up to n Dirent values in an arbitrary order. This is + // a stateful function, so subsequent calls return any next values. + // + // If n > 0, Readdir returns at most n entries or an error. + // If n <= 0, Readdir returns all remaining entries or an error. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - EBADF: the file was closed or not a directory. + // - ENOENT: the directory could not be read (e.g. deleted). + // + // # Notes + // + // - This is like `Readdir` on os.File, but unlike `readdir` in POSIX. + // See https://pubs.opengroup.org/onlinepubs/9699919799/functions/readdir.html + // - Unlike os.File, there is no io.EOF returned on end-of-directory. To + // read the directory completely, the caller must repeat until the + // count read (`len(dirents)`) is less than `n`. + // - See /RATIONALE.md for design notes. + Readdir(n int) (dirents []Dirent, errno Errno) + + // Write attempts to write all bytes in `p` to the file, and returns the + // count written even on error. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - EBADF: the file was closed, not writeable, or a directory. + // + // # Notes + // + // - This is like io.Writer and `write` in POSIX, preferring semantics of + // io.Writer. See https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html + Write(buf []byte) (n int, errno Errno) + + // Pwrite attempts to write all bytes in `p` to the file at the given + // offset `off`, and returns the count written even on error. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - EBADF: the file or directory was closed or not writeable. + // - EINVAL: the offset was negative. + // - EISDIR: the file was a directory. + // + // # Notes + // + // - This is like io.WriterAt and `pwrite` in POSIX, preferring semantics + // of io.WriterAt. See https://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html + Pwrite(buf []byte, off int64) (n int, errno Errno) + + // Truncate truncates a file to a specified length. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - EBADF: the file or directory was closed. + // - EINVAL: the `size` is negative. + // - EISDIR: the file was a directory. + // + // # Notes + // + // - This is like syscall.Ftruncate and `ftruncate` in POSIX. See + // https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html + // - Windows does not error when calling Truncate on a closed file. + Truncate(size int64) Errno + + // Sync synchronizes changes to the file. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - EBADF: the file or directory was closed. + // + // # Notes + // + // - This is like syscall.Fsync and `fsync` in POSIX. See + // https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html + // - This returns with no error instead of ENOSYS when + // unimplemented. This prevents fake filesystems from erring. + // - Windows does not error when calling Sync on a closed file. + Sync() Errno + + // Datasync synchronizes the data of a file. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - EBADF: the file or directory was closed. + // + // # Notes + // + // - This is like syscall.Fdatasync and `fdatasync` in POSIX. See + // https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html + // - This returns with no error instead of ENOSYS when + // unimplemented. This prevents fake filesystems from erring. + // - As this is commonly missing, some implementations dispatch to Sync. + Datasync() Errno + + // Utimens set file access and modification times of this file, at + // nanosecond precision. + // + // # Parameters + // + // The `atim` and `mtim` parameters refer to access and modification time + // stamps as defined in sys.Stat_t. To retain one or the other, substitute + // it with the pseudo-timestamp UTIME_OMIT. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - EBADF: the file or directory was closed. + // + // # Notes + // + // - This is like syscall.UtimesNano and `futimens` in POSIX. See + // https://pubs.opengroup.org/onlinepubs/9699919799/functions/futimens.html + // - Windows requires files to be open with O_RDWR, which means you + // cannot use this to update timestamps on a directory (EPERM). + Utimens(atim, mtim int64) Errno + + // Close closes the underlying file. + // + // A zero Errno is returned if unimplemented or success. + // + // # Notes + // + // - This is like syscall.Close and `close` in POSIX. See + // https://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html + Close() Errno +} diff --git a/vendor/github.com/tetratelabs/wazero/experimental/sys/fs.go b/vendor/github.com/tetratelabs/wazero/experimental/sys/fs.go new file mode 100644 index 000000000..1ce99cef1 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/experimental/sys/fs.go @@ -0,0 +1,293 @@ +package sys + +import ( + "io/fs" + + "github.com/tetratelabs/wazero/sys" +) + +// FS is a writeable fs.FS bridge backed by syscall functions needed for ABI +// including WASI and runtime.GOOS=js. +// +// Implementations should embed UnimplementedFS for forward compatability. Any +// unsupported method or parameter should return ENO +// +// # Errors +// +// All methods that can return an error return a Errno, which is zero +// on success. +// +// Restricting to Errno matches current WebAssembly host functions, +// which are constrained to well-known error codes. For example, `GOOS=js` maps +// hard coded values and panics otherwise. More commonly, WASI maps syscall +// errors to u32 numeric values. +// +// # Notes +// +// A writable filesystem abstraction is not yet implemented as of Go 1.20. See +// https://github.com/golang/go/issues/45757 +type FS interface { + // OpenFile opens a file. It should be closed via Close on File. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - EINVAL: `path` or `flag` is invalid. + // - EISDIR: the path was a directory, but flag included O_RDWR or + // O_WRONLY + // - ENOENT: `path` doesn't exist and `flag` doesn't contain O_CREAT. + // + // # Constraints on the returned file + // + // Implementations that can read flags should enforce them regardless of + // the type returned. For example, while os.File implements io.Writer, + // attempts to write to a directory or a file opened with O_RDONLY fail + // with a EBADF. + // + // Some implementations choose whether to enforce read-only opens, namely + // fs.FS. While fs.FS is supported (Adapt), wazero cannot runtime enforce + // open flags. Instead, we encourage good behavior and test our built-in + // implementations. + // + // # Notes + // + // - This is like os.OpenFile, except the path is relative to this file + // system, and Errno is returned instead of os.PathError. + // - Implications of permissions when O_CREAT are described in Chmod notes. + // - This is like `open` in POSIX. See + // https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html + OpenFile(path string, flag Oflag, perm fs.FileMode) (File, Errno) + + // Lstat gets file status without following symbolic links. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - ENOENT: `path` doesn't exist. + // + // # Notes + // + // - This is like syscall.Lstat, except the `path` is relative to this + // file system. + // - This is like `lstat` in POSIX. See + // https://pubs.opengroup.org/onlinepubs/9699919799/functions/lstat.html + // - An fs.FileInfo backed implementation sets atim, mtim and ctim to the + // same value. + // - When the path is a symbolic link, the stat returned is for the link, + // not the file it refers to. + Lstat(path string) (sys.Stat_t, Errno) + + // Stat gets file status. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - ENOENT: `path` doesn't exist. + // + // # Notes + // + // - This is like syscall.Stat, except the `path` is relative to this + // file system. + // - This is like `stat` in POSIX. See + // https://pubs.opengroup.org/onlinepubs/9699919799/functions/stat.html + // - An fs.FileInfo backed implementation sets atim, mtim and ctim to the + // same value. + // - When the path is a symbolic link, the stat returned is for the file + // it refers to. + Stat(path string) (sys.Stat_t, Errno) + + // Mkdir makes a directory. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - EINVAL: `path` is invalid. + // - EEXIST: `path` exists and is a directory. + // - ENOTDIR: `path` exists and is a file. + // + // # Notes + // + // - This is like syscall.Mkdir, except the `path` is relative to this + // file system. + // - This is like `mkdir` in POSIX. See + // https://pubs.opengroup.org/onlinepubs/9699919799/functions/mkdir.html + // - Implications of permissions are described in Chmod notes. + Mkdir(path string, perm fs.FileMode) Errno + + // Chmod changes the mode of the file. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - EINVAL: `path` is invalid. + // - ENOENT: `path` does not exist. + // + // # Notes + // + // - This is like syscall.Chmod, except the `path` is relative to this + // file system. + // - This is like `chmod` in POSIX. See + // https://pubs.opengroup.org/onlinepubs/9699919799/functions/chmod.html + // - Windows ignores the execute bit, and any permissions come back as + // group and world. For example, chmod of 0400 reads back as 0444, and + // 0700 0666. Also, permissions on directories aren't supported at all. + Chmod(path string, perm fs.FileMode) Errno + + // Rename renames file or directory. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - EINVAL: `from` or `to` is invalid. + // - ENOENT: `from` or `to` don't exist. + // - ENOTDIR: `from` is a directory and `to` exists as a file. + // - EISDIR: `from` is a file and `to` exists as a directory. + // - ENOTEMPTY: `both from` and `to` are existing directory, but + // `to` is not empty. + // + // # Notes + // + // - This is like syscall.Rename, except the paths are relative to this + // file system. + // - This is like `rename` in POSIX. See + // https://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html + // - Windows doesn't let you overwrite an existing directory. + Rename(from, to string) Errno + + // Rmdir removes a directory. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - EINVAL: `path` is invalid. + // - ENOENT: `path` doesn't exist. + // - ENOTDIR: `path` exists, but isn't a directory. + // - ENOTEMPTY: `path` exists, but isn't empty. + // + // # Notes + // + // - This is like syscall.Rmdir, except the `path` is relative to this + // file system. + // - This is like `rmdir` in POSIX. See + // https://pubs.opengroup.org/onlinepubs/9699919799/functions/rmdir.html + // - As of Go 1.19, Windows maps ENOTDIR to ENOENT. + Rmdir(path string) Errno + + // Unlink removes a directory entry. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - EINVAL: `path` is invalid. + // - ENOENT: `path` doesn't exist. + // - EISDIR: `path` exists, but is a directory. + // + // # Notes + // + // - This is like syscall.Unlink, except the `path` is relative to this + // file system. + // - This is like `unlink` in POSIX. See + // https://pubs.opengroup.org/onlinepubs/9699919799/functions/unlink.html + // - On Windows, syscall.Unlink doesn't delete symlink to directory unlike other platforms. Implementations might + // want to combine syscall.RemoveDirectory with syscall.Unlink in order to delete such links on Windows. + // See https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-removedirectorya + Unlink(path string) Errno + + // Link creates a "hard" link from oldPath to newPath, in contrast to a + // soft link (via Symlink). + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - EPERM: `oldPath` is invalid. + // - ENOENT: `oldPath` doesn't exist. + // - EISDIR: `newPath` exists, but is a directory. + // + // # Notes + // + // - This is like syscall.Link, except the `oldPath` is relative to this + // file system. + // - This is like `link` in POSIX. See + // https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html + Link(oldPath, newPath string) Errno + + // Symlink creates a "soft" link from oldPath to newPath, in contrast to a + // hard link (via Link). + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - EPERM: `oldPath` or `newPath` is invalid. + // - EEXIST: `newPath` exists. + // + // # Notes + // + // - This is like syscall.Symlink, except the `oldPath` is relative to + // this file system. + // - This is like `symlink` in POSIX. See + // https://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html + // - Only `newPath` is relative to this file system and `oldPath` is kept + // as-is. That is because the link is only resolved relative to the + // directory when dereferencing it (e.g. ReadLink). + // See https://github.com/bytecodealliance/cap-std/blob/v1.0.4/cap-std/src/fs/dir.rs#L404-L409 + // for how others implement this. + // - Symlinks in Windows requires `SeCreateSymbolicLinkPrivilege`. + // Otherwise, EPERM results. + // See https://learn.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/create-symbolic-links + Symlink(oldPath, linkName string) Errno + + // Readlink reads the contents of a symbolic link. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - EINVAL: `path` is invalid. + // + // # Notes + // + // - This is like syscall.Readlink, except the path is relative to this + // filesystem. + // - This is like `readlink` in POSIX. See + // https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html + // - On Windows, the path separator is different from other platforms, + // but to provide consistent results to Wasm, this normalizes to a "/" + // separator. + Readlink(path string) (string, Errno) + + // Utimens set file access and modification times on a path relative to + // this file system, at nanosecond precision. + // + // # Parameters + // + // If the path is a symbolic link, the target of expanding that link is + // updated. + // + // The `atim` and `mtim` parameters refer to access and modification time + // stamps as defined in sys.Stat_t. To retain one or the other, substitute + // it with the pseudo-timestamp UTIME_OMIT. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - EINVAL: `path` is invalid. + // - EEXIST: `path` exists and is a directory. + // - ENOTDIR: `path` exists and is a file. + // + // # Notes + // + // - This is like syscall.UtimesNano and `utimensat` with `AT_FDCWD` in + // POSIX. See https://pubs.opengroup.org/onlinepubs/9699919799/functions/futimens.html + Utimens(path string, atim, mtim int64) Errno +} diff --git a/vendor/github.com/tetratelabs/wazero/experimental/sys/oflag.go b/vendor/github.com/tetratelabs/wazero/experimental/sys/oflag.go new file mode 100644 index 000000000..39ebd378f --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/experimental/sys/oflag.go @@ -0,0 +1,70 @@ +package sys + +// Oflag are flags used for FS.OpenFile. Values, including zero, should not be +// interpreted numerically. Instead, use by constants prefixed with 'O_' with +// special casing noted below. +// +// # Notes +// +// - O_RDONLY, O_RDWR and O_WRONLY are mutually exclusive, while the other +// flags can coexist bitwise. +// - This is like `flag` in os.OpenFile and `oflag` in POSIX. See +// https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html +type Oflag uint32 + +// This is a subset of oflags to reduce implementation burden. `wasip1` splits +// these across `oflags` and `fdflags`. We can't rely on the Go `os` package, +// as it is missing some values. Any flags added will be defined in POSIX +// order, as needed by functions that explicitly document accepting them. +// +// https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-oflags-flagsu16 +// https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-fdflags-flagsu16 +const ( + // O_RDONLY is like os.O_RDONLY + O_RDONLY Oflag = iota + + // O_RDWR is like os.O_RDWR + O_RDWR + + // O_WRONLY is like os.O_WRONLY + O_WRONLY + + // Define bitflags as they are in POSIX `open`: alphabetically + + // O_APPEND is like os.O_APPEND + O_APPEND Oflag = 1 << iota + + // O_CREAT is link os.O_CREATE + O_CREAT + + // O_DIRECTORY is defined on some platforms as syscall.O_DIRECTORY. + // + // Note: This ensures that the opened file is a directory. Those emulating + // on platforms that don't support the O_DIRECTORY, can double-check the + // result with File.IsDir (or stat) and err if not a directory. + O_DIRECTORY + + // O_DSYNC is defined on some platforms as syscall.O_DSYNC. + O_DSYNC + + // O_EXCL is defined on some platforms as syscall.O_EXCL. + O_EXCL + + // O_NOFOLLOW is defined on some platforms as syscall.O_NOFOLLOW. + // + // Note: This allows programs to ensure that if the opened file is a + // symbolic link, the link itself is opened instead of its target. + O_NOFOLLOW + + // O_NONBLOCK is defined on some platforms as syscall.O_NONBLOCK. + O_NONBLOCK + + // O_RSYNC is defined on some platforms as syscall.O_RSYNC. + O_RSYNC + + // O_SYNC is defined on some platforms as syscall.O_SYNC. + O_SYNC + + // O_TRUNC is defined on some platforms as syscall.O_TRUNC. + O_TRUNC +) diff --git a/vendor/github.com/tetratelabs/wazero/experimental/sys/syscall_errno.go b/vendor/github.com/tetratelabs/wazero/experimental/sys/syscall_errno.go new file mode 100644 index 000000000..ea511ec25 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/experimental/sys/syscall_errno.go @@ -0,0 +1,106 @@ +//go:build !plan9 && !aix + +package sys + +import "syscall" + +func syscallToErrno(err error) (Errno, bool) { + errno, ok := err.(syscall.Errno) + if !ok { + return 0, false + } + switch errno { + case 0: + return 0, true + case syscall.EACCES: + return EACCES, true + case syscall.EAGAIN: + return EAGAIN, true + case syscall.EBADF: + return EBADF, true + case syscall.EEXIST: + return EEXIST, true + case syscall.EFAULT: + return EFAULT, true + case syscall.EINTR: + return EINTR, true + case syscall.EINVAL: + return EINVAL, true + case syscall.EIO: + return EIO, true + case syscall.EISDIR: + return EISDIR, true + case syscall.ELOOP: + return ELOOP, true + case syscall.ENAMETOOLONG: + return ENAMETOOLONG, true + case syscall.ENOENT: + return ENOENT, true + case syscall.ENOSYS: + return ENOSYS, true + case syscall.ENOTDIR: + return ENOTDIR, true + case syscall.ERANGE: + return ERANGE, true + case syscall.ENOTEMPTY: + return ENOTEMPTY, true + case syscall.ENOTSOCK: + return ENOTSOCK, true + case syscall.ENOTSUP: + return ENOTSUP, true + case syscall.EPERM: + return EPERM, true + case syscall.EROFS: + return EROFS, true + default: + return EIO, true + } +} + +// Unwrap is a convenience for runtime.GOOS which define syscall.Errno. +func (e Errno) Unwrap() error { + switch e { + case 0: + return nil + case EACCES: + return syscall.EACCES + case EAGAIN: + return syscall.EAGAIN + case EBADF: + return syscall.EBADF + case EEXIST: + return syscall.EEXIST + case EFAULT: + return syscall.EFAULT + case EINTR: + return syscall.EINTR + case EINVAL: + return syscall.EINVAL + case EIO: + return syscall.EIO + case EISDIR: + return syscall.EISDIR + case ELOOP: + return syscall.ELOOP + case ENAMETOOLONG: + return syscall.ENAMETOOLONG + case ENOENT: + return syscall.ENOENT + case ENOSYS: + return syscall.ENOSYS + case ENOTDIR: + return syscall.ENOTDIR + case ENOTEMPTY: + return syscall.ENOTEMPTY + case ENOTSOCK: + return syscall.ENOTSOCK + case ENOTSUP: + return syscall.ENOTSUP + case EPERM: + return syscall.EPERM + case EROFS: + return syscall.EROFS + default: + return syscall.EIO + } +} diff --git a/vendor/github.com/tetratelabs/wazero/experimental/sys/syscall_errno_notwindows.go b/vendor/github.com/tetratelabs/wazero/experimental/sys/syscall_errno_notwindows.go new file mode 100644 index 000000000..8a88ed765 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/experimental/sys/syscall_errno_notwindows.go @@ -0,0 +1,13 @@ +//go:build !windows + +package sys + +func errorToErrno(err error) Errno { + if errno, ok := err.(Errno); ok { + return errno + } + if errno, ok := syscallToErrno(err); ok { + return errno + } + return EIO +} diff --git a/vendor/github.com/tetratelabs/wazero/experimental/sys/syscall_errno_unsupported.go b/vendor/github.com/tetratelabs/wazero/experimental/sys/syscall_errno_unsupported.go new file mode 100644 index 000000000..1c6d423d0 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/experimental/sys/syscall_errno_unsupported.go @@ -0,0 +1,7 @@ +//go:build plan9 || aix + +package sys + +func syscallToErrno(err error) (Errno, bool) { + return 0, false +} diff --git a/vendor/github.com/tetratelabs/wazero/experimental/sys/syscall_errno_windows.go b/vendor/github.com/tetratelabs/wazero/experimental/sys/syscall_errno_windows.go new file mode 100644 index 000000000..761a1f9dc --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/experimental/sys/syscall_errno_windows.go @@ -0,0 +1,62 @@ +package sys + +import "syscall" + +// These are errors not defined in the syscall package. They are prefixed with +// underscore to avoid exporting them. +// +// See https://learn.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499- +const ( + // _ERROR_INVALID_HANDLE is a Windows error returned by syscall.Write + // instead of syscall.EBADF + _ERROR_INVALID_HANDLE = syscall.Errno(6) + + // _ERROR_INVALID_NAME is a Windows error returned by open when a file + // path has a trailing slash + _ERROR_INVALID_NAME = syscall.Errno(0x7B) + + // _ERROR_NEGATIVE_SEEK is a Windows error returned by os.Truncate + // instead of syscall.EINVAL + _ERROR_NEGATIVE_SEEK = syscall.Errno(0x83) + + // _ERROR_DIRECTORY is a Windows error returned by syscall.Rmdir + // instead of syscall.ENOTDIR + _ERROR_DIRECTORY = syscall.Errno(0x10B) + + // _ERROR_INVALID_SOCKET is a Windows error returned by winsock_select + // when a given handle is not a socket. + _ERROR_INVALID_SOCKET = syscall.Errno(0x2736) +) + +func errorToErrno(err error) Errno { + switch err := err.(type) { + case Errno: + return err + case syscall.Errno: + // Note: In windows, _ERROR_PATH_NOT_FOUND(0x3) maps to syscall.ENOTDIR + switch err { + case syscall.ERROR_ALREADY_EXISTS: + return EEXIST + case _ERROR_DIRECTORY: + return ENOTDIR + case syscall.ERROR_DIR_NOT_EMPTY: + return ENOTEMPTY + case syscall.ERROR_FILE_EXISTS: + return EEXIST + case _ERROR_INVALID_HANDLE, _ERROR_INVALID_SOCKET: + return EBADF + case syscall.ERROR_ACCESS_DENIED: + // POSIX read and write functions expect EBADF, not EACCES when not + // open for reading or writing. + return EBADF + case syscall.ERROR_PRIVILEGE_NOT_HELD: + return EPERM + case _ERROR_NEGATIVE_SEEK, _ERROR_INVALID_NAME: + return EINVAL + } + errno, _ := syscallToErrno(err) + return errno + default: + return EIO + } +} diff --git a/vendor/github.com/tetratelabs/wazero/experimental/sys/time.go b/vendor/github.com/tetratelabs/wazero/experimental/sys/time.go new file mode 100644 index 000000000..4f3e01fef --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/experimental/sys/time.go @@ -0,0 +1,10 @@ +package sys + +import "math" + +// UTIME_OMIT is a special constant for use in updating times via FS.Utimens +// or File.Utimens. When used for atim or mtim, the value is retained. +// +// Note: This may be implemented via a stat when the underlying filesystem +// does not support this value. +const UTIME_OMIT int64 = math.MinInt64 diff --git a/vendor/github.com/tetratelabs/wazero/experimental/sys/unimplemented.go b/vendor/github.com/tetratelabs/wazero/experimental/sys/unimplemented.go new file mode 100644 index 000000000..d853d9e8f --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/experimental/sys/unimplemented.go @@ -0,0 +1,160 @@ +package sys + +import ( + "io/fs" + + "github.com/tetratelabs/wazero/sys" +) + +// UnimplementedFS is an FS that returns ENOSYS for all functions, +// This should be embedded to have forward compatible implementations. +type UnimplementedFS struct{} + +// OpenFile implements FS.OpenFile +func (UnimplementedFS) OpenFile(path string, flag Oflag, perm fs.FileMode) (File, Errno) { + return nil, ENOSYS +} + +// Lstat implements FS.Lstat +func (UnimplementedFS) Lstat(path string) (sys.Stat_t, Errno) { + return sys.Stat_t{}, ENOSYS +} + +// Stat implements FS.Stat +func (UnimplementedFS) Stat(path string) (sys.Stat_t, Errno) { + return sys.Stat_t{}, ENOSYS +} + +// Readlink implements FS.Readlink +func (UnimplementedFS) Readlink(path string) (string, Errno) { + return "", ENOSYS +} + +// Mkdir implements FS.Mkdir +func (UnimplementedFS) Mkdir(path string, perm fs.FileMode) Errno { + return ENOSYS +} + +// Chmod implements FS.Chmod +func (UnimplementedFS) Chmod(path string, perm fs.FileMode) Errno { + return ENOSYS +} + +// Rename implements FS.Rename +func (UnimplementedFS) Rename(from, to string) Errno { + return ENOSYS +} + +// Rmdir implements FS.Rmdir +func (UnimplementedFS) Rmdir(path string) Errno { + return ENOSYS +} + +// Link implements FS.Link +func (UnimplementedFS) Link(_, _ string) Errno { + return ENOSYS +} + +// Symlink implements FS.Symlink +func (UnimplementedFS) Symlink(_, _ string) Errno { + return ENOSYS +} + +// Unlink implements FS.Unlink +func (UnimplementedFS) Unlink(path string) Errno { + return ENOSYS +} + +// Utimens implements FS.Utimens +func (UnimplementedFS) Utimens(path string, atim, mtim int64) Errno { + return ENOSYS +} + +// UnimplementedFile is a File that returns ENOSYS for all functions, +// except where no-op are otherwise documented. +// +// This should be embedded to have forward compatible implementations. +type UnimplementedFile struct{} + +// Dev implements File.Dev +func (UnimplementedFile) Dev() (uint64, Errno) { + return 0, 0 +} + +// Ino implements File.Ino +func (UnimplementedFile) Ino() (sys.Inode, Errno) { + return 0, 0 +} + +// IsDir implements File.IsDir +func (UnimplementedFile) IsDir() (bool, Errno) { + return false, 0 +} + +// IsAppend implements File.IsAppend +func (UnimplementedFile) IsAppend() bool { + return false +} + +// SetAppend implements File.SetAppend +func (UnimplementedFile) SetAppend(bool) Errno { + return ENOSYS +} + +// Stat implements File.Stat +func (UnimplementedFile) Stat() (sys.Stat_t, Errno) { + return sys.Stat_t{}, ENOSYS +} + +// Read implements File.Read +func (UnimplementedFile) Read([]byte) (int, Errno) { + return 0, ENOSYS +} + +// Pread implements File.Pread +func (UnimplementedFile) Pread([]byte, int64) (int, Errno) { + return 0, ENOSYS +} + +// Seek implements File.Seek +func (UnimplementedFile) Seek(int64, int) (int64, Errno) { + return 0, ENOSYS +} + +// Readdir implements File.Readdir +func (UnimplementedFile) Readdir(int) (dirents []Dirent, errno Errno) { + return nil, ENOSYS +} + +// Write implements File.Write +func (UnimplementedFile) Write([]byte) (int, Errno) { + return 0, ENOSYS +} + +// Pwrite implements File.Pwrite +func (UnimplementedFile) Pwrite([]byte, int64) (int, Errno) { + return 0, ENOSYS +} + +// Truncate implements File.Truncate +func (UnimplementedFile) Truncate(int64) Errno { + return ENOSYS +} + +// Sync implements File.Sync +func (UnimplementedFile) Sync() Errno { + return 0 // not ENOSYS +} + +// Datasync implements File.Datasync +func (UnimplementedFile) Datasync() Errno { + return 0 // not ENOSYS +} + +// Utimens implements File.Utimens +func (UnimplementedFile) Utimens(int64, int64) Errno { + return ENOSYS +} + +// Close implements File.Close +func (UnimplementedFile) Close() (errno Errno) { return } diff --git a/vendor/github.com/tetratelabs/wazero/fsconfig.go b/vendor/github.com/tetratelabs/wazero/fsconfig.go new file mode 100644 index 000000000..c28909e19 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/fsconfig.go @@ -0,0 +1,215 @@ +package wazero + +import ( + "io/fs" + + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/sys" + "github.com/tetratelabs/wazero/internal/sysfs" +) + +// FSConfig configures filesystem paths the embedding host allows the wasm +// guest to access. Unconfigured paths are not allowed, so functions like +// `path_open` result in unsupported errors (e.g. syscall.ENOSYS). +// +// # Guest Path +// +// `guestPath` is the name of the path the guest should use a filesystem for, or +// empty for any files. +// +// All `guestPath` paths are normalized, specifically removing any leading or +// trailing slashes. This means "/", "./" or "." all coerce to empty "". +// +// Multiple `guestPath` values can be configured, but the last longest match +// wins. For example, if "tmp", then "" were added, a request to open +// "tmp/foo.txt" use the filesystem associated with "tmp" even though a wider +// path, "" (all files), was added later. +// +// A `guestPath` of "." coerces to the empty string "" because the current +// directory is handled by the guest. In other words, the guest resolves ites +// current directory prior to requesting files. +// +// More notes on `guestPath` +// - Go compiled with runtime.GOOS=js do not pay attention to this value. +// It only works with root mounts (""). +// - Working directories are typically tracked in wasm, though possible some +// relative paths are requested. For example, TinyGo may attempt to resolve +// a path "../.." in unit tests. +// - Zig uses the first path name it sees as the initial working directory of +// the process. +// +// # Scope +// +// Configuration here is module instance scoped. This means you can use the +// same configuration for multiple calls to Runtime.InstantiateModule. Each +// module will have a different file descriptor table. Any errors accessing +// resources allowed here are deferred to instantiation time of each module. +// +// Any host resources present at the time of configuration, but deleted before +// Runtime.InstantiateModule will trap/panic when the guest wasm initializes or +// calls functions like `fd_read`. +// +// # Windows +// +// While wazero supports Windows as a platform, all known compilers use POSIX +// conventions at runtime. For example, even when running on Windows, paths +// used by wasm are separated by forward slash (/), not backslash (\). +// +// # Notes +// +// - This is an interface for decoupling, not third-party implementations. +// All implementations are in wazero. +// - FSConfig is immutable. Each WithXXX function returns a new instance +// including the corresponding change. +// - RATIONALE.md includes design background and relationship to WebAssembly +// System Interfaces (WASI). +type FSConfig interface { + // WithDirMount assigns a directory at `dir` to any paths beginning at + // `guestPath`. + // + // For example, `dirPath` as / (or c:\ in Windows), makes the entire host + // volume writeable to the path on the guest. The `guestPath` is always a + // POSIX style path, slash (/) delimited, even if run on Windows. + // + // If the same `guestPath` was assigned before, this overrides its value, + // retaining the original precedence. See the documentation of FSConfig for + // more details on `guestPath`. + // + // # Isolation + // + // The guest will have full access to this directory including escaping it + // via relative path lookups like "../../". Full access includes operations + // such as creating or deleting files, limited to any host level access + // controls. + // + // # os.DirFS + // + // This configuration optimizes for WASI compatability which is sometimes + // at odds with the behavior of os.DirFS. Hence, this will not behave + // exactly the same as os.DirFS. See /RATIONALE.md for more. + WithDirMount(dir, guestPath string) FSConfig + + // WithReadOnlyDirMount assigns a directory at `dir` to any paths + // beginning at `guestPath`. + // + // This is the same as WithDirMount except only read operations are + // permitted. However, escaping the directory via relative path lookups + // like "../../" is still allowed. + WithReadOnlyDirMount(dir, guestPath string) FSConfig + + // WithFSMount assigns a fs.FS file system for any paths beginning at + // `guestPath`. + // + // If the same `guestPath` was assigned before, this overrides its value, + // retaining the original precedence. See the documentation of FSConfig for + // more details on `guestPath`. + // + // # Isolation + // + // fs.FS does not restrict the ability to overwrite returned files via + // io.Writer. Moreover, os.DirFS documentation includes important notes + // about isolation, which also applies to fs.Sub. As of Go 1.19, the + // built-in file-systems are not jailed (chroot). See + // https://github.com/golang/go/issues/42322 + // + // # os.DirFS + // + // Due to limited control and functionality available in os.DirFS, we + // advise using WithDirMount instead. There will be behavior differences + // between os.DirFS and WithDirMount, as the latter biases towards what's + // expected from WASI implementations. + // + // # Custom fs.FileInfo + // + // The underlying implementation supports data not usually in fs.FileInfo + // when `info.Sys` returns *sys.Stat_t. For example, a custom fs.FS can use + // this approach to generate or mask sys.Inode data. Such a filesystem + // needs to decorate any functions that can return fs.FileInfo: + // + // - `Stat` as defined on `fs.File` (always) + // - `Readdir` as defined on `os.File` (if defined) + // + // See sys.NewStat_t for examples. + WithFSMount(fs fs.FS, guestPath string) FSConfig +} + +type fsConfig struct { + // fs are the currently configured filesystems. + fs []experimentalsys.FS + // guestPaths are the user-supplied names of the filesystems, retained for + // error messages and fmt.Stringer. + guestPaths []string + // guestPathToFS are the normalized paths to the currently configured + // filesystems, used for de-duplicating. + guestPathToFS map[string]int +} + +// NewFSConfig returns a FSConfig that can be used for configuring module instantiation. +func NewFSConfig() FSConfig { + return &fsConfig{guestPathToFS: map[string]int{}} +} + +// clone makes a deep copy of this module config. +func (c *fsConfig) clone() *fsConfig { + ret := *c // copy except slice and maps which share a ref + ret.fs = make([]experimentalsys.FS, 0, len(c.fs)) + ret.fs = append(ret.fs, c.fs...) + ret.guestPaths = make([]string, 0, len(c.guestPaths)) + ret.guestPaths = append(ret.guestPaths, c.guestPaths...) + ret.guestPathToFS = make(map[string]int, len(c.guestPathToFS)) + for key, value := range c.guestPathToFS { + ret.guestPathToFS[key] = value + } + return &ret +} + +// WithDirMount implements FSConfig.WithDirMount +func (c *fsConfig) WithDirMount(dir, guestPath string) FSConfig { + return c.WithSysFSMount(sysfs.DirFS(dir), guestPath) +} + +// WithReadOnlyDirMount implements FSConfig.WithReadOnlyDirMount +func (c *fsConfig) WithReadOnlyDirMount(dir, guestPath string) FSConfig { + return c.WithSysFSMount(&sysfs.ReadFS{FS: sysfs.DirFS(dir)}, guestPath) +} + +// WithFSMount implements FSConfig.WithFSMount +func (c *fsConfig) WithFSMount(fs fs.FS, guestPath string) FSConfig { + var adapted experimentalsys.FS + if fs != nil { + adapted = &sysfs.AdaptFS{FS: fs} + } + return c.WithSysFSMount(adapted, guestPath) +} + +// WithSysFSMount implements sysfs.FSConfig +func (c *fsConfig) WithSysFSMount(fs experimentalsys.FS, guestPath string) FSConfig { + if _, ok := fs.(experimentalsys.UnimplementedFS); ok { + return c // don't add fake paths. + } + cleaned := sys.StripPrefixesAndTrailingSlash(guestPath) + ret := c.clone() + if i, ok := ret.guestPathToFS[cleaned]; ok { + ret.fs[i] = fs + ret.guestPaths[i] = guestPath + } else if fs != nil { + ret.guestPathToFS[cleaned] = len(ret.fs) + ret.fs = append(ret.fs, fs) + ret.guestPaths = append(ret.guestPaths, guestPath) + } + return ret +} + +// preopens returns the possible nil index-correlated preopened filesystems +// with guest paths. +func (c *fsConfig) preopens() ([]experimentalsys.FS, []string) { + preopenCount := len(c.fs) + if preopenCount == 0 { + return nil, nil + } + fs := make([]experimentalsys.FS, len(c.fs)) + copy(fs, c.fs) + guestPaths := make([]string, len(c.guestPaths)) + copy(guestPaths, c.guestPaths) + return fs, guestPaths +} diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/args.go b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/args.go new file mode 100644 index 000000000..4c82e95e2 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/args.go @@ -0,0 +1,97 @@ +package wasi_snapshot_preview1 + +import ( + "context" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/wasip1" + "github.com/tetratelabs/wazero/internal/wasm" +) + +// argsGet is the WASI function named ArgsGetName that reads command-line +// argument data. +// +// # Parameters +// +// - argv: offset to begin writing argument offsets in uint32 little-endian +// encoding to api.Memory +// - argsSizesGet result argc * 4 bytes are written to this offset +// - argvBuf: offset to write the null terminated arguments to api.Memory +// - argsSizesGet result argv_len bytes are written to this offset +// +// Result (Errno) +// +// The return value is ErrnoSuccess except the following error conditions: +// - sys.EFAULT: there is not enough memory to write results +// +// For example, if argsSizesGet wrote argc=2 and argvLen=5 for arguments: +// "a" and "bc" parameters argv=7 and argvBuf=1, this function writes the below +// to api.Memory: +// +// argvLen uint32le uint32le +// +----------------+ +--------+ +--------+ +// | | | | | | +// []byte{?, 'a', 0, 'b', 'c', 0, ?, 1, 0, 0, 0, 3, 0, 0, 0, ?} +// argvBuf --^ ^ ^ +// argv --| | +// offset that begins "a" --+ | +// offset that begins "bc" --+ +// +// See argsSizesGet +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#args_get +// See https://en.wikipedia.org/wiki/Null-terminated_string +var argsGet = newHostFunc(wasip1.ArgsGetName, argsGetFn, []api.ValueType{i32, i32}, "argv", "argv_buf") + +func argsGetFn(_ context.Context, mod api.Module, params []uint64) sys.Errno { + sysCtx := mod.(*wasm.ModuleInstance).Sys + argv, argvBuf := uint32(params[0]), uint32(params[1]) + return writeOffsetsAndNullTerminatedValues(mod.Memory(), sysCtx.Args(), argv, argvBuf, sysCtx.ArgsSize()) +} + +// argsSizesGet is the WASI function named ArgsSizesGetName that reads +// command-line argument sizes. +// +// # Parameters +// +// - resultArgc: offset to write the argument count to api.Memory +// - resultArgvLen: offset to write the null-terminated argument length to +// api.Memory +// +// Result (Errno) +// +// The return value is ErrnoSuccess except the following error conditions: +// - sys.EFAULT: there is not enough memory to write results +// +// For example, if args are "a", "bc" and parameters resultArgc=1 and +// resultArgvLen=6, this function writes the below to api.Memory: +// +// uint32le uint32le +// +--------+ +--------+ +// | | | | +// []byte{?, 2, 0, 0, 0, ?, 5, 0, 0, 0, ?} +// resultArgc --^ ^ +// 2 args --+ | +// resultArgvLen --| +// len([]byte{'a',0,'b',c',0}) --+ +// +// See argsGet +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#args_sizes_get +// See https://en.wikipedia.org/wiki/Null-terminated_string +var argsSizesGet = newHostFunc(wasip1.ArgsSizesGetName, argsSizesGetFn, []api.ValueType{i32, i32}, "result.argc", "result.argv_len") + +func argsSizesGetFn(_ context.Context, mod api.Module, params []uint64) sys.Errno { + sysCtx := mod.(*wasm.ModuleInstance).Sys + mem := mod.Memory() + resultArgc, resultArgvLen := uint32(params[0]), uint32(params[1]) + + // argc and argv_len offsets are not necessarily sequential, so we have to + // write them independently. + if !mem.WriteUint32Le(resultArgc, uint32(len(sysCtx.Args()))) { + return sys.EFAULT + } + if !mem.WriteUint32Le(resultArgvLen, sysCtx.ArgsSize()) { + return sys.EFAULT + } + return 0 +} diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/clock.go b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/clock.go new file mode 100644 index 000000000..31af91071 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/clock.go @@ -0,0 +1,116 @@ +package wasi_snapshot_preview1 + +import ( + "context" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/wasip1" + "github.com/tetratelabs/wazero/internal/wasm" +) + +// clockResGet is the WASI function named ClockResGetName that returns the +// resolution of time values returned by clockTimeGet. +// +// # Parameters +// +// - id: clock ID to use +// - resultResolution: offset to write the resolution to api.Memory +// - the resolution is an uint64 little-endian encoding +// +// Result (Errno) +// +// The return value is 0 except the following error conditions: +// - sys.ENOTSUP: the clock ID is not supported. +// - sys.EINVAL: the clock ID is invalid. +// - sys.EFAULT: there is not enough memory to write results +// +// For example, if the resolution is 100ns, this function writes the below to +// api.Memory: +// +// uint64le +// +-------------------------------------+ +// | | +// []byte{?, 0x64, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ?} +// resultResolution --^ +// +// Note: This is similar to `clock_getres` in POSIX. +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-clock_res_getid-clockid---errno-timestamp +// See https://linux.die.net/man/3/clock_getres +var clockResGet = newHostFunc(wasip1.ClockResGetName, clockResGetFn, []api.ValueType{i32, i32}, "id", "result.resolution") + +func clockResGetFn(_ context.Context, mod api.Module, params []uint64) sys.Errno { + sysCtx := mod.(*wasm.ModuleInstance).Sys + id, resultResolution := uint32(params[0]), uint32(params[1]) + + var resolution uint64 // ns + switch id { + case wasip1.ClockIDRealtime: + resolution = uint64(sysCtx.WalltimeResolution()) + case wasip1.ClockIDMonotonic: + resolution = uint64(sysCtx.NanotimeResolution()) + default: + return sys.EINVAL + } + + if !mod.Memory().WriteUint64Le(resultResolution, resolution) { + return sys.EFAULT + } + return 0 +} + +// clockTimeGet is the WASI function named ClockTimeGetName that returns +// the time value of a name (time.Now). +// +// # Parameters +// +// - id: clock ID to use +// - precision: maximum lag (exclusive) that the returned time value may have, +// compared to its actual value +// - resultTimestamp: offset to write the timestamp to api.Memory +// - the timestamp is epoch nanos encoded as a little-endian uint64 +// +// Result (Errno) +// +// The return value is 0 except the following error conditions: +// - sys.ENOTSUP: the clock ID is not supported. +// - sys.EINVAL: the clock ID is invalid. +// - sys.EFAULT: there is not enough memory to write results +// +// For example, if time.Now returned exactly midnight UTC 2022-01-01 +// (1640995200000000000), and parameters resultTimestamp=1, this function +// writes the below to api.Memory: +// +// uint64le +// +------------------------------------------+ +// | | +// []byte{?, 0x0, 0x0, 0x1f, 0xa6, 0x70, 0xfc, 0xc5, 0x16, ?} +// resultTimestamp --^ +// +// Note: This is similar to `clock_gettime` in POSIX. +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-clock_time_getid-clockid-precision-timestamp---errno-timestamp +// See https://linux.die.net/man/3/clock_gettime +var clockTimeGet = newHostFunc(wasip1.ClockTimeGetName, clockTimeGetFn, []api.ValueType{i32, i64, i32}, "id", "precision", "result.timestamp") + +func clockTimeGetFn(_ context.Context, mod api.Module, params []uint64) sys.Errno { + sysCtx := mod.(*wasm.ModuleInstance).Sys + id := uint32(params[0]) + // TODO: precision is currently ignored. + // precision = params[1] + resultTimestamp := uint32(params[2]) + + var val int64 + switch id { + case wasip1.ClockIDRealtime: + val = sysCtx.WalltimeNanos() + case wasip1.ClockIDMonotonic: + val = sysCtx.Nanotime() + default: + return sys.EINVAL + } + + if !mod.Memory().WriteUint64Le(resultTimestamp, uint64(val)) { + return sys.EFAULT + } + return 0 +} diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/environ.go b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/environ.go new file mode 100644 index 000000000..ec8df708a --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/environ.go @@ -0,0 +1,100 @@ +package wasi_snapshot_preview1 + +import ( + "context" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/wasip1" + "github.com/tetratelabs/wazero/internal/wasm" +) + +// environGet is the WASI function named EnvironGetName that reads +// environment variables. +// +// # Parameters +// +// - environ: offset to begin writing environment offsets in uint32 +// little-endian encoding to api.Memory +// - environSizesGet result environc * 4 bytes are written to this offset +// - environBuf: offset to write the null-terminated variables to api.Memory +// - the format is like os.Environ: null-terminated "key=val" entries +// - environSizesGet result environLen bytes are written to this offset +// +// Result (Errno) +// +// The return value is 0 except the following error conditions: +// - sys.EFAULT: there is not enough memory to write results +// +// For example, if environSizesGet wrote environc=2 and environLen=9 for +// environment variables: "a=b", "b=cd" and parameters environ=11 and +// environBuf=1, this function writes the below to api.Memory: +// +// environLen uint32le uint32le +// +------------------------------------+ +--------+ +--------+ +// | | | | | | +// []byte{?, 'a', '=', 'b', 0, 'b', '=', 'c', 'd', 0, ?, 1, 0, 0, 0, 5, 0, 0, 0, ?} +// environBuf --^ ^ ^ +// environ offset for "a=b" --+ | +// environ offset for "b=cd" --+ +// +// See environSizesGet +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#environ_get +// See https://en.wikipedia.org/wiki/Null-terminated_string +var environGet = newHostFunc(wasip1.EnvironGetName, environGetFn, []api.ValueType{i32, i32}, "environ", "environ_buf") + +func environGetFn(_ context.Context, mod api.Module, params []uint64) sys.Errno { + sysCtx := mod.(*wasm.ModuleInstance).Sys + environ, environBuf := uint32(params[0]), uint32(params[1]) + + return writeOffsetsAndNullTerminatedValues(mod.Memory(), sysCtx.Environ(), environ, environBuf, sysCtx.EnvironSize()) +} + +// environSizesGet is the WASI function named EnvironSizesGetName that +// reads environment variable sizes. +// +// # Parameters +// +// - resultEnvironc: offset to write the count of environment variables to +// api.Memory +// - resultEnvironvLen: offset to write the null-terminated environment +// variable length to api.Memory +// +// Result (Errno) +// +// The return value is 0 except the following error conditions: +// - sys.EFAULT: there is not enough memory to write results +// +// For example, if environ are "a=b","b=cd" and parameters resultEnvironc=1 and +// resultEnvironvLen=6, this function writes the below to api.Memory: +// +// uint32le uint32le +// +--------+ +--------+ +// | | | | +// []byte{?, 2, 0, 0, 0, ?, 9, 0, 0, 0, ?} +// resultEnvironc --^ ^ +// 2 variables --+ | +// resultEnvironvLen --| +// len([]byte{'a','=','b',0, | +// 'b','=','c','d',0}) --+ +// +// See environGet +// https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#environ_sizes_get +// and https://en.wikipedia.org/wiki/Null-terminated_string +var environSizesGet = newHostFunc(wasip1.EnvironSizesGetName, environSizesGetFn, []api.ValueType{i32, i32}, "result.environc", "result.environv_len") + +func environSizesGetFn(_ context.Context, mod api.Module, params []uint64) sys.Errno { + sysCtx := mod.(*wasm.ModuleInstance).Sys + mem := mod.Memory() + resultEnvironc, resultEnvironvLen := uint32(params[0]), uint32(params[1]) + + // environc and environv_len offsets are not necessarily sequential, so we + // have to write them independently. + if !mem.WriteUint32Le(resultEnvironc, uint32(len(sysCtx.Environ()))) { + return sys.EFAULT + } + if !mem.WriteUint32Le(resultEnvironvLen, sysCtx.EnvironSize()) { + return sys.EFAULT + } + return 0 +} diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/fs.go b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/fs.go new file mode 100644 index 000000000..384036a27 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/fs.go @@ -0,0 +1,2013 @@ +package wasi_snapshot_preview1 + +import ( + "context" + "io" + "io/fs" + "math" + "path" + "strings" + "unsafe" + + "github.com/tetratelabs/wazero/api" + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" + socketapi "github.com/tetratelabs/wazero/internal/sock" + "github.com/tetratelabs/wazero/internal/sys" + "github.com/tetratelabs/wazero/internal/wasip1" + "github.com/tetratelabs/wazero/internal/wasm" + sysapi "github.com/tetratelabs/wazero/sys" +) + +// fdAdvise is the WASI function named FdAdviseName which provides file +// advisory information on a file descriptor. +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-fd_advisefd-fd-offset-filesize-len-filesize-advice-advice---errno +var fdAdvise = newHostFunc( + wasip1.FdAdviseName, fdAdviseFn, + []wasm.ValueType{i32, i64, i64, i32}, + "fd", "offset", "len", "advice", +) + +func fdAdviseFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fd := int32(params[0]) + _ = params[1] + _ = params[2] + advice := byte(params[3]) + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + + _, ok := fsc.LookupFile(fd) + if !ok { + return experimentalsys.EBADF + } + + switch advice { + case wasip1.FdAdviceNormal, + wasip1.FdAdviceSequential, + wasip1.FdAdviceRandom, + wasip1.FdAdviceWillNeed, + wasip1.FdAdviceDontNeed, + wasip1.FdAdviceNoReuse: + default: + return experimentalsys.EINVAL + } + + // FdAdvice corresponds to posix_fadvise, but it can only be supported on linux. + // However, the purpose of the call is just to do best-effort optimization on OS kernels, + // so just making this noop rather than returning NoSup error makes sense and doesn't affect + // the semantics of Wasm applications. + // TODO: invoke posix_fadvise on linux, and partially on darwin. + // - https://gitlab.com/cznic/fileutil/-/blob/v1.1.2/fileutil_linux.go#L87-95 + // - https://github.com/bytecodealliance/system-interface/blob/62b97f9776b86235f318c3a6e308395a1187439b/src/fs/file_io_ext.rs#L430-L442 + return 0 +} + +// fdAllocate is the WASI function named FdAllocateName which forces the +// allocation of space in a file. +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-fd_allocatefd-fd-offset-filesize-len-filesize---errno +var fdAllocate = newHostFunc( + wasip1.FdAllocateName, fdAllocateFn, + []wasm.ValueType{i32, i64, i64}, + "fd", "offset", "len", +) + +func fdAllocateFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fd := int32(params[0]) + offset := params[1] + length := params[2] + + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + f, ok := fsc.LookupFile(fd) + if !ok { + return experimentalsys.EBADF + } + + tail := int64(offset + length) + if tail < 0 { + return experimentalsys.EINVAL + } + + st, errno := f.File.Stat() + if errno != 0 { + return errno + } + + if st.Size >= tail { + return 0 // We already have enough space. + } + + return f.File.Truncate(tail) +} + +// fdClose is the WASI function named FdCloseName which closes a file +// descriptor. +// +// # Parameters +// +// - fd: file descriptor to close +// +// Result (Errno) +// +// The return value is 0 except the following error conditions: +// - sys.EBADF: the fd was not open. +// - sys.ENOTSUP: the fs was a pre-open +// +// Note: This is similar to `close` in POSIX. +// See https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md#fd_close +// and https://linux.die.net/man/3/close +var fdClose = newHostFunc(wasip1.FdCloseName, fdCloseFn, []api.ValueType{i32}, "fd") + +func fdCloseFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + fd := int32(params[0]) + + return fsc.CloseFile(fd) +} + +// fdDatasync is the WASI function named FdDatasyncName which synchronizes +// the data of a file to disk. +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-fd_datasyncfd-fd---errno +var fdDatasync = newHostFunc(wasip1.FdDatasyncName, fdDatasyncFn, []api.ValueType{i32}, "fd") + +func fdDatasyncFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + fd := int32(params[0]) + + // Check to see if the file descriptor is available + if f, ok := fsc.LookupFile(fd); !ok { + return experimentalsys.EBADF + } else { + return f.File.Datasync() + } +} + +// fdFdstatGet is the WASI function named FdFdstatGetName which returns the +// attributes of a file descriptor. +// +// # Parameters +// +// - fd: file descriptor to get the fdstat attributes data +// - resultFdstat: offset to write the result fdstat data +// +// Result (Errno) +// +// The return value is 0 except the following error conditions: +// - sys.EBADF: `fd` is invalid +// - sys.EFAULT: `resultFdstat` points to an offset out of memory +// +// fdstat byte layout is 24-byte size, with the following fields: +// - fs_filetype 1 byte: the file type +// - fs_flags 2 bytes: the file descriptor flag +// - 5 pad bytes +// - fs_right_base 8 bytes: ignored as rights were removed from WASI. +// - fs_right_inheriting 8 bytes: ignored as rights were removed from WASI. +// +// For example, with a file corresponding with `fd` was a directory (=3) opened +// with `fd_read` right (=1) and no fs_flags (=0), parameter resultFdstat=1, +// this function writes the below to api.Memory: +// +// uint16le padding uint64le uint64le +// uint8 --+ +--+ +-----------+ +--------------------+ +--------------------+ +// | | | | | | | | | +// []byte{?, 3, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0} +// resultFdstat --^ ^-- fs_flags ^-- fs_right_base ^-- fs_right_inheriting +// | +// +-- fs_filetype +// +// Note: fdFdstatGet returns similar flags to `fsync(fd, F_GETFL)` in POSIX, as +// well as additional fields. +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#fdstat +// and https://linux.die.net/man/3/fsync +var fdFdstatGet = newHostFunc(wasip1.FdFdstatGetName, fdFdstatGetFn, []api.ValueType{i32, i32}, "fd", "result.stat") + +// fdFdstatGetFn cannot currently use proxyResultParams because fdstat is larger +// than api.ValueTypeI64 (i64 == 8 bytes, but fdstat is 24). +func fdFdstatGetFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + + fd, resultFdstat := int32(params[0]), uint32(params[1]) + + // Ensure we can write the fdstat + buf, ok := mod.Memory().Read(resultFdstat, 24) + if !ok { + return experimentalsys.EFAULT + } + + var fdflags uint16 + var st sysapi.Stat_t + var errno experimentalsys.Errno + f, ok := fsc.LookupFile(fd) + if !ok { + return experimentalsys.EBADF + } else if st, errno = f.File.Stat(); errno != 0 { + return errno + } else if f.File.IsAppend() { + fdflags |= wasip1.FD_APPEND + } + + if f.File.IsNonblock() { + fdflags |= wasip1.FD_NONBLOCK + } + + var fsRightsBase uint32 + var fsRightsInheriting uint32 + fileType := getExtendedWasiFiletype(f.File, st.Mode) + + switch fileType { + case wasip1.FILETYPE_DIRECTORY: + // To satisfy wasi-testsuite, we must advertise that directories cannot + // be given seek permission (RIGHT_FD_SEEK). + fsRightsBase = dirRightsBase + fsRightsInheriting = fileRightsBase | dirRightsBase + case wasip1.FILETYPE_CHARACTER_DEVICE: + // According to wasi-libc, + // > A tty is a character device that we can't seek or tell on. + // See https://github.com/WebAssembly/wasi-libc/blob/a6f871343313220b76009827ed0153586361c0d5/libc-bottom-half/sources/isatty.c#L13-L18 + fsRightsBase = fileRightsBase &^ wasip1.RIGHT_FD_SEEK &^ wasip1.RIGHT_FD_TELL + default: + fsRightsBase = fileRightsBase + } + + writeFdstat(buf, fileType, fdflags, fsRightsBase, fsRightsInheriting) + return 0 +} + +// isPreopenedStdio returns true if the FD is sys.FdStdin, sys.FdStdout or +// sys.FdStderr and pre-opened. This double check is needed in case the guest +// closes stdin and re-opens it with a random alternative file. +// +// Currently, we only support non-blocking mode for standard I/O streams. +// Non-blocking mode is rarely supported for regular files, and we don't +// yet have support for sockets, so we make a special case. +// +// Note: this to get or set FD_NONBLOCK, but skip FD_APPEND. Our current +// implementation can't set FD_APPEND, without re-opening files. As stdio are +// pre-opened, we don't know how to re-open them, neither should we close the +// underlying file. Later, we could add support for setting FD_APPEND, similar +// to SetNonblock. +func isPreopenedStdio(fd int32, f *sys.FileEntry) bool { + return fd <= sys.FdStderr && f.IsPreopen +} + +const fileRightsBase = wasip1.RIGHT_FD_DATASYNC | + wasip1.RIGHT_FD_READ | + wasip1.RIGHT_FD_SEEK | + wasip1.RIGHT_FDSTAT_SET_FLAGS | + wasip1.RIGHT_FD_SYNC | + wasip1.RIGHT_FD_TELL | + wasip1.RIGHT_FD_WRITE | + wasip1.RIGHT_FD_ADVISE | + wasip1.RIGHT_FD_ALLOCATE | + wasip1.RIGHT_FD_FILESTAT_GET | + wasip1.RIGHT_FD_FILESTAT_SET_SIZE | + wasip1.RIGHT_FD_FILESTAT_SET_TIMES | + wasip1.RIGHT_POLL_FD_READWRITE + +const dirRightsBase = wasip1.RIGHT_FD_DATASYNC | + wasip1.RIGHT_FDSTAT_SET_FLAGS | + wasip1.RIGHT_FD_SYNC | + wasip1.RIGHT_PATH_CREATE_DIRECTORY | + wasip1.RIGHT_PATH_CREATE_FILE | + wasip1.RIGHT_PATH_LINK_SOURCE | + wasip1.RIGHT_PATH_LINK_TARGET | + wasip1.RIGHT_PATH_OPEN | + wasip1.RIGHT_FD_READDIR | + wasip1.RIGHT_PATH_READLINK | + wasip1.RIGHT_PATH_RENAME_SOURCE | + wasip1.RIGHT_PATH_RENAME_TARGET | + wasip1.RIGHT_PATH_FILESTAT_GET | + wasip1.RIGHT_PATH_FILESTAT_SET_SIZE | + wasip1.RIGHT_PATH_FILESTAT_SET_TIMES | + wasip1.RIGHT_FD_FILESTAT_GET | + wasip1.RIGHT_FD_FILESTAT_SET_TIMES | + wasip1.RIGHT_PATH_SYMLINK | + wasip1.RIGHT_PATH_REMOVE_DIRECTORY | + wasip1.RIGHT_PATH_UNLINK_FILE + +func writeFdstat(buf []byte, fileType uint8, fdflags uint16, fsRightsBase, fsRightsInheriting uint32) { + b := (*[24]byte)(buf) + le.PutUint16(b[0:], uint16(fileType)) + le.PutUint16(b[2:], fdflags) + le.PutUint32(b[4:], 0) + le.PutUint64(b[8:], uint64(fsRightsBase)) + le.PutUint64(b[16:], uint64(fsRightsInheriting)) +} + +// fdFdstatSetFlags is the WASI function named FdFdstatSetFlagsName which +// adjusts the flags associated with a file descriptor. +var fdFdstatSetFlags = newHostFunc(wasip1.FdFdstatSetFlagsName, fdFdstatSetFlagsFn, []wasm.ValueType{i32, i32}, "fd", "flags") + +func fdFdstatSetFlagsFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fd, wasiFlag := int32(params[0]), uint16(params[1]) + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + + // Currently we only support APPEND and NONBLOCK. + if wasip1.FD_DSYNC&wasiFlag != 0 || wasip1.FD_RSYNC&wasiFlag != 0 || wasip1.FD_SYNC&wasiFlag != 0 { + return experimentalsys.EINVAL + } + + if f, ok := fsc.LookupFile(fd); !ok { + return experimentalsys.EBADF + } else { + nonblock := wasip1.FD_NONBLOCK&wasiFlag != 0 + errno := f.File.SetNonblock(nonblock) + if errno != 0 { + return errno + } + if stat, err := f.File.Stat(); err == 0 && stat.Mode.IsRegular() { + // For normal files, proceed to apply an append flag. + append := wasip1.FD_APPEND&wasiFlag != 0 + return f.File.SetAppend(append) + } + } + + return 0 +} + +// fdFdstatSetRights will not be implemented as rights were removed from WASI. +// +// See https://github.com/bytecodealliance/wasmtime/pull/4666 +var fdFdstatSetRights = stubFunction( + wasip1.FdFdstatSetRightsName, + []wasm.ValueType{i32, i64, i64}, + "fd", "fs_rights_base", "fs_rights_inheriting", +) + +// fdFilestatGet is the WASI function named FdFilestatGetName which returns +// the stat attributes of an open file. +// +// # Parameters +// +// - fd: file descriptor to get the filestat attributes data for +// - resultFilestat: offset to write the result filestat data +// +// Result (Errno) +// +// The return value is 0 except the following error conditions: +// - sys.EBADF: `fd` is invalid +// - sys.EIO: could not stat `fd` on filesystem +// - sys.EFAULT: `resultFilestat` points to an offset out of memory +// +// filestat byte layout is 64-byte size, with the following fields: +// - dev 8 bytes: the device ID of device containing the file +// - ino 8 bytes: the file serial number +// - filetype 1 byte: the type of the file +// - 7 pad bytes +// - nlink 8 bytes: number of hard links to the file +// - size 8 bytes: for regular files, the file size in bytes. For symbolic links, the length in bytes of the pathname contained in the symbolic link +// - atim 8 bytes: ast data access timestamp +// - mtim 8 bytes: last data modification timestamp +// - ctim 8 bytes: ast file status change timestamp +// +// For example, with a regular file this function writes the below to api.Memory: +// +// uint8 --+ +// uint64le uint64le | padding uint64le uint64le uint64le uint64le uint64le +// +--------------------+ +--------------------+ | +-----------------+ +--------------------+ +-----------------------+ +----------------------------------+ +----------------------------------+ +----------------------------------+ +// | | | | | | | | | | | | | | | | | +// []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 80, 0, 0, 0, 0, 0, 0, 160, 153, 212, 128, 110, 221, 35, 23, 160, 153, 212, 128, 110, 221, 35, 23, 160, 153, 212, 128, 110, 221, 35, 23} +// resultFilestat ^-- dev ^-- ino ^ ^-- nlink ^-- size ^-- atim ^-- mtim ^-- ctim +// | +// +-- filetype +// +// The following properties of filestat are not implemented: +// - dev: not supported by Golang FS +// - ino: not supported by Golang FS +// - nlink: not supported by Golang FS, we use 1 +// - atime: not supported by Golang FS, we use mtim for this +// - ctim: not supported by Golang FS, we use mtim for this +// +// Note: This is similar to `fstat` in POSIX. +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-fd_filestat_getfd-fd---errno-filestat +// and https://linux.die.net/man/3/fstat +var fdFilestatGet = newHostFunc(wasip1.FdFilestatGetName, fdFilestatGetFn, []api.ValueType{i32, i32}, "fd", "result.filestat") + +// fdFilestatGetFn cannot currently use proxyResultParams because filestat is +// larger than api.ValueTypeI64 (i64 == 8 bytes, but filestat is 64). +func fdFilestatGetFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + return fdFilestatGetFunc(mod, int32(params[0]), uint32(params[1])) +} + +func fdFilestatGetFunc(mod api.Module, fd int32, resultBuf uint32) experimentalsys.Errno { + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + + // Ensure we can write the filestat + buf, ok := mod.Memory().Read(resultBuf, 64) + if !ok { + return experimentalsys.EFAULT + } + + f, ok := fsc.LookupFile(fd) + if !ok { + return experimentalsys.EBADF + } + + st, errno := f.File.Stat() + if errno != 0 { + return errno + } + + filetype := getExtendedWasiFiletype(f.File, st.Mode) + return writeFilestat(buf, &st, filetype) +} + +func getExtendedWasiFiletype(file experimentalsys.File, fm fs.FileMode) (ftype uint8) { + ftype = getWasiFiletype(fm) + if ftype == wasip1.FILETYPE_UNKNOWN { + if _, ok := file.(socketapi.TCPSock); ok { + ftype = wasip1.FILETYPE_SOCKET_STREAM + } else if _, ok = file.(socketapi.TCPConn); ok { + ftype = wasip1.FILETYPE_SOCKET_STREAM + } + } + return +} + +func getWasiFiletype(fm fs.FileMode) uint8 { + switch { + case fm.IsRegular(): + return wasip1.FILETYPE_REGULAR_FILE + case fm.IsDir(): + return wasip1.FILETYPE_DIRECTORY + case fm&fs.ModeSymlink != 0: + return wasip1.FILETYPE_SYMBOLIC_LINK + case fm&fs.ModeDevice != 0: + // Unlike ModeDevice and ModeCharDevice, FILETYPE_CHARACTER_DEVICE and + // FILETYPE_BLOCK_DEVICE are set mutually exclusively. + if fm&fs.ModeCharDevice != 0 { + return wasip1.FILETYPE_CHARACTER_DEVICE + } + return wasip1.FILETYPE_BLOCK_DEVICE + default: // unknown + return wasip1.FILETYPE_UNKNOWN + } +} + +func writeFilestat(buf []byte, st *sysapi.Stat_t, ftype uint8) (errno experimentalsys.Errno) { + le.PutUint64(buf, st.Dev) + le.PutUint64(buf[8:], st.Ino) + le.PutUint64(buf[16:], uint64(ftype)) + le.PutUint64(buf[24:], st.Nlink) + le.PutUint64(buf[32:], uint64(st.Size)) + le.PutUint64(buf[40:], uint64(st.Atim)) + le.PutUint64(buf[48:], uint64(st.Mtim)) + le.PutUint64(buf[56:], uint64(st.Ctim)) + return +} + +// fdFilestatSetSize is the WASI function named FdFilestatSetSizeName which +// adjusts the size of an open file. +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-fd_filestat_set_sizefd-fd-size-filesize---errno +var fdFilestatSetSize = newHostFunc(wasip1.FdFilestatSetSizeName, fdFilestatSetSizeFn, []wasm.ValueType{i32, i64}, "fd", "size") + +func fdFilestatSetSizeFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fd := int32(params[0]) + size := int64(params[1]) + + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + + // Check to see if the file descriptor is available + if f, ok := fsc.LookupFile(fd); !ok { + return experimentalsys.EBADF + } else { + return f.File.Truncate(size) + } +} + +// fdFilestatSetTimes is the WASI function named functionFdFilestatSetTimes +// which adjusts the times of an open file. +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-fd_filestat_set_timesfd-fd-atim-timestamp-mtim-timestamp-fst_flags-fstflags---errno +var fdFilestatSetTimes = newHostFunc( + wasip1.FdFilestatSetTimesName, fdFilestatSetTimesFn, + []wasm.ValueType{i32, i64, i64, i32}, + "fd", "atim", "mtim", "fst_flags", +) + +func fdFilestatSetTimesFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fd := int32(params[0]) + atim := int64(params[1]) + mtim := int64(params[2]) + fstFlags := uint16(params[3]) + + sys := mod.(*wasm.ModuleInstance).Sys + fsc := sys.FS() + + f, ok := fsc.LookupFile(fd) + if !ok { + return experimentalsys.EBADF + } + + atim, mtim, errno := toTimes(sys.WalltimeNanos, atim, mtim, fstFlags) + if errno != 0 { + return errno + } + + // Try to update the file timestamps by file-descriptor. + errno = f.File.Utimens(atim, mtim) + + // Fall back to path based, despite it being less precise. + switch errno { + case experimentalsys.EPERM, experimentalsys.ENOSYS: + errno = f.FS.Utimens(f.Name, atim, mtim) + } + + return errno +} + +func toTimes(walltime func() int64, atim, mtim int64, fstFlags uint16) (int64, int64, experimentalsys.Errno) { + // times[0] == atim, times[1] == mtim + + var nowTim int64 + + // coerce atim into a timespec + if set, now := fstFlags&wasip1.FstflagsAtim != 0, fstFlags&wasip1.FstflagsAtimNow != 0; set && now { + return 0, 0, experimentalsys.EINVAL + } else if set { + // atim is already correct + } else if now { + nowTim = walltime() + atim = nowTim + } else { + atim = experimentalsys.UTIME_OMIT + } + + // coerce mtim into a timespec + if set, now := fstFlags&wasip1.FstflagsMtim != 0, fstFlags&wasip1.FstflagsMtimNow != 0; set && now { + return 0, 0, experimentalsys.EINVAL + } else if set { + // mtim is already correct + } else if now { + if nowTim != 0 { + mtim = nowTim + } else { + mtim = walltime() + } + } else { + mtim = experimentalsys.UTIME_OMIT + } + return atim, mtim, 0 +} + +// fdPread is the WASI function named FdPreadName which reads from a file +// descriptor, without using and updating the file descriptor's offset. +// +// Except for handling offset, this implementation is identical to fdRead. +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-fd_preadfd-fd-iovs-iovec_array-offset-filesize---errno-size +var fdPread = newHostFunc( + wasip1.FdPreadName, fdPreadFn, + []api.ValueType{i32, i32, i32, i64, i32}, + "fd", "iovs", "iovs_len", "offset", "result.nread", +) + +func fdPreadFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + return fdReadOrPread(mod, params, true) +} + +// fdPrestatGet is the WASI function named FdPrestatGetName which returns +// the prestat data of a file descriptor. +// +// # Parameters +// +// - fd: file descriptor to get the prestat +// - resultPrestat: offset to write the result prestat data +// +// Result (Errno) +// +// The return value is 0 except the following error conditions: +// - sys.EBADF: `fd` is invalid or the `fd` is not a pre-opened directory +// - sys.EFAULT: `resultPrestat` points to an offset out of memory +// +// prestat byte layout is 8 bytes, beginning with an 8-bit tag and 3 pad bytes. +// The only valid tag is `prestat_dir`, which is tag zero. This simplifies the +// byte layout to 4 empty bytes followed by the uint32le encoded path length. +// +// For example, the directory name corresponding with `fd` was "/tmp" and +// parameter resultPrestat=1, this function writes the below to api.Memory: +// +// padding uint32le +// uint8 --+ +-----+ +--------+ +// | | | | | +// []byte{?, 0, 0, 0, 0, 4, 0, 0, 0, ?} +// resultPrestat --^ ^ +// tag --+ | +// +-- size in bytes of the string "/tmp" +// +// See fdPrestatDirName and +// https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#prestat +var fdPrestatGet = newHostFunc(wasip1.FdPrestatGetName, fdPrestatGetFn, []api.ValueType{i32, i32}, "fd", "result.prestat") + +func fdPrestatGetFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + fd, resultPrestat := int32(params[0]), uint32(params[1]) + + name, errno := preopenPath(fsc, fd) + if errno != 0 { + return errno + } + + // Upper 32-bits are zero because... + // * Zero-value 8-bit tag, and 3-byte zero-value padding + prestat := uint64(len(name) << 32) + if !mod.Memory().WriteUint64Le(resultPrestat, prestat) { + return experimentalsys.EFAULT + } + return 0 +} + +// fdPrestatDirName is the WASI function named FdPrestatDirNameName which +// returns the path of the pre-opened directory of a file descriptor. +// +// # Parameters +// +// - fd: file descriptor to get the path of the pre-opened directory +// - path: offset in api.Memory to write the result path +// - pathLen: count of bytes to write to `path` +// - This should match the uint32le fdPrestatGet writes to offset +// `resultPrestat`+4 +// +// Result (Errno) +// +// The return value is 0 except the following error conditions: +// - sys.EBADF: `fd` is invalid +// - sys.EFAULT: `path` points to an offset out of memory +// - sys.ENAMETOOLONG: `pathLen` is longer than the actual length of the result +// +// For example, the directory name corresponding with `fd` was "/tmp" and +// # Parameters path=1 pathLen=4 (correct), this function will write the below to +// api.Memory: +// +// pathLen +// +--------------+ +// | | +// []byte{?, '/', 't', 'm', 'p', ?} +// path --^ +// +// See fdPrestatGet +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#fd_prestat_dir_name +var fdPrestatDirName = newHostFunc( + wasip1.FdPrestatDirNameName, fdPrestatDirNameFn, + []api.ValueType{i32, i32, i32}, + "fd", "result.path", "result.path_len", +) + +func fdPrestatDirNameFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + fd, path, pathLen := int32(params[0]), uint32(params[1]), uint32(params[2]) + + name, errno := preopenPath(fsc, fd) + if errno != 0 { + return errno + } + + // Some runtimes may have another semantics. See /RATIONALE.md + if uint32(len(name)) < pathLen { + return experimentalsys.ENAMETOOLONG + } + + if !mod.Memory().Write(path, []byte(name)[:pathLen]) { + return experimentalsys.EFAULT + } + return 0 +} + +// fdPwrite is the WASI function named FdPwriteName which writes to a file +// descriptor, without using and updating the file descriptor's offset. +// +// Except for handling offset, this implementation is identical to fdWrite. +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-fd_pwritefd-fd-iovs-ciovec_array-offset-filesize---errno-size +var fdPwrite = newHostFunc( + wasip1.FdPwriteName, fdPwriteFn, + []api.ValueType{i32, i32, i32, i64, i32}, + "fd", "iovs", "iovs_len", "offset", "result.nwritten", +) + +func fdPwriteFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + return fdWriteOrPwrite(mod, params, true) +} + +// fdRead is the WASI function named FdReadName which reads from a file +// descriptor. +// +// # Parameters +// +// - fd: an opened file descriptor to read data from +// - iovs: offset in api.Memory to read offset, size pairs representing where +// to write file data +// - Both offset and length are encoded as uint32le +// - iovsCount: count of memory offset, size pairs to read sequentially +// starting at iovs +// - resultNread: offset in api.Memory to write the number of bytes read +// +// Result (Errno) +// +// The return value is 0 except the following error conditions: +// - sys.EBADF: `fd` is invalid +// - sys.EFAULT: `iovs` or `resultNread` point to an offset out of memory +// - sys.EIO: a file system error +// +// For example, this function needs to first read `iovs` to determine where +// to write contents. If parameters iovs=1 iovsCount=2, this function reads two +// offset/length pairs from api.Memory: +// +// iovs[0] iovs[1] +// +---------------------+ +--------------------+ +// | uint32le uint32le| |uint32le uint32le| +// +---------+ +--------+ +--------+ +--------+ +// | | | | | | | | +// []byte{?, 18, 0, 0, 0, 4, 0, 0, 0, 23, 0, 0, 0, 2, 0, 0, 0, ?... } +// iovs --^ ^ ^ ^ +// | | | | +// offset --+ length --+ offset --+ length --+ +// +// If the contents of the `fd` parameter was "wazero" (6 bytes) and parameter +// resultNread=26, this function writes the below to api.Memory: +// +// iovs[0].length iovs[1].length +// +--------------+ +----+ uint32le +// | | | | +--------+ +// []byte{ 0..16, ?, 'w', 'a', 'z', 'e', ?, 'r', 'o', ?, 6, 0, 0, 0 } +// iovs[0].offset --^ ^ ^ +// iovs[1].offset --+ | +// resultNread --+ +// +// Note: This is similar to `readv` in POSIX. https://linux.die.net/man/3/readv +// +// See fdWrite +// and https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#fd_read +var fdRead = newHostFunc( + wasip1.FdReadName, fdReadFn, + []api.ValueType{i32, i32, i32, i32}, + "fd", "iovs", "iovs_len", "result.nread", +) + +// preader tracks an offset across multiple reads. +type preader struct { + f experimentalsys.File + offset int64 +} + +// Read implements the same function as documented on sys.File. +func (w *preader) Read(buf []byte) (n int, errno experimentalsys.Errno) { + if len(buf) == 0 { + return 0, 0 // less overhead on zero-length reads. + } + + n, err := w.f.Pread(buf, w.offset) + w.offset += int64(n) + return n, err +} + +func fdReadFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + return fdReadOrPread(mod, params, false) +} + +func fdReadOrPread(mod api.Module, params []uint64, isPread bool) experimentalsys.Errno { + mem := mod.Memory() + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + + fd := int32(params[0]) + iovs := uint32(params[1]) + iovsCount := uint32(params[2]) + + var resultNread uint32 + var reader func(buf []byte) (n int, errno experimentalsys.Errno) + if f, ok := fsc.LookupFile(fd); !ok { + return experimentalsys.EBADF + } else if isPread { + offset := int64(params[3]) + reader = (&preader{f: f.File, offset: offset}).Read + resultNread = uint32(params[4]) + } else { + reader = f.File.Read + resultNread = uint32(params[3]) + } + + nread, errno := readv(mem, iovs, iovsCount, reader) + if errno != 0 { + return errno + } + if !mem.WriteUint32Le(resultNread, nread) { + return experimentalsys.EFAULT + } else { + return 0 + } +} + +func readv(mem api.Memory, iovs uint32, iovsCount uint32, reader func(buf []byte) (nread int, errno experimentalsys.Errno)) (uint32, experimentalsys.Errno) { + var nread uint32 + iovsStop := iovsCount << 3 // iovsCount * 8 + iovsBuf, ok := mem.Read(iovs, iovsStop) + if !ok { + return 0, experimentalsys.EFAULT + } + + for iovsPos := uint32(0); iovsPos < iovsStop; iovsPos += 8 { + offset := le.Uint32(iovsBuf[iovsPos:]) + l := le.Uint32(iovsBuf[iovsPos+4:]) + + if l == 0 { // A zero length iovec could be ahead of another. + continue + } + + b, ok := mem.Read(offset, l) + if !ok { + return 0, experimentalsys.EFAULT + } + + n, errno := reader(b) + nread += uint32(n) + + if errno == experimentalsys.ENOSYS { + return 0, experimentalsys.EBADF // e.g. unimplemented for read + } else if errno != 0 { + return 0, errno + } else if n < int(l) { + break // stop when we read less than capacity. + } + } + return nread, 0 +} + +// fdReaddir is the WASI function named wasip1.FdReaddirName which reads +// directory entries from a directory. Special behaviors required by this +// function are implemented in sys.DirentCache. +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-fd_readdirfd-fd-buf-pointeru8-buf_len-size-cookie-dircookie---errno-size +// +// # Result (Errno) +// +// The return value is 0 except the following known error conditions: +// - sys.ENOSYS: the implementation does not support this function. +// - sys.EBADF: the file was closed or not a directory. +// - sys.EFAULT: `buf` or `buf_len` point to an offset out of memory. +// - sys.ENOENT: `cookie` was invalid. +// - sys.EINVAL: `buf_len` was not large enough to write a dirent header. +// +// # End of Directory (EOF) +// +// More entries are available when `result.bufused` == `buf_len`. See +// https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#fd_readdir +// https://github.com/WebAssembly/wasi-libc/blob/659ff414560721b1660a19685110e484a081c3d4/libc-bottom-half/cloudlibc/src/libc/dirent/readdir.c#L44 +var fdReaddir = newHostFunc( + wasip1.FdReaddirName, fdReaddirFn, + []wasm.ValueType{i32, i32, i32, i64, i32}, + "fd", "buf", "buf_len", "cookie", "result.bufused", +) + +func fdReaddirFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + mem := mod.Memory() + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + + fd := int32(params[0]) + buf := uint32(params[1]) + bufLen := uint32(params[2]) + cookie := params[3] + resultBufused := uint32(params[4]) + + // The bufLen must be enough to write a dirent header. + if bufLen < wasip1.DirentSize { + // This is a bug in the caller, as unless `buf_len` is large enough to + // write a dirent, it can't read the `d_namlen` from it. + return experimentalsys.EINVAL + } + + // Get or open a dirent cache for this file descriptor. + dir, errno := direntCache(fsc, fd) + if errno != 0 { + return errno + } + + // First, determine the maximum directory entries that can be encoded as + // dirents. The total size is DirentSize(24) + nameSize, for each file. + // Since a zero-length file name is invalid, the minimum size entry is + // 25 (DirentSize + 1 character). + maxDirEntries := bufLen/wasip1.DirentSize + 1 + + // While unlikely maxDirEntries will fit into bufLen, add one more just in + // case, as we need to know if we hit the end of the directory or not to + // write the correct bufused (e.g. == bufLen unless EOF). + // >> If less than the size of the read buffer, the end of the + // >> directory has been reached. + maxDirEntries += 1 + + // Read up to max entries. The underlying implementation will cache these, + // starting at the current location, so that they can be re-read. This is + // important because even the first could end up larger than bufLen due to + // the size of its name. + dirents, errno := dir.Read(cookie, maxDirEntries) + if errno != 0 { + return errno + } + + // Determine how many dirents we can write, including a potentially + // truncated last entry. + bufToWrite, direntCount, truncatedLen := maxDirents(dirents, bufLen) + + // Now, write entries to the underlying buffer. + if bufToWrite > 0 { + + // d_next is the index of the next file in the list, so it should + // always be one higher than the requested cookie. + d_next := cookie + 1 + // ^^ yes this can overflow to negative, which means our implementation + // doesn't support writing greater than max int64 entries. + + buf, ok := mem.Read(buf, bufToWrite) + if !ok { + return experimentalsys.EFAULT + } + + writeDirents(buf, dirents, d_next, direntCount, truncatedLen) + } + + // bufused == bufLen means more dirents exist, which is the case when one + // is truncated. + bufused := bufToWrite + if truncatedLen > 0 { + bufused = bufLen + } + + if !mem.WriteUint32Le(resultBufused, bufused) { + return experimentalsys.EFAULT + } + return 0 +} + +const largestDirent = int64(math.MaxUint32 - wasip1.DirentSize) + +// maxDirents returns the dirents to write. +// +// `bufToWrite` is the amount of memory needed to write direntCount, which +// includes up to wasip1.DirentSize of a last truncated entry. +func maxDirents(dirents []experimentalsys.Dirent, bufLen uint32) (bufToWrite uint32, direntCount int, truncatedLen uint32) { + lenRemaining := bufLen + for i := range dirents { + if lenRemaining == 0 { + break + } + d := dirents[i] + direntCount++ + + // use int64 to guard against huge filenames + nameLen := int64(len(d.Name)) + var entryLen uint32 + + // Check to see if DirentSize + nameLen overflows, or if it would be + // larger than possible to encode. + if el := int64(wasip1.DirentSize) + nameLen; el < 0 || el > largestDirent { + // panic, as testing is difficult. ex we would have to extract a + // function to get size of a string or allocate a 2^32 size one! + panic("invalid filename: too large") + } else { // we know this can fit into a uint32 + entryLen = uint32(el) + } + + if entryLen > lenRemaining { + // We haven't room to write the entry, and docs say to write the + // header. This helps especially when there is an entry with a very + // long filename. Ex if bufLen is 4096 and the filename is 4096, + // we need to write DirentSize(24) + 4096 bytes to write the entry. + // In this case, we only write up to DirentSize(24) to allow the + // caller to resize. + if lenRemaining >= wasip1.DirentSize { + truncatedLen = wasip1.DirentSize + } else { + truncatedLen = lenRemaining + } + bufToWrite += truncatedLen + break + } + + // This won't go negative because we checked entryLen <= lenRemaining. + lenRemaining -= entryLen + bufToWrite += entryLen + } + return +} + +// writeDirents writes the directory entries to the buffer, which is pre-sized +// based on maxDirents. truncatedEntryLen means the last is written without its +// name. +func writeDirents(buf []byte, dirents []experimentalsys.Dirent, d_next uint64, direntCount int, truncatedLen uint32) { + pos := uint32(0) + skipNameI := -1 + + // If the last entry was truncated, we either skip it or write it without + // its name, depending on the length. + if truncatedLen > 0 { + if truncatedLen < wasip1.DirentSize { + direntCount-- // skip as too small to write the header. + } else { + skipNameI = direntCount - 1 // write the header, but not the name. + } + } + + for i := 0; i < direntCount; i++ { + e := dirents[i] + nameLen := uint32(len(e.Name)) + writeDirent(buf[pos:], d_next, e.Ino, nameLen, e.Type) + d_next++ + pos += wasip1.DirentSize + + if i != skipNameI { + copy(buf[pos:], e.Name) + pos += nameLen + } + } +} + +// writeDirent writes DirentSize bytes +func writeDirent(buf []byte, dNext uint64, ino sysapi.Inode, dNamlen uint32, dType fs.FileMode) { + le.PutUint64(buf, dNext) // d_next + le.PutUint64(buf[8:], ino) // d_ino + le.PutUint32(buf[16:], dNamlen) // d_namlen + filetype := getWasiFiletype(dType) + le.PutUint32(buf[20:], uint32(filetype)) // d_type +} + +// direntCache lazy opens a sys.DirentCache for this directory or returns an +// error. +func direntCache(fsc *sys.FSContext, fd int32) (*sys.DirentCache, experimentalsys.Errno) { + if f, ok := fsc.LookupFile(fd); !ok { + return nil, experimentalsys.EBADF + } else if dir, errno := f.DirentCache(); errno == 0 { + return dir, 0 + } else if errno == experimentalsys.ENOTDIR { + // fd_readdir docs don't indicate whether to return sys.ENOTDIR or + // sys.EBADF. It has been noticed that rust will crash on sys.ENOTDIR, + // and POSIX C ref seems to not return this, so we don't either. + // + // See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#fd_readdir + // and https://en.wikibooks.org/wiki/C_Programming/POSIX_Reference/dirent.h + return nil, experimentalsys.EBADF + } else { + return nil, errno + } +} + +// fdRenumber is the WASI function named FdRenumberName which atomically +// replaces a file descriptor by renumbering another file descriptor. +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-fd_renumberfd-fd-to-fd---errno +var fdRenumber = newHostFunc(wasip1.FdRenumberName, fdRenumberFn, []wasm.ValueType{i32, i32}, "fd", "to") + +func fdRenumberFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + + from := int32(params[0]) + to := int32(params[1]) + + if errno := fsc.Renumber(from, to); errno != 0 { + return errno + } + return 0 +} + +// fdSeek is the WASI function named FdSeekName which moves the offset of a +// file descriptor. +// +// # Parameters +// +// - fd: file descriptor to move the offset of +// - offset: signed int64, which is encoded as uint64, input argument to +// `whence`, which results in a new offset +// - whence: operator that creates the new offset, given `offset` bytes +// - If io.SeekStart, new offset == `offset`. +// - If io.SeekCurrent, new offset == existing offset + `offset`. +// - If io.SeekEnd, new offset == file size of `fd` + `offset`. +// - resultNewoffset: offset in api.Memory to write the new offset to, +// relative to start of the file +// +// Result (Errno) +// +// The return value is 0 except the following error conditions: +// - sys.EBADF: `fd` is invalid +// - sys.EFAULT: `resultNewoffset` points to an offset out of memory +// - sys.EINVAL: `whence` is an invalid value +// - sys.EIO: a file system error +// - sys.EISDIR: the file was a directory. +// +// For example, if fd 3 is a file with offset 0, and parameters fd=3, offset=4, +// whence=0 (=io.SeekStart), resultNewOffset=1, this function writes the below +// to api.Memory: +// +// uint64le +// +--------------------+ +// | | +// []byte{?, 4, 0, 0, 0, 0, 0, 0, 0, ? } +// resultNewoffset --^ +// +// Note: This is similar to `lseek` in POSIX. https://linux.die.net/man/3/lseek +// +// See io.Seeker +// and https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#fd_seek +var fdSeek = newHostFunc( + wasip1.FdSeekName, fdSeekFn, + []api.ValueType{i32, i64, i32, i32}, + "fd", "offset", "whence", "result.newoffset", +) + +func fdSeekFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + fd := int32(params[0]) + offset := params[1] + whence := uint32(params[2]) + resultNewoffset := uint32(params[3]) + + if f, ok := fsc.LookupFile(fd); !ok { + return experimentalsys.EBADF + } else if isDir, _ := f.File.IsDir(); isDir { + return experimentalsys.EISDIR // POSIX doesn't forbid seeking a directory, but wasi-testsuite does. + } else if newOffset, errno := f.File.Seek(int64(offset), int(whence)); errno != 0 { + return errno + } else if !mod.Memory().WriteUint64Le(resultNewoffset, uint64(newOffset)) { + return experimentalsys.EFAULT + } + return 0 +} + +// fdSync is the WASI function named FdSyncName which synchronizes the data +// and metadata of a file to disk. +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-fd_syncfd-fd---errno +var fdSync = newHostFunc(wasip1.FdSyncName, fdSyncFn, []api.ValueType{i32}, "fd") + +func fdSyncFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + fd := int32(params[0]) + + // Check to see if the file descriptor is available + if f, ok := fsc.LookupFile(fd); !ok { + return experimentalsys.EBADF + } else { + return f.File.Sync() + } +} + +// fdTell is the WASI function named FdTellName which returns the current +// offset of a file descriptor. +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-fd_tellfd-fd---errno-filesize +var fdTell = newHostFunc(wasip1.FdTellName, fdTellFn, []api.ValueType{i32, i32}, "fd", "result.offset") + +func fdTellFn(ctx context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fd := params[0] + offset := uint64(0) + whence := uint64(io.SeekCurrent) + resultNewoffset := params[1] + + fdSeekParams := []uint64{fd, offset, whence, resultNewoffset} + return fdSeekFn(ctx, mod, fdSeekParams) +} + +// fdWrite is the WASI function named FdWriteName which writes to a file +// descriptor. +// +// # Parameters +// +// - fd: an opened file descriptor to write data to +// - iovs: offset in api.Memory to read offset, size pairs representing the +// data to write to `fd` +// - Both offset and length are encoded as uint32le. +// - iovsCount: count of memory offset, size pairs to read sequentially +// starting at iovs +// - resultNwritten: offset in api.Memory to write the number of bytes +// written +// +// Result (Errno) +// +// The return value is 0 except the following error conditions: +// - sys.EBADF: `fd` is invalid +// - sys.EFAULT: `iovs` or `resultNwritten` point to an offset out of memory +// - sys.EIO: a file system error +// +// For example, this function needs to first read `iovs` to determine what to +// write to `fd`. If parameters iovs=1 iovsCount=2, this function reads two +// offset/length pairs from api.Memory: +// +// iovs[0] iovs[1] +// +---------------------+ +--------------------+ +// | uint32le uint32le| |uint32le uint32le| +// +---------+ +--------+ +--------+ +--------+ +// | | | | | | | | +// []byte{?, 18, 0, 0, 0, 4, 0, 0, 0, 23, 0, 0, 0, 2, 0, 0, 0, ?... } +// iovs --^ ^ ^ ^ +// | | | | +// offset --+ length --+ offset --+ length --+ +// +// This function reads those chunks api.Memory into the `fd` sequentially. +// +// iovs[0].length iovs[1].length +// +--------------+ +----+ +// | | | | +// []byte{ 0..16, ?, 'w', 'a', 'z', 'e', ?, 'r', 'o', ? } +// iovs[0].offset --^ ^ +// iovs[1].offset --+ +// +// Since "wazero" was written, if parameter resultNwritten=26, this function +// writes the below to api.Memory: +// +// uint32le +// +--------+ +// | | +// []byte{ 0..24, ?, 6, 0, 0, 0', ? } +// resultNwritten --^ +// +// Note: This is similar to `writev` in POSIX. https://linux.die.net/man/3/writev +// +// See fdRead +// https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#ciovec +// and https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#fd_write +var fdWrite = newHostFunc( + wasip1.FdWriteName, fdWriteFn, + []api.ValueType{i32, i32, i32, i32}, + "fd", "iovs", "iovs_len", "result.nwritten", +) + +func fdWriteFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + return fdWriteOrPwrite(mod, params, false) +} + +// pwriter tracks an offset across multiple writes. +type pwriter struct { + f experimentalsys.File + offset int64 +} + +// Write implements the same function as documented on sys.File. +func (w *pwriter) Write(buf []byte) (n int, errno experimentalsys.Errno) { + if len(buf) == 0 { + return 0, 0 // less overhead on zero-length writes. + } + + n, err := w.f.Pwrite(buf, w.offset) + w.offset += int64(n) + return n, err +} + +func fdWriteOrPwrite(mod api.Module, params []uint64, isPwrite bool) experimentalsys.Errno { + mem := mod.Memory() + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + + fd := int32(params[0]) + iovs := uint32(params[1]) + iovsCount := uint32(params[2]) + + var resultNwritten uint32 + var writer func(buf []byte) (n int, errno experimentalsys.Errno) + if f, ok := fsc.LookupFile(fd); !ok { + return experimentalsys.EBADF + } else if isPwrite { + offset := int64(params[3]) + writer = (&pwriter{f: f.File, offset: offset}).Write + resultNwritten = uint32(params[4]) + } else { + writer = f.File.Write + resultNwritten = uint32(params[3]) + } + + nwritten, errno := writev(mem, iovs, iovsCount, writer) + if errno != 0 { + return errno + } + + if !mod.Memory().WriteUint32Le(resultNwritten, nwritten) { + return experimentalsys.EFAULT + } + return 0 +} + +func writev(mem api.Memory, iovs uint32, iovsCount uint32, writer func(buf []byte) (n int, errno experimentalsys.Errno)) (uint32, experimentalsys.Errno) { + var nwritten uint32 + iovsStop := iovsCount << 3 // iovsCount * 8 + iovsBuf, ok := mem.Read(iovs, iovsStop) + if !ok { + return 0, experimentalsys.EFAULT + } + + for iovsPos := uint32(0); iovsPos < iovsStop; iovsPos += 8 { + offset := le.Uint32(iovsBuf[iovsPos:]) + l := le.Uint32(iovsBuf[iovsPos+4:]) + + b, ok := mem.Read(offset, l) + if !ok { + return 0, experimentalsys.EFAULT + } + n, errno := writer(b) + nwritten += uint32(n) + if errno == experimentalsys.ENOSYS { + return 0, experimentalsys.EBADF // e.g. unimplemented for write + } else if errno != 0 { + return 0, errno + } + } + return nwritten, 0 +} + +// pathCreateDirectory is the WASI function named PathCreateDirectoryName which +// creates a directory. +// +// # Parameters +// +// - fd: file descriptor of a directory that `path` is relative to +// - path: offset in api.Memory to read the path string from +// - pathLen: length of `path` +// +// # Result (Errno) +// +// The return value is 0 except the following error conditions: +// - sys.EBADF: `fd` is invalid +// - sys.ENOENT: `path` does not exist. +// - sys.ENOTDIR: `path` is a file +// +// # Notes +// - This is similar to mkdirat in POSIX. +// See https://linux.die.net/man/2/mkdirat +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-path_create_directoryfd-fd-path-string---errno +var pathCreateDirectory = newHostFunc( + wasip1.PathCreateDirectoryName, pathCreateDirectoryFn, + []wasm.ValueType{i32, i32, i32}, + "fd", "path", "path_len", +) + +func pathCreateDirectoryFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + + fd := int32(params[0]) + path := uint32(params[1]) + pathLen := uint32(params[2]) + + preopen, pathName, errno := atPath(fsc, mod.Memory(), fd, path, pathLen) + if errno != 0 { + return errno + } + + if errno = preopen.Mkdir(pathName, 0o700); errno != 0 { + return errno + } + + return 0 +} + +// pathFilestatGet is the WASI function named PathFilestatGetName which +// returns the stat attributes of a file or directory. +// +// # Parameters +// +// - fd: file descriptor of the folder to look in for the path +// - flags: flags determining the method of how paths are resolved +// - path: path under fd to get the filestat attributes data for +// - path_len: length of the path that was given +// - resultFilestat: offset to write the result filestat data +// +// Result (Errno) +// +// The return value is 0 except the following error conditions: +// - sys.EBADF: `fd` is invalid +// - sys.ENOTDIR: `fd` points to a file not a directory +// - sys.EIO: could not stat `fd` on filesystem +// - sys.EINVAL: the path contained "../" +// - sys.ENAMETOOLONG: `path` + `path_len` is out of memory +// - sys.EFAULT: `resultFilestat` points to an offset out of memory +// - sys.ENOENT: could not find the path +// +// The rest of this implementation matches that of fdFilestatGet, so is not +// repeated here. +// +// Note: This is similar to `fstatat` in POSIX. +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-path_filestat_getfd-fd-flags-lookupflags-path-string---errno-filestat +// and https://linux.die.net/man/2/fstatat +var pathFilestatGet = newHostFunc( + wasip1.PathFilestatGetName, pathFilestatGetFn, + []api.ValueType{i32, i32, i32, i32, i32}, + "fd", "flags", "path", "path_len", "result.filestat", +) + +func pathFilestatGetFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + + fd := int32(params[0]) + flags := uint16(params[1]) + path := uint32(params[2]) + pathLen := uint32(params[3]) + + preopen, pathName, errno := atPath(fsc, mod.Memory(), fd, path, pathLen) + if errno != 0 { + return errno + } + + // Stat the file without allocating a file descriptor. + var st sysapi.Stat_t + + if (flags & wasip1.LOOKUP_SYMLINK_FOLLOW) == 0 { + st, errno = preopen.Lstat(pathName) + } else { + st, errno = preopen.Stat(pathName) + } + if errno != 0 { + return errno + } + + // Write the stat result to memory + resultBuf := uint32(params[4]) + buf, ok := mod.Memory().Read(resultBuf, 64) + if !ok { + return experimentalsys.EFAULT + } + + filetype := getWasiFiletype(st.Mode) + return writeFilestat(buf, &st, filetype) +} + +// pathFilestatSetTimes is the WASI function named PathFilestatSetTimesName +// which adjusts the timestamps of a file or directory. +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-path_filestat_set_timesfd-fd-flags-lookupflags-path-string-atim-timestamp-mtim-timestamp-fst_flags-fstflags---errno +var pathFilestatSetTimes = newHostFunc( + wasip1.PathFilestatSetTimesName, pathFilestatSetTimesFn, + []wasm.ValueType{i32, i32, i32, i32, i64, i64, i32}, + "fd", "flags", "path", "path_len", "atim", "mtim", "fst_flags", +) + +func pathFilestatSetTimesFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fd := int32(params[0]) + flags := uint16(params[1]) + path := uint32(params[2]) + pathLen := uint32(params[3]) + atim := int64(params[4]) + mtim := int64(params[5]) + fstFlags := uint16(params[6]) + + sys := mod.(*wasm.ModuleInstance).Sys + fsc := sys.FS() + + atim, mtim, errno := toTimes(sys.WalltimeNanos, atim, mtim, fstFlags) + if errno != 0 { + return errno + } + + preopen, pathName, errno := atPath(fsc, mod.Memory(), fd, path, pathLen) + if errno != 0 { + return errno + } + + symlinkFollow := flags&wasip1.LOOKUP_SYMLINK_FOLLOW != 0 + if symlinkFollow { + return preopen.Utimens(pathName, atim, mtim) + } + // Otherwise, we need to emulate don't follow by opening the file by path. + if f, errno := preopen.OpenFile(pathName, experimentalsys.O_WRONLY, 0); errno != 0 { + return errno + } else { + defer f.Close() + return f.Utimens(atim, mtim) + } +} + +// pathLink is the WASI function named PathLinkName which adjusts the +// timestamps of a file or directory. +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#path_link +var pathLink = newHostFunc( + wasip1.PathLinkName, pathLinkFn, + []wasm.ValueType{i32, i32, i32, i32, i32, i32, i32}, + "old_fd", "old_flags", "old_path", "old_path_len", "new_fd", "new_path", "new_path_len", +) + +func pathLinkFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + mem := mod.Memory() + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + + oldFD := int32(params[0]) + // TODO: use old_flags? + _ = uint32(params[1]) + oldPath := uint32(params[2]) + oldPathLen := uint32(params[3]) + + oldFS, oldName, errno := atPath(fsc, mem, oldFD, oldPath, oldPathLen) + if errno != 0 { + return errno + } + + newFD := int32(params[4]) + newPath := uint32(params[5]) + newPathLen := uint32(params[6]) + + newFS, newName, errno := atPath(fsc, mem, newFD, newPath, newPathLen) + if errno != 0 { + return errno + } + + if oldFS != newFS { // TODO: handle link across filesystems + return experimentalsys.ENOSYS + } + + return oldFS.Link(oldName, newName) +} + +// pathOpen is the WASI function named PathOpenName which opens a file or +// directory. This returns sys.EBADF if the fd is invalid. +// +// # Parameters +// +// - fd: file descriptor of a directory that `path` is relative to +// - dirflags: flags to indicate how to resolve `path` +// - path: offset in api.Memory to read the path string from +// - pathLen: length of `path` +// - oFlags: open flags to indicate the method by which to open the file +// - fsRightsBase: interpret RIGHT_FD_WRITE to set O_RDWR +// - fsRightsInheriting: ignored as rights were removed from WASI. +// created file descriptor for `path` +// - fdFlags: file descriptor flags +// - resultOpenedFD: offset in api.Memory to write the newly created file +// descriptor to. +// - The result FD value is guaranteed to be less than 2**31 +// +// Result (Errno) +// +// The return value is 0 except the following error conditions: +// - sys.EBADF: `fd` is invalid +// - sys.EFAULT: `resultOpenedFD` points to an offset out of memory +// - sys.ENOENT: `path` does not exist. +// - sys.EEXIST: `path` exists, while `oFlags` requires that it must not. +// - sys.ENOTDIR: `path` is not a directory, while `oFlags` requires it. +// - sys.EIO: a file system error +// +// For example, this function needs to first read `path` to determine the file +// to open. If parameters `path` = 1, `pathLen` = 6, and the path is "wazero", +// pathOpen reads the path from api.Memory: +// +// pathLen +// +------------------------+ +// | | +// []byte{ ?, 'w', 'a', 'z', 'e', 'r', 'o', ?... } +// path --^ +// +// Then, if parameters resultOpenedFD = 8, and this function opened a new file +// descriptor 5 with the given flags, this function writes the below to +// api.Memory: +// +// uint32le +// +--------+ +// | | +// []byte{ 0..6, ?, 5, 0, 0, 0, ?} +// resultOpenedFD --^ +// +// # Notes +// - This is similar to `openat` in POSIX. https://linux.die.net/man/3/openat +// - The returned file descriptor is not guaranteed to be the lowest-number +// +// See https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md#path_open +var pathOpen = newHostFunc( + wasip1.PathOpenName, pathOpenFn, + []api.ValueType{i32, i32, i32, i32, i32, i64, i64, i32, i32}, + "fd", "dirflags", "path", "path_len", "oflags", "fs_rights_base", "fs_rights_inheriting", "fdflags", "result.opened_fd", +) + +func pathOpenFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + + preopenFD := int32(params[0]) + + // TODO: dirflags is a lookupflags, and it only has one bit: symlink_follow + // https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#lookupflags + dirflags := uint16(params[1]) + + path := uint32(params[2]) + pathLen := uint32(params[3]) + + oflags := uint16(params[4]) + + rights := uint32(params[5]) + // inherited rights aren't used + _ = params[6] + + fdflags := uint16(params[7]) + resultOpenedFD := uint32(params[8]) + + preopen, pathName, errno := atPath(fsc, mod.Memory(), preopenFD, path, pathLen) + if errno != 0 { + return errno + } + + fileOpenFlags := openFlags(dirflags, oflags, fdflags, rights) + isDir := fileOpenFlags&experimentalsys.O_DIRECTORY != 0 + + if isDir && oflags&wasip1.O_CREAT != 0 { + return experimentalsys.EINVAL // use pathCreateDirectory! + } + + newFD, errno := fsc.OpenFile(preopen, pathName, fileOpenFlags, 0o600) + if errno != 0 { + return errno + } + + // Check any flags that require the file to evaluate. + if isDir { + if f, ok := fsc.LookupFile(newFD); !ok { + return experimentalsys.EBADF // unexpected + } else if isDir, errno := f.File.IsDir(); errno != 0 { + _ = fsc.CloseFile(newFD) + return errno + } else if !isDir { + _ = fsc.CloseFile(newFD) + return experimentalsys.ENOTDIR + } + } + + if !mod.Memory().WriteUint32Le(resultOpenedFD, uint32(newFD)) { + _ = fsc.CloseFile(newFD) + return experimentalsys.EFAULT + } + return 0 +} + +// atPath returns the pre-open specific path after verifying it is a directory. +// +// # Notes +// +// Languages including Zig and Rust use only pre-opens for the FD because +// wasi-libc `__wasilibc_find_relpath` will only return a preopen. That said, +// our wasi.c example shows other languages act differently and can use a non +// pre-opened file descriptor. +// +// We don't handle `AT_FDCWD`, as that's resolved in the compiler. There's no +// working directory function in WASI, so most assume CWD is "/". Notably, Zig +// has different behavior which assumes it is whatever the first pre-open name +// is. +// +// See https://github.com/WebAssembly/wasi-libc/blob/659ff414560721b1660a19685110e484a081c3d4/libc-bottom-half/sources/at_fdcwd.c +// See https://linux.die.net/man/2/openat +func atPath(fsc *sys.FSContext, mem api.Memory, fd int32, p, pathLen uint32) (experimentalsys.FS, string, experimentalsys.Errno) { + b, ok := mem.Read(p, pathLen) + if !ok { + return nil, "", experimentalsys.EFAULT + } + pathName := string(b) + + // interesting_paths wants us to break on trailing slash if the input ends + // up a file, not a directory! + hasTrailingSlash := strings.HasSuffix(pathName, "/") + + // interesting_paths includes paths that include relative links but end up + // not escaping + pathName = path.Clean(pathName) + + // interesting_paths wants to break on root paths or anything that escapes. + // This part is the same as fs.FS.Open() + if !fs.ValidPath(pathName) { + return nil, "", experimentalsys.EPERM + } + + // add the trailing slash back + if hasTrailingSlash { + pathName = pathName + "/" + } + + if f, ok := fsc.LookupFile(fd); !ok { + return nil, "", experimentalsys.EBADF // closed or invalid + } else if isDir, errno := f.File.IsDir(); errno != 0 { + return nil, "", errno + } else if !isDir { + return nil, "", experimentalsys.ENOTDIR + } else if f.IsPreopen { // don't append the pre-open name + return f.FS, pathName, 0 + } else { + // Join via concat to avoid name conflict on path.Join + return f.FS, f.Name + "/" + pathName, 0 + } +} + +func preopenPath(fsc *sys.FSContext, fd int32) (string, experimentalsys.Errno) { + if f, ok := fsc.LookupFile(fd); !ok { + return "", experimentalsys.EBADF // closed + } else if !f.IsPreopen { + return "", experimentalsys.EBADF + } else if isDir, errno := f.File.IsDir(); errno != 0 || !isDir { + // In wasip1, only directories can be returned by fd_prestat_get as + // there are no prestat types defined for files or sockets. + return "", errno + } else { + return f.Name, 0 + } +} + +func openFlags(dirflags, oflags, fdflags uint16, rights uint32) (openFlags experimentalsys.Oflag) { + if dirflags&wasip1.LOOKUP_SYMLINK_FOLLOW == 0 { + openFlags |= experimentalsys.O_NOFOLLOW + } + if oflags&wasip1.O_DIRECTORY != 0 { + openFlags |= experimentalsys.O_DIRECTORY + return // Early return for directories as the rest of flags doesn't make sense for it. + } else if oflags&wasip1.O_EXCL != 0 { + openFlags |= experimentalsys.O_EXCL + } + // Because we don't implement rights, we partially rely on the open flags + // to determine the mode in which the file will be opened. This will create + // divergent behavior compared to WASI runtimes which have a more strict + // interpretation of the WASI capabilities model; for example, a program + // which sets O_CREAT but does not give read or write permissions will + // successfully create a file when running with wazero, but might get a + // permission denied error on other runtimes. + defaultMode := experimentalsys.O_RDONLY + if oflags&wasip1.O_TRUNC != 0 { + openFlags |= experimentalsys.O_TRUNC + defaultMode = experimentalsys.O_RDWR + } + if oflags&wasip1.O_CREAT != 0 { + openFlags |= experimentalsys.O_CREAT + defaultMode = experimentalsys.O_RDWR + } + if fdflags&wasip1.FD_NONBLOCK != 0 { + openFlags |= experimentalsys.O_NONBLOCK + } + if fdflags&wasip1.FD_APPEND != 0 { + openFlags |= experimentalsys.O_APPEND + defaultMode = experimentalsys.O_RDWR + } + if fdflags&wasip1.FD_DSYNC != 0 { + openFlags |= experimentalsys.O_DSYNC + } + if fdflags&wasip1.FD_RSYNC != 0 { + openFlags |= experimentalsys.O_RSYNC + } + if fdflags&wasip1.FD_SYNC != 0 { + openFlags |= experimentalsys.O_SYNC + } + + // Since rights were discontinued in wasi, we only interpret RIGHT_FD_WRITE + // because it is the only way to know that we need to set write permissions + // on a file if the application did not pass any of O_CREAT, O_APPEND, nor + // O_TRUNC. + const r = wasip1.RIGHT_FD_READ + const w = wasip1.RIGHT_FD_WRITE + const rw = r | w + switch { + case (rights & rw) == rw: + openFlags |= experimentalsys.O_RDWR + case (rights & w) == w: + openFlags |= experimentalsys.O_WRONLY + case (rights & r) == r: + openFlags |= experimentalsys.O_RDONLY + default: + openFlags |= defaultMode + } + return +} + +// pathReadlink is the WASI function named PathReadlinkName that reads the +// contents of a symbolic link. +// +// See: https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-path_readlinkfd-fd-path-string-buf-pointeru8-buf_len-size---errno-size +var pathReadlink = newHostFunc( + wasip1.PathReadlinkName, pathReadlinkFn, + []wasm.ValueType{i32, i32, i32, i32, i32, i32}, + "fd", "path", "path_len", "buf", "buf_len", "result.bufused", +) + +func pathReadlinkFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + + fd := int32(params[0]) + path := uint32(params[1]) + pathLen := uint32(params[2]) + buf := uint32(params[3]) + bufLen := uint32(params[4]) + resultBufused := uint32(params[5]) + + if pathLen == 0 || bufLen == 0 { + return experimentalsys.EINVAL + } + + mem := mod.Memory() + preopen, p, errno := atPath(fsc, mem, fd, path, pathLen) + if errno != 0 { + return errno + } + + dst, errno := preopen.Readlink(p) + if errno != 0 { + return errno + } + + if len(dst) > int(bufLen) { + return experimentalsys.ERANGE + } + + if ok := mem.WriteString(buf, dst); !ok { + return experimentalsys.EFAULT + } + + if !mem.WriteUint32Le(resultBufused, uint32(len(dst))) { + return experimentalsys.EFAULT + } + return 0 +} + +// pathRemoveDirectory is the WASI function named PathRemoveDirectoryName which +// removes a directory. +// +// # Parameters +// +// - fd: file descriptor of a directory that `path` is relative to +// - path: offset in api.Memory to read the path string from +// - pathLen: length of `path` +// +// # Result (Errno) +// +// The return value is 0 except the following error conditions: +// - sys.EBADF: `fd` is invalid +// - sys.ENOENT: `path` does not exist. +// - sys.ENOTEMPTY: `path` is not empty +// - sys.ENOTDIR: `path` is a file +// +// # Notes +// - This is similar to unlinkat with AT_REMOVEDIR in POSIX. +// See https://linux.die.net/man/2/unlinkat +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-path_remove_directoryfd-fd-path-string---errno +var pathRemoveDirectory = newHostFunc( + wasip1.PathRemoveDirectoryName, pathRemoveDirectoryFn, + []wasm.ValueType{i32, i32, i32}, + "fd", "path", "path_len", +) + +func pathRemoveDirectoryFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + + fd := int32(params[0]) + path := uint32(params[1]) + pathLen := uint32(params[2]) + + preopen, pathName, errno := atPath(fsc, mod.Memory(), fd, path, pathLen) + if errno != 0 { + return errno + } + + return preopen.Rmdir(pathName) +} + +// pathRename is the WASI function named PathRenameName which renames a file or +// directory. +// +// # Parameters +// +// - fd: file descriptor of a directory that `old_path` is relative to +// - old_path: offset in api.Memory to read the old path string from +// - old_path_len: length of `old_path` +// - new_fd: file descriptor of a directory that `new_path` is relative to +// - new_path: offset in api.Memory to read the new path string from +// - new_path_len: length of `new_path` +// +// # Result (Errno) +// +// The return value is 0 except the following error conditions: +// - sys.EBADF: `fd` or `new_fd` are invalid +// - sys.ENOENT: `old_path` does not exist. +// - sys.ENOTDIR: `old` is a directory and `new` exists, but is a file. +// - sys.EISDIR: `old` is a file and `new` exists, but is a directory. +// +// # Notes +// - This is similar to unlinkat in POSIX. +// See https://linux.die.net/man/2/renameat +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-path_renamefd-fd-old_path-string-new_fd-fd-new_path-string---errno +var pathRename = newHostFunc( + wasip1.PathRenameName, pathRenameFn, + []wasm.ValueType{i32, i32, i32, i32, i32, i32}, + "fd", "old_path", "old_path_len", "new_fd", "new_path", "new_path_len", +) + +func pathRenameFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + + fd := int32(params[0]) + oldPath := uint32(params[1]) + oldPathLen := uint32(params[2]) + + newFD := int32(params[3]) + newPath := uint32(params[4]) + newPathLen := uint32(params[5]) + + oldFS, oldPathName, errno := atPath(fsc, mod.Memory(), fd, oldPath, oldPathLen) + if errno != 0 { + return errno + } + + newFS, newPathName, errno := atPath(fsc, mod.Memory(), newFD, newPath, newPathLen) + if errno != 0 { + return errno + } + + if oldFS != newFS { // TODO: handle renames across filesystems + return experimentalsys.ENOSYS + } + + return oldFS.Rename(oldPathName, newPathName) +} + +// pathSymlink is the WASI function named PathSymlinkName which creates a +// symbolic link. +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#path_symlink +var pathSymlink = newHostFunc( + wasip1.PathSymlinkName, pathSymlinkFn, + []wasm.ValueType{i32, i32, i32, i32, i32}, + "old_path", "old_path_len", "fd", "new_path", "new_path_len", +) + +func pathSymlinkFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + + oldPath := uint32(params[0]) + oldPathLen := uint32(params[1]) + fd := int32(params[2]) + newPath := uint32(params[3]) + newPathLen := uint32(params[4]) + + mem := mod.Memory() + + dir, ok := fsc.LookupFile(fd) + if !ok { + return experimentalsys.EBADF // closed + } else if isDir, errno := dir.File.IsDir(); errno != 0 { + return errno + } else if !isDir { + return experimentalsys.ENOTDIR + } + + if oldPathLen == 0 || newPathLen == 0 { + return experimentalsys.EINVAL + } + + oldPathBuf, ok := mem.Read(oldPath, oldPathLen) + if !ok { + return experimentalsys.EFAULT + } + + newPathBuf, ok := mem.Read(newPath, newPathLen) + if !ok { + return experimentalsys.EFAULT + } + + return dir.FS.Symlink( + // Do not join old path since it's only resolved when dereference the link created here. + // And the dereference result depends on the opening directory's file descriptor at that point. + bufToStr(oldPathBuf), + path.Join(dir.Name, bufToStr(newPathBuf)), + ) +} + +// bufToStr converts the given byte slice as string unsafely. +func bufToStr(buf []byte) string { + // TODO: use unsafe.String after flooring Go 1.20. + return *(*string)(unsafe.Pointer(&buf)) +} + +// pathUnlinkFile is the WASI function named PathUnlinkFileName which unlinks a +// file. +// +// # Parameters +// +// - fd: file descriptor of a directory that `path` is relative to +// - path: offset in api.Memory to read the path string from +// - pathLen: length of `path` +// +// # Result (Errno) +// +// The return value is 0 except the following error conditions: +// - sys.EBADF: `fd` is invalid +// - sys.ENOENT: `path` does not exist. +// - sys.EISDIR: `path` is a directory +// +// # Notes +// - This is similar to unlinkat without AT_REMOVEDIR in POSIX. +// See https://linux.die.net/man/2/unlinkat +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-path_unlink_filefd-fd-path-string---errno +var pathUnlinkFile = newHostFunc( + wasip1.PathUnlinkFileName, pathUnlinkFileFn, + []wasm.ValueType{i32, i32, i32}, + "fd", "path", "path_len", +) + +func pathUnlinkFileFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno { + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + + fd := int32(params[0]) + path := uint32(params[1]) + pathLen := uint32(params[2]) + + preopen, pathName, errno := atPath(fsc, mod.Memory(), fd, path, pathLen) + if errno != 0 { + return errno + } + + return preopen.Unlink(pathName) +} diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/poll.go b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/poll.go new file mode 100644 index 000000000..d09f30245 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/poll.go @@ -0,0 +1,239 @@ +package wasi_snapshot_preview1 + +import ( + "context" + "time" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/fsapi" + internalsys "github.com/tetratelabs/wazero/internal/sys" + "github.com/tetratelabs/wazero/internal/wasip1" + "github.com/tetratelabs/wazero/internal/wasm" +) + +// pollOneoff is the WASI function named PollOneoffName that concurrently +// polls for the occurrence of a set of events. +// +// # Parameters +// +// - in: pointer to the subscriptions (48 bytes each) +// - out: pointer to the resulting events (32 bytes each) +// - nsubscriptions: count of subscriptions, zero returns sys.EINVAL. +// - resultNevents: count of events. +// +// Result (Errno) +// +// The return value is 0 except the following error conditions: +// - sys.EINVAL: the parameters are invalid +// - sys.ENOTSUP: a parameters is valid, but not yet supported. +// - sys.EFAULT: there is not enough memory to read the subscriptions or +// write results. +// +// # Notes +// +// - Since the `out` pointer nests Errno, the result is always 0. +// - This is similar to `poll` in POSIX. +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#poll_oneoff +// See https://linux.die.net/man/3/poll +var pollOneoff = newHostFunc( + wasip1.PollOneoffName, pollOneoffFn, + []api.ValueType{i32, i32, i32, i32}, + "in", "out", "nsubscriptions", "result.nevents", +) + +type event struct { + eventType byte + userData []byte + errno wasip1.Errno +} + +func pollOneoffFn(_ context.Context, mod api.Module, params []uint64) sys.Errno { + in := uint32(params[0]) + out := uint32(params[1]) + nsubscriptions := uint32(params[2]) + resultNevents := uint32(params[3]) + + if nsubscriptions == 0 { + return sys.EINVAL + } + + mem := mod.Memory() + + // Ensure capacity prior to the read loop to reduce error handling. + inBuf, ok := mem.Read(in, nsubscriptions*48) + if !ok { + return sys.EFAULT + } + outBuf, ok := mem.Read(out, nsubscriptions*32) + // zero-out all buffer before writing + for i := range outBuf { + outBuf[i] = 0 + } + + if !ok { + return sys.EFAULT + } + + // Eagerly write the number of events which will equal subscriptions unless + // there's a fault in parsing (not processing). + if !mod.Memory().WriteUint32Le(resultNevents, nsubscriptions) { + return sys.EFAULT + } + + // Loop through all subscriptions and write their output. + + // Extract FS context, used in the body of the for loop for FS access. + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + // Slice of events that are processed out of the loop (blocking stdin subscribers). + var blockingStdinSubs []*event + // The timeout is initialized at max Duration, the loop will find the minimum. + var timeout time.Duration = 1<<63 - 1 + // Count of all the subscriptions that have been already written back to outBuf. + // nevents*32 returns at all times the offset where the next event should be written: + // this way we ensure that there are no gaps between records. + nevents := uint32(0) + + // Layout is subscription_u: Union + // https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#subscription_u + for i := uint32(0); i < nsubscriptions; i++ { + inOffset := i * 48 + outOffset := nevents * 32 + + eventType := inBuf[inOffset+8] // +8 past userdata + // +8 past userdata +8 contents_offset + argBuf := inBuf[inOffset+8+8:] + userData := inBuf[inOffset : inOffset+8] + + evt := &event{ + eventType: eventType, + userData: userData, + errno: wasip1.ErrnoSuccess, + } + + switch eventType { + case wasip1.EventTypeClock: // handle later + newTimeout, err := processClockEvent(argBuf) + if err != 0 { + return err + } + // Min timeout. + if newTimeout < timeout { + timeout = newTimeout + } + // Ack the clock event to the outBuf. + writeEvent(outBuf[outOffset:], evt) + nevents++ + case wasip1.EventTypeFdRead: + fd := int32(le.Uint32(argBuf)) + if fd < 0 { + return sys.EBADF + } + if file, ok := fsc.LookupFile(fd); !ok { + evt.errno = wasip1.ErrnoBadf + writeEvent(outBuf[outOffset:], evt) + nevents++ + } else if fd != internalsys.FdStdin && file.File.IsNonblock() { + writeEvent(outBuf[outOffset:], evt) + nevents++ + } else { + // if the fd is Stdin, and it is in blocking mode, + // do not ack yet, append to a slice for delayed evaluation. + blockingStdinSubs = append(blockingStdinSubs, evt) + } + case wasip1.EventTypeFdWrite: + fd := int32(le.Uint32(argBuf)) + if fd < 0 { + return sys.EBADF + } + if _, ok := fsc.LookupFile(fd); ok { + evt.errno = wasip1.ErrnoNotsup + } else { + evt.errno = wasip1.ErrnoBadf + } + nevents++ + writeEvent(outBuf[outOffset:], evt) + default: + return sys.EINVAL + } + } + + sysCtx := mod.(*wasm.ModuleInstance).Sys + if nevents == nsubscriptions { + // We already wrote back all the results. We already wrote this number + // earlier to offset `resultNevents`. + // We only need to observe the timeout (nonzero if there are clock subscriptions) + // and return. + if timeout > 0 { + sysCtx.Nanosleep(int64(timeout)) + } + return 0 + } + + // If there are blocking stdin subscribers, check for data with given timeout. + stdin, ok := fsc.LookupFile(internalsys.FdStdin) + if !ok { + return sys.EBADF + } + // Wait for the timeout to expire, or for some data to become available on Stdin. + + if stdinReady, errno := stdin.File.Poll(fsapi.POLLIN, int32(timeout.Milliseconds())); errno != 0 { + return errno + } else if stdinReady { + // stdin has data ready to for reading, write back all the events + for i := range blockingStdinSubs { + evt := blockingStdinSubs[i] + evt.errno = 0 + writeEvent(outBuf[nevents*32:], evt) + nevents++ + } + } + + if nevents != nsubscriptions { + if !mod.Memory().WriteUint32Le(resultNevents, nevents) { + return sys.EFAULT + } + } + + return 0 +} + +// processClockEvent supports only relative name events, as that's what's used +// to implement sleep in various compilers including Rust, Zig and TinyGo. +func processClockEvent(inBuf []byte) (time.Duration, sys.Errno) { + _ /* ID */ = le.Uint32(inBuf[0:8]) // See below + timeout := le.Uint64(inBuf[8:16]) // nanos if relative + _ /* precision */ = le.Uint64(inBuf[16:24]) // Unused + flags := le.Uint16(inBuf[24:32]) + + var err sys.Errno + // subclockflags has only one flag defined: subscription_clock_abstime + switch flags { + case 0: // relative time + case 1: // subscription_clock_abstime + err = sys.ENOTSUP + default: // subclockflags has only one flag defined. + err = sys.EINVAL + } + + if err != 0 { + return 0, err + } else { + // https://linux.die.net/man/3/clock_settime says relative timers are + // unaffected. Since this function only supports relative timeout, we can + // skip name ID validation and use a single sleep function. + + return time.Duration(timeout), 0 + } +} + +// writeEvent writes the event corresponding to the processed subscription. +// https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-event-struct +func writeEvent(outBuf []byte, evt *event) { + copy(outBuf, evt.userData) // userdata + outBuf[8] = byte(evt.errno) // uint16, but safe as < 255 + outBuf[9] = 0 + le.PutUint32(outBuf[10:], uint32(evt.eventType)) + // TODO: When FD events are supported, write outOffset+16 +} diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/proc.go b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/proc.go new file mode 100644 index 000000000..cb0ab487c --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/proc.go @@ -0,0 +1,44 @@ +package wasi_snapshot_preview1 + +import ( + "context" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/wasip1" + "github.com/tetratelabs/wazero/internal/wasm" + "github.com/tetratelabs/wazero/sys" +) + +// procExit is the WASI function named ProcExitName that terminates the +// execution of the module with an exit code. The only successful exit code is +// zero. +// +// # Parameters +// +// - exitCode: exit code. +// +// See https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md#proc_exit +var procExit = &wasm.HostFunc{ + ExportName: wasip1.ProcExitName, + Name: wasip1.ProcExitName, + ParamTypes: []api.ValueType{i32}, + ParamNames: []string{"rval"}, + Code: wasm.Code{GoFunc: api.GoModuleFunc(procExitFn)}, +} + +func procExitFn(ctx context.Context, mod api.Module, params []uint64) { + exitCode := uint32(params[0]) + + // Ensure other callers see the exit code. + _ = mod.CloseWithExitCode(ctx, exitCode) + + // Prevent any code from executing after this function. For example, LLVM + // inserts unreachable instructions after calls to exit. + // See: https://github.com/emscripten-core/emscripten/issues/12322 + panic(sys.NewExitError(exitCode)) +} + +// procRaise is stubbed and will never be supported, as it was removed. +// +// See https://github.com/WebAssembly/WASI/pull/136 +var procRaise = stubFunction(wasip1.ProcRaiseName, []api.ValueType{i32}, "sig") diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/random.go b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/random.go new file mode 100644 index 000000000..e4d7ccee1 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/random.go @@ -0,0 +1,55 @@ +package wasi_snapshot_preview1 + +import ( + "context" + "io" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/wasip1" + "github.com/tetratelabs/wazero/internal/wasm" +) + +// randomGet is the WASI function named RandomGetName which writes random +// data to a buffer. +// +// # Parameters +// +// - buf: api.Memory offset to write random values +// - bufLen: size of random data in bytes +// +// Result (Errno) +// +// The return value is ErrnoSuccess except the following error conditions: +// - sys.EFAULT: `buf` or `bufLen` point to an offset out of memory +// - sys.EIO: a file system error +// +// For example, if underlying random source was seeded like +// `rand.NewSource(42)`, we expect api.Memory to contain: +// +// bufLen (5) +// +--------------------------+ +// | | +// []byte{?, 0x53, 0x8c, 0x7f, 0x96, 0xb1, ?} +// buf --^ +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-random_getbuf-pointeru8-bufLen-size---errno +var randomGet = newHostFunc(wasip1.RandomGetName, randomGetFn, []api.ValueType{i32, i32}, "buf", "buf_len") + +func randomGetFn(_ context.Context, mod api.Module, params []uint64) sys.Errno { + sysCtx := mod.(*wasm.ModuleInstance).Sys + randSource := sysCtx.RandSource() + buf, bufLen := uint32(params[0]), uint32(params[1]) + + randomBytes, ok := mod.Memory().Read(buf, bufLen) + if !ok { // out-of-range + return sys.EFAULT + } + + // We can ignore the returned n as it only != byteCount on error + if _, err := io.ReadAtLeast(randSource, randomBytes, int(bufLen)); err != nil { + return sys.EIO + } + + return 0 +} diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/sched.go b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/sched.go new file mode 100644 index 000000000..86748e6d6 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/sched.go @@ -0,0 +1,22 @@ +package wasi_snapshot_preview1 + +import ( + "context" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/wasip1" + "github.com/tetratelabs/wazero/internal/wasm" +) + +// schedYield is the WASI function named SchedYieldName which temporarily +// yields execution of the calling thread. +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-sched_yield---errno +var schedYield = newHostFunc(wasip1.SchedYieldName, schedYieldFn, nil) + +func schedYieldFn(_ context.Context, mod api.Module, _ []uint64) sys.Errno { + sysCtx := mod.(*wasm.ModuleInstance).Sys + sysCtx.Osyield() + return 0 +} diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/sock.go b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/sock.go new file mode 100644 index 000000000..756c0d391 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/sock.go @@ -0,0 +1,188 @@ +package wasi_snapshot_preview1 + +import ( + "context" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/experimental/sys" + socketapi "github.com/tetratelabs/wazero/internal/sock" + "github.com/tetratelabs/wazero/internal/sysfs" + "github.com/tetratelabs/wazero/internal/wasip1" + "github.com/tetratelabs/wazero/internal/wasm" +) + +// sockAccept is the WASI function named SockAcceptName which accepts a new +// incoming connection. +// +// See: https://github.com/WebAssembly/WASI/blob/0ba0c5e2e37625ca5a6d3e4255a998dfaa3efc52/phases/snapshot/docs.md#sock_accept +// and https://github.com/WebAssembly/WASI/pull/458 +var sockAccept = newHostFunc( + wasip1.SockAcceptName, + sockAcceptFn, + []wasm.ValueType{i32, i32, i32}, + "fd", "flags", "result.fd", +) + +func sockAcceptFn(_ context.Context, mod api.Module, params []uint64) (errno sys.Errno) { + mem := mod.Memory() + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + + fd := int32(params[0]) + flags := uint32(params[1]) + resultFd := uint32(params[2]) + nonblock := flags&uint32(wasip1.FD_NONBLOCK) != 0 + + var connFD int32 + if connFD, errno = fsc.SockAccept(fd, nonblock); errno == 0 { + mem.WriteUint32Le(resultFd, uint32(connFD)) + } + return +} + +// sockRecv is the WASI function named SockRecvName which receives a +// message from a socket. +// +// See: https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-sock_recvfd-fd-ri_data-iovec_array-ri_flags-riflags---errno-size-roflags +var sockRecv = newHostFunc( + wasip1.SockRecvName, + sockRecvFn, + []wasm.ValueType{i32, i32, i32, i32, i32, i32}, + "fd", "ri_data", "ri_data_len", "ri_flags", "result.ro_datalen", "result.ro_flags", +) + +func sockRecvFn(_ context.Context, mod api.Module, params []uint64) sys.Errno { + mem := mod.Memory() + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + + fd := int32(params[0]) + riData := uint32(params[1]) + riDataCount := uint32(params[2]) + riFlags := uint8(params[3]) + resultRoDatalen := uint32(params[4]) + resultRoFlags := uint32(params[5]) + + var conn socketapi.TCPConn + if e, ok := fsc.LookupFile(fd); !ok { + return sys.EBADF // Not open + } else if conn, ok = e.File.(socketapi.TCPConn); !ok { + return sys.EBADF // Not a conn + } + + if riFlags & ^(wasip1.RI_RECV_PEEK|wasip1.RI_RECV_WAITALL) != 0 { + return sys.ENOTSUP + } + + if riFlags&wasip1.RI_RECV_PEEK != 0 { + // Each record in riData is of the form: + // type iovec struct { buf *uint8; bufLen uint32 } + // This means that the first `uint32` is a `buf *uint8`. + firstIovecBufAddr, ok := mem.ReadUint32Le(riData) + if !ok { + return sys.EINVAL + } + // Read bufLen + firstIovecBufLen, ok := mem.ReadUint32Le(riData + 4) + if !ok { + return sys.EINVAL + } + firstIovecBuf, ok := mem.Read(firstIovecBufAddr, firstIovecBufLen) + if !ok { + return sys.EINVAL + } + n, err := conn.Recvfrom(firstIovecBuf, sysfs.MSG_PEEK) + if err != 0 { + return err + } + mem.WriteUint32Le(resultRoDatalen, uint32(n)) + mem.WriteUint16Le(resultRoFlags, 0) + return 0 + } + + // If riFlags&wasip1.RECV_WAITALL != 0 then we should + // do a blocking operation until all data has been retrieved; + // otherwise we are able to return earlier. + // For simplicity, we currently wait all regardless the flag. + bufSize, errno := readv(mem, riData, riDataCount, conn.Read) + if errno != 0 { + return errno + } + mem.WriteUint32Le(resultRoDatalen, bufSize) + mem.WriteUint16Le(resultRoFlags, 0) + return 0 +} + +// sockSend is the WASI function named SockSendName which sends a message +// on a socket. +// +// See: https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-sock_sendfd-fd-si_data-ciovec_array-si_flags-siflags---errno-size +var sockSend = newHostFunc( + wasip1.SockSendName, + sockSendFn, + []wasm.ValueType{i32, i32, i32, i32, i32}, + "fd", "si_data", "si_data_len", "si_flags", "result.so_datalen", +) + +func sockSendFn(_ context.Context, mod api.Module, params []uint64) sys.Errno { + mem := mod.Memory() + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + + fd := int32(params[0]) + siData := uint32(params[1]) + siDataCount := uint32(params[2]) + siFlags := uint32(params[3]) + resultSoDatalen := uint32(params[4]) + + if siFlags != 0 { + return sys.ENOTSUP + } + + var conn socketapi.TCPConn + if e, ok := fsc.LookupFile(fd); !ok { + return sys.EBADF // Not open + } else if conn, ok = e.File.(socketapi.TCPConn); !ok { + return sys.EBADF // Not a conn + } + + bufSize, errno := writev(mem, siData, siDataCount, conn.Write) + if errno != 0 { + return errno + } + mem.WriteUint32Le(resultSoDatalen, bufSize) + return 0 +} + +// sockShutdown is the WASI function named SockShutdownName which shuts +// down socket send and receive channels. +// +// See: https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-sock_shutdownfd-fd-how-sdflags---errno +var sockShutdown = newHostFunc(wasip1.SockShutdownName, sockShutdownFn, []wasm.ValueType{i32, i32}, "fd", "how") + +func sockShutdownFn(_ context.Context, mod api.Module, params []uint64) sys.Errno { + fsc := mod.(*wasm.ModuleInstance).Sys.FS() + + fd := int32(params[0]) + how := uint8(params[1]) + + var conn socketapi.TCPConn + if e, ok := fsc.LookupFile(fd); !ok { + return sys.EBADF // Not open + } else if conn, ok = e.File.(socketapi.TCPConn); !ok { + return sys.EBADF // Not a conn + } + + sysHow := 0 + + switch how { + case wasip1.SD_RD | wasip1.SD_WR: + sysHow = socketapi.SHUT_RD | socketapi.SHUT_WR + case wasip1.SD_RD: + sysHow = socketapi.SHUT_RD + case wasip1.SD_WR: + sysHow = socketapi.SHUT_WR + default: + return sys.EINVAL + } + + // TODO: Map this instead of relying on syscall symbols. + return conn.Shutdown(sysHow) +} diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/cargo-wasi/Cargo.toml b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/cargo-wasi/Cargo.toml new file mode 100644 index 000000000..f1e93d7b4 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/cargo-wasi/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "wasi" +version = "0.1.0" +edition = "2021" + +[[bin]] +name = "wasi" +path = "wasi.rs" + +[dependencies] +libc = "0.2" diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/cargo-wasi/wasi.rs b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/cargo-wasi/wasi.rs new file mode 100644 index 000000000..3641e5394 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/cargo-wasi/wasi.rs @@ -0,0 +1,89 @@ +use std::env; +use std::fs; +use std::io; +use std::io::{Read,Write}; +use std::net::{TcpListener}; +use std::os::wasi::io::FromRawFd; +use std::process::exit; +use std::str::from_utf8; + +// Until NotADirectory is implemented, read the underlying error raised by +// wasi-libc. See https://github.com/rust-lang/rust/issues/86442 +use libc::ENOTDIR; + +fn main() { + let args: Vec = env::args().collect(); + + match args[1].as_str() { + "ls" => { + main_ls(&args[2]); + if args.len() == 4 && args[3].as_str() == "repeat" { + main_ls(&args[2]); + } + } + "stat" => main_stat(), + "sock" => main_sock(), + _ => { + writeln!(io::stderr(), "unknown command: {}", args[1]).unwrap(); + exit(1); + } + } +} + +fn main_ls(dir_name: &String) { + match fs::read_dir(dir_name) { + Ok(paths) => { + for ent in paths.into_iter() { + println!("{}", ent.unwrap().path().display()); + } + } + Err(e) => { + if let Some(error_code) = e.raw_os_error() { + if error_code == ENOTDIR { + println!("ENOTDIR"); + } else { + println!("errno=={}", error_code); + } + } else { + writeln!(io::stderr(), "failed to read directory: {}", e).unwrap(); + } + } + } +} + +extern crate libc; + +fn main_stat() { + unsafe { + println!("stdin isatty: {}", libc::isatty(0) != 0); + println!("stdout isatty: {}", libc::isatty(1) != 0); + println!("stderr isatty: {}", libc::isatty(2) != 0); + println!("/ isatty: {}", libc::isatty(3) != 0); + } +} + +fn main_sock() { + // Get a listener from the pre-opened file descriptor. + // The listener is the first pre-open, with a file-descriptor of 3. + let listener = unsafe { TcpListener::from_raw_fd(3) }; + for conn in listener.incoming() { + match conn { + Ok(mut conn) => { + // Do a blocking read of up to 32 bytes. + // Note: the test should write: "wazero", so that's all we should read. + let mut data = [0 as u8; 32]; + match conn.read(&mut data) { + Ok(size) => { + let text = from_utf8(&data[0..size]).unwrap(); + println!("{}", text); + + // Exit instead of accepting another connection. + exit(0); + }, + Err(e) => writeln!(io::stderr(), "failed to read data: {}", e).unwrap(), + } {} + } + Err(e) => writeln!(io::stderr(), "failed to read connection: {}", e).unwrap(), + } + } +} diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/cargo-wasi/wasi.wasm b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/cargo-wasi/wasi.wasm new file mode 100644 index 0000000000000000000000000000000000000000..2ddde1064d285a9000aa3393cd087ad96e738ed6 GIT binary patch literal 94484 zcmd?S4Y*y`S(v$h&fmS~Ug^kIQemlhpA!wpjfGX9wkwB;mP+gx$4Q|4%|ORa6PM)P z{8+L^q#bH0iIbWnErz(kFaZo?h=BwGV_FXrnhTgt7tb;^ep7am%;dcB&{Y zP-9orxZ^c{>$Z#68~%+~-E#7_SG=lNxj;j!ZG~68=47#UfjT4VeCx^AoVx9Tt*qSs zic_z?DQcm!|N|P_B~ytXCA(g zzw)(jxZ}2BaDg7zsqr^nb;qe!oVsYAyQs$OJY&5}m+FDiTVDT)*WGr((XQNn@(r)N z<+eAz=2TJFkCwk$4(e*ugG`HYS@p|ZyaC7O z)g?t$4EiHF8Q4+L^G{K%`06-brybx705TMHNl8`LL;f28@36eRd^7+0JlHc>ftk|T zvs=Y@_`G`Xy4zm&hLeAjE^YyzCr=gcDaW_m^14^N=JmIne#2{CRlK`g`E8m`<@inI zZ!VE6CoTs>6&1Fn9w z{F^WPE8qIx9RBbBZh775ulUM0-c|mE-ztBjd}n#tjep~Bd-b)m7ypy;H_LmUhi1CJ6~V6R*us>TpvGkO;tqc@v~>|IxAK!@ReqqMjPq&6Y1kW_FF&Jzhl-9<}%k73yP6l|ISc z2EUK_8$C5WZa)^cCAGMDJnFPJPqi;R5jE_!siR>ke!6}3WIT%($|kB*=~MBnZKTeWFJrO_|CQO?5Jrcg*TkpPCgN zDtIAqWIMe>)o4~+-?rQg(w$BHttSA4$!*F8s7FoFFxItk(_=2D6-aHHt505C^?2Ib zm=z6B^-^ic8dZns!4}Zfo7c;x6rfZ!l~7Q3^CWFor%tqYCsMg-6KU;qnw-dk=$}p_ zo-+W!a9Gvp)T3m6U!G3YIrruK-dVZOm{-mpbM>t!W`mtay~1GfNLQc>+uUHx!_8Tr z`pvLef!3OS9(uFdJJzhGH=f9-o)&2Qs8{ z_h2(gC}#eRCqT&*YM7Swu?pflR83|Tql66iMzso%#!V%eMCDltCGr1_vvNN#GR%ex z20bl7Mc`uJRN|xkwOM@wO^F@|L1{q8H(mz2LYX640XGbvm*{Lp-$m}5YC^GI^I)Y%cq}yddTaS@&4#EBweJlfAYeOGzkiqB`kUT@+g7A%eLg~?kJJQ zPo>?b86~_>oP<+Sc?!ZS(sMRW!{aB@fsHW&VR=qU>8qGl{9h}kxdf0ReSt)HdXvAG zU%&qp^vUyXzPfqoH@%lJ*m7Do{aJ6_I!x5GTC179`E>T1J`fe@&&!nn8gpD;zn?1o z{q!b~%w`ETeXTy3A*zuAgM}1WVQ_hRK*HypRHqf7NQRKX5+NeNZiFcK5p+qBk?&{t z)S1l6-kGL^WHK3#XH|@-ei10@byAM$7iG}TzUhFsxmcSOk}Ox-Nfwl3l9j91R>siY zoDyZ1OoQSi6Xk+rmuNd^QG%8wpztM7rUL{MEZY6VxBCNHz6W~kssO(?Zv zD8iOymO=+!Z0e0DvvQV#iYYMDibN~W22ixZKYGi`UBMJrj#144JJE_dPzD{`2n@q! z1iv-|!GdA}5EWwv#HtyPQP+Jl>YB`Uoivm7c4;j*oX!}XtpH>hm8X%;sQ${;rdZQWLv@SDBTS1Pgn7p+FfoHB?hbyOp z&O}4Zp;=)@ECRW8(-t-uM7?=pV>%d%_?vlUkp3hKss4Nr8hYIr>SlmG1^o2^B+NmH z$ODFy0R#MMTG){zO=m(I02SPp%c(!u&cs->(<7bTiE^O>COm)C!A?$?)r7irf#Cw0KL_IaB;zGmM`0{V6`wfB}9D~(v9{^ zkWoBHk5VO!<)i`Kaf@|64Pe2jwG;E7+>8d_Zv?q%_X$S`yK}XF1{Xnw=~~Gdn(n05 zP8N0+9wA1;Vh5!g8rMD0*Hnj#H7rYruWb6E)SEu^hsJ+n({DTNcby_x>P}$Aq&n%X zoRSkLQ*`bKgaS0CIJ*t>)&c>sv~$=LH*K3c<`a@GTi$QYiDUjUGeHrdQ(AH;8P0q> zYPE&TKwT*_6jJ#;WEaY9E;W$FxXrxWiFt`F4`xT~BVgwOxCBvUi>R_i)P|g(B|O?h z^&<;(C}ILeVjG3{4gJgw*C^ARM}(@iR{v?%RRS~|uYXKeOo`FwttNUW~duOFKknje>&7U#-&;zp(rc@urPkr!yCvK(26?2AT z!`vZkLgVwBr>I);oKWcRhYrLUN{lM!`As@y^zUR)4Zn$|^^}5kMl=rs*6fAZP!n7( zJYkGW4%H5}xXv8|dRDf0y=05SMoYH%6b&@eH#^XbjuQ!)F!pYOrgb+FO0cF!hq{8$ zRnWWco2ZVFL2XU}BaxiqXDw{-q#cjFg&p6^c04XQh?*9N2}lgo>ta=^jvfa3R7(|W zTz5+=Lu-BJ3$r3fD*C1aX1MK6wArfyb4O_m6SvZssX-*S6A9>9$RPuI=^AXMEXBF@ zYX3%hA)*^F`hY;pqD;@bp!}3ZmgOgJq)+|+R&hmTbO~*&g%mfVD5qqEG%j{jesdK^ zt%Fb`h^i74j%pxW1LgGa*5vZOMhXy$!%VONE;gT)9aSdTPO6CM&e>lgSr9_i^GLQj zmt^TMlPo_Ynh%o2gcJ8YN!A(EG?QeBzaY9K&_BKVh)h`~S>_p?A<6bL$yOI4S^d?P zWDPn5InPP9pGg+qFb~JUX^{1TWI+lfTV;~PoRnm1W}=>l5PD+2l4Rw0NEXgw##)jM zzrJqgDNhIZ+6UzJlYiuNXOEzk6uib_$+2~S-jV( zH@dR9PP`NAxwA2dwL+;}i;h9GE54ihJkgG2xGy`JJBaogf$oTQmhP2gxLayOm4*Y^ zdV6ceH9Fo7{O!r{R<2AjyB>>a4LyI3m4;A>-=qdzpzRQlLuXPGG;u^%*^ z`Li&dF{vUvyMysuX5$%o9IGmrL=J8(oUjO#0eOIe?Hzq(KUW0shH@HYS%>+|#xt^? zyUuv#4&zyj!T>$Ov^AhDS0&E1q0uAJgxVki8i+)?mNqP%E^M=DG)fm$iwJ0nO0dx7~vVuq>jFRjEgv_W>E8-#4%XNe&^1lCQ04E4sG*1j_pu2~pZ+gvl;-DrQ_ zD%fs4vm4gy03a~92=eV-xNgyKxNgz#HrMU^hMCAb1OUgQWDyJ6V@^7PV-y!6I3BSc zaAAUD0=5%eMk{Kec?D^C3Q)>r``DmjcIm3~Tsk!H+^KU|b{Q7(F#OzX zAwycB0I>fwzL0x)JdRGTN0goK)Zv*U;HqQDw^Hd8Ze3w4GTb_U!mUGibT+cD7-Yb? zkKXACnr=H3bM|Y8G^dSh|4>|pCM)=OqeJpI#|;f0(z4NHf{0DAUpYGd*|l=Oje3Jf zOLa{B+?!#zt8MVuL)-YCF*^cV*3ey?D;c@4bN;C($Lr|R#FC2P0sP+d2;80+oOIOS`J~}Dv19qR7*6xO||UMFtirhSe>Y9 zX-TgmG+^JE&@k{Wq*_`+dp4>iC@=bW2FeT7q7&>QYeYnHP$nF9!#w}WcwC=Z#@QXcK^NO_dEs^whDgDSg8*_i@b z)gp<6YH6u*r`NO>vTD(8Xk#y=S8NLxYN)niIIEVq{8jeBvxEy#KnrC;PYiU;4i~D0 zj#|}1Yze6ZIc--hQL;_7M9D(6;JLGMAF8E7wHVVtL09Lf7Tgj;FU9$)48CwTFCGGS2Q%so>ABl*)P@1r5=*gGJ6oD|ygU zDECRAF~Y~6wT%f&kA_VVRZOK}WtVKcSp&8dF=0g8btMQNUso!0beYsq?Y}b+Ot0x( zRZdLI=%szeJR+V?m|iNzO72bjp(&+;r^}mICpFT}Bo;4@Yck!)@}OwSl=jY~4}4;) zI9$*i+HUeQc6TqQm^haFAG$xw8bOh_aMt5G(AabZ|dc7kc0PI#ZBugjAQM! zB&snEuYcU)7zYvb<#Awe#W*UMo!c8YnXY3D6UqZbqZVrsKpIcJ zVO9Y{;A?556$4cDU+mEffywVFj`L%0EYo`@h;RC%fe zy_-fQnaS5lQ?W2ZH4z#?c|wZ-(X2vi>eM>D2}*dQ{1XuR?noGSn#IYzB-2u%(S>Ks z`v8@n3CT%x?8LB&mhG|l>Cxpb8P4H}1HoQz)(l&(nRVFoC%dDCF=W`gqS`y%6EwCm zk^S*Un?3KFPMST(o4emG6h@OJ9)YAVL$zzjnC@iURB;*Rwy0P72w0`H zBjQ>9hZFfR3?iM?spTg`FxVjh6Mph~!B2f=Vo5FxnJeW&Kln*Tudb+%=%&1pkAH6^2hH#>&#jM{t~yZq9K- z>ST@sp7S|wB$X|39CuW6!o%puKs1Z!_MGFidE(t?$8mO^S*`D)HTZ8b9R>am&GFAP zW@ba4NiJxUb8sAlLvsfpK7RInc9h4PdmSW1CTTL)SJbh-6+*qrL=8n~${yQ181e?H zx*&sf{E~ll1~Ao970E-|z1V1L$O&yvFp;XwU3FELEJ7%I?mxR#O#Zs!=}=LmKl-~HVIE*NUMQ~Z!)m@OivAPI5u-!Eu zRu|@k8cM~~lo$}1NFmp~!KT5yX^ksqNPnu_}6f7rSD0*HUd6ErFp0B;8zPn5xW3tlosd6`1e&j9O ze4Ia%TWOg_uc%*sP5q5L{TPPC)zz!G0*SBX=j>e;yc%n>yrv@1p-Oxw*x`znuC8v6 z%a0da-YwFYME*Vz&;Zlqe-Prc@b&fUz1-8;@|yb93wWrM&c102!;YQ;9+E?@DvIk0 zO}+pfK$uNPLV6|y zJ~xQw^g&)tgUQ`xE?|kWdj|t_S|Y(=G8;j1s=0$uRh;S-?5tRSftc2Kj>#!*?kN#} z<9Dx+V6D`LWTvJB7Y)cmVsb&22^l03Q+aBWLGTvk)n`_-faT^6B3aWqUgyr&U2mzT zNG9?=jSCuuTq?p`H;QIMhqDNx@z}T!`o67A2X zPMSs?aX?-H$if-PRSCI1+p6`muSy~`!W>xJ?lnolNUrkQ1EQ+=Z}>*!)CnYpbVmC1P|FTl^va6JV)9Rk)Ds8dubWw7NtG`O3m(I0~v4$<}{o`+`d4shl^m!xC)Mot6-kbfwd=Z8`smNF|%_ z%61c8=_Wi{lEP;ZEgKP@%qA@kaTXPIa$6ANqTk-h_G+`seMidOydInzYx#I5E?-ku z>zyB$rY6!EVAG^Ke{w=uxN4H0p+KTq5<2*d8;U2BMp(NQU~TFyjY$zp%kI%Tr_na` zPAAZ)Y))nhAke*#m~#^y*mN7oZ=z|#^H5dWG=oHjbO54BJhOdEiQsSt%j5!%fAMz(%Y>FR~}1DdWnbg*_aV%Twfg(~ybHu&$d9 zkkv}tej8k-E*p2aWjTsJi;M@T1T{7@PvG3;sQx@%IN*0<8pw+EJ>J)tB z4TtMW^fK?{(=()f{VjamK>qow1Z_$OdT}*!byjJdcgTLoZxBO4o*Ee2XZtxoE{j!yn4Ip}IH#7i)4bA6Gogj;(=0vjOh<4EdgapD$s9&4Xs45>90g8^jSrDAYIYpFF3*pqXmBkN?rIoVZUK(bhj$;2ljTAhS4J zjJTF2C>cnr@W6-|$>?-=yX#8!5D#l{%kt z@65ueV`Ty1o_eR#r~lbj;q<1-DTt#oTY6r!?-Zjd8O^6{hQ$dRc&r#phbv%o74$)G zAkQRHej@pd?fRF&8m<&rf&J3fNf7ydsFGhJ{*%-3(5kyB*p>F>0&1u7hV?9ze#ma-!OAq~S_He}R{D#ZL&94j>{zhXSD_S#W z#TfuDmh7(11dJRqQ4lsf_+U*3bk5C>N}oWQ4|T0kw?oZ^LtssO0Pw-j4mHDk3H#rg zu#Gh}3HTypy0V})p`P4Ngg|p`L?sBD%C2wD1o>AfaGq}n)C(lr5eZU!4yl%NShLfA%G-8jw zS8g0CXe0nh{f#RM8gc1xkBzKHBkNY7k=@bAo(-m!FeI~-CkTde*S4*}18uv9it_3r z8oi?EUsKR~Q(slAUstT>db^JntOGfLyv+}5I<&}6x7fH%WyU#!*#r_h5{=<7UD(#K z74SL(j^WPDFaxfIe5ru%4#0P}fUgJOm(q!i;K~sbR$w-z!=(=Wb z`BfcPU>qVA?vY*qq8PGwNe~WNY9y-R-#AZmcNc(i2BbT?fN=l>m>_M(pc^d{dU*jt z6rx^XQVTOQvMy0pjR@u+#!%qWBkmVdmA1Iz56d?gwI`TU%;8hh5oqbB&v1Ok5b*(? z!V7U7x;nKnU9rGsYcn7CXrZ>I$uF(mM83uomhvAuD=*_&2w^Os= zDblhq9YO;^aD83HlAUDJptRHJ={J35h&i8sH&~DDy;dcMoW;A)#y~eh5?q<(8Nc3^D5!ji{?eG(T=s$izC51K!)p1(8=ccum&`kst7d> zu|T%HWARKvEI~e|*PIBsYKf4mmI%3OiIAESA+Sq?WtP2}2$vcGF@?Ui2%HB7>hU}G zR)aIOX&E1dmBPY(Vhb~uKh7+OAw*eJ$F~0i6~#*-oO`JTf8scJm6SH=9_o@=x^sc`H_=nPy-;H7M zofcs8X^55llw(@BAHSRxYY=h<*l^DV>E5^V&aTOGE(0&S*vhWZt1u=zFcO8986F?fhmt;bg7fa;PFXdV_vPBAj^m-jx?5P&L)CY(4hte_*u(w z$34ShD&H1N&(Ht+|M1C2-}TeKnZ9~IaS5zYhrm{gorP;u|IvmnMy z+=Gs|(|u0_FDc)>%trydCl`j*IOhhai1?rKjqn~*neiosA&O0vm|Y}GhyfgTaUR1E zIC(W@INeQ0kaDc`j*pk$Hd}i+ew3xS7wyB@dNXd;zj{{fcY${u#1fi?;{-CtgUV(N zRsi8Gg|zadf=Jip&8NPLfw7qx6sEK9;`;9Y5$xT{lNfS~g7z)9VM7NI=3mZPS)$L$ zyJ(e20V-D3mdDf~+~nnRTm;swAh$dP2lIq9{Ae|~e(BX-u8zc&3+7kGRm0UGDLefn z0tZs2*|^L?^Sun&LMF@0T=;-jEz2fvoRK1~qF4nDT@#9!mQB198)=RfFANnEy|sco zQrd=?)16Fw5pW(-gL53p2PL^Fxn*$KxuxSy6|^k~b}QVYb0J+BFGfO(h`&*cq8*Ts zOSi>hXgaXnfXcXv3bF?lU!H6Rv?*2cYZ^j1d0PhXIOg?BfHP~57js2O=_~oU=SR2b z1!hh!#6Bh8U~-2OUa|P5*FlXsVdQPH?G>$lsL+H;aid_il!5>l^eN zkTCH~YN~IrItSRa)4>e1x<)co*RM5W(eSH+T=Y)$e9%8XxRCaYCIZ?ig20 zobccEgDw0F`CPy!3&1gN4Lk+lL>d=>yIP%}Z38@uO+(Ai9&irHSQr`sPBstd7<&VO z!)<4!WctjOPj=eCRX;skY&cS}-;VD?^YJZ)4pBx5YfRCLbt-py^PV5;X4cBizG#zg z`C)Ef49gPMxS(bu}w$;@1pLS>8{#>&X$j zOlwiV>Pu7{rb|wxvuB?wPS`qPp?xPehH|ABSFP|KCVyTq!~IS<9*QRp2Oln0a~v>y zF|;8^s!%WFN7;DXR>Kd`t=LmeG)tTP*o)VDiik*6!!XLV43*|ugQ)f4GcSp1R9tNk z85oP~m1#ij+MW``B0lzQpdvL&m^4Kp%0=^V4+bwuo?TQ9p?UC=SN(>Z-snUo!&QZd>j{B>Y*c3&X+L(J zqU9=4oK}eu=RRi0H~#gB0It`dr&(9d7~mv~##)>y(ksS=qhDNn1Ot7nHWMJ2H$O%I zMNG5DC~)I1OM0+p4NF~?j8JlOws)gpN}Or_Hls~8?_!G%o85#H0nhUiSLcC1(8}y! z9z6008t$jj?aUnL%7X@7izzfahr7+31>kfzlg?4JVL5}(?Um`Fd3){Dl}qy`qlmF- zsDKDpvUTc`YLfk|Exj-7kcxDe=`gr=hSdg?S7|$ej{)+%KEw|*z>zHez$H`te6;Nm ze#mtH5`M^~BaagLnD%K$#{`~rSn25?O|eaQ1gP~*hy=903Az&Bq({AS1NQ_IHM=L! zmktWEbRV%Hk~$7%lfWZaDQw-7YdBabJfSwNE_Z-&WAGNI1Pseo+Koh|Gxg3^CkL6D z5R-ZrdL=p*RYR@MCYb_kFW<=?{jPt}*^2Im-_v z(U@Ki_u#FpO}?-?mjBuCKHBByz${iAj9${}ba&Igs{A4scIZcs^5wl_$KQOmJdT(} zJno-ea{TAte73r)xy1V`{PP!1?mzyaKmPtdF7BFLI;HrEdh&9{CBC>GEec&BGw()Y z_!2I!Di2Qg04>PF+YbE9a!%r|W{v3lq`8!CT-6~pvEQX8GAI`2dnvrPZK;Xc3AS@p zITG>hawChOdfAvL_$85{NLo3CaU>RXt}4lHG<>^ngM9@szcMpV4=Wwl6=hqUa_7vc z8l?yDiFFW08XoXc4+_S-;TeFb;$6FpHYX=}ycY-dPUb<@7o zvo6vLTgvLKYt!s6j=3`BByFDRmD`zB@R?U z#h=l}!NI}VXorTfq;*f$4f*gPX7qX9!XnaOqGeFbD@)^>{ltQK-n z)L@5%m&FQRDy1G`89MKDp!38JN-CVs%xi`8hg-4~4^f;#Q)qWo%SD@z$VfBZJd7&2 z>W1;OtPo>B;8}~vwAc>#-SPH3vCC?eOq-K_!yJJ2F{CrMo|r>$^)$*0XU38Pn+-eZT@Im#^jm|7dd5n(vg? zBZ-ik2fg9_bfbtjN|anCYBC1;y&*PAZ&BpUUAH8}nCYRp-$oZa(gpBvpxbLiuF;GWzRCO0P94#eT z`zYi2{U9oGQW@mF3rwLdMV`fASOo^P55&x~aG~;d(l!y#BFyD_}UbMs(Y z53gNPf%W=P%>_1kf!O1ObY5hkZP1lC{1|Xv;brLUf*V)uf*V)uf}7$7sl(K};FgE# z$hJ2^SGBUnl_@aN?=a$F!tC*fUmdh)aaIl&4YhVvMTtmd1FC>!%ep)r9IPS1A}8 z4(WbaC|$4TG-mN8@ZRWL)w?4=01)oDWsWk0xlt7P&JV_)?0cvcYe3A;^8+Gl9+=_s zlHIZ&BU8E%7Z#Iu~C8DFI10Eg3Q4{p|R&_Rm#I1zfdMz*S2H)RYP^BBcU_4#9^^1xt-!8*8jlO~ug) z00I`C#+_%LNfiE)D&4VWU^(M%Rz&=zo_trCeao2R-b@wqEZ@N5Gm8e?O&BCzayUPb z+mtk~=#!X2Gw)hMBFFgfGG)H#8ng^HV;DhPjEH4aiEEUOG<;s;9O9xJc0$m$1jWdj zwdkc`Np8Yi1>$Wq68DZtjDSQ?*G!$FER61ugo5CA;t(mG5Xnz40ny$TryUavJNR)9 zVx+~nZ~_5qr02o8U;%{eV!+zQ4uDtY93gc81G*!!NLvW#Z@FOs+iV6my138(9D_?M zKx8Z9pBb0^_LDmce}u6w{x#*UL;X?vUs>}Zr0!<yy48pORcP4@zcJFjTxp$;f&W6GGAgFJQn1FO_aFk>ecC&qqN zM6E{#%7)4kE5|j*iuU6VAy*ABa~0tZ)Hc;|LpA+LPfZW~b1-nYaLZl8d8Kh&#DI6x zd*=XA3+FjLU?fVM4$f}^0Bi!}#_4j{jyqW&@alZLizr)QB?8`Sl^nKjy%GY$%?m4A|-58HnfqA&9kPg*r!qU9RI3`f0eot ze@x^n9}KaSrF*p4rPXXM@3vCn^pukNv#oS3O8Lsswo-bdE}w(hR=OIcd(SB~l2M-g zmc-s4c6Gr9nh)kG5?Pp4=|S>emon(mKj5C}XHbl>zM>qMn@38LOQ5?9^%<2a(&|x2 z6C@lhR^{6Nat9Cjmn;~(7qo@Xx9uiJMaJ(70|hpNAECY~apW()USnE3$?yhFzl}qu zHY0DYmLn?|3EQ8EnDw_1Ke6CNqbKNr1ErVuvnL(;ryD9Sy`UH z_!71aqzduv%*b1WmGx!`2J7r)9%TE4SI8dsp@fQwAp#3$OSkl(`B}UeIE0WH^Hk6f zY~0@zR%X#jFXKxF@_0c%^R4}IRr`X45bO)yCctZ7j>sGW3XIYt;I6I?LWKN~OXMB< z{QMbZaxwrj$tw?4>n#$<1)vBh(i^b@-Hv%6M9M@*>5e#xE{sK((;(yl4IuQM*G+3s zK?4yWh>WXtftn>VF^;gBmb4Mco`edr>!jvxb1`yMxk!B@7#$QZjDXJ$K;Tv^0m1Ap zfKc+GYjNhyTLQ+w4iFrWbpvDEgf%R}Jc!C6vP>%?+!4Zx)|?62#dWZP7gvSVTAyl& zbgbd4rYHSyPQ#_RfI?(qyEpxhpNNaJcv!SZ)kSlVUo>YzR@)qx(HvTl^gWx46%JN= zol<2}PFo^&WwcyEF#Jmc;#w;)kSr-Ski3KjmU)cX)S=B;g~@Cprjb9}W>TH1Vr9TJ zfj@!~kBxBXAVX3JSmElVQp~p-C1aUt=(=By1mVp=e866{k`z5R+9aq((TKcd>>myi zwHe2Uyx_vUrMQf6MBWh%Bd?hJU2Y-)@J)KmU&6G&KIpmdtnW}=tE#A z;3Ch47kM_?gg3BC6`AM&vEVv8d{tu9t*~R1G4kCN_)){x7=(24_In@rXmJN#v$@%u zIA&+=IKikR*tp}vPSt?Q@Y@x9pLSh4$3De0Q-WF>)yJ40P+p5o2uKu9Gm1ktG4;ke z?*0{CepMkU0NkpyNK`CKAW}0T`WDkjoIxUB9u0W`e5517O5qjaJW|vxn_v?XzJNWO z(c~%@UL*6zz!PMZo<}_cL^S&U99KHP4kwo z=aW~)ONu>izEF~Rv)5&L+SgblNlLenIf_15RLSwYXt`1EBXZ41x_C2vV-@%(bI^@Q zEE*mdG!<4_^rJ(u(3tT+w}Z*o&mjgEGVnPV%DbyBHV%YFn?C7^TTY++5IK~STbaV2 zf7@1(o|m3_2lwA;%=6-dVGaPwfOn3E&WGg)LiEh4O$jPH*3OL6CK@Z~iK$wkQMzv9 zrbDX`2V(rniU@T+!Y7H9F2~S}q2vy19Ix{l)(bY$bF#Yo@{P17U%lu14d$xfD7X^v zkY6lfU7N2UQ4=*4Y@}y$RkKQ(b!3*LAulNfy9mOAv%#Joq6)ZCfHkW*8gDnl5aiEk z*g(e8Cb1_M+GDC6f(6gaCk5VR6zH!O%cV4$dW}YgvoYQr6!I*HK2tP zSzco2S5AT9+~mC&1Oe$z`6}<9A^R&^m2KPQh1)Jao3>F2@A*VHBk>!)6{3d0eECKW zxYrs&Oi6lY>0G?04 z>=H!$iqk-^aaK;Q4qN(p>QV$@Hg1`#SgLXL42kT586J`G2@c(6xdo8o{P~9cxy^_$ zHc?O;Fi#}Y0IEa-2!p0wbYZhn(10IN+P3I2&`yK++0f5git$I~NgV>3Te+Q;9%hAs z#!c>0IkQ7|-NMQ_-7OYY>ac~fWVa32eX&wQ$VWrxUA;Im0+_I2B*ZCl67e!!3lixY zFoBa%(?lwm20fX)8j-iE8Aq`Ob-H&w|)UP zu?pyk4zja1)0(%6F|W}K+p=3>w9;Aut%0x-27+Wvjch!$Pq5AI;HZh#5iOA@rk;k2 zf_X@X2Gc4GlwQ|I28~jn)oek93Lz#htYA&bz(V&Pp3-^4Ldz`=%a<4q1|QAPR)ocv zVLy1_3`dVNPebe=n$^=BeT*;JjGT9;1JI2&Ux0#8w;#imk2557J^4qB~A96~?yuo^@!C(cJnAAx^i+S_TFU zt+=|bhcLV`f0ws(VcmSzc41w^7_lHzbd11ZA5y{Wtjm%0*taIbED10TBrV$Poa_7YM@C&m&a6xT=e4gwqC@|TeT=Sa3%} z^M^49RN(^7$C23D){X<@a$0TOWK)f|dUTrKI|BDhl(ZDouJ`lg0-E>|E|VJ5X-Dji&}4O zbYC_=R)n{UI7AlBhFkb~u`b^UknO(^z`5~1j$YPXOrLplOGQbhHVu(q3YgNxLV zhPISjHAxUPmME4G+8~pMRDvLca9q;CMv;icuw_nz$s!V#dJfuxiVDSiG5*+q zQ!8=|CGRyowmie>CtAxI7on~O_-9cPsWXl7f15#7nJH0ub$N9xeYAbYW0EPooG4rF zpkSZJwugM9jJn%M-i21(sE8QV`Mt6;niq}Z4#m;4I7FKfy^V%5Tng#Pi3maADwuNH zv$oNFp;t8t@zjp9o6zlq1V1`Q0c96!8pz9|#ev)?Ax+q?3{y=0f9$TUB0WDnbYJJP z8vV)*u!Q1h*roh_$E8r|tW2YJ=>gv{wMYDG+L@nsIrGTKLwq0mYQ3n$^g%P}!S+4vAjDZNXdHWbC_iF9q*svvPe+e%&D5a_Nv`FZaEGC|X#j%- zuA`YZYB9Y)^dFZm$RSy|SB7BgG=R{G!oX1!Mr1kz)xwDE5n>0k7!jtag#w(X1)wu7 zoTQ8iYqV6EC#nj>Lg9v#^R!g<=c?t$e%xt^b935Rysw+Z$r+ky;}lg6QoO$nQtZ@H zo?yjtJHwGI{O#@Z{%GBv1=BGT)!N0(Y<|O^;h*SVNTD^7m|z6cqDE3+Fr5*Q=Z1HQ zaIzstNyOq1FI$mZlZeL}(4@5}MWG>$AoVK6@kmtU1%yTvVWUPZv^^3hib%SNBBO4p zA4NC@QKWWCgD4_{Es97*t`(C)l-Gr|%yl;m52|G`rgB^mYtgvic|}Y1zK++7yakpd zUPi~G)(q~`Kk#=jVH z)<>2zOO~T3B~Xn3yRgB;EHQMyG2q=!N#!=g4JH7%9!+|OMNruY*ep(5e3{dO5ffQ}}t5}eatd_ls*K^k%1d2c7vupKqV=wFT2s3zi^PapxM!4s-A0mK9$ zOG-iP&=FI8w;w_mg57uO%PGLMUptoD`73 zo8g?M2lDlF7tOF>Q{j{l7if01zNwMM*>1^WjbSsJZ0v?W8r4;k8zqQ9NWNJEI!=9N zt>Ohp28!)RO%}=AB)+B_^-^C~GnP!zzplBF9~pX*u5@5c;ui z2xGv!at>}zLdF?z)b7=QllxsL!{AdN47hAS2@nq8h+5I_J^^wR zJpYAj!Wq4;y9j5f`F(0QV?cf9*7${gmNy9WCtr=|lMf9#M-V%zM0285wbdCOxrN0h zf#ux=y18gI$SziZu(ed1xJ;qCk=JCl1spjL+aMCqY~v>@R)mpz(^yhUkj7`m$b?u- zL5^|R+NB1)D@K!V(fI^o^FtR(5Ryp3RJV_@&E^$7eK^-pH+d+z9!i;3+VX~sGY;R= zeGGXhnc&SC!levboi`+#I=>N>9214w9;|Q2V^Rv{6~DlyqXrxBe7raR__Y`AbYCX( z*Y?h@_RX&jbWQO>??l>na>g{)k;N<-Sgr z-;^;w{=cfSR8&7jM01F5#M}xF(Gll~RQ9|#61mUb$SxrX2!XE+dtE+FOjk|uy9=?&Q zf6MO+0By(?>8q<-Wws%aDOioYhE)u9=-QGyQM!9}Df*OKJR0GO96U|sPwIO>&quaLi7>0V#UuV1nlgfIH9E50!nA523><_+V((Q8v7 zh<3#S2*2!)FPS@1G)+l@5IN|8rzbu5+B?z@ANLNMfxE%!`C}FxvIU9zjikyZ{o-w; zRIa}jZ!>Yqtfl6)O}8~T@2>+OH*v{nBw%_fx8k>_AW+PGl(sAZ``#0RW+({+xX{5ENI0V<|Tx=yo+!KCO@a8?! z?8O`Zvx>l5LgiM+myraRJ0L7a1F15H5)M(&2!MP))*mu=ZqYN%#@na_UVcEw!^51`IXJO!VjgeqWR+? z$q)Zy44~W8qloXgA>U%rQ;zFVBhvuw?lU<*)+h^EOGv9NVl|PM*cwitF02)X zMBAhyrxAx~m?OaeHLcQvzp$k>{-7{KP5^i^B{jm_E2+E#vjuxN1Ht`?@qei1PF!n> zx0*!G&LUl!aw^@-Q#%7_0Gmb5uW`-U=d1xJX9(+KmBp+Q8_%nxfz!JEBo9`=-n?Ca zmB{u(Jbh@V=2JW_VUE&WKTfi285>@J`e?C6;C8;O39j@UmJQst(txSL-h79`#m8~Ok_Kf%VZV`=&Vj9KLR8<8K z*n3$j`m+5d)1iOqOuVbv~`90D#Hm&^;tn5$VhaZfvNIb;s zjAhEG2uVRoEM{ygO^^8cIS+97V@YpM0c(l4IF=)N`(vx~{QM5sU4_YKMAMVT*~R-9 zRizE22_G8NRPa2fKL>euvJ++O`)&L!5SDm6t_xC5`lxu~>TuB%=-M)8T@Iu;_wv=D|S;VIwSp7oEh) zoVt^rpMw{@5K%G4sbh^1DKZ5|q2>aBZ7<_8V+ve`{jruREr-%qVi;g6b}aKg+Wo5+ zjkitK$Tc3ASjJlwG#j!~&7X?#R@Jd9Ytypp7w0XJ$M5-#;%gy;V(M4ZLv7--W7Fd< zZPHRYY;qYsK|u zz7zNJzjM{sqsWV}xkvA#yH6C6gG(Do$v%nXq(D;6M9q8bU9e@$4JxkY6q%(Kpo48N zDj8}Fk9ij^%QF`$D8A9G#+N|@1?h|Na3%-1jWpkfs8Uv}-7eD|Te;@hHbUEH4K$=Tg&plU(nCyMyA7mFk8p!j4G5_T9x6sJ!aln<^}cC` zydm7zSlmNVVArE4`pg!H<1@tR(O;xjeZ9O1lhV8aks2UwZDvkAAgQ`5JhJc-xl)DW zD5|kNuK|sHB|neRn1a|D|i(I6UdT<$~u?@V(0gSW@Xd%LUJ+;QN;g)+o4txnP}wA6hOr zNWpuT3%)2FNA3K-+o(W!)-4R&dUIxG3?RsB2rAV#XSgf zvjtzGHCxQ=&1OrKh1tS0Y$I3#4e7zHv=n9wSFPECgQnTy%hKePz^(^^angbs=N~Lt zC-@+(bwZ{X+6`Hmvk~jgH2L*vZkKOc*cZ12(r#B>R-O(8)x(l5w4$Er9RXcTuIG~M z*~%Q6U?abe%T>z~ALlgOVE4p04$y>WtHjAKT$x}Xdr{ZVV22PmAv=Qfa6jQr76la0 zxPZZ@bk!bwgYh8GJ@k&Q1Cpr`KukLuVvF>i_oMV6irgz{B_HVSVPoDCc^sF+mGFe+ zrwpR|*79MXydFbFP5dg|x3twhDC1GyzdaQ@9XkJ^-aASthe!~m*xXesOnWG-R*t%# zsSjy|IJ2wtrphB9jXEg#vA6+v( zigk24b%i>lxM7Ey4hSaD{i1ES$C2BYCbE*>pk25+i=z?0eJvx-G{qcTigdCn-P+H7=9rBaCVMRib3!ue!?MCX!at8KBh5Y;*k~6#WLj6 zjK>+k;1D##nt*^*v!^Y!1;RJL{x(6+Mte?{gNpGVmh)yJe1OvXQDp*?!WTpW!JfKo zFUu)KnM1J>x0TXePBa2^u9XrV*JkuNQ;<{y9kneHYKr6{eE&^0i9$0z$jL>>?m}M3 ztj8L_;=HzWc9fGTSyGgfz>Oa+_eYLm)j)KACN6%Gj?q@oZO1XA6R1qNU)^@Cn+0pA=VLS%?mTU z6BP@C>qhKCLKKJ%vQ!;wchBB*gY5*FGLKqC4aE_hT!E8E3+0!4k~pY8X%GOG4yo5q1hA zr#CCx5##Md_gW|mYJ!8P7oJh*G)d?n1zT?u+J-9-15R6hao~o)9U%N-mXjJ`5~sr{ zwA)-#=ai#Guc;f#JXyNc{cLawehyRr1w8u{Nm2P+w%F&St~~@knQN|Gd&v4%9+Nz- z-AH$J=UKhC$|gzHp**Cawa%SG3F<^b4^H5!bYL?DoExZV!6r++YsB(q7SmNluns2@L z-zTdcst)mfbwzb0kIaC4>hib5Z}Tiuy{0K8 zLL7aIDgbLs1t$H_+qYOSpn;Ei@oE0JxA6O_d1`Bj`Nkkpb*w&C8GMVSMerFYq&qzD zkda-;-_ZU<)&swL`E)BfVOquMaik34_AO%nUEII7i1EX&oB?B^Tm<5o3YNf2?}#!` zic9RdkqXYckunhqP%bfCs%gM1nFPWAB7$U@R+v1KP0%hvF-CFQ<^?4bZ>M3J{`mjw z@j;$g_RD%Oy46i#8m9fMNFl#@(mGl1Q_z?Hag%jjgbBD)QpHqj9k5^I?NFpuyWJf# z&Q~e0exnshG*0Q)s!=)tCuJC-*m}VXKrQ1ytOgCVa9N3<&G~K-e7`tRYzu#QI2rnZfq(YVwLV-OnmHn&v|w6lF=548AKPL z4F;oN^geCGSp29FCdS3b_f%Q*Luw(?RGVnWY^f{M_NGUEcZ-2S;!6&DxMwjCxl=(I zLf`6-?oeGzD+EnsG#o9yfN5aV#H+GAA=BxdAA#MjQ3dXsW)0n{*Bi1cSPDArM-+!H zwNk141rAB8g@}V!LU1=tF}vFUcKq@1UmDRo=V5jzTa5ghGABE<%20e{Xc-}r{r~@J zaq=<-qD~wC*&pgx{FgJ-=XFEQG%s24i|^e>*~J9hlZ$>qyX}Sf*ebUdM)v#sLwcB-?Pf?!P}cMsw-<)1k|l<)W4;PN1c6zhmPw=P(n!5mRWpK0r-23!)@j+XVT*hwWX{7dEV9O;_-PwuyIN`C`1qmQOAljS@5Xq3jtsg($N>)&TwE+%725o?&mty8Dy0@*O#SD^GhVoCS$&*=yw(E6X*2p<|%D~r#aGL6}x z8cNzTIQn3A#Tzr`G{hJGn!36(-$6I|CzHH1Crzk$&Pa7GiY{T|nXUj#)67teC#!`t|kk+~ehWY>wCY zzknB)N>5i~ICzQA$+N(@F=CU<$8cEW>X7br6VTS_Nj@;@g#EQjyat*jfJ8hGN6YJva{2nnLfMghi zFha58-!GTLR&3Km^E*iqyfS=+Mn5ljmECyAwLR6x;8i|(e;&T_!v}C~mG?M3WB95+ z4`0bx=Y+5FIgtpRdHAZ!dClLVbEhWAP=7cF$b+oq%F$Y&P?yN-M&&M~kcY zF=5OIfmc^?)c~vn2!U4|!Bw%^2I4Qe9G3nKkO!>e3^pr1fE}6+v#O`9L`GZ}c;Tvr zsaw$!hUn4={jZmFO1Bbf6)Ddl$}mQeyg|GR6A+?^fR%?CFQir#QcL;9D~u+USd<@# zB#L=`0ycANG1nivF)!u{=&(ov12RVu;)H=PMxNMi6vZhB`6@rshFpG)+Qs-^mfK_g z)NuJFEW5qwUmL{nV)_rc0kaO$U5{C$ zm3X+oVlj;*6*qXd&Jw?L7YH|4$fg#7&@m8T%4hIibl_(z4IA5&aik!h8}*F z49#aSpk^7Gb>xFQ!dYa&k37KlI7lYPjfwMp7e zL#Rx{e-Q=OL<(!tndOoS+PGYCH007YiQcr#nRvQNNk;ez#?<#WFTyVKgNBk$Ki39h;pD zUPLwj_@pIR*E8d!Pp)zXZ?Ba$7!0QD)Uvs|kR27GF_fs|k6p+%q%tIfSAjG|@lY-J zC|fnob>#9YD9S|!Z)}&#YKj+j@&U6QR%hk#pLTHV7VFQ~;QqHVXS8ina0P>2Wnb<6if~a;gPT6k6nJ>uQ;EwY;GM>S%G7Q?p1ejYd4H7PEJ^5U^ z4GZNb987f#JTGbEP7_nAe+^Os)?gEEXqOSHZ{2;vWr&4^vc+!xnQ}Y>C3Ffxc2>3W z($W**ovT_+6X!`~?ff#fP|d~o=UR!tnnIV+4=z2(ke|_JQ+uji*fu4HzV!6yk?H27 zSuH2)P~lLqGCz}+o3(rbvG_sdK0_ghS%640bj0`$oHWQ8M!;Jq85<$>#VyWw%HVu5*xvX$d{RAE+A= zXmZSi)w=CEFgy~{`Dl<{&(ndX#XO@9Jb$a9LK&rIZ{zR25On{k0efdF_)O&&Ya(n~ zfMO`)-1K~Q6_B3ayGVLI(?y>9tVqw8Sx@8COhshY!?xVufZTH~G|b4fN*N-UvxA7` zLiY}d7J~)_XH)4Dv)oFd+W<@|BlA9DvSp6R z!X++a8>6AR@d6TNv(L?=C`EXLRks`-%^}<@l|S4fse_89O zKuw%$z*#$pxt_o;;#{bJ^Wt2E(YK~*zj6$Oydbo^8b?adI78Kj($1ly_yjTa;!DT6 z#66b+rfhXb{2fO)$MJz29w=O)R({FPC#3s7u_fGb#KatQx)xsk(C{cW;Iydb%uKG* z{VYY0T2c}05KLvF8YTq%WLG}o5)k-4G3)Y(TkPSF6qA2U{5^y;-y~vpkm8g_$S5BF za(*1}gkqs{MG3^*EM5p8#jhDC~0-Nqfoy8@?40{q*QBxeCIr&DeCs zN$Jk87ufi!@MGg^P!y?kR;5|C21AXBiCt@8o2(4DjT zeQx}1O3vUr>rvsC@m)JCFLTZIk2#ZhmuYUi!)8&%KsKNY=i=kwb7BcE5y#DUVE zH@x5b$a#4GdZ<0i3G)%!;4h2{ZJJ*AY$>y2)s9$Ry^YY>bnzpywegG)=+C-gwI@=nt18;DIYuE@&cYMQj!F zygK)%kYIqlU7?B}^e%>i(SGp|PC!3GMuC)^5IG$(8JHRf?Nr7o{aBcuc)?FU-`g$G z$oaldw{;zLd1fw3>Fo?{UZVAwu-D*+I0ItErpz$KuheD`6f_Q zNxKQuG3HI6Q5Ks(c~)SLv5xE}P|Dj)pj;g;8qcmM8!EbGQVC~53x*o7rh7iTB^KRP z$g`zQpj>xHRK#M8x!a4%@wrjK6t!q99T+q8A>|Om>=?yR&6XgT?4g&a*-qWw^q!9d z5_Vqn`12>_(Rmn75;?jsouG*C_kJnZ#utUOE88I1j zfs1f=+F)zMXY}5V;MyzlJcx02iR>KtFwXm61X4m@E(c1 z{b>pFn>5DTxD6o!)j%XMXj*scN{q?@(ODaVW-{8$7pGv?4u*F`Fup1P6`h{?kdX(9 z;wuX6C(tJkluW2m7%?9RB--IdRcR#F?nLnTm099JrbUR*FVd4EEAl?6jV&a^xpKw< z(pAT|NDqX)KHg%djkuFdj)|vKq0aSwY<6x|Xn$Uw@XwC+Q&jCfJk5h8Pb(733l%tSFcIui=nmMURAPB12rnIIXA z0J6fmQUb0lB*lChUYzpBkdRQ$;()^t*ola-Ql!gIU?~*o7LV{7 zrNODDcan0xEZNnpsEM>1aB!aWZ#QkLN7c0`81Rh$k_cN6&K#m`z0NixVdmFmYUR67=EXYdBQMGd3+Fh(uN%^|}S!*tMxISGp|@ zk?cowa zPgEE+lQxX)r|(b{CXpS=;7KM7W$cF@Y4S@E5{Nkaw!L%#&BZ05}mIhPq)^#q@A&|O+^M=ZWNI?)?E_x10y!?(x~`_G z9@=?yhMd4Cho*9S$!mI`dRkNG1@lg=w@Q;|kgU%n{12NP@jQ42q zmHfch)I8o?Q(w!E`%$?(!UJ^JA%2ji-<*HGHvhbYpC{Hposjld_?h1 zrwpsZ;yAEa-xaM|4zjcgZ2Xl4VVT~s7b5*nEz|k2; zMPX!dLqMMkqmH73Pv1NjbjIaVB=7e>=iaL7PKQpE?|ZNFozz{<`al2u{Li@}gcAR7 z89xA>xp+~Y&hRGe7jXTU2(PiQ1ZT`ZJYkat*bN#>5uk$J{WV=<)to*8F?_*L0|aX6 z&0htm6=P-}<}p)d7zz*q;Pao$feB1;n0)-Z*lf{UzQ)vC4Wp(RaY%Hu1gsHLxdavf z|8!TdgJR+{E->3nBcrYYU;Cc?ATa-{`aiLMC+!BZ5T&vY?^yB|N}@waix=FmS-E zskYO+cahe~=92)3gvv0>_(HizR6a!lZSlQ9q?rJQ^qRSA2ooUAh13#E&X{Qy`@V^3 zCbR-aLSGo7F>SJQHVHBk)|db)13c*a*=uADk5jo5c~}&B_~72~!H=U-l5g06{>`zd z9Z&-@L@+Y8A)byf;*$%l{Si{Oqn*%0=pS{BofZ)K37O71gE_4NVUe-&gu#d z>H@0LGTc)9(%B#^v>KKOoqdku+5rh#qQjwz!NWvD(CfpMS#~JplOqU=gJKqVa=(`Ie0Cs?rvrG07tG@T~hfMBKhZwOl zN}~?F@ZO+9xNh`>0M*()s0V|j_E~L=kMI^S7_7zi-8sq{o*u`Jk^gv{+fF=?2gF08 z#YoNp7vN$0q*nxir_?A9Jbe)zVSDCya89Zh@W5D>VESl5vh!L5kC2FBck;D;F?NTy zo%cW*0eWKRzTo$YR5t+=PzBQ?1BJo_P#1ogGvGj9M~Mej;1LFpdP;-*!$q0@Om+(y!%x{2WbV*PS z*c%|w7op`YX?+BVss_9}Q-P_=5HQI!XVwJ@v5vr@Lz4=g)`4+ji|17Kp+}U3JG`@l z>w3_ySq=zWsD$7$u_XdyBv5>>!RNSv`fTm4@$Hpp--A$0&`Sz72tUGtkd!{Q#$O}b zV18E|aUZa_5Rw5~3R4iNVOLUum1O&iSV8`^CORU7hQu0WE9BVzL>~edNc(3R8?ytr z?gk7M>7z8X4XTIP^yuai^0KA+pgS@Z3vcJK?xJD-HMgLftRvtEA#*1J>!Y$l3cQAe zvOyvtnv+!*#-jvbE1mBWNqZxe7tnhiaLHntPoI2Fq0|>nBsv-BhiM1gNhxNkIU_f^ zBnYM!GjA>b8VoI3LjPDN8R-uz80Y$vnK7$SwyROl`i6vj#{2b{Ps60}c2R7|xB z+J|v~ssWbdH7Pd5ooxYg0xrO$X?WY{CE;4%%}+co^i4%mEgZ7(^2P7rC550)^zt@h zj)YUKFK6*;!>0r>p>uKSJYs5?HTbpV$VD_?mnM$ErRx$JYu`6O5shL!Un&_hc*z^Fk&tw@$9b!F0Rf`#!P!^V*ELlSHx3vM8 zA>HT`GkgySvwbj$&~K&n(t1>Jln(!cxiX3lt`bHic&RQR|I2aIv`RQGhWD?s`&S$H ze@0k0)V_veiU(!lnyZh)^VCi?#T%;VVMMvRq(OHqIndq}qMGJV2g84|h))R8$ChxxzBUBd;u8_{nrU_Po>8n!A4;Sa39|#&9I4<-SSK)U z88d+|K=ZAikk$A)6ef<4j^>Lfv7hS2Ou>Cevx4&%F-h=h;d^1M)~+`0%)0;_0wHDx z_()Kg^0(nZm(-d8v==A(!lz4^m+^!Qk;yV3=D)Ru1jTgI(Y)+iB>2TA=FnjPhC=`! z(qzs_>UGc&ayv56Ay)&`=&_u@$G`AJ0s06z&VeRH@cTG5oLu;HO<(B=uYoy;RqOlG zv!rcOTpFT-wqd65NB|4rF>7RAUdA4h0=<)6k;iH)QxyQMS5TbobdB}lYe0?4$2ZCX z$XKt~_ks|%&s)EJ($)tWt@D1+sd2m?v<9)2JNp1}ObCP*X(EABpSTa81uiaZCDtD} zsDa|-payaD6)uEAfG;Z64%cgu|a zHn_&(0?p`?Uz==32OBWu(B(czntHN!ICRMyxs`+)(RSZTVA&m{)KO?7uF2w`&iEJm z56)wpM%?-YhAll=LTnT|{zZhXJGj^bd%KTq=M*}prc#~FTByvN)H_6`lYsZpBthUT ziGbrFbb{NizrbKS7-;jtqTqK9Y6mBPL?@Cb@yU%##!Z<7=LR6U$+Q)+0AcBo1-J@7 zcR`{M)u1O3L;Tb~GWZZ8g@zGx(Ar5F>YUX3B!j4^q_iF!4D#afH$M*C zV{l-)Au7YCHDMH!BxYVKG$_OB#j%wb0bI5C56hKjQ-v~6mTWZkp*x@lx)W}_rXtMA z%nT`JBl7iVR0cW0JA`kT5;WMCN7!=~^G>06?A&OH&S(_@8U_&dxK%3BQKlqo|9qTe zdLS;D3yJ7vY)45oBJT(ZaTcH<+oDXk{C(37`^LB5m|Ttd6<~PvD&>gX7Z31=4pfyI#WNIxSk0g2+0= zq6QmVAIa?#YHDODV727++xjRmGYkD;1|LZyF5;!mwW-#-9jTv6%r`BqC#ZErs?fPO z69c3{mGnGN!!Se8oV)0dSCX6{0A`HfJ%k}_C`NP=umZ#4Vk8IX3gU-+0bb*joCFce8^6& z#B<HBSPSK?jE_ici2;Ly{s#9ww^D^rEo`T`>)wj2(Xb2r`L{BKeV2mzSClaPzn8UP=Bt-!k@keIBL_lft-t>MJn-k)sGF-t{10{9|K-HZb;M5k$&_s$GP7zqsRZ zLcR9__4|HB*Ca_GE&dzVohrZzdC<|RV->jXrgsFd7hltNGp^}1WMLOr3gy|-cNb-# zsK>k6+fHiPiPj$eE#(ebM zi)$Ri!E_Tu>jB+KO=up%0l9&F4+En8bB|$yE+DQtTD~|0#<}4KKYHxfAA0A1{rm5U#cufC{cn2sEwA4H z`yaBqhko?Om;TT1ZvWVuZ%9QkZ>fmDQ|dQ%3~UCA1F6T?ih>|SgCyZM5~M>`wb)&$ z3Uh=`A%SObJ%Eo3LcMgLR6bOao$~OoRdVxkyC5jYL+`QbDo}lnH8kY8^1v>yS|6(A z^Yzl9iZ!xq`G8z5$yP}o*j%X$$Oo;VI?hKz{v;Chp#v#wZ$7R!wcMYH>sd$@Z^W}| zJRfcwZHDE}#%_H63k)&4S`Q@g%Zq`ub5a>cV;*)3K) zr&g{U$;)^tb_(OOU#dTA!bVd%_LEk=Ezu;Qm~sW#gWsT44p! z%5l$E;eItzH8_$_pX(z-jLrt-GjT(756uhyI%H=9fAY0Fh?J)Ki+!*{Z_Z7Z6Sa~waH zRus?k(?&MkGgP!IR^>h;=f4b~YF;m1z#)P^F0e*9JY=uKPYi1Q!5Do|{pI@On1V zddwgFjjz90?g@)w{sDZdtx_E<4s*CZjyec;MF5}h8@N`i9g$1rn(UYBC3nQD3>T|a z!e`ej6+O2}@!*hty*lnm)vFDbtF=~KEqS#=<;sE9M=h0DcDVxBQ-i@%&$V2);#I3M zxG5S4?I4G(`9)vg@@`@$MMKF+J zX#}EU#Hv`s9wsn+Oqf7a=gN>Q98=!lRm!DuqhAcitDbj&gl)Y{SC4pyJ*Qr4RKcFPfDOUasg$eL)vkB2h|Fwo z7=OhpQJ+y66oez}aW(8dwL@>wN_`k}hqu5T)^NGBzd3J=BUb7oKokt2J~F~^re5+6 zk3jlh^j--N@Y&Rmh{ffwHw>{|2HjLRORAR~FoON%O7RU;fLQB}DzVWqJS__vIDjeB zi6(+XJYg94h-nr~T!-|W!}W#83r<-Md1WYbVP6aKvT~I-Brgx?b6Z;{({V1vFV!Dn zDyX1RKIFN?3+a#E^&(9`&!lFQiF$8G9VGLvhoW{Se#86!#Qltx`=`KD=sw^nBfy>- zcrhtCc^S{Yk9w&5ukcGcUs%tdP_7O4TyL46CtP$0^V&O^Jl+`NI+^7jv`P-OPy`+h z0U4^Y?Hws&jxZg?ii}C$UmFxQp&ZHCu>59}Cw|*3-(TKM#lzCz*kRe5Q1&e39p5Vu zW)JDAJsd>BBgjWO0r5zxdput~G*||$aTfU^@{%q=dBZ-figVpzEuMw*PWsb%Nb8aO za%C9$UWjCZ0>?1vbfi19mg&R&2BeMSo^QhaW~43So}Z8Vtw{Yyoc4zyqW}oGUh`L* z!kuV`=8W1I4})^G$9H?c7(J5g0rJ}=_|2I$v=~cf)I%9%*sz*vrPr2lH$o&fP z5^VksiR6BG|2(bPat*xh7O%TE+6zN{!sZ4vGWRX=!%7>!}XeXczoYjixrQ( zV_g(V9i5Cm??9cT$1=`DEQ6#)4Qd2v874#vE7-nwn`|Gcd4g~^%96fD{Uf}72KQjJ z=$MWF&<)4SlMekNo|C--k>KU!-DOnndZ>E{GNIzhW$nTH&Se$_yCYZqQdS<<~? zQ@K4e<~5#&@0a2|(b)KLvdS@?oA93SZ7-M`@s;uU7-oX`?nmAsUX*<#mq@75ueDz}7??T#*v+*bI#`5sW}@z( zRVgwt3O4K(t0P0!5ui^4Z7^xQsGr6V!eR%Im~4gcekbmUx3$V7!ZXSf%Aw20-Cu$G zE0Ojgk;VuWSGWr4YNS>e6>#6)1c6T+j@{<-*3cpANVUKew`I#$$?Sq=jqog#a~++X z0`Y+Wo{gFg4U%p%QYk|yKn>W>EA1Xr$xf6d9ut&xpq*nHfXl04RFFC~aWUZ*lv|B* z6WSw9#$PNIYeljNSf^G65*p>6MENX!LtA8TQ`OiA<_o^S1wFx+;6`ZxX?wZ0g>>be z4PAK?QXa=8CNUbmJRKBZcr3T3!a{+XbBSl?HJ`zGo5pgu6Ek&3q($~nniAAp0jtU8tA z2<8w9UZq^$KPZFFok5v205Z5BL|Jyo;u)Rr!h&Y-OZ>;NN+nog@Uqn_)#5=9_Lb#a zTL(&V4PgZNWaJw!D;lut?(S(Z33>>rt36Ex;x3dYU7mCRnu7^>L*)=tSLi<)5{5yh z6xd9=@FL2GKAMoHk{)u>{*?J#E}O~cawGCm`_)>7agRcUiPd@q`pIR;LwZ-3mvlsu zpGjys)1YBW!g}zdDc~~^glWx(JnY9f;zCAHgdI@Jpin`bp^HJQN|SQ1SguzAK^t0@ zJW?)JA^u(XGtkZo)Qh{-%tgaF;85`mT;dNy^3Wt;nqVoDMhhsk%*gjqo@5No7vUH6 znXW034odgbZ-NWy2_%nG!8P5JtfY68mwanf7vVSQ*_4;&g=7cSN6+XT<)=Dn-U#mV zk?0xaA)Scor8elA^3gTbFT{aYNK25?NE?xMBl$>&k=}&#PNe&hK8f@g(l?R*H_{)F z;tAL?NarCPLb@I4KBP||J&N=+(zlU*ffP@63Nw(FAZ3x(B3*{$BOOG#1?e872a&#j z^c>Q6k!U1CwjNN0dAcA(CM_+5dN zMam;}_rT@4yY7%GA@pO7VL#lEr250x3TGb(L)cU%S0fkk0{7T4RL8Obyc)1YNCP7Q z4z32Tz0eflfxAoC(QqCSiQtA?11KX`>tJz=0fJ*RTtoG!5thV zy%?_{AC6o*GD7{3xl0nR8Q4waawAuY08!I)Y0xm5?iis(Ji(>Jyi(+$Z03TW3hojp zn_vv}Qp16Ug50x29wC7V$X3q{%D4Kvf~tjvTEL*l9AiRLO99h>T7xM7oV-d4=o&7n zv6-3sP#`r3D;ur;L4kCdrUy{qdJOaM3H?1gg82-mAaFR5`NfMhrXYYHpWo&T^^bA( z346T5@OIKHk%LPhHG(Dvc74!L2&&LcC4_2%JjP!o>^?GVm*KF$$q@u5(W+!aGlGM1@RKkH$?S@J<%M=2F;T~(6(5=}vb+AfB znY?Uip@CeXPfzAP)3O5rEkMZwbrB&zJdj<_$Y*CDd1P`q5G6q9G|2`M-tn-eCTxKR zj(K6Jd~tYW$Rj%lFVKy^y+&9LWdhP4t|Fp{emI?LMZbt@;TAxPu0U!V6L?I@RXy|q zPj^%iEzjVE`;|j zi$r6IEuhR2w=!DaF$0dz19yZ4T&Ovq-3)ltmcwltgY=0GBGEreqpb}$wkjNhS!n$Wq1{EsZ=Zmc`; zORkd+xCcm_hYMDxuR3Qu^P0;8tt@^zYZOy@Z8{?4i8;%1kYSJ)*);5Y0wn45&KBgDZ z4yl}1qC*;fx7UX@lcC=_PuJji>-_=Thy6JPxGoRJ=#(oSTi5i5Yr$e=cQ@*~ZV7k2 zZ(z#+7u9R52VKIu@SNZj{$_Abe|h+D!s|zZJmGJ{*Ah6cUI^a*8-61wdyv(@;eQC% zu<5+Rw0=a~*Ct0sH4i%uD>#r(AbChdtjXY>XT%e@dr=pDgauvPgju_G$y&%uXV9yj zXnhVWWBQC-DefPvEgxu?QL|sm%L42x}i&SFX5NSoYAR`GkR9nbwfAxoS_)1p&4l-V`L58FbvbknTn~Jnwd5;X4ceA z!!*rY4qeQl`5dawp;!)&#=_xxjO}lbZb0&_A;^*nf^{$_z=Qetoe#T%Op)+@2JXrA zaRTVra!?Pv&dwmQl*^WKJh}sU=OKmnAHy~AE-V#5ONNzO0b^l!8X_uxL$*4rl5m$V zE6I1EPBM2Mz;9Qh4q74PHGCh>iHgGaygYx$T7t$^<5-VE>_&J6WoUe7oXuU_h(rB< z`X}`L=Bp5MY3VipBIEv|^e6N^@(hap=d2UwrdEOfq*^_~`J!?T4}&1SM{~IkgfxI> zL{s6rD{)OGy>MlBclTAy_6nv6Y=S8)P)@B1XDf(3StFB#U?RKdda}HXid5z0G<^f8 z<{0WHlk`^nQoWzRFPW{M#c!P62fV=c_Ctk0R1Hn*GP+m}mlOCEO(yw=2L$2gC`0D% zAMs1{{3?EF-orYmA7i*)(21}Q%DH^b!~7G%D_8;@KwhGQ1Q^vq{GN~(@h2=~hb_L6 z*34mi3(B31{Dk{DQg~11KFM$)j!o}kREi}MQZm^lwZ~G@)M%$TT{ zcglj;!sKFcsd!EFfb?+WG=pR4x=8wk{ZTi}Em;BfBUysh1qZ^l8dcy+`J^Z=s zi)Z}pTi*VG=#;6`&seTz@|(BxU$A|L>+SpJPt9MDNVcbD%+_=H`#m@>f^b|NYAG-Fx2i-tL}rm+gK3-S_iAPnN9D85K4)3l%x}G5+s@s4FS+cBeOC`So`0Zv z`1%{(dhY`dKl1qV4?SEefBv0UcU>2YL{~@rh}hFTdTe1towgvlv~5vrWo%P)>Wa|^ z;!C4Tqsx++)b@=>jka0s$vJB_=ORwBO_>#25}6+p*PGD`V?ELKL|bCLd~UR(O^@Vb z^AgdH#Lj*rJtdv!PPQLCXV--*lPhM;J7>X+*=^g=z@{m46YcS>$#dK4sSWE^#Mi{y z;}^%pSZ5?Q`Zjyf)@1wWhp+D1oNA9xIWr$`*H=YnkAAw>-QBUZt$oYp`CF5_r}QV< zM}N1aePQJMej_q9*&fd&+K=jU6Kf(1E)l0`Q*L~(Ur&ub`POaDl$(^!S+_lK?EHH^ zeJqz)5#1L*r+rKNve=o&9=X!HFq%tDUr#9U?mr}N`u2*p5B>CLdYZT}J~f&=ddpj) z2VzqqZHdlz44mIq>mB`Fdo?*SbITiMbj;|uv~BL_-yS_b@}>>bX5O@OaXdcyt(CEL zOT>}Yk$F++==#Oe^D*)0^DB=1uhHKx-xh6;N;gj5v~BI^7kcAjbZ=~aMmjomRn+ac zqD8()Y{k4%XiiWcG>QE^&F)WqPHCA+pC-P5rUebJLsk+m%` z`qi`BZ;In2l~^numlE-0qHTKng4EoOc~d&4c1(+QM$S0n%(hwLY-sOuBl8mT#Rbyh zS#o4$WOb@rR3fURiT6n#ksgSCH2FvAPq9BsuSSlyeeCd&x83?7<8h{CyF`71wo=_kj9C_`u?zh-U!1y|klcD(%L zXFmJ%SDtX#5WZjSdN>pL(1`o=fC?cNW6{;{XN_}q8DxAm^ieeLOIpX=Yg zBoF1+RKw|)GdKlRwZKK;e-OrJIT%6-54{j0}Ehp+v?52r3Jl@}~5T>m!@J$%Dw zADuOO(c&%VZ{I=q|2H@M(^KF4*7slj^=~WH+iLZ9ozvZO-@~7J?2FHR=ZEiE|L(h# z+ZKQ0o6jEKzT=836Ih!(x969?DwU13=WW=0`yIRY*T3}T=fD2Kzy0*pG~m#l@*JW7`w+6PG5W`0S3I(T$PSU{BNI(>n6eg=ZJ!;pjDIkA5k3?2*X4__04n zE>FyAo6|-JcTK!KJ}-WGVr6Vg`>H5#Bci5OMd!s+kaH!>~Kn=q3r zW5PR@=7d=v(6-y|-g_ zRJ|v9^t-x!sJJ7NRERcGEUoH1Ko z+#wGv{?)3xSFTXxRpk%AxJtTzVD+Lu4Ri~y%K8V659oguf251;ON^yceq?-fs+H@R zb5BlLU~T=cMfYr5pRsnne9b)VHhAV^-M3k?FIwj$sxHYBB>=ZrVmxK+KXNimEUzy6cwTW}0 zVjDzZY-OZ3xnhne8z>M>0*?~y(n2v$#iL1NX_w}Sl9YqYj7q>;agh|k-ZJvp{s)!b2DRF6==tspkIwj4OqLEH~ds&j=;xrMkk1UiH z;oo{mOe94q)h2?P#Jbca9>nLJ+r)U}djJA@o1hw{WV~GxmBngQ!F^0z*4BY7KFAO; z@e&0i`J^P>6%nVv`G5u^($nh&@d@k&x>X#Ig?LdCqGG!&A#8wj3URI!6W=Y(J7bD? zPI7LlJECB0l60=P5s;U#qcDjRY161xl42P53Mnc6lE5ay80*AJIcoW__;)cOf>B17 zMWW(ApngHx8QGFjqt}W0wB;CQdqhQ@32|*?X-rJ6!}gC%8-$5ih!7|N6!HCHBsr5o zRupH6QxlQc6Grl|3Tm4_?<89P12KV2p)LrMKGx`p-q&2i9Euro@0x|Kpq4kp(Ewl$Y@?<`0kfNl#pp_mPZPjm1o6D+#dt1s zOS2Ih8;Qn}Nhz@?dMCb^9MzKIRB={JoQ7Jbvl?TrcsI(djRFFR;e;?S`m(UiIs)yI z(JGGM`wytxDY9Z|VfbTnI)%48QSu9mZ+2b~g{>5_md}H86vBvQH=n16g=)zfsScKF z1-8ED9a0g1QQ2QbKJ26zRC1QC`$}53?40T5GUE2ruZh-x!}?U)H$2T#vsOmY4cn8> zKdt(Fw?J{S=$H+A(pPQQhS>_sQjJ{jmsA9oJ?gSxtvYEY_{#&P2po>o=lKrUEVx*DNr zH2sW`_K+M;RdcGFSY0T2d(SE5 z^^%jencprbpsp{Z5|E}mFTNgsiJ=wO|f!mOZEJmr)RS1*#<&&^Lg$7gcY36(+-gW zyDw1WVqp-mBPa;Zl9pC-if^kq#mf3~)LyuF$9L7U>-!rWP3u`RXBxHzZzVH*=QZ~5&B^##uqSyN<^#he*x`bHcC*c6 z+rTzxni_8zWYO6MXwjr*`EU{XrUgEpbu@PgudD?vpru;yp$F)2-E~Cd2uZpAdIFUN z;M%(7!N&*>Wv1)YrjalSu13?=;jVNY?X2AaWiULq>sX=0zLR`@r{(s!78Y^Fqubb# z03Fd6-%vC=t7ia0CzDRAOV48i$66_ujsP{Th$92ZvC#l?Gytp!VfV)$QoKPjc6GzgDm_~pV-9y*<@2~=l!;z#sQawxO7Eo@v_Dj@4i@m5x|_ou zJuoKA*DPJh<`mAx19*kB%5DqX)(hCUhDCaK@iVq-WL!OMs*n^UjK-1NCgNZ~rn&=s z#aj9hF;dO6K^uma$>t2h&ZM<9z2_ioPQJ8B1FRa>=f*4r@JeggPv~WGn&IVa-SyM0 z0LID)C}wzs^`lVNGic4X9IP$qX3o&lnq#Y(^ILk#3IwdT*?-n+hB)=KMi3+MIq0dG zjH;N1qT~QDtYPd52$~^9Ap2MxJ+T@%UHcJIKW<3lWw4vgTG^~>L+ABuJ7egX@f7SL z+QIb#;M4XXnl)ebfh@k`Ww6T)@%K(zGkSvL*}W6_vP7f4#@DbS#F2rtvL*SWlEh?ihr1_(IZ z#*xp5fC2S za~i6kb-`Xf3R0LTwhxhf%}$=Wwqt0v4b2;?+A8!*Eq&pIO>#u%o0{q_>k!pHc0dg| z0%3;nqj!q#Z)-5#iRdrnONx_owVbCZ4$4B7T+|&%${;+3_-v^N>AD{~ zD$$AxRm;n%S=~xIep=VJ_qXbR0l#hdRhvLz427}phV-#L*RY`LWmL&vX(!AuN2Kt_YN_VJX-69T=Gz7~uRU_xx&{tgBQ*)Qb!DHa2zbt<$suq_~ z4x&C_&S^kk%T|os<*y&cWgQ1GDv0^eY}W@NUU5MS#!ak~ZNnDj%2q@RQQSqbMJ@B) zjO)N8_IyyLW2Ud{pR}&MBM7E$)MYkk45gKvDJr2M6;7SuT9&Uv zfv{Bvwm6LPLL99^qZ;Vu5C-A4M8gG^5RlLJU0p?7Pe%8$CfrxnnwA+Er=IR^*aiV3 zQ8h1}gBGIsIS27dhOP6$Eh3OzLXJ_m7#vc8O=Kfd38;jqBxo?IzL*F@MpG#JAHbI<9f>#L^W2Li6e=g^dM5FRHNau|$aDTwBRG6ikLb2FL!7X+fG zJOVMyLYN?pDaNU{-#t8DXB{hhpsA)|p`?As&Z?H<55~!tPdIE&U4KJr%^WTDn5LMx?{SSDjV*#Q{iU3-L$7-K|oaycLx83VGN%}SqP6T z1c#Gx(_YT?)Y55`^&IF-8VL`_&6=Lq3DhSPHrpk%{ki0X_Pg=5L}><1%iSM zu&xdK3Je-8LY<2a4x=1kg!6iQC@pCp{)f}YR zI0G^@9N?6tx?Zj}sa2w69NX6*7JW-sUDK`y42bo50(CX5Y6fg#IPaiF!$LhcNqz?b zktW8F)jfDLO#RR#`QiJ3GLg}9Ab2h7=MGPj-!svFtdr@aCE1>G1V`DBvt)$4Y;L7I z0#;JME^NnZYP2T~D>N_z#ihlWwT^sQgN~QAR0k6Q>FTPg^@d4$1!f6bNjEjD0@$9f zT(`B^`YH060>>L0XsW|RfWH)eeMfual_wn^e-TQKT}*=XVk>t;+XyA4g2xSi&#KL@&3`lC zy&kOV93iRdWsi!1hW=UzGzO5=eFN)zFm-aO10~1SkBLdFU$GP8ZWPyZn38jqtjXFS zT!u}Rfz9$*kzj+0b<$QdIXKpI^(OK1#uWZl-dOb1f-f{}IhyaNX$n|=lNhbql>=`U zC!Zrl^=P$LN9?kLfM)$~MPtPQ!Pc_WZYsq%1jy+_#-hEx;?yFyWT-pwK~3-6CG~`aqRdz5rRQhhsq;){Bqz zJNTz>6<mxa4woyYD7ReTubKd;(-uX>5vTO zH<{2U0?l$Kd0|h>Eu!YKst3okjmQR2ihhTw6Y@iIPzf0=id z!Uzh3+)=Dy_0q633u_TsECK8PWAffW!G^;RI}%hAT8ol-kH|f96_`vz(1*EoaKdU{ zMzei2?K(O%F}MNVE1qQampe(o6xfo-U{-Yv*xy(=wje&Tx%Y{2-oX3C(^-dTHFyoz zf%y!Ff#I4NtbBh!oZRAN%$u)h5cnDvuV-Q*PsL6VXeC&r%zRM1I>3dKs3t9{;Dl7y zN^+!>koUvDq@XgxEp%K_(w1zTLeG0GSVV`KEDNP_+c{u7GpZ#X80wAh*tP%O`h(#mIN@nhKh9< zELhr>kEQ(Fy<(=!|dlWd|U_!d`?hjRLxZ22ljH=f0&$n(z@bd1ul!Y0l3@K z#)nTLVOt`_ED&baaj~%o>JXN!?h~irV8Q*^nMY!&?A$NLSg6lO#I1pXgk8H3S7Udi zjUURGb&G7yb{t#7DmWH_z}OxT*9BFvaWgo*W(7LV9`xbY_hIL1j+*(XxIL&Km~Whs zgqXT~z9qKqH7hiLQW~~Q0ZwW*?HCV=+60R)Pao0*my$+j){qexv9XzjHp4~{)D(WoU5^P+=SPJeFb!|M2=c8a4g_?pF9;fxmg^+ z3lF!CXcZd_?VrSs0CyM$|MTSI)!}%eN=UK*)Y_*eFM{ByoDUxbOnS?5E$3gvji)x^ zG1Ti}mB@7z1k1q0!&2p^#SNj3NA^gttT_qLushLmv3n6592*XO`!k{+R`Pl&ihzOk+~-fHuxG+;ZJF@vWU!EzHXdU_8=--Zi>I?H>-(ygaeM_{0mm_N>3vw@Pu3tD<~$M6?(>XVRdATuTBm@$3)zq zk99Y!8fF0dXT%_)vsElnBpiMLANFsucRFtoQdrhc9j%Ph%xEC0Kp?Pr8 z80m~-Wb|iW2UiG-(LxV1SjPir^gIK;1xS_W#8?3b>D8VWJGpU<$dDky`0JwD+Y;P? zQ|92t!jY9&2*S}Jg(58rYOaE5QcNhh7W}BjH%_4pT;3WC4&Ad5=C67F|2%~<23&!b z2cfCK?X4KvH$%xeb{?7?!z?41Np-;-Jyo~OZ;6P`MvrMx|1WhX;gmXVYq!MrAs)lZ zsPJ%mp6z5k_uJydC)M;>2gX{3@KgexEpeW>8_bb^9ec3Sh*(lI-~7(RgT+K0#KvP3 zuzkeNS+Lr%LIj_$D~z<^rCWCpr79)K2Cd_~XEC}95!6CQKun&y+CCD2qKwyZHQTLp z>oL*{owL<$L+e&nm*|KCoaVBuaVWoxjsEG?ioRM=m&Xs`RFrx(u5_!pZbisV!x9+8 wSpi+aAsJpZvT_i1_5PtUmR71OQ+9pmz-q)l;xOx#$to1~)d)NNzepA`qW}N^ literal 0 HcmV?d00001 diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/exit_on_start.wasm b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/exit_on_start.wasm new file mode 100644 index 0000000000000000000000000000000000000000..6bbf007f975d3619e3796e9fb3ad04dc078c5367 GIT binary patch literal 137 zcmX}kOA5j;6a~rw>ghXc(s0kD;cA54Ip zd0I6)lfB0L48_D`7iZUN7gKl``*sDWgxvLPOfH%V*tcwOmjedeYOk}!xZk7+{zrHu Q#_hfQ7a0UZofdr&Ujw%x>;M1& literal 0 HcmV?d00001 diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/exit_on_start.wat b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/exit_on_start.wat new file mode 100644 index 000000000..16ca92651 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/exit_on_start.wat @@ -0,0 +1,9 @@ +(module $exit_on_start + (import "wasi_snapshot_preview1" "proc_exit" + (func $wasi.proc_exit (param $rval i32))) + + (func (export "_start") + i32.const 2 ;; push $rval onto the stack + call $wasi.proc_exit ;; return a sys.ExitError to the caller + ) +) diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/exit_on_start_unstable.wasm b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/exit_on_start_unstable.wasm new file mode 100644 index 0000000000000000000000000000000000000000..3602aaf0ffdfb7e14ed4f9835265b766d333d7cb GIT binary patch literal 128 zcmX}kK@Ng26h+bZz61~gfiZh<<^o(v`I-($ppdqLGq(=J#PL13&@d4IbLsg-4@k#q z(=eE~3sIk=y)J%!8T%O`a1k;qn3^N`2o^b0JfuO1d*XDmsH;<&+5HGxqCR)G|3yjx Jk@!_dVh2n;9yR~~ literal 0 HcmV?d00001 diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/exit_on_start_unstable.wat b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/exit_on_start_unstable.wat new file mode 100644 index 000000000..9bdd76f24 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/exit_on_start_unstable.wat @@ -0,0 +1,10 @@ +(module $exit_on_start + ;; Old TinyGo (e.g. 0.19) uses wasi_unstable not wasi_snapshot_preview1 + (import "wasi_unstable" "proc_exit" + (func $wasi.proc_exit (param $rval i32))) + + (func (export "_start") + i32.const 2 ;; push $rval onto the stack + call $wasi.proc_exit ;; return a sys.ExitError to the caller + ) +) diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/gotip/wasi.go b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/gotip/wasi.go new file mode 100644 index 000000000..78fd70ce2 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/gotip/wasi.go @@ -0,0 +1,309 @@ +package main + +import ( + "bytes" + "errors" + "fmt" + "io" + "io/fs" + "net" + "net/http" + "os" + "strconv" + "strings" + "sync" + "syscall" + "time" +) + +func main() { + switch os.Args[1] { + case "ls": + var repeat bool + if len(os.Args) == 4 { + repeat = os.Args[3] == "repeat" + } + // Go doesn't open with O_DIRECTORY, so we don't end up with ENOTDIR, + // rather EBADF trying to read the directory later. + if err := mainLs(os.Args[2], repeat); errors.Is(err, syscall.EBADF) { + fmt.Println("ENOTDIR") + } else if err != nil { + panic(err) + } + case "stat": + if err := mainStat(); err != nil { + panic(err) + } + case "sock": + if err := mainSock(); err != nil { + panic(err) + } + case "nonblock": + if err := mainNonblock(os.Args[2], os.Args[3:]); err != nil { + panic(err) + } + } + + // Handle go-specific additions + switch os.Args[1] { + case "http": + if err := mainHTTP(); err != nil { + panic(err) + } + case "stdin": + if err := mainStdin(); err != nil { + panic(err) + } + case "stdout": + mainStdout() + case "largestdout": + mainLargeStdout() + } +} + +func mainLs(path string, repeat bool) error { + d, err := os.Open(path) + if err != nil { + return err + } + defer d.Close() + + if err = printFileNames(d); err != nil { + return err + } else if repeat { + // rewind + if _, err = d.Seek(0, io.SeekStart); err != nil { + return err + } + return printFileNames(d) + } + return nil +} + +func printFileNames(d *os.File) error { + if names, err := d.Readdirnames(-1); err != nil { + return err + } else { + for _, n := range names { + fmt.Println("./" + n) + } + } + return nil +} + +func mainStat() error { + var isatty = func(name string, fd uintptr) error { + f := os.NewFile(fd, "") + if st, err := f.Stat(); err != nil { + return err + } else { + ttyMode := fs.ModeDevice | fs.ModeCharDevice + isatty := st.Mode()&ttyMode == ttyMode + fmt.Println(name, "isatty:", isatty) + return nil + } + } + + for fd, name := range []string{"stdin", "stdout", "stderr", "/"} { + if err := isatty(name, uintptr(fd)); err != nil { + return err + } + } + return nil +} + +// mainSock is an explicit test of a blocking socket. +func mainSock() error { + // Get a listener from the pre-opened file descriptor. + // The listener is the first pre-open, with a file-descriptor of 3. + f := os.NewFile(3, "") + l, err := net.FileListener(f) + defer f.Close() + if err != nil { + return err + } + defer l.Close() + + // Accept a connection + conn, err := l.Accept() + if err != nil { + return err + } + defer conn.Close() + + // Do a blocking read of up to 32 bytes. + // Note: the test should write: "wazero", so that's all we should read. + var buf [32]byte + n, err := conn.Read(buf[:]) + if err != nil { + return err + } + fmt.Println(string(buf[:n])) + return nil +} + +// Adapted from nonblock.go +// https://github.com/golang/go/blob/0fcc70ecd56e3b5c214ddaee4065ea1139ae16b5/src/runtime/internal/wasitest/testdata/nonblock.go +func mainNonblock(mode string, files []string) error { + ready := make(chan struct{}) + + var wg sync.WaitGroup + for _, path := range files { + f, err := os.Open(path) + if err != nil { + return err + } + switch mode { + case "open": + case "create": + fd := f.Fd() + if err = syscall.SetNonblock(int(fd), true); err != nil { + return err + } + f = os.NewFile(fd, path) + default: + return fmt.Errorf("invalid test mode") + } + + spawnWait := make(chan struct{}) + + wg.Add(1) + go func(f *os.File) { + defer f.Close() + defer wg.Done() + + // Signal the routine has been spawned. + close(spawnWait) + + // Wait until ready. + <-ready + + var buf [256]byte + + if n, err := f.Read(buf[:]); err != nil { + panic(err) + } else { + os.Stderr.Write(buf[:n]) + } + }(f) + + // Spawn one goroutine at a time. + <-spawnWait + } + + println("waiting") + close(ready) + wg.Wait() + return nil +} + +// mainHTTP implicitly tests non-blocking sockets, as they are needed for +// middleware. +func mainHTTP() error { + // Get the file representing a pre-opened TCP socket. + // The socket (listener) is the first pre-open, with a file-descriptor of + // 3 because the host didn't add any pre-opened files. + listenerFD := 3 + f := os.NewFile(uintptr(listenerFD), "") + + // Wasm runs similarly to GOMAXPROCS=1, so multiple goroutines cannot work + // in parallel. non-blocking allows the poller to park the go-routine + // accepting connections while work is done on one. + if err := syscall.SetNonblock(listenerFD, true); err != nil { + return err + } + + // Convert the file representing the pre-opened socket to a listener, so + // that we can integrate it with HTTP middleware. + ln, err := net.FileListener(f) + defer f.Close() + if err != nil { + return err + } + defer ln.Close() + + // Serve middleware that echos the request body to the response once, then quits. + h := &echoOnce{ch: make(chan struct{}, 1)} + go http.Serve(ln, h) + <-h.ch + return nil +} + +type echoOnce struct { + ch chan struct{} +} + +func (e echoOnce) ServeHTTP(w http.ResponseWriter, r *http.Request) { + // Copy up to 32 bytes from the request to the response, appending a newline. + // Note: the test should write: "wazero", so that's all we should read. + var buf [32]byte + if n, err := r.Body.Read(buf[:]); err != nil && err != io.EOF { + panic(err) + } else if n, err = w.Write(append(buf[:n], '\n')); err != nil { + panic(err) + } + // Once one request was served, close the channel. + close(e.ch) +} + +// Reproducer for https://github.com/tetratelabs/wazero/issues/1538 +func mainStdin() error { + go func() { + time.Sleep(1 * time.Second) + os.Stdout.WriteString("waiting for stdin...\n") + }() + + b, err := io.ReadAll(os.Stdin) + if err != nil { + return err + } + os.Stdout.Write(b) + return nil +} + +func mainStdout() { + os.Stdout.WriteString("test") +} + +func mainLargeStdout() { + const ntest = 1024 + + var decls, calls bytes.Buffer + + for i := 1; i <= ntest; i++ { + s := strconv.Itoa(i) + decls.WriteString(strings.Replace(decl, "$", s, -1)) + calls.WriteString(strings.Replace("call(test$)\n\t", "$", s, -1)) + } + + program = strings.Replace(program, "$DECLS", decls.String(), 1) + program = strings.Replace(program, "$CALLS", calls.String(), 1) + fmt.Print(program) +} + +var program = `package main + +var count int + +func call(f func() bool) { + if f() { + count++ + } +} + +$DECLS + +func main() { + $CALLS + if count != 0 { + println("failed", count, "case(s)") + } +} +` + +const decl = ` +type T$ [$]uint8 +func test$() bool { + v := T${1} + return v == [$]uint8{2} || v != [$]uint8{1} +}` diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/print_args.wasm b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/print_args.wasm new file mode 100644 index 0000000000000000000000000000000000000000..a3d5c31788bf04b38c55fb3e031a289ef432e853 GIT binary patch literal 219 zcmaLNK?=e!6a>)uKeZMMr6{=QLWG>aBjhA$z^D~sOA;))Nsn&pUS}~giw6@N0idmD zIVDPMmgdY0uoL^ygieQt8N#iPdhqty+3{2ue+~L-Bk)61UlF>u{qKs)S&zPp79^N> yB?y#PoS>$nTzcYiz2n?j*ZUVE*C84oAvQ-kK$1d@Mv{ce?lm=Pc_gXkru+b(N;;YV literal 0 HcmV?d00001 diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/print_args.wat b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/print_args.wat new file mode 100644 index 000000000..e11970411 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/print_args.wat @@ -0,0 +1,61 @@ +;; $print_args is a WASI command which copies null-terminated args to stdout. +(module $print_args + ;; args_get reads command-line argument data. + ;; + ;; See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-args_getargv-pointerpointeru8-argv_buf-pointeru8---errno + (import "wasi_snapshot_preview1" "args_get" + (func $wasi.args_get (param $argv i32) (param $argv_buf i32) (result (;errno;) i32))) + + ;; args_sizes_get returns command-line argument data sizes. + ;; + ;; See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-args_sizes_get---errno-size-size + (import "wasi_snapshot_preview1" "args_sizes_get" + (func $wasi.args_sizes_get (param $result.argc i32) (param $result.argv_len i32) (result (;errno;) i32))) + + ;; fd_write write bytes to a file descriptor. + ;; + ;; See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#fd_write + (import "wasi_snapshot_preview1" "fd_write" + (func $wasi.fd_write (param $fd i32) (param $iovs i32) (param $iovs_len i32) (param $result.size i32) (result (;errno;) i32))) + + ;; WASI commands are required to export "memory". Particularly, imported functions mutate this. + ;; + ;; Note: 1 is the size in pages (64KB), not bytes! + ;; See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#memories%E2%91%A7 + (memory (export "memory") 1) + + ;; $iovs are offset/length pairs in memory fd_write copies to the file + ;; descriptor. $main will only write one offset/length pair. + (global $iovs i32 i32.const 1024) ;; 1024 is an arbitrary offset + + ;; WASI parameters are usually memory offsets, you can ignore values by writing them to an unread offset. + (global $ignored i32 i32.const 32768) + + ;; _start is a special function defined by a WASI Command that runs like a main function would. + ;; + ;; See https://github.com/WebAssembly/WASI/blob/snapshot-01/design/application-abi.md#current-unstable-abi + (func $main (export "_start") + ;; To copy an argument to a file, we first need to load it into memory. + (call $wasi.args_get + (global.get $ignored) ;; ignore $argv as we only read the argv_buf + (i32.const 0) ;; Write $argv_buf (null-terminated args) to memory offset zero. + ) + drop ;; ignore the errno returned + + ;; Next, we need to know how many bytes were loaded, as that's how much we'll copy to the file. + (call $wasi.args_sizes_get + (global.get $ignored) ;; ignore $result.argc as we only read the argv_buf. + (i32.add (global.get $iovs) (i32.const 4)) ;; store $result.argv_len as the length to copy + ) + drop ;; ignore the errno returned + + ;; Finally, write the memory region to the file. + (call $wasi.fd_write + (i32.const 1) ;; $fd is a file descriptor and 1 is stdout (console). + (global.get $iovs) ;; $iovs is the start offset of the IO vectors to copy. + (i32.const 1) ;; $iovs_len is the count of offset/length pairs to copy to memory. + (global.get $ignored) ;; ignore $result.size as we aren't verifying it. + ) + drop ;; ignore the errno returned + ) +) diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/print_prestat_dirname.wasm b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/print_prestat_dirname.wasm new file mode 100644 index 0000000000000000000000000000000000000000..f10887985594a01bdd558c96c33096f850450578 GIT binary patch literal 231 zcmZ{d!3x4K5JYD;QHz2U3WEIs_2|WWz9bDaY7S{j60Dy3>!zN(bYXZi@L*x0CjfMm z4NntIjhKFr8S@1AEe@lJPRGs+@!2Om1p9J!yzcMq++#9HKWqXPyz0+uUC^EJ7PKH2 zSssH+7A%;=N>aW}#cOYUA3lt=&JRO^*k0%aB@{~38HJK(MoG1TDsBu#x#W~w@4ml? BKaBtY literal 0 HcmV?d00001 diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/print_prestat_dirname.wat b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/print_prestat_dirname.wat new file mode 100644 index 000000000..81f952d52 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/print_prestat_dirname.wat @@ -0,0 +1,42 @@ +;; $$print_prestat_dirname is a WASI command which copies the first preopen dirname to stdout. +(module $print_prestat_dirname + (import "wasi_snapshot_preview1" "fd_prestat_get" + (func $wasi.fd_prestat_get (param $fd i32) (param $result.prestat i32) (result (;errno;) i32))) + + (import "wasi_snapshot_preview1" "fd_prestat_dir_name" + (func $wasi.fd_prestat_dir_name (param $fd i32) (param $result.path i32) (param $result.path_len i32) (result (;errno;) i32))) + + (import "wasi_snapshot_preview1" "fd_write" + (func $wasi.fd_write (param $fd i32) (param $iovs i32) (param $iovs_len i32) (param $result.size i32) (result (;errno;) i32))) + + (memory (export "memory") 1 1) + + (func $main (export "_start") + ;; First, we need to know the size of the prestat dir name. + (call $wasi.fd_prestat_get + (i32.const 3) ;; preopen FD + (i32.const 0) ;; where to write prestat + ) + drop ;; ignore the errno returned + + ;; Next, write the dir name to offset 8 (past the prestat). + (call $wasi.fd_prestat_dir_name + (i32.const 3) ;; preopen FD + (i32.const 8) ;; where to write dir_name + (i32.load (i32.const 4)) ;; length is the last part of the prestat + ) + drop ;; ignore the errno returned + + ;; Now, convert the prestat to an iovec [offset, len] writing offset=8. + (i32.store (i32.const 0) (i32.const 8)) + + ;; Finally, write the dirname to stdout via its iovec [offset, len]. + (call $wasi.fd_write + (i32.const 1) ;; stdout + (i32.const 0) ;; where's the iovec + (i32.const 1) ;; only one iovec + (i32.const 0) ;; overwrite the iovec with the ignored result. + ) + drop ;; ignore the errno returned + ) +) diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/tinygo/wasi.go b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/tinygo/wasi.go new file mode 100644 index 000000000..6c52cc4bc --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/tinygo/wasi.go @@ -0,0 +1,88 @@ +package main + +import ( + "errors" + "fmt" + "io" + "io/fs" + "os" + "syscall" +) + +func main() { + switch os.Args[1] { + case "ls": + var repeat bool + if len(os.Args) == 4 { + repeat = os.Args[3] == "repeat" + } + // Go doesn't open with O_DIRECTORY, so we don't end up with ENOTDIR, + // rather EBADF trying to read the directory later. + if err := mainLs(os.Args[2], repeat); errors.Is(err, syscall.EBADF) { + fmt.Println("ENOTDIR") + } else if err != nil { + panic(err) + } + case "stat": + if err := mainStat(); err != nil { + panic(err) + } + case "sock": + // TODO: undefined: net.FileListener + // See https://github.com/tinygo-org/tinygo/pull/2748 + case "nonblock": + // TODO: undefined: syscall.SetNonblock + // See https://github.com/tinygo-org/tinygo/issues/3840 + } +} + +func mainLs(path string, repeat bool) error { + d, err := os.Open(path) + if err != nil { + return err + } + defer d.Close() + + if err = printFileNames(d); err != nil { + return err + } else if repeat { + // rewind + if _, err = d.Seek(0, io.SeekStart); err != nil { + return err + } + return printFileNames(d) + } + return nil +} + +func printFileNames(d *os.File) error { + if names, err := d.Readdirnames(-1); err != nil { + return err + } else { + for _, n := range names { + fmt.Println("./" + n) + } + } + return nil +} + +func mainStat() error { + var isatty = func(name string, fd uintptr) error { + f := os.NewFile(fd, "") + if st, err := f.Stat(); err != nil { + return err + } else { + ttyMode := fs.ModeDevice | fs.ModeCharDevice + isatty := st.Mode()&ttyMode == ttyMode + fmt.Println(name, "isatty:", isatty) + return nil + } + } + + for fd, name := range []string{"stdin", "stdout", "stderr", "/"} { + if err := isatty(name, uintptr(fd)); err != nil { + return err + } + } + return nil +} diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/tinygo/wasi.wasm b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/tinygo/wasi.wasm new file mode 100644 index 0000000000000000000000000000000000000000..d7dfb28d32ebedf2bfeacf61001e24253ca08b20 GIT binary patch literal 109235 zcmcG%51d`cRp)vCy+7TrU-y;Nw%U>s-}fR&n@EWW#!?hRx-`}w+j8s>2MjoCnaE&w zE4Cyz!hj+@J4&o13K2mG0!-+ch)ILx&xl{Eec|GtQp z_W8E0sQscupMj#3ufLCi24(NIh_|uTvqpHz4{M5Ri3?@=Ju>>2mJE1BO&Om11X*qG z-ODB2&%eoqEWhzb9)9w%hn{@=;hj%D`o!czJ9j^_=dnkA(2OoLphaQ=Xmb_NEhj;(blMg-l*pEH(q?OBFqg>s}3DRqoXgu=x zp2v1S@%Zb4SyUGKA83(2(upS@iIUgAsY!_+-2UX`!;`Pu=8%d#w&Rh1vfv;Eq3}Oh zZb?tM?T_t#=<$a?_()WJ4J2z6-u=kK+h22}`a=OAMa|a%^5i3rOhm)4QJ`<_`pMtJoVUQR7qcmpN}ieY7#~DB<{O0&XOqMzlc9^e_zy>RO?x_ zTCLTiS~XreI9QFdIF6&Z8V}WKY1$8nG>R%wQW>dGI*BS-CCmCMX&hI19!E)<)zX_P zl_ZJtBpRwkQEge=NS3dt*BfyoL(G9U@P_)LDA&7sQU%%@7vEgeT8sMQXfdyA@j%pm z(?FcW^{f)_jMEhG5tyM5T&I&YYPVIZAAID4Pwf8DB&vS!;T>>%^!?cn?tbKv=>63X z_}|-V5Z~TBTz!a<-8~uoKwmwM9LT);-hsI2|I@$Co{wu$5#>WsV+q$HE|MZGvV6e3 z`f9qXajF()`;)PRzeVDTd$O@2cImE-MY3^sGgkT4QM5jyri;gU6_2-5|K7zD?FxmG zWxiCrKBBx!R4SP(mCP@dtd9~(r7D%ql}hKAO4mmz=wuVE3gxo#R!W_0d?0D4ts;4) zUlfZ4&vr`r4#k zWG)|X@j@5cZB+magk~fN>1)&xoP2GPdpIL&lM&z)9u61bU#QukyPHu%0PDNvH}C4c zFqc&Cv+#a2iEa~m>bHRxj46Gm8iYx9F zWuOgXI57x=$F+tE)0#n}p=5kCrs+hFU3L7H7&2A4T|C~3-C#?%gDTSE3f(ha4A8O% zA|6q_cziShh#}%CJz(MhwD>nzF{TRGA$b0gULkW zm*Y6y|E9>TK^|7pjSb1#WTiX##R{O{18#s-jEn0Tz1xz4j>Rt8g1jJy{eHQI|Rr!DT@FleiI3R=v?=#6MpFTUc`%umZ5RB^j5@ zT6Sy3S4NFjQS!o7vMXF2%)Ek2a$7Q7qFf0m=KeJHIJv81kUpLjWU(h5!P*5MvQM0V)un zvH<}e=8~>W21)|dJq+3tm`YK3wzh5 zk(=TPe|fSY)&qoNXxwFcS`~N5c(BcIX)l20l?M;cv!YBuFsaVQa34@AkUb;Kup=202TkIH@+^ z*!Q_8e;;bifFBGXU9xAqT`j7#?W9@aNmt!9iJ0z!g`@)| zN!Y`r;piB@d_|!>;nK(NZC3N|UN%7cz8u}AO~4@V15txvpcm?!lQ$4LV#X0z_cmit zvTnF^lg2#%o^FwOP^2YWasJ)(1%=co38G3gkjlWP9uQDcweFwkE`eWaQfoCoI;lv& z02YX51ZP!bZR7j_#*Z#Zb21u!fQwjF@Jo0b`Xouh=1z(L<5YwzUTFYE9Q4V|HS_zd z&oyg8dJ3vTK9S-BUYnsIQUoOR0+P-Xkjw-m4FUo~As|Hp-{Y=$Cbt5ncxcqKwaH}a z*}4(AXMX|S}8PWHk4RNS{Vt#g-bc$NQ#KHN@=xV+8wZ72@X^_WXL-nX}%>Nj=5 zZ*H@FAnR-H<*7uWaWX;OnSns(eDs-Y9R6vg$yhQ5!+ir6ukP-_m4Y2)#A7@xlu?nv ziRfha-*F*#x2njx3h1ZV$=a?Wxl8uSC3lK7R!4DLrZnB--ngrsx{n^PcBK1K_pJX> z)bz9N#^r+6+`D$s{>{5wbrSe+Y{hHz)Znd(5}Rpm^sU?eRCdlZaMHq?*`{qs1EWuiK<+)PLz znTYX6WB2Ni(BYAA>BPIuE9O^qkDJjiq!ShsrIKV!Aa+vhM7l{;U;XXq?%njsW&naL zj>D4mLc`bP{o+0Dib1nqz%CoZx#so2+yiVjcxfzpizF&?v4oHayYe-zKx0O}g|`7Q zERMr84ws`jV{ED{B6oUF=YgnF+J(fp8mr2C6UzirY%JuQ?3OK%ccM{Ux=F%cM;>@( z%=^FIX2Pq9YILV+#Zu;L=OrOE|2*K%pgD022M>=$d+X}ZD9ryB7 zWfPa9zgXGiyXj8+Y-aV);O%Tf^xkZrTb+N`25kL@a9tbuZfUy69s2nI9@COP>7SkW z8DF*heembHpvr1zX-M3WPx>mC!*A3SE@t9Ugk(Q#Xrme-SN<-p_yJKH%8rO3dJ66d z1?51f?2q`eb(LM=%MSQ{kLKUS`zPIcuC(uN$-hf9h~=&AS07C=pye9*liqaq_!h1| z|E{Pp906gaTEuSSvQ=05LY-XJc>=)C~b{lcZu}m#~ykQ3~G??7q?Ae4{ zae!ThO~6_(zZ`ZORxfO3G~q#a;@M23`)r^D?*0NwAe*Hg87=Qh>M$x@>I6N~r4C3M zbs&bci2UJb9;SsyaizZmgo9!j?$Xt$*`tRrA~)fAJ3Qt|e7LC_cVVqkcf;nUq!am| z6@OQ^_JYP@9K}B$``8@+jQWOGxi0_o=qj67z~q0oJkF(6uhh!9#aE&3F-?A^E2vd> zCNUR8RVAoHw&ZhrP{$uw6~V!Li}0ddY- zH#bu(CgfAl1D`6BXBhLoWVo^g&vpZ?y8EkVvsMNPHKjv$xBJ|ZiNSi*A17&FR_Viw z0-v_#87I_}u?al5H+gKv^z?#ZWqdLEM+0MP+Mx zqbZ$wP_*gP8LPRnRUg1{t8Q%8Ejr+Cmm*A{u=`!A5u%u@wnj6>v%+aqS`9$Ax}W$A z-7evd3hp_ByUN2&+`4gh4nXkt9H4b7H*4i?r(A!-9r!3T0WjCwlJgh^9(O50s~6Pj zY(%pqDee<8FY58xXxx33CSs4%{UtVA)XGI`Wh>z7C1I&|N%b!Fg4-r=m-YAp;QkPB zQu1_hdkO9VfqTioJqS30J-GY|;pK10hdo^n#u}e1g3^h{-FZWbxYcNKs7s@cm3diZ zu7ZHQJrKJ;R@t(trv&DzHMLihJ>v)PdquUb^rF2}Xm=>$E*mhL@{J~wC8S4%^a0+F zCObe{vk`!Ov)~_8trK*h%Uvf7wL^M74f*wjn#wa^!%{F3q5$Q+v4F^eV8(6M`AjG2Z@nrrlVwew~U4bB3nW ztt*)V4X5;rrzgVG1C=(4^+Nb{71WOFo|4nL^6q@Np5!{39IUkZ=-lOO-2MGei%IS2 z%PiLTRxVpBr+Mlwf{nd>Df4B^G8e7PjJ><$1?2)|y90M26W(V9W7c4VVSBOL%B+<* zrxIr=(O*C!xeJ&Qk!*B~W}SfeD+=#<10%|~k6&BuU}~D(svQp14$)s9a5`$$ z4qaRAs8u^?)uuwV=Tyx`YTBy(#I@C?t=b{0b|O?eu4;s|kbJ9l_}XfxtlD9#HWR9y zRyB*BowaJ8zP8#~t9Hby&4y~{RLvy+f>k?mZM6$l?Wk3|7^=OfYBuz*8t)bF4!k#Q z<8d9uFr7&2Kd0zQwui6>QJhjSoCu?ToZ*2hvpL0JTznLe;?IR#3@08npi=@0ME(h? zW-9Tj<~f7R+pek+-@AhWqBwnlsyS$EbIdw>IN){2M}M}b3GUz*GPad))w;j#xh!0fJ`%?(bIDnD`Yt% zq1MgI^h?*P)uOLxDv-uy0#Bh{G{^CA)XDr7>*y&|61vu1luufE1gFd?x@5zDT27I9 zb{OyrHN2ZeexYY3)clKH-*P6Foqy44o{3uu+R87wNIlJ827GMVN0R*NfP31{>xqQn z4#AhYo@R2|jU{Pe$ep4UNHFK+k4Qt!n7&*AhKU9G7`c2LyZtSIflj%~TsCBeTg7!vb(7#fP!h$1o$6%0w@ID1SG%S1h_XY_g}NPVRPUpM9O$){t$y4cqFb#b9h21*S($S3K#Os7x}q^_*Jj!S zUP57xNhcP#`JUxP-|iOrM9Tn_tZL=!n`n(S_qyUP+qma)pTFE%)TQFIQrE|mdO**X zGj2;B_c;Nzq7TGv#RCNqTL>QkgCMsh5Bkdvf4QA%HL7K1Rv?ow zfmXCDlHH+8iDIOQ!xkZg>+4ya@er#+5*C#T?wUS42%{;YNOQ!9geI|At10f?3? z`n-71T}Dci!j+_Ni20G@S0mO7<`JzAG9v;=1S|1Kg7k}1glX!aMVLY$hL*&KpY(wk z7+QGPWknAkKF>PJH)$Q^Yq4M1BpalT^whPc+ZB+0V>Gbkg)~f*j1?8disU<`tv*JZ zCz`3?YxQBQ^g=9vCpU@JWqD<}*_fJsOj0Q;`dHFv0FE4i9mKk!2vG|y4u z;G}@j%CylAoJ5Rgcx5;V87Rp3^bnF7>On3w!&=eLlxs!5K^!nd?lbzB`Q>X=@ioiW zN|q3i%m&QWTB$qq5dwwc@_)%6hD-~j%a=zn`B4?ptNQvI1I@vqe9_`1!#CWxbmXRG zibSUFr_{^}DwEeirzxi4FG171q-h9q}EcHJ=Z$EDIKc?-+4Zh9`_G8$;`4#)I zq~WRn`1kf>vHx+}ek}4oe#?I34R_XVSdjUO-3&I|*X*X*V6L9JKeHbL4cE_)|I2<)GhwLFNx5fa%wJdUBESa(Smf?b1 z@w!^rFCe#T(y?8f)_I_^Q(CydoK>W1yYKB*h6?2mDPEghMqI`uJcsbsY-`+MKW7D4wTu+=wopJy1eJ+O?pYo6N&5@s+P>yb4% zicmxX*lRRXjTJ_dY%MUtcFF}&5}J9DX=8Qd_Pc^->0~>Z*aO#5V8U&?cey&Grx6dS zirccQ@skUsdY&vRTnTq~S8IYSdv5jOT=(J}M7md)ZDAqt9gy#~n8k!Rj^ebE#0;fL zYox^|{86c_*hdy(W%BX96llFrf(la0zb5o&ST*AorrLxY=Vjxy zBK)zW>w0@d_qrtU%QkcQA2f|)UH;KLAQBCX7^Q;4Z(ucwF)YYR>2yvkV&Mu;s11wVmVtJDq`=~CX* zWhbPRwC1Re+1;>|tl5s+A;XXEatyB~M8$GenkYH2octKwtiaQig^=FeNP8{jR+T%0 z`o($o!WD*%@hBBKYFUd>Z_~g$fSwnns~Rt9YJs%ny9Y)4t`267CfeWHOMB=$HwRci z`=C*)UZc_wCB0p)KyJCte=;|r_Q@fo`(iNy+Cocu_a&K^=;Bo#EW>*bk#rL%s>!J> z&N4mq(k|t?YcPxAIH4Vh!HQXsNE`=y|^^V_nqe@{pmT3szl&Bf&s_|P-5D$QivAqAGVT!xYZO-z-HZ%e6{MT$wIfASp| z?m9_dmTpFP%Iue)qm(3?`nZ|af}oYe8xD{k%!P@AL=H?v70($Wjuet5_x`Vpf@F;u zpjYCI@Ia9&7pPQO|um?6E~Xo}=b=Xxp#GVy(UZBCO|PC0_S}rEKmHx|UfQv9xbVvM*_% zz9osiZEBz?Xc5K7%Jdi7{N7)H|f%t8;S+YN@{9R#CTVS7gkLH&gF zH`Jy0U(ltVVMz8`m&$~grgg~z^?pFqBdL@4H@~D_#PnyLQ5SVdjCBloG)}T=WNRvTK3VAlZEWH+e=GUC;mt;w z|8I*Uzl`DyKb=jai<=N5{`SOje`E5{M2y$%ZD7fnYdnG%t|1&*^8eqHpi6*cVz8nh zLPb$xy3$O`{z=l-`0mFq{8sPNw|gSQFZ{N=#5n@o`p+N$`V;%_zOi7qi}?7p1lTxV zk!*-xPlLezF*#Om_ZrnSix-4H4*Cc!ZTbj3tnj5$iC3twe4wC@m`-<9(n#0VEKt6S zy2_XKsO;sJ2)6Q2Eby4i-paGVSv&P{g{_E0`Rx-SFvrv?7#A^GFld+I=>$(X3;xywG~d2k)4B=7-5RE@%4reWKFR(%aUO;NgG#9JG)I|HEi$R7h9jXquJqL&@YNn<-w=JL+8N7` zOx$!YTlgd=jrRsWJUfN_S!;2!WF!Jamb5#c5zoOZt0P(5)RCd&{sMVh1R6GYhWRn2 zVu1Qoyns7qg|w2g#2sIy-k`_%DUb8sZdcE%;89lBRPYJ~yKF={6Np|gM4z*EEUifx zvE*f(Mm`f{eNiBkJ|+SgU5_Z^$x4t$Mv03m(V>LBJrui_X-Fx2pxyy>T@S=vI$jEN zBwzA6RJkl*Bzw8pgPD6Hjh5sPloQt8ODaO%mv8T6?7mLXyu^vTFFJO`T0I_@LooA8 z*K6!$LAqdlQ#0LMChHtIG61?t5#eBqC9kObtd$3w7nx*r#XV4D)+%)XU|BMT#rfF% zKO|IXNz?$JwK4~|7hq%XgZ9HSwMcr%3X(=6=FsY>=5z1z)n|+dhbiH-;@V~RGu>ff z%@xd#7!1~2gE~8UT@oBMB>V<5jOWYKMklnD8ilVt{n3)6$t6JPdXX^|hmlV)T~TZz zwd|!>B4Ei#R_ZdP<~ikbOOr4#lQ%e(nir;c!zY6&EJ}5cU06X8N_NxqOH=3A<^Fxs1hnGEE>0tzB{CKhd5hCPxK{ zW)Cv;vsEK|`kbChqUi{C$Xkw=t3=nQ@O(hD!#X-bHsO9@zioOMP4==*nJI5Vi;|LH zR<&SO*~_kyienB2V2G8vqDNo)}VQfZnyFl zw=uI+sH{wdQfAcp=#xTL#!1}yNf<>b5OjwuI^((fq*zZHnEQzlfc*n4Tb1PTDb+PA zRW@k`>a-qXfn+RzraD{a0IoAlZ2-rJJ@E2&pJbDYu!mGv##iVZx)z;B#Smvy2onq) zsJ^Z< zF2YPx#@A%;Q@7?%=&7px1l8ywQGV=q?=aaK_;K*nguI_*MlR|aA!IW+PyRDztP}rXU9~P28WcfXUoOUMnkCHY`4zQHrVD*`8rZ zyqIpr4KHAO2ruKt0)D1kOjf#hLf_ww*C&yK_mSiL4x1R+Bg&F0x6ziC8;!q@eGsmz zeabk{Ke3GEgCvG2OC?_JBMoUm(u4VB1Z;GlwJXX%FjKK(yv?+=&RDCEm`YL* zC2`7c-qZN2IH@p=MZpMT!x1p|h-~-T*$>tO**2O>IW$44CbX_#Z`-CP2x5_i6BVS2 z+h{8#8F+HQdo?LN^pcKTAo3!QjeU#r+ZoVKMr$YX?NGpeYJ*JM`Uq9nUY{^Q5*VIp z=1{Y`SH zipAeefdMU

rsee+L@0I?C<|*y$qO#i?zn*Z9uBE?Vz-*8eE2tsI`foQTl1@__PXge=*4>|t;`#lDWd^_z}b9EJ1(^i|!K8=rB(%aA= zn=xn$RBvyaTtUg(+wq-1;ql#I#P*7+Ss*JGdULn7Pj5vSAj1}4=(=uwny)$FGYbkVJFztWzV=vsyQ z+AIcKfvcsDNgzj}`-_1BDBqayX zomj{)5eC%3*sx)h(Nh9!LY+xr!xY!B*(q!~*um>y^Hdib;xBZp+q~yvBklRv)0PZz zOX01WSL+e~HYy=uHj%Z)W(-^AxFj~?Fa;FOpcI)F+p~jQ{gx0Dl`e$oP?m`TD*#MX z$#A#HrolZ4gsJfCIZ~&Q>YDRcd?)q7=!csZND5qy-LY7L#3a;yO~vvjn4dzuX`Eaz z!SM@x6lxr?{CXyuR)dKYdYSpDWKGj3H00{&Xq<0?7=*~HvhWdc8Y`Wvu^EBIVf*V( zWbOuPfrZYwumWZ|&rm=KV~J0Ql3Oi}2xb(P89A%Qxt=3u_7_oKmY@(j@;Z!L*0v)= zd$}uRWNi^WsRv+$+m0H?!>tIJu^mQCk1_nK`e4@|{< zYX#}Z1~;Qc-@v=A0dh61@v;HtO$J`9DB62RKn>7Xk*W#qHAAuncx1(u^h(orwaM(N z=x)4C419trA=L}c+3M35Y5{#nOgdM_u?upi6q@gp%z zT2RG#4uh%9xTw9`=XL6qdC6wIsJ~lt6s!Xgts*7Sn5y3nQ#kv}_?2rko^3XYW|lfk zr{H}Jr;)GG8252e{3yTd1j}n#78^|plK3+$!fM3^zO?jCxiEggTyBM!j6P_+f!3Uc zfLUPv--P*xV{~NbOYFjPm-`WO>UUHX^6GP^sF_DHA2or`RA_HQLKC7nODNd1j z?L=L_{MOw-k6YGVdLbui}=dp8X-vY%MgglY8Fg1yoh;%6?njecb> zb_e`kQXZ0<=|N}^s3MH@+V18mbh;JT`Q1z%zpaF(iIJWDA>E**$`gld9ZqiPoWmab z!TC=300oj-!itR{`NPY=F4epOwnA5m{_+-W+G1lMwn8}WZ5)j?_CNKNPyg!P9Yyk_ zJNfIcT>9}Ry&7@Z771N6O3h?E6ly0N>O@K7M&trA=&&M1z#GY!|06zSt7#HP>dNYf zDw9BHF~j8-u4eg*2?A(!K}T+64~kLclEw{@`%^OHZp`09FXH??eoy;qp=*EPzc?K$ zWa$J%+vI80@DaNSpT-Y~I0sJ2e`dA(zeLRC^;0GBc5U$8!Bgxt2q&+RSLymU^ZLI; zwi(Hte%_A>6S-5*YyZ@#FIMtsnSj{1E3q8!cbiWv2d{gfSR$IyVxl8Ybl64`&Vaes z?(HBLc9tdn{1qGv+^6p=f4Yl8-$MKI z3Lr~bDRsD&^AD(LY(ZY$6^-F*Z*D`ocSWtpb&Nu-L^o8(C!tIL*NXD*?LtOQqY0l% z8#n%z6ZI6h=_aS3`XhI{Wu-_ogkhRL;Nn(nYJy?Yj8TKcSa4XIOfza{(oa-4A*L0H zeNYAdfE(Mb97lw{JOhg$IzvYDWJijSRGlKZHjb(`!!-)*lB#EMF%WU$$5 zkJV?)tA4VKQdQ!LXR$Y5GsFnH_#mdLKZ8hzo;1EKlnaB}R{u}v=%N1*Jw74LWoHWU zFt8yH(8abdB7!v1v~WZq4X=1G-Z->S%OX47U}1T}f)5s&HqD`=X;Yu74~m54sH4d; zmvC%=&Dgyv^|GjUq>{3vgTOy{jjq%22e$boax=)K@A|ptCEf0fU1;atd}rfM`U7XO zEEcbf0xICp1N?u%s>p2FQvl@;K?L|j)HaoS#j9Mp|9VY5-uOBvU8*hYFl_;&O#d*e zqr)hAt&WeYn%5ZnY?jE)>wu#J=#7y*ZFs&&@nWp~B!7Z6i80vJ=qJJ%sS^6&r2O@Y zpnyMo$wQP2g-RcXnhINKNHDXc)Qf3qn-PrIT`;O?;}1!I?nVC#ggHe``MeS#a`cPp zq7*iOU^qEum=L-Wamjn^W_?x6&5p7|?EVO?+lVI)PNc9qiyq~#1}&a|`?QSg1>8Gq z1pj?9W!K!{+Ncc+7vJXHp7|@DA^xRe6x@-2|D2V?^f0K6OK~?_-$&8Fsms8AR8&$B zP)kNF(?vRI4yJlPsDXj)48se9nQ<9(@|(F^;&e2l_XgnIB=_t^G|c=3A2Pz~@TYS3 z@^JE+smMf(2Sjr)d|cds3JqY(y)b}57>p8$QKCq_Fc`NU{-ikwm*1E)_g58yxsoC4 z@MGluhIY=x+^~(9K|7Xez{<5^O*3bF3|HR`5b_R*I9Uz z@#NnL4QW}03SR8`2z;fjevvTcFD%rD!dya~8U4C@(Qc%TFW4Ot zwVw<-X4aFAVA*o)?zT2AET^j~7G5VqH(yLH0QF2ktC|{dNhFaxUWktf4l1!&%$}#q2oDHM3>aa|PsU=YCi8Hwe(Pp7+yH=ogjNUJ3I2YRVjM7N}mZs`2o)35gJ-O%B`;{N6C%9ngK zfimwyp(BCQ4`yWYAkhb5QM4m&kyfy7x*4Vii7ha}NR(0xDUmI(v#jg^(HpC7%l3qH z)K$wMaKA<6YQDXtK2r0rtuuyOKyU_}Ja#pmE5LJvf%1!{Edq1yr~WN?6PO8ignw`? zzQ8lWLg5*~B;%#y-FMH0CsV?*=KO&U_|*Vo&1O4RMjMf>5)qsL@T8#u24@mDPLzc| zX9J{}ZZQHt_&V{pP5Wd5AW@j_8VB2G>*cgSz&*#fhE*gOi+v?PwX;>^h9@s#p0uo_ST&(MJUAPYONb!j-B&6Z#iOAXR+gtA_mW5_ zBnidvgt&(|p`!hp8gmf3q7qzRPSY{V8CQd-OT54C9V`wx)VyI4xtBOc55uApZCeS( z_+n%MqC_fz0bP#msdufgJByu>5~Sz;7+npu{F>~RbVQlTc30OfXS?Gq9HK&F8Wp${ zL0sqG6>C${`XxrZrw^I(eEe;K$D&HqWepSQOrHKuTb)JLQPw=)=Iln zsF$?^gbXuxJ{k|}UWt1JZIHQhb5FGPcE{ReQieVEb68E1s&}KE{Q<}`*gerW8JnfZVDQvV+q^|BG#8_ z=Eux{ESW>G0^>3jgFv=Q@7`upc8HFeF~uM!lm4*knBixjMpBdoCW9#SJ?JqjD6>bL z#~`YxoHw~;xQhjTOVwU0&7Hj#>N&wn$s;QO8bq>s{eiH&J06IBLW@6Sj*$4;8l(rd zE}>&60~g*8V}#rN?V)0DuU7CjbY430`Mvv!=3a_L-%F9f4e^I~6H4yYHg+x4m0m#= z(V%VvUKlwA2t3~sSgjA@J*&#Y}QVmD)gPSIKsq0)!IqFn1QY1ZrLEZD3-VN+& z$2xx!_n69xytr3>xgr2XWw+JVM69zyY4!@SG{ns_Y#C2E;+5M@b=Pi6(h7%8{1OND z!viSih78b*hyuk<1>&616^(XU!!LLn83rn`4TBX$WeG9?K<#l9x5&&cd=VW%VQ!(S zT+eZJQ_{>wU=2-kl>6h~9qK+gs5=f1wM-vaUU;_XJ^!Ky@e%}$>vJl{Nb)aZMv!KL z=Xhh=)^gUB?}$ZVRQ5&H0pdmD-L4CGDLlSxkFjh-``L!7_+KHOe#P6QWlU&8l!Bp) z^BrnvG+8AvC;iKQjLKdrV+_*tSU|bLQsz8k?U=hBd&!hc(1P_H7PP4VEf=)s_%UZo zWfcP?Wr56xB&6xg52rD(xkM5%Q=YY7tIH|)O_Z@g4E_neNzo1jFE&aoe50Hze zoyOW_!Bkl_I2w+4!uKQ`I1)A{#He_`#^9n2m*ERdbqT@q^p=!$9@$Z7?M>1Cb}Bo_ z?;GC_ zDZmd$HvYVlEb&O93MwF3=?15C);w6@LlI*rJ!QM$nO_;Q4x{?PCCQ(Lm_}y}6!qXy z{8`L^pYAuA?$7$!b?ToC(%hiMCfqtKcnF9 zaY^dw7__Jpsm8W5yPatFo9DHJ0dF^$#t{p+$I?GI>_JM#Kr-^EP)OBasvot60FlaV zif9?z9kqvxnl3jG6JQ1c#r&F~h^sclWC;WuE^e4;u}(GAjODCOPz(u>rD@Z7jJ1sc zF#|>8OQVEM&`&h4x+aEgkTGI;Z(z;omB1inqF;tb9pk;c0=G(Lb-(<24*r298D6y{ zLMe`qhBs2Vb8^_+GtZzhwGdX+8`#G|3!*@hubMkJ0salY%Rb^~^oKoe0 z1D|TjjqT8I${95C4j|RyA`TvD-?-s7|NE;S`fzJ0z%8eN@I_QCEpFsr?TO6?JrJ~+ z0b$tHtSKOWxV?q$-~-!fm036d5)ubA#H7oHr65{ZmN`+AdXg)V%R*YBTCy${ z)y6mSWU-gu6Sy`$Y`IpOO4)0{niwT z?wgh2EFB$*!$yciVx|NaUeu(G>Er!8l6B&VOslWOt=w_Sz>(U;Z})ZxrPxkn1^ zm6n#cQNmjlzImiC&U6ZXVB_<`f_#-AZAL@=r0SMi?fNJKfTI zpaObI8&pybj$>FL8$U^|C+)di9p$|12F9i}02ehVoE8I0${g@@>Z)Hy_9{%b$%IIW z#Y!_$2)*b;n>2q|LD{}#WL41T5#?RbTT9jqFK!l4bJO^-1) zW@Nm*n5=MpVk_NfnHaJUW+xQiL&sS+yl+*41ujKZbC0Hm50Y8Kut0XF@PtO82s+#KICjHfI-9KHN2LOgySI$@Fxv@pAZ6|w%3+b55=pY_jIMO|Ot=zhl15NM zzP#Qrb?2p5{kBkII^w)4n4lu-=S)Xv#$W1)*=uwJjl73%`JRTpQMOQFGCHmMcYx9|lq3kL*OIaV37TiQr*q*|L0ACV80KC$lF~buSlcqTR zT!=Fc6)cf3jTrUCa;;Imq&i$Lb4B;Gmgq9v8nThL)xron=O?7Es4Oa@BUMbDD^^!u zE-Lz$%kmxIg%sb*ywLS(Tnxb#{mT{Ix4|ZE&Inl+q=7n|fMaZ=)ieha<17g(9YbH3 z4`OQ}6&S)au-Qn9nUh)AA-)ZFL1c>$kz8oqw=*G#lG726rL-wAEU&?ZV5XJD%LL7h zbEm@fc2Kri%sN3KwrX=2ZWX6c9%fC880OY0aDwD3e~pQ(=Bnl*;48?}fk0i?Dsd;2 zZ`e3p;X6-wic{zb?{tvG&6lkhMa0GDaCdzU2(E@ zK&DLghgo_cR?j;h#}i~9(l6Z-PMsVFCei~J8R_rvSxKhrJV zXW+iTb;#spC?3=`^N@6#nR%qe4EuI}k+tWYqKI4`Mccp;Wy+i)NF#iLPP)K4L7Vam zxM#Bg&OvaxNK3U5Q(eLhi4HqBBDMqMVRR1idf9IZvzc$0xc)39K%HUYV%q>A{d6loUM))&Ug-%iPPNeBLM(S2da1qy+8g8ARrv?QFCb#$aKxx+pB0wh> zhWHXO3ZZL04Fcffjj206MFC>wzf@@uFw)cjh7;q`UJv84gkY0`xAnAmw?>WMtj@8tIrDCr-G`03PZ5_Cm`Zk zi^OLRB+2F@ClYRPCy*Wa6JQ-umvW@=tW_cQ3 zkYruO8;m0|>B5}xK$H~t)s!(F4WL_(cls*#{`CP7`J0D;ySlgcy!HMzzp zAT~Wl0d($=4l%^GP}vLStV;UQVe-u_k+8j)wq7B*lZYG{Fi$CIt z(TFxT-fqQwS?dl1Mp^9 zC0jX0mpo@dEi-ZwbPoOYK`ms{2em}g@>oALP;qZy&a1}jj>Wsldqf$HD67%d2Y=ig z@0r_5s_bc@2;GAv*%;>s{QZbXc)!0#3A1V}QM`i-<;S>C^mZmX?lSTR@*LaV=_W9ou5wixPR0QZsF0yfL4x;3wH4VDJ1q$+|Ec>8}P7f~mv-~8W zRWCf0?Y^@XVWhU!)MVd$*ZIYe?ttgiv{WJPA}97~i4Wt2HzQqw$`*sjV89IT)QE-zg-RK zYj@lm0tNiBQhR=QaEDw3UWr0aaRL9mT&U4Ozli+kQ}*DPfe%AT84NswV)VC&AKD*% zV+7Sdz$sFYS71R{N@f9RW^_(yIa$1w^0&s{KK|B&0E5ag!LN#%(*cdCfCjF|@M6QS_QQ0Tbqc3n#YhWY>@wXXED>x+1TJvZ?ucGVUCK?`HZLuzVRP!+4A zsHp93H*7L{*1#k2{Dd=S^ix|j`3VwdV$iV)13hX3jdCtDw?dj{7LDN*2T?9GMgN@Q z7{u_1KVMsMK+E&=KWGy>YIY$*!_5^a&tq~gu@~Z4$oZmh;CeY+FW6Pu5SSPBgMD?T zC(Wa#cbBvVLEy#mXk}wd)EMId1%_R^!vyvi(3m_Ff^+6V%ar=LGv;!A#0s6au9U{0$Pt2& zQt&(gT|rp^e`5pez5txowCu+!dhabYOBYCvW+hBdZC8?-sTs*Qx&V-2AkDHzZ5bRE zugn1GAmg$%m}{knJsO%YoXnRVhmSR_WK01D>S|pBL_3Dg8ZK<8+o7F>Fa?-vzKJB* z2+k2v$7xcJAhlP}`gj13%*nu~)x96=Hr;}BJFFG)l)**U-+^Qymx7BALn$j4u!4_z zfBVJ?X;1ABq~Vonc&oH$Vzu#~fM-n(=)Gju)aT>2Qmy!_=Cd$~*oXxknL<*!nZy2X zaW`4r&sIylulbI*1zL_u>uw3N;w7yF{hnB)!{KtlJHuPCwb~nlu3={Fv+;RF9yDrH zc_H83c%NUD)1bP8d?_xqZ@0QNe6aK?ZM%9a23_-JBe#NGPyh$cpOBi7@Rj!Ez5BSd zCCGw%jXQyECya5?L1FR^l>?xw&U?~TCmiWYw7{-9fk(e}$d0a-fzWu5Af2VCo`f3Y zKUj%_;d(XHJQc1N0)+El@a0a1>nW1$b~pZAMwd|v9UK}zUg%sV-S)*m4BNcu0{nYl zn7}jU3_gA$p)JEm1EjShbB%MYiZXMy5hSi>$pkFLGas~Rn_fStI|~VMI1so4fV%mQ z`q}XuEOs<$>MLoMc-bCoD-1tT{!IeYdu~_aM2UIm*df05aSO>9&b@+UN>Tx(@9-$u zM0=-Tt?;dgj9nmdD2)BS#g{IG6OIv*<4cR!bETPAfo_!lm@jRon9+575nozEqVDQA z9UZ#p$wQS~6e4;p?q^QsOKae)v`<5&G^7yTI3~W}?Y^K!)(R4Wj&o4OL-7Uf2v}<3 zCnJtGN(s=@2?o~I)-p!L7{g==H^|kXo0ufHqdS*+@$Jb+W^dD5($Qk{eOTVng8Mbf zh%;~Mq}&7Z=Wf6)V!s9h*3yR-sD9dh)(QNhm7zgZuIgxhz--)^s*3TYrE2R2UC&l2 z7f#w9EryQoZH;=(3nkPR;4fF9z|cgiU5sw%eEL6q?JukW`hzWTH3ll z7`=PQq6PVoEBewG!vH$sauy1ChpL~F#onMl)l zzJFH*(j9lT3NkDf@i$LJbOw(P1e&AE*9YzTa#fSa@{f6!MYYAcT}v*9%!XobZ*p;K zkY{OG5O8VnCb6-_YRS_i<^-uU3`GUsvn+VMD@7W3;@Am3ow%A0LG%qYVx16LQ=*Rk zkjC+UMEVLsvzauT{ltlz?oUZN()BO6R=8e?Hgi;p%n7Td^({?Ofv`1grf2syIgf-U zXu$m~r3NWgzf*{DbQZH@R+w=U>y!X*cxYf?ktV9Fr#6eqT^!H?_&b|RSk+41zyHbd zaIKBtA`8#li&peWN}Pr}fme4m_eF};LaumZEm=cVH6&DM=;_2aL?8HRpqie5O^Ll0 zj@@5I6K46A-Ps&efVFZrXn+l1+%u}5%bW73Zn55j=we_A)tMetp}!U6l!N)GR^4w? zj13vyL%2SwANl8@3ik6+{b)c{SpDxkSaCYDy0kcSi3xy6;g-^|A+gTfU_!(0VA@o{ z2J>5uIxr1DME>re3S!To!W|@@KKCgL2ODq$%>Y9TACu5f-wOqWf+)XcGcN#g56{FI zdiHkztXi_pA`0}5=qJ?8!PiE7pv#5dt~pT;zJk<)uRA0r3?nWYab%PHYokGLxeu$w zX4zuaGq{xfak!h@7e`7tG%t591a1_#Ufh4mL$U!0Ee>6;#b;G+pllIIGj{TbiGuw` zt@hGDuafVWJvP0FG@+jRF+*+X^-#MPoXMkO806gYO}fDDLa-B;XI(ZjMbV=hJ}%%ys>HQ{NKy{h z49h1qd>o6^Q_gE9@aP@BPpKTKc|GO4JTEBslPZU0oRbHvUsoRJL}1Y0r&F4+bvw|n zA3YuTi~!Zj(VM5Y7&!FSES$1HZwW>(r@XNjguYGIReb`{=l%o`ee?CnLJ+N95c<05 zJP;Lk5fGKv2l0kp5c9N}u&BEK6A%lu+CnS}17Sq7lK%BAbN<&GK7eU+XOK`27r>7nrlEz6F#wKFo(+kpmZd% zB$ZEAvbWBzq0Bu^1z=1Kx0kwiY-+FESS&?J>nkb(!QZ==x4x;o$3^*O+!kCu1;kNF z->gN#dhtyHihJaOd9S+QrJ{yYV)vJnD4f-Sp(G%vUA%Jrbyh#-JMX-ieQ0g=~JW?i5Iphj{`I zvxd6rBf4~abZ@xW@n|Z1#e|$7KSyg_oxpN)D?}|bWxK2V&*&@DJZE0vY z-oU#BIG;9;^|&G*tzp%ku9DQk^;osFSl6j)3-<>Ad`Gaz=KvfQfc!I7{b;qt)@44d zTy5Q?>)|SCw54lDUCZw!X>Ve%nZ(`y_<&WnP+9o(uk`$B4vZhpa0cr&`{Z29|Chv( znB-74G1v&7p(~2v8z7j@P!;J!xJ6KaT~H}GY!mKM^aL3~&sYZz#-4NsVx5OMN}QLo zo8G9(tUr~Nv6;T~(NLOCzFX0nB?n1@VNm!q$em551&;Mh zAd-MaK6w~Ps2)Hb3m~Tia)m&$XTAsISp#`Uc{Mr;IKWW@=Ln^UE0}f!SR4dw=$#U* z<$^V9RYZx!>=E>xxe!X952fwAwq+`Pv8QxNsLP@BrBM2!VBbXP;$}_C=`NpCej~T) zE&QXPWr^inZ}~R0aq7zf$`wHw>4m}!Ux>oR!=oP|e(*z}Xs{Ku{aWL}JGGn<4M10PiI5 zgfcJqBs1fBowlb#*<+#YDYborFrDcsT@v?fD19cBo>A#xS(IV-*U??*HbeGnLiS2P z_G{N7d&Q8QGGwm?kS`15uu9~ZA_ zZU*gpN)J52{FkW&)8)|0bf|YM)SFU0rb-O?b?cSmaVpe18S3$Q@ftG`>dkcP-PCR6 zY$$yul%7#(yi@4ZQ@VtGA(TEJO7k&sJMxo3>6RupH1vSa#2cM1h0+&Qn)5&5gPzhQ z?5m;l%c1lYmByasZosF5bU1^c=Khf_nBw!KR2&DhFdA7H4IKnbJ><$NbUw47!qHHH zfPz0ZD`8sJ+rXhbf|YM)SC+R7!a#)U}1$*p~A^f;e;w6eM1U_1w~80$s@%D}-B=%eh2WR#Ks{0MD@5cMXv9v{$LDx^g`NWg zDF$iI+Nko~us&m4{k&3<>O2m((d23%$IC>8aI`E5pPO;lN7%aP=UY*9UkddEso9qM zZNCV_rH@UpEc`J$S6U2D`2eQh1!+Jo(h&L z&+PnlWqh$hCH$UJpI%Y{u9vy`GuIVsv@zDE3rKxMi?dCtUnT%sasTZ|MvQZ$G;eOT zdrOfhJh?vleJCO*kE+_sYEd7aU{T5aKBVOZYf7WZ&R$dVfQnva^9nHD^=v!-ND+Ui z9s8Yoopus7>=iLVMAh9!D38m7c#st89RAX;f9-`U&F?dG6(5$%%2MUrtIijKR#7!O z9^#c6pRc7m9Ka3~F8BE)Gw|q$3kX^JrTkKrT2YRYWlSB`E7%hD@vn7Q zs?plgdyep0D|q3%?L@B?4kvJHEAL)tX6qIXFVK=c9IG==eLQ#8gxULOJ#N5kMGSI2 zFvzUNbEahe^M>RF+Tv-<4We%uaEwa!FCO}*7 z)_`9Qz%R`KKgSC<+eL2B-99&2xDbk;r?~K(#e@W$4%BR|@av0`LBG193?rYx4hwEC z$eFioa|h;cn}hMTnbJ<&#jqmBDm_aWtYonK$ncY^#NvpLo4b>zZFdguxwF�L-oJ zrIT?W8P|%S1z6UL##<4yUJ{lpvBUnU=l6tlO;i~t*37{noAT#BtGyFX$I?LvuO#tN z-Q6L0Y+O0vk51DjPu3i}N8H6Mj$+tl-e3&gO(~<#nhG+ zDpCU2mq&ttV!9azVWrGhNtb`^Tta4{qs0^5d_|!`M0$J!YbGy^T~FrPTe#e|`CHEO+ZVTdjl-VcpjRL1*#T=+{KZ@)McWBU|i_ z-FLu36i7KRfkl{Qh))ILRLB*VMI}4X53TK0*3gI)qM!D6)lxVm1RByx3!{ zwGRV1VIVQ*ervLZ6B*G`9XS(3xIvbE1%3~;2Dyc+JizWezrBKsRuH+cm@L+$CI0IB zvbqIrmKO_#6z57=yA!x`LV zwm6=$9D8_GcY31Rt2*vm8w7kq2V%(w<6^tX?QEt8Y3dg~%YrUjPB5FWjG8loc-AP$^Z!-4!AWI4hO0Wi*m;D&v+>;>Y6V|OAq&5a~p_{s5&=qSIB zsl)u7(iQO9{vr&>iL)U*5(`83>!PIpPNJy6D@L@4Y<%7NP3>s8`Lz%Xek`EHaxXiQ zA~wLo0=RZ|B#`$$0I^^sNXH`8&WKNLvE|>{kGcp$@?E7n5~3+ITR0#EOl%Y;4O$d7 zLX-GEM`4js?^d=fQHhYRehvE(9AGK7XXtDsjFcJ)lKA{c7~M4zMt6;b4U$Ger%c#L z*!XEAba=pPj6@g!E@#zgs+`ePhFez}KCLSllURtjxZ|+zpat`hymAP8hbC(n`oGW~s_>_`RSRSB}e1#-|q(b{KBKnhV$bkrw1S8-&ar?FO zH%1@va*=zg^3}FE`ioSa{x&u%ybuigaT{QHd?EcsC6ffBq$I(}F8UjhMSmM3(cgqb zl3-je`rBY#UlK$n`p4z6`bm{bx&rm0t~5+`W7vC&^|dr=QQcrmARs9ql#$cpC_ojZ zi}6p7qd@5v239F!@|3Az8Hq*I`1{0X<|`-BdpnSND+NeAxkDACnSJ(1!gdXhGW|uE z*mz@esx917X^jH({`t6jk#DH+?L_ixauoLJs9@A=j{1}|-pY2Suh?fwOeC#a(wsUr zmO_LA7nKsDmWe5i?K8|xr&ct_N9dJ?YfY|`!pC`Ve?xOptn2JcT#2DUmL6=1QzLl8 zWXdQPa(n0lq!Gh*?!tfbn8^u47(P3t!BwFFF`RBZ3;6^cJ4`{l9NcPHD5XQ# zt}u7CzF6X0>N`@Jls~K{b^od0i};xSTQ{g4)LzvQVrE9_b3u*lQp=3l(ehh2NBus* zXd`xJH%ZUVNqMCHXqvxFK1Q|6=f$AUE zA0`&WoBUyYyaso?s;n&43SY*tFN{w?9Bq<8FKL>p+TpdCNlXaH@|Z%aIFquba16%L zy6|@Cl4&hF`L4V@sB_-xqaJK!!G(a8eCgFiy0u+{G3I@Eru@*#R%IYzBv>BO931f` zNgH43K68NZE365aCw!RYc72!yJ!<9GX}5)xsqq8TNga=@Oa%ap@#zH4G~_ceXwiTV zU#u})$mg+ug&_#+@XeYX!UdgeupbpJGlt7f!$skW5}8opK_P=4wF(ai88rX(klEHn z22rzf$^vo1CsPi^A}KlB2I*j|Y&?`T-C#k5U5XZ+@x%@__KN1{Gpq2F5^*nRz-S)s zV%SzkojCt-MuS~9zsSzZ73Ns^5n1c|k*|Hy#ZNL}o6}=et#qu!oo&pf=&=OnOJ-ha zby2&<8i6RuUqyZ7Q&ND`Z}Naw%dwte_eVrn)x~}b5Vmgu%TaOLcDXV91wGd{`w)B% zZnzUIrIck=C3wK;eH}h6u4nJsMIFA^U7aM+m8X<+37newc}d0X+~u|{gvTPw96Wtt zXAWL+O&e9(06fj`)wltg;Y^e(I;QOe=l$cC7!uZauEx`D<2_xdxTkixotx( z%f8IDt!KXNdKVu(OBdjyXY|>S8W2*oU2gH@Zrpdna2;Yj#ukGr9!TMTsr^W*wchx5;R^wrIaFV1n+#=&`fTtCKpGg%%JG?NxDv1G zlTZMz6r^8k;?1KW?GTNHR%bu^ytu9Iabvr2c{z%VGEl1Gej~=feOY7ucb2&AI*eDK ztj@qo=K-k#WMGfm1`rRf1P*)g;MG@uJCYIUHd^C$@gBExVfg^3tPPQDv#R7lMoy+$ zzJqACK9ZPJ*GICCe5VZ`N8W+aOhxLJe%-j;NS9Y_!rdkb+>XY8mYfX*qc`TABI&F9 zBP1!&_;B1k^*%$OEQ~t91;OU@2c$+JJEsdLHZ{s7*m2D4NC(Qt+I6QxrTjTm#8xsA zS}AUaHrbFGdJB+{%_@<|8c+4&z-~-w2u>$t>ZsQ9=KN-Vm#TB^Zm{#OI2Dvbtq{Gk zUCvKay9&sDfuI8D!bQ8Zk72IidSkm!nI|4X=S#20Z-keNRV2uL8%3fum=v#v!4qow zd#9bqZsR3a5wQ4YrqcAw3WSQPwlh3Pd1{4)%aV0?6 zX#`a{K@U+2pARgmWKH5RNqB7K!u0DFY3E1f?&tsq4Ap&7$_f(0qu|c;IT=fcAh={R za4$vo+9HhNZaS5;|8exo8n#nBNa2dxW4kBT@O_B)(;TK-t#baUwF+fey0%vBQ&&6H zPVSo?29!1*XQt4TJ;ID? z!d@G#o}xr#ACST`Ss#55jp2c)P1|-bpY)?5{a$Ji5@E}RQpv69Rc2x^K#*O0!$C(C z<0gGK(lS))j4x`LgcR>qA5aT86jJZvHSjAtwoZ*4o=aOz1t(WiIB9%nhBC!z49*Vq>H6YxShxM_VNnrg+?lPL0qmQOB{1 zwkN8aevbDtYC@r<3KK89M9Vg3^5IFV*&)iyy!2Zc8at*|ks@h&rIlATA+-`l#dVAa z5jHxbT=GP@Q{i?Fl2= zlHo&m+Gk)5SnF&()!`peE4B=IC5peQr72Kn7ip`?z%i0K3L+7oFf4ltln{J+Z+ZG9 zDxM0$CMAFHF5lJsOgFyvgUnVvzb%jdnrFeSPYC`sildNcyH#KB5z@26`z zi(eE@#-L_g^vhSG51YjQa={Uj)saG<`nC_Qx1LV$<+YNB7~QQJT_9@_v*aux%Xt_O zt3-gIWXlf4ggh`IrWZ0J;OdA>u29)HgN-?%Y^<_)WRsk~)rvLdYDiR}1W>d~hqx*R z!`jo(gEUHk*nNx2ktPiII=;MY2D5c5s$&uvcR08RE{#2W6*?td-6|&gJ)_JkFU4t+j z62PcdWS*^?iGbWgDK`AKoShH~eaYM@u)PAKvh{ z$v!^1@%hTW)>3WO*>PMLe!lYb-qua12o93lYF}efl&C?khG4TnSgxP0HBm-{n2NMz z=YI@QWRN0FUU7I|1Nd|MhCXET8J22_o8HIBq6+tNaw_2Ol9-S16oH|_^MCbwe`zM; zLpoTs7}-ltRSM_V#U#NZtoBqd0g*cS7!t5vYqQkFI%lNB8C)sk8Kfbun_~=%26?GO z4&~kk;p9AGolm?}XNsGj%oMKRuD(8M!4ZVBkk} z7CG*if#B>)ThFl{oX=r)&3@Dcf?}+_krZToLas!}BdSZaqquZ3LnOk0T*FQUTxDlr zxA~YC>Q*RY*Ug+81&A3M38uJ85xH5;IBB}ieMX-?ywPLCx~zr2pn9?ve?B@iLai0~7vgbnzSN`HBSYlYL zfhl`#kwcn8oPq>fNP1w@=Qamb+%#IBxB17y2$0mw0CT{fjmPm=+j6Gx z_H2I?^qGzo6690PcEI;Rb?HXtBGj3-?g4Iq(YcX7P8mo(*HdMO z1qJg@@NKuxeuf=b{Cr!~k1fO(8RsajPf$|x9fT08LH9mE9x*_wv)qp7G$hTuTPD#=R zKyv8h*RXQ%U3i3#SKEo3;3 z3><3O!lnKstrP5I=o7D(!}9JSni4EFDilF{1_-UMW5vnO$<%;3s_Bx3rq$$!*a;7{ zva+7`7%OY{1NDdO9FwDB=YVlqt$rcLZspJ%+;WUEzVqG>6NEkLGJAI!Qb@1uRe`Di zy9CkZOgPw5htbb78AE)H3tfw%(~=1V6P#0+hQJ$e>^>Eg2Gb_ISpJ1-d7~czeyWG| zn`@qnjp}hZhuFtBaela`es=W5xyeZiIMghsTM=YGr4B8-Nm(6HEF!SF8$H~8l`)Jo z#Jm@R&?+bxbG1G3|i0bA-X zRB*!Mor4g*QC;GOZRRAvM%*?oak*LPIHDSQSTT{% z2xMq-mxZO=U2$A**78UVK#%KAIe>Ixg*p|>j-G{ErC_Z2y9Ez)xu$|;wrHG7f9EH2 zig3l3$4^~ce&UX=<1jF%qJ)*n#c>GmsFD@Tzp-hhG02u$xU>B(;B9{aY`!u9)&%XZ zkZZLCUB)|Q!w{>@<>w*<=DHlzf#Prjc*wze>EF>=Z0M}3MQ5pp&icQgV=gw;qrF76 z6-g<%CWQ34N96=@g{ZqoR7OuNCMHQ<{6?-tfj-e>mKnFKXY$F+AX_2{>X50GHUwZS z?`{$}(L1=GbG}_iacitENTW>;SQtmlUZ#sp!q8tPda#-aDaMj2C%3zLpL_!2w|mEF zjI%Om1~qFw2zrdO7wNc{D?k@SBWzgpJ;fKY!rYdH=F_hBzU54}kr>G zfJ!z7k0I9sA0&||S|wsZ^)EQi`x}l`b#XL?W8O|l`WyyhfmIBt{=*|^SP=>kU2L`M z3@7E$a}+aNfi~n)ar@So~j15+C(X8RTh%;rM1jV zkEro(eaf&N1&L;azam+79)q~jpUmOBC`>Z0_T!X*Mv-i99m|INGXwpAZ19JoR>{89 zkKe(Fwm7Jk?BT6M3a!c8YBu6nF8s*h7&uSkp>@Y%26FRr6PbfH$DblMrjMK8y&rHI z^WH=)qPh=h7kYk`kp>V4kb`KiDORKzeKk=*hCYU1^CAG5Ya$>lZD>+pl0%rxrdy+E` zcNhZ@aoWtM6V25}q=tNG(q(Lqt<8UnN!oRmpDbF;cYHlN`LH`&O>R)#T+`*=qKn)6 z2m|P6-<$Mh$gSs@<*a+MZk5b_Rqa{DeR(pj9=xNckmtnl+)~3?^k~?Vg);$$Ix++e zE$Zq4s7lBfwZo_M)vUk_Wip7m?AK85VIAYZS2V2~RuP2>X>Z56Z;KOf)^Hqwv_wO( zfJn!$1L6qMgKkWcZbCG|(|AmABRpFE5Z-VWm`y98RTvXo>dJgZ@`DlTj&fIShSM4K zO>xP3j$~lTmCD-tF7u9CjL9N~G;vLSc+Tvk*7$Om_uC>WI6kYQ18 zi9+|jwc*}6J+sklHssWj983kF?bD~F&LC5$5O?IpC=L*^(0!0z!wD?HP(I!vR$7Lt z`;E5{f)jPLViLZX?{p4&IV`=5A5LfOgtVM8nC(X%E7>E9Cvc+`f_407IwUk04(9|@ zuotyL4G$*!<@ncjCtF$3IiFP0%dJc9d+kiIRRQV&fO?3zssGzHf&%2k#U(EL?b>(D%yRTn-ocb3|s0?|A++>lHV zJkCAofo9ZK92zZ6BxFZHO|pg2izuBiJMu*ZtT+md)Xg}bvM>M?Tw(8;IT*pTi}HK-Gh*6F4Lt#GagYsv|n8i03ct){v_Oj#Q;Vn z{Di?3c)@$<18JEjQqcneH`<^ZhjO%0{kh{k3ra~U4=_I4cs8OJR)b^0H4i1pVY0}f zAC6v4qfeRQ1SW?nJ-%$E5vHBXqqg0P)q!wyeIKla^Ib>g23g0#;z0}Yky}~a2dY8l zX&!3>LY)fx+C>P&sL{@38c0EaNxGM?KQG>$DReQ5)9fewGdeUTvUOCNK^#TmuB<1? zay)hbK5Y?ks7{u*Y4sRp{LrW=@g~S=un+e`_)>g6Mad-G=JyBPORfCi0da+2l%|O+ zqZp6M2!lsu1VDdkLtAKh7!4TcO$iVadPG_I^&A?|blw%Ytj$Ud-;BFaOduymPHl}*uVS_s0U-S5s1GSNefV*;sIm}mgjjW4?Phi>g2{2gX;6T2lD7u)5gRLSW z6=CNrq6nM@eI0aLx$_@_S-6S`>E>N4USOYzL!!8uT#21xiT4y9B?L_B1Unv|q<)11 zHiic@F1VFj)t=+ut=fTFtlzTcdy;AhIp_5BD$~j2*nAN3d=?Z1PHH1LI;{ItsXE%N zI-06QOYKW>gN9+JC{5iN>5`BcpF3=#Icu3$iUr(bZwdGIIh`N{08k(R1`5yt)7gX4%0j-i;%87oP8U{#xN`f!n#3-O9DFtAt|6vf#WR7vxxB_rlkdU^Ej5JefueR$Q+NNi_r4QVULg)sLn^! zhZ~ISVp>lYQLmzYw3L8H_Isnel`X>OUG}ZRz+7Hem-ssOF3J}$^1GxJWgt%xmezLx zNaHdTB#t(QO7Uo{)Rjeys0jv3u^X2$%j&WgiK1H2 z2O#WW>=5TdA|O|AH6Urj7-qh8G=DIH0qg||lY*8G3c}RvbiIxuXAIG5CnJi< zpT`fbY}!z5ywU>7VC^H7n*xErwb6_*`IS#yH>+c1axj0#O;ZVM)Y5U~3^s?e_FRdc zh{_LCU6UNeg7mfFAgk1@I!ER2{Nft2D%aBqDjJxBw#(mI?mhgDk~G>%203O|tK7aK z%)?;*!at54ZK!N3kWIy4K@)AK#J`#p2w?DrWI z6aS!~7a`&1v_%dneC$3avBWv47_;^zC!Sk>$G=2f8W?ol^@898IEWCnWZW};XX#8b zaE5xI#)+CxgLfykgiM6Z`FZK<#b)cezmg#_92j)`{fNVGVhN}tnp{SxM}Q>F5f~KW zY9G{dn--*LdV%uvo2sUWyhSJ1ZJLD$a@}KJCP0bIlo^)drRH=g9yCx>iEC#iOb%uJ zpl(rs+{Ey?RJRNCg5!-|!mICOZWbeyLB&ynsK@aMpZaTW>R@pb1qS^kXJQnF;1+>y zL5(K0OW>LzFbES&VkffV9}mGKor;`_{xbjYPVp#Fdr_n18DWyrN7w$@AZ%kX4C|Q7 zht@J`kGFF);H`LWuo%xNUdb^m<0Gy%!RbSAyO$Z`A~Iwq;PsU-)0GIQkHi};VIr|q zJt^#H*DUUgHNztl!0T7gX$x9S)ar&x1)T#Ui^FUh4%j&Wo&ly^{#v(VT3kbf@N45u@5Q>%F_p)MU|51}B{zbP^yCRR(qDYvo<;ftGNPbA)4G z=~OeFoTi#r>i~3_OyQtPQ_8;v!Q}LAbw)UPV0}L@n+P1`HE)U5>D$q@r*F&hQl(fK zvWq2v{2Z?uP~n|?O`Im|D#m*mMsa$3V(n6G0wS4}I&*OBYEFhFr=uEdOJ1B7eA@Bd z9w$1tkjJl=8ief`J>q(uJ;i8~6NoHYYhxJd@g`8vQu+?z z+8Y_6h?eB4J&;bdIkE##P*lX+VvCzChcj{z5{gb)iKbw>W}b5vh=Su4Q2u{DkQfk}B95rQ# zb6${_movF6Z%rUUIN&=rw!lg3o;nuoy!xOjW;{EF?*hXY4>7D`h*9YxLu;{Iu5KN| zq|!3tB&KUHr(9q>XMvQzRe`!dS^5NlJ<3Zg39Ti^K{!W#dQKTU26T^Q#05;()CIcN zGVk-(1^Sld-KV@-4>X{}ya4nAogR1$XpLpuuZ(N!0)5poZ#fR=TFZ;WlYWT+U1#}- z;K6jN<&A2~cu*O&MpoPW<(7HnaX@iw(|r7++9c&+%B%uR7o))vydCnc5Om6H^vZa0rASEYfp%^g-G>BttU>Z__VN;q5fO{w zLJmh87)!$;X4Qu2SeIo-Nysd$!p!)nkmI&#m>P;_->x;H%N6@)JbsxA+G*R#cOPUE z+P#!_rScNCB~sppKH_;l{TayA!)t6e7x6AG;<*Vb#+rlCk~N1Y!Ca>D%z>3G1B}gU zkF~}`C*AmcdCf^71R{C|*o3_Ac@YI0Fkg79~Mk`UQCF36zxj?Bx#xG%% z8WqiRcW&)2C>OGP4xwuqFI384xS%x78YqvPHo&^Bm4pRRt{Hc1TZP@Y7sa%Xan-$X zuXbET1G_iwiA88~pqslT0vDB-5)Ne?lnH19p>b(<_d7#-FJ3Bm&#qw&y3694KpEp} z_${teOm{^=UGw*GDWYCaqfc3KaIbHm7LUWoMcWw5Q4KJO%u4v6()+>9M|QCj1W`S# zF1qEtgQ--G+Z-tsmIba8GLA`bjBc9OIb*H_*H+?g)gg04bTvD%L0#%bT&OGf>;a;q z-vhm-hZ&(=IrmN((+yxWZ8(Whke>0b;Ijv|hv709)i$Tli*l(8pbt@|VTuKa+-Yhd z1uX5lcbaktMzzc--BLn0q`8Palb8DHOrPLYx~q0G4&KGB4cyCzDzUW?Fd%Xw@wivH)C4*1khuK=rt4xV$anO0q-3P~1kI4+dP&B|cEz!&c7+uj$awp$) zih|(5BGn+9MXkI}H8CY|bq;o_OcoiEi^;_xr~#W4a|UI`{4|NXid-<&0!O2kYOz%~ zSlmvaolkpl4ISIMW{w=Ywu#UnDitHN6v*8HQ1$oJ*AD^|VOK9J6ySk^wXiL}bLZT; zMt~t_fm+M0>h?GpIJ98tTw7`6ic__VQA5qbwiMuY`jc9>aX7MMhYEF-XYX!p`J*y3 zCD|lLWnjRh`V)?n*P@P5!|pPYVzMcq5%*6OmSLyTf0Am{GNM|K(RcK(j5*T~eA{FE z;8TadnNFpaB8YahDV+tPMX{l;Cp1s)X{RMc^Rtt0mfE<*t7aCBtgVI?u}k%OwG8N6 ztPe4LIVi`=eZ5N(h4(0k;#i|?S0svx&L&(!9s(^zM1@+}z(vWm9!{%0oK{9~ z60aTm2X?XCT;cOa2V(+J7D1&b1;11Ecg|VwSJz|Z1HQ)mzl6vT;_3!oDHg)--1PTi z1Vm5_yPaYLL|D5Bh_KTP++a7qGw<)k2)&?KjTPJD72B<1I5E8dJm;3b7u#pWuMaY6 zrr4st7h7z_Fxn|r?G;<9VrEz!HLeX0@VJ%;R-pWYB##w=u=wF7iE&*?G~V(eSB<%- z2ygVUvmI5YZh;8fTU;wMgh)I+7kRi`&lSZff#DIJ*N&;XGSPGwE7h(9$xc3R1HtgMXcEzvOV8I>vQ#qZqxcS;faLM_C1v;q!Qto6E- zIGEUo9>t=^&8fI+wW>8MwDp|U=eMjlu7O4oh0XkfxCt=PGgO4lUr)Q%tgdRWE`n&> zbM!z|;Ut9G{~ggPE59emwlp&b7I=l{)j`zeKHk^@ij1V7`;Uk!Qt*F3beizoCyN3+ zt*T0|su{ItN+%u?=jzL9aR}*JIg{fQqjUVSqED;7#8@s2dXC932B=>PoqoA871#Z# zPkUy4&KgD=pHuDcGubXc@u?rx%{zlh0eZt94h*nWD0$y2!gy7K&bz_BS{lbS!|R~j zgjMsSQn|)= z^aI08W%q0Xf2kEv9`x*A^U!X!$NAtXR3>e4;m`8B@X5}LIv{&;`V9sjklqCaAE_?q z=5&g>4UjJwsH#`Z6ry!s_qJs+k&tV>0pjd=I+~sBk-9&%BeV@wUev8SNnT#|*W=W> zj6Mkmtd&et=(-Q(ee*G(Mk;Y1%vo;}n|D7{dO%UHWtK6%~^HMQ9I0GGYDhR=-6S{{^? zxp-+hK$V7jzzh<|U^OzgS{{?&^1#~xOlTJzC{uijvKRqu@q?XBQP!utpc}30)X-vB zNl5ajnmg{TD%ET6OC+jZbXEsD;x1TEJG(_7+}_NGbwjd6zWnE;1bw)-eR1>=IO7cGun{TAcVe)7gLWqog1btni<&v zlpq8^(Zqx4mGzn@siKBRSJ6cfwmK%^?L;?9WdWP1;+d7iJEt&bkcVxt1)&|XP-j+7 znEMg$s1z5ar38jrinGwtm0r4()bqf*+nHROSaH4B#p*uypXMP&$qCL3Eq^6AgtGBZ z`$^(@CD(6BT5mv0b>iff%y1Hzr6O!HGaSu>91FpV*I695sy=tLjCXDYYd<->!JmyF zk>RqMY_N(Sl|Z`Gk9Qor8Ecjc?^slqJNbn#2&*Sr;ugWRF_iQc#DSrxE?9RIWwRCF z7(sz%yPVN_!d;(UT<5Dc!Z_Nz9|DW?bBJUPRcO=?xTMp(&-yYE{SI^^x1ZCTHR7oJaVNAG zOgo~5^&6d=Vvw1a{v%|0Ljc*zg>3#zLDZot(zGsuJYcx+duM_GvId&Kv6Bc$WCEi5ivpHWzWKJb-+X1stwnI}gW)SWf$gQ-~iM5Ti59*^ajJjqC- z*%;I;Lnz9``p|^Zrf>X~Q2s@Hw)oXth1qHhGMI09Fqy}>cAE=Hoa*fJ8vPdz6)O7- zQk8Ys0S^R|Gt3>s>Y%nS*8_E=oX9urrtAljB>J%atyu7gys!7F`3HGlZ`B+!lGb?D zY^>9I#qi^lb5b#1bRU zl6Z%U!+osZdaDzsk|~PIH#ufDIbt{+B7f!$v-EY=?EJ1(GxF=r3CHH=RLxHE8^1jL zPE4`WuwuMp$WXEcuN6zqe_dzI9ta&1X_ePTzg)vn<{HM(-uDpho4L`UQ+x@%%?GXK z4Rj|UY7Pob9~i(71N+ZISQJ-~kD+o6FJMZ4*q0w&$>q#fUwZ+zBvwhnS3y9rJW3!$ zxpUyUXf<2=GJ#DaxRJn7=b+fMuI$gBa;=&ea|zP~AJ1d+qX$7eDq2x$rUC*85!dAV zXA!$H41r`+ut+zGCxN4nM>NUY`oaiN(~u1Ky*^!k;GT%nP$m5d;>JTpI%e;{KWHWqGXnfavrq+3^D=>zQT*`5c_r{)ZCEjZVf z?0+mfXwmO))#e3heD{W|K{hiR*{@SWdmjdF4{I81nHUbZx!tydnhZMzJ?sPQkPy~! z1V_5Y!!hRXII0;2s=te=+VWTAcpva=bP0?tJ9{LL&G&I(H%H%@>9y7$S+;N&SD<+v z(Lf2($s9BIkD@`)feA*0|Lcea+>#$V$CZTW{Jg5!E9fgJ##%-<(9sbdKkA<)9+v>a zUImJmHL^83>MxK}W^TJV+8QifDi5BOO zbVp7Ewr{@i^!LmpWx-VHYY(htV?qOgXlROrnVX0p#)>c0l?wCkPt3h_c?>E*UR9ky zM%2tNb_y3Gu5`GD50`5w#_TVK;3amDlbfR8E>{8I8M?%5zA!df5tp&JdXenz4-q#~ zRXy3i{I1hpve9ID;PhCR)ER~z8I+mAA!>$WLB=?XCng9?+h`bw;?viWMK%{?WhWvM z!r7f&xkAChhPDGm+68^0C{KNy)lmzCUSNm2hTB+^CmpbfYImDxxcF&eh@QZ%jdw}G zkwif^lUl1c9ua`5=mKd^YW23=#(A35B!wZSPaTo4^)}Rkzbb$6)_0y>xbLp@H_k-S zBXr{NR#nNtbBu(+V|TfnWAbT>f^%!VLd?5^Vl!rhs2PQw$)rLeNb2=9{S?smfKAHd zCE)ONPlTqP9mNN6%!5J79^+Wv!qbeh=ZO!wE+-uC-g8J5gg#;1!;*}}j@_P1f-Aq& z{O528FKEB^VJL&`%b>c+7T_vEV=ZY=kUfsf_MXf%)OuF^%tYOf)gPu4>Z((a)%;d^ zIbaIeRjvNgIvUeT*oafBR^gPts8!yhxik(la)pCplt@*ULOiN+XO!Ym;R-Qe2YA+u z14*mBvB#)Y@#sx{+yJftKu|7ZM+#e!pqHC^Q$tpYv^h73;t+>0vWTrTGQmsc%OO~c z?{tIP5+1VnD(le-lATgKgLHg>J=hGuH%t*-d8CD07nenTcU`-7q1bRiW7omOU1-zN zt)S8i5nLEkJNY=~$wdj+iq4|1oQ6d4Nu3BQclzcw$I3^r64TbfDo_WjHL-zu?gBO= zfoazKKu#dCBAk?H&=iA-g(;KElqS^4r-j!LWCUMuO%e-q=%5y2PG5T;*EVQwjBaym zh&45;?(m+XNrZ3H@s2z|tRfPs2zZ^RiInn1ELorCCCJrDKm*-1z zC`ScraHoyTk;yh=gQ6&$BuvPNo9Hh9;)bB#Xp0AcxuOSvV|O*>6M*3V1|T#9F+T=C zzHJu+RyBTpppH2d^}j*ER+0vbpaDdKLgg5R^)1*iKXpbI(5YXyF)E>UqoQ!ZqP~I- z3H-AnQnzPmVn}Kvz*J*j10uyYR2##R#)N*66N?Q1>X6wOG!}4RaR>))M*3OiJbp2a zj5Z@VkIoA9v~w@X$||cnT%(8%8Mjc>eS!;uDwA}CO8}0*;%)DmvL0jb;H=1l2!A+X z9Yn9O#qC*okS1sY4X(a_U`^VgIXuIWvZ0lWLXW}2Y6NT=FOB9+c})6jrX$0KInB4; zS;(o8Xpy|`0kI`WMRM$j$j4?PIcatV+?q0aDFN!Gmz z9-Yu6@$uAPQ+fp_eB0CpX3rZ9~k_khQjzS3WRZHt4YY3-B{YcEi zG@PMK0L94Y-M)5!uFPS|wvm;k&0R6tJ>{f2VWT9XNklhAG(Ze*H#uwApqCVjUE;#0XYf&kIoO~{FR(q z!529VkV{VK!H9NA)-5~O0p>Fn4Ip$tq>hp?54((4`~suX026Q=JIVE&IoF%797*_* z&8wR6&^{50Vpy87lamw1_tJTK&>Jw0Y*8dj+ACSxx`R`kQ?vp!XSTtS2PEjsb$@8v zIogX7^_-Vkc;e6^pdvAh^R+vb1Pr{K7iab%vw}|R5!pDIh()=snIay`jlEbWw+<$Y zjLMFge)N)S=_+=ItxDt$gjV_Kf><=PBE8*jkz90{c3HT&-0ht)7N#sBB+$#I86yjf zE|XD4C(pTM>hx-~jdls6Ye!$#5?~Dd-%Ws^OmY_{edXW_d z9@1~byThJR5~wP(dcaEzjV&QTu;{UO|F5_gj9m_IbY`na&qaBoF0^DQOxsDu=7PJjy$Lr;rqu|xqW zwWHrY=O+M|G&8Pwb$)tspyA9ox!%^Yp5qD}3xfFigHDZxb7#M;=a{`KqBbH%#yuP_ zsL&zUScg0U{50t^LppOj8JPu{LJ*H=d=N z)ZMMgSS32(pf|^jMy;vB@|>JhU&z?MnGXNLv08&eIkoQFl4(2}zr#(dR)nKlPG*dY z)ublqY@HSD?3l&%J1w0pBuxe;b6hJLgoTQrEqvgCz>sI<2o1|ouI8pj+YCqlk_=Oy zb62QXDX66^chD!^Qe>6*2lWJ3eY1R2LCbKH*__Wx^Rxg>@3q8jVdIdt^TgZou)~R3 za>VCXSMpyJC&TbVsstdGZV7}N<5@JwtjXcIr!1!qh-NHD(oikb!~e2>8eg?SYyUw< z@jo7=MAQB)Il+#9w9OYU3s*xG{U(lAGiQW+ydu zu2rwH=@;VydhHIllot#1pe1-;MDzIG76BCNG}d8x!TiN)69cxjiDI;=vG&Qh=yME0 zxbgJlCfffKPf!L3Hp%}L?`y*ub9AgNtF6r0H60;D9J5i6us)oZ_C*yt&)hs4nm4YX z%i)aBgMO$&*BtQUGPV=?5m9bOhlp*1`#98w*HO-R3*m8cd%MeLoL?aGZ#id`@iMn} zDQjBH#PQQ{{A!pB(6x3HvnIK56&@4#l4yjc`7`rph8xepwM=kAxXCObs-<7o9mOnA zLf#na)-&pIsNMN3lbc+~z(eZ>CDSO^B@l4rnc}DG6euM_Q%y!}^akXMGy77a9<1)a z!1ZUj4!PN`6uCXz)QVFb6EV%oLl2=WSn9+;C{m2uKli|jWafw>Djd5AJT$~ddPJrL zJrFAsneStgql=i6K}M;U*rIZ5a|&uHM+-Tz)Nj49c-v2$TIlsgAoQ@;8=L}ntT*<^ zMgqGJP!aS7P8an?fI}VKn5w8X5S;UO=nnZ>ThSewb-4Qhf3|se2ZqPC* z!K9uY=16@5mS5zRvA$>^EhHC|`a*)&K$lK&p$uJtZ^jzaldgz4))mB`$}1-SjJhI0 zJzzl73P_SGX#n^hgx4+(3mFm?HQasf--jtCSfjxXq})|r}!HEVDt);md^ zwZ}9F!I7RaQBp1Tkcr)RAZy*g@Bk^18Arg_i^G-HaduA zq=zuFtHs>5^c-zb2Xq=!InhNL!(d9yYg{3;y&5VYa{}WQC&VN`9EqUmt*mN~Sy0HD zw18!lb8;`?Nw0;LX_RUuN1qEKiYI&(4wzDwd1RkR=KC$Phc?Ac9`CmW1gnisiq)cd ztQ#*Or6aau1_Z{*aZXlG8KX?&+}UL;9DpO@kr=v=b`+6`j&wcAVZDrVGBM%QGA2O~ zMlEyOWlavy7;}TY5^x|jSy2HN&J!DYK!yVX!a6IulE4bSS8AF-dPF)~dPNG^FNHia z0d0vFsF}#2Lk55@t>27unwm!RyrJ~sT~`-_d*ceiEW{!hF>#iCF~~Gq0WqSGSZ&m< zmfQrh2rW!HLEw1br0#nH95|3Mix7MrcWnU-O^?0L3QXgSGLW4C1%X!St?X@4HCD@m zR?AMSrEPGFTZ@)Oo78#zs#Vf9xZbTq%b4gna8zlFrv!T2;7T2cMlI`z;fRGTJVnD^ zwaNoAz0l~fTx1qz+B6yM#o7eIOJ|MMIMWRIo>`V0gQ^L~N$GRsnZ9d0v4TQ`Z-Q9Gizl*lA4T+g4@%16wlAM& zXfQ4FbFPRspZnlyL{KJ%tMg3Ofr|l*P2nn=vt)g{p!Nq~51-RkT2AVV2p`mrbi-LX z9>eFHp*MVE?q;Rjig|(IjzLJxSSZ_lJ?WCyeQs#J&pFfcdB*Zo%9A=w7uX&HG7B>2 zMIBdxhqa4mm~$CC42e{r9!^IyPZZq6+~G{u($jRq#oLLI$CuL`%u#zV;IR4y&1d!? zz7dUI51U<@UxQx&HEUEPZUBcKp|v6b6xAvM31>ffWTk7yCx@s2PsaftQH?-+ja18N zZ+XAJ^nP>b1U#A4K$=J`5hV7&Yh1GRGuDIX{^)Q53k*bec$0Q&uVTbge;Egb)C#84 zXcFE2Wih|Cu;2}?Eple>KfvN%5!)+cu#AhsE-WoU3KpzNP?D3{Gu*H=xgk_!SG%~O zfwUu?syP5kK%A7?gLhKM1ZT+7wkRcyhEkz44h34<20M0rsWnGo;~?J;qclR|1qujr zFD4>Bqm!>%&{EuBA`RDn0hS`&&UPGR4-5p%JgAD)aR=R?f}W5U6_gH%P%>8q*`Y&; zZY~zOZAj87aUqt&I=V6_+odSUh9ZSB`Vt~yP#rWeh%ozKq(B{tQnC3DNCN|AR8Nc3 zjREoCwfD6#Padv1rXS&G#kvH;i8d7>gbqKh7e`+Nls2^cnK)8~O zs?Hyl%%R_{x>e>{@ghiT<-zqOF+CUQcF3x%$ zbMb^fgYMe(9$#cGOh8&>-o`O5k*|ck)iJ;{n&Ou15^>zR7v8CF3=^F_lItpnXrrp3 z1AD;&>T*AINBmZ)+9k&u-O|B8?7Lw6JA#OG>mWxxrak-A}@*YS7=?(edj73~m7(DMBz!_mBIfB57 zrKnghK++>tq@9~5^4{2?Uj$wo93k#B(*l5mfv*;WkU(ALVlXUHqNy;j;Xo9B9OGR6 zWZUT)q^;tX&!YpJULtSETNu2479w%ephx_q)hs~}E~0xc%$b-lHo>d z1~ve^KT{{SKq~nH@k4R84a7kvm9kM*BB2qHz0@EBmwV|_zq*_p$9QDRs%ZQtKxHbm zl3kEdCn;p;Ri;qp3inF|00FF&V3}A&)uhhN4`OU~@OsxUK$EPH9b)&%&f z5Y%Js=jsY;CVSrf&O)_+IA7F$c5kZvLrC~F&~1M&UNVNL>aM(?87L{yHRRT}K2%|fE02#8B|X=br|WDP*aSeDfUJRT1h2tM>QQI&gRa9; zoWaH64;z<(KlBPcWwPjZ4pv8=u11AC<2_yc&_6w0dv}!h6bNufX%}lWMia&_8!iuP=)(}x)K=r0q5zqW)8i6)5;l*Rn2b;J`7i+(w~B19jyYX? zItIf$y69$E35;pVf|3S5>FYlPUv`uF1F`lwAKPGithN}{ZZ*c#)~Jyp@ITZT2B1v3 zI0v7k{MX0T_lec#Eh+h(ohyt!m~_&2@DQg=ij~4{qG%1#PS#4M`$$Vp{A%MSM1bg5 zQ+P^qb+nDsfK5u?^03H*F3Q&MVnGc05~UGTCw?Jfp69q7Q252tVrV_sPS#~MaI^~3 zgbmi0kypsGq_ztQcrt8@6powE9Wbyf$>g3!`CgJgq;2jrzfP-mZ)h*uBMN0X-&P$gnB^Occz}V(Jou`!F>%Fwv zOBX05_p6qBr}wnROILd7V#~9Ry{S-BSO3}wXaHaJvV7pBt8p5NspY7QRabEirmNv( z@X=U0js|DC)mGcxBnMR%HL%}H_bLUc<%ZND@9A!(G~s}k?(@<;r0sopq~hrtT~0<< z+1BV-VRGa!SP;=FLD=&&*=(LKmY@eUD(6Xe7GS zQ^v%&1lkq_%0|BsM@tI(EzEG;2OjpELO{>#6gs5al+ucAc6QYV-qTl=g8W-vx`p19 zx(wobXT(GWagRI8NhkGnm>KD)+{$b_LRM6ME5OL=b50lXWQLgNe`$QC^YvhJX)wDa zQ!t{O69t1cg38LZEd>L)@EU;4dQ2Xfj=9vRQG+64Srd?|*j-BxuHi6tn&S=8Vb1`l z;&+f&HY&5OW}~)dGT!^Tc9Vr$1lCZuId_X$mMzj^6Ls?G zd@p7s8gS9``|M5;9_@><*{IL?F|r7Z0`W%W10XFE2Cbz)M6Hbcf}3iO#xa&1AVRdW zhZIThd>z(N91uo}52<5F531$SZ8-^ys6;V^JIJ`C5@3QNU{2-chkG_mENr5{AOo;K z>vfA)F;dTyLj#kzN-2eA>kW$@$B4bss$LYUdc-rUJz}429aCG|VgZQMw$#lX3_WKf zzP)HFoT@Ds17orb39;nzSPw0}ulA5w>7{E)o$9*CR2wquYLQufJTeB9YBpLmM3iVk zxL&zs*~z9B6W1CdwSp(HYfF2~y!M7{dS#|-IqHpT*hQv_cHPf065(=1Y}Tq*pt-!P zFrDb_ii~rD^oz^h8kkH8{*!g;sRc6;HHx(l$13_P_P8NL1E-cN3?7QK19Yd(Bc`6# ztIzqxT7?w9Fk)3m@>wZYJ(@@BGNuI8<~lZO#8{PH`ey_@b5!f=f319x5unDaoYUc` zd}E!;<+T1=H+3DEc$b$_jHj`eph?xV%B#=DH}&< z@c~!ON(adbt)1s1V5%;nO!oN2n5%`Y@%LUcBkEWVR@j|ip-Qv}R;O!EWWJ)Gsx;J| z<(yrscCGSjnHE*5{qOY{730m<%2>>IZlU8`p$KQ3Xg92Z%;_Q-ZbYK{`O^+viKXeZ zqX4c4oSYU!w>qdJFO%d>1!bloB90Cd#I}qhNsxW26;_THz%8DLs&yK%^2y59fXT^? zJNeoIhfEw!VJU~eS-R5uEl;7|SIZAd;BpfZ<}wXQ+Kf*khz6u$lIp=8#FW}`j)ZL3 zc@UuIDY&-;1MGCVi?s_BYxJG;RWH>MF4%!s$Du57>uhbHVyQQUnR+r8TZE`Ea^_PL zCxGEhd7f7bUwWLg-R$=k!Q;1%O`)!2b)=3QQT;kkM5&H7akuokbx0#tJ5@%Ob3*Sv{DFamyPP+ zm^cGh<)w!_Na17#mLqDoKg^I6ZW_{cCdrH|DN>2Jiy9jnMJ99{GY1@@Lz8v=glgg< z8zTWHSlXdt$P&(w225`Pk|maMAT7yQnvG0MN?>?pNsdNn1_OY#9-x&Tpw-^*J$g?? z>+~DiSbl!9!JO$5b;Ofuq{2vIq)NmeZkmT2EePb?UG08L)CKOVnyQ7d9ztkx?b^freu&cuZp>xAnOjezK$A->zntJ!zbH%!? zlb0t2BgKi614W!y$3tO#CDgMPj-pZ7_Ns+>fs~cq(>+u`L6L^gUPDYBLp$~fJNVCL z@(yE{BcDjTHwx8O9p4i+#C_aDk@{NIt_Sm@gmhrCxJh3KfW|x#aM9mO4=UyPfhcLn zT6aoc@YAFRsQ<&n2w|v)NZ63!P7;K@%o?B{A)Hx1Lb@pht!wLj!bftVespDooU`E? z)nAGI0YJh>T#!M|kE7jSRO`KopyLjR<}Y%GC#{2tA@@eP;iasDn32#(y&jD>!h)k= zs^-Z=)my-+v-T!z8QK`p@>0&Ap!46{bP+*nt9YV)stHxk_@Tpfl~D<|Mh*9&>iBfy zQ^}{s`&9dUQ7MB)6;APuo>1;9EgW53II`SVSXx?ATIMS$^Re}$xMXBenXg_H8F~~K zj4AVtE9p3zH=*-NOMOvsy(gCVqK5S^A2-1lHTGOfdO4Pa`V~wssVG0MxR6&ZE-Wan zD75co)5}H{6c+8N(+5J zsqkK`VhK}QJxTpTc4Ja!d>5FPJuwc}cBgd3nndG}P}K9`O6l@cAQ5(ZTINafZ)#33+CF?-ThR z;InU#-#0Dj_pKZ3_wA`KeIkIHJq~gM9wO`WGbIZz0$4wklF|n**bYX{qC6p~J z9XYmOqJ0@%FtQLJWyRx078aD27EB*qF>&OCf=Lvr7+GE<=24q{w0Q{l*KPBV>5~d! zb2Zu8Jjr_>$8SHMNSoDGm5uWCFDxHhGRk)@m3JRkI-p`gk8y>?qbeqj6V4L~L2Oi~ zu(&*2GCEuicuM+w3n<%?R5*8OAMVm#U&8h$#r~do>E)MR?jjt%`kKz+Yie7@&&cz> zh0{F=?i3!aYQwaxa9S84RBfdN6OkJG?>Fj8;#+O@kp&YcmXwDl6ciPP&(wcI47rpj zzp0Hn`HG7Tma8c`h(H~}B@?O1df7_l)79s?og{%b3iMDH)`GFV_y_FnqQ2wsay#}P za=PuPA%8Mod#jzjCzhvpHMq>$wgZm}OV$6K!W9z>r%fs;h5qC}M7h&cu57@#;(mn_ z`xi_aBS({OBV6Jt z(+-vlHa>NEX`}bPE-$^xGx3tj`g~=4#3Cc5=6q2QxPmlpv}xfH1*44E&?YR2KtaM- zBgYnwswgfj4Ua1ej~Z82Frv6{RN3^2Bh`K>av|$}D;yQ>Ur}B-jXHe3`Z0drDWs8J zEGQjQA!Z#tuDCEJB}%# z&WR=ANrj~o#+8+gqvuBzP8e8xk+PJdvGJ7jNdss}wv$MJV?L3u@~eie==ttcp+-oF4f=S(Uc zSKPl~dLLN4Pet)`r(#S+S@~deUg3lhg{9|@EH5D$P%_1Sb}t-hDZSzIwdT{AkMy}X z;VwQ;^V!MgCq9k9E0xaxJ`?mQC>~u>Isx7>>R(kdu@F|!qk?iMVPq;B3oCZiE4}Gh z=UMT%5r28ECq~x7jzcc#*r#A3|699CCiX88Ir?t=yq^vLuSHVQ3W#T()#1AiSGMVj${vSxkY({4FqQgMtKhLzk z=rhlIm%{gGKGOY*c&7Ae$|x=O((Al*E2-pJaHD*#J;cwcGJkw=h11Gm0ou=Z(Tk*H z^ysoeo+gef>ppl0j8U#`nL4&`A}@`dVIJ7794!_Gq7&=5ITw#ZP;`Q2Z>f02zAJW>V zriatAI;CcIO3mt!7x^!2Jrbt7!V}IO*x%_tX+pt-(~{`K^06sx+x5@rklrD+UH`PS z4rv`yJF43Syp|g}Ts3Zz9%$S`14w(7mz0Ey(L;qpE*Upk?-A6BNv;Mrg;$ChDCvXy zC?F+RT3RuwJWN&>O8Hfz3d##ACKgRBnL4o!!@_BWS^hvqY8?L^y@xpaK)IBS zGjNpNOPRzA{Jy~+iwjQ4q{4~yeCk3nW5JBlm$-=qnC-sMsBze6qf2;mC45~liM*rC zfQOVkTu*u7xt8=Q(mmj|oA24cFDdIFpm27%;nkwP`@DvHBCYTV^DLFm8GLdvLA#L- z0|voSzC#WCz5{#&Uod?>7pFLzZuk&+goJ#0FBrbi1RHW&kPLw-cx+^?P59j5tmL#=DdFM1iN?b>q9(DAKk> zp05S=G}0}kdcL1jb^q+8fq1{K3-9Zbs!r8&0%;4Lh56{2;E2A;*PTx-9SeI#Zx?4XNM?mg<^KI**T@3D@6ASCg*eb6j0Rut%|Qlu!9T zBHicZQGF5(we3yd&l}+P?eyx~?WKFYdIi^)%AAt?s;fmq+RA4>H1uYg9mF_Sq7zk@ zctLfo_VO&?dqY0zpLIM_dNE~{-a#sU+~uYJ_R_COS3>_^NR_V@sc?OabTQADd%yEY zHv)5lmtN_mqe+{F{Ju@3!b$i>`MNU;ciWH(kL>aAi?l&}ScWY~7Q;V^@@k`Kg#}^t zCh|;p{NTYAj40n=EA&2j+Ia8Pm#SAdm{nI+SXeZ=3@S}69ammBdXxkidDS>U(xF3# ztn{q3^sMaktPGMgeaXq?TSi_gU(@pJab8ZgUS#Ixrt4jLW@cKZy-rVOfL6imwA2i@ zbVh1cT8;}N4cNI%K9w~mJ3TKWFVnzfvOLNzcg5Ov}y6$xBN$MAOpp(o^%&bMvyYQVr>>yzJD>?99xZ91s8W zyxi3EjC2a-WV=mC%gjqnOUtGxz}#l#WM-vi<)%_NkBo*!Mh>maOQm>bc3Pg-*xc;& z?940xq-Uh&Wx4In%SZ!!Ru0*+GIMfW5@gb_Z04>x8L2rr8F?N>!6P>#H9IpSJ1ZkM zJ1-l&jfS)}Eh{5EEjK+o4??76xrD#TWMowN%ZZ5r;mzI;3 zo|lzIl`e5}({l52^D^nz%&gq3?97}jYIW(HmztNEmzk5AmXnhX{nG)GmX+$VOeS>5 z%*n_~&CSiGFVcXLl@np4^z@vJ9C|n_GcyBvKy!!&a&AYYrDbI2s>gHE>7i`M5A}fU zv0YYnZe|8e$jwg8ATC1%Xdp)5TCDUJDab92*j;A8N@J(C3$GBPNfm5~A8 zx?P-^nVFg^*3P98m`=o?bb5AnPC7m2${?bbnF+hYUI<5qNTTu?88AeyCqHRvX{j)O zYI>$*IV(F0!UzJLoST}L>WNhre3O=j7LXw43iIdDP8d_FK^zP>AiB8-P);tIB*T;9G_(lhflc8iV`#J#3L+Dc%E&{@ATF+O z=khI^>|!iq?;J5=Hms0JJyesC?TI{7x4pyP9JeLCc~ziQT=lM7e_waYW#RlyGaKA- zU8CsPUoKf%@MPJ_+gG<9^!w*SW4^qi=9S;>TQKO^yHMp4+{q{^Jj1u9AQ z<)+4gUK?uu_~Ah3ofq{T{%h(pef<;47yo(3l!s=wzalql(}VXpRkxjUZRefaA9}80 z&h@MN#SHo;Yy0JWZp`1Yu->A#zy0CdvL`>UzH0j&H(qxr;kVbm`nGAP^+~-?%s>3? z{l5&DI(5(KC+&QA_&v)S|33PSb;(2TSiClT<6F7c_q=Pp?~k=vLodH_;<};Nk9=a@ z6=mW3PM)@YTCbN4=Tel5Cd{=Uh#SATnQ(w@WP zzklkg2d^ELHuuu*3rDs6U_()ExY@EB{$5)@4`{|-TAAR$rj4mr5ZQHiP zGkcmQoILa9ngh#D>z%OS!`+kTeb|5R6^|X*A6wG$mXy$tTOJ=+aPKc4w%hl5p9h{u zZ~FD*kKeg0xl>%Lv==5uKfY{r+8H;-99-2ae&nVJZ*0E%U(NrV^l01@yFS|Xe7kzr zOuO#6d(ZCw-b1&%7B~Fo=T95(?SX~Y_c(CFfdBpyzy7~xKAv>?ce$qyD_-&WW9#aV ze*EW?R+Xg0wwu`V?f%~_*s^T?hXda@Z~E+ymv6hiI_2pNu|GEavddj}6*k^J^T92p zBOdAf-QZIauleK8J72nT+f@ypZ?bgXzSGX%z43)3PfR_!`s*R{3T}I1>J#;{e?5E0 zs%6dFjQ`=epYPpu^1NV0{aJVX>*O`vi&Dy>`<_6<&_s_ksTep*c|5w_~ zv^zd2J*{Z;H(4pY1|4ZN^M`Y;xoOAu(Z0fS(?1&BdG8gE-qLE#_2Xl^owM_W1>O4G zn|!l0k3}h($UtfN|&8Fepw*z{_u#W zM?ZP=j0XqIUERIsxpQA%xnYEF+0h^SCO`6ivlE+sefW`eXAgg+>(r8`Uw?Sbt*a;B z`)*SI+;t6yZcUyMTJlu$?XUJ4KfK5NgU`J7tb2yctiIR(%Y^(RTf3Kk)Zy@+Md!~B zytE{4@Zmp)HoEQiyc4e)dD^*YHE*1;;o3)sW=*eJHf-bf3(r3A>9EX>HxGTO@6#in z&8nDj`kg0~_z!=#>WTXv=yKYu+gq-Ee)k(MO@E}>6+O1z{Qap@lb3$;`Y9*wzwyoA z6RvDtG3BN^?!W!&(XGequl#L$_T`P6e)oItXHV+(pUN{nfA;#>2T!2< zUBCayx8E7|SWdldX}308wQl!UD_YNq{b9)s30?nu^6s6VFWht6iZQQ`_l?=UebZ-q z+Dy2t-Sb=aY|0<*bMAld<`xsH%6|R&_hAzTPwRGD?`@CWcjNeh70dG;?=|+$1wUUp z^P}LM`Ga1MnLVMs|B9=oFS)g9R_AvgzB=y9Ez_?1`GfaoKDBC8eAR-x`3rD@r}X-!rq`;D2TN)`d;NnxPd$A4M{R!mXi?`M zZ(e)Rky}n4{?@R#XWxrE`?V<-ZGYzS>5aQwKkqAZJuu4eCq@C{H ztatxX=b5{+?hY-RwD#-un@9A0J^0Q@|0^{+H_vO;X3U|JcU+!7^3y%j4|PBC{%upb z-Lp6U=f+2xUA#E^!o&Tu7lmHFcj1%GufDY8oLA4f>hp7-TlC-jr8~ZFw&$6KHxEoJJtJ;Y>g-J^quOL$_~N1En+Bxy+27^M{YzfR{``)qE$3#x zeZ^xi%cuO9kE%Iq6{S+cl!ljnBa_+`hBzBwu5%hStiuKnbq|0GTM;qoo- z9O!!f;$FEW-`u(2k-YNh}4sY4}w^i---neUf@@o|-t&!t{~X{HxRTr)|BV z{QbMqf`O$+FMn*~sL8+H_wLF$NB)=&5qN?U_G(U2pD~Q~l?8VF(TTYmKcra$<)iK*n z9Wr&+(cAKOJ<+`1md+=|z1Xhp&`~p=S=i^klds(HM)-~IrXslXvHL z+c@jfYk&GJw@afgH=nn&*AoLDZFA=plX83B+$`a-i|XC;Nt^f9be=LV=EUzmn*ZT@ zUslGy|4_d#UvIvA$Ig|9=Jsoy^k%;u%dXgX^88@@yT3frddxUq_?4bh&MKTVd)wUd zon?C*-@y;}x9!|@^E;pI+%kK?utC1bp|J<+?U?$n=JAIgTKE0vZu6U7KY82BL!Y~M z+w>i&L%a3*px=+1UtF?l;TNq}UpHg?z)KobuUX&Gw>9_UGnzlp>V~}s8pVD1aOavo zV&3_2=^G;-K6%0keQsUQCv{U*j}G1c_;YT0)PP$qzPrOYQ=08x+ULGM+IGF+^B;fc zw&BfpPdcOfC$G&oc*|E8e}C57DKAxho_fcSU$+lCG4)XS^VdH&?dN&te6r|n|KqK@ zWDgqu@Bh4)o_b5uPA|Q5_ZeGX`KtTw`{#At_{5T`AD^o^bOjOIZNGeWMYD#(f4=iS z2cG$**Uo0;pFY&+^OI{mxhV-Z-i-y=%uuCdQoK=;!NZth?{gO@IE`;OfEgTOJr%`oKK}bKc9o z^2)EY;XXnqBg1^@<0NT+n&u z+lQ0?^Kn`K#dp8j>#MVy-0;Ko8@}E1&RfIJdFkhmuB<<7^rH{1Jbg)Q^l$Uio_hP) z(Dz;M+%{;^%-%hw{`g1h&0jA1ddKreGamloyPLmx=FfNUY52#F1-q8j+**tUAvf=M7U-^C853fA<@r{?9{^Kj3E@6-B(f_C0zx`zIz#b$OLJ_<8=5GoE<((5%4Z z9(nles}^m)a!}VxuE~mto4dYk)#z=luKV@$9cy>L9Q($~(=*SkJUa6Jrw;@^S@_hA zM+T+7lsWw9#@D}CeeTX_;nmNNnen5O+qK=1`u$eT?z^b(uA1+%+s;~X&%KR4+gW(U z^!wt|9+~~q$lC(1?K+{)(WjgD=zq<-g$Fifo%_pq18#Zo?d^RBc39r^gggD;EP3zq z$sOmse8t|p`8)18eBG#;ewPe*{*1CImsd@C<@&20xaL5~q0p{FvEw@pJ$=J%^KKY$ z=grwec(##PkH8t)4zDW!|ZRim9IYUtS>))^1(;fe)P?~w>S2^eses9@Amw}?e(@k|L^88A6@lqv*?pU*L*54kzb9eIMg*`_V4*BWpL+zjX^}>w{&$@Qn#hb2eJE_go-#)wKnW0@i z9`Nl&**~1PdCE73Z~pPrqJ-O%zxpm%R6Vunm%l&u-Tw1#$$s?8uV1~P>W+)=d+wvA z>%MIf*!pp!dj?nh@oQjR)rt3?zU<{qgWkJt9dDdtmx5Xxi5U}lc%>{ z5xeHDx3;7t&KvF9c}vG>Wn0>8yW;xa(;IfI^xat6`N9Rix1agT1J50Or&D#ev(A5` zD0BL6r>xt$^2NEmw}gKAV&k0a-hcM=`~Q6X{e$hVdE>+S*$3BtmA<~svghlUPH%Pg zz}wDEyS%#VSKnFhBO?$HTvuI&ukjo`N>sZpXzVhB=?-2r;cg!T~guW@ukmH|CaFYIf+wh zvKNgz=hFEN_QoCBe$UEV7f$N_TvUT6QyZV0@XX6E-(I$U-W~sWxmU>*XZ?5c6VE-@ zxz|rqH!b+-q=f8e9?Lx?Wo4g}4(!^$ZtdsuUm5w)=F`##eG)ECNcp0{n%qmS?X~ox zD+k}S=+xMY=U?!_<^%U$GOK;gzSYzB_j-J7;Vp-X&r92TsC#mY#b>nqc=yp^Ek|v= z@0OND%^JRV=s?^}T{|Y9eQl4@FJAlTo$s^T-@Llv^W(Rj{6T|Dr`|Sq)$BuS-v4^t z%gY+~{Ce>>8y0;t==p7P+KhOr=lhFK?fTHyc@LfO|MYg|@l<^A|DS7j7khS5DTHg^ zD@#IuOAAG)gcOxhl8Ng5?eN))T5MUR^a-FJ>Wzx|H8a+ST6KzzhKjrV5WNx^9`vIeoBlssSK}@e3c-&fthu^ggl8>_7NjkV-!pq@cN}K5# ztCfQHN_Gc+J{w)SY{iDRC-XKe49eWzEPXG>RdN0K7b{!eP?Ah{GO2u%(VL2A%vsZu zAHKV}?w#&wmF9{7Ci7FTQ|wctLS80R>KXbZ9CTfkvgb$Dr7ceahjL6ZLwT`}orS5V zq;@&yB%9lktOctathU|VS8TC|=XTb0F5iX2rFmC&zD{!&Y47Xxf560>a_s?$HQ#B` z&Sgo9Nt3lFcRQ?XX|THOK`JWoG~07?Z)#~AvySZYdt5f%23HG{;vGhV-!tt<4Lf`* z{^`PP8do)ktwig-=m~vxyBh1NQ2Tm~x7S4t@-h2f+?xgID|OZvELl?buDnb~$?=FV z8wqcBav(og#5?!!UaiZEOcLYNDn6!IEv~ot{Hp$iCAlM5zs+o4P>_u!U%zN<->v4> z7D7+wlcYe8(~^>TF1?29>o(dY#{@UmRLU1VTg6Qn()qHz;<|}b$H^4~QSq&h`wtfu z4>)#?H&?8e${I1*f9bQ}Yqzo!T1JHni<{aT{bNov^+$aDwR*kWwZ{EN8BB9SBbR0< z{o=FxVQ+9jadkScb+<43DxFldZ$F+q_+=3*=$rQ72xTJ-H*zde>4Go;s$*-y$nIBegfz4nDmclk&qrEi@p-GwGhWPLSba zzB{SM4+wCsV7?h7bvP**OZB;{>Dl_OZJ*99B4Yf+KH?@t<7pHmJ~mjbi6v| z+4!xgJM6~SGu4&zf=jRE9tw58L*B6Ct?9ixCz3yK;lHoPX{2$!C@9kYu}3WNMBM1P zyHQaVoX>68)m}+nzvWlNGIEI`&C79py#X)z?NcMN;msJ`v4^o{e(aCR7 z@M9`Z@*!dR(-jfZ*zFvKfj927ey(Vo`tVXwG5KdK-d*YBrR(bY_Wp-f?kQ83B~?%U zYIKa^4t|usLBxY;SEBODa)Yp*))SR&oW*ymjZ<~A;KqK1xk4k_LM%Y#RYVi#lBl&J zYYS?#b22yT@jBK#m8A&1vlh77(zi^Btw40Ui_V)(M^F0lL|*h?iEp3x-=jbN!J3RV zCIT)3({DmzmUmw=~*wPANL&0nEq{KGgaOfiO2LGBDs#@<{O-A!{w?s0 z%4d9j)F@K@6n-A0{Y#JH({tRsEo#=^a7iff)+N77vwm$(iLX)#4;$%zy(sn*KSQ*1 z_tX7mJ%n58?W_qIbbsdSjc!bj?~mN4`%P08?>Exhg0JJ9WC)4#h> zd0zr-?XX>v=2|W)#Lm z>W{a;28T+HbL2-nZ#!j_m>J+6(U+g8`J~lsZFIP7N7h>X;hmpcoi84geBowal9+gU zv-id9wPw1ISq@0j5aB9aHElw3! zCbjAOw|%#6KG8NcXv>R88ya3*fAw`XCFW4qlOwHNQL=@feky#5J^$6}k#q1tqKeLj z<7Xz8de!grs$9{U)iiA^9#S1PWTdrm&CrpI8>iCU)6`kt`opbWCH%Lv~d!}^3`LpK`byeY>3mOye_(PZj|>X$B;44i}5SbQwusZR)=^id#L&5*Z-2|tCT;?WSPPmUQ=zH zGPYam1^HG1OW*GMc2t#D6F)j)62d;VU)=e5!%Bbqlt~~q<&?#d*$3q z7FV?wT{g;{*ro%Ui!LxCVTBh6XOu;iCt%PrCms$oOX9tHOj9SNIMa^ zNx7o=l1{4FPJ=Nq+k2rd@AnNDCOp6>q~pO9>bHjrH#YGeIlWK9zW26grTgi9S&M3( zf7U(MyX&2&(NJ~eLazSNjeSkE7x>Q9^5QFv?dz3PnJ$~V-(1K5+U&z(5h(5xdcQJxx+w*~#omH3n zzPMdZKJiFmogYVU-%)>ImqA=d=c{nOqs;6|SFNKHr&RT07d$(^ZFtT4ir0hLs;drc z&J(`R>R%vu&O4>Qzx zPIaRQy6}A9pI$SxC%m_5UzLMy!oG)_eC^{FT;B9$f7-Anr;6R3_r}3Psi!acT&R^} zeOmdg&_>iM9~VJnfB5}JL%l-ai$Le){0!-v9!`#@cD|bY=qA0d!xVRq`~105+ycwV zxBIV(ZO*`{wXLaJW+0rqXZvDt$|ZJ#>Lbs8SbG%p9SsRmv1eW5v2E+e)XR~gF2!x; zn8u-#H45?>cT+Q$RM^J3RYiI2y}mnyeWYuRdP><%y`Rd?jb^5wj82|IyFWkR6ae}+%l+m3snP9=r(2Q=& z>tSu9Q*AynUr*RsKEE&K`IhKvZJ*VBT2Sn^s?<62cX0{ffFJqWIUccn%FdEM)()m)>pq$P(5)wO4KBt`FtUdY$(9$erZuYB{sh`Reo_Ochm)yeIw z%F`}Ot{5^5wUn~<8drQU3>O#Q_1V)=Ei#MU>8!T|zx~Ior#ZE^7&1BI!fIl2UaDs# zvhixTGd@0aQm(_&*tptddym)RMT;Z6D{gY-oq0JjS@fF4D|dN%eL>HO69viwY{tL)qO2-JBF$SDPJAKUQFl)D-1Dco^B0Qs5~|PylI@%Y9fy@dfLQ#V(^Y; zQ{9lzsluo7k0FFblKHwloj7 z<*`PXz^AyiEw_03w6EdsT6H-U4DysdT6{hK7`ub1lGmx-Tk`}ygv(~|mk>(RClBu1 z{`o}O8~a_xXWz31M&02}u;$xa{b{1FP(QvQVd>@PSADmMUi%Q{BJ`yA_UPpo@%9h= z-rJ|2t~kHuwWT#_-L2iPmk#PMMYJs$IP7_uD>Ykq%auM8W{F2~*@a9UCn7dy$ckj9 zu}Dw<;Cf-eW;^`Ea3V2!F;nPtYF>QQ$xhy5duC5ma-zq+$Xny9m&R$mRINU9>GoGfyKc9!6XYRQp6aU% zP2WPQ%Lcnd#P)tOTz~6|<9=mRFAUd0>Z4$Q6cp9E9!#mEOx)_jJ_kDeI$oF@a1?s1rb+ck5R-|@j^IsS7+!__WqA4L)`e9Y;X3>lb zhCY<@gqqQ(Ba_2RuN7zZn7Eu@{c&5!y_@G!2E|{K&fBhxfti{qHz;e$`?IZDSZ)w= zw}ldaEuP-`X(YDQK=MmA`}2n}ok7$5#}z&uw($APO>Df=XK7LS>gM<*pPUAF{)GKx z$>q{RPkYK^3_bSZe8;%bwg`s?WhNBlCfB^$e_zAOaKNEG>F6~9zTICf-rYXvX(gp~ z^oM^}{J^6Ss!#H9r{vPrrKxM;u1aAiTN=VNZVVwG_Bq}^ILeIOieYhC1yUM)9)Lrf#yLJ76!*3pKN%hY* zay+1+MkJ3ND$B(xTn}4qrUu%S|&&H@t;keQ!j0g9~#TAUTw;Auk?E)^OU*T z&rd(LjGFi#2~!CRsCjL%X!q!L{!=y^$lIy}H&NSi`nDB)5xEoiCe&~EwG%gy*Tr9S z@WSUD*#e_24?7QkJhG~;<=Md#N$LXava6DP-jW+NSWL2SX)tv@DmgmdaJuYnZHy>) z?}f#9y`)oT#nSmszkF7VKej%f*j#dlacRT0a2^vo(;H%KoKY^94awSy;wN9-NPqXF z=g^a>fqomweSxoYcV-@4YcChGDrYIR(3WcpUp%Q;DENo;MjnM0!Jrdfr@xqW`sJm* z@b{`Xpm2Z1`{@+(!vrfFmua21^X>`4tI8E03pVEAEW3WJU9o+f=$72hnjuwk(rrYg>-Dd*=3jqev<+>0C1JH@}kFgx?b zo--30qX!+5rN!ef9qwgeBkQNVlUjbOY$WT;#=;A1heMCuds$3%^SHuw`GWPs!vpO% zzR3*bbY=KFD4+;bwvA>TJ3YGmsWqN`Qb4!U_fZko_sXJgtV0{t|LTlCad`UGiP53> zF_#5gS1L?ioGlT@ul$+(MdOa}Ghv@JPQ%RX4I6gd{#@&`=#XPW6tC6M7W+3A{nyWQ zU;nmZQd!RG=esjr)TE4RvBfHJ<+{P1B`*&|!&_~YOZ~c6@;MhUXC^J_ZSCgJ%N~g_ zeJCRznWe*D%$&f(wRxydVioo0lEeo)#Okl|TQ2pI%r!msT~4*)YIn$+c*`HvC5M`Y zh0p4h48`XkDVDhrC|MAdAyLzOF+U*X@v*tb(~ zLLlW3CH7|j)G3j~+nq;WkEKm~+LuSUv?_ctb-9(&mXL$vSqoe3rD772W3^jft9c!_ zkybgV@x^_#Z26(XTNu}r29AVh9h6^P^b`mwT6<46PhuejQgQx^hL7pdp^i%Rka?=;w@p!<*umlydoZpr8NXQZbV6C6`{ zdM3(Dn(AL!F7-O|+1@|b+Wcx2bKUCVb&c=#Y`ea@4$pidKKkZ~&W`;eulzEEe=ds@ z6}mpM=Yh1+vA&*6t~0|Ioy8p$L?;9GesdOYe0FyrZiSncj&pg_tC1DiIFk|H=LfqO zneVjX9tcFU>HD4(+?f5`Fj{{7f%3F$lNRHObBkIy+CKj5ydZmUbDGiF0md5!_j?j= zKQPi6H9wI5_V{Y2<2vF&o+}0LMIW8`J4&Bvhv40KYKdvYvl$a-xIWfO9&wG3osfDL zgEQLe=$ZKavwVcZ_p#!RKK+zeV^P-wJ+#t)28P&ec6oB!LNn`a@7pCVyVnt3Uft(x zrTU)rs8fgB%2eUTWA=9Cp14=WMH5^hkMuJ1cl`+Rs>NB@yh_7A3~ylS%Po^}7I}N^ z)*-{k73ar|oGoR(>NvfSkS<8pD_k2YuqRjL%Y!mb8Rd4{b&nq9$A31iYP<6+cUyQg zb^CPXmJxRw|F}V8K1J~yZl!6z0dizuoPwu~(641r^7l>GT1+Z6+_bHJkzi{bX=N9F zGiT4LvZddYn@6eS%uj0eJx@d$rTwnz-c#h!etd2Jjwa`ph|q&g*~2Dgs`J6|rz+>Sq*k{0 zK6!rY8D@97_<1LsacTb zr>m)T7vGzNR_A`&?3kIvl4Y-78h18LK;@ar)AB5ld-X4+N89&T51x<0*t`=L-?+sy zI%K*yu)qEihL2J8TI}9F6qIBRJi=ao{GEtXuz7lI_ClY!O@j|hHD6xPUf{;|Lt2ID)fZ}bAmjZ@hCX_f z)Dc}~3$nSrnW0Woa%|#M)lfp+$6L#ST^8V1-_BEA_2rw;D@E0i2X>|(*l+ZA)ujYT z@UGP7-&@jUzrktg>5%e--mP&hJ4Cym2fr!vtxWl}?MulIr(4J3KjuADy`-_~cu`^I zjoVV{0U60t`{Qd#rJ^rL7xRj18rgOBEgn(l{!pCVdkMcud(nsPc&n||4-(Q^oHjjv z7n>`7Ze;oAfQoC((K;6+L_QtQHo6j&(^Sw^qr&W}_$8n`_Q+A=`#A5o>k-l6dkPai zc@7Sr(P4atA{L52;SmMDkDiBccTxYrQ>l ziP=)JCvsb!j3n<|?-pd};c|Ud3l3g@p?~-p2Xmpjy=buk{Ns|Eanqw`QtBC?RTuD< z4Bnj5{=NOiOmiQkq7{i4)=jWP>l(1$UF!spOM71mZhF8*L9{+fFN|w+JGc>bnfs2S zjokGciCzNkVcQTRXV{2K_O+5O5)?ptD+()#o&9`w!O~Q3Z;G3vw}d`z1rlvtvcekL z3PzeO;p9O@@&k$bu$BT!+vvDa-q_bw7N9NS^z{pJbB7h&ZoVF_9smJ*AiP-!j8`fPdtM!#2QSpc{(8@<*7at%#ba5%On8PV`7kwK6RmYnR#JxP+%O{@=7KA0z{Gnk6*Tu7W{|6>s=)MUm|IVq zdJZ$?ElI+mHO!}n z$?{6DTtEe;@WV8C+DvX(LIFzwV1_nKx>kef`7rw(Cf&m>qUrCj4gd;*S=$iw&nkii zy?((^aj+~|Nf9mko4+)dR)2!4ahNPvDBrx=`9Cw7K|WAB!fYIEoNQced~E`3s5ZN7 zLTrL;tp1^R;6ic5^h;xy3163>mT3-aVvvil02{SIWLtraS{d?N&$D-cjn*omaC@*( zBSz_5=Gh)#)0Xx@xF6VPT^Gu;Yo5IqY_!Y|g&zbPHF0FegN?2!RPL#H_64vB^zcHk zkqiUc#;tjFE!c1Y(88a9%>g!TY2rM45NvcMqVP$ux#%_t*8XyXjrM8bJX-;59(uSw z*t}q)eYKotyMfI|58n;;0(H_F&$AhLaF`H1 zTm)=ku+cHA&9gUwjbs#1xF^`6;G*M?o@ZYGTZ|rF2{u~xj?#33jg~{BI{G!w7U6~U zWb|+yuor=i>dR)Hy%+4o^zidwqh1KrWA!|{2W&}tI6JKOUP`ygU@rq3)wSh3I}B{p zWuov5u%*F8^?rYz{RM0pdbscc9JU;6bUqB}Hfp)1fEi#5L;&LehJ$tuumUQ825=Tg zr_&7XBoG1e9cO`bpc&`_CIDDliY)=;0TaLs2m>O38lVAa1<+deG$0+w1&V;Dz;j>% zz(D3e3Qz=`0Y5qz$OWjwa#%gU3UC1201TGEGNWa%fF`hljxM<8fNbCj&;@)0CIAsw zCnyeR0lIV|z(wm9%Yi1~3BUqtCW(L=pb2OLy1+WX46p_qfb&2V@B#P)dsQelJ}tlj)+!bPML;ot!FoO^ zKoQsm6afzbw9fB4fWh@^3ZOm=^)unXU7#801%`n!0Ilm^3zz}BfC%6#fI+)o1w;V3 zKoQUn3{wtzF>3U~wl02M&G2aZ4lP!BW% zFOVPF?+u_7=mao+*bZO@Yy%tsZy*9F1*(Ai044za0w4y+0*ZhxfC=I-9UvVT0j2>K zA?Rc25W&?1bbvL08L$mV2eN@YpdIJ{x&cfWju|imE&x@)PXH6eVMc%%;0^c#2|yB1 z0$^g$t^sXeEno(00~~-;Kst~MbS;GPfFki3s=)mMOarHvKsl07e?SDVdMWr7aTr+@ zTtnFZHQ>6#@p!`Z19$+wfFIBdd!N6W10nqcsVW|M-2iG^S35Wp_ zfb&2X&hy92FHx{n@IB<``H40!w(7zT#`G7g#0=NPGz{FLEFUMh?fIqMY zhyY@NMBp@V7B~-J&9J`!)&hMcAOi#dyMbN+djiJ+bOECP_7sP00UUr30DA`I02k<7 z0yhiD1@NtKj|A2LCcvdOSlbIcY{y}Zz>y9db_TctU|n!;0z`o20QMHf7=R+M63_#T zfsMc>pz0l5H^4L{1707XCvPz6*2%|IJ~P2jKxz%Vcdpix?9 z7L3%g88FqG4457uR?2`$02z%8SP{_m3F3c3_&6HTF=8gXFq*@0U_*d5gcMmqd8X(d z5B-@BmF(|7vu@vV<4jm0q(S2t8}P?&g0w06G0Y{o66yR~$; zh3>ur_b1Q`p!M2lyXxSk!#;#SS+o1#6yyquH_%N&Toi<(_3|h^O49)D3A!JJV?+?u zfG`jj!3yZ%Xdf}Y8GRx2NYx8|B!h*Fyf3yOHj0p}V$pmjW)@2HHNTxp=skfp`hXD?v^92T+{nd<;Gw zzCnRd=l+3G-xj2 zG@&J$8G#E9aP$YA5ZJ>gn(a?bPq|FfrZZqUN4lZgt8Q`L0MCDN7X-f~%tfS`#eUmky zZ?cZAm_kd3%0hKx1}@5n(xP^Z%B23z2l5Q?W&&CTYP*T_aI`O|r6DbfH2QW?o>~Y? z2N#ux;!v9?1sAmmlm~_9fZsbXfZ|Vaq&@J~{G&d{p%)v5G)M#Ik2D~! z0Ww*z{az^lC!|4jF<%0ZCN2r_Vb~gs4YrN?yZP}n!8nK?hZ;ov$8r?*XIA?I8ZW49qHQQ(>mVL!%gkx1&;@FCLV7cZL+4>G z&K0TVz{@OJ>qqAo##yv}n~8RRYK5mobU$i^r|IW#Z)t`4N7^~9P+yX?cEf{N(){pD z1LdOpkD&dw!W#wj%+d;V?@dpiNKc34A5l6*^bCltrQP?Ce+BJcuoU}Bk4N{ARybZw znhW*HiTo_sDL6J-es<*Q&@_CIpGr@M&VL8^t-(d-a<;9bYjh9n6a0f4w*(4CM9|$? z|ExRvss%KXit?EWE8!c+(;;VtzO&iTiol+Md-uSMjq;#d;f(LMiv|d~(4-haPP2fS zAQQ|s^V;JGxTs6G2rlh$d<$GsaM&onAnYOmL*Gs(^x@Gv540ouVdJXcqIVv+U(?eP z*gh-+3uX*s3}=jD+`_z#`7rZQ=6dF4=6>cO=C8~wEFvrmSxBs0tR}3cti`NVtmCYc ztnzG%Y&+QO*gVT3x$wMrE&K|+0e&rh9ezFD6u%k%w&CsYuJ~Q}{rFq>a{Oa_GyHYo-{U{v zzu?Ei?D)VNLWi)M_5lVC0G%*5^M<01Xn^Z;Q-+#lI>KW@GyJu~-v`1t0V8S=R}xK$R>bW@2ck34mFPzdCf*{J6CV>> ziEYH!#P`Gx#1SG!+C;J>Ig?yTDWp_V1*wWuM|uE%O{6!Z52PW|2e6~|+aW{wveuQ=XtV4U8ZJ2^WzF|K;9$MDz8Wy)j5W6R^fbCf5M=LSzHPc2Ua z&jMaS-tD}$ynA>fcu(`D^M2#~$ver5@tx&Q=l{u%3GfL>2&fC_30Md?2m}g52y_Z` z3G@jJ3ycY1f+RsMK_Nj2!4Sa+!92kt!Eb_?kgSlRkdBZZ{22=Q2>A<9g(8IVg^Gmk z3pERM2)z~(5nd>~M>t&gkZ_{#Y2kF?Lg6CeDq&1yy@;8}9+3!wiTBk^_Ors8Jed&MKfpNhAM4~dV6PlV+ySb!wM4$IK>pj(~8rI%u4T-hLwJu$I|066Eo{Fn=@sz^s;_r zVcC`0)!7fSzh%qiDCTJ8=;Z|GMC8=wH0Hd>>B_Olwa?v?8|_u zJe$1gyq9_3^Kkhr`Rw@|`P}*Z`4ahF`TqHz^M~`t^09)8?M3Z%?GM{0+OaX8asTlb zgMPDctm(>FVkF=?BwI z(@&<`r#q%!O?OQXPXC&ooG!$UFdk*Rz^KTa$lS@I%Vy7ZgY6w#6nidvG5c$FCcF$@ z39pLRz^}yH;-m2K_#}KTz8HTUUx$By#|TUW8G;f)m0(ARA{--}A*2!R6G%jEq72c9 zXiVHnJW4!9%q3nY))Ma%-w=n1Boa5th-6HPAVra`lFCV~q;^sy$3c!G9GM(h9JL(v z9P2nwaaM3X=B(o~=Gn@#jpq4+?YF^E0wR1 zuQ9Q5LU+Po!f3)`%55rW>fBoox%-C>s-=4=;!h=g8xz;8Nr6 z;^yIrf&Gc+Img4qE5obAtIDg*Ys1GUBp{?N#4f5Knj^|8h8NQjTP5Zy<{_3KmL%pU zY45q+%gM{?S=zJ0XJyaIpWS=L(z>8ktW~>Jx7Db1b8C7BYuDngrCm&e5`#+yr3Y08 zH3zi^*A1EsZWuHhv>3D=+&*YCXgBCE=sf5(7&sU*xOXso@bF;fVBTQWaPx5J*rT!I z6QHLC?+VeoRw}$7M4fF6-CYOa$ZrjuusHT%855Fx!*wpX4aw>1p=4JVdz#=Cj(;`; z$pU)WQ$cIX-i<+B!O%MwTp07+Ut9(b0c z1o(mqtq0Z5k!%eAE#UoUm=%iQ=bLTMkP#l*R{QxnJ5mKmv!OJRUO|Cb?@XdK0e(IP z@L&`u#5)_|?dRte52%@@bl0jA$Y;%yH zHTJcjZB$g?9|??nXA_9=OD~^&=%SB~Wym1HypUsdyY{pvPjRt-Ne3dilmPEgI4B8` ze~E?%SDM`PB7uL2L?hwF{}w?3mFguz|CWPxB$C4a66F!N5t^pUQr@{kf#x@J%zhKa$o~7W;Es|4`Ld`D+J}UbyOCWzp(KjWE06jg(+@p+5^Yo|XF6_^VK)N3JRG zXNJ`?3gudVZw*P6YyVXW(gfG}tL|X4EB-2)E*id)|IcmCoT*iKcp!!kERf+qbX95B zFHNI-H|;S^8_Cma@7}u`-g$uHbs+8J?%hkKMM}b33qLQ4p0G5!N6o0B&OYDC%p}pr z)1r0;`B5nb3#9+?3`tM2nkNwMRAhKU2Yqdj9<>0U;huRr0xjZ?-GIowavMN$mmWT| za}X*wXU*<0Qu^O3XA$h^|G%Y$BSOW|56I~M|JKnC(zm__y(F9ISmCV`t!`%Y$SG?{ zG+$t-k0}MTh}Utd}ZVwc+xlMCDr@LdIyNa^e+-}V;O`p1X zu8RT5a9`?7(=z9r?PB~vP8!}gT5!(>_&5f5nfv)s11+J6&nT{w-JEG(1d$=5n>xix z`0ogmYYnKxZ<*Uqw*bH3breVct#c(q<^U?FmwQ?NO97yOZGj5kws3Z%Al2*~PrmrOff$d7J1fgW7a%jxe7Wyq_MEWhX6 z&dxPN^wvqArl9XdfL2X5L#N!^*PC-*UJDr6`0)JMM;HhC&b429twDYGN&HzKLC#(j zDmoi5eQF)luK%C8pq6*e)dIbwji6Q@Fc(NWu9zpt;n_aYY>T5cl<>I*Xbx9N1a8iYn!`RTr5oiG( zfg9jbjKaZi>W{;k88jZm&D@5lVQ@7^&*=_+xOKb77WY9`Fu37AHb4>US!1 zAeP%frrz-oj-3{Z#@C1GI{}XtjxN4O=rK^As&P18`VJxOcjHYmWR&FSU!hJOZmRKr zhr;kTfqula9Y_iVIgaRxWPOQDr?7AFX80L_^s&z$|uXhh+%)r0Du2JM6%WgJNBSI*(M zXG5F<;VV1N?n>(Ce}{QfT&c8iVmdT9dQP}8`efjEX1xI(ZtgQ_F5viP182T0Vd&uo zj~y3r0<*z?%mvKE3C+g1c82mt4Hot6IAgzOB<$=jb z_UKLwZ*k}!gkkSzkib~U0e+}Qz_HT}vJ%6bsmwTMsxZx&s?2ky8q1ui&N^pmu+5p8 z>~p3T9zVAUMZ#}eiTK-ACjGWmIDXrzoWE@~uHUvg_itN+=eMoN``gyyo3oV_7yP!B z_5n)!QZy3&~IB!__wVt^4r!B{cUTCF_TekE@Y)SWF>LBp^TlvvHL?+2RTy$ z0vXu6;iF1H@U1o+<7zD}j0iE#XyoQ1?-a_w?2KY}D5;SZ$%+!v?o_IOptgbnTyO3{ zPGlH=D}dfT8t8erDtLSE@{xz!p73=#2`48_HAhv7v!;uhrV@PWM_ru)6P~rylqt?g zO&j#8Rb8EwRVXqnmL9&LYyDUh$;z5!C2S)n3_9T^Vebk*Z3aQfOtPFlK~(h3A$d1% yKPULnS(euqzE}c3Z~McgBJb)?MV~j4B{&6nd&$FK8$Mbj3*U@z^Oc8t?*9OMe2qN- literal 0 HcmV?d00001 diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/zig-cc/wasi.c b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/zig-cc/wasi.c new file mode 100644 index 000000000..818b8c330 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/zig-cc/wasi.c @@ -0,0 +1,222 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define formatBool(b) ((b) ? "true" : "false") + +void main_ls(char *dir_name, bool repeat) { + DIR *d; + struct dirent *dir; + d = opendir(dir_name); + if (d) { + while ((dir = readdir(d)) != NULL) { + printf("./%s\n", dir->d_name); + } + if (repeat) { + rewinddir(d); + while ((dir = readdir(d)) != NULL) { + printf("./%s\n", dir->d_name); + } + } + closedir(d); + } else if (errno == ENOTDIR) { + printf("ENOTDIR\n"); + } else { + printf("%s\n", strerror(errno)); + } +} + +void main_stat() { + printf("stdin isatty: %s\n", formatBool(isatty(0))); + printf("stdout isatty: %s\n", formatBool(isatty(1))); + printf("stderr isatty: %s\n", formatBool(isatty(2))); + printf("/ isatty: %s\n", formatBool(isatty(3))); +} + +void main_poll(int timeout, int millis) { + int ret = 0; + fd_set rfds; + struct timeval tv; + + FD_ZERO(&rfds); + FD_SET(0, &rfds); + + tv.tv_sec = timeout; + tv.tv_usec = millis*1000; + ret = select(1, &rfds, NULL, NULL, &tv); + if ((ret > 0) && FD_ISSET(0, &rfds)) { + printf("STDIN\n"); + } else { + printf("NOINPUT\n"); + } +} + +void main_sleepmillis(int millis) { + struct timespec tim, tim2; + tim.tv_sec = 0; + tim.tv_nsec = millis * 1000000; + + if(nanosleep(&tim , &tim2) < 0 ) { + printf("ERR\n"); + return; + } + + printf("OK\n"); +} + +void main_open_rdonly() { + const char *path = "zig-cc.rdonly.test"; + int fd; + char buf[32]; + + fd = open(path, O_CREAT|O_TRUNC|O_RDONLY, 0644); + if (fd < 0) { + perror("ERR: open"); + goto cleanup; + } + if (write(fd, "hello world\n", 12) >= 0) { + perror("ERR: write"); + goto cleanup; + } + if (read(fd, buf, sizeof(buf)) != 0) { + perror("ERR: read"); + goto cleanup; + } + puts("OK"); + cleanup: + close(fd); + unlink(path); +} + +void main_open_wronly() { + const char *path = "zig-cc.wronly.test"; + int fd; + char buf[32]; + + fd = open(path, O_CREAT|O_TRUNC|O_WRONLY, 0644); + if (fd < 0) { + perror("ERR: open"); + goto cleanup; + } + if (write(fd, "hello world\n", 12) != 12) { + perror("ERR: write"); + goto cleanup; + } + if (read(fd, buf, sizeof(buf)) >= 0) { + perror("ERR: read"); + goto cleanup; + } + puts("OK"); + cleanup: + close(fd); + unlink(path); +} + +void main_sock() { + // Get a listener from the pre-opened file descriptor. + // The listener is the first pre-open, with a file-descriptor of 3. + int listener_fd = 3; + + int nfd = -1; + // Some runtimes set the fd to NONBLOCK + // so we loop until we no longer get EAGAIN. + while (true) { + nfd = accept(listener_fd, NULL, NULL); + if (nfd >= 0) { + break; + } + if (errno == EAGAIN) { + sleep(1); + continue; + } else { + perror("ERR: accept"); + return; + } + } + + // Wait data to be available on nfd for 1 sec. + char buf[32]; + struct timeval tv = {1, 0}; + fd_set set; + FD_ZERO(&set); + FD_SET(nfd, &set); + int ret = select(nfd+1, &set, NULL, NULL, &tv); + + // If some data is available, read it. + if (ret) { + // Assume no error: we are about to quit + // and we will check `buf` anyway. + recv(nfd, buf, sizeof(buf), 0); + printf("%s\n", buf); + } else { + puts("ERR: failed to read data"); + } +} + +void main_nonblock(char* fpath) { + struct timespec tim, tim2; + tim.tv_sec = 0; + tim.tv_nsec = 100 * 1000000; // 100 msec + int fd = open(fpath, O_RDONLY | O_NONBLOCK); + char buf[32]; + ssize_t newLen = 0; + while (newLen == 0) { + newLen = read(fd, buf, sizeof(buf)); + if (errno == EAGAIN || newLen == 0) { + printf("."); + nanosleep(&tim , &tim2) ; + continue; + } + } + printf("\n%s\n", buf); + close(fd); +} + +int main(int argc, char** argv) { + if (strcmp(argv[1],"ls")==0) { + bool repeat = false; + if (argc > 3) { + repeat = strcmp(argv[3],"repeat")==0; + } + main_ls(argv[2], repeat); + } else if (strcmp(argv[1],"stat")==0) { + main_stat(); + } else if (strcmp(argv[1],"poll")==0) { + int timeout = 0; + int usec = 0; + if (argc > 2) { + timeout = atoi(argv[2]); + } + if (argc > 3) { + usec = atoi(argv[3]); + } + main_poll(timeout, usec); + } else if (strcmp(argv[1],"sleepmillis")==0) { + int timeout = 0; + if (argc > 2) { + timeout = atoi(argv[2]); + } + main_sleepmillis(timeout); + } else if (strcmp(argv[1],"open-rdonly")==0) { + main_open_rdonly(); + } else if (strcmp(argv[1],"open-wronly")==0) { + main_open_wronly(); + } else if (strcmp(argv[1],"sock")==0) { + main_sock(); + } else if (strcmp(argv[1],"nonblock")==0) { + main_nonblock(argv[2]); + } else { + fprintf(stderr, "unknown command: %s\n", argv[1]); + return 1; + } + return 0; +} diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/zig-cc/wasi.wasm b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/zig-cc/wasi.wasm new file mode 100644 index 0000000000000000000000000000000000000000..255a198f097f84776b119254c961b1b5fe43aadf GIT binary patch literal 62102 zcmeFa2b^71x%a>8nQ~^5lRn7=c-Em96eK7HFGaGWOei9th+eN=;1w()Yopp=jw+4XUhoS#oJUaq4l0 zEPD4ri;g_x=tb{3YVkowFFfqncOQ1#_T7gpeCMKr-g(&KD0!Y5<9v-p?|$!LFI=zt z9fuzD_QQ`_bXb%=Pfz{Sc*miO79X;QhmTlSb7$^xX>&I`WVs4vV7a8M}+h z3lBTw&?tMJ3cY0odW!PrsiRI79d_7)sP;S+goEQ2zI*Xu&pXV7qYqj9u7lq3?!!ms z*Y!M|_4uks9evo5QTOvyY4|F~9C`S=k6hq8ect)kk3Q<~!w)*@$it3$$2*=ExSpdI z9`*Kv4m|1P zx-woK*SqRTl=dV^PhXOxNfKpwEzA0otS5uJ3nMQIu(SyYd*Buyz#eFm9P8pUy6 zJ*9w_Q8F&-8sA8IQX2Jkk(cyDQ9^B6OsG%jnUM6<>-C;w+_;I8CQq3%VZzj@6DLlb zIyKAVqvJf!(>R(?>p_f*;o-GWy=ziZJL0e-j#~JhB&r<*TP|E2P44N9qavo14rnqFKqh%hnD@{ZT>fIpLvk&hYSX)VM^SE^2&K z-xl@9J-ab?f%H(V*cL!QA$?P*xRKViM+H` zENK_rq`LPWY{tdf zB%@+i@rTf`i;k4lW$BzmT~t-6rAD=RF;Hk8VRBHSf_UCiAUvCybBMQs2lBWVILDShSm%yC&!a!Y=`II1P+$z+$u6ps% z8gT5uN=PlRWZ!;qKyk}()}q0ZcC#zg2KHq`07BgsEorf&RWyXkuHxucGx2Fnb`%iJ zZV+JIkfj44?Nea3ZtDW;#nG;ZoQ%F8PqDPUfH|dOpD2K3TiZs6MmwMaQZHy`o{XYA zBrPdVM{N^_w}iTdWeq=8=1D@us5o9M7Wh6J&G*?mg(g}CzR!wHtSj(+*I2&K;Cq$8 z_g&A;_bI)MV&Wz^fcs!g8U#)jFY*kCeM!A&2oFMGU-*iIXEmS_H4C2S1j5$I>S=+d z5hQFp>;JKHtq0*`+RO>&gc(bD+u>5oAYEN-b73fTp@mAqug z3!*YsCj?~xmNE$lGU}4LCH2pxu~(EZsl^r*8Jy5U?}6WVK^x7Kw2YAW9VCCgP)*8E_EbW$1pJM4J`+cwwk$^FdyMd{|q@>O~zCm^nK)|*OFqOWw9R< zK#FcrIkseh7*@4FMTfoPz}{mBy`eIX|D(!0RD3RF9;4CtLz$x$fM&E3Yvv_WM?em+ zXk1NOEKSu)pLt4;rgA)r%84fA#asHCW)*S;IrH_B>=ERNg%+{2-Y26HHO`j~tN$vA zGmNN3VhoX?8H;)e>NWOOOyaH_l`d^JBM}VJLz_TXzC2y^?di(6Nz3aiAs;fSH7x=( zJb01^i!+8Pyv0FNt1+w*@Sq98Vko3^6vY_KtD&@1LusjoyroFrDSJu%poUV^P!!Zq z)KNpBA{0{zY6#s}n%@+P@dw2M6rxyEnjMcDX%!ex=+0=@(MDrsFj~W_e_4)<1 zxZ9%}Gt$5Ydm@aNWX8gO<3bUoh{k(~Q?B?Wi_l! zvpYx?_*PF6nVzE2vTjL856ZJ=LEt&sWXLXGo|2xadOXgP(g>)?ki0NtPl^4c#C}p@ zKM~g@@02eBM+fXDV80fyU+Z8$R0R7f0sFNM_7kwrAJ|9V^pFJmwF>){yp-6_tw%)Y zp?QZ0)+1ICamJD(8AT4jXYNeKz_SpsH)h%6AnV{D#?JwpUa0)!MLxiR8-q~!652D> zRB9&|Qafyc*AWK|=Ifz%zLl>mxLvJgpwoy?Mtt{g#h9bbDMDr%3!2duJ}H!j ze+Wl62C3+4H7-*n!3pqk3S)UfJoGg#P)Re{yYh3IfDF$3i8khQZu!^5_W5tP7 zcC+ku>g5 zE+f2uq;$)TO63hmZ#7OGsWm;+ibD^L(?&{0L2~*?u4j%j^c+<Lha0+ll(y;M6nF@ z652Ix2{7TQjEfo{(L>`K`mC?$jcY!Lm5#?f$9Q^6Y%vb|P7#j^D{-HETty{#H}^FW zD9^*H8SfOqti{q$6Z4x<6WhCS&19!2q2>vpCbm{J)90$0?iAr9qq+R(S*XcZ?zOx! z)s~>Glr=(ub`vY6M|5IiU*?iJxkmn(7$+_oimSo%)=9J@s@tc!cSN1wyK8`4Upc*E zd#NqOLKk?a&)G)(G$x!WPpAw^urhZ6bEb6@#tpn{SvdQ%aP7<*-ZLV z4d97D6|WoRdTP#85e7n)q^h!A6zvR&i0Z?jeB}Z>ZhME@&)XQW#83<=$FYWzc+Wxu zG;1O;W(O7$VU+471#JU~Kq}E9?zfQ8h3#nqnZ8iu-Yx4cx);-E;8-852})?z?ThGY zF`j;>2vwM%3N`G8t@>2dc#c*Oq2&Y(h$6FJinf=mP@1`#C|U2>ez> zV?ZCMp6arw$_91kBuu`-Y?z(-TL^j~m}vck8fL0E_I4p4&E7K)Q%ai`*R4dW{g zgs;ir3;#%!`;fJxJIxO7q~6s@9a?n-g|l`su&|lqsuxlv7T+{aZa`xxi)}1{A)ROj z{MQ}Rf$$|KiYEmre9=HEQPu%nm=s!(tPAHKiQ{CMp;)}Wj!NUhvqccbTNdvpl?5_K zArrGwnW~XYEXc;0Fb9;5i}#g47C`HrEDw+L1;%X=kgb2_Z^yOT#V}MjUR+q$l>F$7 z>fr^d1@)H#F+36lZ@`z2cyCxrF-7n%@f4H#o+E1&Vyk2>y=rc#Pyyb|=l92c7|og9 zTrjq*h-yj6D~1I!L}~qk5F~4CRQ9eSY@+1w@DNGx8%KvDl0Stx$#MYcJ7tJILE65Z)!Tw#A$K0Q~tVOiJbH$D+Ez&U!U z>?N&#EQxzzQLmFzX*=wmpY(Qww2F{3KSqZFIRkY-ceP@f>!Mi=6}HSfILt)rh|QkB zK(1HKSx{tMHnLvJSSAC%Wc5mZgBVKj$#Lg)%Knd_n(R{G%wEehj9#!Ri)X0#KDZ>m)`7crJNwdvV7 z4I_x}i(j6&b{LokrNFxCcf>5}jL;|!7wP;At=QWH|}Bl>sGCk7gcY=XPH zZPYEOiIkcmz=*)1%NROse8}Sjr_xt~yi(Q_HSY2SaCgbNrL2hopF3c>h%F?xVoJb` zwd?@6Xrh0BNS9AR6TXga71NJp9l8gFR$%V5Ij}s(@tXIkXP!O5du%=JewK!#VrB=I z?9U|id7pV^{RzHS=+N4O&3xWH%ZHPd#tNqA*|N0Y%y#Yo1%Wb|5n zBx66z1Q#uf(_(F4+{?=7fSg)MMN+Kvncs|BW%Q90e~(n{fsq^_PF}NPve>e1qlUBw zi-@pW4IZNdmU+^(EMgU>tw7q!j-|8KMHQv;`sR`6g}8COCjkLbSk9B>FS(|Em25BQ zjgz^>tPzRQ7{gXRQ@ue?w66q6{e-@$HBXgiwi;K5QM>@pN*Y1bMp}%Fs#v)F@g55@^c{eQyaqJH}2yF~P0c z(ne8{Z^)XP^f1ILn+>7R6c&%v#d~?dx+jdPi&OIgb+!8;h_tpBKna0yE*O z_RM> zU-iT%T3lRLi9}$YE5+d>7HE_r_v*ED2~xQOE9Ej3tNmwOx(0q5T^em{IcREpTtIJ8xr81d5s0-Z+uW{f>hj}GlssuHvUp^MZIOtO$Xf%lN1|Sp_hVFr&NO*W503)=CCu#uBA>kdj!?zs)@Sf)c z(5tckAw)*yd3N21%yl!`FlPAflZzCGM82eTa|}VWRZnd9`he6s zD@-p%tHq1aoa~KLz(EWac`p)$o3-6J4TAod!%|vgHB69Lh{u`XYqENzfTrv_V=+qm zqazlDHw%7~Lonb!PsV>pw~o5mo98Q%zl{hEw3_H5)_FgxAyM>nJsSR`WXoB}7DQ@Y zMK7CLf}fGCngScjngW4_sSF?~M1zG{01fcT?b#xLZ9bUWDbhM)Pm8Cn5N&~)uHdi& zS&u)CLLx1GaUz1*_@dzJkLE?L2MSQ&=Z@Qp4)|ONd%-4Ym^gSTwwceafroUmb$1AY zy^28=SYR(?pcr18wj1}Vy%q~ulJRgEj*u|XD^F~67vK_;$$aF9P4;>nUE;Uo!E#)j z6;~=Ps|PH-GFaMr`?*wba8{WNI%zK%^^SL3&e3Ao0<>D=TEXaJ1ISf*sA?~M#7pf9 zUTR0BX7x`daaYCv?8lT^UoxUq4=@*&PQc?pwbnve!Hnu&P3M{)?d#f`bx?)3 zJ*JH?vRU%8?!g7kE@%gr7kvdHG6?^v0W7;f**z@0u=a_(1^{&cryGB~g3?nbfH6zc zk|gnk=r96P+J???yZwQH5p^He-!VciLZ3LO4(SRt9Em~T$YN(l7J*setv#tmu>~vZ zMeJmin5E zuAqX3Sa4(E^R}4aapLzFXC*r{L4mdmw488>#`Z&nUS4pZ|L`!O?{$~{*Y*8~UzU=F z{b#~me=AG??m)~gtodnm7E#+J3=xqN){#MOkioDEroc=(nO4s)6nLml#&I6D!x9-h ztxie#C5>;2ko^!$7E!15q*Wj~E29=`tBK%6^u!L7ME7SX{85Bi!u1}$D@-a1o3*EO zF11q~$V+A1F@_2$SQ%_JyCf04663PdbOBXR0;4*oCWc3iS(cIF@E(K!l2XqFOSuv$ z-uF6A_CU%<+entx&rjI+qcA?aRC;LCMl&y=Ogj@+c36t==QJlbyB1jH_tqE$12{5a z?3TKkUdj1VSw{JBcp*2 zyaysKRvobOJplt$nCwqC(k!nq;7?mlrW0X+b0mNv0^&u0WHbZF8YJuhH%Hbpc!U#5 zG>;n(i{|w=!f!!X?(%}Di24epT#TIi)SSc@$*tfYnr81ot+zgOCbe4I#pt&cO3D6C zZam_9o#DAyLkB;EMs-%V3by={xdA3WzLzkLF)w3f z>TZ|{rY)vdi!NYxbTi~)y*4D3S?orGc%e2j^i(^xSgR)jsxSa~!?*ff4-#{!yOy(` zrB`1y^?a|jrggq))lpTi2ciUoY4Rb4WTE$a9@me@BgZr_ZCPd7ESWcZ^&0%%^*G`j^Wh8J(Mc^JlyZ!E z<6JbeEK({DNK5lDB!r@j-uZ9sC)Y-evsDQp=6n;YPD*vR^qn@oPZge7?qc(SuZBZx z#mNMn%Vg-iCBoV-ANG%M^zd-fE}mT{X1k-v77Tij`Wr09(OTOXR9)!#T{S zewwUP>HS}kY~cP}BB$ypc1*1m*2&Uhb<#-=cakc68UXeElmNwbx-d!RirbiVT3pBx z%T#M{p})otH9arr3O6+ubSz2^G?Lh*i16}&IV%ooGgr^I>P>~)sD!TOB-`-K*N78^ znntKW-<)Jta4C2~6KQdJ8F-8;{S+L8=K)LT0zqvTGoV)IHH?IGM2*Y{BLjf;I%aj? z@S3#p>F`x8_ea8fTOEP-ho{I+AQua`A?&*%DQSTY`SU)tL4U44UYfJFSkh(PZuo71 zUNrnBr|SB=Qsm*RthIo}_`Eo6C1)N`Q^lQW3#UCV)=_QgBG*e&E$UkO54qh7U0<2( zS?KzUV?&h%Zd_Tnx8=r@{1`noP`eZOo5K*AG<01P4XIk5}QE9mPnON3f}J&>FFs( ze&VLm7)P7BHq}@1+g>!U+Z3C;pg96pbIM-*Y;|~b7(7Ok!zj?B#<#?Q?6^(pm#azl zlVFi))Q-1_;^siHU#mIQFVkDhsKpji`lu!9sYdDsir7uCscxD)*Xgty2*)d%vTMjx*@c-tQ_ zgu-)X9U4-hZZj0X;ELFc1#X5-N4G~zCPaHPJQ4zI`*_+-EekwRXA}=yblVep?*svu zQS=_(oQhikI;NIvwD%xg3S<{h(VQw=hspNJXtN5tNB_7!T$NA@g3-X!ZdARfub&kT zh$as4l=ZuZOcFK1yfxK{eSKc1XblthS`;gNd#U0W&uyL9gZerJ>njlYc$JGP+^|BQ zuaH(1W^YuX;VWcSg|#y3W5<~6Yvff8Das9M5PJe8ieU1aDXG>4V)&6{fd+PPIyDY3#-5{v*dpIYCh7JL=7Z!!Qxbu zK=D!u^i=sjZV&*J9Yn3e+&m|vn44DVb1?T*En&kpsyv3d2LfZKaFq6p86YsW&o7x; zjm6Yc#nc0JM2qdG&5rdD(GCGrJ1_n-iyqjR=?ns~`rvC5i`~?8ZkU*DGMc3~5lhE5 zvt={EN6?J0^negD=%?yt+5kOh6x7#Lo2j|ZEZ}XTHZ;Q|^3W})%i<*7P8br;2L?uC zO)Yjhyj9$C*4p8)F$;2eSwKyNVPKwA40?^p8Bm_4`Pc!UW16&rP12mTX+I5=wVIP~ zGImVYauS1P-sRXay+1{fc5pVaZ=B4<+LX2xtICO)CIz7VNrVeGv%8KGSik;#?dB#n zJ?I0>+NJ@d7y4vk%UWTs2elbuQZc?=q(g(6>0ooS;%*L|y|OW}e`2H2;QhPmzdj|> z>ZviYJ6Cy5Mo*k26DRggj8rc8W)>F?gDf|VBSlQr8Hz(-kA(`nVu{9eN1SiVHpy$7 zFzZs$yxMyt&Oz_t3(A(0Fvc?JG@LG3291Lv*?@#_qR=i8u}y7o&}}k;W509@OHQ|e zfNfx$Bn=zzW`=s0R3dJ=FT=3qfhl&0?o4UgK^EwlZauhV>Y}&aS>0`XM}`d60Rx^R zQ7*sMLa|L6bS%tH=HEcjR@FDh-M_0w&FONAMvXxQguhE}7^2^WoefHsV0$d)t& zyNVqD!NU!JzAAazr;Dc(6t7f{QV!0QYLpt8?5239atbQBIW=rR=EWa~7^XHJ^?=|y z?a>6YHdWYIpjdEq{rg#b*d}ee!=E97} z1e7`Q zU?w|7Y*bAXSjJ4!rqG{hDjSULYmIb=)HC{UPO(`nt!; zKo4x;m9W$I{V3zWCZ}bkz0LWM*1L>UehTpuJbzK zDt!i>&>VDISaWx`IdY7|OTPVo(Te7lBa!&}^<}s&<3Pm?iq24wzPq?;zQPAO(qF@8 zqlugHwc%jTY<@+0hD`~qwrAGR3cmn+Ow1i_@eBigjKa$gDIc4Hj4Vyq}gD0$W_9ogPLcN`8M} zw-=o0KN70{lbOQ);Mr!B>;^xrLt}_I#KN3Z3JWNC@esN2+`6Pm32&VyP1SLYGeuQ# zANU~uAz!ZA!5_jjbXIYs%F$-ClG8E}tL2u{GTGsU&8>>Zz(WkXk30|ccNH}hla&7; zo}X`5D&S%*&@lQ4@14H3S_P6T_I9kfdLP??S_P<_m!GwXV>dA9BvuLgQ3&YA7Y*X+ zHD|S&)4ZCQ;%E7O&9WK1zv5N~pVT-_S+r)^K~*&QTeTiRX&9t&R$1e$fVwMGO6^cu zg8ul$A3LK1dZ~=*>8yZ8T8=^EIqI==Re?6v0`C-5|1>vMhKa9K&detI18MR@rs&)V z&LAqzCg0>hnKLS3eP4kq>sFQGJbuLz2#e+jr?tw2j$UEm$}U)UuHz$x<%X%s#Ax8& z!O!$KMWb+tGE|olg5JTwFw+XTEz+x>%&n&RgHnpUkw}tox$J%5cu1vR?ZQJB< zX?>Kx%!E{b*`rMshhj+O5`Hn4ZHI(4Y&V$hlt7+`8y$<7b2lxGt^2pRnJ$IKIv5O@J9I{@I7O zJ6xWGUS-4&gYrVB7=vkelFP^T1)B)BTYHtUiJ!hEdt`Gfo1&q?(AGAI%^7A5NL%5Q zvJdag+3@gPYvEsb*wL-0K5D~=1;u!qz>;z`!b=8YTg1+BSTOvzez!8Uwv$@7em6hp zU|FK)0fvZ=ZEj64HDFuwQtFmKvpLXhp+UBl-rln65=*<%Z7KPw{*&dc0~r|gj4xF& zj3RJUqG8aRQW}^jUlIgelqDn!dJwVwCm0i?2RRbw6NVu%IJPaDwLttN>LY8D zh-#38DwVtpHHji=k(Ja&VBI|v7wVP82ZCflQ zEGw28>CIYhGvBPaHT-&<_dLWw8bGWy02OZ=yB~yG1cHf+xL9Cw41n1ysgVloKtH6m@FTwKO(` zWx*oZqd(JX#}vIdpbHg>9-Me;_&v(Jn7vc?5~?kP_J zz8?MUF*q_0p3zFuWPbXaXsd%Ndx>=T$MC*Qi><22M%5>vhAV^=5#vzvsqfla^~ zWkPDTHh@1kW^G{8QPPTV|FhQyIxK)t%p5^m05M4G7yv=k1^~_+1t8k*pA8^*9YN1* zR6d>oHoaOpnLcWC*yo=;`UrY(Nk-7)>4$;K0`)lUQLgN4h@5{Eglau#Ot{U|o^xfV z90G}`L=+Z5fcFTXdTC zAW$-xqx4nqI$03&y8xl8yi4Ck(iKvb;D)Et5|5}M;2EWY^b}MmUJ4V9_wWZfD)X|j z&hjeHdmtlZldpkduqk7e0s#loKUOIyqAHcaU@@^(u1TbT9u^I7En^kofW1yIUn<}rU@G>)rfTW4KtGxIV zi3wP1axW1j2a3bM^hQOf?_4J^>?Na@rD$269VxdzeVyQm<9 z7pi(isCuia((Hw*o)xNIp{g`{p{m27>RGBvvlptWJyeA{s!FqeP&E_>{2vYaCn==V zzKifaO+w>?FQ!em#wt)1bFthh`gRsx*g@t|Ba8af4n0?~7dQNskc{fUIn|%dHW$o< z%!eU-w|=RMJnbq|=ipErx)?Jq70NmI&h{e`^gex9`kF2cq)omN4;_;%2g9E*!Aawg zNu|+7Z;y=DXrukKpwT#-qNbc^8PRAzOs%evtXU)rQ4(65^ll1zc@v(-x8$Dt9ndij zyAQ)SvM0|kcs_V*Ai8nNi8vJ4tPQuw^1>LrajJ@G#@;`*g(Kt1DzumDVajj#S|#>J z3vwxrx_5xR)j*8M8HAUF61sSxh(`#&$;44b68$MBF~X>&MyNNbc&QH8>6nX7wNw?V zMYIr#p#?Wt(3~#U1}Af14|d^MEnzn0NH{#b@|y?Hy7;$)Y!ecHjtW!I3qfOQ=G98| zSdBR_%CZxjZe-d2Pu6ci!ib5OhIy!Tse}a+{2vNa{@Vcb)B}&BfrOP6Ghq`e49bPY zl?coH|H$w7ry)-}?;W^=x@v9y|5^x&8!NAywRtT$;5)LC7+m>XapiRuk4;ffx?5`t zX|Tv9)-TUFzPh=8Dn?$ykoNh<|2RuuGi_Y9L&C9$sE_xDHZEh?S!J9O-MFl5$B~JR%gT0amWHx|mv@fm&LK2~mbHM$ zAI6BZ@w;*Bm&JZmoT81(ULMMNpQ~&(*P#F{D;68K+dh=BY4Hyr;=6#aY=~2aalPwyUfqoGwu zt2kP8XpE&pporcrAN`6){jzw3L5Ddfn+MiS=F(lNwVuq!lhOqiE03eJQU?0ivze8e z)Fm{?Hd3X@*a(C+SUSDMz2Sx*{f&}!zy2EFsP8-i9`civg2mA+UScYqx@7IJXSK!; zBySD?nRZzxu5U`)aB5YUVxQ2z=tL~)UjeGW#22$LLputq*R@Gn`Q~bskasZq}fX&2#tC-DN3db~(W?vYd5mZm_B(i|WlD_Nr z(2&IPt9$f*S-FhF3WNE7HA@vEIF_*?1i$ z(tXr=8J#tKn)e_*;t&&o}9G?4&vA{hyh%X!rai^5m&+K%V$NL>ext`)?x6KX0TL zAWb;zS&^nTmNam)_%SLxDDasl4X&*Ckw=lni@4`Uy-ghWG3xMRRBXhL5|)vFrYkv# zkagil5CU}%*GHZEI#}pdzdnz>PKkq0H#)i9Wy&Ar<#wE~eH526fWYe2i{^xR(Hr19 zFZ&Jlf_M&_%JY=jXf;ljRhhTUHGGD*EHsK&G$)>56HekRmvPxV$K~fQR5$99#hrP> zOIDm@6Ic49UI-~m1~)BfP6R}HnP`&^xQT({6({(fPN0SFi4G>|Y#g?#W?X#1l58K~ z=8HSGg@O-lrgar;W_(!svsohm0D#GQPn>twcmWwrR=s!Ht>BaG4URe%vMF@7)W2fH z8aQMuxIx$ZXF6Nm4MJ(kMMPlJuO0BzE0q`-`cYpDkxLx(&kq&4AD7^QalcT|fKoB4 z+)Ix^y!G~V#KycLRQ}CE2CGUMc5Edr2?L0%IDjx>;;-NtrOp{jeW17fn|0mHBsiHn zF|2gCe-a;hm$RD#Vp6kX=fc1qTxmn=;Yep!aYglRjCI$~juU?Bp)xhtuDnw7;v1MV zuunI9w|3>O2Y6&w_6AF&i+e2h3?{DRrqDITlU;}Fg<@NO*QG+y1gpmG4g%aIpN7%Iq7caS3*Vl$8+H`fB(`1TYN709tn8EkChtu2U_g(6^0aBJjH~@c za*2`;`DDs0Net=M3l+9)A@cZOo%aFR#|!uwCz%iVz0( zz>iImH_|*r^`jx^Mu8@RIO=WxKq7A!!DfnQ(zw>syL>lXmky12H5^g*H>==GWnzI* zuZAc8$pNqW&kwkT_t(qo;&=;9vqzgkG!W-eJb$o$cqDR!$e{6C4OYI6rx!0pv|B}y zq8A>}(@H&YcMi#6C4DyS#TvehbT91T?_2WWM$sEsgyq8ed&l_yX%H^yM=-?;`@E#( zfswN33WuBg)PsZGxe!1`1HO{tiNba(t%+h}Vo)|xRA7JO+a2~AGjv?aH9biQ$CzUj zb4Rkt4wCI}eC#M)W~Enb&xpscP8Ry|u)`xPsiU>AJ(Vi(xAg;~ZjnGx8Bdc0*lx)v z(H(bW^TeK!E}d=M>}Rd;gwbH!vE7KV5a2O44I+ElvXnmc9z|R%)IF7=NHcYaabXf) zC6nU4iX+itnSk{G$Hg1D)fa<}ZvhR6L{uyj$=x7i(Is~rke2}T=r_(%25^9=>znAg z_i!$i(73*VAKnj6Oca-IwonTg7Fae|-*F5AOFpP%513IaAwX5!+(Ca*Kf4wmTnepA zP~a##YAk>QN+N(@2)c{Km?rk=c8Ye^n_IhJ|7wjd2(bi+{Aif;HSko4_6&zTA8co9Qh^ zjy`F%S|`~x*lgag;Qb++rgQ#!Y0hTM=NwQMr&ZYRZF7Vza+}&FIu7K_HZvP?j^$9- zc1^n5oD;m8x7`*{VT=BVP@3ZkThee#&f5UTRjTpMb; z`E<93&9^<;Zco5N^a5t~qTyaGw>NO?P54n_=C%CL&OT)A({it~*V^kwAqgyr9rm?- z8;=LfReqz}&-RmdxqmUoz25eBZ?M<91MCfUz>s?*qaSE*v;*7jO`cQUB%%G&a#7*U z!2GZFX8YG_kWPPZvA3wdf3trpt>jw)>8)I6QatQizO69#?_~XZ%N=BIvxCYGSUO!B zxq~Sg#xn^o_4;pJ27_-n zh*%Idh>5QBKy>2{C*{b@k~?O~4tmQD>SYIgc<_DJJBY|6)-PQD&38NwT#qMfJg*KD z>^G{u5@cmU+1JFfuSsQJdLehRO&mmaI8z{uoZ*3)3Pz@pHLZpCu!m9gl_E*g%f4om zeGQgzjpuH~B6tZ@5q-ZQ>*vGpr! zO7BqNIw@|ojnogg_UCQ=Qk9%;MIAR9-=!Cf_9rx~lu%zWi#P{9T3O)XCs>Jcw=F2s$&Hpi42ymJ*tHBfG~>cIhabOx{5O|j{#Q9(1-u&KtD^n4D~ECW+BZIea3ffh>#*=B7JG8d^b zSt79GW`!j|e^!wzC(@jH6>fAFAJWZn<61E4$L=s{n!DrnB8zZm!Kmx9nuQ zqH11cMdN3}tD8sRJa44sKfIbIrNTkm>~2GQZJ=!ccFzFpUJT|{P0PL3UWd71}7~W zZ8rfV@uszuGA~=x7X~tL=6uevrdUUg?X)*Gj6?7xM@8E3WgPgjt(QrSQ&*v{&1kq8 z>S}!b!oK*C%8_?TF}?}+Q8gXr(r@F2 z5VIZ|-{$rMz2x7p32ohNU=u4aI7_4H1YRD-!o| zdzrm_vD?A6w;fvU739nzXU<~mHx~RDr0tdVGMVrwnDB*2*!H#~5=PFhw*6S^9m#ql zQ-w^oy?Q>vG}m6!cDti#hHPgWTIA+aVGr8vX?xh7`?|f5oB3@dX?NSZ?Ow|)_Q6W; z({`_87OVwJop`^(hY9K2FoAvb)rWNL>-M+(f>7=0-au1Qc0+X3e70hj|tvqLrhOm~fT|8xp&$-?43jIT{L*Nz02O+b}bsTkVqXi^(bFZWbSZVV28Kd5hRZ!d1T8S#o$NV z0@t>q-9l^I!uf6yS&Qu`cZ@A|$J#M=?0k2eEwba?ZnuYgKw>`so2#L4k|x0=f@+$k!uQ`psbziOTu+xug8T5PAr?)2D5oE{IkGh$mE z+Zj|kQ=@Rs=FHg6;*rI)xpsDdh}P%$an6nHoYulx5oC7c(MCvY?OSI3b(1? zc3*Hi1$V^8|F_4-xI1Ix|676YV*==|*gh89UGYNqao_e1+I~U>pVXuKRBWG&-KS$C z@oCz8Mn!kW_KDc7jqUE(-4h#$dno#BY@dnkvq1ehUdea&#zv3##*5tNef9f%e_x1= z#24ay-Tkrg|L3Xx#n?U<+ZRcFNwfcQY+s7)%RD}y*+0-B^MkS77Q3&+_F(M38XJkP zGVDXb^4C;kU!%>}1>iSg`+DrY8QV8v_pR7SdM8%uytttf>mv!n3}!@i4bLmX@ahM_I{kYO7D81uGmv>B#? z^3^gHsQz*FVqj=X!12YK2W}6gOG_eC|2o{E4=jmvMla*YOOM=^wq-TOR$&ZcsLHdmt%nGmVm!MSd(Y0c31hGrR9CP*fTNe% zwk?9Gml8>JF;{v8O z)WQXvA85|6vXrsOXS?F}RNV0b3mVmsEUfC*=3R>WhXo)zQsS0Atq=FP8Y6e{=Y9P) z{L$sFaqbZeG2u(yacGJdhKFj&kK}k3Eadciv@|@GShT1HoT#pMsUn%+`VZmy$05YV z^*3JHixsDE7YBcSsjp2GFx?-!)QuqI!Y__%WoC|vx5@X+!kQmU*z`khZkty_ZxMzj z-X;pzG6dU0VQJ51+170Wffsj%ehHmz!^&P*;PautwqfY)Y&-YTIvg{bD%;y^zq&`# z2LNri14HlNhkk{0S?)m#cXM2?y94_rMCoiVy5fZTDtR z{WlBj<$gu$Us=ohwYt#`gzw-j#rM3p{9DmS)J^bhZ*Ba>5A-&=E~5xSh=c6l*KHI+ zsN)-b$A{XX8+3daA^AIi^&KtZiFXoA7{SD03MU#*`TnbzqWHA$VSz2^^icf7XB}>b zH-4wO`Y|cZ_6R#7oWz=;XRL}H*|^VF0M?`Is0!QsQi<5R3_~z63vJPmTMS~nm1z@+ z94pw@%GM;t8(qiS@f*tUV_osG|BMXZ@&9D_|H<%J86J-R?+J0=SRtPOPZnYXZvjVJ zSPMWp54R&;hpQI{SFi1kMiuIv?o!0t*4|LW7uv$HBEHBLjS=z1ws=IukFjGa5kEGF z_;GgZh^si{-pknUv-jHj+PI2KN)bN+5$D%dm)g<|Mf~wRpNT`KBPg#J5%qQEVvC+* z|DhVYG}n(BVP9#hbp=$7adc2jO4obvC?T$521DL-TX*C4Uh(n!)B5o-&Vgz1YNIvC z*KvY!wEeaQ^U!9d-$Z2z4=c_>WKnw|^9|ztTlcz2YkK1kUPq$y>&5rHc4FClgc4j~ zXoI{Or4u16RvKoV?S>W};HEZHM|~)K#25Na2b@;cij6wZ-I;T2HiRYrFrm#U#mL(h zE%}8Q`OR&sa@F5Y_(jZ)ML(Ox^%Jc5y=V`-!)3ucT=X34exMIqU!i`s#(30Z@o^5f z59WTz?LeQbtJ^EutoO~~e3d+xSuFY`TH9mMFRb|CYwk=|wV=-E?Beln*K+mzRTRFe z<9O``5@qtkwB~9xx}ZYQ!Y7=ELugq22&+F=ZlUeo_+zj{R2!mNa12=+Ol%LC@~|3T^*3YlW{Do3At6 zfW+R=V#V-)4cYuNd8)YObrp-p#X7dUEiRYKLv;q;IAD1z9X@(&#M0|H8&^$dyj<(IYGGX~(IIdd8WXs1t4nY@b(IOR z3!5(>PtE#RVUJmo7Dw|EZyT3%zzss885%|*%uL6nhHRGcP_0dq^xM#F=cwsCJg{p8 z&*lN1a{ovEsBJaGs&vVqT!Ud-m+(Yz>B`|@gHfm9kiNL|#uU-i=gH;@bEnN*N0g%;7T7Pj}C9( z;xusax0g#vh>O#*<1jyQ@Y=xt8!#}Sy;Y0g|A2qx#-`81zZdTi-%zWVH(@3lo|s^+ z{-{LQDuH3gu8Y-Jaqycz@GME4gy)^(pm=NI*$_C*_ea;q6HAp0Y7^$eqvLF18&%uO zCJ8rt=tRW6FlH~2Qca<>4eS{rB)G>B}*LJ=y)9-5%6h&iI zYU$ldjRmBaAGGonon>P!8d!1 z@XdUjsMp$lZB*YL=)Kn{@Ub`Si^ki7*ylCj7{i|KO^p0z{`|>>wtEXv(VOfogYMrT z##`C|4uExN78l&1LMIJF%IF_3Ogn4?e@Ry?epEC%axFX5T5UIa@r%BW2*el?F^;4WYhUb)9Ho%N+VffXibGV=c8jUKxFW_e zhU|i9?`>e@rY>n9c`Jo@5bzx zxbMYA;(O5WQSGbPqg497#`!^P-;eDFJpNFq{$WYOyF3loshh`QTNk?@#r9b2ejFQ# zAHy_1QRByB`$=q%)A$KBexgICpQ`l9*nS$@la&5Ur9Uf6f9j?5=jzpd9+!gp3u;j3 z7u0F|Wei1sDH8rFwqM5fD@gcjJ^sc&{)We=1mSP>=zbU5Z)5lS*hu^y2>+m>KgPzb z2!D$0kFoo6Y$X0n(bKX0A-1Q1>@U9jufBu7#YW<9Q1tIU_Zgr2Y-}W+g`(>TH99%5Rf(O<4wlT*U+Dp=1`XPS^mwCb6p%cWq+VByLS&B-SK*x$89S^@&}V*!2wiVGaA?q+=v+ zNYK$YCU!$&H}c~AO?tf9KiK+H z+?|P$xRaufC3ah4A7iw;eEG+H2cJlc#3zz{-6wtSr+n_G6C?5IWKZ`Q0eZJS)+Tm$ zVryxCPhwR5Ok(%I9G?|)d@ixiCiXeX?oEvD?tk6+LfzffW}a`z{8 zQ{uju*!_w7Qeq^&1dLx6b3C9Tdw@0%YBpaHS2(TSVKON*u#nYPGXNF z?z@SR_%1~Ho_c;XvF|1JC_R5)J%4|MNI&2Qrri${`$1wqgevRw_?UlujK?1d_8;rf z{Uos;C+_jYNIcFgpHR_H6Z=u(o=ohgiThb%Bz{KG&l7thv7a;AFMRngeFwivjKr@X z(yx8)Z+z}kiII2;BK=l?{!SmiPwaPz{hs!JK*SRJZDN0bNPiTO{*>4s6Z;coe@=|< z|4iy>HTp|pPb1Sj{#8@_YlldGOKe@@{+`(1688)mA+cwG@mXPPy^3r-ZH7~3b7E@4 zsau}fiK$zW8i^I@kXxDBv*?Tzoslxms?<(OZ559vr;KxQ>NN%Zh)AnbTb-6fIz_*X zc?##o^}35fzxR`&FzVFQNS>ND{yIjNo|d9KPfzW%)J{)Z?hHMi=^xMJ@hky&wjSL% zshyp=b5kR6ZaUwcr=s&yJBwo)shyv?3sNI-0Yw+4c3x^10_;V;{9@n12U8>Q!E|4D ziO;>%=U$c?iObSG-Q}9+75ca`wJTD)lJ*};jmnp&_MvppUBv-)cXeu4rFJ!C*Q7@G z*O0najn<@gZE9DC8&V^212Ep0LW!GHWH-^~X3gf7 z)NW4Qt*PCTx{str;v-Pvqp97P+DEB$o5s04wcAp=oyR*g&K)Hs&LCKe+@0#?W2xPl zy1P>QSn58W8i|iH;3w4hlc{|owNKLcQ)>LF5=hQysPr?beLA(zP5F>ZAb3k(O3{~JPVGyneHjLLK#vdl#|L@*istuKJ-UZd`zl8_QX}y- z=J$0KeIvE6r0$!keIs?>N{z&~DEfA4Ur+7ZjP|fEf5dn2ozzHt2Y&dj&;6dyeKa)^ zkHQb%7ob1T2iL&-AhjRTeqCx*{(frf;D^V=4?jxnvDAJ<*^g7B`yZ3~i5fkg+D}q@ zoX00L#V1N+qCHZ3Aazfs_S4k;EHx581IC|=AAX@C`vq-&soDH0wO^+0*Qxy~b-ziC z#Bbn-r&9ZQYEMz=w;Jbnsr@#!-|_f+jr0334*iH9{*c-qD#`q#X!J+X$V+DC{*>CE z(#Er6#PQFPzo%3Cb81h6@4x8rum16`JpN5k{auglnbiKCx@S`(@htGKSJ7~0e@oqo znGI)dd1fS*XY<{P%+{k+vbJ04%TLPG!K%zitjhLvC;QyhKKGQ&NSu=G>E53)xl{GQ z<;SOHb{g$Z&y33N&+PPU(4E1L4!SclJ0r6*DLX4Ox<8B5*=lr7W@l%14v*(%pygaH zI|$+Wd71qsb?0YxUgkcK8Ho=7;|2Uyxw}wBb|Gyp;#D4Zab_1~?t__KoViOfBXLPK z~bEj&^T9wap*_rzf#?ND6=awcNM-y=B~!c$n0tcyhe?$ z&Fq@YuBGuBHC|H!Nf@Kj>odD9v+F7Suu4B%mY(Lt@dov3H)N$a-bfAV+(@0q`Y{x} ziC25v&6(Yl+09&2dy5`#^^dpm_z^+)Q9ZibGW%%eZqJOw?Lc^kitfzpBSbHm-I=+& zG9z&pMIX=Xj?6v|WS{WmpY$DkDl-zFf})@Hxu5a5cV|Z8ZYa7|le$MApUvzZ^abrd zml>7UX7)KKdao$@`ONOk?DLe}ml@sPN9qe|bbn@F$n1U|zbJHku|!AYzLeQ5nfr2P zU&`DAnUQz^7#|cxzoH`h3T?is**uilS2Opu%pS_z*E1vWbtw9c%pT0_8&vwH#`#ue z-^}b=Jbqi_d^?OoKceWv>gJKm9?sl%GJ7O*-_4A~cNy?|YW!$s-^=V#8h>Anzh450 zB2noNGy6eiKcsY>O4pU8{0iT2o6R|D;L%Ssza$y_r2t`@dvHFVZ;+)mHknYo>jyR&j5aTWuft;Xl%c6M&((D+<6J~uR`;5?O{pWAu4olofp zRQiFk^n4$FT%caY&8s7c+VkDGJ5DYu(xe@kvuzA?93@+L#C_EXB9%#H4!B=s{j`gv|Y%kAep z{z6#zMTrH}M{Zxs-LG={W$u2R8;M^7<8MUBr&MH5(dM_B&F^yiZSH=b+wXGshulc~ z0Yd&Ux8LOUM=JeES+uw701|&bL$MybkJ&(g&SL05sQR$E^7s1=POTYW@pp>oSISj%$l838+7M#n}s{CX6M%IJj%|m8Qq^x>H}(YLCro;vkQ2< zum&zJtW_?{MKyaicNf>}qMG|)%}9I@7%!=T^Gj7^m(u1k&F1o&T~>2f)a>$_yRv2^ zuB;8Y57q3Fntg~$S81H9Yj#!5uIBL?jdM*Hhkk_fYxUOHwd{pQ#XZY~<~20~(|l%) zKMzBR8T4?SDqTmVncRn5{>SLoEBkt7dk=G_`*5u=cY|_osI}aUHM_C41$_)h_Tk$2 z`kP|*?U+~Fm&}XGpZ?n&$WH+-_#`>A13-q*lrAv(U+*SGs z^l0?2%5L0m*}-ZT({G}MSs!mCozCdE8iRggM$A_0{rR!|9s|5&WyTj>E?r{jJX_ra z41Hz(S@%7UU(rm-E0gh3ZoRP8hWEX6NmDJ#DOs3i|(eL3h-aK2yFOh}fmF(cx ziSpuQebpTs>$qd1!XZKinG77aXa{2Wx!+Y17P7cP5+shv((gf%#R=9i#@DA&05v&jY>w^KHIJyhXVjU~y4 zcwp#I%myA!=4zL(%os;%%U6$~YyuU}R)9&f@5%<18abG(fslArp zm0H=Uu9pCjf}B6~AXXOxyk||bR&3vDtQ7wgCq6A6`XeM-AGH^R-*FDaDIr)JokW-Z zrWIXP!j&=s4P2zqfpK`*3K*Efj-5B?>zBmb6tKCd#5HOigrGSTxyJtYtTXN-;2seD ztaZfu)a2*IkJc}36$k6SAW>^gd8xYd7aJrD9%PMQ=U&kPZ)NctX0<@@H%{_0p_Qs8 zK`Q!#2Fu@dQNJD+0!- zMef4Q7g^55KsU|fHVp{!&SJAg&3r+isFAH7nODcq|-)#xKh%(2wZ$bxksGEwq zX-VA;$oc*l)s$4KX@sDG!#4u6ge>-u#T8`nKZdO0v=@S9U4W(F+6Z_C7Jq$*Ef6sT zEbmMeu|maat^{6`?LR1zsl`~4tc|L3ppAY~3r2y=D~-2yR<87~*77zenW+916<1{7 zE;#_zlfFS8G>esUk{+Z>UO!%!kosB&D({VDEoqcdwR96kR)0IW8&4}51LWwZ{Rf|G zQpuS5qo4L4Tv&gmr>1+RL{*)vD@9dCCoc_mR%s_8)!{z`V(*8!sDA1_;JdpTh~M_< zuo>wCtb0Ep90q><2vSvvyOTs8ENIXqA zhdrw10b`zgyGo6!U1$@J>D*Hbjt;%AV{oVssZWx%JgLm4P{ya(HR!T=NTrbw1XLV7 zythwGh7rUA!iCj*%6GW}WkRPbJRrVE+@;A_5=5SHH8wnH-Tq^LZiO6l^0N}|LI97! ztn9V|v#d=M@)BuRuUnlk($jftcF}pbl$-9X`#n~B&%Ct}#t+yA*A(qmv&*Z|mEJVy z9!eB+__6m#B7e&?Kld)%%vG#{3rK);1O&-r-H#!6LvzdCV`&%z+f$CwJ7x@?G=>Z< z*MQ0XbDN611XMsaFI@%q?7Dhoh4xH7Teq@n%BF7019Qi2pX6;zm(@Af?-{7RpsBI= z@e?#?Jdc+%WCr;GgBG)wf7u(XhMz9^I9Ix$r?)gCKw$!9wr>*jsc3i8O2$*|(utwZ zil>Hw50^(Eu}1?CsrOnK9vJ{w?i4&p4vP4K3!SX{1TuNn;n(g1ZaQJaQ%Da)f%yBu znIbp@lb%%cBQ)}pYNODIu=EBp4R{PJMgwifuxWn;5N<@W9I>qy_nNTb4(k0ZRg_4$_AP#&qrXc@Q!VUY%rV( z}?pv5rd3 zmZn~<_P&rxMO?iIk5(ruK>3I)ajTuJ<`7)gkzTz|6#h}IlJI7|IFXxsi{-;h@kVg3 zxFIFvkj?M9N&&>YmNHtEH~UKtkVQPeMn7$+Si8bShv|O65fn|(_@j-<0rVa?s$*d* z6ry5bBjP)M!CX9Ms8Y>>@Wcy4*Qict1}l}#q+v$-ubR=>3pY~*WF^RcISqyyoh5XE zpZ<#LnqZj5kz|ePdJ?Pf}fdGz#jmA{xB0pMup2?Yo7ZgHq&zsE$&s1!+d{ zjvMJ2g}@U%OAOU{sTXlSO1+rQ8^6j^@mWQnov5@qp1Ba8_Lu$;Wr{f)IC;$pXc#^4 z8X^}McKaz)j$&Ba)XzpKVx532ZND1zMembWR#h-RlyNI4UGqBQ_yfGtxP-x^7_ya3 zj>s=6)a$Xy)bj-EUMbMXn=Gl~dn$k|X--p!NVL}C#u-?Zi@-c%17EhZso$Yi zH<=9prc_@yPk^VOjLV;iy!#31bc<;%L~K;;S7Ayal8+vx0oK)n2?cER$|ZC}g0UGR zbOb1?u^Ch7XR?nLISe|PBKgA_-3Nggp<#_0(==(~$!H z-piL+M`w-XgM2Us!RihxYMSHniQ61KhW9DKNX4;YU-%*n+wC;*=#0Y%lMY(N2Gu|AZ^&b{X*T$X04LXJm2(L*(zB$ z*&g$3%PJKMwq5X;Y(`x($8=c9wQc6P*}cqhogte*!O1hfT(N?dW95QxvAk(}A)#!U zxu7a<7Hli0`>swjJ!kqR+p=~G+jTee-ZGew%> zux0Dc^@9LAaN3fBhAD=$2U$m6gM1MA$uQr;mw1L=y|wYcguRNP`0wZTOP00l*+EuY$LU> z_7yzeW7nE?#lir&x^0$+Ej>@17$)5xFOeR)S2DAfZd-Z$*%s1av;Zr%VwBvxUbKoN zA7;3fGFlB)ym2<@_^_^0f=;?O?)g?x&zcCKYAaAmZrLms>~X!~n4^dhY4o5oYT5-b zS=L^*uIzeVchH?~7o5G|H*?)I69NkZ(QJKWrSt|Q!)NPU$ARhOBJ!z^A%LH(a*gZ! zLJ{gA*y*DWy`e8((?V@{2BV(>9h#&w$VvRi3p=wR3+BPwTk*>a(T zfP${oF}obI`iyF_H9JzUb9xkS)F^U=7$1Ftt5Y!zPFEr%KG<3WU4a zY^BV0U=_2%36yn5F*9iTY%3#7-HNAU8L((3)J>bLiHV41iEXSnL6p!$Dilk$MZOHC zQW1k~Vm=_sVL5^fs~F9QLCiwGkS{=N8PPwA)|;TZK4Nzpl5;kcR;?zJCWonx z>{Uvbe}SF&QybM%6ykXk*MV{A)M}-iLZL-0YFOXL7R$%Vx|b$S4t{4*xpo$vZDu+F zU+qLRha&y3q~!DPb+8Ie8ni%|H48#5 z6+wjsQik;iE+7b~t1B*+L~CExvT`&mShWiyZb`>=ik2LZ)|n-9s9+cTf{W3@{omMZkr4l?UL~ff``C8%V*V$7nthMo68j1J3Lh5> zR7WZD`LTy$>)G4NSJ{X89`>3NkKGx&F}9TLRxVIJ%}$ChDC^XX%3lOjLz=--Y{rZk z1Vc)aa04AE&0wu5)bmuFDYKFdU5q6)R5mb;ctTFuGCVX#1xRk9di>_7vLum{499AH z)UJANtRlwR3Clw=AmdnDU(*yYT~llUj?sZ712T@a^)*ca+iHrfgykU_ka5JnnV`;` zNyoFNx_arnv$v~KJF1AW>4fDW8IWbc*jZDYMpzz_0U1a9>+M_KzhdRUs?`^) zy?ovJ4I8P|>&s;?j#4i$ z3tfLP5aZox1 z|1+*5{4x|`w5n=M{EbeEwiZl@xOzP`(*++@YMUjQ>QTjf!FSbF#F%;qRh%#I=CYQf zjj8vC6<@CFQG}|1hcW2 zpjvod@WyK41%U|_3HZ6-pQVBfotFgvJQeOG)qW}X+B%O-WAVgesJR)#$$!t2KLmap zSiMJFic?&bwI8S2{XDgO1eQkeDQb49qChePl3`!ax~MAq131z zUU8c0TAvL{y>Adt+p8$CrfY4+u176|sYf7~Dd(jgE;9BKRFEB*#M%v!9RpO`eKP1E z{Zh4r4jL^gWvC9NMK4pS=K{PoL8)s#m3nWbmnhA*ml!(*0MY!&2dR%$5Z!1HY1I?5 z$+b5z)&)Vb_iL!h5;U3pYf^Ga*n5{`SV9cwp<@TtEgeFsWl@>29GE~()1bzdeLrZ_ z_|s|$V^kVr?Doiq@25`Ykgw2Dm+WXx*inb0w6+ z*^w+^0sR}s6kACGgMUh%xD1`dr1vfh{naHW*qUDiog~U=uE-K=J^vQQP6m3aN9gud z*#yfP?|?1JW`-pWrNpaL+7b#&KTM^qDb%&81dY*y;A{OIj=zp1fqpnt~p2hLCz$EpEM_qgfk~-wvI1uqZPxM=5i61_JFQHNV42eS1AR_Lhh(KwP zNy>aSjFuph?jlB(dgNn_eK&I6EhOT8ik90YqDTk3E}i$K(0OU;yr>j-=D|>>Ua7=a zLM39GNXkQ

HoyFt_L_K*rocP~JzC-y%i|iQm+gI{HZ8Z_NW^3&$#N!>Q1tUCy{i zDT=VO<1>sM3h0e;+MEn^NXSL&d(ym?U3W3|1BeE9Ot$)oq%&~?h^itsLzIYh&{e79 z1;|alj6)v&5V2_%P93kK+<7&s)A0oUW(pn|;L>=KP5%b)`Gix6=|2R{5N=2^{7FH^ zz6=IUh{K@A6XJhRN+|Nu*R>ItCD)_PZlX5Mh@}(B>8}D)$R|>4`hNragd1WkSp@hh z2%G?|{Ef7^9Fp2Ji^@lR|tRbdivhFM!gZ zbx=HXoWfxi3GH}+5YakSSe|Z-SH(6a*z~u+{#R5sCKF5?BU!NyfdQIDzMH(P>nusF zj*-s0Iw*h`8*K`28p@_KY*5KlgR~ajhDD1OuANw!XmxV1c+dj!Hs&_X z?}eD8G*N$hkTIHOKfwf{N%FOi!9HXU(M1vVsr#tIFukcp9h*Z#c&VkdDhr$2aa~VO zpVi!|Tr(Xyu3&@h7dBkfpyJ7#E6QLyB6J>TtMHI67BJp?DR$FhFbOs^TnZSchvP&i z+VEy@3OKh~Ky@mEZrZdpU9z^}{27Z?G+}W;>rNoCP>n2bG2dzf2 zi#&t37VS!d2pY_kzJd>CohPdpdvI=ai-?z!)<45pG4{t8rn92F-P}YcXhVvw zMU~exW_ks~bIg)A;`#<&fO=Xa+g>axcy72eH03?rX2@G}41?SovE zv+@Rh3VLrkDmbq3F5Becr@E|f(9a9byWCaezV~vd=%<|b$c5AuexrJCBE!S)On8r- z^WH<_ypoj-ti!cKrOO;|QAA5h?VBdznlHrNI90U7gqWozE)nh8QPFz0n2U-;Ms#U! zi8-3jKd4@%@J?OCj|!nBJ|&WyH9n$VqTsJvi&iZ$PfD7jeOOEbdpo{8^FL= z>=v=l(nazp8mbFhHJ-mxG;91E9pZe!wZj@WGoqQ#)kVi?(F|5}bBW-IVT~IZsKDo= zMmr5{`HkvAMJO6ykWo9aa>FRPW^)krR07XintFbln5QKUSE0HP*H=lNjou@y5ROF9 z<(@B7L_DSLM1vEFVbPL!Tr_EKinLY{oiO4`^^=Ms(tJP{+5~i*0Od-Bib=G9U8~zf z0;mxdwZejq#KmyJi?HOaz>tk(6~9Q=_=ZHDEVu-49bBU(VMi*NT{rs+~kyri*Du zMXxUge6fOP_rs_qL{6buT6ErXDc)qRkggr!m+X-M$wauSJFpjA*$SjO1?rDZKuU_D*Xm>@F(&@ zGT$^o9$KkS+Ddm`d`_*cCh0a;=i#~5);(0E*W0=$v=!vD+xh`wI`<4)-=FZw*m*G4 zP_g$PC@@xAsqyO)M@h{^x;i@uMY=8Im&*C|z7ElLOpeKS56I9-@RQghmPX)!FsR5< zTpPs}*d^DT`Zg_=zoe-Sp( zI&vOX5SsI-orl^7P}`{SUy{YdcN!aLgjPY#eW>9Yf0-=0_ducz(}%x;W*p5@hz~j| zv?APn0P`y{m+r6mt7n?~Ice^1VJ;BN4G|0rku>)#)Tq9$Wdc+(_tCSNduL$oAJ1;? zL}2clRddCB7+m9zI|8f!LRNn~v>Kn!ywmEB)>=(Z6L=LU*QHCReO0ub5Di!bllX|J zLemo{17&GW{&jzbJb9aPWt@c_FoB)@Z*Y}7*-dzYy4->67hBv zJ#}mcg8PDtLl|a1-d_`D^ti^q87R9N%s<*siw6HTlmdjpKqBr_;k<~P$P*Q-eM&nb zlE-ji3&v%-9GCA05*~*HKu7=*X`c#^5Rf5(sEZ&2*FIFiG)%4Uk}ps0S5HF&V1igP zfkfv76}I9+A&VG}BN~4ShEC&8py5*iPYA&SB$_9P-Y*M4iARZw#ZAzh!?N>)WPb|m zPXz2C1UnG1gAVq940ZspC$+<;PQm6wh{d~c!$2$8V}XDlKo%eb0EzYq(fTOLXb8WO z#E@s2^E7w>!2=}HxX?a|@*#{e|1k(%ba6R^QG86}k4S}|0mCB!ZwSE)L<)lr zg#$7a1_%|d_8sW^aKQg8L;->yDAf01^xdiP=Rlwfm%LRuE<1i6t&azcAp|23bqqQ> z4#?;jpvKY1B>M|sKNhfu5bQw24m#KaGS~rX*dLPYKL`6m0ec9+4n*vrgFPUF9iWE& zLCO9S*dGkoLkM;tVh0`U0U7K7U~i`t`GJ7r7hnbi2apgGfmgl^!3f%4f`luX&c75i zMwuWQQ;nF=60d3e{{5%H#DAq6!iur~X<9g5R&;d%T||E;QsJ8!Jmt{NI)gSb8R7QH zNkX`X(jR4pA*t9ol{Ih}WpqaoYsXTc*A3!Y}ciN{Y?MwSw4 zH&7Y|JpvnU-ZqDEzmBG|oXoYp1zy$+#M-6&BqO%j8gs!&tk0``YV_9fQ|zFm_(IZG&O3jq8ma8+OuZa0dZ;H9)27H*DWZ zu2~MJx$Q~8c($aQ^$tXa}m_4Q^~=K7Wo z4D>GVUpbUrfjx(Pz5V9u?7+aPRoQ{Qe6M){b{#Fo?=2lM@{RI9$DImWVi) zGy_9Y_NTR4*mq781N)<~qj}irOotl<4N1qUJ6#K!bj9*z%bF2K2olFkje2*pvxKn$ z-kIGHUadymLT*k=cvXpJ^*PgO3Dv1PH)ZT`&3#%E5abDJmY zXwEDMTvnhrvsA{!SXk49qW`=aWn_q--xbPuM;tFo*Va(5E}mXXsfoxXZBfN!*e$KH zN3pdmQg1SVx+BJ#D9J>O)lldWasz5_%o{52?Gw35u{gfGETZIaIGf4 zT{JteUviY(QpH9{MKZmM ?(-0WCR-V|Z&b=;zxvn~mTKynB5d0I?N|I!8T;H)78 z17P}>CG$B_9>cvx$Sc6wFlcHdh7C;ra_NPU^167~$@*|uWaC2KcXR%R7&YIh1wFhk z9x`7M29In>8V-_Yv&GVtG+!v(u4=+fnV&1T!Ifx}CSz=LbCoR1TM}5n zqai$J-LkbOjuECyxyegrZb%ENvdOYFhBXLI$ffc*ISjy7B0_nDHGGD}Fgt>E93NQ> zx7Q42!72EL=aoj{B@dh7u@7Dg&L3=n1aRTgA6I@9v^QCWHu(iNI(ge2D~f!n;%6NV zU!dSy7FS4Dlwve8H_1A$977Aw(}LC57gAgWEwZDdG1GSoWAV`7eev+NcRX3Wx4t=m zbi4Tv@$iQ0Lt1bJA$c)lqM-7x_SMu z5~K1*6bz&3jbN*H|34D8y^%8TM-_xqk#>Ohe~ie0u3uR3PYQw#-)&%C8A8@gK=C$(VHO2}P;%u$lx$U5JX3b*r%6R* z=)|BcHpS;ES=_~{3A#(I;Ohs4uj}h$ji{mThOAuo(71vbkJ{_s#oOFvEx3&0YH#H6 gZCV94f$GwhVnu!!)je#xL-^2aX@Z{By5a8s17yBa+W-In literal 0 HcmV?d00001 diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/zig/build.zig b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/zig/build.zig new file mode 100644 index 000000000..6bfd17bda --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/zig/build.zig @@ -0,0 +1,16 @@ +const std = @import("std"); +const CrossTarget = std.zig.CrossTarget; + +pub fn build(b: *std.build.Builder) void { + const target = .{.cpu_arch = .wasm32, .os_tag = .wasi}; + const optimize = b.standardOptimizeOption(.{}); + + const exe = b.addExecutable(.{ + .name = "wasi", + .root_source_file = .{ .path = "wasi.zig" }, + .target = target, + .optimize = optimize, + }); + + exe.install(); +} diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/zig/wasi.wasm b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/zig/wasi.wasm new file mode 100644 index 0000000000000000000000000000000000000000..d6a3e0faf1052f2136cac44d662605b58809b217 GIT binary patch literal 10787 zcmbtaYm8gRb)K1fNnY}jyLTnURxGz2(n=!(esEtT*LGpeTD!6;*-|2>$&VD$c9)Wu zyISs&TsL5-q7^wS9PBWW8TK-0n~jG{kUBtHt& zKvTHickU%c$}0!tvB4e$;WFjlOg|%~qcH<|2oT zbh9#k@uGCR7(`ZnCx9=7TU|l+G`8z?Pr^vW9zN@>E-&F@!W}} zW3Bqa($aEEdAETn0OrI}yR*>Ao&L%0(+By;~lww(5S9uX=&iE@)V_ z$0&XU(QgqFgHa=f4CgW5?6t<3j#Jj`DtU7S0{D1#*R=JbzvPsniIEuVIRii-^MP+n zmQ!K)bCU7fx012HN5&ux*M4~Iho8GW9cl|YUeemTWQD$bNrUYY2nV+%56{l)Slw`E z8}i2DwcoI2#py;Q1VIi2D`@}%x87AU6b5+BLmpb>VG?;j!W62eESA&vQ(4kWpNnyl#6|<8)P@*bkM~D@a+u0~VOk!}2Qp)XaP?+gPDPz5- zXjB%UJFNoGnm96;h$aO_?)QYjj39);`V9;MS=xQ$0WaOR~KphR@fL8M+ z3>_%plGlU8o2&{yqs=7<#;3@wx1aL2&^R8P9t}N=&J`gf+J&b6wN)^Vq9-;|O!aId zv6Phc<_jxb`Z?e|Osp6VUZD_oZK9>i5#T3jUbUTVZhWY^toPRT; zM|zxpU#*nrT`{yN z;!!qTq<0X$6g{9+X~bRnRk7mGj=19+ZZ9-!1Hg~C^$mBNy{s#ucXq?A&+jS%Vc4_W z0v@B&F0)Y@YY06g20;MB-R`{``0_D7QP>#l3p!NVK*$kd4n*W`Xh7-xg%lR}#f`Z_ z3WnT!St|5j`xrAr6MS26k8iki2NOp(T)xu+csDvw;EV20J)pe~WA*9V$zlWeydJ(% z*k6NV-q0G}z#3QpTs^+ga$_Cv)xD8vxNwuQ12>c~gJ>x7hK0lAE9Ob-ySG#Wn(Mji zs0ePZU}$H$n5QOkHh&N@?oA3Xi7B!-2RbwebOc)|joMM0JGhJfB|d;a9*t0$ogY%2N-i8ehTioXYE0cU$~PM;nIW!#GS+yl5hTda5! zq6~=gO-zv0t;ndR9=;l&Ydz@UMRgx&FMw`rA>24Ei~^hczG}p-X-C5oh=W$qCk$Lj zveHo0Lv(`98ZL_zh@ck$j=F??JP6<0RYHh_PKW|MRw6piya=1X82vt_7=}f_P{$3p zMF}uKmGm0X*97DfAS5Y}Y(KGrBzg@eBMm-Bz}Uqw@}LTwnP(fh-5YZoMQBJvF9~ZV zyzxt(cS&E2dT8I!D(u?;Yh6UAl6Qq^f@JJ5wNeV~ zdb9TO6+|s5e2N+9$mt?8pAqZj%-QAq-L zoU8-*?F1OChVDWUVV9C7Vlo*kRoKxR7Ga3&u-rn;Wx&oLBN;N18PNPagggy(fR#}2 zF-&I>B}|8m3mMqWKo*|sMkUDXY&Y+%#4r}(jtcYu|$}8 zR>ZE{zmpjT@~q9pr8C`CK-R(QPvH*zHyk%o-^7ItQV}aP0S=@w4`2=k_gFPc4d<$! zjbFS-$>B{GZSU1t4802n$v27xJX(1gNlYUPPE*PAD4rwyu{tC7rZ|Qt%3_<@3l32e zpk@*&H%b9&-r_ck1|V2mWHbgs;d#UVEDT8jL1ed4ju111$$S=Z6?chKPqUm3kQN~# zeE>dd^9Lws6sUj{wMVoNA7K*N`;o_i=xi|?OVe&AhoKamS-YLPEL3G%h(V)f z0-QwU*tG|JA@Q4QH=Q~cyDcP&^-(=YjS|vj@P-Vg=n}DUqs)X6GZv>LUl#Csd$JWo zqN|v*Ec3mkR-pV`taW+_wCA0s zRqiTo=Oo!}V$%l$kIQKy!%i5|geXg}9>5~<1T3Y&Kg5d2K(S^4h75*PZC>hYu7<2e*bUKR0f%i|uNsLhZ0m1$sOMlUw9whhKYQ<2 zW~nWTD<~id^Bx5gO9?WUqG2}M)8+1K^8SR$PC<(#z-cM{eadxxFxW` zh!^2RBYycrW5hG;0WddTfP2Z-AjiT#l`n+uig0yz^cAkFe*S(4G}uk#(O@^>qrq;X zfCjq>2!y+d3>q(V0U8u=Su{wWImT~TE{j7+f9|hej^!Kg=cIVpfF}!#MT0ed zkVfF}51?d+_IJVJ}g2hjKlrw^F)#956_{P z7b-z0eDp0cB=n$YF*n%5F@$)aKzY$04U!4EY0Oe1f=wduL)qS5m>)VUOrkH40uhrG7eXAIkugcTM^Iou z{j7eTO~^({XK=Ln=yjPHryw2?-Jav2?1Y?*rJ4Hk(H|29OQxXN z{fR(i8Ikf3NK%o3c+!-ZBzQ?he;T9Wc~2hk96_sygg`MzUll@=9jeXG7ji(IR5DEG zIg1k-WP4|eDH|riOS^Z}0mLtHcO(NuE2x~KYo!3+t2p-RxWE4bq}+H|sYewf+C@gR z0I^moakCfjS?-m3NYF1gaF9iTF#aJ2%PXM16&q=%sIYPo#}MuvTF=mVOJdvvgnK6L z@sfahz#{qW;#2uh%x&yQun|2^2>P^#5(ne3| z403M^wI3Ux7Gk|)nhp~Ae-L1t^g&6l)clIbEQp0)M6yAZ@TJ7~m`TXiTmdK6C^e%$ z;0u_`VBq}cm#O5DVeK){3~K)kPV9v?8t4E8|0xJ=(Hd-P%hmoyfJZ<4YHw}5n%Q!- z@BV*R`=_l}^R`^=Cjy-N@Vx!cmaDNeAJ8e&Lw|rrBnX<^h2VjajAD1&4FYH(!PRc?jq9BXNgji1!w;MBMUKF|ka{SDf7#sH2XHHa{Sv z#s&lw@C-Sv?M)TzJ^TIgpwHg}BXu}+7n+=weO&Z1ZBKHJaat@7W ztYl5H{kVA=8GcbKuwo=8#!2!Yxu^(;N%DK_RgD^DUBs|#4awjm?o0Z0svbb__7H*} z^$|cU*EDE|?_cOB>QRj_$z3K=jf9YJdWaK~aANo}kMmy;7Jvds?Fw0puEzYofFchk z821U^uDnu8CZa0#K)1v#$!6FgBgk{t=f8hX>q~Lh$I0By6BcxgPRh zi?R{oX}_>&0SsftPS0Z#6AOBiZ7)rcM}`R{sqjTo!iD*d#s%aWn;pY-w49G6OW+TWt$Oaedg1pX`CK8qQ6GW?sEeCSGhxFcX>*EJ}s9Tv?HMF<&0diRTsR z7X2%${>7ni_@OTjpBOS=oyY{++QfdgxWkM~rGY!lkK@AX1^Au&H-3Xwjr*)!&UY!R zc3B7`jv3((jF*Pl_ix&6UZaRP;a-LY$_oTspWq--Zxl1!37WmQH1TR;v*#~dfp4(-OuI}66;~IfNzUWhRPHeJ13!jkid=#b3t^x zl}+<8E#=A0XlR4*8K@6)At_(>%wl|$BFLwULi{8E&g+2)cM)BX=$+Yse|eo2FGZ2w zxpg))Eja@Y|7G~9D+x}}0t)?6)T8bygQVruF7HBd3$Y8=ozd4xxCCDJ94;o5*~^;# zTdx3El2X@J;vSubEVgkGtcUGv5K`ty* z=J7p^0MvmRenE}Evd)6r?@`53DF8v@7D;JMA+C#+on&^O%>hL1Z4-bP`&>El118cW?0m?rd zU#5 zf{^OD%cc?gouAZsA`YI3!oWQDn(3toAJ;2l6uf<;&p=O!A%@UIudI0>5jBsDkndp3 zNYDg_gT~h^uzAqO3=oFj4dJEoJCp07R!SNCdHB2eiPZe^YJGOIeNOGeFM$^0$HSYQ z!zZ4SpQWh7r|Yc~tIad&z}h;7H#_)N&$Kqz78g48B^gxh&QcSjPdAUQFD%v%)lYOV zw9rwl`g$GB5&VqDt@7tZ=jP5Xw>xdM+Ez!;wLA4wpRBi=o2|uqn>gyNmRjgwbiHFc zO}n{vrnRtcG1_dYf#2`oCqs|mW&P}WeGw$QAE5UGpDm!CZg%$JCr$_2{C=Xjwgwc- z%{7ow@64V%Qm?l_*r`LyYb%GE&2{yu&WYMwvJRj-%WInpgja`}iz~mj++2-&pnZ8w z;de;#TcuAoH&>TtR{^1(#?OqNX*Lfv*G@t@ox}Jk(|oh_Y5Z_#86(6_@vh?a+}dIj zNKT4AFlBZ*elO$o_R&p9;UpyfxcwAVb_(=#fD9}$XtSzm^^Pgxg)z_QLYaJ4a-(%H5Wo!ou0s_VJ&CRtX zp=qc?_S+aay1BmIY(WVMthGcK?l*&7a_KLu%o)+xlYO@VF*ov2OBOqM6dCnqK+C#NQ-Co7ZH$=c-1 zRC#KAYGP_~YHDhFsxnobs!h#Im#4?4C#EN-r>3W;E7R5K+Vo7NTp6!SR3l_#mq! z&vQ>7erDf+Pv#I57$e?HMJkd2F&Hs?bq$|h++eBNd+xP_zV(Bmvj2GiSVQ#IO{BP1 z4gCP^W9aA6rgfy!Xg%}`XwN6(_hX#%E~9@J+Rdc@RrEiC{>RZ0&uhRpiuQFchX3yb zu8482_ieys(O$(k`>28h?_$#aM>2j4aOD3v^vBRXjh6H@lK0!ua@{iENLK;<6x#Ec yMfd|4=lh-LldkWezYXmV0Jj6}Qy3pXJB|KMv|mcbznS#MlKG0+T!leT?*9i0bM6xW literal 0 HcmV?d00001 diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/zig/wasi.zig b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/zig/wasi.zig new file mode 100644 index 000000000..227526bc1 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/testdata/zig/wasi.zig @@ -0,0 +1,50 @@ +const std = @import("std"); +const os = std.os; +const fs = std.fs; +const allocator = std.heap.page_allocator; +const preopensAlloc = std.fs.wasi.preopensAlloc; +const stdout = std.io.getStdOut().writer(); + +pub fn main() !void { + // Allocate arguments from the the operating system. + const args = try std.process.argsAlloc(allocator); + defer std.process.argsFree(allocator, args); + + if (std.mem.eql(u8, args[1], "ls")) { + // TODO: This only looks at fd 3. See #14678 + var dir = std.fs.cwd().openIterableDir(args[2], .{}) catch |err| switch (err) { + error.NotDir => { + try stdout.print("ENOTDIR\n", .{}); + return; + }, + else => { + try stdout.print("./{}\n", .{err}); + return; + }, + }; + + try ls(dir); + if (args.len > 3 and std.mem.eql(u8, args[3], "repeat")) { + try ls(dir); + } + } else if (std.mem.eql(u8, args[1], "stat")) { + try stdout.print("stdin isatty: {}\n", .{os.isatty(0)}); + try stdout.print("stdout isatty: {}\n", .{os.isatty(1)}); + try stdout.print("stderr isatty: {}\n", .{os.isatty(2)}); + try stdout.print("/ isatty: {}\n", .{os.isatty(3)}); + } else if (std.mem.eql(u8, args[1], "preopen")) { + var wasi_preopens = try preopensAlloc(allocator); + // fs.wasi.Preopens does not have a free function + + for (wasi_preopens.names, 0..) |preopen, i| { + try stdout.print("{}: {s}\n", .{ i, preopen }); + } + } +} + +fn ls(dir: std.fs.IterableDir) !void { + var iter = dir.iterate(); + while (try iter.next()) |entry| { + try stdout.print("./{s}\n", .{entry.name}); + } +} diff --git a/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/wasi.go b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/wasi.go new file mode 100644 index 000000000..4ef41d501 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1/wasi.go @@ -0,0 +1,314 @@ +// Package wasi_snapshot_preview1 contains Go-defined functions to access +// system calls, such as opening a file, similar to Go's x/sys package. These +// are accessible from WebAssembly-defined functions via importing ModuleName. +// All WASI functions return a single Errno result: ErrnoSuccess on success. +// +// e.g. Call Instantiate before instantiating any wasm binary that imports +// "wasi_snapshot_preview1", Otherwise, it will error due to missing imports. +// +// ctx := context.Background() +// r := wazero.NewRuntime(ctx) +// defer r.Close(ctx) // This closes everything this Runtime created. +// +// wasi_snapshot_preview1.MustInstantiate(ctx, r) +// mod, _ := r.Instantiate(ctx, wasm) +// +// See https://github.com/WebAssembly/WASI +package wasi_snapshot_preview1 + +import ( + "context" + "encoding/binary" + + "github.com/tetratelabs/wazero" + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/wasip1" + "github.com/tetratelabs/wazero/internal/wasm" +) + +// ModuleName is the module name WASI functions are exported into. +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md +const ModuleName = wasip1.InternalModuleName + +const i32, i64 = wasm.ValueTypeI32, wasm.ValueTypeI64 + +var le = binary.LittleEndian + +// MustInstantiate calls Instantiate or panics on error. +// +// This is a simpler function for those who know the module ModuleName is not +// already instantiated, and don't need to unload it. +func MustInstantiate(ctx context.Context, r wazero.Runtime) { + if _, err := Instantiate(ctx, r); err != nil { + panic(err) + } +} + +// Instantiate instantiates the ModuleName module into the runtime. +// +// # Notes +// +// - Failure cases are documented on wazero.Runtime InstantiateModule. +// - Closing the wazero.Runtime has the same effect as closing the result. +func Instantiate(ctx context.Context, r wazero.Runtime) (api.Closer, error) { + return NewBuilder(r).Instantiate(ctx) +} + +// Builder configures the ModuleName module for later use via Compile or Instantiate. +// +// # Notes +// +// - This is an interface for decoupling, not third-party implementations. +// All implementations are in wazero. +type Builder interface { + // Compile compiles the ModuleName module. Call this before Instantiate. + // + // Note: This has the same effect as the same function on wazero.HostModuleBuilder. + Compile(context.Context) (wazero.CompiledModule, error) + + // Instantiate instantiates the ModuleName module and returns a function to close it. + // + // Note: This has the same effect as the same function on wazero.HostModuleBuilder. + Instantiate(context.Context) (api.Closer, error) +} + +// NewBuilder returns a new Builder. +func NewBuilder(r wazero.Runtime) Builder { + return &builder{r} +} + +type builder struct{ r wazero.Runtime } + +// hostModuleBuilder returns a new wazero.HostModuleBuilder for ModuleName +func (b *builder) hostModuleBuilder() wazero.HostModuleBuilder { + ret := b.r.NewHostModuleBuilder(ModuleName) + exportFunctions(ret) + return ret +} + +// Compile implements Builder.Compile +func (b *builder) Compile(ctx context.Context) (wazero.CompiledModule, error) { + return b.hostModuleBuilder().Compile(ctx) +} + +// Instantiate implements Builder.Instantiate +func (b *builder) Instantiate(ctx context.Context) (api.Closer, error) { + return b.hostModuleBuilder().Instantiate(ctx) +} + +// FunctionExporter exports functions into a wazero.HostModuleBuilder. +// +// # Notes +// +// - This is an interface for decoupling, not third-party implementations. +// All implementations are in wazero. +type FunctionExporter interface { + ExportFunctions(wazero.HostModuleBuilder) +} + +// NewFunctionExporter returns a new FunctionExporter. This is used for the +// following two use cases: +// - Overriding a builtin function with an alternate implementation. +// - Exporting functions to the module "wasi_unstable" for legacy code. +// +// # Example of overriding default behavior +// +// // Export the default WASI functions. +// wasiBuilder := r.NewHostModuleBuilder(ModuleName) +// wasi_snapshot_preview1.NewFunctionExporter().ExportFunctions(wasiBuilder) +// +// // Subsequent calls to NewFunctionBuilder override built-in exports. +// wasiBuilder.NewFunctionBuilder(). +// WithFunc(func(ctx context.Context, mod api.Module, exitCode uint32) { +// // your custom logic +// }).Export("proc_exit") +// +// # Example of using the old module name for WASI +// +// // Instantiate the current WASI functions under the wasi_unstable +// // instead of wasi_snapshot_preview1. +// wasiBuilder := r.NewHostModuleBuilder("wasi_unstable") +// wasi_snapshot_preview1.NewFunctionExporter().ExportFunctions(wasiBuilder) +// _, err := wasiBuilder.Instantiate(testCtx, r) +func NewFunctionExporter() FunctionExporter { + return &functionExporter{} +} + +type functionExporter struct{} + +// ExportFunctions implements FunctionExporter.ExportFunctions +func (functionExporter) ExportFunctions(builder wazero.HostModuleBuilder) { + exportFunctions(builder) +} + +// ## Translation notes +// ### String +// WebAssembly 1.0 has no string type, so any string input parameter expands to two uint32 parameters: offset +// and length. +// +// ### iovec_array +// `iovec_array` is encoded as two uin32le values (i32): offset and count. +// +// ### Result +// Each result besides Errno is always an uint32 parameter. WebAssembly 1.0 can have up to one result, +// which is already used by Errno. This forces other results to be parameters. A result parameter is a memory +// offset to write the result to. As memory offsets are uint32, each parameter representing a result is uint32. +// +// ### Errno +// The WASI specification is sometimes ambiguous resulting in some runtimes interpreting the same function ways. +// Errno mappings are not defined in WASI, yet, so these mappings are best efforts by maintainers. When in doubt +// about portability, first look at /RATIONALE.md and if needed an issue on +// https://github.com/WebAssembly/WASI/issues +// +// ## Memory +// In WebAssembly 1.0 (20191205), there may be up to one Memory per store, which means api.Memory is always the +// wasm.Store Memories index zero: `store.Memories[0].Buffer` +// +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md +// See https://github.com/WebAssembly/WASI/issues/215 +// See https://wwa.w3.org/TR/2019/REC-wasm-core-1-20191205/#memory-instances%E2%91%A0. + +// exportFunctions adds all go functions that implement wasi. +// These should be exported in the module named ModuleName. +func exportFunctions(builder wazero.HostModuleBuilder) { + exporter := builder.(wasm.HostFuncExporter) + + // Note: these are ordered per spec for consistency even if the resulting + // map can't guarantee that. + // See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#functions + exporter.ExportHostFunc(argsGet) + exporter.ExportHostFunc(argsSizesGet) + exporter.ExportHostFunc(environGet) + exporter.ExportHostFunc(environSizesGet) + exporter.ExportHostFunc(clockResGet) + exporter.ExportHostFunc(clockTimeGet) + exporter.ExportHostFunc(fdAdvise) + exporter.ExportHostFunc(fdAllocate) + exporter.ExportHostFunc(fdClose) + exporter.ExportHostFunc(fdDatasync) + exporter.ExportHostFunc(fdFdstatGet) + exporter.ExportHostFunc(fdFdstatSetFlags) + exporter.ExportHostFunc(fdFdstatSetRights) + exporter.ExportHostFunc(fdFilestatGet) + exporter.ExportHostFunc(fdFilestatSetSize) + exporter.ExportHostFunc(fdFilestatSetTimes) + exporter.ExportHostFunc(fdPread) + exporter.ExportHostFunc(fdPrestatGet) + exporter.ExportHostFunc(fdPrestatDirName) + exporter.ExportHostFunc(fdPwrite) + exporter.ExportHostFunc(fdRead) + exporter.ExportHostFunc(fdReaddir) + exporter.ExportHostFunc(fdRenumber) + exporter.ExportHostFunc(fdSeek) + exporter.ExportHostFunc(fdSync) + exporter.ExportHostFunc(fdTell) + exporter.ExportHostFunc(fdWrite) + exporter.ExportHostFunc(pathCreateDirectory) + exporter.ExportHostFunc(pathFilestatGet) + exporter.ExportHostFunc(pathFilestatSetTimes) + exporter.ExportHostFunc(pathLink) + exporter.ExportHostFunc(pathOpen) + exporter.ExportHostFunc(pathReadlink) + exporter.ExportHostFunc(pathRemoveDirectory) + exporter.ExportHostFunc(pathRename) + exporter.ExportHostFunc(pathSymlink) + exporter.ExportHostFunc(pathUnlinkFile) + exporter.ExportHostFunc(pollOneoff) + exporter.ExportHostFunc(procExit) + exporter.ExportHostFunc(procRaise) + exporter.ExportHostFunc(schedYield) + exporter.ExportHostFunc(randomGet) + exporter.ExportHostFunc(sockAccept) + exporter.ExportHostFunc(sockRecv) + exporter.ExportHostFunc(sockSend) + exporter.ExportHostFunc(sockShutdown) +} + +// writeOffsetsAndNullTerminatedValues is used to write NUL-terminated values +// for args or environ, given a pre-defined bytesLen (which includes NUL +// terminators). +func writeOffsetsAndNullTerminatedValues(mem api.Memory, values [][]byte, offsets, bytes, bytesLen uint32) sys.Errno { + // The caller may not place bytes directly after offsets, so we have to + // read them independently. + valuesLen := len(values) + offsetsLen := uint32(valuesLen * 4) // uint32Le + offsetsBuf, ok := mem.Read(offsets, offsetsLen) + if !ok { + return sys.EFAULT + } + bytesBuf, ok := mem.Read(bytes, bytesLen) + if !ok { + return sys.EFAULT + } + + // Loop through the values, first writing the location of its data to + // offsetsBuf[oI], then its NUL-terminated data at bytesBuf[bI] + var oI, bI uint32 + for _, value := range values { + // Go can't guarantee inlining as there's not //go:inline directive. + // This inlines uint32 little-endian encoding instead. + bytesOffset := bytes + bI + offsetsBuf[oI] = byte(bytesOffset) + offsetsBuf[oI+1] = byte(bytesOffset >> 8) + offsetsBuf[oI+2] = byte(bytesOffset >> 16) + offsetsBuf[oI+3] = byte(bytesOffset >> 24) + oI += 4 // size of uint32 we just wrote + + // Write the next value to memory with a NUL terminator + copy(bytesBuf[bI:], value) + bI += uint32(len(value)) + bytesBuf[bI] = 0 // NUL terminator + bI++ + } + + return 0 +} + +func newHostFunc( + name string, + goFunc wasiFunc, + paramTypes []api.ValueType, + paramNames ...string, +) *wasm.HostFunc { + return &wasm.HostFunc{ + ExportName: name, + Name: name, + ParamTypes: paramTypes, + ParamNames: paramNames, + ResultTypes: []api.ValueType{i32}, + ResultNames: []string{"errno"}, + Code: wasm.Code{GoFunc: goFunc}, + } +} + +// wasiFunc special cases that all WASI functions return a single Errno +// result. The returned value will be written back to the stack at index zero. +type wasiFunc func(ctx context.Context, mod api.Module, params []uint64) sys.Errno + +// Call implements the same method as documented on api.GoModuleFunction. +func (f wasiFunc) Call(ctx context.Context, mod api.Module, stack []uint64) { + // Write the result back onto the stack + errno := f(ctx, mod, stack) + if errno != 0 { + stack[0] = uint64(wasip1.ToErrno(errno)) + } else { // special case ass ErrnoSuccess is zero + stack[0] = 0 + } +} + +// stubFunction stubs for GrainLang per #271. +func stubFunction(name string, paramTypes []wasm.ValueType, paramNames ...string) *wasm.HostFunc { + return &wasm.HostFunc{ + ExportName: name, + Name: name, + ParamTypes: paramTypes, + ParamNames: paramNames, + ResultTypes: []api.ValueType{i32}, + ResultNames: []string{"errno"}, + Code: wasm.Code{ + GoFunc: api.GoModuleFunc(func(_ context.Context, _ api.Module, stack []uint64) { stack[0] = uint64(wasip1.ErrnoNosys) }), + }, + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/asm/amd64/assembler.go b/vendor/github.com/tetratelabs/wazero/internal/asm/amd64/assembler.go new file mode 100644 index 000000000..d247f5564 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/asm/amd64/assembler.go @@ -0,0 +1,98 @@ +package amd64 + +import ( + "github.com/tetratelabs/wazero/internal/asm" +) + +// Assembler is the interface used by amd64 compiler. +type Assembler interface { + asm.AssemblerBase + + // CompileJumpToMemory adds jump-type instruction whose destination is stored in the memory address specified by `baseReg+offset`, + // and returns the corresponding Node in the assembled linked list. + CompileJumpToMemory(jmpInstruction asm.Instruction, baseReg asm.Register, offset asm.ConstantValue) + + // CompileRegisterToRegisterWithArg adds an instruction where source and destination + // are `from` and `to` registers. + CompileRegisterToRegisterWithArg(instruction asm.Instruction, from, to asm.Register, arg byte) + + // CompileMemoryWithIndexToRegister adds an instruction where source operand is the memory address + // specified as `srcBaseReg + srcOffsetConst + srcIndex*srcScale` and destination is the register `dstReg`. + // Note: sourceScale must be one of 1, 2, 4, 8. + CompileMemoryWithIndexToRegister( + instruction asm.Instruction, + srcBaseReg asm.Register, + srcOffsetConst int64, + srcIndex asm.Register, + srcScale int16, + dstReg asm.Register, + ) + + // CompileMemoryWithIndexAndArgToRegister is the same as CompileMemoryWithIndexToRegister except that this + // also accepts one argument. + CompileMemoryWithIndexAndArgToRegister( + instruction asm.Instruction, + srcBaseReg asm.Register, + srcOffsetConst int64, + srcIndex asm.Register, + srcScale int16, + dstReg asm.Register, + arg byte, + ) + + // CompileRegisterToMemoryWithIndex adds an instruction where source operand is the register `srcReg`, + // and the destination is the memory address specified as `dstBaseReg + dstOffsetConst + dstIndex*dstScale` + // Note: dstScale must be one of 1, 2, 4, 8. + CompileRegisterToMemoryWithIndex( + instruction asm.Instruction, + srcReg asm.Register, + dstBaseReg asm.Register, + dstOffsetConst int64, + dstIndex asm.Register, + dstScale int16, + ) + + // CompileRegisterToMemoryWithIndexAndArg is the same as CompileRegisterToMemoryWithIndex except that this + // also accepts one argument. + CompileRegisterToMemoryWithIndexAndArg( + instruction asm.Instruction, + srcReg asm.Register, + dstBaseReg asm.Register, + dstOffsetConst int64, + dstIndex asm.Register, + dstScale int16, + arg byte, + ) + + // CompileRegisterToConst adds an instruction where source operand is the register `srcRegister`, + // and the destination is the const `value`. + CompileRegisterToConst(instruction asm.Instruction, srcRegister asm.Register, value int64) asm.Node + + // CompileRegisterToNone adds an instruction where source operand is the register `register`, + // and there's no destination operand. + CompileRegisterToNone(instruction asm.Instruction, register asm.Register) + + // CompileNoneToRegister adds an instruction where destination operand is the register `register`, + // and there's no source operand. + CompileNoneToRegister(instruction asm.Instruction, register asm.Register) + + // CompileNoneToMemory adds an instruction where destination operand is the memory address specified + // as `baseReg+offset`. and there's no source operand. + CompileNoneToMemory(instruction asm.Instruction, baseReg asm.Register, offset int64) + + // CompileConstToMemory adds an instruction where source operand is the constant `value` and + // the destination is the memory address specified as `dstBaseReg+dstOffset`. + CompileConstToMemory(instruction asm.Instruction, value int64, dstBaseReg asm.Register, dstOffset int64) asm.Node + + // CompileMemoryToConst adds an instruction where source operand is the memory address, and + // the destination is the constant `value`. + CompileMemoryToConst(instruction asm.Instruction, srcBaseReg asm.Register, srcOffset int64, value int64) asm.Node + + // CompileStaticConstToRegister adds an instruction where the source operand is asm.StaticConst located in the + // memory and the destination is the dstReg. + CompileStaticConstToRegister(instruction asm.Instruction, c *asm.StaticConst, dstReg asm.Register) error + + // CompileRegisterToStaticConst adds an instruction where the destination operand is asm.StaticConst located in the + // memory and the source is the srcReg. + CompileRegisterToStaticConst(instruction asm.Instruction, srcReg asm.Register, c *asm.StaticConst) error +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/asm/amd64/consts.go b/vendor/github.com/tetratelabs/wazero/internal/asm/amd64/consts.go new file mode 100644 index 000000000..add64257b --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/asm/amd64/consts.go @@ -0,0 +1,1248 @@ +package amd64 + +import ( + "fmt" + + "github.com/tetratelabs/wazero/internal/asm" +) + +// AMD64-specific conditional register states. +// +// See https://www.lri.fr/~filliatr/ens/compil/x86-64.pdf +// See https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf +const ( + // ConditionalRegisterStateE is the e (equal to zero) condition code + ConditionalRegisterStateE = asm.ConditionalRegisterStateUnset + 1 + iota // ZF equal to zero + // ConditionalRegisterStateNE is the ne (not equal to zero) condition code + ConditionalRegisterStateNE // ĖœZF not equal to zero + // ConditionalRegisterStateS is the s (negative) condition code + ConditionalRegisterStateS // SF negative + // ConditionalRegisterStateNS is the ns (non-negative) condition code + ConditionalRegisterStateNS // ĖœSF non-negative + // ConditionalRegisterStateG is the g (greater) condition code + ConditionalRegisterStateG // Ėœ(SF xor OF) & Ėœ ZF greater (signed >) + // ConditionalRegisterStateGE is the ge (greater or equal) condition code + ConditionalRegisterStateGE // Ėœ(SF xor OF) greater or equal (signed >=) + // ConditionalRegisterStateL is the l (less) condition code + ConditionalRegisterStateL // SF xor OF less (signed <) + // ConditionalRegisterStateLE is the le (less or equal) condition code + ConditionalRegisterStateLE // (SF xor OF) | ZF less or equal (signed <=) + // ConditionalRegisterStateA is the a (above) condition code + ConditionalRegisterStateA // ĖœCF & ĖœZF above (unsigned >) + // ConditionalRegisterStateAE is the ae (above or equal) condition code + ConditionalRegisterStateAE // ĖœCF above or equal (unsigned >=) + // ConditionalRegisterStateB is the b (below) condition code + ConditionalRegisterStateB // CF below (unsigned <) + // ConditionalRegisterStateBE is the be (below or equal) condition code + ConditionalRegisterStateBE // CF | ZF below or equal (unsigned <=) +) + +// AMD64-specific instructions. +// +// Note: This only defines amd64 instructions used by wazero's compiler. +// Note: Naming conventions intentionally match the Go assembler: https://go.dev/doc/asm +// See https://www.felixcloutier.com/x86/index.html +const ( + // NONE is not a real instruction but represents the lack of an instruction + NONE asm.Instruction = iota + // ADDL is the ADD instruction in 32-bit mode. https://www.felixcloutier.com/x86/add + ADDL + // ADDQ is the ADD instruction in 64-bit mode. https://www.felixcloutier.com/x86/add + ADDQ + // ADDSD is the ADDSD instruction. https://www.felixcloutier.com/x86/addsd + ADDSD + // ADDSS is the ADDSS instruction. https://www.felixcloutier.com/x86/addss + ADDSS + // ANDL is the AND instruction in 32-bit mode. https://www.felixcloutier.com/x86/and + ANDL + // ANDPD is the ANDPD instruction. https://www.felixcloutier.com/x86/andpd + ANDPD + // ANDPS is the ANDPS instruction. https://www.felixcloutier.com/x86/andps + ANDPS + // ANDQ is the AND instruction in 64-bit mode. https://www.felixcloutier.com/x86/and + ANDQ + // BSRL is the BSR instruction in 32-bit mode. https://www.felixcloutier.com/x86/bsr + BSRL + // BSRQ is the BSR instruction in 64-bit mode. https://www.felixcloutier.com/x86/bsr + BSRQ + // CDQ is the CDQ instruction. https://www.felixcloutier.com/x86/cwd:cdq:cqo + CDQ + // CLD is the CLD instruction. https://www.felixcloutier.com/x86/cld + CLD + // CMOVQCS is the CMOVC (move if carry) instruction in 64-bit mode. https://www.felixcloutier.com/x86/cmovcc + CMOVQCS + // CMPL is the CMP instruction in 32-bit mode. https://www.felixcloutier.com/x86/cmp + CMPL + // CMPQ is the CMP instruction in 64-bit mode. https://www.felixcloutier.com/x86/cmp + CMPQ + // COMISD is the COMISD instruction. https://www.felixcloutier.com/x86/comisd + COMISD + // COMISS is the COMISS instruction. https://www.felixcloutier.com/x86/comiss + COMISS + // CQO is the CQO instruction. https://www.felixcloutier.com/x86/cwd:cdq:cqo + CQO + // CVTSD2SS is the CVTSD2SS instruction. https://www.felixcloutier.com/x86/cvtsd2ss + CVTSD2SS + // CVTSL2SD is the CVTSI2SD instruction in 32-bit mode. https://www.felixcloutier.com/x86/cvtsi2sd + CVTSL2SD + // CVTSL2SS is the CVTSI2SS instruction in 32-bit mode. https://www.felixcloutier.com/x86/cvtsi2ss + CVTSL2SS + // CVTSQ2SD is the CVTSI2SD instruction in 64-bit mode. https://www.felixcloutier.com/x86/cvtsi2sd + CVTSQ2SD + // CVTSQ2SS is the CVTSI2SS instruction in 64-bit mode. https://www.felixcloutier.com/x86/cvtsi2ss + CVTSQ2SS + // CVTSS2SD is the CVTSS2SD instruction. https://www.felixcloutier.com/x86/cvtss2sd + CVTSS2SD + // CVTTSD2SL is the CVTTSD2SI instruction in 32-bit mode. https://www.felixcloutier.com/x86/cvttsd2si + CVTTSD2SL + // CVTTSD2SQ is the CVTTSD2SI instruction in 64-bit mode. https://www.felixcloutier.com/x86/cvttsd2si + CVTTSD2SQ + // CVTTSS2SL is the CVTTSS2SI instruction in 32-bit mode. https://www.felixcloutier.com/x86/cvttss2si + CVTTSS2SL + // CVTTSS2SQ is the CVTTSS2SI instruction in 64-bit mode. https://www.felixcloutier.com/x86/cvttss2si + CVTTSS2SQ + // DECQ is the DEC instruction in 64-bit mode. https://www.felixcloutier.com/x86/dec + DECQ + // DIVL is the DIV instruction in 32-bit mode. https://www.felixcloutier.com/x86/div + DIVL + // DIVQ is the DIV instruction in 64-bit mode. https://www.felixcloutier.com/x86/div + DIVQ + // DIVSD is the DIVSD instruction. https://www.felixcloutier.com/x86/divsd + DIVSD + // DIVSS is the DIVSS instruction. https://www.felixcloutier.com/x86/divss + DIVSS + // IDIVL is the IDIV instruction in 32-bit mode. https://www.felixcloutier.com/x86/idiv + IDIVL + // IDIVQ is the IDIV instruction in 64-bit mode. https://www.felixcloutier.com/x86/idiv + IDIVQ + // INCQ is the INC instruction in 64-bit mode. https://www.felixcloutier.com/x86/inc + INCQ + // JCC is the JAE (jump if above or equal) instruction. https://www.felixcloutier.com/x86/jcc + JCC + // JCS is the JB (jump if below) instruction. https://www.felixcloutier.com/x86/jcc + JCS + // JEQ is the JE (jump if equal) instruction. https://www.felixcloutier.com/x86/jcc + JEQ + // JGE is the JGE (jump if greater or equal) instruction. https://www.felixcloutier.com/x86/jcc + JGE + // JGT is the JG (jump if greater) instruction. https://www.felixcloutier.com/x86/jcc + JGT + // JHI is the JNBE (jump if not below or equal) instruction. https://www.felixcloutier.com/x86/jcc + JHI + // JLE is the JLE (jump if less or equal) instruction. https://www.felixcloutier.com/x86/jcc + JLE + // JLS is the JNA (jump if not above) instruction. https://www.felixcloutier.com/x86/jcc + JLS + // JLT is the JL (jump if less) instruction. https://www.felixcloutier.com/x86/jcc + JLT + // JMI is the JS (jump if sign) instruction. https://www.felixcloutier.com/x86/jcc + JMI + // JNE is the JNE (jump if not equal) instruction. https://www.felixcloutier.com/x86/jcc + JNE + // JPC is the JPO (jump if parity odd) instruction. https://www.felixcloutier.com/x86/jcc + JPC + // JPL is the JNS (jump if not sign) instruction. https://www.felixcloutier.com/x86/jcc + JPL + // JPS is the JPE (jump if parity even) instruction. https://www.felixcloutier.com/x86/jcc + JPS + // LEAQ is the LEA instruction in 64-bit mode. https://www.felixcloutier.com/x86/lea + LEAQ + // LZCNTL is the LZCNT instruction in 32-bit mode. https://www.felixcloutier.com/x86/lzcnt + LZCNTL + // LZCNTQ is the LZCNT instruction in 64-bit mode. https://www.felixcloutier.com/x86/lzcnt + LZCNTQ + // MAXSD is the MAXSD instruction. https://www.felixcloutier.com/x86/maxsd + MAXSD + // MAXSS is the MAXSS instruction. https://www.felixcloutier.com/x86/maxss + MAXSS + // MINSD is the MINSD instruction. https://www.felixcloutier.com/x86/minsd + MINSD + // MINSS is the MINSS instruction. https://www.felixcloutier.com/x86/minss + MINSS + // MOVB is the MOV instruction for a single byte. https://www.felixcloutier.com/x86/mov + MOVB + // MOVBLSX is the MOVSX instruction for single byte in 32-bit mode. https://www.felixcloutier.com/x86/movsx:movsxd + MOVBLSX + // MOVBLZX is the MOVZX instruction for single-byte in 32-bit mode. https://www.felixcloutier.com/x86/movzx + MOVBLZX + // MOVBQSX is the MOVSX instruction for single byte in 64-bit mode. https://www.felixcloutier.com/x86/movsx:movsxd + MOVBQSX + // MOVBQZX is the MOVZX instruction for single-byte in 64-bit mode. https://www.felixcloutier.com/x86/movzx + MOVBQZX + // MOVL is the MOV instruction for a double word. + MOVL + // MOVLQSX is the MOVSXD instruction. https://www.felixcloutier.com/x86/movsx:movsxd + MOVLQSX + // MOVLQZX is the MOVZX instruction for a word to a doubleword. https://www.felixcloutier.com/x86/movzx + MOVLQZX + // MOVQ is the MOV instruction for a doubleword. https://www.felixcloutier.com/x86/mov + MOVQ + // MOVW is the MOV instruction for a word. https://www.felixcloutier.com/x86/mov + MOVW + // MOVWLSX is the MOVSX instruction for a word in 32-bit mode. https://www.felixcloutier.com/x86/movsx:movsxd + MOVWLSX + // MOVWLZX is the MOVZX instruction for a word in 32-bit mode. https://www.felixcloutier.com/x86/movzx + MOVWLZX + // MOVWQSX is the MOVSX instruction for a word in 64-bit mode. https://www.felixcloutier.com/x86/movsx:movsxd + MOVWQSX + // MOVWQZX is the MOVZX instruction for a word in 64-bit mode. https://www.felixcloutier.com/x86/movzx + MOVWQZX + // MULL is the MUL instruction in 32-bit mode. https://www.felixcloutier.com/x86/mul + MULL + // MULQ is the MUL instruction in 64-bit mode. https://www.felixcloutier.com/x86/mul + MULQ + // IMULQ is the IMUL instruction in 64-bit mode. https://www.felixcloutier.com/x86/imul + IMULQ + // MULSD is the MULSD instruction. https://www.felixcloutier.com/x86/mulsd + MULSD + // MULSS is the MULSS instruction. https://www.felixcloutier.com/x86/mulss + MULSS + // NEGQ is the NEG instruction in 64-bit mode. https://www.felixcloutier.com/x86/neg + NEGQ + // ORL is the OR instruction in 32-bit mode. https://www.felixcloutier.com/x86/or + ORL + // ORPD is the ORPD instruction. https://www.felixcloutier.com/x86/orpd + ORPD + // ORPS is the ORPS instruction. https://www.felixcloutier.com/x86/orps + ORPS + // ORQ is the OR instruction in 64-bit mode. https://www.felixcloutier.com/x86/or + ORQ + // POPCNTL is the POPCNT instruction in 32-bit mode. https://www.felixcloutier.com/x86/popcnt + POPCNTL + // POPCNTQ is the POPCNT instruction in 64-bit mode. https://www.felixcloutier.com/x86/popcnt + POPCNTQ + // PSLLD is the PSLLD instruction. https://www.felixcloutier.com/x86/psllw:pslld:psllq + PSLLD + // PSLLQ is the PSLLQ instruction. https://www.felixcloutier.com/x86/psllw:pslld:psllq + PSLLQ + // PSRLD is the PSRLD instruction. https://www.felixcloutier.com/x86/psrlw:psrld:psrlq + PSRLD + // PSRLQ is the PSRLQ instruction. https://www.felixcloutier.com/x86/psrlw:psrld:psrlq + PSRLQ + // REPMOVSQ is the REP MOVSQ instruction in 64-bit mode. https://www.felixcloutier.com/x86/movs:movsb:movsw:movsd:movsq https://www.felixcloutier.com/x86/rep:repe:repz:repne:repnz + REPMOVSQ + // REPSTOSQ is the REP STOSQ instruction in 64-bit mode. https://www.felixcloutier.com/x86/stos:stosb:stosw:stosd:stosq https://www.felixcloutier.com/x86/rep:repe:repz:repne:repnz + REPSTOSQ + // ROLL is the ROL instruction in 32-bit mode. https://www.felixcloutier.com/x86/rcl:rcr:rol:ror + ROLL + // ROLQ is the ROL instruction in 64-bit mode. https://www.felixcloutier.com/x86/rcl:rcr:rol:ror + ROLQ + // RORL is the ROR instruction in 32-bit mode. https://www.felixcloutier.com/x86/rcl:rcr:rol:ror + RORL + // RORQ is the ROR instruction in 64-bit mode. https://www.felixcloutier.com/x86/rcl:rcr:rol:ror + RORQ + // ROUNDSD is the ROUNDSD instruction. https://www.felixcloutier.com/x86/roundsd + ROUNDSD + // ROUNDSS is the ROUNDSS instruction. https://www.felixcloutier.com/x86/roundss + ROUNDSS + // SARL is the SAR instruction in 32-bit mode. https://www.felixcloutier.com/x86/sal:sar:shl:shr + SARL + // SARQ is the SAR instruction in 64-bit mode. https://www.felixcloutier.com/x86/sal:sar:shl:shr + SARQ + // SETCC is the SETAE (set if above or equal) instruction. https://www.felixcloutier.com/x86/setcc + SETCC + // SETCS is the SETB (set if below) instruction. https://www.felixcloutier.com/x86/setcc + SETCS + // SETEQ is the SETE (set if equal) instruction. https://www.felixcloutier.com/x86/setcc + SETEQ + // SETGE is the SETGE (set if greater or equal) instruction. https://www.felixcloutier.com/x86/setcc + SETGE + // SETGT is the SETG (set if greater) instruction. https://www.felixcloutier.com/x86/setcc + SETGT + // SETHI is the SETNBE (set if not below or equal) instruction. https://www.felixcloutier.com/x86/setcc + SETHI + // SETLE is the SETLE (set if less or equal) instruction. https://www.felixcloutier.com/x86/setcc + SETLE + // SETLS is the SETNA (set if not above) instruction. https://www.felixcloutier.com/x86/setcc + SETLS + // SETLT is the SETL (set if less) instruction. https://www.felixcloutier.com/x86/setcc + SETLT + // SETMI is the SETS (set if sign) instruction. https://www.felixcloutier.com/x86/setcc + SETMI + // SETNE is the SETNE (set if not equal) instruction. https://www.felixcloutier.com/x86/setcc + SETNE + // SETPC is the SETNP (set if not parity) instruction. https://www.felixcloutier.com/x86/setcc + SETPC + // SETPL is the SETNS (set if not sign) instruction. https://www.felixcloutier.com/x86/setcc + SETPL + // SETPS is the SETP (set if parity) instruction. https://www.felixcloutier.com/x86/setcc + SETPS + // SHLL is the SHL instruction in 32-bit mode. https://www.felixcloutier.com/x86/sal:sar:shl:shr + SHLL + // SHLQ is the SHL instruction in 64-bit mode. https://www.felixcloutier.com/x86/sal:sar:shl:shr + SHLQ + // SHRL is the SHR instruction in 32-bit mode. https://www.felixcloutier.com/x86/sal:sar:shl:shr + SHRL + // SHRQ is the SHR instruction in 64-bit mode. https://www.felixcloutier.com/x86/sal:sar:shl:shr + SHRQ + // SQRTSD is the SQRTSD instruction. https://www.felixcloutier.com/x86/sqrtsd + SQRTSD + // SQRTSS is the SQRTSS instruction. https://www.felixcloutier.com/x86/sqrtss + SQRTSS + // STD is the STD instruction. https://www.felixcloutier.com/x86/std + STD + // SUBL is the SUB instruction in 32-bit mode. https://www.felixcloutier.com/x86/sub + SUBL + // SUBQ is the SUB instruction in 64-bit mode. https://www.felixcloutier.com/x86/sub + SUBQ + // SUBSD is the SUBSD instruction. https://www.felixcloutier.com/x86/subsd + SUBSD + // SUBSS is the SUBSS instruction. https://www.felixcloutier.com/x86/subss + SUBSS + // TESTL is the TEST instruction in 32-bit mode. https://www.felixcloutier.com/x86/test + TESTL + // TESTQ is the TEST instruction in 64-bit mode. https://www.felixcloutier.com/x86/test + TESTQ + // TZCNTL is the TZCNT instruction in 32-bit mode. https://www.felixcloutier.com/x86/tzcnt + TZCNTL + // TZCNTQ is the TZCNT instruction in 64-bit mode. https://www.felixcloutier.com/x86/tzcnt + TZCNTQ + // UCOMISD is the UCOMISD instruction. https://www.felixcloutier.com/x86/ucomisd + UCOMISD + // UCOMISS is the UCOMISS instruction. https://www.felixcloutier.com/x86/ucomisd + UCOMISS + // XORL is the XOR instruction in 32-bit mode. https://www.felixcloutier.com/x86/xor + XORL + // XORPD is the XORPD instruction. https://www.felixcloutier.com/x86/xorpd + XORPD + // XORPS is the XORPS instruction. https://www.felixcloutier.com/x86/xorps + XORPS + // XORQ is the XOR instruction in 64-bit mode. https://www.felixcloutier.com/x86/xor + XORQ + // XCHGQ is the XCHG instruction in 64-bit mode. https://www.felixcloutier.com/x86/xchg + XCHGQ + // RET is the RET instruction. https://www.felixcloutier.com/x86/ret + RET + // JMP is the JMP instruction. https://www.felixcloutier.com/x86/jmp + JMP + // NOP is the NOP instruction. https://www.felixcloutier.com/x86/nop + NOP + // UD2 is the UD2 instruction. https://www.felixcloutier.com/x86/ud + UD2 + // MOVDQU is the MOVDQU instruction in 64-bit mode. https://www.felixcloutier.com/x86/movdqu:vmovdqu8:vmovdqu16:vmovdqu32:vmovdqu64 + MOVDQU + // MOVDQA is the MOVDQA instruction in 64-bit mode. https://www.felixcloutier.com/x86/movdqa:vmovdqa32:vmovdqa64 + MOVDQA + // PINSRB is the PINSRB instruction. https://www.felixcloutier.com/x86/pinsrb:pinsrd:pinsrq + PINSRB + // PINSRW is the PINSRW instruction. https://www.felixcloutier.com/x86/pinsrw + PINSRW + // PINSRD is the PINSRD instruction. https://www.felixcloutier.com/x86/pinsrb:pinsrd:pinsrq + PINSRD + // PINSRQ is the PINSRQ instruction. https://www.felixcloutier.com/x86/pinsrb:pinsrd:pinsrq + PINSRQ + // PADDB is the PADDB instruction. https://www.felixcloutier.com/x86/paddb:paddw:paddd:paddq + PADDB + // PADDW is the PADDW instruction. https://www.felixcloutier.com/x86/paddb:paddw:paddd:paddq + PADDW + // PADDD is the PADDD instruction. https://www.felixcloutier.com/x86/paddb:paddw:paddd:paddq + PADDD + // PADDQ is the PADDQ instruction. https://www.felixcloutier.com/x86/paddb:paddw:paddd:paddq + PADDQ + // PSUBB is the PSUBB instruction. https://www.felixcloutier.com/x86/psubb:psubw:psubd + PSUBB + // PSUBW is the PSUBW instruction. https://www.felixcloutier.com/x86/psubb:psubw:psubd + PSUBW + // PSUBD is the PSUBD instruction. https://www.felixcloutier.com/x86/psubb:psubw:psubd + PSUBD + // PSUBQ is the PSUBQ instruction. https://www.felixcloutier.com/x86/psubq + PSUBQ + // ADDPS is the ADDPS instruction. https://www.felixcloutier.com/x86/addps + ADDPS + // ADDPD is the ADDPD instruction. https://www.felixcloutier.com/x86/addpd + ADDPD + // SUBPS is the SUBPS instruction. https://www.felixcloutier.com/x86/subps + SUBPS + // SUBPD is the SUBPD instruction. https://www.felixcloutier.com/x86/subpd + SUBPD + // PMOVSXBW is the PMOVSXBW instruction https://www.felixcloutier.com/x86/pmovsx + PMOVSXBW + // PMOVSXWD is the PMOVSXWD instruction https://www.felixcloutier.com/x86/pmovsx + PMOVSXWD + // PMOVSXDQ is the PMOVSXDQ instruction https://www.felixcloutier.com/x86/pmovsx + PMOVSXDQ + // PMOVZXBW is the PMOVZXBW instruction https://www.felixcloutier.com/x86/pmovzx + PMOVZXBW + // PMOVZXWD is the PMOVZXWD instruction https://www.felixcloutier.com/x86/pmovzx + PMOVZXWD + // PMOVZXDQ is the PMOVZXDQ instruction https://www.felixcloutier.com/x86/pmovzx + PMOVZXDQ + // PSHUFB is the PSHUFB instruction https://www.felixcloutier.com/x86/pshufb + PSHUFB + // PSHUFD is the PSHUFD instruction https://www.felixcloutier.com/x86/pshufd + PSHUFD + // PXOR is the PXOR instruction https://www.felixcloutier.com/x86/pxor + PXOR + // PEXTRB is the PEXTRB instruction https://www.felixcloutier.com/x86/pextrb:pextrd:pextrq + PEXTRB + // PEXTRW is the PEXTRW instruction https://www.felixcloutier.com/x86/pextrw + PEXTRW + // PEXTRD is the PEXTRD instruction https://www.felixcloutier.com/x86/pextrb:pextrd:pextrq + PEXTRD + // PEXTRQ is the PEXTRQ instruction https://www.felixcloutier.com/x86/pextrb:pextrd:pextrq + PEXTRQ + // MOVLHPS is the MOVLHPS instruction https://www.felixcloutier.com/x86/movlhps + MOVLHPS + // INSERTPS is the INSERTPS instruction https://www.felixcloutier.com/x86/insertps + INSERTPS + // PTEST is the PTEST instruction https://www.felixcloutier.com/x86/ptest + PTEST + // PCMPEQB is the PCMPEQB instruction https://www.felixcloutier.com/x86/pcmpeqb:pcmpeqw:pcmpeqd + PCMPEQB + // PCMPEQW is the PCMPEQW instruction https://www.felixcloutier.com/x86/pcmpeqb:pcmpeqw:pcmpeqd + PCMPEQW + // PCMPEQD is the PCMPEQD instruction https://www.felixcloutier.com/x86/pcmpeqb:pcmpeqw:pcmpeqd + PCMPEQD + // PCMPEQQ is the PCMPEQQ instruction https://www.felixcloutier.com/x86/pcmpeqq + PCMPEQQ + // PADDUSB is the PADDUSB instruction https://www.felixcloutier.com/x86/paddusb:paddusw + PADDUSB + // MOVSD is the MOVSD instruction https://www.felixcloutier.com/x86/movsd + MOVSD + // PACKSSWB is the PACKSSWB instruction https://www.felixcloutier.com/x86/packsswb:packssdw + PACKSSWB + // PMOVMSKB is the PMOVMSKB instruction https://www.felixcloutier.com/x86/pmovmskb + PMOVMSKB + // MOVMSKPS is the MOVMSKPS instruction https://www.felixcloutier.com/x86/movmskps + MOVMSKPS + // MOVMSKPD is the MOVMSKPD instruction https://www.felixcloutier.com/x86/movmskpd + MOVMSKPD + // PAND is the PAND instruction https://www.felixcloutier.com/x86/pand + PAND + // POR is the POR instruction https://www.felixcloutier.com/x86/por + POR + // PANDN is the PANDN instruction https://www.felixcloutier.com/x86/pandn + PANDN + // PSRAD is the PSRAD instruction https://www.felixcloutier.com/x86/psraw:psrad:psraq + PSRAD + // PSRAW is the PSRAW instruction https://www.felixcloutier.com/x86/psraw:psrad:psraq + PSRAW + // PSRLW is the PSRLW instruction https://www.felixcloutier.com/x86/psrlw:psrld:psrlq + PSRLW + // PSLLW is the PSLLW instruction https://www.felixcloutier.com/x86/psllw:pslld:psllq + PSLLW + // PUNPCKLBW is the PUNPCKLBW instruction https://www.felixcloutier.com/x86/punpcklbw:punpcklwd:punpckldq:punpcklqdq + PUNPCKLBW + // PUNPCKHBW is the PUNPCKHBW instruction https://www.felixcloutier.com/x86/punpckhbw:punpckhwd:punpckhdq:punpckhqdq + PUNPCKHBW + // CMPPS is the CMPPS instruction https://www.felixcloutier.com/x86/cmpps + CMPPS + // CMPPD is the https://www.felixcloutier.com/x86/cmppd + CMPPD + // PCMPGTQ is the PCMPGTQ instruction https://www.felixcloutier.com/x86/pcmpgtq + PCMPGTQ + // PCMPGTD is the PCMPGTD instruction https://www.felixcloutier.com/x86/pcmpgtb:pcmpgtw:pcmpgtd + PCMPGTD + // PCMPGTW is the PCMPGTW instruction https://www.felixcloutier.com/x86/pcmpgtb:pcmpgtw:pcmpgtd + PCMPGTW + // PCMPGTB is the PCMPGTB instruction https://www.felixcloutier.com/x86/pcmpgtb:pcmpgtw:pcmpgtd + PCMPGTB + // PMINSD is the PMINSD instruction https://www.felixcloutier.com/x86/pminsd:pminsq + PMINSD + // PMINSW is the PMINSW instruction https://www.felixcloutier.com/x86/pminsb:pminsw + PMINSW + // PMINSB is the PMINSB instruction https://www.felixcloutier.com/x86/pminsb:pminsw + PMINSB + // PMAXSD is the PMAXSD instruction https://www.felixcloutier.com/x86/pmaxsb:pmaxsw:pmaxsd:pmaxsq + PMAXSD + // PMAXSW is the PMAXSW instruction https://www.felixcloutier.com/x86/pmaxsb:pmaxsw:pmaxsd:pmaxsq + PMAXSW + // PMAXSB is the PMAXSB instruction https://www.felixcloutier.com/x86/pmaxsb:pmaxsw:pmaxsd:pmaxsq + PMAXSB + // PMINUD is the PMINUD instruction https://www.felixcloutier.com/x86/pminud:pminuq + PMINUD + // PMINUW is the PMINUW instruction https://www.felixcloutier.com/x86/pminub:pminuw + PMINUW + // PMINUB is the PMINUB instruction https://www.felixcloutier.com/x86/pminub:pminuw + PMINUB + // PMAXUD is the PMAXUD instruction https://www.felixcloutier.com/x86/pmaxud:pmaxuq + PMAXUD + // PMAXUW is the PMAXUW instruction https://www.felixcloutier.com/x86/pmaxub:pmaxuw + PMAXUW + // PMAXUB is the PMAXUB instruction https://www.felixcloutier.com/x86/pmaxub:pmaxuw + PMAXUB + // PMULLW is the PMULLW instruction https://www.felixcloutier.com/x86/pmullw + PMULLW + // PMULLD is the PMULLD instruction https://www.felixcloutier.com/x86/pmulld:pmullq + PMULLD + // PMULUDQ is the PMULUDQ instruction https://www.felixcloutier.com/x86/pmuludq + PMULUDQ + // PSUBSB is the PSUBSB instruction https://www.felixcloutier.com/x86/psubsb:psubsw + PSUBSB + // PSUBSW is the PSUBSW instruction https://www.felixcloutier.com/x86/psubsb:psubsw + PSUBSW + // PSUBUSB is the PSUBUSB instruction https://www.felixcloutier.com/x86/psubusb:psubusw + PSUBUSB + // PSUBUSW is the PSUBUSW instruction https://www.felixcloutier.com/x86/psubusb:psubusw + PSUBUSW + // PADDSW is the PADDSW instruction https://www.felixcloutier.com/x86/paddsb:paddsw + PADDSW + // PADDSB is the PADDSB instruction https://www.felixcloutier.com/x86/paddsb:paddsw + PADDSB + // PADDUSW is the PADDUSW instruction https://www.felixcloutier.com/x86/paddusb:paddusw + PADDUSW + // PAVGB is the PAVGB instruction https://www.felixcloutier.com/x86/pavgb:pavgw + PAVGB + // PAVGW is the PAVGW instruction https://www.felixcloutier.com/x86/pavgb:pavgw + PAVGW + // PABSB is the PABSB instruction https://www.felixcloutier.com/x86/pabsb:pabsw:pabsd:pabsq + PABSB + // PABSW is the PABSW instruction https://www.felixcloutier.com/x86/pabsb:pabsw:pabsd:pabsq + PABSW + // PABSD is the PABSD instruction https://www.felixcloutier.com/x86/pabsb:pabsw:pabsd:pabsq + PABSD + // BLENDVPD is the BLENDVPD instruction https://www.felixcloutier.com/x86/blendvpd + BLENDVPD + // MAXPD is the MAXPD instruction https://www.felixcloutier.com/x86/maxpd + MAXPD + // MAXPS is the MAXPS instruction https://www.felixcloutier.com/x86/maxps + MAXPS + // MINPD is the MINPD instruction https://www.felixcloutier.com/x86/minpd + MINPD + // MINPS is the MINPS instruction https://www.felixcloutier.com/x86/minps + MINPS + // ANDNPD is the ANDNPD instruction https://www.felixcloutier.com/x86/andnpd + ANDNPD + // ANDNPS is the ANDNPS instruction https://www.felixcloutier.com/x86/andnps + ANDNPS + // MULPS is the MULPS instruction https://www.felixcloutier.com/x86/mulps + MULPS + // MULPD is the MULPD instruction https://www.felixcloutier.com/x86/mulpd + MULPD + // DIVPS is the DIVPS instruction https://www.felixcloutier.com/x86/divps + DIVPS + // DIVPD is the DIVPD instruction https://www.felixcloutier.com/x86/divpd + DIVPD + // SQRTPS is the SQRTPS instruction https://www.felixcloutier.com/x86/sqrtps + SQRTPS + // SQRTPD is the SQRTPD instruction https://www.felixcloutier.com/x86/sqrtpd + SQRTPD + // ROUNDPS is the ROUNDPS instruction https://www.felixcloutier.com/x86/roundps + ROUNDPS + // ROUNDPD is the ROUNDPD instruction https://www.felixcloutier.com/x86/roundpd + ROUNDPD + // PALIGNR is the PALIGNR instruction https://www.felixcloutier.com/x86/palignr + PALIGNR + // PUNPCKLWD is the PUNPCKLWD instruction https://www.felixcloutier.com/x86/punpcklbw:punpcklwd:punpckldq:punpcklqdq + PUNPCKLWD + // PUNPCKHWD is the PUNPCKHWD instruction https://www.felixcloutier.com/x86/punpckhbw:punpckhwd:punpckhdq:punpckhqdq + PUNPCKHWD + // PMULHUW is the PMULHUW instruction https://www.felixcloutier.com/x86/pmulhuw + PMULHUW + // PMULDQ is the PMULDQ instruction https://www.felixcloutier.com/x86/pmuldq + PMULDQ + // PMULHRSW is the PMULHRSW instruction https://www.felixcloutier.com/x86/pmulhrsw + PMULHRSW + // PMULHW is the PMULHW instruction https://www.felixcloutier.com/x86/pmulhw + PMULHW + // CMPEQPS is the CMPEQPS instruction https://www.felixcloutier.com/x86/cmpps + CMPEQPS + // CMPEQPD is the CMPEQPD instruction https://www.felixcloutier.com/x86/cmppd + CMPEQPD + // CVTTPS2DQ is the CVTTPS2DQ instruction https://www.felixcloutier.com/x86/cvttps2dq + CVTTPS2DQ + // CVTDQ2PS is the CVTDQ2PS instruction https://www.felixcloutier.com/x86/cvtdq2ps + CVTDQ2PS + // MOVUPD is the MOVUPD instruction https://www.felixcloutier.com/x86/movupd + MOVUPD + // SHUFPS is the SHUFPS instruction https://www.felixcloutier.com/x86/shufps + SHUFPS + // PMADDWD is the PMADDWD instruction https://www.felixcloutier.com/x86/pmaddwd + PMADDWD + // CVTDQ2PD is the CVTDQ2PD instruction https://www.felixcloutier.com/x86/cvtdq2pd + CVTDQ2PD + // UNPCKLPS is the UNPCKLPS instruction https://www.felixcloutier.com/x86/unpcklps + UNPCKLPS + // PACKUSWB is the PACKUSWB instruction https://www.felixcloutier.com/x86/packuswb + PACKUSWB + // PACKSSDW is the PACKSSDW instruction https://www.felixcloutier.com/x86/packsswb:packssdw + PACKSSDW + // PACKUSDW is the PACKUSDW instruction https://www.felixcloutier.com/x86/packusdw + PACKUSDW + // CVTPS2PD is the CVTPS2PD instruction https://www.felixcloutier.com/x86/cvtps2pd + CVTPS2PD + // CVTPD2PS is the CVTPD2PS instruction https://www.felixcloutier.com/x86/cvtpd2ps + CVTPD2PS + // PMADDUBSW is the PMADDUBSW instruction https://www.felixcloutier.com/x86/pmaddubsw + PMADDUBSW + // CVTTPD2DQ is the CVTTPD2DQ instruction https://www.felixcloutier.com/x86/cvttpd2dq + CVTTPD2DQ + + // instructionEnd is always placed at the bottom of this iota definition to be used in the test. + instructionEnd +) + +// InstructionName returns the name for an instruction +func InstructionName(instruction asm.Instruction) string { + switch instruction { + case ADDL: + return "ADDL" + case ADDQ: + return "ADDQ" + case ADDSD: + return "ADDSD" + case ADDSS: + return "ADDSS" + case ANDL: + return "ANDL" + case ANDPD: + return "ANDPD" + case ANDPS: + return "ANDPS" + case ANDQ: + return "ANDQ" + case BSRL: + return "BSRL" + case BSRQ: + return "BSRQ" + case CDQ: + return "CDQ" + case CLD: + return "CLD" + case CMOVQCS: + return "CMOVQCS" + case CMPL: + return "CMPL" + case CMPQ: + return "CMPQ" + case COMISD: + return "COMISD" + case COMISS: + return "COMISS" + case CQO: + return "CQO" + case CVTSD2SS: + return "CVTSD2SS" + case CVTSL2SD: + return "CVTSL2SD" + case CVTSL2SS: + return "CVTSL2SS" + case CVTSQ2SD: + return "CVTSQ2SD" + case CVTSQ2SS: + return "CVTSQ2SS" + case CVTSS2SD: + return "CVTSS2SD" + case CVTTSD2SL: + return "CVTTSD2SL" + case CVTTSD2SQ: + return "CVTTSD2SQ" + case CVTTSS2SL: + return "CVTTSS2SL" + case CVTTSS2SQ: + return "CVTTSS2SQ" + case DECQ: + return "DECQ" + case DIVL: + return "DIVL" + case DIVQ: + return "DIVQ" + case DIVSD: + return "DIVSD" + case DIVSS: + return "DIVSS" + case IDIVL: + return "IDIVL" + case IDIVQ: + return "IDIVQ" + case INCQ: + return "INCQ" + case JCC: + return "JCC" + case JCS: + return "JCS" + case JEQ: + return "JEQ" + case JGE: + return "JGE" + case JGT: + return "JGT" + case JHI: + return "JHI" + case JLE: + return "JLE" + case JLS: + return "JLS" + case JLT: + return "JLT" + case JMI: + return "JMI" + case JNE: + return "JNE" + case JPC: + return "JPC" + case JPL: + return "JPL" + case JPS: + return "JPS" + case LEAQ: + return "LEAQ" + case LZCNTL: + return "LZCNTL" + case LZCNTQ: + return "LZCNTQ" + case MAXSD: + return "MAXSD" + case MAXSS: + return "MAXSS" + case MINSD: + return "MINSD" + case MINSS: + return "MINSS" + case MOVB: + return "MOVB" + case MOVBLSX: + return "MOVBLSX" + case MOVBLZX: + return "MOVBLZX" + case MOVBQSX: + return "MOVBQSX" + case MOVBQZX: + return "MOVBQZX" + case MOVL: + return "MOVL" + case MOVLQSX: + return "MOVLQSX" + case MOVLQZX: + return "MOVLQZX" + case MOVQ: + return "MOVQ" + case MOVW: + return "MOVW" + case MOVWLSX: + return "MOVWLSX" + case MOVWLZX: + return "MOVWLZX" + case MOVWQSX: + return "MOVWQSX" + case MOVWQZX: + return "MOVWQZX" + case MULL: + return "MULL" + case MULQ: + return "MULQ" + case IMULQ: + return "IMULQ" + case MULSD: + return "MULSD" + case MULSS: + return "MULSS" + case ORL: + return "ORL" + case ORPD: + return "ORPD" + case ORPS: + return "ORPS" + case ORQ: + return "ORQ" + case POPCNTL: + return "POPCNTL" + case POPCNTQ: + return "POPCNTQ" + case PSLLD: + return "PSLLD" + case PSLLQ: + return "PSLLQ" + case PSRLD: + return "PSRLD" + case PSRLQ: + return "PSRLQ" + case REPMOVSQ: + return "REP MOVSQ" + case REPSTOSQ: + return "REP STOSQ" + case ROLL: + return "ROLL" + case ROLQ: + return "ROLQ" + case RORL: + return "RORL" + case RORQ: + return "RORQ" + case ROUNDSD: + return "ROUNDSD" + case ROUNDSS: + return "ROUNDSS" + case SARL: + return "SARL" + case SARQ: + return "SARQ" + case SETCC: + return "SETCC" + case SETCS: + return "SETCS" + case SETEQ: + return "SETEQ" + case SETGE: + return "SETGE" + case SETGT: + return "SETGT" + case SETHI: + return "SETHI" + case SETLE: + return "SETLE" + case SETLS: + return "SETLS" + case SETLT: + return "SETLT" + case SETMI: + return "SETMI" + case SETNE: + return "SETNE" + case SETPC: + return "SETPC" + case SETPL: + return "SETPL" + case SETPS: + return "SETPS" + case SHLL: + return "SHLL" + case SHLQ: + return "SHLQ" + case SHRL: + return "SHRL" + case SHRQ: + return "SHRQ" + case SQRTSD: + return "SQRTSD" + case SQRTSS: + return "SQRTSS" + case STD: + return "STD" + case SUBL: + return "SUBL" + case SUBQ: + return "SUBQ" + case SUBSD: + return "SUBSD" + case SUBSS: + return "SUBSS" + case TESTL: + return "TESTL" + case TESTQ: + return "TESTQ" + case TZCNTL: + return "TZCNTL" + case TZCNTQ: + return "TZCNTQ" + case UCOMISD: + return "UCOMISD" + case UCOMISS: + return "UCOMISS" + case XORL: + return "XORL" + case XORPD: + return "XORPD" + case XORPS: + return "XORPS" + case XORQ: + return "XORQ" + case XCHGQ: + return "XCHGQ" + case RET: + return "RET" + case JMP: + return "JMP" + case NOP: + return "NOP" + case UD2: + return "UD2" + case MOVDQU: + return "MOVDQU" + case PINSRB: + return "PINSRB" + case PINSRW: + return "PINSRW" + case PINSRD: + return "PINSRD" + case PINSRQ: + return "PINSRQ" + case PADDB: + return "PADDB" + case PADDW: + return "PADDW" + case PADDD: + return "PADDD" + case PADDQ: + return "PADDQ" + case ADDPS: + return "ADDPS" + case ADDPD: + return "ADDPD" + case PSUBB: + return "PSUBB" + case PSUBW: + return "PSUBW" + case PSUBD: + return "PSUBD" + case PSUBQ: + return "PSUBQ" + case SUBPS: + return "SUBPS" + case SUBPD: + return "SUBPD" + case PMOVSXBW: + return "PMOVSXBW" + case PMOVSXWD: + return "PMOVSXWD" + case PMOVSXDQ: + return "PMOVSXDQ" + case PMOVZXBW: + return "PMOVZXBW" + case PMOVZXWD: + return "PMOVZXWD" + case PMOVZXDQ: + return "PMOVZXDQ" + case PSHUFB: + return "PSHUFB" + case PSHUFD: + return "PSHUFD" + case PXOR: + return "PXOR" + case PEXTRB: + return "PEXTRB" + case PEXTRW: + return "PEXTRW" + case PEXTRD: + return "PEXTRD" + case PEXTRQ: + return "PEXTRQ" + case INSERTPS: + return "INSERTPS" + case MOVLHPS: + return "MOVLHPS" + case PTEST: + return "PTEST" + case PCMPEQB: + return "PCMPEQB" + case PCMPEQW: + return "PCMPEQW" + case PCMPEQD: + return "PCMPEQD" + case PCMPEQQ: + return "PCMPEQQ" + case PADDUSB: + return "PADDUSB" + case MOVDQA: + return "MOVDQA" + case MOVSD: + return "MOVSD" + case PACKSSWB: + return "PACKSSWB" + case PMOVMSKB: + return "PMOVMSKB" + case MOVMSKPS: + return "MOVMSKPS" + case MOVMSKPD: + return "MOVMSKPD" + case PAND: + return "PAND" + case POR: + return "POR" + case PANDN: + return "PANDN" + case PSRAD: + return "PSRAD" + case PSRAW: + return "PSRAW" + case PSRLW: + return "PSRLW" + case PSLLW: + return "PSLLW" + case PUNPCKLBW: + return "PUNPCKLBW" + case PUNPCKHBW: + return "PUNPCKHBW" + case NEGQ: + return "NEGQ" + case NONE: + return "NONE" + case CMPPS: + return "CMPPS" + case CMPPD: + return "CMPPD" + case PCMPGTQ: + return "PCMPGTQ" + case PCMPGTD: + return "PCMPGTD" + case PMINSD: + return "PMINSD" + case PMAXSD: + return "PMAXSD" + case PMINSW: + return "PMINSW" + case PCMPGTB: + return "PCMPGTB" + case PMINSB: + return "PMINSB" + case PMINUD: + return "PMINUD" + case PMINUW: + return "PMINUW" + case PMINUB: + return "PMINUB" + case PMAXUD: + return "PMAXUD" + case PMAXUW: + return "PMAXUW" + case PMAXUB: + return "PMAXUB" + case PCMPGTW: + return "PCMPGTW" + case PMAXSW: + return "PMAXSW" + case PMAXSB: + return "PMAXSB" + case PMULLW: + return "PMULLW" + case PMULLD: + return "PMULLD" + case PMULUDQ: + return "PMULUDQ" + case PSUBSB: + return "PSUBSB" + case PSUBUSB: + return "PSUBUSB" + case PADDSW: + return "PADDSW" + case PADDSB: + return "PADDSB" + case PADDUSW: + return "PADDUSW" + case PSUBSW: + return "PSUBSW" + case PSUBUSW: + return "PSUBUSW" + case PAVGB: + return "PAVGB" + case PAVGW: + return "PAVGW" + case PABSB: + return "PABSB" + case PABSW: + return "PABSW" + case PABSD: + return "PABSD" + case BLENDVPD: + return "BLENDVPD" + case MAXPD: + return "MAXPD" + case MAXPS: + return "MAXPS" + case MINPD: + return "MINPD" + case MINPS: + return "MINPS" + case ANDNPD: + return "ANDNPD" + case ANDNPS: + return "ANDNPS" + case MULPS: + return "MULPS" + case MULPD: + return "MULPD" + case DIVPS: + return "DIVPS" + case DIVPD: + return "DIVPD" + case SQRTPS: + return "SQRTPS" + case SQRTPD: + return "SQRTPD" + case ROUNDPS: + return "ROUNDPS" + case ROUNDPD: + return "ROUNDPD" + case PALIGNR: + return "PALIGNR" + case PUNPCKLWD: + return "PUNPCKLWD" + case PUNPCKHWD: + return "PUNPCKHWD" + case PMULHUW: + return "PMULHUW" + case PMULDQ: + return "PMULDQ" + case PMULHRSW: + return "PMULHRSW" + case PMULHW: + return "PMULHW" + case CMPEQPS: + return "CMPEQPS" + case CMPEQPD: + return "CMPEQPD" + case CVTTPS2DQ: + return "CVTTPS2DQ" + case CVTDQ2PS: + return "CVTDQ2PS" + case MOVUPD: + return "MOVUPD" + case SHUFPS: + return "SHUFPS" + case PMADDWD: + return "PMADDWD" + case CVTDQ2PD: + return "CVTDQ2PD" + case UNPCKLPS: + return "UNPCKLPS" + case PACKUSWB: + return "PACKUSWB" + case PACKSSDW: + return "PACKSSDW" + case PACKUSDW: + return "PACKUSDW" + case CVTPS2PD: + return "CVTPS2PD" + case CVTPD2PS: + return "CVTPD2PS" + case PMADDUBSW: + return "PMADDUBSW" + case CVTTPD2DQ: + return "CVTTPD2DQ" + } + panic(fmt.Errorf("unknown instruction %d", instruction)) +} + +// Amd64-specific registers. +// +// Note: naming convention intentionally matches the Go assembler: https://go.dev/doc/asm +// See https://www.lri.fr/~filliatr/ens/compil/x86-64.pdf +// See https://cs.brown.edu/courses/cs033/docs/guides/x64_cheatsheet.pdf +const ( + // RegAX is the ax register + RegAX = asm.NilRegister + 1 + iota + // RegCX is the cx register + RegCX + // RegDX is the dx register + RegDX + // RegBX is the bx register + RegBX + // RegSP is the sp register + RegSP + // RegBP is the bp register + RegBP + // RegSI is the si register + RegSI + // RegDI is the di register + RegDI + // RegR8 is the r8 register + RegR8 + // RegR9 is the r9 register + RegR9 + // RegR10 is the r10 register + RegR10 + // RegR11 is the r11 register + RegR11 + // RegR12 is the r12 register + RegR12 + // RegR13 is the r13 register + RegR13 + // RegR14 is the r14 register + RegR14 + // RegR15 is the r15 register + RegR15 + // RegX0 is the x0 register + RegX0 + // RegX1 is the x1 register + RegX1 + // RegX2 is the x2 register + RegX2 + // RegX3 is the x3 register + RegX3 + // RegX4 is the x4 register + RegX4 + // RegX5 is the x5 register + RegX5 + // RegX6 is the x6 register + RegX6 + // RegX7 is the x7 register + RegX7 + // RegX8 is the x8 register + RegX8 + // RegX9 is the x9 register + RegX9 + // RegX10 is the x10 register + RegX10 + // RegX11 is the x11 register + RegX11 + // RegX12 is the x12 register + RegX12 + // RegX13 is the x13 register + RegX13 + // RegX14 is the x14 register + RegX14 + // RegX15 is the x15 register + RegX15 +) + +// RegisterName returns the name for a register +func RegisterName(reg asm.Register) string { + switch reg { + case RegAX: + return "AX" + case RegCX: + return "CX" + case RegDX: + return "DX" + case RegBX: + return "BX" + case RegSP: + return "SP" + case RegBP: + return "BP" + case RegSI: + return "SI" + case RegDI: + return "DI" + case RegR8: + return "R8" + case RegR9: + return "R9" + case RegR10: + return "R10" + case RegR11: + return "R11" + case RegR12: + return "R12" + case RegR13: + return "R13" + case RegR14: + return "R14" + case RegR15: + return "R15" + case RegX0: + return "X0" + case RegX1: + return "X1" + case RegX2: + return "X2" + case RegX3: + return "X3" + case RegX4: + return "X4" + case RegX5: + return "X5" + case RegX6: + return "X6" + case RegX7: + return "X7" + case RegX8: + return "X8" + case RegX9: + return "X9" + case RegX10: + return "X10" + case RegX11: + return "X11" + case RegX12: + return "X12" + case RegX13: + return "X13" + case RegX14: + return "X14" + case RegX15: + return "X15" + default: + return "nil" + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/asm/amd64/impl.go b/vendor/github.com/tetratelabs/wazero/internal/asm/amd64/impl.go new file mode 100644 index 000000000..8479d81c3 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/asm/amd64/impl.go @@ -0,0 +1,2812 @@ +package amd64 + +import ( + "encoding/binary" + "errors" + "fmt" + "math" + + "github.com/tetratelabs/wazero/internal/asm" +) + +// nodeImpl implements asm.Node for amd64. +type nodeImpl struct { + // jumpTarget holds the target node in the linked for the jump-kind instruction. + jumpTarget *nodeImpl + + // prev and next hold the prev/next node from this node in the assembled linked list. + prev, next *nodeImpl + + // forwardJumpOrigins hold all the nodes trying to jump into this node as a + // singly linked list. In other words, all the nodes with .jumpTarget == this. + forwardJumpOrigins *nodeImpl + + staticConst *asm.StaticConst + + dstConst asm.ConstantValue + offsetInBinary asm.NodeOffsetInBinary + srcConst asm.ConstantValue + instruction asm.Instruction + + // readInstructionAddressBeforeTargetInstruction holds the instruction right before the target of + // read instruction address instruction. See asm.assemblerBase.CompileReadInstructionAddress. + readInstructionAddressBeforeTargetInstruction asm.Instruction + flag nodeFlag + types operandTypes + srcReg, dstReg asm.Register + srcMemIndex, dstMemIndex asm.Register + srcMemScale, dstMemScale byte + arg byte + + // staticConstReferrersAdded true if this node is already added into AssemblerImpl.staticConstReferrers. + // Only used when staticConst is not nil. Through re-assembly, we might end up adding multiple times which causes unnecessary + // allocations, so we use this flag to do it once. + staticConstReferrersAdded bool +} + +type nodeFlag byte + +const ( + // nodeFlagInitializedForEncoding is always set to indicate that node is already initialized. Notably, this is used to judge + // whether a jump is backward or forward before encoding. + nodeFlagInitializedForEncoding nodeFlag = 1 << iota + nodeFlagBackwardJump + // nodeFlagShortForwardJump is set to false by default and only used by forward branch jumps, which means .jumpTarget != nil and + // the target node is encoded after this node. False by default means that we Encode all the jumps with jumpTarget + // as short jump (i.e. relative signed 8-bit integer offset jump) and try to Encode as small as possible. + nodeFlagShortForwardJump +) + +func (n *nodeImpl) isInitializedForEncoding() bool { + return n.flag&nodeFlagInitializedForEncoding != 0 +} + +func (n *nodeImpl) isJumpNode() bool { + return n.jumpTarget != nil +} + +func (n *nodeImpl) isBackwardJump() bool { + return n.isJumpNode() && (n.flag&nodeFlagBackwardJump != 0) +} + +func (n *nodeImpl) isForwardJump() bool { + return n.isJumpNode() && (n.flag&nodeFlagBackwardJump == 0) +} + +func (n *nodeImpl) isForwardShortJump() bool { + return n.isForwardJump() && n.flag&nodeFlagShortForwardJump != 0 +} + +// AssignJumpTarget implements asm.Node.AssignJumpTarget. +func (n *nodeImpl) AssignJumpTarget(target asm.Node) { + n.jumpTarget = target.(*nodeImpl) +} + +// AssignDestinationConstant implements asm.Node.AssignDestinationConstant. +func (n *nodeImpl) AssignDestinationConstant(value asm.ConstantValue) { + n.dstConst = value +} + +// AssignSourceConstant implements asm.Node.AssignSourceConstant. +func (n *nodeImpl) AssignSourceConstant(value asm.ConstantValue) { + n.srcConst = value +} + +// OffsetInBinary implements asm.Node.OffsetInBinary. +func (n *nodeImpl) OffsetInBinary() asm.NodeOffsetInBinary { + return n.offsetInBinary +} + +// String implements fmt.Stringer. +// +// This is for debugging purpose, and the format is almost same as the AT&T assembly syntax, +// meaning that this should look like "INSTRUCTION ${from}, ${to}" where each operand +// might be embraced by '[]' to represent the memory location. +func (n *nodeImpl) String() (ret string) { + instName := InstructionName(n.instruction) + switch n.types { + case operandTypesNoneToNone: + ret = instName + case operandTypesNoneToRegister: + ret = fmt.Sprintf("%s %s", instName, RegisterName(n.dstReg)) + case operandTypesNoneToMemory: + if n.dstMemIndex != asm.NilRegister { + ret = fmt.Sprintf("%s [%s + 0x%x + %s*0x%x]", instName, + RegisterName(n.dstReg), n.dstConst, RegisterName(n.dstMemIndex), n.dstMemScale) + } else { + ret = fmt.Sprintf("%s [%s + 0x%x]", instName, RegisterName(n.dstReg), n.dstConst) + } + case operandTypesNoneToBranch: + ret = fmt.Sprintf("%s {%v}", instName, n.jumpTarget) + case operandTypesRegisterToNone: + ret = fmt.Sprintf("%s %s", instName, RegisterName(n.srcReg)) + case operandTypesRegisterToRegister: + ret = fmt.Sprintf("%s %s, %s", instName, RegisterName(n.srcReg), RegisterName(n.dstReg)) + case operandTypesRegisterToMemory: + if n.dstMemIndex != asm.NilRegister { + ret = fmt.Sprintf("%s %s, [%s + 0x%x + %s*0x%x]", instName, RegisterName(n.srcReg), + RegisterName(n.dstReg), n.dstConst, RegisterName(n.dstMemIndex), n.dstMemScale) + } else { + ret = fmt.Sprintf("%s %s, [%s + 0x%x]", instName, RegisterName(n.srcReg), RegisterName(n.dstReg), n.dstConst) + } + case operandTypesRegisterToConst: + ret = fmt.Sprintf("%s %s, 0x%x", instName, RegisterName(n.srcReg), n.dstConst) + case operandTypesMemoryToRegister: + if n.srcMemIndex != asm.NilRegister { + ret = fmt.Sprintf("%s [%s + %#x + %s*%#x], %s", instName, + RegisterName(n.srcReg), n.srcConst, RegisterName(n.srcMemIndex), n.srcMemScale, RegisterName(n.dstReg)) + } else { + ret = fmt.Sprintf("%s [%s + 0x%x], %s", instName, RegisterName(n.srcReg), n.srcConst, RegisterName(n.dstReg)) + } + case operandTypesMemoryToConst: + if n.srcMemIndex != asm.NilRegister { + ret = fmt.Sprintf("%s [%s + %#x + %s*0x%x], 0x%x", instName, + RegisterName(n.srcReg), n.srcConst, RegisterName(n.srcMemIndex), n.srcMemScale, n.dstConst) + } else { + ret = fmt.Sprintf("%s [%s + %#x], 0x%x", instName, RegisterName(n.srcReg), n.srcConst, n.dstConst) + } + case operandTypesConstToMemory: + if n.dstMemIndex != asm.NilRegister { + ret = fmt.Sprintf("%s 0x%x, [%s + 0x%x + %s*0x%x]", instName, n.srcConst, + RegisterName(n.dstReg), n.dstConst, RegisterName(n.dstMemIndex), n.dstMemScale) + } else { + ret = fmt.Sprintf("%s 0x%x, [%s + 0x%x]", instName, n.srcConst, RegisterName(n.dstReg), n.dstConst) + } + case operandTypesConstToRegister: + ret = fmt.Sprintf("%s 0x%x, %s", instName, n.srcConst, RegisterName(n.dstReg)) + case operandTypesStaticConstToRegister: + ret = fmt.Sprintf("%s $%#x, %s", instName, n.staticConst.Raw, RegisterName(n.dstReg)) + case operandTypesRegisterToStaticConst: + ret = fmt.Sprintf("%s %s, $%#x", instName, RegisterName(n.srcReg), n.staticConst.Raw) + } + return +} + +type operandTypes byte + +const ( + operandTypesNoneToNone operandTypes = iota + operandTypesNoneToRegister + operandTypesNoneToMemory + operandTypesNoneToBranch + operandTypesRegisterToNone + operandTypesRegisterToRegister + operandTypesRegisterToMemory + operandTypesRegisterToConst + operandTypesMemoryToRegister + operandTypesMemoryToConst + operandTypesConstToRegister + operandTypesConstToMemory + operandTypesStaticConstToRegister + operandTypesRegisterToStaticConst +) + +// String implements fmt.Stringer +func (o operandTypes) String() (ret string) { + switch o { + case operandTypesNoneToNone: + ret = "NoneToNone" + case operandTypesNoneToRegister: + ret = "NoneToRegister" + case operandTypesNoneToMemory: + ret = "NoneToMemory" + case operandTypesNoneToBranch: + ret = "NoneToBranch" + case operandTypesRegisterToNone: + ret = "RegisterToNone" + case operandTypesRegisterToRegister: + ret = "RegisterToRegister" + case operandTypesRegisterToMemory: + ret = "RegisterToMemory" + case operandTypesRegisterToConst: + ret = "RegisterToConst" + case operandTypesMemoryToRegister: + ret = "MemoryToRegister" + case operandTypesMemoryToConst: + ret = "MemoryToConst" + case operandTypesConstToRegister: + ret = "ConstToRegister" + case operandTypesConstToMemory: + ret = "ConstToMemory" + case operandTypesStaticConstToRegister: + ret = "StaticConstToRegister" + case operandTypesRegisterToStaticConst: + ret = "RegisterToStaticConst" + } + return +} + +type ( + // AssemblerImpl implements Assembler. + AssemblerImpl struct { + root *nodeImpl + current *nodeImpl + asm.BaseAssemblerImpl + readInstructionAddressNodes []*nodeImpl + + // staticConstReferrers maintains the list of static const referrers which requires the + // offset resolution after finalizing the binary layout. + staticConstReferrers []staticConstReferrer + + nodePool nodePool + pool asm.StaticConstPool + + // MaxDisplacementForConstantPool is fixed to defaultMaxDisplacementForConstantPool + // but have it as an exported field here for testability. + MaxDisplacementForConstantPool int + + forceReAssemble bool + } + + // staticConstReferrer represents a referrer of a asm.StaticConst. + staticConstReferrer struct { + n *nodeImpl + // instLen is the encoded length of the instruction for `n`. + instLen int + } +) + +func NewAssembler() *AssemblerImpl { + return &AssemblerImpl{ + nodePool: nodePool{index: nodePageSize}, + pool: asm.NewStaticConstPool(), + MaxDisplacementForConstantPool: defaultMaxDisplacementForConstantPool, + } +} + +const nodePageSize = 128 + +type nodePage = [nodePageSize]nodeImpl + +// nodePool is the central allocation pool for nodeImpl used by a single AssemblerImpl. +// This reduces the allocations over compilation by reusing AssemblerImpl. +type nodePool struct { + pages []*nodePage + index int +} + +// allocNode allocates a new nodeImpl for use from the pool. +// This expands the pool if there is no space left for it. +func (n *nodePool) allocNode() *nodeImpl { + if n.index == nodePageSize { + if len(n.pages) == cap(n.pages) { + n.pages = append(n.pages, new(nodePage)) + } else { + i := len(n.pages) + n.pages = n.pages[:i+1] + if n.pages[i] == nil { + n.pages[i] = new(nodePage) + } + } + n.index = 0 + } + ret := &n.pages[len(n.pages)-1][n.index] + n.index++ + return ret +} + +func (n *nodePool) reset() { + for _, ns := range n.pages { + pages := ns[:] + for i := range pages { + pages[i] = nodeImpl{} + } + } + n.pages = n.pages[:0] + n.index = nodePageSize +} + +// AllocateNOP implements asm.AssemblerBase. +func (a *AssemblerImpl) AllocateNOP() asm.Node { + n := a.nodePool.allocNode() + n.instruction = NOP + n.types = operandTypesNoneToNone + return n +} + +// Add implements asm.AssemblerBase. +func (a *AssemblerImpl) Add(n asm.Node) { + a.addNode(n.(*nodeImpl)) +} + +// Reset implements asm.AssemblerBase. +func (a *AssemblerImpl) Reset() { + pool := a.pool + pool.Reset() + *a = AssemblerImpl{ + nodePool: a.nodePool, + pool: pool, + readInstructionAddressNodes: a.readInstructionAddressNodes[:0], + staticConstReferrers: a.staticConstReferrers[:0], + BaseAssemblerImpl: asm.BaseAssemblerImpl{ + SetBranchTargetOnNextNodes: a.SetBranchTargetOnNextNodes[:0], + JumpTableEntries: a.JumpTableEntries[:0], + }, + } + a.nodePool.reset() +} + +// newNode creates a new Node and appends it into the linked list. +func (a *AssemblerImpl) newNode(instruction asm.Instruction, types operandTypes) *nodeImpl { + n := a.nodePool.allocNode() + n.instruction = instruction + n.types = types + a.addNode(n) + return n +} + +// addNode appends the new node into the linked list. +func (a *AssemblerImpl) addNode(node *nodeImpl) { + if a.root == nil { + a.root = node + a.current = node + } else { + parent := a.current + parent.next = node + node.prev = parent + a.current = node + } + + for _, o := range a.SetBranchTargetOnNextNodes { + origin := o.(*nodeImpl) + origin.jumpTarget = node + } + // Reuse the underlying slice to avoid re-allocations. + a.SetBranchTargetOnNextNodes = a.SetBranchTargetOnNextNodes[:0] +} + +// encodeNode encodes the given node into writer. +func (a *AssemblerImpl) encodeNode(buf asm.Buffer, n *nodeImpl) (err error) { + switch n.types { + case operandTypesNoneToNone: + err = a.encodeNoneToNone(buf, n) + case operandTypesNoneToRegister: + err = a.encodeNoneToRegister(buf, n) + case operandTypesNoneToMemory: + err = a.encodeNoneToMemory(buf, n) + case operandTypesNoneToBranch: + // Branching operand can be encoded as relative jumps. + err = a.encodeRelativeJump(buf, n) + case operandTypesRegisterToNone: + err = a.encodeRegisterToNone(buf, n) + case operandTypesRegisterToRegister: + err = a.encodeRegisterToRegister(buf, n) + case operandTypesRegisterToMemory: + err = a.encodeRegisterToMemory(buf, n) + case operandTypesRegisterToConst: + err = a.encodeRegisterToConst(buf, n) + case operandTypesMemoryToRegister: + err = a.encodeMemoryToRegister(buf, n) + case operandTypesMemoryToConst: + err = a.encodeMemoryToConst(buf, n) + case operandTypesConstToRegister: + err = a.encodeConstToRegister(buf, n) + case operandTypesConstToMemory: + err = a.encodeConstToMemory(buf, n) + case operandTypesStaticConstToRegister: + err = a.encodeStaticConstToRegister(buf, n) + case operandTypesRegisterToStaticConst: + err = a.encodeRegisterToStaticConst(buf, n) + default: + err = fmt.Errorf("encoder undefined for [%s] operand type", n.types) + } + if err != nil { + err = fmt.Errorf("%w: %s", err, n) // Ensure the error is debuggable by including the string value of the node. + } + return +} + +// Assemble implements asm.AssemblerBase +func (a *AssemblerImpl) Assemble(buf asm.Buffer) error { + a.initializeNodesForEncoding() + + // Continue encoding until we are not forced to re-assemble which happens when + // a short relative jump ends up the offset larger than 8-bit length. + for { + err := a.encode(buf) + if err != nil { + return err + } + + if !a.forceReAssemble { + break + } else { + // We reset the length of buffer but don't delete the underlying slice since + // the binary size will roughly the same after reassemble. + buf.Reset() + // Reset the re-assemble flag in order to avoid the infinite loop! + a.forceReAssemble = false + } + } + + code := buf.Bytes() + for _, n := range a.readInstructionAddressNodes { + if err := a.finalizeReadInstructionAddressNode(code, n); err != nil { + return err + } + } + + // Now that we've finished the layout, fill out static consts offsets. + for i := range a.staticConstReferrers { + ref := &a.staticConstReferrers[i] + n, instLen := ref.n, ref.instLen + // Calculate the displacement between the RIP (the offset _after_ n) and the static constant. + displacement := int(n.staticConst.OffsetInBinary) - int(n.OffsetInBinary()) - instLen + // The offset must be stored at the 4 bytes from the tail of this n. See AssemblerImpl.encodeStaticConstImpl for detail. + displacementOffsetInInstruction := n.OffsetInBinary() + uint64(instLen-4) + binary.LittleEndian.PutUint32(code[displacementOffsetInInstruction:], uint32(int32(displacement))) + } + + return a.FinalizeJumpTableEntry(code) +} + +// initializeNodesForEncoding initializes nodeImpl.flag and determine all the jumps +// are forward or backward jump. +func (a *AssemblerImpl) initializeNodesForEncoding() { + for n := a.root; n != nil; n = n.next { + n.flag |= nodeFlagInitializedForEncoding + if target := n.jumpTarget; target != nil { + if target.isInitializedForEncoding() { + // This means the target exists behind. + n.flag |= nodeFlagBackwardJump + } else { + // Otherwise, this is forward jump. + // We start with assuming that the jump can be short (8-bit displacement). + // If it doens't fit, we change this flag in resolveRelativeForwardJump. + n.flag |= nodeFlagShortForwardJump + + // If the target node is also the branching instruction, we replace the target with the NOP + // node so that we can avoid the collision of the target.forwardJumpOrigins both as destination and origins. + if target.types == operandTypesNoneToBranch { + // Allocate the NOP node from the pool. + nop := a.nodePool.allocNode() + nop.instruction = NOP + nop.types = operandTypesNoneToNone + // Insert it between target.prev and target: [target.prev, target] -> [target.prev, nop, target] + prev := target.prev + nop.prev = prev + prev.next = nop + nop.next = target + target.prev = nop + n.jumpTarget = nop + target = nop + } + + // We add this node `n` into the end of the linked list (.forwardJumpOrigins) beginning from the `target.forwardJumpOrigins`. + // Insert the current `n` as the head of the list. + n.forwardJumpOrigins = target.forwardJumpOrigins + target.forwardJumpOrigins = n + } + } + } +} + +func (a *AssemblerImpl) encode(buf asm.Buffer) error { + for n := a.root; n != nil; n = n.next { + // If an instruction needs NOP padding, we do so before encoding it. + // + // This is necessary to avoid Intel's jump erratum; see in Section 2.1 + // in for when we have to pad NOP: + // https://www.intel.com/content/dam/support/us/en/documents/processors/mitigations-jump-conditional-code-erratum.pdf + // + // This logic used to be implemented in a function called maybeNOPPadding, + // but the complexity of the logic made it impossible for the compiler to + // inline. Since this function is on a hot code path, we inlined the + // initial checks to skip the function call when instructions do not need + // NOP padding. + switch info := nopPaddingInfo[n.instruction]; { + case info.jmp: + if err := a.encodeJmpNOPPadding(buf, n); err != nil { + return err + } + case info.onNextJmp: + if err := a.encodeOnNextJmpNOPPAdding(buf, n); err != nil { + return err + } + } + + // After the padding, we can finalize the offset of this instruction in the binary. + n.offsetInBinary = uint64(buf.Len()) + + if err := a.encodeNode(buf, n); err != nil { + return err + } + + if n.forwardJumpOrigins != nil { + if err := a.resolveForwardRelativeJumps(buf, n); err != nil { + return fmt.Errorf("invalid relative forward jumps: %w", err) + } + } + + a.maybeFlushConstants(buf, n.next == nil) + } + return nil +} + +var nopPaddingInfo = [instructionEnd]struct { + jmp, onNextJmp bool +}{ + RET: {jmp: true}, + JMP: {jmp: true}, + JCC: {jmp: true}, + JCS: {jmp: true}, + JEQ: {jmp: true}, + JGE: {jmp: true}, + JGT: {jmp: true}, + JHI: {jmp: true}, + JLE: {jmp: true}, + JLS: {jmp: true}, + JLT: {jmp: true}, + JMI: {jmp: true}, + JNE: {jmp: true}, + JPC: {jmp: true}, + JPS: {jmp: true}, + // The possible fused jump instructions if the next node is a conditional jump instruction. + CMPL: {onNextJmp: true}, + CMPQ: {onNextJmp: true}, + TESTL: {onNextJmp: true}, + TESTQ: {onNextJmp: true}, + ADDL: {onNextJmp: true}, + ADDQ: {onNextJmp: true}, + SUBL: {onNextJmp: true}, + SUBQ: {onNextJmp: true}, + ANDL: {onNextJmp: true}, + ANDQ: {onNextJmp: true}, + INCQ: {onNextJmp: true}, + DECQ: {onNextJmp: true}, +} + +func (a *AssemblerImpl) encodeJmpNOPPadding(buf asm.Buffer, n *nodeImpl) error { + // In order to know the instruction length before writing into the binary, + // we try encoding it. + prevLen := buf.Len() + + // Assign the temporary offset which may or may not be correct depending on the padding decision. + n.offsetInBinary = uint64(prevLen) + + // Encode the node and get the instruction length. + if err := a.encodeNode(buf, n); err != nil { + return err + } + instructionLen := int32(buf.Len() - prevLen) + + // Revert the written bytes. + buf.Truncate(prevLen) + return a.encodeNOPPadding(buf, instructionLen) +} + +func (a *AssemblerImpl) encodeOnNextJmpNOPPAdding(buf asm.Buffer, n *nodeImpl) error { + instructionLen, err := a.fusedInstructionLength(buf, n) + if err != nil { + return err + } + return a.encodeNOPPadding(buf, instructionLen) +} + +// encodeNOPPadding maybe appends NOP instructions before the node `n`. +// This is necessary to avoid Intel's jump erratum: +// https://www.intel.com/content/dam/support/us/en/documents/processors/mitigations-jump-conditional-code-erratum.pdf +func (a *AssemblerImpl) encodeNOPPadding(buf asm.Buffer, instructionLen int32) error { + const boundaryInBytes int32 = 32 + const mask = boundaryInBytes - 1 + var padNum int + currentPos := int32(buf.Len()) + if used := currentPos & mask; used+instructionLen >= boundaryInBytes { + padNum = int(boundaryInBytes - used) + } + a.padNOP(buf, padNum) + return nil +} + +// fusedInstructionLength returns the length of "macro fused instruction" if the +// instruction sequence starting from `n` can be fused by processor. Otherwise, +// returns zero. +func (a *AssemblerImpl) fusedInstructionLength(buf asm.Buffer, n *nodeImpl) (ret int32, err error) { + // Find the next non-NOP instruction. + next := n.next + for ; next != nil && next.instruction == NOP; next = next.next { + } + + if next == nil { + return + } + + inst, jmpInst := n.instruction, next.instruction + + if !nopPaddingInfo[jmpInst].jmp { + // If the next instruction is not jump kind, the instruction will not be fused. + return + } + + // How to determine whether the instruction can be fused is described in + // Section 3.4.2.2 of "Intel Optimization Manual": + // https://www.intel.com/content/dam/doc/manual/64-ia-32-architectures-optimization-manual.pdf + isTest := inst == TESTL || inst == TESTQ + isCmp := inst == CMPQ || inst == CMPL + isTestCmp := isTest || isCmp + if isTestCmp && (n.types == operandTypesMemoryToConst || n.types == operandTypesConstToMemory) { + // The manual says: "CMP and TEST can not be fused when comparing MEM-IMM". + return + } + + // Implement the decision according to the table 3-1 in the manual. + isAnd := inst == ANDL || inst == ANDQ + if !isTest && !isAnd { + if jmpInst == JMI || jmpInst == JPL || jmpInst == JPS || jmpInst == JPC { + // These jumps are only fused for TEST or AND. + return + } + isAdd := inst == ADDL || inst == ADDQ + isSub := inst == SUBL || inst == SUBQ + if !isCmp && !isAdd && !isSub { + if jmpInst == JCS || jmpInst == JCC || jmpInst == JHI || jmpInst == JLS { + // Thses jumpst are only fused for TEST, AND, CMP, ADD, or SUB. + return + } + } + } + + // Now the instruction is ensured to be fused by the processor. + // In order to know the fused instruction length before writing into the binary, + // we try encoding it. + savedLen := uint64(buf.Len()) + + // Encode the nodes into the buffer. + if err = a.encodeNode(buf, n); err != nil { + return + } + if err = a.encodeNode(buf, next); err != nil { + return + } + + ret = int32(uint64(buf.Len()) - savedLen) + + // Revert the written bytes. + buf.Truncate(int(savedLen)) + return +} + +// nopOpcodes is the multi byte NOP instructions table derived from section 5.8 "Code Padding with Operand-Size Override and Multibyte NOP" +// in "AMD Software Optimization Guide for AMD Family 15h Processors" https://www.amd.com/system/files/TechDocs/47414_15h_sw_opt_guide.pdf +var nopOpcodes = [][11]byte{ + {0x90}, + {0x66, 0x90}, + {0x0f, 0x1f, 0x00}, + {0x0f, 0x1f, 0x40, 0x00}, + {0x0f, 0x1f, 0x44, 0x00, 0x00}, + {0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00}, + {0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00}, + {0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x66, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x66, 0x66, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x66, 0x66, 0x66, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}, +} + +func (a *AssemblerImpl) padNOP(buf asm.Buffer, num int) { + for num > 0 { + singleNopNum := num + if singleNopNum > len(nopOpcodes) { + singleNopNum = len(nopOpcodes) + } + buf.AppendBytes(nopOpcodes[singleNopNum-1][:singleNopNum]) + num -= singleNopNum + } +} + +// CompileStandAlone implements the same method as documented on asm.AssemblerBase. +func (a *AssemblerImpl) CompileStandAlone(instruction asm.Instruction) asm.Node { + return a.newNode(instruction, operandTypesNoneToNone) +} + +// CompileConstToRegister implements the same method as documented on asm.AssemblerBase. +func (a *AssemblerImpl) CompileConstToRegister( + instruction asm.Instruction, + value asm.ConstantValue, + destinationReg asm.Register, +) (inst asm.Node) { + n := a.newNode(instruction, operandTypesConstToRegister) + n.srcConst = value + n.dstReg = destinationReg + return n +} + +// CompileRegisterToRegister implements the same method as documented on asm.AssemblerBase. +func (a *AssemblerImpl) CompileRegisterToRegister(instruction asm.Instruction, from, to asm.Register) { + n := a.newNode(instruction, operandTypesRegisterToRegister) + n.srcReg = from + n.dstReg = to +} + +// CompileMemoryToRegister implements the same method as documented on asm.AssemblerBase. +func (a *AssemblerImpl) CompileMemoryToRegister( + instruction asm.Instruction, + sourceBaseReg asm.Register, + sourceOffsetConst asm.ConstantValue, + destinationReg asm.Register, +) { + n := a.newNode(instruction, operandTypesMemoryToRegister) + n.srcReg = sourceBaseReg + n.srcConst = sourceOffsetConst + n.dstReg = destinationReg +} + +// CompileRegisterToMemory implements the same method as documented on asm.AssemblerBase. +func (a *AssemblerImpl) CompileRegisterToMemory( + instruction asm.Instruction, + sourceRegister, destinationBaseRegister asm.Register, + destinationOffsetConst asm.ConstantValue, +) { + n := a.newNode(instruction, operandTypesRegisterToMemory) + n.srcReg = sourceRegister + n.dstReg = destinationBaseRegister + n.dstConst = destinationOffsetConst +} + +// CompileJump implements the same method as documented on asm.AssemblerBase. +func (a *AssemblerImpl) CompileJump(jmpInstruction asm.Instruction) asm.Node { + return a.newNode(jmpInstruction, operandTypesNoneToBranch) +} + +// CompileJumpToMemory implements the same method as documented on asm.AssemblerBase. +func (a *AssemblerImpl) CompileJumpToMemory( + jmpInstruction asm.Instruction, + baseReg asm.Register, + offset asm.ConstantValue, +) { + n := a.newNode(jmpInstruction, operandTypesNoneToMemory) + n.dstReg = baseReg + n.dstConst = offset +} + +// CompileJumpToRegister implements the same method as documented on asm.AssemblerBase. +func (a *AssemblerImpl) CompileJumpToRegister(jmpInstruction asm.Instruction, reg asm.Register) { + n := a.newNode(jmpInstruction, operandTypesNoneToRegister) + n.dstReg = reg +} + +// CompileReadInstructionAddress implements the same method as documented on asm.AssemblerBase. +func (a *AssemblerImpl) CompileReadInstructionAddress( + destinationRegister asm.Register, + beforeAcquisitionTargetInstruction asm.Instruction, +) { + n := a.newNode(LEAQ, operandTypesMemoryToRegister) + n.dstReg = destinationRegister + n.readInstructionAddressBeforeTargetInstruction = beforeAcquisitionTargetInstruction +} + +// CompileRegisterToRegisterWithArg implements the same method as documented on amd64.Assembler. +func (a *AssemblerImpl) CompileRegisterToRegisterWithArg( + instruction asm.Instruction, + from, to asm.Register, + arg byte, +) { + n := a.newNode(instruction, operandTypesRegisterToRegister) + n.srcReg = from + n.dstReg = to + n.arg = arg +} + +// CompileMemoryWithIndexToRegister implements the same method as documented on amd64.Assembler. +func (a *AssemblerImpl) CompileMemoryWithIndexToRegister( + instruction asm.Instruction, + srcBaseReg asm.Register, + srcOffsetConst asm.ConstantValue, + srcIndex asm.Register, + srcScale int16, + dstReg asm.Register, +) { + n := a.newNode(instruction, operandTypesMemoryToRegister) + n.srcReg = srcBaseReg + n.srcConst = srcOffsetConst + n.srcMemIndex = srcIndex + n.srcMemScale = byte(srcScale) + n.dstReg = dstReg +} + +// CompileMemoryWithIndexAndArgToRegister implements the same method as documented on amd64.Assembler. +func (a *AssemblerImpl) CompileMemoryWithIndexAndArgToRegister( + instruction asm.Instruction, + srcBaseReg asm.Register, + srcOffsetConst asm.ConstantValue, + srcIndex asm.Register, + srcScale int16, + dstReg asm.Register, + arg byte, +) { + n := a.newNode(instruction, operandTypesMemoryToRegister) + n.srcReg = srcBaseReg + n.srcConst = srcOffsetConst + n.srcMemIndex = srcIndex + n.srcMemScale = byte(srcScale) + n.dstReg = dstReg + n.arg = arg +} + +// CompileRegisterToMemoryWithIndex implements the same method as documented on amd64.Assembler. +func (a *AssemblerImpl) CompileRegisterToMemoryWithIndex( + instruction asm.Instruction, + srcReg, dstBaseReg asm.Register, + dstOffsetConst asm.ConstantValue, + dstIndex asm.Register, + dstScale int16, +) { + n := a.newNode(instruction, operandTypesRegisterToMemory) + n.srcReg = srcReg + n.dstReg = dstBaseReg + n.dstConst = dstOffsetConst + n.dstMemIndex = dstIndex + n.dstMemScale = byte(dstScale) +} + +// CompileRegisterToMemoryWithIndexAndArg implements the same method as documented on amd64.Assembler. +func (a *AssemblerImpl) CompileRegisterToMemoryWithIndexAndArg( + instruction asm.Instruction, + srcReg, dstBaseReg asm.Register, + dstOffsetConst asm.ConstantValue, + dstIndex asm.Register, + dstScale int16, + arg byte, +) { + n := a.newNode(instruction, operandTypesRegisterToMemory) + n.srcReg = srcReg + n.dstReg = dstBaseReg + n.dstConst = dstOffsetConst + n.dstMemIndex = dstIndex + n.dstMemScale = byte(dstScale) + n.arg = arg +} + +// CompileRegisterToConst implements the same method as documented on amd64.Assembler. +func (a *AssemblerImpl) CompileRegisterToConst( + instruction asm.Instruction, + srcRegister asm.Register, + value asm.ConstantValue, +) asm.Node { + n := a.newNode(instruction, operandTypesRegisterToConst) + n.srcReg = srcRegister + n.dstConst = value + return n +} + +// CompileRegisterToNone implements the same method as documented on amd64.Assembler. +func (a *AssemblerImpl) CompileRegisterToNone(instruction asm.Instruction, register asm.Register) { + n := a.newNode(instruction, operandTypesRegisterToNone) + n.srcReg = register +} + +// CompileNoneToRegister implements the same method as documented on amd64.Assembler. +func (a *AssemblerImpl) CompileNoneToRegister(instruction asm.Instruction, register asm.Register) { + n := a.newNode(instruction, operandTypesNoneToRegister) + n.dstReg = register +} + +// CompileNoneToMemory implements the same method as documented on amd64.Assembler. +func (a *AssemblerImpl) CompileNoneToMemory( + instruction asm.Instruction, + baseReg asm.Register, + offset asm.ConstantValue, +) { + n := a.newNode(instruction, operandTypesNoneToMemory) + n.dstReg = baseReg + n.dstConst = offset +} + +// CompileConstToMemory implements the same method as documented on amd64.Assembler. +func (a *AssemblerImpl) CompileConstToMemory( + instruction asm.Instruction, + value asm.ConstantValue, + dstbaseReg asm.Register, + dstOffset asm.ConstantValue, +) asm.Node { + n := a.newNode(instruction, operandTypesConstToMemory) + n.srcConst = value + n.dstReg = dstbaseReg + n.dstConst = dstOffset + return n +} + +// CompileMemoryToConst implements the same method as documented on amd64.Assembler. +func (a *AssemblerImpl) CompileMemoryToConst( + instruction asm.Instruction, + srcBaseReg asm.Register, + srcOffset, value asm.ConstantValue, +) asm.Node { + n := a.newNode(instruction, operandTypesMemoryToConst) + n.srcReg = srcBaseReg + n.srcConst = srcOffset + n.dstConst = value + return n +} + +func errorEncodingUnsupported(n *nodeImpl) error { + return fmt.Errorf("%s is unsupported for %s type", InstructionName(n.instruction), n.types) +} + +func (a *AssemblerImpl) encodeNoneToNone(buf asm.Buffer, n *nodeImpl) (err error) { + // Throughout the encoding methods, we use this pair of base offset and + // code buffer to write instructions. + // + // The code buffer is allocated at the end of the current buffer to a size + // large enough to hold all the bytes that may be written by the method. + // + // We use Go's append builtin to write to the buffer because it allows the + // compiler to generate much better code than if we made calls to write + // methods to mutate an encapsulated byte slice. + // + // At the end of the method, we truncate the buffer size back to the base + // plus the length of the code buffer so the end of the buffer points right + // after the last byte that was written. + base := buf.Len() + code := buf.Append(4)[:0] + + switch n.instruction { + case CDQ: + // https://www.felixcloutier.com/x86/cwd:cdq:cqo + code = append(code, 0x99) + case CQO: + // https://www.felixcloutier.com/x86/cwd:cdq:cqo + code = append(code, rexPrefixW, 0x99) + case NOP: + // Simply optimize out the NOP instructions. + case RET: + // https://www.felixcloutier.com/x86/ret + code = append(code, 0xc3) + case UD2: + // https://mudongliang.github.io/x86/html/file_module_x86_id_318.html + code = append(code, 0x0f, 0x0b) + case REPMOVSQ: + code = append(code, 0xf3, rexPrefixW, 0xa5) + case REPSTOSQ: + code = append(code, 0xf3, rexPrefixW, 0xab) + case STD: + code = append(code, 0xfd) + case CLD: + code = append(code, 0xfc) + default: + err = errorEncodingUnsupported(n) + } + + buf.Truncate(base + len(code)) + return +} + +func (a *AssemblerImpl) encodeNoneToRegister(buf asm.Buffer, n *nodeImpl) (err error) { + regBits, prefix := register3bits(n.dstReg, registerSpecifierPositionModRMFieldRM) + + // https://wiki.osdev.org/X86-64_Instruction_Encoding#ModR.2FM + modRM := 0b11_000_000 | // Specifying that opeand is register. + regBits + if n.instruction == JMP { + // JMP's opcode is defined as "FF /4" meaning that we have to have "4" + // in 4-6th bits in the ModRM byte. https://www.felixcloutier.com/x86/jmp + modRM |= 0b00_100_000 + } else if n.instruction == NEGQ { + prefix |= rexPrefixW + modRM |= 0b00_011_000 + } else if n.instruction == INCQ { + prefix |= rexPrefixW + } else if n.instruction == DECQ { + prefix |= rexPrefixW + modRM |= 0b00_001_000 + } else { + if RegSP <= n.dstReg && n.dstReg <= RegDI { + // If the destination is one byte length register, we need to have the default prefix. + // https: //wiki.osdev.org/X86-64_Instruction_Encoding#Registers + prefix |= rexPrefixDefault + } + } + + base := buf.Len() + code := buf.Append(4)[:0] + + if prefix != rexPrefixNone { + // https://wiki.osdev.org/X86-64_Instruction_Encoding#Encoding + code = append(code, prefix) + } + + switch n.instruction { + case JMP: + // https://www.felixcloutier.com/x86/jmp + code = append(code, 0xff, modRM) + case SETCC: + // https://www.felixcloutier.com/x86/setcc + code = append(code, 0x0f, 0x93, modRM) + case SETCS: + // https://www.felixcloutier.com/x86/setcc + code = append(code, 0x0f, 0x92, modRM) + case SETEQ: + // https://www.felixcloutier.com/x86/setcc + code = append(code, 0x0f, 0x94, modRM) + case SETGE: + // https://www.felixcloutier.com/x86/setcc + code = append(code, 0x0f, 0x9d, modRM) + case SETGT: + // https://www.felixcloutier.com/x86/setcc + code = append(code, 0x0f, 0x9f, modRM) + case SETHI: + // https://www.felixcloutier.com/x86/setcc + code = append(code, 0x0f, 0x97, modRM) + case SETLE: + // https://www.felixcloutier.com/x86/setcc + code = append(code, 0x0f, 0x9e, modRM) + case SETLS: + // https://www.felixcloutier.com/x86/setcc + code = append(code, 0x0f, 0x96, modRM) + case SETLT: + // https://www.felixcloutier.com/x86/setcc + code = append(code, 0x0f, 0x9c, modRM) + case SETNE: + // https://www.felixcloutier.com/x86/setcc + code = append(code, 0x0f, 0x95, modRM) + case SETPC: + // https://www.felixcloutier.com/x86/setcc + code = append(code, 0x0f, 0x9b, modRM) + case SETPS: + // https://www.felixcloutier.com/x86/setcc + code = append(code, 0x0f, 0x9a, modRM) + case NEGQ: + // https://www.felixcloutier.com/x86/neg + code = append(code, 0xf7, modRM) + case INCQ: + // https://www.felixcloutier.com/x86/inc + code = append(code, 0xff, modRM) + case DECQ: + // https://www.felixcloutier.com/x86/dec + code = append(code, 0xff, modRM) + default: + err = errorEncodingUnsupported(n) + } + + buf.Truncate(base + len(code)) + return +} + +func (a *AssemblerImpl) encodeNoneToMemory(buf asm.Buffer, n *nodeImpl) (err error) { + rexPrefix, modRM, sbi, sbiExist, displacementWidth, err := n.getMemoryLocation(true) + if err != nil { + return err + } + + var opcode byte + switch n.instruction { + case INCQ: + // https://www.felixcloutier.com/x86/inc + rexPrefix |= rexPrefixW + opcode = 0xff + case DECQ: + // https://www.felixcloutier.com/x86/dec + rexPrefix |= rexPrefixW + modRM |= 0b00_001_000 // DEC needs "/1" extension in ModRM. + opcode = 0xff + case JMP: + // https://www.felixcloutier.com/x86/jmp + modRM |= 0b00_100_000 // JMP needs "/4" extension in ModRM. + opcode = 0xff + default: + return errorEncodingUnsupported(n) + } + + base := buf.Len() + code := buf.Append(12)[:0] + + if rexPrefix != rexPrefixNone { + code = append(code, rexPrefix) + } + + code = append(code, opcode, modRM) + + if sbiExist { + code = append(code, sbi) + } + + if displacementWidth != 0 { + code = appendConst(code, n.dstConst, displacementWidth) + } + + buf.Truncate(base + len(code)) + return +} + +type relativeJumpOpcode struct{ short, long []byte } + +func (o relativeJumpOpcode) instructionLen(short bool) int64 { + if short { + return int64(len(o.short)) + 1 // 1 byte = 8 bit offset + } else { + return int64(len(o.long)) + 4 // 4 byte = 32 bit offset + } +} + +var relativeJumpOpcodes = [...]relativeJumpOpcode{ + // https://www.felixcloutier.com/x86/jcc + JCC: {short: []byte{0x73}, long: []byte{0x0f, 0x83}}, + JCS: {short: []byte{0x72}, long: []byte{0x0f, 0x82}}, + JEQ: {short: []byte{0x74}, long: []byte{0x0f, 0x84}}, + JGE: {short: []byte{0x7d}, long: []byte{0x0f, 0x8d}}, + JGT: {short: []byte{0x7f}, long: []byte{0x0f, 0x8f}}, + JHI: {short: []byte{0x77}, long: []byte{0x0f, 0x87}}, + JLE: {short: []byte{0x7e}, long: []byte{0x0f, 0x8e}}, + JLS: {short: []byte{0x76}, long: []byte{0x0f, 0x86}}, + JLT: {short: []byte{0x7c}, long: []byte{0x0f, 0x8c}}, + JMI: {short: []byte{0x78}, long: []byte{0x0f, 0x88}}, + JPL: {short: []byte{0x79}, long: []byte{0x0f, 0x89}}, + JNE: {short: []byte{0x75}, long: []byte{0x0f, 0x85}}, + JPC: {short: []byte{0x7b}, long: []byte{0x0f, 0x8b}}, + JPS: {short: []byte{0x7a}, long: []byte{0x0f, 0x8a}}, + // https://www.felixcloutier.com/x86/jmp + JMP: {short: []byte{0xeb}, long: []byte{0xe9}}, +} + +func (a *AssemblerImpl) resolveForwardRelativeJumps(buf asm.Buffer, target *nodeImpl) (err error) { + offsetInBinary := int64(target.OffsetInBinary()) + origin := target.forwardJumpOrigins + for ; origin != nil; origin = origin.forwardJumpOrigins { + shortJump := origin.isForwardShortJump() + op := relativeJumpOpcodes[origin.instruction] + instructionLen := op.instructionLen(shortJump) + + // Calculate the offset from the EIP (at the time of executing this jump instruction) + // to the target instruction. This value is always >= 0 as here we only handle forward jumps. + offset := offsetInBinary - (int64(origin.OffsetInBinary()) + instructionLen) + if shortJump { + if offset > math.MaxInt8 { + // This forces reassemble in the outer loop inside AssemblerImpl.Assemble(). + a.forceReAssemble = true + // From the next reAssemble phases, this forward jump will be encoded long jump and + // allocate 32-bit offset bytes by default. This means that this `origin` node + // will always enter the "long jump offset encoding" block below + origin.flag ^= nodeFlagShortForwardJump + } else { + buf.Bytes()[origin.OffsetInBinary()+uint64(instructionLen)-1] = byte(offset) + } + } else { // long jump offset encoding. + if offset > math.MaxInt32 { + return fmt.Errorf("too large jump offset %d for encoding %s", offset, InstructionName(origin.instruction)) + } + binary.LittleEndian.PutUint32(buf.Bytes()[origin.OffsetInBinary()+uint64(instructionLen)-4:], uint32(offset)) + } + } + return nil +} + +func (a *AssemblerImpl) encodeRelativeJump(buf asm.Buffer, n *nodeImpl) (err error) { + if n.jumpTarget == nil { + err = fmt.Errorf("jump target must not be nil for relative %s", InstructionName(n.instruction)) + return + } + + op := relativeJumpOpcodes[n.instruction] + var isShortJump bool + // offsetOfEIP means the offset of EIP register at the time of executing this jump instruction. + // Relative jump instructions can be encoded with the signed 8-bit or 32-bit integer offsets from the EIP. + var offsetOfEIP int64 = 0 // We set zero and resolve later once the target instruction is encoded for forward jumps + if n.isBackwardJump() { + // If this is the backward jump, we can calculate the exact offset now. + offsetOfJumpInstruction := int64(n.jumpTarget.OffsetInBinary()) - int64(n.OffsetInBinary()) + isShortJump = offsetOfJumpInstruction-2 >= math.MinInt8 + offsetOfEIP = offsetOfJumpInstruction - op.instructionLen(isShortJump) + } else { + // For forward jumps, we resolve the offset when we Encode the target node. See AssemblerImpl.ResolveForwardRelativeJumps. + isShortJump = n.isForwardShortJump() + } + + if offsetOfEIP < math.MinInt32 { // offsetOfEIP is always <= 0 as we don't calculate it for forward jump here. + return fmt.Errorf("too large jump offset %d for encoding %s", offsetOfEIP, InstructionName(n.instruction)) + } + + base := buf.Len() + code := buf.Append(6)[:0] + + if isShortJump { + code = append(code, op.short...) + code = append(code, byte(offsetOfEIP)) + } else { + code = append(code, op.long...) + code = appendUint32(code, uint32(offsetOfEIP)) + } + + buf.Truncate(base + len(code)) + return +} + +func (a *AssemblerImpl) encodeRegisterToNone(buf asm.Buffer, n *nodeImpl) (err error) { + regBits, prefix := register3bits(n.srcReg, registerSpecifierPositionModRMFieldRM) + + // https://wiki.osdev.org/X86-64_Instruction_Encoding#ModR.2FM + modRM := 0b11_000_000 | // Specifying that opeand is register. + regBits + + var opcode byte + switch n.instruction { + case DIVL: + // https://www.felixcloutier.com/x86/div + modRM |= 0b00_110_000 + opcode = 0xf7 + case DIVQ: + // https://www.felixcloutier.com/x86/div + prefix |= rexPrefixW + modRM |= 0b00_110_000 + opcode = 0xf7 + case IDIVL: + // https://www.felixcloutier.com/x86/idiv + modRM |= 0b00_111_000 + opcode = 0xf7 + case IDIVQ: + // https://www.felixcloutier.com/x86/idiv + prefix |= rexPrefixW + modRM |= 0b00_111_000 + opcode = 0xf7 + case MULL: + // https://www.felixcloutier.com/x86/mul + modRM |= 0b00_100_000 + opcode = 0xf7 + case MULQ: + // https://www.felixcloutier.com/x86/mul + prefix |= rexPrefixW + modRM |= 0b00_100_000 + opcode = 0xf7 + default: + err = errorEncodingUnsupported(n) + } + + base := buf.Len() + code := buf.Append(3)[:0] + + if prefix != rexPrefixNone { + code = append(code, prefix) + } + + code = append(code, opcode, modRM) + + buf.Truncate(base + len(code)) + return +} + +var registerToRegisterOpcode = [instructionEnd]*struct { + opcode []byte + rPrefix rexPrefix + mandatoryPrefix byte + srcOnModRMReg bool + isSrc8bit bool + needArg bool +}{ + // https://www.felixcloutier.com/x86/add + ADDL: {opcode: []byte{0x1}, srcOnModRMReg: true}, + ADDQ: {opcode: []byte{0x1}, rPrefix: rexPrefixW, srcOnModRMReg: true}, + // https://www.felixcloutier.com/x86/and + ANDL: {opcode: []byte{0x21}, srcOnModRMReg: true}, + ANDQ: {opcode: []byte{0x21}, rPrefix: rexPrefixW, srcOnModRMReg: true}, + // https://www.felixcloutier.com/x86/cmp + CMPL: {opcode: []byte{0x39}}, + CMPQ: {opcode: []byte{0x39}, rPrefix: rexPrefixW}, + // https://www.felixcloutier.com/x86/cmovcc + CMOVQCS: {opcode: []byte{0x0f, 0x42}, rPrefix: rexPrefixW}, + // https://www.felixcloutier.com/x86/addsd + ADDSD: {mandatoryPrefix: 0xf2, opcode: []byte{0x0f, 0x58}}, + // https://www.felixcloutier.com/x86/addss + ADDSS: {mandatoryPrefix: 0xf3, opcode: []byte{0x0f, 0x58}}, + // https://www.felixcloutier.com/x86/addpd + ANDPD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x54}}, + // https://www.felixcloutier.com/x86/addps + ANDPS: {opcode: []byte{0x0f, 0x54}}, + // https://www.felixcloutier.com/x86/bsr + BSRL: {opcode: []byte{0xf, 0xbd}}, + BSRQ: {opcode: []byte{0xf, 0xbd}, rPrefix: rexPrefixW}, + // https://www.felixcloutier.com/x86/comisd + COMISD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x2f}}, + // https://www.felixcloutier.com/x86/comiss + COMISS: {opcode: []byte{0x0f, 0x2f}}, + // https://www.felixcloutier.com/x86/cvtsd2ss + CVTSD2SS: {mandatoryPrefix: 0xf2, opcode: []byte{0x0f, 0x5a}}, + // https://www.felixcloutier.com/x86/cvtsi2sd + CVTSL2SD: {mandatoryPrefix: 0xf2, opcode: []byte{0x0f, 0x2a}}, + // https://www.felixcloutier.com/x86/cvtsi2sd + CVTSQ2SD: {mandatoryPrefix: 0xf2, opcode: []byte{0x0f, 0x2a}, rPrefix: rexPrefixW}, + // https://www.felixcloutier.com/x86/cvtsi2ss + CVTSL2SS: {mandatoryPrefix: 0xf3, opcode: []byte{0x0f, 0x2a}}, + // https://www.felixcloutier.com/x86/cvtsi2ss + CVTSQ2SS: {mandatoryPrefix: 0xf3, opcode: []byte{0x0f, 0x2a}, rPrefix: rexPrefixW}, + // https://www.felixcloutier.com/x86/cvtss2sd + CVTSS2SD: {mandatoryPrefix: 0xf3, opcode: []byte{0x0f, 0x5a}}, + // https://www.felixcloutier.com/x86/cvttsd2si + CVTTSD2SL: {mandatoryPrefix: 0xf2, opcode: []byte{0x0f, 0x2c}}, + CVTTSD2SQ: {mandatoryPrefix: 0xf2, opcode: []byte{0x0f, 0x2c}, rPrefix: rexPrefixW}, + // https://www.felixcloutier.com/x86/cvttss2si + CVTTSS2SL: {mandatoryPrefix: 0xf3, opcode: []byte{0x0f, 0x2c}}, + CVTTSS2SQ: {mandatoryPrefix: 0xf3, opcode: []byte{0x0f, 0x2c}, rPrefix: rexPrefixW}, + // https://www.felixcloutier.com/x86/divsd + DIVSD: {mandatoryPrefix: 0xf2, opcode: []byte{0x0f, 0x5e}}, + // https://www.felixcloutier.com/x86/divss + DIVSS: {mandatoryPrefix: 0xf3, opcode: []byte{0x0f, 0x5e}}, + // https://www.felixcloutier.com/x86/lzcnt + LZCNTL: {mandatoryPrefix: 0xf3, opcode: []byte{0x0f, 0xbd}}, + LZCNTQ: {mandatoryPrefix: 0xf3, opcode: []byte{0x0f, 0xbd}, rPrefix: rexPrefixW}, + // https://www.felixcloutier.com/x86/maxsd + MAXSD: {mandatoryPrefix: 0xf2, opcode: []byte{0x0f, 0x5f}}, + // https://www.felixcloutier.com/x86/maxss + MAXSS: {mandatoryPrefix: 0xf3, opcode: []byte{0x0f, 0x5f}}, + // https://www.felixcloutier.com/x86/minsd + MINSD: {mandatoryPrefix: 0xf2, opcode: []byte{0x0f, 0x5d}}, + // https://www.felixcloutier.com/x86/minss + MINSS: {mandatoryPrefix: 0xf3, opcode: []byte{0x0f, 0x5d}}, + // https://www.felixcloutier.com/x86/movsx:movsxd + MOVBLSX: {opcode: []byte{0x0f, 0xbe}, isSrc8bit: true}, + // https://www.felixcloutier.com/x86/movzx + MOVBLZX: {opcode: []byte{0x0f, 0xb6}, isSrc8bit: true}, + // https://www.felixcloutier.com/x86/movzx + MOVWLZX: {opcode: []byte{0x0f, 0xb7}, isSrc8bit: true}, + // https://www.felixcloutier.com/x86/movsx:movsxd + MOVBQSX: {opcode: []byte{0x0f, 0xbe}, rPrefix: rexPrefixW, isSrc8bit: true}, + // https://www.felixcloutier.com/x86/movsx:movsxd + MOVLQSX: {opcode: []byte{0x63}, rPrefix: rexPrefixW}, + // https://www.felixcloutier.com/x86/movsx:movsxd + MOVWQSX: {opcode: []byte{0x0f, 0xbf}, rPrefix: rexPrefixW}, + // https://www.felixcloutier.com/x86/movsx:movsxd + MOVWLSX: {opcode: []byte{0x0f, 0xbf}}, + // https://www.felixcloutier.com/x86/imul + IMULQ: {opcode: []byte{0x0f, 0xaf}, rPrefix: rexPrefixW}, + // https://www.felixcloutier.com/x86/mulss + MULSS: {mandatoryPrefix: 0xf3, opcode: []byte{0x0f, 0x59}}, + // https://www.felixcloutier.com/x86/mulsd + MULSD: {mandatoryPrefix: 0xf2, opcode: []byte{0x0f, 0x59}}, + // https://www.felixcloutier.com/x86/or + ORL: {opcode: []byte{0x09}, srcOnModRMReg: true}, + ORQ: {opcode: []byte{0x09}, rPrefix: rexPrefixW, srcOnModRMReg: true}, + // https://www.felixcloutier.com/x86/orpd + ORPD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x56}}, + // https://www.felixcloutier.com/x86/orps + ORPS: {opcode: []byte{0x0f, 0x56}}, + // https://www.felixcloutier.com/x86/popcnt + POPCNTL: {mandatoryPrefix: 0xf3, opcode: []byte{0x0f, 0xb8}}, + POPCNTQ: {mandatoryPrefix: 0xf3, opcode: []byte{0x0f, 0xb8}, rPrefix: rexPrefixW}, + // https://www.felixcloutier.com/x86/roundss + ROUNDSS: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x3a, 0x0a}, needArg: true}, + // https://www.felixcloutier.com/x86/roundsd + ROUNDSD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x3a, 0x0b}, needArg: true}, + // https://www.felixcloutier.com/x86/sqrtss + SQRTSS: {mandatoryPrefix: 0xf3, opcode: []byte{0x0f, 0x51}}, + // https://www.felixcloutier.com/x86/sqrtsd + SQRTSD: {mandatoryPrefix: 0xf2, opcode: []byte{0x0f, 0x51}}, + // https://www.felixcloutier.com/x86/sub + SUBL: {opcode: []byte{0x29}, srcOnModRMReg: true}, + SUBQ: {opcode: []byte{0x29}, rPrefix: rexPrefixW, srcOnModRMReg: true}, + // https://www.felixcloutier.com/x86/subss + SUBSS: {mandatoryPrefix: 0xf3, opcode: []byte{0x0f, 0x5c}}, + // https://www.felixcloutier.com/x86/subsd + SUBSD: {mandatoryPrefix: 0xf2, opcode: []byte{0x0f, 0x5c}}, + // https://www.felixcloutier.com/x86/test + TESTL: {opcode: []byte{0x85}, srcOnModRMReg: true}, + TESTQ: {opcode: []byte{0x85}, rPrefix: rexPrefixW, srcOnModRMReg: true}, + // https://www.felixcloutier.com/x86/tzcnt + TZCNTL: {mandatoryPrefix: 0xf3, opcode: []byte{0x0f, 0xbc}}, + TZCNTQ: {mandatoryPrefix: 0xf3, opcode: []byte{0x0f, 0xbc}, rPrefix: rexPrefixW}, + // https://www.felixcloutier.com/x86/ucomisd + UCOMISD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x2e}}, + // https://www.felixcloutier.com/x86/ucomiss + UCOMISS: {opcode: []byte{0x0f, 0x2e}}, + // https://www.felixcloutier.com/x86/xchg + XCHGQ: {opcode: []byte{0x87}, rPrefix: rexPrefixW, srcOnModRMReg: true}, + // https://www.felixcloutier.com/x86/xor + XORL: {opcode: []byte{0x31}, srcOnModRMReg: true}, + XORQ: {opcode: []byte{0x31}, rPrefix: rexPrefixW, srcOnModRMReg: true}, + // https://www.felixcloutier.com/x86/xorpd + XORPD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x57}}, + XORPS: {opcode: []byte{0x0f, 0x57}}, + // https://www.felixcloutier.com/x86/pinsrb:pinsrd:pinsrq + PINSRB: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x3a, 0x20}, needArg: true}, + // https://www.felixcloutier.com/x86/pinsrw + PINSRW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xc4}, needArg: true}, + // https://www.felixcloutier.com/x86/pinsrb:pinsrd:pinsrq + PINSRD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x3a, 0x22}, needArg: true}, + // https://www.felixcloutier.com/x86/pinsrb:pinsrd:pinsrq + PINSRQ: {mandatoryPrefix: 0x66, rPrefix: rexPrefixW, opcode: []byte{0x0f, 0x3a, 0x22}, needArg: true}, + // https://www.felixcloutier.com/x86/movdqu:vmovdqu8:vmovdqu16:vmovdqu32:vmovdqu64 + MOVDQU: {mandatoryPrefix: 0xf3, opcode: []byte{0x0f, 0x6f}}, + // https://www.felixcloutier.com/x86/movdqa:vmovdqa32:vmovdqa64 + MOVDQA: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x6f}}, + // https://www.felixcloutier.com/x86/paddb:paddw:paddd:paddq + PADDB: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xfc}}, + PADDW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xfd}}, + PADDD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xfe}}, + PADDQ: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xd4}}, + // https://www.felixcloutier.com/x86/psubb:psubw:psubd + PSUBB: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xf8}}, + PSUBW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xf9}}, + PSUBD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xfa}}, + // https://www.felixcloutier.com/x86/psubq + PSUBQ: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xfb}}, + // https://www.felixcloutier.com/x86/addps + ADDPS: {opcode: []byte{0x0f, 0x58}}, + // https://www.felixcloutier.com/x86/addpd + ADDPD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x58}}, + // https://www.felixcloutier.com/x86/subps + SUBPS: {opcode: []byte{0x0f, 0x5c}}, + // https://www.felixcloutier.com/x86/subpd + SUBPD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x5c}}, + // https://www.felixcloutier.com/x86/pxor + PXOR: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xef}}, + // https://www.felixcloutier.com/x86/pand + PAND: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xdb}}, + // https://www.felixcloutier.com/x86/por + POR: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xeb}}, + // https://www.felixcloutier.com/x86/pandn + PANDN: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xdf}}, + // https://www.felixcloutier.com/x86/pshufb + PSHUFB: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x0}}, + // https://www.felixcloutier.com/x86/pshufd + PSHUFD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x70}, needArg: true}, + // https://www.felixcloutier.com/x86/pextrb:pextrd:pextrq + PEXTRB: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x3a, 0x14}, needArg: true, srcOnModRMReg: true}, + // https://www.felixcloutier.com/x86/pextrw + PEXTRW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xc5}, needArg: true}, + // https://www.felixcloutier.com/x86/pextrb:pextrd:pextrq + PEXTRD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x3a, 0x16}, needArg: true, srcOnModRMReg: true}, + // https://www.felixcloutier.com/x86/pextrb:pextrd:pextrq + PEXTRQ: {rPrefix: rexPrefixW, mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x3a, 0x16}, needArg: true, srcOnModRMReg: true}, + // https://www.felixcloutier.com/x86/insertps + INSERTPS: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x3a, 0x21}, needArg: true}, + // https://www.felixcloutier.com/x86/movlhps + MOVLHPS: {opcode: []byte{0x0f, 0x16}}, + // https://www.felixcloutier.com/x86/ptest + PTEST: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x17}}, + // https://www.felixcloutier.com/x86/pcmpeqb:pcmpeqw:pcmpeqd + PCMPEQB: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x74}}, + PCMPEQW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x75}}, + PCMPEQD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x76}}, + // https://www.felixcloutier.com/x86/pcmpeqq + PCMPEQQ: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x29}}, + // https://www.felixcloutier.com/x86/paddusb:paddusw + PADDUSB: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xdc}}, + // https://www.felixcloutier.com/x86/movsd + MOVSD: {mandatoryPrefix: 0xf2, opcode: []byte{0x0f, 0x10}}, + // https://www.felixcloutier.com/x86/packsswb:packssdw + PACKSSWB: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x63}}, + // https://www.felixcloutier.com/x86/pmovmskb + PMOVMSKB: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xd7}}, + // https://www.felixcloutier.com/x86/movmskps + MOVMSKPS: {opcode: []byte{0x0f, 0x50}}, + // https://www.felixcloutier.com/x86/movmskpd + MOVMSKPD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x50}}, + // https://www.felixcloutier.com/x86/psraw:psrad:psraq + PSRAD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xe2}}, + // https://www.felixcloutier.com/x86/psraw:psrad:psraq + PSRAW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xe1}}, + // https://www.felixcloutier.com/x86/psrlw:psrld:psrlq + PSRLQ: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xd3}}, + // https://www.felixcloutier.com/x86/psrlw:psrld:psrlq + PSRLD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xd2}}, + // https://www.felixcloutier.com/x86/psrlw:psrld:psrlq + PSRLW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xd1}}, + // https://www.felixcloutier.com/x86/psllw:pslld:psllq + PSLLW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xf1}}, + // https://www.felixcloutier.com/x86/psllw:pslld:psllq + PSLLD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xf2}}, + // https://www.felixcloutier.com/x86/psllw:pslld:psllq + PSLLQ: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xf3}}, + // https://www.felixcloutier.com/x86/punpcklbw:punpcklwd:punpckldq:punpcklqdq + PUNPCKLBW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x60}}, + // https://www.felixcloutier.com/x86/punpckhbw:punpckhwd:punpckhdq:punpckhqdq + PUNPCKHBW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x68}}, + // https://www.felixcloutier.com/x86/cmpps + CMPPS: {opcode: []byte{0x0f, 0xc2}, needArg: true}, + // https://www.felixcloutier.com/x86/cmppd + CMPPD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xc2}, needArg: true}, + // https://www.felixcloutier.com/x86/pcmpgtq + PCMPGTQ: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x37}}, + // https://www.felixcloutier.com/x86/pcmpgtb:pcmpgtw:pcmpgtd + PCMPGTD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x66}}, + // https://www.felixcloutier.com/x86/pcmpgtb:pcmpgtw:pcmpgtd + PCMPGTW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x65}}, + // https://www.felixcloutier.com/x86/pcmpgtb:pcmpgtw:pcmpgtd + PCMPGTB: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x64}}, + // https://www.felixcloutier.com/x86/pminsd:pminsq + PMINSD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x39}}, + // https://www.felixcloutier.com/x86/pmaxsb:pmaxsw:pmaxsd:pmaxsq + PMAXSD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x3d}}, + // https://www.felixcloutier.com/x86/pmaxsb:pmaxsw:pmaxsd:pmaxsq + PMAXSW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xee}}, + // https://www.felixcloutier.com/x86/pmaxsb:pmaxsw:pmaxsd:pmaxsq + PMAXSB: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x3c}}, + // https://www.felixcloutier.com/x86/pminsb:pminsw + PMINSW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xea}}, + // https://www.felixcloutier.com/x86/pminsb:pminsw + PMINSB: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x38}}, + // https://www.felixcloutier.com/x86/pminud:pminuq + PMINUD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x3b}}, + // https://www.felixcloutier.com/x86/pminub:pminuw + PMINUW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x3a}}, + // https://www.felixcloutier.com/x86/pminub:pminuw + PMINUB: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xda}}, + // https://www.felixcloutier.com/x86/pmaxud:pmaxuq + PMAXUD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x3f}}, + // https://www.felixcloutier.com/x86/pmaxub:pmaxuw + PMAXUW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x3e}}, + // https://www.felixcloutier.com/x86/pmaxub:pmaxuw + PMAXUB: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xde}}, + // https://www.felixcloutier.com/x86/pmullw + PMULLW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xd5}}, + // https://www.felixcloutier.com/x86/pmulld:pmullq + PMULLD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x40}}, + // https://www.felixcloutier.com/x86/pmuludq + PMULUDQ: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xf4}}, + // https://www.felixcloutier.com/x86/psubsb:psubsw + PSUBSB: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xe8}}, + // https://www.felixcloutier.com/x86/psubsb:psubsw + PSUBSW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xe9}}, + // https://www.felixcloutier.com/x86/psubusb:psubusw + PSUBUSB: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xd8}}, + // https://www.felixcloutier.com/x86/psubusb:psubusw + PSUBUSW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xd9}}, + // https://www.felixcloutier.com/x86/paddsb:paddsw + PADDSW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xed}}, + // https://www.felixcloutier.com/x86/paddsb:paddsw + PADDSB: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xec}}, + // https://www.felixcloutier.com/x86/paddusb:paddusw + PADDUSW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xdd}}, + // https://www.felixcloutier.com/x86/pavgb:pavgw + PAVGB: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xe0}}, + // https://www.felixcloutier.com/x86/pavgb:pavgw + PAVGW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xe3}}, + // https://www.felixcloutier.com/x86/pabsb:pabsw:pabsd:pabsq + PABSB: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x1c}}, + // https://www.felixcloutier.com/x86/pabsb:pabsw:pabsd:pabsq + PABSW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x1d}}, + // https://www.felixcloutier.com/x86/pabsb:pabsw:pabsd:pabsq + PABSD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x1e}}, + // https://www.felixcloutier.com/x86/blendvpd + BLENDVPD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x15}}, + // https://www.felixcloutier.com/x86/maxpd + MAXPD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x5f}}, + // https://www.felixcloutier.com/x86/maxps + MAXPS: {opcode: []byte{0x0f, 0x5f}}, + // https://www.felixcloutier.com/x86/minpd + MINPD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x5d}}, + // https://www.felixcloutier.com/x86/minps + MINPS: {opcode: []byte{0x0f, 0x5d}}, + // https://www.felixcloutier.com/x86/andnpd + ANDNPD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x55}}, + // https://www.felixcloutier.com/x86/andnps + ANDNPS: {opcode: []byte{0x0f, 0x55}}, + // https://www.felixcloutier.com/x86/mulps + MULPS: {opcode: []byte{0x0f, 0x59}}, + // https://www.felixcloutier.com/x86/mulpd + MULPD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x59}}, + // https://www.felixcloutier.com/x86/divps + DIVPS: {opcode: []byte{0x0f, 0x5e}}, + // https://www.felixcloutier.com/x86/divpd + DIVPD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x5e}}, + // https://www.felixcloutier.com/x86/sqrtps + SQRTPS: {opcode: []byte{0x0f, 0x51}}, + // https://www.felixcloutier.com/x86/sqrtpd + SQRTPD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x51}}, + // https://www.felixcloutier.com/x86/roundps + ROUNDPS: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x3a, 0x08}, needArg: true}, + // https://www.felixcloutier.com/x86/roundpd + ROUNDPD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x3a, 0x09}, needArg: true}, + // https://www.felixcloutier.com/x86/palignr + PALIGNR: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x3a, 0x0f}, needArg: true}, + // https://www.felixcloutier.com/x86/punpcklbw:punpcklwd:punpckldq:punpcklqdq + PUNPCKLWD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x61}}, + // https://www.felixcloutier.com/x86/punpckhbw:punpckhwd:punpckhdq:punpckhqdq + PUNPCKHWD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x69}}, + // https://www.felixcloutier.com/x86/pmulhuw + PMULHUW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xe4}}, + // https://www.felixcloutier.com/x86/pmuldq + PMULDQ: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x28}}, + // https://www.felixcloutier.com/x86/pmulhrsw + PMULHRSW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x0b}}, + // https://www.felixcloutier.com/x86/pmovsx + PMOVSXBW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x20}}, + // https://www.felixcloutier.com/x86/pmovsx + PMOVSXWD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x23}}, + // https://www.felixcloutier.com/x86/pmovsx + PMOVSXDQ: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x25}}, + // https://www.felixcloutier.com/x86/pmovzx + PMOVZXBW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x30}}, + // https://www.felixcloutier.com/x86/pmovzx + PMOVZXWD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x33}}, + // https://www.felixcloutier.com/x86/pmovzx + PMOVZXDQ: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x35}}, + // https://www.felixcloutier.com/x86/pmulhw + PMULHW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xe5}}, + // https://www.felixcloutier.com/x86/cmpps + CMPEQPS: {opcode: []byte{0x0f, 0xc2}, needArg: true}, + // https://www.felixcloutier.com/x86/cmppd + CMPEQPD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xc2}, needArg: true}, + // https://www.felixcloutier.com/x86/cvttps2dq + CVTTPS2DQ: {mandatoryPrefix: 0xf3, opcode: []byte{0x0f, 0x5b}}, + // https://www.felixcloutier.com/x86/cvtdq2ps + CVTDQ2PS: {opcode: []byte{0x0f, 0x5b}}, + // https://www.felixcloutier.com/x86/cvtdq2pd + CVTDQ2PD: {mandatoryPrefix: 0xf3, opcode: []byte{0x0f, 0xe6}}, + // https://www.felixcloutier.com/x86/cvtpd2ps + CVTPD2PS: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x5a}}, + // https://www.felixcloutier.com/x86/cvtps2pd + CVTPS2PD: {opcode: []byte{0x0f, 0x5a}}, + // https://www.felixcloutier.com/x86/movupd + MOVUPD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x10}}, + // https://www.felixcloutier.com/x86/shufps + SHUFPS: {opcode: []byte{0x0f, 0xc6}, needArg: true}, + // https://www.felixcloutier.com/x86/pmaddwd + PMADDWD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xf5}}, + // https://www.felixcloutier.com/x86/unpcklps + UNPCKLPS: {opcode: []byte{0x0f, 0x14}}, + // https://www.felixcloutier.com/x86/packuswb + PACKUSWB: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x67}}, + // https://www.felixcloutier.com/x86/packsswb:packssdw + PACKSSDW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x6b}}, + // https://www.felixcloutier.com/x86/packusdw + PACKUSDW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x2b}}, + // https://www.felixcloutier.com/x86/pmaddubsw + PMADDUBSW: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x38, 0x04}}, + // https://www.felixcloutier.com/x86/cvttpd2dq + CVTTPD2DQ: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0xe6}}, +} + +var registerToRegisterShiftOpcode = [instructionEnd]*struct { + opcode []byte + rPrefix rexPrefix + modRMExtension byte +}{ + // https://www.felixcloutier.com/x86/rcl:rcr:rol:ror + ROLL: {opcode: []byte{0xd3}}, + ROLQ: {opcode: []byte{0xd3}, rPrefix: rexPrefixW}, + RORL: {opcode: []byte{0xd3}, modRMExtension: 0b00_001_000}, + RORQ: {opcode: []byte{0xd3}, modRMExtension: 0b00_001_000, rPrefix: rexPrefixW}, + // https://www.felixcloutier.com/x86/sal:sar:shl:shr + SARL: {opcode: []byte{0xd3}, modRMExtension: 0b00_111_000}, + SARQ: {opcode: []byte{0xd3}, modRMExtension: 0b00_111_000, rPrefix: rexPrefixW}, + SHLL: {opcode: []byte{0xd3}, modRMExtension: 0b00_100_000}, + SHLQ: {opcode: []byte{0xd3}, modRMExtension: 0b00_100_000, rPrefix: rexPrefixW}, + SHRL: {opcode: []byte{0xd3}, modRMExtension: 0b00_101_000}, + SHRQ: {opcode: []byte{0xd3}, modRMExtension: 0b00_101_000, rPrefix: rexPrefixW}, +} + +func (a *AssemblerImpl) encodeRegisterToRegister(buf asm.Buffer, n *nodeImpl) (err error) { + // Alias for readability + inst := n.instruction + base := buf.Len() + code := buf.Append(8)[:0] + + switch inst { + case MOVL, MOVQ: + var ( + opcode []byte + mandatoryPrefix byte + srcOnModRMReg bool + rPrefix rexPrefix + ) + srcIsFloat, dstIsFloat := isVectorRegister(n.srcReg), isVectorRegister(n.dstReg) + f2f := srcIsFloat && dstIsFloat + if f2f { + // https://www.felixcloutier.com/x86/movq + opcode, mandatoryPrefix = []byte{0x0f, 0x7e}, 0xf3 + } else if srcIsFloat && !dstIsFloat { + // https://www.felixcloutier.com/x86/movd:movq + opcode, mandatoryPrefix, srcOnModRMReg = []byte{0x0f, 0x7e}, 0x66, true + } else if !srcIsFloat && dstIsFloat { + // https://www.felixcloutier.com/x86/movd:movq + opcode, mandatoryPrefix, srcOnModRMReg = []byte{0x0f, 0x6e}, 0x66, false + } else { + // https://www.felixcloutier.com/x86/mov + opcode, srcOnModRMReg = []byte{0x89}, true + } + + rexPrefix, modRM, err := n.getRegisterToRegisterModRM(srcOnModRMReg) + if err != nil { + return err + } + rexPrefix |= rPrefix + + if inst == MOVQ && !f2f { + rexPrefix |= rexPrefixW + } + if mandatoryPrefix != 0 { + code = append(code, mandatoryPrefix) + } + if rexPrefix != rexPrefixNone { + code = append(code, rexPrefix) + } + code = append(code, opcode...) + code = append(code, modRM) + buf.Truncate(base + len(code)) + return nil + } + + if op := registerToRegisterOpcode[inst]; op != nil { + rexPrefix, modRM, err := n.getRegisterToRegisterModRM(op.srcOnModRMReg) + if err != nil { + return err + } + rexPrefix |= op.rPrefix + + if op.isSrc8bit && RegSP <= n.srcReg && n.srcReg <= RegDI { + // If an operand register is 8-bit length of SP, BP, DI, or SI register, we need to have the default prefix. + // https://wiki.osdev.org/X86-64_Instruction_Encoding#Registers + rexPrefix |= rexPrefixDefault + } + + if op.mandatoryPrefix != 0 { + code = append(code, op.mandatoryPrefix) + } + + if rexPrefix != rexPrefixNone { + code = append(code, rexPrefix) + } + code = append(code, op.opcode...) + code = append(code, modRM) + + if op.needArg { + code = append(code, n.arg) + } + } else if op := registerToRegisterShiftOpcode[inst]; op != nil { + reg3bits, rexPrefix := register3bits(n.dstReg, registerSpecifierPositionModRMFieldRM) + rexPrefix |= op.rPrefix + if rexPrefix != rexPrefixNone { + code = append(code, rexPrefix) + } + + // https://wiki.osdev.org/X86-64_Instruction_Encoding#ModR.2FM + modRM := 0b11_000_000 | + (op.modRMExtension) | + reg3bits + code = append(code, op.opcode...) + code = append(code, modRM) + } else { + return errorEncodingUnsupported(n) + } + + buf.Truncate(base + len(code)) + return nil +} + +func (a *AssemblerImpl) encodeRegisterToMemory(buf asm.Buffer, n *nodeImpl) (err error) { + rexPrefix, modRM, sbi, sbiExist, displacementWidth, err := n.getMemoryLocation(true) + if err != nil { + return err + } + + var opcode []byte + var mandatoryPrefix byte + var isShiftInstruction bool + var needArg bool + switch n.instruction { + case CMPL: + // https://www.felixcloutier.com/x86/cmp + opcode = []byte{0x3b} + case CMPQ: + // https://www.felixcloutier.com/x86/cmp + rexPrefix |= rexPrefixW + opcode = []byte{0x3b} + case MOVB: + // https://www.felixcloutier.com/x86/mov + opcode = []byte{0x88} + // 1 byte register operands need default prefix for the following registers. + if n.srcReg >= RegSP && n.srcReg <= RegDI { + rexPrefix |= rexPrefixDefault + } + case MOVL: + if isVectorRegister(n.srcReg) { + // https://www.felixcloutier.com/x86/movd:movq + opcode = []byte{0x0f, 0x7e} + mandatoryPrefix = 0x66 + } else { + // https://www.felixcloutier.com/x86/mov + opcode = []byte{0x89} + } + case MOVQ: + if isVectorRegister(n.srcReg) { + // https://www.felixcloutier.com/x86/movq + opcode = []byte{0x0f, 0xd6} + mandatoryPrefix = 0x66 + } else { + // https://www.felixcloutier.com/x86/mov + rexPrefix |= rexPrefixW + opcode = []byte{0x89} + } + case MOVW: + // https://www.felixcloutier.com/x86/mov + // Note: Need 0x66 to indicate that the operand size is 16-bit. + // https://wiki.osdev.org/X86-64_Instruction_Encoding#Operand-size_and_address-size_override_prefix + mandatoryPrefix = 0x66 + opcode = []byte{0x89} + case SARL: + // https://www.felixcloutier.com/x86/sal:sar:shl:shr + modRM |= 0b00_111_000 + opcode = []byte{0xd3} + isShiftInstruction = true + case SARQ: + // https://www.felixcloutier.com/x86/sal:sar:shl:shr + rexPrefix |= rexPrefixW + modRM |= 0b00_111_000 + opcode = []byte{0xd3} + isShiftInstruction = true + case SHLL: + // https://www.felixcloutier.com/x86/sal:sar:shl:shr + modRM |= 0b00_100_000 + opcode = []byte{0xd3} + isShiftInstruction = true + case SHLQ: + // https://www.felixcloutier.com/x86/sal:sar:shl:shr + rexPrefix |= rexPrefixW + modRM |= 0b00_100_000 + opcode = []byte{0xd3} + isShiftInstruction = true + case SHRL: + // https://www.felixcloutier.com/x86/sal:sar:shl:shr + modRM |= 0b00_101_000 + opcode = []byte{0xd3} + isShiftInstruction = true + case SHRQ: + // https://www.felixcloutier.com/x86/sal:sar:shl:shr + rexPrefix |= rexPrefixW + modRM |= 0b00_101_000 + opcode = []byte{0xd3} + isShiftInstruction = true + case ROLL: + // https://www.felixcloutier.com/x86/rcl:rcr:rol:ror + opcode = []byte{0xd3} + isShiftInstruction = true + case ROLQ: + // https://www.felixcloutier.com/x86/rcl:rcr:rol:ror + rexPrefix |= rexPrefixW + opcode = []byte{0xd3} + isShiftInstruction = true + case RORL: + // https://www.felixcloutier.com/x86/rcl:rcr:rol:ror + modRM |= 0b00_001_000 + opcode = []byte{0xd3} + isShiftInstruction = true + case RORQ: + // https://www.felixcloutier.com/x86/rcl:rcr:rol:ror + rexPrefix |= rexPrefixW + opcode = []byte{0xd3} + modRM |= 0b00_001_000 + isShiftInstruction = true + case MOVDQU: + // https://www.felixcloutier.com/x86/movdqu:vmovdqu8:vmovdqu16:vmovdqu32:vmovdqu64 + mandatoryPrefix = 0xf3 + opcode = []byte{0x0f, 0x7f} + case PEXTRB: // https://www.felixcloutier.com/x86/pextrb:pextrd:pextrq + mandatoryPrefix = 0x66 + opcode = []byte{0x0f, 0x3a, 0x14} + needArg = true + case PEXTRW: // https://www.felixcloutier.com/x86/pextrw + mandatoryPrefix = 0x66 + opcode = []byte{0x0f, 0x3a, 0x15} + needArg = true + case PEXTRD: // https://www.felixcloutier.com/x86/pextrb:pextrd:pextrq + mandatoryPrefix = 0x66 + opcode = []byte{0x0f, 0x3a, 0x16} + needArg = true + case PEXTRQ: // https://www.felixcloutier.com/x86/pextrb:pextrd:pextrq + mandatoryPrefix = 0x66 + rexPrefix |= rexPrefixW // REX.W + opcode = []byte{0x0f, 0x3a, 0x16} + needArg = true + default: + return errorEncodingUnsupported(n) + } + + if !isShiftInstruction { + srcReg3Bits, prefix := register3bits(n.srcReg, registerSpecifierPositionModRMFieldReg) + + rexPrefix |= prefix + modRM |= srcReg3Bits << 3 // Place the source register on ModRM:reg + } else { + if n.srcReg != RegCX { + return fmt.Errorf("shifting instruction %s require CX register as src but got %s", InstructionName(n.instruction), RegisterName(n.srcReg)) + } + } + + base := buf.Len() + code := buf.Append(16)[:0] + + if mandatoryPrefix != 0 { + // https://wiki.osdev.org/X86-64_Instruction_Encoding#Mandatory_prefix + code = append(code, mandatoryPrefix) + } + + if rexPrefix != rexPrefixNone { + code = append(code, rexPrefix) + } + + code = append(code, opcode...) + code = append(code, modRM) + + if sbiExist { + code = append(code, sbi) + } + + if displacementWidth != 0 { + code = appendConst(code, n.dstConst, displacementWidth) + } + + if needArg { + code = append(code, n.arg) + } + + buf.Truncate(base + len(code)) + return +} + +func (a *AssemblerImpl) encodeRegisterToConst(buf asm.Buffer, n *nodeImpl) (err error) { + regBits, prefix := register3bits(n.srcReg, registerSpecifierPositionModRMFieldRM) + + base := buf.Len() + code := buf.Append(10)[:0] + + switch n.instruction { + case CMPL, CMPQ: + if n.instruction == CMPQ { + prefix |= rexPrefixW + } + if prefix != rexPrefixNone { + code = append(code, prefix) + } + is8bitConst := fitInSigned8bit(n.dstConst) + // https://www.felixcloutier.com/x86/cmp + if n.srcReg == RegAX && !is8bitConst { + code = append(code, 0x3d) + } else { + // https://wiki.osdev.org/X86-64_Instruction_Encoding#ModR.2FM + modRM := 0b11_000_000 | // Specifying that opeand is register. + 0b00_111_000 | // CMP with immediate needs "/7" extension. + regBits + if is8bitConst { + code = append(code, 0x83, modRM) + } else { + code = append(code, 0x81, modRM) + } + } + default: + err = errorEncodingUnsupported(n) + } + + if fitInSigned8bit(n.dstConst) { + code = append(code, byte(n.dstConst)) + } else { + code = appendUint32(code, uint32(n.dstConst)) + } + + buf.Truncate(base + len(code)) + return +} + +func (a *AssemblerImpl) finalizeReadInstructionAddressNode(code []byte, n *nodeImpl) (err error) { + // Find the target instruction node. + targetNode := n + for ; targetNode != nil; targetNode = targetNode.next { + if targetNode.instruction == n.readInstructionAddressBeforeTargetInstruction { + targetNode = targetNode.next + break + } + } + + if targetNode == nil { + return errors.New("BUG: target instruction not found for read instruction address") + } + + offset := targetNode.OffsetInBinary() - (n.OffsetInBinary() + 7 /* 7 = the length of the LEAQ instruction */) + if offset >= math.MaxInt32 { + return errors.New("BUG: too large offset for LEAQ instruction") + } + + binary.LittleEndian.PutUint32(code[n.OffsetInBinary()+3:], uint32(int32(offset))) + return nil +} + +func (a *AssemblerImpl) encodeReadInstructionAddress(buf asm.Buffer, n *nodeImpl) error { + dstReg3Bits, rexPrefix := register3bits(n.dstReg, registerSpecifierPositionModRMFieldReg) + + a.readInstructionAddressNodes = append(a.readInstructionAddressNodes, n) + + // https://www.felixcloutier.com/x86/lea + opcode := byte(0x8d) + rexPrefix |= rexPrefixW + + // https://wiki.osdev.org/X86-64_Instruction_Encoding#32.2F64-bit_addressing + modRM := 0b00_000_101 | // Indicate "LEAQ [RIP + 32bit displacement], dstReg" encoding. + (dstReg3Bits << 3) // Place the dstReg on ModRM:reg. + + code := buf.Append(7) + code[0] = rexPrefix + code[1] = opcode + code[2] = modRM + binary.LittleEndian.PutUint32(code[3:], 0) // Preserve + return nil +} + +func (a *AssemblerImpl) encodeMemoryToRegister(buf asm.Buffer, n *nodeImpl) (err error) { + if n.instruction == LEAQ && n.readInstructionAddressBeforeTargetInstruction != NONE { + return a.encodeReadInstructionAddress(buf, n) + } + + rexPrefix, modRM, sbi, sbiExist, displacementWidth, err := n.getMemoryLocation(false) + if err != nil { + return err + } + + dstReg3Bits, prefix := register3bits(n.dstReg, registerSpecifierPositionModRMFieldReg) + rexPrefix |= prefix + modRM |= dstReg3Bits << 3 // Place the destination register on ModRM:reg + + var mandatoryPrefix byte + var opcode []byte + var needArg bool + + switch n.instruction { + case ADDL: + // https://www.felixcloutier.com/x86/add + opcode = []byte{0x03} + case ADDQ: + // https://www.felixcloutier.com/x86/add + rexPrefix |= rexPrefixW + opcode = []byte{0x03} + case CMPL: + // https://www.felixcloutier.com/x86/cmp + opcode = []byte{0x39} + case CMPQ: + // https://www.felixcloutier.com/x86/cmp + rexPrefix |= rexPrefixW + opcode = []byte{0x39} + case LEAQ: + // https://www.felixcloutier.com/x86/lea + rexPrefix |= rexPrefixW + opcode = []byte{0x8d} + case MOVBLSX: + // https://www.felixcloutier.com/x86/movsx:movsxd + opcode = []byte{0x0f, 0xbe} + case MOVBLZX: + // https://www.felixcloutier.com/x86/movzx + opcode = []byte{0x0f, 0xb6} + case MOVBQSX: + // https://www.felixcloutier.com/x86/movsx:movsxd + rexPrefix |= rexPrefixW + opcode = []byte{0x0f, 0xbe} + case MOVBQZX: + // https://www.felixcloutier.com/x86/movzx + rexPrefix |= rexPrefixW + opcode = []byte{0x0f, 0xb6} + case MOVLQSX: + // https://www.felixcloutier.com/x86/movsx:movsxd + rexPrefix |= rexPrefixW + opcode = []byte{0x63} + case MOVLQZX: + // https://www.felixcloutier.com/x86/mov + // Note: MOVLQZX means zero extending 32bit reg to 64-bit reg and + // that is semantically equivalent to MOV 32bit to 32bit. + opcode = []byte{0x8B} + case MOVL: + // https://www.felixcloutier.com/x86/mov + // Note: MOVLQZX means zero extending 32bit reg to 64-bit reg and + // that is semantically equivalent to MOV 32bit to 32bit. + if isVectorRegister(n.dstReg) { + // https://www.felixcloutier.com/x86/movd:movq + opcode = []byte{0x0f, 0x6e} + mandatoryPrefix = 0x66 + } else { + // https://www.felixcloutier.com/x86/mov + opcode = []byte{0x8B} + } + case MOVQ: + if isVectorRegister(n.dstReg) { + // https://www.felixcloutier.com/x86/movq + opcode = []byte{0x0f, 0x7e} + mandatoryPrefix = 0xf3 + } else { + // https://www.felixcloutier.com/x86/mov + rexPrefix |= rexPrefixW + opcode = []byte{0x8B} + } + case MOVWLSX: + // https://www.felixcloutier.com/x86/movsx:movsxd + opcode = []byte{0x0f, 0xbf} + case MOVWLZX: + // https://www.felixcloutier.com/x86/movzx + opcode = []byte{0x0f, 0xb7} + case MOVWQSX: + // https://www.felixcloutier.com/x86/movsx:movsxd + rexPrefix |= rexPrefixW + opcode = []byte{0x0f, 0xbf} + case MOVWQZX: + // https://www.felixcloutier.com/x86/movzx + rexPrefix |= rexPrefixW + opcode = []byte{0x0f, 0xb7} + case SUBQ: + // https://www.felixcloutier.com/x86/sub + rexPrefix |= rexPrefixW + opcode = []byte{0x2b} + case SUBSD: + // https://www.felixcloutier.com/x86/subsd + opcode = []byte{0x0f, 0x5c} + mandatoryPrefix = 0xf2 + case SUBSS: + // https://www.felixcloutier.com/x86/subss + opcode = []byte{0x0f, 0x5c} + mandatoryPrefix = 0xf3 + case UCOMISD: + // https://www.felixcloutier.com/x86/ucomisd + opcode = []byte{0x0f, 0x2e} + mandatoryPrefix = 0x66 + case UCOMISS: + // https://www.felixcloutier.com/x86/ucomiss + opcode = []byte{0x0f, 0x2e} + case MOVDQU: + // https://www.felixcloutier.com/x86/movdqu:vmovdqu8:vmovdqu16:vmovdqu32:vmovdqu64 + mandatoryPrefix = 0xf3 + opcode = []byte{0x0f, 0x6f} + case PMOVSXBW: // https://www.felixcloutier.com/x86/pmovsx + mandatoryPrefix = 0x66 + opcode = []byte{0x0f, 0x38, 0x20} + case PMOVSXWD: // https://www.felixcloutier.com/x86/pmovsx + mandatoryPrefix = 0x66 + opcode = []byte{0x0f, 0x38, 0x23} + case PMOVSXDQ: // https://www.felixcloutier.com/x86/pmovsx + mandatoryPrefix = 0x66 + opcode = []byte{0x0f, 0x38, 0x25} + case PMOVZXBW: // https://www.felixcloutier.com/x86/pmovzx + mandatoryPrefix = 0x66 + opcode = []byte{0x0f, 0x38, 0x30} + case PMOVZXWD: // https://www.felixcloutier.com/x86/pmovzx + mandatoryPrefix = 0x66 + opcode = []byte{0x0f, 0x38, 0x33} + case PMOVZXDQ: // https://www.felixcloutier.com/x86/pmovzx + mandatoryPrefix = 0x66 + opcode = []byte{0x0f, 0x38, 0x35} + case PINSRB: // https://www.felixcloutier.com/x86/pinsrb:pinsrd:pinsrq + mandatoryPrefix = 0x66 + opcode = []byte{0x0f, 0x3a, 0x20} + needArg = true + case PINSRW: // https://www.felixcloutier.com/x86/pinsrw + mandatoryPrefix = 0x66 + opcode = []byte{0x0f, 0xc4} + needArg = true + case PINSRD: // https://www.felixcloutier.com/x86/pinsrb:pinsrd:pinsrq + mandatoryPrefix = 0x66 + opcode = []byte{0x0f, 0x3a, 0x22} + needArg = true + case PINSRQ: // https://www.felixcloutier.com/x86/pinsrb:pinsrd:pinsrq + rexPrefix |= rexPrefixW + mandatoryPrefix = 0x66 + opcode = []byte{0x0f, 0x3a, 0x22} + needArg = true + default: + return errorEncodingUnsupported(n) + } + + base := buf.Len() + code := buf.Append(16)[:0] + + if mandatoryPrefix != 0 { + // https://wiki.osdev.org/X86-64_Instruction_Encoding#Mandatory_prefix + code = append(code, mandatoryPrefix) + } + + if rexPrefix != rexPrefixNone { + code = append(code, rexPrefix) + } + + code = append(code, opcode...) + code = append(code, modRM) + + if sbiExist { + code = append(code, sbi) + } + + if displacementWidth != 0 { + code = appendConst(code, n.srcConst, displacementWidth) + } + + if needArg { + code = append(code, n.arg) + } + + buf.Truncate(base + len(code)) + return +} + +func (a *AssemblerImpl) encodeConstToRegister(buf asm.Buffer, n *nodeImpl) (err error) { + regBits, rexPrefix := register3bits(n.dstReg, registerSpecifierPositionModRMFieldRM) + + isFloatReg := isVectorRegister(n.dstReg) + switch n.instruction { + case PSLLD, PSLLQ, PSRLD, PSRLQ, PSRAW, PSRLW, PSLLW, PSRAD: + if !isFloatReg { + return fmt.Errorf("%s needs float register but got %s", InstructionName(n.instruction), RegisterName(n.dstReg)) + } + default: + if isFloatReg { + return fmt.Errorf("%s needs int register but got %s", InstructionName(n.instruction), RegisterName(n.dstReg)) + } + } + + if n.instruction != MOVQ && !fitIn32bit(n.srcConst) { + return fmt.Errorf("constant must fit in 32-bit integer for %s, but got %d", InstructionName(n.instruction), n.srcConst) + } else if (n.instruction == SHLQ || n.instruction == SHRQ) && (n.srcConst < 0 || n.srcConst > math.MaxUint8) { + return fmt.Errorf("constant must fit in positive 8-bit integer for %s, but got %d", InstructionName(n.instruction), n.srcConst) + } else if (n.instruction == PSLLD || + n.instruction == PSLLQ || + n.instruction == PSRLD || + n.instruction == PSRLQ) && (n.srcConst < math.MinInt8 || n.srcConst > math.MaxInt8) { + return fmt.Errorf("constant must fit in signed 8-bit integer for %s, but got %d", InstructionName(n.instruction), n.srcConst) + } + + base := buf.Len() + code := buf.Append(32)[:0] + + isSigned8bitConst := fitInSigned8bit(n.srcConst) + switch inst := n.instruction; inst { + case ADDQ: + // https://www.felixcloutier.com/x86/add + rexPrefix |= rexPrefixW + if n.dstReg == RegAX && !isSigned8bitConst { + code = append(code, rexPrefix, 0x05) + } else { + modRM := 0b11_000_000 | // Specifying that opeand is register. + regBits + if isSigned8bitConst { + code = append(code, rexPrefix, 0x83, modRM) + } else { + code = append(code, rexPrefix, 0x81, modRM) + } + } + if isSigned8bitConst { + code = append(code, byte(n.srcConst)) + } else { + code = appendUint32(code, uint32(n.srcConst)) + } + case ANDQ: + // https://www.felixcloutier.com/x86/and + rexPrefix |= rexPrefixW + if n.dstReg == RegAX && !isSigned8bitConst { + code = append(code, rexPrefix, 0x25) + } else { + modRM := 0b11_000_000 | // Specifying that opeand is register. + 0b00_100_000 | // AND with immediate needs "/4" extension. + regBits + if isSigned8bitConst { + code = append(code, rexPrefix, 0x83, modRM) + } else { + code = append(code, rexPrefix, 0x81, modRM) + } + } + if fitInSigned8bit(n.srcConst) { + code = append(code, byte(n.srcConst)) + } else { + code = appendUint32(code, uint32(n.srcConst)) + } + case TESTQ: + // https://www.felixcloutier.com/x86/test + rexPrefix |= rexPrefixW + if n.dstReg == RegAX && !isSigned8bitConst { + code = append(code, rexPrefix, 0xa9) + } else { + modRM := 0b11_000_000 | // Specifying that operand is register + regBits + code = append(code, rexPrefix, 0xf7, modRM) + } + code = appendUint32(code, uint32(n.srcConst)) + case MOVL: + // https://www.felixcloutier.com/x86/mov + if rexPrefix != rexPrefixNone { + code = append(code, rexPrefix) + } + code = append(code, 0xb8|regBits) + code = appendUint32(code, uint32(n.srcConst)) + case MOVQ: + // https://www.felixcloutier.com/x86/mov + if fitIn32bit(n.srcConst) { + if n.srcConst > math.MaxInt32 { + if rexPrefix != rexPrefixNone { + code = append(code, rexPrefix) + } + code = append(code, 0xb8|regBits) + } else { + rexPrefix |= rexPrefixW + modRM := 0b11_000_000 | // Specifying that opeand is register. + regBits + code = append(code, rexPrefix, 0xc7, modRM) + } + code = appendUint32(code, uint32(n.srcConst)) + } else { + rexPrefix |= rexPrefixW + code = append(code, rexPrefix, 0xb8|regBits) + code = appendUint64(code, uint64(n.srcConst)) + } + case SHLQ: + // https://www.felixcloutier.com/x86/sal:sar:shl:shr + rexPrefix |= rexPrefixW + modRM := 0b11_000_000 | // Specifying that opeand is register. + 0b00_100_000 | // SHL with immediate needs "/4" extension. + regBits + if n.srcConst == 1 { + code = append(code, rexPrefix, 0xd1, modRM) + } else { + code = append(code, rexPrefix, 0xc1, modRM, byte(n.srcConst)) + } + case SHRQ: + // https://www.felixcloutier.com/x86/sal:sar:shl:shr + rexPrefix |= rexPrefixW + modRM := 0b11_000_000 | // Specifying that opeand is register. + 0b00_101_000 | // SHR with immediate needs "/5" extension. + regBits + if n.srcConst == 1 { + code = append(code, rexPrefix, 0xd1, modRM) + } else { + code = append(code, rexPrefix, 0xc1, modRM, byte(n.srcConst)) + } + case PSLLD: + // https://www.felixcloutier.com/x86/psllw:pslld:psllq + modRM := 0b11_000_000 | // Specifying that opeand is register. + 0b00_110_000 | // PSLL with immediate needs "/6" extension. + regBits + if rexPrefix != rexPrefixNone { + code = append(code, 0x66, rexPrefix, 0x0f, 0x72, modRM, byte(n.srcConst)) + } else { + code = append(code, 0x66, 0x0f, 0x72, modRM, byte(n.srcConst)) + } + case PSLLQ: + // https://www.felixcloutier.com/x86/psllw:pslld:psllq + modRM := 0b11_000_000 | // Specifying that opeand is register. + 0b00_110_000 | // PSLL with immediate needs "/6" extension. + regBits + if rexPrefix != rexPrefixNone { + code = append(code, 0x66, rexPrefix, 0x0f, 0x73, modRM, byte(n.srcConst)) + } else { + code = append(code, 0x66, 0x0f, 0x73, modRM, byte(n.srcConst)) + } + case PSRLD: + // https://www.felixcloutier.com/x86/psrlw:psrld:psrlq + // https://www.felixcloutier.com/x86/psllw:pslld:psllq + modRM := 0b11_000_000 | // Specifying that operand is register. + 0b00_010_000 | // PSRL with immediate needs "/2" extension. + regBits + if rexPrefix != rexPrefixNone { + code = append(code, 0x66, rexPrefix, 0x0f, 0x72, modRM, byte(n.srcConst)) + } else { + code = append(code, 0x66, 0x0f, 0x72, modRM, byte(n.srcConst)) + } + case PSRLQ: + // https://www.felixcloutier.com/x86/psrlw:psrld:psrlq + modRM := 0b11_000_000 | // Specifying that operand is register. + 0b00_010_000 | // PSRL with immediate needs "/2" extension. + regBits + if rexPrefix != rexPrefixNone { + code = append(code, 0x66, rexPrefix, 0x0f, 0x73, modRM, byte(n.srcConst)) + } else { + code = append(code, 0x66, 0x0f, 0x73, modRM, byte(n.srcConst)) + } + case PSRAW, PSRAD: + // https://www.felixcloutier.com/x86/psraw:psrad:psraq + modRM := 0b11_000_000 | // Specifying that operand is register. + 0b00_100_000 | // PSRAW with immediate needs "/4" extension. + regBits + code = append(code, 0x66) + if rexPrefix != rexPrefixNone { + code = append(code, rexPrefix) + } + + var op byte + if inst == PSRAD { + op = 0x72 + } else { // PSRAW + op = 0x71 + } + + code = append(code, 0x0f, op, modRM, byte(n.srcConst)) + case PSRLW: + // https://www.felixcloutier.com/x86/psrlw:psrld:psrlq + modRM := 0b11_000_000 | // Specifying that operand is register. + 0b00_010_000 | // PSRLW with immediate needs "/2" extension. + regBits + code = append(code, 0x66) + if rexPrefix != rexPrefixNone { + code = append(code, rexPrefix) + } + code = append(code, 0x0f, 0x71, modRM, byte(n.srcConst)) + case PSLLW: + // https://www.felixcloutier.com/x86/psllw:pslld:psllq + modRM := 0b11_000_000 | // Specifying that operand is register. + 0b00_110_000 | // PSLLW with immediate needs "/6" extension. + regBits + code = append(code, 0x66) + if rexPrefix != rexPrefixNone { + code = append(code, rexPrefix) + } + code = append(code, 0x0f, 0x71, modRM, byte(n.srcConst)) + case XORL, XORQ: + // https://www.felixcloutier.com/x86/xor + if inst == XORQ { + rexPrefix |= rexPrefixW + } + if rexPrefix != rexPrefixNone { + code = append(code, rexPrefix) + } + if n.dstReg == RegAX && !isSigned8bitConst { + code = append(code, 0x35) + } else { + modRM := 0b11_000_000 | // Specifying that opeand is register. + 0b00_110_000 | // XOR with immediate needs "/6" extension. + regBits + if isSigned8bitConst { + code = append(code, 0x83, modRM) + } else { + code = append(code, 0x81, modRM) + } + } + if fitInSigned8bit(n.srcConst) { + code = append(code, byte(n.srcConst)) + } else { + code = appendUint32(code, uint32(n.srcConst)) + } + default: + err = errorEncodingUnsupported(n) + } + + buf.Truncate(base + len(code)) + return +} + +func (a *AssemblerImpl) encodeMemoryToConst(buf asm.Buffer, n *nodeImpl) (err error) { + if !fitIn32bit(n.dstConst) { + return fmt.Errorf("too large target const %d for %s", n.dstConst, InstructionName(n.instruction)) + } + + rexPrefix, modRM, sbi, sbiExist, displacementWidth, err := n.getMemoryLocation(false) + if err != nil { + return err + } + + // Alias for readability. + c := n.dstConst + + var opcode, constWidth byte + switch n.instruction { + case CMPL: + // https://www.felixcloutier.com/x86/cmp + if fitInSigned8bit(c) { + opcode = 0x83 + constWidth = 8 + } else { + opcode = 0x81 + constWidth = 32 + } + modRM |= 0b00_111_000 + default: + return errorEncodingUnsupported(n) + } + + base := buf.Len() + code := buf.Append(20)[:0] + + if rexPrefix != rexPrefixNone { + code = append(code, rexPrefix) + } + + code = append(code, opcode, modRM) + + if sbiExist { + code = append(code, sbi) + } + + if displacementWidth != 0 { + code = appendConst(code, n.srcConst, displacementWidth) + } + + code = appendConst(code, c, constWidth) + buf.Truncate(base + len(code)) + return +} + +func (a *AssemblerImpl) encodeConstToMemory(buf asm.Buffer, n *nodeImpl) (err error) { + rexPrefix, modRM, sbi, sbiExist, displacementWidth, err := n.getMemoryLocation(true) + if err != nil { + return err + } + + // Alias for readability. + inst := n.instruction + c := n.srcConst + + if inst == MOVB && !fitInSigned8bit(c) { + return fmt.Errorf("too large load target const %d for MOVB", c) + } else if !fitIn32bit(c) { + return fmt.Errorf("too large load target const %d for %s", c, InstructionName(n.instruction)) + } + + var constWidth, opcode byte + switch inst { + case MOVB: + opcode = 0xc6 + constWidth = 8 + case MOVL: + opcode = 0xc7 + constWidth = 32 + case MOVQ: + rexPrefix |= rexPrefixW + opcode = 0xc7 + constWidth = 32 + default: + return errorEncodingUnsupported(n) + } + + base := buf.Len() + code := buf.Append(20)[:0] + + if rexPrefix != rexPrefixNone { + code = append(code, rexPrefix) + } + + code = append(code, opcode, modRM) + + if sbiExist { + code = append(code, sbi) + } + + if displacementWidth != 0 { + code = appendConst(code, n.dstConst, displacementWidth) + } + + code = appendConst(code, c, constWidth) + + buf.Truncate(base + len(code)) + return +} + +func appendUint32(code []byte, v uint32) []byte { + b := [4]byte{} + binary.LittleEndian.PutUint32(b[:], uint32(v)) + return append(code, b[:]...) +} + +func appendUint64(code []byte, v uint64) []byte { + b := [8]byte{} + binary.LittleEndian.PutUint64(b[:], uint64(v)) + return append(code, b[:]...) +} + +func appendConst(code []byte, v int64, length byte) []byte { + switch length { + case 8: + return append(code, byte(v)) + case 32: + return appendUint32(code, uint32(v)) + default: + return appendUint64(code, uint64(v)) + } +} + +func (n *nodeImpl) getMemoryLocation(dstMem bool) (p rexPrefix, modRM byte, sbi byte, sbiExist bool, displacementWidth byte, err error) { + var baseReg, indexReg asm.Register + var offset asm.ConstantValue + var scale byte + if dstMem { + baseReg, offset, indexReg, scale = n.dstReg, n.dstConst, n.dstMemIndex, n.dstMemScale + } else { + baseReg, offset, indexReg, scale = n.srcReg, n.srcConst, n.srcMemIndex, n.srcMemScale + } + + if !fitIn32bit(offset) { + err = errors.New("offset does not fit in 32-bit integer") + return + } + + if baseReg == asm.NilRegister && indexReg != asm.NilRegister { + // [(index*scale) + displacement] addressing is possible, but we haven't used it for now. + err = errors.New("addressing without base register but with index is not implemented") + } else if baseReg == asm.NilRegister { + modRM = 0b00_000_100 // Indicate that the memory location is specified by SIB. + sbi, sbiExist = byte(0b00_100_101), true + displacementWidth = 32 + } else if indexReg == asm.NilRegister { + modRM, p = register3bits(baseReg, registerSpecifierPositionModRMFieldRM) + + // Create ModR/M byte so that this instruction takes [R/M + displacement] operand if displacement !=0 + // and otherwise [R/M]. + withoutDisplacement := offset == 0 && + // If the target register is R13 or BP, we have to keep [R/M + displacement] even if the value + // is zero since it's not [R/M] operand is not defined for these two registers. + // https://wiki.osdev.org/X86-64_Instruction_Encoding#32.2F64-bit_addressing + baseReg != RegR13 && baseReg != RegBP + if withoutDisplacement { + // https://wiki.osdev.org/X86-64_Instruction_Encoding#ModR.2FM + modRM |= 0b00_000_000 // Specifying that operand is memory without displacement + displacementWidth = 0 + } else if fitInSigned8bit(offset) { + // https://wiki.osdev.org/X86-64_Instruction_Encoding#ModR.2FM + modRM |= 0b01_000_000 // Specifying that operand is memory + 8bit displacement. + displacementWidth = 8 + } else { + // https://wiki.osdev.org/X86-64_Instruction_Encoding#ModR.2FM + modRM |= 0b10_000_000 // Specifying that operand is memory + 32bit displacement. + displacementWidth = 32 + } + + // For SP and R12 register, we have [SIB + displacement] if the const is non-zero, otherwise [SIP]. + // https://wiki.osdev.org/X86-64_Instruction_Encoding#32.2F64-bit_addressing + // + // Thefore we emit the SIB byte before the const so that [SIB + displacement] ends up [register + displacement]. + // https://wiki.osdev.org/X86-64_Instruction_Encoding#32.2F64-bit_addressing_2 + if baseReg == RegSP || baseReg == RegR12 { + sbi, sbiExist = byte(0b00_100_100), true + } + } else { + if indexReg == RegSP { + err = errors.New("SP cannot be used for SIB index") + return + } + + modRM = 0b00_000_100 // Indicate that the memory location is specified by SIB. + + withoutDisplacement := offset == 0 && + // For R13 and BP, base registers cannot be encoded "without displacement" mod (i.e. 0b00 mod). + baseReg != RegR13 && baseReg != RegBP + if withoutDisplacement { + // https://wiki.osdev.org/X86-64_Instruction_Encoding#ModR.2FM + modRM |= 0b00_000_000 // Specifying that operand is SIB without displacement + displacementWidth = 0 + } else if fitInSigned8bit(offset) { + // https://wiki.osdev.org/X86-64_Instruction_Encoding#ModR.2FM + modRM |= 0b01_000_000 // Specifying that operand is SIB + 8bit displacement. + displacementWidth = 8 + } else { + // https://wiki.osdev.org/X86-64_Instruction_Encoding#ModR.2FM + modRM |= 0b10_000_000 // Specifying that operand is SIB + 32bit displacement. + displacementWidth = 32 + } + + var baseRegBits byte + baseRegBits, p = register3bits(baseReg, registerSpecifierPositionModRMFieldRM) + + var indexRegBits byte + var indexRegPrefix rexPrefix + indexRegBits, indexRegPrefix = register3bits(indexReg, registerSpecifierPositionSIBIndex) + p |= indexRegPrefix + + sbi, sbiExist = baseRegBits|(indexRegBits<<3), true + switch scale { + case 1: + sbi |= 0b00_000_000 + case 2: + sbi |= 0b01_000_000 + case 4: + sbi |= 0b10_000_000 + case 8: + sbi |= 0b11_000_000 + default: + err = fmt.Errorf("scale in SIB must be one of 1, 2, 4, 8 but got %d", scale) + return + } + + } + return +} + +// getRegisterToRegisterModRM does XXXX +// +// TODO: srcOnModRMReg can be deleted after golang-asm removal. This is necessary to match our implementation +// with golang-asm, but in practice, there are equivalent opcodes to always have src on ModRM:reg without ambiguity. +func (n *nodeImpl) getRegisterToRegisterModRM(srcOnModRMReg bool) (rexPrefix, modRM byte, err error) { + var reg3bits, rm3bits byte + if srcOnModRMReg { + reg3bits, rexPrefix = register3bits(n.srcReg, + // Indicate that srcReg will be specified by ModRM:reg. + registerSpecifierPositionModRMFieldReg) + + var dstRexPrefix byte + rm3bits, dstRexPrefix = register3bits(n.dstReg, + // Indicate that dstReg will be specified by ModRM:r/m. + registerSpecifierPositionModRMFieldRM) + rexPrefix |= dstRexPrefix + } else { + rm3bits, rexPrefix = register3bits(n.srcReg, + // Indicate that srcReg will be specified by ModRM:r/m. + registerSpecifierPositionModRMFieldRM) + + var dstRexPrefix byte + reg3bits, dstRexPrefix = register3bits(n.dstReg, + // Indicate that dstReg will be specified by ModRM:reg. + registerSpecifierPositionModRMFieldReg) + rexPrefix |= dstRexPrefix + } + + // https://wiki.osdev.org/X86-64_Instruction_Encoding#ModR.2FM + modRM = 0b11_000_000 | // Specifying that dst operand is register. + (reg3bits << 3) | + rm3bits + + return +} + +// RexPrefix represents REX prefix https://wiki.osdev.org/X86-64_Instruction_Encoding#REX_prefix +type rexPrefix = byte + +// REX prefixes are independent of each other and can be combined with OR. +const ( + rexPrefixNone rexPrefix = 0x0000_0000 // Indicates that the instruction doesn't need RexPrefix. + rexPrefixDefault rexPrefix = 0b0100_0000 + rexPrefixW = 0b0000_1000 | rexPrefixDefault // REX.W + rexPrefixR = 0b0000_0100 | rexPrefixDefault // REX.R + rexPrefixX = 0b0000_0010 | rexPrefixDefault // REX.X + rexPrefixB = 0b0000_0001 | rexPrefixDefault // REX.B +) + +// registerSpecifierPosition represents the position in the instruction bytes where an operand register is placed. +type registerSpecifierPosition byte + +const ( + registerSpecifierPositionModRMFieldReg registerSpecifierPosition = iota + registerSpecifierPositionModRMFieldRM + registerSpecifierPositionSIBIndex +) + +var regInfo = [...]struct { + bits byte + needRex bool +}{ + RegAX: {bits: 0b000}, + RegCX: {bits: 0b001}, + RegDX: {bits: 0b010}, + RegBX: {bits: 0b011}, + RegSP: {bits: 0b100}, + RegBP: {bits: 0b101}, + RegSI: {bits: 0b110}, + RegDI: {bits: 0b111}, + RegR8: {bits: 0b000, needRex: true}, + RegR9: {bits: 0b001, needRex: true}, + RegR10: {bits: 0b010, needRex: true}, + RegR11: {bits: 0b011, needRex: true}, + RegR12: {bits: 0b100, needRex: true}, + RegR13: {bits: 0b101, needRex: true}, + RegR14: {bits: 0b110, needRex: true}, + RegR15: {bits: 0b111, needRex: true}, + RegX0: {bits: 0b000}, + RegX1: {bits: 0b001}, + RegX2: {bits: 0b010}, + RegX3: {bits: 0b011}, + RegX4: {bits: 0b100}, + RegX5: {bits: 0b101}, + RegX6: {bits: 0b110}, + RegX7: {bits: 0b111}, + RegX8: {bits: 0b000, needRex: true}, + RegX9: {bits: 0b001, needRex: true}, + RegX10: {bits: 0b010, needRex: true}, + RegX11: {bits: 0b011, needRex: true}, + RegX12: {bits: 0b100, needRex: true}, + RegX13: {bits: 0b101, needRex: true}, + RegX14: {bits: 0b110, needRex: true}, + RegX15: {bits: 0b111, needRex: true}, +} + +func register3bits( + reg asm.Register, + registerSpecifierPosition registerSpecifierPosition, +) (bits byte, prefix rexPrefix) { + info := regInfo[reg] + bits = info.bits + if info.needRex { + // https://wiki.osdev.org/X86-64_Instruction_Encoding#REX_prefix + switch registerSpecifierPosition { + case registerSpecifierPositionModRMFieldReg: + prefix = rexPrefixR + case registerSpecifierPositionModRMFieldRM: + prefix = rexPrefixB + case registerSpecifierPositionSIBIndex: + prefix = rexPrefixX + } + } + return +} + +func fitIn32bit(v int64) bool { + return math.MinInt32 <= v && v <= math.MaxUint32 +} + +func fitInSigned8bit(v int64) bool { + return math.MinInt8 <= v && v <= math.MaxInt8 +} + +func isVectorRegister(r asm.Register) bool { + return RegX0 <= r && r <= RegX15 +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/asm/amd64/impl_staticconst.go b/vendor/github.com/tetratelabs/wazero/internal/asm/amd64/impl_staticconst.go new file mode 100644 index 000000000..17a7f228c --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/asm/amd64/impl_staticconst.go @@ -0,0 +1,181 @@ +package amd64 + +import ( + "fmt" + "math" + + "github.com/tetratelabs/wazero/internal/asm" +) + +// defaultMaxDisplacementForConstantPool is the maximum displacement allowed for literal move instructions which access +// the constant pool. This is set as 2 ^30 conservatively while the actual limit is 2^31 since we actually allow this +// limit plus max(length(c) for c in the pool) so we must ensure that limit is less than 2^31. +const defaultMaxDisplacementForConstantPool = 1 << 30 + +func (a *AssemblerImpl) maybeFlushConstants(buf asm.Buffer, isEndOfFunction bool) { + if a.pool.Empty() { + return + } + + if isEndOfFunction || + // If the distance between (the first use in binary) and (end of constant pool) can be larger + // than MaxDisplacementForConstantPool, we have to emit the constant pool now, otherwise + // a const might be unreachable by a literal move whose maximum offset is +- 2^31. + ((a.pool.PoolSizeInBytes+buf.Len())-int(a.pool.FirstUseOffsetInBinary)) >= a.MaxDisplacementForConstantPool { + + if !isEndOfFunction { + // Adds the jump instruction to skip the constants if this is not the end of function. + // + // TODO: consider NOP padding for this jump, though this rarely happens as most functions should be + // small enough to fit all consts after the end of function. + if a.pool.PoolSizeInBytes >= math.MaxInt8-2 { + // long (near-relative) jump: https://www.felixcloutier.com/x86/jmp + buf.AppendByte(0xe9) + buf.AppendUint32(uint32(a.pool.PoolSizeInBytes)) + } else { + // short jump: https://www.felixcloutier.com/x86/jmp + buf.AppendByte(0xeb) + buf.AppendByte(byte(a.pool.PoolSizeInBytes)) + } + } + + for _, c := range a.pool.Consts { + c.SetOffsetInBinary(uint64(buf.Len())) + buf.AppendBytes(c.Raw) + } + + a.pool.Reset() + } +} + +func (a *AssemblerImpl) encodeRegisterToStaticConst(buf asm.Buffer, n *nodeImpl) (err error) { + var opc []byte + var rex byte + switch n.instruction { + case CMPL: + opc, rex = []byte{0x3b}, rexPrefixNone + case CMPQ: + opc, rex = []byte{0x3b}, rexPrefixW + default: + return errorEncodingUnsupported(n) + } + return a.encodeStaticConstImpl(buf, n, opc, rex, 0) +} + +var staticConstToRegisterOpcodes = [...]struct { + opcode, vopcode []byte + mandatoryPrefix, vmandatoryPrefix byte + rex rexPrefix +}{ + // https://www.felixcloutier.com/x86/movdqu:vmovdqu8:vmovdqu16:vmovdqu32:vmovdqu64 + MOVDQU: {mandatoryPrefix: 0xf3, opcode: []byte{0x0f, 0x6f}}, + // https://www.felixcloutier.com/x86/lea + LEAQ: {opcode: []byte{0x8d}, rex: rexPrefixW}, + // https://www.felixcloutier.com/x86/movupd + MOVUPD: {mandatoryPrefix: 0x66, opcode: []byte{0x0f, 0x10}}, + // https://www.felixcloutier.com/x86/mov + MOVL: {opcode: []byte{0x8b}, vopcode: []byte{0x0f, 0x6e}, vmandatoryPrefix: 0x66}, + MOVQ: {opcode: []byte{0x8b}, rex: rexPrefixW, vopcode: []byte{0x0f, 0x7e}, vmandatoryPrefix: 0xf3}, + // https://www.felixcloutier.com/x86/ucomisd + UCOMISD: {opcode: []byte{0x0f, 0x2e}, mandatoryPrefix: 0x66}, + // https://www.felixcloutier.com/x86/ucomiss + UCOMISS: {opcode: []byte{0x0f, 0x2e}}, + // https://www.felixcloutier.com/x86/subss + SUBSS: {opcode: []byte{0x0f, 0x5c}, mandatoryPrefix: 0xf3}, + // https://www.felixcloutier.com/x86/subsd + SUBSD: {opcode: []byte{0x0f, 0x5c}, mandatoryPrefix: 0xf2}, + // https://www.felixcloutier.com/x86/cmp + CMPL: {opcode: []byte{0x39}}, + CMPQ: {opcode: []byte{0x39}, rex: rexPrefixW}, + // https://www.felixcloutier.com/x86/add + ADDL: {opcode: []byte{0x03}}, + ADDQ: {opcode: []byte{0x03}, rex: rexPrefixW}, +} + +func (a *AssemblerImpl) encodeStaticConstToRegister(buf asm.Buffer, n *nodeImpl) (err error) { + var opc []byte + var rex, mandatoryPrefix byte + info := staticConstToRegisterOpcodes[n.instruction] + switch n.instruction { + case MOVL, MOVQ: + if isVectorRegister(n.dstReg) { + opc, mandatoryPrefix = info.vopcode, info.vmandatoryPrefix + break + } + fallthrough + default: + opc, rex, mandatoryPrefix = info.opcode, info.rex, info.mandatoryPrefix + } + return a.encodeStaticConstImpl(buf, n, opc, rex, mandatoryPrefix) +} + +// encodeStaticConstImpl encodes an instruction where mod:r/m points to the memory location of the static constant n.staticConst, +// and the other operand is the register given at n.srcReg or n.dstReg. +func (a *AssemblerImpl) encodeStaticConstImpl(buf asm.Buffer, n *nodeImpl, opcode []byte, rex rexPrefix, mandatoryPrefix byte) error { + a.pool.AddConst(n.staticConst, uint64(buf.Len())) + + var reg asm.Register + if n.dstReg != asm.NilRegister { + reg = n.dstReg + } else { + reg = n.srcReg + } + + reg3Bits, rexPrefix := register3bits(reg, registerSpecifierPositionModRMFieldReg) + rexPrefix |= rex + + base := buf.Len() + code := buf.Append(len(opcode) + 7)[:0] + + if mandatoryPrefix != 0 { + code = append(code, mandatoryPrefix) + } + + if rexPrefix != rexPrefixNone { + code = append(code, rexPrefix) + } + + code = append(code, opcode...) + + // https://wiki.osdev.org/X86-64_Instruction_Encoding#32.2F64-bit_addressing + modRM := 0b00_000_101 | // Indicate "[RIP + 32bit displacement]" encoding. + (reg3Bits << 3) // Place the reg on ModRM:reg. + code = append(code, modRM) + + // Preserve 4 bytes for displacement which will be filled after we finalize the location. + code = append(code, 0, 0, 0, 0) + + if !n.staticConstReferrersAdded { + a.staticConstReferrers = append(a.staticConstReferrers, staticConstReferrer{n: n, instLen: len(code)}) + n.staticConstReferrersAdded = true + } + + buf.Truncate(base + len(code)) + return nil +} + +// CompileStaticConstToRegister implements Assembler.CompileStaticConstToRegister. +func (a *AssemblerImpl) CompileStaticConstToRegister(instruction asm.Instruction, c *asm.StaticConst, dstReg asm.Register) (err error) { + if len(c.Raw)%2 != 0 { + err = fmt.Errorf("the length of a static constant must be even but was %d", len(c.Raw)) + return + } + + n := a.newNode(instruction, operandTypesStaticConstToRegister) + n.dstReg = dstReg + n.staticConst = c + return +} + +// CompileRegisterToStaticConst implements Assembler.CompileRegisterToStaticConst. +func (a *AssemblerImpl) CompileRegisterToStaticConst(instruction asm.Instruction, srcReg asm.Register, c *asm.StaticConst) (err error) { + if len(c.Raw)%2 != 0 { + err = fmt.Errorf("the length of a static constant must be even but was %d", len(c.Raw)) + return + } + + n := a.newNode(instruction, operandTypesRegisterToStaticConst) + n.srcReg = srcReg + n.staticConst = c + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/asm/arm64/assembler.go b/vendor/github.com/tetratelabs/wazero/internal/asm/arm64/assembler.go new file mode 100644 index 000000000..628350d4d --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/asm/arm64/assembler.go @@ -0,0 +1,115 @@ +package arm64 + +import ( + "github.com/tetratelabs/wazero/internal/asm" +) + +// Assembler is the interface for arm64 specific assembler. +type Assembler interface { + asm.AssemblerBase + + // CompileMemoryWithRegisterOffsetToRegister adds an instruction where source operand is the memory address + // specified as `srcBaseReg + srcOffsetReg` and dst is the register `dstReg`. + CompileMemoryWithRegisterOffsetToRegister(instruction asm.Instruction, srcBaseReg, srcOffsetReg, dstReg asm.Register) + + // CompileRegisterToMemoryWithRegisterOffset adds an instruction where source operand is the register `srcReg`, + // and the destination is the memory address specified as `dstBaseReg + dstOffsetReg` + CompileRegisterToMemoryWithRegisterOffset(instruction asm.Instruction, srcReg, dstBaseReg, dstOffsetReg asm.Register) + + // CompileTwoRegistersToRegister adds an instruction where source operands consists of two registers `src1` and `src2`, + // and the destination is the register `dst`. + CompileTwoRegistersToRegister(instruction asm.Instruction, src1, src2, dst asm.Register) + + // CompileThreeRegistersToRegister adds an instruction where source operands consist of three registers + // `src1`, `src2` and `src3`, and destination operands consist of `dst` register. + CompileThreeRegistersToRegister(instruction asm.Instruction, src1, src2, src3, dst asm.Register) + + // CompileTwoRegistersToNone adds an instruction where source operands consist of two registers `src1` and `src2`, + // and destination operand is unspecified. + CompileTwoRegistersToNone(instruction asm.Instruction, src1, src2 asm.Register) + + // CompileRegisterAndConstToNone adds an instruction where source operands consist of one register `src` and + // constant `srcConst`, and destination operand is unspecified. + CompileRegisterAndConstToNone(instruction asm.Instruction, src asm.Register, srcConst asm.ConstantValue) + + // CompileRegisterAndConstToRegister adds an instruction where source operands consist of one register `src` and + // constant `srcConst`, and destination operand is a register `dst`. + CompileRegisterAndConstToRegister(instruction asm.Instruction, src asm.Register, srcConst asm.ConstantValue, dst asm.Register) + + // CompileLeftShiftedRegisterToRegister adds an instruction where source operand is the "left shifted register" + // represented as `srcReg << shiftNum` and the destination is the register `dstReg`. + CompileLeftShiftedRegisterToRegister( + instruction asm.Instruction, + shiftedSourceReg asm.Register, + shiftNum asm.ConstantValue, + srcReg, dstReg asm.Register, + ) + + // CompileConditionalRegisterSet adds an instruction to set 1 on dstReg if the condition satisfies, + // otherwise set 0. + CompileConditionalRegisterSet(cond asm.ConditionalRegisterState, dstReg asm.Register) + + // CompileMemoryToVectorRegister adds an instruction where source operands is the memory address specified by + // `srcBaseReg+srcOffset` and the destination is `dstReg` vector register. + CompileMemoryToVectorRegister(instruction asm.Instruction, srcBaseReg asm.Register, srcOffset asm.ConstantValue, + dstReg asm.Register, arrangement VectorArrangement) + + // CompileMemoryWithRegisterOffsetToVectorRegister is the same as CompileMemoryToVectorRegister except that the + // offset is specified by the `srcOffsetRegister` register. + CompileMemoryWithRegisterOffsetToVectorRegister(instruction asm.Instruction, srcBaseReg, + srcOffsetRegister asm.Register, dstReg asm.Register, arrangement VectorArrangement) + + // CompileVectorRegisterToMemory adds an instruction where source operand is `srcReg` vector register and the + // destination is the memory address specified by `dstBaseReg+dstOffset`. + CompileVectorRegisterToMemory(instruction asm.Instruction, srcReg, dstBaseReg asm.Register, + dstOffset asm.ConstantValue, arrangement VectorArrangement) + + // CompileVectorRegisterToMemoryWithRegisterOffset is the same as CompileVectorRegisterToMemory except that the + // offset is specified by the `dstOffsetRegister` register. + CompileVectorRegisterToMemoryWithRegisterOffset(instruction asm.Instruction, srcReg, dstBaseReg, + dstOffsetRegister asm.Register, arrangement VectorArrangement) + + // CompileRegisterToVectorRegister adds an instruction where source operand is `srcReg` general purpose register and + // the destination is the `dstReg` vector register. The destination vector's arrangement and index of element can be + // given by `arrangement` and `index`, but not all the instructions will use them. + CompileRegisterToVectorRegister(instruction asm.Instruction, srcReg, dstReg asm.Register, + arrangement VectorArrangement, index VectorIndex) + + // CompileVectorRegisterToRegister adds an instruction where destination operand is `dstReg` general purpose register + // and the source is the `srcReg` vector register. The source vector's arrangement and index of element can be + // given by `arrangement` and `index`, but not all the instructions will use them. + CompileVectorRegisterToRegister(instruction asm.Instruction, srcReg, dstReg asm.Register, + arrangement VectorArrangement, index VectorIndex) + + // CompileVectorRegisterToVectorRegister adds an instruction where both source and destination operands are vector + // registers. The vector's arrangement can be specified `arrangement`, and the source and destination element's + // index are given by `srcIndex` and `dstIndex` respectively, but not all the instructions will use them. + CompileVectorRegisterToVectorRegister(instruction asm.Instruction, srcReg, dstReg asm.Register, + arrangement VectorArrangement, srcIndex, dstIndex VectorIndex) + + // CompileVectorRegisterToVectorRegisterWithConst is the same as CompileVectorRegisterToVectorRegister but the + // additional constant can be provided. + // For example, the const can be used to specify the shift amount for USHLL instruction. + CompileVectorRegisterToVectorRegisterWithConst(instruction asm.Instruction, srcReg, dstReg asm.Register, + arrangement VectorArrangement, c asm.ConstantValue) + + // CompileStaticConstToRegister adds an instruction where the source operand is StaticConstant located in + // the memory and the destination is the dstReg. + CompileStaticConstToRegister(instruction asm.Instruction, c *asm.StaticConst, dstReg asm.Register) + + // CompileStaticConstToVectorRegister adds an instruction where the source operand is StaticConstant located in + // the memory and the destination is the dstReg. + CompileStaticConstToVectorRegister(instruction asm.Instruction, c *asm.StaticConst, dstReg asm.Register, + arrangement VectorArrangement) + + // CompileTwoVectorRegistersToVectorRegister adds an instruction where source are two vectors and destination is one + // vector. The vector's arrangement can be specified `arrangement`. + CompileTwoVectorRegistersToVectorRegister(instruction asm.Instruction, srcReg, srcReg2, dstReg asm.Register, + arrangement VectorArrangement) + + // CompileTwoVectorRegistersToVectorRegisterWithConst is the same as CompileTwoVectorRegistersToVectorRegister except + // that this also accept additional constant. + // For example EXIT instruction needs the extraction target immediate as const. + CompileTwoVectorRegistersToVectorRegisterWithConst(instruction asm.Instruction, srcReg, srcReg2, dstReg asm.Register, + arrangement VectorArrangement, c asm.ConstantValue) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/asm/arm64/consts.go b/vendor/github.com/tetratelabs/wazero/internal/asm/arm64/consts.go new file mode 100644 index 000000000..47ed3cc2d --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/asm/arm64/consts.go @@ -0,0 +1,1476 @@ +package arm64 + +import ( + "fmt" + + "github.com/tetratelabs/wazero/internal/asm" +) + +// Arm64-specific register states. +// +// Note: Naming conventions intentionally match the Go assembler: https://go.dev/doc/asm +// See https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/condition-codes-1-condition-flags-and-codes +const ( + // CondEQ is the eq (equal) condition code + CondEQ = asm.ConditionalRegisterStateUnset + 1 + iota + // CondNE is the ne (not equal) condition code + CondNE + // CondHS is the hs (unsigned higher or same) condition code + CondHS + // CondLO is the lo (unsigned lower) condition code + CondLO + // CondMI is the mi (negative) condition code + CondMI + // CondPL is the pl (positive or zero) condition code + CondPL + // CondVS is the vs (signed overflow) condition code + CondVS + // CondVC is the vc (no signed overflow) condition code + CondVC + // CondHI is the hi (unsigned higher) condition code + CondHI + // CondLS is the ls (unsigned lower or same) condition code + CondLS + // CondGE is the ge (signed greater than or equal) condition code + CondGE + // CondLT is the lt (signed less than) condition code + CondLT + // CondGT is the gt (signed greater than) condition code + CondGT + // CondLE is the le (signed less than or equal) condition code + CondLE + // CondAL is the al (always executed) condition code + CondAL + // CondNV has the same meaning as CondAL + CondNV +) + +// Arm64-specific registers. +// +// Note: Naming conventions intentionally match the Go assembler: https://go.dev/doc/asm +// See https://developer.arm.com/documentation/dui0801/a/Overview-of-AArch64-state/Predeclared-core-register-names-in-AArch64-state +const ( + // Integer registers. + + // RegR0 is the R0 register + RegR0 asm.Register = asm.NilRegister + 1 + iota + // RegR1 is the R1 register + RegR1 + // RegR2 is the R2 register + RegR2 + // RegR3 is the R3 register + RegR3 + // RegR4 is the R4 register + RegR4 + // RegR5 is the R5 register + RegR5 + // RegR6 is the R6 register + RegR6 + // RegR7 is the R7 register + RegR7 + // RegR8 is the R8 register + RegR8 + // RegR9 is the R9 register + RegR9 + // RegR10 is the R10 register + RegR10 + // RegR11 is the R11 register + RegR11 + // RegR12 is the R12 register + RegR12 + // RegR13 is the R13 register + RegR13 + // RegR14 is the R14 register + RegR14 + // RegR15 is the R15 register + RegR15 + // RegR16 is the R16 register + RegR16 + // RegR17 is the R17 register + RegR17 + // RegR18 is the R18 register + RegR18 + // RegR19 is the R19 register + RegR19 + // RegR20 is the R20 register + RegR20 + // RegR21 is the R21 register + RegR21 + // RegR22 is the R22 register + RegR22 + // RegR23 is the R23 register + RegR23 + // RegR24 is the R24 register + RegR24 + // RegR25 is the R25 register + RegR25 + // RegR26 is the R26 register + RegR26 + // RegR27 is the R27 register + RegR27 + // RegR28 is the R28 register + RegR28 + // RegR29 is the R29 register + RegR29 + // RegR30 is the R30 register + RegR30 + // RegRZR is the RZR register (read-only, always returning zero) + RegRZR + // RegSP is the SP register + RegSP + + // Scalar floating point registers. + + // RegV0 is the V0 register + RegV0 + // RegV1 is the V1 register + RegV1 + // RegV2 is the V2 register + RegV2 + // RegV3 is the V3 register + RegV3 + // RegV4 is the V4 register + RegV4 + // RegV5 is the V5 register + RegV5 + // RegV6 is the V6 register + RegV6 + // RegV7 is the V7 register + RegV7 + // RegV8 is the V8 register + RegV8 + // RegV9 is the V9 register + RegV9 + // RegV10 is the V10 register + RegV10 + // RegV11 is the V11 register + RegV11 + // RegV12 is the V12 register + RegV12 + // RegV13 is the V13 register + RegV13 + // RegV14 is the V14 register + RegV14 + // RegV15 is the V15 register + RegV15 + // RegV16 is the V16 register + RegV16 + // RegV17 is the V17 register + RegV17 + // RegV18 is the V18 register + RegV18 + // RegV19 is the V19 register + RegV19 + // RegV20 is the V20 register + RegV20 + // RegV21 is the V21 register + RegV21 + // RegV22 is the V22 register + RegV22 + // RegV23 is the V23 register + RegV23 + // RegV24 is the V24 register + RegV24 + // RegV25 is the V25 register + RegV25 + // RegV26 is the V26 register + RegV26 + // RegV27 is the V27 register + RegV27 + // RegV28 is the V28 register + RegV28 + // RegV29 is the V29 register + RegV29 + // RegV30 is the V30 register + RegV30 + // RegV31 is the V31 register + RegV31 + + // Floating point status register. + + // RegFPSR is the FPSR register + RegFPSR + + // Assign each conditional register state to the unique register ID. + // This is to reduce the size of nodeImpl struct without having dedicated field + // for conditional register state which would not be used by most nodes. + // This is taking advantage of the fact that conditional operations are always + // on a single register and condition code, and never two registers. + + // RegCondEQ encodes CondEQ into a field that would otherwise store a register + RegCondEQ + // RegCondNE encodes CondNE into a field that would otherwise store a register + RegCondNE + // RegCondHS encodes CondHS into a field that would otherwise store a register + RegCondHS + // RegCondLO encodes CondLO into a field that would otherwise store a register + RegCondLO + // RegCondMI encodes CondMI into a field that would otherwise store a register + RegCondMI + // RegCondPL encodes CondPL into a field that would otherwise store a register + RegCondPL + // RegCondVS encodes CondVS into a field that would otherwise store a register + RegCondVS + // RegCondVC encodes CondVC into a field that would otherwise store a register + RegCondVC + // RegCondHI encodes CondHI into a field that would otherwise store a register + RegCondHI + // RegCondLS encodes CondLS into a field that would otherwise store a register + RegCondLS + // RegCondGE encodes CondGE into a field that would otherwise store a register + RegCondGE + // RegCondLT encodes CondLT into a field that would otherwise store a register + RegCondLT + // RegCondGT encodes CondGT into a field that would otherwise store a register + RegCondGT + // RegCondLE encodes CondLE into a field that would otherwise store a register + RegCondLE + // RegCondAL encodes CondAL into a field that would otherwise store a register + RegCondAL + // RegCondNV encodes CondNV into a field that would otherwise store a register + RegCondNV +) + +// conditionalRegisterStateToRegister cast a conditional register to its unique register ID. +// See the comment on RegCondEQ above. +func conditionalRegisterStateToRegister(c asm.ConditionalRegisterState) asm.Register { + switch c { + case CondEQ: + return RegCondEQ + case CondNE: + return RegCondNE + case CondHS: + return RegCondHS + case CondLO: + return RegCondLO + case CondMI: + return RegCondMI + case CondPL: + return RegCondPL + case CondVS: + return RegCondVS + case CondVC: + return RegCondVC + case CondHI: + return RegCondHI + case CondLS: + return RegCondLS + case CondGE: + return RegCondGE + case CondLT: + return RegCondLT + case CondGT: + return RegCondGT + case CondLE: + return RegCondLE + case CondAL: + return RegCondAL + case CondNV: + return RegCondNV + } + return asm.NilRegister +} + +// RegisterName returns the name of a given register +func RegisterName(r asm.Register) string { + switch r { + case asm.NilRegister: + return "nil" + case RegR0: + return "R0" + case RegR1: + return "R1" + case RegR2: + return "R2" + case RegR3: + return "R3" + case RegR4: + return "R4" + case RegR5: + return "R5" + case RegR6: + return "R6" + case RegR7: + return "R7" + case RegR8: + return "R8" + case RegR9: + return "R9" + case RegR10: + return "R10" + case RegR11: + return "R11" + case RegR12: + return "R12" + case RegR13: + return "R13" + case RegR14: + return "R14" + case RegR15: + return "R15" + case RegR16: + return "R16" + case RegR17: + return "R17" + case RegR18: + return "R18" + case RegR19: + return "R19" + case RegR20: + return "R20" + case RegR21: + return "R21" + case RegR22: + return "R22" + case RegR23: + return "R23" + case RegR24: + return "R24" + case RegR25: + return "R25" + case RegR26: + return "R26" + case RegR27: + return "R27" + case RegR28: + return "R28" + case RegR29: + return "R29" + case RegR30: + return "R30" + case RegRZR: + return "RZR" + case RegSP: + return "SP" + case RegV0: + return "V0" + case RegV1: + return "V1" + case RegV2: + return "V2" + case RegV3: + return "V3" + case RegV4: + return "V4" + case RegV5: + return "V5" + case RegV6: + return "V6" + case RegV7: + return "V7" + case RegV8: + return "V8" + case RegV9: + return "V9" + case RegV10: + return "V10" + case RegV11: + return "V11" + case RegV12: + return "V12" + case RegV13: + return "V13" + case RegV14: + return "V14" + case RegV15: + return "V15" + case RegV16: + return "V16" + case RegV17: + return "V17" + case RegV18: + return "V18" + case RegV19: + return "V19" + case RegV20: + return "V20" + case RegV21: + return "V21" + case RegV22: + return "V22" + case RegV23: + return "V23" + case RegV24: + return "V24" + case RegV25: + return "V25" + case RegV26: + return "V26" + case RegV27: + return "V27" + case RegV28: + return "V28" + case RegV29: + return "V29" + case RegV30: + return "V30" + case RegV31: + return "V31" + case RegFPSR: + return "FPSR" + case RegCondEQ: + return "COND_EQ" + case RegCondNE: + return "COND_NE" + case RegCondHS: + return "COND_HS" + case RegCondLO: + return "COND_LO" + case RegCondMI: + return "COND_MI" + case RegCondPL: + return "COND_PL" + case RegCondVS: + return "COND_VS" + case RegCondVC: + return "COND_VC" + case RegCondHI: + return "COND_HI" + case RegCondLS: + return "COND_LS" + case RegCondGE: + return "COND_GE" + case RegCondLT: + return "COND_LT" + case RegCondGT: + return "COND_GT" + case RegCondLE: + return "COND_LE" + case RegCondAL: + return "COND_AL" + case RegCondNV: + return "COND_NV" + } + return "UNKNOWN" +} + +// Arm64-specific instructions. +// +// Note: This only defines arm64 instructions used by wazero's compiler. +// Note: Naming conventions partially match the Go assembler: https://go.dev/doc/asm +const ( + // NOP is the NOP instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/NOP + NOP asm.Instruction = iota + // RET is the RET instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/RET + RET + // ADD is the ADD instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/ADD--shifted-register- + ADD + // ADDS is the ADDS instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/ADDS--shifted-register- + ADDS + // ADDW is the ADD instruction, in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/ADD--shifted-register- + ADDW + // ADR is the ADR instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/ADR + ADR + // AND is the AND instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/AND--shifted-register- + AND + // ANDIMM32 is the AND(immediate) instruction in 32-bit mode https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/AND--immediate---Bitwise-AND--immediate--?lang=en + ANDIMM32 + // ANDIMM64 is the AND(immediate) instruction in 64-bit mode https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/AND--immediate---Bitwise-AND--immediate--?lang=en + ANDIMM64 + // ANDW is the AND instruction, in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/AND--register- + ANDW + // ASR is the ASR instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/ASR--register- + ASR + // ASRW is the ASR instruction, in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/ASR--register- + ASRW + // B is the B instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/B + B + + // Below are B.cond instructions. + // * https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/B-cond + // * https://developer.arm.com/documentation/dui0802/a/A32-and-T32-Instructions/Condition-codes + + // BCONDEQ is the B.cond instruction with CondEQ. + BCONDEQ + // BCONDGE is the B.cond instruction with CondGE. + BCONDGE + // BCONDGT is the B.cond instruction with CondGT. + BCONDGT + // BCONDHI is the B.cond instruction with CondHI. + BCONDHI + // BCONDHS is the B.cond instruction with CondHS. + BCONDHS + // BCONDLE is the B.cond instruction with CondLE. + BCONDLE + // BCONDLO is the B.cond instruction with CondLO. + BCONDLO + // BCONDLS is the B.cond instruction with CondLS. + BCONDLS + // BCONDLT is the B.cond instruction with CondLT. + BCONDLT + // BCONDMI is the B.cond instruction with CondMI. + BCONDMI + // BCONDPL is the B.cond instruction with CondPL. + BCONDPL + // BCONDNE is the B.cond instruction with CondNE. + BCONDNE + // BCONDVS is the B.cond instruction with CondVS. + BCONDVS + // BCONDVC is the B.cond instruction with CondVC. + BCONDVC + + // CLZ is the CLZ instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/CLZ + CLZ + // CLZW is the CLZ instruction, in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/CLZ + CLZW + // CMP is the CMP instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/CMP--shifted-register- + CMP + // CMPW is the CMP instruction, in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/CMP--shifted-register- + CMPW + // CSET is the CSET instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/CSET + CSET + // EOR is the EOR instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/EOR--shifted-register- + EOR + // EORW is the EOR instruction, in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/EOR--shifted-register- + EORW + // FABSD is the FABS instruction, for double-precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FABS--scalar- + FABSD + // FABSS is the FABS instruction, for single-precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FABS--scalar- + FABSS + // FADDD is the FADD instruction, for double-precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FADD--scalar- + FADDD + // FADDS is the FADD instruction, for single-precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FADD--scalar- + FADDS + // FCMPD is the FCMP instruction, for double-precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FCMP + FCMPD + // FCMPS is the FCMP instruction, for single-precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FCMP + FCMPS + // FCVTDS is the FCVT instruction, for single to double precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FCVT + FCVTDS + // FCVTSD is the FCVT instruction, for double to single precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FCVT + FCVTSD + // FCVTZSD is the FCVTZS instruction, for double precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FCVTZS--scalar--integer- + FCVTZSD + // FCVTZSDW is the FCVTZS instruction, for double precision in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FCVTZS--scalar--integer- + FCVTZSDW + // FCVTZSS is the FCVTZS instruction, for single precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FCVTZS--scalar--integer- + FCVTZSS + // FCVTZSSW is the FCVTZS instruction, for single precision in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FCVTZS--scalar--integer- + FCVTZSSW + // FCVTZUD is the FCVTZU instruction, for double precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FCVTZU--scalar--integer- + FCVTZUD + // FCVTZUDW is the FCVTZU instruction, for double precision in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FCVTZU--scalar--integer- + FCVTZUDW + // FCVTZUS is the FCVTZU instruction, for single precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FCVTZU--scalar--integer- + FCVTZUS + // FCVTZUSW is the FCVTZU instruction, for single precision in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FCVTZU--scalar--integer- + FCVTZUSW + // FDIVD is the FDIV instruction, for double precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FDIV--scalar- + FDIVD + // FDIVS is the FDIV instruction, for single precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FDIV--scalar- + FDIVS + // FMAXD is the FMAX instruction, for double precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FMAX--scalar- + FMAXD + // FMAXS is the FMAX instruction, for single precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FMAX--scalar- + FMAXS + // FMIND is the FMIN instruction, for double precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FMIN--scalar- + FMIND + // FMINS is the FMIN instruction, for single precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FMIN--scalar- + FMINS + // FMOVD is the FMOV instruction, for double precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FMOV--register- + FMOVD + // FMOVS is the FMOV instruction, for single precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FMOV--register- + FMOVS + // FMULD is the FMUL instruction, for double precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FMUL--scalar- + FMULD + // FMULS is the FMUL instruction, for single precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FMUL--scalar- + FMULS + // FNEGD is the FNEG instruction, for double precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FNEG--scalar- + FNEGD + // FNEGS is the FNEG instruction, for single precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FNEG--scalar- + FNEGS + // FRINTMD is the FRINTM instruction, for double precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FRINTM--scalar- + FRINTMD + // FRINTMS is the FRINTM instruction, for single precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FRINTM--scalar- + FRINTMS + // FRINTND is the FRINTN instruction, for double precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FRINTN--scalar- + FRINTND + // FRINTNS is the FRINTN instruction, for single precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FRINTN--scalar- + FRINTNS + // FRINTPD is the FRINTP instruction, for double precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FRINTP--scalar- + FRINTPD + // FRINTPS is the FRINTP instruction, for single precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FRINTP--scalar- + FRINTPS + // FRINTZD is the FRINTZ instruction, for double precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FRINTZ--scalar- + FRINTZD + // FRINTZS is the FRINTZ instruction, for single precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FRINTZ--scalar- + FRINTZS + // FSQRTD is the FSQRT instruction, for double precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FSQRT--scalar- + FSQRTD + // FSQRTS is the FSQRT instruction, for single precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FSQRT--scalar- + FSQRTS + // FSUBD is the FSUB instruction, for double precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FSUB--scalar- + FSUBD + // FSUBS is the FSUB instruction, for single precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/FSUB--scalar- + FSUBS + // LSL is the LSL instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/LSL--register- + LSL + // LSLW is the LSL instruction, in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/LSL--register- + LSLW + // LSR is the LSR instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/LSR--register- + LSR + // LSRW is the LSR instruction, in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/LSR--register- + LSRW + // FLDRD is the LDR (SIMD&FP) instruction for double precisions. https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/LDR--register--SIMD-FP---Load-SIMD-FP-Register--register-offset--?lang=en + FLDRD + // FLDRS is the LDR (SIMD&FP) instruction for single precisions. https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/LDR--register--SIMD-FP---Load-SIMD-FP-Register--register-offset--?lang=en + FLDRS + // LDRD is the LDR instruction in 64-bit mode. https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/LDR--register---Load-Register--register--?lang=en + LDRD + // LDRW is the LDR instruction in 32-bit mode. https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/LDR--register---Load-Register--register--?lang=en + LDRW + // LDRSBD is the LDRSB instruction in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-Data-Transfer-Instructions/LDRSB--register- + LDRSBD + // LDRSBW is the LDRSB instruction in 32-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-Data-Transfer-Instructions/LDRSB--register- + LDRSBW + // LDRB is the LDRB instruction. https://developer.arm.com/documentation/dui0802/a/A64-Data-Transfer-Instructions/LDRB--register- + LDRB + // LDRSHD is the LDRSHW instruction in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-Data-Transfer-Instructions/LDRSH--register- + LDRSHD + // LDRSHW is the LDRSHW instruction in 32-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-Data-Transfer-Instructions/LDRSH--register- + LDRSHW + // LDRH is the LDRH instruction. https://developer.arm.com/documentation/dui0802/a/A64-Data-Transfer-Instructions/LDRH--register- + LDRH + // LDRSW is the LDRSW instruction https://developer.arm.com/documentation/dui0802/a/A64-Data-Transfer-Instructions/LDRSW--register- + LDRSW + // FSTRD is the STR (SIMD&FP) instruction for double precisions. https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/STR--immediate--SIMD-FP---Store-SIMD-FP-register--immediate-offset--?lang=en + FSTRD + // FSTRS is the STR (SIMD&FP) instruction for single precisions. https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/STR--immediate--SIMD-FP---Store-SIMD-FP-register--immediate-offset--?lang=en + FSTRS + // STRD is the STR instruction in 64-bit mode. https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/STR--register---Store-Register--register--?lang=en + STRD + // STRW is the STR instruction in 32-bit mode. https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/STR--register---Store-Register--register--?lang=en + STRW + // STRH is the STRH instruction. https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/STRH--register---Store-Register-Halfword--register--?lang=en + STRH + // STRB is the STRB instruction. https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/STRB--register---Store-Register-Byte--register--?lang=en + STRB + // MOVD moves a double word from register to register, or const to register. + MOVD + // MOVW moves a word from register to register, or const to register. + MOVW + // MRS is the MRS instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/MRS + MRS + // MSR is the MSR instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/MSR--register- + MSR + // MSUB is the MSUB instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/MSUB + MSUB + // MSUBW is the MSUB instruction, in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/MSUB + MSUBW + // MUL is the MUL instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/MUL + MUL + // MULW is the MUL instruction, in 32-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/MUL + MULW + // NEG is the NEG instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/NEG + NEG + // NEGW is the NEG instruction, in 32-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/NEG + NEGW + // ORR is the ORR instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/ORR--shifted-register- + ORR + // ORRW is the ORR instruction, in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/ORR--shifted-register- + ORRW + // RBIT is the RBIT instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/RBIT + RBIT + // RBITW is the RBIT instruction, in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/RBIT + RBITW + // ROR is the ROR instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/ROR--register- + ROR + // RORW is the RORW instruction, in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/ROR--register- + RORW + // SCVTFD is the SCVTF instruction, for double precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/SCVTF--scalar--integer- + SCVTFD + // SCVTFS is the SCVTF instruction, for single precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/SCVTF--scalar--integer- + SCVTFS + // SCVTFWD is the SCVTF instruction, for double precision in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/SCVTF--scalar--integer- + SCVTFWD + // SCVTFWS is the SCVTF instruction, for single precision in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/SCVTF--scalar--integer- + SCVTFWS + // SDIV is the SDIV instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/SDIV + SDIV + // SDIVW is the SDIV instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/SDIV + SDIVW + // SUB is the SUB instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/SUB--shifted-register- + SUB + // SUBS is the SUBS instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/SUBS--shifted-register- + SUBS + // SUBW is the SUB instruction, in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/SUB--shifted-register- + SUBW + // SXTB is the SXTB instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/SXTB + SXTB + // SXTBW is the SXTB instruction, in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/SXTB + SXTBW + // SXTH is the SXTH instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/SXTH + SXTH + // SXTHW is the SXTH instruction, in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/SXTH + SXTHW + // SXTW is the SXTW instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/SXTW + SXTW + // UCVTFD is the UCVTF instruction, for double precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/UCVTF--scalar--integer- + UCVTFD + // UCVTFS is the UCVTF instruction, for single precision. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/UCVTF--scalar--integer- + UCVTFS + // UCVTFWD is the UCVTF instruction, for double precision in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/UCVTF--scalar--integer- + UCVTFWD + // UCVTFWS is the UCVTF instruction, for single precision in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-Floating-point-Instructions/UCVTF--scalar--integer- + UCVTFWS + // UDIV is the UDIV instruction. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/UDIV + UDIV + // UDIVW is the UDIV instruction, in 64-bit mode. https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/UDIV + UDIVW + // VBIT is the BIT instruction. https://developer.arm.com/documentation/dui0802/a/A64-Advanced-SIMD-Vector-Instructions/BIT--vector- + VBIT + // VCNT is the CNT instruction. https://developer.arm.com/documentation/dui0802/a/A64-Advanced-SIMD-Vector-Instructions/CNT--vector- + VCNT + // VMOV has different semantics depending on the types of operands: + // - LDR(SIMD&FP) if the src is memory and dst is a vector: https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/LDR--immediate--SIMD-FP---Load-SIMD-FP-Register--immediate-offset-- + // - LDR(literal, SIMD&FP) if the src is static const and dst is a vector: https://developer.arm.com/documentation/dui0801/h/A64-Floating-point-Instructions/LDR--literal--SIMD-and-FP- + // - STR(SIMD&FP) if the dst is memory and src is a vector: https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/STR--immediate--SIMD-FP---Store-SIMD-FP-register--immediate-offset-- + VMOV + // UMOV is the UMOV instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/UMOV--Unsigned-Move-vector-element-to-general-purpose-register-?lang=en + UMOV + // INSGEN is the INS(general) instruction https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/INS--general---Insert-vector-element-from-general-purpose-register-?lang=en + INSGEN + // INSELEM is the INS(element) instruction https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/INS--element---Insert-vector-element-from-another-vector-element-?lang=en + INSELEM + // UADDLV is the UADDLV(vector) instruction. https://developer.arm.com/documentation/dui0802/a/A64-Advanced-SIMD-Vector-Instructions/UADDLV--vector- + UADDLV + // VADD is the ADD(vector) instruction. https://developer.arm.com/documentation/dui0802/a/A64-Advanced-SIMD-Vector-Instructions/ADD--vector- + VADD + // VFADDS is the FADD(vector) instruction, for single precision. https://developer.arm.com/documentation/dui0802/a/A64-Advanced-SIMD-Vector-Instructions/FADD--vector- + VFADDS + // VFADDD is the FADD(vector) instruction, for double precision. https://developer.arm.com/documentation/dui0802/a/A64-Advanced-SIMD-Vector-Instructions/FADD--vector- + VFADDD + // VSUB is the SUB(vector) instruction. https://developer.arm.com/documentation/dui0802/a/A64-Advanced-SIMD-Vector-Instructions/SUB--vector- + VSUB + // VFSUBS is the FSUB(vector) instruction, for single precision. https://developer.arm.com/documentation/dui0802/a/A64-Advanced-SIMD-Vector-Instructions/FSUB--vector- + VFSUBS + // VFSUBD is the FSUB(vector) instruction, for double precision. https://developer.arm.com/documentation/dui0802/a/A64-Advanced-SIMD-Vector-Instructions/FSUB--vector- + VFSUBD + // SSHL is the SSHL(vector,register) instruction. https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SSHL--Signed-Shift-Left--register--?lang=en + SSHL + // SSHLL is the SSHLL(vector,immediate) instruction. https://developer.arm.com/documentation/dui0801/h/A64-SIMD-Vector-Instructions/SSHLL--SSHLL2--vector- + SSHLL + // USHL is the USHL(vector,register) instruction. https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SSHL--Signed-Shift-Left--register--?lang=en + USHL + // USHLL is the USHLL(vector,immediate) instruction. https://developer.arm.com/documentation/dui0801/h/A64-SIMD-Vector-Instructions/SSHLL--SSHLL2--vector- + USHLL + // LD1R is the LD1R instruction. https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/LD1R--Load-one-single-element-structure-and-Replicate-to-all-lanes--of-one-register-- + LD1R + // SMOV32 is the 32-bit variant of SMOV(vector) instruction. https://developer.arm.com/documentation/100069/0610/A64-SIMD-Vector-Instructions/SMOV--vector- + SMOV32 + // DUPGEN is the DUP(general) instruction. https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/DUP--general---Duplicate-general-purpose-register-to-vector- + DUPGEN + // DUPELEM is the DUP(element) instruction. https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/DUP--element---Duplicate-vector-element-to-vector-or-scalar- + DUPELEM + // UMAXP is the UMAXP(vector) instruction. https://developer.arm.com/documentation/dui0801/g/A64-SIMD-Vector-Instructions/UMAXP--vector- + UMAXP + // UMINV is the UMINV(vector) instruction. https://developer.arm.com/documentation/100069/0610/A64-SIMD-Vector-Instructions/UMINV--vector- + UMINV + // CMEQ is the CMEQ(vector, register) instruction. https://developer.arm.com/documentation/dui0801/g/A64-SIMD-Vector-Instructions/CMEQ--vector--register- + CMEQ + // CMEQZERO is the CMEP(zero) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/CMEQ--zero---Compare-bitwise-Equal-to-zero--vector--?lang=en + CMEQZERO + // ADDP is the ADDP(scalar) instruction. https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/ADDP--scalar---Add-Pair-of-elements--scalar--?lang=en + ADDP + // VADDP is the ADDP(vector) instruction. https://developer.arm.com/documentation/dui0801/g/A64-SIMD-Vector-Instructions/ADDP--vector- + // Note: prefixed by V to distinguish from the non-vector variant of ADDP(scalar). + VADDP + // TBL1 is the TBL instruction whose source is one vector. https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/TBL--Table-vector-Lookup- + TBL1 + // TBL2 is the TBL instruction whose source is two vectors. https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/TBL--Table-vector-Lookup- + TBL2 + // NOT is the NOT(vector) instruction https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/NOT--Bitwise-NOT--vector--?lang=en + NOT + // VAND is the AND(vector) instruction https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/AND--vector---Bitwise-AND--vector-- + // Note: prefixed by V to distinguish from the non-vector variant of AND. + VAND + // VORR is the ORR(vector) instruction https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/ORR--vector--register---Bitwise-inclusive-OR--vector--register-- + // Note: prefixed by V to distinguish from the non-vector variant of ORR. + VORR + // BSL https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/BSL--Bitwise-Select- + BSL + // BIC is the BIC(vector) instruction https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/BIC--vector--register---Bitwise-bit-Clear--vector--register-- + BIC + // VFNEG is the FNEG(vector) instruction https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/FNEG--vector---Floating-point-Negate--vector-- + // Note: prefixed by V to distinguish from the non-vector variant of FNEG. + VFNEG + // ADDV is the ADDV instruction https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/ADDV--Add-across-Vector- + ADDV + // ZIP1 is the ZIP1 instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/ZIP1--Zip-vectors--primary--?lang=en + ZIP1 + // SSHR is the SSHR(immediate,vector) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SSHR--Signed-Shift-Right--immediate--?lang=en + SSHR + // EXT is the EXT instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/EXT--Extract-vector-from-pair-of-vectors-?lang=en + EXT + // CMGT is the CMGT(register) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/CMGT--register---Compare-signed-Greater-than--vector--?lang=en + CMGT + // CMHI is the CMHI(register) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/CMHI--register---Compare-unsigned-Higher--vector--?lang=en + CMHI + // CMGE is the CMGE(register) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/CMGE--register---Compare-signed-Greater-than-or-Equal--vector--?lang=en + CMGE + // CMHS is the CMHS(register) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/CMHS--register---Compare-unsigned-Higher-or-Same--vector--?lang=en + CMHS + // FCMEQ is the FCMEQ(register) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FCMEQ--register---Floating-point-Compare-Equal--vector--?lang=en + FCMEQ + // FCMGT is the FCMGT(register) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FCMGT--register---Floating-point-Compare-Greater-than--vector--?lang=en + FCMGT + // FCMGE is the FCMGE(register) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FCMGE--register---Floating-point-Compare-Greater-than-or-Equal--vector--?lang=en + FCMGE + // VFMUL is the FMUL(vector) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FMUL--vector---Floating-point-Multiply--vector--?lang=en + // Note: prefixed by V to distinguish from the non-vector variant. + VFMUL + // VFDIV is the FDIV(vector) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FDIV--vector---Floating-point-Divide--vector--?lang=en + // Note: prefixed by V to distinguish from the non-vector variant. + VFDIV + // VFSQRT is the FSQRT(vector) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FSQRT--vector---Floating-point-Square-Root--vector--?lang=en + // Note: prefixed by V to distinguish from the non-vector variant. + VFSQRT + // VFMIN is the FMIN(vector) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FMIN--vector---Floating-point-minimum--vector--?lang=en + // Note: prefixed by V to distinguish from the non-vector variant. + VFMIN + // VFMAX is the FMAX(vector) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FMAX--vector---Floating-point-Maximum--vector--?lang=en + // Note: prefixed by V to distinguish from the non-vector variant. + VFMAX + // VFABS is the FABS(vector) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FABS--vector---Floating-point-Absolute-value--vector--?lang=en + // Note: prefixed by V to distinguish from the non-vector variant. + VFABS + // VFRINTP is the FRINTP(vector) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FRINTP--vector---Floating-point-Round-to-Integral--toward-Plus-infinity--vector--?lang=en + // Note: prefixed by V to distinguish from the non-vector variant. + VFRINTP + // VFRINTM is the FRINTM(vector) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FRINTM--vector---Floating-point-Round-to-Integral--toward-Minus-infinity--vector--?lang=en + // Note: prefixed by V to distinguish from the non-vector variant. + VFRINTM + // VFRINTZ is the FRINTZ(vector) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FRINTZ--vector---Floating-point-Round-to-Integral--toward-Zero--vector--?lang=en + // Note: prefixed by V to distinguish from the non-vector variant. + VFRINTZ + // VFRINTN is the FRINTN(vector) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FRINTN--vector---Floating-point-Round-to-Integral--to-nearest-with-ties-to-even--vector--?lang=en + // Note: prefixed by V to distinguish from the non-vector variant. + VFRINTN + // VMUL is the MUL(vector) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/MUL--vector---Multiply--vector--?lang=en + // Note: prefixed by V to distinguish from the non-vector variant. + VMUL + // VNEG is the NEG(vector) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/NEG--vector---Negate--vector--?lang=en + // Note: prefixed by V to distinguish from the non-vector variant. + VNEG + // VABS is the ABS(vector) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/ABS--Absolute-value--vector--?lang=en + // Note: prefixed by V to distinguish from the non-vector variant. + VABS + // VSQADD is the SQADD(vector) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SQADD--Signed-saturating-Add-?lang=en + // Note: prefixed by V to distinguish from the non-vector variant. + VSQADD + // VUQADD is the UQADD(vector) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/UQADD--Unsigned-saturating-Add-?lang=en + // Note: prefixed by V to distinguish from the non-vector variant. + VUQADD + // VSQSUB is the SQSUB(vector) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SQSUB--Signed-saturating-Subtract-?lang=en + // Note: prefixed by V to distinguish from the non-vector variant. + VSQSUB + // VUQSUB is the UQSUB(vector) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/UQSUB--Unsigned-saturating-Subtract-?lang=en + // Note: prefixed by V to distinguish from the non-vector variant. + VUQSUB + // SMIN is the SMIN instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SMIN--Signed-Minimum--vector--?lang=en + SMIN + // SMAX is the SMAX instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SMAX--Signed-Maximum--vector--?lang=en + SMAX + // UMIN is the UMIN instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/UMIN--Unsigned-Minimum--vector--?lang=en + UMIN + // UMAX is the UMAX instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/UMAX--Unsigned-Maximum--vector--?lang=en + UMAX + // URHADD is the URHADD instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/URHADD--Unsigned-Rounding-Halving-Add-?lang=en + URHADD + // REV64 is the REV64 instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/REV64--Reverse-elements-in-64-bit-doublewords--vector--?lang=en + REV64 + // XTN is the XTN instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/XTN--XTN2--Extract-Narrow-?lang=en + XTN + // VUMLAL is the UMLAL(vector) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/UMLAL--UMLAL2--vector---Unsigned-Multiply-Add-Long--vector--?lang=en + // Note: prefixed by V to distinguish from the non-vector variant. + VUMLAL + // SHLL is the SHLL instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SHLL--SHLL2--Shift-Left-Long--by-element-size--?lang=en + SHLL + // SADDLP is the SADDLP instruction. https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SADDLP--Signed-Add-Long-Pairwise-?lang=en + SADDLP + // UADDLP is the UADDLP instruction. https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/UADDLP--Unsigned-Add-Long-Pairwise-?lang=en + UADDLP + // SSHLL2 is the SSHLL2(vector,immediate) instruction. https://developer.arm.com/documentation/dui0801/h/A64-SIMD-Vector-Instructions/SSHLL--SSHLL2--vector- + SSHLL2 + // USHLL2 is the USHLL2(vector,immediate) instruction. https://developer.arm.com/documentation/dui0801/h/A64-SIMD-Vector-Instructions/SSHLL--SSHLL2--vector- + USHLL2 + // SQRDMULH is the SQRDMULH(vector) instruction. https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SQRDMULH--vector---Signed-saturating-Rounding-Doubling-Multiply-returning-High-half-?lang=en + SQRDMULH + // SMULL is the SMULL(vector) instruction. https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SMULL--SMULL2--vector---Signed-Multiply-Long--vector--?lang=en + SMULL + // SMULL2 is the SMULL2(vector) instruction. https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SMULL--SMULL2--vector---Signed-Multiply-Long--vector--?lang=en + SMULL2 + // UMULL is the UMULL instruction. https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en + UMULL + // UMULL2 is the UMULL2 instruction. https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en + UMULL2 + // VFCVTZS is the FCVTZS(vector,integer) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FCVTZS--vector--integer---Floating-point-Convert-to-Signed-integer--rounding-toward-Zero--vector--?lang=en + // Note: prefixed by V to distinguish from the non-vector variant. + VFCVTZS + // VFCVTZU is the FCVTZU(vector,integer) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FCVTZU--vector--integer---Floating-point-Convert-to-Unsigned-integer--rounding-toward-Zero--vector--?lang=en + // Note: prefixed by V to distinguish from the non-vector variant. + VFCVTZU + // SQXTN is the SQXTN instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SQXTN--SQXTN2--Signed-saturating-extract-Narrow-?lang=en + SQXTN + // UQXTN is the UQXTN instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/UQXTN--UQXTN2--Unsigned-saturating-extract-Narrow-?lang=en + UQXTN + // SQXTN2 is the SQXTN2 instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SQXTN--SQXTN2--Signed-saturating-extract-Narrow-?lang=en + SQXTN2 + // SQXTUN is the SQXTUN instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SQXTUN--SQXTUN2--Signed-saturating-extract-Unsigned-Narrow-?lang=en + SQXTUN + // SQXTUN2 is the SQXTUN2 instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SQXTUN--SQXTUN2--Signed-saturating-extract-Unsigned-Narrow-?lang=en + SQXTUN2 + // VSCVTF is the SCVTF(vector, integer) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SCVTF--vector--integer---Signed-integer-Convert-to-Floating-point--vector--?lang=en + // Note: prefixed by V to distinguish from the non-vector variant. + VSCVTF + // VUCVTF is the UCVTF(vector, integer) instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/UCVTF--vector--integer---Unsigned-integer-Convert-to-Floating-point--vector--?lang=en + // Note: prefixed by V to distinguish from the non-vector variant. + VUCVTF + // FCVTL is the FCVTL instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FCVTL--FCVTL2--Floating-point-Convert-to-higher-precision-Long--vector--?lang=en + FCVTL + // FCVTN is the FCVTN instruction https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FCVTN--FCVTN2--Floating-point-Convert-to-lower-precision-Narrow--vector--?lang=en + FCVTN + + // UDF is the UDF instruction https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/UDF--Permanently-Undefined-?lang=en + UDF + + // instructionEnd is always placed at the bottom of this iota definition to be used in the test. + instructionEnd +) + +// VectorArrangement is the arrangement of data within a vector register. +type VectorArrangement byte + +const ( + // VectorArrangementNone is an arrangement indicating no data is stored. + VectorArrangementNone VectorArrangement = iota + // VectorArrangement8B is an arrangement of 8 bytes (64-bit vector) + VectorArrangement8B + // VectorArrangement16B is an arrangement of 16 bytes (128-bit vector) + VectorArrangement16B + // VectorArrangement4H is an arrangement of 4 half precisions (64-bit vector) + VectorArrangement4H + // VectorArrangement8H is an arrangement of 8 half precisions (128-bit vector) + VectorArrangement8H + // VectorArrangement2S is an arrangement of 2 single precisions (64-bit vector) + VectorArrangement2S + // VectorArrangement4S is an arrangement of 4 single precisions (128-bit vector) + VectorArrangement4S + // VectorArrangement1D is an arrangement of 1 double precision (64-bit vector) + VectorArrangement1D + // VectorArrangement2D is an arrangement of 2 double precisions (128-bit vector) + VectorArrangement2D + + // Assign each vector size specifier to a vector arrangement ID. + // Instructions can only have an arrangement or a size specifier, but not both, so it + // simplifies the internal representation of vector instructions by being able to + // store either into the same field. + + // VectorArrangementB is a size specifier of byte + VectorArrangementB + // VectorArrangementH is a size specifier of word (16-bit) + VectorArrangementH + // VectorArrangementS is a size specifier of double word (32-bit) + VectorArrangementS + // VectorArrangementD is a size specifier of quad word (64-bit) + VectorArrangementD + // VectorArrangementQ is a size specifier of the entire vector (128-bit) + VectorArrangementQ +) + +func (v VectorArrangement) String() (ret string) { + switch v { + case VectorArrangement8B: + ret = "8B" + case VectorArrangement16B: + ret = "16B" + case VectorArrangement4H: + ret = "4H" + case VectorArrangement8H: + ret = "8H" + case VectorArrangement2S: + ret = "2S" + case VectorArrangement4S: + ret = "4S" + case VectorArrangement1D: + ret = "1D" + case VectorArrangement2D: + ret = "2D" + case VectorArrangementB: + ret = "B" + case VectorArrangementH: + ret = "H" + case VectorArrangementS: + ret = "S" + case VectorArrangementD: + ret = "D" + case VectorArrangementQ: + ret = "Q" + case VectorArrangementNone: + ret = "none" + default: + panic(v) + } + return +} + +// VectorIndex is the index of an element of a vector register +type VectorIndex byte + +// VectorIndexNone indicates no vector index specified. +const VectorIndexNone = ^VectorIndex(0) + +// InstructionName returns the name of the given instruction +func InstructionName(i asm.Instruction) string { + switch i { + case NOP: + return "NOP" + case RET: + return "RET" + case ADD: + return "ADD" + case ADDS: + return "ADDS" + case ADDW: + return "ADDW" + case ADR: + return "ADR" + case AND: + return "AND" + case ANDIMM32: + return "ANDIMM32" + case ANDIMM64: + return "ANDIMM64" + case ANDW: + return "ANDW" + case ASR: + return "ASR" + case ASRW: + return "ASRW" + case B: + return "B" + case BCONDEQ: + return "BCONDEQ" + case BCONDGE: + return "BCONDGE" + case BCONDGT: + return "BCONDGT" + case BCONDHI: + return "BCONDHI" + case BCONDHS: + return "BCONDHS" + case BCONDLE: + return "BCONDLE" + case BCONDLO: + return "BCONDLO" + case BCONDLS: + return "BCONDLS" + case BCONDLT: + return "BCONDLT" + case BCONDMI: + return "BCONDMI" + case BCONDPL: + return "BCONDPL" + case BCONDNE: + return "BCONDNE" + case BCONDVS: + return "BCONDVS" + case BCONDVC: + return "BCONDVC" + case CLZ: + return "CLZ" + case CLZW: + return "CLZW" + case CMP: + return "CMP" + case CMPW: + return "CMPW" + case CSET: + return "CSET" + case EOR: + return "EOR" + case EORW: + return "EORW" + case FABSD: + return "FABSD" + case FABSS: + return "FABSS" + case FADDD: + return "FADDD" + case FADDS: + return "FADDS" + case FCMPD: + return "FCMPD" + case FCMPS: + return "FCMPS" + case FCVTDS: + return "FCVTDS" + case FCVTSD: + return "FCVTSD" + case FCVTZSD: + return "FCVTZSD" + case FCVTZSDW: + return "FCVTZSDW" + case FCVTZSS: + return "FCVTZSS" + case FCVTZSSW: + return "FCVTZSSW" + case FCVTZUD: + return "FCVTZUD" + case FCVTZUDW: + return "FCVTZUDW" + case FCVTZUS: + return "FCVTZUS" + case FCVTZUSW: + return "FCVTZUSW" + case FDIVD: + return "FDIVD" + case FDIVS: + return "FDIVS" + case FMAXD: + return "FMAXD" + case FMAXS: + return "FMAXS" + case FMIND: + return "FMIND" + case FMINS: + return "FMINS" + case FMOVD: + return "FMOVD" + case FMOVS: + return "FMOVS" + case FMULD: + return "FMULD" + case FMULS: + return "FMULS" + case FNEGD: + return "FNEGD" + case FNEGS: + return "FNEGS" + case FRINTMD: + return "FRINTMD" + case FRINTMS: + return "FRINTMS" + case FRINTND: + return "FRINTND" + case FRINTNS: + return "FRINTNS" + case FRINTPD: + return "FRINTPD" + case FRINTPS: + return "FRINTPS" + case FRINTZD: + return "FRINTZD" + case FRINTZS: + return "FRINTZS" + case FSQRTD: + return "FSQRTD" + case FSQRTS: + return "FSQRTS" + case FSUBD: + return "FSUBD" + case FSUBS: + return "FSUBS" + case LSL: + return "LSL" + case LSLW: + return "LSLW" + case LSR: + return "LSR" + case LSRW: + return "LSRW" + case LDRSBD: + return "LDRSBD" + case LDRSBW: + return "LDRSBW" + case LDRB: + return "LDRB" + case MOVD: + return "MOVD" + case LDRSHD: + return "LDRSHD" + case LDRSHW: + return "LDRSHW" + case LDRH: + return "LDRH" + case LDRSW: + return "LDRSW" + case STRD: + return "STRD" + case STRW: + return "STRW" + case STRH: + return "STRH" + case STRB: + return "STRB" + case MOVW: + return "MOVW" + case MRS: + return "MRS" + case MSR: + return "MSR" + case MSUB: + return "MSUB" + case MSUBW: + return "MSUBW" + case MUL: + return "MUL" + case MULW: + return "MULW" + case NEG: + return "NEG" + case NEGW: + return "NEGW" + case ORR: + return "ORR" + case ORRW: + return "ORRW" + case RBIT: + return "RBIT" + case RBITW: + return "RBITW" + case ROR: + return "ROR" + case RORW: + return "RORW" + case SCVTFD: + return "SCVTFD" + case SCVTFS: + return "SCVTFS" + case SCVTFWD: + return "SCVTFWD" + case SCVTFWS: + return "SCVTFWS" + case SDIV: + return "SDIV" + case SDIVW: + return "SDIVW" + case SUB: + return "SUB" + case SUBS: + return "SUBS" + case SUBW: + return "SUBW" + case SXTB: + return "SXTB" + case SXTBW: + return "SXTBW" + case SXTH: + return "SXTH" + case SXTHW: + return "SXTHW" + case SXTW: + return "SXTW" + case UCVTFD: + return "UCVTFD" + case UCVTFS: + return "UCVTFS" + case UCVTFWD: + return "UCVTFWD" + case UCVTFWS: + return "UCVTFWS" + case UDIV: + return "UDIV" + case UDIVW: + return "UDIVW" + case VBIT: + return "VBIT" + case VCNT: + return "VCNT" + case UADDLV: + return "UADDLV" + case VMOV: + return "VMOV" + case INSELEM: + return "INSELEM" + case UMOV: + return "UMOV" + case INSGEN: + return "INSGEN" + case VADD: + return "VADD" + case VFADDS: + return "VFADDS" + case VFADDD: + return "VFADDD" + case VSUB: + return "VSUB" + case VFSUBS: + return "VFSUBS" + case VFSUBD: + return "VFSUBD" + case SSHL: + return "SSHL" + case USHL: + return "USHL" + case SSHLL: + return "SSHLL" + case USHLL: + return "USHLL" + case LD1R: + return "LD1R" + case SMOV32: + return "SMOV32" + case DUPGEN: + return "DUPGEN" + case DUPELEM: + return "DUPELEM" + case UMAXP: + return "UMAXP" + case UMINV: + return "UMINV" + case CMEQ: + return "CMEQ" + case ADDP: + return "ADDP" + case VADDP: + return "VADDP" + case TBL1: + return "TBL1" + case TBL2: + return "TBL2" + case NOT: + return "NOT" + case VAND: + return "VAND" + case VORR: + return "VORR" + case BSL: + return "BSL" + case BIC: + return "BIC" + case VFNEG: + return "VFNEG" + case ADDV: + return "ADDV" + case CMEQZERO: + return "CMEQZERO" + case ZIP1: + return "ZIP1" + case SSHR: + return "SSHR" + case EXT: + return "EXT" + case CMGT: + return "CMGT" + case CMHI: + return "CMHI" + case CMGE: + return "CMGE" + case CMHS: + return "CMHS" + case FCMEQ: + return "FCMEQ" + case FCMGT: + return "FCMGT" + case FCMGE: + return "FCMGE" + case VFMUL: + return "VFMUL" + case VFDIV: + return "VFDIV" + case VFSQRT: + return "VFSQRT" + case VFMIN: + return "VFMIN" + case VFMAX: + return "VFMAX" + case VFABS: + return "VFABS" + case VFRINTP: + return "VFRINTP" + case VFRINTM: + return "VFRINTM" + case VFRINTZ: + return "VFRINTZ" + case VFRINTN: + return "VFRINTN" + case VMUL: + return "VMUL" + case VNEG: + return "VNEG" + case VABS: + return "VABS" + case VSQADD: + return "VSQADD" + case VUQADD: + return "VUQADD" + case SMIN: + return "SMIN" + case SMAX: + return "SMAX" + case UMIN: + return "UMIN" + case UMAX: + return "UMAX" + case URHADD: + return "URHADD" + case VSQSUB: + return "VSQSUB" + case VUQSUB: + return "VUQSUB" + case REV64: + return "REV64" + case XTN: + return "XTN" + case VUMLAL: + return "VUMLAL" + case SHLL: + return "SHLL" + case SSHLL2: + return "SSHLL2" + case USHLL2: + return "USHLL2" + case SQRDMULH: + return "SQRDMULH" + case SADDLP: + return "SADDLP" + case UADDLP: + return "UADDLP" + case SMULL: + return "SMULL" + case SMULL2: + return "SMULL2" + case UMULL: + return "UMULL" + case UMULL2: + return "UMULL2" + case VFCVTZS: + return "VFCVTZS" + case VFCVTZU: + return "VFCVTZU" + case SQXTN: + return "SQXTN" + case UQXTN: + return "UQXTN" + case SQXTN2: + return "SQXTN2" + case SQXTUN: + return "SQXTUN" + case SQXTUN2: + return "SQXTUN2" + case VSCVTF: + return "VSCVTF" + case VUCVTF: + return "VUCVTF" + case FCVTL: + return "FCVTL" + case FCVTN: + return "FCVTN" + case FSTRD: + return "FSTRD" + case FSTRS: + return "FSTRS" + case LDRD: + return "LDRD" + case LDRW: + return "LDRW" + case FLDRD: + return "FLDRD" + case FLDRS: + return "FLDRS" + case UDF: + return "UDF" + } + panic(fmt.Errorf("unknown instruction %d", i)) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/asm/arm64/impl.go b/vendor/github.com/tetratelabs/wazero/internal/asm/arm64/impl.go new file mode 100644 index 000000000..00bc0d995 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/asm/arm64/impl.go @@ -0,0 +1,3900 @@ +package arm64 + +import ( + "encoding/binary" + "errors" + "fmt" + + "github.com/tetratelabs/wazero/internal/asm" +) + +type nodeImpl struct { + // jumpTarget holds the target node in the linked for the jump-kind instruction. + jumpTarget *nodeImpl + // next holds the next node from this node in the assembled linked list. + next *nodeImpl + staticConst *asm.StaticConst + + instruction asm.Instruction + types operandTypes + srcReg, srcReg2, dstReg, dstReg2 asm.Register + srcConst, dstConst asm.ConstantValue + + offsetInBinary asm.NodeOffsetInBinary + + // readInstructionAddressBeforeTargetInstruction holds the instruction right before the target of + // read instruction address instruction. See asm.assemblerBase.CompileReadInstructionAddress. + readInstructionAddressBeforeTargetInstruction asm.Instruction + + vectorArrangement VectorArrangement + srcVectorIndex, dstVectorIndex VectorIndex +} + +// AssignJumpTarget implements the same method as documented on asm.Node. +func (n *nodeImpl) AssignJumpTarget(target asm.Node) { + n.jumpTarget = target.(*nodeImpl) +} + +// AssignDestinationConstant implements the same method as documented on asm.Node. +func (n *nodeImpl) AssignDestinationConstant(value asm.ConstantValue) { + n.dstConst = value +} + +// AssignSourceConstant implements the same method as documented on asm.Node. +func (n *nodeImpl) AssignSourceConstant(value asm.ConstantValue) { + n.srcConst = value +} + +// OffsetInBinary implements the same method as documented on asm.Node. +func (n *nodeImpl) OffsetInBinary() asm.NodeOffsetInBinary { + return n.offsetInBinary +} + +// String implements fmt.Stringer. +// +// This is for debugging purpose, and the format is similar to the AT&T assembly syntax, +// meaning that this should look like "INSTRUCTION ${from}, ${to}" where each operand +// might be embraced by '[]' to represent the memory location, and multiple operands +// are embraced by `()`. +func (n *nodeImpl) String() (ret string) { + instName := InstructionName(n.instruction) + switch n.types { + case operandTypesNoneToNone: + ret = instName + case operandTypesNoneToRegister: + ret = fmt.Sprintf("%s %s", instName, RegisterName(n.dstReg)) + case operandTypesNoneToBranch: + ret = fmt.Sprintf("%s {%v}", instName, n.jumpTarget) + case operandTypesRegisterToRegister: + ret = fmt.Sprintf("%s %s, %s", instName, RegisterName(n.srcReg), RegisterName(n.dstReg)) + case operandTypesLeftShiftedRegisterToRegister: + ret = fmt.Sprintf("%s (%s, %s << %d), %s", instName, RegisterName(n.srcReg), RegisterName(n.srcReg2), n.srcConst, RegisterName(n.dstReg)) + case operandTypesTwoRegistersToRegister: + ret = fmt.Sprintf("%s (%s, %s), %s", instName, RegisterName(n.srcReg), RegisterName(n.srcReg2), RegisterName(n.dstReg)) + case operandTypesThreeRegistersToRegister: + ret = fmt.Sprintf("%s (%s, %s, %s), %s)", instName, RegisterName(n.srcReg), RegisterName(n.srcReg2), RegisterName(n.dstReg), RegisterName(n.dstReg2)) + case operandTypesTwoRegistersToNone: + ret = fmt.Sprintf("%s (%s, %s)", instName, RegisterName(n.srcReg), RegisterName(n.srcReg2)) + case operandTypesRegisterAndConstToNone: + ret = fmt.Sprintf("%s (%s, 0x%x)", instName, RegisterName(n.srcReg), n.srcConst) + case operandTypesRegisterAndConstToRegister: + ret = fmt.Sprintf("%s (%s, 0x%x), %s", instName, RegisterName(n.srcReg), n.srcConst, RegisterName(n.dstReg)) + case operandTypesRegisterToMemory: + if n.dstReg2 != asm.NilRegister { + ret = fmt.Sprintf("%s %s, [%s + %s]", instName, RegisterName(n.srcReg), RegisterName(n.dstReg), RegisterName(n.dstReg2)) + } else { + ret = fmt.Sprintf("%s %s, [%s + 0x%x]", instName, RegisterName(n.srcReg), RegisterName(n.dstReg), n.dstConst) + } + case operandTypesMemoryToRegister: + if n.srcReg2 != asm.NilRegister { + ret = fmt.Sprintf("%s [%s + %s], %s", instName, RegisterName(n.srcReg), RegisterName(n.srcReg2), RegisterName(n.dstReg)) + } else { + ret = fmt.Sprintf("%s [%s + 0x%x], %s", instName, RegisterName(n.srcReg), n.srcConst, RegisterName(n.dstReg)) + } + case operandTypesConstToRegister: + ret = fmt.Sprintf("%s 0x%x, %s", instName, n.srcConst, RegisterName(n.dstReg)) + case operandTypesRegisterToVectorRegister: + ret = fmt.Sprintf("%s %s, %s.%s[%d]", instName, RegisterName(n.srcReg), RegisterName(n.dstReg), n.vectorArrangement, n.dstVectorIndex) + case operandTypesVectorRegisterToRegister: + ret = fmt.Sprintf("%s %s.%s[%d], %s", instName, RegisterName(n.srcReg), n.vectorArrangement, n.srcVectorIndex, RegisterName(n.dstReg)) + case operandTypesVectorRegisterToMemory: + if n.dstReg2 != asm.NilRegister { + ret = fmt.Sprintf("%s %s.%s, [%s + %s]", instName, RegisterName(n.srcReg), n.vectorArrangement, RegisterName(n.dstReg), RegisterName(n.dstReg2)) + } else { + ret = fmt.Sprintf("%s %s.%s, [%s + 0x%x]", instName, RegisterName(n.srcReg), n.vectorArrangement, RegisterName(n.dstReg), n.dstConst) + } + case operandTypesMemoryToVectorRegister: + ret = fmt.Sprintf("%s [%s], %s.%s", instName, RegisterName(n.srcReg), RegisterName(n.dstReg), n.vectorArrangement) + case operandTypesVectorRegisterToVectorRegister: + ret = fmt.Sprintf("%s %[2]s.%[4]s, %[3]s.%[4]s", instName, RegisterName(n.srcReg), RegisterName(n.dstReg), n.vectorArrangement) + case operandTypesStaticConstToVectorRegister: + ret = fmt.Sprintf("%s $%#x %s.%s", instName, n.staticConst.Raw, RegisterName(n.dstReg), n.vectorArrangement) + case operandTypesTwoVectorRegistersToVectorRegister: + ret = fmt.Sprintf("%s (%s.%[5]s, %[3]s.%[5]s), %[4]s.%[5]s", instName, RegisterName(n.srcReg), RegisterName(n.srcReg2), RegisterName(n.dstReg), n.vectorArrangement) + } + return +} + +// operandTypes represents types of operands of a node. +type operandTypes byte + +const ( + operandTypesNoneToNone operandTypes = iota + operandTypesNoneToRegister + operandTypesNoneToBranch + operandTypesRegisterToRegister + operandTypesLeftShiftedRegisterToRegister + operandTypesTwoRegistersToRegister + operandTypesThreeRegistersToRegister + operandTypesTwoRegistersToNone + operandTypesRegisterAndConstToNone + operandTypesRegisterAndConstToRegister + operandTypesRegisterToMemory + operandTypesMemoryToRegister + operandTypesConstToRegister + operandTypesRegisterToVectorRegister + operandTypesVectorRegisterToRegister + operandTypesMemoryToVectorRegister + operandTypesVectorRegisterToMemory + operandTypesVectorRegisterToVectorRegister + operandTypesTwoVectorRegistersToVectorRegister + operandTypesStaticConstToVectorRegister +) + +// String implements fmt.Stringer +func (o operandTypes) String() (ret string) { + switch o { + case operandTypesNoneToNone: + ret = "NoneToNone" + case operandTypesNoneToRegister: + ret = "NoneToRegister" + case operandTypesNoneToBranch: + ret = "NoneToBranch" + case operandTypesRegisterToRegister: + ret = "RegisterToRegister" + case operandTypesLeftShiftedRegisterToRegister: + ret = "LeftShiftedRegisterToRegister" + case operandTypesTwoRegistersToRegister: + ret = "TwoRegistersToRegister" + case operandTypesThreeRegistersToRegister: + ret = "ThreeRegistersToRegister" + case operandTypesTwoRegistersToNone: + ret = "TwoRegistersToNone" + case operandTypesRegisterAndConstToNone: + ret = "RegisterAndConstToNone" + case operandTypesRegisterAndConstToRegister: + ret = "RegisterAndConstToRegister" + case operandTypesRegisterToMemory: + ret = "RegisterToMemory" + case operandTypesMemoryToRegister: + ret = "MemoryToRegister" + case operandTypesConstToRegister: + ret = "ConstToRegister" + case operandTypesRegisterToVectorRegister: + ret = "RegisterToVectorRegister" + case operandTypesVectorRegisterToRegister: + ret = "VectorRegisterToRegister" + case operandTypesMemoryToVectorRegister: + ret = "MemoryToVectorRegister" + case operandTypesVectorRegisterToMemory: + ret = "VectorRegisterToMemory" + case operandTypesVectorRegisterToVectorRegister: + ret = "VectorRegisterToVectorRegister" + case operandTypesTwoVectorRegistersToVectorRegister: + ret = "TwoVectorRegistersToVectorRegister" + case operandTypesStaticConstToVectorRegister: + ret = "StaticConstToVectorRegister" + } + return +} + +const ( + maxSignedInt26 int64 = 1<<25 - 1 + minSignedInt26 int64 = -(1 << 25) + + maxSignedInt19 int64 = 1<<19 - 1 + minSignedInt19 int64 = -(1 << 19) +) + +// AssemblerImpl implements Assembler. +type AssemblerImpl struct { + root *nodeImpl + current *nodeImpl + asm.BaseAssemblerImpl + relativeJumpNodes []*nodeImpl + adrInstructionNodes []*nodeImpl + nodePool nodePool + pool asm.StaticConstPool + nodeCount int + + // MaxDisplacementForConstantPool is fixed to defaultMaxDisplacementForConstPool + // but have it as a field here for testability. + MaxDisplacementForConstantPool int + + temporaryRegister asm.Register +} + +const nodePageSize = 128 + +type nodePage = [nodePageSize]nodeImpl + +// nodePool is the central allocation pool for nodeImpl used by a single AssemblerImpl. +// This reduces the allocations over compilation by reusing AssemblerImpl. +type nodePool struct { + pages []*nodePage + index int +} + +// allocNode allocates a new nodeImpl for use from the pool. +// This expands the pool if there is no space left for it. +func (n *nodePool) allocNode() *nodeImpl { + if n.index == nodePageSize { + if len(n.pages) == cap(n.pages) { + n.pages = append(n.pages, new(nodePage)) + } else { + i := len(n.pages) + n.pages = n.pages[:i+1] + if n.pages[i] == nil { + n.pages[i] = new(nodePage) + } + } + n.index = 0 + } + ret := &n.pages[len(n.pages)-1][n.index] + n.index++ + return ret +} + +func (n *nodePool) reset() { + for _, ns := range n.pages { + pages := ns[:] + for i := range pages { + pages[i] = nodeImpl{} + } + } + n.pages = n.pages[:0] + n.index = nodePageSize +} + +func NewAssembler(temporaryRegister asm.Register) *AssemblerImpl { + return &AssemblerImpl{ + nodePool: nodePool{index: nodePageSize}, + temporaryRegister: temporaryRegister, + pool: asm.NewStaticConstPool(), + MaxDisplacementForConstantPool: defaultMaxDisplacementForConstPool, + } +} + +// AllocateNOP implements asm.AssemblerBase. +func (a *AssemblerImpl) AllocateNOP() asm.Node { + n := a.nodePool.allocNode() + n.instruction = NOP + n.types = operandTypesNoneToNone + return n +} + +// Add implements asm.AssemblerBase. +func (a *AssemblerImpl) Add(n asm.Node) { + a.addNode(n.(*nodeImpl)) +} + +// Reset implements asm.AssemblerBase. +func (a *AssemblerImpl) Reset() { + pool := a.pool + pool.Reset() + *a = AssemblerImpl{ + nodePool: a.nodePool, + pool: pool, + temporaryRegister: a.temporaryRegister, + adrInstructionNodes: a.adrInstructionNodes[:0], + relativeJumpNodes: a.relativeJumpNodes[:0], + BaseAssemblerImpl: asm.BaseAssemblerImpl{ + SetBranchTargetOnNextNodes: a.SetBranchTargetOnNextNodes[:0], + JumpTableEntries: a.JumpTableEntries[:0], + }, + } + a.nodePool.reset() +} + +// newNode creates a new Node and appends it into the linked list. +func (a *AssemblerImpl) newNode(instruction asm.Instruction, types operandTypes) *nodeImpl { + n := a.nodePool.allocNode() + n.instruction = instruction + n.types = types + + a.addNode(n) + return n +} + +// addNode appends the new node into the linked list. +func (a *AssemblerImpl) addNode(node *nodeImpl) { + a.nodeCount++ + + if a.root == nil { + a.root = node + a.current = node + } else { + parent := a.current + parent.next = node + a.current = node + } + + for _, o := range a.SetBranchTargetOnNextNodes { + origin := o.(*nodeImpl) + origin.jumpTarget = node + } + // Reuse the underlying slice to avoid re-allocations. + a.SetBranchTargetOnNextNodes = a.SetBranchTargetOnNextNodes[:0] +} + +// Assemble implements asm.AssemblerBase +func (a *AssemblerImpl) Assemble(buf asm.Buffer) error { + // arm64 has 32-bit fixed length instructions, + // but note that some nodes are encoded as multiple instructions, + // so the resulting binary might not be the size of count*8. + buf.Grow(a.nodeCount * 8) + + for n := a.root; n != nil; n = n.next { + n.offsetInBinary = uint64(buf.Len()) + if err := a.encodeNode(buf, n); err != nil { + return err + } + a.maybeFlushConstPool(buf, n.next == nil) + } + + code := buf.Bytes() + + if err := a.FinalizeJumpTableEntry(code); err != nil { + return err + } + + for _, rel := range a.relativeJumpNodes { + if err := a.relativeBranchFinalize(code, rel); err != nil { + return err + } + } + + for _, adr := range a.adrInstructionNodes { + if err := a.finalizeADRInstructionNode(code, adr); err != nil { + return err + } + } + return nil +} + +const defaultMaxDisplacementForConstPool = (1 << 20) - 1 - 4 // -4 for unconditional branch to skip the constants. + +// maybeFlushConstPool flushes the constant pool if endOfBinary or a boundary condition was met. +func (a *AssemblerImpl) maybeFlushConstPool(buf asm.Buffer, endOfBinary bool) { + if a.pool.Empty() { + return + } + + // If endOfBinary = true, we no longer need to emit the instructions, therefore + // flush all the constants. + if endOfBinary || + // Also, if the offset between the first usage of the constant pool and + // the first constant would exceed 2^20 -1(= 2MiB-1), which is the maximum offset + // for LDR(literal)/ADR instruction, flush all the constants in the pool. + (buf.Len()+a.pool.PoolSizeInBytes-int(a.pool.FirstUseOffsetInBinary)) >= a.MaxDisplacementForConstantPool { + + // Before emitting consts, we have to add br instruction to skip the const pool. + // https://github.com/golang/go/blob/release-branch.go1.15/src/cmd/internal/obj/arm64/asm7.go#L1123-L1129 + skipOffset := a.pool.PoolSizeInBytes/4 + 1 + if a.pool.PoolSizeInBytes%4 != 0 { + skipOffset++ + } + if endOfBinary { + // If this is the end of binary, we never reach this block, + // so offset can be zero (which is the behavior of Go's assembler). + skipOffset = 0 + } + + buf.Append4Bytes( + byte(skipOffset), + byte(skipOffset>>8), + byte(skipOffset>>16), + 0x14, + ) + + // Then adding the consts into the binary. + for _, c := range a.pool.Consts { + c.SetOffsetInBinary(uint64(buf.Len())) + buf.AppendBytes(c.Raw) + } + + // arm64 instructions are 4-byte (32-bit) aligned, so we must pad the zero consts here. + if pad := buf.Len() % 4; pad != 0 { + buf.AppendBytes(make([]byte, 4-pad)) + } + + // After the flush, reset the constant pool. + a.pool.Reset() + } +} + +// encodeNode encodes the given node into writer. +func (a *AssemblerImpl) encodeNode(buf asm.Buffer, n *nodeImpl) (err error) { + switch n.types { + case operandTypesNoneToNone: + err = a.encodeNoneToNone(buf, n) + case operandTypesNoneToRegister: + err = a.encodeJumpToRegister(buf, n) + case operandTypesNoneToBranch: + err = a.encodeRelativeBranch(buf, n) + case operandTypesRegisterToRegister: + err = a.encodeRegisterToRegister(buf, n) + case operandTypesLeftShiftedRegisterToRegister: + err = a.encodeLeftShiftedRegisterToRegister(buf, n) + case operandTypesTwoRegistersToRegister: + err = a.encodeTwoRegistersToRegister(buf, n) + case operandTypesThreeRegistersToRegister: + err = a.encodeThreeRegistersToRegister(buf, n) + case operandTypesTwoRegistersToNone: + err = a.encodeTwoRegistersToNone(buf, n) + case operandTypesRegisterAndConstToNone: + err = a.encodeRegisterAndConstToNone(buf, n) + case operandTypesRegisterToMemory: + err = a.encodeRegisterToMemory(buf, n) + case operandTypesMemoryToRegister: + err = a.encodeMemoryToRegister(buf, n) + case operandTypesRegisterAndConstToRegister, operandTypesConstToRegister: + err = a.encodeConstToRegister(buf, n) + case operandTypesRegisterToVectorRegister: + err = a.encodeRegisterToVectorRegister(buf, n) + case operandTypesVectorRegisterToRegister: + err = a.encodeVectorRegisterToRegister(buf, n) + case operandTypesMemoryToVectorRegister: + err = a.encodeMemoryToVectorRegister(buf, n) + case operandTypesVectorRegisterToMemory: + err = a.encodeVectorRegisterToMemory(buf, n) + case operandTypesVectorRegisterToVectorRegister: + err = a.encodeVectorRegisterToVectorRegister(buf, n) + case operandTypesStaticConstToVectorRegister: + err = a.encodeStaticConstToVectorRegister(buf, n) + case operandTypesTwoVectorRegistersToVectorRegister: + err = a.encodeTwoVectorRegistersToVectorRegister(buf, n) + default: + err = fmt.Errorf("encoder undefined for [%s] operand type", n.types) + } + if err != nil { + err = fmt.Errorf("%w: %s", err, n) // Ensure the error is debuggable by including the string value of the node. + } + return +} + +// CompileStandAlone implements the same method as documented on asm.AssemblerBase. +func (a *AssemblerImpl) CompileStandAlone(instruction asm.Instruction) asm.Node { + return a.newNode(instruction, operandTypesNoneToNone) +} + +// CompileConstToRegister implements the same method as documented on asm.AssemblerBase. +func (a *AssemblerImpl) CompileConstToRegister( + instruction asm.Instruction, + value asm.ConstantValue, + destinationReg asm.Register, +) (inst asm.Node) { + n := a.newNode(instruction, operandTypesConstToRegister) + n.srcConst = value + n.dstReg = destinationReg + return n +} + +// CompileRegisterToRegister implements the same method as documented on asm.AssemblerBase. +func (a *AssemblerImpl) CompileRegisterToRegister(instruction asm.Instruction, from, to asm.Register) { + n := a.newNode(instruction, operandTypesRegisterToRegister) + n.srcReg = from + n.dstReg = to +} + +// CompileMemoryToRegister implements the same method as documented on asm.AssemblerBase. +func (a *AssemblerImpl) CompileMemoryToRegister( + instruction asm.Instruction, + sourceBaseReg asm.Register, + sourceOffsetConst asm.ConstantValue, + destinationReg asm.Register, +) { + n := a.newNode(instruction, operandTypesMemoryToRegister) + n.srcReg = sourceBaseReg + n.srcConst = sourceOffsetConst + n.dstReg = destinationReg +} + +// CompileRegisterToMemory implements the same method as documented on asm.AssemblerBase. +func (a *AssemblerImpl) CompileRegisterToMemory( + instruction asm.Instruction, + sourceRegister, destinationBaseRegister asm.Register, + destinationOffsetConst asm.ConstantValue, +) { + n := a.newNode(instruction, operandTypesRegisterToMemory) + n.srcReg = sourceRegister + n.dstReg = destinationBaseRegister + n.dstConst = destinationOffsetConst +} + +// CompileJump implements the same method as documented on asm.AssemblerBase. +func (a *AssemblerImpl) CompileJump(jmpInstruction asm.Instruction) asm.Node { + return a.newNode(jmpInstruction, operandTypesNoneToBranch) +} + +// CompileJumpToRegister implements the same method as documented on asm.AssemblerBase. +func (a *AssemblerImpl) CompileJumpToRegister(jmpInstruction asm.Instruction, reg asm.Register) { + n := a.newNode(jmpInstruction, operandTypesNoneToRegister) + n.dstReg = reg +} + +// CompileReadInstructionAddress implements the same method as documented on asm.AssemblerBase. +func (a *AssemblerImpl) CompileReadInstructionAddress( + destinationRegister asm.Register, + beforeAcquisitionTargetInstruction asm.Instruction, +) { + n := a.newNode(ADR, operandTypesMemoryToRegister) + n.dstReg = destinationRegister + n.readInstructionAddressBeforeTargetInstruction = beforeAcquisitionTargetInstruction +} + +// CompileMemoryWithRegisterOffsetToRegister implements Assembler.CompileMemoryWithRegisterOffsetToRegister +func (a *AssemblerImpl) CompileMemoryWithRegisterOffsetToRegister( + instruction asm.Instruction, + srcBaseReg, srcOffsetReg, dstReg asm.Register, +) { + n := a.newNode(instruction, operandTypesMemoryToRegister) + n.dstReg = dstReg + n.srcReg = srcBaseReg + n.srcReg2 = srcOffsetReg +} + +// CompileRegisterToMemoryWithRegisterOffset implements Assembler.CompileRegisterToMemoryWithRegisterOffset +func (a *AssemblerImpl) CompileRegisterToMemoryWithRegisterOffset( + instruction asm.Instruction, + srcReg, dstBaseReg, dstOffsetReg asm.Register, +) { + n := a.newNode(instruction, operandTypesRegisterToMemory) + n.srcReg = srcReg + n.dstReg = dstBaseReg + n.dstReg2 = dstOffsetReg +} + +// CompileTwoRegistersToRegister implements Assembler.CompileTwoRegistersToRegister +func (a *AssemblerImpl) CompileTwoRegistersToRegister(instruction asm.Instruction, src1, src2, dst asm.Register) { + n := a.newNode(instruction, operandTypesTwoRegistersToRegister) + n.srcReg = src1 + n.srcReg2 = src2 + n.dstReg = dst +} + +// CompileThreeRegistersToRegister implements Assembler.CompileThreeRegistersToRegister +func (a *AssemblerImpl) CompileThreeRegistersToRegister( + instruction asm.Instruction, + src1, src2, src3, dst asm.Register, +) { + n := a.newNode(instruction, operandTypesThreeRegistersToRegister) + n.srcReg = src1 + n.srcReg2 = src2 + n.dstReg = src3 // To minimize the size of nodeImpl struct, we reuse dstReg for the third source operand. + n.dstReg2 = dst +} + +// CompileTwoRegistersToNone implements Assembler.CompileTwoRegistersToNone +func (a *AssemblerImpl) CompileTwoRegistersToNone(instruction asm.Instruction, src1, src2 asm.Register) { + n := a.newNode(instruction, operandTypesTwoRegistersToNone) + n.srcReg = src1 + n.srcReg2 = src2 +} + +// CompileRegisterAndConstToNone implements Assembler.CompileRegisterAndConstToNone +func (a *AssemblerImpl) CompileRegisterAndConstToNone( + instruction asm.Instruction, + src asm.Register, + srcConst asm.ConstantValue, +) { + n := a.newNode(instruction, operandTypesRegisterAndConstToNone) + n.srcReg = src + n.srcConst = srcConst +} + +// CompileRegisterAndConstToRegister implements Assembler.CompileRegisterAndConstToRegister +func (a *AssemblerImpl) CompileRegisterAndConstToRegister( + instruction asm.Instruction, + src asm.Register, + srcConst asm.ConstantValue, + dst asm.Register, +) { + n := a.newNode(instruction, operandTypesRegisterAndConstToRegister) + n.srcReg = src + n.srcConst = srcConst + n.dstReg = dst +} + +// CompileLeftShiftedRegisterToRegister implements Assembler.CompileLeftShiftedRegisterToRegister +func (a *AssemblerImpl) CompileLeftShiftedRegisterToRegister( + instruction asm.Instruction, + shiftedSourceReg asm.Register, + shiftNum asm.ConstantValue, + srcReg, dstReg asm.Register, +) { + n := a.newNode(instruction, operandTypesLeftShiftedRegisterToRegister) + n.srcReg = srcReg + n.srcReg2 = shiftedSourceReg + n.srcConst = shiftNum + n.dstReg = dstReg +} + +// CompileConditionalRegisterSet implements Assembler.CompileConditionalRegisterSet +func (a *AssemblerImpl) CompileConditionalRegisterSet(cond asm.ConditionalRegisterState, dstReg asm.Register) { + n := a.newNode(CSET, operandTypesRegisterToRegister) + n.srcReg = conditionalRegisterStateToRegister(cond) + n.dstReg = dstReg +} + +// CompileMemoryToVectorRegister implements Assembler.CompileMemoryToVectorRegister +func (a *AssemblerImpl) CompileMemoryToVectorRegister( + instruction asm.Instruction, srcBaseReg asm.Register, dstOffset asm.ConstantValue, dstReg asm.Register, arrangement VectorArrangement, +) { + n := a.newNode(instruction, operandTypesMemoryToVectorRegister) + n.srcReg = srcBaseReg + n.srcConst = dstOffset + n.dstReg = dstReg + n.vectorArrangement = arrangement +} + +// CompileMemoryWithRegisterOffsetToVectorRegister implements Assembler.CompileMemoryWithRegisterOffsetToVectorRegister +func (a *AssemblerImpl) CompileMemoryWithRegisterOffsetToVectorRegister(instruction asm.Instruction, + srcBaseReg, srcOffsetRegister asm.Register, dstReg asm.Register, arrangement VectorArrangement, +) { + n := a.newNode(instruction, operandTypesMemoryToVectorRegister) + n.srcReg = srcBaseReg + n.srcReg2 = srcOffsetRegister + n.dstReg = dstReg + n.vectorArrangement = arrangement +} + +// CompileVectorRegisterToMemory implements Assembler.CompileVectorRegisterToMemory +func (a *AssemblerImpl) CompileVectorRegisterToMemory( + instruction asm.Instruction, srcReg, dstBaseReg asm.Register, dstOffset asm.ConstantValue, arrangement VectorArrangement, +) { + n := a.newNode(instruction, operandTypesVectorRegisterToMemory) + n.srcReg = srcReg + n.dstReg = dstBaseReg + n.dstConst = dstOffset + n.vectorArrangement = arrangement +} + +// CompileVectorRegisterToMemoryWithRegisterOffset implements Assembler.CompileVectorRegisterToMemoryWithRegisterOffset +func (a *AssemblerImpl) CompileVectorRegisterToMemoryWithRegisterOffset(instruction asm.Instruction, + srcReg, dstBaseReg, dstOffsetRegister asm.Register, arrangement VectorArrangement, +) { + n := a.newNode(instruction, operandTypesVectorRegisterToMemory) + n.srcReg = srcReg + n.dstReg = dstBaseReg + n.dstReg2 = dstOffsetRegister + n.vectorArrangement = arrangement +} + +// CompileRegisterToVectorRegister implements Assembler.CompileRegisterToVectorRegister +func (a *AssemblerImpl) CompileRegisterToVectorRegister( + instruction asm.Instruction, srcReg, dstReg asm.Register, arrangement VectorArrangement, index VectorIndex, +) { + n := a.newNode(instruction, operandTypesRegisterToVectorRegister) + n.srcReg = srcReg + n.dstReg = dstReg + n.vectorArrangement = arrangement + n.dstVectorIndex = index +} + +// CompileVectorRegisterToRegister implements Assembler.CompileVectorRegisterToRegister +func (a *AssemblerImpl) CompileVectorRegisterToRegister(instruction asm.Instruction, srcReg, dstReg asm.Register, + arrangement VectorArrangement, index VectorIndex, +) { + n := a.newNode(instruction, operandTypesVectorRegisterToRegister) + n.srcReg = srcReg + n.dstReg = dstReg + n.vectorArrangement = arrangement + n.srcVectorIndex = index +} + +// CompileVectorRegisterToVectorRegister implements Assembler.CompileVectorRegisterToVectorRegister +func (a *AssemblerImpl) CompileVectorRegisterToVectorRegister( + instruction asm.Instruction, srcReg, dstReg asm.Register, arrangement VectorArrangement, srcIndex, dstIndex VectorIndex, +) { + n := a.newNode(instruction, operandTypesVectorRegisterToVectorRegister) + n.srcReg = srcReg + n.dstReg = dstReg + n.vectorArrangement = arrangement + n.srcVectorIndex = srcIndex + n.dstVectorIndex = dstIndex +} + +// CompileVectorRegisterToVectorRegisterWithConst implements Assembler.CompileVectorRegisterToVectorRegisterWithConst +func (a *AssemblerImpl) CompileVectorRegisterToVectorRegisterWithConst(instruction asm.Instruction, + srcReg, dstReg asm.Register, arrangement VectorArrangement, c asm.ConstantValue, +) { + n := a.newNode(instruction, operandTypesVectorRegisterToVectorRegister) + n.srcReg = srcReg + n.srcConst = c + n.dstReg = dstReg + n.vectorArrangement = arrangement +} + +// CompileStaticConstToRegister implements Assembler.CompileStaticConstToVectorRegister +func (a *AssemblerImpl) CompileStaticConstToRegister(instruction asm.Instruction, c *asm.StaticConst, dstReg asm.Register) { + n := a.newNode(instruction, operandTypesMemoryToRegister) + n.staticConst = c + n.dstReg = dstReg +} + +// CompileStaticConstToVectorRegister implements Assembler.CompileStaticConstToVectorRegister +func (a *AssemblerImpl) CompileStaticConstToVectorRegister(instruction asm.Instruction, + c *asm.StaticConst, dstReg asm.Register, arrangement VectorArrangement, +) { + n := a.newNode(instruction, operandTypesStaticConstToVectorRegister) + n.staticConst = c + n.dstReg = dstReg + n.vectorArrangement = arrangement +} + +// CompileTwoVectorRegistersToVectorRegister implements Assembler.CompileTwoVectorRegistersToVectorRegister. +func (a *AssemblerImpl) CompileTwoVectorRegistersToVectorRegister(instruction asm.Instruction, srcReg, srcReg2, dstReg asm.Register, + arrangement VectorArrangement, +) { + n := a.newNode(instruction, operandTypesTwoVectorRegistersToVectorRegister) + n.srcReg = srcReg + n.srcReg2 = srcReg2 + n.dstReg = dstReg + n.vectorArrangement = arrangement +} + +// CompileTwoVectorRegistersToVectorRegisterWithConst implements Assembler.CompileTwoVectorRegistersToVectorRegisterWithConst. +func (a *AssemblerImpl) CompileTwoVectorRegistersToVectorRegisterWithConst(instruction asm.Instruction, + srcReg, srcReg2, dstReg asm.Register, arrangement VectorArrangement, c asm.ConstantValue, +) { + n := a.newNode(instruction, operandTypesTwoVectorRegistersToVectorRegister) + n.srcReg = srcReg + n.srcReg2 = srcReg2 + n.srcConst = c + n.dstReg = dstReg + n.vectorArrangement = arrangement +} + +func errorEncodingUnsupported(n *nodeImpl) error { + return fmt.Errorf("%s is unsupported for %s type", InstructionName(n.instruction), n.types) +} + +func (a *AssemblerImpl) encodeNoneToNone(buf asm.Buffer, n *nodeImpl) error { + switch n.instruction { + case UDF: + buf.Append4Bytes(0, 0, 0, 0) + return nil + case NOP: + return nil + default: + return errorEncodingUnsupported(n) + } +} + +func (a *AssemblerImpl) encodeJumpToRegister(buf asm.Buffer, n *nodeImpl) error { + // "Unconditional branch (register)" in https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Branches--Exception-Generating-and-System-instructions + var opc byte + switch n.instruction { + case RET: + opc = 0b0010 + case B: + opc = 0b0000 + default: + return errorEncodingUnsupported(n) + } + + regBits, err := intRegisterBits(n.dstReg) + if err != nil { + return fmt.Errorf("invalid destination register: %w", err) + } + + buf.Append4Bytes( + 0x00|(regBits<<5), + 0x00|(regBits>>3), + 0b000_11111|(opc<<5), + 0b1101011_0|(opc>>3), + ) + return err +} + +func (a *AssemblerImpl) relativeBranchFinalize(code []byte, n *nodeImpl) error { + var condBits byte + const condBitsUnconditional = 0xff // Indicates this is not conditional jump. + + // https://developer.arm.com/documentation/den0024/a/CHDEEABE + switch n.instruction { + case B: + condBits = condBitsUnconditional + case BCONDEQ: + condBits = 0b0000 + case BCONDGE: + condBits = 0b1010 + case BCONDGT: + condBits = 0b1100 + case BCONDHI: + condBits = 0b1000 + case BCONDHS: + condBits = 0b0010 + case BCONDLE: + condBits = 0b1101 + case BCONDLO: + condBits = 0b0011 + case BCONDLS: + condBits = 0b1001 + case BCONDLT: + condBits = 0b1011 + case BCONDMI: + condBits = 0b0100 + case BCONDPL: + condBits = 0b0101 + case BCONDNE: + condBits = 0b0001 + case BCONDVS: + condBits = 0b0110 + case BCONDVC: + condBits = 0b0111 + } + + branchInstOffset := int64(n.OffsetInBinary()) + offset := int64(n.jumpTarget.OffsetInBinary()) - branchInstOffset + if offset%4 != 0 { + return errors.New("BUG: relative jump offset must be 4 bytes aligned") + } + + branchInst := code[branchInstOffset : branchInstOffset+4] + if condBits == condBitsUnconditional { + imm26 := offset >> 2 // divide by 4. + if imm26 < minSignedInt26 || imm26 > maxSignedInt26 { + // In theory this could happen if a Wasm binary has a huge single label (more than 128MB for a single block), + // and in that case, we use load the offset into a register and do the register jump, but to avoid the complexity, + // we impose this limit for now as that would be *unlikely* happen in practice. + return fmt.Errorf("relative jump offset %d/4 must be within %d and %d", offset, minSignedInt26, maxSignedInt26) + } + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/B--Branch-?lang=en + branchInst[0] = byte(imm26) + branchInst[1] = byte(imm26 >> 8) + branchInst[2] = byte(imm26 >> 16) + branchInst[3] = (byte(imm26 >> 24 & 0b000000_11)) | 0b000101_00 + } else { + imm19 := offset >> 2 // divide by 4. + if imm19 < minSignedInt19 || imm19 > maxSignedInt19 { + // This should be a bug in our compiler as the conditional jumps are only used in the small offsets (~a few bytes), + // and if ever happens, compiler can be fixed. + return fmt.Errorf("BUG: relative jump offset %d/4(=%d) must be within %d and %d", offset, imm19, minSignedInt19, maxSignedInt19) + } + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/B-cond--Branch-conditionally-?lang=en + branchInst[0] = (byte(imm19<<5) & 0b111_0_0000) | condBits + branchInst[1] = byte(imm19 >> 3) + branchInst[2] = byte(imm19 >> 11) + branchInst[3] = 0b01010100 + } + return nil +} + +func (a *AssemblerImpl) encodeRelativeBranch(buf asm.Buffer, n *nodeImpl) error { + switch n.instruction { + case B, BCONDEQ, BCONDGE, BCONDGT, BCONDHI, BCONDHS, BCONDLE, BCONDLO, BCONDLS, BCONDLT, BCONDMI, BCONDNE, BCONDVS, BCONDVC, BCONDPL: + default: + return errorEncodingUnsupported(n) + } + + if n.jumpTarget == nil { + return fmt.Errorf("branch target must be set for %s", InstructionName(n.instruction)) + } + + // At this point, we don't yet know that target's branch, so emit the placeholder (4 bytes). + buf.Append4Bytes(0, 0, 0, 0) + a.relativeJumpNodes = append(a.relativeJumpNodes, n) + return nil +} + +func checkRegisterToRegisterType(src, dst asm.Register, requireSrcInt, requireDstInt bool) (err error) { + isSrcInt, isDstInt := isIntRegister(src), isIntRegister(dst) + if isSrcInt && !requireSrcInt { + err = fmt.Errorf("src requires float register but got %s", RegisterName(src)) + } else if !isSrcInt && requireSrcInt { + err = fmt.Errorf("src requires int register but got %s", RegisterName(src)) + } else if isDstInt && !requireDstInt { + err = fmt.Errorf("dst requires float register but got %s", RegisterName(dst)) + } else if !isDstInt && requireDstInt { + err = fmt.Errorf("dst requires int register but got %s", RegisterName(dst)) + } + return +} + +func (a *AssemblerImpl) encodeRegisterToRegister(buf asm.Buffer, n *nodeImpl) (err error) { + switch inst := n.instruction; inst { + case ADD, ADDW, SUB: + if err = checkRegisterToRegisterType(n.srcReg, n.dstReg, true, true); err != nil { + return + } + + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Register?lang=en#addsub_shift + var sfops byte + switch inst { + case ADD: + sfops = 0b100 + case ADDW: + case SUB: + sfops = 0b110 + } + + srcRegBits, dstRegBits := registerBits(n.srcReg), registerBits(n.dstReg) + buf.Append4Bytes( + (dstRegBits<<5)|dstRegBits, + dstRegBits>>3, + srcRegBits, + (sfops<<5)|0b01011, + ) + case CLZ, CLZW, RBIT, RBITW: + if err = checkRegisterToRegisterType(n.srcReg, n.dstReg, true, true); err != nil { + return + } + + var sf, opcode byte + switch inst { + case CLZ: + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/CLZ--Count-Leading-Zeros-?lang=en + sf, opcode = 0b1, 0b000_100 + case CLZW: + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/CLZ--Count-Leading-Zeros-?lang=en + sf, opcode = 0b0, 0b000_100 + case RBIT: + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/RBIT--Reverse-Bits-?lang=en + sf, opcode = 0b1, 0b000_000 + case RBITW: + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/RBIT--Reverse-Bits-?lang=en + sf, opcode = 0b0, 0b000_000 + } + if inst == CLZ { + sf = 1 + } + + srcRegBits, dstRegBits := registerBits(n.srcReg), registerBits(n.dstReg) + buf.Append4Bytes( + (srcRegBits<<5)|dstRegBits, + opcode<<2|(srcRegBits>>3), + 0b110_00000, + (sf<<7)|0b0_1011010, + ) + case CSET: + if !isConditionalRegister(n.srcReg) { + return fmt.Errorf("CSET requires conditional register but got %s", RegisterName(n.srcReg)) + } + + dstRegBits, err := intRegisterBits(n.dstReg) + if err != nil { + return err + } + + // CSET encodes the conditional bits with its least significant bit inverted. + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/CSET--Conditional-Set--an-alias-of-CSINC-?lang=en + // + // https://developer.arm.com/documentation/den0024/a/CHDEEABE + var conditionalBits byte + switch n.srcReg { + case RegCondEQ: + conditionalBits = 0b0001 + case RegCondNE: + conditionalBits = 0b0000 + case RegCondHS: + conditionalBits = 0b0011 + case RegCondLO: + conditionalBits = 0b0010 + case RegCondMI: + conditionalBits = 0b0101 + case RegCondPL: + conditionalBits = 0b0100 + case RegCondVS: + conditionalBits = 0b0111 + case RegCondVC: + conditionalBits = 0b0110 + case RegCondHI: + conditionalBits = 0b1001 + case RegCondLS: + conditionalBits = 0b1000 + case RegCondGE: + conditionalBits = 0b1011 + case RegCondLT: + conditionalBits = 0b1010 + case RegCondGT: + conditionalBits = 0b1101 + case RegCondLE: + conditionalBits = 0b1100 + case RegCondAL: + conditionalBits = 0b1111 + case RegCondNV: + conditionalBits = 0b1110 + } + + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/CSET--Conditional-Set--an-alias-of-CSINC-?lang=en + buf.Append4Bytes( + 0b111_00000|dstRegBits, + (conditionalBits<<4)|0b0000_0111, + 0b100_11111, + 0b10011010, + ) + + case FABSD, FABSS, FNEGD, FNEGS, FSQRTD, FSQRTS, FCVTSD, FCVTDS, FRINTMD, FRINTMS, + FRINTND, FRINTNS, FRINTPD, FRINTPS, FRINTZD, FRINTZS: + if err = checkRegisterToRegisterType(n.srcReg, n.dstReg, false, false); err != nil { + return + } + + srcRegBits, dstRegBits := registerBits(n.srcReg), registerBits(n.dstReg) + + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en#floatdp1 + var tp, opcode byte + switch inst { + case FABSD: + opcode, tp = 0b000001, 0b01 + case FABSS: + opcode, tp = 0b000001, 0b00 + case FNEGD: + opcode, tp = 0b000010, 0b01 + case FNEGS: + opcode, tp = 0b000010, 0b00 + case FSQRTD: + opcode, tp = 0b000011, 0b01 + case FSQRTS: + opcode, tp = 0b000011, 0b00 + case FCVTSD: + opcode, tp = 0b000101, 0b00 + case FCVTDS: + opcode, tp = 0b000100, 0b01 + case FRINTMD: + opcode, tp = 0b001010, 0b01 + case FRINTMS: + opcode, tp = 0b001010, 0b00 + case FRINTND: + opcode, tp = 0b001000, 0b01 + case FRINTNS: + opcode, tp = 0b001000, 0b00 + case FRINTPD: + opcode, tp = 0b001001, 0b01 + case FRINTPS: + opcode, tp = 0b001001, 0b00 + case FRINTZD: + opcode, tp = 0b001011, 0b01 + case FRINTZS: + opcode, tp = 0b001011, 0b00 + } + buf.Append4Bytes( + (srcRegBits<<5)|dstRegBits, + (opcode<<7)|0b0_10000_00|(srcRegBits>>3), + tp<<6|0b00_1_00000|opcode>>1, + 0b0_00_11110, + ) + + case FADDD, FADDS, FDIVS, FDIVD, FMAXD, FMAXS, FMIND, FMINS, FMULS, FMULD: + if err = checkRegisterToRegisterType(n.srcReg, n.dstReg, false, false); err != nil { + return + } + + srcRegBits, dstRegBits := registerBits(n.srcReg), registerBits(n.dstReg) + + // "Floating-point data-processing (2 source)" in + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en#floatdp1 + var tp, opcode byte + switch inst { + case FADDD: + opcode, tp = 0b0010, 0b01 + case FADDS: + opcode, tp = 0b0010, 0b00 + case FDIVD: + opcode, tp = 0b0001, 0b01 + case FDIVS: + opcode, tp = 0b0001, 0b00 + case FMAXD: + opcode, tp = 0b0100, 0b01 + case FMAXS: + opcode, tp = 0b0100, 0b00 + case FMIND: + opcode, tp = 0b0101, 0b01 + case FMINS: + opcode, tp = 0b0101, 0b00 + case FMULS: + opcode, tp = 0b0000, 0b00 + case FMULD: + opcode, tp = 0b0000, 0b01 + } + + buf.Append4Bytes( + (dstRegBits<<5)|dstRegBits, + opcode<<4|0b0000_10_00|(dstRegBits>>3), + tp<<6|0b00_1_00000|srcRegBits, + 0b0001_1110, + ) + + case FCVTZSD, FCVTZSDW, FCVTZSS, FCVTZSSW, FCVTZUD, FCVTZUDW, FCVTZUS, FCVTZUSW: + if err = checkRegisterToRegisterType(n.srcReg, n.dstReg, false, true); err != nil { + return + } + + srcRegBits, dstRegBits := registerBits(n.srcReg), registerBits(n.dstReg) + + // "Conversion between floating-point and integer" in + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en#floatdp1 + var sf, tp, opcode byte + switch inst { + case FCVTZSD: // Double to signed 64-bit + sf, tp, opcode = 0b1, 0b01, 0b000 + case FCVTZSDW: // Double to signed 32-bit. + sf, tp, opcode = 0b0, 0b01, 0b000 + case FCVTZSS: // Single to signed 64-bit. + sf, tp, opcode = 0b1, 0b00, 0b000 + case FCVTZSSW: // Single to signed 32-bit. + sf, tp, opcode = 0b0, 0b00, 0b000 + case FCVTZUD: // Double to unsigned 64-bit. + sf, tp, opcode = 0b1, 0b01, 0b001 + case FCVTZUDW: // Double to unsigned 32-bit. + sf, tp, opcode = 0b0, 0b01, 0b001 + case FCVTZUS: // Single to unsigned 64-bit. + sf, tp, opcode = 0b1, 0b00, 0b001 + case FCVTZUSW: // Single to unsigned 32-bit. + sf, tp, opcode = 0b0, 0b00, 0b001 + } + + buf.Append4Bytes( + (srcRegBits<<5)|dstRegBits, + 0|(srcRegBits>>3), + tp<<6|0b00_1_11_000|opcode, + sf<<7|0b0_0_0_11110, + ) + + case FMOVD, FMOVS: + isSrcInt, isDstInt := isIntRegister(n.srcReg), isIntRegister(n.dstReg) + if isSrcInt && isDstInt { + return errors.New("FMOV needs at least one of operands to be integer") + } + + srcRegBits, dstRegBits := registerBits(n.srcReg), registerBits(n.dstReg) + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FMOV--register---Floating-point-Move-register-without-conversion-?lang=en + if !isSrcInt && !isDstInt { // Float to float. + var tp byte + if inst == FMOVD { + tp = 0b01 + } + buf.Append4Bytes( + (srcRegBits<<5)|dstRegBits, + 0b0_10000_00|(srcRegBits>>3), + tp<<6|0b00_1_00000, + 0b000_11110, + ) + } else if isSrcInt && !isDstInt { // Int to float. + var tp, sf byte + if inst == FMOVD { + tp, sf = 0b01, 0b1 + } + buf.Append4Bytes( + (srcRegBits<<5)|dstRegBits, + srcRegBits>>3, + tp<<6|0b00_1_00_111, + sf<<7|0b0_00_11110, + ) + } else { // Float to int. + var tp, sf byte + if inst == FMOVD { + tp, sf = 0b01, 0b1 + } + buf.Append4Bytes( + (srcRegBits<<5)|dstRegBits, + srcRegBits>>3, + tp<<6|0b00_1_00_110, + sf<<7|0b0_00_11110, + ) + } + + case MOVD, MOVW: + if err = checkRegisterToRegisterType(n.srcReg, n.dstReg, true, true); err != nil { + return + } + srcRegBits, dstRegBits := registerBits(n.srcReg), registerBits(n.dstReg) + + if n.srcReg == RegSP || n.dstReg == RegSP { + // Moving between stack pointers. + // https://developer.arm.com/documentation/ddi0602/2021-12/Base-Instructions/MOV--to-from-SP---Move-between-register-and-stack-pointer--an-alias-of-ADD--immediate-- + buf.Append4Bytes( + (srcRegBits<<5)|dstRegBits, + srcRegBits>>3, + 0x0, + 0b1001_0001, + ) + return + } + + if n.srcReg == RegRZR && inst == MOVD { + // If this is 64-bit mov from zero register, then we encode this as MOVK. + // See "Move wide (immediate)" in + // https://developer.arm.com/documentation/ddi0602/2021-06/Index-by-Encoding/Data-Processing----Immediate + buf.Append4Bytes( + dstRegBits, + 0x0, + 0b1000_0000, + 0b1_10_10010, + ) + } else { + // MOV can be encoded as ORR (shifted register): "ORR Wd, WZR, Wm". + // https://developer.arm.com/documentation/100069/0609/A64-General-Instructions/MOV--register- + var sf byte + if inst == MOVD { + sf = 0b1 + } + buf.Append4Bytes( + (zeroRegisterBits<<5)|dstRegBits, + zeroRegisterBits>>3, + 0b000_00000|srcRegBits, + sf<<7|0b0_01_01010, + ) + } + + case MRS: + if n.srcReg != RegFPSR { + return fmt.Errorf("MRS has only support for FPSR register as a src but got %s", RegisterName(n.srcReg)) + } + + // For how to specify FPSR register, see "Accessing FPSR" in: + // https://developer.arm.com/documentation/ddi0595/2021-12/AArch64-Registers/FPSR--Floating-point-Status-Register?lang=en + dstRegBits := registerBits(n.dstReg) + buf.Append4Bytes( + 0b001<<5|dstRegBits, + 0b0100<<4|0b0100, + 0b0011_0000|0b11<<3|0b011, + 0b1101_0101, + ) + + case MSR: + if n.dstReg != RegFPSR { + return fmt.Errorf("MSR has only support for FPSR register as a dst but got %s", RegisterName(n.srcReg)) + } + + // For how to specify FPSR register, see "Accessing FPSR" in: + // https://developer.arm.com/documentation/ddi0595/2021-12/AArch64-Registers/FPSR--Floating-point-Status-Register?lang=en + srcRegBits := registerBits(n.srcReg) + buf.Append4Bytes( + 0b001<<5|srcRegBits, + 0b0100<<4|0b0100, + 0b0001_0000|0b11<<3|0b011, + 0b1101_0101, + ) + + case MUL, MULW: + // Multiplications are encoded as MADD (zero register, src, dst), dst = zero + (src * dst) = src * dst. + // See "Data-processing (3 source)" in + // https://developer.arm.com/documentation/ddi0602/2021-06/Index-by-Encoding/Data-Processing----Register?lang=en + if err = checkRegisterToRegisterType(n.srcReg, n.dstReg, true, true); err != nil { + return + } + + var sf byte + if inst == MUL { + sf = 0b1 + } + + srcRegBits, dstRegBits := registerBits(n.srcReg), registerBits(n.dstReg) + + buf.Append4Bytes( + dstRegBits<<5|dstRegBits, + zeroRegisterBits<<2|dstRegBits>>3, + srcRegBits, + sf<<7|0b11011, + ) + + case NEG, NEGW: + srcRegBits, dstRegBits := registerBits(n.srcReg), registerBits(n.dstReg) + + if err = checkRegisterToRegisterType(n.srcReg, n.dstReg, true, true); err != nil { + return + } + + // NEG is encoded as "SUB dst, XZR, src" = "dst = 0 - src" + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Register?lang=en#addsub_shift + var sf byte + if inst == NEG { + sf = 0b1 + } + + buf.Append4Bytes( + (zeroRegisterBits<<5)|dstRegBits, + zeroRegisterBits>>3, + srcRegBits, + sf<<7|0b0_10_00000|0b0_00_01011, + ) + + case SDIV, SDIVW, UDIV, UDIVW: + srcRegBits, dstRegBits := registerBits(n.srcReg), registerBits(n.dstReg) + + if err = checkRegisterToRegisterType(n.srcReg, n.dstReg, true, true); err != nil { + return + } + + // See "Data-processing (2 source)" in + // https://developer.arm.com/documentation/ddi0602/2021-06/Index-by-Encoding/Data-Processing----Register?lang=en + var sf, opcode byte + switch inst { + case SDIV: + sf, opcode = 0b1, 0b000011 + case SDIVW: + sf, opcode = 0b0, 0b000011 + case UDIV: + sf, opcode = 0b1, 0b000010 + case UDIVW: + sf, opcode = 0b0, 0b000010 + } + + buf.Append4Bytes( + (dstRegBits<<5)|dstRegBits, + opcode<<2|(dstRegBits>>3), + 0b110_00000|srcRegBits, + sf<<7|0b0_00_11010, + ) + + case SCVTFD, SCVTFWD, SCVTFS, SCVTFWS, UCVTFD, UCVTFS, UCVTFWD, UCVTFWS: + srcRegBits, dstRegBits := registerBits(n.srcReg), registerBits(n.dstReg) + + if err = checkRegisterToRegisterType(n.srcReg, n.dstReg, true, false); err != nil { + return + } + + // "Conversion between floating-point and integer" in + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en#floatdp1 + var sf, tp, opcode byte + switch inst { + case SCVTFD: // 64-bit integer to double + sf, tp, opcode = 0b1, 0b01, 0b010 + case SCVTFWD: // 32-bit integer to double + sf, tp, opcode = 0b0, 0b01, 0b010 + case SCVTFS: // 64-bit integer to single + sf, tp, opcode = 0b1, 0b00, 0b010 + case SCVTFWS: // 32-bit integer to single + sf, tp, opcode = 0b0, 0b00, 0b010 + case UCVTFD: // 64-bit to double + sf, tp, opcode = 0b1, 0b01, 0b011 + case UCVTFWD: // 32-bit to double + sf, tp, opcode = 0b0, 0b01, 0b011 + case UCVTFS: // 64-bit to single + sf, tp, opcode = 0b1, 0b00, 0b011 + case UCVTFWS: // 32-bit to single + sf, tp, opcode = 0b0, 0b00, 0b011 + } + + buf.Append4Bytes( + (srcRegBits<<5)|dstRegBits, + srcRegBits>>3, + tp<<6|0b00_1_00_000|opcode, + sf<<7|0b0_0_0_11110, + ) + + case SXTB, SXTBW, SXTH, SXTHW, SXTW: + if err = checkRegisterToRegisterType(n.srcReg, n.dstReg, true, true); err != nil { + return + } + + srcRegBits, dstRegBits := registerBits(n.srcReg), registerBits(n.dstReg) + if n.srcReg == RegRZR { + // If the source is zero register, we encode as MOV dst, zero. + var sf byte + if inst == MOVD { + sf = 0b1 + } + buf.Append4Bytes( + (zeroRegisterBits<<5)|dstRegBits, + zeroRegisterBits>>3, + 0b000_00000|srcRegBits, + sf<<7|0b0_01_01010, + ) + return + } + + // SXTB is encoded as "SBFM Wd, Wn, #0, #7" + // https://developer.arm.com/documentation/dui0801/g/A64-General-Instructions/SXTB + // SXTH is encoded as "SBFM Wd, Wn, #0, #15" + // https://developer.arm.com/documentation/dui0801/g/A64-General-Instructions/SXTH + // SXTW is encoded as "SBFM Xd, Xn, #0, #31" + // https://developer.arm.com/documentation/dui0802/b/A64-General-Instructions/SXTW + + var n, sf, imms, opc byte + switch inst { + case SXTB: + n, sf, imms = 0b1, 0b1, 0x7 + case SXTBW: + n, sf, imms = 0b0, 0b0, 0x7 + case SXTH: + n, sf, imms = 0b1, 0b1, 0xf + case SXTHW: + n, sf, imms = 0b0, 0b0, 0xf + case SXTW: + n, sf, imms = 0b1, 0b1, 0x1f + } + + buf.Append4Bytes( + (srcRegBits<<5)|dstRegBits, + imms<<2|(srcRegBits>>3), + n<<6, + sf<<7|opc<<5|0b10011, + ) + default: + return errorEncodingUnsupported(n) + } + return +} + +func (a *AssemblerImpl) encodeLeftShiftedRegisterToRegister(buf asm.Buffer, n *nodeImpl) error { + baseRegBits, err := intRegisterBits(n.srcReg) + if err != nil { + return err + } + shiftTargetRegBits, err := intRegisterBits(n.srcReg2) + if err != nil { + return err + } + dstRegBits, err := intRegisterBits(n.dstReg) + if err != nil { + return err + } + + switch n.instruction { + case ADD: + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Register?lang=en#addsub_shift + const logicalLeftShiftBits = 0b00 + if n.srcConst < 0 || n.srcConst > 64 { + return fmt.Errorf("shift amount must fit in unsigned 6-bit integer (0-64) but got %d", n.srcConst) + } + shiftByte := byte(n.srcConst) + buf.Append4Bytes( + (baseRegBits<<5)|dstRegBits, + (shiftByte<<2)|(baseRegBits>>3), + (logicalLeftShiftBits<<6)|shiftTargetRegBits, + 0b1000_1011, + ) + return err + default: + return errorEncodingUnsupported(n) + } +} + +func (a *AssemblerImpl) encodeTwoRegistersToRegister(buf asm.Buffer, n *nodeImpl) (err error) { + switch inst := n.instruction; inst { + case AND, ANDW, ORR, ORRW, EOR, EORW: + // See "Logical (shifted register)" in + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Register?lang=en + srcRegBits, srcReg2Bits, dstRegBits := registerBits(n.srcReg), registerBits(n.srcReg2), registerBits(n.dstReg) + var sf, opc byte + switch inst { + case AND: + sf, opc = 0b1, 0b00 + case ANDW: + sf, opc = 0b0, 0b00 + case ORR: + sf, opc = 0b1, 0b01 + case ORRW: + sf, opc = 0b0, 0b01 + case EOR: + sf, opc = 0b1, 0b10 + case EORW: + sf, opc = 0b0, 0b10 + } + buf.Append4Bytes( + (srcReg2Bits<<5)|dstRegBits, + srcReg2Bits>>3, + srcRegBits, + sf<<7|opc<<5|0b01010, + ) + case ASR, ASRW, LSL, LSLW, LSR, LSRW, ROR, RORW: + // See "Data-processing (2 source)" in + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Register?lang=en + srcRegBits, srcReg2Bits, dstRegBits := registerBits(n.srcReg), registerBits(n.srcReg2), registerBits(n.dstReg) + + var sf, opcode byte + switch inst { + case ASR: + sf, opcode = 0b1, 0b001010 + case ASRW: + sf, opcode = 0b0, 0b001010 + case LSL: + sf, opcode = 0b1, 0b001000 + case LSLW: + sf, opcode = 0b0, 0b001000 + case LSR: + sf, opcode = 0b1, 0b001001 + case LSRW: + sf, opcode = 0b0, 0b001001 + case ROR: + sf, opcode = 0b1, 0b001011 + case RORW: + sf, opcode = 0b0, 0b001011 + } + buf.Append4Bytes( + (srcReg2Bits<<5)|dstRegBits, + opcode<<2|(srcReg2Bits>>3), + 0b110_00000|srcRegBits, + sf<<7|0b0_00_11010, + ) + case SDIV, SDIVW, UDIV, UDIVW: + srcRegBits, srcReg2Bits, dstRegBits := registerBits(n.srcReg), registerBits(n.srcReg2), registerBits(n.dstReg) + + // See "Data-processing (2 source)" in + // https://developer.arm.com/documentation/ddi0602/2021-06/Index-by-Encoding/Data-Processing----Register?lang=en + var sf, opcode byte + switch inst { + case SDIV: + sf, opcode = 0b1, 0b000011 + case SDIVW: + sf, opcode = 0b0, 0b000011 + case UDIV: + sf, opcode = 0b1, 0b000010 + case UDIVW: + sf, opcode = 0b0, 0b000010 + } + + buf.Append4Bytes( + (srcReg2Bits<<5)|dstRegBits, + opcode<<2|(srcReg2Bits>>3), + 0b110_00000|srcRegBits, + sf<<7|0b0_00_11010, + ) + case SUB, SUBW: + srcRegBits, srcReg2Bits, dstRegBits := registerBits(n.srcReg), registerBits(n.srcReg2), registerBits(n.dstReg) + + // See "Add/subtract (shifted register)" in + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Register?lang=en + var sf byte + if inst == SUB { + sf = 0b1 + } + + buf.Append4Bytes( + (srcReg2Bits<<5)|dstRegBits, + srcReg2Bits>>3, + srcRegBits, + sf<<7|0b0_10_01011, + ) + case FSUBD, FSUBS: + srcRegBits, srcReg2Bits, dstRegBits := registerBits(n.srcReg), registerBits(n.srcReg2), registerBits(n.dstReg) + + // See "Floating-point data-processing (2 source)" in + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en + var tp byte + if inst == FSUBD { + tp = 0b01 + } + buf.Append4Bytes( + (srcReg2Bits<<5)|dstRegBits, + 0b0011_10_00|(srcReg2Bits>>3), + tp<<6|0b00_1_00000|srcRegBits, + 0b0_00_11110, + ) + default: + return errorEncodingUnsupported(n) + } + return +} + +func (a *AssemblerImpl) encodeThreeRegistersToRegister(buf asm.Buffer, n *nodeImpl) error { + switch n.instruction { + case MSUB, MSUBW: + // Dst = Src2 - (Src1 * Src3) + // "Data-processing (3 source)" in: + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Register?lang=en + src1RegBits, err := intRegisterBits(n.srcReg) + if err != nil { + return err + } + src2RegBits, err := intRegisterBits(n.srcReg2) + if err != nil { + return err + } + src3RegBits, err := intRegisterBits(n.dstReg) + if err != nil { + return err + } + dstRegBits, err := intRegisterBits(n.dstReg2) + if err != nil { + return err + } + + var sf byte // is zero for MSUBW (32-bit MSUB). + if n.instruction == MSUB { + sf = 0b1 + } + + buf.Append4Bytes( + (src3RegBits<<5)|dstRegBits, + 0b1_0000000|(src2RegBits<<2)|(src3RegBits>>3), + src1RegBits, + sf<<7|0b00_11011, + ) + return nil + default: + return errorEncodingUnsupported(n) + } +} + +func (a *AssemblerImpl) encodeTwoRegistersToNone(buf asm.Buffer, n *nodeImpl) error { + switch n.instruction { + case CMPW, CMP: + // Compare on two registers is an alias for "SUBS (src1, src2) ZERO" + // which can be encoded as SUBS (shifted registers) with zero shifting. + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Register?lang=en#addsub_shift + src1RegBits, err := intRegisterBits(n.srcReg) + if err != nil { + return err + } + src2RegBits, err := intRegisterBits(n.srcReg2) + if err != nil { + return err + } + + var op byte + if n.instruction == CMP { + op = 0b111 + } else { + op = 0b011 + } + + buf.Append4Bytes( + (src2RegBits<<5)|zeroRegisterBits, + src2RegBits>>3, + src1RegBits, + 0b01011|(op<<5), + ) + return nil + case FCMPS, FCMPD: + // "Floating-point compare" section in: + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en + src1RegBits, err := vectorRegisterBits(n.srcReg) + if err != nil { + return err + } + src2RegBits, err := vectorRegisterBits(n.srcReg2) + if err != nil { + return err + } + + var ftype byte // is zero for FCMPS (single precision float compare). + if n.instruction == FCMPD { + ftype = 0b01 + } + buf.Append4Bytes( + src2RegBits<<5, + 0b001000_00|(src2RegBits>>3), + ftype<<6|0b1_00000|src1RegBits, + 0b000_11110, + ) + return nil + default: + return errorEncodingUnsupported(n) + } +} + +func (a *AssemblerImpl) encodeRegisterAndConstToNone(buf asm.Buffer, n *nodeImpl) error { + if n.instruction != CMP { + return errorEncodingUnsupported(n) + } + + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/CMP--immediate---Compare--immediate---an-alias-of-SUBS--immediate--?lang=en + if n.srcConst < 0 || n.srcConst > 4095 { + return fmt.Errorf("immediate for CMP must fit in 0 to 4095 but got %d", n.srcConst) + } else if n.srcReg == RegRZR { + return errors.New("zero register is not supported for CMP (immediate)") + } + + srcRegBits, err := intRegisterBits(n.srcReg) + if err != nil { + return err + } + + buf.Append4Bytes( + (srcRegBits<<5)|zeroRegisterBits, + (byte(n.srcConst)<<2)|(srcRegBits>>3), + byte(n.srcConst>>6), + 0b111_10001, + ) + return nil +} + +func fitInSigned9Bits(v int64) bool { + return v >= -256 && v <= 255 +} + +func (a *AssemblerImpl) encodeLoadOrStoreWithRegisterOffset( + buf asm.Buffer, baseRegBits, offsetRegBits, targetRegBits byte, opcode, size, v byte, +) { + // See "Load/store register (register offset)". + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Loads-and-Stores?lang=en#ldst_regoff + buf.Append4Bytes( + (baseRegBits<<5)|targetRegBits, + 0b011_010_00|(baseRegBits>>3), + opcode<<6|0b00_1_00000|offsetRegBits, + size<<6|v<<2|0b00_111_0_00, + ) +} + +// validateMemoryOffset validates the memory offset if the given offset can be encoded in the assembler. +// In theory, offset can be any, but for simplicity of our homemade assembler, we limit the offset range +// that can be encoded enough for supporting compiler. +func validateMemoryOffset(offset int64) error { + if offset > 255 && offset%4 != 0 { + // This is because we only have large offsets for load/store with Wasm value stack or reading type IDs, and its offset + // is always multiplied by 4 or 8 (== the size of uint32 or uint64 == the type of wasm.FunctionTypeID or value stack in Go) + return fmt.Errorf("large memory offset (>255) must be a multiple of 4 but got %d", offset) + } else if offset < -256 { // 9-bit signed integer's minimum = 2^8. + return fmt.Errorf("negative memory offset must be larget than or equal -256 but got %d", offset) + } else if offset > 1<<31-1 { + return fmt.Errorf("large memory offset must be less than %d but got %d", 1<<31-1, offset) + } else { + return nil + } +} + +// encodeLoadOrStoreWithConstOffset encodes load/store instructions with the constant offset. +// +// Note: Encoding strategy intentionally matches the Go assembler: https://go.dev/doc/asm +func (a *AssemblerImpl) encodeLoadOrStoreWithConstOffset( + buf asm.Buffer, + baseRegBits, targetRegBits byte, + offset int64, + opcode, size, v byte, + datasize, datasizeLog2 int64, +) (err error) { + if err = validateMemoryOffset(offset); err != nil { + return + } + + if fitInSigned9Bits(offset) { + // See "LDAPR/STLR (unscaled immediate)" + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Loads-and-Stores?lang=en#ldapstl_unscaled + if offset < 0 || offset%datasize != 0 { + // This case is encoded as one "unscaled signed store". + buf.Append4Bytes( + (baseRegBits<<5)|targetRegBits, + byte(offset<<4)|(baseRegBits>>3), + opcode<<6|(0b00_00_11111&byte(offset>>4)), + size<<6|v<<2|0b00_1_11_0_00, + ) + return + } + } + + // At this point we have the assumption that offset is positive. + // Plus if it is a multiple of datasize, then it can be encoded as a single "unsigned immediate". + if offset%datasize == 0 && + offset < (1<<12)<>3), + opcode<<6|0b00_111111&byte(m>>6), + size<<6|v<<2|0b00_1_11_0_01, + ) + return + } + + // Otherwise, we need multiple instructions. + tmpRegBits := registerBits(a.temporaryRegister) + offset32 := int32(offset) + + // Go's assembler adds a const into the const pool at this point, + // regardless of its usage; e.g. if we enter the then block of the following if statement, + // the const is not used but it is added into the const pool. + c := asm.NewStaticConst(make([]byte, 4)) + binary.LittleEndian.PutUint32(c.Raw, uint32(offset)) + a.pool.AddConst(c, uint64(buf.Len())) + + // https://github.com/golang/go/blob/release-branch.go1.15/src/cmd/internal/obj/arm64/asm7.go#L3529-L3532 + // If the offset is within 24-bits, we can load it with two ADD instructions. + hi := offset32 - (offset32 & (0xfff << uint(datasizeLog2))) + if hi&^0xfff000 == 0 { + var sfops byte = 0b100 + m := ((offset32 - hi) >> datasizeLog2) & 0xfff + hi >>= 12 + + // https://github.com/golang/go/blob/release-branch.go1.15/src/cmd/internal/obj/arm64/asm7.go#L3534-L3535 + buf.Append4Bytes( + (baseRegBits<<5)|tmpRegBits, + (byte(hi)<<2)|(baseRegBits>>3), + 0b01<<6 /* shift by 12 */ |byte(hi>>6), + sfops<<5|0b10001, + ) + + buf.Append4Bytes( + (tmpRegBits<<5)|targetRegBits, + (byte(m<<2))|(tmpRegBits>>3), + opcode<<6|0b00_111111&byte(m>>6), + size<<6|v<<2|0b00_1_11_0_01, + ) + } else { + // This case we load the const via ldr(literal) into tem register, + // and the target const is placed after this instruction below. + loadLiteralOffsetInBinary := uint64(buf.Len()) + + // First we emit the ldr(literal) with offset zero as we don't yet know the const's placement in the binary. + // https://developer.arm.com/documentation/ddi0596/2020-12/Base-Instructions/LDR--literal---Load-Register--literal-- + buf.Append4Bytes(tmpRegBits, 0x0, 0x0, 0b00_011_0_00) + + // Set the callback for the constant, and we set properly the offset in the callback. + + c.AddOffsetFinalizedCallback(func(offsetOfConst uint64) { + // ldr(literal) encodes offset divided by 4. + offset := (int(offsetOfConst) - int(loadLiteralOffsetInBinary)) / 4 + bin := buf.Bytes() + bin[loadLiteralOffsetInBinary] |= byte(offset << 5) + bin[loadLiteralOffsetInBinary+1] |= byte(offset >> 3) + bin[loadLiteralOffsetInBinary+2] |= byte(offset >> 11) + }) + + // Then, load the constant with the register offset. + // https://developer.arm.com/documentation/ddi0596/2020-12/Base-Instructions/LDR--register---Load-Register--register-- + buf.Append4Bytes( + (baseRegBits<<5)|targetRegBits, + 0b011_010_00|(baseRegBits>>3), + opcode<<6|0b00_1_00000|tmpRegBits, + size<<6|v<<2|0b00_111_0_00, + ) + } + return +} + +func (a *AssemblerImpl) encodeRegisterToMemory(buf asm.Buffer, n *nodeImpl) (err error) { + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Loads-and-Stores?lang=en#ldst_regoff + var ( + size, v byte + datasize, datasizeLog2 int64 + isTargetFloat bool + ) + switch n.instruction { + case STRD: + size, v, datasize, datasizeLog2 = 0b11, 0x0, 8, 3 + case STRW: + size, v, datasize, datasizeLog2 = 0b10, 0x0, 4, 2 + case STRH: + size, v, datasize, datasizeLog2 = 0b01, 0x0, 2, 1 + case STRB: + size, v, datasize, datasizeLog2 = 0b00, 0x0, 1, 0 + case FSTRD: + size, v, datasize, datasizeLog2, isTargetFloat = 0b11, 0x1, 8, 3, true + case FSTRS: + size, v, datasize, datasizeLog2, isTargetFloat = 0b10, 0x1, 4, 2, true + default: + return errorEncodingUnsupported(n) + } + + var srcRegBits byte + if isTargetFloat { + srcRegBits, err = vectorRegisterBits(n.srcReg) + } else { + srcRegBits, err = intRegisterBits(n.srcReg) + } + if err != nil { + return + } + + baseRegBits, err := intRegisterBits(n.dstReg) + if err != nil { + return err + } + + const opcode = 0x00 // opcode for store instructions. + if n.dstReg2 != asm.NilRegister { + offsetRegBits, err := intRegisterBits(n.dstReg2) + if err != nil { + return err + } + a.encodeLoadOrStoreWithRegisterOffset(buf, baseRegBits, offsetRegBits, srcRegBits, opcode, size, v) + } else { + err = a.encodeLoadOrStoreWithConstOffset(buf, baseRegBits, srcRegBits, n.dstConst, opcode, size, v, datasize, datasizeLog2) + } + return +} + +func (a *AssemblerImpl) encodeADR(buf asm.Buffer, n *nodeImpl) (err error) { + dstRegBits, err := intRegisterBits(n.dstReg) + if err != nil { + return err + } + + adrInstructionOffsetInBinary := uint64(buf.Len()) + + // At this point, we don't yet know the target offset to read from, + // so we emit the ADR instruction with 0 offset, and replace later in the callback. + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/ADR--Form-PC-relative-address-?lang=en + buf.Append4Bytes(dstRegBits, 0x0, 0x0, 0b10000) + + // This case, the ADR's target offset is for the staticConst's initial address. + if sc := n.staticConst; sc != nil { + a.pool.AddConst(sc, adrInstructionOffsetInBinary) + sc.AddOffsetFinalizedCallback(func(offsetOfConst uint64) { + adrInstructionBytes := buf.Bytes()[adrInstructionOffsetInBinary : adrInstructionOffsetInBinary+4] + offset := int(offsetOfConst) - int(adrInstructionOffsetInBinary) + + // See https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/ADR--Form-PC-relative-address-?lang=en + adrInstructionBytes[3] |= byte(offset & 0b00000011 << 5) + offset >>= 2 + adrInstructionBytes[0] |= byte(offset << 5) + offset >>= 3 + adrInstructionBytes[1] |= byte(offset) + offset >>= 8 + adrInstructionBytes[2] |= byte(offset) + }) + return + } else { + a.adrInstructionNodes = append(a.adrInstructionNodes, n) + } + return +} + +func (a *AssemblerImpl) finalizeADRInstructionNode(code []byte, n *nodeImpl) (err error) { + // Find the target instruction node. + targetNode := n + for ; targetNode != nil; targetNode = targetNode.next { + if targetNode.instruction == n.readInstructionAddressBeforeTargetInstruction { + targetNode = targetNode.next + break + } + } + + if targetNode == nil { + return fmt.Errorf("BUG: target instruction %s not found for ADR", InstructionName(n.readInstructionAddressBeforeTargetInstruction)) + } + + offset := targetNode.OffsetInBinary() - n.OffsetInBinary() + if i64 := int64(offset); i64 >= 1<<20 || i64 < -1<<20 { + // We could support offset over 20-bit range by special casing them here, + // but 20-bit range should be enough for our impl. If the necessity comes up, + // we could add the special casing here to support arbitrary large offset. + return fmt.Errorf("BUG: too large offset for ADR: %#x", offset) + } + + adrInstructionBytes := code[n.OffsetInBinary() : n.OffsetInBinary()+4] + // According to the binary format of ADR instruction: + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/ADR--Form-PC-relative-address-?lang=en + adrInstructionBytes[3] |= byte(offset & 0b00000011 << 5) + offset >>= 2 + adrInstructionBytes[0] |= byte(offset << 5) + offset >>= 3 + adrInstructionBytes[1] |= byte(offset) + offset >>= 8 + adrInstructionBytes[2] |= byte(offset) + return nil +} + +func (a *AssemblerImpl) encodeMemoryToRegister(buf asm.Buffer, n *nodeImpl) (err error) { + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Loads-and-Stores?lang=en#ldst_regoff + var ( + size, v, opcode byte + datasize, datasizeLog2 int64 + isTargetFloat bool + ) + switch n.instruction { + case ADR: + return a.encodeADR(buf, n) + case FLDRD: + size, v, datasize, datasizeLog2, opcode, isTargetFloat = 0b11, 0x1, 8, 3, 0b01, true + case FLDRS: + size, v, datasize, datasizeLog2, opcode, isTargetFloat = 0b10, 0x1, 4, 2, 0b01, true + case LDRD: + size, v, datasize, datasizeLog2, opcode = 0b11, 0x0, 8, 3, 0b01 + case LDRW: + size, v, datasize, datasizeLog2, opcode = 0b10, 0x0, 4, 2, 0b01 + case LDRSHD: + size, v, datasize, datasizeLog2, opcode = 0b01, 0x0, 2, 1, 0b10 + case LDRSHW: + size, v, datasize, datasizeLog2, opcode = 0b01, 0x0, 2, 1, 0b11 + case LDRH: + size, v, datasize, datasizeLog2, opcode = 0b01, 0x0, 2, 1, 0b01 + case LDRSBD: + size, v, datasize, datasizeLog2, opcode = 0b00, 0x0, 1, 0, 0b10 + case LDRSBW: + size, v, datasize, datasizeLog2, opcode = 0b00, 0x0, 1, 0, 0b11 + case LDRB: + size, v, datasize, datasizeLog2, opcode = 0b00, 0x0, 1, 0, 0b01 + case LDRSW: + size, v, datasize, datasizeLog2, opcode = 0b10, 0x0, 4, 2, 0b10 + default: + return errorEncodingUnsupported(n) + } + + var dstRegBits byte + if isTargetFloat { + dstRegBits, err = vectorRegisterBits(n.dstReg) + } else { + dstRegBits, err = intRegisterBits(n.dstReg) + } + if err != nil { + return + } + baseRegBits, err := intRegisterBits(n.srcReg) + if err != nil { + return err + } + + if n.srcReg2 != asm.NilRegister { + offsetRegBits, err := intRegisterBits(n.srcReg2) + if err != nil { + return err + } + a.encodeLoadOrStoreWithRegisterOffset(buf, baseRegBits, offsetRegBits, dstRegBits, opcode, + size, v) + } else { + err = a.encodeLoadOrStoreWithConstOffset(buf, baseRegBits, dstRegBits, n.srcConst, opcode, + size, v, datasize, datasizeLog2) + } + return +} + +// const16bitAligned check if the value is on the 16-bit alignment. +// If so, returns the shift num divided by 16, and otherwise -1. +func const16bitAligned(v int64) (ret int) { + ret = -1 + for s := 0; s < 64; s += 16 { + if (uint64(v) &^ (uint64(0xffff) << uint(s))) == 0 { + ret = s / 16 + break + } + } + return +} + +// isBitMaskImmediate determines if the value can be encoded as "bitmask immediate". +// +// Such an immediate is a 32-bit or 64-bit pattern viewed as a vector of identical elements of size e = 2, 4, 8, 16, 32, or 64 bits. +// Each element contains the same sub-pattern: a single run of 1 to e-1 non-zero bits, rotated by 0 to e-1 bits. +// +// See https://developer.arm.com/documentation/dui0802/b/A64-General-Instructions/MOV--bitmask-immediate- +func isBitMaskImmediate(x uint64) bool { + // All zeros and ones are not "bitmask immediate" by defainition. + if x == 0 || x == 0xffff_ffff_ffff_ffff { + return false + } + + switch { + case x != x>>32|x<<32: + // e = 64 + case x != x>>16|x<<48: + // e = 32 (x == x>>32|x<<32). + // e.g. 0x00ff_ff00_00ff_ff00 + x = uint64(int32(x)) + case x != x>>8|x<<56: + // e = 16 (x == x>>16|x<<48). + // e.g. 0x00ff_00ff_00ff_00ff + x = uint64(int16(x)) + case x != x>>4|x<<60: + // e = 8 (x == x>>8|x<<56). + // e.g. 0x0f0f_0f0f_0f0f_0f0f + x = uint64(int8(x)) + default: + // e = 4 or 2. + return true + } + return sequenceOfSetbits(x) || sequenceOfSetbits(^x) +} + +// sequenceOfSetbits returns true if the number's binary representation is the sequence set bit (1). +// For example: 0b1110 -> true, 0b1010 -> false +func sequenceOfSetbits(x uint64) bool { + y := getLowestBit(x) + // If x is a sequence of set bit, this should results in the number + // with only one set bit (i.e. power of two). + y += x + return (y-1)&y == 0 +} + +func getLowestBit(x uint64) uint64 { + // See https://stackoverflow.com/questions/12247186/find-the-lowest-set-bit + return x & (^x + 1) +} + +func (a *AssemblerImpl) addOrSub64BitRegisters(buf asm.Buffer, sfops byte, sp bool, dstRegBits, src1RegBits, src2RegBits byte) { + // src1Reg = src1Reg +/- src2Reg + if sp { + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/ADD--extended-register---Add--extended-register--?lang=en + buf.Append4Bytes( + (src1RegBits<<5)|dstRegBits, + 0b011<<5|src1RegBits>>3, + 1<<5|src2RegBits, + sfops<<5|0b01011, + ) + } else { + buf.Append4Bytes( + (src1RegBits<<5)|dstRegBits, + src1RegBits>>3, + src2RegBits, + sfops<<5|0b01011, + ) + } +} + +func bitmaskImmediate(c uint64, is64bit bool) (immr, imms, N byte) { + var size uint32 + switch { + case c != c>>32|c<<32: + size = 64 + case c != c>>16|c<<48: + size = 32 + c = uint64(int32(c)) + case c != c>>8|c<<56: + size = 16 + c = uint64(int16(c)) + case c != c>>4|c<<60: + size = 8 + c = uint64(int8(c)) + case c != c>>2|c<<62: + size = 4 + c = uint64(int64(c<<60) >> 60) + default: + size = 2 + c = uint64(int64(c<<62) >> 62) + } + + neg := false + if int64(c) < 0 { + c = ^c + neg = true + } + + onesSize, nonZeroPos := getOnesSequenceSize(c) + if neg { + nonZeroPos = onesSize + nonZeroPos + onesSize = size - onesSize + } + + var mode byte = 32 + if is64bit { + N, mode = 0b1, 64 + } + + immr = byte((size - nonZeroPos) & (size - 1) & uint32(mode-1)) + imms = byte((onesSize - 1) | 63&^(size<<1-1)) + return +} + +func (a *AssemblerImpl) encodeConstToRegister(buf asm.Buffer, n *nodeImpl) (err error) { + // Alias for readability. + c := n.srcConst + + dstRegBits, err := intRegisterBits(n.dstReg) + if err != nil { + return err + } + + // See "Logical (immediate)" in + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Immediate + switch n.instruction { + case ANDIMM32: + var sf, opc byte = 0b0, 0b00 + if !isBitMaskImmediate(uint64(c)) { + err = fmt.Errorf("const %d must be valid bitmask immediate for %s", c, InstructionName(ANDIMM64)) + return + } + immr, imms, N := bitmaskImmediate(uint64(c), false) + buf.Append4Bytes( + (dstRegBits<<5)|dstRegBits, + imms<<2|dstRegBits>>3, + N<<6|immr, + sf<<7|opc<<5|0b10010, + ) + return + case ANDIMM64: + var sf, opc byte = 0b1, 0b00 + if !isBitMaskImmediate(uint64(c)) { + err = fmt.Errorf("const %d must be valid bitmask immediate for %s", c, InstructionName(ANDIMM64)) + return + } + immr, imms, N := bitmaskImmediate(uint64(c), true) + buf.Append4Bytes( + (dstRegBits<<5)|dstRegBits, + imms<<2|dstRegBits>>3, + N<<6|immr, + sf<<7|opc<<5|0b10010, + ) + return + } + + switch inst := n.instruction; inst { + case ADD, ADDS, SUB, SUBS: + srcRegBits := dstRegBits + if n.srcReg != asm.NilRegister { + srcRegBits, err = intRegisterBits(n.srcReg) + if err != nil { + return err + } + } + + var sfops byte + if inst == ADD { + sfops = 0b100 + } else if inst == ADDS { + sfops = 0b101 + } else if inst == SUB { + sfops = 0b110 + } else if inst == SUBS { + sfops = 0b111 + } + + isSP := n.srcReg == RegSP || n.dstReg == RegSP + if c == 0 { + // If the constant equals zero, we encode it as ADD (register) with zero register. + a.addOrSub64BitRegisters(buf, sfops, isSP, dstRegBits, srcRegBits, zeroRegisterBits) + return + } + + if c >= 0 && (c <= 0xfff || (c&0xfff) == 0 && (uint64(c>>12) <= 0xfff)) { + // If the const can be represented as "imm12" or "imm12 << 12": one instruction + // https://github.com/golang/go/blob/release-branch.go1.15/src/cmd/internal/obj/arm64/asm7.go#L2992 + + if c <= 0xfff { + buf.Append4Bytes( + (srcRegBits<<5)|dstRegBits, + (byte(c)<<2)|(srcRegBits>>3), + byte(c>>6), + sfops<<5|0b10001, + ) + } else { + c >>= 12 + buf.Append4Bytes( + (srcRegBits<<5)|dstRegBits, + (byte(c)<<2)|(srcRegBits>>3), + 0b01<<6 /* shift by 12 */ |byte(c>>6), + sfops<<5|0b10001, + ) + } + return + } + + if t := const16bitAligned(c); t >= 0 { + // If the const can fit within 16-bit alignment, for example, 0xffff, 0xffff_0000 or 0xffff_0000_0000_0000 + // We could load it into temporary with movk. + // https://github.com/golang/go/blob/release-branch.go1.15/src/cmd/internal/obj/arm64/asm7.go#L4029 + tmpRegBits := registerBits(a.temporaryRegister) + + // MOVZ $c, tmpReg with shifting. + a.load16bitAlignedConst(buf, c>>(16*t), byte(t), tmpRegBits, false, true) + + // ADD/SUB tmpReg, dstReg + a.addOrSub64BitRegisters(buf, sfops, isSP, dstRegBits, srcRegBits, tmpRegBits) + return + } else if t := const16bitAligned(^c); t >= 0 { + // Also if the reverse of the const can fit within 16-bit range, do the same ^^. + // https://github.com/golang/go/blob/release-branch.go1.15/src/cmd/internal/obj/arm64/asm7.go#L4029 + tmpRegBits := registerBits(a.temporaryRegister) + + // MOVN $c, tmpReg with shifting. + a.load16bitAlignedConst(buf, ^c>>(16*t), byte(t), tmpRegBits, true, true) + + // ADD/SUB tmpReg, dstReg + a.addOrSub64BitRegisters(buf, sfops, isSP, dstRegBits, srcRegBits, tmpRegBits) + return + } + + if uc := uint64(c); isBitMaskImmediate(uc) { + // If the const can be represented as "bitmask immediate", we load it via ORR into temp register. + // https://github.com/golang/go/blob/release-branch.go1.15/src/cmd/internal/obj/arm64/asm7.go#L6570-L6583 + tmpRegBits := registerBits(a.temporaryRegister) + // OOR $c, tmpReg + a.loadConstViaBitMaskImmediate(buf, uc, tmpRegBits, true) + + // ADD/SUB tmpReg, dstReg + a.addOrSub64BitRegisters(buf, sfops, isSP, dstRegBits, srcRegBits, tmpRegBits) + return + } + + // If the value fits within 24-bit, then we emit two add instructions + if 0 <= c && c <= 0xffffff && inst != SUBS && inst != ADDS { + // https://github.com/golang/go/blob/release-branch.go1.15/src/cmd/internal/obj/arm64/asm7.go#L3849-L3862 + buf.Append4Bytes( + (dstRegBits<<5)|dstRegBits, + (byte(c)<<2)|(dstRegBits>>3), + byte(c&0xfff>>6), + sfops<<5|0b10001, + ) + c = c >> 12 + buf.Append4Bytes( + (dstRegBits<<5)|dstRegBits, + (byte(c)<<2)|(dstRegBits>>3), + 0b01_000000 /* shift by 12 */ |byte(c>>6), + sfops<<5|0b10001, + ) + return + } + + // https://github.com/golang/go/blob/release-branch.go1.15/src/cmd/internal/obj/arm64/asm7.go#L3163-L3203 + // Otherwise we use MOVZ and MOVNs for loading const into tmpRegister. + tmpRegBits := registerBits(a.temporaryRegister) + a.load64bitConst(buf, c, tmpRegBits) + a.addOrSub64BitRegisters(buf, sfops, isSP, dstRegBits, srcRegBits, tmpRegBits) + case MOVW: + if c == 0 { + buf.Append4Bytes( + (zeroRegisterBits<<5)|dstRegBits, + zeroRegisterBits>>3, + 0b000_00000|zeroRegisterBits, + 0b0_01_01010, + ) + return + } + + // Following the logic here: + // https://github.com/golang/go/blob/release-branch.go1.15/src/cmd/internal/obj/arm64/asm7.go#L1637 + c32 := uint32(c) + ic := int64(c32) + if ic >= 0 && (ic <= 0xfff || (ic&0xfff) == 0 && (uint64(ic>>12) <= 0xfff)) { + if isBitMaskImmediate(uint64(c)) { + a.loadConstViaBitMaskImmediate(buf, uint64(c), dstRegBits, false) + return + } + } + + if t := const16bitAligned(int64(c32)); t >= 0 { + // If the const can fit within 16-bit alignment, for example, 0xffff, 0xffff_0000 or 0xffff_0000_0000_0000 + // We could load it into temporary with movk. + a.load16bitAlignedConst(buf, int64(c32)>>(16*t), byte(t), dstRegBits, false, false) + } else if t := const16bitAligned(int64(^c32)); t >= 0 { + // Also, if the reverse of the const can fit within 16-bit range, do the same ^^. + a.load16bitAlignedConst(buf, int64(^c32)>>(16*t), byte(t), dstRegBits, true, false) + } else if isBitMaskImmediate(uint64(c)) { + a.loadConstViaBitMaskImmediate(buf, uint64(c), dstRegBits, false) + } else { + // Otherwise, we use MOVZ and MOVK to load it. + // https://github.com/golang/go/blob/release-branch.go1.15/src/cmd/internal/obj/arm64/asm7.go#L6623-L6630 + c16 := uint16(c32) + // MOVZ: https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/MOVZ + buf.Append4Bytes( + (byte(c16)<<5)|dstRegBits, + byte(c16>>3), + 1<<7|byte(c16>>11), + 0b0_10_10010, + ) + // MOVK: https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/MOVK + c16 = uint16(c32 >> 16) + if c16 != 0 { + buf.Append4Bytes( + (byte(c16)<<5)|dstRegBits, + byte(c16>>3), + 1<<7|0b0_01_00000 /* shift by 16 */ |byte(c16>>11), + 0b0_11_10010, + ) + } + } + case MOVD: + // Following the logic here: + // https://github.com/golang/go/blob/release-branch.go1.15/src/cmd/internal/obj/arm64/asm7.go#L1798-L1852 + if c >= 0 && (c <= 0xfff || (c&0xfff) == 0 && (uint64(c>>12) <= 0xfff)) { + if isBitMaskImmediate(uint64(c)) { + a.loadConstViaBitMaskImmediate(buf, uint64(c), dstRegBits, true) + return + } + } + + if t := const16bitAligned(c); t >= 0 { + // If the const can fit within 16-bit alignment, for example, 0xffff, 0xffff_0000 or 0xffff_0000_0000_0000 + // We could load it into temporary with movk. + a.load16bitAlignedConst(buf, c>>(16*t), byte(t), dstRegBits, false, true) + } else if t := const16bitAligned(^c); t >= 0 { + // Also, if the reverse of the const can fit within 16-bit range, do the same ^^. + a.load16bitAlignedConst(buf, (^c)>>(16*t), byte(t), dstRegBits, true, true) + } else if isBitMaskImmediate(uint64(c)) { + a.loadConstViaBitMaskImmediate(buf, uint64(c), dstRegBits, true) + } else { + a.load64bitConst(buf, c, dstRegBits) + } + case LSR: + if c == 0 { + err = errors.New("LSR with zero constant should be optimized out") + return + } else if c < 0 || c > 63 { + err = fmt.Errorf("LSR requires immediate to be within 0 to 63, but got %d", c) + return + } + + // LSR(immediate) is an alias of UBFM + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/LSR--immediate---Logical-Shift-Right--immediate---an-alias-of-UBFM-?lang=en + buf.Append4Bytes( + (dstRegBits<<5)|dstRegBits, + 0b111111_00|dstRegBits>>3, + 0b01_000000|byte(c), + 0b110_10011, + ) + case LSL: + if c == 0 { + err = errors.New("LSL with zero constant should be optimized out") + return + } else if c < 0 || c > 63 { + err = fmt.Errorf("LSL requires immediate to be within 0 to 63, but got %d", c) + return + } + + // LSL(immediate) is an alias of UBFM + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/LSL--immediate---Logical-Shift-Left--immediate---an-alias-of-UBFM- + cb := byte(c) + buf.Append4Bytes( + (dstRegBits<<5)|dstRegBits, + (0b111111-cb)<<2|dstRegBits>>3, + 0b01_000000|(64-cb), + 0b110_10011, + ) + + default: + return errorEncodingUnsupported(n) + } + return +} + +func (a *AssemblerImpl) movk(buf asm.Buffer, v uint64, shfitNum int, dstRegBits byte) { + // https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/MOVK + buf.Append4Bytes( + (byte(v)<<5)|dstRegBits, + byte(v>>3), + 1<<7|byte(shfitNum)<<5|(0b000_11111&byte(v>>11)), + 0b1_11_10010, + ) +} + +func (a *AssemblerImpl) movz(buf asm.Buffer, v uint64, shfitNum int, dstRegBits byte) { + // https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/MOVZ + buf.Append4Bytes( + (byte(v)<<5)|dstRegBits, + byte(v>>3), + 1<<7|byte(shfitNum)<<5|(0b000_11111&byte(v>>11)), + 0b1_10_10010, + ) +} + +func (a *AssemblerImpl) movn(buf asm.Buffer, v uint64, shfitNum int, dstRegBits byte) { + // https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/MOVZ + buf.Append4Bytes( + (byte(v)<<5)|dstRegBits, + byte(v>>3), + 1<<7|byte(shfitNum)<<5|(0b000_11111&byte(v>>11)), + 0b1_00_10010, + ) +} + +// load64bitConst loads a 64-bit constant into the register, following the same logic to decide how to load large 64-bit +// consts as in the Go assembler. +// +// See https://github.com/golang/go/blob/release-branch.go1.15/src/cmd/internal/obj/arm64/asm7.go#L6632-L6759 +func (a *AssemblerImpl) load64bitConst(buf asm.Buffer, c int64, dstRegBits byte) { + var bits [4]uint64 + var zeros, negs int + for i := 0; i < 4; i++ { + bits[i] = uint64((c >> uint(i*16)) & 0xffff) + if v := bits[i]; v == 0 { + zeros++ + } else if v == 0xffff { + negs++ + } + } + + if zeros == 3 { + // one MOVZ instruction. + for i, v := range bits { + if v != 0 { + a.movz(buf, v, i, dstRegBits) + } + } + } else if negs == 3 { + // one MOVN instruction. + for i, v := range bits { + if v != 0xffff { + v = ^v + a.movn(buf, v, i, dstRegBits) + } + } + } else if zeros == 2 { + // one MOVZ then one OVK. + var movz bool + for i, v := range bits { + if !movz && v != 0 { // MOVZ. + // https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/MOVZ + a.movz(buf, v, i, dstRegBits) + movz = true + } else if v != 0 { + a.movk(buf, v, i, dstRegBits) + } + } + + } else if negs == 2 { + // one MOVN then one or two MOVK. + var movn bool + for i, v := range bits { // Emit MOVN. + if !movn && v != 0xffff { + v = ^v + // https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/MOVN + a.movn(buf, v, i, dstRegBits) + movn = true + } else if v != 0xffff { + a.movk(buf, v, i, dstRegBits) + } + } + + } else if zeros == 1 { + // one MOVZ then two MOVK. + var movz bool + for i, v := range bits { + if !movz && v != 0 { // MOVZ. + // https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/MOVZ + a.movz(buf, v, i, dstRegBits) + movz = true + } else if v != 0 { + a.movk(buf, v, i, dstRegBits) + } + } + + } else if negs == 1 { + // one MOVN then two MOVK. + var movn bool + for i, v := range bits { // Emit MOVN. + if !movn && v != 0xffff { + v = ^v + // https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/MOVN + a.movn(buf, v, i, dstRegBits) + movn = true + } else if v != 0xffff { + a.movk(buf, v, i, dstRegBits) + } + } + + } else { + // one MOVZ then tree MOVK. + var movz bool + for i, v := range bits { + if !movz && v != 0 { // MOVZ. + // https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/MOVZ + a.movz(buf, v, i, dstRegBits) + movz = true + } else if v != 0 { + a.movk(buf, v, i, dstRegBits) + } + } + + } +} + +func (a *AssemblerImpl) load16bitAlignedConst(buf asm.Buffer, c int64, shiftNum byte, regBits byte, reverse bool, dst64bit bool) { + var lastByte byte + if reverse { + // MOVN: https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/MOVZ + lastByte = 0b0_00_10010 + } else { + // MOVZ: https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/MOVN + lastByte = 0b0_10_10010 + } + if dst64bit { + lastByte |= 0b1 << 7 + } + buf.Append4Bytes( + (byte(c)<<5)|regBits, + byte(c>>3), + 1<<7|(shiftNum<<5)|byte(c>>11), + lastByte, + ) +} + +// loadConstViaBitMaskImmediate loads the constant with ORR (bitmask immediate). +// https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/ORR--immediate---Bitwise-OR--immediate--?lang=en +func (a *AssemblerImpl) loadConstViaBitMaskImmediate(buf asm.Buffer, c uint64, regBits byte, dst64bit bool) { + var size uint32 + switch { + case c != c>>32|c<<32: + size = 64 + case c != c>>16|c<<48: + size = 32 + c = uint64(int32(c)) + case c != c>>8|c<<56: + size = 16 + c = uint64(int16(c)) + case c != c>>4|c<<60: + size = 8 + c = uint64(int8(c)) + case c != c>>2|c<<62: + size = 4 + c = uint64(int64(c<<60) >> 60) + default: + size = 2 + c = uint64(int64(c<<62) >> 62) + } + + neg := false + if int64(c) < 0 { + c = ^c + neg = true + } + + onesSize, nonZeroPos := getOnesSequenceSize(c) + if neg { + nonZeroPos = onesSize + nonZeroPos + onesSize = size - onesSize + } + + // See the following article for understanding the encoding. + // https://dinfuehr.github.io/blog/encoding-of-immediate-values-on-aarch64/ + var n byte + mode := 32 + if dst64bit && size == 64 { + n = 0b1 + mode = 64 + } + + r := byte((size - nonZeroPos) & (size - 1) & uint32(mode-1)) + s := byte((onesSize - 1) | 63&^(size<<1-1)) + + var sf byte + if dst64bit { + sf = 0b1 + } + buf.Append4Bytes( + (zeroRegisterBits<<5)|regBits, + s<<2|(zeroRegisterBits>>3), + n<<6|r, + sf<<7|0b0_01_10010, + ) +} + +func getOnesSequenceSize(x uint64) (size, nonZeroPos uint32) { + // Take 0b00111000 for example: + y := getLowestBit(x) // = 0b0000100 + nonZeroPos = setBitPos(y) // = 2 + size = setBitPos(x+y) - nonZeroPos // = setBitPos(0b0100000) - 2 = 5 - 2 = 3 + return +} + +func setBitPos(x uint64) (ret uint32) { + for ; ; ret++ { + if x == 0b1 { + break + } + x = x >> 1 + } + return +} + +func checkArrangementIndexPair(arr VectorArrangement, index VectorIndex) (err error) { + if arr == VectorArrangementNone { + return nil + } + var valid bool + switch arr { + case VectorArrangement8B: + valid = index < 8 + case VectorArrangement16B: + valid = index < 16 + case VectorArrangement4H: + valid = index < 4 + case VectorArrangement8H: + valid = index < 8 + case VectorArrangement2S: + valid = index < 2 + case VectorArrangement4S: + valid = index < 4 + case VectorArrangement1D: + valid = index < 1 + case VectorArrangement2D: + valid = index < 2 + case VectorArrangementB: + valid = index < 16 + case VectorArrangementH: + valid = index < 8 + case VectorArrangementS: + valid = index < 4 + case VectorArrangementD: + valid = index < 2 + } + if !valid { + err = fmt.Errorf("invalid arrangement and index pair: %s[%d]", arr, index) + } + return +} + +func (a *AssemblerImpl) encodeMemoryToVectorRegister(buf asm.Buffer, n *nodeImpl) (err error) { + srcBaseRegBits, err := intRegisterBits(n.srcReg) + if err != nil { + return err + } + + dstVectorRegBits, err := vectorRegisterBits(n.dstReg) + if err != nil { + return err + } + + switch n.instruction { + case VMOV: // translated as LDR(immediate,SIMD&FP) + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/LDR--immediate--SIMD-FP---Load-SIMD-FP-Register--immediate-offset--?lang=en + var size, opcode byte + var dataSize, dataSizeLog2 int64 + switch n.vectorArrangement { + case VectorArrangementB: + size, opcode, dataSize, dataSizeLog2 = 0b00, 0b01, 1, 0 + case VectorArrangementH: + size, opcode, dataSize, dataSizeLog2 = 0b01, 0b01, 2, 1 + case VectorArrangementS: + size, opcode, dataSize, dataSizeLog2 = 0b10, 0b01, 4, 2 + case VectorArrangementD: + size, opcode, dataSize, dataSizeLog2 = 0b11, 0b01, 8, 3 + case VectorArrangementQ: + size, opcode, dataSize, dataSizeLog2 = 0b00, 0b11, 16, 4 + } + const v = 1 // v as in https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Loads-and-Stores?lang=en#ldst_pos + if n.srcReg2 != asm.NilRegister { + offsetRegBits, err := intRegisterBits(n.srcReg2) + if err != nil { + return err + } + a.encodeLoadOrStoreWithRegisterOffset(buf, srcBaseRegBits, offsetRegBits, dstVectorRegBits, opcode, size, v) + } else { + err = a.encodeLoadOrStoreWithConstOffset(buf, srcBaseRegBits, dstVectorRegBits, + n.srcConst, opcode, size, v, dataSize, dataSizeLog2) + } + case LD1R: + if n.srcReg2 != asm.NilRegister || n.srcConst != 0 { + return fmt.Errorf("offset for %s is not implemented", InstructionName(LD1R)) + } + + var size, q byte + switch n.vectorArrangement { + case VectorArrangement8B: + size, q = 0b00, 0b0 + case VectorArrangement16B: + size, q = 0b00, 0b1 + case VectorArrangement4H: + size, q = 0b01, 0b0 + case VectorArrangement8H: + size, q = 0b01, 0b1 + case VectorArrangement2S: + size, q = 0b10, 0b0 + case VectorArrangement4S: + size, q = 0b10, 0b1 + case VectorArrangement1D: + size, q = 0b11, 0b0 + case VectorArrangement2D: + size, q = 0b11, 0b1 + } + + // No offset encoding. + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/LD1R--Load-one-single-element-structure-and-Replicate-to-all-lanes--of-one-register--?lang=en#iclass_as_post_index + buf.Append4Bytes( + (srcBaseRegBits<<5)|dstVectorRegBits, + 0b11_000000|size<<2|srcBaseRegBits>>3, + 0b01_000000, + q<<6|0b1101, + ) + default: + return errorEncodingUnsupported(n) + } + return +} + +func arrangementSizeQ(arr VectorArrangement) (size, q byte) { + switch arr { + case VectorArrangement8B: + size, q = 0b00, 0 + case VectorArrangement16B: + size, q = 0b00, 1 + case VectorArrangement4H: + size, q = 0b01, 0 + case VectorArrangement8H: + size, q = 0b01, 1 + case VectorArrangement2S: + size, q = 0b10, 0 + case VectorArrangement4S: + size, q = 0b10, 1 + case VectorArrangement1D: + size, q = 0b11, 0 + case VectorArrangement2D: + size, q = 0b11, 1 + } + return +} + +func (a *AssemblerImpl) encodeVectorRegisterToMemory(buf asm.Buffer, n *nodeImpl) (err error) { + srcVectorRegBits, err := vectorRegisterBits(n.srcReg) + if err != nil { + return err + } + + dstBaseRegBits, err := intRegisterBits(n.dstReg) + if err != nil { + return err + } + + switch n.instruction { + case VMOV: // translated as STR(immediate,SIMD&FP) + // https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/STR--immediate--SIMD-FP---Store-SIMD-FP-register--immediate-offset-- + var size, opcode byte + var dataSize, dataSizeLog2 int64 + switch n.vectorArrangement { + case VectorArrangementB: + size, opcode, dataSize, dataSizeLog2 = 0b00, 0b00, 1, 0 + case VectorArrangementH: + size, opcode, dataSize, dataSizeLog2 = 0b01, 0b00, 2, 1 + case VectorArrangementS: + size, opcode, dataSize, dataSizeLog2 = 0b10, 0b00, 4, 2 + case VectorArrangementD: + size, opcode, dataSize, dataSizeLog2 = 0b11, 0b00, 8, 3 + case VectorArrangementQ: + size, opcode, dataSize, dataSizeLog2 = 0b00, 0b10, 16, 4 + } + const v = 1 // v as in https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Loads-and-Stores?lang=en#ldst_pos + + if n.dstReg2 != asm.NilRegister { + offsetRegBits, err := intRegisterBits(n.dstReg2) + if err != nil { + return err + } + a.encodeLoadOrStoreWithRegisterOffset(buf, dstBaseRegBits, offsetRegBits, srcVectorRegBits, opcode, size, v) + } else { + err = a.encodeLoadOrStoreWithConstOffset(buf, dstBaseRegBits, srcVectorRegBits, + n.dstConst, opcode, size, v, dataSize, dataSizeLog2) + } + default: + return errorEncodingUnsupported(n) + } + return +} + +func (a *AssemblerImpl) encodeStaticConstToVectorRegister(buf asm.Buffer, n *nodeImpl) (err error) { + if n.instruction != VMOV { + return errorEncodingUnsupported(n) + } + + dstRegBits, err := vectorRegisterBits(n.dstReg) + if err != nil { + return err + } + + // LDR (literal, SIMD&FP) + // https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/LDR--literal--SIMD-FP---Load-SIMD-FP-Register--PC-relative-literal-- + var opc byte + var constLength int + switch n.vectorArrangement { + case VectorArrangementS: + opc, constLength = 0b00, 4 + case VectorArrangementD: + opc, constLength = 0b01, 8 + case VectorArrangementQ: + opc, constLength = 0b10, 16 + } + + loadLiteralOffsetInBinary := uint64(buf.Len()) + a.pool.AddConst(n.staticConst, loadLiteralOffsetInBinary) + + if len(n.staticConst.Raw) != constLength { + return fmt.Errorf("invalid const length for %s: want %d but was %d", + n.vectorArrangement, constLength, len(n.staticConst.Raw)) + } + + buf.Append4Bytes(dstRegBits, 0x0, 0x0, opc<<6|0b11100) + n.staticConst.AddOffsetFinalizedCallback(func(offsetOfConst uint64) { + // LDR (literal, SIMD&FP) encodes offset divided by 4. + offset := (int(offsetOfConst) - int(loadLiteralOffsetInBinary)) / 4 + bin := buf.Bytes() + bin[loadLiteralOffsetInBinary] |= byte(offset << 5) + bin[loadLiteralOffsetInBinary+1] |= byte(offset >> 3) + bin[loadLiteralOffsetInBinary+2] |= byte(offset >> 11) + }) + return +} + +// advancedSIMDTwoRegisterMisc holds information to encode instructions as "Advanced SIMD two-register miscellaneous" in +// https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en +var advancedSIMDTwoRegisterMisc = map[asm.Instruction]struct { + qAndSize map[VectorArrangement]qAndSize + u, opcode byte +}{ + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/NOT--Bitwise-NOT--vector--?lang=en + NOT: { + u: 0b1, opcode: 0b00101, + qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement16B: {size: 0b00, q: 0b1}, + VectorArrangement8B: {size: 0b00, q: 0b0}, + }, + }, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FNEG--vector---Floating-point-Negate--vector--?lang=en + VFNEG: { + u: 0b1, opcode: 0b01111, + qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement4S: {size: 0b10, q: 0b1}, + VectorArrangement2S: {size: 0b10, q: 0b0}, + VectorArrangement2D: {size: 0b11, q: 0b1}, + }, + }, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FABS--vector---Floating-point-Absolute-value--vector--?lang=en + VFABS: {u: 0, opcode: 0b01111, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement2D: {size: 0b11, q: 0b1}, + VectorArrangement4S: {size: 0b10, q: 0b1}, + VectorArrangement2S: {size: 0b10, q: 0b0}, + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FSQRT--vector---Floating-point-Square-Root--vector--?lang=en + VFSQRT: {u: 1, opcode: 0b11111, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement2D: {size: 0b11, q: 0b1}, + VectorArrangement4S: {size: 0b10, q: 0b1}, + VectorArrangement2S: {size: 0b10, q: 0b0}, + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FRINTM--vector---Floating-point-Round-to-Integral--toward-Minus-infinity--vector--?lang=en + VFRINTM: {u: 0, opcode: 0b11001, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement2D: {size: 0b01, q: 0b1}, + VectorArrangement4S: {size: 0b00, q: 0b1}, + VectorArrangement2S: {size: 0b00, q: 0b0}, + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FRINTN--vector---Floating-point-Round-to-Integral--to-nearest-with-ties-to-even--vector--?lang=en + VFRINTN: {u: 0, opcode: 0b11000, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement2D: {size: 0b01, q: 0b1}, + VectorArrangement4S: {size: 0b00, q: 0b1}, + VectorArrangement2S: {size: 0b00, q: 0b0}, + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FRINTP--vector---Floating-point-Round-to-Integral--toward-Plus-infinity--vector--?lang=en + VFRINTP: {u: 0, opcode: 0b11000, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement2D: {size: 0b11, q: 0b1}, + VectorArrangement4S: {size: 0b10, q: 0b1}, + VectorArrangement2S: {size: 0b10, q: 0b0}, + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FRINTZ--vector---Floating-point-Round-to-Integral--toward-Zero--vector--?lang=en + VFRINTZ: {u: 0, opcode: 0b11001, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement2D: {size: 0b11, q: 0b1}, + VectorArrangement4S: {size: 0b10, q: 0b1}, + VectorArrangement2S: {size: 0b10, q: 0b0}, + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/CNT--Population-Count-per-byte-?lang=en + VCNT: {u: 0b0, opcode: 0b00101, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement8B: {size: 0b00, q: 0b0}, + VectorArrangement16B: {size: 0b00, q: 0b1}, + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/NEG--vector---Negate--vector--?lang=en + VNEG: {u: 0b1, opcode: 0b01011, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/ABS--Absolute-value--vector--?lang=en + VABS: {u: 0b0, opcode: 0b01011, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/REV64--Reverse-elements-in-64-bit-doublewords--vector--?lang=en + REV64: {u: 0b0, opcode: 0b00000, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/XTN--XTN2--Extract-Narrow-?lang=en + XTN: {u: 0b0, opcode: 0b10010, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement2D: {q: 0, size: 0b10}, + VectorArrangement4S: {q: 0, size: 0b01}, + VectorArrangement8H: {q: 0, size: 0b00}, + }}, + SHLL: {u: 0b1, opcode: 0b10011, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement8B: {q: 0b00, size: 0b00}, + VectorArrangement4H: {q: 0b00, size: 0b01}, + VectorArrangement2S: {q: 0b00, size: 0b10}, + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/CMEQ--zero---Compare-bitwise-Equal-to-zero--vector--?lang=en + CMEQZERO: {u: 0b0, opcode: 0b01001, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SADDLP--Signed-Add-Long-Pairwise-?lang=en + SADDLP: {u: 0b0, opcode: 0b00010, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/UADDLP--Unsigned-Add-Long-Pairwise-?lang=en + UADDLP: {u: 0b1, opcode: 0b00010, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FCVTZS--vector--integer---Floating-point-Convert-to-Signed-integer--rounding-toward-Zero--vector--?lang=en + VFCVTZS: {u: 0b0, opcode: 0b11011, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement4S: {size: 0b10, q: 0b1}, + VectorArrangement2S: {size: 0b10, q: 0b0}, + VectorArrangement2D: {size: 0b11, q: 0b1}, + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FCVTZU--vector--integer---Floating-point-Convert-to-Unsigned-integer--rounding-toward-Zero--vector--?lang=en + VFCVTZU: {u: 0b1, opcode: 0b11011, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement4S: {size: 0b10, q: 0b1}, + VectorArrangement2S: {size: 0b10, q: 0b0}, + VectorArrangement2D: {size: 0b11, q: 0b1}, + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SQXTN--SQXTN2--Signed-saturating-extract-Narrow-?lang=en + SQXTN: {u: 0b0, opcode: 0b10100, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement8B: {q: 0b0, size: 0b00}, + VectorArrangement4H: {q: 0b0, size: 0b01}, + VectorArrangement2S: {q: 0b0, size: 0b10}, + }}, + + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SQXTN--SQXTN2--Signed-saturating-extract-Narrow-?lang=en + SQXTN2: {u: 0b0, opcode: 0b10100, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement16B: {q: 0b1, size: 0b00}, + VectorArrangement8H: {q: 0b1, size: 0b01}, + VectorArrangement4S: {q: 0b1, size: 0b10}, + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/UQXTN--UQXTN2--Unsigned-saturating-extract-Narrow-?lang=en + UQXTN: {u: 0b1, opcode: 0b10100, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SQXTUN--SQXTUN2--Signed-saturating-extract-Unsigned-Narrow-?lang=en + SQXTUN: {u: 0b1, opcode: 0b10010, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement8B: {q: 0b0, size: 0b00}, + VectorArrangement4H: {q: 0b0, size: 0b01}, + VectorArrangement2S: {q: 0b0, size: 0b10}, + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SQXTUN--SQXTUN2--Signed-saturating-extract-Unsigned-Narrow-?lang=en + SQXTUN2: {u: 0b1, opcode: 0b10010, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement16B: {q: 0b1, size: 0b00}, + VectorArrangement8H: {q: 0b1, size: 0b01}, + VectorArrangement4S: {q: 0b1, size: 0b10}, + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SCVTF--vector--integer---Signed-integer-Convert-to-Floating-point--vector--?lang=en + VSCVTF: {u: 0b0, opcode: 0b11101, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement2D: {q: 0b1, size: 0b01}, + VectorArrangement4S: {q: 0b1, size: 0b00}, + VectorArrangement2S: {q: 0b0, size: 0b00}, + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/UCVTF--vector--integer---Unsigned-integer-Convert-to-Floating-point--vector--?lang=en + VUCVTF: {u: 0b1, opcode: 0b11101, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement2D: {q: 0b1, size: 0b01}, + VectorArrangement4S: {q: 0b1, size: 0b00}, + VectorArrangement2S: {q: 0b0, size: 0b00}, + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FCVTL--FCVTL2--Floating-point-Convert-to-higher-precision-Long--vector--?lang=en + FCVTL: {u: 0b0, opcode: 0b10111, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement2S: {size: 0b01, q: 0b0}, + VectorArrangement4H: {size: 0b00, q: 0b0}, + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FCVTN--FCVTN2--Floating-point-Convert-to-lower-precision-Narrow--vector--?lang=en + FCVTN: {u: 0b0, opcode: 0b10110, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement2S: {size: 0b01, q: 0b0}, + VectorArrangement4H: {size: 0b00, q: 0b0}, + }}, +} + +// advancedSIMDThreeDifferent holds information to encode instructions as "Advanced SIMD three different" in +// https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en +var advancedSIMDThreeDifferent = map[asm.Instruction]struct { + qAndSize map[VectorArrangement]qAndSize + u, opcode byte +}{ + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/UMLAL--UMLAL2--vector---Unsigned-Multiply-Add-Long--vector--?lang=en + VUMLAL: {u: 0b1, opcode: 0b1000, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement2S: {q: 0b0, size: 0b10}, + VectorArrangement4H: {q: 0b0, size: 0b01}, + VectorArrangement8B: {q: 0b0, size: 0b00}, + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SMULL--SMULL2--vector---Signed-Multiply-Long--vector--?lang=en + SMULL: {u: 0b0, opcode: 0b1100, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement8B: {q: 0b0, size: 0b00}, + VectorArrangement4H: {q: 0b0, size: 0b01}, + VectorArrangement2S: {q: 0b0, size: 0b10}, + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SMULL--SMULL2--vector---Signed-Multiply-Long--vector--?lang=en + SMULL2: {u: 0b0, opcode: 0b1100, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement16B: {q: 0b1, size: 0b00}, + VectorArrangement8H: {q: 0b1, size: 0b01}, + VectorArrangement4S: {q: 0b1, size: 0b10}, + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en + UMULL: {u: 0b1, opcode: 0b1100, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement8B: {q: 0b0, size: 0b00}, + VectorArrangement4H: {q: 0b0, size: 0b01}, + VectorArrangement2S: {q: 0b0, size: 0b10}, + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en + UMULL2: {u: 0b1, opcode: 0b1100, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement16B: {q: 0b1, size: 0b00}, + VectorArrangement8H: {q: 0b1, size: 0b01}, + VectorArrangement4S: {q: 0b1, size: 0b10}, + }}, +} + +// advancedSIMDThreeSame holds information to encode instructions as "Advanced SIMD three same" in +// https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en +var advancedSIMDThreeSame = map[asm.Instruction]struct { + qAndSize map[VectorArrangement]qAndSize + u, opcode byte +}{ + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/AND--vector---Bitwise-AND--vector--?lang=en + VAND: { + u: 0b0, opcode: 0b00011, + qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement16B: {size: 0b00, q: 0b1}, + VectorArrangement8B: {size: 0b00, q: 0b0}, + }, + }, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/BSL--Bitwise-Select-?lang=en + BSL: { + u: 0b1, opcode: 0b00011, + qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement16B: {size: 0b01, q: 0b1}, + VectorArrangement8B: {size: 0b01, q: 0b0}, + }, + }, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/EOR--vector---Bitwise-Exclusive-OR--vector--?lang=en + EOR: { + u: 0b1, opcode: 0b00011, + qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement16B: {size: 0b00, q: 0b1}, + VectorArrangement8B: {size: 0b00, q: 0b0}, + }, + }, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/ORR--vector--register---Bitwise-inclusive-OR--vector--register--?lang=en + VORR: { + u: 0b0, opcode: 0b00011, + qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement16B: {size: 0b10, q: 0b1}, + VectorArrangement8B: {size: 0b10, q: 0b0}, + }, + }, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/BIC--vector--register---Bitwise-bit-Clear--vector--register--?lang=en + BIC: { + u: 0b0, opcode: 0b00011, + qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement16B: {size: 0b01, q: 0b1}, + VectorArrangement8B: {size: 0b01, q: 0b0}, + }, + }, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FADD--vector---Floating-point-Add--vector--?lang=en + VFADDS: { + u: 0b0, opcode: 0b11010, + qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement4S: {size: 0b00, q: 0b1}, + VectorArrangement2S: {size: 0b00, q: 0b0}, + }, + }, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FADD--vector---Floating-point-Add--vector--?lang=en + VFADDD: { + u: 0b0, opcode: 0b11010, + qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement2D: {size: 0b01, q: 0b1}, + }, + }, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FSUB--vector---Floating-point-Subtract--vector--?lang=en + VFSUBS: { + u: 0b0, opcode: 0b11010, + qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement4S: {size: 0b10, q: 0b1}, + VectorArrangement2S: {size: 0b10, q: 0b0}, + }, + }, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FSUB--vector---Floating-point-Subtract--vector--?lang=en + VFSUBD: { + u: 0b0, opcode: 0b11010, + qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement2D: {size: 0b11, q: 0b1}, + }, + }, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/UMAXP--Unsigned-Maximum-Pairwise-?lang=en + UMAXP: {u: 0b1, opcode: 0b10100, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/CMEQ--register---Compare-bitwise-Equal--vector--?lang=en + CMEQ: {u: 0b1, opcode: 0b10001, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/dui0801/g/A64-SIMD-Vector-Instructions/ADDP--vector- + VADDP: {u: 0b0, opcode: 0b10111, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/ADD--vector---Add--vector--?lang=en + VADD: {u: 0, opcode: 0b10000, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SUB--vector---Subtract--vector--?lang=en + VSUB: {u: 1, opcode: 0b10000, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SSHL--Signed-Shift-Left--register--?lang=en + SSHL: {u: 0, opcode: 0b01000, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SSHL--Signed-Shift-Left--register--?lang=en + USHL: {u: 0b1, opcode: 0b01000, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/CMGT--register---Compare-signed-Greater-than--vector--?lang=en + CMGT: {u: 0b0, opcode: 0b00110, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/CMHI--register---Compare-unsigned-Higher--vector--?lang=en + CMHI: {u: 0b1, opcode: 0b00110, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/CMGE--register---Compare-signed-Greater-than-or-Equal--vector--?lang=en + CMGE: {u: 0b0, opcode: 0b00111, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/CMHS--register---Compare-unsigned-Higher-or-Same--vector--?lang=en + CMHS: {u: 0b1, opcode: 0b00111, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FCMEQ--register---Floating-point-Compare-Equal--vector--?lang=en + FCMEQ: { + u: 0b0, opcode: 0b11100, + qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement4S: {size: 0b00, q: 0b1}, + VectorArrangement2S: {size: 0b00, q: 0b0}, + VectorArrangement2D: {size: 0b01, q: 0b1}, + }, + }, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FCMGT--register---Floating-point-Compare-Greater-than--vector--?lang=en + FCMGT: { + u: 0b1, opcode: 0b11100, + qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement4S: {size: 0b10, q: 0b1}, + VectorArrangement2S: {size: 0b10, q: 0b0}, + VectorArrangement2D: {size: 0b11, q: 0b1}, + }, + }, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FCMGE--register---Floating-point-Compare-Greater-than-or-Equal--vector--?lang=en + FCMGE: { + u: 0b1, opcode: 0b11100, + qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement4S: {size: 0b00, q: 0b1}, + VectorArrangement2S: {size: 0b00, q: 0b0}, + VectorArrangement2D: {size: 0b01, q: 0b1}, + }, + }, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FMIN--vector---Floating-point-minimum--vector--?lang=en + VFMIN: { + u: 0b0, opcode: 0b11110, + qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement4S: {size: 0b10, q: 0b1}, + VectorArrangement2S: {size: 0b10, q: 0b0}, + VectorArrangement2D: {size: 0b11, q: 0b1}, + }, + }, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FMAX--vector---Floating-point-Maximum--vector--?lang=en + VFMAX: { + u: 0b0, opcode: 0b11110, + qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement4S: {size: 0b00, q: 0b1}, + VectorArrangement2S: {size: 0b00, q: 0b0}, + VectorArrangement2D: {size: 0b01, q: 0b1}, + }, + }, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FMUL--vector---Floating-point-Multiply--vector--?lang=en + VFMUL: { + u: 0b1, opcode: 0b11011, + qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement4S: {size: 0b00, q: 0b1}, + VectorArrangement2S: {size: 0b00, q: 0b0}, + VectorArrangement2D: {size: 0b01, q: 0b1}, + }, + }, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/FDIV--vector---Floating-point-Divide--vector--?lang=en + VFDIV: { + u: 0b1, opcode: 0b11111, + qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement4S: {size: 0b00, q: 0b1}, + VectorArrangement2S: {size: 0b00, q: 0b0}, + VectorArrangement2D: {size: 0b01, q: 0b1}, + }, + }, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/MUL--vector---Multiply--vector--?lang=en + VMUL: {u: 0b0, opcode: 0b10011, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SQADD--Signed-saturating-Add-?lang=en + VSQADD: {u: 0b0, opcode: 0b00001, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/UQADD--Unsigned-saturating-Add-?lang=en + VUQADD: {u: 0b1, opcode: 0b00001, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SMIN--Signed-Minimum--vector--?lang=en + SMIN: {u: 0b0, opcode: 0b01101, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SMAX--Signed-Maximum--vector--?lang=en + SMAX: {u: 0b0, opcode: 0b01100, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/UMIN--Unsigned-Minimum--vector--?lang=en + UMIN: {u: 0b1, opcode: 0b01101, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/UMAX--Unsigned-Maximum--vector--?lang=en + UMAX: {u: 0b1, opcode: 0b01100, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/URHADD--Unsigned-Rounding-Halving-Add-?lang=en + URHADD: {u: 0b1, opcode: 0b00010, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SQSUB--Signed-saturating-Subtract-?lang=en + VSQSUB: {u: 0b0, opcode: 0b00101, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/UQSUB--Unsigned-saturating-Subtract-?lang=en + VUQSUB: {u: 0b1, opcode: 0b00101, qAndSize: defaultQAndSize}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/BIT--Bitwise-Insert-if-True-?lang=en + VBIT: {u: 0b1, opcode: 0b00011, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement8B: {q: 0b0, size: 0b10}, + VectorArrangement16B: {q: 0b1, size: 0b10}, + }}, + SQRDMULH: {u: 0b1, opcode: 0b10110, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement4H: {q: 0b0, size: 0b01}, + VectorArrangement8H: {q: 0b1, size: 0b01}, + VectorArrangement2S: {q: 0b0, size: 0b10}, + VectorArrangement4S: {q: 0b1, size: 0b10}, + }}, +} + +// aAndSize is a pair of "Q" and "size" that appear in https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en +type qAndSize struct{ q, size byte } + +// defaultQAndSize maps a vector arrangement to the default qAndSize which is encoded by many instructions. +var defaultQAndSize = map[VectorArrangement]qAndSize{ + VectorArrangement8B: {size: 0b00, q: 0b0}, + VectorArrangement16B: {size: 0b00, q: 0b1}, + VectorArrangement4H: {size: 0b01, q: 0b0}, + VectorArrangement8H: {size: 0b01, q: 0b1}, + VectorArrangement2S: {size: 0b10, q: 0b0}, + VectorArrangement4S: {size: 0b10, q: 0b1}, + VectorArrangement1D: {size: 0b11, q: 0b0}, + VectorArrangement2D: {size: 0b11, q: 0b1}, +} + +// advancedSIMDAcrossLanes holds information to encode instructions as "Advanced SIMD across lanes" in +// https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en +var advancedSIMDAcrossLanes = map[asm.Instruction]struct { + qAndSize map[VectorArrangement]qAndSize + u, opcode byte +}{ + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/ADDV--Add-across-Vector-?lang=en + ADDV: { + u: 0b0, opcode: 0b11011, + qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement16B: {size: 0b00, q: 0b1}, + VectorArrangement8B: {size: 0b00, q: 0b0}, + VectorArrangement8H: {size: 0b01, q: 0b1}, + VectorArrangement4H: {size: 0b01, q: 0b0}, + VectorArrangement4S: {size: 0b10, q: 0b1}, + }, + }, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/UMINV--Unsigned-Minimum-across-Vector-?lang=en + UMINV: { + u: 0b1, opcode: 0b11010, + qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement16B: {size: 0b00, q: 0b1}, + VectorArrangement8B: {size: 0b00, q: 0b0}, + VectorArrangement8H: {size: 0b01, q: 0b1}, + VectorArrangement4H: {size: 0b01, q: 0b0}, + VectorArrangement4S: {size: 0b10, q: 0b1}, + }, + }, + UADDLV: {u: 0b1, opcode: 0b00011, qAndSize: map[VectorArrangement]qAndSize{ + VectorArrangement16B: {size: 0b00, q: 0b1}, + VectorArrangement8B: {size: 0b00, q: 0b0}, + VectorArrangement8H: {size: 0b01, q: 0b1}, + VectorArrangement4H: {size: 0b01, q: 0b0}, + VectorArrangement4S: {size: 0b10, q: 0b1}, + }}, +} + +// advancedSIMDScalarPairwise holds information to encode instructions as "Advanced SIMD scalar pairwise" in +// https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en +var advancedSIMDScalarPairwise = map[asm.Instruction]struct { + size map[VectorArrangement]byte + u, opcode byte +}{ + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/ADDP--scalar---Add-Pair-of-elements--scalar--?lang=en + ADDP: {u: 0b0, opcode: 0b11011, size: map[VectorArrangement]byte{VectorArrangement2D: 0b11}}, +} + +// advancedSIMDCopy holds information to encode instructions as "Advanced SIMD copy" in +// https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en +var advancedSIMDCopy = map[asm.Instruction]struct { + // TODO: extract common implementation of resolver. + resolver func(srcIndex, dstIndex VectorIndex, arr VectorArrangement) (imm5, imm4, q byte, err error) + op byte +}{ + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/DUP--element---Duplicate-vector-element-to-vector-or-scalar-?lang=en + DUPELEM: {op: 0, resolver: func(srcIndex, dstIndex VectorIndex, arr VectorArrangement) (imm5, imm4, q byte, err error) { + imm4 = 0b0000 + q = 0b1 + + switch arr { + case VectorArrangementB: + imm5 |= 0b1 + imm5 |= byte(srcIndex) << 1 + case VectorArrangementH: + imm5 |= 0b10 + imm5 |= byte(srcIndex) << 2 + case VectorArrangementS: + imm5 |= 0b100 + imm5 |= byte(srcIndex) << 3 + case VectorArrangementD: + imm5 |= 0b1000 + imm5 |= byte(srcIndex) << 4 + default: + err = fmt.Errorf("unsupported arrangement for DUPELEM: %d", arr) + } + + return + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/DUP--general---Duplicate-general-purpose-register-to-vector-?lang=en + DUPGEN: {op: 0b0, resolver: func(srcIndex, dstIndex VectorIndex, arr VectorArrangement) (imm5, imm4, q byte, err error) { + imm4 = 0b0001 + switch arr { + case VectorArrangement8B: + imm5 = 0b1 + case VectorArrangement16B: + imm5 = 0b1 + q = 0b1 + case VectorArrangement4H: + imm5 = 0b10 + case VectorArrangement8H: + imm5 = 0b10 + q = 0b1 + case VectorArrangement2S: + imm5 = 0b100 + case VectorArrangement4S: + imm5 = 0b100 + q = 0b1 + case VectorArrangement2D: + imm5 = 0b1000 + q = 0b1 + default: + err = fmt.Errorf("unsupported arrangement for DUPGEN: %s", arr) + } + return + }}, + // https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/INS--general---Insert-vector-element-from-general-purpose-register-?lang=en + INSGEN: {op: 0b0, resolver: func(srcIndex, dstIndex VectorIndex, arr VectorArrangement) (imm5, imm4, q byte, err error) { + imm4, q = 0b0011, 0b1 + switch arr { + case VectorArrangementB: + imm5 |= 0b1 + imm5 |= byte(dstIndex) << 1 + case VectorArrangementH: + imm5 |= 0b10 + imm5 |= byte(dstIndex) << 2 + case VectorArrangementS: + imm5 |= 0b100 + imm5 |= byte(dstIndex) << 3 + case VectorArrangementD: + imm5 |= 0b1000 + imm5 |= byte(dstIndex) << 4 + default: + err = fmt.Errorf("unsupported arrangement for INSGEN: %s", arr) + } + return + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/UMOV--Unsigned-Move-vector-element-to-general-purpose-register-?lang=en + UMOV: {op: 0b0, resolver: func(srcIndex, dstIndex VectorIndex, arr VectorArrangement) (imm5, imm4, q byte, err error) { + imm4 = 0b0111 + switch arr { + case VectorArrangementB: + imm5 |= 0b1 + imm5 |= byte(srcIndex) << 1 + case VectorArrangementH: + imm5 |= 0b10 + imm5 |= byte(srcIndex) << 2 + case VectorArrangementS: + imm5 |= 0b100 + imm5 |= byte(srcIndex) << 3 + case VectorArrangementD: + imm5 |= 0b1000 + imm5 |= byte(srcIndex) << 4 + q = 0b1 + default: + err = fmt.Errorf("unsupported arrangement for UMOV: %s", arr) + } + return + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SMOV--Signed-Move-vector-element-to-general-purpose-register-?lang=en + SMOV32: {op: 0b0, resolver: func(srcIndex, dstIndex VectorIndex, arr VectorArrangement) (imm5, imm4, q byte, err error) { + imm4 = 0b0101 + switch arr { + case VectorArrangementB: + imm5 |= 0b1 + imm5 |= byte(srcIndex) << 1 + case VectorArrangementH: + imm5 |= 0b10 + imm5 |= byte(srcIndex) << 2 + default: + err = fmt.Errorf("unsupported arrangement for SMOV32: %s", arr) + } + return + }}, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/INS--element---Insert-vector-element-from-another-vector-element-?lang=en + INSELEM: {op: 0b1, resolver: func(srcIndex, dstIndex VectorIndex, arr VectorArrangement) (imm5, imm4, q byte, err error) { + q = 0b1 + switch arr { + case VectorArrangementB: + imm5 |= 0b1 + imm5 |= byte(dstIndex) << 1 + imm4 = byte(srcIndex) + case VectorArrangementH: + imm5 |= 0b10 + imm5 |= byte(dstIndex) << 2 + imm4 = byte(srcIndex) << 1 + case VectorArrangementS: + imm5 |= 0b100 + imm5 |= byte(dstIndex) << 3 + imm4 = byte(srcIndex) << 2 + case VectorArrangementD: + imm5 |= 0b1000 + imm5 |= byte(dstIndex) << 4 + imm4 = byte(srcIndex) << 3 + default: + err = fmt.Errorf("unsupported arrangement for INSELEM: %d", arr) + } + return + }}, +} + +// advancedSIMDTableLookup holds information to encode instructions as "Advanced SIMD table lookup" in +// https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en +var advancedSIMDTableLookup = map[asm.Instruction]struct { + q map[VectorArrangement]byte + op, op2, Len byte +}{ + TBL1: {op: 0, op2: 0, Len: 0b00, q: map[VectorArrangement]byte{VectorArrangement16B: 0b1, VectorArrangement8B: 0b0}}, + TBL2: {op: 0, op2: 0, Len: 0b01, q: map[VectorArrangement]byte{VectorArrangement16B: 0b1, VectorArrangement8B: 0b0}}, +} + +// advancedSIMDShiftByImmediate holds information to encode instructions as "Advanced SIMD shift by immediate" in +// https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en +var advancedSIMDShiftByImmediate = map[asm.Instruction]struct { + q map[VectorArrangement]byte + immResolver func(shiftAmount int64, arr VectorArrangement) (immh, immb byte, err error) + U, opcode byte +}{ + // https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/SSHLL--SSHLL2--Signed-Shift-Left-Long--immediate-- + SSHLL: { + U: 0b0, opcode: 0b10100, + q: map[VectorArrangement]byte{VectorArrangement8B: 0b0, VectorArrangement4H: 0b0, VectorArrangement2S: 0b0}, + immResolver: immResolverForSIMDSiftLeftByImmediate, + }, + // https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/SSHLL--SSHLL2--Signed-Shift-Left-Long--immediate-- + SSHLL2: { + U: 0b0, opcode: 0b10100, + q: map[VectorArrangement]byte{VectorArrangement16B: 0b1, VectorArrangement8H: 0b1, VectorArrangement4S: 0b1}, + immResolver: immResolverForSIMDSiftLeftByImmediate, + }, + // https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/USHLL--USHLL2--Unsigned-Shift-Left-Long--immediate-- + USHLL: { + U: 0b1, opcode: 0b10100, + q: map[VectorArrangement]byte{VectorArrangement8B: 0b0, VectorArrangement4H: 0b0, VectorArrangement2S: 0b0}, + immResolver: immResolverForSIMDSiftLeftByImmediate, + }, + // https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/USHLL--USHLL2--Unsigned-Shift-Left-Long--immediate-- + USHLL2: { + U: 0b1, opcode: 0b10100, + q: map[VectorArrangement]byte{VectorArrangement16B: 0b1, VectorArrangement8H: 0b1, VectorArrangement4S: 0b1}, + immResolver: immResolverForSIMDSiftLeftByImmediate, + }, + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/SSHR--Signed-Shift-Right--immediate--?lang=en + SSHR: { + U: 0b0, opcode: 0b00000, + q: map[VectorArrangement]byte{ + VectorArrangement16B: 0b1, VectorArrangement8H: 0b1, VectorArrangement4S: 0b1, VectorArrangement2D: 0b1, + VectorArrangement8B: 0b0, VectorArrangement4H: 0b0, VectorArrangement2S: 0b0, + }, + immResolver: func(shiftAmount int64, arr VectorArrangement) (immh, immb byte, err error) { + switch arr { + case VectorArrangement16B, VectorArrangement8B: + immh = 0b0001 + immb = 8 - byte(shiftAmount&0b111) + case VectorArrangement8H, VectorArrangement4H: + v := 16 - byte(shiftAmount&0b1111) + immb = v & 0b111 + immh = 0b0010 | (v >> 3) + case VectorArrangement4S, VectorArrangement2S: + v := 32 - byte(shiftAmount&0b11111) + immb = v & 0b111 + immh = 0b0100 | (v >> 3) + case VectorArrangement2D: + v := 64 - byte(shiftAmount&0b111111) + immb = v & 0b111 + immh = 0b1000 | (v >> 3) + default: + err = fmt.Errorf("unsupported arrangement %s", arr) + } + return + }, + }, +} + +// advancedSIMDPermute holds information to encode instructions as "Advanced SIMD permute" in +// https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en +var advancedSIMDPermute = map[asm.Instruction]struct { + opcode byte +}{ + ZIP1: {opcode: 0b011}, +} + +func immResolverForSIMDSiftLeftByImmediate(shiftAmount int64, arr VectorArrangement) (immh, immb byte, err error) { + switch arr { + case VectorArrangement16B, VectorArrangement8B: + immb = byte(shiftAmount) + immh = 0b0001 + case VectorArrangement8H, VectorArrangement4H: + immb = byte(shiftAmount) & 0b111 + immh = 0b0010 | byte(shiftAmount>>3) + case VectorArrangement4S, VectorArrangement2S: + immb = byte(shiftAmount) & 0b111 + immh = 0b0100 | byte(shiftAmount>>3) + default: + err = fmt.Errorf("unsupported arrangement %s", arr) + } + return +} + +// encodeAdvancedSIMDCopy encodes instruction as "Advanced SIMD copy" in +// https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en +func (a *AssemblerImpl) encodeAdvancedSIMDCopy(buf asm.Buffer, srcRegBits, dstRegBits, op, imm5, imm4, q byte) { + buf.Append4Bytes( + (srcRegBits<<5)|dstRegBits, + imm4<<3|0b1<<2|srcRegBits>>3, + imm5, + q<<6|op<<5|0b1110, + ) +} + +// encodeAdvancedSIMDThreeSame encodes instruction as "Advanced SIMD three same" in +// https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en +func (a *AssemblerImpl) encodeAdvancedSIMDThreeSame(buf asm.Buffer, src1, src2, dst, opcode, size, q, u byte) { + buf.Append4Bytes( + (src2<<5)|dst, + opcode<<3|1<<2|src2>>3, + size<<6|0b1<<5|src1, + q<<6|u<<5|0b1110, + ) +} + +// encodeAdvancedSIMDThreeDifferent encodes instruction as "Advanced SIMD three different" in +// https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en +func (a *AssemblerImpl) encodeAdvancedSIMDThreeDifferent(buf asm.Buffer, src1, src2, dst, opcode, size, q, u byte) { + buf.Append4Bytes( + (src2<<5)|dst, + opcode<<4|src2>>3, + size<<6|0b1<<5|src1, + q<<6|u<<5|0b1110, + ) +} + +// encodeAdvancedSIMDPermute encodes instruction as "Advanced SIMD permute" in +// https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en +func (a *AssemblerImpl) encodeAdvancedSIMDPermute(buf asm.Buffer, src1, src2, dst, opcode, size, q byte) { + buf.Append4Bytes( + (src2<<5)|dst, + opcode<<4|0b1<<3|src2>>3, + size<<6|src1, + q<<6|0b1110, + ) +} + +func (a *AssemblerImpl) encodeVectorRegisterToVectorRegister(buf asm.Buffer, n *nodeImpl) (err error) { + var srcVectorRegBits byte + if n.srcReg != RegRZR { + srcVectorRegBits, err = vectorRegisterBits(n.srcReg) + } else if n.instruction == CMEQZERO { + // CMEQZERO has RegRZR as the src, and we apply the instruction to the same register as the destination. + srcVectorRegBits, err = vectorRegisterBits(n.dstReg) + } + + if err != nil { + return err + } + + dstVectorRegBits, err := vectorRegisterBits(n.dstReg) + if err != nil { + return err + } + + if simdCopy, ok := advancedSIMDCopy[n.instruction]; ok { + imm5, imm4, q, err := simdCopy.resolver(n.srcVectorIndex, n.dstVectorIndex, n.vectorArrangement) + if err != nil { + return err + } + a.encodeAdvancedSIMDCopy(buf, srcVectorRegBits, dstVectorRegBits, simdCopy.op, imm5, imm4, q) + return nil + } + + if scalarPairwise, ok := advancedSIMDScalarPairwise[n.instruction]; ok { + // See "Advanced SIMD scalar pairwise" in + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en + size, ok := scalarPairwise.size[n.vectorArrangement] + if !ok { + return fmt.Errorf("unsupported vector arrangement %s for %s", n.vectorArrangement, InstructionName(n.instruction)) + } + buf.Append4Bytes( + (srcVectorRegBits<<5)|dstVectorRegBits, + scalarPairwise.opcode<<4|1<<3|srcVectorRegBits>>3, + size<<6|0b11<<4|scalarPairwise.opcode>>4, + 0b1<<6|scalarPairwise.u<<5|0b11110, + ) + return + } + + if twoRegMisc, ok := advancedSIMDTwoRegisterMisc[n.instruction]; ok { + // See "Advanced SIMD two-register miscellaneous" in + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en + qs, ok := twoRegMisc.qAndSize[n.vectorArrangement] + if !ok { + return fmt.Errorf("unsupported vector arrangement %s for %s", n.vectorArrangement, InstructionName(n.instruction)) + } + buf.Append4Bytes( + (srcVectorRegBits<<5)|dstVectorRegBits, + twoRegMisc.opcode<<4|0b1<<3|srcVectorRegBits>>3, + qs.size<<6|0b1<<5|twoRegMisc.opcode>>4, + qs.q<<6|twoRegMisc.u<<5|0b01110, + ) + return nil + } + + if threeSame, ok := advancedSIMDThreeSame[n.instruction]; ok { + qs, ok := threeSame.qAndSize[n.vectorArrangement] + if !ok { + return fmt.Errorf("unsupported vector arrangement %s for %s", n.vectorArrangement, InstructionName(n.instruction)) + } + a.encodeAdvancedSIMDThreeSame(buf, srcVectorRegBits, dstVectorRegBits, dstVectorRegBits, threeSame.opcode, qs.size, qs.q, threeSame.u) + return nil + } + + if threeDifferent, ok := advancedSIMDThreeDifferent[n.instruction]; ok { + qs, ok := threeDifferent.qAndSize[n.vectorArrangement] + if !ok { + return fmt.Errorf("unsupported vector arrangement %s for %s", n.vectorArrangement, InstructionName(n.instruction)) + } + a.encodeAdvancedSIMDThreeDifferent(buf, srcVectorRegBits, dstVectorRegBits, dstVectorRegBits, threeDifferent.opcode, qs.size, qs.q, threeDifferent.u) + return nil + } + + if acrossLanes, ok := advancedSIMDAcrossLanes[n.instruction]; ok { + // See "Advanced SIMD across lanes" in + // https://developer.arm.com/documentation/ddi0596/2021-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en + qs, ok := acrossLanes.qAndSize[n.vectorArrangement] + if !ok { + return fmt.Errorf("unsupported vector arrangement %s for %s", n.vectorArrangement, InstructionName(n.instruction)) + } + buf.Append4Bytes( + (srcVectorRegBits<<5)|dstVectorRegBits, + acrossLanes.opcode<<4|0b1<<3|srcVectorRegBits>>3, + qs.size<<6|0b11000<<1|acrossLanes.opcode>>4, + qs.q<<6|acrossLanes.u<<5|0b01110, + ) + return nil + } + + if lookup, ok := advancedSIMDTableLookup[n.instruction]; ok { + q, ok := lookup.q[n.vectorArrangement] + if !ok { + return fmt.Errorf("unsupported vector arrangement %s for %s", n.vectorArrangement, InstructionName(n.instruction)) + } + buf.Append4Bytes( + (srcVectorRegBits<<5)|dstVectorRegBits, + lookup.Len<<5|lookup.op<<4|srcVectorRegBits>>3, + lookup.op2<<6|dstVectorRegBits, + q<<6|0b1110, + ) + return + } + + if shiftByImmediate, ok := advancedSIMDShiftByImmediate[n.instruction]; ok { + immh, immb, err := shiftByImmediate.immResolver(n.srcConst, n.vectorArrangement) + if err != nil { + return err + } + + q, ok := shiftByImmediate.q[n.vectorArrangement] + if !ok { + return fmt.Errorf("unsupported vector arrangement %s for %s", n.vectorArrangement, InstructionName(n.instruction)) + } + + buf.Append4Bytes( + (srcVectorRegBits<<5)|dstVectorRegBits, + shiftByImmediate.opcode<<3|0b1<<2|srcVectorRegBits>>3, + immh<<3|immb, + q<<6|shiftByImmediate.U<<5|0b1111, + ) + return nil + } + + if permute, ok := advancedSIMDPermute[n.instruction]; ok { + size, q := arrangementSizeQ(n.vectorArrangement) + a.encodeAdvancedSIMDPermute(buf, srcVectorRegBits, dstVectorRegBits, dstVectorRegBits, permute.opcode, size, q) + return + } + return errorEncodingUnsupported(n) +} + +func (a *AssemblerImpl) encodeTwoVectorRegistersToVectorRegister(buf asm.Buffer, n *nodeImpl) (err error) { + var srcRegBits, srcRegBits2, dstRegBits byte + srcRegBits, err = vectorRegisterBits(n.srcReg) + if err != nil { + return err + } + + srcRegBits2, err = vectorRegisterBits(n.srcReg2) + if err != nil { + return err + } + + dstRegBits, err = vectorRegisterBits(n.dstReg) + if err != nil { + return err + } + + if threeSame, ok := advancedSIMDThreeSame[n.instruction]; ok { + qs, ok := threeSame.qAndSize[n.vectorArrangement] + if !ok { + return fmt.Errorf("unsupported vector arrangement %s for %s", n.vectorArrangement, InstructionName(n.instruction)) + } + a.encodeAdvancedSIMDThreeSame(buf, srcRegBits, srcRegBits2, dstRegBits, threeSame.opcode, qs.size, qs.q, threeSame.u) + return nil + } + + if threeDifferent, ok := advancedSIMDThreeDifferent[n.instruction]; ok { + qs, ok := threeDifferent.qAndSize[n.vectorArrangement] + if !ok { + return fmt.Errorf("unsupported vector arrangement %s for %s", n.vectorArrangement, InstructionName(n.instruction)) + } + a.encodeAdvancedSIMDThreeDifferent(buf, srcRegBits, srcRegBits2, dstRegBits, threeDifferent.opcode, qs.size, qs.q, threeDifferent.u) + return nil + } + + if permute, ok := advancedSIMDPermute[n.instruction]; ok { + size, q := arrangementSizeQ(n.vectorArrangement) + a.encodeAdvancedSIMDPermute(buf, srcRegBits, srcRegBits2, dstRegBits, permute.opcode, size, q) + return + } + + if n.instruction == EXT { + // EXT is the only instruction in "Advanced SIMD extract", so inline the encoding here. + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/EXT--Extract-vector-from-pair-of-vectors-?lang=en + var q, imm4 byte + switch n.vectorArrangement { + case VectorArrangement16B: + imm4 = 0b1111 & byte(n.srcConst) + q = 0b1 + case VectorArrangement8B: + imm4 = 0b111 & byte(n.srcConst) + default: + return fmt.Errorf("invalid arrangement %s for EXT", n.vectorArrangement) + } + buf.Append4Bytes( + (srcRegBits2<<5)|dstRegBits, + imm4<<3|srcRegBits2>>3, + srcRegBits, + q<<6|0b101110, + ) + return + } + return +} + +func (a *AssemblerImpl) encodeVectorRegisterToRegister(buf asm.Buffer, n *nodeImpl) (err error) { + if err = checkArrangementIndexPair(n.vectorArrangement, n.srcVectorIndex); err != nil { + return + } + + srcVecRegBits, err := vectorRegisterBits(n.srcReg) + if err != nil { + return err + } + + dstRegBits, err := intRegisterBits(n.dstReg) + if err != nil { + return err + } + + if simdCopy, ok := advancedSIMDCopy[n.instruction]; ok { + imm5, imm4, q, err := simdCopy.resolver(n.srcVectorIndex, n.dstVectorIndex, n.vectorArrangement) + if err != nil { + return err + } + a.encodeAdvancedSIMDCopy(buf, srcVecRegBits, dstRegBits, simdCopy.op, imm5, imm4, q) + return nil + } + return errorEncodingUnsupported(n) +} + +func (a *AssemblerImpl) encodeRegisterToVectorRegister(buf asm.Buffer, n *nodeImpl) (err error) { + srcRegBits, err := intRegisterBits(n.srcReg) + if err != nil { + return err + } + + dstVectorRegBits, err := vectorRegisterBits(n.dstReg) + if err != nil { + return err + } + + if simdCopy, ok := advancedSIMDCopy[n.instruction]; ok { + imm5, imm4, q, err := simdCopy.resolver(n.srcVectorIndex, n.dstVectorIndex, n.vectorArrangement) + if err != nil { + return err + } + a.encodeAdvancedSIMDCopy(buf, srcRegBits, dstVectorRegBits, simdCopy.op, imm5, imm4, q) + return nil + } + return errorEncodingUnsupported(n) +} + +var zeroRegisterBits byte = 0b11111 + +func isIntRegister(r asm.Register) bool { + return RegR0 <= r && r <= RegSP +} + +func isVectorRegister(r asm.Register) bool { + return RegV0 <= r && r <= RegV31 +} + +func isConditionalRegister(r asm.Register) bool { + return RegCondEQ <= r && r <= RegCondNV +} + +func intRegisterBits(r asm.Register) (ret byte, err error) { + if !isIntRegister(r) { + err = fmt.Errorf("%s is not integer", RegisterName(r)) + } else if r == RegSP { + // SP has the same bit representations as RegRZR. + r = RegRZR + } + ret = byte(r - RegR0) + return +} + +func vectorRegisterBits(r asm.Register) (ret byte, err error) { + if !isVectorRegister(r) { + err = fmt.Errorf("%s is not vector", RegisterName(r)) + } else { + ret = byte(r - RegV0) + } + return +} + +func registerBits(r asm.Register) (ret byte) { + if isIntRegister(r) { + if r == RegSP { + // SP has the same bit representations as RegRZR. + r = RegRZR + } + ret = byte(r - RegR0) + } else { + ret = byte(r - RegV0) + } + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/asm/assembler.go b/vendor/github.com/tetratelabs/wazero/internal/asm/assembler.go new file mode 100644 index 000000000..dd34f7863 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/asm/assembler.go @@ -0,0 +1,209 @@ +package asm + +import ( + "fmt" + "math" +) + +// Register represents architecture-specific registers. +type Register byte + +// NilRegister is the only architecture-independent register, and +// can be used to indicate that no register is specified. +const NilRegister Register = 0 + +// Instruction represents architecture-specific instructions. +type Instruction uint16 // to accommodate the high cardinality of vector ops + +// ConditionalRegisterState represents architecture-specific conditional +// register's states. +type ConditionalRegisterState byte + +// ConditionalRegisterStateUnset is the only architecture-independent conditional state, and +// can be used to indicate that no conditional state is specified. +const ConditionalRegisterStateUnset ConditionalRegisterState = 0 + +// Node represents a node in the linked list of assembled operations. +type Node interface { + fmt.Stringer + + // AssignJumpTarget assigns the given target node as the destination of + // jump instruction for this Node. + AssignJumpTarget(target Node) + + // AssignDestinationConstant assigns the given constant as the destination + // of the instruction for this node. + AssignDestinationConstant(value ConstantValue) + + // AssignSourceConstant assigns the given constant as the source + // of the instruction for this node. + AssignSourceConstant(value ConstantValue) + + // OffsetInBinary returns the offset of this node in the assembled binary. + OffsetInBinary() NodeOffsetInBinary +} + +// NodeOffsetInBinary represents an offset of this node in the final binary. +type NodeOffsetInBinary = uint64 + +// ConstantValue represents a constant value used in an instruction. +type ConstantValue = int64 + +// StaticConst represents an arbitrary constant bytes which are pooled and emitted by assembler into the binary. +// These constants can be referenced by instructions. +type StaticConst struct { + // offsetFinalizedCallbacks holds callbacks which are called when .OffsetInBinary is finalized by assembler implementation. + offsetFinalizedCallbacks []func(offsetOfConstInBinary uint64) + + Raw []byte + // OffsetInBinary is the offset of this static const in the result binary. + OffsetInBinary uint64 +} + +// NewStaticConst returns the pointer to the new NewStaticConst for given bytes. +func NewStaticConst(raw []byte) *StaticConst { + return &StaticConst{Raw: raw} +} + +// AddOffsetFinalizedCallback adds a callback into offsetFinalizedCallbacks. +func (s *StaticConst) AddOffsetFinalizedCallback(cb func(offsetOfConstInBinary uint64)) { + s.offsetFinalizedCallbacks = append(s.offsetFinalizedCallbacks, cb) +} + +// SetOffsetInBinary finalizes the offset of this StaticConst, and invokes callbacks. +func (s *StaticConst) SetOffsetInBinary(offset uint64) { + s.OffsetInBinary = offset + for _, cb := range s.offsetFinalizedCallbacks { + cb(offset) + } +} + +// StaticConstPool holds a bulk of StaticConst which are yet to be emitted into the binary. +type StaticConstPool struct { + // addedConsts is used to deduplicate the consts to reduce the final size of binary. + // Note: we can use map on .consts field and remove this field, + // but we have the separate field for deduplication in order to have deterministic assembling behavior. + addedConsts map[*StaticConst]struct{} + + Consts []*StaticConst + // FirstUseOffsetInBinary holds the offset of the first instruction which accesses this const pool . + FirstUseOffsetInBinary NodeOffsetInBinary + // PoolSizeInBytes is the current size of the pool in bytes. + PoolSizeInBytes int +} + +func NewStaticConstPool() StaticConstPool { + return StaticConstPool{addedConsts: map[*StaticConst]struct{}{}, FirstUseOffsetInBinary: math.MaxUint64} +} + +// Reset resets the *StaticConstPool for reuse. +func (p *StaticConstPool) Reset() { + for _, c := range p.Consts { + delete(p.addedConsts, c) + } + // Reuse the slice to avoid re-allocations. + p.Consts = p.Consts[:0] + p.PoolSizeInBytes = 0 + p.FirstUseOffsetInBinary = math.MaxUint64 +} + +// Empty returns true if StaticConstPool is empty. +func (p *StaticConstPool) Empty() bool { + return p.FirstUseOffsetInBinary == math.MaxUint64 +} + +// AddConst adds a *StaticConst into the pool if it's not already added. +func (p *StaticConstPool) AddConst(c *StaticConst, useOffset NodeOffsetInBinary) { + if _, ok := p.addedConsts[c]; ok { + return + } + + if p.Empty() { + p.FirstUseOffsetInBinary = useOffset + } + + c.offsetFinalizedCallbacks = c.offsetFinalizedCallbacks[:0] + + p.Consts = append(p.Consts, c) + p.PoolSizeInBytes += len(c.Raw) + p.addedConsts[c] = struct{}{} +} + +// AssemblerBase is the common interface for assemblers among multiple architectures. +// +// Note: some of them can be implemented in an arch-independent way, but not all can be +// implemented as such. However, we intentionally put such arch-dependant methods here +// in order to provide the common documentation interface. +type AssemblerBase interface { + // Reset resets the state of Assembler implementation and mark it ready for + // the compilation of the new function compilation. + Reset() + + // Assemble produces the final binary for the assembled operations. + Assemble(Buffer) error + + // SetJumpTargetOnNext instructs the assembler that the next node must be + // assigned to the given node's jump destination. + SetJumpTargetOnNext(node Node) + + // BuildJumpTable calculates the offsets between the first instruction `initialInstructions[0]` + // and others (e.g. initialInstructions[3]), and wrote the calculated offsets into pre-allocated + // `table` StaticConst in little endian. + BuildJumpTable(table *StaticConst, initialInstructions []Node) + + // AllocateNOP allocates Node for NOP instruction. + AllocateNOP() Node + + // Add appends the given `Node` in the assembled linked list. + Add(Node) + + // CompileStandAlone adds an instruction to take no arguments. + CompileStandAlone(instruction Instruction) Node + + // CompileConstToRegister adds an instruction where source operand is `value` as constant and destination is `destinationReg` register. + CompileConstToRegister(instruction Instruction, value ConstantValue, destinationReg Register) Node + + // CompileRegisterToRegister adds an instruction where source and destination operands are registers. + CompileRegisterToRegister(instruction Instruction, from, to Register) + + // CompileMemoryToRegister adds an instruction where source operands is the memory address specified by `sourceBaseReg+sourceOffsetConst` + // and the destination is `destinationReg` register. + CompileMemoryToRegister( + instruction Instruction, + sourceBaseReg Register, + sourceOffsetConst ConstantValue, + destinationReg Register, + ) + + // CompileRegisterToMemory adds an instruction where source operand is `sourceRegister` register and the destination is the + // memory address specified by `destinationBaseRegister+destinationOffsetConst`. + CompileRegisterToMemory( + instruction Instruction, + sourceRegister Register, + destinationBaseRegister Register, + destinationOffsetConst ConstantValue, + ) + + // CompileJump adds jump-type instruction and returns the corresponding Node in the assembled linked list. + CompileJump(jmpInstruction Instruction) Node + + // CompileJumpToRegister adds jump-type instruction whose destination is the memory address specified by `reg` register. + CompileJumpToRegister(jmpInstruction Instruction, reg Register) + + // CompileReadInstructionAddress adds an ADR instruction to set the absolute address of "target instruction" + // into destinationRegister. "target instruction" is specified by beforeTargetInst argument and + // the target is determined by "the instruction right after beforeTargetInst type". + // + // For example, if `beforeTargetInst == RET` and we have the instruction sequence like + // `ADR -> X -> Y -> ... -> RET -> MOV`, then the `ADR` instruction emitted by this function set the absolute + // address of `MOV` instruction into the destination register. + CompileReadInstructionAddress(destinationRegister Register, beforeAcquisitionTargetInstruction Instruction) +} + +// JumpTableMaximumOffset represents the limit on the size of jump table in bytes. +// When users try loading an extremely large WebAssembly binary which contains a br_table +// statement with approximately 4294967296 (2^32) targets. Realistically speaking, that kind of binary +// could result in more than ten gigabytes of native compiled code where we have to care about +// huge stacks whose height might exceed 32-bit range, and such huge stack doesn't work with the +// current implementation. +const JumpTableMaximumOffset = math.MaxUint32 diff --git a/vendor/github.com/tetratelabs/wazero/internal/asm/buffer.go b/vendor/github.com/tetratelabs/wazero/internal/asm/buffer.go new file mode 100644 index 000000000..0476c380e --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/asm/buffer.go @@ -0,0 +1,235 @@ +package asm + +import ( + "encoding/binary" + "fmt" + "unsafe" + + "github.com/tetratelabs/wazero/internal/platform" +) + +var zero [16]byte + +// CodeSegment represents a memory mapped segment where native CPU instructions +// are written. +// +// To construct code segments, the program must call Next to obtain a buffer +// view capable of writing data at the end of the segment. Next must be called +// before generating the code of a function because it aligns the next write on +// 16 bytes. +// +// Instances of CodeSegment hold references to memory which is NOT managed by +// the garbage collector and therefore must be released *manually* by calling +// their Unmap method to prevent memory leaks. +// +// The zero value is a valid, empty code segment, equivalent to being +// constructed by calling NewCodeSegment(nil). +type CodeSegment struct { + code []byte + size int +} + +// NewCodeSegment constructs a CodeSegment value from a byte slice. +// +// No validation is made that the byte slice is a memory mapped region which can +// be unmapped on Close. +func NewCodeSegment(code []byte) *CodeSegment { + return &CodeSegment{code: code, size: len(code)} +} + +// Map allocates a memory mapping of the given size to the code segment. +// +// Note that programs only need to use this method to initialize the code +// segment to a specific content (e.g. when loading pre-compiled code from a +// file), otherwise the backing memory mapping is allocated on demand when code +// is written to the code segment via Buffers returned by calls to Next. +// +// The method errors is the segment is already backed by a memory mapping. +func (seg *CodeSegment) Map(size int) error { + if seg.code != nil { + return fmt.Errorf("code segment already initialized to memory mapping of size %d", len(seg.code)) + } + b, err := platform.MmapCodeSegment(size) + if err != nil { + return err + } + seg.code = b + seg.size = size + return nil +} + +// Close unmaps the underlying memory region held by the code segment, clearing +// its state back to an empty code segment. +// +// The value is still usable after unmapping its memory, a new memory area can +// be allocated by calling Map or writing to the segment. +func (seg *CodeSegment) Unmap() error { + if seg.code != nil { + if err := platform.MunmapCodeSegment(seg.code[:cap(seg.code)]); err != nil { + return err + } + seg.code = nil + seg.size = 0 + } + return nil +} + +// Addr returns the address of the beginning of the code segment as a uintptr. +func (seg *CodeSegment) Addr() uintptr { + if len(seg.code) > 0 { + return uintptr(unsafe.Pointer(&seg.code[0])) + } + return 0 +} + +// Size returns the size of code segment, which is less or equal to the length +// of the byte slice returned by Len or Bytes. +func (seg *CodeSegment) Size() uintptr { + return uintptr(seg.size) +} + +// Len returns the length of the byte slice referencing the memory mapping of +// the code segment. +func (seg *CodeSegment) Len() int { + return len(seg.code) +} + +// Bytes returns a byte slice to the memory mapping of the code segment. +// +// The returned slice remains valid until more bytes are written to a buffer +// of the code segment, or Unmap is called. +func (seg *CodeSegment) Bytes() []byte { + return seg.code +} + +// Next returns a buffer pointed at the end of the code segment to support +// writing more code instructions to it. +// +// Buffers are passed by value, but they hold a reference to the code segment +// that they were created from. +func (seg *CodeSegment) NextCodeSection() Buffer { + // Align 16-bytes boundary. + seg.AppendBytes(zero[:seg.size&15]) + return Buffer{CodeSegment: seg, off: seg.size} +} + +// Append appends n bytes to the code segment, returning a slice to the appended +// memory region. +// +// The underlying code segment may be reallocated if it was too short to hold +// n more bytes, which invalidates any addresses previously returned by calls +// to Addr. +func (seg *CodeSegment) Append(n int) []byte { + seg.size += n + if seg.size > len(seg.code) { + seg.growToSize() + } + return seg.code[seg.size-n:] +} + +// AppendByte appends a single byte to the code segment. +// +// The underlying code segment may be reallocated if it was too short to hold +// one more byte, which invalidates any addresses previously returned by calls +// to Addr. +func (seg *CodeSegment) AppendByte(b byte) { + seg.size++ + if seg.size > len(seg.code) { + seg.growToSize() + } + seg.code[seg.size-1] = b +} + +// AppendBytes appends a copy of b to the code segment. +// +// The underlying code segment may be reallocated if it was too short to hold +// len(b) more bytes, which invalidates any addresses previously returned by +// calls to Addr. +func (seg *CodeSegment) AppendBytes(b []byte) { + copy(seg.Append(len(b)), b) +} + +// AppendUint32 appends a 32 bits integer to the code segment. +// +// The underlying code segment may be reallocated if it was too short to hold +// four more bytes, which invalidates any addresses previously returned by calls +// to Addr. +func (seg *CodeSegment) AppendUint32(u uint32) { + seg.size += 4 + if seg.size > len(seg.code) { + seg.growToSize() + } + // This can be replaced by an unsafe operation to assign the uint32, which + // keeps the function cost below the inlining threshold. However, it did not + // show any improvements in arm64 benchmarks so we retained this safer code. + binary.LittleEndian.PutUint32(seg.code[seg.size-4:], u) +} + +// growMode grows the code segment so that another section can be added to it. +// +// The method is marked go:noinline so that it doesn't get inline in Append, +// and AppendByte, which keeps the inlining score of those methods low enough +// that they can be inlined at the call sites. +// +//go:noinline +func (seg *CodeSegment) growToSize() { + seg.Grow(0) +} + +// Grow ensure that the capacity of the code segment is large enough to hold n +// more bytes. +// +// The underlying code segment may be reallocated if it was too short, which +// invalidates any addresses previously returned by calls to Addr. +func (seg *CodeSegment) Grow(n int) { + size := len(seg.code) + want := seg.size + n + if size >= want { + return + } + if size == 0 { + size = 65536 + } + for size < want { + size *= 2 + } + b, err := platform.RemapCodeSegment(seg.code, size) + if err != nil { + // The only reason for growing the buffer to error is if we run + // out of memory, so panic for now as it greatly simplifies error + // handling to assume writing to the buffer would never fail. + panic(err) + } + seg.code = b +} + +// Buffer is a reference type representing a section beginning at the end of a +// code segment where new instructions can be written. +type Buffer struct { + *CodeSegment + off int +} + +func (buf Buffer) Cap() int { + return len(buf.code) - buf.off +} + +func (buf Buffer) Len() int { + return buf.size - buf.off +} + +func (buf Buffer) Bytes() []byte { + return buf.code[buf.off:buf.size:buf.size] +} + +func (buf Buffer) Reset() { + buf.size = buf.off +} + +func (buf Buffer) Truncate(n int) { + buf.size = buf.off + n +} + +func (buf Buffer) Append4Bytes(a, b, c, d byte) { + buf.AppendUint32(uint32(a) | uint32(b)<<8 | uint32(c)<<16 | uint32(d)<<24) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/asm/impl.go b/vendor/github.com/tetratelabs/wazero/internal/asm/impl.go new file mode 100644 index 000000000..6c5481637 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/asm/impl.go @@ -0,0 +1,59 @@ +package asm + +import ( + "encoding/binary" + "fmt" +) + +// BaseAssemblerImpl includes code common to all architectures. +// +// Note: When possible, add code here instead of in architecture-specific files to reduce drift: +// As this is internal, exporting symbols only to reduce duplication is ok. +type BaseAssemblerImpl struct { + // SetBranchTargetOnNextNodes holds branch kind instructions (BR, conditional BR, etc.) + // where we want to set the next coming instruction as the destination of these BR instructions. + SetBranchTargetOnNextNodes []Node + + // JumpTableEntries holds the information to build jump tables. + JumpTableEntries []JumpTableEntry +} + +// JumpTableEntry is the necessary data to build a jump table. +// This is exported for testing purpose. +type JumpTableEntry struct { + t *StaticConst + labelInitialInstructions []Node +} + +// SetJumpTargetOnNext implements AssemblerBase.SetJumpTargetOnNext +func (a *BaseAssemblerImpl) SetJumpTargetOnNext(node Node) { + a.SetBranchTargetOnNextNodes = append(a.SetBranchTargetOnNextNodes, node) +} + +// BuildJumpTable implements AssemblerBase.BuildJumpTable +func (a *BaseAssemblerImpl) BuildJumpTable(table *StaticConst, labelInitialInstructions []Node) { + a.JumpTableEntries = append(a.JumpTableEntries, JumpTableEntry{ + t: table, + labelInitialInstructions: labelInitialInstructions, + }) +} + +// FinalizeJumpTableEntry finalizes the build tables inside the given code. +func (a *BaseAssemblerImpl) FinalizeJumpTableEntry(code []byte) (err error) { + for i := range a.JumpTableEntries { + ent := &a.JumpTableEntries[i] + labelInitialInstructions := ent.labelInitialInstructions + table := ent.t + // Compile the offset table for each target. + base := labelInitialInstructions[0].OffsetInBinary() + for i, nop := range labelInitialInstructions { + if nop.OffsetInBinary()-base >= JumpTableMaximumOffset { + return fmt.Errorf("too large br_table") + } + // We store the offset from the beginning of the L0's initial instruction. + binary.LittleEndian.PutUint32(code[table.OffsetInBinary+uint64(i*4):table.OffsetInBinary+uint64((i+1)*4)], + uint32(nop.OffsetInBinary())-uint32(base)) + } + } + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/bitpack/offset_array.go b/vendor/github.com/tetratelabs/wazero/internal/bitpack/offset_array.go new file mode 100644 index 000000000..8cafd1882 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/bitpack/offset_array.go @@ -0,0 +1,224 @@ +package bitpack + +import ( + "math" +) + +// OffsetArray is an interface representing read-only views of arrays of 64 bits +// offsets. +type OffsetArray interface { + // Returns the value at index i. + // + // The method complexity may be anywhere between O(1) and O(N). + Index(i int) uint64 + // Returns the number of offsets in the array. + // + // The method complexity must be O(1). + Len() int +} + +// OffsetArrayLen is a helper function to access the length of an offset array. +// It is similar to calling Len on the array but handles the special case where +// the array is nil, in which case it returns zero. +func OffsetArrayLen(array OffsetArray) int { + if array != nil { + return array.Len() + } + return 0 +} + +// NewOffsetArray constructs a new array of offsets from the slice of values +// passed as argument. The slice is not retained, the returned array always +// holds a copy of the values. +// +// The underlying implementation of the offset array applies a compression +// mechanism derived from Frame-of-Reference and Delta Encoding to minimize +// the memory footprint of the array. This compression model works best when +// the input is made of ordered values, otherwise the deltas between values +// are likely to be too large to benefit from delta encoding. +// +// See https://lemire.me/blog/2012/02/08/effective-compression-using-frame-of-reference-and-delta-coding/ +func NewOffsetArray(values []uint64) OffsetArray { + if len(values) == 0 { + return emptyOffsetArray{} + } + if len(values) <= smallOffsetArrayCapacity { + return newSmallOffsetArray(values) + } + + maxDelta := uint64(0) + lastValue := values[0] + // TODO: the pre-processing we perform here can be optimized using SIMD + // instructions. + for _, value := range values[1:] { + if delta := value - lastValue; delta > maxDelta { + maxDelta = delta + } + lastValue = value + } + + switch { + case maxDelta > math.MaxUint32: + return newOffsetArray(values) + case maxDelta > math.MaxUint16: + return newDeltaArray[uint32](values) + case maxDelta > math.MaxUint8: + return newDeltaArray[uint16](values) + case maxDelta > 15: + return newDeltaArray[uint8](values) + default: + return newDeltaArrayUint4(values) + } +} + +type offsetArray struct { + values []uint64 +} + +func newOffsetArray(values []uint64) *offsetArray { + a := &offsetArray{ + values: make([]uint64, len(values)), + } + copy(a.values, values) + return a +} + +func (a *offsetArray) Index(i int) uint64 { + return a.values[i] +} + +func (a *offsetArray) Len() int { + return len(a.values) +} + +type emptyOffsetArray struct{} + +func (emptyOffsetArray) Index(int) uint64 { + panic("index out of bounds") +} + +func (emptyOffsetArray) Len() int { + return 0 +} + +const smallOffsetArrayCapacity = 7 + +type smallOffsetArray struct { + length int + values [smallOffsetArrayCapacity]uint64 +} + +func newSmallOffsetArray(values []uint64) *smallOffsetArray { + a := &smallOffsetArray{length: len(values)} + copy(a.values[:], values) + return a +} + +func (a *smallOffsetArray) Index(i int) uint64 { + if i < 0 || i >= a.length { + panic("index out of bounds") + } + return a.values[i] +} + +func (a *smallOffsetArray) Len() int { + return a.length +} + +type uintType interface { + uint8 | uint16 | uint32 | uint64 +} + +type deltaArray[T uintType] struct { + deltas []T + firstValue uint64 +} + +func newDeltaArray[T uintType](values []uint64) *deltaArray[T] { + a := &deltaArray[T]{ + deltas: make([]T, len(values)-1), + firstValue: values[0], + } + lastValue := values[0] + for i, value := range values[1:] { + a.deltas[i] = T(value - lastValue) + lastValue = value + } + return a +} + +func (a *deltaArray[T]) Index(i int) uint64 { + if i < 0 || i >= a.Len() { + panic("index out of bounds") + } + value := a.firstValue + // TODO: computing the prefix sum can be vectorized; + // see https://en.algorithmica.org/hpc/algorithms/prefix/ + for _, delta := range a.deltas[:i] { + value += uint64(delta) + } + return value +} + +func (a *deltaArray[T]) Len() int { + return len(a.deltas) + 1 +} + +// deltaArrayUint4 is a specialization of deltaArray which packs 4 bits integers +// to hold deltas between 0 and 15; based on the analysis of compiling Python, +// it appeared that most source offset deltas were under 16, so using this +// data structure cuts by 50% the memory needed compared to deltaArray[uint8]. +// +// Here is the distribution of source offset deltas for Python 3.13: +// +// - <=15 : 10240 +// - <=255 : 9565 +// - <=65535 : 1163 +// +// Memory profiles showed that using deltaArrayUint4 (compared to deltaArray[T]) +// dropped the memory footprint of source mappings for Python from 6MB to 4.5MB. +type deltaArrayUint4 struct { + deltas []byte + numValues int + firstValue uint64 +} + +func newDeltaArrayUint4(values []uint64) *deltaArrayUint4 { + a := &deltaArrayUint4{ + deltas: make([]byte, len(values)/2+1), + numValues: len(values), + firstValue: values[0], + } + lastValue := values[0] + for i, value := range values[1:] { + a.assign(i, value-lastValue) + lastValue = value + } + return a +} + +func (a *deltaArrayUint4) assign(i int, v uint64) { + index, shift := uint(i)>>1, 4*(uint(i)&1) + a.deltas[index] &= ^(0xF << shift) + a.deltas[index] |= byte(v) << shift +} + +func (a *deltaArrayUint4) index(i int) uint64 { + index, shift := uint(i)>>1, 4*(uint(i)&1) + return uint64((a.deltas[index] >> shift) & 0xF) +} + +func (a *deltaArrayUint4) Index(i int) uint64 { + if i < 0 || i >= a.Len() { + panic("index out of bounds") + } + value := a.firstValue + for j := 0; j < i; j++ { + value += a.index(j) + } + return value +} + +func (a *deltaArrayUint4) Len() int { + return a.numValues +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/close/close.go b/vendor/github.com/tetratelabs/wazero/internal/close/close.go new file mode 100644 index 000000000..33b39b1e2 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/close/close.go @@ -0,0 +1,13 @@ +// Package close allows experimental.CloseNotifier without introducing a +// package cycle. +package close + +import "context" + +// NotifierKey is a context.Context Value key. Its associated value should be a +// Notifier. +type NotifierKey struct{} + +type Notifier interface { + CloseNotify(ctx context.Context, exitCode uint32) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/descriptor/table.go b/vendor/github.com/tetratelabs/wazero/internal/descriptor/table.go new file mode 100644 index 000000000..542958bc7 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/descriptor/table.go @@ -0,0 +1,164 @@ +package descriptor + +import "math/bits" + +// Table is a data structure mapping 32 bit descriptor to items. +// +// # Negative keys are invalid. +// +// Negative keys (e.g. -1) are invalid inputs and will return a corresponding +// not-found value. This matches POSIX behavior of file descriptors. +// See https://pubs.opengroup.org/onlinepubs/9699919799/functions/dirfd.html#tag_16_90 +// +// # Data structure design +// +// The data structure optimizes for memory density and lookup performance, +// trading off compute at insertion time. This is a useful compromise for the +// use cases we employ it with: items are usually accessed a lot more often +// than they are inserted, each operation requires a table lookup, so we are +// better off spending extra compute to insert items in the table in order to +// get cheaper lookups. Memory efficiency is also crucial to support scaling +// with programs that maintain thousands of items: having a high or non-linear +// memory-to-item ratio could otherwise be used as an attack vector by +// malicious applications attempting to damage performance of the host. +type Table[Key ~int32, Item any] struct { + masks []uint64 + items []Item +} + +// Len returns the number of items stored in the table. +func (t *Table[Key, Item]) Len() (n int) { + // We could make this a O(1) operation if we cached the number of items in + // the table. More state usually means more problems, so until we have a + // clear need for this, the simple implementation may be a better trade off. + for _, mask := range t.masks { + n += bits.OnesCount64(mask) + } + return n +} + +// grow ensures that t has enough room for n items, potentially reallocating the +// internal buffers if their capacity was too small to hold this many items. +func (t *Table[Key, Item]) grow(n int) { + // Round up to a multiple of 64 since this is the smallest increment due to + // using 64 bits masks. + n = (n*64 + 63) / 64 + + if n > len(t.masks) { + masks := make([]uint64, n) + copy(masks, t.masks) + + items := make([]Item, n*64) + copy(items, t.items) + + t.masks = masks + t.items = items + } +} + +// Insert inserts the given item to the table, returning the key that it is +// mapped to or false if the table was full. +// +// The method does not perform deduplication, it is possible for the same item +// to be inserted multiple times, each insertion will return a different key. +func (t *Table[Key, Item]) Insert(item Item) (key Key, ok bool) { + offset := 0 +insert: + // Note: this loop could be made a lot more efficient using vectorized + // operations: 256 bits vector registers would yield a theoretical 4x + // speed up (e.g. using AVX2). + for index, mask := range t.masks[offset:] { + if ^mask != 0 { // not full? + shift := bits.TrailingZeros64(^mask) + index += offset + key = Key(index)*64 + Key(shift) + t.items[key] = item + t.masks[index] = mask | uint64(1<= 0 + } + } + + offset = len(t.masks) + n := 2 * len(t.masks) + if n == 0 { + n = 1 + } + + t.grow(n) + goto insert +} + +// Lookup returns the item associated with the given key (may be nil). +func (t *Table[Key, Item]) Lookup(key Key) (item Item, found bool) { + if key < 0 { // invalid key + return + } + if i := int(key); i >= 0 && i < len(t.items) { + index := uint(key) / 64 + shift := uint(key) % 64 + if (t.masks[index] & (1 << shift)) != 0 { + item, found = t.items[i], true + } + } + return +} + +// InsertAt inserts the given `item` at the item descriptor `key`. This returns +// false if the insert was impossible due to negative key. +func (t *Table[Key, Item]) InsertAt(item Item, key Key) bool { + if key < 0 { + return false + } + if diff := int(key) - t.Len(); diff > 0 { + t.grow(diff) + } + index := uint(key) / 64 + shift := uint(key) % 64 + t.masks[index] |= 1 << shift + t.items[key] = item + return true +} + +// Delete deletes the item stored at the given key from the table. +func (t *Table[Key, Item]) Delete(key Key) { + if key < 0 { // invalid key + return + } + if index, shift := key/64, key%64; int(index) < len(t.masks) { + mask := t.masks[index] + if (mask & (1 << shift)) != 0 { + var zero Item + t.items[key] = zero + t.masks[index] = mask & ^uint64(1< arm64.RegSP { + // Skips arm64.RegSP which is not a real register. + ret-- + } + return +} + +func registerFromMaskShift(s int) asm.Register { + if s < 32 { + return arm64.RegR0 + asm.Register(s) + } else { + // Skips arm64.RegSP which is not a real register. + return arm64.RegR0 + asm.Register(s) + 1 + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/arch_arm64.s b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/arch_arm64.s new file mode 100644 index 000000000..bec947286 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/arch_arm64.s @@ -0,0 +1,21 @@ +#include "funcdata.h" +#include "textflag.h" + +// nativecall(codeSegment, ce, moduleInstanceAddress) +TEXT Ā·nativecall(SB), NOSPLIT|NOFRAME, $0-24 + // Load the address of *callEngine into arm64ReservedRegisterForCallEngine. + MOVD ce+8(FP), R0 + + // In arm64, return address is stored in R30 after jumping into the code. + // We save the return address value into archContext.compilerReturnAddress in Engine. + // Note that the const 144 drifts after editting Engine or archContext struct. See TestArchContextOffsetInEngine. + MOVD R30, 144(R0) + + // Load the address of *wasm.ModuleInstance into arm64CallingConventionModuleInstanceAddressRegister. + MOVD moduleInstanceAddress+16(FP), R29 + + // Load the address of native code. + MOVD codeSegment+0(FP), R1 + + // Jump to native code. + JMP (R1) diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/arch_other.go b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/arch_other.go new file mode 100644 index 000000000..e53ac8dff --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/arch_other.go @@ -0,0 +1,26 @@ +//go:build !amd64 && !arm64 + +package compiler + +import ( + "fmt" + "runtime" + + "github.com/tetratelabs/wazero/internal/asm" +) + +// archContext is empty on an unsupported architecture. +type archContext struct{} + +// newCompiler panics with an unsupported error. +func newCompiler() compiler { + panic(fmt.Sprintf("unsupported GOARCH %s", runtime.GOARCH)) +} + +func registerMaskShift(r asm.Register) (ret int) { + panic(fmt.Sprintf("unsupported GOARCH %s", runtime.GOARCH)) +} + +func registerFromMaskShift(s int) asm.Register { + panic(fmt.Sprintf("unsupported GOARCH %s", runtime.GOARCH)) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/arch_other.s b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/arch_other.s new file mode 100644 index 000000000..ad057fbb2 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/arch_other.s @@ -0,0 +1,3 @@ +//go:build !arm64 && !amd64 + +TEXT Ā·nativecall(SB), $0-16 diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/compiler.go b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/compiler.go new file mode 100644 index 000000000..b2c79becc --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/compiler.go @@ -0,0 +1,335 @@ +package compiler + +import ( + "github.com/tetratelabs/wazero/internal/asm" + "github.com/tetratelabs/wazero/internal/wasm" + "github.com/tetratelabs/wazero/internal/wazeroir" +) + +// compiler is the interface of architecture-specific native code compiler, +// and this is responsible for compiling native code for all wazeroir operations. +type compiler interface { + Init(functionType *wasm.FunctionType, ir *wazeroir.CompilationResult, withListener bool) + + // String is for debugging purpose. + String() string + // compilePreamble is called before compiling any wazeroir operation. + // This is used, for example, to initialize the reserved registers, etc. + compilePreamble() error + // compile generates the native code into buf. + // stackPointerCeil is the max stack pointer that the target function would reach. + compile(buf asm.Buffer) (stackPointerCeil uint64, err error) + // compileGoHostFunction adds the trampoline code from which native code can jump into the Go-defined host function. + // TODO: maybe we wouldn't need to have trampoline for host functions. + compileGoDefinedHostFunction() error + // compileLabel notify compilers of the beginning of a label. + // Return true if the compiler decided to skip the entire label. + // See wazeroir.NewOperationLabel + compileLabel(o *wazeroir.UnionOperation) (skipThisLabel bool) + // compileUnreachable adds instruction to perform wazeroir.OperationUnreachable. + compileUnreachable() error + // compileSet adds instruction to perform wazeroir.OperationSet. + compileSet(o *wazeroir.UnionOperation) error + // compileGlobalGet adds instructions to perform wazeroir.OperationGlobalGet. + compileGlobalGet(o *wazeroir.UnionOperation) error + // compileGlobalSet adds instructions to perform wazeroir.OperationGlobalSet. + compileGlobalSet(o *wazeroir.UnionOperation) error + // compileBr adds instructions to perform wazeroir.NewOperationBr. + compileBr(o *wazeroir.UnionOperation) error + // compileBrIf adds instructions to perform wazeroir.NewOperationBrIf. + compileBrIf(o *wazeroir.UnionOperation) error + // compileBrTable adds instructions to perform wazeroir.NewOperationBrTable. + compileBrTable(o *wazeroir.UnionOperation) error + // compileCall adds instructions to perform wazeroir.OperationCall. + compileCall(o *wazeroir.UnionOperation) error + // compileCallIndirect adds instructions to perform wazeroir.OperationCallIndirect. + compileCallIndirect(o *wazeroir.UnionOperation) error + // compileDrop adds instructions to perform wazeroir.NewOperationDrop. + compileDrop(o *wazeroir.UnionOperation) error + // compileSelect adds instructions to perform wazeroir.OperationSelect. + compileSelect(o *wazeroir.UnionOperation) error + // compilePick adds instructions to perform wazeroir.OperationPick. + compilePick(o *wazeroir.UnionOperation) error + // compileAdd adds instructions to perform wazeroir.OperationAdd. + compileAdd(o *wazeroir.UnionOperation) error + // compileSub adds instructions to perform wazeroir.OperationSub. + compileSub(o *wazeroir.UnionOperation) error + // compileMul adds instructions to perform wazeroir.OperationMul. + compileMul(o *wazeroir.UnionOperation) error + // compileClz adds instructions to perform wazeroir.OperationClz. + compileClz(o *wazeroir.UnionOperation) error + // compileCtz adds instructions to perform wazeroir.OperationCtz. + compileCtz(o *wazeroir.UnionOperation) error + // compilePopcnt adds instructions to perform wazeroir.OperationPopcnt. + compilePopcnt(o *wazeroir.UnionOperation) error + // compileDiv adds instructions to perform wazeroir.OperationDiv. + compileDiv(o *wazeroir.UnionOperation) error + // compileRem adds instructions to perform wazeroir.OperationRem. + compileRem(o *wazeroir.UnionOperation) error + // compileAnd adds instructions to perform wazeroir.OperationAnd. + compileAnd(o *wazeroir.UnionOperation) error + // compileOr adds instructions to perform wazeroir.OperationOr. + compileOr(o *wazeroir.UnionOperation) error + // compileXor adds instructions to perform wazeroir.OperationXor. + compileXor(o *wazeroir.UnionOperation) error + // compileShl adds instructions to perform wazeroir.OperationShl. + compileShl(o *wazeroir.UnionOperation) error + // compileShr adds instructions to perform wazeroir.OperationShr. + compileShr(o *wazeroir.UnionOperation) error + // compileRotl adds instructions to perform wazeroir.OperationRotl. + compileRotl(o *wazeroir.UnionOperation) error + // compileRotr adds instructions to perform wazeroir.OperationRotr. + compileRotr(o *wazeroir.UnionOperation) error + // compileNeg adds instructions to perform wazeroir.OperationAbs. + compileAbs(o *wazeroir.UnionOperation) error + // compileNeg adds instructions to perform wazeroir.OperationNeg. + compileNeg(o *wazeroir.UnionOperation) error + // compileCeil adds instructions to perform wazeroir.OperationCeil. + compileCeil(o *wazeroir.UnionOperation) error + // compileFloor adds instructions to perform wazeroir.OperationFloor. + compileFloor(o *wazeroir.UnionOperation) error + // compileTrunc adds instructions to perform wazeroir.OperationTrunc. + compileTrunc(o *wazeroir.UnionOperation) error + // compileNearest adds instructions to perform wazeroir.OperationNearest. + compileNearest(o *wazeroir.UnionOperation) error + // compileSqrt adds instructions perform wazeroir.OperationSqrt. + compileSqrt(o *wazeroir.UnionOperation) error + // compileMin adds instructions perform wazeroir.OperationMin. + compileMin(o *wazeroir.UnionOperation) error + // compileMax adds instructions perform wazeroir.OperationMax. + compileMax(o *wazeroir.UnionOperation) error + // compileCopysign adds instructions to perform wazeroir.OperationCopysign. + compileCopysign(o *wazeroir.UnionOperation) error + // compileI32WrapFromI64 adds instructions to perform wazeroir.OperationI32WrapFromI64. + compileI32WrapFromI64() error + // compileITruncFromF adds instructions to perform wazeroir.NewOperationITruncFromF. + compileITruncFromF(o *wazeroir.UnionOperation) error + // compileFConvertFromI adds instructions to perform wazeroir.NewOperationFConvertFromI. + compileFConvertFromI(o *wazeroir.UnionOperation) error + // compileF32DemoteFromF64 adds instructions to perform wazeroir.OperationF32DemoteFromF64. + compileF32DemoteFromF64() error + // compileF64PromoteFromF32 adds instructions to perform wazeroir.OperationF64PromoteFromF32. + compileF64PromoteFromF32() error + // compileI32ReinterpretFromF32 adds instructions to perform wazeroir.OperationI32ReinterpretFromF32. + compileI32ReinterpretFromF32() error + // compileI64ReinterpretFromF64 adds instructions to perform wazeroir.OperationI64ReinterpretFromF64. + compileI64ReinterpretFromF64() error + // compileF32ReinterpretFromI32 adds instructions to perform wazeroir.OperationF32ReinterpretFromI32. + compileF32ReinterpretFromI32() error + // compileF64ReinterpretFromI64 adds instructions to perform wazeroir.OperationF64ReinterpretFromI64. + compileF64ReinterpretFromI64() error + // compileExtend adds instructions to perform wazeroir.NewOperationExtend. + compileExtend(o *wazeroir.UnionOperation) error + // compileEq adds instructions to perform wazeroir.OperationEq. + compileEq(o *wazeroir.UnionOperation) error + // compileEq adds instructions to perform wazeroir.OperationNe. + compileNe(o *wazeroir.UnionOperation) error + // compileEq adds instructions to perform wazeroir.OperationEqz. + compileEqz(o *wazeroir.UnionOperation) error + // compileLt adds instructions to perform wazeroir.OperationLt. + compileLt(o *wazeroir.UnionOperation) error + // compileGt adds instructions to perform wazeroir.OperationGt. + compileGt(o *wazeroir.UnionOperation) error + // compileLe adds instructions to perform wazeroir.OperationLe. + compileLe(o *wazeroir.UnionOperation) error + // compileLe adds instructions to perform wazeroir.OperationGe. + compileGe(o *wazeroir.UnionOperation) error + // compileLoad adds instructions to perform wazeroir.OperationLoad. + compileLoad(o *wazeroir.UnionOperation) error + // compileLoad8 adds instructions to perform wazeroir.OperationLoad8. + compileLoad8(o *wazeroir.UnionOperation) error + // compileLoad16 adds instructions to perform wazeroir.OperationLoad16. + compileLoad16(o *wazeroir.UnionOperation) error + // compileLoad32 adds instructions to perform wazeroir.OperationLoad32. + compileLoad32(o *wazeroir.UnionOperation) error + // compileStore adds instructions to perform wazeroir.OperationStore. + compileStore(o *wazeroir.UnionOperation) error + // compileStore8 adds instructions to perform wazeroir.OperationStore8. + compileStore8(o *wazeroir.UnionOperation) error + // compileStore16 adds instructions to perform wazeroir.OperationStore16. + compileStore16(o *wazeroir.UnionOperation) error + // compileStore32 adds instructions to perform wazeroir.OperationStore32. + compileStore32(o *wazeroir.UnionOperation) error + // compileMemorySize adds instruction to perform wazeroir.OperationMemoryGrow. + compileMemoryGrow() error + // compileMemorySize adds instruction to perform wazeroir.OperationMemorySize. + compileMemorySize() error + // compileConstI32 adds instruction to perform wazeroir.NewOperationConstI32. + compileConstI32(o *wazeroir.UnionOperation) error + // compileConstI64 adds instruction to perform wazeroir.NewOperationConstI64. + compileConstI64(o *wazeroir.UnionOperation) error + // compileConstF32 adds instruction to perform wazeroir.NewOperationConstF32. + compileConstF32(o *wazeroir.UnionOperation) error + // compileConstF64 adds instruction to perform wazeroir.NewOperationConstF64. + compileConstF64(o *wazeroir.UnionOperation) error + // compileSignExtend32From8 adds instructions to perform wazeroir.OperationSignExtend32From8. + compileSignExtend32From8() error + // compileSignExtend32From16 adds instructions to perform wazeroir.OperationSignExtend32From16. + compileSignExtend32From16() error + // compileSignExtend64From8 adds instructions to perform wazeroir.OperationSignExtend64From8. + compileSignExtend64From8() error + // compileSignExtend64From16 adds instructions to perform wazeroir.OperationSignExtend64From16. + compileSignExtend64From16() error + // compileSignExtend64From32 adds instructions to perform wazeroir.OperationSignExtend64From32. + compileSignExtend64From32() error + // compileMemoryInit adds instructions to perform wazeroir.NewOperationMemoryInit. + compileMemoryInit(*wazeroir.UnionOperation) error + // compileDataDrop adds instructions to perform wazeroir.NewOperationDataDrop. + compileDataDrop(*wazeroir.UnionOperation) error + // compileMemoryCopy adds instructions to perform wazeroir.OperationMemoryCopy. + compileMemoryCopy() error + // compileMemoryFill adds instructions to perform wazeroir.OperationMemoryFill. + compileMemoryFill() error + // compileTableInit adds instructions to perform wazeroir.NewOperationTableInit. + compileTableInit(*wazeroir.UnionOperation) error + // compileTableCopy adds instructions to perform wazeroir.NewOperationTableCopy. + compileTableCopy(*wazeroir.UnionOperation) error + // compileElemDrop adds instructions to perform wazeroir.NewOperationElemDrop. + compileElemDrop(*wazeroir.UnionOperation) error + // compileRefFunc adds instructions to perform wazeroir.NewOperationRefFunc. + compileRefFunc(*wazeroir.UnionOperation) error + // compileTableGet adds instructions to perform wazeroir.NewOperationTableGet. + compileTableGet(*wazeroir.UnionOperation) error + // compileTableSet adds instructions to perform wazeroir.NewOperationTableSet. + compileTableSet(*wazeroir.UnionOperation) error + // compileTableGrow adds instructions to perform wazeroir.NewOperationTableGrow. + compileTableGrow(*wazeroir.UnionOperation) error + // compileTableSize adds instructions to perform wazeroir.NewOperationTableSize. + compileTableSize(*wazeroir.UnionOperation) error + // compileTableFill adds instructions to perform wazeroir.NewOperationTableFill. + compileTableFill(*wazeroir.UnionOperation) error + // compileV128Const adds instructions to perform wazeroir.NewOperationV128Const. + compileV128Const(*wazeroir.UnionOperation) error + // compileV128Add adds instructions to perform wazeroir.OperationV128Add. + compileV128Add(o *wazeroir.UnionOperation) error + // compileV128Sub adds instructions to perform wazeroir.OperationV128Sub. + compileV128Sub(o *wazeroir.UnionOperation) error + // compileV128Load adds instructions to perform wazeroir.OperationV128Load. + compileV128Load(o *wazeroir.UnionOperation) error + // compileV128LoadLane adds instructions to perform wazeroir.OperationV128LoadLane. + compileV128LoadLane(o *wazeroir.UnionOperation) error + // compileV128Store adds instructions to perform wazeroir.NewOperationV128Store. + compileV128Store(o *wazeroir.UnionOperation) error + // compileV128StoreLane adds instructions to perform wazeroir.NewOperationV128StoreLane. + compileV128StoreLane(o *wazeroir.UnionOperation) error + // compileV128ExtractLane adds instructions to perform wazeroir.NewOperationV128ExtractLane. + compileV128ExtractLane(o *wazeroir.UnionOperation) error + // compileV128ReplaceLane adds instructions to perform wazeroir.NewOperationV128ReplaceLane. + compileV128ReplaceLane(o *wazeroir.UnionOperation) error + // compileV128Splat adds instructions to perform wazeroir.NewOperationV128Splat. + compileV128Splat(o *wazeroir.UnionOperation) error + // compileV128Shuffle adds instructions to perform wazeroir.NewOperationV128Shuffle. + compileV128Shuffle(o *wazeroir.UnionOperation) error + // compileV128Swizzle adds instructions to perform wazeroir.OperationV128Swizzle. + compileV128Swizzle(o *wazeroir.UnionOperation) error + // compileV128AnyTrue adds instructions to perform wazeroir.OperationV128AnyTrue. + compileV128AnyTrue(o *wazeroir.UnionOperation) error + // compileV128AllTrue adds instructions to perform wazeroir.NewOperationV128AllTrue. + compileV128AllTrue(o *wazeroir.UnionOperation) error + // compileV128BitMask adds instructions to perform wazeroir.NewOperationV128BitMask. + compileV128BitMask(*wazeroir.UnionOperation) error + // compileV128And adds instructions to perform wazeroir.OperationV128And. + compileV128And(*wazeroir.UnionOperation) error + // compileV128Not adds instructions to perform wazeroir.OperationV128Not. + compileV128Not(*wazeroir.UnionOperation) error + // compileV128Or adds instructions to perform wazeroir.OperationV128Or. + compileV128Or(*wazeroir.UnionOperation) error + // compileV128Xor adds instructions to perform wazeroir.OperationV128Xor. + compileV128Xor(*wazeroir.UnionOperation) error + // compileV128Bitselect adds instructions to perform wazeroir.OperationV128Bitselect. + compileV128Bitselect(*wazeroir.UnionOperation) error + // compileV128AndNot adds instructions to perform wazeroir.OperationV128AndNot. + compileV128AndNot(*wazeroir.UnionOperation) error + // compileV128Shr adds instructions to perform wazeroir.NewOperationV128Shr. + compileV128Shr(*wazeroir.UnionOperation) error + // compileV128Shl adds instructions to perform wazeroir.NewOperationV128Shl. + compileV128Shl(*wazeroir.UnionOperation) error + // compileV128Cmp adds instructions to perform wazeroir.NewOperationV128Cmp. + compileV128Cmp(*wazeroir.UnionOperation) error + // compileV128AddSat adds instructions to perform wazeroir.NewOperationV128AddSat. + compileV128AddSat(*wazeroir.UnionOperation) error + // compileV128SubSat adds instructions to perform wazeroir.NewOperationV128SubSat. + compileV128SubSat(*wazeroir.UnionOperation) error + // compileV128Mul adds instructions to perform wazeroir.NewOperationV128Mul. + compileV128Mul(*wazeroir.UnionOperation) error + // compileV128Div adds instructions to perform wazeroir.NewOperationV128Div. + compileV128Div(*wazeroir.UnionOperation) error + // compileV128Neg adds instructions to perform wazeroir.NewOperationV128Neg. + compileV128Neg(*wazeroir.UnionOperation) error + // compileV128Sqrt adds instructions to perform wazeroir.NewOperationV128Sqrt. + compileV128Sqrt(*wazeroir.UnionOperation) error + // compileV128Abs adds instructions to perform wazeroir.NewOperationV128Abs. + compileV128Abs(*wazeroir.UnionOperation) error + // compileV128Popcnt adds instructions to perform wazeroir.NewOperationV128Popcnt. + compileV128Popcnt(*wazeroir.UnionOperation) error + // compileV128Min adds instructions to perform wazeroir.NewOperationV128Min. + compileV128Min(*wazeroir.UnionOperation) error + // compileV128Max adds instructions to perform wazeroir.NewOperationV128Max. + compileV128Max(*wazeroir.UnionOperation) error + // compileV128AvgrU adds instructions to perform wazeroir.NewOperationV128AvgrU. + compileV128AvgrU(*wazeroir.UnionOperation) error + // compileV128Pmin adds instructions to perform wazeroir.NewOperationV128Pmin. + compileV128Pmin(*wazeroir.UnionOperation) error + // compileV128Pmax adds instructions to perform wazeroir.NewOperationV128Pmax. + compileV128Pmax(*wazeroir.UnionOperation) error + // compileV128Ceil adds instructions to perform wazeroir.NewOperationV128Ceil. + compileV128Ceil(*wazeroir.UnionOperation) error + // compileV128Floor adds instructions to perform wazeroir.NewOperationV128Floor. + compileV128Floor(*wazeroir.UnionOperation) error + // compileV128Trunc adds instructions to perform wazeroir.NewOperationV128Trunc. + compileV128Trunc(*wazeroir.UnionOperation) error + // compileV128Nearest adds instructions to perform wazeroir.NewOperationV128Nearest. + compileV128Nearest(*wazeroir.UnionOperation) error + // compileV128Extend adds instructions to perform wazeroir.NewOperationV128Extend. + compileV128Extend(*wazeroir.UnionOperation) error + // compileV128ExtMul adds instructions to perform wazeroir.NewOperationV128ExtMul. + compileV128ExtMul(*wazeroir.UnionOperation) error + // compileV128Q15mulrSatS adds instructions to perform wazeroir.OperationV128Q15mulrSatS. + compileV128Q15mulrSatS(*wazeroir.UnionOperation) error + // compileV128ExtAddPairwise adds instructions to perform wazeroir.NewOperationV128ExtAddPairwise. + compileV128ExtAddPairwise(o *wazeroir.UnionOperation) error + // compileV128FloatPromote adds instructions to perform wazeroir.OperationV128FloatPromote. + compileV128FloatPromote(o *wazeroir.UnionOperation) error + // compileV128FloatDemote adds instructions to perform wazeroir.OperationV128FloatDemote. + compileV128FloatDemote(o *wazeroir.UnionOperation) error + // compileV128FConvertFromI adds instructions to perform wazeroir.NewOperationV128FConvertFromI. + compileV128FConvertFromI(o *wazeroir.UnionOperation) error + // compileV128Dot adds instructions to perform wazeroir.OperationV128Dot. + compileV128Dot(o *wazeroir.UnionOperation) error + // compileV128Narrow adds instructions to perform wazeroir.NewOperationV128Narrow. + compileV128Narrow(o *wazeroir.UnionOperation) error + // compileV128ITruncSatFromF adds instructions to perform wazeroir.NewOperationV128ITruncSatFromF. + compileV128ITruncSatFromF(o *wazeroir.UnionOperation) error + + // compileBuiltinFunctionCheckExitCode adds instructions to perform wazeroir.OperationBuiltinFunctionCheckExitCode. + compileBuiltinFunctionCheckExitCode() error + + // compileReleaseRegisterToStack adds instructions to write the value on a register back to memory stack region. + compileReleaseRegisterToStack(loc *runtimeValueLocation) + // compileLoadValueOnStackToRegister adds instructions to load the value located on the stack to the assigned register. + compileLoadValueOnStackToRegister(loc *runtimeValueLocation) + + // maybeCompileMoveTopConditionalToGeneralPurposeRegister moves the top value on the stack + // if the value is located on a conditional register. + // + // This is usually called at the beginning of methods on compiler interface where we possibly + // compile instructions without saving the conditional register value. + // The compileXXX functions without calling this function is saving the conditional + // value to the stack or register by invoking compileEnsureOnRegister for the top. + maybeCompileMoveTopConditionalToGeneralPurposeRegister() error + // allocateRegister returns an unused register of the given type. The register will be taken + // either from the free register pool or by stealing a used register. + // + // Note: resulting registers will not be marked as used so the call site should + // mark it used if necessary. + allocateRegister(t registerType) (reg asm.Register, err error) + // runtimeValueLocationStack returns the current runtimeValueLocationStack of the compiler implementation. + runtimeValueLocationStack() *runtimeValueLocationStack + // pushRuntimeValueLocationOnRegister pushes a new runtimeValueLocation on a register `reg` and of the type `vt`. + pushRuntimeValueLocationOnRegister(reg asm.Register, vt runtimeValueType) (ret *runtimeValueLocation) + // pushRuntimeValueLocationOnRegister pushes a new vector value's runtimeValueLocation on a register `reg`. + pushVectorRuntimeValueLocationOnRegister(reg asm.Register) (lowerBitsLocation *runtimeValueLocation) + // compileNOP compiles NOP instruction and returns the corresponding asm.Node in the assembled native code. + // This is used to emit DWARF based stack traces. + compileNOP() asm.Node +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/compiler_drop.go b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/compiler_drop.go new file mode 100644 index 000000000..342cee0e1 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/compiler_drop.go @@ -0,0 +1,126 @@ +package compiler + +import ( + "github.com/tetratelabs/wazero/internal/asm" + "github.com/tetratelabs/wazero/internal/wazeroir" +) + +// compileDropRange adds instruction to drop the values on the target range +// in an architecture independent way. +func compileDropRange(c compiler, raw uint64) (err error) { + r := wazeroir.InclusiveRangeFromU64(raw) + locationStack := c.runtimeValueLocationStack() + if r.Start < 0 { + return + } else if r.Start == 0 { + for i := 0; i <= int(r.End); i++ { + if loc := locationStack.pop(); loc.onRegister() { + locationStack.releaseRegister(loc) + } + } + return + } + + // If the top value is alive, we must ensure that it is not located as a conditional. + // Otherwise, the conditional flag might end up modified by the following operation. + if err = c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return + } + + dropValues, liveValues := locationStack.dropsLivesForInclusiveRange(r) + + // Frees all the registers used by drop target values. + for i := range dropValues { + dv := &dropValues[i] + if dv.onRegister() { + locationStack.releaseRegister(dv) + } + } + + // These registers are not nil if a live value of that type is currently located on the memory stack. + // In order to migrate these values, we can use them below. + gpTmp, vecTmp, err := getTemporariesForStackedLiveValues(c, liveValues) + if err != nil { + return err + } + + // Reset the stack pointer below the end. + locationStack.sp -= uint64(len(liveValues) + len(dropValues)) + + // Push back the live values again. + for i := range liveValues { + live := &liveValues[i] + migrateLiveValue(c, live, gpTmp, vecTmp) + } + return +} + +// migrateLiveValue migrates the live value `live` into the top of the stack. It might be located on the stack +// and in that case, we have to load it into either `generalPurposeTmpReg` or `vectorTmpReg` temporarily, and +// write it back into the *new* stack location. +func migrateLiveValue(c compiler, live *runtimeValueLocation, generalPurposeTmpReg, vectorTmpReg asm.Register) { + if live.valueType == runtimeValueTypeV128Hi { + // Higher bits of vector was already handled together with the lower bits. + return + } + + previouslyOnStack := live.onStack() + if previouslyOnStack { + // If the value is on the stack, load the value on the old location into the temporary value, + // and then write it back to the new memory location below. + switch live.getRegisterType() { + case registerTypeGeneralPurpose: + live.setRegister(generalPurposeTmpReg) + case registerTypeVector: + live.setRegister(vectorTmpReg) + } + // Load the value into tmp. + c.compileLoadValueOnStackToRegister(live) + } + + var newLocation *runtimeValueLocation + if live.valueType == runtimeValueTypeV128Lo { + newLocation = c.pushVectorRuntimeValueLocationOnRegister(live.register) + } else { + newLocation = c.pushRuntimeValueLocationOnRegister(live.register, live.valueType) + } + + if previouslyOnStack { + // This case, the location is on the temporary register. Therefore, + // we have to release the value there into the *new* memory location + // so that the tmp can be used for subsequent live value migrations. + c.compileReleaseRegisterToStack(newLocation) + } +} + +func getTemporariesForStackedLiveValues(c compiler, liveValues []runtimeValueLocation) (gpTmp, vecTmp asm.Register, err error) { + gpTmp, vecTmp = asm.NilRegister, asm.NilRegister + for i := range liveValues { + l := &liveValues[i] + if l.onStack() { + if rt := l.getRegisterType(); rt == registerTypeGeneralPurpose && gpTmp == asm.NilRegister { + gpTmp, err = c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return + } + } else if rt == registerTypeVector && vecTmp == asm.NilRegister { + vecTmp, err = c.allocateRegister(registerTypeVector) + if err != nil { + return + } + } + } + } + return +} + +// dropsLivesForInclusiveRange returns the live and drop target values for the given wazeroir.InclusiveRange. +func (v *runtimeValueLocationStack) dropsLivesForInclusiveRange( + r wazeroir.InclusiveRange, +) (dropValues, liveValues []runtimeValueLocation) { + // liveValues are must be pushed backed after dropping the target range. + liveValues = v.stack[v.sp-uint64(r.Start) : v.sp] + // dropValues are the values on the drop target range. + dropValues = v.stack[v.sp-uint64(r.End)-1 : v.sp-uint64(r.Start)] + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/compiler_value_location.go b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/compiler_value_location.go new file mode 100644 index 000000000..30036fed1 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/compiler_value_location.go @@ -0,0 +1,425 @@ +package compiler + +import ( + "fmt" + "strings" + + "github.com/tetratelabs/wazero/internal/asm" + "github.com/tetratelabs/wazero/internal/wasm" +) + +var ( + // unreservedGeneralPurposeRegisters contains unreserved general purpose registers of integer type. + unreservedGeneralPurposeRegisters []asm.Register + + // unreservedVectorRegisters contains unreserved vector registers. + unreservedVectorRegisters []asm.Register +) + +func isGeneralPurposeRegister(r asm.Register) bool { + return unreservedGeneralPurposeRegisters[0] <= r && r <= unreservedGeneralPurposeRegisters[len(unreservedGeneralPurposeRegisters)-1] +} + +func isVectorRegister(r asm.Register) bool { + return unreservedVectorRegisters[0] <= r && r <= unreservedVectorRegisters[len(unreservedVectorRegisters)-1] +} + +// runtimeValueLocation corresponds to each variable pushed onto the wazeroir (virtual) stack, +// and it has the information about where it exists in the physical machine. +// It might exist in registers, or maybe on in the non-virtual physical stack allocated in memory. +type runtimeValueLocation struct { + valueType runtimeValueType + // register is set to asm.NilRegister if the value is stored in the memory stack. + register asm.Register + // conditionalRegister is set to conditionalRegisterStateUnset if the value is not on the conditional register. + conditionalRegister asm.ConditionalRegisterState + // stackPointer is the location of this value in the memory stack at runtime, + stackPointer uint64 +} + +func (v *runtimeValueLocation) getRegisterType() (ret registerType) { + switch v.valueType { + case runtimeValueTypeI32, runtimeValueTypeI64: + ret = registerTypeGeneralPurpose + case runtimeValueTypeF32, runtimeValueTypeF64, + runtimeValueTypeV128Lo, runtimeValueTypeV128Hi: + ret = registerTypeVector + default: + panic("BUG") + } + return +} + +type runtimeValueType byte + +const ( + runtimeValueTypeNone runtimeValueType = iota + runtimeValueTypeI32 + runtimeValueTypeI64 + runtimeValueTypeF32 + runtimeValueTypeF64 + runtimeValueTypeV128Lo + runtimeValueTypeV128Hi +) + +func (r runtimeValueType) String() (ret string) { + switch r { + case runtimeValueTypeI32: + ret = "i32" + case runtimeValueTypeI64: + ret = "i64" + case runtimeValueTypeF32: + ret = "f32" + case runtimeValueTypeF64: + ret = "f64" + case runtimeValueTypeV128Lo: + ret = "v128.lo" + case runtimeValueTypeV128Hi: + ret = "v128.hi" + } + return +} + +func (v *runtimeValueLocation) setRegister(reg asm.Register) { + v.register = reg + v.conditionalRegister = asm.ConditionalRegisterStateUnset +} + +func (v *runtimeValueLocation) onRegister() bool { + return v.register != asm.NilRegister && v.conditionalRegister == asm.ConditionalRegisterStateUnset +} + +func (v *runtimeValueLocation) onStack() bool { + return v.register == asm.NilRegister && v.conditionalRegister == asm.ConditionalRegisterStateUnset +} + +func (v *runtimeValueLocation) onConditionalRegister() bool { + return v.conditionalRegister != asm.ConditionalRegisterStateUnset +} + +func (v *runtimeValueLocation) String() string { + var location string + if v.onStack() { + location = fmt.Sprintf("stack(%d)", v.stackPointer) + } else if v.onConditionalRegister() { + location = fmt.Sprintf("conditional(%d)", v.conditionalRegister) + } else if v.onRegister() { + location = fmt.Sprintf("register(%s)", registerNameFn(v.register)) + } + return fmt.Sprintf("{type=%s,location=%s}", v.valueType, location) +} + +func newRuntimeValueLocationStack() runtimeValueLocationStack { + return runtimeValueLocationStack{ + unreservedVectorRegisters: unreservedVectorRegisters, + unreservedGeneralPurposeRegisters: unreservedGeneralPurposeRegisters, + } +} + +// runtimeValueLocationStack represents the wazeroir virtual stack +// where each item holds the location information about where it exists +// on the physical machine at runtime. +// +// Notably this is only used in the compilation phase, not runtime, +// and we change the state of this struct at every wazeroir operation we compile. +// In this way, we can see where the operands of an operation (for example, +// two variables for wazeroir add operation.) exist and check the necessity for +// moving the variable to registers to perform actual CPU instruction +// to achieve wazeroir's add operation. +type runtimeValueLocationStack struct { + // stack holds all the variables. + stack []runtimeValueLocation + // sp is the current stack pointer. + sp uint64 + // usedRegisters is the bit map to track the used registers. + usedRegisters usedRegistersMask + // stackPointerCeil tracks max(.sp) across the lifespan of this struct. + stackPointerCeil uint64 + // unreservedGeneralPurposeRegisters and unreservedVectorRegisters hold + // architecture dependent unreserved register list. + unreservedGeneralPurposeRegisters, unreservedVectorRegisters []asm.Register +} + +func (v *runtimeValueLocationStack) reset() { + stack := v.stack[:0] + *v = runtimeValueLocationStack{ + unreservedVectorRegisters: unreservedVectorRegisters, + unreservedGeneralPurposeRegisters: unreservedGeneralPurposeRegisters, + stack: stack, + } +} + +func (v *runtimeValueLocationStack) String() string { + var stackStr []string + for i := uint64(0); i < v.sp; i++ { + stackStr = append(stackStr, v.stack[i].String()) + } + usedRegisters := v.usedRegisters.list() + return fmt.Sprintf("sp=%d, stack=[%s], used_registers=[%s]", v.sp, strings.Join(stackStr, ","), strings.Join(usedRegisters, ",")) +} + +// cloneFrom clones the values on `from` into self except for the slice of .stack field. +// The content on .stack will be copied from the origin to self, and grow the underlying slice +// if necessary. +func (v *runtimeValueLocationStack) cloneFrom(from runtimeValueLocationStack) { + // Assigns the same values for fields except for the stack which we want to reuse. + prev := v.stack + *v = from + v.stack = prev[:cap(prev)] // Expand the length to the capacity so that we can minimize "diff" below. + // Copy the content in the stack. + if diff := int(from.sp) - len(v.stack); diff > 0 { + v.stack = append(v.stack, make([]runtimeValueLocation, diff)...) + } + copy(v.stack, from.stack[:from.sp]) +} + +// pushRuntimeValueLocationOnRegister creates a new runtimeValueLocation with a given register and pushes onto +// the location stack. +func (v *runtimeValueLocationStack) pushRuntimeValueLocationOnRegister(reg asm.Register, vt runtimeValueType) (loc *runtimeValueLocation) { + loc = v.push(reg, asm.ConditionalRegisterStateUnset) + loc.valueType = vt + return +} + +// pushRuntimeValueLocationOnRegister creates a new runtimeValueLocation and pushes onto the location stack. +func (v *runtimeValueLocationStack) pushRuntimeValueLocationOnStack() (loc *runtimeValueLocation) { + loc = v.push(asm.NilRegister, asm.ConditionalRegisterStateUnset) + loc.valueType = runtimeValueTypeNone + return +} + +// pushRuntimeValueLocationOnRegister creates a new runtimeValueLocation with a given conditional register state +// and pushes onto the location stack. +func (v *runtimeValueLocationStack) pushRuntimeValueLocationOnConditionalRegister(state asm.ConditionalRegisterState) (loc *runtimeValueLocation) { + loc = v.push(asm.NilRegister, state) + loc.valueType = runtimeValueTypeI32 + return +} + +// push a runtimeValueLocation onto the stack. +func (v *runtimeValueLocationStack) push(reg asm.Register, conditionalRegister asm.ConditionalRegisterState) (ret *runtimeValueLocation) { + if v.sp >= uint64(len(v.stack)) { + // This case we need to grow the stack capacity by appending the item, + // rather than indexing. + v.stack = append(v.stack, runtimeValueLocation{}) + } + ret = &v.stack[v.sp] + ret.register, ret.conditionalRegister, ret.stackPointer = reg, conditionalRegister, v.sp + v.sp++ + // stackPointerCeil must be set after sp is incremented since + // we skip the stack grow if len(stack) >= basePointer+stackPointerCeil. + if v.sp > v.stackPointerCeil { + v.stackPointerCeil = v.sp + } + return +} + +func (v *runtimeValueLocationStack) pop() (loc *runtimeValueLocation) { + v.sp-- + loc = &v.stack[v.sp] + return +} + +func (v *runtimeValueLocationStack) popV128() (loc *runtimeValueLocation) { + v.sp -= 2 + loc = &v.stack[v.sp] + return +} + +func (v *runtimeValueLocationStack) peek() (loc *runtimeValueLocation) { + loc = &v.stack[v.sp-1] + return +} + +func (v *runtimeValueLocationStack) releaseRegister(loc *runtimeValueLocation) { + v.markRegisterUnused(loc.register) + loc.register = asm.NilRegister + loc.conditionalRegister = asm.ConditionalRegisterStateUnset +} + +func (v *runtimeValueLocationStack) markRegisterUnused(regs ...asm.Register) { + for _, reg := range regs { + v.usedRegisters.remove(reg) + } +} + +func (v *runtimeValueLocationStack) markRegisterUsed(regs ...asm.Register) { + for _, reg := range regs { + v.usedRegisters.add(reg) + } +} + +type registerType byte + +const ( + registerTypeGeneralPurpose registerType = iota + // registerTypeVector represents a vector register which can be used for either scalar float + // operation or SIMD vector operation depending on the instruction by which the register is used. + // + // Note: In normal assembly language, scalar float and vector register have different notations as + // Vn is for vectors and Qn is for scalar floats on arm64 for example. But on physical hardware, + // they are placed on the same locations. (Qn means the lower 64-bit of Vn vector register on arm64). + // + // In wazero, for the sake of simplicity in the register allocation, we intentionally conflate these two types + // and delegate the decision to the assembler which is aware of the instruction types for which these registers are used. + registerTypeVector +) + +func (tp registerType) String() (ret string) { + switch tp { + case registerTypeGeneralPurpose: + ret = "int" + case registerTypeVector: + ret = "vector" + } + return +} + +// takeFreeRegister searches for unused registers. Any found are marked used and returned. +func (v *runtimeValueLocationStack) takeFreeRegister(tp registerType) (reg asm.Register, found bool) { + var targetRegs []asm.Register + switch tp { + case registerTypeVector: + targetRegs = v.unreservedVectorRegisters + case registerTypeGeneralPurpose: + targetRegs = v.unreservedGeneralPurposeRegisters + } + for _, candidate := range targetRegs { + if v.usedRegisters.exist(candidate) { + continue + } + return candidate, true + } + return 0, false +} + +// Search through the stack, and steal the register from the last used +// variable on the stack. +func (v *runtimeValueLocationStack) takeStealTargetFromUsedRegister(tp registerType) (*runtimeValueLocation, bool) { + for i := uint64(0); i < v.sp; i++ { + loc := &v.stack[i] + if loc.onRegister() { + switch tp { + case registerTypeVector: + if loc.valueType == runtimeValueTypeV128Hi { + panic("BUG: V128Hi must be above the corresponding V128Lo") + } + if isVectorRegister(loc.register) { + return loc, true + } + case registerTypeGeneralPurpose: + if isGeneralPurposeRegister(loc.register) { + return loc, true + } + } + } + } + return nil, false +} + +// init sets up the runtimeValueLocationStack which reflects the state of +// the stack at the beginning of the function. +// +// See the diagram in callEngine.stack. +func (v *runtimeValueLocationStack) init(sig *wasm.FunctionType) { + for _, t := range sig.Params { + loc := v.pushRuntimeValueLocationOnStack() + switch t { + case wasm.ValueTypeI32: + loc.valueType = runtimeValueTypeI32 + case wasm.ValueTypeI64, wasm.ValueTypeFuncref, wasm.ValueTypeExternref: + loc.valueType = runtimeValueTypeI64 + case wasm.ValueTypeF32: + loc.valueType = runtimeValueTypeF32 + case wasm.ValueTypeF64: + loc.valueType = runtimeValueTypeF64 + case wasm.ValueTypeV128: + loc.valueType = runtimeValueTypeV128Lo + hi := v.pushRuntimeValueLocationOnStack() + hi.valueType = runtimeValueTypeV128Hi + default: + panic("BUG") + } + } + + // If the len(results) > len(args), the slots for all results are reserved after + // arguments, so we reflect that into the location stack. + for i := 0; i < sig.ResultNumInUint64-sig.ParamNumInUint64; i++ { + _ = v.pushRuntimeValueLocationOnStack() + } + + // Then push the control frame fields. + for i := 0; i < callFrameDataSizeInUint64; i++ { + loc := v.pushRuntimeValueLocationOnStack() + loc.valueType = runtimeValueTypeI64 + } +} + +// getCallFrameLocations returns each field of callFrame's runtime location. +// +// See the diagram in callEngine.stack. +func (v *runtimeValueLocationStack) getCallFrameLocations(sig *wasm.FunctionType) ( + returnAddress, callerStackBasePointerInBytes, callerFunction *runtimeValueLocation, +) { + offset := callFrameOffset(sig) + return &v.stack[offset], &v.stack[offset+1], &v.stack[offset+2] +} + +// pushCallFrame pushes a call frame's runtime locations onto the stack assuming that +// the function call parameters are already pushed there. +// +// See the diagram in callEngine.stack. +func (v *runtimeValueLocationStack) pushCallFrame(callTargetFunctionType *wasm.FunctionType) ( + returnAddress, callerStackBasePointerInBytes, callerFunction *runtimeValueLocation, +) { + // If len(results) > len(args), we reserve the slots for the results below the call frame. + reservedSlotsBeforeCallFrame := callTargetFunctionType.ResultNumInUint64 - callTargetFunctionType.ParamNumInUint64 + for i := 0; i < reservedSlotsBeforeCallFrame; i++ { + v.pushRuntimeValueLocationOnStack() + } + + // Push the runtime location for each field of callFrame struct. Note that each of them has + // uint64 type, and therefore must be treated as runtimeValueTypeI64. + + // callFrame.returnAddress + returnAddress = v.pushRuntimeValueLocationOnStack() + returnAddress.valueType = runtimeValueTypeI64 + // callFrame.returnStackBasePointerInBytes + callerStackBasePointerInBytes = v.pushRuntimeValueLocationOnStack() + callerStackBasePointerInBytes.valueType = runtimeValueTypeI64 + // callFrame.function + callerFunction = v.pushRuntimeValueLocationOnStack() + callerFunction.valueType = runtimeValueTypeI64 + return +} + +// usedRegistersMask tracks the used registers in its bits. +type usedRegistersMask uint64 + +// add adds the given `r` to the mask. +func (u *usedRegistersMask) add(r asm.Register) { + *u = *u | (1 << registerMaskShift(r)) +} + +// remove drops the given `r` from the mask. +func (u *usedRegistersMask) remove(r asm.Register) { + *u = *u & ^(1 << registerMaskShift(r)) +} + +// exist returns true if the given `r` is used. +func (u *usedRegistersMask) exist(r asm.Register) bool { + shift := registerMaskShift(r) + return (*u & (1 << shift)) > 0 +} + +// list returns the list of debug string of used registers. +// Only used for debugging and testing. +func (u *usedRegistersMask) list() (ret []string) { + mask := *u + for i := 0; i < 64; i++ { + if mask&(1< 0 { + ret = append(ret, registerNameFn(registerFromMaskShift(i))) + } + } + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/engine.go b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/engine.go new file mode 100644 index 000000000..b0346d3fb --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/engine.go @@ -0,0 +1,1595 @@ +package compiler + +import ( + "context" + "errors" + "fmt" + "reflect" + "runtime" + "sort" + "sync" + "unsafe" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/experimental" + "github.com/tetratelabs/wazero/internal/asm" + "github.com/tetratelabs/wazero/internal/bitpack" + "github.com/tetratelabs/wazero/internal/filecache" + "github.com/tetratelabs/wazero/internal/internalapi" + "github.com/tetratelabs/wazero/internal/platform" + "github.com/tetratelabs/wazero/internal/version" + "github.com/tetratelabs/wazero/internal/wasm" + "github.com/tetratelabs/wazero/internal/wasmdebug" + "github.com/tetratelabs/wazero/internal/wasmruntime" + "github.com/tetratelabs/wazero/internal/wazeroir" +) + +// NOTE: The offset of many of the struct fields defined here are referenced from +// assembly using the constants below such as moduleEngineFunctionsOffset. +// If changing a struct, update the constant and associated tests as needed. +type ( + // engine is a Compiler implementation of wasm.Engine + engine struct { + enabledFeatures api.CoreFeatures + codes map[wasm.ModuleID]*compiledModule // guarded by mutex. + fileCache filecache.Cache + mux sync.RWMutex + // setFinalizer defaults to runtime.SetFinalizer, but overridable for tests. + setFinalizer func(obj interface{}, finalizer interface{}) + wazeroVersion string + } + + // moduleEngine implements wasm.ModuleEngine + moduleEngine struct { + // See note at top of file before modifying this struct. + + // functions are the functions in a module instances. + // The index is module instance-scoped. We intentionally avoid using map + // as the underlying memory region is accessed by assembly directly by using + // codesElement0Address. + functions []function + + // Keep a reference to the compiled module to prevent the GC from reclaiming + // it while the code may still be needed. + module *compiledModule + } + + // callEngine holds context per moduleEngine.Call, and shared across all the + // function calls originating from the same moduleEngine.Call execution. + // + // This implements api.Function. + callEngine struct { + internalapi.WazeroOnlyType + + // See note at top of file before modifying this struct. + + // These contexts are read and written by compiled code. + // Note: structs are embedded to reduce the costs to access fields inside them. Also, this eases field offset + // calculation. + moduleContext + stackContext + exitContext + archContext + + // The following fields are not accessed by compiled code directly. + + // stack is the go-allocated stack for holding values and call frames. + // Note: We never edit len or cap in compiled code, so we won't get screwed when GC comes in. + // + // At any point of execution, say currently executing function F2 which was called by F1, then + // the stack should look like like: + // + // [..., arg0, arg1, ..., argN, _, _, _, v1, v2, v3, .... + // ^ { } + // | F1's callFrame + // | + // stackBasePointer + // + // where + // - callFrame is the F1's callFrame which called F2. It contains F1's return address, F1's base pointer, and F1's *function. + // - stackBasePointer is the stack base pointer stored at (callEngine stackContext.stackBasePointerInBytes) + // - arg0, ..., argN are the function parameters, and v1, v2, v3,... are the local variables + // including the non-function param locals as well as the temporary variable produced by instructions (e.g i32.const). + // + // If the F2 makes a function call to F3 which takes two arguments, then the stack will become: + // + // [..., arg0, arg1, ..., argN, _, _, _, v1, v2, v3, _, _, _ + // { } ^ { } + // F1's callFrame | F2's callFrame + // | + // stackBasePointer + // where + // - F2's callFrame is pushed above the v2 and v3 (arguments for F3). + // - The previous stackBasePointer (pointed at arg0) was saved inside the F2's callFrame. + // + // Then, if F3 returns one result, say w1, then the result will look like: + // + // [..., arg0, arg1, ..., argN, _, _, _, v1, w1, ... + // ^ { } + // | F1's callFrame + // | + // stackBasePointer + // + // where + // - stackBasePointer was reverted to the position at arg0 + // - The result from F3 was pushed above v1 + // + // If the number of parameters is smaller than that of return values, then the empty slots are reserved + // below the callFrame to store the results on teh return. + // For example, if F3 takes no parameter but returns N(>0) results, then the stack + // after making a call against F3 will look like: + // + // [..., arg0, arg1, ..., argN, _, _, _, v1, v2, v3, res_1, _, res_N, _, _, _ + // { } ^ { } + // F1's callFrame | F2's callFrame + // | + // stackBasePointer + // where res_1, ..., res_N are the reserved slots below the call frame. In general, + // the number of reserved slots equals max(0, len(results)-len(params). + // + // This reserved slots are necessary to save the result values onto the stack while not destroying + // the callFrame value on function returns. + stack []uint64 + + // initialFn is the initial function for this call engine. + initialFn *function + + // Keep a reference to the compiled module to prevent the GC from reclaiming + // it while the code may still be needed. + module *compiledModule + + // stackIterator provides a way to iterate over the stack for Listeners. + // It is setup and valid only during a call to a Listener hook. + stackIterator stackIterator + } + + // moduleContext holds the per-function call specific module information. + // This is subject to be manipulated from compiled native code whenever we make function calls. + moduleContext struct { + // See note at top of file before modifying this struct. + + // fn holds the currently executed *function. + fn *function + + // moduleInstance is the address of module instance from which we initialize + // the following fields. This is set whenever we enter a function or return from function calls. + // + // On the entry to the native code, this must be initialized to zero to let native code preamble know + // that this is the initial function call (which leads to moduleContext initialization pass). + moduleInstance *wasm.ModuleInstance //lint:ignore U1000 This is only used by Compiler code. + + // globalElement0Address is the address of the first element in the global slice, + // i.e. &ModuleInstance.Globals[0] as uintptr. + globalElement0Address uintptr + // memoryElement0Address is the address of the first element in the global slice, + // i.e. &ModuleInstance.Memory.Buffer[0] as uintptr. + memoryElement0Address uintptr + // memorySliceLen is the length of the memory buffer, i.e. len(ModuleInstance.Memory.Buffer). + memorySliceLen uint64 + // memoryInstance holds the memory instance for this module instance. + memoryInstance *wasm.MemoryInstance + // tableElement0Address is the address of the first item in the tables slice, + // i.e. &ModuleInstance.Tables[0] as uintptr. + tablesElement0Address uintptr + + // functionsElement0Address is &moduleContext.functions[0] as uintptr. + functionsElement0Address uintptr + + // typeIDsElement0Address holds the &ModuleInstance.TypeIDs[0] as uintptr. + typeIDsElement0Address uintptr + + // dataInstancesElement0Address holds the &ModuleInstance.DataInstances[0] as uintptr. + dataInstancesElement0Address uintptr + + // elementInstancesElement0Address holds the &ModuleInstance.ElementInstances[0] as uintptr. + elementInstancesElement0Address uintptr + } + + // stackContext stores the data to access engine.stack. + stackContext struct { + // See note at top of file before modifying this struct. + + // stackPointer on .stack field which is accessed by stack[stackBasePointer+stackBasePointerInBytes*8]. + // + // Note: stackPointer is not used in assembly since the native code knows exact position of + // each variable in the value stack from the info from compilation. + // Therefore, only updated when native code exit from the Compiler world and go back to the Go function. + stackPointer uint64 + + // stackBasePointerInBytes is updated whenever we make function calls. + // Background: Functions might be compiled as if they use the stack from the bottom. + // However, in reality, they have to use it from the middle of the stack depending on + // when these function calls are made. So instead of accessing stack via stackPointer alone, + // functions are compiled, so they access the stack via [stackBasePointer](fixed for entire function) + [stackPointer]. + // More precisely, stackBasePointer is set to [callee's stack pointer] + [callee's stack base pointer] - [caller's params]. + // This way, compiled functions can be independent of the timing of functions calls made against them. + stackBasePointerInBytes uint64 + + // stackElement0Address is &engine.stack[0] as uintptr. + // Note: this is updated when growing the stack in builtinFunctionGrowStack. + stackElement0Address uintptr + + // stackLenInBytes is len(engine.stack[0]) * 8 (bytes). + // Note: this is updated when growing the stack in builtinFunctionGrowStack. + stackLenInBytes uint64 + } + + // exitContext will be manipulated whenever compiled native code returns into the Go function. + exitContext struct { + // See note at top of file before modifying this struct. + + // Where we store the status code of Compiler execution. + statusCode nativeCallStatusCode + + // Set when statusCode == compilerStatusCallBuiltInFunction + // Indicating the function call index. + builtinFunctionCallIndex wasm.Index + + // returnAddress is the return address which the engine jumps into + // after executing a builtin function or host function. + returnAddress uintptr + + // callerModuleInstance holds the caller's wasm.ModuleInstance, and is only valid if currently executing a host function. + callerModuleInstance *wasm.ModuleInstance + } + + // callFrame holds the information to which the caller function can return. + // This is mixed in callEngine.stack with other Wasm values just like any other + // native program (where the stack is the system stack though), and we retrieve the struct + // with unsafe pointer casts. + callFrame struct { + // See note at top of file before modifying this struct. + + // returnAddress is the return address to which the engine jumps when the callee function returns. + returnAddress uintptr + // returnStackBasePointerInBytes is the stack base pointer to set on stackContext.stackBasePointerInBytes + // when the callee function returns. + returnStackBasePointerInBytes uint64 + // function is the caller *function, and is used to retrieve the stack trace. + // Note: should be possible to revive *function from returnAddress, but might be costly. + function *function + } + + // Function corresponds to function instance in Wasm, and is created from `code`. + function struct { + // See note at top of file before modifying this struct. + + // codeInitialAddress is the pre-calculated pointer pointing to the initial byte of .codeSegment slice. + // That mean codeInitialAddress always equals uintptr(unsafe.Pointer(&.codeSegment[0])) + // and we cache the value (uintptr(unsafe.Pointer(&.codeSegment[0]))) to this field, + // so we don't need to repeat the calculation on each function call. + codeInitialAddress uintptr + // moduleInstance holds the address of source.ModuleInstance. + moduleInstance *wasm.ModuleInstance + // typeID is the corresponding wasm.FunctionTypeID for funcType. + typeID wasm.FunctionTypeID + // funcType is the function type for this function. Created during compilation. + funcType *wasm.FunctionType + // parent holds code from which this is created. + parent *compiledFunction + } + + compiledModule struct { + // The data that need to be accessed by compiledFunction.parent are + // separated in an embedded field because we use finalizers to manage + // the lifecycle of compiledModule instances and having cyclic pointers + // prevents the Go runtime from calling them, which results in memory + // leaks since the memory mapped code segments cannot be released. + // + // The indirection guarantees that the finalizer set on compiledModule + // instances can run when all references are gone, and the Go GC can + // manage to reclaim the compiledCode when all compiledFunction objects + // referencing it have been freed. + *compiledCode + functions []compiledFunction + + ensureTermination bool + } + + compiledCode struct { + source *wasm.Module + executable asm.CodeSegment + } + + // compiledFunction corresponds to a function in a module (not instantiated one). This holds the machine code + // compiled by wazero compiler. + compiledFunction struct { + // codeSegment is holding the compiled native code as a byte slice. + executableOffset uintptr + // See the doc for codeStaticData type. + // stackPointerCeil is the max of the stack pointer this function can reach. Lazily applied via maybeGrowStack. + stackPointerCeil uint64 + + index wasm.Index + goFunc interface{} + listener experimental.FunctionListener + parent *compiledCode + sourceOffsetMap sourceOffsetMap + } + + // sourceOffsetMap holds the information to retrieve the original offset in + // the Wasm binary from the offset in the native binary. + // + // The fields are implemented as bit-packed arrays of 64 bits integers to + // reduce the memory footprint. Indexing into such arrays is not as fast as + // indexing into a simple slice, but the source offset map is intended to be + // used for debugging, lookups into the arrays should not appear on code + // paths that are critical to the application performance. + // + // The bitpack.OffsetArray fields may be nil, use bitpack.OffsetArrayLen to + // determine whether they are empty prior to indexing into the arrays to + // avoid panics caused by accessing nil pointers. + sourceOffsetMap struct { + // See note at top of file before modifying this struct. + + // irOperationOffsetsInNativeBinary is index-correlated with irOperationSourceOffsetsInWasmBinary, + // and maps each index (corresponding to each IR Operation) to the offset in the compiled native code. + irOperationOffsetsInNativeBinary bitpack.OffsetArray + // irOperationSourceOffsetsInWasmBinary is index-correlated with irOperationOffsetsInNativeBinary. + // See wazeroir.CompilationResult irOperationOffsetsInNativeBinary. + irOperationSourceOffsetsInWasmBinary bitpack.OffsetArray + } + + // functionListenerInvocation captures arguments needed to perform function + // listener invocations when unwinding the call stack. + functionListenerInvocation struct { + experimental.FunctionListener + def api.FunctionDefinition + } +) + +// Native code reads/writes Go's structs with the following constants. +// See TestVerifyOffsetValue for how to derive these values. +const ( + // Offsets for moduleEngine.functions + moduleEngineFunctionsOffset = 0 + + // Offsets for callEngine moduleContext. + callEngineModuleContextFnOffset = 0 + callEngineModuleContextModuleInstanceOffset = 8 + callEngineModuleContextGlobalElement0AddressOffset = 16 + callEngineModuleContextMemoryElement0AddressOffset = 24 + callEngineModuleContextMemorySliceLenOffset = 32 + callEngineModuleContextMemoryInstanceOffset = 40 + callEngineModuleContextTablesElement0AddressOffset = 48 + callEngineModuleContextFunctionsElement0AddressOffset = 56 + callEngineModuleContextTypeIDsElement0AddressOffset = 64 + callEngineModuleContextDataInstancesElement0AddressOffset = 72 + callEngineModuleContextElementInstancesElement0AddressOffset = 80 + + // Offsets for callEngine stackContext. + callEngineStackContextStackPointerOffset = 88 + callEngineStackContextStackBasePointerInBytesOffset = 96 + callEngineStackContextStackElement0AddressOffset = 104 + callEngineStackContextStackLenInBytesOffset = 112 + + // Offsets for callEngine exitContext. + callEngineExitContextNativeCallStatusCodeOffset = 120 + callEngineExitContextBuiltinFunctionCallIndexOffset = 124 + callEngineExitContextReturnAddressOffset = 128 + callEngineExitContextCallerModuleInstanceOffset = 136 + + // Offsets for function. + functionCodeInitialAddressOffset = 0 + functionModuleInstanceOffset = 8 + functionTypeIDOffset = 16 + functionSize = 40 + + // Offsets for wasm.ModuleInstance. + moduleInstanceGlobalsOffset = 24 + moduleInstanceMemoryOffset = 48 + moduleInstanceTablesOffset = 56 + moduleInstanceEngineOffset = 80 + moduleInstanceTypeIDsOffset = 96 + moduleInstanceDataInstancesOffset = 120 + moduleInstanceElementInstancesOffset = 144 + + // Offsets for wasm.TableInstance. + tableInstanceTableOffset = 0 + tableInstanceTableLenOffset = 8 + + // Offsets for wasm.MemoryInstance. + memoryInstanceBufferOffset = 0 + memoryInstanceBufferLenOffset = 8 + + // Offsets for wasm.GlobalInstance. + globalInstanceValueOffset = 8 + + // Offsets for Go's interface. + // https://research.swtch.com/interfaces + // https://github.com/golang/go/blob/release-branch.go1.20/src/runtime/runtime2.go#L207-L210 + interfaceDataOffset = 8 + + // Consts for wasm.DataInstance. + dataInstanceStructSize = 24 + + // Consts for wasm.ElementInstance. + elementInstanceStructSize = 24 + + // pointerSizeLog2 satisfies: 1 << pointerSizeLog2 = sizeOf(uintptr) + pointerSizeLog2 = 3 + + // callFrameDataSizeInUint64 is the size of callFrame struct per 8 bytes (= size of uint64). + callFrameDataSizeInUint64 = 24 / 8 +) + +// nativeCallStatusCode represents the result of `nativecall`. +// This is set by the native code. +type nativeCallStatusCode uint32 + +const ( + // nativeCallStatusCodeReturned means the nativecall reaches the end of function, and returns successfully. + nativeCallStatusCodeReturned nativeCallStatusCode = iota + // nativeCallStatusCodeCallGoHostFunction means the nativecall returns to make a host function call. + nativeCallStatusCodeCallGoHostFunction + // nativeCallStatusCodeCallBuiltInFunction means the nativecall returns to make a builtin function call. + nativeCallStatusCodeCallBuiltInFunction + // nativeCallStatusCodeUnreachable means the function invocation reaches "unreachable" instruction. + nativeCallStatusCodeUnreachable + // nativeCallStatusCodeInvalidFloatToIntConversion means an invalid conversion of integer to floats happened. + nativeCallStatusCodeInvalidFloatToIntConversion + // nativeCallStatusCodeMemoryOutOfBounds means an out-of-bounds memory access happened. + nativeCallStatusCodeMemoryOutOfBounds + // nativeCallStatusCodeInvalidTableAccess means either offset to the table was out of bounds of table, or + // the target element in the table was uninitialized during call_indirect instruction. + nativeCallStatusCodeInvalidTableAccess + // nativeCallStatusCodeTypeMismatchOnIndirectCall means the type check failed during call_indirect. + nativeCallStatusCodeTypeMismatchOnIndirectCall + nativeCallStatusIntegerOverflow + nativeCallStatusIntegerDivisionByZero + nativeCallStatusModuleClosed +) + +// causePanic causes a panic with the corresponding error to the nativeCallStatusCode. +func (s nativeCallStatusCode) causePanic() { + var err error + switch s { + case nativeCallStatusIntegerOverflow: + err = wasmruntime.ErrRuntimeIntegerOverflow + case nativeCallStatusIntegerDivisionByZero: + err = wasmruntime.ErrRuntimeIntegerDivideByZero + case nativeCallStatusCodeInvalidFloatToIntConversion: + err = wasmruntime.ErrRuntimeInvalidConversionToInteger + case nativeCallStatusCodeUnreachable: + err = wasmruntime.ErrRuntimeUnreachable + case nativeCallStatusCodeMemoryOutOfBounds: + err = wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess + case nativeCallStatusCodeInvalidTableAccess: + err = wasmruntime.ErrRuntimeInvalidTableAccess + case nativeCallStatusCodeTypeMismatchOnIndirectCall: + err = wasmruntime.ErrRuntimeIndirectCallTypeMismatch + } + panic(err) +} + +func (s nativeCallStatusCode) String() (ret string) { + switch s { + case nativeCallStatusCodeReturned: + ret = "returned" + case nativeCallStatusCodeCallGoHostFunction: + ret = "call_host_function" + case nativeCallStatusCodeCallBuiltInFunction: + ret = "call_builtin_function" + case nativeCallStatusCodeUnreachable: + ret = "unreachable" + case nativeCallStatusCodeInvalidFloatToIntConversion: + ret = "invalid float to int conversion" + case nativeCallStatusCodeMemoryOutOfBounds: + ret = "memory out of bounds" + case nativeCallStatusCodeInvalidTableAccess: + ret = "invalid table access" + case nativeCallStatusCodeTypeMismatchOnIndirectCall: + ret = "type mismatch on indirect call" + case nativeCallStatusIntegerOverflow: + ret = "integer overflow" + case nativeCallStatusIntegerDivisionByZero: + ret = "integer division by zero" + case nativeCallStatusModuleClosed: + ret = "module closed" + default: + panic("BUG") + } + return +} + +// releaseCompiledModule is a runtime.SetFinalizer function that munmaps the compiledModule.executable. +func releaseCompiledModule(cm *compiledModule) { + if err := cm.executable.Unmap(); err != nil { + // munmap failure cannot recover, and happen asynchronously on the + // finalizer thread. While finalizer functions can return errors, + // they are ignored. + panic(fmt.Errorf("compiler: failed to munmap code segment: %w", err)) + } +} + +// CompiledModuleCount implements the same method as documented on wasm.Engine. +func (e *engine) CompiledModuleCount() uint32 { + return uint32(len(e.codes)) +} + +// DeleteCompiledModule implements the same method as documented on wasm.Engine. +func (e *engine) DeleteCompiledModule(module *wasm.Module) { + e.deleteCompiledModule(module) +} + +// Close implements the same method as documented on wasm.Engine. +func (e *engine) Close() (err error) { + e.mux.Lock() + defer e.mux.Unlock() + // Releasing the references to compiled codes including the memory-mapped machine codes. + e.codes = nil + return +} + +// CompileModule implements the same method as documented on wasm.Engine. +func (e *engine) CompileModule(_ context.Context, module *wasm.Module, listeners []experimental.FunctionListener, ensureTermination bool) error { + if _, ok, err := e.getCompiledModule(module, listeners); ok { // cache hit! + return nil + } else if err != nil { + return err + } + + irCompiler, err := wazeroir.NewCompiler(e.enabledFeatures, callFrameDataSizeInUint64, module, ensureTermination) + if err != nil { + return err + } + + var withGoFunc bool + localFuncs, importedFuncs := len(module.FunctionSection), module.ImportFunctionCount + cm := &compiledModule{ + compiledCode: &compiledCode{ + source: module, + }, + functions: make([]compiledFunction, localFuncs), + ensureTermination: ensureTermination, + } + + if localFuncs == 0 { + return e.addCompiledModule(module, cm, withGoFunc) + } + + // As this uses mmap, we need to munmap on the compiled machine code when it's GCed. + e.setFinalizer(cm, releaseCompiledModule) + ln := len(listeners) + cmp := newCompiler() + asmNodes := new(asmNodes) + offsets := new(offsets) + + // The executable code is allocated in memory mappings held by the + // CodeSegment, which gros on demand when it exhausts its capacity. + var executable asm.CodeSegment + defer func() { + // At the end of the function, the executable is set on the compiled + // module and the local variable cleared; until then, the function owns + // the memory mapping and is reponsible for clearing it if it returns + // due to an error. Note that an error at this stage is not recoverable + // so we panic if we fail to unmap the memory segment. + if err := executable.Unmap(); err != nil { + panic(fmt.Errorf("compiler: failed to munmap code segment: %w", err)) + } + }() + + for i := range module.CodeSection { + typ := &module.TypeSection[module.FunctionSection[i]] + buf := executable.NextCodeSection() + funcIndex := wasm.Index(i) + compiledFn := &cm.functions[i] + compiledFn.executableOffset = executable.Size() + compiledFn.parent = cm.compiledCode + compiledFn.index = importedFuncs + funcIndex + if i < ln { + compiledFn.listener = listeners[i] + } + + if codeSeg := &module.CodeSection[i]; codeSeg.GoFunc != nil { + cmp.Init(typ, nil, compiledFn.listener != nil) + withGoFunc = true + if err = compileGoDefinedHostFunction(buf, cmp); err != nil { + def := module.FunctionDefinition(compiledFn.index) + return fmt.Errorf("error compiling host go func[%s]: %w", def.DebugName(), err) + } + compiledFn.goFunc = codeSeg.GoFunc + } else { + ir, err := irCompiler.Next() + if err != nil { + return fmt.Errorf("failed to lower func[%d]: %v", i, err) + } + cmp.Init(typ, ir, compiledFn.listener != nil) + + compiledFn.stackPointerCeil, compiledFn.sourceOffsetMap, err = compileWasmFunction(buf, cmp, ir, asmNodes, offsets) + if err != nil { + def := module.FunctionDefinition(compiledFn.index) + return fmt.Errorf("error compiling wasm func[%s]: %w", def.DebugName(), err) + } + } + } + + if runtime.GOARCH == "arm64" { + // On arm64, we cannot give all of rwx at the same time, so we change it to exec. + if err := platform.MprotectRX(executable.Bytes()); err != nil { + return err + } + } + cm.executable, executable = executable, asm.CodeSegment{} + return e.addCompiledModule(module, cm, withGoFunc) +} + +// NewModuleEngine implements the same method as documented on wasm.Engine. +func (e *engine) NewModuleEngine(module *wasm.Module, instance *wasm.ModuleInstance) (wasm.ModuleEngine, error) { + me := &moduleEngine{ + functions: make([]function, len(module.FunctionSection)+int(module.ImportFunctionCount)), + } + + // Note: imported functions are resolved in moduleEngine.ResolveImportedFunction. + + cm, ok, err := e.getCompiledModule(module, + // listeners arg is not needed here since NewModuleEngine is called after CompileModule which + // ensures the association of listener with *code. + nil) + if !ok { + return nil, errors.New("source module must be compiled before instantiation") + } else if err != nil { + return nil, err + } + + for i := range cm.functions { + c := &cm.functions[i] + offset := int(module.ImportFunctionCount) + i + typeIndex := module.FunctionSection[i] + me.functions[offset] = function{ + codeInitialAddress: cm.executable.Addr() + c.executableOffset, + moduleInstance: instance, + typeID: instance.TypeIDs[typeIndex], + funcType: &module.TypeSection[typeIndex], + parent: c, + } + } + + me.module = cm + return me, nil +} + +// ResolveImportedFunction implements wasm.ModuleEngine. +func (e *moduleEngine) ResolveImportedFunction(index, indexInImportedModule wasm.Index, importedModuleEngine wasm.ModuleEngine) { + imported := importedModuleEngine.(*moduleEngine) + // Copies the content from the import target moduleEngine. + e.functions[index] = imported.functions[indexInImportedModule] +} + +// GetGlobalValue implements the same method as documented on wasm.ModuleEngine. +func (e *moduleEngine) GetGlobalValue(wasm.Index) (lo, hi uint64) { + panic("BUG: GetGlobalValue should never be called on compiler mode") +} + +// OwnsGlobals implements the same method as documented on wasm.ModuleEngine. +func (e *moduleEngine) OwnsGlobals() bool { return false } + +// ResolveImportedMemory implements wasm.ModuleEngine. +func (e *moduleEngine) ResolveImportedMemory(wasm.ModuleEngine) {} + +// FunctionInstanceReference implements the same method as documented on wasm.ModuleEngine. +func (e *moduleEngine) FunctionInstanceReference(funcIndex wasm.Index) wasm.Reference { + return uintptr(unsafe.Pointer(&e.functions[funcIndex])) +} + +// DoneInstantiation implements wasm.ModuleEngine. +func (e *moduleEngine) DoneInstantiation() {} + +// NewFunction implements wasm.ModuleEngine. +func (e *moduleEngine) NewFunction(index wasm.Index) api.Function { + return e.newFunction(&e.functions[index]) +} + +func (e *moduleEngine) newFunction(f *function) api.Function { + initStackSize := initialStackSize + if initialStackSize < f.parent.stackPointerCeil { + initStackSize = f.parent.stackPointerCeil * 2 + } + return e.newCallEngine(initStackSize, f) +} + +// LookupFunction implements the same method as documented on wasm.ModuleEngine. +func (e *moduleEngine) LookupFunction(t *wasm.TableInstance, typeId wasm.FunctionTypeID, tableOffset wasm.Index) (*wasm.ModuleInstance, wasm.Index) { + if tableOffset >= uint32(len(t.References)) || t.Type != wasm.RefTypeFuncref { + panic(wasmruntime.ErrRuntimeInvalidTableAccess) + } + rawPtr := t.References[tableOffset] + if rawPtr == 0 { + panic(wasmruntime.ErrRuntimeInvalidTableAccess) + } + + tf := functionFromUintptr(rawPtr) + if tf.typeID != typeId { + panic(wasmruntime.ErrRuntimeIndirectCallTypeMismatch) + } + return tf.moduleInstance, tf.parent.index +} + +// functionFromUintptr resurrects the original *function from the given uintptr +// which comes from either funcref table or OpcodeRefFunc instruction. +func functionFromUintptr(ptr uintptr) *function { + // Wraps ptrs as the double pointer in order to avoid the unsafe access as detected by race detector. + // + // For example, if we have (*function)(unsafe.Pointer(ptr)) instead, then the race detector's "checkptr" + // subroutine wanrs as "checkptr: pointer arithmetic result points to invalid allocation" + // https://github.com/golang/go/blob/1ce7fcf139417d618c2730010ede2afb41664211/src/runtime/checkptr.go#L69 + var wrapped *uintptr = &ptr + return *(**function)(unsafe.Pointer(wrapped)) +} + +// Definition implements the same method as documented on wasm.ModuleEngine. +func (ce *callEngine) Definition() api.FunctionDefinition { + return ce.initialFn.definition() +} + +func (f *function) definition() api.FunctionDefinition { + compiled := f.parent + return compiled.parent.source.FunctionDefinition(compiled.index) +} + +// Call implements the same method as documented on wasm.ModuleEngine. +func (ce *callEngine) Call(ctx context.Context, params ...uint64) (results []uint64, err error) { + ft := ce.initialFn.funcType + if n := ft.ParamNumInUint64; n != len(params) { + return nil, fmt.Errorf("expected %d params, but passed %d", n, len(params)) + } + return ce.call(ctx, params, nil) +} + +// CallWithStack implements the same method as documented on wasm.ModuleEngine. +func (ce *callEngine) CallWithStack(ctx context.Context, stack []uint64) error { + params, results, err := wasm.SplitCallStack(ce.initialFn.funcType, stack) + if err != nil { + return err + } + _, err = ce.call(ctx, params, results) + return err +} + +func (ce *callEngine) call(ctx context.Context, params, results []uint64) (_ []uint64, err error) { + m := ce.initialFn.moduleInstance + if ce.module.ensureTermination { + select { + case <-ctx.Done(): + // If the provided context is already done, close the call context + // and return the error. + m.CloseWithCtxErr(ctx) + return nil, m.FailIfClosed() + default: + } + } + + // We ensure that this Call method never panics as + // this Call method is indirectly invoked by embedders via store.CallFunction, + // and we have to make sure that all the runtime errors, including the one happening inside + // host functions, will be captured as errors, not panics. + defer func() { + err = ce.deferredOnCall(ctx, m, recover()) + if err == nil { + // If the module closed during the call, and the call didn't err for another reason, set an ExitError. + err = m.FailIfClosed() + } + // Ensure that the compiled module will never be GC'd before this method returns. + runtime.KeepAlive(ce.module) + }() + + ft := ce.initialFn.funcType + ce.initializeStack(ft, params) + + if ce.module.ensureTermination { + done := m.CloseModuleOnCanceledOrTimeout(ctx) + defer done() + } + + ce.execWasmFunction(ctx, m) + + // This returns a safe copy of the results, instead of a slice view. If we + // returned a re-slice, the caller could accidentally or purposefully + // corrupt the stack of subsequent calls. + if results == nil && ft.ResultNumInUint64 > 0 { + results = make([]uint64, ft.ResultNumInUint64) + } + copy(results, ce.stack) + return results, nil +} + +// initializeStack initializes callEngine.stack before entering native code. +// +// The stack must look like, if len(params) < len(results): +// +// [arg0, arg1, ..., argN, 0, 0, 0, ... +// { } ^ +// callFrame | +// | +// stackPointer +// +// else: +// +// [arg0, arg1, ..., argN, _, _, _, 0, 0, 0, ... +// | | { } ^ +// |reserved| callFrame | +// | | | +// |--------> stackPointer +// len(results)-len(params) +// +// where we reserve the slots below the callframe with the length len(results)-len(params). +// +// Note: callFrame { } is zeroed to indicate that the initial "caller" is this callEngine, not the Wasm function. +// +// See callEngine.stack as well. +func (ce *callEngine) initializeStack(tp *wasm.FunctionType, args []uint64) { + for _, v := range args { + ce.pushValue(v) + } + + ce.stackPointer = uint64(callFrameOffset(tp)) + + for i := 0; i < callFrameDataSizeInUint64; i++ { + ce.stack[ce.stackPointer] = 0 + ce.stackPointer++ + } +} + +// callFrameOffset returns the offset of the call frame from the stack base pointer. +// +// See the diagram in callEngine.stack. +func callFrameOffset(funcType *wasm.FunctionType) (ret int) { + ret = funcType.ResultNumInUint64 + if ret < funcType.ParamNumInUint64 { + ret = funcType.ParamNumInUint64 + } + return +} + +// deferredOnCall takes the recovered value `recovered`, and wraps it +// with the call frame stack traces when not nil. This also resets +// the state of callEngine so that it can be used for the subsequent calls. +// +// This is defined for testability. +func (ce *callEngine) deferredOnCall(ctx context.Context, m *wasm.ModuleInstance, recovered interface{}) (err error) { + if recovered != nil { + builder := wasmdebug.NewErrorBuilder() + + // Unwinds call frames from the values stack, starting from the + // current function `ce.fn`, and the current stack base pointer `ce.stackBasePointerInBytes`. + fn := ce.fn + pc := uint64(ce.returnAddress) + stackBasePointer := int(ce.stackBasePointerInBytes >> 3) + functionListeners := make([]functionListenerInvocation, 0, 16) + + for { + def := fn.definition() + + // sourceInfo holds the source code information corresponding to the frame. + // It is not empty only when the DWARF is enabled. + var sources []string + if p := fn.parent; p.parent.executable.Bytes() != nil { + if fn.parent.sourceOffsetMap.irOperationSourceOffsetsInWasmBinary != nil { + offset := fn.getSourceOffsetInWasmBinary(pc) + sources = p.parent.source.DWARFLines.Line(offset) + } + } + builder.AddFrame(def.DebugName(), def.ParamTypes(), def.ResultTypes(), sources) + + if fn.parent.listener != nil { + functionListeners = append(functionListeners, functionListenerInvocation{ + FunctionListener: fn.parent.listener, + def: fn.definition(), + }) + } + + callFrameOffset := callFrameOffset(fn.funcType) + if stackBasePointer != 0 { + frame := *(*callFrame)(unsafe.Pointer(&ce.stack[stackBasePointer+callFrameOffset])) + fn = frame.function + pc = uint64(frame.returnAddress) + stackBasePointer = int(frame.returnStackBasePointerInBytes >> 3) + } else { // base == 0 means that this was the last call frame stacked. + break + } + } + + err = builder.FromRecovered(recovered) + for i := range functionListeners { + functionListeners[i].Abort(ctx, m, functionListeners[i].def, err) + } + } + + // Allows the reuse of CallEngine. + ce.stackBasePointerInBytes, ce.stackPointer, ce.moduleInstance = 0, 0, nil + ce.moduleContext.fn = ce.initialFn + return +} + +// getSourceOffsetInWasmBinary returns the corresponding offset in the original Wasm binary's code section +// for the given pc (which is an absolute address in the memory). +// If needPreviousInstr equals true, this returns the previous instruction's offset for the given pc. +func (f *function) getSourceOffsetInWasmBinary(pc uint64) uint64 { + srcMap := &f.parent.sourceOffsetMap + n := bitpack.OffsetArrayLen(srcMap.irOperationOffsetsInNativeBinary) + 1 + + // Calculate the offset in the compiled native binary. + pcOffsetInNativeBinary := pc - uint64(f.codeInitialAddress) + + // Then, do the binary search on the list of offsets in the native binary + // for all the IR operations. This returns the index of the *next* IR + // operation of the one corresponding to the origin of this pc. + // See sort.Search. + // + // TODO: the underlying implementation of irOperationOffsetsInNativeBinary + // uses uses delta encoding an calls to the Index method might require a + // O(N) scan of the underlying array, turning binary search into a + // O(N*log(N)) operation. If this code path ends up being a bottleneck, + // we could add a Search method on the bitpack.OffsetArray types to delegate + // the lookup to the underlying data structure, allowing for the selection + // of a more optimized version of the algorithm. If you do so, please add a + // benchmark to verify the impact on compute time. + index := sort.Search(n, func(i int) bool { + if i == n-1 { + return true + } + return srcMap.irOperationOffsetsInNativeBinary.Index(i) >= pcOffsetInNativeBinary + }) + if index == 0 && bitpack.OffsetArrayLen(srcMap.irOperationSourceOffsetsInWasmBinary) > 0 { + // When pc is the beginning of the function, the next IR + // operation (returned by sort.Search) is the first of the + // offset map. + return srcMap.irOperationSourceOffsetsInWasmBinary.Index(0) + } + + if index == n || index == 0 { // This case, somehow pc is not found in the source offset map. + return 0 + } else { + return srcMap.irOperationSourceOffsetsInWasmBinary.Index(index - 1) + } +} + +func NewEngine(_ context.Context, enabledFeatures api.CoreFeatures, fileCache filecache.Cache) wasm.Engine { + return newEngine(enabledFeatures, fileCache) +} + +func newEngine(enabledFeatures api.CoreFeatures, fileCache filecache.Cache) *engine { + return &engine{ + enabledFeatures: enabledFeatures, + codes: map[wasm.ModuleID]*compiledModule{}, + setFinalizer: runtime.SetFinalizer, + fileCache: fileCache, + wazeroVersion: version.GetWazeroVersion(), + } +} + +// Do not make this variable as constant, otherwise there would be +// dangerous memory access from native code. +// +// Background: Go has a mechanism called "goroutine stack-shrink" where Go +// runtime shrinks Goroutine's stack when it is GCing. Shrinking means that +// all the contents on the goroutine stack will be relocated by runtime, +// Therefore, the memory address of these contents change undeterministically. +// Not only shrinks, but also Go runtime grows the goroutine stack at any point +// of function call entries, which also might end up relocating contents. +// +// On the other hand, we hold pointers to the data region of value stack and +// call-frame stack slices and use these raw pointers from native code. +// Therefore, it is dangerous if these two stacks are allocated on stack +// as these stack's address might be changed by Goroutine which we cannot +// detect. +// +// By declaring these values as `var`, slices created via `make([]..., var)` +// will never be allocated on stack [1]. This means accessing these slices via +// raw pointers is safe: As of version 1.21, Go's garbage collector never relocates +// heap-allocated objects (aka no compaction of memory [2]). +// +// On Go upgrades, re-validate heap-allocation via `go build -gcflags='-m' ./internal/engine/compiler/...`. +// +// [1] https://github.com/golang/go/blob/c19c4c566c63818dfd059b352e52c4710eecf14d/src/cmd/compile/internal/escape/utils.go#L213-L215 +// [2] https://github.com/golang/go/blob/c19c4c566c63818dfd059b352e52c4710eecf14d/src/runtime/mgc.go#L9 +// [3] https://mayurwadekar2.medium.com/escape-analysis-in-golang-ee40a1c064c1 +// [4] https://medium.com/@yulang.chu/go-stack-or-heap-2-slices-which-keep-in-stack-have-limitation-of-size-b3f3adfd6190 +var initialStackSize uint64 = 512 + +func (e *moduleEngine) newCallEngine(stackSize uint64, fn *function) *callEngine { + ce := &callEngine{ + stack: make([]uint64, stackSize), + archContext: newArchContext(), + initialFn: fn, + moduleContext: moduleContext{fn: fn}, + module: e.module, + } + + stackHeader := (*reflect.SliceHeader)(unsafe.Pointer(&ce.stack)) + ce.stackContext = stackContext{ + stackElement0Address: stackHeader.Data, + stackLenInBytes: uint64(stackHeader.Len) << 3, + } + return ce +} + +func (ce *callEngine) popValue() (ret uint64) { + ce.stackContext.stackPointer-- + ret = ce.stack[ce.stackTopIndex()] + return +} + +func (ce *callEngine) pushValue(v uint64) { + ce.stack[ce.stackTopIndex()] = v + ce.stackContext.stackPointer++ +} + +func (ce *callEngine) stackTopIndex() uint64 { + return ce.stackContext.stackPointer + (ce.stackContext.stackBasePointerInBytes >> 3) +} + +const ( + builtinFunctionIndexMemoryGrow wasm.Index = iota + builtinFunctionIndexGrowStack + builtinFunctionIndexTableGrow + builtinFunctionIndexFunctionListenerBefore + builtinFunctionIndexFunctionListenerAfter + builtinFunctionIndexCheckExitCode + // builtinFunctionIndexBreakPoint is internal (only for wazero developers). Disabled by default. + builtinFunctionIndexBreakPoint +) + +func (ce *callEngine) execWasmFunction(ctx context.Context, m *wasm.ModuleInstance) { + codeAddr := ce.initialFn.codeInitialAddress + modAddr := ce.initialFn.moduleInstance + +entry: + { + // Call into the native code. + nativecall(codeAddr, ce, modAddr) + + // Check the status code from Compiler code. + switch status := ce.exitContext.statusCode; status { + case nativeCallStatusCodeReturned: + case nativeCallStatusCodeCallGoHostFunction: + calleeHostFunction := ce.moduleContext.fn + base := int(ce.stackBasePointerInBytes >> 3) + + // In the compiler engine, ce.stack has enough capacity for the + // max of param or result length, so we don't need to grow when + // there are more results than parameters. + stackLen := calleeHostFunction.funcType.ParamNumInUint64 + if resultLen := calleeHostFunction.funcType.ResultNumInUint64; resultLen > stackLen { + stackLen = resultLen + } + stack := ce.stack[base : base+stackLen] + + fn := calleeHostFunction.parent.goFunc + switch fn := fn.(type) { + case api.GoModuleFunction: + fn.Call(ctx, ce.callerModuleInstance, stack) + case api.GoFunction: + fn.Call(ctx, stack) + } + + codeAddr, modAddr = ce.returnAddress, ce.moduleInstance + goto entry + case nativeCallStatusCodeCallBuiltInFunction: + caller := ce.moduleContext.fn + switch ce.exitContext.builtinFunctionCallIndex { + case builtinFunctionIndexMemoryGrow: + ce.builtinFunctionMemoryGrow(caller.moduleInstance.MemoryInstance) + case builtinFunctionIndexGrowStack: + ce.builtinFunctionGrowStack(caller.parent.stackPointerCeil) + case builtinFunctionIndexTableGrow: + ce.builtinFunctionTableGrow(caller.moduleInstance.Tables) + case builtinFunctionIndexFunctionListenerBefore: + ce.builtinFunctionFunctionListenerBefore(ctx, m, caller) + case builtinFunctionIndexFunctionListenerAfter: + ce.builtinFunctionFunctionListenerAfter(ctx, m, caller) + case builtinFunctionIndexCheckExitCode: + // Note: this operation must be done in Go, not native code. The reason is that + // native code cannot be preempted and that means it can block forever if there are not + // enough OS threads (which we don't have control over). + if err := m.FailIfClosed(); err != nil { + panic(err) + } + } + if false { + if ce.exitContext.builtinFunctionCallIndex == builtinFunctionIndexBreakPoint { + runtime.Breakpoint() + } + } + + codeAddr, modAddr = ce.returnAddress, ce.moduleInstance + goto entry + default: + status.causePanic() + } + } +} + +// callStackCeiling is the maximum WebAssembly call frame stack height. This allows wazero to raise +// wasm.ErrCallStackOverflow instead of overflowing the Go runtime. +// +// The default value should suffice for most use cases. Those wishing to change this can via `go build -ldflags`. +// +// TODO: allows to configure this via context? +var callStackCeiling = uint64(5000000) // in uint64 (8 bytes) == 40000000 bytes in total == 40mb. + +func (ce *callEngine) builtinFunctionGrowStack(stackPointerCeil uint64) { + oldLen := uint64(len(ce.stack)) + if callStackCeiling < oldLen { + panic(wasmruntime.ErrRuntimeStackOverflow) + } + + // Extends the stack's length to oldLen*2+stackPointerCeil. + newLen := oldLen<<1 + (stackPointerCeil) + newStack := make([]uint64, newLen) + top := ce.stackTopIndex() + copy(newStack[:top], ce.stack[:top]) + ce.stack = newStack + stackHeader := (*reflect.SliceHeader)(unsafe.Pointer(&ce.stack)) + ce.stackContext.stackElement0Address = stackHeader.Data + ce.stackContext.stackLenInBytes = newLen << 3 +} + +func (ce *callEngine) builtinFunctionMemoryGrow(mem *wasm.MemoryInstance) { + newPages := ce.popValue() + + if res, ok := mem.Grow(uint32(newPages)); !ok { + ce.pushValue(uint64(0xffffffff)) // = -1 in signed 32-bit integer. + } else { + ce.pushValue(uint64(res)) + } + + // Update the moduleContext fields as they become stale after the update ^^. + bufSliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&mem.Buffer)) + ce.moduleContext.memorySliceLen = uint64(bufSliceHeader.Len) + ce.moduleContext.memoryElement0Address = bufSliceHeader.Data +} + +func (ce *callEngine) builtinFunctionTableGrow(tables []*wasm.TableInstance) { + tableIndex := uint32(ce.popValue()) + table := tables[tableIndex] // verified not to be out of range by the func validation at compilation phase. + num := ce.popValue() + ref := ce.popValue() + res := table.Grow(uint32(num), uintptr(ref)) + ce.pushValue(uint64(res)) +} + +// stackIterator implements experimental.StackIterator. +type stackIterator struct { + stack []uint64 + fn *function + base int + pc uint64 + started bool +} + +func (si *stackIterator) reset(stack []uint64, fn *function, base int, pc uint64) { + si.stack = stack + si.fn = fn + si.base = base + si.pc = pc + si.started = false +} + +func (si *stackIterator) clear() { + si.stack = nil + si.fn = nil + si.base = 0 + si.started = false +} + +// Next implements the same method as documented on experimental.StackIterator. +func (si *stackIterator) Next() bool { + if !si.started { + si.started = true + return true + } + + if si.fn == nil || si.base == 0 { + return false + } + + frame := si.base + callFrameOffset(si.fn.funcType) + si.pc = si.stack[frame+0] + si.base = int(si.stack[frame+1] >> 3) + // *function lives in the third field of callFrame struct. This must be + // aligned with the definition of callFrame struct. + si.fn = *(**function)(unsafe.Pointer(&si.stack[frame+2])) + return si.fn != nil +} + +// ProgramCounter implements the same method as documented on experimental.StackIterator. +func (si *stackIterator) ProgramCounter() experimental.ProgramCounter { + return experimental.ProgramCounter(si.pc) +} + +// Function implements the same method as documented on experimental.StackIterator. +func (si *stackIterator) Function() experimental.InternalFunction { + return internalFunction{si.fn} +} + +// internalFunction implements experimental.InternalFunction. +type internalFunction struct{ *function } + +// Definition implements the same method as documented on experimental.InternalFunction. +func (f internalFunction) Definition() api.FunctionDefinition { + return f.definition() +} + +// SourceOffsetForPC implements the same method as documented on experimental.InternalFunction. +func (f internalFunction) SourceOffsetForPC(pc experimental.ProgramCounter) uint64 { + p := f.parent + if bitpack.OffsetArrayLen(p.sourceOffsetMap.irOperationSourceOffsetsInWasmBinary) == 0 { + return 0 // source not available + } + return f.getSourceOffsetInWasmBinary(uint64(pc)) +} + +func (ce *callEngine) builtinFunctionFunctionListenerBefore(ctx context.Context, mod api.Module, fn *function) { + base := int(ce.stackBasePointerInBytes >> 3) + pc := uint64(ce.returnAddress) + ce.stackIterator.reset(ce.stack, fn, base, pc) + + params := ce.stack[base : base+fn.funcType.ParamNumInUint64] + fn.parent.listener.Before(ctx, mod, fn.definition(), params, &ce.stackIterator) + + ce.stackIterator.clear() +} + +func (ce *callEngine) builtinFunctionFunctionListenerAfter(ctx context.Context, mod api.Module, fn *function) { + base := int(ce.stackBasePointerInBytes >> 3) + fn.parent.listener.After(ctx, mod, fn.definition(), ce.stack[base:base+fn.funcType.ResultNumInUint64]) +} + +func compileGoDefinedHostFunction(buf asm.Buffer, cmp compiler) error { + if err := cmp.compileGoDefinedHostFunction(); err != nil { + return err + } + _, err := cmp.compile(buf) + return err +} + +type asmNodes struct { + nodes []asm.Node +} + +type offsets struct { + values []uint64 +} + +func compileWasmFunction(buf asm.Buffer, cmp compiler, ir *wazeroir.CompilationResult, asmNodes *asmNodes, offsets *offsets) (spCeil uint64, sm sourceOffsetMap, err error) { + if err = cmp.compilePreamble(); err != nil { + err = fmt.Errorf("failed to emit preamble: %w", err) + return + } + + needSourceOffsets := len(ir.IROperationSourceOffsetsInWasmBinary) > 0 + var irOpBegins []asm.Node + if needSourceOffsets { + irOpBegins = append(asmNodes.nodes[:0], make([]asm.Node, len(ir.Operations))...) + defer func() { asmNodes.nodes = irOpBegins }() + } + + var skip bool + for i := range ir.Operations { + op := &ir.Operations[i] + if needSourceOffsets { + // If this compilation requires source offsets for DWARF based back trace, + // we emit a NOP node at the beginning of each IR operation to get the + // binary offset of the beginning of the corresponding compiled native code. + irOpBegins[i] = cmp.compileNOP() + } + + // Compiler determines whether skip the entire label. + // For example, if the label doesn't have any caller, + // we don't need to generate native code at all as we never reach the region. + if op.Kind == wazeroir.OperationKindLabel { + skip = cmp.compileLabel(op) + } + if skip { + continue + } + + if false { + fmt.Printf("compiling op=%s: %s\n", op.Kind, cmp) + } + switch op.Kind { + case wazeroir.OperationKindUnreachable: + err = cmp.compileUnreachable() + case wazeroir.OperationKindLabel: + // label op is already handled ^^. + case wazeroir.OperationKindBr: + err = cmp.compileBr(op) + case wazeroir.OperationKindBrIf: + err = cmp.compileBrIf(op) + case wazeroir.OperationKindBrTable: + err = cmp.compileBrTable(op) + case wazeroir.OperationKindCall: + err = cmp.compileCall(op) + case wazeroir.OperationKindCallIndirect: + err = cmp.compileCallIndirect(op) + case wazeroir.OperationKindDrop: + err = cmp.compileDrop(op) + case wazeroir.OperationKindSelect: + err = cmp.compileSelect(op) + case wazeroir.OperationKindPick: + err = cmp.compilePick(op) + case wazeroir.OperationKindSet: + err = cmp.compileSet(op) + case wazeroir.OperationKindGlobalGet: + err = cmp.compileGlobalGet(op) + case wazeroir.OperationKindGlobalSet: + err = cmp.compileGlobalSet(op) + case wazeroir.OperationKindLoad: + err = cmp.compileLoad(op) + case wazeroir.OperationKindLoad8: + err = cmp.compileLoad8(op) + case wazeroir.OperationKindLoad16: + err = cmp.compileLoad16(op) + case wazeroir.OperationKindLoad32: + err = cmp.compileLoad32(op) + case wazeroir.OperationKindStore: + err = cmp.compileStore(op) + case wazeroir.OperationKindStore8: + err = cmp.compileStore8(op) + case wazeroir.OperationKindStore16: + err = cmp.compileStore16(op) + case wazeroir.OperationKindStore32: + err = cmp.compileStore32(op) + case wazeroir.OperationKindMemorySize: + err = cmp.compileMemorySize() + case wazeroir.OperationKindMemoryGrow: + err = cmp.compileMemoryGrow() + case wazeroir.OperationKindConstI32: + err = cmp.compileConstI32(op) + case wazeroir.OperationKindConstI64: + err = cmp.compileConstI64(op) + case wazeroir.OperationKindConstF32: + err = cmp.compileConstF32(op) + case wazeroir.OperationKindConstF64: + err = cmp.compileConstF64(op) + case wazeroir.OperationKindEq: + err = cmp.compileEq(op) + case wazeroir.OperationKindNe: + err = cmp.compileNe(op) + case wazeroir.OperationKindEqz: + err = cmp.compileEqz(op) + case wazeroir.OperationKindLt: + err = cmp.compileLt(op) + case wazeroir.OperationKindGt: + err = cmp.compileGt(op) + case wazeroir.OperationKindLe: + err = cmp.compileLe(op) + case wazeroir.OperationKindGe: + err = cmp.compileGe(op) + case wazeroir.OperationKindAdd: + err = cmp.compileAdd(op) + case wazeroir.OperationKindSub: + err = cmp.compileSub(op) + case wazeroir.OperationKindMul: + err = cmp.compileMul(op) + case wazeroir.OperationKindClz: + err = cmp.compileClz(op) + case wazeroir.OperationKindCtz: + err = cmp.compileCtz(op) + case wazeroir.OperationKindPopcnt: + err = cmp.compilePopcnt(op) + case wazeroir.OperationKindDiv: + err = cmp.compileDiv(op) + case wazeroir.OperationKindRem: + err = cmp.compileRem(op) + case wazeroir.OperationKindAnd: + err = cmp.compileAnd(op) + case wazeroir.OperationKindOr: + err = cmp.compileOr(op) + case wazeroir.OperationKindXor: + err = cmp.compileXor(op) + case wazeroir.OperationKindShl: + err = cmp.compileShl(op) + case wazeroir.OperationKindShr: + err = cmp.compileShr(op) + case wazeroir.OperationKindRotl: + err = cmp.compileRotl(op) + case wazeroir.OperationKindRotr: + err = cmp.compileRotr(op) + case wazeroir.OperationKindAbs: + err = cmp.compileAbs(op) + case wazeroir.OperationKindNeg: + err = cmp.compileNeg(op) + case wazeroir.OperationKindCeil: + err = cmp.compileCeil(op) + case wazeroir.OperationKindFloor: + err = cmp.compileFloor(op) + case wazeroir.OperationKindTrunc: + err = cmp.compileTrunc(op) + case wazeroir.OperationKindNearest: + err = cmp.compileNearest(op) + case wazeroir.OperationKindSqrt: + err = cmp.compileSqrt(op) + case wazeroir.OperationKindMin: + err = cmp.compileMin(op) + case wazeroir.OperationKindMax: + err = cmp.compileMax(op) + case wazeroir.OperationKindCopysign: + err = cmp.compileCopysign(op) + case wazeroir.OperationKindI32WrapFromI64: + err = cmp.compileI32WrapFromI64() + case wazeroir.OperationKindITruncFromF: + err = cmp.compileITruncFromF(op) + case wazeroir.OperationKindFConvertFromI: + err = cmp.compileFConvertFromI(op) + case wazeroir.OperationKindF32DemoteFromF64: + err = cmp.compileF32DemoteFromF64() + case wazeroir.OperationKindF64PromoteFromF32: + err = cmp.compileF64PromoteFromF32() + case wazeroir.OperationKindI32ReinterpretFromF32: + err = cmp.compileI32ReinterpretFromF32() + case wazeroir.OperationKindI64ReinterpretFromF64: + err = cmp.compileI64ReinterpretFromF64() + case wazeroir.OperationKindF32ReinterpretFromI32: + err = cmp.compileF32ReinterpretFromI32() + case wazeroir.OperationKindF64ReinterpretFromI64: + err = cmp.compileF64ReinterpretFromI64() + case wazeroir.OperationKindExtend: + err = cmp.compileExtend(op) + case wazeroir.OperationKindSignExtend32From8: + err = cmp.compileSignExtend32From8() + case wazeroir.OperationKindSignExtend32From16: + err = cmp.compileSignExtend32From16() + case wazeroir.OperationKindSignExtend64From8: + err = cmp.compileSignExtend64From8() + case wazeroir.OperationKindSignExtend64From16: + err = cmp.compileSignExtend64From16() + case wazeroir.OperationKindSignExtend64From32: + err = cmp.compileSignExtend64From32() + case wazeroir.OperationKindMemoryInit: + err = cmp.compileMemoryInit(op) + case wazeroir.OperationKindDataDrop: + err = cmp.compileDataDrop(op) + case wazeroir.OperationKindMemoryCopy: + err = cmp.compileMemoryCopy() + case wazeroir.OperationKindMemoryFill: + err = cmp.compileMemoryFill() + case wazeroir.OperationKindTableInit: + err = cmp.compileTableInit(op) + case wazeroir.OperationKindElemDrop: + err = cmp.compileElemDrop(op) + case wazeroir.OperationKindTableCopy: + err = cmp.compileTableCopy(op) + case wazeroir.OperationKindRefFunc: + err = cmp.compileRefFunc(op) + case wazeroir.OperationKindTableGet: + err = cmp.compileTableGet(op) + case wazeroir.OperationKindTableSet: + err = cmp.compileTableSet(op) + case wazeroir.OperationKindTableGrow: + err = cmp.compileTableGrow(op) + case wazeroir.OperationKindTableSize: + err = cmp.compileTableSize(op) + case wazeroir.OperationKindTableFill: + err = cmp.compileTableFill(op) + case wazeroir.OperationKindV128Const: + err = cmp.compileV128Const(op) + case wazeroir.OperationKindV128Add: + err = cmp.compileV128Add(op) + case wazeroir.OperationKindV128Sub: + err = cmp.compileV128Sub(op) + case wazeroir.OperationKindV128Load: + err = cmp.compileV128Load(op) + case wazeroir.OperationKindV128LoadLane: + err = cmp.compileV128LoadLane(op) + case wazeroir.OperationKindV128Store: + err = cmp.compileV128Store(op) + case wazeroir.OperationKindV128StoreLane: + err = cmp.compileV128StoreLane(op) + case wazeroir.OperationKindV128ExtractLane: + err = cmp.compileV128ExtractLane(op) + case wazeroir.OperationKindV128ReplaceLane: + err = cmp.compileV128ReplaceLane(op) + case wazeroir.OperationKindV128Splat: + err = cmp.compileV128Splat(op) + case wazeroir.OperationKindV128Shuffle: + err = cmp.compileV128Shuffle(op) + case wazeroir.OperationKindV128Swizzle: + err = cmp.compileV128Swizzle(op) + case wazeroir.OperationKindV128AnyTrue: + err = cmp.compileV128AnyTrue(op) + case wazeroir.OperationKindV128AllTrue: + err = cmp.compileV128AllTrue(op) + case wazeroir.OperationKindV128BitMask: + err = cmp.compileV128BitMask(op) + case wazeroir.OperationKindV128And: + err = cmp.compileV128And(op) + case wazeroir.OperationKindV128Not: + err = cmp.compileV128Not(op) + case wazeroir.OperationKindV128Or: + err = cmp.compileV128Or(op) + case wazeroir.OperationKindV128Xor: + err = cmp.compileV128Xor(op) + case wazeroir.OperationKindV128Bitselect: + err = cmp.compileV128Bitselect(op) + case wazeroir.OperationKindV128AndNot: + err = cmp.compileV128AndNot(op) + case wazeroir.OperationKindV128Shl: + err = cmp.compileV128Shl(op) + case wazeroir.OperationKindV128Shr: + err = cmp.compileV128Shr(op) + case wazeroir.OperationKindV128Cmp: + err = cmp.compileV128Cmp(op) + case wazeroir.OperationKindV128AddSat: + err = cmp.compileV128AddSat(op) + case wazeroir.OperationKindV128SubSat: + err = cmp.compileV128SubSat(op) + case wazeroir.OperationKindV128Mul: + err = cmp.compileV128Mul(op) + case wazeroir.OperationKindV128Div: + err = cmp.compileV128Div(op) + case wazeroir.OperationKindV128Neg: + err = cmp.compileV128Neg(op) + case wazeroir.OperationKindV128Sqrt: + err = cmp.compileV128Sqrt(op) + case wazeroir.OperationKindV128Abs: + err = cmp.compileV128Abs(op) + case wazeroir.OperationKindV128Popcnt: + err = cmp.compileV128Popcnt(op) + case wazeroir.OperationKindV128Min: + err = cmp.compileV128Min(op) + case wazeroir.OperationKindV128Max: + err = cmp.compileV128Max(op) + case wazeroir.OperationKindV128AvgrU: + err = cmp.compileV128AvgrU(op) + case wazeroir.OperationKindV128Pmin: + err = cmp.compileV128Pmin(op) + case wazeroir.OperationKindV128Pmax: + err = cmp.compileV128Pmax(op) + case wazeroir.OperationKindV128Ceil: + err = cmp.compileV128Ceil(op) + case wazeroir.OperationKindV128Floor: + err = cmp.compileV128Floor(op) + case wazeroir.OperationKindV128Trunc: + err = cmp.compileV128Trunc(op) + case wazeroir.OperationKindV128Nearest: + err = cmp.compileV128Nearest(op) + case wazeroir.OperationKindV128Extend: + err = cmp.compileV128Extend(op) + case wazeroir.OperationKindV128ExtMul: + err = cmp.compileV128ExtMul(op) + case wazeroir.OperationKindV128Q15mulrSatS: + err = cmp.compileV128Q15mulrSatS(op) + case wazeroir.OperationKindV128ExtAddPairwise: + err = cmp.compileV128ExtAddPairwise(op) + case wazeroir.OperationKindV128FloatPromote: + err = cmp.compileV128FloatPromote(op) + case wazeroir.OperationKindV128FloatDemote: + err = cmp.compileV128FloatDemote(op) + case wazeroir.OperationKindV128FConvertFromI: + err = cmp.compileV128FConvertFromI(op) + case wazeroir.OperationKindV128Dot: + err = cmp.compileV128Dot(op) + case wazeroir.OperationKindV128Narrow: + err = cmp.compileV128Narrow(op) + case wazeroir.OperationKindV128ITruncSatFromF: + err = cmp.compileV128ITruncSatFromF(op) + case wazeroir.OperationKindBuiltinFunctionCheckExitCode: + err = cmp.compileBuiltinFunctionCheckExitCode() + default: + err = errors.New("unsupported") + } + if err != nil { + err = fmt.Errorf("operation %s: %w", op.Kind.String(), err) + return + } + } + + spCeil, err = cmp.compile(buf) + if err != nil { + err = fmt.Errorf("failed to compile: %w", err) + return + } + + if needSourceOffsets { + offsetInNativeBin := append(offsets.values[:0], make([]uint64, len(irOpBegins))...) + offsets.values = offsetInNativeBin + for i, nop := range irOpBegins { + offsetInNativeBin[i] = nop.OffsetInBinary() + } + sm.irOperationOffsetsInNativeBinary = bitpack.NewOffsetArray(offsetInNativeBin) + sm.irOperationSourceOffsetsInWasmBinary = bitpack.NewOffsetArray(ir.IROperationSourceOffsetsInWasmBinary) + } + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/engine_cache.go b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/engine_cache.go new file mode 100644 index 000000000..204eb1b8a --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/engine_cache.go @@ -0,0 +1,241 @@ +package compiler + +import ( + "bytes" + "encoding/binary" + "fmt" + "io" + "runtime" + + "github.com/tetratelabs/wazero/experimental" + "github.com/tetratelabs/wazero/internal/platform" + "github.com/tetratelabs/wazero/internal/u32" + "github.com/tetratelabs/wazero/internal/u64" + "github.com/tetratelabs/wazero/internal/wasm" +) + +func (e *engine) deleteCompiledModule(module *wasm.Module) { + e.mux.Lock() + defer e.mux.Unlock() + + delete(e.codes, module.ID) + + // Note: we do not call e.Cache.Delete, as the lifetime of + // the content is up to the implementation of extencache.Cache interface. +} + +func (e *engine) addCompiledModule(module *wasm.Module, cm *compiledModule, withGoFunc bool) (err error) { + e.addCompiledModuleToMemory(module, cm) + if !withGoFunc { + err = e.addCompiledModuleToCache(module, cm) + } + return +} + +func (e *engine) getCompiledModule(module *wasm.Module, listeners []experimental.FunctionListener) (cm *compiledModule, ok bool, err error) { + cm, ok = e.getCompiledModuleFromMemory(module) + if ok { + return + } + cm, ok, err = e.getCompiledModuleFromCache(module) + if ok { + e.addCompiledModuleToMemory(module, cm) + if len(listeners) > 0 { + // Files do not contain the actual listener instances (it's impossible to cache them as files!), so assign each here. + for i := range cm.functions { + cm.functions[i].listener = listeners[i] + } + } + + // As this uses mmap, we need to munmap on the compiled machine code when it's GCed. + e.setFinalizer(cm, releaseCompiledModule) + } + return +} + +func (e *engine) addCompiledModuleToMemory(module *wasm.Module, cm *compiledModule) { + e.mux.Lock() + defer e.mux.Unlock() + e.codes[module.ID] = cm +} + +func (e *engine) getCompiledModuleFromMemory(module *wasm.Module) (cm *compiledModule, ok bool) { + e.mux.RLock() + defer e.mux.RUnlock() + cm, ok = e.codes[module.ID] + return +} + +func (e *engine) addCompiledModuleToCache(module *wasm.Module, cm *compiledModule) (err error) { + if e.fileCache == nil || module.IsHostModule { + return + } + err = e.fileCache.Add(module.ID, serializeCompiledModule(e.wazeroVersion, cm)) + return +} + +func (e *engine) getCompiledModuleFromCache(module *wasm.Module) (cm *compiledModule, hit bool, err error) { + if e.fileCache == nil || module.IsHostModule { + return + } + + // Check if the entries exist in the external cache. + var cached io.ReadCloser + cached, hit, err = e.fileCache.Get(module.ID) + if !hit || err != nil { + return + } + + // Otherwise, we hit the cache on external cache. + // We retrieve *code structures from `cached`. + var staleCache bool + // Note: cached.Close is ensured to be called in deserializeCodes. + cm, staleCache, err = deserializeCompiledModule(e.wazeroVersion, cached, module) + if err != nil { + hit = false + return + } else if staleCache { + return nil, false, e.fileCache.Delete(module.ID) + } + + cm.source = module + return +} + +var wazeroMagic = "WAZERO" // version must be synced with the tag of the wazero library. + +func serializeCompiledModule(wazeroVersion string, cm *compiledModule) io.Reader { + buf := bytes.NewBuffer(nil) + // First 6 byte: WAZERO header. + buf.WriteString(wazeroMagic) + // Next 1 byte: length of version: + buf.WriteByte(byte(len(wazeroVersion))) + // Version of wazero. + buf.WriteString(wazeroVersion) + if cm.ensureTermination { + buf.WriteByte(1) + } else { + buf.WriteByte(0) + } + // Number of *code (== locally defined functions in the module): 4 bytes. + buf.Write(u32.LeBytes(uint32(len(cm.functions)))) + for i := 0; i < len(cm.functions); i++ { + f := &cm.functions[i] + // The stack pointer ceil (8 bytes). + buf.Write(u64.LeBytes(f.stackPointerCeil)) + // The offset of this function in the executable (8 bytes). + buf.Write(u64.LeBytes(uint64(f.executableOffset))) + } + // The length of code segment (8 bytes). + buf.Write(u64.LeBytes(uint64(cm.executable.Len()))) + // Append the native code. + buf.Write(cm.executable.Bytes()) + return bytes.NewReader(buf.Bytes()) +} + +func deserializeCompiledModule(wazeroVersion string, reader io.ReadCloser, module *wasm.Module) (cm *compiledModule, staleCache bool, err error) { + defer reader.Close() + cacheHeaderSize := len(wazeroMagic) + 1 /* version size */ + len(wazeroVersion) + 1 /* ensure termination */ + 4 /* number of functions */ + + // Read the header before the native code. + header := make([]byte, cacheHeaderSize) + n, err := reader.Read(header) + if err != nil { + return nil, false, fmt.Errorf("compilationcache: error reading header: %v", err) + } + + if n != cacheHeaderSize { + return nil, false, fmt.Errorf("compilationcache: invalid header length: %d", n) + } + + // Check the version compatibility. + versionSize := int(header[len(wazeroMagic)]) + + cachedVersionBegin, cachedVersionEnd := len(wazeroMagic)+1, len(wazeroMagic)+1+versionSize + if cachedVersionEnd >= len(header) { + staleCache = true + return + } else if cachedVersion := string(header[cachedVersionBegin:cachedVersionEnd]); cachedVersion != wazeroVersion { + staleCache = true + return + } + + ensureTermination := header[cachedVersionEnd] != 0 + functionsNum := binary.LittleEndian.Uint32(header[len(header)-4:]) + cm = &compiledModule{ + compiledCode: new(compiledCode), + functions: make([]compiledFunction, functionsNum), + ensureTermination: ensureTermination, + } + + imported := module.ImportFunctionCount + + var eightBytes [8]byte + for i := uint32(0); i < functionsNum; i++ { + f := &cm.functions[i] + f.parent = cm.compiledCode + + // Read the stack pointer ceil. + if f.stackPointerCeil, err = readUint64(reader, &eightBytes); err != nil { + err = fmt.Errorf("compilationcache: error reading func[%d] stack pointer ceil: %v", i, err) + return + } + + // Read the offset of each function in the executable. + var offset uint64 + if offset, err = readUint64(reader, &eightBytes); err != nil { + err = fmt.Errorf("compilationcache: error reading func[%d] executable offset: %v", i, err) + return + } + f.executableOffset = uintptr(offset) + f.index = imported + i + } + + executableLen, err := readUint64(reader, &eightBytes) + if err != nil { + err = fmt.Errorf("compilationcache: error reading executable size: %v", err) + return + } + + if executableLen > 0 { + if err = cm.executable.Map(int(executableLen)); err != nil { + err = fmt.Errorf("compilationcache: error mmapping executable (len=%d): %v", executableLen, err) + return + } + + _, err = io.ReadFull(reader, cm.executable.Bytes()) + if err != nil { + err = fmt.Errorf("compilationcache: error reading executable (len=%d): %v", executableLen, err) + return + } + + if runtime.GOARCH == "arm64" { + // On arm64, we cannot give all of rwx at the same time, so we change it to exec. + if err = platform.MprotectRX(cm.executable.Bytes()); err != nil { + return + } + } + } + return +} + +// readUint64 strictly reads an uint64 in little-endian byte order, using the +// given array as a buffer. This returns io.EOF if less than 8 bytes were read. +func readUint64(reader io.Reader, b *[8]byte) (uint64, error) { + s := b[0:8] + n, err := reader.Read(s) + if err != nil { + return 0, err + } else if n < 8 { // more strict than reader.Read + return 0, io.EOF + } + + // Read the u64 from the underlying buffer. + ret := binary.LittleEndian.Uint64(s) + + // Clear the underlying array. + for i := 0; i < 8; i++ { + b[i] = 0 + } + return ret, nil +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/impl_amd64.go b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/impl_amd64.go new file mode 100644 index 000000000..7de2b3318 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/impl_amd64.go @@ -0,0 +1,5209 @@ +package compiler + +// This file implements the compiler for amd64/x86_64 target. +// Please refer to https://www.felixcloutier.com/x86/index.html +// if unfamiliar with amd64 instructions used here. + +import ( + "fmt" + "math" + + "github.com/tetratelabs/wazero/internal/asm" + "github.com/tetratelabs/wazero/internal/asm/amd64" + "github.com/tetratelabs/wazero/internal/platform" + "github.com/tetratelabs/wazero/internal/u32" + "github.com/tetratelabs/wazero/internal/u64" + "github.com/tetratelabs/wazero/internal/wasm" + "github.com/tetratelabs/wazero/internal/wazeroir" +) + +var ( + _minimum32BitSignedInt int32 = math.MinInt32 + _maximum32BitSignedInt int32 = math.MaxInt32 + _maximum32BitUnsignedInt uint32 = math.MaxUint32 + _minimum64BitSignedInt int64 = math.MinInt64 + _maximum64BitSignedInt int64 = math.MaxInt64 + _maximum64BitUnsignedInt uint64 = math.MaxUint64 + _float32SignBitMask uint32 = 1 << 31 + _float32RestBitMask = ^_float32SignBitMask + _float64SignBitMask uint64 = 1 << 63 + _float64RestBitMask = ^_float64SignBitMask + _float32ForMinimumSigned32bitInteger = uint32(0xCF00_0000) + _float64ForMinimumSigned32bitInteger = uint64(0xC1E0_0000_0020_0000) + _float32ForMinimumSigned64bitInteger = uint32(0xDF00_0000) + _float64ForMinimumSigned64bitInteger = uint64(0xC3E0_0000_0000_0000) + _float32ForMaximumSigned32bitIntPlusOne = uint32(0x4F00_0000) + _float64ForMaximumSigned32bitIntPlusOne = uint64(0x41E0_0000_0000_0000) + _float32ForMaximumSigned64bitIntPlusOne = uint32(0x5F00_0000) + _float64ForMaximumSigned64bitIntPlusOne = uint64(0x43E0_0000_0000_0000) +) + +var ( + // amd64ReservedRegisterForCallEngine: pointer to callEngine (i.e. *callEngine as uintptr) + amd64ReservedRegisterForCallEngine = amd64.RegR13 + // amd64ReservedRegisterForStackBasePointerAddress: stack base pointer's address (callEngine.stackBasePointer) in the current function call. + amd64ReservedRegisterForStackBasePointerAddress = amd64.RegR14 + // amd64ReservedRegisterForMemory: pointer to the memory slice's data (i.e. &memory.Buffer[0] as uintptr). + amd64ReservedRegisterForMemory = amd64.RegR15 +) + +var ( + amd64UnreservedVectorRegisters = []asm.Register{ //nolint + amd64.RegX0, amd64.RegX1, amd64.RegX2, amd64.RegX3, + amd64.RegX4, amd64.RegX5, amd64.RegX6, amd64.RegX7, + amd64.RegX8, amd64.RegX9, amd64.RegX10, amd64.RegX11, + amd64.RegX12, amd64.RegX13, amd64.RegX14, amd64.RegX15, + } + // Note that we never invoke "call" instruction, + // so we don't need to care about the calling convention. + // TODO: Maybe it is safe just save rbp, rsp somewhere + // in Go-allocated variables, and reuse these registers + // in compiled functions and write them back before returns. + amd64UnreservedGeneralPurposeRegisters = []asm.Register{ //nolint + amd64.RegAX, amd64.RegCX, amd64.RegDX, amd64.RegBX, + amd64.RegSI, amd64.RegDI, amd64.RegR8, amd64.RegR9, + amd64.RegR10, amd64.RegR11, amd64.RegR12, + } +) + +// amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister holds *wasm.ModuleInstance of the +// next executing function instance. The value is set and used when making function calls +// or function returns in the ModuleContextInitialization. See compileModuleContextInitialization. +var amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister = amd64.RegR12 + +func (c *amd64Compiler) String() string { + return c.locationStack.String() +} + +// compileNOP implements compiler.compileNOP for the amd64 architecture. +func (c *amd64Compiler) compileNOP() asm.Node { + return c.assembler.CompileStandAlone(amd64.NOP) +} + +type amd64Compiler struct { + assembler amd64.Assembler + ir *wazeroir.CompilationResult + cpuFeatures platform.CpuFeatureFlags + // locationStack holds the state of wazeroir virtual stack. + // and each item is either placed in register or the actual memory stack. + locationStack *runtimeValueLocationStack + // labels hold per wazeroir label specific information in this function. + labels [wazeroir.LabelKindNum][]amd64LabelInfo + // stackPointerCeil is the greatest stack pointer value (from runtimeValueLocationStack) seen during compilation. + stackPointerCeil uint64 + // assignStackPointerCeilNeeded holds an asm.Node whose AssignDestinationConstant must be called with the determined stack pointer ceiling. + assignStackPointerCeilNeeded asm.Node + compiledTrapTargets [nativeCallStatusModuleClosed]asm.Node + withListener bool + typ *wasm.FunctionType + // locationStackForEntrypoint is the initial location stack for all functions. To reuse the allocated stack, + // we cache it here, and reset and set to .locationStack in the Init method. + locationStackForEntrypoint runtimeValueLocationStack + // frameIDMax tracks the maximum value of frame id per function. + frameIDMax int + brTableTmp []runtimeValueLocation + + fourZeros, + eightZeros, + minimum32BitSignedInt, + maximum32BitSignedInt, + maximum32BitUnsignedInt, + minimum64BitSignedInt, + maximum64BitSignedInt, + maximum64BitUnsignedInt, + float32SignBitMask, + float32RestBitMask, + float64SignBitMask, + float64RestBitMask, + float32ForMinimumSigned32bitInteger, + float64ForMinimumSigned32bitInteger, + float32ForMinimumSigned64bitInteger, + float64ForMinimumSigned64bitInteger, + float32ForMaximumSigned32bitIntPlusOne, + float64ForMaximumSigned32bitIntPlusOne, + float32ForMaximumSigned64bitIntPlusOne, + float64ForMaximumSigned64bitIntPlusOne *asm.StaticConst +} + +func newAmd64Compiler() compiler { + c := &amd64Compiler{ + assembler: amd64.NewAssembler(), + locationStackForEntrypoint: newRuntimeValueLocationStack(), + cpuFeatures: platform.CpuFeatures, + } + + c.fourZeros = asm.NewStaticConst([]byte{0, 0, 0, 0}) + c.eightZeros = asm.NewStaticConst([]byte{0, 0, 0, 0, 0, 0, 0, 0}) + c.minimum32BitSignedInt = asm.NewStaticConst(u32.LeBytes(uint32(_minimum32BitSignedInt))) + c.maximum32BitSignedInt = asm.NewStaticConst(u32.LeBytes(uint32(_maximum32BitSignedInt))) + c.maximum32BitUnsignedInt = asm.NewStaticConst(u32.LeBytes(_maximum32BitUnsignedInt)) + c.minimum64BitSignedInt = asm.NewStaticConst(u64.LeBytes(uint64(_minimum64BitSignedInt))) + c.maximum64BitSignedInt = asm.NewStaticConst(u64.LeBytes(uint64(_maximum64BitSignedInt))) + c.maximum64BitUnsignedInt = asm.NewStaticConst(u64.LeBytes(_maximum64BitUnsignedInt)) + c.float32SignBitMask = asm.NewStaticConst(u32.LeBytes(_float32SignBitMask)) + c.float32RestBitMask = asm.NewStaticConst(u32.LeBytes(_float32RestBitMask)) + c.float64SignBitMask = asm.NewStaticConst(u64.LeBytes(_float64SignBitMask)) + c.float64RestBitMask = asm.NewStaticConst(u64.LeBytes(_float64RestBitMask)) + c.float32ForMinimumSigned32bitInteger = asm.NewStaticConst(u32.LeBytes(_float32ForMinimumSigned32bitInteger)) + c.float64ForMinimumSigned32bitInteger = asm.NewStaticConst(u64.LeBytes(_float64ForMinimumSigned32bitInteger)) + c.float32ForMinimumSigned64bitInteger = asm.NewStaticConst(u32.LeBytes(_float32ForMinimumSigned64bitInteger)) + c.float64ForMinimumSigned64bitInteger = asm.NewStaticConst(u64.LeBytes(_float64ForMinimumSigned64bitInteger)) + c.float32ForMaximumSigned32bitIntPlusOne = asm.NewStaticConst(u32.LeBytes(_float32ForMaximumSigned32bitIntPlusOne)) + c.float64ForMaximumSigned32bitIntPlusOne = asm.NewStaticConst(u64.LeBytes(_float64ForMaximumSigned32bitIntPlusOne)) + c.float32ForMaximumSigned64bitIntPlusOne = asm.NewStaticConst(u32.LeBytes(_float32ForMaximumSigned64bitIntPlusOne)) + c.float64ForMaximumSigned64bitIntPlusOne = asm.NewStaticConst(u64.LeBytes(_float64ForMaximumSigned64bitIntPlusOne)) + return c +} + +// Init implements compiler.Init. +func (c *amd64Compiler) Init(typ *wasm.FunctionType, ir *wazeroir.CompilationResult, withListener bool) { + c.assembler.Reset() + c.locationStackForEntrypoint.reset() + c.resetLabels() + *c = amd64Compiler{ + ir: ir, + withListener: withListener, + typ: typ, + assembler: c.assembler, + cpuFeatures: c.cpuFeatures, + labels: c.labels, + locationStackForEntrypoint: c.locationStackForEntrypoint, + brTableTmp: c.brTableTmp, + fourZeros: c.fourZeros, + eightZeros: c.eightZeros, + minimum32BitSignedInt: c.minimum32BitSignedInt, + maximum32BitSignedInt: c.maximum32BitSignedInt, + maximum32BitUnsignedInt: c.maximum32BitUnsignedInt, + minimum64BitSignedInt: c.minimum64BitSignedInt, + maximum64BitSignedInt: c.maximum64BitSignedInt, + maximum64BitUnsignedInt: c.maximum64BitUnsignedInt, + float32SignBitMask: c.float32SignBitMask, + float32RestBitMask: c.float32RestBitMask, + float64SignBitMask: c.float64SignBitMask, + float64RestBitMask: c.float64RestBitMask, + float32ForMinimumSigned32bitInteger: c.float32ForMinimumSigned32bitInteger, + float64ForMinimumSigned32bitInteger: c.float64ForMinimumSigned32bitInteger, + float32ForMinimumSigned64bitInteger: c.float32ForMinimumSigned64bitInteger, + float64ForMinimumSigned64bitInteger: c.float64ForMinimumSigned64bitInteger, + float32ForMaximumSigned32bitIntPlusOne: c.float32ForMaximumSigned32bitIntPlusOne, + float64ForMaximumSigned32bitIntPlusOne: c.float64ForMaximumSigned32bitIntPlusOne, + float32ForMaximumSigned64bitIntPlusOne: c.float32ForMaximumSigned64bitIntPlusOne, + float64ForMaximumSigned64bitIntPlusOne: c.float64ForMaximumSigned64bitIntPlusOne, + } + + // Reuses the initial location stack for the compilation of subsequent functions. + c.locationStack = &c.locationStackForEntrypoint +} + +// resetLabels resets the existing content in arm64Compiler.labels so that +// we could reuse the allocated slices and stacks in the subsequent compilations. +func (c *amd64Compiler) resetLabels() { + for i := range c.labels { + for j := range c.labels[i] { + if j > c.frameIDMax { + // Only need to reset until the maximum frame id. This makes the compilation faster for large binary. + break + } + l := &c.labels[i][j] + l.initialInstruction = nil + l.stackInitialized = false + l.initialStack.reset() + } + } +} + +// runtimeValueLocationStack implements compilerImpl.runtimeValueLocationStack for the amd64 architecture. +func (c *amd64Compiler) runtimeValueLocationStack() *runtimeValueLocationStack { + return c.locationStack +} + +// setLocationStack sets the given runtimeValueLocationStack to .locationStack field, +// while allowing us to track runtimeValueLocationStack.stackPointerCeil across multiple stacks. +// This is called when we branch into different block. +func (c *amd64Compiler) setLocationStack(newStack *runtimeValueLocationStack) { + if c.stackPointerCeil < c.locationStack.stackPointerCeil { + c.stackPointerCeil = c.locationStack.stackPointerCeil + } + c.locationStack = newStack +} + +// pushRuntimeValueLocationOnRegister implements compiler.pushRuntimeValueLocationOnRegister for amd64. +func (c *amd64Compiler) pushRuntimeValueLocationOnRegister(reg asm.Register, vt runtimeValueType) (ret *runtimeValueLocation) { + ret = c.locationStack.pushRuntimeValueLocationOnRegister(reg, vt) + c.locationStack.markRegisterUsed(reg) + return +} + +// pushVectorRuntimeValueLocationOnRegister implements compiler.pushVectorRuntimeValueLocationOnRegister for amd64. +func (c *amd64Compiler) pushVectorRuntimeValueLocationOnRegister(reg asm.Register) (lowerBitsLocation *runtimeValueLocation) { + lowerBitsLocation = c.locationStack.pushRuntimeValueLocationOnRegister(reg, runtimeValueTypeV128Lo) + c.locationStack.pushRuntimeValueLocationOnRegister(reg, runtimeValueTypeV128Hi) + c.locationStack.markRegisterUsed(reg) + return +} + +type amd64LabelInfo struct { + // initialInstruction is the initial instruction for this label so other block can jump into it. + initialInstruction asm.Node + // initialStack is the initial value location stack from which we start compiling this label. + initialStack runtimeValueLocationStack + stackInitialized bool +} + +func (c *amd64Compiler) label(label wazeroir.Label) *amd64LabelInfo { + kind := label.Kind() + frames := c.labels[kind] + frameID := label.FrameID() + if c.frameIDMax < frameID { + c.frameIDMax = frameID + } + // If the frameID is not allocated yet, expand the slice by twice of the diff, + // so that we could reduce the allocation in the subsequent compilation. + if diff := frameID - len(frames) + 1; diff > 0 { + for i := 0; i < diff; i++ { + frames = append(frames, amd64LabelInfo{initialStack: newRuntimeValueLocationStack()}) + } + c.labels[kind] = frames + } + return &frames[frameID] +} + +// compileBuiltinFunctionCheckExitCode implements compiler.compileBuiltinFunctionCheckExitCode for the amd64 architecture. +func (c *amd64Compiler) compileBuiltinFunctionCheckExitCode() error { + if err := c.compileCallBuiltinFunction(builtinFunctionIndexCheckExitCode); err != nil { + return err + } + + // After the function call, we have to initialize the stack base pointer and memory reserved registers. + c.compileReservedStackBasePointerInitialization() + c.compileReservedMemoryPointerInitialization() + return nil +} + +// compileGoDefinedHostFunction constructs the entire code to enter the host function implementation, +// and return to the caller. +func (c *amd64Compiler) compileGoDefinedHostFunction() error { + // First we must update the location stack to reflect the number of host function inputs. + c.locationStack.init(c.typ) + + if c.withListener { + if err := c.compileCallBuiltinFunction(builtinFunctionIndexFunctionListenerBefore); err != nil { + return err + } + } + + // Host function needs access to the caller's Function Instance, and the caller's information is stored in the stack + // (as described in the doc of callEngine.stack). Here, we get the caller's *wasm.FunctionInstance from the stack, + // and save it in callEngine.exitContext.callerFunctionInstance so we can pass it to the host function + // without sacrificing the performance. + c.compileReservedStackBasePointerInitialization() + // Alias for readability. + tmp := amd64.RegAX + // Get the location of the callerFunction (*function) in the stack, which depends on the signature. + _, _, callerFunction := c.locationStack.getCallFrameLocations(c.typ) + // Load the value into the tmp register: tmp = &function{..} + callerFunction.setRegister(tmp) + c.compileLoadValueOnStackToRegister(callerFunction) + // tmp = *(tmp+functionSourceOffset) = &wasm.ModuleInstance{...} + c.assembler.CompileMemoryToRegister(amd64.MOVQ, tmp, functionModuleInstanceOffset, tmp) + // Load it onto callEngine.exitContext.callerFunctionInstance. + c.assembler.CompileRegisterToMemory(amd64.MOVQ, + tmp, + amd64ReservedRegisterForCallEngine, callEngineExitContextCallerModuleInstanceOffset) + // Reset the state of callerFunction value location so that we won't mess up subsequent code generation below. + c.locationStack.releaseRegister(callerFunction) + + if err := c.compileCallGoHostFunction(); err != nil { + return err + } + + // Initializes the reserved stack base pointer which is used to retrieve the call frame stack. + c.compileReservedStackBasePointerInitialization() + + // Go function can change the module state in arbitrary way, so we have to force + // the callEngine.moduleContext initialization on the function return. To do so, + // we zero-out callEngine.moduleInstance. + c.assembler.CompileConstToMemory(amd64.MOVQ, + 0, amd64ReservedRegisterForCallEngine, callEngineModuleContextModuleInstanceOffset) + return c.compileReturnFunction() +} + +// compile implements compiler.compile for the amd64 architecture. +func (c *amd64Compiler) compile(buf asm.Buffer) (stackPointerCeil uint64, err error) { + // c.stackPointerCeil tracks the stack pointer ceiling (max seen) value across all runtimeValueLocationStack(s) + // used for all labels (via setLocationStack), excluding the current one. + // Hence, we check here if the final block's max one exceeds the current c.stackPointerCeil. + stackPointerCeil = c.stackPointerCeil + if stackPointerCeil < c.locationStack.stackPointerCeil { + stackPointerCeil = c.locationStack.stackPointerCeil + } + + // Now that the max stack pointer is determined, we are invoking the callback. + // Note this MUST be called before Assemble() below. + c.assignStackPointerCeil(stackPointerCeil) + + err = c.assembler.Assemble(buf) + return +} + +// compileUnreachable implements compiler.compileUnreachable for the amd64 architecture. +func (c *amd64Compiler) compileUnreachable() error { + c.compileExitFromNativeCode(nativeCallStatusCodeUnreachable) + return nil +} + +// assignStackPointerCeil implements compilerImpl.assignStackPointerCeil for the amd64 architecture. +func (c *amd64Compiler) assignStackPointerCeil(ceil uint64) { + if c.assignStackPointerCeilNeeded != nil { + c.assignStackPointerCeilNeeded.AssignDestinationConstant(int64(ceil) << 3) + } +} + +// compileSet implements compiler.compileSet for the amd64 architecture. +func (c *amd64Compiler) compileSet(o *wazeroir.UnionOperation) error { + depth := int(o.U1) + isTargetVector := o.B3 + + setTargetIndex := int(c.locationStack.sp) - 1 - depth + + if isTargetVector { + _ = c.locationStack.pop() // ignore the higher 64-bits. + } + v := c.locationStack.pop() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + + targetLocation := &c.locationStack.stack[setTargetIndex] + if targetLocation.onRegister() { + // We no longer need the register previously used by the target location. + c.locationStack.markRegisterUnused(targetLocation.register) + } + + reg := v.register + targetLocation.setRegister(reg) + targetLocation.valueType = v.valueType + if isTargetVector { + hi := &c.locationStack.stack[setTargetIndex+1] + hi.setRegister(reg) + } + return nil +} + +// compileGlobalGet implements compiler.compileGlobalGet for the amd64 architecture. +func (c *amd64Compiler) compileGlobalGet(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + intReg, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + // First, move the pointer to the global slice into the allocated register. + c.assembler.CompileMemoryToRegister(amd64.MOVQ, amd64ReservedRegisterForCallEngine, callEngineModuleContextGlobalElement0AddressOffset, intReg) + + index := o.U1 + + // Now, move the location of the global instance into the register. + c.assembler.CompileMemoryToRegister(amd64.MOVQ, intReg, 8*int64(index), intReg) + + // When an integer, reuse the pointer register for the value. Otherwise, allocate a float register for it. + valueReg := intReg + var vt runtimeValueType + var inst asm.Instruction + switch c.ir.Globals[index].ValType { + case wasm.ValueTypeI32: + inst = amd64.MOVL + vt = runtimeValueTypeI32 + case wasm.ValueTypeI64, wasm.ValueTypeExternref, wasm.ValueTypeFuncref: + inst = amd64.MOVQ + vt = runtimeValueTypeI64 + case wasm.ValueTypeF32: + inst = amd64.MOVL + vt = runtimeValueTypeF32 + valueReg, err = c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + case wasm.ValueTypeF64: + inst = amd64.MOVQ + vt = runtimeValueTypeF64 + valueReg, err = c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + case wasm.ValueTypeV128: + inst = amd64.MOVDQU + vt = runtimeValueTypeV128Lo + valueReg, err = c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + default: + panic("BUG: unknown runtime value type") + } + + // Using the register holding the pointer to the target instance, move its value into a register. + c.assembler.CompileMemoryToRegister(inst, intReg, globalInstanceValueOffset, valueReg) + + // Record that the retrieved global value on the top of the stack is now in a register. + if vt == runtimeValueTypeV128Lo { + c.pushVectorRuntimeValueLocationOnRegister(valueReg) + } else { + c.pushRuntimeValueLocationOnRegister(valueReg, vt) + } + return nil +} + +// compileGlobalSet implements compiler.compileGlobalSet for the amd64 architecture. +func (c *amd64Compiler) compileGlobalSet(o *wazeroir.UnionOperation) error { + index := o.U1 + + wasmValueType := c.ir.Globals[index].ValType + isV128 := wasmValueType == wasm.ValueTypeV128 + + // First, move the value to set into a temporary register. + val := c.locationStack.pop() + if isV128 { + // The previous val is higher 64-bits, and have to use lower 64-bit's runtimeValueLocation for allocation, etc. + val = c.locationStack.pop() + } + if err := c.compileEnsureOnRegister(val); err != nil { + return err + } + + // Allocate a register to hold the memory location of the target global instance. + intReg, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + // First, move the pointer to the global slice into the allocated register. + c.assembler.CompileMemoryToRegister(amd64.MOVQ, amd64ReservedRegisterForCallEngine, callEngineModuleContextGlobalElement0AddressOffset, intReg) + + // Now, move the location of the global instance into the register. + c.assembler.CompileMemoryToRegister(amd64.MOVQ, intReg, 8*int64(index), intReg) + + // Now ready to write the value to the global instance location. + var inst asm.Instruction + if isV128 { + inst = amd64.MOVDQU + } else if wasmValueType == wasm.ValueTypeI32 || wasmValueType == wasm.ValueTypeF32 { + inst = amd64.MOVL + } else { + inst = amd64.MOVQ + } + c.assembler.CompileRegisterToMemory(inst, val.register, intReg, globalInstanceValueOffset) + + // Since the value is now written to memory, release the value register. + c.locationStack.releaseRegister(val) + return nil +} + +// compileBr implements compiler.compileBr for the amd64 architecture. +func (c *amd64Compiler) compileBr(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + return c.branchInto(wazeroir.Label(o.U1)) +} + +// branchInto adds instruction necessary to jump into the given branch target. +func (c *amd64Compiler) branchInto(target wazeroir.Label) error { + if target.IsReturnTarget() { + return c.compileReturnFunction() + } else { + if c.ir.LabelCallers[target] > 1 { + // We can only re-use register state if when there's a single call-site. + // Release existing values on registers to the stack if there's multiple ones to have + // the consistent value location state at the beginning of label. + if err := c.compileReleaseAllRegistersToStack(); err != nil { + return err + } + } + // Set the initial stack of the target label, so we can start compiling the label + // with the appropriate value locations. Note we clone the stack here as we maybe + // manipulate the stack before compiler reaches the label. + targetLabel := c.label(target) + if !targetLabel.stackInitialized { + targetLabel.initialStack.cloneFrom(*c.locationStack) + targetLabel.stackInitialized = true + } + jmp := c.assembler.CompileJump(amd64.JMP) + c.assignJumpTarget(target, jmp) + } + return nil +} + +// compileBrIf implements compiler.compileBrIf for the amd64 architecture. +func (c *amd64Compiler) compileBrIf(o *wazeroir.UnionOperation) error { + cond := c.locationStack.pop() + var jmpWithCond asm.Node + if cond.onConditionalRegister() { + var inst asm.Instruction + switch cond.conditionalRegister { + case amd64.ConditionalRegisterStateE: + inst = amd64.JEQ + case amd64.ConditionalRegisterStateNE: + inst = amd64.JNE + case amd64.ConditionalRegisterStateS: + inst = amd64.JMI + case amd64.ConditionalRegisterStateNS: + inst = amd64.JPL + case amd64.ConditionalRegisterStateG: + inst = amd64.JGT + case amd64.ConditionalRegisterStateGE: + inst = amd64.JGE + case amd64.ConditionalRegisterStateL: + inst = amd64.JLT + case amd64.ConditionalRegisterStateLE: + inst = amd64.JLE + case amd64.ConditionalRegisterStateA: + inst = amd64.JHI + case amd64.ConditionalRegisterStateAE: + inst = amd64.JCC + case amd64.ConditionalRegisterStateB: + inst = amd64.JCS + case amd64.ConditionalRegisterStateBE: + inst = amd64.JLS + } + jmpWithCond = c.assembler.CompileJump(inst) + } else { + // Usually the comparison operand for br_if is on the conditional register, + // but in some cases, they are on the stack or register. + // For example, the following code + // i64.const 1 + // local.get 1 + // i64.add + // br_if .... + // will try to use the result of i64.add, which resides on the (virtual) stack, + // as the operand for br_if instruction. + if err := c.compileEnsureOnRegister(cond); err != nil { + return err + } + // Check if the value not equals zero. + c.assembler.CompileRegisterToRegister(amd64.TESTQ, cond.register, cond.register) + + // Emit jump instruction which jumps when the value does not equals zero. + jmpWithCond = c.assembler.CompileJump(amd64.JNE) + c.locationStack.markRegisterUnused(cond.register) + } + + // Make sure that the next coming label is the else jump target. + thenTarget := wazeroir.Label(o.U1) + elseTarget := wazeroir.Label(o.U2) + thenToDrop := o.U3 + + // Here's the diagram of how we organize the instructions necessarily for brif operation. + // + // jmp_with_cond -> jmp (.Else) -> Then operations... + // |---------(satisfied)------------^^^ + // + // Note that .Else branch doesn't have ToDrop as .Else is in reality + // corresponding to either If's Else block or Br_if's else block in Wasm. + + // Emit the else branch. + if elseTarget.IsReturnTarget() { + if err := c.compileReturnFunction(); err != nil { + return err + } + } else { + labelInfo := c.label(elseTarget) + if !labelInfo.stackInitialized { + labelInfo.initialStack.cloneFrom(*c.locationStack) + labelInfo.stackInitialized = true + } + + elseJmp := c.assembler.CompileJump(amd64.JMP) + c.assignJumpTarget(elseTarget, elseJmp) + } + + // Handle then branch. + c.assembler.SetJumpTargetOnNext(jmpWithCond) + if err := compileDropRange(c, thenToDrop); err != nil { + return err + } + if thenTarget.IsReturnTarget() { + return c.compileReturnFunction() + } else { + thenLabel := thenTarget + if c.ir.LabelCallers[thenLabel] > 1 { + // We can only re-use register state if when there's a single call-site. + // Release existing values on registers to the stack if there's multiple ones to have + // the consistent value location state at the beginning of label. + if err := c.compileReleaseAllRegistersToStack(); err != nil { + return err + } + } + // Set the initial stack of the target label, so we can start compiling the label + // with the appropriate value locations. Note we clone the stack here as we maybe + // manipulate the stack before compiler reaches the label. + labelInfo := c.label(thenLabel) + if !labelInfo.stackInitialized { + labelInfo.initialStack.cloneFrom(*c.locationStack) + labelInfo.stackInitialized = true + } + thenJmp := c.assembler.CompileJump(amd64.JMP) + c.assignJumpTarget(thenLabel, thenJmp) + return nil + } +} + +// compileBrTable implements compiler.compileBrTable for the amd64 architecture. +func (c *amd64Compiler) compileBrTable(o *wazeroir.UnionOperation) error { + index := c.locationStack.pop() + + // If the operation only consists of the default target, we branch into it and return early. + if len(o.Us) == 2 { + c.locationStack.releaseRegister(index) + if err := compileDropRange(c, o.Us[1]); err != nil { + return err + } + return c.branchInto(wazeroir.Label(o.Us[0])) + } + + // Otherwise, we jump into the selected branch. + if err := c.compileEnsureOnRegister(index); err != nil { + return err + } + + tmp, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + // First, we move the length of target list into the tmp register. + c.assembler.CompileConstToRegister(amd64.MOVQ, int64(len(o.Us)/2-1), tmp) + + // Then, we compare the value with the length of targets. + c.assembler.CompileRegisterToRegister(amd64.CMPL, tmp, index.register) + + // If the value is larger than the length, + // we round the index to the length as the spec states that + // if the index is larger than or equal the length of list, + // branch into the default branch. + c.assembler.CompileRegisterToRegister(amd64.CMOVQCS, tmp, index.register) + + // We prepare the static data which holds the offset of + // each target's first instruction (incl. default) + // relative to the beginning of label tables. + // + // For example, if we have targets=[L0, L1] and default=L_DEFAULT, + // we emit the the code like this at [Emit the code for each targets and default branch] below. + // + // L0: + // 0x123001: XXXX, ... + // ..... + // L1: + // 0x123005: YYY, ... + // ..... + // L_DEFAULT: + // 0x123009: ZZZ, ... + // + // then offsetData becomes like [0x0, 0x5, 0x8]. + // By using this offset list, we could jump into the label for the index by + // "jmp offsetData[index]+0x123001" and "0x123001" can be acquired by "LEA" + // instruction. + // + // Note: We store each offset of 32-bite unsigned integer as 4 consecutive bytes. So more precisely, + // the above example's offsetData would be [0x0, 0x0, 0x0, 0x0, 0x5, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0]. + // + // Note: this is similar to how GCC implements Switch statements in C. + offsetData := asm.NewStaticConst(make([]byte, 4*(len(o.Us)/2))) + + // Load the offsetData's address into tmp. + if err = c.assembler.CompileStaticConstToRegister(amd64.LEAQ, offsetData, tmp); err != nil { + return err + } + + // Now we have the address of first byte of offsetData in tmp register. + // So the target offset's first byte is at tmp+index*4 as we store + // the offset as 4 bytes for a 32-byte integer. + // Here, we store the offset into the index.register. + c.assembler.CompileMemoryWithIndexToRegister(amd64.MOVL, tmp, 0, index.register, 4, index.register) + + // Now we read the address of the beginning of the jump table. + // In the above example, this corresponds to reading the address of 0x123001. + c.assembler.CompileReadInstructionAddress(tmp, amd64.JMP) + + // Now we have the address of L0 in tmp register, and the offset to the target label in the index.register. + // So we could achieve the br_table jump by adding them and jump into the resulting address. + c.assembler.CompileRegisterToRegister(amd64.ADDQ, index.register, tmp) + + c.assembler.CompileJumpToRegister(amd64.JMP, tmp) + + // We no longer need the index's register, so mark it unused. + c.locationStack.markRegisterUnused(index.register) + + // [Emit the code for each targets and default branch] + labelInitialInstructions := make([]asm.Node, len(o.Us)/2) + + // Since we might end up having the different stack state in each branch, + // we need to save the initial stack state here, and use the same initial state + // for each iteration. + initialLocationStack := c.getSavedTemporaryLocationStack() + + for i := range labelInitialInstructions { + // Emit the initial instruction of each target. + // We use NOP as we don't yet know the next instruction in each label. + // Assembler would optimize out this NOP during code generation, so this is harmless. + labelInitialInstructions[i] = c.assembler.CompileStandAlone(amd64.NOP) + + targetLabel := wazeroir.Label(o.Us[i*2]) + targetToDrop := o.Us[i*2+1] + if err = compileDropRange(c, targetToDrop); err != nil { + return err + } + if err = c.branchInto(targetLabel); err != nil { + return err + } + // After the iteration, reset the stack's state with initialLocationStack. + c.locationStack.cloneFrom(initialLocationStack) + } + + c.assembler.BuildJumpTable(offsetData, labelInitialInstructions) + return nil +} + +func (c *amd64Compiler) getSavedTemporaryLocationStack() runtimeValueLocationStack { + initialLocationStack := *c.locationStack // Take copy! + // Use c.brTableTmp for the underlying stack so that we could reduce the allocations. + if diff := int(initialLocationStack.sp) - len(c.brTableTmp); diff > 0 { + c.brTableTmp = append(c.brTableTmp, make([]runtimeValueLocation, diff)...) + } + copy(c.brTableTmp, initialLocationStack.stack[:initialLocationStack.sp]) + initialLocationStack.stack = c.brTableTmp + return initialLocationStack +} + +func (c *amd64Compiler) assignJumpTarget(label wazeroir.Label, jmpInstruction asm.Node) { + jmpTargetLabel := c.label(label) + targetInst := jmpTargetLabel.initialInstruction + if targetInst == nil { + // If the label isn't compiled yet, allocate the NOP node, and set as the initial instruction. + targetInst = c.assembler.AllocateNOP() + jmpTargetLabel.initialInstruction = targetInst + } + jmpInstruction.AssignJumpTarget(targetInst) +} + +// compileLabel implements compiler.compileLabel for the amd64 architecture. +func (c *amd64Compiler) compileLabel(o *wazeroir.UnionOperation) (skipLabel bool) { + label := wazeroir.Label(o.U1) + labelInfo := c.label(label) + + // If initialStack is not set, that means this label has never been reached. + if !labelInfo.stackInitialized { + skipLabel = true + return + } + + // We use NOP as a beginning of instructions in a label. + if labelBegin := labelInfo.initialInstruction; labelBegin == nil { + // We use NOP as a beginning of instructions in a label. + // This should be eventually optimized out by assembler. + labelInfo.initialInstruction = c.assembler.CompileStandAlone(amd64.NOP) + } else { + c.assembler.Add(labelBegin) + } + + // Set the initial stack. + c.setLocationStack(&labelInfo.initialStack) + return +} + +// compileCall implements compiler.compileCall for the amd64 architecture. +func (c *amd64Compiler) compileCall(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + functionIndex := o.U1 + + target := c.ir.Functions[functionIndex] + targetType := &c.ir.Types[target] + + targetAddressRegister, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + // First, push the index to the callEngine.functionsElement0Address into the target register. + c.assembler.CompileConstToRegister(amd64.MOVQ, int64(functionIndex)*functionSize, targetAddressRegister) + + // Next, we add the address of the first item of callEngine.functions slice (= &callEngine.functions[0]) + // to the target register. + c.assembler.CompileMemoryToRegister(amd64.ADDQ, amd64ReservedRegisterForCallEngine, + callEngineModuleContextFunctionsElement0AddressOffset, targetAddressRegister) + + if err := c.compileCallFunctionImpl(targetAddressRegister, targetType); err != nil { + return err + } + return nil +} + +// compileCallIndirect implements compiler.compileCallIndirect for the amd64 architecture. +func (c *amd64Compiler) compileCallIndirect(o *wazeroir.UnionOperation) error { + offset := c.locationStack.pop() + if err := c.compileEnsureOnRegister(offset); err != nil { + return nil + } + typeIndex := o.U1 + tableIndex := o.U2 + + tmp, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.locationStack.markRegisterUsed(tmp) + + tmp2, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.locationStack.markRegisterUsed(tmp2) + + // Load the address of the target table: tmp = &module.Tables[0] + c.assembler.CompileMemoryToRegister(amd64.MOVQ, amd64ReservedRegisterForCallEngine, callEngineModuleContextTablesElement0AddressOffset, tmp) + // tmp = &module.Tables[0] + Index*8 = &module.Tables[0] + sizeOf(*TableInstance)*index = module.Tables[o.TableIndex]. + c.assembler.CompileMemoryToRegister(amd64.MOVQ, tmp, int64(tableIndex*8), tmp) + + // Then, we need to trap if the offset exceeds the length of table. + c.assembler.CompileMemoryToRegister(amd64.CMPQ, tmp, tableInstanceTableLenOffset, offset.register) + c.compileMaybeExitFromNativeCode(amd64.JHI, nativeCallStatusCodeInvalidTableAccess) + + // next we check if the target's type matches the operation's one. + // In order to get the type instance's address, we have to multiply the offset + // by 8 as the offset is the "length" of table in Go's "[]uintptr{}", + // and size of uintptr equals 8 bytes == (2^3). + c.assembler.CompileConstToRegister(amd64.SHLQ, pointerSizeLog2, offset.register) + + // Adds the address of wasm.Table[0] stored as callEngine.tableElement0Address to the offset. + c.assembler.CompileMemoryToRegister(amd64.ADDQ, + tmp, tableInstanceTableOffset, offset.register) + + // "offset = (*offset) (== table[offset] == *code type)" + c.assembler.CompileMemoryToRegister(amd64.MOVQ, offset.register, 0, offset.register) + + // At this point offset.register holds the address of *code (as uintptr) at wasm.Table[offset]. + // + // Check if the value of table[offset] equals zero, meaning that the target is uninitialized. + c.assembler.CompileRegisterToRegister(amd64.TESTQ, offset.register, offset.register) + + // Skipped if the target is initialized. + c.compileMaybeExitFromNativeCode(amd64.JNE, nativeCallStatusCodeInvalidTableAccess) + + // Next, we need to check the type matches, i.e. table[offset].source.TypeID == targetFunctionType's typeID. + // + // "tmp2 = [&moduleInstance.TypeIDs[0] + index * 4] (== moduleInstance.TypeIDs[index])" + c.assembler.CompileMemoryToRegister(amd64.MOVQ, + amd64ReservedRegisterForCallEngine, callEngineModuleContextTypeIDsElement0AddressOffset, + tmp2) + c.assembler.CompileMemoryToRegister(amd64.MOVL, tmp2, int64(typeIndex)*4, tmp2) + + // Skipped if the type matches. + c.assembler.CompileMemoryToRegister(amd64.CMPL, offset.register, functionTypeIDOffset, tmp2) + c.compileMaybeExitFromNativeCode(amd64.JEQ, nativeCallStatusCodeTypeMismatchOnIndirectCall) + targetFunctionType := &c.ir.Types[typeIndex] + if err = c.compileCallFunctionImpl(offset.register, targetFunctionType); err != nil { + return nil + } + + // The offset register should be marked as un-used as we consumed in the function call. + c.locationStack.markRegisterUnused(offset.register, tmp, tmp2) + return nil +} + +// compileDrop implements compiler.compileDrop for the amd64 architecture. +func (c *amd64Compiler) compileDrop(o *wazeroir.UnionOperation) error { + return compileDropRange(c, o.U1) +} + +// compileSelectV128Impl implements compileSelect for vector values. +func (c *amd64Compiler) compileSelectV128Impl(selectorReg asm.Register) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + // Compare the conditional value with zero. + c.assembler.CompileRegisterToRegister(amd64.TESTQ, selectorReg, selectorReg) + + // Set the jump if the top value is not zero. + jmpIfNotZero := c.assembler.CompileJump(amd64.JNE) + + // In this branch, we select the value of x2, so we move the value into x1.register so that + // we can have the result in x1.register regardless of the selection. + c.assembler.CompileRegisterToRegister(amd64.MOVDQU, x2.register, x1.register) + + // Else, we don't need to adjust value, just need to jump to the next instruction. + c.assembler.SetJumpTargetOnNext(jmpIfNotZero) + + // As noted, the result exists in x1.register regardless of the selector. + c.pushVectorRuntimeValueLocationOnRegister(x1.register) + // Plus, x2.register is no longer used. + c.locationStack.markRegisterUnused(x2.register) + c.locationStack.markRegisterUnused(selectorReg) + return nil +} + +// compileSelect implements compiler.compileSelect for the amd64 architecture. +// +// The emitted native code depends on whether the values are on +// the physical registers or memory stack, or maybe conditional register. +func (c *amd64Compiler) compileSelect(o *wazeroir.UnionOperation) error { + cv := c.locationStack.pop() + if err := c.compileEnsureOnRegister(cv); err != nil { + return err + } + + isTargetVector := o.B3 + if isTargetVector { + return c.compileSelectV128Impl(cv.register) + } + + x2 := c.locationStack.pop() + // We do not consume x1 here, but modify the value according to + // the conditional value "c" above. + peekedX1 := c.locationStack.peek() + + // Compare the conditional value with zero. + c.assembler.CompileRegisterToRegister(amd64.TESTQ, cv.register, cv.register) + + // Now we can use c.register as temporary location. + // We alias it here for readability. + tmpRegister := cv.register + + // Set the jump if the top value is not zero. + jmpIfNotZero := c.assembler.CompileJump(amd64.JNE) + + // If the value is zero, we must place the value of x2 onto the stack position of x1. + + // First we copy the value of x2 to the temporary register if x2 is not currently on a register. + if x2.onStack() { + x2.register = tmpRegister + c.compileLoadValueOnStackToRegister(x2) + } + + // + // At this point x2's value is always on a register. + // + + // Then release the value in the x2's register to the x1's stack position. + if peekedX1.onRegister() { + c.assembler.CompileRegisterToRegister(amd64.MOVQ, x2.register, peekedX1.register) + } else { + peekedX1.register = x2.register + c.compileReleaseRegisterToStack(peekedX1) // Note inside we mark the register unused! + } + + // Else, we don't need to adjust value, just need to jump to the next instruction. + c.assembler.SetJumpTargetOnNext(jmpIfNotZero) + + // In any case, we don't need x2 and c anymore! + c.locationStack.releaseRegister(x2) + c.locationStack.releaseRegister(cv) + return nil +} + +// compilePick implements compiler.compilePick for the amd64 architecture. +func (c *amd64Compiler) compilePick(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + depth := o.U1 + isTargetVector := o.B3 + + // TODO: if we track the type of values on the stack, + // we could optimize the instruction according to the bit size of the value. + // For now, we just move the entire register i.e. as a quad word (8 bytes). + pickTarget := &c.locationStack.stack[c.locationStack.sp-1-uint64(depth)] + reg, err := c.allocateRegister(pickTarget.getRegisterType()) + if err != nil { + return err + } + + if pickTarget.onRegister() { + var inst asm.Instruction + if isTargetVector { + inst = amd64.MOVDQU + } else if pickTarget.valueType == runtimeValueTypeI32 { // amd64 cannot copy single-precisions between registers. + inst = amd64.MOVL + } else { + inst = amd64.MOVQ + } + c.assembler.CompileRegisterToRegister(inst, pickTarget.register, reg) + } else if pickTarget.onStack() { + // Copy the value from the stack. + var inst asm.Instruction + if isTargetVector { + inst = amd64.MOVDQU + } else if pickTarget.valueType == runtimeValueTypeI32 || pickTarget.valueType == runtimeValueTypeF32 { + inst = amd64.MOVL + } else { + inst = amd64.MOVQ + } + // Note: stack pointers are ensured not to exceed 2^27 so this offset never exceeds 32-bit range. + c.assembler.CompileMemoryToRegister(inst, amd64ReservedRegisterForStackBasePointerAddress, + int64(pickTarget.stackPointer)*8, reg) + } + // Now we already placed the picked value on the register, + // so push the location onto the stack. + if isTargetVector { + c.pushVectorRuntimeValueLocationOnRegister(reg) + } else { + c.pushRuntimeValueLocationOnRegister(reg, pickTarget.valueType) + } + return nil +} + +// compileAdd implements compiler.compileAdd for the amd64 architecture. +func (c *amd64Compiler) compileAdd(o *wazeroir.UnionOperation) error { + // TODO: if the previous instruction is const, then + // this can be optimized. Same goes for other arithmetic instructions. + + var instruction asm.Instruction + + unsignedType := wazeroir.UnsignedType(o.B1) + switch unsignedType { + case wazeroir.UnsignedTypeI32: + instruction = amd64.ADDL + case wazeroir.UnsignedTypeI64: + instruction = amd64.ADDQ + case wazeroir.UnsignedTypeF32: + instruction = amd64.ADDSS + case wazeroir.UnsignedTypeF64: + instruction = amd64.ADDSD + } + + x2 := c.locationStack.pop() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.peek() // Note this is peek! + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + // x1 += x2. + c.assembler.CompileRegisterToRegister(instruction, x2.register, x1.register) + + // We no longer need x2 register after ADD operation here, + // so we release it. + c.locationStack.releaseRegister(x2) + return nil +} + +// compileSub implements compiler.compileSub for the amd64 architecture. +func (c *amd64Compiler) compileSub(o *wazeroir.UnionOperation) error { + // TODO: if the previous instruction is const, then + // this can be optimized. Same goes for other arithmetic instructions. + + var instruction asm.Instruction + unsignedType := wazeroir.UnsignedType(o.B1) + switch unsignedType { + case wazeroir.UnsignedTypeI32: + instruction = amd64.SUBL + case wazeroir.UnsignedTypeI64: + instruction = amd64.SUBQ + case wazeroir.UnsignedTypeF32: + instruction = amd64.SUBSS + case wazeroir.UnsignedTypeF64: + instruction = amd64.SUBSD + } + + x2 := c.locationStack.pop() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.peek() // Note this is peek! + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + // x1 -= x2. + c.assembler.CompileRegisterToRegister(instruction, x2.register, x1.register) + + // We no longer need x2 register after ADD operation here, + // so we release it. + c.locationStack.releaseRegister(x2) + return nil +} + +// compileMul implements compiler.compileMul for the amd64 architecture. +func (c *amd64Compiler) compileMul(o *wazeroir.UnionOperation) (err error) { + unsignedType := wazeroir.UnsignedType(o.B1) + switch unsignedType { + case wazeroir.UnsignedTypeI32: + err = c.compileMulForInts(true, amd64.MULL) + case wazeroir.UnsignedTypeI64: + err = c.compileMulForInts(false, amd64.MULQ) + case wazeroir.UnsignedTypeF32: + err = c.compileMulForFloats(amd64.MULSS) + case wazeroir.UnsignedTypeF64: + err = c.compileMulForFloats(amd64.MULSD) + } + return +} + +// compileMulForInts emits instructions to perform integer multiplication for +// top two values on the stack. If unfamiliar with the convention for integer +// multiplication on x86, see https://www.felixcloutier.com/x86/mul. +// +// In summary, one of the values must be on the AX register, +// and the mul instruction stores the overflow info in DX register which we don't use. +// Here, we mean "the overflow info" by 65 bit or higher part of the result for 64 bit case. +// +// So, we have to ensure that +// 1. Previously located value on DX must be saved to memory stack. That is because +// the existing value will be overridden after the mul execution. +// 2. One of the operands (x1 or x2) must be on AX register. +// +// See https://www.felixcloutier.com/x86/mul#description for detail semantics. +func (c *amd64Compiler) compileMulForInts(is32Bit bool, mulInstruction asm.Instruction) error { + const ( + resultRegister = amd64.RegAX + reservedRegister = amd64.RegDX + ) + + x2 := c.locationStack.pop() + x1 := c.locationStack.pop() + + var valueOnAX *runtimeValueLocation + if x1.register == resultRegister { + valueOnAX = x1 + } else if x2.register == resultRegister { + valueOnAX = x2 + } else { + valueOnAX = x2 + // This case we move x2 to AX register. + c.onValueReleaseRegisterToStack(resultRegister) + if x2.onConditionalRegister() { + c.compileMoveConditionalToGeneralPurposeRegister(x2, resultRegister) + } else if x2.onStack() { + x2.setRegister(resultRegister) + c.compileLoadValueOnStackToRegister(x2) + c.locationStack.markRegisterUsed(resultRegister) + } else { + var inst asm.Instruction + if is32Bit { + inst = amd64.MOVL + } else { + inst = amd64.MOVQ + } + c.assembler.CompileRegisterToRegister(inst, x2.register, resultRegister) + + // We no longer uses the prev register of x2. + c.locationStack.releaseRegister(x2) + x2.setRegister(resultRegister) + c.locationStack.markRegisterUsed(resultRegister) + } + } + + // We have to make sure that at this point the operands must be on registers. + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + // We have to save the existing value on DX. + // If the DX register is used by either x1 or x2, we don't need to + // save the value because it is consumed by mul anyway. + if x1.register != reservedRegister && x2.register != reservedRegister { + c.onValueReleaseRegisterToStack(reservedRegister) + } + + // Now ready to emit the mul instruction. + if x1 == valueOnAX { + c.assembler.CompileRegisterToNone(mulInstruction, x2.register) + } else { + c.assembler.CompileRegisterToNone(mulInstruction, x1.register) + } + + c.locationStack.markRegisterUnused(x2.register) + c.locationStack.markRegisterUnused(x1.register) + + // Now we have the result in the AX register, + // so we record it. + c.pushRuntimeValueLocationOnRegister(resultRegister, x1.valueType) + return nil +} + +func (c *amd64Compiler) compileMulForFloats(instruction asm.Instruction) error { + x2 := c.locationStack.pop() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.peek() // Note this is peek! + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + // x1 *= x2. + c.assembler.CompileRegisterToRegister(instruction, x2.register, x1.register) + + // We no longer need x2 register after MUL operation here, + // so we release it. + c.locationStack.releaseRegister(x2) + return nil +} + +// compileClz implements compiler.compileClz for the amd64 architecture. +func (c *amd64Compiler) compileClz(o *wazeroir.UnionOperation) error { + target := c.locationStack.pop() + if err := c.compileEnsureOnRegister(target); err != nil { + return err + } + + unsignedInt := wazeroir.UnsignedInt(o.B1) + if c.cpuFeatures.HasExtra(platform.CpuExtraFeatureABM) { + if unsignedInt == wazeroir.UnsignedInt32 { + c.assembler.CompileRegisterToRegister(amd64.LZCNTL, target.register, target.register) + } else { + c.assembler.CompileRegisterToRegister(amd64.LZCNTQ, target.register, target.register) + } + } else { + // On processors that do not support LZCNT, we combine BSR (calculating + // most significant set bit) with XOR. This logic is described in + // "Replace Raw Assembly Code with Builtin Intrinsics" section in: + // https://developer.apple.com/documentation/apple-silicon/addressing-architectural-differences-in-your-macos-code. + + // First, we have to check if the target is non-zero as BSR is undefined + // on zero. See https://www.felixcloutier.com/x86/bsr. + c.assembler.CompileRegisterToRegister(amd64.TESTQ, target.register, target.register) + jmpIfNonZero := c.assembler.CompileJump(amd64.JNE) + + // If the value is zero, we just push the const value. + if unsignedInt == wazeroir.UnsignedInt32 { + c.assembler.CompileConstToRegister(amd64.MOVL, int64(32), target.register) + } else { + c.assembler.CompileConstToRegister(amd64.MOVL, int64(64), target.register) + } + + // Emit the jmp instruction to jump to the position right after + // the non-zero case. + jmpAtEndOfZero := c.assembler.CompileJump(amd64.JMP) + + // Start emitting non-zero case. + c.assembler.SetJumpTargetOnNext(jmpIfNonZero) + // First, we calculate the most significant set bit. + if unsignedInt == wazeroir.UnsignedInt32 { + c.assembler.CompileRegisterToRegister(amd64.BSRL, target.register, target.register) + } else { + c.assembler.CompileRegisterToRegister(amd64.BSRQ, target.register, target.register) + } + + // Now we XOR the value with the bit length minus one. + if unsignedInt == wazeroir.UnsignedInt32 { + c.assembler.CompileConstToRegister(amd64.XORL, 31, target.register) + } else { + c.assembler.CompileConstToRegister(amd64.XORQ, 63, target.register) + } + + // Finally the end jump instruction of zero case must target towards + // the next instruction. + c.assembler.SetJumpTargetOnNext(jmpAtEndOfZero) + } + + // We reused the same register of target for the result. + c.locationStack.markRegisterUnused(target.register) + c.pushRuntimeValueLocationOnRegister(target.register, target.valueType) + return nil +} + +// compileCtz implements compiler.compileCtz for the amd64 architecture. +func (c *amd64Compiler) compileCtz(o *wazeroir.UnionOperation) error { + target := c.locationStack.pop() + if err := c.compileEnsureOnRegister(target); err != nil { + return err + } + + unsignedInt := wazeroir.UnsignedInt(o.B1) + if c.cpuFeatures.HasExtra(platform.CpuExtraFeatureABM) { + if unsignedInt == wazeroir.UnsignedInt32 { + c.assembler.CompileRegisterToRegister(amd64.TZCNTL, target.register, target.register) + } else { + c.assembler.CompileRegisterToRegister(amd64.TZCNTQ, target.register, target.register) + } + } else { + // On processors that do not support TZCNT, the BSF instruction is + // executed instead. The key difference between TZCNT and BSF + // instruction is that if source operand is zero, the content of + // destination operand is undefined. + // https://www.felixcloutier.com/x86/tzcnt.html + + // First we compare the target with zero. + c.assembler.CompileRegisterToRegister(amd64.TESTQ, target.register, target.register) + jmpIfNonZero := c.assembler.CompileJump(amd64.JNE) + + // If the value is zero, we just push the const value. + if unsignedInt == wazeroir.UnsignedInt32 { + c.assembler.CompileConstToRegister(amd64.MOVL, int64(32), target.register) + } else { + c.assembler.CompileConstToRegister(amd64.MOVL, int64(64), target.register) + } + + // Emit the jmp instruction to jump to the position right after + // the non-zero case. + jmpAtEndOfZero := c.assembler.CompileJump(amd64.JMP) + + // Otherwise, emit the TZCNT. + c.assembler.SetJumpTargetOnNext(jmpIfNonZero) + if unsignedInt == wazeroir.UnsignedInt32 { + c.assembler.CompileRegisterToRegister(amd64.TZCNTL, target.register, target.register) + } else { + c.assembler.CompileRegisterToRegister(amd64.TZCNTQ, target.register, target.register) + } + + // Finally the end jump instruction of zero case must target towards + // the next instruction. + c.assembler.SetJumpTargetOnNext(jmpAtEndOfZero) + } + + // We reused the same register of target for the result. + c.locationStack.markRegisterUnused(target.register) + c.pushRuntimeValueLocationOnRegister(target.register, target.valueType) + return nil +} + +// compilePopcnt implements compiler.compilePopcnt for the amd64 architecture. +func (c *amd64Compiler) compilePopcnt(o *wazeroir.UnionOperation) error { + target := c.locationStack.pop() + if err := c.compileEnsureOnRegister(target); err != nil { + return err + } + + unsignedInt := wazeroir.UnsignedInt(o.B1) + if unsignedInt == wazeroir.UnsignedInt32 { + c.assembler.CompileRegisterToRegister(amd64.POPCNTL, target.register, target.register) + } else { + c.assembler.CompileRegisterToRegister(amd64.POPCNTQ, target.register, target.register) + } + + // We reused the same register of target for the result. + c.locationStack.markRegisterUnused(target.register) + c.pushRuntimeValueLocationOnRegister(target.register, target.valueType) + return nil +} + +// compileDiv implements compiler.compileDiv for the amd64 architecture. +func (c *amd64Compiler) compileDiv(o *wazeroir.UnionOperation) (err error) { + signedType := wazeroir.SignedType(o.B1) + switch signedType { + case wazeroir.SignedTypeUint32: + err = c.compileDivForInts(true, false) + case wazeroir.SignedTypeUint64: + err = c.compileDivForInts(false, false) + case wazeroir.SignedTypeInt32: + err = c.compileDivForInts(true, true) + case wazeroir.SignedTypeInt64: + err = c.compileDivForInts(false, true) + case wazeroir.SignedTypeFloat32: + err = c.compileDivForFloats(true) + case wazeroir.SignedTypeFloat64: + err = c.compileDivForFloats(false) + } + return +} + +// compileDivForInts emits the instructions to perform division on the top +// two values of integer type on the stack and puts the quotient of the result +// onto the stack. For example, stack [..., 10, 3] results in [..., 3] where +// the remainder is discarded. +func (c *amd64Compiler) compileDivForInts(is32Bit bool, signed bool) error { + if err := c.performDivisionOnInts(false, is32Bit, signed); err != nil { + return err + } + // Now we have the quotient of the division result in the AX register, + // so we record it. + if is32Bit { + c.pushRuntimeValueLocationOnRegister(amd64.RegAX, runtimeValueTypeI32) + } else { + c.pushRuntimeValueLocationOnRegister(amd64.RegAX, runtimeValueTypeI64) + } + return nil +} + +// compileRem implements compiler.compileRem for the amd64 architecture. +func (c *amd64Compiler) compileRem(o *wazeroir.UnionOperation) (err error) { + var vt runtimeValueType + signedInt := wazeroir.SignedInt(o.B1) + switch signedInt { + case wazeroir.SignedInt32: + err = c.performDivisionOnInts(true, true, true) + vt = runtimeValueTypeI32 + case wazeroir.SignedInt64: + err = c.performDivisionOnInts(true, false, true) + vt = runtimeValueTypeI64 + case wazeroir.SignedUint32: + err = c.performDivisionOnInts(true, true, false) + vt = runtimeValueTypeI32 + case wazeroir.SignedUint64: + err = c.performDivisionOnInts(true, false, false) + vt = runtimeValueTypeI64 + } + if err != nil { + return err + } + + // Now we have the remainder of the division result in the DX register, + // so we record it. + c.pushRuntimeValueLocationOnRegister(amd64.RegDX, vt) + return +} + +// performDivisionOnInts emits the instructions to do divisions on top two integers on the stack +// via DIV (unsigned div) and IDIV (signed div) instructions. +// See the following explanation of these instructions' semantics from https://www.lri.fr/~filliatr/ens/compil/x86-64.pdf +// +// >> Division requires special arrangements: idiv (signed) and div (unsigned) operate on a 2n-byte dividend and +// >> an n-byte divisor to produce an n-byte quotient and n-byte remainder. The dividend always lives in a fixed pair of +// >> registers (%edx and %eax for the 32-bit case; %rdx and %rax for the 64-bit case); the divisor is specified as the +// >> source operand in the instruction. The quotient goes in %eax (resp. %rax); the remainder in %edx (resp. %rdx). For +// >> signed division, the cltd (resp. ctqo) instruction is used to prepare %edx (resp. %rdx) with the sign extension of +// >> %eax (resp. %rax). For example, if a,b, c are memory locations holding quad words, then we could set c = a/b +// >> using the sequence: movq a(%rip), %rax; ctqo; idivq b(%rip); movq %rax, c(%rip). +// +// tl;dr is that the division result is placed in AX and DX registers after instructions emitted by this function +// where AX holds the quotient while DX the remainder of the division result. +func (c *amd64Compiler) performDivisionOnInts(isRem, is32Bit, signed bool) error { + const ( + quotientRegister = amd64.RegAX + remainderRegister = amd64.RegDX + ) + + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + // Ensures that previous values on these registers are saved to memory. + c.onValueReleaseRegisterToStack(quotientRegister) + c.onValueReleaseRegisterToStack(remainderRegister) + + // In order to ensure x2 is placed on a temporary register for x2 value other than AX and DX, + // we mark them as used here. + c.locationStack.markRegisterUsed(quotientRegister) + c.locationStack.markRegisterUsed(remainderRegister) + + // Ensure that x2 is placed on a register which is not either AX or DX. + x2 := c.locationStack.pop() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + // Now we successfully place x2 on a temp register, so we no longer need to + // mark these registers used. + c.locationStack.markRegisterUnused(quotientRegister) + c.locationStack.markRegisterUnused(remainderRegister) + + // Check if the x2 equals zero. + if is32Bit { + c.assembler.CompileRegisterToRegister(amd64.TESTL, x2.register, x2.register) + } else { + c.assembler.CompileRegisterToRegister(amd64.TESTQ, x2.register, x2.register) + } + + // Skipped if the divisor is nonzero. + c.compileMaybeExitFromNativeCode(amd64.JNE, nativeCallStatusIntegerDivisionByZero) + + // next, we ensure that x1 is placed on AX. + x1 := c.locationStack.pop() + if x1.onRegister() && x1.register != quotientRegister { + // Move x1 to quotientRegister. + if is32Bit { + c.assembler.CompileRegisterToRegister(amd64.MOVL, x1.register, quotientRegister) + } else { + c.assembler.CompileRegisterToRegister(amd64.MOVQ, x1.register, quotientRegister) + } + c.locationStack.markRegisterUnused(x1.register) + x1.setRegister(quotientRegister) + } else if x1.onStack() { + x1.setRegister(quotientRegister) + c.compileLoadValueOnStackToRegister(x1) + } + + // Note: at this point, x1 is placed on AX, x2 is on a register which is not AX or DX. + + isSignedRem := isRem && signed + isSignedDiv := !isRem && signed + var signedRemMinusOneDivisorJmp asm.Node + if isSignedRem { + // If this is for getting remainder of signed division, + // we have to treat the special case where the divisor equals -1. + // For example, if this is 32-bit case, the result of (-2^31) / -1 equals (quotient=2^31, remainder=0) + // where quotient doesn't fit in the 32-bit range whose maximum is 2^31-1. + // x86 in this case cause floating point exception, but according to the Wasm spec + // if the divisor equals -1, the result must be zero (not undefined!) as opposed to be "undefined" + // for divisions on (-2^31) / -1 where we do not need to emit the special branches. + // For detail, please refer to https://stackoverflow.com/questions/56303282/why-idiv-with-1-causes-floating-point-exception + + // First we store zero into the remainder result register (DX) and compare the divisor with -1. + if is32Bit { + c.assembler.CompileRegisterToRegister(amd64.XORL, remainderRegister, remainderRegister) + c.assembler.CompileRegisterToConst(amd64.CMPL, x2.register, -1) + } else { + c.assembler.CompileRegisterToRegister(amd64.XORQ, remainderRegister, remainderRegister) + c.assembler.CompileRegisterToConst(amd64.CMPQ, x2.register, -1) + } + + // If it equals minus one, we skip the normal case. + signedRemMinusOneDivisorJmp = c.assembler.CompileJump(amd64.JEQ) + } else if isSignedDiv { + // For signed division, we have to have branches for "math.MinInt{32,64} / -1" + // case which results in the floating point exception via division error as + // the resulting value exceeds the maximum of signed int. + + // First we compare the division with -1. + if is32Bit { + c.assembler.CompileRegisterToConst(amd64.CMPL, x2.register, -1) + } else { + c.assembler.CompileRegisterToConst(amd64.CMPQ, x2.register, -1) + } + + // If it doesn't equal minus one, we jump to the normal case. + nonMinusOneDivisorJmp := c.assembler.CompileJump(amd64.JNE) + + // next we check if the quotient is the most negative value for the signed integer. + // That means whether or not we try to do (math.MinInt32 / -1) or (math.MinInt64 / -1) respectively. + if is32Bit { + if err := c.assembler.CompileRegisterToStaticConst(amd64.CMPL, x1.register, c.minimum32BitSignedInt); err != nil { + return err + } + } else { + if err := c.assembler.CompileRegisterToStaticConst(amd64.CMPQ, x1.register, c.minimum64BitSignedInt); err != nil { + return err + } + } + + // Trap if we are trying to do (math.MinInt32 / -1) or (math.MinInt64 / -1), + // as that is the overflow in division as the result becomes 2^31 which is larger than + // the maximum of signed 32-bit int (2^31-1). + c.compileMaybeExitFromNativeCode(amd64.JNE, nativeCallStatusIntegerOverflow) + // Set the normal case's jump target. + c.assembler.SetJumpTargetOnNext(nonMinusOneDivisorJmp) + } + + // Now ready to emit the div instruction. + // Since the div instructions takes 2n byte dividend placed in DX:AX registers... + // * signed case - we need to sign-extend the dividend into DX register via CDQ (32 bit) or CQO (64 bit). + // * unsigned case - we need to zero DX register via "XOR DX DX" + if is32Bit && signed { + // Emit sign-extension to have 64 bit dividend over DX and AX registers. + c.assembler.CompileStandAlone(amd64.CDQ) + c.assembler.CompileRegisterToNone(amd64.IDIVL, x2.register) + } else if is32Bit && !signed { + // Zeros DX register to have 64 bit dividend over DX and AX registers. + c.assembler.CompileRegisterToRegister(amd64.XORQ, amd64.RegDX, amd64.RegDX) + c.assembler.CompileRegisterToNone(amd64.DIVL, x2.register) + } else if !is32Bit && signed { + // Emits sign-extension to have 128 bit dividend over DX and AX registers. + c.assembler.CompileStandAlone(amd64.CQO) + c.assembler.CompileRegisterToNone(amd64.IDIVQ, x2.register) + } else if !is32Bit && !signed { + // Zeros DX register to have 128 bit dividend over DX and AX registers. + c.assembler.CompileRegisterToRegister(amd64.XORQ, amd64.RegDX, amd64.RegDX) + c.assembler.CompileRegisterToNone(amd64.DIVQ, x2.register) + } + + // If this is signed rem instruction, we must set the jump target of + // the exit jump from division -1 case towards the next instruction. + if signedRemMinusOneDivisorJmp != nil { + c.assembler.SetJumpTargetOnNext(signedRemMinusOneDivisorJmp) + } + + // We mark them as unused so that we can push one of them onto the location stack at call sites. + c.locationStack.markRegisterUnused(remainderRegister) + c.locationStack.markRegisterUnused(quotientRegister) + c.locationStack.markRegisterUnused(x2.register) + return nil +} + +// compileDivForFloats emits the instructions to perform division +// on the top two values of float type on the stack, placing the result back onto the stack. +// For example, stack [..., 1.0, 4.0] results in [..., 0.25]. +func (c *amd64Compiler) compileDivForFloats(is32Bit bool) error { + if is32Bit { + return c.compileSimpleBinaryOp(amd64.DIVSS) + } else { + return c.compileSimpleBinaryOp(amd64.DIVSD) + } +} + +// compileAnd implements compiler.compileAnd for the amd64 architecture. +func (c *amd64Compiler) compileAnd(o *wazeroir.UnionOperation) (err error) { + unsignedInt := wazeroir.UnsignedInt(o.B1) + switch unsignedInt { + case wazeroir.UnsignedInt32: + err = c.compileSimpleBinaryOp(amd64.ANDL) + case wazeroir.UnsignedInt64: + err = c.compileSimpleBinaryOp(amd64.ANDQ) + } + return +} + +// compileOr implements compiler.compileOr for the amd64 architecture. +func (c *amd64Compiler) compileOr(o *wazeroir.UnionOperation) (err error) { + unsignedInt := wazeroir.UnsignedInt(o.B1) + switch unsignedInt { + case wazeroir.UnsignedInt32: + err = c.compileSimpleBinaryOp(amd64.ORL) + case wazeroir.UnsignedInt64: + err = c.compileSimpleBinaryOp(amd64.ORQ) + } + return +} + +// compileXor implements compiler.compileXor for the amd64 architecture. +func (c *amd64Compiler) compileXor(o *wazeroir.UnionOperation) (err error) { + unsignedInt := wazeroir.UnsignedInt(o.B1) + switch unsignedInt { + case wazeroir.UnsignedInt32: + err = c.compileSimpleBinaryOp(amd64.XORL) + case wazeroir.UnsignedInt64: + err = c.compileSimpleBinaryOp(amd64.XORQ) + } + return +} + +// compileSimpleBinaryOp emits instructions to pop two values from the stack +// and perform the given instruction on these two values and push the result +// onto the stack. +func (c *amd64Compiler) compileSimpleBinaryOp(instruction asm.Instruction) error { + x2 := c.locationStack.pop() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.pop() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + c.assembler.CompileRegisterToRegister(instruction, x2.register, x1.register) + + // We consumed x2 register after the operation here, + // so we release it. + c.locationStack.releaseRegister(x2) + + // We already stored the result in the register used by x1 + // so we record it. + c.locationStack.markRegisterUnused(x1.register) + c.pushRuntimeValueLocationOnRegister(x1.register, x1.valueType) + return nil +} + +// compileShl implements compiler.compileShl for the amd64 architecture. +func (c *amd64Compiler) compileShl(o *wazeroir.UnionOperation) (err error) { + unsignedInt := wazeroir.UnsignedInt(o.B1) + switch unsignedInt { + case wazeroir.UnsignedInt32: + err = c.compileShiftOp(amd64.SHLL, false) + case wazeroir.UnsignedInt64: + err = c.compileShiftOp(amd64.SHLQ, true) + } + return +} + +// compileShr implements compiler.compileShr for the amd64 architecture. +func (c *amd64Compiler) compileShr(o *wazeroir.UnionOperation) (err error) { + signedInt := wazeroir.SignedInt(o.B1) + switch signedInt { + case wazeroir.SignedInt32: + err = c.compileShiftOp(amd64.SARL, true) + case wazeroir.SignedInt64: + err = c.compileShiftOp(amd64.SARQ, false) + case wazeroir.SignedUint32: + err = c.compileShiftOp(amd64.SHRL, true) + case wazeroir.SignedUint64: + err = c.compileShiftOp(amd64.SHRQ, false) + } + return +} + +// compileRotl implements compiler.compileRotl for the amd64 architecture. +func (c *amd64Compiler) compileRotl(o *wazeroir.UnionOperation) (err error) { + unsignedInt := wazeroir.UnsignedInt(o.B1) + switch unsignedInt { + case wazeroir.UnsignedInt32: + err = c.compileShiftOp(amd64.ROLL, true) + case wazeroir.UnsignedInt64: + err = c.compileShiftOp(amd64.ROLQ, false) + } + return +} + +// compileRotr implements compiler.compileRotr for the amd64 architecture. +func (c *amd64Compiler) compileRotr(o *wazeroir.UnionOperation) (err error) { + unsignedInt := wazeroir.UnsignedInt(o.B1) + switch unsignedInt { + case wazeroir.UnsignedInt32: + err = c.compileShiftOp(amd64.RORL, true) + case wazeroir.UnsignedInt64: + err = c.compileShiftOp(amd64.RORQ, false) + } + return +} + +// compileShiftOp adds instructions for shift operations (SHR, SHL, ROTR, ROTL) +// where we have to place the second value (shift counts) on the CX register. +func (c *amd64Compiler) compileShiftOp(instruction asm.Instruction, is32Bit bool) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + x2 := c.locationStack.pop() + + // Ensures that x2 (holding shift counts) is placed on the CX register. + const shiftCountRegister = amd64.RegCX + if (x2.onRegister() && x2.register != shiftCountRegister) || x2.onStack() { + // If another value lives on the CX register, we release it to the stack. + c.onValueReleaseRegisterToStack(shiftCountRegister) + + if x2.onRegister() { + x2r := x2.register + // If x2 lives on a register, we move the value to CX. + if is32Bit { + c.assembler.CompileRegisterToRegister(amd64.MOVL, x2r, shiftCountRegister) + } else { + c.assembler.CompileRegisterToRegister(amd64.MOVQ, x2r, shiftCountRegister) + } + // We no longer place any value on the original register, so we record it. + c.locationStack.markRegisterUnused(x2r) + } else { + // If it is on stack, we just move the memory allocated value to the CX register. + x2.setRegister(shiftCountRegister) + c.compileLoadValueOnStackToRegister(x2) + } + c.locationStack.markRegisterUsed(shiftCountRegister) + } + + x1 := c.locationStack.peek() // Note this is peek! + x1r := x1.register + + if x1.onRegister() { + c.assembler.CompileRegisterToRegister(instruction, shiftCountRegister, x1r) + } else { + // Shift target can be placed on a memory location. + // Note: stack pointers are ensured not to exceed 2^27 so this offset never exceeds 32-bit range. + c.assembler.CompileRegisterToMemory(instruction, shiftCountRegister, amd64ReservedRegisterForStackBasePointerAddress, int64(x1.stackPointer)*8) + } + + // We consumed x2 register after the operation here, + // so we release it. + c.locationStack.markRegisterUnused(shiftCountRegister) + return nil +} + +// compileAbs implements compiler.compileAbs for the amd64 architecture. +// +// See the following discussions for how we could take the abs of floats on x86 assembly. +// https://stackoverflow.com/questions/32408665/fastest-way-to-compute-absolute-value-using-sse/32422471#32422471 +// https://stackoverflow.com/questions/44630015/how-would-fabsdouble-be-implemented-on-x86-is-it-an-expensive-operation +func (c *amd64Compiler) compileAbs(o *wazeroir.UnionOperation) (err error) { + target := c.locationStack.peek() // Note this is peek! + if err = c.compileEnsureOnRegister(target); err != nil { + return err + } + + // First shift left by one to clear the sign bit, and then shift right by one. + if wazeroir.Float(o.B1) == wazeroir.Float32 { + c.assembler.CompileConstToRegister(amd64.PSLLD, 1, target.register) + c.assembler.CompileConstToRegister(amd64.PSRLD, 1, target.register) + } else { + c.assembler.CompileConstToRegister(amd64.PSLLQ, 1, target.register) + c.assembler.CompileConstToRegister(amd64.PSRLQ, 1, target.register) + } + return nil +} + +// compileNeg implements compiler.compileNeg for the amd64 architecture. +func (c *amd64Compiler) compileNeg(o *wazeroir.UnionOperation) (err error) { + target := c.locationStack.peek() // Note this is peek! + if err := c.compileEnsureOnRegister(target); err != nil { + return err + } + + tmpReg, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + // First we move the sign-bit mask (placed in memory) to the tmp register, + // since we cannot take XOR directly with float reg and const. + // And then negate the value by XOR it with the sign-bit mask. + if wazeroir.Float(o.B1) == wazeroir.Float32 { + err = c.assembler.CompileStaticConstToRegister(amd64.MOVL, c.float32SignBitMask, tmpReg) + if err != nil { + return err + } + c.assembler.CompileRegisterToRegister(amd64.XORPS, tmpReg, target.register) + } else { + err = c.assembler.CompileStaticConstToRegister(amd64.MOVQ, c.float64SignBitMask, tmpReg) + if err != nil { + return err + } + c.assembler.CompileRegisterToRegister(amd64.XORPD, tmpReg, target.register) + } + return nil +} + +// compileCeil implements compiler.compileCeil for the amd64 architecture. +func (c *amd64Compiler) compileCeil(o *wazeroir.UnionOperation) (err error) { + // Internally, ceil can be performed via ROUND instruction with 0x02 mode. + // See https://android.googlesource.com/platform/bionic/+/882b8af/libm/x86_64/ceilf.S for example. + return c.compileRoundInstruction(wazeroir.Float(o.B1) == wazeroir.Float32, 0x02) +} + +// compileFloor implements compiler.compileFloor for the amd64 architecture. +func (c *amd64Compiler) compileFloor(o *wazeroir.UnionOperation) (err error) { + // Internally, floor can be performed via ROUND instruction with 0x01 mode. + // See https://android.googlesource.com/platform/bionic/+/882b8af/libm/x86_64/floorf.S for example. + return c.compileRoundInstruction(wazeroir.Float(o.B1) == wazeroir.Float32, 0x01) +} + +// compileTrunc implements compiler.compileTrunc for the amd64 architecture. +func (c *amd64Compiler) compileTrunc(o *wazeroir.UnionOperation) error { + // Internally, trunc can be performed via ROUND instruction with 0x03 mode. + // See https://android.googlesource.com/platform/bionic/+/882b8af/libm/x86_64/truncf.S for example. + return c.compileRoundInstruction(wazeroir.Float(o.B1) == wazeroir.Float32, 0x03) +} + +// compileNearest implements compiler.compileNearest for the amd64 architecture. +func (c *amd64Compiler) compileNearest(o *wazeroir.UnionOperation) error { + // Nearest can be performed via ROUND instruction with 0x00 mode. + return c.compileRoundInstruction(wazeroir.Float(o.B1) == wazeroir.Float32, 0x00) +} + +func (c *amd64Compiler) compileRoundInstruction(is32Bit bool, mode int64) error { + target := c.locationStack.peek() // Note this is peek! + if err := c.compileEnsureOnRegister(target); err != nil { + return err + } + + if is32Bit { + c.assembler.CompileRegisterToRegisterWithArg(amd64.ROUNDSS, target.register, target.register, byte(mode)) + } else { + c.assembler.CompileRegisterToRegisterWithArg(amd64.ROUNDSD, target.register, target.register, byte(mode)) + } + return nil +} + +// compileMin implements compiler.compileMin for the amd64 architecture. +func (c *amd64Compiler) compileMin(o *wazeroir.UnionOperation) error { + is32Bit := wazeroir.Float(o.B1) == wazeroir.Float32 + if is32Bit { + return c.compileMinOrMax(is32Bit, true, amd64.MINSS) + } else { + return c.compileMinOrMax(is32Bit, true, amd64.MINSD) + } +} + +// compileMax implements compiler.compileMax for the amd64 architecture. +func (c *amd64Compiler) compileMax(o *wazeroir.UnionOperation) error { + is32Bit := wazeroir.Float(o.B1) == wazeroir.Float32 + if is32Bit { + return c.compileMinOrMax(is32Bit, false, amd64.MAXSS) + } else { + return c.compileMinOrMax(is32Bit, false, amd64.MAXSD) + } +} + +// emitMinOrMax adds instructions to pop two values from the stack, and push back either minimum or +// minimum of these two values onto the stack according to the minOrMaxInstruction argument. +// minOrMaxInstruction must be one of MAXSS, MAXSD, MINSS or MINSD. +// Note: These native min/max instructions are almost compatible with min/max in the Wasm specification, +// but it is slightly different with respect to the NaN handling. +// Native min/max instructions return non-NaN value if exactly one of target values +// is NaN. For example native_{min,max}(5.0, NaN) returns always 5.0, not NaN. +// However, WebAssembly specifies that min/max must always return NaN if one of values is NaN. +// Therefore, in this function, we have to add conditional jumps to check if one of values is NaN before +// the native min/max, which is why we cannot simply emit a native min/max instruction here. +// +// For the semantics, see wazeroir.Min and wazeroir.Max for detail. +func (c *amd64Compiler) compileMinOrMax(is32Bit, isMin bool, minOrMaxInstruction asm.Instruction) error { + x2 := c.locationStack.pop() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + x1 := c.locationStack.pop() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + // Check if this is (either x1 or x2 is NaN) or (x1 equals x2) case + if is32Bit { + c.assembler.CompileRegisterToRegister(amd64.UCOMISS, x2.register, x1.register) + } else { + c.assembler.CompileRegisterToRegister(amd64.UCOMISD, x2.register, x1.register) + } + + // At this point, we have the three cases of conditional flags below + // (See https://www.felixcloutier.com/x86/ucomiss#operation for detail.) + // + // 1) Two values are NaN-free and different: All flags are cleared. + // 2) Two values are NaN-free and equal: Only ZF flags is set. + // 3) One of Two values is NaN: ZF, PF and CF flags are set. + + // Jump instruction to handle 1) case by checking the ZF flag + // as ZF is only set for 2) and 3) cases. + nanFreeOrDiffJump := c.assembler.CompileJump(amd64.JNE) + + // Start handling 2) and 3). + + // Jump if one of two values is NaN by checking the parity flag (PF). + includeNaNJmp := c.assembler.CompileJump(amd64.JPS) + + // Start handling 2). + + // Before we exit this case, we have to ensure that positive zero (or negative zero for min instruction) is + // returned if two values are positive and negative zeros. + var inst asm.Instruction + switch { + case is32Bit && isMin: + inst = amd64.ORPS + case !is32Bit && isMin: + inst = amd64.ORPD + case is32Bit && !isMin: + inst = amd64.ANDPS + case !is32Bit && !isMin: + inst = amd64.ANDPD + } + c.assembler.CompileRegisterToRegister(inst, x2.register, x1.register) + + sameExitJmp := c.assembler.CompileJump(amd64.JMP) + + // start handling 3). + c.assembler.SetJumpTargetOnNext(includeNaNJmp) + + // We emit the ADD instruction to produce the NaN in x1. + if is32Bit { + c.assembler.CompileRegisterToRegister(amd64.ADDSS, x2.register, x1.register) + } else { + c.assembler.CompileRegisterToRegister(amd64.ADDSD, x2.register, x1.register) + } + + // Exit from the NaN case branch. + nanExitJmp := c.assembler.CompileJump(amd64.JMP) + + // Start handling 1). + c.assembler.SetJumpTargetOnNext(nanFreeOrDiffJump) + + // Now handle the NaN-free and different values case. + c.assembler.CompileRegisterToRegister(minOrMaxInstruction, x2.register, x1.register) + + // Set the jump target of 1) and 2) cases to the next instruction after 3) case. + c.assembler.SetJumpTargetOnNext(nanExitJmp) + c.assembler.SetJumpTargetOnNext(sameExitJmp) + + // Record that we consumed the x2 and placed the minOrMax result in the x1's register. + c.locationStack.markRegisterUnused(x2.register) + c.locationStack.markRegisterUnused(x1.register) + c.pushRuntimeValueLocationOnRegister(x1.register, x1.valueType) + return nil +} + +// compileCopysign implements compiler.compileCopysign for the amd64 architecture. +func (c *amd64Compiler) compileCopysign(o *wazeroir.UnionOperation) error { + is32Bit := wazeroir.Float(o.B1) == wazeroir.Float32 + + x2 := c.locationStack.pop() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + x1 := c.locationStack.pop() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + tmpReg, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + // Move the rest bit mask to the temp register. + if is32Bit { + err = c.assembler.CompileStaticConstToRegister(amd64.MOVL, c.float32RestBitMask, tmpReg) + } else { + err = c.assembler.CompileStaticConstToRegister(amd64.MOVQ, c.float64RestBitMask, tmpReg) + } + if err != nil { + return err + } + + // Clear the sign bit of x1 via AND with the mask. + if is32Bit { + c.assembler.CompileRegisterToRegister(amd64.ANDPS, tmpReg, x1.register) + } else { + c.assembler.CompileRegisterToRegister(amd64.ANDPD, tmpReg, x1.register) + } + + // Move the sign bit mask to the temp register. + if is32Bit { + err = c.assembler.CompileStaticConstToRegister(amd64.MOVL, c.float32SignBitMask, tmpReg) + } else { + err = c.assembler.CompileStaticConstToRegister(amd64.MOVQ, c.float64SignBitMask, tmpReg) + } + if err != nil { + return err + } + + // Clear the non-sign bits of x2 via AND with the mask. + if is32Bit { + c.assembler.CompileRegisterToRegister(amd64.ANDPS, tmpReg, x2.register) + } else { + c.assembler.CompileRegisterToRegister(amd64.ANDPD, tmpReg, x2.register) + } + + // Finally, copy the sign bit of x2 to x1. + if is32Bit { + c.assembler.CompileRegisterToRegister(amd64.ORPS, x2.register, x1.register) + } else { + c.assembler.CompileRegisterToRegister(amd64.ORPD, x2.register, x1.register) + } + + // Record that we consumed the x2 and placed the copysign result in the x1's register. + c.locationStack.markRegisterUnused(x2.register) + c.locationStack.markRegisterUnused(x1.register) + c.pushRuntimeValueLocationOnRegister(x1.register, x1.valueType) + return nil +} + +// compileSqrt implements compiler.compileSqrt for the amd64 architecture. +func (c *amd64Compiler) compileSqrt(o *wazeroir.UnionOperation) error { + target := c.locationStack.peek() // Note this is peek! + if err := c.compileEnsureOnRegister(target); err != nil { + return err + } + if wazeroir.Float(o.B1) == wazeroir.Float32 { + c.assembler.CompileRegisterToRegister(amd64.SQRTSS, target.register, target.register) + } else { + c.assembler.CompileRegisterToRegister(amd64.SQRTSD, target.register, target.register) + } + return nil +} + +// compileI32WrapFromI64 implements compiler.compileI32WrapFromI64 for the amd64 architecture. +func (c *amd64Compiler) compileI32WrapFromI64() error { + target := c.locationStack.peek() // Note this is peek! + if err := c.compileEnsureOnRegister(target); err != nil { + return err + } + c.assembler.CompileRegisterToRegister(amd64.MOVL, target.register, target.register) + target.valueType = runtimeValueTypeI32 + return nil +} + +// compileITruncFromF implements compiler.compileITruncFromF for the amd64 architecture. +// +// Note: in the following implementation, we use CVTSS2SI and CVTSD2SI to convert floats to signed integers. +// According to the Intel manual ([1],[2]), if the source float value is either +-Inf or NaN, or it exceeds representative ranges +// of target signed integer, then the instruction returns "masked" response float32SignBitMask (or float64SignBitMask for 64 bit case). +// [1] Chapter 11.5.2, SIMD Floating-Point Exception Conditions in "Vol 1, IntelĀ® 64 and IA-32 Architectures Manual" +// +// https://www.intel.com/content/www/us/en/architecture-and-technology/64-ia-32-architectures-software-developer-vol-1-manual.html +// +// [2] https://xem.github.io/minix86/manual/intel-x86-and-64-manual-vol1/o_7281d5ea06a5b67a-268.html +func (c *amd64Compiler) compileITruncFromF(o *wazeroir.UnionOperation) (err error) { + inputType := wazeroir.Float(o.B1) + outputType := wazeroir.SignedInt(o.B2) + nonTrapping := o.B3 + if inputType == wazeroir.Float32 && outputType == wazeroir.SignedInt32 { + err = c.emitSignedI32TruncFromFloat(true, nonTrapping) + } else if inputType == wazeroir.Float32 && outputType == wazeroir.SignedInt64 { + err = c.emitSignedI64TruncFromFloat(true, nonTrapping) + } else if inputType == wazeroir.Float64 && outputType == wazeroir.SignedInt32 { + err = c.emitSignedI32TruncFromFloat(false, nonTrapping) + } else if inputType == wazeroir.Float64 && outputType == wazeroir.SignedInt64 { + err = c.emitSignedI64TruncFromFloat(false, nonTrapping) + } else if inputType == wazeroir.Float32 && outputType == wazeroir.SignedUint32 { + err = c.emitUnsignedI32TruncFromFloat(true, nonTrapping) + } else if inputType == wazeroir.Float32 && outputType == wazeroir.SignedUint64 { + err = c.emitUnsignedI64TruncFromFloat(true, nonTrapping) + } else if inputType == wazeroir.Float64 && outputType == wazeroir.SignedUint32 { + err = c.emitUnsignedI32TruncFromFloat(false, nonTrapping) + } else if inputType == wazeroir.Float64 && outputType == wazeroir.SignedUint64 { + err = c.emitUnsignedI64TruncFromFloat(false, nonTrapping) + } + return +} + +// emitUnsignedI32TruncFromFloat implements compileITruncFromF when the destination type is a 32-bit unsigned integer. +func (c *amd64Compiler) emitUnsignedI32TruncFromFloat(isFloat32Bit, nonTrapping bool) error { + source := c.locationStack.pop() + if err := c.compileEnsureOnRegister(source); err != nil { + return err + } + + result, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + // First, we check the source float value is above or equal math.MaxInt32+1. + if isFloat32Bit { + err = c.assembler.CompileStaticConstToRegister(amd64.UCOMISS, c.float32ForMaximumSigned32bitIntPlusOne, source.register) + } else { + err = c.assembler.CompileStaticConstToRegister(amd64.UCOMISD, c.float64ForMaximumSigned32bitIntPlusOne, source.register) + } + if err != nil { + return err + } + + // Check the parity flag (set when the value is NaN), and if it is set, we should raise an exception. + var nonTrappingNaNJump asm.Node + if nonTrapping { + jmpIfNotNaN := c.assembler.CompileJump(amd64.JPC) // jump if parity is not set. + // In non trapping case, NaN is casted as zero. + // Zero out the result register by XOR itsself. + c.assembler.CompileRegisterToRegister(amd64.XORL, result, result) + nonTrappingNaNJump = c.assembler.CompileJump(amd64.JMP) + c.assembler.SetJumpTargetOnNext(jmpIfNotNaN) + } else { + c.compileMaybeExitFromNativeCode(amd64.JPC, nativeCallStatusCodeInvalidFloatToIntConversion) + } + + // Jump if the source float value is above or equal math.MaxInt32+1. + jmpAboveOrEqualMaxIn32PlusOne := c.assembler.CompileJump(amd64.JCC) + + // next we convert the value as a signed integer. + if isFloat32Bit { + c.assembler.CompileRegisterToRegister(amd64.CVTTSS2SL, source.register, result) + } else { + c.assembler.CompileRegisterToRegister(amd64.CVTTSD2SL, source.register, result) + } + + // Then if the result is minus, it is invalid conversion from minus float (incl. -Inf). + c.assembler.CompileRegisterToRegister(amd64.TESTL, result, result) + + var nonTrappingMinusJump asm.Node + if nonTrapping { + jmpIfNotMinusOrMinusInf := c.assembler.CompileJump(amd64.JPL) + // In non trapping case, the minus value is casted as zero. + // Zero out the result register by XOR itsself. + c.assembler.CompileRegisterToRegister(amd64.XORL, result, result) + nonTrappingMinusJump = c.assembler.CompileJump(amd64.JMP) + c.assembler.SetJumpTargetOnNext(jmpIfNotMinusOrMinusInf) + } else { + c.compileMaybeExitFromNativeCode(amd64.JPL, nativeCallStatusIntegerOverflow) + } + + // Otherwise, the values is valid. + okJmpForLessThanMaxInt32PlusOne := c.assembler.CompileJump(amd64.JMP) + + // Now, start handling the case where the original float value is above or equal math.MaxInt32+1. + // + // First, we subtract the math.MaxInt32+1 from the original value so it can fit in signed 32-bit integer. + c.assembler.SetJumpTargetOnNext(jmpAboveOrEqualMaxIn32PlusOne) + if isFloat32Bit { + err = c.assembler.CompileStaticConstToRegister(amd64.SUBSS, c.float32ForMaximumSigned32bitIntPlusOne, source.register) + } else { + err = c.assembler.CompileStaticConstToRegister(amd64.SUBSD, c.float64ForMaximumSigned32bitIntPlusOne, source.register) + } + if err != nil { + return err + } + + // Then, convert the subtracted value as a signed 32-bit integer. + if isFloat32Bit { + c.assembler.CompileRegisterToRegister(amd64.CVTTSS2SL, source.register, result) + } else { + c.assembler.CompileRegisterToRegister(amd64.CVTTSD2SL, source.register, result) + } + + // next, we have to check if the value is from NaN, +Inf. + // NaN or +Inf cases result in 0x8000_0000 according to the semantics of conversion, + // This means we check if the result int value is minus or not. + c.assembler.CompileRegisterToRegister(amd64.TESTL, result, result) + + // If the result is minus, the conversion is invalid (from NaN or +Inf) + var nonTrappingAboveOrEqualMaxInt32PlusOne asm.Node + if nonTrapping { + jmpIfNotPlusInf := c.assembler.CompileJump(amd64.JPL) + err = c.assembler.CompileStaticConstToRegister(amd64.MOVL, c.maximum32BitUnsignedInt, result) + if err != nil { + return err + } + nonTrappingAboveOrEqualMaxInt32PlusOne = c.assembler.CompileJump(amd64.JMP) + c.assembler.SetJumpTargetOnNext(jmpIfNotPlusInf) + } else { + c.compileMaybeExitFromNativeCode(amd64.JPL, nativeCallStatusIntegerOverflow) + } + + // Otherwise, we successfully converted the source float minus (math.MaxInt32+1) to int. + // So, we retrieve the original source float value by adding the sign mask. + if err = c.assembler.CompileStaticConstToRegister(amd64.ADDL, c.float32SignBitMask, result); err != nil { + return err + } + + // We jump to the next instructions for valid cases. + c.assembler.SetJumpTargetOnNext(okJmpForLessThanMaxInt32PlusOne) + if nonTrapping { + c.assembler.SetJumpTargetOnNext(nonTrappingAboveOrEqualMaxInt32PlusOne) + c.assembler.SetJumpTargetOnNext(nonTrappingMinusJump) + c.assembler.SetJumpTargetOnNext(nonTrappingNaNJump) + } + + // We consumed the source's register and placed the conversion result + // in the result register. + c.locationStack.markRegisterUnused(source.register) + c.pushRuntimeValueLocationOnRegister(result, runtimeValueTypeI32) + return nil +} + +// emitUnsignedI32TruncFromFloat implements compileITruncFromF when the destination type is a 64-bit unsigned integer. +func (c *amd64Compiler) emitUnsignedI64TruncFromFloat(isFloat32Bit, nonTrapping bool) error { + source := c.locationStack.pop() + if err := c.compileEnsureOnRegister(source); err != nil { + return err + } + + result, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + // First, we check the source float value is above or equal math.MaxInt64+1. + if isFloat32Bit { + err = c.assembler.CompileStaticConstToRegister(amd64.UCOMISS, c.float32ForMaximumSigned64bitIntPlusOne, source.register) + } else { + err = c.assembler.CompileStaticConstToRegister(amd64.UCOMISD, c.float64ForMaximumSigned64bitIntPlusOne, source.register) + } + if err != nil { + return err + } + + // Check the parity flag (set when the value is NaN), and if it is set, we should raise an exception. + var nonTrappingNaNJump asm.Node + if nonTrapping { + jmpIfNotNaN := c.assembler.CompileJump(amd64.JPC) // jump if parity is c.not set. + // In non trapping case, NaN is casted as zero. + // Zero out the result register by XOR itsself. + c.assembler.CompileRegisterToRegister(amd64.XORQ, result, result) + nonTrappingNaNJump = c.assembler.CompileJump(amd64.JMP) + c.assembler.SetJumpTargetOnNext(jmpIfNotNaN) + } else { + c.compileMaybeExitFromNativeCode(amd64.JPC, nativeCallStatusCodeInvalidFloatToIntConversion) + } + + // Jump if the source float values is above or equal math.MaxInt64+1. + jmpAboveOrEqualMaxIn32PlusOne := c.assembler.CompileJump(amd64.JCC) + + // next we convert the value as a signed integer. + if isFloat32Bit { + c.assembler.CompileRegisterToRegister(amd64.CVTTSS2SQ, source.register, result) + } else { + c.assembler.CompileRegisterToRegister(amd64.CVTTSD2SQ, source.register, result) + } + + // Then if the result is minus, it is invalid conversion from minus float (incl. -Inf). + c.assembler.CompileRegisterToRegister(amd64.TESTQ, result, result) + + var nonTrappingMinusJump asm.Node + if nonTrapping { + jmpIfNotMinusOrMinusInf := c.assembler.CompileJump(amd64.JPL) + // In non trapping case, the minus value is casted as zero. + // Zero out the result register by XOR itsself. + c.assembler.CompileRegisterToRegister(amd64.XORQ, result, result) + nonTrappingMinusJump = c.assembler.CompileJump(amd64.JMP) + c.assembler.SetJumpTargetOnNext(jmpIfNotMinusOrMinusInf) + } else { + c.compileMaybeExitFromNativeCode(amd64.JPL, nativeCallStatusIntegerOverflow) + } + + // Otherwise, the values is valid. + okJmpForLessThanMaxInt64PlusOne := c.assembler.CompileJump(amd64.JMP) + + // Now, start handling the case where the original float value is above or equal math.MaxInt64+1. + // + // First, we subtract the math.MaxInt64+1 from the original value so it can fit in signed 64-bit integer. + c.assembler.SetJumpTargetOnNext(jmpAboveOrEqualMaxIn32PlusOne) + if isFloat32Bit { + err = c.assembler.CompileStaticConstToRegister(amd64.SUBSS, c.float32ForMaximumSigned64bitIntPlusOne, source.register) + } else { + err = c.assembler.CompileStaticConstToRegister(amd64.SUBSD, c.float64ForMaximumSigned64bitIntPlusOne, source.register) + } + if err != nil { + return err + } + + // Then, convert the subtracted value as a signed 64-bit integer. + if isFloat32Bit { + c.assembler.CompileRegisterToRegister(amd64.CVTTSS2SQ, source.register, result) + } else { + c.assembler.CompileRegisterToRegister(amd64.CVTTSD2SQ, source.register, result) + } + + // next, we have to check if the value is from NaN, +Inf. + // NaN or +Inf cases result in 0x8000_0000 according to the semantics of conversion, + // This means we check if the result int value is minus or not. + c.assembler.CompileRegisterToRegister(amd64.TESTQ, result, result) + + // If the result is minus, the conversion is invalid (from NaN or +Inf) + var nonTrappingAboveOrEqualMaxInt64PlusOne asm.Node + if nonTrapping { + jmpIfNotPlusInf := c.assembler.CompileJump(amd64.JPL) + err = c.assembler.CompileStaticConstToRegister(amd64.MOVQ, c.maximum64BitUnsignedInt, result) + if err != nil { + return err + } + nonTrappingAboveOrEqualMaxInt64PlusOne = c.assembler.CompileJump(amd64.JMP) + c.assembler.SetJumpTargetOnNext(jmpIfNotPlusInf) + } else { + c.compileMaybeExitFromNativeCode(amd64.JPL, nativeCallStatusIntegerOverflow) + } + + // Otherwise, we successfully converted the the source float minus (math.MaxInt64+1) to int. + // So, we retrieve the original source float value by adding the sign mask. + if err = c.assembler.CompileStaticConstToRegister(amd64.ADDQ, c.float64SignBitMask, result); err != nil { + return err + } + + // We jump to the next instructions for valid cases. + c.assembler.SetJumpTargetOnNext(okJmpForLessThanMaxInt64PlusOne) + if nonTrapping { + c.assembler.SetJumpTargetOnNext(nonTrappingAboveOrEqualMaxInt64PlusOne) + c.assembler.SetJumpTargetOnNext(nonTrappingMinusJump) + c.assembler.SetJumpTargetOnNext(nonTrappingNaNJump) + } + + // We consumed the source's register and placed the conversion result + // in the result register. + c.locationStack.markRegisterUnused(source.register) + c.pushRuntimeValueLocationOnRegister(result, runtimeValueTypeI64) + return nil +} + +// emitSignedI32TruncFromFloat implements compileITruncFromF when the destination type is a 32-bit signed integer. +func (c *amd64Compiler) emitSignedI32TruncFromFloat(isFloat32Bit, nonTrapping bool) error { + source := c.locationStack.pop() + if err := c.compileEnsureOnRegister(source); err != nil { + return err + } + + result, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + // First we unconditionally convert source to integer via CVTTSS2SI (CVTTSD2SI for 64bit float). + if isFloat32Bit { + c.assembler.CompileRegisterToRegister(amd64.CVTTSS2SL, source.register, result) + } else { + c.assembler.CompileRegisterToRegister(amd64.CVTTSD2SL, source.register, result) + } + + // We compare the conversion result with the sign bit mask to check if it is either + // 1) the source float value is either +-Inf or NaN, or it exceeds representative ranges of 32bit signed integer, or + // 2) the source equals the minimum signed 32-bit (=-2147483648.000000) whose bit pattern is float32ForMinimumSigned32bitIntegerAddress for 32 bit float + // or float64ForMinimumSigned32bitIntegerAddress for 64bit float. + err = c.assembler.CompileStaticConstToRegister(amd64.CMPL, c.float32SignBitMask, result) + if err != nil { + return err + } + + // Otherwise, jump to exit as the result is valid. + okJmp := c.assembler.CompileJump(amd64.JNE) + + // Start handling the case of 1) and 2). + // First, check if the value is NaN. + if isFloat32Bit { + c.assembler.CompileRegisterToRegister(amd64.UCOMISS, source.register, source.register) + } else { + c.assembler.CompileRegisterToRegister(amd64.UCOMISD, source.register, source.register) + } + + // Check the parity flag (set when the value is NaN), and if it is set, we should raise an exception. + var nontrappingNanJump asm.Node + if nonTrapping { + jmpIfNotNaN := c.assembler.CompileJump(amd64.JPC) // jump if parity is not set. + // In non trapping case, NaN is casted as zero. + // Zero out the result register by XOR itsself. + c.assembler.CompileRegisterToRegister(amd64.XORL, result, result) + nontrappingNanJump = c.assembler.CompileJump(amd64.JMP) + c.assembler.SetJumpTargetOnNext(jmpIfNotNaN) + } else { + // If the value is NaN, we return the function with nativeCallStatusCodeInvalidFloatToIntConversion. + c.compileMaybeExitFromNativeCode(amd64.JPC, nativeCallStatusCodeInvalidFloatToIntConversion) + } + + // Check if the value is larger than or equal the minimum 32-bit integer value, + // meaning that the value exceeds the lower bound of 32-bit signed integer range. + if isFloat32Bit { + err = c.assembler.CompileStaticConstToRegister(amd64.UCOMISS, c.float32ForMinimumSigned32bitInteger, source.register) + } else { + err = c.assembler.CompileStaticConstToRegister(amd64.UCOMISD, c.float64ForMinimumSigned32bitInteger, source.register) + } + if err != nil { + return err + } + + if !nonTrapping { + // Trap if the value does not exceed the lower bound. + if isFloat32Bit { + c.compileMaybeExitFromNativeCode(amd64.JCC, nativeCallStatusIntegerOverflow) + } else { + c.compileMaybeExitFromNativeCode(amd64.JHI, nativeCallStatusIntegerOverflow) + } + + // At this point, the value is the minimum signed 32-bit int (=-2147483648.000000) or larger than 32-bit maximum. + // So, check if the value equals the minimum signed 32-bit int. + if isFloat32Bit { + err = c.assembler.CompileStaticConstToRegister(amd64.UCOMISS, c.fourZeros, source.register) + } else { + err = c.assembler.CompileStaticConstToRegister(amd64.UCOMISD, c.eightZeros, source.register) + } + if err != nil { + return err + } + + // Trap if the value is not minus (= the minimum signed 32-bit int). + c.compileMaybeExitFromNativeCode(amd64.JCS, nativeCallStatusIntegerOverflow) + + // We jump to the next instructions for valid cases. + c.assembler.SetJumpTargetOnNext(okJmp) + } else { + // Jump if the value does not exceed the lower bound. + var jmpIfNotExceedsLowerBound asm.Node + if isFloat32Bit { + jmpIfNotExceedsLowerBound = c.assembler.CompileJump(amd64.JCC) + } else { + jmpIfNotExceedsLowerBound = c.assembler.CompileJump(amd64.JHI) + } + + // If the value exceeds the lower bound, we "saturate" it to the minimum. + if err = c.assembler.CompileStaticConstToRegister(amd64.MOVL, c.minimum32BitSignedInt, result); err != nil { + return err + } + nonTrappingSaturatedMinimumJump := c.assembler.CompileJump(amd64.JMP) + + // Otherwise, the value is the minimum signed 32-bit int (=-2147483648.000000) or larger than 32-bit maximum. + c.assembler.SetJumpTargetOnNext(jmpIfNotExceedsLowerBound) + if isFloat32Bit { + err = c.assembler.CompileStaticConstToRegister(amd64.UCOMISS, c.fourZeros, source.register) + } else { + err = c.assembler.CompileStaticConstToRegister(amd64.UCOMISD, c.eightZeros, source.register) + } + if err != nil { + return err + } + jmpIfMinimumSignedInt := c.assembler.CompileJump(amd64.JCS) // jump if the value is minus (= the minimum signed 32-bit int). + + // If the value exceeds signed 32-bit maximum, we saturate it to the maximum. + if err = c.assembler.CompileStaticConstToRegister(amd64.MOVL, c.maximum32BitSignedInt, result); err != nil { + return err + } + + c.assembler.SetJumpTargetOnNext(okJmp) + c.assembler.SetJumpTargetOnNext(nontrappingNanJump) + c.assembler.SetJumpTargetOnNext(nonTrappingSaturatedMinimumJump) + c.assembler.SetJumpTargetOnNext(jmpIfMinimumSignedInt) + } + + // We consumed the source's register and placed the conversion result + // in the result register. + c.locationStack.markRegisterUnused(source.register) + c.pushRuntimeValueLocationOnRegister(result, runtimeValueTypeI32) + return nil +} + +// emitSignedI64TruncFromFloat implements compileITruncFromF when the destination type is a 64-bit signed integer. +func (c *amd64Compiler) emitSignedI64TruncFromFloat(isFloat32Bit, nonTrapping bool) error { + source := c.locationStack.pop() + if err := c.compileEnsureOnRegister(source); err != nil { + return err + } + + result, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + // First we unconditionally convert source to integer via CVTTSS2SI (CVTTSD2SI for 64bit float). + if isFloat32Bit { + c.assembler.CompileRegisterToRegister(amd64.CVTTSS2SQ, source.register, result) + } else { + c.assembler.CompileRegisterToRegister(amd64.CVTTSD2SQ, source.register, result) + } + + // We compare the conversion result with the sign bit mask to check if it is either + // 1) the source float value is either +-Inf or NaN, or it exceeds representative ranges of 32bit signed integer, or + // 2) the source equals the minimum signed 32-bit (=-9223372036854775808.0) whose bit pattern is float32ForMinimumSigned64bitIntegerAddress for 32 bit float + // or float64ForMinimumSigned64bitIntegerAddress for 64bit float. + err = c.assembler.CompileStaticConstToRegister(amd64.CMPQ, c.float64SignBitMask, result) + if err != nil { + return err + } + + // Otherwise, we simply jump to exit as the result is valid. + okJmp := c.assembler.CompileJump(amd64.JNE) + + // Start handling the case of 1) and 2). + // First, check if the value is NaN. + if isFloat32Bit { + c.assembler.CompileRegisterToRegister(amd64.UCOMISS, source.register, source.register) + } else { + c.assembler.CompileRegisterToRegister(amd64.UCOMISD, source.register, source.register) + } + + // Check the parity flag (set when the value is NaN), and if it is set, we should raise an exception. + var nontrappingNanJump asm.Node + if nonTrapping { + jmpIfNotNaN := c.assembler.CompileJump(amd64.JPC) // jump if parity is not set. + // In non trapping case, NaN is casted as zero. + // Zero out the result register by XOR itsself. + c.assembler.CompileRegisterToRegister(amd64.XORQ, result, result) + nontrappingNanJump = c.assembler.CompileJump(amd64.JMP) + c.assembler.SetJumpTargetOnNext(jmpIfNotNaN) + } else { + c.compileMaybeExitFromNativeCode(amd64.JPC, nativeCallStatusCodeInvalidFloatToIntConversion) + } + + // Check if the value is larger than or equal the minimum 64-bit integer value, + // meaning that the value exceeds the lower bound of 64-bit signed integer range. + if isFloat32Bit { + err = c.assembler.CompileStaticConstToRegister(amd64.UCOMISS, c.float32ForMinimumSigned64bitInteger, source.register) + } else { + err = c.assembler.CompileStaticConstToRegister(amd64.UCOMISD, c.float64ForMinimumSigned64bitInteger, source.register) + } + if err != nil { + return err + } + + if !nonTrapping { + // Jump if the value is -Inf. + c.compileMaybeExitFromNativeCode(amd64.JCC, nativeCallStatusIntegerOverflow) + + // At this point, the value is the minimum signed 64-bit int (=-9223372036854775808.0) or larger than 64-bit maximum. + // So, check if the value equals the minimum signed 64-bit int. + if isFloat32Bit { + err = c.assembler.CompileStaticConstToRegister(amd64.UCOMISS, c.fourZeros, source.register) + } else { + err = c.assembler.CompileStaticConstToRegister(amd64.UCOMISD, c.eightZeros, source.register) + } + if err != nil { + return err + } + + // Trap if the value is not minus (= the minimum signed 64-bit int). + c.compileMaybeExitFromNativeCode(amd64.JCS, nativeCallStatusIntegerOverflow) + + // We jump to the next instructions for valid cases. + c.assembler.SetJumpTargetOnNext(okJmp) + } else { + // Jump if the value is not -Inf. + jmpIfNotExceedsLowerBound := c.assembler.CompileJump(amd64.JCC) + + // If the value exceeds the lower bound, we "saturate" it to the minimum. + err = c.assembler.CompileStaticConstToRegister(amd64.MOVQ, c.minimum64BitSignedInt, result) + if err != nil { + return err + } + + nonTrappingSaturatedMinimumJump := c.assembler.CompileJump(amd64.JMP) + + // Otherwise, the value is the minimum signed 64-bit int (=-9223372036854775808.0) or larger than 64-bit maximum. + // So, check if the value equals the minimum signed 64-bit int. + c.assembler.SetJumpTargetOnNext(jmpIfNotExceedsLowerBound) + if isFloat32Bit { + err = c.assembler.CompileStaticConstToRegister(amd64.UCOMISS, c.fourZeros, source.register) + } else { + err = c.assembler.CompileStaticConstToRegister(amd64.UCOMISD, c.eightZeros, source.register) + } + if err != nil { + return err + } + + jmpIfMinimumSignedInt := c.assembler.CompileJump(amd64.JCS) // jump if the value is minus (= the minimum signed 64-bit int). + + // If the value exceeds signed 64-bit maximum, we saturate it to the maximum. + if err = c.assembler.CompileStaticConstToRegister(amd64.MOVQ, c.maximum64BitSignedInt, result); err != nil { + return err + } + + c.assembler.SetJumpTargetOnNext(okJmp) + c.assembler.SetJumpTargetOnNext(jmpIfMinimumSignedInt) + c.assembler.SetJumpTargetOnNext(nonTrappingSaturatedMinimumJump) + c.assembler.SetJumpTargetOnNext(nontrappingNanJump) + } + + // We consumed the source's register and placed the conversion result + // in the result register. + c.locationStack.markRegisterUnused(source.register) + c.pushRuntimeValueLocationOnRegister(result, runtimeValueTypeI64) + return nil +} + +// compileFConvertFromI implements compiler.compileFConvertFromI for the amd64 architecture. +func (c *amd64Compiler) compileFConvertFromI(o *wazeroir.UnionOperation) (err error) { + inputType := wazeroir.SignedInt(o.B1) + outputType := wazeroir.Float(o.B2) + if outputType == wazeroir.Float32 && inputType == wazeroir.SignedInt32 { + err = c.compileSimpleConversion(amd64.CVTSL2SS, registerTypeVector, runtimeValueTypeF32) // = CVTSI2SS for 32bit int + } else if outputType == wazeroir.Float32 && inputType == wazeroir.SignedInt64 { + err = c.compileSimpleConversion(amd64.CVTSQ2SS, registerTypeVector, runtimeValueTypeF32) // = CVTSI2SS for 64bit int + } else if outputType == wazeroir.Float64 && inputType == wazeroir.SignedInt32 { + err = c.compileSimpleConversion(amd64.CVTSL2SD, registerTypeVector, runtimeValueTypeF64) // = CVTSI2SD for 32bit int + } else if outputType == wazeroir.Float64 && inputType == wazeroir.SignedInt64 { + err = c.compileSimpleConversion(amd64.CVTSQ2SD, registerTypeVector, runtimeValueTypeF64) // = CVTSI2SD for 64bit int + } else if outputType == wazeroir.Float32 && inputType == wazeroir.SignedUint32 { + // See the following link for why we use 64bit conversion for unsigned 32bit integer sources: + // https://stackoverflow.com/questions/41495498/fpu-operations-generated-by-gcc-during-casting-integer-to-float. + // + // Here's the summary: + // >> CVTSI2SS is indeed designed for converting a signed integer to a scalar single-precision float, + // >> not an unsigned integer like you have here. So what gives? Well, a 64-bit processor has 64-bit wide + // >> registers available, so the unsigned 32-bit input values can be stored as signed 64-bit intermediate values, + // >> which allows CVTSI2SS to be used after all. + err = c.compileSimpleConversion(amd64.CVTSQ2SS, registerTypeVector, runtimeValueTypeF32) // = CVTSI2SS for 64bit int. + } else if outputType == wazeroir.Float64 && inputType == wazeroir.SignedUint32 { + // For the same reason above, we use 64bit conversion for unsigned 32bit. + err = c.compileSimpleConversion(amd64.CVTSQ2SD, registerTypeVector, runtimeValueTypeF64) // = CVTSI2SD for 64bit int. + } else if outputType == wazeroir.Float32 && inputType == wazeroir.SignedUint64 { + err = c.emitUnsignedInt64ToFloatConversion(true) + } else if outputType == wazeroir.Float64 && inputType == wazeroir.SignedUint64 { + err = c.emitUnsignedInt64ToFloatConversion(false) + } + return +} + +// emitUnsignedInt64ToFloatConversion is handling the case of unsigned 64-bit integer +// in compileFConvertFromI. +func (c *amd64Compiler) emitUnsignedInt64ToFloatConversion(isFloat32bit bool) error { + // The logic here is exactly the same as GCC emits for the following code: + // + // float convert(int num) { + // float foo; + // uint64_t ptr1 = 100; + // foo = (float)(ptr1); + // return foo; + // } + // + // which is compiled by GCC as + // + // convert: + // push rbp + // mov rbp, rsp + // mov DWORD PTR [rbp-20], edi + // mov DWORD PTR [rbp-4], 100 + // mov eax, DWORD PTR [rbp-4] + // test rax, rax + // js .handle_sign_bit_case + // cvtsi2ss xmm0, rax + // jmp .exit + // .handle_sign_bit_case: + // mov rdx, rax + // shr rdx + // and eax, 1 + // or rdx, rax + // cvtsi2ss xmm0, rdx + // addsd xmm0, xmm0 + // .exit: ... + // + // tl;dr is that we have a branch depending on whether or not sign bit is set. + + origin := c.locationStack.pop() + if err := c.compileEnsureOnRegister(origin); err != nil { + return err + } + + dest, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + c.locationStack.markRegisterUsed(dest) + + tmpReg, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + // Check if the most significant bit (sign bit) is set. + c.assembler.CompileRegisterToRegister(amd64.TESTQ, origin.register, origin.register) + + // Jump if the sign bit is set. + jmpIfSignbitSet := c.assembler.CompileJump(amd64.JMI) + + // Otherwise, we could fit the unsigned int into float32. + // So, we convert it to float32 and emit jump instruction to exit from this branch. + if isFloat32bit { + c.assembler.CompileRegisterToRegister(amd64.CVTSQ2SS, origin.register, dest) + } else { + c.assembler.CompileRegisterToRegister(amd64.CVTSQ2SD, origin.register, dest) + } + exitFromSignbitUnSet := c.assembler.CompileJump(amd64.JMP) + + // Now handling the case where sign-bit is set. + // We emit the following sequences: + // mov tmpReg, origin + // shr tmpReg, 1 + // and origin, 1 + // or tmpReg, origin + // cvtsi2ss xmm0, tmpReg + // addsd xmm0, xmm0 + + c.assembler.SetJumpTargetOnNext(jmpIfSignbitSet) + c.assembler.CompileRegisterToRegister(amd64.MOVQ, origin.register, tmpReg) + c.assembler.CompileConstToRegister(amd64.SHRQ, 1, tmpReg) + c.assembler.CompileConstToRegister(amd64.ANDQ, 1, origin.register) + c.assembler.CompileRegisterToRegister(amd64.ORQ, origin.register, tmpReg) + if isFloat32bit { + c.assembler.CompileRegisterToRegister(amd64.CVTSQ2SS, tmpReg, dest) + } else { + c.assembler.CompileRegisterToRegister(amd64.CVTSQ2SD, tmpReg, dest) + } + if isFloat32bit { + c.assembler.CompileRegisterToRegister(amd64.ADDSS, dest, dest) + } else { + c.assembler.CompileRegisterToRegister(amd64.ADDSD, dest, dest) + } + + // Now, we finished the sign-bit set branch. + // We have to make the exit jump target of sign-bit unset branch + // towards the next instruction. + c.assembler.SetJumpTargetOnNext(exitFromSignbitUnSet) + + // We consumed the origin's register and placed the conversion result + // in the dest register. + c.locationStack.markRegisterUnused(origin.register) + if isFloat32bit { + c.pushRuntimeValueLocationOnRegister(dest, runtimeValueTypeF32) + } else { + c.pushRuntimeValueLocationOnRegister(dest, runtimeValueTypeF64) + } + return nil +} + +// compileSimpleConversion pops a value type from the stack, and applies the +// given instruction on it, and push the result onto a register of the given type. +func (c *amd64Compiler) compileSimpleConversion(convInstruction asm.Instruction, + destinationRegisterType registerType, destinationValueType runtimeValueType, +) error { + origin := c.locationStack.pop() + if err := c.compileEnsureOnRegister(origin); err != nil { + return err + } + + dest, err := c.allocateRegister(destinationRegisterType) + if err != nil { + return err + } + + c.assembler.CompileRegisterToRegister(convInstruction, origin.register, dest) + + c.locationStack.markRegisterUnused(origin.register) + c.pushRuntimeValueLocationOnRegister(dest, destinationValueType) + return nil +} + +// compileF32DemoteFromF64 implements compiler.compileF32DemoteFromF64 for the amd64 architecture. +func (c *amd64Compiler) compileF32DemoteFromF64() error { + target := c.locationStack.peek() // Note this is peek! + if err := c.compileEnsureOnRegister(target); err != nil { + return err + } + + c.assembler.CompileRegisterToRegister(amd64.CVTSD2SS, target.register, target.register) + target.valueType = runtimeValueTypeF32 + return nil +} + +// compileF64PromoteFromF32 implements compiler.compileF64PromoteFromF32 for the amd64 architecture. +func (c *amd64Compiler) compileF64PromoteFromF32() error { + target := c.locationStack.peek() // Note this is peek! + if err := c.compileEnsureOnRegister(target); err != nil { + return err + } + + c.assembler.CompileRegisterToRegister(amd64.CVTSS2SD, target.register, target.register) + target.valueType = runtimeValueTypeF64 + return nil +} + +// compileI32ReinterpretFromF32 implements compiler.compileI32ReinterpretFromF32 for the amd64 architecture. +func (c *amd64Compiler) compileI32ReinterpretFromF32() error { + if peek := c.locationStack.peek(); peek.onStack() { + // If the value is on the stack, this is no-op as there is nothing to do for converting type. + peek.valueType = runtimeValueTypeI32 + return nil + } + return c.compileSimpleConversion(amd64.MOVL, registerTypeGeneralPurpose, runtimeValueTypeI32) +} + +// compileI64ReinterpretFromF64 implements compiler.compileI64ReinterpretFromF64 for the amd64 architecture. +func (c *amd64Compiler) compileI64ReinterpretFromF64() error { + if peek := c.locationStack.peek(); peek.onStack() { + // If the value is on the stack, this is no-op as there is nothing to do for converting type. + peek.valueType = runtimeValueTypeI64 + return nil + } + return c.compileSimpleConversion(amd64.MOVQ, registerTypeGeneralPurpose, runtimeValueTypeI64) +} + +// compileF32ReinterpretFromI32 implements compiler.compileF32ReinterpretFromI32 for the amd64 architecture. +func (c *amd64Compiler) compileF32ReinterpretFromI32() error { + if peek := c.locationStack.peek(); peek.onStack() { + // If the value is on the stack, this is no-op as there is nothing to do for converting type. + peek.valueType = runtimeValueTypeF32 + return nil + } + return c.compileSimpleConversion(amd64.MOVL, registerTypeVector, runtimeValueTypeF32) +} + +// compileF64ReinterpretFromI64 implements compiler.compileF64ReinterpretFromI64 for the amd64 architecture. +func (c *amd64Compiler) compileF64ReinterpretFromI64() error { + if peek := c.locationStack.peek(); peek.onStack() { + // If the value is on the stack, this is no-op as there is nothing to do for converting type. + peek.valueType = runtimeValueTypeF64 + return nil + } + return c.compileSimpleConversion(amd64.MOVQ, registerTypeVector, runtimeValueTypeF64) +} + +// compileExtend implements compiler.compileExtend for the amd64 architecture. +func (c *amd64Compiler) compileExtend(o *wazeroir.UnionOperation) error { + var inst asm.Instruction + signed := o.B1 != 0 + if signed { + inst = amd64.MOVLQSX // = MOVSXD https://www.felixcloutier.com/x86/movsx:movsxd + } else { + inst = amd64.MOVL + } + return c.compileExtendImpl(inst, runtimeValueTypeI64) +} + +// compileSignExtend32From8 implements compiler.compileSignExtend32From8 for the amd64 architecture. +func (c *amd64Compiler) compileSignExtend32From8() error { + return c.compileExtendImpl(amd64.MOVBLSX, runtimeValueTypeI32) +} + +// compileSignExtend32From16 implements compiler.compileSignExtend32From16 for the amd64 architecture. +func (c *amd64Compiler) compileSignExtend32From16() error { + return c.compileExtendImpl(amd64.MOVWLSX, runtimeValueTypeI32) +} + +// compileSignExtend64From8 implements compiler.compileSignExtend64From8 for the amd64 architecture. +func (c *amd64Compiler) compileSignExtend64From8() error { + return c.compileExtendImpl(amd64.MOVBQSX, runtimeValueTypeI64) +} + +// compileSignExtend64From16 implements compiler.compileSignExtend64From16 for the amd64 architecture. +func (c *amd64Compiler) compileSignExtend64From16() error { + return c.compileExtendImpl(amd64.MOVWQSX, runtimeValueTypeI64) +} + +// compileSignExtend64From32 implements compiler.compileSignExtend64From32 for the amd64 architecture. +func (c *amd64Compiler) compileSignExtend64From32() error { + return c.compileExtendImpl(amd64.MOVLQSX, runtimeValueTypeI64) +} + +func (c *amd64Compiler) compileExtendImpl(inst asm.Instruction, destinationType runtimeValueType) error { + target := c.locationStack.peek() // Note this is peek! + if err := c.compileEnsureOnRegister(target); err != nil { + return err + } + + c.assembler.CompileRegisterToRegister(inst, target.register, target.register) + target.valueType = destinationType + return nil +} + +// compileEq implements compiler.compileEq for the amd64 architecture. +func (c *amd64Compiler) compileEq(o *wazeroir.UnionOperation) error { + return c.compileEqOrNe(wazeroir.UnsignedType(o.B1), true) +} + +// compileNe implements compiler.compileNe for the amd64 architecture. +func (c *amd64Compiler) compileNe(o *wazeroir.UnionOperation) error { + return c.compileEqOrNe(wazeroir.UnsignedType(o.B1), false) +} + +func (c *amd64Compiler) compileEqOrNe(t wazeroir.UnsignedType, shouldEqual bool) (err error) { + x2 := c.locationStack.pop() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.pop() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + x1r, x2r := x1.register, x2.register + + // x1 and x2 are temporary registers only used for the cmp operation. Release them. + c.locationStack.releaseRegister(x1) + c.locationStack.releaseRegister(x2) + + switch t { + case wazeroir.UnsignedTypeI32: + err = c.compileEqOrNeForInts(x1r, x2r, amd64.CMPL, shouldEqual) + case wazeroir.UnsignedTypeI64: + err = c.compileEqOrNeForInts(x1r, x2r, amd64.CMPQ, shouldEqual) + case wazeroir.UnsignedTypeF32: + err = c.compileEqOrNeForFloats(x1r, x2r, amd64.UCOMISS, shouldEqual) + case wazeroir.UnsignedTypeF64: + err = c.compileEqOrNeForFloats(x1r, x2r, amd64.UCOMISD, shouldEqual) + } + if err != nil { + return + } + return +} + +func (c *amd64Compiler) compileEqOrNeForInts(x1Reg, x2Reg asm.Register, cmpInstruction asm.Instruction, + shouldEqual bool, +) error { + c.assembler.CompileRegisterToRegister(cmpInstruction, x2Reg, x1Reg) + + // Record that the result is on the conditional register. + var condReg asm.ConditionalRegisterState + if shouldEqual { + condReg = amd64.ConditionalRegisterStateE + } else { + condReg = amd64.ConditionalRegisterStateNE + } + loc := c.locationStack.pushRuntimeValueLocationOnConditionalRegister(condReg) + loc.valueType = runtimeValueTypeI32 + return nil +} + +// For float EQ and NE, we have to take NaN values into account. +// Notably, Wasm specification states that if one of targets is NaN, +// the result must be zero for EQ or one for NE. +func (c *amd64Compiler) compileEqOrNeForFloats(x1Reg, x2Reg asm.Register, cmpInstruction asm.Instruction, shouldEqual bool) error { + // Before we allocate the result, we have to reserve two int registers. + nanFragReg, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.locationStack.markRegisterUsed(nanFragReg) + cmpResultReg, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + // Then, execute the comparison. + c.assembler.CompileRegisterToRegister(cmpInstruction, x2Reg, x1Reg) + + // First, we get the parity flag which indicates whether one of values was NaN. + if shouldEqual { + // Set 1 if two values are NOT NaN. + c.assembler.CompileNoneToRegister(amd64.SETPC, nanFragReg) + } else { + // Set 1 if one of values is NaN. + c.assembler.CompileNoneToRegister(amd64.SETPS, nanFragReg) + } + + // next, we get the usual comparison flag. + if shouldEqual { + // Set 1 if equal. + c.assembler.CompileNoneToRegister(amd64.SETEQ, cmpResultReg) + } else { + // Set 1 if not equal. + c.assembler.CompileNoneToRegister(amd64.SETNE, cmpResultReg) + } + + // Do "and" or "or" operations on these two flags to get the actual result. + if shouldEqual { + c.assembler.CompileRegisterToRegister(amd64.ANDL, nanFragReg, cmpResultReg) + } else { + c.assembler.CompileRegisterToRegister(amd64.ORL, nanFragReg, cmpResultReg) + } + + // Clear the unnecessary bits by zero extending the first byte. + // This is necessary the upper bits (5 to 32 bits) of SET* instruction result is undefined. + c.assembler.CompileRegisterToRegister(amd64.MOVBLZX, cmpResultReg, cmpResultReg) + + // Now we have the result in cmpResultReg register, so we record it. + c.pushRuntimeValueLocationOnRegister(cmpResultReg, runtimeValueTypeI32) + // Also, we no longer need nanFragRegister. + c.locationStack.markRegisterUnused(nanFragReg) + return nil +} + +// compileEqz implements compiler.compileEqz for the amd64 architecture. +func (c *amd64Compiler) compileEqz(o *wazeroir.UnionOperation) (err error) { + v := c.locationStack.pop() + if err = c.compileEnsureOnRegister(v); err != nil { + return err + } + + unsignedInt := wazeroir.UnsignedInt(o.B1) + switch unsignedInt { + case wazeroir.UnsignedInt32: + err = c.assembler.CompileStaticConstToRegister(amd64.CMPL, c.fourZeros, v.register) + case wazeroir.UnsignedInt64: + err = c.assembler.CompileStaticConstToRegister(amd64.CMPQ, c.eightZeros, v.register) + } + if err != nil { + return err + } + + // v is consumed by the cmp operation so release it. + c.locationStack.releaseRegister(v) + + // Finally, record that the result is on the conditional register. + loc := c.locationStack.pushRuntimeValueLocationOnConditionalRegister(amd64.ConditionalRegisterStateE) + loc.valueType = runtimeValueTypeI32 + return nil +} + +// compileLt implements compiler.compileLt for the amd64 architecture. +func (c *amd64Compiler) compileLt(o *wazeroir.UnionOperation) error { + x2 := c.locationStack.pop() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.pop() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + // Emit the compare instruction. + var resultConditionState asm.ConditionalRegisterState + var inst asm.Instruction + signedType := wazeroir.SignedType(o.B1) + switch signedType { + case wazeroir.SignedTypeInt32: + resultConditionState = amd64.ConditionalRegisterStateL + inst = amd64.CMPL + case wazeroir.SignedTypeUint32: + resultConditionState = amd64.ConditionalRegisterStateB + inst = amd64.CMPL + case wazeroir.SignedTypeInt64: + inst = amd64.CMPQ + resultConditionState = amd64.ConditionalRegisterStateL + case wazeroir.SignedTypeUint64: + resultConditionState = amd64.ConditionalRegisterStateB + inst = amd64.CMPQ + case wazeroir.SignedTypeFloat32: + resultConditionState = amd64.ConditionalRegisterStateA + inst = amd64.COMISS + case wazeroir.SignedTypeFloat64: + resultConditionState = amd64.ConditionalRegisterStateA + inst = amd64.COMISD + } + c.assembler.CompileRegisterToRegister(inst, x1.register, x2.register) + + // x1 and x2 are temporary registers only used for the cmp operation. Release them. + c.locationStack.releaseRegister(x1) + c.locationStack.releaseRegister(x2) + + // Finally, record that the result is on the conditional register. + loc := c.locationStack.pushRuntimeValueLocationOnConditionalRegister(resultConditionState) + loc.valueType = runtimeValueTypeI32 + return nil +} + +// compileGt implements compiler.compileGt for the amd64 architecture. +func (c *amd64Compiler) compileGt(o *wazeroir.UnionOperation) error { + x2 := c.locationStack.pop() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.pop() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + // Emit the compare instruction. + var resultConditionState asm.ConditionalRegisterState + signedType := wazeroir.SignedType(o.B1) + switch signedType { + case wazeroir.SignedTypeInt32: + resultConditionState = amd64.ConditionalRegisterStateG + c.assembler.CompileRegisterToRegister(amd64.CMPL, x1.register, x2.register) + case wazeroir.SignedTypeUint32: + c.assembler.CompileRegisterToRegister(amd64.CMPL, x1.register, x2.register) + resultConditionState = amd64.ConditionalRegisterStateA + case wazeroir.SignedTypeInt64: + c.assembler.CompileRegisterToRegister(amd64.CMPQ, x1.register, x2.register) + resultConditionState = amd64.ConditionalRegisterStateG + case wazeroir.SignedTypeUint64: + c.assembler.CompileRegisterToRegister(amd64.CMPQ, x1.register, x2.register) + resultConditionState = amd64.ConditionalRegisterStateA + case wazeroir.SignedTypeFloat32: + c.assembler.CompileRegisterToRegister(amd64.UCOMISS, x2.register, x1.register) + resultConditionState = amd64.ConditionalRegisterStateA + case wazeroir.SignedTypeFloat64: + c.assembler.CompileRegisterToRegister(amd64.UCOMISD, x2.register, x1.register) + resultConditionState = amd64.ConditionalRegisterStateA + } + + // x1 and x2 are temporary registers only used for the cmp operation. Release them. + c.locationStack.releaseRegister(x1) + c.locationStack.releaseRegister(x2) + + // Finally, record that the result is on the conditional register. + loc := c.locationStack.pushRuntimeValueLocationOnConditionalRegister(resultConditionState) + loc.valueType = runtimeValueTypeI32 + return nil +} + +// compileLe implements compiler.compileLe for the amd64 architecture. +func (c *amd64Compiler) compileLe(o *wazeroir.UnionOperation) error { + x2 := c.locationStack.pop() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.pop() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + // Emit the compare instruction. + var inst asm.Instruction + var resultConditionState asm.ConditionalRegisterState + signedType := wazeroir.SignedType(o.B1) + switch signedType { + case wazeroir.SignedTypeInt32: + resultConditionState = amd64.ConditionalRegisterStateLE + inst = amd64.CMPL + case wazeroir.SignedTypeUint32: + resultConditionState = amd64.ConditionalRegisterStateBE + inst = amd64.CMPL + case wazeroir.SignedTypeInt64: + resultConditionState = amd64.ConditionalRegisterStateLE + inst = amd64.CMPQ + case wazeroir.SignedTypeUint64: + resultConditionState = amd64.ConditionalRegisterStateBE + inst = amd64.CMPQ + case wazeroir.SignedTypeFloat32: + resultConditionState = amd64.ConditionalRegisterStateAE + inst = amd64.UCOMISS + case wazeroir.SignedTypeFloat64: + resultConditionState = amd64.ConditionalRegisterStateAE + inst = amd64.UCOMISD + } + c.assembler.CompileRegisterToRegister(inst, x1.register, x2.register) + + // x1 and x2 are temporary registers only used for the cmp operation. Release them. + c.locationStack.releaseRegister(x1) + c.locationStack.releaseRegister(x2) + + // Finally, record that the result is on the conditional register. + loc := c.locationStack.pushRuntimeValueLocationOnConditionalRegister(resultConditionState) + loc.valueType = runtimeValueTypeI32 + return nil +} + +// compileGe implements compiler.compileGe for the amd64 architecture. +func (c *amd64Compiler) compileGe(o *wazeroir.UnionOperation) error { + x2 := c.locationStack.pop() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.pop() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + // Emit the compare instruction. + var resultConditionState asm.ConditionalRegisterState + signedType := wazeroir.SignedType(o.B1) + switch signedType { + case wazeroir.SignedTypeInt32: + c.assembler.CompileRegisterToRegister(amd64.CMPL, x1.register, x2.register) + resultConditionState = amd64.ConditionalRegisterStateGE + case wazeroir.SignedTypeUint32: + c.assembler.CompileRegisterToRegister(amd64.CMPL, x1.register, x2.register) + resultConditionState = amd64.ConditionalRegisterStateAE + case wazeroir.SignedTypeInt64: + c.assembler.CompileRegisterToRegister(amd64.CMPQ, x1.register, x2.register) + resultConditionState = amd64.ConditionalRegisterStateGE + case wazeroir.SignedTypeUint64: + c.assembler.CompileRegisterToRegister(amd64.CMPQ, x1.register, x2.register) + resultConditionState = amd64.ConditionalRegisterStateAE + case wazeroir.SignedTypeFloat32: + c.assembler.CompileRegisterToRegister(amd64.COMISS, x2.register, x1.register) + resultConditionState = amd64.ConditionalRegisterStateAE + case wazeroir.SignedTypeFloat64: + c.assembler.CompileRegisterToRegister(amd64.COMISD, x2.register, x1.register) + resultConditionState = amd64.ConditionalRegisterStateAE + } + + // x1 and x2 are temporary registers only used for the cmp operation. Release them. + c.locationStack.releaseRegister(x1) + c.locationStack.releaseRegister(x2) + + // Finally, record that the result is on the conditional register. + loc := c.locationStack.pushRuntimeValueLocationOnConditionalRegister(resultConditionState) + loc.valueType = runtimeValueTypeI32 + return nil +} + +// compileLoad implements compiler.compileLoad for the amd64 architecture. +func (c *amd64Compiler) compileLoad(o *wazeroir.UnionOperation) error { + var ( + isIntType bool + movInst asm.Instruction + targetSizeInBytes int64 + vt runtimeValueType + ) + + unsignedType := wazeroir.UnsignedType(o.B1) + offset := uint32(o.U2) + + switch unsignedType { + case wazeroir.UnsignedTypeI32: + isIntType = true + movInst = amd64.MOVL + targetSizeInBytes = 32 / 8 + vt = runtimeValueTypeI32 + case wazeroir.UnsignedTypeI64: + isIntType = true + movInst = amd64.MOVQ + targetSizeInBytes = 64 / 8 + vt = runtimeValueTypeI64 + case wazeroir.UnsignedTypeF32: + isIntType = false + movInst = amd64.MOVL + targetSizeInBytes = 32 / 8 + vt = runtimeValueTypeF32 + case wazeroir.UnsignedTypeF64: + isIntType = false + movInst = amd64.MOVQ + targetSizeInBytes = 64 / 8 + vt = runtimeValueTypeF64 + } + + reg, err := c.compileMemoryAccessCeilSetup(offset, targetSizeInBytes) + if err != nil { + return err + } + + if isIntType { + // For integer types, read the corresponding bytes from the offset to the memory + // and store the value to the int register. + c.assembler.CompileMemoryWithIndexToRegister(movInst, + // we access memory as memory.Buffer[ceil-targetSizeInBytes: ceil]. + amd64ReservedRegisterForMemory, -targetSizeInBytes, reg, 1, + reg) + c.pushRuntimeValueLocationOnRegister(reg, vt) + } else { + // For float types, we read the value to the float register. + floatReg, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + c.assembler.CompileMemoryWithIndexToRegister(movInst, + // we access memory as memory.Buffer[ceil-targetSizeInBytes: ceil]. + amd64ReservedRegisterForMemory, -targetSizeInBytes, reg, 1, + floatReg) + c.pushRuntimeValueLocationOnRegister(floatReg, vt) + // We no longer need the int register so mark it unused. + c.locationStack.markRegisterUnused(reg) + } + return nil +} + +// compileLoad8 implements compiler.compileLoad8 for the amd64 architecture. +func (c *amd64Compiler) compileLoad8(o *wazeroir.UnionOperation) error { + const targetSizeInBytes = 1 + offset := uint32(o.U2) + reg, err := c.compileMemoryAccessCeilSetup(offset, targetSizeInBytes) + if err != nil { + return err + } + + // Then move a byte at the offset to the register. + // Note that Load8 is only for integer types. + var inst asm.Instruction + var vt runtimeValueType + signedInt := wazeroir.SignedInt(o.B1) + switch signedInt { + case wazeroir.SignedInt32: + inst = amd64.MOVBLSX + vt = runtimeValueTypeI32 + case wazeroir.SignedUint32: + inst = amd64.MOVBLZX + vt = runtimeValueTypeI32 + case wazeroir.SignedInt64: + inst = amd64.MOVBQSX + vt = runtimeValueTypeI64 + case wazeroir.SignedUint64: + inst = amd64.MOVBQZX + vt = runtimeValueTypeI64 + } + + c.assembler.CompileMemoryWithIndexToRegister(inst, + // we access memory as memory.Buffer[ceil-targetSizeInBytes: ceil]. + amd64ReservedRegisterForMemory, -targetSizeInBytes, reg, 1, + reg) + + c.pushRuntimeValueLocationOnRegister(reg, vt) + return nil +} + +// compileLoad16 implements compiler.compileLoad16 for the amd64 architecture. +func (c *amd64Compiler) compileLoad16(o *wazeroir.UnionOperation) error { + const targetSizeInBytes = 16 / 8 + offset := uint32(o.U2) + reg, err := c.compileMemoryAccessCeilSetup(offset, targetSizeInBytes) + if err != nil { + return err + } + + // Then move 2 bytes at the offset to the register. + // Note that Load16 is only for integer types. + var inst asm.Instruction + var vt runtimeValueType + signedInt := wazeroir.SignedInt(o.B1) + switch signedInt { + case wazeroir.SignedInt32: + inst = amd64.MOVWLSX + vt = runtimeValueTypeI32 + case wazeroir.SignedInt64: + inst = amd64.MOVWQSX + vt = runtimeValueTypeI64 + case wazeroir.SignedUint32: + inst = amd64.MOVWLZX + vt = runtimeValueTypeI32 + case wazeroir.SignedUint64: + inst = amd64.MOVWQZX + vt = runtimeValueTypeI64 + } + + c.assembler.CompileMemoryWithIndexToRegister(inst, + // we access memory as memory.Buffer[ceil-targetSizeInBytes: ceil]. + amd64ReservedRegisterForMemory, -targetSizeInBytes, reg, 1, + reg) + + c.pushRuntimeValueLocationOnRegister(reg, vt) + return nil +} + +// compileLoad32 implements compiler.compileLoad32 for the amd64 architecture. +func (c *amd64Compiler) compileLoad32(o *wazeroir.UnionOperation) error { + const targetSizeInBytes = 32 / 8 + offset := uint32(o.U2) + reg, err := c.compileMemoryAccessCeilSetup(offset, targetSizeInBytes) + if err != nil { + return err + } + + // Then move 4 bytes at the offset to the register. + var inst asm.Instruction + signed := o.B1 == 1 + if signed { + inst = amd64.MOVLQSX + } else { + inst = amd64.MOVLQZX + } + c.assembler.CompileMemoryWithIndexToRegister(inst, + // We access memory as memory.Buffer[ceil-targetSizeInBytes: ceil]. + amd64ReservedRegisterForMemory, -targetSizeInBytes, reg, 1, + reg) + c.pushRuntimeValueLocationOnRegister(reg, runtimeValueTypeI64) + return nil +} + +// compileMemoryAccessCeilSetup pops the top value from the stack (called "base"), stores "base + offsetArg + targetSizeInBytes" +// into a register, and returns the stored register. We call the result "ceil" because we access the memory +// as memory.Buffer[ceil-targetSizeInBytes: ceil]. +// +// Note: this also emits the instructions to check the out-of-bounds memory access. +// In other words, if the ceil exceeds the memory size, the code exits with nativeCallStatusCodeMemoryOutOfBounds status. +func (c *amd64Compiler) compileMemoryAccessCeilSetup(offsetArg uint32, targetSizeInBytes int64) (asm.Register, error) { + base := c.locationStack.pop() + if err := c.compileEnsureOnRegister(base); err != nil { + return asm.NilRegister, err + } + + result := base.register + if offsetConst := int64(offsetArg) + targetSizeInBytes; offsetConst <= math.MaxInt32 { + c.assembler.CompileConstToRegister(amd64.ADDQ, offsetConst, result) + } else if offsetConst <= math.MaxUint32 { + // Note: in practice, this branch rarely happens as in this case, the wasm binary know that + // memory has more than 1 GBi or at least tries to access above 1 GBi memory region. + // + // This case, we cannot directly add the offset to a register by ADDQ(const) instruction. + // That is because the imm32 const is sign-extended to 64-bit in ADDQ(const), and we end up + // making offsetConst as the negative number, which is wrong. + tmp, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return asm.NilRegister, err + } + c.assembler.CompileConstToRegister(amd64.MOVL, int64(uint32(offsetConst)), tmp) + c.assembler.CompileRegisterToRegister(amd64.ADDQ, tmp, result) + } else { + // If the offset const is too large, we exit with nativeCallStatusCodeMemoryOutOfBounds. + c.compileExitFromNativeCode(nativeCallStatusCodeMemoryOutOfBounds) + return result, nil + } + + // Now we compare the value with the memory length which is held by callEngine. + c.assembler.CompileMemoryToRegister(amd64.CMPQ, + amd64ReservedRegisterForCallEngine, callEngineModuleContextMemorySliceLenOffset, result) + + // Trap if the value is out-of-bounds of memory length. + c.compileMaybeExitFromNativeCode(amd64.JCC, nativeCallStatusCodeMemoryOutOfBounds) + + c.locationStack.markRegisterUnused(result) + return result, nil +} + +// compileStore implements compiler.compileStore for the amd64 architecture. +func (c *amd64Compiler) compileStore(o *wazeroir.UnionOperation) error { + var movInst asm.Instruction + var targetSizeInByte int64 + unsignedType := wazeroir.UnsignedType(o.B1) + offset := uint32(o.U2) + switch unsignedType { + case wazeroir.UnsignedTypeI32, wazeroir.UnsignedTypeF32: + movInst = amd64.MOVL + targetSizeInByte = 32 / 8 + case wazeroir.UnsignedTypeI64, wazeroir.UnsignedTypeF64: + movInst = amd64.MOVQ + targetSizeInByte = 64 / 8 + } + return c.compileStoreImpl(offset, movInst, targetSizeInByte) +} + +// compileStore8 implements compiler.compileStore8 for the amd64 architecture. +func (c *amd64Compiler) compileStore8(o *wazeroir.UnionOperation) error { + return c.compileStoreImpl(uint32(o.U2), amd64.MOVB, 1) +} + +// compileStore32 implements compiler.compileStore32 for the amd64 architecture. +func (c *amd64Compiler) compileStore16(o *wazeroir.UnionOperation) error { + return c.compileStoreImpl(uint32(o.U2), amd64.MOVW, 16/8) +} + +// compileStore32 implements compiler.compileStore32 for the amd64 architecture. +func (c *amd64Compiler) compileStore32(o *wazeroir.UnionOperation) error { + return c.compileStoreImpl(uint32(o.U2), amd64.MOVL, 32/8) +} + +func (c *amd64Compiler) compileStoreImpl(offsetConst uint32, inst asm.Instruction, targetSizeInBytes int64) error { + val := c.locationStack.pop() + if err := c.compileEnsureOnRegister(val); err != nil { + return err + } + + reg, err := c.compileMemoryAccessCeilSetup(offsetConst, targetSizeInBytes) + if err != nil { + return err + } + + c.assembler.CompileRegisterToMemoryWithIndex( + inst, val.register, + amd64ReservedRegisterForMemory, -targetSizeInBytes, reg, 1, + ) + + // We no longer need both the value and base registers. + c.locationStack.releaseRegister(val) + c.locationStack.markRegisterUnused(reg) + return nil +} + +// compileMemoryGrow implements compiler.compileMemoryGrow for the amd64 architecture. +func (c *amd64Compiler) compileMemoryGrow() error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + if err := c.compileCallBuiltinFunction(builtinFunctionIndexMemoryGrow); err != nil { + return err + } + + // After the function call, we have to initialize the stack base pointer and memory reserved registers. + c.compileReservedStackBasePointerInitialization() + c.compileReservedMemoryPointerInitialization() + return nil +} + +// compileMemorySize implements compiler.compileMemorySize for the amd64 architecture. +func (c *amd64Compiler) compileMemorySize() error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + reg, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + loc := c.pushRuntimeValueLocationOnRegister(reg, runtimeValueTypeI32) + + c.assembler.CompileMemoryToRegister(amd64.MOVQ, amd64ReservedRegisterForCallEngine, callEngineModuleContextMemorySliceLenOffset, loc.register) + + // WebAssembly's memory.size returns the page size (65536) of memory region. + // That is equivalent to divide the len of memory slice by 65536 and + // that can be calculated as SHR by 16 bits as 65536 = 2^16. + c.assembler.CompileConstToRegister(amd64.SHRQ, wasm.MemoryPageSizeInBits, loc.register) + return nil +} + +// compileMemoryInit implements compiler.compileMemoryInit for the amd64 architecture. +func (c *amd64Compiler) compileMemoryInit(o *wazeroir.UnionOperation) error { + dataIndex := uint32(o.U1) + return c.compileInitImpl(false, dataIndex, 0) +} + +// compileInitImpl implements compileTableInit and compileMemoryInit. +// +// TODO: the compiled code in this function should be reused and compile at once as +// the code is independent of any module. +func (c *amd64Compiler) compileInitImpl(isTable bool, index, tableIndex uint32) error { + outOfBoundsErrorStatus := nativeCallStatusCodeMemoryOutOfBounds + if isTable { + outOfBoundsErrorStatus = nativeCallStatusCodeInvalidTableAccess + } + + copySize := c.locationStack.pop() + if err := c.compileEnsureOnRegister(copySize); err != nil { + return err + } + + sourceOffset := c.locationStack.pop() + if err := c.compileEnsureOnRegister(sourceOffset); err != nil { + return err + } + + destinationOffset := c.locationStack.pop() + if err := c.compileEnsureOnRegister(destinationOffset); err != nil { + return err + } + + instanceAddr, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.locationStack.markRegisterUsed(instanceAddr) + if isTable { + c.compileLoadElemInstanceAddress(index, instanceAddr) + } else { + c.compileLoadDataInstanceAddress(index, instanceAddr) + } + + tmp, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.locationStack.markRegisterUsed(tmp) + + // sourceOffset += size. + c.assembler.CompileRegisterToRegister(amd64.ADDQ, copySize.register, sourceOffset.register) + // destinationOffset += size. + c.assembler.CompileRegisterToRegister(amd64.ADDQ, copySize.register, destinationOffset.register) + + // Check instance bounds and if exceeds the length, exit with out of bounds error. + c.assembler.CompileMemoryToRegister(amd64.CMPQ, + instanceAddr, 8, // DataInstance and Element instance holds the length is stored at offset 8. + sourceOffset.register) + c.compileMaybeExitFromNativeCode(amd64.JCC, outOfBoundsErrorStatus) + + // Check destination bounds and if exceeds the length, exit with out of bounds error. + if isTable { + // Load the target table's address. + c.assembler.CompileMemoryToRegister(amd64.MOVQ, amd64ReservedRegisterForCallEngine, callEngineModuleContextTablesElement0AddressOffset, tmp) + c.assembler.CompileMemoryToRegister(amd64.MOVQ, tmp, int64(tableIndex*8), tmp) + // Compare length. + c.assembler.CompileMemoryToRegister(amd64.CMPQ, tmp, tableInstanceTableLenOffset, destinationOffset.register) + } else { + c.assembler.CompileMemoryToRegister(amd64.CMPQ, + amd64ReservedRegisterForCallEngine, callEngineModuleContextMemorySliceLenOffset, + destinationOffset.register) + } + + c.compileMaybeExitFromNativeCode(amd64.JCC, outOfBoundsErrorStatus) + + // Otherwise, ready to copy the value from source to destination. + // + // If the copy size equal zero, we skip the entire instructions below. + c.assembler.CompileRegisterToRegister(amd64.TESTQ, copySize.register, copySize.register) + skipJump := c.assembler.CompileJump(amd64.JEQ) + + var scale int16 + var memToReg, regToMem asm.Instruction + if isTable { + // Each element is of type uintptr; 2^3 = 1 << pointerSizeLog2. + c.assembler.CompileConstToRegister(amd64.SHLQ, pointerSizeLog2, sourceOffset.register) + c.assembler.CompileConstToRegister(amd64.SHLQ, pointerSizeLog2, destinationOffset.register) + // destinationOffset += table buffer's absolute address. + c.assembler.CompileMemoryToRegister(amd64.ADDQ, + tmp, tableInstanceTableOffset, destinationOffset.register) + // sourceOffset += data buffer's absolute address. + c.assembler.CompileMemoryToRegister(amd64.ADDQ, + instanceAddr, 0, sourceOffset.register) + + // For tables, we move 8 bytes at once. + memToReg = amd64.MOVQ + regToMem = memToReg + scale = 8 + } else { + // destinationOffset += memory buffer's absolute address. + c.assembler.CompileRegisterToRegister(amd64.ADDQ, amd64ReservedRegisterForMemory, destinationOffset.register) + + // sourceOffset += data buffer's absolute address. + c.assembler.CompileMemoryToRegister(amd64.ADDQ, instanceAddr, 0, sourceOffset.register) + + // Move one byte at once. + memToReg = amd64.MOVBQZX + regToMem = amd64.MOVB + scale = 1 + } + + // Negate the counter. + c.assembler.CompileNoneToRegister(amd64.NEGQ, copySize.register) + + beginCopyLoop := c.assembler.CompileStandAlone(amd64.NOP) + + c.assembler.CompileMemoryWithIndexToRegister(memToReg, + sourceOffset.register, 0, copySize.register, scale, + tmp) + // [destinationOffset + (size.register)] = tmp. + c.assembler.CompileRegisterToMemoryWithIndex(regToMem, + tmp, + destinationOffset.register, 0, copySize.register, scale, + ) + + // size += 1 + c.assembler.CompileNoneToRegister(amd64.INCQ, copySize.register) + c.assembler.CompileJump(amd64.JMI).AssignJumpTarget(beginCopyLoop) + + c.locationStack.markRegisterUnused(copySize.register, sourceOffset.register, + destinationOffset.register, instanceAddr, tmp) + c.assembler.SetJumpTargetOnNext(skipJump) + return nil +} + +// compileDataDrop implements compiler.compileDataDrop for the amd64 architecture. +func (c *amd64Compiler) compileDataDrop(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + tmp, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + dataIndex := uint32(o.U1) + c.compileLoadDataInstanceAddress(dataIndex, tmp) + + // Clears the content of DataInstance[o.DataIndex] (== []byte type). + c.assembler.CompileConstToMemory(amd64.MOVQ, 0, tmp, 0) + c.assembler.CompileConstToMemory(amd64.MOVQ, 0, tmp, 8) + c.assembler.CompileConstToMemory(amd64.MOVQ, 0, tmp, 16) + return nil +} + +func (c *amd64Compiler) compileLoadDataInstanceAddress(dataIndex uint32, dst asm.Register) { + // dst = dataIndex * dataInstanceStructSize. + c.assembler.CompileConstToRegister(amd64.MOVQ, int64(dataIndex)*dataInstanceStructSize, dst) + + // dst = &moduleInstance.DataInstances[0] + dst + // = &moduleInstance.DataInstances[0] + dataIndex*dataInstanceStructSize + // = &moduleInstance.DataInstances[dataIndex] + c.assembler.CompileMemoryToRegister(amd64.ADDQ, + amd64ReservedRegisterForCallEngine, callEngineModuleContextDataInstancesElement0AddressOffset, + dst, + ) +} + +// compileCopyLoopImpl implements a REP MOVSQ memory copy for the given range with support for both directions. +func (c *amd64Compiler) compileCopyLoopImpl(destinationOffset, sourceOffset, copySize *runtimeValueLocation, backwards bool, bwOffset uint8) { + // skip if nothing to copy + c.assembler.CompileRegisterToRegister(amd64.TESTQ, copySize.register, copySize.register) + emptyEightGroupsJump := c.assembler.CompileJump(amd64.JEQ) + + // Prepare registers for swaps. There will never be more than 3 XCHGs in total. + restoreCrossing := c.compilePreventCrossedTargetRegisters( + []*runtimeValueLocation{destinationOffset, sourceOffset, copySize}, + []asm.Register{amd64.RegDI, amd64.RegSI, amd64.RegCX}) + + // Prepare registers for REP MOVSQ: copy from rsi to rdi, rcx times. + c.compileMaybeSwapRegisters(destinationOffset.register, amd64.RegDI) + c.compileMaybeSwapRegisters(sourceOffset.register, amd64.RegSI) + c.compileMaybeSwapRegisters(copySize.register, amd64.RegCX) + + // Point on first byte of first quadword to copy. + if backwards { + c.assembler.CompileConstToRegister(amd64.ADDQ, -int64(bwOffset), amd64.RegDI) + c.assembler.CompileConstToRegister(amd64.ADDQ, -int64(bwOffset), amd64.RegSI) + // Set REP prefix direction backwards. + c.assembler.CompileStandAlone(amd64.STD) + } + + c.assembler.CompileStandAlone(amd64.REPMOVSQ) + + if backwards { + // Reset direction. + c.assembler.CompileStandAlone(amd64.CLD) + } + + // Restore registers. + c.compileMaybeSwapRegisters(destinationOffset.register, amd64.RegDI) + c.compileMaybeSwapRegisters(sourceOffset.register, amd64.RegSI) + c.compileMaybeSwapRegisters(copySize.register, amd64.RegCX) + restoreCrossing() + + c.assembler.SetJumpTargetOnNext(emptyEightGroupsJump) + c.assembler.CompileStandAlone(amd64.NOP) +} + +// compileMemoryCopyLoopImpl is used for directly copying after bounds/direction check. +func (c *amd64Compiler) compileMemoryCopyLoopImpl(destinationOffset, sourceOffset, copySize *runtimeValueLocation, tmp asm.Register, backwards bool) { + // Point on first byte to be copied depending on direction. + if backwards { + c.assembler.CompileNoneToRegister(amd64.DECQ, sourceOffset.register) + c.assembler.CompileNoneToRegister(amd64.DECQ, destinationOffset.register) + } else { + c.assembler.CompileRegisterToRegister(amd64.SUBQ, copySize.register, sourceOffset.register) + c.assembler.CompileRegisterToRegister(amd64.SUBQ, copySize.register, destinationOffset.register) + } + + // destinationOffset += memory buffer's absolute address. + c.assembler.CompileRegisterToRegister(amd64.ADDQ, amd64ReservedRegisterForMemory, destinationOffset.register) + // sourceOffset += memory buffer's absolute address. + c.assembler.CompileRegisterToRegister(amd64.ADDQ, amd64ReservedRegisterForMemory, sourceOffset.register) + + // Copy copySize % 8 bytes in loop to allow copying in 8 byte groups afterward. + beginLoop := c.assembler.CompileStandAlone(amd64.NOP) + + // Check copySize % 8 == 0. + c.assembler.CompileConstToRegister(amd64.TESTQ, 7, copySize.register) + breakLoop := c.assembler.CompileJump(amd64.JEQ) + + c.assembler.CompileMemoryToRegister(amd64.MOVBQZX, sourceOffset.register, 0, tmp) + c.assembler.CompileRegisterToMemory(amd64.MOVB, tmp, destinationOffset.register, 0) + + if backwards { + c.assembler.CompileNoneToRegister(amd64.DECQ, sourceOffset.register) + c.assembler.CompileNoneToRegister(amd64.DECQ, destinationOffset.register) + } else { + c.assembler.CompileNoneToRegister(amd64.INCQ, sourceOffset.register) + c.assembler.CompileNoneToRegister(amd64.INCQ, destinationOffset.register) + } + + c.assembler.CompileNoneToRegister(amd64.DECQ, copySize.register) + c.assembler.CompileJump(amd64.JMP).AssignJumpTarget(beginLoop) + c.assembler.SetJumpTargetOnNext(breakLoop) + + // compileCopyLoopImpl counts in groups of 8 bytes, so we have to divide the copySize by 8. + c.assembler.CompileConstToRegister(amd64.SHRQ, 3, copySize.register) + + c.compileCopyLoopImpl(destinationOffset, sourceOffset, copySize, backwards, 7) +} + +// compileMemoryCopy implements compiler.compileMemoryCopy for the amd64 architecture. +// +// This uses efficient `REP MOVSQ` instructions to copy in quadword (8 bytes) batches. The remaining bytes +// are copied with a simple `MOV` loop. It uses backward copying for overlapped segments. +func (c *amd64Compiler) compileMemoryCopy() error { + copySize := c.locationStack.pop() + if err := c.compileEnsureOnRegister(copySize); err != nil { + return err + } + + sourceOffset := c.locationStack.pop() + if err := c.compileEnsureOnRegister(sourceOffset); err != nil { + return err + } + + destinationOffset := c.locationStack.pop() + if err := c.compileEnsureOnRegister(destinationOffset); err != nil { + return err + } + + tmp, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.locationStack.markRegisterUsed(tmp) + + // sourceOffset += size. + c.assembler.CompileRegisterToRegister(amd64.ADDQ, copySize.register, sourceOffset.register) + // destinationOffset += size. + c.assembler.CompileRegisterToRegister(amd64.ADDQ, copySize.register, destinationOffset.register) + // tmp = max(sourceOffset, destinationOffset). + c.assembler.CompileRegisterToRegister(amd64.CMPQ, sourceOffset.register, destinationOffset.register) + c.assembler.CompileRegisterToRegister(amd64.MOVQ, sourceOffset.register, tmp) + c.assembler.CompileRegisterToRegister(amd64.CMOVQCS, destinationOffset.register, tmp) + + // Check maximum bounds and if exceeds the length, exit with out of bounds error. + c.assembler.CompileMemoryToRegister(amd64.CMPQ, + amd64ReservedRegisterForCallEngine, callEngineModuleContextMemorySliceLenOffset, tmp) + c.compileMaybeExitFromNativeCode(amd64.JCC, nativeCallStatusCodeMemoryOutOfBounds) + + // Skip zero size. + c.assembler.CompileRegisterToRegister(amd64.TESTQ, copySize.register, copySize.register) + skipJump := c.assembler.CompileJump(amd64.JEQ) + + // If dest < source, we can copy forwards + c.assembler.CompileRegisterToRegister(amd64.CMPQ, destinationOffset.register, sourceOffset.register) + destLowerThanSourceJump := c.assembler.CompileJump(amd64.JLS) + + // If source + size < dest, we can copy forwards + c.assembler.CompileRegisterToRegister(amd64.MOVQ, destinationOffset.register, tmp) + c.assembler.CompileRegisterToRegister(amd64.SUBQ, copySize.register, tmp) + c.assembler.CompileRegisterToRegister(amd64.CMPQ, sourceOffset.register, tmp) + sourceBoundLowerThanDestJump := c.assembler.CompileJump(amd64.JLS) + + // Copy backwards. + c.compileMemoryCopyLoopImpl(destinationOffset, sourceOffset, copySize, tmp, true) + endJump := c.assembler.CompileJump(amd64.JMP) + + // Copy forwards. + c.assembler.SetJumpTargetOnNext(destLowerThanSourceJump) + c.assembler.SetJumpTargetOnNext(sourceBoundLowerThanDestJump) + c.compileMemoryCopyLoopImpl(destinationOffset, sourceOffset, copySize, tmp, false) + + c.locationStack.markRegisterUnused(copySize.register, sourceOffset.register, + destinationOffset.register, tmp) + c.assembler.SetJumpTargetOnNext(skipJump) + c.assembler.SetJumpTargetOnNext(endJump) + + return nil +} + +// compileFillLoopImpl implements a REP STOSQ fill loop. +func (c *amd64Compiler) compileFillLoopImpl(destinationOffset, value, fillSize *runtimeValueLocation, tmp asm.Register, replicateByte bool) { + // Skip if nothing to fill. + c.assembler.CompileRegisterToRegister(amd64.TESTQ, fillSize.register, fillSize.register) + emptyEightGroupsJump := c.assembler.CompileJump(amd64.JEQ) + + if replicateByte { + // Truncate value.register to a single byte + c.assembler.CompileConstToRegister(amd64.ANDQ, 0xff, value.register) + // Replicate single byte onto full 8-byte register. + c.assembler.CompileConstToRegister(amd64.MOVQ, 0x0101010101010101, tmp) + c.assembler.CompileRegisterToRegister(amd64.IMULQ, tmp, value.register) + } + + // Prepare registers for swaps. There will never be more than 3 XCHGs in total. + restoreCrossing := c.compilePreventCrossedTargetRegisters( + []*runtimeValueLocation{destinationOffset, value, fillSize}, + []asm.Register{amd64.RegDI, amd64.RegAX, amd64.RegCX}) + + // Prepare registers for REP STOSQ: fill at [rdi] with rax, rcx times. + c.compileMaybeSwapRegisters(destinationOffset.register, amd64.RegDI) + c.compileMaybeSwapRegisters(value.register, amd64.RegAX) + c.compileMaybeSwapRegisters(fillSize.register, amd64.RegCX) + + c.assembler.CompileStandAlone(amd64.REPSTOSQ) + + // Restore registers. + c.compileMaybeSwapRegisters(destinationOffset.register, amd64.RegDI) + c.compileMaybeSwapRegisters(value.register, amd64.RegAX) + c.compileMaybeSwapRegisters(fillSize.register, amd64.RegCX) + restoreCrossing() + + c.assembler.SetJumpTargetOnNext(emptyEightGroupsJump) +} + +// compileMemoryFill implements compiler.compileMemoryFill for the amd64 architecture. +// +// This function uses efficient `REP STOSQ` instructions to copy in quadword (8 bytes) batches +// if the size if above 15 bytes. For smaller sizes, a simple MOVB copy loop is the best +// option. +// +// TODO: the compiled code in this function should be reused and compile at once as +// the code is independent of any module. +func (c *amd64Compiler) compileFillImpl(isTable bool, tableIndex uint32) error { + copySize := c.locationStack.pop() + if err := c.compileEnsureOnRegister(copySize); err != nil { + return err + } + + value := c.locationStack.pop() + if err := c.compileEnsureOnRegister(value); err != nil { + return err + } + + destinationOffset := c.locationStack.pop() + if err := c.compileEnsureOnRegister(destinationOffset); err != nil { + return err + } + + tmp, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.locationStack.markRegisterUsed(tmp) + + // destinationOffset += size. + c.assembler.CompileRegisterToRegister(amd64.ADDQ, copySize.register, destinationOffset.register) + + // Check destination bounds and if exceeds the length, exit with out of bounds error. + if isTable { + // tmp = &tables[0] + c.assembler.CompileMemoryToRegister(amd64.MOVQ, + amd64ReservedRegisterForCallEngine, callEngineModuleContextTablesElement0AddressOffset, + tmp) + + // tmp = [tmp + TableIndex*8] + // = [&tables[0] + TableIndex*sizeOf(*tableInstance)] + // = [&tables[TableIndex]] = tables[TableIndex]. + c.assembler.CompileMemoryToRegister(amd64.MOVQ, tmp, int64(tableIndex)*8, tmp) + + c.assembler.CompileMemoryToRegister(amd64.CMPQ, + tmp, tableInstanceTableLenOffset, + destinationOffset.register) + } else { + c.assembler.CompileMemoryToRegister(amd64.CMPQ, + amd64ReservedRegisterForCallEngine, callEngineModuleContextMemorySliceLenOffset, + destinationOffset.register) + } + if isTable { + c.compileMaybeExitFromNativeCode(amd64.JCC, nativeCallStatusCodeInvalidTableAccess) + } else { + c.compileMaybeExitFromNativeCode(amd64.JCC, nativeCallStatusCodeMemoryOutOfBounds) + } + + // Otherwise, ready to copy the value from source to destination. + // + // If the copy size equal zero, we skip the entire instructions below. + c.assembler.CompileRegisterToRegister(amd64.TESTQ, copySize.register, copySize.register) + skipJump := c.assembler.CompileJump(amd64.JEQ) + + // destinationOffset -= size. + c.assembler.CompileRegisterToRegister(amd64.SUBQ, copySize.register, destinationOffset.register) + + if isTable { + // Each element is of type uintptr; 2^3 = 1 << pointerSizeLog2. + c.assembler.CompileConstToRegister(amd64.SHLQ, pointerSizeLog2, destinationOffset.register) + // destinationOffset += table buffer's absolute address. + c.assembler.CompileMemoryToRegister(amd64.ADDQ, tmp, tableInstanceTableOffset, destinationOffset.register) + + } else { + // destinationOffset += memory buffer's absolute address. + c.assembler.CompileRegisterToRegister(amd64.ADDQ, amd64ReservedRegisterForMemory, destinationOffset.register) + + // Copy first % 16 bytes with simple MOVB instruction. + beginCopyLoop := c.assembler.CompileStandAlone(amd64.NOP) + c.assembler.CompileConstToRegister(amd64.TESTQ, 15, copySize.register) + breakLoop := c.assembler.CompileJump(amd64.JEQ) + + c.assembler.CompileRegisterToMemory(amd64.MOVB, value.register, destinationOffset.register, 0) + + c.assembler.CompileNoneToRegister(amd64.INCQ, destinationOffset.register) + c.assembler.CompileNoneToRegister(amd64.DECQ, copySize.register) + c.assembler.CompileJump(amd64.JMP).AssignJumpTarget(beginCopyLoop) + + c.assembler.SetJumpTargetOnNext(breakLoop) + // compileFillLoopImpl counts in groups of 8 bytes, so we have to divide the copySize by 8. + c.assembler.CompileConstToRegister(amd64.SHRQ, 3, copySize.register) + } + + c.compileFillLoopImpl(destinationOffset, value, copySize, tmp, !isTable) + + c.locationStack.markRegisterUnused(copySize.register, value.register, + destinationOffset.register, tmp) + c.assembler.SetJumpTargetOnNext(skipJump) + return nil +} + +// compileMemoryFill implements compiler.compileMemoryFill for the amd64 architecture. +// +// TODO: the compiled code in this function should be reused and compile at once as +// the code is independent of any module. +func (c *amd64Compiler) compileMemoryFill() error { + return c.compileFillImpl(false, 0) +} + +// compileTableInit implements compiler.compileTableInit for the amd64 architecture. +func (c *amd64Compiler) compileTableInit(o *wazeroir.UnionOperation) error { + elemIndex := uint32(o.U1) + tableIndex := uint32(o.U2) + return c.compileInitImpl(true, elemIndex, tableIndex) +} + +// compileTableCopyLoopImpl is used for directly copying after bounds/direction check. +func (c *amd64Compiler) compileTableCopyLoopImpl(srcTableIndex, dstTableIndex uint32, destinationOffset, sourceOffset, copySize *runtimeValueLocation, tmp asm.Register, backwards bool) { + // Point on first byte to be copied. + if !backwards { + c.assembler.CompileRegisterToRegister(amd64.SUBQ, copySize.register, sourceOffset.register) + c.assembler.CompileRegisterToRegister(amd64.SUBQ, copySize.register, destinationOffset.register) + } + + // Each element is of type uintptr; 2^3 = 1 << pointerSizeLog2. + c.assembler.CompileConstToRegister(amd64.SHLQ, pointerSizeLog2, sourceOffset.register) + c.assembler.CompileConstToRegister(amd64.SHLQ, pointerSizeLog2, destinationOffset.register) + // destinationOffset += table buffer's absolute address. + c.assembler.CompileMemoryToRegister(amd64.MOVQ, amd64ReservedRegisterForCallEngine, callEngineModuleContextTablesElement0AddressOffset, tmp) + c.assembler.CompileMemoryToRegister(amd64.MOVQ, tmp, int64(dstTableIndex*8), tmp) + c.assembler.CompileMemoryToRegister(amd64.ADDQ, tmp, tableInstanceTableOffset, destinationOffset.register) + // sourceOffset += table buffer's absolute address. + c.assembler.CompileMemoryToRegister(amd64.MOVQ, amd64ReservedRegisterForCallEngine, callEngineModuleContextTablesElement0AddressOffset, tmp) + c.assembler.CompileMemoryToRegister(amd64.MOVQ, tmp, int64(srcTableIndex*8), tmp) + c.assembler.CompileMemoryToRegister(amd64.ADDQ, tmp, tableInstanceTableOffset, sourceOffset.register) + + c.compileCopyLoopImpl(destinationOffset, sourceOffset, copySize, backwards, 8) +} + +// compileTableCopy implements compiler.compileTableCopy for the amd64 architecture. +// +// It uses efficient `REP MOVSB` instructions for optimized copying. It uses backward copying for +// overlapped segments. +func (c *amd64Compiler) compileTableCopy(o *wazeroir.UnionOperation) error { + copySize := c.locationStack.pop() + if err := c.compileEnsureOnRegister(copySize); err != nil { + return err + } + + sourceOffset := c.locationStack.pop() + if err := c.compileEnsureOnRegister(sourceOffset); err != nil { + return err + } + + destinationOffset := c.locationStack.pop() + if err := c.compileEnsureOnRegister(destinationOffset); err != nil { + return err + } + + tmp, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + // sourceOffset += size. + c.assembler.CompileRegisterToRegister(amd64.ADDQ, copySize.register, sourceOffset.register) + // destinationOffset += size. + c.assembler.CompileRegisterToRegister(amd64.ADDQ, copySize.register, destinationOffset.register) + + srcTableIndex := uint32(o.U1) + dstTableIndex := uint32(o.U2) + + // Check source bounds and if exceeds the length, exit with out of bounds error. + c.assembler.CompileMemoryToRegister(amd64.MOVQ, amd64ReservedRegisterForCallEngine, callEngineModuleContextTablesElement0AddressOffset, tmp) + c.assembler.CompileMemoryToRegister(amd64.MOVQ, tmp, int64(srcTableIndex*8), tmp) + c.assembler.CompileMemoryToRegister(amd64.CMPQ, tmp, tableInstanceTableLenOffset, sourceOffset.register) + c.compileMaybeExitFromNativeCode(amd64.JCC, nativeCallStatusCodeInvalidTableAccess) + + // Check destination bounds and if exceeds the length, exit with out of bounds error. + c.assembler.CompileMemoryToRegister(amd64.MOVQ, amd64ReservedRegisterForCallEngine, callEngineModuleContextTablesElement0AddressOffset, tmp) + c.assembler.CompileMemoryToRegister(amd64.MOVQ, tmp, int64(dstTableIndex*8), tmp) + c.assembler.CompileMemoryToRegister(amd64.CMPQ, tmp, tableInstanceTableLenOffset, destinationOffset.register) + c.compileMaybeExitFromNativeCode(amd64.JCC, nativeCallStatusCodeInvalidTableAccess) + + // Skip zero size. + c.assembler.CompileRegisterToRegister(amd64.TESTQ, copySize.register, copySize.register) + skipJump := c.assembler.CompileJump(amd64.JEQ) + + // If dest < source, we can copy forwards. + c.assembler.CompileRegisterToRegister(amd64.CMPQ, destinationOffset.register, sourceOffset.register) + destLowerThanSourceJump := c.assembler.CompileJump(amd64.JLS) + + // If source + size < dest, we can copy forwards. + c.assembler.CompileRegisterToRegister(amd64.MOVQ, destinationOffset.register, tmp) + c.assembler.CompileRegisterToRegister(amd64.SUBQ, copySize.register, tmp) + c.assembler.CompileRegisterToRegister(amd64.CMPQ, sourceOffset.register, tmp) + sourceBoundLowerThanDestJump := c.assembler.CompileJump(amd64.JLS) + + // Copy backwards. + c.compileTableCopyLoopImpl(srcTableIndex, dstTableIndex, destinationOffset, sourceOffset, copySize, tmp, true) + endJump := c.assembler.CompileJump(amd64.JMP) + + // Copy forwards. + c.assembler.SetJumpTargetOnNext(destLowerThanSourceJump) + c.assembler.SetJumpTargetOnNext(sourceBoundLowerThanDestJump) + c.compileTableCopyLoopImpl(srcTableIndex, dstTableIndex, destinationOffset, sourceOffset, copySize, tmp, false) + + c.locationStack.markRegisterUnused(copySize.register, sourceOffset.register, + destinationOffset.register, tmp) + c.assembler.SetJumpTargetOnNext(skipJump) + c.assembler.SetJumpTargetOnNext(endJump) + return nil +} + +// compileElemDrop implements compiler.compileElemDrop for the amd64 architecture. +func (c *amd64Compiler) compileElemDrop(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + tmp, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + elemIndex := uint32(o.U1) + c.compileLoadElemInstanceAddress(elemIndex, tmp) + + // Clears the content of ElementInstances[o.ElemIndex].References (== []uintptr{} type). + c.assembler.CompileConstToMemory(amd64.MOVQ, 0, tmp, 0) + c.assembler.CompileConstToMemory(amd64.MOVQ, 0, tmp, 8) + c.assembler.CompileConstToMemory(amd64.MOVQ, 0, tmp, 16) + return nil +} + +func (c *amd64Compiler) compileLoadElemInstanceAddress(elemIndex uint32, dst asm.Register) { + // dst = elemIndex * elementInstanceStructSize + c.assembler.CompileConstToRegister(amd64.MOVQ, int64(elemIndex)*elementInstanceStructSize, dst) + + // dst = &moduleInstance.ElementInstances[0] + dst + // = &moduleInstance.ElementInstances[0] + elemIndex*elementInstanceStructSize + // = &moduleInstance.ElementInstances[elemIndex] + c.assembler.CompileMemoryToRegister(amd64.ADDQ, + amd64ReservedRegisterForCallEngine, callEngineModuleContextElementInstancesElement0AddressOffset, + dst, + ) +} + +// compileTableGet implements compiler.compileTableGet for the amd64 architecture. +func (c *amd64Compiler) compileTableGet(o *wazeroir.UnionOperation) error { + ref, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + c.locationStack.markRegisterUsed(ref) + + offset := c.locationStack.pop() + if err := c.compileEnsureOnRegister(offset); err != nil { + return err + } + + // ref = &tables[0] + c.assembler.CompileMemoryToRegister(amd64.MOVQ, + amd64ReservedRegisterForCallEngine, callEngineModuleContextTablesElement0AddressOffset, + ref) + + // ref = [ref + TableIndex*8] + // = [&tables[0] + TableIndex*sizeOf(*tableInstance)] + // = [&tables[TableIndex]] = tables[TableIndex]. + tableIndex := int64(o.U1) + c.assembler.CompileMemoryToRegister(amd64.MOVQ, ref, tableIndex*8, ref) + + // Out of bounds check. + c.assembler.CompileMemoryToRegister(amd64.CMPQ, ref, tableInstanceTableLenOffset, offset.register) + c.compileMaybeExitFromNativeCode(amd64.JHI, nativeCallStatusCodeInvalidTableAccess) + + // ref = [&tables[TableIndex] + tableInstanceTableOffset] = &tables[TableIndex].References[0] + c.assembler.CompileMemoryToRegister(amd64.MOVQ, ref, tableInstanceTableOffset, ref) + + // ref = [ref + 0 + offset.register * 8] + // = [&tables[TableIndex].References[0] + sizeOf(uintptr) * offset] + // = [&tables[TableIndex].References[offset]] + // = tables[TableIndex].References[offset] + c.assembler.CompileMemoryWithIndexToRegister(amd64.MOVQ, ref, + 0, offset.register, 8, ref, + ) + + c.locationStack.markRegisterUnused(offset.register) + c.pushRuntimeValueLocationOnRegister(ref, runtimeValueTypeI64) // table elements are opaque 64-bit at runtime. + return nil +} + +// compileTableSet implements compiler.compileTableSet for the amd64 architecture. +func (c *amd64Compiler) compileTableSet(o *wazeroir.UnionOperation) error { + ref := c.locationStack.pop() + if err := c.compileEnsureOnRegister(ref); err != nil { + return err + } + + offset := c.locationStack.pop() + if err := c.compileEnsureOnRegister(offset); err != nil { + return err + } + + tmp, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + // tmp = &tables[0] + c.assembler.CompileMemoryToRegister(amd64.MOVQ, + amd64ReservedRegisterForCallEngine, callEngineModuleContextTablesElement0AddressOffset, + tmp) + + // ref = [ref + TableIndex*8] + // = [&tables[0] + TableIndex*sizeOf(*tableInstance)] + // = [&tables[TableIndex]] = tables[TableIndex]. + tableIndex := int64(o.U1) + c.assembler.CompileMemoryToRegister(amd64.MOVQ, tmp, tableIndex*8, tmp) + + // Out of bounds check. + c.assembler.CompileMemoryToRegister(amd64.CMPQ, tmp, tableInstanceTableLenOffset, offset.register) + c.compileMaybeExitFromNativeCode(amd64.JHI, nativeCallStatusCodeInvalidTableAccess) + + // tmp = [&tables[TableIndex] + tableInstanceTableOffset] = &tables[TableIndex].References[0] + c.assembler.CompileMemoryToRegister(amd64.MOVQ, tmp, tableInstanceTableOffset, tmp) + + // [tmp + 0 + offset.register * 8] = ref + // [&tables[TableIndex].References[0] + sizeOf(uintptr) * offset] = ref + // [&tables[TableIndex].References[offset]] = ref + // tables[TableIndex].References[offset] = ref + c.assembler.CompileRegisterToMemoryWithIndex(amd64.MOVQ, + ref.register, + tmp, 0, offset.register, 8) + + c.locationStack.markRegisterUnused(offset.register, ref.register) + return nil +} + +// compileTableGrow implements compiler.compileTableGrow for the amd64 architecture. +func (c *amd64Compiler) compileTableGrow(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + // Pushes the table index. + tableIndex := uint32(o.U1) + if err := c.compileConstI32Impl(tableIndex); err != nil { + return err + } + + // Table grow cannot be done in assembly just like memory grow as it involves with allocation in Go. + // Therefore, call out to the built function for this purpose. + if err := c.compileCallBuiltinFunction(builtinFunctionIndexTableGrow); err != nil { + return err + } + + // TableGrow consumes three values (table index, number of items, initial value). + for i := 0; i < 3; i++ { + c.locationStack.pop() + } + + // Then, the previous length was pushed as the result. + loc := c.locationStack.pushRuntimeValueLocationOnStack() + loc.valueType = runtimeValueTypeI32 + + // After return, we re-initialize reserved registers just like preamble of functions. + c.compileReservedStackBasePointerInitialization() + c.compileReservedMemoryPointerInitialization() + return nil +} + +// compileTableSize implements compiler.compileTableSize for the amd64 architecture. +func (c *amd64Compiler) compileTableSize(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + result, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + // result = &tables[0] + c.assembler.CompileMemoryToRegister(amd64.MOVQ, + amd64ReservedRegisterForCallEngine, callEngineModuleContextTablesElement0AddressOffset, + result) + + // result = [result + TableIndex*8] + // = [&tables[0] + TableIndex*sizeOf(*tableInstance)] + // = [&tables[TableIndex]] = tables[TableIndex]. + tableIndex := int64(o.U1) + c.assembler.CompileMemoryToRegister(amd64.MOVQ, result, tableIndex*8, result) + + // result = [result + tableInstanceTableLenOffset] + // = [tables[TableIndex] + tableInstanceTableLenOffset] + // = len(tables[TableIndex]) + c.assembler.CompileMemoryToRegister(amd64.MOVQ, result, tableInstanceTableLenOffset, result) + + c.pushRuntimeValueLocationOnRegister(result, runtimeValueTypeI32) + return nil +} + +// compileTableFill implements compiler.compileTableFill for the amd64 architecture. +func (c *amd64Compiler) compileTableFill(o *wazeroir.UnionOperation) error { + tableIndex := uint32(o.U1) + return c.compileFillImpl(true, tableIndex) +} + +// compileRefFunc implements compiler.compileRefFunc for the amd64 architecture. +func (c *amd64Compiler) compileRefFunc(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + ref, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + functionIndex := int64(o.U1) + c.assembler.CompileConstToRegister(amd64.MOVQ, functionIndex*functionSize, ref) + + // ref = [amd64ReservedRegisterForCallEngine + callEngineModuleContextFunctionsElement0AddressOffset + int64(o.FunctionIndex)*functionSize] + // = &moduleEngine.functions[index] + c.assembler.CompileMemoryToRegister( + amd64.ADDQ, amd64ReservedRegisterForCallEngine, callEngineModuleContextFunctionsElement0AddressOffset, + ref, + ) + + c.pushRuntimeValueLocationOnRegister(ref, runtimeValueTypeI64) + return nil +} + +// compileConstI32 implements compiler.compileConstI32 for the amd64 architecture. +func (c *amd64Compiler) compileConstI32(o *wazeroir.UnionOperation) error { + return c.compileConstI32Impl(uint32(o.U1)) +} + +func (c *amd64Compiler) compileConstI32Impl(v uint32) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + reg, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.pushRuntimeValueLocationOnRegister(reg, runtimeValueTypeI32) + c.assembler.CompileConstToRegister(amd64.MOVL, int64(v), reg) + return nil +} + +// compileConstI64 implements compiler.compileConstI64 for the amd64 architecture. +func (c *amd64Compiler) compileConstI64(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + reg, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.pushRuntimeValueLocationOnRegister(reg, runtimeValueTypeI64) + + c.assembler.CompileConstToRegister(amd64.MOVQ, int64(o.U1), reg) + return nil +} + +// compileConstF32 implements compiler.compileConstF32 for the amd64 architecture. +func (c *amd64Compiler) compileConstF32(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + reg, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + c.pushRuntimeValueLocationOnRegister(reg, runtimeValueTypeF32) + + // We cannot directly load the value from memory to float regs, + // so we move it to int reg temporarily. + tmpReg, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + c.assembler.CompileConstToRegister(amd64.MOVL, int64(o.U1) /*math.Float32bits(o.Value)*/, tmpReg) + c.assembler.CompileRegisterToRegister(amd64.MOVL, tmpReg, reg) + return nil +} + +// compileConstF64 implements compiler.compileConstF64 for the amd64 architecture. +func (c *amd64Compiler) compileConstF64(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + reg, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + c.pushRuntimeValueLocationOnRegister(reg, runtimeValueTypeF64) + + // We cannot directly load the value from memory to float regs, + // so we move it to int reg temporarily. + tmpReg, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + c.assembler.CompileConstToRegister(amd64.MOVQ, int64(o.U1) /* math.Float64bits(o.Value) */, tmpReg) + c.assembler.CompileRegisterToRegister(amd64.MOVQ, tmpReg, reg) + return nil +} + +// compileLoadValueOnStackToRegister implements compiler.compileLoadValueOnStackToRegister for amd64. +func (c *amd64Compiler) compileLoadValueOnStackToRegister(loc *runtimeValueLocation) { + var inst asm.Instruction + switch loc.valueType { + case runtimeValueTypeV128Lo: + inst = amd64.MOVDQU + case runtimeValueTypeV128Hi: + panic("BUG: V128Hi must be be loaded to a register along with V128Lo") + case runtimeValueTypeI32, runtimeValueTypeF32: + inst = amd64.MOVL + case runtimeValueTypeI64, runtimeValueTypeF64: + inst = amd64.MOVQ + default: + panic("BUG: unknown runtime value type") + } + + // Copy the value from the stack. + c.assembler.CompileMemoryToRegister(inst, + // Note: stack pointers are ensured not to exceed 2^27 so this offset never exceeds 32-bit range. + amd64ReservedRegisterForStackBasePointerAddress, int64(loc.stackPointer)*8, + loc.register) + + if loc.valueType == runtimeValueTypeV128Lo { + // Higher 64-bits are loaded as well ^^. + hi := &c.locationStack.stack[loc.stackPointer+1] + hi.setRegister(loc.register) + } +} + +// maybeCompileMoveTopConditionalToGeneralPurposeRegister moves the top value on the stack +// if the value is located on a conditional register. +// +// This is usually called at the beginning of methods on compiler interface where we possibly +// compile instructions without saving the conditional register value. +// The compileXXX functions without calling this function is saving the conditional +// value to the stack or register by invoking compileEnsureOnRegister for the top. +func (c *amd64Compiler) maybeCompileMoveTopConditionalToGeneralPurposeRegister() (err error) { + if c.locationStack.sp > 0 { + if loc := c.locationStack.peek(); loc.onConditionalRegister() { + if err = c.compileLoadConditionalRegisterToGeneralPurposeRegister(loc); err != nil { + return err + } + } + } + return +} + +// loadConditionalRegisterToGeneralPurposeRegister saves the conditional register value +// to a general purpose register. +func (c *amd64Compiler) compileLoadConditionalRegisterToGeneralPurposeRegister(loc *runtimeValueLocation) error { + reg, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.compileMoveConditionalToGeneralPurposeRegister(loc, reg) + return nil +} + +func (c *amd64Compiler) compileMoveConditionalToGeneralPurposeRegister(loc *runtimeValueLocation, reg asm.Register) { + // Set the flag bit to the destination. See + // - https://c9x.me/x86/html/file_module_x86_id_288.html + // - https://github.com/golang/go/blob/master/src/cmd/internal/obj/x86/asm6.go#L1453-L1468 + // to translate conditionalRegisterState* to amd64.SET* + var inst asm.Instruction + switch loc.conditionalRegister { + case amd64.ConditionalRegisterStateE: + inst = amd64.SETEQ + case amd64.ConditionalRegisterStateNE: + inst = amd64.SETNE + case amd64.ConditionalRegisterStateS: + inst = amd64.SETMI + case amd64.ConditionalRegisterStateNS: + inst = amd64.SETPL + case amd64.ConditionalRegisterStateG: + inst = amd64.SETGT + case amd64.ConditionalRegisterStateGE: + inst = amd64.SETGE + case amd64.ConditionalRegisterStateL: + inst = amd64.SETLT + case amd64.ConditionalRegisterStateLE: + inst = amd64.SETLE + case amd64.ConditionalRegisterStateA: + inst = amd64.SETHI + case amd64.ConditionalRegisterStateAE: + inst = amd64.SETCC + case amd64.ConditionalRegisterStateB: + inst = amd64.SETCS + case amd64.ConditionalRegisterStateBE: + inst = amd64.SETLS + } + + c.assembler.CompileNoneToRegister(inst, reg) + + // Then we reset the unnecessary bit. + c.assembler.CompileConstToRegister(amd64.ANDQ, 0x1, reg) + + // Mark it uses the register. + loc.setRegister(reg) + c.locationStack.markRegisterUsed(reg) +} + +// allocateRegister implements compiler.allocateRegister for amd64. +func (c *amd64Compiler) allocateRegister(t registerType) (reg asm.Register, err error) { + var ok bool + // Try to get the unused register. + reg, ok = c.locationStack.takeFreeRegister(t) + if ok { + return + } + + // If not found, we have to steal the register. + stealTarget, ok := c.locationStack.takeStealTargetFromUsedRegister(t) + if !ok { + err = fmt.Errorf("cannot steal register") + return + } + + // Release the steal target register value onto stack location. + reg = stealTarget.register + c.compileReleaseRegisterToStack(stealTarget) + return +} + +// callFunction adds instructions to call a function whose address equals either addr parameter or the value on indexReg. +// +// Note: this is the counterpart for returnFunction, and see the comments there as well +// to understand how the function calls are achieved. +func (c *amd64Compiler) compileCallFunctionImpl(functionAddressRegister asm.Register, functype *wasm.FunctionType) error { + // Release all the registers as our calling convention requires the caller-save. + if err := c.compileReleaseAllRegistersToStack(); err != nil { + return err + } + + c.locationStack.markRegisterUsed(functionAddressRegister) + + // Obtain a temporary register to be used in the followings. + tmpRegister, found := c.locationStack.takeFreeRegister(registerTypeGeneralPurpose) + if !found { + // This in theory never happen as all the registers must be free except codeAddressRegister. + return fmt.Errorf("could not find enough free registers") + } + + // The stack should look like: + // + // reserved slots for results (if len(results) > len(args)) + // | | + // ,arg0, ..., argN, ..., _, .returnAddress, .returnStackBasePointerInBytes, .function, .... + // | | | + // | callFrame{^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^} + // | + // nextStackBasePointerOffset + // + // where callFrame is used to return to this currently executed function. + + nextStackBasePointerOffset := int64(c.locationStack.sp) - int64(functype.ParamNumInUint64) + + callFrameReturnAddressLoc, callFrameStackBasePointerInBytesLoc, callFrameFunctionLoc := c.locationStack.pushCallFrame(functype) + + // Save the current stack base pointer at callFrameStackBasePointerInBytesLoc. + c.assembler.CompileMemoryToRegister(amd64.MOVQ, + amd64ReservedRegisterForCallEngine, callEngineStackContextStackBasePointerInBytesOffset, + tmpRegister) + callFrameStackBasePointerInBytesLoc.setRegister(tmpRegister) + c.compileReleaseRegisterToStack(callFrameStackBasePointerInBytesLoc) + + // Set callEngine.stackContext.stackBasePointer for the next function. + c.assembler.CompileConstToRegister(amd64.ADDQ, nextStackBasePointerOffset<<3, tmpRegister) + + // Write the calculated value to callEngine.stackContext.stackBasePointer. + c.assembler.CompileRegisterToMemory(amd64.MOVQ, tmpRegister, + amd64ReservedRegisterForCallEngine, callEngineStackContextStackBasePointerInBytesOffset) + + // Save the currently executed *function (placed at callEngine.moduleContext.fn) into callFrameFunctionLoc. + c.assembler.CompileMemoryToRegister(amd64.MOVQ, + amd64ReservedRegisterForCallEngine, callEngineModuleContextFnOffset, + tmpRegister) + callFrameFunctionLoc.setRegister(tmpRegister) + c.compileReleaseRegisterToStack(callFrameFunctionLoc) + + // Set callEngine.moduleContext.fn to the next *function. + c.assembler.CompileRegisterToMemory(amd64.MOVQ, functionAddressRegister, + amd64ReservedRegisterForCallEngine, callEngineModuleContextFnOffset) + + // Write the return address into callFrameReturnAddressLoc. + c.assembler.CompileReadInstructionAddress(tmpRegister, amd64.JMP) + callFrameReturnAddressLoc.setRegister(tmpRegister) + c.compileReleaseRegisterToStack(callFrameReturnAddressLoc) + + if amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister == functionAddressRegister { + // This case we must move the value on targetFunctionAddressRegister to another register, otherwise + // the address (jump target below) will be modified and result in segfault. + // See #526. + c.assembler.CompileRegisterToRegister(amd64.MOVQ, functionAddressRegister, tmpRegister) + functionAddressRegister = tmpRegister + } + + // Also, we have to put the target function's *wasm.ModuleInstance into amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister. + c.assembler.CompileMemoryToRegister(amd64.MOVQ, functionAddressRegister, functionModuleInstanceOffset, + amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister) + + // And jump into the initial address of the target function. + c.assembler.CompileJumpToMemory(amd64.JMP, functionAddressRegister, functionCodeInitialAddressOffset) + + // All the registers used are temporary, so we mark them unused. + c.locationStack.markRegisterUnused(tmpRegister, functionAddressRegister) + + // On the function return, we have to initialize the state. + if err := c.compileModuleContextInitialization(); err != nil { + return err + } + + // Due to the change to callEngine.stackContext.stackBasePointer. + c.compileReservedStackBasePointerInitialization() + + // Due to the change to callEngine.moduleContext.moduleInstance as that might result in + // the memory instance manipulation. + c.compileReservedMemoryPointerInitialization() + + // We consumed the function parameters, the call frame stack and reserved slots during the call. + c.locationStack.sp = uint64(nextStackBasePointerOffset) + + // Now the function results are pushed by the call. + for _, t := range functype.Results { + loc := c.locationStack.pushRuntimeValueLocationOnStack() + switch t { + case wasm.ValueTypeI32: + loc.valueType = runtimeValueTypeI32 + case wasm.ValueTypeI64, wasm.ValueTypeFuncref, wasm.ValueTypeExternref: + loc.valueType = runtimeValueTypeI64 + case wasm.ValueTypeF32: + loc.valueType = runtimeValueTypeF32 + case wasm.ValueTypeF64: + loc.valueType = runtimeValueTypeF64 + case wasm.ValueTypeV128: + loc.valueType = runtimeValueTypeV128Lo + hi := c.locationStack.pushRuntimeValueLocationOnStack() + hi.valueType = runtimeValueTypeV128Hi + default: + panic("BUG: invalid type: " + wasm.ValueTypeName(t)) + } + } + return nil +} + +// returnFunction adds instructions to return from the current callframe back to the caller's frame. +// If this is the current one is the origin, we return to the callEngine.execWasmFunction with the Returned status. +// Otherwise, we jump into the callers' return address stored in callFrame.returnAddress while setting +// up all the necessary change on the callEngine's state. +// +// Note: this is the counterpart for callFunction, and see the comments there as well +// to understand how the function calls are achieved. +func (c *amd64Compiler) compileReturnFunction() error { + // Release all the registers as our calling convention requires the caller-save. + if err := c.compileReleaseAllRegistersToStack(); err != nil { + return err + } + + if c.withListener { + if err := c.compileCallBuiltinFunction(builtinFunctionIndexFunctionListenerAfter); err != nil { + return err + } + // After return, we re-initialize the stack base pointer as that is used to return to the caller below. + c.compileReservedStackBasePointerInitialization() + } + + // amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister holds the module instance's address + // so mark it used so that it won't be used as a free register. + c.locationStack.markRegisterUsed(amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister) + defer c.locationStack.markRegisterUnused(amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister) + + // Obtain a temporary register to be used in the following. + returnAddressRegister, found := c.locationStack.takeFreeRegister(registerTypeGeneralPurpose) + if !found { + panic("BUG: all the registers should be free at this point: " + c.locationStack.String()) + } + + returnAddress, callerStackBasePointerInBytes, callerFunction := c.locationStack.getCallFrameLocations(c.typ) + + // A zero return address means return from the execution. + c.assembler.CompileMemoryToRegister(amd64.MOVQ, + amd64ReservedRegisterForStackBasePointerAddress, int64(returnAddress.stackPointer)*8, + returnAddressRegister, + ) + c.assembler.CompileRegisterToRegister(amd64.TESTQ, returnAddressRegister, returnAddressRegister) + + c.compileMaybeExitFromNativeCode(amd64.JNE, nativeCallStatusCodeReturned) + + // Alias for readability. + tmpRegister := amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister + + // First, restore the stackContext.stackBasePointerInBytesOffset from callerStackBasePointerInBytes. + callerStackBasePointerInBytes.setRegister(tmpRegister) + c.compileLoadValueOnStackToRegister(callerStackBasePointerInBytes) + c.assembler.CompileRegisterToMemory(amd64.MOVQ, + tmpRegister, amd64ReservedRegisterForCallEngine, callEngineStackContextStackBasePointerInBytesOffset) + + // Next, restore moduleContext.fn from callerFunction. + callerFunction.setRegister(tmpRegister) + c.compileLoadValueOnStackToRegister(callerFunction) + c.assembler.CompileRegisterToMemory(amd64.MOVQ, + tmpRegister, amd64ReservedRegisterForCallEngine, callEngineModuleContextFnOffset) + + // Also, we have to put the target function's *wasm.ModuleInstance into amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister. + c.assembler.CompileMemoryToRegister(amd64.MOVQ, + tmpRegister, functionModuleInstanceOffset, + amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister) + + // Then, jump into the return address! + c.assembler.CompileJumpToRegister(amd64.JMP, returnAddressRegister) + return nil +} + +func (c *amd64Compiler) compileCallGoHostFunction() error { + return c.compileCallGoFunction(nativeCallStatusCodeCallGoHostFunction) +} + +func (c *amd64Compiler) compileCallBuiltinFunction(index wasm.Index) error { + // Set the functionAddress to the callEngine.exitContext functionCallAddress. + c.assembler.CompileConstToMemory(amd64.MOVL, int64(index), amd64ReservedRegisterForCallEngine, callEngineExitContextBuiltinFunctionCallIndexOffset) + return c.compileCallGoFunction(nativeCallStatusCodeCallBuiltInFunction) +} + +func (c *amd64Compiler) compileCallGoFunction(compilerStatus nativeCallStatusCode) error { + // Release all the registers as our calling convention requires the caller-save. + if err := c.compileReleaseAllRegistersToStack(); err != nil { + return err + } + + c.compileExitFromNativeCode(compilerStatus) + return nil +} + +// compileReleaseAllRegistersToStack add the instructions to release all the LIVE value +// in the value location stack at this point into the stack memory location. +func (c *amd64Compiler) compileReleaseAllRegistersToStack() (err error) { + for i := uint64(0); i < c.locationStack.sp; i++ { + if loc := &c.locationStack.stack[i]; loc.onRegister() { + c.compileReleaseRegisterToStack(loc) + } else if loc.onConditionalRegister() { + if err = c.compileLoadConditionalRegisterToGeneralPurposeRegister(loc); err != nil { + return + } + c.compileReleaseRegisterToStack(loc) + } + } + return +} + +func (c *amd64Compiler) onValueReleaseRegisterToStack(reg asm.Register) { + for i := uint64(0); i < c.locationStack.sp; i++ { + prevValue := &c.locationStack.stack[i] + if prevValue.register == reg { + c.compileReleaseRegisterToStack(prevValue) + break + } + } +} + +// compileReleaseRegisterToStack implements compiler.compileReleaseRegisterToStack for amd64. +func (c *amd64Compiler) compileReleaseRegisterToStack(loc *runtimeValueLocation) { + var inst asm.Instruction + switch loc.valueType { + case runtimeValueTypeV128Lo: + inst = amd64.MOVDQU + case runtimeValueTypeV128Hi: + panic("BUG: V128Hi must be released to the stack along with V128Lo") + case runtimeValueTypeI32, runtimeValueTypeF32: + inst = amd64.MOVL + case runtimeValueTypeI64, runtimeValueTypeF64: + inst = amd64.MOVQ + default: + panic("BUG: unknown runtime value type") + } + + c.assembler.CompileRegisterToMemory(inst, loc.register, + // Note: stack pointers are ensured not to exceed 2^27 so this offset never exceeds 32-bit range. + amd64ReservedRegisterForStackBasePointerAddress, int64(loc.stackPointer)*8) + + // Mark the register is free. + c.locationStack.releaseRegister(loc) + + if loc.valueType == runtimeValueTypeV128Lo { + // Higher 64-bits are released as well ^^. + hi := &c.locationStack.stack[loc.stackPointer+1] + c.locationStack.releaseRegister(hi) + } +} + +func (c *amd64Compiler) compileMaybeExitFromNativeCode(skipCondition asm.Instruction, status nativeCallStatusCode) { + if target := c.compiledTrapTargets[status]; target != nil { + // We've already compiled this. + // Invert the return condition to jump into the appropriate target. + var returnCondition asm.Instruction + switch skipCondition { + case amd64.JHI: + returnCondition = amd64.JLS + case amd64.JLS: + returnCondition = amd64.JHI + case amd64.JNE: + returnCondition = amd64.JEQ + case amd64.JEQ: + returnCondition = amd64.JNE + case amd64.JCC: + returnCondition = amd64.JCS + case amd64.JCS: + returnCondition = amd64.JCC + case amd64.JPC: + returnCondition = amd64.JPS + case amd64.JPS: + returnCondition = amd64.JPC + case amd64.JPL: + returnCondition = amd64.JMI + case amd64.JMI: + returnCondition = amd64.JPL + default: + panic("BUG: couldn't invert condition") + } + c.assembler.CompileJump(returnCondition).AssignJumpTarget(target) + } else { + skip := c.assembler.CompileJump(skipCondition) + c.compileExitFromNativeCode(status) + c.assembler.SetJumpTargetOnNext(skip) + } +} + +func (c *amd64Compiler) compileExitFromNativeCode(status nativeCallStatusCode) { + if target := c.compiledTrapTargets[status]; target != nil { + c.assembler.CompileJump(amd64.JMP).AssignJumpTarget(target) + return + } + + switch status { + case nativeCallStatusCodeReturned: + // Save the target for reuse. + c.compiledTrapTargets[status] = c.compileNOP() + case nativeCallStatusCodeCallGoHostFunction, nativeCallStatusCodeCallBuiltInFunction: + // Read the return address, and write it to callEngine.exitContext.returnAddress. + returnAddressReg, ok := c.locationStack.takeFreeRegister(registerTypeGeneralPurpose) + if !ok { + panic("BUG: cannot take free register") + } + c.assembler.CompileReadInstructionAddress(returnAddressReg, amd64.RET) + c.assembler.CompileRegisterToMemory(amd64.MOVQ, + returnAddressReg, amd64ReservedRegisterForCallEngine, callEngineExitContextReturnAddressOffset) + default: + if c.ir.IROperationSourceOffsetsInWasmBinary != nil { + // This case, the execution traps and we want the top frame's source position in the stack trace. + // Take RegR15 and store the instruction address onto callEngine.returnAddress. + returnAddressReg := amd64.RegR15 + c.assembler.CompileReadInstructionAddress(returnAddressReg, amd64.MOVQ) + c.assembler.CompileRegisterToMemory(amd64.MOVQ, + returnAddressReg, amd64ReservedRegisterForCallEngine, callEngineExitContextReturnAddressOffset) + } else { + // We won't use the source position, so just save the target for reuse. + c.compiledTrapTargets[status] = c.compileNOP() + } + } + + // Write the status to callEngine.exitContext.statusCode. + c.assembler.CompileConstToMemory(amd64.MOVB, int64(status), + amd64ReservedRegisterForCallEngine, callEngineExitContextNativeCallStatusCodeOffset) + + // Write back the cached SP to the actual eng.stackPointer. + c.assembler.CompileConstToMemory(amd64.MOVQ, int64(c.locationStack.sp), + amd64ReservedRegisterForCallEngine, callEngineStackContextStackPointerOffset) + + c.assembler.CompileStandAlone(amd64.RET) +} + +func (c *amd64Compiler) compilePreamble() (err error) { + // We assume all function parameters are already pushed onto the stack by + // the caller. + c.locationStack.init(c.typ) + + if err := c.compileModuleContextInitialization(); err != nil { + return err + } + + // Check if it's necessary to grow the value stack by using max stack pointer. + if err = c.compileMaybeGrowStack(); err != nil { + return err + } + + if c.withListener { + if err = c.compileCallBuiltinFunction(builtinFunctionIndexFunctionListenerBefore); err != nil { + return err + } + } + + c.compileReservedStackBasePointerInitialization() + + // Finally, we initialize the reserved memory register based on the module context. + c.compileReservedMemoryPointerInitialization() + return +} + +func (c *amd64Compiler) compileReservedStackBasePointerInitialization() { + // First, make reservedRegisterForStackBasePointer point to the beginning of the slice backing array. + c.assembler.CompileMemoryToRegister(amd64.MOVQ, + amd64ReservedRegisterForCallEngine, callEngineStackContextStackElement0AddressOffset, + amd64ReservedRegisterForStackBasePointerAddress) + + // next we move the base pointer (callEngine.stackBasePointer) to the tmp register. + c.assembler.CompileMemoryToRegister(amd64.ADDQ, + amd64ReservedRegisterForCallEngine, callEngineStackContextStackBasePointerInBytesOffset, + amd64ReservedRegisterForStackBasePointerAddress, + ) +} + +func (c *amd64Compiler) compileReservedMemoryPointerInitialization() { + if c.ir.HasMemory || c.ir.UsesMemory { + c.assembler.CompileMemoryToRegister(amd64.MOVQ, + amd64ReservedRegisterForCallEngine, callEngineModuleContextMemoryElement0AddressOffset, + amd64ReservedRegisterForMemory, + ) + } +} + +// compileMaybeGrowStack adds instructions to check the necessity to grow the value stack, +// and if so, make the builtin function call to do so. These instructions are called in the function's +// preamble. +func (c *amd64Compiler) compileMaybeGrowStack() error { + tmpRegister, ok := c.locationStack.takeFreeRegister(registerTypeGeneralPurpose) + if !ok { + panic("BUG: cannot take free register") + } + + c.assembler.CompileMemoryToRegister(amd64.MOVQ, + amd64ReservedRegisterForCallEngine, callEngineStackContextStackLenInBytesOffset, tmpRegister) + c.assembler.CompileMemoryToRegister(amd64.SUBQ, + amd64ReservedRegisterForCallEngine, callEngineStackContextStackBasePointerInBytesOffset, tmpRegister) + + // If stack base pointer + max stack pointer > stackLen, we need to grow the stack. + cmpWithStackPointerCeil := c.assembler.CompileRegisterToConst(amd64.CMPQ, tmpRegister, 0) + c.assignStackPointerCeilNeeded = cmpWithStackPointerCeil + + // Jump if we have no need to grow. + jmpIfNoNeedToGrowStack := c.assembler.CompileJump(amd64.JCC) + + // Otherwise, we have to make the builtin function call to grow the call stack. + if err := c.compileCallBuiltinFunction(builtinFunctionIndexGrowStack); err != nil { + return err + } + + c.assembler.SetJumpTargetOnNext(jmpIfNoNeedToGrowStack) + return nil +} + +// compileModuleContextInitialization adds instructions to initialize callEngine.ModuleContext's fields based on +// callEngine.ModuleContext.ModuleInstanceAddress. +// This is called in two cases: in function preamble, and on the return from (non-Go) function calls. +func (c *amd64Compiler) compileModuleContextInitialization() error { + // amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister holds the module instance's address + // so mark it used so that it won't be used as a free register until the module context initialization finishes. + c.locationStack.markRegisterUsed(amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister) + defer c.locationStack.markRegisterUnused(amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister) + + // Obtain the temporary registers to be used in the followings. + tmpRegister, found := c.locationStack.takeFreeRegister(registerTypeGeneralPurpose) + if !found { + // This in theory never happen as all the registers must be free except indexReg. + return fmt.Errorf("could not find enough free registers") + } + c.locationStack.markRegisterUsed(tmpRegister) + tmpRegister2, found := c.locationStack.takeFreeRegister(registerTypeGeneralPurpose) + if !found { + // This in theory never happen as all the registers must be free except indexReg. + return fmt.Errorf("could not find enough free registers") + } + c.locationStack.markRegisterUsed(tmpRegister2) + + // If the module instance address stays the same, we could skip the entire code below. + // The rationale/idea for this is that, in almost all use cases, users instantiate a single + // Wasm binary and run the functions from it, rather than doing import/export on multiple + // binaries. As a result, this cmp and jmp instruction sequence below must be easy for + // x64 CPU to do branch prediction since almost 100% jump happens across function calls. + c.assembler.CompileMemoryToRegister(amd64.CMPQ, + amd64ReservedRegisterForCallEngine, callEngineModuleContextModuleInstanceOffset, amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister) + jmpIfModuleNotChange := c.assembler.CompileJump(amd64.JEQ) + + // If engine.ModuleContext.ModuleInstance is not equal the value on amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister, + // we have to put the new value there. + c.assembler.CompileRegisterToMemory(amd64.MOVQ, amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister, + amd64ReservedRegisterForCallEngine, callEngineModuleContextModuleInstanceOffset) + + // Also, we have to update the following fields: + // * callEngine.moduleContext.globalElement0Address + // * callEngine.moduleContext.tableElement0Address + // * callEngine.moduleContext.memoryInstance + // * callEngine.moduleContext.memoryElement0Address + // * callEngine.moduleContext.memorySliceLen + // * callEngine.moduleContext.codesElement0Address + // * callEngine.moduleContext.typeIDsElement0Address + // * callEngine.moduleContext.dataInstancesElement0Address + // * callEngine.moduleContext.elementInstancesElement0Address + + // Update globalElement0Address. + // + // Note: if there's global.get or set instruction in the function, the existence of the globals + // is ensured by function validation at module instantiation phase, and that's why it is ok to + // skip the initialization if the module's globals slice is empty. + if len(c.ir.Globals) > 0 { + // Since ModuleInstance.Globals is []*globalInstance, internally + // the address of the first item in the underlying array lies exactly on the globals offset. + // See https://go.dev/blog/slices-intro if unfamiliar. + c.assembler.CompileMemoryToRegister(amd64.MOVQ, amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister, moduleInstanceGlobalsOffset, tmpRegister) + + c.assembler.CompileRegisterToMemory(amd64.MOVQ, tmpRegister, amd64ReservedRegisterForCallEngine, callEngineModuleContextGlobalElement0AddressOffset) + } + + // Update tableElement0Address. + // + // Note: if there's table instruction in the function, the existence of the table + // is ensured by function validation at module instantiation phase, and that's + // why it is ok to skip the initialization if the module's table doesn't exist. + if c.ir.HasTable { + // First, we need to read the *wasm.Table. + c.assembler.CompileMemoryToRegister(amd64.MOVQ, amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister, moduleInstanceTablesOffset, tmpRegister) + + // At this point, tmpRegister holds the address of ModuleInstance.Table. + // So we are ready to read and put the first item's address stored in Table.Table. + // Here we read the value into tmpRegister2. + c.assembler.CompileRegisterToMemory(amd64.MOVQ, tmpRegister, + amd64ReservedRegisterForCallEngine, callEngineModuleContextTablesElement0AddressOffset) + + // Finally, we put &ModuleInstance.TypeIDs[0] into moduleContext.typeIDsElement0Address. + c.assembler.CompileMemoryToRegister(amd64.MOVQ, + amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister, moduleInstanceTypeIDsOffset, tmpRegister) + c.assembler.CompileRegisterToMemory(amd64.MOVQ, + tmpRegister, amd64ReservedRegisterForCallEngine, callEngineModuleContextTypeIDsElement0AddressOffset) + } + + // Update memoryElement0Address and memorySliceLen. + // + // Note: if there's memory instruction in the function, memory instance must be non-nil. + // That is ensured by function validation at module instantiation phase, and that's + // why it is ok to skip the initialization if the module's memory instance is nil. + if c.ir.HasMemory { + c.assembler.CompileMemoryToRegister(amd64.MOVQ, + amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister, moduleInstanceMemoryOffset, + tmpRegister) + + // Set memory instance. + c.assembler.CompileRegisterToMemory(amd64.MOVQ, tmpRegister, + amd64ReservedRegisterForCallEngine, callEngineModuleContextMemoryInstanceOffset) + + // Set length. + c.assembler.CompileMemoryToRegister(amd64.MOVQ, tmpRegister, memoryInstanceBufferLenOffset, tmpRegister2) + c.assembler.CompileRegisterToMemory(amd64.MOVQ, tmpRegister2, + amd64ReservedRegisterForCallEngine, callEngineModuleContextMemorySliceLenOffset) + + // Set element zero address. + c.assembler.CompileMemoryToRegister(amd64.MOVQ, tmpRegister, memoryInstanceBufferOffset, tmpRegister2) + c.assembler.CompileRegisterToMemory(amd64.MOVQ, tmpRegister2, + amd64ReservedRegisterForCallEngine, callEngineModuleContextMemoryElement0AddressOffset) + } + + // Update moduleContext.codesElement0Address + { + // "tmpRegister = [moduleInstanceAddressRegister + moduleInstanceEngineOffset + interfaceDataOffset] (== *moduleEngine)" + // + // Go's interface is laid out on memory as two quad words as struct {tab, data uintptr} + // where tab points to the interface table, and the latter points to the actual + // implementation of interface. This case, we extract "data" pointer as *moduleEngine. + // See the following references for detail: + // * https://research.swtch.com/interfaces + // * https://github.com/golang/go/blob/release-branch.go1.20/src/runtime/runtime2.go#L207-L210 + c.assembler.CompileMemoryToRegister(amd64.MOVQ, amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister, moduleInstanceEngineOffset+interfaceDataOffset, tmpRegister) + + // "tmpRegister = [tmpRegister + moduleEnginecodesOffset] (== &moduleEngine.codes[0])" + c.assembler.CompileMemoryToRegister(amd64.MOVQ, tmpRegister, moduleEngineFunctionsOffset, tmpRegister) + + // "callEngine.moduleContext.functionsElement0Address = tmpRegister". + c.assembler.CompileRegisterToMemory(amd64.MOVQ, tmpRegister, amd64ReservedRegisterForCallEngine, + callEngineModuleContextFunctionsElement0AddressOffset) + } + + // Update dataInstancesElement0Address. + if c.ir.HasDataInstances { + // "tmpRegister = &moduleInstance.DataInstances[0]" + c.assembler.CompileMemoryToRegister( + amd64.MOVQ, + amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister, moduleInstanceDataInstancesOffset, + tmpRegister, + ) + // "callEngine.moduleContext.dataInstancesElement0Address = tmpRegister". + c.assembler.CompileRegisterToMemory( + amd64.MOVQ, + tmpRegister, + amd64ReservedRegisterForCallEngine, callEngineModuleContextDataInstancesElement0AddressOffset, + ) + } + + // Update callEngine.moduleContext.elementInstancesElement0Address + if c.ir.HasElementInstances { + // "tmpRegister = &moduleInstance.ElementInstnaces[0]" + c.assembler.CompileMemoryToRegister( + amd64.MOVQ, + amd64CallingConventionDestinationFunctionModuleInstanceAddressRegister, moduleInstanceElementInstancesOffset, + tmpRegister, + ) + // "callEngine.moduleContext.dataInstancesElement0Address = tmpRegister". + c.assembler.CompileRegisterToMemory( + amd64.MOVQ, + tmpRegister, + amd64ReservedRegisterForCallEngine, callEngineModuleContextElementInstancesElement0AddressOffset, + ) + } + + c.locationStack.markRegisterUnused(tmpRegister, tmpRegister2) + + // Set the jump target towards the next instruction for the case where module instance address hasn't changed. + c.assembler.SetJumpTargetOnNext(jmpIfModuleNotChange) + return nil +} + +// compileEnsureOnRegister ensures that the given value is located on a +// general purpose register of an appropriate type. +func (c *amd64Compiler) compileEnsureOnRegister(loc *runtimeValueLocation) (err error) { + if loc.onStack() { + // Allocate the register. + reg, err := c.allocateRegister(loc.getRegisterType()) + if err != nil { + return err + } + + // Mark it uses the register. + loc.setRegister(reg) + c.locationStack.markRegisterUsed(reg) + + c.compileLoadValueOnStackToRegister(loc) + } else if loc.onConditionalRegister() { + err = c.compileLoadConditionalRegisterToGeneralPurposeRegister(loc) + } + return +} + +// compileMaybeSwapRegisters swaps two registers if they're not equal. +func (c *amd64Compiler) compileMaybeSwapRegisters(reg1, reg2 asm.Register) { + if reg1 != reg2 { + c.assembler.CompileRegisterToRegister(amd64.XCHGQ, reg1, reg2) + } +} + +// compilePreventCrossedTargetRegisters swaps registers in such a way, that for neither runtimeValueLocation from locs its +// corresponding register with the same index from targets is occupied by some other runtimeValueLocation from locs. It returns a +// closure to restore the original register placement. +// +// This function makes it possible to safely exchange one set of registers with another, where a register might be in both sets. +// Each register will correspond either to itself or another register not present in its own set. +// +// For example, if we have locs = [AX, BX, CX], targets = [BX, SI, AX], then it'll do two swaps +// to make locs = [BX, CX, AX]. +func (c *amd64Compiler) compilePreventCrossedTargetRegisters(locs []*runtimeValueLocation, targets []asm.Register) (restore func()) { + type swap struct{ srcIndex, dstIndex int } + var swaps []swap + for i := range locs { + targetLocation := -1 // -1 means not found. + for j := range locs { + if locs[j].register == targets[i] { + targetLocation = j + break + } + } + if targetLocation != -1 && targetLocation != i { + c.compileMaybeSwapRegisters(locs[i].register, locs[targetLocation].register) + locs[i].register, locs[targetLocation].register = locs[targetLocation].register, locs[i].register + swaps = append(swaps, swap{i, targetLocation}) + } + } + return func() { + // Restore in reverse order because a register can be moved multiple times. + for i := len(swaps) - 1; i >= 0; i -= 1 { + r1, r2 := swaps[i].srcIndex, swaps[i].dstIndex + c.compileMaybeSwapRegisters(locs[r1].register, locs[r2].register) + locs[r1].register, locs[r2].register = locs[r2].register, locs[r1].register + } + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/impl_arm64.go b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/impl_arm64.go new file mode 100644 index 000000000..b5be128fa --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/impl_arm64.go @@ -0,0 +1,4329 @@ +// This file implements the compiler for arm64 target. +// Please refer to https://developer.arm.com/documentation/102374/latest/ +// if unfamiliar with arm64 instructions and semantics. +package compiler + +import ( + "bytes" + "errors" + "fmt" + "math" + + "github.com/tetratelabs/wazero/internal/asm" + "github.com/tetratelabs/wazero/internal/asm/arm64" + "github.com/tetratelabs/wazero/internal/wasm" + "github.com/tetratelabs/wazero/internal/wazeroir" +) + +type arm64Compiler struct { + assembler arm64.Assembler + ir *wazeroir.CompilationResult + // locationStack holds the state of wazeroir virtual stack. + // and each item is either placed in register or the actual memory stack. + locationStack *runtimeValueLocationStack + // labels maps a label (e.g. ".L1_then") to *arm64LabelInfo. + labels [wazeroir.LabelKindNum][]arm64LabelInfo + // stackPointerCeil is the greatest stack pointer value (from runtimeValueLocationStack) seen during compilation. + stackPointerCeil uint64 + // assignStackPointerCeilNeeded holds an asm.Node whose AssignDestinationConstant must be called with the determined stack pointer ceiling. + assignStackPointerCeilNeeded asm.Node + compiledTrapTargets [nativeCallStatusModuleClosed]asm.Node + withListener bool + typ *wasm.FunctionType + br *bytes.Reader + // locationStackForEntrypoint is the initial location stack for all functions. To reuse the allocated stack, + // we cache it here, and reset and set to .locationStack in the Init method. + locationStackForEntrypoint runtimeValueLocationStack + // frameIDMax tracks the maximum value of frame id per function. + frameIDMax int + brTableTmp []runtimeValueLocation +} + +func newArm64Compiler() compiler { + return &arm64Compiler{ + assembler: arm64.NewAssembler(arm64ReservedRegisterForTemporary), + locationStackForEntrypoint: newRuntimeValueLocationStack(), + br: bytes.NewReader(nil), + } +} + +// Init implements compiler.Init. +func (c *arm64Compiler) Init(typ *wasm.FunctionType, ir *wazeroir.CompilationResult, withListener bool) { + c.assembler.Reset() + c.locationStackForEntrypoint.reset() + c.resetLabels() + + *c = arm64Compiler{ + ir: ir, + withListener: withListener, + typ: typ, + assembler: c.assembler, + labels: c.labels, + br: c.br, + brTableTmp: c.brTableTmp, + locationStackForEntrypoint: c.locationStackForEntrypoint, + } + + // Reuses the initial location stack for the compilation of subsequent functions. + c.locationStack = &c.locationStackForEntrypoint +} + +// resetLabels resets the existing content in arm64Compiler.labels so that +// we could reuse the allocated slices and stacks in the subsequent compilations. +func (c *arm64Compiler) resetLabels() { + for i := range c.labels { + for j := range c.labels[i] { + if j > c.frameIDMax { + // Only need to reset until the maximum frame id. This makes the compilation faster for large binary. + break + } + l := &c.labels[i][j] + l.initialInstruction = nil + l.stackInitialized = false + l.initialStack.reset() + } + } +} + +var ( + arm64UnreservedVectorRegisters = []asm.Register{ + arm64.RegV0, arm64.RegV1, arm64.RegV2, arm64.RegV3, + arm64.RegV4, arm64.RegV5, arm64.RegV6, arm64.RegV7, arm64.RegV8, + arm64.RegV9, arm64.RegV10, arm64.RegV11, arm64.RegV12, arm64.RegV13, + arm64.RegV14, arm64.RegV15, arm64.RegV16, arm64.RegV17, arm64.RegV18, + arm64.RegV19, arm64.RegV20, arm64.RegV21, arm64.RegV22, arm64.RegV23, + arm64.RegV24, arm64.RegV25, arm64.RegV26, arm64.RegV27, arm64.RegV28, + arm64.RegV29, arm64.RegV30, arm64.RegV31, + } + + // Note (see arm64 section in https://go.dev/doc/asm): + // * RegR18 is reserved as a platform register, and we don't use it in Compiler. + // * RegR28 is reserved for Goroutine by Go runtime, and we don't use it in Compiler. + arm64UnreservedGeneralPurposeRegisters = []asm.Register{ //nolint + arm64.RegR3, arm64.RegR4, arm64.RegR5, arm64.RegR6, arm64.RegR7, arm64.RegR8, + arm64.RegR9, arm64.RegR10, arm64.RegR11, arm64.RegR12, arm64.RegR13, + arm64.RegR14, arm64.RegR15, arm64.RegR16, arm64.RegR17, arm64.RegR19, + arm64.RegR20, arm64.RegR21, arm64.RegR22, arm64.RegR23, arm64.RegR24, + arm64.RegR25, arm64.RegR26, arm64.RegR29, arm64.RegR30, + } +) + +const ( + // arm64ReservedRegisterForCallEngine holds the pointer to callEngine instance (i.e. *callEngine as uintptr) + arm64ReservedRegisterForCallEngine = arm64.RegR0 + // arm64ReservedRegisterForStackBasePointerAddress holds stack base pointer's address (callEngine.stackBasePointer) in the current function call. + arm64ReservedRegisterForStackBasePointerAddress = arm64.RegR1 + // arm64ReservedRegisterForMemory holds the pointer to the memory slice's data (i.e. &memory.Buffer[0] as uintptr). + arm64ReservedRegisterForMemory = arm64.RegR2 + // arm64ReservedRegisterForTemporary is the temporary register which is available at any point of execution, but its content shouldn't be supposed to live beyond the single operation. + // Note: we choose R27 as that is the temporary register used in Go's assembler. + arm64ReservedRegisterForTemporary = arm64.RegR27 +) + +var arm64CallingConventionModuleInstanceAddressRegister = arm64.RegR29 + +const ( + // arm64CallEngineArchContextCompilerCallReturnAddressOffset is the offset of archContext.nativeCallReturnAddress in callEngine. + arm64CallEngineArchContextCompilerCallReturnAddressOffset = 144 + // arm64CallEngineArchContextMinimum32BitSignedIntOffset is the offset of archContext.minimum32BitSignedIntAddress in callEngine. + arm64CallEngineArchContextMinimum32BitSignedIntOffset = 152 + // arm64CallEngineArchContextMinimum64BitSignedIntOffset is the offset of archContext.minimum64BitSignedIntAddress in callEngine. + arm64CallEngineArchContextMinimum64BitSignedIntOffset = 160 +) + +func isZeroRegister(r asm.Register) bool { + return r == arm64.RegRZR +} + +// compileNOP implements compiler.compileNOP for the arm64 architecture. +func (c *arm64Compiler) compileNOP() asm.Node { + return c.assembler.CompileStandAlone(arm64.NOP) +} + +// compile implements compiler.compile for the arm64 architecture. +func (c *arm64Compiler) compile(buf asm.Buffer) (stackPointerCeil uint64, err error) { + // c.stackPointerCeil tracks the stack pointer ceiling (max seen) value across all runtimeValueLocationStack(s) + // used for all labels (via setLocationStack), excluding the current one. + // Hence, we check here if the final block's max one exceeds the current c.stackPointerCeil. + stackPointerCeil = c.stackPointerCeil + if stackPointerCeil < c.locationStack.stackPointerCeil { + stackPointerCeil = c.locationStack.stackPointerCeil + } + + // Now that the ceil of stack pointer is determined, we are invoking the callback. + // Note: this must be called before Assemble() below. + c.assignStackPointerCeil(stackPointerCeil) + + err = c.assembler.Assemble(buf) + return +} + +// arm64LabelInfo holds a wazeroir label specific information in this function. +type arm64LabelInfo struct { + // initialInstruction is the initial instruction for this label so other block can branch into it. + initialInstruction asm.Node + // initialStack is the initial value location stack from which we start compiling this label. + initialStack runtimeValueLocationStack + stackInitialized bool +} + +// assignStackPointerCeil implements compilerImpl.assignStackPointerCeil for the arm64 architecture. +func (c *arm64Compiler) assignStackPointerCeil(ceil uint64) { + if c.assignStackPointerCeilNeeded != nil { + c.assignStackPointerCeilNeeded.AssignSourceConstant(int64(ceil) << 3) + } +} + +func (c *arm64Compiler) label(label wazeroir.Label) *arm64LabelInfo { + kind := label.Kind() + frames := c.labels[kind] + frameID := label.FrameID() + if c.frameIDMax < frameID { + c.frameIDMax = frameID + } + // If the frameID is not allocated yet, expand the slice by twice of the diff, + // so that we could reduce the allocation in the subsequent compilation. + if diff := frameID - len(frames) + 1; diff > 0 { + for i := 0; i < diff; i++ { + frames = append(frames, arm64LabelInfo{initialStack: newRuntimeValueLocationStack()}) + } + c.labels[kind] = frames + } + return &frames[frameID] +} + +// runtimeValueLocationStack implements compilerImpl.runtimeValueLocationStack for the amd64 architecture. +func (c *arm64Compiler) runtimeValueLocationStack() *runtimeValueLocationStack { + return c.locationStack +} + +// pushRuntimeValueLocationOnRegister implements compiler.pushRuntimeValueLocationOnRegister for arm64. +func (c *arm64Compiler) pushRuntimeValueLocationOnRegister(reg asm.Register, vt runtimeValueType) (ret *runtimeValueLocation) { + ret = c.locationStack.pushRuntimeValueLocationOnRegister(reg, vt) + c.markRegisterUsed(reg) + return +} + +// pushVectorRuntimeValueLocationOnRegister implements compiler.pushVectorRuntimeValueLocationOnRegister for arm64. +func (c *arm64Compiler) pushVectorRuntimeValueLocationOnRegister(reg asm.Register) (lowerBitsLocation *runtimeValueLocation) { + lowerBitsLocation = c.locationStack.pushRuntimeValueLocationOnRegister(reg, runtimeValueTypeV128Lo) + c.locationStack.pushRuntimeValueLocationOnRegister(reg, runtimeValueTypeV128Hi) + c.markRegisterUsed(reg) + return +} + +func (c *arm64Compiler) markRegisterUsed(regs ...asm.Register) { + for _, reg := range regs { + if !isZeroRegister(reg) && reg != asm.NilRegister { + c.locationStack.markRegisterUsed(reg) + } + } +} + +func (c *arm64Compiler) markRegisterUnused(regs ...asm.Register) { + for _, reg := range regs { + if !isZeroRegister(reg) && reg != asm.NilRegister { + c.locationStack.markRegisterUnused(reg) + } + } +} + +func (c *arm64Compiler) String() (ret string) { return c.locationStack.String() } + +// compilePreamble implements compiler.compilePreamble for the arm64 architecture. +func (c *arm64Compiler) compilePreamble() error { + c.markRegisterUsed(arm64CallingConventionModuleInstanceAddressRegister) + defer c.markRegisterUnused(arm64CallingConventionModuleInstanceAddressRegister) + + c.locationStack.init(c.typ) + + // Check if it's necessary to grow the value stack before entering function body. + if err := c.compileMaybeGrowStack(); err != nil { + return err + } + + if err := c.compileModuleContextInitialization(); err != nil { + return err + } + + if c.withListener { + if err := c.compileCallGoFunction(nativeCallStatusCodeCallBuiltInFunction, builtinFunctionIndexFunctionListenerBefore); err != nil { + return err + } + } + + // We must initialize the stack base pointer register so that we can manipulate the stack properly. + c.compileReservedStackBasePointerRegisterInitialization() + + c.compileReservedMemoryRegisterInitialization() + + return nil +} + +// compileMaybeGrowStack adds instructions to check the necessity to grow the value stack, +// and if so, make the builtin function call to do so. These instructions are called in the function's +// preamble. +func (c *arm64Compiler) compileMaybeGrowStack() error { + tmpX, found := c.locationStack.takeFreeRegister(registerTypeGeneralPurpose) + if !found { + panic("BUG: all the registers should be free at this point") + } + c.markRegisterUsed(tmpX) + tmpY, found := c.locationStack.takeFreeRegister(registerTypeGeneralPurpose) + if !found { + panic("BUG: all the registers should be free at this point") + } + c.markRegisterUsed(tmpY) + + // "tmpX = len(ce.stack)" + c.assembler.CompileMemoryToRegister( + arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineStackContextStackLenInBytesOffset, + tmpX, + ) + + // "tmpY = ce.stackBasePointer" + c.assembler.CompileMemoryToRegister( + arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineStackContextStackBasePointerInBytesOffset, + tmpY, + ) + + // "tmpX = tmpX - tmpY", in other words "tmpX = len(ce.stack) - ce.stackBasePointer" + c.assembler.CompileRegisterToRegister( + arm64.SUB, + tmpY, + tmpX, + ) + + // "tmpY = stackPointerCeil" + loadStackPointerCeil := c.assembler.CompileConstToRegister( + arm64.MOVD, + math.MaxInt32, + tmpY, + ) + // At this point of compilation, we don't know the value of stack point ceil, + // so we lazily resolve the value later. + c.assignStackPointerCeilNeeded = loadStackPointerCeil + + // Compare tmpX (len(ce.stack) - ce.stackBasePointer) and tmpY (ce.stackPointerCeil) + c.assembler.CompileTwoRegistersToNone(arm64.CMP, tmpX, tmpY) + + // If ceil > stackLen - stack base pointer, we need to grow the stack by calling builtin Go function. + brIfStackOK := c.assembler.CompileJump(arm64.BCONDLS) + if err := c.compileCallGoFunction(nativeCallStatusCodeCallBuiltInFunction, builtinFunctionIndexGrowStack); err != nil { + return err + } + + // Otherwise, skip calling it. + c.assembler.SetJumpTargetOnNext(brIfStackOK) + + c.markRegisterUnused(tmpX, tmpY) + return nil +} + +// returnFunction emits instructions to return from the current function frame. +// If the current frame is the bottom, the code goes back to the Go code with nativeCallStatusCodeReturned status. +// Otherwise, we branch into the caller's return address. +func (c *arm64Compiler) compileReturnFunction() error { + // Release all the registers as our calling convention requires the caller-save. + if err := c.compileReleaseAllRegistersToStack(); err != nil { + return err + } + + if c.withListener { + if err := c.compileCallGoFunction(nativeCallStatusCodeCallBuiltInFunction, builtinFunctionIndexFunctionListenerAfter); err != nil { + return err + } + // After return, we re-initialize the stack base pointer as that is used to return to the caller below. + c.compileReservedStackBasePointerRegisterInitialization() + } + + // arm64CallingConventionModuleInstanceAddressRegister holds the module intstance's address + // so mark it used so that it won't be used as a free register. + c.locationStack.markRegisterUsed(arm64CallingConventionModuleInstanceAddressRegister) + defer c.locationStack.markRegisterUnused(arm64CallingConventionModuleInstanceAddressRegister) + + returnAddress, callerStackBasePointerInBytes, callerFunction := c.locationStack.getCallFrameLocations(c.typ) + + // If the return address is zero, meaning that we return from the execution. + returnAddress.setRegister(arm64ReservedRegisterForTemporary) + c.compileLoadValueOnStackToRegister(returnAddress) + c.assembler.CompileTwoRegistersToNone(arm64.CMP, arm64ReservedRegisterForTemporary, arm64.RegRZR) + + // Br if the address does not equal zero, otherwise, exit. + // If the address doesn't equal zero, return br into returnAddressRegister (caller's return address). + c.compileMaybeExitFromNativeCode(arm64.BCONDNE, nativeCallStatusCodeReturned) + + // Alias for readability. + tmp := arm64CallingConventionModuleInstanceAddressRegister + + // First, restore the stackContext.stackBasePointerInBytesOffset from callerStackBasePointerInBytes. + callerStackBasePointerInBytes.setRegister(tmp) + c.compileLoadValueOnStackToRegister(callerStackBasePointerInBytes) + c.assembler.CompileRegisterToMemory(arm64.STRD, tmp, + arm64ReservedRegisterForCallEngine, callEngineStackContextStackBasePointerInBytesOffset) + + // Next, restore moduleContext.fn from callerFunction. + callerFunction.setRegister(tmp) + c.compileLoadValueOnStackToRegister(callerFunction) + c.assembler.CompileRegisterToMemory(arm64.STRD, tmp, + arm64ReservedRegisterForCallEngine, callEngineModuleContextFnOffset) + + // Also, we have to put the target function's *wasm.ModuleInstance into arm64CallingConventionModuleInstanceAddressRegister. + c.assembler.CompileMemoryToRegister(arm64.LDRD, + tmp, functionModuleInstanceOffset, + arm64CallingConventionModuleInstanceAddressRegister) + + c.assembler.CompileJumpToRegister(arm64.B, returnAddress.register) + return nil +} + +func (c *arm64Compiler) compileMaybeExitFromNativeCode(skipCondition asm.Instruction, status nativeCallStatusCode) { + skip := c.assembler.CompileJump(skipCondition) + c.compileExitFromNativeCode(status) + c.assembler.SetJumpTargetOnNext(skip) +} + +// compileExitFromNativeCode adds instructions to give the control back to ce.exec with the given status code. +func (c *arm64Compiler) compileExitFromNativeCode(status nativeCallStatusCode) { + if target := c.compiledTrapTargets[status]; target != nil { + c.assembler.CompileJump(arm64.B).AssignJumpTarget(target) + return + } + + switch status { + case nativeCallStatusCodeReturned: + // Save the target for reuse. + c.compiledTrapTargets[status] = c.compileNOP() + case nativeCallStatusCodeCallGoHostFunction, nativeCallStatusCodeCallBuiltInFunction: + // Read the return address, and write it to callEngine.exitContext.returnAddress. + c.assembler.CompileReadInstructionAddress(arm64ReservedRegisterForTemporary, arm64.RET) + c.assembler.CompileRegisterToMemory( + arm64.STRD, arm64ReservedRegisterForTemporary, + arm64ReservedRegisterForCallEngine, callEngineExitContextReturnAddressOffset, + ) + default: + if c.ir.IROperationSourceOffsetsInWasmBinary != nil { + // This case, the execution traps, and we want the top frame's source position in the stack trace. + // We store the instruction address onto callEngine.returnAddress. + c.assembler.CompileReadInstructionAddress(arm64ReservedRegisterForTemporary, arm64.STRD) + c.assembler.CompileRegisterToMemory( + arm64.STRD, arm64ReservedRegisterForTemporary, + arm64ReservedRegisterForCallEngine, callEngineExitContextReturnAddressOffset, + ) + } else { + // We won't use the source position, so just save the target for reuse. + c.compiledTrapTargets[status] = c.compileNOP() + } + } + + // Write the current stack pointer to the ce.stackPointer. + c.assembler.CompileConstToRegister(arm64.MOVD, int64(c.locationStack.sp), arm64ReservedRegisterForTemporary) + c.assembler.CompileRegisterToMemory(arm64.STRD, arm64ReservedRegisterForTemporary, arm64ReservedRegisterForCallEngine, + callEngineStackContextStackPointerOffset) + + // Write the status to callEngine.exitContext.statusCode. + if status != 0 { + c.assembler.CompileConstToRegister(arm64.MOVW, int64(status), arm64ReservedRegisterForTemporary) + c.assembler.CompileRegisterToMemory(arm64.STRW, arm64ReservedRegisterForTemporary, + arm64ReservedRegisterForCallEngine, callEngineExitContextNativeCallStatusCodeOffset) + } else { + // If the status == 0, we use zero register to store zero. + c.assembler.CompileRegisterToMemory(arm64.STRW, arm64.RegRZR, + arm64ReservedRegisterForCallEngine, callEngineExitContextNativeCallStatusCodeOffset) + } + + // The return address to the Go code is stored in archContext.compilerReturnAddress which + // is embedded in ce. We load the value to the tmpRegister, and then + // invoke RET with that register. + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForCallEngine, arm64CallEngineArchContextCompilerCallReturnAddressOffset, + arm64ReservedRegisterForTemporary) + + c.assembler.CompileJumpToRegister(arm64.RET, arm64ReservedRegisterForTemporary) +} + +// compileGoHostFunction implements compiler.compileHostFunction for the arm64 architecture. +func (c *arm64Compiler) compileGoDefinedHostFunction() error { + // First we must update the location stack to reflect the number of host function inputs. + c.locationStack.init(c.typ) + + if c.withListener { + if err := c.compileCallGoFunction(nativeCallStatusCodeCallBuiltInFunction, + builtinFunctionIndexFunctionListenerBefore); err != nil { + return err + } + } + + // Host function needs access to the caller's Function Instance, and the caller's information is stored in the stack + // (as described in the doc of callEngine.stack). Here, we get the caller's *wasm.FunctionInstance from the stack, + // and save it in callEngine.exitContext.callerFunctionInstance so we can pass it to the host function + // without sacrificing the performance. + c.compileReservedStackBasePointerRegisterInitialization() + // Alias for readability. + tmp := arm64CallingConventionModuleInstanceAddressRegister + // Get the location of the callerFunction (*function) in the stack, which depends on the signature. + _, _, callerFunction := c.locationStack.getCallFrameLocations(c.typ) + // Load the value into the tmp register: tmp = &function{..} + callerFunction.setRegister(tmp) + c.compileLoadValueOnStackToRegister(callerFunction) + // tmp = *(tmp+functionModuleInstanceOffset) = &wasm.ModuleInstance{...} + c.assembler.CompileMemoryToRegister(arm64.LDRD, tmp, functionModuleInstanceOffset, tmp) + // Load it onto callEngine.exitContext.callerModuleInstance. + c.assembler.CompileRegisterToMemory(arm64.STRD, + tmp, + arm64ReservedRegisterForCallEngine, callEngineExitContextCallerModuleInstanceOffset) + // Reset the state of callerFunction value location so that we won't mess up subsequent code generation below. + c.locationStack.releaseRegister(callerFunction) + + if err := c.compileCallGoFunction(nativeCallStatusCodeCallGoHostFunction, 0); err != nil { + return err + } + + // Initializes the reserved stack base pointer which is used to retrieve the call frame stack. + c.compileReservedStackBasePointerRegisterInitialization() + + // Go function can change the module state in arbitrary way, so we have to force + // the callEngine.moduleContext initialization on the function return. To do so, + // we zero-out callEngine.moduleInstance. + c.assembler.CompileRegisterToMemory(arm64.STRD, + arm64.RegRZR, + arm64ReservedRegisterForCallEngine, callEngineModuleContextModuleInstanceOffset) + + return c.compileReturnFunction() +} + +// setLocationStack sets the given runtimeValueLocationStack to .locationStack field, +// while allowing us to track runtimeValueLocationStack.stackPointerCeil across multiple stacks. +// This is called when we branch into different block. +func (c *arm64Compiler) setLocationStack(newStack *runtimeValueLocationStack) { + if c.stackPointerCeil < c.locationStack.stackPointerCeil { + c.stackPointerCeil = c.locationStack.stackPointerCeil + } + c.locationStack = newStack +} + +// compileBuiltinFunctionCheckExitCode implements compiler.compileBuiltinFunctionCheckExitCode for the arm64 architecture. +func (c *arm64Compiler) compileBuiltinFunctionCheckExitCode() error { + if err := c.compileCallGoFunction(nativeCallStatusCodeCallBuiltInFunction, builtinFunctionIndexCheckExitCode); err != nil { + return err + } + + // After return, we re-initialize reserved registers just like preamble of functions. + c.compileReservedStackBasePointerRegisterInitialization() + c.compileReservedMemoryRegisterInitialization() + return nil +} + +// compileLabel implements compiler.compileLabel for the arm64 architecture. +func (c *arm64Compiler) compileLabel(o *wazeroir.UnionOperation) (skipThisLabel bool) { + labelKey := wazeroir.Label(o.U1) + labelInfo := c.label(labelKey) + + // If initialStack is not set, that means this label has never been reached. + if !labelInfo.stackInitialized { + skipThisLabel = true + return + } + + if labelBegin := labelInfo.initialInstruction; labelBegin == nil { + // We use NOP as a beginning of instructions in a label. + // This should be eventually optimized out by assembler. + labelInfo.initialInstruction = c.assembler.CompileStandAlone(arm64.NOP) + } else { + c.assembler.Add(labelBegin) + } + + // Set the initial stack. + c.setLocationStack(&labelInfo.initialStack) + return false +} + +// compileUnreachable implements compiler.compileUnreachable for the arm64 architecture. +func (c *arm64Compiler) compileUnreachable() error { + c.compileExitFromNativeCode(nativeCallStatusCodeUnreachable) + return nil +} + +// compileSet implements compiler.compileSet for the arm64 architecture. +func (c *arm64Compiler) compileSet(o *wazeroir.UnionOperation) error { + depth := int(o.U1) + isTargetVector := o.B3 + + setTargetIndex := int(c.locationStack.sp) - 1 - depth + + if isTargetVector { + _ = c.locationStack.pop() + } + v := c.locationStack.pop() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + + targetLocation := &c.locationStack.stack[setTargetIndex] + if targetLocation.onRegister() { + // We no longer need the register previously used by the target location. + c.markRegisterUnused(targetLocation.register) + } + + reg := v.register + targetLocation.setRegister(reg) + targetLocation.valueType = v.valueType + if isTargetVector { + hi := &c.locationStack.stack[setTargetIndex+1] + hi.setRegister(reg) + } + return nil +} + +// compileGlobalGet implements compiler.compileGlobalGet for the arm64 architecture. +func (c *arm64Compiler) compileGlobalGet(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + index := uint32(o.U1) + + wasmValueType := c.ir.Globals[index].ValType + isV128 := wasmValueType == wasm.ValueTypeV128 + // Get the address of globals[index] into globalAddressReg. + globalAddressReg, err := c.compileReadGlobalAddress(index) + if err != nil { + return err + } + + if isV128 { + resultReg, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + c.assembler.CompileConstToRegister(arm64.ADD, globalInstanceValueOffset, globalAddressReg) + c.assembler.CompileMemoryToVectorRegister(arm64.VMOV, globalAddressReg, 0, + resultReg, arm64.VectorArrangementQ) + + c.pushVectorRuntimeValueLocationOnRegister(resultReg) + } else { + ldr := arm64.NOP + var result asm.Register + var vt runtimeValueType + switch wasmValueType { + case wasm.ValueTypeI32: + ldr = arm64.LDRW + vt = runtimeValueTypeI32 + result = globalAddressReg + case wasm.ValueTypeI64, wasm.ValueTypeExternref, wasm.ValueTypeFuncref: + ldr = arm64.LDRD + vt = runtimeValueTypeI64 + result = globalAddressReg + case wasm.ValueTypeF32: + result, err = c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + ldr = arm64.FLDRS + vt = runtimeValueTypeF32 + case wasm.ValueTypeF64: + result, err = c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + ldr = arm64.FLDRD + vt = runtimeValueTypeF64 + } + + // "result = [globalAddressReg + globalInstanceValueOffset] (== globals[index].Val)" + c.assembler.CompileMemoryToRegister( + ldr, + globalAddressReg, globalInstanceValueOffset, + result, + ) + + c.pushRuntimeValueLocationOnRegister(result, vt) + } + return nil +} + +// compileGlobalSet implements compiler.compileGlobalSet for the arm64 architecture. +func (c *arm64Compiler) compileGlobalSet(o *wazeroir.UnionOperation) error { + index := uint32(o.U1) + + wasmValueType := c.ir.Globals[index].ValType + isV128 := wasmValueType == wasm.ValueTypeV128 + + var val *runtimeValueLocation + if isV128 { + val = c.locationStack.popV128() + } else { + val = c.locationStack.pop() + } + if err := c.compileEnsureOnRegister(val); err != nil { + return err + } + + globalInstanceAddressRegister, err := c.compileReadGlobalAddress(index) + if err != nil { + return err + } + + if isV128 { + c.assembler.CompileVectorRegisterToMemory(arm64.VMOV, + val.register, globalInstanceAddressRegister, globalInstanceValueOffset, + arm64.VectorArrangementQ) + } else { + var str asm.Instruction + switch c.ir.Globals[index].ValType { + case wasm.ValueTypeI32: + str = arm64.STRW + case wasm.ValueTypeI64, wasm.ValueTypeExternref, wasm.ValueTypeFuncref: + str = arm64.STRD + case wasm.ValueTypeF32: + str = arm64.FSTRS + case wasm.ValueTypeF64: + str = arm64.FSTRD + } + + // At this point "globalInstanceAddressRegister = globals[index]". + // Therefore, this means "globals[index].Val = val.register" + c.assembler.CompileRegisterToMemory( + str, + val.register, + globalInstanceAddressRegister, globalInstanceValueOffset, + ) + } + + c.markRegisterUnused(val.register) + return nil +} + +// compileReadGlobalAddress adds instructions to store the absolute address of the global instance at globalIndex into a register +func (c *arm64Compiler) compileReadGlobalAddress(globalIndex uint32) (destinationRegister asm.Register, err error) { + // TODO: rethink about the type used in store `globals []*GlobalInstance`. + // If we use `[]GlobalInstance` instead, we could reduce one MOV instruction here. + + destinationRegister, err = c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return + } + + // "destinationRegister = globalIndex * 8" + c.assembler.CompileConstToRegister( + // globalIndex is an index to []*GlobalInstance, therefore + // we have to multiply it by the size of *GlobalInstance == the pointer size == 8. + arm64.MOVD, int64(globalIndex)*8, destinationRegister, + ) + + // "arm64ReservedRegisterForTemporary = &globals[0]" + c.assembler.CompileMemoryToRegister( + arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineModuleContextGlobalElement0AddressOffset, + arm64ReservedRegisterForTemporary, + ) + + // "destinationRegister = [arm64ReservedRegisterForTemporary + destinationRegister] (== globals[globalIndex])". + c.assembler.CompileMemoryWithRegisterOffsetToRegister( + arm64.LDRD, + arm64ReservedRegisterForTemporary, destinationRegister, + destinationRegister, + ) + return +} + +// compileBr implements compiler.compileBr for the arm64 architecture. +func (c *arm64Compiler) compileBr(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + return c.compileBranchInto(wazeroir.Label(o.U1)) +} + +// compileBrIf implements compiler.compileBrIf for the arm64 architecture. +func (c *arm64Compiler) compileBrIf(o *wazeroir.UnionOperation) error { + cond := c.locationStack.pop() + + var conditionalBR asm.Node + if cond.onConditionalRegister() { + // If the cond is on a conditional register, it corresponds to one of "conditional codes" + // https://developer.arm.com/documentation/dui0801/a/Condition-Codes/Condition-code-suffixes + // Here we represent the conditional codes by using arm64.COND_** registers, and that means the + // conditional jump can be performed if we use arm64.B**. + // For example, if we have arm64.CondEQ on cond, that means we performed compileEq right before + // this compileBrIf and BrIf can be achieved by arm64.BCONDEQ. + var brInst asm.Instruction + switch cond.conditionalRegister { + case arm64.CondEQ: + brInst = arm64.BCONDEQ + case arm64.CondNE: + brInst = arm64.BCONDNE + case arm64.CondHS: + brInst = arm64.BCONDHS + case arm64.CondLO: + brInst = arm64.BCONDLO + case arm64.CondMI: + brInst = arm64.BCONDMI + case arm64.CondHI: + brInst = arm64.BCONDHI + case arm64.CondLS: + brInst = arm64.BCONDLS + case arm64.CondGE: + brInst = arm64.BCONDGE + case arm64.CondLT: + brInst = arm64.BCONDLT + case arm64.CondGT: + brInst = arm64.BCONDGT + case arm64.CondLE: + brInst = arm64.BCONDLE + default: + // BUG: This means that we use the cond.conditionalRegister somewhere in this file, + // but not covered in switch ^. That shouldn't happen. + return fmt.Errorf("unsupported condition for br_if: %v", cond.conditionalRegister) + } + conditionalBR = c.assembler.CompileJump(brInst) + } else { + // If the value is not on the conditional register, we compare the value with the zero register, + // and then do the conditional BR if the value doesn't equal zero. + if err := c.compileEnsureOnRegister(cond); err != nil { + return err + } + // Compare the value with zero register. Note that the value is ensured to be i32 by function validation phase, + // so we use CMPW (32-bit compare) here. + c.assembler.CompileTwoRegistersToNone(arm64.CMPW, cond.register, arm64.RegRZR) + + conditionalBR = c.assembler.CompileJump(arm64.BCONDNE) + + c.markRegisterUnused(cond.register) + } + + // Emit the code for branching into else branch. + elseTarget := wazeroir.Label(o.U2) + if err := c.compileBranchInto(elseTarget); err != nil { + return err + } + // We branch into here from the original conditional BR (conditionalBR). + c.assembler.SetJumpTargetOnNext(conditionalBR) + thenTarget := wazeroir.Label(o.U1) + if err := compileDropRange(c, o.U3); err != nil { + return err + } + return c.compileBranchInto(thenTarget) +} + +func (c *arm64Compiler) compileBranchInto(target wazeroir.Label) error { + if target.IsReturnTarget() { + return c.compileReturnFunction() + } else { + if c.ir.LabelCallers[target] > 1 { + // We can only re-use register state if when there's a single call-site. + // Release existing values on registers to the stack if there's multiple ones to have + // the consistent value location state at the beginning of label. + if err := c.compileReleaseAllRegistersToStack(); err != nil { + return err + } + } + // Set the initial stack of the target label, so we can start compiling the label + // with the appropriate value locations. Note we clone the stack here as we maybe + // manipulate the stack before compiler reaches the label. + targetLabel := c.label(target) + if !targetLabel.stackInitialized { + targetLabel.initialStack.cloneFrom(*c.locationStack) + targetLabel.stackInitialized = true + } + + br := c.assembler.CompileJump(arm64.B) + c.assignBranchTarget(target, br) + return nil + } +} + +// assignBranchTarget assigns the given label's initial instruction to the destination of br. +func (c *arm64Compiler) assignBranchTarget(label wazeroir.Label, br asm.Node) { + target := c.label(label) + + targetInst := target.initialInstruction + if targetInst == nil { + // If the label isn't compiled yet, allocate the NOP node, and set as the initial instruction. + targetInst = c.assembler.AllocateNOP() + target.initialInstruction = targetInst + } + + br.AssignJumpTarget(targetInst) +} + +// compileBrTable implements compiler.compileBrTable for the arm64 architecture. +func (c *arm64Compiler) compileBrTable(o *wazeroir.UnionOperation) error { + // If the operation only consists of the default target, we branch into it and return early. + if len(o.Us) == 2 { + loc := c.locationStack.pop() + if loc.onRegister() { + c.markRegisterUnused(loc.register) + } + if err := compileDropRange(c, o.Us[1]); err != nil { + return err + } + return c.compileBranchInto(wazeroir.Label(o.Us[0])) + } + + index := c.locationStack.pop() + if err := c.compileEnsureOnRegister(index); err != nil { + return err + } + + if isZeroRegister(index.register) { + reg, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + index.setRegister(reg) + c.markRegisterUsed(reg) + + // Zero the value on a picked register. + c.assembler.CompileRegisterToRegister(arm64.MOVD, arm64.RegRZR, reg) + } + + tmpReg, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + // Load the branch table's length. + // "tmpReg = len(o.Targets)" + c.assembler.CompileConstToRegister(arm64.MOVW, int64(len(o.Us)/2-1), tmpReg) + // Compare the length with offset. + c.assembler.CompileTwoRegistersToNone(arm64.CMPW, tmpReg, index.register) + // If the value exceeds the length, we will branch into the default target (corresponding to len(o.Targets) index). + brDefaultIndex := c.assembler.CompileJump(arm64.BCONDLO) + c.assembler.CompileRegisterToRegister(arm64.MOVW, tmpReg, index.register) + c.assembler.SetJumpTargetOnNext(brDefaultIndex) + + // We prepare the asm.StaticConst which holds the offset of + // each target's first instruction (incl. default) + // relative to the beginning of label tables. + // + // For example, if we have targets=[L0, L1] and default=L_DEFAULT, + // we emit the code like this at [Emit the code for each target and default branch] below. + // + // L0: + // 0x123001: XXXX, ... + // ..... + // L1: + // 0x123005: YYY, ... + // ..... + // L_DEFAULT: + // 0x123009: ZZZ, ... + // + // then offsetData becomes like [0x0, 0x5, 0x8]. + // By using this offset list, we could jump into the label for the index by + // "jmp offsetData[index]+0x123001" and "0x123001" can be acquired by ADR instruction. + // + // Note: We store each offset of 32-bit unsigned integer as 4 consecutive bytes. So more precisely, + // the above example's offsetData would be [0x0, 0x0, 0x0, 0x0, 0x5, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0]. + // + // Note: this is similar to how GCC implements Switch statements in C. + offsetData := asm.NewStaticConst(make([]byte, 4*(len(o.Us)/2))) + + // "tmpReg = &offsetData[0]" + c.assembler.CompileStaticConstToRegister(arm64.ADR, offsetData, tmpReg) + + // "index.register = tmpReg + (index.register << 2) (== &offsetData[offset])" + c.assembler.CompileLeftShiftedRegisterToRegister(arm64.ADD, index.register, 2, tmpReg, index.register) + + // "index.register = *index.register (== offsetData[offset])" + c.assembler.CompileMemoryToRegister(arm64.LDRW, index.register, 0, index.register) + + // Now we read the address of the beginning of the jump table. + // In the above example, this corresponds to reading the address of 0x123001. + c.assembler.CompileReadInstructionAddress(tmpReg, arm64.B) + + // Now we have the address of L0 in tmp register, and the offset to the target label in the index.register. + // So we could achieve the br_table jump by adding them and jump into the resulting address. + c.assembler.CompileRegisterToRegister(arm64.ADD, tmpReg, index.register) + + c.assembler.CompileJumpToRegister(arm64.B, index.register) + + // We no longer need the index's register, so mark it unused. + c.markRegisterUnused(index.register) + + // [Emit the code for each targets and default branch] + labelInitialInstructions := make([]asm.Node, len(o.Us)/2) + + // Since we might end up having the different stack state in each branch, + // we need to save the initial stack state here, and use the same initial state + // for each iteration. + initialLocationStack := c.getSavedTemporaryLocationStack() + + for i := range labelInitialInstructions { + // Emit the initial instruction of each target where + // we use NOP as we don't yet know the next instruction in each label. + init := c.assembler.CompileStandAlone(arm64.NOP) + labelInitialInstructions[i] = init + + targetLabel := wazeroir.Label(o.Us[i*2]) + targetToDrop := o.Us[i*2+1] + if err = compileDropRange(c, targetToDrop); err != nil { + return err + } + if err = c.compileBranchInto(targetLabel); err != nil { + return err + } + // After the iteration, reset the stack's state with initialLocationStack. + c.locationStack.cloneFrom(initialLocationStack) + } + + c.assembler.BuildJumpTable(offsetData, labelInitialInstructions) + return nil +} + +func (c *arm64Compiler) getSavedTemporaryLocationStack() runtimeValueLocationStack { + initialLocationStack := *c.locationStack // Take copy! + // Use c.brTableTmp for the underlying stack so that we could reduce the allocations. + if diff := int(initialLocationStack.sp) - len(c.brTableTmp); diff > 0 { + c.brTableTmp = append(c.brTableTmp, make([]runtimeValueLocation, diff)...) + } + copy(c.brTableTmp, initialLocationStack.stack[:initialLocationStack.sp]) + initialLocationStack.stack = c.brTableTmp + return initialLocationStack +} + +// compileCall implements compiler.compileCall for the arm64 architecture. +func (c *arm64Compiler) compileCall(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + functionIndex := o.U1 + + tp := &c.ir.Types[c.ir.Functions[functionIndex]] + + targetFunctionAddressReg, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.markRegisterUsed(targetFunctionAddressReg) + defer c.markRegisterUnused(targetFunctionAddressReg) + + // 3) Set rc.next to specify which function is executed on the current call frame. + // + // First, we read the address of the first item of ce.functions slice (= &ce.functions[0]) + // into tmp. + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineModuleContextFunctionsElement0AddressOffset, + targetFunctionAddressReg) + + c.assembler.CompileConstToRegister( + arm64.ADD, + int64(functionIndex)*functionSize, // * 8 because the size of *function equals 8 bytes. + targetFunctionAddressReg) + + return c.compileCallImpl(targetFunctionAddressReg, tp) +} + +// compileCallImpl implements compiler.compileCall and compiler.compileCallIndirect for the arm64 architecture. +func (c *arm64Compiler) compileCallImpl(targetFunctionAddressRegister asm.Register, functype *wasm.FunctionType) error { + // Release all the registers as our calling convention requires the caller-save. + if err := c.compileReleaseAllRegistersToStack(); err != nil { + return err + } + + tmp, ok := c.locationStack.takeFreeRegister(registerTypeGeneralPurpose) + if !ok { + panic("BUG: cannot take a free register") + } + + // The stack should look like: + // + // reserved slots for results (if len(results) > len(args)) + // | | + // ,arg0, ..., argN, ..., _, .returnAddress, .returnStackBasePointerInBytes, .function, .... + // | | | + // | callFrame{^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^} + // | + // nextStackBasePointerOffset + // + // where callFrame is used to return to this currently executed function. + + nextStackBasePointerOffset := int64(c.locationStack.sp) - int64(functype.ParamNumInUint64) + + callFrameReturnAddressLoc, callFrameStackBasePointerInBytesLoc, callFrameFunctionLoc := c.locationStack.pushCallFrame(functype) + + // Save the current stack base pointer at callFrameStackBasePointerInBytesLoc. + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineStackContextStackBasePointerInBytesOffset, + tmp) + callFrameStackBasePointerInBytesLoc.setRegister(tmp) + c.compileReleaseRegisterToStack(callFrameStackBasePointerInBytesLoc) + + // Set callEngine.stackContext.stackBasePointer for the next function. + c.assembler.CompileConstToRegister(arm64.ADD, nextStackBasePointerOffset<<3, tmp) + c.assembler.CompileRegisterToMemory(arm64.STRD, + tmp, + arm64ReservedRegisterForCallEngine, callEngineStackContextStackBasePointerInBytesOffset) + + // Save the currently executed *function (placed at callEngine.moduleContext.fn) into callFrameFunctionLoc. + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineModuleContextFnOffset, + tmp) + callFrameFunctionLoc.setRegister(tmp) + c.compileReleaseRegisterToStack(callFrameFunctionLoc) + + // Set callEngine.moduleContext.fn to the next *function. + c.assembler.CompileRegisterToMemory(arm64.STRD, + targetFunctionAddressRegister, + arm64ReservedRegisterForCallEngine, callEngineModuleContextFnOffset) + + // Write the return address into callFrameReturnAddressLoc. + c.assembler.CompileReadInstructionAddress(tmp, arm64.B) + callFrameReturnAddressLoc.setRegister(tmp) + c.compileReleaseRegisterToStack(callFrameReturnAddressLoc) + + if targetFunctionAddressRegister == arm64CallingConventionModuleInstanceAddressRegister { + // This case we must move the value on targetFunctionAddressRegister to another register, otherwise + // the address (jump target below) will be modified and result in segfault. + // See #526. + c.assembler.CompileRegisterToRegister(arm64.MOVD, targetFunctionAddressRegister, tmp) + targetFunctionAddressRegister = tmp + } + + // Also, we have to put the code's moduleInstance address into arm64CallingConventionModuleInstanceAddressRegister. + c.assembler.CompileMemoryToRegister(arm64.LDRD, + targetFunctionAddressRegister, functionModuleInstanceOffset, + arm64CallingConventionModuleInstanceAddressRegister, + ) + + // Then, br into the target function's initial address. + c.assembler.CompileMemoryToRegister(arm64.LDRD, + targetFunctionAddressRegister, functionCodeInitialAddressOffset, + targetFunctionAddressRegister) + + c.assembler.CompileJumpToRegister(arm64.B, targetFunctionAddressRegister) + + // We consumed the function parameters, the call frame stack and reserved slots during the call. + c.locationStack.sp = uint64(nextStackBasePointerOffset) + + // Also, the function results were pushed by the call. + for _, t := range functype.Results { + loc := c.locationStack.pushRuntimeValueLocationOnStack() + switch t { + case wasm.ValueTypeI32: + loc.valueType = runtimeValueTypeI32 + case wasm.ValueTypeI64, wasm.ValueTypeFuncref, wasm.ValueTypeExternref: + loc.valueType = runtimeValueTypeI64 + case wasm.ValueTypeF32: + loc.valueType = runtimeValueTypeF32 + case wasm.ValueTypeF64: + loc.valueType = runtimeValueTypeF64 + case wasm.ValueTypeV128: + loc.valueType = runtimeValueTypeV128Lo + hi := c.locationStack.pushRuntimeValueLocationOnStack() + hi.valueType = runtimeValueTypeV128Hi + } + } + + if err := c.compileModuleContextInitialization(); err != nil { + return err + } + + // On the function return, we initialize the state for this function. + c.compileReservedStackBasePointerRegisterInitialization() + + c.compileReservedMemoryRegisterInitialization() + return nil +} + +// compileCallIndirect implements compiler.compileCallIndirect for the arm64 architecture. +func (c *arm64Compiler) compileCallIndirect(o *wazeroir.UnionOperation) (err error) { + offset := c.locationStack.pop() + if err = c.compileEnsureOnRegister(offset); err != nil { + return err + } + typeIndex := o.U1 + tableIndex := o.U2 + + offsetReg := offset.register + if isZeroRegister(offsetReg) { + offsetReg, err = c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.markRegisterUsed(offsetReg) + + // Zero the value on a picked register. + c.assembler.CompileRegisterToRegister(arm64.MOVD, arm64.RegRZR, offsetReg) + } + + tmp, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.markRegisterUsed(tmp) + + tmp2, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.markRegisterUsed(tmp2) + + // First, we need to check if the offset doesn't exceed the length of table. + // "tmp = &Tables[0]" + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineModuleContextTablesElement0AddressOffset, + tmp, + ) + // tmp = [tmp + TableIndex*8] = [&Tables[0] + TableIndex*sizeOf(*tableInstance)] = Tables[tableIndex] + c.assembler.CompileMemoryToRegister(arm64.LDRD, + tmp, int64(tableIndex)*8, + tmp, + ) + // tmp2 = [tmp + tableInstanceTableLenOffset] = len(Tables[tableIndex]) + c.assembler.CompileMemoryToRegister(arm64.LDRD, tmp, tableInstanceTableLenOffset, tmp2) + + // "cmp tmp2, offset" + c.assembler.CompileTwoRegistersToNone(arm64.CMP, tmp2, offsetReg) + + // If it exceeds len(table), we trap. + c.compileMaybeExitFromNativeCode(arm64.BCONDLO, nativeCallStatusCodeInvalidTableAccess) + // Otherwise, we proceed to do function type check. + + // We need to obtain the absolute address of table element. + // "tmp = &Tables[tableIndex].table[0]" + c.assembler.CompileMemoryToRegister( + arm64.LDRD, + tmp, tableInstanceTableOffset, + tmp, + ) + // "offset = tmp + (offset << pointerSizeLog2) (== &table[offset])" + // Here we left shifting by 3 in order to get the offset in bytes, + // and the table element type is uintptr which is 8 bytes. + c.assembler.CompileLeftShiftedRegisterToRegister( + arm64.ADD, + offsetReg, pointerSizeLog2, + tmp, + offsetReg, + ) + + // "offset = (*offset) (== table[offset])" + c.assembler.CompileMemoryToRegister(arm64.LDRD, offsetReg, 0, offsetReg) + + // Check if the value of table[offset] equals zero, meaning that the target element is uninitialized. + c.assembler.CompileTwoRegistersToNone(arm64.CMP, arm64.RegRZR, offsetReg) + + // Skipped if the target is initialized. + c.compileMaybeExitFromNativeCode(arm64.BCONDNE, nativeCallStatusCodeInvalidTableAccess) + + // next we check the type matches, i.e. table[offset].source.TypeID == targetFunctionType. + // "tmp = table[offset].typeID" + c.assembler.CompileMemoryToRegister( + arm64.LDRD, + offsetReg, functionTypeIDOffset, + tmp, + ) + // "tmp2 = ModuleInstance.TypeIDs[index]" + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineModuleContextTypeIDsElement0AddressOffset, + tmp2) + c.assembler.CompileMemoryToRegister(arm64.LDRW, tmp2, int64(typeIndex)*4, tmp2) + + // Compare these two values, and if they equal, we are ready to make function call. + c.assembler.CompileTwoRegistersToNone(arm64.CMPW, tmp, tmp2) + // Skipped if the type matches. + c.compileMaybeExitFromNativeCode(arm64.BCONDEQ, nativeCallStatusCodeTypeMismatchOnIndirectCall) + + targetFunctionType := &c.ir.Types[typeIndex] + if err := c.compileCallImpl(offsetReg, targetFunctionType); err != nil { + return err + } + + // The offset register should be marked as un-used as we consumed in the function call. + c.markRegisterUnused(offsetReg, tmp, tmp2) + return nil +} + +// compileDrop implements compiler.compileDrop for the arm64 architecture. +func (c *arm64Compiler) compileDrop(o *wazeroir.UnionOperation) error { + return compileDropRange(c, o.U1) +} + +func (c *arm64Compiler) compileSelectV128Impl(selectorRegister asm.Register) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + c.assembler.CompileTwoRegistersToNone(arm64.CMPW, arm64.RegRZR, selectorRegister) + brIfNotZero := c.assembler.CompileJump(arm64.BCONDNE) + + // In this branch, we select the value of x2, so we move the value into x1.register so that + // we can have the result in x1.register regardless of the selection. + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.VORR, + x2.register, x2.register, x1.register, arm64.VectorArrangement16B) + + c.assembler.SetJumpTargetOnNext(brIfNotZero) + + // As noted, the result exists in x1.register regardless of the selector. + c.pushVectorRuntimeValueLocationOnRegister(x1.register) + // Plus, x2.register is no longer used. + c.markRegisterUnused(x2.register) + return nil +} + +// compileSelect implements compiler.compileSelect for the arm64 architecture. +func (c *arm64Compiler) compileSelect(o *wazeroir.UnionOperation) error { + cv, err := c.popValueOnRegister() + if err != nil { + return err + } + + isTargetVector := o.B3 + if isTargetVector { + return c.compileSelectV128Impl(cv.register) + } + + c.markRegisterUsed(cv.register) + + x1, x2, err := c.popTwoValuesOnRegisters() + if err != nil { + return err + } + + if isZeroRegister(x1.register) && isZeroRegister(x2.register) { + // If both values are zero, the result is always zero. + c.pushRuntimeValueLocationOnRegister(arm64.RegRZR, x1.valueType) + c.markRegisterUnused(cv.register) + return nil + } + + // In the following, we emit the code so that x1's register contains the chosen value + // no matter which of original x1 or x2 is selected. + // + // If x1 is currently on zero register, we cannot place the result because + // "MOV arm64.RegRZR x2.register" results in arm64.RegRZR regardless of the value. + // So we explicitly assign a general purpose register to x1 here. + if isZeroRegister(x1.register) { + // Mark x2 and cv's registers are used so they won't be chosen. + c.markRegisterUsed(x2.register) + // Pick the non-zero register for x1. + x1Reg, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + x1.setRegister(x1Reg) + // And zero our the picked register. + c.assembler.CompileRegisterToRegister(arm64.MOVD, arm64.RegRZR, x1Reg) + } + + // At this point, x1 is non-zero register, and x2 is either general purpose or zero register. + + c.assembler.CompileTwoRegistersToNone(arm64.CMPW, arm64.RegRZR, cv.register) + brIfNotZero := c.assembler.CompileJump(arm64.BCONDNE) + + // If cv == 0, we move the value of x2 to the x1.register. + + switch x1.valueType { + case runtimeValueTypeI32: + // TODO: use 32-bit mov + c.assembler.CompileRegisterToRegister(arm64.MOVD, x2.register, x1.register) + case runtimeValueTypeI64: + c.assembler.CompileRegisterToRegister(arm64.MOVD, x2.register, x1.register) + case runtimeValueTypeF32: + // TODO: use 32-bit mov + c.assembler.CompileRegisterToRegister(arm64.FMOVD, x2.register, x1.register) + case runtimeValueTypeF64: + c.assembler.CompileRegisterToRegister(arm64.FMOVD, x2.register, x1.register) + default: + return errors.New("TODO: implement vector type select") + } + + c.pushRuntimeValueLocationOnRegister(x1.register, x1.valueType) + + // Otherwise, nothing to do for select. + c.assembler.SetJumpTargetOnNext(brIfNotZero) + + // Only x1.register is reused. + c.markRegisterUnused(cv.register, x2.register) + return nil +} + +// compilePick implements compiler.compilePick for the arm64 architecture. +func (c *arm64Compiler) compilePick(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + depth := o.U1 + isTargetVector := o.B3 + + pickTarget := &c.locationStack.stack[c.locationStack.sp-1-uint64(depth)] + pickedRegister, err := c.allocateRegister(pickTarget.getRegisterType()) + if err != nil { + return err + } + + if pickTarget.onRegister() { // Copy the value to the pickedRegister. + switch pickTarget.valueType { + case runtimeValueTypeI32: + c.assembler.CompileRegisterToRegister(arm64.MOVW, pickTarget.register, pickedRegister) + case runtimeValueTypeI64: + c.assembler.CompileRegisterToRegister(arm64.MOVD, pickTarget.register, pickedRegister) + case runtimeValueTypeF32: + c.assembler.CompileRegisterToRegister(arm64.FMOVS, pickTarget.register, pickedRegister) + case runtimeValueTypeF64: + c.assembler.CompileRegisterToRegister(arm64.FMOVD, pickTarget.register, pickedRegister) + case runtimeValueTypeV128Lo: + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.VORR, + pickTarget.register, pickTarget.register, pickedRegister, arm64.VectorArrangement16B) + case runtimeValueTypeV128Hi: + panic("BUG") // since pick target must point to the lower 64-bits of vectors. + } + } else if pickTarget.onStack() { + // Temporarily assign a register to the pick target, and then load the value. + pickTarget.setRegister(pickedRegister) + c.compileLoadValueOnStackToRegister(pickTarget) + + // After the load, we revert the register assignment to the pick target. + pickTarget.setRegister(asm.NilRegister) + if isTargetVector { + hi := &c.locationStack.stack[pickTarget.stackPointer+1] + hi.setRegister(asm.NilRegister) + } + } + + // Now we have the value of the target on the pickedRegister, + // so push the location. + c.pushRuntimeValueLocationOnRegister(pickedRegister, pickTarget.valueType) + if isTargetVector { + c.pushRuntimeValueLocationOnRegister(pickedRegister, runtimeValueTypeV128Hi) + } + return nil +} + +// compileAdd implements compiler.compileAdd for the arm64 architecture. +func (c *arm64Compiler) compileAdd(o *wazeroir.UnionOperation) error { + x1, x2, err := c.popTwoValuesOnRegisters() + if err != nil { + return err + } + + // Addition can be nop if one of operands is zero. + if isZeroRegister(x1.register) { + c.pushRuntimeValueLocationOnRegister(x2.register, x1.valueType) + return nil + } else if isZeroRegister(x2.register) { + c.pushRuntimeValueLocationOnRegister(x1.register, x1.valueType) + return nil + } + + var inst asm.Instruction + unsignedType := wazeroir.UnsignedType(o.B1) + switch unsignedType { + case wazeroir.UnsignedTypeI32: + inst = arm64.ADDW + case wazeroir.UnsignedTypeI64: + inst = arm64.ADD + case wazeroir.UnsignedTypeF32: + inst = arm64.FADDS + case wazeroir.UnsignedTypeF64: + inst = arm64.FADDD + } + + c.assembler.CompileRegisterToRegister(inst, x2.register, x1.register) + // The result is placed on a register for x1, so record it. + c.pushRuntimeValueLocationOnRegister(x1.register, x1.valueType) + return nil +} + +// compileSub implements compiler.compileSub for the arm64 architecture. +func (c *arm64Compiler) compileSub(o *wazeroir.UnionOperation) error { + x1, x2, err := c.popTwoValuesOnRegisters() + if err != nil { + return err + } + + // If both of registers are zeros, this can be nop and push the zero register. + if isZeroRegister(x1.register) && isZeroRegister(x2.register) { + c.pushRuntimeValueLocationOnRegister(arm64.RegRZR, x1.valueType) + return nil + } + + // At this point, at least one of x1 or x2 registers is non zero. + // Choose the non-zero register as destination. + destinationReg := x1.register + if isZeroRegister(x1.register) { + destinationReg = x2.register + } + + var inst asm.Instruction + var vt runtimeValueType + unsignedType := wazeroir.UnsignedType(o.B1) + switch unsignedType { + case wazeroir.UnsignedTypeI32: + inst = arm64.SUBW + vt = runtimeValueTypeI32 + case wazeroir.UnsignedTypeI64: + inst = arm64.SUB + vt = runtimeValueTypeI64 + case wazeroir.UnsignedTypeF32: + inst = arm64.FSUBS + vt = runtimeValueTypeF32 + case wazeroir.UnsignedTypeF64: + inst = arm64.FSUBD + vt = runtimeValueTypeF64 + } + + c.assembler.CompileTwoRegistersToRegister(inst, x2.register, x1.register, destinationReg) + c.pushRuntimeValueLocationOnRegister(destinationReg, vt) + return nil +} + +// compileMul implements compiler.compileMul for the arm64 architecture. +func (c *arm64Compiler) compileMul(o *wazeroir.UnionOperation) error { + x1, x2, err := c.popTwoValuesOnRegisters() + if err != nil { + return err + } + + // Multiplication can be done by putting a zero register if one of operands is zero. + if isZeroRegister(x1.register) || isZeroRegister(x2.register) { + c.pushRuntimeValueLocationOnRegister(arm64.RegRZR, x1.valueType) + return nil + } + + var inst asm.Instruction + var vt runtimeValueType + unsignedType := wazeroir.UnsignedType(o.B1) + switch unsignedType { + case wazeroir.UnsignedTypeI32: + inst = arm64.MULW + vt = runtimeValueTypeI32 + case wazeroir.UnsignedTypeI64: + inst = arm64.MUL + vt = runtimeValueTypeI64 + case wazeroir.UnsignedTypeF32: + inst = arm64.FMULS + vt = runtimeValueTypeF32 + case wazeroir.UnsignedTypeF64: + inst = arm64.FMULD + vt = runtimeValueTypeF64 + } + + c.assembler.CompileRegisterToRegister(inst, x2.register, x1.register) + // The result is placed on a register for x1, so record it. + c.pushRuntimeValueLocationOnRegister(x1.register, vt) + return nil +} + +// compileClz implements compiler.compileClz for the arm64 architecture. +func (c *arm64Compiler) compileClz(o *wazeroir.UnionOperation) error { + v, err := c.popValueOnRegister() + if err != nil { + return err + } + + unsignedInt := wazeroir.UnsignedInt(o.B1) + if isZeroRegister(v.register) { + // If the target is zero register, the result is always 32 (or 64 for 64-bits), + // so we allocate a register and put the const on it. + reg, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + var vt runtimeValueType + if unsignedInt == wazeroir.UnsignedInt32 { + vt = runtimeValueTypeI32 + c.assembler.CompileConstToRegister(arm64.MOVW, 32, reg) + } else { + vt = runtimeValueTypeI64 + c.assembler.CompileConstToRegister(arm64.MOVD, 64, reg) + } + c.pushRuntimeValueLocationOnRegister(reg, vt) + return nil + } + + reg := v.register + var vt runtimeValueType + if unsignedInt == wazeroir.UnsignedInt32 { + vt = runtimeValueTypeI32 + c.assembler.CompileRegisterToRegister(arm64.CLZW, reg, reg) + } else { + vt = runtimeValueTypeI64 + c.assembler.CompileRegisterToRegister(arm64.CLZ, reg, reg) + } + c.pushRuntimeValueLocationOnRegister(reg, vt) + return nil +} + +// compileCtz implements compiler.compileCtz for the arm64 architecture. +func (c *arm64Compiler) compileCtz(o *wazeroir.UnionOperation) error { + v, err := c.popValueOnRegister() + if err != nil { + return err + } + + unsignedInt := wazeroir.UnsignedInt(o.B1) + reg := v.register + if isZeroRegister(reg) { + // If the target is zero register, the result is always 32 (or 64 for 64-bits), + // so we allocate a register and put the const on it. + reg, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + var vt runtimeValueType + if unsignedInt == wazeroir.UnsignedInt32 { + vt = runtimeValueTypeI32 + c.assembler.CompileConstToRegister(arm64.MOVW, 32, reg) + } else { + vt = runtimeValueTypeI64 + c.assembler.CompileConstToRegister(arm64.MOVD, 64, reg) + } + c.pushRuntimeValueLocationOnRegister(reg, vt) + return nil + } + + // Since arm64 doesn't have an instruction directly counting trailing zeros, + // we reverse the bits first, and then do CLZ, which is exactly the same as + // gcc implements __builtin_ctz for arm64. + var vt runtimeValueType + if unsignedInt == wazeroir.UnsignedInt32 { + vt = runtimeValueTypeI32 + c.assembler.CompileRegisterToRegister(arm64.RBITW, reg, reg) + c.assembler.CompileRegisterToRegister(arm64.CLZW, reg, reg) + } else { + vt = runtimeValueTypeI64 + c.assembler.CompileRegisterToRegister(arm64.RBIT, reg, reg) + c.assembler.CompileRegisterToRegister(arm64.CLZ, reg, reg) + } + c.pushRuntimeValueLocationOnRegister(reg, vt) + return nil +} + +// compilePopcnt implements compiler.compilePopcnt for the arm64 architecture. +func (c *arm64Compiler) compilePopcnt(o *wazeroir.UnionOperation) error { + v, err := c.popValueOnRegister() + if err != nil { + return err + } + + reg := v.register + if isZeroRegister(reg) { + c.pushRuntimeValueLocationOnRegister(reg, v.valueType) + return nil + } + + freg, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + // arm64 doesn't have an instruction for population count on scalar register, + // so we use the vector one (VCNT). + // This exactly what the official Go implements bits.OneCount. + // For example, "func () int { return bits.OneCount(10) }" is compiled as + // + // MOVD $10, R0 ;; Load 10. + // FMOVD R0, F0 + // VCNT V0.B8, V0.B8 + // UADDLV V0.B8, V0 + // + var movInst asm.Instruction + unsignedInt := wazeroir.UnsignedInt(o.B1) + if unsignedInt == wazeroir.UnsignedInt32 { + movInst = arm64.FMOVS + } else { + movInst = arm64.FMOVD + } + c.assembler.CompileRegisterToRegister(movInst, reg, freg) + c.assembler.CompileVectorRegisterToVectorRegister(arm64.VCNT, freg, freg, + arm64.VectorArrangement16B, arm64.VectorIndexNone, arm64.VectorIndexNone) + c.assembler.CompileVectorRegisterToVectorRegister(arm64.UADDLV, freg, freg, arm64.VectorArrangement8B, + arm64.VectorIndexNone, arm64.VectorIndexNone) + + c.assembler.CompileRegisterToRegister(movInst, freg, reg) + + c.pushRuntimeValueLocationOnRegister(reg, v.valueType) + return nil +} + +// compileDiv implements compiler.compileDiv for the arm64 architecture. +func (c *arm64Compiler) compileDiv(o *wazeroir.UnionOperation) error { + dividend, divisor, err := c.popTwoValuesOnRegisters() + if err != nil { + return err + } + + signedType := wazeroir.SignedType(o.B1) + + // If the divisor is on the zero register, exit from the function deterministically. + if isZeroRegister(divisor.register) { + // Push any value so that the subsequent instruction can have a consistent location stack state. + v := c.locationStack.pushRuntimeValueLocationOnStack() + switch signedType { + case wazeroir.SignedTypeInt32, wazeroir.SignedTypeUint32: + v.valueType = runtimeValueTypeI32 + case wazeroir.SignedTypeUint64, wazeroir.SignedTypeInt64: + v.valueType = runtimeValueTypeI64 + } + c.compileExitFromNativeCode(nativeCallStatusIntegerDivisionByZero) + return nil + } + + var inst asm.Instruction + var vt runtimeValueType + switch signedType { + case wazeroir.SignedTypeUint32: + inst = arm64.UDIVW + if err := c.compileIntegerDivPrecheck(true, false, dividend.register, divisor.register); err != nil { + return err + } + vt = runtimeValueTypeI32 + case wazeroir.SignedTypeUint64: + if err := c.compileIntegerDivPrecheck(false, false, dividend.register, divisor.register); err != nil { + return err + } + inst = arm64.UDIV + vt = runtimeValueTypeI64 + case wazeroir.SignedTypeInt32: + if err := c.compileIntegerDivPrecheck(true, true, dividend.register, divisor.register); err != nil { + return err + } + inst = arm64.SDIVW + vt = runtimeValueTypeI32 + case wazeroir.SignedTypeInt64: + if err := c.compileIntegerDivPrecheck(false, true, dividend.register, divisor.register); err != nil { + return err + } + inst = arm64.SDIV + vt = runtimeValueTypeI64 + case wazeroir.SignedTypeFloat32: + inst = arm64.FDIVS + vt = runtimeValueTypeF32 + case wazeroir.SignedTypeFloat64: + inst = arm64.FDIVD + vt = runtimeValueTypeF64 + } + + c.assembler.CompileRegisterToRegister(inst, divisor.register, dividend.register) + + c.pushRuntimeValueLocationOnRegister(dividend.register, vt) + return nil +} + +// compileIntegerDivPrecheck adds instructions to check if the divisor and dividend are sound for division operation. +// First, this adds instructions to check if the divisor equals zero, and if so, exits the function. +// Plus, for signed divisions, check if the result might result in overflow or not. +func (c *arm64Compiler) compileIntegerDivPrecheck(is32Bit, isSigned bool, dividend, divisor asm.Register) error { + // We check the divisor value equals zero. + var cmpInst, movInst, loadInst asm.Instruction + var minValueOffsetInVM int64 + if is32Bit { + cmpInst = arm64.CMPW + movInst = arm64.MOVW + loadInst = arm64.LDRW + minValueOffsetInVM = arm64CallEngineArchContextMinimum32BitSignedIntOffset + } else { + cmpInst = arm64.CMP + movInst = arm64.MOVD + loadInst = arm64.LDRD + minValueOffsetInVM = arm64CallEngineArchContextMinimum64BitSignedIntOffset + } + c.assembler.CompileTwoRegistersToNone(cmpInst, arm64.RegRZR, divisor) + + // If it is zero, we exit with nativeCallStatusIntegerDivisionByZero. + c.compileMaybeExitFromNativeCode(arm64.BCONDNE, nativeCallStatusIntegerDivisionByZero) + // Otherwise, we proceed. + + // If the operation is a signed integer div, we have to do an additional check on overflow. + if isSigned { + // For signed division, we have to have branches for "math.MinInt{32,64} / -1" + // case which results in the overflow. + + // First, we compare the divisor with -1. + c.assembler.CompileConstToRegister(movInst, -1, arm64ReservedRegisterForTemporary) + c.assembler.CompileTwoRegistersToNone(cmpInst, arm64ReservedRegisterForTemporary, divisor) + + // If they not equal, we skip the following check. + brIfDivisorNonMinusOne := c.assembler.CompileJump(arm64.BCONDNE) + + // Otherwise, we further check if the dividend equals math.MinInt32 or MinInt64. + c.assembler.CompileMemoryToRegister( + loadInst, + arm64ReservedRegisterForCallEngine, minValueOffsetInVM, + arm64ReservedRegisterForTemporary, + ) + c.assembler.CompileTwoRegistersToNone(cmpInst, arm64ReservedRegisterForTemporary, dividend) + + // If they not equal, we are safe to execute the division. + // Otherwise, we raise overflow error. + c.compileMaybeExitFromNativeCode(arm64.BCONDNE, nativeCallStatusIntegerOverflow) + + c.assembler.SetJumpTargetOnNext(brIfDivisorNonMinusOne) + } + return nil +} + +// compileRem implements compiler.compileRem for the arm64 architecture. +func (c *arm64Compiler) compileRem(o *wazeroir.UnionOperation) error { + dividend, divisor, err := c.popTwoValuesOnRegisters() + if err != nil { + return err + } + + dividendReg := dividend.register + divisorReg := divisor.register + + // If the divisor is on the zero register, exit from the function deterministically. + if isZeroRegister(divisor.register) { + // Push any value so that the subsequent instruction can have a consistent location stack state. + v := c.locationStack.pushRuntimeValueLocationOnStack() + v.valueType = runtimeValueTypeI32 + c.compileExitFromNativeCode(nativeCallStatusIntegerDivisionByZero) + return nil + } + + var divInst, msubInst, cmpInst asm.Instruction + signedInt := wazeroir.SignedInt(o.B1) + switch signedInt { + case wazeroir.SignedUint32: + divInst = arm64.UDIVW + msubInst = arm64.MSUBW + cmpInst = arm64.CMPW + case wazeroir.SignedUint64: + divInst = arm64.UDIV + msubInst = arm64.MSUB + cmpInst = arm64.CMP + case wazeroir.SignedInt32: + divInst = arm64.SDIVW + msubInst = arm64.MSUBW + cmpInst = arm64.CMPW + case wazeroir.SignedInt64: + divInst = arm64.SDIV + msubInst = arm64.MSUB + cmpInst = arm64.CMP + } + + // We check the divisor value equals zero. + c.assembler.CompileTwoRegistersToNone(cmpInst, arm64.RegRZR, divisorReg) + + // If it is zero, we exit with nativeCallStatusIntegerDivisionByZero. + c.compileMaybeExitFromNativeCode(arm64.BCONDNE, nativeCallStatusIntegerDivisionByZero) + // Otherwise, we proceed. + + // Temporarily mark them used to allocate a result register while keeping these values. + c.markRegisterUsed(dividend.register, divisor.register) + + resultReg, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + // arm64 doesn't have an instruction for rem, we use calculate it by two instructions: UDIV (SDIV for signed) and MSUB. + // This exactly the same code that Clang emits. + // [input: x0=dividend, x1=divisor] + // >> UDIV x2, x0, x1 + // >> MSUB x3, x2, x1, x0 + // [result: x2=quotient, x3=remainder] + // + c.assembler.CompileTwoRegistersToRegister(divInst, divisorReg, dividendReg, resultReg) + // ResultReg = dividendReg - (divisorReg * resultReg) + c.assembler.CompileThreeRegistersToRegister(msubInst, divisorReg, dividendReg, resultReg, resultReg) + + c.markRegisterUnused(dividend.register, divisor.register) + c.pushRuntimeValueLocationOnRegister(resultReg, dividend.valueType) + return nil +} + +// compileAnd implements compiler.compileAnd for the arm64 architecture. +func (c *arm64Compiler) compileAnd(o *wazeroir.UnionOperation) error { + x1, x2, err := c.popTwoValuesOnRegisters() + if err != nil { + return err + } + + // If either of the registers x1 or x2 is zero, + // the result will always be zero. + if isZeroRegister(x1.register) || isZeroRegister(x2.register) { + c.pushRuntimeValueLocationOnRegister(arm64.RegRZR, x1.valueType) + return nil + } + + // At this point, at least one of x1 or x2 registers is non zero. + // Choose the non-zero register as destination. + destinationReg := x1.register + if isZeroRegister(x1.register) { + destinationReg = x2.register + } + + var inst asm.Instruction + unsignedInt := wazeroir.UnsignedInt(o.B1) + switch unsignedInt { + case wazeroir.UnsignedInt32: + inst = arm64.ANDW + case wazeroir.UnsignedInt64: + inst = arm64.AND + } + + c.assembler.CompileTwoRegistersToRegister(inst, x2.register, x1.register, destinationReg) + c.pushRuntimeValueLocationOnRegister(x1.register, x1.valueType) + return nil +} + +// compileOr implements compiler.compileOr for the arm64 architecture. +func (c *arm64Compiler) compileOr(o *wazeroir.UnionOperation) error { + x1, x2, err := c.popTwoValuesOnRegisters() + if err != nil { + return err + } + + if isZeroRegister(x1.register) { + c.pushRuntimeValueLocationOnRegister(x2.register, x2.valueType) + return nil + } + if isZeroRegister(x2.register) { + c.pushRuntimeValueLocationOnRegister(x1.register, x1.valueType) + return nil + } + + var inst asm.Instruction + unsignedInt := wazeroir.UnsignedInt(o.B1) + switch unsignedInt { + case wazeroir.UnsignedInt32: + inst = arm64.ORRW + case wazeroir.UnsignedInt64: + inst = arm64.ORR + } + + c.assembler.CompileTwoRegistersToRegister(inst, x2.register, x1.register, x1.register) + c.pushRuntimeValueLocationOnRegister(x1.register, x1.valueType) + return nil +} + +// compileXor implements compiler.compileXor for the arm64 architecture. +func (c *arm64Compiler) compileXor(o *wazeroir.UnionOperation) error { + x1, x2, err := c.popTwoValuesOnRegisters() + if err != nil { + return err + } + + // At this point, at least one of x1 or x2 registers is non zero. + // Choose the non-zero register as destination. + destinationReg := x1.register + if isZeroRegister(x1.register) { + destinationReg = x2.register + } + + var inst asm.Instruction + unsignedInt := wazeroir.UnsignedInt(o.B1) + switch unsignedInt { + case wazeroir.UnsignedInt32: + inst = arm64.EORW + case wazeroir.UnsignedInt64: + inst = arm64.EOR + } + + c.assembler.CompileTwoRegistersToRegister(inst, x2.register, x1.register, destinationReg) + c.pushRuntimeValueLocationOnRegister(destinationReg, x1.valueType) + return nil +} + +// compileShl implements compiler.compileShl for the arm64 architecture. +func (c *arm64Compiler) compileShl(o *wazeroir.UnionOperation) error { + x1, x2, err := c.popTwoValuesOnRegisters() + if err != nil { + return err + } + + if isZeroRegister(x1.register) || isZeroRegister(x2.register) { + c.pushRuntimeValueLocationOnRegister(x1.register, x1.valueType) + return nil + } + + var inst asm.Instruction + unsignedInt := wazeroir.UnsignedInt(o.B1) + switch unsignedInt { + case wazeroir.UnsignedInt32: + inst = arm64.LSLW + case wazeroir.UnsignedInt64: + inst = arm64.LSL + } + + c.assembler.CompileTwoRegistersToRegister(inst, x2.register, x1.register, x1.register) + c.pushRuntimeValueLocationOnRegister(x1.register, x1.valueType) + return nil +} + +// compileShr implements compiler.compileShr for the arm64 architecture. +func (c *arm64Compiler) compileShr(o *wazeroir.UnionOperation) error { + x1, x2, err := c.popTwoValuesOnRegisters() + if err != nil { + return err + } + + if isZeroRegister(x1.register) || isZeroRegister(x2.register) { + c.pushRuntimeValueLocationOnRegister(x1.register, x1.valueType) + return nil + } + + var inst asm.Instruction + signedInt := wazeroir.SignedInt(o.B1) + switch signedInt { + case wazeroir.SignedInt32: + inst = arm64.ASRW + case wazeroir.SignedInt64: + inst = arm64.ASR + case wazeroir.SignedUint32: + inst = arm64.LSRW + case wazeroir.SignedUint64: + inst = arm64.LSR + } + + c.assembler.CompileTwoRegistersToRegister(inst, x2.register, x1.register, x1.register) + c.pushRuntimeValueLocationOnRegister(x1.register, x1.valueType) + return nil +} + +// compileRotl implements compiler.compileRotl for the arm64 architecture. +func (c *arm64Compiler) compileRotl(o *wazeroir.UnionOperation) error { + x1, x2, err := c.popTwoValuesOnRegisters() + if err != nil { + return err + } + + if isZeroRegister(x1.register) || isZeroRegister(x2.register) { + c.pushRuntimeValueLocationOnRegister(x1.register, x1.valueType) + return nil + } + + var inst, neginst asm.Instruction + unsignedInt := wazeroir.UnsignedInt(o.B1) + switch unsignedInt { + case wazeroir.UnsignedInt32: + inst = arm64.RORW + neginst = arm64.NEGW + case wazeroir.UnsignedInt64: + inst = arm64.ROR + neginst = arm64.NEG + } + + // Arm64 doesn't have rotate left instruction. + // The shift amount needs to be converted to a negative number, similar to assembly output of bits.RotateLeft. + c.assembler.CompileRegisterToRegister(neginst, x2.register, x2.register) + + c.assembler.CompileTwoRegistersToRegister(inst, x2.register, x1.register, x1.register) + c.pushRuntimeValueLocationOnRegister(x1.register, x1.valueType) + return nil +} + +// compileRotr implements compiler.compileRotr for the arm64 architecture. +func (c *arm64Compiler) compileRotr(o *wazeroir.UnionOperation) error { + x1, x2, err := c.popTwoValuesOnRegisters() + if err != nil { + return err + } + + if isZeroRegister(x1.register) || isZeroRegister(x2.register) { + c.pushRuntimeValueLocationOnRegister(x1.register, x1.valueType) + return nil + } + + var inst asm.Instruction + unsignedInt := wazeroir.UnsignedInt(o.B1) + switch unsignedInt { + case wazeroir.UnsignedInt32: + inst = arm64.RORW + case wazeroir.UnsignedInt64: + inst = arm64.ROR + } + + c.assembler.CompileTwoRegistersToRegister(inst, x2.register, x1.register, x1.register) + c.pushRuntimeValueLocationOnRegister(x1.register, x1.valueType) + return nil +} + +// compileAbs implements compiler.compileAbs for the arm64 architecture. +func (c *arm64Compiler) compileAbs(o *wazeroir.UnionOperation) error { + if wazeroir.Float(o.B1) == wazeroir.Float32 { + return c.compileSimpleUnop(arm64.FABSS, runtimeValueTypeF32) + } else { + return c.compileSimpleUnop(arm64.FABSD, runtimeValueTypeF64) + } +} + +// compileNeg implements compiler.compileNeg for the arm64 architecture. +func (c *arm64Compiler) compileNeg(o *wazeroir.UnionOperation) error { + if wazeroir.Float(o.B1) == wazeroir.Float32 { + return c.compileSimpleUnop(arm64.FNEGS, runtimeValueTypeF32) + } else { + return c.compileSimpleUnop(arm64.FNEGD, runtimeValueTypeF64) + } +} + +// compileCeil implements compiler.compileCeil for the arm64 architecture. +func (c *arm64Compiler) compileCeil(o *wazeroir.UnionOperation) error { + if wazeroir.Float(o.B1) == wazeroir.Float32 { + return c.compileSimpleUnop(arm64.FRINTPS, runtimeValueTypeF32) + } else { + return c.compileSimpleUnop(arm64.FRINTPD, runtimeValueTypeF64) + } +} + +// compileFloor implements compiler.compileFloor for the arm64 architecture. +func (c *arm64Compiler) compileFloor(o *wazeroir.UnionOperation) error { + if wazeroir.Float(o.B1) == wazeroir.Float32 { + return c.compileSimpleUnop(arm64.FRINTMS, runtimeValueTypeF32) + } else { + return c.compileSimpleUnop(arm64.FRINTMD, runtimeValueTypeF64) + } +} + +// compileTrunc implements compiler.compileTrunc for the arm64 architecture. +func (c *arm64Compiler) compileTrunc(o *wazeroir.UnionOperation) error { + if wazeroir.Float(o.B1) == wazeroir.Float32 { + return c.compileSimpleUnop(arm64.FRINTZS, runtimeValueTypeF32) + } else { + return c.compileSimpleUnop(arm64.FRINTZD, runtimeValueTypeF64) + } +} + +// compileNearest implements compiler.compileNearest for the arm64 architecture. +func (c *arm64Compiler) compileNearest(o *wazeroir.UnionOperation) error { + if wazeroir.Float(o.B1) == wazeroir.Float32 { + return c.compileSimpleUnop(arm64.FRINTNS, runtimeValueTypeF32) + } else { + return c.compileSimpleUnop(arm64.FRINTND, runtimeValueTypeF64) + } +} + +// compileSqrt implements compiler.compileSqrt for the arm64 architecture. +func (c *arm64Compiler) compileSqrt(o *wazeroir.UnionOperation) error { + if wazeroir.Float(o.B1) == wazeroir.Float32 { + return c.compileSimpleUnop(arm64.FSQRTS, runtimeValueTypeF32) + } else { + return c.compileSimpleUnop(arm64.FSQRTD, runtimeValueTypeF64) + } +} + +// compileMin implements compiler.compileMin for the arm64 architecture. +func (c *arm64Compiler) compileMin(o *wazeroir.UnionOperation) error { + if wazeroir.Float(o.B1) == wazeroir.Float32 { + return c.compileSimpleFloatBinop(arm64.FMINS) + } else { + return c.compileSimpleFloatBinop(arm64.FMIND) + } +} + +// compileMax implements compiler.compileMax for the arm64 architecture. +func (c *arm64Compiler) compileMax(o *wazeroir.UnionOperation) error { + if wazeroir.Float(o.B1) == wazeroir.Float32 { + return c.compileSimpleFloatBinop(arm64.FMAXS) + } else { + return c.compileSimpleFloatBinop(arm64.FMAXD) + } +} + +func (c *arm64Compiler) compileSimpleFloatBinop(inst asm.Instruction) error { + x1, x2, err := c.popTwoValuesOnRegisters() + if err != nil { + return err + } + c.assembler.CompileRegisterToRegister(inst, x2.register, x1.register) + c.pushRuntimeValueLocationOnRegister(x1.register, x1.valueType) + return nil +} + +// compileCopysign implements compiler.compileCopysign for the arm64 architecture. +func (c *arm64Compiler) compileCopysign(o *wazeroir.UnionOperation) error { + x1, x2, err := c.popTwoValuesOnRegisters() + if err != nil { + return err + } + + var ldr asm.Instruction + var minValueOffsetInVM int64 + if wazeroir.Float(o.B1) == wazeroir.Float32 { + ldr = arm64.FLDRS + minValueOffsetInVM = arm64CallEngineArchContextMinimum32BitSignedIntOffset + } else { + ldr = arm64.FLDRD + minValueOffsetInVM = arm64CallEngineArchContextMinimum64BitSignedIntOffset + } + + c.markRegisterUsed(x1.register, x2.register) + freg, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + // This is exactly the same code emitted by GCC for "__builtin_copysign": + // + // mov x0, -9223372036854775808 + // fmov d2, x0 + // vbit v0.8b, v1.8b, v2.8b + // + // "mov freg, -9223372036854775808 (stored at ce.minimum64BitSignedInt)" + c.assembler.CompileMemoryToRegister( + ldr, + arm64ReservedRegisterForCallEngine, minValueOffsetInVM, + freg, + ) + + // VBIT inserts each bit from the first operand into the destination if the corresponding bit of the second operand is 1, + // otherwise it leaves the destination bit unchanged. + // See https://developer.arm.com/documentation/dui0801/g/Advanced-SIMD-Instructions--32-bit-/VBIT + // + // "vbit vreg.8b, x2vreg.8b, x1vreg.8b" == "inserting 64th bit of x2 into x1". + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.VBIT, + freg, x2.register, x1.register, arm64.VectorArrangement16B) + + c.markRegisterUnused(x2.register) + c.pushRuntimeValueLocationOnRegister(x1.register, x1.valueType) + return nil +} + +// compileI32WrapFromI64 implements compiler.compileI32WrapFromI64 for the arm64 architecture. +func (c *arm64Compiler) compileI32WrapFromI64() error { + return c.compileSimpleUnop(arm64.MOVW, runtimeValueTypeI32) +} + +// compileITruncFromF implements compiler.compileITruncFromF for the arm64 architecture. +func (c *arm64Compiler) compileITruncFromF(o *wazeroir.UnionOperation) error { + // Clear the floating point status register (FPSR). + c.assembler.CompileRegisterToRegister(arm64.MSR, arm64.RegRZR, arm64.RegFPSR) + + var vt runtimeValueType + var convinst asm.Instruction + inputType := wazeroir.Float(o.B1) + outputType := wazeroir.SignedInt(o.B2) + nonTrapping := o.B3 + + is32bitFloat := inputType == wazeroir.Float32 + if is32bitFloat && outputType == wazeroir.SignedInt32 { + convinst = arm64.FCVTZSSW + vt = runtimeValueTypeI32 + } else if is32bitFloat && outputType == wazeroir.SignedInt64 { + convinst = arm64.FCVTZSS + vt = runtimeValueTypeI64 + } else if !is32bitFloat && outputType == wazeroir.SignedInt32 { + convinst = arm64.FCVTZSDW + vt = runtimeValueTypeI32 + } else if !is32bitFloat && outputType == wazeroir.SignedInt64 { + convinst = arm64.FCVTZSD + vt = runtimeValueTypeI64 + } else if is32bitFloat && outputType == wazeroir.SignedUint32 { + convinst = arm64.FCVTZUSW + vt = runtimeValueTypeI32 + } else if is32bitFloat && outputType == wazeroir.SignedUint64 { + convinst = arm64.FCVTZUS + vt = runtimeValueTypeI64 + } else if !is32bitFloat && outputType == wazeroir.SignedUint32 { + convinst = arm64.FCVTZUDW + vt = runtimeValueTypeI32 + } else if !is32bitFloat && outputType == wazeroir.SignedUint64 { + convinst = arm64.FCVTZUD + vt = runtimeValueTypeI64 + } + + source, err := c.popValueOnRegister() + if err != nil { + return err + } + sourceReg := source.register + + destinationReg, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + c.assembler.CompileRegisterToRegister(convinst, sourceReg, destinationReg) + c.pushRuntimeValueLocationOnRegister(destinationReg, vt) + + if !nonTrapping { + // Obtain the floating point status register value into the general purpose register, + // so that we can check if the conversion resulted in undefined behavior. + c.assembler.CompileRegisterToRegister(arm64.MRS, arm64.RegFPSR, arm64ReservedRegisterForTemporary) + // Check if the conversion was undefined by comparing the status with 1. + // See https://developer.arm.com/documentation/ddi0595/2020-12/AArch64-Registers/FPSR--Floating-point-Status-Register + c.assembler.CompileRegisterAndConstToNone(arm64.CMP, arm64ReservedRegisterForTemporary, 1) + + brOK := c.assembler.CompileJump(arm64.BCONDNE) + + // If so, exit the execution with errors depending on whether or not the source value is NaN. + var floatcmp asm.Instruction + if is32bitFloat { + floatcmp = arm64.FCMPS + } else { + floatcmp = arm64.FCMPD + } + c.assembler.CompileTwoRegistersToNone(floatcmp, sourceReg, sourceReg) + // VS flag is set if at least one of values for FCMP is NaN. + // https://developer.arm.com/documentation/dui0801/g/Condition-Codes/Comparison-of-condition-code-meanings-in-integer-and-floating-point-code + // If the source value is not NaN, the operation was overflow. + c.compileMaybeExitFromNativeCode(arm64.BCONDVS, nativeCallStatusIntegerOverflow) + + // Otherwise, the operation was invalid as this is trying to convert NaN to integer. + c.compileExitFromNativeCode(nativeCallStatusCodeInvalidFloatToIntConversion) + + // Otherwise, we branch into the next instruction. + c.assembler.SetJumpTargetOnNext(brOK) + } + return nil +} + +// compileFConvertFromI implements compiler.compileFConvertFromI for the arm64 architecture. +func (c *arm64Compiler) compileFConvertFromI(o *wazeroir.UnionOperation) error { + var convinst asm.Instruction + inputType := wazeroir.SignedInt(o.B1) + outputType := wazeroir.Float(o.B2) + + if outputType == wazeroir.Float32 && inputType == wazeroir.SignedInt32 { + convinst = arm64.SCVTFWS + } else if outputType == wazeroir.Float32 && inputType == wazeroir.SignedInt64 { + convinst = arm64.SCVTFS + } else if outputType == wazeroir.Float64 && inputType == wazeroir.SignedInt32 { + convinst = arm64.SCVTFWD + } else if outputType == wazeroir.Float64 && inputType == wazeroir.SignedInt64 { + convinst = arm64.SCVTFD + } else if outputType == wazeroir.Float32 && inputType == wazeroir.SignedUint32 { + convinst = arm64.UCVTFWS + } else if outputType == wazeroir.Float32 && inputType == wazeroir.SignedUint64 { + convinst = arm64.UCVTFS + } else if outputType == wazeroir.Float64 && inputType == wazeroir.SignedUint32 { + convinst = arm64.UCVTFWD + } else if outputType == wazeroir.Float64 && inputType == wazeroir.SignedUint64 { + convinst = arm64.UCVTFD + } + + var vt runtimeValueType + if outputType == wazeroir.Float32 { + vt = runtimeValueTypeF32 + } else { + vt = runtimeValueTypeF64 + } + return c.compileSimpleConversion(convinst, registerTypeVector, vt) +} + +// compileF32DemoteFromF64 implements compiler.compileF32DemoteFromF64 for the arm64 architecture. +func (c *arm64Compiler) compileF32DemoteFromF64() error { + return c.compileSimpleUnop(arm64.FCVTDS, runtimeValueTypeF32) +} + +// compileF64PromoteFromF32 implements compiler.compileF64PromoteFromF32 for the arm64 architecture. +func (c *arm64Compiler) compileF64PromoteFromF32() error { + return c.compileSimpleUnop(arm64.FCVTSD, runtimeValueTypeF64) +} + +// compileI32ReinterpretFromF32 implements compiler.compileI32ReinterpretFromF32 for the arm64 architecture. +func (c *arm64Compiler) compileI32ReinterpretFromF32() error { + if peek := c.locationStack.peek(); peek.onStack() { + // If the value is on the stack, this is no-op as there is nothing to do for converting type. + peek.valueType = runtimeValueTypeI32 + return nil + } + return c.compileSimpleConversion(arm64.FMOVS, registerTypeGeneralPurpose, runtimeValueTypeI32) +} + +// compileI64ReinterpretFromF64 implements compiler.compileI64ReinterpretFromF64 for the arm64 architecture. +func (c *arm64Compiler) compileI64ReinterpretFromF64() error { + if peek := c.locationStack.peek(); peek.onStack() { + // If the value is on the stack, this is no-op as there is nothing to do for converting type. + peek.valueType = runtimeValueTypeI64 + return nil + } + return c.compileSimpleConversion(arm64.FMOVD, registerTypeGeneralPurpose, runtimeValueTypeI64) +} + +// compileF32ReinterpretFromI32 implements compiler.compileF32ReinterpretFromI32 for the arm64 architecture. +func (c *arm64Compiler) compileF32ReinterpretFromI32() error { + if peek := c.locationStack.peek(); peek.onStack() { + // If the value is on the stack, this is no-op as there is nothing to do for converting type. + peek.valueType = runtimeValueTypeF32 + return nil + } + return c.compileSimpleConversion(arm64.FMOVS, registerTypeVector, runtimeValueTypeF32) +} + +// compileF64ReinterpretFromI64 implements compiler.compileF64ReinterpretFromI64 for the arm64 architecture. +func (c *arm64Compiler) compileF64ReinterpretFromI64() error { + if peek := c.locationStack.peek(); peek.onStack() { + // If the value is on the stack, this is no-op as there is nothing to do for converting type. + peek.valueType = runtimeValueTypeF64 + return nil + } + return c.compileSimpleConversion(arm64.FMOVD, registerTypeVector, runtimeValueTypeF64) +} + +func (c *arm64Compiler) compileSimpleConversion(inst asm.Instruction, destinationRegType registerType, resultRuntimeValueType runtimeValueType) error { + source, err := c.popValueOnRegister() + if err != nil { + return err + } + + destinationReg, err := c.allocateRegister(destinationRegType) + if err != nil { + return err + } + + c.assembler.CompileRegisterToRegister(inst, source.register, destinationReg) + c.pushRuntimeValueLocationOnRegister(destinationReg, resultRuntimeValueType) + return nil +} + +// compileExtend implements compiler.compileExtend for the arm64 architecture. +func (c *arm64Compiler) compileExtend(o *wazeroir.UnionOperation) error { + signed := o.B1 != 0 + if signed { + return c.compileSimpleUnop(arm64.SXTW, runtimeValueTypeI64) + } else { + return c.compileSimpleUnop(arm64.MOVW, runtimeValueTypeI64) + } +} + +// compileSignExtend32From8 implements compiler.compileSignExtend32From8 for the arm64 architecture. +func (c *arm64Compiler) compileSignExtend32From8() error { + return c.compileSimpleUnop(arm64.SXTBW, runtimeValueTypeI32) +} + +// compileSignExtend32From16 implements compiler.compileSignExtend32From16 for the arm64 architecture. +func (c *arm64Compiler) compileSignExtend32From16() error { + return c.compileSimpleUnop(arm64.SXTHW, runtimeValueTypeI32) +} + +// compileSignExtend64From8 implements compiler.compileSignExtend64From8 for the arm64 architecture. +func (c *arm64Compiler) compileSignExtend64From8() error { + return c.compileSimpleUnop(arm64.SXTB, runtimeValueTypeI64) +} + +// compileSignExtend64From16 implements compiler.compileSignExtend64From16 for the arm64 architecture. +func (c *arm64Compiler) compileSignExtend64From16() error { + return c.compileSimpleUnop(arm64.SXTH, runtimeValueTypeI64) +} + +// compileSignExtend64From32 implements compiler.compileSignExtend64From32 for the arm64 architecture. +func (c *arm64Compiler) compileSignExtend64From32() error { + return c.compileSimpleUnop(arm64.SXTW, runtimeValueTypeI64) +} + +func (c *arm64Compiler) compileSimpleUnop(inst asm.Instruction, resultRuntimeValueType runtimeValueType) error { + v, err := c.popValueOnRegister() + if err != nil { + return err + } + reg := v.register + c.assembler.CompileRegisterToRegister(inst, reg, reg) + c.pushRuntimeValueLocationOnRegister(reg, resultRuntimeValueType) + return nil +} + +// compileEq implements compiler.compileEq for the arm64 architecture. +func (c *arm64Compiler) compileEq(o *wazeroir.UnionOperation) error { + return c.emitEqOrNe(true, wazeroir.UnsignedType(o.B1)) +} + +// compileNe implements compiler.compileNe for the arm64 architecture. +func (c *arm64Compiler) compileNe(o *wazeroir.UnionOperation) error { + return c.emitEqOrNe(false, wazeroir.UnsignedType(o.B1)) +} + +// emitEqOrNe implements compiler.compileEq and compiler.compileNe for the arm64 architecture. +func (c *arm64Compiler) emitEqOrNe(isEq bool, unsignedType wazeroir.UnsignedType) error { + x1, x2, err := c.popTwoValuesOnRegisters() + if err != nil { + return err + } + + var inst asm.Instruction + switch unsignedType { + case wazeroir.UnsignedTypeI32: + inst = arm64.CMPW + case wazeroir.UnsignedTypeI64: + inst = arm64.CMP + case wazeroir.UnsignedTypeF32: + inst = arm64.FCMPS + case wazeroir.UnsignedTypeF64: + inst = arm64.FCMPD + } + + c.assembler.CompileTwoRegistersToNone(inst, x2.register, x1.register) + + // Push the comparison result as a conditional register value. + cond := arm64.CondNE + if isEq { + cond = arm64.CondEQ + } + c.locationStack.pushRuntimeValueLocationOnConditionalRegister(cond) + return nil +} + +// compileEqz implements compiler.compileEqz for the arm64 architecture. +func (c *arm64Compiler) compileEqz(o *wazeroir.UnionOperation) error { + x1, err := c.popValueOnRegister() + if err != nil { + return err + } + + var inst asm.Instruction + unsignedInt := wazeroir.UnsignedInt(o.B1) + switch unsignedInt { + case wazeroir.UnsignedInt32: + inst = arm64.CMPW + case wazeroir.UnsignedInt64: + inst = arm64.CMP + } + + c.assembler.CompileTwoRegistersToNone(inst, arm64.RegRZR, x1.register) + + // Push the comparison result as a conditional register value. + c.locationStack.pushRuntimeValueLocationOnConditionalRegister(arm64.CondEQ) + return nil +} + +// compileLt implements compiler.compileLt for the arm64 architecture. +func (c *arm64Compiler) compileLt(o *wazeroir.UnionOperation) error { + x1, x2, err := c.popTwoValuesOnRegisters() + if err != nil { + return err + } + + var inst asm.Instruction + var conditionalRegister asm.ConditionalRegisterState + signedType := wazeroir.SignedType(o.B1) + switch signedType { + case wazeroir.SignedTypeUint32: + inst = arm64.CMPW + conditionalRegister = arm64.CondLO + case wazeroir.SignedTypeUint64: + inst = arm64.CMP + conditionalRegister = arm64.CondLO + case wazeroir.SignedTypeInt32: + inst = arm64.CMPW + conditionalRegister = arm64.CondLT + case wazeroir.SignedTypeInt64: + inst = arm64.CMP + conditionalRegister = arm64.CondLT + case wazeroir.SignedTypeFloat32: + inst = arm64.FCMPS + conditionalRegister = arm64.CondMI + case wazeroir.SignedTypeFloat64: + inst = arm64.FCMPD + conditionalRegister = arm64.CondMI + } + + c.assembler.CompileTwoRegistersToNone(inst, x2.register, x1.register) + + // Push the comparison result as a conditional register value. + c.locationStack.pushRuntimeValueLocationOnConditionalRegister(conditionalRegister) + return nil +} + +// compileGt implements compiler.compileGt for the arm64 architecture. +func (c *arm64Compiler) compileGt(o *wazeroir.UnionOperation) error { + x1, x2, err := c.popTwoValuesOnRegisters() + if err != nil { + return err + } + + var inst asm.Instruction + var conditionalRegister asm.ConditionalRegisterState + signedType := wazeroir.SignedType(o.B1) + switch signedType { + case wazeroir.SignedTypeUint32: + inst = arm64.CMPW + conditionalRegister = arm64.CondHI + case wazeroir.SignedTypeUint64: + inst = arm64.CMP + conditionalRegister = arm64.CondHI + case wazeroir.SignedTypeInt32: + inst = arm64.CMPW + conditionalRegister = arm64.CondGT + case wazeroir.SignedTypeInt64: + inst = arm64.CMP + conditionalRegister = arm64.CondGT + case wazeroir.SignedTypeFloat32: + inst = arm64.FCMPS + conditionalRegister = arm64.CondGT + case wazeroir.SignedTypeFloat64: + inst = arm64.FCMPD + conditionalRegister = arm64.CondGT + } + + c.assembler.CompileTwoRegistersToNone(inst, x2.register, x1.register) + + // Push the comparison result as a conditional register value. + c.locationStack.pushRuntimeValueLocationOnConditionalRegister(conditionalRegister) + return nil +} + +// compileLe implements compiler.compileLe for the arm64 architecture. +func (c *arm64Compiler) compileLe(o *wazeroir.UnionOperation) error { + x1, x2, err := c.popTwoValuesOnRegisters() + if err != nil { + return err + } + + var inst asm.Instruction + var conditionalRegister asm.ConditionalRegisterState + signedType := wazeroir.SignedType(o.B1) + switch signedType { + case wazeroir.SignedTypeUint32: + inst = arm64.CMPW + conditionalRegister = arm64.CondLS + case wazeroir.SignedTypeUint64: + inst = arm64.CMP + conditionalRegister = arm64.CondLS + case wazeroir.SignedTypeInt32: + inst = arm64.CMPW + conditionalRegister = arm64.CondLE + case wazeroir.SignedTypeInt64: + inst = arm64.CMP + conditionalRegister = arm64.CondLE + case wazeroir.SignedTypeFloat32: + inst = arm64.FCMPS + conditionalRegister = arm64.CondLS + case wazeroir.SignedTypeFloat64: + inst = arm64.FCMPD + conditionalRegister = arm64.CondLS + } + + c.assembler.CompileTwoRegistersToNone(inst, x2.register, x1.register) + + // Push the comparison result as a conditional register value. + c.locationStack.pushRuntimeValueLocationOnConditionalRegister(conditionalRegister) + return nil +} + +// compileGe implements compiler.compileGe for the arm64 architecture. +func (c *arm64Compiler) compileGe(o *wazeroir.UnionOperation) error { + x1, x2, err := c.popTwoValuesOnRegisters() + if err != nil { + return err + } + + var inst asm.Instruction + var conditionalRegister asm.ConditionalRegisterState + signedType := wazeroir.SignedType(o.B1) + switch signedType { + case wazeroir.SignedTypeUint32: + inst = arm64.CMPW + conditionalRegister = arm64.CondHS + case wazeroir.SignedTypeUint64: + inst = arm64.CMP + conditionalRegister = arm64.CondHS + case wazeroir.SignedTypeInt32: + inst = arm64.CMPW + conditionalRegister = arm64.CondGE + case wazeroir.SignedTypeInt64: + inst = arm64.CMP + conditionalRegister = arm64.CondGE + case wazeroir.SignedTypeFloat32: + inst = arm64.FCMPS + conditionalRegister = arm64.CondGE + case wazeroir.SignedTypeFloat64: + inst = arm64.FCMPD + conditionalRegister = arm64.CondGE + } + + c.assembler.CompileTwoRegistersToNone(inst, x2.register, x1.register) + + // Push the comparison result as a conditional register value. + c.locationStack.pushRuntimeValueLocationOnConditionalRegister(conditionalRegister) + return nil +} + +// compileLoad implements compiler.compileLoad for the arm64 architecture. +func (c *arm64Compiler) compileLoad(o *wazeroir.UnionOperation) error { + var ( + isFloat bool + loadInst asm.Instruction + targetSizeInBytes int64 + vt runtimeValueType + ) + + unsignedType := wazeroir.UnsignedType(o.B1) + offset := uint32(o.U2) + + switch unsignedType { + case wazeroir.UnsignedTypeI32: + loadInst = arm64.LDRW + targetSizeInBytes = 32 / 8 + vt = runtimeValueTypeI32 + case wazeroir.UnsignedTypeI64: + loadInst = arm64.LDRD + targetSizeInBytes = 64 / 8 + vt = runtimeValueTypeI64 + case wazeroir.UnsignedTypeF32: + loadInst = arm64.FLDRS + isFloat = true + targetSizeInBytes = 32 / 8 + vt = runtimeValueTypeF32 + case wazeroir.UnsignedTypeF64: + loadInst = arm64.FLDRD + isFloat = true + targetSizeInBytes = 64 / 8 + vt = runtimeValueTypeF64 + } + return c.compileLoadImpl(offset, loadInst, targetSizeInBytes, isFloat, vt) +} + +// compileLoad8 implements compiler.compileLoad8 for the arm64 architecture. +func (c *arm64Compiler) compileLoad8(o *wazeroir.UnionOperation) error { + var loadInst asm.Instruction + var vt runtimeValueType + + signedInt := wazeroir.SignedInt(o.B1) + offset := uint32(o.U2) + + switch signedInt { + case wazeroir.SignedInt32: + loadInst = arm64.LDRSBW + vt = runtimeValueTypeI32 + case wazeroir.SignedInt64: + loadInst = arm64.LDRSBD + vt = runtimeValueTypeI64 + case wazeroir.SignedUint32: + loadInst = arm64.LDRB + vt = runtimeValueTypeI32 + case wazeroir.SignedUint64: + loadInst = arm64.LDRB + vt = runtimeValueTypeI64 + } + return c.compileLoadImpl(offset, loadInst, 1, false, vt) +} + +// compileLoad16 implements compiler.compileLoad16 for the arm64 architecture. +func (c *arm64Compiler) compileLoad16(o *wazeroir.UnionOperation) error { + var loadInst asm.Instruction + var vt runtimeValueType + + signedInt := wazeroir.SignedInt(o.B1) + offset := uint32(o.U2) + + switch signedInt { + case wazeroir.SignedInt32: + loadInst = arm64.LDRSHW + vt = runtimeValueTypeI32 + case wazeroir.SignedInt64: + loadInst = arm64.LDRSHD + vt = runtimeValueTypeI64 + case wazeroir.SignedUint32: + loadInst = arm64.LDRH + vt = runtimeValueTypeI32 + case wazeroir.SignedUint64: + loadInst = arm64.LDRH + vt = runtimeValueTypeI64 + } + return c.compileLoadImpl(offset, loadInst, 16/8, false, vt) +} + +// compileLoad32 implements compiler.compileLoad32 for the arm64 architecture. +func (c *arm64Compiler) compileLoad32(o *wazeroir.UnionOperation) error { + var loadInst asm.Instruction + signed := o.B1 == 1 + offset := uint32(o.U2) + + if signed { + loadInst = arm64.LDRSW + } else { + loadInst = arm64.LDRW + } + return c.compileLoadImpl(offset, loadInst, 32/8, false, runtimeValueTypeI64) +} + +// compileLoadImpl implements compileLoadImpl* variants for arm64 architecture. +func (c *arm64Compiler) compileLoadImpl(offsetArg uint32, loadInst asm.Instruction, + targetSizeInBytes int64, isFloat bool, resultRuntimeValueType runtimeValueType, +) error { + offsetReg, err := c.compileMemoryAccessOffsetSetup(offsetArg, targetSizeInBytes) + if err != nil { + return err + } + + resultRegister := offsetReg + if isFloat { + resultRegister, err = c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + } + + // "resultRegister = [arm64ReservedRegisterForMemory + offsetReg]" + // In other words, "resultRegister = memory.Buffer[offset: offset+targetSizeInBytes]" + c.assembler.CompileMemoryWithRegisterOffsetToRegister( + loadInst, + arm64ReservedRegisterForMemory, offsetReg, + resultRegister, + ) + + c.pushRuntimeValueLocationOnRegister(resultRegister, resultRuntimeValueType) + return nil +} + +// compileStore implements compiler.compileStore for the arm64 architecture. +func (c *arm64Compiler) compileStore(o *wazeroir.UnionOperation) error { + var movInst asm.Instruction + var targetSizeInBytes int64 + unsignedType := wazeroir.UnsignedType(o.B1) + offset := uint32(o.U2) + switch unsignedType { + case wazeroir.UnsignedTypeI32: + movInst = arm64.STRW + targetSizeInBytes = 32 / 8 + case wazeroir.UnsignedTypeI64: + movInst = arm64.STRD + targetSizeInBytes = 64 / 8 + case wazeroir.UnsignedTypeF32: + movInst = arm64.FSTRS + targetSizeInBytes = 32 / 8 + case wazeroir.UnsignedTypeF64: + movInst = arm64.FSTRD + targetSizeInBytes = 64 / 8 + } + return c.compileStoreImpl(offset, movInst, targetSizeInBytes) +} + +// compileStore8 implements compiler.compileStore8 for the arm64 architecture. +func (c *arm64Compiler) compileStore8(o *wazeroir.UnionOperation) error { + return c.compileStoreImpl(uint32(o.U2), arm64.STRB, 1) +} + +// compileStore16 implements compiler.compileStore16 for the arm64 architecture. +func (c *arm64Compiler) compileStore16(o *wazeroir.UnionOperation) error { + return c.compileStoreImpl(uint32(o.U2), arm64.STRH, 16/8) +} + +// compileStore32 implements compiler.compileStore32 for the arm64 architecture. +func (c *arm64Compiler) compileStore32(o *wazeroir.UnionOperation) error { + return c.compileStoreImpl(uint32(o.U2), arm64.STRW, 32/8) +} + +// compileStoreImpl implements compleStore* variants for arm64 architecture. +func (c *arm64Compiler) compileStoreImpl(offsetArg uint32, storeInst asm.Instruction, targetSizeInBytes int64) error { + val, err := c.popValueOnRegister() + if err != nil { + return err + } + // Mark temporarily used as compileMemoryAccessOffsetSetup might try allocating register. + c.markRegisterUsed(val.register) + + offsetReg, err := c.compileMemoryAccessOffsetSetup(offsetArg, targetSizeInBytes) + if err != nil { + return err + } + + // "[arm64ReservedRegisterForMemory + offsetReg] = val.register" + // In other words, "memory.Buffer[offset: offset+targetSizeInBytes] = val.register" + c.assembler.CompileRegisterToMemoryWithRegisterOffset( + storeInst, val.register, + arm64ReservedRegisterForMemory, offsetReg, + ) + + c.markRegisterUnused(val.register) + return nil +} + +// compileMemoryAccessOffsetSetup pops the top value from the stack (called "base"), stores "base + offsetArg" +// into a register, and returns the stored register. We call the result "offset" because we access the memory +// as memory.Buffer[offset: offset+targetSizeInBytes]. +// +// Note: this also emits the instructions to check the out of bounds memory access. +// In other words, if the offset+targetSizeInBytes exceeds the memory size, the code exits with nativeCallStatusCodeMemoryOutOfBounds status. +func (c *arm64Compiler) compileMemoryAccessOffsetSetup(offsetArg uint32, targetSizeInBytes int64) (offsetRegister asm.Register, err error) { + base, err := c.popValueOnRegister() + if err != nil { + return 0, err + } + + offsetRegister = base.register + if isZeroRegister(base.register) { + offsetRegister, err = c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return + } + c.assembler.CompileRegisterToRegister(arm64.MOVD, arm64.RegRZR, offsetRegister) + } + + if offsetConst := int64(offsetArg) + targetSizeInBytes; offsetConst <= math.MaxUint32 { + // "offsetRegister = base + offsetArg + targetSizeInBytes" + c.assembler.CompileConstToRegister(arm64.ADD, offsetConst, offsetRegister) + } else { + // If the offset const is too large, we exit with nativeCallStatusCodeMemoryOutOfBounds. + c.compileExitFromNativeCode(nativeCallStatusCodeMemoryOutOfBounds) + return + } + + // "arm64ReservedRegisterForTemporary = len(memory.Buffer)" + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineModuleContextMemorySliceLenOffset, + arm64ReservedRegisterForTemporary) + + // Check if offsetRegister(= base+offsetArg+targetSizeInBytes) > len(memory.Buffer). + c.assembler.CompileTwoRegistersToNone(arm64.CMP, arm64ReservedRegisterForTemporary, offsetRegister) + + // If offsetRegister(= base+offsetArg+targetSizeInBytes) exceeds the memory length, + // we exit the function with nativeCallStatusCodeMemoryOutOfBounds. + c.compileMaybeExitFromNativeCode(arm64.BCONDLS, nativeCallStatusCodeMemoryOutOfBounds) + + // Otherwise, we subtract targetSizeInBytes from offsetRegister. + c.assembler.CompileConstToRegister(arm64.SUB, targetSizeInBytes, offsetRegister) + return offsetRegister, nil +} + +// compileMemoryGrow implements compileMemoryGrow variants for arm64 architecture. +func (c *arm64Compiler) compileMemoryGrow() error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + if err := c.compileCallGoFunction(nativeCallStatusCodeCallBuiltInFunction, builtinFunctionIndexMemoryGrow); err != nil { + return err + } + + // After return, we re-initialize reserved registers just like preamble of functions. + c.compileReservedStackBasePointerRegisterInitialization() + c.compileReservedMemoryRegisterInitialization() + return nil +} + +// compileMemorySize implements compileMemorySize variants for arm64 architecture. +func (c *arm64Compiler) compileMemorySize() error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + reg, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + // "reg = len(memory.Buffer)" + c.assembler.CompileMemoryToRegister( + arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineModuleContextMemorySliceLenOffset, + reg, + ) + + // memory.size loads the page size of memory, so we have to divide by the page size. + // "reg = reg >> wasm.MemoryPageSizeInBits (== reg / wasm.MemoryPageSize) " + c.assembler.CompileConstToRegister( + arm64.LSR, + wasm.MemoryPageSizeInBits, + reg, + ) + + c.pushRuntimeValueLocationOnRegister(reg, runtimeValueTypeI32) + return nil +} + +// compileCallGoFunction adds instructions to call a Go function whose address equals the addr parameter. +// compilerStatus is set before making call, and it should be either nativeCallStatusCodeCallBuiltInFunction or +// nativeCallStatusCodeCallGoHostFunction. +func (c *arm64Compiler) compileCallGoFunction(compilerStatus nativeCallStatusCode, builtinFunction wasm.Index) error { + // Release all the registers as our calling convention requires the caller-save. + if err := c.compileReleaseAllRegistersToStack(); err != nil { + return err + } + + if compilerStatus == nativeCallStatusCodeCallBuiltInFunction { + // Set the target function address to ce.functionCallAddress + // "tmp = $index" + c.assembler.CompileConstToRegister( + arm64.MOVD, + int64(builtinFunction), + arm64ReservedRegisterForTemporary, + ) + // "[arm64ReservedRegisterForCallEngine + callEngineExitContextFunctionCallAddressOffset] = tmp" + // In other words, "ce.functionCallAddress = tmp (== $addr)" + c.assembler.CompileRegisterToMemory( + arm64.STRW, + arm64ReservedRegisterForTemporary, + arm64ReservedRegisterForCallEngine, callEngineExitContextBuiltinFunctionCallIndexOffset, + ) + } + + c.compileExitFromNativeCode(compilerStatus) + return nil +} + +// compileConstI32 implements compiler.compileConstI32 for the arm64 architecture. +func (c *arm64Compiler) compileConstI32(o *wazeroir.UnionOperation) error { + return c.compileIntConstant(true, o.U1) +} + +// compileConstI64 implements compiler.compileConstI64 for the arm64 architecture. +func (c *arm64Compiler) compileConstI64(o *wazeroir.UnionOperation) error { + return c.compileIntConstant(false, o.U1) +} + +// compileIntConstant adds instructions to load an integer constant. +// is32bit is true if the target value is originally 32-bit const, false otherwise. +// value holds the (zero-extended for 32-bit case) load target constant. +func (c *arm64Compiler) compileIntConstant(is32bit bool, value uint64) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + var inst asm.Instruction + var vt runtimeValueType + if is32bit { + inst = arm64.MOVW + vt = runtimeValueTypeI32 + } else { + inst = arm64.MOVD + vt = runtimeValueTypeI64 + } + + if value == 0 { + c.pushRuntimeValueLocationOnRegister(arm64.RegRZR, vt) + } else { + // Take a register to load the value. + reg, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + c.assembler.CompileConstToRegister(inst, int64(value), reg) + + c.pushRuntimeValueLocationOnRegister(reg, vt) + } + return nil +} + +// compileConstF32 implements compiler.compileConstF32 for the arm64 architecture. +func (c *arm64Compiler) compileConstF32(o *wazeroir.UnionOperation) error { + return c.compileFloatConstant(true, o.U1 /*uint64(math.Float32bits(o.Value))*/) +} + +// compileConstF64 implements compiler.compileConstF64 for the arm64 architecture. +func (c *arm64Compiler) compileConstF64(o *wazeroir.UnionOperation) error { + return c.compileFloatConstant(false, o.U1 /*math.Float64bits(o.Value)*/) +} + +// compileFloatConstant adds instructions to load a float constant. +// is32bit is true if the target value is originally 32-bit const, false otherwise. +// value holds the (zero-extended for 32-bit case) bit representation of load target float constant. +func (c *arm64Compiler) compileFloatConstant(is32bit bool, value uint64) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + // Take a register to load the value. + reg, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + tmpReg := arm64.RegRZR + if value != 0 { + tmpReg = arm64ReservedRegisterForTemporary + var inst asm.Instruction + if is32bit { + inst = arm64.MOVW + } else { + inst = arm64.MOVD + } + c.assembler.CompileConstToRegister(inst, int64(value), tmpReg) + } + + // Use FMOV instruction to move the value on integer register into the float one. + var inst asm.Instruction + var vt runtimeValueType + if is32bit { + vt = runtimeValueTypeF32 + inst = arm64.FMOVS + } else { + vt = runtimeValueTypeF64 + inst = arm64.FMOVD + } + c.assembler.CompileRegisterToRegister(inst, tmpReg, reg) + + c.pushRuntimeValueLocationOnRegister(reg, vt) + return nil +} + +// compileMemoryInit implements compiler.compileMemoryInit for the arm64 architecture. +func (c *arm64Compiler) compileMemoryInit(o *wazeroir.UnionOperation) error { + dataIndex := uint32(o.U1) + return c.compileInitImpl(false, dataIndex, 0) +} + +// compileInitImpl implements compileTableInit and compileMemoryInit. +// +// TODO: the compiled code in this function should be reused and compile at once as +// the code is independent of any module. +func (c *arm64Compiler) compileInitImpl(isTable bool, index, tableIndex uint32) error { + outOfBoundsErrorStatus := nativeCallStatusCodeMemoryOutOfBounds + if isTable { + outOfBoundsErrorStatus = nativeCallStatusCodeInvalidTableAccess + } + + copySize, err := c.popValueOnRegister() + if err != nil { + return err + } + c.markRegisterUsed(copySize.register) + + sourceOffset, err := c.popValueOnRegister() + if err != nil { + return err + } + if isZeroRegister(sourceOffset.register) { + sourceOffset.register, err = c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.assembler.CompileRegisterToRegister(arm64.MOVD, arm64.RegRZR, sourceOffset.register) + } + c.markRegisterUsed(sourceOffset.register) + + destinationOffset, err := c.popValueOnRegister() + if err != nil { + return err + } + if isZeroRegister(destinationOffset.register) { + destinationOffset.register, err = c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.assembler.CompileRegisterToRegister(arm64.MOVD, arm64.RegRZR, destinationOffset.register) + } + c.markRegisterUsed(destinationOffset.register) + + tableInstanceAddressReg := asm.NilRegister + if isTable { + tableInstanceAddressReg, err = c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.markRegisterUsed(tableInstanceAddressReg) + } + + if !isZeroRegister(copySize.register) { + // sourceOffset += size. + c.assembler.CompileRegisterToRegister(arm64.ADD, copySize.register, sourceOffset.register) + // destinationOffset += size. + c.assembler.CompileRegisterToRegister(arm64.ADD, copySize.register, destinationOffset.register) + } + + instanceAddr, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + if isTable { + c.compileLoadElemInstanceAddress(index, instanceAddr) + } else { + c.compileLoadDataInstanceAddress(index, instanceAddr) + } + + // Check data instance bounds. + c.assembler.CompileMemoryToRegister(arm64.LDRD, + instanceAddr, 8, // DataInstance and Element instance holds the length is stored at offset 8. + arm64ReservedRegisterForTemporary) + + c.assembler.CompileTwoRegistersToNone(arm64.CMP, arm64ReservedRegisterForTemporary, sourceOffset.register) + // If not, raise out of bounds memory access error. + c.compileMaybeExitFromNativeCode(arm64.BCONDLS, outOfBoundsErrorStatus) + + // Otherwise, ready to copy the value from destination to source. + // Check destination bounds. + if isTable { + // arm64ReservedRegisterForTemporary = &tables[0] + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineModuleContextTablesElement0AddressOffset, + arm64ReservedRegisterForTemporary) + // tableInstanceAddressReg = arm64ReservedRegisterForTemporary + tableIndex*8 + // = &tables[0] + sizeOf(*tableInstance)*8 + // = &tables[tableIndex] + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, int64(tableIndex)*8, + tableInstanceAddressReg) + // arm64ReservedRegisterForTemporary = [tableInstanceAddressReg+tableInstanceTableLenOffset] = len(tables[tableIndex]) + c.assembler.CompileMemoryToRegister(arm64.LDRD, + tableInstanceAddressReg, tableInstanceTableLenOffset, + arm64ReservedRegisterForTemporary) + } else { + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineModuleContextMemorySliceLenOffset, + arm64ReservedRegisterForTemporary) + } + + c.assembler.CompileTwoRegistersToNone(arm64.CMP, arm64ReservedRegisterForTemporary, destinationOffset.register) + // If not, raise out of bounds memory access error. + c.compileMaybeExitFromNativeCode(arm64.BCONDLS, outOfBoundsErrorStatus) + + // Otherwise, ready to copy the value from source to destination. + if !isZeroRegister(copySize.register) { + // If the size equals zero, we can skip the entire instructions beflow. + c.assembler.CompileTwoRegistersToNone(arm64.CMP, arm64.RegRZR, copySize.register) + skipCopyJump := c.assembler.CompileJump(arm64.BCONDEQ) + + var ldr, str asm.Instruction + var movSize int64 + if isTable { + ldr, str = arm64.LDRD, arm64.STRD + movSize = 8 + + // arm64ReservedRegisterForTemporary = &Table[0] + c.assembler.CompileMemoryToRegister(arm64.LDRD, tableInstanceAddressReg, + tableInstanceTableOffset, arm64ReservedRegisterForTemporary) + // destinationOffset = (destinationOffset<< pointerSizeLog2) + arm64ReservedRegisterForTemporary + c.assembler.CompileLeftShiftedRegisterToRegister(arm64.ADD, + destinationOffset.register, pointerSizeLog2, + arm64ReservedRegisterForTemporary, destinationOffset.register) + + // arm64ReservedRegisterForTemporary = &ElementInstance.References[0] + c.assembler.CompileMemoryToRegister(arm64.LDRD, instanceAddr, 0, arm64ReservedRegisterForTemporary) + // sourceOffset = (sourceOffset<< pointerSizeLog2) + arm64ReservedRegisterForTemporary + c.assembler.CompileLeftShiftedRegisterToRegister(arm64.ADD, + sourceOffset.register, pointerSizeLog2, + arm64ReservedRegisterForTemporary, sourceOffset.register) + + // copySize = copySize << pointerSizeLog2 + c.assembler.CompileConstToRegister(arm64.LSL, pointerSizeLog2, copySize.register) + } else { + ldr, str = arm64.LDRB, arm64.STRB + movSize = 1 + + // destinationOffset += memory buffer's absolute address. + c.assembler.CompileRegisterToRegister(arm64.ADD, arm64ReservedRegisterForMemory, destinationOffset.register) + + // sourceOffset += data buffer's absolute address. + c.assembler.CompileMemoryToRegister(arm64.LDRD, instanceAddr, 0, arm64ReservedRegisterForTemporary) + c.assembler.CompileRegisterToRegister(arm64.ADD, arm64ReservedRegisterForTemporary, sourceOffset.register) + + } + + // Negate the counter. + c.assembler.CompileRegisterToRegister(arm64.NEG, copySize.register, copySize.register) + + beginCopyLoop := c.assembler.CompileStandAlone(arm64.NOP) + + // arm64ReservedRegisterForTemporary = [sourceOffset + (size.register)] + c.assembler.CompileMemoryWithRegisterOffsetToRegister(ldr, + sourceOffset.register, copySize.register, + arm64ReservedRegisterForTemporary) + // [destinationOffset + (size.register)] = arm64ReservedRegisterForTemporary. + c.assembler.CompileRegisterToMemoryWithRegisterOffset(str, + arm64ReservedRegisterForTemporary, + destinationOffset.register, copySize.register, + ) + + // Decrement the size counter and if the value is still negative, continue the loop. + c.assembler.CompileConstToRegister(arm64.ADDS, movSize, copySize.register) + c.assembler.CompileJump(arm64.BCONDMI).AssignJumpTarget(beginCopyLoop) + + c.assembler.SetJumpTargetOnNext(skipCopyJump) + } + + c.markRegisterUnused(copySize.register, sourceOffset.register, + destinationOffset.register, instanceAddr, tableInstanceAddressReg) + return nil +} + +// compileDataDrop implements compiler.compileDataDrop for the arm64 architecture. +func (c *arm64Compiler) compileDataDrop(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + tmp, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + dataIndex := uint32(o.U1) + c.compileLoadDataInstanceAddress(dataIndex, tmp) + + // Clears the content of DataInstance[o.DataIndex] (== []byte type). + c.assembler.CompileRegisterToMemory(arm64.STRD, arm64.RegRZR, tmp, 0) + c.assembler.CompileRegisterToMemory(arm64.STRD, arm64.RegRZR, tmp, 8) + c.assembler.CompileRegisterToMemory(arm64.STRD, arm64.RegRZR, tmp, 16) + return nil +} + +func (c *arm64Compiler) compileLoadDataInstanceAddress(dataIndex uint32, dst asm.Register) { + // dst = dataIndex * dataInstanceStructSize + c.assembler.CompileConstToRegister(arm64.MOVD, int64(dataIndex)*dataInstanceStructSize, dst) + + // arm64ReservedRegisterForTemporary = &moduleInstance.DataInstances[0] + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineModuleContextDataInstancesElement0AddressOffset, + arm64ReservedRegisterForTemporary, + ) + + // dst = arm64ReservedRegisterForTemporary + dst + // = &moduleInstance.DataInstances[0] + dataIndex*dataInstanceStructSize + // = &moduleInstance.DataInstances[dataIndex] + c.assembler.CompileRegisterToRegister(arm64.ADD, arm64ReservedRegisterForTemporary, dst) +} + +// compileMemoryCopy implements compiler.compileMemoryCopy for the arm64 architecture. +func (c *arm64Compiler) compileMemoryCopy() error { + return c.compileCopyImpl(false, 0, 0) +} + +// compileCopyImpl implements compileTableCopy and compileMemoryCopy. +// +// TODO: the compiled code in this function should be reused and compile at once as +// the code is independent of any module. +func (c *arm64Compiler) compileCopyImpl(isTable bool, srcTableIndex, dstTableIndex uint32) error { + outOfBoundsErrorStatus := nativeCallStatusCodeMemoryOutOfBounds + if isTable { + outOfBoundsErrorStatus = nativeCallStatusCodeInvalidTableAccess + } + + copySize, err := c.popValueOnRegister() + if err != nil { + return err + } + c.markRegisterUsed(copySize.register) + + sourceOffset, err := c.popValueOnRegister() + if err != nil { + return err + } + if isZeroRegister(sourceOffset.register) { + sourceOffset.register, err = c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.assembler.CompileRegisterToRegister(arm64.MOVD, arm64.RegRZR, sourceOffset.register) + } + c.markRegisterUsed(sourceOffset.register) + + destinationOffset, err := c.popValueOnRegister() + if err != nil { + return err + } + if isZeroRegister(destinationOffset.register) { + destinationOffset.register, err = c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.assembler.CompileRegisterToRegister(arm64.MOVD, arm64.RegRZR, destinationOffset.register) + } + c.markRegisterUsed(destinationOffset.register) + + if !isZeroRegister(copySize.register) { + // sourceOffset += size. + c.assembler.CompileRegisterToRegister(arm64.ADD, copySize.register, sourceOffset.register) + // destinationOffset += size. + c.assembler.CompileRegisterToRegister(arm64.ADD, copySize.register, destinationOffset.register) + } + + if isTable { + // arm64ReservedRegisterForTemporary = &tables[0] + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineModuleContextTablesElement0AddressOffset, + arm64ReservedRegisterForTemporary) + // arm64ReservedRegisterForTemporary = arm64ReservedRegisterForTemporary + srcTableIndex*8 + // = &tables[0] + sizeOf(*tableInstance)*8 + // = &tables[srcTableIndex] + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, int64(srcTableIndex)*8, + arm64ReservedRegisterForTemporary) + // arm64ReservedRegisterForTemporary = [arm64ReservedRegisterForTemporary+tableInstanceTableLenOffset] = len(tables[srcTableIndex]) + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, tableInstanceTableLenOffset, + arm64ReservedRegisterForTemporary) + } else { + // arm64ReservedRegisterForTemporary = len(memoryInst.Buffer). + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineModuleContextMemorySliceLenOffset, + arm64ReservedRegisterForTemporary) + } + + // Check memory len >= sourceOffset. + c.assembler.CompileTwoRegistersToNone(arm64.CMP, arm64ReservedRegisterForTemporary, sourceOffset.register) + // If not, raise out of bounds memory access error. + c.compileMaybeExitFromNativeCode(arm64.BCONDLS, outOfBoundsErrorStatus) + + // Otherwise, check memory len >= destinationOffset. + if isTable { + // arm64ReservedRegisterForTemporary = &tables[0] + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineModuleContextTablesElement0AddressOffset, + arm64ReservedRegisterForTemporary) + // arm64ReservedRegisterForTemporary = arm64ReservedRegisterForTemporary + dstTableIndex*8 + // = &tables[0] + sizeOf(*tableInstance)*8 + // = &tables[dstTableIndex] + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, int64(dstTableIndex)*8, + arm64ReservedRegisterForTemporary) + // arm64ReservedRegisterForTemporary = [arm64ReservedRegisterForTemporary+tableInstanceTableLenOffset] = len(tables[dstTableIndex]) + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, tableInstanceTableLenOffset, + arm64ReservedRegisterForTemporary) + } + + c.assembler.CompileTwoRegistersToNone(arm64.CMP, arm64ReservedRegisterForTemporary, destinationOffset.register) + // If not, raise out of bounds memory access error. + c.compileMaybeExitFromNativeCode(arm64.BCONDLS, outOfBoundsErrorStatus) + + // Otherwise, ready to copy the value from source to destination. + var ldr, str asm.Instruction + var movSize int64 + if isTable { + ldr, str = arm64.LDRD, arm64.STRD + movSize = 8 + } else { + ldr, str = arm64.LDRB, arm64.STRB + movSize = 1 + } + + // If the size equals zero, we can skip the entire instructions beflow. + if !isZeroRegister(copySize.register) { + c.assembler.CompileTwoRegistersToNone(arm64.CMP, arm64.RegRZR, copySize.register) + skipCopyJump := c.assembler.CompileJump(arm64.BCONDEQ) + + // If source offet < destination offset: for (i = size-1; i >= 0; i--) dst[i] = src[i]; + c.assembler.CompileTwoRegistersToNone(arm64.CMP, sourceOffset.register, destinationOffset.register) + destLowerThanSourceJump := c.assembler.CompileJump(arm64.BCONDLS) + var endJump asm.Node + { + // sourceOffset -= size. + c.assembler.CompileRegisterToRegister(arm64.SUB, copySize.register, sourceOffset.register) + // destinationOffset -= size. + c.assembler.CompileRegisterToRegister(arm64.SUB, copySize.register, destinationOffset.register) + + if isTable { + // arm64ReservedRegisterForTemporary = &Tables[dstTableIndex].Table[0] + c.assembler.CompileMemoryToRegister(arm64.LDRD, arm64ReservedRegisterForCallEngine, + callEngineModuleContextTablesElement0AddressOffset, arm64ReservedRegisterForTemporary) + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, int64(dstTableIndex)*8, + arm64ReservedRegisterForTemporary) + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, tableInstanceTableOffset, + arm64ReservedRegisterForTemporary) + // destinationOffset = (destinationOffset<< pointerSizeLog2) + &Table[dstTableIndex].Table[0] + c.assembler.CompileLeftShiftedRegisterToRegister(arm64.ADD, + destinationOffset.register, pointerSizeLog2, + arm64ReservedRegisterForTemporary, destinationOffset.register) + + // arm64ReservedRegisterForTemporary = &Tables[srcTableIndex] + c.assembler.CompileMemoryToRegister(arm64.LDRD, arm64ReservedRegisterForCallEngine, + callEngineModuleContextTablesElement0AddressOffset, arm64ReservedRegisterForTemporary) + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, int64(srcTableIndex)*8, + arm64ReservedRegisterForTemporary) + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, tableInstanceTableOffset, + arm64ReservedRegisterForTemporary) + // sourceOffset = (sourceOffset<< 3) + &Table[0] + c.assembler.CompileLeftShiftedRegisterToRegister(arm64.ADD, + sourceOffset.register, pointerSizeLog2, + arm64ReservedRegisterForTemporary, sourceOffset.register) + + // copySize = copySize << pointerSizeLog2 as each element has 8 bytes and we copy one by one. + c.assembler.CompileConstToRegister(arm64.LSL, pointerSizeLog2, copySize.register) + } else { + // sourceOffset += memory buffer's absolute address. + c.assembler.CompileRegisterToRegister(arm64.ADD, arm64ReservedRegisterForMemory, sourceOffset.register) + // destinationOffset += memory buffer's absolute address. + c.assembler.CompileRegisterToRegister(arm64.ADD, arm64ReservedRegisterForMemory, destinationOffset.register) + } + + beginCopyLoop := c.assembler.CompileStandAlone(arm64.NOP) + + // size -= 1 + c.assembler.CompileConstToRegister(arm64.SUBS, movSize, copySize.register) + + // arm64ReservedRegisterForTemporary = [sourceOffset + (size.register)] + c.assembler.CompileMemoryWithRegisterOffsetToRegister(ldr, + sourceOffset.register, copySize.register, + arm64ReservedRegisterForTemporary) + // [destinationOffset + (size.register)] = arm64ReservedRegisterForTemporary. + c.assembler.CompileRegisterToMemoryWithRegisterOffset(str, + arm64ReservedRegisterForTemporary, + destinationOffset.register, copySize.register, + ) + + // If the value on the copySize.register is not equal zero, continue the loop. + c.assembler.CompileJump(arm64.BCONDNE).AssignJumpTarget(beginCopyLoop) + + // Otherwise, exit the loop. + endJump = c.assembler.CompileJump(arm64.B) + } + + // Else (destination offet < source offset): for (i = 0; i < size; i++) dst[counter-1-i] = src[counter-1-i]; + c.assembler.SetJumpTargetOnNext(destLowerThanSourceJump) + { + + if isTable { + // arm64ReservedRegisterForTemporary = &Tables[dstTableIndex].Table[0] + c.assembler.CompileMemoryToRegister(arm64.LDRD, arm64ReservedRegisterForCallEngine, + callEngineModuleContextTablesElement0AddressOffset, arm64ReservedRegisterForTemporary) + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, int64(dstTableIndex)*8, + arm64ReservedRegisterForTemporary) + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, tableInstanceTableOffset, + arm64ReservedRegisterForTemporary) + // destinationOffset = (destinationOffset<< interfaceDataySizeLog2) + &Table[dstTableIndex].Table[0] + c.assembler.CompileLeftShiftedRegisterToRegister(arm64.ADD, + destinationOffset.register, pointerSizeLog2, + arm64ReservedRegisterForTemporary, destinationOffset.register) + + // arm64ReservedRegisterForTemporary = &Tables[srcTableIndex] + c.assembler.CompileMemoryToRegister(arm64.LDRD, arm64ReservedRegisterForCallEngine, + callEngineModuleContextTablesElement0AddressOffset, arm64ReservedRegisterForTemporary) + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, int64(srcTableIndex)*8, + arm64ReservedRegisterForTemporary) + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, tableInstanceTableOffset, + arm64ReservedRegisterForTemporary) + // sourceOffset = (sourceOffset<< 3) + &Table[0] + c.assembler.CompileLeftShiftedRegisterToRegister(arm64.ADD, + sourceOffset.register, pointerSizeLog2, + arm64ReservedRegisterForTemporary, sourceOffset.register) + + // copySize = copySize << pointerSizeLog2 as each element has 8 bytes and we copy one by one. + c.assembler.CompileConstToRegister(arm64.LSL, pointerSizeLog2, copySize.register) + } else { + // sourceOffset += memory buffer's absolute address. + c.assembler.CompileRegisterToRegister(arm64.ADD, arm64ReservedRegisterForMemory, sourceOffset.register) + // destinationOffset += memory buffer's absolute address. + c.assembler.CompileRegisterToRegister(arm64.ADD, arm64ReservedRegisterForMemory, destinationOffset.register) + } + + // Negate the counter. + c.assembler.CompileRegisterToRegister(arm64.NEG, copySize.register, copySize.register) + + beginCopyLoop := c.assembler.CompileStandAlone(arm64.NOP) + + // arm64ReservedRegisterForTemporary = [sourceOffset + (size.register)] + c.assembler.CompileMemoryWithRegisterOffsetToRegister(ldr, + sourceOffset.register, copySize.register, + arm64ReservedRegisterForTemporary) + // [destinationOffset + (size.register)] = arm64ReservedRegisterForTemporary. + c.assembler.CompileRegisterToMemoryWithRegisterOffset(str, + arm64ReservedRegisterForTemporary, + destinationOffset.register, copySize.register, + ) + + // size += 1 + c.assembler.CompileConstToRegister(arm64.ADDS, movSize, copySize.register) + c.assembler.CompileJump(arm64.BCONDMI).AssignJumpTarget(beginCopyLoop) + } + c.assembler.SetJumpTargetOnNext(skipCopyJump) + c.assembler.SetJumpTargetOnNext(endJump) + } + + // Mark all of the operand registers. + c.markRegisterUnused(copySize.register, sourceOffset.register, destinationOffset.register) + + return nil +} + +// compileMemoryFill implements compiler.compileMemoryCopy for the arm64 architecture. +func (c *arm64Compiler) compileMemoryFill() error { + return c.compileFillImpl(false, 0) +} + +// compileFillImpl implements TableFill and MemoryFill. +// +// TODO: the compiled code in this function should be reused and compile at once as +// the code is independent of any module. +func (c *arm64Compiler) compileFillImpl(isTable bool, tableIndex uint32) error { + outOfBoundsErrorStatus := nativeCallStatusCodeMemoryOutOfBounds + if isTable { + outOfBoundsErrorStatus = nativeCallStatusCodeInvalidTableAccess + } + + fillSize, err := c.popValueOnRegister() + if err != nil { + return err + } + c.markRegisterUsed(fillSize.register) + + value, err := c.popValueOnRegister() + if err != nil { + return err + } + c.markRegisterUsed(value.register) + + destinationOffset, err := c.popValueOnRegister() + if err != nil { + return err + } + if isZeroRegister(destinationOffset.register) { + destinationOffset.register, err = c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.assembler.CompileRegisterToRegister(arm64.MOVD, arm64.RegRZR, destinationOffset.register) + } + c.markRegisterUsed(destinationOffset.register) + + // destinationOffset += size. + c.assembler.CompileRegisterToRegister(arm64.ADD, fillSize.register, destinationOffset.register) + + if isTable { + // arm64ReservedRegisterForTemporary = &tables[0] + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineModuleContextTablesElement0AddressOffset, + arm64ReservedRegisterForTemporary) + // arm64ReservedRegisterForTemporary = arm64ReservedRegisterForTemporary + srcTableIndex*8 + // = &tables[0] + sizeOf(*tableInstance)*8 + // = &tables[srcTableIndex] + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, int64(tableIndex)*8, + arm64ReservedRegisterForTemporary) + // arm64ReservedRegisterForTemporary = [arm64ReservedRegisterForTemporary+tableInstanceTableLenOffset] = len(tables[srcTableIndex]) + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, tableInstanceTableLenOffset, + arm64ReservedRegisterForTemporary) + } else { + // arm64ReservedRegisterForTemporary = len(memoryInst.Buffer). + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineModuleContextMemorySliceLenOffset, + arm64ReservedRegisterForTemporary) + } + + // Check len >= destinationOffset. + c.assembler.CompileTwoRegistersToNone(arm64.CMP, arm64ReservedRegisterForTemporary, destinationOffset.register) + + // If not, raise the runtime error. + c.compileMaybeExitFromNativeCode(arm64.BCONDLS, outOfBoundsErrorStatus) + + // Otherwise, ready to copy the value from destination to source. + // If the size equals zero, we can skip the entire instructions below. + c.assembler.CompileTwoRegistersToNone(arm64.CMP, arm64.RegRZR, fillSize.register) + skipCopyJump := c.assembler.CompileJump(arm64.BCONDEQ) + + // destinationOffset -= size. + c.assembler.CompileRegisterToRegister(arm64.SUB, fillSize.register, destinationOffset.register) + + var str asm.Instruction + var movSize int64 + if isTable { + str = arm64.STRD + movSize = 8 + + // arm64ReservedRegisterForTemporary = &Tables[dstTableIndex].Table[0] + c.assembler.CompileMemoryToRegister(arm64.LDRD, arm64ReservedRegisterForCallEngine, + callEngineModuleContextTablesElement0AddressOffset, arm64ReservedRegisterForTemporary) + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, int64(tableIndex)*8, + arm64ReservedRegisterForTemporary) + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, tableInstanceTableOffset, + arm64ReservedRegisterForTemporary) + // destinationOffset = (destinationOffset<< pointerSizeLog2) + &Table[dstTableIndex].Table[0] + c.assembler.CompileLeftShiftedRegisterToRegister(arm64.ADD, + destinationOffset.register, pointerSizeLog2, + arm64ReservedRegisterForTemporary, destinationOffset.register) + + // copySize = copySize << pointerSizeLog2 as each element has 8 bytes and we copy one by one. + c.assembler.CompileConstToRegister(arm64.LSL, pointerSizeLog2, fillSize.register) + } else { + str = arm64.STRB + movSize = 1 + + // destinationOffset += memory buffer's absolute address. + c.assembler.CompileRegisterToRegister(arm64.ADD, arm64ReservedRegisterForMemory, destinationOffset.register) + } + + // Naively implement the copy with "for loop" by copying byte one by one. + beginCopyLoop := c.assembler.CompileStandAlone(arm64.NOP) + + // size -= 1 + c.assembler.CompileConstToRegister(arm64.SUBS, movSize, fillSize.register) + + // [destinationOffset + (size.register)] = arm64ReservedRegisterForTemporary. + c.assembler.CompileRegisterToMemoryWithRegisterOffset(str, + value.register, + destinationOffset.register, fillSize.register, + ) + + // If the value on the copySizeRgister.register is not equal zero, continue the loop. + continueJump := c.assembler.CompileJump(arm64.BCONDNE) + continueJump.AssignJumpTarget(beginCopyLoop) + + // Mark all of the operand registers. + c.markRegisterUnused(fillSize.register, value.register, destinationOffset.register) + + c.assembler.SetJumpTargetOnNext(skipCopyJump) + return nil +} + +// compileTableInit implements compiler.compileTableInit for the arm64 architecture. +func (c *arm64Compiler) compileTableInit(o *wazeroir.UnionOperation) error { + elemIndex := uint32(o.U1) + tableIndex := uint32(o.U2) + return c.compileInitImpl(true, elemIndex, tableIndex) +} + +// compileTableCopy implements compiler.compileTableCopy for the arm64 architecture. +func (c *arm64Compiler) compileTableCopy(o *wazeroir.UnionOperation) error { + return c.compileCopyImpl(true, uint32(o.U1), uint32(o.U2)) +} + +// compileElemDrop implements compiler.compileElemDrop for the arm64 architecture. +func (c *arm64Compiler) compileElemDrop(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + tmp, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + elemIndex := uint32(o.U1) + c.compileLoadElemInstanceAddress(elemIndex, tmp) + + // Clears the content of ElementInstances[o.ElemIndex] (== []interface{} type). + c.assembler.CompileRegisterToMemory(arm64.STRD, arm64.RegRZR, tmp, 0) + c.assembler.CompileRegisterToMemory(arm64.STRD, arm64.RegRZR, tmp, 8) + c.assembler.CompileRegisterToMemory(arm64.STRD, arm64.RegRZR, tmp, 16) + return nil +} + +func (c *arm64Compiler) compileLoadElemInstanceAddress(elemIndex uint32, dst asm.Register) { + // dst = dataIndex * elementInstanceStructSize + c.assembler.CompileConstToRegister(arm64.MOVD, int64(elemIndex)*elementInstanceStructSize, dst) + + // arm64ReservedRegisterForTemporary = &moduleInstance.ElementInstances[0] + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineModuleContextElementInstancesElement0AddressOffset, + arm64ReservedRegisterForTemporary, + ) + + // dst = arm64ReservedRegisterForTemporary + dst + // = &moduleInstance.ElementInstances[0] + elemIndex*elementInstanceStructSize + // = &moduleInstance.ElementInstances[elemIndex] + c.assembler.CompileRegisterToRegister(arm64.ADD, arm64ReservedRegisterForTemporary, dst) +} + +// compileRefFunc implements compiler.compileRefFunc for the arm64 architecture. +func (c *arm64Compiler) compileRefFunc(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + ref, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + // arm64ReservedRegisterForTemporary = [arm64ReservedRegisterForCallEngine + callEngineModuleContextFunctionsElement0AddressOffset] + // = &moduleEngine.functions[0] + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineModuleContextFunctionsElement0AddressOffset, + ref) + + // ref = ref + int64(o.FunctionIndex)*sizeOf(function) + // = &moduleEngine.functions[index] + functionIndex := int64(o.U1) + c.assembler.CompileConstToRegister(arm64.ADD, + functionIndex*functionSize, + ref, + ) + + c.pushRuntimeValueLocationOnRegister(ref, runtimeValueTypeI64) + return nil +} + +// compileTableGet implements compiler.compileTableGet for the arm64 architecture. +func (c *arm64Compiler) compileTableGet(o *wazeroir.UnionOperation) error { + ref, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.markRegisterUsed(ref) + + offset, err := c.popValueOnRegister() + if err != nil { + return err + } + + // arm64ReservedRegisterForTemporary = &tables[0] + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineModuleContextTablesElement0AddressOffset, + arm64ReservedRegisterForTemporary) + // arm64ReservedRegisterForTemporary = [arm64ReservedRegisterForTemporary + TableIndex*8] + // = [&tables[0] + TableIndex*sizeOf(*tableInstance)] + // = [&tables[TableIndex]] = tables[TableIndex]. + tableIndex := int64(o.U1) + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, tableIndex*8, + arm64ReservedRegisterForTemporary) + + // Out of bounds check. + // ref = [&tables[TableIndex] + tableInstanceTableLenOffset] = len(tables[TableIndex]) + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, tableInstanceTableLenOffset, + ref, + ) + // "cmp ref, offset" + c.assembler.CompileTwoRegistersToNone(arm64.CMP, ref, offset.register) + + // If it exceeds len(table), we exit the execution. + c.compileMaybeExitFromNativeCode(arm64.BCONDLO, nativeCallStatusCodeInvalidTableAccess) + + // ref = [&tables[TableIndex] + tableInstanceTableOffset] = &tables[TableIndex].References[0] + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, tableInstanceTableOffset, + ref, + ) + + // ref = (offset << pointerSizeLog2) + ref + // = &tables[TableIndex].References[0] + sizeOf(uintptr) * offset + // = &tables[TableIndex].References[offset] + c.assembler.CompileLeftShiftedRegisterToRegister(arm64.ADD, + offset.register, pointerSizeLog2, ref, ref) + + // ref = [&tables[TableIndex]] = load the Reference's pointer as uint64. + c.assembler.CompileMemoryToRegister(arm64.LDRD, ref, 0, ref) + + c.pushRuntimeValueLocationOnRegister(ref, runtimeValueTypeI64) // table elements are opaque 64-bit at runtime. + return nil +} + +// compileTableSet implements compiler.compileTableSet for the arm64 architecture. +func (c *arm64Compiler) compileTableSet(o *wazeroir.UnionOperation) error { + ref := c.locationStack.pop() + if err := c.compileEnsureOnRegister(ref); err != nil { + return err + } + + offset := c.locationStack.pop() + if err := c.compileEnsureOnRegister(offset); err != nil { + return err + } + + tmp, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + // arm64ReservedRegisterForTemporary = &tables[0] + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineModuleContextTablesElement0AddressOffset, + arm64ReservedRegisterForTemporary) + // arm64ReservedRegisterForTemporary = arm64ReservedRegisterForTemporary + TableIndex*8 + // = &tables[0] + TableIndex*sizeOf(*tableInstance) + // = &tables[TableIndex] + tableIndex := int64(o.U1) + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, tableIndex*8, + arm64ReservedRegisterForTemporary) + + // Out of bounds check. + // tmp = [&tables[TableIndex] + tableInstanceTableLenOffset] = len(tables[TableIndex]) + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, tableInstanceTableLenOffset, + tmp, + ) + // "cmp tmp, offset" + c.assembler.CompileTwoRegistersToNone(arm64.CMP, tmp, offset.register) + + // If it exceeds len(table), we exit the execution. + c.compileMaybeExitFromNativeCode(arm64.BCONDLO, nativeCallStatusCodeInvalidTableAccess) + + // tmp = [&tables[TableIndex] + tableInstanceTableOffset] = &tables[TableIndex].References[0] + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, tableInstanceTableOffset, + tmp, + ) + + // tmp = (offset << pointerSizeLog2) + tmp + // = &tables[TableIndex].References[0] + sizeOf(uintptr) * offset + // = &tables[TableIndex].References[offset] + c.assembler.CompileLeftShiftedRegisterToRegister(arm64.ADD, offset.register, pointerSizeLog2, tmp, tmp) + + // Set the reference's raw pointer. + c.assembler.CompileRegisterToMemory(arm64.STRD, ref.register, tmp, 0) + + c.markRegisterUnused(offset.register, ref.register, tmp) + return nil +} + +// compileTableGrow implements compiler.compileTableGrow for the arm64 architecture. +func (c *arm64Compiler) compileTableGrow(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + // Pushes the table index. + tableIndex := o.U1 + if err := c.compileIntConstant(true, tableIndex); err != nil { + return err + } + + // Table grow cannot be done in assembly just like memory grow as it involves with allocation in Go. + // Therefore, call out to the built function for this purpose. + if err := c.compileCallGoFunction(nativeCallStatusCodeCallBuiltInFunction, builtinFunctionIndexTableGrow); err != nil { + return err + } + + // TableGrow consumes three values (table index, number of items, initial value). + for i := 0; i < 3; i++ { + c.locationStack.pop() + } + + // Then, the previous length was pushed as the result. + v := c.locationStack.pushRuntimeValueLocationOnStack() + v.valueType = runtimeValueTypeI32 + + // After return, we re-initialize reserved registers just like preamble of functions. + c.compileReservedStackBasePointerRegisterInitialization() + c.compileReservedMemoryRegisterInitialization() + return nil +} + +// compileTableSize implements compiler.compileTableSize for the arm64 architecture. +func (c *arm64Compiler) compileTableSize(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + result, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.markRegisterUsed(result) + + // arm64ReservedRegisterForTemporary = &tables[0] + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineModuleContextTablesElement0AddressOffset, + arm64ReservedRegisterForTemporary) + // arm64ReservedRegisterForTemporary = [arm64ReservedRegisterForTemporary + TableIndex*8] + // = [&tables[0] + TableIndex*sizeOf(*tableInstance)] + // = [&tables[TableIndex]] = tables[TableIndex]. + tableIndex := int64(o.U1) + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, tableIndex*8, + arm64ReservedRegisterForTemporary) + + // result = [&tables[TableIndex] + tableInstanceTableLenOffset] = len(tables[TableIndex]) + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForTemporary, tableInstanceTableLenOffset, + result, + ) + + c.pushRuntimeValueLocationOnRegister(result, runtimeValueTypeI32) + return nil +} + +// compileTableFill implements compiler.compileTableFill for the arm64 architecture. +func (c *arm64Compiler) compileTableFill(o *wazeroir.UnionOperation) error { + tableIndex := uint32(o.U1) + return c.compileFillImpl(true, tableIndex) +} + +// popTwoValuesOnRegisters pops two values from the location stacks, ensures +// these two values are located on registers, and mark them unused. +// +// TODO: weā€™d usually prefix this with compileXXX as this might end up emitting instructions, +// but the name seems awkward. +func (c *arm64Compiler) popTwoValuesOnRegisters() (x1, x2 *runtimeValueLocation, err error) { + x2 = c.locationStack.pop() + if err = c.compileEnsureOnRegister(x2); err != nil { + return + } + + x1 = c.locationStack.pop() + if err = c.compileEnsureOnRegister(x1); err != nil { + return + } + + c.markRegisterUnused(x2.register) + c.markRegisterUnused(x1.register) + return +} + +// popValueOnRegister pops one value from the location stack, ensures +// that it is located on a register, and mark it unused. +// +// TODO: weā€™d usually prefix this with compileXXX as this might end up emitting instructions, +// but the name seems awkward. +func (c *arm64Compiler) popValueOnRegister() (v *runtimeValueLocation, err error) { + v = c.locationStack.pop() + if err = c.compileEnsureOnRegister(v); err != nil { + return + } + + c.markRegisterUnused(v.register) + return +} + +// compileEnsureOnRegister emits instructions to ensure that a value is located on a register. +func (c *arm64Compiler) compileEnsureOnRegister(loc *runtimeValueLocation) (err error) { + if loc.onStack() { + reg, err := c.allocateRegister(loc.getRegisterType()) + if err != nil { + return err + } + + // Record that the value holds the register and the register is marked used. + loc.setRegister(reg) + c.markRegisterUsed(reg) + + c.compileLoadValueOnStackToRegister(loc) + } else if loc.onConditionalRegister() { + err = c.compileLoadConditionalRegisterToGeneralPurposeRegister(loc) + } + return +} + +// maybeCompileMoveTopConditionalToGeneralPurposeRegister moves the top value on the stack +// if the value is located on a conditional register. +// +// This is usually called at the beginning of methods on compiler interface where we possibly +// compile instructions without saving the conditional register value. +// compile* functions without calling this function is saving the conditional +// value to the stack or register by invoking ensureOnGeneralPurposeRegister for the top. +func (c *arm64Compiler) maybeCompileMoveTopConditionalToGeneralPurposeRegister() (err error) { + if c.locationStack.sp > 0 { + if loc := c.locationStack.peek(); loc.onConditionalRegister() { + err = c.compileLoadConditionalRegisterToGeneralPurposeRegister(loc) + } + } + return +} + +// loadConditionalRegisterToGeneralPurposeRegister saves the conditional register value +// to a general purpose register. +func (c *arm64Compiler) compileLoadConditionalRegisterToGeneralPurposeRegister(loc *runtimeValueLocation) error { + reg, err := c.allocateRegister(loc.getRegisterType()) + if err != nil { + return err + } + + c.markRegisterUsed(reg) + c.assembler.CompileConditionalRegisterSet(loc.conditionalRegister, reg) + + // Record that now the value is located on a general purpose register. + loc.setRegister(reg) + return nil +} + +// compileLoadValueOnStackToRegister implements compiler.compileLoadValueOnStackToRegister for arm64. +func (c *arm64Compiler) compileLoadValueOnStackToRegister(loc *runtimeValueLocation) { + switch loc.valueType { + case runtimeValueTypeI32: + c.assembler.CompileMemoryToRegister(arm64.LDRW, arm64ReservedRegisterForStackBasePointerAddress, + int64(loc.stackPointer)*8, loc.register) + case runtimeValueTypeI64: + c.assembler.CompileMemoryToRegister(arm64.LDRD, arm64ReservedRegisterForStackBasePointerAddress, + int64(loc.stackPointer)*8, loc.register) + case runtimeValueTypeF32: + c.assembler.CompileMemoryToRegister(arm64.FLDRS, arm64ReservedRegisterForStackBasePointerAddress, + int64(loc.stackPointer)*8, loc.register) + case runtimeValueTypeF64: + c.assembler.CompileMemoryToRegister(arm64.FLDRD, arm64ReservedRegisterForStackBasePointerAddress, + int64(loc.stackPointer)*8, loc.register) + case runtimeValueTypeV128Lo: + c.assembler.CompileMemoryToVectorRegister(arm64.VMOV, + arm64ReservedRegisterForStackBasePointerAddress, int64(loc.stackPointer)*8, loc.register, + arm64.VectorArrangementQ) + // Higher 64-bits are loaded as well ^^. + hi := &c.locationStack.stack[loc.stackPointer+1] + hi.setRegister(loc.register) + case runtimeValueTypeV128Hi: + panic("BUG: V128Hi must be be loaded to a register along with V128Lo") + } +} + +// allocateRegister implements compiler.allocateRegister for arm64. +func (c *arm64Compiler) allocateRegister(t registerType) (reg asm.Register, err error) { + var ok bool + // Try to get the unused register. + reg, ok = c.locationStack.takeFreeRegister(t) + if ok { + return + } + + // If not found, we have to steal the register. + stealTarget, ok := c.locationStack.takeStealTargetFromUsedRegister(t) + if !ok { + err = fmt.Errorf("cannot steal register") + return + } + + // Release the steal target register value onto stack location. + reg = stealTarget.register + c.compileReleaseRegisterToStack(stealTarget) + return +} + +// compileReleaseAllRegistersToStack adds instructions to store all the values located on +// either general purpose or conditional registers onto the memory stack. +// See releaseRegisterToStack. +func (c *arm64Compiler) compileReleaseAllRegistersToStack() (err error) { + for i := uint64(0); i < c.locationStack.sp; i++ { + if loc := &c.locationStack.stack[i]; loc.onRegister() { + c.compileReleaseRegisterToStack(loc) + } else if loc.onConditionalRegister() { + if err = c.compileLoadConditionalRegisterToGeneralPurposeRegister(loc); err != nil { + return + } + c.compileReleaseRegisterToStack(loc) + } + } + return +} + +// releaseRegisterToStack adds an instruction to write the value on a register back to memory stack region. +func (c *arm64Compiler) compileReleaseRegisterToStack(loc *runtimeValueLocation) { + switch loc.valueType { + case runtimeValueTypeI32: + c.assembler.CompileRegisterToMemory(arm64.STRW, loc.register, arm64ReservedRegisterForStackBasePointerAddress, int64(loc.stackPointer)*8) + case runtimeValueTypeI64: + c.assembler.CompileRegisterToMemory(arm64.STRD, loc.register, arm64ReservedRegisterForStackBasePointerAddress, int64(loc.stackPointer)*8) + case runtimeValueTypeF32: + c.assembler.CompileRegisterToMemory(arm64.FSTRS, loc.register, arm64ReservedRegisterForStackBasePointerAddress, int64(loc.stackPointer)*8) + case runtimeValueTypeF64: + c.assembler.CompileRegisterToMemory(arm64.FSTRD, loc.register, arm64ReservedRegisterForStackBasePointerAddress, int64(loc.stackPointer)*8) + case runtimeValueTypeV128Lo: + c.assembler.CompileVectorRegisterToMemory(arm64.VMOV, + loc.register, arm64ReservedRegisterForStackBasePointerAddress, int64(loc.stackPointer)*8, + arm64.VectorArrangementQ) + // Higher 64-bits are released as well ^^. + hi := &c.locationStack.stack[loc.stackPointer+1] + c.locationStack.releaseRegister(hi) + case runtimeValueTypeV128Hi: + panic("BUG: V128Hi must be released to the stack along with V128Lo") + default: + panic("BUG") + } + + // Mark the register is free. + c.locationStack.releaseRegister(loc) +} + +// compileReservedStackBasePointerRegisterInitialization adds instructions to initialize arm64ReservedRegisterForStackBasePointerAddress +// so that it points to the absolute address of the stack base for this function. +func (c *arm64Compiler) compileReservedStackBasePointerRegisterInitialization() { + // First, load the address of the first element in the value stack into arm64ReservedRegisterForStackBasePointerAddress temporarily. + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineStackContextStackElement0AddressOffset, + arm64ReservedRegisterForStackBasePointerAddress) + + // next we move the base pointer (ce.stackBasePointer) to arm64ReservedRegisterForTemporary. + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineStackContextStackBasePointerInBytesOffset, + arm64ReservedRegisterForTemporary) + + // Finally, we calculate "callEngineStackContextStackBasePointerInBytesOffset + arm64ReservedRegisterForTemporary" + c.assembler.CompileRegisterToRegister(arm64.ADD, arm64ReservedRegisterForTemporary, arm64ReservedRegisterForStackBasePointerAddress) +} + +func (c *arm64Compiler) compileReservedMemoryRegisterInitialization() { + if c.ir.HasMemory || c.ir.UsesMemory { + // "arm64ReservedRegisterForMemory = ce.MemoryElement0Address" + c.assembler.CompileMemoryToRegister( + arm64.LDRD, + arm64ReservedRegisterForCallEngine, callEngineModuleContextMemoryElement0AddressOffset, + arm64ReservedRegisterForMemory, + ) + } +} + +// compileModuleContextInitialization adds instructions to initialize ce.moduleContext's fields based on +// ce.moduleContext.ModuleInstanceAddress. +// This is called in two cases: in function preamble, and on the return from (non-Go) function calls. +func (c *arm64Compiler) compileModuleContextInitialization() error { + tmpX, found := c.locationStack.takeFreeRegister(registerTypeGeneralPurpose) + if !found { + panic("BUG: all the registers should be free at this point") + } + c.markRegisterUsed(tmpX) + tmpY, found := c.locationStack.takeFreeRegister(registerTypeGeneralPurpose) + if !found { + panic("BUG: all the registers should be free at this point") + } + c.markRegisterUsed(tmpY) + + // "tmpX = ce.ModuleInstanceAddress" + c.assembler.CompileMemoryToRegister(arm64.LDRD, arm64ReservedRegisterForCallEngine, callEngineModuleContextModuleInstanceOffset, tmpX) + + // If the module instance address stays the same, we could skip the entire code below. + c.assembler.CompileTwoRegistersToNone(arm64.CMP, arm64CallingConventionModuleInstanceAddressRegister, tmpX) + brIfModuleUnchanged := c.assembler.CompileJump(arm64.BCONDEQ) + + // Otherwise, update the moduleEngine.moduleContext.ModuleInstanceAddress. + c.assembler.CompileRegisterToMemory(arm64.STRD, + arm64CallingConventionModuleInstanceAddressRegister, + arm64ReservedRegisterForCallEngine, callEngineModuleContextModuleInstanceOffset, + ) + + // Also, we have to update the following fields: + // * callEngine.moduleContext.globalElement0Address + // * callEngine.moduleContext.memoryElement0Address + // * callEngine.moduleContext.memorySliceLen + // * callEngine.moduleContext.memoryInstance + // * callEngine.moduleContext.tableElement0Address + // * callEngine.moduleContext.tableSliceLen + // * callEngine.moduleContext.functionsElement0Address + // * callEngine.moduleContext.typeIDsElement0Address + // * callEngine.moduleContext.dataInstancesElement0Address + // * callEngine.moduleContext.elementInstancesElement0Address + + // Update globalElement0Address. + // + // Note: if there's global.get or set instruction in the function, the existence of the globals + // is ensured by function validation at module instantiation phase, and that's why it is ok to + // skip the initialization if the module's globals slice is empty. + if len(c.ir.Globals) > 0 { + // "tmpX = &moduleInstance.Globals[0]" + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64CallingConventionModuleInstanceAddressRegister, moduleInstanceGlobalsOffset, + tmpX, + ) + + // "ce.GlobalElement0Address = tmpX (== &moduleInstance.Globals[0])" + c.assembler.CompileRegisterToMemory( + arm64.STRD, tmpX, + arm64ReservedRegisterForCallEngine, callEngineModuleContextGlobalElement0AddressOffset, + ) + } + + // Update memoryElement0Address and memorySliceLen. + // + // Note: if there's memory instruction in the function, memory instance must be non-nil. + // That is ensured by function validation at module instantiation phase, and that's + // why it is ok to skip the initialization if the module's memory instance is nil. + if c.ir.HasMemory { + // "tmpX = moduleInstance.Memory" + c.assembler.CompileMemoryToRegister( + arm64.LDRD, + arm64CallingConventionModuleInstanceAddressRegister, moduleInstanceMemoryOffset, + tmpX, + ) + + // First, set ce.memoryInstance + c.assembler.CompileRegisterToMemory( + arm64.STRD, + tmpX, + arm64ReservedRegisterForCallEngine, callEngineModuleContextMemoryInstanceOffset, + ) + + // Next, we write the memory length into ce.MemorySliceLen. + // + // "tmpY = [tmpX + memoryInstanceBufferLenOffset] (== len(memory.Buffer))" + c.assembler.CompileMemoryToRegister( + arm64.LDRD, + tmpX, memoryInstanceBufferLenOffset, + tmpY, + ) + // "ce.MemorySliceLen = tmpY". + c.assembler.CompileRegisterToMemory( + arm64.STRD, + tmpY, + arm64ReservedRegisterForCallEngine, callEngineModuleContextMemorySliceLenOffset, + ) + + // Finally, we write ce.memoryElement0Address. + // + // "tmpY = *tmpX (== &memory.Buffer[0])" + c.assembler.CompileMemoryToRegister( + arm64.LDRD, + tmpX, memoryInstanceBufferOffset, + tmpY, + ) + // "ce.memoryElement0Address = tmpY". + c.assembler.CompileRegisterToMemory( + arm64.STRD, + tmpY, + arm64ReservedRegisterForCallEngine, callEngineModuleContextMemoryElement0AddressOffset, + ) + } + + // Update tableElement0Address, tableSliceLen and typeIDsElement0Address. + // + // Note: if there's table instruction in the function, the existence of the table + // is ensured by function validation at module instantiation phase, and that's + // why it is ok to skip the initialization if the module's table doesn't exist. + if c.ir.HasTable { + // "tmpX = &tables[0] (type of **wasm.Table)" + c.assembler.CompileMemoryToRegister( + arm64.LDRD, + arm64CallingConventionModuleInstanceAddressRegister, moduleInstanceTablesOffset, + tmpX, + ) + + // Update ce.tableElement0Address. + // "ce.tableElement0Address = tmpX". + c.assembler.CompileRegisterToMemory( + arm64.STRD, + tmpX, + arm64ReservedRegisterForCallEngine, callEngineModuleContextTablesElement0AddressOffset, + ) + + // Finally, we put &ModuleInstance.TypeIDs[0] into moduleContext.typeIDsElement0Address. + c.assembler.CompileMemoryToRegister(arm64.LDRD, + arm64CallingConventionModuleInstanceAddressRegister, moduleInstanceTypeIDsOffset, tmpX) + c.assembler.CompileRegisterToMemory(arm64.STRD, + tmpX, arm64ReservedRegisterForCallEngine, callEngineModuleContextTypeIDsElement0AddressOffset) + } + + // Update callEngine.moduleContext.functionsElement0Address + { + // "tmpX = [moduleInstanceAddressRegister + moduleInstanceEngineOffset + interfaceDataOffset] (== *moduleEngine)" + // + // Go's interface is laid out on memory as two quad words as struct {tab, data uintptr} + // where tab points to the interface table, and the latter points to the actual + // implementation of interface. This case, we extract "data" pointer as *moduleEngine. + // See the following references for detail: + // * https://research.swtch.com/interfaces + // * https://github.com/golang/go/blob/release-branch.go1.20/src/runtime/runtime2.go#L207-L210 + c.assembler.CompileMemoryToRegister( + arm64.LDRD, + arm64CallingConventionModuleInstanceAddressRegister, moduleInstanceEngineOffset+interfaceDataOffset, + tmpX, + ) + + // "tmpY = [tmpX + moduleEngineFunctionsOffset] (== &moduleEngine.functions[0])" + c.assembler.CompileMemoryToRegister( + arm64.LDRD, + tmpX, moduleEngineFunctionsOffset, + tmpY, + ) + + // "callEngine.moduleContext.functionsElement0Address = tmpY". + c.assembler.CompileRegisterToMemory( + arm64.STRD, + tmpY, + arm64ReservedRegisterForCallEngine, callEngineModuleContextFunctionsElement0AddressOffset, + ) + } + + // Update dataInstancesElement0Address. + if c.ir.HasDataInstances { + // "tmpX = &moduleInstance.DataInstances[0]" + c.assembler.CompileMemoryToRegister( + arm64.LDRD, + arm64CallingConventionModuleInstanceAddressRegister, moduleInstanceDataInstancesOffset, + tmpX, + ) + // "callEngine.moduleContext.dataInstancesElement0Address = tmpX". + c.assembler.CompileRegisterToMemory( + arm64.STRD, + tmpX, + arm64ReservedRegisterForCallEngine, callEngineModuleContextDataInstancesElement0AddressOffset, + ) + } + + // Update callEngine.moduleContext.elementInstancesElement0Address + if c.ir.HasElementInstances { + // "tmpX = &moduleInstance.DataInstances[0]" + c.assembler.CompileMemoryToRegister( + arm64.LDRD, + arm64CallingConventionModuleInstanceAddressRegister, moduleInstanceElementInstancesOffset, + tmpX, + ) + // "callEngine.moduleContext.dataInstancesElement0Address = tmpX". + c.assembler.CompileRegisterToMemory( + arm64.STRD, + tmpX, + arm64ReservedRegisterForCallEngine, callEngineModuleContextElementInstancesElement0AddressOffset, + ) + } + + c.assembler.SetJumpTargetOnNext(brIfModuleUnchanged) + c.markRegisterUnused(tmpX, tmpY) + return nil +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/impl_vec_amd64.go b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/impl_vec_amd64.go new file mode 100644 index 000000000..d6c111db4 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/impl_vec_amd64.go @@ -0,0 +1,2812 @@ +package compiler + +import ( + "errors" + + "github.com/tetratelabs/wazero/internal/asm" + "github.com/tetratelabs/wazero/internal/asm/amd64" + "github.com/tetratelabs/wazero/internal/wazeroir" +) + +// compileV128Const implements compiler.compileV128Const for amd64 architecture. +func (c *amd64Compiler) compileV128Const(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + lo, hi := o.U1, o.U2 + + result, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + // We cannot directly load the value from memory to float regs, + // so we move it to int reg temporarily. + tmpReg, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + // Move the lower 64-bits. + if lo == 0 { + c.assembler.CompileRegisterToRegister(amd64.XORQ, tmpReg, tmpReg) + } else { + c.assembler.CompileConstToRegister(amd64.MOVQ, int64(lo), tmpReg) + } + c.assembler.CompileRegisterToRegister(amd64.MOVQ, tmpReg, result) + + if lo != 0 && hi == 0 { + c.assembler.CompileRegisterToRegister(amd64.XORQ, tmpReg, tmpReg) + } else if hi != 0 { + c.assembler.CompileConstToRegister(amd64.MOVQ, int64(hi), tmpReg) + } + // Move the higher 64-bits with PINSRQ at the second element of 64x2 vector. + c.assembler.CompileRegisterToRegisterWithArg(amd64.PINSRQ, tmpReg, result, 1) + + c.pushVectorRuntimeValueLocationOnRegister(result) + return nil +} + +// compileV128Add implements compiler.compileV128Add for amd64 architecture. +func (c *amd64Compiler) compileV128Add(o *wazeroir.UnionOperation) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + var inst asm.Instruction + shape := o.B1 + switch shape { + case wazeroir.ShapeI8x16: + inst = amd64.PADDB + case wazeroir.ShapeI16x8: + inst = amd64.PADDW + case wazeroir.ShapeI32x4: + inst = amd64.PADDD + case wazeroir.ShapeI64x2: + inst = amd64.PADDQ + case wazeroir.ShapeF32x4: + inst = amd64.ADDPS + case wazeroir.ShapeF64x2: + inst = amd64.ADDPD + } + c.assembler.CompileRegisterToRegister(inst, x2.register, x1.register) + + c.pushVectorRuntimeValueLocationOnRegister(x1.register) + c.locationStack.markRegisterUnused(x2.register) + return nil +} + +// compileV128Sub implements compiler.compileV128Sub for amd64 architecture. +func (c *amd64Compiler) compileV128Sub(o *wazeroir.UnionOperation) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + var inst asm.Instruction + shape := o.B1 + switch shape { + case wazeroir.ShapeI8x16: + inst = amd64.PSUBB + case wazeroir.ShapeI16x8: + inst = amd64.PSUBW + case wazeroir.ShapeI32x4: + inst = amd64.PSUBD + case wazeroir.ShapeI64x2: + inst = amd64.PSUBQ + case wazeroir.ShapeF32x4: + inst = amd64.SUBPS + case wazeroir.ShapeF64x2: + inst = amd64.SUBPD + } + c.assembler.CompileRegisterToRegister(inst, x2.register, x1.register) + + c.pushVectorRuntimeValueLocationOnRegister(x1.register) + c.locationStack.markRegisterUnused(x2.register) + return nil +} + +// compileV128Load implements compiler.compileV128Load for amd64 architecture. +func (c *amd64Compiler) compileV128Load(o *wazeroir.UnionOperation) error { + result, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + offset := uint32(o.U2) + loadType := wazeroir.V128LoadType(o.B1) + + switch loadType { + case wazeroir.V128LoadType128: + err = c.compileV128LoadImpl(amd64.MOVDQU, offset, 16, result) + case wazeroir.V128LoadType8x8s: + err = c.compileV128LoadImpl(amd64.PMOVSXBW, offset, 8, result) + case wazeroir.V128LoadType8x8u: + err = c.compileV128LoadImpl(amd64.PMOVZXBW, offset, 8, result) + case wazeroir.V128LoadType16x4s: + err = c.compileV128LoadImpl(amd64.PMOVSXWD, offset, 8, result) + case wazeroir.V128LoadType16x4u: + err = c.compileV128LoadImpl(amd64.PMOVZXWD, offset, 8, result) + case wazeroir.V128LoadType32x2s: + err = c.compileV128LoadImpl(amd64.PMOVSXDQ, offset, 8, result) + case wazeroir.V128LoadType32x2u: + err = c.compileV128LoadImpl(amd64.PMOVZXDQ, offset, 8, result) + case wazeroir.V128LoadType8Splat: + reg, err := c.compileMemoryAccessCeilSetup(offset, 1) + if err != nil { + return err + } + c.assembler.CompileMemoryWithIndexToRegister(amd64.MOVBQZX, amd64ReservedRegisterForMemory, -1, + reg, 1, reg) + // pinsrb $0, reg, result + // pxor tmpVReg, tmpVReg + // pshufb tmpVReg, result + c.locationStack.markRegisterUsed(result) + tmpVReg, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + c.assembler.CompileRegisterToRegisterWithArg(amd64.PINSRB, reg, result, 0) + c.assembler.CompileRegisterToRegister(amd64.PXOR, tmpVReg, tmpVReg) + c.assembler.CompileRegisterToRegister(amd64.PSHUFB, tmpVReg, result) + case wazeroir.V128LoadType16Splat: + reg, err := c.compileMemoryAccessCeilSetup(offset, 2) + if err != nil { + return err + } + c.assembler.CompileMemoryWithIndexToRegister(amd64.MOVWQZX, amd64ReservedRegisterForMemory, -2, + reg, 1, reg) + // pinsrw $0, reg, result + // pinsrw $1, reg, result + // pshufd $0, result, result (result = result[0,0,0,0]) + c.assembler.CompileRegisterToRegisterWithArg(amd64.PINSRW, reg, result, 0) + c.assembler.CompileRegisterToRegisterWithArg(amd64.PINSRW, reg, result, 1) + c.assembler.CompileRegisterToRegisterWithArg(amd64.PSHUFD, result, result, 0) + case wazeroir.V128LoadType32Splat: + reg, err := c.compileMemoryAccessCeilSetup(offset, 4) + if err != nil { + return err + } + c.assembler.CompileMemoryWithIndexToRegister(amd64.MOVLQZX, amd64ReservedRegisterForMemory, -4, + reg, 1, reg) + // pinsrd $0, reg, result + // pshufd $0, result, result (result = result[0,0,0,0]) + c.assembler.CompileRegisterToRegisterWithArg(amd64.PINSRD, reg, result, 0) + c.assembler.CompileRegisterToRegisterWithArg(amd64.PSHUFD, result, result, 0) + case wazeroir.V128LoadType64Splat: + reg, err := c.compileMemoryAccessCeilSetup(offset, 8) + if err != nil { + return err + } + c.assembler.CompileMemoryWithIndexToRegister(amd64.MOVQ, amd64ReservedRegisterForMemory, -8, + reg, 1, reg) + // pinsrq $0, reg, result + // pinsrq $1, reg, result + c.assembler.CompileRegisterToRegisterWithArg(amd64.PINSRQ, reg, result, 0) + c.assembler.CompileRegisterToRegisterWithArg(amd64.PINSRQ, reg, result, 1) + case wazeroir.V128LoadType32zero: + err = c.compileV128LoadImpl(amd64.MOVL, offset, 4, result) + case wazeroir.V128LoadType64zero: + err = c.compileV128LoadImpl(amd64.MOVQ, offset, 8, result) + } + + if err != nil { + return err + } + + c.pushVectorRuntimeValueLocationOnRegister(result) + return nil +} + +func (c *amd64Compiler) compileV128LoadImpl(inst asm.Instruction, offset uint32, targetSizeInBytes int64, dst asm.Register) error { + offsetReg, err := c.compileMemoryAccessCeilSetup(offset, targetSizeInBytes) + if err != nil { + return err + } + c.assembler.CompileMemoryWithIndexToRegister(inst, amd64ReservedRegisterForMemory, -targetSizeInBytes, + offsetReg, 1, dst) + return nil +} + +// compileV128LoadLane implements compiler.compileV128LoadLane for amd64. +func (c *amd64Compiler) compileV128LoadLane(o *wazeroir.UnionOperation) error { + targetVector := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(targetVector); err != nil { + return err + } + + laneSize, laneIndex := o.B1, o.B2 + offset := uint32(o.U2) + + var insertInst asm.Instruction + switch laneSize { + case 8: + insertInst = amd64.PINSRB + case 16: + insertInst = amd64.PINSRW + case 32: + insertInst = amd64.PINSRD + case 64: + insertInst = amd64.PINSRQ + } + + targetSizeInBytes := int64(laneSize / 8) + offsetReg, err := c.compileMemoryAccessCeilSetup(offset, targetSizeInBytes) + if err != nil { + return err + } + c.assembler.CompileMemoryWithIndexAndArgToRegister(insertInst, amd64ReservedRegisterForMemory, -targetSizeInBytes, + offsetReg, 1, targetVector.register, laneIndex) + + c.pushVectorRuntimeValueLocationOnRegister(targetVector.register) + return nil +} + +// compileV128Store implements compiler.compileV128Store for amd64. +func (c *amd64Compiler) compileV128Store(o *wazeroir.UnionOperation) error { + val := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(val); err != nil { + return err + } + + const targetSizeInBytes = 16 + offset := uint32(o.U2) + offsetReg, err := c.compileMemoryAccessCeilSetup(offset, targetSizeInBytes) + if err != nil { + return err + } + + c.assembler.CompileRegisterToMemoryWithIndex(amd64.MOVDQU, val.register, + amd64ReservedRegisterForMemory, -targetSizeInBytes, offsetReg, 1) + + c.locationStack.markRegisterUnused(val.register, offsetReg) + return nil +} + +// compileV128StoreLane implements compiler.compileV128StoreLane for amd64. +func (c *amd64Compiler) compileV128StoreLane(o *wazeroir.UnionOperation) error { + var storeInst asm.Instruction + laneSize := o.B1 + laneIndex := o.B2 + offset := uint32(o.U2) + switch laneSize { + case 8: + storeInst = amd64.PEXTRB + case 16: + storeInst = amd64.PEXTRW + case 32: + storeInst = amd64.PEXTRD + case 64: + storeInst = amd64.PEXTRQ + } + + val := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(val); err != nil { + return err + } + + targetSizeInBytes := int64(laneSize / 8) + offsetReg, err := c.compileMemoryAccessCeilSetup(offset, targetSizeInBytes) + if err != nil { + return err + } + + c.assembler.CompileRegisterToMemoryWithIndexAndArg(storeInst, val.register, + amd64ReservedRegisterForMemory, -targetSizeInBytes, offsetReg, 1, laneIndex) + + c.locationStack.markRegisterUnused(val.register, offsetReg) + return nil +} + +// compileV128ExtractLane implements compiler.compileV128ExtractLane for amd64. +func (c *amd64Compiler) compileV128ExtractLane(o *wazeroir.UnionOperation) error { + v := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + vreg := v.register + shape := o.B1 + laneIndex := o.B2 + signed := o.B3 + switch shape { + case wazeroir.ShapeI8x16: + result, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.assembler.CompileRegisterToRegisterWithArg(amd64.PEXTRB, vreg, result, laneIndex) + if signed { + c.assembler.CompileRegisterToRegister(amd64.MOVBLSX, result, result) + } else { + c.assembler.CompileRegisterToRegister(amd64.MOVBLZX, result, result) + } + c.pushRuntimeValueLocationOnRegister(result, runtimeValueTypeI32) + c.locationStack.markRegisterUnused(vreg) + case wazeroir.ShapeI16x8: + result, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.assembler.CompileRegisterToRegisterWithArg(amd64.PEXTRW, vreg, result, laneIndex) + if signed { + c.assembler.CompileRegisterToRegister(amd64.MOVWLSX, result, result) + } else { + c.assembler.CompileRegisterToRegister(amd64.MOVWLZX, result, result) + } + c.pushRuntimeValueLocationOnRegister(result, runtimeValueTypeI32) + c.locationStack.markRegisterUnused(vreg) + case wazeroir.ShapeI32x4: + result, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.assembler.CompileRegisterToRegisterWithArg(amd64.PEXTRD, vreg, result, laneIndex) + c.pushRuntimeValueLocationOnRegister(result, runtimeValueTypeI32) + c.locationStack.markRegisterUnused(vreg) + case wazeroir.ShapeI64x2: + result, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.assembler.CompileRegisterToRegisterWithArg(amd64.PEXTRQ, vreg, result, laneIndex) + c.pushRuntimeValueLocationOnRegister(result, runtimeValueTypeI64) + c.locationStack.markRegisterUnused(vreg) + case wazeroir.ShapeF32x4: + if laneIndex != 0 { + c.assembler.CompileRegisterToRegisterWithArg(amd64.PSHUFD, vreg, vreg, laneIndex) + } + c.pushRuntimeValueLocationOnRegister(vreg, runtimeValueTypeF32) + case wazeroir.ShapeF64x2: + if laneIndex != 0 { + // This case we can assume LaneIndex == 1. + // We have to modify the val.register as, for example: + // 0b11 0b10 0b01 0b00 + // | | | | + // [x3, x2, x1, x0] -> [x0, x0, x3, x2] + // where val.register = [x3, x2, x1, x0] and each xN = 32bits. + // Then, we interpret the register as float64, therefore, the float64 value is obtained as [x3, x2]. + arg := byte(0b00_00_11_10) + c.assembler.CompileRegisterToRegisterWithArg(amd64.PSHUFD, vreg, vreg, arg) + } + c.pushRuntimeValueLocationOnRegister(vreg, runtimeValueTypeF64) + } + + return nil +} + +// compileV128ReplaceLane implements compiler.compileV128ReplaceLane for amd64. +func (c *amd64Compiler) compileV128ReplaceLane(o *wazeroir.UnionOperation) error { + origin := c.locationStack.pop() + if err := c.compileEnsureOnRegister(origin); err != nil { + return err + } + + vector := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(vector); err != nil { + return err + } + + shape := o.B1 + laneIndex := o.B2 + switch shape { + case wazeroir.ShapeI8x16: + c.assembler.CompileRegisterToRegisterWithArg(amd64.PINSRB, origin.register, vector.register, laneIndex) + case wazeroir.ShapeI16x8: + c.assembler.CompileRegisterToRegisterWithArg(amd64.PINSRW, origin.register, vector.register, laneIndex) + case wazeroir.ShapeI32x4: + c.assembler.CompileRegisterToRegisterWithArg(amd64.PINSRD, origin.register, vector.register, laneIndex) + case wazeroir.ShapeI64x2: + c.assembler.CompileRegisterToRegisterWithArg(amd64.PINSRQ, origin.register, vector.register, laneIndex) + case wazeroir.ShapeF32x4: + c.assembler.CompileRegisterToRegisterWithArg(amd64.INSERTPS, origin.register, vector.register, + // In INSERTPS instruction, the destination index is encoded at 4 and 5 bits of the argument. + // See https://www.felixcloutier.com/x86/insertps + laneIndex<<4, + ) + case wazeroir.ShapeF64x2: + if laneIndex == 0 { + c.assembler.CompileRegisterToRegister(amd64.MOVSD, origin.register, vector.register) + } else { + c.assembler.CompileRegisterToRegister(amd64.MOVLHPS, origin.register, vector.register) + } + } + + c.pushVectorRuntimeValueLocationOnRegister(vector.register) + c.locationStack.markRegisterUnused(origin.register) + return nil +} + +// compileV128Splat implements compiler.compileV128Splat for amd64. +func (c *amd64Compiler) compileV128Splat(o *wazeroir.UnionOperation) (err error) { + origin := c.locationStack.pop() + if err = c.compileEnsureOnRegister(origin); err != nil { + return + } + + var result asm.Register + shape := o.B1 + switch shape { + case wazeroir.ShapeI8x16: + result, err = c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + c.locationStack.markRegisterUsed(result) + + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + c.assembler.CompileRegisterToRegisterWithArg(amd64.PINSRB, origin.register, result, 0) + c.assembler.CompileRegisterToRegister(amd64.PXOR, tmp, tmp) + c.assembler.CompileRegisterToRegister(amd64.PSHUFB, tmp, result) + case wazeroir.ShapeI16x8: + result, err = c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + c.locationStack.markRegisterUsed(result) + c.assembler.CompileRegisterToRegisterWithArg(amd64.PINSRW, origin.register, result, 0) + c.assembler.CompileRegisterToRegisterWithArg(amd64.PINSRW, origin.register, result, 1) + c.assembler.CompileRegisterToRegisterWithArg(amd64.PSHUFD, result, result, 0) + case wazeroir.ShapeI32x4: + result, err = c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + c.locationStack.markRegisterUsed(result) + c.assembler.CompileRegisterToRegisterWithArg(amd64.PINSRD, origin.register, result, 0) + c.assembler.CompileRegisterToRegisterWithArg(amd64.PSHUFD, result, result, 0) + case wazeroir.ShapeI64x2: + result, err = c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + c.locationStack.markRegisterUsed(result) + c.assembler.CompileRegisterToRegisterWithArg(amd64.PINSRQ, origin.register, result, 0) + c.assembler.CompileRegisterToRegisterWithArg(amd64.PINSRQ, origin.register, result, 1) + case wazeroir.ShapeF32x4: + result = origin.register + c.assembler.CompileRegisterToRegisterWithArg(amd64.INSERTPS, origin.register, result, 0) + c.assembler.CompileRegisterToRegisterWithArg(amd64.PSHUFD, result, result, 0) + case wazeroir.ShapeF64x2: + result = origin.register + c.assembler.CompileRegisterToRegister(amd64.MOVQ, origin.register, result) + c.assembler.CompileRegisterToRegister(amd64.MOVLHPS, origin.register, result) + } + + c.locationStack.markRegisterUnused(origin.register) + c.pushVectorRuntimeValueLocationOnRegister(result) + return nil +} + +// compileV128Shuffle implements compiler.compileV128Shuffle for amd64. +func (c *amd64Compiler) compileV128Shuffle(o *wazeroir.UnionOperation) error { + w := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(w); err != nil { + return err + } + + v := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + + wr, vr := w.register, v.register + + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + consts := [32]byte{} + lanes := o.Us + for i, unsignedLane := range lanes { + lane := byte(unsignedLane) + if lane < 16 { + consts[i+16] = 0x80 + consts[i] = lane + } else { + consts[i+16] = lane - 16 + consts[i] = 0x80 + } + } + + err = c.assembler.CompileStaticConstToRegister(amd64.MOVDQU, asm.NewStaticConst(consts[:16]), tmp) + if err != nil { + return err + } + c.assembler.CompileRegisterToRegister(amd64.PSHUFB, tmp, vr) + err = c.assembler.CompileStaticConstToRegister(amd64.MOVDQU, asm.NewStaticConst(consts[16:]), tmp) + if err != nil { + return err + } + c.assembler.CompileRegisterToRegister(amd64.PSHUFB, tmp, wr) + c.assembler.CompileRegisterToRegister(amd64.ORPS, vr, wr) + + c.pushVectorRuntimeValueLocationOnRegister(wr) + c.locationStack.markRegisterUnused(vr) + return nil +} + +var swizzleConst = [16]byte{ + 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, + 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, +} + +// compileV128Swizzle implements compiler.compileV128Swizzle for amd64. +func (c *amd64Compiler) compileV128Swizzle(*wazeroir.UnionOperation) error { + index := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(index); err != nil { + return err + } + + base := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(base); err != nil { + return err + } + + idxReg, baseReg := index.register, base.register + + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + err = c.assembler.CompileStaticConstToRegister(amd64.MOVDQU, asm.NewStaticConst(swizzleConst[:]), tmp) + if err != nil { + return err + } + + c.assembler.CompileRegisterToRegister(amd64.PADDUSB, tmp, idxReg) + c.assembler.CompileRegisterToRegister(amd64.PSHUFB, idxReg, baseReg) + + c.pushVectorRuntimeValueLocationOnRegister(baseReg) + c.locationStack.markRegisterUnused(idxReg) + return nil +} + +// compileV128AnyTrue implements compiler.compileV128AnyTrue for amd64. +func (c *amd64Compiler) compileV128AnyTrue(*wazeroir.UnionOperation) error { + v := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + vreg := v.register + + c.assembler.CompileRegisterToRegister(amd64.PTEST, vreg, vreg) + + c.locationStack.pushRuntimeValueLocationOnConditionalRegister(amd64.ConditionalRegisterStateNE) + c.locationStack.markRegisterUnused(vreg) + return nil +} + +// compileV128AllTrue implements compiler.compileV128AllTrue for amd64. +func (c *amd64Compiler) compileV128AllTrue(o *wazeroir.UnionOperation) error { + v := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + var cmpInst asm.Instruction + shape := o.B1 + switch shape { + case wazeroir.ShapeI8x16: + cmpInst = amd64.PCMPEQB + case wazeroir.ShapeI16x8: + cmpInst = amd64.PCMPEQW + case wazeroir.ShapeI32x4: + cmpInst = amd64.PCMPEQD + case wazeroir.ShapeI64x2: + cmpInst = amd64.PCMPEQQ + } + + c.assembler.CompileRegisterToRegister(amd64.PXOR, tmp, tmp) + c.assembler.CompileRegisterToRegister(cmpInst, v.register, tmp) + c.assembler.CompileRegisterToRegister(amd64.PTEST, tmp, tmp) + c.locationStack.markRegisterUnused(v.register, tmp) + c.locationStack.pushRuntimeValueLocationOnConditionalRegister(amd64.ConditionalRegisterStateE) + return nil +} + +// compileV128BitMask implements compiler.compileV128BitMask for amd64. +func (c *amd64Compiler) compileV128BitMask(o *wazeroir.UnionOperation) error { + v := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + + result, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + shape := o.B1 + switch shape { + case wazeroir.ShapeI8x16: + c.assembler.CompileRegisterToRegister(amd64.PMOVMSKB, v.register, result) + case wazeroir.ShapeI16x8: + // When we have: + // R1 = [R1(w1), R1(w2), R1(w3), R1(w4), R1(w5), R1(w6), R1(w7), R1(v8)] + // R2 = [R2(w1), R2(w2), R2(w3), R2(v4), R2(w5), R2(w6), R2(w7), R2(v8)] + // where RX(wn) is n-th signed word (16-bit) of RX register, + // + // "PACKSSWB R1, R2" produces + // R1 = [ + // byte_sat(R1(w1)), byte_sat(R1(w2)), byte_sat(R1(w3)), byte_sat(R1(w4)), + // byte_sat(R1(w5)), byte_sat(R1(w6)), byte_sat(R1(w7)), byte_sat(R1(w8)), + // byte_sat(R2(w1)), byte_sat(R2(w2)), byte_sat(R2(w3)), byte_sat(R2(w4)), + // byte_sat(R2(w5)), byte_sat(R2(w6)), byte_sat(R2(w7)), byte_sat(R2(w8)), + // ] + // where R1 is the destination register, and + // byte_sat(w) = int8(w) if w fits as signed 8-bit, + // 0x80 if w is less than 0x80 + // 0x7F if w is greater than 0x7f + // + // See https://www.felixcloutier.com/x86/packsswb:packssdw for detail. + // + // Therefore, v.register ends up having i-th and (i+8)-th bit set if i-th lane is negative (for i in 0..8). + c.assembler.CompileRegisterToRegister(amd64.PACKSSWB, v.register, v.register) + c.assembler.CompileRegisterToRegister(amd64.PMOVMSKB, v.register, result) + // Clear the higher bits than 8. + c.assembler.CompileConstToRegister(amd64.SHRQ, 8, result) + case wazeroir.ShapeI32x4: + c.assembler.CompileRegisterToRegister(amd64.MOVMSKPS, v.register, result) + case wazeroir.ShapeI64x2: + c.assembler.CompileRegisterToRegister(amd64.MOVMSKPD, v.register, result) + } + + c.locationStack.markRegisterUnused(v.register) + c.pushRuntimeValueLocationOnRegister(result, runtimeValueTypeI32) + return nil +} + +// compileV128And implements compiler.compileV128And for amd64. +func (c *amd64Compiler) compileV128And(*wazeroir.UnionOperation) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + c.assembler.CompileRegisterToRegister(amd64.PAND, x2.register, x1.register) + + c.locationStack.markRegisterUnused(x2.register) + c.pushVectorRuntimeValueLocationOnRegister(x1.register) + return nil +} + +// compileV128Not implements compiler.compileV128Not for amd64. +func (c *amd64Compiler) compileV128Not(*wazeroir.UnionOperation) error { + v := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + // Set all bits on tmp register. + c.assembler.CompileRegisterToRegister(amd64.PCMPEQD, tmp, tmp) + // Then XOR with tmp to reverse all bits on v.register. + c.assembler.CompileRegisterToRegister(amd64.PXOR, tmp, v.register) + c.pushVectorRuntimeValueLocationOnRegister(v.register) + return nil +} + +// compileV128Or implements compiler.compileV128Or for amd64. +func (c *amd64Compiler) compileV128Or(*wazeroir.UnionOperation) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + c.assembler.CompileRegisterToRegister(amd64.POR, x2.register, x1.register) + + c.locationStack.markRegisterUnused(x2.register) + c.pushVectorRuntimeValueLocationOnRegister(x1.register) + return nil +} + +// compileV128Xor implements compiler.compileV128Xor for amd64. +func (c *amd64Compiler) compileV128Xor(*wazeroir.UnionOperation) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + c.assembler.CompileRegisterToRegister(amd64.PXOR, x2.register, x1.register) + + c.locationStack.markRegisterUnused(x2.register) + c.pushVectorRuntimeValueLocationOnRegister(x1.register) + return nil +} + +// compileV128Bitselect implements compiler.compileV128Bitselect for amd64. +func (c *amd64Compiler) compileV128Bitselect(*wazeroir.UnionOperation) error { + selector := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(selector); err != nil { + return err + } + + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + // The following logic is equivalent to v128.or(v128.and(v1, selector), v128.and(v2, v128.not(selector))) + // See https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/simd/SIMD.md#bitwise-select + c.assembler.CompileRegisterToRegister(amd64.PAND, selector.register, x1.register) + c.assembler.CompileRegisterToRegister(amd64.PANDN, x2.register, selector.register) + c.assembler.CompileRegisterToRegister(amd64.POR, selector.register, x1.register) + + c.locationStack.markRegisterUnused(x2.register, selector.register) + c.pushVectorRuntimeValueLocationOnRegister(x1.register) + return nil +} + +// compileV128AndNot implements compiler.compileV128AndNot for amd64. +func (c *amd64Compiler) compileV128AndNot(*wazeroir.UnionOperation) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + c.assembler.CompileRegisterToRegister(amd64.PANDN, x1.register, x2.register) + + c.locationStack.markRegisterUnused(x1.register) + c.pushVectorRuntimeValueLocationOnRegister(x2.register) + return nil +} + +// compileV128Shr implements compiler.compileV128Shr for amd64. +func (c *amd64Compiler) compileV128Shr(o *wazeroir.UnionOperation) error { + // https://stackoverflow.com/questions/35002937/sse-simd-shift-with-one-byte-element-size-granularity + shape := o.B1 + signed := o.B3 + if shape == wazeroir.ShapeI8x16 { + return c.compileV128ShrI8x16Impl(signed) + } else if shape == wazeroir.ShapeI64x2 && signed { + return c.compileV128ShrI64x2SignedImpl() + } else { + return c.compileV128ShrImpl(o) + } +} + +// compileV128ShrImpl implements shift right instructions except for i8x16 (logical/arithmetic) and i64x2 (arithmetic). +func (c *amd64Compiler) compileV128ShrImpl(o *wazeroir.UnionOperation) error { + s := c.locationStack.pop() + if err := c.compileEnsureOnRegister(s); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + vecTmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + var moduleConst int64 + var shift asm.Instruction + shape := o.B1 + signed := o.B3 + switch shape { + case wazeroir.ShapeI16x8: + moduleConst = 0xf // modulo 16. + if signed { + shift = amd64.PSRAW + } else { + shift = amd64.PSRLW + } + case wazeroir.ShapeI32x4: + moduleConst = 0x1f // modulo 32. + if signed { + shift = amd64.PSRAD + } else { + shift = amd64.PSRLD + } + case wazeroir.ShapeI64x2: + moduleConst = 0x3f // modulo 64. + shift = amd64.PSRLQ + } + + gpShiftAmount := s.register + c.assembler.CompileConstToRegister(amd64.ANDQ, moduleConst, gpShiftAmount) + c.assembler.CompileRegisterToRegister(amd64.MOVL, gpShiftAmount, vecTmp) + c.assembler.CompileRegisterToRegister(shift, vecTmp, x1.register) + + c.locationStack.markRegisterUnused(gpShiftAmount) + c.pushVectorRuntimeValueLocationOnRegister(x1.register) + return nil +} + +// compileV128ShrI64x2SignedImpl implements compiler.compileV128Shr for i64x2 signed (arithmetic) shift. +// PSRAQ instruction requires AVX, so we emulate it without AVX instructions. https://www.felixcloutier.com/x86/psraw:psrad:psraq +func (c *amd64Compiler) compileV128ShrI64x2SignedImpl() error { + const shiftCountRegister = amd64.RegCX + + s := c.locationStack.pop() + if s.register != shiftCountRegister { + // If another value lives on the CX register, we release it to the stack. + c.onValueReleaseRegisterToStack(shiftCountRegister) + if s.onStack() { + s.setRegister(shiftCountRegister) + c.compileLoadValueOnStackToRegister(s) + } else if s.onConditionalRegister() { + c.compileMoveConditionalToGeneralPurposeRegister(s, shiftCountRegister) + } else { // already on register. + old := s.register + c.assembler.CompileRegisterToRegister(amd64.MOVL, old, shiftCountRegister) + s.setRegister(shiftCountRegister) + c.locationStack.markRegisterUnused(old) + } + } + + c.locationStack.markRegisterUsed(shiftCountRegister) + tmp, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + // Extract each lane into tmp, execute SHR on tmp, and write it back to the lane. + c.assembler.CompileRegisterToRegisterWithArg(amd64.PEXTRQ, x1.register, tmp, 0) + c.assembler.CompileRegisterToRegister(amd64.SARQ, shiftCountRegister, tmp) + c.assembler.CompileRegisterToRegisterWithArg(amd64.PINSRQ, tmp, x1.register, 0) + c.assembler.CompileRegisterToRegisterWithArg(amd64.PEXTRQ, x1.register, tmp, 1) + c.assembler.CompileRegisterToRegister(amd64.SARQ, shiftCountRegister, tmp) + c.assembler.CompileRegisterToRegisterWithArg(amd64.PINSRQ, tmp, x1.register, 1) + + c.locationStack.markRegisterUnused(shiftCountRegister) + c.pushVectorRuntimeValueLocationOnRegister(x1.register) + return nil +} + +// i8x16LogicalSHRMaskTable is necessary for emulating non-existent packed bytes logical right shifts on amd64. +// The mask is applied after performing packed word shifts on the value to clear out the unnecessary bits. +var i8x16LogicalSHRMaskTable = [8 * 16]byte{ // (the number of possible shift amount 0, 1, ..., 7.) * 16 bytes. + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // for 0 shift + 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, // for 1 shift + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, // for 2 shift + 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, // for 3 shift + 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, // for 4 shift + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, // for 5 shift + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, // for 6 shift + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, // for 7 shift +} + +// compileV128ShrI64x2SignedImpl implements compiler.compileV128Shr for i8x16 signed logical/arithmetic shifts. +// amd64 doesn't have packed byte shifts, so we need this special casing. +// See https://stackoverflow.com/questions/35002937/sse-simd-shift-with-one-byte-element-size-granularity +func (c *amd64Compiler) compileV128ShrI8x16Impl(signed bool) error { + s := c.locationStack.pop() + if err := c.compileEnsureOnRegister(s); err != nil { + return err + } + + v := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + + vecTmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + gpShiftAmount := s.register + c.assembler.CompileConstToRegister(amd64.ANDQ, 0x7, gpShiftAmount) // mod 8. + + if signed { + c.locationStack.markRegisterUsed(vecTmp) + vecTmp2, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + vreg := v.register + + // Copy the value from v.register to vecTmp. + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, vreg, vecTmp) + + // Assuming that we have + // vreg = [b1, ..., b16] + // vecTmp = [b1, ..., b16] + // at this point, then we use PUNPCKLBW and PUNPCKHBW to produce: + // vreg = [b1, b1, b2, b2, ..., b8, b8] + // vecTmp = [b9, b9, b10, b10, ..., b16, b16] + c.assembler.CompileRegisterToRegister(amd64.PUNPCKLBW, vreg, vreg) + c.assembler.CompileRegisterToRegister(amd64.PUNPCKHBW, vecTmp, vecTmp) + + // Adding 8 to the shift amount, and then move the amount to vecTmp2. + c.assembler.CompileConstToRegister(amd64.ADDQ, 0x8, gpShiftAmount) + c.assembler.CompileRegisterToRegister(amd64.MOVL, gpShiftAmount, vecTmp2) + + // Perform the word packed arithmetic right shifts on vreg and vecTmp. + // This changes these two registers as: + // vreg = [xxx, b1 >> s, xxx, b2 >> s, ..., xxx, b8 >> s] + // vecTmp = [xxx, b9 >> s, xxx, b10 >> s, ..., xxx, b16 >> s] + // where xxx is 1 or 0 depending on each byte's sign, and ">>" is the arithmetic shift on a byte. + c.assembler.CompileRegisterToRegister(amd64.PSRAW, vecTmp2, vreg) + c.assembler.CompileRegisterToRegister(amd64.PSRAW, vecTmp2, vecTmp) + + // Finally, we can get the result by packing these two word vectors. + c.assembler.CompileRegisterToRegister(amd64.PACKSSWB, vecTmp, vreg) + + c.locationStack.markRegisterUnused(gpShiftAmount, vecTmp) + c.pushVectorRuntimeValueLocationOnRegister(vreg) + } else { + c.assembler.CompileRegisterToRegister(amd64.MOVL, gpShiftAmount, vecTmp) + // amd64 doesn't have packed byte shifts, so we packed word shift here, and then mark-out + // the unnecessary bits below. + c.assembler.CompileRegisterToRegister(amd64.PSRLW, vecTmp, v.register) + + gpTmp, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + // Read the initial address of the mask table into gpTmp register. + err = c.assembler.CompileStaticConstToRegister(amd64.LEAQ, asm.NewStaticConst(i8x16LogicalSHRMaskTable[:]), gpTmp) + if err != nil { + return err + } + + // We have to get the mask according to the shift amount, so we first have to do + // gpShiftAmount << 4 = gpShiftAmount*16 to get the initial offset of the mask (16 is the size of each mask in bytes). + c.assembler.CompileConstToRegister(amd64.SHLQ, 4, gpShiftAmount) + + // Now ready to read the content of the mask into the vecTmp. + c.assembler.CompileMemoryWithIndexToRegister(amd64.MOVDQU, + gpTmp, 0, gpShiftAmount, 1, + vecTmp, + ) + + // Finally, clear out the unnecessary + c.assembler.CompileRegisterToRegister(amd64.PAND, vecTmp, v.register) + + c.locationStack.markRegisterUnused(gpShiftAmount) + c.pushVectorRuntimeValueLocationOnRegister(v.register) + } + return nil +} + +// i8x16SHLMaskTable is necessary for emulating non-existent packed bytes left shifts on amd64. +// The mask is applied after performing packed word shifts on the value to clear out the unnecessary bits. +var i8x16SHLMaskTable = [8 * 16]byte{ // (the number of possible shift amount 0, 1, ..., 7.) * 16 bytes. + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // for 0 shift + 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, // for 1 shift + 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, // for 2 shift + 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, // for 3 shift + 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, // for 4 shift + 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, // for 5 shift + 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, // for 6 shift + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, // for 7 shift +} + +// compileV128Shl implements compiler.compileV128Shl for amd64. +func (c *amd64Compiler) compileV128Shl(o *wazeroir.UnionOperation) error { + s := c.locationStack.pop() + if err := c.compileEnsureOnRegister(s); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + vecTmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + var modulo int64 + var shift asm.Instruction + shape := o.B1 + switch shape { + case wazeroir.ShapeI8x16: + modulo = 0x7 // modulo 8. + // x86 doesn't have packed bytes shift, so we use PSLLW and mask-out the redundant bits. + // See https://stackoverflow.com/questions/35002937/sse-simd-shift-with-one-byte-element-size-granularity + shift = amd64.PSLLW + case wazeroir.ShapeI16x8: + modulo = 0xf // modulo 16. + shift = amd64.PSLLW + case wazeroir.ShapeI32x4: + modulo = 0x1f // modulo 32. + shift = amd64.PSLLD + case wazeroir.ShapeI64x2: + modulo = 0x3f // modulo 64. + shift = amd64.PSLLQ + } + + gpShiftAmount := s.register + c.assembler.CompileConstToRegister(amd64.ANDQ, modulo, gpShiftAmount) + c.assembler.CompileRegisterToRegister(amd64.MOVL, gpShiftAmount, vecTmp) + c.assembler.CompileRegisterToRegister(shift, vecTmp, x1.register) + + if shape == wazeroir.ShapeI8x16 { + gpTmp, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + // Read the initial address of the mask table into gpTmp register. + err = c.assembler.CompileStaticConstToRegister(amd64.LEAQ, asm.NewStaticConst(i8x16SHLMaskTable[:]), gpTmp) + if err != nil { + return err + } + + // We have to get the mask according to the shift amount, so we first have to do + // gpShiftAmount << 4 = gpShiftAmount*16 to get the initial offset of the mask (16 is the size of each mask in bytes). + c.assembler.CompileConstToRegister(amd64.SHLQ, 4, gpShiftAmount) + + // Now ready to read the content of the mask into the vecTmp. + c.assembler.CompileMemoryWithIndexToRegister(amd64.MOVDQU, + gpTmp, 0, gpShiftAmount, 1, + vecTmp, + ) + + // Finally, clear out the unnecessary + c.assembler.CompileRegisterToRegister(amd64.PAND, vecTmp, x1.register) + } + + c.locationStack.markRegisterUnused(gpShiftAmount) + c.pushVectorRuntimeValueLocationOnRegister(x1.register) + return nil +} + +// compileV128Cmp implements compiler.compileV128Cmp for amd64. +func (c *amd64Compiler) compileV128Cmp(o *wazeroir.UnionOperation) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + const ( + // See https://www.felixcloutier.com/x86/cmppd and https://www.felixcloutier.com/x86/cmpps + floatEqualArg = 0 + floatLessThanArg = 1 + floatLessThanOrEqualArg = 2 + floatNotEqualARg = 4 + ) + + x1Reg, x2Reg, result := x1.register, x2.register, asm.NilRegister + v128CmpType := o.B1 + switch v128CmpType { + case wazeroir.V128CmpTypeF32x4Eq: + c.assembler.CompileRegisterToRegisterWithArg(amd64.CMPPS, x2Reg, x1Reg, floatEqualArg) + result = x1Reg + case wazeroir.V128CmpTypeF32x4Ne: + c.assembler.CompileRegisterToRegisterWithArg(amd64.CMPPS, x2Reg, x1Reg, floatNotEqualARg) + result = x1Reg + case wazeroir.V128CmpTypeF32x4Lt: + c.assembler.CompileRegisterToRegisterWithArg(amd64.CMPPS, x2Reg, x1Reg, floatLessThanArg) + result = x1Reg + case wazeroir.V128CmpTypeF32x4Gt: + // Without AVX, there's no float Gt instruction, so we swap the register and use Lt instead. + c.assembler.CompileRegisterToRegisterWithArg(amd64.CMPPS, x1Reg, x2Reg, floatLessThanArg) + result = x2Reg + case wazeroir.V128CmpTypeF32x4Le: + c.assembler.CompileRegisterToRegisterWithArg(amd64.CMPPS, x2Reg, x1Reg, floatLessThanOrEqualArg) + result = x1Reg + case wazeroir.V128CmpTypeF32x4Ge: + // Without AVX, there's no float Ge instruction, so we swap the register and use Le instead. + c.assembler.CompileRegisterToRegisterWithArg(amd64.CMPPS, x1Reg, x2Reg, floatLessThanOrEqualArg) + result = x2Reg + case wazeroir.V128CmpTypeF64x2Eq: + c.assembler.CompileRegisterToRegisterWithArg(amd64.CMPPD, x2Reg, x1Reg, floatEqualArg) + result = x1Reg + case wazeroir.V128CmpTypeF64x2Ne: + c.assembler.CompileRegisterToRegisterWithArg(amd64.CMPPD, x2Reg, x1Reg, floatNotEqualARg) + result = x1Reg + case wazeroir.V128CmpTypeF64x2Lt: + c.assembler.CompileRegisterToRegisterWithArg(amd64.CMPPD, x2Reg, x1Reg, floatLessThanArg) + result = x1Reg + case wazeroir.V128CmpTypeF64x2Gt: + // Without AVX, there's no float Gt instruction, so we swap the register and use Lt instead. + c.assembler.CompileRegisterToRegisterWithArg(amd64.CMPPD, x1Reg, x2Reg, floatLessThanArg) + result = x2Reg + case wazeroir.V128CmpTypeF64x2Le: + c.assembler.CompileRegisterToRegisterWithArg(amd64.CMPPD, x2Reg, x1Reg, floatLessThanOrEqualArg) + result = x1Reg + case wazeroir.V128CmpTypeF64x2Ge: + // Without AVX, there's no float Ge instruction, so we swap the register and use Le instead. + c.assembler.CompileRegisterToRegisterWithArg(amd64.CMPPD, x1Reg, x2Reg, floatLessThanOrEqualArg) + result = x2Reg + case wazeroir.V128CmpTypeI8x16Eq: + c.assembler.CompileRegisterToRegister(amd64.PCMPEQB, x2Reg, x1Reg) + result = x1Reg + case wazeroir.V128CmpTypeI8x16Ne: + c.assembler.CompileRegisterToRegister(amd64.PCMPEQB, x2Reg, x1Reg) + // Set all bits on x2Reg register. + c.assembler.CompileRegisterToRegister(amd64.PCMPEQD, x2Reg, x2Reg) + // Swap the bits on x1Reg register. + c.assembler.CompileRegisterToRegister(amd64.PXOR, x2Reg, x1Reg) + result = x1Reg + case wazeroir.V128CmpTypeI8x16LtS: + c.assembler.CompileRegisterToRegister(amd64.PCMPGTB, x1Reg, x2Reg) + result = x2Reg + case wazeroir.V128CmpTypeI8x16LtU, wazeroir.V128CmpTypeI8x16GtU: + // Take the unsigned min/max values on each byte on x1 and x2 onto x1Reg. + if v128CmpType == wazeroir.V128CmpTypeI8x16LtU { + c.assembler.CompileRegisterToRegister(amd64.PMINUB, x2Reg, x1Reg) + } else { + c.assembler.CompileRegisterToRegister(amd64.PMAXUB, x2Reg, x1Reg) + } + c.assembler.CompileRegisterToRegister(amd64.PCMPEQB, x2Reg, x1Reg) + // Set all bits on x2Reg register. + c.assembler.CompileRegisterToRegister(amd64.PCMPEQD, x2Reg, x2Reg) + // Swap the bits on x2Reg register. + c.assembler.CompileRegisterToRegister(amd64.PXOR, x2Reg, x1Reg) + result = x1Reg + case wazeroir.V128CmpTypeI8x16GtS: + c.assembler.CompileRegisterToRegister(amd64.PCMPGTB, x2Reg, x1Reg) + result = x1Reg + case wazeroir.V128CmpTypeI8x16LeS, wazeroir.V128CmpTypeI8x16LeU: + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + // Copy the value on the src to tmp. + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, x1Reg, tmp) + if v128CmpType == wazeroir.V128CmpTypeI8x16LeS { + c.assembler.CompileRegisterToRegister(amd64.PMINSB, x2Reg, tmp) + } else { + c.assembler.CompileRegisterToRegister(amd64.PMINUB, x2Reg, tmp) + } + c.assembler.CompileRegisterToRegister(amd64.PCMPEQB, tmp, x1Reg) + result = x1Reg + case wazeroir.V128CmpTypeI8x16GeS, wazeroir.V128CmpTypeI8x16GeU: + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, x1Reg, tmp) + if v128CmpType == wazeroir.V128CmpTypeI8x16GeS { + c.assembler.CompileRegisterToRegister(amd64.PMAXSB, x2Reg, tmp) + } else { + c.assembler.CompileRegisterToRegister(amd64.PMAXUB, x2Reg, tmp) + } + c.assembler.CompileRegisterToRegister(amd64.PCMPEQB, tmp, x1Reg) + result = x1Reg + case wazeroir.V128CmpTypeI16x8Eq: + c.assembler.CompileRegisterToRegister(amd64.PCMPEQW, x2Reg, x1Reg) + result = x1Reg + case wazeroir.V128CmpTypeI16x8Ne: + c.assembler.CompileRegisterToRegister(amd64.PCMPEQW, x2Reg, x1Reg) + // Set all bits on x2Reg register. + c.assembler.CompileRegisterToRegister(amd64.PCMPEQD, x2Reg, x2Reg) + // Swap the bits on x1Reg register. + c.assembler.CompileRegisterToRegister(amd64.PXOR, x2Reg, x1Reg) + result = x1Reg + case wazeroir.V128CmpTypeI16x8LtS: + c.assembler.CompileRegisterToRegister(amd64.PCMPGTW, x1Reg, x2Reg) + result = x2Reg + case wazeroir.V128CmpTypeI16x8LtU, wazeroir.V128CmpTypeI16x8GtU: + // Take the unsigned min/max values on each byte on x1 and x2 onto x1Reg. + if v128CmpType == wazeroir.V128CmpTypeI16x8LtU { + c.assembler.CompileRegisterToRegister(amd64.PMINUW, x2Reg, x1Reg) + } else { + c.assembler.CompileRegisterToRegister(amd64.PMAXUW, x2Reg, x1Reg) + } + c.assembler.CompileRegisterToRegister(amd64.PCMPEQW, x2Reg, x1Reg) + // Set all bits on x2Reg register. + c.assembler.CompileRegisterToRegister(amd64.PCMPEQD, x2Reg, x2Reg) + // Swap the bits on x2Reg register. + c.assembler.CompileRegisterToRegister(amd64.PXOR, x2Reg, x1Reg) + result = x1Reg + case wazeroir.V128CmpTypeI16x8GtS: + c.assembler.CompileRegisterToRegister(amd64.PCMPGTW, x2Reg, x1Reg) + result = x1Reg + case wazeroir.V128CmpTypeI16x8LeS, wazeroir.V128CmpTypeI16x8LeU: + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + // Copy the value on the src to tmp. + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, x1Reg, tmp) + if v128CmpType == wazeroir.V128CmpTypeI16x8LeS { + c.assembler.CompileRegisterToRegister(amd64.PMINSW, x2Reg, tmp) + } else { + c.assembler.CompileRegisterToRegister(amd64.PMINUW, x2Reg, tmp) + } + c.assembler.CompileRegisterToRegister(amd64.PCMPEQW, tmp, x1Reg) + result = x1Reg + case wazeroir.V128CmpTypeI16x8GeS, wazeroir.V128CmpTypeI16x8GeU: + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, x1Reg, tmp) + if v128CmpType == wazeroir.V128CmpTypeI16x8GeS { + c.assembler.CompileRegisterToRegister(amd64.PMAXSW, x2Reg, tmp) + } else { + c.assembler.CompileRegisterToRegister(amd64.PMAXUW, x2Reg, tmp) + } + c.assembler.CompileRegisterToRegister(amd64.PCMPEQW, tmp, x1Reg) + result = x1Reg + case wazeroir.V128CmpTypeI32x4Eq: + c.assembler.CompileRegisterToRegister(amd64.PCMPEQD, x2Reg, x1Reg) + result = x1Reg + case wazeroir.V128CmpTypeI32x4Ne: + c.assembler.CompileRegisterToRegister(amd64.PCMPEQD, x2Reg, x1Reg) + // Set all bits on x2Reg register. + c.assembler.CompileRegisterToRegister(amd64.PCMPEQD, x2Reg, x2Reg) + // Swap the bits on x1Reg register. + c.assembler.CompileRegisterToRegister(amd64.PXOR, x2Reg, x1Reg) + result = x1Reg + case wazeroir.V128CmpTypeI32x4LtS: + c.assembler.CompileRegisterToRegister(amd64.PCMPGTD, x1Reg, x2Reg) + result = x2Reg + case wazeroir.V128CmpTypeI32x4LtU, wazeroir.V128CmpTypeI32x4GtU: + // Take the unsigned min/max values on each byte on x1 and x2 onto x1Reg. + if v128CmpType == wazeroir.V128CmpTypeI32x4LtU { + c.assembler.CompileRegisterToRegister(amd64.PMINUD, x2Reg, x1Reg) + } else { + c.assembler.CompileRegisterToRegister(amd64.PMAXUD, x2Reg, x1Reg) + } + c.assembler.CompileRegisterToRegister(amd64.PCMPEQD, x2Reg, x1Reg) + // Set all bits on x2Reg register. + c.assembler.CompileRegisterToRegister(amd64.PCMPEQD, x2Reg, x2Reg) + // Swap the bits on x2Reg register. + c.assembler.CompileRegisterToRegister(amd64.PXOR, x2Reg, x1Reg) + result = x1Reg + case wazeroir.V128CmpTypeI32x4GtS: + c.assembler.CompileRegisterToRegister(amd64.PCMPGTD, x2Reg, x1Reg) + result = x1Reg + case wazeroir.V128CmpTypeI32x4LeS, wazeroir.V128CmpTypeI32x4LeU: + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + // Copy the value on the src to tmp. + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, x1Reg, tmp) + if v128CmpType == wazeroir.V128CmpTypeI32x4LeS { + c.assembler.CompileRegisterToRegister(amd64.PMINSD, x2Reg, tmp) + } else { + c.assembler.CompileRegisterToRegister(amd64.PMINUD, x2Reg, tmp) + } + c.assembler.CompileRegisterToRegister(amd64.PCMPEQD, tmp, x1Reg) + result = x1Reg + case wazeroir.V128CmpTypeI32x4GeS, wazeroir.V128CmpTypeI32x4GeU: + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, x1Reg, tmp) + if v128CmpType == wazeroir.V128CmpTypeI32x4GeS { + c.assembler.CompileRegisterToRegister(amd64.PMAXSD, x2Reg, tmp) + } else { + c.assembler.CompileRegisterToRegister(amd64.PMAXUD, x2Reg, tmp) + } + c.assembler.CompileRegisterToRegister(amd64.PCMPEQD, tmp, x1Reg) + result = x1Reg + case wazeroir.V128CmpTypeI64x2Eq: + c.assembler.CompileRegisterToRegister(amd64.PCMPEQQ, x2Reg, x1Reg) + result = x1Reg + case wazeroir.V128CmpTypeI64x2Ne: + c.assembler.CompileRegisterToRegister(amd64.PCMPEQQ, x2Reg, x1Reg) + // Set all bits on x2Reg register. + c.assembler.CompileRegisterToRegister(amd64.PCMPEQD, x2Reg, x2Reg) + // Swap the bits on x1Reg register. + c.assembler.CompileRegisterToRegister(amd64.PXOR, x2Reg, x1Reg) + result = x1Reg + case wazeroir.V128CmpTypeI64x2LtS: + c.assembler.CompileRegisterToRegister(amd64.PCMPGTQ, x1Reg, x2Reg) + result = x2Reg + case wazeroir.V128CmpTypeI64x2GtS: + c.assembler.CompileRegisterToRegister(amd64.PCMPGTQ, x2Reg, x1Reg) + result = x1Reg + case wazeroir.V128CmpTypeI64x2LeS: + c.assembler.CompileRegisterToRegister(amd64.PCMPGTQ, x2Reg, x1Reg) + // Set all bits on x2Reg register. + c.assembler.CompileRegisterToRegister(amd64.PCMPEQD, x2Reg, x2Reg) + // Swap the bits on x1Reg register. + c.assembler.CompileRegisterToRegister(amd64.PXOR, x2Reg, x1Reg) + result = x1Reg + case wazeroir.V128CmpTypeI64x2GeS: + c.assembler.CompileRegisterToRegister(amd64.PCMPGTQ, x1Reg, x2Reg) + // Set all bits on x1Reg register. + c.assembler.CompileRegisterToRegister(amd64.PCMPEQD, x1Reg, x1Reg) + // Swap the bits on x2Reg register. + c.assembler.CompileRegisterToRegister(amd64.PXOR, x1Reg, x2Reg) + result = x2Reg + } + + c.locationStack.markRegisterUnused(x1Reg, x2Reg) + c.pushVectorRuntimeValueLocationOnRegister(result) + return nil +} + +// compileV128AddSat implements compiler.compileV128AddSat for amd64. +func (c *amd64Compiler) compileV128AddSat(o *wazeroir.UnionOperation) error { + var inst asm.Instruction + shape := o.B1 + signed := o.B3 + switch shape { + case wazeroir.ShapeI8x16: + if signed { + inst = amd64.PADDSB + } else { + inst = amd64.PADDUSB + } + case wazeroir.ShapeI16x8: + if signed { + inst = amd64.PADDSW + } else { + inst = amd64.PADDUSW + } + } + + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + c.assembler.CompileRegisterToRegister(inst, x2.register, x1.register) + + c.locationStack.markRegisterUnused(x2.register) + c.pushVectorRuntimeValueLocationOnRegister(x1.register) + return nil +} + +// compileV128SubSat implements compiler.compileV128SubSat for amd64. +func (c *amd64Compiler) compileV128SubSat(o *wazeroir.UnionOperation) error { + var inst asm.Instruction + shape := o.B1 + signed := o.B3 + switch shape { + case wazeroir.ShapeI8x16: + if signed { + inst = amd64.PSUBSB + } else { + inst = amd64.PSUBUSB + } + case wazeroir.ShapeI16x8: + if signed { + inst = amd64.PSUBSW + } else { + inst = amd64.PSUBUSW + } + } + + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + c.assembler.CompileRegisterToRegister(inst, x2.register, x1.register) + + c.locationStack.markRegisterUnused(x2.register) + c.pushVectorRuntimeValueLocationOnRegister(x1.register) + return nil +} + +// compileV128Mul implements compiler.compileV128Mul for amd64. +func (c *amd64Compiler) compileV128Mul(o *wazeroir.UnionOperation) error { + var inst asm.Instruction + shape := o.B1 + switch shape { + case wazeroir.ShapeI16x8: + inst = amd64.PMULLW + case wazeroir.ShapeI32x4: + inst = amd64.PMULLD + case wazeroir.ShapeI64x2: + return c.compileV128MulI64x2() + case wazeroir.ShapeF32x4: + inst = amd64.MULPS + case wazeroir.ShapeF64x2: + inst = amd64.MULPD + } + + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + c.assembler.CompileRegisterToRegister(inst, x2.register, x1.register) + + c.locationStack.markRegisterUnused(x2.register) + c.pushVectorRuntimeValueLocationOnRegister(x1.register) + return nil +} + +// compileV128MulI64x2 implements V128Mul for i64x2. +func (c *amd64Compiler) compileV128MulI64x2() error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + x1r, x2r := x1.register, x2.register + + tmp1, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + c.locationStack.markRegisterUsed(tmp1) + + tmp2, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + // Assuming that we have + // x1r = [p1, p2] = [p1_lo, p1_hi, p2_lo, p2_high] + // x2r = [q1, q2] = [q1_lo, q1_hi, q2_lo, q2_high] + // where pN and qN are 64-bit (quad word) lane, and pN_lo, pN_hi, qN_lo and qN_hi are 32-bit (double word) lane. + + // Copy x1's value into tmp1. + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, x1r, tmp1) + // And do the logical right shift by 32-bit on tmp1, which makes tmp1 = [0, p1_high, 0, p2_high] + c.assembler.CompileConstToRegister(amd64.PSRLQ, 32, tmp1) + + // Execute "pmuludq x2r,tmp1", which makes tmp1 = [p1_high*q1_lo, p2_high*q2_lo] where each lane is 64-bit. + c.assembler.CompileRegisterToRegister(amd64.PMULUDQ, x2r, tmp1) + + // Copy x2's value into tmp2. + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, x2r, tmp2) + // And do the logical right shift by 32-bit on tmp2, which makes tmp2 = [0, q1_high, 0, q2_high] + c.assembler.CompileConstToRegister(amd64.PSRLQ, 32, tmp2) + + // Execute "pmuludq x1r,tmp2", which makes tmp2 = [p1_lo*q1_high, p2_lo*q2_high] where each lane is 64-bit. + c.assembler.CompileRegisterToRegister(amd64.PMULUDQ, x1r, tmp2) + + // Adds tmp1 and tmp2 and do the logical left shift by 32-bit, + // which makes tmp1 = [(p1_lo*q1_high+p1_high*q1_lo)<<32, (p2_lo*q2_high+p2_high*q2_lo)<<32] + c.assembler.CompileRegisterToRegister(amd64.PADDQ, tmp2, tmp1) + c.assembler.CompileConstToRegister(amd64.PSLLQ, 32, tmp1) + + // Execute "pmuludq x2r,x1r", which makes x1r = [p1_lo*q1_lo, p2_lo*q2_lo] where each lane is 64-bit. + c.assembler.CompileRegisterToRegister(amd64.PMULUDQ, x2r, x1r) + + // Finally, we get the result by adding x1r and tmp1, + // which makes x1r = [(p1_lo*q1_high+p1_high*q1_lo)<<32+p1_lo*q1_lo, (p2_lo*q2_high+p2_high*q2_lo)<<32+p2_lo*q2_lo] + c.assembler.CompileRegisterToRegister(amd64.PADDQ, tmp1, x1r) + + c.locationStack.markRegisterUnused(x2r, tmp1) + c.pushVectorRuntimeValueLocationOnRegister(x1r) + return nil +} + +// compileV128Div implements compiler.compileV128Div for amd64. +func (c *amd64Compiler) compileV128Div(o *wazeroir.UnionOperation) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + var inst asm.Instruction + shape := o.B1 + switch shape { + case wazeroir.ShapeF32x4: + inst = amd64.DIVPS + case wazeroir.ShapeF64x2: + inst = amd64.DIVPD + } + + c.assembler.CompileRegisterToRegister(inst, x2.register, x1.register) + + c.locationStack.markRegisterUnused(x2.register) + c.pushVectorRuntimeValueLocationOnRegister(x1.register) + return nil +} + +// compileV128Neg implements compiler.compileV128Neg for amd64. +func (c *amd64Compiler) compileV128Neg(o *wazeroir.UnionOperation) error { + shape := o.B1 + if shape <= wazeroir.ShapeI64x2 { + return c.compileV128NegInt(shape) + } else { + return c.compileV128NegFloat(shape) + } +} + +// compileV128NegInt implements compiler.compileV128Neg for integer lanes. +func (c *amd64Compiler) compileV128NegInt(s wazeroir.Shape) error { + v := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + + result, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + var subInst asm.Instruction + switch s { + case wazeroir.ShapeI8x16: + subInst = amd64.PSUBB + case wazeroir.ShapeI16x8: + subInst = amd64.PSUBW + case wazeroir.ShapeI32x4: + subInst = amd64.PSUBD + case wazeroir.ShapeI64x2: + subInst = amd64.PSUBQ + } + + c.assembler.CompileRegisterToRegister(amd64.PXOR, result, result) + c.assembler.CompileRegisterToRegister(subInst, v.register, result) + + c.locationStack.markRegisterUnused(v.register) + c.pushVectorRuntimeValueLocationOnRegister(result) + return nil +} + +// compileV128NegInt implements compiler.compileV128Neg for float lanes. +func (c *amd64Compiler) compileV128NegFloat(s wazeroir.Shape) error { + v := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + var leftShiftInst, xorInst asm.Instruction + var leftShiftAmount asm.ConstantValue + if s == wazeroir.ShapeF32x4 { + leftShiftInst, leftShiftAmount, xorInst = amd64.PSLLD, 31, amd64.XORPS + } else { + leftShiftInst, leftShiftAmount, xorInst = amd64.PSLLQ, 63, amd64.XORPD + } + + // Clear all bits on tmp. + c.assembler.CompileRegisterToRegister(amd64.XORPS, tmp, tmp) + // Set all bits on tmp by CMPPD with arg=0 (== pseudo CMPEQPD instruction). + // See https://www.felixcloutier.com/x86/cmpps + // + // Note: if we do not clear all the bits ^ with XORPS, this might end up not setting ones on some lane + // if the lane is NaN. + c.assembler.CompileRegisterToRegisterWithArg(amd64.CMPPD, tmp, tmp, 0x8) + // Do the left shift on each lane to set only the most significant bit in each. + c.assembler.CompileConstToRegister(leftShiftInst, leftShiftAmount, tmp) + // Get the negated result by XOR on each lane with tmp. + c.assembler.CompileRegisterToRegister(xorInst, tmp, v.register) + + c.pushVectorRuntimeValueLocationOnRegister(v.register) + return nil +} + +// compileV128Sqrt implements compiler.compileV128Sqrt for amd64. +func (c *amd64Compiler) compileV128Sqrt(o *wazeroir.UnionOperation) error { + v := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + + var inst asm.Instruction + shape := o.B1 + switch shape { + case wazeroir.ShapeF64x2: + inst = amd64.SQRTPD + case wazeroir.ShapeF32x4: + inst = amd64.SQRTPS + } + + c.assembler.CompileRegisterToRegister(inst, v.register, v.register) + c.pushVectorRuntimeValueLocationOnRegister(v.register) + return nil +} + +// compileV128Abs implements compiler.compileV128Abs for amd64. +func (c *amd64Compiler) compileV128Abs(o *wazeroir.UnionOperation) error { + shape := o.B1 + if shape == wazeroir.ShapeI64x2 { + return c.compileV128AbsI64x2() + } + + v := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + + result := v.register + switch shape { + case wazeroir.ShapeI8x16: + c.assembler.CompileRegisterToRegister(amd64.PABSB, result, result) + case wazeroir.ShapeI16x8: + c.assembler.CompileRegisterToRegister(amd64.PABSW, result, result) + case wazeroir.ShapeI32x4: + c.assembler.CompileRegisterToRegister(amd64.PABSD, result, result) + case wazeroir.ShapeF32x4: + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + // Set all bits on tmp. + c.assembler.CompileRegisterToRegister(amd64.PCMPEQD, tmp, tmp) + // Shift right packed single floats by 1 to clear the sign bits. + c.assembler.CompileConstToRegister(amd64.PSRLD, 1, tmp) + // Clear the sign bit of vr. + c.assembler.CompileRegisterToRegister(amd64.ANDPS, tmp, result) + case wazeroir.ShapeF64x2: + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + // Set all bits on tmp. + c.assembler.CompileRegisterToRegister(amd64.PCMPEQD, tmp, tmp) + // Shift right packed single floats by 1 to clear the sign bits. + c.assembler.CompileConstToRegister(amd64.PSRLQ, 1, tmp) + // Clear the sign bit of vr. + c.assembler.CompileRegisterToRegister(amd64.ANDPD, tmp, result) + } + + c.pushVectorRuntimeValueLocationOnRegister(result) + return nil +} + +// compileV128AbsI64x2 implements compileV128Abs for i64x2 lanes. +func (c *amd64Compiler) compileV128AbsI64x2() error { + // See https://www.felixcloutier.com/x86/blendvpd + const blendMaskReg = amd64.RegX0 + c.onValueReleaseRegisterToStack(blendMaskReg) + c.locationStack.markRegisterUsed(blendMaskReg) + + v := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + vr := v.register + + if vr == blendMaskReg { + return errors.New("BUG: X0 must not be used") + } + + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + c.locationStack.markRegisterUsed(tmp) + + // Copy the value to tmp. + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, vr, tmp) + + // Clear all bits on blendMaskReg. + c.assembler.CompileRegisterToRegister(amd64.PXOR, blendMaskReg, blendMaskReg) + // Subtract vr from blendMaskReg. + c.assembler.CompileRegisterToRegister(amd64.PSUBQ, vr, blendMaskReg) + // Copy the subtracted value ^^ back into vr. + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, blendMaskReg, vr) + + c.assembler.CompileRegisterToRegister(amd64.BLENDVPD, tmp, vr) + + c.locationStack.markRegisterUnused(blendMaskReg, tmp) + c.pushVectorRuntimeValueLocationOnRegister(vr) + return nil +} + +var ( + popcntMask = [16]byte{ + 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, + 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, + } + // popcntTable holds each index's Popcnt, for example popcntTable[5] holds popcnt(0x05). + popcntTable = [16]byte{ + 0x00, 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, 0x03, + 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, + } +) + +// compileV128Popcnt implements compiler.compileV128Popcnt for amd64. +func (c *amd64Compiler) compileV128Popcnt(operation *wazeroir.UnionOperation) error { + v := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + vr := v.register + + tmp1, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + c.locationStack.markRegisterUsed(tmp1) + + tmp2, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + c.locationStack.markRegisterUsed(tmp2) + + tmp3, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + // Read the popcntMask into tmp1, and we have + // tmp1 = [0xf, ..., 0xf] + if err := c.assembler.CompileStaticConstToRegister(amd64.MOVDQU, asm.NewStaticConst(popcntMask[:]), tmp1); err != nil { + return err + } + + // Copy the original value into tmp2. + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, vr, tmp2) + + // Given that we have: + // v = [b1, ..., b16] where bn = hn:ln and hn and ln are higher and lower 4-bits of bn. + // + // Take PAND on tmp1 and tmp2, and we have + // tmp2 = [l1, ..., l16]. + c.assembler.CompileRegisterToRegister(amd64.PAND, tmp1, tmp2) + + // Do logical (packed word) right shift by 4 on vr and PAND with vr and tmp1, meaning that we have + // vr = [h1, ...., h16]. + c.assembler.CompileConstToRegister(amd64.PSRLW, 4, vr) + c.assembler.CompileRegisterToRegister(amd64.PAND, tmp1, vr) + + // Read the popcntTable into tmp1, and we have + // tmp1 = [0x00, 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, 0x03, 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04] + if err := c.assembler.CompileStaticConstToRegister(amd64.MOVDQU, asm.NewStaticConst(popcntTable[:]), tmp1); err != nil { + return err + } + + // Copy the tmp1 into tmp3, and we have + // tmp3 = [0x00, 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, 0x03, 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04] + c.assembler.CompileRegisterToRegister(amd64.MOVDQU, tmp1, tmp3) + + // tmp3 = [popcnt(l1), ..., popcnt(l16)]. + c.assembler.CompileRegisterToRegister(amd64.PSHUFB, tmp2, tmp3) + + // tmp1 = [popcnt(h1), ..., popcnt(h16)]. + c.assembler.CompileRegisterToRegister(amd64.PSHUFB, vr, tmp1) + + // vr = tmp1 = [popcnt(h1), ..., popcnt(h16)]. + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, tmp1, vr) + + // vr += tmp3 = [popcnt(h1)+popcnt(l1), ..., popcnt(h16)+popcnt(l16)] = [popcnt(b1), ..., popcnt(b16)]. + c.assembler.CompileRegisterToRegister(amd64.PADDB, tmp3, vr) + + c.locationStack.markRegisterUnused(tmp1, tmp2) + c.pushVectorRuntimeValueLocationOnRegister(vr) + return nil +} + +// compileV128Min implements compiler.compileV128Min for amd64. +func (c *amd64Compiler) compileV128Min(o *wazeroir.UnionOperation) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + shape := o.B1 + if shape >= wazeroir.ShapeF32x4 { + return c.compileV128FloatMinImpl(shape == wazeroir.ShapeF32x4, x1.register, x2.register) + } + + signed := o.B3 + var inst asm.Instruction + switch shape { + case wazeroir.ShapeI8x16: + if signed { + inst = amd64.PMINSB + } else { + inst = amd64.PMINUB + } + case wazeroir.ShapeI16x8: + if signed { + inst = amd64.PMINSW + } else { + inst = amd64.PMINUW + } + case wazeroir.ShapeI32x4: + if signed { + inst = amd64.PMINSD + } else { + inst = amd64.PMINUD + } + } + + c.assembler.CompileRegisterToRegister(inst, x2.register, x1.register) + + c.locationStack.markRegisterUnused(x2.register) + c.pushVectorRuntimeValueLocationOnRegister(x1.register) + return nil +} + +// compileV128FloatMinImpl implements compiler.compileV128Min for float lanes. +func (c *amd64Compiler) compileV128FloatMinImpl(is32bit bool, x1r, x2r asm.Register) error { + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + var min, cmp, andn, or, srl /* shit right logical */ asm.Instruction + var shiftNumToInverseNaN asm.ConstantValue + if is32bit { + min, cmp, andn, or, srl, shiftNumToInverseNaN = amd64.MINPS, amd64.CMPPS, amd64.ANDNPS, amd64.ORPS, amd64.PSRLD, 0xa + } else { + min, cmp, andn, or, srl, shiftNumToInverseNaN = amd64.MINPD, amd64.CMPPD, amd64.ANDNPD, amd64.ORPD, amd64.PSRLQ, 0xd + } + + // Let v1 and v2 be the operand values on x1r and x2r at this point. + + // Copy the value into tmp: tmp=v1 + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, x1r, tmp) + // tmp=min(v1, v2) + c.assembler.CompileRegisterToRegister(min, x2r, tmp) + // x2r=min(v2, v1) + c.assembler.CompileRegisterToRegister(min, x1r, x2r) + // x1r=min(v2, v1) + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, x2r, x1r) + + // x2r = -0 if (v1 == -0 || x2 == -0) && v1 != NaN && v2 !=NaN + // NaN if v1 == NaN || v2 == NaN + // min(v1, v2) otherwise + c.assembler.CompileRegisterToRegister(or, tmp, x2r) + // x1r = 0^ (set all bits) if v1 == NaN || v2 == NaN + // 0 otherwise + c.assembler.CompileRegisterToRegisterWithArg(cmp, tmp, x1r, 3) + // x2r = -0 if (v1 == -0 || x2 == -0) && v1 != NaN && v2 !=NaN + // ^0 if v1 == NaN || v2 == NaN + // min(v1, v2) otherwise + c.assembler.CompileRegisterToRegister(or, x1r, x2r) + // x1r = set all bits on the mantissa bits + // 0 otherwise + c.assembler.CompileConstToRegister(srl, shiftNumToInverseNaN, x1r) + // x1r = x2r and !x1r + // = -0 if (v1 == -0 || x2 == -0) && v1 != NaN && v2 !=NaN + // set all bits on exponential and sign bit (== NaN) if v1 == NaN || v2 == NaN + // min(v1, v2) otherwise + c.assembler.CompileRegisterToRegister(andn, x2r, x1r) + + c.locationStack.markRegisterUnused(x2r) + c.pushVectorRuntimeValueLocationOnRegister(x1r) + return nil +} + +// compileV128Max implements compiler.compileV128Max for amd64. +func (c *amd64Compiler) compileV128Max(o *wazeroir.UnionOperation) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + shape := o.B1 + if shape >= wazeroir.ShapeF32x4 { + return c.compileV128FloatMaxImpl(shape == wazeroir.ShapeF32x4, x1.register, x2.register) + } + + signed := o.B3 + var inst asm.Instruction + switch shape { + case wazeroir.ShapeI8x16: + if signed { + inst = amd64.PMAXSB + } else { + inst = amd64.PMAXUB + } + case wazeroir.ShapeI16x8: + if signed { + inst = amd64.PMAXSW + } else { + inst = amd64.PMAXUW + } + case wazeroir.ShapeI32x4: + if signed { + inst = amd64.PMAXSD + } else { + inst = amd64.PMAXUD + } + } + + c.assembler.CompileRegisterToRegister(inst, x2.register, x1.register) + + c.locationStack.markRegisterUnused(x2.register) + c.pushVectorRuntimeValueLocationOnRegister(x1.register) + return nil +} + +// compileV128FloatMaxImpl implements compiler.compileV128Max for float lanes. +func (c *amd64Compiler) compileV128FloatMaxImpl(is32bit bool, x1r, x2r asm.Register) error { + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + var max, cmp, andn, or, xor, sub, srl /* shit right logical */ asm.Instruction + var shiftNumToInverseNaN asm.ConstantValue + if is32bit { + max, cmp, andn, or, xor, sub, srl, shiftNumToInverseNaN = amd64.MAXPS, amd64.CMPPS, amd64.ANDNPS, amd64.ORPS, amd64.XORPS, amd64.SUBPS, amd64.PSRLD, 0xa + } else { + max, cmp, andn, or, xor, sub, srl, shiftNumToInverseNaN = amd64.MAXPD, amd64.CMPPD, amd64.ANDNPD, amd64.ORPD, amd64.XORPD, amd64.SUBPD, amd64.PSRLQ, 0xd + } + + // Let v1 and v2 be the operand values on x1r and x2r at this point. + + // Copy the value into tmp: tmp=v2 + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, x2r, tmp) + // tmp=max(v2, v1) + c.assembler.CompileRegisterToRegister(max, x1r, tmp) + // x1r=max(v1, v2) + c.assembler.CompileRegisterToRegister(max, x2r, x1r) + // x2r=max(v1, v2) + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, x1r, x2r) + + // x2r = -0 if (v1 == -0 && v2 == 0) || (v1 == 0 && v2 == -0) + // 0 if (v1 == 0 && v2 == 0) + // -0 if (v1 == -0 && v2 == -0) + // v1^v2 if v1 == NaN || v2 == NaN + // 0 otherwise + c.assembler.CompileRegisterToRegister(xor, tmp, x2r) + // x1r = -0 if (v1 == -0 && v2 == 0) || (v1 == 0 && v2 == -0) + // 0 if (v1 == 0 && v2 == 0) + // -0 if (v1 == -0 && v2 == -0) + // NaN if v1 == NaN || v2 == NaN + // max(v1, v2) otherwise + c.assembler.CompileRegisterToRegister(or, x2r, x1r) + // Copy x1r into tmp. + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, x1r, tmp) + // tmp = 0 if (v1 == -0 && v2 == 0) || (v1 == 0 && v2 == -0) || (v1 == 0 && v2 == 0) + // -0 if (v1 == -0 && v2 == -0) + // NaN if v1 == NaN || v2 == NaN + // max(v1, v2) otherwise + // + // Note: -0 - (-0) = 0 (!= -0) in floating point operation. + c.assembler.CompileRegisterToRegister(sub, x2r, tmp) + // x1r = 0^ if v1 == NaN || v2 == NaN + c.assembler.CompileRegisterToRegisterWithArg(cmp, x1r, x1r, 3) + // x1r = set all bits on the mantissa bits + // 0 otherwise + c.assembler.CompileConstToRegister(srl, shiftNumToInverseNaN, x1r) + c.assembler.CompileRegisterToRegister(andn, tmp, x1r) + + c.locationStack.markRegisterUnused(x2r) + c.pushVectorRuntimeValueLocationOnRegister(x1r) + return nil +} + +// compileV128AvgrU implements compiler.compileV128AvgrU for amd64. +func (c *amd64Compiler) compileV128AvgrU(o *wazeroir.UnionOperation) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + var inst asm.Instruction + shape := o.B1 + switch shape { + case wazeroir.ShapeI8x16: + inst = amd64.PAVGB + case wazeroir.ShapeI16x8: + inst = amd64.PAVGW + } + + c.assembler.CompileRegisterToRegister(inst, x2.register, x1.register) + + c.locationStack.markRegisterUnused(x2.register) + c.pushVectorRuntimeValueLocationOnRegister(x1.register) + return nil +} + +// compileV128Pmin implements compiler.compileV128Pmin for amd64. +func (c *amd64Compiler) compileV128Pmin(o *wazeroir.UnionOperation) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + var min asm.Instruction + if o.B1 == wazeroir.ShapeF32x4 { + min = amd64.MINPS + } else { + min = amd64.MINPD + } + + x1r, v2r := x1.register, x2.register + + c.assembler.CompileRegisterToRegister(min, x1r, v2r) + + c.locationStack.markRegisterUnused(x1r) + c.pushVectorRuntimeValueLocationOnRegister(v2r) + return nil +} + +// compileV128Pmax implements compiler.compileV128Pmax for amd64. +func (c *amd64Compiler) compileV128Pmax(o *wazeroir.UnionOperation) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + var min asm.Instruction + if o.B1 == wazeroir.ShapeF32x4 { + min = amd64.MAXPS + } else { + min = amd64.MAXPD + } + + x1r, v2r := x1.register, x2.register + + c.assembler.CompileRegisterToRegister(min, x1r, v2r) + + c.locationStack.markRegisterUnused(x1r) + c.pushVectorRuntimeValueLocationOnRegister(v2r) + return nil +} + +// compileV128Ceil implements compiler.compileV128Ceil for amd64. +func (c *amd64Compiler) compileV128Ceil(o *wazeroir.UnionOperation) error { + // See https://www.felixcloutier.com/x86/roundpd + const roundModeCeil = 0x2 + return c.compileV128RoundImpl(o.B1 == wazeroir.ShapeF32x4, roundModeCeil) +} + +// compileV128Floor implements compiler.compileV128Floor for amd64. +func (c *amd64Compiler) compileV128Floor(o *wazeroir.UnionOperation) error { + // See https://www.felixcloutier.com/x86/roundpd + const roundModeFloor = 0x1 + return c.compileV128RoundImpl(o.B1 == wazeroir.ShapeF32x4, roundModeFloor) +} + +// compileV128Trunc implements compiler.compileV128Trunc for amd64. +func (c *amd64Compiler) compileV128Trunc(o *wazeroir.UnionOperation) error { + // See https://www.felixcloutier.com/x86/roundpd + const roundModeTrunc = 0x3 + return c.compileV128RoundImpl(o.B1 == wazeroir.ShapeF32x4, roundModeTrunc) +} + +// compileV128Nearest implements compiler.compileV128Nearest for amd64. +func (c *amd64Compiler) compileV128Nearest(o *wazeroir.UnionOperation) error { + // See https://www.felixcloutier.com/x86/roundpd + const roundModeNearest = 0x0 + return c.compileV128RoundImpl(o.B1 == wazeroir.ShapeF32x4, roundModeNearest) +} + +// compileV128RoundImpl implements compileV128Nearest compileV128Trunc compileV128Floor and compileV128Ceil +// with ROUNDPS (32-bit lane) and ROUNDPD (64-bit lane). +func (c *amd64Compiler) compileV128RoundImpl(is32bit bool, mode byte) error { + v := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + vr := v.register + + var round asm.Instruction + if is32bit { + round = amd64.ROUNDPS + } else { + round = amd64.ROUNDPD + } + + c.assembler.CompileRegisterToRegisterWithArg(round, vr, vr, mode) + c.pushVectorRuntimeValueLocationOnRegister(vr) + return nil +} + +// compileV128Extend implements compiler.compileV128Extend for amd64. +func (c *amd64Compiler) compileV128Extend(o *wazeroir.UnionOperation) error { + v := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + vr := v.register + + originShape := o.B1 + signed := o.B2 == 1 + useLow := o.B3 + if !useLow { + // We have to shift the higher 64-bits into the lower ones before the actual extending instruction. + // Shifting right by 0x8 * 8 = 64bits and concatenate itself. + // See https://www.felixcloutier.com/x86/palignr + c.assembler.CompileRegisterToRegisterWithArg(amd64.PALIGNR, v.register, v.register, 0x8) + } + + var extend asm.Instruction + switch originShape { + case wazeroir.ShapeI8x16: + if signed { + extend = amd64.PMOVSXBW + } else { + extend = amd64.PMOVZXBW + } + case wazeroir.ShapeI16x8: + if signed { + extend = amd64.PMOVSXWD + } else { + extend = amd64.PMOVZXWD + } + case wazeroir.ShapeI32x4: + if signed { + extend = amd64.PMOVSXDQ + } else { + extend = amd64.PMOVZXDQ + } + } + + c.assembler.CompileRegisterToRegister(extend, vr, vr) + c.pushVectorRuntimeValueLocationOnRegister(vr) + return nil +} + +// compileV128ExtMul implements compiler.compileV128ExtMul for amd64. +func (c *amd64Compiler) compileV128ExtMul(o *wazeroir.UnionOperation) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + x1r, x2r := x1.register, x2.register + + originShape := o.B1 + signed := o.B2 == 1 + useLow := o.B3 + switch originShape { + case wazeroir.ShapeI8x16: + if !useLow { + // We have to shift the higher 64-bits into the lower ones before the actual extending instruction. + // Shifting right by 0x8 * 8 = 64bits and concatenate itself. + // See https://www.felixcloutier.com/x86/palignr + c.assembler.CompileRegisterToRegisterWithArg(amd64.PALIGNR, x1r, x1r, 0x8) + c.assembler.CompileRegisterToRegisterWithArg(amd64.PALIGNR, x2r, x2r, 0x8) + } + + var ext asm.Instruction + if signed { + ext = amd64.PMOVSXBW + } else { + ext = amd64.PMOVZXBW + } + + // Signed or Zero extend lower half packed bytes to packed words. + c.assembler.CompileRegisterToRegister(ext, x1r, x1r) + c.assembler.CompileRegisterToRegister(ext, x2r, x2r) + + c.assembler.CompileRegisterToRegister(amd64.PMULLW, x2r, x1r) + case wazeroir.ShapeI16x8: + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + // Copy the value on x1r to tmp. + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, x1r, tmp) + + // Multiply the values and store the lower 16-bits into x1r. + c.assembler.CompileRegisterToRegister(amd64.PMULLW, x2r, x1r) + if signed { + // Signed multiply the values and store the higher 16-bits into tmp. + c.assembler.CompileRegisterToRegister(amd64.PMULHW, x2r, tmp) + } else { + // Unsigned multiply the values and store the higher 16-bits into tmp. + c.assembler.CompileRegisterToRegister(amd64.PMULHUW, x2r, tmp) + } + + // Unpack lower or higher half of vectors (tmp and x1r) and concatenate them. + if useLow { + c.assembler.CompileRegisterToRegister(amd64.PUNPCKLWD, tmp, x1r) + } else { + c.assembler.CompileRegisterToRegister(amd64.PUNPCKHWD, tmp, x1r) + } + case wazeroir.ShapeI32x4: + var shuffleOrder byte + // Given that the original state of the register is as [v1, v2, v3, v4] where vN = a word, + if useLow { + // This makes the register as [v1, v1, v2, v2] + shuffleOrder = 0b01010000 + } else { + // This makes the register as [v3, v3, v4, v4] + shuffleOrder = 0b11111010 + } + // See https://www.felixcloutier.com/x86/pshufd + c.assembler.CompileRegisterToRegisterWithArg(amd64.PSHUFD, x1r, x1r, shuffleOrder) + c.assembler.CompileRegisterToRegisterWithArg(amd64.PSHUFD, x2r, x2r, shuffleOrder) + + var mul asm.Instruction + if signed { + mul = amd64.PMULDQ + } else { + mul = amd64.PMULUDQ + } + c.assembler.CompileRegisterToRegister(mul, x2r, x1r) + } + + c.locationStack.markRegisterUnused(x2r) + c.pushVectorRuntimeValueLocationOnRegister(x1r) + return nil +} + +var q15mulrSatSMask = [16]byte{ + 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, + 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, +} + +// compileV128Q15mulrSatS implements compiler.compileV128Q15mulrSatS for amd64. +func (c *amd64Compiler) compileV128Q15mulrSatS(*wazeroir.UnionOperation) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + x1r, x2r := x1.register, x2.register + + // See https://github.com/WebAssembly/simd/pull/365 for the following logic. + if err := c.assembler.CompileStaticConstToRegister(amd64.MOVDQU, asm.NewStaticConst(q15mulrSatSMask[:]), tmp); err != nil { + return err + } + + c.assembler.CompileRegisterToRegister(amd64.PMULHRSW, x2r, x1r) + c.assembler.CompileRegisterToRegister(amd64.PCMPEQW, x1r, tmp) + c.assembler.CompileRegisterToRegister(amd64.PXOR, tmp, x1r) + + c.locationStack.markRegisterUnused(x2r) + c.pushVectorRuntimeValueLocationOnRegister(x1r) + return nil +} + +var ( + allOnesI8x16 = [16]byte{0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1} + allOnesI16x8 = [16]byte{0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0} + + extAddPairwiseI16x8uMask = [16 * 2]byte{ + 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, + } +) + +// compileV128ExtAddPairwise implements compiler.compileV128ExtAddPairwise for amd64. +func (c *amd64Compiler) compileV128ExtAddPairwise(o *wazeroir.UnionOperation) error { + v := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + vr := v.register + + originShape := o.B1 + signed := o.B3 + switch originShape { + case wazeroir.ShapeI8x16: + allOnesReg, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + if err = c.assembler.CompileStaticConstToRegister(amd64.MOVDQU, + asm.NewStaticConst(allOnesI8x16[:]), allOnesReg); err != nil { + return err + } + + var result asm.Register + // See https://www.felixcloutier.com/x86/pmaddubsw for detail. + if signed { + // Interpret vr's value as signed byte and multiply with one and add pairwise, which results in pairwise + // signed extadd. + c.assembler.CompileRegisterToRegister(amd64.PMADDUBSW, vr, allOnesReg) + result = allOnesReg + } else { + // Interpreter tmp (all ones) as signed byte meaning that all the multiply-add is unsigned. + c.assembler.CompileRegisterToRegister(amd64.PMADDUBSW, allOnesReg, vr) + result = vr + } + + if result != vr { + c.locationStack.markRegisterUnused(vr) + } + c.pushVectorRuntimeValueLocationOnRegister(result) + case wazeroir.ShapeI16x8: + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + if signed { + // See https://www.felixcloutier.com/x86/pmaddwd + if err = c.assembler.CompileStaticConstToRegister(amd64.MOVDQU, + asm.NewStaticConst(allOnesI16x8[:]), tmp); err != nil { + return err + } + + c.assembler.CompileRegisterToRegister(amd64.PMADDWD, tmp, vr) + c.pushVectorRuntimeValueLocationOnRegister(vr) + } else { + + if err = c.assembler.CompileStaticConstToRegister(amd64.MOVDQU, + asm.NewStaticConst(extAddPairwiseI16x8uMask[:16]), tmp); err != nil { + return err + } + + // Flip the sign bits on vr. + // + // Assuming that vr = [w1, ..., w8], now we have, + // vr[i] = int8(-w1) for i = 0...8 + c.assembler.CompileRegisterToRegister(amd64.PXOR, tmp, vr) + + if err = c.assembler.CompileStaticConstToRegister(amd64.MOVDQU, + asm.NewStaticConst(allOnesI16x8[:]), tmp); err != nil { + return err + } + + // For i = 0,..4 (as this results in i32x4 lanes), now we have + // vr[i] = int32(-wn + -w(n+1)) = int32(-(wn + w(n+1))) + c.assembler.CompileRegisterToRegister(amd64.PMADDWD, tmp, vr) + + // tmp[i] = [0, 0, 1, 0] = int32(math.MaxInt16+1) + if err = c.assembler.CompileStaticConstToRegister(amd64.MOVDQU, + asm.NewStaticConst(extAddPairwiseI16x8uMask[16:]), tmp); err != nil { + return err + } + + // vr[i] = int32(-(wn + w(n+1))) + int32(math.MaxInt16+1) = int32((wn + w(n+1))) = uint32(wn + w(n+1)). + c.assembler.CompileRegisterToRegister(amd64.PADDD, tmp, vr) + c.pushVectorRuntimeValueLocationOnRegister(vr) + } + } + return nil +} + +// compileV128FloatPromote implements compiler.compileV128FloatPromote for amd64. +func (c *amd64Compiler) compileV128FloatPromote(*wazeroir.UnionOperation) error { + v := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + vr := v.register + + c.assembler.CompileRegisterToRegister(amd64.CVTPS2PD, vr, vr) + c.pushVectorRuntimeValueLocationOnRegister(vr) + return nil +} + +// compileV128FloatDemote implements compiler.compileV128FloatDemote for amd64. +func (c *amd64Compiler) compileV128FloatDemote(*wazeroir.UnionOperation) error { + v := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + vr := v.register + + c.assembler.CompileRegisterToRegister(amd64.CVTPD2PS, vr, vr) + c.pushVectorRuntimeValueLocationOnRegister(vr) + return nil +} + +// compileV128Dot implements compiler.compileV128Dot for amd64. +func (c *amd64Compiler) compileV128Dot(*wazeroir.UnionOperation) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + c.assembler.CompileRegisterToRegister(amd64.PMADDWD, x2.register, x1.register) + + c.locationStack.markRegisterUnused(x2.register) + c.pushVectorRuntimeValueLocationOnRegister(x1.register) + return nil +} + +var fConvertFromIMask = [16]byte{ + 0x00, 0x00, 0x30, 0x43, 0x00, 0x00, 0x30, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +} + +// compileV128FConvertFromI implements compiler.compileV128FConvertFromI for amd64. +func (c *amd64Compiler) compileV128FConvertFromI(o *wazeroir.UnionOperation) error { + v := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + vr := v.register + + destinationShape := o.B1 + signed := o.B3 + + switch destinationShape { + case wazeroir.ShapeF32x4: + if signed { + c.assembler.CompileRegisterToRegister(amd64.CVTDQ2PS, vr, vr) + } else { + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + // Copy the value into tmp. + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, vr, tmp) + + // Clear the higher 16-bits of tmp. + c.assembler.CompileConstToRegister(amd64.PSLLD, 0xa, tmp) + c.assembler.CompileConstToRegister(amd64.PSRLD, 0xa, tmp) + + // Subtract the higher 16-bits from vr == clear the lower 16-bits of vr. + c.assembler.CompileRegisterToRegister(amd64.PSUBD, tmp, vr) + + // Convert the lower 16-bits in tmp. + c.assembler.CompileRegisterToRegister(amd64.CVTDQ2PS, tmp, tmp) + + // Left shift by one and convert vr, meaning that halved conversion result of higher 16-bits in vr. + c.assembler.CompileConstToRegister(amd64.PSRLD, 1, vr) + c.assembler.CompileRegisterToRegister(amd64.CVTDQ2PS, vr, vr) + + // Double the converted halved higher 16bits. + c.assembler.CompileRegisterToRegister(amd64.ADDPS, vr, vr) + + // Get the conversion result by add tmp (holding lower 16-bit conversion) into vr. + c.assembler.CompileRegisterToRegister(amd64.ADDPS, tmp, vr) + } + case wazeroir.ShapeF64x2: + if signed { + c.assembler.CompileRegisterToRegister(amd64.CVTDQ2PD, vr, vr) + } else { + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + // tmp = [0x00, 0x00, 0x30, 0x43, 0x00, 0x00, 0x30, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] + if err = c.assembler.CompileStaticConstToRegister(amd64.MOVDQU, asm.NewStaticConst(fConvertFromIMask[:16]), tmp); err != nil { + return err + } + + // Given that we have vr = [d1, d2, d3, d4], this results in + // vr = [d1, [0x00, 0x00, 0x30, 0x43], d2, [0x00, 0x00, 0x30, 0x43]] + // = [float64(uint32(d1)) + 0x1.0p52, float64(uint32(d2)) + 0x1.0p52] + // ^See https://stackoverflow.com/questions/13269523/can-all-32-bit-ints-be-exactly-represented-as-a-double + c.assembler.CompileRegisterToRegister(amd64.UNPCKLPS, tmp, vr) + + // tmp = [float64(0x1.0p52), float64(0x1.0p52)] + if err = c.assembler.CompileStaticConstToRegister(amd64.MOVDQU, + asm.NewStaticConst(twop52[:]), tmp); err != nil { + return err + } + + // Now, we get the result as + // vr = [float64(uint32(d1)), float64(uint32(d2))] + // because the following equality always satisfies: + // float64(0x1.0p52 + float64(uint32(x))) - float64(0x1.0p52 + float64(uint32(y))) = float64(uint32(x)) - float64(uint32(y)) + c.assembler.CompileRegisterToRegister(amd64.SUBPD, tmp, vr) + } + } + + c.pushVectorRuntimeValueLocationOnRegister(vr) + return nil +} + +// compileV128Narrow implements compiler.compileV128Narrow for amd64. +func (c *amd64Compiler) compileV128Narrow(o *wazeroir.UnionOperation) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + var narrow asm.Instruction + originShape := o.B1 + signed := o.B3 + switch originShape { + case wazeroir.ShapeI16x8: + if signed { + narrow = amd64.PACKSSWB + } else { + narrow = amd64.PACKUSWB + } + case wazeroir.ShapeI32x4: + if signed { + narrow = amd64.PACKSSDW + } else { + narrow = amd64.PACKUSDW + } + } + c.assembler.CompileRegisterToRegister(narrow, x2.register, x1.register) + + c.locationStack.markRegisterUnused(x2.register) + c.pushVectorRuntimeValueLocationOnRegister(x1.register) + return nil +} + +var ( + // i32sMaxOnF64x2 holds math.MaxInt32(=2147483647.0) on two f64 lanes. + i32sMaxOnF64x2 = [16]byte{ + 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xdf, 0x41, // float64(2147483647.0) + 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xdf, 0x41, // float64(2147483647.0) + } + + // i32sMaxOnF64x2 holds math.MaxUint32(=4294967295.0) on two f64 lanes. + i32uMaxOnF64x2 = [16]byte{ + 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xef, 0x41, // float64(4294967295.0) + 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xef, 0x41, // float64(4294967295.0) + } + + // twop52 holds two float64(0x1.0p52) on two f64 lanes. 0x1.0p52 is special in the sense that + // with this exponent, the mantissa represents a corresponding uint32 number, and arithmetics, + // like addition or subtraction, the resulted floating point holds exactly the same + // bit representations in 32-bit integer on its mantissa. + // + // Note: the name twop52 is common across various compiler ecosystem. + // E.g. https://github.com/llvm/llvm-project/blob/92ab024f81e5b64e258b7c3baaf213c7c26fcf40/compiler-rt/lib/builtins/floatdidf.c#L28 + // E.g. https://opensource.apple.com/source/clang/clang-425.0.24/src/projects/compiler-rt/lib/floatdidf.c.auto.html + twop52 = [16]byte{ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x43, // float64(0x1.0p52) + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x43, // float64(0x1.0p52) + } +) + +// compileV128ITruncSatFromF implements compiler.compileV128ITruncSatFromF for amd64. +func (c *amd64Compiler) compileV128ITruncSatFromF(o *wazeroir.UnionOperation) error { + v := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + vr := v.register + + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + c.locationStack.markRegisterUsed(tmp) + + originShape := o.B1 + signed := o.B3 + switch originShape { + case wazeroir.ShapeF32x4: + if signed { + // Copy the value into tmp. + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, vr, tmp) + + // Assuming we have vr = [v1, v2, v3, v4]. + // + // Set all bits if lane is not NaN on tmp. + // tmp[i] = 0xffffffff if vi != NaN + // = 0 if vi == NaN + c.assembler.CompileRegisterToRegister(amd64.CMPEQPS, tmp, tmp) + + // Clear NaN lanes on vr, meaning that + // vr[i] = vi if vi != NaN + // 0 if vi == NaN + c.assembler.CompileRegisterToRegister(amd64.ANDPS, tmp, vr) + + // tmp[i] = ^vi if vi != NaN + // = 0xffffffff if vi == NaN + // which means that tmp[i] & 0x80000000 != 0 if and only if vi is negative. + c.assembler.CompileRegisterToRegister(amd64.PXOR, vr, tmp) + + // vr[i] = int32(vi) if vi != NaN and vr is not overflowing. + // = 0x80000000 if vi != NaN and vr is overflowing (See https://www.felixcloutier.com/x86/cvttps2dq) + // = 0 if vi == NaN + c.assembler.CompileRegisterToRegister(amd64.CVTTPS2DQ, vr, vr) + + // Below, we have to convert 0x80000000 into 0x7FFFFFFF for positive overflowing lane. + // + // tmp[i] = 0x80000000 if vi is positive + // = any satisfying any&0x80000000 = 0 if vi is negative or zero. + c.assembler.CompileRegisterToRegister(amd64.PAND, vr, tmp) + + // Arithmetic right shifting tmp by 31, meaning that we have + // tmp[i] = 0xffffffff if vi is positive, 0 otherwise. + c.assembler.CompileConstToRegister(amd64.PSRAD, 0x1f, tmp) + + // Flipping 0x80000000 if vi is positive, otherwise keep intact. + c.assembler.CompileRegisterToRegister(amd64.PXOR, tmp, vr) + } else { + tmp2, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + // See https://github.com/bytecodealliance/wasmtime/pull/2440 + // Note: even v8 doesn't seem to have support for this i32x4.tranc_sat_f32x4_u. + c.assembler.CompileRegisterToRegister(amd64.PXOR, tmp, tmp) + c.assembler.CompileRegisterToRegister(amd64.MAXPS, tmp, vr) + c.assembler.CompileRegisterToRegister(amd64.PCMPEQD, tmp, tmp) + c.assembler.CompileConstToRegister(amd64.PSRLD, 0x1, tmp) + c.assembler.CompileRegisterToRegister(amd64.CVTDQ2PS, tmp, tmp) + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, vr, tmp2) + c.assembler.CompileRegisterToRegister(amd64.CVTTPS2DQ, vr, vr) + c.assembler.CompileRegisterToRegister(amd64.SUBPS, tmp, tmp2) + c.assembler.CompileRegisterToRegisterWithArg(amd64.CMPPS, tmp2, tmp, 0x2) // == CMPLEPS + c.assembler.CompileRegisterToRegister(amd64.CVTTPS2DQ, tmp2, tmp2) + c.assembler.CompileRegisterToRegister(amd64.PXOR, tmp, tmp2) + c.assembler.CompileRegisterToRegister(amd64.PXOR, tmp, tmp) + c.assembler.CompileRegisterToRegister(amd64.PMAXSD, tmp, tmp2) + c.assembler.CompileRegisterToRegister(amd64.PADDD, tmp2, vr) + } + case wazeroir.ShapeF64x2: + tmp2, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + if signed { + // Copy the value into tmp. + c.assembler.CompileRegisterToRegister(amd64.MOVDQA, vr, tmp) + + // Set all bits for non-NaN lanes, zeros otherwise. + // I.e. tmp[i] = 0xffffffff_ffffffff if vi != NaN, 0 otherwise. + c.assembler.CompileRegisterToRegister(amd64.CMPEQPD, tmp, tmp) + + // Load the 2147483647 into tmp2's each lane. + if err = c.assembler.CompileStaticConstToRegister(amd64.MOVUPD, asm.NewStaticConst(i32sMaxOnF64x2[:]), tmp2); err != nil { + return err + } + + // tmp[i] = 2147483647 if vi != NaN, 0 otherwise. + c.assembler.CompileRegisterToRegister(amd64.ANDPS, tmp2, tmp) + + // MINPD returns the source register's value as-is, so we have + // vr[i] = vi if vi != NaN + // = 0 if vi == NaN + c.assembler.CompileRegisterToRegister(amd64.MINPD, tmp, vr) + + c.assembler.CompileRegisterToRegister(amd64.CVTTPD2DQ, vr, vr) + } else { + // Clears all bits on tmp. + c.assembler.CompileRegisterToRegister(amd64.PXOR, tmp, tmp) + + // vr[i] = vi if vi != NaN && vi > 0 + // = 0 if vi == NaN || vi <= 0 + c.assembler.CompileRegisterToRegister(amd64.MAXPD, tmp, vr) + + // tmp2[i] = float64(math.MaxUint32) = math.MaxUint32 + if err = c.assembler.CompileStaticConstToRegister(amd64.MOVUPD, asm.NewStaticConst(i32uMaxOnF64x2[:]), tmp2); err != nil { + return err + } + + // vr[i] = vi if vi != NaN && vi > 0 && vi <= math.MaxUint32 + // = 0 otherwise + c.assembler.CompileRegisterToRegister(amd64.MINPD, tmp2, vr) + + // Round the floating points into integer. + c.assembler.CompileRegisterToRegisterWithArg(amd64.ROUNDPD, vr, vr, 0x3) + + // tmp2[i] = float64(0x1.0p52) + if err = c.assembler.CompileStaticConstToRegister(amd64.MOVUPD, asm.NewStaticConst(twop52[:]), tmp2); err != nil { + return err + } + + // vr[i] = float64(0x1.0p52) + float64(uint32(vi)) if vi != NaN && vi > 0 && vi <= math.MaxUint32 + // = 0 otherwise + // + // This means that vr[i] holds exactly the same bit of uint32(vi) in its lower 32-bits. + c.assembler.CompileRegisterToRegister(amd64.ADDPD, tmp2, vr) + + // At this point, we have + // vr = [uint32(v0), float64(0x1.0p52), uint32(v1), float64(0x1.0p52)] + // tmp = [0, 0, 0, 0] + // as 32x4 lanes. Therefore, SHUFPS with 0b00_00_10_00 results in + // vr = [vr[00], vr[10], tmp[00], tmp[00]] = [vr[00], vr[10], 0, 0] + // meaning that for i = 0 and 1, we have + // vr[i] = uint32(vi) if vi != NaN && vi > 0 && vi <= math.MaxUint32 + // = 0 otherwise. + c.assembler.CompileRegisterToRegisterWithArg(amd64.SHUFPS, tmp, vr, 0b00_00_10_00) + } + } + + c.locationStack.markRegisterUnused(tmp) + c.pushVectorRuntimeValueLocationOnRegister(vr) + return nil +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/impl_vec_arm64.go b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/impl_vec_arm64.go new file mode 100644 index 000000000..70aa4a019 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/compiler/impl_vec_arm64.go @@ -0,0 +1,1592 @@ +package compiler + +import ( + "github.com/tetratelabs/wazero/internal/asm" + "github.com/tetratelabs/wazero/internal/asm/arm64" + "github.com/tetratelabs/wazero/internal/wazeroir" +) + +// compileV128Const implements compiler.compileV128Const for arm64. +func (c *arm64Compiler) compileV128Const(o *wazeroir.UnionOperation) error { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + + lo, hi := o.U1, o.U2 + + result, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + // Moves the lower 64-bits as a scalar float. + intReg := arm64ReservedRegisterForTemporary + if lo == 0 { + intReg = arm64.RegRZR + } else { + c.assembler.CompileConstToRegister(arm64.MOVD, int64(lo), arm64ReservedRegisterForTemporary) + } + c.assembler.CompileRegisterToRegister(arm64.FMOVD, intReg, result) + + // Then, insert the higher bits with INS(vector,general). + intReg = arm64ReservedRegisterForTemporary + if hi == 0 { + intReg = arm64.RegRZR + } else { + c.assembler.CompileConstToRegister(arm64.MOVD, int64(hi), arm64ReservedRegisterForTemporary) + } + // "ins Vn.D[1], intReg" + c.assembler.CompileRegisterToVectorRegister(arm64.INSGEN, intReg, result, arm64.VectorArrangementD, 1) + + c.pushVectorRuntimeValueLocationOnRegister(result) + return nil +} + +// compileV128Add implements compiler.compileV128Add for arm64. +func (c *arm64Compiler) compileV128Add(o *wazeroir.UnionOperation) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + x1r, x2r := x1.register, x2.register + + var arr arm64.VectorArrangement + var inst asm.Instruction + shape := o.B1 + switch shape { + case wazeroir.ShapeI8x16: + inst = arm64.VADD + arr = arm64.VectorArrangement16B + case wazeroir.ShapeI16x8: + inst = arm64.VADD + arr = arm64.VectorArrangement8H + case wazeroir.ShapeI32x4: + inst = arm64.VADD + arr = arm64.VectorArrangement4S + case wazeroir.ShapeI64x2: + inst = arm64.VADD + arr = arm64.VectorArrangement2D + case wazeroir.ShapeF32x4: + inst = arm64.VFADDS + arr = arm64.VectorArrangement4S + case wazeroir.ShapeF64x2: + inst = arm64.VFADDD + arr = arm64.VectorArrangement2D + } + + c.assembler.CompileVectorRegisterToVectorRegister(inst, x1r, x2r, arr, + arm64.VectorIndexNone, arm64.VectorIndexNone) + + c.pushVectorRuntimeValueLocationOnRegister(x2r) + c.markRegisterUnused(x1r) + return nil +} + +// compileV128Sub implements compiler.compileV128Sub for arm64. +func (c *arm64Compiler) compileV128Sub(o *wazeroir.UnionOperation) (err error) { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + x1r, x2r := x1.register, x2.register + + var arr arm64.VectorArrangement + var inst asm.Instruction + shape := o.B1 + switch shape { + case wazeroir.ShapeI8x16: + inst = arm64.VSUB + arr = arm64.VectorArrangement16B + case wazeroir.ShapeI16x8: + inst = arm64.VSUB + arr = arm64.VectorArrangement8H + case wazeroir.ShapeI32x4: + inst = arm64.VSUB + arr = arm64.VectorArrangement4S + case wazeroir.ShapeI64x2: + inst = arm64.VSUB + arr = arm64.VectorArrangement2D + case wazeroir.ShapeF32x4: + inst = arm64.VFSUBS + arr = arm64.VectorArrangement4S + case wazeroir.ShapeF64x2: + inst = arm64.VFSUBD + arr = arm64.VectorArrangement2D + } + + c.assembler.CompileVectorRegisterToVectorRegister(inst, x2r, x1r, arr, + arm64.VectorIndexNone, arm64.VectorIndexNone) + + c.pushVectorRuntimeValueLocationOnRegister(x1r) + c.markRegisterUnused(x2r) + return +} + +// compileV128Load implements compiler.compileV128Load for arm64. +func (c *arm64Compiler) compileV128Load(o *wazeroir.UnionOperation) (err error) { + if err := c.maybeCompileMoveTopConditionalToGeneralPurposeRegister(); err != nil { + return err + } + result, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + offset := uint32(o.U2) + loadType := wazeroir.V128LoadType(o.B1) + + switch loadType { + case wazeroir.V128LoadType128: + offset, err := c.compileMemoryAccessOffsetSetup(offset, 16) + if err != nil { + return err + } + c.assembler.CompileMemoryWithRegisterOffsetToVectorRegister(arm64.VMOV, + arm64ReservedRegisterForMemory, offset, result, arm64.VectorArrangementQ, + ) + case wazeroir.V128LoadType8x8s: + offset, err := c.compileMemoryAccessOffsetSetup(offset, 8) + if err != nil { + return err + } + c.assembler.CompileMemoryWithRegisterOffsetToVectorRegister(arm64.VMOV, + arm64ReservedRegisterForMemory, offset, result, arm64.VectorArrangementD, + ) + c.assembler.CompileVectorRegisterToVectorRegister(arm64.SSHLL, result, result, + arm64.VectorArrangement8B, arm64.VectorIndexNone, arm64.VectorIndexNone) + case wazeroir.V128LoadType8x8u: + offset, err := c.compileMemoryAccessOffsetSetup(offset, 8) + if err != nil { + return err + } + c.assembler.CompileMemoryWithRegisterOffsetToVectorRegister(arm64.VMOV, + arm64ReservedRegisterForMemory, offset, result, arm64.VectorArrangementD, + ) + c.assembler.CompileVectorRegisterToVectorRegister(arm64.USHLL, result, result, + arm64.VectorArrangement8B, arm64.VectorIndexNone, arm64.VectorIndexNone) + case wazeroir.V128LoadType16x4s: + offset, err := c.compileMemoryAccessOffsetSetup(offset, 8) + if err != nil { + return err + } + c.assembler.CompileMemoryWithRegisterOffsetToVectorRegister(arm64.VMOV, + arm64ReservedRegisterForMemory, offset, result, arm64.VectorArrangementD, + ) + c.assembler.CompileVectorRegisterToVectorRegister(arm64.SSHLL, result, result, + arm64.VectorArrangement4H, arm64.VectorIndexNone, arm64.VectorIndexNone) + case wazeroir.V128LoadType16x4u: + offset, err := c.compileMemoryAccessOffsetSetup(offset, 8) + if err != nil { + return err + } + c.assembler.CompileMemoryWithRegisterOffsetToVectorRegister(arm64.VMOV, + arm64ReservedRegisterForMemory, offset, result, arm64.VectorArrangementD, + ) + c.assembler.CompileVectorRegisterToVectorRegister(arm64.USHLL, result, result, + arm64.VectorArrangement4H, arm64.VectorIndexNone, arm64.VectorIndexNone) + case wazeroir.V128LoadType32x2s: + offset, err := c.compileMemoryAccessOffsetSetup(offset, 8) + if err != nil { + return err + } + c.assembler.CompileMemoryWithRegisterOffsetToVectorRegister(arm64.VMOV, + arm64ReservedRegisterForMemory, offset, result, arm64.VectorArrangementD, + ) + c.assembler.CompileVectorRegisterToVectorRegister(arm64.SSHLL, result, result, + arm64.VectorArrangement2S, arm64.VectorIndexNone, arm64.VectorIndexNone) + case wazeroir.V128LoadType32x2u: + offset, err := c.compileMemoryAccessOffsetSetup(offset, 8) + if err != nil { + return err + } + c.assembler.CompileMemoryWithRegisterOffsetToVectorRegister(arm64.VMOV, + arm64ReservedRegisterForMemory, offset, result, arm64.VectorArrangementD, + ) + c.assembler.CompileVectorRegisterToVectorRegister(arm64.USHLL, result, result, + arm64.VectorArrangement2S, arm64.VectorIndexNone, arm64.VectorIndexNone) + case wazeroir.V128LoadType8Splat: + offset, err := c.compileMemoryAccessOffsetSetup(offset, 1) + if err != nil { + return err + } + c.assembler.CompileRegisterToRegister(arm64.ADD, arm64ReservedRegisterForMemory, offset) + c.assembler.CompileMemoryToVectorRegister(arm64.LD1R, offset, 0, result, arm64.VectorArrangement16B) + case wazeroir.V128LoadType16Splat: + offset, err := c.compileMemoryAccessOffsetSetup(offset, 2) + if err != nil { + return err + } + c.assembler.CompileRegisterToRegister(arm64.ADD, arm64ReservedRegisterForMemory, offset) + c.assembler.CompileMemoryToVectorRegister(arm64.LD1R, offset, 0, result, arm64.VectorArrangement8H) + case wazeroir.V128LoadType32Splat: + offset, err := c.compileMemoryAccessOffsetSetup(offset, 4) + if err != nil { + return err + } + c.assembler.CompileRegisterToRegister(arm64.ADD, arm64ReservedRegisterForMemory, offset) + c.assembler.CompileMemoryToVectorRegister(arm64.LD1R, offset, 0, result, arm64.VectorArrangement4S) + case wazeroir.V128LoadType64Splat: + offset, err := c.compileMemoryAccessOffsetSetup(offset, 8) + if err != nil { + return err + } + c.assembler.CompileRegisterToRegister(arm64.ADD, arm64ReservedRegisterForMemory, offset) + c.assembler.CompileMemoryToVectorRegister(arm64.LD1R, offset, 0, result, arm64.VectorArrangement2D) + case wazeroir.V128LoadType32zero: + offset, err := c.compileMemoryAccessOffsetSetup(offset, 4) + if err != nil { + return err + } + c.assembler.CompileMemoryWithRegisterOffsetToVectorRegister(arm64.VMOV, + arm64ReservedRegisterForMemory, offset, result, arm64.VectorArrangementS, + ) + case wazeroir.V128LoadType64zero: + offset, err := c.compileMemoryAccessOffsetSetup(offset, 8) + if err != nil { + return err + } + c.assembler.CompileMemoryWithRegisterOffsetToVectorRegister(arm64.VMOV, + arm64ReservedRegisterForMemory, offset, result, arm64.VectorArrangementD, + ) + } + + c.pushVectorRuntimeValueLocationOnRegister(result) + return +} + +// compileV128LoadLane implements compiler.compileV128LoadLane for arm64. +func (c *arm64Compiler) compileV128LoadLane(o *wazeroir.UnionOperation) (err error) { + targetVector := c.locationStack.popV128() + if err = c.compileEnsureOnRegister(targetVector); err != nil { + return + } + + laneSize, laneIndex := o.B1, o.B2 + offset := uint32(o.U2) + + targetSizeInBytes := int64(laneSize / 8) + source, err := c.compileMemoryAccessOffsetSetup(offset, targetSizeInBytes) + if err != nil { + return err + } + + var loadInst asm.Instruction + var arr arm64.VectorArrangement + switch laneSize { + case 8: + arr = arm64.VectorArrangementB + loadInst = arm64.LDRB + case 16: + arr = arm64.VectorArrangementH + loadInst = arm64.LDRH + case 32: + loadInst = arm64.LDRW + arr = arm64.VectorArrangementS + case 64: + loadInst = arm64.LDRD + arr = arm64.VectorArrangementD + } + + c.assembler.CompileMemoryWithRegisterOffsetToRegister(loadInst, arm64ReservedRegisterForMemory, source, source) + c.assembler.CompileRegisterToVectorRegister(arm64.INSGEN, source, targetVector.register, arr, arm64.VectorIndex(laneIndex)) + + c.pushVectorRuntimeValueLocationOnRegister(targetVector.register) + c.locationStack.markRegisterUnused(source) + return +} + +// compileV128Store implements compiler.compileV128Store for arm64. +func (c *arm64Compiler) compileV128Store(o *wazeroir.UnionOperation) (err error) { + v := c.locationStack.popV128() + if err = c.compileEnsureOnRegister(v); err != nil { + return + } + + const targetSizeInBytes = 16 + offset := uint32(o.U2) + offsetReg, err := c.compileMemoryAccessOffsetSetup(offset, targetSizeInBytes) + if err != nil { + return err + } + + c.assembler.CompileVectorRegisterToMemoryWithRegisterOffset(arm64.VMOV, + v.register, arm64ReservedRegisterForMemory, offsetReg, arm64.VectorArrangementQ) + + c.markRegisterUnused(v.register) + return +} + +// compileV128StoreLane implements compiler.compileV128StoreLane for arm64. +func (c *arm64Compiler) compileV128StoreLane(o *wazeroir.UnionOperation) (err error) { + var arr arm64.VectorArrangement + var storeInst asm.Instruction + laneSize := o.B1 + laneIndex := o.B2 + offset := uint32(o.U2) + switch laneSize { + case 8: + storeInst = arm64.STRB + arr = arm64.VectorArrangementB + case 16: + storeInst = arm64.STRH + arr = arm64.VectorArrangementH + case 32: + storeInst = arm64.STRW + arr = arm64.VectorArrangementS + case 64: + storeInst = arm64.STRD + arr = arm64.VectorArrangementD + } + + v := c.locationStack.popV128() + if err = c.compileEnsureOnRegister(v); err != nil { + return + } + + targetSizeInBytes := int64(laneSize / 8) + offsetReg, err := c.compileMemoryAccessOffsetSetup(offset, targetSizeInBytes) + if err != nil { + return err + } + + c.assembler.CompileVectorRegisterToRegister(arm64.UMOV, v.register, arm64ReservedRegisterForTemporary, arr, + arm64.VectorIndex(laneIndex)) + + c.assembler.CompileRegisterToMemoryWithRegisterOffset(storeInst, + arm64ReservedRegisterForTemporary, arm64ReservedRegisterForMemory, offsetReg) + + c.locationStack.markRegisterUnused(v.register) + return +} + +// compileV128ExtractLane implements compiler.compileV128ExtractLane for arm64. +func (c *arm64Compiler) compileV128ExtractLane(o *wazeroir.UnionOperation) (err error) { + v := c.locationStack.popV128() + if err = c.compileEnsureOnRegister(v); err != nil { + return + } + + shape := o.B1 + laneIndex := o.B2 + signed := o.B3 + switch shape { + case wazeroir.ShapeI8x16: + result, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + var inst asm.Instruction + if signed { + inst = arm64.SMOV32 + } else { + inst = arm64.UMOV + } + c.assembler.CompileVectorRegisterToRegister(inst, v.register, result, + arm64.VectorArrangementB, arm64.VectorIndex(laneIndex)) + + c.locationStack.markRegisterUnused(v.register) + c.pushRuntimeValueLocationOnRegister(result, runtimeValueTypeI32) + case wazeroir.ShapeI16x8: + result, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + var inst asm.Instruction + if signed { + inst = arm64.SMOV32 + } else { + inst = arm64.UMOV + } + c.assembler.CompileVectorRegisterToRegister(inst, v.register, result, + arm64.VectorArrangementH, arm64.VectorIndex(laneIndex)) + + c.locationStack.markRegisterUnused(v.register) + c.pushRuntimeValueLocationOnRegister(result, runtimeValueTypeI32) + case wazeroir.ShapeI32x4: + result, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.assembler.CompileVectorRegisterToRegister(arm64.UMOV, v.register, result, + arm64.VectorArrangementS, arm64.VectorIndex(laneIndex)) + + c.locationStack.markRegisterUnused(v.register) + c.pushRuntimeValueLocationOnRegister(result, runtimeValueTypeI32) + case wazeroir.ShapeI64x2: + result, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + c.assembler.CompileVectorRegisterToRegister(arm64.UMOV, v.register, result, + arm64.VectorArrangementD, arm64.VectorIndex(laneIndex)) + + c.locationStack.markRegisterUnused(v.register) + c.pushRuntimeValueLocationOnRegister(result, runtimeValueTypeI64) + case wazeroir.ShapeF32x4: + c.assembler.CompileVectorRegisterToVectorRegister(arm64.INSELEM, v.register, v.register, + arm64.VectorArrangementS, arm64.VectorIndex(laneIndex), 0) + c.pushRuntimeValueLocationOnRegister(v.register, runtimeValueTypeF32) + case wazeroir.ShapeF64x2: + c.assembler.CompileVectorRegisterToVectorRegister(arm64.INSELEM, v.register, v.register, + arm64.VectorArrangementD, arm64.VectorIndex(laneIndex), 0) + c.pushRuntimeValueLocationOnRegister(v.register, runtimeValueTypeF64) + } + return +} + +// compileV128ReplaceLane implements compiler.compileV128ReplaceLane for arm64. +func (c *arm64Compiler) compileV128ReplaceLane(o *wazeroir.UnionOperation) (err error) { + origin := c.locationStack.pop() + if err = c.compileEnsureOnRegister(origin); err != nil { + return + } + + vector := c.locationStack.popV128() + if err = c.compileEnsureOnRegister(vector); err != nil { + return + } + + shape := o.B1 + laneIndex := o.B2 + switch shape { + case wazeroir.ShapeI8x16: + c.assembler.CompileRegisterToVectorRegister(arm64.INSGEN, origin.register, vector.register, + arm64.VectorArrangementB, arm64.VectorIndex(laneIndex)) + case wazeroir.ShapeI16x8: + c.assembler.CompileRegisterToVectorRegister(arm64.INSGEN, origin.register, vector.register, + arm64.VectorArrangementH, arm64.VectorIndex(laneIndex)) + case wazeroir.ShapeI32x4: + c.assembler.CompileRegisterToVectorRegister(arm64.INSGEN, origin.register, vector.register, + arm64.VectorArrangementS, arm64.VectorIndex(laneIndex)) + case wazeroir.ShapeI64x2: + c.assembler.CompileRegisterToVectorRegister(arm64.INSGEN, origin.register, vector.register, + arm64.VectorArrangementD, arm64.VectorIndex(laneIndex)) + case wazeroir.ShapeF32x4: + c.assembler.CompileVectorRegisterToVectorRegister(arm64.INSELEM, origin.register, vector.register, + arm64.VectorArrangementS, 0, arm64.VectorIndex(laneIndex)) + case wazeroir.ShapeF64x2: + c.assembler.CompileVectorRegisterToVectorRegister(arm64.INSELEM, origin.register, vector.register, + arm64.VectorArrangementD, 0, arm64.VectorIndex(laneIndex)) + } + + c.locationStack.markRegisterUnused(origin.register) + c.pushVectorRuntimeValueLocationOnRegister(vector.register) + return +} + +// compileV128Splat implements compiler.compileV128Splat for arm64. +func (c *arm64Compiler) compileV128Splat(o *wazeroir.UnionOperation) (err error) { + origin := c.locationStack.pop() + if err = c.compileEnsureOnRegister(origin); err != nil { + return + } + + var result asm.Register + shape := o.B1 + switch shape { + case wazeroir.ShapeI8x16: + result, err = c.allocateRegister(registerTypeVector) + if err != nil { + return + } + c.assembler.CompileRegisterToVectorRegister(arm64.DUPGEN, origin.register, result, + arm64.VectorArrangement16B, arm64.VectorIndexNone) + case wazeroir.ShapeI16x8: + result, err = c.allocateRegister(registerTypeVector) + if err != nil { + return + } + c.assembler.CompileRegisterToVectorRegister(arm64.DUPGEN, origin.register, result, + arm64.VectorArrangement8H, arm64.VectorIndexNone) + case wazeroir.ShapeI32x4: + result, err = c.allocateRegister(registerTypeVector) + if err != nil { + return + } + c.assembler.CompileRegisterToVectorRegister(arm64.DUPGEN, origin.register, result, + arm64.VectorArrangement4S, arm64.VectorIndexNone) + case wazeroir.ShapeI64x2: + result, err = c.allocateRegister(registerTypeVector) + if err != nil { + return + } + c.assembler.CompileRegisterToVectorRegister(arm64.DUPGEN, origin.register, result, + arm64.VectorArrangement2D, arm64.VectorIndexNone) + case wazeroir.ShapeF32x4: + result = origin.register + c.assembler.CompileVectorRegisterToVectorRegister(arm64.DUPELEM, origin.register, result, + arm64.VectorArrangementS, 0, arm64.VectorIndexNone) + case wazeroir.ShapeF64x2: + result = origin.register + c.assembler.CompileVectorRegisterToVectorRegister(arm64.DUPELEM, origin.register, result, + arm64.VectorArrangementD, 0, arm64.VectorIndexNone) + } + + c.locationStack.markRegisterUnused(origin.register) + c.pushVectorRuntimeValueLocationOnRegister(result) + return +} + +func (c *arm64Compiler) onValueReleaseRegisterToStack(reg asm.Register) { + for i := uint64(0); i < c.locationStack.sp; i++ { + prevValue := &c.locationStack.stack[i] + if prevValue.register == reg { + c.compileReleaseRegisterToStack(prevValue) + break + } + } +} + +// compileV128Shuffle implements compiler.compileV128Shuffle for arm64. +func (c *arm64Compiler) compileV128Shuffle(o *wazeroir.UnionOperation) (err error) { + // Shuffle needs two operands (v, w) must be next to each other. + // For simplicity, we use V29 for v and V30 for w values respectively. + const vReg, wReg = arm64.RegV29, arm64.RegV30 + + // Ensures that w value is placed on wReg. + w := c.locationStack.popV128() + if w.register != wReg { + // If wReg is already in use, save the value onto the stack. + c.onValueReleaseRegisterToStack(wReg) + + if w.onRegister() { + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.VORR, + w.register, w.register, wReg, arm64.VectorArrangement16B) + // We no longer use the old register. + c.markRegisterUnused(w.register) + } else { // on stack + w.setRegister(wReg) + c.compileLoadValueOnStackToRegister(w) + } + } + + // Ensures that v value is placed on wReg. + v := c.locationStack.popV128() + if v.register != vReg { + // If vReg is already in use, save the value onto the stack. + c.onValueReleaseRegisterToStack(vReg) + + if v.onRegister() { + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.VORR, + v.register, v.register, vReg, arm64.VectorArrangement16B) + // We no longer use the old register. + c.markRegisterUnused(v.register) + } else { // on stack + v.setRegister(vReg) + c.compileLoadValueOnStackToRegister(v) + } + } + + c.locationStack.markRegisterUsed(vReg, wReg) + result, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + lanes := make([]byte, len(o.Us)) + for i, lane := range o.Us { + lanes[i] = byte(lane) + } + c.assembler.CompileStaticConstToVectorRegister(arm64.VMOV, asm.NewStaticConst(lanes), result, arm64.VectorArrangementQ) + c.assembler.CompileVectorRegisterToVectorRegister(arm64.TBL2, vReg, result, arm64.VectorArrangement16B, + arm64.VectorIndexNone, arm64.VectorIndexNone) + + c.locationStack.markRegisterUnused(vReg, wReg) + c.pushVectorRuntimeValueLocationOnRegister(result) + return +} + +// compileV128Swizzle implements compiler.compileV128Swizzle for arm64. +func (c *arm64Compiler) compileV128Swizzle(*wazeroir.UnionOperation) (err error) { + indexVec := c.locationStack.popV128() + if err = c.compileEnsureOnRegister(indexVec); err != nil { + return + } + baseVec := c.locationStack.popV128() + if err = c.compileEnsureOnRegister(baseVec); err != nil { + return + } + + c.assembler.CompileVectorRegisterToVectorRegister(arm64.TBL1, baseVec.register, indexVec.register, + arm64.VectorArrangement16B, arm64.VectorIndexNone, arm64.VectorIndexNone) + + c.markRegisterUnused(baseVec.register) + c.pushVectorRuntimeValueLocationOnRegister(indexVec.register) + return +} + +// compileV128AnyTrue implements compiler.compileV128AnyTrue for arm64. +func (c *arm64Compiler) compileV128AnyTrue(*wazeroir.UnionOperation) (err error) { + vector := c.locationStack.popV128() + if err = c.compileEnsureOnRegister(vector); err != nil { + return + } + + v := vector.register + c.assembler.CompileVectorRegisterToVectorRegister(arm64.UMAXP, v, v, + arm64.VectorArrangement16B, arm64.VectorIndexNone, arm64.VectorIndexNone) + c.assembler.CompileVectorRegisterToRegister(arm64.UMOV, v, arm64ReservedRegisterForTemporary, + arm64.VectorArrangementD, 0) + c.assembler.CompileTwoRegistersToNone(arm64.CMP, arm64.RegRZR, arm64ReservedRegisterForTemporary) + c.locationStack.pushRuntimeValueLocationOnConditionalRegister(arm64.CondNE) + + c.locationStack.markRegisterUnused(v) + return +} + +// compileV128AllTrue implements compiler.compileV128AllTrue for arm64. +func (c *arm64Compiler) compileV128AllTrue(o *wazeroir.UnionOperation) (err error) { + vector := c.locationStack.popV128() + if err = c.compileEnsureOnRegister(vector); err != nil { + return + } + + v := vector.register + shape := o.B1 + if shape == wazeroir.ShapeI64x2 { + c.assembler.CompileVectorRegisterToVectorRegister(arm64.CMEQZERO, arm64.RegRZR, v, + arm64.VectorArrangement2D, arm64.VectorIndexNone, arm64.VectorIndexNone) + c.assembler.CompileVectorRegisterToVectorRegister(arm64.ADDP, v, v, + arm64.VectorArrangement2D, arm64.VectorIndexNone, arm64.VectorIndexNone) + c.assembler.CompileTwoRegistersToNone(arm64.FCMPD, v, v) + c.locationStack.pushRuntimeValueLocationOnConditionalRegister(arm64.CondEQ) + } else { + var arr arm64.VectorArrangement + switch shape { + case wazeroir.ShapeI8x16: + arr = arm64.VectorArrangement16B + case wazeroir.ShapeI16x8: + arr = arm64.VectorArrangement8H + case wazeroir.ShapeI32x4: + arr = arm64.VectorArrangement4S + } + + c.assembler.CompileVectorRegisterToVectorRegister(arm64.UMINV, v, v, + arr, arm64.VectorIndexNone, arm64.VectorIndexNone) + c.assembler.CompileVectorRegisterToRegister(arm64.UMOV, v, arm64ReservedRegisterForTemporary, + arm64.VectorArrangementD, 0) + c.assembler.CompileTwoRegistersToNone(arm64.CMP, arm64.RegRZR, arm64ReservedRegisterForTemporary) + c.locationStack.pushRuntimeValueLocationOnConditionalRegister(arm64.CondNE) + } + c.markRegisterUnused(v) + return +} + +var ( + i8x16BitmaskConst = [16]byte{ + 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, + 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, + } + i16x8BitmaskConst = [16]byte{ + 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08, 0x00, + 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80, 0x00, + } + i32x4BitmaskConst = [16]byte{ + 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + } +) + +// compileV128BitMask implements compiler.compileV128BitMask for arm64. +func (c *arm64Compiler) compileV128BitMask(o *wazeroir.UnionOperation) (err error) { + vector := c.locationStack.popV128() + if err = c.compileEnsureOnRegister(vector); err != nil { + return + } + + v := vector.register + + result, err := c.allocateRegister(registerTypeGeneralPurpose) + if err != nil { + return err + } + + shape := o.B1 + switch shape { + case wazeroir.ShapeI8x16: + vecTmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + // Right arithmetic shift on the original vector and store the result into vecTmp. So we have: + // v[i] = 0xff if vi<0, 0 otherwise. + c.assembler.CompileVectorRegisterToVectorRegisterWithConst(arm64.SSHR, v, v, arm64.VectorArrangement16B, 7) + + // Load the bit mask into vecTmp. + c.assembler.CompileStaticConstToVectorRegister(arm64.VMOV, asm.NewStaticConst(i8x16BitmaskConst[:]), vecTmp, arm64.VectorArrangementQ) + + // Lane-wise logical AND with i8x16BitmaskConst, meaning that we have + // v[i] = (1 << i) if vi<0, 0 otherwise. + // + // Below, we use the following notation: + // wi := (1 << i) if vi<0, 0 otherwise. + c.assembler.CompileVectorRegisterToVectorRegister(arm64.VAND, vecTmp, v, arm64.VectorArrangement16B, + arm64.VectorIndexNone, arm64.VectorIndexNone) + + // Swap the lower and higher 8 byte elements, and write it into vecTmp, meaning that we have + // vecTmp[i] = w(i+8) if i < 8, w(i-8) otherwise. + // + c.assembler.CompileTwoVectorRegistersToVectorRegisterWithConst(arm64.EXT, v, v, vecTmp, arm64.VectorArrangement16B, 0x8) + + // v = [w0, w8, ..., w7, w15] + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.ZIP1, vecTmp, v, v, arm64.VectorArrangement16B) + + // v.h[0] = w0 + ... + w15 + c.assembler.CompileVectorRegisterToVectorRegister(arm64.ADDV, v, v, + arm64.VectorArrangement8H, arm64.VectorIndexNone, arm64.VectorIndexNone) + + // Extract the v.h[0] as the result. + c.assembler.CompileVectorRegisterToRegister(arm64.UMOV, v, result, arm64.VectorArrangementH, 0) + case wazeroir.ShapeI16x8: + vecTmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + // Right arithmetic shift on the original vector and store the result into vecTmp. So we have: + // v[i] = 0xffff if vi<0, 0 otherwise. + c.assembler.CompileVectorRegisterToVectorRegisterWithConst(arm64.SSHR, v, v, arm64.VectorArrangement8H, 15) + + // Load the bit mask into vecTmp. + c.assembler.CompileStaticConstToVectorRegister(arm64.VMOV, asm.NewStaticConst(i16x8BitmaskConst[:]), vecTmp, arm64.VectorArrangementQ) + + // Lane-wise logical AND with i16x8BitmaskConst, meaning that we have + // v[i] = (1 << i) if vi<0, 0 otherwise for i=0..3 + // = (1 << (i+4)) if vi<0, 0 otherwise for i=3..7 + c.assembler.CompileVectorRegisterToVectorRegister(arm64.VAND, vecTmp, v, arm64.VectorArrangement16B, + arm64.VectorIndexNone, arm64.VectorIndexNone) + + c.assembler.CompileVectorRegisterToVectorRegister(arm64.ADDV, v, v, + arm64.VectorArrangement8H, arm64.VectorIndexNone, arm64.VectorIndexNone) + + c.assembler.CompileVectorRegisterToRegister(arm64.UMOV, v, result, arm64.VectorArrangementH, 0) + case wazeroir.ShapeI32x4: + vecTmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + // Right arithmetic shift on the original vector and store the result into vecTmp. So we have: + // v[i] = 0xffffffff if vi<0, 0 otherwise. + c.assembler.CompileVectorRegisterToVectorRegisterWithConst(arm64.SSHR, v, v, arm64.VectorArrangement4S, 32) + + // Load the bit mask into vecTmp. + c.assembler.CompileStaticConstToVectorRegister(arm64.VMOV, + asm.NewStaticConst(i32x4BitmaskConst[:]), vecTmp, arm64.VectorArrangementQ) + + // Lane-wise logical AND with i16x8BitmaskConst, meaning that we have + // v[i] = (1 << i) if vi<0, 0 otherwise for i in [0, 1] + // = (1 << (i+4)) if vi<0, 0 otherwise for i in [2, 3] + c.assembler.CompileVectorRegisterToVectorRegister(arm64.VAND, vecTmp, v, arm64.VectorArrangement16B, + arm64.VectorIndexNone, arm64.VectorIndexNone) + + c.assembler.CompileVectorRegisterToVectorRegister(arm64.ADDV, v, v, + arm64.VectorArrangement4S, arm64.VectorIndexNone, arm64.VectorIndexNone) + + c.assembler.CompileVectorRegisterToRegister(arm64.UMOV, v, result, arm64.VectorArrangementS, 0) + case wazeroir.ShapeI64x2: + // Move the lower 64-bit int into result, + c.assembler.CompileVectorRegisterToRegister(arm64.UMOV, v, result, + arm64.VectorArrangementD, 0) + // Move the higher 64-bit int into arm64ReservedRegisterForTemporary. + c.assembler.CompileVectorRegisterToRegister(arm64.UMOV, v, arm64ReservedRegisterForTemporary, + arm64.VectorArrangementD, 1) + + // Move the sign bit into the least significant bit. + c.assembler.CompileConstToRegister(arm64.LSR, 63, result) + c.assembler.CompileConstToRegister(arm64.LSR, 63, arm64ReservedRegisterForTemporary) + + // result = (arm64ReservedRegisterForTemporary<<1) | result + c.assembler.CompileLeftShiftedRegisterToRegister(arm64.ADD, + arm64ReservedRegisterForTemporary, 1, result, result) + } + + c.markRegisterUnused(v) + c.pushRuntimeValueLocationOnRegister(result, runtimeValueTypeI32) + return +} + +// compileV128And implements compiler.compileV128And for arm64. +func (c *arm64Compiler) compileV128And(*wazeroir.UnionOperation) error { + return c.compileV128x2BinOp(arm64.VAND, arm64.VectorArrangement16B) +} + +// compileV128Not implements compiler.compileV128Not for arm64. +func (c *arm64Compiler) compileV128Not(*wazeroir.UnionOperation) error { + return c.compileV128UniOp(arm64.NOT, arm64.VectorArrangement16B) +} + +// compileV128Or implements compiler.compileV128Or for arm64. +func (c *arm64Compiler) compileV128Or(*wazeroir.UnionOperation) error { + return c.compileV128x2BinOp(arm64.VORR, arm64.VectorArrangement16B) +} + +// compileV128Xor implements compiler.compileV128Xor for arm64. +func (c *arm64Compiler) compileV128Xor(*wazeroir.UnionOperation) error { + return c.compileV128x2BinOp(arm64.EOR, arm64.VectorArrangement16B) +} + +// compileV128Bitselect implements compiler.compileV128Bitselect for arm64. +func (c *arm64Compiler) compileV128Bitselect(*wazeroir.UnionOperation) error { + selector := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(selector); err != nil { + return err + } + + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.BSL, + x2.register, x1.register, selector.register, arm64.VectorArrangement16B) + + c.markRegisterUnused(x1.register, x2.register) + c.pushVectorRuntimeValueLocationOnRegister(selector.register) + return nil +} + +// compileV128AndNot implements compiler.compileV128AndNot for arm64. +func (c *arm64Compiler) compileV128AndNot(*wazeroir.UnionOperation) error { + return c.compileV128x2BinOp(arm64.BIC, arm64.VectorArrangement16B) +} + +func (c *arm64Compiler) compileV128UniOp(inst asm.Instruction, arr arm64.VectorArrangement) error { + v := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + + c.assembler.CompileVectorRegisterToVectorRegister(inst, v.register, v.register, arr, arm64.VectorIndexNone, arm64.VectorIndexNone) + + c.pushVectorRuntimeValueLocationOnRegister(v.register) + return nil +} + +func (c *arm64Compiler) compileV128x2BinOp(inst asm.Instruction, arr arm64.VectorArrangement) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + c.assembler.CompileVectorRegisterToVectorRegister(inst, x2.register, x1.register, arr, arm64.VectorIndexNone, arm64.VectorIndexNone) + + c.markRegisterUnused(x2.register) + c.pushVectorRuntimeValueLocationOnRegister(x1.register) + return nil +} + +// compileV128Shr implements compiler.compileV128Shr for arm64. +func (c *arm64Compiler) compileV128Shr(o *wazeroir.UnionOperation) error { + var inst asm.Instruction + shape := o.B1 + signed := o.B3 + if signed { + inst = arm64.SSHL + } else { + inst = arm64.USHL + } + return c.compileV128ShiftImpl(shape, inst, true) +} + +// compileV128Shl implements compiler.compileV128Shl for arm64. +func (c *arm64Compiler) compileV128Shl(o *wazeroir.UnionOperation) error { + return c.compileV128ShiftImpl(o.B1 /*shape*/, arm64.SSHL, false) +} + +func (c *arm64Compiler) compileV128ShiftImpl(shape wazeroir.Shape, ins asm.Instruction, rightShift bool) error { + s := c.locationStack.pop() + if s.register == arm64.RegRZR { + // If the shift amount is zero register, nothing to do here. + return nil + } + + var modulo asm.ConstantValue + var arr arm64.VectorArrangement + switch shape { + case wazeroir.ShapeI8x16: + modulo = 0x7 // modulo 8. + arr = arm64.VectorArrangement16B + case wazeroir.ShapeI16x8: + modulo = 0xf // modulo 16. + arr = arm64.VectorArrangement8H + case wazeroir.ShapeI32x4: + modulo = 0x1f // modulo 32. + arr = arm64.VectorArrangement4S + case wazeroir.ShapeI64x2: + modulo = 0x3f // modulo 64. + arr = arm64.VectorArrangement2D + } + + if err := c.compileEnsureOnRegister(s); err != nil { + return err + } + + v := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(v); err != nil { + return err + } + + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + c.assembler.CompileConstToRegister(arm64.ANDIMM32, modulo, s.register) + + if rightShift { + // Negate the amount to make this as right shift. + c.assembler.CompileRegisterToRegister(arm64.NEG, s.register, s.register) + } + + // Copy the shift amount into a vector register as SSHL requires it to be there. + c.assembler.CompileRegisterToVectorRegister(arm64.DUPGEN, s.register, tmp, + arr, arm64.VectorIndexNone) + + c.assembler.CompileVectorRegisterToVectorRegister(ins, tmp, v.register, arr, + arm64.VectorIndexNone, arm64.VectorIndexNone) + + c.markRegisterUnused(s.register) + c.pushVectorRuntimeValueLocationOnRegister(v.register) + return nil +} + +// compileV128Cmp implements compiler.compileV128Cmp for arm64. +func (c *arm64Compiler) compileV128Cmp(o *wazeroir.UnionOperation) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + var arr arm64.VectorArrangement + v128CmpType := o.B1 + if v128CmpType <= wazeroir.V128CmpTypeI8x16GeU { + arr = arm64.VectorArrangement16B + } else if v128CmpType <= wazeroir.V128CmpTypeI16x8GeU { + arr = arm64.VectorArrangement8H + } else if v128CmpType <= wazeroir.V128CmpTypeI32x4GeU { + arr = arm64.VectorArrangement4S + } else if v128CmpType <= wazeroir.V128CmpTypeI64x2GeS { + arr = arm64.VectorArrangement2D + } else if v128CmpType <= wazeroir.V128CmpTypeF32x4Ge { + arr = arm64.VectorArrangement4S + } else { // f64x2 + arr = arm64.VectorArrangement2D + } + + result := x1.register + switch v128CmpType { + case wazeroir.V128CmpTypeI8x16Eq, wazeroir.V128CmpTypeI16x8Eq, wazeroir.V128CmpTypeI32x4Eq, wazeroir.V128CmpTypeI64x2Eq: + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.CMEQ, x1.register, x2.register, result, arr) + case wazeroir.V128CmpTypeI8x16Ne, wazeroir.V128CmpTypeI16x8Ne, wazeroir.V128CmpTypeI32x4Ne, wazeroir.V128CmpTypeI64x2Ne: + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.CMEQ, x1.register, x2.register, result, arr) + // Reverse the condition by flipping all bits. + c.assembler.CompileVectorRegisterToVectorRegister(arm64.NOT, result, result, + arm64.VectorArrangement16B, arm64.VectorIndexNone, arm64.VectorIndexNone) + case wazeroir.V128CmpTypeI8x16LtS, wazeroir.V128CmpTypeI16x8LtS, wazeroir.V128CmpTypeI32x4LtS, wazeroir.V128CmpTypeI64x2LtS: + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.CMGT, x1.register, x2.register, result, arr) + case wazeroir.V128CmpTypeI8x16LtU, wazeroir.V128CmpTypeI16x8LtU, wazeroir.V128CmpTypeI32x4LtU: + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.CMHI, x1.register, x2.register, result, arr) + case wazeroir.V128CmpTypeI8x16GtS, wazeroir.V128CmpTypeI16x8GtS, wazeroir.V128CmpTypeI32x4GtS, wazeroir.V128CmpTypeI64x2GtS: + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.CMGT, x2.register, x1.register, result, arr) + case wazeroir.V128CmpTypeI8x16GtU, wazeroir.V128CmpTypeI16x8GtU, wazeroir.V128CmpTypeI32x4GtU: + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.CMHI, x2.register, x1.register, result, arr) + case wazeroir.V128CmpTypeI8x16LeS, wazeroir.V128CmpTypeI16x8LeS, wazeroir.V128CmpTypeI32x4LeS, wazeroir.V128CmpTypeI64x2LeS: + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.CMGE, x1.register, x2.register, result, arr) + case wazeroir.V128CmpTypeI8x16LeU, wazeroir.V128CmpTypeI16x8LeU, wazeroir.V128CmpTypeI32x4LeU: + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.CMHS, x1.register, x2.register, result, arr) + case wazeroir.V128CmpTypeI8x16GeS, wazeroir.V128CmpTypeI16x8GeS, wazeroir.V128CmpTypeI32x4GeS, wazeroir.V128CmpTypeI64x2GeS: + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.CMGE, x2.register, x1.register, result, arr) + case wazeroir.V128CmpTypeI8x16GeU, wazeroir.V128CmpTypeI16x8GeU, wazeroir.V128CmpTypeI32x4GeU: + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.CMHS, x2.register, x1.register, result, arr) + case wazeroir.V128CmpTypeF32x4Eq, wazeroir.V128CmpTypeF64x2Eq: + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.FCMEQ, x2.register, x1.register, result, arr) + case wazeroir.V128CmpTypeF32x4Ne, wazeroir.V128CmpTypeF64x2Ne: + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.FCMEQ, x2.register, x1.register, result, arr) + // Reverse the condition by flipping all bits. + c.assembler.CompileVectorRegisterToVectorRegister(arm64.NOT, result, result, + arm64.VectorArrangement16B, arm64.VectorIndexNone, arm64.VectorIndexNone) + case wazeroir.V128CmpTypeF32x4Lt, wazeroir.V128CmpTypeF64x2Lt: + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.FCMGT, x1.register, x2.register, result, arr) + case wazeroir.V128CmpTypeF32x4Le, wazeroir.V128CmpTypeF64x2Le: + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.FCMGE, x1.register, x2.register, result, arr) + case wazeroir.V128CmpTypeF32x4Gt, wazeroir.V128CmpTypeF64x2Gt: + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.FCMGT, x2.register, x1.register, result, arr) + case wazeroir.V128CmpTypeF32x4Ge, wazeroir.V128CmpTypeF64x2Ge: + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.FCMGE, x2.register, x1.register, result, arr) + } + + c.markRegisterUnused(x2.register) + c.pushVectorRuntimeValueLocationOnRegister(result) + return nil +} + +// compileV128AddSat implements compiler.compileV128AddSat for arm64. +func (c *arm64Compiler) compileV128AddSat(o *wazeroir.UnionOperation) error { + var inst asm.Instruction + shape := o.B1 + signed := o.B3 + if signed { + inst = arm64.VSQADD + } else { + inst = arm64.VUQADD + } + return c.compileV128x2BinOp(inst, defaultArrangementForShape(shape)) +} + +// compileV128SubSat implements compiler.compileV128SubSat for arm64. +func (c *arm64Compiler) compileV128SubSat(o *wazeroir.UnionOperation) error { + var inst asm.Instruction + shape := o.B1 + signed := o.B3 + if signed { + inst = arm64.VSQSUB + } else { + inst = arm64.VUQSUB + } + return c.compileV128x2BinOp(inst, defaultArrangementForShape(shape)) +} + +// compileV128Mul implements compiler.compileV128Mul for arm64. +func (c *arm64Compiler) compileV128Mul(o *wazeroir.UnionOperation) (err error) { + shape := o.B1 + switch shape { + case wazeroir.ShapeI8x16, wazeroir.ShapeI16x8, wazeroir.ShapeI32x4: + err = c.compileV128x2BinOp(arm64.VMUL, defaultArrangementForShape(shape)) + case wazeroir.ShapeF32x4, wazeroir.ShapeF64x2: + err = c.compileV128x2BinOp(arm64.VFMUL, defaultArrangementForShape(shape)) + case wazeroir.ShapeI64x2: + x2 := c.locationStack.popV128() + if err = c.compileEnsureOnRegister(x2); err != nil { + return + } + + x1 := c.locationStack.popV128() + if err = c.compileEnsureOnRegister(x1); err != nil { + return + } + + src1, src2 := x1.register, x2.register + + tmp1, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + c.markRegisterUsed(tmp1) + + tmp2, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + c.markRegisterUsed(tmp2) + + tmp3, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + // Following the algorithm in https://chromium-review.googlesource.com/c/v8/v8/+/1781696 + c.assembler.CompileVectorRegisterToVectorRegister(arm64.REV64, src2, tmp2, + arm64.VectorArrangement4S, arm64.VectorIndexNone, arm64.VectorIndexNone) + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.VMUL, src1, tmp2, tmp2, arm64.VectorArrangement4S) + + c.assembler.CompileVectorRegisterToVectorRegister(arm64.XTN, src1, tmp1, + arm64.VectorArrangement2D, arm64.VectorIndexNone, arm64.VectorIndexNone) + + c.assembler.CompileVectorRegisterToVectorRegister(arm64.VADDP, tmp2, tmp2, arm64.VectorArrangement4S, + arm64.VectorIndexNone, arm64.VectorIndexNone, + ) + + c.assembler.CompileVectorRegisterToVectorRegister(arm64.XTN, src2, tmp3, + arm64.VectorArrangement2D, arm64.VectorIndexNone, arm64.VectorIndexNone) + + c.assembler.CompileVectorRegisterToVectorRegister(arm64.SHLL, tmp2, src1, + arm64.VectorArrangement2S, arm64.VectorIndexNone, arm64.VectorIndexNone) + + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.VUMLAL, tmp3, tmp1, src1, arm64.VectorArrangement2S) + + c.markRegisterUnused(src2, tmp1, tmp2) + c.pushVectorRuntimeValueLocationOnRegister(src1) + } + return +} + +// compileV128Div implements compiler.compileV128Div for arm64. +func (c *arm64Compiler) compileV128Div(o *wazeroir.UnionOperation) error { + var arr arm64.VectorArrangement + var inst asm.Instruction + shape := o.B1 + switch shape { + case wazeroir.ShapeF32x4: + arr = arm64.VectorArrangement4S + inst = arm64.VFDIV + case wazeroir.ShapeF64x2: + arr = arm64.VectorArrangement2D + inst = arm64.VFDIV + } + return c.compileV128x2BinOp(inst, arr) +} + +// compileV128Neg implements compiler.compileV128Neg for arm64. +func (c *arm64Compiler) compileV128Neg(o *wazeroir.UnionOperation) error { + var inst asm.Instruction + shape := o.B1 + if shape <= wazeroir.ShapeI64x2 { // Integer lanes + inst = arm64.VNEG + } else { // Floating point lanes + inst = arm64.VFNEG + } + return c.compileV128UniOp(inst, defaultArrangementForShape(shape)) +} + +// compileV128Sqrt implements compiler.compileV128Sqrt for arm64. +func (c *arm64Compiler) compileV128Sqrt(o *wazeroir.UnionOperation) error { + var arr arm64.VectorArrangement + shape := o.B1 + switch shape { + case wazeroir.ShapeF32x4: + arr = arm64.VectorArrangement4S + case wazeroir.ShapeF64x2: + arr = arm64.VectorArrangement2D + } + return c.compileV128UniOp(arm64.VFSQRT, arr) +} + +// compileV128Abs implements compiler.compileV128Abs for arm64. +func (c *arm64Compiler) compileV128Abs(o *wazeroir.UnionOperation) error { + var inst asm.Instruction + shape := o.B1 + if shape <= wazeroir.ShapeI64x2 { // Integer lanes + inst = arm64.VABS + } else { // Floating point lanes + inst = arm64.VFABS + } + return c.compileV128UniOp(inst, defaultArrangementForShape(shape)) +} + +// compileV128Popcnt implements compiler.compileV128Popcnt for arm64. +func (c *arm64Compiler) compileV128Popcnt(o *wazeroir.UnionOperation) error { + return c.compileV128UniOp(arm64.VCNT, defaultArrangementForShape(o.B1)) +} + +// compileV128Min implements compiler.compileV128Min for arm64. +func (c *arm64Compiler) compileV128Min(o *wazeroir.UnionOperation) error { + var inst asm.Instruction + shape := o.B1 + signed := o.B3 + if shape <= wazeroir.ShapeI64x2 { // Integer lanes + if signed { + inst = arm64.SMIN + } else { + inst = arm64.UMIN + } + } else { // Floating point lanes + inst = arm64.VFMIN + } + return c.compileV128x2BinOp(inst, defaultArrangementForShape(shape)) +} + +func defaultArrangementForShape(s wazeroir.Shape) (arr arm64.VectorArrangement) { + switch s { + case wazeroir.ShapeI8x16: + arr = arm64.VectorArrangement16B + case wazeroir.ShapeI16x8: + arr = arm64.VectorArrangement8H + case wazeroir.ShapeI32x4: + arr = arm64.VectorArrangement4S + case wazeroir.ShapeI64x2: + arr = arm64.VectorArrangement2D + case wazeroir.ShapeF32x4: + arr = arm64.VectorArrangement4S + case wazeroir.ShapeF64x2: + arr = arm64.VectorArrangement2D + } + return +} + +// compileV128Max implements compiler.compileV128Max for arm64. +func (c *arm64Compiler) compileV128Max(o *wazeroir.UnionOperation) error { + var inst asm.Instruction + shape := o.B1 + signed := o.B3 + if shape <= wazeroir.ShapeI64x2 { // Integer lanes + if signed { + inst = arm64.SMAX + } else { + inst = arm64.UMAX + } + } else { // Floating point lanes + inst = arm64.VFMAX + } + return c.compileV128x2BinOp(inst, defaultArrangementForShape(shape)) +} + +// compileV128AvgrU implements compiler.compileV128AvgrU for arm64. +func (c *arm64Compiler) compileV128AvgrU(o *wazeroir.UnionOperation) error { + return c.compileV128x2BinOp(arm64.URHADD, defaultArrangementForShape(o.B1)) +} + +// compileV128Pmin implements compiler.compileV128Pmin for arm64. +func (c *arm64Compiler) compileV128Pmin(o *wazeroir.UnionOperation) error { + return c.compileV128PseudoMinOrMax(defaultArrangementForShape(o.B1), false) +} + +// compileV128Pmax implements compiler.compileV128Pmax for arm64. +func (c *arm64Compiler) compileV128Pmax(o *wazeroir.UnionOperation) error { + return c.compileV128PseudoMinOrMax(defaultArrangementForShape(o.B1), true) +} + +// compileV128PseudoMinOrMax implements compileV128Pmax and compileV128Pmin. +func (c *arm64Compiler) compileV128PseudoMinOrMax(arr arm64.VectorArrangement, max bool) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + result, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + x1r, x2r := x1.register, x2.register + + // Sets all bits on each lane if x1r's lane satisfies the condition (min or max), zeros otherwise. + if max { + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.FCMGT, x1r, x2r, result, arr) + } else { + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.FCMGT, x2r, x1r, result, arr) + } + // Select each bit based on the result bits ^. + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.BSL, x1r, x2r, result, arm64.VectorArrangement16B) + + c.markRegisterUnused(x1r, x2r) + c.pushVectorRuntimeValueLocationOnRegister(result) + return nil +} + +// compileV128Ceil implements compiler.compileV128Ceil for arm64. +func (c *arm64Compiler) compileV128Ceil(o *wazeroir.UnionOperation) error { + var arr arm64.VectorArrangement + shape := o.B1 + switch shape { + case wazeroir.ShapeF32x4: + arr = arm64.VectorArrangement4S + case wazeroir.ShapeF64x2: + arr = arm64.VectorArrangement2D + } + return c.compileV128UniOp(arm64.VFRINTP, arr) +} + +// compileV128Floor implements compiler.compileV128Floor for arm64. +func (c *arm64Compiler) compileV128Floor(o *wazeroir.UnionOperation) error { + var arr arm64.VectorArrangement + shape := o.B1 + switch shape { + case wazeroir.ShapeF32x4: + arr = arm64.VectorArrangement4S + case wazeroir.ShapeF64x2: + arr = arm64.VectorArrangement2D + } + return c.compileV128UniOp(arm64.VFRINTM, arr) +} + +// compileV128Trunc implements compiler.compileV128Trunc for arm64. +func (c *arm64Compiler) compileV128Trunc(o *wazeroir.UnionOperation) error { + var arr arm64.VectorArrangement + shape := o.B1 + switch shape { + case wazeroir.ShapeF32x4: + arr = arm64.VectorArrangement4S + case wazeroir.ShapeF64x2: + arr = arm64.VectorArrangement2D + } + return c.compileV128UniOp(arm64.VFRINTZ, arr) +} + +// compileV128Nearest implements compiler.compileV128Nearest for arm64. +func (c *arm64Compiler) compileV128Nearest(o *wazeroir.UnionOperation) error { + var arr arm64.VectorArrangement + shape := o.B1 + switch shape { + case wazeroir.ShapeF32x4: + arr = arm64.VectorArrangement4S + case wazeroir.ShapeF64x2: + arr = arm64.VectorArrangement2D + } + return c.compileV128UniOp(arm64.VFRINTN, arr) +} + +// compileV128Extend implements compiler.compileV128Extend for arm64. +func (c *arm64Compiler) compileV128Extend(o *wazeroir.UnionOperation) error { + var inst asm.Instruction + var arr arm64.VectorArrangement + originShape := o.B1 + signed := o.B2 == 1 + useLow := o.B3 + if useLow { + if signed { + inst = arm64.SSHLL + } else { + inst = arm64.USHLL + } + + switch originShape { + case wazeroir.ShapeI8x16: + arr = arm64.VectorArrangement8B + case wazeroir.ShapeI16x8: + arr = arm64.VectorArrangement4H + case wazeroir.ShapeI32x4: + arr = arm64.VectorArrangement2S + } + } else { + if signed { + inst = arm64.SSHLL2 + } else { + inst = arm64.USHLL2 + } + arr = defaultArrangementForShape(originShape) + } + + return c.compileV128UniOp(inst, arr) +} + +// compileV128ExtMul implements compiler.compileV128ExtMul for arm64. +func (c *arm64Compiler) compileV128ExtMul(o *wazeroir.UnionOperation) error { + var inst asm.Instruction + var arr arm64.VectorArrangement + originShape := o.B1 + signed := o.B2 == 1 + useLow := o.B3 + if useLow { + if signed { + inst = arm64.SMULL + } else { + inst = arm64.UMULL + } + + switch originShape { + case wazeroir.ShapeI8x16: + arr = arm64.VectorArrangement8B + case wazeroir.ShapeI16x8: + arr = arm64.VectorArrangement4H + case wazeroir.ShapeI32x4: + arr = arm64.VectorArrangement2S + } + } else { + if signed { + inst = arm64.SMULL2 + } else { + inst = arm64.UMULL2 + } + arr = defaultArrangementForShape(originShape) + } + + return c.compileV128x2BinOp(inst, arr) +} + +// compileV128Q15mulrSatS implements compiler.compileV128Q15mulrSatS for arm64. +func (c *arm64Compiler) compileV128Q15mulrSatS(*wazeroir.UnionOperation) error { + return c.compileV128x2BinOp(arm64.SQRDMULH, arm64.VectorArrangement8H) +} + +// compileV128ExtAddPairwise implements compiler.compileV128ExtAddPairwise for arm64. +func (c *arm64Compiler) compileV128ExtAddPairwise(o *wazeroir.UnionOperation) error { + var inst asm.Instruction + originShape := o.B1 + signed := o.B3 + if signed { + inst = arm64.SADDLP + } else { + inst = arm64.UADDLP + } + return c.compileV128UniOp(inst, defaultArrangementForShape(originShape)) +} + +// compileV128FloatPromote implements compiler.compileV128FloatPromote for arm64. +func (c *arm64Compiler) compileV128FloatPromote(*wazeroir.UnionOperation) error { + return c.compileV128UniOp(arm64.FCVTL, arm64.VectorArrangement2S) +} + +// compileV128FloatDemote implements compiler.compileV128FloatDemote for arm64. +func (c *arm64Compiler) compileV128FloatDemote(*wazeroir.UnionOperation) error { + return c.compileV128UniOp(arm64.FCVTN, arm64.VectorArrangement2S) +} + +// compileV128FConvertFromI implements compiler.compileV128FConvertFromI for arm64. +func (c *arm64Compiler) compileV128FConvertFromI(o *wazeroir.UnionOperation) (err error) { + destinationShape := o.B1 + signed := o.B3 + + if destinationShape == wazeroir.ShapeF32x4 { + if signed { + err = c.compileV128UniOp(arm64.VSCVTF, defaultArrangementForShape(destinationShape)) + } else { + err = c.compileV128UniOp(arm64.VUCVTF, defaultArrangementForShape(destinationShape)) + } + return + } else { // f64x2 + v := c.locationStack.popV128() + if err = c.compileEnsureOnRegister(v); err != nil { + return + } + vr := v.register + + var expand, convert asm.Instruction + if signed { + expand, convert = arm64.SSHLL, arm64.VSCVTF + } else { + expand, convert = arm64.USHLL, arm64.VUCVTF + } + + // Expand lower two 32-bit lanes as two 64-bit lanes. + c.assembler.CompileVectorRegisterToVectorRegisterWithConst(expand, vr, vr, arm64.VectorArrangement2S, 0) + // Convert these two 64-bit (integer) values on each lane as double precision values. + c.assembler.CompileVectorRegisterToVectorRegister(convert, vr, vr, arm64.VectorArrangement2D, + arm64.VectorIndexNone, arm64.VectorIndexNone) + c.pushVectorRuntimeValueLocationOnRegister(vr) + } + return +} + +// compileV128Dot implements compiler.compileV128Dot for arm64. +func (c *arm64Compiler) compileV128Dot(*wazeroir.UnionOperation) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + tmp, err := c.allocateRegister(registerTypeVector) + if err != nil { + return err + } + + x1r, x2r := x1.register, x2.register + + // Multiply lower integers and get the 32-bit results into tmp. + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.SMULL, x1r, x2r, tmp, arm64.VectorArrangement4H) + // Multiply higher integers and get the 32-bit results into x1r. + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.SMULL2, x1r, x2r, x1r, arm64.VectorArrangement8H) + // Adds these two results into x1r. + c.assembler.CompileTwoVectorRegistersToVectorRegister(arm64.VADDP, x1r, tmp, x1r, arm64.VectorArrangement4S) + + c.markRegisterUnused(x2r) + c.pushVectorRuntimeValueLocationOnRegister(x1r) + + return nil +} + +// compileV128Narrow implements compiler.compileV128Narrow for arm64. +func (c *arm64Compiler) compileV128Narrow(o *wazeroir.UnionOperation) error { + x2 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x2); err != nil { + return err + } + + x1 := c.locationStack.popV128() + if err := c.compileEnsureOnRegister(x1); err != nil { + return err + } + + x1r, x2r := x1.register, x2.register + + var arr, arr2 arm64.VectorArrangement + originShape := o.B1 + signed := o.B3 + switch originShape { + case wazeroir.ShapeI16x8: + arr = arm64.VectorArrangement8B + arr2 = arm64.VectorArrangement16B + case wazeroir.ShapeI32x4: + arr = arm64.VectorArrangement4H + arr2 = arm64.VectorArrangement8H + } + + var lo, hi asm.Instruction + if signed { + lo, hi = arm64.SQXTN, arm64.SQXTN2 + } else { + lo, hi = arm64.SQXTUN, arm64.SQXTUN2 + } + + // Narrow lanes on x1r and write them into lower-half of x1r. + c.assembler.CompileVectorRegisterToVectorRegister(lo, x1r, x1r, arr, arm64.VectorIndexNone, arm64.VectorIndexNone) + // Narrow lanes on x2r and write them into higher-half of x1r. + c.assembler.CompileVectorRegisterToVectorRegister(hi, x2r, x1r, arr2, arm64.VectorIndexNone, arm64.VectorIndexNone) + + c.markRegisterUnused(x2r) + c.pushVectorRuntimeValueLocationOnRegister(x1r) + return nil +} + +// compileV128ITruncSatFromF implements compiler.compileV128ITruncSatFromF for arm64. +func (c *arm64Compiler) compileV128ITruncSatFromF(o *wazeroir.UnionOperation) (err error) { + v := c.locationStack.popV128() + if err = c.compileEnsureOnRegister(v); err != nil { + return err + } + + originShape := o.B1 + signed := o.B3 + var cvt asm.Instruction + if signed { + cvt = arm64.VFCVTZS + } else { + cvt = arm64.VFCVTZU + } + + c.assembler.CompileVectorRegisterToVectorRegister(cvt, v.register, v.register, + defaultArrangementForShape(originShape), arm64.VectorIndexNone, arm64.VectorIndexNone, + ) + + if originShape == wazeroir.ShapeF64x2 { + var narrow asm.Instruction + if signed { + narrow = arm64.SQXTN + } else { + narrow = arm64.UQXTN + } + c.assembler.CompileVectorRegisterToVectorRegister(narrow, v.register, v.register, + arm64.VectorArrangement2S, arm64.VectorIndexNone, arm64.VectorIndexNone, + ) + } + + c.pushVectorRuntimeValueLocationOnRegister(v.register) + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/interpreter/interpreter.go b/vendor/github.com/tetratelabs/wazero/internal/engine/interpreter/interpreter.go new file mode 100644 index 000000000..c60d0584b --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/interpreter/interpreter.go @@ -0,0 +1,4147 @@ +package interpreter + +import ( + "context" + "encoding/binary" + "errors" + "fmt" + "math" + "math/bits" + "sync" + "unsafe" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/experimental" + "github.com/tetratelabs/wazero/internal/filecache" + "github.com/tetratelabs/wazero/internal/internalapi" + "github.com/tetratelabs/wazero/internal/moremath" + "github.com/tetratelabs/wazero/internal/wasm" + "github.com/tetratelabs/wazero/internal/wasmdebug" + "github.com/tetratelabs/wazero/internal/wasmruntime" + "github.com/tetratelabs/wazero/internal/wazeroir" +) + +// callStackCeiling is the maximum WebAssembly call frame stack height. This allows wazero to raise +// wasm.ErrCallStackOverflow instead of overflowing the Go runtime. +// +// The default value should suffice for most use cases. Those wishing to change this can via `go build -ldflags`. +var callStackCeiling = 2000 + +// engine is an interpreter implementation of wasm.Engine +type engine struct { + enabledFeatures api.CoreFeatures + compiledFunctions map[wasm.ModuleID][]compiledFunction // guarded by mutex. + mux sync.RWMutex + // labelAddressResolutionCache is the temporary cache used to map LabelKind -> FrameID -> the index to the body. + labelAddressResolutionCache [wazeroir.LabelKindNum][]uint64 +} + +func NewEngine(_ context.Context, enabledFeatures api.CoreFeatures, _ filecache.Cache) wasm.Engine { + return &engine{ + enabledFeatures: enabledFeatures, + compiledFunctions: map[wasm.ModuleID][]compiledFunction{}, + } +} + +// Close implements the same method as documented on wasm.Engine. +func (e *engine) Close() (err error) { + return +} + +// CompiledModuleCount implements the same method as documented on wasm.Engine. +func (e *engine) CompiledModuleCount() uint32 { + return uint32(len(e.compiledFunctions)) +} + +// DeleteCompiledModule implements the same method as documented on wasm.Engine. +func (e *engine) DeleteCompiledModule(m *wasm.Module) { + e.deleteCompiledFunctions(m) +} + +func (e *engine) deleteCompiledFunctions(module *wasm.Module) { + e.mux.Lock() + defer e.mux.Unlock() + delete(e.compiledFunctions, module.ID) +} + +func (e *engine) addCompiledFunctions(module *wasm.Module, fs []compiledFunction) { + e.mux.Lock() + defer e.mux.Unlock() + e.compiledFunctions[module.ID] = fs +} + +func (e *engine) getCompiledFunctions(module *wasm.Module) (fs []compiledFunction, ok bool) { + e.mux.RLock() + defer e.mux.RUnlock() + fs, ok = e.compiledFunctions[module.ID] + return +} + +// moduleEngine implements wasm.ModuleEngine +type moduleEngine struct { + // codes are the compiled functions in a module instances. + // The index is module instance-scoped. + functions []function + + // parentEngine holds *engine from which this module engine is created from. + parentEngine *engine +} + +// GetGlobalValue implements the same method as documented on wasm.ModuleEngine. +func (e *moduleEngine) GetGlobalValue(wasm.Index) (lo, hi uint64) { + panic("BUG: GetGlobalValue should never be called on interpreter mode") +} + +// OwnsGlobals implements the same method as documented on wasm.ModuleEngine. +func (e *moduleEngine) OwnsGlobals() bool { return false } + +// callEngine holds context per moduleEngine.Call, and shared across all the +// function calls originating from the same moduleEngine.Call execution. +// +// This implements api.Function. +type callEngine struct { + internalapi.WazeroOnlyType + + // stack contains the operands. + // Note that all the values are represented as uint64. + stack []uint64 + + // frames are the function call stack. + frames []*callFrame + + // f is the initial function for this call engine. + f *function + + // stackiterator for Listeners to walk frames and stack. + stackIterator stackIterator +} + +func (e *moduleEngine) newCallEngine(compiled *function) *callEngine { + return &callEngine{f: compiled} +} + +func (ce *callEngine) pushValue(v uint64) { + ce.stack = append(ce.stack, v) +} + +func (ce *callEngine) pushValues(v []uint64) { + ce.stack = append(ce.stack, v...) +} + +func (ce *callEngine) popValue() (v uint64) { + // No need to check stack bound + // as we can assume that all the operations + // are valid thanks to validateFunction + // at module validation phase + // and wazeroir translation + // before compilation. + stackTopIndex := len(ce.stack) - 1 + v = ce.stack[stackTopIndex] + ce.stack = ce.stack[:stackTopIndex] + return +} + +func (ce *callEngine) popValues(v []uint64) { + stackTopIndex := len(ce.stack) - len(v) + copy(v, ce.stack[stackTopIndex:]) + ce.stack = ce.stack[:stackTopIndex] +} + +// peekValues peeks api.ValueType values from the stack and returns them. +func (ce *callEngine) peekValues(count int) []uint64 { + if count == 0 { + return nil + } + stackLen := len(ce.stack) + return ce.stack[stackLen-count : stackLen] +} + +func (ce *callEngine) drop(raw uint64) { + r := wazeroir.InclusiveRangeFromU64(raw) + if r.Start == -1 { + return + } else if r.Start == 0 { + ce.stack = ce.stack[:int32(len(ce.stack))-1-r.End] + } else { + newStack := ce.stack[:int32(len(ce.stack))-1-r.End] + newStack = append(newStack, ce.stack[int32(len(ce.stack))-r.Start:]...) + ce.stack = newStack + } +} + +func (ce *callEngine) pushFrame(frame *callFrame) { + if callStackCeiling <= len(ce.frames) { + panic(wasmruntime.ErrRuntimeStackOverflow) + } + ce.frames = append(ce.frames, frame) +} + +func (ce *callEngine) popFrame() (frame *callFrame) { + // No need to check stack bound as we can assume that all the operations are valid thanks to validateFunction at + // module validation phase and wazeroir translation before compilation. + oneLess := len(ce.frames) - 1 + frame = ce.frames[oneLess] + ce.frames = ce.frames[:oneLess] + return +} + +type callFrame struct { + // pc is the program counter representing the current position in code.body. + pc uint64 + // f is the compiled function used in this function frame. + f *function + // base index in the frame of this function, used to detect the count of + // values on the stack. + base int +} + +type compiledFunction struct { + source *wasm.Module + body []wazeroir.UnionOperation + listener experimental.FunctionListener + offsetsInWasmBinary []uint64 + hostFn interface{} + ensureTermination bool + index wasm.Index +} + +type function struct { + funcType *wasm.FunctionType + moduleInstance *wasm.ModuleInstance + typeID wasm.FunctionTypeID + parent *compiledFunction +} + +// functionFromUintptr resurrects the original *function from the given uintptr +// which comes from either funcref table or OpcodeRefFunc instruction. +func functionFromUintptr(ptr uintptr) *function { + // Wraps ptrs as the double pointer in order to avoid the unsafe access as detected by race detector. + // + // For example, if we have (*function)(unsafe.Pointer(ptr)) instead, then the race detector's "checkptr" + // subroutine wanrs as "checkptr: pointer arithmetic result points to invalid allocation" + // https://github.com/golang/go/blob/1ce7fcf139417d618c2730010ede2afb41664211/src/runtime/checkptr.go#L69 + var wrapped *uintptr = &ptr + return *(**function)(unsafe.Pointer(wrapped)) +} + +// stackIterator implements experimental.StackIterator. +type stackIterator struct { + stack []uint64 + frames []*callFrame + started bool + fn *function + pc uint64 +} + +func (si *stackIterator) reset(stack []uint64, frames []*callFrame, f *function) { + si.fn = f + si.pc = 0 + si.stack = stack + si.frames = frames + si.started = false +} + +func (si *stackIterator) clear() { + si.stack = nil + si.frames = nil + si.started = false + si.fn = nil +} + +// Next implements the same method as documented on experimental.StackIterator. +func (si *stackIterator) Next() bool { + if !si.started { + si.started = true + return true + } + + if len(si.frames) == 0 { + return false + } + + frame := si.frames[len(si.frames)-1] + si.stack = si.stack[:frame.base] + si.fn = frame.f + si.pc = frame.pc + si.frames = si.frames[:len(si.frames)-1] + return true +} + +// Function implements the same method as documented on +// experimental.StackIterator. +func (si *stackIterator) Function() experimental.InternalFunction { + return internalFunction{si.fn} +} + +// ProgramCounter implements the same method as documented on +// experimental.StackIterator. +func (si *stackIterator) ProgramCounter() experimental.ProgramCounter { + return experimental.ProgramCounter(si.pc) +} + +// internalFunction implements experimental.InternalFunction. +type internalFunction struct{ *function } + +// Definition implements the same method as documented on +// experimental.InternalFunction. +func (f internalFunction) Definition() api.FunctionDefinition { + return f.definition() +} + +// SourceOffsetForPC implements the same method as documented on +// experimental.InternalFunction. +func (f internalFunction) SourceOffsetForPC(pc experimental.ProgramCounter) uint64 { + offsetsMap := f.parent.offsetsInWasmBinary + if uint64(pc) < uint64(len(offsetsMap)) { + return offsetsMap[pc] + } + return 0 +} + +// interpreter mode doesn't maintain call frames in the stack, so pass the zero size to the IR. +const callFrameStackSize = 0 + +// CompileModule implements the same method as documented on wasm.Engine. +func (e *engine) CompileModule(_ context.Context, module *wasm.Module, listeners []experimental.FunctionListener, ensureTermination bool) error { + if _, ok := e.getCompiledFunctions(module); ok { // cache hit! + return nil + } + + funcs := make([]compiledFunction, len(module.FunctionSection)) + irCompiler, err := wazeroir.NewCompiler(e.enabledFeatures, callFrameStackSize, module, ensureTermination) + if err != nil { + return err + } + imported := module.ImportFunctionCount + for i := range module.CodeSection { + var lsn experimental.FunctionListener + if i < len(listeners) { + lsn = listeners[i] + } + + compiled := &funcs[i] + // If this is the host function, there's nothing to do as the runtime representation of + // host function in interpreter is its Go function itself as opposed to Wasm functions, + // which need to be compiled down to wazeroir. + if codeSeg := &module.CodeSection[i]; codeSeg.GoFunc != nil { + compiled.hostFn = codeSeg.GoFunc + } else { + ir, err := irCompiler.Next() + if err != nil { + return err + } + err = e.lowerIR(ir, compiled) + if err != nil { + def := module.FunctionDefinition(uint32(i) + module.ImportFunctionCount) + return fmt.Errorf("failed to lower func[%s] to wazeroir: %w", def.DebugName(), err) + } + } + compiled.source = module + compiled.ensureTermination = ensureTermination + compiled.listener = lsn + compiled.index = imported + uint32(i) + } + e.addCompiledFunctions(module, funcs) + return nil +} + +// NewModuleEngine implements the same method as documented on wasm.Engine. +func (e *engine) NewModuleEngine(module *wasm.Module, instance *wasm.ModuleInstance) (wasm.ModuleEngine, error) { + me := &moduleEngine{ + parentEngine: e, + functions: make([]function, len(module.FunctionSection)+int(module.ImportFunctionCount)), + } + + codes, ok := e.getCompiledFunctions(module) + if !ok { + return nil, errors.New("source module must be compiled before instantiation") + } + + for i := range codes { + c := &codes[i] + offset := i + int(module.ImportFunctionCount) + typeIndex := module.FunctionSection[i] + me.functions[offset] = function{ + moduleInstance: instance, + typeID: instance.TypeIDs[typeIndex], + funcType: &module.TypeSection[typeIndex], + parent: c, + } + } + return me, nil +} + +// lowerIR lowers the wazeroir operations to engine friendly struct. +func (e *engine) lowerIR(ir *wazeroir.CompilationResult, ret *compiledFunction) error { + // Copy the body from the result. + ret.body = make([]wazeroir.UnionOperation, len(ir.Operations)) + copy(ret.body, ir.Operations) + // Also copy the offsets if necessary. + if offsets := ir.IROperationSourceOffsetsInWasmBinary; len(offsets) > 0 { + ret.offsetsInWasmBinary = make([]uint64, len(offsets)) + copy(ret.offsetsInWasmBinary, offsets) + } + + // First, we iterate all labels, and resolve the address. + for i := range ret.body { + op := &ret.body[i] + switch op.Kind { + case wazeroir.OperationKindLabel: + label := wazeroir.Label(op.U1) + address := uint64(i) + + kind, fid := label.Kind(), label.FrameID() + frameToAddresses := e.labelAddressResolutionCache[label.Kind()] + // Expand the slice if necessary. + if diff := fid - len(frameToAddresses) + 1; diff > 0 { + for j := 0; j < diff; j++ { + frameToAddresses = append(frameToAddresses, 0) + } + } + frameToAddresses[fid] = address + e.labelAddressResolutionCache[kind] = frameToAddresses + } + } + + // Then resolve the label as the index to the body. + for i := range ret.body { + op := &ret.body[i] + switch op.Kind { + case wazeroir.OperationKindBr: + e.setLabelAddress(&op.U1, wazeroir.Label(op.U1)) + case wazeroir.OperationKindBrIf: + e.setLabelAddress(&op.U1, wazeroir.Label(op.U1)) + e.setLabelAddress(&op.U2, wazeroir.Label(op.U2)) + case wazeroir.OperationKindBrTable: + for j := 0; j < len(op.Us); j += 2 { + target := op.Us[j] + e.setLabelAddress(&op.Us[j], wazeroir.Label(target)) + } + } + } + + // Reuses the slices for the subsequent compilation, so clear the content here. + for i := range e.labelAddressResolutionCache { + e.labelAddressResolutionCache[i] = e.labelAddressResolutionCache[i][:0] + } + return nil +} + +func (e *engine) setLabelAddress(op *uint64, label wazeroir.Label) { + if label.IsReturnTarget() { + // Jmp to the end of the possible binary. + *op = math.MaxUint64 + } else { + *op = e.labelAddressResolutionCache[label.Kind()][label.FrameID()] + } +} + +// ResolveImportedFunction implements wasm.ModuleEngine. +func (e *moduleEngine) ResolveImportedFunction(index, indexInImportedModule wasm.Index, importedModuleEngine wasm.ModuleEngine) { + imported := importedModuleEngine.(*moduleEngine) + e.functions[index] = imported.functions[indexInImportedModule] +} + +// ResolveImportedMemory implements wasm.ModuleEngine. +func (e *moduleEngine) ResolveImportedMemory(wasm.ModuleEngine) {} + +// DoneInstantiation implements wasm.ModuleEngine. +func (e *moduleEngine) DoneInstantiation() {} + +// FunctionInstanceReference implements the same method as documented on wasm.ModuleEngine. +func (e *moduleEngine) FunctionInstanceReference(funcIndex wasm.Index) wasm.Reference { + return uintptr(unsafe.Pointer(&e.functions[funcIndex])) +} + +// NewFunction implements the same method as documented on wasm.ModuleEngine. +func (e *moduleEngine) NewFunction(index wasm.Index) (ce api.Function) { + // Note: The input parameters are pre-validated, so a compiled function is only absent on close. Updates to + // code on close aren't locked, neither is this read. + compiled := &e.functions[index] + return e.newCallEngine(compiled) +} + +// LookupFunction implements the same method as documented on wasm.ModuleEngine. +func (e *moduleEngine) LookupFunction(t *wasm.TableInstance, typeId wasm.FunctionTypeID, tableOffset wasm.Index) (*wasm.ModuleInstance, wasm.Index) { + if tableOffset >= uint32(len(t.References)) { + panic(wasmruntime.ErrRuntimeInvalidTableAccess) + } + rawPtr := t.References[tableOffset] + if rawPtr == 0 { + panic(wasmruntime.ErrRuntimeInvalidTableAccess) + } + + tf := functionFromUintptr(rawPtr) + if tf.typeID != typeId { + panic(wasmruntime.ErrRuntimeIndirectCallTypeMismatch) + } + return tf.moduleInstance, tf.parent.index +} + +// Definition implements the same method as documented on api.Function. +func (ce *callEngine) Definition() api.FunctionDefinition { + return ce.f.definition() +} + +func (f *function) definition() api.FunctionDefinition { + compiled := f.parent + return compiled.source.FunctionDefinition(compiled.index) +} + +// Call implements the same method as documented on api.Function. +func (ce *callEngine) Call(ctx context.Context, params ...uint64) (results []uint64, err error) { + ft := ce.f.funcType + if n := ft.ParamNumInUint64; n != len(params) { + return nil, fmt.Errorf("expected %d params, but passed %d", n, len(params)) + } + return ce.call(ctx, params, nil) +} + +// CallWithStack implements the same method as documented on api.Function. +func (ce *callEngine) CallWithStack(ctx context.Context, stack []uint64) error { + params, results, err := wasm.SplitCallStack(ce.f.funcType, stack) + if err != nil { + return err + } + _, err = ce.call(ctx, params, results) + return err +} + +func (ce *callEngine) call(ctx context.Context, params, results []uint64) (_ []uint64, err error) { + m := ce.f.moduleInstance + if ce.f.parent.ensureTermination { + select { + case <-ctx.Done(): + // If the provided context is already done, close the call context + // and return the error. + m.CloseWithCtxErr(ctx) + return nil, m.FailIfClosed() + default: + } + } + + defer func() { + // If the module closed during the call, and the call didn't err for another reason, set an ExitError. + if err == nil { + err = m.FailIfClosed() + } + // TODO: ^^ Will not fail if the function was imported from a closed module. + + if v := recover(); v != nil { + err = ce.recoverOnCall(ctx, m, v) + } + }() + + ce.pushValues(params) + + if ce.f.parent.ensureTermination { + done := m.CloseModuleOnCanceledOrTimeout(ctx) + defer done() + } + + ce.callFunction(ctx, m, ce.f) + + // This returns a safe copy of the results, instead of a slice view. If we + // returned a re-slice, the caller could accidentally or purposefully + // corrupt the stack of subsequent calls. + ft := ce.f.funcType + if results == nil && ft.ResultNumInUint64 > 0 { + results = make([]uint64, ft.ResultNumInUint64) + } + ce.popValues(results) + return results, nil +} + +// functionListenerInvocation captures arguments needed to perform function +// listener invocations when unwinding the call stack. +type functionListenerInvocation struct { + experimental.FunctionListener + def api.FunctionDefinition +} + +// recoverOnCall takes the recovered value `recoverOnCall`, and wraps it +// with the call frame stack traces. Also, reset the state of callEngine +// so that it can be used for the subsequent calls. +func (ce *callEngine) recoverOnCall(ctx context.Context, m *wasm.ModuleInstance, v interface{}) (err error) { + builder := wasmdebug.NewErrorBuilder() + frameCount := len(ce.frames) + functionListeners := make([]functionListenerInvocation, 0, 16) + + for i := 0; i < frameCount; i++ { + frame := ce.popFrame() + f := frame.f + def := f.definition() + var sources []string + if parent := frame.f.parent; parent.body != nil && len(parent.offsetsInWasmBinary) > 0 { + sources = parent.source.DWARFLines.Line(parent.offsetsInWasmBinary[frame.pc]) + } + builder.AddFrame(def.DebugName(), def.ParamTypes(), def.ResultTypes(), sources) + if f.parent.listener != nil { + functionListeners = append(functionListeners, functionListenerInvocation{ + FunctionListener: f.parent.listener, + def: f.definition(), + }) + } + } + + err = builder.FromRecovered(v) + for i := range functionListeners { + functionListeners[i].Abort(ctx, m, functionListeners[i].def, err) + } + + // Allows the reuse of CallEngine. + ce.stack, ce.frames = ce.stack[:0], ce.frames[:0] + return +} + +func (ce *callEngine) callFunction(ctx context.Context, m *wasm.ModuleInstance, f *function) { + if f.parent.hostFn != nil { + ce.callGoFuncWithStack(ctx, m, f) + } else if lsn := f.parent.listener; lsn != nil { + ce.callNativeFuncWithListener(ctx, m, f, lsn) + } else { + ce.callNativeFunc(ctx, m, f) + } +} + +func (ce *callEngine) callGoFunc(ctx context.Context, m *wasm.ModuleInstance, f *function, stack []uint64) { + typ := f.funcType + lsn := f.parent.listener + if lsn != nil { + params := stack[:typ.ParamNumInUint64] + ce.stackIterator.reset(ce.stack, ce.frames, f) + lsn.Before(ctx, m, f.definition(), params, &ce.stackIterator) + ce.stackIterator.clear() + } + frame := &callFrame{f: f, base: len(ce.stack)} + ce.pushFrame(frame) + + fn := f.parent.hostFn + switch fn := fn.(type) { + case api.GoModuleFunction: + fn.Call(ctx, m, stack) + case api.GoFunction: + fn.Call(ctx, stack) + } + + ce.popFrame() + if lsn != nil { + // TODO: This doesn't get the error due to use of panic to propagate them. + results := stack[:typ.ResultNumInUint64] + lsn.After(ctx, m, f.definition(), results) + } +} + +func (ce *callEngine) callNativeFunc(ctx context.Context, m *wasm.ModuleInstance, f *function) { + frame := &callFrame{f: f, base: len(ce.stack)} + moduleInst := f.moduleInstance + functions := moduleInst.Engine.(*moduleEngine).functions + memoryInst := moduleInst.MemoryInstance + globals := moduleInst.Globals + tables := moduleInst.Tables + typeIDs := moduleInst.TypeIDs + dataInstances := moduleInst.DataInstances + elementInstances := moduleInst.ElementInstances + ce.pushFrame(frame) + body := frame.f.parent.body + bodyLen := uint64(len(body)) + for frame.pc < bodyLen { + op := &body[frame.pc] + // TODO: add description of each operation/case + // on, for example, how many args are used, + // how the stack is modified, etc. + switch op.Kind { + case wazeroir.OperationKindBuiltinFunctionCheckExitCode: + if err := m.FailIfClosed(); err != nil { + panic(err) + } + frame.pc++ + case wazeroir.OperationKindUnreachable: + panic(wasmruntime.ErrRuntimeUnreachable) + case wazeroir.OperationKindBr: + frame.pc = op.U1 + case wazeroir.OperationKindBrIf: + if ce.popValue() > 0 { + ce.drop(op.U3) + frame.pc = op.U1 + } else { + frame.pc = op.U2 + } + case wazeroir.OperationKindBrTable: + v := ce.popValue() + defaultAt := uint64(len(op.Us))/2 - 1 + if v > defaultAt { + v = defaultAt + } + v *= 2 + ce.drop(op.Us[v+1]) + frame.pc = op.Us[v] + case wazeroir.OperationKindCall: + ce.callFunction(ctx, f.moduleInstance, &functions[op.U1]) + frame.pc++ + case wazeroir.OperationKindCallIndirect: + offset := ce.popValue() + table := tables[op.U2] + if offset >= uint64(len(table.References)) { + panic(wasmruntime.ErrRuntimeInvalidTableAccess) + } + rawPtr := table.References[offset] + if rawPtr == 0 { + panic(wasmruntime.ErrRuntimeInvalidTableAccess) + } + + tf := functionFromUintptr(rawPtr) + if tf.typeID != typeIDs[op.U1] { + panic(wasmruntime.ErrRuntimeIndirectCallTypeMismatch) + } + + ce.callFunction(ctx, f.moduleInstance, tf) + frame.pc++ + case wazeroir.OperationKindDrop: + ce.drop(op.U1) + frame.pc++ + case wazeroir.OperationKindSelect: + c := ce.popValue() + if op.B3 { // Target is vector. + x2Hi, x2Lo := ce.popValue(), ce.popValue() + if c == 0 { + _, _ = ce.popValue(), ce.popValue() // discard the x1's lo and hi bits. + ce.pushValue(x2Lo) + ce.pushValue(x2Hi) + } + } else { + v2 := ce.popValue() + if c == 0 { + _ = ce.popValue() + ce.pushValue(v2) + } + } + frame.pc++ + case wazeroir.OperationKindPick: + index := len(ce.stack) - 1 - int(op.U1) + ce.pushValue(ce.stack[index]) + if op.B3 { // V128 value target. + ce.pushValue(ce.stack[index+1]) + } + frame.pc++ + case wazeroir.OperationKindSet: + if op.B3 { // V128 value target. + lowIndex := len(ce.stack) - 1 - int(op.U1) + highIndex := lowIndex + 1 + hi, lo := ce.popValue(), ce.popValue() + ce.stack[lowIndex], ce.stack[highIndex] = lo, hi + } else { + index := len(ce.stack) - 1 - int(op.U1) + ce.stack[index] = ce.popValue() + } + frame.pc++ + case wazeroir.OperationKindGlobalGet: + g := globals[op.U1] + ce.pushValue(g.Val) + if g.Type.ValType == wasm.ValueTypeV128 { + ce.pushValue(g.ValHi) + } + frame.pc++ + case wazeroir.OperationKindGlobalSet: + g := globals[op.U1] + if g.Type.ValType == wasm.ValueTypeV128 { + g.ValHi = ce.popValue() + } + g.Val = ce.popValue() + frame.pc++ + case wazeroir.OperationKindLoad: + offset := ce.popMemoryOffset(op) + switch wazeroir.UnsignedType(op.B1) { + case wazeroir.UnsignedTypeI32, wazeroir.UnsignedTypeF32: + if val, ok := memoryInst.ReadUint32Le(offset); !ok { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } else { + ce.pushValue(uint64(val)) + } + case wazeroir.UnsignedTypeI64, wazeroir.UnsignedTypeF64: + if val, ok := memoryInst.ReadUint64Le(offset); !ok { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } else { + ce.pushValue(val) + } + } + frame.pc++ + case wazeroir.OperationKindLoad8: + val, ok := memoryInst.ReadByte(ce.popMemoryOffset(op)) + if !ok { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + + switch wazeroir.SignedInt(op.B1) { + case wazeroir.SignedInt32: + ce.pushValue(uint64(uint32(int8(val)))) + case wazeroir.SignedInt64: + ce.pushValue(uint64(int8(val))) + case wazeroir.SignedUint32, wazeroir.SignedUint64: + ce.pushValue(uint64(val)) + } + frame.pc++ + case wazeroir.OperationKindLoad16: + + val, ok := memoryInst.ReadUint16Le(ce.popMemoryOffset(op)) + if !ok { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + + switch wazeroir.SignedInt(op.B1) { + case wazeroir.SignedInt32: + ce.pushValue(uint64(uint32(int16(val)))) + case wazeroir.SignedInt64: + ce.pushValue(uint64(int16(val))) + case wazeroir.SignedUint32, wazeroir.SignedUint64: + ce.pushValue(uint64(val)) + } + frame.pc++ + case wazeroir.OperationKindLoad32: + val, ok := memoryInst.ReadUint32Le(ce.popMemoryOffset(op)) + if !ok { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + + if op.B1 == 1 { // Signed + ce.pushValue(uint64(int32(val))) + } else { + ce.pushValue(uint64(val)) + } + frame.pc++ + case wazeroir.OperationKindStore: + val := ce.popValue() + offset := ce.popMemoryOffset(op) + switch wazeroir.UnsignedType(op.B1) { + case wazeroir.UnsignedTypeI32, wazeroir.UnsignedTypeF32: + if !memoryInst.WriteUint32Le(offset, uint32(val)) { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + case wazeroir.UnsignedTypeI64, wazeroir.UnsignedTypeF64: + if !memoryInst.WriteUint64Le(offset, val) { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + } + frame.pc++ + case wazeroir.OperationKindStore8: + val := byte(ce.popValue()) + offset := ce.popMemoryOffset(op) + if !memoryInst.WriteByte(offset, val) { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + frame.pc++ + case wazeroir.OperationKindStore16: + val := uint16(ce.popValue()) + offset := ce.popMemoryOffset(op) + if !memoryInst.WriteUint16Le(offset, val) { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + frame.pc++ + case wazeroir.OperationKindStore32: + val := uint32(ce.popValue()) + offset := ce.popMemoryOffset(op) + if !memoryInst.WriteUint32Le(offset, val) { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + frame.pc++ + case wazeroir.OperationKindMemorySize: + ce.pushValue(uint64(memoryInst.PageSize())) + frame.pc++ + case wazeroir.OperationKindMemoryGrow: + n := ce.popValue() + if res, ok := memoryInst.Grow(uint32(n)); !ok { + ce.pushValue(uint64(0xffffffff)) // = -1 in signed 32-bit integer. + } else { + ce.pushValue(uint64(res)) + } + frame.pc++ + case wazeroir.OperationKindConstI32, wazeroir.OperationKindConstI64, + wazeroir.OperationKindConstF32, wazeroir.OperationKindConstF64: + ce.pushValue(op.U1) + frame.pc++ + case wazeroir.OperationKindEq: + var b bool + switch wazeroir.UnsignedType(op.B1) { + case wazeroir.UnsignedTypeI32: + v2, v1 := ce.popValue(), ce.popValue() + b = uint32(v1) == uint32(v2) + case wazeroir.UnsignedTypeI64: + v2, v1 := ce.popValue(), ce.popValue() + b = v1 == v2 + case wazeroir.UnsignedTypeF32: + v2, v1 := ce.popValue(), ce.popValue() + b = math.Float32frombits(uint32(v2)) == math.Float32frombits(uint32(v1)) + case wazeroir.UnsignedTypeF64: + v2, v1 := ce.popValue(), ce.popValue() + b = math.Float64frombits(v2) == math.Float64frombits(v1) + } + if b { + ce.pushValue(1) + } else { + ce.pushValue(0) + } + frame.pc++ + case wazeroir.OperationKindNe: + var b bool + switch wazeroir.UnsignedType(op.B1) { + case wazeroir.UnsignedTypeI32, wazeroir.UnsignedTypeI64: + v2, v1 := ce.popValue(), ce.popValue() + b = v1 != v2 + case wazeroir.UnsignedTypeF32: + v2, v1 := ce.popValue(), ce.popValue() + b = math.Float32frombits(uint32(v2)) != math.Float32frombits(uint32(v1)) + case wazeroir.UnsignedTypeF64: + v2, v1 := ce.popValue(), ce.popValue() + b = math.Float64frombits(v2) != math.Float64frombits(v1) + } + if b { + ce.pushValue(1) + } else { + ce.pushValue(0) + } + frame.pc++ + case wazeroir.OperationKindEqz: + if ce.popValue() == 0 { + ce.pushValue(1) + } else { + ce.pushValue(0) + } + frame.pc++ + case wazeroir.OperationKindLt: + v2 := ce.popValue() + v1 := ce.popValue() + var b bool + switch wazeroir.SignedType(op.B1) { + case wazeroir.SignedTypeInt32: + b = int32(v1) < int32(v2) + case wazeroir.SignedTypeInt64: + b = int64(v1) < int64(v2) + case wazeroir.SignedTypeUint32, wazeroir.SignedTypeUint64: + b = v1 < v2 + case wazeroir.SignedTypeFloat32: + b = math.Float32frombits(uint32(v1)) < math.Float32frombits(uint32(v2)) + case wazeroir.SignedTypeFloat64: + b = math.Float64frombits(v1) < math.Float64frombits(v2) + } + if b { + ce.pushValue(1) + } else { + ce.pushValue(0) + } + frame.pc++ + case wazeroir.OperationKindGt: + v2 := ce.popValue() + v1 := ce.popValue() + var b bool + switch wazeroir.SignedType(op.B1) { + case wazeroir.SignedTypeInt32: + b = int32(v1) > int32(v2) + case wazeroir.SignedTypeInt64: + b = int64(v1) > int64(v2) + case wazeroir.SignedTypeUint32, wazeroir.SignedTypeUint64: + b = v1 > v2 + case wazeroir.SignedTypeFloat32: + b = math.Float32frombits(uint32(v1)) > math.Float32frombits(uint32(v2)) + case wazeroir.SignedTypeFloat64: + b = math.Float64frombits(v1) > math.Float64frombits(v2) + } + if b { + ce.pushValue(1) + } else { + ce.pushValue(0) + } + frame.pc++ + case wazeroir.OperationKindLe: + v2 := ce.popValue() + v1 := ce.popValue() + var b bool + switch wazeroir.SignedType(op.B1) { + case wazeroir.SignedTypeInt32: + b = int32(v1) <= int32(v2) + case wazeroir.SignedTypeInt64: + b = int64(v1) <= int64(v2) + case wazeroir.SignedTypeUint32, wazeroir.SignedTypeUint64: + b = v1 <= v2 + case wazeroir.SignedTypeFloat32: + b = math.Float32frombits(uint32(v1)) <= math.Float32frombits(uint32(v2)) + case wazeroir.SignedTypeFloat64: + b = math.Float64frombits(v1) <= math.Float64frombits(v2) + } + if b { + ce.pushValue(1) + } else { + ce.pushValue(0) + } + frame.pc++ + case wazeroir.OperationKindGe: + v2 := ce.popValue() + v1 := ce.popValue() + var b bool + switch wazeroir.SignedType(op.B1) { + case wazeroir.SignedTypeInt32: + b = int32(v1) >= int32(v2) + case wazeroir.SignedTypeInt64: + b = int64(v1) >= int64(v2) + case wazeroir.SignedTypeUint32, wazeroir.SignedTypeUint64: + b = v1 >= v2 + case wazeroir.SignedTypeFloat32: + b = math.Float32frombits(uint32(v1)) >= math.Float32frombits(uint32(v2)) + case wazeroir.SignedTypeFloat64: + b = math.Float64frombits(v1) >= math.Float64frombits(v2) + } + if b { + ce.pushValue(1) + } else { + ce.pushValue(0) + } + frame.pc++ + case wazeroir.OperationKindAdd: + v2 := ce.popValue() + v1 := ce.popValue() + switch wazeroir.UnsignedType(op.B1) { + case wazeroir.UnsignedTypeI32: + v := uint32(v1) + uint32(v2) + ce.pushValue(uint64(v)) + case wazeroir.UnsignedTypeI64: + ce.pushValue(v1 + v2) + case wazeroir.UnsignedTypeF32: + ce.pushValue(addFloat32bits(uint32(v1), uint32(v2))) + case wazeroir.UnsignedTypeF64: + v := math.Float64frombits(v1) + math.Float64frombits(v2) + ce.pushValue(math.Float64bits(v)) + } + frame.pc++ + case wazeroir.OperationKindSub: + v2 := ce.popValue() + v1 := ce.popValue() + switch wazeroir.UnsignedType(op.B1) { + case wazeroir.UnsignedTypeI32: + ce.pushValue(uint64(uint32(v1) - uint32(v2))) + case wazeroir.UnsignedTypeI64: + ce.pushValue(v1 - v2) + case wazeroir.UnsignedTypeF32: + ce.pushValue(subFloat32bits(uint32(v1), uint32(v2))) + case wazeroir.UnsignedTypeF64: + v := math.Float64frombits(v1) - math.Float64frombits(v2) + ce.pushValue(math.Float64bits(v)) + } + frame.pc++ + case wazeroir.OperationKindMul: + v2 := ce.popValue() + v1 := ce.popValue() + switch wazeroir.UnsignedType(op.B1) { + case wazeroir.UnsignedTypeI32: + ce.pushValue(uint64(uint32(v1) * uint32(v2))) + case wazeroir.UnsignedTypeI64: + ce.pushValue(v1 * v2) + case wazeroir.UnsignedTypeF32: + ce.pushValue(mulFloat32bits(uint32(v1), uint32(v2))) + case wazeroir.UnsignedTypeF64: + v := math.Float64frombits(v2) * math.Float64frombits(v1) + ce.pushValue(math.Float64bits(v)) + } + frame.pc++ + case wazeroir.OperationKindClz: + v := ce.popValue() + if op.B1 == 0 { + // UnsignedInt32 + ce.pushValue(uint64(bits.LeadingZeros32(uint32(v)))) + } else { + // UnsignedInt64 + ce.pushValue(uint64(bits.LeadingZeros64(v))) + } + frame.pc++ + case wazeroir.OperationKindCtz: + v := ce.popValue() + if op.B1 == 0 { + // UnsignedInt32 + ce.pushValue(uint64(bits.TrailingZeros32(uint32(v)))) + } else { + // UnsignedInt64 + ce.pushValue(uint64(bits.TrailingZeros64(v))) + } + frame.pc++ + case wazeroir.OperationKindPopcnt: + v := ce.popValue() + if op.B1 == 0 { + // UnsignedInt32 + ce.pushValue(uint64(bits.OnesCount32(uint32(v)))) + } else { + // UnsignedInt64 + ce.pushValue(uint64(bits.OnesCount64(v))) + } + frame.pc++ + case wazeroir.OperationKindDiv: + // If an integer, check we won't divide by zero. + t := wazeroir.SignedType(op.B1) + v2, v1 := ce.popValue(), ce.popValue() + switch t { + case wazeroir.SignedTypeFloat32, wazeroir.SignedTypeFloat64: // not integers + default: + if v2 == 0 { + panic(wasmruntime.ErrRuntimeIntegerDivideByZero) + } + } + + switch t { + case wazeroir.SignedTypeInt32: + d := int32(v2) + n := int32(v1) + if n == math.MinInt32 && d == -1 { + panic(wasmruntime.ErrRuntimeIntegerOverflow) + } + ce.pushValue(uint64(uint32(n / d))) + case wazeroir.SignedTypeInt64: + d := int64(v2) + n := int64(v1) + if n == math.MinInt64 && d == -1 { + panic(wasmruntime.ErrRuntimeIntegerOverflow) + } + ce.pushValue(uint64(n / d)) + case wazeroir.SignedTypeUint32: + d := uint32(v2) + n := uint32(v1) + ce.pushValue(uint64(n / d)) + case wazeroir.SignedTypeUint64: + d := v2 + n := v1 + ce.pushValue(n / d) + case wazeroir.SignedTypeFloat32: + ce.pushValue(divFloat32bits(uint32(v1), uint32(v2))) + case wazeroir.SignedTypeFloat64: + ce.pushValue(math.Float64bits(math.Float64frombits(v1) / math.Float64frombits(v2))) + } + frame.pc++ + case wazeroir.OperationKindRem: + v2, v1 := ce.popValue(), ce.popValue() + if v2 == 0 { + panic(wasmruntime.ErrRuntimeIntegerDivideByZero) + } + switch wazeroir.SignedInt(op.B1) { + case wazeroir.SignedInt32: + d := int32(v2) + n := int32(v1) + ce.pushValue(uint64(uint32(n % d))) + case wazeroir.SignedInt64: + d := int64(v2) + n := int64(v1) + ce.pushValue(uint64(n % d)) + case wazeroir.SignedUint32: + d := uint32(v2) + n := uint32(v1) + ce.pushValue(uint64(n % d)) + case wazeroir.SignedUint64: + d := v2 + n := v1 + ce.pushValue(n % d) + } + frame.pc++ + case wazeroir.OperationKindAnd: + v2 := ce.popValue() + v1 := ce.popValue() + if op.B1 == 0 { + // UnsignedInt32 + ce.pushValue(uint64(uint32(v2) & uint32(v1))) + } else { + // UnsignedInt64 + ce.pushValue(uint64(v2 & v1)) + } + frame.pc++ + case wazeroir.OperationKindOr: + v2 := ce.popValue() + v1 := ce.popValue() + if op.B1 == 0 { + // UnsignedInt32 + ce.pushValue(uint64(uint32(v2) | uint32(v1))) + } else { + // UnsignedInt64 + ce.pushValue(uint64(v2 | v1)) + } + frame.pc++ + case wazeroir.OperationKindXor: + v2 := ce.popValue() + v1 := ce.popValue() + if op.B1 == 0 { + // UnsignedInt32 + ce.pushValue(uint64(uint32(v2) ^ uint32(v1))) + } else { + // UnsignedInt64 + ce.pushValue(uint64(v2 ^ v1)) + } + frame.pc++ + case wazeroir.OperationKindShl: + v2 := ce.popValue() + v1 := ce.popValue() + if op.B1 == 0 { + // UnsignedInt32 + ce.pushValue(uint64(uint32(v1) << (uint32(v2) % 32))) + } else { + // UnsignedInt64 + ce.pushValue(v1 << (v2 % 64)) + } + frame.pc++ + case wazeroir.OperationKindShr: + v2 := ce.popValue() + v1 := ce.popValue() + switch wazeroir.SignedInt(op.B1) { + case wazeroir.SignedInt32: + ce.pushValue(uint64(uint32(int32(v1) >> (uint32(v2) % 32)))) + case wazeroir.SignedInt64: + ce.pushValue(uint64(int64(v1) >> (v2 % 64))) + case wazeroir.SignedUint32: + ce.pushValue(uint64(uint32(v1) >> (uint32(v2) % 32))) + case wazeroir.SignedUint64: + ce.pushValue(v1 >> (v2 % 64)) + } + frame.pc++ + case wazeroir.OperationKindRotl: + v2 := ce.popValue() + v1 := ce.popValue() + if op.B1 == 0 { + // UnsignedInt32 + ce.pushValue(uint64(bits.RotateLeft32(uint32(v1), int(v2)))) + } else { + // UnsignedInt64 + ce.pushValue(uint64(bits.RotateLeft64(v1, int(v2)))) + } + frame.pc++ + case wazeroir.OperationKindRotr: + v2 := ce.popValue() + v1 := ce.popValue() + if op.B1 == 0 { + // UnsignedInt32 + ce.pushValue(uint64(bits.RotateLeft32(uint32(v1), -int(v2)))) + } else { + // UnsignedInt64 + ce.pushValue(uint64(bits.RotateLeft64(v1, -int(v2)))) + } + frame.pc++ + case wazeroir.OperationKindAbs: + if op.B1 == 0 { + // Float32 + const mask uint32 = 1 << 31 + ce.pushValue(uint64(uint32(ce.popValue()) &^ mask)) + } else { + // Float64 + const mask uint64 = 1 << 63 + ce.pushValue(ce.popValue() &^ mask) + } + frame.pc++ + case wazeroir.OperationKindNeg: + if op.B1 == 0 { + // Float32 + v := -math.Float32frombits(uint32(ce.popValue())) + ce.pushValue(uint64(math.Float32bits(v))) + } else { + // Float64 + v := -math.Float64frombits(ce.popValue()) + ce.pushValue(math.Float64bits(v)) + } + frame.pc++ + case wazeroir.OperationKindCeil: + if op.B1 == 0 { + // Float32 + v := moremath.WasmCompatCeilF32(math.Float32frombits(uint32(ce.popValue()))) + ce.pushValue(uint64(math.Float32bits(v))) + } else { + // Float64 + v := moremath.WasmCompatCeilF64(math.Float64frombits(ce.popValue())) + ce.pushValue(math.Float64bits(v)) + } + frame.pc++ + case wazeroir.OperationKindFloor: + if op.B1 == 0 { + // Float32 + v := moremath.WasmCompatFloorF32(math.Float32frombits(uint32(ce.popValue()))) + ce.pushValue(uint64(math.Float32bits(v))) + } else { + // Float64 + v := moremath.WasmCompatFloorF64(math.Float64frombits(ce.popValue())) + ce.pushValue(math.Float64bits(v)) + } + frame.pc++ + case wazeroir.OperationKindTrunc: + if op.B1 == 0 { + // Float32 + v := moremath.WasmCompatTruncF32(math.Float32frombits(uint32(ce.popValue()))) + ce.pushValue(uint64(math.Float32bits(v))) + } else { + // Float64 + v := moremath.WasmCompatTruncF64(math.Float64frombits(ce.popValue())) + ce.pushValue(math.Float64bits(v)) + } + frame.pc++ + case wazeroir.OperationKindNearest: + if op.B1 == 0 { + // Float32 + f := math.Float32frombits(uint32(ce.popValue())) + ce.pushValue(uint64(math.Float32bits(moremath.WasmCompatNearestF32(f)))) + } else { + // Float64 + f := math.Float64frombits(ce.popValue()) + ce.pushValue(math.Float64bits(moremath.WasmCompatNearestF64(f))) + } + frame.pc++ + case wazeroir.OperationKindSqrt: + if op.B1 == 0 { + // Float32 + v := math.Sqrt(float64(math.Float32frombits(uint32(ce.popValue())))) + ce.pushValue(uint64(math.Float32bits(float32(v)))) + } else { + // Float64 + v := math.Sqrt(math.Float64frombits(ce.popValue())) + ce.pushValue(math.Float64bits(v)) + } + frame.pc++ + case wazeroir.OperationKindMin: + if op.B1 == 0 { + // Float32 + ce.pushValue(WasmCompatMin32bits(uint32(ce.popValue()), uint32(ce.popValue()))) + } else { + v2 := math.Float64frombits(ce.popValue()) + v1 := math.Float64frombits(ce.popValue()) + ce.pushValue(math.Float64bits(moremath.WasmCompatMin64(v1, v2))) + } + frame.pc++ + case wazeroir.OperationKindMax: + if op.B1 == 0 { + ce.pushValue(WasmCompatMax32bits(uint32(ce.popValue()), uint32(ce.popValue()))) + } else { + // Float64 + v2 := math.Float64frombits(ce.popValue()) + v1 := math.Float64frombits(ce.popValue()) + ce.pushValue(math.Float64bits(moremath.WasmCompatMax64(v1, v2))) + } + frame.pc++ + case wazeroir.OperationKindCopysign: + if op.B1 == 0 { + // Float32 + v2 := uint32(ce.popValue()) + v1 := uint32(ce.popValue()) + const signbit = 1 << 31 + ce.pushValue(uint64(v1&^signbit | v2&signbit)) + } else { + // Float64 + v2 := ce.popValue() + v1 := ce.popValue() + const signbit = 1 << 63 + ce.pushValue(v1&^signbit | v2&signbit) + } + frame.pc++ + case wazeroir.OperationKindI32WrapFromI64: + ce.pushValue(uint64(uint32(ce.popValue()))) + frame.pc++ + case wazeroir.OperationKindITruncFromF: + if op.B1 == 0 { + // Float32 + switch wazeroir.SignedInt(op.B2) { + case wazeroir.SignedInt32: + v := math.Trunc(float64(math.Float32frombits(uint32(ce.popValue())))) + if math.IsNaN(v) { // NaN cannot be compared with themselves, so we have to use IsNaN + if op.B3 { + // non-trapping conversion must cast nan to zero. + v = 0 + } else { + panic(wasmruntime.ErrRuntimeInvalidConversionToInteger) + } + } else if v < math.MinInt32 || v > math.MaxInt32 { + if op.B3 { + // non-trapping conversion must "saturate" the value for overflowing sources. + if v < 0 { + v = math.MinInt32 + } else { + v = math.MaxInt32 + } + } else { + panic(wasmruntime.ErrRuntimeIntegerOverflow) + } + } + ce.pushValue(uint64(uint32(int32(v)))) + case wazeroir.SignedInt64: + v := math.Trunc(float64(math.Float32frombits(uint32(ce.popValue())))) + res := int64(v) + if math.IsNaN(v) { // NaN cannot be compared with themselves, so we have to use IsNaN + if op.B3 { + // non-trapping conversion must cast nan to zero. + res = 0 + } else { + panic(wasmruntime.ErrRuntimeInvalidConversionToInteger) + } + } else if v < math.MinInt64 || v >= math.MaxInt64 { + // Note: math.MaxInt64 is rounded up to math.MaxInt64+1 in 64-bit float representation, + // and that's why we use '>=' not '>' to check overflow. + if op.B3 { + // non-trapping conversion must "saturate" the value for overflowing sources. + if v < 0 { + res = math.MinInt64 + } else { + res = math.MaxInt64 + } + } else { + panic(wasmruntime.ErrRuntimeIntegerOverflow) + } + } + ce.pushValue(uint64(res)) + case wazeroir.SignedUint32: + v := math.Trunc(float64(math.Float32frombits(uint32(ce.popValue())))) + if math.IsNaN(v) { // NaN cannot be compared with themselves, so we have to use IsNaN + if op.B3 { + // non-trapping conversion must cast nan to zero. + v = 0 + } else { + panic(wasmruntime.ErrRuntimeInvalidConversionToInteger) + } + } else if v < 0 || v > math.MaxUint32 { + if op.B3 { + // non-trapping conversion must "saturate" the value for overflowing source. + if v < 0 { + v = 0 + } else { + v = math.MaxUint32 + } + } else { + panic(wasmruntime.ErrRuntimeIntegerOverflow) + } + } + ce.pushValue(uint64(uint32(v))) + case wazeroir.SignedUint64: + v := math.Trunc(float64(math.Float32frombits(uint32(ce.popValue())))) + res := uint64(v) + if math.IsNaN(v) { // NaN cannot be compared with themselves, so we have to use IsNaN + if op.B3 { + // non-trapping conversion must cast nan to zero. + res = 0 + } else { + panic(wasmruntime.ErrRuntimeInvalidConversionToInteger) + } + } else if v < 0 || v >= math.MaxUint64 { + // Note: math.MaxUint64 is rounded up to math.MaxUint64+1 in 64-bit float representation, + // and that's why we use '>=' not '>' to check overflow. + if op.B3 { + // non-trapping conversion must "saturate" the value for overflowing source. + if v < 0 { + res = 0 + } else { + res = math.MaxUint64 + } + } else { + panic(wasmruntime.ErrRuntimeIntegerOverflow) + } + } + ce.pushValue(res) + } + } else { + // Float64 + switch wazeroir.SignedInt(op.B2) { + case wazeroir.SignedInt32: + v := math.Trunc(math.Float64frombits(ce.popValue())) + if math.IsNaN(v) { // NaN cannot be compared with themselves, so we have to use IsNaN + if op.B3 { + // non-trapping conversion must cast nan to zero. + v = 0 + } else { + panic(wasmruntime.ErrRuntimeInvalidConversionToInteger) + } + } else if v < math.MinInt32 || v > math.MaxInt32 { + if op.B3 { + // non-trapping conversion must "saturate" the value for overflowing source. + if v < 0 { + v = math.MinInt32 + } else { + v = math.MaxInt32 + } + } else { + panic(wasmruntime.ErrRuntimeIntegerOverflow) + } + } + ce.pushValue(uint64(uint32(int32(v)))) + case wazeroir.SignedInt64: + v := math.Trunc(math.Float64frombits(ce.popValue())) + res := int64(v) + if math.IsNaN(v) { // NaN cannot be compared with themselves, so we have to use IsNaN + if op.B3 { + // non-trapping conversion must cast nan to zero. + res = 0 + } else { + panic(wasmruntime.ErrRuntimeInvalidConversionToInteger) + } + } else if v < math.MinInt64 || v >= math.MaxInt64 { + // Note: math.MaxInt64 is rounded up to math.MaxInt64+1 in 64-bit float representation, + // and that's why we use '>=' not '>' to check overflow. + if op.B3 { + // non-trapping conversion must "saturate" the value for overflowing source. + if v < 0 { + res = math.MinInt64 + } else { + res = math.MaxInt64 + } + } else { + panic(wasmruntime.ErrRuntimeIntegerOverflow) + } + } + ce.pushValue(uint64(res)) + case wazeroir.SignedUint32: + v := math.Trunc(math.Float64frombits(ce.popValue())) + if math.IsNaN(v) { // NaN cannot be compared with themselves, so we have to use IsNaN + if op.B3 { + // non-trapping conversion must cast nan to zero. + v = 0 + } else { + panic(wasmruntime.ErrRuntimeInvalidConversionToInteger) + } + } else if v < 0 || v > math.MaxUint32 { + if op.B3 { + // non-trapping conversion must "saturate" the value for overflowing source. + if v < 0 { + v = 0 + } else { + v = math.MaxUint32 + } + } else { + panic(wasmruntime.ErrRuntimeIntegerOverflow) + } + } + ce.pushValue(uint64(uint32(v))) + case wazeroir.SignedUint64: + v := math.Trunc(math.Float64frombits(ce.popValue())) + res := uint64(v) + if math.IsNaN(v) { // NaN cannot be compared with themselves, so we have to use IsNaN + if op.B3 { + // non-trapping conversion must cast nan to zero. + res = 0 + } else { + panic(wasmruntime.ErrRuntimeInvalidConversionToInteger) + } + } else if v < 0 || v >= math.MaxUint64 { + // Note: math.MaxUint64 is rounded up to math.MaxUint64+1 in 64-bit float representation, + // and that's why we use '>=' not '>' to check overflow. + if op.B3 { + // non-trapping conversion must "saturate" the value for overflowing source. + if v < 0 { + res = 0 + } else { + res = math.MaxUint64 + } + } else { + panic(wasmruntime.ErrRuntimeIntegerOverflow) + } + } + ce.pushValue(res) + } + } + frame.pc++ + case wazeroir.OperationKindFConvertFromI: + switch wazeroir.SignedInt(op.B1) { + case wazeroir.SignedInt32: + if op.B2 == 0 { + // Float32 + v := float32(int32(ce.popValue())) + ce.pushValue(uint64(math.Float32bits(v))) + } else { + // Float64 + v := float64(int32(ce.popValue())) + ce.pushValue(math.Float64bits(v)) + } + case wazeroir.SignedInt64: + if op.B2 == 0 { + // Float32 + v := float32(int64(ce.popValue())) + ce.pushValue(uint64(math.Float32bits(v))) + } else { + // Float64 + v := float64(int64(ce.popValue())) + ce.pushValue(math.Float64bits(v)) + } + case wazeroir.SignedUint32: + if op.B2 == 0 { + // Float32 + v := float32(uint32(ce.popValue())) + ce.pushValue(uint64(math.Float32bits(v))) + } else { + // Float64 + v := float64(uint32(ce.popValue())) + ce.pushValue(math.Float64bits(v)) + } + case wazeroir.SignedUint64: + if op.B2 == 0 { + // Float32 + v := float32(ce.popValue()) + ce.pushValue(uint64(math.Float32bits(v))) + } else { + // Float64 + v := float64(ce.popValue()) + ce.pushValue(math.Float64bits(v)) + } + } + frame.pc++ + case wazeroir.OperationKindF32DemoteFromF64: + v := float32(math.Float64frombits(ce.popValue())) + ce.pushValue(uint64(math.Float32bits(v))) + frame.pc++ + case wazeroir.OperationKindF64PromoteFromF32: + v := float64(math.Float32frombits(uint32(ce.popValue()))) + ce.pushValue(math.Float64bits(v)) + frame.pc++ + case wazeroir.OperationKindExtend: + if op.B1 == 1 { + // Signed. + v := int64(int32(ce.popValue())) + ce.pushValue(uint64(v)) + } else { + v := uint64(uint32(ce.popValue())) + ce.pushValue(v) + } + frame.pc++ + case wazeroir.OperationKindSignExtend32From8: + v := uint32(int8(ce.popValue())) + ce.pushValue(uint64(v)) + frame.pc++ + case wazeroir.OperationKindSignExtend32From16: + v := uint32(int16(ce.popValue())) + ce.pushValue(uint64(v)) + frame.pc++ + case wazeroir.OperationKindSignExtend64From8: + v := int64(int8(ce.popValue())) + ce.pushValue(uint64(v)) + frame.pc++ + case wazeroir.OperationKindSignExtend64From16: + v := int64(int16(ce.popValue())) + ce.pushValue(uint64(v)) + frame.pc++ + case wazeroir.OperationKindSignExtend64From32: + v := int64(int32(ce.popValue())) + ce.pushValue(uint64(v)) + frame.pc++ + case wazeroir.OperationKindMemoryInit: + dataInstance := dataInstances[op.U1] + copySize := ce.popValue() + inDataOffset := ce.popValue() + inMemoryOffset := ce.popValue() + if inDataOffset+copySize > uint64(len(dataInstance)) || + inMemoryOffset+copySize > uint64(len(memoryInst.Buffer)) { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } else if copySize != 0 { + copy(memoryInst.Buffer[inMemoryOffset:inMemoryOffset+copySize], dataInstance[inDataOffset:]) + } + frame.pc++ + case wazeroir.OperationKindDataDrop: + dataInstances[op.U1] = nil + frame.pc++ + case wazeroir.OperationKindMemoryCopy: + memLen := uint64(len(memoryInst.Buffer)) + copySize := ce.popValue() + sourceOffset := ce.popValue() + destinationOffset := ce.popValue() + if sourceOffset+copySize > memLen || destinationOffset+copySize > memLen { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } else if copySize != 0 { + copy(memoryInst.Buffer[destinationOffset:], + memoryInst.Buffer[sourceOffset:sourceOffset+copySize]) + } + frame.pc++ + case wazeroir.OperationKindMemoryFill: + fillSize := ce.popValue() + value := byte(ce.popValue()) + offset := ce.popValue() + if fillSize+offset > uint64(len(memoryInst.Buffer)) { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } else if fillSize != 0 { + // Uses the copy trick for faster filling buffer. + // https://gist.github.com/taylorza/df2f89d5f9ab3ffd06865062a4cf015d + buf := memoryInst.Buffer[offset : offset+fillSize] + buf[0] = value + for i := 1; i < len(buf); i *= 2 { + copy(buf[i:], buf[:i]) + } + } + frame.pc++ + case wazeroir.OperationKindTableInit: + elementInstance := elementInstances[op.U1] + copySize := ce.popValue() + inElementOffset := ce.popValue() + inTableOffset := ce.popValue() + table := tables[op.U2] + if inElementOffset+copySize > uint64(len(elementInstance)) || + inTableOffset+copySize > uint64(len(table.References)) { + panic(wasmruntime.ErrRuntimeInvalidTableAccess) + } else if copySize != 0 { + copy(table.References[inTableOffset:inTableOffset+copySize], elementInstance[inElementOffset:]) + } + frame.pc++ + case wazeroir.OperationKindElemDrop: + elementInstances[op.U1] = nil + frame.pc++ + case wazeroir.OperationKindTableCopy: + srcTable, dstTable := tables[op.U1].References, tables[op.U2].References + copySize := ce.popValue() + sourceOffset := ce.popValue() + destinationOffset := ce.popValue() + if sourceOffset+copySize > uint64(len(srcTable)) || destinationOffset+copySize > uint64(len(dstTable)) { + panic(wasmruntime.ErrRuntimeInvalidTableAccess) + } else if copySize != 0 { + copy(dstTable[destinationOffset:], srcTable[sourceOffset:sourceOffset+copySize]) + } + frame.pc++ + case wazeroir.OperationKindRefFunc: + ce.pushValue(uint64(uintptr(unsafe.Pointer(&functions[op.U1])))) + frame.pc++ + case wazeroir.OperationKindTableGet: + table := tables[op.U1] + + offset := ce.popValue() + if offset >= uint64(len(table.References)) { + panic(wasmruntime.ErrRuntimeInvalidTableAccess) + } + + ce.pushValue(uint64(table.References[offset])) + frame.pc++ + case wazeroir.OperationKindTableSet: + table := tables[op.U1] + ref := ce.popValue() + + offset := ce.popValue() + if offset >= uint64(len(table.References)) { + panic(wasmruntime.ErrRuntimeInvalidTableAccess) + } + + table.References[offset] = uintptr(ref) // externrefs are opaque uint64. + frame.pc++ + case wazeroir.OperationKindTableSize: + table := tables[op.U1] + ce.pushValue(uint64(len(table.References))) + frame.pc++ + case wazeroir.OperationKindTableGrow: + table := tables[op.U1] + num, ref := ce.popValue(), ce.popValue() + ret := table.Grow(uint32(num), uintptr(ref)) + ce.pushValue(uint64(ret)) + frame.pc++ + case wazeroir.OperationKindTableFill: + table := tables[op.U1] + num := ce.popValue() + ref := uintptr(ce.popValue()) + offset := ce.popValue() + if num+offset > uint64(len(table.References)) { + panic(wasmruntime.ErrRuntimeInvalidTableAccess) + } else if num > 0 { + // Uses the copy trick for faster filling the region with the value. + // https://gist.github.com/taylorza/df2f89d5f9ab3ffd06865062a4cf015d + targetRegion := table.References[offset : offset+num] + targetRegion[0] = ref + for i := 1; i < len(targetRegion); i *= 2 { + copy(targetRegion[i:], targetRegion[:i]) + } + } + frame.pc++ + case wazeroir.OperationKindV128Const: + lo, hi := op.U1, op.U2 + ce.pushValue(lo) + ce.pushValue(hi) + frame.pc++ + case wazeroir.OperationKindV128Add: + yHigh, yLow := ce.popValue(), ce.popValue() + xHigh, xLow := ce.popValue(), ce.popValue() + switch op.B1 { + case wazeroir.ShapeI8x16: + ce.pushValue( + uint64(uint8(xLow>>8)+uint8(yLow>>8))<<8 | uint64(uint8(xLow)+uint8(yLow)) | + uint64(uint8(xLow>>24)+uint8(yLow>>24))<<24 | uint64(uint8(xLow>>16)+uint8(yLow>>16))<<16 | + uint64(uint8(xLow>>40)+uint8(yLow>>40))<<40 | uint64(uint8(xLow>>32)+uint8(yLow>>32))<<32 | + uint64(uint8(xLow>>56)+uint8(yLow>>56))<<56 | uint64(uint8(xLow>>48)+uint8(yLow>>48))<<48, + ) + ce.pushValue( + uint64(uint8(xHigh>>8)+uint8(yHigh>>8))<<8 | uint64(uint8(xHigh)+uint8(yHigh)) | + uint64(uint8(xHigh>>24)+uint8(yHigh>>24))<<24 | uint64(uint8(xHigh>>16)+uint8(yHigh>>16))<<16 | + uint64(uint8(xHigh>>40)+uint8(yHigh>>40))<<40 | uint64(uint8(xHigh>>32)+uint8(yHigh>>32))<<32 | + uint64(uint8(xHigh>>56)+uint8(yHigh>>56))<<56 | uint64(uint8(xHigh>>48)+uint8(yHigh>>48))<<48, + ) + case wazeroir.ShapeI16x8: + ce.pushValue( + uint64(uint16(xLow>>16+yLow>>16))<<16 | uint64(uint16(xLow)+uint16(yLow)) | + uint64(uint16(xLow>>48+yLow>>48))<<48 | uint64(uint16(xLow>>32+yLow>>32))<<32, + ) + ce.pushValue( + uint64(uint16(xHigh>>16)+uint16(yHigh>>16))<<16 | uint64(uint16(xHigh)+uint16(yHigh)) | + uint64(uint16(xHigh>>48)+uint16(yHigh>>48))<<48 | uint64(uint16(xHigh>>32)+uint16(yHigh>>32))<<32, + ) + case wazeroir.ShapeI32x4: + ce.pushValue(uint64(uint32(xLow>>32)+uint32(yLow>>32))<<32 | uint64(uint32(xLow)+uint32(yLow))) + ce.pushValue(uint64(uint32(xHigh>>32)+uint32(yHigh>>32))<<32 | uint64(uint32(xHigh)+uint32(yHigh))) + case wazeroir.ShapeI64x2: + ce.pushValue(xLow + yLow) + ce.pushValue(xHigh + yHigh) + case wazeroir.ShapeF32x4: + ce.pushValue( + addFloat32bits(uint32(xLow), uint32(yLow)) | addFloat32bits(uint32(xLow>>32), uint32(yLow>>32))<<32, + ) + ce.pushValue( + addFloat32bits(uint32(xHigh), uint32(yHigh)) | addFloat32bits(uint32(xHigh>>32), uint32(yHigh>>32))<<32, + ) + case wazeroir.ShapeF64x2: + ce.pushValue(math.Float64bits(math.Float64frombits(xLow) + math.Float64frombits(yLow))) + ce.pushValue(math.Float64bits(math.Float64frombits(xHigh) + math.Float64frombits(yHigh))) + } + frame.pc++ + case wazeroir.OperationKindV128Sub: + yHigh, yLow := ce.popValue(), ce.popValue() + xHigh, xLow := ce.popValue(), ce.popValue() + switch op.B1 { + case wazeroir.ShapeI8x16: + ce.pushValue( + uint64(uint8(xLow>>8)-uint8(yLow>>8))<<8 | uint64(uint8(xLow)-uint8(yLow)) | + uint64(uint8(xLow>>24)-uint8(yLow>>24))<<24 | uint64(uint8(xLow>>16)-uint8(yLow>>16))<<16 | + uint64(uint8(xLow>>40)-uint8(yLow>>40))<<40 | uint64(uint8(xLow>>32)-uint8(yLow>>32))<<32 | + uint64(uint8(xLow>>56)-uint8(yLow>>56))<<56 | uint64(uint8(xLow>>48)-uint8(yLow>>48))<<48, + ) + ce.pushValue( + uint64(uint8(xHigh>>8)-uint8(yHigh>>8))<<8 | uint64(uint8(xHigh)-uint8(yHigh)) | + uint64(uint8(xHigh>>24)-uint8(yHigh>>24))<<24 | uint64(uint8(xHigh>>16)-uint8(yHigh>>16))<<16 | + uint64(uint8(xHigh>>40)-uint8(yHigh>>40))<<40 | uint64(uint8(xHigh>>32)-uint8(yHigh>>32))<<32 | + uint64(uint8(xHigh>>56)-uint8(yHigh>>56))<<56 | uint64(uint8(xHigh>>48)-uint8(yHigh>>48))<<48, + ) + case wazeroir.ShapeI16x8: + ce.pushValue( + uint64(uint16(xLow>>16)-uint16(yLow>>16))<<16 | uint64(uint16(xLow)-uint16(yLow)) | + uint64(uint16(xLow>>48)-uint16(yLow>>48))<<48 | uint64(uint16(xLow>>32)-uint16(yLow>>32))<<32, + ) + ce.pushValue( + uint64(uint16(xHigh>>16)-uint16(yHigh>>16))<<16 | uint64(uint16(xHigh)-uint16(yHigh)) | + uint64(uint16(xHigh>>48)-uint16(yHigh>>48))<<48 | uint64(uint16(xHigh>>32)-uint16(yHigh>>32))<<32, + ) + case wazeroir.ShapeI32x4: + ce.pushValue(uint64(uint32(xLow>>32-yLow>>32))<<32 | uint64(uint32(xLow)-uint32(yLow))) + ce.pushValue(uint64(uint32(xHigh>>32-yHigh>>32))<<32 | uint64(uint32(xHigh)-uint32(yHigh))) + case wazeroir.ShapeI64x2: + ce.pushValue(xLow - yLow) + ce.pushValue(xHigh - yHigh) + case wazeroir.ShapeF32x4: + ce.pushValue( + subFloat32bits(uint32(xLow), uint32(yLow)) | subFloat32bits(uint32(xLow>>32), uint32(yLow>>32))<<32, + ) + ce.pushValue( + subFloat32bits(uint32(xHigh), uint32(yHigh)) | subFloat32bits(uint32(xHigh>>32), uint32(yHigh>>32))<<32, + ) + case wazeroir.ShapeF64x2: + ce.pushValue(math.Float64bits(math.Float64frombits(xLow) - math.Float64frombits(yLow))) + ce.pushValue(math.Float64bits(math.Float64frombits(xHigh) - math.Float64frombits(yHigh))) + } + frame.pc++ + case wazeroir.OperationKindV128Load: + offset := ce.popMemoryOffset(op) + switch op.B1 { + case wazeroir.V128LoadType128: + lo, ok := memoryInst.ReadUint64Le(offset) + if !ok { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + ce.pushValue(lo) + hi, ok := memoryInst.ReadUint64Le(offset + 8) + if !ok { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + ce.pushValue(hi) + case wazeroir.V128LoadType8x8s: + data, ok := memoryInst.Read(offset, 8) + if !ok { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + ce.pushValue( + uint64(uint16(int8(data[3])))<<48 | uint64(uint16(int8(data[2])))<<32 | uint64(uint16(int8(data[1])))<<16 | uint64(uint16(int8(data[0]))), + ) + ce.pushValue( + uint64(uint16(int8(data[7])))<<48 | uint64(uint16(int8(data[6])))<<32 | uint64(uint16(int8(data[5])))<<16 | uint64(uint16(int8(data[4]))), + ) + case wazeroir.V128LoadType8x8u: + data, ok := memoryInst.Read(offset, 8) + if !ok { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + ce.pushValue( + uint64(data[3])<<48 | uint64(data[2])<<32 | uint64(data[1])<<16 | uint64(data[0]), + ) + ce.pushValue( + uint64(data[7])<<48 | uint64(data[6])<<32 | uint64(data[5])<<16 | uint64(data[4]), + ) + case wazeroir.V128LoadType16x4s: + data, ok := memoryInst.Read(offset, 8) + if !ok { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + ce.pushValue( + uint64(int16(binary.LittleEndian.Uint16(data[2:])))<<32 | + uint64(uint32(int16(binary.LittleEndian.Uint16(data)))), + ) + ce.pushValue( + uint64(uint32(int16(binary.LittleEndian.Uint16(data[6:]))))<<32 | + uint64(uint32(int16(binary.LittleEndian.Uint16(data[4:])))), + ) + case wazeroir.V128LoadType16x4u: + data, ok := memoryInst.Read(offset, 8) + if !ok { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + ce.pushValue( + uint64(binary.LittleEndian.Uint16(data[2:]))<<32 | uint64(binary.LittleEndian.Uint16(data)), + ) + ce.pushValue( + uint64(binary.LittleEndian.Uint16(data[6:]))<<32 | uint64(binary.LittleEndian.Uint16(data[4:])), + ) + case wazeroir.V128LoadType32x2s: + data, ok := memoryInst.Read(offset, 8) + if !ok { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + ce.pushValue(uint64(int32(binary.LittleEndian.Uint32(data)))) + ce.pushValue(uint64(int32(binary.LittleEndian.Uint32(data[4:])))) + case wazeroir.V128LoadType32x2u: + data, ok := memoryInst.Read(offset, 8) + if !ok { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + ce.pushValue(uint64(binary.LittleEndian.Uint32(data))) + ce.pushValue(uint64(binary.LittleEndian.Uint32(data[4:]))) + case wazeroir.V128LoadType8Splat: + v, ok := memoryInst.ReadByte(offset) + if !ok { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + v8 := uint64(v)<<56 | uint64(v)<<48 | uint64(v)<<40 | uint64(v)<<32 | + uint64(v)<<24 | uint64(v)<<16 | uint64(v)<<8 | uint64(v) + ce.pushValue(v8) + ce.pushValue(v8) + case wazeroir.V128LoadType16Splat: + v, ok := memoryInst.ReadUint16Le(offset) + if !ok { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + v4 := uint64(v)<<48 | uint64(v)<<32 | uint64(v)<<16 | uint64(v) + ce.pushValue(v4) + ce.pushValue(v4) + case wazeroir.V128LoadType32Splat: + v, ok := memoryInst.ReadUint32Le(offset) + if !ok { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + vv := uint64(v)<<32 | uint64(v) + ce.pushValue(vv) + ce.pushValue(vv) + case wazeroir.V128LoadType64Splat: + lo, ok := memoryInst.ReadUint64Le(offset) + if !ok { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + ce.pushValue(lo) + ce.pushValue(lo) + case wazeroir.V128LoadType32zero: + lo, ok := memoryInst.ReadUint32Le(offset) + if !ok { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + ce.pushValue(uint64(lo)) + ce.pushValue(0) + case wazeroir.V128LoadType64zero: + lo, ok := memoryInst.ReadUint64Le(offset) + if !ok { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + ce.pushValue(lo) + ce.pushValue(0) + } + frame.pc++ + case wazeroir.OperationKindV128LoadLane: + hi, lo := ce.popValue(), ce.popValue() + offset := ce.popMemoryOffset(op) + switch op.B1 { + case 8: + b, ok := memoryInst.ReadByte(offset) + if !ok { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + if op.B2 < 8 { + s := op.B2 << 3 + lo = (lo & ^(0xff << s)) | uint64(b)<>(op.B2*8))) + } else { + ok = memoryInst.WriteByte(offset, byte(hi>>((op.B2-8)*8))) + } + case 16: + if op.B2 < 4 { + ok = memoryInst.WriteUint16Le(offset, uint16(lo>>(op.B2*16))) + } else { + ok = memoryInst.WriteUint16Le(offset, uint16(hi>>((op.B2-4)*16))) + } + case 32: + if op.B2 < 2 { + ok = memoryInst.WriteUint32Le(offset, uint32(lo>>(op.B2*32))) + } else { + ok = memoryInst.WriteUint32Le(offset, uint32(hi>>((op.B2-2)*32))) + } + case 64: + if op.B2 == 0 { + ok = memoryInst.WriteUint64Le(offset, lo) + } else { + ok = memoryInst.WriteUint64Le(offset, hi) + } + } + if !ok { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + frame.pc++ + case wazeroir.OperationKindV128ReplaceLane: + v := ce.popValue() + hi, lo := ce.popValue(), ce.popValue() + switch op.B1 { + case wazeroir.ShapeI8x16: + if op.B2 < 8 { + s := op.B2 << 3 + lo = (lo & ^(0xff << s)) | uint64(byte(v))<> (op.B2 * 8)) + } else { + u8 = byte(hi >> ((op.B2 - 8) * 8)) + } + if op.B3 { + // sign-extend. + v = uint64(uint32(int8(u8))) + } else { + v = uint64(u8) + } + case wazeroir.ShapeI16x8: + var u16 uint16 + if op.B2 < 4 { + u16 = uint16(lo >> (op.B2 * 16)) + } else { + u16 = uint16(hi >> ((op.B2 - 4) * 16)) + } + if op.B3 { + // sign-extend. + v = uint64(uint32(int16(u16))) + } else { + v = uint64(u16) + } + case wazeroir.ShapeI32x4, wazeroir.ShapeF32x4: + if op.B2 < 2 { + v = uint64(uint32(lo >> (op.B2 * 32))) + } else { + v = uint64(uint32(hi >> ((op.B2 - 2) * 32))) + } + case wazeroir.ShapeI64x2, wazeroir.ShapeF64x2: + if op.B2 == 0 { + v = lo + } else { + v = hi + } + } + ce.pushValue(v) + frame.pc++ + case wazeroir.OperationKindV128Splat: + v := ce.popValue() + var hi, lo uint64 + switch op.B1 { + case wazeroir.ShapeI8x16: + v8 := uint64(byte(v))<<56 | uint64(byte(v))<<48 | uint64(byte(v))<<40 | uint64(byte(v))<<32 | + uint64(byte(v))<<24 | uint64(byte(v))<<16 | uint64(byte(v))<<8 | uint64(byte(v)) + hi, lo = v8, v8 + case wazeroir.ShapeI16x8: + v4 := uint64(uint16(v))<<48 | uint64(uint16(v))<<32 | uint64(uint16(v))<<16 | uint64(uint16(v)) + hi, lo = v4, v4 + case wazeroir.ShapeI32x4, wazeroir.ShapeF32x4: + v2 := uint64(uint32(v))<<32 | uint64(uint32(v)) + lo, hi = v2, v2 + case wazeroir.ShapeI64x2, wazeroir.ShapeF64x2: + lo, hi = v, v + } + ce.pushValue(lo) + ce.pushValue(hi) + frame.pc++ + case wazeroir.OperationKindV128Swizzle: + idxHi, idxLo := ce.popValue(), ce.popValue() + baseHi, baseLo := ce.popValue(), ce.popValue() + var newVal [16]byte + for i := 0; i < 16; i++ { + var id byte + if i < 8 { + id = byte(idxLo >> (i * 8)) + } else { + id = byte(idxHi >> ((i - 8) * 8)) + } + if id < 8 { + newVal[i] = byte(baseLo >> (id * 8)) + } else if id < 16 { + newVal[i] = byte(baseHi >> ((id - 8) * 8)) + } + } + ce.pushValue(binary.LittleEndian.Uint64(newVal[:8])) + ce.pushValue(binary.LittleEndian.Uint64(newVal[8:])) + frame.pc++ + case wazeroir.OperationKindV128Shuffle: + xHi, xLo, yHi, yLo := ce.popValue(), ce.popValue(), ce.popValue(), ce.popValue() + var newVal [16]byte + for i, l := range op.Us { + if l < 8 { + newVal[i] = byte(yLo >> (l * 8)) + } else if l < 16 { + newVal[i] = byte(yHi >> ((l - 8) * 8)) + } else if l < 24 { + newVal[i] = byte(xLo >> ((l - 16) * 8)) + } else if l < 32 { + newVal[i] = byte(xHi >> ((l - 24) * 8)) + } + } + ce.pushValue(binary.LittleEndian.Uint64(newVal[:8])) + ce.pushValue(binary.LittleEndian.Uint64(newVal[8:])) + frame.pc++ + case wazeroir.OperationKindV128AnyTrue: + hi, lo := ce.popValue(), ce.popValue() + if hi != 0 || lo != 0 { + ce.pushValue(1) + } else { + ce.pushValue(0) + } + frame.pc++ + case wazeroir.OperationKindV128AllTrue: + hi, lo := ce.popValue(), ce.popValue() + var ret bool + switch op.B1 { + case wazeroir.ShapeI8x16: + ret = (uint8(lo) != 0) && (uint8(lo>>8) != 0) && (uint8(lo>>16) != 0) && (uint8(lo>>24) != 0) && + (uint8(lo>>32) != 0) && (uint8(lo>>40) != 0) && (uint8(lo>>48) != 0) && (uint8(lo>>56) != 0) && + (uint8(hi) != 0) && (uint8(hi>>8) != 0) && (uint8(hi>>16) != 0) && (uint8(hi>>24) != 0) && + (uint8(hi>>32) != 0) && (uint8(hi>>40) != 0) && (uint8(hi>>48) != 0) && (uint8(hi>>56) != 0) + case wazeroir.ShapeI16x8: + ret = (uint16(lo) != 0) && (uint16(lo>>16) != 0) && (uint16(lo>>32) != 0) && (uint16(lo>>48) != 0) && + (uint16(hi) != 0) && (uint16(hi>>16) != 0) && (uint16(hi>>32) != 0) && (uint16(hi>>48) != 0) + case wazeroir.ShapeI32x4: + ret = (uint32(lo) != 0) && (uint32(lo>>32) != 0) && + (uint32(hi) != 0) && (uint32(hi>>32) != 0) + case wazeroir.ShapeI64x2: + ret = (lo != 0) && + (hi != 0) + } + if ret { + ce.pushValue(1) + } else { + ce.pushValue(0) + } + frame.pc++ + case wazeroir.OperationKindV128BitMask: + // https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/simd/SIMD.md#bitmask-extraction + hi, lo := ce.popValue(), ce.popValue() + var res uint64 + switch op.B1 { + case wazeroir.ShapeI8x16: + for i := 0; i < 8; i++ { + if int8(lo>>(i*8)) < 0 { + res |= 1 << i + } + } + for i := 0; i < 8; i++ { + if int8(hi>>(i*8)) < 0 { + res |= 1 << (i + 8) + } + } + case wazeroir.ShapeI16x8: + for i := 0; i < 4; i++ { + if int16(lo>>(i*16)) < 0 { + res |= 1 << i + } + } + for i := 0; i < 4; i++ { + if int16(hi>>(i*16)) < 0 { + res |= 1 << (i + 4) + } + } + case wazeroir.ShapeI32x4: + for i := 0; i < 2; i++ { + if int32(lo>>(i*32)) < 0 { + res |= 1 << i + } + } + for i := 0; i < 2; i++ { + if int32(hi>>(i*32)) < 0 { + res |= 1 << (i + 2) + } + } + case wazeroir.ShapeI64x2: + if int64(lo) < 0 { + res |= 0b01 + } + if int(hi) < 0 { + res |= 0b10 + } + } + ce.pushValue(res) + frame.pc++ + case wazeroir.OperationKindV128And: + x2Hi, x2Lo := ce.popValue(), ce.popValue() + x1Hi, x1Lo := ce.popValue(), ce.popValue() + ce.pushValue(x1Lo & x2Lo) + ce.pushValue(x1Hi & x2Hi) + frame.pc++ + case wazeroir.OperationKindV128Not: + hi, lo := ce.popValue(), ce.popValue() + ce.pushValue(^lo) + ce.pushValue(^hi) + frame.pc++ + case wazeroir.OperationKindV128Or: + x2Hi, x2Lo := ce.popValue(), ce.popValue() + x1Hi, x1Lo := ce.popValue(), ce.popValue() + ce.pushValue(x1Lo | x2Lo) + ce.pushValue(x1Hi | x2Hi) + frame.pc++ + case wazeroir.OperationKindV128Xor: + x2Hi, x2Lo := ce.popValue(), ce.popValue() + x1Hi, x1Lo := ce.popValue(), ce.popValue() + ce.pushValue(x1Lo ^ x2Lo) + ce.pushValue(x1Hi ^ x2Hi) + frame.pc++ + case wazeroir.OperationKindV128Bitselect: + // https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/simd/SIMD.md#bitwise-select + cHi, cLo := ce.popValue(), ce.popValue() + x2Hi, x2Lo := ce.popValue(), ce.popValue() + x1Hi, x1Lo := ce.popValue(), ce.popValue() + // v128.or(v128.and(v1, c), v128.and(v2, v128.not(c))) + ce.pushValue((x1Lo & cLo) | (x2Lo & (^cLo))) + ce.pushValue((x1Hi & cHi) | (x2Hi & (^cHi))) + frame.pc++ + case wazeroir.OperationKindV128AndNot: + x2Hi, x2Lo := ce.popValue(), ce.popValue() + x1Hi, x1Lo := ce.popValue(), ce.popValue() + ce.pushValue(x1Lo & (^x2Lo)) + ce.pushValue(x1Hi & (^x2Hi)) + frame.pc++ + case wazeroir.OperationKindV128Shl: + s := ce.popValue() + hi, lo := ce.popValue(), ce.popValue() + switch op.B1 { + case wazeroir.ShapeI8x16: + s = s % 8 + lo = uint64(uint8(lo<>8)<>16)<>24)<>32)<>40)<>48)<>56)<>8)<>16)<>24)<>32)<>40)<>48)<>56)<>16)<>32)<>48)<>16)<>32)<>48)<>32)<>32)<>s)) | + uint64(uint8(int8(lo>>8)>>s))<<8 | + uint64(uint8(int8(lo>>16)>>s))<<16 | + uint64(uint8(int8(lo>>24)>>s))<<24 | + uint64(uint8(int8(lo>>32)>>s))<<32 | + uint64(uint8(int8(lo>>40)>>s))<<40 | + uint64(uint8(int8(lo>>48)>>s))<<48 | + uint64(uint8(int8(lo>>56)>>s))<<56 + hi = uint64(uint8(int8(hi)>>s)) | + uint64(uint8(int8(hi>>8)>>s))<<8 | + uint64(uint8(int8(hi>>16)>>s))<<16 | + uint64(uint8(int8(hi>>24)>>s))<<24 | + uint64(uint8(int8(hi>>32)>>s))<<32 | + uint64(uint8(int8(hi>>40)>>s))<<40 | + uint64(uint8(int8(hi>>48)>>s))<<48 | + uint64(uint8(int8(hi>>56)>>s))<<56 + } else { + lo = uint64(uint8(lo)>>s) | + uint64(uint8(lo>>8)>>s)<<8 | + uint64(uint8(lo>>16)>>s)<<16 | + uint64(uint8(lo>>24)>>s)<<24 | + uint64(uint8(lo>>32)>>s)<<32 | + uint64(uint8(lo>>40)>>s)<<40 | + uint64(uint8(lo>>48)>>s)<<48 | + uint64(uint8(lo>>56)>>s)<<56 + hi = uint64(uint8(hi)>>s) | + uint64(uint8(hi>>8)>>s)<<8 | + uint64(uint8(hi>>16)>>s)<<16 | + uint64(uint8(hi>>24)>>s)<<24 | + uint64(uint8(hi>>32)>>s)<<32 | + uint64(uint8(hi>>40)>>s)<<40 | + uint64(uint8(hi>>48)>>s)<<48 | + uint64(uint8(hi>>56)>>s)<<56 + } + case wazeroir.ShapeI16x8: + s = s % 16 + if op.B3 { // signed + lo = uint64(uint16(int16(lo)>>s)) | + uint64(uint16(int16(lo>>16)>>s))<<16 | + uint64(uint16(int16(lo>>32)>>s))<<32 | + uint64(uint16(int16(lo>>48)>>s))<<48 + hi = uint64(uint16(int16(hi)>>s)) | + uint64(uint16(int16(hi>>16)>>s))<<16 | + uint64(uint16(int16(hi>>32)>>s))<<32 | + uint64(uint16(int16(hi>>48)>>s))<<48 + } else { + lo = uint64(uint16(lo)>>s) | + uint64(uint16(lo>>16)>>s)<<16 | + uint64(uint16(lo>>32)>>s)<<32 | + uint64(uint16(lo>>48)>>s)<<48 + hi = uint64(uint16(hi)>>s) | + uint64(uint16(hi>>16)>>s)<<16 | + uint64(uint16(hi>>32)>>s)<<32 | + uint64(uint16(hi>>48)>>s)<<48 + } + case wazeroir.ShapeI32x4: + s = s % 32 + if op.B3 { + lo = uint64(uint32(int32(lo)>>s)) | uint64(uint32(int32(lo>>32)>>s))<<32 + hi = uint64(uint32(int32(hi)>>s)) | uint64(uint32(int32(hi>>32)>>s))<<32 + } else { + lo = uint64(uint32(lo)>>s) | uint64(uint32(lo>>32)>>s)<<32 + hi = uint64(uint32(hi)>>s) | uint64(uint32(hi>>32)>>s)<<32 + } + case wazeroir.ShapeI64x2: + s = s % 64 + if op.B3 { // signed + lo = uint64(int64(lo) >> s) + hi = uint64(int64(hi) >> s) + } else { + lo = lo >> s + hi = hi >> s + } + + } + ce.pushValue(lo) + ce.pushValue(hi) + frame.pc++ + case wazeroir.OperationKindV128Cmp: + x2Hi, x2Lo := ce.popValue(), ce.popValue() + x1Hi, x1Lo := ce.popValue(), ce.popValue() + var result []bool + switch op.B1 { + case wazeroir.V128CmpTypeI8x16Eq: + result = []bool{ + byte(x1Lo>>0) == byte(x2Lo>>0), byte(x1Lo>>8) == byte(x2Lo>>8), + byte(x1Lo>>16) == byte(x2Lo>>16), byte(x1Lo>>24) == byte(x2Lo>>24), + byte(x1Lo>>32) == byte(x2Lo>>32), byte(x1Lo>>40) == byte(x2Lo>>40), + byte(x1Lo>>48) == byte(x2Lo>>48), byte(x1Lo>>56) == byte(x2Lo>>56), + byte(x1Hi>>0) == byte(x2Hi>>0), byte(x1Hi>>8) == byte(x2Hi>>8), + byte(x1Hi>>16) == byte(x2Hi>>16), byte(x1Hi>>24) == byte(x2Hi>>24), + byte(x1Hi>>32) == byte(x2Hi>>32), byte(x1Hi>>40) == byte(x2Hi>>40), + byte(x1Hi>>48) == byte(x2Hi>>48), byte(x1Hi>>56) == byte(x2Hi>>56), + } + case wazeroir.V128CmpTypeI8x16Ne: + result = []bool{ + byte(x1Lo>>0) != byte(x2Lo>>0), byte(x1Lo>>8) != byte(x2Lo>>8), + byte(x1Lo>>16) != byte(x2Lo>>16), byte(x1Lo>>24) != byte(x2Lo>>24), + byte(x1Lo>>32) != byte(x2Lo>>32), byte(x1Lo>>40) != byte(x2Lo>>40), + byte(x1Lo>>48) != byte(x2Lo>>48), byte(x1Lo>>56) != byte(x2Lo>>56), + byte(x1Hi>>0) != byte(x2Hi>>0), byte(x1Hi>>8) != byte(x2Hi>>8), + byte(x1Hi>>16) != byte(x2Hi>>16), byte(x1Hi>>24) != byte(x2Hi>>24), + byte(x1Hi>>32) != byte(x2Hi>>32), byte(x1Hi>>40) != byte(x2Hi>>40), + byte(x1Hi>>48) != byte(x2Hi>>48), byte(x1Hi>>56) != byte(x2Hi>>56), + } + case wazeroir.V128CmpTypeI8x16LtS: + result = []bool{ + int8(x1Lo>>0) < int8(x2Lo>>0), int8(x1Lo>>8) < int8(x2Lo>>8), + int8(x1Lo>>16) < int8(x2Lo>>16), int8(x1Lo>>24) < int8(x2Lo>>24), + int8(x1Lo>>32) < int8(x2Lo>>32), int8(x1Lo>>40) < int8(x2Lo>>40), + int8(x1Lo>>48) < int8(x2Lo>>48), int8(x1Lo>>56) < int8(x2Lo>>56), + int8(x1Hi>>0) < int8(x2Hi>>0), int8(x1Hi>>8) < int8(x2Hi>>8), + int8(x1Hi>>16) < int8(x2Hi>>16), int8(x1Hi>>24) < int8(x2Hi>>24), + int8(x1Hi>>32) < int8(x2Hi>>32), int8(x1Hi>>40) < int8(x2Hi>>40), + int8(x1Hi>>48) < int8(x2Hi>>48), int8(x1Hi>>56) < int8(x2Hi>>56), + } + case wazeroir.V128CmpTypeI8x16LtU: + result = []bool{ + byte(x1Lo>>0) < byte(x2Lo>>0), byte(x1Lo>>8) < byte(x2Lo>>8), + byte(x1Lo>>16) < byte(x2Lo>>16), byte(x1Lo>>24) < byte(x2Lo>>24), + byte(x1Lo>>32) < byte(x2Lo>>32), byte(x1Lo>>40) < byte(x2Lo>>40), + byte(x1Lo>>48) < byte(x2Lo>>48), byte(x1Lo>>56) < byte(x2Lo>>56), + byte(x1Hi>>0) < byte(x2Hi>>0), byte(x1Hi>>8) < byte(x2Hi>>8), + byte(x1Hi>>16) < byte(x2Hi>>16), byte(x1Hi>>24) < byte(x2Hi>>24), + byte(x1Hi>>32) < byte(x2Hi>>32), byte(x1Hi>>40) < byte(x2Hi>>40), + byte(x1Hi>>48) < byte(x2Hi>>48), byte(x1Hi>>56) < byte(x2Hi>>56), + } + case wazeroir.V128CmpTypeI8x16GtS: + result = []bool{ + int8(x1Lo>>0) > int8(x2Lo>>0), int8(x1Lo>>8) > int8(x2Lo>>8), + int8(x1Lo>>16) > int8(x2Lo>>16), int8(x1Lo>>24) > int8(x2Lo>>24), + int8(x1Lo>>32) > int8(x2Lo>>32), int8(x1Lo>>40) > int8(x2Lo>>40), + int8(x1Lo>>48) > int8(x2Lo>>48), int8(x1Lo>>56) > int8(x2Lo>>56), + int8(x1Hi>>0) > int8(x2Hi>>0), int8(x1Hi>>8) > int8(x2Hi>>8), + int8(x1Hi>>16) > int8(x2Hi>>16), int8(x1Hi>>24) > int8(x2Hi>>24), + int8(x1Hi>>32) > int8(x2Hi>>32), int8(x1Hi>>40) > int8(x2Hi>>40), + int8(x1Hi>>48) > int8(x2Hi>>48), int8(x1Hi>>56) > int8(x2Hi>>56), + } + case wazeroir.V128CmpTypeI8x16GtU: + result = []bool{ + byte(x1Lo>>0) > byte(x2Lo>>0), byte(x1Lo>>8) > byte(x2Lo>>8), + byte(x1Lo>>16) > byte(x2Lo>>16), byte(x1Lo>>24) > byte(x2Lo>>24), + byte(x1Lo>>32) > byte(x2Lo>>32), byte(x1Lo>>40) > byte(x2Lo>>40), + byte(x1Lo>>48) > byte(x2Lo>>48), byte(x1Lo>>56) > byte(x2Lo>>56), + byte(x1Hi>>0) > byte(x2Hi>>0), byte(x1Hi>>8) > byte(x2Hi>>8), + byte(x1Hi>>16) > byte(x2Hi>>16), byte(x1Hi>>24) > byte(x2Hi>>24), + byte(x1Hi>>32) > byte(x2Hi>>32), byte(x1Hi>>40) > byte(x2Hi>>40), + byte(x1Hi>>48) > byte(x2Hi>>48), byte(x1Hi>>56) > byte(x2Hi>>56), + } + case wazeroir.V128CmpTypeI8x16LeS: + result = []bool{ + int8(x1Lo>>0) <= int8(x2Lo>>0), int8(x1Lo>>8) <= int8(x2Lo>>8), + int8(x1Lo>>16) <= int8(x2Lo>>16), int8(x1Lo>>24) <= int8(x2Lo>>24), + int8(x1Lo>>32) <= int8(x2Lo>>32), int8(x1Lo>>40) <= int8(x2Lo>>40), + int8(x1Lo>>48) <= int8(x2Lo>>48), int8(x1Lo>>56) <= int8(x2Lo>>56), + int8(x1Hi>>0) <= int8(x2Hi>>0), int8(x1Hi>>8) <= int8(x2Hi>>8), + int8(x1Hi>>16) <= int8(x2Hi>>16), int8(x1Hi>>24) <= int8(x2Hi>>24), + int8(x1Hi>>32) <= int8(x2Hi>>32), int8(x1Hi>>40) <= int8(x2Hi>>40), + int8(x1Hi>>48) <= int8(x2Hi>>48), int8(x1Hi>>56) <= int8(x2Hi>>56), + } + case wazeroir.V128CmpTypeI8x16LeU: + result = []bool{ + byte(x1Lo>>0) <= byte(x2Lo>>0), byte(x1Lo>>8) <= byte(x2Lo>>8), + byte(x1Lo>>16) <= byte(x2Lo>>16), byte(x1Lo>>24) <= byte(x2Lo>>24), + byte(x1Lo>>32) <= byte(x2Lo>>32), byte(x1Lo>>40) <= byte(x2Lo>>40), + byte(x1Lo>>48) <= byte(x2Lo>>48), byte(x1Lo>>56) <= byte(x2Lo>>56), + byte(x1Hi>>0) <= byte(x2Hi>>0), byte(x1Hi>>8) <= byte(x2Hi>>8), + byte(x1Hi>>16) <= byte(x2Hi>>16), byte(x1Hi>>24) <= byte(x2Hi>>24), + byte(x1Hi>>32) <= byte(x2Hi>>32), byte(x1Hi>>40) <= byte(x2Hi>>40), + byte(x1Hi>>48) <= byte(x2Hi>>48), byte(x1Hi>>56) <= byte(x2Hi>>56), + } + case wazeroir.V128CmpTypeI8x16GeS: + result = []bool{ + int8(x1Lo>>0) >= int8(x2Lo>>0), int8(x1Lo>>8) >= int8(x2Lo>>8), + int8(x1Lo>>16) >= int8(x2Lo>>16), int8(x1Lo>>24) >= int8(x2Lo>>24), + int8(x1Lo>>32) >= int8(x2Lo>>32), int8(x1Lo>>40) >= int8(x2Lo>>40), + int8(x1Lo>>48) >= int8(x2Lo>>48), int8(x1Lo>>56) >= int8(x2Lo>>56), + int8(x1Hi>>0) >= int8(x2Hi>>0), int8(x1Hi>>8) >= int8(x2Hi>>8), + int8(x1Hi>>16) >= int8(x2Hi>>16), int8(x1Hi>>24) >= int8(x2Hi>>24), + int8(x1Hi>>32) >= int8(x2Hi>>32), int8(x1Hi>>40) >= int8(x2Hi>>40), + int8(x1Hi>>48) >= int8(x2Hi>>48), int8(x1Hi>>56) >= int8(x2Hi>>56), + } + case wazeroir.V128CmpTypeI8x16GeU: + result = []bool{ + byte(x1Lo>>0) >= byte(x2Lo>>0), byte(x1Lo>>8) >= byte(x2Lo>>8), + byte(x1Lo>>16) >= byte(x2Lo>>16), byte(x1Lo>>24) >= byte(x2Lo>>24), + byte(x1Lo>>32) >= byte(x2Lo>>32), byte(x1Lo>>40) >= byte(x2Lo>>40), + byte(x1Lo>>48) >= byte(x2Lo>>48), byte(x1Lo>>56) >= byte(x2Lo>>56), + byte(x1Hi>>0) >= byte(x2Hi>>0), byte(x1Hi>>8) >= byte(x2Hi>>8), + byte(x1Hi>>16) >= byte(x2Hi>>16), byte(x1Hi>>24) >= byte(x2Hi>>24), + byte(x1Hi>>32) >= byte(x2Hi>>32), byte(x1Hi>>40) >= byte(x2Hi>>40), + byte(x1Hi>>48) >= byte(x2Hi>>48), byte(x1Hi>>56) >= byte(x2Hi>>56), + } + case wazeroir.V128CmpTypeI16x8Eq: + result = []bool{ + uint16(x1Lo>>0) == uint16(x2Lo>>0), uint16(x1Lo>>16) == uint16(x2Lo>>16), + uint16(x1Lo>>32) == uint16(x2Lo>>32), uint16(x1Lo>>48) == uint16(x2Lo>>48), + uint16(x1Hi>>0) == uint16(x2Hi>>0), uint16(x1Hi>>16) == uint16(x2Hi>>16), + uint16(x1Hi>>32) == uint16(x2Hi>>32), uint16(x1Hi>>48) == uint16(x2Hi>>48), + } + case wazeroir.V128CmpTypeI16x8Ne: + result = []bool{ + uint16(x1Lo>>0) != uint16(x2Lo>>0), uint16(x1Lo>>16) != uint16(x2Lo>>16), + uint16(x1Lo>>32) != uint16(x2Lo>>32), uint16(x1Lo>>48) != uint16(x2Lo>>48), + uint16(x1Hi>>0) != uint16(x2Hi>>0), uint16(x1Hi>>16) != uint16(x2Hi>>16), + uint16(x1Hi>>32) != uint16(x2Hi>>32), uint16(x1Hi>>48) != uint16(x2Hi>>48), + } + case wazeroir.V128CmpTypeI16x8LtS: + result = []bool{ + int16(x1Lo>>0) < int16(x2Lo>>0), int16(x1Lo>>16) < int16(x2Lo>>16), + int16(x1Lo>>32) < int16(x2Lo>>32), int16(x1Lo>>48) < int16(x2Lo>>48), + int16(x1Hi>>0) < int16(x2Hi>>0), int16(x1Hi>>16) < int16(x2Hi>>16), + int16(x1Hi>>32) < int16(x2Hi>>32), int16(x1Hi>>48) < int16(x2Hi>>48), + } + case wazeroir.V128CmpTypeI16x8LtU: + result = []bool{ + uint16(x1Lo>>0) < uint16(x2Lo>>0), uint16(x1Lo>>16) < uint16(x2Lo>>16), + uint16(x1Lo>>32) < uint16(x2Lo>>32), uint16(x1Lo>>48) < uint16(x2Lo>>48), + uint16(x1Hi>>0) < uint16(x2Hi>>0), uint16(x1Hi>>16) < uint16(x2Hi>>16), + uint16(x1Hi>>32) < uint16(x2Hi>>32), uint16(x1Hi>>48) < uint16(x2Hi>>48), + } + case wazeroir.V128CmpTypeI16x8GtS: + result = []bool{ + int16(x1Lo>>0) > int16(x2Lo>>0), int16(x1Lo>>16) > int16(x2Lo>>16), + int16(x1Lo>>32) > int16(x2Lo>>32), int16(x1Lo>>48) > int16(x2Lo>>48), + int16(x1Hi>>0) > int16(x2Hi>>0), int16(x1Hi>>16) > int16(x2Hi>>16), + int16(x1Hi>>32) > int16(x2Hi>>32), int16(x1Hi>>48) > int16(x2Hi>>48), + } + case wazeroir.V128CmpTypeI16x8GtU: + result = []bool{ + uint16(x1Lo>>0) > uint16(x2Lo>>0), uint16(x1Lo>>16) > uint16(x2Lo>>16), + uint16(x1Lo>>32) > uint16(x2Lo>>32), uint16(x1Lo>>48) > uint16(x2Lo>>48), + uint16(x1Hi>>0) > uint16(x2Hi>>0), uint16(x1Hi>>16) > uint16(x2Hi>>16), + uint16(x1Hi>>32) > uint16(x2Hi>>32), uint16(x1Hi>>48) > uint16(x2Hi>>48), + } + case wazeroir.V128CmpTypeI16x8LeS: + result = []bool{ + int16(x1Lo>>0) <= int16(x2Lo>>0), int16(x1Lo>>16) <= int16(x2Lo>>16), + int16(x1Lo>>32) <= int16(x2Lo>>32), int16(x1Lo>>48) <= int16(x2Lo>>48), + int16(x1Hi>>0) <= int16(x2Hi>>0), int16(x1Hi>>16) <= int16(x2Hi>>16), + int16(x1Hi>>32) <= int16(x2Hi>>32), int16(x1Hi>>48) <= int16(x2Hi>>48), + } + case wazeroir.V128CmpTypeI16x8LeU: + result = []bool{ + uint16(x1Lo>>0) <= uint16(x2Lo>>0), uint16(x1Lo>>16) <= uint16(x2Lo>>16), + uint16(x1Lo>>32) <= uint16(x2Lo>>32), uint16(x1Lo>>48) <= uint16(x2Lo>>48), + uint16(x1Hi>>0) <= uint16(x2Hi>>0), uint16(x1Hi>>16) <= uint16(x2Hi>>16), + uint16(x1Hi>>32) <= uint16(x2Hi>>32), uint16(x1Hi>>48) <= uint16(x2Hi>>48), + } + case wazeroir.V128CmpTypeI16x8GeS: + result = []bool{ + int16(x1Lo>>0) >= int16(x2Lo>>0), int16(x1Lo>>16) >= int16(x2Lo>>16), + int16(x1Lo>>32) >= int16(x2Lo>>32), int16(x1Lo>>48) >= int16(x2Lo>>48), + int16(x1Hi>>0) >= int16(x2Hi>>0), int16(x1Hi>>16) >= int16(x2Hi>>16), + int16(x1Hi>>32) >= int16(x2Hi>>32), int16(x1Hi>>48) >= int16(x2Hi>>48), + } + case wazeroir.V128CmpTypeI16x8GeU: + result = []bool{ + uint16(x1Lo>>0) >= uint16(x2Lo>>0), uint16(x1Lo>>16) >= uint16(x2Lo>>16), + uint16(x1Lo>>32) >= uint16(x2Lo>>32), uint16(x1Lo>>48) >= uint16(x2Lo>>48), + uint16(x1Hi>>0) >= uint16(x2Hi>>0), uint16(x1Hi>>16) >= uint16(x2Hi>>16), + uint16(x1Hi>>32) >= uint16(x2Hi>>32), uint16(x1Hi>>48) >= uint16(x2Hi>>48), + } + case wazeroir.V128CmpTypeI32x4Eq: + result = []bool{ + uint32(x1Lo>>0) == uint32(x2Lo>>0), uint32(x1Lo>>32) == uint32(x2Lo>>32), + uint32(x1Hi>>0) == uint32(x2Hi>>0), uint32(x1Hi>>32) == uint32(x2Hi>>32), + } + case wazeroir.V128CmpTypeI32x4Ne: + result = []bool{ + uint32(x1Lo>>0) != uint32(x2Lo>>0), uint32(x1Lo>>32) != uint32(x2Lo>>32), + uint32(x1Hi>>0) != uint32(x2Hi>>0), uint32(x1Hi>>32) != uint32(x2Hi>>32), + } + case wazeroir.V128CmpTypeI32x4LtS: + result = []bool{ + int32(x1Lo>>0) < int32(x2Lo>>0), int32(x1Lo>>32) < int32(x2Lo>>32), + int32(x1Hi>>0) < int32(x2Hi>>0), int32(x1Hi>>32) < int32(x2Hi>>32), + } + case wazeroir.V128CmpTypeI32x4LtU: + result = []bool{ + uint32(x1Lo>>0) < uint32(x2Lo>>0), uint32(x1Lo>>32) < uint32(x2Lo>>32), + uint32(x1Hi>>0) < uint32(x2Hi>>0), uint32(x1Hi>>32) < uint32(x2Hi>>32), + } + case wazeroir.V128CmpTypeI32x4GtS: + result = []bool{ + int32(x1Lo>>0) > int32(x2Lo>>0), int32(x1Lo>>32) > int32(x2Lo>>32), + int32(x1Hi>>0) > int32(x2Hi>>0), int32(x1Hi>>32) > int32(x2Hi>>32), + } + case wazeroir.V128CmpTypeI32x4GtU: + result = []bool{ + uint32(x1Lo>>0) > uint32(x2Lo>>0), uint32(x1Lo>>32) > uint32(x2Lo>>32), + uint32(x1Hi>>0) > uint32(x2Hi>>0), uint32(x1Hi>>32) > uint32(x2Hi>>32), + } + case wazeroir.V128CmpTypeI32x4LeS: + result = []bool{ + int32(x1Lo>>0) <= int32(x2Lo>>0), int32(x1Lo>>32) <= int32(x2Lo>>32), + int32(x1Hi>>0) <= int32(x2Hi>>0), int32(x1Hi>>32) <= int32(x2Hi>>32), + } + case wazeroir.V128CmpTypeI32x4LeU: + result = []bool{ + uint32(x1Lo>>0) <= uint32(x2Lo>>0), uint32(x1Lo>>32) <= uint32(x2Lo>>32), + uint32(x1Hi>>0) <= uint32(x2Hi>>0), uint32(x1Hi>>32) <= uint32(x2Hi>>32), + } + case wazeroir.V128CmpTypeI32x4GeS: + result = []bool{ + int32(x1Lo>>0) >= int32(x2Lo>>0), int32(x1Lo>>32) >= int32(x2Lo>>32), + int32(x1Hi>>0) >= int32(x2Hi>>0), int32(x1Hi>>32) >= int32(x2Hi>>32), + } + case wazeroir.V128CmpTypeI32x4GeU: + result = []bool{ + uint32(x1Lo>>0) >= uint32(x2Lo>>0), uint32(x1Lo>>32) >= uint32(x2Lo>>32), + uint32(x1Hi>>0) >= uint32(x2Hi>>0), uint32(x1Hi>>32) >= uint32(x2Hi>>32), + } + case wazeroir.V128CmpTypeI64x2Eq: + result = []bool{x1Lo == x2Lo, x1Hi == x2Hi} + case wazeroir.V128CmpTypeI64x2Ne: + result = []bool{x1Lo != x2Lo, x1Hi != x2Hi} + case wazeroir.V128CmpTypeI64x2LtS: + result = []bool{int64(x1Lo) < int64(x2Lo), int64(x1Hi) < int64(x2Hi)} + case wazeroir.V128CmpTypeI64x2GtS: + result = []bool{int64(x1Lo) > int64(x2Lo), int64(x1Hi) > int64(x2Hi)} + case wazeroir.V128CmpTypeI64x2LeS: + result = []bool{int64(x1Lo) <= int64(x2Lo), int64(x1Hi) <= int64(x2Hi)} + case wazeroir.V128CmpTypeI64x2GeS: + result = []bool{int64(x1Lo) >= int64(x2Lo), int64(x1Hi) >= int64(x2Hi)} + case wazeroir.V128CmpTypeF32x4Eq: + result = []bool{ + math.Float32frombits(uint32(x1Lo>>0)) == math.Float32frombits(uint32(x2Lo>>0)), + math.Float32frombits(uint32(x1Lo>>32)) == math.Float32frombits(uint32(x2Lo>>32)), + math.Float32frombits(uint32(x1Hi>>0)) == math.Float32frombits(uint32(x2Hi>>0)), + math.Float32frombits(uint32(x1Hi>>32)) == math.Float32frombits(uint32(x2Hi>>32)), + } + case wazeroir.V128CmpTypeF32x4Ne: + result = []bool{ + math.Float32frombits(uint32(x1Lo>>0)) != math.Float32frombits(uint32(x2Lo>>0)), + math.Float32frombits(uint32(x1Lo>>32)) != math.Float32frombits(uint32(x2Lo>>32)), + math.Float32frombits(uint32(x1Hi>>0)) != math.Float32frombits(uint32(x2Hi>>0)), + math.Float32frombits(uint32(x1Hi>>32)) != math.Float32frombits(uint32(x2Hi>>32)), + } + case wazeroir.V128CmpTypeF32x4Lt: + result = []bool{ + math.Float32frombits(uint32(x1Lo>>0)) < math.Float32frombits(uint32(x2Lo>>0)), + math.Float32frombits(uint32(x1Lo>>32)) < math.Float32frombits(uint32(x2Lo>>32)), + math.Float32frombits(uint32(x1Hi>>0)) < math.Float32frombits(uint32(x2Hi>>0)), + math.Float32frombits(uint32(x1Hi>>32)) < math.Float32frombits(uint32(x2Hi>>32)), + } + case wazeroir.V128CmpTypeF32x4Gt: + result = []bool{ + math.Float32frombits(uint32(x1Lo>>0)) > math.Float32frombits(uint32(x2Lo>>0)), + math.Float32frombits(uint32(x1Lo>>32)) > math.Float32frombits(uint32(x2Lo>>32)), + math.Float32frombits(uint32(x1Hi>>0)) > math.Float32frombits(uint32(x2Hi>>0)), + math.Float32frombits(uint32(x1Hi>>32)) > math.Float32frombits(uint32(x2Hi>>32)), + } + case wazeroir.V128CmpTypeF32x4Le: + result = []bool{ + math.Float32frombits(uint32(x1Lo>>0)) <= math.Float32frombits(uint32(x2Lo>>0)), + math.Float32frombits(uint32(x1Lo>>32)) <= math.Float32frombits(uint32(x2Lo>>32)), + math.Float32frombits(uint32(x1Hi>>0)) <= math.Float32frombits(uint32(x2Hi>>0)), + math.Float32frombits(uint32(x1Hi>>32)) <= math.Float32frombits(uint32(x2Hi>>32)), + } + case wazeroir.V128CmpTypeF32x4Ge: + result = []bool{ + math.Float32frombits(uint32(x1Lo>>0)) >= math.Float32frombits(uint32(x2Lo>>0)), + math.Float32frombits(uint32(x1Lo>>32)) >= math.Float32frombits(uint32(x2Lo>>32)), + math.Float32frombits(uint32(x1Hi>>0)) >= math.Float32frombits(uint32(x2Hi>>0)), + math.Float32frombits(uint32(x1Hi>>32)) >= math.Float32frombits(uint32(x2Hi>>32)), + } + case wazeroir.V128CmpTypeF64x2Eq: + result = []bool{ + math.Float64frombits(x1Lo) == math.Float64frombits(x2Lo), + math.Float64frombits(x1Hi) == math.Float64frombits(x2Hi), + } + case wazeroir.V128CmpTypeF64x2Ne: + result = []bool{ + math.Float64frombits(x1Lo) != math.Float64frombits(x2Lo), + math.Float64frombits(x1Hi) != math.Float64frombits(x2Hi), + } + case wazeroir.V128CmpTypeF64x2Lt: + result = []bool{ + math.Float64frombits(x1Lo) < math.Float64frombits(x2Lo), + math.Float64frombits(x1Hi) < math.Float64frombits(x2Hi), + } + case wazeroir.V128CmpTypeF64x2Gt: + result = []bool{ + math.Float64frombits(x1Lo) > math.Float64frombits(x2Lo), + math.Float64frombits(x1Hi) > math.Float64frombits(x2Hi), + } + case wazeroir.V128CmpTypeF64x2Le: + result = []bool{ + math.Float64frombits(x1Lo) <= math.Float64frombits(x2Lo), + math.Float64frombits(x1Hi) <= math.Float64frombits(x2Hi), + } + case wazeroir.V128CmpTypeF64x2Ge: + result = []bool{ + math.Float64frombits(x1Lo) >= math.Float64frombits(x2Lo), + math.Float64frombits(x1Hi) >= math.Float64frombits(x2Hi), + } + } + + var retLo, retHi uint64 + laneNum := len(result) + switch laneNum { + case 16: + for i, b := range result { + if b { + if i < 8 { + retLo |= 0xff << (i * 8) + } else { + retHi |= 0xff << ((i - 8) * 8) + } + } + } + case 8: + for i, b := range result { + if b { + if i < 4 { + retLo |= 0xffff << (i * 16) + } else { + retHi |= 0xffff << ((i - 4) * 16) + } + } + } + case 4: + for i, b := range result { + if b { + if i < 2 { + retLo |= 0xffff_ffff << (i * 32) + } else { + retHi |= 0xffff_ffff << ((i - 2) * 32) + } + } + } + case 2: + if result[0] { + retLo = ^uint64(0) + } + if result[1] { + retHi = ^uint64(0) + } + } + + ce.pushValue(retLo) + ce.pushValue(retHi) + frame.pc++ + case wazeroir.OperationKindV128AddSat: + x2hi, x2Lo := ce.popValue(), ce.popValue() + x1hi, x1Lo := ce.popValue(), ce.popValue() + + var retLo, retHi uint64 + + // Lane-wise addition while saturating the overflowing values. + // https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/simd/SIMD.md#saturating-integer-addition + switch op.B1 { + case wazeroir.ShapeI8x16: + for i := 0; i < 16; i++ { + var v, w byte + if i < 8 { + v, w = byte(x1Lo>>(i*8)), byte(x2Lo>>(i*8)) + } else { + v, w = byte(x1hi>>((i-8)*8)), byte(x2hi>>((i-8)*8)) + } + + var uv uint64 + if op.B3 { // signed + if subbed := int64(int8(v)) + int64(int8(w)); subbed < math.MinInt8 { + uv = uint64(byte(0x80)) + } else if subbed > math.MaxInt8 { + uv = uint64(byte(0x7f)) + } else { + uv = uint64(byte(int8(subbed))) + } + } else { + if subbed := int64(v) + int64(w); subbed < 0 { + uv = uint64(byte(0)) + } else if subbed > math.MaxUint8 { + uv = uint64(byte(0xff)) + } else { + uv = uint64(byte(subbed)) + } + } + + if i < 8 { // first 8 lanes are on lower 64bits. + retLo |= uv << (i * 8) + } else { + retHi |= uv << ((i - 8) * 8) + } + } + case wazeroir.ShapeI16x8: + for i := 0; i < 8; i++ { + var v, w uint16 + if i < 4 { + v, w = uint16(x1Lo>>(i*16)), uint16(x2Lo>>(i*16)) + } else { + v, w = uint16(x1hi>>((i-4)*16)), uint16(x2hi>>((i-4)*16)) + } + + var uv uint64 + if op.B3 { // signed + if added := int64(int16(v)) + int64(int16(w)); added < math.MinInt16 { + uv = uint64(uint16(0x8000)) + } else if added > math.MaxInt16 { + uv = uint64(uint16(0x7fff)) + } else { + uv = uint64(uint16(int16(added))) + } + } else { + if added := int64(v) + int64(w); added < 0 { + uv = uint64(uint16(0)) + } else if added > math.MaxUint16 { + uv = uint64(uint16(0xffff)) + } else { + uv = uint64(uint16(added)) + } + } + + if i < 4 { // first 4 lanes are on lower 64bits. + retLo |= uv << (i * 16) + } else { + retHi |= uv << ((i - 4) * 16) + } + } + } + + ce.pushValue(retLo) + ce.pushValue(retHi) + frame.pc++ + case wazeroir.OperationKindV128SubSat: + x2hi, x2Lo := ce.popValue(), ce.popValue() + x1hi, x1Lo := ce.popValue(), ce.popValue() + + var retLo, retHi uint64 + + // Lane-wise subtraction while saturating the overflowing values. + // https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/simd/SIMD.md#saturating-integer-subtraction + switch op.B1 { + case wazeroir.ShapeI8x16: + for i := 0; i < 16; i++ { + var v, w byte + if i < 8 { + v, w = byte(x1Lo>>(i*8)), byte(x2Lo>>(i*8)) + } else { + v, w = byte(x1hi>>((i-8)*8)), byte(x2hi>>((i-8)*8)) + } + + var uv uint64 + if op.B3 { // signed + if subbed := int64(int8(v)) - int64(int8(w)); subbed < math.MinInt8 { + uv = uint64(byte(0x80)) + } else if subbed > math.MaxInt8 { + uv = uint64(byte(0x7f)) + } else { + uv = uint64(byte(int8(subbed))) + } + } else { + if subbed := int64(v) - int64(w); subbed < 0 { + uv = uint64(byte(0)) + } else if subbed > math.MaxUint8 { + uv = uint64(byte(0xff)) + } else { + uv = uint64(byte(subbed)) + } + } + + if i < 8 { + retLo |= uv << (i * 8) + } else { + retHi |= uv << ((i - 8) * 8) + } + } + case wazeroir.ShapeI16x8: + for i := 0; i < 8; i++ { + var v, w uint16 + if i < 4 { + v, w = uint16(x1Lo>>(i*16)), uint16(x2Lo>>(i*16)) + } else { + v, w = uint16(x1hi>>((i-4)*16)), uint16(x2hi>>((i-4)*16)) + } + + var uv uint64 + if op.B3 { // signed + if subbed := int64(int16(v)) - int64(int16(w)); subbed < math.MinInt16 { + uv = uint64(uint16(0x8000)) + } else if subbed > math.MaxInt16 { + uv = uint64(uint16(0x7fff)) + } else { + uv = uint64(uint16(int16(subbed))) + } + } else { + if subbed := int64(v) - int64(w); subbed < 0 { + uv = uint64(uint16(0)) + } else if subbed > math.MaxUint16 { + uv = uint64(uint16(0xffff)) + } else { + uv = uint64(uint16(subbed)) + } + } + + if i < 4 { + retLo |= uv << (i * 16) + } else { + retHi |= uv << ((i - 4) * 16) + } + } + } + + ce.pushValue(retLo) + ce.pushValue(retHi) + frame.pc++ + case wazeroir.OperationKindV128Mul: + x2hi, x2lo := ce.popValue(), ce.popValue() + x1hi, x1lo := ce.popValue(), ce.popValue() + var retLo, retHi uint64 + switch op.B1 { + case wazeroir.ShapeI16x8: + retHi = uint64(uint16(x1hi)*uint16(x2hi)) | (uint64(uint16(x1hi>>16)*uint16(x2hi>>16)) << 16) | + (uint64(uint16(x1hi>>32)*uint16(x2hi>>32)) << 32) | (uint64(uint16(x1hi>>48)*uint16(x2hi>>48)) << 48) + retLo = uint64(uint16(x1lo)*uint16(x2lo)) | (uint64(uint16(x1lo>>16)*uint16(x2lo>>16)) << 16) | + (uint64(uint16(x1lo>>32)*uint16(x2lo>>32)) << 32) | (uint64(uint16(x1lo>>48)*uint16(x2lo>>48)) << 48) + case wazeroir.ShapeI32x4: + retHi = uint64(uint32(x1hi)*uint32(x2hi)) | (uint64(uint32(x1hi>>32)*uint32(x2hi>>32)) << 32) + retLo = uint64(uint32(x1lo)*uint32(x2lo)) | (uint64(uint32(x1lo>>32)*uint32(x2lo>>32)) << 32) + case wazeroir.ShapeI64x2: + retHi = x1hi * x2hi + retLo = x1lo * x2lo + case wazeroir.ShapeF32x4: + retHi = mulFloat32bits(uint32(x1hi), uint32(x2hi)) | mulFloat32bits(uint32(x1hi>>32), uint32(x2hi>>32))<<32 + retLo = mulFloat32bits(uint32(x1lo), uint32(x2lo)) | mulFloat32bits(uint32(x1lo>>32), uint32(x2lo>>32))<<32 + case wazeroir.ShapeF64x2: + retHi = math.Float64bits(math.Float64frombits(x1hi) * math.Float64frombits(x2hi)) + retLo = math.Float64bits(math.Float64frombits(x1lo) * math.Float64frombits(x2lo)) + } + ce.pushValue(retLo) + ce.pushValue(retHi) + frame.pc++ + case wazeroir.OperationKindV128Div: + x2hi, x2lo := ce.popValue(), ce.popValue() + x1hi, x1lo := ce.popValue(), ce.popValue() + var retLo, retHi uint64 + if op.B1 == wazeroir.ShapeF64x2 { + retHi = math.Float64bits(math.Float64frombits(x1hi) / math.Float64frombits(x2hi)) + retLo = math.Float64bits(math.Float64frombits(x1lo) / math.Float64frombits(x2lo)) + } else { + retHi = divFloat32bits(uint32(x1hi), uint32(x2hi)) | divFloat32bits(uint32(x1hi>>32), uint32(x2hi>>32))<<32 + retLo = divFloat32bits(uint32(x1lo), uint32(x2lo)) | divFloat32bits(uint32(x1lo>>32), uint32(x2lo>>32))<<32 + } + ce.pushValue(retLo) + ce.pushValue(retHi) + frame.pc++ + case wazeroir.OperationKindV128Neg: + hi, lo := ce.popValue(), ce.popValue() + switch op.B1 { + case wazeroir.ShapeI8x16: + lo = uint64(-byte(lo)) | (uint64(-byte(lo>>8)) << 8) | + (uint64(-byte(lo>>16)) << 16) | (uint64(-byte(lo>>24)) << 24) | + (uint64(-byte(lo>>32)) << 32) | (uint64(-byte(lo>>40)) << 40) | + (uint64(-byte(lo>>48)) << 48) | (uint64(-byte(lo>>56)) << 56) + hi = uint64(-byte(hi)) | (uint64(-byte(hi>>8)) << 8) | + (uint64(-byte(hi>>16)) << 16) | (uint64(-byte(hi>>24)) << 24) | + (uint64(-byte(hi>>32)) << 32) | (uint64(-byte(hi>>40)) << 40) | + (uint64(-byte(hi>>48)) << 48) | (uint64(-byte(hi>>56)) << 56) + case wazeroir.ShapeI16x8: + hi = uint64(-uint16(hi)) | (uint64(-uint16(hi>>16)) << 16) | + (uint64(-uint16(hi>>32)) << 32) | (uint64(-uint16(hi>>48)) << 48) + lo = uint64(-uint16(lo)) | (uint64(-uint16(lo>>16)) << 16) | + (uint64(-uint16(lo>>32)) << 32) | (uint64(-uint16(lo>>48)) << 48) + case wazeroir.ShapeI32x4: + hi = uint64(-uint32(hi)) | (uint64(-uint32(hi>>32)) << 32) + lo = uint64(-uint32(lo)) | (uint64(-uint32(lo>>32)) << 32) + case wazeroir.ShapeI64x2: + hi = -hi + lo = -lo + case wazeroir.ShapeF32x4: + hi = uint64(math.Float32bits(-math.Float32frombits(uint32(hi)))) | + (uint64(math.Float32bits(-math.Float32frombits(uint32(hi>>32)))) << 32) + lo = uint64(math.Float32bits(-math.Float32frombits(uint32(lo)))) | + (uint64(math.Float32bits(-math.Float32frombits(uint32(lo>>32)))) << 32) + case wazeroir.ShapeF64x2: + hi = math.Float64bits(-math.Float64frombits(hi)) + lo = math.Float64bits(-math.Float64frombits(lo)) + } + ce.pushValue(lo) + ce.pushValue(hi) + frame.pc++ + case wazeroir.OperationKindV128Sqrt: + hi, lo := ce.popValue(), ce.popValue() + if op.B1 == wazeroir.ShapeF64x2 { + hi = math.Float64bits(math.Sqrt(math.Float64frombits(hi))) + lo = math.Float64bits(math.Sqrt(math.Float64frombits(lo))) + } else { + hi = uint64(math.Float32bits(float32(math.Sqrt(float64(math.Float32frombits(uint32(hi))))))) | + (uint64(math.Float32bits(float32(math.Sqrt(float64(math.Float32frombits(uint32(hi>>32))))))) << 32) + lo = uint64(math.Float32bits(float32(math.Sqrt(float64(math.Float32frombits(uint32(lo))))))) | + (uint64(math.Float32bits(float32(math.Sqrt(float64(math.Float32frombits(uint32(lo>>32))))))) << 32) + } + ce.pushValue(lo) + ce.pushValue(hi) + frame.pc++ + case wazeroir.OperationKindV128Abs: + hi, lo := ce.popValue(), ce.popValue() + switch op.B1 { + case wazeroir.ShapeI8x16: + lo = uint64(i8Abs(byte(lo))) | (uint64(i8Abs(byte(lo>>8))) << 8) | + (uint64(i8Abs(byte(lo>>16))) << 16) | (uint64(i8Abs(byte(lo>>24))) << 24) | + (uint64(i8Abs(byte(lo>>32))) << 32) | (uint64(i8Abs(byte(lo>>40))) << 40) | + (uint64(i8Abs(byte(lo>>48))) << 48) | (uint64(i8Abs(byte(lo>>56))) << 56) + hi = uint64(i8Abs(byte(hi))) | (uint64(i8Abs(byte(hi>>8))) << 8) | + (uint64(i8Abs(byte(hi>>16))) << 16) | (uint64(i8Abs(byte(hi>>24))) << 24) | + (uint64(i8Abs(byte(hi>>32))) << 32) | (uint64(i8Abs(byte(hi>>40))) << 40) | + (uint64(i8Abs(byte(hi>>48))) << 48) | (uint64(i8Abs(byte(hi>>56))) << 56) + case wazeroir.ShapeI16x8: + hi = uint64(i16Abs(uint16(hi))) | (uint64(i16Abs(uint16(hi>>16))) << 16) | + (uint64(i16Abs(uint16(hi>>32))) << 32) | (uint64(i16Abs(uint16(hi>>48))) << 48) + lo = uint64(i16Abs(uint16(lo))) | (uint64(i16Abs(uint16(lo>>16))) << 16) | + (uint64(i16Abs(uint16(lo>>32))) << 32) | (uint64(i16Abs(uint16(lo>>48))) << 48) + case wazeroir.ShapeI32x4: + hi = uint64(i32Abs(uint32(hi))) | (uint64(i32Abs(uint32(hi>>32))) << 32) + lo = uint64(i32Abs(uint32(lo))) | (uint64(i32Abs(uint32(lo>>32))) << 32) + case wazeroir.ShapeI64x2: + if int64(hi) < 0 { + hi = -hi + } + if int64(lo) < 0 { + lo = -lo + } + case wazeroir.ShapeF32x4: + hi = hi &^ (1<<31 | 1<<63) + lo = lo &^ (1<<31 | 1<<63) + case wazeroir.ShapeF64x2: + hi = hi &^ (1 << 63) + lo = lo &^ (1 << 63) + } + ce.pushValue(lo) + ce.pushValue(hi) + frame.pc++ + case wazeroir.OperationKindV128Popcnt: + hi, lo := ce.popValue(), ce.popValue() + var retLo, retHi uint64 + for i := 0; i < 16; i++ { + var v byte + if i < 8 { + v = byte(lo >> (i * 8)) + } else { + v = byte(hi >> ((i - 8) * 8)) + } + + var cnt uint64 + for i := 0; i < 8; i++ { + if (v>>i)&0b1 != 0 { + cnt++ + } + } + + if i < 8 { + retLo |= cnt << (i * 8) + } else { + retHi |= cnt << ((i - 8) * 8) + } + } + ce.pushValue(retLo) + ce.pushValue(retHi) + frame.pc++ + case wazeroir.OperationKindV128Min: + x2hi, x2lo := ce.popValue(), ce.popValue() + x1hi, x1lo := ce.popValue(), ce.popValue() + var retLo, retHi uint64 + switch op.B1 { + case wazeroir.ShapeI8x16: + if op.B3 { // signed + retLo = uint64(i8MinS(uint8(x1lo>>8), uint8(x2lo>>8)))<<8 | uint64(i8MinS(uint8(x1lo), uint8(x2lo))) | + uint64(i8MinS(uint8(x1lo>>24), uint8(x2lo>>24)))<<24 | uint64(i8MinS(uint8(x1lo>>16), uint8(x2lo>>16)))<<16 | + uint64(i8MinS(uint8(x1lo>>40), uint8(x2lo>>40)))<<40 | uint64(i8MinS(uint8(x1lo>>32), uint8(x2lo>>32)))<<32 | + uint64(i8MinS(uint8(x1lo>>56), uint8(x2lo>>56)))<<56 | uint64(i8MinS(uint8(x1lo>>48), uint8(x2lo>>48)))<<48 + retHi = uint64(i8MinS(uint8(x1hi>>8), uint8(x2hi>>8)))<<8 | uint64(i8MinS(uint8(x1hi), uint8(x2hi))) | + uint64(i8MinS(uint8(x1hi>>24), uint8(x2hi>>24)))<<24 | uint64(i8MinS(uint8(x1hi>>16), uint8(x2hi>>16)))<<16 | + uint64(i8MinS(uint8(x1hi>>40), uint8(x2hi>>40)))<<40 | uint64(i8MinS(uint8(x1hi>>32), uint8(x2hi>>32)))<<32 | + uint64(i8MinS(uint8(x1hi>>56), uint8(x2hi>>56)))<<56 | uint64(i8MinS(uint8(x1hi>>48), uint8(x2hi>>48)))<<48 + } else { + retLo = uint64(i8MinU(uint8(x1lo>>8), uint8(x2lo>>8)))<<8 | uint64(i8MinU(uint8(x1lo), uint8(x2lo))) | + uint64(i8MinU(uint8(x1lo>>24), uint8(x2lo>>24)))<<24 | uint64(i8MinU(uint8(x1lo>>16), uint8(x2lo>>16)))<<16 | + uint64(i8MinU(uint8(x1lo>>40), uint8(x2lo>>40)))<<40 | uint64(i8MinU(uint8(x1lo>>32), uint8(x2lo>>32)))<<32 | + uint64(i8MinU(uint8(x1lo>>56), uint8(x2lo>>56)))<<56 | uint64(i8MinU(uint8(x1lo>>48), uint8(x2lo>>48)))<<48 + retHi = uint64(i8MinU(uint8(x1hi>>8), uint8(x2hi>>8)))<<8 | uint64(i8MinU(uint8(x1hi), uint8(x2hi))) | + uint64(i8MinU(uint8(x1hi>>24), uint8(x2hi>>24)))<<24 | uint64(i8MinU(uint8(x1hi>>16), uint8(x2hi>>16)))<<16 | + uint64(i8MinU(uint8(x1hi>>40), uint8(x2hi>>40)))<<40 | uint64(i8MinU(uint8(x1hi>>32), uint8(x2hi>>32)))<<32 | + uint64(i8MinU(uint8(x1hi>>56), uint8(x2hi>>56)))<<56 | uint64(i8MinU(uint8(x1hi>>48), uint8(x2hi>>48)))<<48 + } + case wazeroir.ShapeI16x8: + if op.B3 { // signed + retLo = uint64(i16MinS(uint16(x1lo), uint16(x2lo))) | + uint64(i16MinS(uint16(x1lo>>16), uint16(x2lo>>16)))<<16 | + uint64(i16MinS(uint16(x1lo>>32), uint16(x2lo>>32)))<<32 | + uint64(i16MinS(uint16(x1lo>>48), uint16(x2lo>>48)))<<48 + retHi = uint64(i16MinS(uint16(x1hi), uint16(x2hi))) | + uint64(i16MinS(uint16(x1hi>>16), uint16(x2hi>>16)))<<16 | + uint64(i16MinS(uint16(x1hi>>32), uint16(x2hi>>32)))<<32 | + uint64(i16MinS(uint16(x1hi>>48), uint16(x2hi>>48)))<<48 + } else { + retLo = uint64(i16MinU(uint16(x1lo), uint16(x2lo))) | + uint64(i16MinU(uint16(x1lo>>16), uint16(x2lo>>16)))<<16 | + uint64(i16MinU(uint16(x1lo>>32), uint16(x2lo>>32)))<<32 | + uint64(i16MinU(uint16(x1lo>>48), uint16(x2lo>>48)))<<48 + retHi = uint64(i16MinU(uint16(x1hi), uint16(x2hi))) | + uint64(i16MinU(uint16(x1hi>>16), uint16(x2hi>>16)))<<16 | + uint64(i16MinU(uint16(x1hi>>32), uint16(x2hi>>32)))<<32 | + uint64(i16MinU(uint16(x1hi>>48), uint16(x2hi>>48)))<<48 + } + case wazeroir.ShapeI32x4: + if op.B3 { // signed + retLo = uint64(i32MinS(uint32(x1lo), uint32(x2lo))) | + uint64(i32MinS(uint32(x1lo>>32), uint32(x2lo>>32)))<<32 + retHi = uint64(i32MinS(uint32(x1hi), uint32(x2hi))) | + uint64(i32MinS(uint32(x1hi>>32), uint32(x2hi>>32)))<<32 + } else { + retLo = uint64(i32MinU(uint32(x1lo), uint32(x2lo))) | + uint64(i32MinU(uint32(x1lo>>32), uint32(x2lo>>32)))<<32 + retHi = uint64(i32MinU(uint32(x1hi), uint32(x2hi))) | + uint64(i32MinU(uint32(x1hi>>32), uint32(x2hi>>32)))<<32 + } + case wazeroir.ShapeF32x4: + retHi = WasmCompatMin32bits(uint32(x1hi), uint32(x2hi)) | + WasmCompatMin32bits(uint32(x1hi>>32), uint32(x2hi>>32))<<32 + retLo = WasmCompatMin32bits(uint32(x1lo), uint32(x2lo)) | + WasmCompatMin32bits(uint32(x1lo>>32), uint32(x2lo>>32))<<32 + case wazeroir.ShapeF64x2: + retHi = math.Float64bits(moremath.WasmCompatMin64( + math.Float64frombits(x1hi), + math.Float64frombits(x2hi), + )) + retLo = math.Float64bits(moremath.WasmCompatMin64( + math.Float64frombits(x1lo), + math.Float64frombits(x2lo), + )) + } + ce.pushValue(retLo) + ce.pushValue(retHi) + frame.pc++ + case wazeroir.OperationKindV128Max: + x2hi, x2lo := ce.popValue(), ce.popValue() + x1hi, x1lo := ce.popValue(), ce.popValue() + var retLo, retHi uint64 + switch op.B1 { + case wazeroir.ShapeI8x16: + if op.B3 { // signed + retLo = uint64(i8MaxS(uint8(x1lo>>8), uint8(x2lo>>8)))<<8 | uint64(i8MaxS(uint8(x1lo), uint8(x2lo))) | + uint64(i8MaxS(uint8(x1lo>>24), uint8(x2lo>>24)))<<24 | uint64(i8MaxS(uint8(x1lo>>16), uint8(x2lo>>16)))<<16 | + uint64(i8MaxS(uint8(x1lo>>40), uint8(x2lo>>40)))<<40 | uint64(i8MaxS(uint8(x1lo>>32), uint8(x2lo>>32)))<<32 | + uint64(i8MaxS(uint8(x1lo>>56), uint8(x2lo>>56)))<<56 | uint64(i8MaxS(uint8(x1lo>>48), uint8(x2lo>>48)))<<48 + retHi = uint64(i8MaxS(uint8(x1hi>>8), uint8(x2hi>>8)))<<8 | uint64(i8MaxS(uint8(x1hi), uint8(x2hi))) | + uint64(i8MaxS(uint8(x1hi>>24), uint8(x2hi>>24)))<<24 | uint64(i8MaxS(uint8(x1hi>>16), uint8(x2hi>>16)))<<16 | + uint64(i8MaxS(uint8(x1hi>>40), uint8(x2hi>>40)))<<40 | uint64(i8MaxS(uint8(x1hi>>32), uint8(x2hi>>32)))<<32 | + uint64(i8MaxS(uint8(x1hi>>56), uint8(x2hi>>56)))<<56 | uint64(i8MaxS(uint8(x1hi>>48), uint8(x2hi>>48)))<<48 + } else { + retLo = uint64(i8MaxU(uint8(x1lo>>8), uint8(x2lo>>8)))<<8 | uint64(i8MaxU(uint8(x1lo), uint8(x2lo))) | + uint64(i8MaxU(uint8(x1lo>>24), uint8(x2lo>>24)))<<24 | uint64(i8MaxU(uint8(x1lo>>16), uint8(x2lo>>16)))<<16 | + uint64(i8MaxU(uint8(x1lo>>40), uint8(x2lo>>40)))<<40 | uint64(i8MaxU(uint8(x1lo>>32), uint8(x2lo>>32)))<<32 | + uint64(i8MaxU(uint8(x1lo>>56), uint8(x2lo>>56)))<<56 | uint64(i8MaxU(uint8(x1lo>>48), uint8(x2lo>>48)))<<48 + retHi = uint64(i8MaxU(uint8(x1hi>>8), uint8(x2hi>>8)))<<8 | uint64(i8MaxU(uint8(x1hi), uint8(x2hi))) | + uint64(i8MaxU(uint8(x1hi>>24), uint8(x2hi>>24)))<<24 | uint64(i8MaxU(uint8(x1hi>>16), uint8(x2hi>>16)))<<16 | + uint64(i8MaxU(uint8(x1hi>>40), uint8(x2hi>>40)))<<40 | uint64(i8MaxU(uint8(x1hi>>32), uint8(x2hi>>32)))<<32 | + uint64(i8MaxU(uint8(x1hi>>56), uint8(x2hi>>56)))<<56 | uint64(i8MaxU(uint8(x1hi>>48), uint8(x2hi>>48)))<<48 + } + case wazeroir.ShapeI16x8: + if op.B3 { // signed + retLo = uint64(i16MaxS(uint16(x1lo), uint16(x2lo))) | + uint64(i16MaxS(uint16(x1lo>>16), uint16(x2lo>>16)))<<16 | + uint64(i16MaxS(uint16(x1lo>>32), uint16(x2lo>>32)))<<32 | + uint64(i16MaxS(uint16(x1lo>>48), uint16(x2lo>>48)))<<48 + retHi = uint64(i16MaxS(uint16(x1hi), uint16(x2hi))) | + uint64(i16MaxS(uint16(x1hi>>16), uint16(x2hi>>16)))<<16 | + uint64(i16MaxS(uint16(x1hi>>32), uint16(x2hi>>32)))<<32 | + uint64(i16MaxS(uint16(x1hi>>48), uint16(x2hi>>48)))<<48 + } else { + retLo = uint64(i16MaxU(uint16(x1lo), uint16(x2lo))) | + uint64(i16MaxU(uint16(x1lo>>16), uint16(x2lo>>16)))<<16 | + uint64(i16MaxU(uint16(x1lo>>32), uint16(x2lo>>32)))<<32 | + uint64(i16MaxU(uint16(x1lo>>48), uint16(x2lo>>48)))<<48 + retHi = uint64(i16MaxU(uint16(x1hi), uint16(x2hi))) | + uint64(i16MaxU(uint16(x1hi>>16), uint16(x2hi>>16)))<<16 | + uint64(i16MaxU(uint16(x1hi>>32), uint16(x2hi>>32)))<<32 | + uint64(i16MaxU(uint16(x1hi>>48), uint16(x2hi>>48)))<<48 + } + case wazeroir.ShapeI32x4: + if op.B3 { // signed + retLo = uint64(i32MaxS(uint32(x1lo), uint32(x2lo))) | + uint64(i32MaxS(uint32(x1lo>>32), uint32(x2lo>>32)))<<32 + retHi = uint64(i32MaxS(uint32(x1hi), uint32(x2hi))) | + uint64(i32MaxS(uint32(x1hi>>32), uint32(x2hi>>32)))<<32 + } else { + retLo = uint64(i32MaxU(uint32(x1lo), uint32(x2lo))) | + uint64(i32MaxU(uint32(x1lo>>32), uint32(x2lo>>32)))<<32 + retHi = uint64(i32MaxU(uint32(x1hi), uint32(x2hi))) | + uint64(i32MaxU(uint32(x1hi>>32), uint32(x2hi>>32)))<<32 + } + case wazeroir.ShapeF32x4: + retHi = WasmCompatMax32bits(uint32(x1hi), uint32(x2hi)) | + WasmCompatMax32bits(uint32(x1hi>>32), uint32(x2hi>>32))<<32 + retLo = WasmCompatMax32bits(uint32(x1lo), uint32(x2lo)) | + WasmCompatMax32bits(uint32(x1lo>>32), uint32(x2lo>>32))<<32 + case wazeroir.ShapeF64x2: + retHi = math.Float64bits(moremath.WasmCompatMax64( + math.Float64frombits(x1hi), + math.Float64frombits(x2hi), + )) + retLo = math.Float64bits(moremath.WasmCompatMax64( + math.Float64frombits(x1lo), + math.Float64frombits(x2lo), + )) + } + ce.pushValue(retLo) + ce.pushValue(retHi) + frame.pc++ + case wazeroir.OperationKindV128AvgrU: + x2hi, x2lo := ce.popValue(), ce.popValue() + x1hi, x1lo := ce.popValue(), ce.popValue() + var retLo, retHi uint64 + switch op.B1 { + case wazeroir.ShapeI8x16: + retLo = uint64(i8RoundingAverage(uint8(x1lo>>8), uint8(x2lo>>8)))<<8 | uint64(i8RoundingAverage(uint8(x1lo), uint8(x2lo))) | + uint64(i8RoundingAverage(uint8(x1lo>>24), uint8(x2lo>>24)))<<24 | uint64(i8RoundingAverage(uint8(x1lo>>16), uint8(x2lo>>16)))<<16 | + uint64(i8RoundingAverage(uint8(x1lo>>40), uint8(x2lo>>40)))<<40 | uint64(i8RoundingAverage(uint8(x1lo>>32), uint8(x2lo>>32)))<<32 | + uint64(i8RoundingAverage(uint8(x1lo>>56), uint8(x2lo>>56)))<<56 | uint64(i8RoundingAverage(uint8(x1lo>>48), uint8(x2lo>>48)))<<48 + retHi = uint64(i8RoundingAverage(uint8(x1hi>>8), uint8(x2hi>>8)))<<8 | uint64(i8RoundingAverage(uint8(x1hi), uint8(x2hi))) | + uint64(i8RoundingAverage(uint8(x1hi>>24), uint8(x2hi>>24)))<<24 | uint64(i8RoundingAverage(uint8(x1hi>>16), uint8(x2hi>>16)))<<16 | + uint64(i8RoundingAverage(uint8(x1hi>>40), uint8(x2hi>>40)))<<40 | uint64(i8RoundingAverage(uint8(x1hi>>32), uint8(x2hi>>32)))<<32 | + uint64(i8RoundingAverage(uint8(x1hi>>56), uint8(x2hi>>56)))<<56 | uint64(i8RoundingAverage(uint8(x1hi>>48), uint8(x2hi>>48)))<<48 + case wazeroir.ShapeI16x8: + retLo = uint64(i16RoundingAverage(uint16(x1lo), uint16(x2lo))) | + uint64(i16RoundingAverage(uint16(x1lo>>16), uint16(x2lo>>16)))<<16 | + uint64(i16RoundingAverage(uint16(x1lo>>32), uint16(x2lo>>32)))<<32 | + uint64(i16RoundingAverage(uint16(x1lo>>48), uint16(x2lo>>48)))<<48 + retHi = uint64(i16RoundingAverage(uint16(x1hi), uint16(x2hi))) | + uint64(i16RoundingAverage(uint16(x1hi>>16), uint16(x2hi>>16)))<<16 | + uint64(i16RoundingAverage(uint16(x1hi>>32), uint16(x2hi>>32)))<<32 | + uint64(i16RoundingAverage(uint16(x1hi>>48), uint16(x2hi>>48)))<<48 + } + ce.pushValue(retLo) + ce.pushValue(retHi) + frame.pc++ + case wazeroir.OperationKindV128Pmin: + x2hi, x2lo := ce.popValue(), ce.popValue() + x1hi, x1lo := ce.popValue(), ce.popValue() + var retLo, retHi uint64 + if op.B1 == wazeroir.ShapeF32x4 { + if flt32(math.Float32frombits(uint32(x2lo)), math.Float32frombits(uint32(x1lo))) { + retLo = x2lo & 0x00000000_ffffffff + } else { + retLo = x1lo & 0x00000000_ffffffff + } + if flt32(math.Float32frombits(uint32(x2lo>>32)), math.Float32frombits(uint32(x1lo>>32))) { + retLo |= x2lo & 0xffffffff_00000000 + } else { + retLo |= x1lo & 0xffffffff_00000000 + } + if flt32(math.Float32frombits(uint32(x2hi)), math.Float32frombits(uint32(x1hi))) { + retHi = x2hi & 0x00000000_ffffffff + } else { + retHi = x1hi & 0x00000000_ffffffff + } + if flt32(math.Float32frombits(uint32(x2hi>>32)), math.Float32frombits(uint32(x1hi>>32))) { + retHi |= x2hi & 0xffffffff_00000000 + } else { + retHi |= x1hi & 0xffffffff_00000000 + } + } else { + if flt64(math.Float64frombits(x2lo), math.Float64frombits(x1lo)) { + retLo = x2lo + } else { + retLo = x1lo + } + if flt64(math.Float64frombits(x2hi), math.Float64frombits(x1hi)) { + retHi = x2hi + } else { + retHi = x1hi + } + } + ce.pushValue(retLo) + ce.pushValue(retHi) + frame.pc++ + case wazeroir.OperationKindV128Pmax: + x2hi, x2lo := ce.popValue(), ce.popValue() + x1hi, x1lo := ce.popValue(), ce.popValue() + var retLo, retHi uint64 + if op.B1 == wazeroir.ShapeF32x4 { + if flt32(math.Float32frombits(uint32(x1lo)), math.Float32frombits(uint32(x2lo))) { + retLo = x2lo & 0x00000000_ffffffff + } else { + retLo = x1lo & 0x00000000_ffffffff + } + if flt32(math.Float32frombits(uint32(x1lo>>32)), math.Float32frombits(uint32(x2lo>>32))) { + retLo |= x2lo & 0xffffffff_00000000 + } else { + retLo |= x1lo & 0xffffffff_00000000 + } + if flt32(math.Float32frombits(uint32(x1hi)), math.Float32frombits(uint32(x2hi))) { + retHi = x2hi & 0x00000000_ffffffff + } else { + retHi = x1hi & 0x00000000_ffffffff + } + if flt32(math.Float32frombits(uint32(x1hi>>32)), math.Float32frombits(uint32(x2hi>>32))) { + retHi |= x2hi & 0xffffffff_00000000 + } else { + retHi |= x1hi & 0xffffffff_00000000 + } + } else { + if flt64(math.Float64frombits(x1lo), math.Float64frombits(x2lo)) { + retLo = x2lo + } else { + retLo = x1lo + } + if flt64(math.Float64frombits(x1hi), math.Float64frombits(x2hi)) { + retHi = x2hi + } else { + retHi = x1hi + } + } + ce.pushValue(retLo) + ce.pushValue(retHi) + frame.pc++ + case wazeroir.OperationKindV128Ceil: + hi, lo := ce.popValue(), ce.popValue() + if op.B1 == wazeroir.ShapeF32x4 { + lo = uint64(math.Float32bits(moremath.WasmCompatCeilF32(math.Float32frombits(uint32(lo))))) | + (uint64(math.Float32bits(moremath.WasmCompatCeilF32(math.Float32frombits(uint32(lo>>32))))) << 32) + hi = uint64(math.Float32bits(moremath.WasmCompatCeilF32(math.Float32frombits(uint32(hi))))) | + (uint64(math.Float32bits(moremath.WasmCompatCeilF32(math.Float32frombits(uint32(hi>>32))))) << 32) + } else { + lo = math.Float64bits(moremath.WasmCompatCeilF64(math.Float64frombits(lo))) + hi = math.Float64bits(moremath.WasmCompatCeilF64(math.Float64frombits(hi))) + } + ce.pushValue(lo) + ce.pushValue(hi) + frame.pc++ + case wazeroir.OperationKindV128Floor: + hi, lo := ce.popValue(), ce.popValue() + if op.B1 == wazeroir.ShapeF32x4 { + lo = uint64(math.Float32bits(moremath.WasmCompatFloorF32(math.Float32frombits(uint32(lo))))) | + (uint64(math.Float32bits(moremath.WasmCompatFloorF32(math.Float32frombits(uint32(lo>>32))))) << 32) + hi = uint64(math.Float32bits(moremath.WasmCompatFloorF32(math.Float32frombits(uint32(hi))))) | + (uint64(math.Float32bits(moremath.WasmCompatFloorF32(math.Float32frombits(uint32(hi>>32))))) << 32) + } else { + lo = math.Float64bits(moremath.WasmCompatFloorF64(math.Float64frombits(lo))) + hi = math.Float64bits(moremath.WasmCompatFloorF64(math.Float64frombits(hi))) + } + ce.pushValue(lo) + ce.pushValue(hi) + frame.pc++ + case wazeroir.OperationKindV128Trunc: + hi, lo := ce.popValue(), ce.popValue() + if op.B1 == wazeroir.ShapeF32x4 { + lo = uint64(math.Float32bits(moremath.WasmCompatTruncF32(math.Float32frombits(uint32(lo))))) | + (uint64(math.Float32bits(moremath.WasmCompatTruncF32(math.Float32frombits(uint32(lo>>32))))) << 32) + hi = uint64(math.Float32bits(moremath.WasmCompatTruncF32(math.Float32frombits(uint32(hi))))) | + (uint64(math.Float32bits(moremath.WasmCompatTruncF32(math.Float32frombits(uint32(hi>>32))))) << 32) + } else { + lo = math.Float64bits(moremath.WasmCompatTruncF64(math.Float64frombits(lo))) + hi = math.Float64bits(moremath.WasmCompatTruncF64(math.Float64frombits(hi))) + } + ce.pushValue(lo) + ce.pushValue(hi) + frame.pc++ + case wazeroir.OperationKindV128Nearest: + hi, lo := ce.popValue(), ce.popValue() + if op.B1 == wazeroir.ShapeF32x4 { + lo = uint64(math.Float32bits(moremath.WasmCompatNearestF32(math.Float32frombits(uint32(lo))))) | + (uint64(math.Float32bits(moremath.WasmCompatNearestF32(math.Float32frombits(uint32(lo>>32))))) << 32) + hi = uint64(math.Float32bits(moremath.WasmCompatNearestF32(math.Float32frombits(uint32(hi))))) | + (uint64(math.Float32bits(moremath.WasmCompatNearestF32(math.Float32frombits(uint32(hi>>32))))) << 32) + } else { + lo = math.Float64bits(moremath.WasmCompatNearestF64(math.Float64frombits(lo))) + hi = math.Float64bits(moremath.WasmCompatNearestF64(math.Float64frombits(hi))) + } + ce.pushValue(lo) + ce.pushValue(hi) + frame.pc++ + case wazeroir.OperationKindV128Extend: + hi, lo := ce.popValue(), ce.popValue() + var origin uint64 + if op.B3 { // use lower 64 bits + origin = lo + } else { + origin = hi + } + + signed := op.B2 == 1 + + var retHi, retLo uint64 + switch op.B1 { + case wazeroir.ShapeI8x16: + for i := 0; i < 8; i++ { + v8 := byte(origin >> (i * 8)) + + var v16 uint16 + if signed { + v16 = uint16(int8(v8)) + } else { + v16 = uint16(v8) + } + + if i < 4 { + retLo |= uint64(v16) << (i * 16) + } else { + retHi |= uint64(v16) << ((i - 4) * 16) + } + } + case wazeroir.ShapeI16x8: + for i := 0; i < 4; i++ { + v16 := uint16(origin >> (i * 16)) + + var v32 uint32 + if signed { + v32 = uint32(int16(v16)) + } else { + v32 = uint32(v16) + } + + if i < 2 { + retLo |= uint64(v32) << (i * 32) + } else { + retHi |= uint64(v32) << ((i - 2) * 32) + } + } + case wazeroir.ShapeI32x4: + v32Lo := uint32(origin) + v32Hi := uint32(origin >> 32) + if signed { + retLo = uint64(int32(v32Lo)) + retHi = uint64(int32(v32Hi)) + } else { + retLo = uint64(v32Lo) + retHi = uint64(v32Hi) + } + } + ce.pushValue(retLo) + ce.pushValue(retHi) + frame.pc++ + case wazeroir.OperationKindV128ExtMul: + x2Hi, x2Lo := ce.popValue(), ce.popValue() + x1Hi, x1Lo := ce.popValue(), ce.popValue() + var x1, x2 uint64 + if op.B3 { // use lower 64 bits + x1, x2 = x1Lo, x2Lo + } else { + x1, x2 = x1Hi, x2Hi + } + + signed := op.B2 == 1 + + var retLo, retHi uint64 + switch op.B1 { + case wazeroir.ShapeI8x16: + for i := 0; i < 8; i++ { + v1, v2 := byte(x1>>(i*8)), byte(x2>>(i*8)) + + var v16 uint16 + if signed { + v16 = uint16(int16(int8(v1)) * int16(int8(v2))) + } else { + v16 = uint16(v1) * uint16(v2) + } + + if i < 4 { + retLo |= uint64(v16) << (i * 16) + } else { + retHi |= uint64(v16) << ((i - 4) * 16) + } + } + case wazeroir.ShapeI16x8: + for i := 0; i < 4; i++ { + v1, v2 := uint16(x1>>(i*16)), uint16(x2>>(i*16)) + + var v32 uint32 + if signed { + v32 = uint32(int32(int16(v1)) * int32(int16(v2))) + } else { + v32 = uint32(v1) * uint32(v2) + } + + if i < 2 { + retLo |= uint64(v32) << (i * 32) + } else { + retHi |= uint64(v32) << ((i - 2) * 32) + } + } + case wazeroir.ShapeI32x4: + v1Lo, v2Lo := uint32(x1), uint32(x2) + v1Hi, v2Hi := uint32(x1>>32), uint32(x2>>32) + if signed { + retLo = uint64(int64(int32(v1Lo)) * int64(int32(v2Lo))) + retHi = uint64(int64(int32(v1Hi)) * int64(int32(v2Hi))) + } else { + retLo = uint64(v1Lo) * uint64(v2Lo) + retHi = uint64(v1Hi) * uint64(v2Hi) + } + } + + ce.pushValue(retLo) + ce.pushValue(retHi) + frame.pc++ + case wazeroir.OperationKindV128Q15mulrSatS: + x2hi, x2Lo := ce.popValue(), ce.popValue() + x1hi, x1Lo := ce.popValue(), ce.popValue() + var retLo, retHi uint64 + for i := 0; i < 8; i++ { + var v, w int16 + if i < 4 { + v, w = int16(uint16(x1Lo>>(i*16))), int16(uint16(x2Lo>>(i*16))) + } else { + v, w = int16(uint16(x1hi>>((i-4)*16))), int16(uint16(x2hi>>((i-4)*16))) + } + + var uv uint64 + // https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/simd/SIMD.md#saturating-integer-q-format-rounding-multiplication + if calc := ((int32(v) * int32(w)) + 0x4000) >> 15; calc < math.MinInt16 { + uv = uint64(uint16(0x8000)) + } else if calc > math.MaxInt16 { + uv = uint64(uint16(0x7fff)) + } else { + uv = uint64(uint16(int16(calc))) + } + + if i < 4 { + retLo |= uv << (i * 16) + } else { + retHi |= uv << ((i - 4) * 16) + } + } + + ce.pushValue(retLo) + ce.pushValue(retHi) + frame.pc++ + case wazeroir.OperationKindV128ExtAddPairwise: + hi, lo := ce.popValue(), ce.popValue() + + signed := op.B3 + + var retLo, retHi uint64 + switch op.B1 { + case wazeroir.ShapeI8x16: + for i := 0; i < 8; i++ { + var v1, v2 byte + if i < 4 { + v1, v2 = byte(lo>>((i*2)*8)), byte(lo>>((i*2+1)*8)) + } else { + v1, v2 = byte(hi>>(((i-4)*2)*8)), byte(hi>>(((i-4)*2+1)*8)) + } + + var v16 uint16 + if signed { + v16 = uint16(int16(int8(v1)) + int16(int8(v2))) + } else { + v16 = uint16(v1) + uint16(v2) + } + + if i < 4 { + retLo |= uint64(v16) << (i * 16) + } else { + retHi |= uint64(v16) << ((i - 4) * 16) + } + } + case wazeroir.ShapeI16x8: + for i := 0; i < 4; i++ { + var v1, v2 uint16 + if i < 2 { + v1, v2 = uint16(lo>>((i*2)*16)), uint16(lo>>((i*2+1)*16)) + } else { + v1, v2 = uint16(hi>>(((i-2)*2)*16)), uint16(hi>>(((i-2)*2+1)*16)) + } + + var v32 uint32 + if signed { + v32 = uint32(int32(int16(v1)) + int32(int16(v2))) + } else { + v32 = uint32(v1) + uint32(v2) + } + + if i < 2 { + retLo |= uint64(v32) << (i * 32) + } else { + retHi |= uint64(v32) << ((i - 2) * 32) + } + } + } + ce.pushValue(retLo) + ce.pushValue(retHi) + frame.pc++ + case wazeroir.OperationKindV128FloatPromote: + _, toPromote := ce.popValue(), ce.popValue() + ce.pushValue(math.Float64bits(float64(math.Float32frombits(uint32(toPromote))))) + ce.pushValue(math.Float64bits(float64(math.Float32frombits(uint32(toPromote >> 32))))) + frame.pc++ + case wazeroir.OperationKindV128FloatDemote: + hi, lo := ce.popValue(), ce.popValue() + ce.pushValue( + uint64(math.Float32bits(float32(math.Float64frombits(lo)))) | + (uint64(math.Float32bits(float32(math.Float64frombits(hi)))) << 32), + ) + ce.pushValue(0) + frame.pc++ + case wazeroir.OperationKindV128FConvertFromI: + hi, lo := ce.popValue(), ce.popValue() + v1, v2, v3, v4 := uint32(lo), uint32(lo>>32), uint32(hi), uint32(hi>>32) + signed := op.B3 + + var retLo, retHi uint64 + switch op.B1 { // Destination shape. + case wazeroir.ShapeF32x4: // f32x4 from signed/unsigned i32x4 + if signed { + retLo = uint64(math.Float32bits(float32(int32(v1)))) | + (uint64(math.Float32bits(float32(int32(v2)))) << 32) + retHi = uint64(math.Float32bits(float32(int32(v3)))) | + (uint64(math.Float32bits(float32(int32(v4)))) << 32) + } else { + retLo = uint64(math.Float32bits(float32(v1))) | + (uint64(math.Float32bits(float32(v2))) << 32) + retHi = uint64(math.Float32bits(float32(v3))) | + (uint64(math.Float32bits(float32(v4))) << 32) + } + case wazeroir.ShapeF64x2: // f64x2 from signed/unsigned i32x4 + if signed { + retLo, retHi = math.Float64bits(float64(int32(v1))), math.Float64bits(float64(int32(v2))) + } else { + retLo, retHi = math.Float64bits(float64(v1)), math.Float64bits(float64(v2)) + } + } + + ce.pushValue(retLo) + ce.pushValue(retHi) + frame.pc++ + case wazeroir.OperationKindV128Narrow: + x2Hi, x2Lo := ce.popValue(), ce.popValue() + x1Hi, x1Lo := ce.popValue(), ce.popValue() + signed := op.B3 + + var retLo, retHi uint64 + switch op.B1 { + case wazeroir.ShapeI16x8: // signed/unsigned i16x8 to i8x16 + for i := 0; i < 8; i++ { + var v16 uint16 + if i < 4 { + v16 = uint16(x1Lo >> (i * 16)) + } else { + v16 = uint16(x1Hi >> ((i - 4) * 16)) + } + + var v byte + if signed { + if s := int16(v16); s > math.MaxInt8 { + v = math.MaxInt8 + } else if s < math.MinInt8 { + s = math.MinInt8 + v = byte(s) + } else { + v = byte(v16) + } + } else { + if s := int16(v16); s > math.MaxUint8 { + v = math.MaxUint8 + } else if s < 0 { + v = 0 + } else { + v = byte(v16) + } + } + retLo |= uint64(v) << (i * 8) + } + for i := 0; i < 8; i++ { + var v16 uint16 + if i < 4 { + v16 = uint16(x2Lo >> (i * 16)) + } else { + v16 = uint16(x2Hi >> ((i - 4) * 16)) + } + + var v byte + if signed { + if s := int16(v16); s > math.MaxInt8 { + v = math.MaxInt8 + } else if s < math.MinInt8 { + s = math.MinInt8 + v = byte(s) + } else { + v = byte(v16) + } + } else { + if s := int16(v16); s > math.MaxUint8 { + v = math.MaxUint8 + } else if s < 0 { + v = 0 + } else { + v = byte(v16) + } + } + retHi |= uint64(v) << (i * 8) + } + case wazeroir.ShapeI32x4: // signed/unsigned i32x4 to i16x8 + for i := 0; i < 4; i++ { + var v32 uint32 + if i < 2 { + v32 = uint32(x1Lo >> (i * 32)) + } else { + v32 = uint32(x1Hi >> ((i - 2) * 32)) + } + + var v uint16 + if signed { + if s := int32(v32); s > math.MaxInt16 { + v = math.MaxInt16 + } else if s < math.MinInt16 { + s = math.MinInt16 + v = uint16(s) + } else { + v = uint16(v32) + } + } else { + if s := int32(v32); s > math.MaxUint16 { + v = math.MaxUint16 + } else if s < 0 { + v = 0 + } else { + v = uint16(v32) + } + } + retLo |= uint64(v) << (i * 16) + } + + for i := 0; i < 4; i++ { + var v32 uint32 + if i < 2 { + v32 = uint32(x2Lo >> (i * 32)) + } else { + v32 = uint32(x2Hi >> ((i - 2) * 32)) + } + + var v uint16 + if signed { + if s := int32(v32); s > math.MaxInt16 { + v = math.MaxInt16 + } else if s < math.MinInt16 { + s = math.MinInt16 + v = uint16(s) + } else { + v = uint16(v32) + } + } else { + if s := int32(v32); s > math.MaxUint16 { + v = math.MaxUint16 + } else if s < 0 { + v = 0 + } else { + v = uint16(v32) + } + } + retHi |= uint64(v) << (i * 16) + } + } + ce.pushValue(retLo) + ce.pushValue(retHi) + frame.pc++ + case wazeroir.OperationKindV128Dot: + x2Hi, x2Lo := ce.popValue(), ce.popValue() + x1Hi, x1Lo := ce.popValue(), ce.popValue() + ce.pushValue( + uint64(uint32(int32(int16(x1Lo>>0))*int32(int16(x2Lo>>0))+int32(int16(x1Lo>>16))*int32(int16(x2Lo>>16)))) | + (uint64(uint32(int32(int16(x1Lo>>32))*int32(int16(x2Lo>>32))+int32(int16(x1Lo>>48))*int32(int16(x2Lo>>48)))) << 32), + ) + ce.pushValue( + uint64(uint32(int32(int16(x1Hi>>0))*int32(int16(x2Hi>>0))+int32(int16(x1Hi>>16))*int32(int16(x2Hi>>16)))) | + (uint64(uint32(int32(int16(x1Hi>>32))*int32(int16(x2Hi>>32))+int32(int16(x1Hi>>48))*int32(int16(x2Hi>>48)))) << 32), + ) + frame.pc++ + case wazeroir.OperationKindV128ITruncSatFromF: + hi, lo := ce.popValue(), ce.popValue() + signed := op.B3 + var retLo, retHi uint64 + + switch op.B1 { + case wazeroir.ShapeF32x4: // f32x4 to i32x4 + for i, f64 := range [4]float64{ + math.Trunc(float64(math.Float32frombits(uint32(lo)))), + math.Trunc(float64(math.Float32frombits(uint32(lo >> 32)))), + math.Trunc(float64(math.Float32frombits(uint32(hi)))), + math.Trunc(float64(math.Float32frombits(uint32(hi >> 32)))), + } { + + var v uint32 + if math.IsNaN(f64) { + v = 0 + } else if signed { + if f64 < math.MinInt32 { + f64 = math.MinInt32 + } else if f64 > math.MaxInt32 { + f64 = math.MaxInt32 + } + v = uint32(int32(f64)) + } else { + if f64 < 0 { + f64 = 0 + } else if f64 > math.MaxUint32 { + f64 = math.MaxUint32 + } + v = uint32(f64) + } + + if i < 2 { + retLo |= uint64(v) << (i * 32) + } else { + retHi |= uint64(v) << ((i - 2) * 32) + } + } + + case wazeroir.ShapeF64x2: // f64x2 to i32x4 + for i, f := range [2]float64{ + math.Trunc(math.Float64frombits(lo)), + math.Trunc(math.Float64frombits(hi)), + } { + var v uint32 + if math.IsNaN(f) { + v = 0 + } else if signed { + if f < math.MinInt32 { + f = math.MinInt32 + } else if f > math.MaxInt32 { + f = math.MaxInt32 + } + v = uint32(int32(f)) + } else { + if f < 0 { + f = 0 + } else if f > math.MaxUint32 { + f = math.MaxUint32 + } + v = uint32(f) + } + + retLo |= uint64(v) << (i * 32) + } + } + + ce.pushValue(retLo) + ce.pushValue(retHi) + frame.pc++ + default: + frame.pc++ + } + } + ce.popFrame() +} + +func WasmCompatMax32bits(v1, v2 uint32) uint64 { + return uint64(math.Float32bits(moremath.WasmCompatMax32( + math.Float32frombits(v1), + math.Float32frombits(v2), + ))) +} + +func WasmCompatMin32bits(v1, v2 uint32) uint64 { + return uint64(math.Float32bits(moremath.WasmCompatMin32( + math.Float32frombits(v1), + math.Float32frombits(v2), + ))) +} + +func addFloat32bits(v1, v2 uint32) uint64 { + return uint64(math.Float32bits(math.Float32frombits(v1) + math.Float32frombits(v2))) +} + +func subFloat32bits(v1, v2 uint32) uint64 { + return uint64(math.Float32bits(math.Float32frombits(v1) - math.Float32frombits(v2))) +} + +func mulFloat32bits(v1, v2 uint32) uint64 { + return uint64(math.Float32bits(math.Float32frombits(v1) * math.Float32frombits(v2))) +} + +func divFloat32bits(v1, v2 uint32) uint64 { + return uint64(math.Float32bits(math.Float32frombits(v1) / math.Float32frombits(v2))) +} + +// https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/numerics.html#xref-exec-numerics-op-flt-mathrm-flt-n-z-1-z-2 +func flt32(z1, z2 float32) bool { + if z1 != z1 || z2 != z2 { + return false + } else if z1 == z2 { + return false + } else if math.IsInf(float64(z1), 1) { + return false + } else if math.IsInf(float64(z1), -1) { + return true + } else if math.IsInf(float64(z2), 1) { + return true + } else if math.IsInf(float64(z2), -1) { + return false + } + return z1 < z2 +} + +// https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/numerics.html#xref-exec-numerics-op-flt-mathrm-flt-n-z-1-z-2 +func flt64(z1, z2 float64) bool { + if z1 != z1 || z2 != z2 { + return false + } else if z1 == z2 { + return false + } else if math.IsInf(z1, 1) { + return false + } else if math.IsInf(z1, -1) { + return true + } else if math.IsInf(z2, 1) { + return true + } else if math.IsInf(z2, -1) { + return false + } + return z1 < z2 +} + +func i8RoundingAverage(v1, v2 byte) byte { + // https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/simd/SIMD.md#lane-wise-integer-rounding-average + return byte((uint16(v1) + uint16(v2) + uint16(1)) / 2) +} + +func i16RoundingAverage(v1, v2 uint16) uint16 { + // https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/simd/SIMD.md#lane-wise-integer-rounding-average + return uint16((uint32(v1) + uint32(v2) + 1) / 2) +} + +func i8Abs(v byte) byte { + if i := int8(v); i < 0 { + return byte(-i) + } else { + return byte(i) + } +} + +func i8MaxU(v1, v2 byte) byte { + if v1 < v2 { + return v2 + } else { + return v1 + } +} + +func i8MinU(v1, v2 byte) byte { + if v1 > v2 { + return v2 + } else { + return v1 + } +} + +func i8MaxS(v1, v2 byte) byte { + if int8(v1) < int8(v2) { + return v2 + } else { + return v1 + } +} + +func i8MinS(v1, v2 byte) byte { + if int8(v1) > int8(v2) { + return v2 + } else { + return v1 + } +} + +func i16MaxU(v1, v2 uint16) uint16 { + if v1 < v2 { + return v2 + } else { + return v1 + } +} + +func i16MinU(v1, v2 uint16) uint16 { + if v1 > v2 { + return v2 + } else { + return v1 + } +} + +func i16MaxS(v1, v2 uint16) uint16 { + if int16(v1) < int16(v2) { + return v2 + } else { + return v1 + } +} + +func i16MinS(v1, v2 uint16) uint16 { + if int16(v1) > int16(v2) { + return v2 + } else { + return v1 + } +} + +func i32MaxU(v1, v2 uint32) uint32 { + if v1 < v2 { + return v2 + } else { + return v1 + } +} + +func i32MinU(v1, v2 uint32) uint32 { + if v1 > v2 { + return v2 + } else { + return v1 + } +} + +func i32MaxS(v1, v2 uint32) uint32 { + if int32(v1) < int32(v2) { + return v2 + } else { + return v1 + } +} + +func i32MinS(v1, v2 uint32) uint32 { + if int32(v1) > int32(v2) { + return v2 + } else { + return v1 + } +} + +func i16Abs(v uint16) uint16 { + if i := int16(v); i < 0 { + return uint16(-i) + } else { + return uint16(i) + } +} + +func i32Abs(v uint32) uint32 { + if i := int32(v); i < 0 { + return uint32(-i) + } else { + return uint32(i) + } +} + +func (ce *callEngine) callNativeFuncWithListener(ctx context.Context, m *wasm.ModuleInstance, f *function, fnl experimental.FunctionListener) context.Context { + def, typ := f.definition(), f.funcType + + ce.stackIterator.reset(ce.stack, ce.frames, f) + fnl.Before(ctx, m, def, ce.peekValues(typ.ParamNumInUint64), &ce.stackIterator) + ce.stackIterator.clear() + ce.callNativeFunc(ctx, m, f) + fnl.After(ctx, m, def, ce.peekValues(typ.ResultNumInUint64)) + return ctx +} + +// popMemoryOffset takes a memory offset off the stack for use in load and store instructions. +// As the top of stack value is 64-bit, this ensures it is in range before returning it. +func (ce *callEngine) popMemoryOffset(op *wazeroir.UnionOperation) uint32 { + offset := op.U2 + ce.popValue() + if offset > math.MaxUint32 { + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + } + return uint32(offset) +} + +func (ce *callEngine) callGoFuncWithStack(ctx context.Context, m *wasm.ModuleInstance, f *function) { + typ := f.funcType + paramLen := typ.ParamNumInUint64 + resultLen := typ.ResultNumInUint64 + stackLen := paramLen + + // In the interpreter engine, ce.stack may only have capacity to store + // parameters. Grow when there are more results than parameters. + if growLen := resultLen - paramLen; growLen > 0 { + for i := 0; i < growLen; i++ { + ce.stack = append(ce.stack, 0) + } + stackLen += growLen + } + + // Pass the stack elements to the go function. + stack := ce.stack[len(ce.stack)-stackLen:] + ce.callGoFunc(ctx, m, f, stack) + + // Shrink the stack when there were more parameters than results. + if shrinkLen := paramLen - resultLen; shrinkLen > 0 { + ce.stack = ce.stack[0 : len(ce.stack)-shrinkLen] + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/README.md b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/README.md new file mode 100644 index 000000000..4ec94a3e2 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/README.md @@ -0,0 +1,2 @@ +wazevo is the new optimizing compiler backend under active development and it's not usable yet. +Please refer to https://github.com/tetratelabs/wazero/issues/1496 diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/abi.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/abi.go new file mode 100644 index 000000000..0d1eb4cb6 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/abi.go @@ -0,0 +1,61 @@ +package backend + +import ( + "fmt" + + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc" + "github.com/tetratelabs/wazero/internal/engine/wazevo/ssa" +) + +// FunctionABI represents an ABI for the specific target combined with the function signature. +type FunctionABI interface { + // CalleeGenFunctionArgsToVRegs generates instructions to move arguments to virtual registers. + CalleeGenFunctionArgsToVRegs(regs []ssa.Value) + // CalleeGenVRegsToFunctionReturns generates instructions to move virtual registers to a return value locations. + CalleeGenVRegsToFunctionReturns(regs []ssa.Value) +} + +type ( + // ABIArg represents either argument or return value's location. + ABIArg struct { + // Index is the index of the argument. + Index int + // Kind is the kind of the argument. + Kind ABIArgKind + // Reg is valid if Kind == ABIArgKindReg. + // This VReg must be based on RealReg. + Reg regalloc.VReg + // Offset is valid if Kind == ABIArgKindStack. + // This is the offset from the beginning of either arg or ret stack slot. + Offset int64 + // Type is the type of the argument. + Type ssa.Type + } + + // ABIArgKind is the kind of ABI argument. + ABIArgKind byte +) + +const ( + // ABIArgKindReg represents an argument passed in a register. + ABIArgKindReg = iota + // ABIArgKindStack represents an argument passed in the stack. + ABIArgKindStack +) + +// String implements fmt.Stringer. +func (a *ABIArg) String() string { + return fmt.Sprintf("args[%d]: %s", a.Index, a.Kind) +} + +// String implements fmt.Stringer. +func (a ABIArgKind) String() string { + switch a { + case ABIArgKindReg: + return "reg" + case ABIArgKindStack: + return "stack" + default: + panic("BUG") + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/backend.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/backend.go new file mode 100644 index 000000000..dd67da43e --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/backend.go @@ -0,0 +1,3 @@ +// Package backend must be free of Wasm-specific concept. In other words, +// this package must not import internal/wasm package. +package backend diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/compiler.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/compiler.go new file mode 100644 index 000000000..2c0e3cb85 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/compiler.go @@ -0,0 +1,386 @@ +package backend + +import ( + "context" + "encoding/hex" + "fmt" + + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc" + "github.com/tetratelabs/wazero/internal/engine/wazevo/ssa" + "github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi" +) + +// NewCompiler returns a new Compiler that can generate a machine code. +func NewCompiler(ctx context.Context, mach Machine, builder ssa.Builder) Compiler { + return newCompiler(ctx, mach, builder) +} + +func newCompiler(_ context.Context, mach Machine, builder ssa.Builder) *compiler { + c := &compiler{ + mach: mach, ssaBuilder: builder, + nextVRegID: regalloc.VRegIDNonReservedBegin, + regAlloc: regalloc.NewAllocator(mach.RegisterInfo()), + } + mach.SetCompiler(c) + return c +} + +// Compiler is the backend of wazevo which takes ssa.Builder and Machine, +// use the information there to emit the final machine code. +type Compiler interface { + // SSABuilder returns the ssa.Builder used by this compiler. + SSABuilder() ssa.Builder + + // Compile executes the following steps: + // 1. Lower() + // 2. RegAlloc() + // 3. Finalize() + // 4. Encode() + // + // Each step can be called individually for testing purpose, therefore they are exposed in this interface too. + // + // The returned byte slices are the machine code and the relocation information for the machine code. + // The caller is responsible for copying them immediately since the compiler may reuse the buffer. + Compile(ctx context.Context) (_ []byte, _ []RelocationInfo, _ error) + + // Lower lowers the given ssa.Instruction to the machine-specific instructions. + Lower() + + // RegAlloc performs the register allocation after Lower is called. + RegAlloc() + + // Finalize performs the finalization of the compilation. This must be called after RegAlloc. + Finalize(ctx context.Context) + + // Encode encodes the machine code to the buffer. + Encode() + + // Buf returns the buffer of the encoded machine code. This is only used for testing purpose. + Buf() []byte + + // Format returns the debug string of the current state of the compiler. + Format() string + + // Init initializes the internal state of the compiler for the next compilation. + Init() + + // AllocateVReg allocates a new virtual register of the given type. + AllocateVReg(typ ssa.Type) regalloc.VReg + + // ValueDefinition returns the definition of the given value. + ValueDefinition(ssa.Value) *SSAValueDefinition + + // VRegOf returns the virtual register of the given ssa.Value. + VRegOf(value ssa.Value) regalloc.VReg + + // TypeOf returns the ssa.Type of the given virtual register. + TypeOf(regalloc.VReg) ssa.Type + + // MatchInstr returns true if the given definition is from an instruction with the given opcode, the current group ID, + // and a refcount of 1. That means, the instruction can be merged/swapped within the current instruction group. + MatchInstr(def *SSAValueDefinition, opcode ssa.Opcode) bool + + // MatchInstrOneOf is the same as MatchInstr but for multiple opcodes. If it matches one of ssa.Opcode, + // this returns the opcode. Otherwise, this returns ssa.OpcodeInvalid. + // + // Note: caller should be careful to avoid excessive allocation on opcodes slice. + MatchInstrOneOf(def *SSAValueDefinition, opcodes []ssa.Opcode) ssa.Opcode + + // AddRelocationInfo appends the relocation information for the function reference at the current buffer offset. + AddRelocationInfo(funcRef ssa.FuncRef) + + // AddSourceOffsetInfo appends the source offset information for the given offset. + AddSourceOffsetInfo(executableOffset int64, sourceOffset ssa.SourceOffset) + + // SourceOffsetInfo returns the source offset information for the current buffer offset. + SourceOffsetInfo() []SourceOffsetInfo + + // Emit4Bytes appends 4 bytes to the buffer. Used during the code emission. + Emit4Bytes(b uint32) +} + +// RelocationInfo represents the relocation information for a call instruction. +type RelocationInfo struct { + // Offset represents the offset from the beginning of the machine code of either a function or the entire module. + Offset int64 + // Target is the target function of the call instruction. + FuncRef ssa.FuncRef +} + +// compiler implements Compiler. +type compiler struct { + mach Machine + currentGID ssa.InstructionGroupID + ssaBuilder ssa.Builder + // nextVRegID is the next virtual register ID to be allocated. + nextVRegID regalloc.VRegID + // ssaValueToVRegs maps ssa.ValueID to regalloc.VReg. + ssaValueToVRegs [] /* VRegID to */ regalloc.VReg + // ssaValueDefinitions maps ssa.ValueID to its definition. + ssaValueDefinitions []SSAValueDefinition + // ssaValueRefCounts is a cached list obtained by ssa.Builder.ValueRefCounts(). + ssaValueRefCounts []int + // returnVRegs is the list of virtual registers that store the return values. + returnVRegs []regalloc.VReg + regAlloc regalloc.Allocator + varEdges [][2]regalloc.VReg + varEdgeTypes []ssa.Type + constEdges []struct { + cInst *ssa.Instruction + dst regalloc.VReg + } + vRegSet []bool + vRegIDs []regalloc.VRegID + tempRegs []regalloc.VReg + tmpVals []ssa.Value + ssaTypeOfVRegID [] /* VRegID to */ ssa.Type + buf []byte + relocations []RelocationInfo + sourceOffsets []SourceOffsetInfo +} + +// SourceOffsetInfo is a data to associate the source offset with the executable offset. +type SourceOffsetInfo struct { + // SourceOffset is the source offset in the original source code. + SourceOffset ssa.SourceOffset + // ExecutableOffset is the offset in the compiled executable. + ExecutableOffset int64 +} + +// Compile implements Compiler.Compile. +func (c *compiler) Compile(ctx context.Context) ([]byte, []RelocationInfo, error) { + c.Lower() + if wazevoapi.PrintSSAToBackendIRLowering && wazevoapi.PrintEnabledIndex(ctx) { + fmt.Printf("[[[after lowering for %s ]]]%s\n", wazevoapi.GetCurrentFunctionName(ctx), c.Format()) + } + if wazevoapi.DeterministicCompilationVerifierEnabled { + wazevoapi.VerifyOrSetDeterministicCompilationContextValue(ctx, "After lowering to ISA specific IR", c.Format()) + } + c.RegAlloc() + if wazevoapi.PrintRegisterAllocated && wazevoapi.PrintEnabledIndex(ctx) { + fmt.Printf("[[[after regalloc for %s]]]%s\n", wazevoapi.GetCurrentFunctionName(ctx), c.Format()) + } + if wazevoapi.DeterministicCompilationVerifierEnabled { + wazevoapi.VerifyOrSetDeterministicCompilationContextValue(ctx, "After Register Allocation", c.Format()) + } + c.Finalize(ctx) + if wazevoapi.PrintFinalizedMachineCode && wazevoapi.PrintEnabledIndex(ctx) { + fmt.Printf("[[[after finalize for %s]]]%s\n", wazevoapi.GetCurrentFunctionName(ctx), c.Format()) + } + if wazevoapi.DeterministicCompilationVerifierEnabled { + wazevoapi.VerifyOrSetDeterministicCompilationContextValue(ctx, "After Finalization", c.Format()) + } + c.Encode() + if wazevoapi.DeterministicCompilationVerifierEnabled { + wazevoapi.VerifyOrSetDeterministicCompilationContextValue(ctx, "Encoded Machine code", hex.EncodeToString(c.buf)) + } + return c.buf, c.relocations, nil +} + +// RegAlloc implements Compiler.RegAlloc. +func (c *compiler) RegAlloc() { + regAllocFn := c.mach.Function() + c.regAlloc.DoAllocation(regAllocFn) +} + +// Finalize implements Compiler.Finalize. +func (c *compiler) Finalize(ctx context.Context) { + c.mach.SetupPrologue() + c.mach.SetupEpilogue() + c.mach.ResolveRelativeAddresses(ctx) +} + +// Encode implements Compiler.Encode. +func (c *compiler) Encode() { + c.mach.Encode() +} + +// setCurrentGroupID sets the current instruction group ID. +func (c *compiler) setCurrentGroupID(gid ssa.InstructionGroupID) { + c.currentGID = gid +} + +// assignVirtualRegisters assigns a virtual register to each ssa.ValueID Valid in the ssa.Builder. +func (c *compiler) assignVirtualRegisters() { + builder := c.ssaBuilder + refCounts := builder.ValueRefCounts() + c.ssaValueRefCounts = refCounts + + need := len(refCounts) + if need >= len(c.ssaValueToVRegs) { + c.ssaValueToVRegs = append(c.ssaValueToVRegs, make([]regalloc.VReg, need+1)...) + } + if need >= len(c.ssaValueDefinitions) { + c.ssaValueDefinitions = append(c.ssaValueDefinitions, make([]SSAValueDefinition, need+1)...) + } + + for blk := builder.BlockIteratorReversePostOrderBegin(); blk != nil; blk = builder.BlockIteratorReversePostOrderNext() { + // First we assign a virtual register to each parameter. + for i := 0; i < blk.Params(); i++ { + p := blk.Param(i) + pid := p.ID() + typ := p.Type() + vreg := c.AllocateVReg(typ) + c.ssaValueToVRegs[pid] = vreg + c.ssaValueDefinitions[pid] = SSAValueDefinition{BlockParamValue: p, BlkParamVReg: vreg} + c.ssaTypeOfVRegID[vreg.ID()] = p.Type() + } + + // Assigns each value to a virtual register produced by instructions. + for cur := blk.Root(); cur != nil; cur = cur.Next() { + r, rs := cur.Returns() + var N int + if r.Valid() { + id := r.ID() + ssaTyp := r.Type() + typ := r.Type() + vReg := c.AllocateVReg(typ) + c.ssaValueToVRegs[id] = vReg + c.ssaValueDefinitions[id] = SSAValueDefinition{ + Instr: cur, + N: 0, + RefCount: refCounts[id], + } + c.ssaTypeOfVRegID[vReg.ID()] = ssaTyp + N++ + } + for _, r := range rs { + id := r.ID() + ssaTyp := r.Type() + vReg := c.AllocateVReg(ssaTyp) + c.ssaValueToVRegs[id] = vReg + c.ssaValueDefinitions[id] = SSAValueDefinition{ + Instr: cur, + N: N, + RefCount: refCounts[id], + } + c.ssaTypeOfVRegID[vReg.ID()] = ssaTyp + N++ + } + } + } + + for i, retBlk := 0, builder.ReturnBlock(); i < retBlk.Params(); i++ { + typ := retBlk.Param(i).Type() + vReg := c.AllocateVReg(typ) + c.returnVRegs = append(c.returnVRegs, vReg) + c.ssaTypeOfVRegID[vReg.ID()] = typ + } +} + +// AllocateVReg implements Compiler.AllocateVReg. +func (c *compiler) AllocateVReg(typ ssa.Type) regalloc.VReg { + regType := regalloc.RegTypeOf(typ) + r := regalloc.VReg(c.nextVRegID).SetRegType(regType) + + id := r.ID() + if int(id) >= len(c.ssaTypeOfVRegID) { + c.ssaTypeOfVRegID = append(c.ssaTypeOfVRegID, make([]ssa.Type, id+1)...) + } + c.ssaTypeOfVRegID[id] = typ + c.nextVRegID++ + return r +} + +// Init implements Compiler.Init. +func (c *compiler) Init() { + c.currentGID = 0 + c.nextVRegID = regalloc.VRegIDNonReservedBegin + c.returnVRegs = c.returnVRegs[:0] + c.mach.Reset() + c.varEdges = c.varEdges[:0] + c.constEdges = c.constEdges[:0] + c.regAlloc.Reset() + c.buf = c.buf[:0] + c.sourceOffsets = c.sourceOffsets[:0] + c.relocations = c.relocations[:0] +} + +// ValueDefinition implements Compiler.ValueDefinition. +func (c *compiler) ValueDefinition(value ssa.Value) *SSAValueDefinition { + return &c.ssaValueDefinitions[value.ID()] +} + +// VRegOf implements Compiler.VRegOf. +func (c *compiler) VRegOf(value ssa.Value) regalloc.VReg { + return c.ssaValueToVRegs[value.ID()] +} + +// Format implements Compiler.Format. +func (c *compiler) Format() string { + return c.mach.Format() +} + +// TypeOf implements Compiler.Format. +func (c *compiler) TypeOf(v regalloc.VReg) ssa.Type { + return c.ssaTypeOfVRegID[v.ID()] +} + +// MatchInstr implements Compiler.MatchInstr. +func (c *compiler) MatchInstr(def *SSAValueDefinition, opcode ssa.Opcode) bool { + instr := def.Instr + return def.IsFromInstr() && + instr.Opcode() == opcode && + instr.GroupID() == c.currentGID && + def.RefCount < 2 +} + +// MatchInstrOneOf implements Compiler.MatchInstrOneOf. +func (c *compiler) MatchInstrOneOf(def *SSAValueDefinition, opcodes []ssa.Opcode) ssa.Opcode { + instr := def.Instr + if !def.IsFromInstr() { + return ssa.OpcodeInvalid + } + + if instr.GroupID() != c.currentGID { + return ssa.OpcodeInvalid + } + + if def.RefCount >= 2 { + return ssa.OpcodeInvalid + } + + opcode := instr.Opcode() + for _, op := range opcodes { + if opcode == op { + return opcode + } + } + return ssa.OpcodeInvalid +} + +// SSABuilder implements Compiler .SSABuilder. +func (c *compiler) SSABuilder() ssa.Builder { + return c.ssaBuilder +} + +// AddSourceOffsetInfo implements Compiler.AddSourceOffsetInfo. +func (c *compiler) AddSourceOffsetInfo(executableOffset int64, sourceOffset ssa.SourceOffset) { + c.sourceOffsets = append(c.sourceOffsets, SourceOffsetInfo{ + SourceOffset: sourceOffset, + ExecutableOffset: executableOffset, + }) +} + +// SourceOffsetInfo implements Compiler.SourceOffsetInfo. +func (c *compiler) SourceOffsetInfo() []SourceOffsetInfo { + return c.sourceOffsets +} + +// AddRelocationInfo implements Compiler.AddRelocationInfo. +func (c *compiler) AddRelocationInfo(funcRef ssa.FuncRef) { + c.relocations = append(c.relocations, RelocationInfo{ + Offset: int64(len(c.buf)), + FuncRef: funcRef, + }) +} + +// Emit4Bytes implements Compiler.Add4Bytes. +func (c *compiler) Emit4Bytes(b uint32) { + c.buf = append(c.buf, byte(b), byte(b>>8), byte(b>>16), byte(b>>24)) +} + +// Buf implements Compiler.Buf. +func (c *compiler) Buf() []byte { + return c.buf +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/compiler_lower.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/compiler_lower.go new file mode 100644 index 000000000..8f513423f --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/compiler_lower.go @@ -0,0 +1,219 @@ +package backend + +import ( + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc" + "github.com/tetratelabs/wazero/internal/engine/wazevo/ssa" +) + +// Lower implements Compiler.Lower. +func (c *compiler) Lower() { + c.assignVirtualRegisters() + c.mach.InitializeABI(c.ssaBuilder.Signature()) + c.mach.StartLoweringFunction(c.ssaBuilder.BlockIDMax()) + c.lowerBlocks() + c.mach.EndLoweringFunction() +} + +// lowerBlocks lowers each block in the ssa.Builder. +func (c *compiler) lowerBlocks() { + builder := c.ssaBuilder + for blk := builder.BlockIteratorReversePostOrderBegin(); blk != nil; blk = builder.BlockIteratorReversePostOrderNext() { + c.lowerBlock(blk) + } + // After lowering all blocks, we need to link adjacent blocks to layout one single instruction list. + var prev ssa.BasicBlock + for next := builder.BlockIteratorReversePostOrderBegin(); next != nil; next = builder.BlockIteratorReversePostOrderNext() { + if prev != nil { + c.mach.LinkAdjacentBlocks(prev, next) + } + prev = next + } +} + +func (c *compiler) lowerBlock(blk ssa.BasicBlock) { + mach := c.mach + mach.StartBlock(blk) + + // We traverse the instructions in reverse order because we might want to lower multiple + // instructions together. + cur := blk.Tail() + + // First gather the branching instructions at the end of the blocks. + var br0, br1 *ssa.Instruction + if cur.IsBranching() { + br0 = cur + cur = cur.Prev() + if cur != nil && cur.IsBranching() { + br1 = cur + cur = cur.Prev() + } + } + + if br0 != nil { + c.lowerBranches(br0, br1) + } + + if br1 != nil && br0 == nil { + panic("BUG? when a block has conditional branch but doesn't end with an unconditional branch?") + } + + // Now start lowering the non-branching instructions. + for ; cur != nil; cur = cur.Prev() { + c.setCurrentGroupID(cur.GroupID()) + if cur.Lowered() { + continue + } + + switch cur.Opcode() { + case ssa.OpcodeReturn: + c.lowerFunctionReturns(cur.ReturnVals()) + c.mach.InsertReturn() + default: + mach.LowerInstr(cur) + } + mach.FlushPendingInstructions() + } + + // Finally, if this is the entry block, we have to insert copies of arguments from the real location to the VReg. + if blk.EntryBlock() { + c.lowerFunctionArguments(blk) + } + + mach.EndBlock() +} + +// lowerBranches is called right after StartBlock and before any LowerInstr call if +// there are branches to the given block. br0 is the very end of the block and b1 is the before the br0 if it exists. +// At least br0 is not nil, but br1 can be nil if there's no branching before br0. +// +// See ssa.Instruction IsBranching, and the comment on ssa.BasicBlock. +func (c *compiler) lowerBranches(br0, br1 *ssa.Instruction) { + c.setCurrentGroupID(br0.GroupID()) + c.mach.LowerSingleBranch(br0) + c.mach.FlushPendingInstructions() + if br1 != nil { + c.setCurrentGroupID(br1.GroupID()) + c.mach.LowerConditionalBranch(br1) + c.mach.FlushPendingInstructions() + } + + if br0.Opcode() == ssa.OpcodeJump { + _, args, target := br0.BranchData() + argExists := len(args) != 0 + if argExists && br1 != nil { + panic("BUG: critical edge split failed") + } + if argExists && target.ReturnBlock() { + c.lowerFunctionReturns(args) + } else if argExists { + c.lowerBlockArguments(args, target) + } + } + c.mach.FlushPendingInstructions() +} + +func (c *compiler) lowerFunctionArguments(entry ssa.BasicBlock) { + c.tmpVals = c.tmpVals[:0] + for i := 0; i < entry.Params(); i++ { + p := entry.Param(i) + if c.ssaValueRefCounts[p.ID()] > 0 { + c.tmpVals = append(c.tmpVals, p) + } else { + // If the argument is not used, we can just pass an invalid value. + c.tmpVals = append(c.tmpVals, ssa.ValueInvalid) + } + } + c.mach.ABI().CalleeGenFunctionArgsToVRegs(c.tmpVals) + c.mach.FlushPendingInstructions() +} + +func (c *compiler) lowerFunctionReturns(returns []ssa.Value) { + c.mach.ABI().CalleeGenVRegsToFunctionReturns(returns) +} + +// lowerBlockArguments lowers how to pass arguments to the given successor block. +func (c *compiler) lowerBlockArguments(args []ssa.Value, succ ssa.BasicBlock) { + if len(args) != succ.Params() { + panic("BUG: mismatched number of arguments") + } + + c.varEdges = c.varEdges[:0] + c.varEdgeTypes = c.varEdgeTypes[:0] + c.constEdges = c.constEdges[:0] + for i := 0; i < len(args); i++ { + dst := succ.Param(i) + src := args[i] + + dstReg := c.VRegOf(dst) + srcDef := c.ssaValueDefinitions[src.ID()] + if srcDef.IsFromInstr() && srcDef.Instr.Constant() { + c.constEdges = append(c.constEdges, struct { + cInst *ssa.Instruction + dst regalloc.VReg + }{cInst: srcDef.Instr, dst: dstReg}) + } else { + srcReg := c.VRegOf(src) + // Even when the src=dst, insert the move so that we can keep such registers keep-alive. + c.varEdges = append(c.varEdges, [2]regalloc.VReg{srcReg, dstReg}) + c.varEdgeTypes = append(c.varEdgeTypes, src.Type()) + } + } + + // Check if there's an overlap among the dsts and srcs in varEdges. + c.vRegIDs = c.vRegIDs[:0] + for _, edge := range c.varEdges { + src := edge[0].ID() + if int(src) >= len(c.vRegSet) { + c.vRegSet = append(c.vRegSet, make([]bool, src+1)...) + } + c.vRegSet[src] = true + c.vRegIDs = append(c.vRegIDs, src) + } + separated := true + for _, edge := range c.varEdges { + dst := edge[1].ID() + if int(dst) >= len(c.vRegSet) { + c.vRegSet = append(c.vRegSet, make([]bool, dst+1)...) + } else { + if c.vRegSet[dst] { + separated = false + break + } + } + } + for _, id := range c.vRegIDs { + c.vRegSet[id] = false // reset for the next use. + } + + if separated { + // If there's no overlap, we can simply move the source to destination. + for i, edge := range c.varEdges { + src, dst := edge[0], edge[1] + c.mach.InsertMove(dst, src, c.varEdgeTypes[i]) + } + } else { + // Otherwise, we allocate a temporary registers and move the source to the temporary register, + // + // First move all of them to temporary registers. + c.tempRegs = c.tempRegs[:0] + for i, edge := range c.varEdges { + src := edge[0] + typ := c.varEdgeTypes[i] + temp := c.AllocateVReg(typ) + c.tempRegs = append(c.tempRegs, temp) + c.mach.InsertMove(temp, src, typ) + } + // Then move the temporary registers to the destination. + for i, edge := range c.varEdges { + temp := c.tempRegs[i] + dst := edge[1] + c.mach.InsertMove(dst, temp, c.varEdgeTypes[i]) + } + } + + // Finally, move the constants. + for _, edge := range c.constEdges { + cInst, dst := edge.cInst, edge.dst + c.mach.InsertLoadConstant(cInst, dst) + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/abi.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/abi.go new file mode 100644 index 000000000..f75aa55be --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/abi.go @@ -0,0 +1,421 @@ +package arm64 + +import ( + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend" + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc" + "github.com/tetratelabs/wazero/internal/engine/wazevo/ssa" +) + +// References: +// * https://github.com/golang/go/blob/49d42128fd8594c172162961ead19ac95e247d24/src/cmd/compile/abi-internal.md#arm64-architecture +// * https://developer.arm.com/documentation/102374/0101/Procedure-Call-Standard + +const xArgRetRegMax, vArgRetRegMax = x7, v7 // x0-x7 & v0-v7. + +var regInfo = ®alloc.RegisterInfo{ + AllocatableRegisters: [regalloc.NumRegType][]regalloc.RealReg{ + // We don't allocate: + // - x18: Reserved by the macOS: https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms#Respect-the-purpose-of-specific-CPU-registers + // - x28: Reserved by Go runtime. + // - x27(=tmpReg): because of the reason described on tmpReg. + regalloc.RegTypeInt: { + x8, x9, x10, x11, x12, x13, x14, x15, + x16, x17, x19, x20, x21, x22, x23, x24, x25, + x26, x29, x30, + // These are the argument/return registers. Less preferred in the allocation. + x7, x6, x5, x4, x3, x2, x1, x0, + }, + regalloc.RegTypeFloat: { + v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, + v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, + // These are the argument/return registers. Less preferred in the allocation. + v7, v6, v5, v4, v3, v2, v1, v0, + }, + }, + CalleeSavedRegisters: [regalloc.RealRegsNumMax]bool{ + x19: true, x20: true, x21: true, x22: true, x23: true, x24: true, x25: true, x26: true, x28: true, + v18: true, v19: true, v20: true, v21: true, v22: true, v23: true, v24: true, v25: true, v26: true, + v27: true, v28: true, v29: true, v30: true, v31: true, + }, + CallerSavedRegisters: [regalloc.RealRegsNumMax]bool{ + x0: true, x1: true, x2: true, x3: true, x4: true, x5: true, x6: true, x7: true, x8: true, x9: true, x10: true, + x11: true, x12: true, x13: true, x14: true, x15: true, x16: true, x17: true, x29: true, x30: true, + v0: true, v1: true, v2: true, v3: true, v4: true, v5: true, v6: true, v7: true, v8: true, v9: true, v10: true, + v11: true, v12: true, v13: true, v14: true, v15: true, v16: true, v17: true, + }, + RealRegToVReg: []regalloc.VReg{ + x0: x0VReg, x1: x1VReg, x2: x2VReg, x3: x3VReg, x4: x4VReg, x5: x5VReg, x6: x6VReg, x7: x7VReg, x8: x8VReg, x9: x9VReg, x10: x10VReg, x11: x11VReg, x12: x12VReg, x13: x13VReg, x14: x14VReg, x15: x15VReg, x16: x16VReg, x17: x17VReg, x18: x18VReg, x19: x19VReg, x20: x20VReg, x21: x21VReg, x22: x22VReg, x23: x23VReg, x24: x24VReg, x25: x25VReg, x26: x26VReg, x27: x27VReg, x28: x28VReg, x29: x29VReg, x30: x30VReg, + v0: v0VReg, v1: v1VReg, v2: v2VReg, v3: v3VReg, v4: v4VReg, v5: v5VReg, v6: v6VReg, v7: v7VReg, v8: v8VReg, v9: v9VReg, v10: v10VReg, v11: v11VReg, v12: v12VReg, v13: v13VReg, v14: v14VReg, v15: v15VReg, v16: v16VReg, v17: v17VReg, v18: v18VReg, v19: v19VReg, v20: v20VReg, v21: v21VReg, v22: v22VReg, v23: v23VReg, v24: v24VReg, v25: v25VReg, v26: v26VReg, v27: v27VReg, v28: v28VReg, v29: v29VReg, v30: v30VReg, v31: v31VReg, + }, + RealRegName: func(r regalloc.RealReg) string { return regNames[r] }, + RealRegType: func(r regalloc.RealReg) regalloc.RegType { + if r < v0 { + return regalloc.RegTypeInt + } + return regalloc.RegTypeFloat + }, +} + +// abiImpl implements backend.FunctionABI. +type abiImpl struct { + m *machine + args, rets []backend.ABIArg + argStackSize, retStackSize int64 + + argRealRegs []regalloc.VReg + retRealRegs []regalloc.VReg +} + +func (m *machine) getOrCreateABIImpl(sig *ssa.Signature) *abiImpl { + if int(sig.ID) >= len(m.abis) { + m.abis = append(m.abis, make([]abiImpl, int(sig.ID)+1)...) + } + + abi := &m.abis[sig.ID] + if abi.m != nil { + return abi + } + + abi.m = m + abi.init(sig) + return abi +} + +// int initializes the abiImpl for the given signature. +func (a *abiImpl) init(sig *ssa.Signature) { + if len(a.rets) < len(sig.Results) { + a.rets = make([]backend.ABIArg, len(sig.Results)) + } + a.rets = a.rets[:len(sig.Results)] + a.retStackSize = a.setABIArgs(a.rets, sig.Results) + if argsNum := len(sig.Params); len(a.args) < argsNum { + a.args = make([]backend.ABIArg, argsNum) + } + a.args = a.args[:len(sig.Params)] + a.argStackSize = a.setABIArgs(a.args, sig.Params) + + // Gather the real registers usages in arg/return. + a.retRealRegs = a.retRealRegs[:0] + for i := range a.rets { + r := &a.rets[i] + if r.Kind == backend.ABIArgKindReg { + a.retRealRegs = append(a.retRealRegs, r.Reg) + } + } + a.argRealRegs = a.argRealRegs[:0] + for i := range a.args { + arg := &a.args[i] + if arg.Kind == backend.ABIArgKindReg { + reg := arg.Reg + a.argRealRegs = append(a.argRealRegs, reg) + } + } +} + +// setABIArgs sets the ABI arguments in the given slice. This assumes that len(s) >= len(types) +// where if len(s) > len(types), the last elements of s is for the multi-return slot. +func (a *abiImpl) setABIArgs(s []backend.ABIArg, types []ssa.Type) (stackSize int64) { + var stackOffset int64 + nextX, nextV := x0, v0 + for i, typ := range types { + arg := &s[i] + arg.Index = i + arg.Type = typ + if typ.IsInt() { + if nextX > xArgRetRegMax { + arg.Kind = backend.ABIArgKindStack + const slotSize = 8 // Align 8 bytes. + arg.Offset = stackOffset + stackOffset += slotSize + } else { + arg.Kind = backend.ABIArgKindReg + arg.Reg = regalloc.FromRealReg(nextX, regalloc.RegTypeInt) + nextX++ + } + } else { + if nextV > vArgRetRegMax { + arg.Kind = backend.ABIArgKindStack + slotSize := int64(8) // Align at least 8 bytes. + if typ.Bits() == 128 { // Vector. + slotSize = 16 + } + arg.Offset = stackOffset + stackOffset += slotSize + } else { + arg.Kind = backend.ABIArgKindReg + arg.Reg = regalloc.FromRealReg(nextV, regalloc.RegTypeFloat) + nextV++ + } + } + } + return stackOffset +} + +// CalleeGenFunctionArgsToVRegs implements backend.FunctionABI. +func (a *abiImpl) CalleeGenFunctionArgsToVRegs(args []ssa.Value) { + for i, ssaArg := range args { + if !ssaArg.Valid() { + continue + } + reg := a.m.compiler.VRegOf(ssaArg) + arg := &a.args[i] + if arg.Kind == backend.ABIArgKindReg { + a.m.InsertMove(reg, arg.Reg, arg.Type) + } else { + // TODO: we could use pair load if there's consecutive loads for the same type. + // + // (high address) + // +-----------------+ + // | ....... | + // | ret Y | + // | ....... | + // | ret 0 | + // | arg X | + // | ....... | + // | arg 1 | + // | arg 0 | <-| + // | ReturnAddress | | + // +-----------------+ | + // | ........... | | + // | spill slot M | | argStackOffset: is unknown at this point of compilation. + // | ............ | | + // | spill slot 2 | | + // | spill slot 1 | | + // | clobbered 0 | | + // | clobbered 1 | | + // | ........... | | + // | clobbered N | | + // SP---> +-----------------+ <-+ + // (low address) + + m := a.m + bits := arg.Type.Bits() + // At this point of compilation, we don't yet know how much space exist below the return address. + // So we instruct the address mode to add the `argStackOffset` to the offset at the later phase of compilation. + amode := addressMode{imm: arg.Offset, rn: spVReg, kind: addressModeKindArgStackSpace} + load := m.allocateInstr() + switch arg.Type { + case ssa.TypeI32, ssa.TypeI64: + load.asULoad(operandNR(reg), amode, bits) + case ssa.TypeF32, ssa.TypeF64, ssa.TypeV128: + load.asFpuLoad(operandNR(reg), amode, bits) + default: + panic("BUG") + } + m.insert(load) + a.m.unresolvedAddressModes = append(a.m.unresolvedAddressModes, load) + } + } +} + +// CalleeGenVRegsToFunctionReturns implements backend.FunctionABI. +func (a *abiImpl) CalleeGenVRegsToFunctionReturns(rets []ssa.Value) { + l := len(rets) - 1 + for i := range rets { + // Reverse order in order to avoid overwriting the stack returns existing in the return registers. + ret := rets[l-i] + r := &a.rets[l-i] + reg := a.m.compiler.VRegOf(ret) + if def := a.m.compiler.ValueDefinition(ret); def.IsFromInstr() { + // Constant instructions are inlined. + if inst := def.Instr; inst.Constant() { + a.m.InsertLoadConstant(inst, reg) + } + } + if r.Kind == backend.ABIArgKindReg { + a.m.InsertMove(r.Reg, reg, ret.Type()) + } else { + // TODO: we could use pair store if there's consecutive stores for the same type. + // + // (high address) + // +-----------------+ + // | ....... | + // | ret Y | + // | ....... | + // | ret 0 | <-+ + // | arg X | | + // | ....... | | + // | arg 1 | | + // | arg 0 | | + // | ReturnAddress | | + // +-----------------+ | + // | ........... | | + // | spill slot M | | retStackOffset: is unknown at this point of compilation. + // | ............ | | + // | spill slot 2 | | + // | spill slot 1 | | + // | clobbered 0 | | + // | clobbered 1 | | + // | ........... | | + // | clobbered N | | + // SP---> +-----------------+ <-+ + // (low address) + + bits := r.Type.Bits() + + // At this point of compilation, we don't yet know how much space exist below the return address. + // So we instruct the address mode to add the `retStackOffset` to the offset at the later phase of compilation. + amode := addressMode{imm: r.Offset, rn: spVReg, kind: addressModeKindResultStackSpace} + store := a.m.allocateInstr() + store.asStore(operandNR(reg), amode, bits) + a.m.insert(store) + a.m.unresolvedAddressModes = append(a.m.unresolvedAddressModes, store) + } + } +} + +// callerGenVRegToFunctionArg is the opposite of GenFunctionArgToVReg, which is used to generate the +// caller side of the function call. +func (a *abiImpl) callerGenVRegToFunctionArg(argIndex int, reg regalloc.VReg, def *backend.SSAValueDefinition, slotBegin int64) { + arg := &a.args[argIndex] + if def != nil && def.IsFromInstr() { + // Constant instructions are inlined. + if inst := def.Instr; inst.Constant() { + a.m.InsertLoadConstant(inst, reg) + } + } + if arg.Kind == backend.ABIArgKindReg { + a.m.InsertMove(arg.Reg, reg, arg.Type) + } else { + // TODO: we could use pair store if there's consecutive stores for the same type. + // + // Note that at this point, stack pointer is already adjusted. + bits := arg.Type.Bits() + amode := a.m.resolveAddressModeForOffset(arg.Offset-slotBegin, bits, spVReg, false) + store := a.m.allocateInstr() + store.asStore(operandNR(reg), amode, bits) + a.m.insert(store) + } +} + +func (a *abiImpl) callerGenFunctionReturnVReg(retIndex int, reg regalloc.VReg, slotBegin int64) { + r := &a.rets[retIndex] + if r.Kind == backend.ABIArgKindReg { + a.m.InsertMove(reg, r.Reg, r.Type) + } else { + // TODO: we could use pair load if there's consecutive loads for the same type. + amode := a.m.resolveAddressModeForOffset(a.argStackSize+r.Offset-slotBegin, r.Type.Bits(), spVReg, false) + ldr := a.m.allocateInstr() + switch r.Type { + case ssa.TypeI32, ssa.TypeI64: + ldr.asULoad(operandNR(reg), amode, r.Type.Bits()) + case ssa.TypeF32, ssa.TypeF64, ssa.TypeV128: + ldr.asFpuLoad(operandNR(reg), amode, r.Type.Bits()) + default: + panic("BUG") + } + a.m.insert(ldr) + } +} + +func (m *machine) resolveAddressModeForOffsetAndInsert(cur *instruction, offset int64, dstBits byte, rn regalloc.VReg, allowTmpRegUse bool) (*instruction, addressMode) { + m.pendingInstructions = m.pendingInstructions[:0] + mode := m.resolveAddressModeForOffset(offset, dstBits, rn, allowTmpRegUse) + for _, instr := range m.pendingInstructions { + cur = linkInstr(cur, instr) + } + return cur, mode +} + +func (m *machine) resolveAddressModeForOffset(offset int64, dstBits byte, rn regalloc.VReg, allowTmpRegUse bool) addressMode { + if rn.RegType() != regalloc.RegTypeInt { + panic("BUG: rn should be a pointer: " + formatVRegSized(rn, 64)) + } + var amode addressMode + if offsetFitsInAddressModeKindRegUnsignedImm12(dstBits, offset) { + amode = addressMode{kind: addressModeKindRegUnsignedImm12, rn: rn, imm: offset} + } else if offsetFitsInAddressModeKindRegSignedImm9(offset) { + amode = addressMode{kind: addressModeKindRegSignedImm9, rn: rn, imm: offset} + } else { + var indexReg regalloc.VReg + if allowTmpRegUse { + m.lowerConstantI64(tmpRegVReg, offset) + indexReg = tmpRegVReg + } else { + indexReg = m.compiler.AllocateVReg(ssa.TypeI64) + m.lowerConstantI64(indexReg, offset) + } + amode = addressMode{kind: addressModeKindRegReg, rn: rn, rm: indexReg, extOp: extendOpUXTX /* indicates index rm is 64-bit */} + } + return amode +} + +func (a *abiImpl) alignedArgResultStackSlotSize() int64 { + stackSlotSize := a.retStackSize + a.argStackSize + // Align stackSlotSize to 16 bytes. + stackSlotSize = (stackSlotSize + 15) &^ 15 + return stackSlotSize +} + +func (m *machine) lowerCall(si *ssa.Instruction) { + isDirectCall := si.Opcode() == ssa.OpcodeCall + var indirectCalleePtr ssa.Value + var directCallee ssa.FuncRef + var sigID ssa.SignatureID + var args []ssa.Value + if isDirectCall { + directCallee, sigID, args = si.CallData() + } else { + indirectCalleePtr, sigID, args = si.CallIndirectData() + } + calleeABI := m.getOrCreateABIImpl(m.compiler.SSABuilder().ResolveSignature(sigID)) + + stackSlotSize := calleeABI.alignedArgResultStackSlotSize() + if m.maxRequiredStackSizeForCalls < stackSlotSize+16 { + m.maxRequiredStackSizeForCalls = stackSlotSize + 16 // return address frame. + } + + for i, arg := range args { + reg := m.compiler.VRegOf(arg) + def := m.compiler.ValueDefinition(arg) + calleeABI.callerGenVRegToFunctionArg(i, reg, def, stackSlotSize) + } + + if isDirectCall { + call := m.allocateInstr() + call.asCall(directCallee, calleeABI) + m.insert(call) + } else { + ptr := m.compiler.VRegOf(indirectCalleePtr) + callInd := m.allocateInstr() + callInd.asCallIndirect(ptr, calleeABI) + m.insert(callInd) + } + + var index int + r1, rs := si.Returns() + if r1.Valid() { + calleeABI.callerGenFunctionReturnVReg(0, m.compiler.VRegOf(r1), stackSlotSize) + index++ + } + + for _, r := range rs { + calleeABI.callerGenFunctionReturnVReg(index, m.compiler.VRegOf(r), stackSlotSize) + index++ + } +} + +func (m *machine) insertAddOrSubStackPointer(rd regalloc.VReg, diff int64, add bool) { + if imm12Operand, ok := asImm12Operand(uint64(diff)); ok { + alu := m.allocateInstr() + var ao aluOp + if add { + ao = aluOpAdd + } else { + ao = aluOpSub + } + alu.asALU(ao, operandNR(rd), operandNR(spVReg), imm12Operand, true) + m.insert(alu) + } else { + m.lowerConstantI64(tmpRegVReg, diff) + alu := m.allocateInstr() + var ao aluOp + if add { + ao = aluOpAdd + } else { + ao = aluOpSub + } + alu.asALU(ao, operandNR(rd), operandNR(spVReg), operandNR(tmpRegVReg), true) + m.insert(alu) + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/abi_entry_arm64.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/abi_entry_arm64.go new file mode 100644 index 000000000..95190e046 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/abi_entry_arm64.go @@ -0,0 +1,9 @@ +package arm64 + +// entrypoint enters the machine code generated by this backend which begins with the preamble generated by abiImpl.EmitGoEntryPreamble below. +// This implements wazevo.entrypoint, and see the comments there for detail. +func entrypoint(preambleExecutable, functionExecutable *byte, executionContextPtr uintptr, moduleContextPtr *byte, paramResultPtr *uint64, goAllocatedStackSlicePtr uintptr) + +// afterGoFunctionCallEntrypoint enters the machine code after growing the stack. +// This implements wazevo.afterGoFunctionCallEntrypoint, and see the comments there for detail. +func afterGoFunctionCallEntrypoint(executable *byte, executionContextPtr uintptr, stackPointer uintptr) diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/abi_entry_arm64.s b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/abi_entry_arm64.s new file mode 100644 index 000000000..082954ca6 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/abi_entry_arm64.s @@ -0,0 +1,29 @@ +//go:build arm64 + +#include "funcdata.h" +#include "textflag.h" + +// See the comments on EmitGoEntryPreamble for what this function is supposed to do. +TEXT Ā·entrypoint(SB), NOSPLIT|NOFRAME, $0-48 + MOVD preambleExecutable+0(FP), R27 + MOVD functionExectuable+8(FP), R24 + MOVD executionContextPtr+16(FP), R0 + MOVD moduleContextPtr+24(FP), R1 + MOVD paramResultSlicePtr+32(FP), R19 + MOVD goAllocatedStackSlicePtr+40(FP), R26 + JMP (R27) + +TEXT Ā·afterGoFunctionCallEntrypoint(SB), NOSPLIT|NOFRAME, $0-24 + MOVD goCallReturnAddress+0(FP), R20 + MOVD executionContextPtr+8(FP), R0 + MOVD stackPointer+16(FP), R19 + + // Save the current FP(R29), SP and LR(R30) into the wazevo.executionContext (stored in R0). + MOVD R29, 16(R0) // Store FP(R29) into [RO, #ExecutionContextOffsets.OriginalFramePointer] + MOVD RSP, R27 // Move SP to R27 (temporary register) since SP cannot be stored directly in str instructions. + MOVD R27, 24(R0) // Store R27 into [RO, #ExecutionContextOffsets.OriginalFramePointer] + MOVD R30, 32(R0) // Store R30 into [R0, #ExecutionContextOffsets.GoReturnAddress] + + // Load the new stack pointer (which sits somewhere in Go-allocated stack) into SP. + MOVD R19, RSP + JMP (R20) diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/abi_entry_preamble.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/abi_entry_preamble.go new file mode 100644 index 000000000..0cec5cf58 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/abi_entry_preamble.go @@ -0,0 +1,231 @@ +package arm64 + +import ( + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend" + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc" + "github.com/tetratelabs/wazero/internal/engine/wazevo/ssa" + "github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi" +) + +// CompileEntryPreamble implements backend.Machine. This assumes `entrypoint` function (in abi_go_entry_arm64.s) passes: +// +// 1. First (execution context ptr) and Second arguments are already passed in x0, and x1. +// 2. param/result slice ptr in x19; the pointer to []uint64{} which is used to pass arguments and accept return values. +// 3. Go-allocated stack slice ptr in x26. +// 4. Function executable in x24. +// +// also SP and FP are correct Go-runtime-based values, and LR is the return address to the Go-side caller. +func (m *machine) CompileEntryPreamble(signature *ssa.Signature) []byte { + abi := abiImpl{} + abi.m = m + abi.init(signature) + root := abi.constructEntryPreamble() + m.encode(root) + return m.compiler.Buf() +} + +var ( + executionContextPtrReg = x0VReg + // callee-saved regs so that they can be used in the prologue and epilogue. + paramResultSlicePtr = x19VReg + savedExecutionContextPtr = x20VReg + // goAllocatedStackPtr is not used in the epilogue. + goAllocatedStackPtr = x26VReg + // paramResultSliceCopied is not used in the epilogue. + paramResultSliceCopied = x25VReg + // tmpRegVReg is not used in the epilogue. + functionExecutable = x24VReg +) + +func (m *machine) goEntryPreamblePassArg(cur *instruction, paramSlicePtr regalloc.VReg, arg *backend.ABIArg, argStartOffsetFromSP int64) *instruction { + typ := arg.Type + bits := typ.Bits() + isStackArg := arg.Kind == backend.ABIArgKindStack + + var loadTargetReg operand + if !isStackArg { + loadTargetReg = operandNR(arg.Reg) + } else { + switch typ { + case ssa.TypeI32, ssa.TypeI64: + loadTargetReg = operandNR(x15VReg) + case ssa.TypeF32, ssa.TypeF64, ssa.TypeV128: + loadTargetReg = operandNR(v15VReg) + default: + panic("TODO?") + } + } + + var postIndexImm int64 + if typ == ssa.TypeV128 { + postIndexImm = 16 // v128 is represented as 2x64-bit in Go slice. + } else { + postIndexImm = 8 + } + loadMode := addressMode{kind: addressModeKindPostIndex, rn: paramSlicePtr, imm: postIndexImm} + + instr := m.allocateInstr() + switch typ { + case ssa.TypeI32: + instr.asULoad(loadTargetReg, loadMode, 32) + case ssa.TypeI64: + instr.asULoad(loadTargetReg, loadMode, 64) + case ssa.TypeF32: + instr.asFpuLoad(loadTargetReg, loadMode, 32) + case ssa.TypeF64: + instr.asFpuLoad(loadTargetReg, loadMode, 64) + case ssa.TypeV128: + instr.asFpuLoad(loadTargetReg, loadMode, 128) + } + cur = linkInstr(cur, instr) + + if isStackArg { + var storeMode addressMode + cur, storeMode = m.resolveAddressModeForOffsetAndInsert(cur, argStartOffsetFromSP+arg.Offset, bits, spVReg, true) + toStack := m.allocateInstr() + toStack.asStore(loadTargetReg, storeMode, bits) + cur = linkInstr(cur, toStack) + } + return cur +} + +func (m *machine) goEntryPreamblePassResult(cur *instruction, resultSlicePtr regalloc.VReg, result *backend.ABIArg, resultStartOffsetFromSP int64) *instruction { + isStackArg := result.Kind == backend.ABIArgKindStack + typ := result.Type + bits := typ.Bits() + + var storeTargetReg operand + if !isStackArg { + storeTargetReg = operandNR(result.Reg) + } else { + switch typ { + case ssa.TypeI32, ssa.TypeI64: + storeTargetReg = operandNR(x15VReg) + case ssa.TypeF32, ssa.TypeF64, ssa.TypeV128: + storeTargetReg = operandNR(v15VReg) + default: + panic("TODO?") + } + } + + var postIndexImm int64 + if typ == ssa.TypeV128 { + postIndexImm = 16 // v128 is represented as 2x64-bit in Go slice. + } else { + postIndexImm = 8 + } + + if isStackArg { + var loadMode addressMode + cur, loadMode = m.resolveAddressModeForOffsetAndInsert(cur, resultStartOffsetFromSP+result.Offset, bits, spVReg, true) + toReg := m.allocateInstr() + switch typ { + case ssa.TypeI32, ssa.TypeI64: + toReg.asULoad(storeTargetReg, loadMode, bits) + case ssa.TypeF32, ssa.TypeF64, ssa.TypeV128: + toReg.asFpuLoad(storeTargetReg, loadMode, bits) + default: + panic("TODO?") + } + cur = linkInstr(cur, toReg) + } + + mode := addressMode{kind: addressModeKindPostIndex, rn: resultSlicePtr, imm: postIndexImm} + instr := m.allocateInstr() + instr.asStore(storeTargetReg, mode, bits) + cur = linkInstr(cur, instr) + return cur +} + +func (a *abiImpl) constructEntryPreamble() (root *instruction) { + m := a.m + root = m.allocateNop() + + //// ----------------------------------- prologue ----------------------------------- //// + + // First, we save executionContextPtrReg into a callee-saved register so that it can be used in epilogue as well. + // mov savedExecutionContextPtr, x0 + cur := a.move64(savedExecutionContextPtr, executionContextPtrReg, root) + + // Next, save the current FP, SP and LR into the wazevo.executionContext: + // str fp, [savedExecutionContextPtr, #OriginalFramePointer] + // mov tmp, sp ;; sp cannot be str'ed directly. + // str sp, [savedExecutionContextPtr, #OriginalStackPointer] + // str lr, [savedExecutionContextPtr, #GoReturnAddress] + cur = a.loadOrStoreAtExecutionContext(fpVReg, wazevoapi.ExecutionContextOffsetOriginalFramePointer, true, cur) + cur = a.move64(tmpRegVReg, spVReg, cur) + cur = a.loadOrStoreAtExecutionContext(tmpRegVReg, wazevoapi.ExecutionContextOffsetOriginalStackPointer, true, cur) + cur = a.loadOrStoreAtExecutionContext(lrVReg, wazevoapi.ExecutionContextOffsetGoReturnAddress, true, cur) + + // Then, move the Go-allocated stack pointer to SP: + // mov sp, goAllocatedStackPtr + cur = a.move64(spVReg, goAllocatedStackPtr, cur) + + prReg := paramResultSlicePtr + if len(a.args) > 2 && len(a.rets) > 0 { + // paramResultSlicePtr is modified during the execution of goEntryPreamblePassArg, + // so copy it to another reg. + cur = a.move64(paramResultSliceCopied, paramResultSlicePtr, cur) + prReg = paramResultSliceCopied + } + + stackSlotSize := a.alignedArgResultStackSlotSize() + for i := range a.args { + if i < 2 { + // module context ptr and execution context ptr are passed in x0 and x1 by the Go assembly function. + continue + } + arg := &a.args[i] + cur = m.goEntryPreamblePassArg(cur, prReg, arg, -stackSlotSize) + } + + // Call the real function. + bl := m.allocateInstr() + bl.asCallIndirect(functionExecutable, a) + cur = linkInstr(cur, bl) + + ///// ----------------------------------- epilogue ----------------------------------- ///// + + // Store the register results into paramResultSlicePtr. + for i := range a.rets { + cur = m.goEntryPreamblePassResult(cur, paramResultSlicePtr, &a.rets[i], a.argStackSize-stackSlotSize) + } + + // Finally, restore the FP, SP and LR, and return to the Go code. + // ldr fp, [savedExecutionContextPtr, #OriginalFramePointer] + // ldr tmp, [savedExecutionContextPtr, #OriginalStackPointer] + // mov sp, tmp ;; sp cannot be str'ed directly. + // ldr lr, [savedExecutionContextPtr, #GoReturnAddress] + // ret ;; --> return to the Go code + cur = a.loadOrStoreAtExecutionContext(fpVReg, wazevoapi.ExecutionContextOffsetOriginalFramePointer, false, cur) + cur = a.loadOrStoreAtExecutionContext(tmpRegVReg, wazevoapi.ExecutionContextOffsetOriginalStackPointer, false, cur) + cur = a.move64(spVReg, tmpRegVReg, cur) + cur = a.loadOrStoreAtExecutionContext(lrVReg, wazevoapi.ExecutionContextOffsetGoReturnAddress, false, cur) + retInst := a.m.allocateInstr() + retInst.asRet(nil) + linkInstr(cur, retInst) + return +} + +func (a *abiImpl) move64(dst, src regalloc.VReg, prev *instruction) *instruction { + instr := a.m.allocateInstr() + instr.asMove64(dst, src) + return linkInstr(prev, instr) +} + +func (a *abiImpl) loadOrStoreAtExecutionContext(d regalloc.VReg, offset wazevoapi.Offset, store bool, prev *instruction) *instruction { + instr := a.m.allocateInstr() + mode := addressMode{kind: addressModeKindRegUnsignedImm12, rn: savedExecutionContextPtr, imm: offset.I64()} + if store { + instr.asStore(operandNR(d), mode, 64) + } else { + instr.asULoad(operandNR(d), mode, 64) + } + return linkInstr(prev, instr) +} + +func linkInstr(prev, next *instruction) *instruction { + prev.next = next + next.prev = prev + return next +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/abi_go_call.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/abi_go_call.go new file mode 100644 index 000000000..e09abea55 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/abi_go_call.go @@ -0,0 +1,454 @@ +package arm64 + +import ( + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend" + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc" + "github.com/tetratelabs/wazero/internal/engine/wazevo/ssa" + "github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi" +) + +var calleeSavedRegistersSorted = []regalloc.VReg{ + x19VReg, x20VReg, x21VReg, x22VReg, x23VReg, x24VReg, x25VReg, x26VReg, x28VReg, + v18VReg, v19VReg, v20VReg, v21VReg, v22VReg, v23VReg, v24VReg, v25VReg, v26VReg, v27VReg, v28VReg, v29VReg, v30VReg, v31VReg, +} + +// CompileGoFunctionTrampoline implements backend.Machine. +func (m *machine) CompileGoFunctionTrampoline(exitCode wazevoapi.ExitCode, sig *ssa.Signature, needModuleContextPtr bool) []byte { + argBegin := 1 // Skips exec context by default. + if needModuleContextPtr { + argBegin++ + } + + abi := &abiImpl{m: m} + abi.init(sig) + m.currentABI = abi + + cur := m.allocateInstr() + cur.asNop0() + m.rootInstr = cur + + // Execution context is always the first argument. + execCtrPtr := x0VReg + + // In the following, we create the following stack layout: + // + // (high address) + // SP ------> +-----------------+ <----+ + // | ....... | | + // | ret Y | | + // | ....... | | + // | ret 0 | | + // | arg X | | size_of_arg_ret + // | ....... | | + // | arg 1 | | + // | arg 0 | <----+ <-------- originalArg0Reg + // | size_of_arg_ret | + // | ReturnAddress | + // +-----------------+ <----+ + // | xxxx | | ;; might be padded to make it 16-byte aligned. + // +--->| arg[N]/ret[M] | | + // sliceSize| | ............ | | goCallStackSize + // | | arg[1]/ret[1] | | + // +--->| arg[0]/ret[0] | <----+ <-------- arg0ret0AddrReg + // | sliceSize | + // | frame_size | + // +-----------------+ + // (low address) + // + // where the region of "arg[0]/ret[0] ... arg[N]/ret[M]" is the stack used by the Go functions, + // therefore will be accessed as the usual []uint64. So that's where we need to pass/receive + // the arguments/return values. + + // First of all, to update the SP, and create "ReturnAddress + size_of_arg_ret". + cur = m.createReturnAddrAndSizeOfArgRetSlot(cur) + + const frameInfoSize = 16 // == frame_size + sliceSize. + + // Next, we should allocate the stack for the Go function call if necessary. + goCallStackSize, sliceSizeInBytes := goFunctionCallRequiredStackSize(sig, argBegin) + cur = m.insertStackBoundsCheck(goCallStackSize+frameInfoSize, cur) + + originalArg0Reg := x17VReg // Caller save, so we can use it for whatever we want. + if m.currentABI.alignedArgResultStackSlotSize() > 0 { + // At this point, SP points to `ReturnAddress`, so add 16 to get the original arg 0 slot. + cur = m.addsAddOrSubStackPointer(cur, originalArg0Reg, frameInfoSize, true) + } + + // Save the callee saved registers. + cur = m.saveRegistersInExecutionContext(cur, calleeSavedRegistersSorted) + + // Next, we need to store all the arguments to the stack in the typical Wasm stack style. + if needModuleContextPtr { + offset := wazevoapi.ExecutionContextOffsetGoFunctionCallCalleeModuleContextOpaque.I64() + if !offsetFitsInAddressModeKindRegUnsignedImm12(64, offset) { + panic("BUG: too large or un-aligned offset for goFunctionCallCalleeModuleContextOpaque in execution context") + } + + // Module context is always the second argument. + moduleCtrPtr := x1VReg + store := m.allocateInstr() + amode := addressMode{kind: addressModeKindRegUnsignedImm12, rn: execCtrPtr, imm: offset} + store.asStore(operandNR(moduleCtrPtr), amode, 64) + cur = linkInstr(cur, store) + } + + // Advances the stack pointer. + cur = m.addsAddOrSubStackPointer(cur, spVReg, goCallStackSize, false) + + // Copy the pointer to x15VReg. + arg0ret0AddrReg := x15VReg // Caller save, so we can use it for whatever we want. + copySp := m.allocateInstr() + copySp.asMove64(arg0ret0AddrReg, spVReg) + cur = linkInstr(cur, copySp) + + for i := range abi.args[argBegin:] { + arg := &abi.args[argBegin+i] + store := m.allocateInstr() + var v regalloc.VReg + if arg.Kind == backend.ABIArgKindReg { + v = arg.Reg + } else { + cur, v = m.goFunctionCallLoadStackArg(cur, originalArg0Reg, arg, + // Caller save, so we can use it for whatever we want. + x11VReg, v11VReg) + } + + var sizeInBits byte + if arg.Type == ssa.TypeV128 { + sizeInBits = 128 + } else { + sizeInBits = 64 + } + store.asStore(operandNR(v), + addressMode{ + kind: addressModeKindPostIndex, + rn: arg0ret0AddrReg, imm: int64(sizeInBits / 8), + }, sizeInBits) + cur = linkInstr(cur, store) + } + + // Finally, now that we've advanced SP to arg[0]/ret[0], we allocate `frame_size + sliceSize`. + var frameSizeReg, sliceSizeReg regalloc.VReg + if goCallStackSize > 0 { + cur = m.lowerConstantI64AndInsert(cur, tmpRegVReg, goCallStackSize) + frameSizeReg = tmpRegVReg + cur = m.lowerConstantI64AndInsert(cur, x16VReg, sliceSizeInBytes/8) + sliceSizeReg = x16VReg + } else { + frameSizeReg = xzrVReg + sliceSizeReg = xzrVReg + } + _amode := addressModePreOrPostIndex(spVReg, -16, true) + storeP := m.allocateInstr() + storeP.asStorePair64(frameSizeReg, sliceSizeReg, _amode) + cur = linkInstr(cur, storeP) + + // Set the exit status on the execution context. + cur = m.setExitCode(cur, x0VReg, exitCode) + + // Save the current stack pointer. + cur = m.saveCurrentStackPointer(cur, x0VReg) + + // Exit the execution. + cur = m.storeReturnAddressAndExit(cur) + + // After the call, we need to restore the callee saved registers. + cur = m.restoreRegistersInExecutionContext(cur, calleeSavedRegistersSorted) + + // Get the pointer to the arg[0]/ret[0]: We need to skip `frame_size + sliceSize`. + if len(abi.rets) > 0 { + cur = m.addsAddOrSubStackPointer(cur, arg0ret0AddrReg, frameInfoSize, true) + } + + // Advances the SP so that it points to `ReturnAddress`. + cur = m.addsAddOrSubStackPointer(cur, spVReg, frameInfoSize+goCallStackSize, true) + ldr := m.allocateInstr() + // And load the return address. + ldr.asULoad(operandNR(lrVReg), + addressModePreOrPostIndex(spVReg, 16 /* stack pointer must be 16-byte aligned. */, false /* increment after loads */), 64) + cur = linkInstr(cur, ldr) + + originalRet0Reg := x17VReg // Caller save, so we can use it for whatever we want. + if m.currentABI.retStackSize > 0 { + cur = m.addsAddOrSubStackPointer(cur, originalRet0Reg, m.currentABI.argStackSize, true) + } + + // Make the SP point to the original address (above the result slot). + if s := m.currentABI.alignedArgResultStackSlotSize(); s > 0 { + cur = m.addsAddOrSubStackPointer(cur, spVReg, s, true) + } + + for i := range abi.rets { + r := &abi.rets[i] + if r.Kind == backend.ABIArgKindReg { + loadIntoReg := m.allocateInstr() + mode := addressMode{kind: addressModeKindPostIndex, rn: arg0ret0AddrReg} + switch r.Type { + case ssa.TypeI32: + mode.imm = 8 // We use uint64 for all basic types, except SIMD v128. + loadIntoReg.asULoad(operandNR(r.Reg), mode, 32) + case ssa.TypeI64: + mode.imm = 8 // We use uint64 for all basic types, except SIMD v128. + loadIntoReg.asULoad(operandNR(r.Reg), mode, 64) + case ssa.TypeF32: + mode.imm = 8 // We use uint64 for all basic types, except SIMD v128. + loadIntoReg.asFpuLoad(operandNR(r.Reg), mode, 32) + case ssa.TypeF64: + mode.imm = 8 // We use uint64 for all basic types, except SIMD v128. + loadIntoReg.asFpuLoad(operandNR(r.Reg), mode, 64) + case ssa.TypeV128: + mode.imm = 16 + loadIntoReg.asFpuLoad(operandNR(r.Reg), mode, 128) + default: + panic("TODO") + } + cur = linkInstr(cur, loadIntoReg) + } else { + // First we need to load the value to a temporary just like ^^. + intTmp, floatTmp := x11VReg, v11VReg + loadIntoTmpReg := m.allocateInstr() + mode := addressMode{kind: addressModeKindPostIndex, rn: arg0ret0AddrReg} + var resultReg regalloc.VReg + switch r.Type { + case ssa.TypeI32: + mode.imm = 8 // We use uint64 for all basic types, except SIMD v128. + loadIntoTmpReg.asULoad(operandNR(intTmp), mode, 32) + resultReg = intTmp + case ssa.TypeI64: + mode.imm = 8 // We use uint64 for all basic types, except SIMD v128. + loadIntoTmpReg.asULoad(operandNR(intTmp), mode, 64) + resultReg = intTmp + case ssa.TypeF32: + mode.imm = 8 // We use uint64 for all basic types, except SIMD v128. + loadIntoTmpReg.asFpuLoad(operandNR(floatTmp), mode, 32) + resultReg = floatTmp + case ssa.TypeF64: + mode.imm = 8 // We use uint64 for all basic types, except SIMD v128. + loadIntoTmpReg.asFpuLoad(operandNR(floatTmp), mode, 64) + resultReg = floatTmp + case ssa.TypeV128: + mode.imm = 16 + loadIntoTmpReg.asFpuLoad(operandNR(floatTmp), mode, 128) + resultReg = floatTmp + default: + panic("TODO") + } + cur = linkInstr(cur, loadIntoTmpReg) + cur = m.goFunctionCallStoreStackResult(cur, originalRet0Reg, r, resultReg) + } + } + + ret := m.allocateInstr() + ret.asRet(nil) + linkInstr(cur, ret) + + m.encode(m.rootInstr) + return m.compiler.Buf() +} + +func (m *machine) saveRegistersInExecutionContext(cur *instruction, regs []regalloc.VReg) *instruction { + offset := wazevoapi.ExecutionContextOffsetSavedRegistersBegin.I64() + for _, v := range regs { + store := m.allocateInstr() + var sizeInBits byte + switch v.RegType() { + case regalloc.RegTypeInt: + sizeInBits = 64 + case regalloc.RegTypeFloat: + sizeInBits = 128 + } + store.asStore(operandNR(v), + addressMode{ + kind: addressModeKindRegUnsignedImm12, + // Execution context is always the first argument. + rn: x0VReg, imm: offset, + }, sizeInBits) + store.prev = cur + cur.next = store + cur = store + offset += 16 // Imm12 must be aligned 16 for vector regs, so we unconditionally store regs at the offset of multiple of 16. + } + return cur +} + +func (m *machine) restoreRegistersInExecutionContext(cur *instruction, regs []regalloc.VReg) *instruction { + offset := wazevoapi.ExecutionContextOffsetSavedRegistersBegin.I64() + for _, v := range regs { + load := m.allocateInstr() + var as func(dst operand, amode addressMode, sizeInBits byte) + var sizeInBits byte + switch v.RegType() { + case regalloc.RegTypeInt: + as = load.asULoad + sizeInBits = 64 + case regalloc.RegTypeFloat: + as = load.asFpuLoad + sizeInBits = 128 + } + as(operandNR(v), + addressMode{ + kind: addressModeKindRegUnsignedImm12, + // Execution context is always the first argument. + rn: x0VReg, imm: offset, + }, sizeInBits) + cur = linkInstr(cur, load) + offset += 16 // Imm12 must be aligned 16 for vector regs, so we unconditionally load regs at the offset of multiple of 16. + } + return cur +} + +func (m *machine) lowerConstantI64AndInsert(cur *instruction, dst regalloc.VReg, v int64) *instruction { + m.pendingInstructions = m.pendingInstructions[:0] + m.lowerConstantI64(dst, v) + for _, instr := range m.pendingInstructions { + cur = linkInstr(cur, instr) + } + return cur +} + +func (m *machine) lowerConstantI32AndInsert(cur *instruction, dst regalloc.VReg, v int32) *instruction { + m.pendingInstructions = m.pendingInstructions[:0] + m.lowerConstantI32(dst, v) + for _, instr := range m.pendingInstructions { + cur = linkInstr(cur, instr) + } + return cur +} + +func (m *machine) setExitCode(cur *instruction, execCtr regalloc.VReg, exitCode wazevoapi.ExitCode) *instruction { + constReg := x17VReg // caller-saved, so we can use it. + cur = m.lowerConstantI32AndInsert(cur, constReg, int32(exitCode)) + + // Set the exit status on the execution context. + setExistStatus := m.allocateInstr() + setExistStatus.asStore(operandNR(constReg), + addressMode{ + kind: addressModeKindRegUnsignedImm12, + rn: execCtr, imm: wazevoapi.ExecutionContextOffsetExitCodeOffset.I64(), + }, 32) + cur = linkInstr(cur, setExistStatus) + return cur +} + +func (m *machine) storeReturnAddressAndExit(cur *instruction) *instruction { + // Read the return address into tmp, and store it in the execution context. + adr := m.allocateInstr() + adr.asAdr(tmpRegVReg, exitSequenceSize+8) + cur = linkInstr(cur, adr) + + storeReturnAddr := m.allocateInstr() + storeReturnAddr.asStore(operandNR(tmpRegVReg), + addressMode{ + kind: addressModeKindRegUnsignedImm12, + // Execution context is always the first argument. + rn: x0VReg, imm: wazevoapi.ExecutionContextOffsetGoCallReturnAddress.I64(), + }, 64) + cur = linkInstr(cur, storeReturnAddr) + + // Exit the execution. + trapSeq := m.allocateInstr() + trapSeq.asExitSequence(x0VReg) + cur = linkInstr(cur, trapSeq) + return cur +} + +func (m *machine) saveCurrentStackPointer(cur *instruction, execCtr regalloc.VReg) *instruction { + // Save the current stack pointer: + // mov tmp, sp, + // str tmp, [exec_ctx, #stackPointerBeforeGoCall] + movSp := m.allocateInstr() + movSp.asMove64(tmpRegVReg, spVReg) + cur = linkInstr(cur, movSp) + + strSp := m.allocateInstr() + strSp.asStore(operandNR(tmpRegVReg), + addressMode{ + kind: addressModeKindRegUnsignedImm12, + rn: execCtr, imm: wazevoapi.ExecutionContextOffsetStackPointerBeforeGoCall.I64(), + }, 64) + cur = linkInstr(cur, strSp) + return cur +} + +// goFunctionCallRequiredStackSize returns the size of the stack required for the Go function call. +func goFunctionCallRequiredStackSize(sig *ssa.Signature, argBegin int) (ret, retUnaligned int64) { + var paramNeededInBytes, resultNeededInBytes int64 + for _, p := range sig.Params[argBegin:] { + s := int64(p.Size()) + if s < 8 { + s = 8 // We use uint64 for all basic types, except SIMD v128. + } + paramNeededInBytes += s + } + for _, r := range sig.Results { + s := int64(r.Size()) + if s < 8 { + s = 8 // We use uint64 for all basic types, except SIMD v128. + } + resultNeededInBytes += s + } + + if paramNeededInBytes > resultNeededInBytes { + ret = paramNeededInBytes + } else { + ret = resultNeededInBytes + } + retUnaligned = ret + // Align to 16 bytes. + ret = (ret + 15) &^ 15 + return +} + +func (m *machine) goFunctionCallLoadStackArg(cur *instruction, originalArg0Reg regalloc.VReg, arg *backend.ABIArg, intVReg, floatVReg regalloc.VReg) (*instruction, regalloc.VReg) { + load := m.allocateInstr() + var result regalloc.VReg + mode := addressMode{kind: addressModeKindPostIndex, rn: originalArg0Reg} + switch arg.Type { + case ssa.TypeI32: + mode.imm = 8 // We use uint64 for all basic types, except SIMD v128. + load.asULoad(operandNR(intVReg), mode, 32) + result = intVReg + case ssa.TypeI64: + mode.imm = 8 // We use uint64 for all basic types, except SIMD v128. + load.asULoad(operandNR(intVReg), mode, 64) + result = intVReg + case ssa.TypeF32: + mode.imm = 8 // We use uint64 for all basic types, except SIMD v128. + load.asFpuLoad(operandNR(floatVReg), mode, 32) + result = floatVReg + case ssa.TypeF64: + mode.imm = 8 // We use uint64 for all basic types, except SIMD v128. + load.asFpuLoad(operandNR(floatVReg), mode, 64) + result = floatVReg + case ssa.TypeV128: + mode.imm = 16 + load.asFpuLoad(operandNR(floatVReg), mode, 128) + result = floatVReg + default: + panic("TODO") + } + + cur = linkInstr(cur, load) + return cur, result +} + +func (m *machine) goFunctionCallStoreStackResult(cur *instruction, originalRet0Reg regalloc.VReg, result *backend.ABIArg, resultVReg regalloc.VReg) *instruction { + store := m.allocateInstr() + mode := addressMode{kind: addressModeKindPostIndex, rn: originalRet0Reg} + var sizeInBits byte + switch result.Type { + case ssa.TypeI32, ssa.TypeF32: + mode.imm = 8 + sizeInBits = 32 + case ssa.TypeI64, ssa.TypeF64: + mode.imm = 8 + sizeInBits = 64 + case ssa.TypeV128: + mode.imm = 16 + sizeInBits = 128 + default: + panic("TODO") + } + store.asStore(operandNR(resultVReg), mode, sizeInBits) + return linkInstr(cur, store) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/cond.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/cond.go new file mode 100644 index 000000000..6f6cdd1b2 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/cond.go @@ -0,0 +1,215 @@ +package arm64 + +import ( + "strconv" + + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc" + "github.com/tetratelabs/wazero/internal/engine/wazevo/ssa" +) + +type ( + cond uint64 + condKind byte +) + +const ( + // condKindRegisterZero represents a condition which checks if the register is zero. + // This indicates that the instruction must be encoded as CBZ: + // https://developer.arm.com/documentation/ddi0596/2020-12/Base-Instructions/CBZ--Compare-and-Branch-on-Zero- + condKindRegisterZero condKind = iota + // condKindRegisterNotZero indicates that the instruction must be encoded as CBNZ: + // https://developer.arm.com/documentation/ddi0596/2020-12/Base-Instructions/CBNZ--Compare-and-Branch-on-Nonzero- + condKindRegisterNotZero + // condKindCondFlagSet indicates that the instruction must be encoded as B.cond: + // https://developer.arm.com/documentation/ddi0596/2020-12/Base-Instructions/B-cond--Branch-conditionally- + condKindCondFlagSet +) + +// kind returns the kind of condition which is stored in the first two bits. +func (c cond) kind() condKind { + return condKind(c & 0b11) +} + +func (c cond) asUint64() uint64 { + return uint64(c) +} + +// register returns the register for register conditions. +// This panics if the condition is not a register condition (condKindRegisterZero or condKindRegisterNotZero). +func (c cond) register() regalloc.VReg { + if c.kind() != condKindRegisterZero && c.kind() != condKindRegisterNotZero { + panic("condition is not a register") + } + return regalloc.VReg(c >> 2) +} + +func registerAsRegZeroCond(r regalloc.VReg) cond { + return cond(r)<<2 | cond(condKindRegisterZero) +} + +func registerAsRegNotZeroCond(r regalloc.VReg) cond { + return cond(r)<<2 | cond(condKindRegisterNotZero) +} + +func (c cond) flag() condFlag { + if c.kind() != condKindCondFlagSet { + panic("condition is not a flag") + } + return condFlag(c >> 2) +} + +func (c condFlag) asCond() cond { + return cond(c)<<2 | cond(condKindCondFlagSet) +} + +// condFlag represents a condition flag for conditional branches. +// The value matches the encoding of condition flags in the ARM64 instruction set. +// https://developer.arm.com/documentation/den0024/a/The-A64-instruction-set/Data-processing-instructions/Conditional-instructions +type condFlag uint8 + +const ( + eq condFlag = iota // eq represents "equal" + ne // ne represents "not equal" + hs // hs represents "higher or same" + lo // lo represents "lower" + mi // mi represents "minus or negative result" + pl // pl represents "plus or positive result" + vs // vs represents "overflow set" + vc // vc represents "overflow clear" + hi // hi represents "higher" + ls // ls represents "lower or same" + ge // ge represents "greater or equal" + lt // lt represents "less than" + gt // gt represents "greater than" + le // le represents "less than or equal" + al // al represents "always" + nv // nv represents "never" +) + +// invert returns the inverted condition. +func (c condFlag) invert() condFlag { + switch c { + case eq: + return ne + case ne: + return eq + case hs: + return lo + case lo: + return hs + case mi: + return pl + case pl: + return mi + case vs: + return vc + case vc: + return vs + case hi: + return ls + case ls: + return hi + case ge: + return lt + case lt: + return ge + case gt: + return le + case le: + return gt + case al: + return nv + case nv: + return al + default: + panic(c) + } +} + +// String implements fmt.Stringer. +func (c condFlag) String() string { + switch c { + case eq: + return "eq" + case ne: + return "ne" + case hs: + return "hs" + case lo: + return "lo" + case mi: + return "mi" + case pl: + return "pl" + case vs: + return "vs" + case vc: + return "vc" + case hi: + return "hi" + case ls: + return "ls" + case ge: + return "ge" + case lt: + return "lt" + case gt: + return "gt" + case le: + return "le" + case al: + return "al" + case nv: + return "nv" + default: + panic(strconv.Itoa(int(c))) + } +} + +// condFlagFromSSAIntegerCmpCond returns the condition flag for the given ssa.IntegerCmpCond. +func condFlagFromSSAIntegerCmpCond(c ssa.IntegerCmpCond) condFlag { + switch c { + case ssa.IntegerCmpCondEqual: + return eq + case ssa.IntegerCmpCondNotEqual: + return ne + case ssa.IntegerCmpCondSignedLessThan: + return lt + case ssa.IntegerCmpCondSignedGreaterThanOrEqual: + return ge + case ssa.IntegerCmpCondSignedGreaterThan: + return gt + case ssa.IntegerCmpCondSignedLessThanOrEqual: + return le + case ssa.IntegerCmpCondUnsignedLessThan: + return lo + case ssa.IntegerCmpCondUnsignedGreaterThanOrEqual: + return hs + case ssa.IntegerCmpCondUnsignedGreaterThan: + return hi + case ssa.IntegerCmpCondUnsignedLessThanOrEqual: + return ls + default: + panic(c) + } +} + +// condFlagFromSSAFloatCmpCond returns the condition flag for the given ssa.FloatCmpCond. +func condFlagFromSSAFloatCmpCond(c ssa.FloatCmpCond) condFlag { + switch c { + case ssa.FloatCmpCondEqual: + return eq + case ssa.FloatCmpCondNotEqual: + return ne + case ssa.FloatCmpCondLessThan: + return mi + case ssa.FloatCmpCondLessThanOrEqual: + return ls + case ssa.FloatCmpCondGreaterThan: + return gt + case ssa.FloatCmpCondGreaterThanOrEqual: + return ge + default: + panic(c) + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/instr.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/instr.go new file mode 100644 index 000000000..3aa50e4c8 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/instr.go @@ -0,0 +1,2362 @@ +package arm64 + +import ( + "fmt" + "math" + "strings" + + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc" + "github.com/tetratelabs/wazero/internal/engine/wazevo/ssa" +) + +type ( + // instruction represents either a real instruction in arm64, or the meta instructions + // that are convenient for code generation. For example, inline constants are also treated + // as instructions. + // + // Basically, each instruction knows how to get encoded in binaries. Hence, the final output of compilation + // can be considered equivalent to the sequence of such instructions. + // + // Each field is interpreted depending on the kind. + // + // TODO: optimize the layout later once the impl settles. + instruction struct { + kind instructionKind + prev, next *instruction + u1, u2, u3 uint64 + rd, rm, rn, ra operand + amode addressMode + abi *abiImpl + targets []uint32 + addedBeforeRegAlloc bool + } + + // instructionKind represents the kind of instruction. + // This controls how the instruction struct is interpreted. + instructionKind int +) + +// IsCall implements regalloc.Instr IsCall. +func (i *instruction) IsCall() bool { + return i.kind == call +} + +// IsIndirectCall implements regalloc.Instr IsIndirectCall. +func (i *instruction) IsIndirectCall() bool { + return i.kind == callInd +} + +// IsReturn implements regalloc.Instr IsReturn. +func (i *instruction) IsReturn() bool { + return i.kind == ret +} + +type defKind byte + +const ( + defKindNone defKind = iota + 1 + defKindRD + defKindCall +) + +var defKinds = [numInstructionKinds]defKind{ + adr: defKindRD, + aluRRR: defKindRD, + aluRRRR: defKindRD, + aluRRImm12: defKindRD, + aluRRBitmaskImm: defKindRD, + aluRRRShift: defKindRD, + aluRRImmShift: defKindRD, + aluRRRExtend: defKindRD, + bitRR: defKindRD, + movZ: defKindRD, + movK: defKindRD, + movN: defKindRD, + mov32: defKindRD, + mov64: defKindRD, + fpuMov64: defKindRD, + fpuMov128: defKindRD, + fpuRR: defKindRD, + fpuRRR: defKindRD, + nop0: defKindNone, + call: defKindCall, + callInd: defKindCall, + ret: defKindNone, + store8: defKindNone, + store16: defKindNone, + store32: defKindNone, + store64: defKindNone, + exitSequence: defKindNone, + condBr: defKindNone, + br: defKindNone, + brTableSequence: defKindNone, + cSet: defKindRD, + extend: defKindRD, + fpuCmp: defKindNone, + uLoad8: defKindRD, + uLoad16: defKindRD, + uLoad32: defKindRD, + sLoad8: defKindRD, + sLoad16: defKindRD, + sLoad32: defKindRD, + uLoad64: defKindRD, + fpuLoad32: defKindRD, + fpuLoad64: defKindRD, + fpuLoad128: defKindRD, + vecLoad1R: defKindRD, + loadFpuConst32: defKindRD, + loadFpuConst64: defKindRD, + loadFpuConst128: defKindRD, + fpuStore32: defKindNone, + fpuStore64: defKindNone, + fpuStore128: defKindNone, + udf: defKindNone, + cSel: defKindRD, + fpuCSel: defKindRD, + movToVec: defKindRD, + movFromVec: defKindRD, + movFromVecSigned: defKindRD, + vecDup: defKindRD, + vecDupElement: defKindRD, + vecExtract: defKindRD, + vecMisc: defKindRD, + vecMovElement: defKindRD, + vecLanes: defKindRD, + vecShiftImm: defKindRD, + vecTbl: defKindRD, + vecTbl2: defKindRD, + vecPermute: defKindRD, + vecRRR: defKindRD, + vecRRRRewrite: defKindNone, + fpuToInt: defKindRD, + intToFpu: defKindRD, + cCmpImm: defKindNone, + movToFPSR: defKindNone, + movFromFPSR: defKindRD, + emitSourceOffsetInfo: defKindNone, +} + +// Defs returns the list of regalloc.VReg that are defined by the instruction. +// In order to reduce the number of allocations, the caller can pass the slice to be used. +func (i *instruction) Defs(regs *[]regalloc.VReg) []regalloc.VReg { + *regs = (*regs)[:0] + switch defKinds[i.kind] { + case defKindNone: + case defKindRD: + *regs = append(*regs, i.rd.nr()) + case defKindCall: + *regs = append(*regs, i.abi.retRealRegs...) + default: + panic(fmt.Sprintf("defKind for %v not defined", i)) + } + return *regs +} + +// AssignDef implements regalloc.Instr AssignDef. +func (i *instruction) AssignDef(reg regalloc.VReg) { + switch defKinds[i.kind] { + case defKindNone: + case defKindRD: + i.rd = i.rd.assignReg(reg) + case defKindCall: + panic("BUG: call instructions shouldn't be assigned") + default: + panic(fmt.Sprintf("defKind for %v not defined", i)) + } +} + +type useKind byte + +const ( + useKindNone useKind = iota + 1 + useKindRN + useKindRNRM + useKindRNRMRA + useKindRNRN1RM + useKindRet + useKindCall + useKindCallInd + useKindAMode + useKindRNAMode + useKindCond + useKindVecRRRRewrite +) + +var useKinds = [numInstructionKinds]useKind{ + udf: useKindNone, + aluRRR: useKindRNRM, + aluRRRR: useKindRNRMRA, + aluRRImm12: useKindRN, + aluRRBitmaskImm: useKindRN, + aluRRRShift: useKindRNRM, + aluRRImmShift: useKindRN, + aluRRRExtend: useKindRNRM, + bitRR: useKindRN, + movZ: useKindNone, + movK: useKindNone, + movN: useKindNone, + mov32: useKindRN, + mov64: useKindRN, + fpuMov64: useKindRN, + fpuMov128: useKindRN, + fpuRR: useKindRN, + fpuRRR: useKindRNRM, + nop0: useKindNone, + call: useKindCall, + callInd: useKindCallInd, + ret: useKindRet, + store8: useKindRNAMode, + store16: useKindRNAMode, + store32: useKindRNAMode, + store64: useKindRNAMode, + exitSequence: useKindRN, + condBr: useKindCond, + br: useKindNone, + brTableSequence: useKindRN, + cSet: useKindNone, + extend: useKindRN, + fpuCmp: useKindRNRM, + uLoad8: useKindAMode, + uLoad16: useKindAMode, + uLoad32: useKindAMode, + sLoad8: useKindAMode, + sLoad16: useKindAMode, + sLoad32: useKindAMode, + uLoad64: useKindAMode, + fpuLoad32: useKindAMode, + fpuLoad64: useKindAMode, + fpuLoad128: useKindAMode, + fpuStore32: useKindRNAMode, + fpuStore64: useKindRNAMode, + fpuStore128: useKindRNAMode, + loadFpuConst32: useKindNone, + loadFpuConst64: useKindNone, + loadFpuConst128: useKindNone, + vecLoad1R: useKindRN, + cSel: useKindRNRM, + fpuCSel: useKindRNRM, + movToVec: useKindRN, + movFromVec: useKindRN, + movFromVecSigned: useKindRN, + vecDup: useKindRN, + vecDupElement: useKindRN, + vecExtract: useKindRNRM, + cCmpImm: useKindRN, + vecMisc: useKindRN, + vecMovElement: useKindRN, + vecLanes: useKindRN, + vecShiftImm: useKindRN, + vecTbl: useKindRNRM, + vecTbl2: useKindRNRN1RM, + vecRRR: useKindRNRM, + vecRRRRewrite: useKindVecRRRRewrite, + vecPermute: useKindRNRM, + fpuToInt: useKindRN, + intToFpu: useKindRN, + movToFPSR: useKindRN, + movFromFPSR: useKindNone, + adr: useKindNone, + emitSourceOffsetInfo: useKindNone, +} + +// Uses returns the list of regalloc.VReg that are used by the instruction. +// In order to reduce the number of allocations, the caller can pass the slice to be used. +func (i *instruction) Uses(regs *[]regalloc.VReg) []regalloc.VReg { + *regs = (*regs)[:0] + switch useKinds[i.kind] { + case useKindNone: + case useKindRN: + if rn := i.rn.reg(); rn.Valid() { + *regs = append(*regs, rn) + } + case useKindRNRM: + if rn := i.rn.reg(); rn.Valid() { + *regs = append(*regs, rn) + } + if rm := i.rm.reg(); rm.Valid() { + *regs = append(*regs, rm) + } + case useKindRNRMRA: + if rn := i.rn.reg(); rn.Valid() { + *regs = append(*regs, rn) + } + if rm := i.rm.reg(); rm.Valid() { + *regs = append(*regs, rm) + } + if ra := i.ra.reg(); ra.Valid() { + *regs = append(*regs, ra) + } + case useKindRNRN1RM: + if rn := i.rn.reg(); rn.Valid() && rn.IsRealReg() { + rn1 := regalloc.FromRealReg(rn.RealReg()+1, rn.RegType()) + *regs = append(*regs, rn, rn1) + } + if rm := i.rm.reg(); rm.Valid() { + *regs = append(*regs, rm) + } + case useKindRet: + *regs = append(*regs, i.abi.retRealRegs...) + case useKindAMode: + if amodeRN := i.amode.rn; amodeRN.Valid() { + *regs = append(*regs, amodeRN) + } + if amodeRM := i.amode.rm; amodeRM.Valid() { + *regs = append(*regs, amodeRM) + } + case useKindRNAMode: + *regs = append(*regs, i.rn.reg()) + if amodeRN := i.amode.rn; amodeRN.Valid() { + *regs = append(*regs, amodeRN) + } + if amodeRM := i.amode.rm; amodeRM.Valid() { + *regs = append(*regs, amodeRM) + } + case useKindCond: + cnd := cond(i.u1) + if cnd.kind() != condKindCondFlagSet { + *regs = append(*regs, cnd.register()) + } + case useKindCall: + *regs = append(*regs, i.abi.argRealRegs...) + case useKindCallInd: + *regs = append(*regs, i.rn.nr()) + *regs = append(*regs, i.abi.argRealRegs...) + case useKindVecRRRRewrite: + *regs = append(*regs, i.rn.reg()) + *regs = append(*regs, i.rm.reg()) + *regs = append(*regs, i.rd.reg()) + default: + panic(fmt.Sprintf("useKind for %v not defined", i)) + } + return *regs +} + +func (i *instruction) AssignUse(index int, reg regalloc.VReg) { + switch useKinds[i.kind] { + case useKindNone: + case useKindRN: + if rn := i.rn.reg(); rn.Valid() { + i.rn = i.rn.assignReg(reg) + } + case useKindRNRM: + if index == 0 { + if rn := i.rn.reg(); rn.Valid() { + i.rn = i.rn.assignReg(reg) + } + } else { + if rm := i.rm.reg(); rm.Valid() { + i.rm = i.rm.assignReg(reg) + } + } + case useKindVecRRRRewrite: + if index == 0 { + if rn := i.rn.reg(); rn.Valid() { + i.rn = i.rn.assignReg(reg) + } + } else if index == 1 { + if rm := i.rm.reg(); rm.Valid() { + i.rm = i.rm.assignReg(reg) + } + } else { + if rd := i.rd.reg(); rd.Valid() { + i.rd = i.rd.assignReg(reg) + } + } + case useKindRNRN1RM: + if index == 0 { + if rn := i.rn.reg(); rn.Valid() { + i.rn = i.rn.assignReg(reg) + } + if rn1 := i.rn.reg() + 1; rn1.Valid() { + i.rm = i.rm.assignReg(reg + 1) + } + } else { + if rm := i.rm.reg(); rm.Valid() { + i.rm = i.rm.assignReg(reg) + } + } + case useKindRNRMRA: + if index == 0 { + if rn := i.rn.reg(); rn.Valid() { + i.rn = i.rn.assignReg(reg) + } + } else if index == 1 { + if rm := i.rm.reg(); rm.Valid() { + i.rm = i.rm.assignReg(reg) + } + } else { + if ra := i.ra.reg(); ra.Valid() { + i.ra = i.ra.assignReg(reg) + } + } + case useKindRet: + panic("BUG: ret instructions shouldn't be assigned") + case useKindAMode: + if index == 0 { + if amodeRN := i.amode.rn; amodeRN.Valid() { + i.amode.rn = reg + } + } else { + if amodeRM := i.amode.rm; amodeRM.Valid() { + i.amode.rm = reg + } + } + case useKindRNAMode: + if index == 0 { + i.rn = i.rn.assignReg(reg) + } else if index == 1 { + if amodeRN := i.amode.rn; amodeRN.Valid() { + i.amode.rn = reg + } else { + panic("BUG") + } + } else { + if amodeRM := i.amode.rm; amodeRM.Valid() { + i.amode.rm = reg + } else { + panic("BUG") + } + } + case useKindCond: + c := cond(i.u1) + switch c.kind() { + case condKindRegisterZero: + i.u1 = uint64(registerAsRegZeroCond(reg)) + case condKindRegisterNotZero: + i.u1 = uint64(registerAsRegNotZeroCond(reg)) + } + case useKindCall: + panic("BUG: call instructions shouldn't be assigned") + case useKindCallInd: + i.rn = i.rn.assignReg(reg) + default: + panic(fmt.Sprintf("useKind for %v not defined", i)) + } +} + +func (i *instruction) asCall(ref ssa.FuncRef, abi *abiImpl) { + i.kind = call + i.u1 = uint64(ref) + i.abi = abi +} + +func (i *instruction) asCallIndirect(ptr regalloc.VReg, abi *abiImpl) { + i.kind = callInd + i.rn = operandNR(ptr) + i.abi = abi +} + +func (i *instruction) callFuncRef() ssa.FuncRef { + return ssa.FuncRef(i.u1) +} + +// shift must be divided by 16 and must be in range 0-3 (if dst64bit is true) or 0-1 (if dst64bit is false) +func (i *instruction) asMOVZ(dst regalloc.VReg, imm uint64, shift uint64, dst64bit bool) { + i.kind = movZ + i.rd = operandNR(dst) + i.u1 = imm + i.u2 = shift + if dst64bit { + i.u3 = 1 + } +} + +// shift must be divided by 16 and must be in range 0-3 (if dst64bit is true) or 0-1 (if dst64bit is false) +func (i *instruction) asMOVK(dst regalloc.VReg, imm uint64, shift uint64, dst64bit bool) { + i.kind = movK + i.rd = operandNR(dst) + i.u1 = imm + i.u2 = shift + if dst64bit { + i.u3 = 1 + } +} + +// shift must be divided by 16 and must be in range 0-3 (if dst64bit is true) or 0-1 (if dst64bit is false) +func (i *instruction) asMOVN(dst regalloc.VReg, imm uint64, shift uint64, dst64bit bool) { + i.kind = movN + i.rd = operandNR(dst) + i.u1 = imm + i.u2 = shift + if dst64bit { + i.u3 = 1 + } +} + +func (i *instruction) asNop0() *instruction { + i.kind = nop0 + return i +} + +func (i *instruction) asNop0WithLabel(l label) { + i.kind = nop0 + i.u1 = uint64(l) +} + +func (i *instruction) nop0Label() label { + return label(i.u1) +} + +func (i *instruction) asRet(abi *abiImpl) { + i.kind = ret + i.abi = abi +} + +func (i *instruction) asStorePair64(src1, src2 regalloc.VReg, amode addressMode) { + i.kind = storeP64 + i.rn = operandNR(src1) + i.rm = operandNR(src2) + i.amode = amode +} + +func (i *instruction) asLoadPair64(src1, src2 regalloc.VReg, amode addressMode) { + i.kind = loadP64 + i.rn = operandNR(src1) + i.rm = operandNR(src2) + i.amode = amode +} + +func (i *instruction) asStore(src operand, amode addressMode, sizeInBits byte) { + switch sizeInBits { + case 8: + i.kind = store8 + case 16: + i.kind = store16 + case 32: + if src.reg().RegType() == regalloc.RegTypeInt { + i.kind = store32 + } else { + i.kind = fpuStore32 + } + case 64: + if src.reg().RegType() == regalloc.RegTypeInt { + i.kind = store64 + } else { + i.kind = fpuStore64 + } + case 128: + i.kind = fpuStore128 + } + i.rn = src + i.amode = amode +} + +func (i *instruction) asSLoad(dst operand, amode addressMode, sizeInBits byte) { + switch sizeInBits { + case 8: + i.kind = sLoad8 + case 16: + i.kind = sLoad16 + case 32: + i.kind = sLoad32 + default: + panic("BUG") + } + i.rd = dst + i.amode = amode +} + +func (i *instruction) asULoad(dst operand, amode addressMode, sizeInBits byte) { + switch sizeInBits { + case 8: + i.kind = uLoad8 + case 16: + i.kind = uLoad16 + case 32: + i.kind = uLoad32 + case 64: + i.kind = uLoad64 + } + i.rd = dst + i.amode = amode +} + +func (i *instruction) asFpuLoad(dst operand, amode addressMode, sizeInBits byte) { + switch sizeInBits { + case 32: + i.kind = fpuLoad32 + case 64: + i.kind = fpuLoad64 + case 128: + i.kind = fpuLoad128 + } + i.rd = dst + i.amode = amode +} + +func (i *instruction) asVecLoad1R(rd, rn operand, arr vecArrangement) { + // NOTE: currently only has support for no-offset loads, though it is suspicious that + // we would need to support offset load (that is only available for post-index). + i.kind = vecLoad1R + i.rd = rd + i.rn = rn + i.u1 = uint64(arr) +} + +func (i *instruction) asCSet(rd regalloc.VReg, mask bool, c condFlag) { + i.kind = cSet + i.rd = operandNR(rd) + i.u1 = uint64(c) + if mask { + i.u2 = 1 + } +} + +func (i *instruction) asCSel(rd, rn, rm operand, c condFlag, _64bit bool) { + i.kind = cSel + i.rd = rd + i.rn = rn + i.rm = rm + i.u1 = uint64(c) + if _64bit { + i.u3 = 1 + } +} + +func (i *instruction) asFpuCSel(rd, rn, rm operand, c condFlag, _64bit bool) { + i.kind = fpuCSel + i.rd = rd + i.rn = rn + i.rm = rm + i.u1 = uint64(c) + if _64bit { + i.u3 = 1 + } +} + +func (i *instruction) asBr(target label) { + if target == returnLabel { + panic("BUG: call site should special case for returnLabel") + } + i.kind = br + i.u1 = uint64(target) +} + +func (i *instruction) asBrTableSequence(indexReg regalloc.VReg, targets []uint32) { + i.kind = brTableSequence + i.rn = operandNR(indexReg) + i.targets = targets +} + +func (i *instruction) brTableSequenceOffsetsResolved() { + i.u3 = 1 // indicate that the offsets are resolved, for debugging. +} + +func (i *instruction) brLabel() label { + return label(i.u1) +} + +// brOffsetResolved is called when the target label is resolved. +func (i *instruction) brOffsetResolve(offset int64) { + i.u2 = uint64(offset) + i.u3 = 1 // indicate that the offset is resolved, for debugging. +} + +func (i *instruction) brOffset() int64 { + return int64(i.u2) +} + +// asCondBr encodes a conditional branch instruction. is64bit is only needed when cond is not flag. +func (i *instruction) asCondBr(c cond, target label, is64bit bool) { + i.kind = condBr + i.u1 = c.asUint64() + i.u2 = uint64(target) + if is64bit { + i.u3 = 1 + } +} + +func (i *instruction) setCondBrTargets(target label) { + i.u2 = uint64(target) +} + +func (i *instruction) condBrLabel() label { + return label(i.u2) +} + +// condBrOffsetResolve is called when the target label is resolved. +func (i *instruction) condBrOffsetResolve(offset int64) { + i.rd.data = uint64(offset) + i.rd.data2 = 1 // indicate that the offset is resolved, for debugging. +} + +// condBrOffsetResolved returns true if condBrOffsetResolve is already called. +func (i *instruction) condBrOffsetResolved() bool { + return i.rd.data2 == 1 +} + +func (i *instruction) condBrOffset() int64 { + return int64(i.rd.data) +} + +func (i *instruction) condBrCond() cond { + return cond(i.u1) +} + +func (i *instruction) condBr64bit() bool { + return i.u3 == 1 +} + +func (i *instruction) asLoadFpuConst32(rd regalloc.VReg, raw uint64) { + i.kind = loadFpuConst32 + i.u1 = raw + i.rd = operandNR(rd) +} + +func (i *instruction) asLoadFpuConst64(rd regalloc.VReg, raw uint64) { + i.kind = loadFpuConst64 + i.u1 = raw + i.rd = operandNR(rd) +} + +func (i *instruction) asLoadFpuConst128(rd regalloc.VReg, lo, hi uint64) { + i.kind = loadFpuConst128 + i.u1 = lo + i.u2 = hi + i.rd = operandNR(rd) +} + +func (i *instruction) asFpuCmp(rn, rm operand, is64bit bool) { + i.kind = fpuCmp + i.rn, i.rm = rn, rm + if is64bit { + i.u3 = 1 + } +} + +func (i *instruction) asCCmpImm(rn operand, imm uint64, c condFlag, flag byte, is64bit bool) { + i.kind = cCmpImm + i.rn = rn + i.rm.data = imm + i.u1 = uint64(c) + i.u2 = uint64(flag) + if is64bit { + i.u3 = 1 + } +} + +// asALU setups a basic ALU instruction. +func (i *instruction) asALU(aluOp aluOp, rd, rn, rm operand, dst64bit bool) { + switch rm.kind { + case operandKindNR: + i.kind = aluRRR + case operandKindSR: + i.kind = aluRRRShift + case operandKindER: + i.kind = aluRRRExtend + case operandKindImm12: + i.kind = aluRRImm12 + default: + panic("BUG") + } + i.u1 = uint64(aluOp) + i.rd, i.rn, i.rm = rd, rn, rm + if dst64bit { + i.u3 = 1 + } +} + +// asALU setups a basic ALU instruction. +func (i *instruction) asALURRRR(aluOp aluOp, rd, rn, rm, ra operand, dst64bit bool) { + i.kind = aluRRRR + i.u1 = uint64(aluOp) + i.rd, i.rn, i.rm, i.ra = rd, rn, rm, ra + if dst64bit { + i.u3 = 1 + } +} + +// asALUShift setups a shift based ALU instruction. +func (i *instruction) asALUShift(aluOp aluOp, rd, rn, rm operand, dst64bit bool) { + switch rm.kind { + case operandKindNR: + i.kind = aluRRR // If the shift amount op is a register, then the instruction is encoded as a normal ALU instruction with two register operands. + case operandKindShiftImm: + i.kind = aluRRImmShift + default: + panic("BUG") + } + i.u1 = uint64(aluOp) + i.rd, i.rn, i.rm = rd, rn, rm + if dst64bit { + i.u3 = 1 + } +} + +func (i *instruction) asALUBitmaskImm(aluOp aluOp, rd, rn regalloc.VReg, imm uint64, dst64bit bool) { + i.kind = aluRRBitmaskImm + i.u1 = uint64(aluOp) + i.rn, i.rd = operandNR(rn), operandNR(rd) + i.u2 = imm + if dst64bit { + i.u3 = 1 + } +} + +func (i *instruction) asMovToFPSR(rn regalloc.VReg) { + i.kind = movToFPSR + i.rn = operandNR(rn) +} + +func (i *instruction) asMovFromFPSR(rd regalloc.VReg) { + i.kind = movFromFPSR + i.rd = operandNR(rd) +} + +func (i *instruction) asBitRR(bitOp bitOp, rd, rn regalloc.VReg, is64bit bool) { + i.kind = bitRR + i.rn, i.rd = operandNR(rn), operandNR(rd) + i.u1 = uint64(bitOp) + if is64bit { + i.u2 = 1 + } +} + +func (i *instruction) asFpuRRR(op fpuBinOp, rd, rn, rm operand, dst64bit bool) { + i.kind = fpuRRR + i.u1 = uint64(op) + i.rd, i.rn, i.rm = rd, rn, rm + if dst64bit { + i.u3 = 1 + } +} + +func (i *instruction) asFpuRR(op fpuUniOp, rd, rn operand, dst64bit bool) { + i.kind = fpuRR + i.u1 = uint64(op) + i.rd, i.rn = rd, rn + if dst64bit { + i.u3 = 1 + } +} + +func (i *instruction) asExtend(rd, rn regalloc.VReg, fromBits, toBits byte, signed bool) { + i.kind = extend + i.rn, i.rd = operandNR(rn), operandNR(rd) + i.u1 = uint64(fromBits) + i.u2 = uint64(toBits) + if signed { + i.u3 = 1 + } +} + +func (i *instruction) asMove32(rd, rn regalloc.VReg) { + i.kind = mov32 + i.rn, i.rd = operandNR(rn), operandNR(rd) +} + +func (i *instruction) asMove64(rd, rn regalloc.VReg) *instruction { + i.kind = mov64 + i.rn, i.rd = operandNR(rn), operandNR(rd) + return i +} + +func (i *instruction) asFpuMov64(rd, rn regalloc.VReg) { + i.kind = fpuMov64 + i.rn, i.rd = operandNR(rn), operandNR(rd) +} + +func (i *instruction) asFpuMov128(rd, rn regalloc.VReg) *instruction { + i.kind = fpuMov128 + i.rn, i.rd = operandNR(rn), operandNR(rd) + return i +} + +func (i *instruction) asMovToVec(rd, rn operand, arr vecArrangement, index vecIndex) { + i.kind = movToVec + i.rd = rd + i.rn = rn + i.u1, i.u2 = uint64(arr), uint64(index) +} + +func (i *instruction) asMovFromVec(rd, rn operand, arr vecArrangement, index vecIndex, signed bool) { + if signed { + i.kind = movFromVecSigned + } else { + i.kind = movFromVec + } + i.rd = rd + i.rn = rn + i.u1, i.u2 = uint64(arr), uint64(index) +} + +func (i *instruction) asVecDup(rd, rn operand, arr vecArrangement) { + i.kind = vecDup + i.u1 = uint64(arr) + i.rn, i.rd = rn, rd +} + +func (i *instruction) asVecDupElement(rd, rn operand, arr vecArrangement, index vecIndex) { + i.kind = vecDupElement + i.u1 = uint64(arr) + i.rn, i.rd = rn, rd + i.u2 = uint64(index) +} + +func (i *instruction) asVecExtract(rd, rn, rm operand, arr vecArrangement, index uint32) { + i.kind = vecExtract + i.u1 = uint64(arr) + i.rn, i.rm, i.rd = rn, rm, rd + i.u2 = uint64(index) +} + +func (i *instruction) asVecMovElement(rd, rn operand, arr vecArrangement, rdIndex, rnIndex vecIndex) { + i.kind = vecMovElement + i.u1 = uint64(arr) + i.u2, i.u3 = uint64(rdIndex), uint64(rnIndex) + i.rn, i.rd = rn, rd +} + +func (i *instruction) asVecMisc(op vecOp, rd, rn operand, arr vecArrangement) { + i.kind = vecMisc + i.u1 = uint64(op) + i.rn, i.rd = rn, rd + i.u2 = uint64(arr) +} + +func (i *instruction) asVecLanes(op vecOp, rd, rn operand, arr vecArrangement) { + i.kind = vecLanes + i.u1 = uint64(op) + i.rn, i.rd = rn, rd + i.u2 = uint64(arr) +} + +func (i *instruction) asVecShiftImm(op vecOp, rd, rn, rm operand, arr vecArrangement) { + i.kind = vecShiftImm + i.u1 = uint64(op) + i.rn, i.rm, i.rd = rn, rm, rd + i.u2 = uint64(arr) +} + +func (i *instruction) asVecTbl(nregs byte, rd, rn, rm operand, arr vecArrangement) { + switch nregs { + case 0, 1: + i.kind = vecTbl + case 2: + i.kind = vecTbl2 + if !rn.reg().IsRealReg() { + panic("rn is not a RealReg") + } + if rn.realReg() == v31 { + panic("rn cannot be v31") + } + default: + panic(fmt.Sprintf("unsupported number of registers %d", nregs)) + } + i.rn, i.rm, i.rd = rn, rm, rd + i.u2 = uint64(arr) +} + +func (i *instruction) asVecPermute(op vecOp, rd, rn, rm operand, arr vecArrangement) { + i.kind = vecPermute + i.u1 = uint64(op) + i.rn, i.rm, i.rd = rn, rm, rd + i.u2 = uint64(arr) +} + +func (i *instruction) asVecRRR(op vecOp, rd, rn, rm operand, arr vecArrangement) { + i.kind = vecRRR + i.u1 = uint64(op) + i.rn, i.rd, i.rm = rn, rd, rm + i.u2 = uint64(arr) +} + +// asVecRRRRewrite encodes a vector instruction that rewrites the destination register. +// IMPORTANT: the destination register must be already defined before this instruction. +func (i *instruction) asVecRRRRewrite(op vecOp, rd, rn, rm operand, arr vecArrangement) { + i.kind = vecRRRRewrite + i.u1 = uint64(op) + i.rn, i.rd, i.rm = rn, rd, rm + i.u2 = uint64(arr) +} + +func (i *instruction) IsCopy() bool { + op := i.kind + // We do not include mov32 as it is not a copy instruction in the sense that it does not preserve the upper 32 bits, + // and it is only used in the translation of IReduce, not the actual copy indeed. + return op == mov64 || op == fpuMov64 || op == fpuMov128 +} + +// String implements fmt.Stringer. +func (i *instruction) String() (str string) { + is64SizeBitToSize := func(u3 uint64) byte { + if u3 == 0 { + return 32 + } + return 64 + } + + switch i.kind { + case nop0: + if i.u1 != 0 { + l := label(i.u1) + str = fmt.Sprintf("%s:", l) + } else { + str = "nop0" + } + case aluRRR: + size := is64SizeBitToSize(i.u3) + str = fmt.Sprintf("%s %s, %s, %s", aluOp(i.u1).String(), + formatVRegSized(i.rd.nr(), size), formatVRegSized(i.rn.nr(), size), + i.rm.format(size)) + case aluRRRR: + size := is64SizeBitToSize(i.u3) + str = fmt.Sprintf("%s %s, %s, %s, %s", aluOp(i.u1).String(), + formatVRegSized(i.rd.nr(), size), formatVRegSized(i.rn.nr(), size), formatVRegSized(i.rm.nr(), size), formatVRegSized(i.ra.nr(), size)) + case aluRRImm12: + size := is64SizeBitToSize(i.u3) + str = fmt.Sprintf("%s %s, %s, %s", aluOp(i.u1).String(), + formatVRegSized(i.rd.nr(), size), formatVRegSized(i.rn.nr(), size), i.rm.format(size)) + case aluRRBitmaskImm: + size := is64SizeBitToSize(i.u3) + rd, rn := formatVRegSized(i.rd.nr(), size), formatVRegSized(i.rn.nr(), size) + if size == 32 { + str = fmt.Sprintf("%s %s, %s, #%#x", aluOp(i.u1).String(), rd, rn, uint32(i.u2)) + } else { + str = fmt.Sprintf("%s %s, %s, #%#x", aluOp(i.u1).String(), rd, rn, i.u2) + } + case aluRRImmShift: + size := is64SizeBitToSize(i.u3) + str = fmt.Sprintf("%s %s, %s, %#x", + aluOp(i.u1).String(), + formatVRegSized(i.rd.nr(), size), + formatVRegSized(i.rn.nr(), size), + i.rm.shiftImm(), + ) + case aluRRRShift: + size := is64SizeBitToSize(i.u3) + str = fmt.Sprintf("%s %s, %s, %s", + aluOp(i.u1).String(), + formatVRegSized(i.rd.nr(), size), + formatVRegSized(i.rn.nr(), size), + i.rm.format(size), + ) + case aluRRRExtend: + size := is64SizeBitToSize(i.u3) + str = fmt.Sprintf("%s %s, %s, %s", aluOp(i.u1).String(), + formatVRegSized(i.rd.nr(), size), + formatVRegSized(i.rn.nr(), size), + // Regardless of the source size, the register is formatted in 32-bit. + i.rm.format(32), + ) + case bitRR: + size := is64SizeBitToSize(i.u2) + str = fmt.Sprintf("%s %s, %s", + bitOp(i.u1), + formatVRegSized(i.rd.nr(), size), + formatVRegSized(i.rn.nr(), size), + ) + case uLoad8: + str = fmt.Sprintf("ldrb %s, %s", formatVRegSized(i.rd.nr(), 32), i.amode.format(32)) + case sLoad8: + str = fmt.Sprintf("ldrsb %s, %s", formatVRegSized(i.rd.nr(), 32), i.amode.format(32)) + case uLoad16: + str = fmt.Sprintf("ldrh %s, %s", formatVRegSized(i.rd.nr(), 32), i.amode.format(32)) + case sLoad16: + str = fmt.Sprintf("ldrsh %s, %s", formatVRegSized(i.rd.nr(), 32), i.amode.format(32)) + case uLoad32: + str = fmt.Sprintf("ldr %s, %s", formatVRegSized(i.rd.nr(), 32), i.amode.format(32)) + case sLoad32: + str = fmt.Sprintf("ldrs %s, %s", formatVRegSized(i.rd.nr(), 32), i.amode.format(32)) + case uLoad64: + str = fmt.Sprintf("ldr %s, %s", formatVRegSized(i.rd.nr(), 64), i.amode.format(64)) + case store8: + str = fmt.Sprintf("strb %s, %s", formatVRegSized(i.rn.nr(), 32), i.amode.format(8)) + case store16: + str = fmt.Sprintf("strh %s, %s", formatVRegSized(i.rn.nr(), 32), i.amode.format(16)) + case store32: + str = fmt.Sprintf("str %s, %s", formatVRegSized(i.rn.nr(), 32), i.amode.format(32)) + case store64: + str = fmt.Sprintf("str %s, %s", formatVRegSized(i.rn.nr(), 64), i.amode.format(64)) + case storeP64: + str = fmt.Sprintf("stp %s, %s, %s", + formatVRegSized(i.rn.nr(), 64), formatVRegSized(i.rm.nr(), 64), i.amode.format(64)) + case loadP64: + str = fmt.Sprintf("ldp %s, %s, %s", + formatVRegSized(i.rn.nr(), 64), formatVRegSized(i.rm.nr(), 64), i.amode.format(64)) + case mov64: + str = fmt.Sprintf("mov %s, %s", + formatVRegSized(i.rd.nr(), 64), + formatVRegSized(i.rn.nr(), 64)) + case mov32: + str = fmt.Sprintf("mov %s, %s", formatVRegSized(i.rd.nr(), 32), formatVRegSized(i.rn.nr(), 32)) + case movZ: + size := is64SizeBitToSize(i.u3) + str = fmt.Sprintf("movz %s, #%#x, lsl %d", formatVRegSized(i.rd.nr(), size), uint16(i.u1), i.u2*16) + case movN: + size := is64SizeBitToSize(i.u3) + str = fmt.Sprintf("movn %s, #%#x, lsl %d", formatVRegSized(i.rd.nr(), size), uint16(i.u1), i.u2*16) + case movK: + size := is64SizeBitToSize(i.u3) + str = fmt.Sprintf("movk %s, #%#x, lsl %d", formatVRegSized(i.rd.nr(), size), uint16(i.u1), i.u2*16) + case extend: + fromBits, toBits := byte(i.u1), byte(i.u2) + + var signedStr string + if i.u3 == 1 { + signedStr = "s" + } else { + signedStr = "u" + } + var fromStr string + switch fromBits { + case 8: + fromStr = "b" + case 16: + fromStr = "h" + case 32: + fromStr = "w" + } + str = fmt.Sprintf("%sxt%s %s, %s", signedStr, fromStr, formatVRegSized(i.rd.nr(), toBits), formatVRegSized(i.rn.nr(), 32)) + case cSel: + size := is64SizeBitToSize(i.u3) + str = fmt.Sprintf("csel %s, %s, %s, %s", + formatVRegSized(i.rd.nr(), size), + formatVRegSized(i.rn.nr(), size), + formatVRegSized(i.rm.nr(), size), + condFlag(i.u1), + ) + case cSet: + if i.u2 != 0 { + str = fmt.Sprintf("csetm %s, %s", formatVRegSized(i.rd.nr(), 64), condFlag(i.u1)) + } else { + str = fmt.Sprintf("cset %s, %s", formatVRegSized(i.rd.nr(), 64), condFlag(i.u1)) + } + case cCmpImm: + size := is64SizeBitToSize(i.u3) + str = fmt.Sprintf("ccmp %s, #%#x, #%#x, %s", + formatVRegSized(i.rn.nr(), size), i.rm.data, + i.u2&0b1111, + condFlag(i.u1)) + case fpuMov64: + str = fmt.Sprintf("mov %s, %s", + formatVRegVec(i.rd.nr(), vecArrangement8B, vecIndexNone), + formatVRegVec(i.rn.nr(), vecArrangement8B, vecIndexNone)) + case fpuMov128: + str = fmt.Sprintf("mov %s, %s", + formatVRegVec(i.rd.nr(), vecArrangement16B, vecIndexNone), + formatVRegVec(i.rn.nr(), vecArrangement16B, vecIndexNone)) + case fpuMovFromVec: + panic("TODO") + case fpuRR: + dstSz := is64SizeBitToSize(i.u3) + srcSz := dstSz + op := fpuUniOp(i.u1) + switch op { + case fpuUniOpCvt32To64: + srcSz = 32 + case fpuUniOpCvt64To32: + srcSz = 64 + } + str = fmt.Sprintf("%s %s, %s", op.String(), + formatVRegSized(i.rd.nr(), dstSz), formatVRegSized(i.rn.nr(), srcSz)) + case fpuRRR: + size := is64SizeBitToSize(i.u3) + str = fmt.Sprintf("%s %s, %s, %s", fpuBinOp(i.u1).String(), + formatVRegSized(i.rd.nr(), size), formatVRegSized(i.rn.nr(), size), formatVRegSized(i.rm.nr(), size)) + case fpuRRI: + panic("TODO") + case fpuRRRR: + panic("TODO") + case fpuCmp: + size := is64SizeBitToSize(i.u3) + str = fmt.Sprintf("fcmp %s, %s", + formatVRegSized(i.rn.nr(), size), formatVRegSized(i.rm.nr(), size)) + case fpuLoad32: + str = fmt.Sprintf("ldr %s, %s", formatVRegSized(i.rd.nr(), 32), i.amode.format(32)) + case fpuStore32: + str = fmt.Sprintf("str %s, %s", formatVRegSized(i.rn.nr(), 32), i.amode.format(64)) + case fpuLoad64: + str = fmt.Sprintf("ldr %s, %s", formatVRegSized(i.rd.nr(), 64), i.amode.format(64)) + case fpuStore64: + str = fmt.Sprintf("str %s, %s", formatVRegSized(i.rn.nr(), 64), i.amode.format(64)) + case fpuLoad128: + str = fmt.Sprintf("ldr %s, %s", formatVRegSized(i.rd.nr(), 128), i.amode.format(64)) + case fpuStore128: + str = fmt.Sprintf("str %s, %s", formatVRegSized(i.rn.nr(), 128), i.amode.format(64)) + case loadFpuConst32: + str = fmt.Sprintf("ldr %s, #8; b 8; data.f32 %f", formatVRegSized(i.rd.nr(), 32), math.Float32frombits(uint32(i.u1))) + case loadFpuConst64: + str = fmt.Sprintf("ldr %s, #8; b 16; data.f64 %f", formatVRegSized(i.rd.nr(), 64), math.Float64frombits(i.u1)) + case loadFpuConst128: + str = fmt.Sprintf("ldr %s, #8; b 32; data.v128 %016x %016x", + formatVRegSized(i.rd.nr(), 128), i.u1, i.u2) + case fpuToInt: + var op, src, dst string + if signed := i.u1 == 1; signed { + op = "fcvtzs" + } else { + op = "fcvtzu" + } + if src64 := i.u2 == 1; src64 { + src = formatVRegWidthVec(i.rn.nr(), vecArrangementD) + } else { + src = formatVRegWidthVec(i.rn.nr(), vecArrangementS) + } + if dst64 := i.u3 == 1; dst64 { + dst = formatVRegSized(i.rd.nr(), 64) + } else { + dst = formatVRegSized(i.rd.nr(), 32) + } + str = fmt.Sprintf("%s %s, %s", op, dst, src) + + case intToFpu: + var op, src, dst string + if signed := i.u1 == 1; signed { + op = "scvtf" + } else { + op = "ucvtf" + } + if src64 := i.u2 == 1; src64 { + src = formatVRegSized(i.rn.nr(), 64) + } else { + src = formatVRegSized(i.rn.nr(), 32) + } + if dst64 := i.u3 == 1; dst64 { + dst = formatVRegWidthVec(i.rd.nr(), vecArrangementD) + } else { + dst = formatVRegWidthVec(i.rd.nr(), vecArrangementS) + } + str = fmt.Sprintf("%s %s, %s", op, dst, src) + case fpuCSel: + size := is64SizeBitToSize(i.u3) + str = fmt.Sprintf("fcsel %s, %s, %s, %s", + formatVRegSized(i.rd.nr(), size), + formatVRegSized(i.rn.nr(), size), + formatVRegSized(i.rm.nr(), size), + condFlag(i.u1), + ) + case movToVec: + var size byte + arr := vecArrangement(i.u1) + switch arr { + case vecArrangementB, vecArrangementH, vecArrangementS: + size = 32 + case vecArrangementD: + size = 64 + default: + panic("unsupported arrangement " + arr.String()) + } + str = fmt.Sprintf("ins %s, %s", formatVRegVec(i.rd.nr(), arr, vecIndex(i.u2)), formatVRegSized(i.rn.nr(), size)) + case movFromVec, movFromVecSigned: + var size byte + var opcode string + arr := vecArrangement(i.u1) + signed := i.kind == movFromVecSigned + switch arr { + case vecArrangementB, vecArrangementH, vecArrangementS: + size = 32 + if signed { + opcode = "smov" + } else { + opcode = "umov" + } + case vecArrangementD: + size = 64 + if signed { + opcode = "smov" + } else { + opcode = "mov" + } + default: + panic("unsupported arrangement " + arr.String()) + } + str = fmt.Sprintf("%s %s, %s", opcode, formatVRegSized(i.rd.nr(), size), formatVRegVec(i.rn.nr(), arr, vecIndex(i.u2))) + case vecDup: + str = fmt.Sprintf("dup %s, %s", + formatVRegVec(i.rd.nr(), vecArrangement(i.u1), vecIndexNone), + formatVRegSized(i.rn.nr(), 64), + ) + case vecDupElement: + arr := vecArrangement(i.u1) + str = fmt.Sprintf("dup %s, %s", + formatVRegVec(i.rd.nr(), arr, vecIndexNone), + formatVRegVec(i.rn.nr(), arr, vecIndex(i.u2)), + ) + case vecDupFromFpu: + panic("TODO") + case vecExtract: + str = fmt.Sprintf("ext %s, %s, %s, #%d", + formatVRegVec(i.rd.nr(), vecArrangement(i.u1), vecIndexNone), + formatVRegVec(i.rn.nr(), vecArrangement(i.u1), vecIndexNone), + formatVRegVec(i.rm.nr(), vecArrangement(i.u1), vecIndexNone), + uint32(i.u2), + ) + case vecExtend: + panic("TODO") + case vecMovElement: + str = fmt.Sprintf("mov %s, %s", + formatVRegVec(i.rd.nr(), vecArrangement(i.u1), vecIndex(i.u2)), + formatVRegVec(i.rn.nr(), vecArrangement(i.u1), vecIndex(i.u3)), + ) + case vecMiscNarrow: + panic("TODO") + case vecRRR, vecRRRRewrite: + str = fmt.Sprintf("%s %s, %s, %s", + vecOp(i.u1), + formatVRegVec(i.rd.nr(), vecArrangement(i.u2), vecIndexNone), + formatVRegVec(i.rn.nr(), vecArrangement(i.u2), vecIndexNone), + formatVRegVec(i.rm.nr(), vecArrangement(i.u2), vecIndexNone), + ) + case vecMisc: + vop := vecOp(i.u1) + if vop == vecOpCmeq0 { + str = fmt.Sprintf("cmeq %s, %s, #0", + formatVRegVec(i.rd.nr(), vecArrangement(i.u2), vecIndexNone), + formatVRegVec(i.rn.nr(), vecArrangement(i.u2), vecIndexNone)) + } else { + str = fmt.Sprintf("%s %s, %s", + vop, + formatVRegVec(i.rd.nr(), vecArrangement(i.u2), vecIndexNone), + formatVRegVec(i.rn.nr(), vecArrangement(i.u2), vecIndexNone)) + } + case vecLanes: + arr := vecArrangement(i.u2) + var destArr vecArrangement + switch arr { + case vecArrangement8B, vecArrangement16B: + destArr = vecArrangementH + case vecArrangement4H, vecArrangement8H: + destArr = vecArrangementS + case vecArrangement4S: + destArr = vecArrangementD + default: + panic("invalid arrangement " + arr.String()) + } + str = fmt.Sprintf("%s %s, %s", + vecOp(i.u1), + formatVRegWidthVec(i.rd.nr(), destArr), + formatVRegVec(i.rn.nr(), arr, vecIndexNone)) + case vecShiftImm: + arr := vecArrangement(i.u2) + str = fmt.Sprintf("%s %s, %s, #%d", + vecOp(i.u1), + formatVRegVec(i.rd.nr(), arr, vecIndexNone), + formatVRegVec(i.rn.nr(), arr, vecIndexNone), + i.rm.shiftImm()) + case vecTbl: + arr := vecArrangement(i.u2) + str = fmt.Sprintf("tbl %s, { %s }, %s", + formatVRegVec(i.rd.nr(), arr, vecIndexNone), + formatVRegVec(i.rn.nr(), vecArrangement16B, vecIndexNone), + formatVRegVec(i.rm.nr(), arr, vecIndexNone)) + case vecTbl2: + arr := vecArrangement(i.u2) + rd, rn, rm := i.rd.nr(), i.rn.nr(), i.rm.nr() + rn1 := regalloc.FromRealReg(rn.RealReg()+1, rn.RegType()) + str = fmt.Sprintf("tbl %s, { %s, %s }, %s", + formatVRegVec(rd, arr, vecIndexNone), + formatVRegVec(rn, vecArrangement16B, vecIndexNone), + formatVRegVec(rn1, vecArrangement16B, vecIndexNone), + formatVRegVec(rm, arr, vecIndexNone)) + case vecPermute: + arr := vecArrangement(i.u2) + str = fmt.Sprintf("%s %s, %s, %s", + vecOp(i.u1), + formatVRegVec(i.rd.nr(), arr, vecIndexNone), + formatVRegVec(i.rn.nr(), arr, vecIndexNone), + formatVRegVec(i.rm.nr(), arr, vecIndexNone)) + case movToFPSR: + str = fmt.Sprintf("msr fpsr, %s", formatVRegSized(i.rn.nr(), 64)) + case movFromFPSR: + str = fmt.Sprintf("mrs %s fpsr", formatVRegSized(i.rd.nr(), 64)) + case call: + if i.u2 > 0 { + str = fmt.Sprintf("bl #%#x", i.u2) + } else { + str = fmt.Sprintf("bl %s", ssa.FuncRef(i.u1)) + } + case callInd: + str = fmt.Sprintf("bl %s", formatVRegSized(i.rn.nr(), 64)) + case ret: + str = "ret" + case br: + target := label(i.u1) + if i.u3 != 0 { + str = fmt.Sprintf("b #%#x (%s)", i.brOffset(), target.String()) + } else { + str = fmt.Sprintf("b %s", target.String()) + } + case condBr: + size := is64SizeBitToSize(i.u3) + c := cond(i.u1) + target := label(i.u2) + switch c.kind() { + case condKindRegisterZero: + if !i.condBrOffsetResolved() { + str = fmt.Sprintf("cbz %s, (%s)", formatVRegSized(c.register(), size), target.String()) + } else { + str = fmt.Sprintf("cbz %s, #%#x %s", formatVRegSized(c.register(), size), i.condBrOffset(), target.String()) + } + case condKindRegisterNotZero: + if offset := i.condBrOffset(); offset != 0 { + str = fmt.Sprintf("cbnz %s, #%#x (%s)", formatVRegSized(c.register(), size), offset, target.String()) + } else { + str = fmt.Sprintf("cbnz %s, %s", formatVRegSized(c.register(), size), target.String()) + } + case condKindCondFlagSet: + if offset := i.condBrOffset(); offset != 0 { + if target == invalidLabel { + str = fmt.Sprintf("b.%s #%#x", c.flag(), offset) + } else { + str = fmt.Sprintf("b.%s #%#x, (%s)", c.flag(), offset, target.String()) + } + } else { + str = fmt.Sprintf("b.%s %s", c.flag(), target.String()) + } + } + case adr: + str = fmt.Sprintf("adr %s, #%#x", formatVRegSized(i.rd.nr(), 64), int64(i.u1)) + case brTableSequence: + if i.u3 == 0 { // The offsets haven't been resolved yet. + labels := make([]string, len(i.targets)) + for index, l := range i.targets { + labels[index] = label(l).String() + } + str = fmt.Sprintf("br_table_sequence %s, [%s]", + formatVRegSized(i.rn.nr(), 64), + strings.Join(labels, ", "), + ) + } else { + // See encodeBrTableSequence for the encoding. + offsets := make([]string, len(i.targets)) + for index, offset := range i.targets { + offsets[index] = fmt.Sprintf("%#x", int32(offset)) + } + str = fmt.Sprintf( + `adr %[2]s, #16; ldrsw %[1]s, [%[2]s, %[1]s, UXTW 2]; add %[2]s, %[2]s, %[1]s; br %[2]s; %s`, + formatVRegSized(i.rn.nr(), 64), + formatVRegSized(tmpRegVReg, 64), + offsets, + ) + } + case exitSequence: + str = fmt.Sprintf("exit_sequence %s", formatVRegSized(i.rn.nr(), 64)) + case udf: + str = "udf" + case emitSourceOffsetInfo: + str = fmt.Sprintf("source_offset_info %d", ssa.SourceOffset(i.u1)) + case vecLoad1R: + str = fmt.Sprintf("ld1r {%s}, [%s]", formatVRegVec(i.rd.nr(), vecArrangement(i.u1), vecIndexNone), formatVRegSized(i.rn.nr(), 64)) + default: + panic(i.kind) + } + return +} + +func (i *instruction) asAdr(rd regalloc.VReg, offset int64) { + i.kind = adr + i.rd = operandNR(rd) + i.u1 = uint64(offset) +} + +// TODO: delete unnecessary things. +const ( + // nop0 represents a no-op of zero size. + nop0 instructionKind = iota + 1 + // aluRRR represents an ALU operation with two register sources and a register destination. + aluRRR + // aluRRRR represents an ALU operation with three register sources and a register destination. + aluRRRR + // aluRRImm12 represents an ALU operation with a register source and an immediate-12 source, with a register destination. + aluRRImm12 + // aluRRBitmaskImm represents an ALU operation with a register source and a bitmask immediate, with a register destination. + aluRRBitmaskImm + // aluRRImmShift represents an ALU operation with a register source and an immediate-shifted source, with a register destination. + aluRRImmShift + // aluRRRShift represents an ALU operation with two register sources, one of which can be shifted, with a register destination. + aluRRRShift + // aluRRRExtend represents an ALU operation with two register sources, one of which can be extended, with a register destination. + aluRRRExtend + // bitRR represents a bit op instruction with a single register source. + bitRR + // uLoad8 represents an unsigned 8-bit load. + uLoad8 + // sLoad8 represents a signed 8-bit load into 64-bit register. + sLoad8 + // uLoad16 represents an unsigned 16-bit load into 64-bit register. + uLoad16 + // sLoad16 represents a signed 16-bit load into 64-bit register. + sLoad16 + // uLoad32 represents an unsigned 32-bit load into 64-bit register. + uLoad32 + // sLoad32 represents a signed 32-bit load into 64-bit register. + sLoad32 + // uLoad64 represents a 64-bit load. + uLoad64 + // store8 represents an 8-bit store. + store8 + // store16 represents a 16-bit store. + store16 + // store32 represents a 32-bit store. + store32 + // store64 represents a 64-bit store. + store64 + // storeP64 represents a store of a pair of registers. + storeP64 + // loadP64 represents a load of a pair of registers. + loadP64 + // mov64 represents a MOV instruction. These are encoded as ORR's but we keep them separate for better handling. + mov64 + // mov32 represents a 32-bit MOV. This zeroes the top 32 bits of the destination. + mov32 + // movZ represents a MOVZ with a 16-bit immediate. + movZ + // movN represents a MOVN with a 16-bit immediate. + movN + // movK represents a MOVK with a 16-bit immediate. + movK + // extend represents a sign- or zero-extend operation. + extend + // cSel represents a conditional-select operation. + cSel + // cSet represents a conditional-set operation. + cSet + // cCmpImm represents a conditional comparison with an immediate. + cCmpImm + // fpuMov64 represents a FPU move. Distinct from a vector-register move; moving just 64 bits appears to be significantly faster. + fpuMov64 + // fpuMov128 represents a vector register move. + fpuMov128 + // fpuMovFromVec represents a move to scalar from a vector element. + fpuMovFromVec + // fpuRR represents a 1-op FPU instruction. + fpuRR + // fpuRRR represents a 2-op FPU instruction. + fpuRRR + // fpuRRI represents a 2-op FPU instruction with immediate value. + fpuRRI + // fpuRRRR represents a 3-op FPU instruction. + fpuRRRR + // fpuCmp represents a FPU comparison, either 32 or 64 bit. + fpuCmp + // fpuLoad32 represents a floating-point load, single-precision (32 bit). + fpuLoad32 + // fpuStore32 represents a floating-point store, single-precision (32 bit). + fpuStore32 + // fpuLoad64 represents a floating-point load, double-precision (64 bit). + fpuLoad64 + // fpuStore64 represents a floating-point store, double-precision (64 bit). + fpuStore64 + // fpuLoad128 represents a floating-point/vector load, 128 bit. + fpuLoad128 + // fpuStore128 represents a floating-point/vector store, 128 bit. + fpuStore128 + // loadFpuConst32 represents a load of a 32-bit floating-point constant. + loadFpuConst32 + // loadFpuConst64 represents a load of a 64-bit floating-point constant. + loadFpuConst64 + // loadFpuConst128 represents a load of a 128-bit floating-point constant. + loadFpuConst128 + // vecLoad1R represents a load of a one single-element structure that replicates to all lanes of a vector. + vecLoad1R + // fpuToInt represents a conversion from FP to integer. + fpuToInt + // intToFpu represents a conversion from integer to FP. + intToFpu + // fpuCSel represents a 32/64-bit FP conditional select. + fpuCSel + // movToVec represents a move to a vector element from a GPR. + movToVec + // movFromVec represents an unsigned move from a vector element to a GPR. + movFromVec + // movFromVecSigned represents a signed move from a vector element to a GPR. + movFromVecSigned + // vecDup represents a duplication of general-purpose register to vector. + vecDup + // vecDupElement represents a duplication of a vector element to vector or scalar. + vecDupElement + // vecDupFromFpu represents a duplication of scalar to vector. + vecDupFromFpu + // vecExtract represents a vector extraction operation. + vecExtract + // vecExtend represents a vector extension operation. + vecExtend + // vecMovElement represents a move vector element to another vector element operation. + vecMovElement + // vecMiscNarrow represents a vector narrowing operation. + vecMiscNarrow + // vecRRR represents a vector ALU operation. + vecRRR + // vecRRRRewrite is exactly the same as vecRRR except that this rewrites the destination register. + // For example, BSL instruction rewrites the destination register, and the existing value influences the result. + // Therefore, the "destination" register in vecRRRRewrite will be treated as "use" which makes the register outlive + // the instruction while this instruction doesn't have "def" in the context of register allocation. + vecRRRRewrite + // vecMisc represents a vector two register miscellaneous instruction. + vecMisc + // vecLanes represents a vector instruction across lanes. + vecLanes + // vecShiftImm represents a SIMD scalar shift by immediate instruction. + vecShiftImm + // vecTbl represents a table vector lookup - single register table. + vecTbl + // vecTbl2 represents a table vector lookup - two register table. + vecTbl2 + // vecPermute represents a vector permute instruction. + vecPermute + // movToNZCV represents a move to the FPSR. + movToFPSR + // movFromNZCV represents a move from the FPSR. + movFromFPSR + // call represents a machine call instruction. + call + // callInd represents a machine indirect-call instruction. + callInd + // ret represents a machine return instruction. + ret + // br represents an unconditional branch. + br + // condBr represents a conditional branch. + condBr + // adr represents a compute the address (using a PC-relative offset) of a memory location. + adr + // brTableSequence represents a jump-table sequence. + brTableSequence + // exitSequence consists of multiple instructions, and exits the execution immediately. + // See encodeExitSequence. + exitSequence + // UDF is the undefined instruction. For debugging only. + udf + + // emitSourceOffsetInfo is a dummy instruction to emit source offset info. + // The existence of this instruction does not affect the execution. + emitSourceOffsetInfo + + // ------------------- do not define below this line ------------------- + numInstructionKinds +) + +func (i *instruction) asEmitSourceOffsetInfo(l ssa.SourceOffset) *instruction { + i.kind = emitSourceOffsetInfo + i.u1 = uint64(l) + return i +} + +func (i *instruction) sourceOffsetInfo() ssa.SourceOffset { + return ssa.SourceOffset(i.u1) +} + +func (i *instruction) asUDF() *instruction { + i.kind = udf + return i +} + +func (i *instruction) asFpuToInt(rd, rn operand, rdSigned, src64bit, dst64bit bool) { + i.kind = fpuToInt + i.rn = rn + i.rd = rd + if rdSigned { + i.u1 = 1 + } + if src64bit { + i.u2 = 1 + } + if dst64bit { + i.u3 = 1 + } +} + +func (i *instruction) asIntToFpu(rd, rn operand, rnSigned, src64bit, dst64bit bool) { + i.kind = intToFpu + i.rn = rn + i.rd = rd + if rnSigned { + i.u1 = 1 + } + if src64bit { + i.u2 = 1 + } + if dst64bit { + i.u3 = 1 + } +} + +func (i *instruction) asExitSequence(ctx regalloc.VReg) *instruction { + i.kind = exitSequence + i.rn = operandNR(ctx) + return i +} + +// aluOp determines the type of ALU operation. Instructions whose kind is one of +// aluRRR, aluRRRR, aluRRImm12, aluRRBitmaskImm, aluRRImmShift, aluRRRShift and aluRRRExtend +// would use this type. +type aluOp int + +func (a aluOp) String() string { + switch a { + case aluOpAdd: + return "add" + case aluOpSub: + return "sub" + case aluOpOrr: + return "orr" + case aluOpAnd: + return "and" + case aluOpBic: + return "bic" + case aluOpEor: + return "eor" + case aluOpAddS: + return "adds" + case aluOpSubS: + return "subs" + case aluOpSMulH: + return "sMulH" + case aluOpUMulH: + return "uMulH" + case aluOpSDiv: + return "sdiv" + case aluOpUDiv: + return "udiv" + case aluOpRotR: + return "ror" + case aluOpLsr: + return "lsr" + case aluOpAsr: + return "asr" + case aluOpLsl: + return "lsl" + case aluOpMAdd: + return "madd" + case aluOpMSub: + return "msub" + } + panic(int(a)) +} + +const ( + // 32/64-bit Add. + aluOpAdd aluOp = iota + // 32/64-bit Subtract. + aluOpSub + // 32/64-bit Bitwise OR. + aluOpOrr + // 32/64-bit Bitwise AND. + aluOpAnd + // 32/64-bit Bitwise AND NOT. + aluOpBic + // 32/64-bit Bitwise XOR (Exclusive OR). + aluOpEor + // 32/64-bit Add setting flags. + aluOpAddS + // 32/64-bit Subtract setting flags. + aluOpSubS + // Signed multiply, high-word result. + aluOpSMulH + // Unsigned multiply, high-word result. + aluOpUMulH + // 64-bit Signed divide. + aluOpSDiv + // 64-bit Unsigned divide. + aluOpUDiv + // 32/64-bit Rotate right. + aluOpRotR + // 32/64-bit Logical shift right. + aluOpLsr + // 32/64-bit Arithmetic shift right. + aluOpAsr + // 32/64-bit Logical shift left. + aluOpLsl /// Multiply-add + + // MAdd and MSub are only applicable for aluRRRR. + aluOpMAdd + aluOpMSub +) + +// vecOp determines the type of vector operation. Instructions whose kind is one of +// vecOpCnt would use this type. +type vecOp int + +// String implements fmt.Stringer. +func (b vecOp) String() string { + switch b { + case vecOpCnt: + return "cnt" + case vecOpCmeq: + return "cmeq" + case vecOpCmgt: + return "cmgt" + case vecOpCmhi: + return "cmhi" + case vecOpCmge: + return "cmge" + case vecOpCmhs: + return "cmhs" + case vecOpFcmeq: + return "fcmeq" + case vecOpFcmgt: + return "fcmgt" + case vecOpFcmge: + return "fcmge" + case vecOpCmeq0: + return "cmeq0" + case vecOpUaddlv: + return "uaddlv" + case vecOpBit: + return "bit" + case vecOpBic: + return "bic" + case vecOpBsl: + return "bsl" + case vecOpNot: + return "not" + case vecOpAnd: + return "and" + case vecOpOrr: + return "orr" + case vecOpEOR: + return "eor" + case vecOpFadd: + return "fadd" + case vecOpAdd: + return "add" + case vecOpAddp: + return "addp" + case vecOpAddv: + return "addv" + case vecOpSub: + return "sub" + case vecOpFsub: + return "fsub" + case vecOpSmin: + return "smin" + case vecOpUmin: + return "umin" + case vecOpUminv: + return "uminv" + case vecOpSmax: + return "smax" + case vecOpUmax: + return "umax" + case vecOpUmaxp: + return "umaxp" + case vecOpUrhadd: + return "urhadd" + case vecOpFmul: + return "fmul" + case vecOpSqrdmulh: + return "sqrdmulh" + case vecOpMul: + return "mul" + case vecOpUmlal: + return "umlal" + case vecOpFdiv: + return "fdiv" + case vecOpFsqrt: + return "fsqrt" + case vecOpAbs: + return "abs" + case vecOpFabs: + return "fabs" + case vecOpNeg: + return "neg" + case vecOpFneg: + return "fneg" + case vecOpFrintp: + return "frintp" + case vecOpFrintm: + return "frintm" + case vecOpFrintn: + return "frintn" + case vecOpFrintz: + return "frintz" + case vecOpFcvtl: + return "fcvtl" + case vecOpFcvtn: + return "fcvtn" + case vecOpFcvtzu: + return "fcvtzu" + case vecOpFcvtzs: + return "fcvtzs" + case vecOpScvtf: + return "scvtf" + case vecOpUcvtf: + return "ucvtf" + case vecOpSqxtn: + return "sqxtn" + case vecOpUqxtn: + return "uqxtn" + case vecOpSqxtun: + return "sqxtun" + case vecOpRev64: + return "rev64" + case vecOpXtn: + return "xtn" + case vecOpShll: + return "shll" + case vecOpSshl: + return "sshl" + case vecOpSshll: + return "sshll" + case vecOpUshl: + return "ushl" + case vecOpUshll: + return "ushll" + case vecOpSshr: + return "sshr" + case vecOpZip1: + return "zip1" + case vecOpFmin: + return "fmin" + case vecOpFmax: + return "fmax" + } + panic(int(b)) +} + +const ( + vecOpCnt vecOp = iota + vecOpCmeq0 + vecOpCmeq + vecOpCmgt + vecOpCmhi + vecOpCmge + vecOpCmhs + vecOpFcmeq + vecOpFcmgt + vecOpFcmge + vecOpUaddlv + vecOpBit + vecOpBic + vecOpBsl + vecOpNot + vecOpAnd + vecOpOrr + vecOpEOR + vecOpAdd + vecOpFadd + vecOpAddv + vecOpSqadd + vecOpUqadd + vecOpAddp + vecOpSub + vecOpFsub + vecOpSqsub + vecOpUqsub + vecOpSmin + vecOpUmin + vecOpUminv + vecOpFmin + vecOpSmax + vecOpUmax + vecOpUmaxp + vecOpFmax + vecOpUrhadd + vecOpMul + vecOpFmul + vecOpSqrdmulh + vecOpUmlal + vecOpFdiv + vecOpFsqrt + vecOpAbs + vecOpFabs + vecOpNeg + vecOpFneg + vecOpFrintm + vecOpFrintn + vecOpFrintp + vecOpFrintz + vecOpFcvtl + vecOpFcvtn + vecOpFcvtzs + vecOpFcvtzu + vecOpScvtf + vecOpUcvtf + vecOpSqxtn + vecOpSqxtun + vecOpUqxtn + vecOpRev64 + vecOpXtn + vecOpShll + vecOpSshl + vecOpSshll + vecOpUshl + vecOpUshll + vecOpSshr + vecOpZip1 +) + +// bitOp determines the type of bitwise operation. Instructions whose kind is one of +// bitOpRbit and bitOpClz would use this type. +type bitOp int + +// String implements fmt.Stringer. +func (b bitOp) String() string { + switch b { + case bitOpRbit: + return "rbit" + case bitOpClz: + return "clz" + } + panic(int(b)) +} + +const ( + // 32/64-bit Rbit. + bitOpRbit bitOp = iota + // 32/64-bit Clz. + bitOpClz +) + +// fpuUniOp represents a unary floating-point unit (FPU) operation. +type fpuUniOp byte + +const ( + fpuUniOpNeg fpuUniOp = iota + fpuUniOpCvt32To64 + fpuUniOpCvt64To32 + fpuUniOpSqrt + fpuUniOpRoundPlus + fpuUniOpRoundMinus + fpuUniOpRoundZero + fpuUniOpRoundNearest + fpuUniOpAbs +) + +// String implements the fmt.Stringer. +func (f fpuUniOp) String() string { + switch f { + case fpuUniOpNeg: + return "fneg" + case fpuUniOpCvt32To64: + return "fcvt" + case fpuUniOpCvt64To32: + return "fcvt" + case fpuUniOpSqrt: + return "fsqrt" + case fpuUniOpRoundPlus: + return "frintp" + case fpuUniOpRoundMinus: + return "frintm" + case fpuUniOpRoundZero: + return "frintz" + case fpuUniOpRoundNearest: + return "frintn" + case fpuUniOpAbs: + return "fabs" + } + panic(int(f)) +} + +// fpuBinOp represents a binary floating-point unit (FPU) operation. +type fpuBinOp byte + +const ( + fpuBinOpAdd = iota + fpuBinOpSub + fpuBinOpMul + fpuBinOpDiv + fpuBinOpMax + fpuBinOpMin +) + +// String implements the fmt.Stringer. +func (f fpuBinOp) String() string { + switch f { + case fpuBinOpAdd: + return "fadd" + case fpuBinOpSub: + return "fsub" + case fpuBinOpMul: + return "fmul" + case fpuBinOpDiv: + return "fdiv" + case fpuBinOpMax: + return "fmax" + case fpuBinOpMin: + return "fmin" + } + panic(int(f)) +} + +// extMode represents the mode of a register operand extension. +// For example, aluRRRExtend instructions need this info to determine the extensions. +type extMode byte + +const ( + extModeNone extMode = iota + // extModeZeroExtend64 suggests a zero-extension to 32 bits if the original bit size is less than 32. + extModeZeroExtend32 + // extModeSignExtend64 stands for a sign-extension to 32 bits if the original bit size is less than 32. + extModeSignExtend32 + // extModeZeroExtend64 suggests a zero-extension to 64 bits if the original bit size is less than 64. + extModeZeroExtend64 + // extModeSignExtend64 stands for a sign-extension to 64 bits if the original bit size is less than 64. + extModeSignExtend64 +) + +func (e extMode) bits() byte { + switch e { + case extModeZeroExtend32, extModeSignExtend32: + return 32 + case extModeZeroExtend64, extModeSignExtend64: + return 64 + default: + return 0 + } +} + +func (e extMode) signed() bool { + switch e { + case extModeSignExtend32, extModeSignExtend64: + return true + default: + return false + } +} + +func extModeOf(t ssa.Type, signed bool) extMode { + switch t.Bits() { + case 32: + if signed { + return extModeSignExtend32 + } + return extModeZeroExtend32 + case 64: + if signed { + return extModeSignExtend64 + } + return extModeZeroExtend64 + default: + panic("TODO? do we need narrower than 32 bits?") + } +} + +type extendOp byte + +const ( + extendOpUXTB extendOp = 0b000 + extendOpUXTH extendOp = 0b001 + extendOpUXTW extendOp = 0b010 + // extendOpUXTX does nothing, but convenient symbol that officially exists. See: + // https://stackoverflow.com/questions/72041372/what-do-the-uxtx-and-sxtx-extensions-mean-for-32-bit-aarch64-adds-instruct + extendOpUXTX extendOp = 0b011 + extendOpSXTB extendOp = 0b100 + extendOpSXTH extendOp = 0b101 + extendOpSXTW extendOp = 0b110 + // extendOpSXTX does nothing, but convenient symbol that officially exists. See: + // https://stackoverflow.com/questions/72041372/what-do-the-uxtx-and-sxtx-extensions-mean-for-32-bit-aarch64-adds-instruct + extendOpSXTX extendOp = 0b111 + extendOpNone extendOp = 0xff +) + +func (e extendOp) srcBits() byte { + switch e { + case extendOpUXTB, extendOpSXTB: + return 8 + case extendOpUXTH, extendOpSXTH: + return 16 + case extendOpUXTW, extendOpSXTW: + return 32 + case extendOpUXTX, extendOpSXTX: + return 64 + } + panic(int(e)) +} + +func (e extendOp) String() string { + switch e { + case extendOpUXTB: + return "UXTB" + case extendOpUXTH: + return "UXTH" + case extendOpUXTW: + return "UXTW" + case extendOpUXTX: + return "UXTX" + case extendOpSXTB: + return "SXTB" + case extendOpSXTH: + return "SXTH" + case extendOpSXTW: + return "SXTW" + case extendOpSXTX: + return "SXTX" + } + panic(int(e)) +} + +func extendOpFrom(signed bool, from byte) extendOp { + switch from { + case 8: + if signed { + return extendOpSXTB + } + return extendOpUXTB + case 16: + if signed { + return extendOpSXTH + } + return extendOpUXTH + case 32: + if signed { + return extendOpSXTW + } + return extendOpUXTW + case 64: + if signed { + return extendOpSXTX + } + return extendOpUXTX + } + panic("invalid extendOpFrom") +} + +type shiftOp byte + +const ( + shiftOpLSL shiftOp = 0b00 + shiftOpLSR shiftOp = 0b01 + shiftOpASR shiftOp = 0b10 + shiftOpROR shiftOp = 0b11 +) + +func (s shiftOp) String() string { + switch s { + case shiftOpLSL: + return "lsl" + case shiftOpLSR: + return "lsr" + case shiftOpASR: + return "asr" + case shiftOpROR: + return "ror" + } + panic(int(s)) +} + +const exitSequenceSize = 6 * 4 // 6 instructions as in encodeExitSequence. + +// size returns the size of the instruction in encoded bytes. +func (i *instruction) size() int64 { + switch i.kind { + case exitSequence: + return exitSequenceSize // 5 instructions as in encodeExitSequence. + case nop0: + return 0 + case emitSourceOffsetInfo: + return 0 + case loadFpuConst32: + if i.u1 == 0 { + return 4 // zero loading can be encoded as a single instruction. + } + return 4 + 4 + 4 + case loadFpuConst64: + if i.u1 == 0 { + return 4 // zero loading can be encoded as a single instruction. + } + return 4 + 4 + 8 + case loadFpuConst128: + if i.u1 == 0 && i.u2 == 0 { + return 4 // zero loading can be encoded as a single instruction. + } + return 4 + 4 + 16 + case brTableSequence: + return 4*4 + int64(len(i.targets))*4 + default: + return 4 + } +} + +// vecArrangement is the arrangement of data within a vector register. +type vecArrangement byte + +const ( + // vecArrangementNone is an arrangement indicating no data is stored. + vecArrangementNone vecArrangement = iota + // vecArrangement8B is an arrangement of 8 bytes (64-bit vector) + vecArrangement8B + // vecArrangement16B is an arrangement of 16 bytes (128-bit vector) + vecArrangement16B + // vecArrangement4H is an arrangement of 4 half precisions (64-bit vector) + vecArrangement4H + // vecArrangement8H is an arrangement of 8 half precisions (128-bit vector) + vecArrangement8H + // vecArrangement2S is an arrangement of 2 single precisions (64-bit vector) + vecArrangement2S + // vecArrangement4S is an arrangement of 4 single precisions (128-bit vector) + vecArrangement4S + // vecArrangement1D is an arrangement of 1 double precision (64-bit vector) + vecArrangement1D + // vecArrangement2D is an arrangement of 2 double precisions (128-bit vector) + vecArrangement2D + + // Assign each vector size specifier to a vector arrangement ID. + // Instructions can only have an arrangement or a size specifier, but not both, so it + // simplifies the internal representation of vector instructions by being able to + // store either into the same field. + + // vecArrangementB is a size specifier of byte + vecArrangementB + // vecArrangementH is a size specifier of word (16-bit) + vecArrangementH + // vecArrangementS is a size specifier of double word (32-bit) + vecArrangementS + // vecArrangementD is a size specifier of quad word (64-bit) + vecArrangementD + // vecArrangementQ is a size specifier of the entire vector (128-bit) + vecArrangementQ +) + +// String implements fmt.Stringer +func (v vecArrangement) String() (ret string) { + switch v { + case vecArrangement8B: + ret = "8B" + case vecArrangement16B: + ret = "16B" + case vecArrangement4H: + ret = "4H" + case vecArrangement8H: + ret = "8H" + case vecArrangement2S: + ret = "2S" + case vecArrangement4S: + ret = "4S" + case vecArrangement1D: + ret = "1D" + case vecArrangement2D: + ret = "2D" + case vecArrangementB: + ret = "B" + case vecArrangementH: + ret = "H" + case vecArrangementS: + ret = "S" + case vecArrangementD: + ret = "D" + case vecArrangementQ: + ret = "Q" + case vecArrangementNone: + ret = "none" + default: + panic(v) + } + return +} + +// vecIndex is the index of an element of a vector register +type vecIndex byte + +// vecIndexNone indicates no vector index specified. +const vecIndexNone = ^vecIndex(0) + +func ssaLaneToArrangement(lane ssa.VecLane) vecArrangement { + switch lane { + case ssa.VecLaneI8x16: + return vecArrangement16B + case ssa.VecLaneI16x8: + return vecArrangement8H + case ssa.VecLaneI32x4: + return vecArrangement4S + case ssa.VecLaneI64x2: + return vecArrangement2D + case ssa.VecLaneF32x4: + return vecArrangement4S + case ssa.VecLaneF64x2: + return vecArrangement2D + default: + panic(lane) + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/instr_encoding.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/instr_encoding.go new file mode 100644 index 000000000..80a8f1eff --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/instr_encoding.go @@ -0,0 +1,2218 @@ +package arm64 + +import ( + "fmt" + + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend" + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc" + "github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi" +) + +// Encode implements backend.Machine Encode. +func (m *machine) Encode() { + m.encode(m.rootInstr) +} + +func (m *machine) encode(root *instruction) { + for cur := root; cur != nil; cur = cur.next { + cur.encode(m.compiler) + } +} + +func (i *instruction) encode(c backend.Compiler) { + switch kind := i.kind; kind { + case nop0, emitSourceOffsetInfo: + case exitSequence: + encodeExitSequence(c, i.rn.reg()) + case ret: + // https://developer.arm.com/documentation/ddi0596/2020-12/Base-Instructions/RET--Return-from-subroutine-?lang=en + c.Emit4Bytes(encodeRet()) + case br: + imm := i.brOffset() + c.Emit4Bytes(encodeUnconditionalBranch(false, imm)) + case call: + if i.u2 > 0 { + // This is a special case for EmitGoEntryPreamble which doesn't need reloc info, + // but instead the imm is already resolved. + c.Emit4Bytes(encodeUnconditionalBranch(true, int64(i.u2))) + } else { + // We still don't know the exact address of the function to call, so we emit a placeholder. + c.AddRelocationInfo(i.callFuncRef()) + c.Emit4Bytes(encodeUnconditionalBranch(true, 0)) // 0 = placeholder + } + case callInd: + c.Emit4Bytes(encodeUnconditionalBranchReg(regNumberInEncoding[i.rn.realReg()], true)) + case store8, store16, store32, store64, fpuStore32, fpuStore64, fpuStore128: + c.Emit4Bytes(encodeLoadOrStore(i.kind, regNumberInEncoding[i.rn.realReg()], i.amode)) + case uLoad8, uLoad16, uLoad32, uLoad64, sLoad8, sLoad16, sLoad32, fpuLoad32, fpuLoad64, fpuLoad128: + c.Emit4Bytes(encodeLoadOrStore(i.kind, regNumberInEncoding[i.rd.realReg()], i.amode)) + case vecLoad1R: + c.Emit4Bytes(encodeVecLoad1R( + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + vecArrangement(i.u1))) + case condBr: + imm19 := i.condBrOffset() + if imm19%4 != 0 { + panic("imm26 for branch must be a multiple of 4") + } + + imm19U32 := uint32(imm19/4) & 0b111_11111111_11111111 + brCond := i.condBrCond() + switch brCond.kind() { + case condKindRegisterZero: + rt := regNumberInEncoding[brCond.register().RealReg()] + c.Emit4Bytes(encodeCBZCBNZ(rt, false, imm19U32, i.condBr64bit())) + case condKindRegisterNotZero: + rt := regNumberInEncoding[brCond.register().RealReg()] + c.Emit4Bytes(encodeCBZCBNZ(rt, true, imm19U32, i.condBr64bit())) + case condKindCondFlagSet: + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/B-cond--Branch-conditionally- + fl := brCond.flag() + c.Emit4Bytes(0b01010100<<24 | (imm19U32 << 5) | uint32(fl)) + default: + panic("BUG") + } + case movN: + c.Emit4Bytes(encodeMoveWideImmediate(0b00, regNumberInEncoding[i.rd.realReg()], i.u1, i.u2, i.u3)) + case movZ: + c.Emit4Bytes(encodeMoveWideImmediate(0b10, regNumberInEncoding[i.rd.realReg()], i.u1, i.u2, i.u3)) + case movK: + c.Emit4Bytes(encodeMoveWideImmediate(0b11, regNumberInEncoding[i.rd.realReg()], i.u1, i.u2, i.u3)) + case mov32: + to, from := i.rd.realReg(), i.rn.realReg() + c.Emit4Bytes(encodeAsMov32(regNumberInEncoding[from], regNumberInEncoding[to])) + case mov64: + to, from := i.rd.realReg(), i.rn.realReg() + toIsSp := to == sp + fromIsSp := from == sp + c.Emit4Bytes(encodeMov64(regNumberInEncoding[to], regNumberInEncoding[from], toIsSp, fromIsSp)) + case loadP64, storeP64: + rt, rt2 := regNumberInEncoding[i.rn.realReg()], regNumberInEncoding[i.rm.realReg()] + amode := i.amode + rn := regNumberInEncoding[amode.rn.RealReg()] + var pre bool + switch amode.kind { + case addressModeKindPostIndex: + case addressModeKindPreIndex: + pre = true + default: + panic("BUG") + } + c.Emit4Bytes(encodePreOrPostIndexLoadStorePair64(pre, kind == loadP64, rn, rt, rt2, amode.imm)) + case loadFpuConst32: + rd := regNumberInEncoding[i.rd.realReg()] + if i.u1 == 0 { + c.Emit4Bytes(encodeVecRRR(vecOpEOR, rd, rd, rd, vecArrangement8B)) + } else { + encodeLoadFpuConst32(c, rd, i.u1) + } + case loadFpuConst64: + rd := regNumberInEncoding[i.rd.realReg()] + if i.u1 == 0 { + c.Emit4Bytes(encodeVecRRR(vecOpEOR, rd, rd, rd, vecArrangement8B)) + } else { + encodeLoadFpuConst64(c, regNumberInEncoding[i.rd.realReg()], i.u1) + } + case loadFpuConst128: + rd := regNumberInEncoding[i.rd.realReg()] + lo, hi := i.u1, i.u2 + if lo == 0 && hi == 0 { + c.Emit4Bytes(encodeVecRRR(vecOpEOR, rd, rd, rd, vecArrangement16B)) + } else { + encodeLoadFpuConst128(c, rd, lo, hi) + } + case aluRRRR: + c.Emit4Bytes(encodeAluRRRR( + aluOp(i.u1), + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + regNumberInEncoding[i.rm.realReg()], + regNumberInEncoding[i.ra.realReg()], + uint32(i.u3), + )) + case aluRRImmShift: + c.Emit4Bytes(encodeAluRRImm( + aluOp(i.u1), + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + uint32(i.rm.shiftImm()), + uint32(i.u3), + )) + case aluRRR: + rn := i.rn.realReg() + c.Emit4Bytes(encodeAluRRR( + aluOp(i.u1), + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[rn], + regNumberInEncoding[i.rm.realReg()], + i.u3 == 1, + rn == sp, + )) + case aluRRRExtend: + rm, exo, to := i.rm.er() + c.Emit4Bytes(encodeAluRRRExtend( + aluOp(i.u1), + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + regNumberInEncoding[rm.RealReg()], + exo, + to, + )) + case aluRRRShift: + r, amt, sop := i.rm.sr() + c.Emit4Bytes(encodeAluRRRShift( + aluOp(i.u1), + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + regNumberInEncoding[r.RealReg()], + uint32(amt), + sop, + i.u3 == 1, + )) + case aluRRBitmaskImm: + c.Emit4Bytes(encodeAluBitmaskImmediate( + aluOp(i.u1), + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + i.u2, + i.u3 == 1, + )) + case bitRR: + c.Emit4Bytes(encodeBitRR( + bitOp(i.u1), + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + uint32(i.u2)), + ) + case aluRRImm12: + imm12, shift := i.rm.imm12() + c.Emit4Bytes(encodeAluRRImm12( + aluOp(i.u1), + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + imm12, shift, + i.u3 == 1, + )) + case fpuRRR: + c.Emit4Bytes(encodeFpuRRR( + fpuBinOp(i.u1), + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + regNumberInEncoding[i.rm.realReg()], + i.u3 == 1, + )) + case fpuMov64, fpuMov128: + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/MOV--vector---Move-vector--an-alias-of-ORR--vector--register-- + rd := regNumberInEncoding[i.rd.realReg()] + rn := regNumberInEncoding[i.rn.realReg()] + var q uint32 + if kind == fpuMov128 { + q = 0b1 + } + c.Emit4Bytes(q<<30 | 0b1110101<<21 | rn<<16 | 0b000111<<10 | rn<<5 | rd) + case cSet: + rd := regNumberInEncoding[i.rd.realReg()] + cf := condFlag(i.u1) + if i.u2 == 1 { + // https://developer.arm.com/documentation/ddi0602/2022-03/Base-Instructions/CSETM--Conditional-Set-Mask--an-alias-of-CSINV- + // Note that we set 64bit version here. + c.Emit4Bytes(0b1101101010011111<<16 | uint32(cf.invert())<<12 | 0b011111<<5 | rd) + } else { + // https://developer.arm.com/documentation/ddi0602/2022-06/Base-Instructions/CSET--Conditional-Set--an-alias-of-CSINC- + // Note that we set 64bit version here. + c.Emit4Bytes(0b1001101010011111<<16 | uint32(cf.invert())<<12 | 0b111111<<5 | rd) + } + case extend: + c.Emit4Bytes(encodeExtend(i.u3 == 1, byte(i.u1), byte(i.u2), regNumberInEncoding[i.rd.realReg()], regNumberInEncoding[i.rn.realReg()])) + case fpuCmp: + // https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/FCMP--Floating-point-quiet-Compare--scalar--?lang=en + rn, rm := regNumberInEncoding[i.rn.realReg()], regNumberInEncoding[i.rm.realReg()] + var ftype uint32 + if i.u3 == 1 { + ftype = 0b01 // double precision. + } + c.Emit4Bytes(0b1111<<25 | ftype<<22 | 1<<21 | rm<<16 | 0b1<<13 | rn<<5) + case udf: + // https://developer.arm.com/documentation/ddi0596/2020-12/Base-Instructions/UDF--Permanently-Undefined-?lang=en + if wazevoapi.PrintMachineCodeHexPerFunctionDisassemblable { + c.Emit4Bytes(dummyInstruction) + } else { + c.Emit4Bytes(0) + } + case adr: + c.Emit4Bytes(encodeAdr(regNumberInEncoding[i.rd.realReg()], uint32(i.u1))) + case cSel: + c.Emit4Bytes(encodeConditionalSelect( + kind, + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + regNumberInEncoding[i.rm.realReg()], + condFlag(i.u1), + i.u3 == 1, + )) + case fpuCSel: + c.Emit4Bytes(encodeFpuCSel( + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + regNumberInEncoding[i.rm.realReg()], + condFlag(i.u1), + i.u3 == 1, + )) + case movToVec: + c.Emit4Bytes(encodeMoveToVec( + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + vecArrangement(byte(i.u1)), + vecIndex(i.u2), + )) + case movFromVec, movFromVecSigned: + c.Emit4Bytes(encodeMoveFromVec( + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + vecArrangement(byte(i.u1)), + vecIndex(i.u2), + i.kind == movFromVecSigned, + )) + case vecDup: + c.Emit4Bytes(encodeVecDup( + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + vecArrangement(byte(i.u1)))) + case vecDupElement: + c.Emit4Bytes(encodeVecDupElement( + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + vecArrangement(byte(i.u1)), + vecIndex(i.u2))) + case vecExtract: + c.Emit4Bytes(encodeVecExtract( + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + regNumberInEncoding[i.rm.realReg()], + vecArrangement(byte(i.u1)), + uint32(i.u2))) + case vecPermute: + c.Emit4Bytes(encodeVecPermute( + vecOp(i.u1), + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + regNumberInEncoding[i.rm.realReg()], + vecArrangement(byte(i.u2)))) + case vecMovElement: + c.Emit4Bytes(encodeVecMovElement( + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + vecArrangement(i.u1), + uint32(i.u2), uint32(i.u3), + )) + case vecMisc: + c.Emit4Bytes(encodeAdvancedSIMDTwoMisc( + vecOp(i.u1), + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + vecArrangement(i.u2), + )) + case vecLanes: + c.Emit4Bytes(encodeVecLanes( + vecOp(i.u1), + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + vecArrangement(i.u2), + )) + case vecShiftImm: + c.Emit4Bytes(encodeVecShiftImm( + vecOp(i.u1), + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + uint32(i.rm.shiftImm()), + vecArrangement(i.u2), + )) + case vecTbl: + c.Emit4Bytes(encodeVecTbl( + 1, + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + regNumberInEncoding[i.rm.realReg()], + vecArrangement(i.u2)), + ) + case vecTbl2: + c.Emit4Bytes(encodeVecTbl( + 2, + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + regNumberInEncoding[i.rm.realReg()], + vecArrangement(i.u2)), + ) + case brTableSequence: + encodeBrTableSequence(c, i.rn.reg(), i.targets) + case fpuToInt, intToFpu: + c.Emit4Bytes(encodeCnvBetweenFloatInt(i)) + case fpuRR: + c.Emit4Bytes(encodeFloatDataOneSource( + fpuUniOp(i.u1), + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + i.u3 == 1, + )) + case vecRRR: + if op := vecOp(i.u1); op == vecOpBsl || op == vecOpBit || op == vecOpUmlal { + panic(fmt.Sprintf("vecOp %s must use vecRRRRewrite instead of vecRRR", op.String())) + } + fallthrough + case vecRRRRewrite: + c.Emit4Bytes(encodeVecRRR( + vecOp(i.u1), + regNumberInEncoding[i.rd.realReg()], + regNumberInEncoding[i.rn.realReg()], + regNumberInEncoding[i.rm.realReg()], + vecArrangement(i.u2), + )) + case cCmpImm: + // Conditional compare (immediate) in https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Register?lang=en + sf := uint32(i.u3 & 0b1) + nzcv := uint32(i.u2 & 0b1111) + cond := uint32(condFlag(i.u1)) + imm := uint32(i.rm.data & 0b11111) + rn := regNumberInEncoding[i.rn.realReg()] + c.Emit4Bytes( + sf<<31 | 0b111101001<<22 | imm<<16 | cond<<12 | 0b1<<11 | rn<<5 | nzcv, + ) + case movFromFPSR: + rt := regNumberInEncoding[i.rd.realReg()] + c.Emit4Bytes(encodeSystemRegisterMove(rt, true)) + case movToFPSR: + rt := regNumberInEncoding[i.rn.realReg()] + c.Emit4Bytes(encodeSystemRegisterMove(rt, false)) + default: + panic(i.String()) + } +} + +func encodeMov64(rd, rn uint32, toIsSp, fromIsSp bool) uint32 { + if toIsSp || fromIsSp { + // This is an alias of ADD (immediate): + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/MOV--to-from-SP---Move-between-register-and-stack-pointer--an-alias-of-ADD--immediate-- + return encodeAddSubtractImmediate(0b100, 0, 0, rn, rd) + } else { + // This is an alias of ORR (shifted register): + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/MOV--register---Move--register---an-alias-of-ORR--shifted-register-- + return encodeLogicalShiftedRegister(0b101, 0, rn, 0, regNumberInEncoding[xzr], rd) + } +} + +// encodeSystemRegisterMove encodes as "System register move" in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Branches--Exception-Generating-and-System-instructions?lang=en +// +// Note that currently we only supports read/write of FPSR. +func encodeSystemRegisterMove(rt uint32, fromSystem bool) uint32 { + ret := 0b11010101<<24 | 0b11011<<16 | 0b01000100<<8 | 0b001<<5 | rt + if fromSystem { + ret |= 0b1 << 21 + } + return ret +} + +// encodeVecRRR encodes as either "Advanced SIMD three *" in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en +func encodeVecRRR(op vecOp, rd, rn, rm uint32, arr vecArrangement) uint32 { + switch op { + case vecOpBit: + _, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b00011, 0b10 /* always has size 0b10 */, 0b1, q) + case vecOpBic: + if arr > vecArrangement16B { + panic("unsupported arrangement: " + arr.String()) + } + _, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b00011, 0b01 /* always has size 0b01 */, 0b0, q) + case vecOpBsl: + if arr > vecArrangement16B { + panic("unsupported arrangement: " + arr.String()) + } + _, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b00011, 0b01 /* always has size 0b01 */, 0b1, q) + case vecOpAnd: + if arr > vecArrangement16B { + panic("unsupported arrangement: " + arr.String()) + } + _, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b00011, 0b00 /* always has size 0b00 */, 0b0, q) + case vecOpOrr: + _, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b00011, 0b10 /* always has size 0b10 */, 0b0, q) + case vecOpEOR: + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b00011, size, 0b1, q) + case vecOpCmeq: + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b10001, size, 0b1, q) + case vecOpCmgt: + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b00110, size, 0b0, q) + case vecOpCmhi: + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b00110, size, 0b1, q) + case vecOpCmge: + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b00111, size, 0b0, q) + case vecOpCmhs: + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b00111, size, 0b1, q) + case vecOpFcmeq: + var size, q uint32 + switch arr { + case vecArrangement4S: + size, q = 0b00, 0b1 + case vecArrangement2S: + size, q = 0b00, 0b0 + case vecArrangement2D: + size, q = 0b01, 0b1 + default: + panic("unsupported arrangement: " + arr.String()) + } + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b11100, size, 0b0, q) + case vecOpFcmgt: + if arr < vecArrangement2S || arr == vecArrangement1D { + panic("unsupported arrangement: " + arr.String()) + } + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b11100, size, 0b1, q) + case vecOpFcmge: + var size, q uint32 + switch arr { + case vecArrangement4S: + size, q = 0b00, 0b1 + case vecArrangement2S: + size, q = 0b00, 0b0 + case vecArrangement2D: + size, q = 0b01, 0b1 + default: + panic("unsupported arrangement: " + arr.String()) + } + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b11100, size, 0b1, q) + case vecOpAdd: + if arr == vecArrangement1D { + panic("unsupported arrangement: " + arr.String()) + } + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b10000, size, 0b0, q) + case vecOpSqadd: + if arr == vecArrangement1D { + panic("unsupported arrangement: " + arr.String()) + } + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b00001, size, 0b0, q) + case vecOpUqadd: + if arr == vecArrangement1D { + panic("unsupported arrangement: " + arr.String()) + } + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b00001, size, 0b1, q) + case vecOpAddp: + if arr == vecArrangement1D { + panic("unsupported arrangement: " + arr.String()) + } + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b10111, size, 0b0, q) + case vecOpSqsub: + if arr == vecArrangement1D { + panic("unsupported arrangement: " + arr.String()) + } + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b00101, size, 0b0, q) + case vecOpUqsub: + if arr == vecArrangement1D { + panic("unsupported arrangement: " + arr.String()) + } + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b00101, size, 0b1, q) + case vecOpSub: + if arr == vecArrangement1D { + panic("unsupported arrangement: " + arr.String()) + } + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b10000, size, 0b1, q) + case vecOpFmin: + if arr < vecArrangement2S || arr == vecArrangement1D { + panic("unsupported arrangement: " + arr.String()) + } + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b11110, size, 0b0, q) + case vecOpSmin: + if arr > vecArrangement4S { + panic("unsupported arrangement: " + arr.String()) + } + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b01101, size, 0b0, q) + case vecOpUmin: + if arr > vecArrangement4S { + panic("unsupported arrangement: " + arr.String()) + } + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b01101, size, 0b1, q) + case vecOpFmax: + var size, q uint32 + switch arr { + case vecArrangement4S: + size, q = 0b00, 0b1 + case vecArrangement2S: + size, q = 0b00, 0b0 + case vecArrangement2D: + size, q = 0b01, 0b1 + default: + panic("unsupported arrangement: " + arr.String()) + } + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b11110, size, 0b0, q) + case vecOpFadd: + var size, q uint32 + switch arr { + case vecArrangement4S: + size, q = 0b00, 0b1 + case vecArrangement2S: + size, q = 0b00, 0b0 + case vecArrangement2D: + size, q = 0b01, 0b1 + default: + panic("unsupported arrangement: " + arr.String()) + } + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b11010, size, 0b0, q) + case vecOpFsub: + if arr < vecArrangement2S || arr == vecArrangement1D { + panic("unsupported arrangement: " + arr.String()) + } + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b11010, size, 0b0, q) + case vecOpFmul: + var size, q uint32 + switch arr { + case vecArrangement4S: + size, q = 0b00, 0b1 + case vecArrangement2S: + size, q = 0b00, 0b0 + case vecArrangement2D: + size, q = 0b01, 0b1 + default: + panic("unsupported arrangement: " + arr.String()) + } + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b11011, size, 0b1, q) + case vecOpSqrdmulh: + if arr < vecArrangement4H || arr > vecArrangement4S { + panic("unsupported arrangement: " + arr.String()) + } + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b10110, size, 0b1, q) + case vecOpFdiv: + var size, q uint32 + switch arr { + case vecArrangement4S: + size, q = 0b00, 0b1 + case vecArrangement2S: + size, q = 0b00, 0b0 + case vecArrangement2D: + size, q = 0b01, 0b1 + default: + panic("unsupported arrangement: " + arr.String()) + } + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b11111, size, 0b1, q) + case vecOpSmax: + if arr > vecArrangement4S { + panic("unsupported arrangement: " + arr.String()) + } + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b01100, size, 0b0, q) + case vecOpUmax: + if arr > vecArrangement4S { + panic("unsupported arrangement: " + arr.String()) + } + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b01100, size, 0b1, q) + case vecOpUmaxp: + if arr > vecArrangement4S { + panic("unsupported arrangement: " + arr.String()) + } + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b10100, size, 0b1, q) + case vecOpUrhadd: + if arr > vecArrangement4S { + panic("unsupported arrangement: " + arr.String()) + } + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b00010, size, 0b1, q) + case vecOpMul: + if arr > vecArrangement4S { + panic("unsupported arrangement: " + arr.String()) + } + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b10011, size, 0b0, q) + case vecOpUmlal: + if arr > vecArrangement4S { + panic("unsupported arrangement: " + arr.String()) + } + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeDifferent(rd, rn, rm, 0b1000, size, 0b1, q) + case vecOpSshl: + if arr == vecArrangement1D { + panic("unsupported arrangement: " + arr.String()) + } + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b01000, size, 0b0, q) + case vecOpUshl: + if arr == vecArrangement1D { + panic("unsupported arrangement: " + arr.String()) + } + size, q := arrToSizeQEncoded(arr) + return encodeAdvancedSIMDThreeSame(rd, rn, rm, 0b01000, size, 0b1, q) + + default: + panic("TODO: " + op.String()) + } +} + +func arrToSizeQEncoded(arr vecArrangement) (size, q uint32) { + switch arr { + case vecArrangement16B: + q = 0b1 + fallthrough + case vecArrangement8B: + size = 0b00 + case vecArrangement8H: + q = 0b1 + fallthrough + case vecArrangement4H: + size = 0b01 + case vecArrangement4S: + q = 0b1 + fallthrough + case vecArrangement2S: + size = 0b10 + case vecArrangement2D: + q = 0b1 + fallthrough + case vecArrangement1D: + size = 0b11 + default: + panic("BUG") + } + return +} + +// encodeAdvancedSIMDThreeSame encodes as "Advanced SIMD three same" in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en +func encodeAdvancedSIMDThreeSame(rd, rn, rm, opcode, size, U, Q uint32) uint32 { + return Q<<30 | U<<29 | 0b111<<25 | size<<22 | 0b1<<21 | rm<<16 | opcode<<11 | 0b1<<10 | rn<<5 | rd +} + +// encodeAdvancedSIMDThreeDifferent encodes as "Advanced SIMD three different" in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en +func encodeAdvancedSIMDThreeDifferent(rd, rn, rm, opcode, size, U, Q uint32) uint32 { + return Q<<30 | U<<29 | 0b111<<25 | size<<22 | 0b1<<21 | rm<<16 | opcode<<12 | rn<<5 | rd +} + +// encodeFloatDataOneSource encodes as "Floating-point data-processing (1 source)" in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en#simd-dp +func encodeFloatDataOneSource(op fpuUniOp, rd, rn uint32, dst64bit bool) uint32 { + var opcode, ptype uint32 + switch op { + case fpuUniOpCvt32To64: + opcode = 0b000101 + case fpuUniOpCvt64To32: + opcode = 0b000100 + ptype = 0b01 + case fpuUniOpNeg: + opcode = 0b000010 + if dst64bit { + ptype = 0b01 + } + case fpuUniOpSqrt: + opcode = 0b000011 + if dst64bit { + ptype = 0b01 + } + case fpuUniOpRoundPlus: + opcode = 0b001001 + if dst64bit { + ptype = 0b01 + } + case fpuUniOpRoundMinus: + opcode = 0b001010 + if dst64bit { + ptype = 0b01 + } + case fpuUniOpRoundZero: + opcode = 0b001011 + if dst64bit { + ptype = 0b01 + } + case fpuUniOpRoundNearest: + opcode = 0b001000 + if dst64bit { + ptype = 0b01 + } + case fpuUniOpAbs: + opcode = 0b000001 + if dst64bit { + ptype = 0b01 + } + default: + panic("BUG") + } + return 0b1111<<25 | ptype<<22 | 0b1<<21 | opcode<<15 | 0b1<<14 | rn<<5 | rd +} + +// encodeCnvBetweenFloatInt encodes as "Conversion between floating-point and integer" in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en +func encodeCnvBetweenFloatInt(i *instruction) uint32 { + rd := regNumberInEncoding[i.rd.realReg()] + rn := regNumberInEncoding[i.rn.realReg()] + + var opcode uint32 + var rmode uint32 + var ptype uint32 + var sf uint32 + switch i.kind { + case intToFpu: // Either UCVTF or SCVTF. + rmode = 0b00 + + signed := i.u1 == 1 + src64bit := i.u2 == 1 + dst64bit := i.u3 == 1 + if signed { + opcode = 0b010 + } else { + opcode = 0b011 + } + if src64bit { + sf = 0b1 + } + if dst64bit { + ptype = 0b01 + } else { + ptype = 0b00 + } + case fpuToInt: // Either FCVTZU or FCVTZS. + rmode = 0b11 + + signed := i.u1 == 1 + src64bit := i.u2 == 1 + dst64bit := i.u3 == 1 + + if signed { + opcode = 0b000 + } else { + opcode = 0b001 + } + if dst64bit { + sf = 0b1 + } + if src64bit { + ptype = 0b01 + } else { + ptype = 0b00 + } + } + return sf<<31 | 0b1111<<25 | ptype<<22 | 0b1<<21 | rmode<<19 | opcode<<16 | rn<<5 | rd +} + +// encodeAdr encodes a PC-relative ADR instruction. +// https://developer.arm.com/documentation/ddi0602/2022-06/Base-Instructions/ADR--Form-PC-relative-address- +func encodeAdr(rd uint32, offset uint32) uint32 { + if offset >= 1<<20 { + panic("BUG: too large adr instruction") + } + return offset&0b11<<29 | 0b1<<28 | offset&0b1111111111_1111111100<<3 | rd +} + +// encodeFpuCSel encodes as "Floating-point conditional select" in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en +func encodeFpuCSel(rd, rn, rm uint32, c condFlag, _64bit bool) uint32 { + var ftype uint32 + if _64bit { + ftype = 0b01 // double precision. + } + return 0b1111<<25 | ftype<<22 | 0b1<<21 | rm<<16 | uint32(c)<<12 | 0b11<<10 | rn<<5 | rd +} + +// encodeMoveToVec encodes as "Move general-purpose register to a vector element" (represented as `ins`) in +// https://developer.arm.com/documentation/dui0801/g/A64-SIMD-Vector-Instructions/MOV--vector--from-general- +// https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/MOV--from-general---Move-general-purpose-register-to-a-vector-element--an-alias-of-INS--general--?lang=en +func encodeMoveToVec(rd, rn uint32, arr vecArrangement, index vecIndex) uint32 { + var imm5 uint32 + switch arr { + case vecArrangementB: + imm5 |= 0b1 + imm5 |= uint32(index) << 1 + if index > 0b1111 { + panic(fmt.Sprintf("vector index is larger than the allowed bound: %d > 15", index)) + } + case vecArrangementH: + imm5 |= 0b10 + imm5 |= uint32(index) << 2 + if index > 0b111 { + panic(fmt.Sprintf("vector index is larger than the allowed bound: %d > 7", index)) + } + case vecArrangementS: + imm5 |= 0b100 + imm5 |= uint32(index) << 3 + if index > 0b11 { + panic(fmt.Sprintf("vector index is larger than the allowed bound: %d > 3", index)) + } + case vecArrangementD: + imm5 |= 0b1000 + imm5 |= uint32(index) << 4 + if index > 0b1 { + panic(fmt.Sprintf("vector index is larger than the allowed bound: %d > 1", index)) + } + default: + panic("Unsupported arrangement " + arr.String()) + } + + return 0b01001110000<<21 | imm5<<16 | 0b000111<<10 | rn<<5 | rd +} + +// encodeMoveToVec encodes as "Move vector element to another vector element, mov (element)" (represented as `ins`) in +// https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/MOV--element---Move-vector-element-to-another-vector-element--an-alias-of-INS--element--?lang=en +// https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/INS--element---Insert-vector-element-from-another-vector-element-?lang=en +func encodeVecMovElement(rd, rn uint32, arr vecArrangement, srcIndex, dstIndex uint32) uint32 { + var imm4, imm5 uint32 + switch arr { + case vecArrangementB: + imm5 |= 0b1 + imm5 |= srcIndex << 1 + imm4 = dstIndex + if srcIndex > 0b1111 { + panic(fmt.Sprintf("vector index is larger than the allowed bound: %d > 15", srcIndex)) + } + case vecArrangementH: + imm5 |= 0b10 + imm5 |= srcIndex << 2 + imm4 = dstIndex << 1 + if srcIndex > 0b111 { + panic(fmt.Sprintf("vector index is larger than the allowed bound: %d > 7", srcIndex)) + } + case vecArrangementS: + imm5 |= 0b100 + imm5 |= srcIndex << 3 + imm4 = dstIndex << 2 + if srcIndex > 0b11 { + panic(fmt.Sprintf("vector index is larger than the allowed bound: %d > 3", srcIndex)) + } + case vecArrangementD: + imm5 |= 0b1000 + imm5 |= srcIndex << 4 + imm4 = dstIndex << 3 + if srcIndex > 0b1 { + panic(fmt.Sprintf("vector index is larger than the allowed bound: %d > 1", srcIndex)) + } + default: + panic("Unsupported arrangement " + arr.String()) + } + + return 0b01101110000<<21 | imm5<<16 | imm4<<11 | 0b1<<10 | rn<<5 | rd +} + +// encodeUnconditionalBranchReg encodes as "Unconditional branch (register)" in: +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Branches--Exception-Generating-and-System-instructions?lang=en +func encodeUnconditionalBranchReg(rn uint32, link bool) uint32 { + var opc uint32 + if link { + opc = 0b0001 + } + return 0b1101011<<25 | opc<<21 | 0b11111<<16 | rn<<5 +} + +// encodeMoveFromVec encodes as "Move vector element to a general-purpose register" +// (represented as `umov` when dest is 32-bit, `umov` otherwise) in +// https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/UMOV--Unsigned-Move-vector-element-to-general-purpose-register-?lang=en +// https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/MOV--to-general---Move-vector-element-to-general-purpose-register--an-alias-of-UMOV-?lang=en +func encodeMoveFromVec(rd, rn uint32, arr vecArrangement, index vecIndex, signed bool) uint32 { + var op, imm4, q, imm5 uint32 + switch { + case arr == vecArrangementB: + imm5 |= 0b1 + imm5 |= uint32(index) << 1 + if index > 0b1111 { + panic(fmt.Sprintf("vector index is larger than the allowed bound: %d > 15", index)) + } + case arr == vecArrangementH: + imm5 |= 0b10 + imm5 |= uint32(index) << 2 + if index > 0b111 { + panic(fmt.Sprintf("vector index is larger than the allowed bound: %d > 7", index)) + } + case arr == vecArrangementS && signed: + q = 0b1 + fallthrough + case arr == vecArrangementS: + imm5 |= 0b100 + imm5 |= uint32(index) << 3 + if index > 0b11 { + panic(fmt.Sprintf("vector index is larger than the allowed bound: %d > 3", index)) + } + case arr == vecArrangementD && !signed: + imm5 |= 0b1000 + imm5 |= uint32(index) << 4 + q = 0b1 + if index > 0b1 { + panic(fmt.Sprintf("vector index is larger than the allowed bound: %d > 1", index)) + } + default: + panic("Unsupported arrangement " + arr.String()) + } + if signed { + op, imm4 = 0, 0b0101 + } else { + op, imm4 = 0, 0b0111 + } + return op<<29 | 0b01110000<<21 | q<<30 | imm5<<16 | imm4<<11 | 1<<10 | rn<<5 | rd +} + +// encodeVecDup encodes as "Duplicate general-purpose register to vector" DUP (general) +// (represented as `dup`) +// https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/DUP--general---Duplicate-general-purpose-register-to-vector-?lang=en +func encodeVecDup(rd, rn uint32, arr vecArrangement) uint32 { + var q, imm5 uint32 + switch arr { + case vecArrangement8B: + q, imm5 = 0b0, 0b1 + case vecArrangement16B: + q, imm5 = 0b1, 0b1 + case vecArrangement4H: + q, imm5 = 0b0, 0b10 + case vecArrangement8H: + q, imm5 = 0b1, 0b10 + case vecArrangement2S: + q, imm5 = 0b0, 0b100 + case vecArrangement4S: + q, imm5 = 0b1, 0b100 + case vecArrangement2D: + q, imm5 = 0b1, 0b1000 + default: + panic("Unsupported arrangement " + arr.String()) + } + return q<<30 | 0b001110000<<21 | imm5<<16 | 0b000011<<10 | rn<<5 | rd +} + +// encodeVecDup encodes as "Duplicate vector element to vector or scalar" DUP (element). +// (represented as `dup`) +// https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/DUP--element---Duplicate-vector-element-to-vector-or-scalar- +func encodeVecDupElement(rd, rn uint32, arr vecArrangement, srcIndex vecIndex) uint32 { + var q, imm5 uint32 + q = 0b1 + switch arr { + case vecArrangementB: + imm5 |= 0b1 + imm5 |= uint32(srcIndex) << 1 + case vecArrangementH: + imm5 |= 0b10 + imm5 |= uint32(srcIndex) << 2 + case vecArrangementS: + imm5 |= 0b100 + imm5 |= uint32(srcIndex) << 3 + case vecArrangementD: + imm5 |= 0b1000 + imm5 |= uint32(srcIndex) << 4 + default: + panic("unsupported arrangement" + arr.String()) + } + + return q<<30 | 0b001110000<<21 | imm5<<16 | 0b1<<10 | rn<<5 | rd +} + +// encodeVecExtract encodes as "Advanced SIMD extract." +// Currently only `ext` is defined. +// https://developer.arm.com/documentation/ddi0602/2023-06/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en#simd-dp +// https://developer.arm.com/documentation/ddi0602/2023-06/SIMD-FP-Instructions/EXT--Extract-vector-from-pair-of-vectors-?lang=en +func encodeVecExtract(rd, rn, rm uint32, arr vecArrangement, index uint32) uint32 { + var q, imm4 uint32 + switch arr { + case vecArrangement8B: + q, imm4 = 0, 0b0111&uint32(index) + case vecArrangement16B: + q, imm4 = 1, 0b1111&uint32(index) + default: + panic("Unsupported arrangement " + arr.String()) + } + return q<<30 | 0b101110000<<21 | rm<<16 | imm4<<11 | rn<<5 | rd +} + +// encodeVecPermute encodes as "Advanced SIMD permute." +// https://developer.arm.com/documentation/ddi0602/2023-06/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en#simd-dp +func encodeVecPermute(op vecOp, rd, rn, rm uint32, arr vecArrangement) uint32 { + var q, size, opcode uint32 + switch op { + case vecOpZip1: + opcode = 0b011 + if arr == vecArrangement1D { + panic("unsupported arrangement: " + arr.String()) + } + size, q = arrToSizeQEncoded(arr) + default: + panic("TODO: " + op.String()) + } + return q<<30 | 0b001110<<24 | size<<22 | rm<<16 | opcode<<12 | 0b10<<10 | rn<<5 | rd +} + +// encodeConditionalSelect encodes as "Conditional select" in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Register?lang=en#condsel +func encodeConditionalSelect(kind instructionKind, rd, rn, rm uint32, c condFlag, _64bit bool) uint32 { + if kind != cSel { + panic("TODO: support other conditional select") + } + + ret := 0b110101<<23 | rm<<16 | uint32(c)<<12 | rn<<5 | rd + if _64bit { + ret |= 0b1 << 31 + } + return ret +} + +const dummyInstruction uint32 = 0x14000000 // "b 0" + +// encodeLoadFpuConst32 encodes the following three instructions: +// +// ldr s8, #8 ;; literal load of data.f32 +// b 8 ;; skip the data +// data.f32 xxxxxxx +func encodeLoadFpuConst32(c backend.Compiler, rd uint32, rawF32 uint64) { + c.Emit4Bytes( + // https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/LDR--literal--SIMD-FP---Load-SIMD-FP-Register--PC-relative-literal--?lang=en + 0b111<<26 | (0x8/4)<<5 | rd, + ) + c.Emit4Bytes(encodeUnconditionalBranch(false, 8)) // b 8 + if wazevoapi.PrintMachineCodeHexPerFunctionDisassemblable { + // Inlined data.f32 cannot be disassembled, so we add a dummy instruction here. + c.Emit4Bytes(dummyInstruction) + } else { + c.Emit4Bytes(uint32(rawF32)) // data.f32 xxxxxxx + } +} + +// encodeLoadFpuConst64 encodes the following three instructions: +// +// ldr d8, #8 ;; literal load of data.f64 +// b 12 ;; skip the data +// data.f64 xxxxxxx +func encodeLoadFpuConst64(c backend.Compiler, rd uint32, rawF64 uint64) { + c.Emit4Bytes( + // https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/LDR--literal--SIMD-FP---Load-SIMD-FP-Register--PC-relative-literal--?lang=en + 0b1<<30 | 0b111<<26 | (0x8/4)<<5 | rd, + ) + c.Emit4Bytes(encodeUnconditionalBranch(false, 12)) // b 12 + if wazevoapi.PrintMachineCodeHexPerFunctionDisassemblable { + // Inlined data.f64 cannot be disassembled, so we add dummy instructions here. + c.Emit4Bytes(dummyInstruction) + c.Emit4Bytes(dummyInstruction) + } else { + // data.f64 xxxxxxx + c.Emit4Bytes(uint32(rawF64)) + c.Emit4Bytes(uint32(rawF64 >> 32)) + } +} + +// encodeLoadFpuConst128 encodes the following three instructions: +// +// ldr v8, #8 ;; literal load of data.f64 +// b 20 ;; skip the data +// data.v128 xxxxxxx +func encodeLoadFpuConst128(c backend.Compiler, rd uint32, lo, hi uint64) { + c.Emit4Bytes( + // https://developer.arm.com/documentation/ddi0596/2020-12/SIMD-FP-Instructions/LDR--literal--SIMD-FP---Load-SIMD-FP-Register--PC-relative-literal--?lang=en + 0b1<<31 | 0b111<<26 | (0x8/4)<<5 | rd, + ) + c.Emit4Bytes(encodeUnconditionalBranch(false, 20)) // b 20 + if wazevoapi.PrintMachineCodeHexPerFunctionDisassemblable { + // Inlined data.v128 cannot be disassembled, so we add dummy instructions here. + c.Emit4Bytes(dummyInstruction) + c.Emit4Bytes(dummyInstruction) + c.Emit4Bytes(dummyInstruction) + c.Emit4Bytes(dummyInstruction) + } else { + // data.v128 xxxxxxx + c.Emit4Bytes(uint32(lo)) + c.Emit4Bytes(uint32(lo >> 32)) + c.Emit4Bytes(uint32(hi)) + c.Emit4Bytes(uint32(hi >> 32)) + } +} + +// encodeAluRRRR encodes as Data-processing (3 source) in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Register?lang=en +func encodeAluRRRR(op aluOp, rd, rn, rm, ra, _64bit uint32) uint32 { + var oO, op31 uint32 + switch op { + case aluOpMAdd: + op31, oO = 0b000, 0b0 + case aluOpMSub: + op31, oO = 0b000, 0b1 + default: + panic("TODO/BUG") + } + return _64bit<<31 | 0b11011<<24 | op31<<21 | rm<<16 | oO<<15 | ra<<10 | rn<<5 | rd +} + +// encodeBitRR encodes as Data-processing (1 source) in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Register?lang=en +func encodeBitRR(op bitOp, rd, rn, _64bit uint32) uint32 { + var opcode2, opcode uint32 + switch op { + case bitOpRbit: + opcode2, opcode = 0b00000, 0b000000 + case bitOpClz: + opcode2, opcode = 0b00000, 0b000100 + default: + panic("TODO/BUG") + } + return _64bit<<31 | 0b1_0_11010110<<21 | opcode2<<15 | opcode<<10 | rn<<5 | rd +} + +func encodeAsMov32(rn, rd uint32) uint32 { + // This is an alias of ORR (shifted register): + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/MOV--register---Move--register---an-alias-of-ORR--shifted-register-- + return encodeLogicalShiftedRegister(0b001, 0, rn, 0, regNumberInEncoding[xzr], rd) +} + +// encodeExtend encodes extension instructions. +func encodeExtend(signed bool, from, to byte, rd, rn uint32) uint32 { + // UTXB: https://developer.arm.com/documentation/ddi0596/2020-12/Base-Instructions/UXTB--Unsigned-Extend-Byte--an-alias-of-UBFM-?lang=en + // UTXH: https://developer.arm.com/documentation/ddi0596/2020-12/Base-Instructions/UXTH--Unsigned-Extend-Halfword--an-alias-of-UBFM-?lang=en + // STXB: https://developer.arm.com/documentation/ddi0596/2020-12/Base-Instructions/SXTB--Signed-Extend-Byte--an-alias-of-SBFM- + // STXH: https://developer.arm.com/documentation/ddi0596/2020-12/Base-Instructions/SXTH--Sign-Extend-Halfword--an-alias-of-SBFM- + // STXW: https://developer.arm.com/documentation/ddi0596/2020-12/Base-Instructions/SXTW--Sign-Extend-Word--an-alias-of-SBFM- + var _31to10 uint32 + switch { + case !signed && from == 8 && to == 32: + // 32-bit UXTB + _31to10 = 0b0101001100000000000111 + case !signed && from == 16 && to == 32: + // 32-bit UXTH + _31to10 = 0b0101001100000000001111 + case !signed && from == 8 && to == 64: + // 64-bit UXTB + _31to10 = 0b0101001100000000000111 + case !signed && from == 16 && to == 64: + // 64-bit UXTH + _31to10 = 0b0101001100000000001111 + case !signed && from == 32 && to == 64: + return encodeAsMov32(rn, rd) + case signed && from == 8 && to == 32: + // 32-bit SXTB + _31to10 = 0b0001001100000000000111 + case signed && from == 16 && to == 32: + // 32-bit SXTH + _31to10 = 0b0001001100000000001111 + case signed && from == 8 && to == 64: + // 64-bit SXTB + _31to10 = 0b1001001101000000000111 + case signed && from == 16 && to == 64: + // 64-bit SXTH + _31to10 = 0b1001001101000000001111 + case signed && from == 32 && to == 64: + // SXTW + _31to10 = 0b1001001101000000011111 + default: + panic("BUG") + } + return _31to10<<10 | rn<<5 | rd +} + +func encodeLoadOrStore(kind instructionKind, rt uint32, amode addressMode) uint32 { + var _22to31 uint32 + var bits int64 + switch kind { + case uLoad8: + _22to31 = 0b0011100001 + bits = 8 + case sLoad8: + _22to31 = 0b0011100010 + bits = 8 + case uLoad16: + _22to31 = 0b0111100001 + bits = 16 + case sLoad16: + _22to31 = 0b0111100010 + bits = 16 + case uLoad32: + _22to31 = 0b1011100001 + bits = 32 + case sLoad32: + _22to31 = 0b1011100010 + bits = 32 + case uLoad64: + _22to31 = 0b1111100001 + bits = 64 + case fpuLoad32: + _22to31 = 0b1011110001 + bits = 32 + case fpuLoad64: + _22to31 = 0b1111110001 + bits = 64 + case fpuLoad128: + _22to31 = 0b0011110011 + bits = 128 + case store8: + _22to31 = 0b0011100000 + bits = 8 + case store16: + _22to31 = 0b0111100000 + bits = 16 + case store32: + _22to31 = 0b1011100000 + bits = 32 + case store64: + _22to31 = 0b1111100000 + bits = 64 + case fpuStore32: + _22to31 = 0b1011110000 + bits = 32 + case fpuStore64: + _22to31 = 0b1111110000 + bits = 64 + case fpuStore128: + _22to31 = 0b0011110010 + bits = 128 + default: + panic("BUG") + } + + switch amode.kind { + case addressModeKindRegScaledExtended: + return encodeLoadOrStoreExtended(_22to31, + regNumberInEncoding[amode.rn.RealReg()], + regNumberInEncoding[amode.rm.RealReg()], + rt, true, amode.extOp) + case addressModeKindRegScaled: + return encodeLoadOrStoreExtended(_22to31, + regNumberInEncoding[amode.rn.RealReg()], regNumberInEncoding[amode.rm.RealReg()], + rt, true, extendOpNone) + case addressModeKindRegExtended: + return encodeLoadOrStoreExtended(_22to31, + regNumberInEncoding[amode.rn.RealReg()], regNumberInEncoding[amode.rm.RealReg()], + rt, false, amode.extOp) + case addressModeKindRegReg: + return encodeLoadOrStoreExtended(_22to31, + regNumberInEncoding[amode.rn.RealReg()], regNumberInEncoding[amode.rm.RealReg()], + rt, false, extendOpNone) + case addressModeKindRegSignedImm9: + // e.g. https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/LDUR--Load-Register--unscaled-- + return encodeLoadOrStoreSIMM9(_22to31, 0b00 /* unscaled */, regNumberInEncoding[amode.rn.RealReg()], rt, amode.imm) + case addressModeKindPostIndex: + return encodeLoadOrStoreSIMM9(_22to31, 0b01 /* post index */, regNumberInEncoding[amode.rn.RealReg()], rt, amode.imm) + case addressModeKindPreIndex: + return encodeLoadOrStoreSIMM9(_22to31, 0b11 /* pre index */, regNumberInEncoding[amode.rn.RealReg()], rt, amode.imm) + case addressModeKindRegUnsignedImm12: + // "unsigned immediate" in https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Loads-and-Stores?lang=en + rn := regNumberInEncoding[amode.rn.RealReg()] + imm := amode.imm + div := bits / 8 + if imm != 0 && !offsetFitsInAddressModeKindRegUnsignedImm12(byte(bits), imm) { + panic("BUG") + } + imm /= div + return _22to31<<22 | 0b1<<24 | uint32(imm&0b111111111111)<<10 | rn<<5 | rt + default: + panic("BUG") + } +} + +// encodeVecLoad1R encodes as Load one single-element structure and Replicate to all lanes (of one register) in +// https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/LD1R--Load-one-single-element-structure-and-Replicate-to-all-lanes--of-one-register--?lang=en#sa_imm +func encodeVecLoad1R(rt, rn uint32, arr vecArrangement) uint32 { + size, q := arrToSizeQEncoded(arr) + return q<<30 | 0b001101010000001100<<12 | size<<10 | rn<<5 | rt +} + +// encodeAluBitmaskImmediate encodes as Logical (immediate) in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Immediate?lang=en +func encodeAluBitmaskImmediate(op aluOp, rd, rn uint32, imm uint64, _64bit bool) uint32 { + var _31to23 uint32 + switch op { + case aluOpAnd: + _31to23 = 0b00_100100 + case aluOpOrr: + _31to23 = 0b01_100100 + case aluOpEor: + _31to23 = 0b10_100100 + default: + panic("BUG") + } + if _64bit { + _31to23 |= 0b1 << 8 + } + immr, imms, N := bitmaskImmediate(imm, _64bit) + return _31to23<<23 | uint32(N)<<22 | uint32(immr)<<16 | uint32(imms)<<10 | rn<<5 | rd +} + +func bitmaskImmediate(c uint64, is64bit bool) (immr, imms, N byte) { + var size uint32 + switch { + case c != c>>32|c<<32: + size = 64 + case c != c>>16|c<<48: + size = 32 + c = uint64(int32(c)) + case c != c>>8|c<<56: + size = 16 + c = uint64(int16(c)) + case c != c>>4|c<<60: + size = 8 + c = uint64(int8(c)) + case c != c>>2|c<<62: + size = 4 + c = uint64(int64(c<<60) >> 60) + default: + size = 2 + c = uint64(int64(c<<62) >> 62) + } + + neg := false + if int64(c) < 0 { + c = ^c + neg = true + } + + onesSize, nonZeroPos := getOnesSequenceSize(c) + if neg { + nonZeroPos = onesSize + nonZeroPos + onesSize = size - onesSize + } + + var mode byte = 32 + if is64bit && size == 64 { + N, mode = 0b1, 64 + } + + immr = byte((size - nonZeroPos) & (size - 1) & uint32(mode-1)) + imms = byte((onesSize - 1) | 63&^(size<<1-1)) + return +} + +func getOnesSequenceSize(x uint64) (size, nonZeroPos uint32) { + // Take 0b00111000 for example: + y := getLowestBit(x) // = 0b0000100 + nonZeroPos = setBitPos(y) // = 2 + size = setBitPos(x+y) - nonZeroPos // = setBitPos(0b0100000) - 2 = 5 - 2 = 3 + return +} + +func setBitPos(x uint64) (ret uint32) { + for ; ; ret++ { + if x == 0b1 { + break + } + x = x >> 1 + } + return +} + +// encodeLoadOrStoreExtended encodes store/load instruction as "extended register offset" in Load/store register (register offset): +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Loads-and-Stores?lang=en +func encodeLoadOrStoreExtended(_22to32 uint32, rn, rm, rt uint32, scaled bool, extOp extendOp) uint32 { + var option uint32 + switch extOp { + case extendOpUXTW: + option = 0b010 + case extendOpSXTW: + option = 0b110 + case extendOpNone: + option = 0b111 + default: + panic("BUG") + } + var s uint32 + if scaled { + s = 0b1 + } + return _22to32<<22 | 0b1<<21 | rm<<16 | option<<13 | s<<12 | 0b10<<10 | rn<<5 | rt +} + +// encodeLoadOrStoreSIMM9 encodes store/load instruction as one of post-index, pre-index or unscaled immediate as in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Loads-and-Stores?lang=en +func encodeLoadOrStoreSIMM9(_22to32, _1011 uint32, rn, rt uint32, imm9 int64) uint32 { + return _22to32<<22 | (uint32(imm9)&0b111111111)<<12 | _1011<<10 | rn<<5 | rt +} + +// encodeFpuRRR encodes as single or double precision (depending on `_64bit`) of Floating-point data-processing (2 source) in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en +func encodeFpuRRR(op fpuBinOp, rd, rn, rm uint32, _64bit bool) (ret uint32) { + // https://developer.arm.com/documentation/ddi0596/2021-12/SIMD-FP-Instructions/ADD--vector--Add-vectors--scalar--floating-point-and-integer- + var opcode uint32 + switch op { + case fpuBinOpAdd: + opcode = 0b0010 + case fpuBinOpSub: + opcode = 0b0011 + case fpuBinOpMul: + opcode = 0b0000 + case fpuBinOpDiv: + opcode = 0b0001 + case fpuBinOpMax: + opcode = 0b0100 + case fpuBinOpMin: + opcode = 0b0101 + default: + panic("BUG") + } + var ptype uint32 + if _64bit { + ptype = 0b01 + } + return 0b1111<<25 | ptype<<22 | 0b1<<21 | rm<<16 | opcode<<12 | 0b1<<11 | rn<<5 | rd +} + +// encodeAluRRImm12 encodes as Add/subtract (immediate) in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Immediate?lang=en +func encodeAluRRImm12(op aluOp, rd, rn uint32, imm12 uint16, shiftBit byte, _64bit bool) uint32 { + var _31to24 uint32 + switch op { + case aluOpAdd: + _31to24 = 0b00_10001 + case aluOpAddS: + _31to24 = 0b01_10001 + case aluOpSub: + _31to24 = 0b10_10001 + case aluOpSubS: + _31to24 = 0b11_10001 + default: + panic("BUG") + } + if _64bit { + _31to24 |= 0b1 << 7 + } + return _31to24<<24 | uint32(shiftBit)<<22 | uint32(imm12&0b111111111111)<<10 | rn<<5 | rd +} + +// encodeAluRRR encodes as Data Processing (shifted register), depending on aluOp. +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Register?lang=en#addsub_shift +func encodeAluRRRShift(op aluOp, rd, rn, rm, amount uint32, shiftOp shiftOp, _64bit bool) uint32 { + var _31to24 uint32 + var opc, n uint32 + switch op { + case aluOpAdd: + _31to24 = 0b00001011 + case aluOpAddS: + _31to24 = 0b00101011 + case aluOpSub: + _31to24 = 0b01001011 + case aluOpSubS: + _31to24 = 0b01101011 + case aluOpAnd, aluOpOrr, aluOpEor: + // "Logical (shifted register)". + switch op { + case aluOpAnd: + // all zeros + case aluOpOrr: + opc = 0b01 + case aluOpEor: + opc = 0b10 + } + _31to24 = 0b000_01010 + default: + panic(op.String()) + } + + if _64bit { + _31to24 |= 0b1 << 7 + } + + var shift uint32 + switch shiftOp { + case shiftOpLSL: + shift = 0b00 + case shiftOpLSR: + shift = 0b01 + case shiftOpASR: + shift = 0b10 + default: + panic(shiftOp.String()) + } + return opc<<29 | n<<21 | _31to24<<24 | shift<<22 | rm<<16 | (amount << 10) | (rn << 5) | rd +} + +// "Add/subtract (extended register)" in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Register?lang=en#addsub_ext +func encodeAluRRRExtend(ao aluOp, rd, rn, rm uint32, extOp extendOp, to byte) uint32 { + var s, op uint32 + switch ao { + case aluOpAdd: + op = 0b0 + case aluOpAddS: + op, s = 0b0, 0b1 + case aluOpSub: + op = 0b1 + case aluOpSubS: + op, s = 0b1, 0b1 + default: + panic("BUG: extended register operand can be used only for add/sub") + } + + var sf uint32 + if to == 64 { + sf = 0b1 + } + + var option uint32 + switch extOp { + case extendOpUXTB: + option = 0b000 + case extendOpUXTH: + option = 0b001 + case extendOpUXTW: + option = 0b010 + case extendOpSXTB: + option = 0b100 + case extendOpSXTH: + option = 0b101 + case extendOpSXTW: + option = 0b110 + case extendOpSXTX, extendOpUXTX: + panic(fmt.Sprintf("%s is essentially noop, and should be handled much earlier than encoding", extOp.String())) + } + return sf<<31 | op<<30 | s<<29 | 0b1011001<<21 | rm<<16 | option<<13 | rn<<5 | rd +} + +// encodeAluRRR encodes as Data Processing (register), depending on aluOp. +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Register?lang=en +func encodeAluRRR(op aluOp, rd, rn, rm uint32, _64bit, isRnSp bool) uint32 { + var _31to21, _15to10 uint32 + switch op { + case aluOpAdd: + if isRnSp { + // "Extended register" with UXTW. + _31to21 = 0b00001011_001 + _15to10 = 0b011000 + } else { + // "Shifted register" with shift = 0 + _31to21 = 0b00001011_000 + } + case aluOpAddS: + if isRnSp { + panic("TODO") + } + // "Shifted register" with shift = 0 + _31to21 = 0b00101011_000 + case aluOpSub: + if isRnSp { + // "Extended register" with UXTW. + _31to21 = 0b01001011_001 + _15to10 = 0b011000 + } else { + // "Shifted register" with shift = 0 + _31to21 = 0b01001011_000 + } + case aluOpSubS: + if isRnSp { + panic("TODO") + } + // "Shifted register" with shift = 0 + _31to21 = 0b01101011_000 + case aluOpAnd, aluOpOrr, aluOpEor: + // "Logical (shifted register)". + var opc, n uint32 + switch op { + case aluOpAnd: + // all zeros + case aluOpOrr: + opc = 0b01 + case aluOpEor: + opc = 0b10 + } + _31to21 = 0b000_01010_000 | opc<<8 | n + case aluOpLsl, aluOpAsr, aluOpLsr, aluOpRotR: + // "Data-processing (2 source)". + _31to21 = 0b00011010_110 + switch op { + case aluOpLsl: + _15to10 = 0b001000 + case aluOpLsr: + _15to10 = 0b001001 + case aluOpAsr: + _15to10 = 0b001010 + case aluOpRotR: + _15to10 = 0b001011 + } + case aluOpSDiv: + // "Data-processing (2 source)". + _31to21 = 0b11010110 + _15to10 = 0b000011 + case aluOpUDiv: + // "Data-processing (2 source)". + _31to21 = 0b11010110 + _15to10 = 0b000010 + default: + panic(op.String()) + } + if _64bit { + _31to21 |= 0b1 << 10 + } + return _31to21<<21 | rm<<16 | (_15to10 << 10) | (rn << 5) | rd +} + +// encodeLogicalShiftedRegister encodes as Logical (shifted register) in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Register?lang=en +func encodeLogicalShiftedRegister(sf_opc uint32, shift_N uint32, rm uint32, imm6 uint32, rn, rd uint32) (ret uint32) { + ret = sf_opc << 29 + ret |= 0b01010 << 24 + ret |= shift_N << 21 + ret |= rm << 16 + ret |= imm6 << 10 + ret |= rn << 5 + ret |= rd + return +} + +// encodeAddSubtractImmediate encodes as Add/subtract (immediate) in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Immediate?lang=en +func encodeAddSubtractImmediate(sf_op_s uint32, sh uint32, imm12 uint32, rn, rd uint32) (ret uint32) { + ret = sf_op_s << 29 + ret |= 0b100010 << 23 + ret |= sh << 22 + ret |= imm12 << 10 + ret |= rn << 5 + ret |= rd + return +} + +// encodePreOrPostIndexLoadStorePair64 encodes as Load/store pair (pre/post-indexed) in +// https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/LDP--Load-Pair-of-Registers- +// https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/STP--Store-Pair-of-Registers- +func encodePreOrPostIndexLoadStorePair64(pre bool, load bool, rn, rt, rt2 uint32, imm7 int64) (ret uint32) { + if imm7%8 != 0 { + panic("imm7 for pair load/store must be a multiple of 8") + } + imm7 /= 8 + ret = rt + ret |= rn << 5 + ret |= rt2 << 10 + ret |= (uint32(imm7) & 0b1111111) << 15 + if load { + ret |= 0b1 << 22 + } + ret |= 0b101010001 << 23 + if pre { + ret |= 0b1 << 24 + } + return +} + +// encodeUnconditionalBranch encodes as B or BL instructions: +// https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/B--Branch- +// https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/BL--Branch-with-Link- +func encodeUnconditionalBranch(link bool, imm26 int64) (ret uint32) { + if imm26%4 != 0 { + panic("imm26 for branch must be a multiple of 4") + } + imm26 /= 4 + ret = uint32(imm26 & 0b11_11111111_11111111_11111111) + ret |= 0b101 << 26 + if link { + ret |= 0b1 << 31 + } + return +} + +// encodeCBZCBNZ encodes as either CBZ or CBNZ: +// https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/CBZ--Compare-and-Branch-on-Zero- +// https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/CBNZ--Compare-and-Branch-on-Nonzero- +func encodeCBZCBNZ(rt uint32, nz bool, imm19 uint32, _64bit bool) (ret uint32) { + ret = rt + ret |= imm19 << 5 + if nz { + ret |= 1 << 24 + } + ret |= 0b11010 << 25 + if _64bit { + ret |= 1 << 31 + } + return +} + +// encodeMoveWideImmediate encodes as either MOVZ, MOVN or MOVK, as Move wide (immediate) in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Immediate?lang=en +// +// "shift" must have been divided by 16 at this point. +func encodeMoveWideImmediate(opc uint32, rd uint32, imm, shift, _64bit uint64) (ret uint32) { + ret = rd + ret |= uint32(imm&0xffff) << 5 + ret |= (uint32(shift)) << 21 + ret |= 0b100101 << 23 + ret |= opc << 29 + ret |= uint32(_64bit) << 31 + return +} + +// encodeAluRRImm encodes as "Bitfield" in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Immediate?lang=en#log_imm +func encodeAluRRImm(op aluOp, rd, rn, amount, _64bit uint32) uint32 { + var opc uint32 + var immr, imms uint32 + switch op { + case aluOpLsl: + // LSL (immediate) is an alias for UBFM. + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/UBFM--Unsigned-Bitfield-Move-?lang=en + opc = 0b10 + if amount == 0 { + // This can be encoded as NOP, but we don't do it for consistency: lsr xn, xm, #0 + immr = 0 + if _64bit == 1 { + imms = 0b111111 + } else { + imms = 0b11111 + } + } else { + if _64bit == 1 { + immr = 64 - amount + } else { + immr = (32 - amount) & 0b11111 + } + imms = immr - 1 + } + case aluOpLsr: + // LSR (immediate) is an alias for UBFM. + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/LSR--immediate---Logical-Shift-Right--immediate---an-alias-of-UBFM-?lang=en + opc = 0b10 + imms, immr = 0b011111|_64bit<<5, amount + case aluOpAsr: + // ASR (immediate) is an alias for SBFM. + // https://developer.arm.com/documentation/ddi0596/2020-12/Base-Instructions/SBFM--Signed-Bitfield-Move-?lang=en + opc = 0b00 + imms, immr = 0b011111|_64bit<<5, amount + default: + panic(op.String()) + } + return _64bit<<31 | opc<<29 | 0b100110<<23 | _64bit<<22 | immr<<16 | imms<<10 | rn<<5 | rd +} + +// encodeVecLanes encodes as Data Processing (Advanced SIMD across lanes) depending on vecOp in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en +func encodeVecLanes(op vecOp, rd uint32, rn uint32, arr vecArrangement) uint32 { + var u, q, size, opcode uint32 + switch arr { + case vecArrangement8B: + q, size = 0b0, 0b00 + case vecArrangement16B: + q, size = 0b1, 0b00 + case vecArrangement4H: + q, size = 0, 0b01 + case vecArrangement8H: + q, size = 1, 0b01 + case vecArrangement4S: + q, size = 1, 0b10 + default: + panic("unsupported arrangement: " + arr.String()) + } + switch op { + case vecOpUaddlv: + u, opcode = 1, 0b00011 + case vecOpUminv: + u, opcode = 1, 0b11010 + case vecOpAddv: + u, opcode = 0, 0b11011 + default: + panic("unsupported or illegal vecOp: " + op.String()) + } + return q<<30 | u<<29 | 0b1110<<24 | size<<22 | 0b11000<<17 | opcode<<12 | 0b10<<10 | rn<<5 | rd +} + +// encodeVecLanes encodes as Data Processing (Advanced SIMD scalar shift by immediate) depending on vecOp in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en +func encodeVecShiftImm(op vecOp, rd uint32, rn, amount uint32, arr vecArrangement) uint32 { + var u, q, immh, immb, opcode uint32 + switch op { + case vecOpSshll: + u, opcode = 0b0, 0b10100 + case vecOpUshll: + u, opcode = 0b1, 0b10100 + case vecOpSshr: + u, opcode = 0, 0b00000 + default: + panic("unsupported or illegal vecOp: " + op.String()) + } + switch arr { + case vecArrangement16B: + q = 0b1 + fallthrough + case vecArrangement8B: + immh = 0b0001 + immb = 8 - uint32(amount&0b111) + case vecArrangement8H: + q = 0b1 + fallthrough + case vecArrangement4H: + v := 16 - uint32(amount&0b1111) + immb = v & 0b111 + immh = 0b0010 | (v >> 3) + case vecArrangement4S: + q = 0b1 + fallthrough + case vecArrangement2S: + v := 32 - uint32(amount&0b11111) + immb = v & 0b111 + immh = 0b0100 | (v >> 3) + case vecArrangement2D: + q = 0b1 + v := 64 - uint32(amount&0b111111) + immb = v & 0b111 + immh = 0b1000 | (v >> 3) + default: + panic("unsupported arrangement: " + arr.String()) + } + return q<<30 | u<<29 | 0b011110<<23 | immh<<19 | immb<<16 | 0b000001<<10 | opcode<<11 | 0b1<<10 | rn<<5 | rd +} + +// encodeVecTbl encodes as Data Processing (Advanced SIMD table lookup) in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en#simd-dp +// +// Note: tblOp may encode tbl1, tbl2... in the future. Currently, it is ignored. +func encodeVecTbl(nregs, rd, rn, rm uint32, arr vecArrangement) uint32 { + var q, op2, len, op uint32 + + switch nregs { + case 1: + // tbl: single-register + len = 0b00 + case 2: + // tbl2: 2-register table + len = 0b01 + default: + panic(fmt.Sprintf("unsupported number or registers %d", nregs)) + } + switch arr { + case vecArrangement8B: + q = 0b0 + case vecArrangement16B: + q = 0b1 + default: + panic("unsupported arrangement: " + arr.String()) + } + + return q<<30 | 0b001110<<24 | op2<<22 | rm<<16 | len<<13 | op<<12 | rn<<5 | rd +} + +// encodeVecMisc encodes as Data Processing (Advanced SIMD two-register miscellaneous) depending on vecOp in +// https://developer.arm.com/documentation/ddi0596/2020-12/Index-by-Encoding/Data-Processing----Scalar-Floating-Point-and-Advanced-SIMD?lang=en#simd-dp +func encodeAdvancedSIMDTwoMisc(op vecOp, rd, rn uint32, arr vecArrangement) uint32 { + var q, u, size, opcode uint32 + switch op { + case vecOpCnt: + opcode = 0b00101 + switch arr { + case vecArrangement8B: + q, size = 0b0, 0b00 + case vecArrangement16B: + q, size = 0b1, 0b00 + default: + panic("unsupported arrangement: " + arr.String()) + } + case vecOpCmeq0: + if arr == vecArrangement1D { + panic("unsupported arrangement: " + arr.String()) + } + opcode = 0b01001 + size, q = arrToSizeQEncoded(arr) + case vecOpNot: + u = 1 + opcode = 0b00101 + switch arr { + case vecArrangement8B: + q, size = 0b0, 0b00 + case vecArrangement16B: + q, size = 0b1, 0b00 + default: + panic("unsupported arrangement: " + arr.String()) + } + case vecOpAbs: + if arr == vecArrangement1D { + panic("unsupported arrangement: " + arr.String()) + } + opcode = 0b01011 + u = 0b0 + size, q = arrToSizeQEncoded(arr) + case vecOpNeg: + if arr == vecArrangement1D { + panic("unsupported arrangement: " + arr.String()) + } + opcode = 0b01011 + u = 0b1 + size, q = arrToSizeQEncoded(arr) + case vecOpFabs: + if arr < vecArrangement2S || arr == vecArrangement1D { + panic("unsupported arrangement: " + arr.String()) + } + opcode = 0b01111 + u = 0b0 + size, q = arrToSizeQEncoded(arr) + case vecOpFneg: + if arr < vecArrangement2S || arr == vecArrangement1D { + panic("unsupported arrangement: " + arr.String()) + } + opcode = 0b01111 + u = 0b1 + size, q = arrToSizeQEncoded(arr) + case vecOpFrintm: + u = 0b0 + opcode = 0b11001 + switch arr { + case vecArrangement2S: + q, size = 0b0, 0b00 + case vecArrangement4S: + q, size = 0b1, 0b00 + case vecArrangement2D: + q, size = 0b1, 0b01 + default: + panic("unsupported arrangement: " + arr.String()) + } + case vecOpFrintn: + u = 0b0 + opcode = 0b11000 + switch arr { + case vecArrangement2S: + q, size = 0b0, 0b00 + case vecArrangement4S: + q, size = 0b1, 0b00 + case vecArrangement2D: + q, size = 0b1, 0b01 + default: + panic("unsupported arrangement: " + arr.String()) + } + case vecOpFrintp: + u = 0b0 + opcode = 0b11000 + if arr < vecArrangement2S || arr == vecArrangement1D { + panic("unsupported arrangement: " + arr.String()) + } + size, q = arrToSizeQEncoded(arr) + case vecOpFrintz: + u = 0b0 + opcode = 0b11001 + if arr < vecArrangement2S || arr == vecArrangement1D { + panic("unsupported arrangement: " + arr.String()) + } + size, q = arrToSizeQEncoded(arr) + case vecOpFsqrt: + if arr < vecArrangement2S || arr == vecArrangement1D { + panic("unsupported arrangement: " + arr.String()) + } + opcode = 0b11111 + u = 0b1 + size, q = arrToSizeQEncoded(arr) + case vecOpFcvtl: + opcode = 0b10111 + u = 0b0 + switch arr { + case vecArrangement2S: + size, q = 0b01, 0b0 + case vecArrangement4H: + size, q = 0b00, 0b0 + default: + panic("unsupported arrangement: " + arr.String()) + } + case vecOpFcvtn: + opcode = 0b10110 + u = 0b0 + switch arr { + case vecArrangement2S: + size, q = 0b01, 0b0 + case vecArrangement4H: + size, q = 0b00, 0b0 + default: + panic("unsupported arrangement: " + arr.String()) + } + case vecOpFcvtzs: + opcode = 0b11011 + u = 0b0 + switch arr { + case vecArrangement2S: + q, size = 0b0, 0b10 + case vecArrangement4S: + q, size = 0b1, 0b10 + case vecArrangement2D: + q, size = 0b1, 0b11 + default: + panic("unsupported arrangement: " + arr.String()) + } + case vecOpFcvtzu: + opcode = 0b11011 + u = 0b1 + switch arr { + case vecArrangement2S: + q, size = 0b0, 0b10 + case vecArrangement4S: + q, size = 0b1, 0b10 + case vecArrangement2D: + q, size = 0b1, 0b11 + default: + panic("unsupported arrangement: " + arr.String()) + } + case vecOpScvtf: + opcode = 0b11101 + u = 0b0 + switch arr { + case vecArrangement4S: + q, size = 0b1, 0b00 + case vecArrangement2S: + q, size = 0b0, 0b00 + case vecArrangement2D: + q, size = 0b1, 0b01 + default: + panic("unsupported arrangement: " + arr.String()) + } + case vecOpUcvtf: + opcode = 0b11101 + u = 0b1 + switch arr { + case vecArrangement4S: + q, size = 0b1, 0b00 + case vecArrangement2S: + q, size = 0b0, 0b00 + case vecArrangement2D: + q, size = 0b1, 0b01 + default: + panic("unsupported arrangement: " + arr.String()) + } + case vecOpSqxtn: + // When q == 1 it encodes sqxtn2 (operates on upper 64 bits). + opcode = 0b10100 + u = 0b0 + if arr > vecArrangement4S { + panic("unsupported arrangement: " + arr.String()) + } + size, q = arrToSizeQEncoded(arr) + case vecOpUqxtn: + // When q == 1 it encodes uqxtn2 (operates on upper 64 bits). + opcode = 0b10100 + u = 0b1 + if arr > vecArrangement4S { + panic("unsupported arrangement: " + arr.String()) + } + size, q = arrToSizeQEncoded(arr) + case vecOpSqxtun: + // When q == 1 it encodes sqxtun2 (operates on upper 64 bits). + opcode = 0b10010 // 0b10100 + u = 0b1 + if arr > vecArrangement4S { + panic("unsupported arrangement: " + arr.String()) + } + size, q = arrToSizeQEncoded(arr) + case vecOpRev64: + opcode = 0b00000 + size, q = arrToSizeQEncoded(arr) + case vecOpXtn: + u = 0b0 + opcode = 0b10010 + size, q = arrToSizeQEncoded(arr) + case vecOpShll: + u = 0b1 + opcode = 0b10011 + switch arr { + case vecArrangement8B: + q, size = 0b0, 0b00 + case vecArrangement4H: + q, size = 0b0, 0b01 + case vecArrangement2S: + q, size = 0b0, 0b10 + default: + panic("unsupported arrangement: " + arr.String()) + } + default: + panic("unsupported or illegal vecOp: " + op.String()) + } + return q<<30 | u<<29 | 0b01110<<24 | size<<22 | 0b10000<<17 | opcode<<12 | 0b10<<10 | rn<<5 | rd +} + +// brTableSequenceOffsetTableBegin is the offset inside the brTableSequence where the table begins after 4 instructions +const brTableSequenceOffsetTableBegin = 16 + +func encodeBrTableSequence(c backend.Compiler, index regalloc.VReg, targets []uint32) { + tmpRegNumber := regNumberInEncoding[tmp] + indexNumber := regNumberInEncoding[index.RealReg()] + + // adr tmpReg, PC+16 (PC+16 is the address of the first label offset) + // ldrsw index, [tmpReg, index, UXTW 2] ;; index = int64(*(tmpReg + index*8)) + // add tmpReg, tmpReg, index + // br tmpReg + // [offset_to_l1, offset_to_l2, ..., offset_to_lN] + c.Emit4Bytes(encodeAdr(tmpRegNumber, 16)) + c.Emit4Bytes(encodeLoadOrStore(sLoad32, indexNumber, + addressMode{kind: addressModeKindRegScaledExtended, rn: tmpRegVReg, rm: index, extOp: extendOpUXTW}, + )) + c.Emit4Bytes(encodeAluRRR(aluOpAdd, tmpRegNumber, tmpRegNumber, indexNumber, true, false)) + c.Emit4Bytes(encodeUnconditionalBranchReg(tmpRegNumber, false)) + + // Offsets are resolved in ResolveRelativeAddress phase. + for _, offset := range targets { + if wazevoapi.PrintMachineCodeHexPerFunctionDisassemblable { + // Inlined offset tables cannot be disassembled properly, so pad dummy instructions to make the debugging easier. + c.Emit4Bytes(dummyInstruction) + } else { + c.Emit4Bytes(offset) + } + } +} + +// encodeExitSequence matches the implementation detail of abiImpl.emitGoEntryPreamble. +func encodeExitSequence(c backend.Compiler, ctxReg regalloc.VReg) { + // Restore the FP, SP and LR, and return to the Go code: + // ldr lr, [ctxReg, #GoReturnAddress] + // ldr fp, [ctxReg, #OriginalFramePointer] + // ldr tmp, [ctxReg, #OriginalStackPointer] + // mov sp, tmp ;; sp cannot be str'ed directly. + // ret ;; --> return to the Go code + + var ctxEvicted bool + if ctx := ctxReg.RealReg(); ctx == fp || ctx == lr { + // In order to avoid overwriting the context register, we move ctxReg to tmp. + c.Emit4Bytes(encodeMov64(regNumberInEncoding[tmp], regNumberInEncoding[ctx], false, false)) + ctxReg = tmpRegVReg + ctxEvicted = true + } + + restoreLr := encodeLoadOrStore( + uLoad64, + regNumberInEncoding[lr], + addressMode{ + kind: addressModeKindRegUnsignedImm12, + rn: ctxReg, + imm: wazevoapi.ExecutionContextOffsetGoReturnAddress.I64(), + }, + ) + + restoreFp := encodeLoadOrStore( + uLoad64, + regNumberInEncoding[fp], + addressMode{ + kind: addressModeKindRegUnsignedImm12, + rn: ctxReg, + imm: wazevoapi.ExecutionContextOffsetOriginalFramePointer.I64(), + }, + ) + + restoreSpToTmp := encodeLoadOrStore( + uLoad64, + regNumberInEncoding[tmp], + addressMode{ + kind: addressModeKindRegUnsignedImm12, + rn: ctxReg, + imm: wazevoapi.ExecutionContextOffsetOriginalStackPointer.I64(), + }, + ) + + movTmpToSp := encodeAddSubtractImmediate(0b100, 0, 0, + regNumberInEncoding[tmp], regNumberInEncoding[sp]) + + c.Emit4Bytes(restoreFp) + c.Emit4Bytes(restoreLr) + c.Emit4Bytes(restoreSpToTmp) + c.Emit4Bytes(movTmpToSp) + c.Emit4Bytes(encodeRet()) + if !ctxEvicted { + // In order to have the fixed-length exit sequence, we need to padd the binary. + // Since this will never be reached, we insert a dummy instruction. + c.Emit4Bytes(dummyInstruction) + } +} + +func encodeRet() uint32 { + // https://developer.arm.com/documentation/ddi0596/2020-12/Base-Instructions/RET--Return-from-subroutine-?lang=en + return 0b1101011001011111<<16 | regNumberInEncoding[lr]<<5 +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/lower_constant.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/lower_constant.go new file mode 100644 index 000000000..5516c0b3e --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/lower_constant.go @@ -0,0 +1,290 @@ +package arm64 + +import ( + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc" + "github.com/tetratelabs/wazero/internal/engine/wazevo/ssa" +) + +// lowerConstant allocates a new VReg and inserts the instruction to load the constant value. +func (m *machine) lowerConstant(instr *ssa.Instruction) (vr regalloc.VReg) { + val := instr.Return() + valType := val.Type() + + vr = m.compiler.AllocateVReg(valType) + m.InsertLoadConstant(instr, vr) + return +} + +// InsertLoadConstant implements backend.Machine. +func (m *machine) InsertLoadConstant(instr *ssa.Instruction, vr regalloc.VReg) { + val := instr.Return() + valType := val.Type() + v := instr.ConstantVal() + + if valType.Bits() < 64 { // Clear the redundant bits just in case it's unexpectedly sign-extended, etc. + v = v & ((1 << valType.Bits()) - 1) + } + + switch valType { + case ssa.TypeF32: + loadF := m.allocateInstr() + loadF.asLoadFpuConst32(vr, v) + m.insert(loadF) + case ssa.TypeF64: + loadF := m.allocateInstr() + loadF.asLoadFpuConst64(vr, v) + m.insert(loadF) + case ssa.TypeI32: + if v == 0 { + m.InsertMove(vr, xzrVReg, ssa.TypeI32) + } else { + m.lowerConstantI32(vr, int32(v)) + } + case ssa.TypeI64: + if v == 0 { + m.InsertMove(vr, xzrVReg, ssa.TypeI64) + } else { + m.lowerConstantI64(vr, int64(v)) + } + default: + panic("TODO") + } +} + +// The following logics are based on the old asm/arm64 package. +// https://github.com/tetratelabs/wazero/blob/39f2ff23a6d609e10c82b9cc0b981f6de5b87a9c/internal/asm/arm64/impl.go + +func (m *machine) lowerConstantI32(dst regalloc.VReg, c int32) { + // Following the logic here: + // https://github.com/golang/go/blob/release-branch.go1.15/src/cmd/internal/obj/arm64/asm7.go#L1637 + ic := int64(uint32(c)) + if ic >= 0 && (ic <= 0xfff || (ic&0xfff) == 0 && (uint64(ic>>12) <= 0xfff)) { + if isBitMaskImmediate(uint64(c), false) { + m.lowerConstViaBitMaskImmediate(uint64(uint32(c)), dst, false) + return + } + } + + if t := const16bitAligned(int64(uint32(c))); t >= 0 { + // If the const can fit within 16-bit alignment, for example, 0xffff, 0xffff_0000 or 0xffff_0000_0000_0000 + // We could load it into temporary with movk. + m.insertMOVZ(dst, uint64(uint32(c)>>(16*t)), t, false) + } else if t := const16bitAligned(int64(^c)); t >= 0 { + // Also, if the inverse of the const can fit within 16-bit range, do the same ^^. + m.insertMOVN(dst, uint64(^c>>(16*t)), t, false) + } else if isBitMaskImmediate(uint64(uint32(c)), false) { + m.lowerConstViaBitMaskImmediate(uint64(c), dst, false) + } else { + // Otherwise, we use MOVZ and MOVK to load it. + c16 := uint16(c) + m.insertMOVZ(dst, uint64(c16), 0, false) + c16 = uint16(uint32(c) >> 16) + m.insertMOVK(dst, uint64(c16), 1, false) + } +} + +func (m *machine) lowerConstantI64(dst regalloc.VReg, c int64) { + // Following the logic here: + // https://github.com/golang/go/blob/release-branch.go1.15/src/cmd/internal/obj/arm64/asm7.go#L1798-L1852 + if c >= 0 && (c <= 0xfff || (c&0xfff) == 0 && (uint64(c>>12) <= 0xfff)) { + if isBitMaskImmediate(uint64(c), true) { + m.lowerConstViaBitMaskImmediate(uint64(c), dst, true) + return + } + } + + if t := const16bitAligned(c); t >= 0 { + // If the const can fit within 16-bit alignment, for example, 0xffff, 0xffff_0000 or 0xffff_0000_0000_0000 + // We could load it into temporary with movk. + m.insertMOVZ(dst, uint64(c)>>(16*t), t, true) + } else if t := const16bitAligned(^c); t >= 0 { + // Also, if the reverse of the const can fit within 16-bit range, do the same ^^. + m.insertMOVN(dst, uint64(^c)>>(16*t), t, true) + } else if isBitMaskImmediate(uint64(c), true) { + m.lowerConstViaBitMaskImmediate(uint64(c), dst, true) + } else { + m.load64bitConst(c, dst) + } +} + +func (m *machine) lowerConstViaBitMaskImmediate(c uint64, dst regalloc.VReg, b64 bool) { + instr := m.allocateInstr() + instr.asALUBitmaskImm(aluOpOrr, dst, xzrVReg, c, b64) + m.insert(instr) +} + +// isBitMaskImmediate determines if the value can be encoded as "bitmask immediate". +// +// Such an immediate is a 32-bit or 64-bit pattern viewed as a vector of identical elements of size e = 2, 4, 8, 16, 32, or 64 bits. +// Each element contains the same sub-pattern: a single run of 1 to e-1 non-zero bits, rotated by 0 to e-1 bits. +// +// See https://developer.arm.com/documentation/dui0802/b/A64-General-Instructions/MOV--bitmask-immediate- +func isBitMaskImmediate(x uint64, _64 bool) bool { + // All zeros and ones are not "bitmask immediate" by definition. + if x == 0 || (_64 && x == 0xffff_ffff_ffff_ffff) || (!_64 && x == 0xffff_ffff) { + return false + } + + switch { + case x != x>>32|x<<32: + // e = 64 + case x != x>>16|x<<48: + // e = 32 (x == x>>32|x<<32). + // e.g. 0x00ff_ff00_00ff_ff00 + x = uint64(int32(x)) + case x != x>>8|x<<56: + // e = 16 (x == x>>16|x<<48). + // e.g. 0x00ff_00ff_00ff_00ff + x = uint64(int16(x)) + case x != x>>4|x<<60: + // e = 8 (x == x>>8|x<<56). + // e.g. 0x0f0f_0f0f_0f0f_0f0f + x = uint64(int8(x)) + default: + // e = 4 or 2. + return true + } + return sequenceOfSetbits(x) || sequenceOfSetbits(^x) +} + +// sequenceOfSetbits returns true if the number's binary representation is the sequence set bit (1). +// For example: 0b1110 -> true, 0b1010 -> false +func sequenceOfSetbits(x uint64) bool { + y := getLowestBit(x) + // If x is a sequence of set bit, this should results in the number + // with only one set bit (i.e. power of two). + y += x + return (y-1)&y == 0 +} + +func getLowestBit(x uint64) uint64 { + return x & (^x + 1) +} + +// const16bitAligned check if the value is on the 16-bit alignment. +// If so, returns the shift num divided by 16, and otherwise -1. +func const16bitAligned(v int64) (ret int) { + ret = -1 + for s := 0; s < 64; s += 16 { + if (uint64(v) &^ (uint64(0xffff) << uint(s))) == 0 { + ret = s / 16 + break + } + } + return +} + +// load64bitConst loads a 64-bit constant into the register, following the same logic to decide how to load large 64-bit +// consts as in the Go assembler. +// +// See https://github.com/golang/go/blob/release-branch.go1.15/src/cmd/internal/obj/arm64/asm7.go#L6632-L6759 +func (m *machine) load64bitConst(c int64, dst regalloc.VReg) { + var bits [4]uint64 + var zeros, negs int + for i := 0; i < 4; i++ { + bits[i] = uint64(c) >> uint(i*16) & 0xffff + if v := bits[i]; v == 0 { + zeros++ + } else if v == 0xffff { + negs++ + } + } + + if zeros == 3 { + // one MOVZ instruction. + for i, v := range bits { + if v != 0 { + m.insertMOVZ(dst, v, i, true) + } + } + } else if negs == 3 { + // one MOVN instruction. + for i, v := range bits { + if v != 0xffff { + v = ^v + m.insertMOVN(dst, v, i, true) + } + } + } else if zeros == 2 { + // one MOVZ then one OVK. + var movz bool + for i, v := range bits { + if !movz && v != 0 { // MOVZ. + m.insertMOVZ(dst, v, i, true) + movz = true + } else if v != 0 { + m.insertMOVK(dst, v, i, true) + } + } + + } else if negs == 2 { + // one MOVN then one or two MOVK. + var movn bool + for i, v := range bits { // Emit MOVN. + if !movn && v != 0xffff { + v = ^v + // https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/MOVN + m.insertMOVN(dst, v, i, true) + movn = true + } else if v != 0xffff { + m.insertMOVK(dst, v, i, true) + } + } + + } else if zeros == 1 { + // one MOVZ then two MOVK. + var movz bool + for i, v := range bits { + if !movz && v != 0 { // MOVZ. + m.insertMOVZ(dst, v, i, true) + movz = true + } else if v != 0 { + m.insertMOVK(dst, v, i, true) + } + } + + } else if negs == 1 { + // one MOVN then two MOVK. + var movn bool + for i, v := range bits { // Emit MOVN. + if !movn && v != 0xffff { + v = ^v + // https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/MOVN + m.insertMOVN(dst, v, i, true) + movn = true + } else if v != 0xffff { + m.insertMOVK(dst, v, i, true) + } + } + + } else { + // one MOVZ then up to three MOVK. + var movz bool + for i, v := range bits { + if !movz && v != 0 { // MOVZ. + m.insertMOVZ(dst, v, i, true) + movz = true + } else if v != 0 { + m.insertMOVK(dst, v, i, true) + } + } + } +} + +func (m *machine) insertMOVZ(dst regalloc.VReg, v uint64, shift int, dst64 bool) { + instr := m.allocateInstr() + instr.asMOVZ(dst, v, uint64(shift), dst64) + m.insert(instr) +} + +func (m *machine) insertMOVK(dst regalloc.VReg, v uint64, shift int, dst64 bool) { + instr := m.allocateInstr() + instr.asMOVK(dst, v, uint64(shift), dst64) + m.insert(instr) +} + +func (m *machine) insertMOVN(dst regalloc.VReg, v uint64, shift int, dst64 bool) { + instr := m.allocateInstr() + instr.asMOVN(dst, v, uint64(shift), dst64) + m.insert(instr) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/lower_instr.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/lower_instr.go new file mode 100644 index 000000000..f72509108 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/lower_instr.go @@ -0,0 +1,1995 @@ +package arm64 + +// Files prefixed as lower_instr** do the instruction selection, meaning that lowering SSA level instructions +// into machine specific instructions. +// +// Importantly, what the lower** functions does includes tree-matching; find the pattern from the given instruction tree, +// and merge the multiple instructions if possible. It can be considered as "N:1" instruction selection. + +import ( + "fmt" + "math" + + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc" + "github.com/tetratelabs/wazero/internal/engine/wazevo/ssa" + "github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi" +) + +// LowerSingleBranch implements backend.Machine. +func (m *machine) LowerSingleBranch(br *ssa.Instruction) { + switch br.Opcode() { + case ssa.OpcodeJump: + _, _, targetBlk := br.BranchData() + if br.IsFallthroughJump() { + return + } + b := m.allocateInstr() + target := m.getOrAllocateSSABlockLabel(targetBlk) + if target == returnLabel { + b.asRet(m.currentABI) + } else { + b.asBr(target) + } + m.insert(b) + case ssa.OpcodeBrTable: + m.lowerBrTable(br) + default: + panic("BUG: unexpected branch opcode" + br.Opcode().String()) + } +} + +func (m *machine) lowerBrTable(i *ssa.Instruction) { + index, targets := i.BrTableData() + indexOperand := m.getOperand_NR(m.compiler.ValueDefinition(index), extModeNone) + + // Firstly, we have to do the bounds check of the index, and + // set it to the default target (sitting at the end of the list) if it's out of bounds. + + // mov maxIndexReg #maximum_index + // subs wzr, index, maxIndexReg + // csel adjustedIndex, maxIndexReg, index, hs ;; if index is higher or equal than maxIndexReg. + maxIndexReg := m.compiler.AllocateVReg(ssa.TypeI32) + m.lowerConstantI32(maxIndexReg, int32(len(targets)-1)) + subs := m.allocateInstr() + subs.asALU(aluOpSubS, operandNR(xzrVReg), indexOperand, operandNR(maxIndexReg), false) + m.insert(subs) + csel := m.allocateInstr() + adjustedIndex := m.compiler.AllocateVReg(ssa.TypeI32) + csel.asCSel(operandNR(adjustedIndex), operandNR(maxIndexReg), indexOperand, hs, false) + m.insert(csel) + + brSequence := m.allocateInstr() + + // TODO: reuse the slice! + labels := make([]uint32, len(targets)) + for j, target := range targets { + labels[j] = uint32(m.getOrAllocateSSABlockLabel(target)) + } + + brSequence.asBrTableSequence(adjustedIndex, labels) + m.insert(brSequence) +} + +// LowerConditionalBranch implements backend.Machine. +func (m *machine) LowerConditionalBranch(b *ssa.Instruction) { + cval, args, targetBlk := b.BranchData() + if len(args) > 0 { + panic(fmt.Sprintf( + "conditional branch shouldn't have args; likely a bug in critical edge splitting: from %s to %s", + m.currentSSABlk, + targetBlk, + )) + } + + target := m.getOrAllocateSSABlockLabel(targetBlk) + cvalDef := m.compiler.ValueDefinition(cval) + + switch { + case m.compiler.MatchInstr(cvalDef, ssa.OpcodeIcmp): // This case, we can use the ALU flag set by SUBS instruction. + cvalInstr := cvalDef.Instr + x, y, c := cvalInstr.IcmpData() + cc, signed := condFlagFromSSAIntegerCmpCond(c), c.Signed() + if b.Opcode() == ssa.OpcodeBrz { + cc = cc.invert() + } + + m.lowerIcmpToFlag(x, y, signed) + cbr := m.allocateInstr() + cbr.asCondBr(cc.asCond(), target, false /* ignored */) + m.insert(cbr) + cvalDef.Instr.MarkLowered() + case m.compiler.MatchInstr(cvalDef, ssa.OpcodeFcmp): // This case we can use the Fpu flag directly. + cvalInstr := cvalDef.Instr + x, y, c := cvalInstr.FcmpData() + cc := condFlagFromSSAFloatCmpCond(c) + if b.Opcode() == ssa.OpcodeBrz { + cc = cc.invert() + } + m.lowerFcmpToFlag(x, y) + cbr := m.allocateInstr() + cbr.asCondBr(cc.asCond(), target, false /* ignored */) + m.insert(cbr) + cvalDef.Instr.MarkLowered() + default: + rn := m.getOperand_NR(cvalDef, extModeNone) + var c cond + if b.Opcode() == ssa.OpcodeBrz { + c = registerAsRegZeroCond(rn.nr()) + } else { + c = registerAsRegNotZeroCond(rn.nr()) + } + cbr := m.allocateInstr() + cbr.asCondBr(c, target, false) + m.insert(cbr) + } +} + +// LowerInstr implements backend.Machine. +func (m *machine) LowerInstr(instr *ssa.Instruction) { + if l := instr.SourceOffset(); l.Valid() { + info := m.allocateInstr().asEmitSourceOffsetInfo(l) + m.insert(info) + } + + switch op := instr.Opcode(); op { + case ssa.OpcodeBrz, ssa.OpcodeBrnz, ssa.OpcodeJump, ssa.OpcodeBrTable: + panic("BUG: branching instructions are handled by LowerBranches") + case ssa.OpcodeReturn: + panic("BUG: return must be handled by backend.Compiler") + case ssa.OpcodeIadd, ssa.OpcodeIsub: + m.lowerSubOrAdd(instr, op == ssa.OpcodeIadd) + case ssa.OpcodeFadd, ssa.OpcodeFsub, ssa.OpcodeFmul, ssa.OpcodeFdiv, ssa.OpcodeFmax, ssa.OpcodeFmin: + m.lowerFpuBinOp(instr) + case ssa.OpcodeIconst, ssa.OpcodeF32const, ssa.OpcodeF64const: // Constant instructions are inlined. + case ssa.OpcodeExitWithCode: + execCtx, code := instr.ExitWithCodeData() + m.lowerExitWithCode(m.compiler.VRegOf(execCtx), code) + case ssa.OpcodeExitIfTrueWithCode: + execCtx, c, code := instr.ExitIfTrueWithCodeData() + m.lowerExitIfTrueWithCode(m.compiler.VRegOf(execCtx), c, code) + case ssa.OpcodeStore, ssa.OpcodeIstore8, ssa.OpcodeIstore16, ssa.OpcodeIstore32: + m.lowerStore(instr) + case ssa.OpcodeLoad: + dst := instr.Return() + ptr, offset, typ := instr.LoadData() + m.lowerLoad(ptr, offset, typ, dst) + case ssa.OpcodeVZeroExtLoad: + dst := instr.Return() + ptr, offset, typ := instr.VZeroExtLoadData() + m.lowerLoad(ptr, offset, typ, dst) + case ssa.OpcodeUload8, ssa.OpcodeUload16, ssa.OpcodeUload32, ssa.OpcodeSload8, ssa.OpcodeSload16, ssa.OpcodeSload32: + ptr, offset, _ := instr.LoadData() + ret := m.compiler.VRegOf(instr.Return()) + m.lowerExtLoad(op, ptr, offset, ret) + case ssa.OpcodeCall, ssa.OpcodeCallIndirect: + m.lowerCall(instr) + case ssa.OpcodeIcmp: + m.lowerIcmp(instr) + case ssa.OpcodeVIcmp: + m.lowerVIcmp(instr) + case ssa.OpcodeVFcmp: + m.lowerVFcmp(instr) + case ssa.OpcodeVCeil: + m.lowerVecMisc(vecOpFrintp, instr) + case ssa.OpcodeVFloor: + m.lowerVecMisc(vecOpFrintm, instr) + case ssa.OpcodeVTrunc: + m.lowerVecMisc(vecOpFrintz, instr) + case ssa.OpcodeVNearest: + m.lowerVecMisc(vecOpFrintn, instr) + case ssa.OpcodeVMaxPseudo: + m.lowerVMinMaxPseudo(instr, true) + case ssa.OpcodeVMinPseudo: + m.lowerVMinMaxPseudo(instr, false) + case ssa.OpcodeBand: + m.lowerBitwiseAluOp(instr, aluOpAnd) + case ssa.OpcodeBor: + m.lowerBitwiseAluOp(instr, aluOpOrr) + case ssa.OpcodeBxor: + m.lowerBitwiseAluOp(instr, aluOpEor) + case ssa.OpcodeIshl: + m.lowerShifts(instr, extModeNone, aluOpLsl) + case ssa.OpcodeSshr: + if instr.Return().Type().Bits() == 64 { + m.lowerShifts(instr, extModeSignExtend64, aluOpAsr) + } else { + m.lowerShifts(instr, extModeSignExtend32, aluOpAsr) + } + case ssa.OpcodeUshr: + if instr.Return().Type().Bits() == 64 { + m.lowerShifts(instr, extModeZeroExtend64, aluOpLsr) + } else { + m.lowerShifts(instr, extModeZeroExtend32, aluOpLsr) + } + case ssa.OpcodeRotl: + m.lowerRotl(instr) + case ssa.OpcodeRotr: + m.lowerRotr(instr) + case ssa.OpcodeSExtend, ssa.OpcodeUExtend: + from, to, signed := instr.ExtendData() + m.lowerExtend(instr.Arg(), instr.Return(), from, to, signed) + case ssa.OpcodeFcmp: + x, y, c := instr.FcmpData() + m.lowerFcmp(x, y, instr.Return(), c) + case ssa.OpcodeImul: + x, y := instr.Arg2() + result := instr.Return() + m.lowerImul(x, y, result) + case ssa.OpcodeUndefined: + undef := m.allocateInstr() + undef.asUDF() + m.insert(undef) + case ssa.OpcodeSelect: + c, x, y := instr.SelectData() + if x.Type() == ssa.TypeV128 { + rc := m.getOperand_NR(m.compiler.ValueDefinition(c), extModeNone) + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rm := m.getOperand_NR(m.compiler.ValueDefinition(y), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + m.lowerSelectVec(rc, rn, rm, rd) + } else { + m.lowerSelect(c, x, y, instr.Return()) + } + case ssa.OpcodeClz: + x := instr.Arg() + result := instr.Return() + m.lowerClz(x, result) + case ssa.OpcodeCtz: + x := instr.Arg() + result := instr.Return() + m.lowerCtz(x, result) + case ssa.OpcodePopcnt: + x := instr.Arg() + result := instr.Return() + m.lowerPopcnt(x, result) + case ssa.OpcodeFcvtToSint, ssa.OpcodeFcvtToSintSat: + x, ctx := instr.Arg2() + result := instr.Return() + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rd := operandNR(m.compiler.VRegOf(result)) + ctxVReg := m.compiler.VRegOf(ctx) + m.lowerFpuToInt(rd, rn, ctxVReg, true, x.Type() == ssa.TypeF64, + result.Type().Bits() == 64, op == ssa.OpcodeFcvtToSintSat) + case ssa.OpcodeFcvtToUint, ssa.OpcodeFcvtToUintSat: + x, ctx := instr.Arg2() + result := instr.Return() + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rd := operandNR(m.compiler.VRegOf(result)) + ctxVReg := m.compiler.VRegOf(ctx) + m.lowerFpuToInt(rd, rn, ctxVReg, false, x.Type() == ssa.TypeF64, + result.Type().Bits() == 64, op == ssa.OpcodeFcvtToUintSat) + case ssa.OpcodeFcvtFromSint: + x := instr.Arg() + result := instr.Return() + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rd := operandNR(m.compiler.VRegOf(result)) + m.lowerIntToFpu(rd, rn, true, x.Type() == ssa.TypeI64, result.Type().Bits() == 64) + case ssa.OpcodeFcvtFromUint: + x := instr.Arg() + result := instr.Return() + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rd := operandNR(m.compiler.VRegOf(result)) + m.lowerIntToFpu(rd, rn, false, x.Type() == ssa.TypeI64, result.Type().Bits() == 64) + case ssa.OpcodeFdemote: + v := instr.Arg() + rn := m.getOperand_NR(m.compiler.ValueDefinition(v), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + cnt := m.allocateInstr() + cnt.asFpuRR(fpuUniOpCvt64To32, rd, rn, false) + m.insert(cnt) + case ssa.OpcodeFpromote: + v := instr.Arg() + rn := m.getOperand_NR(m.compiler.ValueDefinition(v), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + cnt := m.allocateInstr() + cnt.asFpuRR(fpuUniOpCvt32To64, rd, rn, true) + m.insert(cnt) + case ssa.OpcodeIreduce: + rn := m.getOperand_NR(m.compiler.ValueDefinition(instr.Arg()), extModeNone) + retVal := instr.Return() + rd := m.compiler.VRegOf(retVal) + + if retVal.Type() != ssa.TypeI32 { + panic("TODO?: Ireduce to non-i32") + } + mov := m.allocateInstr() + mov.asMove32(rd, rn.reg()) + m.insert(mov) + case ssa.OpcodeFneg: + m.lowerFpuUniOp(fpuUniOpNeg, instr.Arg(), instr.Return()) + case ssa.OpcodeSqrt: + m.lowerFpuUniOp(fpuUniOpSqrt, instr.Arg(), instr.Return()) + case ssa.OpcodeCeil: + m.lowerFpuUniOp(fpuUniOpRoundPlus, instr.Arg(), instr.Return()) + case ssa.OpcodeFloor: + m.lowerFpuUniOp(fpuUniOpRoundMinus, instr.Arg(), instr.Return()) + case ssa.OpcodeTrunc: + m.lowerFpuUniOp(fpuUniOpRoundZero, instr.Arg(), instr.Return()) + case ssa.OpcodeNearest: + m.lowerFpuUniOp(fpuUniOpRoundNearest, instr.Arg(), instr.Return()) + case ssa.OpcodeFabs: + m.lowerFpuUniOp(fpuUniOpAbs, instr.Arg(), instr.Return()) + case ssa.OpcodeBitcast: + m.lowerBitcast(instr) + case ssa.OpcodeFcopysign: + x, y := instr.Arg2() + m.lowerFcopysign(x, y, instr.Return()) + case ssa.OpcodeSdiv, ssa.OpcodeUdiv: + x, y, ctx := instr.Arg3() + ctxVReg := m.compiler.VRegOf(ctx) + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rm := m.getOperand_NR(m.compiler.ValueDefinition(y), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + m.lowerIDiv(ctxVReg, rd, rn, rm, x.Type() == ssa.TypeI64, op == ssa.OpcodeSdiv) + case ssa.OpcodeSrem, ssa.OpcodeUrem: + x, y, ctx := instr.Arg3() + ctxVReg := m.compiler.VRegOf(ctx) + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rm := m.getOperand_NR(m.compiler.ValueDefinition(y), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + m.lowerIRem(ctxVReg, rd, rn, rm, x.Type() == ssa.TypeI64, op == ssa.OpcodeSrem) + case ssa.OpcodeVconst: + result := m.compiler.VRegOf(instr.Return()) + lo, hi := instr.VconstData() + v := m.allocateInstr() + v.asLoadFpuConst128(result, lo, hi) + m.insert(v) + case ssa.OpcodeVbnot: + x := instr.Arg() + ins := m.allocateInstr() + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + ins.asVecMisc(vecOpNot, rd, rn, vecArrangement16B) + m.insert(ins) + case ssa.OpcodeVbxor: + x, y := instr.Arg2() + m.lowerVecRRR(vecOpEOR, x, y, instr.Return(), vecArrangement16B) + case ssa.OpcodeVbor: + x, y := instr.Arg2() + m.lowerVecRRR(vecOpOrr, x, y, instr.Return(), vecArrangement16B) + case ssa.OpcodeVband: + x, y := instr.Arg2() + m.lowerVecRRR(vecOpAnd, x, y, instr.Return(), vecArrangement16B) + case ssa.OpcodeVbandnot: + x, y := instr.Arg2() + m.lowerVecRRR(vecOpBic, x, y, instr.Return(), vecArrangement16B) + case ssa.OpcodeVbitselect: + c, x, y := instr.SelectData() + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rm := m.getOperand_NR(m.compiler.ValueDefinition(y), extModeNone) + creg := m.getOperand_NR(m.compiler.ValueDefinition(c), extModeNone) + tmp := operandNR(m.compiler.AllocateVReg(ssa.TypeV128)) + + // creg is overwritten by BSL, so we need to move it to the result register before the instruction + // in case when it is used somewhere else. + mov := m.allocateInstr() + mov.asFpuMov128(tmp.nr(), creg.nr()) + m.insert(mov) + + ins := m.allocateInstr() + ins.asVecRRRRewrite(vecOpBsl, tmp, rn, rm, vecArrangement16B) + m.insert(ins) + + mov2 := m.allocateInstr() + rd := m.compiler.VRegOf(instr.Return()) + mov2.asFpuMov128(rd, tmp.nr()) + m.insert(mov2) + case ssa.OpcodeVanyTrue, ssa.OpcodeVallTrue: + x, lane := instr.ArgWithLane() + var arr vecArrangement + if op == ssa.OpcodeVallTrue { + arr = ssaLaneToArrangement(lane) + } + rm := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + m.lowerVcheckTrue(op, rm, rd, arr) + case ssa.OpcodeVhighBits: + x, lane := instr.ArgWithLane() + rm := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + arr := ssaLaneToArrangement(lane) + m.lowerVhighBits(rm, rd, arr) + case ssa.OpcodeVIadd: + x, y, lane := instr.Arg2WithLane() + arr := ssaLaneToArrangement(lane) + m.lowerVecRRR(vecOpAdd, x, y, instr.Return(), arr) + case ssa.OpcodeIaddPairwise: + x, y, lane := instr.Arg2WithLane() + arr := ssaLaneToArrangement(lane) + m.lowerVecRRR(vecOpAddp, x, y, instr.Return(), arr) + case ssa.OpcodeVSaddSat: + x, y, lane := instr.Arg2WithLane() + arr := ssaLaneToArrangement(lane) + m.lowerVecRRR(vecOpSqadd, x, y, instr.Return(), arr) + case ssa.OpcodeVUaddSat: + x, y, lane := instr.Arg2WithLane() + arr := ssaLaneToArrangement(lane) + m.lowerVecRRR(vecOpUqadd, x, y, instr.Return(), arr) + case ssa.OpcodeVIsub: + x, y, lane := instr.Arg2WithLane() + arr := ssaLaneToArrangement(lane) + m.lowerVecRRR(vecOpSub, x, y, instr.Return(), arr) + case ssa.OpcodeVSsubSat: + x, y, lane := instr.Arg2WithLane() + arr := ssaLaneToArrangement(lane) + m.lowerVecRRR(vecOpSqsub, x, y, instr.Return(), arr) + case ssa.OpcodeVUsubSat: + x, y, lane := instr.Arg2WithLane() + arr := ssaLaneToArrangement(lane) + m.lowerVecRRR(vecOpUqsub, x, y, instr.Return(), arr) + case ssa.OpcodeVImin: + x, y, lane := instr.Arg2WithLane() + arr := ssaLaneToArrangement(lane) + m.lowerVecRRR(vecOpSmin, x, y, instr.Return(), arr) + case ssa.OpcodeVUmin: + x, y, lane := instr.Arg2WithLane() + arr := ssaLaneToArrangement(lane) + m.lowerVecRRR(vecOpUmin, x, y, instr.Return(), arr) + case ssa.OpcodeVImax: + x, y, lane := instr.Arg2WithLane() + arr := ssaLaneToArrangement(lane) + m.lowerVecRRR(vecOpSmax, x, y, instr.Return(), arr) + case ssa.OpcodeVUmax: + x, y, lane := instr.Arg2WithLane() + arr := ssaLaneToArrangement(lane) + m.lowerVecRRR(vecOpUmax, x, y, instr.Return(), arr) + case ssa.OpcodeVAvgRound: + x, y, lane := instr.Arg2WithLane() + arr := ssaLaneToArrangement(lane) + m.lowerVecRRR(vecOpUrhadd, x, y, instr.Return(), arr) + case ssa.OpcodeVImul: + x, y, lane := instr.Arg2WithLane() + arr := ssaLaneToArrangement(lane) + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rm := m.getOperand_NR(m.compiler.ValueDefinition(y), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + m.lowerVIMul(rd, rn, rm, arr) + case ssa.OpcodeVIabs: + m.lowerVecMisc(vecOpAbs, instr) + case ssa.OpcodeVIneg: + m.lowerVecMisc(vecOpNeg, instr) + case ssa.OpcodeVIpopcnt: + m.lowerVecMisc(vecOpCnt, instr) + case ssa.OpcodeVIshl, + ssa.OpcodeVSshr, ssa.OpcodeVUshr: + x, y, lane := instr.Arg2WithLane() + arr := ssaLaneToArrangement(lane) + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rm := m.getOperand_NR(m.compiler.ValueDefinition(y), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + m.lowerVShift(op, rd, rn, rm, arr) + case ssa.OpcodeVSqrt: + m.lowerVecMisc(vecOpFsqrt, instr) + case ssa.OpcodeVFabs: + m.lowerVecMisc(vecOpFabs, instr) + case ssa.OpcodeVFneg: + m.lowerVecMisc(vecOpFneg, instr) + case ssa.OpcodeVFmin: + x, y, lane := instr.Arg2WithLane() + arr := ssaLaneToArrangement(lane) + m.lowerVecRRR(vecOpFmin, x, y, instr.Return(), arr) + case ssa.OpcodeVFmax: + x, y, lane := instr.Arg2WithLane() + arr := ssaLaneToArrangement(lane) + m.lowerVecRRR(vecOpFmax, x, y, instr.Return(), arr) + case ssa.OpcodeVFadd: + x, y, lane := instr.Arg2WithLane() + arr := ssaLaneToArrangement(lane) + m.lowerVecRRR(vecOpFadd, x, y, instr.Return(), arr) + case ssa.OpcodeVFsub: + x, y, lane := instr.Arg2WithLane() + arr := ssaLaneToArrangement(lane) + m.lowerVecRRR(vecOpFsub, x, y, instr.Return(), arr) + case ssa.OpcodeVFmul: + x, y, lane := instr.Arg2WithLane() + arr := ssaLaneToArrangement(lane) + m.lowerVecRRR(vecOpFmul, x, y, instr.Return(), arr) + case ssa.OpcodeSqmulRoundSat: + x, y, lane := instr.Arg2WithLane() + arr := ssaLaneToArrangement(lane) + m.lowerVecRRR(vecOpSqrdmulh, x, y, instr.Return(), arr) + case ssa.OpcodeVFdiv: + x, y, lane := instr.Arg2WithLane() + arr := ssaLaneToArrangement(lane) + m.lowerVecRRR(vecOpFdiv, x, y, instr.Return(), arr) + case ssa.OpcodeVFcvtToSintSat, ssa.OpcodeVFcvtToUintSat: + x, lane := instr.ArgWithLane() + arr := ssaLaneToArrangement(lane) + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + m.lowerVfpuToInt(rd, rn, arr, op == ssa.OpcodeVFcvtToSintSat) + case ssa.OpcodeVFcvtFromSint, ssa.OpcodeVFcvtFromUint: + x, lane := instr.ArgWithLane() + arr := ssaLaneToArrangement(lane) + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + m.lowerVfpuFromInt(rd, rn, arr, op == ssa.OpcodeVFcvtFromSint) + case ssa.OpcodeSwidenLow, ssa.OpcodeUwidenLow: + x, lane := instr.ArgWithLane() + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + + var arr vecArrangement + switch lane { + case ssa.VecLaneI8x16: + arr = vecArrangement8B + case ssa.VecLaneI16x8: + arr = vecArrangement4H + case ssa.VecLaneI32x4: + arr = vecArrangement2S + } + + shll := m.allocateInstr() + if signed := op == ssa.OpcodeSwidenLow; signed { + shll.asVecShiftImm(vecOpSshll, rd, rn, operandShiftImm(0), arr) + } else { + shll.asVecShiftImm(vecOpUshll, rd, rn, operandShiftImm(0), arr) + } + m.insert(shll) + case ssa.OpcodeSwidenHigh, ssa.OpcodeUwidenHigh: + x, lane := instr.ArgWithLane() + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + + arr := ssaLaneToArrangement(lane) + + shll := m.allocateInstr() + if signed := op == ssa.OpcodeSwidenHigh; signed { + shll.asVecShiftImm(vecOpSshll, rd, rn, operandShiftImm(0), arr) + } else { + shll.asVecShiftImm(vecOpUshll, rd, rn, operandShiftImm(0), arr) + } + m.insert(shll) + + case ssa.OpcodeSnarrow, ssa.OpcodeUnarrow: + x, y, lane := instr.Arg2WithLane() + var arr, arr2 vecArrangement + switch lane { + case ssa.VecLaneI16x8: // I16x8 + arr = vecArrangement8B + arr2 = vecArrangement16B // Implies sqxtn2. + case ssa.VecLaneI32x4: + arr = vecArrangement4H + arr2 = vecArrangement8H // Implies sqxtn2. + default: + panic("unsupported lane " + lane.String()) + } + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rm := m.getOperand_NR(m.compiler.ValueDefinition(y), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + + tmp := operandNR(m.compiler.AllocateVReg(ssa.TypeV128)) + + loQxtn := m.allocateInstr() + hiQxtn := m.allocateInstr() + if signed := op == ssa.OpcodeSnarrow; signed { + // Narrow lanes on rn and write them into lower-half of rd. + loQxtn.asVecMisc(vecOpSqxtn, tmp, rn, arr) // low + // Narrow lanes on rm and write them into higher-half of rd. + hiQxtn.asVecMisc(vecOpSqxtn, tmp, rm, arr2) // high (sqxtn2) + } else { + // Narrow lanes on rn and write them into lower-half of rd. + loQxtn.asVecMisc(vecOpSqxtun, tmp, rn, arr) // low + // Narrow lanes on rm and write them into higher-half of rd. + hiQxtn.asVecMisc(vecOpSqxtun, tmp, rm, arr2) // high (sqxtn2) + } + m.insert(loQxtn) + m.insert(hiQxtn) + + mov := m.allocateInstr() + mov.asFpuMov128(rd.nr(), tmp.nr()) + m.insert(mov) + case ssa.OpcodeFvpromoteLow: + x, lane := instr.ArgWithLane() + if lane != ssa.VecLaneF32x4 { + panic("unsupported lane type " + lane.String()) + } + ins := m.allocateInstr() + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + ins.asVecMisc(vecOpFcvtl, rd, rn, vecArrangement2S) + m.insert(ins) + case ssa.OpcodeFvdemote: + x, lane := instr.ArgWithLane() + if lane != ssa.VecLaneF64x2 { + panic("unsupported lane type " + lane.String()) + } + ins := m.allocateInstr() + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + ins.asVecMisc(vecOpFcvtn, rd, rn, vecArrangement2S) + m.insert(ins) + case ssa.OpcodeExtractlane: + x, index, signed, lane := instr.ExtractlaneData() + + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + + mov := m.allocateInstr() + switch lane { + case ssa.VecLaneI8x16: + mov.asMovFromVec(rd, rn, vecArrangementB, vecIndex(index), signed) + case ssa.VecLaneI16x8: + mov.asMovFromVec(rd, rn, vecArrangementH, vecIndex(index), signed) + case ssa.VecLaneI32x4: + mov.asMovFromVec(rd, rn, vecArrangementS, vecIndex(index), signed) + case ssa.VecLaneI64x2: + mov.asMovFromVec(rd, rn, vecArrangementD, vecIndex(index), signed) + case ssa.VecLaneF32x4: + mov.asVecMovElement(rd, rn, vecArrangementS, vecIndex(0), vecIndex(index)) + case ssa.VecLaneF64x2: + mov.asVecMovElement(rd, rn, vecArrangementD, vecIndex(0), vecIndex(index)) + default: + panic("unsupported lane: " + lane.String()) + } + + m.insert(mov) + + case ssa.OpcodeInsertlane: + x, y, index, lane := instr.InsertlaneData() + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rm := m.getOperand_NR(m.compiler.ValueDefinition(y), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + tmpReg := operandNR(m.compiler.AllocateVReg(ssa.TypeV128)) + + // Initially mov rn to tmp. + mov1 := m.allocateInstr() + mov1.asFpuMov128(tmpReg.nr(), rn.nr()) + m.insert(mov1) + + // movToVec and vecMovElement do not clear the remaining bits to zero, + // thus, we can mov rm in-place to tmp. + mov2 := m.allocateInstr() + switch lane { + case ssa.VecLaneI8x16: + mov2.asMovToVec(tmpReg, rm, vecArrangementB, vecIndex(index)) + case ssa.VecLaneI16x8: + mov2.asMovToVec(tmpReg, rm, vecArrangementH, vecIndex(index)) + case ssa.VecLaneI32x4: + mov2.asMovToVec(tmpReg, rm, vecArrangementS, vecIndex(index)) + case ssa.VecLaneI64x2: + mov2.asMovToVec(tmpReg, rm, vecArrangementD, vecIndex(index)) + case ssa.VecLaneF32x4: + mov2.asVecMovElement(tmpReg, rm, vecArrangementS, vecIndex(index), vecIndex(0)) + case ssa.VecLaneF64x2: + mov2.asVecMovElement(tmpReg, rm, vecArrangementD, vecIndex(index), vecIndex(0)) + } + m.insert(mov2) + + // Finally mov tmp to rd. + mov3 := m.allocateInstr() + mov3.asFpuMov128(rd.nr(), tmpReg.nr()) + m.insert(mov3) + + case ssa.OpcodeSwizzle: + x, y, lane := instr.Arg2WithLane() + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rm := m.getOperand_NR(m.compiler.ValueDefinition(y), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + + arr := ssaLaneToArrangement(lane) + + // tbl ., { . }, . + tbl1 := m.allocateInstr() + tbl1.asVecTbl(1, rd, rn, rm, arr) + m.insert(tbl1) + + case ssa.OpcodeShuffle: + x, y, lane1, lane2 := instr.ShuffleData() + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rm := m.getOperand_NR(m.compiler.ValueDefinition(y), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + + m.lowerShuffle(rd, rn, rm, lane1, lane2) + + case ssa.OpcodeSplat: + x, lane := instr.ArgWithLane() + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + + dup := m.allocateInstr() + switch lane { + case ssa.VecLaneI8x16: + dup.asVecDup(rd, rn, vecArrangement16B) + case ssa.VecLaneI16x8: + dup.asVecDup(rd, rn, vecArrangement8H) + case ssa.VecLaneI32x4: + dup.asVecDup(rd, rn, vecArrangement4S) + case ssa.VecLaneI64x2: + dup.asVecDup(rd, rn, vecArrangement2D) + case ssa.VecLaneF32x4: + dup.asVecDupElement(rd, rn, vecArrangementS, vecIndex(0)) + case ssa.VecLaneF64x2: + dup.asVecDupElement(rd, rn, vecArrangementD, vecIndex(0)) + } + m.insert(dup) + + case ssa.OpcodeLoadSplat: + ptr, offset, lane := instr.LoadSplatData() + m.lowerLoadSplat(ptr, offset, lane, instr.Return()) + default: + panic("TODO: lowering " + op.String()) + } + m.FlushPendingInstructions() +} + +func (m *machine) lowerShuffle(rd, rn, rm operand, lane1, lane2 uint64) { + // `tbl2` requires 2 consecutive registers, so we arbitrarily pick v29, v30. + vReg, wReg := v29VReg, v30VReg + + // Initialize v29, v30 to rn, rm. + movv := m.allocateInstr() + movv.asFpuMov128(vReg, rn.nr()) + m.insert(movv) + + movw := m.allocateInstr() + movw.asFpuMov128(wReg, rm.nr()) + m.insert(movw) + + // `lane1`, `lane2` are already encoded as two u64s with the right layout: + // lane1 := lane[7]<<56 | ... | lane[1]<<8 | lane[0] + // lane2 := lane[15]<<56 | ... | lane[9]<<8 | lane[8] + // Thus, we can use loadFpuConst128. + tmp := operandNR(m.compiler.AllocateVReg(ssa.TypeV128)) + lfc := m.allocateInstr() + lfc.asLoadFpuConst128(tmp.nr(), lane1, lane2) + m.insert(lfc) + + // tbl .16b, { .16B, .16b }, .16b + tbl2 := m.allocateInstr() + tbl2.asVecTbl(2, rd, operandNR(vReg), tmp, vecArrangement16B) + m.insert(tbl2) +} + +func (m *machine) lowerVShift(op ssa.Opcode, rd, rn, rm operand, arr vecArrangement) { + var modulo byte + switch arr { + case vecArrangement16B: + modulo = 0x7 // Modulo 8. + case vecArrangement8H: + modulo = 0xf // Modulo 16. + case vecArrangement4S: + modulo = 0x1f // Modulo 32. + case vecArrangement2D: + modulo = 0x3f // Modulo 64. + default: + panic("unsupported arrangment " + arr.String()) + } + + rtmp := operandNR(m.compiler.AllocateVReg(ssa.TypeI64)) + vtmp := operandNR(m.compiler.AllocateVReg(ssa.TypeV128)) + + and := m.allocateInstr() + and.asALUBitmaskImm(aluOpAnd, rtmp.nr(), rm.nr(), uint64(modulo), true) + m.insert(and) + + if op != ssa.OpcodeVIshl { + // Negate the amount to make this as right shift. + neg := m.allocateInstr() + neg.asALU(aluOpSub, rtmp, operandNR(xzrVReg), rtmp, true) + m.insert(neg) + } + + // Copy the shift amount into a vector register as sshl/ushl requires it to be there. + dup := m.allocateInstr() + dup.asVecDup(vtmp, rtmp, arr) + m.insert(dup) + + if op == ssa.OpcodeVIshl || op == ssa.OpcodeVSshr { + sshl := m.allocateInstr() + sshl.asVecRRR(vecOpSshl, rd, rn, vtmp, arr) + m.insert(sshl) + } else { + ushl := m.allocateInstr() + ushl.asVecRRR(vecOpUshl, rd, rn, vtmp, arr) + m.insert(ushl) + } +} + +func (m *machine) lowerVcheckTrue(op ssa.Opcode, rm, rd operand, arr vecArrangement) { + tmp := operandNR(m.compiler.AllocateVReg(ssa.TypeV128)) + + // Special case VallTrue for i64x2. + if op == ssa.OpcodeVallTrue && arr == vecArrangement2D { + // cmeq v3?.2d, v2?.2d, #0 + // addp v3?.2d, v3?.2d, v3?.2d + // fcmp v3?, v3? + // cset dst, eq + + ins := m.allocateInstr() + ins.asVecMisc(vecOpCmeq0, tmp, rm, vecArrangement2D) + m.insert(ins) + + addp := m.allocateInstr() + addp.asVecRRR(vecOpAddp, tmp, tmp, tmp, vecArrangement2D) + m.insert(addp) + + fcmp := m.allocateInstr() + fcmp.asFpuCmp(tmp, tmp, true) + m.insert(fcmp) + + cset := m.allocateInstr() + cset.asCSet(rd.nr(), false, eq) + m.insert(cset) + + return + } + + // Create a scalar value with umaxp or uminv, then compare it against zero. + ins := m.allocateInstr() + if op == ssa.OpcodeVanyTrue { + // umaxp v4?.16b, v2?.16b, v2?.16b + ins.asVecRRR(vecOpUmaxp, tmp, rm, rm, vecArrangement16B) + } else { + // uminv d4?, v2?.4s + ins.asVecLanes(vecOpUminv, tmp, rm, arr) + } + m.insert(ins) + + // mov x3?, v4?.d[0] + // ccmp x3?, #0x0, #0x0, al + // cset x3?, ne + // mov x0, x3? + + movv := m.allocateInstr() + movv.asMovFromVec(rd, tmp, vecArrangementD, vecIndex(0), false) + m.insert(movv) + + fc := m.allocateInstr() + fc.asCCmpImm(rd, uint64(0), al, 0, true) + m.insert(fc) + + cset := m.allocateInstr() + cset.asCSet(rd.nr(), false, ne) + m.insert(cset) +} + +func (m *machine) lowerVhighBits(rm, rd operand, arr vecArrangement) { + r0 := operandNR(m.compiler.AllocateVReg(ssa.TypeI64)) + v0 := operandNR(m.compiler.AllocateVReg(ssa.TypeV128)) + v1 := operandNR(m.compiler.AllocateVReg(ssa.TypeV128)) + + switch arr { + case vecArrangement16B: + // sshr v6?.16b, v2?.16b, #7 + // movz x4?, #0x201, lsl 0 + // movk x4?, #0x804, lsl 16 + // movk x4?, #0x2010, lsl 32 + // movk x4?, #0x8040, lsl 48 + // dup v5?.2d, x4? + // and v6?.16b, v6?.16b, v5?.16b + // ext v5?.16b, v6?.16b, v6?.16b, #8 + // zip1 v5?.16b, v6?.16b, v5?.16b + // addv s5?, v5?.8h + // umov s3?, v5?.h[0] + + // Right arithmetic shift on the original vector and store the result into v1. So we have: + // v1[i] = 0xff if vi<0, 0 otherwise. + sshr := m.allocateInstr() + sshr.asVecShiftImm(vecOpSshr, v1, rm, operandShiftImm(7), vecArrangement16B) + m.insert(sshr) + + // Load the bit mask into r0. + m.insertMOVZ(r0.nr(), 0x0201, 0, true) + m.insertMOVK(r0.nr(), 0x0804, 1, true) + m.insertMOVK(r0.nr(), 0x2010, 2, true) + m.insertMOVK(r0.nr(), 0x8040, 3, true) + + // dup r0 to v0. + dup := m.allocateInstr() + dup.asVecDup(v0, r0, vecArrangement2D) + m.insert(dup) + + // Lane-wise logical AND with the bit mask, meaning that we have + // v[i] = (1 << i) if vi<0, 0 otherwise. + // + // Below, we use the following notation: + // wi := (1 << i) if vi<0, 0 otherwise. + and := m.allocateInstr() + and.asVecRRR(vecOpAnd, v1, v1, v0, vecArrangement16B) + m.insert(and) + + // Swap the lower and higher 8 byte elements, and write it into v0, meaning that we have + // v0[i] = w(i+8) if i < 8, w(i-8) otherwise. + ext := m.allocateInstr() + ext.asVecExtract(v0, v1, v1, vecArrangement16B, uint32(8)) + m.insert(ext) + + // v = [w0, w8, ..., w7, w15] + zip1 := m.allocateInstr() + zip1.asVecPermute(vecOpZip1, v0, v1, v0, vecArrangement16B) + m.insert(zip1) + + // v.h[0] = w0 + ... + w15 + addv := m.allocateInstr() + addv.asVecLanes(vecOpAddv, v0, v0, vecArrangement8H) + m.insert(addv) + + // Extract the v.h[0] as the result. + movfv := m.allocateInstr() + movfv.asMovFromVec(rd, v0, vecArrangementH, vecIndex(0), false) + m.insert(movfv) + case vecArrangement8H: + // sshr v6?.8h, v2?.8h, #15 + // movz x4?, #0x1, lsl 0 + // movk x4?, #0x2, lsl 16 + // movk x4?, #0x4, lsl 32 + // movk x4?, #0x8, lsl 48 + // dup v5?.2d, x4? + // lsl x4?, x4?, 0x4 + // ins v5?.d[1], x4? + // and v5?.16b, v6?.16b, v5?.16b + // addv s5?, v5?.8h + // umov s3?, v5?.h[0] + + // Right arithmetic shift on the original vector and store the result into v1. So we have: + // v[i] = 0xffff if vi<0, 0 otherwise. + sshr := m.allocateInstr() + sshr.asVecShiftImm(vecOpSshr, v1, rm, operandShiftImm(15), vecArrangement8H) + m.insert(sshr) + + // Load the bit mask into r0. + m.lowerConstantI64(r0.nr(), 0x0008000400020001) + + // dup r0 to vector v0. + dup := m.allocateInstr() + dup.asVecDup(v0, r0, vecArrangement2D) + m.insert(dup) + + lsl := m.allocateInstr() + lsl.asALUShift(aluOpLsl, r0, r0, operandShiftImm(4), true) + m.insert(lsl) + + movv := m.allocateInstr() + movv.asMovToVec(v0, r0, vecArrangementD, vecIndex(1)) + m.insert(movv) + + // Lane-wise logical AND with the bitmask, meaning that we have + // v[i] = (1 << i) if vi<0, 0 otherwise for i=0..3 + // = (1 << (i+4)) if vi<0, 0 otherwise for i=3..7 + and := m.allocateInstr() + and.asVecRRR(vecOpAnd, v0, v1, v0, vecArrangement16B) + m.insert(and) + + addv := m.allocateInstr() + addv.asVecLanes(vecOpAddv, v0, v0, vecArrangement8H) + m.insert(addv) + + movfv := m.allocateInstr() + movfv.asMovFromVec(rd, v0, vecArrangementH, vecIndex(0), false) + m.insert(movfv) + case vecArrangement4S: + // sshr v6?.8h, v2?.8h, #15 + // movz x4?, #0x1, lsl 0 + // movk x4?, #0x2, lsl 16 + // movk x4?, #0x4, lsl 32 + // movk x4?, #0x8, lsl 48 + // dup v5?.2d, x4? + // lsl x4?, x4?, 0x4 + // ins v5?.d[1], x4? + // and v5?.16b, v6?.16b, v5?.16b + // addv s5?, v5?.8h + // umov s3?, v5?.h[0] + + // Right arithmetic shift on the original vector and store the result into v1. So we have: + // v[i] = 0xffffffff if vi<0, 0 otherwise. + sshr := m.allocateInstr() + sshr.asVecShiftImm(vecOpSshr, v1, rm, operandShiftImm(31), vecArrangement4S) + m.insert(sshr) + + // Load the bit mask into r0. + m.lowerConstantI64(r0.nr(), 0x0000000200000001) + + // dup r0 to vector v0. + dup := m.allocateInstr() + dup.asVecDup(v0, r0, vecArrangement2D) + m.insert(dup) + + lsl := m.allocateInstr() + lsl.asALUShift(aluOpLsl, r0, r0, operandShiftImm(2), true) + m.insert(lsl) + + movv := m.allocateInstr() + movv.asMovToVec(v0, r0, vecArrangementD, vecIndex(1)) + m.insert(movv) + + // Lane-wise logical AND with the bitmask, meaning that we have + // v[i] = (1 << i) if vi<0, 0 otherwise for i in [0, 1] + // = (1 << (i+4)) if vi<0, 0 otherwise for i in [2, 3] + and := m.allocateInstr() + and.asVecRRR(vecOpAnd, v0, v1, v0, vecArrangement16B) + m.insert(and) + + addv := m.allocateInstr() + addv.asVecLanes(vecOpAddv, v0, v0, vecArrangement4S) + m.insert(addv) + + movfv := m.allocateInstr() + movfv.asMovFromVec(rd, v0, vecArrangementS, vecIndex(0), false) + m.insert(movfv) + case vecArrangement2D: + // mov d3?, v2?.d[0] + // mov x4?, v2?.d[1] + // lsr x4?, x4?, 0x3f + // lsr d3?, d3?, 0x3f + // add s3?, s3?, w4?, lsl #1 + + // Move the lower 64-bit int into result. + movv0 := m.allocateInstr() + movv0.asMovFromVec(rd, rm, vecArrangementD, vecIndex(0), false) + m.insert(movv0) + + // Move the higher 64-bit int into r0. + movv1 := m.allocateInstr() + movv1.asMovFromVec(r0, rm, vecArrangementD, vecIndex(1), false) + m.insert(movv1) + + // Move the sign bit into the least significant bit. + lsr1 := m.allocateInstr() + lsr1.asALUShift(aluOpLsr, r0, r0, operandShiftImm(63), true) + m.insert(lsr1) + + lsr2 := m.allocateInstr() + lsr2.asALUShift(aluOpLsr, rd, rd, operandShiftImm(63), true) + m.insert(lsr2) + + // rd = (r0<<1) | rd + lsl := m.allocateInstr() + lsl.asALU(aluOpAdd, rd, rd, operandSR(r0.nr(), 1, shiftOpLSL), false) + m.insert(lsl) + default: + panic("Unsupported " + arr.String()) + } +} + +func (m *machine) lowerVecMisc(op vecOp, instr *ssa.Instruction) { + x, lane := instr.ArgWithLane() + arr := ssaLaneToArrangement(lane) + ins := m.allocateInstr() + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + ins.asVecMisc(op, rd, rn, arr) + m.insert(ins) +} + +func (m *machine) lowerVecRRR(op vecOp, x, y, ret ssa.Value, arr vecArrangement) { + ins := m.allocateInstr() + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rm := m.getOperand_NR(m.compiler.ValueDefinition(y), extModeNone) + rd := operandNR(m.compiler.VRegOf(ret)) + ins.asVecRRR(op, rd, rn, rm, arr) + m.insert(ins) +} + +func (m *machine) lowerVIMul(rd, rn, rm operand, arr vecArrangement) { + if arr != vecArrangement2D { + mul := m.allocateInstr() + mul.asVecRRR(vecOpMul, rd, rn, rm, arr) + m.insert(mul) + } else { + tmp1 := operandNR(m.compiler.AllocateVReg(ssa.TypeV128)) + tmp2 := operandNR(m.compiler.AllocateVReg(ssa.TypeV128)) + tmp3 := operandNR(m.compiler.AllocateVReg(ssa.TypeV128)) + + tmpRes := operandNR(m.compiler.AllocateVReg(ssa.TypeV128)) + + // Following the algorithm in https://chromium-review.googlesource.com/c/v8/v8/+/1781696 + rev64 := m.allocateInstr() + rev64.asVecMisc(vecOpRev64, tmp2, rm, vecArrangement4S) + m.insert(rev64) + + mul := m.allocateInstr() + mul.asVecRRR(vecOpMul, tmp2, tmp2, rn, vecArrangement4S) + m.insert(mul) + + xtn1 := m.allocateInstr() + xtn1.asVecMisc(vecOpXtn, tmp1, rn, vecArrangement2S) + m.insert(xtn1) + + addp := m.allocateInstr() + addp.asVecRRR(vecOpAddp, tmp2, tmp2, tmp2, vecArrangement4S) + m.insert(addp) + + xtn2 := m.allocateInstr() + xtn2.asVecMisc(vecOpXtn, tmp3, rm, vecArrangement2S) + m.insert(xtn2) + + // Note: do not write the result directly into result yet. This is the same reason as in bsl. + // In short, in UMLAL instruction, the result register is also one of the source register, and + // the value on the result register is significant. + shll := m.allocateInstr() + shll.asVecMisc(vecOpShll, tmpRes, tmp2, vecArrangement2S) + m.insert(shll) + + umlal := m.allocateInstr() + umlal.asVecRRRRewrite(vecOpUmlal, tmpRes, tmp3, tmp1, vecArrangement2S) + m.insert(umlal) + + mov := m.allocateInstr() + mov.asFpuMov128(rd.nr(), tmpRes.nr()) + m.insert(mov) + } +} + +func (m *machine) lowerVMinMaxPseudo(instr *ssa.Instruction, max bool) { + x, y, lane := instr.Arg2WithLane() + arr := ssaLaneToArrangement(lane) + + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rm := m.getOperand_NR(m.compiler.ValueDefinition(y), extModeNone) + + // Note: this usage of tmp is important. + // BSL modifies the destination register, so we need to use a temporary register so that + // the actual definition of the destination register happens *after* the BSL instruction. + // That way, we can force the spill instruction to be inserted after the BSL instruction. + tmp := operandNR(m.compiler.AllocateVReg(ssa.TypeV128)) + + fcmgt := m.allocateInstr() + if max { + fcmgt.asVecRRR(vecOpFcmgt, tmp, rm, rn, arr) + } else { + // If min, swap the args. + fcmgt.asVecRRR(vecOpFcmgt, tmp, rn, rm, arr) + } + m.insert(fcmgt) + + bsl := m.allocateInstr() + bsl.asVecRRRRewrite(vecOpBsl, tmp, rm, rn, vecArrangement16B) + m.insert(bsl) + + res := operandNR(m.compiler.VRegOf(instr.Return())) + mov2 := m.allocateInstr() + mov2.asFpuMov128(res.nr(), tmp.nr()) + m.insert(mov2) +} + +func (m *machine) lowerIRem(execCtxVReg regalloc.VReg, rd, rn, rm operand, _64bit, signed bool) { + div := m.allocateInstr() + + if signed { + div.asALU(aluOpSDiv, rd, rn, rm, _64bit) + } else { + div.asALU(aluOpUDiv, rd, rn, rm, _64bit) + } + m.insert(div) + + // Check if rm is zero: + m.exitIfNot(execCtxVReg, registerAsRegNotZeroCond(rm.nr()), _64bit, wazevoapi.ExitCodeIntegerDivisionByZero) + + // rd = rn-rd*rm by MSUB instruction. + msub := m.allocateInstr() + msub.asALURRRR(aluOpMSub, rd, rd, rm, rn, _64bit) + m.insert(msub) +} + +func (m *machine) lowerIDiv(execCtxVReg regalloc.VReg, rd, rn, rm operand, _64bit, signed bool) { + div := m.allocateInstr() + + if signed { + div.asALU(aluOpSDiv, rd, rn, rm, _64bit) + } else { + div.asALU(aluOpUDiv, rd, rn, rm, _64bit) + } + m.insert(div) + + // Check if rm is zero: + m.exitIfNot(execCtxVReg, registerAsRegNotZeroCond(rm.nr()), _64bit, wazevoapi.ExitCodeIntegerDivisionByZero) + + if signed { + // We need to check the signed overflow which happens iff "math.MinInt{32,64} / -1" + minusOneCheck := m.allocateInstr() + // Sets eq condition if rm == -1. + minusOneCheck.asALU(aluOpAddS, operandNR(xzrVReg), rm, operandImm12(1, 0), _64bit) + m.insert(minusOneCheck) + + ccmp := m.allocateInstr() + // If eq condition is set, sets the flag by the result based on "rn - 1", otherwise clears the flag. + ccmp.asCCmpImm(rn, 1, eq, 0, _64bit) + m.insert(ccmp) + + // Check the overflow flag. + m.exitIfNot(execCtxVReg, vs.invert().asCond(), false, wazevoapi.ExitCodeIntegerOverflow) + } +} + +// exitIfNot emits a conditional branch to exit if the condition is not met. +// If `c` (cond type) is a register, `cond64bit` must be chosen to indicate whether the register is 32-bit or 64-bit. +// Otherwise, `cond64bit` is ignored. +func (m *machine) exitIfNot(execCtxVReg regalloc.VReg, c cond, cond64bit bool, code wazevoapi.ExitCode) { + execCtxTmp := m.copyToTmp(execCtxVReg) + + cbr := m.allocateInstr() + m.insert(cbr) + m.lowerExitWithCode(execCtxTmp, code) + // Conditional branch target is after exit. + l := m.insertBrTargetLabel() + cbr.asCondBr(c, l, cond64bit) +} + +func (m *machine) lowerFcopysign(x, y, ret ssa.Value) { + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rm := m.getOperand_NR(m.compiler.ValueDefinition(y), extModeNone) + var tmpI, tmpF operand + _64 := x.Type() == ssa.TypeF64 + if _64 { + tmpF = operandNR(m.compiler.AllocateVReg(ssa.TypeF64)) + tmpI = operandNR(m.compiler.AllocateVReg(ssa.TypeI64)) + } else { + tmpF = operandNR(m.compiler.AllocateVReg(ssa.TypeF32)) + tmpI = operandNR(m.compiler.AllocateVReg(ssa.TypeI32)) + } + rd := m.compiler.VRegOf(ret) + m.lowerFcopysignImpl(operandNR(rd), rn, rm, tmpI, tmpF, _64) +} + +func (m *machine) lowerFcopysignImpl(rd, rn, rm, tmpI, tmpF operand, _64bit bool) { + // This is exactly the same code emitted by GCC for "__builtin_copysign": + // + // mov x0, -9223372036854775808 + // fmov d2, x0 + // vbit v0.8b, v1.8b, v2.8b + // + + setMSB := m.allocateInstr() + if _64bit { + m.lowerConstantI64(tmpI.nr(), math.MinInt64) + setMSB.asMovToVec(tmpF, tmpI, vecArrangementD, vecIndex(0)) + } else { + m.lowerConstantI32(tmpI.nr(), math.MinInt32) + setMSB.asMovToVec(tmpF, tmpI, vecArrangementS, vecIndex(0)) + } + m.insert(setMSB) + + tmpReg := operandNR(m.compiler.AllocateVReg(ssa.TypeF64)) + + mov := m.allocateInstr() + mov.asFpuMov64(tmpReg.nr(), rn.nr()) + m.insert(mov) + + vbit := m.allocateInstr() + vbit.asVecRRRRewrite(vecOpBit, tmpReg, rm, tmpF, vecArrangement8B) + m.insert(vbit) + + movDst := m.allocateInstr() + movDst.asFpuMov64(rd.nr(), tmpReg.nr()) + m.insert(movDst) +} + +func (m *machine) lowerBitcast(instr *ssa.Instruction) { + v, dstType := instr.BitcastData() + srcType := v.Type() + rn := m.getOperand_NR(m.compiler.ValueDefinition(v), extModeNone) + rd := operandNR(m.compiler.VRegOf(instr.Return())) + srcInt := srcType.IsInt() + dstInt := dstType.IsInt() + switch { + case srcInt && !dstInt: // Int to Float: + mov := m.allocateInstr() + var arr vecArrangement + if srcType.Bits() == 64 { + arr = vecArrangementD + } else { + arr = vecArrangementS + } + mov.asMovToVec(rd, rn, arr, vecIndex(0)) + m.insert(mov) + case !srcInt && dstInt: // Float to Int: + mov := m.allocateInstr() + var arr vecArrangement + if dstType.Bits() == 64 { + arr = vecArrangementD + } else { + arr = vecArrangementS + } + mov.asMovFromVec(rd, rn, arr, vecIndex(0), false) + m.insert(mov) + default: + panic("TODO?BUG?") + } +} + +func (m *machine) lowerFpuUniOp(op fpuUniOp, in, out ssa.Value) { + rn := m.getOperand_NR(m.compiler.ValueDefinition(in), extModeNone) + rd := operandNR(m.compiler.VRegOf(out)) + + neg := m.allocateInstr() + neg.asFpuRR(op, rd, rn, in.Type().Bits() == 64) + m.insert(neg) +} + +func (m *machine) lowerFpuToInt(rd, rn operand, ctx regalloc.VReg, signed, src64bit, dst64bit, nonTrapping bool) { + if !nonTrapping { + // First of all, we have to clear the FPU flags. + flagClear := m.allocateInstr() + flagClear.asMovToFPSR(xzrVReg) + m.insert(flagClear) + } + + // Then, do the conversion which doesn't trap inherently. + cvt := m.allocateInstr() + cvt.asFpuToInt(rd, rn, signed, src64bit, dst64bit) + m.insert(cvt) + + if !nonTrapping { + tmpReg := m.compiler.AllocateVReg(ssa.TypeI64) + + // After the conversion, check the FPU flags. + getFlag := m.allocateInstr() + getFlag.asMovFromFPSR(tmpReg) + m.insert(getFlag) + + execCtx := m.copyToTmp(ctx) + _rn := operandNR(m.copyToTmp(rn.nr())) + + // Check if the conversion was undefined by comparing the status with 1. + // See https://developer.arm.com/documentation/ddi0595/2020-12/AArch64-Registers/FPSR--Floating-point-Status-Register + alu := m.allocateInstr() + alu.asALU(aluOpSubS, operandNR(xzrVReg), operandNR(tmpReg), operandImm12(1, 0), true) + m.insert(alu) + + // If it is not undefined, we can return the result. + ok := m.allocateInstr() + m.insert(ok) + + // Otherwise, we have to choose the status depending on it is overflow or NaN conversion. + + // Comparing itself to check if it is a NaN. + fpuCmp := m.allocateInstr() + fpuCmp.asFpuCmp(_rn, _rn, src64bit) + m.insert(fpuCmp) + // If the VC flag is not set (== VS flag is set), it is a NaN. + m.exitIfNot(execCtx, vc.asCond(), false, wazevoapi.ExitCodeInvalidConversionToInteger) + // Otherwise, it is an overflow. + m.lowerExitWithCode(execCtx, wazevoapi.ExitCodeIntegerOverflow) + + // Conditional branch target is after exit. + l := m.insertBrTargetLabel() + ok.asCondBr(ne.asCond(), l, false /* ignored */) + } +} + +func (m *machine) lowerIntToFpu(rd, rn operand, signed, src64bit, dst64bit bool) { + cvt := m.allocateInstr() + cvt.asIntToFpu(rd, rn, signed, src64bit, dst64bit) + m.insert(cvt) +} + +func (m *machine) lowerFpuBinOp(si *ssa.Instruction) { + instr := m.allocateInstr() + var op fpuBinOp + switch si.Opcode() { + case ssa.OpcodeFadd: + op = fpuBinOpAdd + case ssa.OpcodeFsub: + op = fpuBinOpSub + case ssa.OpcodeFmul: + op = fpuBinOpMul + case ssa.OpcodeFdiv: + op = fpuBinOpDiv + case ssa.OpcodeFmax: + op = fpuBinOpMax + case ssa.OpcodeFmin: + op = fpuBinOpMin + } + x, y := si.Arg2() + xDef, yDef := m.compiler.ValueDefinition(x), m.compiler.ValueDefinition(y) + rn := m.getOperand_NR(xDef, extModeNone) + rm := m.getOperand_NR(yDef, extModeNone) + rd := operandNR(m.compiler.VRegOf(si.Return())) + instr.asFpuRRR(op, rd, rn, rm, x.Type().Bits() == 64) + m.insert(instr) +} + +func (m *machine) lowerSubOrAdd(si *ssa.Instruction, add bool) { + x, y := si.Arg2() + if !x.Type().IsInt() { + panic("BUG?") + } + + xDef, yDef := m.compiler.ValueDefinition(x), m.compiler.ValueDefinition(y) + rn := m.getOperand_NR(xDef, extModeNone) + rm, yNegated := m.getOperand_MaybeNegatedImm12_ER_SR_NR(yDef, extModeNone) + + var aop aluOp + switch { + case add && !yNegated: // rn+rm = x+y + aop = aluOpAdd + case add && yNegated: // rn-rm = x-(-y) = x+y + aop = aluOpSub + case !add && !yNegated: // rn-rm = x-y + aop = aluOpSub + case !add && yNegated: // rn+rm = x-(-y) = x-y + aop = aluOpAdd + } + rd := operandNR(m.compiler.VRegOf(si.Return())) + alu := m.allocateInstr() + alu.asALU(aop, rd, rn, rm, x.Type().Bits() == 64) + m.insert(alu) +} + +// InsertMove implements backend.Machine. +func (m *machine) InsertMove(dst, src regalloc.VReg, typ ssa.Type) { + instr := m.allocateInstr() + switch typ { + case ssa.TypeI32, ssa.TypeI64: + instr.asMove64(dst, src) + case ssa.TypeF32, ssa.TypeF64: + instr.asFpuMov64(dst, src) + case ssa.TypeV128: + instr.asFpuMov128(dst, src) + default: + panic("TODO") + } + m.insert(instr) +} + +func (m *machine) lowerIcmp(si *ssa.Instruction) { + x, y, c := si.IcmpData() + flag := condFlagFromSSAIntegerCmpCond(c) + + in64bit := x.Type().Bits() == 64 + var ext extMode + if in64bit { + if c.Signed() { + ext = extModeSignExtend64 + } else { + ext = extModeZeroExtend64 + } + } else { + if c.Signed() { + ext = extModeSignExtend32 + } else { + ext = extModeZeroExtend32 + } + } + + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), ext) + rm := m.getOperand_Imm12_ER_SR_NR(m.compiler.ValueDefinition(y), ext) + alu := m.allocateInstr() + alu.asALU(aluOpSubS, operandNR(xzrVReg), rn, rm, in64bit) + m.insert(alu) + + cset := m.allocateInstr() + cset.asCSet(m.compiler.VRegOf(si.Return()), false, flag) + m.insert(cset) +} + +func (m *machine) lowerVIcmp(si *ssa.Instruction) { + x, y, c, lane := si.VIcmpData() + flag := condFlagFromSSAIntegerCmpCond(c) + arr := ssaLaneToArrangement(lane) + + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rm := m.getOperand_NR(m.compiler.ValueDefinition(y), extModeNone) + rd := operandNR(m.compiler.VRegOf(si.Return())) + + switch flag { + case eq: + cmp := m.allocateInstr() + cmp.asVecRRR(vecOpCmeq, rd, rn, rm, arr) + m.insert(cmp) + case ne: + cmp := m.allocateInstr() + cmp.asVecRRR(vecOpCmeq, rd, rn, rm, arr) + m.insert(cmp) + not := m.allocateInstr() + not.asVecMisc(vecOpNot, rd, rd, vecArrangement16B) + m.insert(not) + case ge: + cmp := m.allocateInstr() + cmp.asVecRRR(vecOpCmge, rd, rn, rm, arr) + m.insert(cmp) + case gt: + cmp := m.allocateInstr() + cmp.asVecRRR(vecOpCmgt, rd, rn, rm, arr) + m.insert(cmp) + case le: + cmp := m.allocateInstr() + cmp.asVecRRR(vecOpCmge, rd, rm, rn, arr) // rm, rn are swapped + m.insert(cmp) + case lt: + cmp := m.allocateInstr() + cmp.asVecRRR(vecOpCmgt, rd, rm, rn, arr) // rm, rn are swapped + m.insert(cmp) + case hs: + cmp := m.allocateInstr() + cmp.asVecRRR(vecOpCmhs, rd, rn, rm, arr) + m.insert(cmp) + case hi: + cmp := m.allocateInstr() + cmp.asVecRRR(vecOpCmhi, rd, rn, rm, arr) + m.insert(cmp) + case ls: + cmp := m.allocateInstr() + cmp.asVecRRR(vecOpCmhs, rd, rm, rn, arr) // rm, rn are swapped + m.insert(cmp) + case lo: + cmp := m.allocateInstr() + cmp.asVecRRR(vecOpCmhi, rd, rm, rn, arr) // rm, rn are swapped + m.insert(cmp) + } +} + +func (m *machine) lowerVFcmp(si *ssa.Instruction) { + x, y, c, lane := si.VFcmpData() + flag := condFlagFromSSAFloatCmpCond(c) + arr := ssaLaneToArrangement(lane) + + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rm := m.getOperand_NR(m.compiler.ValueDefinition(y), extModeNone) + rd := operandNR(m.compiler.VRegOf(si.Return())) + + switch flag { + case eq: + cmp := m.allocateInstr() + cmp.asVecRRR(vecOpFcmeq, rd, rn, rm, arr) + m.insert(cmp) + case ne: + cmp := m.allocateInstr() + cmp.asVecRRR(vecOpFcmeq, rd, rn, rm, arr) + m.insert(cmp) + not := m.allocateInstr() + not.asVecMisc(vecOpNot, rd, rd, vecArrangement16B) + m.insert(not) + case ge: + cmp := m.allocateInstr() + cmp.asVecRRR(vecOpFcmge, rd, rn, rm, arr) + m.insert(cmp) + case gt: + cmp := m.allocateInstr() + cmp.asVecRRR(vecOpFcmgt, rd, rn, rm, arr) + m.insert(cmp) + case mi: + cmp := m.allocateInstr() + cmp.asVecRRR(vecOpFcmgt, rd, rm, rn, arr) // rm, rn are swapped + m.insert(cmp) + case ls: + cmp := m.allocateInstr() + cmp.asVecRRR(vecOpFcmge, rd, rm, rn, arr) // rm, rn are swapped + m.insert(cmp) + } +} + +func (m *machine) lowerVfpuToInt(rd, rn operand, arr vecArrangement, signed bool) { + cvt := m.allocateInstr() + if signed { + cvt.asVecMisc(vecOpFcvtzs, rd, rn, arr) + } else { + cvt.asVecMisc(vecOpFcvtzu, rd, rn, arr) + } + m.insert(cvt) + + if arr == vecArrangement2D { + narrow := m.allocateInstr() + if signed { + narrow.asVecMisc(vecOpSqxtn, rd, rd, vecArrangement2S) + } else { + narrow.asVecMisc(vecOpUqxtn, rd, rd, vecArrangement2S) + } + m.insert(narrow) + } +} + +func (m *machine) lowerVfpuFromInt(rd, rn operand, arr vecArrangement, signed bool) { + cvt := m.allocateInstr() + if signed { + cvt.asVecMisc(vecOpScvtf, rd, rn, arr) + } else { + cvt.asVecMisc(vecOpUcvtf, rd, rn, arr) + } + m.insert(cvt) +} + +func (m *machine) lowerShifts(si *ssa.Instruction, ext extMode, aluOp aluOp) { + x, amount := si.Arg2() + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), ext) + rm := m.getOperand_ShiftImm_NR(m.compiler.ValueDefinition(amount), ext, x.Type().Bits()) + rd := operandNR(m.compiler.VRegOf(si.Return())) + + alu := m.allocateInstr() + alu.asALUShift(aluOp, rd, rn, rm, x.Type().Bits() == 64) + m.insert(alu) +} + +func (m *machine) lowerBitwiseAluOp(si *ssa.Instruction, op aluOp) { + x, y := si.Arg2() + + xDef, yDef := m.compiler.ValueDefinition(x), m.compiler.ValueDefinition(y) + rn := m.getOperand_NR(xDef, extModeNone) + rd := operandNR(m.compiler.VRegOf(si.Return())) + + _64 := x.Type().Bits() == 64 + alu := m.allocateInstr() + if instr := yDef.Instr; instr != nil && instr.Constant() { + c := instr.ConstantVal() + if isBitMaskImmediate(c, _64) { + // Constant bit wise operations can be lowered to a single instruction. + alu.asALUBitmaskImm(op, rd.nr(), rn.nr(), c, _64) + m.insert(alu) + return + } + } + + rm := m.getOperand_SR_NR(yDef, extModeNone) + alu.asALU(op, rd, rn, rm, _64) + m.insert(alu) +} + +func (m *machine) lowerRotl(si *ssa.Instruction) { + x, y := si.Arg2() + r := si.Return() + _64 := r.Type().Bits() == 64 + + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rm := m.getOperand_NR(m.compiler.ValueDefinition(y), extModeNone) + var tmp operand + if _64 { + tmp = operandNR(m.compiler.AllocateVReg(ssa.TypeI64)) + } else { + tmp = operandNR(m.compiler.AllocateVReg(ssa.TypeI32)) + } + rd := operandNR(m.compiler.VRegOf(r)) + + // Encode rotl as neg + rotr: neg is a sub against the zero-reg. + m.lowerRotlImpl(rd, rn, rm, tmp, _64) +} + +func (m *machine) lowerRotlImpl(rd, rn, rm, tmp operand, is64bit bool) { + // Encode rotl as neg + rotr: neg is a sub against the zero-reg. + neg := m.allocateInstr() + neg.asALU(aluOpSub, tmp, operandNR(xzrVReg), rm, is64bit) + m.insert(neg) + alu := m.allocateInstr() + alu.asALU(aluOpRotR, rd, rn, tmp, is64bit) + m.insert(alu) +} + +func (m *machine) lowerRotr(si *ssa.Instruction) { + x, y := si.Arg2() + + xDef, yDef := m.compiler.ValueDefinition(x), m.compiler.ValueDefinition(y) + rn := m.getOperand_NR(xDef, extModeNone) + rm := m.getOperand_NR(yDef, extModeNone) + rd := operandNR(m.compiler.VRegOf(si.Return())) + + alu := m.allocateInstr() + alu.asALU(aluOpRotR, rd, rn, rm, si.Return().Type().Bits() == 64) + m.insert(alu) +} + +func (m *machine) lowerExtend(arg, ret ssa.Value, from, to byte, signed bool) { + rd := m.compiler.VRegOf(ret) + def := m.compiler.ValueDefinition(arg) + + if instr := def.Instr; !signed && from == 32 && instr != nil { + // We can optimize out the unsigned extend because: + // Writes to the W register set bits [63:32] of the X register to zero + // https://developer.arm.com/documentation/den0024/a/An-Introduction-to-the-ARMv8-Instruction-Sets/The-ARMv8-instruction-sets/Distinguishing-between-32-bit-and-64-bit-A64-instructions + switch instr.Opcode() { + case + ssa.OpcodeIadd, ssa.OpcodeIsub, ssa.OpcodeLoad, + ssa.OpcodeBand, ssa.OpcodeBor, ssa.OpcodeBnot, + ssa.OpcodeIshl, ssa.OpcodeUshr, ssa.OpcodeSshr, + ssa.OpcodeRotl, ssa.OpcodeRotr, + ssa.OpcodeUload8, ssa.OpcodeUload16, ssa.OpcodeUload32: + // So, if the argument is the result of a 32-bit operation, we can just copy the register. + // It is highly likely that this copy will be optimized out after register allocation. + rn := m.compiler.VRegOf(arg) + mov := m.allocateInstr() + // Note: do not use move32 as it will be lowered to a 32-bit move, which is not copy (that is actually the impl of UExtend). + mov.asMove64(rd, rn) + m.insert(mov) + return + default: + } + } + rn := m.getOperand_NR(def, extModeNone) + + ext := m.allocateInstr() + ext.asExtend(rd, rn.nr(), from, to, signed) + m.insert(ext) +} + +func (m *machine) lowerFcmp(x, y, result ssa.Value, c ssa.FloatCmpCond) { + rn, rm := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone), m.getOperand_NR(m.compiler.ValueDefinition(y), extModeNone) + + fc := m.allocateInstr() + fc.asFpuCmp(rn, rm, x.Type().Bits() == 64) + m.insert(fc) + + cset := m.allocateInstr() + cset.asCSet(m.compiler.VRegOf(result), false, condFlagFromSSAFloatCmpCond(c)) + m.insert(cset) +} + +func (m *machine) lowerImul(x, y, result ssa.Value) { + rd := m.compiler.VRegOf(result) + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rm := m.getOperand_NR(m.compiler.ValueDefinition(y), extModeNone) + + // TODO: if this comes before Add/Sub, we could merge it by putting it into the place of xzrVReg. + + mul := m.allocateInstr() + mul.asALURRRR(aluOpMAdd, operandNR(rd), rn, rm, operandNR(xzrVReg), x.Type().Bits() == 64) + m.insert(mul) +} + +func (m *machine) lowerClz(x, result ssa.Value) { + rd := m.compiler.VRegOf(result) + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + clz := m.allocateInstr() + clz.asBitRR(bitOpClz, rd, rn.nr(), x.Type().Bits() == 64) + m.insert(clz) +} + +func (m *machine) lowerCtz(x, result ssa.Value) { + rd := m.compiler.VRegOf(result) + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rbit := m.allocateInstr() + _64 := x.Type().Bits() == 64 + var tmpReg regalloc.VReg + if _64 { + tmpReg = m.compiler.AllocateVReg(ssa.TypeI64) + } else { + tmpReg = m.compiler.AllocateVReg(ssa.TypeI32) + } + rbit.asBitRR(bitOpRbit, tmpReg, rn.nr(), _64) + m.insert(rbit) + + clz := m.allocateInstr() + clz.asBitRR(bitOpClz, rd, tmpReg, _64) + m.insert(clz) +} + +func (m *machine) lowerPopcnt(x, result ssa.Value) { + // arm64 doesn't have an instruction for population count on scalar register, + // so we use the vector instruction `cnt`. + // This is exactly what the official Go implements bits.OneCount. + // For example, "func () int { return bits.OneCount(10) }" is compiled as + // + // MOVD $10, R0 ;; Load 10. + // FMOVD R0, F0 + // VCNT V0.B8, V0.B8 + // UADDLV V0.B8, V0 + // + // In aarch64 asm, FMOVD is encoded as `ins`, VCNT is `cnt`, + // and the registers may use different names. In our encoding we use the following + // instructions: + // + // ins v0.d[0], x0 ;; mov from GPR to vec (FMOV above) is encoded as INS + // cnt v0.16b, v0.16b ;; we use vec arrangement 16b + // uaddlv h0, v0.8b ;; h0 is still v0 with the dest width specifier 'H', implied when src arrangement is 8b + // mov x5, v0.d[0] ;; finally we mov the result back to a GPR + // + + rd := operandNR(m.compiler.VRegOf(result)) + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + + rf1 := operandNR(m.compiler.AllocateVReg(ssa.TypeF64)) + ins := m.allocateInstr() + ins.asMovToVec(rf1, rn, vecArrangementD, vecIndex(0)) + m.insert(ins) + + rf2 := operandNR(m.compiler.AllocateVReg(ssa.TypeF64)) + cnt := m.allocateInstr() + cnt.asVecMisc(vecOpCnt, rf2, rf1, vecArrangement16B) + m.insert(cnt) + + rf3 := operandNR(m.compiler.AllocateVReg(ssa.TypeF64)) + uaddlv := m.allocateInstr() + uaddlv.asVecLanes(vecOpUaddlv, rf3, rf2, vecArrangement8B) + m.insert(uaddlv) + + mov := m.allocateInstr() + mov.asMovFromVec(rd, rf3, vecArrangementD, vecIndex(0), false) + m.insert(mov) +} + +// lowerExitWithCode lowers the lowerExitWithCode takes a context pointer as argument. +func (m *machine) lowerExitWithCode(execCtxVReg regalloc.VReg, code wazevoapi.ExitCode) { + tmpReg1 := m.compiler.AllocateVReg(ssa.TypeI32) + loadExitCodeConst := m.allocateInstr() + loadExitCodeConst.asMOVZ(tmpReg1, uint64(code), 0, true) + + setExitCode := m.allocateInstr() + setExitCode.asStore(operandNR(tmpReg1), + addressMode{ + kind: addressModeKindRegUnsignedImm12, + rn: execCtxVReg, imm: wazevoapi.ExecutionContextOffsetExitCodeOffset.I64(), + }, 32) + + // In order to unwind the stack, we also need to push the current stack pointer: + tmp2 := m.compiler.AllocateVReg(ssa.TypeI64) + movSpToTmp := m.allocateInstr() + movSpToTmp.asMove64(tmp2, spVReg) + strSpToExecCtx := m.allocateInstr() + strSpToExecCtx.asStore(operandNR(tmp2), + addressMode{ + kind: addressModeKindRegUnsignedImm12, + rn: execCtxVReg, imm: wazevoapi.ExecutionContextOffsetStackPointerBeforeGoCall.I64(), + }, 64) + // Also the address of this exit. + tmp3 := m.compiler.AllocateVReg(ssa.TypeI64) + currentAddrToTmp := m.allocateInstr() + currentAddrToTmp.asAdr(tmp3, 0) + storeCurrentAddrToExecCtx := m.allocateInstr() + storeCurrentAddrToExecCtx.asStore(operandNR(tmp3), + addressMode{ + kind: addressModeKindRegUnsignedImm12, + rn: execCtxVReg, imm: wazevoapi.ExecutionContextOffsetGoCallReturnAddress.I64(), + }, 64) + + exitSeq := m.allocateInstr() + exitSeq.asExitSequence(execCtxVReg) + + m.insert(loadExitCodeConst) + m.insert(setExitCode) + m.insert(movSpToTmp) + m.insert(strSpToExecCtx) + m.insert(currentAddrToTmp) + m.insert(storeCurrentAddrToExecCtx) + m.insert(exitSeq) +} + +func (m *machine) lowerIcmpToFlag(x, y ssa.Value, signed bool) { + if x.Type() != y.Type() { + panic( + fmt.Sprintf("TODO(maybe): support icmp with different types: v%d=%s != v%d=%s", + x.ID(), x.Type(), y.ID(), y.Type())) + } + + extMod := extModeOf(x.Type(), signed) + + // First operand must be in pure register form. + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extMod) + // Second operand can be in any of Imm12, ER, SR, or NR form supported by the SUBS instructions. + rm := m.getOperand_Imm12_ER_SR_NR(m.compiler.ValueDefinition(y), extMod) + + alu := m.allocateInstr() + // subs zr, rn, rm + alu.asALU( + aluOpSubS, + // We don't need the result, just need to set flags. + operandNR(xzrVReg), + rn, + rm, + x.Type().Bits() == 64, + ) + m.insert(alu) +} + +func (m *machine) lowerFcmpToFlag(x, y ssa.Value) { + if x.Type() != y.Type() { + panic("TODO(maybe): support icmp with different types") + } + + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rm := m.getOperand_NR(m.compiler.ValueDefinition(y), extModeNone) + cmp := m.allocateInstr() + cmp.asFpuCmp(rn, rm, x.Type().Bits() == 64) + m.insert(cmp) +} + +func (m *machine) lowerExitIfTrueWithCode(execCtxVReg regalloc.VReg, cond ssa.Value, code wazevoapi.ExitCode) { + condDef := m.compiler.ValueDefinition(cond) + if !m.compiler.MatchInstr(condDef, ssa.OpcodeIcmp) { + panic("TODO: OpcodeExitIfTrueWithCode must come after Icmp at the moment: " + condDef.Instr.Opcode().String()) + } + condDef.Instr.MarkLowered() + + cvalInstr := condDef.Instr + x, y, c := cvalInstr.IcmpData() + signed := c.Signed() + m.lowerIcmpToFlag(x, y, signed) + + execCtxTmp := m.copyToTmp(execCtxVReg) + + // We have to skip the entire exit sequence if the condition is false. + cbr := m.allocateInstr() + m.insert(cbr) + m.lowerExitWithCode(execCtxTmp, code) + // conditional branch target is after exit. + l := m.insertBrTargetLabel() + cbr.asCondBr(condFlagFromSSAIntegerCmpCond(c).invert().asCond(), l, false /* ignored */) +} + +func (m *machine) lowerSelect(c, x, y, result ssa.Value) { + cvalDef := m.compiler.ValueDefinition(c) + + var cc condFlag + switch { + case m.compiler.MatchInstr(cvalDef, ssa.OpcodeIcmp): // This case, we can use the ALU flag set by SUBS instruction. + cvalInstr := cvalDef.Instr + x, y, c := cvalInstr.IcmpData() + cc = condFlagFromSSAIntegerCmpCond(c) + m.lowerIcmpToFlag(x, y, c.Signed()) + cvalDef.Instr.MarkLowered() + case m.compiler.MatchInstr(cvalDef, ssa.OpcodeFcmp): // This case we can use the Fpu flag directly. + cvalInstr := cvalDef.Instr + x, y, c := cvalInstr.FcmpData() + cc = condFlagFromSSAFloatCmpCond(c) + m.lowerFcmpToFlag(x, y) + cvalDef.Instr.MarkLowered() + default: + rn := m.getOperand_NR(cvalDef, extModeNone) + if c.Type() != ssa.TypeI32 && c.Type() != ssa.TypeI64 { + panic("TODO?BUG?: support select with non-integer condition") + } + alu := m.allocateInstr() + // subs zr, rn, zr + alu.asALU( + aluOpSubS, + // We don't need the result, just need to set flags. + operandNR(xzrVReg), + rn, + operandNR(xzrVReg), + c.Type().Bits() == 64, + ) + m.insert(alu) + cc = ne + } + + rn := m.getOperand_NR(m.compiler.ValueDefinition(x), extModeNone) + rm := m.getOperand_NR(m.compiler.ValueDefinition(y), extModeNone) + + rd := operandNR(m.compiler.VRegOf(result)) + switch x.Type() { + case ssa.TypeI32, ssa.TypeI64: + // csel rd, rn, rm, cc + csel := m.allocateInstr() + csel.asCSel(rd, rn, rm, cc, x.Type().Bits() == 64) + m.insert(csel) + case ssa.TypeF32, ssa.TypeF64: + // fcsel rd, rn, rm, cc + fcsel := m.allocateInstr() + fcsel.asFpuCSel(rd, rn, rm, cc, x.Type().Bits() == 64) + m.insert(fcsel) + default: + panic("BUG") + } +} + +func (m *machine) lowerSelectVec(rc, rn, rm, rd operand) { + // First check if `rc` is zero or not. + checkZero := m.allocateInstr() + checkZero.asALU(aluOpSubS, operandNR(xzrVReg), rc, operandNR(xzrVReg), false) + m.insert(checkZero) + + // Then use CSETM to set all bits to one if `rc` is zero. + allOnesOrZero := m.compiler.AllocateVReg(ssa.TypeI64) + cset := m.allocateInstr() + cset.asCSet(allOnesOrZero, true, ne) + m.insert(cset) + + // Then move the bits to the result vector register. + tmp2 := operandNR(m.compiler.AllocateVReg(ssa.TypeV128)) + dup := m.allocateInstr() + dup.asVecDup(tmp2, operandNR(allOnesOrZero), vecArrangement2D) + m.insert(dup) + + // Now that `tmp2` has either all bits one or zero depending on `rc`, + // we can use bsl to select between `rn` and `rm`. + ins := m.allocateInstr() + ins.asVecRRRRewrite(vecOpBsl, tmp2, rn, rm, vecArrangement16B) + m.insert(ins) + + // Finally, move the result to the destination register. + mov2 := m.allocateInstr() + mov2.asFpuMov128(rd.nr(), tmp2.nr()) + m.insert(mov2) +} + +// copyToTmp copies the given regalloc.VReg to a temporary register. This is called before cbr to avoid the regalloc issue +// e.g. reload happening in the middle of the exit sequence which is not the path the normal path executes +func (m *machine) copyToTmp(v regalloc.VReg) regalloc.VReg { + typ := m.compiler.TypeOf(v) + mov := m.allocateInstr() + tmp := m.compiler.AllocateVReg(typ) + if typ.IsInt() { + mov.asMove64(tmp, v) + } else { + mov.asFpuMov128(tmp, v) + } + m.insert(mov) + return tmp +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/lower_instr_operands.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/lower_instr_operands.go new file mode 100644 index 000000000..d9fbf1789 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/lower_instr_operands.go @@ -0,0 +1,350 @@ +package arm64 + +// This file contains the logic to "find and determine operands" for instructions. +// In order to finalize the form of an operand, we might end up merging/eliminating +// the source instructions into an operand whenever possible. + +import ( + "fmt" + + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend" + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc" + "github.com/tetratelabs/wazero/internal/engine/wazevo/ssa" +) + +type ( + // operand represents an operand of an instruction whose type is determined by the kind. + operand struct { + kind operandKind + data, data2 uint64 + } + operandKind byte +) + +// Here's the list of operand kinds. We use the abbreviation of the kind name not only for these consts, +// but also names of functions which return the operand of the kind. +const ( + // operandKindNR represents "NormalRegister" (NR). This is literally the register without any special operation unlike others. + operandKindNR operandKind = iota + // operandKindSR represents "Shifted Register" (SR). This is a register which is shifted by a constant. + // Some of the arm64 instructions can take this kind of operand. + operandKindSR + // operandKindER represents "Extended Register (ER). This is a register which is sign/zero-extended to a larger size. + // Some of the arm64 instructions can take this kind of operand. + operandKindER + // operandKindImm12 represents "Immediate 12" (Imm12). This is a 12-bit immediate value which can be either shifted by 12 or not. + // See asImm12 function for detail. + operandKindImm12 + // operandKindShiftImm represents "Shifted Immediate" (ShiftImm) used by shift operations. + operandKindShiftImm +) + +// String implements fmt.Stringer for debugging. +func (o operand) format(size byte) string { + switch o.kind { + case operandKindNR: + return formatVRegSized(o.nr(), size) + case operandKindSR: + r, amt, sop := o.sr() + return fmt.Sprintf("%s, %s #%d", formatVRegSized(r, size), sop, amt) + case operandKindER: + r, eop, _ := o.er() + return fmt.Sprintf("%s %s", formatVRegSized(r, size), eop) + case operandKindImm12: + imm12, shiftBit := o.imm12() + if shiftBit == 1 { + return fmt.Sprintf("#%#x", uint64(imm12)<<12) + } else { + return fmt.Sprintf("#%#x", imm12) + } + default: + panic(fmt.Sprintf("unknown operand kind: %d", o.kind)) + } +} + +// operandNR encodes the given VReg as an operand of operandKindNR. +func operandNR(r regalloc.VReg) operand { + return operand{kind: operandKindNR, data: uint64(r)} +} + +// nr decodes the underlying VReg assuming the operand is of operandKindNR. +func (o operand) nr() regalloc.VReg { + return regalloc.VReg(o.data) +} + +// operandER encodes the given VReg as an operand of operandKindER. +func operandER(r regalloc.VReg, eop extendOp, to byte) operand { + if to < 32 { + panic("TODO?BUG?: when we need to extend to less than 32 bits?") + } + return operand{kind: operandKindER, data: uint64(r), data2: uint64(eop)<<32 | uint64(to)} +} + +// er decodes the underlying VReg, extend operation, and the target size assuming the operand is of operandKindER. +func (o operand) er() (r regalloc.VReg, eop extendOp, to byte) { + return regalloc.VReg(o.data), extendOp(o.data2>>32) & 0xff, byte(o.data2 & 0xff) +} + +// operandSR encodes the given VReg as an operand of operandKindSR. +func operandSR(r regalloc.VReg, amt byte, sop shiftOp) operand { + return operand{kind: operandKindSR, data: uint64(r), data2: uint64(amt)<<32 | uint64(sop)} +} + +// sr decodes the underlying VReg, shift amount, and shift operation assuming the operand is of operandKindSR. +func (o operand) sr() (r regalloc.VReg, amt byte, sop shiftOp) { + return regalloc.VReg(o.data), byte(o.data2>>32) & 0xff, shiftOp(o.data2) & 0xff +} + +// operandImm12 encodes the given imm12 as an operand of operandKindImm12. +func operandImm12(imm12 uint16, shiftBit byte) operand { + return operand{kind: operandKindImm12, data: uint64(imm12) | uint64(shiftBit)<<32} +} + +// imm12 decodes the underlying imm12 data assuming the operand is of operandKindImm12. +func (o operand) imm12() (v uint16, shiftBit byte) { + return uint16(o.data), byte(o.data >> 32) +} + +// operandShiftImm encodes the given amount as an operand of operandKindShiftImm. +func operandShiftImm(amount byte) operand { + return operand{kind: operandKindShiftImm, data: uint64(amount)} +} + +// shiftImm decodes the underlying shift amount data assuming the operand is of operandKindShiftImm. +func (o operand) shiftImm() byte { + return byte(o.data) +} + +// reg returns the register of the operand if applicable. +func (o operand) reg() regalloc.VReg { + switch o.kind { + case operandKindNR: + return o.nr() + case operandKindSR: + r, _, _ := o.sr() + return r + case operandKindER: + r, _, _ := o.er() + return r + case operandKindImm12: + // Does not have a register. + case operandKindShiftImm: + // Does not have a register. + default: + panic(o.kind) + } + return regalloc.VRegInvalid +} + +func (o operand) realReg() regalloc.RealReg { + return o.nr().RealReg() +} + +func (o operand) assignReg(v regalloc.VReg) operand { + switch o.kind { + case operandKindNR: + return operandNR(v) + case operandKindSR: + _, amt, sop := o.sr() + return operandSR(v, amt, sop) + case operandKindER: + _, eop, to := o.er() + return operandER(v, eop, to) + case operandKindImm12: + // Does not have a register. + case operandKindShiftImm: + // Does not have a register. + } + panic(o.kind) +} + +// ensureValueNR returns an operand of either operandKindER, operandKindSR, or operandKindNR from the given value (defined by `def). +// +// `mode` is used to extend the operand if the bit length is smaller than mode.bits(). +// If the operand can be expressed as operandKindImm12, `mode` is ignored. +func (m *machine) getOperand_Imm12_ER_SR_NR(def *backend.SSAValueDefinition, mode extMode) (op operand) { + if def.IsFromBlockParam() { + return operandNR(def.BlkParamVReg) + } + + instr := def.Instr + if instr.Opcode() == ssa.OpcodeIconst { + if imm12Op, ok := asImm12Operand(instr.ConstantVal()); ok { + instr.MarkLowered() + return imm12Op + } + } + return m.getOperand_ER_SR_NR(def, mode) +} + +// getOperand_MaybeNegatedImm12_ER_SR_NR is almost the same as getOperand_Imm12_ER_SR_NR, but this might negate the immediate value. +// If the immediate value is negated, the second return value is true, otherwise always false. +func (m *machine) getOperand_MaybeNegatedImm12_ER_SR_NR(def *backend.SSAValueDefinition, mode extMode) (op operand, negatedImm12 bool) { + if def.IsFromBlockParam() { + return operandNR(def.BlkParamVReg), false + } + + instr := def.Instr + if instr.Opcode() == ssa.OpcodeIconst { + c := instr.ConstantVal() + if imm12Op, ok := asImm12Operand(c); ok { + instr.MarkLowered() + return imm12Op, false + } + + signExtended := int64(c) + if def.SSAValue().Type().Bits() == 32 { + signExtended = (signExtended << 32) >> 32 + } + negatedWithoutSign := -signExtended + if imm12Op, ok := asImm12Operand(uint64(negatedWithoutSign)); ok { + instr.MarkLowered() + return imm12Op, true + } + } + return m.getOperand_ER_SR_NR(def, mode), false +} + +// ensureValueNR returns an operand of either operandKindER, operandKindSR, or operandKindNR from the given value (defined by `def). +// +// `mode` is used to extend the operand if the bit length is smaller than mode.bits(). +func (m *machine) getOperand_ER_SR_NR(def *backend.SSAValueDefinition, mode extMode) (op operand) { + if def.IsFromBlockParam() { + return operandNR(def.BlkParamVReg) + } + + if m.compiler.MatchInstr(def, ssa.OpcodeSExtend) || m.compiler.MatchInstr(def, ssa.OpcodeUExtend) { + extInstr := def.Instr + + signed := extInstr.Opcode() == ssa.OpcodeSExtend + innerExtFromBits, innerExtToBits := extInstr.ExtendFromToBits() + modeBits, modeSigned := mode.bits(), mode.signed() + if mode == extModeNone || innerExtToBits == modeBits { + eop := extendOpFrom(signed, innerExtFromBits) + extArg := m.getOperand_NR(m.compiler.ValueDefinition(extInstr.Arg()), extModeNone) + op = operandER(extArg.nr(), eop, innerExtToBits) + extInstr.MarkLowered() + return + } + + if innerExtToBits > modeBits { + panic("BUG?TODO?: need the results of inner extension to be larger than the mode") + } + + switch { + case (!signed && !modeSigned) || (signed && modeSigned): + // Two sign/zero extensions are equivalent to one sign/zero extension for the larger size. + eop := extendOpFrom(modeSigned, innerExtFromBits) + op = operandER(m.compiler.VRegOf(extInstr.Arg()), eop, modeBits) + extInstr.MarkLowered() + case (signed && !modeSigned) || (!signed && modeSigned): + // We need to {sign, zero}-extend the result of the {zero,sign} extension. + eop := extendOpFrom(modeSigned, innerExtToBits) + op = operandER(m.compiler.VRegOf(extInstr.Return()), eop, modeBits) + // Note that we failed to merge the inner extension instruction this case. + } + return + } + return m.getOperand_SR_NR(def, mode) +} + +// ensureValueNR returns an operand of either operandKindSR or operandKindNR from the given value (defined by `def). +// +// `mode` is used to extend the operand if the bit length is smaller than mode.bits(). +func (m *machine) getOperand_SR_NR(def *backend.SSAValueDefinition, mode extMode) (op operand) { + if def.IsFromBlockParam() { + return operandNR(def.BlkParamVReg) + } + + if m.compiler.MatchInstr(def, ssa.OpcodeIshl) { + // Check if the shift amount is constant instruction. + targetVal, amountVal := def.Instr.Arg2() + targetVReg := m.getOperand_NR(m.compiler.ValueDefinition(targetVal), extModeNone).nr() + amountDef := m.compiler.ValueDefinition(amountVal) + if amountDef.IsFromInstr() && amountDef.Instr.Constant() { + // If that is the case, we can use the shifted register operand (SR). + c := byte(amountDef.Instr.ConstantVal()) & (targetVal.Type().Bits() - 1) // Clears the unnecessary bits. + def.Instr.MarkLowered() + amountDef.Instr.MarkLowered() + return operandSR(targetVReg, c, shiftOpLSL) + } + } + return m.getOperand_NR(def, mode) +} + +// getOperand_ShiftImm_NR returns an operand of either operandKindShiftImm or operandKindNR from the given value (defined by `def). +func (m *machine) getOperand_ShiftImm_NR(def *backend.SSAValueDefinition, mode extMode, shiftBitWidth byte) (op operand) { + if def.IsFromBlockParam() { + return operandNR(def.BlkParamVReg) + } + + instr := def.Instr + if instr.Constant() { + amount := byte(instr.ConstantVal()) & (shiftBitWidth - 1) // Clears the unnecessary bits. + return operandShiftImm(amount) + } + return m.getOperand_NR(def, mode) +} + +// ensureValueNR returns an operand of operandKindNR from the given value (defined by `def). +// +// `mode` is used to extend the operand if the bit length is smaller than mode.bits(). +func (m *machine) getOperand_NR(def *backend.SSAValueDefinition, mode extMode) (op operand) { + var v regalloc.VReg + if def.IsFromBlockParam() { + v = def.BlkParamVReg + } else { + instr := def.Instr + if instr.Constant() { + // We inline all the constant instructions so that we could reduce the register usage. + v = m.lowerConstant(instr) + instr.MarkLowered() + } else { + if n := def.N; n == 0 { + v = m.compiler.VRegOf(instr.Return()) + } else { + _, rs := instr.Returns() + v = m.compiler.VRegOf(rs[n-1]) + } + } + } + + r := v + switch inBits := def.SSAValue().Type().Bits(); { + case mode == extModeNone: + case inBits == 32 && (mode == extModeZeroExtend32 || mode == extModeSignExtend32): + case inBits == 32 && mode == extModeZeroExtend64: + extended := m.compiler.AllocateVReg(ssa.TypeI64) + ext := m.allocateInstr() + ext.asExtend(extended, v, 32, 64, false) + m.insert(ext) + r = extended + case inBits == 32 && mode == extModeSignExtend64: + extended := m.compiler.AllocateVReg(ssa.TypeI64) + ext := m.allocateInstr() + ext.asExtend(extended, v, 32, 64, true) + m.insert(ext) + r = extended + case inBits == 64 && (mode == extModeZeroExtend64 || mode == extModeSignExtend64): + } + return operandNR(r) +} + +func asImm12Operand(val uint64) (op operand, ok bool) { + v, shiftBit, ok := asImm12(val) + if !ok { + return operand{}, false + } + return operandImm12(v, shiftBit), true +} + +func asImm12(val uint64) (v uint16, shiftBit byte, ok bool) { + const mask1, mask2 uint64 = 0xfff, 0xfff_000 + if val&^mask1 == 0 { + return uint16(val), 0, true + } else if val&^mask2 == 0 { + return uint16(val >> 12), 1, true + } else { + return 0, 0, false + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/lower_mem.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/lower_mem.go new file mode 100644 index 000000000..3179abda0 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/lower_mem.go @@ -0,0 +1,510 @@ +package arm64 + +import ( + "fmt" + + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc" + "github.com/tetratelabs/wazero/internal/engine/wazevo/ssa" +) + +type ( + // addressMode represents an ARM64 addressing mode. + // + // https://developer.arm.com/documentation/102374/0101/Loads-and-stores---addressing + // TODO: use the bit-packed layout like operand struct. + addressMode struct { + kind addressModeKind + rn, rm regalloc.VReg + extOp extendOp + imm int64 + } + + // addressModeKind represents the kind of ARM64 addressing mode. + addressModeKind byte +) + +const ( + // addressModeKindRegExtended takes a base register and an index register. The index register is sign/zero-extended, + // and then scaled by bits(type)/8. + // + // e.g. + // - ldrh w1, [x2, w3, SXTW #1] ;; sign-extended and scaled by 2 (== LSL #1) + // - strh w1, [x2, w3, UXTW #1] ;; zero-extended and scaled by 2 (== LSL #1) + // - ldr w1, [x2, w3, SXTW #2] ;; sign-extended and scaled by 4 (== LSL #2) + // - str x1, [x2, w3, UXTW #3] ;; zero-extended and scaled by 8 (== LSL #3) + // + // See the following pages: + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/LDRH--register---Load-Register-Halfword--register-- + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/LDR--register---Load-Register--register-- + addressModeKindRegScaledExtended addressModeKind = iota + + // addressModeKindRegScaled is the same as addressModeKindRegScaledExtended, but without extension factor. + addressModeKindRegScaled + + // addressModeKindRegScaled is the same as addressModeKindRegScaledExtended, but without scale factor. + addressModeKindRegExtended + + // addressModeKindRegReg takes a base register and an index register. The index register is not either scaled or extended. + addressModeKindRegReg + + // addressModeKindRegSignedImm9 takes a base register and a 9-bit "signed" immediate offset (-256 to 255). + // The immediate will be sign-extended, and be added to the base register. + // This is a.k.a. "unscaled" since the immediate is not scaled. + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/LDUR--Load-Register--unscaled-- + addressModeKindRegSignedImm9 + + // addressModeKindRegUnsignedImm12 takes a base register and a 12-bit "unsigned" immediate offset. scaled by + // the size of the type. In other words, the actual offset will be imm12 * bits(type)/8. + // See "Unsigned offset" in the following pages: + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/LDRB--immediate---Load-Register-Byte--immediate-- + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/LDRH--immediate---Load-Register-Halfword--immediate-- + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/LDR--immediate---Load-Register--immediate-- + addressModeKindRegUnsignedImm12 + + // addressModePostIndex takes a base register and a 9-bit "signed" immediate offset. + // After the load/store, the base register will be updated by the offset. + // + // Note that when this is used for pair load/store, the offset will be 7-bit "signed" immediate offset. + // + // See "Post-index" in the following pages for examples: + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/LDRB--immediate---Load-Register-Byte--immediate-- + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/LDRH--immediate---Load-Register-Halfword--immediate-- + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/LDR--immediate---Load-Register--immediate-- + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/LDP--Load-Pair-of-Registers- + addressModeKindPostIndex + + // addressModePostIndex takes a base register and a 9-bit "signed" immediate offset. + // Before the load/store, the base register will be updated by the offset. + // + // Note that when this is used for pair load/store, the offset will be 7-bit "signed" immediate offset. + // + // See "Pre-index" in the following pages for examples: + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/LDRB--immediate---Load-Register-Byte--immediate-- + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/LDRH--immediate---Load-Register-Halfword--immediate-- + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/LDR--immediate---Load-Register--immediate-- + // https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/LDP--Load-Pair-of-Registers- + addressModeKindPreIndex + + // addressModeKindArgStackSpace is used to resolve the address of the argument stack space + // exiting right above the stack pointer. Since we don't know the exact stack space needed for a function + // at a compilation phase, this is used as a placeholder and further lowered to a real addressing mode like above. + addressModeKindArgStackSpace + + // addressModeKindResultStackSpace is used to resolve the address of the result stack space + // exiting right above the stack pointer. Since we don't know the exact stack space needed for a function + // at a compilation phase, this is used as a placeholder and further lowered to a real addressing mode like above. + addressModeKindResultStackSpace +) + +func (a addressMode) format(dstSizeBits byte) (ret string) { + base := formatVRegSized(a.rn, 64) + if rn := a.rn; rn.RegType() != regalloc.RegTypeInt { + panic("invalid base register type: " + a.rn.RegType().String()) + } else if rn.IsRealReg() && v0 <= a.rn.RealReg() && a.rn.RealReg() <= v30 { + panic("BUG: likely a bug in reg alloc or reset behavior") + } + + switch a.kind { + case addressModeKindRegScaledExtended: + amount := a.sizeInBitsToShiftAmount(dstSizeBits) + ret = fmt.Sprintf("[%s, %s, %s #%#x]", base, formatVRegSized(a.rm, a.indexRegBits()), a.extOp, amount) + case addressModeKindRegScaled: + amount := a.sizeInBitsToShiftAmount(dstSizeBits) + ret = fmt.Sprintf("[%s, %s, lsl #%#x]", base, formatVRegSized(a.rm, a.indexRegBits()), amount) + case addressModeKindRegExtended: + ret = fmt.Sprintf("[%s, %s, %s]", base, formatVRegSized(a.rm, a.indexRegBits()), a.extOp) + case addressModeKindRegReg: + ret = fmt.Sprintf("[%s, %s]", base, formatVRegSized(a.rm, a.indexRegBits())) + case addressModeKindRegSignedImm9: + if a.imm != 0 { + ret = fmt.Sprintf("[%s, #%#x]", base, a.imm) + } else { + ret = fmt.Sprintf("[%s]", base) + } + case addressModeKindRegUnsignedImm12: + if a.imm != 0 { + ret = fmt.Sprintf("[%s, #%#x]", base, a.imm) + } else { + ret = fmt.Sprintf("[%s]", base) + } + case addressModeKindPostIndex: + ret = fmt.Sprintf("[%s], #%#x", base, a.imm) + case addressModeKindPreIndex: + ret = fmt.Sprintf("[%s, #%#x]!", base, a.imm) + case addressModeKindArgStackSpace: + ret = fmt.Sprintf("[#arg_space, #%#x]", a.imm) + case addressModeKindResultStackSpace: + ret = fmt.Sprintf("[#ret_space, #%#x]", a.imm) + } + return +} + +func addressModePreOrPostIndex(rn regalloc.VReg, imm int64, preIndex bool) addressMode { + if !offsetFitsInAddressModeKindRegSignedImm9(imm) { + panic(fmt.Sprintf("BUG: offset %#x does not fit in addressModeKindRegSignedImm9", imm)) + } + if preIndex { + return addressMode{kind: addressModeKindPreIndex, rn: rn, imm: imm} + } else { + return addressMode{kind: addressModeKindPostIndex, rn: rn, imm: imm} + } +} + +func offsetFitsInAddressModeKindRegUnsignedImm12(dstSizeInBits byte, offset int64) bool { + divisor := int64(dstSizeInBits) / 8 + return 0 < offset && offset%divisor == 0 && offset/divisor < 4096 +} + +func offsetFitsInAddressModeKindRegSignedImm9(offset int64) bool { + return -256 <= offset && offset <= 255 +} + +func (a addressMode) indexRegBits() byte { + bits := a.extOp.srcBits() + if bits != 32 && bits != 64 { + panic("invalid index register for address mode. it must be either 32 or 64 bits") + } + return bits +} + +func (a addressMode) sizeInBitsToShiftAmount(sizeInBits byte) (lsl byte) { + switch sizeInBits { + case 8: + lsl = 0 + case 16: + lsl = 1 + case 32: + lsl = 2 + case 64: + lsl = 3 + } + return +} + +func extLoadSignSize(op ssa.Opcode) (size byte, signed bool) { + switch op { + case ssa.OpcodeUload8: + size, signed = 8, false + case ssa.OpcodeUload16: + size, signed = 16, false + case ssa.OpcodeUload32: + size, signed = 32, false + case ssa.OpcodeSload8: + size, signed = 8, true + case ssa.OpcodeSload16: + size, signed = 16, true + case ssa.OpcodeSload32: + size, signed = 32, true + default: + panic("BUG") + } + return +} + +func (m *machine) lowerExtLoad(op ssa.Opcode, ptr ssa.Value, offset uint32, ret regalloc.VReg) { + size, signed := extLoadSignSize(op) + amode := m.lowerToAddressMode(ptr, offset, size) + load := m.allocateInstr() + if signed { + load.asSLoad(operandNR(ret), amode, size) + } else { + load.asULoad(operandNR(ret), amode, size) + } + m.insert(load) +} + +func (m *machine) lowerLoad(ptr ssa.Value, offset uint32, typ ssa.Type, ret ssa.Value) { + amode := m.lowerToAddressMode(ptr, offset, typ.Bits()) + + dst := m.compiler.VRegOf(ret) + load := m.allocateInstr() + switch typ { + case ssa.TypeI32, ssa.TypeI64: + load.asULoad(operandNR(dst), amode, typ.Bits()) + case ssa.TypeF32, ssa.TypeF64: + load.asFpuLoad(operandNR(dst), amode, typ.Bits()) + case ssa.TypeV128: + load.asFpuLoad(operandNR(dst), amode, 128) + default: + panic("TODO") + } + m.insert(load) +} + +func (m *machine) lowerLoadSplat(ptr ssa.Value, offset uint32, lane ssa.VecLane, ret ssa.Value) { + var opSize byte + switch lane { + case ssa.VecLaneI8x16: + opSize = 8 + case ssa.VecLaneI16x8: + opSize = 16 + case ssa.VecLaneI32x4: + opSize = 32 + case ssa.VecLaneI64x2: + opSize = 64 + } + amode := m.lowerToAddressMode(ptr, offset, opSize) + rd := operandNR(m.compiler.VRegOf(ret)) + m.lowerLoadSplatFromAddressMode(rd, amode, lane) +} + +// lowerLoadSplatFromAddressMode is extracted from lowerLoadSplat for testing. +func (m *machine) lowerLoadSplatFromAddressMode(rd operand, amode addressMode, lane ssa.VecLane) { + tmpReg := operandNR(m.compiler.AllocateVReg(ssa.TypeI64)) + + // vecLoad1R has offset address mode (base+imm) only for post index, so the only addressing mode + // we can use here is "no-offset" register addressing mode, i.e. `addressModeKindRegReg`. + switch amode.kind { + case addressModeKindRegReg: + add := m.allocateInstr() + add.asALU(aluOpAdd, tmpReg, operandNR(amode.rn), operandNR(amode.rm), true) + m.insert(add) + case addressModeKindRegSignedImm9: + add := m.allocateInstr() + add.asALU(aluOpAdd, tmpReg, operandNR(amode.rn), operandImm12(uint16(amode.imm), 0), true) + m.insert(add) + case addressModeKindRegUnsignedImm12: + if amode.imm != 0 { + offsetReg := m.compiler.AllocateVReg(ssa.TypeI64) + m.load64bitConst(amode.imm, offsetReg) + add := m.allocateInstr() + m.insert(add) + add.asALU(aluOpAdd, tmpReg, operandNR(amode.rn), operandNR(offsetReg), true) + } else { + tmpReg = operandNR(amode.rn) + } + default: + panic("unsupported address mode for LoadSplat") + } + + arr := ssaLaneToArrangement(lane) + + ld1r := m.allocateInstr() + ld1r.asVecLoad1R(rd, tmpReg, arr) + m.insert(ld1r) +} + +func (m *machine) lowerStore(si *ssa.Instruction) { + // TODO: merge consecutive stores into a single pair store instruction. + value, ptr, offset, storeSizeInBits := si.StoreData() + amode := m.lowerToAddressMode(ptr, offset, storeSizeInBits) + + valueOp := m.getOperand_NR(m.compiler.ValueDefinition(value), extModeNone) + store := m.allocateInstr() + store.asStore(valueOp, amode, storeSizeInBits) + m.insert(store) +} + +// lowerToAddressMode converts a pointer to an addressMode that can be used as an operand for load/store instructions. +func (m *machine) lowerToAddressMode(ptr ssa.Value, offsetBase uint32, size byte) (amode addressMode) { + // TODO: currently the instruction selection logic doesn't support addressModeKindRegScaledExtended and + // addressModeKindRegScaled since collectAddends doesn't take ssa.OpcodeIshl into account. This should be fixed + // to support more efficient address resolution. + + a32s, a64s, offset := m.collectAddends(ptr) + offset += int64(offsetBase) + return m.lowerToAddressModeFromAddends(a32s, a64s, size, offset) +} + +// lowerToAddressModeFromAddends creates an addressMode from a list of addends collected by collectAddends. +// During the construction, this might emit additional instructions. +// +// Extracted as a separate function for easy testing. +func (m *machine) lowerToAddressModeFromAddends(a32s *queue[addend32], a64s *queue[regalloc.VReg], size byte, offset int64) (amode addressMode) { + switch a64sExist, a32sExist := !a64s.empty(), !a32s.empty(); { + case a64sExist && a32sExist: + var base regalloc.VReg + base = a64s.dequeue() + var a32 addend32 + a32 = a32s.dequeue() + amode = addressMode{kind: addressModeKindRegExtended, rn: base, rm: a32.r, extOp: a32.ext} + case a64sExist && offsetFitsInAddressModeKindRegUnsignedImm12(size, offset): + var base regalloc.VReg + base = a64s.dequeue() + amode = addressMode{kind: addressModeKindRegUnsignedImm12, rn: base, imm: offset} + offset = 0 + case a64sExist && offsetFitsInAddressModeKindRegSignedImm9(offset): + var base regalloc.VReg + base = a64s.dequeue() + amode = addressMode{kind: addressModeKindRegSignedImm9, rn: base, imm: offset} + offset = 0 + case a64sExist: + var base regalloc.VReg + base = a64s.dequeue() + if !a64s.empty() { + index := a64s.dequeue() + amode = addressMode{kind: addressModeKindRegReg, rn: base, rm: index, extOp: extendOpUXTX /* indicates index reg is 64-bit */} + } else { + amode = addressMode{kind: addressModeKindRegUnsignedImm12, rn: base, imm: 0} + } + case a32sExist: + base32 := a32s.dequeue() + + // First we need 64-bit base. + base := m.compiler.AllocateVReg(ssa.TypeI64) + baseExt := m.allocateInstr() + var signed bool + if base32.ext == extendOpSXTW { + signed = true + } + baseExt.asExtend(base, base32.r, 32, 64, signed) + m.insert(baseExt) + + if !a32s.empty() { + index := a32s.dequeue() + amode = addressMode{kind: addressModeKindRegExtended, rn: base, rm: index.r, extOp: index.ext} + } else { + amode = addressMode{kind: addressModeKindRegUnsignedImm12, rn: base, imm: 0} + } + default: // Only static offsets. + tmpReg := m.compiler.AllocateVReg(ssa.TypeI64) + m.lowerConstantI64(tmpReg, offset) + amode = addressMode{kind: addressModeKindRegUnsignedImm12, rn: tmpReg, imm: 0} + offset = 0 + } + + baseReg := amode.rn + if offset > 0 { + baseReg = m.addConstToReg64(baseReg, offset) // baseReg += offset + } + + for !a64s.empty() { + a64 := a64s.dequeue() + baseReg = m.addReg64ToReg64(baseReg, a64) // baseReg += a64 + } + + for !a32s.empty() { + a32 := a32s.dequeue() + baseReg = m.addRegToReg64Ext(baseReg, a32.r, a32.ext) // baseReg += (a32 extended to 64-bit) + } + amode.rn = baseReg + return +} + +var addendsMatchOpcodes = [4]ssa.Opcode{ssa.OpcodeUExtend, ssa.OpcodeSExtend, ssa.OpcodeIadd, ssa.OpcodeIconst} + +func (m *machine) collectAddends(ptr ssa.Value) (addends32 *queue[addend32], addends64 *queue[regalloc.VReg], offset int64) { + m.addendsWorkQueue.reset() + m.addends32.reset() + m.addends64.reset() + m.addendsWorkQueue.enqueue(ptr) + + for !m.addendsWorkQueue.empty() { + v := m.addendsWorkQueue.dequeue() + + def := m.compiler.ValueDefinition(v) + switch op := m.compiler.MatchInstrOneOf(def, addendsMatchOpcodes[:]); op { + case ssa.OpcodeIadd: + // If the addend is an add, we recursively collect its operands. + x, y := def.Instr.Arg2() + m.addendsWorkQueue.enqueue(x) + m.addendsWorkQueue.enqueue(y) + def.Instr.MarkLowered() + case ssa.OpcodeIconst: + // If the addend is constant, we just statically merge it into the offset. + ic := def.Instr + u64 := ic.ConstantVal() + if ic.Return().Type().Bits() == 32 { + offset += int64(int32(u64)) // sign-extend. + } else { + offset += int64(u64) + } + def.Instr.MarkLowered() + case ssa.OpcodeUExtend, ssa.OpcodeSExtend: + switch input := def.Instr.Arg(); input.Type().Bits() { + case 64: + // If the input is already 64-bit, this extend is a no-op. TODO: shouldn't this be optimized out at much earlier stage? no? + m.addends64.enqueue(m.getOperand_NR(m.compiler.ValueDefinition(input), extModeNone).nr()) + def.Instr.MarkLowered() + continue + case 32: + var ext extendOp + if op == ssa.OpcodeUExtend { + ext = extendOpUXTW + } else { + ext = extendOpSXTW + } + + inputDef := m.compiler.ValueDefinition(input) + constInst := inputDef.IsFromInstr() && inputDef.Instr.Constant() + switch { + case constInst && ext == extendOpUXTW: + // Zero-extension of a 32-bit constant can be merged into the offset. + offset += int64(uint32(inputDef.Instr.ConstantVal())) + case constInst && ext == extendOpSXTW: + // Sign-extension of a 32-bit constant can be merged into the offset. + offset += int64(int32(inputDef.Instr.ConstantVal())) // sign-extend! + default: + m.addends32.enqueue(addend32{r: m.getOperand_NR(inputDef, extModeNone).nr(), ext: ext}) + } + def.Instr.MarkLowered() + continue + } + // If this is the extension smaller than 32 bits, this cannot be merged into addressing mode since + // arm64 requires index registers must be at least 32 bits (extension modes can only be applied in 32 bits). + // fallthrough + panic("TODO: add tests") + default: + // If the addend is not one of them, we simply use it as-is (without merging!), optionally zero-extending it. + m.addends64.enqueue(m.getOperand_NR(def, extModeZeroExtend64 /* optional zero ext */).nr()) + } + } + return &m.addends32, &m.addends64, offset +} + +func (m *machine) addConstToReg64(r regalloc.VReg, c int64) (rd regalloc.VReg) { + rd = m.compiler.AllocateVReg(ssa.TypeI64) + alu := m.allocateInstr() + if imm12Op, ok := asImm12Operand(uint64(c)); ok { + alu.asALU(aluOpAdd, operandNR(rd), operandNR(r), imm12Op, true) + } else if imm12Op, ok = asImm12Operand(uint64(-c)); ok { + alu.asALU(aluOpSub, operandNR(rd), operandNR(r), imm12Op, true) + } else { + tmp := m.compiler.AllocateVReg(ssa.TypeI64) + m.load64bitConst(c, tmp) + alu.asALU(aluOpAdd, operandNR(rd), operandNR(r), operandNR(tmp), true) + } + m.insert(alu) + return +} + +func (m *machine) addReg64ToReg64(rn, rm regalloc.VReg) (rd regalloc.VReg) { + rd = m.compiler.AllocateVReg(ssa.TypeI64) + alu := m.allocateInstr() + alu.asALU(aluOpAdd, operandNR(rd), operandNR(rn), operandNR(rm), true) + m.insert(alu) + return +} + +func (m *machine) addRegToReg64Ext(rn, rm regalloc.VReg, ext extendOp) (rd regalloc.VReg) { + rd = m.compiler.AllocateVReg(ssa.TypeI64) + alu := m.allocateInstr() + alu.asALU(aluOpAdd, operandNR(rd), operandNR(rn), operandER(rm, ext, 64), true) + m.insert(alu) + return +} + +// queue is the resettable queue where the underlying slice is reused. +type queue[T any] struct { + index int + data []T +} + +func (q *queue[T]) enqueue(v T) { + q.data = append(q.data, v) +} + +func (q *queue[T]) dequeue() (ret T) { + ret = q.data[q.index] + q.index++ + return +} + +func (q *queue[T]) empty() bool { + return q.index >= len(q.data) +} + +func (q *queue[T]) reset() { + q.index = 0 + q.data = q.data[:0] +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/machine.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/machine.go new file mode 100644 index 000000000..821bdfb83 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/machine.go @@ -0,0 +1,628 @@ +package arm64 + +import ( + "context" + "fmt" + "math" + "strings" + + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend" + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc" + "github.com/tetratelabs/wazero/internal/engine/wazevo/ssa" + "github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi" +) + +type ( + // machine implements backend.Machine. + machine struct { + compiler backend.Compiler + currentABI *abiImpl + currentSSABlk ssa.BasicBlock + // abis maps ssa.SignatureID to the ABI implementation. + abis []abiImpl + instrPool wazevoapi.Pool[instruction] + // rootInstr is the root instruction of the currently-compiled function. + rootInstr *instruction + // perBlockHead and perBlockEnd are the head and tail of the instruction list per currently-compiled ssa.BasicBlock. + perBlockHead, perBlockEnd *instruction + // pendingInstructions are the instructions which are not yet emitted into the instruction list. + pendingInstructions []*instruction + regAllocFn regAllocFunctionImpl + nextLabel label + + // ssaBlockIDToLabels maps an SSA block ID to the label. + ssaBlockIDToLabels []label + // labelToInstructions maps a label to the instructions of the region which the label represents. + labelPositions map[label]*labelPosition + orderedBlockLabels []*labelPosition + labelPositionPool wazevoapi.Pool[labelPosition] + + // addendsWorkQueue is used during address lowering, defined here for reuse. + addendsWorkQueue queue[ssa.Value] + addends32 queue[addend32] + // addends64 is used during address lowering, defined here for reuse. + addends64 queue[regalloc.VReg] + unresolvedAddressModes []*instruction + + // condBrRelocs holds the conditional branches which need offset relocation. + condBrRelocs []condBrReloc + + // spillSlotSize is the size of the stack slot in bytes used for spilling registers. + // During the execution of the function, the stack looks like: + // + // + // (high address) + // +-----------------+ + // | ....... | + // | ret Y | + // | ....... | + // | ret 0 | + // | arg X | + // | ....... | + // | arg 1 | + // | arg 0 | + // | xxxxx | + // | ReturnAddress | + // +-----------------+ <<-| + // | ........... | | + // | spill slot M | | <--- spillSlotSize + // | ............ | | + // | spill slot 2 | | + // | spill slot 1 | <<-+ + // | clobbered N | + // | ........... | + // | clobbered 1 | + // | clobbered 0 | + // SP---> +-----------------+ + // (low address) + // + // and it represents the size of the space between FP and the first spilled slot. This must be a multiple of 16. + // Also note that this is only known after register allocation. + spillSlotSize int64 + spillSlots map[regalloc.VRegID]int64 // regalloc.VRegID to offset. + // clobberedRegs holds real-register backed VRegs saved at the function prologue, and restored at the epilogue. + clobberedRegs []regalloc.VReg + + maxRequiredStackSizeForCalls int64 + stackBoundsCheckDisabled bool + + regAllocStarted bool + } + + addend32 struct { + r regalloc.VReg + ext extendOp + } + + // label represents a position in the generated code which is either + // a real instruction or the constant pool (e.g. jump tables). + // + // This is exactly the same as the traditional "label" in assembly code. + label uint32 + + // labelPosition represents the regions of the generated code which the label represents. + labelPosition struct { + l label + begin, end *instruction + binarySize int64 + binaryOffset int64 + } + + condBrReloc struct { + cbr *instruction + // currentLabelPos is the labelPosition within which condBr is defined. + currentLabelPos *labelPosition + // Next block's labelPosition. + nextLabel label + offset int64 + } +) + +const ( + invalidLabel = 0 + returnLabel = math.MaxUint32 +) + +// NewBackend returns a new backend for arm64. +func NewBackend() backend.Machine { + m := &machine{ + instrPool: wazevoapi.NewPool[instruction](resetInstruction), + labelPositionPool: wazevoapi.NewPool[labelPosition](resetLabelPosition), + labelPositions: make(map[label]*labelPosition), + spillSlots: make(map[regalloc.VRegID]int64), + nextLabel: invalidLabel, + } + m.regAllocFn.m = m + m.regAllocFn.labelToRegAllocBlockIndex = make(map[label]int) + return m +} + +// Reset implements backend.Machine. +func (m *machine) Reset() { + m.regAllocStarted = false + m.instrPool.Reset() + m.labelPositionPool.Reset() + m.currentSSABlk = nil + for l := label(0); l <= m.nextLabel; l++ { + delete(m.labelPositions, l) + } + m.pendingInstructions = m.pendingInstructions[:0] + m.clobberedRegs = m.clobberedRegs[:0] + for key := range m.spillSlots { + m.clobberedRegs = append(m.clobberedRegs, regalloc.VReg(key)) + } + for _, key := range m.clobberedRegs { + delete(m.spillSlots, regalloc.VRegID(key)) + } + m.clobberedRegs = m.clobberedRegs[:0] + m.orderedBlockLabels = m.orderedBlockLabels[:0] + m.regAllocFn.reset() + m.spillSlotSize = 0 + m.unresolvedAddressModes = m.unresolvedAddressModes[:0] + m.rootInstr = nil + m.ssaBlockIDToLabels = m.ssaBlockIDToLabels[:0] + m.perBlockHead, m.perBlockEnd = nil, nil + m.maxRequiredStackSizeForCalls = 0 + m.nextLabel = invalidLabel +} + +// InitializeABI implements backend.Machine InitializeABI. +func (m *machine) InitializeABI(sig *ssa.Signature) { + m.currentABI = m.getOrCreateABIImpl(sig) +} + +// DisableStackCheck implements backend.Machine DisableStackCheck. +func (m *machine) DisableStackCheck() { + m.stackBoundsCheckDisabled = true +} + +// ABI implements backend.Machine. +func (m *machine) ABI() backend.FunctionABI { + return m.currentABI +} + +// allocateLabel allocates an unused label. +func (m *machine) allocateLabel() label { + m.nextLabel++ + return m.nextLabel +} + +// SetCompiler implements backend.Machine. +func (m *machine) SetCompiler(ctx backend.Compiler) { + m.compiler = ctx +} + +// StartLoweringFunction implements backend.Machine. +func (m *machine) StartLoweringFunction(max ssa.BasicBlockID) { + imax := int(max) + if len(m.ssaBlockIDToLabels) <= imax { + // Eagerly allocate labels for the blocks since the underlying slice will be used for the next iteration. + m.ssaBlockIDToLabels = append(m.ssaBlockIDToLabels, make([]label, imax+1)...) + } +} + +// EndLoweringFunction implements backend.Machine. +func (m *machine) EndLoweringFunction() {} + +// StartBlock implements backend.Machine. +func (m *machine) StartBlock(blk ssa.BasicBlock) { + m.currentSSABlk = blk + + l := m.ssaBlockIDToLabels[m.currentSSABlk.ID()] + if l == invalidLabel { + l = m.allocateLabel() + m.ssaBlockIDToLabels[blk.ID()] = l + } + + end := m.allocateNop() + m.perBlockHead, m.perBlockEnd = end, end + + labelPos, ok := m.labelPositions[l] + if !ok { + labelPos = m.allocateLabelPosition(l) + m.labelPositions[l] = labelPos + } + m.orderedBlockLabels = append(m.orderedBlockLabels, labelPos) + labelPos.begin, labelPos.end = end, end + m.regAllocFn.addBlock(blk, l, labelPos) +} + +// EndBlock implements backend.Machine. +func (m *machine) EndBlock() { + // Insert nop0 as the head of the block for convenience to simplify the logic of inserting instructions. + m.insertAtPerBlockHead(m.allocateNop()) + + l := m.ssaBlockIDToLabels[m.currentSSABlk.ID()] + m.labelPositions[l].begin = m.perBlockHead + + if m.currentSSABlk.EntryBlock() { + m.rootInstr = m.perBlockHead + } +} + +func (m *machine) insert(i *instruction) { + m.pendingInstructions = append(m.pendingInstructions, i) +} + +func (m *machine) insertBrTargetLabel() label { + nop, l := m.allocateBrTarget() + m.insert(nop) + return l +} + +func (m *machine) allocateBrTarget() (nop *instruction, l label) { + l = m.allocateLabel() + nop = m.allocateInstr() + nop.asNop0WithLabel(l) + pos := m.allocateLabelPosition(l) + pos.begin, pos.end = nop, nop + m.labelPositions[l] = pos + return +} + +func (m *machine) allocateLabelPosition(la label) *labelPosition { + l := m.labelPositionPool.Allocate() + l.l = la + return l +} + +func resetLabelPosition(l *labelPosition) { + *l = labelPosition{} +} + +// FlushPendingInstructions implements backend.Machine. +func (m *machine) FlushPendingInstructions() { + l := len(m.pendingInstructions) + if l == 0 { + return + } + for i := l - 1; i >= 0; i-- { // reverse because we lower instructions in reverse order. + m.insertAtPerBlockHead(m.pendingInstructions[i]) + } + m.pendingInstructions = m.pendingInstructions[:0] +} + +func (m *machine) insertAtPerBlockHead(i *instruction) { + if m.perBlockHead == nil { + m.perBlockHead = i + m.perBlockEnd = i + return + } + i.next = m.perBlockHead + m.perBlockHead.prev = i + m.perBlockHead = i +} + +// String implements backend.Machine. +func (l label) String() string { + return fmt.Sprintf("L%d", l) +} + +// allocateInstr allocates an instruction. +func (m *machine) allocateInstr() *instruction { + instr := m.instrPool.Allocate() + if !m.regAllocStarted { + instr.addedBeforeRegAlloc = true + } + return instr +} + +func resetInstruction(i *instruction) { + *i = instruction{} +} + +func (m *machine) allocateNop() *instruction { + instr := m.allocateInstr() + instr.asNop0() + return instr +} + +func (m *machine) resolveAddressingMode(arg0offset, ret0offset int64, i *instruction) { + amode := &i.amode + switch amode.kind { + case addressModeKindResultStackSpace: + amode.imm += ret0offset + case addressModeKindArgStackSpace: + amode.imm += arg0offset + default: + panic("BUG") + } + + var sizeInBits byte + switch i.kind { + case store8, uLoad8: + sizeInBits = 8 + case store16, uLoad16: + sizeInBits = 16 + case store32, fpuStore32, uLoad32, fpuLoad32: + sizeInBits = 32 + case store64, fpuStore64, uLoad64, fpuLoad64: + sizeInBits = 64 + case fpuStore128, fpuLoad128: + sizeInBits = 128 + default: + panic("BUG") + } + + if offsetFitsInAddressModeKindRegUnsignedImm12(sizeInBits, amode.imm) { + amode.kind = addressModeKindRegUnsignedImm12 + } else { + // This case, we load the offset into the temporary register, + // and then use it as the index register. + newPrev := m.lowerConstantI64AndInsert(i.prev, tmpRegVReg, amode.imm) + linkInstr(newPrev, i) + *amode = addressMode{kind: addressModeKindRegReg, rn: amode.rn, rm: tmpRegVReg, extOp: extendOpUXTX /* indicates rm reg is 64-bit */} + } +} + +// ResolveRelativeAddresses implements backend.Machine. +func (m *machine) ResolveRelativeAddresses(ctx context.Context) { + if len(m.unresolvedAddressModes) > 0 { + arg0offset, ret0offset := m.arg0OffsetFromSP(), m.ret0OffsetFromSP() + for _, i := range m.unresolvedAddressModes { + m.resolveAddressingMode(arg0offset, ret0offset, i) + } + } + + // Reuse the slice to gather the unresolved conditional branches. + cbrs := m.condBrRelocs[:0] + + var fn string + var fnIndex int + var labelToSSABlockID map[label]ssa.BasicBlockID + if wazevoapi.PerfMapEnabled { + fn = wazevoapi.GetCurrentFunctionName(ctx) + labelToSSABlockID = make(map[label]ssa.BasicBlockID) + for i, l := range m.ssaBlockIDToLabels { + labelToSSABlockID[l] = ssa.BasicBlockID(i) + } + fnIndex = wazevoapi.GetCurrentFunctionIndex(ctx) + } + + // Next, in order to determine the offsets of relative jumps, we have to calculate the size of each label. + var offset int64 + for i, pos := range m.orderedBlockLabels { + pos.binaryOffset = offset + var size int64 + for cur := pos.begin; ; cur = cur.next { + switch cur.kind { + case nop0: + l := cur.nop0Label() + if pos, ok := m.labelPositions[l]; ok { + pos.binaryOffset = offset + size + } + case condBr: + if !cur.condBrOffsetResolved() { + var nextLabel label + if i < len(m.orderedBlockLabels)-1 { + // Note: this is only used when the block ends with fallthrough, + // therefore can be safely assumed that the next block exists when it's needed. + nextLabel = m.orderedBlockLabels[i+1].l + } + cbrs = append(cbrs, condBrReloc{ + cbr: cur, currentLabelPos: pos, offset: offset + size, + nextLabel: nextLabel, + }) + } + } + size += cur.size() + if cur == pos.end { + break + } + } + + if wazevoapi.PerfMapEnabled { + if size > 0 { + l := pos.l + var labelStr string + if blkID, ok := labelToSSABlockID[l]; ok { + labelStr = fmt.Sprintf("%s::SSA_Block[%s]", l, blkID) + } else { + labelStr = l.String() + } + wazevoapi.PerfMap.AddModuleEntry(fnIndex, offset, uint64(size), fmt.Sprintf("%s:::::%s", fn, labelStr)) + } + } + + pos.binarySize = size + offset += size + } + + // Before resolving any offsets, we need to check if all the conditional branches can be resolved. + var needRerun bool + for i := range cbrs { + reloc := &cbrs[i] + cbr := reloc.cbr + offset := reloc.offset + + target := cbr.condBrLabel() + offsetOfTarget := m.labelPositions[target].binaryOffset + diff := offsetOfTarget - offset + if divided := diff >> 2; divided < minSignedInt19 || divided > maxSignedInt19 { + // This case the conditional branch is too huge. We place the trampoline instructions at the end of the current block, + // and jump to it. + m.insertConditionalJumpTrampoline(cbr, reloc.currentLabelPos, reloc.nextLabel) + // Then, we need to recall this function to fix up the label offsets + // as they have changed after the trampoline is inserted. + needRerun = true + } + } + if needRerun { + m.ResolveRelativeAddresses(ctx) + if wazevoapi.PerfMapEnabled { + wazevoapi.PerfMap.Clear() + } + return + } + + var currentOffset int64 + for cur := m.rootInstr; cur != nil; cur = cur.next { + switch cur.kind { + case br: + target := cur.brLabel() + offsetOfTarget := m.labelPositions[target].binaryOffset + diff := offsetOfTarget - currentOffset + divided := diff >> 2 + if divided < minSignedInt26 || divided > maxSignedInt26 { + // This means the currently compiled single function is extremely large. + panic("too large function that requires branch relocation of large unconditional branch larger than 26-bit range") + } + cur.brOffsetResolve(diff) + case condBr: + if !cur.condBrOffsetResolved() { + target := cur.condBrLabel() + offsetOfTarget := m.labelPositions[target].binaryOffset + diff := offsetOfTarget - currentOffset + if divided := diff >> 2; divided < minSignedInt19 || divided > maxSignedInt19 { + panic("BUG: branch relocation for large conditional branch larger than 19-bit range must be handled properly") + } + cur.condBrOffsetResolve(diff) + } + case brTableSequence: + for i := range cur.targets { + l := label(cur.targets[i]) + offsetOfTarget := m.labelPositions[l].binaryOffset + diff := offsetOfTarget - (currentOffset + brTableSequenceOffsetTableBegin) + cur.targets[i] = uint32(diff) + } + cur.brTableSequenceOffsetsResolved() + case emitSourceOffsetInfo: + m.compiler.AddSourceOffsetInfo(currentOffset, cur.sourceOffsetInfo()) + } + currentOffset += cur.size() + } +} + +const ( + maxSignedInt26 int64 = 1<<25 - 1 + minSignedInt26 int64 = -(1 << 25) + + maxSignedInt19 int64 = 1<<19 - 1 + minSignedInt19 int64 = -(1 << 19) +) + +func (m *machine) insertConditionalJumpTrampoline(cbr *instruction, currentBlk *labelPosition, nextLabel label) { + cur := currentBlk.end + originalTarget := cbr.condBrLabel() + endNext := cur.next + + if cur.kind != br { + // If the current block ends with a conditional branch, we can just insert the trampoline after it. + // Otherwise, we need to insert "skip" instruction to skip the trampoline instructions. + skip := m.allocateInstr() + skip.asBr(nextLabel) + cur = linkInstr(cur, skip) + } + + cbrNewTargetInstr, cbrNewTargetLabel := m.allocateBrTarget() + cbr.setCondBrTargets(cbrNewTargetLabel) + cur = linkInstr(cur, cbrNewTargetInstr) + + // Then insert the unconditional branch to the original, which should be possible to get encoded + // as 26-bit offset should be enough for any practical application. + br := m.allocateInstr() + br.asBr(originalTarget) + cur = linkInstr(cur, br) + + // Update the end of the current block. + currentBlk.end = cur + + linkInstr(cur, endNext) +} + +func (m *machine) getOrAllocateSSABlockLabel(blk ssa.BasicBlock) label { + if blk.ReturnBlock() { + return returnLabel + } + l := m.ssaBlockIDToLabels[blk.ID()] + if l == invalidLabel { + l = m.allocateLabel() + m.ssaBlockIDToLabels[blk.ID()] = l + } + return l +} + +// LinkAdjacentBlocks implements backend.Machine. +func (m *machine) LinkAdjacentBlocks(prev, next ssa.BasicBlock) { + prevLabelPos := m.labelPositions[m.getOrAllocateSSABlockLabel(prev)] + nextLabelPos := m.labelPositions[m.getOrAllocateSSABlockLabel(next)] + prevLabelPos.end.next = nextLabelPos.begin +} + +// Format implements backend.Machine. +func (m *machine) Format() string { + begins := map[*instruction]label{} + for l, pos := range m.labelPositions { + begins[pos.begin] = l + } + + irBlocks := map[label]ssa.BasicBlockID{} + for i, l := range m.ssaBlockIDToLabels { + irBlocks[l] = ssa.BasicBlockID(i) + } + + var lines []string + for cur := m.rootInstr; cur != nil; cur = cur.next { + if l, ok := begins[cur]; ok { + var labelStr string + if blkID, ok := irBlocks[l]; ok { + labelStr = fmt.Sprintf("%s (SSA Block: %s):", l, blkID) + } else { + labelStr = fmt.Sprintf("%s:", l) + } + lines = append(lines, labelStr) + } + if cur.kind == nop0 { + continue + } + lines = append(lines, "\t"+cur.String()) + } + return "\n" + strings.Join(lines, "\n") + "\n" +} + +// InsertReturn implements backend.Machine. +func (m *machine) InsertReturn() { + i := m.allocateInstr() + i.asRet(m.currentABI) + m.insert(i) +} + +func (m *machine) getVRegSpillSlotOffsetFromSP(id regalloc.VRegID, size byte) int64 { + offset, ok := m.spillSlots[id] + if !ok { + offset = m.spillSlotSize + // TODO: this should be aligned depending on the `size` to use Imm12 offset load/store as much as possible. + m.spillSlots[id] = offset + m.spillSlotSize += int64(size) + } + return offset + 16 // spill slot starts above the clobbered registers and the frame size. +} + +func (m *machine) clobberedRegSlotSize() int64 { + return int64(len(m.clobberedRegs) * 16) +} + +func (m *machine) arg0OffsetFromSP() int64 { + return m.frameSize() + + 16 + // 16-byte aligned return address + 16 // frame size saved below the clobbered registers. +} + +func (m *machine) ret0OffsetFromSP() int64 { + return m.arg0OffsetFromSP() + m.currentABI.argStackSize +} + +func (m *machine) requiredStackSize() int64 { + return m.maxRequiredStackSizeForCalls + + m.frameSize() + + 16 + // 16-byte aligned return address. + 16 // frame size saved below the clobbered registers. +} + +func (m *machine) frameSize() int64 { + s := m.clobberedRegSlotSize() + m.spillSlotSize + if s&0xf != 0 { + panic(fmt.Errorf("BUG: frame size %d is not 16-byte aligned", s)) + } + return s +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/machine_pro_epi_logue.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/machine_pro_epi_logue.go new file mode 100644 index 000000000..62b4e0ece --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/machine_pro_epi_logue.go @@ -0,0 +1,445 @@ +package arm64 + +import ( + "fmt" + + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc" + "github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi" +) + +// SetupPrologue implements backend.Machine. +func (m *machine) SetupPrologue() { + cur := m.rootInstr + prevInitInst := cur.next + + // + // (high address) (high address) + // SP----> +-----------------+ +------------------+ <----+ + // | ....... | | ....... | | + // | ret Y | | ret Y | | + // | ....... | | ....... | | + // | ret 0 | | ret 0 | | + // | arg X | | arg X | | size_of_arg_ret. + // | ....... | ====> | ....... | | + // | arg 1 | | arg 1 | | + // | arg 0 | | arg 0 | <----+ + // |-----------------| | size_of_arg_ret | + // | return address | + // +------------------+ <---- SP + // (low address) (low address) + + // Saves the return address (lr) and the size_of_arg_ret below the SP. + // size_of_arg_ret is used for stack unwinding. + cur = m.createReturnAddrAndSizeOfArgRetSlot(cur) + + if !m.stackBoundsCheckDisabled { + cur = m.insertStackBoundsCheck(m.requiredStackSize(), cur) + } + + // Decrement SP if spillSlotSize > 0. + if m.spillSlotSize == 0 && len(m.spillSlots) != 0 { + panic(fmt.Sprintf("BUG: spillSlotSize=%d, spillSlots=%v\n", m.spillSlotSize, m.spillSlots)) + } + + if regs := m.clobberedRegs; len(regs) > 0 { + // + // (high address) (high address) + // +-----------------+ +-----------------+ + // | ....... | | ....... | + // | ret Y | | ret Y | + // | ....... | | ....... | + // | ret 0 | | ret 0 | + // | arg X | | arg X | + // | ....... | | ....... | + // | arg 1 | | arg 1 | + // | arg 0 | | arg 0 | + // | size_of_arg_ret | | size_of_arg_ret | + // | ReturnAddress | | ReturnAddress | + // SP----> +-----------------+ ====> +-----------------+ + // (low address) | clobbered M | + // | ............ | + // | clobbered 0 | + // +-----------------+ <----- SP + // (low address) + // + _amode := addressModePreOrPostIndex(spVReg, + -16, // stack pointer must be 16-byte aligned. + true, // Decrement before store. + ) + for _, vr := range regs { + // TODO: pair stores to reduce the number of instructions. + store := m.allocateInstr() + store.asStore(operandNR(vr), _amode, regTypeToRegisterSizeInBits(vr.RegType())) + cur = linkInstr(cur, store) + } + } + + if size := m.spillSlotSize; size > 0 { + // Check if size is 16-byte aligned. + if size&0xf != 0 { + panic(fmt.Errorf("BUG: spill slot size %d is not 16-byte aligned", size)) + } + + cur = m.addsAddOrSubStackPointer(cur, spVReg, size, false) + + // At this point, the stack looks like: + // + // (high address) + // +------------------+ + // | ....... | + // | ret Y | + // | ....... | + // | ret 0 | + // | arg X | + // | ....... | + // | arg 1 | + // | arg 0 | + // | size_of_arg_ret | + // | ReturnAddress | + // +------------------+ + // | clobbered M | + // | ............ | + // | clobbered 0 | + // | spill slot N | + // | ............ | + // | spill slot 2 | + // | spill slot 0 | + // SP----> +------------------+ + // (low address) + } + + // We push the frame size into the stack to make it possible to unwind stack: + // + // + // (high address) (high address) + // +-----------------+ +-----------------+ + // | ....... | | ....... | + // | ret Y | | ret Y | + // | ....... | | ....... | + // | ret 0 | | ret 0 | + // | arg X | | arg X | + // | ....... | | ....... | + // | arg 1 | | arg 1 | + // | arg 0 | | arg 0 | + // | size_of_arg_ret | | size_of_arg_ret | + // | ReturnAddress | | ReturnAddress | + // +-----------------+ ==> +-----------------+ <----+ + // | clobbered M | | clobbered M | | + // | ............ | | ............ | | + // | clobbered 2 | | clobbered 2 | | + // | clobbered 1 | | clobbered 1 | | frame size + // | clobbered 0 | | clobbered 0 | | + // | spill slot N | | spill slot N | | + // | ............ | | ............ | | + // | spill slot 0 | | spill slot 0 | <----+ + // SP---> +-----------------+ | xxxxxx | ;; unused space to make it 16-byte aligned. + // | frame_size | + // +-----------------+ <---- SP + // (low address) + // + cur = m.createFrameSizeSlot(cur, m.frameSize()) + + linkInstr(cur, prevInitInst) +} + +func (m *machine) createReturnAddrAndSizeOfArgRetSlot(cur *instruction) *instruction { + // First we decrement the stack pointer to point the arg0 slot. + var sizeOfArgRetReg regalloc.VReg + s := m.currentABI.alignedArgResultStackSlotSize() + if s > 0 { + cur = m.lowerConstantI64AndInsert(cur, tmpRegVReg, s) + sizeOfArgRetReg = tmpRegVReg + + subSp := m.allocateInstr() + subSp.asALU(aluOpSub, operandNR(spVReg), operandNR(spVReg), operandNR(sizeOfArgRetReg), true) + cur = linkInstr(cur, subSp) + } else { + sizeOfArgRetReg = xzrVReg + } + + // Saves the return address (lr) and the size_of_arg_ret below the SP. + // size_of_arg_ret is used for stack unwinding. + pstr := m.allocateInstr() + amode := addressModePreOrPostIndex(spVReg, -16, true /* decrement before store */) + pstr.asStorePair64(lrVReg, sizeOfArgRetReg, amode) + cur = linkInstr(cur, pstr) + return cur +} + +func (m *machine) createFrameSizeSlot(cur *instruction, s int64) *instruction { + var frameSizeReg regalloc.VReg + if s > 0 { + cur = m.lowerConstantI64AndInsert(cur, tmpRegVReg, s) + frameSizeReg = tmpRegVReg + } else { + frameSizeReg = xzrVReg + } + _amode := addressModePreOrPostIndex(spVReg, + -16, // stack pointer must be 16-byte aligned. + true, // Decrement before store. + ) + store := m.allocateInstr() + store.asStore(operandNR(frameSizeReg), _amode, 64) + cur = linkInstr(cur, store) + return cur +} + +// SetupEpilogue implements backend.Machine. +func (m *machine) SetupEpilogue() { + for cur := m.rootInstr; cur != nil; cur = cur.next { + if cur.kind == ret { + m.setupEpilogueAfter(cur.prev) + continue + } + + // Removes the redundant copy instruction. + // TODO: doing this in `SetupEpilogue` seems weird. Find a better home. + if cur.IsCopy() && cur.rn.realReg() == cur.rd.realReg() { + prev, next := cur.prev, cur.next + // Remove the copy instruction. + prev.next = next + if next != nil { + next.prev = prev + } + } + } +} + +func (m *machine) setupEpilogueAfter(cur *instruction) { + prevNext := cur.next + + // We've stored the frame size in the prologue, and now that we are about to return from this function, we won't need it anymore. + cur = m.addsAddOrSubStackPointer(cur, spVReg, 16, true) + + if s := m.spillSlotSize; s > 0 { + // Adjust SP to the original value: + // + // (high address) (high address) + // +-----------------+ +-----------------+ + // | ....... | | ....... | + // | ret Y | | ret Y | + // | ....... | | ....... | + // | ret 0 | | ret 0 | + // | arg X | | arg X | + // | ....... | | ....... | + // | arg 1 | | arg 1 | + // | arg 0 | | arg 0 | + // | xxxxx | | xxxxx | + // | ReturnAddress | | ReturnAddress | + // +-----------------+ ====> +-----------------+ + // | clobbered M | | clobbered M | + // | ............ | | ............ | + // | clobbered 1 | | clobbered 1 | + // | clobbered 0 | | clobbered 0 | + // | spill slot N | +-----------------+ <---- SP + // | ............ | + // | spill slot 0 | + // SP---> +-----------------+ + // (low address) + // + cur = m.addsAddOrSubStackPointer(cur, spVReg, s, true) + } + + // First we need to restore the clobbered registers. + if len(m.clobberedRegs) > 0 { + // (high address) + // +-----------------+ +-----------------+ + // | ....... | | ....... | + // | ret Y | | ret Y | + // | ....... | | ....... | + // | ret 0 | | ret 0 | + // | arg X | | arg X | + // | ....... | | ....... | + // | arg 1 | | arg 1 | + // | arg 0 | | arg 0 | + // | xxxxx | | xxxxx | + // | ReturnAddress | | ReturnAddress | + // +-----------------+ ========> +-----------------+ <---- SP + // | clobbered M | + // | clobbered 1 | + // | ........... | + // | clobbered 0 | + // SP---> +-----------------+ + // (low address) + + l := len(m.clobberedRegs) - 1 + for i := range m.clobberedRegs { + vr := m.clobberedRegs[l-i] // reverse order to restore. + load := m.allocateInstr() + amode := addressModePreOrPostIndex(spVReg, + 16, // stack pointer must be 16-byte aligned. + false, // Increment after store. + ) + // TODO: pair loads to reduce the number of instructions. + switch regTypeToRegisterSizeInBits(vr.RegType()) { + case 64: // save int reg. + load.asULoad(operandNR(vr), amode, 64) + case 128: // save vector reg. + load.asFpuLoad(operandNR(vr), amode, 128) + } + cur = linkInstr(cur, load) + } + } + + // Reload the return address (lr). + // + // +-----------------+ +-----------------+ + // | ....... | | ....... | + // | ret Y | | ret Y | + // | ....... | | ....... | + // | ret 0 | | ret 0 | + // | arg X | | arg X | + // | ....... | ===> | ....... | + // | arg 1 | | arg 1 | + // | arg 0 | | arg 0 | + // | xxxxx | +-----------------+ <---- SP + // | ReturnAddress | + // SP----> +-----------------+ + + ldr := m.allocateInstr() + ldr.asULoad(operandNR(lrVReg), + addressModePreOrPostIndex(spVReg, 16 /* stack pointer must be 16-byte aligned. */, false /* increment after loads */), 64) + cur = linkInstr(cur, ldr) + + if s := m.currentABI.alignedArgResultStackSlotSize(); s > 0 { + cur = m.addsAddOrSubStackPointer(cur, spVReg, s, true) + } + + linkInstr(cur, prevNext) +} + +// saveRequiredRegs is the set of registers that must be saved/restored during growing stack when there's insufficient +// stack space left. Basically this is the combination of CalleeSavedRegisters plus argument registers execpt for x0, +// which always points to the execution context whenever the native code is entered from Go. +var saveRequiredRegs = []regalloc.VReg{ + x1VReg, x2VReg, x3VReg, x4VReg, x5VReg, x6VReg, x7VReg, + x19VReg, x20VReg, x21VReg, x22VReg, x23VReg, x24VReg, x25VReg, x26VReg, x28VReg, lrVReg, + v0VReg, v1VReg, v2VReg, v3VReg, v4VReg, v5VReg, v6VReg, v7VReg, + v18VReg, v19VReg, v20VReg, v21VReg, v22VReg, v23VReg, v24VReg, v25VReg, v26VReg, v27VReg, v28VReg, v29VReg, v30VReg, v31VReg, +} + +// insertStackBoundsCheck will insert the instructions after `cur` to check the +// stack bounds, and if there's no sufficient spaces required for the function, +// exit the execution and try growing it in Go world. +// +// TODO: we should be able to share the instructions across all the functions to reduce the size of compiled executable. +func (m *machine) insertStackBoundsCheck(requiredStackSize int64, cur *instruction) *instruction { + if requiredStackSize%16 != 0 { + panic("BUG") + } + + if immm12op, ok := asImm12Operand(uint64(requiredStackSize)); ok { + // sub tmp, sp, #requiredStackSize + sub := m.allocateInstr() + sub.asALU(aluOpSub, operandNR(tmpRegVReg), operandNR(spVReg), immm12op, true) + cur = linkInstr(cur, sub) + } else { + // This case, we first load the requiredStackSize into the temporary register, + cur = m.lowerConstantI64AndInsert(cur, tmpRegVReg, requiredStackSize) + // Then subtract it. + sub := m.allocateInstr() + sub.asALU(aluOpSub, operandNR(tmpRegVReg), operandNR(spVReg), operandNR(tmpRegVReg), true) + cur = linkInstr(cur, sub) + } + + tmp2 := x11VReg // Callee save, so it is safe to use it here in the prologue. + + // ldr tmp2, [executionContext #StackBottomPtr] + ldr := m.allocateInstr() + ldr.asULoad(operandNR(tmp2), addressMode{ + kind: addressModeKindRegUnsignedImm12, + rn: x0VReg, // execution context is always the first argument. + imm: wazevoapi.ExecutionContextOffsetStackBottomPtr.I64(), + }, 64) + cur = linkInstr(cur, ldr) + + // subs xzr, tmp, tmp2 + subs := m.allocateInstr() + subs.asALU(aluOpSubS, operandNR(xzrVReg), operandNR(tmpRegVReg), operandNR(tmp2), true) + cur = linkInstr(cur, subs) + + // b.ge #imm + cbr := m.allocateInstr() + cbr.asCondBr(ge.asCond(), invalidLabel, false /* ignored */) + cur = linkInstr(cur, cbr) + + // Set the required stack size and set it to the exec context. + { + // First load the requiredStackSize into the temporary register, + cur = m.lowerConstantI64AndInsert(cur, tmpRegVReg, requiredStackSize) + setRequiredStackSize := m.allocateInstr() + setRequiredStackSize.asStore(operandNR(tmpRegVReg), + addressMode{ + kind: addressModeKindRegUnsignedImm12, + // Execution context is always the first argument. + rn: x0VReg, imm: wazevoapi.ExecutionContextOffsetStackGrowRequiredSize.I64(), + }, 64) + + cur = linkInstr(cur, setRequiredStackSize) + } + + ldrAddress := m.allocateInstr() + ldrAddress.asULoad(operandNR(tmpRegVReg), addressMode{ + kind: addressModeKindRegUnsignedImm12, + rn: x0VReg, // execution context is always the first argument + imm: wazevoapi.ExecutionContextOffsetStackGrowCallTrampolineAddress.I64(), + }, 64) + cur = linkInstr(cur, ldrAddress) + + // Then jumps to the stack grow call sequence's address, meaning + // transferring the control to the code compiled by CompileStackGrowCallSequence. + bl := m.allocateInstr() + bl.asCallIndirect(tmpRegVReg, nil) + cur = linkInstr(cur, bl) + + // Now that we know the entire code, we can finalize how many bytes + // we have to skip when the stack size is sufficient. + var cbrOffset int64 + for _cur := cbr; ; _cur = _cur.next { + cbrOffset += _cur.size() + if _cur == cur { + break + } + } + cbr.condBrOffsetResolve(cbrOffset) + return cur +} + +// CompileStackGrowCallSequence implements backend.Machine. +func (m *machine) CompileStackGrowCallSequence() []byte { + cur := m.allocateInstr() + cur.asNop0() + m.rootInstr = cur + + // Save the callee saved and argument registers. + cur = m.saveRegistersInExecutionContext(cur, saveRequiredRegs) + + // Save the current stack pointer. + cur = m.saveCurrentStackPointer(cur, x0VReg) + + // Set the exit status on the execution context. + cur = m.setExitCode(cur, x0VReg, wazevoapi.ExitCodeGrowStack) + + // Exit the execution. + cur = m.storeReturnAddressAndExit(cur) + + // After the exit, restore the saved registers. + cur = m.restoreRegistersInExecutionContext(cur, saveRequiredRegs) + + // Then goes back the original address of this stack grow call. + ret := m.allocateInstr() + ret.asRet(nil) + linkInstr(cur, ret) + + m.encode(m.rootInstr) + return m.compiler.Buf() +} + +func (m *machine) addsAddOrSubStackPointer(cur *instruction, rd regalloc.VReg, diff int64, add bool) *instruction { + m.pendingInstructions = m.pendingInstructions[:0] + m.insertAddOrSubStackPointer(rd, diff, add) + for _, inserted := range m.pendingInstructions { + cur = linkInstr(cur, inserted) + } + return cur +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/machine_regalloc.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/machine_regalloc.go new file mode 100644 index 000000000..eaa5f479c --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/machine_regalloc.go @@ -0,0 +1,433 @@ +package arm64 + +// This file implements the interfaces required for register allocations. See regalloc/api.go. + +import ( + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc" + "github.com/tetratelabs/wazero/internal/engine/wazevo/ssa" +) + +type ( + // regAllocFunctionImpl implements regalloc.Function. + regAllocFunctionImpl struct { + m *machine + // iter is the iterator for reversePostOrderBlocks + iter int + reversePostOrderBlocks []regAllocBlockImpl + // labelToRegAllocBlockIndex maps label to the index of reversePostOrderBlocks. + labelToRegAllocBlockIndex map[label]int + loopNestingForestRoots []ssa.BasicBlock + } + + // regAllocBlockImpl implements regalloc.Block. + regAllocBlockImpl struct { + // f is the function this instruction belongs to. Used to reuse the regAllocFunctionImpl.predsSlice slice for Defs() and Uses(). + f *regAllocFunctionImpl + sb ssa.BasicBlock + l label + pos *labelPosition + loopNestingForestChildren []ssa.BasicBlock + cur *instruction + id int + cachedLastInstr regalloc.Instr + } +) + +func (f *regAllocFunctionImpl) addBlock(sb ssa.BasicBlock, l label, pos *labelPosition) { + i := len(f.reversePostOrderBlocks) + f.reversePostOrderBlocks = append(f.reversePostOrderBlocks, regAllocBlockImpl{ + f: f, + sb: sb, + l: l, + pos: pos, + id: int(sb.ID()), + }) + f.labelToRegAllocBlockIndex[l] = i +} + +func (f *regAllocFunctionImpl) reset() { + f.reversePostOrderBlocks = f.reversePostOrderBlocks[:0] + f.iter = 0 +} + +var ( + _ regalloc.Function = (*regAllocFunctionImpl)(nil) + _ regalloc.Block = (*regAllocBlockImpl)(nil) +) + +// PostOrderBlockIteratorBegin implements regalloc.Function PostOrderBlockIteratorBegin. +func (f *regAllocFunctionImpl) PostOrderBlockIteratorBegin() regalloc.Block { + f.iter = len(f.reversePostOrderBlocks) - 1 + return f.PostOrderBlockIteratorNext() +} + +// PostOrderBlockIteratorNext implements regalloc.Function PostOrderBlockIteratorNext. +func (f *regAllocFunctionImpl) PostOrderBlockIteratorNext() regalloc.Block { + if f.iter < 0 { + return nil + } + b := &f.reversePostOrderBlocks[f.iter] + f.iter-- + return b +} + +// ReversePostOrderBlockIteratorBegin implements regalloc.Function ReversePostOrderBlockIteratorBegin. +func (f *regAllocFunctionImpl) ReversePostOrderBlockIteratorBegin() regalloc.Block { + f.iter = 0 + return f.ReversePostOrderBlockIteratorNext() +} + +// ReversePostOrderBlockIteratorNext implements regalloc.Function ReversePostOrderBlockIteratorNext. +func (f *regAllocFunctionImpl) ReversePostOrderBlockIteratorNext() regalloc.Block { + if f.iter >= len(f.reversePostOrderBlocks) { + return nil + } + b := &f.reversePostOrderBlocks[f.iter] + f.iter++ + return b +} + +// ClobberedRegisters implements regalloc.Function ClobberedRegisters. +func (f *regAllocFunctionImpl) ClobberedRegisters(regs []regalloc.VReg) { + m := f.m + m.clobberedRegs = append(m.clobberedRegs[:0], regs...) +} + +// StoreRegisterBefore implements regalloc.Function StoreRegisterBefore. +func (f *regAllocFunctionImpl) StoreRegisterBefore(v regalloc.VReg, instr regalloc.Instr) { + m := f.m + m.insertStoreRegisterAt(v, instr.(*instruction), false) +} + +// SwapAtEndOfBlock implements regalloc.Function SwapAtEndOfBlock. +func (f *regAllocFunctionImpl) SwapAtEndOfBlock(x1, x2, tmp regalloc.VReg, block regalloc.Block) { + blk := block.(*regAllocBlockImpl) + cur := blk.LastInstr().(*instruction) + cur = cur.prev + f.m.swap(cur, x1, x2, tmp) +} + +func (m *machine) swap(cur *instruction, x1, x2, tmp regalloc.VReg) { + prevNext := cur.next + var mov1, mov2, mov3 *instruction + if x1.RegType() == regalloc.RegTypeInt { + if !tmp.Valid() { + tmp = tmpRegVReg + } + mov1 = m.allocateInstr().asMove64(tmp, x1) + mov2 = m.allocateInstr().asMove64(x1, x2) + mov3 = m.allocateInstr().asMove64(x2, tmp) + cur = linkInstr(cur, mov1) + cur = linkInstr(cur, mov2) + cur = linkInstr(cur, mov3) + linkInstr(cur, prevNext) + } else { + if !tmp.Valid() { + r2 := x2.RealReg() + // Temporarily spill x1 to stack. + cur = m.insertStoreRegisterAt(x1, cur, true).prev + // Then move x2 to x1. + cur = linkInstr(cur, m.allocateInstr().asFpuMov128(x1, x2)) + linkInstr(cur, prevNext) + // Then reload the original value on x1 from stack to r2. + m.insertReloadRegisterAt(x1.SetRealReg(r2), cur, true) + } else { + mov1 = m.allocateInstr().asFpuMov128(tmp, x1) + mov2 = m.allocateInstr().asFpuMov128(x1, x2) + mov3 = m.allocateInstr().asFpuMov128(x2, tmp) + cur = linkInstr(cur, mov1) + cur = linkInstr(cur, mov2) + cur = linkInstr(cur, mov3) + linkInstr(cur, prevNext) + } + } +} + +// InsertMoveBefore implements regalloc.Function InsertMoveBefore. +func (f *regAllocFunctionImpl) InsertMoveBefore(dst, src regalloc.VReg, instr regalloc.Instr) { + m := f.m + + typ := src.RegType() + if typ != dst.RegType() { + panic("BUG: src and dst must have the same type") + } + + mov := m.allocateInstr() + if typ == regalloc.RegTypeInt { + mov.asMove64(dst, src) + } else { + mov.asFpuMov128(dst, src) + } + + cur := instr.(*instruction).prev + prevNext := cur.next + cur = linkInstr(cur, mov) + linkInstr(cur, prevNext) +} + +// StoreRegisterAfter implements regalloc.Function StoreRegisterAfter. +func (f *regAllocFunctionImpl) StoreRegisterAfter(v regalloc.VReg, instr regalloc.Instr) { + m := f.m + m.insertStoreRegisterAt(v, instr.(*instruction), true) +} + +// ReloadRegisterBefore implements regalloc.Function ReloadRegisterBefore. +func (f *regAllocFunctionImpl) ReloadRegisterBefore(v regalloc.VReg, instr regalloc.Instr) { + m := f.m + m.insertReloadRegisterAt(v, instr.(*instruction), false) +} + +// ReloadRegisterAfter implements regalloc.Function ReloadRegisterAfter. +func (f *regAllocFunctionImpl) ReloadRegisterAfter(v regalloc.VReg, instr regalloc.Instr) { + m := f.m + m.insertReloadRegisterAt(v, instr.(*instruction), true) +} + +// Done implements regalloc.Function Done. +func (f *regAllocFunctionImpl) Done() { + m := f.m + // Now that we know the final spill slot size, we must align spillSlotSize to 16 bytes. + m.spillSlotSize = (m.spillSlotSize + 15) &^ 15 +} + +// ID implements regalloc.Block ID. +func (r *regAllocBlockImpl) ID() int { + return r.id +} + +// Preds implements regalloc.Block Preds. +func (r *regAllocBlockImpl) Preds() int { + return r.sb.Preds() +} + +// Pred implements regalloc.Block Pred. +func (r *regAllocBlockImpl) Pred(i int) regalloc.Block { + sb := r.sb + pred := sb.Pred(i) + l := r.f.m.ssaBlockIDToLabels[pred.ID()] + index := r.f.labelToRegAllocBlockIndex[l] + return &r.f.reversePostOrderBlocks[index] +} + +// Succs implements regalloc.Block Succs. +func (r *regAllocBlockImpl) Succs() int { + return r.sb.Succs() +} + +// Succ implements regalloc.Block Succ. +func (r *regAllocBlockImpl) Succ(i int) regalloc.Block { + sb := r.sb + succ := sb.Succ(i) + if succ.ReturnBlock() { + return nil + } + l := r.f.m.ssaBlockIDToLabels[succ.ID()] + index := r.f.labelToRegAllocBlockIndex[l] + return &r.f.reversePostOrderBlocks[index] +} + +// LoopHeader implements regalloc.Block LoopHeader. +func (r *regAllocBlockImpl) LoopHeader() bool { + return r.sb.LoopHeader() +} + +// LoopNestingForestRoots implements regalloc.Function LoopNestingForestRoots. +func (f *regAllocFunctionImpl) LoopNestingForestRoots() int { + f.loopNestingForestRoots = f.m.compiler.SSABuilder().LoopNestingForestRoots() + return len(f.loopNestingForestRoots) +} + +// LoopNestingForestRoot implements regalloc.Function LoopNestingForestRoot. +func (f *regAllocFunctionImpl) LoopNestingForestRoot(i int) regalloc.Block { + blk := f.loopNestingForestRoots[i] + l := f.m.ssaBlockIDToLabels[blk.ID()] + index := f.labelToRegAllocBlockIndex[l] + return &f.reversePostOrderBlocks[index] +} + +// LoopNestingForestChildren implements regalloc.Block LoopNestingForestChildren. +func (r *regAllocBlockImpl) LoopNestingForestChildren() int { + r.loopNestingForestChildren = r.sb.LoopNestingForestChildren() + return len(r.loopNestingForestChildren) +} + +// LoopNestingForestChild implements regalloc.Block LoopNestingForestChild. +func (r *regAllocBlockImpl) LoopNestingForestChild(i int) regalloc.Block { + blk := r.loopNestingForestChildren[i] + l := r.f.m.ssaBlockIDToLabels[blk.ID()] + index := r.f.labelToRegAllocBlockIndex[l] + return &r.f.reversePostOrderBlocks[index] +} + +// InstrIteratorBegin implements regalloc.Block InstrIteratorBegin. +func (r *regAllocBlockImpl) InstrIteratorBegin() regalloc.Instr { + r.cur = r.pos.begin + return r.cur +} + +// InstrIteratorNext implements regalloc.Block InstrIteratorNext. +func (r *regAllocBlockImpl) InstrIteratorNext() regalloc.Instr { + for { + if r.cur == r.pos.end { + return nil + } + instr := r.cur.next + r.cur = instr + if instr == nil { + return nil + } else if instr.addedBeforeRegAlloc { + // Only concerned about the instruction added before regalloc. + return instr + } + } +} + +// InstrRevIteratorBegin implements regalloc.Block InstrRevIteratorBegin. +func (r *regAllocBlockImpl) InstrRevIteratorBegin() regalloc.Instr { + r.cur = r.pos.end + return r.cur +} + +// InstrRevIteratorNext implements regalloc.Block InstrRevIteratorNext. +func (r *regAllocBlockImpl) InstrRevIteratorNext() regalloc.Instr { + for { + if r.cur == r.pos.begin { + return nil + } + instr := r.cur.prev + r.cur = instr + if instr == nil { + return nil + } else if instr.addedBeforeRegAlloc { + // Only concerned about the instruction added before regalloc. + return instr + } + } +} + +// BlockParams implements regalloc.Block BlockParams. +func (r *regAllocBlockImpl) BlockParams(regs *[]regalloc.VReg) []regalloc.VReg { + c := r.f.m.compiler + *regs = (*regs)[:0] + for i := 0; i < r.sb.Params(); i++ { + v := c.VRegOf(r.sb.Param(i)) + *regs = append(*regs, v) + } + return *regs +} + +// Entry implements regalloc.Block Entry. +func (r *regAllocBlockImpl) Entry() bool { return r.sb.EntryBlock() } + +// RegisterInfo implements backend.Machine. +func (m *machine) RegisterInfo() *regalloc.RegisterInfo { + return regInfo +} + +// Function implements backend.Machine Function. +func (m *machine) Function() regalloc.Function { + m.regAllocStarted = true + return &m.regAllocFn +} + +func (m *machine) insertStoreRegisterAt(v regalloc.VReg, instr *instruction, after bool) *instruction { + if !v.IsRealReg() { + panic("BUG: VReg must be backed by real reg to be stored") + } + + typ := m.compiler.TypeOf(v) + + var prevNext, cur *instruction + if after { + cur, prevNext = instr, instr.next + } else { + cur, prevNext = instr.prev, instr + } + + offsetFromSP := m.getVRegSpillSlotOffsetFromSP(v.ID(), typ.Size()) + var amode addressMode + cur, amode = m.resolveAddressModeForOffsetAndInsert(cur, offsetFromSP, typ.Bits(), spVReg, true) + store := m.allocateInstr() + store.asStore(operandNR(v), amode, typ.Bits()) + + cur = linkInstr(cur, store) + return linkInstr(cur, prevNext) +} + +func (m *machine) insertReloadRegisterAt(v regalloc.VReg, instr *instruction, after bool) *instruction { + if !v.IsRealReg() { + panic("BUG: VReg must be backed by real reg to be stored") + } + + typ := m.compiler.TypeOf(v) + + var prevNext, cur *instruction + if after { + cur, prevNext = instr, instr.next + } else { + cur, prevNext = instr.prev, instr + } + + offsetFromSP := m.getVRegSpillSlotOffsetFromSP(v.ID(), typ.Size()) + var amode addressMode + cur, amode = m.resolveAddressModeForOffsetAndInsert(cur, offsetFromSP, typ.Bits(), spVReg, true) + load := m.allocateInstr() + switch typ { + case ssa.TypeI32, ssa.TypeI64: + load.asULoad(operandNR(v), amode, typ.Bits()) + case ssa.TypeF32, ssa.TypeF64: + load.asFpuLoad(operandNR(v), amode, typ.Bits()) + case ssa.TypeV128: + load.asFpuLoad(operandNR(v), amode, 128) + default: + panic("TODO") + } + + cur = linkInstr(cur, load) + return linkInstr(cur, prevNext) +} + +// LowestCommonAncestor implements regalloc.Function LowestCommonAncestor. +func (f *regAllocFunctionImpl) LowestCommonAncestor(blk1, blk2 regalloc.Block) regalloc.Block { + ret := f.m.compiler.SSABuilder().LowestCommonAncestor(blk1.(*regAllocBlockImpl).sb, blk2.(*regAllocBlockImpl).sb) + l := f.m.ssaBlockIDToLabels[ret.ID()] + index := f.labelToRegAllocBlockIndex[l] + return &f.reversePostOrderBlocks[index] +} + +func (f *regAllocFunctionImpl) Idom(blk regalloc.Block) regalloc.Block { + builder := f.m.compiler.SSABuilder() + idom := builder.Idom(blk.(*regAllocBlockImpl).sb) + if idom == nil { + panic("BUG: idom must not be nil") + } + l := f.m.ssaBlockIDToLabels[idom.ID()] + index := f.labelToRegAllocBlockIndex[l] + return &f.reversePostOrderBlocks[index] +} + +// FirstInstr implements regalloc.Block FirstInstr. +func (r *regAllocBlockImpl) FirstInstr() regalloc.Instr { + return r.pos.begin +} + +// LastInstr implements regalloc.Block LastInstr. +func (r *regAllocBlockImpl) LastInstr() regalloc.Instr { + if r.cachedLastInstr == nil { + cur := r.pos.end + for cur.kind == nop0 { + cur = cur.prev + if cur == r.pos.begin { + r.cachedLastInstr = r.pos.end + return r.cachedLastInstr + } + } + switch cur.kind { + case br: + r.cachedLastInstr = cur + default: + r.cachedLastInstr = r.pos.end + } + } + return r.cachedLastInstr +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/machine_relocation.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/machine_relocation.go new file mode 100644 index 000000000..37d72667c --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/machine_relocation.go @@ -0,0 +1,28 @@ +package arm64 + +import ( + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend" + "github.com/tetratelabs/wazero/internal/engine/wazevo/ssa" +) + +// ResolveRelocations implements backend.Machine ResolveRelocations. +// +// TODO: unit test! +func (m *machine) ResolveRelocations(refToBinaryOffset map[ssa.FuncRef]int, binary []byte, relocations []backend.RelocationInfo) { + for _, r := range relocations { + instrOffset := r.Offset + calleeFnOffset := refToBinaryOffset[r.FuncRef] + brInstr := binary[instrOffset : instrOffset+4] + diff := int64(calleeFnOffset) - (instrOffset) + // https://developer.arm.com/documentation/ddi0596/2020-12/Base-Instructions/BL--Branch-with-Link- + imm26 := diff / 4 + brInstr[0] = byte(imm26) + brInstr[1] = byte(imm26 >> 8) + brInstr[2] = byte(imm26 >> 16) + if diff < 0 { + brInstr[3] = (byte(imm26 >> 24 & 0b000000_01)) | 0b100101_10 // Set sign bit. + } else { + brInstr[3] = (byte(imm26 >> 24 & 0b000000_01)) | 0b100101_00 // No sign bit. + } + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/reg.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/reg.go new file mode 100644 index 000000000..45737516d --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/reg.go @@ -0,0 +1,397 @@ +package arm64 + +import ( + "fmt" + "strconv" + "strings" + + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc" +) + +// Arm64-specific registers. +// +// See https://developer.arm.com/documentation/dui0801/a/Overview-of-AArch64-state/Predeclared-core-register-names-in-AArch64-state + +const ( + // General purpose registers. Note that we do not distinguish wn and xn registers + // because they are the same from the perspective of register allocator, and + // the size can be determined by the type of the instruction. + + x0 = regalloc.RealRegInvalid + 1 + iota + x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12 + x13 + x14 + x15 + x16 + x17 + x18 + x19 + x20 + x21 + x22 + x23 + x24 + x25 + x26 + x27 + x28 + x29 + x30 + + // Vector registers. Note that we do not distinguish vn and dn, ... registers + // because they are the same from the perspective of register allocator, and + // the size can be determined by the type of the instruction. + + v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12 + v13 + v14 + v15 + v16 + v17 + v18 + v19 + v20 + v21 + v22 + v23 + v24 + v25 + v26 + v27 + v28 + v29 + v30 + v31 + + // Special registers + + xzr + sp + lr = x30 + fp = x29 + tmp = x27 +) + +var ( + x0VReg = regalloc.FromRealReg(x0, regalloc.RegTypeInt) + x1VReg = regalloc.FromRealReg(x1, regalloc.RegTypeInt) + x2VReg = regalloc.FromRealReg(x2, regalloc.RegTypeInt) + x3VReg = regalloc.FromRealReg(x3, regalloc.RegTypeInt) + x4VReg = regalloc.FromRealReg(x4, regalloc.RegTypeInt) + x5VReg = regalloc.FromRealReg(x5, regalloc.RegTypeInt) + x6VReg = regalloc.FromRealReg(x6, regalloc.RegTypeInt) + x7VReg = regalloc.FromRealReg(x7, regalloc.RegTypeInt) + x8VReg = regalloc.FromRealReg(x8, regalloc.RegTypeInt) + x9VReg = regalloc.FromRealReg(x9, regalloc.RegTypeInt) + x10VReg = regalloc.FromRealReg(x10, regalloc.RegTypeInt) + x11VReg = regalloc.FromRealReg(x11, regalloc.RegTypeInt) + x12VReg = regalloc.FromRealReg(x12, regalloc.RegTypeInt) + x13VReg = regalloc.FromRealReg(x13, regalloc.RegTypeInt) + x14VReg = regalloc.FromRealReg(x14, regalloc.RegTypeInt) + x15VReg = regalloc.FromRealReg(x15, regalloc.RegTypeInt) + x16VReg = regalloc.FromRealReg(x16, regalloc.RegTypeInt) + x17VReg = regalloc.FromRealReg(x17, regalloc.RegTypeInt) + x18VReg = regalloc.FromRealReg(x18, regalloc.RegTypeInt) + x19VReg = regalloc.FromRealReg(x19, regalloc.RegTypeInt) + x20VReg = regalloc.FromRealReg(x20, regalloc.RegTypeInt) + x21VReg = regalloc.FromRealReg(x21, regalloc.RegTypeInt) + x22VReg = regalloc.FromRealReg(x22, regalloc.RegTypeInt) + x23VReg = regalloc.FromRealReg(x23, regalloc.RegTypeInt) + x24VReg = regalloc.FromRealReg(x24, regalloc.RegTypeInt) + x25VReg = regalloc.FromRealReg(x25, regalloc.RegTypeInt) + x26VReg = regalloc.FromRealReg(x26, regalloc.RegTypeInt) + x27VReg = regalloc.FromRealReg(x27, regalloc.RegTypeInt) + x28VReg = regalloc.FromRealReg(x28, regalloc.RegTypeInt) + x29VReg = regalloc.FromRealReg(x29, regalloc.RegTypeInt) + x30VReg = regalloc.FromRealReg(x30, regalloc.RegTypeInt) + v0VReg = regalloc.FromRealReg(v0, regalloc.RegTypeFloat) + v1VReg = regalloc.FromRealReg(v1, regalloc.RegTypeFloat) + v2VReg = regalloc.FromRealReg(v2, regalloc.RegTypeFloat) + v3VReg = regalloc.FromRealReg(v3, regalloc.RegTypeFloat) + v4VReg = regalloc.FromRealReg(v4, regalloc.RegTypeFloat) + v5VReg = regalloc.FromRealReg(v5, regalloc.RegTypeFloat) + v6VReg = regalloc.FromRealReg(v6, regalloc.RegTypeFloat) + v7VReg = regalloc.FromRealReg(v7, regalloc.RegTypeFloat) + v8VReg = regalloc.FromRealReg(v8, regalloc.RegTypeFloat) + v9VReg = regalloc.FromRealReg(v9, regalloc.RegTypeFloat) + v10VReg = regalloc.FromRealReg(v10, regalloc.RegTypeFloat) + v11VReg = regalloc.FromRealReg(v11, regalloc.RegTypeFloat) + v12VReg = regalloc.FromRealReg(v12, regalloc.RegTypeFloat) + v13VReg = regalloc.FromRealReg(v13, regalloc.RegTypeFloat) + v14VReg = regalloc.FromRealReg(v14, regalloc.RegTypeFloat) + v15VReg = regalloc.FromRealReg(v15, regalloc.RegTypeFloat) + v16VReg = regalloc.FromRealReg(v16, regalloc.RegTypeFloat) + v17VReg = regalloc.FromRealReg(v17, regalloc.RegTypeFloat) + v18VReg = regalloc.FromRealReg(v18, regalloc.RegTypeFloat) + v19VReg = regalloc.FromRealReg(v19, regalloc.RegTypeFloat) + v20VReg = regalloc.FromRealReg(v20, regalloc.RegTypeFloat) + v21VReg = regalloc.FromRealReg(v21, regalloc.RegTypeFloat) + v22VReg = regalloc.FromRealReg(v22, regalloc.RegTypeFloat) + v23VReg = regalloc.FromRealReg(v23, regalloc.RegTypeFloat) + v24VReg = regalloc.FromRealReg(v24, regalloc.RegTypeFloat) + v25VReg = regalloc.FromRealReg(v25, regalloc.RegTypeFloat) + v26VReg = regalloc.FromRealReg(v26, regalloc.RegTypeFloat) + v27VReg = regalloc.FromRealReg(v27, regalloc.RegTypeFloat) + // lr (link register) holds the return address at the function entry. + lrVReg = x30VReg + // tmpReg is used to perform spill/load on large stack offsets, and load large constants. + // Therefore, be cautious to use this register in the middle of the compilation, especially before the register allocation. + // This is the same as golang/go, but it's only described in the source code: + // https://github.com/golang/go/blob/18e17e2cb12837ea2c8582ecdb0cc780f49a1aac/src/cmd/compile/internal/ssa/_gen/ARM64Ops.go#L59 + // https://github.com/golang/go/blob/18e17e2cb12837ea2c8582ecdb0cc780f49a1aac/src/cmd/compile/internal/ssa/_gen/ARM64Ops.go#L13-L15 + tmpRegVReg = regalloc.FromRealReg(tmp, regalloc.RegTypeInt) + v28VReg = regalloc.FromRealReg(v28, regalloc.RegTypeFloat) + v29VReg = regalloc.FromRealReg(v29, regalloc.RegTypeFloat) + v30VReg = regalloc.FromRealReg(v30, regalloc.RegTypeFloat) + v31VReg = regalloc.FromRealReg(v31, regalloc.RegTypeFloat) + xzrVReg = regalloc.FromRealReg(xzr, regalloc.RegTypeInt) + spVReg = regalloc.FromRealReg(sp, regalloc.RegTypeInt) + fpVReg = regalloc.FromRealReg(fp, regalloc.RegTypeInt) +) + +var regNames = [...]string{ + x0: "x0", + x1: "x1", + x2: "x2", + x3: "x3", + x4: "x4", + x5: "x5", + x6: "x6", + x7: "x7", + x8: "x8", + x9: "x9", + x10: "x10", + x11: "x11", + x12: "x12", + x13: "x13", + x14: "x14", + x15: "x15", + x16: "x16", + x17: "x17", + x18: "x18", + x19: "x19", + x20: "x20", + x21: "x21", + x22: "x22", + x23: "x23", + x24: "x24", + x25: "x25", + x26: "x26", + x27: "x27", + x28: "x28", + x29: "x29", + x30: "x30", + xzr: "xzr", + sp: "sp", + v0: "v0", + v1: "v1", + v2: "v2", + v3: "v3", + v4: "v4", + v5: "v5", + v6: "v6", + v7: "v7", + v8: "v8", + v9: "v9", + v10: "v10", + v11: "v11", + v12: "v12", + v13: "v13", + v14: "v14", + v15: "v15", + v16: "v16", + v17: "v17", + v18: "v18", + v19: "v19", + v20: "v20", + v21: "v21", + v22: "v22", + v23: "v23", + v24: "v24", + v25: "v25", + v26: "v26", + v27: "v27", + v28: "v28", + v29: "v29", + v30: "v30", + v31: "v31", +} + +func formatVRegSized(r regalloc.VReg, size byte) (ret string) { + if r.IsRealReg() { + ret = regNames[r.RealReg()] + switch ret[0] { + case 'x': + switch size { + case 32: + ret = strings.Replace(ret, "x", "w", 1) + case 64: + default: + panic("BUG: invalid register size: " + strconv.Itoa(int(size))) + } + case 'v': + switch size { + case 32: + ret = strings.Replace(ret, "v", "s", 1) + case 64: + ret = strings.Replace(ret, "v", "d", 1) + case 128: + ret = strings.Replace(ret, "v", "q", 1) + default: + panic("BUG: invalid register size") + } + } + } else { + switch r.RegType() { + case regalloc.RegTypeInt: + switch size { + case 32: + ret = fmt.Sprintf("w%d?", r.ID()) + case 64: + ret = fmt.Sprintf("x%d?", r.ID()) + default: + panic("BUG: invalid register size: " + strconv.Itoa(int(size))) + } + case regalloc.RegTypeFloat: + switch size { + case 32: + ret = fmt.Sprintf("s%d?", r.ID()) + case 64: + ret = fmt.Sprintf("d%d?", r.ID()) + case 128: + ret = fmt.Sprintf("q%d?", r.ID()) + default: + panic("BUG: invalid register size") + } + default: + panic(fmt.Sprintf("BUG: invalid register type: %d for %s", r.RegType(), r)) + } + } + return +} + +func formatVRegWidthVec(r regalloc.VReg, width vecArrangement) (ret string) { + var id string + wspec := strings.ToLower(width.String()) + if r.IsRealReg() { + id = regNames[r.RealReg()][1:] + } else { + id = fmt.Sprintf("%d?", r.ID()) + } + ret = fmt.Sprintf("%s%s", wspec, id) + return +} + +func formatVRegVec(r regalloc.VReg, arr vecArrangement, index vecIndex) (ret string) { + id := fmt.Sprintf("v%d?", r.ID()) + if r.IsRealReg() { + id = regNames[r.RealReg()] + } + ret = fmt.Sprintf("%s.%s", id, strings.ToLower(arr.String())) + if index != vecIndexNone { + ret += fmt.Sprintf("[%d]", index) + } + return +} + +func regTypeToRegisterSizeInBits(r regalloc.RegType) byte { + switch r { + case regalloc.RegTypeInt: + return 64 + case regalloc.RegTypeFloat: + return 128 + default: + panic("BUG: invalid register type") + } +} + +var regNumberInEncoding = [...]uint32{ + x0: 0, + x1: 1, + x2: 2, + x3: 3, + x4: 4, + x5: 5, + x6: 6, + x7: 7, + x8: 8, + x9: 9, + x10: 10, + x11: 11, + x12: 12, + x13: 13, + x14: 14, + x15: 15, + x16: 16, + x17: 17, + x18: 18, + x19: 19, + x20: 20, + x21: 21, + x22: 22, + x23: 23, + x24: 24, + x25: 25, + x26: 26, + x27: 27, + x28: 28, + x29: 29, + x30: 30, + xzr: 31, + sp: 31, + v0: 0, + v1: 1, + v2: 2, + v3: 3, + v4: 4, + v5: 5, + v6: 6, + v7: 7, + v8: 8, + v9: 9, + v10: 10, + v11: 11, + v12: 12, + v13: 13, + v14: 14, + v15: 15, + v16: 16, + v17: 17, + v18: 18, + v19: 19, + v20: 20, + v21: 21, + v22: 22, + v23: 23, + v24: 24, + v25: 25, + v26: 26, + v27: 27, + v28: 28, + v29: 29, + v30: 30, + v31: 31, +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/unwind_stack.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/unwind_stack.go new file mode 100644 index 000000000..3f5e79f3e --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64/unwind_stack.go @@ -0,0 +1,86 @@ +package arm64 + +import ( + "encoding/binary" + "reflect" + "unsafe" +) + +// UnwindStack is a function to unwind the stack, and appends return addresses to `returnAddresses` slice. +// The implementation must be aligned with the ABI/Calling convention as in machine_pro_epi_logue.go/abi.go. +func UnwindStack(sp, top uintptr, returnAddresses []uintptr) []uintptr { + l := int(top - sp) + + var stackBuf []byte + { + // TODO: use unsafe.Slice after floor version is set to Go 1.20. + hdr := (*reflect.SliceHeader)(unsafe.Pointer(&stackBuf)) + hdr.Data = sp + hdr.Len = l + hdr.Cap = l + } + + for i := uint64(0); i < uint64(l); { + // (high address) + // +-----------------+ + // | ....... | + // | ret Y | <----+ + // | ....... | | + // | ret 0 | | + // | arg X | | size_of_arg_ret + // | ....... | | + // | arg 1 | | + // | arg 0 | <----+ + // | size_of_arg_ret | + // | ReturnAddress | + // +-----------------+ <----+ + // | ........... | | + // | spill slot M | | + // | ............ | | + // | spill slot 2 | | + // | spill slot 1 | | frame size + // | spill slot 1 | | + // | clobbered N | | + // | ............ | | + // | clobbered 0 | <----+ + // | xxxxxx | ;; unused space to make it 16-byte aligned. + // | frame_size | + // +-----------------+ <---- SP + // (low address) + + frameSize := binary.LittleEndian.Uint64(stackBuf[i:]) + i += frameSize + + 16 // frame size + aligned space. + retAddr := binary.LittleEndian.Uint64(stackBuf[i:]) + i += 8 // ret addr. + sizeOfArgRet := binary.LittleEndian.Uint64(stackBuf[i:]) + i += 8 + sizeOfArgRet + returnAddresses = append(returnAddresses, uintptr(retAddr)) + } + return returnAddresses +} + +// GoCallStackView is a function to get a view of the stack before a Go call, which +// is the view of the stack allocated in CompileGoFunctionTrampoline. +func GoCallStackView(stackPointerBeforeGoCall *uint64) []uint64 { + // (high address) + // +-----------------+ <----+ + // | xxxxxxxxxxx | | ;; optional unused space to make it 16-byte aligned. + // ^ | arg[N]/ret[M] | | + // sliceSize | | ............ | | sliceSize + // | | arg[1]/ret[1] | | + // v | arg[0]/ret[0] | <----+ + // | sliceSize | + // | frame_size | + // +-----------------+ <---- stackPointerBeforeGoCall + // (low address) + size := *(*uint64)(unsafe.Pointer(uintptr(unsafe.Pointer(stackPointerBeforeGoCall)) + 8)) + var view []uint64 + { + sh := (*reflect.SliceHeader)(unsafe.Pointer(&view)) + sh.Data = uintptr(unsafe.Pointer(stackPointerBeforeGoCall)) + 16 // skips the (frame_size, sliceSize). + sh.Len = int(size) + sh.Cap = int(size) + } + return view +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/machine.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/machine.go new file mode 100644 index 000000000..c94ac577d --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/machine.go @@ -0,0 +1,113 @@ +package backend + +import ( + "context" + + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc" + "github.com/tetratelabs/wazero/internal/engine/wazevo/ssa" + "github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi" +) + +type ( + // Machine is a backend for a specific ISA machine. + Machine interface { + // DisableStackCheck disables the stack check for the current compilation for debugging/testing. + DisableStackCheck() + + // RegisterInfo returns the set of registers that can be used for register allocation. + // This is only called once, and the result is shared across all compilations. + RegisterInfo() *regalloc.RegisterInfo + + // InitializeABI initializes the FunctionABI for the given signature. + InitializeABI(sig *ssa.Signature) + + // ABI returns the FunctionABI used for the currently compiled function. + ABI() FunctionABI + + // SetCompiler sets the compilation context used for the lifetime of Machine. + // This is only called once per Machine, i.e. before the first compilation. + SetCompiler(Compiler) + + // StartLoweringFunction is called when the lowering of the given function is started. + // maximumBlockID is the maximum value of ssa.BasicBlockID existing in the function. + StartLoweringFunction(maximumBlockID ssa.BasicBlockID) + + // StartBlock is called when the compilation of the given block is started. + // The order of this being called is the reverse post order of the ssa.BasicBlock(s) as we iterate with + // ssa.Builder BlockIteratorReversePostOrderBegin and BlockIteratorReversePostOrderEnd. + StartBlock(ssa.BasicBlock) + + // LowerSingleBranch is called when the compilation of the given single branch is started. + LowerSingleBranch(b *ssa.Instruction) + + // LowerConditionalBranch is called when the compilation of the given conditional branch is started. + LowerConditionalBranch(b *ssa.Instruction) + + // LowerInstr is called for each instruction in the given block except for the ones marked as already lowered + // via Compiler.MarkLowered. The order is reverse, i.e. from the last instruction to the first one. + // + // Note: this can lower multiple instructions (which produce the inputs) at once whenever it's possible + // for optimization. + LowerInstr(*ssa.Instruction) + + // EndBlock is called when the compilation of the current block is finished. + EndBlock() + + // LinkAdjacentBlocks is called after finished lowering all blocks in order to create one single instruction list. + LinkAdjacentBlocks(prev, next ssa.BasicBlock) + + // EndLoweringFunction is called when the lowering of the current function is finished. + EndLoweringFunction() + + // Reset resets the machine state for the next compilation. + Reset() + + // FlushPendingInstructions flushes the pending instructions to the buffer. + // This will be called after the lowering of each SSA Instruction. + FlushPendingInstructions() + + // InsertMove inserts a move instruction from src to dst whose type is typ. + InsertMove(dst, src regalloc.VReg, typ ssa.Type) + + // InsertReturn inserts the return instruction to return from the current function. + InsertReturn() + + // InsertLoadConstant inserts the instruction(s) to load the constant value into the given regalloc.VReg. + InsertLoadConstant(instr *ssa.Instruction, vr regalloc.VReg) + + // Format returns the string representation of the currently compiled machine code. + // This is only for testing purpose. + Format() string + + // Function returns the currently compiled state as regalloc.Function so that we can perform register allocation. + Function() regalloc.Function + + // SetupPrologue inserts the prologue after register allocations. + SetupPrologue() + + // SetupEpilogue inserts the epilogue after register allocations. + // This sets up the instructions for the inverse of SetupPrologue right before + SetupEpilogue() + + // ResolveRelativeAddresses resolves the relative addresses after register allocations and prologue/epilogue setup. + // After this, the compiler is finally ready to emit machine code. + ResolveRelativeAddresses(ctx context.Context) + + // ResolveRelocations resolves the relocations after emitting machine code. + ResolveRelocations(refToBinaryOffset map[ssa.FuncRef]int, binary []byte, relocations []RelocationInfo) + + // Encode encodes the machine instructions to the Compiler. + Encode() + + // CompileGoFunctionTrampoline compiles the trampoline function to call a Go function of the given exit code and signature. + CompileGoFunctionTrampoline(exitCode wazevoapi.ExitCode, sig *ssa.Signature, needModuleContextPtr bool) []byte + + // CompileStackGrowCallSequence returns the sequence of instructions shared by all functions to + // call the stack grow builtin function. + CompileStackGrowCallSequence() []byte + + // CompileEntryPreamble returns the sequence of instructions shared by multiple functions to + // enter the function from Go. + CompileEntryPreamble(signature *ssa.Signature) []byte + } +) diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc/api.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc/api.go new file mode 100644 index 000000000..81240cfd9 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc/api.go @@ -0,0 +1,124 @@ +package regalloc + +import "fmt" + +// These interfaces are implemented by ISA-specific backends to abstract away the details, and allow the register +// allocators to work on any ISA. +// +// TODO: the interfaces are not stabilized yet, especially x64 will need some changes. E.g. x64 has an addressing mode +// where index can be in memory. That kind of info will be useful to reduce the register pressure, and should be leveraged +// by the register allocators, like https://docs.rs/regalloc2/latest/regalloc2/enum.OperandConstraint.html + +type ( + // Function is the top-level interface to do register allocation, which corresponds to a CFG containing + // Blocks(s). + Function interface { + // PostOrderBlockIteratorBegin returns the first block in the post-order traversal of the CFG. + // In other words, the last blocks in the CFG will be returned first. + PostOrderBlockIteratorBegin() Block + // PostOrderBlockIteratorNext returns the next block in the post-order traversal of the CFG. + PostOrderBlockIteratorNext() Block + // ReversePostOrderBlockIteratorBegin returns the first block in the reverse post-order traversal of the CFG. + // In other words, the first blocks in the CFG will be returned first. + ReversePostOrderBlockIteratorBegin() Block + // ReversePostOrderBlockIteratorNext returns the next block in the reverse post-order traversal of the CFG. + ReversePostOrderBlockIteratorNext() Block + // ClobberedRegisters tell the clobbered registers by this function. + ClobberedRegisters([]VReg) + // Done tells the implementation that register allocation is done, and it can finalize the stack + Done() + // LoopNestingForestRoots returns the number of roots of the loop nesting forest in a function. + LoopNestingForestRoots() int + // LoopNestingForestRoot returns the i-th root of the loop nesting forest in a function. + LoopNestingForestRoot(i int) Block + // LowestCommonAncestor returns the lowest common ancestor of two blocks in the dominator tree. + LowestCommonAncestor(blk1, blk2 Block) Block + // Idom returns the immediate dominator of the given block. + Idom(blk Block) Block + + // Followings are for rewriting the function. + + // SwapAtEndOfBlock swaps the two virtual registers at the end of the given block. + SwapAtEndOfBlock(x1, x2, tmp VReg, block Block) + // StoreRegisterBefore inserts store instruction(s) before the given instruction for the given virtual register. + StoreRegisterBefore(v VReg, instr Instr) + // StoreRegisterAfter inserts store instruction(s) after the given instruction for the given virtual register. + StoreRegisterAfter(v VReg, instr Instr) + // ReloadRegisterBefore inserts reload instruction(s) before the given instruction for the given virtual register. + ReloadRegisterBefore(v VReg, instr Instr) + // ReloadRegisterAfter inserts reload instruction(s) after the given instruction for the given virtual register. + ReloadRegisterAfter(v VReg, instr Instr) + // InsertMoveBefore inserts move instruction(s) before the given instruction for the given virtual registers. + InsertMoveBefore(dst, src VReg, instr Instr) + } + + // Block is a basic block in the CFG of a function, and it consists of multiple instructions, and predecessor Block(s). + Block interface { + // ID returns the unique identifier of this block which is ordered in the reverse post-order traversal of the CFG. + ID() int + // BlockParams returns the virtual registers used as the parameters of this block. + BlockParams(*[]VReg) []VReg + // InstrIteratorBegin returns the first instruction in this block. Instructions added after lowering must be skipped. + // Note: multiple Instr(s) will not be held at the same time, so it's safe to use the same impl for the return Instr. + InstrIteratorBegin() Instr + // InstrIteratorNext returns the next instruction in this block. Instructions added after lowering must be skipped. + // Note: multiple Instr(s) will not be held at the same time, so it's safe to use the same impl for the return Instr. + InstrIteratorNext() Instr + // InstrRevIteratorBegin is the same as InstrIteratorBegin, but in the reverse order. + InstrRevIteratorBegin() Instr + // InstrRevIteratorNext is the same as InstrIteratorNext, but in the reverse order. + InstrRevIteratorNext() Instr + // FirstInstr returns the fist instruction in this block where instructions will be inserted after it. + FirstInstr() Instr + // LastInstr returns the last instruction in this block where instructions will be inserted before it. + // Such insertions only happen when we need to insert spill/reload instructions to adjust the merge edges. + // If the very last instruction is the unconditional branching, then the returned instruction is the one before it. + // Note that at the time of register allocation, all the critical edges are already split, so there is no need + // to worry about the case where branching instruction has multiple successors. + LastInstr() Instr + // Preds returns the number of predecessors of this block in the CFG. + Preds() int + // Pred returns the i-th predecessor of this block in the CFG. + Pred(i int) Block + // Entry returns true if the block is for the entry block. + Entry() bool + // Succs returns the number of successors of this block in the CFG. + Succs() int + // Succ returns the i-th successor of this block in the CFG. + Succ(i int) Block + // LoopHeader returns true if this block is a loop header. + LoopHeader() bool + // LoopNestingForestChildren returns the number of children of this block in the loop nesting forest. + LoopNestingForestChildren() int + // LoopNestingForestChild returns the i-th child of this block in the loop nesting forest. + LoopNestingForestChild(i int) Block + } + + // Instr is an instruction in a block, abstracting away the underlying ISA. + Instr interface { + fmt.Stringer + + // Defs returns the virtual registers defined by this instruction. + Defs(*[]VReg) []VReg + // Uses returns the virtual registers used by this instruction. + // Note: multiple returned []VReg will not be held at the same time, so it's safe to use the same slice for this. + Uses(*[]VReg) []VReg + // AssignUse assigns the RealReg-allocated virtual register used by this instruction at the given index. + AssignUse(index int, v VReg) + // AssignDef assigns a RealReg-allocated virtual register defined by this instruction. + // This only accepts one register because we don't allocate registers for multi-def instructions (i.e. call instruction) + AssignDef(VReg) + // IsCopy returns true if this instruction is a move instruction between two registers. + // If true, the instruction is of the form of dst = src, and if the src and dst do not interfere with each other, + // we could coalesce them, and hence the copy can be eliminated from the final code. + IsCopy() bool + // IsCall returns true if this instruction is a call instruction. The result is used to insert + // caller saved register spills and restores. + IsCall() bool + // IsIndirectCall returns true if this instruction is an indirect call instruction which calls a function pointer. + // The result is used to insert caller saved register spills and restores. + IsIndirectCall() bool + // IsReturn returns true if this instruction is a return instruction. + IsReturn() bool + } +) diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc/reg.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc/reg.go new file mode 100644 index 000000000..e365936b9 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc/reg.go @@ -0,0 +1,125 @@ +package regalloc + +import ( + "fmt" + + "github.com/tetratelabs/wazero/internal/engine/wazevo/ssa" +) + +// VReg represents a register which is assigned to an SSA value. This is used to represent a register in the backend. +// A VReg may or may not be a physical register, and the info of physical register can be obtained by RealReg. +type VReg uint64 + +// VRegID is the lower 32bit of VReg, which is the pure identifier of VReg without RealReg info. +type VRegID uint32 + +// RealReg returns the RealReg of this VReg. +func (v VReg) RealReg() RealReg { + return RealReg(v >> 32) +} + +// IsRealReg returns true if this VReg is backed by a physical register. +func (v VReg) IsRealReg() bool { + return v.RealReg() != RealRegInvalid +} + +// FromRealReg returns a VReg from the given RealReg and RegType. +// This is used to represent a specific pre-colored register in the backend. +func FromRealReg(r RealReg, typ RegType) VReg { + rid := VRegID(r) + if rid > vRegIDReservedForRealNum { + panic(fmt.Sprintf("invalid real reg %d", r)) + } + return VReg(r).SetRealReg(r).SetRegType(typ) +} + +// SetRealReg sets the RealReg of this VReg and returns the updated VReg. +func (v VReg) SetRealReg(r RealReg) VReg { + return VReg(r)<<32 | (v & 0xff_00_ffffffff) +} + +// RegType returns the RegType of this VReg. +func (v VReg) RegType() RegType { + return RegType(v >> 40) +} + +// SetRegType sets the RegType of this VReg and returns the updated VReg. +func (v VReg) SetRegType(t RegType) VReg { + return VReg(t)<<40 | (v & 0x00_ff_ffffffff) +} + +// ID returns the VRegID of this VReg. +func (v VReg) ID() VRegID { + return VRegID(v & 0xffffffff) +} + +// Valid returns true if this VReg is Valid. +func (v VReg) Valid() bool { + return v.ID() != vRegIDInvalid && v.RegType() != RegTypeInvalid +} + +// RealReg represents a physical register. +type RealReg byte + +const RealRegInvalid RealReg = 0 + +const ( + vRegIDInvalid VRegID = 1 << 31 + VRegIDNonReservedBegin = vRegIDReservedForRealNum + vRegIDReservedForRealNum VRegID = 128 + VRegInvalid = VReg(vRegIDInvalid) +) + +// String implements fmt.Stringer. +func (r RealReg) String() string { + switch r { + case RealRegInvalid: + return "invalid" + default: + return fmt.Sprintf("r%d", r) + } +} + +// String implements fmt.Stringer. +func (v VReg) String() string { + if v.IsRealReg() { + return fmt.Sprintf("r%d", v.ID()) + } + return fmt.Sprintf("v%d?", v.ID()) +} + +// RegType represents the type of a register. +type RegType byte + +const ( + RegTypeInvalid RegType = iota + RegTypeInt + RegTypeFloat + NumRegType +) + +// String implements fmt.Stringer. +func (r RegType) String() string { + switch r { + case RegTypeInt: + return "int" + case RegTypeFloat: + return "float" + default: + return "invalid" + } +} + +// RegTypeOf returns the RegType of the given ssa.Type. +func RegTypeOf(p ssa.Type) RegType { + switch p { + case ssa.TypeI32, ssa.TypeI64: + return RegTypeInt + case ssa.TypeF32, ssa.TypeF64, ssa.TypeV128: + return RegTypeFloat + default: + panic("invalid type") + } +} + +const RealRegsNumMax = 128 diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc/regalloc.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc/regalloc.go new file mode 100644 index 000000000..38a1735cf --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc/regalloc.go @@ -0,0 +1,1021 @@ +// Package regalloc performs register allocation. The algorithm can work on any ISA by implementing the interfaces in +// api.go. +package regalloc + +// References: +// * https://web.stanford.edu/class/archive/cs/cs143/cs143.1128/lectures/17/Slides17.pdf +// * https://en.wikipedia.org/wiki/Chaitin%27s_algorithm +// * https://llvm.org/ProjectsWithLLVM/2004-Fall-CS426-LS.pdf +// * https://pfalcon.github.io/ssabook/latest/book-full.pdf: Chapter 9. for liveness analysis. + +import ( + "fmt" + "math" + "strings" + + "github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi" +) + +// NewAllocator returns a new Allocator. +func NewAllocator(allocatableRegs *RegisterInfo) Allocator { + a := Allocator{ + regInfo: allocatableRegs, + blockLivenessDataPool: wazevoapi.NewPool[blockLivenessData](resetBlockLivenessData), + phiDefInstListPool: wazevoapi.NewPool[phiDefInstList](resetPhiDefInstList), + } + a.state.reset() + for _, regs := range allocatableRegs.AllocatableRegisters { + for _, r := range regs { + a.allocatableSet = a.allocatableSet.add(r) + } + } + return a +} + +type ( + // RegisterInfo holds the statically-known ISA-specific register information. + RegisterInfo struct { + // AllocatableRegisters is a 2D array of allocatable RealReg, indexed by regTypeNum and regNum. + // The order matters: the first element is the most preferred one when allocating. + AllocatableRegisters [NumRegType][]RealReg + CalleeSavedRegisters [RealRegsNumMax]bool + CallerSavedRegisters [RealRegsNumMax]bool + RealRegToVReg []VReg + // RealRegName returns the name of the given RealReg for debugging. + RealRegName func(r RealReg) string + RealRegType func(r RealReg) RegType + } + + // Allocator is a register allocator. + Allocator struct { + // regInfo is static per ABI/ISA, and is initialized by the machine during Machine.PrepareRegisterAllocator. + regInfo *RegisterInfo + // allocatableSet is a set of allocatable RealReg derived from regInfo. Static per ABI/ISA. + allocatableSet regSet + allocatedCalleeSavedRegs []VReg + blockLivenessDataPool wazevoapi.Pool[blockLivenessData] + blockLivenessData [] /* blockID to */ *blockLivenessData + vs []VReg + maxBlockID int + phiDefInstListPool wazevoapi.Pool[phiDefInstList] + + // Followings are re-used during various places e.g. coloring. + blks []Block + reals []RealReg + currentOccupants regInUseSet + + // Following two fields are updated while iterating the blocks in the reverse postorder. + state state + blockStates [] /* blockID to */ blockState + } + + // blockLivenessData is a per-block information used during the register allocation. + blockLivenessData struct { + seen bool + liveOuts map[VReg]struct{} + liveIns map[VReg]struct{} + } + + // programCounter represents an opaque index into the program which is used to represents a LiveInterval of a VReg. + programCounter int32 + + state struct { + argRealRegs []VReg + regsInUse regInUseSet + vrStates []vrState + maxVRegIDEncountered int + + // allocatedRegSet is a set of RealReg that are allocated during the allocation phase. This is reset per function. + allocatedRegSet regSet + } + + blockState struct { + visited bool + startFromPredIndex int + // startRegs is a list of RealReg that are used at the beginning of the block. This is used to fix the merge edges. + startRegs regInUseSet + // endRegs is a list of RealReg that are used at the end of the block. This is used to fix the merge edges. + endRegs regInUseSet + init bool + } + + vrState struct { + v VReg + r RealReg + // defInstr is the instruction that defines this value. If this is the phi value and not the entry block, this is nil. + defInstr Instr + // defBlk is the block that defines this value. If this is the phi value, this is the block whose arguments contain this value. + defBlk Block + // spilled is true if this value is spilled i.e. the value is reload from the stack somewhere in the program. + spilled bool + // lca = lowest common ancestor. This is the block that is the lowest common ancestor of all the blocks that + // reloads this value. This is used to determine the spill location. Only valid if spilled=true. + lca Block + // lastUse is the program counter of the last use of this value. This changes while iterating the block, and + // should not be used across the blocks as it becomes invalid. + lastUse programCounter + // isPhi is true if this is a phi value. + isPhi bool + // phiDefInstList is a list of instructions that defines this phi value. + // This is used to determine the spill location, and only valid if isPhi=true. + *phiDefInstList + } + + // phiDefInstList is a linked list of instructions that defines a phi value. + phiDefInstList struct { + instr Instr + next *phiDefInstList + } +) + +func resetPhiDefInstList(l *phiDefInstList) { + l.instr = nil + l.next = nil +} + +func (s *state) dump(info *RegisterInfo) { //nolint:unused + fmt.Println("\t\tstate:") + fmt.Println("\t\t\targRealRegs:", s.argRealRegs) + fmt.Println("\t\t\tregsInUse", s.regsInUse.format(info)) + fmt.Println("\t\t\tallocatedRegSet:", s.allocatedRegSet.format(info)) + fmt.Println("\t\t\tused:", s.regsInUse.format(info)) + fmt.Println("\t\t\tmaxVRegIDEncountered:", s.maxVRegIDEncountered) + var strs []string + for i, v := range s.vrStates { + if v.r != RealRegInvalid { + strs = append(strs, fmt.Sprintf("(v%d: %s)", i, info.RealRegName(v.r))) + } + } + fmt.Println("\t\t\tvrStates:", strings.Join(strs, ", ")) +} + +func (s *state) reset() { + s.argRealRegs = s.argRealRegs[:0] + for i, l := 0, len(s.vrStates); i <= s.maxVRegIDEncountered && i < l; i++ { + s.vrStates[i].reset() + } + s.maxVRegIDEncountered = -1 + s.allocatedRegSet = regSet(0) + s.regsInUse.reset() +} + +func (a *Allocator) getBlockState(bID int) *blockState { + if bID >= len(a.blockStates) { + a.blockStates = append(a.blockStates, make([]blockState, (bID+1)-len(a.blockStates))...) + a.blockStates = a.blockStates[:cap(a.blockStates)] + } + ret := &a.blockStates[bID] + if !ret.init { + ret.reset() + ret.init = true + } + return ret +} + +func (s *state) setVRegState(v VReg, r RealReg) { + id := int(v.ID()) + if id >= len(s.vrStates) { + s.vrStates = append(s.vrStates, make([]vrState, id+1-len(s.vrStates))...) + s.vrStates = s.vrStates[:cap(s.vrStates)] + } + + st := &s.vrStates[id] + st.r = r + st.v = v +} + +func (vs *vrState) reset() { + vs.r = RealRegInvalid + vs.defInstr = nil + vs.defBlk = nil + vs.spilled = false + vs.lca = nil + vs.isPhi = false + vs.phiDefInstList = nil +} + +func (s *state) getVRegState(v VReg) *vrState { + id := int(v.ID()) + if id >= len(s.vrStates) { + s.setVRegState(v, RealRegInvalid) + } + if s.maxVRegIDEncountered < id { + s.maxVRegIDEncountered = id + } + return &s.vrStates[id] +} + +func (s *state) useRealReg(r RealReg, v VReg) { + if s.regsInUse.has(r) { + panic("BUG: useRealReg: the given real register is already used") + } + s.regsInUse.add(r, v) + s.setVRegState(v, r) + s.allocatedRegSet = s.allocatedRegSet.add(r) +} + +func (s *state) releaseRealReg(r RealReg) { + current := s.regsInUse.get(r) + if current.Valid() { + s.regsInUse.remove(r) + s.setVRegState(current, RealRegInvalid) + } +} + +// recordReload records that the given VReg is reloaded in the given block. +// This is used to determine the spill location by tracking the lowest common ancestor of all the blocks that reloads the value. +func (vs *vrState) recordReload(f Function, blk Block) { + vs.spilled = true + if vs.lca == nil { + if wazevoapi.RegAllocLoggingEnabled { + fmt.Printf("\t\tv%d is reloaded in blk%d,\n", vs.v.ID(), blk.ID()) + } + vs.lca = blk + } else { + if wazevoapi.RegAllocLoggingEnabled { + fmt.Printf("\t\tv%d is reloaded in blk%d, lca=%d\n", vs.v.ID(), blk.ID(), vs.lca.ID()) + } + vs.lca = f.LowestCommonAncestor(vs.lca, blk) + if wazevoapi.RegAllocLoggingEnabled { + fmt.Printf("updated lca=%d\n", vs.lca.ID()) + } + } +} + +func (s *state) findOrSpillAllocatable(a *Allocator, allocatable []RealReg, forbiddenMask regSet) (r RealReg) { + r = RealRegInvalid + var lastUseAt programCounter = math.MinInt32 + var spillVReg VReg + for _, candidateReal := range allocatable { + if forbiddenMask.has(candidateReal) { + continue + } + + using := s.regsInUse.get(candidateReal) + if using == VRegInvalid { + // This is not used at this point. + return candidateReal + } + + if last := s.getVRegState(using).lastUse; last > lastUseAt { + lastUseAt = last + r = candidateReal + spillVReg = using + } + } + + if r == RealRegInvalid { + panic("not found any allocatable register") + } + + if wazevoapi.RegAllocLoggingEnabled { + fmt.Printf("\tspilling v%d when: %s\n", spillVReg.ID(), forbiddenMask.format(a.regInfo)) + } + s.releaseRealReg(r) + return r +} + +func (s *state) findAllocatable(allocatable []RealReg, forbiddenMask regSet) RealReg { + for _, r := range allocatable { + if !s.regsInUse.has(r) && !forbiddenMask.has(r) { + return r + } + } + return RealRegInvalid +} + +func (s *state) resetAt(bs *blockState, liveIns map[VReg]struct{}) { + s.regsInUse.range_(func(_ RealReg, vr VReg) { + s.setVRegState(vr, RealRegInvalid) + }) + s.regsInUse.reset() + bs.endRegs.range_(func(r RealReg, v VReg) { + if _, ok := liveIns[v]; ok { + s.regsInUse.add(r, v) + s.setVRegState(v, r) + } + }) +} + +func (b *blockState) reset() { + b.visited = false + b.endRegs.reset() + b.startRegs.reset() + b.startFromPredIndex = -1 + b.init = false +} + +func (b *blockState) dump(a *RegisterInfo) { + fmt.Println("\t\tblockState:") + fmt.Println("\t\t\tstartRegs:", b.startRegs.format(a)) + fmt.Println("\t\t\tendRegs:", b.endRegs.format(a)) + fmt.Println("\t\t\tstartFromPredIndex:", b.startFromPredIndex) + fmt.Println("\t\t\tvisited:", b.visited) + fmt.Println("\t\t\tinit:", b.init) +} + +// DoAllocation performs register allocation on the given Function. +func (a *Allocator) DoAllocation(f Function) { + a.livenessAnalysis(f) + a.alloc(f) + a.determineCalleeSavedRealRegs(f) + f.Done() +} + +func (a *Allocator) determineCalleeSavedRealRegs(f Function) { + a.allocatedCalleeSavedRegs = a.allocatedCalleeSavedRegs[:0] + a.state.allocatedRegSet.range_(func(allocatedRealReg RealReg) { + if a.regInfo.isCalleeSaved(allocatedRealReg) { + a.allocatedCalleeSavedRegs = append(a.allocatedCalleeSavedRegs, a.regInfo.RealRegToVReg[allocatedRealReg]) + } + }) + f.ClobberedRegisters(a.allocatedCalleeSavedRegs) +} + +// phiBlk returns the block that defines the given phi value, nil otherwise. +func (s *state) phiBlk(v VReg) Block { + vs := s.getVRegState(v) + if vs.isPhi { + return vs.defBlk + } + return nil +} + +// liveAnalysis constructs Allocator.blockLivenessData. +// The algorithm here is described in https://pfalcon.github.io/ssabook/latest/book-full.pdf Chapter 9.2. +func (a *Allocator) livenessAnalysis(f Function) { + // First, we need to allocate blockLivenessData. + s := &a.state + for blk := f.PostOrderBlockIteratorBegin(); blk != nil; blk = f.PostOrderBlockIteratorNext() { // Order doesn't matter. + a.allocateBlockLivenessData(blk.ID()) + + // We should gather phi value data. + for _, p := range blk.BlockParams(&a.vs) { + vs := s.getVRegState(p) + vs.isPhi = true + vs.defBlk = blk + } + if blk.ID() > a.maxBlockID { + a.maxBlockID = blk.ID() + } + } + + // Run the Algorithm 9.2 in the bool. + for blk := f.PostOrderBlockIteratorBegin(); blk != nil; blk = f.PostOrderBlockIteratorNext() { + blkID := blk.ID() + info := a.livenessDataAt(blkID) + + ns := blk.Succs() + for i := 0; i < ns; i++ { + succ := blk.Succ(i) + if succ == nil { + continue + } + + succID := succ.ID() + succInfo := a.livenessDataAt(succID) + if !succInfo.seen { // This means the back edge. + continue + } + + for v := range succInfo.liveIns { + if s.phiBlk(v) != succ { + info.liveOuts[v] = struct{}{} + info.liveIns[v] = struct{}{} + } + } + } + + for instr := blk.InstrRevIteratorBegin(); instr != nil; instr = blk.InstrRevIteratorNext() { + + var use, def VReg + for _, def = range instr.Defs(&a.vs) { + if !def.IsRealReg() { + delete(info.liveIns, def) + } + } + for _, use = range instr.Uses(&a.vs) { + if !use.IsRealReg() { + info.liveIns[use] = struct{}{} + } + } + + // If the destination is a phi value, and ... + if def.Valid() && s.phiBlk(def) != nil { + if use.Valid() && use.IsRealReg() { + // If the source is a real register, this is the beginning of the function. + a.state.argRealRegs = append(a.state.argRealRegs, use) + } else { + // Otherwise, this is the definition of the phi value for the successor block. + // So we need to make it outlive the block. + info.liveOuts[def] = struct{}{} + } + } + } + info.seen = true + } + + nrs := f.LoopNestingForestRoots() + for i := 0; i < nrs; i++ { + root := f.LoopNestingForestRoot(i) + a.loopTreeDFS(root) + } +} + +// loopTreeDFS implements the Algorithm 9.3 in the book in an iterative way. +func (a *Allocator) loopTreeDFS(entry Block) { + a.blks = a.blks[:0] + a.blks = append(a.blks, entry) + + s := &a.state + for len(a.blks) > 0 { + tail := len(a.blks) - 1 + loop := a.blks[tail] + a.blks = a.blks[:tail] + a.vs = a.vs[:0] + + info := a.livenessDataAt(loop.ID()) + for v := range info.liveIns { + if s.phiBlk(v) != loop { + a.vs = append(a.vs, v) + info.liveOuts[v] = struct{}{} + } + } + + cn := loop.LoopNestingForestChildren() + for i := 0; i < cn; i++ { + child := loop.LoopNestingForestChild(i) + childID := child.ID() + childInfo := a.livenessDataAt(childID) + for _, v := range a.vs { + childInfo.liveIns[v] = struct{}{} + childInfo.liveOuts[v] = struct{}{} + } + if child.LoopHeader() { + a.blks = append(a.blks, child) + } + } + } +} + +// alloc allocates registers for the given function by iterating the blocks in the reverse postorder. +// The algorithm here is derived from the Go compiler's allocator https://github.com/golang/go/blob/release-branch.go1.21/src/cmd/compile/internal/ssa/regalloc.go +// In short, this is a simply linear scan register allocation where each block inherits the register allocation state from +// one of its predecessors. Each block inherits the selected state and starts allocation from there. +// If there's a discrepancy in the end states between predecessors, the adjustments are made to ensure consistency after allocation is done (which we call "fixing merge state"). +// The spill instructions (store into the dedicated slots) are inserted after all the allocations and fixing merge states. That is because +// at the point, we all know where the reloads happen, and therefore we can know the best place to spill the values. More precisely, +// the spill happens in the block that is the lowest common ancestor of all the blocks that reloads the value. +// +// All of these logics are almost the same as Go's compiler which has a dedicated description in the source file ^^. +func (a *Allocator) alloc(f Function) { + // First we allocate each block in the reverse postorder (at least one predecessor should be allocated for each block). + for blk := f.ReversePostOrderBlockIteratorBegin(); blk != nil; blk = f.ReversePostOrderBlockIteratorNext() { + if wazevoapi.RegAllocLoggingEnabled { + fmt.Printf("========== allocating blk%d ========\n", blk.ID()) + } + a.allocBlock(f, blk) + } + // After the allocation, we all know the start and end state of each block. So we can fix the merge states. + for blk := f.ReversePostOrderBlockIteratorBegin(); blk != nil; blk = f.ReversePostOrderBlockIteratorNext() { + a.fixMergeState(f, blk) + } + // Finally, we insert the spill instructions as we know all the places where the reloads happen. + a.scheduleSpills(f) +} + +func (a *Allocator) allocBlock(f Function, blk Block) { + bID := blk.ID() + liveness := a.livenessDataAt(bID) + s := &a.state + currentBlkState := a.getBlockState(bID) + + preds := blk.Preds() + var predState *blockState + switch preds { + case 0: // This is the entry block. + case 1: + predID := blk.Pred(0).ID() + predState = a.getBlockState(predID) + currentBlkState.startFromPredIndex = 0 + default: + // TODO: there should be some better heuristic to choose the predecessor. + for i := 0; i < preds; i++ { + predID := blk.Pred(i).ID() + if _predState := a.getBlockState(predID); _predState.visited { + predState = _predState + currentBlkState.startFromPredIndex = i + break + } + } + } + if predState == nil { + if !blk.Entry() { + panic(fmt.Sprintf("BUG: at lease one predecessor should be visited for blk%d", blk.ID())) + } + for _, u := range s.argRealRegs { + s.useRealReg(u.RealReg(), u) + } + } else if predState != nil { + if wazevoapi.RegAllocLoggingEnabled { + fmt.Printf("allocating blk%d starting from blk%d (on index=%d) \n", + bID, blk.Pred(currentBlkState.startFromPredIndex).ID(), currentBlkState.startFromPredIndex) + } + s.resetAt(predState, liveness.liveIns) + } + + s.regsInUse.range_(func(allocated RealReg, v VReg) { + currentBlkState.startRegs.add(allocated, v) + }) + + // Update the last use of each VReg. + var pc programCounter + for instr := blk.InstrIteratorBegin(); instr != nil; instr = blk.InstrIteratorNext() { + for _, use := range instr.Uses(&a.vs) { + if !use.IsRealReg() { + s.getVRegState(use).lastUse = pc + } + } + pc++ + } + // Reset the last use of the liveOuts. + for outlive := range liveness.liveOuts { + s.getVRegState(outlive).lastUse = math.MaxInt32 + } + + pc = 0 + for instr := blk.InstrIteratorBegin(); instr != nil; instr = blk.InstrIteratorNext() { + if wazevoapi.RegAllocLoggingEnabled { + fmt.Println(instr) + } + + var currentUsedSet regSet + killSet := a.reals[:0] + + // Gather the set of registers that will be used in the current instruction. + for _, use := range instr.Uses(&a.vs) { + if use.IsRealReg() { + r := use.RealReg() + currentUsedSet = currentUsedSet.add(r) + if a.allocatableSet.has(r) { + killSet = append(killSet, r) + } + } else { + vs := s.getVRegState(use) + if r := vs.r; r != RealRegInvalid { + currentUsedSet = currentUsedSet.add(r) + } + } + } + + for i, use := range instr.Uses(&a.vs) { + if !use.IsRealReg() { + vs := s.getVRegState(use) + killed := liveness.isKilledAt(vs, pc) + r := vs.r + + if r == RealRegInvalid { + r = s.findOrSpillAllocatable(a, a.regInfo.AllocatableRegisters[use.RegType()], currentUsedSet) + vs.recordReload(f, blk) + f.ReloadRegisterBefore(use.SetRealReg(r), instr) + s.useRealReg(r, use) + } + if wazevoapi.RegAllocLoggingEnabled { + fmt.Printf("\ttrying to use v%v on %s\n", use.ID(), a.regInfo.RealRegName(r)) + } + instr.AssignUse(i, use.SetRealReg(r)) + currentUsedSet = currentUsedSet.add(r) + if killed { + if wazevoapi.RegAllocLoggingEnabled { + fmt.Printf("\tkill v%d with %s\n", use.ID(), a.regInfo.RealRegName(r)) + } + killSet = append(killSet, r) + } + } + } + + isIndirect := instr.IsIndirectCall() + call := instr.IsCall() || isIndirect + if call { + addr := RealRegInvalid + if instr.IsIndirectCall() { + addr = a.vs[0].RealReg() + } + a.releaseCallerSavedRegs(addr) + } + + for _, r := range killSet { + s.releaseRealReg(r) + } + a.reals = killSet + + defs := instr.Defs(&a.vs) + switch { + case len(defs) > 1: + if !call { + panic("only call can have multiple defs") + } + // Call's defining register are all caller-saved registers. + // Therefore, we can assume that all of them are allocatable. + for _, def := range defs { + s.useRealReg(def.RealReg(), def) + } + case len(defs) == 1: + def := defs[0] + if def.IsRealReg() { + r := def.RealReg() + if a.allocatableSet.has(r) { + if s.regsInUse.has(r) { + s.releaseRealReg(r) + } + s.useRealReg(r, def) + } + } else { + vState := s.getVRegState(def) + r := vState.r + // Allocate a new real register if `def` is not currently assigned one. + // It can happen when multiple instructions define the same VReg (e.g. const loads). + if r == RealRegInvalid { + if instr.IsCopy() { + copySrc := instr.Uses(&a.vs)[0].RealReg() + if a.allocatableSet.has(copySrc) && !s.regsInUse.has(copySrc) { + r = copySrc + } + } + if r == RealRegInvalid { + typ := def.RegType() + r = s.findOrSpillAllocatable(a, a.regInfo.AllocatableRegisters[typ], regSet(0)) + } + s.useRealReg(r, def) + } + instr.AssignDef(def.SetRealReg(r)) + if wazevoapi.RegAllocLoggingEnabled { + fmt.Printf("\tdefining v%d with %s\n", def.ID(), a.regInfo.RealRegName(r)) + } + if vState.isPhi { + n := a.phiDefInstListPool.Allocate() + n.instr = instr + n.next = vState.phiDefInstList + vState.phiDefInstList = n + } else { + vState.defInstr = instr + vState.defBlk = blk + } + } + } + if wazevoapi.RegAllocLoggingEnabled { + fmt.Println(instr) + } + pc++ + } + + s.regsInUse.range_(func(allocated RealReg, v VReg) { + currentBlkState.endRegs.add(allocated, v) + }) + + currentBlkState.visited = true + if wazevoapi.RegAllocLoggingEnabled { + currentBlkState.dump(a.regInfo) + } +} + +func (a *Allocator) releaseCallerSavedRegs(addrReg RealReg) { + s := &a.state + + for i := 0; i < 64; i++ { + allocated := RealReg(i) + if allocated == addrReg { // If this is the call indirect, we should not touch the addr register. + continue + } + if v := s.regsInUse.get(allocated); v.Valid() { + if v.IsRealReg() { + continue // This is the argument register as it's already used by VReg backed by the corresponding RealReg. + } + if !a.regInfo.isCallerSaved(allocated) { + // If this is not a caller-saved register, it is safe to keep it across the call. + continue + } + s.releaseRealReg(allocated) + } + } +} + +func (a *Allocator) fixMergeState(f Function, blk Block) { + preds := blk.Preds() + if preds <= 1 { + return + } + + s := &a.state + + // Restores the state at the beginning of the block. + bID := blk.ID() + blkSt := a.getBlockState(bID) + desiredOccupants := &blkSt.startRegs + aliveOnRegVRegs := make(map[VReg]RealReg) + for i := 0; i < 64; i++ { + r := RealReg(i) + if v := blkSt.startRegs.get(r); v.Valid() { + aliveOnRegVRegs[v] = r + } + } + + if wazevoapi.RegAllocLoggingEnabled { + fmt.Println("fixMergeState", blk.ID(), ":", desiredOccupants.format(a.regInfo)) + } + + currentOccupants := &a.currentOccupants + for i := 0; i < preds; i++ { + currentOccupants.reset() + if i == blkSt.startFromPredIndex { + continue + } + + currentOccupantsRev := make(map[VReg]RealReg) + pred := blk.Pred(i) + predSt := a.getBlockState(pred.ID()) + for ii := 0; ii < 64; ii++ { + r := RealReg(ii) + if v := predSt.endRegs.get(r); v.Valid() { + if _, ok := aliveOnRegVRegs[v]; !ok { + continue + } + currentOccupants.add(r, v) + currentOccupantsRev[v] = r + } + } + + s.resetAt(predSt, a.livenessDataAt(bID).liveIns) + + // Finds the free registers if any. + intTmp, floatTmp := VRegInvalid, VRegInvalid + if intFree := s.findAllocatable( + a.regInfo.AllocatableRegisters[RegTypeInt], desiredOccupants.set, + ); intFree != RealRegInvalid { + intTmp = FromRealReg(intFree, RegTypeInt) + } + if floatFree := s.findAllocatable( + a.regInfo.AllocatableRegisters[RegTypeFloat], desiredOccupants.set, + ); floatFree != RealRegInvalid { + floatTmp = FromRealReg(floatFree, RegTypeFloat) + } + + if wazevoapi.RegAllocLoggingEnabled { + fmt.Println("\t", pred.ID(), ":", currentOccupants.format(a.regInfo)) + } + + for ii := 0; ii < 64; ii++ { + r := RealReg(ii) + desiredVReg := desiredOccupants.get(r) + if !desiredVReg.Valid() { + continue + } + + currentVReg := currentOccupants.get(r) + if desiredVReg.ID() == currentVReg.ID() { + continue + } + + typ := desiredVReg.RegType() + var tmpRealReg VReg + if typ == RegTypeInt { + tmpRealReg = intTmp + } else { + tmpRealReg = floatTmp + } + a.reconcileEdge(f, r, pred, currentOccupants, currentOccupantsRev, currentVReg, desiredVReg, tmpRealReg, typ) + } + } +} + +func (a *Allocator) reconcileEdge(f Function, + r RealReg, + pred Block, + currentOccupants *regInUseSet, + currentOccupantsRev map[VReg]RealReg, + currentVReg, desiredVReg VReg, + freeReg VReg, + typ RegType, +) { + s := &a.state + if currentVReg.Valid() { + // Both are on reg. + er, ok := currentOccupantsRev[desiredVReg] + if !ok { + if wazevoapi.RegAllocLoggingEnabled { + fmt.Printf("\t\tv%d is desired to be on %s, but currently on the stack\n", + desiredVReg.ID(), a.regInfo.RealRegName(r), + ) + } + // This case is that the desired value is on the stack, but currentVReg is on the target register. + // We need to move the current value to the stack, and reload the desired value. + // TODO: we can do better here. + f.StoreRegisterBefore(currentVReg.SetRealReg(r), pred.LastInstr()) + delete(currentOccupantsRev, currentVReg) + + s.getVRegState(desiredVReg).recordReload(f, pred) + f.ReloadRegisterBefore(desiredVReg.SetRealReg(r), pred.LastInstr()) + currentOccupants.add(r, desiredVReg) + currentOccupantsRev[desiredVReg] = r + return + } + + if wazevoapi.RegAllocLoggingEnabled { + fmt.Printf("\t\tv%d is desired to be on %s, but currently on %s\n", + desiredVReg.ID(), a.regInfo.RealRegName(r), a.regInfo.RealRegName(er), + ) + } + f.SwapAtEndOfBlock( + currentVReg.SetRealReg(r), + desiredVReg.SetRealReg(er), + freeReg, + pred, + ) + s.allocatedRegSet = s.allocatedRegSet.add(freeReg.RealReg()) + currentOccupantsRev[desiredVReg] = r + currentOccupantsRev[currentVReg] = er + currentOccupants.add(r, desiredVReg) + currentOccupants.add(er, currentVReg) + if wazevoapi.RegAllocLoggingEnabled { + fmt.Printf("\t\tv%d previously on %s moved to %s\n", currentVReg.ID(), a.regInfo.RealRegName(r), a.regInfo.RealRegName(er)) + } + } else { + // Desired is on reg, but currently the target register is not used. + if wazevoapi.RegAllocLoggingEnabled { + fmt.Printf("\t\tv%d is desired to be on %s, current not used\n", + desiredVReg.ID(), a.regInfo.RealRegName(r), + ) + } + if currentReg, ok := currentOccupantsRev[desiredVReg]; ok { + f.InsertMoveBefore( + FromRealReg(r, typ), + desiredVReg.SetRealReg(currentReg), + pred.LastInstr(), + ) + currentOccupants.remove(currentReg) + } else { + s.getVRegState(desiredVReg).recordReload(f, pred) + f.ReloadRegisterBefore(desiredVReg.SetRealReg(r), pred.LastInstr()) + } + currentOccupantsRev[desiredVReg] = r + currentOccupants.add(r, desiredVReg) + } + + if wazevoapi.RegAllocLoggingEnabled { + fmt.Println("\t", pred.ID(), ":", currentOccupants.format(a.regInfo)) + } +} + +func (a *Allocator) scheduleSpills(f Function) { + vrStates := a.state.vrStates + for i := 0; i <= a.state.maxVRegIDEncountered; i++ { + vs := &vrStates[i] + if vs.spilled { + a.scheduleSpill(f, vs) + } + } +} + +func (a *Allocator) scheduleSpill(f Function, vs *vrState) { + v := vs.v + // If the value is the phi value, we need to insert a spill after each phi definition. + if vs.isPhi { + for defInstr := vs.phiDefInstList; defInstr != nil; defInstr = defInstr.next { + def := defInstr.instr.Defs(&a.vs)[0] + f.StoreRegisterAfter(def, defInstr.instr) + } + return + } + + pos := vs.lca + definingBlk := vs.defBlk + r := RealRegInvalid + if wazevoapi.RegAllocLoggingEnabled { + fmt.Printf("v%d is spilled in blk%d, lca=blk%d\n", v.ID(), definingBlk.ID(), pos.ID()) + } + for pos != definingBlk { + st := a.blockStates[pos.ID()] + for ii := 0; ii < 64; ii++ { + rr := RealReg(ii) + if st.startRegs.get(rr) == v { + r = rr + // Already in the register, so we can place the spill at the beginning of the block. + break + } + } + + if r != RealRegInvalid { + break + } + + pos = f.Idom(pos) + } + + if pos == definingBlk { + defInstr := vs.defInstr + defInstr.Defs(&a.vs) + if wazevoapi.RegAllocLoggingEnabled { + fmt.Printf("schedule spill v%d after %v\n", v.ID(), defInstr) + } + f.StoreRegisterAfter(a.vs[0], defInstr) + } else { + // Found an ancestor block that holds the value in the register at the beginning of the block. + // We need to insert a spill before the last use. + first := pos.FirstInstr() + if wazevoapi.RegAllocLoggingEnabled { + fmt.Printf("schedule spill v%d before %v\n", v.ID(), first) + } + f.StoreRegisterAfter(v.SetRealReg(r), first) + } +} + +// Reset resets the allocator's internal state so that it can be reused. +func (a *Allocator) Reset() { + a.state.reset() + for i, l := 0, len(a.blockStates); i <= a.maxBlockID && i < l; i++ { + a.blockLivenessData[i] = nil + s := &a.blockStates[i] + s.reset() + } + a.blockLivenessDataPool.Reset() + a.phiDefInstListPool.Reset() + + a.vs = a.vs[:0] + a.maxBlockID = -1 +} + +func (a *Allocator) allocateBlockLivenessData(blockID int) *blockLivenessData { + if blockID >= len(a.blockLivenessData) { + a.blockLivenessData = append(a.blockLivenessData, make([]*blockLivenessData, (blockID+1)-len(a.blockLivenessData))...) + } + info := a.blockLivenessData[blockID] + if info == nil { + info = a.blockLivenessDataPool.Allocate() + a.blockLivenessData[blockID] = info + } + return info +} + +func (a *Allocator) livenessDataAt(blockID int) (info *blockLivenessData) { + info = a.blockLivenessData[blockID] + return +} + +func resetBlockLivenessData(i *blockLivenessData) { + i.seen = false + i.liveOuts = resetMap(i.liveOuts) + i.liveIns = resetMap(i.liveIns) +} + +func resetMap[K comparable, V any](m map[K]V) map[K]V { + if m == nil { + m = make(map[K]V) + } else { + for v := range m { + delete(m, v) + } + } + return m +} + +// Format is for debugging. +func (i *blockLivenessData) Format(ri *RegisterInfo) string { + var buf strings.Builder + buf.WriteString("\t\tblockLivenessData:") + buf.WriteString("\n\t\t\tliveOuts: ") + for v := range i.liveOuts { + if v.IsRealReg() { + buf.WriteString(fmt.Sprintf("%s ", ri.RealRegName(v.RealReg()))) + } else { + buf.WriteString(fmt.Sprintf("%v ", v)) + } + } + buf.WriteString("\n\t\t\tliveIns: ") + for v := range i.liveIns { + if v.IsRealReg() { + buf.WriteString(fmt.Sprintf("%s ", ri.RealRegName(v.RealReg()))) + } else { + buf.WriteString(fmt.Sprintf("%v ", v)) + } + } + buf.WriteString(fmt.Sprintf("\n\t\t\tseen: %v", i.seen)) + return buf.String() +} + +func (i *blockLivenessData) isKilledAt(vs *vrState, pos programCounter) bool { + v := vs.v + if vs.lastUse == pos { + if _, ok := i.liveOuts[v]; !ok { + return true + } + } + return false +} + +func (r *RegisterInfo) isCalleeSaved(reg RealReg) bool { + return r.CalleeSavedRegisters[reg] +} + +func (r *RegisterInfo) isCallerSaved(reg RealReg) bool { + return r.CallerSavedRegisters[reg] +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc/regset.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc/regset.go new file mode 100644 index 000000000..542c2a75a --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/backend/regalloc/regset.go @@ -0,0 +1,98 @@ +package regalloc + +import ( + "fmt" + "strings" +) + +type regSet uint64 + +func (rs regSet) format(info *RegisterInfo) string { //nolint:unused + var ret []string + for i := 0; i < 64; i++ { + if rs&(1<= 64 { + return rs + } + return rs | 1<v%d)", info.RealRegName(RealReg(i)), vr.ID())) + } + } + return strings.Join(ret, ", ") +} + +func (rs *regInUseSet) has(r RealReg) bool { + if r >= 64 { + return false + } + return rs.set&(1<= 64 { + return VRegInvalid + } + return rs.vrs[r] +} + +func (rs *regInUseSet) remove(r RealReg) { + if r >= 64 { + return + } + rs.set &= ^(1 << uint(r)) + rs.vrs[r] = VRegInvalid +} + +func (rs *regInUseSet) add(r RealReg, vr VReg) { + if r >= 64 { + return + } + rs.set |= 1 << uint(r) + rs.vrs[r] = vr +} + +func (rs *regInUseSet) range_(f func(allocatedRealReg RealReg, vr VReg)) { + for i := 0; i < 64; i++ { + if rs.set&(1< stackSize { + stackSize = required + } + return stackSize +} + +func (c *callEngine) init() { + stackSize := c.requiredInitialStackSize() + if wazevoapi.StackGuardCheckEnabled { + stackSize += wazevoapi.StackGuardCheckGuardPageSize + } + c.stack = make([]byte, stackSize) + c.stackTop = alignedStackTop(c.stack) + if wazevoapi.StackGuardCheckEnabled { + c.execCtx.stackBottomPtr = &c.stack[wazevoapi.StackGuardCheckGuardPageSize] + } else { + c.execCtx.stackBottomPtr = &c.stack[0] + } + c.execCtxPtr = uintptr(unsafe.Pointer(&c.execCtx)) +} + +// alignedStackTop returns 16-bytes aligned stack top of given stack. +// 16 bytes should be good for all platform (arm64/amd64). +func alignedStackTop(s []byte) uintptr { + stackAddr := uintptr(unsafe.Pointer(&s[len(s)-1])) + return stackAddr - (stackAddr & (16 - 1)) +} + +// Definition implements api.Function. +func (c *callEngine) Definition() api.FunctionDefinition { + return c.parent.module.Source.FunctionDefinition(c.indexInModule) +} + +// Call implements api.Function. +func (c *callEngine) Call(ctx context.Context, params ...uint64) ([]uint64, error) { + if c.requiredParams != len(params) { + return nil, fmt.Errorf("expected %d params, but passed %d", c.requiredParams, len(params)) + } + paramResultSlice := make([]uint64, c.sizeOfParamResultSlice) + copy(paramResultSlice, params) + if err := c.callWithStack(ctx, paramResultSlice); err != nil { + return nil, err + } + return paramResultSlice[:c.numberOfResults], nil +} + +func (c *callEngine) addFrame(builder wasmdebug.ErrorBuilder, addr uintptr) (def api.FunctionDefinition, listener experimental.FunctionListener) { + eng := c.parent.parent.parent + cm := eng.compiledModuleOfAddr(addr) + if cm != nil { + index := cm.functionIndexOf(addr) + def = cm.module.FunctionDefinition(cm.module.ImportFunctionCount + index) + var sources []string + if dw := cm.module.DWARFLines; dw != nil { + sourceOffset := cm.getSourceOffset(addr) + sources = dw.Line(sourceOffset) + } + builder.AddFrame(def.DebugName(), def.ParamTypes(), def.ResultTypes(), sources) + if len(cm.listeners) > 0 { + listener = cm.listeners[index] + } + } + return +} + +// CallWithStack implements api.Function. +func (c *callEngine) CallWithStack(ctx context.Context, paramResultStack []uint64) (err error) { + if c.sizeOfParamResultSlice > len(paramResultStack) { + return fmt.Errorf("need %d params, but stack size is %d", c.sizeOfParamResultSlice, len(paramResultStack)) + } + return c.callWithStack(ctx, paramResultStack) +} + +// CallWithStack implements api.Function. +func (c *callEngine) callWithStack(ctx context.Context, paramResultStack []uint64) (err error) { + if wazevoapi.StackGuardCheckEnabled { + defer func() { + wazevoapi.CheckStackGuardPage(c.stack) + }() + } + + p := c.parent + ensureTermination := p.parent.ensureTermination + m := p.module + if ensureTermination { + select { + case <-ctx.Done(): + // If the provided context is already done, close the module and return the error. + m.CloseWithCtxErr(ctx) + return m.FailIfClosed() + default: + } + } + + var paramResultPtr *uint64 + if len(paramResultStack) > 0 { + paramResultPtr = ¶mResultStack[0] + } + defer func() { + if r := recover(); r != nil { + type listenerForAbort struct { + def api.FunctionDefinition + lsn experimental.FunctionListener + } + + var listeners []listenerForAbort + builder := wasmdebug.NewErrorBuilder() + def, lsn := c.addFrame(builder, uintptr(unsafe.Pointer(c.execCtx.goCallReturnAddress))) + if lsn != nil { + listeners = append(listeners, listenerForAbort{def, lsn}) + } + returnAddrs := unwindStack(uintptr(unsafe.Pointer(c.execCtx.stackPointerBeforeGoCall)), c.stackTop, nil) + for _, retAddr := range returnAddrs[:len(returnAddrs)-1] { // the last return addr is the trampoline, so we skip it. + def, lsn = c.addFrame(builder, retAddr) + if lsn != nil { + listeners = append(listeners, listenerForAbort{def, lsn}) + } + } + err = builder.FromRecovered(r) + + for _, lsn := range listeners { + lsn.lsn.Abort(ctx, m, lsn.def, err) + } + } else { + if err != wasmruntime.ErrRuntimeStackOverflow { // Stackoverflow case shouldn't be panic (to avoid extreme stack unwinding). + err = c.parent.module.FailIfClosed() + } + } + + if err != nil { + // Ensures that we can reuse this callEngine even after an error. + c.execCtx.exitCode = wazevoapi.ExitCodeOK + } + }() + + if ensureTermination { + done := m.CloseModuleOnCanceledOrTimeout(ctx) + defer done() + } + + entrypoint(c.preambleExecutable, c.executable, c.execCtxPtr, c.parent.opaquePtr, paramResultPtr, c.stackTop) + for { + switch ec := c.execCtx.exitCode; ec & wazevoapi.ExitCodeMask { + case wazevoapi.ExitCodeOK: + return nil + case wazevoapi.ExitCodeGrowStack: + var newsp uintptr + if wazevoapi.StackGuardCheckEnabled { + newsp, err = c.growStackWithGuarded() + } else { + newsp, err = c.growStack() + } + if err != nil { + return err + } + c.execCtx.exitCode = wazevoapi.ExitCodeOK + afterGoFunctionCallEntrypoint(c.execCtx.goCallReturnAddress, c.execCtxPtr, newsp) + case wazevoapi.ExitCodeGrowMemory: + mod := c.callerModuleInstance() + mem := mod.MemoryInstance + s := goCallStackView(c.execCtx.stackPointerBeforeGoCall) + argRes := &s[0] + if res, ok := mem.Grow(uint32(*argRes)); !ok { + *argRes = uint64(0xffffffff) // = -1 in signed 32-bit integer. + } else { + *argRes = uint64(res) + calleeOpaque := opaqueViewFromPtr(uintptr(unsafe.Pointer(c.execCtx.callerModuleContextPtr))) + if mod.Source.MemorySection != nil { // Local memory. + putLocalMemory(calleeOpaque, 8 /* local memory begins at 8 */, mem) + } else { + // Imported memory's owner at offset 16 of the callerModuleContextPtr. + opaquePtr := uintptr(binary.LittleEndian.Uint64(calleeOpaque[16:])) + importedMemOwner := opaqueViewFromPtr(opaquePtr) + putLocalMemory(importedMemOwner, 8 /* local memory begins at 8 */, mem) + } + } + c.execCtx.exitCode = wazevoapi.ExitCodeOK + afterGoFunctionCallEntrypoint(c.execCtx.goCallReturnAddress, c.execCtxPtr, uintptr(unsafe.Pointer(c.execCtx.stackPointerBeforeGoCall))) + case wazevoapi.ExitCodeTableGrow: + mod := c.callerModuleInstance() + s := goCallStackView(c.execCtx.stackPointerBeforeGoCall) + tableIndex, num, ref := s[0], uint32(s[1]), uintptr(s[2]) + table := mod.Tables[tableIndex] + s[0] = uint64(uint32(int32(table.Grow(num, ref)))) + c.execCtx.exitCode = wazevoapi.ExitCodeOK + afterGoFunctionCallEntrypoint(c.execCtx.goCallReturnAddress, c.execCtxPtr, uintptr(unsafe.Pointer(c.execCtx.stackPointerBeforeGoCall))) + case wazevoapi.ExitCodeCallGoFunction: + index := wazevoapi.GoFunctionIndexFromExitCode(ec) + f := hostModuleGoFuncFromOpaque[api.GoFunction](index, c.execCtx.goFunctionCallCalleeModuleContextOpaque) + f.Call(ctx, goCallStackView(c.execCtx.stackPointerBeforeGoCall)) + // Back to the native code. + c.execCtx.exitCode = wazevoapi.ExitCodeOK + afterGoFunctionCallEntrypoint(c.execCtx.goCallReturnAddress, c.execCtxPtr, uintptr(unsafe.Pointer(c.execCtx.stackPointerBeforeGoCall))) + case wazevoapi.ExitCodeCallGoFunctionWithListener: + index := wazevoapi.GoFunctionIndexFromExitCode(ec) + f := hostModuleGoFuncFromOpaque[api.GoFunction](index, c.execCtx.goFunctionCallCalleeModuleContextOpaque) + listeners := hostModuleListenersSliceFromOpaque(c.execCtx.goFunctionCallCalleeModuleContextOpaque) + s := goCallStackView(c.execCtx.stackPointerBeforeGoCall) + // Call Listener.Before. + callerModule := c.callerModuleInstance() + listener := listeners[index] + hostModule := hostModuleFromOpaque(c.execCtx.goFunctionCallCalleeModuleContextOpaque) + def := hostModule.FunctionDefinition(wasm.Index(index)) + listener.Before(ctx, callerModule, def, s, c.stackIterator(true)) + // Call into the Go function. + f.Call(ctx, s) + // Call Listener.After. + listener.After(ctx, callerModule, def, s) + // Back to the native code. + c.execCtx.exitCode = wazevoapi.ExitCodeOK + afterGoFunctionCallEntrypoint(c.execCtx.goCallReturnAddress, c.execCtxPtr, uintptr(unsafe.Pointer(c.execCtx.stackPointerBeforeGoCall))) + case wazevoapi.ExitCodeCallGoModuleFunction: + index := wazevoapi.GoFunctionIndexFromExitCode(ec) + f := hostModuleGoFuncFromOpaque[api.GoModuleFunction](index, c.execCtx.goFunctionCallCalleeModuleContextOpaque) + mod := c.callerModuleInstance() + f.Call(ctx, mod, goCallStackView(c.execCtx.stackPointerBeforeGoCall)) + // Back to the native code. + c.execCtx.exitCode = wazevoapi.ExitCodeOK + afterGoFunctionCallEntrypoint(c.execCtx.goCallReturnAddress, c.execCtxPtr, uintptr(unsafe.Pointer(c.execCtx.stackPointerBeforeGoCall))) + case wazevoapi.ExitCodeCallGoModuleFunctionWithListener: + index := wazevoapi.GoFunctionIndexFromExitCode(ec) + f := hostModuleGoFuncFromOpaque[api.GoModuleFunction](index, c.execCtx.goFunctionCallCalleeModuleContextOpaque) + listeners := hostModuleListenersSliceFromOpaque(c.execCtx.goFunctionCallCalleeModuleContextOpaque) + s := goCallStackView(c.execCtx.stackPointerBeforeGoCall) + // Call Listener.Before. + callerModule := c.callerModuleInstance() + listener := listeners[index] + hostModule := hostModuleFromOpaque(c.execCtx.goFunctionCallCalleeModuleContextOpaque) + def := hostModule.FunctionDefinition(wasm.Index(index)) + listener.Before(ctx, callerModule, def, s, c.stackIterator(true)) + // Call into the Go function. + f.Call(ctx, callerModule, s) + // Call Listener.After. + listener.After(ctx, callerModule, def, s) + // Back to the native code. + c.execCtx.exitCode = wazevoapi.ExitCodeOK + afterGoFunctionCallEntrypoint(c.execCtx.goCallReturnAddress, c.execCtxPtr, uintptr(unsafe.Pointer(c.execCtx.stackPointerBeforeGoCall))) + case wazevoapi.ExitCodeCallListenerBefore: + stack := goCallStackView(c.execCtx.stackPointerBeforeGoCall) + index := stack[0] + mod := c.callerModuleInstance() + listener := mod.Engine.(*moduleEngine).listeners[index] + def := mod.Source.FunctionDefinition(wasm.Index(index)) + listener.Before(ctx, mod, def, stack[1:], c.stackIterator(false)) + c.execCtx.exitCode = wazevoapi.ExitCodeOK + afterGoFunctionCallEntrypoint(c.execCtx.goCallReturnAddress, c.execCtxPtr, uintptr(unsafe.Pointer(c.execCtx.stackPointerBeforeGoCall))) + case wazevoapi.ExitCodeCallListenerAfter: + stack := goCallStackView(c.execCtx.stackPointerBeforeGoCall) + index := stack[0] + mod := c.callerModuleInstance() + listener := mod.Engine.(*moduleEngine).listeners[index] + def := mod.Source.FunctionDefinition(wasm.Index(index)) + listener.After(ctx, mod, def, stack[1:]) + c.execCtx.exitCode = wazevoapi.ExitCodeOK + afterGoFunctionCallEntrypoint(c.execCtx.goCallReturnAddress, c.execCtxPtr, uintptr(unsafe.Pointer(c.execCtx.stackPointerBeforeGoCall))) + case wazevoapi.ExitCodeCheckModuleExitCode: + // Note: this operation must be done in Go, not native code. The reason is that + // native code cannot be preempted and that means it can block forever if there are not + // enough OS threads (which we don't have control over). + if err := m.FailIfClosed(); err != nil { + panic(err) + } + c.execCtx.exitCode = wazevoapi.ExitCodeOK + afterGoFunctionCallEntrypoint(c.execCtx.goCallReturnAddress, c.execCtxPtr, uintptr(unsafe.Pointer(c.execCtx.stackPointerBeforeGoCall))) + case wazevoapi.ExitCodeRefFunc: + mod := c.callerModuleInstance() + s := goCallStackView(c.execCtx.stackPointerBeforeGoCall) + funcIndex := s[0] + ref := mod.Engine.FunctionInstanceReference(wasm.Index(funcIndex)) + s[0] = uint64(ref) + c.execCtx.exitCode = wazevoapi.ExitCodeOK + afterGoFunctionCallEntrypoint(c.execCtx.goCallReturnAddress, c.execCtxPtr, uintptr(unsafe.Pointer(c.execCtx.stackPointerBeforeGoCall))) + case wazevoapi.ExitCodeUnreachable: + panic(wasmruntime.ErrRuntimeUnreachable) + case wazevoapi.ExitCodeMemoryOutOfBounds: + panic(wasmruntime.ErrRuntimeOutOfBoundsMemoryAccess) + case wazevoapi.ExitCodeTableOutOfBounds: + panic(wasmruntime.ErrRuntimeInvalidTableAccess) + case wazevoapi.ExitCodeIndirectCallNullPointer: + panic(wasmruntime.ErrRuntimeInvalidTableAccess) + case wazevoapi.ExitCodeIndirectCallTypeMismatch: + panic(wasmruntime.ErrRuntimeIndirectCallTypeMismatch) + case wazevoapi.ExitCodeIntegerOverflow: + panic(wasmruntime.ErrRuntimeIntegerOverflow) + case wazevoapi.ExitCodeIntegerDivisionByZero: + panic(wasmruntime.ErrRuntimeIntegerDivideByZero) + case wazevoapi.ExitCodeInvalidConversionToInteger: + panic(wasmruntime.ErrRuntimeInvalidConversionToInteger) + default: + panic("BUG") + } + } +} + +func (c *callEngine) callerModuleInstance() *wasm.ModuleInstance { + return moduleInstanceFromOpaquePtr(c.execCtx.callerModuleContextPtr) +} + +func opaqueViewFromPtr(ptr uintptr) []byte { + var opaque []byte + sh := (*reflect.SliceHeader)(unsafe.Pointer(&opaque)) + sh.Data = ptr + sh.Len = 24 + sh.Cap = 24 + return opaque +} + +const callStackCeiling = uintptr(50000000) // in uint64 (8 bytes) == 400000000 bytes in total == 400mb. + +func (c *callEngine) growStackWithGuarded() (newSP uintptr, err error) { + if wazevoapi.StackGuardCheckEnabled { + wazevoapi.CheckStackGuardPage(c.stack) + } + newSP, err = c.growStack() + if err != nil { + return + } + if wazevoapi.StackGuardCheckEnabled { + c.execCtx.stackBottomPtr = &c.stack[wazevoapi.StackGuardCheckGuardPageSize] + } + return +} + +// growStack grows the stack, and returns the new stack pointer. +func (c *callEngine) growStack() (newSP uintptr, err error) { + currentLen := uintptr(len(c.stack)) + if callStackCeiling < currentLen { + err = wasmruntime.ErrRuntimeStackOverflow + return + } + + newLen := 2*currentLen + c.execCtx.stackGrowRequiredSize + 16 // Stack might be aligned to 16 bytes, so add 16 bytes just in case. + newStack := make([]byte, newLen) + + relSp := c.stackTop - uintptr(unsafe.Pointer(c.execCtx.stackPointerBeforeGoCall)) + + // Copy the existing contents in the previous Go-allocated stack into the new one. + var prevStackAligned, newStackAligned []byte + { + sh := (*reflect.SliceHeader)(unsafe.Pointer(&prevStackAligned)) + sh.Data = c.stackTop - relSp + sh.Len = int(relSp) + sh.Cap = int(relSp) + } + newTop := alignedStackTop(newStack) + { + newSP = newTop - relSp + sh := (*reflect.SliceHeader)(unsafe.Pointer(&newStackAligned)) + sh.Data = newSP + sh.Len = int(relSp) + sh.Cap = int(relSp) + } + copy(newStackAligned, prevStackAligned) + + c.stack = newStack + c.stackTop = newTop + c.execCtx.stackBottomPtr = &newStack[0] + return +} + +func (c *callEngine) stackIterator(onHostCall bool) experimental.StackIterator { + c.stackIteratorImpl.reset(c, onHostCall) + return &c.stackIteratorImpl +} + +// stackIterator implements experimental.StackIterator. +type stackIterator struct { + retAddrs []uintptr + retAddrCursor int + eng *engine + pc uint64 + + currentDef *wasm.FunctionDefinition +} + +func (si *stackIterator) reset(c *callEngine, onHostCall bool) { + if onHostCall { + si.retAddrs = append(si.retAddrs[:0], uintptr(unsafe.Pointer(c.execCtx.goCallReturnAddress))) + } else { + si.retAddrs = si.retAddrs[:0] + } + si.retAddrs = unwindStack(uintptr(unsafe.Pointer(c.execCtx.stackPointerBeforeGoCall)), c.stackTop, si.retAddrs) + si.retAddrs = si.retAddrs[:len(si.retAddrs)-1] // the last return addr is the trampoline, so we skip it. + si.retAddrCursor = 0 + si.eng = c.parent.parent.parent +} + +// Next implements the same method as documented on experimental.StackIterator. +func (si *stackIterator) Next() bool { + if si.retAddrCursor >= len(si.retAddrs) { + return false + } + + addr := si.retAddrs[si.retAddrCursor] + cm := si.eng.compiledModuleOfAddr(addr) + if cm != nil { + index := cm.functionIndexOf(addr) + def := cm.module.FunctionDefinition(cm.module.ImportFunctionCount + index) + si.currentDef = def + si.retAddrCursor++ + si.pc = uint64(addr) + return true + } + return false +} + +// ProgramCounter implements the same method as documented on experimental.StackIterator. +func (si *stackIterator) ProgramCounter() experimental.ProgramCounter { + return experimental.ProgramCounter(si.pc) +} + +// Function implements the same method as documented on experimental.StackIterator. +func (si *stackIterator) Function() experimental.InternalFunction { + return si +} + +// Definition implements the same method as documented on experimental.InternalFunction. +func (si *stackIterator) Definition() api.FunctionDefinition { + return si.currentDef +} + +// SourceOffsetForPC implements the same method as documented on experimental.InternalFunction. +func (si *stackIterator) SourceOffsetForPC(pc experimental.ProgramCounter) uint64 { + upc := uintptr(pc) + cm := si.eng.compiledModuleOfAddr(upc) + return cm.getSourceOffset(upc) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/engine.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/engine.go new file mode 100644 index 000000000..faa1330fe --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/engine.go @@ -0,0 +1,765 @@ +package wazevo + +import ( + "context" + "encoding/hex" + "errors" + "fmt" + "runtime" + "sort" + "sync" + "unsafe" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/experimental" + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend" + "github.com/tetratelabs/wazero/internal/engine/wazevo/frontend" + "github.com/tetratelabs/wazero/internal/engine/wazevo/ssa" + "github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi" + "github.com/tetratelabs/wazero/internal/filecache" + "github.com/tetratelabs/wazero/internal/platform" + "github.com/tetratelabs/wazero/internal/version" + "github.com/tetratelabs/wazero/internal/wasm" +) + +type ( + // engine implements wasm.Engine. + engine struct { + wazeroVersion string + fileCache filecache.Cache + compiledModules map[wasm.ModuleID]*compiledModule + // sortedCompiledModules is a list of compiled modules sorted by the initial address of the executable. + sortedCompiledModules []*compiledModule + mux sync.RWMutex + // rels is a list of relocations to be resolved. This is reused for each compilation to avoid allocation. + rels []backend.RelocationInfo + // refToBinaryOffset is reused for each compilation to avoid allocation. + refToBinaryOffset map[ssa.FuncRef]int + // sharedFunctions is compiled functions shared by all modules. + sharedFunctions *sharedFunctions + // setFinalizer defaults to runtime.SetFinalizer, but overridable for tests. + setFinalizer func(obj interface{}, finalizer interface{}) + + // The followings are reused for compiling shared functions. + machine backend.Machine + be backend.Compiler + } + + sharedFunctions struct { + // memoryGrowExecutable is a compiled trampoline executable for memory.grow builtin function. + memoryGrowExecutable []byte + // checkModuleExitCode is a compiled trampoline executable for checking module instance exit code. This + // is used when ensureTermination is true. + checkModuleExitCode []byte + // stackGrowExecutable is a compiled executable for growing stack builtin function. + stackGrowExecutable []byte + // tableGrowExecutable is a compiled trampoline executable for table.grow builtin function. + tableGrowExecutable []byte + // refFuncExecutable is a compiled trampoline executable for ref.func builtin function. + refFuncExecutable []byte + listenerBeforeTrampolines map[*wasm.FunctionType][]byte + listenerAfterTrampolines map[*wasm.FunctionType][]byte + } + + // compiledModule is a compiled variant of a wasm.Module and ready to be used for instantiation. + compiledModule struct { + *executables + // functionOffsets maps a local function index to the offset in the executable. + functionOffsets []int + parent *engine + module *wasm.Module + ensureTermination bool + listeners []experimental.FunctionListener + listenerBeforeTrampolines []*byte + listenerAfterTrampolines []*byte + + // The followings are only available for non host modules. + + offsets wazevoapi.ModuleContextOffsetData + sharedFunctions *sharedFunctions + sourceMap sourceMap + } + + executables struct { + executable []byte + entryPreambles [][]byte + } +) + +// sourceMap is a mapping from the offset of the executable to the offset of the original wasm binary. +type sourceMap struct { + // executableOffsets is a sorted list of offsets of the executable. This is index-correlated with wasmBinaryOffsets, + // in other words executableOffsets[i] is the offset of the executable which corresponds to the offset of a Wasm + // binary pointed by wasmBinaryOffsets[i]. + executableOffsets []uintptr + // wasmBinaryOffsets is the counterpart of executableOffsets. + wasmBinaryOffsets []uint64 +} + +var _ wasm.Engine = (*engine)(nil) + +// NewEngine returns the implementation of wasm.Engine. +func NewEngine(ctx context.Context, _ api.CoreFeatures, fc filecache.Cache) wasm.Engine { + machine := newMachine() + be := backend.NewCompiler(ctx, machine, ssa.NewBuilder()) + e := &engine{ + compiledModules: make(map[wasm.ModuleID]*compiledModule), refToBinaryOffset: make(map[ssa.FuncRef]int), + setFinalizer: runtime.SetFinalizer, + machine: machine, + be: be, + fileCache: fc, + wazeroVersion: version.GetWazeroVersion(), + } + e.compileSharedFunctions() + return e +} + +// CompileModule implements wasm.Engine. +func (e *engine) CompileModule(ctx context.Context, module *wasm.Module, listeners []experimental.FunctionListener, ensureTermination bool) (err error) { + if wazevoapi.PerfMapEnabled { + wazevoapi.PerfMap.Lock() + defer wazevoapi.PerfMap.Unlock() + } + + if _, ok, err := e.getCompiledModule(module, listeners, ensureTermination); ok { // cache hit! + return nil + } else if err != nil { + return err + } + + if wazevoapi.DeterministicCompilationVerifierEnabled { + ctx = wazevoapi.NewDeterministicCompilationVerifierContext(ctx, len(module.CodeSection)) + } + cm, err := e.compileModule(ctx, module, listeners, ensureTermination) + if err != nil { + return err + } + if err = e.addCompiledModule(module, cm); err != nil { + return err + } + + if wazevoapi.DeterministicCompilationVerifierEnabled { + for i := 0; i < wazevoapi.DeterministicCompilationVerifyingIter; i++ { + _, err := e.compileModule(ctx, module, listeners, ensureTermination) + if err != nil { + return err + } + } + } + + if len(listeners) > 0 { + cm.listeners = listeners + cm.listenerBeforeTrampolines = make([]*byte, len(module.TypeSection)) + cm.listenerAfterTrampolines = make([]*byte, len(module.TypeSection)) + for i := range module.TypeSection { + typ := &module.TypeSection[i] + before, after := e.getListenerTrampolineForType(typ) + cm.listenerBeforeTrampolines[i] = before + cm.listenerAfterTrampolines[i] = after + } + } + return nil +} + +func (exec *executables) compileEntryPreambles(m *wasm.Module, machine backend.Machine, be backend.Compiler) { + exec.entryPreambles = make([][]byte, len(m.TypeSection)) + for i := range m.TypeSection { + typ := &m.TypeSection[i] + sig := frontend.SignatureForWasmFunctionType(typ) + be.Init() + buf := machine.CompileEntryPreamble(&sig) + executable := mmapExecutable(buf) + exec.entryPreambles[i] = executable + + if wazevoapi.PerfMapEnabled { + wazevoapi.PerfMap.AddEntry(uintptr(unsafe.Pointer(&executable[0])), + uint64(len(executable)), fmt.Sprintf("entry_preamble::type=%s", typ.String())) + } + } +} + +func (e *engine) compileModule(ctx context.Context, module *wasm.Module, listeners []experimental.FunctionListener, ensureTermination bool) (*compiledModule, error) { + withListener := len(listeners) > 0 + e.rels = e.rels[:0] + cm := &compiledModule{ + offsets: wazevoapi.NewModuleContextOffsetData(module, withListener), parent: e, module: module, + ensureTermination: ensureTermination, + executables: &executables{}, + } + + if module.IsHostModule { + return e.compileHostModule(ctx, module, listeners) + } + + importedFns, localFns := int(module.ImportFunctionCount), len(module.FunctionSection) + if localFns == 0 { + return cm, nil + } + + if wazevoapi.DeterministicCompilationVerifierEnabled { + // The compilation must be deterministic regardless of the order of functions being compiled. + wazevoapi.DeterministicCompilationVerifierRandomizeIndexes(ctx) + } + + needSourceInfo := module.DWARFLines != nil + + // Creates new compiler instances which are reused for each function. + ssaBuilder := ssa.NewBuilder() + fe := frontend.NewFrontendCompiler(module, ssaBuilder, &cm.offsets, ensureTermination, withListener, needSourceInfo) + machine := newMachine() + be := backend.NewCompiler(ctx, machine, ssaBuilder) + + cm.executables.compileEntryPreambles(module, machine, be) + + totalSize := 0 // Total binary size of the executable. + cm.functionOffsets = make([]int, localFns) + bodies := make([][]byte, localFns) + for i := range module.CodeSection { + if wazevoapi.DeterministicCompilationVerifierEnabled { + i = wazevoapi.DeterministicCompilationVerifierGetRandomizedLocalFunctionIndex(ctx, i) + } + + fidx := wasm.Index(i + importedFns) + + if wazevoapi.NeedFunctionNameInContext { + def := module.FunctionDefinition(fidx) + name := def.DebugName() + if len(def.ExportNames()) > 0 { + name = def.ExportNames()[0] + } + ctx = wazevoapi.SetCurrentFunctionName(ctx, i, fmt.Sprintf("[%d/%d]%s", i, len(module.CodeSection)-1, name)) + } + + needListener := len(listeners) > 0 && listeners[i] != nil + body, rels, err := e.compileLocalWasmFunction(ctx, module, wasm.Index(i), fe, ssaBuilder, be, needListener) + if err != nil { + return nil, fmt.Errorf("compile function %d/%d: %v", i, len(module.CodeSection)-1, err) + } + + // Align 16-bytes boundary. + totalSize = (totalSize + 15) &^ 15 + cm.functionOffsets[i] = totalSize + + if needSourceInfo { + // At the beginning of the function, we add the offset of the function body so that + // we can resolve the source location of the call site of before listener call. + cm.sourceMap.executableOffsets = append(cm.sourceMap.executableOffsets, uintptr(totalSize)) + cm.sourceMap.wasmBinaryOffsets = append(cm.sourceMap.wasmBinaryOffsets, module.CodeSection[i].BodyOffsetInCodeSection) + + for _, info := range be.SourceOffsetInfo() { + cm.sourceMap.executableOffsets = append(cm.sourceMap.executableOffsets, uintptr(totalSize)+uintptr(info.ExecutableOffset)) + cm.sourceMap.wasmBinaryOffsets = append(cm.sourceMap.wasmBinaryOffsets, uint64(info.SourceOffset)) + } + } + + fref := frontend.FunctionIndexToFuncRef(fidx) + e.refToBinaryOffset[fref] = totalSize + + // At this point, relocation offsets are relative to the start of the function body, + // so we adjust it to the start of the executable. + for _, r := range rels { + r.Offset += int64(totalSize) + e.rels = append(e.rels, r) + } + + bodies[i] = body + totalSize += len(body) + if wazevoapi.PrintMachineCodeHexPerFunction { + fmt.Printf("[[[machine code for %s]]]\n%s\n\n", wazevoapi.GetCurrentFunctionName(ctx), hex.EncodeToString(body)) + } + } + + // Allocate executable memory and then copy the generated machine code. + executable, err := platform.MmapCodeSegment(totalSize) + if err != nil { + panic(err) + } + cm.executable = executable + + for i, b := range bodies { + offset := cm.functionOffsets[i] + copy(executable[offset:], b) + } + + if wazevoapi.PerfMapEnabled { + wazevoapi.PerfMap.Flush(uintptr(unsafe.Pointer(&executable[0])), cm.functionOffsets) + } + + if needSourceInfo { + for i := range cm.sourceMap.executableOffsets { + cm.sourceMap.executableOffsets[i] += uintptr(unsafe.Pointer(&cm.executable[0])) + } + } + + // Resolve relocations for local function calls. + machine.ResolveRelocations(e.refToBinaryOffset, executable, e.rels) + + if runtime.GOARCH == "arm64" { + // On arm64, we cannot give all of rwx at the same time, so we change it to exec. + if err = platform.MprotectRX(executable); err != nil { + return nil, err + } + } + cm.sharedFunctions = e.sharedFunctions + e.setFinalizer(cm.executables, executablesFinalizer) + return cm, nil +} + +func (e *engine) compileLocalWasmFunction( + ctx context.Context, + module *wasm.Module, + localFunctionIndex wasm.Index, + fe *frontend.Compiler, + ssaBuilder ssa.Builder, + be backend.Compiler, + needListener bool, +) (body []byte, rels []backend.RelocationInfo, err error) { + typIndex := module.FunctionSection[localFunctionIndex] + typ := &module.TypeSection[typIndex] + codeSeg := &module.CodeSection[localFunctionIndex] + + // Initializes both frontend and backend compilers. + fe.Init(localFunctionIndex, typIndex, typ, codeSeg.LocalTypes, codeSeg.Body, needListener, codeSeg.BodyOffsetInCodeSection) + be.Init() + + // Lower Wasm to SSA. + fe.LowerToSSA() + if wazevoapi.PrintSSA && wazevoapi.PrintEnabledIndex(ctx) { + fmt.Printf("[[[SSA for %s]]]%s\n", wazevoapi.GetCurrentFunctionName(ctx), ssaBuilder.Format()) + } + + if wazevoapi.DeterministicCompilationVerifierEnabled { + wazevoapi.VerifyOrSetDeterministicCompilationContextValue(ctx, "SSA", ssaBuilder.Format()) + } + + // Run SSA-level optimization passes. + ssaBuilder.RunPasses() + + if wazevoapi.PrintOptimizedSSA && wazevoapi.PrintEnabledIndex(ctx) { + fmt.Printf("[[[Optimized SSA for %s]]]%s\n", wazevoapi.GetCurrentFunctionName(ctx), ssaBuilder.Format()) + } + + if wazevoapi.DeterministicCompilationVerifierEnabled { + wazevoapi.VerifyOrSetDeterministicCompilationContextValue(ctx, "Optimized SSA", ssaBuilder.Format()) + } + + // Finalize the layout of SSA blocks which might use the optimization results. + ssaBuilder.LayoutBlocks() + + if wazevoapi.PrintBlockLaidOutSSA && wazevoapi.PrintEnabledIndex(ctx) { + fmt.Printf("[[[Laidout SSA for %s]]]%s\n", wazevoapi.GetCurrentFunctionName(ctx), ssaBuilder.Format()) + } + + if wazevoapi.DeterministicCompilationVerifierEnabled { + wazevoapi.VerifyOrSetDeterministicCompilationContextValue(ctx, "Block laid out SSA", ssaBuilder.Format()) + } + + // Now our ssaBuilder contains the necessary information to further lower them to + // machine code. + original, rels, err := be.Compile(ctx) + if err != nil { + return nil, nil, fmt.Errorf("ssa->machine code: %v", err) + } + + // TODO: optimize as zero copy. + copied := make([]byte, len(original)) + copy(copied, original) + return copied, rels, nil +} + +func (e *engine) compileHostModule(ctx context.Context, module *wasm.Module, listeners []experimental.FunctionListener) (*compiledModule, error) { + machine := newMachine() + be := backend.NewCompiler(ctx, machine, ssa.NewBuilder()) + + num := len(module.CodeSection) + cm := &compiledModule{module: module, listeners: listeners, executables: &executables{}} + cm.functionOffsets = make([]int, num) + totalSize := 0 // Total binary size of the executable. + bodies := make([][]byte, num) + var sig ssa.Signature + for i := range module.CodeSection { + totalSize = (totalSize + 15) &^ 15 + cm.functionOffsets[i] = totalSize + + typIndex := module.FunctionSection[i] + typ := &module.TypeSection[typIndex] + + // We can relax until the index fits together in ExitCode as we do in wazevoapi.ExitCodeCallGoModuleFunctionWithIndex. + // However, 1 << 16 should be large enough for a real use case. + const hostFunctionNumMaximum = 1 << 16 + if i >= hostFunctionNumMaximum { + return nil, fmt.Errorf("too many host functions (maximum %d)", hostFunctionNumMaximum) + } + + sig.ID = ssa.SignatureID(typIndex) // This is important since we reuse the `machine` which caches the ABI based on the SignatureID. + sig.Params = append(sig.Params[:0], + ssa.TypeI64, // First argument must be exec context. + ssa.TypeI64, // The second argument is the moduleContextOpaque of this host module. + ) + for _, t := range typ.Params { + sig.Params = append(sig.Params, frontend.WasmTypeToSSAType(t)) + } + + sig.Results = sig.Results[:0] + for _, t := range typ.Results { + sig.Results = append(sig.Results, frontend.WasmTypeToSSAType(t)) + } + + c := &module.CodeSection[i] + if c.GoFunc == nil { + panic("BUG: GoFunc must be set for host module") + } + + withListener := len(listeners) > 0 && listeners[i] != nil + var exitCode wazevoapi.ExitCode + fn := c.GoFunc + switch fn.(type) { + case api.GoModuleFunction: + exitCode = wazevoapi.ExitCodeCallGoModuleFunctionWithIndex(i, withListener) + case api.GoFunction: + exitCode = wazevoapi.ExitCodeCallGoFunctionWithIndex(i, withListener) + } + + be.Init() + machine.CompileGoFunctionTrampoline(exitCode, &sig, true) + be.Encode() + body := be.Buf() + + if wazevoapi.PerfMapEnabled { + name := module.FunctionDefinition(wasm.Index(i)).DebugName() + wazevoapi.PerfMap.AddModuleEntry(i, + int64(totalSize), + uint64(len(body)), + fmt.Sprintf("trampoline:%s", name)) + } + + // TODO: optimize as zero copy. + copied := make([]byte, len(body)) + copy(copied, body) + bodies[i] = copied + totalSize += len(body) + } + + // Allocate executable memory and then copy the generated machine code. + executable, err := platform.MmapCodeSegment(totalSize) + if err != nil { + panic(err) + } + cm.executable = executable + + for i, b := range bodies { + offset := cm.functionOffsets[i] + copy(executable[offset:], b) + } + + if wazevoapi.PerfMapEnabled { + wazevoapi.PerfMap.Flush(uintptr(unsafe.Pointer(&executable[0])), cm.functionOffsets) + } + + if runtime.GOARCH == "arm64" { + // On arm64, we cannot give all of rwx at the same time, so we change it to exec. + if err = platform.MprotectRX(executable); err != nil { + return nil, err + } + } + e.setFinalizer(cm.executables, executablesFinalizer) + return cm, nil +} + +// Close implements wasm.Engine. +func (e *engine) Close() (err error) { + e.mux.Lock() + defer e.mux.Unlock() + + for _, cm := range e.compiledModules { + cm.functionOffsets = nil + cm.module = nil + cm.parent = nil + cm.executables = nil + } + e.sortedCompiledModules = nil + e.compiledModules = nil + e.sharedFunctions = nil + return nil +} + +// CompiledModuleCount implements wasm.Engine. +func (e *engine) CompiledModuleCount() uint32 { + e.mux.RLock() + defer e.mux.RUnlock() + return uint32(len(e.compiledModules)) +} + +// DeleteCompiledModule implements wasm.Engine. +func (e *engine) DeleteCompiledModule(m *wasm.Module) { + e.mux.Lock() + defer e.mux.Unlock() + cm, ok := e.compiledModules[m.ID] + if ok { + if len(cm.executable) > 0 { + e.deleteCompiledModuleFromSortedList(cm) + } + delete(e.compiledModules, m.ID) + } +} + +func (e *engine) addCompiledModuleToSortedList(cm *compiledModule) { + ptr := uintptr(unsafe.Pointer(&cm.executable[0])) + + index := sort.Search(len(e.sortedCompiledModules), func(i int) bool { + return uintptr(unsafe.Pointer(&e.sortedCompiledModules[i].executable[0])) >= ptr + }) + e.sortedCompiledModules = append(e.sortedCompiledModules, nil) + copy(e.sortedCompiledModules[index+1:], e.sortedCompiledModules[index:]) + e.sortedCompiledModules[index] = cm +} + +func (e *engine) deleteCompiledModuleFromSortedList(cm *compiledModule) { + ptr := uintptr(unsafe.Pointer(&cm.executable[0])) + + index := sort.Search(len(e.sortedCompiledModules), func(i int) bool { + return uintptr(unsafe.Pointer(&e.sortedCompiledModules[i].executable[0])) >= ptr + }) + if index >= len(e.sortedCompiledModules) { + return + } + copy(e.sortedCompiledModules[index:], e.sortedCompiledModules[index+1:]) + e.sortedCompiledModules = e.sortedCompiledModules[:len(e.sortedCompiledModules)-1] +} + +func (e *engine) compiledModuleOfAddr(addr uintptr) *compiledModule { + e.mux.RLock() + defer e.mux.RUnlock() + + index := sort.Search(len(e.sortedCompiledModules), func(i int) bool { + return uintptr(unsafe.Pointer(&e.sortedCompiledModules[i].executable[0])) > addr + }) + index -= 1 + if index < 0 { + return nil + } + return e.sortedCompiledModules[index] +} + +// NewModuleEngine implements wasm.Engine. +func (e *engine) NewModuleEngine(m *wasm.Module, mi *wasm.ModuleInstance) (wasm.ModuleEngine, error) { + me := &moduleEngine{} + + // Note: imported functions are resolved in moduleEngine.ResolveImportedFunction. + me.importedFunctions = make([]importedFunction, m.ImportFunctionCount) + + compiled, ok := e.compiledModules[m.ID] + if !ok { + return nil, errors.New("source module must be compiled before instantiation") + } + me.parent = compiled + me.module = mi + me.listeners = compiled.listeners + + if m.IsHostModule { + me.opaque = buildHostModuleOpaque(m, compiled.listeners) + me.opaquePtr = &me.opaque[0] + } else { + if size := compiled.offsets.TotalSize; size != 0 { + opaque := make([]byte, size) + me.opaque = opaque + me.opaquePtr = &opaque[0] + } + } + return me, nil +} + +func (e *engine) compileSharedFunctions() { + e.sharedFunctions = &sharedFunctions{ + listenerBeforeTrampolines: make(map[*wasm.FunctionType][]byte), + listenerAfterTrampolines: make(map[*wasm.FunctionType][]byte), + } + + e.be.Init() + { + src := e.machine.CompileGoFunctionTrampoline(wazevoapi.ExitCodeGrowMemory, &ssa.Signature{ + Params: []ssa.Type{ssa.TypeI64 /* exec context */, ssa.TypeI32}, + Results: []ssa.Type{ssa.TypeI32}, + }, false) + e.sharedFunctions.memoryGrowExecutable = mmapExecutable(src) + if wazevoapi.PerfMapEnabled { + exe := e.sharedFunctions.memoryGrowExecutable + wazevoapi.PerfMap.AddEntry(uintptr(unsafe.Pointer(&exe[0])), uint64(len(exe)), "memory_grow_trampoline") + } + } + + e.be.Init() + { + src := e.machine.CompileGoFunctionTrampoline(wazevoapi.ExitCodeTableGrow, &ssa.Signature{ + Params: []ssa.Type{ssa.TypeI64 /* exec context */, ssa.TypeI32 /* table index */, ssa.TypeI32 /* num */, ssa.TypeI64 /* ref */}, + Results: []ssa.Type{ssa.TypeI32}, + }, false) + e.sharedFunctions.tableGrowExecutable = mmapExecutable(src) + if wazevoapi.PerfMapEnabled { + exe := e.sharedFunctions.tableGrowExecutable + wazevoapi.PerfMap.AddEntry(uintptr(unsafe.Pointer(&exe[0])), uint64(len(exe)), "table_grow_trampoline") + } + } + + e.be.Init() + { + src := e.machine.CompileGoFunctionTrampoline(wazevoapi.ExitCodeCheckModuleExitCode, &ssa.Signature{ + Params: []ssa.Type{ssa.TypeI32 /* exec context */}, + Results: []ssa.Type{ssa.TypeI32}, + }, false) + e.sharedFunctions.checkModuleExitCode = mmapExecutable(src) + if wazevoapi.PerfMapEnabled { + exe := e.sharedFunctions.checkModuleExitCode + wazevoapi.PerfMap.AddEntry(uintptr(unsafe.Pointer(&exe[0])), uint64(len(exe)), "check_module_exit_code_trampoline") + } + } + + e.be.Init() + { + src := e.machine.CompileGoFunctionTrampoline(wazevoapi.ExitCodeRefFunc, &ssa.Signature{ + Params: []ssa.Type{ssa.TypeI64 /* exec context */, ssa.TypeI32 /* function index */}, + Results: []ssa.Type{ssa.TypeI64}, // returns the function reference. + }, false) + e.sharedFunctions.refFuncExecutable = mmapExecutable(src) + if wazevoapi.PerfMapEnabled { + exe := e.sharedFunctions.refFuncExecutable + wazevoapi.PerfMap.AddEntry(uintptr(unsafe.Pointer(&exe[0])), uint64(len(exe)), "ref_func_trampoline") + } + } + + e.be.Init() + { + src := e.machine.CompileStackGrowCallSequence() + e.sharedFunctions.stackGrowExecutable = mmapExecutable(src) + if wazevoapi.PerfMapEnabled { + exe := e.sharedFunctions.stackGrowExecutable + wazevoapi.PerfMap.AddEntry(uintptr(unsafe.Pointer(&exe[0])), uint64(len(exe)), "stack_grow_trampoline") + } + } + + e.setFinalizer(e.sharedFunctions, sharedFunctionsFinalizer) +} + +func sharedFunctionsFinalizer(sf *sharedFunctions) { + if err := platform.MunmapCodeSegment(sf.memoryGrowExecutable); err != nil { + panic(err) + } + if err := platform.MunmapCodeSegment(sf.checkModuleExitCode); err != nil { + panic(err) + } + if err := platform.MunmapCodeSegment(sf.stackGrowExecutable); err != nil { + panic(err) + } + if err := platform.MunmapCodeSegment(sf.tableGrowExecutable); err != nil { + panic(err) + } + if err := platform.MunmapCodeSegment(sf.refFuncExecutable); err != nil { + panic(err) + } + for _, f := range sf.listenerBeforeTrampolines { + if err := platform.MunmapCodeSegment(f); err != nil { + panic(err) + } + } + for _, f := range sf.listenerAfterTrampolines { + if err := platform.MunmapCodeSegment(f); err != nil { + panic(err) + } + } + + sf.memoryGrowExecutable = nil + sf.checkModuleExitCode = nil + sf.stackGrowExecutable = nil + sf.tableGrowExecutable = nil + sf.refFuncExecutable = nil + sf.listenerBeforeTrampolines = nil + sf.listenerAfterTrampolines = nil +} + +func executablesFinalizer(exec *executables) { + if len(exec.executable) > 0 { + if err := platform.MunmapCodeSegment(exec.executable); err != nil { + panic(err) + } + } + exec.executable = nil + + for _, f := range exec.entryPreambles { + if err := platform.MunmapCodeSegment(f); err != nil { + panic(err) + } + } + exec.entryPreambles = nil +} + +func mmapExecutable(src []byte) []byte { + executable, err := platform.MmapCodeSegment(len(src)) + if err != nil { + panic(err) + } + + copy(executable, src) + + if runtime.GOARCH == "arm64" { + // On arm64, we cannot give all of rwx at the same time, so we change it to exec. + if err = platform.MprotectRX(executable); err != nil { + panic(err) + } + } + return executable +} + +func (cm *compiledModule) functionIndexOf(addr uintptr) wasm.Index { + addr -= uintptr(unsafe.Pointer(&cm.executable[0])) + offset := cm.functionOffsets + index := sort.Search(len(offset), func(i int) bool { + return offset[i] > int(addr) + }) + index-- + if index < 0 { + panic("BUG") + } + return wasm.Index(index) +} + +func (e *engine) getListenerTrampolineForType(functionType *wasm.FunctionType) (before, after *byte) { + e.mux.Lock() + defer e.mux.Unlock() + + beforeBuf, ok := e.sharedFunctions.listenerBeforeTrampolines[functionType] + afterBuf := e.sharedFunctions.listenerAfterTrampolines[functionType] + if ok { + return &beforeBuf[0], &afterBuf[0] + } + + beforeSig, afterSig := frontend.SignatureForListener(functionType) + + e.be.Init() + buf := e.machine.CompileGoFunctionTrampoline(wazevoapi.ExitCodeCallListenerBefore, beforeSig, false) + beforeBuf = mmapExecutable(buf) + + e.be.Init() + buf = e.machine.CompileGoFunctionTrampoline(wazevoapi.ExitCodeCallListenerAfter, afterSig, false) + afterBuf = mmapExecutable(buf) + + e.sharedFunctions.listenerBeforeTrampolines[functionType] = beforeBuf + e.sharedFunctions.listenerAfterTrampolines[functionType] = afterBuf + return &beforeBuf[0], &afterBuf[0] +} + +func (cm *compiledModule) getSourceOffset(pc uintptr) uint64 { + offsets := cm.sourceMap.executableOffsets + if len(offsets) == 0 { + return 0 + } + + index := sort.Search(len(offsets), func(i int) bool { + return offsets[i] >= pc + }) + + index-- + if index < 0 { + return 0 + } + return cm.sourceMap.wasmBinaryOffsets[index] +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/engine_cache.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/engine_cache.go new file mode 100644 index 000000000..fedc4d057 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/engine_cache.go @@ -0,0 +1,283 @@ +package wazevo + +import ( + "bytes" + "context" + "crypto/sha256" + "encoding/binary" + "fmt" + "io" + "runtime" + "unsafe" + + "github.com/tetratelabs/wazero/experimental" + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend" + "github.com/tetratelabs/wazero/internal/engine/wazevo/ssa" + "github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi" + "github.com/tetratelabs/wazero/internal/filecache" + "github.com/tetratelabs/wazero/internal/platform" + "github.com/tetratelabs/wazero/internal/u32" + "github.com/tetratelabs/wazero/internal/u64" + "github.com/tetratelabs/wazero/internal/wasm" +) + +// fileCacheKey returns a key for the file cache. +// In order to avoid collisions with the existing compiler, we do not use m.ID directly, +// but instead we rehash it with magic. +func fileCacheKey(m *wasm.Module) (ret filecache.Key) { + s := sha256.New() + s.Write(m.ID[:]) + s.Write(magic) + s.Sum(ret[:0]) + return +} + +func (e *engine) addCompiledModule(module *wasm.Module, cm *compiledModule) (err error) { + e.addCompiledModuleToMemory(module, cm) + if !module.IsHostModule && e.fileCache != nil { + err = e.addCompiledModuleToCache(module, cm) + } + return +} + +func (e *engine) getCompiledModule(module *wasm.Module, listeners []experimental.FunctionListener, ensureTermination bool) (cm *compiledModule, ok bool, err error) { + cm, ok = e.getCompiledModuleFromMemory(module) + if ok { + return + } + cm, ok, err = e.getCompiledModuleFromCache(module) + if ok { + cm.parent = e + cm.module = module + cm.sharedFunctions = e.sharedFunctions + cm.ensureTermination = ensureTermination + cm.offsets = wazevoapi.NewModuleContextOffsetData(module, len(listeners) > 0) + if len(listeners) > 0 { + cm.listeners = listeners + cm.listenerBeforeTrampolines = make([]*byte, len(module.TypeSection)) + cm.listenerAfterTrampolines = make([]*byte, len(module.TypeSection)) + for i := range module.TypeSection { + typ := &module.TypeSection[i] + before, after := e.getListenerTrampolineForType(typ) + cm.listenerBeforeTrampolines[i] = before + cm.listenerAfterTrampolines[i] = after + } + } + e.addCompiledModuleToMemory(module, cm) + ssaBuilder := ssa.NewBuilder() + machine := newMachine() + be := backend.NewCompiler(context.Background(), machine, ssaBuilder) + cm.executables.compileEntryPreambles(module, machine, be) + + // Set the finalizer. + e.setFinalizer(cm.executables, executablesFinalizer) + } + return +} + +func (e *engine) addCompiledModuleToMemory(m *wasm.Module, cm *compiledModule) { + e.mux.Lock() + defer e.mux.Unlock() + e.compiledModules[m.ID] = cm + if len(cm.executable) > 0 { + e.addCompiledModuleToSortedList(cm) + } +} + +func (e *engine) getCompiledModuleFromMemory(module *wasm.Module) (cm *compiledModule, ok bool) { + e.mux.RLock() + defer e.mux.RUnlock() + cm, ok = e.compiledModules[module.ID] + return +} + +func (e *engine) addCompiledModuleToCache(module *wasm.Module, cm *compiledModule) (err error) { + if e.fileCache == nil || module.IsHostModule { + return + } + err = e.fileCache.Add(fileCacheKey(module), serializeCompiledModule(e.wazeroVersion, cm)) + return +} + +func (e *engine) getCompiledModuleFromCache(module *wasm.Module) (cm *compiledModule, hit bool, err error) { + if e.fileCache == nil || module.IsHostModule { + return + } + + // Check if the entries exist in the external cache. + var cached io.ReadCloser + cached, hit, err = e.fileCache.Get(fileCacheKey(module)) + if !hit || err != nil { + return + } + + // Otherwise, we hit the cache on external cache. + // We retrieve *code structures from `cached`. + var staleCache bool + // Note: cached.Close is ensured to be called in deserializeCodes. + cm, staleCache, err = deserializeCompiledModule(e.wazeroVersion, cached) + if err != nil { + hit = false + return + } else if staleCache { + return nil, false, e.fileCache.Delete(fileCacheKey(module)) + } + return +} + +var magic = []byte{'W', 'A', 'Z', 'E', 'V', 'O'} + +func serializeCompiledModule(wazeroVersion string, cm *compiledModule) io.Reader { + buf := bytes.NewBuffer(nil) + // First 6 byte: WAZEVO header. + buf.Write(magic) + // Next 1 byte: length of version: + buf.WriteByte(byte(len(wazeroVersion))) + // Version of wazero. + buf.WriteString(wazeroVersion) + // Number of *code (== locally defined functions in the module): 4 bytes. + buf.Write(u32.LeBytes(uint32(len(cm.functionOffsets)))) + for _, offset := range cm.functionOffsets { + // The offset of this function in the executable (8 bytes). + buf.Write(u64.LeBytes(uint64(offset))) + } + // The length of code segment (8 bytes). + buf.Write(u64.LeBytes(uint64(len(cm.executable)))) + // Append the native code. + buf.Write(cm.executable) + if sm := cm.sourceMap; len(sm.executableOffsets) > 0 { + buf.WriteByte(1) // indicates that source map is present. + l := len(sm.wasmBinaryOffsets) + buf.Write(u64.LeBytes(uint64(l))) + executableAddr := uintptr(unsafe.Pointer(&cm.executable[0])) + for i := 0; i < l; i++ { + buf.Write(u64.LeBytes(sm.wasmBinaryOffsets[i])) + // executableOffsets is absolute address, so we need to subtract executableAddr. + buf.Write(u64.LeBytes(uint64(sm.executableOffsets[i] - executableAddr))) + } + } else { + buf.WriteByte(0) // indicates that source map is not present. + } + return bytes.NewReader(buf.Bytes()) +} + +func deserializeCompiledModule(wazeroVersion string, reader io.ReadCloser) (cm *compiledModule, staleCache bool, err error) { + defer reader.Close() + cacheHeaderSize := len(magic) + 1 /* version size */ + len(wazeroVersion) + 4 /* number of functions */ + + // Read the header before the native code. + header := make([]byte, cacheHeaderSize) + n, err := reader.Read(header) + if err != nil { + return nil, false, fmt.Errorf("compilationcache: error reading header: %v", err) + } + + if n != cacheHeaderSize { + return nil, false, fmt.Errorf("compilationcache: invalid header length: %d", n) + } + + if !bytes.Equal(header[:len(magic)], magic) { + return nil, false, fmt.Errorf( + "compilationcache: invalid magic number: got %s but want %s", magic, header[:len(magic)]) + } + + // Check the version compatibility. + versionSize := int(header[len(magic)]) + + cachedVersionBegin, cachedVersionEnd := len(magic)+1, len(magic)+1+versionSize + if cachedVersionEnd >= len(header) { + staleCache = true + return + } else if cachedVersion := string(header[cachedVersionBegin:cachedVersionEnd]); cachedVersion != wazeroVersion { + staleCache = true + return + } + + functionsNum := binary.LittleEndian.Uint32(header[len(header)-4:]) + cm = &compiledModule{functionOffsets: make([]int, functionsNum), executables: &executables{}} + + var eightBytes [8]byte + for i := uint32(0); i < functionsNum; i++ { + // Read the offset of each function in the executable. + var offset uint64 + if offset, err = readUint64(reader, &eightBytes); err != nil { + err = fmt.Errorf("compilationcache: error reading func[%d] executable offset: %v", i, err) + return + } + cm.functionOffsets[i] = int(offset) + } + + executableLen, err := readUint64(reader, &eightBytes) + if err != nil { + err = fmt.Errorf("compilationcache: error reading executable size: %v", err) + return + } + + if executableLen > 0 { + executable, err := platform.MmapCodeSegment(int(executableLen)) + if err != nil { + err = fmt.Errorf("compilationcache: error mmapping executable (len=%d): %v", executableLen, err) + return nil, false, err + } + + _, err = io.ReadFull(reader, executable) + if err != nil { + err = fmt.Errorf("compilationcache: error reading executable (len=%d): %v", executableLen, err) + return nil, false, err + } + + if runtime.GOARCH == "arm64" { + // On arm64, we cannot give all of rwx at the same time, so we change it to exec. + if err = platform.MprotectRX(executable); err != nil { + return nil, false, err + } + } + cm.executable = executable + } + + if _, err := io.ReadFull(reader, eightBytes[:1]); err != nil { + return nil, false, fmt.Errorf("compilationcache: error reading source map presence: %v", err) + } + + if eightBytes[0] == 1 { + sm := &cm.sourceMap + sourceMapLen, err := readUint64(reader, &eightBytes) + if err != nil { + err = fmt.Errorf("compilationcache: error reading source map length: %v", err) + return nil, false, err + } + executableOffset := uintptr(unsafe.Pointer(&cm.executable[0])) + for i := uint64(0); i < sourceMapLen; i++ { + wasmBinaryOffset, err := readUint64(reader, &eightBytes) + if err != nil { + err = fmt.Errorf("compilationcache: error reading source map[%d] wasm binary offset: %v", i, err) + return nil, false, err + } + executableRelativeOffset, err := readUint64(reader, &eightBytes) + if err != nil { + err = fmt.Errorf("compilationcache: error reading source map[%d] executable offset: %v", i, err) + return nil, false, err + } + sm.wasmBinaryOffsets = append(sm.wasmBinaryOffsets, wasmBinaryOffset) + // executableOffsets is absolute address, so we need to add executableOffset. + sm.executableOffsets = append(sm.executableOffsets, uintptr(executableRelativeOffset)+executableOffset) + } + } + return +} + +// readUint64 strictly reads an uint64 in little-endian byte order, using the +// given array as a buffer. This returns io.EOF if less than 8 bytes were read. +func readUint64(reader io.Reader, b *[8]byte) (uint64, error) { + s := b[0:8] + n, err := reader.Read(s) + if err != nil { + return 0, err + } else if n < 8 { // more strict than reader.Read + return 0, io.EOF + } + + // Read the u64 from the underlying buffer. + ret := binary.LittleEndian.Uint64(s) + return ret, nil +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/entrypoint_arm64.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/entrypoint_arm64.go new file mode 100644 index 000000000..95ceeff59 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/entrypoint_arm64.go @@ -0,0 +1,13 @@ +package wazevo + +import _ "unsafe" + +// entrypoint is implemented by the backend. +// +//go:linkname entrypoint github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64.entrypoint +func entrypoint(preambleExecutable, functionExecutable *byte, executionContextPtr uintptr, moduleContextPtr *byte, paramResultStackPtr *uint64, goAllocatedStackSlicePtr uintptr) + +// entrypoint is implemented by the backend. +// +//go:linkname afterGoFunctionCallEntrypoint github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64.afterGoFunctionCallEntrypoint +func afterGoFunctionCallEntrypoint(executable *byte, executionContextPtr uintptr, stackPointer uintptr) diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/entrypoint_others.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/entrypoint_others.go new file mode 100644 index 000000000..5fd25f971 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/entrypoint_others.go @@ -0,0 +1,15 @@ +//go:build !arm64 + +package wazevo + +import ( + "runtime" +) + +func entrypoint(preambleExecutable, functionExecutable *byte, executionContextPtr uintptr, moduleContextPtr *byte, paramResultStackPtr *uint64, goAllocatedStackSlicePtr uintptr) { + panic(runtime.GOARCH) +} + +func afterGoFunctionCallEntrypoint(executable *byte, executionContextPtr uintptr, stackPointer uintptr) { + panic(runtime.GOARCH) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/frontend/frontend.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/frontend/frontend.go new file mode 100644 index 000000000..ac92a3760 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/frontend/frontend.go @@ -0,0 +1,403 @@ +// Package frontend implements the translation of WebAssembly to SSA IR using the ssa package. +package frontend + +import ( + "bytes" + + "github.com/tetratelabs/wazero/internal/engine/wazevo/ssa" + "github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi" + "github.com/tetratelabs/wazero/internal/wasm" +) + +// Compiler is in charge of lowering Wasm to SSA IR, and does the optimization +// on top of it in architecture-independent way. +type Compiler struct { + // Per-module data that is used across all functions. + + m *wasm.Module + offset *wazevoapi.ModuleContextOffsetData + // ssaBuilder is a ssa.Builder used by this frontend. + ssaBuilder ssa.Builder + signatures map[*wasm.FunctionType]*ssa.Signature + listenerSignatures map[*wasm.FunctionType][2]*ssa.Signature + memoryGrowSig ssa.Signature + checkModuleExitCodeSig ssa.Signature + tableGrowSig ssa.Signature + refFuncSig ssa.Signature + memmoveSig ssa.Signature + checkModuleExitCodeArg [1]ssa.Value + ensureTermination bool + + // Followings are reset by per function. + + // wasmLocalToVariable maps the index (considered as wasm.Index of locals) + // to the corresponding ssa.Variable. + wasmLocalToVariable map[wasm.Index]ssa.Variable + wasmLocalFunctionIndex wasm.Index + wasmFunctionTypeIndex wasm.Index + wasmFunctionTyp *wasm.FunctionType + wasmFunctionLocalTypes []wasm.ValueType + wasmFunctionBody []byte + wasmFunctionBodyOffsetInCodeSection uint64 + memoryBaseVariable, memoryLenVariable ssa.Variable + needMemory bool + globalVariables []ssa.Variable + globalVariablesTypes []ssa.Type + mutableGlobalVariablesIndexes []wasm.Index // index to ^. + needListener bool + needSourceOffsetInfo bool + // br is reused during lowering. + br *bytes.Reader + loweringState loweringState + + knownSafeBounds []knownSafeBound + knownSafeBoundsSet []ssa.ValueID + + execCtxPtrValue, moduleCtxPtrValue ssa.Value +} + +type knownSafeBound struct { + bound uint64 + absoluteAddr ssa.Value +} + +// NewFrontendCompiler returns a frontend Compiler. +func NewFrontendCompiler(m *wasm.Module, ssaBuilder ssa.Builder, offset *wazevoapi.ModuleContextOffsetData, ensureTermination bool, listenerOn bool, sourceInfo bool) *Compiler { + c := &Compiler{ + m: m, + ssaBuilder: ssaBuilder, + br: bytes.NewReader(nil), + wasmLocalToVariable: make(map[wasm.Index]ssa.Variable), + offset: offset, + ensureTermination: ensureTermination, + needSourceOffsetInfo: sourceInfo, + } + c.declareSignatures(listenerOn) + return c +} + +func (c *Compiler) declareSignatures(listenerOn bool) { + m := c.m + c.signatures = make(map[*wasm.FunctionType]*ssa.Signature, len(m.TypeSection)+2) + if listenerOn { + c.listenerSignatures = make(map[*wasm.FunctionType][2]*ssa.Signature, len(m.TypeSection)) + } + for i := range m.TypeSection { + wasmSig := &m.TypeSection[i] + sig := SignatureForWasmFunctionType(wasmSig) + sig.ID = ssa.SignatureID(i) + c.signatures[wasmSig] = &sig + c.ssaBuilder.DeclareSignature(&sig) + + if listenerOn { + beforeSig, afterSig := SignatureForListener(wasmSig) + beforeSig.ID = ssa.SignatureID(i) + ssa.SignatureID(len(m.TypeSection)) + afterSig.ID = ssa.SignatureID(i) + ssa.SignatureID(len(m.TypeSection))*2 + c.listenerSignatures[wasmSig] = [2]*ssa.Signature{beforeSig, afterSig} + c.ssaBuilder.DeclareSignature(beforeSig) + c.ssaBuilder.DeclareSignature(afterSig) + } + } + + begin := ssa.SignatureID(len(m.TypeSection)) + if listenerOn { + begin *= 3 + } + c.memoryGrowSig = ssa.Signature{ + ID: begin, + // Takes execution context and the page size to grow. + Params: []ssa.Type{ssa.TypeI64, ssa.TypeI32}, + // Returns the previous page size. + Results: []ssa.Type{ssa.TypeI32}, + } + c.ssaBuilder.DeclareSignature(&c.memoryGrowSig) + + c.checkModuleExitCodeSig = ssa.Signature{ + ID: c.memoryGrowSig.ID + 1, + // Only takes execution context. + Params: []ssa.Type{ssa.TypeI64}, + } + c.ssaBuilder.DeclareSignature(&c.checkModuleExitCodeSig) + + c.tableGrowSig = ssa.Signature{ + ID: c.checkModuleExitCodeSig.ID + 1, + Params: []ssa.Type{ssa.TypeI64 /* exec context */, ssa.TypeI32 /* table index */, ssa.TypeI32 /* num */, ssa.TypeI64 /* ref */}, + // Returns the previous size. + Results: []ssa.Type{ssa.TypeI32}, + } + c.ssaBuilder.DeclareSignature(&c.tableGrowSig) + + c.refFuncSig = ssa.Signature{ + ID: c.tableGrowSig.ID + 1, + Params: []ssa.Type{ssa.TypeI64 /* exec context */, ssa.TypeI32 /* func index */}, + // Returns the function reference. + Results: []ssa.Type{ssa.TypeI64}, + } + c.ssaBuilder.DeclareSignature(&c.refFuncSig) + + c.memmoveSig = ssa.Signature{ + ID: c.refFuncSig.ID + 1, + // dst, src, and the byte count. + Params: []ssa.Type{ssa.TypeI64, ssa.TypeI64, ssa.TypeI32}, + } + c.ssaBuilder.DeclareSignature(&c.memmoveSig) +} + +// SignatureForWasmFunctionType returns the ssa.Signature for the given wasm.FunctionType. +func SignatureForWasmFunctionType(typ *wasm.FunctionType) ssa.Signature { + sig := ssa.Signature{ + // +2 to pass moduleContextPtr and executionContextPtr. See the inline comment LowerToSSA. + Params: make([]ssa.Type, len(typ.Params)+2), + Results: make([]ssa.Type, len(typ.Results)), + } + sig.Params[0] = executionContextPtrTyp + sig.Params[1] = moduleContextPtrTyp + for j, typ := range typ.Params { + sig.Params[j+2] = WasmTypeToSSAType(typ) + } + for j, typ := range typ.Results { + sig.Results[j] = WasmTypeToSSAType(typ) + } + return sig +} + +// Init initializes the state of frontendCompiler and make it ready for a next function. +func (c *Compiler) Init(idx, typIndex wasm.Index, typ *wasm.FunctionType, localTypes []wasm.ValueType, body []byte, needListener bool, bodyOffsetInCodeSection uint64) { + c.ssaBuilder.Init(c.signatures[typ]) + c.loweringState.reset() + + c.wasmFunctionTypeIndex = typIndex + c.wasmLocalFunctionIndex = idx + c.wasmFunctionTyp = typ + c.wasmFunctionLocalTypes = localTypes + c.wasmFunctionBody = body + c.wasmFunctionBodyOffsetInCodeSection = bodyOffsetInCodeSection + c.needListener = needListener +} + +// Note: this assumes 64-bit platform (I believe we won't have 32-bit backend ;)). +const executionContextPtrTyp, moduleContextPtrTyp = ssa.TypeI64, ssa.TypeI64 + +// LowerToSSA lowers the current function to SSA function which will be held by ssaBuilder. +// After calling this, the caller will be able to access the SSA info in *Compiler.ssaBuilder. +// +// Note that this only does the naive lowering, and do not do any optimization, instead the caller is expected to do so. +func (c *Compiler) LowerToSSA() { + builder := c.ssaBuilder + + // Set up the entry block. + entryBlock := builder.AllocateBasicBlock() + builder.SetCurrentBlock(entryBlock) + + // Functions always take two parameters in addition to Wasm-level parameters: + // + // 1. executionContextPtr: pointer to the *executionContext in wazevo package. + // This will be used to exit the execution in the face of trap, plus used for host function calls. + // + // 2. moduleContextPtr: pointer to the *moduleContextOpaque in wazevo package. + // This will be used to access memory, etc. Also, this will be used during host function calls. + // + // Note: it's clear that sometimes a function won't need them. For example, + // if the function doesn't trap and doesn't make function call, then + // we might be able to eliminate the parameter. However, if that function + // can be called via call_indirect, then we cannot eliminate because the + // signature won't match with the expected one. + // TODO: maybe there's some way to do this optimization without glitches, but so far I have no clue about the feasibility. + // + // Note: In Wasmtime or many other runtimes, moduleContextPtr is called "vmContext". Also note that `moduleContextPtr` + // is wazero-specific since other runtimes can naturally use the OS-level signal to do this job thanks to the fact that + // they can use native stack vs wazero cannot use Go-routine stack and have to use Go-runtime allocated []byte as a stack. + c.execCtxPtrValue = entryBlock.AddParam(builder, executionContextPtrTyp) + c.moduleCtxPtrValue = entryBlock.AddParam(builder, moduleContextPtrTyp) + builder.AnnotateValue(c.execCtxPtrValue, "exec_ctx") + builder.AnnotateValue(c.moduleCtxPtrValue, "module_ctx") + + for i, typ := range c.wasmFunctionTyp.Params { + st := WasmTypeToSSAType(typ) + variable := builder.DeclareVariable(st) + value := entryBlock.AddParam(builder, st) + builder.DefineVariable(variable, value, entryBlock) + c.wasmLocalToVariable[wasm.Index(i)] = variable + } + c.declareWasmLocals(entryBlock) + c.declareNecessaryVariables() + + c.lowerBody(entryBlock) +} + +// localVariable returns the SSA variable for the given Wasm local index. +func (c *Compiler) localVariable(index wasm.Index) ssa.Variable { + return c.wasmLocalToVariable[index] +} + +// declareWasmLocals declares the SSA variables for the Wasm locals. +func (c *Compiler) declareWasmLocals(entry ssa.BasicBlock) { + localCount := wasm.Index(len(c.wasmFunctionTyp.Params)) + for i, typ := range c.wasmFunctionLocalTypes { + st := WasmTypeToSSAType(typ) + variable := c.ssaBuilder.DeclareVariable(st) + c.wasmLocalToVariable[wasm.Index(i)+localCount] = variable + + zeroInst := c.ssaBuilder.AllocateInstruction() + switch st { + case ssa.TypeI32: + zeroInst.AsIconst32(0) + case ssa.TypeI64: + zeroInst.AsIconst64(0) + case ssa.TypeF32: + zeroInst.AsF32const(0) + case ssa.TypeF64: + zeroInst.AsF64const(0) + case ssa.TypeV128: + zeroInst.AsVconst(0, 0) + default: + panic("TODO: " + wasm.ValueTypeName(typ)) + } + + c.ssaBuilder.InsertInstruction(zeroInst) + value := zeroInst.Return() + c.ssaBuilder.DefineVariable(variable, value, entry) + } +} + +func (c *Compiler) declareNecessaryVariables() { + c.needMemory = c.m.ImportMemoryCount > 0 || c.m.MemorySection != nil + if c.needMemory { + c.memoryBaseVariable = c.ssaBuilder.DeclareVariable(ssa.TypeI64) + c.memoryLenVariable = c.ssaBuilder.DeclareVariable(ssa.TypeI64) + } + + c.globalVariables = c.globalVariables[:0] + c.mutableGlobalVariablesIndexes = c.mutableGlobalVariablesIndexes[:0] + c.globalVariablesTypes = c.globalVariablesTypes[:0] + for _, imp := range c.m.ImportSection { + if imp.Type == wasm.ExternTypeGlobal { + desc := imp.DescGlobal + c.declareWasmGlobal(desc.ValType, desc.Mutable) + } + } + for _, g := range c.m.GlobalSection { + desc := g.Type + c.declareWasmGlobal(desc.ValType, desc.Mutable) + } + + // TODO: add tables. +} + +func (c *Compiler) declareWasmGlobal(typ wasm.ValueType, mutable bool) { + var st ssa.Type + switch typ { + case wasm.ValueTypeI32: + st = ssa.TypeI32 + case wasm.ValueTypeI64, + // Both externref and funcref are represented as I64 since we only support 64-bit platforms. + wasm.ValueTypeExternref, wasm.ValueTypeFuncref: + st = ssa.TypeI64 + case wasm.ValueTypeF32: + st = ssa.TypeF32 + case wasm.ValueTypeF64: + st = ssa.TypeF64 + case wasm.ValueTypeV128: + st = ssa.TypeV128 + default: + panic("TODO: " + wasm.ValueTypeName(typ)) + } + v := c.ssaBuilder.DeclareVariable(st) + index := wasm.Index(len(c.globalVariables)) + c.globalVariables = append(c.globalVariables, v) + c.globalVariablesTypes = append(c.globalVariablesTypes, st) + if mutable { + c.mutableGlobalVariablesIndexes = append(c.mutableGlobalVariablesIndexes, index) + } +} + +// WasmTypeToSSAType converts wasm.ValueType to ssa.Type. +func WasmTypeToSSAType(vt wasm.ValueType) ssa.Type { + switch vt { + case wasm.ValueTypeI32: + return ssa.TypeI32 + case wasm.ValueTypeI64, + // Both externref and funcref are represented as I64 since we only support 64-bit platforms. + wasm.ValueTypeExternref, wasm.ValueTypeFuncref: + return ssa.TypeI64 + case wasm.ValueTypeF32: + return ssa.TypeF32 + case wasm.ValueTypeF64: + return ssa.TypeF64 + case wasm.ValueTypeV128: + return ssa.TypeV128 + default: + panic("TODO: " + wasm.ValueTypeName(vt)) + } +} + +// addBlockParamsFromWasmTypes adds the block parameters to the given block. +func (c *Compiler) addBlockParamsFromWasmTypes(tps []wasm.ValueType, blk ssa.BasicBlock) { + for _, typ := range tps { + st := WasmTypeToSSAType(typ) + blk.AddParam(c.ssaBuilder, st) + } +} + +// formatBuilder outputs the constructed SSA function as a string with a source information. +func (c *Compiler) formatBuilder() string { + return c.ssaBuilder.Format() +} + +// SignatureForListener returns the signatures for the listener functions. +func SignatureForListener(wasmSig *wasm.FunctionType) (*ssa.Signature, *ssa.Signature) { + beforeSig := &ssa.Signature{} + beforeSig.Params = make([]ssa.Type, len(wasmSig.Params)+2) + beforeSig.Params[0] = ssa.TypeI64 // Execution context. + beforeSig.Params[1] = ssa.TypeI32 // Function index. + for i, p := range wasmSig.Params { + beforeSig.Params[i+2] = WasmTypeToSSAType(p) + } + afterSig := &ssa.Signature{} + afterSig.Params = make([]ssa.Type, len(wasmSig.Results)+2) + afterSig.Params[0] = ssa.TypeI64 // Execution context. + afterSig.Params[1] = ssa.TypeI32 // Function index. + for i, p := range wasmSig.Results { + afterSig.Params[i+2] = WasmTypeToSSAType(p) + } + return beforeSig, afterSig +} + +// isBoundSafe returns true if the given value is known to be safe to access up to the given bound. +func (c *Compiler) getKnownSafeBound(v ssa.ValueID) *knownSafeBound { + if int(v) >= len(c.knownSafeBounds) { + return nil + } + return &c.knownSafeBounds[v] +} + +// recordKnownSafeBound records the given safe bound for the given value. +func (c *Compiler) recordKnownSafeBound(v ssa.ValueID, safeBound uint64, absoluteAddr ssa.Value) { + if int(v) >= len(c.knownSafeBounds) { + c.knownSafeBounds = append(c.knownSafeBounds, make([]knownSafeBound, v+1)...) + } + + if exiting := c.knownSafeBounds[v]; exiting.bound == 0 { + c.knownSafeBounds[v] = knownSafeBound{ + bound: safeBound, + absoluteAddr: absoluteAddr, + } + c.knownSafeBoundsSet = append(c.knownSafeBoundsSet, v) + } else if safeBound > exiting.bound { + c.knownSafeBounds[v].bound = safeBound + } +} + +// clearSafeBounds clears the known safe bounds. This must be called +// after the compilation of each block. +func (c *Compiler) clearSafeBounds() { + for _, v := range c.knownSafeBoundsSet { + ptr := &c.knownSafeBounds[v] + ptr.bound = 0 + } + c.knownSafeBoundsSet = c.knownSafeBoundsSet[:0] +} + +func (k *knownSafeBound) valid() bool { + return k != nil && k.bound > 0 +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/frontend/lower.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/frontend/lower.go new file mode 100644 index 000000000..06d353e63 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/frontend/lower.go @@ -0,0 +1,3947 @@ +package frontend + +import ( + "encoding/binary" + "fmt" + "math" + "strings" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/engine/wazevo/ssa" + "github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi" + "github.com/tetratelabs/wazero/internal/leb128" + "github.com/tetratelabs/wazero/internal/wasm" +) + +type ( + // loweringState is used to keep the state of lowering. + loweringState struct { + // values holds the values on the Wasm stack. + values []ssa.Value + controlFrames []controlFrame + unreachable bool + unreachableDepth int + tmpForBrTable []uint32 + pc int + } + controlFrame struct { + kind controlFrameKind + // originalStackLen holds the number of values on the Wasm stack + // when start executing this control frame minus params for the block. + originalStackLenWithoutParam int + // blk is the loop header if this is loop, and is the else-block if this is an if frame. + blk, + // followingBlock is the basic block we enter if we reach "end" of block. + followingBlock ssa.BasicBlock + blockType *wasm.FunctionType + // clonedArgs hold the arguments to Else block. + clonedArgs []ssa.Value + } + + controlFrameKind byte +) + +// String implements fmt.Stringer for debugging. +func (l *loweringState) String() string { + var str []string + for _, v := range l.values { + str = append(str, fmt.Sprintf("v%v", v.ID())) + } + var frames []string + for i := range l.controlFrames { + frames = append(frames, l.controlFrames[i].kind.String()) + } + return fmt.Sprintf("\n\tunreachable=%v(depth=%d)\n\tstack: %s\n\tcontrol frames: %s", + l.unreachable, l.unreachableDepth, + strings.Join(str, ", "), + strings.Join(frames, ", "), + ) +} + +const ( + controlFrameKindFunction = iota + 1 + controlFrameKindLoop + controlFrameKindIfWithElse + controlFrameKindIfWithoutElse + controlFrameKindBlock +) + +// String implements fmt.Stringer for debugging. +func (k controlFrameKind) String() string { + switch k { + case controlFrameKindFunction: + return "function" + case controlFrameKindLoop: + return "loop" + case controlFrameKindIfWithElse: + return "if_with_else" + case controlFrameKindIfWithoutElse: + return "if_without_else" + case controlFrameKindBlock: + return "block" + default: + panic(k) + } +} + +// isLoop returns true if this is a loop frame. +func (ctrl *controlFrame) isLoop() bool { + return ctrl.kind == controlFrameKindLoop +} + +// reset resets the state of loweringState for reuse. +func (l *loweringState) reset() { + l.values = l.values[:0] + l.controlFrames = l.controlFrames[:0] + l.pc = 0 + l.unreachable = false + l.unreachableDepth = 0 +} + +func (l *loweringState) peek() (ret ssa.Value) { + tail := len(l.values) - 1 + return l.values[tail] +} + +func (l *loweringState) pop() (ret ssa.Value) { + tail := len(l.values) - 1 + ret = l.values[tail] + l.values = l.values[:tail] + return +} + +func (l *loweringState) push(ret ssa.Value) { + l.values = append(l.values, ret) +} + +func (l *loweringState) nPopInto(n int, dst []ssa.Value) { + if n == 0 { + return + } + tail := len(l.values) + begin := tail - n + view := l.values[begin:tail] + copy(dst, view) + l.values = l.values[:begin] +} + +func (l *loweringState) nPeekDup(n int) []ssa.Value { + if n == 0 { + return nil + } + tail := len(l.values) + view := l.values[tail-n : tail] + return cloneValuesList(view) +} + +func (l *loweringState) ctrlPop() (ret controlFrame) { + tail := len(l.controlFrames) - 1 + ret = l.controlFrames[tail] + l.controlFrames = l.controlFrames[:tail] + return +} + +func (l *loweringState) ctrlPush(ret controlFrame) { + l.controlFrames = append(l.controlFrames, ret) +} + +func (l *loweringState) ctrlPeekAt(n int) (ret *controlFrame) { + tail := len(l.controlFrames) - 1 + return &l.controlFrames[tail-n] +} + +// lowerBody lowers the body of the Wasm function to the SSA form. +func (c *Compiler) lowerBody(entryBlk ssa.BasicBlock) { + c.ssaBuilder.Seal(entryBlk) + + if c.needListener { + c.callListenerBefore() + } + + // Pushes the empty control frame which corresponds to the function return. + c.loweringState.ctrlPush(controlFrame{ + kind: controlFrameKindFunction, + blockType: c.wasmFunctionTyp, + followingBlock: c.ssaBuilder.ReturnBlock(), + }) + + for c.loweringState.pc < len(c.wasmFunctionBody) { + c.lowerCurrentOpcode() + } +} + +func (c *Compiler) state() *loweringState { + return &c.loweringState +} + +func (c *Compiler) lowerCurrentOpcode() { + op := c.wasmFunctionBody[c.loweringState.pc] + + if c.needSourceOffsetInfo { + c.ssaBuilder.SetCurrentSourceOffset( + ssa.SourceOffset(c.loweringState.pc) + ssa.SourceOffset(c.wasmFunctionBodyOffsetInCodeSection), + ) + } + + builder := c.ssaBuilder + state := c.state() + switch op { + case wasm.OpcodeI32Const: + c := c.readI32s() + if state.unreachable { + break + } + + iconst := builder.AllocateInstruction().AsIconst32(uint32(c)).Insert(builder) + value := iconst.Return() + state.push(value) + case wasm.OpcodeI64Const: + c := c.readI64s() + if state.unreachable { + break + } + iconst := builder.AllocateInstruction().AsIconst64(uint64(c)).Insert(builder) + value := iconst.Return() + state.push(value) + case wasm.OpcodeF32Const: + f32 := c.readF32() + if state.unreachable { + break + } + f32const := builder.AllocateInstruction(). + AsF32const(f32). + Insert(builder). + Return() + state.push(f32const) + case wasm.OpcodeF64Const: + f64 := c.readF64() + if state.unreachable { + break + } + f64const := builder.AllocateInstruction(). + AsF64const(f64). + Insert(builder). + Return() + state.push(f64const) + case wasm.OpcodeI32Add, wasm.OpcodeI64Add: + if state.unreachable { + break + } + y, x := state.pop(), state.pop() + iadd := builder.AllocateInstruction() + iadd.AsIadd(x, y) + builder.InsertInstruction(iadd) + value := iadd.Return() + state.push(value) + case wasm.OpcodeI32Sub, wasm.OpcodeI64Sub: + if state.unreachable { + break + } + y, x := state.pop(), state.pop() + isub := builder.AllocateInstruction() + isub.AsIsub(x, y) + builder.InsertInstruction(isub) + value := isub.Return() + state.push(value) + case wasm.OpcodeF32Add, wasm.OpcodeF64Add: + if state.unreachable { + break + } + y, x := state.pop(), state.pop() + iadd := builder.AllocateInstruction() + iadd.AsFadd(x, y) + builder.InsertInstruction(iadd) + value := iadd.Return() + state.push(value) + case wasm.OpcodeI32Mul, wasm.OpcodeI64Mul: + if state.unreachable { + break + } + y, x := state.pop(), state.pop() + imul := builder.AllocateInstruction() + imul.AsImul(x, y) + builder.InsertInstruction(imul) + value := imul.Return() + state.push(value) + case wasm.OpcodeF32Sub, wasm.OpcodeF64Sub: + if state.unreachable { + break + } + y, x := state.pop(), state.pop() + isub := builder.AllocateInstruction() + isub.AsFsub(x, y) + builder.InsertInstruction(isub) + value := isub.Return() + state.push(value) + case wasm.OpcodeF32Mul, wasm.OpcodeF64Mul: + if state.unreachable { + break + } + y, x := state.pop(), state.pop() + isub := builder.AllocateInstruction() + isub.AsFmul(x, y) + builder.InsertInstruction(isub) + value := isub.Return() + state.push(value) + case wasm.OpcodeF32Div, wasm.OpcodeF64Div: + if state.unreachable { + break + } + y, x := state.pop(), state.pop() + isub := builder.AllocateInstruction() + isub.AsFdiv(x, y) + builder.InsertInstruction(isub) + value := isub.Return() + state.push(value) + case wasm.OpcodeF32Max, wasm.OpcodeF64Max: + if state.unreachable { + break + } + y, x := state.pop(), state.pop() + isub := builder.AllocateInstruction() + isub.AsFmax(x, y) + builder.InsertInstruction(isub) + value := isub.Return() + state.push(value) + case wasm.OpcodeF32Min, wasm.OpcodeF64Min: + if state.unreachable { + break + } + y, x := state.pop(), state.pop() + isub := builder.AllocateInstruction() + isub.AsFmin(x, y) + builder.InsertInstruction(isub) + value := isub.Return() + state.push(value) + case wasm.OpcodeI64Extend8S: + if state.unreachable { + break + } + c.insertIntegerExtend(true, 8, 64) + case wasm.OpcodeI64Extend16S: + if state.unreachable { + break + } + c.insertIntegerExtend(true, 16, 64) + case wasm.OpcodeI64Extend32S, wasm.OpcodeI64ExtendI32S: + if state.unreachable { + break + } + c.insertIntegerExtend(true, 32, 64) + case wasm.OpcodeI64ExtendI32U: + if state.unreachable { + break + } + c.insertIntegerExtend(false, 32, 64) + case wasm.OpcodeI32Extend8S: + if state.unreachable { + break + } + c.insertIntegerExtend(true, 8, 32) + case wasm.OpcodeI32Extend16S: + if state.unreachable { + break + } + c.insertIntegerExtend(true, 16, 32) + case wasm.OpcodeI32Eqz, wasm.OpcodeI64Eqz: + if state.unreachable { + break + } + x := state.pop() + zero := builder.AllocateInstruction() + if op == wasm.OpcodeI32Eqz { + zero.AsIconst32(0) + } else { + zero.AsIconst64(0) + } + builder.InsertInstruction(zero) + icmp := builder.AllocateInstruction(). + AsIcmp(x, zero.Return(), ssa.IntegerCmpCondEqual). + Insert(builder). + Return() + state.push(icmp) + case wasm.OpcodeI32Eq, wasm.OpcodeI64Eq: + if state.unreachable { + break + } + c.insertIcmp(ssa.IntegerCmpCondEqual) + case wasm.OpcodeI32Ne, wasm.OpcodeI64Ne: + if state.unreachable { + break + } + c.insertIcmp(ssa.IntegerCmpCondNotEqual) + case wasm.OpcodeI32LtS, wasm.OpcodeI64LtS: + if state.unreachable { + break + } + c.insertIcmp(ssa.IntegerCmpCondSignedLessThan) + case wasm.OpcodeI32LtU, wasm.OpcodeI64LtU: + if state.unreachable { + break + } + c.insertIcmp(ssa.IntegerCmpCondUnsignedLessThan) + case wasm.OpcodeI32GtS, wasm.OpcodeI64GtS: + if state.unreachable { + break + } + c.insertIcmp(ssa.IntegerCmpCondSignedGreaterThan) + case wasm.OpcodeI32GtU, wasm.OpcodeI64GtU: + if state.unreachable { + break + } + c.insertIcmp(ssa.IntegerCmpCondUnsignedGreaterThan) + case wasm.OpcodeI32LeS, wasm.OpcodeI64LeS: + if state.unreachable { + break + } + c.insertIcmp(ssa.IntegerCmpCondSignedLessThanOrEqual) + case wasm.OpcodeI32LeU, wasm.OpcodeI64LeU: + if state.unreachable { + break + } + c.insertIcmp(ssa.IntegerCmpCondUnsignedLessThanOrEqual) + case wasm.OpcodeI32GeS, wasm.OpcodeI64GeS: + if state.unreachable { + break + } + c.insertIcmp(ssa.IntegerCmpCondSignedGreaterThanOrEqual) + case wasm.OpcodeI32GeU, wasm.OpcodeI64GeU: + if state.unreachable { + break + } + c.insertIcmp(ssa.IntegerCmpCondUnsignedGreaterThanOrEqual) + + case wasm.OpcodeF32Eq, wasm.OpcodeF64Eq: + if state.unreachable { + break + } + c.insertFcmp(ssa.FloatCmpCondEqual) + case wasm.OpcodeF32Ne, wasm.OpcodeF64Ne: + if state.unreachable { + break + } + c.insertFcmp(ssa.FloatCmpCondNotEqual) + case wasm.OpcodeF32Lt, wasm.OpcodeF64Lt: + if state.unreachable { + break + } + c.insertFcmp(ssa.FloatCmpCondLessThan) + case wasm.OpcodeF32Gt, wasm.OpcodeF64Gt: + if state.unreachable { + break + } + c.insertFcmp(ssa.FloatCmpCondGreaterThan) + case wasm.OpcodeF32Le, wasm.OpcodeF64Le: + if state.unreachable { + break + } + c.insertFcmp(ssa.FloatCmpCondLessThanOrEqual) + case wasm.OpcodeF32Ge, wasm.OpcodeF64Ge: + if state.unreachable { + break + } + c.insertFcmp(ssa.FloatCmpCondGreaterThanOrEqual) + case wasm.OpcodeF32Neg, wasm.OpcodeF64Neg: + if state.unreachable { + break + } + x := state.pop() + v := builder.AllocateInstruction().AsFneg(x).Insert(builder).Return() + state.push(v) + case wasm.OpcodeF32Sqrt, wasm.OpcodeF64Sqrt: + if state.unreachable { + break + } + x := state.pop() + v := builder.AllocateInstruction().AsSqrt(x).Insert(builder).Return() + state.push(v) + case wasm.OpcodeF32Abs, wasm.OpcodeF64Abs: + if state.unreachable { + break + } + x := state.pop() + v := builder.AllocateInstruction().AsFabs(x).Insert(builder).Return() + state.push(v) + case wasm.OpcodeF32Copysign, wasm.OpcodeF64Copysign: + if state.unreachable { + break + } + y, x := state.pop(), state.pop() + v := builder.AllocateInstruction().AsFcopysign(x, y).Insert(builder).Return() + state.push(v) + + case wasm.OpcodeF32Ceil, wasm.OpcodeF64Ceil: + if state.unreachable { + break + } + x := state.pop() + v := builder.AllocateInstruction().AsCeil(x).Insert(builder).Return() + state.push(v) + case wasm.OpcodeF32Floor, wasm.OpcodeF64Floor: + if state.unreachable { + break + } + x := state.pop() + v := builder.AllocateInstruction().AsFloor(x).Insert(builder).Return() + state.push(v) + case wasm.OpcodeF32Trunc, wasm.OpcodeF64Trunc: + if state.unreachable { + break + } + x := state.pop() + v := builder.AllocateInstruction().AsTrunc(x).Insert(builder).Return() + state.push(v) + case wasm.OpcodeF32Nearest, wasm.OpcodeF64Nearest: + if state.unreachable { + break + } + x := state.pop() + v := builder.AllocateInstruction().AsNearest(x).Insert(builder).Return() + state.push(v) + case wasm.OpcodeI64TruncF64S, wasm.OpcodeI64TruncF32S, + wasm.OpcodeI32TruncF64S, wasm.OpcodeI32TruncF32S, + wasm.OpcodeI64TruncF64U, wasm.OpcodeI64TruncF32U, + wasm.OpcodeI32TruncF64U, wasm.OpcodeI32TruncF32U: + if state.unreachable { + break + } + ret := builder.AllocateInstruction().AsFcvtToInt( + state.pop(), + c.execCtxPtrValue, + op == wasm.OpcodeI64TruncF64S || op == wasm.OpcodeI64TruncF32S || op == wasm.OpcodeI32TruncF32S || op == wasm.OpcodeI32TruncF64S, + op == wasm.OpcodeI64TruncF64S || op == wasm.OpcodeI64TruncF32S || op == wasm.OpcodeI64TruncF64U || op == wasm.OpcodeI64TruncF32U, + false, + ).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeMiscPrefix: + state.pc++ + // A misc opcode is encoded as an unsigned variable 32-bit integer. + miscOpUint, num, err := leb128.LoadUint32(c.wasmFunctionBody[state.pc:]) + if err != nil { + // In normal conditions this should never happen because the function has passed validation. + panic(fmt.Sprintf("failed to read misc opcode: %v", err)) + } + state.pc += int(num - 1) + miscOp := wasm.OpcodeMisc(miscOpUint) + switch miscOp { + case wasm.OpcodeMiscI64TruncSatF64S, wasm.OpcodeMiscI64TruncSatF32S, + wasm.OpcodeMiscI32TruncSatF64S, wasm.OpcodeMiscI32TruncSatF32S, + wasm.OpcodeMiscI64TruncSatF64U, wasm.OpcodeMiscI64TruncSatF32U, + wasm.OpcodeMiscI32TruncSatF64U, wasm.OpcodeMiscI32TruncSatF32U: + if state.unreachable { + break + } + ret := builder.AllocateInstruction().AsFcvtToInt( + state.pop(), + c.execCtxPtrValue, + miscOp == wasm.OpcodeMiscI64TruncSatF64S || miscOp == wasm.OpcodeMiscI64TruncSatF32S || miscOp == wasm.OpcodeMiscI32TruncSatF32S || miscOp == wasm.OpcodeMiscI32TruncSatF64S, + miscOp == wasm.OpcodeMiscI64TruncSatF64S || miscOp == wasm.OpcodeMiscI64TruncSatF32S || miscOp == wasm.OpcodeMiscI64TruncSatF64U || miscOp == wasm.OpcodeMiscI64TruncSatF32U, + true, + ).Insert(builder).Return() + state.push(ret) + + case wasm.OpcodeMiscTableSize: + tableIndex := c.readI32u() + if state.unreachable { + break + } + + // Load the table. + loadTableInstancePtr := builder.AllocateInstruction() + loadTableInstancePtr.AsLoad(c.moduleCtxPtrValue, c.offset.TableOffset(int(tableIndex)).U32(), ssa.TypeI64) + builder.InsertInstruction(loadTableInstancePtr) + tableInstancePtr := loadTableInstancePtr.Return() + + // Load the table's length. + loadTableLen := builder.AllocateInstruction(). + AsLoad(tableInstancePtr, tableInstanceLenOffset, ssa.TypeI32). + Insert(builder) + state.push(loadTableLen.Return()) + + case wasm.OpcodeMiscTableGrow: + tableIndex := c.readI32u() + if state.unreachable { + break + } + + c.storeCallerModuleContext() + + tableIndexVal := builder.AllocateInstruction().AsIconst32(tableIndex).Insert(builder).Return() + + num := state.pop() + r := state.pop() + + tableGrowPtr := builder.AllocateInstruction(). + AsLoad(c.execCtxPtrValue, + wazevoapi.ExecutionContextOffsetTableGrowTrampolineAddress.U32(), + ssa.TypeI64, + ).Insert(builder).Return() + + // TODO: reuse the slice. + args := []ssa.Value{c.execCtxPtrValue, tableIndexVal, num, r} + callGrowRet := builder. + AllocateInstruction(). + AsCallIndirect(tableGrowPtr, &c.tableGrowSig, args). + Insert(builder).Return() + state.push(callGrowRet) + + case wasm.OpcodeMiscTableCopy: + dstTableIndex := c.readI32u() + srcTableIndex := c.readI32u() + if state.unreachable { + break + } + + copySize := builder. + AllocateInstruction().AsUExtend(state.pop(), 32, 64).Insert(builder).Return() + srcOffset := builder. + AllocateInstruction().AsUExtend(state.pop(), 32, 64).Insert(builder).Return() + dstOffset := builder. + AllocateInstruction().AsUExtend(state.pop(), 32, 64).Insert(builder).Return() + + // Out of bounds check. + dstTableInstancePtr := c.boundsCheckInTable(dstTableIndex, dstOffset, copySize) + srcTableInstancePtr := c.boundsCheckInTable(srcTableIndex, srcOffset, copySize) + + dstTableBaseAddr := c.loadTableBaseAddr(dstTableInstancePtr) + srcTableBaseAddr := c.loadTableBaseAddr(srcTableInstancePtr) + + three := builder.AllocateInstruction().AsIconst64(3).Insert(builder).Return() + + dstOffsetInBytes := builder.AllocateInstruction().AsIshl(dstOffset, three).Insert(builder).Return() + dstAddr := builder.AllocateInstruction().AsIadd(dstTableBaseAddr, dstOffsetInBytes).Insert(builder).Return() + srcOffsetInBytes := builder.AllocateInstruction().AsIshl(srcOffset, three).Insert(builder).Return() + srcAddr := builder.AllocateInstruction().AsIadd(srcTableBaseAddr, srcOffsetInBytes).Insert(builder).Return() + + copySizeInBytes := builder.AllocateInstruction().AsIshl(copySize, three).Insert(builder).Return() + c.callMemmove(dstAddr, srcAddr, copySizeInBytes) + + case wasm.OpcodeMiscMemoryCopy: + state.pc += 2 // +2 to skip two memory indexes which are fixed to zero. + if state.unreachable { + break + } + + copySize := builder. + AllocateInstruction().AsUExtend(state.pop(), 32, 64).Insert(builder).Return() + srcOffset := builder. + AllocateInstruction().AsUExtend(state.pop(), 32, 64).Insert(builder).Return() + dstOffset := builder. + AllocateInstruction().AsUExtend(state.pop(), 32, 64).Insert(builder).Return() + + // Out of bounds check. + memLen := c.getMemoryLenValue(false) + c.boundsCheckInMemory(memLen, dstOffset, copySize) + c.boundsCheckInMemory(memLen, srcOffset, copySize) + + memBase := c.getMemoryBaseValue(false) + dstAddr := builder.AllocateInstruction().AsIadd(memBase, dstOffset).Insert(builder).Return() + srcAddr := builder.AllocateInstruction().AsIadd(memBase, srcOffset).Insert(builder).Return() + + c.callMemmove(dstAddr, srcAddr, copySize) + + case wasm.OpcodeMiscTableFill: + tableIndex := c.readI32u() + if state.unreachable { + break + } + fillSize := state.pop() + value := state.pop() + offset := state.pop() + + fillSizeExt := builder. + AllocateInstruction().AsUExtend(fillSize, 32, 64).Insert(builder).Return() + offsetExt := builder. + AllocateInstruction().AsUExtend(offset, 32, 64).Insert(builder).Return() + tableInstancePtr := c.boundsCheckInTable(tableIndex, offsetExt, fillSizeExt) + + three := builder.AllocateInstruction().AsIconst64(3).Insert(builder).Return() + offsetInBytes := builder.AllocateInstruction().AsIshl(offsetExt, three).Insert(builder).Return() + fillSizeInBytes := builder.AllocateInstruction().AsIshl(fillSizeExt, three).Insert(builder).Return() + + // Calculate the base address of the table. + tableBaseAddr := c.loadTableBaseAddr(tableInstancePtr) + addr := builder.AllocateInstruction().AsIadd(tableBaseAddr, offsetInBytes).Insert(builder).Return() + + // Prepare the loop and following block. + beforeLoop := builder.AllocateBasicBlock() + loopBlk := builder.AllocateBasicBlock() + loopVar := loopBlk.AddParam(builder, ssa.TypeI64) + followingBlk := builder.AllocateBasicBlock() + + // Uses the copy trick for faster filling buffer like memory.fill, but in this case we copy 8 bytes at a time. + // buf := memoryInst.Buffer[offset : offset+fillSize] + // buf[0:8] = value + // for i := 8; i < fillSize; i *= 2 { Begin with 8 bytes. + // copy(buf[i:], buf[:i]) + // } + + // Insert the jump to the beforeLoop block; If the fillSize is zero, then jump to the following block to skip entire logics. + zero := builder.AllocateInstruction().AsIconst64(0).Insert(builder).Return() + ifFillSizeZero := builder.AllocateInstruction().AsIcmp(fillSizeExt, zero, ssa.IntegerCmpCondEqual). + Insert(builder).Return() + builder.AllocateInstruction().AsBrnz(ifFillSizeZero, nil, followingBlk).Insert(builder) + c.insertJumpToBlock(nil, beforeLoop) + + // buf[0:8] = value + builder.SetCurrentBlock(beforeLoop) + builder.AllocateInstruction().AsStore(ssa.OpcodeStore, value, addr, 0).Insert(builder) + initValue := builder.AllocateInstruction().AsIconst64(8).Insert(builder).Return() + c.insertJumpToBlock([]ssa.Value{initValue}, loopBlk) // TODO: reuse the slice. + + builder.SetCurrentBlock(loopBlk) + dstAddr := builder.AllocateInstruction().AsIadd(addr, loopVar).Insert(builder).Return() + + // If loopVar*2 > fillSizeInBytes, then count must be fillSizeInBytes-loopVar. + var count ssa.Value + { + loopVarDoubled := builder.AllocateInstruction().AsIadd(loopVar, loopVar).Insert(builder).Return() + loopVarDoubledLargerThanFillSize := builder. + AllocateInstruction().AsIcmp(loopVarDoubled, fillSizeInBytes, ssa.IntegerCmpCondUnsignedGreaterThanOrEqual). + Insert(builder).Return() + diff := builder.AllocateInstruction().AsIsub(fillSizeInBytes, loopVar).Insert(builder).Return() + count = builder.AllocateInstruction().AsSelect(loopVarDoubledLargerThanFillSize, diff, loopVar).Insert(builder).Return() + } + + c.callMemmove(dstAddr, addr, count) + + shiftAmount := builder.AllocateInstruction().AsIconst64(1).Insert(builder).Return() + newLoopVar := builder.AllocateInstruction().AsIshl(loopVar, shiftAmount).Insert(builder).Return() + loopVarLessThanFillSize := builder.AllocateInstruction(). + AsIcmp(newLoopVar, fillSizeInBytes, ssa.IntegerCmpCondUnsignedLessThan).Insert(builder).Return() + + builder.AllocateInstruction(). + AsBrnz(loopVarLessThanFillSize, []ssa.Value{newLoopVar}, loopBlk). // TODO: reuse the slice. + Insert(builder) + + c.insertJumpToBlock(nil, followingBlk) + builder.SetCurrentBlock(followingBlk) + + builder.Seal(beforeLoop) + builder.Seal(loopBlk) + builder.Seal(followingBlk) + + case wasm.OpcodeMiscMemoryFill: + state.pc++ // Skip the memory index which is fixed to zero. + if state.unreachable { + break + } + + fillSize := builder. + AllocateInstruction().AsUExtend(state.pop(), 32, 64).Insert(builder).Return() + value := state.pop() + offset := builder. + AllocateInstruction().AsUExtend(state.pop(), 32, 64).Insert(builder).Return() + + // Out of bounds check. + c.boundsCheckInMemory(c.getMemoryLenValue(false), offset, fillSize) + + // Calculate the base address: + addr := builder.AllocateInstruction().AsIadd(c.getMemoryBaseValue(false), offset).Insert(builder).Return() + + // Uses the copy trick for faster filling buffer: https://gist.github.com/taylorza/df2f89d5f9ab3ffd06865062a4cf015d + // buf := memoryInst.Buffer[offset : offset+fillSize] + // buf[0] = value + // for i := 1; i < fillSize; i *= 2 { + // copy(buf[i:], buf[:i]) + // } + + // Prepare the loop and following block. + beforeLoop := builder.AllocateBasicBlock() + loopBlk := builder.AllocateBasicBlock() + loopVar := loopBlk.AddParam(builder, ssa.TypeI64) + followingBlk := builder.AllocateBasicBlock() + + // Insert the jump to the beforeLoop block; If the fillSize is zero, then jump to the following block to skip entire logics. + zero := builder.AllocateInstruction().AsIconst64(0).Insert(builder).Return() + ifFillSizeZero := builder.AllocateInstruction().AsIcmp(fillSize, zero, ssa.IntegerCmpCondEqual). + Insert(builder).Return() + builder.AllocateInstruction().AsBrnz(ifFillSizeZero, nil, followingBlk).Insert(builder) + c.insertJumpToBlock(nil, beforeLoop) + + // buf[0] = value + builder.SetCurrentBlock(beforeLoop) + builder.AllocateInstruction().AsStore(ssa.OpcodeIstore8, value, addr, 0).Insert(builder) + initValue := builder.AllocateInstruction().AsIconst64(1).Insert(builder).Return() + c.insertJumpToBlock([]ssa.Value{initValue}, loopBlk) // TODO: reuse the slice. + + builder.SetCurrentBlock(loopBlk) + dstAddr := builder.AllocateInstruction().AsIadd(addr, loopVar).Insert(builder).Return() + + // If loopVar*2 > fillSizeExt, then count must be fillSizeExt-loopVar. + var count ssa.Value + { + loopVarDoubled := builder.AllocateInstruction().AsIadd(loopVar, loopVar).Insert(builder).Return() + loopVarDoubledLargerThanFillSize := builder. + AllocateInstruction().AsIcmp(loopVarDoubled, fillSize, ssa.IntegerCmpCondUnsignedGreaterThanOrEqual). + Insert(builder).Return() + diff := builder.AllocateInstruction().AsIsub(fillSize, loopVar).Insert(builder).Return() + count = builder.AllocateInstruction().AsSelect(loopVarDoubledLargerThanFillSize, diff, loopVar).Insert(builder).Return() + } + + c.callMemmove(dstAddr, addr, count) + + shiftAmount := builder.AllocateInstruction().AsIconst64(1).Insert(builder).Return() + newLoopVar := builder.AllocateInstruction().AsIshl(loopVar, shiftAmount).Insert(builder).Return() + loopVarLessThanFillSize := builder.AllocateInstruction(). + AsIcmp(newLoopVar, fillSize, ssa.IntegerCmpCondUnsignedLessThan).Insert(builder).Return() + + builder.AllocateInstruction(). + AsBrnz(loopVarLessThanFillSize, []ssa.Value{newLoopVar}, loopBlk). // TODO: reuse the slice. + Insert(builder) + + c.insertJumpToBlock(nil, followingBlk) + builder.SetCurrentBlock(followingBlk) + + builder.Seal(beforeLoop) + builder.Seal(loopBlk) + builder.Seal(followingBlk) + + case wasm.OpcodeMiscMemoryInit: + index := c.readI32u() + state.pc++ // Skip the memory index which is fixed to zero. + if state.unreachable { + break + } + + copySize := builder. + AllocateInstruction().AsUExtend(state.pop(), 32, 64).Insert(builder).Return() + offsetInDataInstance := builder. + AllocateInstruction().AsUExtend(state.pop(), 32, 64).Insert(builder).Return() + offsetInMemory := builder. + AllocateInstruction().AsUExtend(state.pop(), 32, 64).Insert(builder).Return() + + dataInstPtr := c.dataOrElementInstanceAddr(index, c.offset.DataInstances1stElement) + + // Bounds check. + c.boundsCheckInMemory(c.getMemoryLenValue(false), offsetInMemory, copySize) + c.boundsCheckInDataOrElementInstance(dataInstPtr, offsetInDataInstance, copySize, wazevoapi.ExitCodeMemoryOutOfBounds) + + dataInstBaseAddr := builder.AllocateInstruction().AsLoad(dataInstPtr, 0, ssa.TypeI64).Insert(builder).Return() + srcAddr := builder.AllocateInstruction().AsIadd(dataInstBaseAddr, offsetInDataInstance).Insert(builder).Return() + + memBase := c.getMemoryBaseValue(false) + dstAddr := builder.AllocateInstruction().AsIadd(memBase, offsetInMemory).Insert(builder).Return() + + c.callMemmove(dstAddr, srcAddr, copySize) + + case wasm.OpcodeMiscTableInit: + elemIndex := c.readI32u() + tableIndex := c.readI32u() + if state.unreachable { + break + } + + copySize := builder. + AllocateInstruction().AsUExtend(state.pop(), 32, 64).Insert(builder).Return() + offsetInElementInstance := builder. + AllocateInstruction().AsUExtend(state.pop(), 32, 64).Insert(builder).Return() + offsetInTable := builder. + AllocateInstruction().AsUExtend(state.pop(), 32, 64).Insert(builder).Return() + + elemInstPtr := c.dataOrElementInstanceAddr(elemIndex, c.offset.ElementInstances1stElement) + + // Bounds check. + tableInstancePtr := c.boundsCheckInTable(tableIndex, offsetInTable, copySize) + c.boundsCheckInDataOrElementInstance(elemInstPtr, offsetInElementInstance, copySize, wazevoapi.ExitCodeTableOutOfBounds) + + three := builder.AllocateInstruction().AsIconst64(3).Insert(builder).Return() + // Calculates the destination address in the table. + tableOffsetInBytes := builder.AllocateInstruction().AsIshl(offsetInTable, three).Insert(builder).Return() + tableBaseAddr := c.loadTableBaseAddr(tableInstancePtr) + dstAddr := builder.AllocateInstruction().AsIadd(tableBaseAddr, tableOffsetInBytes).Insert(builder).Return() + + // Calculates the source address in the element instance. + srcOffsetInBytes := builder.AllocateInstruction().AsIshl(offsetInElementInstance, three).Insert(builder).Return() + elemInstBaseAddr := builder.AllocateInstruction().AsLoad(elemInstPtr, 0, ssa.TypeI64).Insert(builder).Return() + srcAddr := builder.AllocateInstruction().AsIadd(elemInstBaseAddr, srcOffsetInBytes).Insert(builder).Return() + + copySizeInBytes := builder.AllocateInstruction().AsIshl(copySize, three).Insert(builder).Return() + c.callMemmove(dstAddr, srcAddr, copySizeInBytes) + + case wasm.OpcodeMiscElemDrop: + index := c.readI32u() + if state.unreachable { + break + } + + c.dropDataOrElementInstance(index, c.offset.ElementInstances1stElement) + + case wasm.OpcodeMiscDataDrop: + index := c.readI32u() + if state.unreachable { + break + } + c.dropDataOrElementInstance(index, c.offset.DataInstances1stElement) + + default: + panic("Unknown MiscOp " + wasm.MiscInstructionName(miscOp)) + } + + case wasm.OpcodeI32ReinterpretF32: + if state.unreachable { + break + } + reinterpret := builder.AllocateInstruction(). + AsBitcast(state.pop(), ssa.TypeI32). + Insert(builder).Return() + state.push(reinterpret) + + case wasm.OpcodeI64ReinterpretF64: + if state.unreachable { + break + } + reinterpret := builder.AllocateInstruction(). + AsBitcast(state.pop(), ssa.TypeI64). + Insert(builder).Return() + state.push(reinterpret) + + case wasm.OpcodeF32ReinterpretI32: + if state.unreachable { + break + } + reinterpret := builder.AllocateInstruction(). + AsBitcast(state.pop(), ssa.TypeF32). + Insert(builder).Return() + state.push(reinterpret) + + case wasm.OpcodeF64ReinterpretI64: + if state.unreachable { + break + } + reinterpret := builder.AllocateInstruction(). + AsBitcast(state.pop(), ssa.TypeF64). + Insert(builder).Return() + state.push(reinterpret) + + case wasm.OpcodeI32DivS, wasm.OpcodeI64DivS: + if state.unreachable { + break + } + y, x := state.pop(), state.pop() + result := builder.AllocateInstruction().AsSDiv(x, y, c.execCtxPtrValue).Insert(builder).Return() + state.push(result) + + case wasm.OpcodeI32DivU, wasm.OpcodeI64DivU: + if state.unreachable { + break + } + y, x := state.pop(), state.pop() + result := builder.AllocateInstruction().AsUDiv(x, y, c.execCtxPtrValue).Insert(builder).Return() + state.push(result) + + case wasm.OpcodeI32RemS, wasm.OpcodeI64RemS: + if state.unreachable { + break + } + y, x := state.pop(), state.pop() + result := builder.AllocateInstruction().AsSRem(x, y, c.execCtxPtrValue).Insert(builder).Return() + state.push(result) + + case wasm.OpcodeI32RemU, wasm.OpcodeI64RemU: + if state.unreachable { + break + } + y, x := state.pop(), state.pop() + result := builder.AllocateInstruction().AsURem(x, y, c.execCtxPtrValue).Insert(builder).Return() + state.push(result) + + case wasm.OpcodeI32And, wasm.OpcodeI64And: + if state.unreachable { + break + } + y, x := state.pop(), state.pop() + and := builder.AllocateInstruction() + and.AsBand(x, y) + builder.InsertInstruction(and) + value := and.Return() + state.push(value) + case wasm.OpcodeI32Or, wasm.OpcodeI64Or: + if state.unreachable { + break + } + y, x := state.pop(), state.pop() + or := builder.AllocateInstruction() + or.AsBor(x, y) + builder.InsertInstruction(or) + value := or.Return() + state.push(value) + case wasm.OpcodeI32Xor, wasm.OpcodeI64Xor: + if state.unreachable { + break + } + y, x := state.pop(), state.pop() + xor := builder.AllocateInstruction() + xor.AsBxor(x, y) + builder.InsertInstruction(xor) + value := xor.Return() + state.push(value) + case wasm.OpcodeI32Shl, wasm.OpcodeI64Shl: + if state.unreachable { + break + } + y, x := state.pop(), state.pop() + ishl := builder.AllocateInstruction() + ishl.AsIshl(x, y) + builder.InsertInstruction(ishl) + value := ishl.Return() + state.push(value) + case wasm.OpcodeI32ShrU, wasm.OpcodeI64ShrU: + if state.unreachable { + break + } + y, x := state.pop(), state.pop() + ishl := builder.AllocateInstruction() + ishl.AsUshr(x, y) + builder.InsertInstruction(ishl) + value := ishl.Return() + state.push(value) + case wasm.OpcodeI32ShrS, wasm.OpcodeI64ShrS: + if state.unreachable { + break + } + y, x := state.pop(), state.pop() + ishl := builder.AllocateInstruction() + ishl.AsSshr(x, y) + builder.InsertInstruction(ishl) + value := ishl.Return() + state.push(value) + case wasm.OpcodeI32Rotl, wasm.OpcodeI64Rotl: + if state.unreachable { + break + } + y, x := state.pop(), state.pop() + rotl := builder.AllocateInstruction() + rotl.AsRotl(x, y) + builder.InsertInstruction(rotl) + value := rotl.Return() + state.push(value) + case wasm.OpcodeI32Rotr, wasm.OpcodeI64Rotr: + if state.unreachable { + break + } + y, x := state.pop(), state.pop() + rotr := builder.AllocateInstruction() + rotr.AsRotr(x, y) + builder.InsertInstruction(rotr) + value := rotr.Return() + state.push(value) + case wasm.OpcodeI32Clz, wasm.OpcodeI64Clz: + if state.unreachable { + break + } + x := state.pop() + clz := builder.AllocateInstruction() + clz.AsClz(x) + builder.InsertInstruction(clz) + value := clz.Return() + state.push(value) + case wasm.OpcodeI32Ctz, wasm.OpcodeI64Ctz: + if state.unreachable { + break + } + x := state.pop() + ctz := builder.AllocateInstruction() + ctz.AsCtz(x) + builder.InsertInstruction(ctz) + value := ctz.Return() + state.push(value) + case wasm.OpcodeI32Popcnt, wasm.OpcodeI64Popcnt: + if state.unreachable { + break + } + x := state.pop() + popcnt := builder.AllocateInstruction() + popcnt.AsPopcnt(x) + builder.InsertInstruction(popcnt) + value := popcnt.Return() + state.push(value) + + case wasm.OpcodeI32WrapI64: + if state.unreachable { + break + } + x := state.pop() + wrap := builder.AllocateInstruction().AsIreduce(x, ssa.TypeI32).Insert(builder).Return() + state.push(wrap) + case wasm.OpcodeGlobalGet: + index := c.readI32u() + if state.unreachable { + break + } + v := c.getWasmGlobalValue(index, false) + state.push(v) + case wasm.OpcodeGlobalSet: + index := c.readI32u() + if state.unreachable { + break + } + v := state.pop() + c.setWasmGlobalValue(index, v) + case wasm.OpcodeLocalGet: + index := c.readI32u() + if state.unreachable { + break + } + variable := c.localVariable(index) + v := builder.MustFindValue(variable) + state.push(v) + case wasm.OpcodeLocalSet: + index := c.readI32u() + if state.unreachable { + break + } + variable := c.localVariable(index) + newValue := state.pop() + builder.DefineVariableInCurrentBB(variable, newValue) + + case wasm.OpcodeLocalTee: + index := c.readI32u() + if state.unreachable { + break + } + variable := c.localVariable(index) + newValue := state.peek() + builder.DefineVariableInCurrentBB(variable, newValue) + + case wasm.OpcodeSelect, wasm.OpcodeTypedSelect: + if op == wasm.OpcodeTypedSelect { + state.pc += 2 // ignores the type which is only needed during validation. + } + + if state.unreachable { + break + } + + cond := state.pop() + v2 := state.pop() + v1 := state.pop() + + sl := builder.AllocateInstruction(). + AsSelect(cond, v1, v2). + Insert(builder). + Return() + state.push(sl) + + case wasm.OpcodeMemorySize: + state.pc++ // skips the memory index. + if state.unreachable { + break + } + + var memSizeInBytes ssa.Value + if c.offset.LocalMemoryBegin < 0 { + memInstPtr := builder.AllocateInstruction(). + AsLoad(c.moduleCtxPtrValue, c.offset.ImportedMemoryBegin.U32(), ssa.TypeI64). + Insert(builder). + Return() + + memSizeInBytes = builder.AllocateInstruction(). + AsLoad(memInstPtr, memoryInstanceBufSizeOffset, ssa.TypeI32). + Insert(builder). + Return() + } else { + memSizeInBytes = builder.AllocateInstruction(). + AsLoad(c.moduleCtxPtrValue, c.offset.LocalMemoryLen().U32(), ssa.TypeI32). + Insert(builder). + Return() + } + + amount := builder.AllocateInstruction() + amount.AsIconst32(uint32(wasm.MemoryPageSizeInBits)) + builder.InsertInstruction(amount) + memSize := builder.AllocateInstruction(). + AsUshr(memSizeInBytes, amount.Return()). + Insert(builder). + Return() + state.push(memSize) + + case wasm.OpcodeMemoryGrow: + state.pc++ // skips the memory index. + if state.unreachable { + break + } + + c.storeCallerModuleContext() + + pages := state.pop() + memoryGrowPtr := builder.AllocateInstruction(). + AsLoad(c.execCtxPtrValue, + wazevoapi.ExecutionContextOffsetMemoryGrowTrampolineAddress.U32(), + ssa.TypeI64, + ).Insert(builder).Return() + + // TODO: reuse the slice. + args := []ssa.Value{c.execCtxPtrValue, pages} + + callGrowRet := builder. + AllocateInstruction(). + AsCallIndirect(memoryGrowPtr, &c.memoryGrowSig, args). + Insert(builder).Return() + state.push(callGrowRet) + + // After the memory grow, reload the cached memory base and len. + c.reloadMemoryBaseLen() + + case wasm.OpcodeI32Store, + wasm.OpcodeI64Store, + wasm.OpcodeF32Store, + wasm.OpcodeF64Store, + wasm.OpcodeI32Store8, + wasm.OpcodeI32Store16, + wasm.OpcodeI64Store8, + wasm.OpcodeI64Store16, + wasm.OpcodeI64Store32: + + _, offset := c.readMemArg() + if state.unreachable { + break + } + var opSize uint64 + var opcode ssa.Opcode + switch op { + case wasm.OpcodeI32Store, wasm.OpcodeF32Store: + opcode = ssa.OpcodeStore + opSize = 4 + case wasm.OpcodeI64Store, wasm.OpcodeF64Store: + opcode = ssa.OpcodeStore + opSize = 8 + case wasm.OpcodeI32Store8, wasm.OpcodeI64Store8: + opcode = ssa.OpcodeIstore8 + opSize = 1 + case wasm.OpcodeI32Store16, wasm.OpcodeI64Store16: + opcode = ssa.OpcodeIstore16 + opSize = 2 + case wasm.OpcodeI64Store32: + opcode = ssa.OpcodeIstore32 + opSize = 4 + default: + panic("BUG") + } + + value := state.pop() + baseAddr := state.pop() + addr := c.memOpSetup(baseAddr, uint64(offset), opSize) + builder.AllocateInstruction(). + AsStore(opcode, value, addr, offset). + Insert(builder) + + case wasm.OpcodeI32Load, + wasm.OpcodeI64Load, + wasm.OpcodeF32Load, + wasm.OpcodeF64Load, + wasm.OpcodeI32Load8S, + wasm.OpcodeI32Load8U, + wasm.OpcodeI32Load16S, + wasm.OpcodeI32Load16U, + wasm.OpcodeI64Load8S, + wasm.OpcodeI64Load8U, + wasm.OpcodeI64Load16S, + wasm.OpcodeI64Load16U, + wasm.OpcodeI64Load32S, + wasm.OpcodeI64Load32U: + _, offset := c.readMemArg() + if state.unreachable { + break + } + + var opSize uint64 + switch op { + case wasm.OpcodeI32Load, wasm.OpcodeF32Load: + opSize = 4 + case wasm.OpcodeI64Load, wasm.OpcodeF64Load: + opSize = 8 + case wasm.OpcodeI32Load8S, wasm.OpcodeI32Load8U: + opSize = 1 + case wasm.OpcodeI32Load16S, wasm.OpcodeI32Load16U: + opSize = 2 + case wasm.OpcodeI64Load8S, wasm.OpcodeI64Load8U: + opSize = 1 + case wasm.OpcodeI64Load16S, wasm.OpcodeI64Load16U: + opSize = 2 + case wasm.OpcodeI64Load32S, wasm.OpcodeI64Load32U: + opSize = 4 + default: + panic("BUG") + } + + baseAddr := state.pop() + addr := c.memOpSetup(baseAddr, uint64(offset), opSize) + load := builder.AllocateInstruction() + switch op { + case wasm.OpcodeI32Load: + load.AsLoad(addr, offset, ssa.TypeI32) + case wasm.OpcodeI64Load: + load.AsLoad(addr, offset, ssa.TypeI64) + case wasm.OpcodeF32Load: + load.AsLoad(addr, offset, ssa.TypeF32) + case wasm.OpcodeF64Load: + load.AsLoad(addr, offset, ssa.TypeF64) + case wasm.OpcodeI32Load8S: + load.AsExtLoad(ssa.OpcodeSload8, addr, offset, false) + case wasm.OpcodeI32Load8U: + load.AsExtLoad(ssa.OpcodeUload8, addr, offset, false) + case wasm.OpcodeI32Load16S: + load.AsExtLoad(ssa.OpcodeSload16, addr, offset, false) + case wasm.OpcodeI32Load16U: + load.AsExtLoad(ssa.OpcodeUload16, addr, offset, false) + case wasm.OpcodeI64Load8S: + load.AsExtLoad(ssa.OpcodeSload8, addr, offset, true) + case wasm.OpcodeI64Load8U: + load.AsExtLoad(ssa.OpcodeUload8, addr, offset, true) + case wasm.OpcodeI64Load16S: + load.AsExtLoad(ssa.OpcodeSload16, addr, offset, true) + case wasm.OpcodeI64Load16U: + load.AsExtLoad(ssa.OpcodeUload16, addr, offset, true) + case wasm.OpcodeI64Load32S: + load.AsExtLoad(ssa.OpcodeSload32, addr, offset, true) + case wasm.OpcodeI64Load32U: + load.AsExtLoad(ssa.OpcodeUload32, addr, offset, true) + default: + panic("BUG") + } + builder.InsertInstruction(load) + state.push(load.Return()) + case wasm.OpcodeBlock: + // Note: we do not need to create a BB for this as that would always have only one predecessor + // which is the current BB, and therefore it's always ok to merge them in any way. + + bt := c.readBlockType() + + if state.unreachable { + state.unreachableDepth++ + break + } + + followingBlk := builder.AllocateBasicBlock() + c.addBlockParamsFromWasmTypes(bt.Results, followingBlk) + + state.ctrlPush(controlFrame{ + kind: controlFrameKindBlock, + originalStackLenWithoutParam: len(state.values) - len(bt.Params), + followingBlock: followingBlk, + blockType: bt, + }) + case wasm.OpcodeLoop: + bt := c.readBlockType() + + if state.unreachable { + state.unreachableDepth++ + break + } + + loopHeader, afterLoopBlock := builder.AllocateBasicBlock(), builder.AllocateBasicBlock() + c.addBlockParamsFromWasmTypes(bt.Params, loopHeader) + c.addBlockParamsFromWasmTypes(bt.Results, afterLoopBlock) + + originalLen := len(state.values) - len(bt.Params) + state.ctrlPush(controlFrame{ + originalStackLenWithoutParam: originalLen, + kind: controlFrameKindLoop, + blk: loopHeader, + followingBlock: afterLoopBlock, + blockType: bt, + }) + + var args []ssa.Value + if len(bt.Params) > 0 { + args = cloneValuesList(state.values[originalLen:]) + } + + // Insert the jump to the header of loop. + br := builder.AllocateInstruction() + br.AsJump(args, loopHeader) + builder.InsertInstruction(br) + + c.switchTo(originalLen, loopHeader) + + if c.ensureTermination { + checkModuleExitCodePtr := builder.AllocateInstruction(). + AsLoad(c.execCtxPtrValue, + wazevoapi.ExecutionContextOffsetCheckModuleExitCodeTrampolineAddress.U32(), + ssa.TypeI64, + ).Insert(builder).Return() + + c.checkModuleExitCodeArg[0] = c.execCtxPtrValue + + builder.AllocateInstruction(). + AsCallIndirect(checkModuleExitCodePtr, &c.checkModuleExitCodeSig, c.checkModuleExitCodeArg[:]). + Insert(builder) + } + case wasm.OpcodeIf: + bt := c.readBlockType() + + if state.unreachable { + state.unreachableDepth++ + break + } + + v := state.pop() + thenBlk, elseBlk, followingBlk := builder.AllocateBasicBlock(), builder.AllocateBasicBlock(), builder.AllocateBasicBlock() + + // We do not make the Wasm-level block parameters as SSA-level block params for if-else blocks + // since they won't be PHI and the definition is unique. + + // On the other hand, the following block after if-else-end will likely have + // multiple definitions (one in Then and another in Else blocks). + c.addBlockParamsFromWasmTypes(bt.Results, followingBlk) + + var args []ssa.Value + if len(bt.Params) > 0 { + args = cloneValuesList(state.values[len(state.values)-len(bt.Params):]) + } + + // Insert the conditional jump to the Else block. + brz := builder.AllocateInstruction() + brz.AsBrz(v, nil, elseBlk) + builder.InsertInstruction(brz) + + // Then, insert the jump to the Then block. + br := builder.AllocateInstruction() + br.AsJump(nil, thenBlk) + builder.InsertInstruction(br) + + state.ctrlPush(controlFrame{ + kind: controlFrameKindIfWithoutElse, + originalStackLenWithoutParam: len(state.values) - len(bt.Params), + blk: elseBlk, + followingBlock: followingBlk, + blockType: bt, + clonedArgs: args, + }) + + builder.SetCurrentBlock(thenBlk) + + // Then and Else (if exists) have only one predecessor. + builder.Seal(thenBlk) + builder.Seal(elseBlk) + case wasm.OpcodeElse: + c.clearSafeBounds() // Reset the safe bounds since we are entering the Else block. + + ifctrl := state.ctrlPeekAt(0) + if unreachable := state.unreachable; unreachable && state.unreachableDepth > 0 { + // If it is currently in unreachable and is a nested if, + // we just remove the entire else block. + break + } + + ifctrl.kind = controlFrameKindIfWithElse + if !state.unreachable { + // If this Then block is currently reachable, we have to insert the branching to the following BB. + followingBlk := ifctrl.followingBlock // == the BB after if-then-else. + args := c.loweringState.nPeekDup(len(ifctrl.blockType.Results)) + c.insertJumpToBlock(args, followingBlk) + } else { + state.unreachable = false + } + + // Reset the stack so that we can correctly handle the else block. + state.values = state.values[:ifctrl.originalStackLenWithoutParam] + elseBlk := ifctrl.blk + for _, arg := range ifctrl.clonedArgs { + state.push(arg) + } + + builder.SetCurrentBlock(elseBlk) + + case wasm.OpcodeEnd: + c.clearSafeBounds() // Reset the safe bounds since we are exiting the block. + + if state.unreachableDepth > 0 { + state.unreachableDepth-- + break + } + + ctrl := state.ctrlPop() + followingBlk := ctrl.followingBlock + + unreachable := state.unreachable + if !unreachable { + // Top n-th args will be used as a result of the current control frame. + args := c.loweringState.nPeekDup(len(ctrl.blockType.Results)) + + // Insert the unconditional branch to the target. + c.insertJumpToBlock(args, followingBlk) + } else { // recover from the unreachable state. + state.unreachable = false + } + + switch ctrl.kind { + case controlFrameKindFunction: + break // This is the very end of function. + case controlFrameKindLoop: + // Loop header block can be reached from any br/br_table contained in the loop, + // so now that we've reached End of it, we can seal it. + builder.Seal(ctrl.blk) + case controlFrameKindIfWithoutElse: + // If this is the end of Then block, we have to emit the empty Else block. + elseBlk := ctrl.blk + builder.SetCurrentBlock(elseBlk) + c.insertJumpToBlock(ctrl.clonedArgs, followingBlk) + } + + builder.Seal(ctrl.followingBlock) + + // Ready to start translating the following block. + c.switchTo(ctrl.originalStackLenWithoutParam, followingBlk) + + case wasm.OpcodeBr: + labelIndex := c.readI32u() + if state.unreachable { + break + } + + targetBlk, argNum := state.brTargetArgNumFor(labelIndex) + args := c.loweringState.nPeekDup(argNum) + c.insertJumpToBlock(args, targetBlk) + + state.unreachable = true + + case wasm.OpcodeBrIf: + labelIndex := c.readI32u() + if state.unreachable { + break + } + + v := state.pop() + + targetBlk, argNum := state.brTargetArgNumFor(labelIndex) + args := c.loweringState.nPeekDup(argNum) + + // Insert the conditional jump to the target block. + brnz := builder.AllocateInstruction() + brnz.AsBrnz(v, args, targetBlk) + builder.InsertInstruction(brnz) + + // Insert the unconditional jump to the Else block which corresponds to after br_if. + elseBlk := builder.AllocateBasicBlock() + c.insertJumpToBlock(nil, elseBlk) + + // Now start translating the instructions after br_if. + builder.Seal(elseBlk) // Else of br_if has the current block as the only one successor. + builder.SetCurrentBlock(elseBlk) + + case wasm.OpcodeBrTable: + labels := state.tmpForBrTable + labels = labels[:0] + labelCount := c.readI32u() + for i := 0; i < int(labelCount); i++ { + labels = append(labels, c.readI32u()) + } + labels = append(labels, c.readI32u()) // default label. + if state.unreachable { + break + } + + index := state.pop() + if labelCount == 0 { // If this br_table is empty, we can just emit the unconditional jump. + targetBlk, argNum := state.brTargetArgNumFor(labels[0]) + args := c.loweringState.nPeekDup(argNum) + c.insertJumpToBlock(args, targetBlk) + } else { + c.lowerBrTable(labels, index) + } + state.unreachable = true + + case wasm.OpcodeNop: + case wasm.OpcodeReturn: + if state.unreachable { + break + } + if c.needListener { + c.callListenerAfter() + } + + results := c.loweringState.nPeekDup(c.results()) + instr := builder.AllocateInstruction() + + instr.AsReturn(results) + builder.InsertInstruction(instr) + state.unreachable = true + + case wasm.OpcodeUnreachable: + if state.unreachable { + break + } + exit := builder.AllocateInstruction() + exit.AsExitWithCode(c.execCtxPtrValue, wazevoapi.ExitCodeUnreachable) + builder.InsertInstruction(exit) + state.unreachable = true + + case wasm.OpcodeCallIndirect: + typeIndex := c.readI32u() + tableIndex := c.readI32u() + if state.unreachable { + break + } + c.lowerCallIndirect(typeIndex, tableIndex) + + case wasm.OpcodeCall: + fnIndex := c.readI32u() + if state.unreachable { + break + } + + // Before transfer the control to the callee, we have to store the current module's moduleContextPtr + // into execContext.callerModuleContextPtr in case when the callee is a Go function. + // + // TODO: maybe this can be optimized out if this is in-module function calls. Investigate later. + c.storeCallerModuleContext() + + var typIndex wasm.Index + if fnIndex < c.m.ImportFunctionCount { + var fi int + for i := range c.m.ImportSection { + imp := &c.m.ImportSection[i] + if imp.Type == wasm.ExternTypeFunc { + if fi == int(fnIndex) { + typIndex = imp.DescFunc + break + } + fi++ + } + } + } else { + typIndex = c.m.FunctionSection[fnIndex-c.m.ImportFunctionCount] + } + typ := &c.m.TypeSection[typIndex] + + // TODO: reuse slice? + argN := len(typ.Params) + args := make([]ssa.Value, argN+2) + args[0] = c.execCtxPtrValue + state.nPopInto(argN, args[2:]) + + sig := c.signatures[typ] + call := builder.AllocateInstruction() + if fnIndex >= c.m.ImportFunctionCount { + args[1] = c.moduleCtxPtrValue // This case the callee module is itself. + call.AsCall(FunctionIndexToFuncRef(fnIndex), sig, args) + builder.InsertInstruction(call) + } else { + // This case we have to read the address of the imported function from the module context. + moduleCtx := c.moduleCtxPtrValue + loadFuncPtr, loadModuleCtxPtr := builder.AllocateInstruction(), builder.AllocateInstruction() + funcPtrOffset, moduleCtxPtrOffset, _ := c.offset.ImportedFunctionOffset(fnIndex) + loadFuncPtr.AsLoad(moduleCtx, funcPtrOffset.U32(), ssa.TypeI64) + loadModuleCtxPtr.AsLoad(moduleCtx, moduleCtxPtrOffset.U32(), ssa.TypeI64) + builder.InsertInstruction(loadFuncPtr) + builder.InsertInstruction(loadModuleCtxPtr) + + args[1] = loadModuleCtxPtr.Return() // This case the callee module is itself. + + call.AsCallIndirect(loadFuncPtr.Return(), sig, args) + builder.InsertInstruction(call) + } + + first, rest := call.Returns() + if first.Valid() { + state.push(first) + } + for _, v := range rest { + state.push(v) + } + + c.reloadAfterCall() + + case wasm.OpcodeDrop: + if state.unreachable { + break + } + _ = state.pop() + case wasm.OpcodeF64ConvertI32S, wasm.OpcodeF64ConvertI64S, wasm.OpcodeF64ConvertI32U, wasm.OpcodeF64ConvertI64U: + if state.unreachable { + break + } + result := builder.AllocateInstruction().AsFcvtFromInt( + state.pop(), + op == wasm.OpcodeF64ConvertI32S || op == wasm.OpcodeF64ConvertI64S, + true, + ).Insert(builder).Return() + state.push(result) + case wasm.OpcodeF32ConvertI32S, wasm.OpcodeF32ConvertI64S, wasm.OpcodeF32ConvertI32U, wasm.OpcodeF32ConvertI64U: + if state.unreachable { + break + } + result := builder.AllocateInstruction().AsFcvtFromInt( + state.pop(), + op == wasm.OpcodeF32ConvertI32S || op == wasm.OpcodeF32ConvertI64S, + false, + ).Insert(builder).Return() + state.push(result) + case wasm.OpcodeF32DemoteF64: + if state.unreachable { + break + } + cvt := builder.AllocateInstruction() + cvt.AsFdemote(state.pop()) + builder.InsertInstruction(cvt) + state.push(cvt.Return()) + case wasm.OpcodeF64PromoteF32: + if state.unreachable { + break + } + cvt := builder.AllocateInstruction() + cvt.AsFpromote(state.pop()) + builder.InsertInstruction(cvt) + state.push(cvt.Return()) + + case wasm.OpcodeVecPrefix: + state.pc++ + vecOp := c.wasmFunctionBody[state.pc] + switch vecOp { + case wasm.OpcodeVecV128Const: + state.pc++ + lo := binary.LittleEndian.Uint64(c.wasmFunctionBody[state.pc:]) + state.pc += 8 + hi := binary.LittleEndian.Uint64(c.wasmFunctionBody[state.pc:]) + state.pc += 7 + if state.unreachable { + break + } + ret := builder.AllocateInstruction().AsVconst(lo, hi).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecV128Load: + _, offset := c.readMemArg() + if state.unreachable { + break + } + baseAddr := state.pop() + addr := c.memOpSetup(baseAddr, uint64(offset), 16) + load := builder.AllocateInstruction() + load.AsLoad(addr, offset, ssa.TypeV128) + builder.InsertInstruction(load) + state.push(load.Return()) + case wasm.OpcodeVecV128Load8Lane, wasm.OpcodeVecV128Load16Lane, wasm.OpcodeVecV128Load32Lane: + _, offset := c.readMemArg() + state.pc++ + if state.unreachable { + break + } + var lane ssa.VecLane + var loadOp ssa.Opcode + var opSize uint64 + switch vecOp { + case wasm.OpcodeVecV128Load8Lane: + loadOp, lane, opSize = ssa.OpcodeUload8, ssa.VecLaneI8x16, 1 + case wasm.OpcodeVecV128Load16Lane: + loadOp, lane, opSize = ssa.OpcodeUload16, ssa.VecLaneI16x8, 2 + case wasm.OpcodeVecV128Load32Lane: + loadOp, lane, opSize = ssa.OpcodeUload32, ssa.VecLaneI32x4, 4 + } + laneIndex := c.wasmFunctionBody[state.pc] + vector := state.pop() + baseAddr := state.pop() + addr := c.memOpSetup(baseAddr, uint64(offset), opSize) + load := builder.AllocateInstruction(). + AsExtLoad(loadOp, addr, offset, false). + Insert(builder).Return() + ret := builder.AllocateInstruction(). + AsInsertlane(vector, load, laneIndex, lane). + Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecV128Load64Lane: + _, offset := c.readMemArg() + state.pc++ + if state.unreachable { + break + } + laneIndex := c.wasmFunctionBody[state.pc] + vector := state.pop() + baseAddr := state.pop() + addr := c.memOpSetup(baseAddr, uint64(offset), 8) + load := builder.AllocateInstruction(). + AsLoad(addr, offset, ssa.TypeI64). + Insert(builder).Return() + ret := builder.AllocateInstruction(). + AsInsertlane(vector, load, laneIndex, ssa.VecLaneI64x2). + Insert(builder).Return() + state.push(ret) + + case wasm.OpcodeVecV128Load32zero, wasm.OpcodeVecV128Load64zero: + _, offset := c.readMemArg() + if state.unreachable { + break + } + + var scalarType ssa.Type + switch vecOp { + case wasm.OpcodeVecV128Load32zero: + scalarType = ssa.TypeF32 + case wasm.OpcodeVecV128Load64zero: + scalarType = ssa.TypeF64 + } + + baseAddr := state.pop() + addr := c.memOpSetup(baseAddr, uint64(offset), uint64(scalarType.Size())) + + ret := builder.AllocateInstruction(). + AsVZeroExtLoad(addr, offset, scalarType). + Insert(builder).Return() + state.push(ret) + + case wasm.OpcodeVecV128Load8x8u, wasm.OpcodeVecV128Load8x8s, + wasm.OpcodeVecV128Load16x4u, wasm.OpcodeVecV128Load16x4s, + wasm.OpcodeVecV128Load32x2u, wasm.OpcodeVecV128Load32x2s: + _, offset := c.readMemArg() + if state.unreachable { + break + } + var lane ssa.VecLane + var signed bool + switch vecOp { + case wasm.OpcodeVecV128Load8x8s: + signed = true + fallthrough + case wasm.OpcodeVecV128Load8x8u: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecV128Load16x4s: + signed = true + fallthrough + case wasm.OpcodeVecV128Load16x4u: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecV128Load32x2s: + signed = true + fallthrough + case wasm.OpcodeVecV128Load32x2u: + lane = ssa.VecLaneI32x4 + } + baseAddr := state.pop() + addr := c.memOpSetup(baseAddr, uint64(offset), 8) + load := builder.AllocateInstruction(). + AsLoad(addr, offset, ssa.TypeV128). + Insert(builder).Return() + ret := builder.AllocateInstruction(). + AsWiden(load, lane, signed, true). + Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecV128Load8Splat, wasm.OpcodeVecV128Load16Splat, + wasm.OpcodeVecV128Load32Splat, wasm.OpcodeVecV128Load64Splat: + _, offset := c.readMemArg() + if state.unreachable { + break + } + var lane ssa.VecLane + var opSize uint64 + switch vecOp { + case wasm.OpcodeVecV128Load8Splat: + lane, opSize = ssa.VecLaneI8x16, 1 + case wasm.OpcodeVecV128Load16Splat: + lane, opSize = ssa.VecLaneI16x8, 2 + case wasm.OpcodeVecV128Load32Splat: + lane, opSize = ssa.VecLaneI32x4, 4 + case wasm.OpcodeVecV128Load64Splat: + lane, opSize = ssa.VecLaneI64x2, 8 + } + baseAddr := state.pop() + addr := c.memOpSetup(baseAddr, uint64(offset), opSize) + ret := builder.AllocateInstruction(). + AsLoadSplat(addr, offset, lane). + Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecV128Store: + _, offset := c.readMemArg() + if state.unreachable { + break + } + value := state.pop() + baseAddr := state.pop() + addr := c.memOpSetup(baseAddr, uint64(offset), 16) + builder.AllocateInstruction(). + AsStore(ssa.OpcodeStore, value, addr, offset). + Insert(builder) + case wasm.OpcodeVecV128Store8Lane, wasm.OpcodeVecV128Store16Lane, + wasm.OpcodeVecV128Store32Lane, wasm.OpcodeVecV128Store64Lane: + _, offset := c.readMemArg() + state.pc++ + if state.unreachable { + break + } + laneIndex := c.wasmFunctionBody[state.pc] + var storeOp ssa.Opcode + var lane ssa.VecLane + var opSize uint64 + switch vecOp { + case wasm.OpcodeVecV128Store8Lane: + storeOp, lane, opSize = ssa.OpcodeIstore8, ssa.VecLaneI8x16, 1 + case wasm.OpcodeVecV128Store16Lane: + storeOp, lane, opSize = ssa.OpcodeIstore16, ssa.VecLaneI16x8, 2 + case wasm.OpcodeVecV128Store32Lane: + storeOp, lane, opSize = ssa.OpcodeIstore32, ssa.VecLaneI32x4, 4 + case wasm.OpcodeVecV128Store64Lane: + storeOp, lane, opSize = ssa.OpcodeStore, ssa.VecLaneI64x2, 8 + } + vector := state.pop() + baseAddr := state.pop() + addr := c.memOpSetup(baseAddr, uint64(offset), opSize) + value := builder.AllocateInstruction(). + AsExtractlane(vector, laneIndex, lane, false). + Insert(builder).Return() + builder.AllocateInstruction(). + AsStore(storeOp, value, addr, offset). + Insert(builder) + case wasm.OpcodeVecV128Not: + if state.unreachable { + break + } + v1 := state.pop() + ret := builder.AllocateInstruction().AsVbnot(v1).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecV128And: + if state.unreachable { + break + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVband(v1, v2).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecV128AndNot: + if state.unreachable { + break + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVbandnot(v1, v2).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecV128Or: + if state.unreachable { + break + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVbor(v1, v2).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecV128Xor: + if state.unreachable { + break + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVbxor(v1, v2).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecV128Bitselect: + if state.unreachable { + break + } + c := state.pop() + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVbitselect(c, v1, v2).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecV128AnyTrue: + if state.unreachable { + break + } + v1 := state.pop() + ret := builder.AllocateInstruction().AsVanyTrue(v1).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16AllTrue, wasm.OpcodeVecI16x8AllTrue, wasm.OpcodeVecI32x4AllTrue, wasm.OpcodeVecI64x2AllTrue: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16AllTrue: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8AllTrue: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4AllTrue: + lane = ssa.VecLaneI32x4 + case wasm.OpcodeVecI64x2AllTrue: + lane = ssa.VecLaneI64x2 + } + v1 := state.pop() + ret := builder.AllocateInstruction().AsVallTrue(v1, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16BitMask, wasm.OpcodeVecI16x8BitMask, wasm.OpcodeVecI32x4BitMask, wasm.OpcodeVecI64x2BitMask: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16BitMask: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8BitMask: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4BitMask: + lane = ssa.VecLaneI32x4 + case wasm.OpcodeVecI64x2BitMask: + lane = ssa.VecLaneI64x2 + } + v1 := state.pop() + ret := builder.AllocateInstruction().AsVhighBits(v1, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16Abs, wasm.OpcodeVecI16x8Abs, wasm.OpcodeVecI32x4Abs, wasm.OpcodeVecI64x2Abs: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16Abs: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8Abs: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4Abs: + lane = ssa.VecLaneI32x4 + case wasm.OpcodeVecI64x2Abs: + lane = ssa.VecLaneI64x2 + } + v1 := state.pop() + ret := builder.AllocateInstruction().AsVIabs(v1, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16Neg, wasm.OpcodeVecI16x8Neg, wasm.OpcodeVecI32x4Neg, wasm.OpcodeVecI64x2Neg: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16Neg: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8Neg: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4Neg: + lane = ssa.VecLaneI32x4 + case wasm.OpcodeVecI64x2Neg: + lane = ssa.VecLaneI64x2 + } + v1 := state.pop() + ret := builder.AllocateInstruction().AsVIneg(v1, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16Popcnt: + if state.unreachable { + break + } + lane := ssa.VecLaneI8x16 + v1 := state.pop() + + ret := builder.AllocateInstruction().AsVIpopcnt(v1, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16Add, wasm.OpcodeVecI16x8Add, wasm.OpcodeVecI32x4Add, wasm.OpcodeVecI64x2Add: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16Add: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8Add: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4Add: + lane = ssa.VecLaneI32x4 + case wasm.OpcodeVecI64x2Add: + lane = ssa.VecLaneI64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVIadd(v1, v2, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16AddSatS, wasm.OpcodeVecI16x8AddSatS: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16AddSatS: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8AddSatS: + lane = ssa.VecLaneI16x8 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVSaddSat(v1, v2, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16AddSatU, wasm.OpcodeVecI16x8AddSatU: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16AddSatU: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8AddSatU: + lane = ssa.VecLaneI16x8 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVUaddSat(v1, v2, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16SubSatS, wasm.OpcodeVecI16x8SubSatS: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16SubSatS: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8SubSatS: + lane = ssa.VecLaneI16x8 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVSsubSat(v1, v2, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16SubSatU, wasm.OpcodeVecI16x8SubSatU: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16SubSatU: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8SubSatU: + lane = ssa.VecLaneI16x8 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVUsubSat(v1, v2, lane).Insert(builder).Return() + state.push(ret) + + case wasm.OpcodeVecI8x16Sub, wasm.OpcodeVecI16x8Sub, wasm.OpcodeVecI32x4Sub, wasm.OpcodeVecI64x2Sub: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16Sub: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8Sub: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4Sub: + lane = ssa.VecLaneI32x4 + case wasm.OpcodeVecI64x2Sub: + lane = ssa.VecLaneI64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVIsub(v1, v2, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16MinS, wasm.OpcodeVecI16x8MinS, wasm.OpcodeVecI32x4MinS: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16MinS: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8MinS: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4MinS: + lane = ssa.VecLaneI32x4 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVImin(v1, v2, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16MinU, wasm.OpcodeVecI16x8MinU, wasm.OpcodeVecI32x4MinU: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16MinU: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8MinU: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4MinU: + lane = ssa.VecLaneI32x4 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVUmin(v1, v2, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16MaxS, wasm.OpcodeVecI16x8MaxS, wasm.OpcodeVecI32x4MaxS: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16MaxS: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8MaxS: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4MaxS: + lane = ssa.VecLaneI32x4 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVImax(v1, v2, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16MaxU, wasm.OpcodeVecI16x8MaxU, wasm.OpcodeVecI32x4MaxU: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16MaxU: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8MaxU: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4MaxU: + lane = ssa.VecLaneI32x4 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVUmax(v1, v2, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16AvgrU, wasm.OpcodeVecI16x8AvgrU: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16AvgrU: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8AvgrU: + lane = ssa.VecLaneI16x8 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVAvgRound(v1, v2, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI16x8Mul, wasm.OpcodeVecI32x4Mul, wasm.OpcodeVecI64x2Mul: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI16x8Mul: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4Mul: + lane = ssa.VecLaneI32x4 + case wasm.OpcodeVecI64x2Mul: + lane = ssa.VecLaneI64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVImul(v1, v2, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI16x8Q15mulrSatS: + if state.unreachable { + break + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsSqmulRoundSat(v1, v2, ssa.VecLaneI16x8).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16Eq, wasm.OpcodeVecI16x8Eq, wasm.OpcodeVecI32x4Eq, wasm.OpcodeVecI64x2Eq: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16Eq: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8Eq: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4Eq: + lane = ssa.VecLaneI32x4 + case wasm.OpcodeVecI64x2Eq: + lane = ssa.VecLaneI64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsVIcmp(v1, v2, ssa.IntegerCmpCondEqual, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16Ne, wasm.OpcodeVecI16x8Ne, wasm.OpcodeVecI32x4Ne, wasm.OpcodeVecI64x2Ne: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16Ne: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8Ne: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4Ne: + lane = ssa.VecLaneI32x4 + case wasm.OpcodeVecI64x2Ne: + lane = ssa.VecLaneI64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsVIcmp(v1, v2, ssa.IntegerCmpCondNotEqual, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16LtS, wasm.OpcodeVecI16x8LtS, wasm.OpcodeVecI32x4LtS, wasm.OpcodeVecI64x2LtS: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16LtS: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8LtS: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4LtS: + lane = ssa.VecLaneI32x4 + case wasm.OpcodeVecI64x2LtS: + lane = ssa.VecLaneI64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsVIcmp(v1, v2, ssa.IntegerCmpCondSignedLessThan, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16LtU, wasm.OpcodeVecI16x8LtU, wasm.OpcodeVecI32x4LtU: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16LtU: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8LtU: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4LtU: + lane = ssa.VecLaneI32x4 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsVIcmp(v1, v2, ssa.IntegerCmpCondUnsignedLessThan, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16LeS, wasm.OpcodeVecI16x8LeS, wasm.OpcodeVecI32x4LeS, wasm.OpcodeVecI64x2LeS: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16LeS: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8LeS: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4LeS: + lane = ssa.VecLaneI32x4 + case wasm.OpcodeVecI64x2LeS: + lane = ssa.VecLaneI64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsVIcmp(v1, v2, ssa.IntegerCmpCondSignedLessThanOrEqual, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16LeU, wasm.OpcodeVecI16x8LeU, wasm.OpcodeVecI32x4LeU: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16LeU: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8LeU: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4LeU: + lane = ssa.VecLaneI32x4 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsVIcmp(v1, v2, ssa.IntegerCmpCondUnsignedLessThanOrEqual, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16GtS, wasm.OpcodeVecI16x8GtS, wasm.OpcodeVecI32x4GtS, wasm.OpcodeVecI64x2GtS: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16GtS: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8GtS: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4GtS: + lane = ssa.VecLaneI32x4 + case wasm.OpcodeVecI64x2GtS: + lane = ssa.VecLaneI64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsVIcmp(v1, v2, ssa.IntegerCmpCondSignedGreaterThan, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16GtU, wasm.OpcodeVecI16x8GtU, wasm.OpcodeVecI32x4GtU: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16GtU: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8GtU: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4GtU: + lane = ssa.VecLaneI32x4 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsVIcmp(v1, v2, ssa.IntegerCmpCondUnsignedGreaterThan, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16GeS, wasm.OpcodeVecI16x8GeS, wasm.OpcodeVecI32x4GeS, wasm.OpcodeVecI64x2GeS: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16GeS: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8GeS: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4GeS: + lane = ssa.VecLaneI32x4 + case wasm.OpcodeVecI64x2GeS: + lane = ssa.VecLaneI64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsVIcmp(v1, v2, ssa.IntegerCmpCondSignedGreaterThanOrEqual, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16GeU, wasm.OpcodeVecI16x8GeU, wasm.OpcodeVecI32x4GeU: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16GeU: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8GeU: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4GeU: + lane = ssa.VecLaneI32x4 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsVIcmp(v1, v2, ssa.IntegerCmpCondUnsignedGreaterThanOrEqual, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecF32x4Max, wasm.OpcodeVecF64x2Max: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecF32x4Max: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2Max: + lane = ssa.VecLaneF64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVFmax(v1, v2, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecF32x4Abs, wasm.OpcodeVecF64x2Abs: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecF32x4Abs: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2Abs: + lane = ssa.VecLaneF64x2 + } + v1 := state.pop() + ret := builder.AllocateInstruction().AsVFabs(v1, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecF32x4Min, wasm.OpcodeVecF64x2Min: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecF32x4Min: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2Min: + lane = ssa.VecLaneF64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVFmin(v1, v2, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecF32x4Neg, wasm.OpcodeVecF64x2Neg: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecF32x4Neg: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2Neg: + lane = ssa.VecLaneF64x2 + } + v1 := state.pop() + ret := builder.AllocateInstruction().AsVFneg(v1, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecF32x4Sqrt, wasm.OpcodeVecF64x2Sqrt: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecF32x4Sqrt: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2Sqrt: + lane = ssa.VecLaneF64x2 + } + v1 := state.pop() + ret := builder.AllocateInstruction().AsVSqrt(v1, lane).Insert(builder).Return() + state.push(ret) + + case wasm.OpcodeVecF32x4Add, wasm.OpcodeVecF64x2Add: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecF32x4Add: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2Add: + lane = ssa.VecLaneF64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVFadd(v1, v2, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecF32x4Sub, wasm.OpcodeVecF64x2Sub: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecF32x4Sub: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2Sub: + lane = ssa.VecLaneF64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVFsub(v1, v2, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecF32x4Mul, wasm.OpcodeVecF64x2Mul: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecF32x4Mul: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2Mul: + lane = ssa.VecLaneF64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVFmul(v1, v2, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecF32x4Div, wasm.OpcodeVecF64x2Div: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecF32x4Div: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2Div: + lane = ssa.VecLaneF64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVFdiv(v1, v2, lane).Insert(builder).Return() + state.push(ret) + + case wasm.OpcodeVecI16x8ExtaddPairwiseI8x16S, wasm.OpcodeVecI16x8ExtaddPairwiseI8x16U: + if state.unreachable { + break + } + v1 := state.pop() + // TODO: The sequence `Widen; Widen; IaddPairwise` can be substituted for a single instruction on some ISAs. + signed := vecOp == wasm.OpcodeVecI16x8ExtaddPairwiseI8x16S + vlo := builder.AllocateInstruction().AsWiden(v1, ssa.VecLaneI8x16, signed, true).Insert(builder).Return() + vhi := builder.AllocateInstruction().AsWiden(v1, ssa.VecLaneI8x16, signed, false).Insert(builder).Return() + ret := builder.AllocateInstruction().AsIaddPairwise(vlo, vhi, ssa.VecLaneI16x8).Insert(builder).Return() + state.push(ret) + + case wasm.OpcodeVecI32x4ExtaddPairwiseI16x8S, wasm.OpcodeVecI32x4ExtaddPairwiseI16x8U: + if state.unreachable { + break + } + v1 := state.pop() + // TODO: The sequence `Widen; Widen; IaddPairwise` can be substituted for a single instruction on some ISAs. + signed := vecOp == wasm.OpcodeVecI32x4ExtaddPairwiseI16x8S + vlo := builder.AllocateInstruction().AsWiden(v1, ssa.VecLaneI16x8, signed, true).Insert(builder).Return() + vhi := builder.AllocateInstruction().AsWiden(v1, ssa.VecLaneI16x8, signed, false).Insert(builder).Return() + ret := builder.AllocateInstruction().AsIaddPairwise(vlo, vhi, ssa.VecLaneI32x4).Insert(builder).Return() + state.push(ret) + + case wasm.OpcodeVecI16x8ExtMulLowI8x16S, wasm.OpcodeVecI16x8ExtMulLowI8x16U: + if state.unreachable { + break + } + v2 := state.pop() + v1 := state.pop() + ret := c.lowerExtMul( + v1, v2, + ssa.VecLaneI8x16, ssa.VecLaneI16x8, + vecOp == wasm.OpcodeVecI16x8ExtMulLowI8x16S, true) + state.push(ret) + + case wasm.OpcodeVecI16x8ExtMulHighI8x16S, wasm.OpcodeVecI16x8ExtMulHighI8x16U: + if state.unreachable { + break + } + v2 := state.pop() + v1 := state.pop() + ret := c.lowerExtMul( + v1, v2, + ssa.VecLaneI8x16, ssa.VecLaneI16x8, + vecOp == wasm.OpcodeVecI16x8ExtMulHighI8x16S, false) + state.push(ret) + + case wasm.OpcodeVecI32x4ExtMulLowI16x8S, wasm.OpcodeVecI32x4ExtMulLowI16x8U: + if state.unreachable { + break + } + v2 := state.pop() + v1 := state.pop() + ret := c.lowerExtMul( + v1, v2, + ssa.VecLaneI16x8, ssa.VecLaneI32x4, + vecOp == wasm.OpcodeVecI32x4ExtMulLowI16x8S, true) + state.push(ret) + + case wasm.OpcodeVecI32x4ExtMulHighI16x8S, wasm.OpcodeVecI32x4ExtMulHighI16x8U: + if state.unreachable { + break + } + v2 := state.pop() + v1 := state.pop() + ret := c.lowerExtMul( + v1, v2, + ssa.VecLaneI16x8, ssa.VecLaneI32x4, + vecOp == wasm.OpcodeVecI32x4ExtMulHighI16x8S, false) + state.push(ret) + case wasm.OpcodeVecI64x2ExtMulLowI32x4S, wasm.OpcodeVecI64x2ExtMulLowI32x4U: + if state.unreachable { + break + } + v2 := state.pop() + v1 := state.pop() + ret := c.lowerExtMul( + v1, v2, + ssa.VecLaneI32x4, ssa.VecLaneI64x2, + vecOp == wasm.OpcodeVecI64x2ExtMulLowI32x4S, true) + state.push(ret) + + case wasm.OpcodeVecI64x2ExtMulHighI32x4S, wasm.OpcodeVecI64x2ExtMulHighI32x4U: + if state.unreachable { + break + } + v2 := state.pop() + v1 := state.pop() + ret := c.lowerExtMul( + v1, v2, + ssa.VecLaneI32x4, ssa.VecLaneI64x2, + vecOp == wasm.OpcodeVecI64x2ExtMulHighI32x4S, false) + state.push(ret) + + case wasm.OpcodeVecI32x4DotI16x8S: + if state.unreachable { + break + } + v2 := state.pop() + v1 := state.pop() + + // TODO: The sequence `Widen; Widen; VIMul` can be substituted for a single instruction on some ISAs. + v1lo := builder.AllocateInstruction().AsWiden(v1, ssa.VecLaneI16x8, true, true).Insert(builder).Return() + v2lo := builder.AllocateInstruction().AsWiden(v2, ssa.VecLaneI16x8, true, true).Insert(builder).Return() + low := builder.AllocateInstruction().AsVImul(v1lo, v2lo, ssa.VecLaneI32x4).Insert(builder).Return() + + v1hi := builder.AllocateInstruction().AsWiden(v1, ssa.VecLaneI16x8, true, false).Insert(builder).Return() + v2hi := builder.AllocateInstruction().AsWiden(v2, ssa.VecLaneI16x8, true, false).Insert(builder).Return() + high := builder.AllocateInstruction().AsVImul(v1hi, v2hi, ssa.VecLaneI32x4).Insert(builder).Return() + + ret := builder.AllocateInstruction().AsIaddPairwise(low, high, ssa.VecLaneI32x4).Insert(builder).Return() + state.push(ret) + + case wasm.OpcodeVecF32x4Eq, wasm.OpcodeVecF64x2Eq: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecF32x4Eq: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2Eq: + lane = ssa.VecLaneF64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsVFcmp(v1, v2, ssa.FloatCmpCondEqual, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecF32x4Ne, wasm.OpcodeVecF64x2Ne: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecF32x4Ne: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2Ne: + lane = ssa.VecLaneF64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsVFcmp(v1, v2, ssa.FloatCmpCondNotEqual, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecF32x4Lt, wasm.OpcodeVecF64x2Lt: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecF32x4Lt: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2Lt: + lane = ssa.VecLaneF64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsVFcmp(v1, v2, ssa.FloatCmpCondLessThan, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecF32x4Le, wasm.OpcodeVecF64x2Le: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecF32x4Le: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2Le: + lane = ssa.VecLaneF64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsVFcmp(v1, v2, ssa.FloatCmpCondLessThanOrEqual, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecF32x4Gt, wasm.OpcodeVecF64x2Gt: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecF32x4Gt: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2Gt: + lane = ssa.VecLaneF64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsVFcmp(v1, v2, ssa.FloatCmpCondGreaterThan, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecF32x4Ge, wasm.OpcodeVecF64x2Ge: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecF32x4Ge: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2Ge: + lane = ssa.VecLaneF64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsVFcmp(v1, v2, ssa.FloatCmpCondGreaterThanOrEqual, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecF32x4Ceil, wasm.OpcodeVecF64x2Ceil: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecF32x4Ceil: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2Ceil: + lane = ssa.VecLaneF64x2 + } + v1 := state.pop() + ret := builder.AllocateInstruction().AsVCeil(v1, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecF32x4Floor, wasm.OpcodeVecF64x2Floor: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecF32x4Floor: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2Floor: + lane = ssa.VecLaneF64x2 + } + v1 := state.pop() + ret := builder.AllocateInstruction().AsVFloor(v1, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecF32x4Trunc, wasm.OpcodeVecF64x2Trunc: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecF32x4Trunc: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2Trunc: + lane = ssa.VecLaneF64x2 + } + v1 := state.pop() + ret := builder.AllocateInstruction().AsVTrunc(v1, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecF32x4Nearest, wasm.OpcodeVecF64x2Nearest: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecF32x4Nearest: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2Nearest: + lane = ssa.VecLaneF64x2 + } + v1 := state.pop() + ret := builder.AllocateInstruction().AsVNearest(v1, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecF32x4Pmin, wasm.OpcodeVecF64x2Pmin: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecF32x4Pmin: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2Pmin: + lane = ssa.VecLaneF64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVMinPseudo(v1, v2, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecF32x4Pmax, wasm.OpcodeVecF64x2Pmax: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecF32x4Pmax: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2Pmax: + lane = ssa.VecLaneF64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVMaxPseudo(v1, v2, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI32x4TruncSatF32x4S, wasm.OpcodeVecI32x4TruncSatF32x4U: + if state.unreachable { + break + } + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsVFcvtToIntSat(v1, ssa.VecLaneF32x4, vecOp == wasm.OpcodeVecI32x4TruncSatF32x4S).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI32x4TruncSatF64x2SZero, wasm.OpcodeVecI32x4TruncSatF64x2UZero: + if state.unreachable { + break + } + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsVFcvtToIntSat(v1, ssa.VecLaneF64x2, vecOp == wasm.OpcodeVecI32x4TruncSatF64x2SZero).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecF32x4ConvertI32x4S, wasm.OpcodeVecF32x4ConvertI32x4U: + if state.unreachable { + break + } + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsVFcvtFromInt(v1, ssa.VecLaneF32x4, vecOp == wasm.OpcodeVecF32x4ConvertI32x4S).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecF64x2ConvertLowI32x4S, wasm.OpcodeVecF64x2ConvertLowI32x4U: + if state.unreachable { + break + } + v1 := state.pop() + v1w := builder.AllocateInstruction(). + AsWiden(v1, ssa.VecLaneI32x4, vecOp == wasm.OpcodeVecF64x2ConvertLowI32x4S, true).Insert(builder).Return() + ret := builder.AllocateInstruction(). + AsVFcvtFromInt(v1w, ssa.VecLaneF64x2, vecOp == wasm.OpcodeVecF64x2ConvertLowI32x4S). + Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16NarrowI16x8S, wasm.OpcodeVecI8x16NarrowI16x8U: + if state.unreachable { + break + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsNarrow(v1, v2, ssa.VecLaneI16x8, vecOp == wasm.OpcodeVecI8x16NarrowI16x8S). + Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI16x8NarrowI32x4S, wasm.OpcodeVecI16x8NarrowI32x4U: + if state.unreachable { + break + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsNarrow(v1, v2, ssa.VecLaneI32x4, vecOp == wasm.OpcodeVecI16x8NarrowI32x4S). + Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI16x8ExtendLowI8x16S, wasm.OpcodeVecI16x8ExtendLowI8x16U: + if state.unreachable { + break + } + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsWiden(v1, ssa.VecLaneI8x16, vecOp == wasm.OpcodeVecI16x8ExtendLowI8x16S, true). + Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI16x8ExtendHighI8x16S, wasm.OpcodeVecI16x8ExtendHighI8x16U: + if state.unreachable { + break + } + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsWiden(v1, ssa.VecLaneI8x16, vecOp == wasm.OpcodeVecI16x8ExtendHighI8x16S, false). + Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI32x4ExtendLowI16x8S, wasm.OpcodeVecI32x4ExtendLowI16x8U: + if state.unreachable { + break + } + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsWiden(v1, ssa.VecLaneI16x8, vecOp == wasm.OpcodeVecI32x4ExtendLowI16x8S, true). + Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI32x4ExtendHighI16x8S, wasm.OpcodeVecI32x4ExtendHighI16x8U: + if state.unreachable { + break + } + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsWiden(v1, ssa.VecLaneI16x8, vecOp == wasm.OpcodeVecI32x4ExtendHighI16x8S, false). + Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI64x2ExtendLowI32x4S, wasm.OpcodeVecI64x2ExtendLowI32x4U: + if state.unreachable { + break + } + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsWiden(v1, ssa.VecLaneI32x4, vecOp == wasm.OpcodeVecI64x2ExtendLowI32x4S, true). + Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI64x2ExtendHighI32x4S, wasm.OpcodeVecI64x2ExtendHighI32x4U: + if state.unreachable { + break + } + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsWiden(v1, ssa.VecLaneI32x4, vecOp == wasm.OpcodeVecI64x2ExtendHighI32x4S, false). + Insert(builder).Return() + state.push(ret) + + case wasm.OpcodeVecF64x2PromoteLowF32x4Zero: + if state.unreachable { + break + } + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsFvpromoteLow(v1, ssa.VecLaneF32x4). + Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecF32x4DemoteF64x2Zero: + if state.unreachable { + break + } + v1 := state.pop() + ret := builder.AllocateInstruction(). + AsFvdemote(v1, ssa.VecLaneF64x2). + Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16Shl, wasm.OpcodeVecI16x8Shl, wasm.OpcodeVecI32x4Shl, wasm.OpcodeVecI64x2Shl: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16Shl: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8Shl: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4Shl: + lane = ssa.VecLaneI32x4 + case wasm.OpcodeVecI64x2Shl: + lane = ssa.VecLaneI64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVIshl(v1, v2, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16ShrS, wasm.OpcodeVecI16x8ShrS, wasm.OpcodeVecI32x4ShrS, wasm.OpcodeVecI64x2ShrS: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16ShrS: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8ShrS: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4ShrS: + lane = ssa.VecLaneI32x4 + case wasm.OpcodeVecI64x2ShrS: + lane = ssa.VecLaneI64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVSshr(v1, v2, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16ShrU, wasm.OpcodeVecI16x8ShrU, wasm.OpcodeVecI32x4ShrU, wasm.OpcodeVecI64x2ShrU: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16ShrU: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8ShrU: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4ShrU: + lane = ssa.VecLaneI32x4 + case wasm.OpcodeVecI64x2ShrU: + lane = ssa.VecLaneI64x2 + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsVUshr(v1, v2, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecI8x16ExtractLaneS, wasm.OpcodeVecI16x8ExtractLaneS: + state.pc++ + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16ExtractLaneS: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8ExtractLaneS: + lane = ssa.VecLaneI16x8 + } + v1 := state.pop() + index := c.wasmFunctionBody[state.pc] + ext := builder.AllocateInstruction().AsExtractlane(v1, index, lane, true).Insert(builder).Return() + state.push(ext) + case wasm.OpcodeVecI8x16ExtractLaneU, wasm.OpcodeVecI16x8ExtractLaneU, + wasm.OpcodeVecI32x4ExtractLane, wasm.OpcodeVecI64x2ExtractLane, + wasm.OpcodeVecF32x4ExtractLane, wasm.OpcodeVecF64x2ExtractLane: + state.pc++ // Skip the immediate value. + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16ExtractLaneU: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8ExtractLaneU: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4ExtractLane: + lane = ssa.VecLaneI32x4 + case wasm.OpcodeVecI64x2ExtractLane: + lane = ssa.VecLaneI64x2 + case wasm.OpcodeVecF32x4ExtractLane: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2ExtractLane: + lane = ssa.VecLaneF64x2 + } + v1 := state.pop() + index := c.wasmFunctionBody[state.pc] + ext := builder.AllocateInstruction().AsExtractlane(v1, index, lane, false).Insert(builder).Return() + state.push(ext) + case wasm.OpcodeVecI8x16ReplaceLane, wasm.OpcodeVecI16x8ReplaceLane, + wasm.OpcodeVecI32x4ReplaceLane, wasm.OpcodeVecI64x2ReplaceLane, + wasm.OpcodeVecF32x4ReplaceLane, wasm.OpcodeVecF64x2ReplaceLane: + state.pc++ + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16ReplaceLane: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8ReplaceLane: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4ReplaceLane: + lane = ssa.VecLaneI32x4 + case wasm.OpcodeVecI64x2ReplaceLane: + lane = ssa.VecLaneI64x2 + case wasm.OpcodeVecF32x4ReplaceLane: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2ReplaceLane: + lane = ssa.VecLaneF64x2 + } + v2 := state.pop() + v1 := state.pop() + index := c.wasmFunctionBody[state.pc] + ret := builder.AllocateInstruction().AsInsertlane(v1, v2, index, lane).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeVecV128i8x16Shuffle: + state.pc++ + laneIndexes := c.wasmFunctionBody[state.pc : state.pc+16] + state.pc += 15 + if state.unreachable { + break + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsShuffle(v1, v2, laneIndexes).Insert(builder).Return() + state.push(ret) + + case wasm.OpcodeVecI8x16Swizzle: + if state.unreachable { + break + } + v2 := state.pop() + v1 := state.pop() + ret := builder.AllocateInstruction().AsSwizzle(v1, v2, ssa.VecLaneI8x16).Insert(builder).Return() + state.push(ret) + + case wasm.OpcodeVecI8x16Splat, + wasm.OpcodeVecI16x8Splat, + wasm.OpcodeVecI32x4Splat, + wasm.OpcodeVecI64x2Splat, + wasm.OpcodeVecF32x4Splat, + wasm.OpcodeVecF64x2Splat: + if state.unreachable { + break + } + var lane ssa.VecLane + switch vecOp { + case wasm.OpcodeVecI8x16Splat: + lane = ssa.VecLaneI8x16 + case wasm.OpcodeVecI16x8Splat: + lane = ssa.VecLaneI16x8 + case wasm.OpcodeVecI32x4Splat: + lane = ssa.VecLaneI32x4 + case wasm.OpcodeVecI64x2Splat: + lane = ssa.VecLaneI64x2 + case wasm.OpcodeVecF32x4Splat: + lane = ssa.VecLaneF32x4 + case wasm.OpcodeVecF64x2Splat: + lane = ssa.VecLaneF64x2 + } + v1 := state.pop() + ret := builder.AllocateInstruction().AsSplat(v1, lane).Insert(builder).Return() + state.push(ret) + + default: + panic("TODO: unsupported vector instruction: " + wasm.VectorInstructionName(vecOp)) + } + case wasm.OpcodeRefFunc: + funcIndex := c.readI32u() + if state.unreachable { + break + } + + c.storeCallerModuleContext() + + funcIndexVal := builder.AllocateInstruction().AsIconst32(funcIndex).Insert(builder).Return() + + refFuncPtr := builder.AllocateInstruction(). + AsLoad(c.execCtxPtrValue, + wazevoapi.ExecutionContextOffsetRefFuncTrampolineAddress.U32(), + ssa.TypeI64, + ).Insert(builder).Return() + + // TODO: reuse the slice. + args := []ssa.Value{c.execCtxPtrValue, funcIndexVal} + refFuncRet := builder. + AllocateInstruction(). + AsCallIndirect(refFuncPtr, &c.refFuncSig, args). + Insert(builder).Return() + state.push(refFuncRet) + + case wasm.OpcodeRefNull: + c.loweringState.pc++ // skips the reference type as we treat both of them as i64(0). + if state.unreachable { + break + } + ret := builder.AllocateInstruction().AsIconst64(0).Insert(builder).Return() + state.push(ret) + case wasm.OpcodeRefIsNull: + if state.unreachable { + break + } + r := state.pop() + zero := builder.AllocateInstruction().AsIconst64(0).Insert(builder) + icmp := builder.AllocateInstruction(). + AsIcmp(r, zero.Return(), ssa.IntegerCmpCondEqual). + Insert(builder). + Return() + state.push(icmp) + case wasm.OpcodeTableSet: + tableIndex := c.readI32u() + if state.unreachable { + break + } + r := state.pop() + targetOffsetInTable := state.pop() + + elementAddr := c.lowerAccessTableWithBoundsCheck(tableIndex, targetOffsetInTable) + builder.AllocateInstruction().AsStore(ssa.OpcodeStore, r, elementAddr, 0).Insert(builder) + + case wasm.OpcodeTableGet: + tableIndex := c.readI32u() + if state.unreachable { + break + } + targetOffsetInTable := state.pop() + elementAddr := c.lowerAccessTableWithBoundsCheck(tableIndex, targetOffsetInTable) + loaded := builder.AllocateInstruction().AsLoad(elementAddr, 0, ssa.TypeI64).Insert(builder).Return() + state.push(loaded) + default: + panic("TODO: unsupported in wazevo yet: " + wasm.InstructionName(op)) + } + + if wazevoapi.FrontEndLoggingEnabled { + fmt.Println("--------- Translated " + wasm.InstructionName(op) + " --------") + fmt.Println("state: " + c.loweringState.String()) + fmt.Println(c.formatBuilder()) + fmt.Println("--------------------------") + } + c.loweringState.pc++ +} + +func (c *Compiler) lowerExtMul(v1, v2 ssa.Value, from, to ssa.VecLane, signed, low bool) ssa.Value { + // TODO: The sequence `Widen; Widen; VIMul` can be substituted for a single instruction on some ISAs. + builder := c.ssaBuilder + + v1lo := builder.AllocateInstruction().AsWiden(v1, from, signed, low).Insert(builder).Return() + v2lo := builder.AllocateInstruction().AsWiden(v2, from, signed, low).Insert(builder).Return() + + return builder.AllocateInstruction().AsVImul(v1lo, v2lo, to).Insert(builder).Return() +} + +const ( + tableInstanceBaseAddressOffset = 0 + tableInstanceLenOffset = tableInstanceBaseAddressOffset + 8 +) + +func (c *Compiler) lowerAccessTableWithBoundsCheck(tableIndex uint32, elementOffsetInTable ssa.Value) (elementAddress ssa.Value) { + builder := c.ssaBuilder + + // Load the table. + loadTableInstancePtr := builder.AllocateInstruction() + loadTableInstancePtr.AsLoad(c.moduleCtxPtrValue, c.offset.TableOffset(int(tableIndex)).U32(), ssa.TypeI64) + builder.InsertInstruction(loadTableInstancePtr) + tableInstancePtr := loadTableInstancePtr.Return() + + // Load the table's length. + loadTableLen := builder.AllocateInstruction() + loadTableLen.AsLoad(tableInstancePtr, tableInstanceLenOffset, ssa.TypeI32) + builder.InsertInstruction(loadTableLen) + tableLen := loadTableLen.Return() + + // Compare the length and the target, and trap if out of bounds. + checkOOB := builder.AllocateInstruction() + checkOOB.AsIcmp(elementOffsetInTable, tableLen, ssa.IntegerCmpCondUnsignedGreaterThanOrEqual) + builder.InsertInstruction(checkOOB) + exitIfOOB := builder.AllocateInstruction() + exitIfOOB.AsExitIfTrueWithCode(c.execCtxPtrValue, checkOOB.Return(), wazevoapi.ExitCodeTableOutOfBounds) + builder.InsertInstruction(exitIfOOB) + + // Get the base address of wasm.TableInstance.References. + loadTableBaseAddress := builder.AllocateInstruction() + loadTableBaseAddress.AsLoad(tableInstancePtr, tableInstanceBaseAddressOffset, ssa.TypeI64) + builder.InsertInstruction(loadTableBaseAddress) + tableBase := loadTableBaseAddress.Return() + + // Calculate the address of the target function. First we need to multiply targetOffsetInTable by 8 (pointer size). + multiplyBy8 := builder.AllocateInstruction() + three := builder.AllocateInstruction() + three.AsIconst64(3) + builder.InsertInstruction(three) + multiplyBy8.AsIshl(elementOffsetInTable, three.Return()) + builder.InsertInstruction(multiplyBy8) + targetOffsetInTableMultipliedBy8 := multiplyBy8.Return() + + // Then add the multiplied value to the base which results in the address of the target function (*wazevo.functionInstance) + calcElementAddressInTable := builder.AllocateInstruction() + calcElementAddressInTable.AsIadd(tableBase, targetOffsetInTableMultipliedBy8) + builder.InsertInstruction(calcElementAddressInTable) + return calcElementAddressInTable.Return() +} + +func (c *Compiler) lowerCallIndirect(typeIndex, tableIndex uint32) { + builder := c.ssaBuilder + state := c.state() + + elementOffsetInTable := state.pop() + functionInstancePtrAddress := c.lowerAccessTableWithBoundsCheck(tableIndex, elementOffsetInTable) + loadFunctionInstancePtr := builder.AllocateInstruction() + loadFunctionInstancePtr.AsLoad(functionInstancePtrAddress, 0, ssa.TypeI64) + builder.InsertInstruction(loadFunctionInstancePtr) + functionInstancePtr := loadFunctionInstancePtr.Return() + + // Check if it is not the null pointer. + zero := builder.AllocateInstruction() + zero.AsIconst64(0) + builder.InsertInstruction(zero) + checkNull := builder.AllocateInstruction() + checkNull.AsIcmp(functionInstancePtr, zero.Return(), ssa.IntegerCmpCondEqual) + builder.InsertInstruction(checkNull) + exitIfNull := builder.AllocateInstruction() + exitIfNull.AsExitIfTrueWithCode(c.execCtxPtrValue, checkNull.Return(), wazevoapi.ExitCodeIndirectCallNullPointer) + builder.InsertInstruction(exitIfNull) + + // We need to do the type check. First, load the target function instance's typeID. + loadTypeID := builder.AllocateInstruction() + loadTypeID.AsLoad(functionInstancePtr, wazevoapi.FunctionInstanceTypeIDOffset, ssa.TypeI32) + builder.InsertInstruction(loadTypeID) + actualTypeID := loadTypeID.Return() + + // Next, we load the expected TypeID: + loadTypeIDsBegin := builder.AllocateInstruction() + loadTypeIDsBegin.AsLoad(c.moduleCtxPtrValue, c.offset.TypeIDs1stElement.U32(), ssa.TypeI64) + builder.InsertInstruction(loadTypeIDsBegin) + typeIDsBegin := loadTypeIDsBegin.Return() + + loadExpectedTypeID := builder.AllocateInstruction() + loadExpectedTypeID.AsLoad(typeIDsBegin, uint32(typeIndex)*4 /* size of wasm.FunctionTypeID */, ssa.TypeI32) + builder.InsertInstruction(loadExpectedTypeID) + expectedTypeID := loadExpectedTypeID.Return() + + // Check if the type ID matches. + checkTypeID := builder.AllocateInstruction() + checkTypeID.AsIcmp(actualTypeID, expectedTypeID, ssa.IntegerCmpCondNotEqual) + builder.InsertInstruction(checkTypeID) + exitIfNotMatch := builder.AllocateInstruction() + exitIfNotMatch.AsExitIfTrueWithCode(c.execCtxPtrValue, checkTypeID.Return(), wazevoapi.ExitCodeIndirectCallTypeMismatch) + builder.InsertInstruction(exitIfNotMatch) + + // Now ready to call the function. Load the executable and moduleContextOpaquePtr from the function instance. + loadExecutablePtr := builder.AllocateInstruction() + loadExecutablePtr.AsLoad(functionInstancePtr, wazevoapi.FunctionInstanceExecutableOffset, ssa.TypeI64) + builder.InsertInstruction(loadExecutablePtr) + executablePtr := loadExecutablePtr.Return() + loadModuleContextOpaquePtr := builder.AllocateInstruction() + loadModuleContextOpaquePtr.AsLoad(functionInstancePtr, wazevoapi.FunctionInstanceModuleContextOpaquePtrOffset, ssa.TypeI64) + builder.InsertInstruction(loadModuleContextOpaquePtr) + moduleContextOpaquePtr := loadModuleContextOpaquePtr.Return() + + // TODO: reuse slice? + typ := &c.m.TypeSection[typeIndex] + argN := len(typ.Params) + args := make([]ssa.Value, argN+2) + args[0] = c.execCtxPtrValue + args[1] = moduleContextOpaquePtr + state.nPopInto(argN, args[2:]) + + // Before transfer the control to the callee, we have to store the current module's moduleContextPtr + // into execContext.callerModuleContextPtr in case when the callee is a Go function. + c.storeCallerModuleContext() + + call := builder.AllocateInstruction() + call.AsCallIndirect(executablePtr, c.signatures[typ], args) + builder.InsertInstruction(call) + + first, rest := call.Returns() + if first.Valid() { + state.push(first) + } + for _, v := range rest { + state.push(v) + } + + c.reloadAfterCall() +} + +// memOpSetup inserts the bounds check and calculates the address of the memory operation (loads/stores). +func (c *Compiler) memOpSetup(baseAddr ssa.Value, constOffset, operationSizeInBytes uint64) (address ssa.Value) { + address = ssa.ValueInvalid + builder := c.ssaBuilder + + baseAddrID := baseAddr.ID() + ceil := constOffset + operationSizeInBytes + if known := c.getKnownSafeBound(baseAddrID); known.valid() { + // We reuse the calculated absolute address even if the bound is not known to be safe. + address = known.absoluteAddr + if ceil <= known.bound { + return + } + } + + ceilConst := builder.AllocateInstruction() + ceilConst.AsIconst64(ceil) + builder.InsertInstruction(ceilConst) + + // We calculate the offset in 64-bit space. + extBaseAddr := builder.AllocateInstruction(). + AsUExtend(baseAddr, 32, 64). + Insert(builder). + Return() + + // Note: memLen is already zero extended to 64-bit space at the load time. + memLen := c.getMemoryLenValue(false) + + // baseAddrPlusCeil = baseAddr + ceil + baseAddrPlusCeil := builder.AllocateInstruction() + baseAddrPlusCeil.AsIadd(extBaseAddr, ceilConst.Return()) + builder.InsertInstruction(baseAddrPlusCeil) + + // Check for out of bounds memory access: `memLen >= baseAddrPlusCeil`. + cmp := builder.AllocateInstruction() + cmp.AsIcmp(memLen, baseAddrPlusCeil.Return(), ssa.IntegerCmpCondUnsignedLessThan) + builder.InsertInstruction(cmp) + exitIfNZ := builder.AllocateInstruction() + exitIfNZ.AsExitIfTrueWithCode(c.execCtxPtrValue, cmp.Return(), wazevoapi.ExitCodeMemoryOutOfBounds) + builder.InsertInstruction(exitIfNZ) + + // Load the value from memBase + extBaseAddr. + if address == ssa.ValueInvalid { // Reuse the value if the memBase is already calculated at this point. + memBase := c.getMemoryBaseValue(false) + address = builder.AllocateInstruction(). + AsIadd(memBase, extBaseAddr).Insert(builder).Return() + } + + // Record the bound ceil for this baseAddr is known to be safe for the subsequent memory access in the same block. + c.recordKnownSafeBound(baseAddrID, ceil, address) + return +} + +func (c *Compiler) callMemmove(dst, src, size ssa.Value) { + args := []ssa.Value{dst, src, size} // TODO: reuse the slice. + + builder := c.ssaBuilder + memmovePtr := builder.AllocateInstruction(). + AsLoad(c.execCtxPtrValue, + wazevoapi.ExecutionContextOffsetMemmoveAddress.U32(), + ssa.TypeI64, + ).Insert(builder).Return() + builder.AllocateInstruction().AsCallIndirect(memmovePtr, &c.memmoveSig, args).Insert(builder) +} + +func (c *Compiler) reloadAfterCall() { + // Note that when these are not used in the following instructions, they will be optimized out. + // So in any ways, we define them! + + // After calling any function, memory buffer might have changed. So we need to re-defined the variable. + if c.needMemory { + c.reloadMemoryBaseLen() + } + + // Also, any mutable Global can change. + for _, index := range c.mutableGlobalVariablesIndexes { + _ = c.getWasmGlobalValue(index, true) + } +} + +func (c *Compiler) reloadMemoryBaseLen() { + _ = c.getMemoryBaseValue(true) + _ = c.getMemoryLenValue(true) + + // This function being called means that the memory base might have changed. + // Therefore, we need to clear the known safe bounds because we cache the absolute address of the memory access per each base offset. + c.clearSafeBounds() +} + +func (c *Compiler) setWasmGlobalValue(index wasm.Index, v ssa.Value) { + variable := c.globalVariables[index] + opaqueOffset := c.offset.GlobalInstanceOffset(index) + + builder := c.ssaBuilder + if index < c.m.ImportGlobalCount { + loadGlobalInstPtr := builder.AllocateInstruction() + loadGlobalInstPtr.AsLoad(c.moduleCtxPtrValue, uint32(opaqueOffset), ssa.TypeI64) + builder.InsertInstruction(loadGlobalInstPtr) + + store := builder.AllocateInstruction() + store.AsStore(ssa.OpcodeStore, v, loadGlobalInstPtr.Return(), uint32(0)) + builder.InsertInstruction(store) + + } else { + store := builder.AllocateInstruction() + store.AsStore(ssa.OpcodeStore, v, c.moduleCtxPtrValue, uint32(opaqueOffset)) + builder.InsertInstruction(store) + } + + // The value has changed to `v`, so we record it. + builder.DefineVariableInCurrentBB(variable, v) +} + +func (c *Compiler) getWasmGlobalValue(index wasm.Index, forceLoad bool) ssa.Value { + variable := c.globalVariables[index] + typ := c.globalVariablesTypes[index] + opaqueOffset := c.offset.GlobalInstanceOffset(index) + + builder := c.ssaBuilder + if !forceLoad { + if v := builder.FindValueInLinearPath(variable); v.Valid() { + return v + } + } + + var load *ssa.Instruction + if index < c.m.ImportGlobalCount { + loadGlobalInstPtr := builder.AllocateInstruction() + loadGlobalInstPtr.AsLoad(c.moduleCtxPtrValue, uint32(opaqueOffset), ssa.TypeI64) + builder.InsertInstruction(loadGlobalInstPtr) + load = builder.AllocateInstruction(). + AsLoad(loadGlobalInstPtr.Return(), uint32(0), typ) + } else { + load = builder.AllocateInstruction(). + AsLoad(c.moduleCtxPtrValue, uint32(opaqueOffset), typ) + } + + v := load.Insert(builder).Return() + builder.DefineVariableInCurrentBB(variable, v) + return v +} + +const ( + memoryInstanceBufOffset = 0 + memoryInstanceBufSizeOffset = memoryInstanceBufOffset + 8 +) + +func (c *Compiler) getMemoryBaseValue(forceReload bool) ssa.Value { + builder := c.ssaBuilder + variable := c.memoryBaseVariable + if !forceReload { + if v := builder.FindValueInLinearPath(variable); v.Valid() { + return v + } + } + + var ret ssa.Value + if c.offset.LocalMemoryBegin < 0 { + loadMemInstPtr := builder.AllocateInstruction() + loadMemInstPtr.AsLoad(c.moduleCtxPtrValue, c.offset.ImportedMemoryBegin.U32(), ssa.TypeI64) + builder.InsertInstruction(loadMemInstPtr) + memInstPtr := loadMemInstPtr.Return() + + loadBufPtr := builder.AllocateInstruction() + loadBufPtr.AsLoad(memInstPtr, memoryInstanceBufOffset, ssa.TypeI64) + builder.InsertInstruction(loadBufPtr) + ret = loadBufPtr.Return() + } else { + load := builder.AllocateInstruction() + load.AsLoad(c.moduleCtxPtrValue, c.offset.LocalMemoryBase().U32(), ssa.TypeI64) + builder.InsertInstruction(load) + ret = load.Return() + } + + builder.DefineVariableInCurrentBB(variable, ret) + return ret +} + +func (c *Compiler) getMemoryLenValue(forceReload bool) ssa.Value { + variable := c.memoryLenVariable + builder := c.ssaBuilder + if !forceReload { + if v := builder.FindValueInLinearPath(variable); v.Valid() { + return v + } + } + + var ret ssa.Value + if c.offset.LocalMemoryBegin < 0 { + loadMemInstPtr := builder.AllocateInstruction() + loadMemInstPtr.AsLoad(c.moduleCtxPtrValue, c.offset.ImportedMemoryBegin.U32(), ssa.TypeI64) + builder.InsertInstruction(loadMemInstPtr) + memInstPtr := loadMemInstPtr.Return() + + loadBufSizePtr := builder.AllocateInstruction() + loadBufSizePtr.AsLoad(memInstPtr, memoryInstanceBufSizeOffset, ssa.TypeI64) + builder.InsertInstruction(loadBufSizePtr) + + ret = loadBufSizePtr.Return() + } else { + load := builder.AllocateInstruction() + load.AsExtLoad(ssa.OpcodeUload32, c.moduleCtxPtrValue, c.offset.LocalMemoryLen().U32(), true) + builder.InsertInstruction(load) + ret = load.Return() + } + + builder.DefineVariableInCurrentBB(variable, ret) + return ret +} + +func (c *Compiler) insertIcmp(cond ssa.IntegerCmpCond) { + state, builder := c.state(), c.ssaBuilder + y, x := state.pop(), state.pop() + cmp := builder.AllocateInstruction() + cmp.AsIcmp(x, y, cond) + builder.InsertInstruction(cmp) + value := cmp.Return() + state.push(value) +} + +func (c *Compiler) insertFcmp(cond ssa.FloatCmpCond) { + state, builder := c.state(), c.ssaBuilder + y, x := state.pop(), state.pop() + cmp := builder.AllocateInstruction() + cmp.AsFcmp(x, y, cond) + builder.InsertInstruction(cmp) + value := cmp.Return() + state.push(value) +} + +// storeCallerModuleContext stores the current module's moduleContextPtr into execContext.callerModuleContextPtr. +func (c *Compiler) storeCallerModuleContext() { + builder := c.ssaBuilder + execCtx := c.execCtxPtrValue + store := builder.AllocateInstruction() + store.AsStore(ssa.OpcodeStore, + c.moduleCtxPtrValue, execCtx, wazevoapi.ExecutionContextOffsetCallerModuleContextPtr.U32()) + builder.InsertInstruction(store) +} + +func (c *Compiler) readI32u() uint32 { + v, n, err := leb128.LoadUint32(c.wasmFunctionBody[c.loweringState.pc+1:]) + if err != nil { + panic(err) // shouldn't be reached since compilation comes after validation. + } + c.loweringState.pc += int(n) + return v +} + +func (c *Compiler) readI32s() int32 { + v, n, err := leb128.LoadInt32(c.wasmFunctionBody[c.loweringState.pc+1:]) + if err != nil { + panic(err) // shouldn't be reached since compilation comes after validation. + } + c.loweringState.pc += int(n) + return v +} + +func (c *Compiler) readI64s() int64 { + v, n, err := leb128.LoadInt64(c.wasmFunctionBody[c.loweringState.pc+1:]) + if err != nil { + panic(err) // shouldn't be reached since compilation comes after validation. + } + c.loweringState.pc += int(n) + return v +} + +func (c *Compiler) readF32() float32 { + v := math.Float32frombits(binary.LittleEndian.Uint32(c.wasmFunctionBody[c.loweringState.pc+1:])) + c.loweringState.pc += 4 + return v +} + +func (c *Compiler) readF64() float64 { + v := math.Float64frombits(binary.LittleEndian.Uint64(c.wasmFunctionBody[c.loweringState.pc+1:])) + c.loweringState.pc += 8 + return v +} + +// readBlockType reads the block type from the current position of the bytecode reader. +func (c *Compiler) readBlockType() *wasm.FunctionType { + state := c.state() + + c.br.Reset(c.wasmFunctionBody[state.pc+1:]) + bt, num, err := wasm.DecodeBlockType(c.m.TypeSection, c.br, api.CoreFeaturesV2) + if err != nil { + panic(err) // shouldn't be reached since compilation comes after validation. + } + state.pc += int(num) + + return bt +} + +func (c *Compiler) readMemArg() (align, offset uint32) { + state := c.state() + + align, num, err := leb128.LoadUint32(c.wasmFunctionBody[state.pc+1:]) + if err != nil { + panic(fmt.Errorf("read memory align: %v", err)) + } + + state.pc += int(num) + offset, num, err = leb128.LoadUint32(c.wasmFunctionBody[state.pc+1:]) + if err != nil { + panic(fmt.Errorf("read memory offset: %v", err)) + } + + state.pc += int(num) + return align, offset +} + +// insertJumpToBlock inserts a jump instruction to the given block in the current block. +func (c *Compiler) insertJumpToBlock(args []ssa.Value, targetBlk ssa.BasicBlock) { + if targetBlk.ReturnBlock() { + if c.needListener { + c.callListenerAfter() + } + } + + builder := c.ssaBuilder + jmp := builder.AllocateInstruction() + jmp.AsJump(args, targetBlk) + builder.InsertInstruction(jmp) +} + +func (c *Compiler) insertIntegerExtend(signed bool, from, to byte) { + state := c.state() + builder := c.ssaBuilder + v := state.pop() + extend := builder.AllocateInstruction() + if signed { + extend.AsSExtend(v, from, to) + } else { + extend.AsUExtend(v, from, to) + } + builder.InsertInstruction(extend) + value := extend.Return() + state.push(value) +} + +func (c *Compiler) switchTo(originalStackLen int, targetBlk ssa.BasicBlock) { + if targetBlk.Preds() == 0 { + c.loweringState.unreachable = true + } + + // Now we should adjust the stack and start translating the continuation block. + c.loweringState.values = c.loweringState.values[:originalStackLen] + + c.ssaBuilder.SetCurrentBlock(targetBlk) + + // At this point, blocks params consist only of the Wasm-level parameters, + // (since it's added only when we are trying to resolve variable *inside* this block). + for i := 0; i < targetBlk.Params(); i++ { + value := targetBlk.Param(i) + c.loweringState.push(value) + } +} + +// cloneValuesList clones the given values list. +func cloneValuesList(in []ssa.Value) (ret []ssa.Value) { + ret = make([]ssa.Value, len(in)) + for i := range ret { + ret[i] = in[i] + } + return +} + +// results returns the number of results of the current function. +func (c *Compiler) results() int { + return len(c.wasmFunctionTyp.Results) +} + +func (c *Compiler) lowerBrTable(labels []uint32, index ssa.Value) { + state := c.state() + builder := c.ssaBuilder + + f := state.ctrlPeekAt(int(labels[0])) + var numArgs int + if f.isLoop() { + numArgs = len(f.blockType.Params) + } else { + numArgs = len(f.blockType.Results) + } + + targets := make([]ssa.BasicBlock, len(labels)) + + // We need trampoline blocks since depending on the target block structure, we might end up inserting moves before jumps, + // which cannot be done with br_table. Instead, we can do such per-block moves in the trampoline blocks. + // At the linking phase (very end of the backend), we can remove the unnecessary jumps, and therefore no runtime overhead. + currentBlk := builder.CurrentBlock() + for i, l := range labels { + // Args are always on the top of the stack. Note that we should not share the args slice + // among the jump instructions since the args are modified during passes (e.g. redundant phi elimination). + args := c.loweringState.nPeekDup(numArgs) + targetBlk, _ := state.brTargetArgNumFor(l) + trampoline := builder.AllocateBasicBlock() + builder.SetCurrentBlock(trampoline) + c.insertJumpToBlock(args, targetBlk) + targets[i] = trampoline + } + builder.SetCurrentBlock(currentBlk) + + // If the target block has no arguments, we can just jump to the target block. + brTable := builder.AllocateInstruction() + brTable.AsBrTable(index, targets) + builder.InsertInstruction(brTable) + + for _, trampoline := range targets { + builder.Seal(trampoline) + } +} + +func (l *loweringState) brTargetArgNumFor(labelIndex uint32) (targetBlk ssa.BasicBlock, argNum int) { + targetFrame := l.ctrlPeekAt(int(labelIndex)) + if targetFrame.isLoop() { + targetBlk, argNum = targetFrame.blk, len(targetFrame.blockType.Params) + } else { + targetBlk, argNum = targetFrame.followingBlock, len(targetFrame.blockType.Results) + } + return +} + +func (c *Compiler) callListenerBefore() { + c.storeCallerModuleContext() + + builder := c.ssaBuilder + beforeListeners1stElement := builder.AllocateInstruction(). + AsLoad(c.moduleCtxPtrValue, + c.offset.BeforeListenerTrampolines1stElement.U32(), + ssa.TypeI64, + ).Insert(builder).Return() + + beforeListenerPtr := builder.AllocateInstruction(). + AsLoad(beforeListeners1stElement, uint32(c.wasmFunctionTypeIndex)*8 /* 8 bytes per index */, ssa.TypeI64).Insert(builder).Return() + + entry := builder.EntryBlock() + ps := entry.Params() + // TODO: reuse! + args := make([]ssa.Value, ps) + args[0] = c.execCtxPtrValue + args[1] = builder.AllocateInstruction().AsIconst32(c.wasmLocalFunctionIndex).Insert(builder).Return() + for i := 2; i < ps; i++ { + args[i] = entry.Param(i) + } + + beforeSig := c.listenerSignatures[c.wasmFunctionTyp][0] + builder.AllocateInstruction(). + AsCallIndirect(beforeListenerPtr, beforeSig, args). + Insert(builder) +} + +func (c *Compiler) callListenerAfter() { + c.storeCallerModuleContext() + + builder := c.ssaBuilder + afterListeners1stElement := builder.AllocateInstruction(). + AsLoad(c.moduleCtxPtrValue, + c.offset.AfterListenerTrampolines1stElement.U32(), + ssa.TypeI64, + ).Insert(builder).Return() + + afterListenerPtr := builder.AllocateInstruction(). + AsLoad(afterListeners1stElement, + uint32(c.wasmFunctionTypeIndex)*8 /* 8 bytes per index */, ssa.TypeI64). + Insert(builder). + Return() + + afterSig := c.listenerSignatures[c.wasmFunctionTyp][1] + results := c.loweringState.nPeekDup(c.results()) + + // TODO: reuse! + args := make([]ssa.Value, len(results)+2) + args[0] = c.execCtxPtrValue + args[1] = builder.AllocateInstruction().AsIconst32(c.wasmLocalFunctionIndex).Insert(builder).Return() + for i, r := range results { + args[i+2] = r + } + builder.AllocateInstruction(). + AsCallIndirect(afterListenerPtr, afterSig, args). + Insert(builder) +} + +const ( + elementOrDataInstanceLenOffset = 8 + elementOrDataInstanceSize = 24 +) + +// dropInstance inserts instructions to drop the element/data instance specified by the given index. +func (c *Compiler) dropDataOrElementInstance(index uint32, firstItemOffset wazevoapi.Offset) { + builder := c.ssaBuilder + instPtr := c.dataOrElementInstanceAddr(index, firstItemOffset) + + zero := builder.AllocateInstruction().AsIconst64(0).Insert(builder).Return() + + // Clear the instance. + builder.AllocateInstruction().AsStore(ssa.OpcodeStore, zero, instPtr, 0).Insert(builder) + builder.AllocateInstruction().AsStore(ssa.OpcodeStore, zero, instPtr, elementOrDataInstanceLenOffset).Insert(builder) + builder.AllocateInstruction().AsStore(ssa.OpcodeStore, zero, instPtr, elementOrDataInstanceLenOffset+8).Insert(builder) +} + +func (c *Compiler) dataOrElementInstanceAddr(index uint32, firstItemOffset wazevoapi.Offset) ssa.Value { + builder := c.ssaBuilder + + _1stItemPtr := builder. + AllocateInstruction(). + AsLoad(c.moduleCtxPtrValue, firstItemOffset.U32(), ssa.TypeI64). + Insert(builder).Return() + + // Each data/element instance is a slice, so we need to multiply index by 16 to get the offset of the target instance. + index = index * elementOrDataInstanceSize + indexExt := builder.AllocateInstruction().AsIconst64(uint64(index)).Insert(builder).Return() + // Then, add the offset to the address of the instance. + instPtr := builder.AllocateInstruction().AsIadd(_1stItemPtr, indexExt).Insert(builder).Return() + return instPtr +} + +func (c *Compiler) boundsCheckInDataOrElementInstance(instPtr, offsetInInstance, copySize ssa.Value, exitCode wazevoapi.ExitCode) { + builder := c.ssaBuilder + dataInstLen := builder.AllocateInstruction(). + AsLoad(instPtr, elementOrDataInstanceLenOffset, ssa.TypeI64). + Insert(builder).Return() + ceil := builder.AllocateInstruction().AsIadd(offsetInInstance, copySize).Insert(builder).Return() + cmp := builder.AllocateInstruction(). + AsIcmp(dataInstLen, ceil, ssa.IntegerCmpCondUnsignedLessThan). + Insert(builder). + Return() + builder.AllocateInstruction(). + AsExitIfTrueWithCode(c.execCtxPtrValue, cmp, exitCode). + Insert(builder) +} + +func (c *Compiler) boundsCheckInTable(tableIndex uint32, offset, size ssa.Value) (tableInstancePtr ssa.Value) { + builder := c.ssaBuilder + dstCeil := builder.AllocateInstruction().AsIadd(offset, size).Insert(builder).Return() + + // Load the table. + tableInstancePtr = builder.AllocateInstruction(). + AsLoad(c.moduleCtxPtrValue, c.offset.TableOffset(int(tableIndex)).U32(), ssa.TypeI64). + Insert(builder).Return() + + // Load the table's length. + tableLen := builder.AllocateInstruction(). + AsLoad(tableInstancePtr, tableInstanceLenOffset, ssa.TypeI32).Insert(builder).Return() + tableLenExt := builder.AllocateInstruction().AsUExtend(tableLen, 32, 64).Insert(builder).Return() + + // Compare the length and the target, and trap if out of bounds. + checkOOB := builder.AllocateInstruction() + checkOOB.AsIcmp(tableLenExt, dstCeil, ssa.IntegerCmpCondUnsignedLessThan) + builder.InsertInstruction(checkOOB) + exitIfOOB := builder.AllocateInstruction() + exitIfOOB.AsExitIfTrueWithCode(c.execCtxPtrValue, checkOOB.Return(), wazevoapi.ExitCodeTableOutOfBounds) + builder.InsertInstruction(exitIfOOB) + return +} + +func (c *Compiler) loadTableBaseAddr(tableInstancePtr ssa.Value) ssa.Value { + builder := c.ssaBuilder + loadTableBaseAddress := builder. + AllocateInstruction(). + AsLoad(tableInstancePtr, tableInstanceBaseAddressOffset, ssa.TypeI64). + Insert(builder) + return loadTableBaseAddress.Return() +} + +func (c *Compiler) boundsCheckInMemory(memLen, offset, size ssa.Value) { + builder := c.ssaBuilder + ceil := builder.AllocateInstruction().AsIadd(offset, size).Insert(builder).Return() + cmp := builder.AllocateInstruction(). + AsIcmp(memLen, ceil, ssa.IntegerCmpCondUnsignedLessThan). + Insert(builder). + Return() + builder.AllocateInstruction(). + AsExitIfTrueWithCode(c.execCtxPtrValue, cmp, wazevoapi.ExitCodeMemoryOutOfBounds). + Insert(builder) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/frontend/misc.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/frontend/misc.go new file mode 100644 index 000000000..2db2b892c --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/frontend/misc.go @@ -0,0 +1,10 @@ +package frontend + +import ( + "github.com/tetratelabs/wazero/internal/engine/wazevo/ssa" + "github.com/tetratelabs/wazero/internal/wasm" +) + +func FunctionIndexToFuncRef(idx wasm.Index) ssa.FuncRef { + return ssa.FuncRef(idx) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/hostmodule.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/hostmodule.go new file mode 100644 index 000000000..3ce9850f4 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/hostmodule.go @@ -0,0 +1,83 @@ +package wazevo + +import ( + "encoding/binary" + "reflect" + "unsafe" + + "github.com/tetratelabs/wazero/experimental" + "github.com/tetratelabs/wazero/internal/wasm" +) + +func buildHostModuleOpaque(m *wasm.Module, listeners []experimental.FunctionListener) moduleContextOpaque { + size := len(m.CodeSection)*16 + 32 + ret := make(moduleContextOpaque, size) + + binary.LittleEndian.PutUint64(ret[0:], uint64(uintptr(unsafe.Pointer(m)))) + + if len(listeners) > 0 { + sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&listeners)) + binary.LittleEndian.PutUint64(ret[8:], uint64(sliceHeader.Data)) + binary.LittleEndian.PutUint64(ret[16:], uint64(sliceHeader.Len)) + binary.LittleEndian.PutUint64(ret[24:], uint64(sliceHeader.Cap)) + } + + offset := 32 + for i := range m.CodeSection { + goFn := m.CodeSection[i].GoFunc + writeIface(goFn, ret[offset:]) + offset += 16 + } + return ret +} + +func hostModuleFromOpaque(opaqueBegin uintptr) *wasm.Module { + var opaqueViewOverSlice []byte + sh := (*reflect.SliceHeader)(unsafe.Pointer(&opaqueViewOverSlice)) + sh.Data = opaqueBegin + sh.Len = 32 + sh.Cap = 32 + return *(**wasm.Module)(unsafe.Pointer(&opaqueViewOverSlice[0])) +} + +func hostModuleListenersSliceFromOpaque(opaqueBegin uintptr) []experimental.FunctionListener { + var opaqueViewOverSlice []byte + sh := (*reflect.SliceHeader)(unsafe.Pointer(&opaqueViewOverSlice)) + sh.Data = opaqueBegin + sh.Len = 32 + sh.Cap = 32 + + b := binary.LittleEndian.Uint64(opaqueViewOverSlice[8:]) + l := binary.LittleEndian.Uint64(opaqueViewOverSlice[16:]) + c := binary.LittleEndian.Uint64(opaqueViewOverSlice[24:]) + var ret []experimental.FunctionListener + sh = (*reflect.SliceHeader)(unsafe.Pointer(&ret)) + sh.Data = uintptr(b) + sh.Len = int(l) + sh.Cap = int(c) + return ret +} + +func hostModuleGoFuncFromOpaque[T any](index int, opaqueBegin uintptr) T { + offset := uintptr(index*16) + 32 + ptr := opaqueBegin + offset + + var opaqueViewOverFunction []byte + sh := (*reflect.SliceHeader)(unsafe.Pointer(&opaqueViewOverFunction)) + sh.Data = ptr + sh.Len = 16 + sh.Cap = 16 + return readIface(opaqueViewOverFunction).(T) +} + +func writeIface(goFn interface{}, buf []byte) { + goFnIface := *(*[2]uint64)(unsafe.Pointer(&goFn)) + binary.LittleEndian.PutUint64(buf, goFnIface[0]) + binary.LittleEndian.PutUint64(buf[8:], goFnIface[1]) +} + +func readIface(buf []byte) interface{} { + b := binary.LittleEndian.Uint64(buf) + s := binary.LittleEndian.Uint64(buf[8:]) + return *(*interface{})(unsafe.Pointer(&[2]uint64{b, s})) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/machine.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/machine.go new file mode 100644 index 000000000..0ad347b56 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/machine.go @@ -0,0 +1,35 @@ +package wazevo + +import ( + "runtime" + + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend" + "github.com/tetratelabs/wazero/internal/engine/wazevo/backend/isa/arm64" +) + +func newMachine() backend.Machine { + switch runtime.GOARCH { + case "arm64": + return arm64.NewBackend() + default: + panic("unsupported architecture") + } +} + +func unwindStack(sp, top uintptr, returnAddresses []uintptr) []uintptr { + switch runtime.GOARCH { + case "arm64": + return arm64.UnwindStack(sp, top, returnAddresses) + default: + panic("unsupported architecture") + } +} + +func goCallStackView(stackPointerBeforeGoCall *uint64) []uint64 { + switch runtime.GOARCH { + case "arm64": + return arm64.GoCallStackView(stackPointerBeforeGoCall) + default: + panic("unsupported architecture") + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/memmove.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/memmove.go new file mode 100644 index 000000000..889922107 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/memmove.go @@ -0,0 +1,11 @@ +package wazevo + +import ( + "reflect" + "unsafe" +) + +//go:linkname memmove runtime.memmove +func memmove(_, _ unsafe.Pointer, _ uintptr) + +var memmovPtr = reflect.ValueOf(memmove).Pointer() diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/module_engine.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/module_engine.go new file mode 100644 index 000000000..3a61e3310 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/module_engine.go @@ -0,0 +1,330 @@ +package wazevo + +import ( + "encoding/binary" + "unsafe" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/experimental" + "github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi" + "github.com/tetratelabs/wazero/internal/wasm" + "github.com/tetratelabs/wazero/internal/wasmruntime" +) + +type ( + // moduleEngine implements wasm.ModuleEngine. + moduleEngine struct { + // opaquePtr equals &opaque[0]. + opaquePtr *byte + parent *compiledModule + module *wasm.ModuleInstance + opaque moduleContextOpaque + localFunctionInstances []*functionInstance + importedFunctions []importedFunction + listeners []experimental.FunctionListener + } + + functionInstance struct { + executable *byte + moduleContextOpaquePtr *byte + typeID wasm.FunctionTypeID + indexInModule wasm.Index + } + + importedFunction struct { + me *moduleEngine + indexInModule wasm.Index + } + + // moduleContextOpaque is the opaque byte slice of Module instance specific contents whose size + // is only Wasm-compile-time known, hence dynamic. Its contents are basically the pointers to the module instance, + // specific objects as well as functions. This is sometimes called "VMContext" in other Wasm runtimes. + // + // Internally, the buffer is structured as follows: + // + // type moduleContextOpaque struct { + // moduleInstance *wasm.ModuleInstance + // localMemoryBufferPtr *byte (optional) + // localMemoryLength uint64 (optional) + // importedMemoryInstance *wasm.MemoryInstance (optional) + // importedMemoryOwnerOpaqueCtx *byte (optional) + // importedFunctions [# of importedFunctions]functionInstance + // importedGlobals []ImportedGlobal (optional) + // localGlobals []Global (optional) + // typeIDsBegin &wasm.ModuleInstance.TypeIDs[0] (optional) + // tables []*wasm.TableInstance (optional) + // beforeListenerTrampolines1stElement **byte (optional) + // afterListenerTrampolines1stElement **byte (optional) + // dataInstances1stElement []wasm.DataInstance (optional) + // elementInstances1stElement []wasm.ElementInstance (optional) + // } + // + // type ImportedGlobal struct { + // *Global + // _ uint64 // padding + // } + // + // type Global struct { + // Val, ValHi uint64 + // } + // + // See wazevoapi.NewModuleContextOffsetData for the details of the offsets. + // + // Note that for host modules, the structure is entirely different. See buildHostModuleOpaque. + moduleContextOpaque []byte +) + +func putLocalMemory(opaque []byte, offset wazevoapi.Offset, mem *wasm.MemoryInstance) { + s := uint64(len(mem.Buffer)) + var b uint64 + if len(mem.Buffer) > 0 { + b = uint64(uintptr(unsafe.Pointer(&mem.Buffer[0]))) + } + binary.LittleEndian.PutUint64(opaque[offset:], b) + binary.LittleEndian.PutUint64(opaque[offset+8:], s) +} + +func (m *moduleEngine) setupOpaque() { + inst := m.module + offsets := &m.parent.offsets + opaque := m.opaque + + binary.LittleEndian.PutUint64(opaque[offsets.ModuleInstanceOffset:], + uint64(uintptr(unsafe.Pointer(m.module))), + ) + + if lm := offsets.LocalMemoryBegin; lm >= 0 { + putLocalMemory(opaque, lm, inst.MemoryInstance) + } + + // Note: imported memory is resolved in ResolveImportedFunction. + + // Note: imported functions are resolved in ResolveImportedFunction. + + if globalOffset := offsets.GlobalsBegin; globalOffset >= 0 { + for i, g := range inst.Globals { + if i < int(inst.Source.ImportGlobalCount) { + importedME := g.Me.(*moduleEngine) + offset := importedME.parent.offsets.GlobalInstanceOffset(g.Index) + importedMEOpaque := importedME.opaque + binary.LittleEndian.PutUint64(opaque[globalOffset:], + uint64(uintptr(unsafe.Pointer(&importedMEOpaque[offset])))) + } else { + binary.LittleEndian.PutUint64(opaque[globalOffset:], g.Val) + binary.LittleEndian.PutUint64(opaque[globalOffset+8:], g.ValHi) + } + globalOffset += 16 + } + } + + if tableOffset := offsets.TablesBegin; tableOffset >= 0 { + // First we write the first element's address of typeIDs. + if len(inst.TypeIDs) > 0 { + binary.LittleEndian.PutUint64(opaque[offsets.TypeIDs1stElement:], uint64(uintptr(unsafe.Pointer(&inst.TypeIDs[0])))) + } + + // Then we write the table addresses. + for _, table := range inst.Tables { + binary.LittleEndian.PutUint64(opaque[tableOffset:], uint64(uintptr(unsafe.Pointer(table)))) + tableOffset += 8 + } + } + + if beforeListenerOffset := offsets.BeforeListenerTrampolines1stElement; beforeListenerOffset >= 0 { + binary.LittleEndian.PutUint64(opaque[beforeListenerOffset:], uint64(uintptr(unsafe.Pointer(&m.parent.listenerBeforeTrampolines[0])))) + } + if afterListenerOffset := offsets.AfterListenerTrampolines1stElement; afterListenerOffset >= 0 { + binary.LittleEndian.PutUint64(opaque[afterListenerOffset:], uint64(uintptr(unsafe.Pointer(&m.parent.listenerAfterTrampolines[0])))) + } + if len(inst.DataInstances) > 0 { + binary.LittleEndian.PutUint64(opaque[offsets.DataInstances1stElement:], uint64(uintptr(unsafe.Pointer(&inst.DataInstances[0])))) + } + if len(inst.ElementInstances) > 0 { + binary.LittleEndian.PutUint64(opaque[offsets.ElementInstances1stElement:], uint64(uintptr(unsafe.Pointer(&inst.ElementInstances[0])))) + } +} + +// NewFunction implements wasm.ModuleEngine. +func (m *moduleEngine) NewFunction(index wasm.Index) api.Function { + if wazevoapi.PrintMachineCodeHexPerFunctionDisassemblable { + panic("When PrintMachineCodeHexPerFunctionDisassemblable enabled, functions must not be called") + } + + localIndex := index + if importedFnCount := m.module.Source.ImportFunctionCount; index < importedFnCount { + imported := &m.importedFunctions[index] + return imported.me.NewFunction(imported.indexInModule) + } else { + localIndex -= importedFnCount + } + + src := m.module.Source + typIndex := src.FunctionSection[localIndex] + typ := src.TypeSection[typIndex] + sizeOfParamResultSlice := typ.ResultNumInUint64 + if ps := typ.ParamNumInUint64; ps > sizeOfParamResultSlice { + sizeOfParamResultSlice = ps + } + p := m.parent + offset := p.functionOffsets[localIndex] + + ce := &callEngine{ + indexInModule: index, + executable: &p.executable[offset], + parent: m, + preambleExecutable: &m.parent.entryPreambles[typIndex][0], + sizeOfParamResultSlice: sizeOfParamResultSlice, + requiredParams: typ.ParamNumInUint64, + numberOfResults: typ.ResultNumInUint64, + } + + ce.execCtx.memoryGrowTrampolineAddress = &m.parent.sharedFunctions.memoryGrowExecutable[0] + ce.execCtx.stackGrowCallTrampolineAddress = &m.parent.sharedFunctions.stackGrowExecutable[0] + ce.execCtx.checkModuleExitCodeTrampolineAddress = &m.parent.sharedFunctions.checkModuleExitCode[0] + ce.execCtx.tableGrowTrampolineAddress = &m.parent.sharedFunctions.tableGrowExecutable[0] + ce.execCtx.refFuncTrampolineAddress = &m.parent.sharedFunctions.refFuncExecutable[0] + ce.execCtx.memmoveAddress = memmovPtr + ce.init() + return ce +} + +// GetGlobalValue implements the same method as documented on wasm.ModuleEngine. +func (m *moduleEngine) GetGlobalValue(i wasm.Index) (lo, hi uint64) { + offset := m.parent.offsets.GlobalInstanceOffset(i) + buf := m.opaque[offset:] + if i < m.module.Source.ImportGlobalCount { + panic("GetGlobalValue should not be called for imported globals") + } + return binary.LittleEndian.Uint64(buf), binary.LittleEndian.Uint64(buf[8:]) +} + +// OwnsGlobals implements the same method as documented on wasm.ModuleEngine. +func (m *moduleEngine) OwnsGlobals() bool { return true } + +// ResolveImportedFunction implements wasm.ModuleEngine. +func (m *moduleEngine) ResolveImportedFunction(index, indexInImportedModule wasm.Index, importedModuleEngine wasm.ModuleEngine) { + executableOffset, moduleCtxOffset, typeIDOffset := m.parent.offsets.ImportedFunctionOffset(index) + importedME := importedModuleEngine.(*moduleEngine) + + if int(indexInImportedModule) >= len(importedME.importedFunctions) { + indexInImportedModule -= wasm.Index(len(importedME.importedFunctions)) + } else { + imported := &importedME.importedFunctions[indexInImportedModule] + m.ResolveImportedFunction(index, imported.indexInModule, imported.me) + return // Recursively resolve the imported function. + } + + offset := importedME.parent.functionOffsets[indexInImportedModule] + typeID := getTypeIDOf(indexInImportedModule, importedME.module) + executable := &importedME.parent.executable[offset] + // Write functionInstance. + binary.LittleEndian.PutUint64(m.opaque[executableOffset:], uint64(uintptr(unsafe.Pointer(executable)))) + binary.LittleEndian.PutUint64(m.opaque[moduleCtxOffset:], uint64(uintptr(unsafe.Pointer(importedME.opaquePtr)))) + binary.LittleEndian.PutUint64(m.opaque[typeIDOffset:], uint64(typeID)) + + // Write importedFunction so that it can be used by NewFunction. + m.importedFunctions[index] = importedFunction{me: importedME, indexInModule: indexInImportedModule} +} + +func getTypeIDOf(funcIndex wasm.Index, m *wasm.ModuleInstance) wasm.FunctionTypeID { + source := m.Source + + var typeIndex wasm.Index + if funcIndex >= source.ImportFunctionCount { + funcIndex -= source.ImportFunctionCount + typeIndex = source.FunctionSection[funcIndex] + } else { + var cnt wasm.Index + for i := range source.ImportSection { + if source.ImportSection[i].Type == wasm.ExternTypeFunc { + if cnt == funcIndex { + typeIndex = source.ImportSection[i].DescFunc + break + } + cnt++ + } + } + } + return m.TypeIDs[typeIndex] +} + +// ResolveImportedMemory implements wasm.ModuleEngine. +func (m *moduleEngine) ResolveImportedMemory(importedModuleEngine wasm.ModuleEngine) { + importedME := importedModuleEngine.(*moduleEngine) + inst := importedME.module + + var memInstPtr uint64 + var memOwnerOpaquePtr uint64 + if offs := importedME.parent.offsets; offs.ImportedMemoryBegin >= 0 { + offset := offs.ImportedMemoryBegin + memInstPtr = binary.LittleEndian.Uint64(importedME.opaque[offset:]) + memOwnerOpaquePtr = binary.LittleEndian.Uint64(importedME.opaque[offset+8:]) + } else { + memInstPtr = uint64(uintptr(unsafe.Pointer(inst.MemoryInstance))) + memOwnerOpaquePtr = uint64(uintptr(unsafe.Pointer(importedME.opaquePtr))) + } + offset := m.parent.offsets.ImportedMemoryBegin + binary.LittleEndian.PutUint64(m.opaque[offset:], memInstPtr) + binary.LittleEndian.PutUint64(m.opaque[offset+8:], memOwnerOpaquePtr) +} + +// DoneInstantiation implements wasm.ModuleEngine. +func (m *moduleEngine) DoneInstantiation() { + if !m.module.Source.IsHostModule { + m.setupOpaque() + } +} + +// FunctionInstanceReference implements wasm.ModuleEngine. +func (m *moduleEngine) FunctionInstanceReference(funcIndex wasm.Index) wasm.Reference { + if funcIndex < m.module.Source.ImportFunctionCount { + begin, _, _ := m.parent.offsets.ImportedFunctionOffset(funcIndex) + return uintptr(unsafe.Pointer(&m.opaque[begin])) + } + localIndex := funcIndex - m.module.Source.ImportFunctionCount + p := m.parent + executable := &p.executable[p.functionOffsets[localIndex]] + typeID := m.module.TypeIDs[m.module.Source.FunctionSection[localIndex]] + + lf := &functionInstance{ + executable: executable, + moduleContextOpaquePtr: m.opaquePtr, + typeID: typeID, + indexInModule: funcIndex, + } + m.localFunctionInstances = append(m.localFunctionInstances, lf) + return uintptr(unsafe.Pointer(lf)) +} + +// LookupFunction implements wasm.ModuleEngine. +func (m *moduleEngine) LookupFunction(t *wasm.TableInstance, typeId wasm.FunctionTypeID, tableOffset wasm.Index) (*wasm.ModuleInstance, wasm.Index) { + if tableOffset >= uint32(len(t.References)) || t.Type != wasm.RefTypeFuncref { + panic(wasmruntime.ErrRuntimeInvalidTableAccess) + } + rawPtr := t.References[tableOffset] + if rawPtr == 0 { + panic(wasmruntime.ErrRuntimeInvalidTableAccess) + } + + tf := functionFromUintptr(rawPtr) + if tf.typeID != typeId { + panic(wasmruntime.ErrRuntimeIndirectCallTypeMismatch) + } + return moduleInstanceFromOpaquePtr(tf.moduleContextOpaquePtr), tf.indexInModule +} + +// functionFromUintptr resurrects the original *function from the given uintptr +// which comes from either funcref table or OpcodeRefFunc instruction. +func functionFromUintptr(ptr uintptr) *functionInstance { + // Wraps ptrs as the double pointer in order to avoid the unsafe access as detected by race detector. + // + // For example, if we have (*function)(unsafe.Pointer(ptr)) instead, then the race detector's "checkptr" + // subroutine wanrs as "checkptr: pointer arithmetic result points to invalid allocation" + // https://github.com/golang/go/blob/1ce7fcf139417d618c2730010ede2afb41664211/src/runtime/checkptr.go#L69 + var wrapped *uintptr = &ptr + return *(**functionInstance)(unsafe.Pointer(wrapped)) +} + +func moduleInstanceFromOpaquePtr(ptr *byte) *wasm.ModuleInstance { + return *(**wasm.ModuleInstance)(unsafe.Pointer(ptr)) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/basic_block.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/basic_block.go new file mode 100644 index 000000000..b85d9d267 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/basic_block.go @@ -0,0 +1,390 @@ +package ssa + +import ( + "fmt" + "strconv" + "strings" +) + +// BasicBlock represents the Basic Block of an SSA function. +// Each BasicBlock always ends with branching instructions (e.g. Branch, Return, etc.), +// and at most two branches are allowed. If there's two branches, these two are placed together at the end of the block. +// In other words, there's no branching instruction in the middle of the block. +// +// Note: we use the "block argument" variant of SSA, instead of PHI functions. See the package level doc comments. +// +// Note: we use "parameter/param" as a placeholder which represents a variant of PHI, and "argument/arg" as an actual +// Value passed to that "parameter/param". +type BasicBlock interface { + // ID returns the unique ID of this block. + ID() BasicBlockID + + // Name returns the unique string ID of this block. e.g. blk0, blk1, ... + Name() string + + // AddParam adds the parameter to the block whose type specified by `t`. + AddParam(b Builder, t Type) Value + + // Params returns the number of parameters to this block. + Params() int + + // Param returns (Variable, Value) which corresponds to the i-th parameter of this block. + // The returned Value is the definition of the param in this block. + Param(i int) Value + + // InsertInstruction inserts an instruction that implements Value into the tail of this block. + InsertInstruction(raw *Instruction) + + // Root returns the root instruction of this block. + Root() *Instruction + + // Tail returns the tail instruction of this block. + Tail() *Instruction + + // EntryBlock returns true if this block represents the function entry. + EntryBlock() bool + + // ReturnBlock returns ture if this block represents the function return. + ReturnBlock() bool + + // FormatHeader returns the debug string of this block, not including instruction. + FormatHeader(b Builder) string + + // Valid is true if this block is still valid even after optimizations. + Valid() bool + + // BeginPredIterator returns the first predecessor of this block. + BeginPredIterator() BasicBlock + + // NextPredIterator returns the next predecessor of this block. + NextPredIterator() BasicBlock + + // Preds returns the number of predecessors of this block. + Preds() int + + // Pred returns the i-th predecessor of this block. + Pred(i int) BasicBlock + + // Succs returns the number of successors of this block. + Succs() int + + // Succ returns the i-th successor of this block. + Succ(i int) BasicBlock + + // LoopHeader returns true if this block is a loop header. + LoopHeader() bool + + // LoopNestingForestChildren returns the children of this block in the loop nesting forest. + LoopNestingForestChildren() []BasicBlock +} + +type ( + // basicBlock is a basic block in a SSA-transformed function. + basicBlock struct { + id BasicBlockID + rootInstr, currentInstr *Instruction + params []blockParam + predIter int + preds []basicBlockPredecessorInfo + success []*basicBlock + // singlePred is the alias to preds[0] for fast lookup, and only set after Seal is called. + singlePred *basicBlock + // lastDefinitions maps Variable to its last definition in this block. + lastDefinitions map[Variable]Value + // unknownsValues are used in builder.findValue. The usage is well-described in the paper. + unknownValues map[Variable]Value + // invalid is true if this block is made invalid during optimizations. + invalid bool + // sealed is true if this is sealed (all the predecessors are known). + sealed bool + // loopHeader is true if this block is a loop header: + // + // > A loop header (sometimes called the entry point of the loop) is a dominator that is the target + // > of a loop-forming back edge. The loop header dominates all blocks in the loop body. + // > A block may be a loop header for more than one loop. A loop may have multiple entry points, + // > in which case it has no "loop header". + // + // See https://en.wikipedia.org/wiki/Control-flow_graph for more details. + // + // This is modified during the subPassLoopDetection pass. + loopHeader bool + + // loopNestingForestChildren holds the children of this block in the loop nesting forest. + // Non-empty if and only if this block is a loop header (i.e. loopHeader=true) + loopNestingForestChildren []BasicBlock + + // reversePostOrder is used to sort all the blocks in the function in reverse post order. + // This is used in builder.LayoutBlocks. + reversePostOrder int + + // child and sibling are the ones in the dominator tree. + child, sibling *basicBlock + } + // BasicBlockID is the unique ID of a basicBlock. + BasicBlockID uint32 + + // blockParam implements Value and represents a parameter to a basicBlock. + blockParam struct { + // value is the Value that corresponds to the parameter in this block, + // and can be considered as an output of PHI instruction in traditional SSA. + value Value + // typ is the type of the parameter. + typ Type + } +) + +const basicBlockIDReturnBlock = 0xffffffff + +// Name implements BasicBlock.Name. +func (bb *basicBlock) Name() string { + if bb.id == basicBlockIDReturnBlock { + return "blk_ret" + } else { + return fmt.Sprintf("blk%d", bb.id) + } +} + +// String implements fmt.Stringer for debugging. +func (bid BasicBlockID) String() string { + if bid == basicBlockIDReturnBlock { + return "blk_ret" + } else { + return fmt.Sprintf("blk%d", bid) + } +} + +// ID implements BasicBlock.ID. +func (bb *basicBlock) ID() BasicBlockID { + return bb.id +} + +// basicBlockPredecessorInfo is the information of a predecessor of a basicBlock. +// predecessor is determined by a pair of block and the branch instruction used to jump to the successor. +type basicBlockPredecessorInfo struct { + blk *basicBlock + branch *Instruction +} + +// EntryBlock implements BasicBlock.EntryBlock. +func (bb *basicBlock) EntryBlock() bool { + return bb.id == 0 +} + +// ReturnBlock implements BasicBlock.ReturnBlock. +func (bb *basicBlock) ReturnBlock() bool { + return bb.id == basicBlockIDReturnBlock +} + +// AddParam implements BasicBlock.AddParam. +func (bb *basicBlock) AddParam(b Builder, typ Type) Value { + paramValue := b.allocateValue(typ) + bb.params = append(bb.params, blockParam{typ: typ, value: paramValue}) + return paramValue +} + +// addParamOn adds a parameter to this block whose value is already allocated. +func (bb *basicBlock) addParamOn(typ Type, value Value) { + bb.params = append(bb.params, blockParam{typ: typ, value: value}) +} + +// Params implements BasicBlock.Params. +func (bb *basicBlock) Params() int { + return len(bb.params) +} + +// Param implements BasicBlock.Param. +func (bb *basicBlock) Param(i int) Value { + p := &bb.params[i] + return p.value +} + +// Valid implements BasicBlock.Valid. +func (bb *basicBlock) Valid() bool { + return !bb.invalid +} + +// InsertInstruction implements BasicBlock.InsertInstruction. +func (bb *basicBlock) InsertInstruction(next *Instruction) { + current := bb.currentInstr + if current != nil { + current.next = next + next.prev = current + } else { + bb.rootInstr = next + } + bb.currentInstr = next + + switch next.opcode { + case OpcodeJump, OpcodeBrz, OpcodeBrnz: + target := next.blk.(*basicBlock) + target.addPred(bb, next) + case OpcodeBrTable: + for _, _target := range next.targets { + target := _target.(*basicBlock) + target.addPred(bb, next) + } + } +} + +// NumPreds implements BasicBlock.NumPreds. +func (bb *basicBlock) NumPreds() int { + return len(bb.preds) +} + +// BeginPredIterator implements BasicBlock.BeginPredIterator. +func (bb *basicBlock) BeginPredIterator() BasicBlock { + bb.predIter = 0 + return bb.NextPredIterator() +} + +// NextPredIterator implements BasicBlock.NextPredIterator. +func (bb *basicBlock) NextPredIterator() BasicBlock { + if bb.predIter >= len(bb.preds) { + return nil + } + pred := bb.preds[bb.predIter].blk + bb.predIter++ + return pred +} + +// Preds implements BasicBlock.Preds. +func (bb *basicBlock) Preds() int { + return len(bb.preds) +} + +// Pred implements BasicBlock.Pred. +func (bb *basicBlock) Pred(i int) BasicBlock { + return bb.preds[i].blk +} + +// Succs implements BasicBlock.Succs. +func (bb *basicBlock) Succs() int { + return len(bb.success) +} + +// Succ implements BasicBlock.Succ. +func (bb *basicBlock) Succ(i int) BasicBlock { + return bb.success[i] +} + +// Root implements BasicBlock.Root. +func (bb *basicBlock) Root() *Instruction { + return bb.rootInstr +} + +// Tail implements BasicBlock.Tail. +func (bb *basicBlock) Tail() *Instruction { + return bb.currentInstr +} + +// reset resets the basicBlock to its initial state so that it can be reused for another function. +func resetBasicBlock(bb *basicBlock) { + bb.params = bb.params[:0] + bb.rootInstr, bb.currentInstr = nil, nil + bb.preds = bb.preds[:0] + bb.success = bb.success[:0] + bb.invalid, bb.sealed = false, false + bb.singlePred = nil + bb.unknownValues = make(map[Variable]Value) + bb.lastDefinitions = make(map[Variable]Value) + bb.reversePostOrder = -1 + bb.loopNestingForestChildren = bb.loopNestingForestChildren[:0] + bb.loopHeader = false + bb.sibling = nil + bb.child = nil +} + +// addPred adds a predecessor to this block specified by the branch instruction. +func (bb *basicBlock) addPred(blk BasicBlock, branch *Instruction) { + if bb.sealed { + panic("BUG: trying to add predecessor to a sealed block: " + bb.Name()) + } + + pred := blk.(*basicBlock) + for i := range bb.preds { + existingPred := &bb.preds[i] + if existingPred.blk == pred && existingPred.branch != branch { + // If the target is already added, then this must come from the same BrTable, + // otherwise such redundant branch should be eliminated by the frontend. (which should be simpler). + panic(fmt.Sprintf("BUG: redundant non BrTable jumps in %s whose targes are the same", bb.Name())) + } + } + + bb.preds = append(bb.preds, basicBlockPredecessorInfo{ + blk: pred, + branch: branch, + }) + + pred.success = append(pred.success, bb) +} + +// FormatHeader implements BasicBlock.FormatHeader. +func (bb *basicBlock) FormatHeader(b Builder) string { + ps := make([]string, len(bb.params)) + for i, p := range bb.params { + ps[i] = p.value.formatWithType(b) + } + + if len(bb.preds) > 0 { + preds := make([]string, 0, len(bb.preds)) + for _, pred := range bb.preds { + if pred.blk.invalid { + continue + } + preds = append(preds, fmt.Sprintf("blk%d", pred.blk.id)) + + } + return fmt.Sprintf("blk%d: (%s) <-- (%s)", + bb.id, strings.Join(ps, ","), strings.Join(preds, ",")) + } else { + return fmt.Sprintf("blk%d: (%s)", bb.id, strings.Join(ps, ", ")) + } +} + +// validates validates the basicBlock for debugging purpose. +func (bb *basicBlock) validate(b *builder) { + if bb.invalid { + panic("BUG: trying to validate an invalid block: " + bb.Name()) + } + if len(bb.preds) > 0 { + for _, pred := range bb.preds { + if pred.branch.opcode != OpcodeBrTable { + if target := pred.branch.blk; target != bb { + panic(fmt.Sprintf("BUG: '%s' is not branch to %s, but to %s", + pred.branch.Format(b), bb.Name(), target.Name())) + } + } + + var exp int + if bb.ReturnBlock() { + exp = len(b.currentSignature.Results) + } else { + exp = len(bb.params) + } + + if len(pred.branch.vs) != exp { + panic(fmt.Sprintf( + "BUG: len(argument at %s) != len(params at %s): %d != %d: %s", + pred.blk.Name(), bb.Name(), + len(pred.branch.vs), len(bb.params), pred.branch.Format(b), + )) + } + + } + } +} + +// String implements fmt.Stringer for debugging purpose only. +func (bb *basicBlock) String() string { + return strconv.Itoa(int(bb.id)) +} + +// LoopNestingForestChildren implements BasicBlock.LoopNestingForestChildren. +func (bb *basicBlock) LoopNestingForestChildren() []BasicBlock { + return bb.loopNestingForestChildren +} + +// LoopHeader implements BasicBlock.LoopHeader. +func (bb *basicBlock) LoopHeader() bool { + return bb.loopHeader +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/builder.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/builder.go new file mode 100644 index 000000000..90a83853d --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/builder.go @@ -0,0 +1,1066 @@ +package ssa + +import ( + "fmt" + "sort" + "strings" + + "github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi" +) + +// Builder is used to builds SSA consisting of Basic Blocks per function. +type Builder interface { + // Init must be called to reuse this builder for the next function. + Init(typ *Signature) + + // Signature returns the Signature of the currently-compiled function. + Signature() *Signature + + // BlockIDMax returns the maximum value of BasicBlocksID existing in the currently-compiled function. + BlockIDMax() BasicBlockID + + // AllocateBasicBlock creates a basic block in SSA function. + AllocateBasicBlock() BasicBlock + + // CurrentBlock returns the currently handled BasicBlock which is set by the latest call to SetCurrentBlock. + CurrentBlock() BasicBlock + + // EntryBlock returns the entry BasicBlock of the currently-compiled function. + EntryBlock() BasicBlock + + // SetCurrentBlock sets the instruction insertion target to the BasicBlock `b`. + SetCurrentBlock(b BasicBlock) + + // DeclareVariable declares a Variable of the given Type. + DeclareVariable(Type) Variable + + // DefineVariable defines a variable in the `block` with value. + // The defining instruction will be inserted into the `block`. + DefineVariable(variable Variable, value Value, block BasicBlock) + + // DefineVariableInCurrentBB is the same as DefineVariable except the definition is + // inserted into the current BasicBlock. Alias to DefineVariable(x, y, CurrentBlock()). + DefineVariableInCurrentBB(variable Variable, value Value) + + // AllocateInstruction returns a new Instruction. + AllocateInstruction() *Instruction + + // InsertInstruction executes BasicBlock.InsertInstruction for the currently handled basic block. + InsertInstruction(raw *Instruction) + + // allocateValue allocates an unused Value. + allocateValue(typ Type) Value + + // MustFindValue searches the latest definition of the given Variable and returns the result. + MustFindValue(variable Variable) Value + + // FindValueInLinearPath tries to find the latest definition of the given Variable in the linear path to the current BasicBlock. + // If it cannot find the definition, or it's not sealed yet, it returns ValueInvalid. + FindValueInLinearPath(variable Variable) Value + + // Seal declares that we've known all the predecessors to this block and were added via AddPred. + // After calling this, AddPred will be forbidden. + Seal(blk BasicBlock) + + // AnnotateValue is for debugging purpose. + AnnotateValue(value Value, annotation string) + + // DeclareSignature appends the *Signature to be referenced by various instructions (e.g. OpcodeCall). + DeclareSignature(signature *Signature) + + // Signatures returns the slice of declared Signatures. + Signatures() []*Signature + + // ResolveSignature returns the Signature which corresponds to SignatureID. + ResolveSignature(id SignatureID) *Signature + + // RunPasses runs various passes on the constructed SSA function. + RunPasses() + + // Format returns the debugging string of the SSA function. + Format() string + + // BlockIteratorBegin initializes the state to iterate over all the valid BasicBlock(s) compiled. + // Combined with BlockIteratorNext, we can use this like: + // + // for blk := builder.BlockIteratorBegin(); blk != nil; blk = builder.BlockIteratorNext() { + // // ... + // } + // + // The returned blocks are ordered in the order of AllocateBasicBlock being called. + BlockIteratorBegin() BasicBlock + + // BlockIteratorNext advances the state for iteration initialized by BlockIteratorBegin. + // Returns nil if there's no unseen BasicBlock. + BlockIteratorNext() BasicBlock + + // ValueRefCounts returns the map of ValueID to its reference count. + // The returned slice must not be modified. + ValueRefCounts() []int + + // LayoutBlocks layouts the BasicBlock(s) so that backend can easily generate the code. + // During its process, it splits the critical edges in the function. + // This must be called after RunPasses. Otherwise, it panics. + // + // The resulting order is available via BlockIteratorReversePostOrderBegin and BlockIteratorReversePostOrderNext. + LayoutBlocks() + + // BlockIteratorReversePostOrderBegin is almost the same as BlockIteratorBegin except it returns the BasicBlock in the reverse post-order. + // This is available after RunPasses is run. + BlockIteratorReversePostOrderBegin() BasicBlock + + // BlockIteratorReversePostOrderNext is almost the same as BlockIteratorPostOrderNext except it returns the BasicBlock in the reverse post-order. + // This is available after RunPasses is run. + BlockIteratorReversePostOrderNext() BasicBlock + + // ReturnBlock returns the BasicBlock which is used to return from the function. + ReturnBlock() BasicBlock + + // InsertUndefined inserts an undefined instruction at the current position. + InsertUndefined() + + // SetCurrentSourceOffset sets the current source offset. The incoming instruction will be annotated with this offset. + SetCurrentSourceOffset(line SourceOffset) + + // LoopNestingForestRoots returns the roots of the loop nesting forest. + LoopNestingForestRoots() []BasicBlock + + // LowestCommonAncestor returns the lowest common ancestor in the dominator tree of the given BasicBlock(s). + LowestCommonAncestor(blk1, blk2 BasicBlock) BasicBlock + + // Idom returns the immediate dominator of the given BasicBlock. + Idom(blk BasicBlock) BasicBlock +} + +// NewBuilder returns a new Builder implementation. +func NewBuilder() Builder { + return &builder{ + instructionsPool: wazevoapi.NewPool[Instruction](resetInstruction), + basicBlocksPool: wazevoapi.NewPool[basicBlock](resetBasicBlock), + valueAnnotations: make(map[ValueID]string), + signatures: make(map[SignatureID]*Signature), + blkVisited: make(map[*basicBlock]int), + valueIDAliases: make(map[ValueID]Value), + redundantParameterIndexToValue: make(map[int]Value), + returnBlk: &basicBlock{id: basicBlockIDReturnBlock}, + } +} + +// builder implements Builder interface. +type builder struct { + basicBlocksPool wazevoapi.Pool[basicBlock] + instructionsPool wazevoapi.Pool[Instruction] + signatures map[SignatureID]*Signature + currentSignature *Signature + + // reversePostOrderedBasicBlocks are the BasicBlock(s) ordered in the reverse post-order after passCalculateImmediateDominators. + reversePostOrderedBasicBlocks []*basicBlock + currentBB *basicBlock + returnBlk *basicBlock + + // variables track the types for Variable with the index regarded Variable. + variables []Type + // nextValueID is used by builder.AllocateValue. + nextValueID ValueID + // nextVariable is used by builder.AllocateVariable. + nextVariable Variable + + valueIDAliases map[ValueID]Value + valueAnnotations map[ValueID]string + + // valueRefCounts is used to lower the SSA in backend, and will be calculated + // by the last SSA-level optimization pass. + valueRefCounts []int + + // dominators stores the immediate dominator of each BasicBlock. + // The index is blockID of the BasicBlock. + dominators []*basicBlock + sparseTree dominatorSparseTree + + // loopNestingForestRoots are the roots of the loop nesting forest. + loopNestingForestRoots []BasicBlock + + // The followings are used for optimization passes/deterministic compilation. + instStack []*Instruction + blkVisited map[*basicBlock]int + valueIDToInstruction []*Instruction + blkStack []*basicBlock + blkStack2 []*basicBlock + ints []int + redundantParameterIndexToValue map[int]Value + vars []Variable + + // blockIterCur is used to implement blockIteratorBegin and blockIteratorNext. + blockIterCur int + + // donePasses is true if RunPasses is called. + donePasses bool + // doneBlockLayout is true if LayoutBlocks is called. + doneBlockLayout bool + + currentSourceOffset SourceOffset +} + +// ReturnBlock implements Builder.ReturnBlock. +func (b *builder) ReturnBlock() BasicBlock { + return b.returnBlk +} + +// Init implements Builder.Reset. +func (b *builder) Init(s *Signature) { + b.nextVariable = 0 + b.currentSignature = s + resetBasicBlock(b.returnBlk) + b.instructionsPool.Reset() + b.basicBlocksPool.Reset() + b.donePasses = false + for _, sig := range b.signatures { + sig.used = false + } + + b.ints = b.ints[:0] + b.blkStack = b.blkStack[:0] + b.blkStack2 = b.blkStack2[:0] + b.dominators = b.dominators[:0] + b.loopNestingForestRoots = b.loopNestingForestRoots[:0] + + for i := 0; i < b.basicBlocksPool.Allocated(); i++ { + blk := b.basicBlocksPool.View(i) + delete(b.blkVisited, blk) + } + b.basicBlocksPool.Reset() + + for v := ValueID(0); v < b.nextValueID; v++ { + delete(b.valueAnnotations, v) + delete(b.valueIDAliases, v) + b.valueRefCounts[v] = 0 + b.valueIDToInstruction[v] = nil + } + b.nextValueID = 0 + b.reversePostOrderedBasicBlocks = b.reversePostOrderedBasicBlocks[:0] + b.donePasses = false + b.doneBlockLayout = false + for i := range b.valueRefCounts { + b.valueRefCounts[i] = 0 + } + + b.currentSourceOffset = sourceOffsetUnknown +} + +// Signature implements Builder.Signature. +func (b *builder) Signature() *Signature { + return b.currentSignature +} + +// AnnotateValue implements Builder.AnnotateValue. +func (b *builder) AnnotateValue(value Value, a string) { + b.valueAnnotations[value.ID()] = a +} + +// AllocateInstruction implements Builder.AllocateInstruction. +func (b *builder) AllocateInstruction() *Instruction { + instr := b.instructionsPool.Allocate() + instr.id = b.instructionsPool.Allocated() + return instr +} + +// DeclareSignature implements Builder.AnnotateValue. +func (b *builder) DeclareSignature(s *Signature) { + b.signatures[s.ID] = s + s.used = false +} + +// Signatures implements Builder.Signatures. +func (b *builder) Signatures() (ret []*Signature) { + for _, sig := range b.signatures { + ret = append(ret, sig) + } + sort.Slice(ret, func(i, j int) bool { + return ret[i].ID < ret[j].ID + }) + return +} + +// SetCurrentSourceOffset implements Builder.SetCurrentSourceOffset. +func (b *builder) SetCurrentSourceOffset(l SourceOffset) { + b.currentSourceOffset = l +} + +func (b *builder) usedSignatures() (ret []*Signature) { + for _, sig := range b.signatures { + if sig.used { + ret = append(ret, sig) + } + } + sort.Slice(ret, func(i, j int) bool { + return ret[i].ID < ret[j].ID + }) + return +} + +// ResolveSignature implements Builder.ResolveSignature. +func (b *builder) ResolveSignature(id SignatureID) *Signature { + return b.signatures[id] +} + +// AllocateBasicBlock implements Builder.AllocateBasicBlock. +func (b *builder) AllocateBasicBlock() BasicBlock { + return b.allocateBasicBlock() +} + +// allocateBasicBlock allocates a new basicBlock. +func (b *builder) allocateBasicBlock() *basicBlock { + id := BasicBlockID(b.basicBlocksPool.Allocated()) + blk := b.basicBlocksPool.Allocate() + blk.id = id + blk.lastDefinitions = make(map[Variable]Value) + blk.unknownValues = make(map[Variable]Value) + return blk +} + +// Idom implements Builder.Idom. +func (b *builder) Idom(blk BasicBlock) BasicBlock { + return b.dominators[blk.ID()] +} + +// InsertInstruction implements Builder.InsertInstruction. +func (b *builder) InsertInstruction(instr *Instruction) { + b.currentBB.InsertInstruction(instr) + + if l := b.currentSourceOffset; l.Valid() { + // Emit the source offset info only when the instruction has side effect because + // these are the only instructions that are accessed by stack unwinding. + // This reduces the significant amount of the offset info in the binary. + if instr.sideEffect() != sideEffectNone { + instr.annotateSourceOffset(l) + } + } + + resultTypesFn := instructionReturnTypes[instr.opcode] + if resultTypesFn == nil { + panic("TODO: " + instr.Format(b)) + } + + t1, ts := resultTypesFn(b, instr) + if t1.invalid() { + return + } + + r1 := b.allocateValue(t1) + instr.rValue = r1 + + tsl := len(ts) + if tsl == 0 { + return + } + + // TODO: reuse slices, though this seems not to be common. + instr.rValues = make([]Value, tsl) + for i := 0; i < tsl; i++ { + instr.rValues[i] = b.allocateValue(ts[i]) + } +} + +// DefineVariable implements Builder.DefineVariable. +func (b *builder) DefineVariable(variable Variable, value Value, block BasicBlock) { + if b.variables[variable].invalid() { + panic("BUG: trying to define variable " + variable.String() + " but is not declared yet") + } + + if b.variables[variable] != value.Type() { + panic(fmt.Sprintf("BUG: inconsistent type for variable %d: expected %s but got %s", variable, b.variables[variable], value.Type())) + } + bb := block.(*basicBlock) + bb.lastDefinitions[variable] = value +} + +// DefineVariableInCurrentBB implements Builder.DefineVariableInCurrentBB. +func (b *builder) DefineVariableInCurrentBB(variable Variable, value Value) { + b.DefineVariable(variable, value, b.currentBB) +} + +// SetCurrentBlock implements Builder.SetCurrentBlock. +func (b *builder) SetCurrentBlock(bb BasicBlock) { + b.currentBB = bb.(*basicBlock) +} + +// CurrentBlock implements Builder.CurrentBlock. +func (b *builder) CurrentBlock() BasicBlock { + return b.currentBB +} + +// EntryBlock implements Builder.EntryBlock. +func (b *builder) EntryBlock() BasicBlock { + return b.entryBlk() +} + +// DeclareVariable implements Builder.DeclareVariable. +func (b *builder) DeclareVariable(typ Type) Variable { + v := b.allocateVariable() + iv := int(v) + if l := len(b.variables); l <= iv { + b.variables = append(b.variables, make([]Type, 2*(l+1))...) + } + b.variables[v] = typ + return v +} + +// allocateVariable allocates a new variable. +func (b *builder) allocateVariable() (ret Variable) { + ret = b.nextVariable + b.nextVariable++ + return +} + +// allocateValue implements Builder.AllocateValue. +func (b *builder) allocateValue(typ Type) (v Value) { + v = Value(b.nextValueID) + v = v.setType(typ) + b.nextValueID++ + return +} + +// FindValueInLinearPath implements Builder.FindValueInLinearPath. +func (b *builder) FindValueInLinearPath(variable Variable) Value { + return b.findValueInLinearPath(variable, b.currentBB) +} + +func (b *builder) findValueInLinearPath(variable Variable, blk *basicBlock) Value { + if val, ok := blk.lastDefinitions[variable]; ok { + return val + } else if !blk.sealed { + return ValueInvalid + } + + if pred := blk.singlePred; pred != nil { + // If this block is sealed and have only one predecessor, + // we can use the value in that block without ambiguity on definition. + return b.findValueInLinearPath(variable, pred) + } + if len(blk.preds) == 1 { + panic("BUG") + } + return ValueInvalid +} + +// MustFindValue implements Builder.MustFindValue. +func (b *builder) MustFindValue(variable Variable) Value { + typ := b.definedVariableType(variable) + return b.findValue(typ, variable, b.currentBB) +} + +// findValue recursively tries to find the latest definition of a `variable`. The algorithm is described in +// the section 2 of the paper https://link.springer.com/content/pdf/10.1007/978-3-642-37051-9_6.pdf. +// +// TODO: reimplement this in iterative, not recursive, to avoid stack overflow. +func (b *builder) findValue(typ Type, variable Variable, blk *basicBlock) Value { + if val, ok := blk.lastDefinitions[variable]; ok { + // The value is already defined in this block! + return val + } else if !blk.sealed { // Incomplete CFG as in the paper. + // If this is not sealed, that means it might have additional unknown predecessor later on. + // So we temporarily define the placeholder value here (not add as a parameter yet!), + // and record it as unknown. + // The unknown values are resolved when we call seal this block via BasicBlock.Seal(). + value := b.allocateValue(typ) + if wazevoapi.SSALoggingEnabled { + fmt.Printf("adding unknown value placeholder for %s at %d\n", variable, blk.id) + } + blk.lastDefinitions[variable] = value + blk.unknownValues[variable] = value + return value + } + + if pred := blk.singlePred; pred != nil { + // If this block is sealed and have only one predecessor, + // we can use the value in that block without ambiguity on definition. + return b.findValue(typ, variable, pred) + } else if len(blk.preds) == 0 { + panic("BUG: value is not defined for " + variable.String()) + } + + // If this block has multiple predecessors, we have to gather the definitions, + // and treat them as an argument to this block. + // + // The first thing is to define a new parameter to this block which may or may not be redundant, but + // later we eliminate trivial params in an optimization pass. This must be done before finding the + // definitions in the predecessors so that we can break the cycle. + paramValue := blk.AddParam(b, typ) + b.DefineVariable(variable, paramValue, blk) + + // After the new param is added, we have to manipulate the original branching instructions + // in predecessors so that they would pass the definition of `variable` as the argument to + // the newly added PHI. + for i := range blk.preds { + pred := &blk.preds[i] + value := b.findValue(typ, variable, pred.blk) + pred.branch.addArgumentBranchInst(value) + } + return paramValue +} + +// Seal implements Builder.Seal. +func (b *builder) Seal(raw BasicBlock) { + blk := raw.(*basicBlock) + if len(blk.preds) == 1 { + blk.singlePred = blk.preds[0].blk + } + blk.sealed = true + + // To get the deterministic compilation, + // we need to sort the parameters in the order of the variable index. + b.vars = b.vars[:0] + for v := range blk.unknownValues { + b.vars = append(b.vars, v) + } + sort.Slice(b.vars, func(i, j int) bool { + return b.vars[i] < b.vars[j] + }) + + for _, variable := range b.vars { + phiValue := blk.unknownValues[variable] + typ := b.definedVariableType(variable) + blk.addParamOn(typ, phiValue) + for i := range blk.preds { + pred := &blk.preds[i] + predValue := b.findValue(typ, variable, pred.blk) + if !predValue.Valid() { + panic("BUG: value is not defined anywhere in the predecessors in the CFG") + } + pred.branch.addArgumentBranchInst(predValue) + } + } +} + +// definedVariableType returns the type of the given variable. If the variable is not defined yet, it panics. +func (b *builder) definedVariableType(variable Variable) Type { + typ := b.variables[variable] + if typ.invalid() { + panic(fmt.Sprintf("%s is not defined yet", variable)) + } + return typ +} + +// Format implements Builder.Format. +func (b *builder) Format() string { + str := strings.Builder{} + usedSigs := b.usedSignatures() + if len(usedSigs) > 0 { + str.WriteByte('\n') + str.WriteString("signatures:\n") + for _, sig := range usedSigs { + str.WriteByte('\t') + str.WriteString(sig.String()) + str.WriteByte('\n') + } + } + + var iterBegin, iterNext func() *basicBlock + if b.doneBlockLayout { + iterBegin, iterNext = b.blockIteratorReversePostOrderBegin, b.blockIteratorReversePostOrderNext + } else { + iterBegin, iterNext = b.blockIteratorBegin, b.blockIteratorNext + } + for bb := iterBegin(); bb != nil; bb = iterNext() { + str.WriteByte('\n') + str.WriteString(bb.FormatHeader(b)) + str.WriteByte('\n') + + for cur := bb.Root(); cur != nil; cur = cur.Next() { + str.WriteByte('\t') + str.WriteString(cur.Format(b)) + str.WriteByte('\n') + } + } + return str.String() +} + +// BlockIteratorNext implements Builder.BlockIteratorNext. +func (b *builder) BlockIteratorNext() BasicBlock { + if blk := b.blockIteratorNext(); blk == nil { + return nil // BasicBlock((*basicBlock)(nil)) != BasicBlock(nil) + } else { + return blk + } +} + +// BlockIteratorNext implements Builder.BlockIteratorNext. +func (b *builder) blockIteratorNext() *basicBlock { + index := b.blockIterCur + for { + if index == b.basicBlocksPool.Allocated() { + return nil + } + ret := b.basicBlocksPool.View(index) + index++ + if !ret.invalid { + b.blockIterCur = index + return ret + } + } +} + +// BlockIteratorBegin implements Builder.BlockIteratorBegin. +func (b *builder) BlockIteratorBegin() BasicBlock { + return b.blockIteratorBegin() +} + +// BlockIteratorBegin implements Builder.BlockIteratorBegin. +func (b *builder) blockIteratorBegin() *basicBlock { + b.blockIterCur = 0 + return b.blockIteratorNext() +} + +// BlockIteratorReversePostOrderBegin implements Builder.BlockIteratorReversePostOrderBegin. +func (b *builder) BlockIteratorReversePostOrderBegin() BasicBlock { + return b.blockIteratorReversePostOrderBegin() +} + +// BlockIteratorBegin implements Builder.BlockIteratorBegin. +func (b *builder) blockIteratorReversePostOrderBegin() *basicBlock { + b.blockIterCur = 0 + return b.blockIteratorReversePostOrderNext() +} + +// BlockIteratorReversePostOrderNext implements Builder.BlockIteratorReversePostOrderNext. +func (b *builder) BlockIteratorReversePostOrderNext() BasicBlock { + if blk := b.blockIteratorReversePostOrderNext(); blk == nil { + return nil // BasicBlock((*basicBlock)(nil)) != BasicBlock(nil) + } else { + return blk + } +} + +// BlockIteratorNext implements Builder.BlockIteratorNext. +func (b *builder) blockIteratorReversePostOrderNext() *basicBlock { + if b.blockIterCur >= len(b.reversePostOrderedBasicBlocks) { + return nil + } else { + ret := b.reversePostOrderedBasicBlocks[b.blockIterCur] + b.blockIterCur++ + return ret + } +} + +// ValueRefCounts implements Builder.ValueRefCounts. +func (b *builder) ValueRefCounts() []int { + return b.valueRefCounts +} + +// alias records the alias of the given values. The alias(es) will be +// eliminated in the optimization pass via resolveArgumentAlias. +func (b *builder) alias(dst, src Value) { + b.valueIDAliases[dst.ID()] = src +} + +// resolveArgumentAlias resolves the alias of the arguments of the given instruction. +func (b *builder) resolveArgumentAlias(instr *Instruction) { + if instr.v.Valid() { + instr.v = b.resolveAlias(instr.v) + } + + if instr.v2.Valid() { + instr.v2 = b.resolveAlias(instr.v2) + } + + if instr.v3.Valid() { + instr.v3 = b.resolveAlias(instr.v3) + } + + for i, v := range instr.vs { + instr.vs[i] = b.resolveAlias(v) + } +} + +// resolveAlias resolves the alias of the given value. +func (b *builder) resolveAlias(v Value) Value { + // Some aliases are chained, so we need to resolve them recursively. + for { + if src, ok := b.valueIDAliases[v.ID()]; ok { + v = src + } else { + break + } + } + return v +} + +// entryBlk returns the entry block of the function. +func (b *builder) entryBlk() *basicBlock { + return b.basicBlocksPool.View(0) +} + +// isDominatedBy returns true if the given block `n` is dominated by the given block `d`. +// Before calling this, the builder must pass by passCalculateImmediateDominators. +func (b *builder) isDominatedBy(n *basicBlock, d *basicBlock) bool { + if len(b.dominators) == 0 { + panic("BUG: passCalculateImmediateDominators must be called before calling isDominatedBy") + } + ent := b.entryBlk() + doms := b.dominators + for n != d && n != ent { + n = doms[n.id] + } + return n == d +} + +// BlockIDMax implements Builder.BlockIDMax. +func (b *builder) BlockIDMax() BasicBlockID { + return BasicBlockID(b.basicBlocksPool.Allocated()) +} + +// LayoutBlocks implements Builder.LayoutBlocks. This re-organizes builder.reversePostOrderedBasicBlocks. +// +// TODO: there are tons of room for improvement here. e.g. LLVM has BlockPlacementPass using BlockFrequencyInfo, +// BranchProbabilityInfo, and LoopInfo to do a much better job. Also, if we have the profiling instrumentation +// like ball-larus algorithm, then we could do profile-guided optimization. Basically all of them are trying +// to maximize the fall-through opportunities which is most efficient. +// +// Here, fallthrough happens when a block ends with jump instruction whose target is the right next block in the +// builder.reversePostOrderedBasicBlocks. +// +// Currently, we just place blocks using the DFS reverse post-order of the dominator tree with the heuristics: +// 1. a split edge trampoline towards a loop header will be placed as a fallthrough. +// 2. we invert the brz and brnz if it makes the fallthrough more likely. +// +// This heuristic is done in maybeInvertBranches function. +func (b *builder) LayoutBlocks() { + if !b.donePasses { + panic("LayoutBlocks must be called after all passes are done") + } + + b.clearBlkVisited() + + // We might end up splitting critical edges which adds more basic blocks, + // so we store the currently existing basic blocks in nonSplitBlocks temporarily. + // That way we can iterate over the original basic blocks while appending new ones into reversePostOrderedBasicBlocks. + nonSplitBlocks := b.blkStack[:0] + for i, blk := range b.reversePostOrderedBasicBlocks { + if !blk.Valid() { + continue + } + nonSplitBlocks = append(nonSplitBlocks, blk) + if i != len(b.reversePostOrderedBasicBlocks)-1 { + _ = maybeInvertBranches(blk, b.reversePostOrderedBasicBlocks[i+1]) + } + } + + var trampolines []*basicBlock + + // Reset the order slice since we update on the fly by splitting critical edges. + b.reversePostOrderedBasicBlocks = b.reversePostOrderedBasicBlocks[:0] + uninsertedTrampolines := b.blkStack2[:0] + for _, blk := range nonSplitBlocks { + for i := range blk.preds { + pred := blk.preds[i].blk + if _, ok := b.blkVisited[pred]; ok || !pred.Valid() { + continue + } else if pred.reversePostOrder < blk.reversePostOrder { + // This means the edge is critical, and this pred is the trampoline and yet to be inserted. + // Split edge trampolines must come before the destination in reverse post-order. + b.reversePostOrderedBasicBlocks = append(b.reversePostOrderedBasicBlocks, pred) + b.blkVisited[pred] = 0 // mark as inserted, the value is not used. + } + } + + // Now that we've already added all the potential trampoline blocks incoming to this block, + // we can add this block itself. + b.reversePostOrderedBasicBlocks = append(b.reversePostOrderedBasicBlocks, blk) + b.blkVisited[blk] = 0 // mark as inserted, the value is not used. + + if len(blk.success) < 2 { + // There won't be critical edge originating from this block. + continue + } else if blk.currentInstr.opcode == OpcodeBrTable { + // We don't split critical edges here, because at the construction site of BrTable, we already split the edges. + continue + } + + for sidx, succ := range blk.success { + if !succ.ReturnBlock() && // If the successor is a return block, we need to split the edge any way because we need "epilogue" to be inserted. + // Plus if there's no multiple incoming edges to this successor, (pred, succ) is not critical. + len(succ.preds) < 2 { + continue + } + + // Otherwise, we are sure this is a critical edge. To modify the CFG, we need to find the predecessor info + // from the successor. + var predInfo *basicBlockPredecessorInfo + for i := range succ.preds { // This linear search should not be a problem since the number of predecessors should almost always small. + pred := &succ.preds[i] + if pred.blk == blk { + predInfo = pred + break + } + } + + if predInfo == nil { + // This must be a bug in somewhere around branch manipulation. + panic("BUG: predecessor info not found while the successor exists in successors list") + } + + if wazevoapi.SSALoggingEnabled { + fmt.Printf("trying to split edge from %d->%d at %s\n", + blk.ID(), succ.ID(), predInfo.branch.Format(b)) + } + + trampoline := b.splitCriticalEdge(blk, succ, predInfo) + // Update the successors slice because the target is no longer the original `succ`. + blk.success[sidx] = trampoline + + if wazevoapi.SSAValidationEnabled { + trampolines = append(trampolines, trampoline) + } + + if wazevoapi.SSALoggingEnabled { + fmt.Printf("edge split from %d->%d at %s as %d->%d->%d \n", + blk.ID(), succ.ID(), predInfo.branch.Format(b), + blk.ID(), trampoline.ID(), succ.ID()) + } + + fallthroughBranch := blk.currentInstr + if fallthroughBranch.opcode == OpcodeJump && fallthroughBranch.blk == trampoline { + // This can be lowered as fallthrough at the end of the block. + b.reversePostOrderedBasicBlocks = append(b.reversePostOrderedBasicBlocks, trampoline) + b.blkVisited[trampoline] = 0 // mark as inserted, the value is not used. + } else { + uninsertedTrampolines = append(uninsertedTrampolines, trampoline) + } + } + + for _, trampoline := range uninsertedTrampolines { + if trampoline.success[0].reversePostOrder <= trampoline.reversePostOrder { // "<=", not "<" because the target might be itself. + // This means the critical edge was backward, so we insert after the current block immediately. + b.reversePostOrderedBasicBlocks = append(b.reversePostOrderedBasicBlocks, trampoline) + b.blkVisited[trampoline] = 0 // mark as inserted, the value is not used. + } // If the target is forward, we can wait to insert until the target is inserted. + } + uninsertedTrampolines = uninsertedTrampolines[:0] // Reuse the stack for the next block. + } + + if wazevoapi.SSALoggingEnabled { + var bs []string + for _, blk := range b.reversePostOrderedBasicBlocks { + bs = append(bs, blk.Name()) + } + fmt.Println("ordered blocks: ", strings.Join(bs, ", ")) + } + + if wazevoapi.SSAValidationEnabled { + for _, trampoline := range trampolines { + if _, ok := b.blkVisited[trampoline]; !ok { + panic("BUG: trampoline block not inserted: " + trampoline.FormatHeader(b)) + } + trampoline.validate(b) + } + } + + // Critical edges are split, so we fix the loop nesting forest. + buildLoopNestingForest(b) + buildDominatorTree(b) + + // Reuse the stack for the next iteration. + b.blkStack2 = uninsertedTrampolines[:0] + + // Now that we know the final placement of the blocks, we can explicitly mark the fallthrough jumps. + b.markFallthroughJumps() + b.doneBlockLayout = true +} + +// markFallthroughJumps finds the fallthrough jumps and marks them as such. +func (b *builder) markFallthroughJumps() { + l := len(b.reversePostOrderedBasicBlocks) - 1 + for i, blk := range b.reversePostOrderedBasicBlocks { + if i < l { + cur := blk.currentInstr + if cur.opcode == OpcodeJump && cur.blk == b.reversePostOrderedBasicBlocks[i+1] { + cur.AsFallthroughJump() + } + } + } +} + +// maybeInvertBranches inverts the branch instructions if it is likely possible to the fallthrough more likely with simple heuristics. +// nextInRPO is the next block in the reverse post-order. +// +// Returns true if the branch is inverted for testing purpose. +func maybeInvertBranches(now *basicBlock, nextInRPO *basicBlock) bool { + fallthroughBranch := now.currentInstr + if fallthroughBranch.opcode == OpcodeBrTable { + return false + } + + condBranch := fallthroughBranch.prev + if condBranch == nil || (condBranch.opcode != OpcodeBrnz && condBranch.opcode != OpcodeBrz) { + return false + } + + if len(fallthroughBranch.vs) != 0 || len(condBranch.vs) != 0 { + // If either one of them has arguments, we don't invert the branches. + return false + } + + // So this block has two branches (a conditional branch followed by an unconditional branch) at the end. + // We can invert the condition of the branch if it makes the fallthrough more likely. + + fallthroughTarget, condTarget := fallthroughBranch.blk.(*basicBlock), condBranch.blk.(*basicBlock) + + if fallthroughTarget.loopHeader { + // First, if the tail's target is loopHeader, we don't need to do anything here, + // because the edge is likely to be critical edge for complex loops (e.g. loop with branches inside it). + // That means, we will split the edge in the end of LayoutBlocks function, and insert the trampoline block + // right after this block, which will be fallthrough in any way. + return false + } else if condTarget.loopHeader { + // On the other hand, if the condBranch's target is loopHeader, we invert the condition of the branch + // so that we could get the fallthrough to the trampoline block. + goto invert + } + + if fallthroughTarget == nextInRPO { + // Also, if the tail's target is the next block in the reverse post-order, we don't need to do anything here, + // because if this is not critical edge, we would end up placing these two blocks adjacent to each other. + // Even if it is the critical edge, we place the trampoline block right after this block, which will be fallthrough in any way. + return false + } else if condTarget == nextInRPO { + // If the condBranch's target is the next block in the reverse post-order, we invert the condition of the branch + // so that we could get the fallthrough to the block. + goto invert + } else { + return false + } + +invert: + for i := range fallthroughTarget.preds { + pred := &fallthroughTarget.preds[i] + if pred.branch == fallthroughBranch { + pred.branch = condBranch + break + } + } + for i := range condTarget.preds { + pred := &condTarget.preds[i] + if pred.branch == condBranch { + pred.branch = fallthroughBranch + break + } + } + + condBranch.InvertBrx() + condBranch.blk = fallthroughTarget + fallthroughBranch.blk = condTarget + if wazevoapi.SSALoggingEnabled { + fmt.Printf("inverting branches at %d->%d and %d->%d\n", + now.ID(), fallthroughTarget.ID(), now.ID(), condTarget.ID()) + } + + return true +} + +// splitCriticalEdge splits the critical edge between the given predecessor (`pred`) and successor (owning `predInfo`). +// +// - `pred` is the source of the critical edge, +// - `succ` is the destination of the critical edge, +// - `predInfo` is the predecessor info in the succ.preds slice which represents the critical edge. +// +// Why splitting critical edges is important? See following links: +// +// - https://en.wikipedia.org/wiki/Control-flow_graph +// - https://nickdesaulniers.github.io/blog/2023/01/27/critical-edge-splitting/ +// +// The returned basic block is the trampoline block which is inserted to split the critical edge. +func (b *builder) splitCriticalEdge(pred, succ *basicBlock, predInfo *basicBlockPredecessorInfo) *basicBlock { + // In the following, we convert the following CFG: + // + // pred --(originalBranch)--> succ + // + // to the following CFG: + // + // pred --(newBranch)--> trampoline --(originalBranch)-> succ + // + // where trampoline is a new basic block which is created to split the critical edge. + + trampoline := b.allocateBasicBlock() + if int(trampoline.id) >= len(b.dominators) { + b.dominators = append(b.dominators, make([]*basicBlock, trampoline.id+1)...) + } + b.dominators[trampoline.id] = pred + + originalBranch := predInfo.branch + + // Replace originalBranch with the newBranch. + newBranch := b.AllocateInstruction() + newBranch.opcode = originalBranch.opcode + newBranch.blk = trampoline + switch originalBranch.opcode { + case OpcodeJump: + case OpcodeBrz, OpcodeBrnz: + originalBranch.opcode = OpcodeJump // Trampoline consists of one unconditional branch. + newBranch.v = originalBranch.v + originalBranch.v = ValueInvalid + default: + panic("BUG: critical edge shouldn't be originated from br_table") + } + swapInstruction(pred, originalBranch, newBranch) + + // Replace the original branch with the new branch. + trampoline.rootInstr = originalBranch + trampoline.currentInstr = originalBranch + trampoline.success = append(trampoline.success, succ) // Do not use []*basicBlock{pred} because we might have already allocated the slice. + trampoline.preds = append(trampoline.preds, // same as ^. + basicBlockPredecessorInfo{blk: pred, branch: newBranch}) + b.Seal(trampoline) + + // Update the original branch to point to the trampoline. + predInfo.blk = trampoline + predInfo.branch = originalBranch + + if wazevoapi.SSAValidationEnabled { + trampoline.validate(b) + } + + if len(trampoline.params) > 0 { + panic("trampoline should not have params") + } + + // Assign the same order as the original block so that this will be placed before the actual destination. + trampoline.reversePostOrder = pred.reversePostOrder + return trampoline +} + +// swapInstruction replaces `old` in the block `blk` with `New`. +func swapInstruction(blk *basicBlock, old, New *Instruction) { + if blk.rootInstr == old { + blk.rootInstr = New + next := old.next + New.next = next + next.prev = New + } else { + if blk.currentInstr == old { + blk.currentInstr = New + } + prev := old.prev + prev.next, New.prev = New, prev + if next := old.next; next != nil { + New.next, next.prev = next, New + } + } + old.prev, old.next = nil, nil +} + +// InsertUndefined implements Builder.InsertUndefined. +func (b *builder) InsertUndefined() { + instr := b.AllocateInstruction() + instr.opcode = OpcodeUndefined + b.InsertInstruction(instr) +} + +// LoopNestingForestRoots implements Builder.LoopNestingForestRoots. +func (b *builder) LoopNestingForestRoots() []BasicBlock { + return b.loopNestingForestRoots +} + +// LowestCommonAncestor implements Builder.LowestCommonAncestor. +func (b *builder) LowestCommonAncestor(blk1, blk2 BasicBlock) BasicBlock { + return b.sparseTree.findLCA(blk1.ID(), blk2.ID()) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/cmp.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/cmp.go new file mode 100644 index 000000000..15b62ca8e --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/cmp.go @@ -0,0 +1,107 @@ +package ssa + +// IntegerCmpCond represents a condition for integer comparison. +type IntegerCmpCond byte + +const ( + // IntegerCmpCondInvalid represents an invalid condition. + IntegerCmpCondInvalid IntegerCmpCond = iota + // IntegerCmpCondEqual represents "==". + IntegerCmpCondEqual + // IntegerCmpCondNotEqual represents "!=". + IntegerCmpCondNotEqual + // IntegerCmpCondSignedLessThan represents Signed "<". + IntegerCmpCondSignedLessThan + // IntegerCmpCondSignedGreaterThanOrEqual represents Signed ">=". + IntegerCmpCondSignedGreaterThanOrEqual + // IntegerCmpCondSignedGreaterThan represents Signed ">". + IntegerCmpCondSignedGreaterThan + // IntegerCmpCondSignedLessThanOrEqual represents Signed "<=". + IntegerCmpCondSignedLessThanOrEqual + // IntegerCmpCondUnsignedLessThan represents Unsigned "<". + IntegerCmpCondUnsignedLessThan + // IntegerCmpCondUnsignedGreaterThanOrEqual represents Unsigned ">=". + IntegerCmpCondUnsignedGreaterThanOrEqual + // IntegerCmpCondUnsignedGreaterThan represents Unsigned ">". + IntegerCmpCondUnsignedGreaterThan + // IntegerCmpCondUnsignedLessThanOrEqual represents Unsigned "<=". + IntegerCmpCondUnsignedLessThanOrEqual +) + +// String implements fmt.Stringer. +func (i IntegerCmpCond) String() string { + switch i { + case IntegerCmpCondEqual: + return "eq" + case IntegerCmpCondNotEqual: + return "neq" + case IntegerCmpCondSignedLessThan: + return "lt_s" + case IntegerCmpCondSignedGreaterThanOrEqual: + return "ge_s" + case IntegerCmpCondSignedGreaterThan: + return "gt_s" + case IntegerCmpCondSignedLessThanOrEqual: + return "le_s" + case IntegerCmpCondUnsignedLessThan: + return "lt_u" + case IntegerCmpCondUnsignedGreaterThanOrEqual: + return "ge_u" + case IntegerCmpCondUnsignedGreaterThan: + return "gt_u" + case IntegerCmpCondUnsignedLessThanOrEqual: + return "le_u" + default: + panic("invalid integer comparison condition") + } +} + +// Signed returns true if the condition is signed integer comparison. +func (i IntegerCmpCond) Signed() bool { + switch i { + case IntegerCmpCondSignedLessThan, IntegerCmpCondSignedGreaterThanOrEqual, + IntegerCmpCondSignedGreaterThan, IntegerCmpCondSignedLessThanOrEqual: + return true + default: + return false + } +} + +type FloatCmpCond byte + +const ( + // FloatCmpCondInvalid represents an invalid condition. + FloatCmpCondInvalid FloatCmpCond = iota + // FloatCmpCondEqual represents "==". + FloatCmpCondEqual + // FloatCmpCondNotEqual represents "!=". + FloatCmpCondNotEqual + // FloatCmpCondLessThan represents "<". + FloatCmpCondLessThan + // FloatCmpCondLessThanOrEqual represents "<=". + FloatCmpCondLessThanOrEqual + // FloatCmpCondGreaterThan represents ">". + FloatCmpCondGreaterThan + // FloatCmpCondGreaterThanOrEqual represents ">=". + FloatCmpCondGreaterThanOrEqual +) + +// String implements fmt.Stringer. +func (f FloatCmpCond) String() string { + switch f { + case FloatCmpCondEqual: + return "eq" + case FloatCmpCondNotEqual: + return "neq" + case FloatCmpCondLessThan: + return "lt" + case FloatCmpCondLessThanOrEqual: + return "le" + case FloatCmpCondGreaterThan: + return "gt" + case FloatCmpCondGreaterThanOrEqual: + return "ge" + default: + panic("invalid float comparison condition") + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/funcref.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/funcref.go new file mode 100644 index 000000000..d9620762a --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/funcref.go @@ -0,0 +1,12 @@ +package ssa + +import "fmt" + +// FuncRef is a unique identifier for a function of the frontend, +// and is used to reference the function in function call. +type FuncRef uint32 + +// String implements fmt.Stringer. +func (r FuncRef) String() string { + return fmt.Sprintf("f%d", r) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/instructions.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/instructions.go new file mode 100644 index 000000000..4dbe0883a --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/instructions.go @@ -0,0 +1,2838 @@ +package ssa + +import ( + "fmt" + "math" + "strings" + + "github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi" +) + +// Opcode represents a SSA instruction. +type Opcode uint32 + +// Instruction represents an instruction whose opcode is specified by +// Opcode. Since Go doesn't have union type, we use this flattened type +// for all instructions, and therefore each field has different meaning +// depending on Opcode. +type Instruction struct { + // id is the unique ID of this instruction which ascends from 0 following the order of program. + id int + opcode Opcode + u1, u2 uint64 + v Value + v2 Value + v3 Value + vs []Value + typ Type + blk BasicBlock + targets []BasicBlock + prev, next *Instruction + + rValue Value + rValues []Value + gid InstructionGroupID + sourceOffset SourceOffset + live bool + alreadyLowered bool +} + +// SourceOffset represents the offset of the source of an instruction. +type SourceOffset int64 + +const sourceOffsetUnknown = -1 + +// Valid returns true if this source offset is valid. +func (l SourceOffset) Valid() bool { + return l != sourceOffsetUnknown +} + +func (i *Instruction) annotateSourceOffset(line SourceOffset) { + i.sourceOffset = line +} + +// SourceOffset returns the source offset of this instruction. +func (i *Instruction) SourceOffset() SourceOffset { + return i.sourceOffset +} + +// Opcode returns the opcode of this instruction. +func (i *Instruction) Opcode() Opcode { + return i.opcode +} + +// GroupID returns the InstructionGroupID of this instruction. +func (i *Instruction) GroupID() InstructionGroupID { + return i.gid +} + +// MarkLowered marks this instruction as already lowered. +func (i *Instruction) MarkLowered() { + i.alreadyLowered = true +} + +// Lowered returns true if this instruction is already lowered. +func (i *Instruction) Lowered() bool { + return i.alreadyLowered +} + +// resetInstruction resets this instruction to the initial state. +func resetInstruction(i *Instruction) { + *i = Instruction{} + i.v = ValueInvalid + i.v2 = ValueInvalid + i.v3 = ValueInvalid + i.rValue = ValueInvalid + i.typ = typeInvalid + i.vs = nil + i.sourceOffset = sourceOffsetUnknown +} + +// InstructionGroupID is assigned to each instruction and represents a group of instructions +// where each instruction is interchangeable with others except for the last instruction +// in the group which has side effects. In short, InstructionGroupID is determined by the side effects of instructions. +// That means, if there's an instruction with side effect between two instructions, then these two instructions +// will have different instructionGroupID. Note that each block always ends with branching, which is with side effects, +// therefore, instructions in different blocks always have different InstructionGroupID(s). +// +// The notable application of this is used in lowering SSA-level instruction to a ISA specific instruction, +// where we eagerly try to merge multiple instructions into single operation etc. Such merging cannot be done +// if these instruction have different InstructionGroupID since it will change the semantics of a program. +// +// See passDeadCodeElimination. +type InstructionGroupID uint32 + +// Returns Value(s) produced by this instruction if any. +// The `first` is the first return value, and `rest` is the rest of the values. +func (i *Instruction) Returns() (first Value, rest []Value) { + return i.rValue, i.rValues +} + +// Return returns a Value(s) produced by this instruction if any. +// If there's multiple return values, only the first one is returned. +func (i *Instruction) Return() (first Value) { + return i.rValue +} + +// Args returns the arguments to this instruction. +func (i *Instruction) Args() (v1, v2, v3 Value, vs []Value) { + return i.v, i.v2, i.v3, i.vs +} + +// Arg returns the first argument to this instruction. +func (i *Instruction) Arg() Value { + return i.v +} + +// Arg2 returns the first two arguments to this instruction. +func (i *Instruction) Arg2() (Value, Value) { + return i.v, i.v2 +} + +// ArgWithLane returns the first argument to this instruction, and the lane type. +func (i *Instruction) ArgWithLane() (Value, VecLane) { + return i.v, VecLane(i.u1) +} + +// Arg2WithLane returns the first two arguments to this instruction, and the lane type. +func (i *Instruction) Arg2WithLane() (Value, Value, VecLane) { + return i.v, i.v2, VecLane(i.u1) +} + +// ShuffleData returns the first two arguments to this instruction and 2 uint64s `lo`, `hi`. +// +// Note: Each uint64 encodes a sequence of 8 bytes where each byte encodes a VecLane, +// so that the 128bit integer `hi<<64|lo` packs a slice `[16]VecLane`, +// where `lane[0]` is the least significant byte, and `lane[n]` is shifted to offset `n*8`. +func (i *Instruction) ShuffleData() (v Value, v2 Value, lo uint64, hi uint64) { + return i.v, i.v2, i.u1, i.u2 +} + +// Arg3 returns the first three arguments to this instruction. +func (i *Instruction) Arg3() (Value, Value, Value) { + return i.v, i.v2, i.v3 +} + +// Next returns the next instruction laid out next to itself. +func (i *Instruction) Next() *Instruction { + return i.next +} + +// Prev returns the previous instruction laid out prior to itself. +func (i *Instruction) Prev() *Instruction { + return i.prev +} + +// IsBranching returns true if this instruction is a branching instruction. +func (i *Instruction) IsBranching() bool { + switch i.opcode { + case OpcodeJump, OpcodeBrz, OpcodeBrnz, OpcodeBrTable: + return true + default: + return false + } +} + +// TODO: complete opcode comments. +const ( + OpcodeInvalid Opcode = iota + + // OpcodeUndefined is a placeholder for undefined opcode. This can be used for debugging to intentionally + // cause a crash at certain point. + OpcodeUndefined + + // OpcodeJump takes the list of args to the `block` and unconditionally jumps to it. + OpcodeJump + + // OpcodeBrz branches into `blk` with `args` if the value `c` equals zero: `Brz c, blk, args`. + OpcodeBrz + + // OpcodeBrnz branches into `blk` with `args` if the value `c` is not zero: `Brnz c, blk, args`. + OpcodeBrnz + + // OpcodeBrTable takes the index value `index`, and branches into `labelX`. If the `index` is out of range, + // it branches into the last labelN: `BrTable index, [label1, label2, ... labelN]`. + OpcodeBrTable + + // OpcodeExitWithCode exit the execution immediately. + OpcodeExitWithCode + + // OpcodeExitIfTrueWithCode exits the execution immediately if the value `c` is not zero. + OpcodeExitIfTrueWithCode + + // OpcodeReturn returns from the function: `return rvalues`. + OpcodeReturn + + // OpcodeCall calls a function specified by the symbol FN with arguments `args`: `returnvals = Call FN, args...` + // This is a "near" call, which means the call target is known at compile time, and the target is relatively close + // to this function. If the target cannot be reached by near call, the backend fails to compile. + OpcodeCall + + // OpcodeCallIndirect calls a function specified by `callee` which is a function address: `returnvals = call_indirect SIG, callee, args`. + // Note that this is different from call_indirect in Wasm, which also does type checking, etc. + OpcodeCallIndirect + + // OpcodeSplat performs a vector splat operation: `v = Splat.lane x`. + OpcodeSplat + + // OpcodeSwizzle performs a vector swizzle operation: `v = Swizzle.lane x, y`. + OpcodeSwizzle + + // OpcodeInsertlane ... + // `v = insertlane x, y, Idx`. (TernaryImm8) + OpcodeInsertlane + + // OpcodeExtractlane ... + // `v = extractlane x, Idx`. (BinaryImm8) + OpcodeExtractlane + + // OpcodeLoad loads a Type value from the [base + offset] address: `v = Load base, offset`. + OpcodeLoad + + // OpcodeStore stores a Type value to the [base + offset] address: `Store v, base, offset`. + OpcodeStore + + // OpcodeUload8 loads the 8-bit value from the [base + offset] address, zero-extended to 64 bits: `v = Uload8 base, offset`. + OpcodeUload8 + + // OpcodeSload8 loads the 8-bit value from the [base + offset] address, sign-extended to 64 bits: `v = Sload8 base, offset`. + OpcodeSload8 + + // OpcodeIstore8 stores the 8-bit value to the [base + offset] address, sign-extended to 64 bits: `Istore8 v, base, offset`. + OpcodeIstore8 + + // OpcodeUload16 loads the 16-bit value from the [base + offset] address, zero-extended to 64 bits: `v = Uload16 base, offset`. + OpcodeUload16 + + // OpcodeSload16 loads the 16-bit value from the [base + offset] address, sign-extended to 64 bits: `v = Sload16 base, offset`. + OpcodeSload16 + + // OpcodeIstore16 stores the 16-bit value to the [base + offset] address, zero-extended to 64 bits: `Istore16 v, base, offset`. + OpcodeIstore16 + + // OpcodeUload32 loads the 32-bit value from the [base + offset] address, zero-extended to 64 bits: `v = Uload32 base, offset`. + OpcodeUload32 + + // OpcodeSload32 loads the 32-bit value from the [base + offset] address, sign-extended to 64 bits: `v = Sload32 base, offset`. + OpcodeSload32 + + // OpcodeIstore32 stores the 32-bit value to the [base + offset] address, zero-extended to 64 bits: `Istore16 v, base, offset`. + OpcodeIstore32 + + // OpcodeLoadSplat represents a load that replicates the loaded value to all lanes `v = LoadSplat.lane p, Offset`. + OpcodeLoadSplat + + // OpcodeVZeroExtLoad loads a scalar single/double precision floating point value from the [p + Offset] address, + // and zero-extend it to the V128 value: `v = VExtLoad p, Offset`. + OpcodeVZeroExtLoad + + // OpcodeIconst represents the integer const. + OpcodeIconst + + // OpcodeF32const represents the single-precision const. + OpcodeF32const + + // OpcodeF64const represents the double-precision const. + OpcodeF64const + + // OpcodeVconst represents the 128bit vector const. + OpcodeVconst + + // OpcodeVbor computes binary or between two 128bit vectors: `v = bor x, y`. + OpcodeVbor + + // OpcodeVbxor computes binary xor between two 128bit vectors: `v = bxor x, y`. + OpcodeVbxor + + // OpcodeVband computes binary and between two 128bit vectors: `v = band x, y`. + OpcodeVband + + // OpcodeVbandnot computes binary and-not between two 128bit vectors: `v = bandnot x, y`. + OpcodeVbandnot + + // OpcodeVbnot negates a 128bit vector: `v = bnot x`. + OpcodeVbnot + + // OpcodeVbitselect uses the bits in the control mask c to select the corresponding bit from x when 1 + // and y when 0: `v = bitselect c, x, y`. + OpcodeVbitselect + + // OpcodeShuffle shuffles two vectors using the given 128-bit immediate: `v = shuffle imm, x, y`. + // For each byte in the immediate, a value i in [0, 15] selects the i-th byte in vector x; + // i in [16, 31] selects the (i-16)-th byte in vector y. + OpcodeShuffle + + // OpcodeSelect chooses between two values based on a condition `c`: `v = Select c, x, y`. + OpcodeSelect + + // OpcodeVanyTrue performs a any true operation: `s = VanyTrue a`. + OpcodeVanyTrue + + // OpcodeVallTrue performs a lane-wise all true operation: `s = VallTrue.lane a`. + OpcodeVallTrue + + // OpcodeVhighBits performs a lane-wise extract of the high bits: `v = VhighBits.lane a`. + OpcodeVhighBits + + // OpcodeIcmp compares two integer values with the given condition: `v = icmp Cond, x, y`. + OpcodeIcmp + + // OpcodeVIcmp compares two integer values with the given condition: `v = vicmp Cond, x, y` on vector. + OpcodeVIcmp + + // OpcodeIcmpImm compares an integer value with the immediate value on the given condition: `v = icmp_imm Cond, x, Y`. + OpcodeIcmpImm + + // OpcodeIadd performs an integer addition: `v = Iadd x, y`. + OpcodeIadd + + // OpcodeVIadd performs an integer addition: `v = VIadd.lane x, y` on vector. + OpcodeVIadd + + // OpcodeVSaddSat performs a signed saturating vector addition: `v = VSaddSat.lane x, y` on vector. + OpcodeVSaddSat + + // OpcodeVUaddSat performs an unsigned saturating vector addition: `v = VUaddSat.lane x, y` on vector. + OpcodeVUaddSat + + // OpcodeIsub performs an integer subtraction: `v = Isub x, y`. + OpcodeIsub + + // OpcodeVIsub performs an integer subtraction: `v = VIsub.lane x, y` on vector. + OpcodeVIsub + + // OpcodeVSsubSat performs a signed saturating vector subtraction: `v = VSsubSat.lane x, y` on vector. + OpcodeVSsubSat + + // OpcodeVUsubSat performs an unsigned saturating vector subtraction: `v = VUsubSat.lane x, y` on vector. + OpcodeVUsubSat + + // OpcodeVImin performs a signed integer min: `v = VImin.lane x, y` on vector. + OpcodeVImin + + // OpcodeVUmin performs an unsigned integer min: `v = VUmin.lane x, y` on vector. + OpcodeVUmin + + // OpcodeVImax performs a signed integer max: `v = VImax.lane x, y` on vector. + OpcodeVImax + + // OpcodeVUmax performs an unsigned integer max: `v = VUmax.lane x, y` on vector. + OpcodeVUmax + + // OpcodeVAvgRound performs an unsigned integer avg, truncating to zero: `v = VAvgRound.lane x, y` on vector. + OpcodeVAvgRound + + // OpcodeVImul performs an integer multiplication: `v = VImul.lane x, y` on vector. + OpcodeVImul + + // OpcodeVIneg negates the given integer vector value: `v = VIneg x`. + OpcodeVIneg + + // OpcodeVIpopcnt counts the number of 1-bits in the given vector: `v = VIpopcnt x`. + OpcodeVIpopcnt + + // OpcodeVIabs returns the absolute value for the given vector value: `v = VIabs.lane x`. + OpcodeVIabs + + // OpcodeVIshl shifts x left by (y mod lane-width): `v = VIshl.lane x, y` on vector. + OpcodeVIshl + + // OpcodeVUshr shifts x right by (y mod lane-width), unsigned: `v = VUshr.lane x, y` on vector. + OpcodeVUshr + + // OpcodeVSshr shifts x right by (y mod lane-width), signed: `v = VSshr.lane x, y` on vector. + OpcodeVSshr + + // OpcodeVFabs takes the absolute value of a floating point value: `v = VFabs.lane x on vector. + OpcodeVFabs + + // OpcodeVFmax takes the maximum of two floating point values: `v = VFmax.lane x, y on vector. + OpcodeVFmax + + // OpcodeVFmin takes the minimum of two floating point values: `v = VFmin.lane x, y on vector. + OpcodeVFmin + + // OpcodeVFneg negates the given floating point vector value: `v = VFneg x`. + OpcodeVFneg + + // OpcodeVFadd performs a floating point addition: `v = VFadd.lane x, y` on vector. + OpcodeVFadd + + // OpcodeVFsub performs a floating point subtraction: `v = VFsub.lane x, y` on vector. + OpcodeVFsub + + // OpcodeVFmul performs a floating point multiplication: `v = VFmul.lane x, y` on vector. + OpcodeVFmul + + // OpcodeVFdiv performs a floating point division: `v = VFdiv.lane x, y` on vector. + OpcodeVFdiv + + // OpcodeVFcmp compares two float values with the given condition: `v = VFcmp.lane Cond, x, y` on float. + OpcodeVFcmp + + // OpcodeVCeil takes the ceiling of the given floating point value: `v = ceil.lane x` on vector. + OpcodeVCeil + + // OpcodeVFloor takes the floor of the given floating point value: `v = floor.lane x` on vector. + OpcodeVFloor + + // OpcodeVTrunc takes the truncation of the given floating point value: `v = trunc.lane x` on vector. + OpcodeVTrunc + + // OpcodeVNearest takes the nearest integer of the given floating point value: `v = nearest.lane x` on vector. + OpcodeVNearest + + // OpcodeVMaxPseudo computes the lane-wise maximum value `v = VMaxPseudo.lane x, y` on vector defined as `x < y ? x : y`. + OpcodeVMaxPseudo + + // OpcodeVMinPseudo computes the lane-wise minimum value `v = VMinPseudo.lane x, y` on vector defined as `y < x ? x : y`. + OpcodeVMinPseudo + + // OpcodeVSqrt takes the minimum of two floating point values: `v = VFmin.lane x, y` on vector. + OpcodeVSqrt + + // OpcodeVFcvtToUintSat converts a floating point value to an unsigned integer: `v = FcvtToUintSat.lane x` on vector. + OpcodeVFcvtToUintSat + + // OpcodeVFcvtToSintSat converts a floating point value to a signed integer: `v = VFcvtToSintSat.lane x` on vector. + OpcodeVFcvtToSintSat + + // OpcodeVFcvtFromUint converts a floating point value from an unsigned integer: `v = FcvtFromUint.lane x` on vector. + OpcodeVFcvtFromUint + + // OpcodeVFcvtFromSint converts a floating point value from a signed integer: `v = VFcvtFromSint.lane x` on vector. + OpcodeVFcvtFromSint + + // OpcodeImul performs an integer multiplication: `v = Imul x, y`. + OpcodeImul + + // OpcodeUdiv performs the unsigned integer division `v = Udiv x, y`. + OpcodeUdiv + + // OpcodeSdiv performs the signed integer division `v = Sdiv x, y`. + OpcodeSdiv + + // OpcodeUrem computes the remainder of the unsigned integer division `v = Urem x, y`. + OpcodeUrem + + // OpcodeSrem computes the remainder of the signed integer division `v = Srem x, y`. + OpcodeSrem + + // OpcodeBand performs a binary and: `v = Band x, y`. + OpcodeBand + + // OpcodeBor performs a binary or: `v = Bor x, y`. + OpcodeBor + + // OpcodeBxor performs a binary xor: `v = Bxor x, y`. + OpcodeBxor + + // OpcodeBnot performs a binary not: `v = Bnot x`. + OpcodeBnot + + // OpcodeRotl rotates the given integer value to the left: `v = Rotl x, y`. + OpcodeRotl + + // OpcodeRotr rotates the given integer value to the right: `v = Rotr x, y`. + OpcodeRotr + + // OpcodeIshl does logical shift left: `v = Ishl x, y`. + OpcodeIshl + + // OpcodeUshr does logical shift right: `v = Ushr x, y`. + OpcodeUshr + + // OpcodeSshr does arithmetic shift right: `v = Sshr x, y`. + OpcodeSshr + + // OpcodeClz counts the number of leading zeros: `v = clz x`. + OpcodeClz + + // OpcodeCtz counts the number of trailing zeros: `v = ctz x`. + OpcodeCtz + + // OpcodePopcnt counts the number of 1-bits: `v = popcnt x`. + OpcodePopcnt + + // OpcodeFcmp compares two floating point values: `v = fcmp Cond, x, y`. + OpcodeFcmp + + // OpcodeFadd performs a floating point addition: / `v = Fadd x, y`. + OpcodeFadd + + // OpcodeFsub performs a floating point subtraction: `v = Fsub x, y`. + OpcodeFsub + + // OpcodeFmul performs a floating point multiplication: `v = Fmul x, y`. + OpcodeFmul + + // OpcodeSqmulRoundSat performs a lane-wise saturating rounding multiplication + // in Q15 format: `v = SqmulRoundSat.lane x,y` on vector. + OpcodeSqmulRoundSat + + // OpcodeFdiv performs a floating point division: `v = Fdiv x, y`. + OpcodeFdiv + + // OpcodeSqrt takes the square root of the given floating point value: `v = sqrt x`. + OpcodeSqrt + + // OpcodeFneg negates the given floating point value: `v = Fneg x`. + OpcodeFneg + + // OpcodeFabs takes the absolute value of the given floating point value: `v = fabs x`. + OpcodeFabs + + // OpcodeFcopysign copies the sign of the second floating point value to the first floating point value: + // `v = Fcopysign x, y`. + OpcodeFcopysign + + // OpcodeFmin takes the minimum of two floating point values: `v = fmin x, y`. + OpcodeFmin + + // OpcodeFmax takes the maximum of two floating point values: `v = fmax x, y`. + OpcodeFmax + + // OpcodeCeil takes the ceiling of the given floating point value: `v = ceil x`. + OpcodeCeil + + // OpcodeFloor takes the floor of the given floating point value: `v = floor x`. + OpcodeFloor + + // OpcodeTrunc takes the truncation of the given floating point value: `v = trunc x`. + OpcodeTrunc + + // OpcodeNearest takes the nearest integer of the given floating point value: `v = nearest x`. + OpcodeNearest + + // OpcodeBitcast is a bitcast operation: `v = bitcast x`. + OpcodeBitcast + + // OpcodeBmask ... + // `v = bmask x`. + OpcodeBmask + + // OpcodeIreduce ... + // `v = ireduce x`. + OpcodeIreduce + + // OpcodeSnarrow converts two input vectors x, y into a smaller lane vector by narrowing each lane, signed `v = Snarrow.lane x, y`. + OpcodeSnarrow + + // OpcodeUnarrow converts two input vectors x, y into a smaller lane vector by narrowing each lane, unsigned `v = Unarrow.lane x, y`. + OpcodeUnarrow + + // OpcodeSwidenLow converts low half of the smaller lane vector to a larger lane vector, sign extended: `v = SwidenLow.lane x`. + OpcodeSwidenLow + + // OpcodeSwidenHigh converts high half of the smaller lane vector to a larger lane vector, sign extended: `v = SwidenHigh.lane x`. + OpcodeSwidenHigh + + // OpcodeUwidenLow converts low half of the smaller lane vector to a larger lane vector, zero (unsigned) extended: `v = UwidenLow.lane x`. + OpcodeUwidenLow + + // OpcodeUwidenHigh converts high half of the smaller lane vector to a larger lane vector, zero (unsigned) extended: `v = UwidenHigh.lane x`. + OpcodeUwidenHigh + + // OpcodeIaddPairwise is a lane-wise integer extended pairwise addition producing extended results (twice wider results than the inputs): `v = iadd_pairwise x, y` on vector. + OpcodeIaddPairwise + + // OpcodeWideningPairwiseDotProductS ... + // `v = widening_pairwise_dot_product_s x, y`. + OpcodeWideningPairwiseDotProductS + + // OpcodeUExtend zero-extends the given integer: `v = UExtend x, from->to`. + OpcodeUExtend + + // OpcodeSExtend sign-extends the given integer: `v = SExtend x, from->to`. + OpcodeSExtend + + // OpcodeFpromote promotes the given floating point value: `v = Fpromote x`. + OpcodeFpromote + + // OpcodeFvpromoteLow converts the two lower single-precision floating point lanes + // to the two double-precision lanes of the result: `v = FvpromoteLow.lane x` on vector. + OpcodeFvpromoteLow + + // OpcodeFdemote demotes the given float point value: `v = Fdemote x`. + OpcodeFdemote + + // OpcodeFvdemote converts the two double-precision floating point lanes + // to two lower single-precision lanes of the result `v = Fvdemote.lane x`. + OpcodeFvdemote + + // OpcodeFcvtToUint ... + // `v = fcvt_to_uint x`. + OpcodeFcvtToUint + + // OpcodeFcvtToSint converts a floating point value to a signed integer: `v = FcvtToSint x`. + OpcodeFcvtToSint + + // OpcodeFcvtToUintSat converts a floating point value to an unsigned integer: `v = FcvtToUintSat x`. + OpcodeFcvtToUintSat + + // OpcodeFcvtToSintSat ... + // `v = fcvt_to_sint_sat x`. + OpcodeFcvtToSintSat + + // OpcodeFcvtFromUint converts an unsigned integer to a floating point value: `v = FcvtFromUint x`. + OpcodeFcvtFromUint + + // OpcodeFcvtFromSint converts a signed integer to a floating point value: `v = FcvtFromSint x`. + OpcodeFcvtFromSint + + // OpcodeIsplit ... + // `lo, hi = isplit x`. + OpcodeIsplit + + // OpcodeIconcat ... + // `v = iconcat lo, hi`. + OpcodeIconcat + + // OpcodeAtomicRmw ... + // `v = atomic_rmw MemFlags, AtomicRmwOp, p, x`. + OpcodeAtomicRmw + + // OpcodeAtomicCas ... + // `v = atomic_cas MemFlags, p, e, x`. + OpcodeAtomicCas + + // OpcodeAtomicLoad ... + // `v = atomic_load MemFlags, p`. + OpcodeAtomicLoad + + // OpcodeAtomicStore ... + // `atomic_store MemFlags, x, p`. + OpcodeAtomicStore + + // OpcodeFence ... + // `fence`. + OpcodeFence + + // opcodeEnd marks the end of the opcode list. + opcodeEnd +) + +// returnTypesFn provides the info to determine the type of instruction. +// t1 is the type of the first result, ts are the types of the remaining results. +type returnTypesFn func(b *builder, instr *Instruction) (t1 Type, ts []Type) + +var ( + returnTypesFnNoReturns returnTypesFn = func(b *builder, instr *Instruction) (t1 Type, ts []Type) { return typeInvalid, nil } + returnTypesFnSingle = func(b *builder, instr *Instruction) (t1 Type, ts []Type) { return instr.typ, nil } + returnTypesFnI32 = func(b *builder, instr *Instruction) (t1 Type, ts []Type) { return TypeI32, nil } + returnTypesFnF32 = func(b *builder, instr *Instruction) (t1 Type, ts []Type) { return TypeF32, nil } + returnTypesFnF64 = func(b *builder, instr *Instruction) (t1 Type, ts []Type) { return TypeF64, nil } + returnTypesFnV128 = func(b *builder, instr *Instruction) (t1 Type, ts []Type) { return TypeV128, nil } +) + +// sideEffect provides the info to determine if an instruction has side effects which +// is used to determine if it can be optimized out, interchanged with others, etc. +type sideEffect byte + +const ( + sideEffectUnknown sideEffect = iota + // sideEffectStrict represents an instruction with side effects, and should be always alive plus cannot be reordered. + sideEffectStrict + // sideEffectTraps represents an instruction that can trap, and should be always alive but can be reordered within the group. + sideEffectTraps + // sideEffectNone represents an instruction without side effects, and can be eliminated if the result is not used, plus can be reordered within the group. + sideEffectNone +) + +// instructionSideEffects provides the info to determine if an instruction has side effects. +// Instructions with side effects must not be eliminated regardless whether the result is used or not. +var instructionSideEffects = [opcodeEnd]sideEffect{ + OpcodeUndefined: sideEffectStrict, + OpcodeJump: sideEffectStrict, + OpcodeIconst: sideEffectNone, + OpcodeCall: sideEffectStrict, + OpcodeCallIndirect: sideEffectStrict, + OpcodeIadd: sideEffectNone, + OpcodeImul: sideEffectNone, + OpcodeIsub: sideEffectNone, + OpcodeIcmp: sideEffectNone, + OpcodeExtractlane: sideEffectNone, + OpcodeInsertlane: sideEffectNone, + OpcodeBand: sideEffectNone, + OpcodeBor: sideEffectNone, + OpcodeBxor: sideEffectNone, + OpcodeRotl: sideEffectNone, + OpcodeRotr: sideEffectNone, + OpcodeFcmp: sideEffectNone, + OpcodeFadd: sideEffectNone, + OpcodeClz: sideEffectNone, + OpcodeCtz: sideEffectNone, + OpcodePopcnt: sideEffectNone, + OpcodeLoad: sideEffectNone, + OpcodeLoadSplat: sideEffectNone, + OpcodeUload8: sideEffectNone, + OpcodeUload16: sideEffectNone, + OpcodeUload32: sideEffectNone, + OpcodeSload8: sideEffectNone, + OpcodeSload16: sideEffectNone, + OpcodeSload32: sideEffectNone, + OpcodeSExtend: sideEffectNone, + OpcodeUExtend: sideEffectNone, + OpcodeSwidenLow: sideEffectNone, + OpcodeUwidenLow: sideEffectNone, + OpcodeSwidenHigh: sideEffectNone, + OpcodeUwidenHigh: sideEffectNone, + OpcodeSnarrow: sideEffectNone, + OpcodeUnarrow: sideEffectNone, + OpcodeSwizzle: sideEffectNone, + OpcodeShuffle: sideEffectNone, + OpcodeSplat: sideEffectNone, + OpcodeFsub: sideEffectNone, + OpcodeF32const: sideEffectNone, + OpcodeF64const: sideEffectNone, + OpcodeIshl: sideEffectNone, + OpcodeSshr: sideEffectNone, + OpcodeUshr: sideEffectNone, + OpcodeStore: sideEffectStrict, + OpcodeIstore8: sideEffectStrict, + OpcodeIstore16: sideEffectStrict, + OpcodeIstore32: sideEffectStrict, + OpcodeExitWithCode: sideEffectStrict, + OpcodeExitIfTrueWithCode: sideEffectStrict, + OpcodeReturn: sideEffectStrict, + OpcodeBrz: sideEffectStrict, + OpcodeBrnz: sideEffectStrict, + OpcodeBrTable: sideEffectStrict, + OpcodeFdiv: sideEffectNone, + OpcodeFmul: sideEffectNone, + OpcodeFmax: sideEffectNone, + OpcodeSqmulRoundSat: sideEffectNone, + OpcodeSelect: sideEffectNone, + OpcodeFmin: sideEffectNone, + OpcodeFneg: sideEffectNone, + OpcodeFcvtToSint: sideEffectTraps, + OpcodeFcvtToUint: sideEffectTraps, + OpcodeFcvtFromSint: sideEffectNone, + OpcodeFcvtFromUint: sideEffectNone, + OpcodeFcvtToSintSat: sideEffectNone, + OpcodeFcvtToUintSat: sideEffectNone, + OpcodeVFcvtFromUint: sideEffectNone, + OpcodeVFcvtFromSint: sideEffectNone, + OpcodeFdemote: sideEffectNone, + OpcodeFvpromoteLow: sideEffectNone, + OpcodeFvdemote: sideEffectNone, + OpcodeFpromote: sideEffectNone, + OpcodeBitcast: sideEffectNone, + OpcodeIreduce: sideEffectNone, + OpcodeSqrt: sideEffectNone, + OpcodeCeil: sideEffectNone, + OpcodeFloor: sideEffectNone, + OpcodeTrunc: sideEffectNone, + OpcodeNearest: sideEffectNone, + OpcodeSdiv: sideEffectTraps, + OpcodeSrem: sideEffectTraps, + OpcodeUdiv: sideEffectTraps, + OpcodeUrem: sideEffectTraps, + OpcodeFabs: sideEffectNone, + OpcodeFcopysign: sideEffectNone, + OpcodeIaddPairwise: sideEffectNone, + OpcodeVconst: sideEffectNone, + OpcodeVbor: sideEffectNone, + OpcodeVbxor: sideEffectNone, + OpcodeVband: sideEffectNone, + OpcodeVbandnot: sideEffectNone, + OpcodeVbnot: sideEffectNone, + OpcodeVbitselect: sideEffectNone, + OpcodeVanyTrue: sideEffectNone, + OpcodeVallTrue: sideEffectNone, + OpcodeVhighBits: sideEffectNone, + OpcodeVIadd: sideEffectNone, + OpcodeVSaddSat: sideEffectNone, + OpcodeVUaddSat: sideEffectNone, + OpcodeVIsub: sideEffectNone, + OpcodeVSsubSat: sideEffectNone, + OpcodeVUsubSat: sideEffectNone, + OpcodeVIcmp: sideEffectNone, + OpcodeVImin: sideEffectNone, + OpcodeVUmin: sideEffectNone, + OpcodeVImax: sideEffectNone, + OpcodeVUmax: sideEffectNone, + OpcodeVAvgRound: sideEffectNone, + OpcodeVImul: sideEffectNone, + OpcodeVIabs: sideEffectNone, + OpcodeVIneg: sideEffectNone, + OpcodeVIpopcnt: sideEffectNone, + OpcodeVIshl: sideEffectNone, + OpcodeVSshr: sideEffectNone, + OpcodeVUshr: sideEffectNone, + OpcodeVSqrt: sideEffectNone, + OpcodeVFabs: sideEffectNone, + OpcodeVFmin: sideEffectNone, + OpcodeVFmax: sideEffectNone, + OpcodeVFneg: sideEffectNone, + OpcodeVFadd: sideEffectNone, + OpcodeVFsub: sideEffectNone, + OpcodeVFmul: sideEffectNone, + OpcodeVFdiv: sideEffectNone, + OpcodeVFcmp: sideEffectNone, + OpcodeVCeil: sideEffectNone, + OpcodeVFloor: sideEffectNone, + OpcodeVTrunc: sideEffectNone, + OpcodeVNearest: sideEffectNone, + OpcodeVMaxPseudo: sideEffectNone, + OpcodeVMinPseudo: sideEffectNone, + OpcodeVFcvtToUintSat: sideEffectNone, + OpcodeVFcvtToSintSat: sideEffectNone, + OpcodeVZeroExtLoad: sideEffectNone, +} + +// sideEffect returns true if this instruction has side effects. +func (i *Instruction) sideEffect() sideEffect { + if e := instructionSideEffects[i.opcode]; e == sideEffectUnknown { + panic("BUG: side effect info not registered for " + i.opcode.String()) + } else { + return e + } +} + +// instructionReturnTypes provides the function to determine the return types of an instruction. +var instructionReturnTypes = [opcodeEnd]returnTypesFn{ + OpcodeIaddPairwise: returnTypesFnV128, + OpcodeVbor: returnTypesFnV128, + OpcodeVbxor: returnTypesFnV128, + OpcodeVband: returnTypesFnV128, + OpcodeVbnot: returnTypesFnV128, + OpcodeVbandnot: returnTypesFnV128, + OpcodeVbitselect: returnTypesFnV128, + OpcodeVanyTrue: returnTypesFnI32, + OpcodeVallTrue: returnTypesFnI32, + OpcodeVhighBits: returnTypesFnI32, + OpcodeVIadd: returnTypesFnV128, + OpcodeVSaddSat: returnTypesFnV128, + OpcodeVUaddSat: returnTypesFnV128, + OpcodeVIsub: returnTypesFnV128, + OpcodeVSsubSat: returnTypesFnV128, + OpcodeVUsubSat: returnTypesFnV128, + OpcodeVIcmp: returnTypesFnV128, + OpcodeVImin: returnTypesFnV128, + OpcodeVUmin: returnTypesFnV128, + OpcodeVImax: returnTypesFnV128, + OpcodeVUmax: returnTypesFnV128, + OpcodeVImul: returnTypesFnV128, + OpcodeVAvgRound: returnTypesFnV128, + OpcodeVIabs: returnTypesFnV128, + OpcodeVIneg: returnTypesFnV128, + OpcodeVIpopcnt: returnTypesFnV128, + OpcodeVIshl: returnTypesFnV128, + OpcodeVSshr: returnTypesFnV128, + OpcodeVUshr: returnTypesFnV128, + OpcodeExtractlane: returnTypesFnSingle, + OpcodeInsertlane: returnTypesFnV128, + OpcodeBand: returnTypesFnSingle, + OpcodeFcopysign: returnTypesFnSingle, + OpcodeBitcast: returnTypesFnSingle, + OpcodeBor: returnTypesFnSingle, + OpcodeBxor: returnTypesFnSingle, + OpcodeRotl: returnTypesFnSingle, + OpcodeRotr: returnTypesFnSingle, + OpcodeIshl: returnTypesFnSingle, + OpcodeSshr: returnTypesFnSingle, + OpcodeSdiv: returnTypesFnSingle, + OpcodeSrem: returnTypesFnSingle, + OpcodeUdiv: returnTypesFnSingle, + OpcodeUrem: returnTypesFnSingle, + OpcodeUshr: returnTypesFnSingle, + OpcodeJump: returnTypesFnNoReturns, + OpcodeUndefined: returnTypesFnNoReturns, + OpcodeIconst: returnTypesFnSingle, + OpcodeSelect: returnTypesFnSingle, + OpcodeSExtend: returnTypesFnSingle, + OpcodeUExtend: returnTypesFnSingle, + OpcodeSwidenLow: returnTypesFnV128, + OpcodeUwidenLow: returnTypesFnV128, + OpcodeSwidenHigh: returnTypesFnV128, + OpcodeUwidenHigh: returnTypesFnV128, + OpcodeSnarrow: returnTypesFnV128, + OpcodeUnarrow: returnTypesFnV128, + OpcodeSwizzle: returnTypesFnSingle, + OpcodeShuffle: returnTypesFnV128, + OpcodeSplat: returnTypesFnV128, + OpcodeIreduce: returnTypesFnSingle, + OpcodeFabs: returnTypesFnSingle, + OpcodeSqrt: returnTypesFnSingle, + OpcodeCeil: returnTypesFnSingle, + OpcodeFloor: returnTypesFnSingle, + OpcodeTrunc: returnTypesFnSingle, + OpcodeNearest: returnTypesFnSingle, + OpcodeCallIndirect: func(b *builder, instr *Instruction) (t1 Type, ts []Type) { + sigID := SignatureID(instr.u1) + sig, ok := b.signatures[sigID] + if !ok { + panic("BUG") + } + switch len(sig.Results) { + case 0: + t1 = typeInvalid + case 1: + t1 = sig.Results[0] + default: + t1, ts = sig.Results[0], sig.Results[1:] + } + return + }, + OpcodeCall: func(b *builder, instr *Instruction) (t1 Type, ts []Type) { + sigID := SignatureID(instr.u2) + sig, ok := b.signatures[sigID] + if !ok { + panic("BUG") + } + switch len(sig.Results) { + case 0: + t1 = typeInvalid + case 1: + t1 = sig.Results[0] + default: + t1, ts = sig.Results[0], sig.Results[1:] + } + return + }, + OpcodeLoad: returnTypesFnSingle, + OpcodeVZeroExtLoad: returnTypesFnV128, + OpcodeLoadSplat: returnTypesFnV128, + OpcodeIadd: returnTypesFnSingle, + OpcodeIsub: returnTypesFnSingle, + OpcodeImul: returnTypesFnSingle, + OpcodeIcmp: returnTypesFnI32, + OpcodeFcmp: returnTypesFnI32, + OpcodeFadd: returnTypesFnSingle, + OpcodeFsub: returnTypesFnSingle, + OpcodeFdiv: returnTypesFnSingle, + OpcodeFmul: returnTypesFnSingle, + OpcodeFmax: returnTypesFnSingle, + OpcodeFmin: returnTypesFnSingle, + OpcodeSqmulRoundSat: returnTypesFnV128, + OpcodeF32const: returnTypesFnF32, + OpcodeF64const: returnTypesFnF64, + OpcodeClz: returnTypesFnSingle, + OpcodeCtz: returnTypesFnSingle, + OpcodePopcnt: returnTypesFnSingle, + OpcodeStore: returnTypesFnNoReturns, + OpcodeIstore8: returnTypesFnNoReturns, + OpcodeIstore16: returnTypesFnNoReturns, + OpcodeIstore32: returnTypesFnNoReturns, + OpcodeExitWithCode: returnTypesFnNoReturns, + OpcodeExitIfTrueWithCode: returnTypesFnNoReturns, + OpcodeReturn: returnTypesFnNoReturns, + OpcodeBrz: returnTypesFnNoReturns, + OpcodeBrnz: returnTypesFnNoReturns, + OpcodeBrTable: returnTypesFnNoReturns, + OpcodeUload8: returnTypesFnSingle, + OpcodeUload16: returnTypesFnSingle, + OpcodeUload32: returnTypesFnSingle, + OpcodeSload8: returnTypesFnSingle, + OpcodeSload16: returnTypesFnSingle, + OpcodeSload32: returnTypesFnSingle, + OpcodeFcvtToSint: returnTypesFnSingle, + OpcodeFcvtToUint: returnTypesFnSingle, + OpcodeFcvtFromSint: returnTypesFnSingle, + OpcodeFcvtFromUint: returnTypesFnSingle, + OpcodeFcvtToSintSat: returnTypesFnSingle, + OpcodeFcvtToUintSat: returnTypesFnSingle, + OpcodeVFcvtFromUint: returnTypesFnV128, + OpcodeVFcvtFromSint: returnTypesFnV128, + OpcodeFneg: returnTypesFnSingle, + OpcodeFdemote: returnTypesFnF32, + OpcodeFvdemote: returnTypesFnV128, + OpcodeFvpromoteLow: returnTypesFnV128, + OpcodeFpromote: returnTypesFnF64, + OpcodeVconst: returnTypesFnV128, + OpcodeVFabs: returnTypesFnV128, + OpcodeVSqrt: returnTypesFnV128, + OpcodeVFmax: returnTypesFnV128, + OpcodeVFmin: returnTypesFnV128, + OpcodeVFneg: returnTypesFnV128, + OpcodeVFadd: returnTypesFnV128, + OpcodeVFsub: returnTypesFnV128, + OpcodeVFmul: returnTypesFnV128, + OpcodeVFdiv: returnTypesFnV128, + OpcodeVFcmp: returnTypesFnV128, + OpcodeVCeil: returnTypesFnV128, + OpcodeVFloor: returnTypesFnV128, + OpcodeVTrunc: returnTypesFnV128, + OpcodeVNearest: returnTypesFnV128, + OpcodeVMaxPseudo: returnTypesFnV128, + OpcodeVMinPseudo: returnTypesFnV128, + OpcodeVFcvtToUintSat: returnTypesFnV128, + OpcodeVFcvtToSintSat: returnTypesFnV128, +} + +// AsLoad initializes this instruction as a store instruction with OpcodeLoad. +func (i *Instruction) AsLoad(ptr Value, offset uint32, typ Type) *Instruction { + i.opcode = OpcodeLoad + i.v = ptr + i.u1 = uint64(offset) + i.typ = typ + return i +} + +// AsExtLoad initializes this instruction as a store instruction with OpcodeLoad. +func (i *Instruction) AsExtLoad(op Opcode, ptr Value, offset uint32, dst64bit bool) *Instruction { + i.opcode = op + i.v = ptr + i.u1 = uint64(offset) + if dst64bit { + i.typ = TypeI64 + } else { + i.typ = TypeI32 + } + return i +} + +// AsVZeroExtLoad initializes this instruction as a store instruction with OpcodeVExtLoad. +func (i *Instruction) AsVZeroExtLoad(ptr Value, offset uint32, scalarType Type) *Instruction { + i.opcode = OpcodeVZeroExtLoad + i.v = ptr + i.u1 = uint64(offset) + i.u2 = uint64(scalarType) + i.typ = TypeV128 + return i +} + +// VZeroExtLoadData returns the operands for a load instruction. The returned `typ` is the scalar type of the load target. +func (i *Instruction) VZeroExtLoadData() (ptr Value, offset uint32, typ Type) { + return i.v, uint32(i.u1), Type(i.u2) +} + +// AsLoadSplat initializes this instruction as a store instruction with OpcodeLoadSplat. +func (i *Instruction) AsLoadSplat(ptr Value, offset uint32, lane VecLane) *Instruction { + i.opcode = OpcodeLoadSplat + i.v = ptr + i.u1 = uint64(offset) + i.u2 = uint64(lane) + i.typ = TypeV128 + return i +} + +// LoadData returns the operands for a load instruction. +func (i *Instruction) LoadData() (ptr Value, offset uint32, typ Type) { + return i.v, uint32(i.u1), i.typ +} + +// LoadSplatData returns the operands for a load splat instruction. +func (i *Instruction) LoadSplatData() (ptr Value, offset uint32, lane VecLane) { + return i.v, uint32(i.u1), VecLane(i.u2) +} + +// AsStore initializes this instruction as a store instruction with OpcodeStore. +func (i *Instruction) AsStore(storeOp Opcode, value, ptr Value, offset uint32) *Instruction { + i.opcode = storeOp + i.v = value + i.v2 = ptr + + var dstSize uint64 + switch storeOp { + case OpcodeStore: + dstSize = uint64(value.Type().Bits()) + case OpcodeIstore8: + dstSize = 8 + case OpcodeIstore16: + dstSize = 16 + case OpcodeIstore32: + dstSize = 32 + default: + panic("invalid store opcode" + storeOp.String()) + } + i.u1 = uint64(offset) | dstSize<<32 + return i +} + +// StoreData returns the operands for a store instruction. +func (i *Instruction) StoreData() (value, ptr Value, offset uint32, storeSizeInBits byte) { + return i.v, i.v2, uint32(i.u1), byte(i.u1 >> 32) +} + +// AsIconst64 initializes this instruction as a 64-bit integer constant instruction with OpcodeIconst. +func (i *Instruction) AsIconst64(v uint64) *Instruction { + i.opcode = OpcodeIconst + i.typ = TypeI64 + i.u1 = v + return i +} + +// AsIconst32 initializes this instruction as a 32-bit integer constant instruction with OpcodeIconst. +func (i *Instruction) AsIconst32(v uint32) *Instruction { + i.opcode = OpcodeIconst + i.typ = TypeI32 + i.u1 = uint64(v) + return i +} + +// AsIadd initializes this instruction as an integer addition instruction with OpcodeIadd. +func (i *Instruction) AsIadd(x, y Value) *Instruction { + i.opcode = OpcodeIadd + i.v = x + i.v2 = y + i.typ = x.Type() + return i +} + +// AsVIadd initializes this instruction as an integer addition instruction with OpcodeVIadd on a vector. +func (i *Instruction) AsVIadd(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeVIadd + i.v = x + i.v2 = y + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsIaddPairwise initializes this instruction as a lane-wise integer extended pairwise addition instruction +// with OpcodeIaddPairwise on a vector. +func (i *Instruction) AsIaddPairwise(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeIaddPairwise + i.v = x + i.v2 = y + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVSaddSat initializes this instruction as a vector addition with saturation instruction with OpcodeVSaddSat on a vector. +func (i *Instruction) AsVSaddSat(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeVSaddSat + i.v = x + i.v2 = y + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVUaddSat initializes this instruction as a vector addition with saturation instruction with OpcodeVUaddSat on a vector. +func (i *Instruction) AsVUaddSat(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeVUaddSat + i.v = x + i.v2 = y + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVIsub initializes this instruction as an integer subtraction instruction with OpcodeVIsub on a vector. +func (i *Instruction) AsVIsub(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeVIsub + i.v = x + i.v2 = y + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVSsubSat initializes this instruction as a vector addition with saturation instruction with OpcodeVSsubSat on a vector. +func (i *Instruction) AsVSsubSat(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeVSsubSat + i.v = x + i.v2 = y + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVUsubSat initializes this instruction as a vector addition with saturation instruction with OpcodeVUsubSat on a vector. +func (i *Instruction) AsVUsubSat(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeVUsubSat + i.v = x + i.v2 = y + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVImin initializes this instruction as a signed integer min instruction with OpcodeVImin on a vector. +func (i *Instruction) AsVImin(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeVImin + i.v = x + i.v2 = y + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVUmin initializes this instruction as an unsigned integer min instruction with OpcodeVUmin on a vector. +func (i *Instruction) AsVUmin(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeVUmin + i.v = x + i.v2 = y + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVImax initializes this instruction as a signed integer max instruction with OpcodeVImax on a vector. +func (i *Instruction) AsVImax(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeVImax + i.v = x + i.v2 = y + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVUmax initializes this instruction as an unsigned integer max instruction with OpcodeVUmax on a vector. +func (i *Instruction) AsVUmax(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeVUmax + i.v = x + i.v2 = y + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVAvgRound initializes this instruction as an unsigned integer avg instruction, truncating to zero with OpcodeVAvgRound on a vector. +func (i *Instruction) AsVAvgRound(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeVAvgRound + i.v = x + i.v2 = y + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVImul initializes this instruction as an integer multiplication with OpcodeVImul on a vector. +func (i *Instruction) AsVImul(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeVImul + i.v = x + i.v2 = y + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsSqmulRoundSat initializes this instruction as a lane-wise saturating rounding multiplication +// in Q15 format with OpcodeSqmulRoundSat on a vector. +func (i *Instruction) AsSqmulRoundSat(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeSqmulRoundSat + i.v = x + i.v2 = y + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVIabs initializes this instruction as a vector absolute value with OpcodeVIabs. +func (i *Instruction) AsVIabs(x Value, lane VecLane) *Instruction { + i.opcode = OpcodeVIabs + i.v = x + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVIneg initializes this instruction as a vector negation with OpcodeVIneg. +func (i *Instruction) AsVIneg(x Value, lane VecLane) *Instruction { + i.opcode = OpcodeVIneg + i.v = x + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVIpopcnt initializes this instruction as a Population Count instruction with OpcodeVIpopcnt on a vector. +func (i *Instruction) AsVIpopcnt(x Value, lane VecLane) *Instruction { + if lane != VecLaneI8x16 { + panic("Unsupported lane type " + lane.String()) + } + i.opcode = OpcodeVIpopcnt + i.v = x + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVSqrt initializes this instruction as a sqrt instruction with OpcodeVSqrt on a vector. +func (i *Instruction) AsVSqrt(x Value, lane VecLane) *Instruction { + i.opcode = OpcodeVSqrt + i.v = x + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVFabs initializes this instruction as a float abs instruction with OpcodeVFabs on a vector. +func (i *Instruction) AsVFabs(x Value, lane VecLane) *Instruction { + i.opcode = OpcodeVFabs + i.v = x + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVFneg initializes this instruction as a float neg instruction with OpcodeVFneg on a vector. +func (i *Instruction) AsVFneg(x Value, lane VecLane) *Instruction { + i.opcode = OpcodeVFneg + i.v = x + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVFmax initializes this instruction as a float max instruction with OpcodeVFmax on a vector. +func (i *Instruction) AsVFmax(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeVFmax + i.v = x + i.v2 = y + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVFmin initializes this instruction as a float min instruction with OpcodeVFmin on a vector. +func (i *Instruction) AsVFmin(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeVFmin + i.v = x + i.v2 = y + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVFadd initializes this instruction as a floating point add instruction with OpcodeVFadd on a vector. +func (i *Instruction) AsVFadd(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeVFadd + i.v = x + i.v2 = y + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVFsub initializes this instruction as a floating point subtraction instruction with OpcodeVFsub on a vector. +func (i *Instruction) AsVFsub(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeVFsub + i.v = x + i.v2 = y + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVFmul initializes this instruction as a floating point multiplication instruction with OpcodeVFmul on a vector. +func (i *Instruction) AsVFmul(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeVFmul + i.v = x + i.v2 = y + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVFdiv initializes this instruction as a floating point division instruction with OpcodeVFdiv on a vector. +func (i *Instruction) AsVFdiv(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeVFdiv + i.v = x + i.v2 = y + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsImul initializes this instruction as an integer addition instruction with OpcodeImul. +func (i *Instruction) AsImul(x, y Value) *Instruction { + i.opcode = OpcodeImul + i.v = x + i.v2 = y + i.typ = x.Type() + return i +} + +func (i *Instruction) Insert(b Builder) *Instruction { + b.InsertInstruction(i) + return i +} + +// AsIsub initializes this instruction as an integer subtraction instruction with OpcodeIsub. +func (i *Instruction) AsIsub(x, y Value) *Instruction { + i.opcode = OpcodeIsub + i.v = x + i.v2 = y + i.typ = x.Type() + return i +} + +// AsIcmp initializes this instruction as an integer comparison instruction with OpcodeIcmp. +func (i *Instruction) AsIcmp(x, y Value, c IntegerCmpCond) *Instruction { + i.opcode = OpcodeIcmp + i.v = x + i.v2 = y + i.u1 = uint64(c) + i.typ = TypeI32 + return i +} + +// AsFcmp initializes this instruction as an integer comparison instruction with OpcodeFcmp. +func (i *Instruction) AsFcmp(x, y Value, c FloatCmpCond) { + i.opcode = OpcodeFcmp + i.v = x + i.v2 = y + i.u1 = uint64(c) + i.typ = TypeI32 +} + +// AsVIcmp initializes this instruction as an integer vector comparison instruction with OpcodeVIcmp. +func (i *Instruction) AsVIcmp(x, y Value, c IntegerCmpCond, lane VecLane) *Instruction { + i.opcode = OpcodeVIcmp + i.v = x + i.v2 = y + i.u1 = uint64(c) + i.u2 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsVFcmp initializes this instruction as a float comparison instruction with OpcodeVFcmp on Vector. +func (i *Instruction) AsVFcmp(x, y Value, c FloatCmpCond, lane VecLane) *Instruction { + i.opcode = OpcodeVFcmp + i.v = x + i.v2 = y + i.u1 = uint64(c) + i.typ = TypeV128 + i.u2 = uint64(lane) + return i +} + +// AsVCeil initializes this instruction as an instruction with OpcodeCeil. +func (i *Instruction) AsVCeil(x Value, lane VecLane) *Instruction { + i.opcode = OpcodeVCeil + i.v = x + i.typ = x.Type() + i.u1 = uint64(lane) + return i +} + +// AsVFloor initializes this instruction as an instruction with OpcodeFloor. +func (i *Instruction) AsVFloor(x Value, lane VecLane) *Instruction { + i.opcode = OpcodeVFloor + i.v = x + i.typ = x.Type() + i.u1 = uint64(lane) + return i +} + +// AsVTrunc initializes this instruction as an instruction with OpcodeTrunc. +func (i *Instruction) AsVTrunc(x Value, lane VecLane) *Instruction { + i.opcode = OpcodeVTrunc + i.v = x + i.typ = x.Type() + i.u1 = uint64(lane) + return i +} + +// AsVNearest initializes this instruction as an instruction with OpcodeNearest. +func (i *Instruction) AsVNearest(x Value, lane VecLane) *Instruction { + i.opcode = OpcodeVNearest + i.v = x + i.typ = x.Type() + i.u1 = uint64(lane) + return i +} + +// AsVMaxPseudo initializes this instruction as an instruction with OpcodeVMaxPseudo. +func (i *Instruction) AsVMaxPseudo(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeVMaxPseudo + i.typ = x.Type() + i.v = x + i.v2 = y + i.u1 = uint64(lane) + return i +} + +// AsVMinPseudo initializes this instruction as an instruction with OpcodeVMinPseudo. +func (i *Instruction) AsVMinPseudo(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeVMinPseudo + i.typ = x.Type() + i.v = x + i.v2 = y + i.u1 = uint64(lane) + return i +} + +// AsSDiv initializes this instruction as an integer bitwise and instruction with OpcodeSdiv. +func (i *Instruction) AsSDiv(x, y, ctx Value) *Instruction { + i.opcode = OpcodeSdiv + i.v = x + i.v2 = y + i.v3 = ctx + i.typ = x.Type() + return i +} + +// AsUDiv initializes this instruction as an integer bitwise and instruction with OpcodeUdiv. +func (i *Instruction) AsUDiv(x, y, ctx Value) *Instruction { + i.opcode = OpcodeUdiv + i.v = x + i.v2 = y + i.v3 = ctx + i.typ = x.Type() + return i +} + +// AsSRem initializes this instruction as an integer bitwise and instruction with OpcodeSrem. +func (i *Instruction) AsSRem(x, y, ctx Value) *Instruction { + i.opcode = OpcodeSrem + i.v = x + i.v2 = y + i.v3 = ctx + i.typ = x.Type() + return i +} + +// AsURem initializes this instruction as an integer bitwise and instruction with OpcodeUrem. +func (i *Instruction) AsURem(x, y, ctx Value) *Instruction { + i.opcode = OpcodeUrem + i.v = x + i.v2 = y + i.v3 = ctx + i.typ = x.Type() + return i +} + +// AsBand initializes this instruction as an integer bitwise and instruction with OpcodeBand. +func (i *Instruction) AsBand(x, amount Value) { + i.opcode = OpcodeBand + i.v = x + i.v2 = amount + i.typ = x.Type() +} + +// AsBor initializes this instruction as an integer bitwise or instruction with OpcodeBor. +func (i *Instruction) AsBor(x, amount Value) { + i.opcode = OpcodeBor + i.v = x + i.v2 = amount + i.typ = x.Type() +} + +// AsBxor initializes this instruction as an integer bitwise xor instruction with OpcodeBxor. +func (i *Instruction) AsBxor(x, amount Value) { + i.opcode = OpcodeBxor + i.v = x + i.v2 = amount + i.typ = x.Type() +} + +// AsIshl initializes this instruction as an integer shift left instruction with OpcodeIshl. +func (i *Instruction) AsIshl(x, amount Value) *Instruction { + i.opcode = OpcodeIshl + i.v = x + i.v2 = amount + i.typ = x.Type() + return i +} + +// AsVIshl initializes this instruction as an integer shift left instruction with OpcodeVIshl on vector. +func (i *Instruction) AsVIshl(x, amount Value, lane VecLane) *Instruction { + i.opcode = OpcodeVIshl + i.v = x + i.v2 = amount + i.u1 = uint64(lane) + i.typ = x.Type() + return i +} + +// AsUshr initializes this instruction as an integer unsigned shift right (logical shift right) instruction with OpcodeUshr. +func (i *Instruction) AsUshr(x, amount Value) *Instruction { + i.opcode = OpcodeUshr + i.v = x + i.v2 = amount + i.typ = x.Type() + return i +} + +// AsVUshr initializes this instruction as an integer unsigned shift right (logical shift right) instruction with OpcodeVUshr on vector. +func (i *Instruction) AsVUshr(x, amount Value, lane VecLane) *Instruction { + i.opcode = OpcodeVUshr + i.v = x + i.v2 = amount + i.u1 = uint64(lane) + i.typ = x.Type() + return i +} + +// AsSshr initializes this instruction as an integer signed shift right (arithmetic shift right) instruction with OpcodeSshr. +func (i *Instruction) AsSshr(x, amount Value) *Instruction { + i.opcode = OpcodeSshr + i.v = x + i.v2 = amount + i.typ = x.Type() + return i +} + +// AsVSshr initializes this instruction as an integer signed shift right (arithmetic shift right) instruction with OpcodeVSshr on vector. +func (i *Instruction) AsVSshr(x, amount Value, lane VecLane) *Instruction { + i.opcode = OpcodeVSshr + i.v = x + i.v2 = amount + i.u1 = uint64(lane) + i.typ = x.Type() + return i +} + +// AsExtractlane initializes this instruction as an extract lane instruction with OpcodeExtractlane on vector. +func (i *Instruction) AsExtractlane(x Value, index byte, lane VecLane, signed bool) *Instruction { + i.opcode = OpcodeExtractlane + i.v = x + // We do not have a field for signedness, but `index` is a byte, + // so we just encode the flag in the high bits of `u1`. + i.u1 = uint64(index) + if signed { + i.u1 = i.u1 | 1<<32 + } + i.u2 = uint64(lane) + switch lane { + case VecLaneI8x16, VecLaneI16x8, VecLaneI32x4: + i.typ = TypeI32 + case VecLaneI64x2: + i.typ = TypeI64 + case VecLaneF32x4: + i.typ = TypeF32 + case VecLaneF64x2: + i.typ = TypeF64 + } + return i +} + +// AsInsertlane initializes this instruction as an insert lane instruction with OpcodeInsertlane on vector. +func (i *Instruction) AsInsertlane(x, y Value, index byte, lane VecLane) *Instruction { + i.opcode = OpcodeInsertlane + i.v = x + i.v2 = y + i.u1 = uint64(index) + i.u2 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsShuffle initializes this instruction as a shuffle instruction with OpcodeShuffle on vector. +func (i *Instruction) AsShuffle(x, y Value, lane []byte) *Instruction { + i.opcode = OpcodeShuffle + i.v = x + i.v2 = y + // Encode the 16 bytes as 8 bytes in u1, and 8 bytes in u2. + i.u1 = uint64(lane[7])<<56 | uint64(lane[6])<<48 | uint64(lane[5])<<40 | uint64(lane[4])<<32 | uint64(lane[3])<<24 | uint64(lane[2])<<16 | uint64(lane[1])<<8 | uint64(lane[0]) + i.u2 = uint64(lane[15])<<56 | uint64(lane[14])<<48 | uint64(lane[13])<<40 | uint64(lane[12])<<32 | uint64(lane[11])<<24 | uint64(lane[10])<<16 | uint64(lane[9])<<8 | uint64(lane[8]) + i.typ = TypeV128 + return i +} + +// AsSwizzle initializes this instruction as an insert lane instruction with OpcodeSwizzle on vector. +func (i *Instruction) AsSwizzle(x, y Value, lane VecLane) *Instruction { + i.opcode = OpcodeSwizzle + i.v = x + i.v2 = y + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsSplat initializes this instruction as an insert lane instruction with OpcodeSplat on vector. +func (i *Instruction) AsSplat(x Value, lane VecLane) *Instruction { + i.opcode = OpcodeSplat + i.v = x + i.u1 = uint64(lane) + i.typ = TypeV128 + return i +} + +// AsRotl initializes this instruction as a word rotate left instruction with OpcodeRotl. +func (i *Instruction) AsRotl(x, amount Value) { + i.opcode = OpcodeRotl + i.v = x + i.v2 = amount + i.typ = x.Type() +} + +// AsRotr initializes this instruction as a word rotate right instruction with OpcodeRotr. +func (i *Instruction) AsRotr(x, amount Value) { + i.opcode = OpcodeRotr + i.v = x + i.v2 = amount + i.typ = x.Type() +} + +// IcmpData returns the operands and comparison condition of this integer comparison instruction. +func (i *Instruction) IcmpData() (x, y Value, c IntegerCmpCond) { + return i.v, i.v2, IntegerCmpCond(i.u1) +} + +// FcmpData returns the operands and comparison condition of this floating-point comparison instruction. +func (i *Instruction) FcmpData() (x, y Value, c FloatCmpCond) { + return i.v, i.v2, FloatCmpCond(i.u1) +} + +// VIcmpData returns the operands and comparison condition of this integer comparison instruction on vector. +func (i *Instruction) VIcmpData() (x, y Value, c IntegerCmpCond, l VecLane) { + return i.v, i.v2, IntegerCmpCond(i.u1), VecLane(i.u2) +} + +// VFcmpData returns the operands and comparison condition of this float comparison instruction on vector. +func (i *Instruction) VFcmpData() (x, y Value, c FloatCmpCond, l VecLane) { + return i.v, i.v2, FloatCmpCond(i.u1), VecLane(i.u2) +} + +// ExtractlaneData returns the operands and sign flag of Extractlane on vector. +func (i *Instruction) ExtractlaneData() (x Value, index byte, signed bool, l VecLane) { + x = i.v + index = byte(0b00001111 & i.u1) + signed = i.u1>>32 != 0 + l = VecLane(i.u2) + return +} + +// InsertlaneData returns the operands and sign flag of Insertlane on vector. +func (i *Instruction) InsertlaneData() (x, y Value, index byte, l VecLane) { + x = i.v + y = i.v2 + index = byte(i.u1) + l = VecLane(i.u2) + return +} + +// AsFadd initializes this instruction as a floating-point addition instruction with OpcodeFadd. +func (i *Instruction) AsFadd(x, y Value) { + i.opcode = OpcodeFadd + i.v = x + i.v2 = y + i.typ = x.Type() +} + +// AsFsub initializes this instruction as a floating-point subtraction instruction with OpcodeFsub. +func (i *Instruction) AsFsub(x, y Value) { + i.opcode = OpcodeFsub + i.v = x + i.v2 = y + i.typ = x.Type() +} + +// AsFmul initializes this instruction as a floating-point multiplication instruction with OpcodeFmul. +func (i *Instruction) AsFmul(x, y Value) { + i.opcode = OpcodeFmul + i.v = x + i.v2 = y + i.typ = x.Type() +} + +// AsFdiv initializes this instruction as a floating-point division instruction with OpcodeFdiv. +func (i *Instruction) AsFdiv(x, y Value) { + i.opcode = OpcodeFdiv + i.v = x + i.v2 = y + i.typ = x.Type() +} + +// AsFmin initializes this instruction to take the minimum of two floating-points with OpcodeFmin. +func (i *Instruction) AsFmin(x, y Value) { + i.opcode = OpcodeFmin + i.v = x + i.v2 = y + i.typ = x.Type() +} + +// AsFmax initializes this instruction to take the maximum of two floating-points with OpcodeFmax. +func (i *Instruction) AsFmax(x, y Value) { + i.opcode = OpcodeFmax + i.v = x + i.v2 = y + i.typ = x.Type() +} + +// AsF32const initializes this instruction as a 32-bit floating-point constant instruction with OpcodeF32const. +func (i *Instruction) AsF32const(f float32) *Instruction { + i.opcode = OpcodeF32const + i.typ = TypeF64 + i.u1 = uint64(math.Float32bits(f)) + return i +} + +// AsF64const initializes this instruction as a 64-bit floating-point constant instruction with OpcodeF64const. +func (i *Instruction) AsF64const(f float64) *Instruction { + i.opcode = OpcodeF64const + i.typ = TypeF64 + i.u1 = math.Float64bits(f) + return i +} + +// AsVconst initializes this instruction as a vector constant instruction with OpcodeVconst. +func (i *Instruction) AsVconst(lo, hi uint64) *Instruction { + i.opcode = OpcodeVconst + i.typ = TypeV128 + i.u1 = lo + i.u2 = hi + return i +} + +// AsVbnot initializes this instruction as a vector negation instruction with OpcodeVbnot. +func (i *Instruction) AsVbnot(v Value) *Instruction { + i.opcode = OpcodeVbnot + i.typ = TypeV128 + i.v = v + return i +} + +// AsVband initializes this instruction as an and vector instruction with OpcodeVband. +func (i *Instruction) AsVband(x, y Value) *Instruction { + i.opcode = OpcodeVband + i.typ = TypeV128 + i.v = x + i.v2 = y + return i +} + +// AsVbor initializes this instruction as an or vector instruction with OpcodeVbor. +func (i *Instruction) AsVbor(x, y Value) *Instruction { + i.opcode = OpcodeVbor + i.typ = TypeV128 + i.v = x + i.v2 = y + return i +} + +// AsVbxor initializes this instruction as a xor vector instruction with OpcodeVbxor. +func (i *Instruction) AsVbxor(x, y Value) *Instruction { + i.opcode = OpcodeVbxor + i.typ = TypeV128 + i.v = x + i.v2 = y + return i +} + +// AsVbandnot initializes this instruction as an and-not vector instruction with OpcodeVbandnot. +func (i *Instruction) AsVbandnot(x, y Value) *Instruction { + i.opcode = OpcodeVbandnot + i.typ = TypeV128 + i.v = x + i.v2 = y + return i +} + +// AsVbitselect initializes this instruction as a bit select vector instruction with OpcodeVbitselect. +func (i *Instruction) AsVbitselect(c, x, y Value) *Instruction { + i.opcode = OpcodeVbitselect + i.typ = TypeV128 + i.v = c + i.v2 = x + i.v3 = y + return i +} + +// AsVanyTrue initializes this instruction as an anyTrue vector instruction with OpcodeVanyTrue. +func (i *Instruction) AsVanyTrue(x Value) *Instruction { + i.opcode = OpcodeVanyTrue + i.typ = TypeI32 + i.v = x + return i +} + +// AsVallTrue initializes this instruction as an allTrue vector instruction with OpcodeVallTrue. +func (i *Instruction) AsVallTrue(x Value, lane VecLane) *Instruction { + i.opcode = OpcodeVallTrue + i.typ = TypeI32 + i.v = x + i.u1 = uint64(lane) + return i +} + +// AsVhighBits initializes this instruction as a highBits vector instruction with OpcodeVhighBits. +func (i *Instruction) AsVhighBits(x Value, lane VecLane) *Instruction { + i.opcode = OpcodeVhighBits + i.typ = TypeI32 + i.v = x + i.u1 = uint64(lane) + return i +} + +// VconstData returns the operands of this vector constant instruction. +func (i *Instruction) VconstData() (lo, hi uint64) { + return i.u1, i.u2 +} + +// AsReturn initializes this instruction as a return instruction with OpcodeReturn. +func (i *Instruction) AsReturn(vs []Value) *Instruction { + i.opcode = OpcodeReturn + i.vs = vs + return i +} + +// AsIreduce initializes this instruction as a reduction instruction with OpcodeIreduce. +func (i *Instruction) AsIreduce(v Value, dstType Type) *Instruction { + i.opcode = OpcodeIreduce + i.v = v + i.typ = dstType + return i +} + +// AsWiden initializes this instruction as a signed or unsigned widen instruction +// on low half or high half of the given vector with OpcodeSwidenLow, OpcodeUwidenLow, OpcodeSwidenHigh, OpcodeUwidenHigh. +func (i *Instruction) AsWiden(v Value, lane VecLane, signed, low bool) *Instruction { + switch { + case signed && low: + i.opcode = OpcodeSwidenLow + case !signed && low: + i.opcode = OpcodeUwidenLow + case signed && !low: + i.opcode = OpcodeSwidenHigh + case !signed && !low: + i.opcode = OpcodeUwidenHigh + } + i.v = v + i.u1 = uint64(lane) + return i +} + +// ReturnVals returns the return values of OpcodeReturn. +func (i *Instruction) ReturnVals() []Value { + return i.vs +} + +// AsExitWithCode initializes this instruction as a trap instruction with OpcodeExitWithCode. +func (i *Instruction) AsExitWithCode(ctx Value, code wazevoapi.ExitCode) { + i.opcode = OpcodeExitWithCode + i.v = ctx + i.u1 = uint64(code) +} + +// AsExitIfTrueWithCode initializes this instruction as a trap instruction with OpcodeExitIfTrueWithCode. +func (i *Instruction) AsExitIfTrueWithCode(ctx, c Value, code wazevoapi.ExitCode) *Instruction { + i.opcode = OpcodeExitIfTrueWithCode + i.v = ctx + i.v2 = c + i.u1 = uint64(code) + return i +} + +// ExitWithCodeData returns the context and exit code of OpcodeExitWithCode. +func (i *Instruction) ExitWithCodeData() (ctx Value, code wazevoapi.ExitCode) { + return i.v, wazevoapi.ExitCode(i.u1) +} + +// ExitIfTrueWithCodeData returns the context and exit code of OpcodeExitWithCode. +func (i *Instruction) ExitIfTrueWithCodeData() (ctx, c Value, code wazevoapi.ExitCode) { + return i.v, i.v2, wazevoapi.ExitCode(i.u1) +} + +// InvertBrx inverts either OpcodeBrz or OpcodeBrnz to the other. +func (i *Instruction) InvertBrx() { + switch i.opcode { + case OpcodeBrz: + i.opcode = OpcodeBrnz + case OpcodeBrnz: + i.opcode = OpcodeBrz + default: + panic("BUG") + } +} + +// BranchData returns the branch data for this instruction necessary for backends. +func (i *Instruction) BranchData() (condVal Value, blockArgs []Value, target BasicBlock) { + switch i.opcode { + case OpcodeJump: + condVal = ValueInvalid + case OpcodeBrz, OpcodeBrnz: + condVal = i.v + default: + panic("BUG") + } + blockArgs = i.vs + target = i.blk + return +} + +// BrTableData returns the branch table data for this instruction necessary for backends. +func (i *Instruction) BrTableData() (index Value, targets []BasicBlock) { + if i.opcode != OpcodeBrTable { + panic("BUG: BrTableData only available for OpcodeBrTable") + } + index = i.v + targets = i.targets + return +} + +// AsJump initializes this instruction as a jump instruction with OpcodeJump. +func (i *Instruction) AsJump(vs []Value, target BasicBlock) { + i.opcode = OpcodeJump + i.vs = vs + i.blk = target +} + +// IsFallthroughJump returns true if this instruction is a fallthrough jump. +func (i *Instruction) IsFallthroughJump() bool { + if i.opcode != OpcodeJump { + panic("BUG: IsFallthrough only available for OpcodeJump") + } + return i.opcode == OpcodeJump && i.u1 != 0 +} + +// AsFallthroughJump marks this instruction as a fallthrough jump. +func (i *Instruction) AsFallthroughJump() { + if i.opcode != OpcodeJump { + panic("BUG: AsFallthroughJump only available for OpcodeJump") + } + i.u1 = 1 +} + +// AsBrz initializes this instruction as a branch-if-zero instruction with OpcodeBrz. +func (i *Instruction) AsBrz(v Value, args []Value, target BasicBlock) { + i.opcode = OpcodeBrz + i.v = v + i.vs = args + i.blk = target +} + +// AsBrnz initializes this instruction as a branch-if-not-zero instruction with OpcodeBrnz. +func (i *Instruction) AsBrnz(v Value, args []Value, target BasicBlock) *Instruction { + i.opcode = OpcodeBrnz + i.v = v + i.vs = args + i.blk = target + return i +} + +// AsBrTable initializes this instruction as a branch-table instruction with OpcodeBrTable. +func (i *Instruction) AsBrTable(index Value, targets []BasicBlock) { + i.opcode = OpcodeBrTable + i.v = index + i.targets = targets +} + +// AsCall initializes this instruction as a call instruction with OpcodeCall. +func (i *Instruction) AsCall(ref FuncRef, sig *Signature, args []Value) { + i.opcode = OpcodeCall + i.u1 = uint64(ref) + i.vs = args + i.u2 = uint64(sig.ID) + sig.used = true +} + +// CallData returns the call data for this instruction necessary for backends. +func (i *Instruction) CallData() (ref FuncRef, sigID SignatureID, args []Value) { + if i.opcode != OpcodeCall { + panic("BUG: CallData only available for OpcodeCall") + } + ref = FuncRef(i.u1) + sigID = SignatureID(i.u2) + args = i.vs + return +} + +// AsCallIndirect initializes this instruction as a call-indirect instruction with OpcodeCallIndirect. +func (i *Instruction) AsCallIndirect(funcPtr Value, sig *Signature, args []Value) *Instruction { + i.opcode = OpcodeCallIndirect + i.typ = TypeF64 + i.vs = args + i.v = funcPtr + i.u1 = uint64(sig.ID) + sig.used = true + return i +} + +// CallIndirectData returns the call indirect data for this instruction necessary for backends. +func (i *Instruction) CallIndirectData() (funcPtr Value, sigID SignatureID, args []Value) { + if i.opcode != OpcodeCallIndirect { + panic("BUG: CallIndirectData only available for OpcodeCallIndirect") + } + funcPtr = i.v + sigID = SignatureID(i.u1) + args = i.vs + return +} + +// AsClz initializes this instruction as a Count Leading Zeroes instruction with OpcodeClz. +func (i *Instruction) AsClz(x Value) { + i.opcode = OpcodeClz + i.v = x + i.typ = x.Type() +} + +// AsCtz initializes this instruction as a Count Trailing Zeroes instruction with OpcodeCtz. +func (i *Instruction) AsCtz(x Value) { + i.opcode = OpcodeCtz + i.v = x + i.typ = x.Type() +} + +// AsPopcnt initializes this instruction as a Population Count instruction with OpcodePopcnt. +func (i *Instruction) AsPopcnt(x Value) { + i.opcode = OpcodePopcnt + i.v = x + i.typ = x.Type() +} + +// AsFneg initializes this instruction as an instruction with OpcodeFneg. +func (i *Instruction) AsFneg(x Value) *Instruction { + i.opcode = OpcodeFneg + i.v = x + i.typ = x.Type() + return i +} + +// AsSqrt initializes this instruction as an instruction with OpcodeSqrt. +func (i *Instruction) AsSqrt(x Value) *Instruction { + i.opcode = OpcodeSqrt + i.v = x + i.typ = x.Type() + return i +} + +// AsFabs initializes this instruction as an instruction with OpcodeFabs. +func (i *Instruction) AsFabs(x Value) *Instruction { + i.opcode = OpcodeFabs + i.v = x + i.typ = x.Type() + return i +} + +// AsFcopysign initializes this instruction as an instruction with OpcodeFcopysign. +func (i *Instruction) AsFcopysign(x, y Value) *Instruction { + i.opcode = OpcodeFcopysign + i.v = x + i.v2 = y + i.typ = x.Type() + return i +} + +// AsCeil initializes this instruction as an instruction with OpcodeCeil. +func (i *Instruction) AsCeil(x Value) *Instruction { + i.opcode = OpcodeCeil + i.v = x + i.typ = x.Type() + return i +} + +// AsFloor initializes this instruction as an instruction with OpcodeFloor. +func (i *Instruction) AsFloor(x Value) *Instruction { + i.opcode = OpcodeFloor + i.v = x + i.typ = x.Type() + return i +} + +// AsTrunc initializes this instruction as an instruction with OpcodeTrunc. +func (i *Instruction) AsTrunc(x Value) *Instruction { + i.opcode = OpcodeTrunc + i.v = x + i.typ = x.Type() + return i +} + +// AsNearest initializes this instruction as an instruction with OpcodeNearest. +func (i *Instruction) AsNearest(x Value) *Instruction { + i.opcode = OpcodeNearest + i.v = x + i.typ = x.Type() + return i +} + +// AsBitcast initializes this instruction as an instruction with OpcodeBitcast. +func (i *Instruction) AsBitcast(x Value, dstType Type) *Instruction { + i.opcode = OpcodeBitcast + i.v = x + i.typ = dstType + return i +} + +// BitcastData returns the operands for a bitcast instruction. +func (i *Instruction) BitcastData() (x Value, dstType Type) { + return i.v, i.typ +} + +// AsFdemote initializes this instruction as an instruction with OpcodeFdemote. +func (i *Instruction) AsFdemote(x Value) { + i.opcode = OpcodeFdemote + i.v = x + i.typ = TypeF32 +} + +// AsFpromote initializes this instruction as an instruction with OpcodeFpromote. +func (i *Instruction) AsFpromote(x Value) { + i.opcode = OpcodeFpromote + i.v = x + i.typ = TypeF64 +} + +// AsFcvtFromInt initializes this instruction as an instruction with either OpcodeFcvtFromUint or OpcodeFcvtFromSint +func (i *Instruction) AsFcvtFromInt(x Value, signed bool, dst64bit bool) *Instruction { + if signed { + i.opcode = OpcodeFcvtFromSint + } else { + i.opcode = OpcodeFcvtFromUint + } + i.v = x + if dst64bit { + i.typ = TypeF64 + } else { + i.typ = TypeF32 + } + return i +} + +// AsFcvtToInt initializes this instruction as an instruction with either OpcodeFcvtToUint or OpcodeFcvtToSint +func (i *Instruction) AsFcvtToInt(x, ctx Value, signed bool, dst64bit bool, sat bool) *Instruction { + switch { + case signed && !sat: + i.opcode = OpcodeFcvtToSint + case !signed && !sat: + i.opcode = OpcodeFcvtToUint + case signed && sat: + i.opcode = OpcodeFcvtToSintSat + case !signed && sat: + i.opcode = OpcodeFcvtToUintSat + } + i.v = x + i.v2 = ctx + if dst64bit { + i.typ = TypeI64 + } else { + i.typ = TypeI32 + } + return i +} + +// AsVFcvtToIntSat initializes this instruction as an instruction with either OpcodeVFcvtToSintSat or OpcodeVFcvtToUintSat +func (i *Instruction) AsVFcvtToIntSat(x Value, lane VecLane, signed bool) *Instruction { + if signed { + i.opcode = OpcodeVFcvtToSintSat + } else { + i.opcode = OpcodeVFcvtToUintSat + } + i.v = x + i.u1 = uint64(lane) + return i +} + +// AsVFcvtFromInt initializes this instruction as an instruction with either OpcodeVFcvtToSintSat or OpcodeVFcvtToUintSat +func (i *Instruction) AsVFcvtFromInt(x Value, lane VecLane, signed bool) *Instruction { + if signed { + i.opcode = OpcodeVFcvtFromSint + } else { + i.opcode = OpcodeVFcvtFromUint + } + i.v = x + i.u1 = uint64(lane) + return i +} + +// AsNarrow initializes this instruction as an instruction with either OpcodeSnarrow or OpcodeUnarrow +func (i *Instruction) AsNarrow(x, y Value, lane VecLane, signed bool) *Instruction { + if signed { + i.opcode = OpcodeSnarrow + } else { + i.opcode = OpcodeUnarrow + } + i.v = x + i.v2 = y + i.u1 = uint64(lane) + return i +} + +// AsFvpromoteLow initializes this instruction as an instruction with OpcodeFvpromoteLow +func (i *Instruction) AsFvpromoteLow(x Value, lane VecLane) *Instruction { + i.opcode = OpcodeFvpromoteLow + i.v = x + i.u1 = uint64(lane) + return i +} + +// AsFvdemote initializes this instruction as an instruction with OpcodeFvdemote +func (i *Instruction) AsFvdemote(x Value, lane VecLane) *Instruction { + i.opcode = OpcodeFvdemote + i.v = x + i.u1 = uint64(lane) + return i +} + +// AsSExtend initializes this instruction as a sign extension instruction with OpcodeSExtend. +func (i *Instruction) AsSExtend(v Value, from, to byte) *Instruction { + i.opcode = OpcodeSExtend + i.v = v + i.u1 = uint64(from)<<8 | uint64(to) + if to == 64 { + i.typ = TypeI64 + } else { + i.typ = TypeI32 + } + return i +} + +// AsUExtend initializes this instruction as an unsigned extension instruction with OpcodeUExtend. +func (i *Instruction) AsUExtend(v Value, from, to byte) *Instruction { + i.opcode = OpcodeUExtend + i.v = v + i.u1 = uint64(from)<<8 | uint64(to) + if to == 64 { + i.typ = TypeI64 + } else { + i.typ = TypeI32 + } + return i +} + +func (i *Instruction) ExtendData() (from, to byte, signed bool) { + if i.opcode != OpcodeSExtend && i.opcode != OpcodeUExtend { + panic("BUG: ExtendData only available for OpcodeSExtend and OpcodeUExtend") + } + from = byte(i.u1 >> 8) + to = byte(i.u1) + signed = i.opcode == OpcodeSExtend + return +} + +// AsSelect initializes this instruction as an unsigned extension instruction with OpcodeSelect. +func (i *Instruction) AsSelect(c, x, y Value) *Instruction { + i.opcode = OpcodeSelect + i.v = c + i.v2 = x + i.v3 = y + i.typ = x.Type() + return i +} + +// SelectData returns the select data for this instruction necessary for backends. +func (i *Instruction) SelectData() (c, x, y Value) { + c = i.v + x = i.v2 + y = i.v3 + return +} + +// ExtendFromToBits returns the from and to bit size for the extension instruction. +func (i *Instruction) ExtendFromToBits() (from, to byte) { + from = byte(i.u1 >> 8) + to = byte(i.u1) + return +} + +// Format returns a string representation of this instruction with the given builder. +// For debugging purposes only. +func (i *Instruction) Format(b Builder) string { + var instSuffix string + switch i.opcode { + case OpcodeExitWithCode: + instSuffix = fmt.Sprintf(" %s, %s", i.v.Format(b), wazevoapi.ExitCode(i.u1)) + case OpcodeExitIfTrueWithCode: + instSuffix = fmt.Sprintf(" %s, %s, %s", i.v2.Format(b), i.v.Format(b), wazevoapi.ExitCode(i.u1)) + case OpcodeIadd, OpcodeIsub, OpcodeImul, OpcodeFadd, OpcodeFsub, OpcodeFmin, OpcodeFmax, OpcodeFdiv, OpcodeFmul: + instSuffix = fmt.Sprintf(" %s, %s", i.v.Format(b), i.v2.Format(b)) + case OpcodeIcmp: + instSuffix = fmt.Sprintf(" %s, %s, %s", IntegerCmpCond(i.u1), i.v.Format(b), i.v2.Format(b)) + case OpcodeFcmp: + instSuffix = fmt.Sprintf(" %s, %s, %s", FloatCmpCond(i.u1), i.v.Format(b), i.v2.Format(b)) + case OpcodeSExtend, OpcodeUExtend: + instSuffix = fmt.Sprintf(" %s, %d->%d", i.v.Format(b), i.u1>>8, i.u1&0xff) + case OpcodeCall, OpcodeCallIndirect: + vs := make([]string, len(i.vs)) + for idx := range vs { + vs[idx] = i.vs[idx].Format(b) + } + if i.opcode == OpcodeCallIndirect { + instSuffix = fmt.Sprintf(" %s:%s, %s", i.v.Format(b), SignatureID(i.u1), strings.Join(vs, ", ")) + } else { + instSuffix = fmt.Sprintf(" %s:%s, %s", FuncRef(i.u1), SignatureID(i.u2), strings.Join(vs, ", ")) + } + case OpcodeStore, OpcodeIstore8, OpcodeIstore16, OpcodeIstore32: + instSuffix = fmt.Sprintf(" %s, %s, %#x", i.v.Format(b), i.v2.Format(b), int32(i.u1)) + case OpcodeLoad, OpcodeVZeroExtLoad: + instSuffix = fmt.Sprintf(" %s, %#x", i.v.Format(b), int32(i.u1)) + case OpcodeLoadSplat: + instSuffix = fmt.Sprintf(".%s %s, %#x", VecLane(i.u2), i.v.Format(b), int32(i.u1)) + case OpcodeUload8, OpcodeUload16, OpcodeUload32, OpcodeSload8, OpcodeSload16, OpcodeSload32: + instSuffix = fmt.Sprintf(" %s, %#x", i.v.Format(b), int32(i.u1)) + case OpcodeSelect, OpcodeVbitselect: + instSuffix = fmt.Sprintf(" %s, %s, %s", i.v.Format(b), i.v2.Format(b), i.v3.Format(b)) + case OpcodeIconst: + switch i.typ { + case TypeI32: + instSuffix = fmt.Sprintf("_32 %#x", uint32(i.u1)) + case TypeI64: + instSuffix = fmt.Sprintf("_64 %#x", i.u1) + } + case OpcodeVconst: + instSuffix = fmt.Sprintf(" %016x %016x", i.u1, i.u2) + case OpcodeF32const: + instSuffix = fmt.Sprintf(" %f", math.Float32frombits(uint32(i.u1))) + case OpcodeF64const: + instSuffix = fmt.Sprintf(" %f", math.Float64frombits(i.u1)) + case OpcodeReturn: + if len(i.vs) == 0 { + break + } + vs := make([]string, len(i.vs)) + for idx := range vs { + vs[idx] = i.vs[idx].Format(b) + } + instSuffix = fmt.Sprintf(" %s", strings.Join(vs, ", ")) + case OpcodeJump: + vs := make([]string, len(i.vs)+1) + if i.IsFallthroughJump() { + vs[0] = " fallthrough" + } else { + vs[0] = " " + i.blk.(*basicBlock).Name() + } + for idx := range i.vs { + vs[idx+1] = i.vs[idx].Format(b) + } + + instSuffix = strings.Join(vs, ", ") + case OpcodeBrz, OpcodeBrnz: + vs := make([]string, len(i.vs)+2) + vs[0] = " " + i.v.Format(b) + vs[1] = i.blk.(*basicBlock).Name() + for idx := range i.vs { + vs[idx+2] = i.vs[idx].Format(b) + } + instSuffix = strings.Join(vs, ", ") + case OpcodeBrTable: + // `BrTable index, [label1, label2, ... labelN]` + instSuffix = fmt.Sprintf(" %s", i.v.Format(b)) + instSuffix += ", [" + for i, target := range i.targets { + blk := target.(*basicBlock) + if i == 0 { + instSuffix += blk.Name() + } else { + instSuffix += ", " + blk.Name() + } + } + instSuffix += "]" + case OpcodeBand, OpcodeBor, OpcodeBxor, OpcodeRotr, OpcodeRotl, OpcodeIshl, OpcodeSshr, OpcodeUshr, + OpcodeSdiv, OpcodeUdiv, OpcodeFcopysign, OpcodeSrem, OpcodeUrem, + OpcodeVbnot, OpcodeVbxor, OpcodeVbor, OpcodeVband, OpcodeVbandnot, OpcodeVIcmp, OpcodeVFcmp: + instSuffix = fmt.Sprintf(" %s, %s", i.v.Format(b), i.v2.Format(b)) + case OpcodeUndefined: + case OpcodeClz, OpcodeCtz, OpcodePopcnt, OpcodeFneg, OpcodeFcvtToSint, OpcodeFcvtToUint, OpcodeFcvtFromSint, + OpcodeFcvtFromUint, OpcodeFcvtToSintSat, OpcodeFcvtToUintSat, OpcodeFdemote, OpcodeFpromote, OpcodeIreduce, OpcodeBitcast, OpcodeSqrt, OpcodeFabs, + OpcodeCeil, OpcodeFloor, OpcodeTrunc, OpcodeNearest: + instSuffix = " " + i.v.Format(b) + case OpcodeVIadd, OpcodeIaddPairwise, OpcodeVSaddSat, OpcodeVUaddSat, OpcodeVIsub, OpcodeVSsubSat, OpcodeVUsubSat, + OpcodeVImin, OpcodeVUmin, OpcodeVImax, OpcodeVUmax, OpcodeVImul, OpcodeVAvgRound, + OpcodeVFadd, OpcodeVFsub, OpcodeVFmul, OpcodeVFdiv, + OpcodeVIshl, OpcodeVSshr, OpcodeVUshr, + OpcodeVFmin, OpcodeVFmax, OpcodeVMinPseudo, OpcodeVMaxPseudo, + OpcodeSnarrow, OpcodeUnarrow, OpcodeSwizzle, OpcodeSqmulRoundSat: + instSuffix = fmt.Sprintf(".%s %s, %s", VecLane(i.u1), i.v.Format(b), i.v2.Format(b)) + case OpcodeVIabs, OpcodeVIneg, OpcodeVIpopcnt, OpcodeVhighBits, OpcodeVallTrue, OpcodeVanyTrue, + OpcodeVFabs, OpcodeVFneg, OpcodeVSqrt, OpcodeVCeil, OpcodeVFloor, OpcodeVTrunc, OpcodeVNearest, + OpcodeVFcvtToUintSat, OpcodeVFcvtToSintSat, OpcodeVFcvtFromUint, OpcodeVFcvtFromSint, + OpcodeFvpromoteLow, OpcodeFvdemote, OpcodeSwidenLow, OpcodeUwidenLow, OpcodeSwidenHigh, OpcodeUwidenHigh, + OpcodeSplat: + instSuffix = fmt.Sprintf(".%s %s", VecLane(i.u1), i.v.Format(b)) + case OpcodeExtractlane: + var signedness string + if i.u1 != 0 { + signedness = "signed" + } else { + signedness = "unsigned" + } + instSuffix = fmt.Sprintf(".%s %d, %s (%s)", VecLane(i.u2), 0x0000FFFF&i.u1, i.v.Format(b), signedness) + case OpcodeInsertlane: + instSuffix = fmt.Sprintf(".%s %d, %s, %s", VecLane(i.u2), i.u1, i.v.Format(b), i.v2.Format(b)) + case OpcodeShuffle: + lanes := make([]byte, 16) + for idx := 0; idx < 8; idx++ { + lanes[idx] = byte(i.u1 >> (8 * idx)) + } + for idx := 0; idx < 8; idx++ { + lanes[idx+8] = byte(i.u2 >> (8 * idx)) + } + // Prints Shuffle.[0 1 2 3 4 5 6 7 ...] v2, v3 + instSuffix = fmt.Sprintf(".%v %s, %s", lanes, i.v.Format(b), i.v2.Format(b)) + + default: + panic(fmt.Sprintf("TODO: format for %s", i.opcode)) + } + + instr := i.opcode.String() + instSuffix + + var rvs []string + if rv := i.rValue; rv.Valid() { + rvs = append(rvs, rv.formatWithType(b)) + } + + for _, v := range i.rValues { + rvs = append(rvs, v.formatWithType(b)) + } + + if len(rvs) > 0 { + return fmt.Sprintf("%s = %s", strings.Join(rvs, ", "), instr) + } else { + return instr + } +} + +// addArgumentBranchInst adds an argument to this instruction. +func (i *Instruction) addArgumentBranchInst(v Value) { + switch i.opcode { + case OpcodeJump, OpcodeBrz, OpcodeBrnz: + i.vs = append(i.vs, v) + default: + panic("BUG: " + i.opcode.String()) + } +} + +// Constant returns true if this instruction is a constant instruction. +func (i *Instruction) Constant() bool { + switch i.opcode { + case OpcodeIconst, OpcodeF32const, OpcodeF64const: + return true + } + return false +} + +// ConstantVal returns the constant value of this instruction. +// How to interpret the return value depends on the opcode. +func (i *Instruction) ConstantVal() (ret uint64) { + switch i.opcode { + case OpcodeIconst, OpcodeF32const, OpcodeF64const: + ret = i.u1 + default: + panic("TODO") + } + return +} + +// String implements fmt.Stringer. +func (o Opcode) String() (ret string) { + switch o { + case OpcodeInvalid: + return "invalid" + case OpcodeUndefined: + return "Undefined" + case OpcodeJump: + return "Jump" + case OpcodeBrz: + return "Brz" + case OpcodeBrnz: + return "Brnz" + case OpcodeBrTable: + return "BrTable" + case OpcodeExitWithCode: + return "Exit" + case OpcodeExitIfTrueWithCode: + return "ExitIfTrue" + case OpcodeReturn: + return "Return" + case OpcodeCall: + return "Call" + case OpcodeCallIndirect: + return "CallIndirect" + case OpcodeSplat: + return "Splat" + case OpcodeSwizzle: + return "Swizzle" + case OpcodeInsertlane: + return "Insertlane" + case OpcodeExtractlane: + return "Extractlane" + case OpcodeLoad: + return "Load" + case OpcodeLoadSplat: + return "LoadSplat" + case OpcodeStore: + return "Store" + case OpcodeUload8: + return "Uload8" + case OpcodeSload8: + return "Sload8" + case OpcodeIstore8: + return "Istore8" + case OpcodeUload16: + return "Uload16" + case OpcodeSload16: + return "Sload16" + case OpcodeIstore16: + return "Istore16" + case OpcodeUload32: + return "Uload32" + case OpcodeSload32: + return "Sload32" + case OpcodeIstore32: + return "Istore32" + case OpcodeIconst: + return "Iconst" + case OpcodeF32const: + return "F32const" + case OpcodeF64const: + return "F64const" + case OpcodeVconst: + return "Vconst" + case OpcodeShuffle: + return "Shuffle" + case OpcodeSelect: + return "Select" + case OpcodeVanyTrue: + return "VanyTrue" + case OpcodeVallTrue: + return "VallTrue" + case OpcodeVhighBits: + return "VhighBits" + case OpcodeIcmp: + return "Icmp" + case OpcodeIcmpImm: + return "IcmpImm" + case OpcodeVIcmp: + return "VIcmp" + case OpcodeIadd: + return "Iadd" + case OpcodeIsub: + return "Isub" + case OpcodeImul: + return "Imul" + case OpcodeUdiv: + return "Udiv" + case OpcodeSdiv: + return "Sdiv" + case OpcodeUrem: + return "Urem" + case OpcodeSrem: + return "Srem" + case OpcodeBand: + return "Band" + case OpcodeBor: + return "Bor" + case OpcodeBxor: + return "Bxor" + case OpcodeBnot: + return "Bnot" + case OpcodeRotl: + return "Rotl" + case OpcodeRotr: + return "Rotr" + case OpcodeIshl: + return "Ishl" + case OpcodeUshr: + return "Ushr" + case OpcodeSshr: + return "Sshr" + case OpcodeClz: + return "Clz" + case OpcodeCtz: + return "Ctz" + case OpcodePopcnt: + return "Popcnt" + case OpcodeFcmp: + return "Fcmp" + case OpcodeFadd: + return "Fadd" + case OpcodeFsub: + return "Fsub" + case OpcodeFmul: + return "Fmul" + case OpcodeFdiv: + return "Fdiv" + case OpcodeSqmulRoundSat: + return "SqmulRoundSat" + case OpcodeSqrt: + return "Sqrt" + case OpcodeFneg: + return "Fneg" + case OpcodeFabs: + return "Fabs" + case OpcodeFcopysign: + return "Fcopysign" + case OpcodeFmin: + return "Fmin" + case OpcodeFmax: + return "Fmax" + case OpcodeCeil: + return "Ceil" + case OpcodeFloor: + return "Floor" + case OpcodeTrunc: + return "Trunc" + case OpcodeNearest: + return "Nearest" + case OpcodeBitcast: + return "Bitcast" + case OpcodeBmask: + return "Bmask" + case OpcodeIreduce: + return "Ireduce" + case OpcodeSnarrow: + return "Snarrow" + case OpcodeUnarrow: + return "Unarrow" + case OpcodeSwidenLow: + return "SwidenLow" + case OpcodeSwidenHigh: + return "SwidenHigh" + case OpcodeUwidenLow: + return "UwidenLow" + case OpcodeUwidenHigh: + return "UwidenHigh" + case OpcodeIaddPairwise: + return "IaddPairwise" + case OpcodeWideningPairwiseDotProductS: + return "WideningPairwiseDotProductS" + case OpcodeUExtend: + return "UExtend" + case OpcodeSExtend: + return "SExtend" + case OpcodeFpromote: + return "Fpromote" + case OpcodeFdemote: + return "Fdemote" + case OpcodeFvdemote: + return "Fvdemote" + case OpcodeFcvtToUint: + return "FcvtToUint" + case OpcodeFcvtToSint: + return "FcvtToSint" + case OpcodeFcvtToUintSat: + return "FcvtToUintSat" + case OpcodeFcvtToSintSat: + return "FcvtToSintSat" + case OpcodeFcvtFromUint: + return "FcvtFromUint" + case OpcodeFcvtFromSint: + return "FcvtFromSint" + case OpcodeIsplit: + return "Isplit" + case OpcodeIconcat: + return "Iconcat" + case OpcodeAtomicRmw: + return "AtomicRmw" + case OpcodeAtomicCas: + return "AtomicCas" + case OpcodeAtomicLoad: + return "AtomicLoad" + case OpcodeAtomicStore: + return "AtomicStore" + case OpcodeFence: + return "Fence" + case OpcodeVbor: + return "Vbor" + case OpcodeVbxor: + return "Vbxor" + case OpcodeVband: + return "Vband" + case OpcodeVbandnot: + return "Vbandnot" + case OpcodeVbnot: + return "Vbnot" + case OpcodeVbitselect: + return "Vbitselect" + case OpcodeVIadd: + return "VIadd" + case OpcodeVSaddSat: + return "VSaddSat" + case OpcodeVUaddSat: + return "VUaddSat" + case OpcodeVSsubSat: + return "VSsubSat" + case OpcodeVUsubSat: + return "VUsubSat" + case OpcodeVAvgRound: + return "OpcodeVAvgRound" + case OpcodeVIsub: + return "VIsub" + case OpcodeVImin: + return "VImin" + case OpcodeVUmin: + return "VUmin" + case OpcodeVImax: + return "VImax" + case OpcodeVUmax: + return "VUmax" + case OpcodeVImul: + return "VImul" + case OpcodeVIabs: + return "VIabs" + case OpcodeVIneg: + return "VIneg" + case OpcodeVIpopcnt: + return "VIpopcnt" + case OpcodeVIshl: + return "VIshl" + case OpcodeVUshr: + return "VUshr" + case OpcodeVSshr: + return "VSshr" + case OpcodeVFabs: + return "VFabs" + case OpcodeVFmax: + return "VFmax" + case OpcodeVFmin: + return "VFmin" + case OpcodeVFneg: + return "VFneg" + case OpcodeVFadd: + return "VFadd" + case OpcodeVFsub: + return "VFsub" + case OpcodeVFmul: + return "VFmul" + case OpcodeVFdiv: + return "VFdiv" + case OpcodeVFcmp: + return "VFcmp" + case OpcodeVCeil: + return "VCeil" + case OpcodeVFloor: + return "VFloor" + case OpcodeVTrunc: + return "VTrunc" + case OpcodeVNearest: + return "VNearest" + case OpcodeVMaxPseudo: + return "VMaxPseudo" + case OpcodeVMinPseudo: + return "VMinPseudo" + case OpcodeVSqrt: + return "VSqrt" + case OpcodeVFcvtToUintSat: + return "VFcvtToUintSat" + case OpcodeVFcvtToSintSat: + return "VFcvtToSintSat" + case OpcodeVFcvtFromUint: + return "VFcvtFromUint" + case OpcodeVFcvtFromSint: + return "VFcvtFromSint" + case OpcodeFvpromoteLow: + return "FvpromoteLow" + case OpcodeVZeroExtLoad: + return "VZeroExtLoad" + } + panic(fmt.Sprintf("unknown opcode %d", o)) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/pass.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/pass.go new file mode 100644 index 000000000..17c8486f6 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/pass.go @@ -0,0 +1,375 @@ +package ssa + +import ( + "fmt" + "sort" + + "github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi" +) + +// RunPasses implements Builder.RunPasses. +// +// The order here matters; some pass depends on the previous ones. +// +// Note that passes suffixed with "Opt" are the optimization passes, meaning that they edit the instructions and blocks +// while the other passes are not, like passEstimateBranchProbabilities does not edit them, but only calculates the additional information. +func (b *builder) RunPasses() { + passSortSuccessors(b) + passDeadBlockEliminationOpt(b) + passRedundantPhiEliminationOpt(b) + // The result of passCalculateImmediateDominators will be used by various passes below. + passCalculateImmediateDominators(b) + passNopInstElimination(b) + + // TODO: implement either conversion of irreducible CFG into reducible one, or irreducible CFG detection where we panic. + // WebAssembly program shouldn't result in irreducible CFG, but we should handle it properly in just in case. + // See FixIrreducible pass in LLVM: https://llvm.org/doxygen/FixIrreducible_8cpp_source.html + + // TODO: implement more optimization passes like: + // block coalescing. + // Copy-propagation. + // Constant folding. + // Common subexpression elimination. + // Arithmetic simplifications. + // and more! + + // passDeadCodeEliminationOpt could be more accurate if we do this after other optimizations. + passDeadCodeEliminationOpt(b) + b.donePasses = true +} + +// passDeadBlockEliminationOpt searches the unreachable blocks, and sets the basicBlock.invalid flag true if so. +func passDeadBlockEliminationOpt(b *builder) { + entryBlk := b.entryBlk() + b.clearBlkVisited() + b.blkStack = append(b.blkStack, entryBlk) + for len(b.blkStack) > 0 { + reachableBlk := b.blkStack[len(b.blkStack)-1] + b.blkStack = b.blkStack[:len(b.blkStack)-1] + b.blkVisited[reachableBlk] = 0 // the value won't be used in this pass. + + if !reachableBlk.sealed && !reachableBlk.ReturnBlock() { + panic(fmt.Sprintf("%s is not sealed", reachableBlk)) + } + + if wazevoapi.SSAValidationEnabled { + reachableBlk.validate(b) + } + + for _, succ := range reachableBlk.success { + if _, ok := b.blkVisited[succ]; ok { + continue + } + b.blkStack = append(b.blkStack, succ) + } + } + + for blk := b.blockIteratorBegin(); blk != nil; blk = b.blockIteratorNext() { + if _, ok := b.blkVisited[blk]; !ok { + blk.invalid = true + } + } +} + +// passRedundantPhiEliminationOpt eliminates the redundant PHIs (in our terminology, parameters of a block). +func passRedundantPhiEliminationOpt(b *builder) { + redundantParameterIndexes := b.ints[:0] // reuse the slice from previous iterations. + + _ = b.blockIteratorBegin() // skip entry block! + // Below, we intentionally use the named iteration variable name, as this comes with inevitable nested for loops! + for blk := b.blockIteratorNext(); blk != nil; blk = b.blockIteratorNext() { + paramNum := len(blk.params) + + for paramIndex := 0; paramIndex < paramNum; paramIndex++ { + phiValue := blk.params[paramIndex].value + redundant := true + + nonSelfReferencingValue := ValueInvalid + for predIndex := range blk.preds { + pred := blk.preds[predIndex].branch.vs[paramIndex] + if pred == phiValue { + // This is self-referencing: PHI from the same PHI. + continue + } + + if !nonSelfReferencingValue.Valid() { + nonSelfReferencingValue = pred + continue + } + + if nonSelfReferencingValue != pred { + redundant = false + break + } + } + + if !nonSelfReferencingValue.Valid() { + // This shouldn't happen, and must be a bug in builder.go. + panic("BUG: params added but only self-referencing") + } + + if redundant { + b.redundantParameterIndexToValue[paramIndex] = nonSelfReferencingValue + redundantParameterIndexes = append(redundantParameterIndexes, paramIndex) + } + } + + if len(b.redundantParameterIndexToValue) == 0 { + continue + } + + // Remove the redundant PHIs from the argument list of branching instructions. + for predIndex := range blk.preds { + var cur int + predBlk := blk.preds[predIndex] + branchInst := predBlk.branch + for argIndex, value := range branchInst.vs { + if _, ok := b.redundantParameterIndexToValue[argIndex]; !ok { + branchInst.vs[cur] = value + cur++ + } + } + branchInst.vs = branchInst.vs[:cur] + } + + // Still need to have the definition of the value of the PHI (previously as the parameter). + for _, redundantParamIndex := range redundantParameterIndexes { + phiValue := blk.params[redundantParamIndex].value + onlyValue := b.redundantParameterIndexToValue[redundantParamIndex] + // Create an alias in this block from the only phi argument to the phi value. + b.alias(phiValue, onlyValue) + } + + // Finally, Remove the param from the blk. + var cur int + for paramIndex := 0; paramIndex < paramNum; paramIndex++ { + param := blk.params[paramIndex] + if _, ok := b.redundantParameterIndexToValue[paramIndex]; !ok { + blk.params[cur] = param + cur++ + } + } + blk.params = blk.params[:cur] + + // Clears the map for the next iteration. + for _, paramIndex := range redundantParameterIndexes { + delete(b.redundantParameterIndexToValue, paramIndex) + } + redundantParameterIndexes = redundantParameterIndexes[:0] + } + + // Reuse the slice for the future passes. + b.ints = redundantParameterIndexes +} + +// passDeadCodeEliminationOpt traverses all the instructions, and calculates the reference count of each Value, and +// eliminates all the unnecessary instructions whose ref count is zero. +// The results are stored at builder.valueRefCounts. This also assigns a InstructionGroupID to each Instruction +// during the process. This is the last SSA-level optimization pass and after this, +// the SSA function is ready to be used by backends. +// +// TODO: the algorithm here might not be efficient. Get back to this later. +func passDeadCodeEliminationOpt(b *builder) { + nvid := int(b.nextValueID) + if nvid >= len(b.valueRefCounts) { + b.valueRefCounts = append(b.valueRefCounts, make([]int, b.nextValueID)...) + } + if nvid >= len(b.valueIDToInstruction) { + b.valueIDToInstruction = append(b.valueIDToInstruction, make([]*Instruction, b.nextValueID)...) + } + + // First, we gather all the instructions with side effects. + liveInstructions := b.instStack[:0] + // During the process, we will assign InstructionGroupID to each instruction, which is not + // relevant to dead code elimination, but we need in the backend. + var gid InstructionGroupID + for blk := b.blockIteratorBegin(); blk != nil; blk = b.blockIteratorNext() { + for cur := blk.rootInstr; cur != nil; cur = cur.next { + cur.gid = gid + switch cur.sideEffect() { + case sideEffectTraps: + // The trappable should always be alive. + liveInstructions = append(liveInstructions, cur) + case sideEffectStrict: + liveInstructions = append(liveInstructions, cur) + // The strict side effect should create different instruction groups. + gid++ + } + + r1, rs := cur.Returns() + if r1.Valid() { + b.valueIDToInstruction[r1.ID()] = cur + } + for _, r := range rs { + b.valueIDToInstruction[r.ID()] = cur + } + } + } + + // Find all the instructions referenced by live instructions transitively. + for len(liveInstructions) > 0 { + tail := len(liveInstructions) - 1 + live := liveInstructions[tail] + liveInstructions = liveInstructions[:tail] + if live.live { + // If it's already marked alive, this is referenced multiple times, + // so we can skip it. + continue + } + live.live = true + + // Before we walk, we need to resolve the alias first. + b.resolveArgumentAlias(live) + + v1, v2, v3, vs := live.Args() + if v1.Valid() { + producingInst := b.valueIDToInstruction[v1.ID()] + if producingInst != nil { + liveInstructions = append(liveInstructions, producingInst) + } + } + + if v2.Valid() { + producingInst := b.valueIDToInstruction[v2.ID()] + if producingInst != nil { + liveInstructions = append(liveInstructions, producingInst) + } + } + + if v3.Valid() { + producingInst := b.valueIDToInstruction[v3.ID()] + if producingInst != nil { + liveInstructions = append(liveInstructions, producingInst) + } + } + + for _, v := range vs { + producingInst := b.valueIDToInstruction[v.ID()] + if producingInst != nil { + liveInstructions = append(liveInstructions, producingInst) + } + } + } + + // Now that all the live instructions are flagged as live=true, we eliminate all dead instructions. + for blk := b.blockIteratorBegin(); blk != nil; blk = b.blockIteratorNext() { + for cur := blk.rootInstr; cur != nil; cur = cur.next { + if !cur.live { + // Remove the instruction from the list. + if prev := cur.prev; prev != nil { + prev.next = cur.next + } else { + blk.rootInstr = cur.next + } + if next := cur.next; next != nil { + next.prev = cur.prev + } + continue + } + + // If the value alive, we can be sure that arguments are used definitely. + // Hence, we can increment the value reference counts. + v1, v2, v3, vs := cur.Args() + if v1.Valid() { + b.incRefCount(v1.ID(), cur) + } + if v2.Valid() { + b.incRefCount(v2.ID(), cur) + } + if v3.Valid() { + b.incRefCount(v3.ID(), cur) + } + for _, v := range vs { + b.incRefCount(v.ID(), cur) + } + } + } + + b.instStack = liveInstructions // we reuse the stack for the next iteration. +} + +func (b *builder) incRefCount(id ValueID, from *Instruction) { + if wazevoapi.SSALoggingEnabled { + fmt.Printf("v%d referenced from %v\n", id, from.Format(b)) + } + b.valueRefCounts[id]++ +} + +// clearBlkVisited clears the b.blkVisited map so that we can reuse it for multiple places. +func (b *builder) clearBlkVisited() { + b.blkStack2 = b.blkStack2[:0] + for key := range b.blkVisited { + b.blkStack2 = append(b.blkStack2, key) + } + for _, blk := range b.blkStack2 { + delete(b.blkVisited, blk) + } + b.blkStack2 = b.blkStack2[:0] +} + +// passNopInstElimination eliminates the instructions which is essentially a no-op. +func passNopInstElimination(b *builder) { + if int(b.nextValueID) >= len(b.valueIDToInstruction) { + b.valueIDToInstruction = append(b.valueIDToInstruction, make([]*Instruction, b.nextValueID)...) + } + + for blk := b.blockIteratorBegin(); blk != nil; blk = b.blockIteratorNext() { + for cur := blk.rootInstr; cur != nil; cur = cur.next { + r1, rs := cur.Returns() + if r1.Valid() { + b.valueIDToInstruction[r1.ID()] = cur + } + for _, r := range rs { + b.valueIDToInstruction[r.ID()] = cur + } + } + } + + for blk := b.blockIteratorBegin(); blk != nil; blk = b.blockIteratorNext() { + for cur := blk.rootInstr; cur != nil; cur = cur.next { + switch cur.Opcode() { + // TODO: add more logics here. + case OpcodeIshl, OpcodeSshr, OpcodeUshr: + x, amount := cur.Arg2() + definingInst := b.valueIDToInstruction[amount.ID()] + if definingInst == nil { + // If there's no defining instruction, that means the amount is coming from the parameter. + continue + } + if definingInst.Constant() { + v := definingInst.ConstantVal() + + if x.Type().Bits() == 64 { + v = v % 64 + } else { + v = v % 32 + } + if v == 0 { + b.alias(cur.Return(), x) + } + } + } + } + } +} + +// passSortSuccessors sorts the successors of each block in the natural program order. +func passSortSuccessors(b *builder) { + for i := 0; i < b.basicBlocksPool.Allocated(); i++ { + blk := b.basicBlocksPool.View(i) + sort.SliceStable(blk.success, func(i, j int) bool { + iBlk, jBlk := blk.success[i], blk.success[j] + if jBlk.ReturnBlock() { + return true + } + if iBlk.ReturnBlock() { + return false + } + iRoot, jRoot := iBlk.rootInstr, jBlk.rootInstr + if iRoot == nil || jRoot == nil { // For testing. + return true + } + return iBlk.rootInstr.id < jBlk.rootInstr.id + }) + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/pass_cfg.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/pass_cfg.go new file mode 100644 index 000000000..c39a75b5f --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/pass_cfg.go @@ -0,0 +1,312 @@ +package ssa + +import ( + "fmt" + "math" + "strings" + + "github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi" +) + +// passCalculateImmediateDominators calculates immediate dominators for each basic block. +// The result is stored in b.dominators. This make it possible for the following passes to +// use builder.isDominatedBy to check if a block is dominated by another block. +// +// At the last of pass, this function also does the loop detection and sets the basicBlock.loop flag. +func passCalculateImmediateDominators(b *builder) { + reversePostOrder := b.reversePostOrderedBasicBlocks[:0] + exploreStack := b.blkStack[:0] + b.clearBlkVisited() + + entryBlk := b.entryBlk() + + // Store the reverse postorder from the entrypoint into reversePostOrder slice. + // This calculation of reverse postorder is not described in the paper, + // so we use heuristic to calculate it so that we could potentially handle arbitrary + // complex CFGs under the assumption that success is sorted in program's natural order. + // That means blk.success[i] always appears before blk.success[i+1] in the source program, + // which is a reasonable assumption as long as SSA Builder is properly used. + // + // First we push blocks in postorder iteratively visit successors of the entry block. + exploreStack = append(exploreStack, entryBlk) + const visitStateUnseen, visitStateSeen, visitStateDone = 0, 1, 2 + b.blkVisited[entryBlk] = visitStateSeen + for len(exploreStack) > 0 { + tail := len(exploreStack) - 1 + blk := exploreStack[tail] + exploreStack = exploreStack[:tail] + switch b.blkVisited[blk] { + case visitStateUnseen: + // This is likely a bug in the frontend. + panic("BUG: unsupported CFG") + case visitStateSeen: + // This is the first time to pop this block, and we have to see the successors first. + // So push this block again to the stack. + exploreStack = append(exploreStack, blk) + // And push the successors to the stack if necessary. + for _, succ := range blk.success { + if succ.ReturnBlock() || succ.invalid { + continue + } + if b.blkVisited[succ] == visitStateUnseen { + b.blkVisited[succ] = visitStateSeen + exploreStack = append(exploreStack, succ) + } + } + // Finally, we could pop this block once we pop all of its successors. + b.blkVisited[blk] = visitStateDone + case visitStateDone: + // Note: at this point we push blk in postorder despite its name. + reversePostOrder = append(reversePostOrder, blk) + } + } + // At this point, reversePostOrder has postorder actually, so we reverse it. + for i := len(reversePostOrder)/2 - 1; i >= 0; i-- { + j := len(reversePostOrder) - 1 - i + reversePostOrder[i], reversePostOrder[j] = reversePostOrder[j], reversePostOrder[i] + } + + for i, blk := range reversePostOrder { + blk.reversePostOrder = i + } + + // Reuse the dominators slice if possible from the previous computation of function. + b.dominators = b.dominators[:cap(b.dominators)] + if len(b.dominators) < b.basicBlocksPool.Allocated() { + // Generously reserve space in the slice because the slice will be reused future allocation. + b.dominators = append(b.dominators, make([]*basicBlock, b.basicBlocksPool.Allocated())...) + } + calculateDominators(reversePostOrder, b.dominators) + + // Reuse the slices for the future use. + b.blkStack = exploreStack + + // For the following passes. + b.reversePostOrderedBasicBlocks = reversePostOrder + + // Ready to detect loops! + subPassLoopDetection(b) +} + +// calculateDominators calculates the immediate dominator of each node in the CFG, and store the result in `doms`. +// The algorithm is based on the one described in the paper "A Simple, Fast Dominance Algorithm" +// https://www.cs.rice.edu/~keith/EMBED/dom.pdf which is a faster/simple alternative to the well known Lengauer-Tarjan algorithm. +// +// The following code almost matches the pseudocode in the paper with one exception (see the code comment below). +// +// The result slice `doms` must be pre-allocated with the size larger than the size of dfsBlocks. +func calculateDominators(reversePostOrderedBlks []*basicBlock, doms []*basicBlock) { + entry, reversePostOrderedBlks := reversePostOrderedBlks[0], reversePostOrderedBlks[1: /* skips entry point */] + for _, blk := range reversePostOrderedBlks { + doms[blk.id] = nil + } + doms[entry.id] = entry + + changed := true + for changed { + changed = false + for _, blk := range reversePostOrderedBlks { + var u *basicBlock + for i := range blk.preds { + pred := blk.preds[i].blk + // Skip if this pred is not reachable yet. Note that this is not described in the paper, + // but it is necessary to handle nested loops etc. + if doms[pred.id] == nil { + continue + } + + if u == nil { + u = pred + continue + } else { + u = intersect(doms, u, pred) + } + } + if doms[blk.id] != u { + doms[blk.id] = u + changed = true + } + } + } +} + +// intersect returns the common dominator of blk1 and blk2. +// +// This is the `intersect` function in the paper. +func intersect(doms []*basicBlock, blk1 *basicBlock, blk2 *basicBlock) *basicBlock { + finger1, finger2 := blk1, blk2 + for finger1 != finger2 { + // Move the 'finger1' upwards to its immediate dominator. + for finger1.reversePostOrder > finger2.reversePostOrder { + finger1 = doms[finger1.id] + } + // Move the 'finger2' upwards to its immediate dominator. + for finger2.reversePostOrder > finger1.reversePostOrder { + finger2 = doms[finger2.id] + } + } + return finger1 +} + +// subPassLoopDetection detects loops in the function using the immediate dominators. +// +// This is run at the last of passCalculateImmediateDominators. +func subPassLoopDetection(b *builder) { + for blk := b.blockIteratorBegin(); blk != nil; blk = b.blockIteratorNext() { + for i := range blk.preds { + pred := blk.preds[i].blk + if pred.invalid { + continue + } + if b.isDominatedBy(pred, blk) { + blk.loopHeader = true + } + } + } +} + +// buildLoopNestingForest builds the loop nesting forest for the function. +// This must be called after branch splitting since it relies on the CFG. +func buildLoopNestingForest(b *builder) { + ent := b.entryBlk() + doms := b.dominators + for _, blk := range b.reversePostOrderedBasicBlocks { + n := doms[blk.id] + for !n.loopHeader && n != ent { + n = doms[n.id] + } + + if n == ent && blk.loopHeader { + b.loopNestingForestRoots = append(b.loopNestingForestRoots, blk) + } else if n == ent { + } else if n.loopHeader { + n.loopNestingForestChildren = append(n.loopNestingForestChildren, blk) + } + } + + if wazevoapi.SSALoggingEnabled { + for _, root := range b.loopNestingForestRoots { + printLoopNestingForest(root.(*basicBlock), 0) + } + } +} + +func printLoopNestingForest(root *basicBlock, depth int) { + fmt.Println(strings.Repeat("\t", depth), "loop nesting forest root:", root.ID()) + for _, child := range root.loopNestingForestChildren { + fmt.Println(strings.Repeat("\t", depth+1), "child:", child.ID()) + if child.LoopHeader() { + printLoopNestingForest(child.(*basicBlock), depth+2) + } + } +} + +type dominatorSparseTree struct { + time int + euler []*basicBlock + first, depth []int + table [][]int +} + +// buildDominatorTree builds the dominator tree for the function, and constructs builder.sparseTree. +func buildDominatorTree(b *builder) { + // First we materialize the children of each node in the dominator tree. + idoms := b.dominators + for _, blk := range b.reversePostOrderedBasicBlocks { + parent := idoms[blk.id] + if parent == nil { + panic("BUG") + } else if parent == blk { + // This is the entry block. + continue + } + if prev := parent.child; prev == nil { + parent.child = blk + } else { + parent.child = blk + blk.sibling = prev + } + } + + // Reset the state from the previous computation. + n := b.basicBlocksPool.Allocated() + st := &b.sparseTree + st.euler = append(st.euler[:0], make([]*basicBlock, 2*n-1)...) + st.first = append(st.first[:0], make([]int, n)...) + for i := range st.first { + st.first[i] = -1 + } + st.depth = append(st.depth[:0], make([]int, 2*n-1)...) + st.time = 0 + + // Start building the sparse tree. + st.eulerTour(b.entryBlk(), 0) + st.buildSparseTable() +} + +func (dt *dominatorSparseTree) eulerTour(node *basicBlock, height int) { + if wazevoapi.SSALoggingEnabled { + fmt.Println(strings.Repeat("\t", height), "euler tour:", node.ID()) + } + dt.euler[dt.time] = node + dt.depth[dt.time] = height + if dt.first[node.id] == -1 { + dt.first[node.id] = dt.time + } + dt.time++ + + for child := node.child; child != nil; child = child.sibling { + dt.eulerTour(child, height+1) + dt.euler[dt.time] = node // add the current node again after visiting a child + dt.depth[dt.time] = height + dt.time++ + } +} + +// buildSparseTable builds a sparse table for RMQ queries. +func (dt *dominatorSparseTree) buildSparseTable() { + n := len(dt.depth) + k := int(math.Log2(float64(n))) + 1 + table := dt.table + + if n >= len(table) { + table = append(table, make([][]int, n+1)...) + } + for i := range table { + if len(table[i]) < k { + table[i] = append(table[i], make([]int, k)...) + } + table[i][0] = i + } + + for j := 1; 1< first[v] { + u, v = v, u + } + return dt.euler[dt.rmq(first[u], first[v])] +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/signature.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/signature.go new file mode 100644 index 000000000..43483395a --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/signature.go @@ -0,0 +1,49 @@ +package ssa + +import ( + "fmt" + "strings" +) + +// Signature is a function prototype. +type Signature struct { + // ID is a unique identifier for this signature used to lookup. + ID SignatureID + // Params and Results are the types of the parameters and results of the function. + Params, Results []Type + + // used is true if this is used by the currently-compiled function. + // Debugging only. + used bool +} + +// String implements fmt.Stringer. +func (s *Signature) String() string { + str := strings.Builder{} + str.WriteString(s.ID.String()) + str.WriteString(": ") + if len(s.Params) > 0 { + for _, typ := range s.Params { + str.WriteString(typ.String()) + } + } else { + str.WriteByte('v') + } + str.WriteByte('_') + if len(s.Results) > 0 { + for _, typ := range s.Results { + str.WriteString(typ.String()) + } + } else { + str.WriteByte('v') + } + return str.String() +} + +// SignatureID is an unique identifier used to lookup. +type SignatureID int + +// String implements fmt.Stringer. +func (s SignatureID) String() string { + return fmt.Sprintf("sig%d", s) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/ssa.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/ssa.go new file mode 100644 index 000000000..b477e58bd --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/ssa.go @@ -0,0 +1,14 @@ +// Package ssa is used to construct SSA function. By nature this is free of Wasm specific thing +// and ISA. +// +// We use the "block argument" variant of SSA: https://en.wikipedia.org/wiki/Static_single-assignment_form#Block_arguments +// which is equivalent to the traditional PHI function based one, but more convenient during optimizations. +// However, in this package's source code comment, we might use PHI whenever it seems necessary in order to be aligned with +// existing literatures, e.g. SSA level optimization algorithms are often described using PHI nodes. +// +// The rationale doc for the choice of "block argument" by MLIR of LLVM is worth a read: +// https://mlir.llvm.org/docs/Rationale/Rationale/#block-arguments-vs-phi-nodes +// +// The algorithm to resolve variable definitions used here is based on the paper +// "Simple and Efficient Construction of Static Single Assignment Form": https://link.springer.com/content/pdf/10.1007/978-3-642-37051-9_6.pdf. +package ssa diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/type.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/type.go new file mode 100644 index 000000000..4e320db36 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/type.go @@ -0,0 +1,107 @@ +package ssa + +type Type byte + +const ( + typeInvalid Type = iota + + // TODO: add 8, 16 bit types when it's needed for optimizations. + + // TypeI32 represents an integer type with 32 bits. + TypeI32 + + // TypeI64 represents an integer type with 64 bits. + TypeI64 + + // TypeF32 represents 32-bit floats in the IEEE 754. + TypeF32 + + // TypeF64 represents 64-bit floats in the IEEE 754. + TypeF64 + + // TypeV128 represents 128-bit SIMD vectors. + TypeV128 +) + +// String implements fmt.Stringer. +func (t Type) String() (ret string) { + switch t { + case typeInvalid: + return "invalid" + case TypeI32: + return "i32" + case TypeI64: + return "i64" + case TypeF32: + return "f32" + case TypeF64: + return "f64" + case TypeV128: + return "v128" + default: + panic(int(t)) + } +} + +// IsInt returns true if the type is an integer type. +func (t Type) IsInt() bool { + return t == TypeI32 || t == TypeI64 +} + +// Bits returns the number of bits required to represent the type. +func (t Type) Bits() byte { + switch t { + case TypeI32, TypeF32: + return 32 + case TypeI64, TypeF64: + return 64 + case TypeV128: + return 128 + default: + panic(int(t)) + } +} + +// Size returns the number of bytes required to represent the type. +func (t Type) Size() byte { + return t.Bits() / 8 +} + +func (t Type) invalid() bool { + return t == typeInvalid +} + +// VecLane represents a lane in a SIMD vector. +type VecLane byte + +const ( + VecLaneInvalid VecLane = 1 + iota + VecLaneI8x16 + VecLaneI16x8 + VecLaneI32x4 + VecLaneI64x2 + VecLaneF32x4 + VecLaneF64x2 +) + +// String implements fmt.Stringer. +func (vl VecLane) String() (ret string) { + switch vl { + case VecLaneInvalid: + return "invalid" + case VecLaneI8x16: + return "i8x16" + case VecLaneI16x8: + return "i16x8" + case VecLaneI32x4: + return "i32x4" + case VecLaneI64x2: + return "i64x2" + case VecLaneF32x4: + return "f32x4" + case VecLaneF64x2: + return "f64x2" + default: + panic(int(vl)) + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/vs.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/vs.go new file mode 100644 index 000000000..0afc941d3 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/ssa/vs.go @@ -0,0 +1,81 @@ +package ssa + +import ( + "fmt" + "math" + + "github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi" +) + +// Variable is a unique identifier for a source program's variable and will correspond to +// multiple ssa Value(s). +// +// For example, `Local 1` is a Variable in WebAssembly, and Value(s) will be created for it +// whenever it executes `local.set 1`. +// +// Variable is useful to track the SSA Values of a variable in the source program, and +// can be used to find the corresponding latest SSA Value via Builder.FindValue. +type Variable uint32 + +// String implements fmt.Stringer. +func (v Variable) String() string { + return fmt.Sprintf("var%d", v) +} + +// Value represents an SSA value with a type information. The relationship with Variable is 1: N (including 0), +// that means there might be multiple Variable(s) for a Value. +// +// Higher 32-bit is used to store Type for this value. +type Value uint64 + +// ValueID is the lower 32bit of Value, which is the pure identifier of Value without type info. +type ValueID uint32 + +const ( + valueIDInvalid ValueID = math.MaxUint32 + ValueInvalid Value = Value(valueIDInvalid) +) + +// Format creates a debug string for this Value using the data stored in Builder. +func (v Value) Format(b Builder) string { + if annotation, ok := b.(*builder).valueAnnotations[v.ID()]; ok { + return annotation + } + return fmt.Sprintf("v%d", v.ID()) +} + +func (v Value) formatWithType(b Builder) (ret string) { + if annotation, ok := b.(*builder).valueAnnotations[v.ID()]; ok { + ret = annotation + ":" + v.Type().String() + } else { + ret = fmt.Sprintf("v%d:%s", v.ID(), v.Type()) + } + + if wazevoapi.SSALoggingEnabled { // This is useful to check live value analysis bugs. + if bd := b.(*builder); bd.donePasses { + id := v.ID() + ret += fmt.Sprintf("(ref=%d)", bd.valueRefCounts[id]) + } + } + return ret +} + +// Valid returns true if this value is valid. +func (v Value) Valid() bool { + return v.ID() != valueIDInvalid +} + +// Type returns the Type of this value. +func (v Value) Type() Type { + return Type(v >> 32) +} + +// ID returns the valueID of this value. +func (v Value) ID() ValueID { + return ValueID(v) +} + +// setType sets a type to this Value and returns the updated Value. +func (v Value) setType(typ Type) Value { + return v | Value(typ)<<32 +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/debug_options.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/debug_options.go new file mode 100644 index 000000000..73b69c0de --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/debug_options.go @@ -0,0 +1,213 @@ +package wazevoapi + +import ( + "context" + "encoding/hex" + "fmt" + "math/rand" + "os" + "time" +) + +// These consts are used various places in the wazevo implementations. +// Instead of defining them in each file, we define them here so that we can quickly iterate on +// debugging without spending "where do we have debug logging?" time. + +// ----- Debug logging ----- +// These consts must be disabled by default. Enable them only when debugging. + +const ( + FrontEndLoggingEnabled = false + SSALoggingEnabled = false + RegAllocLoggingEnabled = false +) + +// ----- Output prints ----- +// These consts must be disabled by default. Enable them only when debugging. + +const ( + PrintSSA = false + PrintOptimizedSSA = false + PrintBlockLaidOutSSA = false + PrintSSAToBackendIRLowering = false + PrintRegisterAllocated = false + PrintFinalizedMachineCode = false + PrintMachineCodeHexPerFunction = printMachineCodeHexPerFunctionUnmodified || PrintMachineCodeHexPerFunctionDisassemblable //nolint + printMachineCodeHexPerFunctionUnmodified = false + // PrintMachineCodeHexPerFunctionDisassemblable prints the machine code while modifying the actual result + // to make it disassemblable. This is useful when debugging the final machine code. See the places where this is used for detail. + // When this is enabled, functions must not be called. + PrintMachineCodeHexPerFunctionDisassemblable = false +) + +// printTarget is the function index to print the machine code. This is used for debugging to print the machine code +// of a specific function. +const printTarget = -1 + +// PrintEnabledIndex returns true if the current function index is the print target. +func PrintEnabledIndex(ctx context.Context) bool { + if printTarget == -1 { + return true + } + return GetCurrentFunctionIndex(ctx) == printTarget +} + +// ----- Validations ----- +const ( + // SSAValidationEnabled enables the SSA validation. This is disabled by default since the operation is expensive. + SSAValidationEnabled = false +) + +// ----- Stack Guard Check ----- +const ( + // StackGuardCheckEnabled enables the stack guard check to ensure that our stack bounds check works correctly. + StackGuardCheckEnabled = false + StackGuardCheckGuardPageSize = 8096 +) + +// CheckStackGuardPage checks the given stack guard page is not corrupted. +func CheckStackGuardPage(s []byte) { + for i := 0; i < StackGuardCheckGuardPageSize; i++ { + if s[i] != 0 { + panic( + fmt.Sprintf("BUG: stack guard page is corrupted:\n\tguard_page=%s\n\tstack=%s", + hex.EncodeToString(s[:StackGuardCheckGuardPageSize]), + hex.EncodeToString(s[StackGuardCheckGuardPageSize:]), + )) + } + } +} + +// ----- Deterministic compilation verifier ----- + +const ( + // DeterministicCompilationVerifierEnabled enables the deterministic compilation verifier. This is disabled by default + // since the operation is expensive. But when in doubt, enable this to make sure the compilation is deterministic. + DeterministicCompilationVerifierEnabled = false + DeterministicCompilationVerifyingIter = 5 +) + +type ( + verifierState struct { + initialCompilationDone bool + maybeRandomizedIndexes []int + r *rand.Rand + values map[string]string + } + verifierStateContextKey struct{} + currentFunctionNameKey struct{} + currentFunctionIndexKey struct{} +) + +// NewDeterministicCompilationVerifierContext creates a new context with the deterministic compilation verifier used per wasm.Module. +func NewDeterministicCompilationVerifierContext(ctx context.Context, localFunctions int) context.Context { + maybeRandomizedIndexes := make([]int, localFunctions) + for i := range maybeRandomizedIndexes { + maybeRandomizedIndexes[i] = i + } + r := rand.New(rand.NewSource(time.Now().UnixNano())) + return context.WithValue(ctx, verifierStateContextKey{}, &verifierState{ + r: r, maybeRandomizedIndexes: maybeRandomizedIndexes, values: map[string]string{}, + }) +} + +// DeterministicCompilationVerifierRandomizeIndexes randomizes the indexes for the deterministic compilation verifier. +// To get the randomized index, use DeterministicCompilationVerifierGetRandomizedLocalFunctionIndex. +func DeterministicCompilationVerifierRandomizeIndexes(ctx context.Context) { + state := ctx.Value(verifierStateContextKey{}).(*verifierState) + if !state.initialCompilationDone { + // If this is the first attempt, we use the index as-is order. + state.initialCompilationDone = true + return + } + r := state.r + r.Shuffle(len(state.maybeRandomizedIndexes), func(i, j int) { + state.maybeRandomizedIndexes[i], state.maybeRandomizedIndexes[j] = state.maybeRandomizedIndexes[j], state.maybeRandomizedIndexes[i] + }) +} + +// DeterministicCompilationVerifierGetRandomizedLocalFunctionIndex returns the randomized index for the given `index` +// which is assigned by DeterministicCompilationVerifierRandomizeIndexes. +func DeterministicCompilationVerifierGetRandomizedLocalFunctionIndex(ctx context.Context, index int) int { + state := ctx.Value(verifierStateContextKey{}).(*verifierState) + ret := state.maybeRandomizedIndexes[index] + return ret +} + +// VerifyOrSetDeterministicCompilationContextValue verifies that the `newValue` is the same as the previous value for the given `scope` +// and the current function name. If the previous value doesn't exist, it sets the value to the given `newValue`. +// +// If the verification fails, this prints the diff and exits the process. +func VerifyOrSetDeterministicCompilationContextValue(ctx context.Context, scope string, newValue string) { + fn := ctx.Value(currentFunctionNameKey{}).(string) + key := fn + ": " + scope + verifierCtx := ctx.Value(verifierStateContextKey{}).(*verifierState) + oldValue, ok := verifierCtx.values[key] + if !ok { + verifierCtx.values[key] = newValue + return + } + if oldValue != newValue { + fmt.Printf( + `BUG: Deterministic compilation failed for function%s at scope="%s". + +This is mostly due to (but might not be limited to): + * Resetting ssa.Builder, backend.Compiler or frontend.Compiler, etc doens't work as expected, and the compilation has been affected by the previous iterations. + * Using a map with non-deterministic iteration order. + +---------- [old] ---------- +%s + +---------- [new] ---------- +%s +`, + fn, scope, oldValue, newValue, + ) + os.Exit(1) + } +} + +// nolint +const NeedFunctionNameInContext = PrintSSA || + PrintOptimizedSSA || + PrintBlockLaidOutSSA || + PrintSSAToBackendIRLowering || + PrintRegisterAllocated || + PrintFinalizedMachineCode || + PrintMachineCodeHexPerFunction || + DeterministicCompilationVerifierEnabled || + PerfMapEnabled + +// SetCurrentFunctionName sets the current function name to the given `functionName`. +func SetCurrentFunctionName(ctx context.Context, index int, functionName string) context.Context { + ctx = context.WithValue(ctx, currentFunctionNameKey{}, functionName) + ctx = context.WithValue(ctx, currentFunctionIndexKey{}, index) + return ctx +} + +// GetCurrentFunctionName returns the current function name. +func GetCurrentFunctionName(ctx context.Context) string { + ret, _ := ctx.Value(currentFunctionNameKey{}).(string) + return ret +} + +// GetCurrentFunctionIndex returns the current function index. +func GetCurrentFunctionIndex(ctx context.Context) int { + ret, _ := ctx.Value(currentFunctionIndexKey{}).(int) + return ret +} + +// ----- High Register Pressure ----- + +type highRegisterPressureContextKey struct{} + +// EnableHighRegisterPressure enables the high register pressure mode. +func EnableHighRegisterPressure(ctx context.Context) context.Context { + ctx = context.WithValue(ctx, highRegisterPressureContextKey{}, true) + return ctx +} + +// IsHighRegisterPressure returns true if the current compilation is under high register pressure. +func IsHighRegisterPressure(ctx context.Context) bool { + return ctx.Value(highRegisterPressureContextKey{}) != nil +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/exitcode.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/exitcode.go new file mode 100644 index 000000000..fd7c39892 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/exitcode.go @@ -0,0 +1,97 @@ +package wazevoapi + +// ExitCode is an exit code of an execution of a function. +type ExitCode uint32 + +const ( + ExitCodeOK ExitCode = iota + ExitCodeGrowStack + ExitCodeGrowMemory + ExitCodeUnreachable + ExitCodeMemoryOutOfBounds + // ExitCodeCallGoModuleFunction is an exit code for a call to an api.GoModuleFunction. + ExitCodeCallGoModuleFunction + // ExitCodeCallGoFunction is an exit code for a call to an api.GoFunction. + ExitCodeCallGoFunction + ExitCodeTableOutOfBounds + ExitCodeIndirectCallNullPointer + ExitCodeIndirectCallTypeMismatch + ExitCodeIntegerDivisionByZero + ExitCodeIntegerOverflow + ExitCodeInvalidConversionToInteger + ExitCodeCheckModuleExitCode + ExitCodeCallListenerBefore + ExitCodeCallListenerAfter + ExitCodeCallGoModuleFunctionWithListener + ExitCodeCallGoFunctionWithListener + ExitCodeTableGrow + ExitCodeRefFunc + exitCodeMax +) + +const ExitCodeMask = 0xff + +// String implements fmt.Stringer. +func (e ExitCode) String() string { + switch e { + case ExitCodeOK: + return "ok" + case ExitCodeGrowStack: + return "grow_stack" + case ExitCodeCallGoModuleFunction: + return "call_go_module_function" + case ExitCodeCallGoFunction: + return "call_go_function" + case ExitCodeUnreachable: + return "unreachable" + case ExitCodeMemoryOutOfBounds: + return "memory_out_of_bounds" + case ExitCodeTableOutOfBounds: + return "table_out_of_bounds" + case ExitCodeIndirectCallNullPointer: + return "indirect_call_null_pointer" + case ExitCodeIndirectCallTypeMismatch: + return "indirect_call_type_mismatch" + case ExitCodeIntegerDivisionByZero: + return "integer_division_by_zero" + case ExitCodeIntegerOverflow: + return "integer_overflow" + case ExitCodeInvalidConversionToInteger: + return "invalid_conversion_to_integer" + case ExitCodeCheckModuleExitCode: + return "check_module_exit_code" + case ExitCodeCallListenerBefore: + return "call_listener_before" + case ExitCodeCallListenerAfter: + return "call_listener_after" + case ExitCodeCallGoModuleFunctionWithListener: + return "call_go_module_function_with_listener" + case ExitCodeCallGoFunctionWithListener: + return "call_go_function_with_listener" + case ExitCodeGrowMemory: + return "grow_memory" + case ExitCodeTableGrow: + return "table_grow" + case ExitCodeRefFunc: + return "ref_func" + } + panic("TODO") +} + +func ExitCodeCallGoModuleFunctionWithIndex(index int, withListener bool) ExitCode { + if withListener { + return ExitCodeCallGoModuleFunctionWithListener | ExitCode(index<<8) + } + return ExitCodeCallGoModuleFunction | ExitCode(index<<8) +} + +func ExitCodeCallGoFunctionWithIndex(index int, withListener bool) ExitCode { + if withListener { + return ExitCodeCallGoFunctionWithListener | ExitCode(index<<8) + } + return ExitCodeCallGoFunction | ExitCode(index<<8) +} + +func GoFunctionIndexFromExitCode(exitCode ExitCode) int { + return int(exitCode >> 8) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/offsetdata.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/offsetdata.go new file mode 100644 index 000000000..09b7c1351 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/offsetdata.go @@ -0,0 +1,198 @@ +package wazevoapi + +import ( + "github.com/tetratelabs/wazero/internal/wasm" +) + +const ( + // FunctionInstanceSize is the size of wazevo.functionInstance. + FunctionInstanceSize = 24 + // FunctionInstanceExecutableOffset is an offset of `executable` field in wazevo.functionInstance + FunctionInstanceExecutableOffset = 0 + // FunctionInstanceModuleContextOpaquePtrOffset is an offset of `moduleContextOpaquePtr` field in wazevo.functionInstance + FunctionInstanceModuleContextOpaquePtrOffset = 8 + // FunctionInstanceTypeIDOffset is an offset of `typeID` field in wazevo.functionInstance + FunctionInstanceTypeIDOffset = 16 +) + +const ( + // ExecutionContextOffsetExitCodeOffset is an offset of `exitCode` field in wazevo.executionContext + ExecutionContextOffsetExitCodeOffset Offset = 0 + // ExecutionContextOffsetCallerModuleContextPtr is an offset of `callerModuleContextPtr` field in wazevo.executionContext + ExecutionContextOffsetCallerModuleContextPtr Offset = 8 + // ExecutionContextOffsetOriginalFramePointer is an offset of `originalFramePointer` field in wazevo.executionContext + ExecutionContextOffsetOriginalFramePointer Offset = 16 + // ExecutionContextOffsetOriginalStackPointer is an offset of `originalStackPointer` field in wazevo.executionContext + ExecutionContextOffsetOriginalStackPointer Offset = 24 + // ExecutionContextOffsetGoReturnAddress is an offset of `goReturnAddress` field in wazevo.executionContext + ExecutionContextOffsetGoReturnAddress Offset = 32 + // ExecutionContextOffsetStackBottomPtr is an offset of `stackBottomPtr` field in wazevo.executionContext + ExecutionContextOffsetStackBottomPtr Offset = 40 + // ExecutionContextOffsetGoCallReturnAddress is an offset of `goCallReturnAddress` field in wazevo.executionContext + ExecutionContextOffsetGoCallReturnAddress Offset = 48 + // ExecutionContextOffsetStackPointerBeforeGoCall is an offset of `StackPointerBeforeGoCall` field in wazevo.executionContext + ExecutionContextOffsetStackPointerBeforeGoCall Offset = 56 + // ExecutionContextOffsetStackGrowRequiredSize is an offset of `stackGrowRequiredSize` field in wazevo.executionContext + ExecutionContextOffsetStackGrowRequiredSize Offset = 64 + // ExecutionContextOffsetMemoryGrowTrampolineAddress is an offset of `memoryGrowTrampolineAddress` field in wazevo.executionContext + ExecutionContextOffsetMemoryGrowTrampolineAddress Offset = 72 + // ExecutionContextOffsetStackGrowCallTrampolineAddress is an offset of `stackGrowCallTrampolineAddress` field in wazevo.executionContext. + ExecutionContextOffsetStackGrowCallTrampolineAddress Offset = 80 + // ExecutionContextOffsetCheckModuleExitCodeTrampolineAddress is an offset of `checkModuleExitCodeTrampolineAddress` field in wazevo.executionContext. + ExecutionContextOffsetCheckModuleExitCodeTrampolineAddress Offset = 88 + // ExecutionContextOffsetSavedRegistersBegin is an offset of the first element of `savedRegisters` field in wazevo.executionContext + ExecutionContextOffsetSavedRegistersBegin Offset = 96 + // ExecutionContextOffsetGoFunctionCallCalleeModuleContextOpaque is an offset of `goFunctionCallCalleeModuleContextOpaque` field in wazevo.executionContext + ExecutionContextOffsetGoFunctionCallCalleeModuleContextOpaque Offset = 1120 + // ExecutionContextOffsetTableGrowTrampolineAddress is an offset of `tableGrowTrampolineAddress` field in wazevo.executionContext + ExecutionContextOffsetTableGrowTrampolineAddress Offset = 1128 + // ExecutionContextOffsetRefFuncTrampolineAddress is an offset of `refFuncTrampolineAddress` field in wazevo.executionContext + ExecutionContextOffsetRefFuncTrampolineAddress Offset = 1136 + ExecutionContextOffsetMemmoveAddress Offset = 1144 +) + +// ModuleContextOffsetData allows the compilers to get the information about offsets to the fields of wazevo.moduleContextOpaque, +// This is unique per module. +type ModuleContextOffsetData struct { + TotalSize int + ModuleInstanceOffset, + LocalMemoryBegin, + ImportedMemoryBegin, + ImportedFunctionsBegin, + GlobalsBegin, + TypeIDs1stElement, + TablesBegin, + BeforeListenerTrampolines1stElement, + AfterListenerTrampolines1stElement, + DataInstances1stElement, + ElementInstances1stElement Offset +} + +// ImportedFunctionOffset returns an offset of the i-th imported function. +// Each item is stored as wazevo.functionInstance whose size matches FunctionInstanceSize. +func (m *ModuleContextOffsetData) ImportedFunctionOffset(i wasm.Index) ( + executableOffset, moduleCtxOffset, typeIDOffset Offset, +) { + base := m.ImportedFunctionsBegin + Offset(i)*FunctionInstanceSize + return base, base + 8, base + 16 +} + +// GlobalInstanceOffset returns an offset of the i-th global instance. +func (m *ModuleContextOffsetData) GlobalInstanceOffset(i wasm.Index) Offset { + return m.GlobalsBegin + Offset(i)*16 +} + +// Offset represents an offset of a field of a struct. +type Offset int32 + +// U32 encodes an Offset as uint32 for convenience. +func (o Offset) U32() uint32 { + return uint32(o) +} + +// I64 encodes an Offset as int64 for convenience. +func (o Offset) I64() int64 { + return int64(o) +} + +// U64 encodes an Offset as int64 for convenience. +func (o Offset) U64() uint64 { + return uint64(o) +} + +// LocalMemoryBase returns an offset of the first byte of the local memory. +func (m *ModuleContextOffsetData) LocalMemoryBase() Offset { + return m.LocalMemoryBegin +} + +// LocalMemoryLen returns an offset of the length of the local memory buffer. +func (m *ModuleContextOffsetData) LocalMemoryLen() Offset { + if l := m.LocalMemoryBegin; l >= 0 { + return l + 8 + } + return -1 +} + +// TableOffset returns an offset of the i-th table instance. +func (m *ModuleContextOffsetData) TableOffset(tableIndex int) Offset { + return m.TablesBegin + Offset(tableIndex)*8 +} + +// NewModuleContextOffsetData creates a ModuleContextOffsetData determining the structure of moduleContextOpaque for the given Module. +// The structure is described in the comment of wazevo.moduleContextOpaque. +func NewModuleContextOffsetData(m *wasm.Module, withListener bool) ModuleContextOffsetData { + ret := ModuleContextOffsetData{} + var offset Offset + + ret.ModuleInstanceOffset = 0 + offset += 8 + + if m.MemorySection != nil { + ret.LocalMemoryBegin = offset + // buffer base + memory size. + const localMemorySizeInOpaqueModuleContext = 16 + offset += localMemorySizeInOpaqueModuleContext + } else { + // Indicates that there's no local memory + ret.LocalMemoryBegin = -1 + } + + if m.ImportMemoryCount > 0 { + // *wasm.MemoryInstance + imported memory's owner (moduleContextOpaque) + const importedMemorySizeInOpaqueModuleContext = 16 + ret.ImportedMemoryBegin = offset + offset += importedMemorySizeInOpaqueModuleContext + } else { + // Indicates that there's no imported memory + ret.ImportedMemoryBegin = -1 + } + + if m.ImportFunctionCount > 0 { + ret.ImportedFunctionsBegin = offset + // Each function is stored wazevo.functionInstance. + size := int(m.ImportFunctionCount) * FunctionInstanceSize + offset += Offset(size) + } else { + ret.ImportedFunctionsBegin = -1 + } + + if globals := int(m.ImportGlobalCount) + len(m.GlobalSection); globals > 0 { + ret.GlobalsBegin = offset + // Pointers to *wasm.GlobalInstance. + offset += Offset(globals) * 16 + } else { + ret.GlobalsBegin = -1 + } + + if tables := len(m.TableSection) + int(m.ImportTableCount); tables > 0 { + ret.TypeIDs1stElement = offset + offset += 8 // First element of TypeIDs. + + ret.TablesBegin = offset + // Pointers to *wasm.TableInstance. + offset += Offset(tables) * 8 + } else { + ret.TypeIDs1stElement = -1 + ret.TablesBegin = -1 + } + + if withListener { + ret.BeforeListenerTrampolines1stElement = offset + offset += 8 // First element of BeforeListenerTrampolines. + + ret.AfterListenerTrampolines1stElement = offset + offset += 8 // First element of AfterListenerTrampolines. + } else { + ret.BeforeListenerTrampolines1stElement = -1 + ret.AfterListenerTrampolines1stElement = -1 + } + + ret.DataInstances1stElement = offset + offset += 8 // First element of DataInstances. + + ret.ElementInstances1stElement = offset + offset += 8 // First element of ElementInstances. + + ret.TotalSize = int(offset) + return ret +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/perfmap.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/perfmap.go new file mode 100644 index 000000000..642c7f75d --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/perfmap.go @@ -0,0 +1,96 @@ +package wazevoapi + +import ( + "fmt" + "os" + "strconv" + "sync" +) + +var PerfMap *Perfmap + +func init() { + if PerfMapEnabled { + pid := os.Getpid() + filename := "/tmp/perf-" + strconv.Itoa(pid) + ".map" + + fh, err := os.OpenFile(filename, os.O_APPEND|os.O_RDWR|os.O_CREATE, 0o644) + if err != nil { + panic(err) + } + + PerfMap = &Perfmap{fh: fh} + } +} + +// Perfmap holds perfmap entries to be flushed into a perfmap file. +type Perfmap struct { + entries []entry + mux sync.Mutex + fh *os.File +} + +type entry struct { + index int + offset int64 + size uint64 + name string +} + +func (f *Perfmap) Lock() { + f.mux.Lock() +} + +func (f *Perfmap) Unlock() { + f.mux.Unlock() +} + +// AddModuleEntry adds a perfmap entry into the perfmap file. +// index is the index of the function in the module, offset is the offset of the function in the module, +// size is the size of the function, and name is the name of the function. +// +// Note that the entries are not flushed into the perfmap file until Flush is called, +// and the entries are module-scoped; Perfmap must be locked until Flush is called. +func (f *Perfmap) AddModuleEntry(index int, offset int64, size uint64, name string) { + e := entry{index: index, offset: offset, size: size, name: name} + if f.entries == nil { + f.entries = []entry{e} + return + } + f.entries = append(f.entries, e) +} + +// Flush writes the perfmap entries into the perfmap file where the entries are adjusted by the given `addr` and `functionOffsets`. +func (f *Perfmap) Flush(addr uintptr, functionOffsets []int) { + defer func() { + _ = f.fh.Sync() + }() + + for _, e := range f.entries { + if _, err := f.fh.WriteString(fmt.Sprintf("%x %s %s\n", + uintptr(e.offset)+addr+uintptr(functionOffsets[e.index]), + strconv.FormatUint(e.size, 16), + e.name, + )); err != nil { + panic(err) + } + } + f.entries = f.entries[:0] +} + +// Clear clears the perfmap entries not yet flushed. +func (f *Perfmap) Clear() { + f.entries = f.entries[:0] +} + +// AddEntry writes a perfmap entry directly into the perfmap file, not using the entries. +func (f *Perfmap) AddEntry(addr uintptr, size uint64, name string) { + _, err := f.fh.WriteString(fmt.Sprintf("%x %s %s\n", + addr, + strconv.FormatUint(size, 16), + name, + )) + if err != nil { + panic(err) + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/perfmap_disabled.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/perfmap_disabled.go new file mode 100644 index 000000000..bcc4e545c --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/perfmap_disabled.go @@ -0,0 +1,5 @@ +//go:build !perfmap + +package wazevoapi + +const PerfMapEnabled = false diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/perfmap_enabled.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/perfmap_enabled.go new file mode 100644 index 000000000..2a39879ec --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/perfmap_enabled.go @@ -0,0 +1,5 @@ +//go:build perfmap + +package wazevoapi + +const PerfMapEnabled = true diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/pool.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/pool.go new file mode 100644 index 000000000..500b32870 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/pool.go @@ -0,0 +1,59 @@ +package wazevoapi + +const poolPageSize = 128 + +// Pool is a pool of T that can be allocated and reset. +// This is useful to avoid unnecessary allocations. +type Pool[T any] struct { + pages []*[poolPageSize]T + resetFn func(*T) + allocated, index int +} + +// NewPool returns a new Pool. +// resetFn is called when a new T is allocated in Pool.Allocate. +func NewPool[T any](resetFn func(*T)) Pool[T] { + var ret Pool[T] + ret.resetFn = resetFn + ret.Reset() + return ret +} + +// Allocated returns the number of allocated T currently in the pool. +func (p *Pool[T]) Allocated() int { + return p.allocated +} + +// Allocate allocates a new T from the pool. +func (p *Pool[T]) Allocate() *T { + if p.index == poolPageSize { + if len(p.pages) == cap(p.pages) { + p.pages = append(p.pages, new([poolPageSize]T)) + } else { + i := len(p.pages) + p.pages = p.pages[:i+1] + if p.pages[i] == nil { + p.pages[i] = new([poolPageSize]T) + } + } + p.index = 0 + } + ret := &p.pages[len(p.pages)-1][p.index] + p.resetFn(ret) + p.index++ + p.allocated++ + return ret +} + +// View returns the pointer to i-th item from the pool. +func (p *Pool[T]) View(i int) *T { + page, index := i/poolPageSize, i%poolPageSize + return &p.pages[page][index] +} + +// Reset resets the pool. +func (p *Pool[T]) Reset() { + p.pages = p.pages[:0] + p.index = poolPageSize + p.allocated = 0 +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/filecache/compilationcache.go b/vendor/github.com/tetratelabs/wazero/internal/filecache/compilationcache.go new file mode 100644 index 000000000..b2dbd4650 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/filecache/compilationcache.go @@ -0,0 +1,42 @@ +package filecache + +import ( + "crypto/sha256" + "io" +) + +// Cache allows the compiler engine to skip compilation of wasm to machine code +// where doing so is redundant for the same wasm binary and version of wazero. +// +// This augments the default in-memory cache of compiled functions, by +// decoupling it from a wazero.Runtime instance. Concretely, a runtime loses +// its cache once closed. This cache allows the runtime to rebuild its +// in-memory cache quicker, significantly reducing first-hit penalty on a hit. +// +// See New for the example implementation. +type Cache interface { + // Get is called when the runtime is trying to get the cached compiled functions. + // Implementations are supposed to return compiled function in io.Reader with ok=true + // if the key exists on the cache. In the case of not-found, this should return + // ok=false with err=nil. content.Close() is automatically called by + // the caller of this Get. + // + // Note: the returned content won't go through the validation pass of Wasm binary + // which is applied when the binary is compiled from scratch without cache hit. + Get(key Key) (content io.ReadCloser, ok bool, err error) + // + // Add is called when the runtime is trying to add the new cache entry. + // The given `content` must be un-modified, and returned as-is in Get method. + // + // Note: the `content` is ensured to be safe through the validation phase applied on the Wasm binary. + Add(key Key, content io.Reader) (err error) + // + // Delete is called when the cache on the `key` returned by Get is no longer usable, and + // must be purged. Specifically, this is called happens when the wazero's version has been changed. + // For example, that is when there's a difference between the version of compiling wazero and the + // version of the currently used wazero. + Delete(key Key) (err error) +} + +// Key represents the 256-bit unique identifier assigned to each cache entry. +type Key = [sha256.Size]byte diff --git a/vendor/github.com/tetratelabs/wazero/internal/filecache/file_cache.go b/vendor/github.com/tetratelabs/wazero/internal/filecache/file_cache.go new file mode 100644 index 000000000..4898c710c --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/filecache/file_cache.go @@ -0,0 +1,107 @@ +package filecache + +import ( + "encoding/hex" + "errors" + "io" + "os" + "path" + "sync" +) + +// New returns a new Cache implemented by fileCache. +func New(dir string) Cache { + return newFileCache(dir) +} + +func newFileCache(dir string) *fileCache { + return &fileCache{dirPath: dir} +} + +// fileCache persists compiled functions into dirPath. +// +// Note: this can be expanded to do binary signing/verification, set TTL on each entry, etc. +type fileCache struct { + dirPath string + mux sync.RWMutex +} + +type fileReadCloser struct { + *os.File + fc *fileCache +} + +func (fc *fileCache) path(key Key) string { + return path.Join(fc.dirPath, hex.EncodeToString(key[:])) +} + +func (fc *fileCache) Get(key Key) (content io.ReadCloser, ok bool, err error) { + // TODO: take lock per key for more efficiency vs the complexity of impl. + fc.mux.RLock() + unlock := fc.mux.RUnlock + defer func() { + if unlock != nil { + unlock() + } + }() + + f, err := os.Open(fc.path(key)) + if errors.Is(err, os.ErrNotExist) { + return nil, false, nil + } else if err != nil { + return nil, false, err + } else { + // Unlock is done inside the content.Close() at the call site. + unlock = nil + return &fileReadCloser{File: f, fc: fc}, true, nil + } +} + +// Close wraps the os.File Close to release the read lock on fileCache. +func (f *fileReadCloser) Close() (err error) { + defer f.fc.mux.RUnlock() + err = f.File.Close() + return +} + +func (fc *fileCache) Add(key Key, content io.Reader) (err error) { + // TODO: take lock per key for more efficiency vs the complexity of impl. + fc.mux.Lock() + defer fc.mux.Unlock() + + // Use rename for an atomic write + path := fc.path(key) + file, err := os.Create(path + ".tmp") + if err != nil { + return + } + defer func() { + if err != nil { + _ = os.Remove(file.Name()) + } + }() + defer file.Close() + if _, err = io.Copy(file, content); err != nil { + return + } + if err = file.Sync(); err != nil { + return + } + if err = file.Close(); err != nil { + return + } + err = os.Rename(file.Name(), path) + return +} + +func (fc *fileCache) Delete(key Key) (err error) { + // TODO: take lock per key for more efficiency vs the complexity of impl. + fc.mux.Lock() + defer fc.mux.Unlock() + + err = os.Remove(fc.path(key)) + if errors.Is(err, os.ErrNotExist) { + err = nil + } + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/fsapi/file.go b/vendor/github.com/tetratelabs/wazero/internal/fsapi/file.go new file mode 100644 index 000000000..0640b2271 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/fsapi/file.go @@ -0,0 +1,69 @@ +package fsapi + +import experimentalsys "github.com/tetratelabs/wazero/experimental/sys" + +// File includes methods not yet ready to document for end users, notably +// non-blocking functionality. +// +// Particularly, Poll is subject to debate. For example, whether a user should +// be able to choose how to implement timeout or not. Currently, this interface +// allows the user to choose to sleep or use native polling, and which choice +// they make impacts thread behavior as summarized here: +// https://github.com/tetratelabs/wazero/pull/1606#issuecomment-1665475516 +type File interface { + experimentalsys.File + + // IsNonblock returns true if the file was opened with O_NONBLOCK, or + // SetNonblock was successfully enabled on this file. + // + // # Notes + // + // - This might not match the underlying state of the file descriptor if + // the file was not opened via OpenFile. + IsNonblock() bool + + // SetNonblock toggles the non-blocking mode (O_NONBLOCK) of this file. + // + // # Errors + // + // A zero Errno is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - EBADF: the file or directory was closed. + // + // # Notes + // + // - This is like syscall.SetNonblock and `fcntl` with O_NONBLOCK in + // POSIX. See https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html + SetNonblock(enable bool) experimentalsys.Errno + + // Poll returns if the file has data ready to be read or written. + // + // # Parameters + // + // The `flag` parameter determines which event to await, such as POLLIN, + // POLLOUT, or a combination like `POLLIN|POLLOUT`. + // + // The `timeoutMillis` parameter is how long to block for an event, or + // interrupted, in milliseconds. There are two special values: + // - zero returns immediately + // - any negative value blocks any amount of time + // + // # Results + // + // `ready` means there was data ready to read or written. False can mean no + // event was ready or `errno` is not zero. + // + // A zero `errno` is success. The below are expected otherwise: + // - ENOSYS: the implementation does not support this function. + // - ENOTSUP: the implementation does not the flag combination. + // - EINTR: the call was interrupted prior to an event. + // + // # Notes + // + // - This is like `poll` in POSIX, for a single file. + // See https://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html + // - No-op files, such as those which read from /dev/null, should return + // immediately true, as data will never become available. + // - See /RATIONALE.md for detailed notes including impact of blocking. + Poll(flag Pflag, timeoutMillis int32) (ready bool, errno experimentalsys.Errno) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/fsapi/poll.go b/vendor/github.com/tetratelabs/wazero/internal/fsapi/poll.go new file mode 100644 index 000000000..25f7c5711 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/fsapi/poll.go @@ -0,0 +1,20 @@ +package fsapi + +// Pflag are bit flags used for File.Poll. Values, including zero, should not +// be interpreted numerically. Instead, use by constants prefixed with 'POLL'. +// +// # Notes +// +// - This is like `pollfd.events` flags for `poll` in POSIX. See +// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/poll.h.html +type Pflag uint32 + +// Only define bitflags we support and are needed by `poll_oneoff` in wasip1 +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#eventrwflags +const ( + // POLLIN is a read event. + POLLIN Pflag = 1 << iota + + // POLLOUT is a write event. + POLLOUT +) diff --git a/vendor/github.com/tetratelabs/wazero/internal/fsapi/unimplemented.go b/vendor/github.com/tetratelabs/wazero/internal/fsapi/unimplemented.go new file mode 100644 index 000000000..99d9c2db3 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/fsapi/unimplemented.go @@ -0,0 +1,27 @@ +package fsapi + +import experimentalsys "github.com/tetratelabs/wazero/experimental/sys" + +func Adapt(f experimentalsys.File) File { + if f, ok := f.(File); ok { + return f + } + return unimplementedFile{f} +} + +type unimplementedFile struct{ experimentalsys.File } + +// IsNonblock implements File.IsNonblock +func (unimplementedFile) IsNonblock() bool { + return false +} + +// SetNonblock implements File.SetNonblock +func (unimplementedFile) SetNonblock(bool) experimentalsys.Errno { + return experimentalsys.ENOSYS +} + +// Poll implements File.Poll +func (unimplementedFile) Poll(Pflag, int32) (ready bool, errno experimentalsys.Errno) { + return false, experimentalsys.ENOSYS +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/ieee754/ieee754.go b/vendor/github.com/tetratelabs/wazero/internal/ieee754/ieee754.go new file mode 100644 index 000000000..0c9298957 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/ieee754/ieee754.go @@ -0,0 +1,29 @@ +package ieee754 + +import ( + "encoding/binary" + "io" + "math" +) + +// DecodeFloat32 decodes a float32 in IEEE 754 binary representation. +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#floating-point%E2%91%A2 +func DecodeFloat32(buf []byte) (float32, error) { + if len(buf) < 4 { + return 0, io.ErrUnexpectedEOF + } + + raw := binary.LittleEndian.Uint32(buf[:4]) + return math.Float32frombits(raw), nil +} + +// DecodeFloat64 decodes a float64 in IEEE 754 binary representation. +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#floating-point%E2%91%A2 +func DecodeFloat64(buf []byte) (float64, error) { + if len(buf) < 8 { + return 0, io.ErrUnexpectedEOF + } + + raw := binary.LittleEndian.Uint64(buf) + return math.Float64frombits(raw), nil +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/integration_test/engine/testdata/infinite_loop.wasm b/vendor/github.com/tetratelabs/wazero/internal/integration_test/engine/testdata/infinite_loop.wasm new file mode 100644 index 0000000000000000000000000000000000000000..6b5794135936f712d7f1929787147f8eb794fcd8 GIT binary patch literal 48 zcmZQbEY4+QU|?WmVN76PU}j=uU>9WM&CE;7%*!lEjnB!?FJNHc;$&oJV0PeP;N}JZ DyyyqS literal 0 HcmV?d00001 diff --git a/vendor/github.com/tetratelabs/wazero/internal/integration_test/vs/testdata/fac.wasm b/vendor/github.com/tetratelabs/wazero/internal/integration_test/vs/testdata/fac.wasm new file mode 100644 index 0000000000000000000000000000000000000000..5e3dcb064bfe5d81eb127a037a6c4c8ceb3b8da1 GIT binary patch literal 146 zcmW;Eu?oUK5CqVf+cSwClB&JR?l zI#@(aDwjbOFQBUf>sua=rDV8GFBSH7q4`5AJ0wFSGEyTGzYz(SExI-Y9Q-rSSF9U* W(SLGzvvpX#?&Eag!dWUhf{!12^%+6{ literal 0 HcmV?d00001 diff --git a/vendor/github.com/tetratelabs/wazero/internal/integration_test/vs/testdata/mem_grow.wasm b/vendor/github.com/tetratelabs/wazero/internal/integration_test/vs/testdata/mem_grow.wasm new file mode 100644 index 0000000000000000000000000000000000000000..a2c9f66d0f0408979282d9cb627d387cc046d0b4 GIT binary patch literal 59 zcmV~$I}Uh*;v`Dq|V!-}AF6>= 7 + + // The encoding unsigned numbers is simpler as it only needs to check if the value is non-zero to tell if there + // are more bits to encode. Signed is a little more complicated as you have to double-check the sign bit. + // If either case, set the high-order bit to tell the reader there are more bytes in this int. + if (value != -1 || s == 0) && (value != 0 || s != 0) { + b |= 0x80 + } + + // Append b into the buffer + buf = append(buf, b) + if b&0x80 == 0 { + break + } + } + return buf +} + +// EncodeUint32 encodes the value into a buffer in LEB128 format +// +// See https://en.wikipedia.org/wiki/LEB128#Encode_unsigned_integer +func EncodeUint32(value uint32) []byte { + return EncodeUint64(uint64(value)) +} + +// EncodeUint64 encodes the value into a buffer in LEB128 format +// +// See https://en.wikipedia.org/wiki/LEB128#Encode_unsigned_integer +func EncodeUint64(value uint64) (buf []byte) { + // This is effectively a do/while loop where we take 7 bits of the value and encode them until it is zero. + for { + // Take 7 remaining low-order bits from the value into b. + b := uint8(value & 0x7f) + value = value >> 7 + + // If there are remaining bits, the value won't be zero: Set the high- + // order bit to tell the reader there are more bytes in this uint. + if value != 0 { + b |= 0x80 + } + + // Append b into the buffer + buf = append(buf, b) + if b&0x80 == 0 { + return buf + } + } +} + +type nextByte func(i int) (byte, error) + +func DecodeUint32(r io.ByteReader) (ret uint32, bytesRead uint64, err error) { + return decodeUint32(func(_ int) (byte, error) { return r.ReadByte() }) +} + +func LoadUint32(buf []byte) (ret uint32, bytesRead uint64, err error) { + return decodeUint32(func(i int) (byte, error) { + if i >= len(buf) { + return 0, io.EOF + } + return buf[i], nil + }) +} + +func decodeUint32(next nextByte) (ret uint32, bytesRead uint64, err error) { + // Derived from https://github.com/golang/go/blob/go1.20/src/encoding/binary/varint.go + // with the modification on the overflow handling tailored for 32-bits. + var s uint32 + for i := 0; i < maxVarintLen32; i++ { + b, err := next(i) + if err != nil { + return 0, 0, err + } + if b < 0x80 { + // Unused bits must be all zero. + if i == maxVarintLen32-1 && (b&0xf0) > 0 { + return 0, 0, errOverflow32 + } + return ret | uint32(b)<= bufLen { + return 0, 0, io.EOF + } + b := buf[i] + if b < 0x80 { + // Unused bits (non first bit) must all be zero. + if i == maxVarintLen64-1 && b > 1 { + return 0, 0, errOverflow64 + } + return ret | uint64(b)<= len(buf) { + return 0, io.EOF + } + return buf[i], nil + }) +} + +func decodeInt32(next nextByte) (ret int32, bytesRead uint64, err error) { + var shift int + var b byte + for { + b, err = next(int(bytesRead)) + if err != nil { + return 0, 0, fmt.Errorf("readByte failed: %w", err) + } + ret |= (int32(b) & 0x7f) << shift + shift += 7 + bytesRead++ + if b&0x80 == 0 { + if shift < 32 && (b&0x40) != 0 { + ret |= ^0 << shift + } + // Over flow checks. + // fixme: can be optimized. + if bytesRead > maxVarintLen32 { + return 0, 0, errOverflow32 + } else if unused := b & 0b00110000; bytesRead == maxVarintLen32 && ret < 0 && unused != 0b00110000 { + return 0, 0, errOverflow32 + } else if bytesRead == maxVarintLen32 && ret >= 0 && unused != 0x00 { + return 0, 0, errOverflow32 + } + return + } + } +} + +// DecodeInt33AsInt64 is a special cased decoder for wasm.BlockType which is encoded as a positive signed integer, yet +// still needs to fit the 32-bit range of allowed indices. Hence, this is 33, not 32-bit! +// +// See https://webassembly.github.io/spec/core/binary/instructions.html#control-instructions +func DecodeInt33AsInt64(r io.ByteReader) (ret int64, bytesRead uint64, err error) { + var shift int + var b int64 + var rb byte + for shift < 35 { + rb, err = r.ReadByte() + if err != nil { + return 0, 0, fmt.Errorf("readByte failed: %w", err) + } + b = int64(rb) + ret |= (b & int33Mask2) << shift + shift += 7 + bytesRead++ + if b&int33Mask == 0 { + break + } + } + + // fixme: can be optimized + if shift < 33 && (b&int33Mask3) == int33Mask3 { + ret |= int33Mask4 << shift + } + ret = ret & int33Mask4 + + // if 33rd bit == 1, we translate it as a corresponding signed-33bit minus value + if ret&int33Mask5 > 0 { + ret = ret - int33Mask6 + } + // Over flow checks. + // fixme: can be optimized. + if bytesRead > maxVarintLen33 { + return 0, 0, errOverflow33 + } else if unused := b & 0b00100000; bytesRead == maxVarintLen33 && ret < 0 && unused != 0b00100000 { + return 0, 0, errOverflow33 + } else if bytesRead == maxVarintLen33 && ret >= 0 && unused != 0x00 { + return 0, 0, errOverflow33 + } + return ret, bytesRead, nil +} + +func DecodeInt64(r io.ByteReader) (ret int64, bytesRead uint64, err error) { + return decodeInt64(func(_ int) (byte, error) { return r.ReadByte() }) +} + +func LoadInt64(buf []byte) (ret int64, bytesRead uint64, err error) { + return decodeInt64(func(i int) (byte, error) { + if i >= len(buf) { + return 0, io.EOF + } + return buf[i], nil + }) +} + +func decodeInt64(next nextByte) (ret int64, bytesRead uint64, err error) { + var shift int + var b byte + for { + b, err = next(int(bytesRead)) + if err != nil { + return 0, 0, fmt.Errorf("readByte failed: %w", err) + } + ret |= (int64(b) & 0x7f) << shift + shift += 7 + bytesRead++ + if b&0x80 == 0 { + if shift < 64 && (b&int64Mask3) == int64Mask3 { + ret |= int64Mask4 << shift + } + // Over flow checks. + // fixme: can be optimized. + if bytesRead > maxVarintLen64 { + return 0, 0, errOverflow64 + } else if unused := b & 0b00111110; bytesRead == maxVarintLen64 && ret < 0 && unused != 0b00111110 { + return 0, 0, errOverflow64 + } else if bytesRead == maxVarintLen64 && ret >= 0 && unused != 0x00 { + return 0, 0, errOverflow64 + } + return + } + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/moremath/moremath.go b/vendor/github.com/tetratelabs/wazero/internal/moremath/moremath.go new file mode 100644 index 000000000..4741f07bb --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/moremath/moremath.go @@ -0,0 +1,271 @@ +package moremath + +import ( + "math" +) + +// https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/syntax/values.html#floating-point +const ( + // F32CanonicalNaNBits is the 32-bit float where payload's MSB equals 1 and others are all zero. + F32CanonicalNaNBits = uint32(0x7fc0_0000) + // F32CanonicalNaNBitsMask can be used to judge the value `v` is canonical nan as "v&F32CanonicalNaNBitsMask == F32CanonicalNaNBits" + F32CanonicalNaNBitsMask = uint32(0x7fff_ffff) + // F64CanonicalNaNBits is the 64-bit float where payload's MSB equals 1 and others are all zero. + F64CanonicalNaNBits = uint64(0x7ff8_0000_0000_0000) + // F64CanonicalNaNBitsMask can be used to judge the value `v` is canonical nan as "v&F64CanonicalNaNBitsMask == F64CanonicalNaNBits" + F64CanonicalNaNBitsMask = uint64(0x7fff_ffff_ffff_ffff) + // F32ArithmeticNaNPayloadMSB is used to extract the most significant bit of payload of 32-bit arithmetic NaN values + F32ArithmeticNaNPayloadMSB = uint32(0x0040_0000) + // F32ExponentMask is used to extract the exponent of 32-bit floating point. + F32ExponentMask = uint32(0x7f80_0000) + // F32ArithmeticNaNBits is an example 32-bit arithmetic NaN. + F32ArithmeticNaNBits = F32CanonicalNaNBits | 0b1 // Set first bit to make this different from the canonical NaN. + // F64ArithmeticNaNPayloadMSB is used to extract the most significant bit of payload of 64-bit arithmetic NaN values + F64ArithmeticNaNPayloadMSB = uint64(0x0008_0000_0000_0000) + // F64ExponentMask is used to extract the exponent of 64-bit floating point. + F64ExponentMask = uint64(0x7ff0_0000_0000_0000) + // F64ArithmeticNaNBits is an example 64-bit arithmetic NaN. + F64ArithmeticNaNBits = F64CanonicalNaNBits | 0b1 // Set first bit to make this different from the canonical NaN. +) + +// WasmCompatMin64 is the Wasm spec compatible variant of math.Min for 64-bit floating points. +func WasmCompatMin64(x, y float64) float64 { + switch { + case math.IsNaN(x) || math.IsNaN(y): + return returnF64NaNBinOp(x, y) + case math.IsInf(x, -1) || math.IsInf(y, -1): + return math.Inf(-1) + case x == 0 && x == y: + if math.Signbit(x) { + return x + } + return y + } + if x < y { + return x + } + return y +} + +// WasmCompatMin32 is the Wasm spec compatible variant of math.Min for 32-bit floating points. +func WasmCompatMin32(x, y float32) float32 { + x64, y64 := float64(x), float64(y) + switch { + case math.IsNaN(x64) || math.IsNaN(y64): + return returnF32NaNBinOp(x, y) + case math.IsInf(x64, -1) || math.IsInf(y64, -1): + return float32(math.Inf(-1)) + case x == 0 && x == y: + if math.Signbit(x64) { + return x + } + return y + } + if x < y { + return x + } + return y +} + +// WasmCompatMax64 is the Wasm spec compatible variant of math.Max for 64-bit floating points. +func WasmCompatMax64(x, y float64) float64 { + switch { + case math.IsNaN(x) || math.IsNaN(y): + return returnF64NaNBinOp(x, y) + case math.IsInf(x, 1) || math.IsInf(y, 1): + return math.Inf(1) + case x == 0 && x == y: + if math.Signbit(x) { + return y + } + return x + } + if x > y { + return x + } + return y +} + +// WasmCompatMax32 is the Wasm spec compatible variant of math.Max for 32-bit floating points. +func WasmCompatMax32(x, y float32) float32 { + x64, y64 := float64(x), float64(y) + switch { + case math.IsNaN(x64) || math.IsNaN(y64): + return returnF32NaNBinOp(x, y) + case math.IsInf(x64, 1) || math.IsInf(y64, 1): + return float32(math.Inf(1)) + case x == 0 && x == y: + if math.Signbit(x64) { + return y + } + return x + } + if x > y { + return x + } + return y +} + +// WasmCompatNearestF32 is the Wasm spec compatible variant of math.Round, used for Nearest instruction. +// For example, this converts 1.9 to 2.0, and this has the semantics of LLVM's rint intrinsic. +// +// e.g. math.Round(-4.5) results in -5 while this results in -4. +// +// See https://llvm.org/docs/LangRef.html#llvm-rint-intrinsic. +func WasmCompatNearestF32(f float32) float32 { + var res float32 + // TODO: look at https://github.com/bytecodealliance/wasmtime/pull/2171 and reconsider this algorithm + if f != 0 { + ceil := float32(math.Ceil(float64(f))) + floor := float32(math.Floor(float64(f))) + distToCeil := math.Abs(float64(f - ceil)) + distToFloor := math.Abs(float64(f - floor)) + h := ceil / 2.0 + if distToCeil < distToFloor { + res = ceil + } else if distToCeil == distToFloor && float32(math.Floor(float64(h))) == h { + res = ceil + } else { + res = floor + } + } else { + res = f + } + return returnF32UniOp(f, res) +} + +// WasmCompatNearestF64 is the Wasm spec compatible variant of math.Round, used for Nearest instruction. +// For example, this converts 1.9 to 2.0, and this has the semantics of LLVM's rint intrinsic. +// +// e.g. math.Round(-4.5) results in -5 while this results in -4. +// +// See https://llvm.org/docs/LangRef.html#llvm-rint-intrinsic. +func WasmCompatNearestF64(f float64) float64 { + // TODO: look at https://github.com/bytecodealliance/wasmtime/pull/2171 and reconsider this algorithm + var res float64 + if f != 0 { + ceil := math.Ceil(f) + floor := math.Floor(f) + distToCeil := math.Abs(f - ceil) + distToFloor := math.Abs(f - floor) + h := ceil / 2.0 + if distToCeil < distToFloor { + res = ceil + } else if distToCeil == distToFloor && math.Floor(h) == h { + res = ceil + } else { + res = floor + } + } else { + res = f + } + return returnF64UniOp(f, res) +} + +// WasmCompatCeilF32 is the same as math.Ceil on 32-bit except that +// the returned NaN value follows the Wasm specification on NaN +// propagation. +// https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/numerics.html#nan-propagation +func WasmCompatCeilF32(f float32) float32 { + return returnF32UniOp(f, float32(math.Ceil(float64(f)))) +} + +// WasmCompatCeilF64 is the same as math.Ceil on 64-bit except that +// the returned NaN value follows the Wasm specification on NaN +// propagation. +// https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/numerics.html#nan-propagation +func WasmCompatCeilF64(f float64) float64 { + return returnF64UniOp(f, math.Ceil(f)) +} + +// WasmCompatFloorF32 is the same as math.Floor on 32-bit except that +// the returned NaN value follows the Wasm specification on NaN +// propagation. +// https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/numerics.html#nan-propagation +func WasmCompatFloorF32(f float32) float32 { + return returnF32UniOp(f, float32(math.Floor(float64(f)))) +} + +// WasmCompatFloorF64 is the same as math.Floor on 64-bit except that +// the returned NaN value follows the Wasm specification on NaN +// propagation. +// https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/numerics.html#nan-propagation +func WasmCompatFloorF64(f float64) float64 { + return returnF64UniOp(f, math.Floor(f)) +} + +// WasmCompatTruncF32 is the same as math.Trunc on 32-bit except that +// the returned NaN value follows the Wasm specification on NaN +// propagation. +// https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/numerics.html#nan-propagation +func WasmCompatTruncF32(f float32) float32 { + return returnF32UniOp(f, float32(math.Trunc(float64(f)))) +} + +// WasmCompatTruncF64 is the same as math.Trunc on 64-bit except that +// the returned NaN value follows the Wasm specification on NaN +// propagation. +// https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/numerics.html#nan-propagation +func WasmCompatTruncF64(f float64) float64 { + return returnF64UniOp(f, math.Trunc(f)) +} + +func f32IsNaN(v float32) bool { + return v != v // this is how NaN is defined. +} + +func f64IsNaN(v float64) bool { + return v != v // this is how NaN is defined. +} + +// returnF32UniOp returns the result of 32-bit unary operation. This accepts `original` which is the operand, +// and `result` which is its result. This returns the `result` as-is if the result is not NaN. Otherwise, this follows +// the same logic as in the reference interpreter as well as the amd64 and arm64 floating point handling. +func returnF32UniOp(original, result float32) float32 { + // Following the same logic as in the reference interpreter: + // https://github.com/WebAssembly/spec/blob/d48af683f5e6d00c13f775ab07d29a15daf92203/interpreter/exec/fxx.ml#L115-L122 + if !f32IsNaN(result) { + return result + } + if !f32IsNaN(original) { + return math.Float32frombits(F32CanonicalNaNBits) + } + return math.Float32frombits(math.Float32bits(original) | F32CanonicalNaNBits) +} + +// returnF32UniOp returns the result of 64-bit unary operation. This accepts `original` which is the operand, +// and `result` which is its result. This returns the `result` as-is if the result is not NaN. Otherwise, this follows +// the same logic as in the reference interpreter as well as the amd64 and arm64 floating point handling. +func returnF64UniOp(original, result float64) float64 { + // Following the same logic as in the reference interpreter (== amd64 and arm64's behavior): + // https://github.com/WebAssembly/spec/blob/d48af683f5e6d00c13f775ab07d29a15daf92203/interpreter/exec/fxx.ml#L115-L122 + if !f64IsNaN(result) { + return result + } + if !f64IsNaN(original) { + return math.Float64frombits(F64CanonicalNaNBits) + } + return math.Float64frombits(math.Float64bits(original) | F64CanonicalNaNBits) +} + +// returnF64NaNBinOp returns a NaN for 64-bit binary operations. `x` and `y` are original floats +// and at least one of them is NaN. The returned NaN is guaranteed to comply with the NaN propagation +// procedure: https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/numerics.html#nan-propagation +func returnF64NaNBinOp(x, y float64) float64 { + if f64IsNaN(x) { + return math.Float64frombits(math.Float64bits(x) | F64CanonicalNaNBits) + } else { + return math.Float64frombits(math.Float64bits(y) | F64CanonicalNaNBits) + } +} + +// returnF64NaNBinOp returns a NaN for 32-bit binary operations. `x` and `y` are original floats +// and at least one of them is NaN. The returned NaN is guaranteed to comply with the NaN propagation +// procedure: https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/numerics.html#nan-propagation +func returnF32NaNBinOp(x, y float32) float32 { + if f32IsNaN(x) { + return math.Float32frombits(math.Float32bits(x) | F32CanonicalNaNBits) + } else { + return math.Float32frombits(math.Float32bits(y) | F32CanonicalNaNBits) + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/platform/cpuid_amd64.go b/vendor/github.com/tetratelabs/wazero/internal/platform/cpuid_amd64.go new file mode 100644 index 000000000..2702d3162 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/platform/cpuid_amd64.go @@ -0,0 +1,79 @@ +package platform + +const ( + // CpuFeatureSSE3 is the flag to query CpuFeatureFlags.Has for SSEv3 capabilities + CpuFeatureSSE3 = uint64(1) + // CpuFeatureSSE4_1 is the flag to query CpuFeatureFlags.Has for SSEv4.1 capabilities + CpuFeatureSSE4_1 = uint64(1) << 19 + // CpuFeatureSSE4_2 is the flag to query CpuFeatureFlags.Has for SSEv4.2 capabilities + CpuFeatureSSE4_2 = uint64(1) << 20 +) + +const ( + // CpuExtraFeatureABM is the flag to query CpuFeatureFlags.HasExtra for Advanced Bit Manipulation capabilities (e.g. LZCNT) + CpuExtraFeatureABM = uint64(1) << 5 +) + +// CpuFeatures exposes the capabilities for this CPU, queried via the Has, HasExtra methods +var CpuFeatures CpuFeatureFlags = loadCpuFeatureFlags() + +// CpuFeatureFlags exposes methods for querying CPU capabilities +type CpuFeatureFlags interface { + // Has returns true when the specified flag (represented as uint64) is supported + Has(cpuFeature uint64) bool + // HasExtra returns true when the specified extraFlag (represented as uint64) is supported + HasExtra(cpuFeature uint64) bool +} + +// cpuFeatureFlags implements CpuFeatureFlags interface +type cpuFeatureFlags struct { + flags uint64 + extraFlags uint64 +} + +// cpuid exposes the CPUID instruction to the Go layer (https://www.amd.com/system/files/TechDocs/25481.pdf) +// implemented in impl_amd64.s +func cpuid(arg1, arg2 uint32) (eax, ebx, ecx, edx uint32) + +// cpuidAsBitmap combines the result of invoking cpuid to uint64 bitmap +func cpuidAsBitmap(arg1, arg2 uint32) uint64 { + _ /* eax */, _ /* ebx */, ecx, edx := cpuid(arg1, arg2) + return (uint64(edx) << 32) | uint64(ecx) +} + +// loadStandardRange load flags from the standard range, panics otherwise +func loadStandardRange(id uint32) uint64 { + // ensure that the id is in the valid range, returned by cpuid(0,0) + maxRange, _, _, _ := cpuid(0, 0) + if id > maxRange { + panic("cannot query standard CPU flags") + } + return cpuidAsBitmap(id, 0) +} + +// loadStandardRange load flags from the extended range, panics otherwise +func loadExtendedRange(id uint32) uint64 { + // ensure that the id is in the valid range, returned by cpuid(0x80000000,0) + maxRange, _, _, _ := cpuid(0x80000000, 0) + if id > maxRange { + panic("cannot query extended CPU flags") + } + return cpuidAsBitmap(id, 0) +} + +func loadCpuFeatureFlags() CpuFeatureFlags { + return &cpuFeatureFlags{ + flags: loadStandardRange(1), + extraFlags: loadExtendedRange(0x80000001), + } +} + +// Has implements the same method on the CpuFeatureFlags interface +func (f *cpuFeatureFlags) Has(cpuFeature uint64) bool { + return (f.flags & cpuFeature) != 0 +} + +// HasExtra implements the same method on the CpuFeatureFlags interface +func (f *cpuFeatureFlags) HasExtra(cpuFeature uint64) bool { + return (f.extraFlags & cpuFeature) != 0 +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/platform/cpuid_amd64.s b/vendor/github.com/tetratelabs/wazero/internal/platform/cpuid_amd64.s new file mode 100644 index 000000000..8d483f3a6 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/platform/cpuid_amd64.s @@ -0,0 +1,14 @@ +#include "textflag.h" + +// lifted from github.com/intel-go/cpuid and src/internal/cpu/cpu_x86.s +// func cpuid(arg1, arg2 uint32) (eax, ebx, ecx, edx uint32) +TEXT Ā·cpuid(SB), NOSPLIT, $0-24 + MOVL arg1+0(FP), AX + MOVL arg2+4(FP), CX + CPUID + MOVL AX, eax+8(FP) + MOVL BX, ebx+12(FP) + MOVL CX, ecx+16(FP) + MOVL DX, edx+20(FP) + RET + diff --git a/vendor/github.com/tetratelabs/wazero/internal/platform/crypto.go b/vendor/github.com/tetratelabs/wazero/internal/platform/crypto.go new file mode 100644 index 000000000..c141f00f0 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/platform/crypto.go @@ -0,0 +1,17 @@ +package platform + +import ( + "io" + "math/rand" +) + +// seed is a fixed seed value for NewFakeRandSource. +// +// Trivia: While arbitrary, 42 was chosen as it is the "Ultimate Answer" in +// the Douglas Adams novel "The Hitchhiker's Guide to the Galaxy." +const seed = int64(42) + +// NewFakeRandSource returns a deterministic source of random values. +func NewFakeRandSource() io.Reader { + return rand.New(rand.NewSource(seed)) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/platform/mmap_linux.go b/vendor/github.com/tetratelabs/wazero/internal/platform/mmap_linux.go new file mode 100644 index 000000000..55906e827 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/platform/mmap_linux.go @@ -0,0 +1,76 @@ +package platform + +import ( + "math/bits" + "os" + "sort" + "strconv" + "strings" + "syscall" +) + +const ( + // https://man7.org/linux/man-pages/man2/mmap.2.html + __MAP_HUGE_SHIFT = 26 + __MAP_HUGETLB = 0x40000 +) + +var hugePagesConfigs []hugePagesConfig + +type hugePagesConfig struct { + size int + flag int +} + +func (hpc *hugePagesConfig) match(size int) bool { + return (size & (hpc.size - 1)) == 0 +} + +func init() { + dirents, err := os.ReadDir("/sys/kernel/mm/hugepages/") + if err != nil { + return + } + + for _, dirent := range dirents { + name := dirent.Name() + if !strings.HasPrefix(name, "hugepages-") { + continue + } + if !strings.HasSuffix(name, "kB") { + continue + } + n, err := strconv.ParseUint(name[10:len(name)-2], 10, 64) + if err != nil { + continue + } + if bits.OnesCount64(n) != 1 { + continue + } + n *= 1024 + hugePagesConfigs = append(hugePagesConfigs, hugePagesConfig{ + size: int(n), + flag: int(bits.TrailingZeros64(n)<<__MAP_HUGE_SHIFT) | __MAP_HUGETLB, + }) + } + + sort.Slice(hugePagesConfigs, func(i, j int) bool { + return hugePagesConfigs[i].size > hugePagesConfigs[j].size + }) +} + +func mmapCodeSegment(size, prot int) ([]byte, error) { + flags := syscall.MAP_ANON | syscall.MAP_PRIVATE + + for _, hugePagesConfig := range hugePagesConfigs { + if hugePagesConfig.match(size) { + b, err := syscall.Mmap(-1, 0, size, prot, flags|hugePagesConfig.flag) + if err != nil { + continue + } + return b, nil + } + } + + return syscall.Mmap(-1, 0, size, prot, flags) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/platform/mmap_other.go b/vendor/github.com/tetratelabs/wazero/internal/platform/mmap_other.go new file mode 100644 index 000000000..ed5c40a4d --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/platform/mmap_other.go @@ -0,0 +1,18 @@ +// Separated from linux which has support for huge pages. +//go:build darwin || freebsd + +package platform + +import "syscall" + +func mmapCodeSegment(size, prot int) ([]byte, error) { + return syscall.Mmap( + -1, + 0, + size, + prot, + // Anonymous as this is not an actual file, but a memory, + // Private as this is in-process memory region. + syscall.MAP_ANON|syscall.MAP_PRIVATE, + ) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/platform/mmap_unix.go b/vendor/github.com/tetratelabs/wazero/internal/platform/mmap_unix.go new file mode 100644 index 000000000..03b6cc601 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/platform/mmap_unix.go @@ -0,0 +1,47 @@ +//go:build darwin || linux || freebsd + +package platform + +import ( + "syscall" + "unsafe" +) + +const ( + mmapProtAMD64 = syscall.PROT_READ | syscall.PROT_WRITE | syscall.PROT_EXEC + mmapProtARM64 = syscall.PROT_READ | syscall.PROT_WRITE +) + +func munmapCodeSegment(code []byte) error { + return syscall.Munmap(code) +} + +// mmapCodeSegmentAMD64 gives all read-write-exec permission to the mmap region +// to enter the function. Otherwise, segmentation fault exception is raised. +func mmapCodeSegmentAMD64(size int) ([]byte, error) { + // The region must be RWX: RW for writing native codes, X for executing the region. + return mmapCodeSegment(size, mmapProtAMD64) +} + +// mmapCodeSegmentARM64 cannot give all read-write-exec permission to the mmap region. +// Otherwise, the mmap systemcall would raise an error. Here we give read-write +// to the region so that we can write contents at call-sites. Callers are responsible to +// execute MprotectRX on the returned buffer. +func mmapCodeSegmentARM64(size int) ([]byte, error) { + // The region must be RW: RW for writing native codes. + return mmapCodeSegment(size, mmapProtARM64) +} + +// MprotectRX is like syscall.Mprotect with RX permission, defined locally so that freebsd compiles. +func MprotectRX(b []byte) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } + const prot = syscall.PROT_READ | syscall.PROT_EXEC + _, _, e1 := syscall.Syscall(syscall.SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) + if e1 != 0 { + err = syscall.Errno(e1) + } + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/platform/mmap_unsupported.go b/vendor/github.com/tetratelabs/wazero/internal/platform/mmap_unsupported.go new file mode 100644 index 000000000..b9de9a1f7 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/platform/mmap_unsupported.go @@ -0,0 +1,26 @@ +//go:build !(darwin || linux || freebsd || windows) + +package platform + +import ( + "fmt" + "runtime" +) + +var errUnsupported = fmt.Errorf("mmap unsupported on GOOS=%s. Use interpreter instead.", runtime.GOOS) + +func munmapCodeSegment(code []byte) error { + panic(errUnsupported) +} + +func mmapCodeSegmentAMD64(size int) ([]byte, error) { + panic(errUnsupported) +} + +func mmapCodeSegmentARM64(size int) ([]byte, error) { + panic(errUnsupported) +} + +func MprotectRX(b []byte) (err error) { + panic(errUnsupported) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/platform/mmap_windows.go b/vendor/github.com/tetratelabs/wazero/internal/platform/mmap_windows.go new file mode 100644 index 000000000..fb8944b42 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/platform/mmap_windows.go @@ -0,0 +1,106 @@ +package platform + +import ( + "fmt" + "reflect" + "syscall" + "unsafe" +) + +var ( + kernel32 = syscall.NewLazyDLL("kernel32.dll") + procVirtualAlloc = kernel32.NewProc("VirtualAlloc") + procVirtualProtect = kernel32.NewProc("VirtualProtect") + procVirtualFree = kernel32.NewProc("VirtualFree") +) + +const ( + windows_MEM_COMMIT uintptr = 0x00001000 + windows_MEM_RELEASE uintptr = 0x00008000 + windows_PAGE_READWRITE uintptr = 0x00000004 + windows_PAGE_EXECUTE_READ uintptr = 0x00000020 + windows_PAGE_EXECUTE_READWRITE uintptr = 0x00000040 +) + +func munmapCodeSegment(code []byte) error { + return freeMemory(code) +} + +// allocateMemory commits the memory region via the "VirtualAlloc" function. +// See https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualalloc +func allocateMemory(size uintptr, protect uintptr) (uintptr, error) { + address := uintptr(0) // system determines where to allocate the region. + alloctype := windows_MEM_COMMIT + if r, _, err := procVirtualAlloc.Call(address, size, alloctype, protect); r == 0 { + return 0, fmt.Errorf("compiler: VirtualAlloc error: %w", ensureErr(err)) + } else { + return r, nil + } +} + +// freeMemory releases the memory region via the "VirtualFree" function. +// See https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualfree +func freeMemory(code []byte) error { + address := unsafe.Pointer(&code[0]) + size := uintptr(0) // size must be 0 because we're using MEM_RELEASE. + freetype := windows_MEM_RELEASE + if r, _, err := procVirtualFree.Call(uintptr(address), size, freetype); r == 0 { + return fmt.Errorf("compiler: VirtualFree error: %w", ensureErr(err)) + } + return nil +} + +func virtualProtect(address, size, newprotect uintptr, oldprotect *uint32) error { + if r, _, err := procVirtualProtect.Call(address, size, newprotect, uintptr(unsafe.Pointer(oldprotect))); r == 0 { + return fmt.Errorf("compiler: VirtualProtect error: %w", ensureErr(err)) + } + return nil +} + +func mmapCodeSegmentAMD64(size int) ([]byte, error) { + p, err := allocateMemory(uintptr(size), windows_PAGE_EXECUTE_READWRITE) + if err != nil { + return nil, err + } + + var mem []byte + sh := (*reflect.SliceHeader)(unsafe.Pointer(&mem)) + sh.Data = p + sh.Len = size + sh.Cap = size + return mem, err +} + +func mmapCodeSegmentARM64(size int) ([]byte, error) { + p, err := allocateMemory(uintptr(size), windows_PAGE_READWRITE) + if err != nil { + return nil, err + } + + var mem []byte + sh := (*reflect.SliceHeader)(unsafe.Pointer(&mem)) + sh.Data = p + sh.Len = size + sh.Cap = size + return mem, nil +} + +var old = uint32(windows_PAGE_READWRITE) + +func MprotectRX(b []byte) (err error) { + err = virtualProtect(uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), windows_PAGE_EXECUTE_READ, &old) + return +} + +// ensureErr returns syscall.EINVAL when the input error is nil. +// +// We are supposed to use "GetLastError" which is more precise, but it is not safe to execute in goroutines. While +// "GetLastError" is thread-local, goroutines are not pinned to threads. +// +// See https://docs.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror +func ensureErr(err error) error { + if err != nil { + return err + } + return syscall.EINVAL +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/platform/mremap_other.go b/vendor/github.com/tetratelabs/wazero/internal/platform/mremap_other.go new file mode 100644 index 000000000..5be501c19 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/platform/mremap_other.go @@ -0,0 +1,23 @@ +//go:build !(darwin || linux || freebsd) + +package platform + +func remapCodeSegmentAMD64(code []byte, size int) ([]byte, error) { + b, err := mmapCodeSegmentAMD64(size) + if err != nil { + return nil, err + } + copy(b, code) + mustMunmapCodeSegment(code) + return b, nil +} + +func remapCodeSegmentARM64(code []byte, size int) ([]byte, error) { + b, err := mmapCodeSegmentARM64(size) + if err != nil { + return nil, err + } + copy(b, code) + mustMunmapCodeSegment(code) + return b, nil +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/platform/mremap_unix.go b/vendor/github.com/tetratelabs/wazero/internal/platform/mremap_unix.go new file mode 100644 index 000000000..5017aaf7a --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/platform/mremap_unix.go @@ -0,0 +1,21 @@ +//go:build darwin || linux || freebsd + +package platform + +func remapCodeSegmentAMD64(code []byte, size int) ([]byte, error) { + return remapCodeSegment(code, size, mmapProtAMD64) +} + +func remapCodeSegmentARM64(code []byte, size int) ([]byte, error) { + return remapCodeSegment(code, size, mmapProtARM64) +} + +func remapCodeSegment(code []byte, size, prot int) ([]byte, error) { + b, err := mmapCodeSegment(size, prot) + if err != nil { + return nil, err + } + copy(b, code) + mustMunmapCodeSegment(code) + return b, nil +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/platform/path.go b/vendor/github.com/tetratelabs/wazero/internal/platform/path.go new file mode 100644 index 000000000..361049ae2 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/platform/path.go @@ -0,0 +1,6 @@ +//go:build !windows + +package platform + +// ToPosixPath returns the input, as only windows might return backslashes. +func ToPosixPath(in string) string { return in } diff --git a/vendor/github.com/tetratelabs/wazero/internal/platform/path_windows.go b/vendor/github.com/tetratelabs/wazero/internal/platform/path_windows.go new file mode 100644 index 000000000..77c4187d9 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/platform/path_windows.go @@ -0,0 +1,17 @@ +package platform + +import "strings" + +// ToPosixPath returns the input, converting any backslashes to forward ones. +func ToPosixPath(in string) string { + // strings.Map only allocates on change, which is good enough especially as + // path.Join uses forward slash even on windows. + return strings.Map(windowsToPosixSeparator, in) +} + +func windowsToPosixSeparator(r rune) rune { + if r == '\\' { + return '/' + } + return r +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/platform/platform.go b/vendor/github.com/tetratelabs/wazero/internal/platform/platform.go new file mode 100644 index 000000000..508b89f22 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/platform/platform.go @@ -0,0 +1,90 @@ +// Package platform includes runtime-specific code needed for the compiler or otherwise. +// +// Note: This is a dependency-free alternative to depending on parts of Go's x/sys. +// See /RATIONALE.md for more context. +package platform + +import ( + "regexp" + "runtime" +) + +// IsAtLeastGo120 checks features added in 1.20. We can remove this when Go +// 1.22 is out. +var IsAtLeastGo120 = isAtLeastGo120(runtime.Version()) + +func isAtLeastGo120(version string) bool { + return regexp.MustCompile("go1.[2-9][0-9][^0-9]").MatchString(version) +} + +// archRequirementsVerified is set by platform-specific init to true if the platform is supported +var archRequirementsVerified bool + +// CompilerSupported is exported for tests and includes constraints here and also the assembler. +func CompilerSupported() bool { + switch runtime.GOOS { + case "darwin", "windows", "linux", "freebsd": + default: + return false + } + + return archRequirementsVerified +} + +// MmapCodeSegment copies the code into the executable region and returns the byte slice of the region. +// +// See https://man7.org/linux/man-pages/man2/mmap.2.html for mmap API and flags. +func MmapCodeSegment(size int) ([]byte, error) { + if size == 0 { + panic("BUG: MmapCodeSegment with zero length") + } + if runtime.GOARCH == "amd64" { + return mmapCodeSegmentAMD64(size) + } else { + return mmapCodeSegmentARM64(size) + } +} + +// RemapCodeSegment reallocates the memory mapping of an existing code segment +// to increase its size. The previous code mapping is unmapped and must not be +// reused after the function returns. +// +// This is similar to mremap(2) on linux, and emulated on platforms which do not +// have this syscall. +// +// See https://man7.org/linux/man-pages/man2/mremap.2.html +func RemapCodeSegment(code []byte, size int) ([]byte, error) { + if size < len(code) { + panic("BUG: RemapCodeSegment with size less than code") + } + if code == nil { + return MmapCodeSegment(size) + } + if runtime.GOARCH == "amd64" { + return remapCodeSegmentAMD64(code, size) + } else { + return remapCodeSegmentARM64(code, size) + } +} + +// MunmapCodeSegment unmaps the given memory region. +func MunmapCodeSegment(code []byte) error { + if len(code) == 0 { + panic("BUG: MunmapCodeSegment with zero length") + } + return munmapCodeSegment(code) +} + +// mustMunmapCodeSegment panics instead of returning an error to the +// application. +// +// # Why panic? +// +// It is less disruptive to the application to leak the previous block if it +// could be unmapped than to leak the new block and return an error. +// Realistically, either scenarios are pretty hard to debug, so we panic. +func mustMunmapCodeSegment(code []byte) { + if err := munmapCodeSegment(code); err != nil { + panic(err) + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/platform/platform_amd64.go b/vendor/github.com/tetratelabs/wazero/internal/platform/platform_amd64.go new file mode 100644 index 000000000..4437e98f9 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/platform/platform_amd64.go @@ -0,0 +1,7 @@ +package platform + +// init verifies that the current CPU supports the required AMD64 instructions +func init() { + // Ensure SSE4.1 is supported. + archRequirementsVerified = CpuFeatures.Has(CpuFeatureSSE4_1) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/platform/platform_arm64.go b/vendor/github.com/tetratelabs/wazero/internal/platform/platform_arm64.go new file mode 100644 index 000000000..caac58a3d --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/platform/platform_arm64.go @@ -0,0 +1,7 @@ +package platform + +// init verifies that the current CPU supports the required ARM64 features +func init() { + // No further checks currently needed. + archRequirementsVerified = true +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/platform/time.go b/vendor/github.com/tetratelabs/wazero/internal/platform/time.go new file mode 100644 index 000000000..fa9da1acb --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/platform/time.go @@ -0,0 +1,76 @@ +package platform + +import ( + "sync/atomic" + "time" + + "github.com/tetratelabs/wazero/sys" +) + +const ( + ms = int64(time.Millisecond) + // FakeEpochNanos is midnight UTC 2022-01-01 and exposed for testing + FakeEpochNanos = 1640995200000 * ms +) + +// NewFakeWalltime implements sys.Walltime with FakeEpochNanos that increases by 1ms each reading. +// See /RATIONALE.md +func NewFakeWalltime() sys.Walltime { + // AddInt64 returns the new value. Adjust so the first reading will be FakeEpochNanos + t := FakeEpochNanos - ms + return func() (sec int64, nsec int32) { + wt := atomic.AddInt64(&t, ms) + return wt / 1e9, int32(wt % 1e9) + } +} + +// NewFakeNanotime implements sys.Nanotime that increases by 1ms each reading. +// See /RATIONALE.md +func NewFakeNanotime() sys.Nanotime { + // AddInt64 returns the new value. Adjust so the first reading will be zero. + t := int64(0) - ms + return func() int64 { + return atomic.AddInt64(&t, ms) + } +} + +// FakeNanosleep implements sys.Nanosleep by returning without sleeping. +var FakeNanosleep = sys.Nanosleep(func(int64) {}) + +// FakeOsyield implements sys.Osyield by returning without yielding. +var FakeOsyield = sys.Osyield(func() {}) + +// Walltime implements sys.Walltime with time.Now. +// +// Note: This is only notably less efficient than it could be is reading +// runtime.walltime(). time.Now defensively reads nanotime also, just in case +// time.Since is used. This doubles the performance impact. However, wall time +// is likely to be read less frequently than Nanotime. Also, doubling the cost +// matters less on fast platforms that can return both in <=100ns. +func Walltime() (sec int64, nsec int32) { + t := time.Now() + return t.Unix(), int32(t.Nanosecond()) +} + +// nanoBase uses time.Now to ensure a monotonic clock reading on all platforms +// via time.Since. +var nanoBase = time.Now() + +// nanotimePortable implements sys.Nanotime with time.Since. +// +// Note: This is less efficient than it could be is reading runtime.nanotime(), +// Just to do that requires CGO. +func nanotimePortable() int64 { + return time.Since(nanoBase).Nanoseconds() +} + +// Nanotime implements sys.Nanotime with runtime.nanotime() if CGO is available +// and time.Since if not. +func Nanotime() int64 { + return nanotime() +} + +// Nanosleep implements sys.Nanosleep with time.Sleep. +func Nanosleep(ns int64) { + time.Sleep(time.Duration(ns)) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/platform/time_cgo.go b/vendor/github.com/tetratelabs/wazero/internal/platform/time_cgo.go new file mode 100644 index 000000000..ff01d90ce --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/platform/time_cgo.go @@ -0,0 +1,11 @@ +//go:build cgo && !windows + +package platform + +import _ "unsafe" // for go:linkname + +// nanotime uses runtime.nanotime as it is available on all platforms and +// benchmarks faster than using time.Since. +// +//go:linkname nanotime runtime.nanotime +func nanotime() int64 diff --git a/vendor/github.com/tetratelabs/wazero/internal/platform/time_notcgo.go b/vendor/github.com/tetratelabs/wazero/internal/platform/time_notcgo.go new file mode 100644 index 000000000..0697b7c70 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/platform/time_notcgo.go @@ -0,0 +1,7 @@ +//go:build !cgo && !windows + +package platform + +func nanotime() int64 { + return nanotimePortable() +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/platform/time_windows.go b/vendor/github.com/tetratelabs/wazero/internal/platform/time_windows.go new file mode 100644 index 000000000..58731fc8e --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/platform/time_windows.go @@ -0,0 +1,40 @@ +//go:build windows + +package platform + +import ( + "math/bits" + "time" + "unsafe" +) + +var ( + _QueryPerformanceCounter = kernel32.NewProc("QueryPerformanceCounter") + _QueryPerformanceFrequency = kernel32.NewProc("QueryPerformanceFrequency") +) + +var qpcfreq uint64 + +func init() { + _, _, _ = _QueryPerformanceFrequency.Call(uintptr(unsafe.Pointer(&qpcfreq))) +} + +// On Windows, time.Time handled in time package cannot have the nanosecond precision. +// The reason is that by default, it doesn't use QueryPerformanceCounter[1], but instead, use "interrupt time" +// which doesn't support nanoseconds precision (though it is a monotonic) [2, 3, 4, 5]. +// +// [1] https://learn.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter +// [2] https://github.com/golang/go/blob/0cd309e12818f988693bf8e4d9f1453331dcf9f2/src/runtime/sys_windows_amd64.s#L297-L298 +// [3] https://github.com/golang/go/blob/0cd309e12818f988693bf8e4d9f1453331dcf9f2/src/runtime/os_windows.go#L549-L551 +// [4] https://github.com/golang/go/blob/master/src/runtime/time_windows.h#L7-L13 +// [5] http://web.archive.org/web/20210411000829/https://wrkhpi.wordpress.com/2007/08/09/getting-os-information-the-kuser_shared_data-structure/ +// +// Therefore, on Windows, we directly invoke the syscall for QPC instead of time.Now or runtime.nanotime. +// See https://github.com/golang/go/issues/31160 for example. +func nanotime() int64 { + var counter uint64 + _, _, _ = _QueryPerformanceCounter.Call(uintptr(unsafe.Pointer(&counter))) + hi, lo := bits.Mul64(counter, uint64(time.Second)) + nanos, _ := bits.Div64(hi, lo, qpcfreq) + return int64(nanos) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sock/sock.go b/vendor/github.com/tetratelabs/wazero/internal/sock/sock.go new file mode 100644 index 000000000..ca17aa39e --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sock/sock.go @@ -0,0 +1,89 @@ +package sock + +import ( + "fmt" + "net" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +// TCPSock is a pseudo-file representing a TCP socket. +type TCPSock interface { + sys.File + + Accept() (TCPConn, sys.Errno) +} + +// TCPConn is a pseudo-file representing a TCP connection. +type TCPConn interface { + sys.File + + // Recvfrom only supports the flag sysfs.MSG_PEEK + // TODO: document this like sys.File with known sys.Errno + Recvfrom(p []byte, flags int) (n int, errno sys.Errno) + + // TODO: document this like sys.File with known sys.Errno + Shutdown(how int) sys.Errno +} + +// ConfigKey is a context.Context Value key. Its associated value should be a Config. +type ConfigKey struct{} + +// Config is an internal struct meant to implement +// the interface in experimental/sock/Config. +type Config struct { + // TCPAddresses is a slice of the configured host:port pairs. + TCPAddresses []TCPAddress +} + +// TCPAddress is a host:port pair to pre-open. +type TCPAddress struct { + // Host is the host name for this listener. + Host string + // Port is the port number for this listener. + Port int +} + +// WithTCPListener implements the method of the same name in experimental/sock/Config. +// +// However, to avoid cyclic dependencies, this is returning the *Config in this scope. +// The interface is implemented in experimental/sock/Config via delegation. +func (c *Config) WithTCPListener(host string, port int) *Config { + ret := c.clone() + ret.TCPAddresses = append(ret.TCPAddresses, TCPAddress{host, port}) + return &ret +} + +// Makes a deep copy of this sockConfig. +func (c *Config) clone() Config { + ret := *c + ret.TCPAddresses = make([]TCPAddress, 0, len(c.TCPAddresses)) + ret.TCPAddresses = append(ret.TCPAddresses, c.TCPAddresses...) + return ret +} + +// BuildTCPListeners build listeners from the current configuration. +func (c *Config) BuildTCPListeners() (tcpListeners []*net.TCPListener, err error) { + for _, tcpAddr := range c.TCPAddresses { + var ln net.Listener + ln, err = net.Listen("tcp", tcpAddr.String()) + if err != nil { + break + } + if tcpln, ok := ln.(*net.TCPListener); ok { + tcpListeners = append(tcpListeners, tcpln) + } + } + if err != nil { + // An error occurred, cleanup. + for _, l := range tcpListeners { + _ = l.Close() // Ignore errors, we are already cleaning. + } + tcpListeners = nil + } + return +} + +func (t TCPAddress) String() string { + return fmt.Sprintf("%s:%d", t.Host, t.Port) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sock/sock_supported.go b/vendor/github.com/tetratelabs/wazero/internal/sock/sock_supported.go new file mode 100644 index 000000000..30cdb9f92 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sock/sock_supported.go @@ -0,0 +1,11 @@ +//go:build !plan9 && !js + +package sock + +import "syscall" + +const ( + SHUT_RD = syscall.SHUT_RD + SHUT_RDWR = syscall.SHUT_RDWR + SHUT_WR = syscall.SHUT_WR +) diff --git a/vendor/github.com/tetratelabs/wazero/internal/sock/sock_unsupported.go b/vendor/github.com/tetratelabs/wazero/internal/sock/sock_unsupported.go new file mode 100644 index 000000000..76ec031ef --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sock/sock_unsupported.go @@ -0,0 +1,10 @@ +//go:build plan9 || js + +package sock + +// plan9/js doesn't declare these constants +const ( + SHUT_RD = 1 << iota + SHUT_WR + SHUT_RDWR = SHUT_RD | SHUT_WR +) diff --git a/vendor/github.com/tetratelabs/wazero/internal/sys/fs.go b/vendor/github.com/tetratelabs/wazero/internal/sys/fs.go new file mode 100644 index 000000000..332a95262 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sys/fs.go @@ -0,0 +1,474 @@ +package sys + +import ( + "io" + "io/fs" + "net" + + "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/descriptor" + "github.com/tetratelabs/wazero/internal/fsapi" + socketapi "github.com/tetratelabs/wazero/internal/sock" + "github.com/tetratelabs/wazero/internal/sysfs" +) + +const ( + FdStdin int32 = iota + FdStdout + FdStderr + // FdPreopen is the file descriptor of the first pre-opened directory. + // + // # Why file descriptor 3? + // + // While not specified, the most common WASI implementation, wasi-libc, + // expects POSIX style file descriptor allocation, where the lowest + // available number is used to open the next file. Since 1 and 2 are taken + // by stdout and stderr, the next is 3. + // - https://github.com/WebAssembly/WASI/issues/122 + // - https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_14 + // - https://github.com/WebAssembly/wasi-libc/blob/wasi-sdk-16/libc-bottom-half/sources/preopens.c#L215 + FdPreopen +) + +const modeDevice = fs.ModeDevice | 0o640 + +// FileEntry maps a path to an open file in a file system. +type FileEntry struct { + // Name is the name of the directory up to its pre-open, or the pre-open + // name itself when IsPreopen. + // + // # Notes + // + // - This can drift on rename. + // - This relates to the guest path, which is not the real file path + // except if the entire host filesystem was made available. + Name string + + // IsPreopen is a directory that is lazily opened. + IsPreopen bool + + // FS is the filesystem associated with the pre-open. + FS sys.FS + + // File is always non-nil. + File fsapi.File + + // direntCache is nil until DirentCache was called. + direntCache *DirentCache +} + +// DirentCache gets or creates a DirentCache for this file or returns an error. +// +// # Errors +// +// A zero sys.Errno is success. The below are expected otherwise: +// - sys.ENOSYS: the implementation does not support this function. +// - sys.EBADF: the dir was closed or not readable. +// - sys.ENOTDIR: the file was not a directory. +// +// # Notes +// +// - See /RATIONALE.md for design notes. +func (f *FileEntry) DirentCache() (*DirentCache, sys.Errno) { + if dir := f.direntCache; dir != nil { + return dir, 0 + } + + // Require the file to be a directory vs a late error on the same. + if isDir, errno := f.File.IsDir(); errno != 0 { + return nil, errno + } else if !isDir { + return nil, sys.ENOTDIR + } + + // Generate the dotEntries only once. + if dotEntries, errno := synthesizeDotEntries(f); errno != 0 { + return nil, errno + } else { + f.direntCache = &DirentCache{f: f.File, dotEntries: dotEntries} + } + + return f.direntCache, 0 +} + +// DirentCache is a caching abstraction of sys.File Readdir. +// +// This is special-cased for "wasi_snapshot_preview1.fd_readdir", and may be +// unneeded, or require changes, to support preview1 or preview2. +// - The position of the dirents are serialized as `d_next`. For reasons +// described below, any may need to be re-read. This accepts any positions +// in the cache, rather than track the position of the last dirent. +// - dot entries ("." and "..") must be returned. See /RATIONALE.md for why. +// - An sys.Dirent Name is variable length, it could exceed memory size and +// need to be re-read. +// - Multiple dirents may be returned. It is more efficient to read from the +// underlying file in bulk vs one-at-a-time. +// +// The last results returned by Read are cached, but entries before that +// position are not. This support re-reading entries that couldn't fit into +// memory without accidentally caching all entries in a large directory. This +// approach is sometimes called a sliding window. +type DirentCache struct { + // f is the underlying file + f sys.File + + // dotEntries are the "." and ".." entries added when the directory is + // initialized. + dotEntries []sys.Dirent + + // dirents are the potentially unread directory entries. + // + // Internal detail: nil is different from zero length. Zero length is an + // exhausted directory (eof). nil means the re-read. + dirents []sys.Dirent + + // countRead is the total count of dirents read since last rewind. + countRead uint64 + + // eof is true when the underlying file is at EOF. This avoids re-reading + // the directory when it is exhausted. Entires in an exhausted directory + // are not visible until it is rewound via calling Read with `pos==0`. + eof bool +} + +// synthesizeDotEntries generates a slice of the two elements "." and "..". +func synthesizeDotEntries(f *FileEntry) ([]sys.Dirent, sys.Errno) { + dotIno, errno := f.File.Ino() + if errno != 0 { + return nil, errno + } + result := [2]sys.Dirent{} + result[0] = sys.Dirent{Name: ".", Ino: dotIno, Type: fs.ModeDir} + // See /RATIONALE.md for why we don't attempt to get an inode for ".." and + // why in wasi-libc this won't fan-out either. + result[1] = sys.Dirent{Name: "..", Ino: 0, Type: fs.ModeDir} + return result[:], 0 +} + +// exhaustedDirents avoids allocating empty slices. +var exhaustedDirents = [0]sys.Dirent{} + +// Read is similar to and returns the same errors as `Readdir` on sys.File. +// The main difference is this caches entries returned, resulting in multiple +// valid positions to read from. +// +// When zero, `pos` means rewind to the beginning of this directory. This +// implies a rewind (Seek to zero on the underlying sys.File), unless the +// initial entries are still cached. +// +// When non-zero, `pos` is the zero based index of all dirents returned since +// last rewind. Only entries beginning at `pos` are cached for subsequent +// calls. A non-zero `pos` before the cache returns sys.ENOENT for reasons +// described on DirentCache documentation. +// +// Up to `n` entries are cached and returned. When `n` exceeds the cache, the +// difference are read from the underlying sys.File via `Readdir`. EOF is +// when `len(dirents)` returned are less than `n`. +func (d *DirentCache) Read(pos uint64, n uint32) (dirents []sys.Dirent, errno sys.Errno) { + switch { + case pos > d.countRead: // farther than read or negative coerced to uint64. + return nil, sys.ENOENT + case pos == 0 && d.dirents != nil: + // Rewind if we have already read entries. This allows us to see new + // entries added after the directory was opened. + if _, errno = d.f.Seek(0, io.SeekStart); errno != 0 { + return + } + d.dirents = nil // dump cache + d.countRead = 0 + } + + if n == 0 { + return // special case no entries. + } + + if d.dirents == nil { + // Always populate dot entries, which makes min len(dirents) == 2. + d.dirents = d.dotEntries + d.countRead = 2 + d.eof = false + + if countToRead := int(n - 2); countToRead <= 0 { + return + } else if dirents, errno = d.f.Readdir(countToRead); errno != 0 { + return + } else if countRead := len(dirents); countRead > 0 { + d.eof = countRead < countToRead + d.dirents = append(d.dotEntries, dirents...) + d.countRead += uint64(countRead) + } + + return d.cachedDirents(n), 0 + } + + // Reset our cache to the first entry being read. + cacheStart := d.countRead - uint64(len(d.dirents)) + if pos < cacheStart { + // We don't currently allow reads before our cache because Seek(0) is + // the only portable way. Doing otherwise requires skipping, which we + // won't do unless wasi-testsuite starts requiring it. Implementing + // this would allow re-reading a large directory, so care would be + // needed to not buffer the entire directory in memory while skipping. + errno = sys.ENOENT + return + } else if posInCache := pos - cacheStart; posInCache != 0 { + if uint64(len(d.dirents)) == posInCache { + // Avoid allocation re-slicing to zero length. + d.dirents = exhaustedDirents[:] + } else { + d.dirents = d.dirents[posInCache:] + } + } + + // See if we need more entries. + if countToRead := int(n) - len(d.dirents); countToRead > 0 && !d.eof { + // Try to read more, which could fail. + if dirents, errno = d.f.Readdir(countToRead); errno != 0 { + return + } + + // Append the next read entries if we weren't at EOF. + if countRead := len(dirents); countRead > 0 { + d.eof = countRead < countToRead + d.dirents = append(d.dirents, dirents...) + d.countRead += uint64(countRead) + } + } + + return d.cachedDirents(n), 0 +} + +// cachedDirents returns up to `n` dirents from the cache. +func (d *DirentCache) cachedDirents(n uint32) []sys.Dirent { + direntCount := uint32(len(d.dirents)) + switch { + case direntCount == 0: + return nil + case direntCount > n: + return d.dirents[:n] + } + return d.dirents +} + +type FSContext struct { + // rootFS is the root ("/") mount. + rootFS sys.FS + + // openedFiles is a map of file descriptor numbers (>=FdPreopen) to open files + // (or directories) and defaults to empty. + // TODO: This is unguarded, so not goroutine-safe! + openedFiles FileTable +} + +// FileTable is a specialization of the descriptor.Table type used to map file +// descriptors to file entries. +type FileTable = descriptor.Table[int32, *FileEntry] + +// RootFS returns a possibly unimplemented root filesystem. Any files that +// should be added to the table should be inserted via InsertFile. +// +// TODO: This is only used by GOOS=js and tests: Remove when we remove GOOS=js +// (after Go 1.22 is released). +func (c *FSContext) RootFS() sys.FS { + if rootFS := c.rootFS; rootFS == nil { + return sys.UnimplementedFS{} + } else { + return rootFS + } +} + +// LookupFile returns a file if it is in the table. +func (c *FSContext) LookupFile(fd int32) (*FileEntry, bool) { + return c.openedFiles.Lookup(fd) +} + +// OpenFile opens the file into the table and returns its file descriptor. +// The result must be closed by CloseFile or Close. +func (c *FSContext) OpenFile(fs sys.FS, path string, flag sys.Oflag, perm fs.FileMode) (int32, sys.Errno) { + if f, errno := fs.OpenFile(path, flag, perm); errno != 0 { + return 0, errno + } else { + fe := &FileEntry{FS: fs, File: fsapi.Adapt(f)} + if path == "/" || path == "." { + fe.Name = "" + } else { + fe.Name = path + } + if newFD, ok := c.openedFiles.Insert(fe); !ok { + return 0, sys.EBADF + } else { + return newFD, 0 + } + } +} + +// Renumber assigns the file pointed by the descriptor `from` to `to`. +func (c *FSContext) Renumber(from, to int32) sys.Errno { + fromFile, ok := c.openedFiles.Lookup(from) + if !ok || to < 0 { + return sys.EBADF + } else if fromFile.IsPreopen { + return sys.ENOTSUP + } + + // If toFile is already open, we close it to prevent windows lock issues. + // + // The doc is unclear and other implementations do nothing for already-opened To FDs. + // https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-fd_renumberfd-fd-to-fd---errno + // https://github.com/bytecodealliance/wasmtime/blob/main/crates/wasi-common/src/snapshots/preview_1.rs#L531-L546 + if toFile, ok := c.openedFiles.Lookup(to); ok { + if toFile.IsPreopen { + return sys.ENOTSUP + } + _ = toFile.File.Close() + } + + c.openedFiles.Delete(from) + if !c.openedFiles.InsertAt(fromFile, to) { + return sys.EBADF + } + return 0 +} + +// SockAccept accepts a sock.TCPConn into the file table and returns its file +// descriptor. +func (c *FSContext) SockAccept(sockFD int32, nonblock bool) (int32, sys.Errno) { + var sock socketapi.TCPSock + if e, ok := c.LookupFile(sockFD); !ok || !e.IsPreopen { + return 0, sys.EBADF // Not a preopen + } else if sock, ok = e.File.(socketapi.TCPSock); !ok { + return 0, sys.EBADF // Not a sock + } + + conn, errno := sock.Accept() + if errno != 0 { + return 0, errno + } + + fe := &FileEntry{File: fsapi.Adapt(conn)} + + if nonblock { + if errno = fe.File.SetNonblock(true); errno != 0 { + _ = conn.Close() + return 0, errno + } + } + + if newFD, ok := c.openedFiles.Insert(fe); !ok { + return 0, sys.EBADF + } else { + return newFD, 0 + } +} + +// CloseFile returns any error closing the existing file. +func (c *FSContext) CloseFile(fd int32) (errno sys.Errno) { + f, ok := c.openedFiles.Lookup(fd) + if !ok { + return sys.EBADF + } + if errno = f.File.Close(); errno != 0 { + return errno + } + c.openedFiles.Delete(fd) + return errno +} + +// Close implements io.Closer +func (c *FSContext) Close() (err error) { + // Close any files opened in this context + c.openedFiles.Range(func(fd int32, entry *FileEntry) bool { + if errno := entry.File.Close(); errno != 0 { + err = errno // This means err returned == the last non-nil error. + } + return true + }) + // A closed FSContext cannot be reused so clear the state. + c.openedFiles = FileTable{} + return +} + +// InitFSContext initializes a FSContext with stdio streams and optional +// pre-opened filesystems and TCP listeners. +func (c *Context) InitFSContext( + stdin io.Reader, + stdout, stderr io.Writer, + fs []sys.FS, guestPaths []string, + tcpListeners []*net.TCPListener, +) (err error) { + inFile, err := stdinFileEntry(stdin) + if err != nil { + return err + } + c.fsc.openedFiles.Insert(inFile) + outWriter, err := stdioWriterFileEntry("stdout", stdout) + if err != nil { + return err + } + c.fsc.openedFiles.Insert(outWriter) + errWriter, err := stdioWriterFileEntry("stderr", stderr) + if err != nil { + return err + } + c.fsc.openedFiles.Insert(errWriter) + + for i, fs := range fs { + guestPath := guestPaths[i] + + if StripPrefixesAndTrailingSlash(guestPath) == "" { + // Default to bind to '/' when guestPath is effectively empty. + guestPath = "/" + c.fsc.rootFS = fs + } + c.fsc.openedFiles.Insert(&FileEntry{ + FS: fs, + Name: guestPath, + IsPreopen: true, + File: &lazyDir{fs: fs}, + }) + } + + for _, tl := range tcpListeners { + c.fsc.openedFiles.Insert(&FileEntry{IsPreopen: true, File: fsapi.Adapt(sysfs.NewTCPListenerFile(tl))}) + } + return nil +} + +// StripPrefixesAndTrailingSlash skips any leading "./" or "/" such that the +// result index begins with another string. A result of "." coerces to the +// empty string "" because the current directory is handled by the guest. +// +// Results are the offset/len pair which is an optimization to avoid re-slicing +// overhead, as this function is called for every path operation. +// +// Note: Relative paths should be handled by the guest, as that's what knows +// what the current directory is. However, paths that escape the current +// directory e.g. "../.." have been found in `tinygo test` and this +// implementation takes care to avoid it. +func StripPrefixesAndTrailingSlash(path string) string { + // strip trailing slashes + pathLen := len(path) + for ; pathLen > 0 && path[pathLen-1] == '/'; pathLen-- { + } + + pathI := 0 +loop: + for pathI < pathLen { + switch path[pathI] { + case '/': + pathI++ + case '.': + nextI := pathI + 1 + if nextI < pathLen && path[nextI] == '/' { + pathI = nextI + 1 + } else if nextI == pathLen { + pathI = nextI + } else { + break loop + } + default: + break loop + } + } + return path[pathI:pathLen] +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sys/lazy.go b/vendor/github.com/tetratelabs/wazero/internal/sys/lazy.go new file mode 100644 index 000000000..fe233d29e --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sys/lazy.go @@ -0,0 +1,151 @@ +package sys + +import ( + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/fsapi" + "github.com/tetratelabs/wazero/sys" +) + +// compile-time check to ensure lazyDir implements sys.File. +var _ experimentalsys.File = (*lazyDir)(nil) + +type lazyDir struct { + experimentalsys.DirFile + + fs experimentalsys.FS + f experimentalsys.File +} + +// Dev implements the same method as documented on sys.File +func (d *lazyDir) Dev() (uint64, experimentalsys.Errno) { + if f, ok := d.file(); !ok { + return 0, experimentalsys.EBADF + } else { + return f.Dev() + } +} + +// Ino implements the same method as documented on sys.File +func (d *lazyDir) Ino() (sys.Inode, experimentalsys.Errno) { + if f, ok := d.file(); !ok { + return 0, experimentalsys.EBADF + } else { + return f.Ino() + } +} + +// IsDir implements the same method as documented on sys.File +func (d *lazyDir) IsDir() (bool, experimentalsys.Errno) { + // Note: we don't return a constant because we don't know if this is really + // backed by a dir, until the first call. + if f, ok := d.file(); !ok { + return false, experimentalsys.EBADF + } else { + return f.IsDir() + } +} + +// IsAppend implements the same method as documented on sys.File +func (d *lazyDir) IsAppend() bool { + return false +} + +// SetAppend implements the same method as documented on sys.File +func (d *lazyDir) SetAppend(bool) experimentalsys.Errno { + return experimentalsys.EISDIR +} + +// Seek implements the same method as documented on sys.File +func (d *lazyDir) Seek(offset int64, whence int) (newOffset int64, errno experimentalsys.Errno) { + if f, ok := d.file(); !ok { + return 0, experimentalsys.EBADF + } else { + return f.Seek(offset, whence) + } +} + +// Stat implements the same method as documented on sys.File +func (d *lazyDir) Stat() (sys.Stat_t, experimentalsys.Errno) { + if f, ok := d.file(); !ok { + return sys.Stat_t{}, experimentalsys.EBADF + } else { + return f.Stat() + } +} + +// Readdir implements the same method as documented on sys.File +func (d *lazyDir) Readdir(n int) (dirents []experimentalsys.Dirent, errno experimentalsys.Errno) { + if f, ok := d.file(); !ok { + return nil, experimentalsys.EBADF + } else { + return f.Readdir(n) + } +} + +// Sync implements the same method as documented on sys.File +func (d *lazyDir) Sync() experimentalsys.Errno { + if f, ok := d.file(); !ok { + return experimentalsys.EBADF + } else { + return f.Sync() + } +} + +// Datasync implements the same method as documented on sys.File +func (d *lazyDir) Datasync() experimentalsys.Errno { + if f, ok := d.file(); !ok { + return experimentalsys.EBADF + } else { + return f.Datasync() + } +} + +// Utimens implements the same method as documented on sys.File +func (d *lazyDir) Utimens(atim, mtim int64) experimentalsys.Errno { + if f, ok := d.file(); !ok { + return experimentalsys.EBADF + } else { + return f.Utimens(atim, mtim) + } +} + +// file returns the underlying file or false if it doesn't exist. +func (d *lazyDir) file() (experimentalsys.File, bool) { + if f := d.f; d.f != nil { + return f, true + } + var errno experimentalsys.Errno + d.f, errno = d.fs.OpenFile(".", experimentalsys.O_RDONLY, 0) + switch errno { + case 0: + return d.f, true + case experimentalsys.ENOENT: + return nil, false + default: + panic(errno) // unexpected + } +} + +// Close implements fs.File +func (d *lazyDir) Close() experimentalsys.Errno { + f := d.f + if f == nil { + return 0 // never opened + } + return f.Close() +} + +// IsNonblock implements the same method as documented on fsapi.File +func (d *lazyDir) IsNonblock() bool { + return false +} + +// SetNonblock implements the same method as documented on fsapi.File +func (d *lazyDir) SetNonblock(bool) experimentalsys.Errno { + return experimentalsys.EISDIR +} + +// Poll implements the same method as documented on fsapi.File +func (d *lazyDir) Poll(fsapi.Pflag, int32) (ready bool, errno experimentalsys.Errno) { + return false, experimentalsys.ENOSYS +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sys/stdio.go b/vendor/github.com/tetratelabs/wazero/internal/sys/stdio.go new file mode 100644 index 000000000..32c33661e --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sys/stdio.go @@ -0,0 +1,128 @@ +package sys + +import ( + "io" + "os" + + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/fsapi" + "github.com/tetratelabs/wazero/internal/sysfs" + "github.com/tetratelabs/wazero/sys" +) + +// StdinFile is a fs.ModeDevice file for use implementing FdStdin. +// This is safer than reading from os.DevNull as it can never overrun +// operating system file descriptors. +type StdinFile struct { + noopStdinFile + io.Reader +} + +// Read implements the same method as documented on sys.File +func (f *StdinFile) Read(buf []byte) (int, experimentalsys.Errno) { + n, err := f.Reader.Read(buf) + return n, experimentalsys.UnwrapOSError(err) +} + +type writerFile struct { + noopStdoutFile + + w io.Writer +} + +// Write implements the same method as documented on sys.File +func (f *writerFile) Write(buf []byte) (int, experimentalsys.Errno) { + n, err := f.w.Write(buf) + return n, experimentalsys.UnwrapOSError(err) +} + +// noopStdinFile is a fs.ModeDevice file for use implementing FdStdin. This is +// safer than reading from os.DevNull as it can never overrun operating system +// file descriptors. +type noopStdinFile struct { + noopStdioFile +} + +// Read implements the same method as documented on sys.File +func (noopStdinFile) Read([]byte) (int, experimentalsys.Errno) { + return 0, 0 // Always EOF +} + +// Poll implements the same method as documented on fsapi.File +func (noopStdinFile) Poll(flag fsapi.Pflag, timeoutMillis int32) (ready bool, errno experimentalsys.Errno) { + if flag != fsapi.POLLIN { + return false, experimentalsys.ENOTSUP + } + return true, 0 // always ready to read nothing +} + +// noopStdoutFile is a fs.ModeDevice file for use implementing FdStdout and +// FdStderr. +type noopStdoutFile struct { + noopStdioFile +} + +// Write implements the same method as documented on sys.File +func (noopStdoutFile) Write(buf []byte) (int, experimentalsys.Errno) { + return len(buf), 0 // same as io.Discard +} + +type noopStdioFile struct { + experimentalsys.UnimplementedFile +} + +// Stat implements the same method as documented on sys.File +func (noopStdioFile) Stat() (sys.Stat_t, experimentalsys.Errno) { + return sys.Stat_t{Mode: modeDevice, Nlink: 1}, 0 +} + +// IsDir implements the same method as documented on sys.File +func (noopStdioFile) IsDir() (bool, experimentalsys.Errno) { + return false, 0 +} + +// Close implements the same method as documented on sys.File +func (noopStdioFile) Close() (errno experimentalsys.Errno) { return } + +// IsNonblock implements the same method as documented on fsapi.File +func (noopStdioFile) IsNonblock() bool { + return false +} + +// SetNonblock implements the same method as documented on fsapi.File +func (noopStdioFile) SetNonblock(bool) experimentalsys.Errno { + return experimentalsys.ENOSYS +} + +// Poll implements the same method as documented on fsapi.File +func (noopStdioFile) Poll(fsapi.Pflag, int32) (ready bool, errno experimentalsys.Errno) { + return false, experimentalsys.ENOSYS +} + +func stdinFileEntry(r io.Reader) (*FileEntry, error) { + if r == nil { + return &FileEntry{Name: "stdin", IsPreopen: true, File: &noopStdinFile{}}, nil + } else if f, ok := r.(*os.File); ok { + if f, err := sysfs.NewStdioFile(true, f); err != nil { + return nil, err + } else { + return &FileEntry{Name: "stdin", IsPreopen: true, File: f}, nil + } + } else { + return &FileEntry{Name: "stdin", IsPreopen: true, File: &StdinFile{Reader: r}}, nil + } +} + +func stdioWriterFileEntry(name string, w io.Writer) (*FileEntry, error) { + if w == nil { + return &FileEntry{Name: name, IsPreopen: true, File: &noopStdoutFile{}}, nil + } else if f, ok := w.(*os.File); ok { + if f, err := sysfs.NewStdioFile(false, f); err != nil { + return nil, err + } else { + return &FileEntry{Name: name, IsPreopen: true, File: f}, nil + } + } else { + return &FileEntry{Name: name, IsPreopen: true, File: &writerFile{w: w}}, nil + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sys/sys.go b/vendor/github.com/tetratelabs/wazero/internal/sys/sys.go new file mode 100644 index 000000000..12279ee49 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sys/sys.go @@ -0,0 +1,228 @@ +package sys + +import ( + "errors" + "fmt" + "io" + "net" + "time" + + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/platform" + "github.com/tetratelabs/wazero/sys" +) + +// Context holds module-scoped system resources currently only supported by +// built-in host functions. +type Context struct { + args, environ [][]byte + argsSize, environSize uint32 + + walltime sys.Walltime + walltimeResolution sys.ClockResolution + nanotime sys.Nanotime + nanotimeResolution sys.ClockResolution + nanosleep sys.Nanosleep + osyield sys.Osyield + randSource io.Reader + fsc FSContext +} + +// Args is like os.Args and defaults to nil. +// +// Note: The count will never be more than math.MaxUint32. +// See wazero.ModuleConfig WithArgs +func (c *Context) Args() [][]byte { + return c.args +} + +// ArgsSize is the size to encode Args as Null-terminated strings. +// +// Note: To get the size without null-terminators, subtract the length of Args from this value. +// See wazero.ModuleConfig WithArgs +// See https://en.wikipedia.org/wiki/Null-terminated_string +func (c *Context) ArgsSize() uint32 { + return c.argsSize +} + +// Environ are "key=value" entries like os.Environ and default to nil. +// +// Note: The count will never be more than math.MaxUint32. +// See wazero.ModuleConfig WithEnv +func (c *Context) Environ() [][]byte { + return c.environ +} + +// EnvironSize is the size to encode Environ as Null-terminated strings. +// +// Note: To get the size without null-terminators, subtract the length of Environ from this value. +// See wazero.ModuleConfig WithEnv +// See https://en.wikipedia.org/wiki/Null-terminated_string +func (c *Context) EnvironSize() uint32 { + return c.environSize +} + +// Walltime implements platform.Walltime. +func (c *Context) Walltime() (sec int64, nsec int32) { + return c.walltime() +} + +// WalltimeNanos returns platform.Walltime as epoch nanoseconds. +func (c *Context) WalltimeNanos() int64 { + sec, nsec := c.Walltime() + return (sec * time.Second.Nanoseconds()) + int64(nsec) +} + +// WalltimeResolution returns resolution of Walltime. +func (c *Context) WalltimeResolution() sys.ClockResolution { + return c.walltimeResolution +} + +// Nanotime implements sys.Nanotime. +func (c *Context) Nanotime() int64 { + return c.nanotime() +} + +// NanotimeResolution returns resolution of Nanotime. +func (c *Context) NanotimeResolution() sys.ClockResolution { + return c.nanotimeResolution +} + +// Nanosleep implements sys.Nanosleep. +func (c *Context) Nanosleep(ns int64) { + c.nanosleep(ns) +} + +// Osyield implements sys.Osyield. +func (c *Context) Osyield() { + c.osyield() +} + +// FS returns the possibly empty (UnimplementedFS) file system context. +func (c *Context) FS() *FSContext { + return &c.fsc +} + +// RandSource is a source of random bytes and defaults to a deterministic source. +// see wazero.ModuleConfig WithRandSource +func (c *Context) RandSource() io.Reader { + return c.randSource +} + +// DefaultContext returns Context with no values set except a possible nil +// sys.FS. +// +// Note: This is only used for testing. +func DefaultContext(fs experimentalsys.FS) *Context { + if sysCtx, err := NewContext(0, nil, nil, nil, nil, nil, nil, nil, 0, nil, 0, nil, nil, []experimentalsys.FS{fs}, []string{""}, nil); err != nil { + panic(fmt.Errorf("BUG: DefaultContext should never error: %w", err)) + } else { + return sysCtx + } +} + +// NewContext is a factory function which helps avoid needing to know defaults or exporting all fields. +// Note: max is exposed for testing. max is only used for env/args validation. +func NewContext( + max uint32, + args, environ [][]byte, + stdin io.Reader, + stdout, stderr io.Writer, + randSource io.Reader, + walltime sys.Walltime, + walltimeResolution sys.ClockResolution, + nanotime sys.Nanotime, + nanotimeResolution sys.ClockResolution, + nanosleep sys.Nanosleep, + osyield sys.Osyield, + fs []experimentalsys.FS, guestPaths []string, + tcpListeners []*net.TCPListener, +) (sysCtx *Context, err error) { + sysCtx = &Context{args: args, environ: environ} + + if sysCtx.argsSize, err = nullTerminatedByteCount(max, args); err != nil { + return nil, fmt.Errorf("args invalid: %w", err) + } + + if sysCtx.environSize, err = nullTerminatedByteCount(max, environ); err != nil { + return nil, fmt.Errorf("environ invalid: %w", err) + } + + if randSource == nil { + sysCtx.randSource = platform.NewFakeRandSource() + } else { + sysCtx.randSource = randSource + } + + if walltime != nil { + if clockResolutionInvalid(walltimeResolution) { + return nil, fmt.Errorf("invalid Walltime resolution: %d", walltimeResolution) + } + sysCtx.walltime = walltime + sysCtx.walltimeResolution = walltimeResolution + } else { + sysCtx.walltime = platform.NewFakeWalltime() + sysCtx.walltimeResolution = sys.ClockResolution(time.Microsecond.Nanoseconds()) + } + + if nanotime != nil { + if clockResolutionInvalid(nanotimeResolution) { + return nil, fmt.Errorf("invalid Nanotime resolution: %d", nanotimeResolution) + } + sysCtx.nanotime = nanotime + sysCtx.nanotimeResolution = nanotimeResolution + } else { + sysCtx.nanotime = platform.NewFakeNanotime() + sysCtx.nanotimeResolution = sys.ClockResolution(time.Nanosecond) + } + + if nanosleep != nil { + sysCtx.nanosleep = nanosleep + } else { + sysCtx.nanosleep = platform.FakeNanosleep + } + + if osyield != nil { + sysCtx.osyield = osyield + } else { + sysCtx.osyield = platform.FakeOsyield + } + + err = sysCtx.InitFSContext(stdin, stdout, stderr, fs, guestPaths, tcpListeners) + + return +} + +// clockResolutionInvalid returns true if the value stored isn't reasonable. +func clockResolutionInvalid(resolution sys.ClockResolution) bool { + return resolution < 1 || resolution > sys.ClockResolution(time.Hour.Nanoseconds()) +} + +// nullTerminatedByteCount ensures the count or Nul-terminated length of the elements doesn't exceed max, and that no +// element includes the nul character. +func nullTerminatedByteCount(max uint32, elements [][]byte) (uint32, error) { + count := uint32(len(elements)) + if count > max { + return 0, errors.New("exceeds maximum count") + } + + // The buffer size is the total size including null terminators. The null terminator count == value count, sum + // count with each value length. This works because in Go, the length of a string is the same as its byte count. + bufSize, maxSize := uint64(count), uint64(max) // uint64 to allow summing without overflow + for _, e := range elements { + // As this is null-terminated, We have to validate there are no null characters in the string. + for _, c := range e { + if c == 0 { + return 0, errors.New("contains NUL character") + } + } + + nextSize := bufSize + uint64(len(e)) + if nextSize > maxSize { + return 0, errors.New("exceeds maximum size") + } + bufSize = nextSize + + } + return uint32(bufSize), nil +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sys/testdata/empty.txt b/vendor/github.com/tetratelabs/wazero/internal/sys/testdata/empty.txt new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/tetratelabs/wazero/internal/sys/testdata/sub/sub/test.txt b/vendor/github.com/tetratelabs/wazero/internal/sys/testdata/sub/sub/test.txt new file mode 100644 index 000000000..75a0f4877 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sys/testdata/sub/sub/test.txt @@ -0,0 +1 @@ +greet sub sub dir diff --git a/vendor/github.com/tetratelabs/wazero/internal/sys/testdata/sub/test.txt b/vendor/github.com/tetratelabs/wazero/internal/sys/testdata/sub/test.txt new file mode 100644 index 000000000..4b45af5ed --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sys/testdata/sub/test.txt @@ -0,0 +1 @@ +greet sub dir diff --git a/vendor/github.com/tetratelabs/wazero/internal/sys/testdata/test.txt b/vendor/github.com/tetratelabs/wazero/internal/sys/testdata/test.txt new file mode 100644 index 000000000..fcb5845aa --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sys/testdata/test.txt @@ -0,0 +1 @@ +animals diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/adapter.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/adapter.go new file mode 100644 index 000000000..51a9a5480 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/adapter.go @@ -0,0 +1,105 @@ +package sysfs + +import ( + "fmt" + "io/fs" + "path" + + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/sys" +) + +type AdaptFS struct { + FS fs.FS +} + +// String implements fmt.Stringer +func (a *AdaptFS) String() string { + return fmt.Sprintf("%v", a.FS) +} + +// OpenFile implements the same method as documented on sys.FS +func (a *AdaptFS) OpenFile(path string, flag experimentalsys.Oflag, perm fs.FileMode) (experimentalsys.File, experimentalsys.Errno) { + return OpenFSFile(a.FS, cleanPath(path), flag, perm) +} + +// Lstat implements the same method as documented on sys.FS +func (a *AdaptFS) Lstat(path string) (sys.Stat_t, experimentalsys.Errno) { + // At this time, we make the assumption sys.FS instances do not support + // symbolic links, therefore Lstat is the same as Stat. This is obviously + // not true, but until FS.FS has a solid story for how to handle symlinks, + // we are better off not making a decision that would be difficult to + // revert later on. + // + // For further discussions on the topic, see: + // https://github.com/golang/go/issues/49580 + return a.Stat(path) +} + +// Stat implements the same method as documented on sys.FS +func (a *AdaptFS) Stat(path string) (sys.Stat_t, experimentalsys.Errno) { + f, errno := a.OpenFile(path, experimentalsys.O_RDONLY, 0) + if errno != 0 { + return sys.Stat_t{}, errno + } + defer f.Close() + return f.Stat() +} + +// Readlink implements the same method as documented on sys.FS +func (a *AdaptFS) Readlink(string) (string, experimentalsys.Errno) { + return "", experimentalsys.ENOSYS +} + +// Mkdir implements the same method as documented on sys.FS +func (a *AdaptFS) Mkdir(string, fs.FileMode) experimentalsys.Errno { + return experimentalsys.ENOSYS +} + +// Chmod implements the same method as documented on sys.FS +func (a *AdaptFS) Chmod(string, fs.FileMode) experimentalsys.Errno { + return experimentalsys.ENOSYS +} + +// Rename implements the same method as documented on sys.FS +func (a *AdaptFS) Rename(string, string) experimentalsys.Errno { + return experimentalsys.ENOSYS +} + +// Rmdir implements the same method as documented on sys.FS +func (a *AdaptFS) Rmdir(string) experimentalsys.Errno { + return experimentalsys.ENOSYS +} + +// Link implements the same method as documented on sys.FS +func (a *AdaptFS) Link(string, string) experimentalsys.Errno { + return experimentalsys.ENOSYS +} + +// Symlink implements the same method as documented on sys.FS +func (a *AdaptFS) Symlink(string, string) experimentalsys.Errno { + return experimentalsys.ENOSYS +} + +// Unlink implements the same method as documented on sys.FS +func (a *AdaptFS) Unlink(string) experimentalsys.Errno { + return experimentalsys.ENOSYS +} + +// Utimens implements the same method as documented on sys.FS +func (a *AdaptFS) Utimens(string, int64, int64) experimentalsys.Errno { + return experimentalsys.ENOSYS +} + +func cleanPath(name string) string { + if len(name) == 0 { + return name + } + // fs.ValidFile cannot be rooted (start with '/') + cleaned := name + if name[0] == '/' { + cleaned = name[1:] + } + cleaned = path.Clean(cleaned) // e.g. "sub/." -> "sub" + return cleaned +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/datasync_linux.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/datasync_linux.go new file mode 100644 index 000000000..c37e698d2 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/datasync_linux.go @@ -0,0 +1,14 @@ +//go:build linux + +package sysfs + +import ( + "os" + "syscall" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +func datasync(f *os.File) sys.Errno { + return sys.UnwrapOSError(syscall.Fdatasync(int(f.Fd()))) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/datasync_unsupported.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/datasync_unsupported.go new file mode 100644 index 000000000..aa05719be --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/datasync_unsupported.go @@ -0,0 +1,14 @@ +//go:build !linux + +package sysfs + +import ( + "os" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +func datasync(f *os.File) sys.Errno { + // Attempt to sync everything, even if we only need to sync the data. + return fsync(f) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/dir.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/dir.go new file mode 100644 index 000000000..f9823287c --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/dir.go @@ -0,0 +1,24 @@ +package sysfs + +import ( + "io" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +func adjustReaddirErr(f sys.File, isClosed bool, err error) sys.Errno { + if err == io.EOF { + return 0 // e.g. Readdir on darwin returns io.EOF, but linux doesn't. + } else if errno := sys.UnwrapOSError(err); errno != 0 { + errno = dirError(f, isClosed, errno) + // Comply with errors allowed on sys.File Readdir + switch errno { + case sys.EINVAL: // os.File Readdir can return this + return sys.EBADF + case sys.ENOTDIR: // dirError can return this + return sys.EBADF + } + return errno + } + return 0 +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/dirfs.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/dirfs.go new file mode 100644 index 000000000..05d5b647e --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/dirfs.go @@ -0,0 +1,131 @@ +package sysfs + +import ( + "io/fs" + "os" + + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/platform" + "github.com/tetratelabs/wazero/sys" +) + +func DirFS(dir string) experimentalsys.FS { + return &dirFS{ + dir: dir, + cleanedDir: ensureTrailingPathSeparator(dir), + } +} + +func ensureTrailingPathSeparator(dir string) string { + if !os.IsPathSeparator(dir[len(dir)-1]) { + return dir + string(os.PathSeparator) + } + return dir +} + +// dirFS is not exported because the input fields must be maintained together. +// This is likely why os.DirFS doesn't, either! +type dirFS struct { + experimentalsys.UnimplementedFS + + dir string + // cleanedDir is for easier OS-specific concatenation, as it always has + // a trailing path separator. + cleanedDir string +} + +// String implements fmt.Stringer +func (d *dirFS) String() string { + return d.dir +} + +// OpenFile implements the same method as documented on sys.FS +func (d *dirFS) OpenFile(path string, flag experimentalsys.Oflag, perm fs.FileMode) (experimentalsys.File, experimentalsys.Errno) { + return OpenOSFile(d.join(path), flag, perm) +} + +// Lstat implements the same method as documented on sys.FS +func (d *dirFS) Lstat(path string) (sys.Stat_t, experimentalsys.Errno) { + return lstat(d.join(path)) +} + +// Stat implements the same method as documented on sys.FS +func (d *dirFS) Stat(path string) (sys.Stat_t, experimentalsys.Errno) { + return stat(d.join(path)) +} + +// Mkdir implements the same method as documented on sys.FS +func (d *dirFS) Mkdir(path string, perm fs.FileMode) (errno experimentalsys.Errno) { + err := os.Mkdir(d.join(path), perm) + if errno = experimentalsys.UnwrapOSError(err); errno == experimentalsys.ENOTDIR { + errno = experimentalsys.ENOENT + } + return +} + +// Chmod implements the same method as documented on sys.FS +func (d *dirFS) Chmod(path string, perm fs.FileMode) experimentalsys.Errno { + err := os.Chmod(d.join(path), perm) + return experimentalsys.UnwrapOSError(err) +} + +// Rename implements the same method as documented on sys.FS +func (d *dirFS) Rename(from, to string) experimentalsys.Errno { + from, to = d.join(from), d.join(to) + return rename(from, to) +} + +// Readlink implements the same method as documented on sys.FS +func (d *dirFS) Readlink(path string) (string, experimentalsys.Errno) { + // Note: do not use syscall.Readlink as that causes race on Windows. + // In any case, syscall.Readlink does almost the same logic as os.Readlink. + dst, err := os.Readlink(d.join(path)) + if err != nil { + return "", experimentalsys.UnwrapOSError(err) + } + return platform.ToPosixPath(dst), 0 +} + +// Link implements the same method as documented on sys.FS +func (d *dirFS) Link(oldName, newName string) experimentalsys.Errno { + err := os.Link(d.join(oldName), d.join(newName)) + return experimentalsys.UnwrapOSError(err) +} + +// Rmdir implements the same method as documented on sys.FS +func (d *dirFS) Rmdir(path string) experimentalsys.Errno { + return rmdir(d.join(path)) +} + +// Unlink implements the same method as documented on sys.FS +func (d *dirFS) Unlink(path string) (err experimentalsys.Errno) { + return unlink(d.join(path)) +} + +// Symlink implements the same method as documented on sys.FS +func (d *dirFS) Symlink(oldName, link string) experimentalsys.Errno { + // Note: do not resolve `oldName` relative to this dirFS. The link result is always resolved + // when dereference the `link` on its usage (e.g. readlink, read, etc). + // https://github.com/bytecodealliance/cap-std/blob/v1.0.4/cap-std/src/fs/dir.rs#L404-L409 + err := os.Symlink(oldName, d.join(link)) + return experimentalsys.UnwrapOSError(err) +} + +// Utimens implements the same method as documented on sys.FS +func (d *dirFS) Utimens(path string, atim, mtim int64) experimentalsys.Errno { + return utimens(d.join(path), atim, mtim) +} + +func (d *dirFS) join(path string) string { + switch path { + case "", ".", "/": + if d.cleanedDir == "/" { + return "/" + } + // cleanedDir includes an unnecessary delimiter for the root path. + return d.cleanedDir[:len(d.cleanedDir)-1] + } + // TODO: Enforce similar to safefilepath.FromFS(path), but be careful as + // relative path inputs are allowed. e.g. dir or path == ../ + return d.cleanedDir + path +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/file.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/file.go new file mode 100644 index 000000000..9a77205bb --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/file.go @@ -0,0 +1,520 @@ +package sysfs + +import ( + "io" + "io/fs" + "os" + "time" + + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/fsapi" + "github.com/tetratelabs/wazero/sys" +) + +func NewStdioFile(stdin bool, f fs.File) (fsapi.File, error) { + // Return constant stat, which has fake times, but keep the underlying + // file mode. Fake times are needed to pass wasi-testsuite. + // https://github.com/WebAssembly/wasi-testsuite/blob/af57727/tests/rust/src/bin/fd_filestat_get.rs#L1-L19 + var mode fs.FileMode + if st, err := f.Stat(); err != nil { + return nil, err + } else { + mode = st.Mode() + } + var flag experimentalsys.Oflag + if stdin { + flag = experimentalsys.O_RDONLY + } else { + flag = experimentalsys.O_WRONLY + } + var file fsapi.File + if of, ok := f.(*os.File); ok { + // This is ok because functions that need path aren't used by stdioFile + file = newOsFile("", flag, 0, of) + } else { + file = &fsFile{file: f} + } + return &stdioFile{File: file, st: sys.Stat_t{Mode: mode, Nlink: 1}}, nil +} + +func OpenFile(path string, flag experimentalsys.Oflag, perm fs.FileMode) (*os.File, experimentalsys.Errno) { + if flag&experimentalsys.O_DIRECTORY != 0 && flag&(experimentalsys.O_WRONLY|experimentalsys.O_RDWR) != 0 { + return nil, experimentalsys.EISDIR // invalid to open a directory writeable + } + return openFile(path, flag, perm) +} + +func OpenOSFile(path string, flag experimentalsys.Oflag, perm fs.FileMode) (experimentalsys.File, experimentalsys.Errno) { + f, errno := OpenFile(path, flag, perm) + if errno != 0 { + return nil, errno + } + return newOsFile(path, flag, perm, f), 0 +} + +func OpenFSFile(fs fs.FS, path string, flag experimentalsys.Oflag, perm fs.FileMode) (experimentalsys.File, experimentalsys.Errno) { + if flag&experimentalsys.O_DIRECTORY != 0 && flag&(experimentalsys.O_WRONLY|experimentalsys.O_RDWR) != 0 { + return nil, experimentalsys.EISDIR // invalid to open a directory writeable + } + f, err := fs.Open(path) + if errno := experimentalsys.UnwrapOSError(err); errno != 0 { + return nil, errno + } + // Don't return an os.File because the path is not absolute. osFile needs + // the path to be real and certain FS.File impls are subrooted. + return &fsFile{fs: fs, name: path, file: f}, 0 +} + +type stdioFile struct { + fsapi.File + st sys.Stat_t +} + +// SetAppend implements File.SetAppend +func (f *stdioFile) SetAppend(bool) experimentalsys.Errno { + // Ignore for stdio. + return 0 +} + +// IsAppend implements File.SetAppend +func (f *stdioFile) IsAppend() bool { + return true +} + +// Stat implements File.Stat +func (f *stdioFile) Stat() (sys.Stat_t, experimentalsys.Errno) { + return f.st, 0 +} + +// Close implements File.Close +func (f *stdioFile) Close() experimentalsys.Errno { + return 0 +} + +// fsFile is used for wrapped fs.File, like os.Stdin or any fs.File +// implementation. Notably, this does not have access to the full file path. +// so certain operations can't be supported, such as inode lookups on Windows. +type fsFile struct { + experimentalsys.UnimplementedFile + + // fs is the file-system that opened the file, or nil when wrapped for + // pre-opens like stdio. + fs fs.FS + + // name is what was used in fs for Open, so it may not be the actual path. + name string + + // file is always set, possibly an os.File like os.Stdin. + file fs.File + + // reopenDir is true if reopen should be called before Readdir. This flag + // is deferred until Readdir to prevent redundant rewinds. This could + // happen if Seek(0) was called twice, or if in Windows, Seek(0) was called + // before Readdir. + reopenDir bool + + // closed is true when closed was called. This ensures proper sys.EBADF + closed bool + + // cachedStat includes fields that won't change while a file is open. + cachedSt *cachedStat +} + +type cachedStat struct { + // dev is the same as sys.Stat_t Dev. + dev uint64 + + // dev is the same as sys.Stat_t Ino. + ino sys.Inode + + // isDir is sys.Stat_t Mode masked with fs.ModeDir + isDir bool +} + +// cachedStat returns the cacheable parts of sys.Stat_t or an error if they +// couldn't be retrieved. +func (f *fsFile) cachedStat() (dev uint64, ino sys.Inode, isDir bool, errno experimentalsys.Errno) { + if f.cachedSt == nil { + if _, errno = f.Stat(); errno != 0 { + return + } + } + return f.cachedSt.dev, f.cachedSt.ino, f.cachedSt.isDir, 0 +} + +// Dev implements the same method as documented on sys.File +func (f *fsFile) Dev() (uint64, experimentalsys.Errno) { + dev, _, _, errno := f.cachedStat() + return dev, errno +} + +// Ino implements the same method as documented on sys.File +func (f *fsFile) Ino() (sys.Inode, experimentalsys.Errno) { + _, ino, _, errno := f.cachedStat() + return ino, errno +} + +// IsDir implements the same method as documented on sys.File +func (f *fsFile) IsDir() (bool, experimentalsys.Errno) { + _, _, isDir, errno := f.cachedStat() + return isDir, errno +} + +// IsAppend implements the same method as documented on sys.File +func (f *fsFile) IsAppend() bool { + return false +} + +// SetAppend implements the same method as documented on sys.File +func (f *fsFile) SetAppend(bool) (errno experimentalsys.Errno) { + return fileError(f, f.closed, experimentalsys.ENOSYS) +} + +// Stat implements the same method as documented on sys.File +func (f *fsFile) Stat() (sys.Stat_t, experimentalsys.Errno) { + if f.closed { + return sys.Stat_t{}, experimentalsys.EBADF + } + + st, errno := statFile(f.file) + switch errno { + case 0: + f.cachedSt = &cachedStat{dev: st.Dev, ino: st.Ino, isDir: st.Mode&fs.ModeDir == fs.ModeDir} + case experimentalsys.EIO: + errno = experimentalsys.EBADF + } + return st, errno +} + +// Read implements the same method as documented on sys.File +func (f *fsFile) Read(buf []byte) (n int, errno experimentalsys.Errno) { + if n, errno = read(f.file, buf); errno != 0 { + // Defer validation overhead until we've already had an error. + errno = fileError(f, f.closed, errno) + } + return +} + +// Pread implements the same method as documented on sys.File +func (f *fsFile) Pread(buf []byte, off int64) (n int, errno experimentalsys.Errno) { + if ra, ok := f.file.(io.ReaderAt); ok { + if n, errno = pread(ra, buf, off); errno != 0 { + // Defer validation overhead until we've already had an error. + errno = fileError(f, f.closed, errno) + } + return + } + + // See /RATIONALE.md "fd_pread: io.Seeker fallback when io.ReaderAt is not supported" + if rs, ok := f.file.(io.ReadSeeker); ok { + // Determine the current position in the file, as we need to revert it. + currentOffset, err := rs.Seek(0, io.SeekCurrent) + if err != nil { + return 0, fileError(f, f.closed, experimentalsys.UnwrapOSError(err)) + } + + // Put the read position back when complete. + defer func() { _, _ = rs.Seek(currentOffset, io.SeekStart) }() + + // If the current offset isn't in sync with this reader, move it. + if off != currentOffset { + if _, err = rs.Seek(off, io.SeekStart); err != nil { + return 0, fileError(f, f.closed, experimentalsys.UnwrapOSError(err)) + } + } + + n, err = rs.Read(buf) + if errno = experimentalsys.UnwrapOSError(err); errno != 0 { + // Defer validation overhead until we've already had an error. + errno = fileError(f, f.closed, errno) + } + } else { + errno = experimentalsys.ENOSYS // unsupported + } + return +} + +// Seek implements the same method as documented on sys.File +func (f *fsFile) Seek(offset int64, whence int) (newOffset int64, errno experimentalsys.Errno) { + // If this is a directory, and we're attempting to seek to position zero, + // we have to re-open the file to ensure the directory state is reset. + var isDir bool + if offset == 0 && whence == io.SeekStart { + if isDir, errno = f.IsDir(); errno == 0 && isDir { + f.reopenDir = true + return + } + } + + if s, ok := f.file.(io.Seeker); ok { + if newOffset, errno = seek(s, offset, whence); errno != 0 { + // Defer validation overhead until we've already had an error. + errno = fileError(f, f.closed, errno) + } + } else { + errno = experimentalsys.ENOSYS // unsupported + } + return +} + +// Readdir implements the same method as documented on sys.File +// +// Notably, this uses readdirFile or fs.ReadDirFile if available. This does not +// return inodes on windows. +func (f *fsFile) Readdir(n int) (dirents []experimentalsys.Dirent, errno experimentalsys.Errno) { + // Windows lets you Readdir after close, FS.File also may not implement + // close in a meaningful way. read our closed field to return consistent + // results. + if f.closed { + errno = experimentalsys.EBADF + return + } + + if f.reopenDir { // re-open the directory if needed. + f.reopenDir = false + if errno = adjustReaddirErr(f, f.closed, f.reopen()); errno != 0 { + return + } + } + + if of, ok := f.file.(readdirFile); ok { + // We can't use f.name here because it is the path up to the sys.FS, + // not necessarily the real path. For this reason, Windows may not be + // able to populate inodes. However, Darwin and Linux will. + if dirents, errno = readdir(of, "", n); errno != 0 { + errno = adjustReaddirErr(f, f.closed, errno) + } + return + } + + // Try with FS.ReadDirFile which is available on api.FS implementations + // like embed:FS. + if rdf, ok := f.file.(fs.ReadDirFile); ok { + entries, e := rdf.ReadDir(n) + if errno = adjustReaddirErr(f, f.closed, e); errno != 0 { + return + } + dirents = make([]experimentalsys.Dirent, 0, len(entries)) + for _, e := range entries { + // By default, we don't attempt to read inode data + dirents = append(dirents, experimentalsys.Dirent{Name: e.Name(), Type: e.Type()}) + } + } else { + errno = experimentalsys.EBADF // not a directory + } + return +} + +// Write implements the same method as documented on sys.File. +func (f *fsFile) Write(buf []byte) (n int, errno experimentalsys.Errno) { + if w, ok := f.file.(io.Writer); ok { + if n, errno = write(w, buf); errno != 0 { + // Defer validation overhead until we've already had an error. + errno = fileError(f, f.closed, errno) + } + } else { + errno = experimentalsys.ENOSYS // unsupported + } + return +} + +// Pwrite implements the same method as documented on sys.File. +func (f *fsFile) Pwrite(buf []byte, off int64) (n int, errno experimentalsys.Errno) { + if wa, ok := f.file.(io.WriterAt); ok { + if n, errno = pwrite(wa, buf, off); errno != 0 { + // Defer validation overhead until we've already had an error. + errno = fileError(f, f.closed, errno) + } + } else { + errno = experimentalsys.ENOSYS // unsupported + } + return +} + +// Close implements the same method as documented on sys.File. +func (f *fsFile) Close() experimentalsys.Errno { + if f.closed { + return 0 + } + f.closed = true + return f.close() +} + +func (f *fsFile) close() experimentalsys.Errno { + return experimentalsys.UnwrapOSError(f.file.Close()) +} + +// IsNonblock implements the same method as documented on fsapi.File +func (f *fsFile) IsNonblock() bool { + return false +} + +// SetNonblock implements the same method as documented on fsapi.File +func (f *fsFile) SetNonblock(bool) experimentalsys.Errno { + return experimentalsys.ENOSYS +} + +// Poll implements the same method as documented on fsapi.File +func (f *fsFile) Poll(fsapi.Pflag, int32) (ready bool, errno experimentalsys.Errno) { + return false, experimentalsys.ENOSYS +} + +// dirError is used for commands that work against a directory, but not a file. +func dirError(f experimentalsys.File, isClosed bool, errno experimentalsys.Errno) experimentalsys.Errno { + if vErrno := validate(f, isClosed, false, true); vErrno != 0 { + return vErrno + } + return errno +} + +// fileError is used for commands that work against a file, but not a directory. +func fileError(f experimentalsys.File, isClosed bool, errno experimentalsys.Errno) experimentalsys.Errno { + if vErrno := validate(f, isClosed, true, false); vErrno != 0 { + return vErrno + } + return errno +} + +// validate is used to making syscalls which will fail. +func validate(f experimentalsys.File, isClosed, wantFile, wantDir bool) experimentalsys.Errno { + if isClosed { + return experimentalsys.EBADF + } + + isDir, errno := f.IsDir() + if errno != 0 { + return errno + } + + if wantFile && isDir { + return experimentalsys.EISDIR + } else if wantDir && !isDir { + return experimentalsys.ENOTDIR + } + return 0 +} + +func read(r io.Reader, buf []byte) (n int, errno experimentalsys.Errno) { + if len(buf) == 0 { + return 0, 0 // less overhead on zero-length reads. + } + + n, err := r.Read(buf) + return n, experimentalsys.UnwrapOSError(err) +} + +func pread(ra io.ReaderAt, buf []byte, off int64) (n int, errno experimentalsys.Errno) { + if len(buf) == 0 { + return 0, 0 // less overhead on zero-length reads. + } + + n, err := ra.ReadAt(buf, off) + return n, experimentalsys.UnwrapOSError(err) +} + +func seek(s io.Seeker, offset int64, whence int) (int64, experimentalsys.Errno) { + if uint(whence) > io.SeekEnd { + return 0, experimentalsys.EINVAL // negative or exceeds the largest valid whence + } + + newOffset, err := s.Seek(offset, whence) + return newOffset, experimentalsys.UnwrapOSError(err) +} + +// reopenFile allows re-opening a file for reasons such as applying flags or +// directory iteration. +type reopenFile func() experimentalsys.Errno + +// compile-time check to ensure fsFile.reopen implements reopenFile. +var _ reopenFile = (*fsFile)(nil).reopen + +// reopen implements the same method as documented on reopenFile. +func (f *fsFile) reopen() experimentalsys.Errno { + _ = f.close() + var err error + f.file, err = f.fs.Open(f.name) + return experimentalsys.UnwrapOSError(err) +} + +// readdirFile allows masking the `Readdir` function on os.File. +type readdirFile interface { + Readdir(n int) ([]fs.FileInfo, error) +} + +// readdir uses readdirFile.Readdir, special casing windows when path !="". +func readdir(f readdirFile, path string, n int) (dirents []experimentalsys.Dirent, errno experimentalsys.Errno) { + fis, e := f.Readdir(n) + if errno = experimentalsys.UnwrapOSError(e); errno != 0 { + return + } + + dirents = make([]experimentalsys.Dirent, 0, len(fis)) + + // linux/darwin won't have to fan out to lstat, but windows will. + var ino sys.Inode + for fi := range fis { + t := fis[fi] + // inoFromFileInfo is more efficient than sys.NewStat_t, as it gets the + // inode without allocating an instance and filling other fields. + if ino, errno = inoFromFileInfo(path, t); errno != 0 { + return + } + dirents = append(dirents, experimentalsys.Dirent{Name: t.Name(), Ino: ino, Type: t.Mode().Type()}) + } + return +} + +func write(w io.Writer, buf []byte) (n int, errno experimentalsys.Errno) { + if len(buf) == 0 { + return 0, 0 // less overhead on zero-length writes. + } + + n, err := w.Write(buf) + return n, experimentalsys.UnwrapOSError(err) +} + +func pwrite(w io.WriterAt, buf []byte, off int64) (n int, errno experimentalsys.Errno) { + if len(buf) == 0 { + return 0, 0 // less overhead on zero-length writes. + } + + n, err := w.WriteAt(buf, off) + return n, experimentalsys.UnwrapOSError(err) +} + +func chtimes(path string, atim, mtim int64) (errno experimentalsys.Errno) { //nolint:unused + // When both inputs are omitted, there is nothing to change. + if atim == experimentalsys.UTIME_OMIT && mtim == experimentalsys.UTIME_OMIT { + return + } + + // UTIME_OMIT is expensive until progress is made in Go, as it requires a + // stat to read-back the value to re-apply. + // - https://github.com/golang/go/issues/32558. + // - https://go-review.googlesource.com/c/go/+/219638 (unmerged) + var st sys.Stat_t + if atim == experimentalsys.UTIME_OMIT || mtim == experimentalsys.UTIME_OMIT { + if st, errno = stat(path); errno != 0 { + return + } + } + + var atime, mtime time.Time + if atim == experimentalsys.UTIME_OMIT { + atime = epochNanosToTime(st.Atim) + mtime = epochNanosToTime(mtim) + } else if mtim == experimentalsys.UTIME_OMIT { + atime = epochNanosToTime(atim) + mtime = epochNanosToTime(st.Mtim) + } else { + atime = epochNanosToTime(atim) + mtime = epochNanosToTime(mtim) + } + return experimentalsys.UnwrapOSError(os.Chtimes(path, atime, mtime)) +} + +func epochNanosToTime(epochNanos int64) time.Time { //nolint:unused + seconds := epochNanos / 1e9 + nanos := epochNanos % 1e9 + return time.Unix(seconds, nanos) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/file_test.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/file_test.go new file mode 100644 index 000000000..44e7eb54c --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/file_test.go @@ -0,0 +1,1136 @@ +package sysfs + +import ( + "embed" + "io" + "io/fs" + "os" + "path" + "runtime" + "testing" + gofstest "testing/fstest" + + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/fsapi" + "github.com/tetratelabs/wazero/internal/platform" + "github.com/tetratelabs/wazero/internal/testing/require" + "github.com/tetratelabs/wazero/sys" +) + +//go:embed file_test.go +var embedFS embed.FS + +var ( + //go:embed testdata + testdata embed.FS + wazeroFile = "wazero.txt" + emptyFile = "empty.txt" +) + +func TestStdioFileSetNonblock(t *testing.T) { + // Test using os.Pipe as it is known to support non-blocking reads. + r, w, err := os.Pipe() + require.NoError(t, err) + defer r.Close() + defer w.Close() + + rF, err := NewStdioFile(true, r) + require.NoError(t, err) + + errno := rF.SetNonblock(true) + require.EqualErrno(t, 0, errno) + require.True(t, rF.IsNonblock()) + + errno = rF.SetNonblock(false) + require.EqualErrno(t, 0, errno) + require.False(t, rF.IsNonblock()) +} + +func TestRegularFileSetNonblock(t *testing.T) { + // Test using os.Pipe as it is known to support non-blocking reads. + r, w, err := os.Pipe() + require.NoError(t, err) + defer r.Close() + defer w.Close() + + rF := newOsFile("", experimentalsys.O_RDONLY, 0, r) + + errno := rF.SetNonblock(true) + require.EqualErrno(t, 0, errno) + require.True(t, rF.IsNonblock()) + + // Read from the file without ever writing to it should not block. + buf := make([]byte, 8) + _, e := rF.Read(buf) + require.EqualErrno(t, experimentalsys.EAGAIN, e) + + errno = rF.SetNonblock(false) + require.EqualErrno(t, 0, errno) + require.False(t, rF.IsNonblock()) +} + +func TestReadFdNonblock(t *testing.T) { + // Test using os.Pipe as it is known to support non-blocking reads. + r, w, err := os.Pipe() + require.NoError(t, err) + defer r.Close() + defer w.Close() + + fd := r.Fd() + errno := setNonblock(fd, true) + require.EqualErrno(t, 0, errno) + + // Read from the file without ever writing to it should not block. + buf := make([]byte, 8) + _, errno = readFd(fd, buf) + require.EqualErrno(t, experimentalsys.EAGAIN, errno) +} + +func TestWriteFdNonblock(t *testing.T) { + // Test using os.Pipe as it is known to support non-blocking reads. + r, w, err := os.Pipe() + require.NoError(t, err) + defer r.Close() + defer w.Close() + + fd := w.Fd() + errno := setNonblock(fd, true) + + require.EqualErrno(t, 0, errno) + + // Create a buffer (the content is not relevant) + buf := make([]byte, 1024) + // Write to the file until the pipe buffer gets filled up. + numWrites := 100 + for i := 0; i < numWrites; i++ { + _, e := writeFd(fd, buf) + if e != 0 { + if runtime.GOOS == "windows" { + // This is currently not supported on Windows. + require.EqualErrno(t, experimentalsys.ENOSYS, e) + } else { + require.EqualErrno(t, experimentalsys.EAGAIN, e) + } + return + } + } + t.Fatal("writeFd should return EAGAIN at some point") +} + +func TestFileSetAppend(t *testing.T) { + tmpDir := t.TempDir() + + fPath := path.Join(tmpDir, "file") + require.NoError(t, os.WriteFile(fPath, []byte("0123456789"), 0o600)) + + // Open without APPEND. + f, errno := OpenOSFile(fPath, experimentalsys.O_RDWR, 0o600) + require.EqualErrno(t, 0, errno) + require.False(t, f.IsAppend()) + + // Set the APPEND flag. + require.EqualErrno(t, 0, f.SetAppend(true)) + require.True(t, f.IsAppend()) + + requireFileContent := func(exp string) { + buf, err := os.ReadFile(fPath) + require.NoError(t, err) + require.Equal(t, exp, string(buf)) + } + + // with O_APPEND flag, the data is appended to buffer. + _, errno = f.Write([]byte("wazero")) + require.EqualErrno(t, 0, errno) + requireFileContent("0123456789wazero") + + // Remove the APPEND flag. + require.EqualErrno(t, 0, f.SetAppend(false)) + require.False(t, f.IsAppend()) + + _, errno = f.Seek(0, 0) + require.EqualErrno(t, 0, errno) + + // without O_APPEND flag, the data writes at offset zero + _, errno = f.Write([]byte("wazero")) + require.EqualErrno(t, 0, errno) + requireFileContent("wazero6789wazero") +} + +func TestStdioFile_SetAppend(t *testing.T) { + // SetAppend should not affect Stdio. + file, err := NewStdioFile(false, os.Stdout) + require.NoError(t, err) + errno := file.SetAppend(true) + require.EqualErrno(t, 0, errno) + _, errno = file.Write([]byte{}) + require.EqualErrno(t, 0, errno) +} + +func TestFileIno(t *testing.T) { + tmpDir := t.TempDir() + dirFS, embedFS, mapFS := dirEmbedMapFS(t, tmpDir) + + // get the expected inode + st, errno := stat(tmpDir) + require.EqualErrno(t, 0, errno) + + tests := []struct { + name string + fs fs.FS + expectedIno sys.Inode + }{ + {name: "os.DirFS", fs: dirFS, expectedIno: st.Ino}, + {name: "embed.api.FS", fs: embedFS}, + {name: "fstest.MapFS", fs: mapFS}, + } + + for _, tc := range tests { + tc := tc + + t.Run(tc.name, func(t *testing.T) { + d, errno := OpenFSFile(tc.fs, ".", experimentalsys.O_RDONLY, 0) + require.EqualErrno(t, 0, errno) + defer d.Close() + + ino, errno := d.Ino() + require.EqualErrno(t, 0, errno) + // Results are inconsistent, so don't validate the opposite. + if statSetsIno() { + require.Equal(t, tc.expectedIno, ino) + } + }) + } + + t.Run("OS", func(t *testing.T) { + d, errno := OpenOSFile(tmpDir, experimentalsys.O_RDONLY, 0) + require.EqualErrno(t, 0, errno) + defer d.Close() + + ino, errno := d.Ino() + require.EqualErrno(t, 0, errno) + // Results are inconsistent, so don't validate the opposite. + if statSetsIno() { + require.Equal(t, st.Ino, ino) + } + }) +} + +// statSetsIno returns true if this will set sys.Stat_t Ino on stat. The +// reverse doesn't mean it won't. Rather it is inconsistent. This is needed +// because Windows on Go 1.19 sometimes, but not always returns non-zero inode. +func statSetsIno() bool { + if runtime.GOOS != "windows" { + return true + } else { + // Go can read the inode via a Windows file handle, but it is + // inconsistent on Go 1.19. + return platform.IsAtLeastGo120 + } +} + +func TestFileIsDir(t *testing.T) { + dirFS, embedFS, mapFS := dirEmbedMapFS(t, t.TempDir()) + + tests := []struct { + name string + fs fs.FS + }{ + {name: "os.DirFS", fs: dirFS}, + {name: "embed.api.FS", fs: embedFS}, + {name: "fstest.MapFS", fs: mapFS}, + } + + for _, tc := range tests { + tc := tc + + t.Run(tc.name, func(t *testing.T) { + t.Run("file", func(t *testing.T) { + f, errno := OpenFSFile(tc.fs, wazeroFile, experimentalsys.O_RDONLY, 0) + require.EqualErrno(t, 0, errno) + defer f.Close() + + isDir, errno := f.IsDir() + require.EqualErrno(t, 0, errno) + require.False(t, isDir) + }) + + t.Run("dir", func(t *testing.T) { + d, errno := OpenFSFile(tc.fs, ".", experimentalsys.O_RDONLY, 0) + require.EqualErrno(t, 0, errno) + defer d.Close() + + isDir, errno := d.IsDir() + require.EqualErrno(t, 0, errno) + require.True(t, isDir) + }) + }) + } + + t.Run("OS dir", func(t *testing.T) { + d, errno := OpenOSFile(t.TempDir(), experimentalsys.O_RDONLY, 0) + require.EqualErrno(t, 0, errno) + defer d.Close() + + isDir, errno := d.IsDir() + require.EqualErrno(t, 0, errno) + require.True(t, isDir) + }) +} + +func TestFileReadAndPread(t *testing.T) { + dirFS, embedFS, mapFS := dirEmbedMapFS(t, t.TempDir()) + + tests := []struct { + name string + fs fs.FS + }{ + {name: "os.DirFS", fs: dirFS}, + {name: "embed.api.FS", fs: embedFS}, + {name: "fstest.MapFS", fs: mapFS}, + } + + buf := make([]byte, 3) + + for _, tc := range tests { + tc := tc + + t.Run(tc.name, func(t *testing.T) { + f, errno := OpenFSFile(tc.fs, wazeroFile, experimentalsys.O_RDONLY, 0) + require.EqualErrno(t, 0, errno) + defer f.Close() + + // The file should be readable (base case) + requireRead(t, f, buf) + require.Equal(t, "waz", string(buf)) + buf = buf[:] + + // We should be able to pread from zero also + requirePread(t, f, buf, 0) + require.Equal(t, "waz", string(buf)) + buf = buf[:] + + // If the offset didn't change, read should expect the next three chars. + requireRead(t, f, buf) + require.Equal(t, "ero", string(buf)) + buf = buf[:] + + // We should also be able pread from any offset + requirePread(t, f, buf, 2) + require.Equal(t, "zer", string(buf)) + }) + } +} + +func TestFilePoll_POLLIN(t *testing.T) { + pflag := fsapi.POLLIN + + // Test using os.Pipe as it is known to support poll. + r, w, err := os.Pipe() + require.NoError(t, err) + defer r.Close() + defer w.Close() + + rF, err := NewStdioFile(true, r) + require.NoError(t, err) + buf := make([]byte, 10) + timeout := int32(0) // return immediately + + // When there's nothing in the pipe, it isn't ready. + ready, errno := rF.Poll(pflag, timeout) + require.EqualErrno(t, 0, errno) + require.False(t, ready) + + // Write to the pipe to make the data available + expected := []byte("wazero") + _, err = w.Write([]byte("wazero")) + require.NoError(t, err) + + // We should now be able to poll ready + ready, errno = rF.Poll(pflag, timeout) + require.EqualErrno(t, 0, errno) + require.True(t, ready) + + // We should now be able to read from the pipe + n, errno := rF.Read(buf) + require.EqualErrno(t, 0, errno) + require.Equal(t, len(expected), n) + require.Equal(t, expected, buf[:len(expected)]) +} + +func TestFilePoll_POLLOUT(t *testing.T) { + pflag := fsapi.POLLOUT + + // Test using os.Pipe as it is known to support poll. + r, w, err := os.Pipe() + require.NoError(t, err) + defer r.Close() + defer w.Close() + + wF, err := NewStdioFile(false, w) + require.NoError(t, err) + timeout := int32(0) // return immediately + + // We don't yet implement write blocking. + ready, errno := wF.Poll(pflag, timeout) + require.EqualErrno(t, experimentalsys.ENOTSUP, errno) + require.False(t, ready) +} + +func requireRead(t *testing.T, f experimentalsys.File, buf []byte) { + n, errno := f.Read(buf) + require.EqualErrno(t, 0, errno) + require.Equal(t, len(buf), n) +} + +func requirePread(t *testing.T, f experimentalsys.File, buf []byte, off int64) { + n, errno := f.Pread(buf, off) + require.EqualErrno(t, 0, errno) + require.Equal(t, len(buf), n) +} + +func TestFileRead_empty(t *testing.T) { + dirFS, embedFS, mapFS := dirEmbedMapFS(t, t.TempDir()) + + tests := []struct { + name string + fs fs.FS + }{ + {name: "os.DirFS", fs: dirFS}, + {name: "embed.api.FS", fs: embedFS}, + {name: "fstest.MapFS", fs: mapFS}, + } + + buf := make([]byte, 3) + + for _, tc := range tests { + tc := tc + + t.Run(tc.name, func(t *testing.T) { + f, errno := OpenFSFile(tc.fs, emptyFile, experimentalsys.O_RDONLY, 0) + require.EqualErrno(t, 0, errno) + defer f.Close() + + t.Run("Read", func(t *testing.T) { + // We should be able to read an empty file + n, errno := f.Read(buf) + require.EqualErrno(t, 0, errno) + require.Zero(t, n) + }) + + t.Run("Pread", func(t *testing.T) { + n, errno := f.Pread(buf, 0) + require.EqualErrno(t, 0, errno) + require.Zero(t, n) + }) + }) + } +} + +type maskFS struct { + fs.FS +} + +func (m *maskFS) Open(name string) (fs.File, error) { + f, err := m.FS.Open(name) + return struct{ fs.File }{f}, err +} + +func TestFilePread_Unsupported(t *testing.T) { + embedFS, err := fs.Sub(testdata, "testdata") + require.NoError(t, err) + + f, errno := OpenFSFile(&maskFS{embedFS}, emptyFile, experimentalsys.O_RDONLY, 0) + require.EqualErrno(t, 0, errno) + defer f.Close() + + buf := make([]byte, 3) + _, errno = f.Pread(buf, 0) + require.EqualErrno(t, experimentalsys.ENOSYS, errno) +} + +func TestFileRead_Errors(t *testing.T) { + // Create the file + path := path.Join(t.TempDir(), emptyFile) + + // Open the file write-only + flag := experimentalsys.O_WRONLY | experimentalsys.O_CREAT + f := requireOpenFile(t, path, flag, 0o600) + defer f.Close() + buf := make([]byte, 5) + + tests := []struct { + name string + fn func(experimentalsys.File) experimentalsys.Errno + }{ + {name: "Read", fn: func(f experimentalsys.File) experimentalsys.Errno { + _, errno := f.Read(buf) + return errno + }}, + {name: "Pread", fn: func(f experimentalsys.File) experimentalsys.Errno { + _, errno := f.Pread(buf, 0) + return errno + }}, + } + + for _, tc := range tests { + tc := tc + + t.Run(tc.name, func(t *testing.T) { + t.Run("EBADF when not open for reading", func(t *testing.T) { + // The descriptor exists, but not open for reading + errno := tc.fn(f) + require.EqualErrno(t, experimentalsys.EBADF, errno) + }) + testEISDIR(t, tc.fn) + }) + } +} + +func TestFileSeek(t *testing.T) { + tmpDir := t.TempDir() + dirFS, embedFS, mapFS := dirEmbedMapFS(t, tmpDir) + + tests := []struct { + name string + openFile func(string) (experimentalsys.File, experimentalsys.Errno) + }{ + {name: "fsFile os.DirFS", openFile: func(name string) (experimentalsys.File, experimentalsys.Errno) { + return OpenFSFile(dirFS, name, experimentalsys.O_RDONLY, 0) + }}, + {name: "fsFile embed.api.FS", openFile: func(name string) (experimentalsys.File, experimentalsys.Errno) { + return OpenFSFile(embedFS, name, experimentalsys.O_RDONLY, 0) + }}, + {name: "fsFile fstest.MapFS", openFile: func(name string) (experimentalsys.File, experimentalsys.Errno) { + return OpenFSFile(mapFS, name, experimentalsys.O_RDONLY, 0) + }}, + {name: "osFile", openFile: func(name string) (experimentalsys.File, experimentalsys.Errno) { + return OpenOSFile(path.Join(tmpDir, name), experimentalsys.O_RDONLY, 0o666) + }}, + } + + buf := make([]byte, 3) + + for _, tc := range tests { + tc := tc + + t.Run(tc.name, func(t *testing.T) { + f, errno := tc.openFile(wazeroFile) + require.EqualErrno(t, 0, errno) + defer f.Close() + + // Shouldn't be able to use an invalid whence + _, errno = f.Seek(0, io.SeekEnd+1) + require.EqualErrno(t, experimentalsys.EINVAL, errno) + _, errno = f.Seek(0, -1) + require.EqualErrno(t, experimentalsys.EINVAL, errno) + + // Shouldn't be able to seek before the file starts. + _, errno = f.Seek(-1, io.SeekStart) + require.EqualErrno(t, experimentalsys.EINVAL, errno) + + requireRead(t, f, buf) // read 3 bytes + + // Seek to the start + newOffset, errno := f.Seek(0, io.SeekStart) + require.EqualErrno(t, 0, errno) + + // verify we can re-read from the beginning now. + require.Zero(t, newOffset) + requireRead(t, f, buf) // read 3 bytes again + require.Equal(t, "waz", string(buf)) + buf = buf[:] + + // Seek to the start with zero allows you to read it back. + newOffset, errno = f.Seek(0, io.SeekCurrent) + require.EqualErrno(t, 0, errno) + require.Equal(t, int64(3), newOffset) + + // Seek to the last two bytes + newOffset, errno = f.Seek(-2, io.SeekEnd) + require.EqualErrno(t, 0, errno) + + // verify we can read the last two bytes + require.Equal(t, int64(5), newOffset) + n, errno := f.Read(buf) + require.EqualErrno(t, 0, errno) + require.Equal(t, 2, n) + require.Equal(t, "o\n", string(buf[:2])) + + t.Run("directory seek to zero", func(t *testing.T) { + dotF, errno := tc.openFile(".") + require.EqualErrno(t, 0, errno) + defer dotF.Close() + + dirents, errno := dotF.Readdir(-1) + require.EqualErrno(t, 0, errno) + direntCount := len(dirents) + require.False(t, direntCount == 0) + + // rewind via seek to zero + newOffset, errno := dotF.Seek(0, io.SeekStart) + require.EqualErrno(t, 0, errno) + require.Zero(t, newOffset) + + // redundantly seek to zero again + newOffset, errno = dotF.Seek(0, io.SeekStart) + require.EqualErrno(t, 0, errno) + require.Zero(t, newOffset) + + // We should be able to read again + dirents, errno = dotF.Readdir(-1) + require.EqualErrno(t, 0, errno) + require.Equal(t, direntCount, len(dirents)) + }) + + seekToZero := func(f experimentalsys.File) experimentalsys.Errno { + _, errno := f.Seek(0, io.SeekStart) + return errno + } + testEBADFIfFileClosed(t, seekToZero) + }) + } +} + +func requireSeek(t *testing.T, f experimentalsys.File, off int64, whence int) int64 { + n, errno := f.Seek(off, whence) + require.EqualErrno(t, 0, errno) + return n +} + +func TestFileSeek_empty(t *testing.T) { + dirFS, embedFS, mapFS := dirEmbedMapFS(t, t.TempDir()) + + tests := []struct { + name string + fs fs.FS + }{ + {name: "os.DirFS", fs: dirFS}, + {name: "embed.api.FS", fs: embedFS}, + {name: "fstest.MapFS", fs: mapFS}, + } + + for _, tc := range tests { + tc := tc + + t.Run(tc.name, func(t *testing.T) { + f, errno := OpenFSFile(tc.fs, emptyFile, experimentalsys.O_RDONLY, 0) + require.EqualErrno(t, 0, errno) + defer f.Close() + + t.Run("Start", func(t *testing.T) { + require.Zero(t, requireSeek(t, f, 0, io.SeekStart)) + }) + + t.Run("Current", func(t *testing.T) { + require.Zero(t, requireSeek(t, f, 0, io.SeekCurrent)) + }) + + t.Run("End", func(t *testing.T) { + require.Zero(t, requireSeek(t, f, 0, io.SeekEnd)) + }) + }) + } +} + +func TestFileSeek_Unsupported(t *testing.T) { + embedFS, err := fs.Sub(testdata, "testdata") + require.NoError(t, err) + + f, errno := OpenFSFile(&maskFS{embedFS}, emptyFile, experimentalsys.O_RDONLY, 0) + require.EqualErrno(t, 0, errno) + defer f.Close() + + _, errno = f.Seek(0, io.SeekCurrent) + require.EqualErrno(t, experimentalsys.ENOSYS, errno) +} + +func TestFileWriteAndPwrite(t *testing.T) { + // sys.FS doesn't support writes, and there is no other built-in + // implementation except os.File. + path := path.Join(t.TempDir(), wazeroFile) + f := requireOpenFile(t, path, experimentalsys.O_RDWR|experimentalsys.O_CREAT, 0o600) + defer f.Close() + + text := "wazero" + buf := make([]byte, 3) + copy(buf, text[:3]) + + // The file should be writeable + requireWrite(t, f, buf) + + // We should be able to pwrite at gap + requirePwrite(t, f, buf, 6) + + copy(buf, text[3:]) + + // If the offset didn't change, the next chars will write after the + // first + requireWrite(t, f, buf) + + // We should be able to pwrite the same bytes as above + requirePwrite(t, f, buf, 9) + + // We should also be able to pwrite past the above. + requirePwrite(t, f, buf, 12) + + b, err := os.ReadFile(path) + require.NoError(t, err) + + // We expect to have written the text two and a half times: + // 1. Write: (file offset 0) "waz" + // 2. Pwrite: offset 6 "waz" + // 3. Write: (file offset 3) "ero" + // 4. Pwrite: offset 9 "ero" + // 4. Pwrite: offset 12 "ero" + require.Equal(t, "wazerowazeroero", string(b)) +} + +func requireWrite(t *testing.T, f experimentalsys.File, buf []byte) { + n, errno := f.Write(buf) + require.EqualErrno(t, 0, errno) + require.Equal(t, len(buf), n) +} + +func requirePwrite(t *testing.T, f experimentalsys.File, buf []byte, off int64) { + n, errno := f.Pwrite(buf, off) + require.EqualErrno(t, 0, errno) + require.Equal(t, len(buf), n) +} + +func TestFileWrite_empty(t *testing.T) { + // sys.FS doesn't support writes, and there is no other built-in + // implementation except os.File. + path := path.Join(t.TempDir(), emptyFile) + f := requireOpenFile(t, path, experimentalsys.O_RDWR|experimentalsys.O_CREAT, 0o600) + defer f.Close() + + tests := []struct { + name string + fn func(experimentalsys.File, []byte) (int, experimentalsys.Errno) + }{ + {name: "Write", fn: func(f experimentalsys.File, buf []byte) (int, experimentalsys.Errno) { + return f.Write(buf) + }}, + {name: "Pwrite from zero", fn: func(f experimentalsys.File, buf []byte) (int, experimentalsys.Errno) { + return f.Pwrite(buf, 0) + }}, + {name: "Pwrite from 3", fn: func(f experimentalsys.File, buf []byte) (int, experimentalsys.Errno) { + return f.Pwrite(buf, 3) + }}, + } + + var emptyBuf []byte + + for _, tc := range tests { + tc := tc + + t.Run(tc.name, func(t *testing.T) { + n, errno := tc.fn(f, emptyBuf) + require.EqualErrno(t, 0, errno) + require.Zero(t, n) + + // The file should be empty + b, err := os.ReadFile(path) + require.NoError(t, err) + require.Zero(t, len(b)) + }) + } +} + +func TestFileWrite_Unsupported(t *testing.T) { + embedFS, err := fs.Sub(testdata, "testdata") + require.NoError(t, err) + + // Use sys.O_RDWR so that it fails due to type not flags + f, errno := OpenFSFile(&maskFS{embedFS}, wazeroFile, experimentalsys.O_RDWR, 0) + require.EqualErrno(t, 0, errno) + defer f.Close() + + tests := []struct { + name string + fn func(experimentalsys.File, []byte) (int, experimentalsys.Errno) + }{ + {name: "Write", fn: func(f experimentalsys.File, buf []byte) (int, experimentalsys.Errno) { + return f.Write(buf) + }}, + {name: "Pwrite", fn: func(f experimentalsys.File, buf []byte) (int, experimentalsys.Errno) { + return f.Pwrite(buf, 0) + }}, + } + + buf := []byte("wazero") + + for _, tc := range tests { + tc := tc + + t.Run(tc.name, func(t *testing.T) { + _, errno := tc.fn(f, buf) + require.EqualErrno(t, experimentalsys.ENOSYS, errno) + }) + } +} + +func TestFileWrite_Errors(t *testing.T) { + // Create the file + path := path.Join(t.TempDir(), emptyFile) + of, err := os.Create(path) + require.NoError(t, err) + require.NoError(t, of.Close()) + + // Open the file read-only + flag := experimentalsys.O_RDONLY + f := requireOpenFile(t, path, flag, 0o600) + defer f.Close() + buf := []byte("wazero") + + tests := []struct { + name string + fn func(experimentalsys.File) experimentalsys.Errno + }{ + {name: "Write", fn: func(f experimentalsys.File) experimentalsys.Errno { + _, errno := f.Write(buf) + return errno + }}, + {name: "Pwrite", fn: func(f experimentalsys.File) experimentalsys.Errno { + _, errno := f.Pwrite(buf, 0) + return errno + }}, + } + + for _, tc := range tests { + tc := tc + + t.Run(tc.name, func(t *testing.T) { + t.Run("EBADF when not open for writing", func(t *testing.T) { + // The descriptor exists, but not open for writing + errno := tc.fn(f) + require.EqualErrno(t, experimentalsys.EBADF, errno) + }) + testEISDIR(t, tc.fn) + }) + } +} + +func TestFileSync_NoError(t *testing.T) { + testSync_NoError(t, experimentalsys.File.Sync) +} + +func TestFileDatasync_NoError(t *testing.T) { + testSync_NoError(t, experimentalsys.File.Datasync) +} + +func testSync_NoError(t *testing.T, sync func(experimentalsys.File) experimentalsys.Errno) { + roPath := "file_test.go" + ro, errno := OpenFSFile(embedFS, roPath, experimentalsys.O_RDONLY, 0) + require.EqualErrno(t, 0, errno) + defer ro.Close() + + rwPath := path.Join(t.TempDir(), "datasync") + rw, errno := OpenOSFile(rwPath, experimentalsys.O_CREAT|experimentalsys.O_RDWR, 0o600) + require.EqualErrno(t, 0, errno) + defer rw.Close() + + tests := []struct { + name string + f experimentalsys.File + }{ + {name: "UnimplementedFile", f: experimentalsys.UnimplementedFile{}}, + {name: "File of read-only FS.File", f: ro}, + {name: "File of os.File", f: rw}, + } + + for _, tt := range tests { + tc := tt + + t.Run(tc.name, func(t *testing.T) { + require.EqualErrno(t, 0, sync(tc.f)) + }) + } +} + +func TestFileSync(t *testing.T) { + testSync(t, experimentalsys.File.Sync) +} + +func TestFileDatasync(t *testing.T) { + testSync(t, experimentalsys.File.Datasync) +} + +// testSync doesn't guarantee sync works because the operating system may +// sync anyway. There is no test in Go for syscall.Fdatasync, but closest is +// similar to below. Effectively, this only tests that things don't error. +func testSync(t *testing.T, sync func(experimentalsys.File) experimentalsys.Errno) { + // Even though it is invalid, try to sync a directory + dPath := t.TempDir() + d := requireOpenFile(t, dPath, experimentalsys.O_RDONLY, 0) + defer d.Close() + + errno := sync(d) + require.EqualErrno(t, 0, errno) + + fPath := path.Join(dPath, t.Name()) + + f := requireOpenFile(t, fPath, experimentalsys.O_RDWR|experimentalsys.O_CREAT, 0o600) + defer f.Close() + + expected := "hello world!" + + // Write the expected data + _, errno = f.Write([]byte(expected)) + require.EqualErrno(t, 0, errno) + + // Sync the data. + errno = sync(f) + require.EqualErrno(t, 0, errno) + + // Rewind while the file is still open. + _, errno = f.Seek(0, io.SeekStart) + require.EqualErrno(t, 0, errno) + + // Read data from the file + buf := make([]byte, 50) + n, errno := f.Read(buf) + require.EqualErrno(t, 0, errno) + + // It may be the case that sync worked. + require.Equal(t, expected, string(buf[:n])) + + // Windows allows you to sync a closed file + if runtime.GOOS != "windows" { + testEBADFIfFileClosed(t, sync) + testEBADFIfDirClosed(t, sync) + } +} + +func TestFileTruncate(t *testing.T) { + content := []byte("123456") + + tests := []struct { + name string + size int64 + expectedContent []byte + expectedErr error + }{ + { + name: "one less", + size: 5, + expectedContent: []byte("12345"), + }, + { + name: "same", + size: 6, + expectedContent: content, + }, + { + name: "zero", + size: 0, + expectedContent: []byte(""), + }, + { + name: "larger", + size: 106, + expectedContent: append(content, make([]byte, 100)...), + }, + } + + for _, tt := range tests { + tc := tt + t.Run(tc.name, func(t *testing.T) { + tmpDir := t.TempDir() + + fPath := path.Join(tmpDir, tc.name) + f := openForWrite(t, fPath, content) + defer f.Close() + + errno := f.Truncate(tc.size) + require.EqualErrno(t, 0, errno) + + actual, err := os.ReadFile(fPath) + require.NoError(t, err) + require.Equal(t, tc.expectedContent, actual) + }) + } + + truncateToZero := func(f experimentalsys.File) experimentalsys.Errno { + return f.Truncate(0) + } + + if runtime.GOOS != "windows" { + // TODO: os.Truncate on windows passes even when closed + testEBADFIfFileClosed(t, truncateToZero) + } + + testEISDIR(t, truncateToZero) + + t.Run("negative", func(t *testing.T) { + tmpDir := t.TempDir() + + f := openForWrite(t, path.Join(tmpDir, "truncate"), content) + defer f.Close() + + errno := f.Truncate(-1) + require.EqualErrno(t, experimentalsys.EINVAL, errno) + }) +} + +func TestFileUtimens(t *testing.T) { + switch runtime.GOOS { + case "linux", "darwin": // supported + case "freebsd": // TODO: support freebsd w/o CGO + case "windows": + if !platform.IsAtLeastGo120 { + t.Skip("windows only works after Go 1.20") // TODO: possibly 1.19 ;) + } + default: // expect ENOSYS and callers need to fall back to Utimens + t.Skip("unsupported GOOS", runtime.GOOS) + } + + testUtimens(t, true) + + testEBADFIfFileClosed(t, func(f experimentalsys.File) experimentalsys.Errno { + return f.Utimens(experimentalsys.UTIME_OMIT, experimentalsys.UTIME_OMIT) + }) + testEBADFIfDirClosed(t, func(d experimentalsys.File) experimentalsys.Errno { + return d.Utimens(experimentalsys.UTIME_OMIT, experimentalsys.UTIME_OMIT) + }) +} + +func TestNewStdioFile(t *testing.T) { + // simulate regular file attached to stdin + f, err := os.CreateTemp(t.TempDir(), "somefile") + require.NoError(t, err) + defer f.Close() + + stdin, err := NewStdioFile(true, os.Stdin) + require.NoError(t, err) + stdinStat, err := os.Stdin.Stat() + require.NoError(t, err) + + stdinFile, err := NewStdioFile(true, f) + require.NoError(t, err) + + stdout, err := NewStdioFile(false, os.Stdout) + require.NoError(t, err) + stdoutStat, err := os.Stdout.Stat() + require.NoError(t, err) + + stdoutFile, err := NewStdioFile(false, f) + require.NoError(t, err) + + tests := []struct { + name string + f experimentalsys.File + // Depending on how the tests run, os.Stdin won't necessarily be a char + // device. We compare against an os.File, to account for this. + expectedType fs.FileMode + }{ + { + name: "stdin", + f: stdin, + expectedType: stdinStat.Mode().Type(), + }, + { + name: "stdin file", + f: stdinFile, + expectedType: 0, // normal file + }, + { + name: "stdout", + f: stdout, + expectedType: stdoutStat.Mode().Type(), + }, + { + name: "stdout file", + f: stdoutFile, + expectedType: 0, // normal file + }, + } + + for _, tt := range tests { + tc := tt + + t.Run(tc.name+" Stat", func(t *testing.T) { + st, errno := tc.f.Stat() + require.EqualErrno(t, 0, errno) + require.Equal(t, tc.expectedType, st.Mode&fs.ModeType) + require.Equal(t, uint64(1), st.Nlink) + + // Fake times are needed to pass wasi-testsuite. + // See https://github.com/WebAssembly/wasi-testsuite/blob/af57727/tests/rust/src/bin/fd_filestat_get.rs#L1-L19 + require.Zero(t, st.Ctim) + require.Zero(t, st.Mtim) + require.Zero(t, st.Atim) + }) + } +} + +func testEBADFIfDirClosed(t *testing.T, fn func(experimentalsys.File) experimentalsys.Errno) bool { + return t.Run("EBADF if dir closed", func(t *testing.T) { + d := requireOpenFile(t, t.TempDir(), experimentalsys.O_RDONLY, 0o755) + + // close the directory underneath + require.EqualErrno(t, 0, d.Close()) + + require.EqualErrno(t, experimentalsys.EBADF, fn(d)) + }) +} + +func testEBADFIfFileClosed(t *testing.T, fn func(experimentalsys.File) experimentalsys.Errno) bool { + return t.Run("EBADF if file closed", func(t *testing.T) { + tmpDir := t.TempDir() + + f := openForWrite(t, path.Join(tmpDir, "EBADF"), []byte{1, 2, 3, 4}) + + // close the file underneath + require.EqualErrno(t, 0, f.Close()) + + require.EqualErrno(t, experimentalsys.EBADF, fn(f)) + }) +} + +func testEISDIR(t *testing.T, fn func(experimentalsys.File) experimentalsys.Errno) bool { + return t.Run("EISDIR if directory", func(t *testing.T) { + f := requireOpenFile(t, os.TempDir(), experimentalsys.O_RDONLY|experimentalsys.O_DIRECTORY, 0o666) + defer f.Close() + + require.EqualErrno(t, experimentalsys.EISDIR, fn(f)) + }) +} + +func openForWrite(t *testing.T, path string, content []byte) experimentalsys.File { + require.NoError(t, os.WriteFile(path, content, 0o0666)) + f := requireOpenFile(t, path, experimentalsys.O_RDWR, 0o666) + _, errno := f.Write(content) + require.EqualErrno(t, 0, errno) + return f +} + +func requireOpenFile(t *testing.T, path string, flag experimentalsys.Oflag, perm fs.FileMode) experimentalsys.File { + f, errno := OpenOSFile(path, flag, perm) + require.EqualErrno(t, 0, errno) + return f +} + +func dirEmbedMapFS(t *testing.T, tmpDir string) (fs.FS, fs.FS, fs.FS) { + embedFS, err := fs.Sub(testdata, "testdata") + require.NoError(t, err) + + f, err := embedFS.Open(wazeroFile) + require.NoError(t, err) + defer f.Close() + + bytes, err := io.ReadAll(f) + require.NoError(t, err) + + mapFS := gofstest.MapFS{ + emptyFile: &gofstest.MapFile{}, + wazeroFile: &gofstest.MapFile{Data: bytes}, + } + + // Write a file as can't open "testdata" in scratch tests because they + // can't read the original filesystem. + require.NoError(t, os.WriteFile(path.Join(tmpDir, emptyFile), nil, 0o600)) + require.NoError(t, os.WriteFile(path.Join(tmpDir, wazeroFile), bytes, 0o600)) + dirFS := os.DirFS(tmpDir) + return dirFS, embedFS, mapFS +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/file_unix.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/file_unix.go new file mode 100644 index 000000000..92eaf3542 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/file_unix.go @@ -0,0 +1,39 @@ +//go:build unix + +package sysfs + +import ( + "syscall" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +const ( + nonBlockingFileReadSupported = true + nonBlockingFileWriteSupported = true +) + +func rmdir(path string) sys.Errno { + err := syscall.Rmdir(path) + return sys.UnwrapOSError(err) +} + +// readFd exposes syscall.Read. +func readFd(fd uintptr, buf []byte) (int, sys.Errno) { + if len(buf) == 0 { + return 0, 0 // Short-circuit 0-len reads. + } + n, err := syscall.Read(int(fd), buf) + errno := sys.UnwrapOSError(err) + return n, errno +} + +// writeFd exposes syscall.Write. +func writeFd(fd uintptr, buf []byte) (int, sys.Errno) { + if len(buf) == 0 { + return 0, 0 // Short-circuit 0-len writes. + } + n, err := syscall.Write(int(fd), buf) + errno := sys.UnwrapOSError(err) + return n, errno +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/file_unsupported.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/file_unsupported.go new file mode 100644 index 000000000..e74a8e4dd --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/file_unsupported.go @@ -0,0 +1,28 @@ +//go:build !unix && !windows + +package sysfs + +import ( + "os" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +const ( + nonBlockingFileReadSupported = false + nonBlockingFileWriteSupported = false +) + +func rmdir(path string) sys.Errno { + return sys.UnwrapOSError(os.Remove(path)) +} + +// readFd returns ENOSYS on unsupported platforms. +func readFd(fd uintptr, buf []byte) (int, sys.Errno) { + return -1, sys.ENOSYS +} + +// writeFd returns ENOSYS on unsupported platforms. +func writeFd(fd uintptr, buf []byte) (int, sys.Errno) { + return -1, sys.ENOSYS +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/file_windows.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/file_windows.go new file mode 100644 index 000000000..3ad9648e6 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/file_windows.go @@ -0,0 +1,88 @@ +package sysfs + +import ( + "syscall" + "unsafe" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +const ( + nonBlockingFileReadSupported = true + nonBlockingFileWriteSupported = false +) + +var kernel32 = syscall.NewLazyDLL("kernel32.dll") + +// procPeekNamedPipe is the syscall.LazyProc in kernel32 for PeekNamedPipe +var procPeekNamedPipe = kernel32.NewProc("PeekNamedPipe") + +// readFd returns ENOSYS on unsupported platforms. +// +// PeekNamedPipe: https://learn.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-peeknamedpipe +// "GetFileType can assist in determining what device type the handle refers to. A console handle presents as FILE_TYPE_CHAR." +// https://learn.microsoft.com/en-us/windows/console/console-handles +func readFd(fd uintptr, buf []byte) (int, sys.Errno) { + handle := syscall.Handle(fd) + fileType, err := syscall.GetFileType(handle) + if err != nil { + return 0, sys.UnwrapOSError(err) + } + if fileType&syscall.FILE_TYPE_CHAR == 0 { + return -1, sys.ENOSYS + } + n, errno := peekNamedPipe(handle) + if errno == syscall.ERROR_BROKEN_PIPE { + return 0, 0 + } + if n == 0 { + return -1, sys.EAGAIN + } + un, err := syscall.Read(handle, buf[0:n]) + return un, sys.UnwrapOSError(err) +} + +func writeFd(fd uintptr, buf []byte) (int, sys.Errno) { + return -1, sys.ENOSYS +} + +func readSocket(h syscall.Handle, buf []byte) (int, sys.Errno) { + var overlapped syscall.Overlapped + var done uint32 + errno := syscall.ReadFile(h, buf, &done, &overlapped) + if errno == syscall.ERROR_IO_PENDING { + errno = sys.EAGAIN + } + return int(done), sys.UnwrapOSError(errno) +} + +func writeSocket(fd uintptr, buf []byte) (int, sys.Errno) { + var done uint32 + var overlapped syscall.Overlapped + errno := syscall.WriteFile(syscall.Handle(fd), buf, &done, &overlapped) + if errno == syscall.ERROR_IO_PENDING { + errno = syscall.EAGAIN + } + return int(done), sys.UnwrapOSError(errno) +} + +// peekNamedPipe partially exposes PeekNamedPipe from the Win32 API +// see https://learn.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-peeknamedpipe +func peekNamedPipe(handle syscall.Handle) (uint32, syscall.Errno) { + var totalBytesAvail uint32 + totalBytesPtr := unsafe.Pointer(&totalBytesAvail) + _, _, errno := syscall.SyscallN( + procPeekNamedPipe.Addr(), + uintptr(handle), // [in] HANDLE hNamedPipe, + 0, // [out, optional] LPVOID lpBuffer, + 0, // [in] DWORD nBufferSize, + 0, // [out, optional] LPDWORD lpBytesRead + uintptr(totalBytesPtr), // [out, optional] LPDWORD lpTotalBytesAvail, + 0) // [out, optional] LPDWORD lpBytesLeftThisMessage + return totalBytesAvail, errno +} + +func rmdir(path string) sys.Errno { + err := syscall.Rmdir(path) + return sys.UnwrapOSError(err) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens.go new file mode 100644 index 000000000..1f670ca11 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens.go @@ -0,0 +1,37 @@ +//go:build linux || darwin + +package sysfs + +import ( + "syscall" + "unsafe" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +func timesToPtr(times *[2]syscall.Timespec) unsafe.Pointer { //nolint:unused + if times != nil { + return unsafe.Pointer(×[0]) + } + return unsafe.Pointer(nil) +} + +func timesToTimespecs(atim int64, mtim int64) (times *[2]syscall.Timespec) { + // When both inputs are omitted, there is nothing to change. + if atim == sys.UTIME_OMIT && mtim == sys.UTIME_OMIT { + return + } + + times = &[2]syscall.Timespec{} + if atim == sys.UTIME_OMIT { + times[0] = syscall.Timespec{Nsec: _UTIME_OMIT} + times[1] = syscall.NsecToTimespec(mtim) + } else if mtim == sys.UTIME_OMIT { + times[0] = syscall.NsecToTimespec(atim) + times[1] = syscall.Timespec{Nsec: _UTIME_OMIT} + } else { + times[0] = syscall.NsecToTimespec(atim) + times[1] = syscall.NsecToTimespec(mtim) + } + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_darwin.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_darwin.go new file mode 100644 index 000000000..88e4008f0 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_darwin.go @@ -0,0 +1,51 @@ +package sysfs + +import ( + "syscall" + _ "unsafe" + + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" +) + +const ( + _AT_FDCWD = -0x2 + _AT_SYMLINK_NOFOLLOW = 0x0020 + _UTIME_OMIT = -2 +) + +//go:noescape +//go:linkname utimensat syscall.utimensat +func utimensat(dirfd int, path string, times *[2]syscall.Timespec, flags int) error + +func utimens(path string, atim, mtim int64) experimentalsys.Errno { + times := timesToTimespecs(atim, mtim) + if times == nil { + return 0 + } + var flags int + return experimentalsys.UnwrapOSError(utimensat(_AT_FDCWD, path, times, flags)) +} + +func futimens(fd uintptr, atim, mtim int64) experimentalsys.Errno { + times := timesToTimespecs(atim, mtim) + if times == nil { + return 0 + } + _p0 := timesToPtr(times) + + // Warning: futimens only exists since High Sierra (10.13). + _, _, e1 := syscall_syscall6(libc_futimens_trampoline_addr, fd, uintptr(_p0), 0, 0, 0, 0) + return experimentalsys.UnwrapOSError(e1) +} + +// libc_futimens_trampoline_addr is the address of the +// `libc_futimens_trampoline` symbol, defined in `futimens_darwin.s`. +// +// We use this to invoke the syscall through syscall_syscall6 imported below. +var libc_futimens_trampoline_addr uintptr + +// Imports the futimens symbol from libc as `libc_futimens`. +// +// Note: CGO mechanisms are used in darwin regardless of the CGO_ENABLED value +// or the "cgo" build flag. See /RATIONALE.md for why. +//go:cgo_import_dynamic libc_futimens futimens "/usr/lib/libSystem.B.dylib" diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_darwin.s b/vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_darwin.s new file mode 100644 index 000000000..b86aecdf0 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_darwin.s @@ -0,0 +1,8 @@ +// lifted from golang.org/x/sys unix +#include "textflag.h" + +TEXT libc_futimens_trampoline<>(SB), NOSPLIT, $0-0 + JMP libc_futimens(SB) + +GLOBL Ā·libc_futimens_trampoline_addr(SB), RODATA, $8 +DATA Ā·libc_futimens_trampoline_addr(SB)/8, $libc_futimens_trampoline<>(SB) diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_linux.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_linux.go new file mode 100644 index 000000000..3ec68537b --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_linux.go @@ -0,0 +1,47 @@ +package sysfs + +import ( + "syscall" + "unsafe" + _ "unsafe" + + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" +) + +const ( + _AT_FDCWD = -0x64 + _UTIME_OMIT = (1 << 30) - 2 +) + +func utimens(path string, atim, mtim int64) experimentalsys.Errno { + times := timesToTimespecs(atim, mtim) + if times == nil { + return 0 + } + + var flags int + var _p0 *byte + _p0, err := syscall.BytePtrFromString(path) + if err == nil { + err = utimensat(_AT_FDCWD, uintptr(unsafe.Pointer(_p0)), times, flags) + } + return experimentalsys.UnwrapOSError(err) +} + +// On linux, implement futimens via utimensat with the NUL path. +func futimens(fd uintptr, atim, mtim int64) experimentalsys.Errno { + times := timesToTimespecs(atim, mtim) + if times == nil { + return 0 + } + return experimentalsys.UnwrapOSError(utimensat(int(fd), 0 /* NUL */, times, 0)) +} + +// utimensat is like syscall.utimensat special-cased to accept a NUL string for the path value. +func utimensat(dirfd int, strPtr uintptr, times *[2]syscall.Timespec, flags int) (err error) { + _, _, e1 := syscall.Syscall6(syscall.SYS_UTIMENSAT, uintptr(dirfd), strPtr, uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) + if e1 != 0 { + err = e1 + } + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_unsupported.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_unsupported.go new file mode 100644 index 000000000..c78a16b40 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_unsupported.go @@ -0,0 +1,18 @@ +//go:build !windows && !linux && !darwin + +package sysfs + +import ( + "github.com/tetratelabs/wazero/experimental/sys" +) + +func utimens(path string, atim, mtim int64) sys.Errno { + return chtimes(path, atim, mtim) +} + +func futimens(fd uintptr, atim, mtim int64) error { + // Go exports syscall.Futimes, which is microsecond granularity, and + // WASI tests expect nanosecond. We don't yet have a way to invoke the + // futimens syscall portably. + return sys.ENOSYS +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_windows.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_windows.go new file mode 100644 index 000000000..3a5289b70 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_windows.go @@ -0,0 +1,49 @@ +package sysfs + +import ( + "syscall" + + "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/platform" +) + +func utimens(path string, atim, mtim int64) sys.Errno { + return chtimes(path, atim, mtim) +} + +func futimens(fd uintptr, atim, mtim int64) error { + // Before Go 1.20, ERROR_INVALID_HANDLE was returned for too many reasons. + // Kick out so that callers can use path-based operations instead. + if !platform.IsAtLeastGo120 { + return sys.ENOSYS + } + + // Per docs, zero isn't a valid timestamp as it cannot be differentiated + // from nil. In both cases, it is a marker like sys.UTIME_OMIT. + // See https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-setfiletime + a, w := timespecToFiletime(atim, mtim) + + if a == nil && w == nil { + return nil // both omitted, so nothing to change + } + + // Attempt to get the stat by handle, which works for normal files + h := syscall.Handle(fd) + + // Note: This returns ERROR_ACCESS_DENIED when the input is a directory. + return syscall.SetFileTime(h, nil, a, w) +} + +func timespecToFiletime(atim, mtim int64) (a, w *syscall.Filetime) { + a = timespecToFileTime(atim) + w = timespecToFileTime(mtim) + return +} + +func timespecToFileTime(tim int64) *syscall.Filetime { + if tim == sys.UTIME_OMIT { + return nil + } + ft := syscall.NsecToFiletime(tim) + return &ft +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/ino.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/ino.go new file mode 100644 index 000000000..703f11366 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/ino.go @@ -0,0 +1,22 @@ +//go:build !windows && !plan9 + +package sysfs + +import ( + "io/fs" + "syscall" + + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/sys" +) + +func inoFromFileInfo(_ string, info fs.FileInfo) (sys.Inode, experimentalsys.Errno) { + switch v := info.Sys().(type) { + case *sys.Stat_t: + return v.Ino, 0 + case *syscall.Stat_t: + return v.Ino, 0 + default: + return 0, 0 + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/ino_plan9.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/ino_plan9.go new file mode 100644 index 000000000..9c669a475 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/ino_plan9.go @@ -0,0 +1,15 @@ +package sysfs + +import ( + "io/fs" + + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/sys" +) + +func inoFromFileInfo(_ string, info fs.FileInfo) (sys.Inode, experimentalsys.Errno) { + if v, ok := info.Sys().(*sys.Stat_t); ok { + return v.Ino, 0 + } + return 0, 0 +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/ino_windows.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/ino_windows.go new file mode 100644 index 000000000..d163b3601 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/ino_windows.go @@ -0,0 +1,28 @@ +package sysfs + +import ( + "io/fs" + "path" + + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/sys" +) + +// inoFromFileInfo uses stat to get the inode information of the file. +func inoFromFileInfo(dirPath string, info fs.FileInfo) (ino sys.Inode, errno experimentalsys.Errno) { + if v, ok := info.Sys().(*sys.Stat_t); ok { + return v.Ino, 0 + } + if dirPath == "" { + // This is a FS.File backed implementation which doesn't have access to + // the original file path. + return + } + // Ino is no not in Win32FileAttributeData + inoPath := path.Clean(path.Join(dirPath, info.Name())) + var st sys.Stat_t + if st, errno = lstat(inoPath); errno == 0 { + ino = st.Ino + } + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/nonblock_plan9.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/nonblock_plan9.go new file mode 100644 index 000000000..8e94e5922 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/nonblock_plan9.go @@ -0,0 +1,11 @@ +package sysfs + +import "github.com/tetratelabs/wazero/experimental/sys" + +func setNonblock(fd uintptr, enable bool) sys.Errno { + return sys.ENOSYS +} + +func isNonblock(f *osFile) bool { + return false +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/nonblock_unix.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/nonblock_unix.go new file mode 100644 index 000000000..07fb15cf1 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/nonblock_unix.go @@ -0,0 +1,17 @@ +//go:build !windows && !plan9 + +package sysfs + +import ( + "syscall" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +func setNonblock(fd uintptr, enable bool) sys.Errno { + return sys.UnwrapOSError(syscall.SetNonblock(int(fd), enable)) +} + +func isNonblock(f *osFile) bool { + return f.flag&sys.O_NONBLOCK == sys.O_NONBLOCK +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/nonblock_windows.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/nonblock_windows.go new file mode 100644 index 000000000..eb38ea5af --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/nonblock_windows.go @@ -0,0 +1,23 @@ +package sysfs + +import ( + "io/fs" + "syscall" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +func setNonblock(fd uintptr, enable bool) sys.Errno { + // We invoke the syscall, but this is currently no-op. + return sys.UnwrapOSError(syscall.SetNonblock(syscall.Handle(fd), enable)) +} + +func isNonblock(f *osFile) bool { + // On Windows, we support non-blocking reads only on named pipes. + isValid := false + st, errno := f.Stat() + if errno == 0 { + isValid = st.Mode&fs.ModeNamedPipe != 0 + } + return isValid && f.flag&sys.O_NONBLOCK == sys.O_NONBLOCK +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/oflag.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/oflag.go new file mode 100644 index 000000000..be6d2c35f --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/oflag.go @@ -0,0 +1,38 @@ +package sysfs + +import ( + "os" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +// toOsOpenFlag converts the input to the flag parameter of os.OpenFile +func toOsOpenFlag(oflag sys.Oflag) (flag int) { + // First flags are exclusive + switch oflag & (sys.O_RDONLY | sys.O_RDWR | sys.O_WRONLY) { + case sys.O_RDONLY: + flag |= os.O_RDONLY + case sys.O_RDWR: + flag |= os.O_RDWR + case sys.O_WRONLY: + flag |= os.O_WRONLY + } + + // Run down the flags defined in the os package + if oflag&sys.O_APPEND != 0 { + flag |= os.O_APPEND + } + if oflag&sys.O_CREAT != 0 { + flag |= os.O_CREATE + } + if oflag&sys.O_EXCL != 0 { + flag |= os.O_EXCL + } + if oflag&sys.O_SYNC != 0 { + flag |= os.O_SYNC + } + if oflag&sys.O_TRUNC != 0 { + flag |= os.O_TRUNC + } + return withSyscallOflag(oflag, flag) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_darwin.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_darwin.go new file mode 100644 index 000000000..a4f54ca2c --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_darwin.go @@ -0,0 +1,26 @@ +package sysfs + +import ( + "syscall" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +const supportedSyscallOflag = sys.O_DIRECTORY | sys.O_DSYNC | sys.O_NOFOLLOW | sys.O_NONBLOCK + +func withSyscallOflag(oflag sys.Oflag, flag int) int { + if oflag&sys.O_DIRECTORY != 0 { + flag |= syscall.O_DIRECTORY + } + if oflag&sys.O_DSYNC != 0 { + flag |= syscall.O_DSYNC + } + if oflag&sys.O_NOFOLLOW != 0 { + flag |= syscall.O_NOFOLLOW + } + if oflag&sys.O_NONBLOCK != 0 { + flag |= syscall.O_NONBLOCK + } + // syscall.O_RSYNC not defined on darwin + return flag +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_freebsd.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_freebsd.go new file mode 100644 index 000000000..42adaa214 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_freebsd.go @@ -0,0 +1,24 @@ +package sysfs + +import ( + "syscall" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +const supportedSyscallOflag = sys.O_DIRECTORY | sys.O_NOFOLLOW | sys.O_NONBLOCK + +func withSyscallOflag(oflag sys.Oflag, flag int) int { + if oflag&sys.O_DIRECTORY != 0 { + flag |= syscall.O_DIRECTORY + } + // syscall.O_DSYNC not defined on darwin + if oflag&sys.O_NOFOLLOW != 0 { + flag |= syscall.O_NOFOLLOW + } + if oflag&sys.O_NONBLOCK != 0 { + flag |= syscall.O_NONBLOCK + } + // syscall.O_RSYNC not defined on darwin + return flag +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_linux.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_linux.go new file mode 100644 index 000000000..7f4915480 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_linux.go @@ -0,0 +1,28 @@ +package sysfs + +import ( + "syscall" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +const supportedSyscallOflag = sys.O_DIRECTORY | sys.O_DSYNC | sys.O_NOFOLLOW | sys.O_NONBLOCK | sys.O_RSYNC + +func withSyscallOflag(oflag sys.Oflag, flag int) int { + if oflag&sys.O_DIRECTORY != 0 { + flag |= syscall.O_DIRECTORY + } + if oflag&sys.O_DSYNC != 0 { + flag |= syscall.O_DSYNC + } + if oflag&sys.O_NOFOLLOW != 0 { + flag |= syscall.O_NOFOLLOW + } + if oflag&sys.O_NONBLOCK != 0 { + flag |= syscall.O_NONBLOCK + } + if oflag&sys.O_RSYNC != 0 { + flag |= syscall.O_RSYNC + } + return flag +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_notwindows.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_notwindows.go new file mode 100644 index 000000000..9ae1e2bcd --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_notwindows.go @@ -0,0 +1,20 @@ +//go:build !windows + +package sysfs + +import ( + "io/fs" + "os" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +// openFile is like os.OpenFile except it accepts a sys.Oflag and returns +// sys.Errno. A zero sys.Errno is success. +func openFile(path string, oflag sys.Oflag, perm fs.FileMode) (*os.File, sys.Errno) { + f, err := os.OpenFile(path, toOsOpenFlag(oflag), perm) + // Note: This does not return a sys.File because sys.FS that returns + // one may want to hide the real OS path. For example, this is needed for + // pre-opens. + return f, sys.UnwrapOSError(err) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_sun.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_sun.go new file mode 100644 index 000000000..bdf7dd84d --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_sun.go @@ -0,0 +1,31 @@ +//go:build illumos || solaris + +package sysfs + +import ( + "syscall" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +const supportedSyscallOflag = sys.O_DIRECTORY | sys.O_DSYNC | sys.O_NOFOLLOW | sys.O_NONBLOCK | sys.O_RSYNC + +func withSyscallOflag(oflag sys.Oflag, flag int) int { + if oflag&sys.O_DIRECTORY != 0 { + // See https://github.com/illumos/illumos-gate/blob/edd580643f2cf1434e252cd7779e83182ea84945/usr/src/uts/common/sys/fcntl.h#L90 + flag |= 0x1000000 + } + if oflag&sys.O_DSYNC != 0 { + flag |= syscall.O_DSYNC + } + if oflag&sys.O_NOFOLLOW != 0 { + flag |= syscall.O_NOFOLLOW + } + if oflag&sys.O_NONBLOCK != 0 { + flag |= syscall.O_NONBLOCK + } + if oflag&sys.O_RSYNC != 0 { + flag |= syscall.O_RSYNC + } + return flag +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_unsupported.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_unsupported.go new file mode 100644 index 000000000..9f7a6d088 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_unsupported.go @@ -0,0 +1,18 @@ +//go:build !darwin && !linux && !windows && !illumos && !solaris && !freebsd + +package sysfs + +import ( + "github.com/tetratelabs/wazero/experimental/sys" +) + +const supportedSyscallOflag = sys.Oflag(0) + +func withSyscallOflag(oflag sys.Oflag, flag int) int { + // O_DIRECTORY not defined + // O_DSYNC not defined + // O_NOFOLLOW not defined + // O_NONBLOCK not defined + // O_RSYNC not defined + return flag +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_windows.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_windows.go new file mode 100644 index 000000000..bcfbfbcd6 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/open_file_windows.go @@ -0,0 +1,164 @@ +package sysfs + +import ( + "io/fs" + "os" + "strings" + "syscall" + "unsafe" + + "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/platform" +) + +func openFile(path string, oflag sys.Oflag, perm fs.FileMode) (*os.File, sys.Errno) { + isDir := oflag&sys.O_DIRECTORY > 0 + flag := toOsOpenFlag(oflag) + + // TODO: document why we are opening twice + fd, err := open(path, flag|syscall.O_CLOEXEC, uint32(perm)) + if err == nil { + return os.NewFile(uintptr(fd), path), 0 + } + + // TODO: Set FILE_SHARE_DELETE for directory as well. + f, err := os.OpenFile(path, flag, perm) + errno := sys.UnwrapOSError(err) + if errno == 0 { + return f, 0 + } + + switch errno { + case sys.EINVAL: + // WASI expects ENOTDIR for a file path with a trailing slash. + if strings.HasSuffix(path, "/") { + errno = sys.ENOTDIR + } + // To match expectations of WASI, e.g. TinyGo TestStatBadDir, return + // ENOENT, not ENOTDIR. + case sys.ENOTDIR: + errno = sys.ENOENT + case sys.ENOENT: + if isSymlink(path) { + // Either symlink or hard link not found. We change the returned + // errno depending on if it is symlink or not to have consistent + // behavior across OSes. + if isDir { + // Dangling symlink dir must raise ENOTDIR. + errno = sys.ENOTDIR + } else { + errno = sys.ELOOP + } + } + } + return f, errno +} + +const supportedSyscallOflag = sys.O_NONBLOCK + +// Map to synthetic values here https://github.com/golang/go/blob/go1.20/src/syscall/types_windows.go#L34-L48 +func withSyscallOflag(oflag sys.Oflag, flag int) int { + // O_DIRECTORY not defined in windows + // O_DSYNC not defined in windows + // O_NOFOLLOW not defined in windows + if oflag&sys.O_NONBLOCK != 0 { + flag |= syscall.O_NONBLOCK + } + // O_RSYNC not defined in windows + return flag +} + +func isSymlink(path string) bool { + if st, e := os.Lstat(path); e == nil && st.Mode()&os.ModeSymlink != 0 { + return true + } + return false +} + +// # Differences from syscall.Open +// +// This code is based on syscall.Open from the below link with some differences +// https://github.com/golang/go/blame/go1.20/src/syscall/syscall_windows.go#L308-L379 +// +// - syscall.O_CREAT doesn't imply syscall.GENERIC_WRITE as that breaks +// flag expectations in wasi. +// - add support for setting FILE_SHARE_DELETE. +func open(path string, mode int, perm uint32) (fd syscall.Handle, err error) { + if len(path) == 0 { + return syscall.InvalidHandle, syscall.ERROR_FILE_NOT_FOUND + } + pathp, err := syscall.UTF16PtrFromString(path) + if err != nil { + return syscall.InvalidHandle, err + } + var access uint32 + switch mode & (syscall.O_RDONLY | syscall.O_WRONLY | syscall.O_RDWR) { + case syscall.O_RDONLY: + access = syscall.GENERIC_READ + case syscall.O_WRONLY: + access = syscall.GENERIC_WRITE + case syscall.O_RDWR: + access = syscall.GENERIC_READ | syscall.GENERIC_WRITE + } + if mode&syscall.O_APPEND != 0 { + access &^= syscall.GENERIC_WRITE + access |= syscall.FILE_APPEND_DATA + } + sharemode := uint32(syscall.FILE_SHARE_READ | syscall.FILE_SHARE_WRITE | syscall.FILE_SHARE_DELETE) + var sa *syscall.SecurityAttributes + if mode&syscall.O_CLOEXEC == 0 { + var _sa syscall.SecurityAttributes + _sa.Length = uint32(unsafe.Sizeof(sa)) + _sa.InheritHandle = 1 + sa = &_sa + } + var createmode uint32 + switch { + case mode&(syscall.O_CREAT|syscall.O_EXCL) == (syscall.O_CREAT | syscall.O_EXCL): + createmode = syscall.CREATE_NEW + case mode&(syscall.O_CREAT|syscall.O_TRUNC) == (syscall.O_CREAT | syscall.O_TRUNC): + createmode = syscall.CREATE_ALWAYS + case mode&syscall.O_CREAT == syscall.O_CREAT: + createmode = syscall.OPEN_ALWAYS + case mode&syscall.O_TRUNC == syscall.O_TRUNC: + createmode = syscall.TRUNCATE_EXISTING + default: + createmode = syscall.OPEN_EXISTING + } + var attrs uint32 = syscall.FILE_ATTRIBUTE_NORMAL + if perm&syscall.S_IWRITE == 0 { + attrs = syscall.FILE_ATTRIBUTE_READONLY + if createmode == syscall.CREATE_ALWAYS { + // We have been asked to create a read-only file. + // If the file already exists, the semantics of + // the Unix open system call is to preserve the + // existing permissions. If we pass CREATE_ALWAYS + // and FILE_ATTRIBUTE_READONLY to CreateFile, + // and the file already exists, CreateFile will + // change the file permissions. + // Avoid that to preserve the Unix semantics. + h, e := syscall.CreateFile(pathp, access, sharemode, sa, syscall.TRUNCATE_EXISTING, syscall.FILE_ATTRIBUTE_NORMAL, 0) + switch e { + case syscall.ERROR_FILE_NOT_FOUND, syscall.ERROR_PATH_NOT_FOUND: + // File does not exist. These are the same + // errors as Errno.Is checks for ErrNotExist. + // Carry on to create the file. + default: + // Success or some different error. + return h, e + } + } + } + + if platform.IsAtLeastGo120 { + // This shouldn't be included before 1.20 to have consistent behavior. + // https://github.com/golang/go/commit/0f0aa5d8a6a0253627d58b3aa083b24a1091933f + if createmode == syscall.OPEN_EXISTING && access == syscall.GENERIC_READ { + // Necessary for opening directory handles. + attrs |= syscall.FILE_FLAG_BACKUP_SEMANTICS + } + } + + h, e := syscall.CreateFile(pathp, access, sharemode, sa, createmode, attrs, 0) + return h, e +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/osfile.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/osfile.go new file mode 100644 index 000000000..a28ee6bb5 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/osfile.go @@ -0,0 +1,295 @@ +package sysfs + +import ( + "io" + "io/fs" + "os" + "runtime" + + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/fsapi" + "github.com/tetratelabs/wazero/sys" +) + +func newOsFile(path string, flag experimentalsys.Oflag, perm fs.FileMode, f *os.File) fsapi.File { + // Windows cannot read files written to a directory after it was opened. + // This was noticed in #1087 in zig tests. Use a flag instead of a + // different type. + reopenDir := runtime.GOOS == "windows" + return &osFile{path: path, flag: flag, perm: perm, reopenDir: reopenDir, file: f, fd: f.Fd()} +} + +// osFile is a file opened with this package, and uses os.File or syscalls to +// implement api.File. +type osFile struct { + path string + flag experimentalsys.Oflag + perm fs.FileMode + file *os.File + fd uintptr + + // reopenDir is true if reopen should be called before Readdir. This flag + // is deferred until Readdir to prevent redundant rewinds. This could + // happen if Seek(0) was called twice, or if in Windows, Seek(0) was called + // before Readdir. + reopenDir bool + + // closed is true when closed was called. This ensures proper sys.EBADF + closed bool + + // cachedStat includes fields that won't change while a file is open. + cachedSt *cachedStat +} + +// cachedStat returns the cacheable parts of sys.Stat_t or an error if they +// couldn't be retrieved. +func (f *osFile) cachedStat() (dev uint64, ino sys.Inode, isDir bool, errno experimentalsys.Errno) { + if f.cachedSt == nil { + if _, errno = f.Stat(); errno != 0 { + return + } + } + return f.cachedSt.dev, f.cachedSt.ino, f.cachedSt.isDir, 0 +} + +// Dev implements the same method as documented on sys.File +func (f *osFile) Dev() (uint64, experimentalsys.Errno) { + dev, _, _, errno := f.cachedStat() + return dev, errno +} + +// Ino implements the same method as documented on sys.File +func (f *osFile) Ino() (sys.Inode, experimentalsys.Errno) { + _, ino, _, errno := f.cachedStat() + return ino, errno +} + +// IsDir implements the same method as documented on sys.File +func (f *osFile) IsDir() (bool, experimentalsys.Errno) { + _, _, isDir, errno := f.cachedStat() + return isDir, errno +} + +// IsAppend implements File.IsAppend +func (f *osFile) IsAppend() bool { + return f.flag&experimentalsys.O_APPEND == experimentalsys.O_APPEND +} + +// SetAppend implements the same method as documented on sys.File +func (f *osFile) SetAppend(enable bool) (errno experimentalsys.Errno) { + if enable { + f.flag |= experimentalsys.O_APPEND + } else { + f.flag &= ^experimentalsys.O_APPEND + } + + // Clear any create or trunc flag, as we are re-opening, not re-creating. + f.flag &= ^(experimentalsys.O_CREAT | experimentalsys.O_TRUNC) + + // appendMode (bool) cannot be changed later, so we have to re-open the + // file. https://github.com/golang/go/blob/go1.20/src/os/file_unix.go#L60 + return fileError(f, f.closed, f.reopen()) +} + +// compile-time check to ensure osFile.reopen implements reopenFile. +var _ reopenFile = (*fsFile)(nil).reopen + +func (f *osFile) reopen() (errno experimentalsys.Errno) { + // Clear any create flag, as we are re-opening, not re-creating. + f.flag &= ^experimentalsys.O_CREAT + + var ( + isDir bool + offset int64 + err error + ) + + isDir, errno = f.IsDir() + if errno != 0 { + return errno + } + + if !isDir { + offset, err = f.file.Seek(0, io.SeekCurrent) + if err != nil { + return experimentalsys.UnwrapOSError(err) + } + } + + _ = f.close() + f.file, errno = OpenFile(f.path, f.flag, f.perm) + if errno != 0 { + return errno + } + + if !isDir { + _, err = f.file.Seek(offset, io.SeekStart) + if err != nil { + return experimentalsys.UnwrapOSError(err) + } + } + + return 0 +} + +// IsNonblock implements the same method as documented on fsapi.File +func (f *osFile) IsNonblock() bool { + return isNonblock(f) +} + +// SetNonblock implements the same method as documented on fsapi.File +func (f *osFile) SetNonblock(enable bool) (errno experimentalsys.Errno) { + if enable { + f.flag |= experimentalsys.O_NONBLOCK + } else { + f.flag &= ^experimentalsys.O_NONBLOCK + } + if errno = setNonblock(f.fd, enable); errno != 0 { + return fileError(f, f.closed, errno) + } + return 0 +} + +// Stat implements the same method as documented on sys.File +func (f *osFile) Stat() (sys.Stat_t, experimentalsys.Errno) { + if f.closed { + return sys.Stat_t{}, experimentalsys.EBADF + } + + st, errno := statFile(f.file) + switch errno { + case 0: + f.cachedSt = &cachedStat{dev: st.Dev, ino: st.Ino, isDir: st.Mode&fs.ModeDir == fs.ModeDir} + case experimentalsys.EIO: + errno = experimentalsys.EBADF + } + return st, errno +} + +// Read implements the same method as documented on sys.File +func (f *osFile) Read(buf []byte) (n int, errno experimentalsys.Errno) { + if len(buf) == 0 { + return 0, 0 // Short-circuit 0-len reads. + } + if nonBlockingFileReadSupported && f.IsNonblock() { + n, errno = readFd(f.fd, buf) + } else { + n, errno = read(f.file, buf) + } + if errno != 0 { + // Defer validation overhead until we've already had an error. + errno = fileError(f, f.closed, errno) + } + return +} + +// Pread implements the same method as documented on sys.File +func (f *osFile) Pread(buf []byte, off int64) (n int, errno experimentalsys.Errno) { + if n, errno = pread(f.file, buf, off); errno != 0 { + // Defer validation overhead until we've already had an error. + errno = fileError(f, f.closed, errno) + } + return +} + +// Seek implements the same method as documented on sys.File +func (f *osFile) Seek(offset int64, whence int) (newOffset int64, errno experimentalsys.Errno) { + if newOffset, errno = seek(f.file, offset, whence); errno != 0 { + // Defer validation overhead until we've already had an error. + errno = fileError(f, f.closed, errno) + + // If the error was trying to rewind a directory, re-open it. Notably, + // seeking to zero on a directory doesn't work on Windows with Go 1.19. + if errno == experimentalsys.EISDIR && offset == 0 && whence == io.SeekStart { + errno = 0 + f.reopenDir = true + } + } + return +} + +// Poll implements the same method as documented on fsapi.File +func (f *osFile) Poll(flag fsapi.Pflag, timeoutMillis int32) (ready bool, errno experimentalsys.Errno) { + return poll(f.fd, flag, timeoutMillis) +} + +// Readdir implements File.Readdir. Notably, this uses "Readdir", not +// "ReadDir", from os.File. +func (f *osFile) Readdir(n int) (dirents []experimentalsys.Dirent, errno experimentalsys.Errno) { + if f.reopenDir { // re-open the directory if needed. + f.reopenDir = false + if errno = adjustReaddirErr(f, f.closed, f.reopen()); errno != 0 { + return + } + } + + if dirents, errno = readdir(f.file, f.path, n); errno != 0 { + errno = adjustReaddirErr(f, f.closed, errno) + } + return +} + +// Write implements the same method as documented on sys.File +func (f *osFile) Write(buf []byte) (n int, errno experimentalsys.Errno) { + if len(buf) == 0 { + return 0, 0 // Short-circuit 0-len writes. + } + if nonBlockingFileWriteSupported && f.IsNonblock() { + n, errno = writeFd(f.fd, buf) + } else if n, errno = write(f.file, buf); errno != 0 { + // Defer validation overhead until we've already had an error. + errno = fileError(f, f.closed, errno) + } + return +} + +// Pwrite implements the same method as documented on sys.File +func (f *osFile) Pwrite(buf []byte, off int64) (n int, errno experimentalsys.Errno) { + if n, errno = pwrite(f.file, buf, off); errno != 0 { + // Defer validation overhead until we've already had an error. + errno = fileError(f, f.closed, errno) + } + return +} + +// Truncate implements the same method as documented on sys.File +func (f *osFile) Truncate(size int64) (errno experimentalsys.Errno) { + if errno = experimentalsys.UnwrapOSError(f.file.Truncate(size)); errno != 0 { + // Defer validation overhead until we've already had an error. + errno = fileError(f, f.closed, errno) + } + return +} + +// Sync implements the same method as documented on sys.File +func (f *osFile) Sync() experimentalsys.Errno { + return fsync(f.file) +} + +// Datasync implements the same method as documented on sys.File +func (f *osFile) Datasync() experimentalsys.Errno { + return datasync(f.file) +} + +// Utimens implements the same method as documented on sys.File +func (f *osFile) Utimens(atim, mtim int64) experimentalsys.Errno { + if f.closed { + return experimentalsys.EBADF + } + + err := futimens(f.fd, atim, mtim) + return experimentalsys.UnwrapOSError(err) +} + +// Close implements the same method as documented on sys.File +func (f *osFile) Close() experimentalsys.Errno { + if f.closed { + return 0 + } + f.closed = true + return f.close() +} + +func (f *osFile) close() experimentalsys.Errno { + return experimentalsys.UnwrapOSError(f.file.Close()) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/poll.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/poll.go new file mode 100644 index 000000000..f5c982952 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/poll.go @@ -0,0 +1,18 @@ +//go:build windows || linux || darwin + +package sysfs + +import ( + "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/fsapi" +) + +// poll implements `Poll` as documented on sys.File via a file descriptor. +func poll(fd uintptr, flag fsapi.Pflag, timeoutMillis int32) (ready bool, errno sys.Errno) { + if flag != fsapi.POLLIN { + return false, sys.ENOTSUP + } + fds := []pollFd{newPollFd(fd, _POLLIN, 0)} + count, errno := _poll(fds, timeoutMillis) + return count > 0, errno +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/poll_darwin.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/poll_darwin.go new file mode 100644 index 000000000..1f7f89093 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/poll_darwin.go @@ -0,0 +1,55 @@ +package sysfs + +import ( + "unsafe" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +// pollFd is the struct to query for file descriptor events using poll. +type pollFd struct { + // fd is the file descriptor. + fd int32 + // events is a bitmap containing the requested events. + events int16 + // revents is a bitmap containing the returned events. + revents int16 +} + +// newPollFd is a constructor for pollFd that abstracts the platform-specific type of file descriptors. +func newPollFd(fd uintptr, events, revents int16) pollFd { + return pollFd{fd: int32(fd), events: events, revents: revents} +} + +// _POLLIN subscribes a notification when any readable data is available. +const _POLLIN = 0x0001 + +// _poll implements poll on Darwin via the corresponding libc function. +func _poll(fds []pollFd, timeoutMillis int32) (n int, errno sys.Errno) { + var fdptr *pollFd + nfds := len(fds) + if nfds > 0 { + fdptr = &fds[0] + } + n1, _, err := syscall_syscall6( + libc_poll_trampoline_addr, + uintptr(unsafe.Pointer(fdptr)), + uintptr(nfds), + uintptr(int(timeoutMillis)), + uintptr(unsafe.Pointer(nil)), + uintptr(unsafe.Pointer(nil)), + uintptr(unsafe.Pointer(nil))) + return int(n1), sys.UnwrapOSError(err) +} + +// libc_poll_trampoline_addr is the address of the +// `libc_poll_trampoline` symbol, defined in `poll_darwin.s`. +// +// We use this to invoke the syscall through syscall_syscall6 imported below. +var libc_poll_trampoline_addr uintptr + +// Imports the select symbol from libc as `libc_poll`. +// +// Note: CGO mechanisms are used in darwin regardless of the CGO_ENABLED value +// or the "cgo" build flag. See /RATIONALE.md for why. +//go:cgo_import_dynamic libc_poll poll "/usr/lib/libSystem.B.dylib" diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/poll_darwin.s b/vendor/github.com/tetratelabs/wazero/internal/sysfs/poll_darwin.s new file mode 100644 index 000000000..e04fca583 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/poll_darwin.s @@ -0,0 +1,8 @@ +// lifted from golang.org/x/sys unix +#include "textflag.h" + +TEXT libc_poll_trampoline<>(SB), NOSPLIT, $0-0 + JMP libc_poll(SB) + +GLOBL Ā·libc_poll_trampoline_addr(SB), RODATA, $8 +DATA Ā·libc_poll_trampoline_addr(SB)/8, $libc_poll_trampoline<>(SB) diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/poll_linux.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/poll_linux.go new file mode 100644 index 000000000..dab7bb2ca --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/poll_linux.go @@ -0,0 +1,57 @@ +package sysfs + +import ( + "syscall" + "time" + "unsafe" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +// pollFd is the struct to query for file descriptor events using poll. +type pollFd struct { + // fd is the file descriptor. + fd int32 + // events is a bitmap containing the requested events. + events int16 + // revents is a bitmap containing the returned events. + revents int16 +} + +// newPollFd is a constructor for pollFd that abstracts the platform-specific type of file descriptors. +func newPollFd(fd uintptr, events, revents int16) pollFd { + return pollFd{fd: int32(fd), events: events, revents: revents} +} + +// _POLLIN subscribes a notification when any readable data is available. +const _POLLIN = 0x0001 + +// _poll implements poll on Linux via ppoll. +func _poll(fds []pollFd, timeoutMillis int32) (n int, errno sys.Errno) { + var ts syscall.Timespec + if timeoutMillis >= 0 { + ts = syscall.NsecToTimespec(int64(time.Duration(timeoutMillis) * time.Millisecond)) + } + return ppoll(fds, &ts) +} + +// ppoll is a poll variant that allows to subscribe to a mask of signals. +// However, we do not need such mask, so the corresponding argument is always nil. +func ppoll(fds []pollFd, timespec *syscall.Timespec) (n int, err sys.Errno) { + var fdptr *pollFd + nfd := len(fds) + if nfd != 0 { + fdptr = &fds[0] + } + + n1, _, errno := syscall.Syscall6( + uintptr(syscall.SYS_PPOLL), + uintptr(unsafe.Pointer(fdptr)), + uintptr(nfd), + uintptr(unsafe.Pointer(timespec)), + uintptr(unsafe.Pointer(nil)), // sigmask is currently always ignored + uintptr(unsafe.Pointer(nil)), + uintptr(unsafe.Pointer(nil))) + + return int(n1), sys.UnwrapOSError(errno) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/poll_unsupported.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/poll_unsupported.go new file mode 100644 index 000000000..ebe8a6fa9 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/poll_unsupported.go @@ -0,0 +1,13 @@ +//go:build !linux && !darwin && !windows + +package sysfs + +import ( + "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/fsapi" +) + +// poll implements `Poll` as documented on fsapi.File via a file descriptor. +func poll(uintptr, fsapi.Pflag, int32) (bool, sys.Errno) { + return false, sys.ENOSYS +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/poll_windows.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/poll_windows.go new file mode 100644 index 000000000..82c8b2baf --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/poll_windows.go @@ -0,0 +1,224 @@ +package sysfs + +import ( + "syscall" + "time" + "unsafe" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +var ( + procWSAPoll = modws2_32.NewProc("WSAPoll") + procGetNamedPipeInfo = kernel32.NewProc("GetNamedPipeInfo") +) + +const ( + // _POLLRDNORM subscribes to normal data for read. + _POLLRDNORM = 0x0100 + // _POLLRDBAND subscribes to priority band (out-of-band) data for read. + _POLLRDBAND = 0x0200 + // _POLLIN subscribes a notification when any readable data is available. + _POLLIN = (_POLLRDNORM | _POLLRDBAND) +) + +// pollFd is the struct to query for file descriptor events using poll. +type pollFd struct { + // fd is the file descriptor. + fd uintptr + // events is a bitmap containing the requested events. + events int16 + // revents is a bitmap containing the returned events. + revents int16 +} + +// newPollFd is a constructor for pollFd that abstracts the platform-specific type of file descriptors. +func newPollFd(fd uintptr, events, revents int16) pollFd { + return pollFd{fd: fd, events: events, revents: revents} +} + +// pollInterval is the interval between each calls to peekNamedPipe in selectAllHandles +const pollInterval = 100 * time.Millisecond + +// _poll implements poll on Windows, for a subset of cases. +// +// fds may contain any number of file handles, but regular files and pipes are only processed for _POLLIN. +// Stdin is a pipe, thus it is checked for readiness when present. Pipes are checked using PeekNamedPipe. +// Regular files always immediately reported as ready, regardless their actual state and timeouts. +// +// If n==0 it will wait for the given timeout duration, but it will return sys.ENOSYS if timeout is nil, +// i.e. it won't block indefinitely. The given ctx is used to allow for cancellation, +// and it is currently used only in tests. +// +// The implementation actually polls every 100 milliseconds (pollInterval) until it reaches the +// given timeout (in millis). +// +// The duration may be negative, in which case it will wait indefinitely. The given ctx is +// used to allow for cancellation, and it is currently used only in tests. +func _poll(fds []pollFd, timeoutMillis int32) (n int, errno sys.Errno) { + if fds == nil { + return -1, sys.ENOSYS + } + + regular, pipes, sockets, errno := partionByFtype(fds) + nregular := len(regular) + if errno != 0 { + return -1, errno + } + + // Ticker that emits at every pollInterval. + tick := time.NewTicker(pollInterval) + tickCh := tick.C + defer tick.Stop() + + // Timer that expires after the given duration. + // Initialize afterCh as nil: the select below will wait forever. + var afterCh <-chan time.Time + if timeoutMillis >= 0 { + // If duration is not nil, instantiate the timer. + after := time.NewTimer(time.Duration(timeoutMillis) * time.Millisecond) + defer after.Stop() + afterCh = after.C + } + + npipes, nsockets, errno := peekAll(pipes, sockets) + if errno != 0 { + return -1, errno + } + count := nregular + npipes + nsockets + if count > 0 { + return count, 0 + } + + for { + select { + case <-afterCh: + return 0, 0 + case <-tickCh: + npipes, nsockets, errno := peekAll(pipes, sockets) + if errno != 0 { + return -1, errno + } + count = nregular + npipes + nsockets + if count > 0 { + return count, 0 + } + } + } +} + +func peekAll(pipes, sockets []pollFd) (npipes, nsockets int, errno sys.Errno) { + npipes, errno = peekPipes(pipes) + if errno != 0 { + return + } + + // Invoke wsaPoll with a 0-timeout to avoid blocking. + // Timeouts are handled in pollWithContext instead. + nsockets, errno = wsaPoll(sockets, 0) + if errno != 0 { + return + } + + count := npipes + nsockets + if count > 0 { + return + } + + return +} + +func peekPipes(fds []pollFd) (n int, errno sys.Errno) { + for _, fd := range fds { + bytes, errno := peekNamedPipe(syscall.Handle(fd.fd)) + if errno != 0 { + return -1, sys.UnwrapOSError(errno) + } + if bytes > 0 { + n++ + } + } + return +} + +// wsaPoll is the WSAPoll function from winsock2. +// +// See https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsapoll +func wsaPoll(fds []pollFd, timeout int) (n int, errno sys.Errno) { + if len(fds) > 0 { + sockptr := &fds[0] + ns, _, e := syscall.SyscallN( + procWSAPoll.Addr(), + uintptr(unsafe.Pointer(sockptr)), + uintptr(len(fds)), + uintptr(timeout)) + if e != 0 { + return -1, sys.UnwrapOSError(e) + } + n = int(ns) + } + return +} + +// ftype is a type of file that can be handled by poll. +type ftype uint8 + +const ( + ftype_regular ftype = iota + ftype_pipe + ftype_socket +) + +// partionByFtype checks the type of each fd in fds and returns 3 distinct partitions +// for regular files, named pipes and sockets. +func partionByFtype(fds []pollFd) (regular, pipe, socket []pollFd, errno sys.Errno) { + for _, pfd := range fds { + t, errno := ftypeOf(pfd.fd) + if errno != 0 { + return nil, nil, nil, errno + } + switch t { + case ftype_regular: + regular = append(regular, pfd) + case ftype_pipe: + pipe = append(pipe, pfd) + case ftype_socket: + socket = append(socket, pfd) + } + } + return +} + +// ftypeOf checks the type of fd and return the corresponding ftype. +func ftypeOf(fd uintptr) (ftype, sys.Errno) { + h := syscall.Handle(fd) + t, err := syscall.GetFileType(h) + if err != nil { + return 0, sys.UnwrapOSError(err) + } + switch t { + case syscall.FILE_TYPE_CHAR, syscall.FILE_TYPE_DISK: + return ftype_regular, 0 + case syscall.FILE_TYPE_PIPE: + if isSocket(h) { + return ftype_socket, 0 + } else { + return ftype_pipe, 0 + } + default: + return ftype_regular, 0 + } +} + +// isSocket returns true if the given file handle +// is a pipe. +func isSocket(fd syscall.Handle) bool { + r, _, errno := syscall.SyscallN( + procGetNamedPipeInfo.Addr(), + uintptr(fd), + uintptr(unsafe.Pointer(nil)), + uintptr(unsafe.Pointer(nil)), + uintptr(unsafe.Pointer(nil)), + uintptr(unsafe.Pointer(nil))) + return r == 0 || errno != 0 +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/readfs.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/readfs.go new file mode 100644 index 000000000..59e331a29 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/readfs.go @@ -0,0 +1,117 @@ +package sysfs + +import ( + "io/fs" + + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" +) + +type ReadFS struct { + experimentalsys.FS +} + +// OpenFile implements the same method as documented on sys.FS +func (r *ReadFS) OpenFile(path string, flag experimentalsys.Oflag, perm fs.FileMode) (experimentalsys.File, experimentalsys.Errno) { + // Mask the mutually exclusive bits as they determine write mode. + switch flag & (experimentalsys.O_RDONLY | experimentalsys.O_WRONLY | experimentalsys.O_RDWR) { + case experimentalsys.O_WRONLY, experimentalsys.O_RDWR: + // Return the correct error if a directory was opened for write. + if flag&experimentalsys.O_DIRECTORY != 0 { + return nil, experimentalsys.EISDIR + } + return nil, experimentalsys.ENOSYS + default: // sys.O_RDONLY (integer zero) so we are ok! + } + + f, errno := r.FS.OpenFile(path, flag, perm) + if errno != 0 { + return nil, errno + } + return &readFile{f}, 0 +} + +// Mkdir implements the same method as documented on sys.FS +func (r *ReadFS) Mkdir(path string, perm fs.FileMode) experimentalsys.Errno { + return experimentalsys.EROFS +} + +// Chmod implements the same method as documented on sys.FS +func (r *ReadFS) Chmod(path string, perm fs.FileMode) experimentalsys.Errno { + return experimentalsys.EROFS +} + +// Rename implements the same method as documented on sys.FS +func (r *ReadFS) Rename(from, to string) experimentalsys.Errno { + return experimentalsys.EROFS +} + +// Rmdir implements the same method as documented on sys.FS +func (r *ReadFS) Rmdir(path string) experimentalsys.Errno { + return experimentalsys.EROFS +} + +// Link implements the same method as documented on sys.FS +func (r *ReadFS) Link(_, _ string) experimentalsys.Errno { + return experimentalsys.EROFS +} + +// Symlink implements the same method as documented on sys.FS +func (r *ReadFS) Symlink(_, _ string) experimentalsys.Errno { + return experimentalsys.EROFS +} + +// Unlink implements the same method as documented on sys.FS +func (r *ReadFS) Unlink(path string) experimentalsys.Errno { + return experimentalsys.EROFS +} + +// Utimens implements the same method as documented on sys.FS +func (r *ReadFS) Utimens(path string, atim, mtim int64) experimentalsys.Errno { + return experimentalsys.EROFS +} + +// compile-time check to ensure readFile implements api.File. +var _ experimentalsys.File = (*readFile)(nil) + +type readFile struct { + experimentalsys.File +} + +// Write implements the same method as documented on sys.File. +func (r *readFile) Write([]byte) (int, experimentalsys.Errno) { + return 0, r.writeErr() +} + +// Pwrite implements the same method as documented on sys.File. +func (r *readFile) Pwrite([]byte, int64) (n int, errno experimentalsys.Errno) { + return 0, r.writeErr() +} + +// Truncate implements the same method as documented on sys.File. +func (r *readFile) Truncate(int64) experimentalsys.Errno { + return r.writeErr() +} + +// Sync implements the same method as documented on sys.File. +func (r *readFile) Sync() experimentalsys.Errno { + return experimentalsys.EBADF +} + +// Datasync implements the same method as documented on sys.File. +func (r *readFile) Datasync() experimentalsys.Errno { + return experimentalsys.EBADF +} + +// Utimens implements the same method as documented on sys.File. +func (r *readFile) Utimens(int64, int64) experimentalsys.Errno { + return experimentalsys.EBADF +} + +func (r *readFile) writeErr() experimentalsys.Errno { + if isDir, errno := r.IsDir(); errno != 0 { + return errno + } else if isDir { + return experimentalsys.EISDIR + } + return experimentalsys.EBADF +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/rename.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/rename.go new file mode 100644 index 000000000..f7d84ef7a --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/rename.go @@ -0,0 +1,16 @@ +//go:build !windows && !plan9 + +package sysfs + +import ( + "syscall" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +func rename(from, to string) sys.Errno { + if from == to { + return 0 + } + return sys.UnwrapOSError(syscall.Rename(from, to)) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/rename_plan9.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/rename_plan9.go new file mode 100644 index 000000000..474cc7595 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/rename_plan9.go @@ -0,0 +1,14 @@ +package sysfs + +import ( + "os" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +func rename(from, to string) sys.Errno { + if from == to { + return 0 + } + return sys.UnwrapOSError(os.Rename(from, to)) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/rename_windows.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/rename_windows.go new file mode 100644 index 000000000..5e8102239 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/rename_windows.go @@ -0,0 +1,55 @@ +package sysfs + +import ( + "os" + "syscall" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +func rename(from, to string) sys.Errno { + if from == to { + return 0 + } + + var fromIsDir, toIsDir bool + if fromStat, errno := stat(from); errno != 0 { + return errno // failed to stat from + } else { + fromIsDir = fromStat.Mode.IsDir() + } + if toStat, errno := stat(to); errno == sys.ENOENT { + return syscallRename(from, to) // file or dir to not-exist is ok + } else if errno != 0 { + return errno // failed to stat to + } else { + toIsDir = toStat.Mode.IsDir() + } + + // Now, handle known cases + switch { + case !fromIsDir && toIsDir: // file to dir + return sys.EISDIR + case !fromIsDir && !toIsDir: // file to file + // Use os.Rename instead of syscall.Rename to overwrite a file. + // This uses MoveFileEx instead of MoveFile (used by syscall.Rename). + return sys.UnwrapOSError(os.Rename(from, to)) + case fromIsDir && !toIsDir: // dir to file + return sys.ENOTDIR + default: // dir to dir + + // We can't tell if a directory is empty or not, via stat information. + // Reading the directory is expensive, as it can buffer large amounts + // of data on fail. Instead, speculatively try to remove the directory. + // This is only one syscall and won't buffer anything. + if errno := rmdir(to); errno == 0 || errno == sys.ENOENT { + return syscallRename(from, to) + } else { + return errno + } + } +} + +func syscallRename(from string, to string) sys.Errno { + return sys.UnwrapOSError(syscall.Rename(from, to)) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/sock.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/sock.go new file mode 100644 index 000000000..af739a908 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/sock.go @@ -0,0 +1,37 @@ +package sysfs + +import ( + "net" + "os" + + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" + socketapi "github.com/tetratelabs/wazero/internal/sock" + "github.com/tetratelabs/wazero/sys" +) + +// NewTCPListenerFile creates a socketapi.TCPSock for a given *net.TCPListener. +func NewTCPListenerFile(tl *net.TCPListener) socketapi.TCPSock { + return newTCPListenerFile(tl) +} + +// baseSockFile implements base behavior for all TCPSock, TCPConn files, +// regardless the platform. +type baseSockFile struct { + experimentalsys.UnimplementedFile +} + +var _ experimentalsys.File = (*baseSockFile)(nil) + +// IsDir implements the same method as documented on File.IsDir +func (*baseSockFile) IsDir() (bool, experimentalsys.Errno) { + // We need to override this method because WASI-libc prestats the FD + // and the default impl returns ENOSYS otherwise. + return false, 0 +} + +// Stat implements the same method as documented on File.Stat +func (f *baseSockFile) Stat() (fs sys.Stat_t, errno experimentalsys.Errno) { + // The mode is not really important, but it should be neither a regular file nor a directory. + fs.Mode = os.ModeIrregular + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/sock_unix.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/sock_unix.go new file mode 100644 index 000000000..3698f560e --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/sock_unix.go @@ -0,0 +1,180 @@ +//go:build linux || darwin + +package sysfs + +import ( + "net" + "syscall" + + "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/fsapi" + socketapi "github.com/tetratelabs/wazero/internal/sock" +) + +// MSG_PEEK is the constant syscall.MSG_PEEK +const MSG_PEEK = syscall.MSG_PEEK + +// newTCPListenerFile is a constructor for a socketapi.TCPSock. +// +// Note: the implementation of socketapi.TCPSock goes straight +// to the syscall layer, bypassing most of the Go library. +// For an alternative approach, consider winTcpListenerFile +// where most APIs are implemented with regular Go std-lib calls. +func newTCPListenerFile(tl *net.TCPListener) socketapi.TCPSock { + conn, err := tl.File() + if err != nil { + panic(err) + } + fd := conn.Fd() + // We need to duplicate this file handle, or the lifecycle will be tied + // to the TCPListener. We rely on the TCPListener only to set up + // the connection correctly and parse/resolve the TCP Address + // (notice we actually rely on the listener in the Windows implementation). + sysfd, err := syscall.Dup(int(fd)) + if err != nil { + panic(err) + } + return &tcpListenerFile{fd: uintptr(sysfd), addr: tl.Addr().(*net.TCPAddr)} +} + +var _ socketapi.TCPSock = (*tcpListenerFile)(nil) + +type tcpListenerFile struct { + baseSockFile + + fd uintptr + addr *net.TCPAddr + nonblock bool +} + +// Accept implements the same method as documented on socketapi.TCPSock +func (f *tcpListenerFile) Accept() (socketapi.TCPConn, sys.Errno) { + nfd, _, err := syscall.Accept(int(f.fd)) + errno := sys.UnwrapOSError(err) + if errno != 0 { + return nil, errno + } + return &tcpConnFile{fd: uintptr(nfd)}, 0 +} + +// Close implements the same method as documented on sys.File +func (f *tcpListenerFile) Close() sys.Errno { + return sys.UnwrapOSError(syscall.Close(int(f.fd))) +} + +// Addr is exposed for testing. +func (f *tcpListenerFile) Addr() *net.TCPAddr { + return f.addr +} + +// SetNonblock implements the same method as documented on fsapi.File +func (f *tcpListenerFile) SetNonblock(enabled bool) sys.Errno { + f.nonblock = enabled + return sys.UnwrapOSError(setNonblock(f.fd, enabled)) +} + +// IsNonblock implements the same method as documented on fsapi.File +func (f *tcpListenerFile) IsNonblock() bool { + return f.nonblock +} + +// Poll implements the same method as documented on fsapi.File +func (f *tcpListenerFile) Poll(flag fsapi.Pflag, timeoutMillis int32) (ready bool, errno sys.Errno) { + return false, sys.ENOSYS +} + +var _ socketapi.TCPConn = (*tcpConnFile)(nil) + +type tcpConnFile struct { + baseSockFile + + fd uintptr + nonblock bool + + // closed is true when closed was called. This ensures proper sys.EBADF + closed bool +} + +func newTcpConn(tc *net.TCPConn) socketapi.TCPConn { + f, err := tc.File() + if err != nil { + panic(err) + } + return &tcpConnFile{fd: f.Fd()} +} + +// Read implements the same method as documented on sys.File +func (f *tcpConnFile) Read(buf []byte) (n int, errno sys.Errno) { + n, err := syscall.Read(int(f.fd), buf) + if err != nil { + // Defer validation overhead until we've already had an error. + errno = sys.UnwrapOSError(err) + errno = fileError(f, f.closed, errno) + } + return n, errno +} + +// Write implements the same method as documented on sys.File +func (f *tcpConnFile) Write(buf []byte) (n int, errno sys.Errno) { + n, err := syscall.Write(int(f.fd), buf) + if err != nil { + // Defer validation overhead until we've already had an error. + errno = sys.UnwrapOSError(err) + errno = fileError(f, f.closed, errno) + } + return n, errno +} + +// Recvfrom implements the same method as documented on socketapi.TCPConn +func (f *tcpConnFile) Recvfrom(p []byte, flags int) (n int, errno sys.Errno) { + if flags != MSG_PEEK { + errno = sys.EINVAL + return + } + n, _, recvfromErr := syscall.Recvfrom(int(f.fd), p, MSG_PEEK) + errno = sys.UnwrapOSError(recvfromErr) + return n, errno +} + +// Shutdown implements the same method as documented on sys.Conn +func (f *tcpConnFile) Shutdown(how int) sys.Errno { + var err error + switch how { + case syscall.SHUT_RD, syscall.SHUT_WR: + err = syscall.Shutdown(int(f.fd), how) + case syscall.SHUT_RDWR: + return f.close() + default: + return sys.EINVAL + } + return sys.UnwrapOSError(err) +} + +// Close implements the same method as documented on sys.File +func (f *tcpConnFile) Close() sys.Errno { + return f.close() +} + +func (f *tcpConnFile) close() sys.Errno { + if f.closed { + return 0 + } + f.closed = true + return sys.UnwrapOSError(syscall.Shutdown(int(f.fd), syscall.SHUT_RDWR)) +} + +// SetNonblock implements the same method as documented on fsapi.File +func (f *tcpConnFile) SetNonblock(enabled bool) (errno sys.Errno) { + f.nonblock = enabled + return sys.UnwrapOSError(setNonblock(f.fd, enabled)) +} + +// IsNonblock implements the same method as documented on fsapi.File +func (f *tcpConnFile) IsNonblock() bool { + return f.nonblock +} + +// Poll implements the same method as documented on fsapi.File +func (f *tcpConnFile) Poll(flag fsapi.Pflag, timeoutMillis int32) (ready bool, errno sys.Errno) { + return false, sys.ENOSYS +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/sock_unsupported.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/sock_unsupported.go new file mode 100644 index 000000000..76a10a8b6 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/sock_unsupported.go @@ -0,0 +1,26 @@ +//go:build !linux && !darwin && !windows + +package sysfs + +import ( + "net" + + "github.com/tetratelabs/wazero/experimental/sys" + socketapi "github.com/tetratelabs/wazero/internal/sock" +) + +// MSG_PEEK is a filler value. +const MSG_PEEK = 0x2 + +func newTCPListenerFile(tl *net.TCPListener) socketapi.TCPSock { + return &unsupportedSockFile{} +} + +type unsupportedSockFile struct { + baseSockFile +} + +// Accept implements the same method as documented on socketapi.TCPSock +func (f *unsupportedSockFile) Accept() (socketapi.TCPConn, sys.Errno) { + return nil, sys.ENOSYS +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/sock_windows.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/sock_windows.go new file mode 100644 index 000000000..ed275e629 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/sock_windows.go @@ -0,0 +1,285 @@ +//go:build windows + +package sysfs + +import ( + "net" + "syscall" + "unsafe" + + "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/internal/fsapi" + socketapi "github.com/tetratelabs/wazero/internal/sock" +) + +const ( + // MSG_PEEK is the flag PEEK for syscall.Recvfrom on Windows. + // This constant is not exported on this platform. + MSG_PEEK = 0x2 + // _FIONBIO is the flag to set the O_NONBLOCK flag on socket handles using ioctlsocket. + _FIONBIO = 0x8004667e +) + +var ( + // modws2_32 is WinSock. + modws2_32 = syscall.NewLazyDLL("ws2_32.dll") + // procrecvfrom exposes recvfrom from WinSock. + procrecvfrom = modws2_32.NewProc("recvfrom") + // procioctlsocket exposes ioctlsocket from WinSock. + procioctlsocket = modws2_32.NewProc("ioctlsocket") +) + +// recvfrom exposes the underlying syscall in Windows. +// +// Note: since we are only using this to expose MSG_PEEK, +// we do not need really need all the parameters that are actually +// allowed in WinSock. +// We ignore `from *sockaddr` and `fromlen *int`. +func recvfrom(s syscall.Handle, buf []byte, flags int32) (n int, errno sys.Errno) { + var _p0 *byte + if len(buf) > 0 { + _p0 = &buf[0] + } + r0, _, e1 := syscall.SyscallN( + procrecvfrom.Addr(), + uintptr(s), + uintptr(unsafe.Pointer(_p0)), + uintptr(len(buf)), + uintptr(flags), + 0, // from *sockaddr (optional) + 0) // fromlen *int (optional) + return int(r0), sys.UnwrapOSError(e1) +} + +func setNonblockSocket(fd syscall.Handle, enabled bool) sys.Errno { + opt := uint64(0) + if enabled { + opt = 1 + } + // ioctlsocket(fd, FIONBIO, &opt) + _, _, errno := syscall.SyscallN( + procioctlsocket.Addr(), + uintptr(fd), + uintptr(_FIONBIO), + uintptr(unsafe.Pointer(&opt))) + return sys.UnwrapOSError(errno) +} + +// syscallConnControl extracts a syscall.RawConn from the given syscall.Conn and applies +// the given fn to a file descriptor, returning an integer or a nonzero syscall.Errno on failure. +// +// syscallConnControl streamlines the pattern of extracting the syscall.Rawconn, +// invoking its syscall.RawConn.Control method, then handling properly the errors that may occur +// within fn or returned by syscall.RawConn.Control itself. +func syscallConnControl(conn syscall.Conn, fn func(fd uintptr) (int, sys.Errno)) (n int, errno sys.Errno) { + syscallConn, err := conn.SyscallConn() + if err != nil { + return 0, sys.UnwrapOSError(err) + } + // Prioritize the inner errno over Control + if controlErr := syscallConn.Control(func(fd uintptr) { + n, errno = fn(fd) + }); errno == 0 { + errno = sys.UnwrapOSError(controlErr) + } + return +} + +func _pollSock(conn syscall.Conn, flag fsapi.Pflag, timeoutMillis int32) (bool, sys.Errno) { + if flag != fsapi.POLLIN { + return false, sys.ENOTSUP + } + n, errno := syscallConnControl(conn, func(fd uintptr) (int, sys.Errno) { + return _poll([]pollFd{newPollFd(fd, _POLLIN, 0)}, timeoutMillis) + }) + return n > 0, errno +} + +// newTCPListenerFile is a constructor for a socketapi.TCPSock. +// +// Note: currently the Windows implementation of socketapi.TCPSock +// returns a winTcpListenerFile, which is a specialized TCPSock +// that delegates to a .net.TCPListener. +// The current strategy is to delegate most behavior to the Go +// standard library, instead of invoke syscalls/Win32 APIs +// because they are sensibly different from Unix's. +func newTCPListenerFile(tl *net.TCPListener) socketapi.TCPSock { + return &winTcpListenerFile{tl: tl} +} + +var _ socketapi.TCPSock = (*winTcpListenerFile)(nil) + +type winTcpListenerFile struct { + baseSockFile + + tl *net.TCPListener + closed bool + nonblock bool +} + +// Accept implements the same method as documented on socketapi.TCPSock +func (f *winTcpListenerFile) Accept() (socketapi.TCPConn, sys.Errno) { + // Ensure we have an incoming connection using winsock_select, otherwise return immediately. + if f.nonblock { + if ready, errno := _pollSock(f.tl, fsapi.POLLIN, 0); !ready || errno != 0 { + return nil, sys.EAGAIN + } + } + + // Accept normally blocks goroutines, but we + // made sure that we have an incoming connection, + // so we should be safe. + if conn, err := f.tl.Accept(); err != nil { + return nil, sys.UnwrapOSError(err) + } else { + return newTcpConn(conn.(*net.TCPConn)), 0 + } +} + +// Close implements the same method as documented on sys.File +func (f *winTcpListenerFile) Close() sys.Errno { + if !f.closed { + return sys.UnwrapOSError(f.tl.Close()) + } + return 0 +} + +// Addr is exposed for testing. +func (f *winTcpListenerFile) Addr() *net.TCPAddr { + return f.tl.Addr().(*net.TCPAddr) +} + +// IsNonblock implements the same method as documented on fsapi.File +func (f *winTcpListenerFile) IsNonblock() bool { + return f.nonblock +} + +// SetNonblock implements the same method as documented on fsapi.File +func (f *winTcpListenerFile) SetNonblock(enabled bool) sys.Errno { + f.nonblock = enabled + _, errno := syscallConnControl(f.tl, func(fd uintptr) (int, sys.Errno) { + return 0, setNonblockSocket(syscall.Handle(fd), enabled) + }) + return errno +} + +// Poll implements the same method as documented on fsapi.File +func (f *winTcpListenerFile) Poll(fsapi.Pflag, int32) (ready bool, errno sys.Errno) { + return false, sys.ENOSYS +} + +var _ socketapi.TCPConn = (*winTcpConnFile)(nil) + +// winTcpConnFile is a blocking connection. +// +// It is a wrapper for an underlying net.TCPConn. +type winTcpConnFile struct { + baseSockFile + + tc *net.TCPConn + + // nonblock is true when the underlying connection is flagged as non-blocking. + // This ensures that reads and writes return sys.EAGAIN without blocking the caller. + nonblock bool + // closed is true when closed was called. This ensures proper sys.EBADF + closed bool +} + +func newTcpConn(tc *net.TCPConn) socketapi.TCPConn { + return &winTcpConnFile{tc: tc} +} + +// Read implements the same method as documented on sys.File +func (f *winTcpConnFile) Read(buf []byte) (n int, errno sys.Errno) { + if len(buf) == 0 { + return 0, 0 // Short-circuit 0-len reads. + } + if nonBlockingFileReadSupported && f.IsNonblock() { + n, errno = syscallConnControl(f.tc, func(fd uintptr) (int, sys.Errno) { + return readSocket(syscall.Handle(fd), buf) + }) + } else { + n, errno = read(f.tc, buf) + } + if errno != 0 { + // Defer validation overhead until we've already had an error. + errno = fileError(f, f.closed, errno) + } + return +} + +// Write implements the same method as documented on sys.File +func (f *winTcpConnFile) Write(buf []byte) (n int, errno sys.Errno) { + if nonBlockingFileWriteSupported && f.IsNonblock() { + return syscallConnControl(f.tc, func(fd uintptr) (int, sys.Errno) { + return writeSocket(fd, buf) + }) + } else { + n, errno = write(f.tc, buf) + } + if errno != 0 { + // Defer validation overhead until we've already had an error. + errno = fileError(f, f.closed, errno) + } + return +} + +// Recvfrom implements the same method as documented on socketapi.TCPConn +func (f *winTcpConnFile) Recvfrom(p []byte, flags int) (n int, errno sys.Errno) { + if flags != MSG_PEEK { + errno = sys.EINVAL + return + } + return syscallConnControl(f.tc, func(fd uintptr) (int, sys.Errno) { + return recvfrom(syscall.Handle(fd), p, MSG_PEEK) + }) +} + +// Shutdown implements the same method as documented on sys.Conn +func (f *winTcpConnFile) Shutdown(how int) sys.Errno { + // FIXME: can userland shutdown listeners? + var err error + switch how { + case syscall.SHUT_RD: + err = f.tc.CloseRead() + case syscall.SHUT_WR: + err = f.tc.CloseWrite() + case syscall.SHUT_RDWR: + return f.close() + default: + return sys.EINVAL + } + return sys.UnwrapOSError(err) +} + +// Close implements the same method as documented on sys.File +func (f *winTcpConnFile) Close() sys.Errno { + return f.close() +} + +func (f *winTcpConnFile) close() sys.Errno { + if f.closed { + return 0 + } + f.closed = true + return f.Shutdown(syscall.SHUT_RDWR) +} + +// IsNonblock implements the same method as documented on fsapi.File +func (f *winTcpConnFile) IsNonblock() bool { + return f.nonblock +} + +// SetNonblock implements the same method as documented on fsapi.File +func (f *winTcpConnFile) SetNonblock(enabled bool) (errno sys.Errno) { + f.nonblock = true + _, errno = syscallConnControl(f.tc, func(fd uintptr) (int, sys.Errno) { + return 0, sys.UnwrapOSError(setNonblockSocket(syscall.Handle(fd), enabled)) + }) + return +} + +// Poll implements the same method as documented on fsapi.File +func (f *winTcpConnFile) Poll(fsapi.Pflag, int32) (ready bool, errno sys.Errno) { + return false, sys.ENOSYS +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/stat.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/stat.go new file mode 100644 index 000000000..2d973b16c --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/stat.go @@ -0,0 +1,16 @@ +package sysfs + +import ( + "io/fs" + + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/sys" +) + +func defaultStatFile(f fs.File) (sys.Stat_t, experimentalsys.Errno) { + if info, err := f.Stat(); err != nil { + return sys.Stat_t{}, experimentalsys.UnwrapOSError(err) + } else { + return sys.NewStat_t(info), 0 + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/stat_bsd.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/stat_bsd.go new file mode 100644 index 000000000..254e204cd --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/stat_bsd.go @@ -0,0 +1,37 @@ +//go:build (amd64 || arm64) && (darwin || freebsd) + +package sysfs + +import ( + "io/fs" + "os" + + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/sys" +) + +// dirNlinkIncludesDot is true because even though os.File filters out dot +// entries, the underlying syscall.Stat includes them. +// +// Note: this is only used in tests +const dirNlinkIncludesDot = true + +func lstat(path string) (sys.Stat_t, experimentalsys.Errno) { + if info, err := os.Lstat(path); err != nil { + return sys.Stat_t{}, experimentalsys.UnwrapOSError(err) + } else { + return sys.NewStat_t(info), 0 + } +} + +func stat(path string) (sys.Stat_t, experimentalsys.Errno) { + if info, err := os.Stat(path); err != nil { + return sys.Stat_t{}, experimentalsys.UnwrapOSError(err) + } else { + return sys.NewStat_t(info), 0 + } +} + +func statFile(f fs.File) (sys.Stat_t, experimentalsys.Errno) { + return defaultStatFile(f) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/stat_linux.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/stat_linux.go new file mode 100644 index 000000000..fd289756d --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/stat_linux.go @@ -0,0 +1,40 @@ +//go:build (amd64 || arm64 || riscv64) && linux + +// Note: This expression is not the same as compiler support, even if it looks +// similar. Platform functions here are used in interpreter mode as well. + +package sysfs + +import ( + "io/fs" + "os" + + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/sys" +) + +// dirNlinkIncludesDot is true because even though os.File filters out dot +// entries, the underlying syscall.Stat includes them. +// +// Note: this is only used in tests +const dirNlinkIncludesDot = true + +func lstat(path string) (sys.Stat_t, experimentalsys.Errno) { + if info, err := os.Lstat(path); err != nil { + return sys.Stat_t{}, experimentalsys.UnwrapOSError(err) + } else { + return sys.NewStat_t(info), 0 + } +} + +func stat(path string) (sys.Stat_t, experimentalsys.Errno) { + if info, err := os.Stat(path); err != nil { + return sys.Stat_t{}, experimentalsys.UnwrapOSError(err) + } else { + return sys.NewStat_t(info), 0 + } +} + +func statFile(f fs.File) (sys.Stat_t, experimentalsys.Errno) { + return defaultStatFile(f) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/stat_unsupported.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/stat_unsupported.go new file mode 100644 index 000000000..4b05a8977 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/stat_unsupported.go @@ -0,0 +1,40 @@ +//go:build (!((amd64 || arm64 || riscv64) && linux) && !((amd64 || arm64) && (darwin || freebsd)) && !((amd64 || arm64) && windows)) || js + +package sysfs + +import ( + "io/fs" + "os" + + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/sys" +) + +// Note: go:build constraints must be the same as /sys.stat_unsupported.go for +// the same reasons. + +// dirNlinkIncludesDot might be true for some operating systems, which can have +// new stat_XX.go files as necessary. +// +// Note: this is only used in tests +const dirNlinkIncludesDot = false + +func lstat(path string) (sys.Stat_t, experimentalsys.Errno) { + if info, err := os.Lstat(path); err != nil { + return sys.Stat_t{}, experimentalsys.UnwrapOSError(err) + } else { + return sys.NewStat_t(info), 0 + } +} + +func stat(path string) (sys.Stat_t, experimentalsys.Errno) { + if info, err := os.Stat(path); err != nil { + return sys.Stat_t{}, experimentalsys.UnwrapOSError(err) + } else { + return sys.NewStat_t(info), 0 + } +} + +func statFile(f fs.File) (sys.Stat_t, experimentalsys.Errno) { + return defaultStatFile(f) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/stat_windows.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/stat_windows.go new file mode 100644 index 000000000..4456dd782 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/stat_windows.go @@ -0,0 +1,120 @@ +//go:build (amd64 || arm64) && windows + +package sysfs + +import ( + "io/fs" + "syscall" + + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" + "github.com/tetratelabs/wazero/sys" +) + +// dirNlinkIncludesDot is false because Windows does not return dot entries. +// +// Note: this is only used in tests +const dirNlinkIncludesDot = false + +func lstat(path string) (sys.Stat_t, experimentalsys.Errno) { + attrs := uint32(syscall.FILE_FLAG_BACKUP_SEMANTICS) + // Use FILE_FLAG_OPEN_REPARSE_POINT, otherwise CreateFile will follow symlink. + // See https://docs.microsoft.com/en-us/windows/desktop/FileIO/symbolic-link-effects-on-file-systems-functions#createfile-and-createfiletransacted + attrs |= syscall.FILE_FLAG_OPEN_REPARSE_POINT + return statPath(attrs, path) +} + +func stat(path string) (sys.Stat_t, experimentalsys.Errno) { + attrs := uint32(syscall.FILE_FLAG_BACKUP_SEMANTICS) + return statPath(attrs, path) +} + +func statPath(createFileAttrs uint32, path string) (sys.Stat_t, experimentalsys.Errno) { + if len(path) == 0 { + return sys.Stat_t{}, experimentalsys.ENOENT + } + pathp, err := syscall.UTF16PtrFromString(path) + if err != nil { + return sys.Stat_t{}, experimentalsys.EINVAL + } + + // open the file handle + h, err := syscall.CreateFile(pathp, 0, 0, nil, + syscall.OPEN_EXISTING, createFileAttrs, 0) + if err != nil { + errno := experimentalsys.UnwrapOSError(err) + // To match expectations of WASI, e.g. TinyGo TestStatBadDir, return + // ENOENT, not ENOTDIR. + if errno == experimentalsys.ENOTDIR { + errno = experimentalsys.ENOENT + } + return sys.Stat_t{}, errno + } + defer syscall.CloseHandle(h) + + return statHandle(h) +} + +// fdFile allows masking the `Fd` function on os.File. +type fdFile interface { + Fd() uintptr +} + +func statFile(f fs.File) (sys.Stat_t, experimentalsys.Errno) { + if osF, ok := f.(fdFile); ok { + // Attempt to get the stat by handle, which works for normal files + st, err := statHandle(syscall.Handle(osF.Fd())) + + // ERROR_INVALID_HANDLE happens before Go 1.20. Don't fail as we only + // use that approach to fill in inode data, which is not critical. + // + // Note: statHandle uses UnwrapOSError which coerces + // ERROR_INVALID_HANDLE to EBADF. + if err != experimentalsys.EBADF { + return st, err + } + } + return defaultStatFile(f) +} + +func statHandle(h syscall.Handle) (sys.Stat_t, experimentalsys.Errno) { + winFt, err := syscall.GetFileType(h) + if err != nil { + return sys.Stat_t{}, experimentalsys.UnwrapOSError(err) + } + + var fi syscall.ByHandleFileInformation + if err = syscall.GetFileInformationByHandle(h, &fi); err != nil { + return sys.Stat_t{}, experimentalsys.UnwrapOSError(err) + } + + var m fs.FileMode + if fi.FileAttributes&syscall.FILE_ATTRIBUTE_READONLY != 0 { + m |= 0o444 + } else { + m |= 0o666 + } + + switch { // check whether this is a symlink first + case fi.FileAttributes&syscall.FILE_ATTRIBUTE_REPARSE_POINT != 0: + m |= fs.ModeSymlink + case winFt == syscall.FILE_TYPE_PIPE: + m |= fs.ModeNamedPipe + case winFt == syscall.FILE_TYPE_CHAR: + m |= fs.ModeDevice | fs.ModeCharDevice + case fi.FileAttributes&syscall.FILE_ATTRIBUTE_DIRECTORY != 0: + m |= fs.ModeDir | 0o111 // e.g. 0o444 -> 0o555 + } + + st := sys.Stat_t{} + // FileIndex{High,Low} can be combined and used as a unique identifier like inode. + // https://learn.microsoft.com/en-us/windows/win32/api/fileapi/ns-fileapi-by_handle_file_information + st.Dev = uint64(fi.VolumeSerialNumber) + st.Ino = (uint64(fi.FileIndexHigh) << 32) | uint64(fi.FileIndexLow) + st.Mode = m + st.Nlink = uint64(fi.NumberOfLinks) + st.Size = int64(fi.FileSizeHigh)<<32 + int64(fi.FileSizeLow) + st.Atim = fi.LastAccessTime.Nanoseconds() + st.Mtim = fi.LastWriteTime.Nanoseconds() + st.Ctim = fi.CreationTime.Nanoseconds() + return st, 0 +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/sync.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/sync.go new file mode 100644 index 000000000..86f9a0865 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/sync.go @@ -0,0 +1,13 @@ +//go:build !windows + +package sysfs + +import ( + "os" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +func fsync(f *os.File) sys.Errno { + return sys.UnwrapOSError(f.Sync()) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/sync_windows.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/sync_windows.go new file mode 100644 index 000000000..f288eb25b --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/sync_windows.go @@ -0,0 +1,20 @@ +package sysfs + +import ( + "os" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +func fsync(f *os.File) sys.Errno { + errno := sys.UnwrapOSError(f.Sync()) + // Coerce error performing stat on a directory to 0, as it won't work + // on Windows. + switch errno { + case sys.EACCES /* Go 1.20 */, sys.EBADF /* Go 1.19 */ : + if st, err := f.Stat(); err == nil && st.IsDir() { + errno = 0 + } + } + return errno +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/syscall6_darwin.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/syscall6_darwin.go new file mode 100644 index 000000000..9fde5baa5 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/syscall6_darwin.go @@ -0,0 +1,13 @@ +package sysfs + +import ( + "syscall" + _ "unsafe" +) + +// syscall_syscall6 is a private symbol that we link below. We need to use this +// instead of syscall.Syscall6 because the public syscall.Syscall6 won't work +// when fn is an address. +// +//go:linkname syscall_syscall6 syscall.syscall6 +func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/sysfs.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/sysfs.go new file mode 100644 index 000000000..e0ebfe5b9 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/sysfs.go @@ -0,0 +1,6 @@ +// Package sysfs includes a low-level filesystem interface and utilities needed +// for WebAssembly host functions (ABI) such as WASI and runtime.GOOS=js. +// +// The name sysfs was chosen because wazero's public API has a "sys" package, +// which was named after https://github.com/golang/sys. +package sysfs diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/testdata/empty.txt b/vendor/github.com/tetratelabs/wazero/internal/sysfs/testdata/empty.txt new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/testdata/wazero.txt b/vendor/github.com/tetratelabs/wazero/internal/sysfs/testdata/wazero.txt new file mode 100644 index 000000000..3058e8056 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/testdata/wazero.txt @@ -0,0 +1 @@ +wazero diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/unlink.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/unlink.go new file mode 100644 index 000000000..4f7dbe3fe --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/unlink.go @@ -0,0 +1,17 @@ +//go:build !windows && !plan9 + +package sysfs + +import ( + "syscall" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +func unlink(name string) (errno sys.Errno) { + err := syscall.Unlink(name) + if errno = sys.UnwrapOSError(err); errno == sys.EPERM { + errno = sys.EISDIR + } + return errno +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/unlink_plan9.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/unlink_plan9.go new file mode 100644 index 000000000..16ed06ab2 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/unlink_plan9.go @@ -0,0 +1,12 @@ +package sysfs + +import ( + "syscall" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +func unlink(name string) sys.Errno { + err := syscall.Remove(name) + return sys.UnwrapOSError(err) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/unlink_windows.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/unlink_windows.go new file mode 100644 index 000000000..be31c7b91 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/unlink_windows.go @@ -0,0 +1,25 @@ +package sysfs + +import ( + "os" + "syscall" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +func unlink(name string) sys.Errno { + err := syscall.Unlink(name) + if err == nil { + return 0 + } + errno := sys.UnwrapOSError(err) + if errno == sys.EBADF { + lstat, errLstat := os.Lstat(name) + if errLstat == nil && lstat.Mode()&os.ModeSymlink != 0 { + errno = sys.UnwrapOSError(os.Remove(name)) + } else { + errno = sys.EISDIR + } + } + return errno +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/u32/u32.go b/vendor/github.com/tetratelabs/wazero/internal/u32/u32.go new file mode 100644 index 000000000..5960a6f0c --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/u32/u32.go @@ -0,0 +1,11 @@ +package u32 + +// LeBytes returns a byte slice corresponding to the 4 bytes in the uint32 in little-endian byte order. +func LeBytes(v uint32) []byte { + return []byte{ + byte(v), + byte(v >> 8), + byte(v >> 16), + byte(v >> 24), + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/u64/u64.go b/vendor/github.com/tetratelabs/wazero/internal/u64/u64.go new file mode 100644 index 000000000..65c7cd124 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/u64/u64.go @@ -0,0 +1,15 @@ +package u64 + +// LeBytes returns a byte slice corresponding to the 8 bytes in the uint64 in little-endian byte order. +func LeBytes(v uint64) []byte { + return []byte{ + byte(v), + byte(v >> 8), + byte(v >> 16), + byte(v >> 24), + byte(v >> 32), + byte(v >> 40), + byte(v >> 48), + byte(v >> 56), + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/version/version.go b/vendor/github.com/tetratelabs/wazero/internal/version/version.go new file mode 100644 index 000000000..9261df0f7 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/version/version.go @@ -0,0 +1,52 @@ +package version + +import ( + "runtime/debug" + "strings" +) + +// Default is the default version value used when none was found. +const Default = "dev" + +// version holds the current version from the go.mod of downstream users or set by ldflag for wazero CLI. +var version string + +// GetWazeroVersion returns the current version of wazero either in the go.mod or set by ldflag for wazero CLI. +// +// If this is not CLI, this assumes that downstream users of wazero imports wazero as "github.com/tetratelabs/wazero". +// To be precise, the returned string matches the require statement there. +// For example, if the go.mod has "require github.com/tetratelabs/wazero 0.1.2-12314124-abcd", +// then this returns "0.1.2-12314124-abcd". +// +// Note: this is tested in ./testdata/main_test.go with a separate go.mod to pretend as the wazero user. +func GetWazeroVersion() (ret string) { + if len(version) != 0 { + return version + } + + info, ok := debug.ReadBuildInfo() + if ok { + for _, dep := range info.Deps { + // Note: here's the assumption that wazero is imported as github.com/tetratelabs/wazero. + if strings.Contains(dep.Path, "github.com/tetratelabs/wazero") { + ret = dep.Version + } + } + + // In wazero CLI, wazero is a main module, so we have to get the version info from info.Main. + if versionMissing(ret) { + ret = info.Main.Version + } + } + if versionMissing(ret) { + return Default // don't return parens + } + + // Cache for the subsequent calls. + version = ret + return ret +} + +func versionMissing(ret string) bool { + return ret == "" || ret == "(devel)" // pkg.go defaults to (devel) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasip1/args.go b/vendor/github.com/tetratelabs/wazero/internal/wasip1/args.go new file mode 100644 index 000000000..212d3b2de --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasip1/args.go @@ -0,0 +1,6 @@ +package wasip1 + +const ( + ArgsGetName = "args_get" + ArgsSizesGetName = "args_sizes_get" +) diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasip1/clock.go b/vendor/github.com/tetratelabs/wazero/internal/wasip1/clock.go new file mode 100644 index 000000000..1d1b8c12d --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasip1/clock.go @@ -0,0 +1,16 @@ +package wasip1 + +const ( + ClockResGetName = "clock_res_get" + ClockTimeGetName = "clock_time_get" +) + +// https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-clockid-enumu32 +const ( + // ClockIDRealtime is the name ID named "realtime" like sys.Walltime + ClockIDRealtime = iota + // ClockIDMonotonic is the name ID named "monotonic" like sys.Nanotime + ClockIDMonotonic + // Note: clockIDProcessCputime and clockIDThreadCputime were removed by + // WASI maintainers: https://github.com/WebAssembly/wasi-libc/pull/294 +) diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasip1/environ.go b/vendor/github.com/tetratelabs/wazero/internal/wasip1/environ.go new file mode 100644 index 000000000..2b0d59828 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasip1/environ.go @@ -0,0 +1,6 @@ +package wasip1 + +const ( + EnvironGetName = "environ_get" + EnvironSizesGetName = "environ_sizes_get" +) diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasip1/errno.go b/vendor/github.com/tetratelabs/wazero/internal/wasip1/errno.go new file mode 100644 index 000000000..701c2aa4f --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasip1/errno.go @@ -0,0 +1,314 @@ +package wasip1 + +import ( + "fmt" + + "github.com/tetratelabs/wazero/experimental/sys" +) + +// Errno is neither uint16 nor an alias for parity with wasm.ValueType. +type Errno = uint32 + +// ErrnoName returns the POSIX error code name, except ErrnoSuccess, which is +// not an error. e.g. Errno2big -> "E2BIG" +func ErrnoName(errno uint32) string { + if int(errno) < len(errnoToString) { + return errnoToString[errno] + } + return fmt.Sprintf("errno(%d)", errno) +} + +// Note: Below prefers POSIX symbol names over WASI ones, even if the docs are from WASI. +// See https://linux.die.net/man/3/errno +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#variants-1 +const ( + // ErrnoSuccess No error occurred. System call completed successfully. + ErrnoSuccess Errno = iota + // Errno2big Argument list too long. + Errno2big + // ErrnoAcces Permission denied. + ErrnoAcces + // ErrnoAddrinuse Address in use. + ErrnoAddrinuse + // ErrnoAddrnotavail Address not available. + ErrnoAddrnotavail + // ErrnoAfnosupport Address family not supported. + ErrnoAfnosupport + // ErrnoAgain Resource unavailable, or operation would block. + ErrnoAgain + // ErrnoAlready Connection already in progress. + ErrnoAlready + // ErrnoBadf Bad file descriptor. + ErrnoBadf + // ErrnoBadmsg Bad message. + ErrnoBadmsg + // ErrnoBusy Device or resource busy. + ErrnoBusy + // ErrnoCanceled Operation canceled. + ErrnoCanceled + // ErrnoChild No child processes. + ErrnoChild + // ErrnoConnaborted Connection aborted. + ErrnoConnaborted + // ErrnoConnrefused Connection refused. + ErrnoConnrefused + // ErrnoConnreset Connection reset. + ErrnoConnreset + // ErrnoDeadlk Resource deadlock would occur. + ErrnoDeadlk + // ErrnoDestaddrreq Destination address required. + ErrnoDestaddrreq + // ErrnoDom Mathematics argument out of domain of function. + ErrnoDom + // ErrnoDquot Reserved. + ErrnoDquot + // ErrnoExist File exists. + ErrnoExist + // ErrnoFault Bad address. + ErrnoFault + // ErrnoFbig File too large. + ErrnoFbig + // ErrnoHostunreach Host is unreachable. + ErrnoHostunreach + // ErrnoIdrm Identifier removed. + ErrnoIdrm + // ErrnoIlseq Illegal byte sequence. + ErrnoIlseq + // ErrnoInprogress Operation in progress. + ErrnoInprogress + // ErrnoIntr Interrupted function. + ErrnoIntr + // ErrnoInval Invalid argument. + ErrnoInval + // ErrnoIo I/O error. + ErrnoIo + // ErrnoIsconn Socket is connected. + ErrnoIsconn + // ErrnoIsdir Is a directory. + ErrnoIsdir + // ErrnoLoop Too many levels of symbolic links. + ErrnoLoop + // ErrnoMfile File descriptor value too large. + ErrnoMfile + // ErrnoMlink Too many links. + ErrnoMlink + // ErrnoMsgsize Message too large. + ErrnoMsgsize + // ErrnoMultihop Reserved. + ErrnoMultihop + // ErrnoNametoolong Filename too long. + ErrnoNametoolong + // ErrnoNetdown Network is down. + ErrnoNetdown + // ErrnoNetreset Connection aborted by network. + ErrnoNetreset + // ErrnoNetunreach Network unreachable. + ErrnoNetunreach + // ErrnoNfile Too many files open in system. + ErrnoNfile + // ErrnoNobufs No buffer space available. + ErrnoNobufs + // ErrnoNodev No such device. + ErrnoNodev + // ErrnoNoent No such file or directory. + ErrnoNoent + // ErrnoNoexec Executable file format error. + ErrnoNoexec + // ErrnoNolck No locks available. + ErrnoNolck + // ErrnoNolink Reserved. + ErrnoNolink + // ErrnoNomem Not enough space. + ErrnoNomem + // ErrnoNomsg No message of the desired type. + ErrnoNomsg + // ErrnoNoprotoopt No message of the desired type. + ErrnoNoprotoopt + // ErrnoNospc No space left on device. + ErrnoNospc + // ErrnoNosys function not supported. + ErrnoNosys + // ErrnoNotconn The socket is not connected. + ErrnoNotconn + // ErrnoNotdir Not a directory or a symbolic link to a directory. + ErrnoNotdir + // ErrnoNotempty Directory not empty. + ErrnoNotempty + // ErrnoNotrecoverable State not recoverable. + ErrnoNotrecoverable + // ErrnoNotsock Not a socket. + ErrnoNotsock + // ErrnoNotsup Not supported, or operation not supported on socket. + ErrnoNotsup + // ErrnoNotty Inappropriate I/O control operation. + ErrnoNotty + // ErrnoNxio No such device or address. + ErrnoNxio + // ErrnoOverflow Value too large to be stored in data type. + ErrnoOverflow + // ErrnoOwnerdead Previous owner died. + ErrnoOwnerdead + // ErrnoPerm Operation not permitted. + ErrnoPerm + // ErrnoPipe Broken pipe. + ErrnoPipe + // ErrnoProto Protocol error. + ErrnoProto + // ErrnoProtonosupport Protocol error. + ErrnoProtonosupport + // ErrnoPrototype Protocol wrong type for socket. + ErrnoPrototype + // ErrnoRange Result too large. + ErrnoRange + // ErrnoRofs Read-only file system. + ErrnoRofs + // ErrnoSpipe Invalid seek. + ErrnoSpipe + // ErrnoSrch No such process. + ErrnoSrch + // ErrnoStale Reserved. + ErrnoStale + // ErrnoTimedout Connection timed out. + ErrnoTimedout + // ErrnoTxtbsy Text file busy. + ErrnoTxtbsy + // ErrnoXdev Cross-device link. + ErrnoXdev + + // Note: ErrnoNotcapable was removed by WASI maintainers. + // See https://github.com/WebAssembly/wasi-libc/pull/294 +) + +var errnoToString = [...]string{ + "ESUCCESS", + "E2BIG", + "EACCES", + "EADDRINUSE", + "EADDRNOTAVAIL", + "EAFNOSUPPORT", + "EAGAIN", + "EALREADY", + "EBADF", + "EBADMSG", + "EBUSY", + "ECANCELED", + "ECHILD", + "ECONNABORTED", + "ECONNREFUSED", + "ECONNRESET", + "EDEADLK", + "EDESTADDRREQ", + "EDOM", + "EDQUOT", + "EEXIST", + "EFAULT", + "EFBIG", + "EHOSTUNREACH", + "EIDRM", + "EILSEQ", + "EINPROGRESS", + "EINTR", + "EINVAL", + "EIO", + "EISCONN", + "EISDIR", + "ELOOP", + "EMFILE", + "EMLINK", + "EMSGSIZE", + "EMULTIHOP", + "ENAMETOOLONG", + "ENETDOWN", + "ENETRESET", + "ENETUNREACH", + "ENFILE", + "ENOBUFS", + "ENODEV", + "ENOENT", + "ENOEXEC", + "ENOLCK", + "ENOLINK", + "ENOMEM", + "ENOMSG", + "ENOPROTOOPT", + "ENOSPC", + "ENOSYS", + "ENOTCONN", + "ENOTDIR", + "ENOTEMPTY", + "ENOTRECOVERABLE", + "ENOTSOCK", + "ENOTSUP", + "ENOTTY", + "ENXIO", + "EOVERFLOW", + "EOWNERDEAD", + "EPERM", + "EPIPE", + "EPROTO", + "EPROTONOSUPPORT", + "EPROTOTYPE", + "ERANGE", + "EROFS", + "ESPIPE", + "ESRCH", + "ESTALE", + "ETIMEDOUT", + "ETXTBSY", + "EXDEV", + "ENOTCAPABLE", +} + +// ToErrno coerces the error to a WASI Errno. +// +// Note: Coercion isn't centralized in sys.FSContext because ABI use different +// error codes. For example, wasi-filesystem and GOOS=js don't map to these +// Errno. +func ToErrno(errno sys.Errno) Errno { + switch errno { + case 0: + return ErrnoSuccess + case sys.EACCES: + return ErrnoAcces + case sys.EAGAIN: + return ErrnoAgain + case sys.EBADF: + return ErrnoBadf + case sys.EEXIST: + return ErrnoExist + case sys.EFAULT: + return ErrnoFault + case sys.EINTR: + return ErrnoIntr + case sys.EINVAL: + return ErrnoInval + case sys.EIO: + return ErrnoIo + case sys.EISDIR: + return ErrnoIsdir + case sys.ELOOP: + return ErrnoLoop + case sys.ENAMETOOLONG: + return ErrnoNametoolong + case sys.ENOENT: + return ErrnoNoent + case sys.ENOSYS: + return ErrnoNosys + case sys.ENOTDIR: + return ErrnoNotdir + case sys.ERANGE: + return ErrnoRange + case sys.ENOTEMPTY: + return ErrnoNotempty + case sys.ENOTSOCK: + return ErrnoNotsock + case sys.ENOTSUP: + return ErrnoNotsup + case sys.EPERM: + return ErrnoPerm + case sys.EROFS: + return ErrnoRofs + default: + return ErrnoIo + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasip1/fs.go b/vendor/github.com/tetratelabs/wazero/internal/wasip1/fs.go new file mode 100644 index 000000000..ed8df1edc --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasip1/fs.go @@ -0,0 +1,164 @@ +package wasip1 + +import ( + "fmt" +) + +const ( + FdAdviseName = "fd_advise" + FdAllocateName = "fd_allocate" + FdCloseName = "fd_close" + FdDatasyncName = "fd_datasync" + FdFdstatGetName = "fd_fdstat_get" + FdFdstatSetFlagsName = "fd_fdstat_set_flags" + FdFdstatSetRightsName = "fd_fdstat_set_rights" + FdFilestatGetName = "fd_filestat_get" + FdFilestatSetSizeName = "fd_filestat_set_size" + FdFilestatSetTimesName = "fd_filestat_set_times" + FdPreadName = "fd_pread" + FdPrestatGetName = "fd_prestat_get" + FdPrestatDirNameName = "fd_prestat_dir_name" + FdPwriteName = "fd_pwrite" + FdReadName = "fd_read" + FdReaddirName = "fd_readdir" + FdRenumberName = "fd_renumber" + FdSeekName = "fd_seek" + FdSyncName = "fd_sync" + FdTellName = "fd_tell" + FdWriteName = "fd_write" + + PathCreateDirectoryName = "path_create_directory" + PathFilestatGetName = "path_filestat_get" + PathFilestatSetTimesName = "path_filestat_set_times" + PathLinkName = "path_link" + PathOpenName = "path_open" + PathReadlinkName = "path_readlink" + PathRemoveDirectoryName = "path_remove_directory" + PathRenameName = "path_rename" + PathSymlinkName = "path_symlink" + PathUnlinkFileName = "path_unlink_file" +) + +// oflags are open flags used by path_open +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-oflags-flagsu16 +const ( + // O_CREAT creates a file if it does not exist. + O_CREAT uint16 = 1 << iota //nolint + // O_DIRECTORY fails if not a directory. + O_DIRECTORY + // O_EXCL fails if file already exists. + O_EXCL //nolint + // O_TRUNC truncates the file to size 0. + O_TRUNC //nolint +) + +func OflagsString(oflags int) string { + return flagsString(oflagNames[:], oflags) +} + +var oflagNames = [...]string{ + "CREAT", + "DIRECTORY", + "EXCL", + "TRUNC", +} + +// file descriptor flags +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#fdflags +const ( + FD_APPEND uint16 = 1 << iota //nolint + FD_DSYNC + FD_NONBLOCK + FD_RSYNC + FD_SYNC +) + +func FdFlagsString(fdflags int) string { + return flagsString(fdflagNames[:], fdflags) +} + +var fdflagNames = [...]string{ + "APPEND", + "DSYNC", + "NONBLOCK", + "RSYNC", + "SYNC", +} + +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#lookupflags +const ( + // LOOKUP_SYMLINK_FOLLOW expands a path if it resolves into a symbolic + // link. + LOOKUP_SYMLINK_FOLLOW uint16 = 1 << iota //nolint +) + +var lookupflagNames = [...]string{ + "SYMLINK_FOLLOW", +} + +func LookupflagsString(lookupflags int) string { + return flagsString(lookupflagNames[:], lookupflags) +} + +// DirentSize is the size of the dirent struct, which should be followed by the +// length of a file name. +const DirentSize = uint32(24) + +const ( + FILETYPE_UNKNOWN uint8 = iota + FILETYPE_BLOCK_DEVICE + FILETYPE_CHARACTER_DEVICE + FILETYPE_DIRECTORY + FILETYPE_REGULAR_FILE + FILETYPE_SOCKET_DGRAM + FILETYPE_SOCKET_STREAM + FILETYPE_SYMBOLIC_LINK +) + +// FiletypeName returns string name of the file type. +func FiletypeName(filetype uint8) string { + if int(filetype) < len(filetypeToString) { + return filetypeToString[filetype] + } + return fmt.Sprintf("filetype(%d)", filetype) +} + +var filetypeToString = [...]string{ + "UNKNOWN", + "BLOCK_DEVICE", + "CHARACTER_DEVICE", + "DIRECTORY", + "REGULAR_FILE", + "SOCKET_DGRAM", + "SOCKET_STREAM", + "SYMBOLIC_LINK", +} + +// https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#fstflags +const ( + FstflagsAtim uint16 = 1 << iota + FstflagsAtimNow + FstflagsMtim + FstflagsMtimNow +) + +var fstflagNames = [...]string{ + "ATIM", + "ATIM_NOW", + "MTIM", + "MTIM_NOW", +} + +func FstflagsString(fdflags int) string { + return flagsString(fstflagNames[:], fdflags) +} + +// https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-advice-enumu8 +const ( + FdAdviceNormal byte = iota + FdAdviceSequential + FdAdviceRandom + FdAdviceWillNeed + FdAdviceDontNeed + FdAdviceNoReuse +) diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasip1/poll.go b/vendor/github.com/tetratelabs/wazero/internal/wasip1/poll.go new file mode 100644 index 000000000..9bde768f2 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasip1/poll.go @@ -0,0 +1,15 @@ +package wasip1 + +// https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-eventtype-enumu8 +const ( + // EventTypeClock is the timeout event named "name". + EventTypeClock = iota + // EventTypeFdRead is the data available event named "fd_read". + EventTypeFdRead + // EventTypeFdWrite is the capacity available event named "fd_write". + EventTypeFdWrite +) + +const ( + PollOneoffName = "poll_oneoff" +) diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasip1/proc.go b/vendor/github.com/tetratelabs/wazero/internal/wasip1/proc.go new file mode 100644 index 000000000..50b040c98 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasip1/proc.go @@ -0,0 +1,6 @@ +package wasip1 + +const ( + ProcExitName = "proc_exit" + ProcRaiseName = "proc_raise" +) diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasip1/random.go b/vendor/github.com/tetratelabs/wazero/internal/wasip1/random.go new file mode 100644 index 000000000..236453374 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasip1/random.go @@ -0,0 +1,3 @@ +package wasip1 + +const RandomGetName = "random_get" diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasip1/rights.go b/vendor/github.com/tetratelabs/wazero/internal/wasip1/rights.go new file mode 100644 index 000000000..2ab56c604 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasip1/rights.go @@ -0,0 +1,148 @@ +package wasip1 + +// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-rights-flagsu64 +const ( + // RIGHT_FD_DATASYNC is the right to invoke fd_datasync. If RIGHT_PATH_OPEN + // is set, includes the right to invoke path_open with FD_DSYNC. + RIGHT_FD_DATASYNC uint32 = 1 << iota //nolint + + // RIGHT_FD_READ is he right to invoke fd_read and sock_recv. If + // RIGHT_FD_SYNC is set, includes the right to invoke fd_pread. + RIGHT_FD_READ + + // RIGHT_FD_SEEK is the right to invoke fd_seek. This flag implies + // RIGHT_FD_TELL. + RIGHT_FD_SEEK + + // RIGHT_FDSTAT_SET_FLAGS is the right to invoke fd_fdstat_set_flags. + RIGHT_FDSTAT_SET_FLAGS + + // RIGHT_FD_SYNC The right to invoke fd_sync. If path_open is set, includes + // the right to invoke path_open with FD_RSYNC and FD_DSYNC. + RIGHT_FD_SYNC + + // RIGHT_FD_TELL is the right to invoke fd_seek in such a way that the file + // offset remains unaltered (i.e., whence::cur with offset zero), or to + // invoke fd_tell. + RIGHT_FD_TELL + + // RIGHT_FD_WRITE is the right to invoke fd_write and sock_send. If + // RIGHT_FD_SEEK is set, includes the right to invoke fd_pwrite. + RIGHT_FD_WRITE + + // RIGHT_FD_ADVISE is the right to invoke fd_advise. + RIGHT_FD_ADVISE + + // RIGHT_FD_ALLOCATE is the right to invoke fd_allocate. + RIGHT_FD_ALLOCATE + + // RIGHT_PATH_CREATE_DIRECTORY is the right to invoke + // path_create_directory. + RIGHT_PATH_CREATE_DIRECTORY + + // RIGHT_PATH_CREATE_FILE when RIGHT_PATH_OPEN is set, the right to invoke + // path_open with O_CREAT. + RIGHT_PATH_CREATE_FILE + + // RIGHT_PATH_LINK_SOURCE is the right to invoke path_link with the file + // descriptor as the source directory. + RIGHT_PATH_LINK_SOURCE + + // RIGHT_PATH_LINK_TARGET is the right to invoke path_link with the file + // descriptor as the target directory. + RIGHT_PATH_LINK_TARGET + + // RIGHT_PATH_OPEN is the right to invoke path_open. + RIGHT_PATH_OPEN + + // RIGHT_FD_READDIR is the right to invoke fd_readdir. + RIGHT_FD_READDIR + + // RIGHT_PATH_READLINK is the right to invoke path_readlink. + RIGHT_PATH_READLINK + + // RIGHT_PATH_RENAME_SOURCE is the right to invoke path_rename with the + // file descriptor as the source directory. + RIGHT_PATH_RENAME_SOURCE + + // RIGHT_PATH_RENAME_TARGET is the right to invoke path_rename with the + // file descriptor as the target directory. + RIGHT_PATH_RENAME_TARGET + + // RIGHT_PATH_FILESTAT_GET is the right to invoke path_filestat_get. + RIGHT_PATH_FILESTAT_GET + + // RIGHT_PATH_FILESTAT_SET_SIZE is the right to change a file's size (there + // is no path_filestat_set_size). If RIGHT_PATH_OPEN is set, includes the + // right to invoke path_open with O_TRUNC. + RIGHT_PATH_FILESTAT_SET_SIZE + + // RIGHT_PATH_FILESTAT_SET_TIMES is the right to invoke + // path_filestat_set_times. + RIGHT_PATH_FILESTAT_SET_TIMES + + // RIGHT_FD_FILESTAT_GET is the right to invoke fd_filestat_get. + RIGHT_FD_FILESTAT_GET + + // RIGHT_FD_FILESTAT_SET_SIZE is the right to invoke fd_filestat_set_size. + RIGHT_FD_FILESTAT_SET_SIZE + + // RIGHT_FD_FILESTAT_SET_TIMES is the right to invoke + // fd_filestat_set_times. + RIGHT_FD_FILESTAT_SET_TIMES + + // RIGHT_PATH_SYMLINK is the right to invoke path_symlink. + RIGHT_PATH_SYMLINK + + // RIGHT_PATH_REMOVE_DIRECTORY is the right to invoke + // path_remove_directory. + RIGHT_PATH_REMOVE_DIRECTORY + + // RIGHT_PATH_UNLINK_FILE is the right to invoke path_unlink_file. + RIGHT_PATH_UNLINK_FILE + + // RIGHT_POLL_FD_READWRITE when RIGHT_FD_READ is set, includes the right to + // invoke poll_oneoff to subscribe to eventtype::fd_read. If RIGHT_FD_WRITE + // is set, includes the right to invoke poll_oneoff to subscribe to + // eventtype::fd_write. + RIGHT_POLL_FD_READWRITE + + // RIGHT_SOCK_SHUTDOWN is the right to invoke sock_shutdown. + RIGHT_SOCK_SHUTDOWN +) + +func RightsString(rights int) string { + return flagsString(rightNames[:], rights) +} + +var rightNames = [...]string{ + "FD_DATASYNC", + "FD_READ", + "FD_SEEK", + "FDSTAT_SET_FLAGS", + "FD_SYNC", + "FD_TELL", + "FD_WRITE", + "FD_ADVISE", + "FD_ALLOCATE", + "PATH_CREATE_DIRECTORY", + "PATH_CREATE_FILE", + "PATH_LINK_SOURCE", + "PATH_LINK_TARGET", + "PATH_OPEN", + "FD_READDIR", + "PATH_READLINK", + "PATH_RENAME_SOURCE", + "PATH_RENAME_TARGET", + "PATH_FILESTAT_GET", + "PATH_FILESTAT_SET_SIZE", + "PATH_FILESTAT_SET_TIMES", + "FD_FILESTAT_GET", + "FD_FILESTAT_SET_SIZE", + "FD_FILESTAT_SET_TIMES", + "PATH_SYMLINK", + "PATH_REMOVE_DIRECTORY", + "PATH_UNLINK_FILE", + "POLL_FD_READWRITE", + "SOCK_SHUTDOWN", +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasip1/sched.go b/vendor/github.com/tetratelabs/wazero/internal/wasip1/sched.go new file mode 100644 index 000000000..bc6e39385 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasip1/sched.go @@ -0,0 +1,3 @@ +package wasip1 + +const SchedYieldName = "sched_yield" diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasip1/sock.go b/vendor/github.com/tetratelabs/wazero/internal/wasip1/sock.go new file mode 100644 index 000000000..90d33ece8 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasip1/sock.go @@ -0,0 +1,71 @@ +package wasip1 + +import "strconv" + +const ( + SockAcceptName = "sock_accept" + SockRecvName = "sock_recv" + SockSendName = "sock_send" + SockShutdownName = "sock_shutdown" +) + +// SD Flags indicate which channels on a socket to shut down. +// https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-sdflags-flagsu8 +const ( + // SD_RD disables further receive operations. + SD_RD uint8 = 1 << iota //nolint + // SD_WR disables further send operations. + SD_WR +) + +func SdFlagsString(sdflags int) string { + return flagsString(sdflagNames[:], sdflags) +} + +var sdflagNames = [...]string{ + "RD", + "WR", +} + +// SI Flags are flags provided to sock_send. As there are currently no flags defined, it must be set to zero. +// https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-siflags-u16 + +func SiFlagsString(siflags int) string { + if siflags == 0 { + return "" + } + return strconv.Itoa(siflags) +} + +// RI Flags are flags provided to sock_recv. +// https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-riflags-flagsu16 +const ( + // RI_RECV_PEEK returns the message without removing it from the socket's receive queue + RI_RECV_PEEK uint8 = 1 << iota //nolint + // RI_RECV_WAITALL on byte-stream sockets, block until the full amount of data can be returned. + RI_RECV_WAITALL +) + +func RiFlagsString(riflags int) string { + return flagsString(riflagNames[:], riflags) +} + +var riflagNames = [...]string{ + "RECV_PEEK", + "RECV_WAITALL", +} + +// RO Flags are flags returned by sock_recv. +// https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-roflags-flagsu16 +const ( + // RO_RECV_DATA_TRUNCATED is returned by sock_recv when message data has been truncated. + RO_RECV_DATA_TRUNCATED uint8 = 1 << iota //nolint +) + +func RoFlagsString(roflags int) string { + return flagsString(roflagNames[:], roflags) +} + +var roflagNames = [...]string{ + "RECV_DATA_TRUNCATED", +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasip1/wasi.go b/vendor/github.com/tetratelabs/wazero/internal/wasip1/wasi.go new file mode 100644 index 000000000..299feea2f --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasip1/wasi.go @@ -0,0 +1,26 @@ +// Package wasip1 is a helper to remove package cycles re-using constants. +package wasip1 + +import ( + "strings" +) + +// InternalModuleName is not named ModuleName, to avoid a clash on dot imports. +const InternalModuleName = "wasi_snapshot_preview1" + +func flagsString(names []string, f int) string { + var builder strings.Builder + first := true + for i, sf := range names { + target := 1 << i + if target&f != 0 { + if !first { + builder.WriteByte('|') + } else { + first = false + } + builder.WriteString(sf) + } + } + return builder.String() +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/code.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/code.go new file mode 100644 index 000000000..2fac9196c --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/code.go @@ -0,0 +1,100 @@ +package binary + +import ( + "bytes" + "fmt" + "io" + "math" + + "github.com/tetratelabs/wazero/internal/leb128" + "github.com/tetratelabs/wazero/internal/wasm" +) + +func decodeCode(r *bytes.Reader, codeSectionStart uint64, ret *wasm.Code) (err error) { + ss, _, err := leb128.DecodeUint32(r) + if err != nil { + return fmt.Errorf("get the size of code: %w", err) + } + remaining := int64(ss) + + // Parse #locals. + ls, bytesRead, err := leb128.DecodeUint32(r) + remaining -= int64(bytesRead) + if err != nil { + return fmt.Errorf("get the size locals: %v", err) + } else if remaining < 0 { + return io.EOF + } + + // Validate the locals. + bytesRead = 0 + var sum uint64 + for i := uint32(0); i < ls; i++ { + num, n, err := leb128.DecodeUint32(r) + if err != nil { + return fmt.Errorf("read n of locals: %v", err) + } else if remaining < 0 { + return io.EOF + } + + sum += uint64(num) + + b, err := r.ReadByte() + if err != nil { + return fmt.Errorf("read type of local: %v", err) + } + + bytesRead += n + 1 + switch vt := b; vt { + case wasm.ValueTypeI32, wasm.ValueTypeF32, wasm.ValueTypeI64, wasm.ValueTypeF64, + wasm.ValueTypeFuncref, wasm.ValueTypeExternref, wasm.ValueTypeV128: + default: + return fmt.Errorf("invalid local type: 0x%x", vt) + } + } + + if sum > math.MaxUint32 { + return fmt.Errorf("too many locals: %d", sum) + } + + // Rewind the buffer. + _, err = r.Seek(-int64(bytesRead), io.SeekCurrent) + if err != nil { + return err + } + + localTypes := make([]wasm.ValueType, 0, sum) + for i := uint32(0); i < ls; i++ { + num, bytesRead, err := leb128.DecodeUint32(r) + remaining -= int64(bytesRead) + 1 // +1 for the subsequent ReadByte + if err != nil { + return fmt.Errorf("read n of locals: %v", err) + } else if remaining < 0 { + return io.EOF + } + + b, err := r.ReadByte() + if err != nil { + return fmt.Errorf("read type of local: %v", err) + } + + for j := uint32(0); j < num; j++ { + localTypes = append(localTypes, b) + } + } + + bodyOffsetInCodeSection := codeSectionStart - uint64(r.Len()) + body := make([]byte, remaining) + if _, err = io.ReadFull(r, body); err != nil { + return fmt.Errorf("read body: %w", err) + } + + if endIndex := len(body) - 1; endIndex < 0 || body[endIndex] != wasm.OpcodeEnd { + return fmt.Errorf("expr not end with OpcodeEnd") + } + + ret.BodyOffsetInCodeSection = bodyOffsetInCodeSection + ret.LocalTypes = localTypes + ret.Body = body + return nil +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/const_expr.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/const_expr.go new file mode 100644 index 000000000..edfc0a086 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/const_expr.go @@ -0,0 +1,105 @@ +package binary + +import ( + "bytes" + "fmt" + "io" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/ieee754" + "github.com/tetratelabs/wazero/internal/leb128" + "github.com/tetratelabs/wazero/internal/wasm" +) + +func decodeConstantExpression(r *bytes.Reader, enabledFeatures api.CoreFeatures, ret *wasm.ConstantExpression) error { + b, err := r.ReadByte() + if err != nil { + return fmt.Errorf("read opcode: %v", err) + } + + remainingBeforeData := int64(r.Len()) + offsetAtData := r.Size() - remainingBeforeData + + opcode := b + switch opcode { + case wasm.OpcodeI32Const: + // Treat constants as signed as their interpretation is not yet known per /RATIONALE.md + _, _, err = leb128.DecodeInt32(r) + case wasm.OpcodeI64Const: + // Treat constants as signed as their interpretation is not yet known per /RATIONALE.md + _, _, err = leb128.DecodeInt64(r) + case wasm.OpcodeF32Const: + buf := make([]byte, 4) + if _, err := io.ReadFull(r, buf); err != nil { + return fmt.Errorf("read f32 constant: %v", err) + } + _, err = ieee754.DecodeFloat32(buf) + case wasm.OpcodeF64Const: + buf := make([]byte, 8) + if _, err := io.ReadFull(r, buf); err != nil { + return fmt.Errorf("read f64 constant: %v", err) + } + _, err = ieee754.DecodeFloat64(buf) + case wasm.OpcodeGlobalGet: + _, _, err = leb128.DecodeUint32(r) + case wasm.OpcodeRefNull: + if err := enabledFeatures.RequireEnabled(api.CoreFeatureBulkMemoryOperations); err != nil { + return fmt.Errorf("ref.null is not supported as %w", err) + } + reftype, err := r.ReadByte() + if err != nil { + return fmt.Errorf("read reference type for ref.null: %w", err) + } else if reftype != wasm.RefTypeFuncref && reftype != wasm.RefTypeExternref { + return fmt.Errorf("invalid type for ref.null: 0x%x", reftype) + } + case wasm.OpcodeRefFunc: + if err := enabledFeatures.RequireEnabled(api.CoreFeatureBulkMemoryOperations); err != nil { + return fmt.Errorf("ref.func is not supported as %w", err) + } + // Parsing index. + _, _, err = leb128.DecodeUint32(r) + case wasm.OpcodeVecPrefix: + if err := enabledFeatures.RequireEnabled(api.CoreFeatureSIMD); err != nil { + return fmt.Errorf("vector instructions are not supported as %w", err) + } + opcode, err = r.ReadByte() + if err != nil { + return fmt.Errorf("read vector instruction opcode suffix: %w", err) + } + + if opcode != wasm.OpcodeVecV128Const { + return fmt.Errorf("invalid vector opcode for const expression: %#x", opcode) + } + + remainingBeforeData = int64(r.Len()) + offsetAtData = r.Size() - remainingBeforeData + + n, err := r.Read(make([]byte, 16)) + if err != nil { + return fmt.Errorf("read vector const instruction immediates: %w", err) + } else if n != 16 { + return fmt.Errorf("read vector const instruction immediates: needs 16 bytes but was %d bytes", n) + } + default: + return fmt.Errorf("%v for const expression opt code: %#x", ErrInvalidByte, b) + } + + if err != nil { + return fmt.Errorf("read value: %v", err) + } + + if b, err = r.ReadByte(); err != nil { + return fmt.Errorf("look for end opcode: %v", err) + } + + if b != wasm.OpcodeEnd { + return fmt.Errorf("constant expression has been not terminated") + } + + ret.Data = make([]byte, remainingBeforeData-int64(r.Len())-1) + if _, err = r.ReadAt(ret.Data, offsetAtData); err != nil { + return fmt.Errorf("error re-buffering ConstantExpression.Data") + } + ret.Opcode = opcode + return nil +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/custom.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/custom.go new file mode 100644 index 000000000..771f8c327 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/custom.go @@ -0,0 +1,22 @@ +package binary + +import ( + "bytes" + + "github.com/tetratelabs/wazero/internal/wasm" +) + +// decodeCustomSection deserializes the data **not** associated with the "name" key in SectionIDCustom. +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#custom-section%E2%91%A0 +func decodeCustomSection(r *bytes.Reader, name string, limit uint64) (result *wasm.CustomSection, err error) { + buf := make([]byte, limit) + _, err = r.Read(buf) + + result = &wasm.CustomSection{ + Name: name, + Data: buf, + } + + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/data.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/data.go new file mode 100644 index 000000000..054ccb3c6 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/data.go @@ -0,0 +1,79 @@ +package binary + +import ( + "bytes" + "fmt" + "io" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/leb128" + "github.com/tetratelabs/wazero/internal/wasm" +) + +// dataSegmentPrefix represents three types of data segments. +// +// https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/binary/modules.html#data-section +type dataSegmentPrefix = uint32 + +const ( + // dataSegmentPrefixActive is the prefix for the version 1.0 compatible data segment, which is classified as "active" in 2.0. + dataSegmentPrefixActive dataSegmentPrefix = 0x0 + // dataSegmentPrefixPassive prefixes the "passive" data segment as in version 2.0 specification. + dataSegmentPrefixPassive dataSegmentPrefix = 0x1 + // dataSegmentPrefixActiveWithMemoryIndex is the active prefix with memory index encoded which is defined for futur use as of 2.0. + dataSegmentPrefixActiveWithMemoryIndex dataSegmentPrefix = 0x2 +) + +func decodeDataSegment(r *bytes.Reader, enabledFeatures api.CoreFeatures, ret *wasm.DataSegment) (err error) { + dataSegmentPrefx, _, err := leb128.DecodeUint32(r) + if err != nil { + err = fmt.Errorf("read data segment prefix: %w", err) + return + } + + if dataSegmentPrefx != dataSegmentPrefixActive { + if err = enabledFeatures.RequireEnabled(api.CoreFeatureBulkMemoryOperations); err != nil { + err = fmt.Errorf("non-zero prefix for data segment is invalid as %w", err) + return + } + } + + switch dataSegmentPrefx { + case dataSegmentPrefixActive, + dataSegmentPrefixActiveWithMemoryIndex: + // Active data segment as in + // https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/binary/modules.html#data-section + if dataSegmentPrefx == 0x2 { + d, _, err := leb128.DecodeUint32(r) + if err != nil { + return fmt.Errorf("read memory index: %v", err) + } else if d != 0 { + return fmt.Errorf("memory index must be zero but was %d", d) + } + } + + err = decodeConstantExpression(r, enabledFeatures, &ret.OffsetExpression) + if err != nil { + return fmt.Errorf("read offset expression: %v", err) + } + case dataSegmentPrefixPassive: + // Passive data segment doesn't need const expr nor memory index encoded. + // https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/binary/modules.html#data-section + ret.Passive = true + default: + err = fmt.Errorf("invalid data segment prefix: 0x%x", dataSegmentPrefx) + return + } + + vs, _, err := leb128.DecodeUint32(r) + if err != nil { + err = fmt.Errorf("get the size of vector: %v", err) + return + } + + ret.Init = make([]byte, vs) + if _, err = io.ReadFull(r, ret.Init); err != nil { + err = fmt.Errorf("read bytes for init: %v", err) + } + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/decoder.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/decoder.go new file mode 100644 index 000000000..62000484b --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/decoder.go @@ -0,0 +1,193 @@ +package binary + +import ( + "bytes" + "debug/dwarf" + "errors" + "fmt" + "io" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/leb128" + "github.com/tetratelabs/wazero/internal/wasm" + "github.com/tetratelabs/wazero/internal/wasmdebug" +) + +// DecodeModule implements wasm.DecodeModule for the WebAssembly 1.0 (20191205) Binary Format +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-format%E2%91%A0 +func DecodeModule( + binary []byte, + enabledFeatures api.CoreFeatures, + memoryLimitPages uint32, + memoryCapacityFromMax, + dwarfEnabled, storeCustomSections bool, +) (*wasm.Module, error) { + r := bytes.NewReader(binary) + + // Magic number. + buf := make([]byte, 4) + if _, err := io.ReadFull(r, buf); err != nil || !bytes.Equal(buf, Magic) { + return nil, ErrInvalidMagicNumber + } + + // Version. + if _, err := io.ReadFull(r, buf); err != nil || !bytes.Equal(buf, version) { + return nil, ErrInvalidVersion + } + + memSizer := newMemorySizer(memoryLimitPages, memoryCapacityFromMax) + + m := &wasm.Module{} + var info, line, str, abbrev, ranges []byte // For DWARF Data. + for { + // TODO: except custom sections, all others are required to be in order, but we aren't checking yet. + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#modules%E2%91%A0%E2%93%AA + sectionID, err := r.ReadByte() + if err == io.EOF { + break + } else if err != nil { + return nil, fmt.Errorf("read section id: %w", err) + } + + sectionSize, _, err := leb128.DecodeUint32(r) + if err != nil { + return nil, fmt.Errorf("get size of section %s: %v", wasm.SectionIDName(sectionID), err) + } + + sectionContentStart := r.Len() + switch sectionID { + case wasm.SectionIDCustom: + // First, validate the section and determine if the section for this name has already been set + name, nameSize, decodeErr := decodeUTF8(r, "custom section name") + if decodeErr != nil { + err = decodeErr + break + } else if sectionSize < nameSize { + err = fmt.Errorf("malformed custom section %s", name) + break + } else if name == "name" && m.NameSection != nil { + err = fmt.Errorf("redundant custom section %s", name) + break + } + + // Now, either decode the NameSection or CustomSection + limit := sectionSize - nameSize + + var c *wasm.CustomSection + if name != "name" { + if storeCustomSections || dwarfEnabled { + c, err = decodeCustomSection(r, name, uint64(limit)) + if err != nil { + return nil, fmt.Errorf("failed to read custom section name[%s]: %w", name, err) + } + m.CustomSections = append(m.CustomSections, c) + if dwarfEnabled { + switch name { + case ".debug_info": + info = c.Data + case ".debug_line": + line = c.Data + case ".debug_str": + str = c.Data + case ".debug_abbrev": + abbrev = c.Data + case ".debug_ranges": + ranges = c.Data + } + } + } else { + if _, err = io.CopyN(io.Discard, r, int64(limit)); err != nil { + return nil, fmt.Errorf("failed to skip name[%s]: %w", name, err) + } + } + } else { + m.NameSection, err = decodeNameSection(r, uint64(limit)) + } + case wasm.SectionIDType: + m.TypeSection, err = decodeTypeSection(enabledFeatures, r) + case wasm.SectionIDImport: + m.ImportSection, m.ImportPerModule, m.ImportFunctionCount, m.ImportGlobalCount, m.ImportMemoryCount, m.ImportTableCount, err = decodeImportSection(r, memSizer, memoryLimitPages, enabledFeatures) + if err != nil { + return nil, err // avoid re-wrapping the error. + } + case wasm.SectionIDFunction: + m.FunctionSection, err = decodeFunctionSection(r) + case wasm.SectionIDTable: + m.TableSection, err = decodeTableSection(r, enabledFeatures) + case wasm.SectionIDMemory: + m.MemorySection, err = decodeMemorySection(r, memSizer, memoryLimitPages) + case wasm.SectionIDGlobal: + if m.GlobalSection, err = decodeGlobalSection(r, enabledFeatures); err != nil { + return nil, err // avoid re-wrapping the error. + } + case wasm.SectionIDExport: + m.ExportSection, m.Exports, err = decodeExportSection(r) + case wasm.SectionIDStart: + if m.StartSection != nil { + return nil, errors.New("multiple start sections are invalid") + } + m.StartSection, err = decodeStartSection(r) + case wasm.SectionIDElement: + m.ElementSection, err = decodeElementSection(r, enabledFeatures) + case wasm.SectionIDCode: + m.CodeSection, err = decodeCodeSection(r) + case wasm.SectionIDData: + m.DataSection, err = decodeDataSection(r, enabledFeatures) + case wasm.SectionIDDataCount: + if err := enabledFeatures.RequireEnabled(api.CoreFeatureBulkMemoryOperations); err != nil { + return nil, fmt.Errorf("data count section not supported as %v", err) + } + m.DataCountSection, err = decodeDataCountSection(r) + default: + err = ErrInvalidSectionID + } + + readBytes := sectionContentStart - r.Len() + if err == nil && int(sectionSize) != readBytes { + err = fmt.Errorf("invalid section length: expected to be %d but got %d", sectionSize, readBytes) + } + + if err != nil { + return nil, fmt.Errorf("section %s: %v", wasm.SectionIDName(sectionID), err) + } + } + + if dwarfEnabled { + d, _ := dwarf.New(abbrev, nil, nil, info, line, nil, ranges, str) + m.DWARFLines = wasmdebug.NewDWARFLines(d) + } + + functionCount, codeCount := m.SectionElementCount(wasm.SectionIDFunction), m.SectionElementCount(wasm.SectionIDCode) + if functionCount != codeCount { + return nil, fmt.Errorf("function and code section have inconsistent lengths: %d != %d", functionCount, codeCount) + } + return m, nil +} + +// memorySizer derives min, capacity and max pages from decoded wasm. +type memorySizer func(minPages uint32, maxPages *uint32) (min uint32, capacity uint32, max uint32) + +// newMemorySizer sets capacity to minPages unless max is defined and +// memoryCapacityFromMax is true. +func newMemorySizer(memoryLimitPages uint32, memoryCapacityFromMax bool) memorySizer { + return func(minPages uint32, maxPages *uint32) (min, capacity, max uint32) { + if maxPages != nil { + if memoryCapacityFromMax { + return minPages, *maxPages, *maxPages + } + // This is an invalid value: let it propagate, we will fail later. + if *maxPages > wasm.MemoryLimitPages { + return minPages, minPages, *maxPages + } + // This is a valid value, but it goes over the run-time limit: return the limit. + if *maxPages > memoryLimitPages { + return minPages, minPages, memoryLimitPages + } + return minPages, minPages, *maxPages + } + if memoryCapacityFromMax { + return minPages, memoryLimitPages, memoryLimitPages + } + return minPages, minPages, memoryLimitPages + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/element.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/element.go new file mode 100644 index 000000000..538b98343 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/element.go @@ -0,0 +1,272 @@ +package binary + +import ( + "bytes" + "errors" + "fmt" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/leb128" + "github.com/tetratelabs/wazero/internal/wasm" +) + +func ensureElementKindFuncRef(r *bytes.Reader) error { + elemKind, err := r.ReadByte() + if err != nil { + return fmt.Errorf("read element prefix: %w", err) + } + if elemKind != 0x0 { // ElemKind is fixed to 0x0 now: https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/binary/modules.html#element-section + return fmt.Errorf("element kind must be zero but was 0x%x", elemKind) + } + return nil +} + +func decodeElementInitValueVector(r *bytes.Reader) ([]wasm.Index, error) { + vs, _, err := leb128.DecodeUint32(r) + if err != nil { + return nil, fmt.Errorf("get size of vector: %w", err) + } + + vec := make([]wasm.Index, vs) + for i := range vec { + u32, _, err := leb128.DecodeUint32(r) + if err != nil { + return nil, fmt.Errorf("read function index: %w", err) + } + + if u32 >= wasm.MaximumFunctionIndex { + return nil, fmt.Errorf("too large function index in Element init: %d", u32) + } + vec[i] = u32 + } + return vec, nil +} + +func decodeElementConstExprVector(r *bytes.Reader, elemType wasm.RefType, enabledFeatures api.CoreFeatures) ([]wasm.Index, error) { + vs, _, err := leb128.DecodeUint32(r) + if err != nil { + return nil, fmt.Errorf("failed to get the size of constexpr vector: %w", err) + } + vec := make([]wasm.Index, vs) + for i := range vec { + var expr wasm.ConstantExpression + err := decodeConstantExpression(r, enabledFeatures, &expr) + if err != nil { + return nil, err + } + switch expr.Opcode { + case wasm.OpcodeRefFunc: + if elemType != wasm.RefTypeFuncref { + return nil, fmt.Errorf("element type mismatch: want %s, but constexpr has funcref", wasm.RefTypeName(elemType)) + } + v, _, _ := leb128.LoadUint32(expr.Data) + if v >= wasm.MaximumFunctionIndex { + return nil, fmt.Errorf("too large function index in Element init: %d", v) + } + vec[i] = v + case wasm.OpcodeRefNull: + if elemType != expr.Data[0] { + return nil, fmt.Errorf("element type mismatch: want %s, but constexpr has %s", + wasm.RefTypeName(elemType), wasm.RefTypeName(expr.Data[0])) + } + vec[i] = wasm.ElementInitNullReference + case wasm.OpcodeGlobalGet: + i32, _, _ := leb128.LoadInt32(expr.Data) + if elemType != wasm.RefTypeFuncref { + return nil, fmt.Errorf("element type mismatch: want %s, but requires funcref", wasm.RefTypeName(elemType)) + } + // Resolving the function index is done at instantiation phase. See the comment on + // wasm.ElementInitImportedGlobalFunctionReference. + vec[i] = wasm.ElementInitImportedGlobalFunctionReference | wasm.Index(i32) + default: + return nil, fmt.Errorf("const expr must be either ref.null or ref.func but was %s", wasm.InstructionName(expr.Opcode)) + } + } + return vec, nil +} + +func decodeElementRefType(r *bytes.Reader) (ret wasm.RefType, err error) { + ret, err = r.ReadByte() + if err != nil { + err = fmt.Errorf("read element ref type: %w", err) + return + } + if ret != wasm.RefTypeFuncref && ret != wasm.RefTypeExternref { + return 0, errors.New("ref type must be funcref or externref for element as of WebAssembly 2.0") + } + return +} + +const ( + // The prefix is explained at https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/binary/modules.html#element-section + + // elementSegmentPrefixLegacy is the legacy prefix and is only valid one before CoreFeatureBulkMemoryOperations. + elementSegmentPrefixLegacy = iota + // elementSegmentPrefixPassiveFuncrefValueVector is the passive element whose indexes are encoded as vec(varint), and reftype is fixed to funcref. + elementSegmentPrefixPassiveFuncrefValueVector + // elementSegmentPrefixActiveFuncrefValueVectorWithTableIndex is the same as elementSegmentPrefixPassiveFuncrefValueVector but active and table index is encoded. + elementSegmentPrefixActiveFuncrefValueVectorWithTableIndex + // elementSegmentPrefixDeclarativeFuncrefValueVector is the same as elementSegmentPrefixPassiveFuncrefValueVector but declarative. + elementSegmentPrefixDeclarativeFuncrefValueVector + // elementSegmentPrefixActiveFuncrefConstExprVector is active whoce reftype is fixed to funcref and indexes are encoded as vec(const_expr). + elementSegmentPrefixActiveFuncrefConstExprVector + // elementSegmentPrefixPassiveConstExprVector is passive whoce indexes are encoded as vec(const_expr), and reftype is encoded. + elementSegmentPrefixPassiveConstExprVector + // elementSegmentPrefixPassiveConstExprVector is active whoce indexes are encoded as vec(const_expr), and reftype and table index are encoded. + elementSegmentPrefixActiveConstExprVector + // elementSegmentPrefixDeclarativeConstExprVector is declarative whoce indexes are encoded as vec(const_expr), and reftype is encoded. + elementSegmentPrefixDeclarativeConstExprVector +) + +func decodeElementSegment(r *bytes.Reader, enabledFeatures api.CoreFeatures, ret *wasm.ElementSegment) error { + prefix, _, err := leb128.DecodeUint32(r) + if err != nil { + return fmt.Errorf("read element prefix: %w", err) + } + + if prefix != elementSegmentPrefixLegacy { + if err := enabledFeatures.RequireEnabled(api.CoreFeatureBulkMemoryOperations); err != nil { + return fmt.Errorf("non-zero prefix for element segment is invalid as %w", err) + } + } + + // Encoding depends on the prefix and described at https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/binary/modules.html#element-section + switch prefix { + case elementSegmentPrefixLegacy: + // Legacy prefix which is WebAssembly 1.0 compatible. + err = decodeConstantExpression(r, enabledFeatures, &ret.OffsetExpr) + if err != nil { + return fmt.Errorf("read expr for offset: %w", err) + } + + ret.Init, err = decodeElementInitValueVector(r) + if err != nil { + return err + } + + ret.Mode = wasm.ElementModeActive + ret.Type = wasm.RefTypeFuncref + return nil + case elementSegmentPrefixPassiveFuncrefValueVector: + // Prefix 1 requires funcref. + if err = ensureElementKindFuncRef(r); err != nil { + return err + } + + ret.Init, err = decodeElementInitValueVector(r) + if err != nil { + return err + } + ret.Mode = wasm.ElementModePassive + ret.Type = wasm.RefTypeFuncref + return nil + case elementSegmentPrefixActiveFuncrefValueVectorWithTableIndex: + ret.TableIndex, _, err = leb128.DecodeUint32(r) + if err != nil { + return fmt.Errorf("get size of vector: %w", err) + } + + if ret.TableIndex != 0 { + if err := enabledFeatures.RequireEnabled(api.CoreFeatureReferenceTypes); err != nil { + return fmt.Errorf("table index must be zero but was %d: %w", ret.TableIndex, err) + } + } + + err := decodeConstantExpression(r, enabledFeatures, &ret.OffsetExpr) + if err != nil { + return fmt.Errorf("read expr for offset: %w", err) + } + + // Prefix 2 requires funcref. + if err = ensureElementKindFuncRef(r); err != nil { + return err + } + + ret.Init, err = decodeElementInitValueVector(r) + if err != nil { + return err + } + + ret.Mode = wasm.ElementModeActive + ret.Type = wasm.RefTypeFuncref + return nil + case elementSegmentPrefixDeclarativeFuncrefValueVector: + // Prefix 3 requires funcref. + if err = ensureElementKindFuncRef(r); err != nil { + return err + } + ret.Init, err = decodeElementInitValueVector(r) + if err != nil { + return err + } + ret.Type = wasm.RefTypeFuncref + ret.Mode = wasm.ElementModeDeclarative + return nil + case elementSegmentPrefixActiveFuncrefConstExprVector: + err := decodeConstantExpression(r, enabledFeatures, &ret.OffsetExpr) + if err != nil { + return fmt.Errorf("read expr for offset: %w", err) + } + + ret.Init, err = decodeElementConstExprVector(r, wasm.RefTypeFuncref, enabledFeatures) + if err != nil { + return err + } + ret.Mode = wasm.ElementModeActive + ret.Type = wasm.RefTypeFuncref + return nil + case elementSegmentPrefixPassiveConstExprVector: + ret.Type, err = decodeElementRefType(r) + if err != nil { + return err + } + ret.Init, err = decodeElementConstExprVector(r, ret.Type, enabledFeatures) + if err != nil { + return err + } + ret.Mode = wasm.ElementModePassive + return nil + case elementSegmentPrefixActiveConstExprVector: + ret.TableIndex, _, err = leb128.DecodeUint32(r) + if err != nil { + return fmt.Errorf("get size of vector: %w", err) + } + + if ret.TableIndex != 0 { + if err := enabledFeatures.RequireEnabled(api.CoreFeatureReferenceTypes); err != nil { + return fmt.Errorf("table index must be zero but was %d: %w", ret.TableIndex, err) + } + } + err := decodeConstantExpression(r, enabledFeatures, &ret.OffsetExpr) + if err != nil { + return fmt.Errorf("read expr for offset: %w", err) + } + + ret.Type, err = decodeElementRefType(r) + if err != nil { + return err + } + + ret.Init, err = decodeElementConstExprVector(r, ret.Type, enabledFeatures) + if err != nil { + return err + } + + ret.Mode = wasm.ElementModeActive + return nil + case elementSegmentPrefixDeclarativeConstExprVector: + ret.Type, err = decodeElementRefType(r) + if err != nil { + return err + } + ret.Init, err = decodeElementConstExprVector(r, ret.Type, enabledFeatures) + if err != nil { + return err + } + + ret.Mode = wasm.ElementModeDeclarative + return nil + default: + return fmt.Errorf("invalid element segment prefix: 0x%x", prefix) + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/errors.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/errors.go new file mode 100644 index 000000000..b9125b038 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/errors.go @@ -0,0 +1,11 @@ +package binary + +import "errors" + +var ( + ErrInvalidByte = errors.New("invalid byte") + ErrInvalidMagicNumber = errors.New("invalid magic number") + ErrInvalidVersion = errors.New("invalid version header") + ErrInvalidSectionID = errors.New("invalid section id") + ErrCustomSectionNotFound = errors.New("custom section not found") +) diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/export.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/export.go new file mode 100644 index 000000000..925e9c499 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/export.go @@ -0,0 +1,32 @@ +package binary + +import ( + "bytes" + "fmt" + + "github.com/tetratelabs/wazero/internal/leb128" + "github.com/tetratelabs/wazero/internal/wasm" +) + +func decodeExport(r *bytes.Reader, ret *wasm.Export) (err error) { + if ret.Name, _, err = decodeUTF8(r, "export name"); err != nil { + return + } + + b, err := r.ReadByte() + if err != nil { + err = fmt.Errorf("error decoding export kind: %w", err) + return + } + + ret.Type = b + switch ret.Type { + case wasm.ExternTypeFunc, wasm.ExternTypeTable, wasm.ExternTypeMemory, wasm.ExternTypeGlobal: + if ret.Index, _, err = leb128.DecodeUint32(r); err != nil { + err = fmt.Errorf("error decoding export index: %w", err) + } + default: + err = fmt.Errorf("%w: invalid byte for exportdesc: %#x", ErrInvalidByte, b) + } + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/function.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/function.go new file mode 100644 index 000000000..bb9e2b649 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/function.go @@ -0,0 +1,56 @@ +package binary + +import ( + "bytes" + "fmt" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/leb128" + "github.com/tetratelabs/wazero/internal/wasm" +) + +func decodeFunctionType(enabledFeatures api.CoreFeatures, r *bytes.Reader, ret *wasm.FunctionType) (err error) { + b, err := r.ReadByte() + if err != nil { + return fmt.Errorf("read leading byte: %w", err) + } + + if b != 0x60 { + return fmt.Errorf("%w: %#x != 0x60", ErrInvalidByte, b) + } + + paramCount, _, err := leb128.DecodeUint32(r) + if err != nil { + return fmt.Errorf("could not read parameter count: %w", err) + } + + paramTypes, err := decodeValueTypes(r, paramCount) + if err != nil { + return fmt.Errorf("could not read parameter types: %w", err) + } + + resultCount, _, err := leb128.DecodeUint32(r) + if err != nil { + return fmt.Errorf("could not read result count: %w", err) + } + + // Guard >1.0 feature multi-value + if resultCount > 1 { + if err = enabledFeatures.RequireEnabled(api.CoreFeatureMultiValue); err != nil { + return fmt.Errorf("multiple result types invalid as %v", err) + } + } + + resultTypes, err := decodeValueTypes(r, resultCount) + if err != nil { + return fmt.Errorf("could not read result types: %w", err) + } + + ret.Params = paramTypes + ret.Results = resultTypes + + // cache the key for the function type + _ = ret.String() + + return nil +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/global.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/global.go new file mode 100644 index 000000000..4e1c16fda --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/global.go @@ -0,0 +1,50 @@ +package binary + +import ( + "bytes" + "fmt" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/wasm" +) + +// decodeGlobal returns the api.Global decoded with the WebAssembly 1.0 (20191205) Binary Format. +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-global +func decodeGlobal(r *bytes.Reader, enabledFeatures api.CoreFeatures, ret *wasm.Global) (err error) { + ret.Type, err = decodeGlobalType(r) + if err != nil { + return err + } + + err = decodeConstantExpression(r, enabledFeatures, &ret.Init) + return +} + +// decodeGlobalType returns the wasm.GlobalType decoded with the WebAssembly 1.0 (20191205) Binary Format. +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-globaltype +func decodeGlobalType(r *bytes.Reader) (wasm.GlobalType, error) { + vt, err := decodeValueTypes(r, 1) + if err != nil { + return wasm.GlobalType{}, fmt.Errorf("read value type: %w", err) + } + + ret := wasm.GlobalType{ + ValType: vt[0], + } + + b, err := r.ReadByte() + if err != nil { + return wasm.GlobalType{}, fmt.Errorf("read mutablity: %w", err) + } + + switch mut := b; mut { + case 0x00: // not mutable + case 0x01: // mutable + ret.Mutable = true + default: + return wasm.GlobalType{}, fmt.Errorf("%w for mutability: %#x != 0x00 or 0x01", ErrInvalidByte, mut) + } + return ret, nil +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/header.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/header.go new file mode 100644 index 000000000..29ba1b599 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/header.go @@ -0,0 +1,9 @@ +package binary + +// Magic is the 4 byte preamble (literally "\0asm") of the binary format +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-magic +var Magic = []byte{0x00, 0x61, 0x73, 0x6D} + +// version is format version and doesn't change between known specification versions +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-version +var version = []byte{0x01, 0x00, 0x00, 0x00} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/import.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/import.go new file mode 100644 index 000000000..666636177 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/import.go @@ -0,0 +1,52 @@ +package binary + +import ( + "bytes" + "fmt" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/leb128" + "github.com/tetratelabs/wazero/internal/wasm" +) + +func decodeImport( + r *bytes.Reader, + idx uint32, + memorySizer memorySizer, + memoryLimitPages uint32, + enabledFeatures api.CoreFeatures, + ret *wasm.Import, +) (err error) { + if ret.Module, _, err = decodeUTF8(r, "import module"); err != nil { + err = fmt.Errorf("import[%d] error decoding module: %w", idx, err) + return + } + + if ret.Name, _, err = decodeUTF8(r, "import name"); err != nil { + err = fmt.Errorf("import[%d] error decoding name: %w", idx, err) + return + } + + b, err := r.ReadByte() + if err != nil { + err = fmt.Errorf("import[%d] error decoding type: %w", idx, err) + return + } + ret.Type = b + switch ret.Type { + case wasm.ExternTypeFunc: + ret.DescFunc, _, err = leb128.DecodeUint32(r) + case wasm.ExternTypeTable: + err = decodeTable(r, enabledFeatures, &ret.DescTable) + case wasm.ExternTypeMemory: + ret.DescMem, err = decodeMemory(r, memorySizer, memoryLimitPages) + case wasm.ExternTypeGlobal: + ret.DescGlobal, err = decodeGlobalType(r) + default: + err = fmt.Errorf("%w: invalid byte for importdesc: %#x", ErrInvalidByte, b) + } + if err != nil { + err = fmt.Errorf("import[%d] %s[%s.%s]: %w", idx, wasm.ExternTypeName(ret.Type), ret.Module, ret.Name, err) + } + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/limits.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/limits.go new file mode 100644 index 000000000..1ec8d7c30 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/limits.go @@ -0,0 +1,42 @@ +package binary + +import ( + "bytes" + "fmt" + + "github.com/tetratelabs/wazero/internal/leb128" +) + +// decodeLimitsType returns the `limitsType` (min, max) decoded with the WebAssembly 1.0 (20191205) Binary Format. +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#limits%E2%91%A6 +func decodeLimitsType(r *bytes.Reader) (min uint32, max *uint32, err error) { + var flag byte + if flag, err = r.ReadByte(); err != nil { + err = fmt.Errorf("read leading byte: %v", err) + return + } + + switch flag { + case 0x00: + min, _, err = leb128.DecodeUint32(r) + if err != nil { + err = fmt.Errorf("read min of limit: %v", err) + } + case 0x01: + min, _, err = leb128.DecodeUint32(r) + if err != nil { + err = fmt.Errorf("read min of limit: %v", err) + return + } + var m uint32 + if m, _, err = leb128.DecodeUint32(r); err != nil { + err = fmt.Errorf("read max of limit: %v", err) + } else { + max = &m + } + default: + err = fmt.Errorf("%v for limits: %#x != 0x00 or 0x01", ErrInvalidByte, flag) + } + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/memory.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/memory.go new file mode 100644 index 000000000..fd6b32a67 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/memory.go @@ -0,0 +1,26 @@ +package binary + +import ( + "bytes" + + "github.com/tetratelabs/wazero/internal/wasm" +) + +// decodeMemory returns the api.Memory decoded with the WebAssembly 1.0 (20191205) Binary Format. +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-memory +func decodeMemory( + r *bytes.Reader, + memorySizer func(minPages uint32, maxPages *uint32) (min, capacity, max uint32), + memoryLimitPages uint32, +) (*wasm.Memory, error) { + min, maxP, err := decodeLimitsType(r) + if err != nil { + return nil, err + } + + min, capacity, max := memorySizer(min, maxP) + mem := &wasm.Memory{Min: min, Cap: capacity, Max: max, IsMaxEncoded: maxP != nil} + + return mem, mem.Validate(memoryLimitPages) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/names.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/names.go new file mode 100644 index 000000000..56fb96dc8 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/names.go @@ -0,0 +1,151 @@ +package binary + +import ( + "bytes" + "fmt" + "io" + + "github.com/tetratelabs/wazero/internal/leb128" + "github.com/tetratelabs/wazero/internal/wasm" +) + +const ( + // subsectionIDModuleName contains only the module name. + subsectionIDModuleName = uint8(0) + // subsectionIDFunctionNames is a map of indices to function names, in ascending order by function index + subsectionIDFunctionNames = uint8(1) + // subsectionIDLocalNames contain a map of function indices to a map of local indices to their names, in ascending + // order by function and local index + subsectionIDLocalNames = uint8(2) +) + +// decodeNameSection deserializes the data associated with the "name" key in SectionIDCustom according to the +// standard: +// +// * ModuleName decode from subsection 0 +// * FunctionNames decode from subsection 1 +// * LocalNames decode from subsection 2 +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-namesec +func decodeNameSection(r *bytes.Reader, limit uint64) (result *wasm.NameSection, err error) { + // TODO: add leb128 functions that work on []byte and offset. While using a reader allows us to reuse reader-based + // leb128 functions, it is less efficient, causes untestable code and in some cases more complex vs plain []byte. + result = &wasm.NameSection{} + + // subsectionID is decoded if known, and skipped if not + var subsectionID uint8 + // subsectionSize is the length to skip when the subsectionID is unknown + var subsectionSize uint32 + var bytesRead uint64 + for limit > 0 { + if subsectionID, err = r.ReadByte(); err != nil { + if err == io.EOF { + return result, nil + } + // TODO: untestable as this can't fail for a reason beside EOF reading a byte from a buffer + return nil, fmt.Errorf("failed to read a subsection ID: %w", err) + } + limit-- + + if subsectionSize, bytesRead, err = leb128.DecodeUint32(r); err != nil { + return nil, fmt.Errorf("failed to read the size of subsection[%d]: %w", subsectionID, err) + } + limit -= bytesRead + + switch subsectionID { + case subsectionIDModuleName: + if result.ModuleName, _, err = decodeUTF8(r, "module name"); err != nil { + return nil, err + } + case subsectionIDFunctionNames: + if result.FunctionNames, err = decodeFunctionNames(r); err != nil { + return nil, err + } + case subsectionIDLocalNames: + if result.LocalNames, err = decodeLocalNames(r); err != nil { + return nil, err + } + default: // Skip other subsections. + // Note: Not Seek because it doesn't err when given an offset past EOF. Rather, it leads to undefined state. + if _, err = io.CopyN(io.Discard, r, int64(subsectionSize)); err != nil { + return nil, fmt.Errorf("failed to skip subsection[%d]: %w", subsectionID, err) + } + } + limit -= uint64(subsectionSize) + } + return +} + +func decodeFunctionNames(r *bytes.Reader) (wasm.NameMap, error) { + functionCount, err := decodeFunctionCount(r, subsectionIDFunctionNames) + if err != nil { + return nil, err + } + + result := make(wasm.NameMap, functionCount) + for i := uint32(0); i < functionCount; i++ { + functionIndex, err := decodeFunctionIndex(r, subsectionIDFunctionNames) + if err != nil { + return nil, err + } + + name, _, err := decodeUTF8(r, "function[%d] name", functionIndex) + if err != nil { + return nil, err + } + result[i] = wasm.NameAssoc{Index: functionIndex, Name: name} + } + return result, nil +} + +func decodeLocalNames(r *bytes.Reader) (wasm.IndirectNameMap, error) { + functionCount, err := decodeFunctionCount(r, subsectionIDLocalNames) + if err != nil { + return nil, err + } + + result := make(wasm.IndirectNameMap, functionCount) + for i := uint32(0); i < functionCount; i++ { + functionIndex, err := decodeFunctionIndex(r, subsectionIDLocalNames) + if err != nil { + return nil, err + } + + localCount, _, err := leb128.DecodeUint32(r) + if err != nil { + return nil, fmt.Errorf("failed to read the local count for function[%d]: %w", functionIndex, err) + } + + locals := make(wasm.NameMap, localCount) + for j := uint32(0); j < localCount; j++ { + localIndex, _, err := leb128.DecodeUint32(r) + if err != nil { + return nil, fmt.Errorf("failed to read a local index of function[%d]: %w", functionIndex, err) + } + + name, _, err := decodeUTF8(r, "function[%d] local[%d] name", functionIndex, localIndex) + if err != nil { + return nil, err + } + locals[j] = wasm.NameAssoc{Index: localIndex, Name: name} + } + result[i] = wasm.NameMapAssoc{Index: functionIndex, NameMap: locals} + } + return result, nil +} + +func decodeFunctionIndex(r *bytes.Reader, subsectionID uint8) (uint32, error) { + functionIndex, _, err := leb128.DecodeUint32(r) + if err != nil { + return 0, fmt.Errorf("failed to read a function index in subsection[%d]: %w", subsectionID, err) + } + return functionIndex, nil +} + +func decodeFunctionCount(r *bytes.Reader, subsectionID uint8) (uint32, error) { + functionCount, _, err := leb128.DecodeUint32(r) + if err != nil { + return 0, fmt.Errorf("failed to read the function count of subsection[%d]: %w", subsectionID, err) + } + return functionCount, nil +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/section.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/section.go new file mode 100644 index 000000000..a4111572f --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/section.go @@ -0,0 +1,225 @@ +package binary + +import ( + "bytes" + "fmt" + "io" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/leb128" + "github.com/tetratelabs/wazero/internal/wasm" +) + +func decodeTypeSection(enabledFeatures api.CoreFeatures, r *bytes.Reader) ([]wasm.FunctionType, error) { + vs, _, err := leb128.DecodeUint32(r) + if err != nil { + return nil, fmt.Errorf("get size of vector: %w", err) + } + + result := make([]wasm.FunctionType, vs) + for i := uint32(0); i < vs; i++ { + if err = decodeFunctionType(enabledFeatures, r, &result[i]); err != nil { + return nil, fmt.Errorf("read %d-th type: %v", i, err) + } + } + return result, nil +} + +// decodeImportSection decodes the decoded import segments plus the count per wasm.ExternType. +func decodeImportSection( + r *bytes.Reader, + memorySizer memorySizer, + memoryLimitPages uint32, + enabledFeatures api.CoreFeatures, +) (result []wasm.Import, + perModule map[string][]*wasm.Import, + funcCount, globalCount, memoryCount, tableCount wasm.Index, err error, +) { + vs, _, err := leb128.DecodeUint32(r) + if err != nil { + err = fmt.Errorf("get size of vector: %w", err) + return + } + + perModule = make(map[string][]*wasm.Import) + result = make([]wasm.Import, vs) + for i := uint32(0); i < vs; i++ { + imp := &result[i] + if err = decodeImport(r, i, memorySizer, memoryLimitPages, enabledFeatures, imp); err != nil { + return + } + switch imp.Type { + case wasm.ExternTypeFunc: + imp.IndexPerType = funcCount + funcCount++ + case wasm.ExternTypeGlobal: + imp.IndexPerType = globalCount + globalCount++ + case wasm.ExternTypeMemory: + imp.IndexPerType = memoryCount + memoryCount++ + case wasm.ExternTypeTable: + imp.IndexPerType = tableCount + tableCount++ + } + perModule[imp.Module] = append(perModule[imp.Module], imp) + } + return +} + +func decodeFunctionSection(r *bytes.Reader) ([]uint32, error) { + vs, _, err := leb128.DecodeUint32(r) + if err != nil { + return nil, fmt.Errorf("get size of vector: %w", err) + } + + result := make([]uint32, vs) + for i := uint32(0); i < vs; i++ { + if result[i], _, err = leb128.DecodeUint32(r); err != nil { + return nil, fmt.Errorf("get type index: %w", err) + } + } + return result, err +} + +func decodeTableSection(r *bytes.Reader, enabledFeatures api.CoreFeatures) ([]wasm.Table, error) { + vs, _, err := leb128.DecodeUint32(r) + if err != nil { + return nil, fmt.Errorf("error reading size") + } + if vs > 1 { + if err := enabledFeatures.RequireEnabled(api.CoreFeatureReferenceTypes); err != nil { + return nil, fmt.Errorf("at most one table allowed in module as %w", err) + } + } + + ret := make([]wasm.Table, vs) + for i := range ret { + err = decodeTable(r, enabledFeatures, &ret[i]) + if err != nil { + return nil, err + } + } + return ret, nil +} + +func decodeMemorySection( + r *bytes.Reader, + memorySizer memorySizer, + memoryLimitPages uint32, +) (*wasm.Memory, error) { + vs, _, err := leb128.DecodeUint32(r) + if err != nil { + return nil, fmt.Errorf("error reading size") + } + if vs > 1 { + return nil, fmt.Errorf("at most one memory allowed in module, but read %d", vs) + } else if vs == 0 { + // memory count can be zero. + return nil, nil + } + + return decodeMemory(r, memorySizer, memoryLimitPages) +} + +func decodeGlobalSection(r *bytes.Reader, enabledFeatures api.CoreFeatures) ([]wasm.Global, error) { + vs, _, err := leb128.DecodeUint32(r) + if err != nil { + return nil, fmt.Errorf("get size of vector: %w", err) + } + + result := make([]wasm.Global, vs) + for i := uint32(0); i < vs; i++ { + if err = decodeGlobal(r, enabledFeatures, &result[i]); err != nil { + return nil, fmt.Errorf("global[%d]: %w", i, err) + } + } + return result, nil +} + +func decodeExportSection(r *bytes.Reader) ([]wasm.Export, map[string]*wasm.Export, error) { + vs, _, sizeErr := leb128.DecodeUint32(r) + if sizeErr != nil { + return nil, nil, fmt.Errorf("get size of vector: %v", sizeErr) + } + + exportMap := make(map[string]*wasm.Export, vs) + exportSection := make([]wasm.Export, vs) + for i := wasm.Index(0); i < vs; i++ { + export := &exportSection[i] + err := decodeExport(r, export) + if err != nil { + return nil, nil, fmt.Errorf("read export: %w", err) + } + if _, ok := exportMap[export.Name]; ok { + return nil, nil, fmt.Errorf("export[%d] duplicates name %q", i, export.Name) + } else { + exportMap[export.Name] = export + } + } + return exportSection, exportMap, nil +} + +func decodeStartSection(r *bytes.Reader) (*wasm.Index, error) { + vs, _, err := leb128.DecodeUint32(r) + if err != nil { + return nil, fmt.Errorf("get function index: %w", err) + } + return &vs, nil +} + +func decodeElementSection(r *bytes.Reader, enabledFeatures api.CoreFeatures) ([]wasm.ElementSegment, error) { + vs, _, err := leb128.DecodeUint32(r) + if err != nil { + return nil, fmt.Errorf("get size of vector: %w", err) + } + + result := make([]wasm.ElementSegment, vs) + for i := uint32(0); i < vs; i++ { + if err = decodeElementSegment(r, enabledFeatures, &result[i]); err != nil { + return nil, fmt.Errorf("read element: %w", err) + } + } + return result, nil +} + +func decodeCodeSection(r *bytes.Reader) ([]wasm.Code, error) { + codeSectionStart := uint64(r.Len()) + vs, _, err := leb128.DecodeUint32(r) + if err != nil { + return nil, fmt.Errorf("get size of vector: %w", err) + } + + result := make([]wasm.Code, vs) + for i := uint32(0); i < vs; i++ { + err = decodeCode(r, codeSectionStart, &result[i]) + if err != nil { + return nil, fmt.Errorf("read %d-th code segment: %v", i, err) + } + } + return result, nil +} + +func decodeDataSection(r *bytes.Reader, enabledFeatures api.CoreFeatures) ([]wasm.DataSegment, error) { + vs, _, err := leb128.DecodeUint32(r) + if err != nil { + return nil, fmt.Errorf("get size of vector: %w", err) + } + + result := make([]wasm.DataSegment, vs) + for i := uint32(0); i < vs; i++ { + if err = decodeDataSegment(r, enabledFeatures, &result[i]); err != nil { + return nil, fmt.Errorf("read data segment: %w", err) + } + } + return result, nil +} + +func decodeDataCountSection(r *bytes.Reader) (count *uint32, err error) { + v, _, err := leb128.DecodeUint32(r) + if err != nil && err != io.EOF { + // data count is optional, so EOF is fine. + return nil, err + } + return &v, nil +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/table.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/table.go new file mode 100644 index 000000000..cb5aa75e7 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/table.go @@ -0,0 +1,39 @@ +package binary + +import ( + "bytes" + "fmt" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/wasm" +) + +// decodeTable returns the wasm.Table decoded with the WebAssembly 1.0 (20191205) Binary Format. +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-table +func decodeTable(r *bytes.Reader, enabledFeatures api.CoreFeatures, ret *wasm.Table) (err error) { + ret.Type, err = r.ReadByte() + if err != nil { + return fmt.Errorf("read leading byte: %v", err) + } + + if ret.Type != wasm.RefTypeFuncref { + if err = enabledFeatures.RequireEnabled(api.CoreFeatureReferenceTypes); err != nil { + return fmt.Errorf("table type funcref is invalid: %w", err) + } + } + + ret.Min, ret.Max, err = decodeLimitsType(r) + if err != nil { + return fmt.Errorf("read limits: %v", err) + } + if ret.Min > wasm.MaximumFunctionIndex { + return fmt.Errorf("table min must be at most %d", wasm.MaximumFunctionIndex) + } + if ret.Max != nil { + if *ret.Max < ret.Min { + return fmt.Errorf("table size minimum must not be greater than maximum") + } + } + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/value.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/value.go new file mode 100644 index 000000000..755ee5ea3 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/binary/value.go @@ -0,0 +1,60 @@ +package binary + +import ( + "bytes" + "fmt" + "io" + "unicode/utf8" + "unsafe" + + "github.com/tetratelabs/wazero/internal/leb128" + "github.com/tetratelabs/wazero/internal/wasm" +) + +func decodeValueTypes(r *bytes.Reader, num uint32) ([]wasm.ValueType, error) { + if num == 0 { + return nil, nil + } + + ret := make([]wasm.ValueType, num) + _, err := io.ReadFull(r, ret) + if err != nil { + return nil, err + } + + for _, v := range ret { + switch v { + case wasm.ValueTypeI32, wasm.ValueTypeF32, wasm.ValueTypeI64, wasm.ValueTypeF64, + wasm.ValueTypeExternref, wasm.ValueTypeFuncref, wasm.ValueTypeV128: + default: + return nil, fmt.Errorf("invalid value type: %d", v) + } + } + return ret, nil +} + +// decodeUTF8 decodes a size prefixed string from the reader, returning it and the count of bytes read. +// contextFormat and contextArgs apply an error format when present +func decodeUTF8(r *bytes.Reader, contextFormat string, contextArgs ...interface{}) (string, uint32, error) { + size, sizeOfSize, err := leb128.DecodeUint32(r) + if err != nil { + return "", 0, fmt.Errorf("failed to read %s size: %w", fmt.Sprintf(contextFormat, contextArgs...), err) + } + + if size == 0 { + return "", uint32(sizeOfSize), nil + } + + buf := make([]byte, size) + if _, err = io.ReadFull(r, buf); err != nil { + return "", 0, fmt.Errorf("failed to read %s: %w", fmt.Sprintf(contextFormat, contextArgs...), err) + } + + if !utf8.Valid(buf) { + return "", 0, fmt.Errorf("%s is not valid UTF-8", fmt.Sprintf(contextFormat, contextArgs...)) + } + + // TODO: use unsafe.String after flooring Go 1.20. + ret := *(*string)(unsafe.Pointer(&buf)) + return ret, size + uint32(sizeOfSize), nil +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/counts.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/counts.go new file mode 100644 index 000000000..685a40941 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/counts.go @@ -0,0 +1,51 @@ +package wasm + +import "fmt" + +// SectionElementCount returns the count of elements in a given section ID +// +// For example... +// * SectionIDType returns the count of FunctionType +// * SectionIDCustom returns the count of CustomSections plus one if NameSection is present +// * SectionIDHostFunction returns the count of HostFunctionSection +// * SectionIDExport returns the count of unique export names +func (m *Module) SectionElementCount(sectionID SectionID) uint32 { // element as in vector elements! + switch sectionID { + case SectionIDCustom: + numCustomSections := uint32(len(m.CustomSections)) + if m.NameSection != nil { + numCustomSections++ + } + return numCustomSections + case SectionIDType: + return uint32(len(m.TypeSection)) + case SectionIDImport: + return uint32(len(m.ImportSection)) + case SectionIDFunction: + return uint32(len(m.FunctionSection)) + case SectionIDTable: + return uint32(len(m.TableSection)) + case SectionIDMemory: + if m.MemorySection != nil { + return 1 + } + return 0 + case SectionIDGlobal: + return uint32(len(m.GlobalSection)) + case SectionIDExport: + return uint32(len(m.ExportSection)) + case SectionIDStart: + if m.StartSection != nil { + return 1 + } + return 0 + case SectionIDElement: + return uint32(len(m.ElementSection)) + case SectionIDCode: + return uint32(len(m.CodeSection)) + case SectionIDData: + return uint32(len(m.DataSection)) + default: + panic(fmt.Errorf("BUG: unknown section: %d", sectionID)) + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/engine.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/engine.go new file mode 100644 index 000000000..c2f82efcc --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/engine.go @@ -0,0 +1,68 @@ +package wasm + +import ( + "context" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/experimental" +) + +// Engine is a Store-scoped mechanism to compile functions declared or imported by a module. +// This is a top-level type implemented by an interpreter or compiler. +type Engine interface { + // Close closes this engine, and releases all the compiled cache. + Close() (err error) + + // CompileModule implements the same method as documented on wasm.Engine. + CompileModule(ctx context.Context, module *Module, listeners []experimental.FunctionListener, ensureTermination bool) error + + // CompiledModuleCount is exported for testing, to track the size of the compilation cache. + CompiledModuleCount() uint32 + + // DeleteCompiledModule releases compilation caches for the given module (source). + // Note: it is safe to call this function for a module from which module instances are instantiated even when these + // module instances have outstanding calls. + DeleteCompiledModule(module *Module) + + // NewModuleEngine compiles down the function instances in a module, and returns ModuleEngine for the module. + // + // * module is the source module from which moduleFunctions are instantiated. This is used for caching. + // * instance is the *ModuleInstance which is created from `module`. + // + // Note: Input parameters must be pre-validated with wasm.Module Validate, to ensure no fields are invalid + // due to reasons such as out-of-bounds. + NewModuleEngine(module *Module, instance *ModuleInstance) (ModuleEngine, error) +} + +// ModuleEngine implements function calls for a given module. +type ModuleEngine interface { + // DoneInstantiation is called at the end of the instantiation of the module. + DoneInstantiation() + + // NewFunction returns an api.Function for the given function pointed by the given Index. + NewFunction(index Index) api.Function + + // ResolveImportedFunction is used to add imported functions needed to make this ModuleEngine fully functional. + // - `index` is the function Index of this imported function. + // - `indexInImportedModule` is the function Index of the imported function in the imported module. + // - `importedModuleEngine` is the ModuleEngine for the imported ModuleInstance. + ResolveImportedFunction(index, indexInImportedModule Index, importedModuleEngine ModuleEngine) + + // ResolveImportedMemory is called when this module imports a memory from another module. + ResolveImportedMemory(importedModuleEngine ModuleEngine) + + // LookupFunction returns the FunctionModule and the Index of the function in the returned ModuleInstance at the given offset in the table. + LookupFunction(t *TableInstance, typeId FunctionTypeID, tableOffset Index) (*ModuleInstance, Index) + + // GetGlobalValue returns the value of the global variable at the given Index. + // Only called when OwnsGlobals() returns true, and must not be called for imported globals + GetGlobalValue(idx Index) (lo, hi uint64) + + // OwnsGlobals returns true if this ModuleEngine owns the global variables. If true, wasm.GlobalInstance's Val,ValHi should + // not be accessed directly. + OwnsGlobals() bool + + // FunctionInstanceReference returns Reference for the given Index for a FunctionInstance. The returned values are used by + // the initialization via ElementSegment. + FunctionInstanceReference(funcIndex Index) Reference +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/func_validation.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/func_validation.go new file mode 100644 index 000000000..e9aef72c8 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/func_validation.go @@ -0,0 +1,1954 @@ +package wasm + +import ( + "bytes" + "errors" + "fmt" + "strconv" + "strings" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/leb128" +) + +// The wazero specific limitation described at RATIONALE.md. +const maximumValuesOnStack = 1 << 27 + +// validateFunction validates the instruction sequence of a function. +// following the specification https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#instructions%E2%91%A2. +// +// * idx is the index in the FunctionSection +// * functions are the function index, which is prefixed by imports. The value is the TypeSection index. +// * globals are the global index, which is prefixed by imports. +// * memory is the potentially imported memory and can be nil. +// * table is the potentially imported table and can be nil. +// * declaredFunctionIndexes is the set of function indexes declared by declarative element segments which can be acceed by OpcodeRefFunc instruction. +// +// Returns an error if the instruction sequence is not valid, +// or potentially it can exceed the maximum number of values on the stack. +func (m *Module) validateFunction(sts *stacks, enabledFeatures api.CoreFeatures, idx Index, functions []Index, + globals []GlobalType, memory *Memory, tables []Table, declaredFunctionIndexes map[Index]struct{}, br *bytes.Reader, +) error { + return m.validateFunctionWithMaxStackValues(sts, enabledFeatures, idx, functions, globals, memory, tables, maximumValuesOnStack, declaredFunctionIndexes, br) +} + +func readMemArg(pc uint64, body []byte) (align, offset uint32, read uint64, err error) { + align, num, err := leb128.LoadUint32(body[pc:]) + if err != nil { + err = fmt.Errorf("read memory align: %v", err) + return + } + read += num + + offset, num, err = leb128.LoadUint32(body[pc+num:]) + if err != nil { + err = fmt.Errorf("read memory offset: %v", err) + return + } + + read += num + return align, offset, read, nil +} + +// validateFunctionWithMaxStackValues is like validateFunction, but allows overriding maxStackValues for testing. +// +// * stacks is to track the state of Wasm value and control frame stacks at anypoint of execution, and reused to reduce allocation. +// * maxStackValues is the maximum height of values stack which the target is allowed to reach. +func (m *Module) validateFunctionWithMaxStackValues( + sts *stacks, + enabledFeatures api.CoreFeatures, + idx Index, + functions []Index, + globals []GlobalType, + memory *Memory, + tables []Table, + maxStackValues int, + declaredFunctionIndexes map[Index]struct{}, + br *bytes.Reader, +) error { + functionType := &m.TypeSection[m.FunctionSection[idx]] + code := &m.CodeSection[idx] + body := code.Body + localTypes := code.LocalTypes + + sts.reset(functionType) + valueTypeStack := &sts.vs + // We start with the outermost control block which is for function return if the code branches into it. + controlBlockStack := &sts.cs + + // Now start walking through all the instructions in the body while tracking + // control blocks and value types to check the validity of all instructions. + for pc := uint64(0); pc < uint64(len(body)); pc++ { + op := body[pc] + if false { + var instName string + if op == OpcodeMiscPrefix { + instName = MiscInstructionName(body[pc+1]) + } else if op == OpcodeVecPrefix { + instName = VectorInstructionName(body[pc+1]) + } else { + instName = InstructionName(op) + } + fmt.Printf("handling %s, stack=%s, blocks: %v\n", instName, valueTypeStack.stack, controlBlockStack) + } + + if OpcodeI32Load <= op && op <= OpcodeI64Store32 { + if memory == nil { + return fmt.Errorf("memory must exist for %s", InstructionName(op)) + } + pc++ + align, _, read, err := readMemArg(pc, body) + if err != nil { + return err + } + pc += read - 1 + switch op { + case OpcodeI32Load: + if 1< 32/8 { + return fmt.Errorf("invalid memory alignment") + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + valueTypeStack.push(ValueTypeI32) + case OpcodeF32Load: + if 1< 32/8 { + return fmt.Errorf("invalid memory alignment") + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + valueTypeStack.push(ValueTypeF32) + case OpcodeI32Store: + if 1< 32/8 { + return fmt.Errorf("invalid memory alignment") + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + case OpcodeF32Store: + if 1< 32/8 { + return fmt.Errorf("invalid memory alignment") + } + if err := valueTypeStack.popAndVerifyType(ValueTypeF32); err != nil { + return err + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + case OpcodeI64Load: + if 1< 64/8 { + return fmt.Errorf("invalid memory alignment") + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + valueTypeStack.push(ValueTypeI64) + case OpcodeF64Load: + if 1< 64/8 { + return fmt.Errorf("invalid memory alignment") + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + valueTypeStack.push(ValueTypeF64) + case OpcodeI64Store: + if 1< 64/8 { + return fmt.Errorf("invalid memory alignment") + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI64); err != nil { + return err + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + case OpcodeF64Store: + if 1< 64/8 { + return fmt.Errorf("invalid memory alignment") + } + if err := valueTypeStack.popAndVerifyType(ValueTypeF64); err != nil { + return err + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + case OpcodeI32Load8S: + if 1< 1 { + return fmt.Errorf("invalid memory alignment") + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + valueTypeStack.push(ValueTypeI32) + case OpcodeI32Load8U: + if 1< 1 { + return fmt.Errorf("invalid memory alignment") + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + valueTypeStack.push(ValueTypeI32) + case OpcodeI64Load8S, OpcodeI64Load8U: + if 1< 1 { + return fmt.Errorf("invalid memory alignment") + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + valueTypeStack.push(ValueTypeI64) + case OpcodeI32Store8: + if 1< 1 { + return fmt.Errorf("invalid memory alignment") + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + case OpcodeI64Store8: + if 1< 1 { + return fmt.Errorf("invalid memory alignment") + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI64); err != nil { + return err + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + case OpcodeI32Load16S, OpcodeI32Load16U: + if 1< 16/8 { + return fmt.Errorf("invalid memory alignment") + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + valueTypeStack.push(ValueTypeI32) + case OpcodeI64Load16S, OpcodeI64Load16U: + if 1< 16/8 { + return fmt.Errorf("invalid memory alignment") + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + valueTypeStack.push(ValueTypeI64) + case OpcodeI32Store16: + if 1< 16/8 { + return fmt.Errorf("invalid memory alignment") + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + case OpcodeI64Store16: + if 1< 16/8 { + return fmt.Errorf("invalid memory alignment") + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI64); err != nil { + return err + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + case OpcodeI64Load32S, OpcodeI64Load32U: + if 1< 32/8 { + return fmt.Errorf("invalid memory alignment") + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + valueTypeStack.push(ValueTypeI64) + case OpcodeI64Store32: + if 1< 32/8 { + return fmt.Errorf("invalid memory alignment") + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI64); err != nil { + return err + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + } + } else if OpcodeMemorySize <= op && op <= OpcodeMemoryGrow { + if memory == nil { + return fmt.Errorf("memory must exist for %s", InstructionName(op)) + } + pc++ + val, num, err := leb128.LoadUint32(body[pc:]) + if err != nil { + return fmt.Errorf("read immediate: %v", err) + } + if val != 0 || num != 1 { + return fmt.Errorf("memory instruction reserved bytes not zero with 1 byte") + } + switch Opcode(op) { + case OpcodeMemoryGrow: + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return err + } + valueTypeStack.push(ValueTypeI32) + case OpcodeMemorySize: + valueTypeStack.push(ValueTypeI32) + } + pc += num - 1 + } else if OpcodeI32Const <= op && op <= OpcodeF64Const { + pc++ + switch Opcode(op) { + case OpcodeI32Const: + _, num, err := leb128.LoadInt32(body[pc:]) + if err != nil { + return fmt.Errorf("read i32 immediate: %s", err) + } + pc += num - 1 + valueTypeStack.push(ValueTypeI32) + case OpcodeI64Const: + _, num, err := leb128.LoadInt64(body[pc:]) + if err != nil { + return fmt.Errorf("read i64 immediate: %v", err) + } + valueTypeStack.push(ValueTypeI64) + pc += num - 1 + case OpcodeF32Const: + valueTypeStack.push(ValueTypeF32) + pc += 3 + case OpcodeF64Const: + valueTypeStack.push(ValueTypeF64) + pc += 7 + } + } else if OpcodeLocalGet <= op && op <= OpcodeGlobalSet { + pc++ + index, num, err := leb128.LoadUint32(body[pc:]) + if err != nil { + return fmt.Errorf("read immediate: %v", err) + } + pc += num - 1 + switch op { + case OpcodeLocalGet: + inputLen := uint32(len(functionType.Params)) + if l := uint32(len(localTypes)) + inputLen; index >= l { + return fmt.Errorf("invalid local index for %s %d >= %d(=len(locals)+len(parameters))", + OpcodeLocalGetName, index, l) + } + if index < inputLen { + valueTypeStack.push(functionType.Params[index]) + } else { + valueTypeStack.push(localTypes[index-inputLen]) + } + case OpcodeLocalSet: + inputLen := uint32(len(functionType.Params)) + if l := uint32(len(localTypes)) + inputLen; index >= l { + return fmt.Errorf("invalid local index for %s %d >= %d(=len(locals)+len(parameters))", + OpcodeLocalSetName, index, l) + } + var expType ValueType + if index < inputLen { + expType = functionType.Params[index] + } else { + expType = localTypes[index-inputLen] + } + if err := valueTypeStack.popAndVerifyType(expType); err != nil { + return err + } + case OpcodeLocalTee: + inputLen := uint32(len(functionType.Params)) + if l := uint32(len(localTypes)) + inputLen; index >= l { + return fmt.Errorf("invalid local index for %s %d >= %d(=len(locals)+len(parameters))", + OpcodeLocalTeeName, index, l) + } + var expType ValueType + if index < inputLen { + expType = functionType.Params[index] + } else { + expType = localTypes[index-inputLen] + } + if err := valueTypeStack.popAndVerifyType(expType); err != nil { + return err + } + valueTypeStack.push(expType) + case OpcodeGlobalGet: + if index >= uint32(len(globals)) { + return fmt.Errorf("invalid index for %s", OpcodeGlobalGetName) + } + valueTypeStack.push(globals[index].ValType) + case OpcodeGlobalSet: + if index >= uint32(len(globals)) { + return fmt.Errorf("invalid global index") + } else if !globals[index].Mutable { + return fmt.Errorf("%s when not mutable", OpcodeGlobalSetName) + } else if err := valueTypeStack.popAndVerifyType( + globals[index].ValType); err != nil { + return err + } + } + } else if op == OpcodeBr { + pc++ + index, num, err := leb128.LoadUint32(body[pc:]) + if err != nil { + return fmt.Errorf("read immediate: %v", err) + } else if int(index) >= len(controlBlockStack.stack) { + return fmt.Errorf("invalid %s operation: index out of range", OpcodeBrName) + } + pc += num - 1 + // Check type soundness. + target := &controlBlockStack.stack[len(controlBlockStack.stack)-int(index)-1] + var targetResultType []ValueType + if target.op == OpcodeLoop { + targetResultType = target.blockType.Params + } else { + targetResultType = target.blockType.Results + } + if err = valueTypeStack.popResults(op, targetResultType, false); err != nil { + return err + } + // br instruction is stack-polymorphic. + valueTypeStack.unreachable() + } else if op == OpcodeBrIf { + pc++ + index, num, err := leb128.LoadUint32(body[pc:]) + if err != nil { + return fmt.Errorf("read immediate: %v", err) + } else if int(index) >= len(controlBlockStack.stack) { + return fmt.Errorf( + "invalid ln param given for %s: index=%d with %d for the current label stack length", + OpcodeBrIfName, index, len(controlBlockStack.stack)) + } + pc += num - 1 + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return fmt.Errorf("cannot pop the required operand for %s", OpcodeBrIfName) + } + // Check type soundness. + target := &controlBlockStack.stack[len(controlBlockStack.stack)-int(index)-1] + var targetResultType []ValueType + if target.op == OpcodeLoop { + targetResultType = target.blockType.Params + } else { + targetResultType = target.blockType.Results + } + if err := valueTypeStack.popResults(op, targetResultType, false); err != nil { + return err + } + // Push back the result + for _, t := range targetResultType { + valueTypeStack.push(t) + } + } else if op == OpcodeBrTable { + pc++ + br.Reset(body[pc:]) + nl, num, err := leb128.DecodeUint32(br) + if err != nil { + return fmt.Errorf("read immediate: %w", err) + } + + list := make([]uint32, nl) + for i := uint32(0); i < nl; i++ { + l, n, err := leb128.DecodeUint32(br) + if err != nil { + return fmt.Errorf("read immediate: %w", err) + } + num += n + list[i] = l + } + ln, n, err := leb128.DecodeUint32(br) + if err != nil { + return fmt.Errorf("read immediate: %w", err) + } else if int(ln) >= len(controlBlockStack.stack) { + return fmt.Errorf( + "invalid ln param given for %s: ln=%d with %d for the current label stack length", + OpcodeBrTableName, ln, len(controlBlockStack.stack)) + } + pc += n + num - 1 + // Check type soundness. + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return fmt.Errorf("cannot pop the required operand for %s", OpcodeBrTableName) + } + lnLabel := &controlBlockStack.stack[len(controlBlockStack.stack)-1-int(ln)] + var defaultLabelType []ValueType + // Below, we might modify the slice in case of unreachable. Therefore, + // we have to copy the content of block result types, otherwise the original + // function type might result in invalid value types if the block is the outermost label + // which equals the function's type. + if lnLabel.op != OpcodeLoop { // Loop operation doesn't require results since the continuation is the beginning of the loop. + defaultLabelType = make([]ValueType, len(lnLabel.blockType.Results)) + copy(defaultLabelType, lnLabel.blockType.Results) + } else { + defaultLabelType = make([]ValueType, len(lnLabel.blockType.Params)) + copy(defaultLabelType, lnLabel.blockType.Params) + } + + if enabledFeatures.IsEnabled(api.CoreFeatureReferenceTypes) { + // As of reference-types proposal, br_table on unreachable state + // can choose unknown types for expected parameter types for each label. + // https://github.com/WebAssembly/reference-types/pull/116 + for i := range defaultLabelType { + index := len(defaultLabelType) - 1 - i + exp := defaultLabelType[index] + actual, err := valueTypeStack.pop() + if err != nil { + return err + } + if actual == valueTypeUnknown { + // Re-assign the expected type to unknown. + defaultLabelType[index] = valueTypeUnknown + } else if actual != exp { + return typeMismatchError(true, OpcodeBrTableName, actual, exp, i) + } + } + } else { + if err = valueTypeStack.popResults(op, defaultLabelType, false); err != nil { + return err + } + } + + for _, l := range list { + if int(l) >= len(controlBlockStack.stack) { + return fmt.Errorf("invalid l param given for %s", OpcodeBrTableName) + } + label := &controlBlockStack.stack[len(controlBlockStack.stack)-1-int(l)] + var tableLabelType []ValueType + if label.op != OpcodeLoop { + tableLabelType = label.blockType.Results + } else { + tableLabelType = label.blockType.Params + } + if len(defaultLabelType) != len(tableLabelType) { + return fmt.Errorf("inconsistent block type length for %s at %d; %v (ln=%d) != %v (l=%d)", OpcodeBrTableName, l, defaultLabelType, ln, tableLabelType, l) + } + for i := range defaultLabelType { + if defaultLabelType[i] != valueTypeUnknown && defaultLabelType[i] != tableLabelType[i] { + return fmt.Errorf("incosistent block type for %s at %d", OpcodeBrTableName, l) + } + } + } + + // br_table instruction is stack-polymorphic. + valueTypeStack.unreachable() + } else if op == OpcodeCall { + pc++ + index, num, err := leb128.LoadUint32(body[pc:]) + if err != nil { + return fmt.Errorf("read immediate: %v", err) + } + pc += num - 1 + if int(index) >= len(functions) { + return fmt.Errorf("invalid function index") + } + funcType := &m.TypeSection[functions[index]] + for i := 0; i < len(funcType.Params); i++ { + if err := valueTypeStack.popAndVerifyType(funcType.Params[len(funcType.Params)-1-i]); err != nil { + return fmt.Errorf("type mismatch on %s operation param type: %v", OpcodeCallName, err) + } + } + for _, exp := range funcType.Results { + valueTypeStack.push(exp) + } + } else if op == OpcodeCallIndirect { + pc++ + typeIndex, num, err := leb128.LoadUint32(body[pc:]) + if err != nil { + return fmt.Errorf("read immediate: %v", err) + } + pc += num + + if int(typeIndex) >= len(m.TypeSection) { + return fmt.Errorf("invalid type index at %s: %d", OpcodeCallIndirectName, typeIndex) + } + + tableIndex, num, err := leb128.LoadUint32(body[pc:]) + if err != nil { + return fmt.Errorf("read table index: %v", err) + } + pc += num - 1 + if tableIndex != 0 { + if err := enabledFeatures.RequireEnabled(api.CoreFeatureReferenceTypes); err != nil { + return fmt.Errorf("table index must be zero but was %d: %w", tableIndex, err) + } + } + + if tableIndex >= uint32(len(tables)) { + return fmt.Errorf("unknown table index: %d", tableIndex) + } + + table := tables[tableIndex] + if table.Type != RefTypeFuncref { + return fmt.Errorf("table is not funcref type but was %s for %s", RefTypeName(table.Type), OpcodeCallIndirectName) + } + + if err = valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return fmt.Errorf("cannot pop the offset in table for %s", OpcodeCallIndirectName) + } + funcType := &m.TypeSection[typeIndex] + for i := 0; i < len(funcType.Params); i++ { + if err = valueTypeStack.popAndVerifyType(funcType.Params[len(funcType.Params)-1-i]); err != nil { + return fmt.Errorf("type mismatch on %s operation input type", OpcodeCallIndirectName) + } + } + for _, exp := range funcType.Results { + valueTypeStack.push(exp) + } + } else if OpcodeI32Eqz <= op && op <= OpcodeI64Extend32S { + switch op { + case OpcodeI32Eqz: + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", OpcodeI32EqzName, err) + } + valueTypeStack.push(ValueTypeI32) + case OpcodeI32Eq, OpcodeI32Ne, OpcodeI32LtS, + OpcodeI32LtU, OpcodeI32GtS, OpcodeI32GtU, OpcodeI32LeS, + OpcodeI32LeU, OpcodeI32GeS, OpcodeI32GeU: + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return fmt.Errorf("cannot pop the 1st i32 operand for %s: %v", InstructionName(op), err) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return fmt.Errorf("cannot pop the 2nd i32 operand for %s: %v", InstructionName(op), err) + } + valueTypeStack.push(ValueTypeI32) + case OpcodeI64Eqz: + if err := valueTypeStack.popAndVerifyType(ValueTypeI64); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", OpcodeI64EqzName, err) + } + valueTypeStack.push(ValueTypeI32) + case OpcodeI64Eq, OpcodeI64Ne, OpcodeI64LtS, + OpcodeI64LtU, OpcodeI64GtS, OpcodeI64GtU, + OpcodeI64LeS, OpcodeI64LeU, OpcodeI64GeS, OpcodeI64GeU: + if err := valueTypeStack.popAndVerifyType(ValueTypeI64); err != nil { + return fmt.Errorf("cannot pop the 1st i64 operand for %s: %v", InstructionName(op), err) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI64); err != nil { + return fmt.Errorf("cannot pop the 2nd i64 operand for %s: %v", InstructionName(op), err) + } + valueTypeStack.push(ValueTypeI32) + case OpcodeF32Eq, OpcodeF32Ne, OpcodeF32Lt, OpcodeF32Gt, OpcodeF32Le, OpcodeF32Ge: + if err := valueTypeStack.popAndVerifyType(ValueTypeF32); err != nil { + return fmt.Errorf("cannot pop the 1st f32 operand for %s: %v", InstructionName(op), err) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeF32); err != nil { + return fmt.Errorf("cannot pop the 2nd f32 operand for %s: %v", InstructionName(op), err) + } + valueTypeStack.push(ValueTypeI32) + case OpcodeF64Eq, OpcodeF64Ne, OpcodeF64Lt, OpcodeF64Gt, OpcodeF64Le, OpcodeF64Ge: + if err := valueTypeStack.popAndVerifyType(ValueTypeF64); err != nil { + return fmt.Errorf("cannot pop the 1st f64 operand for %s: %v", InstructionName(op), err) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeF64); err != nil { + return fmt.Errorf("cannot pop the 2nd f64 operand for %s: %v", InstructionName(op), err) + } + valueTypeStack.push(ValueTypeI32) + case OpcodeI32Clz, OpcodeI32Ctz, OpcodeI32Popcnt: + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return fmt.Errorf("cannot pop the i32 operand for %s: %v", InstructionName(op), err) + } + valueTypeStack.push(ValueTypeI32) + case OpcodeI32Add, OpcodeI32Sub, OpcodeI32Mul, OpcodeI32DivS, + OpcodeI32DivU, OpcodeI32RemS, OpcodeI32RemU, OpcodeI32And, + OpcodeI32Or, OpcodeI32Xor, OpcodeI32Shl, OpcodeI32ShrS, + OpcodeI32ShrU, OpcodeI32Rotl, OpcodeI32Rotr: + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return fmt.Errorf("cannot pop the 1st operand for %s: %v", InstructionName(op), err) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return fmt.Errorf("cannot pop the 2nd operand for %s: %v", InstructionName(op), err) + } + valueTypeStack.push(ValueTypeI32) + case OpcodeI64Clz, OpcodeI64Ctz, OpcodeI64Popcnt: + if err := valueTypeStack.popAndVerifyType(ValueTypeI64); err != nil { + return fmt.Errorf("cannot pop the i64 operand for %s: %v", InstructionName(op), err) + } + valueTypeStack.push(ValueTypeI64) + case OpcodeI64Add, OpcodeI64Sub, OpcodeI64Mul, OpcodeI64DivS, + OpcodeI64DivU, OpcodeI64RemS, OpcodeI64RemU, OpcodeI64And, + OpcodeI64Or, OpcodeI64Xor, OpcodeI64Shl, OpcodeI64ShrS, + OpcodeI64ShrU, OpcodeI64Rotl, OpcodeI64Rotr: + if err := valueTypeStack.popAndVerifyType(ValueTypeI64); err != nil { + return fmt.Errorf("cannot pop the 1st i64 operand for %s: %v", InstructionName(op), err) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI64); err != nil { + return fmt.Errorf("cannot pop the 2nd i64 operand for %s: %v", InstructionName(op), err) + } + valueTypeStack.push(ValueTypeI64) + case OpcodeF32Abs, OpcodeF32Neg, OpcodeF32Ceil, + OpcodeF32Floor, OpcodeF32Trunc, OpcodeF32Nearest, + OpcodeF32Sqrt: + if err := valueTypeStack.popAndVerifyType(ValueTypeF32); err != nil { + return fmt.Errorf("cannot pop the 1st f32 operand for %s: %v", InstructionName(op), err) + } + valueTypeStack.push(ValueTypeF32) + case OpcodeF32Add, OpcodeF32Sub, OpcodeF32Mul, + OpcodeF32Div, OpcodeF32Min, OpcodeF32Max, + OpcodeF32Copysign: + if err := valueTypeStack.popAndVerifyType(ValueTypeF32); err != nil { + return fmt.Errorf("cannot pop the 1st f32 operand for %s: %v", InstructionName(op), err) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeF32); err != nil { + return fmt.Errorf("cannot pop the 2nd f32 operand for %s: %v", InstructionName(op), err) + } + valueTypeStack.push(ValueTypeF32) + case OpcodeF64Abs, OpcodeF64Neg, OpcodeF64Ceil, + OpcodeF64Floor, OpcodeF64Trunc, OpcodeF64Nearest, + OpcodeF64Sqrt: + if err := valueTypeStack.popAndVerifyType(ValueTypeF64); err != nil { + return fmt.Errorf("cannot pop the 1st f64 operand for %s: %v", InstructionName(op), err) + } + valueTypeStack.push(ValueTypeF64) + case OpcodeF64Add, OpcodeF64Sub, OpcodeF64Mul, + OpcodeF64Div, OpcodeF64Min, OpcodeF64Max, + OpcodeF64Copysign: + if err := valueTypeStack.popAndVerifyType(ValueTypeF64); err != nil { + return fmt.Errorf("cannot pop the 1st f64 operand for %s: %v", InstructionName(op), err) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeF64); err != nil { + return fmt.Errorf("cannot pop the 2nd f64 operand for %s: %v", InstructionName(op), err) + } + valueTypeStack.push(ValueTypeF64) + case OpcodeI32WrapI64: + if err := valueTypeStack.popAndVerifyType(ValueTypeI64); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", OpcodeI32WrapI64Name, err) + } + valueTypeStack.push(ValueTypeI32) + case OpcodeI32TruncF32S, OpcodeI32TruncF32U: + if err := valueTypeStack.popAndVerifyType(ValueTypeF32); err != nil { + return fmt.Errorf("cannot pop the f32 operand for %s: %v", InstructionName(op), err) + } + valueTypeStack.push(ValueTypeI32) + case OpcodeI32TruncF64S, OpcodeI32TruncF64U: + if err := valueTypeStack.popAndVerifyType(ValueTypeF64); err != nil { + return fmt.Errorf("cannot pop the f64 operand for %s: %v", InstructionName(op), err) + } + valueTypeStack.push(ValueTypeI32) + case OpcodeI64ExtendI32S, OpcodeI64ExtendI32U: + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return fmt.Errorf("cannot pop the i32 operand for %s: %v", InstructionName(op), err) + } + valueTypeStack.push(ValueTypeI64) + case OpcodeI64TruncF32S, OpcodeI64TruncF32U: + if err := valueTypeStack.popAndVerifyType(ValueTypeF32); err != nil { + return fmt.Errorf("cannot pop the f32 operand for %s: %v", InstructionName(op), err) + } + valueTypeStack.push(ValueTypeI64) + case OpcodeI64TruncF64S, OpcodeI64TruncF64U: + if err := valueTypeStack.popAndVerifyType(ValueTypeF64); err != nil { + return fmt.Errorf("cannot pop the f64 operand for %s: %v", InstructionName(op), err) + } + valueTypeStack.push(ValueTypeI64) + case OpcodeF32ConvertI32S, OpcodeF32ConvertI32U: + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return fmt.Errorf("cannot pop the i32 operand for %s: %v", InstructionName(op), err) + } + valueTypeStack.push(ValueTypeF32) + case OpcodeF32ConvertI64S, OpcodeF32ConvertI64U: + if err := valueTypeStack.popAndVerifyType(ValueTypeI64); err != nil { + return fmt.Errorf("cannot pop the i64 operand for %s: %v", InstructionName(op), err) + } + valueTypeStack.push(ValueTypeF32) + case OpcodeF32DemoteF64: + if err := valueTypeStack.popAndVerifyType(ValueTypeF64); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", OpcodeF32DemoteF64Name, err) + } + valueTypeStack.push(ValueTypeF32) + case OpcodeF64ConvertI32S, OpcodeF64ConvertI32U: + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return fmt.Errorf("cannot pop the i32 operand for %s: %v", InstructionName(op), err) + } + valueTypeStack.push(ValueTypeF64) + case OpcodeF64ConvertI64S, OpcodeF64ConvertI64U: + if err := valueTypeStack.popAndVerifyType(ValueTypeI64); err != nil { + return fmt.Errorf("cannot pop the i64 operand for %s: %v", InstructionName(op), err) + } + valueTypeStack.push(ValueTypeF64) + case OpcodeF64PromoteF32: + if err := valueTypeStack.popAndVerifyType(ValueTypeF32); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", OpcodeF64PromoteF32Name, err) + } + valueTypeStack.push(ValueTypeF64) + case OpcodeI32ReinterpretF32: + if err := valueTypeStack.popAndVerifyType(ValueTypeF32); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", OpcodeI32ReinterpretF32Name, err) + } + valueTypeStack.push(ValueTypeI32) + case OpcodeI64ReinterpretF64: + if err := valueTypeStack.popAndVerifyType(ValueTypeF64); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", OpcodeI64ReinterpretF64Name, err) + } + valueTypeStack.push(ValueTypeI64) + case OpcodeF32ReinterpretI32: + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", OpcodeF32ReinterpretI32Name, err) + } + valueTypeStack.push(ValueTypeF32) + case OpcodeF64ReinterpretI64: + if err := valueTypeStack.popAndVerifyType(ValueTypeI64); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", OpcodeF64ReinterpretI64Name, err) + } + valueTypeStack.push(ValueTypeF64) + case OpcodeI32Extend8S, OpcodeI32Extend16S: + if err := enabledFeatures.RequireEnabled(api.CoreFeatureSignExtensionOps); err != nil { + return fmt.Errorf("%s invalid as %v", instructionNames[op], err) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", instructionNames[op], err) + } + valueTypeStack.push(ValueTypeI32) + case OpcodeI64Extend8S, OpcodeI64Extend16S, OpcodeI64Extend32S: + if err := enabledFeatures.RequireEnabled(api.CoreFeatureSignExtensionOps); err != nil { + return fmt.Errorf("%s invalid as %v", instructionNames[op], err) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI64); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", instructionNames[op], err) + } + valueTypeStack.push(ValueTypeI64) + default: + return fmt.Errorf("invalid numeric instruction 0x%x", op) + } + } else if op >= OpcodeRefNull && op <= OpcodeRefFunc { + if err := enabledFeatures.RequireEnabled(api.CoreFeatureReferenceTypes); err != nil { + return fmt.Errorf("%s invalid as %v", instructionNames[op], err) + } + switch op { + case OpcodeRefNull: + pc++ + switch reftype := body[pc]; reftype { + case ValueTypeExternref: + valueTypeStack.push(ValueTypeExternref) + case ValueTypeFuncref: + valueTypeStack.push(ValueTypeFuncref) + default: + return fmt.Errorf("unknown type for ref.null: 0x%x", reftype) + } + case OpcodeRefIsNull: + tp, err := valueTypeStack.pop() + if err != nil { + return fmt.Errorf("cannot pop the operand for ref.is_null: %v", err) + } else if !isReferenceValueType(tp) && tp != valueTypeUnknown { + return fmt.Errorf("type mismatch: expected reference type but was %s", ValueTypeName(tp)) + } + valueTypeStack.push(ValueTypeI32) + case OpcodeRefFunc: + pc++ + index, num, err := leb128.LoadUint32(body[pc:]) + if err != nil { + return fmt.Errorf("failed to read function index for ref.func: %v", err) + } + if _, ok := declaredFunctionIndexes[index]; !ok { + return fmt.Errorf("undeclared function index %d for ref.func", index) + } + pc += num - 1 + valueTypeStack.push(ValueTypeFuncref) + } + } else if op == OpcodeTableGet || op == OpcodeTableSet { + if err := enabledFeatures.RequireEnabled(api.CoreFeatureReferenceTypes); err != nil { + return fmt.Errorf("%s is invalid as %v", InstructionName(op), err) + } + pc++ + tableIndex, num, err := leb128.LoadUint32(body[pc:]) + if err != nil { + return fmt.Errorf("read immediate: %v", err) + } + if tableIndex >= uint32(len(tables)) { + return fmt.Errorf("table of index %d not found", tableIndex) + } + + refType := tables[tableIndex].Type + if op == OpcodeTableGet { + if err := valueTypeStack.popAndVerifyType(api.ValueTypeI32); err != nil { + return fmt.Errorf("cannot pop the operand for table.get: %v", err) + } + valueTypeStack.push(refType) + } else { + if err := valueTypeStack.popAndVerifyType(refType); err != nil { + return fmt.Errorf("cannot pop the operand for table.set: %v", err) + } + if err := valueTypeStack.popAndVerifyType(api.ValueTypeI32); err != nil { + return fmt.Errorf("cannot pop the operand for table.set: %v", err) + } + } + pc += num - 1 + } else if op == OpcodeMiscPrefix { + pc++ + // A misc opcode is encoded as an unsigned variable 32-bit integer. + miscOp32, num, err := leb128.LoadUint32(body[pc:]) + if err != nil { + return fmt.Errorf("failed to read misc opcode: %v", err) + } + pc += num - 1 + miscOpcode := byte(miscOp32) + // If the misc opcode is beyond byte range, it is highly likely this is an invalid binary, or + // it is due to the new opcode from a new proposal. In the latter case, we have to + // change the alias type of OpcodeMisc (which is currently byte) to uint32. + if uint32(byte(miscOp32)) != miscOp32 { + return fmt.Errorf("invalid misc opcode: %#x", miscOp32) + } + if miscOpcode >= OpcodeMiscI32TruncSatF32S && miscOpcode <= OpcodeMiscI64TruncSatF64U { + if err := enabledFeatures.RequireEnabled(api.CoreFeatureNonTrappingFloatToIntConversion); err != nil { + return fmt.Errorf("%s invalid as %v", miscInstructionNames[miscOpcode], err) + } + var inType, outType ValueType + switch miscOpcode { + case OpcodeMiscI32TruncSatF32S, OpcodeMiscI32TruncSatF32U: + inType, outType = ValueTypeF32, ValueTypeI32 + case OpcodeMiscI32TruncSatF64S, OpcodeMiscI32TruncSatF64U: + inType, outType = ValueTypeF64, ValueTypeI32 + case OpcodeMiscI64TruncSatF32S, OpcodeMiscI64TruncSatF32U: + inType, outType = ValueTypeF32, ValueTypeI64 + case OpcodeMiscI64TruncSatF64S, OpcodeMiscI64TruncSatF64U: + inType, outType = ValueTypeF64, ValueTypeI64 + } + if err := valueTypeStack.popAndVerifyType(inType); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", miscInstructionNames[miscOpcode], err) + } + valueTypeStack.push(outType) + } else if miscOpcode >= OpcodeMiscMemoryInit && miscOpcode <= OpcodeMiscTableCopy { + if err := enabledFeatures.RequireEnabled(api.CoreFeatureBulkMemoryOperations); err != nil { + return fmt.Errorf("%s invalid as %v", miscInstructionNames[miscOpcode], err) + } + var params []ValueType + // Handle opcodes added in bulk-memory-operations/WebAssembly 2.0. + switch miscOpcode { + case OpcodeMiscDataDrop: + if m.DataCountSection == nil { + return fmt.Errorf("%s requires data count section", MiscInstructionName(miscOpcode)) + } + + // We need to read the index to the data section. + pc++ + index, num, err := leb128.LoadUint32(body[pc:]) + if err != nil { + return fmt.Errorf("failed to read data segment index for %s: %v", MiscInstructionName(miscOpcode), err) + } + if int(index) >= len(m.DataSection) { + return fmt.Errorf("index %d out of range of data section(len=%d)", index, len(m.DataSection)) + } + pc += num - 1 + case OpcodeMiscMemoryInit, OpcodeMiscMemoryCopy, OpcodeMiscMemoryFill: + if memory == nil { + return fmt.Errorf("memory must exist for %s", MiscInstructionName(miscOpcode)) + } + params = []ValueType{ValueTypeI32, ValueTypeI32, ValueTypeI32} + + if miscOpcode == OpcodeMiscMemoryInit { + if m.DataCountSection == nil { + return fmt.Errorf("%s requires data count section", MiscInstructionName(miscOpcode)) + } + + // We need to read the index to the data section. + pc++ + index, num, err := leb128.LoadUint32(body[pc:]) + if err != nil { + return fmt.Errorf("failed to read data segment index for %s: %v", MiscInstructionName(miscOpcode), err) + } + if int(index) >= len(m.DataSection) { + return fmt.Errorf("index %d out of range of data section(len=%d)", index, len(m.DataSection)) + } + pc += num - 1 + } + + pc++ + val, num, err := leb128.LoadUint32(body[pc:]) + if err != nil { + return fmt.Errorf("failed to read memory index for %s: %v", MiscInstructionName(miscOpcode), err) + } + if val != 0 || num != 1 { + return fmt.Errorf("%s reserved byte must be zero encoded with 1 byte", MiscInstructionName(miscOpcode)) + } + if miscOpcode == OpcodeMiscMemoryCopy { + pc++ + // memory.copy needs two memory index which are reserved as zero. + val, num, err := leb128.LoadUint32(body[pc:]) + if err != nil { + return fmt.Errorf("failed to read memory index for %s: %v", MiscInstructionName(miscOpcode), err) + } + if val != 0 || num != 1 { + return fmt.Errorf("%s reserved byte must be zero encoded with 1 byte", MiscInstructionName(miscOpcode)) + } + } + + case OpcodeMiscTableInit: + params = []ValueType{ValueTypeI32, ValueTypeI32, ValueTypeI32} + pc++ + elementIndex, num, err := leb128.LoadUint32(body[pc:]) + if err != nil { + return fmt.Errorf("failed to read element segment index for %s: %v", MiscInstructionName(miscOpcode), err) + } + if int(elementIndex) >= len(m.ElementSection) { + return fmt.Errorf("index %d out of range of element section(len=%d)", elementIndex, len(m.ElementSection)) + } + pc += num + + tableIndex, num, err := leb128.LoadUint32(body[pc:]) + if err != nil { + return fmt.Errorf("failed to read source table index for %s: %v", MiscInstructionName(miscOpcode), err) + } + if tableIndex != 0 { + if err := enabledFeatures.RequireEnabled(api.CoreFeatureReferenceTypes); err != nil { + return fmt.Errorf("source table index must be zero for %s as %v", MiscInstructionName(miscOpcode), err) + } + } + if tableIndex >= uint32(len(tables)) { + return fmt.Errorf("table of index %d not found", tableIndex) + } + + if m.ElementSection[elementIndex].Type != tables[tableIndex].Type { + return fmt.Errorf("type mismatch for table.init: element type %s does not match table type %s", + RefTypeName(m.ElementSection[elementIndex].Type), + RefTypeName(tables[tableIndex].Type), + ) + } + pc += num - 1 + case OpcodeMiscElemDrop: + pc++ + elementIndex, num, err := leb128.LoadUint32(body[pc:]) + if err != nil { + return fmt.Errorf("failed to read element segment index for %s: %v", MiscInstructionName(miscOpcode), err) + } else if int(elementIndex) >= len(m.ElementSection) { + return fmt.Errorf("index %d out of range of element section(len=%d)", elementIndex, len(m.ElementSection)) + } + pc += num - 1 + case OpcodeMiscTableCopy: + params = []ValueType{ValueTypeI32, ValueTypeI32, ValueTypeI32} + pc++ + + dstTableIndex, num, err := leb128.LoadUint32(body[pc:]) + if err != nil { + return fmt.Errorf("failed to read destination table index for %s: %v", MiscInstructionName(miscOpcode), err) + } + if dstTableIndex != 0 { + if err := enabledFeatures.RequireEnabled(api.CoreFeatureReferenceTypes); err != nil { + return fmt.Errorf("destination table index must be zero for %s as %v", MiscInstructionName(miscOpcode), err) + } + } + if dstTableIndex >= uint32(len(tables)) { + return fmt.Errorf("table of index %d not found", dstTableIndex) + } + pc += num + + srcTableIndex, num, err := leb128.LoadUint32(body[pc:]) + if err != nil { + return fmt.Errorf("failed to read source table index for %s: %v", MiscInstructionName(miscOpcode), err) + } + if srcTableIndex != 0 { + if err := enabledFeatures.RequireEnabled(api.CoreFeatureReferenceTypes); err != nil { + return fmt.Errorf("source table index must be zero for %s as %v", MiscInstructionName(miscOpcode), err) + } + } + if srcTableIndex >= uint32(len(tables)) { + return fmt.Errorf("table of index %d not found", srcTableIndex) + } + + if tables[srcTableIndex].Type != tables[dstTableIndex].Type { + return fmt.Errorf("table type mismatch for table.copy: %s (src) != %s (dst)", + RefTypeName(tables[srcTableIndex].Type), RefTypeName(tables[dstTableIndex].Type)) + } + + pc += num - 1 + } + for _, p := range params { + if err := valueTypeStack.popAndVerifyType(p); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", miscInstructionNames[miscOpcode], err) + } + } + } else if miscOpcode >= OpcodeMiscTableGrow && miscOpcode <= OpcodeMiscTableFill { + if err := enabledFeatures.RequireEnabled(api.CoreFeatureReferenceTypes); err != nil { + return fmt.Errorf("%s invalid as %v", miscInstructionNames[miscOpcode], err) + } + + pc++ + tableIndex, num, err := leb128.LoadUint32(body[pc:]) + if err != nil { + return fmt.Errorf("failed to read table index for %s: %v", MiscInstructionName(miscOpcode), err) + } + if tableIndex >= uint32(len(tables)) { + return fmt.Errorf("table of index %d not found", tableIndex) + } + pc += num - 1 + + var params, results []ValueType + reftype := tables[tableIndex].Type + if miscOpcode == OpcodeMiscTableGrow { + params = []ValueType{ValueTypeI32, reftype} + results = []ValueType{ValueTypeI32} + } else if miscOpcode == OpcodeMiscTableSize { + results = []ValueType{ValueTypeI32} + } else if miscOpcode == OpcodeMiscTableFill { + params = []ValueType{ValueTypeI32, reftype, ValueTypeI32} + } + + for _, p := range params { + if err := valueTypeStack.popAndVerifyType(p); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", miscInstructionNames[miscOpcode], err) + } + } + for _, r := range results { + valueTypeStack.push(r) + } + } + } else if op == OpcodeVecPrefix { + pc++ + // Vector instructions come with two bytes where the first byte is always OpcodeVecPrefix, + // and the second byte determines the actual instruction. + vecOpcode := body[pc] + if err := enabledFeatures.RequireEnabled(api.CoreFeatureSIMD); err != nil { + return fmt.Errorf("%s invalid as %v", vectorInstructionName[vecOpcode], err) + } + + switch vecOpcode { + case OpcodeVecV128Const: + // Read 128-bit = 16 bytes constants + if int(pc+16) >= len(body) { + return fmt.Errorf("cannot read constant vector value for %s", vectorInstructionName[vecOpcode]) + } + pc += 16 + valueTypeStack.push(ValueTypeV128) + case OpcodeVecV128AnyTrue, OpcodeVecI8x16AllTrue, OpcodeVecI16x8AllTrue, OpcodeVecI32x4AllTrue, OpcodeVecI64x2AllTrue, + OpcodeVecI8x16BitMask, OpcodeVecI16x8BitMask, OpcodeVecI32x4BitMask, OpcodeVecI64x2BitMask: + if err := valueTypeStack.popAndVerifyType(ValueTypeV128); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + valueTypeStack.push(ValueTypeI32) + case OpcodeVecV128Load, OpcodeVecV128Load8x8s, OpcodeVecV128Load8x8u, OpcodeVecV128Load16x4s, OpcodeVecV128Load16x4u, + OpcodeVecV128Load32x2s, OpcodeVecV128Load32x2u, OpcodeVecV128Load8Splat, OpcodeVecV128Load16Splat, + OpcodeVecV128Load32Splat, OpcodeVecV128Load64Splat, + OpcodeVecV128Load32zero, OpcodeVecV128Load64zero: + if memory == nil { + return fmt.Errorf("memory must exist for %s", VectorInstructionName(vecOpcode)) + } + pc++ + align, _, read, err := readMemArg(pc, body) + if err != nil { + return err + } + pc += read - 1 + var maxAlign uint32 + switch vecOpcode { + case OpcodeVecV128Load: + maxAlign = 128 / 8 + case OpcodeVecV128Load8x8s, OpcodeVecV128Load8x8u, OpcodeVecV128Load16x4s, OpcodeVecV128Load16x4u, + OpcodeVecV128Load32x2s, OpcodeVecV128Load32x2u: + maxAlign = 64 / 8 + case OpcodeVecV128Load8Splat: + maxAlign = 1 + case OpcodeVecV128Load16Splat: + maxAlign = 16 / 8 + case OpcodeVecV128Load32Splat: + maxAlign = 32 / 8 + case OpcodeVecV128Load64Splat: + maxAlign = 64 / 8 + case OpcodeVecV128Load32zero: + maxAlign = 32 / 8 + case OpcodeVecV128Load64zero: + maxAlign = 64 / 8 + } + + if 1< maxAlign { + return fmt.Errorf("invalid memory alignment %d for %s", align, VectorInstructionName(vecOpcode)) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", VectorInstructionName(vecOpcode), err) + } + valueTypeStack.push(ValueTypeV128) + case OpcodeVecV128Store: + if memory == nil { + return fmt.Errorf("memory must exist for %s", VectorInstructionName(vecOpcode)) + } + pc++ + align, _, read, err := readMemArg(pc, body) + if err != nil { + return err + } + pc += read - 1 + if 1< 128/8 { + return fmt.Errorf("invalid memory alignment %d for %s", align, OpcodeVecV128StoreName) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeV128); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", OpcodeVecV128StoreName, err) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", OpcodeVecV128StoreName, err) + } + case OpcodeVecV128Load8Lane, OpcodeVecV128Load16Lane, OpcodeVecV128Load32Lane, OpcodeVecV128Load64Lane: + if memory == nil { + return fmt.Errorf("memory must exist for %s", VectorInstructionName(vecOpcode)) + } + attr := vecLoadLanes[vecOpcode] + pc++ + align, _, read, err := readMemArg(pc, body) + if err != nil { + return err + } + if 1< attr.alignMax { + return fmt.Errorf("invalid memory alignment %d for %s", align, vectorInstructionName[vecOpcode]) + } + pc += read + if pc >= uint64(len(body)) { + return fmt.Errorf("lane for %s not found", OpcodeVecV128Load64LaneName) + } + lane := body[pc] + if lane >= attr.laneCeil { + return fmt.Errorf("invalid lane index %d >= %d for %s", lane, attr.laneCeil, vectorInstructionName[vecOpcode]) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeV128); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + valueTypeStack.push(ValueTypeV128) + case OpcodeVecV128Store8Lane, OpcodeVecV128Store16Lane, OpcodeVecV128Store32Lane, OpcodeVecV128Store64Lane: + if memory == nil { + return fmt.Errorf("memory must exist for %s", VectorInstructionName(vecOpcode)) + } + attr := vecStoreLanes[vecOpcode] + pc++ + align, _, read, err := readMemArg(pc, body) + if err != nil { + return err + } + if 1< attr.alignMax { + return fmt.Errorf("invalid memory alignment %d for %s", align, vectorInstructionName[vecOpcode]) + } + pc += read + if pc >= uint64(len(body)) { + return fmt.Errorf("lane for %s not found", vectorInstructionName[vecOpcode]) + } + lane := body[pc] + if lane >= attr.laneCeil { + return fmt.Errorf("invalid lane index %d >= %d for %s", lane, attr.laneCeil, vectorInstructionName[vecOpcode]) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeV128); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + case OpcodeVecI8x16ExtractLaneS, + OpcodeVecI8x16ExtractLaneU, + OpcodeVecI16x8ExtractLaneS, + OpcodeVecI16x8ExtractLaneU, + OpcodeVecI32x4ExtractLane, + OpcodeVecI64x2ExtractLane, + OpcodeVecF32x4ExtractLane, + OpcodeVecF64x2ExtractLane: + pc++ + if pc >= uint64(len(body)) { + return fmt.Errorf("lane for %s not found", vectorInstructionName[vecOpcode]) + } + attr := vecExtractLanes[vecOpcode] + lane := body[pc] + if lane >= attr.laneCeil { + return fmt.Errorf("invalid lane index %d >= %d for %s", lane, attr.laneCeil, vectorInstructionName[vecOpcode]) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeV128); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + valueTypeStack.push(attr.resultType) + case OpcodeVecI8x16ReplaceLane, OpcodeVecI16x8ReplaceLane, OpcodeVecI32x4ReplaceLane, + OpcodeVecI64x2ReplaceLane, OpcodeVecF32x4ReplaceLane, OpcodeVecF64x2ReplaceLane: + pc++ + if pc >= uint64(len(body)) { + return fmt.Errorf("lane for %s not found", vectorInstructionName[vecOpcode]) + } + attr := vecReplaceLanes[vecOpcode] + lane := body[pc] + if lane >= attr.laneCeil { + return fmt.Errorf("invalid lane index %d >= %d for %s", lane, attr.laneCeil, vectorInstructionName[vecOpcode]) + } + if err := valueTypeStack.popAndVerifyType(attr.paramType); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeV128); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + valueTypeStack.push(ValueTypeV128) + case OpcodeVecI8x16Splat, OpcodeVecI16x8Splat, OpcodeVecI32x4Splat, + OpcodeVecI64x2Splat, OpcodeVecF32x4Splat, OpcodeVecF64x2Splat: + tp := vecSplatValueTypes[vecOpcode] + if err := valueTypeStack.popAndVerifyType(tp); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + valueTypeStack.push(ValueTypeV128) + case OpcodeVecI8x16Swizzle, OpcodeVecV128And, OpcodeVecV128Or, OpcodeVecV128Xor, OpcodeVecV128AndNot: + if err := valueTypeStack.popAndVerifyType(ValueTypeV128); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeV128); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + valueTypeStack.push(ValueTypeV128) + case OpcodeVecV128Bitselect: + if err := valueTypeStack.popAndVerifyType(ValueTypeV128); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeV128); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeV128); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + valueTypeStack.push(ValueTypeV128) + case OpcodeVecV128Not: + if err := valueTypeStack.popAndVerifyType(ValueTypeV128); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + valueTypeStack.push(ValueTypeV128) + case OpcodeVecV128i8x16Shuffle: + pc++ + if pc+15 >= uint64(len(body)) { + return fmt.Errorf("16 lane indexes for %s not found", vectorInstructionName[vecOpcode]) + } + lanes := body[pc : pc+16] + for i, l := range lanes { + if l >= 32 { + return fmt.Errorf("invalid lane index[%d] %d >= %d for %s", i, l, 32, vectorInstructionName[vecOpcode]) + } + } + if err := valueTypeStack.popAndVerifyType(ValueTypeV128); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeV128); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + valueTypeStack.push(ValueTypeV128) + pc += 15 + case OpcodeVecI8x16Shl, OpcodeVecI8x16ShrS, OpcodeVecI8x16ShrU, + OpcodeVecI16x8Shl, OpcodeVecI16x8ShrS, OpcodeVecI16x8ShrU, + OpcodeVecI32x4Shl, OpcodeVecI32x4ShrS, OpcodeVecI32x4ShrU, + OpcodeVecI64x2Shl, OpcodeVecI64x2ShrS, OpcodeVecI64x2ShrU: + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeV128); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + valueTypeStack.push(ValueTypeV128) + case OpcodeVecI8x16Eq, OpcodeVecI8x16Ne, OpcodeVecI8x16LtS, OpcodeVecI8x16LtU, OpcodeVecI8x16GtS, + OpcodeVecI8x16GtU, OpcodeVecI8x16LeS, OpcodeVecI8x16LeU, OpcodeVecI8x16GeS, OpcodeVecI8x16GeU, + OpcodeVecI16x8Eq, OpcodeVecI16x8Ne, OpcodeVecI16x8LtS, OpcodeVecI16x8LtU, OpcodeVecI16x8GtS, + OpcodeVecI16x8GtU, OpcodeVecI16x8LeS, OpcodeVecI16x8LeU, OpcodeVecI16x8GeS, OpcodeVecI16x8GeU, + OpcodeVecI32x4Eq, OpcodeVecI32x4Ne, OpcodeVecI32x4LtS, OpcodeVecI32x4LtU, OpcodeVecI32x4GtS, + OpcodeVecI32x4GtU, OpcodeVecI32x4LeS, OpcodeVecI32x4LeU, OpcodeVecI32x4GeS, OpcodeVecI32x4GeU, + OpcodeVecI64x2Eq, OpcodeVecI64x2Ne, OpcodeVecI64x2LtS, OpcodeVecI64x2GtS, OpcodeVecI64x2LeS, + OpcodeVecI64x2GeS, OpcodeVecF32x4Eq, OpcodeVecF32x4Ne, OpcodeVecF32x4Lt, OpcodeVecF32x4Gt, + OpcodeVecF32x4Le, OpcodeVecF32x4Ge, OpcodeVecF64x2Eq, OpcodeVecF64x2Ne, OpcodeVecF64x2Lt, + OpcodeVecF64x2Gt, OpcodeVecF64x2Le, OpcodeVecF64x2Ge, + OpcodeVecI32x4DotI16x8S, + OpcodeVecI8x16NarrowI16x8S, OpcodeVecI8x16NarrowI16x8U, OpcodeVecI16x8NarrowI32x4S, OpcodeVecI16x8NarrowI32x4U: + if err := valueTypeStack.popAndVerifyType(ValueTypeV128); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeV128); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + valueTypeStack.push(ValueTypeV128) + case OpcodeVecI8x16Neg, OpcodeVecI16x8Neg, OpcodeVecI32x4Neg, OpcodeVecI64x2Neg, OpcodeVecF32x4Neg, OpcodeVecF64x2Neg, + OpcodeVecF32x4Sqrt, OpcodeVecF64x2Sqrt, + OpcodeVecI8x16Abs, OpcodeVecI8x16Popcnt, OpcodeVecI16x8Abs, OpcodeVecI32x4Abs, OpcodeVecI64x2Abs, + OpcodeVecF32x4Abs, OpcodeVecF64x2Abs, + OpcodeVecF32x4Ceil, OpcodeVecF32x4Floor, OpcodeVecF32x4Trunc, OpcodeVecF32x4Nearest, + OpcodeVecF64x2Ceil, OpcodeVecF64x2Floor, OpcodeVecF64x2Trunc, OpcodeVecF64x2Nearest, + OpcodeVecI16x8ExtendLowI8x16S, OpcodeVecI16x8ExtendHighI8x16S, OpcodeVecI16x8ExtendLowI8x16U, OpcodeVecI16x8ExtendHighI8x16U, + OpcodeVecI32x4ExtendLowI16x8S, OpcodeVecI32x4ExtendHighI16x8S, OpcodeVecI32x4ExtendLowI16x8U, OpcodeVecI32x4ExtendHighI16x8U, + OpcodeVecI64x2ExtendLowI32x4S, OpcodeVecI64x2ExtendHighI32x4S, OpcodeVecI64x2ExtendLowI32x4U, OpcodeVecI64x2ExtendHighI32x4U, + OpcodeVecI16x8ExtaddPairwiseI8x16S, OpcodeVecI16x8ExtaddPairwiseI8x16U, + OpcodeVecI32x4ExtaddPairwiseI16x8S, OpcodeVecI32x4ExtaddPairwiseI16x8U, + OpcodeVecF64x2PromoteLowF32x4Zero, OpcodeVecF32x4DemoteF64x2Zero, + OpcodeVecF32x4ConvertI32x4S, OpcodeVecF32x4ConvertI32x4U, + OpcodeVecF64x2ConvertLowI32x4S, OpcodeVecF64x2ConvertLowI32x4U, + OpcodeVecI32x4TruncSatF32x4S, OpcodeVecI32x4TruncSatF32x4U, OpcodeVecI32x4TruncSatF64x2SZero, OpcodeVecI32x4TruncSatF64x2UZero: + if err := valueTypeStack.popAndVerifyType(ValueTypeV128); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + valueTypeStack.push(ValueTypeV128) + + case OpcodeVecI8x16Add, OpcodeVecI8x16AddSatS, OpcodeVecI8x16AddSatU, OpcodeVecI8x16Sub, OpcodeVecI8x16SubSatS, OpcodeVecI8x16SubSatU, + OpcodeVecI16x8Add, OpcodeVecI16x8AddSatS, OpcodeVecI16x8AddSatU, OpcodeVecI16x8Sub, OpcodeVecI16x8SubSatS, OpcodeVecI16x8SubSatU, OpcodeVecI16x8Mul, + OpcodeVecI32x4Add, OpcodeVecI32x4Sub, OpcodeVecI32x4Mul, + OpcodeVecI64x2Add, OpcodeVecI64x2Sub, OpcodeVecI64x2Mul, + OpcodeVecF32x4Add, OpcodeVecF32x4Sub, OpcodeVecF32x4Mul, OpcodeVecF32x4Div, + OpcodeVecF64x2Add, OpcodeVecF64x2Sub, OpcodeVecF64x2Mul, OpcodeVecF64x2Div, + OpcodeVecI8x16MinS, OpcodeVecI8x16MinU, OpcodeVecI8x16MaxS, OpcodeVecI8x16MaxU, + OpcodeVecI8x16AvgrU, + OpcodeVecI16x8MinS, OpcodeVecI16x8MinU, OpcodeVecI16x8MaxS, OpcodeVecI16x8MaxU, + OpcodeVecI16x8AvgrU, + OpcodeVecI32x4MinS, OpcodeVecI32x4MinU, OpcodeVecI32x4MaxS, OpcodeVecI32x4MaxU, + OpcodeVecF32x4Min, OpcodeVecF32x4Max, OpcodeVecF64x2Min, OpcodeVecF64x2Max, + OpcodeVecF32x4Pmin, OpcodeVecF32x4Pmax, OpcodeVecF64x2Pmin, OpcodeVecF64x2Pmax, + OpcodeVecI16x8Q15mulrSatS, + OpcodeVecI16x8ExtMulLowI8x16S, OpcodeVecI16x8ExtMulHighI8x16S, OpcodeVecI16x8ExtMulLowI8x16U, OpcodeVecI16x8ExtMulHighI8x16U, + OpcodeVecI32x4ExtMulLowI16x8S, OpcodeVecI32x4ExtMulHighI16x8S, OpcodeVecI32x4ExtMulLowI16x8U, OpcodeVecI32x4ExtMulHighI16x8U, + OpcodeVecI64x2ExtMulLowI32x4S, OpcodeVecI64x2ExtMulHighI32x4S, OpcodeVecI64x2ExtMulLowI32x4U, OpcodeVecI64x2ExtMulHighI32x4U: + if err := valueTypeStack.popAndVerifyType(ValueTypeV128); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + if err := valueTypeStack.popAndVerifyType(ValueTypeV128); err != nil { + return fmt.Errorf("cannot pop the operand for %s: %v", vectorInstructionName[vecOpcode], err) + } + valueTypeStack.push(ValueTypeV128) + default: + return fmt.Errorf("TODO: SIMD instruction %s will be implemented in #506", vectorInstructionName[vecOpcode]) + } + } else if op == OpcodeBlock { + br.Reset(body[pc+1:]) + bt, num, err := DecodeBlockType(m.TypeSection, br, enabledFeatures) + if err != nil { + return fmt.Errorf("read block: %w", err) + } + controlBlockStack.push(pc, 0, 0, bt, num, 0) + if err = valueTypeStack.popParams(op, bt.Params, false); err != nil { + return err + } + // Plus we have to push any block params again. + for _, p := range bt.Params { + valueTypeStack.push(p) + } + valueTypeStack.pushStackLimit(len(bt.Params)) + pc += num + } else if op == OpcodeLoop { + br.Reset(body[pc+1:]) + bt, num, err := DecodeBlockType(m.TypeSection, br, enabledFeatures) + if err != nil { + return fmt.Errorf("read block: %w", err) + } + controlBlockStack.push(pc, 0, 0, bt, num, op) + if err = valueTypeStack.popParams(op, bt.Params, false); err != nil { + return err + } + // Plus we have to push any block params again. + for _, p := range bt.Params { + valueTypeStack.push(p) + } + valueTypeStack.pushStackLimit(len(bt.Params)) + pc += num + } else if op == OpcodeIf { + br.Reset(body[pc+1:]) + bt, num, err := DecodeBlockType(m.TypeSection, br, enabledFeatures) + if err != nil { + return fmt.Errorf("read block: %w", err) + } + controlBlockStack.push(pc, 0, 0, bt, num, op) + if err = valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return fmt.Errorf("cannot pop the operand for 'if': %v", err) + } + if err = valueTypeStack.popParams(op, bt.Params, false); err != nil { + return err + } + // Plus we have to push any block params again. + for _, p := range bt.Params { + valueTypeStack.push(p) + } + valueTypeStack.pushStackLimit(len(bt.Params)) + pc += num + } else if op == OpcodeElse { + if len(controlBlockStack.stack) == 0 { + return fmt.Errorf("redundant Else instruction at %#x", pc) + } + bl := &controlBlockStack.stack[len(controlBlockStack.stack)-1] + bl.elseAt = pc + // Check the type soundness of the instructions *before* entering this else Op. + if err := valueTypeStack.popResults(OpcodeIf, bl.blockType.Results, true); err != nil { + return err + } + // Before entering instructions inside else, we pop all the values pushed by then block. + valueTypeStack.resetAtStackLimit() + // Plus we have to push any block params again. + for _, p := range bl.blockType.Params { + valueTypeStack.push(p) + } + } else if op == OpcodeEnd { + if len(controlBlockStack.stack) == 0 { + return fmt.Errorf("redundant End instruction at %#x", pc) + } + bl := controlBlockStack.pop() + bl.endAt = pc + + // OpcodeEnd can end a block or the function itself. Check to see what it is: + + ifMissingElse := bl.op == OpcodeIf && bl.elseAt <= bl.startAt + if ifMissingElse { + // If this is the end of block without else, the number of block's results and params must be same. + // Otherwise, the value stack would result in the inconsistent state at runtime. + if !bytes.Equal(bl.blockType.Results, bl.blockType.Params) { + return typeCountError(false, OpcodeElseName, bl.blockType.Params, bl.blockType.Results) + } + // -1 skips else, to handle if block without else properly. + bl.elseAt = bl.endAt - 1 + } + + // Determine the block context + ctx := "" // the outer-most block: the function return + if bl.op == OpcodeIf && !ifMissingElse && bl.elseAt > 0 { + ctx = OpcodeElseName + } else if bl.op != 0 { + ctx = InstructionName(bl.op) + } + + // Check return types match + if err := valueTypeStack.requireStackValues(false, ctx, bl.blockType.Results, true); err != nil { + return err + } + + // Put the result types at the end after resetting at the stack limit + // since we might have Any type between the limit and the current top. + valueTypeStack.resetAtStackLimit() + for _, exp := range bl.blockType.Results { + valueTypeStack.push(exp) + } + // We exit if/loop/block, so reset the constraints on the stack manipulation + // on values previously pushed by outer blocks. + valueTypeStack.popStackLimit() + } else if op == OpcodeReturn { + // Same formatting as OpcodeEnd on the outer-most block + if err := valueTypeStack.requireStackValues(false, "", functionType.Results, false); err != nil { + return err + } + // return instruction is stack-polymorphic. + valueTypeStack.unreachable() + } else if op == OpcodeDrop { + _, err := valueTypeStack.pop() + if err != nil { + return fmt.Errorf("invalid drop: %v", err) + } + } else if op == OpcodeSelect || op == OpcodeTypedSelect { + if err := valueTypeStack.popAndVerifyType(ValueTypeI32); err != nil { + return fmt.Errorf("type mismatch on 3rd select operand: %v", err) + } + v1, err := valueTypeStack.pop() + if err != nil { + return fmt.Errorf("invalid select: %v", err) + } + v2, err := valueTypeStack.pop() + if err != nil { + return fmt.Errorf("invalid select: %v", err) + } + + if op == OpcodeTypedSelect { + if err := enabledFeatures.RequireEnabled(api.CoreFeatureReferenceTypes); err != nil { + return fmt.Errorf("%s is invalid as %w", InstructionName(op), err) + } + pc++ + if numTypeImmeidates := body[pc]; numTypeImmeidates != 1 { + return fmt.Errorf("too many type immediates for %s", InstructionName(op)) + } + pc++ + tp := body[pc] + if tp != ValueTypeI32 && tp != ValueTypeI64 && tp != ValueTypeF32 && tp != ValueTypeF64 && + tp != api.ValueTypeExternref && tp != ValueTypeFuncref && tp != ValueTypeV128 { + return fmt.Errorf("invalid type %s for %s", ValueTypeName(tp), OpcodeTypedSelectName) + } + } else if isReferenceValueType(v1) || isReferenceValueType(v2) { + return fmt.Errorf("reference types cannot be used for non typed select instruction") + } + + if v1 != v2 && v1 != valueTypeUnknown && v2 != valueTypeUnknown { + return fmt.Errorf("type mismatch on 1st and 2nd select operands") + } + if v1 == valueTypeUnknown { + valueTypeStack.push(v2) + } else { + valueTypeStack.push(v1) + } + } else if op == OpcodeUnreachable { + // unreachable instruction is stack-polymorphic. + valueTypeStack.unreachable() + } else if op == OpcodeNop { + } else { + return fmt.Errorf("invalid instruction 0x%x", op) + } + } + + if len(controlBlockStack.stack) > 0 { + return fmt.Errorf("ill-nested block exists") + } + if valueTypeStack.maximumStackPointer > maxStackValues { + return fmt.Errorf("function may have %d stack values, which exceeds limit %d", valueTypeStack.maximumStackPointer, maxStackValues) + } + return nil +} + +var vecExtractLanes = [...]struct { + laneCeil byte + resultType ValueType +}{ + OpcodeVecI8x16ExtractLaneS: {laneCeil: 16, resultType: ValueTypeI32}, + OpcodeVecI8x16ExtractLaneU: {laneCeil: 16, resultType: ValueTypeI32}, + OpcodeVecI16x8ExtractLaneS: {laneCeil: 8, resultType: ValueTypeI32}, + OpcodeVecI16x8ExtractLaneU: {laneCeil: 8, resultType: ValueTypeI32}, + OpcodeVecI32x4ExtractLane: {laneCeil: 4, resultType: ValueTypeI32}, + OpcodeVecI64x2ExtractLane: {laneCeil: 2, resultType: ValueTypeI64}, + OpcodeVecF32x4ExtractLane: {laneCeil: 4, resultType: ValueTypeF32}, + OpcodeVecF64x2ExtractLane: {laneCeil: 2, resultType: ValueTypeF64}, +} + +var vecReplaceLanes = [...]struct { + laneCeil byte + paramType ValueType +}{ + OpcodeVecI8x16ReplaceLane: {laneCeil: 16, paramType: ValueTypeI32}, + OpcodeVecI16x8ReplaceLane: {laneCeil: 8, paramType: ValueTypeI32}, + OpcodeVecI32x4ReplaceLane: {laneCeil: 4, paramType: ValueTypeI32}, + OpcodeVecI64x2ReplaceLane: {laneCeil: 2, paramType: ValueTypeI64}, + OpcodeVecF32x4ReplaceLane: {laneCeil: 4, paramType: ValueTypeF32}, + OpcodeVecF64x2ReplaceLane: {laneCeil: 2, paramType: ValueTypeF64}, +} + +var vecStoreLanes = [...]struct { + alignMax uint32 + laneCeil byte +}{ + OpcodeVecV128Store64Lane: {alignMax: 64 / 8, laneCeil: 128 / 64}, + OpcodeVecV128Store32Lane: {alignMax: 32 / 8, laneCeil: 128 / 32}, + OpcodeVecV128Store16Lane: {alignMax: 16 / 8, laneCeil: 128 / 16}, + OpcodeVecV128Store8Lane: {alignMax: 1, laneCeil: 128 / 8}, +} + +var vecLoadLanes = [...]struct { + alignMax uint32 + laneCeil byte +}{ + OpcodeVecV128Load64Lane: {alignMax: 64 / 8, laneCeil: 128 / 64}, + OpcodeVecV128Load32Lane: {alignMax: 32 / 8, laneCeil: 128 / 32}, + OpcodeVecV128Load16Lane: {alignMax: 16 / 8, laneCeil: 128 / 16}, + OpcodeVecV128Load8Lane: {alignMax: 1, laneCeil: 128 / 8}, +} + +var vecSplatValueTypes = [...]ValueType{ + OpcodeVecI8x16Splat: ValueTypeI32, + OpcodeVecI16x8Splat: ValueTypeI32, + OpcodeVecI32x4Splat: ValueTypeI32, + OpcodeVecI64x2Splat: ValueTypeI64, + OpcodeVecF32x4Splat: ValueTypeF32, + OpcodeVecF64x2Splat: ValueTypeF64, +} + +type stacks struct { + vs valueTypeStack + cs controlBlockStack +} + +func (sts *stacks) reset(functionType *FunctionType) { + // Reset valueStack for reuse. + sts.vs.stack = sts.vs.stack[:0] + sts.vs.stackLimits = sts.vs.stackLimits[:0] + sts.vs.maximumStackPointer = 0 + sts.cs.stack = sts.cs.stack[:0] + sts.cs.stack = append(sts.cs.stack, controlBlock{blockType: functionType}) +} + +type controlBlockStack struct { + stack []controlBlock +} + +func (s *controlBlockStack) pop() *controlBlock { + tail := len(s.stack) - 1 + ret := &s.stack[tail] + s.stack = s.stack[:tail] + return ret +} + +func (s *controlBlockStack) push(startAt, elseAt, endAt uint64, blockType *FunctionType, blockTypeBytes uint64, op Opcode) { + s.stack = append(s.stack, controlBlock{ + startAt: startAt, + elseAt: elseAt, + endAt: endAt, + blockType: blockType, + blockTypeBytes: blockTypeBytes, + op: op, + }) +} + +type valueTypeStack struct { + stack []ValueType + stackLimits []int + maximumStackPointer int + // requireStackValuesTmp is used in requireStackValues function to reduce the allocation. + requireStackValuesTmp []ValueType +} + +// Only used in the analyzeFunction below. +const valueTypeUnknown = ValueType(0xFF) + +func (s *valueTypeStack) tryPop() (vt ValueType, limit int, ok bool) { + if len(s.stackLimits) > 0 { + limit = s.stackLimits[len(s.stackLimits)-1] + } + stackLen := len(s.stack) + if stackLen <= limit { + return + } else if stackLen == limit+1 && s.stack[limit] == valueTypeUnknown { + vt = valueTypeUnknown + ok = true + return + } else { + vt = s.stack[stackLen-1] + s.stack = s.stack[:stackLen-1] + ok = true + return + } +} + +func (s *valueTypeStack) pop() (ValueType, error) { + if vt, limit, ok := s.tryPop(); ok { + return vt, nil + } else { + return 0, fmt.Errorf("invalid operation: trying to pop at %d with limit %d", len(s.stack), limit) + } +} + +// popAndVerifyType returns an error if the stack value is unexpected. +func (s *valueTypeStack) popAndVerifyType(expected ValueType) error { + have, _, ok := s.tryPop() + if !ok { + return fmt.Errorf("%s missing", ValueTypeName(expected)) + } + if have != expected && have != valueTypeUnknown && expected != valueTypeUnknown { + return fmt.Errorf("type mismatch: expected %s, but was %s", ValueTypeName(expected), ValueTypeName(have)) + } + return nil +} + +func (s *valueTypeStack) push(v ValueType) { + s.stack = append(s.stack, v) + if sp := len(s.stack); sp > s.maximumStackPointer { + s.maximumStackPointer = sp + } +} + +func (s *valueTypeStack) unreachable() { + s.resetAtStackLimit() + s.stack = append(s.stack, valueTypeUnknown) +} + +func (s *valueTypeStack) resetAtStackLimit() { + if len(s.stackLimits) != 0 { + s.stack = s.stack[:s.stackLimits[len(s.stackLimits)-1]] + } else { + s.stack = s.stack[:0] + } +} + +func (s *valueTypeStack) popStackLimit() { + if len(s.stackLimits) != 0 { + s.stackLimits = s.stackLimits[:len(s.stackLimits)-1] + } +} + +// pushStackLimit pushes the control frame's bottom of the stack. +func (s *valueTypeStack) pushStackLimit(params int) { + limit := len(s.stack) - params + s.stackLimits = append(s.stackLimits, limit) +} + +func (s *valueTypeStack) popParams(oc Opcode, want []ValueType, checkAboveLimit bool) error { + return s.requireStackValues(true, InstructionName(oc), want, checkAboveLimit) +} + +func (s *valueTypeStack) popResults(oc Opcode, want []ValueType, checkAboveLimit bool) error { + return s.requireStackValues(false, InstructionName(oc), want, checkAboveLimit) +} + +func (s *valueTypeStack) requireStackValues( + isParam bool, + context string, + want []ValueType, + checkAboveLimit bool, +) error { + limit := 0 + if len(s.stackLimits) > 0 { + limit = s.stackLimits[len(s.stackLimits)-1] + } + // Iterate backwards as we are comparing the desired slice against stack value types. + countWanted := len(want) + + // First, check if there are enough values on the stack. + s.requireStackValuesTmp = s.requireStackValuesTmp[:0] + for i := countWanted - 1; i >= 0; i-- { + popped, _, ok := s.tryPop() + if !ok { + if len(s.requireStackValuesTmp) > len(want) { + return typeCountError(isParam, context, s.requireStackValuesTmp, want) + } + return typeCountError(isParam, context, s.requireStackValuesTmp, want) + } + s.requireStackValuesTmp = append(s.requireStackValuesTmp, popped) + } + + // Now, check if there are too many values. + if checkAboveLimit { + if !(limit == len(s.stack) || (limit+1 == len(s.stack) && s.stack[limit] == valueTypeUnknown)) { + return typeCountError(isParam, context, append(s.stack, want...), want) + } + } + + // Finally, check the types of the values: + for i, v := range s.requireStackValuesTmp { + nextWant := want[countWanted-i-1] // have is in reverse order (stack) + if v != nextWant && v != valueTypeUnknown && nextWant != valueTypeUnknown { + return typeMismatchError(isParam, context, v, nextWant, i) + } + } + return nil +} + +// typeMismatchError returns an error similar to go compiler's error on type mismatch. +func typeMismatchError(isParam bool, context string, have ValueType, want ValueType, i int) error { + var ret strings.Builder + ret.WriteString("cannot use ") + ret.WriteString(ValueTypeName(have)) + if context != "" { + ret.WriteString(" in ") + ret.WriteString(context) + ret.WriteString(" block") + } + if isParam { + ret.WriteString(" as param") + } else { + ret.WriteString(" as result") + } + ret.WriteString("[") + ret.WriteString(strconv.Itoa(i)) + ret.WriteString("] type ") + ret.WriteString(ValueTypeName(want)) + return errors.New(ret.String()) +} + +// typeCountError returns an error similar to go compiler's error on type count mismatch. +func typeCountError(isParam bool, context string, have []ValueType, want []ValueType) error { + var ret strings.Builder + if len(have) > len(want) { + ret.WriteString("too many ") + } else { + ret.WriteString("not enough ") + } + if isParam { + ret.WriteString("params") + } else { + ret.WriteString("results") + } + if context != "" { + if isParam { + ret.WriteString(" for ") + } else { + ret.WriteString(" in ") + } + ret.WriteString(context) + ret.WriteString(" block") + } + ret.WriteString("\n\thave (") + writeValueTypes(have, &ret) + ret.WriteString(")\n\twant (") + writeValueTypes(want, &ret) + ret.WriteByte(')') + return errors.New(ret.String()) +} + +func writeValueTypes(vts []ValueType, ret *strings.Builder) { + switch len(vts) { + case 0: + case 1: + ret.WriteString(ValueTypeName(vts[0])) + default: + ret.WriteString(ValueTypeName(vts[0])) + for _, vt := range vts[1:] { + ret.WriteString(", ") + ret.WriteString(ValueTypeName(vt)) + } + } +} + +func (s *valueTypeStack) String() string { + var typeStrs, limits []string + for _, v := range s.stack { + var str string + if v == valueTypeUnknown { + str = "unknown" + } else { + str = ValueTypeName(v) + } + typeStrs = append(typeStrs, str) + } + for _, d := range s.stackLimits { + limits = append(limits, fmt.Sprintf("%d", d)) + } + return fmt.Sprintf("{stack: [%s], limits: [%s]}", + strings.Join(typeStrs, ", "), strings.Join(limits, ",")) +} + +type controlBlock struct { + startAt, elseAt, endAt uint64 + blockType *FunctionType + blockTypeBytes uint64 + // op is zero when the outermost block + op Opcode +} + +// DecodeBlockType decodes the type index from a positive 33-bit signed integer. Negative numbers indicate up to one +// WebAssembly 1.0 (20191205) compatible result type. Positive numbers are decoded when `enabledFeatures` include +// CoreFeatureMultiValue and include an index in the Module.TypeSection. +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-blocktype +// See https://github.com/WebAssembly/spec/blob/wg-2.0.draft1/proposals/multi-value/Overview.md +func DecodeBlockType(types []FunctionType, r *bytes.Reader, enabledFeatures api.CoreFeatures) (*FunctionType, uint64, error) { + raw, num, err := leb128.DecodeInt33AsInt64(r) + if err != nil { + return nil, 0, fmt.Errorf("decode int33: %w", err) + } + + var ret *FunctionType + switch raw { + case -64: // 0x40 in original byte = nil + ret = blockType_v_v + case -1: // 0x7f in original byte = i32 + ret = blockType_v_i32 + case -2: // 0x7e in original byte = i64 + ret = blockType_v_i64 + case -3: // 0x7d in original byte = f32 + ret = blockType_v_f32 + case -4: // 0x7c in original byte = f64 + ret = blockType_v_f64 + case -5: // 0x7b in original byte = v128 + ret = blockType_v_v128 + case -16: // 0x70 in original byte = funcref + ret = blockType_v_funcref + case -17: // 0x6f in original byte = externref + ret = blockType_v_externref + default: + if err = enabledFeatures.RequireEnabled(api.CoreFeatureMultiValue); err != nil { + return nil, num, fmt.Errorf("block with function type return invalid as %v", err) + } + if raw < 0 || (raw >= int64(len(types))) { + return nil, 0, fmt.Errorf("type index out of range: %d", raw) + } + ret = &types[raw] + } + return ret, num, err +} + +// These block types are defined as globals in order to avoid allocations in DecodeBlockType. +var ( + blockType_v_v = &FunctionType{} + blockType_v_i32 = &FunctionType{Results: []ValueType{ValueTypeI32}, ResultNumInUint64: 1} + blockType_v_i64 = &FunctionType{Results: []ValueType{ValueTypeI64}, ResultNumInUint64: 1} + blockType_v_f32 = &FunctionType{Results: []ValueType{ValueTypeF32}, ResultNumInUint64: 1} + blockType_v_f64 = &FunctionType{Results: []ValueType{ValueTypeF64}, ResultNumInUint64: 1} + blockType_v_v128 = &FunctionType{Results: []ValueType{ValueTypeV128}, ResultNumInUint64: 2} + blockType_v_funcref = &FunctionType{Results: []ValueType{ValueTypeFuncref}, ResultNumInUint64: 1} + blockType_v_externref = &FunctionType{Results: []ValueType{ValueTypeExternref}, ResultNumInUint64: 1} +) + +// SplitCallStack returns the input stack resliced to the count of params and +// results, or errors if it isn't long enough for either. +func SplitCallStack(ft *FunctionType, stack []uint64) (params []uint64, results []uint64, err error) { + stackLen := len(stack) + if n := ft.ParamNumInUint64; n > stackLen { + return nil, nil, fmt.Errorf("need %d params, but stack size is %d", n, stackLen) + } else if n > 0 { + params = stack[:n] + } + if n := ft.ResultNumInUint64; n > stackLen { + return nil, nil, fmt.Errorf("need %d results, but stack size is %d", n, stackLen) + } else if n > 0 { + results = stack[:n] + } + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/function_definition.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/function_definition.go new file mode 100644 index 000000000..c5f6e9121 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/function_definition.go @@ -0,0 +1,188 @@ +package wasm + +import ( + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/internalapi" + "github.com/tetratelabs/wazero/internal/wasmdebug" +) + +// ImportedFunctions returns the definitions of each imported function. +// +// Note: Unlike ExportedFunctions, there is no unique constraint on imports. +func (m *Module) ImportedFunctions() (ret []api.FunctionDefinition) { + for i := uint32(0); i < m.ImportFunctionCount; i++ { + ret = append(ret, m.FunctionDefinition(i)) + } + return +} + +// ExportedFunctions returns the definitions of each exported function. +func (m *Module) ExportedFunctions() map[string]api.FunctionDefinition { + ret := map[string]api.FunctionDefinition{} + for i := range m.ExportSection { + exp := &m.ExportSection[i] + if exp.Type == ExternTypeFunc { + d := m.FunctionDefinition(exp.Index) + ret[exp.Name] = d + } + } + return ret +} + +// FunctionDefinition returns the FunctionDefinition for the given `index`. +func (m *Module) FunctionDefinition(index Index) *FunctionDefinition { + // TODO: function initialization is lazy, but bulk. Make it per function. + m.buildFunctionDefinitions() + return &m.FunctionDefinitionSection[index] +} + +// buildFunctionDefinitions generates function metadata that can be parsed from +// the module. This must be called after all validation. +func (m *Module) buildFunctionDefinitions() { + m.functionDefinitionSectionInitOnce.Do(m.buildFunctionDefinitionsOnce) +} + +func (m *Module) buildFunctionDefinitionsOnce() { + var moduleName string + var functionNames NameMap + var localNames, resultNames IndirectNameMap + if m.NameSection != nil { + moduleName = m.NameSection.ModuleName + functionNames = m.NameSection.FunctionNames + localNames = m.NameSection.LocalNames + resultNames = m.NameSection.ResultNames + } + + importCount := m.ImportFunctionCount + m.FunctionDefinitionSection = make([]FunctionDefinition, importCount+uint32(len(m.FunctionSection))) + + importFuncIdx := Index(0) + for i := range m.ImportSection { + imp := &m.ImportSection[i] + if imp.Type != ExternTypeFunc { + continue + } + + def := &m.FunctionDefinitionSection[importFuncIdx] + def.importDesc = imp + def.index = importFuncIdx + def.Functype = &m.TypeSection[imp.DescFunc] + importFuncIdx++ + } + + for codeIndex, typeIndex := range m.FunctionSection { + code := &m.CodeSection[codeIndex] + idx := importFuncIdx + Index(codeIndex) + def := &m.FunctionDefinitionSection[idx] + def.index = idx + def.Functype = &m.TypeSection[typeIndex] + def.goFunc = code.GoFunc + } + + n, nLen := 0, len(functionNames) + for i := range m.FunctionDefinitionSection { + d := &m.FunctionDefinitionSection[i] + // The function name section begins with imports, but can be sparse. + // This keeps track of how far in the name section we've searched. + funcIdx := d.index + var funcName string + for ; n < nLen; n++ { + next := &functionNames[n] + if next.Index > funcIdx { + break // we have function names, but starting at a later index. + } else if next.Index == funcIdx { + funcName = next.Name + break + } + } + + d.moduleName = moduleName + d.name = funcName + d.Debugname = wasmdebug.FuncName(moduleName, funcName, funcIdx) + d.paramNames = paramNames(localNames, funcIdx, len(d.Functype.Params)) + d.resultNames = paramNames(resultNames, funcIdx, len(d.Functype.Results)) + + for i := range m.ExportSection { + e := &m.ExportSection[i] + if e.Type == ExternTypeFunc && e.Index == funcIdx { + d.exportNames = append(d.exportNames, e.Name) + } + } + } +} + +// FunctionDefinition implements api.FunctionDefinition +type FunctionDefinition struct { + internalapi.WazeroOnlyType + moduleName string + index Index + name string + // Debugname is exported for testing purpose. + Debugname string + goFunc interface{} + // Functype is exported for testing purpose. + Functype *FunctionType + importDesc *Import + exportNames []string + paramNames []string + resultNames []string +} + +// ModuleName implements the same method as documented on api.FunctionDefinition. +func (f *FunctionDefinition) ModuleName() string { + return f.moduleName +} + +// Index implements the same method as documented on api.FunctionDefinition. +func (f *FunctionDefinition) Index() uint32 { + return f.index +} + +// Name implements the same method as documented on api.FunctionDefinition. +func (f *FunctionDefinition) Name() string { + return f.name +} + +// DebugName implements the same method as documented on api.FunctionDefinition. +func (f *FunctionDefinition) DebugName() string { + return f.Debugname +} + +// Import implements the same method as documented on api.FunctionDefinition. +func (f *FunctionDefinition) Import() (moduleName, name string, isImport bool) { + if f.importDesc != nil { + importDesc := f.importDesc + moduleName, name, isImport = importDesc.Module, importDesc.Name, true + } + return +} + +// ExportNames implements the same method as documented on api.FunctionDefinition. +func (f *FunctionDefinition) ExportNames() []string { + return f.exportNames +} + +// GoFunction implements the same method as documented on api.FunctionDefinition. +func (f *FunctionDefinition) GoFunction() interface{} { + return f.goFunc +} + +// ParamTypes implements api.FunctionDefinition ParamTypes. +func (f *FunctionDefinition) ParamTypes() []ValueType { + return f.Functype.Params +} + +// ParamNames implements the same method as documented on api.FunctionDefinition. +func (f *FunctionDefinition) ParamNames() []string { + return f.paramNames +} + +// ResultTypes implements api.FunctionDefinition ResultTypes. +func (f *FunctionDefinition) ResultTypes() []ValueType { + return f.Functype.Results +} + +// ResultNames implements the same method as documented on api.FunctionDefinition. +func (f *FunctionDefinition) ResultNames() []string { + return f.resultNames +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/global.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/global.go new file mode 100644 index 000000000..f28f46ed4 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/global.go @@ -0,0 +1,55 @@ +package wasm + +import ( + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/internalapi" +) + +// constantGlobal wraps GlobalInstance to implement api.Global. +type constantGlobal struct { + internalapi.WazeroOnlyType + g *GlobalInstance +} + +// Type implements api.Global. +func (g constantGlobal) Type() api.ValueType { + return g.g.Type.ValType +} + +// Get implements api.Global. +func (g constantGlobal) Get() uint64 { + ret, _ := g.g.Value() + return ret +} + +// String implements api.Global. +func (g constantGlobal) String() string { + return g.g.String() +} + +// mutableGlobal extends constantGlobal to allow updates. +type mutableGlobal struct { + internalapi.WazeroOnlyType + g *GlobalInstance +} + +// Type implements api.Global. +func (g mutableGlobal) Type() api.ValueType { + return g.g.Type.ValType +} + +// Get implements api.Global. +func (g mutableGlobal) Get() uint64 { + ret, _ := g.g.Value() + return ret +} + +// String implements api.Global. +func (g mutableGlobal) String() string { + return g.g.String() +} + +// Set implements the same method as documented on api.MutableGlobal. +func (g mutableGlobal) Set(v uint64) { + g.g.Val = v +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/gofunc.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/gofunc.go new file mode 100644 index 000000000..9510c2588 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/gofunc.go @@ -0,0 +1,279 @@ +package wasm + +import ( + "bytes" + "context" + "errors" + "fmt" + "math" + "reflect" + + "github.com/tetratelabs/wazero/api" +) + +type paramsKind byte + +const ( + paramsKindNoContext paramsKind = iota + paramsKindContext + paramsKindContextModule +) + +// Below are reflection code to get the interface type used to parse functions and set values. + +var ( + moduleType = reflect.TypeOf((*api.Module)(nil)).Elem() + goContextType = reflect.TypeOf((*context.Context)(nil)).Elem() + errorType = reflect.TypeOf((*error)(nil)).Elem() +) + +// compile-time check to ensure reflectGoModuleFunction implements +// api.GoModuleFunction. +var _ api.GoModuleFunction = (*reflectGoModuleFunction)(nil) + +type reflectGoModuleFunction struct { + fn *reflect.Value + params, results []ValueType +} + +// Call implements the same method as documented on api.GoModuleFunction. +func (f *reflectGoModuleFunction) Call(ctx context.Context, mod api.Module, stack []uint64) { + callGoFunc(ctx, mod, f.fn, stack) +} + +// EqualTo is exposed for testing. +func (f *reflectGoModuleFunction) EqualTo(that interface{}) bool { + if f2, ok := that.(*reflectGoModuleFunction); !ok { + return false + } else { + // TODO compare reflect pointers + return bytes.Equal(f.params, f2.params) && bytes.Equal(f.results, f2.results) + } +} + +// compile-time check to ensure reflectGoFunction implements api.GoFunction. +var _ api.GoFunction = (*reflectGoFunction)(nil) + +type reflectGoFunction struct { + fn *reflect.Value + pk paramsKind + params, results []ValueType +} + +// EqualTo is exposed for testing. +func (f *reflectGoFunction) EqualTo(that interface{}) bool { + if f2, ok := that.(*reflectGoFunction); !ok { + return false + } else { + // TODO compare reflect pointers + return f.pk == f2.pk && + bytes.Equal(f.params, f2.params) && bytes.Equal(f.results, f2.results) + } +} + +// Call implements the same method as documented on api.GoFunction. +func (f *reflectGoFunction) Call(ctx context.Context, stack []uint64) { + if f.pk == paramsKindNoContext { + ctx = nil + } + callGoFunc(ctx, nil, f.fn, stack) +} + +// callGoFunc executes the reflective function by converting params to Go +// types. The results of the function call are converted back to api.ValueType. +func callGoFunc(ctx context.Context, mod api.Module, fn *reflect.Value, stack []uint64) { + tp := fn.Type() + + var in []reflect.Value + pLen := tp.NumIn() + if pLen != 0 { + in = make([]reflect.Value, pLen) + + i := 0 + if ctx != nil { + in[0] = newContextVal(ctx) + i++ + } + if mod != nil { + in[1] = newModuleVal(mod) + i++ + } + + for j := 0; i < pLen; i++ { + next := tp.In(i) + val := reflect.New(next).Elem() + k := next.Kind() + raw := stack[j] + j++ + + switch k { + case reflect.Float32: + val.SetFloat(float64(math.Float32frombits(uint32(raw)))) + case reflect.Float64: + val.SetFloat(math.Float64frombits(raw)) + case reflect.Uint32, reflect.Uint64, reflect.Uintptr: + val.SetUint(raw) + case reflect.Int32, reflect.Int64: + val.SetInt(int64(raw)) + default: + panic(fmt.Errorf("BUG: param[%d] has an invalid type: %v", i, k)) + } + in[i] = val + } + } + + // Execute the host function and push back the call result onto the stack. + for i, ret := range fn.Call(in) { + switch ret.Kind() { + case reflect.Float32: + stack[i] = uint64(math.Float32bits(float32(ret.Float()))) + case reflect.Float64: + stack[i] = math.Float64bits(ret.Float()) + case reflect.Uint32, reflect.Uint64, reflect.Uintptr: + stack[i] = ret.Uint() + case reflect.Int32, reflect.Int64: + stack[i] = uint64(ret.Int()) + default: + panic(fmt.Errorf("BUG: result[%d] has an invalid type: %v", i, ret.Kind())) + } + } +} + +func newContextVal(ctx context.Context) reflect.Value { + val := reflect.New(goContextType).Elem() + val.Set(reflect.ValueOf(ctx)) + return val +} + +func newModuleVal(m api.Module) reflect.Value { + val := reflect.New(moduleType).Elem() + val.Set(reflect.ValueOf(m)) + return val +} + +// MustParseGoReflectFuncCode parses Code from the go function or panics. +// +// Exposing this simplifies FunctionDefinition of host functions in built-in host +// modules and tests. +func MustParseGoReflectFuncCode(fn interface{}) Code { + _, _, code, err := parseGoReflectFunc(fn) + if err != nil { + panic(err) + } + return code +} + +func parseGoReflectFunc(fn interface{}) (params, results []ValueType, code Code, err error) { + fnV := reflect.ValueOf(fn) + p := fnV.Type() + + if fnV.Kind() != reflect.Func { + err = fmt.Errorf("kind != func: %s", fnV.Kind().String()) + return + } + + pk, kindErr := kind(p) + if kindErr != nil { + err = kindErr + return + } + + pOffset := 0 + switch pk { + case paramsKindNoContext: + case paramsKindContext: + pOffset = 1 + case paramsKindContextModule: + pOffset = 2 + } + + pCount := p.NumIn() - pOffset + if pCount > 0 { + params = make([]ValueType, pCount) + } + for i := 0; i < len(params); i++ { + pI := p.In(i + pOffset) + if t, ok := getTypeOf(pI.Kind()); ok { + params[i] = t + continue + } + + // Now, we will definitely err, decide which message is best + var arg0Type reflect.Type + if hc := pI.Implements(moduleType); hc { + arg0Type = moduleType + } else if gc := pI.Implements(goContextType); gc { + arg0Type = goContextType + } + + if arg0Type != nil { + err = fmt.Errorf("param[%d] is a %s, which may be defined only once as param[0]", i+pOffset, arg0Type) + } else { + err = fmt.Errorf("param[%d] is unsupported: %s", i+pOffset, pI.Kind()) + } + return + } + + rCount := p.NumOut() + if rCount > 0 { + results = make([]ValueType, rCount) + } + for i := 0; i < len(results); i++ { + rI := p.Out(i) + if t, ok := getTypeOf(rI.Kind()); ok { + results[i] = t + continue + } + + // Now, we will definitely err, decide which message is best + if rI.Implements(errorType) { + err = fmt.Errorf("result[%d] is an error, which is unsupported", i) + } else { + err = fmt.Errorf("result[%d] is unsupported: %s", i, rI.Kind()) + } + return + } + + code = Code{} + if pk == paramsKindContextModule { + code.GoFunc = &reflectGoModuleFunction{fn: &fnV, params: params, results: results} + } else { + code.GoFunc = &reflectGoFunction{pk: pk, fn: &fnV, params: params, results: results} + } + return +} + +func kind(p reflect.Type) (paramsKind, error) { + pCount := p.NumIn() + if pCount > 0 && p.In(0).Kind() == reflect.Interface { + p0 := p.In(0) + if p0.Implements(moduleType) { + return 0, errors.New("invalid signature: api.Module parameter must be preceded by context.Context") + } else if p0.Implements(goContextType) { + if pCount >= 2 && p.In(1).Implements(moduleType) { + return paramsKindContextModule, nil + } + return paramsKindContext, nil + } + } + // Without context param allows portability with reflective runtimes. + // This allows people to more easily port to wazero. + return paramsKindNoContext, nil +} + +func getTypeOf(kind reflect.Kind) (ValueType, bool) { + switch kind { + case reflect.Float64: + return ValueTypeF64, true + case reflect.Float32: + return ValueTypeF32, true + case reflect.Int32, reflect.Uint32: + return ValueTypeI32, true + case reflect.Int64, reflect.Uint64: + return ValueTypeI64, true + case reflect.Uintptr: + return ValueTypeExternref, true + default: + return 0x00, false + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/host.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/host.go new file mode 100644 index 000000000..bca686d1d --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/host.go @@ -0,0 +1,179 @@ +package wasm + +import ( + "errors" + "fmt" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/wasmdebug" +) + +type HostFuncExporter interface { + ExportHostFunc(*HostFunc) +} + +// HostFunc is a function with an inlined type, used for NewHostModule. +// Any corresponding FunctionType will be reused or added to the Module. +type HostFunc struct { + // ExportName is the only value returned by api.FunctionDefinition. + ExportName string + + // Name is equivalent to the same method on api.FunctionDefinition. + Name string + + // ParamTypes is equivalent to the same method on api.FunctionDefinition. + ParamTypes []ValueType + + // ParamNames is equivalent to the same method on api.FunctionDefinition. + ParamNames []string + + // ResultTypes is equivalent to the same method on api.FunctionDefinition. + ResultTypes []ValueType + + // ResultNames is equivalent to the same method on api.FunctionDefinition. + ResultNames []string + + // Code is the equivalent function in the SectionIDCode. + Code Code +} + +// WithGoModuleFunc returns a copy of the function, replacing its Code.GoFunc. +func (f *HostFunc) WithGoModuleFunc(fn api.GoModuleFunc) *HostFunc { + ret := *f + ret.Code.GoFunc = fn + return &ret +} + +// NewHostModule is defined internally for use in WASI tests and to keep the code size in the root directory small. +func NewHostModule( + moduleName string, + exportNames []string, + nameToHostFunc map[string]*HostFunc, + enabledFeatures api.CoreFeatures, +) (m *Module, err error) { + if moduleName != "" { + m = &Module{NameSection: &NameSection{ModuleName: moduleName}} + } else { + return nil, errors.New("a module name must not be empty") + } + + if exportCount := uint32(len(nameToHostFunc)); exportCount > 0 { + m.ExportSection = make([]Export, 0, exportCount) + m.Exports = make(map[string]*Export, exportCount) + if err = addFuncs(m, exportNames, nameToHostFunc, enabledFeatures); err != nil { + return + } + } + + m.IsHostModule = true + // Uses the address of *wasm.Module as the module ID so that host functions can have each state per compilation. + // Downside of this is that compilation cache on host functions (trampoline codes for Go functions and + // Wasm codes for Wasm-implemented host functions) are not available and compiles each time. On the other hand, + // compilation of host modules is not costly as it's merely small trampolines vs the real-world native Wasm binary. + // TODO: refactor engines so that we can properly cache compiled machine codes for host modules. + m.AssignModuleID([]byte(fmt.Sprintf("@@@@@@@@%p", m)), // @@@@@@@@ = any 8 bytes different from Wasm header. + nil, false) + return +} + +func addFuncs( + m *Module, + exportNames []string, + nameToHostFunc map[string]*HostFunc, + enabledFeatures api.CoreFeatures, +) (err error) { + if m.NameSection == nil { + m.NameSection = &NameSection{} + } + moduleName := m.NameSection.ModuleName + + for _, k := range exportNames { + hf := nameToHostFunc[k] + if hf.Name == "" { + hf.Name = k // default name to export name + } + switch hf.Code.GoFunc.(type) { + case api.GoModuleFunction, api.GoFunction: + continue // already parsed + } + + // Resolve the code using reflection + hf.ParamTypes, hf.ResultTypes, hf.Code, err = parseGoReflectFunc(hf.Code.GoFunc) + if err != nil { + return fmt.Errorf("func[%s.%s] %w", moduleName, k, err) + } + + // Assign names to the function, if they exist. + params := hf.ParamTypes + if paramNames := hf.ParamNames; paramNames != nil { + if paramNamesLen := len(paramNames); paramNamesLen != len(params) { + return fmt.Errorf("func[%s.%s] has %d params, but %d params names", moduleName, k, paramNamesLen, len(params)) + } + } + + results := hf.ResultTypes + if resultNames := hf.ResultNames; resultNames != nil { + if resultNamesLen := len(resultNames); resultNamesLen != len(results) { + return fmt.Errorf("func[%s.%s] has %d results, but %d results names", moduleName, k, resultNamesLen, len(results)) + } + } + } + + funcCount := uint32(len(exportNames)) + m.NameSection.FunctionNames = make([]NameAssoc, 0, funcCount) + m.FunctionSection = make([]Index, 0, funcCount) + m.CodeSection = make([]Code, 0, funcCount) + + idx := Index(0) + for _, name := range exportNames { + hf := nameToHostFunc[name] + debugName := wasmdebug.FuncName(moduleName, name, idx) + typeIdx, typeErr := m.maybeAddType(hf.ParamTypes, hf.ResultTypes, enabledFeatures) + if typeErr != nil { + return fmt.Errorf("func[%s] %v", debugName, typeErr) + } + m.FunctionSection = append(m.FunctionSection, typeIdx) + m.CodeSection = append(m.CodeSection, hf.Code) + + export := hf.ExportName + m.ExportSection = append(m.ExportSection, Export{Type: ExternTypeFunc, Name: export, Index: idx}) + m.Exports[export] = &m.ExportSection[len(m.ExportSection)-1] + m.NameSection.FunctionNames = append(m.NameSection.FunctionNames, NameAssoc{Index: idx, Name: hf.Name}) + + if len(hf.ParamNames) > 0 { + localNames := NameMapAssoc{Index: idx} + for i, n := range hf.ParamNames { + localNames.NameMap = append(localNames.NameMap, NameAssoc{Index: Index(i), Name: n}) + } + m.NameSection.LocalNames = append(m.NameSection.LocalNames, localNames) + } + if len(hf.ResultNames) > 0 { + resultNames := NameMapAssoc{Index: idx} + for i, n := range hf.ResultNames { + resultNames.NameMap = append(resultNames.NameMap, NameAssoc{Index: Index(i), Name: n}) + } + m.NameSection.ResultNames = append(m.NameSection.ResultNames, resultNames) + } + idx++ + } + return nil +} + +func (m *Module) maybeAddType(params, results []ValueType, enabledFeatures api.CoreFeatures) (Index, error) { + if len(results) > 1 { + // Guard >1.0 feature multi-value + if err := enabledFeatures.RequireEnabled(api.CoreFeatureMultiValue); err != nil { + return 0, fmt.Errorf("multiple result types invalid as %v", err) + } + } + for i := range m.TypeSection { + t := &m.TypeSection[i] + if t.EqualsSignature(params, results) { + return Index(i), nil + } + } + + result := m.SectionElementCount(SectionIDType) + m.TypeSection = append(m.TypeSection, FunctionType{Params: params, Results: results}) + return result, nil +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/instruction.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/instruction.go new file mode 100644 index 000000000..ded246660 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/instruction.go @@ -0,0 +1,1549 @@ +package wasm + +// Opcode is the binary Opcode of an instruction. See also InstructionName +type Opcode = byte + +const ( + // OpcodeUnreachable causes an unconditional trap. + OpcodeUnreachable Opcode = 0x00 + // OpcodeNop does nothing + OpcodeNop Opcode = 0x01 + // OpcodeBlock brackets a sequence of instructions. A branch instruction on an if label breaks out to after its + // OpcodeEnd. + OpcodeBlock Opcode = 0x02 + // OpcodeLoop brackets a sequence of instructions. A branch instruction on a loop label will jump back to the + // beginning of its block. + OpcodeLoop Opcode = 0x03 + // OpcodeIf brackets a sequence of instructions. When the top of the stack evaluates to 1, the block is executed. + // Zero jumps to the optional OpcodeElse. A branch instruction on an if label breaks out to after its OpcodeEnd. + OpcodeIf Opcode = 0x04 + // OpcodeElse brackets a sequence of instructions enclosed by an OpcodeIf. A branch instruction on a then label + // breaks out to after the OpcodeEnd on the enclosing OpcodeIf. + OpcodeElse Opcode = 0x05 + // OpcodeEnd terminates a control instruction OpcodeBlock, OpcodeLoop or OpcodeIf. + OpcodeEnd Opcode = 0x0b + + // OpcodeBr is a stack-polymorphic opcode that performs an unconditional branch. How the stack is modified depends + // on whether the "br" is enclosed by a loop, and if CoreFeatureMultiValue is enabled. + // + // Here are the rules in pseudocode about how the stack is modified based on the "br" operand L (label): + // if L is loop: append(L.originalStackWithoutInputs, N-values popped from the stack) where N == L.inputs + // else: append(L.originalStackWithoutInputs, N-values popped from the stack) where N == L.results + // + // In WebAssembly 1.0 (20191205), N can be zero or one. When CoreFeatureMultiValue is enabled, N can be more than one, + // depending on the type use of the label L. + // + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#-hrefsyntax-instr-controlmathsfbrl + OpcodeBr Opcode = 0x0c + + OpcodeBrIf Opcode = 0x0d + OpcodeBrTable Opcode = 0x0e + OpcodeReturn Opcode = 0x0f + OpcodeCall Opcode = 0x10 + OpcodeCallIndirect Opcode = 0x11 + + // parametric instructions + + OpcodeDrop Opcode = 0x1a + OpcodeSelect Opcode = 0x1b + OpcodeTypedSelect Opcode = 0x1c + + // variable instructions + + OpcodeLocalGet Opcode = 0x20 + OpcodeLocalSet Opcode = 0x21 + OpcodeLocalTee Opcode = 0x22 + OpcodeGlobalGet Opcode = 0x23 + OpcodeGlobalSet Opcode = 0x24 + + // Below are toggled with CoreFeatureReferenceTypes + + OpcodeTableGet Opcode = 0x25 + OpcodeTableSet Opcode = 0x26 + + // memory instructions + + OpcodeI32Load Opcode = 0x28 + OpcodeI64Load Opcode = 0x29 + OpcodeF32Load Opcode = 0x2a + OpcodeF64Load Opcode = 0x2b + OpcodeI32Load8S Opcode = 0x2c + OpcodeI32Load8U Opcode = 0x2d + OpcodeI32Load16S Opcode = 0x2e + OpcodeI32Load16U Opcode = 0x2f + OpcodeI64Load8S Opcode = 0x30 + OpcodeI64Load8U Opcode = 0x31 + OpcodeI64Load16S Opcode = 0x32 + OpcodeI64Load16U Opcode = 0x33 + OpcodeI64Load32S Opcode = 0x34 + OpcodeI64Load32U Opcode = 0x35 + OpcodeI32Store Opcode = 0x36 + OpcodeI64Store Opcode = 0x37 + OpcodeF32Store Opcode = 0x38 + OpcodeF64Store Opcode = 0x39 + OpcodeI32Store8 Opcode = 0x3a + OpcodeI32Store16 Opcode = 0x3b + OpcodeI64Store8 Opcode = 0x3c + OpcodeI64Store16 Opcode = 0x3d + OpcodeI64Store32 Opcode = 0x3e + OpcodeMemorySize Opcode = 0x3f + OpcodeMemoryGrow Opcode = 0x40 + + // const instructions + + OpcodeI32Const Opcode = 0x41 + OpcodeI64Const Opcode = 0x42 + OpcodeF32Const Opcode = 0x43 + OpcodeF64Const Opcode = 0x44 + + // numeric instructions + + OpcodeI32Eqz Opcode = 0x45 + OpcodeI32Eq Opcode = 0x46 + OpcodeI32Ne Opcode = 0x47 + OpcodeI32LtS Opcode = 0x48 + OpcodeI32LtU Opcode = 0x49 + OpcodeI32GtS Opcode = 0x4a + OpcodeI32GtU Opcode = 0x4b + OpcodeI32LeS Opcode = 0x4c + OpcodeI32LeU Opcode = 0x4d + OpcodeI32GeS Opcode = 0x4e + OpcodeI32GeU Opcode = 0x4f + + OpcodeI64Eqz Opcode = 0x50 + OpcodeI64Eq Opcode = 0x51 + OpcodeI64Ne Opcode = 0x52 + OpcodeI64LtS Opcode = 0x53 + OpcodeI64LtU Opcode = 0x54 + OpcodeI64GtS Opcode = 0x55 + OpcodeI64GtU Opcode = 0x56 + OpcodeI64LeS Opcode = 0x57 + OpcodeI64LeU Opcode = 0x58 + OpcodeI64GeS Opcode = 0x59 + OpcodeI64GeU Opcode = 0x5a + + OpcodeF32Eq Opcode = 0x5b + OpcodeF32Ne Opcode = 0x5c + OpcodeF32Lt Opcode = 0x5d + OpcodeF32Gt Opcode = 0x5e + OpcodeF32Le Opcode = 0x5f + OpcodeF32Ge Opcode = 0x60 + + OpcodeF64Eq Opcode = 0x61 + OpcodeF64Ne Opcode = 0x62 + OpcodeF64Lt Opcode = 0x63 + OpcodeF64Gt Opcode = 0x64 + OpcodeF64Le Opcode = 0x65 + OpcodeF64Ge Opcode = 0x66 + + OpcodeI32Clz Opcode = 0x67 + OpcodeI32Ctz Opcode = 0x68 + OpcodeI32Popcnt Opcode = 0x69 + OpcodeI32Add Opcode = 0x6a + OpcodeI32Sub Opcode = 0x6b + OpcodeI32Mul Opcode = 0x6c + OpcodeI32DivS Opcode = 0x6d + OpcodeI32DivU Opcode = 0x6e + OpcodeI32RemS Opcode = 0x6f + OpcodeI32RemU Opcode = 0x70 + OpcodeI32And Opcode = 0x71 + OpcodeI32Or Opcode = 0x72 + OpcodeI32Xor Opcode = 0x73 + OpcodeI32Shl Opcode = 0x74 + OpcodeI32ShrS Opcode = 0x75 + OpcodeI32ShrU Opcode = 0x76 + OpcodeI32Rotl Opcode = 0x77 + OpcodeI32Rotr Opcode = 0x78 + + OpcodeI64Clz Opcode = 0x79 + OpcodeI64Ctz Opcode = 0x7a + OpcodeI64Popcnt Opcode = 0x7b + OpcodeI64Add Opcode = 0x7c + OpcodeI64Sub Opcode = 0x7d + OpcodeI64Mul Opcode = 0x7e + OpcodeI64DivS Opcode = 0x7f + OpcodeI64DivU Opcode = 0x80 + OpcodeI64RemS Opcode = 0x81 + OpcodeI64RemU Opcode = 0x82 + OpcodeI64And Opcode = 0x83 + OpcodeI64Or Opcode = 0x84 + OpcodeI64Xor Opcode = 0x85 + OpcodeI64Shl Opcode = 0x86 + OpcodeI64ShrS Opcode = 0x87 + OpcodeI64ShrU Opcode = 0x88 + OpcodeI64Rotl Opcode = 0x89 + OpcodeI64Rotr Opcode = 0x8a + + OpcodeF32Abs Opcode = 0x8b + OpcodeF32Neg Opcode = 0x8c + OpcodeF32Ceil Opcode = 0x8d + OpcodeF32Floor Opcode = 0x8e + OpcodeF32Trunc Opcode = 0x8f + OpcodeF32Nearest Opcode = 0x90 + OpcodeF32Sqrt Opcode = 0x91 + OpcodeF32Add Opcode = 0x92 + OpcodeF32Sub Opcode = 0x93 + OpcodeF32Mul Opcode = 0x94 + OpcodeF32Div Opcode = 0x95 + OpcodeF32Min Opcode = 0x96 + OpcodeF32Max Opcode = 0x97 + OpcodeF32Copysign Opcode = 0x98 + + OpcodeF64Abs Opcode = 0x99 + OpcodeF64Neg Opcode = 0x9a + OpcodeF64Ceil Opcode = 0x9b + OpcodeF64Floor Opcode = 0x9c + OpcodeF64Trunc Opcode = 0x9d + OpcodeF64Nearest Opcode = 0x9e + OpcodeF64Sqrt Opcode = 0x9f + OpcodeF64Add Opcode = 0xa0 + OpcodeF64Sub Opcode = 0xa1 + OpcodeF64Mul Opcode = 0xa2 + OpcodeF64Div Opcode = 0xa3 + OpcodeF64Min Opcode = 0xa4 + OpcodeF64Max Opcode = 0xa5 + OpcodeF64Copysign Opcode = 0xa6 + + OpcodeI32WrapI64 Opcode = 0xa7 + OpcodeI32TruncF32S Opcode = 0xa8 + OpcodeI32TruncF32U Opcode = 0xa9 + OpcodeI32TruncF64S Opcode = 0xaa + OpcodeI32TruncF64U Opcode = 0xab + + OpcodeI64ExtendI32S Opcode = 0xac + OpcodeI64ExtendI32U Opcode = 0xad + OpcodeI64TruncF32S Opcode = 0xae + OpcodeI64TruncF32U Opcode = 0xaf + OpcodeI64TruncF64S Opcode = 0xb0 + OpcodeI64TruncF64U Opcode = 0xb1 + + OpcodeF32ConvertI32S Opcode = 0xb2 + OpcodeF32ConvertI32U Opcode = 0xb3 + OpcodeF32ConvertI64S Opcode = 0xb4 + OpcodeF32ConvertI64U Opcode = 0xb5 + OpcodeF32DemoteF64 Opcode = 0xb6 + + OpcodeF64ConvertI32S Opcode = 0xb7 + OpcodeF64ConvertI32U Opcode = 0xb8 + OpcodeF64ConvertI64S Opcode = 0xb9 + OpcodeF64ConvertI64U Opcode = 0xba + OpcodeF64PromoteF32 Opcode = 0xbb + + OpcodeI32ReinterpretF32 Opcode = 0xbc + OpcodeI64ReinterpretF64 Opcode = 0xbd + OpcodeF32ReinterpretI32 Opcode = 0xbe + OpcodeF64ReinterpretI64 Opcode = 0xbf + + // OpcodeRefNull pushes a null reference value whose type is specified by immediate to this opcode. + // This is defined in the reference-types proposal, but necessary for CoreFeatureBulkMemoryOperations as well. + // + // Currently only supported in the constant expression in element segments. + OpcodeRefNull = 0xd0 + // OpcodeRefIsNull pops a reference value, and pushes 1 if it is null, 0 otherwise. + // This is defined in the reference-types proposal, but necessary for CoreFeatureBulkMemoryOperations as well. + // + // Currently not supported. + OpcodeRefIsNull = 0xd1 + // OpcodeRefFunc pushes a funcref value whose index equals the immediate to this opcode. + // This is defined in the reference-types proposal, but necessary for CoreFeatureBulkMemoryOperations as well. + // + // Currently, this is only supported in the constant expression in element segments. + OpcodeRefFunc = 0xd2 + + // Below are toggled with CoreFeatureSignExtensionOps + + // OpcodeI32Extend8S extends a signed 8-bit integer to a 32-bit integer. + // Note: This is dependent on the flag CoreFeatureSignExtensionOps + OpcodeI32Extend8S Opcode = 0xc0 + + // OpcodeI32Extend16S extends a signed 16-bit integer to a 32-bit integer. + // Note: This is dependent on the flag CoreFeatureSignExtensionOps + OpcodeI32Extend16S Opcode = 0xc1 + + // OpcodeI64Extend8S extends a signed 8-bit integer to a 64-bit integer. + // Note: This is dependent on the flag CoreFeatureSignExtensionOps + OpcodeI64Extend8S Opcode = 0xc2 + + // OpcodeI64Extend16S extends a signed 16-bit integer to a 64-bit integer. + // Note: This is dependent on the flag CoreFeatureSignExtensionOps + OpcodeI64Extend16S Opcode = 0xc3 + + // OpcodeI64Extend32S extends a signed 32-bit integer to a 64-bit integer. + // Note: This is dependent on the flag CoreFeatureSignExtensionOps + OpcodeI64Extend32S Opcode = 0xc4 + + // OpcodeMiscPrefix is the prefix of various multi-byte opcodes. + // Introduced in CoreFeatureNonTrappingFloatToIntConversion, but used in other + // features, such as CoreFeatureBulkMemoryOperations. + OpcodeMiscPrefix Opcode = 0xfc + + // OpcodeVecPrefix is the prefix of all vector isntructions introduced in + // CoreFeatureSIMD. + OpcodeVecPrefix Opcode = 0xfd +) + +// OpcodeMisc represents opcodes of the miscellaneous operations. +// Such an operations has multi-byte encoding which is prefixed by OpcodeMiscPrefix. +type OpcodeMisc = byte + +const ( + // Below are toggled with CoreFeatureNonTrappingFloatToIntConversion. + // https://github.com/WebAssembly/spec/blob/ce4b6c4d47eb06098cc7ab2e81f24748da822f20/proposals/nontrapping-float-to-int-conversion/Overview.md + + OpcodeMiscI32TruncSatF32S OpcodeMisc = 0x00 + OpcodeMiscI32TruncSatF32U OpcodeMisc = 0x01 + OpcodeMiscI32TruncSatF64S OpcodeMisc = 0x02 + OpcodeMiscI32TruncSatF64U OpcodeMisc = 0x03 + OpcodeMiscI64TruncSatF32S OpcodeMisc = 0x04 + OpcodeMiscI64TruncSatF32U OpcodeMisc = 0x05 + OpcodeMiscI64TruncSatF64S OpcodeMisc = 0x06 + OpcodeMiscI64TruncSatF64U OpcodeMisc = 0x07 + + // Below are toggled with CoreFeatureBulkMemoryOperations. + // Opcodes are those new in document/core/appendix/index-instructions.rst (the commit that merged the feature). + // See https://github.com/WebAssembly/spec/commit/7fa2f20a6df4cf1c114582c8cb60f5bfcdbf1be1 + // See https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/appendix/changes.html#bulk-memory-and-table-instructions + + OpcodeMiscMemoryInit OpcodeMisc = 0x08 + OpcodeMiscDataDrop OpcodeMisc = 0x09 + OpcodeMiscMemoryCopy OpcodeMisc = 0x0a + OpcodeMiscMemoryFill OpcodeMisc = 0x0b + OpcodeMiscTableInit OpcodeMisc = 0x0c + OpcodeMiscElemDrop OpcodeMisc = 0x0d + OpcodeMiscTableCopy OpcodeMisc = 0x0e + + // Below are toggled with CoreFeatureReferenceTypes + + OpcodeMiscTableGrow OpcodeMisc = 0x0f + OpcodeMiscTableSize OpcodeMisc = 0x10 + OpcodeMiscTableFill OpcodeMisc = 0x11 +) + +// OpcodeVec represents an opcode of a vector instructions which has +// multi-byte encoding and is prefixed by OpcodeMiscPrefix. +// +// These opcodes are toggled with CoreFeatureSIMD. +type OpcodeVec = byte + +const ( + // Loads and stores. + + OpcodeVecV128Load OpcodeVec = 0x00 + OpcodeVecV128Load8x8s OpcodeVec = 0x01 + OpcodeVecV128Load8x8u OpcodeVec = 0x02 + OpcodeVecV128Load16x4s OpcodeVec = 0x03 + OpcodeVecV128Load16x4u OpcodeVec = 0x04 + OpcodeVecV128Load32x2s OpcodeVec = 0x05 + OpcodeVecV128Load32x2u OpcodeVec = 0x06 + OpcodeVecV128Load8Splat OpcodeVec = 0x07 + OpcodeVecV128Load16Splat OpcodeVec = 0x08 + OpcodeVecV128Load32Splat OpcodeVec = 0x09 + OpcodeVecV128Load64Splat OpcodeVec = 0x0a + + OpcodeVecV128Load32zero OpcodeVec = 0x5c + OpcodeVecV128Load64zero OpcodeVec = 0x5d + + OpcodeVecV128Store OpcodeVec = 0x0b + OpcodeVecV128Load8Lane OpcodeVec = 0x54 + OpcodeVecV128Load16Lane OpcodeVec = 0x55 + OpcodeVecV128Load32Lane OpcodeVec = 0x56 + OpcodeVecV128Load64Lane OpcodeVec = 0x57 + OpcodeVecV128Store8Lane OpcodeVec = 0x58 + OpcodeVecV128Store16Lane OpcodeVec = 0x59 + OpcodeVecV128Store32Lane OpcodeVec = 0x5a + OpcodeVecV128Store64Lane OpcodeVec = 0x5b + + // OpcodeVecV128Const is the vector const instruction. + OpcodeVecV128Const OpcodeVec = 0x0c + + // OpcodeVecV128i8x16Shuffle is the vector shuffle instruction. + OpcodeVecV128i8x16Shuffle OpcodeVec = 0x0d + + // Extrac and replaces. + + OpcodeVecI8x16ExtractLaneS OpcodeVec = 0x15 + OpcodeVecI8x16ExtractLaneU OpcodeVec = 0x16 + OpcodeVecI8x16ReplaceLane OpcodeVec = 0x17 + OpcodeVecI16x8ExtractLaneS OpcodeVec = 0x18 + OpcodeVecI16x8ExtractLaneU OpcodeVec = 0x19 + OpcodeVecI16x8ReplaceLane OpcodeVec = 0x1a + OpcodeVecI32x4ExtractLane OpcodeVec = 0x1b + OpcodeVecI32x4ReplaceLane OpcodeVec = 0x1c + OpcodeVecI64x2ExtractLane OpcodeVec = 0x1d + OpcodeVecI64x2ReplaceLane OpcodeVec = 0x1e + OpcodeVecF32x4ExtractLane OpcodeVec = 0x1f + OpcodeVecF32x4ReplaceLane OpcodeVec = 0x20 + OpcodeVecF64x2ExtractLane OpcodeVec = 0x21 + OpcodeVecF64x2ReplaceLane OpcodeVec = 0x22 + + // Splat and swizzle. + + OpcodeVecI8x16Swizzle OpcodeVec = 0x0e + OpcodeVecI8x16Splat OpcodeVec = 0x0f + OpcodeVecI16x8Splat OpcodeVec = 0x10 + OpcodeVecI32x4Splat OpcodeVec = 0x11 + OpcodeVecI64x2Splat OpcodeVec = 0x12 + OpcodeVecF32x4Splat OpcodeVec = 0x13 + OpcodeVecF64x2Splat OpcodeVec = 0x14 + + // i8 comparisons. + + OpcodeVecI8x16Eq OpcodeVec = 0x23 + OpcodeVecI8x16Ne OpcodeVec = 0x24 + OpcodeVecI8x16LtS OpcodeVec = 0x25 + OpcodeVecI8x16LtU OpcodeVec = 0x26 + OpcodeVecI8x16GtS OpcodeVec = 0x27 + OpcodeVecI8x16GtU OpcodeVec = 0x28 + OpcodeVecI8x16LeS OpcodeVec = 0x29 + OpcodeVecI8x16LeU OpcodeVec = 0x2a + OpcodeVecI8x16GeS OpcodeVec = 0x2b + OpcodeVecI8x16GeU OpcodeVec = 0x2c + + // i16 comparisons. + + OpcodeVecI16x8Eq OpcodeVec = 0x2d + OpcodeVecI16x8Ne OpcodeVec = 0x2e + OpcodeVecI16x8LtS OpcodeVec = 0x2f + OpcodeVecI16x8LtU OpcodeVec = 0x30 + OpcodeVecI16x8GtS OpcodeVec = 0x31 + OpcodeVecI16x8GtU OpcodeVec = 0x32 + OpcodeVecI16x8LeS OpcodeVec = 0x33 + OpcodeVecI16x8LeU OpcodeVec = 0x34 + OpcodeVecI16x8GeS OpcodeVec = 0x35 + OpcodeVecI16x8GeU OpcodeVec = 0x36 + + // i32 comparisons. + + OpcodeVecI32x4Eq OpcodeVec = 0x37 + OpcodeVecI32x4Ne OpcodeVec = 0x38 + OpcodeVecI32x4LtS OpcodeVec = 0x39 + OpcodeVecI32x4LtU OpcodeVec = 0x3a + OpcodeVecI32x4GtS OpcodeVec = 0x3b + OpcodeVecI32x4GtU OpcodeVec = 0x3c + OpcodeVecI32x4LeS OpcodeVec = 0x3d + OpcodeVecI32x4LeU OpcodeVec = 0x3e + OpcodeVecI32x4GeS OpcodeVec = 0x3f + OpcodeVecI32x4GeU OpcodeVec = 0x40 + + // i64 comparisons. + + OpcodeVecI64x2Eq OpcodeVec = 0xd6 + OpcodeVecI64x2Ne OpcodeVec = 0xd7 + OpcodeVecI64x2LtS OpcodeVec = 0xd8 + OpcodeVecI64x2GtS OpcodeVec = 0xd9 + OpcodeVecI64x2LeS OpcodeVec = 0xda + OpcodeVecI64x2GeS OpcodeVec = 0xdb + + // f32 comparisons. + + OpcodeVecF32x4Eq OpcodeVec = 0x41 + OpcodeVecF32x4Ne OpcodeVec = 0x42 + OpcodeVecF32x4Lt OpcodeVec = 0x43 + OpcodeVecF32x4Gt OpcodeVec = 0x44 + OpcodeVecF32x4Le OpcodeVec = 0x45 + OpcodeVecF32x4Ge OpcodeVec = 0x46 + + // f64 comparisons. + + OpcodeVecF64x2Eq OpcodeVec = 0x47 + OpcodeVecF64x2Ne OpcodeVec = 0x48 + OpcodeVecF64x2Lt OpcodeVec = 0x49 + OpcodeVecF64x2Gt OpcodeVec = 0x4a + OpcodeVecF64x2Le OpcodeVec = 0x4b + OpcodeVecF64x2Ge OpcodeVec = 0x4c + + // v128 logical instructions. + + OpcodeVecV128Not OpcodeVec = 0x4d + OpcodeVecV128And OpcodeVec = 0x4e + OpcodeVecV128AndNot OpcodeVec = 0x4f + OpcodeVecV128Or OpcodeVec = 0x50 + OpcodeVecV128Xor OpcodeVec = 0x51 + OpcodeVecV128Bitselect OpcodeVec = 0x52 + OpcodeVecV128AnyTrue OpcodeVec = 0x53 + + // i8 misc. + + OpcodeVecI8x16Abs OpcodeVec = 0x60 + OpcodeVecI8x16Neg OpcodeVec = 0x61 + OpcodeVecI8x16Popcnt OpcodeVec = 0x62 + OpcodeVecI8x16AllTrue OpcodeVec = 0x63 + OpcodeVecI8x16BitMask OpcodeVec = 0x64 + OpcodeVecI8x16NarrowI16x8S OpcodeVec = 0x65 + OpcodeVecI8x16NarrowI16x8U OpcodeVec = 0x66 + + OpcodeVecI8x16Shl OpcodeVec = 0x6b + OpcodeVecI8x16ShrS OpcodeVec = 0x6c + OpcodeVecI8x16ShrU OpcodeVec = 0x6d + OpcodeVecI8x16Add OpcodeVec = 0x6e + OpcodeVecI8x16AddSatS OpcodeVec = 0x6f + + OpcodeVecI8x16AddSatU OpcodeVec = 0x70 + OpcodeVecI8x16Sub OpcodeVec = 0x71 + OpcodeVecI8x16SubSatS OpcodeVec = 0x72 + OpcodeVecI8x16SubSatU OpcodeVec = 0x73 + OpcodeVecI8x16MinS OpcodeVec = 0x76 + OpcodeVecI8x16MinU OpcodeVec = 0x77 + OpcodeVecI8x16MaxS OpcodeVec = 0x78 + OpcodeVecI8x16MaxU OpcodeVec = 0x79 + OpcodeVecI8x16AvgrU OpcodeVec = 0x7b + + // i16 misc. + + OpcodeVecI16x8ExtaddPairwiseI8x16S OpcodeVec = 0x7c + OpcodeVecI16x8ExtaddPairwiseI8x16U OpcodeVec = 0x7d + OpcodeVecI16x8Abs OpcodeVec = 0x80 + OpcodeVecI16x8Neg OpcodeVec = 0x81 + OpcodeVecI16x8Q15mulrSatS OpcodeVec = 0x82 + OpcodeVecI16x8AllTrue OpcodeVec = 0x83 + OpcodeVecI16x8BitMask OpcodeVec = 0x84 + OpcodeVecI16x8NarrowI32x4S OpcodeVec = 0x85 + OpcodeVecI16x8NarrowI32x4U OpcodeVec = 0x86 + OpcodeVecI16x8ExtendLowI8x16S OpcodeVec = 0x87 + OpcodeVecI16x8ExtendHighI8x16S OpcodeVec = 0x88 + OpcodeVecI16x8ExtendLowI8x16U OpcodeVec = 0x89 + OpcodeVecI16x8ExtendHighI8x16U OpcodeVec = 0x8a + OpcodeVecI16x8Shl OpcodeVec = 0x8b + OpcodeVecI16x8ShrS OpcodeVec = 0x8c + OpcodeVecI16x8ShrU OpcodeVec = 0x8d + OpcodeVecI16x8Add OpcodeVec = 0x8e + OpcodeVecI16x8AddSatS OpcodeVec = 0x8f + OpcodeVecI16x8AddSatU OpcodeVec = 0x90 + OpcodeVecI16x8Sub OpcodeVec = 0x91 + OpcodeVecI16x8SubSatS OpcodeVec = 0x92 + OpcodeVecI16x8SubSatU OpcodeVec = 0x93 + OpcodeVecI16x8Mul OpcodeVec = 0x95 + OpcodeVecI16x8MinS OpcodeVec = 0x96 + OpcodeVecI16x8MinU OpcodeVec = 0x97 + OpcodeVecI16x8MaxS OpcodeVec = 0x98 + OpcodeVecI16x8MaxU OpcodeVec = 0x99 + OpcodeVecI16x8AvgrU OpcodeVec = 0x9b + OpcodeVecI16x8ExtMulLowI8x16S OpcodeVec = 0x9c + OpcodeVecI16x8ExtMulHighI8x16S OpcodeVec = 0x9d + OpcodeVecI16x8ExtMulLowI8x16U OpcodeVec = 0x9e + OpcodeVecI16x8ExtMulHighI8x16U OpcodeVec = 0x9f + + // i32 misc. + + OpcodeVecI32x4ExtaddPairwiseI16x8S OpcodeVec = 0x7e + OpcodeVecI32x4ExtaddPairwiseI16x8U OpcodeVec = 0x7f + OpcodeVecI32x4Abs OpcodeVec = 0xa0 + OpcodeVecI32x4Neg OpcodeVec = 0xa1 + OpcodeVecI32x4AllTrue OpcodeVec = 0xa3 + OpcodeVecI32x4BitMask OpcodeVec = 0xa4 + OpcodeVecI32x4ExtendLowI16x8S OpcodeVec = 0xa7 + OpcodeVecI32x4ExtendHighI16x8S OpcodeVec = 0xa8 + OpcodeVecI32x4ExtendLowI16x8U OpcodeVec = 0xa9 + OpcodeVecI32x4ExtendHighI16x8U OpcodeVec = 0xaa + OpcodeVecI32x4Shl OpcodeVec = 0xab + OpcodeVecI32x4ShrS OpcodeVec = 0xac + OpcodeVecI32x4ShrU OpcodeVec = 0xad + OpcodeVecI32x4Add OpcodeVec = 0xae + OpcodeVecI32x4Sub OpcodeVec = 0xb1 + OpcodeVecI32x4Mul OpcodeVec = 0xb5 + OpcodeVecI32x4MinS OpcodeVec = 0xb6 + OpcodeVecI32x4MinU OpcodeVec = 0xb7 + OpcodeVecI32x4MaxS OpcodeVec = 0xb8 + OpcodeVecI32x4MaxU OpcodeVec = 0xb9 + OpcodeVecI32x4DotI16x8S OpcodeVec = 0xba + OpcodeVecI32x4ExtMulLowI16x8S OpcodeVec = 0xbc + OpcodeVecI32x4ExtMulHighI16x8S OpcodeVec = 0xbd + OpcodeVecI32x4ExtMulLowI16x8U OpcodeVec = 0xbe + OpcodeVecI32x4ExtMulHighI16x8U OpcodeVec = 0xbf + + // i64 misc. + + OpcodeVecI64x2Abs OpcodeVec = 0xc0 + OpcodeVecI64x2Neg OpcodeVec = 0xc1 + OpcodeVecI64x2AllTrue OpcodeVec = 0xc3 + OpcodeVecI64x2BitMask OpcodeVec = 0xc4 + OpcodeVecI64x2ExtendLowI32x4S OpcodeVec = 0xc7 + OpcodeVecI64x2ExtendHighI32x4S OpcodeVec = 0xc8 + OpcodeVecI64x2ExtendLowI32x4U OpcodeVec = 0xc9 + OpcodeVecI64x2ExtendHighI32x4U OpcodeVec = 0xca + OpcodeVecI64x2Shl OpcodeVec = 0xcb + OpcodeVecI64x2ShrS OpcodeVec = 0xcc + OpcodeVecI64x2ShrU OpcodeVec = 0xcd + OpcodeVecI64x2Add OpcodeVec = 0xce + OpcodeVecI64x2Sub OpcodeVec = 0xd1 + OpcodeVecI64x2Mul OpcodeVec = 0xd5 + OpcodeVecI64x2ExtMulLowI32x4S OpcodeVec = 0xdc + OpcodeVecI64x2ExtMulHighI32x4S OpcodeVec = 0xdd + OpcodeVecI64x2ExtMulLowI32x4U OpcodeVec = 0xde + OpcodeVecI64x2ExtMulHighI32x4U OpcodeVec = 0xdf + + // f32 misc. + + OpcodeVecF32x4Ceil OpcodeVec = 0x67 + OpcodeVecF32x4Floor OpcodeVec = 0x68 + OpcodeVecF32x4Trunc OpcodeVec = 0x69 + OpcodeVecF32x4Nearest OpcodeVec = 0x6a + OpcodeVecF32x4Abs OpcodeVec = 0xe0 + OpcodeVecF32x4Neg OpcodeVec = 0xe1 + OpcodeVecF32x4Sqrt OpcodeVec = 0xe3 + OpcodeVecF32x4Add OpcodeVec = 0xe4 + OpcodeVecF32x4Sub OpcodeVec = 0xe5 + OpcodeVecF32x4Mul OpcodeVec = 0xe6 + OpcodeVecF32x4Div OpcodeVec = 0xe7 + OpcodeVecF32x4Min OpcodeVec = 0xe8 + OpcodeVecF32x4Max OpcodeVec = 0xe9 + OpcodeVecF32x4Pmin OpcodeVec = 0xea + OpcodeVecF32x4Pmax OpcodeVec = 0xeb + + // f64 misc. + + OpcodeVecF64x2Ceil OpcodeVec = 0x74 + OpcodeVecF64x2Floor OpcodeVec = 0x75 + OpcodeVecF64x2Trunc OpcodeVec = 0x7a + OpcodeVecF64x2Nearest OpcodeVec = 0x94 + OpcodeVecF64x2Abs OpcodeVec = 0xec + OpcodeVecF64x2Neg OpcodeVec = 0xed + OpcodeVecF64x2Sqrt OpcodeVec = 0xef + OpcodeVecF64x2Add OpcodeVec = 0xf0 + OpcodeVecF64x2Sub OpcodeVec = 0xf1 + OpcodeVecF64x2Mul OpcodeVec = 0xf2 + OpcodeVecF64x2Div OpcodeVec = 0xf3 + OpcodeVecF64x2Min OpcodeVec = 0xf4 + OpcodeVecF64x2Max OpcodeVec = 0xf5 + OpcodeVecF64x2Pmin OpcodeVec = 0xf6 + OpcodeVecF64x2Pmax OpcodeVec = 0xf7 + + // conversions. + + OpcodeVecI32x4TruncSatF32x4S OpcodeVec = 0xf8 + OpcodeVecI32x4TruncSatF32x4U OpcodeVec = 0xf9 + OpcodeVecF32x4ConvertI32x4S OpcodeVec = 0xfa + OpcodeVecF32x4ConvertI32x4U OpcodeVec = 0xfb + OpcodeVecI32x4TruncSatF64x2SZero OpcodeVec = 0xfc + OpcodeVecI32x4TruncSatF64x2UZero OpcodeVec = 0xfd + OpcodeVecF64x2ConvertLowI32x4S OpcodeVec = 0xfe + OpcodeVecF64x2ConvertLowI32x4U OpcodeVec = 0xff + OpcodeVecF32x4DemoteF64x2Zero OpcodeVec = 0x5e + OpcodeVecF64x2PromoteLowF32x4Zero OpcodeVec = 0x5f +) + +const ( + OpcodeUnreachableName = "unreachable" + OpcodeNopName = "nop" + OpcodeBlockName = "block" + OpcodeLoopName = "loop" + OpcodeIfName = "if" + OpcodeElseName = "else" + OpcodeEndName = "end" + OpcodeBrName = "br" + OpcodeBrIfName = "br_if" + OpcodeBrTableName = "br_table" + OpcodeReturnName = "return" + OpcodeCallName = "call" + OpcodeCallIndirectName = "call_indirect" + OpcodeDropName = "drop" + OpcodeSelectName = "select" + OpcodeTypedSelectName = "typed_select" + OpcodeLocalGetName = "local.get" + OpcodeLocalSetName = "local.set" + OpcodeLocalTeeName = "local.tee" + OpcodeGlobalGetName = "global.get" + OpcodeGlobalSetName = "global.set" + OpcodeI32LoadName = "i32.load" + OpcodeI64LoadName = "i64.load" + OpcodeF32LoadName = "f32.load" + OpcodeF64LoadName = "f64.load" + OpcodeI32Load8SName = "i32.load8_s" + OpcodeI32Load8UName = "i32.load8_u" + OpcodeI32Load16SName = "i32.load16_s" + OpcodeI32Load16UName = "i32.load16_u" + OpcodeI64Load8SName = "i64.load8_s" + OpcodeI64Load8UName = "i64.load8_u" + OpcodeI64Load16SName = "i64.load16_s" + OpcodeI64Load16UName = "i64.load16_u" + OpcodeI64Load32SName = "i64.load32_s" + OpcodeI64Load32UName = "i64.load32_u" + OpcodeI32StoreName = "i32.store" + OpcodeI64StoreName = "i64.store" + OpcodeF32StoreName = "f32.store" + OpcodeF64StoreName = "f64.store" + OpcodeI32Store8Name = "i32.store8" + OpcodeI32Store16Name = "i32.store16" + OpcodeI64Store8Name = "i64.store8" + OpcodeI64Store16Name = "i64.store16" + OpcodeI64Store32Name = "i64.store32" + OpcodeMemorySizeName = "memory.size" + OpcodeMemoryGrowName = "memory.grow" + OpcodeI32ConstName = "i32.const" + OpcodeI64ConstName = "i64.const" + OpcodeF32ConstName = "f32.const" + OpcodeF64ConstName = "f64.const" + OpcodeI32EqzName = "i32.eqz" + OpcodeI32EqName = "i32.eq" + OpcodeI32NeName = "i32.ne" + OpcodeI32LtSName = "i32.lt_s" + OpcodeI32LtUName = "i32.lt_u" + OpcodeI32GtSName = "i32.gt_s" + OpcodeI32GtUName = "i32.gt_u" + OpcodeI32LeSName = "i32.le_s" + OpcodeI32LeUName = "i32.le_u" + OpcodeI32GeSName = "i32.ge_s" + OpcodeI32GeUName = "i32.ge_u" + OpcodeI64EqzName = "i64.eqz" + OpcodeI64EqName = "i64.eq" + OpcodeI64NeName = "i64.ne" + OpcodeI64LtSName = "i64.lt_s" + OpcodeI64LtUName = "i64.lt_u" + OpcodeI64GtSName = "i64.gt_s" + OpcodeI64GtUName = "i64.gt_u" + OpcodeI64LeSName = "i64.le_s" + OpcodeI64LeUName = "i64.le_u" + OpcodeI64GeSName = "i64.ge_s" + OpcodeI64GeUName = "i64.ge_u" + OpcodeF32EqName = "f32.eq" + OpcodeF32NeName = "f32.ne" + OpcodeF32LtName = "f32.lt" + OpcodeF32GtName = "f32.gt" + OpcodeF32LeName = "f32.le" + OpcodeF32GeName = "f32.ge" + OpcodeF64EqName = "f64.eq" + OpcodeF64NeName = "f64.ne" + OpcodeF64LtName = "f64.lt" + OpcodeF64GtName = "f64.gt" + OpcodeF64LeName = "f64.le" + OpcodeF64GeName = "f64.ge" + OpcodeI32ClzName = "i32.clz" + OpcodeI32CtzName = "i32.ctz" + OpcodeI32PopcntName = "i32.popcnt" + OpcodeI32AddName = "i32.add" + OpcodeI32SubName = "i32.sub" + OpcodeI32MulName = "i32.mul" + OpcodeI32DivSName = "i32.div_s" + OpcodeI32DivUName = "i32.div_u" + OpcodeI32RemSName = "i32.rem_s" + OpcodeI32RemUName = "i32.rem_u" + OpcodeI32AndName = "i32.and" + OpcodeI32OrName = "i32.or" + OpcodeI32XorName = "i32.xor" + OpcodeI32ShlName = "i32.shl" + OpcodeI32ShrSName = "i32.shr_s" + OpcodeI32ShrUName = "i32.shr_u" + OpcodeI32RotlName = "i32.rotl" + OpcodeI32RotrName = "i32.rotr" + OpcodeI64ClzName = "i64.clz" + OpcodeI64CtzName = "i64.ctz" + OpcodeI64PopcntName = "i64.popcnt" + OpcodeI64AddName = "i64.add" + OpcodeI64SubName = "i64.sub" + OpcodeI64MulName = "i64.mul" + OpcodeI64DivSName = "i64.div_s" + OpcodeI64DivUName = "i64.div_u" + OpcodeI64RemSName = "i64.rem_s" + OpcodeI64RemUName = "i64.rem_u" + OpcodeI64AndName = "i64.and" + OpcodeI64OrName = "i64.or" + OpcodeI64XorName = "i64.xor" + OpcodeI64ShlName = "i64.shl" + OpcodeI64ShrSName = "i64.shr_s" + OpcodeI64ShrUName = "i64.shr_u" + OpcodeI64RotlName = "i64.rotl" + OpcodeI64RotrName = "i64.rotr" + OpcodeF32AbsName = "f32.abs" + OpcodeF32NegName = "f32.neg" + OpcodeF32CeilName = "f32.ceil" + OpcodeF32FloorName = "f32.floor" + OpcodeF32TruncName = "f32.trunc" + OpcodeF32NearestName = "f32.nearest" + OpcodeF32SqrtName = "f32.sqrt" + OpcodeF32AddName = "f32.add" + OpcodeF32SubName = "f32.sub" + OpcodeF32MulName = "f32.mul" + OpcodeF32DivName = "f32.div" + OpcodeF32MinName = "f32.min" + OpcodeF32MaxName = "f32.max" + OpcodeF32CopysignName = "f32.copysign" + OpcodeF64AbsName = "f64.abs" + OpcodeF64NegName = "f64.neg" + OpcodeF64CeilName = "f64.ceil" + OpcodeF64FloorName = "f64.floor" + OpcodeF64TruncName = "f64.trunc" + OpcodeF64NearestName = "f64.nearest" + OpcodeF64SqrtName = "f64.sqrt" + OpcodeF64AddName = "f64.add" + OpcodeF64SubName = "f64.sub" + OpcodeF64MulName = "f64.mul" + OpcodeF64DivName = "f64.div" + OpcodeF64MinName = "f64.min" + OpcodeF64MaxName = "f64.max" + OpcodeF64CopysignName = "f64.copysign" + OpcodeI32WrapI64Name = "i32.wrap_i64" + OpcodeI32TruncF32SName = "i32.trunc_f32_s" + OpcodeI32TruncF32UName = "i32.trunc_f32_u" + OpcodeI32TruncF64SName = "i32.trunc_f64_s" + OpcodeI32TruncF64UName = "i32.trunc_f64_u" + OpcodeI64ExtendI32SName = "i64.extend_i32_s" + OpcodeI64ExtendI32UName = "i64.extend_i32_u" + OpcodeI64TruncF32SName = "i64.trunc_f32_s" + OpcodeI64TruncF32UName = "i64.trunc_f32_u" + OpcodeI64TruncF64SName = "i64.trunc_f64_s" + OpcodeI64TruncF64UName = "i64.trunc_f64_u" + OpcodeF32ConvertI32SName = "f32.convert_i32_s" + OpcodeF32ConvertI32UName = "f32.convert_i32_u" + OpcodeF32ConvertI64SName = "f32.convert_i64_s" + OpcodeF32ConvertI64UName = "f32.convert_i64u" + OpcodeF32DemoteF64Name = "f32.demote_f64" + OpcodeF64ConvertI32SName = "f64.convert_i32_s" + OpcodeF64ConvertI32UName = "f64.convert_i32_u" + OpcodeF64ConvertI64SName = "f64.convert_i64_s" + OpcodeF64ConvertI64UName = "f64.convert_i64_u" + OpcodeF64PromoteF32Name = "f64.promote_f32" + OpcodeI32ReinterpretF32Name = "i32.reinterpret_f32" + OpcodeI64ReinterpretF64Name = "i64.reinterpret_f64" + OpcodeF32ReinterpretI32Name = "f32.reinterpret_i32" + OpcodeF64ReinterpretI64Name = "f64.reinterpret_i64" + + OpcodeRefNullName = "ref.null" + OpcodeRefIsNullName = "ref.is_null" + OpcodeRefFuncName = "ref.func" + + OpcodeTableGetName = "table.get" + OpcodeTableSetName = "table.set" + + // Below are toggled with CoreFeatureSignExtensionOps + + OpcodeI32Extend8SName = "i32.extend8_s" + OpcodeI32Extend16SName = "i32.extend16_s" + OpcodeI64Extend8SName = "i64.extend8_s" + OpcodeI64Extend16SName = "i64.extend16_s" + OpcodeI64Extend32SName = "i64.extend32_s" + + OpcodeMiscPrefixName = "misc_prefix" + OpcodeVecPrefixName = "vector_prefix" +) + +var instructionNames = [256]string{ + OpcodeUnreachable: OpcodeUnreachableName, + OpcodeNop: OpcodeNopName, + OpcodeBlock: OpcodeBlockName, + OpcodeLoop: OpcodeLoopName, + OpcodeIf: OpcodeIfName, + OpcodeElse: OpcodeElseName, + OpcodeEnd: OpcodeEndName, + OpcodeBr: OpcodeBrName, + OpcodeBrIf: OpcodeBrIfName, + OpcodeBrTable: OpcodeBrTableName, + OpcodeReturn: OpcodeReturnName, + OpcodeCall: OpcodeCallName, + OpcodeCallIndirect: OpcodeCallIndirectName, + OpcodeDrop: OpcodeDropName, + OpcodeSelect: OpcodeSelectName, + OpcodeTypedSelect: OpcodeTypedSelectName, + OpcodeLocalGet: OpcodeLocalGetName, + OpcodeLocalSet: OpcodeLocalSetName, + OpcodeLocalTee: OpcodeLocalTeeName, + OpcodeGlobalGet: OpcodeGlobalGetName, + OpcodeGlobalSet: OpcodeGlobalSetName, + OpcodeI32Load: OpcodeI32LoadName, + OpcodeI64Load: OpcodeI64LoadName, + OpcodeF32Load: OpcodeF32LoadName, + OpcodeF64Load: OpcodeF64LoadName, + OpcodeI32Load8S: OpcodeI32Load8SName, + OpcodeI32Load8U: OpcodeI32Load8UName, + OpcodeI32Load16S: OpcodeI32Load16SName, + OpcodeI32Load16U: OpcodeI32Load16UName, + OpcodeI64Load8S: OpcodeI64Load8SName, + OpcodeI64Load8U: OpcodeI64Load8UName, + OpcodeI64Load16S: OpcodeI64Load16SName, + OpcodeI64Load16U: OpcodeI64Load16UName, + OpcodeI64Load32S: OpcodeI64Load32SName, + OpcodeI64Load32U: OpcodeI64Load32UName, + OpcodeI32Store: OpcodeI32StoreName, + OpcodeI64Store: OpcodeI64StoreName, + OpcodeF32Store: OpcodeF32StoreName, + OpcodeF64Store: OpcodeF64StoreName, + OpcodeI32Store8: OpcodeI32Store8Name, + OpcodeI32Store16: OpcodeI32Store16Name, + OpcodeI64Store8: OpcodeI64Store8Name, + OpcodeI64Store16: OpcodeI64Store16Name, + OpcodeI64Store32: OpcodeI64Store32Name, + OpcodeMemorySize: OpcodeMemorySizeName, + OpcodeMemoryGrow: OpcodeMemoryGrowName, + OpcodeI32Const: OpcodeI32ConstName, + OpcodeI64Const: OpcodeI64ConstName, + OpcodeF32Const: OpcodeF32ConstName, + OpcodeF64Const: OpcodeF64ConstName, + OpcodeI32Eqz: OpcodeI32EqzName, + OpcodeI32Eq: OpcodeI32EqName, + OpcodeI32Ne: OpcodeI32NeName, + OpcodeI32LtS: OpcodeI32LtSName, + OpcodeI32LtU: OpcodeI32LtUName, + OpcodeI32GtS: OpcodeI32GtSName, + OpcodeI32GtU: OpcodeI32GtUName, + OpcodeI32LeS: OpcodeI32LeSName, + OpcodeI32LeU: OpcodeI32LeUName, + OpcodeI32GeS: OpcodeI32GeSName, + OpcodeI32GeU: OpcodeI32GeUName, + OpcodeI64Eqz: OpcodeI64EqzName, + OpcodeI64Eq: OpcodeI64EqName, + OpcodeI64Ne: OpcodeI64NeName, + OpcodeI64LtS: OpcodeI64LtSName, + OpcodeI64LtU: OpcodeI64LtUName, + OpcodeI64GtS: OpcodeI64GtSName, + OpcodeI64GtU: OpcodeI64GtUName, + OpcodeI64LeS: OpcodeI64LeSName, + OpcodeI64LeU: OpcodeI64LeUName, + OpcodeI64GeS: OpcodeI64GeSName, + OpcodeI64GeU: OpcodeI64GeUName, + OpcodeF32Eq: OpcodeF32EqName, + OpcodeF32Ne: OpcodeF32NeName, + OpcodeF32Lt: OpcodeF32LtName, + OpcodeF32Gt: OpcodeF32GtName, + OpcodeF32Le: OpcodeF32LeName, + OpcodeF32Ge: OpcodeF32GeName, + OpcodeF64Eq: OpcodeF64EqName, + OpcodeF64Ne: OpcodeF64NeName, + OpcodeF64Lt: OpcodeF64LtName, + OpcodeF64Gt: OpcodeF64GtName, + OpcodeF64Le: OpcodeF64LeName, + OpcodeF64Ge: OpcodeF64GeName, + OpcodeI32Clz: OpcodeI32ClzName, + OpcodeI32Ctz: OpcodeI32CtzName, + OpcodeI32Popcnt: OpcodeI32PopcntName, + OpcodeI32Add: OpcodeI32AddName, + OpcodeI32Sub: OpcodeI32SubName, + OpcodeI32Mul: OpcodeI32MulName, + OpcodeI32DivS: OpcodeI32DivSName, + OpcodeI32DivU: OpcodeI32DivUName, + OpcodeI32RemS: OpcodeI32RemSName, + OpcodeI32RemU: OpcodeI32RemUName, + OpcodeI32And: OpcodeI32AndName, + OpcodeI32Or: OpcodeI32OrName, + OpcodeI32Xor: OpcodeI32XorName, + OpcodeI32Shl: OpcodeI32ShlName, + OpcodeI32ShrS: OpcodeI32ShrSName, + OpcodeI32ShrU: OpcodeI32ShrUName, + OpcodeI32Rotl: OpcodeI32RotlName, + OpcodeI32Rotr: OpcodeI32RotrName, + OpcodeI64Clz: OpcodeI64ClzName, + OpcodeI64Ctz: OpcodeI64CtzName, + OpcodeI64Popcnt: OpcodeI64PopcntName, + OpcodeI64Add: OpcodeI64AddName, + OpcodeI64Sub: OpcodeI64SubName, + OpcodeI64Mul: OpcodeI64MulName, + OpcodeI64DivS: OpcodeI64DivSName, + OpcodeI64DivU: OpcodeI64DivUName, + OpcodeI64RemS: OpcodeI64RemSName, + OpcodeI64RemU: OpcodeI64RemUName, + OpcodeI64And: OpcodeI64AndName, + OpcodeI64Or: OpcodeI64OrName, + OpcodeI64Xor: OpcodeI64XorName, + OpcodeI64Shl: OpcodeI64ShlName, + OpcodeI64ShrS: OpcodeI64ShrSName, + OpcodeI64ShrU: OpcodeI64ShrUName, + OpcodeI64Rotl: OpcodeI64RotlName, + OpcodeI64Rotr: OpcodeI64RotrName, + OpcodeF32Abs: OpcodeF32AbsName, + OpcodeF32Neg: OpcodeF32NegName, + OpcodeF32Ceil: OpcodeF32CeilName, + OpcodeF32Floor: OpcodeF32FloorName, + OpcodeF32Trunc: OpcodeF32TruncName, + OpcodeF32Nearest: OpcodeF32NearestName, + OpcodeF32Sqrt: OpcodeF32SqrtName, + OpcodeF32Add: OpcodeF32AddName, + OpcodeF32Sub: OpcodeF32SubName, + OpcodeF32Mul: OpcodeF32MulName, + OpcodeF32Div: OpcodeF32DivName, + OpcodeF32Min: OpcodeF32MinName, + OpcodeF32Max: OpcodeF32MaxName, + OpcodeF32Copysign: OpcodeF32CopysignName, + OpcodeF64Abs: OpcodeF64AbsName, + OpcodeF64Neg: OpcodeF64NegName, + OpcodeF64Ceil: OpcodeF64CeilName, + OpcodeF64Floor: OpcodeF64FloorName, + OpcodeF64Trunc: OpcodeF64TruncName, + OpcodeF64Nearest: OpcodeF64NearestName, + OpcodeF64Sqrt: OpcodeF64SqrtName, + OpcodeF64Add: OpcodeF64AddName, + OpcodeF64Sub: OpcodeF64SubName, + OpcodeF64Mul: OpcodeF64MulName, + OpcodeF64Div: OpcodeF64DivName, + OpcodeF64Min: OpcodeF64MinName, + OpcodeF64Max: OpcodeF64MaxName, + OpcodeF64Copysign: OpcodeF64CopysignName, + OpcodeI32WrapI64: OpcodeI32WrapI64Name, + OpcodeI32TruncF32S: OpcodeI32TruncF32SName, + OpcodeI32TruncF32U: OpcodeI32TruncF32UName, + OpcodeI32TruncF64S: OpcodeI32TruncF64SName, + OpcodeI32TruncF64U: OpcodeI32TruncF64UName, + OpcodeI64ExtendI32S: OpcodeI64ExtendI32SName, + OpcodeI64ExtendI32U: OpcodeI64ExtendI32UName, + OpcodeI64TruncF32S: OpcodeI64TruncF32SName, + OpcodeI64TruncF32U: OpcodeI64TruncF32UName, + OpcodeI64TruncF64S: OpcodeI64TruncF64SName, + OpcodeI64TruncF64U: OpcodeI64TruncF64UName, + OpcodeF32ConvertI32S: OpcodeF32ConvertI32SName, + OpcodeF32ConvertI32U: OpcodeF32ConvertI32UName, + OpcodeF32ConvertI64S: OpcodeF32ConvertI64SName, + OpcodeF32ConvertI64U: OpcodeF32ConvertI64UName, + OpcodeF32DemoteF64: OpcodeF32DemoteF64Name, + OpcodeF64ConvertI32S: OpcodeF64ConvertI32SName, + OpcodeF64ConvertI32U: OpcodeF64ConvertI32UName, + OpcodeF64ConvertI64S: OpcodeF64ConvertI64SName, + OpcodeF64ConvertI64U: OpcodeF64ConvertI64UName, + OpcodeF64PromoteF32: OpcodeF64PromoteF32Name, + OpcodeI32ReinterpretF32: OpcodeI32ReinterpretF32Name, + OpcodeI64ReinterpretF64: OpcodeI64ReinterpretF64Name, + OpcodeF32ReinterpretI32: OpcodeF32ReinterpretI32Name, + OpcodeF64ReinterpretI64: OpcodeF64ReinterpretI64Name, + + OpcodeRefNull: OpcodeRefNullName, + OpcodeRefIsNull: OpcodeRefIsNullName, + OpcodeRefFunc: OpcodeRefFuncName, + + OpcodeTableGet: OpcodeTableGetName, + OpcodeTableSet: OpcodeTableSetName, + + // Below are toggled with CoreFeatureSignExtensionOps + + OpcodeI32Extend8S: OpcodeI32Extend8SName, + OpcodeI32Extend16S: OpcodeI32Extend16SName, + OpcodeI64Extend8S: OpcodeI64Extend8SName, + OpcodeI64Extend16S: OpcodeI64Extend16SName, + OpcodeI64Extend32S: OpcodeI64Extend32SName, + + OpcodeMiscPrefix: OpcodeMiscPrefixName, + OpcodeVecPrefix: OpcodeVecPrefixName, +} + +// InstructionName returns the instruction corresponding to this binary Opcode. +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#a7-index-of-instructions +func InstructionName(oc Opcode) string { + return instructionNames[oc] +} + +const ( + OpcodeI32TruncSatF32SName = "i32.trunc_sat_f32_s" + OpcodeI32TruncSatF32UName = "i32.trunc_sat_f32_u" + OpcodeI32TruncSatF64SName = "i32.trunc_sat_f64_s" + OpcodeI32TruncSatF64UName = "i32.trunc_sat_f64_u" + OpcodeI64TruncSatF32SName = "i64.trunc_sat_f32_s" + OpcodeI64TruncSatF32UName = "i64.trunc_sat_f32_u" + OpcodeI64TruncSatF64SName = "i64.trunc_sat_f64_s" + OpcodeI64TruncSatF64UName = "i64.trunc_sat_f64_u" + + OpcodeMemoryInitName = "memory.init" + OpcodeDataDropName = "data.drop" + OpcodeMemoryCopyName = "memory.copy" + OpcodeMemoryFillName = "memory.fill" + OpcodeTableInitName = "table.init" + OpcodeElemDropName = "elem.drop" + OpcodeTableCopyName = "table.copy" + OpcodeTableGrowName = "table.grow" + OpcodeTableSizeName = "table.size" + OpcodeTableFillName = "table.fill" +) + +var miscInstructionNames = [256]string{ + OpcodeMiscI32TruncSatF32S: OpcodeI32TruncSatF32SName, + OpcodeMiscI32TruncSatF32U: OpcodeI32TruncSatF32UName, + OpcodeMiscI32TruncSatF64S: OpcodeI32TruncSatF64SName, + OpcodeMiscI32TruncSatF64U: OpcodeI32TruncSatF64UName, + OpcodeMiscI64TruncSatF32S: OpcodeI64TruncSatF32SName, + OpcodeMiscI64TruncSatF32U: OpcodeI64TruncSatF32UName, + OpcodeMiscI64TruncSatF64S: OpcodeI64TruncSatF64SName, + OpcodeMiscI64TruncSatF64U: OpcodeI64TruncSatF64UName, + + OpcodeMiscMemoryInit: OpcodeMemoryInitName, + OpcodeMiscDataDrop: OpcodeDataDropName, + OpcodeMiscMemoryCopy: OpcodeMemoryCopyName, + OpcodeMiscMemoryFill: OpcodeMemoryFillName, + OpcodeMiscTableInit: OpcodeTableInitName, + OpcodeMiscElemDrop: OpcodeElemDropName, + OpcodeMiscTableCopy: OpcodeTableCopyName, + OpcodeMiscTableGrow: OpcodeTableGrowName, + OpcodeMiscTableSize: OpcodeTableSizeName, + OpcodeMiscTableFill: OpcodeTableFillName, +} + +// MiscInstructionName returns the instruction corresponding to this miscellaneous Opcode. +func MiscInstructionName(oc OpcodeMisc) string { + return miscInstructionNames[oc] +} + +const ( + OpcodeVecV128LoadName = "v128.load" + OpcodeVecV128Load8x8SName = "v128.load8x8_s" + OpcodeVecV128Load8x8UName = "v128.load8x8_u" + OpcodeVecV128Load16x4SName = "v128.load16x4_s" + OpcodeVecV128Load16x4UName = "v128.load16x4_u" + OpcodeVecV128Load32x2SName = "v128.load32x2_s" + OpcodeVecV128Load32x2UName = "v128.load32x2_u" + OpcodeVecV128Load8SplatName = "v128.load8_splat" + OpcodeVecV128Load16SplatName = "v128.load16_splat" + OpcodeVecV128Load32SplatName = "v128.load32_splat" + OpcodeVecV128Load64SplatName = "v128.load64_splat" + OpcodeVecV128Load32zeroName = "v128.load32_zero" + OpcodeVecV128Load64zeroName = "v128.load64_zero" + OpcodeVecV128StoreName = "v128.store" + OpcodeVecV128Load8LaneName = "v128.load8_lane" + OpcodeVecV128Load16LaneName = "v128.load16_lane" + OpcodeVecV128Load32LaneName = "v128.load32_lane" + OpcodeVecV128Load64LaneName = "v128.load64_lane" + OpcodeVecV128Store8LaneName = "v128.store8_lane" + OpcodeVecV128Store16LaneName = "v128.store16_lane" + OpcodeVecV128Store32LaneName = "v128.store32_lane" + OpcodeVecV128Store64LaneName = "v128.store64_lane" + OpcodeVecV128ConstName = "v128.const" + OpcodeVecV128i8x16ShuffleName = "v128.shuffle" + OpcodeVecI8x16ExtractLaneSName = "i8x16.extract_lane_s" + OpcodeVecI8x16ExtractLaneUName = "i8x16.extract_lane_u" + OpcodeVecI8x16ReplaceLaneName = "i8x16.replace_lane" + OpcodeVecI16x8ExtractLaneSName = "i16x8.extract_lane_s" + OpcodeVecI16x8ExtractLaneUName = "i16x8.extract_lane_u" + OpcodeVecI16x8ReplaceLaneName = "i16x8.replace_lane" + OpcodeVecI32x4ExtractLaneName = "i32x4.extract_lane" + OpcodeVecI32x4ReplaceLaneName = "i32x4.replace_lane" + OpcodeVecI64x2ExtractLaneName = "i64x2.extract_lane" + OpcodeVecI64x2ReplaceLaneName = "i64x2.replace_lane" + OpcodeVecF32x4ExtractLaneName = "f32x4.extract_lane" + OpcodeVecF32x4ReplaceLaneName = "f32x4.replace_lane" + OpcodeVecF64x2ExtractLaneName = "f64x2.extract_lane" + OpcodeVecF64x2ReplaceLaneName = "f64x2.replace_lane" + OpcodeVecI8x16SwizzleName = "i8x16.swizzle" + OpcodeVecI8x16SplatName = "i8x16.splat" + OpcodeVecI16x8SplatName = "i16x8.splat" + OpcodeVecI32x4SplatName = "i32x4.splat" + OpcodeVecI64x2SplatName = "i64x2.splat" + OpcodeVecF32x4SplatName = "f32x4.splat" + OpcodeVecF64x2SplatName = "f64x2.splat" + OpcodeVecI8x16EqName = "i8x16.eq" + OpcodeVecI8x16NeName = "i8x16.ne" + OpcodeVecI8x16LtSName = "i8x16.lt_s" + OpcodeVecI8x16LtUName = "i8x16.lt_u" + OpcodeVecI8x16GtSName = "i8x16.gt_s" + OpcodeVecI8x16GtUName = "i8x16.gt_u" + OpcodeVecI8x16LeSName = "i8x16.le_s" + OpcodeVecI8x16LeUName = "i8x16.le_u" + OpcodeVecI8x16GeSName = "i8x16.ge_s" + OpcodeVecI8x16GeUName = "i8x16.ge_u" + OpcodeVecI16x8EqName = "i16x8.eq" + OpcodeVecI16x8NeName = "i16x8.ne" + OpcodeVecI16x8LtSName = "i16x8.lt_s" + OpcodeVecI16x8LtUName = "i16x8.lt_u" + OpcodeVecI16x8GtSName = "i16x8.gt_s" + OpcodeVecI16x8GtUName = "i16x8.gt_u" + OpcodeVecI16x8LeSName = "i16x8.le_s" + OpcodeVecI16x8LeUName = "i16x8.le_u" + OpcodeVecI16x8GeSName = "i16x8.ge_s" + OpcodeVecI16x8GeUName = "i16x8.ge_u" + OpcodeVecI32x4EqName = "i32x4.eq" + OpcodeVecI32x4NeName = "i32x4.ne" + OpcodeVecI32x4LtSName = "i32x4.lt_s" + OpcodeVecI32x4LtUName = "i32x4.lt_u" + OpcodeVecI32x4GtSName = "i32x4.gt_s" + OpcodeVecI32x4GtUName = "i32x4.gt_u" + OpcodeVecI32x4LeSName = "i32x4.le_s" + OpcodeVecI32x4LeUName = "i32x4.le_u" + OpcodeVecI32x4GeSName = "i32x4.ge_s" + OpcodeVecI32x4GeUName = "i32x4.ge_u" + OpcodeVecI64x2EqName = "i64x2.eq" + OpcodeVecI64x2NeName = "i64x2.ne" + OpcodeVecI64x2LtSName = "i64x2.lt" + OpcodeVecI64x2GtSName = "i64x2.gt" + OpcodeVecI64x2LeSName = "i64x2.le" + OpcodeVecI64x2GeSName = "i64x2.ge" + OpcodeVecF32x4EqName = "f32x4.eq" + OpcodeVecF32x4NeName = "f32x4.ne" + OpcodeVecF32x4LtName = "f32x4.lt" + OpcodeVecF32x4GtName = "f32x4.gt" + OpcodeVecF32x4LeName = "f32x4.le" + OpcodeVecF32x4GeName = "f32x4.ge" + OpcodeVecF64x2EqName = "f64x2.eq" + OpcodeVecF64x2NeName = "f64x2.ne" + OpcodeVecF64x2LtName = "f64x2.lt" + OpcodeVecF64x2GtName = "f64x2.gt" + OpcodeVecF64x2LeName = "f64x2.le" + OpcodeVecF64x2GeName = "f64x2.ge" + OpcodeVecV128NotName = "v128.not" + OpcodeVecV128AndName = "v128.and" + OpcodeVecV128AndNotName = "v128.andnot" + OpcodeVecV128OrName = "v128.or" + OpcodeVecV128XorName = "v128.xor" + OpcodeVecV128BitselectName = "v128.bitselect" + OpcodeVecV128AnyTrueName = "v128.any_true" + OpcodeVecI8x16AbsName = "i8x16.abs" + OpcodeVecI8x16NegName = "i8x16.neg" + OpcodeVecI8x16PopcntName = "i8x16.popcnt" + OpcodeVecI8x16AllTrueName = "i8x16.all_true" + OpcodeVecI8x16BitMaskName = "i8x16.bitmask" + OpcodeVecI8x16NarrowI16x8SName = "i8x16.narrow_i16x8_s" + OpcodeVecI8x16NarrowI16x8UName = "i8x16.narrow_i16x8_u" + OpcodeVecI8x16ShlName = "i8x16.shl" + OpcodeVecI8x16ShrSName = "i8x16.shr_s" + OpcodeVecI8x16ShrUName = "i8x16.shr_u" + OpcodeVecI8x16AddName = "i8x16.add" + OpcodeVecI8x16AddSatSName = "i8x16.add_sat_s" + OpcodeVecI8x16AddSatUName = "i8x16.add_sat_u" + OpcodeVecI8x16SubName = "i8x16.sub" + OpcodeVecI8x16SubSatSName = "i8x16.sub_s" + OpcodeVecI8x16SubSatUName = "i8x16.sub_u" + OpcodeVecI8x16MinSName = "i8x16.min_s" + OpcodeVecI8x16MinUName = "i8x16.min_u" + OpcodeVecI8x16MaxSName = "i8x16.max_s" + OpcodeVecI8x16MaxUName = "i8x16.max_u" + OpcodeVecI8x16AvgrUName = "i8x16.avgr_u" + OpcodeVecI16x8ExtaddPairwiseI8x16SName = "i16x8.extadd_pairwise_i8x16_s" + OpcodeVecI16x8ExtaddPairwiseI8x16UName = "i16x8.extadd_pairwise_i8x16_u" + OpcodeVecI16x8AbsName = "i16x8.abs" + OpcodeVecI16x8NegName = "i16x8.neg" + OpcodeVecI16x8Q15mulrSatSName = "i16x8.q15mulr_sat_s" + OpcodeVecI16x8AllTrueName = "i16x8.all_true" + OpcodeVecI16x8BitMaskName = "i16x8.bitmask" + OpcodeVecI16x8NarrowI32x4SName = "i16x8.narrow_i32x4_s" + OpcodeVecI16x8NarrowI32x4UName = "i16x8.narrow_i32x4_u" + OpcodeVecI16x8ExtendLowI8x16SName = "i16x8.extend_low_i8x16_s" + OpcodeVecI16x8ExtendHighI8x16SName = "i16x8.extend_high_i8x16_s" + OpcodeVecI16x8ExtendLowI8x16UName = "i16x8.extend_low_i8x16_u" + OpcodeVecI16x8ExtendHighI8x16UName = "i16x8.extend_high_i8x16_u" + OpcodeVecI16x8ShlName = "i16x8.shl" + OpcodeVecI16x8ShrSName = "i16x8.shr_s" + OpcodeVecI16x8ShrUName = "i16x8.shr_u" + OpcodeVecI16x8AddName = "i16x8.add" + OpcodeVecI16x8AddSatSName = "i16x8.add_sat_s" + OpcodeVecI16x8AddSatUName = "i16x8.add_sat_u" + OpcodeVecI16x8SubName = "i16x8.sub" + OpcodeVecI16x8SubSatSName = "i16x8.sub_sat_s" + OpcodeVecI16x8SubSatUName = "i16x8.sub_sat_u" + OpcodeVecI16x8MulName = "i16x8.mul" + OpcodeVecI16x8MinSName = "i16x8.min_s" + OpcodeVecI16x8MinUName = "i16x8.min_u" + OpcodeVecI16x8MaxSName = "i16x8.max_s" + OpcodeVecI16x8MaxUName = "i16x8.max_u" + OpcodeVecI16x8AvgrUName = "i16x8.avgr_u" + OpcodeVecI16x8ExtMulLowI8x16SName = "i16x8.extmul_low_i8x16_s" + OpcodeVecI16x8ExtMulHighI8x16SName = "i16x8.extmul_high_i8x16_s" + OpcodeVecI16x8ExtMulLowI8x16UName = "i16x8.extmul_low_i8x16_u" + OpcodeVecI16x8ExtMulHighI8x16UName = "i16x8.extmul_high_i8x16_u" + OpcodeVecI32x4ExtaddPairwiseI16x8SName = "i32x4.extadd_pairwise_i16x8_s" + OpcodeVecI32x4ExtaddPairwiseI16x8UName = "i32x4.extadd_pairwise_i16x8_u" + OpcodeVecI32x4AbsName = "i32x4.abs" + OpcodeVecI32x4NegName = "i32x4.neg" + OpcodeVecI32x4AllTrueName = "i32x4.all_true" + OpcodeVecI32x4BitMaskName = "i32x4.bitmask" + OpcodeVecI32x4ExtendLowI16x8SName = "i32x4.extend_low_i16x8_s" + OpcodeVecI32x4ExtendHighI16x8SName = "i32x4.extend_high_i16x8_s" + OpcodeVecI32x4ExtendLowI16x8UName = "i32x4.extend_low_i16x8_u" + OpcodeVecI32x4ExtendHighI16x8UName = "i32x4.extend_high_i16x8_u" + OpcodeVecI32x4ShlName = "i32x4.shl" + OpcodeVecI32x4ShrSName = "i32x4.shr_s" + OpcodeVecI32x4ShrUName = "i32x4.shr_u" + OpcodeVecI32x4AddName = "i32x4.add" + OpcodeVecI32x4SubName = "i32x4.sub" + OpcodeVecI32x4MulName = "i32x4.mul" + OpcodeVecI32x4MinSName = "i32x4.min_s" + OpcodeVecI32x4MinUName = "i32x4.min_u" + OpcodeVecI32x4MaxSName = "i32x4.max_s" + OpcodeVecI32x4MaxUName = "i32x4.max_u" + OpcodeVecI32x4DotI16x8SName = "i32x4.dot_i16x8_s" + OpcodeVecI32x4ExtMulLowI16x8SName = "i32x4.extmul_low_i16x8_s" + OpcodeVecI32x4ExtMulHighI16x8SName = "i32x4.extmul_high_i16x8_s" + OpcodeVecI32x4ExtMulLowI16x8UName = "i32x4.extmul_low_i16x8_u" + OpcodeVecI32x4ExtMulHighI16x8UName = "i32x4.extmul_high_i16x8_u" + OpcodeVecI64x2AbsName = "i64x2.abs" + OpcodeVecI64x2NegName = "i64x2.neg" + OpcodeVecI64x2AllTrueName = "i64x2.all_true" + OpcodeVecI64x2BitMaskName = "i64x2.bitmask" + OpcodeVecI64x2ExtendLowI32x4SName = "i64x2.extend_low_i32x4_s" + OpcodeVecI64x2ExtendHighI32x4SName = "i64x2.extend_high_i32x4_s" + OpcodeVecI64x2ExtendLowI32x4UName = "i64x2.extend_low_i32x4_u" + OpcodeVecI64x2ExtendHighI32x4UName = "i64x2.extend_high_i32x4_u" + OpcodeVecI64x2ShlName = "i64x2.shl" + OpcodeVecI64x2ShrSName = "i64x2.shr_s" + OpcodeVecI64x2ShrUName = "i64x2.shr_u" + OpcodeVecI64x2AddName = "i64x2.add" + OpcodeVecI64x2SubName = "i64x2.sub" + OpcodeVecI64x2MulName = "i64x2.mul" + OpcodeVecI64x2ExtMulLowI32x4SName = "i64x2.extmul_low_i32x4_s" + OpcodeVecI64x2ExtMulHighI32x4SName = "i64x2.extmul_high_i32x4_s" + OpcodeVecI64x2ExtMulLowI32x4UName = "i64x2.extmul_low_i32x4_u" + OpcodeVecI64x2ExtMulHighI32x4UName = "i64x2.extmul_high_i32x4_u" + OpcodeVecF32x4CeilName = "f32x4.ceil" + OpcodeVecF32x4FloorName = "f32x4.floor" + OpcodeVecF32x4TruncName = "f32x4.trunc" + OpcodeVecF32x4NearestName = "f32x4.nearest" + OpcodeVecF32x4AbsName = "f32x4.abs" + OpcodeVecF32x4NegName = "f32x4.neg" + OpcodeVecF32x4SqrtName = "f32x4.sqrt" + OpcodeVecF32x4AddName = "f32x4.add" + OpcodeVecF32x4SubName = "f32x4.sub" + OpcodeVecF32x4MulName = "f32x4.mul" + OpcodeVecF32x4DivName = "f32x4.div" + OpcodeVecF32x4MinName = "f32x4.min" + OpcodeVecF32x4MaxName = "f32x4.max" + OpcodeVecF32x4PminName = "f32x4.pmin" + OpcodeVecF32x4PmaxName = "f32x4.pmax" + OpcodeVecF64x2CeilName = "f64x2.ceil" + OpcodeVecF64x2FloorName = "f64x2.floor" + OpcodeVecF64x2TruncName = "f64x2.trunc" + OpcodeVecF64x2NearestName = "f64x2.nearest" + OpcodeVecF64x2AbsName = "f64x2.abs" + OpcodeVecF64x2NegName = "f64x2.neg" + OpcodeVecF64x2SqrtName = "f64x2.sqrt" + OpcodeVecF64x2AddName = "f64x2.add" + OpcodeVecF64x2SubName = "f64x2.sub" + OpcodeVecF64x2MulName = "f64x2.mul" + OpcodeVecF64x2DivName = "f64x2.div" + OpcodeVecF64x2MinName = "f64x2.min" + OpcodeVecF64x2MaxName = "f64x2.max" + OpcodeVecF64x2PminName = "f64x2.pmin" + OpcodeVecF64x2PmaxName = "f64x2.pmax" + OpcodeVecI32x4TruncSatF32x4SName = "i32x4.trunc_sat_f32x4_s" + OpcodeVecI32x4TruncSatF32x4UName = "i32x4.trunc_sat_f32x4_u" + OpcodeVecF32x4ConvertI32x4SName = "f32x4.convert_i32x4_s" + OpcodeVecF32x4ConvertI32x4UName = "f32x4.convert_i32x4_u" + OpcodeVecI32x4TruncSatF64x2SZeroName = "i32x4.trunc_sat_f64x2_s_zero" + OpcodeVecI32x4TruncSatF64x2UZeroName = "i32x4.trunc_sat_f64x2_u_zero" + OpcodeVecF64x2ConvertLowI32x4SName = "f64x2.convert_low_i32x4_s" + OpcodeVecF64x2ConvertLowI32x4UName = "f64x2.convert_low_i32x4_u" + OpcodeVecF32x4DemoteF64x2ZeroName = "f32x4.demote_f64x2_zero" + OpcodeVecF64x2PromoteLowF32x4ZeroName = "f64x2.promote_low_f32x4" +) + +var vectorInstructionName = map[OpcodeVec]string{ + OpcodeVecV128Load: OpcodeVecV128LoadName, + OpcodeVecV128Load8x8s: OpcodeVecV128Load8x8SName, + OpcodeVecV128Load8x8u: OpcodeVecV128Load8x8UName, + OpcodeVecV128Load16x4s: OpcodeVecV128Load16x4SName, + OpcodeVecV128Load16x4u: OpcodeVecV128Load16x4UName, + OpcodeVecV128Load32x2s: OpcodeVecV128Load32x2SName, + OpcodeVecV128Load32x2u: OpcodeVecV128Load32x2UName, + OpcodeVecV128Load8Splat: OpcodeVecV128Load8SplatName, + OpcodeVecV128Load16Splat: OpcodeVecV128Load16SplatName, + OpcodeVecV128Load32Splat: OpcodeVecV128Load32SplatName, + OpcodeVecV128Load64Splat: OpcodeVecV128Load64SplatName, + OpcodeVecV128Load32zero: OpcodeVecV128Load32zeroName, + OpcodeVecV128Load64zero: OpcodeVecV128Load64zeroName, + OpcodeVecV128Store: OpcodeVecV128StoreName, + OpcodeVecV128Load8Lane: OpcodeVecV128Load8LaneName, + OpcodeVecV128Load16Lane: OpcodeVecV128Load16LaneName, + OpcodeVecV128Load32Lane: OpcodeVecV128Load32LaneName, + OpcodeVecV128Load64Lane: OpcodeVecV128Load64LaneName, + OpcodeVecV128Store8Lane: OpcodeVecV128Store8LaneName, + OpcodeVecV128Store16Lane: OpcodeVecV128Store16LaneName, + OpcodeVecV128Store32Lane: OpcodeVecV128Store32LaneName, + OpcodeVecV128Store64Lane: OpcodeVecV128Store64LaneName, + OpcodeVecV128Const: OpcodeVecV128ConstName, + OpcodeVecV128i8x16Shuffle: OpcodeVecV128i8x16ShuffleName, + OpcodeVecI8x16ExtractLaneS: OpcodeVecI8x16ExtractLaneSName, + OpcodeVecI8x16ExtractLaneU: OpcodeVecI8x16ExtractLaneUName, + OpcodeVecI8x16ReplaceLane: OpcodeVecI8x16ReplaceLaneName, + OpcodeVecI16x8ExtractLaneS: OpcodeVecI16x8ExtractLaneSName, + OpcodeVecI16x8ExtractLaneU: OpcodeVecI16x8ExtractLaneUName, + OpcodeVecI16x8ReplaceLane: OpcodeVecI16x8ReplaceLaneName, + OpcodeVecI32x4ExtractLane: OpcodeVecI32x4ExtractLaneName, + OpcodeVecI32x4ReplaceLane: OpcodeVecI32x4ReplaceLaneName, + OpcodeVecI64x2ExtractLane: OpcodeVecI64x2ExtractLaneName, + OpcodeVecI64x2ReplaceLane: OpcodeVecI64x2ReplaceLaneName, + OpcodeVecF32x4ExtractLane: OpcodeVecF32x4ExtractLaneName, + OpcodeVecF32x4ReplaceLane: OpcodeVecF32x4ReplaceLaneName, + OpcodeVecF64x2ExtractLane: OpcodeVecF64x2ExtractLaneName, + OpcodeVecF64x2ReplaceLane: OpcodeVecF64x2ReplaceLaneName, + OpcodeVecI8x16Swizzle: OpcodeVecI8x16SwizzleName, + OpcodeVecI8x16Splat: OpcodeVecI8x16SplatName, + OpcodeVecI16x8Splat: OpcodeVecI16x8SplatName, + OpcodeVecI32x4Splat: OpcodeVecI32x4SplatName, + OpcodeVecI64x2Splat: OpcodeVecI64x2SplatName, + OpcodeVecF32x4Splat: OpcodeVecF32x4SplatName, + OpcodeVecF64x2Splat: OpcodeVecF64x2SplatName, + OpcodeVecI8x16Eq: OpcodeVecI8x16EqName, + OpcodeVecI8x16Ne: OpcodeVecI8x16NeName, + OpcodeVecI8x16LtS: OpcodeVecI8x16LtSName, + OpcodeVecI8x16LtU: OpcodeVecI8x16LtUName, + OpcodeVecI8x16GtS: OpcodeVecI8x16GtSName, + OpcodeVecI8x16GtU: OpcodeVecI8x16GtUName, + OpcodeVecI8x16LeS: OpcodeVecI8x16LeSName, + OpcodeVecI8x16LeU: OpcodeVecI8x16LeUName, + OpcodeVecI8x16GeS: OpcodeVecI8x16GeSName, + OpcodeVecI8x16GeU: OpcodeVecI8x16GeUName, + OpcodeVecI16x8Eq: OpcodeVecI16x8EqName, + OpcodeVecI16x8Ne: OpcodeVecI16x8NeName, + OpcodeVecI16x8LtS: OpcodeVecI16x8LtSName, + OpcodeVecI16x8LtU: OpcodeVecI16x8LtUName, + OpcodeVecI16x8GtS: OpcodeVecI16x8GtSName, + OpcodeVecI16x8GtU: OpcodeVecI16x8GtUName, + OpcodeVecI16x8LeS: OpcodeVecI16x8LeSName, + OpcodeVecI16x8LeU: OpcodeVecI16x8LeUName, + OpcodeVecI16x8GeS: OpcodeVecI16x8GeSName, + OpcodeVecI16x8GeU: OpcodeVecI16x8GeUName, + OpcodeVecI32x4Eq: OpcodeVecI32x4EqName, + OpcodeVecI32x4Ne: OpcodeVecI32x4NeName, + OpcodeVecI32x4LtS: OpcodeVecI32x4LtSName, + OpcodeVecI32x4LtU: OpcodeVecI32x4LtUName, + OpcodeVecI32x4GtS: OpcodeVecI32x4GtSName, + OpcodeVecI32x4GtU: OpcodeVecI32x4GtUName, + OpcodeVecI32x4LeS: OpcodeVecI32x4LeSName, + OpcodeVecI32x4LeU: OpcodeVecI32x4LeUName, + OpcodeVecI32x4GeS: OpcodeVecI32x4GeSName, + OpcodeVecI32x4GeU: OpcodeVecI32x4GeUName, + OpcodeVecI64x2Eq: OpcodeVecI64x2EqName, + OpcodeVecI64x2Ne: OpcodeVecI64x2NeName, + OpcodeVecI64x2LtS: OpcodeVecI64x2LtSName, + OpcodeVecI64x2GtS: OpcodeVecI64x2GtSName, + OpcodeVecI64x2LeS: OpcodeVecI64x2LeSName, + OpcodeVecI64x2GeS: OpcodeVecI64x2GeSName, + OpcodeVecF32x4Eq: OpcodeVecF32x4EqName, + OpcodeVecF32x4Ne: OpcodeVecF32x4NeName, + OpcodeVecF32x4Lt: OpcodeVecF32x4LtName, + OpcodeVecF32x4Gt: OpcodeVecF32x4GtName, + OpcodeVecF32x4Le: OpcodeVecF32x4LeName, + OpcodeVecF32x4Ge: OpcodeVecF32x4GeName, + OpcodeVecF64x2Eq: OpcodeVecF64x2EqName, + OpcodeVecF64x2Ne: OpcodeVecF64x2NeName, + OpcodeVecF64x2Lt: OpcodeVecF64x2LtName, + OpcodeVecF64x2Gt: OpcodeVecF64x2GtName, + OpcodeVecF64x2Le: OpcodeVecF64x2LeName, + OpcodeVecF64x2Ge: OpcodeVecF64x2GeName, + OpcodeVecV128Not: OpcodeVecV128NotName, + OpcodeVecV128And: OpcodeVecV128AndName, + OpcodeVecV128AndNot: OpcodeVecV128AndNotName, + OpcodeVecV128Or: OpcodeVecV128OrName, + OpcodeVecV128Xor: OpcodeVecV128XorName, + OpcodeVecV128Bitselect: OpcodeVecV128BitselectName, + OpcodeVecV128AnyTrue: OpcodeVecV128AnyTrueName, + OpcodeVecI8x16Abs: OpcodeVecI8x16AbsName, + OpcodeVecI8x16Neg: OpcodeVecI8x16NegName, + OpcodeVecI8x16Popcnt: OpcodeVecI8x16PopcntName, + OpcodeVecI8x16AllTrue: OpcodeVecI8x16AllTrueName, + OpcodeVecI8x16BitMask: OpcodeVecI8x16BitMaskName, + OpcodeVecI8x16NarrowI16x8S: OpcodeVecI8x16NarrowI16x8SName, + OpcodeVecI8x16NarrowI16x8U: OpcodeVecI8x16NarrowI16x8UName, + OpcodeVecI8x16Shl: OpcodeVecI8x16ShlName, + OpcodeVecI8x16ShrS: OpcodeVecI8x16ShrSName, + OpcodeVecI8x16ShrU: OpcodeVecI8x16ShrUName, + OpcodeVecI8x16Add: OpcodeVecI8x16AddName, + OpcodeVecI8x16AddSatS: OpcodeVecI8x16AddSatSName, + OpcodeVecI8x16AddSatU: OpcodeVecI8x16AddSatUName, + OpcodeVecI8x16Sub: OpcodeVecI8x16SubName, + OpcodeVecI8x16SubSatS: OpcodeVecI8x16SubSatSName, + OpcodeVecI8x16SubSatU: OpcodeVecI8x16SubSatUName, + OpcodeVecI8x16MinS: OpcodeVecI8x16MinSName, + OpcodeVecI8x16MinU: OpcodeVecI8x16MinUName, + OpcodeVecI8x16MaxS: OpcodeVecI8x16MaxSName, + OpcodeVecI8x16MaxU: OpcodeVecI8x16MaxUName, + OpcodeVecI8x16AvgrU: OpcodeVecI8x16AvgrUName, + OpcodeVecI16x8ExtaddPairwiseI8x16S: OpcodeVecI16x8ExtaddPairwiseI8x16SName, + OpcodeVecI16x8ExtaddPairwiseI8x16U: OpcodeVecI16x8ExtaddPairwiseI8x16UName, + OpcodeVecI16x8Abs: OpcodeVecI16x8AbsName, + OpcodeVecI16x8Neg: OpcodeVecI16x8NegName, + OpcodeVecI16x8Q15mulrSatS: OpcodeVecI16x8Q15mulrSatSName, + OpcodeVecI16x8AllTrue: OpcodeVecI16x8AllTrueName, + OpcodeVecI16x8BitMask: OpcodeVecI16x8BitMaskName, + OpcodeVecI16x8NarrowI32x4S: OpcodeVecI16x8NarrowI32x4SName, + OpcodeVecI16x8NarrowI32x4U: OpcodeVecI16x8NarrowI32x4UName, + OpcodeVecI16x8ExtendLowI8x16S: OpcodeVecI16x8ExtendLowI8x16SName, + OpcodeVecI16x8ExtendHighI8x16S: OpcodeVecI16x8ExtendHighI8x16SName, + OpcodeVecI16x8ExtendLowI8x16U: OpcodeVecI16x8ExtendLowI8x16UName, + OpcodeVecI16x8ExtendHighI8x16U: OpcodeVecI16x8ExtendHighI8x16UName, + OpcodeVecI16x8Shl: OpcodeVecI16x8ShlName, + OpcodeVecI16x8ShrS: OpcodeVecI16x8ShrSName, + OpcodeVecI16x8ShrU: OpcodeVecI16x8ShrUName, + OpcodeVecI16x8Add: OpcodeVecI16x8AddName, + OpcodeVecI16x8AddSatS: OpcodeVecI16x8AddSatSName, + OpcodeVecI16x8AddSatU: OpcodeVecI16x8AddSatUName, + OpcodeVecI16x8Sub: OpcodeVecI16x8SubName, + OpcodeVecI16x8SubSatS: OpcodeVecI16x8SubSatSName, + OpcodeVecI16x8SubSatU: OpcodeVecI16x8SubSatUName, + OpcodeVecI16x8Mul: OpcodeVecI16x8MulName, + OpcodeVecI16x8MinS: OpcodeVecI16x8MinSName, + OpcodeVecI16x8MinU: OpcodeVecI16x8MinUName, + OpcodeVecI16x8MaxS: OpcodeVecI16x8MaxSName, + OpcodeVecI16x8MaxU: OpcodeVecI16x8MaxUName, + OpcodeVecI16x8AvgrU: OpcodeVecI16x8AvgrUName, + OpcodeVecI16x8ExtMulLowI8x16S: OpcodeVecI16x8ExtMulLowI8x16SName, + OpcodeVecI16x8ExtMulHighI8x16S: OpcodeVecI16x8ExtMulHighI8x16SName, + OpcodeVecI16x8ExtMulLowI8x16U: OpcodeVecI16x8ExtMulLowI8x16UName, + OpcodeVecI16x8ExtMulHighI8x16U: OpcodeVecI16x8ExtMulHighI8x16UName, + OpcodeVecI32x4ExtaddPairwiseI16x8S: OpcodeVecI32x4ExtaddPairwiseI16x8SName, + OpcodeVecI32x4ExtaddPairwiseI16x8U: OpcodeVecI32x4ExtaddPairwiseI16x8UName, + OpcodeVecI32x4Abs: OpcodeVecI32x4AbsName, + OpcodeVecI32x4Neg: OpcodeVecI32x4NegName, + OpcodeVecI32x4AllTrue: OpcodeVecI32x4AllTrueName, + OpcodeVecI32x4BitMask: OpcodeVecI32x4BitMaskName, + OpcodeVecI32x4ExtendLowI16x8S: OpcodeVecI32x4ExtendLowI16x8SName, + OpcodeVecI32x4ExtendHighI16x8S: OpcodeVecI32x4ExtendHighI16x8SName, + OpcodeVecI32x4ExtendLowI16x8U: OpcodeVecI32x4ExtendLowI16x8UName, + OpcodeVecI32x4ExtendHighI16x8U: OpcodeVecI32x4ExtendHighI16x8UName, + OpcodeVecI32x4Shl: OpcodeVecI32x4ShlName, + OpcodeVecI32x4ShrS: OpcodeVecI32x4ShrSName, + OpcodeVecI32x4ShrU: OpcodeVecI32x4ShrUName, + OpcodeVecI32x4Add: OpcodeVecI32x4AddName, + OpcodeVecI32x4Sub: OpcodeVecI32x4SubName, + OpcodeVecI32x4Mul: OpcodeVecI32x4MulName, + OpcodeVecI32x4MinS: OpcodeVecI32x4MinSName, + OpcodeVecI32x4MinU: OpcodeVecI32x4MinUName, + OpcodeVecI32x4MaxS: OpcodeVecI32x4MaxSName, + OpcodeVecI32x4MaxU: OpcodeVecI32x4MaxUName, + OpcodeVecI32x4DotI16x8S: OpcodeVecI32x4DotI16x8SName, + OpcodeVecI32x4ExtMulLowI16x8S: OpcodeVecI32x4ExtMulLowI16x8SName, + OpcodeVecI32x4ExtMulHighI16x8S: OpcodeVecI32x4ExtMulHighI16x8SName, + OpcodeVecI32x4ExtMulLowI16x8U: OpcodeVecI32x4ExtMulLowI16x8UName, + OpcodeVecI32x4ExtMulHighI16x8U: OpcodeVecI32x4ExtMulHighI16x8UName, + OpcodeVecI64x2Abs: OpcodeVecI64x2AbsName, + OpcodeVecI64x2Neg: OpcodeVecI64x2NegName, + OpcodeVecI64x2AllTrue: OpcodeVecI64x2AllTrueName, + OpcodeVecI64x2BitMask: OpcodeVecI64x2BitMaskName, + OpcodeVecI64x2ExtendLowI32x4S: OpcodeVecI64x2ExtendLowI32x4SName, + OpcodeVecI64x2ExtendHighI32x4S: OpcodeVecI64x2ExtendHighI32x4SName, + OpcodeVecI64x2ExtendLowI32x4U: OpcodeVecI64x2ExtendLowI32x4UName, + OpcodeVecI64x2ExtendHighI32x4U: OpcodeVecI64x2ExtendHighI32x4UName, + OpcodeVecI64x2Shl: OpcodeVecI64x2ShlName, + OpcodeVecI64x2ShrS: OpcodeVecI64x2ShrSName, + OpcodeVecI64x2ShrU: OpcodeVecI64x2ShrUName, + OpcodeVecI64x2Add: OpcodeVecI64x2AddName, + OpcodeVecI64x2Sub: OpcodeVecI64x2SubName, + OpcodeVecI64x2Mul: OpcodeVecI64x2MulName, + OpcodeVecI64x2ExtMulLowI32x4S: OpcodeVecI64x2ExtMulLowI32x4SName, + OpcodeVecI64x2ExtMulHighI32x4S: OpcodeVecI64x2ExtMulHighI32x4SName, + OpcodeVecI64x2ExtMulLowI32x4U: OpcodeVecI64x2ExtMulLowI32x4UName, + OpcodeVecI64x2ExtMulHighI32x4U: OpcodeVecI64x2ExtMulHighI32x4UName, + OpcodeVecF32x4Ceil: OpcodeVecF32x4CeilName, + OpcodeVecF32x4Floor: OpcodeVecF32x4FloorName, + OpcodeVecF32x4Trunc: OpcodeVecF32x4TruncName, + OpcodeVecF32x4Nearest: OpcodeVecF32x4NearestName, + OpcodeVecF32x4Abs: OpcodeVecF32x4AbsName, + OpcodeVecF32x4Neg: OpcodeVecF32x4NegName, + OpcodeVecF32x4Sqrt: OpcodeVecF32x4SqrtName, + OpcodeVecF32x4Add: OpcodeVecF32x4AddName, + OpcodeVecF32x4Sub: OpcodeVecF32x4SubName, + OpcodeVecF32x4Mul: OpcodeVecF32x4MulName, + OpcodeVecF32x4Div: OpcodeVecF32x4DivName, + OpcodeVecF32x4Min: OpcodeVecF32x4MinName, + OpcodeVecF32x4Max: OpcodeVecF32x4MaxName, + OpcodeVecF32x4Pmin: OpcodeVecF32x4PminName, + OpcodeVecF32x4Pmax: OpcodeVecF32x4PmaxName, + OpcodeVecF64x2Ceil: OpcodeVecF64x2CeilName, + OpcodeVecF64x2Floor: OpcodeVecF64x2FloorName, + OpcodeVecF64x2Trunc: OpcodeVecF64x2TruncName, + OpcodeVecF64x2Nearest: OpcodeVecF64x2NearestName, + OpcodeVecF64x2Abs: OpcodeVecF64x2AbsName, + OpcodeVecF64x2Neg: OpcodeVecF64x2NegName, + OpcodeVecF64x2Sqrt: OpcodeVecF64x2SqrtName, + OpcodeVecF64x2Add: OpcodeVecF64x2AddName, + OpcodeVecF64x2Sub: OpcodeVecF64x2SubName, + OpcodeVecF64x2Mul: OpcodeVecF64x2MulName, + OpcodeVecF64x2Div: OpcodeVecF64x2DivName, + OpcodeVecF64x2Min: OpcodeVecF64x2MinName, + OpcodeVecF64x2Max: OpcodeVecF64x2MaxName, + OpcodeVecF64x2Pmin: OpcodeVecF64x2PminName, + OpcodeVecF64x2Pmax: OpcodeVecF64x2PmaxName, + OpcodeVecI32x4TruncSatF32x4S: OpcodeVecI32x4TruncSatF32x4SName, + OpcodeVecI32x4TruncSatF32x4U: OpcodeVecI32x4TruncSatF32x4UName, + OpcodeVecF32x4ConvertI32x4S: OpcodeVecF32x4ConvertI32x4SName, + OpcodeVecF32x4ConvertI32x4U: OpcodeVecF32x4ConvertI32x4UName, + OpcodeVecI32x4TruncSatF64x2SZero: OpcodeVecI32x4TruncSatF64x2SZeroName, + OpcodeVecI32x4TruncSatF64x2UZero: OpcodeVecI32x4TruncSatF64x2UZeroName, + OpcodeVecF64x2ConvertLowI32x4S: OpcodeVecF64x2ConvertLowI32x4SName, + OpcodeVecF64x2ConvertLowI32x4U: OpcodeVecF64x2ConvertLowI32x4UName, + OpcodeVecF32x4DemoteF64x2Zero: OpcodeVecF32x4DemoteF64x2ZeroName, + OpcodeVecF64x2PromoteLowF32x4Zero: OpcodeVecF64x2PromoteLowF32x4ZeroName, +} + +// VectorInstructionName returns the instruction name corresponding to the vector Opcode. +func VectorInstructionName(oc OpcodeVec) (ret string) { + return vectorInstructionName[oc] +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/memory.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/memory.go new file mode 100644 index 000000000..bce037e41 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/memory.go @@ -0,0 +1,279 @@ +package wasm + +import ( + "encoding/binary" + "fmt" + "math" + "reflect" + "unsafe" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/internalapi" +) + +const ( + // MemoryPageSize is the unit of memory length in WebAssembly, + // and is defined as 2^16 = 65536. + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#memory-instances%E2%91%A0 + MemoryPageSize = uint32(65536) + // MemoryLimitPages is maximum number of pages defined (2^16). + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#grow-mem + MemoryLimitPages = uint32(65536) + // MemoryPageSizeInBits satisfies the relation: "1 << MemoryPageSizeInBits == MemoryPageSize". + MemoryPageSizeInBits = 16 +) + +// compile-time check to ensure MemoryInstance implements api.Memory +var _ api.Memory = &MemoryInstance{} + +// MemoryInstance represents a memory instance in a store, and implements api.Memory. +// +// Note: In WebAssembly 1.0 (20191205), there may be up to one Memory per store, which means the precise memory is always +// wasm.Store Memories index zero: `store.Memories[0]` +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#memory-instances%E2%91%A0. +type MemoryInstance struct { + internalapi.WazeroOnlyType + + Buffer []byte + Min, Cap, Max uint32 + // definition is known at compile time. + definition api.MemoryDefinition +} + +// NewMemoryInstance creates a new instance based on the parameters in the SectionIDMemory. +func NewMemoryInstance(memSec *Memory) *MemoryInstance { + min := MemoryPagesToBytesNum(memSec.Min) + capacity := MemoryPagesToBytesNum(memSec.Cap) + return &MemoryInstance{ + Buffer: make([]byte, min, capacity), + Min: memSec.Min, + Cap: memSec.Cap, + Max: memSec.Max, + } +} + +// Definition implements the same method as documented on api.Memory. +func (m *MemoryInstance) Definition() api.MemoryDefinition { + return m.definition +} + +// Size implements the same method as documented on api.Memory. +func (m *MemoryInstance) Size() uint32 { + return m.size() +} + +// ReadByte implements the same method as documented on api.Memory. +func (m *MemoryInstance) ReadByte(offset uint32) (byte, bool) { + if offset >= m.size() { + return 0, false + } + return m.Buffer[offset], true +} + +// ReadUint16Le implements the same method as documented on api.Memory. +func (m *MemoryInstance) ReadUint16Le(offset uint32) (uint16, bool) { + if !m.hasSize(offset, 2) { + return 0, false + } + return binary.LittleEndian.Uint16(m.Buffer[offset : offset+2]), true +} + +// ReadUint32Le implements the same method as documented on api.Memory. +func (m *MemoryInstance) ReadUint32Le(offset uint32) (uint32, bool) { + return m.readUint32Le(offset) +} + +// ReadFloat32Le implements the same method as documented on api.Memory. +func (m *MemoryInstance) ReadFloat32Le(offset uint32) (float32, bool) { + v, ok := m.readUint32Le(offset) + if !ok { + return 0, false + } + return math.Float32frombits(v), true +} + +// ReadUint64Le implements the same method as documented on api.Memory. +func (m *MemoryInstance) ReadUint64Le(offset uint32) (uint64, bool) { + return m.readUint64Le(offset) +} + +// ReadFloat64Le implements the same method as documented on api.Memory. +func (m *MemoryInstance) ReadFloat64Le(offset uint32) (float64, bool) { + v, ok := m.readUint64Le(offset) + if !ok { + return 0, false + } + return math.Float64frombits(v), true +} + +// Read implements the same method as documented on api.Memory. +func (m *MemoryInstance) Read(offset, byteCount uint32) ([]byte, bool) { + if !m.hasSize(offset, uint64(byteCount)) { + return nil, false + } + return m.Buffer[offset : offset+byteCount : offset+byteCount], true +} + +// WriteByte implements the same method as documented on api.Memory. +func (m *MemoryInstance) WriteByte(offset uint32, v byte) bool { + if offset >= m.size() { + return false + } + m.Buffer[offset] = v + return true +} + +// WriteUint16Le implements the same method as documented on api.Memory. +func (m *MemoryInstance) WriteUint16Le(offset uint32, v uint16) bool { + if !m.hasSize(offset, 2) { + return false + } + binary.LittleEndian.PutUint16(m.Buffer[offset:], v) + return true +} + +// WriteUint32Le implements the same method as documented on api.Memory. +func (m *MemoryInstance) WriteUint32Le(offset, v uint32) bool { + return m.writeUint32Le(offset, v) +} + +// WriteFloat32Le implements the same method as documented on api.Memory. +func (m *MemoryInstance) WriteFloat32Le(offset uint32, v float32) bool { + return m.writeUint32Le(offset, math.Float32bits(v)) +} + +// WriteUint64Le implements the same method as documented on api.Memory. +func (m *MemoryInstance) WriteUint64Le(offset uint32, v uint64) bool { + return m.writeUint64Le(offset, v) +} + +// WriteFloat64Le implements the same method as documented on api.Memory. +func (m *MemoryInstance) WriteFloat64Le(offset uint32, v float64) bool { + return m.writeUint64Le(offset, math.Float64bits(v)) +} + +// Write implements the same method as documented on api.Memory. +func (m *MemoryInstance) Write(offset uint32, val []byte) bool { + if !m.hasSize(offset, uint64(len(val))) { + return false + } + copy(m.Buffer[offset:], val) + return true +} + +// WriteString implements the same method as documented on api.Memory. +func (m *MemoryInstance) WriteString(offset uint32, val string) bool { + if !m.hasSize(offset, uint64(len(val))) { + return false + } + copy(m.Buffer[offset:], val) + return true +} + +// MemoryPagesToBytesNum converts the given pages into the number of bytes contained in these pages. +func MemoryPagesToBytesNum(pages uint32) (bytesNum uint64) { + return uint64(pages) << MemoryPageSizeInBits +} + +// Grow implements the same method as documented on api.Memory. +func (m *MemoryInstance) Grow(delta uint32) (result uint32, ok bool) { + currentPages := memoryBytesNumToPages(uint64(len(m.Buffer))) + if delta == 0 { + return currentPages, true + } + + // If exceeds the max of memory size, we push -1 according to the spec. + newPages := currentPages + delta + if newPages > m.Max { + return 0, false + } else if newPages > m.Cap { // grow the memory. + m.Buffer = append(m.Buffer, make([]byte, MemoryPagesToBytesNum(delta))...) + m.Cap = newPages + return currentPages, true + } else { // We already have the capacity we need. + sp := (*reflect.SliceHeader)(unsafe.Pointer(&m.Buffer)) + sp.Len = int(MemoryPagesToBytesNum(newPages)) + return currentPages, true + } +} + +// PageSize returns the current memory buffer size in pages. +func (m *MemoryInstance) PageSize() (result uint32) { + return memoryBytesNumToPages(uint64(len(m.Buffer))) +} + +// PagesToUnitOfBytes converts the pages to a human-readable form similar to what's specified. e.g. 1 -> "64Ki" +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#memory-instances%E2%91%A0 +func PagesToUnitOfBytes(pages uint32) string { + k := pages * 64 + if k < 1024 { + return fmt.Sprintf("%d Ki", k) + } + m := k / 1024 + if m < 1024 { + return fmt.Sprintf("%d Mi", m) + } + g := m / 1024 + if g < 1024 { + return fmt.Sprintf("%d Gi", g) + } + return fmt.Sprintf("%d Ti", g/1024) +} + +// Below are raw functions used to implement the api.Memory API: + +// memoryBytesNumToPages converts the given number of bytes into the number of pages. +func memoryBytesNumToPages(bytesNum uint64) (pages uint32) { + return uint32(bytesNum >> MemoryPageSizeInBits) +} + +// size returns the size in bytes of the buffer. +func (m *MemoryInstance) size() uint32 { + return uint32(len(m.Buffer)) // We don't lock here because size can't become smaller. +} + +// hasSize returns true if Len is sufficient for byteCount at the given offset. +// +// Note: This is always fine, because memory can grow, but never shrink. +func (m *MemoryInstance) hasSize(offset uint32, byteCount uint64) bool { + return uint64(offset)+byteCount <= uint64(len(m.Buffer)) // uint64 prevents overflow on add +} + +// readUint32Le implements ReadUint32Le without using a context. This is extracted as both ints and floats are stored in +// memory as uint32le. +func (m *MemoryInstance) readUint32Le(offset uint32) (uint32, bool) { + if !m.hasSize(offset, 4) { + return 0, false + } + return binary.LittleEndian.Uint32(m.Buffer[offset : offset+4]), true +} + +// readUint64Le implements ReadUint64Le without using a context. This is extracted as both ints and floats are stored in +// memory as uint64le. +func (m *MemoryInstance) readUint64Le(offset uint32) (uint64, bool) { + if !m.hasSize(offset, 8) { + return 0, false + } + return binary.LittleEndian.Uint64(m.Buffer[offset : offset+8]), true +} + +// writeUint32Le implements WriteUint32Le without using a context. This is extracted as both ints and floats are stored +// in memory as uint32le. +func (m *MemoryInstance) writeUint32Le(offset uint32, v uint32) bool { + if !m.hasSize(offset, 4) { + return false + } + binary.LittleEndian.PutUint32(m.Buffer[offset:], v) + return true +} + +// writeUint64Le implements WriteUint64Le without using a context. This is extracted as both ints and floats are stored +// in memory as uint64le. +func (m *MemoryInstance) writeUint64Le(offset uint32, v uint64) bool { + if !m.hasSize(offset, 8) { + return false + } + binary.LittleEndian.PutUint64(m.Buffer[offset:], v) + return true +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/memory_definition.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/memory_definition.go new file mode 100644 index 000000000..03d6fd303 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/memory_definition.go @@ -0,0 +1,128 @@ +package wasm + +import ( + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/internalapi" +) + +// ImportedMemories implements the same method as documented on wazero.CompiledModule. +func (m *Module) ImportedMemories() (ret []api.MemoryDefinition) { + for i := range m.MemoryDefinitionSection { + d := &m.MemoryDefinitionSection[i] + if d.importDesc != nil { + ret = append(ret, d) + } + } + return +} + +// ExportedMemories implements the same method as documented on wazero.CompiledModule. +func (m *Module) ExportedMemories() map[string]api.MemoryDefinition { + ret := map[string]api.MemoryDefinition{} + for i := range m.MemoryDefinitionSection { + d := &m.MemoryDefinitionSection[i] + for _, e := range d.exportNames { + ret[e] = d + } + } + return ret +} + +// BuildMemoryDefinitions generates memory metadata that can be parsed from +// the module. This must be called after all validation. +// +// Note: This is exported for wazero.Runtime `CompileModule`. +func (m *Module) BuildMemoryDefinitions() { + var moduleName string + if m.NameSection != nil { + moduleName = m.NameSection.ModuleName + } + + memoryCount := m.ImportMemoryCount + if m.MemorySection != nil { + memoryCount++ + } + + if memoryCount == 0 { + return + } + + m.MemoryDefinitionSection = make([]MemoryDefinition, 0, memoryCount) + importMemIdx := Index(0) + for i := range m.ImportSection { + imp := &m.ImportSection[i] + if imp.Type != ExternTypeMemory { + continue + } + + m.MemoryDefinitionSection = append(m.MemoryDefinitionSection, MemoryDefinition{ + importDesc: &[2]string{imp.Module, imp.Name}, + index: importMemIdx, + memory: imp.DescMem, + }) + importMemIdx++ + } + + if m.MemorySection != nil { + m.MemoryDefinitionSection = append(m.MemoryDefinitionSection, MemoryDefinition{ + index: importMemIdx, + memory: m.MemorySection, + }) + } + + for i := range m.MemoryDefinitionSection { + d := &m.MemoryDefinitionSection[i] + d.moduleName = moduleName + for i := range m.ExportSection { + e := &m.ExportSection[i] + if e.Type == ExternTypeMemory && e.Index == d.index { + d.exportNames = append(d.exportNames, e.Name) + } + } + } +} + +// MemoryDefinition implements api.MemoryDefinition +type MemoryDefinition struct { + internalapi.WazeroOnlyType + moduleName string + index Index + importDesc *[2]string + exportNames []string + memory *Memory +} + +// ModuleName implements the same method as documented on api.MemoryDefinition. +func (f *MemoryDefinition) ModuleName() string { + return f.moduleName +} + +// Index implements the same method as documented on api.MemoryDefinition. +func (f *MemoryDefinition) Index() uint32 { + return f.index +} + +// Import implements the same method as documented on api.MemoryDefinition. +func (f *MemoryDefinition) Import() (moduleName, name string, isImport bool) { + if importDesc := f.importDesc; importDesc != nil { + moduleName, name, isImport = importDesc[0], importDesc[1], true + } + return +} + +// ExportNames implements the same method as documented on api.MemoryDefinition. +func (f *MemoryDefinition) ExportNames() []string { + return f.exportNames +} + +// Min implements the same method as documented on api.MemoryDefinition. +func (f *MemoryDefinition) Min() uint32 { + return f.memory.Min +} + +// Max implements the same method as documented on api.MemoryDefinition. +func (f *MemoryDefinition) Max() (max uint32, encoded bool) { + max = f.memory.Max + encoded = f.memory.IsMaxEncoded + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/module.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/module.go new file mode 100644 index 000000000..a5aaf6adf --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/module.go @@ -0,0 +1,1076 @@ +package wasm + +import ( + "bytes" + "crypto/sha256" + "encoding/binary" + "errors" + "fmt" + "io" + "sort" + "strings" + "sync" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/experimental" + "github.com/tetratelabs/wazero/internal/ieee754" + "github.com/tetratelabs/wazero/internal/leb128" + "github.com/tetratelabs/wazero/internal/wasmdebug" +) + +// Module is a WebAssembly binary representation. +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#modules%E2%91%A8 +// +// Differences from the specification: +// * NameSection is the only key ("name") decoded from the SectionIDCustom. +// * ExportSection is represented as a map for lookup convenience. +// * Code.GoFunc is contains any go `func`. It may be present when Code.Body is not. +type Module struct { + // TypeSection contains the unique FunctionType of functions imported or defined in this module. + // + // Note: Currently, there is no type ambiguity in the index as WebAssembly 1.0 only defines function type. + // In the future, other types may be introduced to support CoreFeatures such as module linking. + // + // Note: In the Binary Format, this is SectionIDType. + // + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#types%E2%91%A0%E2%91%A0 + TypeSection []FunctionType + + // ImportSection contains imported functions, tables, memories or globals required for instantiation + // (Store.Instantiate). + // + // Note: there are no unique constraints relating to the two-level namespace of Import.Module and Import.Name. + // + // Note: In the Binary Format, this is SectionIDImport. + // + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#import-section%E2%91%A0 + ImportSection []Import + // ImportFunctionCount ImportGlobalCount ImportMemoryCount, and ImportTableCount are + // the cached import count per ExternType set during decoding. + ImportFunctionCount, + ImportGlobalCount, + ImportMemoryCount, + ImportTableCount Index + // ImportPerModule maps a module name to the list of Import to be imported from the module. + // This is used to do fast import resolution during instantiation. + ImportPerModule map[string][]*Import + + // FunctionSection contains the index in TypeSection of each function defined in this module. + // + // Note: The function Index space begins with imported functions and ends with those defined in this module. + // For example, if there are two imported functions and one defined in this module, the function Index 3 is defined + // in this module at FunctionSection[0]. + // + // Note: FunctionSection is index correlated with the CodeSection. If given the same position, e.g. 2, a function + // type is at TypeSection[FunctionSection[2]], while its locals and body are at CodeSection[2]. + // + // Note: In the Binary Format, this is SectionIDFunction. + // + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#function-section%E2%91%A0 + FunctionSection []Index + + // TableSection contains each table defined in this module. + // + // Note: The table Index space begins with imported tables and ends with those defined in this module. + // For example, if there are two imported tables and one defined in this module, the table Index 3 is defined in + // this module at TableSection[0]. + // + // Note: Version 1.0 (20191205) of the WebAssembly spec allows at most one table definition per module, so the + // length of the TableSection can be zero or one, and can only be one if there is no imported table. + // + // Note: In the Binary Format, this is SectionIDTable. + // + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#table-section%E2%91%A0 + TableSection []Table + + // MemorySection contains each memory defined in this module. + // + // Note: The memory Index space begins with imported memories and ends with those defined in this module. + // For example, if there are two imported memories and one defined in this module, the memory Index 3 is defined in + // this module at TableSection[0]. + // + // Note: Version 1.0 (20191205) of the WebAssembly spec allows at most one memory definition per module, so the + // length of the MemorySection can be zero or one, and can only be one if there is no imported memory. + // + // Note: In the Binary Format, this is SectionIDMemory. + // + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#memory-section%E2%91%A0 + MemorySection *Memory + + // GlobalSection contains each global defined in this module. + // + // Global indexes are offset by any imported globals because the global index begins with imports, followed by + // ones defined in this module. For example, if there are two imported globals and three defined in this module, the + // global at index 3 is defined in this module at GlobalSection[0]. + // + // Note: In the Binary Format, this is SectionIDGlobal. + // + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#global-section%E2%91%A0 + GlobalSection []Global + + // ExportSection contains each export defined in this module. + // + // Note: In the Binary Format, this is SectionIDExport. + // + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#exports%E2%91%A0 + ExportSection []Export + // Exports maps a name to Export, and is convenient for fast look up of exported instances at runtime. + // Each item of this map points to an element of ExportSection. + Exports map[string]*Export + + // StartSection is the index of a function to call before returning from Store.Instantiate. + // + // Note: The index here is not the position in the FunctionSection, rather in the function index, which + // begins with imported functions. + // + // Note: In the Binary Format, this is SectionIDStart. + // + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#start-section%E2%91%A0 + StartSection *Index + + // Note: In the Binary Format, this is SectionIDElement. + ElementSection []ElementSegment + + // CodeSection is index-correlated with FunctionSection and contains each + // function's locals and body. + // + // When present, the HostFunctionSection of the same index must be nil. + // + // Note: In the Binary Format, this is SectionIDCode. + // + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#code-section%E2%91%A0 + CodeSection []Code + + // Note: In the Binary Format, this is SectionIDData. + DataSection []DataSegment + + // NameSection is set when the SectionIDCustom "name" was successfully decoded from the binary format. + // + // Note: This is the only SectionIDCustom defined in the WebAssembly 1.0 (20191205) Binary Format. + // Others are skipped as they are not used in wazero. + // + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#name-section%E2%91%A0 + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#custom-section%E2%91%A0 + NameSection *NameSection + + // CustomSections are set when the SectionIDCustom other than "name" were successfully decoded from the binary format. + // + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#custom-section%E2%91%A0 + CustomSections []*CustomSection + + // DataCountSection is the optional section and holds the number of data segments in the data section. + // + // Note: This may exist in WebAssembly 2.0 or WebAssembly 1.0 with CoreFeatureBulkMemoryOperations. + // See https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/binary/modules.html#data-count-section + // See https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/appendix/changes.html#bulk-memory-and-table-instructions + DataCountSection *uint32 + + // ID is the sha256 value of the source wasm plus the configurations which affect the runtime representation of + // Wasm binary. This is only used for caching. + ID ModuleID + + // IsHostModule true if this is the host module, false otherwise. + IsHostModule bool + + // functionDefinitionSectionInitOnce guards FunctionDefinitionSection so that it is initialized exactly once. + functionDefinitionSectionInitOnce sync.Once + + // FunctionDefinitionSection is a wazero-specific section. + FunctionDefinitionSection []FunctionDefinition + + // MemoryDefinitionSection is a wazero-specific section. + MemoryDefinitionSection []MemoryDefinition + + // DWARFLines is used to emit DWARF based stack trace. This is created from the multiple custom sections + // as described in https://yurydelendik.github.io/webassembly-dwarf/, though it is not specified in the Wasm + // specification: https://github.com/WebAssembly/debugging/issues/1 + DWARFLines *wasmdebug.DWARFLines +} + +// ModuleID represents sha256 hash value uniquely assigned to Module. +type ModuleID = [sha256.Size]byte + +// The wazero specific limitation described at RATIONALE.md. +// TL;DR; We multiply by 8 (to get offsets in bytes) and the multiplication result must be less than 32bit max +const ( + MaximumGlobals = uint32(1 << 27) + MaximumFunctionIndex = uint32(1 << 27) + MaximumTableIndex = uint32(1 << 27) +) + +// AssignModuleID calculates a sha256 checksum on `wasm` and other args, and set Module.ID to the result. +// See the doc on Module.ID on what it's used for. +func (m *Module) AssignModuleID(wasm []byte, listeners []experimental.FunctionListener, withEnsureTermination bool) { + h := sha256.New() + h.Write(wasm) + // Use the pre-allocated space backed by m.ID below. + + // Write the existence of listeners to the checksum per function. + for i, l := range listeners { + binary.LittleEndian.PutUint32(m.ID[:], uint32(i)) + m.ID[4] = boolToByte(l != nil) + h.Write(m.ID[:5]) + } + // Write the flag of ensureTermination to the checksum. + m.ID[0] = boolToByte(withEnsureTermination) + h.Write(m.ID[:1]) + // Get checksum by passing the slice underlying m.ID. + h.Sum(m.ID[:0]) +} + +func boolToByte(b bool) (ret byte) { + if b { + ret = 1 + } + return +} + +// typeOfFunction returns the wasm.FunctionType for the given function space index or nil. +func (m *Module) typeOfFunction(funcIdx Index) *FunctionType { + typeSectionLength, importedFunctionCount := uint32(len(m.TypeSection)), m.ImportFunctionCount + if funcIdx < importedFunctionCount { + // Imports are not exclusively functions. This is the current function index in the loop. + cur := Index(0) + for i := range m.ImportSection { + imp := &m.ImportSection[i] + if imp.Type != ExternTypeFunc { + continue + } + if funcIdx == cur { + if imp.DescFunc >= typeSectionLength { + return nil + } + return &m.TypeSection[imp.DescFunc] + } + cur++ + } + } + + funcSectionIdx := funcIdx - m.ImportFunctionCount + if funcSectionIdx >= uint32(len(m.FunctionSection)) { + return nil + } + typeIdx := m.FunctionSection[funcSectionIdx] + if typeIdx >= typeSectionLength { + return nil + } + return &m.TypeSection[typeIdx] +} + +func (m *Module) Validate(enabledFeatures api.CoreFeatures) error { + for i := range m.TypeSection { + tp := &m.TypeSection[i] + tp.CacheNumInUint64() + } + + if err := m.validateStartSection(); err != nil { + return err + } + + functions, globals, memory, tables, err := m.AllDeclarations() + if err != nil { + return err + } + + if err = m.validateImports(enabledFeatures); err != nil { + return err + } + + if err = m.validateGlobals(globals, uint32(len(functions)), MaximumGlobals); err != nil { + return err + } + + if err = m.validateMemory(memory, globals, enabledFeatures); err != nil { + return err + } + + if err = m.validateExports(enabledFeatures, functions, globals, memory, tables); err != nil { + return err + } + + if m.CodeSection != nil { + if err = m.validateFunctions(enabledFeatures, functions, globals, memory, tables, MaximumFunctionIndex); err != nil { + return err + } + } // No need to validate host functions as NewHostModule validates + + if err = m.validateTable(enabledFeatures, tables, MaximumTableIndex); err != nil { + return err + } + + if err = m.validateDataCountSection(); err != nil { + return err + } + return nil +} + +func (m *Module) validateStartSection() error { + // Check the start function is valid. + // TODO: this should be verified during decode so that errors have the correct source positions + if m.StartSection != nil { + startIndex := *m.StartSection + ft := m.typeOfFunction(startIndex) + if ft == nil { // TODO: move this check to decoder so that a module can never be decoded invalidly + return fmt.Errorf("invalid start function: func[%d] has an invalid type", startIndex) + } + if len(ft.Params) > 0 || len(ft.Results) > 0 { + return fmt.Errorf("invalid start function: func[%d] must have an empty (nullary) signature: %s", startIndex, ft) + } + } + return nil +} + +func (m *Module) validateGlobals(globals []GlobalType, numFuncts, maxGlobals uint32) error { + if uint32(len(globals)) > maxGlobals { + return fmt.Errorf("too many globals in a module") + } + + // Global initialization constant expression can only reference the imported globals. + // See the note on https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#constant-expressions%E2%91%A0 + importedGlobals := globals[:m.ImportGlobalCount] + for i := range m.GlobalSection { + g := &m.GlobalSection[i] + if err := validateConstExpression(importedGlobals, numFuncts, &g.Init, g.Type.ValType); err != nil { + return err + } + } + return nil +} + +func (m *Module) validateFunctions(enabledFeatures api.CoreFeatures, functions []Index, globals []GlobalType, memory *Memory, tables []Table, maximumFunctionIndex uint32) error { + if uint32(len(functions)) > maximumFunctionIndex { + return fmt.Errorf("too many functions (%d) in a module", len(functions)) + } + + functionCount := m.SectionElementCount(SectionIDFunction) + codeCount := m.SectionElementCount(SectionIDCode) + if functionCount == 0 && codeCount == 0 { + return nil + } + + typeCount := m.SectionElementCount(SectionIDType) + if codeCount != functionCount { + return fmt.Errorf("code count (%d) != function count (%d)", codeCount, functionCount) + } + + declaredFuncIndexes, err := m.declaredFunctionIndexes() + if err != nil { + return err + } + + // Create bytes.Reader once as it causes allocation, and + // we frequently need it (e.g. on every If instruction). + br := bytes.NewReader(nil) + // Also, we reuse the stacks across multiple function validations to reduce allocations. + vs := &stacks{} + for idx, typeIndex := range m.FunctionSection { + if typeIndex >= typeCount { + return fmt.Errorf("invalid %s: type section index %d out of range", m.funcDesc(SectionIDFunction, Index(idx)), typeIndex) + } + c := &m.CodeSection[idx] + if c.GoFunc != nil { + continue + } + if err = m.validateFunction(vs, enabledFeatures, Index(idx), functions, globals, memory, tables, declaredFuncIndexes, br); err != nil { + return fmt.Errorf("invalid %s: %w", m.funcDesc(SectionIDFunction, Index(idx)), err) + } + } + return nil +} + +// declaredFunctionIndexes returns a set of function indexes that can be used as an immediate for OpcodeRefFunc instruction. +// +// The criteria for which function indexes can be available for that instruction is vague in the spec: +// +// - "References: the list of function indices that occur in the module outside functions and can hence be used to form references inside them." +// - https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/valid/conventions.html#contexts +// - "Ref is the set funcidx(module with functions=Īµ, start=Īµ) , i.e., the set of function indices occurring in the module, except in its functions or start function." +// - https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/valid/modules.html#valid-module +// +// To clarify, we reverse-engineer logic required to pass the WebAssembly Core specification 2.0 test suite: +// https://github.com/WebAssembly/spec/blob/d39195773112a22b245ffbe864bab6d1182ccb06/test/core/ref_func.wast#L78-L115 +// +// To summarize, the function indexes OpcodeRefFunc can refer include: +// - existing in an element section regardless of its mode (active, passive, declarative). +// - defined as globals whose value type is ValueRefFunc. +// - used as an exported function. +// +// See https://github.com/WebAssembly/reference-types/issues/31 +// See https://github.com/WebAssembly/reference-types/issues/76 +func (m *Module) declaredFunctionIndexes() (ret map[Index]struct{}, err error) { + ret = map[uint32]struct{}{} + + for i := range m.ExportSection { + exp := &m.ExportSection[i] + if exp.Type == ExternTypeFunc { + ret[exp.Index] = struct{}{} + } + } + + for i := range m.GlobalSection { + g := &m.GlobalSection[i] + if g.Init.Opcode == OpcodeRefFunc { + var index uint32 + index, _, err = leb128.LoadUint32(g.Init.Data) + if err != nil { + err = fmt.Errorf("%s[%d] failed to initialize: %w", SectionIDName(SectionIDGlobal), i, err) + return + } + ret[index] = struct{}{} + } + } + + for i := range m.ElementSection { + elem := &m.ElementSection[i] + for _, index := range elem.Init { + if index != ElementInitNullReference { + ret[index] = struct{}{} + } + } + } + return +} + +func (m *Module) funcDesc(sectionID SectionID, sectionIndex Index) string { + // Try to improve the error message by collecting any exports: + var exportNames []string + funcIdx := sectionIndex + m.ImportFunctionCount + for i := range m.ExportSection { + exp := &m.ExportSection[i] + if exp.Index == funcIdx && exp.Type == ExternTypeFunc { + exportNames = append(exportNames, fmt.Sprintf("%q", exp.Name)) + } + } + sectionIDName := SectionIDName(sectionID) + if exportNames == nil { + return fmt.Sprintf("%s[%d]", sectionIDName, sectionIndex) + } + sort.Strings(exportNames) // go map keys do not iterate consistently + return fmt.Sprintf("%s[%d] export[%s]", sectionIDName, sectionIndex, strings.Join(exportNames, ",")) +} + +func (m *Module) validateMemory(memory *Memory, globals []GlobalType, _ api.CoreFeatures) error { + var activeElementCount int + for i := range m.DataSection { + d := &m.DataSection[i] + if !d.IsPassive() { + activeElementCount++ + } + } + if activeElementCount > 0 && memory == nil { + return fmt.Errorf("unknown memory") + } + + // Constant expression can only reference imported globals. + // https://github.com/WebAssembly/spec/blob/5900d839f38641989a9d8df2df4aee0513365d39/test/core/data.wast#L84-L91 + importedGlobals := globals[:m.ImportGlobalCount] + for i := range m.DataSection { + d := &m.DataSection[i] + if !d.IsPassive() { + if err := validateConstExpression(importedGlobals, 0, &d.OffsetExpression, ValueTypeI32); err != nil { + return fmt.Errorf("calculate offset: %w", err) + } + } + } + return nil +} + +func (m *Module) validateImports(enabledFeatures api.CoreFeatures) error { + for i := range m.ImportSection { + imp := &m.ImportSection[i] + if imp.Module == "" { + return fmt.Errorf("import[%d] has an empty module name", i) + } + switch imp.Type { + case ExternTypeFunc: + if int(imp.DescFunc) >= len(m.TypeSection) { + return fmt.Errorf("invalid import[%q.%q] function: type index out of range", imp.Module, imp.Name) + } + case ExternTypeGlobal: + if !imp.DescGlobal.Mutable { + continue + } + if err := enabledFeatures.RequireEnabled(api.CoreFeatureMutableGlobal); err != nil { + return fmt.Errorf("invalid import[%q.%q] global: %w", imp.Module, imp.Name, err) + } + } + } + return nil +} + +func (m *Module) validateExports(enabledFeatures api.CoreFeatures, functions []Index, globals []GlobalType, memory *Memory, tables []Table) error { + for i := range m.ExportSection { + exp := &m.ExportSection[i] + index := exp.Index + switch exp.Type { + case ExternTypeFunc: + if index >= uint32(len(functions)) { + return fmt.Errorf("unknown function for export[%q]", exp.Name) + } + case ExternTypeGlobal: + if index >= uint32(len(globals)) { + return fmt.Errorf("unknown global for export[%q]", exp.Name) + } + if !globals[index].Mutable { + continue + } + if err := enabledFeatures.RequireEnabled(api.CoreFeatureMutableGlobal); err != nil { + return fmt.Errorf("invalid export[%q] global[%d]: %w", exp.Name, index, err) + } + case ExternTypeMemory: + if index > 0 || memory == nil { + return fmt.Errorf("memory for export[%q] out of range", exp.Name) + } + case ExternTypeTable: + if index >= uint32(len(tables)) { + return fmt.Errorf("table for export[%q] out of range", exp.Name) + } + } + } + return nil +} + +func validateConstExpression(globals []GlobalType, numFuncs uint32, expr *ConstantExpression, expectedType ValueType) (err error) { + var actualType ValueType + switch expr.Opcode { + case OpcodeI32Const: + // Treat constants as signed as their interpretation is not yet known per /RATIONALE.md + _, _, err = leb128.LoadInt32(expr.Data) + if err != nil { + return fmt.Errorf("read i32: %w", err) + } + actualType = ValueTypeI32 + case OpcodeI64Const: + // Treat constants as signed as their interpretation is not yet known per /RATIONALE.md + _, _, err = leb128.LoadInt64(expr.Data) + if err != nil { + return fmt.Errorf("read i64: %w", err) + } + actualType = ValueTypeI64 + case OpcodeF32Const: + _, err = ieee754.DecodeFloat32(expr.Data) + if err != nil { + return fmt.Errorf("read f32: %w", err) + } + actualType = ValueTypeF32 + case OpcodeF64Const: + _, err = ieee754.DecodeFloat64(expr.Data) + if err != nil { + return fmt.Errorf("read f64: %w", err) + } + actualType = ValueTypeF64 + case OpcodeGlobalGet: + id, _, err := leb128.LoadUint32(expr.Data) + if err != nil { + return fmt.Errorf("read index of global: %w", err) + } + if uint32(len(globals)) <= id { + return fmt.Errorf("global index out of range") + } + actualType = globals[id].ValType + case OpcodeRefNull: + if len(expr.Data) == 0 { + return fmt.Errorf("read reference type for ref.null: %w", io.ErrShortBuffer) + } + reftype := expr.Data[0] + if reftype != RefTypeFuncref && reftype != RefTypeExternref { + return fmt.Errorf("invalid type for ref.null: 0x%x", reftype) + } + actualType = reftype + case OpcodeRefFunc: + index, _, err := leb128.LoadUint32(expr.Data) + if err != nil { + return fmt.Errorf("read i32: %w", err) + } else if index >= numFuncs { + return fmt.Errorf("ref.func index out of range [%d] with length %d", index, numFuncs-1) + } + actualType = ValueTypeFuncref + case OpcodeVecV128Const: + if len(expr.Data) != 16 { + return fmt.Errorf("%s needs 16 bytes but was %d bytes", OpcodeVecV128ConstName, len(expr.Data)) + } + actualType = ValueTypeV128 + default: + return fmt.Errorf("invalid opcode for const expression: 0x%x", expr.Opcode) + } + + if actualType != expectedType { + return fmt.Errorf("const expression type mismatch expected %s but got %s", + ValueTypeName(expectedType), ValueTypeName(actualType)) + } + return nil +} + +func (m *Module) validateDataCountSection() (err error) { + if m.DataCountSection != nil && int(*m.DataCountSection) != len(m.DataSection) { + err = fmt.Errorf("data count section (%d) doesn't match the length of data section (%d)", + *m.DataCountSection, len(m.DataSection)) + } + return +} + +func (m *ModuleInstance) buildGlobals(module *Module, funcRefResolver func(funcIndex Index) Reference) { + importedGlobals := m.Globals[:module.ImportGlobalCount] + + me := m.Engine + engineOwnGlobal := me.OwnsGlobals() + for i := Index(0); i < Index(len(module.GlobalSection)); i++ { + gs := &module.GlobalSection[i] + g := &GlobalInstance{} + if engineOwnGlobal { + g.Me = me + g.Index = i + module.ImportGlobalCount + } + m.Globals[i+module.ImportGlobalCount] = g + g.Type = gs.Type + g.initialize(importedGlobals, &gs.Init, funcRefResolver) + } +} + +func paramNames(localNames IndirectNameMap, funcIdx uint32, paramLen int) []string { + for i := range localNames { + nm := &localNames[i] + // Only build parameter names if we have one for each. + if nm.Index != funcIdx || len(nm.NameMap) < paramLen { + continue + } + + ret := make([]string, paramLen) + for j := range nm.NameMap { + p := &nm.NameMap[j] + if int(p.Index) < paramLen { + ret[p.Index] = p.Name + } + } + return ret + } + return nil +} + +func (m *ModuleInstance) buildMemory(module *Module) { + memSec := module.MemorySection + if memSec != nil { + m.MemoryInstance = NewMemoryInstance(memSec) + m.MemoryInstance.definition = &module.MemoryDefinitionSection[0] + } +} + +// Index is the offset in an index, not necessarily an absolute position in a Module section. This is because +// indexs are often preceded by a corresponding type in the Module.ImportSection. +// +// For example, the function index starts with any ExternTypeFunc in the Module.ImportSection followed by +// the Module.FunctionSection +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-index +type Index = uint32 + +// FunctionType is a possibly empty function signature. +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#function-types%E2%91%A0 +type FunctionType struct { + // Params are the possibly empty sequence of value types accepted by a function with this signature. + Params []ValueType + + // Results are the possibly empty sequence of value types returned by a function with this signature. + // + // Note: In WebAssembly 1.0 (20191205), there can be at most one result. + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#result-types%E2%91%A0 + Results []ValueType + + // string is cached as it is used both for String and key + string string + + // ParamNumInUint64 is the number of uint64 values requires to represent the Wasm param type. + ParamNumInUint64 int + + // ResultsNumInUint64 is the number of uint64 values requires to represent the Wasm result type. + ResultNumInUint64 int +} + +func (f *FunctionType) CacheNumInUint64() { + if f.ParamNumInUint64 == 0 { + for _, tp := range f.Params { + f.ParamNumInUint64++ + if tp == ValueTypeV128 { + f.ParamNumInUint64++ + } + } + } + + if f.ResultNumInUint64 == 0 { + for _, tp := range f.Results { + f.ResultNumInUint64++ + if tp == ValueTypeV128 { + f.ResultNumInUint64++ + } + } + } +} + +// EqualsSignature returns true if the function type has the same parameters and results. +func (f *FunctionType) EqualsSignature(params []ValueType, results []ValueType) bool { + return bytes.Equal(f.Params, params) && bytes.Equal(f.Results, results) +} + +// key gets or generates the key for Store.typeIDs. e.g. "i32_v" for one i32 parameter and no (void) result. +func (f *FunctionType) key() string { + if f.string != "" { + return f.string + } + var ret string + for _, b := range f.Params { + ret += ValueTypeName(b) + } + if len(f.Params) == 0 { + ret += "v_" + } else { + ret += "_" + } + for _, b := range f.Results { + ret += ValueTypeName(b) + } + if len(f.Results) == 0 { + ret += "v" + } + f.string = ret + return ret +} + +// String implements fmt.Stringer. +func (f *FunctionType) String() string { + return f.key() +} + +// Import is the binary representation of an import indicated by Type +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-import +type Import struct { + Type ExternType + // Module is the possibly empty primary namespace of this import + Module string + // Module is the possibly empty secondary namespace of this import + Name string + // DescFunc is the index in Module.TypeSection when Type equals ExternTypeFunc + DescFunc Index + // DescTable is the inlined Table when Type equals ExternTypeTable + DescTable Table + // DescMem is the inlined Memory when Type equals ExternTypeMemory + DescMem *Memory + // DescGlobal is the inlined GlobalType when Type equals ExternTypeGlobal + DescGlobal GlobalType + // IndexPerType has the index of this import per ExternType. + IndexPerType Index +} + +// Memory describes the limits of pages (64KB) in a memory. +type Memory struct { + Min, Cap, Max uint32 + // IsMaxEncoded true if the Max is encoded in the original binary. + IsMaxEncoded bool +} + +// Validate ensures values assigned to Min, Cap and Max are within valid thresholds. +func (m *Memory) Validate(memoryLimitPages uint32) error { + min, capacity, max := m.Min, m.Cap, m.Max + + if max > memoryLimitPages { + return fmt.Errorf("max %d pages (%s) over limit of %d pages (%s)", + max, PagesToUnitOfBytes(max), memoryLimitPages, PagesToUnitOfBytes(memoryLimitPages)) + } else if min > memoryLimitPages { + return fmt.Errorf("min %d pages (%s) over limit of %d pages (%s)", + min, PagesToUnitOfBytes(min), memoryLimitPages, PagesToUnitOfBytes(memoryLimitPages)) + } else if min > max { + return fmt.Errorf("min %d pages (%s) > max %d pages (%s)", + min, PagesToUnitOfBytes(min), max, PagesToUnitOfBytes(max)) + } else if capacity < min { + return fmt.Errorf("capacity %d pages (%s) less than minimum %d pages (%s)", + capacity, PagesToUnitOfBytes(capacity), min, PagesToUnitOfBytes(min)) + } else if capacity > memoryLimitPages { + return fmt.Errorf("capacity %d pages (%s) over limit of %d pages (%s)", + capacity, PagesToUnitOfBytes(capacity), memoryLimitPages, PagesToUnitOfBytes(memoryLimitPages)) + } + return nil +} + +type GlobalType struct { + ValType ValueType + Mutable bool +} + +type Global struct { + Type GlobalType + Init ConstantExpression +} + +type ConstantExpression struct { + Opcode Opcode + Data []byte +} + +// Export is the binary representation of an export indicated by Type +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-export +type Export struct { + Type ExternType + + // Name is what the host refers to this definition as. + Name string + + // Index is the index of the definition to export, the index is by Type + // e.g. If ExternTypeFunc, this is a position in the function index. + Index Index +} + +// Code is an entry in the Module.CodeSection containing the locals and body of the function. +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-code +type Code struct { + // LocalTypes are any function-scoped variables in insertion order. + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-local + LocalTypes []ValueType + + // Body is a sequence of expressions ending in OpcodeEnd + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-expr + Body []byte + + // GoFunc is non-nil when IsHostFunction and defined in go, either + // api.GoFunction or api.GoModuleFunction. When present, LocalTypes and Body must + // be nil. + // + // Note: This has no serialization format, so is not encodable. + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#host-functions%E2%91%A2 + GoFunc interface{} + + // BodyOffsetInCodeSection is the offset of the beginning of the body in the code section. + // This is used for DWARF based stack trace where a program counter represents an offset in code section. + BodyOffsetInCodeSection uint64 +} + +type DataSegment struct { + OffsetExpression ConstantExpression + Init []byte + Passive bool +} + +// IsPassive returns true if this data segment is "passive" in the sense that memory offset and +// index is determined at runtime and used by OpcodeMemoryInitName instruction in the bulk memory +// operations proposal. +// +// See https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/appendix/changes.html#bulk-memory-and-table-instructions +func (d *DataSegment) IsPassive() bool { + return d.Passive +} + +// NameSection represent the known custom name subsections defined in the WebAssembly Binary Format +// +// Note: This can be nil if no names were decoded for any reason including configuration. +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#name-section%E2%91%A0 +type NameSection struct { + // ModuleName is the symbolic identifier for a module. e.g. math + // + // Note: This can be empty for any reason including configuration. + ModuleName string + + // FunctionNames is an association of a function index to its symbolic identifier. e.g. add + // + // * the key (idx) is in the function index, where module defined functions are preceded by imported ones. + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#functions%E2%91%A7 + // + // For example, assuming the below text format is the second import, you would expect FunctionNames[1] = "mul" + // (import "Math" "Mul" (func $mul (param $x f32) (param $y f32) (result f32))) + // + // Note: FunctionNames are only used for debugging. At runtime, functions are called based on raw numeric index. + // Note: This can be nil for any reason including configuration. + FunctionNames NameMap + + // LocalNames contains symbolic names for function parameters or locals that have one. + // + // Note: In the Text Format, function local names can inherit parameter + // names from their type. Here are some examples: + // * (module (import (func (param $x i32) (param i32))) (func (type 0))) = [{0, {x,0}}] + // * (module (import (func (param i32) (param $y i32))) (func (type 0) (local $z i32))) = [0, [{y,1},{z,2}]] + // * (module (func (param $x i32) (local $y i32) (local $z i32))) = [{x,0},{y,1},{z,2}] + // + // Note: LocalNames are only used for debugging. At runtime, locals are called based on raw numeric index. + // Note: This can be nil for any reason including configuration. + LocalNames IndirectNameMap + + // ResultNames is a wazero-specific mechanism to store result names. + ResultNames IndirectNameMap +} + +// CustomSection contains the name and raw data of a custom section. +type CustomSection struct { + Name string + Data []byte +} + +// NameMap associates an index with any associated names. +// +// Note: Often the index bridges multiple sections. For example, the function index starts with any +// ExternTypeFunc in the Module.ImportSection followed by the Module.FunctionSection +// +// Note: NameMap is unique by NameAssoc.Index, but NameAssoc.Name needn't be unique. +// Note: When encoding in the Binary format, this must be ordered by NameAssoc.Index +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-namemap +type NameMap []NameAssoc + +type NameAssoc struct { + Index Index + Name string +} + +// IndirectNameMap associates an index with an association of names. +// +// Note: IndirectNameMap is unique by NameMapAssoc.Index, but NameMapAssoc.NameMap needn't be unique. +// Note: When encoding in the Binary format, this must be ordered by NameMapAssoc.Index +// https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-indirectnamemap +type IndirectNameMap []NameMapAssoc + +type NameMapAssoc struct { + Index Index + NameMap NameMap +} + +// AllDeclarations returns all declarations for functions, globals, memories and tables in a module including imported ones. +func (m *Module) AllDeclarations() (functions []Index, globals []GlobalType, memory *Memory, tables []Table, err error) { + for i := range m.ImportSection { + imp := &m.ImportSection[i] + switch imp.Type { + case ExternTypeFunc: + functions = append(functions, imp.DescFunc) + case ExternTypeGlobal: + globals = append(globals, imp.DescGlobal) + case ExternTypeMemory: + memory = imp.DescMem + case ExternTypeTable: + tables = append(tables, imp.DescTable) + } + } + + functions = append(functions, m.FunctionSection...) + for i := range m.GlobalSection { + g := &m.GlobalSection[i] + globals = append(globals, g.Type) + } + if m.MemorySection != nil { + if memory != nil { // shouldn't be possible due to Validate + err = errors.New("at most one table allowed in module") + return + } + memory = m.MemorySection + } + if m.TableSection != nil { + tables = append(tables, m.TableSection...) + } + return +} + +// SectionID identifies the sections of a Module in the WebAssembly 1.0 (20191205) Binary Format. +// +// Note: these are defined in the wasm package, instead of the binary package, as a key per section is needed regardless +// of format, and deferring to the binary type avoids confusion. +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#sections%E2%91%A0 +type SectionID = byte + +const ( + // SectionIDCustom includes the standard defined NameSection and possibly others not defined in the standard. + SectionIDCustom SectionID = iota // don't add anything not in https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#sections%E2%91%A0 + SectionIDType + SectionIDImport + SectionIDFunction + SectionIDTable + SectionIDMemory + SectionIDGlobal + SectionIDExport + SectionIDStart + SectionIDElement + SectionIDCode + SectionIDData + + // SectionIDDataCount may exist in WebAssembly 2.0 or WebAssembly 1.0 with CoreFeatureBulkMemoryOperations enabled. + // + // See https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/binary/modules.html#data-count-section + // See https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/appendix/changes.html#bulk-memory-and-table-instructions + SectionIDDataCount +) + +// SectionIDName returns the canonical name of a module section. +// https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#sections%E2%91%A0 +func SectionIDName(sectionID SectionID) string { + switch sectionID { + case SectionIDCustom: + return "custom" + case SectionIDType: + return "type" + case SectionIDImport: + return "import" + case SectionIDFunction: + return "function" + case SectionIDTable: + return "table" + case SectionIDMemory: + return "memory" + case SectionIDGlobal: + return "global" + case SectionIDExport: + return "export" + case SectionIDStart: + return "start" + case SectionIDElement: + return "element" + case SectionIDCode: + return "code" + case SectionIDData: + return "data" + case SectionIDDataCount: + return "data_count" + } + return "unknown" +} + +// ValueType is an alias of api.ValueType defined to simplify imports. +type ValueType = api.ValueType + +const ( + ValueTypeI32 = api.ValueTypeI32 + ValueTypeI64 = api.ValueTypeI64 + ValueTypeF32 = api.ValueTypeF32 + ValueTypeF64 = api.ValueTypeF64 + // TODO: ValueTypeV128 is not exposed in the api pkg yet. + ValueTypeV128 ValueType = 0x7b + // TODO: ValueTypeFuncref is not exposed in the api pkg yet. + ValueTypeFuncref ValueType = 0x70 + ValueTypeExternref = api.ValueTypeExternref +) + +// ValueTypeName is an alias of api.ValueTypeName defined to simplify imports. +func ValueTypeName(t ValueType) string { + if t == ValueTypeFuncref { + return "funcref" + } else if t == ValueTypeV128 { + return "v128" + } + return api.ValueTypeName(t) +} + +func isReferenceValueType(vt ValueType) bool { + return vt == ValueTypeExternref || vt == ValueTypeFuncref +} + +// ExternType is an alias of api.ExternType defined to simplify imports. +type ExternType = api.ExternType + +const ( + ExternTypeFunc = api.ExternTypeFunc + ExternTypeFuncName = api.ExternTypeFuncName + ExternTypeTable = api.ExternTypeTable + ExternTypeTableName = api.ExternTypeTableName + ExternTypeMemory = api.ExternTypeMemory + ExternTypeMemoryName = api.ExternTypeMemoryName + ExternTypeGlobal = api.ExternTypeGlobal + ExternTypeGlobalName = api.ExternTypeGlobalName +) + +// ExternTypeName is an alias of api.ExternTypeName defined to simplify imports. +func ExternTypeName(t ValueType) string { + return api.ExternTypeName(t) +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/module_instance.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/module_instance.go new file mode 100644 index 000000000..ea313e134 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/module_instance.go @@ -0,0 +1,247 @@ +package wasm + +import ( + "context" + "errors" + "fmt" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/sys" +) + +// FailIfClosed returns a sys.ExitError if CloseWithExitCode was called. +func (m *ModuleInstance) FailIfClosed() (err error) { + if closed := m.Closed.Load(); closed != 0 { + switch closed & exitCodeFlagMask { + case exitCodeFlagResourceClosed: + case exitCodeFlagResourceNotClosed: + // This happens when this module is closed asynchronously in CloseModuleOnCanceledOrTimeout, + // and the closure of resources have been deferred here. + _ = m.ensureResourcesClosed(context.Background()) + } + return sys.NewExitError(uint32(closed >> 32)) // Unpack the high order bits as the exit code. + } + return nil +} + +// CloseModuleOnCanceledOrTimeout take a context `ctx`, which might be a Cancel or Timeout context, +// and spawns the Goroutine to check the context is canceled ot deadline exceeded. If it reaches +// one of the conditions, it sets the appropriate exit code. +// +// Callers of this function must invoke the returned context.CancelFunc to release the spawned Goroutine. +func (m *ModuleInstance) CloseModuleOnCanceledOrTimeout(ctx context.Context) context.CancelFunc { + // Creating an empty channel in this case is a bit more efficient than + // creating a context.Context and canceling it with the same effect. We + // really just need to be notified when to stop listening to the users + // context. Closing the channel will unblock the select in the goroutine + // causing it to return an stop listening to ctx.Done(). + cancelChan := make(chan struct{}) + go m.closeModuleOnCanceledOrTimeout(ctx, cancelChan) + return func() { close(cancelChan) } +} + +// closeModuleOnCanceledOrTimeout is extracted from CloseModuleOnCanceledOrTimeout for testing. +func (m *ModuleInstance) closeModuleOnCanceledOrTimeout(ctx context.Context, cancelChan <-chan struct{}) { + select { + case <-ctx.Done(): + select { + case <-cancelChan: + // In some cases by the time this goroutine is scheduled, the caller + // has already closed both the context and the cancelChan. In this + // case go will randomize which branch of the outer select to enter + // and we don't want to close the module. + default: + // This is the same logic as CloseWithCtxErr except this calls closeWithExitCodeWithoutClosingResource + // so that we can defer the resource closure in FailIfClosed. + switch { + case errors.Is(ctx.Err(), context.Canceled): + // TODO: figure out how to report error here. + _ = m.closeWithExitCodeWithoutClosingResource(sys.ExitCodeContextCanceled) + case errors.Is(ctx.Err(), context.DeadlineExceeded): + // TODO: figure out how to report error here. + _ = m.closeWithExitCodeWithoutClosingResource(sys.ExitCodeDeadlineExceeded) + } + } + case <-cancelChan: + } +} + +// CloseWithCtxErr closes the module with an exit code based on the type of +// error reported by the context. +// +// If the context's error is unknown or nil, the module does not close. +func (m *ModuleInstance) CloseWithCtxErr(ctx context.Context) { + switch { + case errors.Is(ctx.Err(), context.Canceled): + // TODO: figure out how to report error here. + _ = m.CloseWithExitCode(ctx, sys.ExitCodeContextCanceled) + case errors.Is(ctx.Err(), context.DeadlineExceeded): + // TODO: figure out how to report error here. + _ = m.CloseWithExitCode(ctx, sys.ExitCodeDeadlineExceeded) + } +} + +// Name implements the same method as documented on api.Module +func (m *ModuleInstance) Name() string { + return m.ModuleName +} + +// String implements the same method as documented on api.Module +func (m *ModuleInstance) String() string { + return fmt.Sprintf("Module[%s]", m.Name()) +} + +// Close implements the same method as documented on api.Module. +func (m *ModuleInstance) Close(ctx context.Context) (err error) { + return m.CloseWithExitCode(ctx, 0) +} + +// CloseWithExitCode implements the same method as documented on api.Module. +func (m *ModuleInstance) CloseWithExitCode(ctx context.Context, exitCode uint32) (err error) { + if !m.setExitCode(exitCode, exitCodeFlagResourceClosed) { + return nil // not an error to have already closed + } + _ = m.s.deleteModule(m) + return m.ensureResourcesClosed(ctx) +} + +// IsClosed implements the same method as documented on api.Module. +func (m *ModuleInstance) IsClosed() bool { + return m.Closed.Load() != 0 +} + +func (m *ModuleInstance) closeWithExitCodeWithoutClosingResource(exitCode uint32) (err error) { + if !m.setExitCode(exitCode, exitCodeFlagResourceNotClosed) { + return nil // not an error to have already closed + } + _ = m.s.deleteModule(m) + return nil +} + +// closeWithExitCode is the same as CloseWithExitCode besides this doesn't delete it from Store.moduleList. +func (m *ModuleInstance) closeWithExitCode(ctx context.Context, exitCode uint32) (err error) { + if !m.setExitCode(exitCode, exitCodeFlagResourceClosed) { + return nil // not an error to have already closed + } + return m.ensureResourcesClosed(ctx) +} + +type exitCodeFlag = uint64 + +const exitCodeFlagMask = 0xff + +const ( + // exitCodeFlagResourceClosed indicates that the module was closed and resources were already closed. + exitCodeFlagResourceClosed = 1 << iota + // exitCodeFlagResourceNotClosed indicates that the module was closed while resources are not closed yet. + exitCodeFlagResourceNotClosed +) + +func (m *ModuleInstance) setExitCode(exitCode uint32, flag exitCodeFlag) bool { + closed := flag | uint64(exitCode)<<32 // Store exitCode as high-order bits. + return m.Closed.CompareAndSwap(0, closed) +} + +// ensureResourcesClosed ensures that resources assigned to ModuleInstance is released. +// Only one call will happen per module, due to external atomic guards on Closed. +func (m *ModuleInstance) ensureResourcesClosed(ctx context.Context) (err error) { + if closeNotifier := m.CloseNotifier; closeNotifier != nil { // experimental + closeNotifier.CloseNotify(ctx, uint32(m.Closed.Load()>>32)) + m.CloseNotifier = nil + } + + if sysCtx := m.Sys; sysCtx != nil { // nil if from HostModuleBuilder + if err = sysCtx.FS().Close(); err != nil { + return err + } + m.Sys = nil + } + + if m.CodeCloser == nil { + return + } + if e := m.CodeCloser.Close(ctx); e != nil && err == nil { + err = e + } + m.CodeCloser = nil + return +} + +// Memory implements the same method as documented on api.Module. +func (m *ModuleInstance) Memory() api.Memory { + return m.MemoryInstance +} + +// ExportedMemory implements the same method as documented on api.Module. +func (m *ModuleInstance) ExportedMemory(name string) api.Memory { + _, err := m.getExport(name, ExternTypeMemory) + if err != nil { + return nil + } + // We Assume that we have at most one memory. + return m.MemoryInstance +} + +// ExportedMemoryDefinitions implements the same method as documented on +// api.Module. +func (m *ModuleInstance) ExportedMemoryDefinitions() map[string]api.MemoryDefinition { + // Special case as we currently only support one memory. + if mem := m.MemoryInstance; mem != nil { + // Now, find out if it is exported + for name, exp := range m.Exports { + if exp.Type == ExternTypeMemory { + return map[string]api.MemoryDefinition{name: mem.definition} + } + } + } + return map[string]api.MemoryDefinition{} +} + +// ExportedFunction implements the same method as documented on api.Module. +func (m *ModuleInstance) ExportedFunction(name string) api.Function { + exp, err := m.getExport(name, ExternTypeFunc) + if err != nil { + return nil + } + return m.Engine.NewFunction(exp.Index) +} + +// ExportedFunctionDefinitions implements the same method as documented on +// api.Module. +func (m *ModuleInstance) ExportedFunctionDefinitions() map[string]api.FunctionDefinition { + result := map[string]api.FunctionDefinition{} + for name, exp := range m.Exports { + if exp.Type == ExternTypeFunc { + result[name] = m.Source.FunctionDefinition(exp.Index) + } + } + return result +} + +// GlobalVal is an internal hack to get the lower 64 bits of a global. +func (m *ModuleInstance) GlobalVal(idx Index) uint64 { + return m.Globals[idx].Val +} + +// ExportedGlobal implements the same method as documented on api.Module. +func (m *ModuleInstance) ExportedGlobal(name string) api.Global { + exp, err := m.getExport(name, ExternTypeGlobal) + if err != nil { + return nil + } + g := m.Globals[exp.Index] + if g.Type.Mutable { + return mutableGlobal{g: g} + } + return constantGlobal{g: g} +} + +// NumGlobal implements experimental.InternalModule. +func (m *ModuleInstance) NumGlobal() int { + return len(m.Globals) +} + +// Global implements experimental.InternalModule. +func (m *ModuleInstance) Global(idx int) api.Global { + return constantGlobal{g: m.Globals[idx]} +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/module_instance_lookup.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/module_instance_lookup.go new file mode 100644 index 000000000..442d26a22 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/module_instance_lookup.go @@ -0,0 +1,73 @@ +package wasm + +import ( + "context" + "fmt" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/internalapi" +) + +// LookupFunction looks up the table by the given index, and returns the api.Function implementation if found, +// otherwise this panics according to the same semantics as call_indirect instruction. +// Currently, this is only used by emscripten which needs to do call_indirect-like operation in the host function. +func (m *ModuleInstance) LookupFunction(t *TableInstance, typeId FunctionTypeID, tableOffset Index) api.Function { + fm, index := m.Engine.LookupFunction(t, typeId, tableOffset) + if source := fm.Source; source.IsHostModule { + // This case, the found function is a host function stored in the table. Generally, Engine.NewFunction are only + // responsible for calling Wasm-defined functions (not designed for calling Go functions!). Hence we need to wrap + // the host function as a special case. + def := &source.FunctionDefinitionSection[index] + goF := source.CodeSection[index].GoFunc + switch typed := goF.(type) { + case api.GoFunction: + // GoFunction doesn't need looked up module. + return &lookedUpGoFunction{def: def, g: goFunctionAsGoModuleFunction(typed)} + case api.GoModuleFunction: + return &lookedUpGoFunction{def: def, lookedUpModule: m, g: typed} + default: + panic(fmt.Sprintf("unexpected GoFunc type: %T", goF)) + } + } else { + return fm.Engine.NewFunction(index) + } +} + +// lookedUpGoFunction implements lookedUpGoModuleFunction. +type lookedUpGoFunction struct { + internalapi.WazeroOnly + def *FunctionDefinition + // lookedUpModule is the *ModuleInstance from which this Go function is looked up, i.e. owner of the table. + lookedUpModule *ModuleInstance + g api.GoModuleFunction +} + +// goFunctionAsGoModuleFunction converts api.GoFunction to api.GoModuleFunction which ignores the api.Module argument. +func goFunctionAsGoModuleFunction(g api.GoFunction) api.GoModuleFunction { + return api.GoModuleFunc(func(ctx context.Context, _ api.Module, stack []uint64) { + g.Call(ctx, stack) + }) +} + +// Definition implements api.Function. +func (l *lookedUpGoFunction) Definition() api.FunctionDefinition { return l.def } + +// Call implements api.Function. +func (l *lookedUpGoFunction) Call(ctx context.Context, params ...uint64) ([]uint64, error) { + typ := l.def.Functype + stackSize := typ.ParamNumInUint64 + rn := typ.ResultNumInUint64 + if rn > stackSize { + stackSize = rn + } + stack := make([]uint64, stackSize) + copy(stack, params) + return stack[:rn], l.CallWithStack(ctx, stack) +} + +// CallWithStack implements api.Function. +func (l *lookedUpGoFunction) CallWithStack(ctx context.Context, stack []uint64) error { + // The Go host function always needs to access caller's module, in this case the one holding the table. + l.g.Call(ctx, l.lookedUpModule, stack) + return nil +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/store.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/store.go new file mode 100644 index 000000000..e6ae75cca --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/store.go @@ -0,0 +1,641 @@ +package wasm + +import ( + "context" + "encoding/binary" + "fmt" + "sync" + "sync/atomic" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/close" + "github.com/tetratelabs/wazero/internal/internalapi" + "github.com/tetratelabs/wazero/internal/leb128" + internalsys "github.com/tetratelabs/wazero/internal/sys" + "github.com/tetratelabs/wazero/sys" +) + +// nameToModuleShrinkThreshold is the size the nameToModule map can grow to +// before it starts to be monitored for shrinking. +// The capacity will never be smaller than this once the threshold is met. +const nameToModuleShrinkThreshold = 100 + +type ( + // Store is the runtime representation of "instantiated" Wasm module and objects. + // Multiple modules can be instantiated within a single store, and each instance, + // (e.g. function instance) can be referenced by other module instances in a Store via Module.ImportSection. + // + // Every type whose name ends with "Instance" suffix belongs to exactly one store. + // + // Note that store is not thread (concurrency) safe, meaning that using single Store + // via multiple goroutines might result in race conditions. In that case, the invocation + // and access to any methods and field of Store must be guarded by mutex. + // + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#store%E2%91%A0 + Store struct { + // moduleList ensures modules are closed in reverse initialization order. + moduleList *ModuleInstance // guarded by mux + + // nameToModule holds the instantiated Wasm modules by module name from Instantiate. + // It ensures no race conditions instantiating two modules of the same name. + nameToModule map[string]*ModuleInstance // guarded by mux + + // nameToModuleCap tracks the growth of the nameToModule map in order to + // track when to shrink it. + nameToModuleCap int // guarded by mux + + // EnabledFeatures are read-only to allow optimizations. + EnabledFeatures api.CoreFeatures + + // Engine is a global context for a Store which is in responsible for compilation and execution of Wasm modules. + Engine Engine + + // typeIDs maps each FunctionType.String() to a unique FunctionTypeID. This is used at runtime to + // do type-checks on indirect function calls. + typeIDs map[string]FunctionTypeID + + // functionMaxTypes represents the limit on the number of function types in a store. + // Note: this is fixed to 2^27 but have this a field for testability. + functionMaxTypes uint32 + + // mux is used to guard the fields from concurrent access. + mux sync.RWMutex + } + + // ModuleInstance represents instantiated wasm module. + // The difference from the spec is that in wazero, a ModuleInstance holds pointers + // to the instances, rather than "addresses" (i.e. index to Store.Functions, Globals, etc) for convenience. + // + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#syntax-moduleinst + // + // This implements api.Module. + ModuleInstance struct { + internalapi.WazeroOnlyType + + ModuleName string + Exports map[string]*Export + Globals []*GlobalInstance + MemoryInstance *MemoryInstance + Tables []*TableInstance + + // Engine implements function calls for this module. + Engine ModuleEngine + + // TypeIDs is index-correlated with types and holds typeIDs which is uniquely assigned to a type by store. + // This is necessary to achieve fast runtime type checking for indirect function calls at runtime. + TypeIDs []FunctionTypeID + + // DataInstances holds data segments bytes of the module. + // This is only used by bulk memory operations. + // + // https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/runtime.html#data-instances + DataInstances []DataInstance + + // ElementInstances holds the element instance, and each holds the references to either functions + // or external objects (unimplemented). + ElementInstances []ElementInstance + + // Sys is exposed for use in special imports such as WASI, assemblyscript + // and gojs. + // + // # Notes + // + // - This is a part of ModuleInstance so that scope and Close is coherent. + // - This is not exposed outside this repository (as a host function + // parameter) because we haven't thought through capabilities based + // security implications. + Sys *internalsys.Context + + // Closed is used both to guard moduleEngine.CloseWithExitCode and to store the exit code. + // + // The update value is closedType + exitCode << 32. This ensures an exit code of zero isn't mistaken for never closed. + // + // Note: Exclusively reading and updating this with atomics guarantees cross-goroutine observations. + // See /RATIONALE.md + Closed atomic.Uint64 + + // CodeCloser is non-nil when the code should be closed after this module. + CodeCloser api.Closer + + // s is the Store on which this module is instantiated. + s *Store + // prev and next hold the nodes in the linked list of ModuleInstance held by Store. + prev, next *ModuleInstance + // Source is a pointer to the Module from which this ModuleInstance derives. + Source *Module + + // CloseNotifier is an experimental hook called once on close. + CloseNotifier close.Notifier + } + + // DataInstance holds bytes corresponding to the data segment in a module. + // + // https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/runtime.html#data-instances + DataInstance = []byte + + // GlobalInstance represents a global instance in a store. + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#global-instances%E2%91%A0 + GlobalInstance struct { + Type GlobalType + // Val holds a 64-bit representation of the actual value. + // If me is non-nil, the value will not be updated and the current value is stored in the module engine. + Val uint64 + // ValHi is only used for vector type globals, and holds the higher bits of the vector. + // If me is non-nil, the value will not be updated and the current value is stored in the module engine. + ValHi uint64 + // Me is the module engine that owns this global instance. + // The .Val and .ValHi fields are only valid when me is nil. + // If me is non-nil, the value is stored in the module engine. + Me ModuleEngine + Index Index + } + + // FunctionTypeID is a uniquely assigned integer for a function type. + // This is wazero specific runtime object and specific to a store, + // and used at runtime to do type-checks on indirect function calls. + FunctionTypeID uint32 +) + +// The wazero specific limitations described at RATIONALE.md. +const maximumFunctionTypes = 1 << 27 + +// GetFunctionTypeID is used by emscripten. +func (m *ModuleInstance) GetFunctionTypeID(t *FunctionType) FunctionTypeID { + id, err := m.s.GetFunctionTypeID(t) + if err != nil { + // This is not recoverable in practice since the only error GetFunctionTypeID returns is + // when there's too many function types in the store. + panic(err) + } + return id +} + +func (m *ModuleInstance) buildElementInstances(elements []ElementSegment) { + m.ElementInstances = make([][]Reference, len(elements)) + for i, elm := range elements { + if elm.Type == RefTypeFuncref && elm.Mode == ElementModePassive { + // Only passive elements can be access as element instances. + // See https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/syntax/modules.html#element-segments + inits := elm.Init + inst := make([]Reference, len(inits)) + m.ElementInstances[i] = inst + for j, idx := range inits { + if idx != ElementInitNullReference { + inst[j] = m.Engine.FunctionInstanceReference(idx) + } + } + } + } +} + +func (m *ModuleInstance) applyElements(elems []ElementSegment) { + for elemI := range elems { + elem := &elems[elemI] + if !elem.IsActive() || + // Per https://github.com/WebAssembly/spec/issues/1427 init can be no-op. + len(elem.Init) == 0 { + continue + } + var offset uint32 + if elem.OffsetExpr.Opcode == OpcodeGlobalGet { + // Ignore error as it's already validated. + globalIdx, _, _ := leb128.LoadUint32(elem.OffsetExpr.Data) + global := m.Globals[globalIdx] + offset = uint32(global.Val) + } else { + // Ignore error as it's already validated. + o, _, _ := leb128.LoadInt32(elem.OffsetExpr.Data) + offset = uint32(o) + } + + table := m.Tables[elem.TableIndex] + references := table.References + if int(offset)+len(elem.Init) > len(references) { + // ErrElementOffsetOutOfBounds is the error raised when the active element offset exceeds the table length. + // Before CoreFeatureReferenceTypes, this was checked statically before instantiation, after the proposal, + // this must be raised as runtime error (as in assert_trap in spectest), not even an instantiation error. + // https://github.com/WebAssembly/spec/blob/d39195773112a22b245ffbe864bab6d1182ccb06/test/core/linking.wast#L264-L274 + // + // In wazero, we ignore it since in any way, the instantiated module and engines are fine and can be used + // for function invocations. + return + } + + if table.Type == RefTypeExternref { + for i := 0; i < len(elem.Init); i++ { + references[offset+uint32(i)] = Reference(0) + } + } else { + for i, init := range elem.Init { + if init == ElementInitNullReference { + continue + } + + var ref Reference + if index, ok := unwrapElementInitGlobalReference(init); ok { + global := m.Globals[index] + ref = Reference(global.Val) + } else { + ref = m.Engine.FunctionInstanceReference(index) + } + references[offset+uint32(i)] = ref + } + } + } +} + +// validateData ensures that data segments are valid in terms of memory boundary. +// Note: this is used only when bulk-memory/reference type feature is disabled. +func (m *ModuleInstance) validateData(data []DataSegment) (err error) { + for i := range data { + d := &data[i] + if !d.IsPassive() { + offset := int(executeConstExpressionI32(m.Globals, &d.OffsetExpression)) + ceil := offset + len(d.Init) + if offset < 0 || ceil > len(m.MemoryInstance.Buffer) { + return fmt.Errorf("%s[%d]: out of bounds memory access", SectionIDName(SectionIDData), i) + } + } + } + return +} + +// applyData uses the given data segments and mutate the memory according to the initial contents on it +// and populate the `DataInstances`. This is called after all the validation phase passes and out of +// bounds memory access error here is not a validation error, but rather a runtime error. +func (m *ModuleInstance) applyData(data []DataSegment) error { + m.DataInstances = make([][]byte, len(data)) + for i := range data { + d := &data[i] + m.DataInstances[i] = d.Init + if !d.IsPassive() { + offset := executeConstExpressionI32(m.Globals, &d.OffsetExpression) + if offset < 0 || int(offset)+len(d.Init) > len(m.MemoryInstance.Buffer) { + return fmt.Errorf("%s[%d]: out of bounds memory access", SectionIDName(SectionIDData), i) + } + copy(m.MemoryInstance.Buffer[offset:], d.Init) + } + } + return nil +} + +// GetExport returns an export of the given name and type or errs if not exported or the wrong type. +func (m *ModuleInstance) getExport(name string, et ExternType) (*Export, error) { + exp, ok := m.Exports[name] + if !ok { + return nil, fmt.Errorf("%q is not exported in module %q", name, m.ModuleName) + } + if exp.Type != et { + return nil, fmt.Errorf("export %q in module %q is a %s, not a %s", name, m.ModuleName, ExternTypeName(exp.Type), ExternTypeName(et)) + } + return exp, nil +} + +func NewStore(enabledFeatures api.CoreFeatures, engine Engine) *Store { + return &Store{ + nameToModule: map[string]*ModuleInstance{}, + nameToModuleCap: nameToModuleShrinkThreshold, + EnabledFeatures: enabledFeatures, + Engine: engine, + typeIDs: map[string]FunctionTypeID{}, + functionMaxTypes: maximumFunctionTypes, + } +} + +// Instantiate uses name instead of the Module.NameSection ModuleName as it allows instantiating the same module under +// different names safely and concurrently. +// +// * ctx: the default context used for function calls. +// * name: the name of the module. +// * sys: the system context, which will be closed (SysContext.Close) on ModuleInstance.Close. +// +// Note: Module.Validate must be called prior to instantiation. +func (s *Store) Instantiate( + ctx context.Context, + module *Module, + name string, + sys *internalsys.Context, + typeIDs []FunctionTypeID, +) (*ModuleInstance, error) { + // Instantiate the module and add it to the store so that other modules can import it. + m, err := s.instantiate(ctx, module, name, sys, typeIDs) + if err != nil { + return nil, err + } + + // Now that the instantiation is complete without error, add it. + if err = s.registerModule(m); err != nil { + _ = m.Close(ctx) + return nil, err + } + return m, nil +} + +func (s *Store) instantiate( + ctx context.Context, + module *Module, + name string, + sysCtx *internalsys.Context, + typeIDs []FunctionTypeID, +) (m *ModuleInstance, err error) { + m = &ModuleInstance{ModuleName: name, TypeIDs: typeIDs, Sys: sysCtx, s: s, Source: module} + + m.Tables = make([]*TableInstance, int(module.ImportTableCount)+len(module.TableSection)) + m.Globals = make([]*GlobalInstance, int(module.ImportGlobalCount)+len(module.GlobalSection)) + m.Engine, err = s.Engine.NewModuleEngine(module, m) + if err != nil { + return nil, err + } + + if err = m.resolveImports(module); err != nil { + return nil, err + } + + err = m.buildTables(module, + // As of reference-types proposal, boundary check must be done after instantiation. + s.EnabledFeatures.IsEnabled(api.CoreFeatureReferenceTypes)) + if err != nil { + return nil, err + } + + m.buildGlobals(module, m.Engine.FunctionInstanceReference) + m.buildMemory(module) + m.Exports = module.Exports + + // As of reference types proposal, data segment validation must happen after instantiation, + // and the side effect must persist even if there's out of bounds error after instantiation. + // https://github.com/WebAssembly/spec/blob/d39195773112a22b245ffbe864bab6d1182ccb06/test/core/linking.wast#L395-L405 + if !s.EnabledFeatures.IsEnabled(api.CoreFeatureReferenceTypes) { + if err = m.validateData(module.DataSection); err != nil { + return nil, err + } + } + + // After engine creation, we can create the funcref element instances and initialize funcref type globals. + m.buildElementInstances(module.ElementSection) + + // Now all the validation passes, we are safe to mutate memory instances (possibly imported ones). + if err = m.applyData(module.DataSection); err != nil { + return nil, err + } + + m.applyElements(module.ElementSection) + + m.Engine.DoneInstantiation() + + // Execute the start function. + if module.StartSection != nil { + funcIdx := *module.StartSection + ce := m.Engine.NewFunction(funcIdx) + _, err = ce.Call(ctx) + if exitErr, ok := err.(*sys.ExitError); ok { // Don't wrap an exit error! + return nil, exitErr + } else if err != nil { + return nil, fmt.Errorf("start %s failed: %w", module.funcDesc(SectionIDFunction, funcIdx), err) + } + } + return +} + +func (m *ModuleInstance) resolveImports(module *Module) (err error) { + for moduleName, imports := range module.ImportPerModule { + var importedModule *ModuleInstance + importedModule, err = m.s.module(moduleName) + if err != nil { + return err + } + + for _, i := range imports { + var imported *Export + imported, err = importedModule.getExport(i.Name, i.Type) + if err != nil { + return + } + + switch i.Type { + case ExternTypeFunc: + expectedType := &module.TypeSection[i.DescFunc] + src := importedModule.Source + actual := src.typeOfFunction(imported.Index) + if !actual.EqualsSignature(expectedType.Params, expectedType.Results) { + err = errorInvalidImport(i, fmt.Errorf("signature mismatch: %s != %s", expectedType, actual)) + return + } + + m.Engine.ResolveImportedFunction(i.IndexPerType, imported.Index, importedModule.Engine) + case ExternTypeTable: + expected := i.DescTable + importedTable := importedModule.Tables[imported.Index] + if expected.Type != importedTable.Type { + err = errorInvalidImport(i, fmt.Errorf("table type mismatch: %s != %s", + RefTypeName(expected.Type), RefTypeName(importedTable.Type))) + return + } + + if expected.Min > importedTable.Min { + err = errorMinSizeMismatch(i, expected.Min, importedTable.Min) + return + } + + if expected.Max != nil { + expectedMax := *expected.Max + if importedTable.Max == nil { + err = errorNoMax(i, expectedMax) + return + } else if expectedMax < *importedTable.Max { + err = errorMaxSizeMismatch(i, expectedMax, *importedTable.Max) + return + } + } + m.Tables[i.IndexPerType] = importedTable + case ExternTypeMemory: + expected := i.DescMem + importedMemory := importedModule.MemoryInstance + + if expected.Min > memoryBytesNumToPages(uint64(len(importedMemory.Buffer))) { + err = errorMinSizeMismatch(i, expected.Min, importedMemory.Min) + return + } + + if expected.Max < importedMemory.Max { + err = errorMaxSizeMismatch(i, expected.Max, importedMemory.Max) + return + } + m.MemoryInstance = importedMemory + m.Engine.ResolveImportedMemory(importedModule.Engine) + case ExternTypeGlobal: + expected := i.DescGlobal + importedGlobal := importedModule.Globals[imported.Index] + + if expected.Mutable != importedGlobal.Type.Mutable { + err = errorInvalidImport(i, fmt.Errorf("mutability mismatch: %t != %t", + expected.Mutable, importedGlobal.Type.Mutable)) + return + } + + if expected.ValType != importedGlobal.Type.ValType { + err = errorInvalidImport(i, fmt.Errorf("value type mismatch: %s != %s", + ValueTypeName(expected.ValType), ValueTypeName(importedGlobal.Type.ValType))) + return + } + m.Globals[i.IndexPerType] = importedGlobal + } + } + } + return +} + +func errorMinSizeMismatch(i *Import, expected, actual uint32) error { + return errorInvalidImport(i, fmt.Errorf("minimum size mismatch: %d > %d", expected, actual)) +} + +func errorNoMax(i *Import, expected uint32) error { + return errorInvalidImport(i, fmt.Errorf("maximum size mismatch: %d, but actual has no max", expected)) +} + +func errorMaxSizeMismatch(i *Import, expected, actual uint32) error { + return errorInvalidImport(i, fmt.Errorf("maximum size mismatch: %d < %d", expected, actual)) +} + +func errorInvalidImport(i *Import, err error) error { + return fmt.Errorf("import %s[%s.%s]: %w", ExternTypeName(i.Type), i.Module, i.Name, err) +} + +// executeConstExpressionI32 executes the ConstantExpression which returns ValueTypeI32. +// The validity of the expression is ensured when calling this function as this is only called +// during instantiation phrase, and the validation happens in compilation (validateConstExpression). +func executeConstExpressionI32(importedGlobals []*GlobalInstance, expr *ConstantExpression) (ret int32) { + switch expr.Opcode { + case OpcodeI32Const: + ret, _, _ = leb128.LoadInt32(expr.Data) + case OpcodeGlobalGet: + id, _, _ := leb128.LoadUint32(expr.Data) + g := importedGlobals[id] + ret = int32(g.Val) + } + return +} + +// initialize initializes the value of this global instance given the const expr and imported globals. +// funcRefResolver is called to get the actual funcref (engine specific) from the OpcodeRefFunc const expr. +// +// Global initialization constant expression can only reference the imported globals. +// See the note on https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#constant-expressions%E2%91%A0 +func (g *GlobalInstance) initialize(importedGlobals []*GlobalInstance, expr *ConstantExpression, funcRefResolver func(funcIndex Index) Reference) { + switch expr.Opcode { + case OpcodeI32Const: + // Treat constants as signed as their interpretation is not yet known per /RATIONALE.md + v, _, _ := leb128.LoadInt32(expr.Data) + g.Val = uint64(uint32(v)) + case OpcodeI64Const: + // Treat constants as signed as their interpretation is not yet known per /RATIONALE.md + v, _, _ := leb128.LoadInt64(expr.Data) + g.Val = uint64(v) + case OpcodeF32Const: + g.Val = uint64(binary.LittleEndian.Uint32(expr.Data)) + case OpcodeF64Const: + g.Val = binary.LittleEndian.Uint64(expr.Data) + case OpcodeGlobalGet: + id, _, _ := leb128.LoadUint32(expr.Data) + importedG := importedGlobals[id] + switch importedG.Type.ValType { + case ValueTypeI32: + g.Val = uint64(uint32(importedG.Val)) + case ValueTypeI64: + g.Val = importedG.Val + case ValueTypeF32: + g.Val = importedG.Val + case ValueTypeF64: + g.Val = importedG.Val + case ValueTypeV128: + g.Val, g.ValHi = importedG.Val, importedG.ValHi + case ValueTypeFuncref, ValueTypeExternref: + g.Val = importedG.Val + } + case OpcodeRefNull: + switch expr.Data[0] { + case ValueTypeExternref, ValueTypeFuncref: + g.Val = 0 // Reference types are opaque 64bit pointer at runtime. + } + case OpcodeRefFunc: + v, _, _ := leb128.LoadUint32(expr.Data) + g.Val = uint64(funcRefResolver(v)) + case OpcodeVecV128Const: + g.Val, g.ValHi = binary.LittleEndian.Uint64(expr.Data[0:8]), binary.LittleEndian.Uint64(expr.Data[8:16]) + } +} + +// String implements api.Global. +func (g *GlobalInstance) String() string { + switch g.Type.ValType { + case ValueTypeI32, ValueTypeI64: + return fmt.Sprintf("global(%d)", g.Val) + case ValueTypeF32: + return fmt.Sprintf("global(%f)", api.DecodeF32(g.Val)) + case ValueTypeF64: + return fmt.Sprintf("global(%f)", api.DecodeF64(g.Val)) + default: + panic(fmt.Errorf("BUG: unknown value type %X", g.Type.ValType)) + } +} + +func (g *GlobalInstance) Value() (uint64, uint64) { + if g.Me != nil { + return g.Me.GetGlobalValue(g.Index) + } + return g.Val, g.ValHi +} + +func (s *Store) GetFunctionTypeIDs(ts []FunctionType) ([]FunctionTypeID, error) { + ret := make([]FunctionTypeID, len(ts)) + for i := range ts { + t := &ts[i] + inst, err := s.GetFunctionTypeID(t) + if err != nil { + return nil, err + } + ret[i] = inst + } + return ret, nil +} + +func (s *Store) GetFunctionTypeID(t *FunctionType) (FunctionTypeID, error) { + s.mux.RLock() + key := t.key() + id, ok := s.typeIDs[key] + s.mux.RUnlock() + if !ok { + s.mux.Lock() + defer s.mux.Unlock() + // Check again in case another goroutine has already added the type. + if id, ok = s.typeIDs[key]; ok { + return id, nil + } + l := len(s.typeIDs) + if uint32(l) >= s.functionMaxTypes { + return 0, fmt.Errorf("too many function types in a store") + } + id = FunctionTypeID(l) + s.typeIDs[key] = id + } + return id, nil +} + +// CloseWithExitCode implements the same method as documented on wazero.Runtime. +func (s *Store) CloseWithExitCode(ctx context.Context, exitCode uint32) (err error) { + s.mux.Lock() + defer s.mux.Unlock() + // Close modules in reverse initialization order. + for m := s.moduleList; m != nil; m = m.next { + // If closing this module errs, proceed anyway to close the others. + if e := m.closeWithExitCode(ctx, exitCode); e != nil && err == nil { + // TODO: use multiple errors handling in Go 1.20. + err = e // first error + } + } + s.moduleList = nil + s.nameToModule = nil + s.nameToModuleCap = 0 + s.typeIDs = nil + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/store_module_list.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/store_module_list.go new file mode 100644 index 000000000..17c63e38e --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/store_module_list.go @@ -0,0 +1,97 @@ +package wasm + +import ( + "errors" + "fmt" + + "github.com/tetratelabs/wazero/api" +) + +// deleteModule makes the moduleName available for instantiation again. +func (s *Store) deleteModule(m *ModuleInstance) error { + s.mux.Lock() + defer s.mux.Unlock() + + // Remove this module name. + if m.prev != nil { + m.prev.next = m.next + } + if m.next != nil { + m.next.prev = m.prev + } + if s.moduleList == m { + s.moduleList = m.next + } + // Clear the m state so it does not enter any other branch + // on subsequent calls to deleteModule. + m.prev = nil + m.next = nil + + if m.ModuleName != "" { + delete(s.nameToModule, m.ModuleName) + + // Shrink the map if it's allocated more than twice the size of the list + newCap := len(s.nameToModule) + if newCap < nameToModuleShrinkThreshold { + newCap = nameToModuleShrinkThreshold + } + if newCap*2 <= s.nameToModuleCap { + nameToModule := make(map[string]*ModuleInstance, newCap) + for k, v := range s.nameToModule { + nameToModule[k] = v + } + s.nameToModule = nameToModule + s.nameToModuleCap = newCap + } + } + return nil +} + +// module returns the module of the given name or error if not in this store +func (s *Store) module(moduleName string) (*ModuleInstance, error) { + s.mux.RLock() + defer s.mux.RUnlock() + m, ok := s.nameToModule[moduleName] + if !ok { + return nil, fmt.Errorf("module[%s] not instantiated", moduleName) + } + return m, nil +} + +// registerModule registers a ModuleInstance into the store. +// This makes the ModuleInstance visible for import if it's not anonymous, and ensures it is closed when the store is. +func (s *Store) registerModule(m *ModuleInstance) error { + s.mux.Lock() + defer s.mux.Unlock() + + if s.nameToModule == nil { + return errors.New("already closed") + } + + if m.ModuleName != "" { + if _, ok := s.nameToModule[m.ModuleName]; ok { + return fmt.Errorf("module[%s] has already been instantiated", m.ModuleName) + } + s.nameToModule[m.ModuleName] = m + if len(s.nameToModule) > s.nameToModuleCap { + s.nameToModuleCap = len(s.nameToModule) + } + } + + // Add the newest node to the moduleNamesList as the head. + m.next = s.moduleList + if m.next != nil { + m.next.prev = m + } + s.moduleList = m + return nil +} + +// Module implements wazero.Runtime Module +func (s *Store) Module(moduleName string) api.Module { + m, err := s.module(moduleName) + if err != nil { + return nil + } + return m +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasm/table.go b/vendor/github.com/tetratelabs/wazero/internal/wasm/table.go new file mode 100644 index 000000000..ac9fc4986 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasm/table.go @@ -0,0 +1,327 @@ +package wasm + +import ( + "fmt" + "math" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/leb128" +) + +// Table describes the limits of elements and its type in a table. +type Table struct { + Min uint32 + Max *uint32 + Type RefType +} + +// RefType is either RefTypeFuncref or RefTypeExternref as of WebAssembly core 2.0. +type RefType = byte + +const ( + // RefTypeFuncref represents a reference to a function. + RefTypeFuncref = ValueTypeFuncref + // RefTypeExternref represents a reference to a host object, which is not currently supported in wazero. + RefTypeExternref = ValueTypeExternref +) + +func RefTypeName(t RefType) (ret string) { + switch t { + case RefTypeFuncref: + ret = "funcref" + case RefTypeExternref: + ret = "externref" + default: + ret = fmt.Sprintf("unknown(0x%x)", t) + } + return +} + +// ElementMode represents a mode of element segment which is either active, passive or declarative. +// +// https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/syntax/modules.html#element-segments +type ElementMode = byte + +const ( + // ElementModeActive is the mode which requires the runtime to initialize table with the contents in .Init field combined with OffsetExpr. + ElementModeActive ElementMode = iota + // ElementModePassive is the mode which doesn't require the runtime to initialize table, and only used with OpcodeTableInitName. + ElementModePassive + // ElementModeDeclarative is introduced in reference-types proposal which can be used to declare function indexes used by OpcodeRefFunc. + ElementModeDeclarative +) + +// ElementSegment are initialization instructions for a TableInstance +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#syntax-elem +type ElementSegment struct { + // OffsetExpr returns the table element offset to apply to Init indices. + // Note: This can be validated prior to instantiation unless it includes OpcodeGlobalGet (an imported global). + OffsetExpr ConstantExpression + + // TableIndex is the table's index to which this element segment is applied. + // Note: This is used if and only if the Mode is active. + TableIndex Index + + // Followings are set/used regardless of the Mode. + + // Init indices are (nullable) table elements where each index is the function index by which the module initialize the table. + Init []Index + + // Type holds the type of this element segment, which is the RefType in WebAssembly 2.0. + Type RefType + + // Mode is the mode of this element segment. + Mode ElementMode +} + +const ( + // ElementInitNullReference represents the null reference in ElementSegment's Init. + // In Wasm spec, an init item represents either Function's Index or null reference, + // and in wazero, we limit the maximum number of functions available in a module to + // MaximumFunctionIndex. Therefore, it is safe to use 1 << 31 to represent the null + // reference in Element segments. + ElementInitNullReference Index = 1 << 31 + // ElementInitImportedGlobalFunctionReference represents an init item which is resolved via an imported global constexpr. + // The actual function reference stored at Global is only known at instantiation-time, so we set this flag + // to items of ElementSegment.Init at binary decoding, and unwrap this flag at instantiation to resolve the value. + // + // This might collide the init element resolved via ref.func instruction which is resolved with the func index at decoding, + // but in practice, that is not allowed in wazero thanks to our limit MaximumFunctionIndex. Thus, it is safe to set this flag + // in init element to indicate as such. + ElementInitImportedGlobalFunctionReference Index = 1 << 30 +) + +// unwrapElementInitGlobalReference takes an item of the init vector of an ElementSegment, +// and returns the Global index if it is supposed to get generated from a global. +// ok is true if the given init item is as such. +func unwrapElementInitGlobalReference(init Index) (_ Index, ok bool) { + if init&ElementInitImportedGlobalFunctionReference == ElementInitImportedGlobalFunctionReference { + return init &^ ElementInitImportedGlobalFunctionReference, true + } + return init, false +} + +// IsActive returns true if the element segment is "active" mode which requires the runtime to initialize table +// with the contents in .Init field. +func (e *ElementSegment) IsActive() bool { + return e.Mode == ElementModeActive +} + +// TableInstance represents a table of (RefTypeFuncref) elements in a module. +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#table-instances%E2%91%A0 +type TableInstance struct { + // References holds references whose type is either RefTypeFuncref or RefTypeExternref (unsupported). + // + // Currently, only function references are supported. + References []Reference + + // Min is the minimum (function) elements in this table and cannot grow to accommodate ElementSegment. + Min uint32 + + // Max if present is the maximum (function) elements in this table, or nil if unbounded. + Max *uint32 + + // Type is either RefTypeFuncref or RefTypeExternRef. + Type RefType +} + +// ElementInstance represents an element instance in a module. +// +// See https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/runtime.html#element-instances +type ElementInstance = []Reference + +// Reference is the runtime representation of RefType which is either RefTypeFuncref or RefTypeExternref. +type Reference = uintptr + +// validateTable ensures any ElementSegment is valid. This caches results via Module.validatedActiveElementSegments. +// Note: limitsType are validated by decoders, so not re-validated here. +func (m *Module) validateTable(enabledFeatures api.CoreFeatures, tables []Table, maximumTableIndex uint32) error { + if len(tables) > int(maximumTableIndex) { + return fmt.Errorf("too many tables in a module: %d given with limit %d", len(tables), maximumTableIndex) + } + + importedTableCount := m.ImportTableCount + + // Create bounds checks as these can err prior to instantiation + funcCount := m.ImportFunctionCount + m.SectionElementCount(SectionIDFunction) + globalsCount := m.ImportGlobalCount + m.SectionElementCount(SectionIDGlobal) + + // Now, we have to figure out which table elements can be resolved before instantiation and also fail early if there + // are any imported globals that are known to be invalid by their declarations. + for i := range m.ElementSection { + elem := &m.ElementSection[i] + idx := Index(i) + initCount := uint32(len(elem.Init)) + + if elem.Type == RefTypeFuncref { + // Any offset applied is to the element, not the function index: validate here if the funcidx is sound. + for ei, init := range elem.Init { + if init == ElementInitNullReference { + continue + } + index, ok := unwrapElementInitGlobalReference(init) + if ok { + if index >= globalsCount { + return fmt.Errorf("%s[%d].init[%d] globalidx %d out of range", SectionIDName(SectionIDElement), idx, ei, index) + } + } else { + if index >= funcCount { + return fmt.Errorf("%s[%d].init[%d] funcidx %d out of range", SectionIDName(SectionIDElement), idx, ei, index) + } + } + } + } else { + for j, elem := range elem.Init { + if elem != ElementInitNullReference { + return fmt.Errorf("%s[%d].init[%d] must be ref.null but was %v", SectionIDName(SectionIDElement), idx, j, elem) + } + } + } + + if elem.IsActive() { + if len(tables) <= int(elem.TableIndex) { + return fmt.Errorf("unknown table %d as active element target", elem.TableIndex) + } + + t := tables[elem.TableIndex] + if t.Type != elem.Type { + return fmt.Errorf("element type mismatch: table has %s but element has %s", + RefTypeName(t.Type), RefTypeName(elem.Type), + ) + } + + // global.get needs to be discovered during initialization + oc := elem.OffsetExpr.Opcode + if oc == OpcodeGlobalGet { + globalIdx, _, err := leb128.LoadUint32(elem.OffsetExpr.Data) + if err != nil { + return fmt.Errorf("%s[%d] couldn't read global.get parameter: %w", SectionIDName(SectionIDElement), idx, err) + } else if err = m.verifyImportGlobalI32(SectionIDElement, idx, globalIdx); err != nil { + return err + } + } else if oc == OpcodeI32Const { + // Per https://github.com/WebAssembly/spec/blob/wg-1.0/test/core/elem.wast#L117 we must pass if imported + // table has set its min=0. Per https://github.com/WebAssembly/spec/blob/wg-1.0/test/core/elem.wast#L142, we + // have to do fail if module-defined min=0. + if !enabledFeatures.IsEnabled(api.CoreFeatureReferenceTypes) && elem.TableIndex >= importedTableCount { + // Treat constants as signed as their interpretation is not yet known per /RATIONALE.md + o, _, err := leb128.LoadInt32(elem.OffsetExpr.Data) + if err != nil { + return fmt.Errorf("%s[%d] couldn't read i32.const parameter: %w", SectionIDName(SectionIDElement), idx, err) + } + offset := Index(o) + if err = checkSegmentBounds(t.Min, uint64(initCount)+uint64(offset), idx); err != nil { + return err + } + } + } else { + return fmt.Errorf("%s[%d] has an invalid const expression: %s", SectionIDName(SectionIDElement), idx, InstructionName(oc)) + } + } + } + return nil +} + +// buildTable returns TableInstances if the module defines or imports a table. +// - importedTables: returned as `tables` unmodified. +// - importedGlobals: include all instantiated, imported globals. +// +// If the result `init` is non-nil, it is the `tableInit` parameter of Engine.NewModuleEngine. +// +// Note: An error is only possible when an ElementSegment.OffsetExpr is out of range of the TableInstance.Min. +func (m *ModuleInstance) buildTables(module *Module, skipBoundCheck bool) (err error) { + idx := module.ImportTableCount + for i := range module.TableSection { + tsec := &module.TableSection[i] + // The module defining the table is the one that sets its Min/Max etc. + m.Tables[idx] = &TableInstance{ + References: make([]Reference, tsec.Min), Min: tsec.Min, Max: tsec.Max, + Type: tsec.Type, + } + idx++ + } + + if !skipBoundCheck { + for elemI := range module.ElementSection { // Do not loop over the value since elementSegments is a slice of value. + elem := &module.ElementSection[elemI] + table := m.Tables[elem.TableIndex] + var offset uint32 + if elem.OffsetExpr.Opcode == OpcodeGlobalGet { + // Ignore error as it's already validated. + globalIdx, _, _ := leb128.LoadUint32(elem.OffsetExpr.Data) + global := m.Globals[globalIdx] + offset = uint32(global.Val) + } else { // i32.const + // Ignore error as it's already validated. + o, _, _ := leb128.LoadInt32(elem.OffsetExpr.Data) + offset = uint32(o) + } + + // Check to see if we are out-of-bounds + initCount := uint64(len(elem.Init)) + if err = checkSegmentBounds(table.Min, uint64(offset)+initCount, Index(elemI)); err != nil { + return + } + } + } + return +} + +// checkSegmentBounds fails if the capacity needed for an ElementSegment.Init is larger than limitsType.Min +// +// WebAssembly 1.0 (20191205) doesn't forbid growing to accommodate element segments, and spectests are inconsistent. +// For example, the spectests enforce elements within Table limitsType.Min, but ignore Import.DescTable min. What this +// means is we have to delay offset checks on imported tables until we link to them. +// e.g. https://github.com/WebAssembly/spec/blob/wg-1.0/test/core/elem.wast#L117 wants pass on min=0 for import +// e.g. https://github.com/WebAssembly/spec/blob/wg-1.0/test/core/elem.wast#L142 wants fail on min=0 module-defined +func checkSegmentBounds(min uint32, requireMin uint64, idx Index) error { // uint64 in case offset was set to -1 + if requireMin > uint64(min) { + return fmt.Errorf("%s[%d].init exceeds min table size", SectionIDName(SectionIDElement), idx) + } + return nil +} + +func (m *Module) verifyImportGlobalI32(sectionID SectionID, sectionIdx Index, idx uint32) error { + ig := uint32(math.MaxUint32) // +1 == 0 + for i := range m.ImportSection { + imp := &m.ImportSection[i] + if imp.Type == ExternTypeGlobal { + ig++ + if ig == idx { + if imp.DescGlobal.ValType != ValueTypeI32 { + return fmt.Errorf("%s[%d] (global.get %d): import[%d].global.ValType != i32", SectionIDName(sectionID), sectionIdx, idx, i) + } + return nil + } + } + } + return fmt.Errorf("%s[%d] (global.get %d): out of range of imported globals", SectionIDName(sectionID), sectionIdx, idx) +} + +// Grow appends the `initialRef` by `delta` times into the References slice. +// Returns -1 if the operation is not valid, otherwise the old length of the table. +// +// https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/instructions.html#xref-syntax-instructions-syntax-instr-table-mathsf-table-grow-x +func (t *TableInstance) Grow(delta uint32, initialRef Reference) (currentLen uint32) { + currentLen = uint32(len(t.References)) + if delta == 0 { + return + } + + if newLen := int64(currentLen) + int64(delta); // adding as 64bit ints to avoid overflow. + newLen >= math.MaxUint32 || (t.Max != nil && newLen > int64(*t.Max)) { + return 0xffffffff // = -1 in signed 32-bit integer. + } + t.References = append(t.References, make([]uintptr, delta)...) + + // Uses the copy trick for faster filling the new region with the initial value. + // https://gist.github.com/taylorza/df2f89d5f9ab3ffd06865062a4cf015d + newRegion := t.References[currentLen:] + newRegion[0] = initialRef + for i := 1; i < len(newRegion); i *= 2 { + copy(newRegion[i:], newRegion[:i]) + } + return +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasmdebug/debug.go b/vendor/github.com/tetratelabs/wazero/internal/wasmdebug/debug.go new file mode 100644 index 000000000..0aa613695 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasmdebug/debug.go @@ -0,0 +1,157 @@ +// Package wasmdebug contains utilities used to give consistent search keys between stack traces and error messages. +// Note: This is named wasmdebug to avoid conflicts with the normal go module. +// Note: This only imports "api" as importing "wasm" would create a cyclic dependency. +package wasmdebug + +import ( + "fmt" + "runtime" + "runtime/debug" + "strconv" + "strings" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/wasmruntime" + "github.com/tetratelabs/wazero/sys" +) + +// FuncName returns the naming convention of "moduleName.funcName". +// +// - moduleName is the possibly empty name the module was instantiated with. +// - funcName is the name in the Custom Name section. +// - funcIdx is the position in the function index, prefixed with +// imported functions. +// +// Note: "moduleName.$funcIdx" is used when the funcName is empty, as commonly +// the case in TinyGo. +func FuncName(moduleName, funcName string, funcIdx uint32) string { + var ret strings.Builder + + // Start module.function + ret.WriteString(moduleName) + ret.WriteByte('.') + if funcName == "" { + ret.WriteByte('$') + ret.WriteString(strconv.Itoa(int(funcIdx))) + } else { + ret.WriteString(funcName) + } + + return ret.String() +} + +// signature returns a formatted signature similar to how it is defined in Go. +// +// * paramTypes should be from wasm.FunctionType +// * resultTypes should be from wasm.FunctionType +// TODO: add paramNames +func signature(funcName string, paramTypes []api.ValueType, resultTypes []api.ValueType) string { + var ret strings.Builder + ret.WriteString(funcName) + + // Start params + ret.WriteByte('(') + paramCount := len(paramTypes) + switch paramCount { + case 0: + case 1: + ret.WriteString(api.ValueTypeName(paramTypes[0])) + default: + ret.WriteString(api.ValueTypeName(paramTypes[0])) + for _, vt := range paramTypes[1:] { + ret.WriteByte(',') + ret.WriteString(api.ValueTypeName(vt)) + } + } + ret.WriteByte(')') + + // Start results + resultCount := len(resultTypes) + switch resultCount { + case 0: + case 1: + ret.WriteByte(' ') + ret.WriteString(api.ValueTypeName(resultTypes[0])) + default: // As this is used for errors, don't panic if there are multiple returns, even if that's invalid! + ret.WriteByte(' ') + ret.WriteByte('(') + ret.WriteString(api.ValueTypeName(resultTypes[0])) + for _, vt := range resultTypes[1:] { + ret.WriteByte(',') + ret.WriteString(api.ValueTypeName(vt)) + } + ret.WriteByte(')') + } + + return ret.String() +} + +// ErrorBuilder helps build consistent errors, particularly adding a WASM stack trace. +// +// AddFrame should be called beginning at the frame that panicked until no more frames exist. Once done, call Format. +type ErrorBuilder interface { + // AddFrame adds the next frame. + // + // * funcName should be from FuncName + // * paramTypes should be from wasm.FunctionType + // * resultTypes should be from wasm.FunctionType + // * sources is the source code information for this frame and can be empty. + // + // Note: paramTypes and resultTypes are present because signature misunderstanding, mismatch or overflow are common. + AddFrame(funcName string, paramTypes, resultTypes []api.ValueType, sources []string) + + // FromRecovered returns an error with the wasm stack trace appended to it. + FromRecovered(recovered interface{}) error +} + +func NewErrorBuilder() ErrorBuilder { + return &stackTrace{} +} + +type stackTrace struct { + frames []string +} + +// GoRuntimeErrorTracePrefix is the prefix coming before the Go runtime stack trace included in the face of runtime.Error. +// This is exported for testing purpose. +const GoRuntimeErrorTracePrefix = "Go runtime stack trace:" + +func (s *stackTrace) FromRecovered(recovered interface{}) error { + if false { + debug.PrintStack() + } + + if exitErr, ok := recovered.(*sys.ExitError); ok { // Don't wrap an exit error! + return exitErr + } + + stack := strings.Join(s.frames, "\n\t") + + // If the error was internal, don't mention it was recovered. + if wasmErr, ok := recovered.(*wasmruntime.Error); ok { + return fmt.Errorf("wasm error: %w\nwasm stack trace:\n\t%s", wasmErr, stack) + } + + // If we have a runtime.Error, something severe happened which should include the stack trace. This could be + // a nil pointer from wazero or a user-defined function from HostModuleBuilder. + if runtimeErr, ok := recovered.(runtime.Error); ok { + return fmt.Errorf("%w (recovered by wazero)\nwasm stack trace:\n\t%s\n\n%s\n%s", + runtimeErr, stack, GoRuntimeErrorTracePrefix, debug.Stack()) + } + + // At this point we expect the error was from a function defined by HostModuleBuilder that intentionally called panic. + if runtimeErr, ok := recovered.(error); ok { // e.g. panic(errors.New("whoops")) + return fmt.Errorf("%w (recovered by wazero)\nwasm stack trace:\n\t%s", runtimeErr, stack) + } else { // e.g. panic("whoops") + return fmt.Errorf("%v (recovered by wazero)\nwasm stack trace:\n\t%s", recovered, stack) + } +} + +// AddFrame implements ErrorBuilder.AddFrame +func (s *stackTrace) AddFrame(funcName string, paramTypes, resultTypes []api.ValueType, sources []string) { + sig := signature(funcName, paramTypes, resultTypes) + s.frames = append(s.frames, sig) + for _, source := range sources { + s.frames = append(s.frames, "\t"+source) + } +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasmdebug/dwarf.go b/vendor/github.com/tetratelabs/wazero/internal/wasmdebug/dwarf.go new file mode 100644 index 000000000..3b0d3a7a6 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasmdebug/dwarf.go @@ -0,0 +1,226 @@ +package wasmdebug + +import ( + "debug/dwarf" + "errors" + "fmt" + "io" + "sort" + "strings" + "sync" +) + +// DWARFLines is used to retrieve source code line information from the DWARF data. +type DWARFLines struct { + // d is created by DWARF custom sections. + d *dwarf.Data + // linesPerEntry maps dwarf.Offset for dwarf.Entry to the list of lines contained by the entry. + // The value is sorted in the increasing order by the address. + linesPerEntry map[dwarf.Offset][]line + mux sync.Mutex +} + +type line struct { + addr uint64 + pos dwarf.LineReaderPos +} + +// NewDWARFLines returns DWARFLines for the given *dwarf.Data. +func NewDWARFLines(d *dwarf.Data) *DWARFLines { + if d == nil { + return nil + } + return &DWARFLines{d: d, linesPerEntry: map[dwarf.Offset][]line{}} +} + +// isTombstoneAddr returns true if the given address is invalid a.k.a tombstone address which was made no longer valid +// by linker. According to the DWARF spec[1], the value is encoded as 0xffffffff for Wasm (as 32-bit target), +// but some tools encode it either in -1, -2 [2] or 1<<32 (This might not be by tools, but by debug/dwarf package's bug). +// +// [1] https://dwarfstd.org/issues/200609.1.html +// [2] https://github.com/WebAssembly/binaryen/blob/97178d08d4a20d2a5e3a6be813fc6a7079ef86e1/src/wasm/wasm-debug.cpp#L651-L660 +// [3] https://reviews.llvm.org/D81784 +func isTombstoneAddr(addr uint64) bool { + addr32 := int32(addr) + return addr32 == -1 || addr32 == -2 || + addr32 == 0 // This covers 1 <<32. +} + +// Line returns the line information for the given instructionOffset which is an offset in +// the code section of the original Wasm binary. Returns empty string if the info is not found. +func (d *DWARFLines) Line(instructionOffset uint64) (ret []string) { + if d == nil { + return + } + + // DWARFLines is created per Wasm binary, so there's a possibility that multiple instances + // created from a same binary face runtime error at the same time, and that results in + // concurrent access to this function. + d.mux.Lock() + defer d.mux.Unlock() + + r := d.d.Reader() + + var inlinedRoutines []*dwarf.Entry + var cu *dwarf.Entry + var inlinedDone bool +entry: + for { + ent, err := r.Next() + if err != nil || ent == nil { + break + } + + // If we already found the compilation unit and relevant inlined routines, we can stop searching entries. + if cu != nil && inlinedDone { + break + } + + switch ent.Tag { + case dwarf.TagCompileUnit, dwarf.TagInlinedSubroutine: + default: + // Only CompileUnit and InlinedSubroutines are relevant. + continue + } + + // Check if the entry spans the range which contains the target instruction. + ranges, err := d.d.Ranges(ent) + if err != nil { + continue + } + for _, pcs := range ranges { + start, end := pcs[0], pcs[1] + if isTombstoneAddr(start) || isTombstoneAddr(end) { + continue + } + if start <= instructionOffset && instructionOffset < end { + switch ent.Tag { + case dwarf.TagCompileUnit: + cu = ent + case dwarf.TagInlinedSubroutine: + inlinedRoutines = append(inlinedRoutines, ent) + // Search inlined subroutines until all the children. + inlinedDone = !ent.Children + // Not that "children" in the DWARF spec is defined as the next entry to this entry. + // See "2.3 Relationship of Debugging Information Entries" in https://dwarfstd.org/doc/DWARF4.pdf + } + continue entry + } + } + } + + // If the relevant compilation unit is not found, nothing we can do with this DWARF info. + if cu == nil { + return + } + + lineReader, err := d.d.LineReader(cu) + if err != nil || lineReader == nil { + return + } + var lines []line + var ok bool + var le dwarf.LineEntry + // Get the lines inside the entry. + if lines, ok = d.linesPerEntry[cu.Offset]; !ok { + // If not found, we create the list of lines by reading all the LineEntries in the Entry. + // + // Note that the dwarf.LineEntry.SeekPC API shouldn't be used because the Go's dwarf package assumes that + // all the line entries in an Entry are sorted in increasing order which *might not* be true + // for some languages. Such order requirement is not a part of DWARF specification, + // and in fact Zig language tends to emit interleaved line information. + // + // Thus, here we read all line entries here, and sort them in the increasing order wrt addresses. + for { + pos := lineReader.Tell() + err = lineReader.Next(&le) + if errors.Is(err, io.EOF) { + break + } else if err != nil { + return + } + // TODO: Maybe we should ignore tombstone addresses by using isTombstoneAddr, + // but not sure if that would be an issue in practice. + lines = append(lines, line{addr: le.Address, pos: pos}) + } + sort.Slice(lines, func(i, j int) bool { return lines[i].addr < lines[j].addr }) + d.linesPerEntry[cu.Offset] = lines // Caches for the future inquiries for the same Entry. + } + + // Now we have the lines for this entry. We can find the corresponding source line for instructionOffset + // via binary search on the list. + n := len(lines) + index := sort.Search(n, func(i int) bool { return lines[i].addr >= instructionOffset }) + + if index == n { // This case the address is not found. See the doc sort.Search. + return + } + + ln := lines[index] + if ln.addr != instructionOffset { + // If the address doesn't match exactly, the previous entry is the one that contains the instruction. + // That can happen anytime as the DWARF spec allows it, and other tools can handle it in this way conventionally + // https://github.com/gimli-rs/addr2line/blob/3a2dbaf84551a06a429f26e9c96071bb409b371f/src/lib.rs#L236-L242 + // https://github.com/kateinoigakukun/wasminspect/blob/f29f052f1b03104da9f702508ac0c1bbc3530ae4/crates/debugger/src/dwarf/mod.rs#L453-L459 + if index-1 < 0 { + return + } + ln = lines[index-1] + } + + // Advance the line reader for the found position. + lineReader.Seek(ln.pos) + err = lineReader.Next(&le) + + if err != nil { + // If we reach this block, that means there's a bug in the []line creation logic above. + panic("BUG: stored dwarf.LineReaderPos is invalid") + } + + // In the inlined case, the line info is the innermost inlined function call. + inlined := len(inlinedRoutines) != 0 + prefix := fmt.Sprintf("%#x: ", instructionOffset) + ret = append(ret, formatLine(prefix, le.File.Name, int64(le.Line), int64(le.Column), inlined)) + + if inlined { + prefix = strings.Repeat(" ", len(prefix)) + files := lineReader.Files() + // inlinedRoutines contain the inlined call information in the reverse order (children is higher than parent), + // so we traverse the reverse order and emit the inlined calls. + for i := len(inlinedRoutines) - 1; i >= 0; i-- { + inlined := inlinedRoutines[i] + fileIndex, ok := inlined.Val(dwarf.AttrCallFile).(int64) + if !ok { + return + } else if fileIndex >= int64(len(files)) { + // This in theory shouldn't happen according to the spec, but guard against ill-formed DWARF info. + return + } + fileName := files[fileIndex] + line, _ := inlined.Val(dwarf.AttrCallLine).(int64) + col, _ := inlined.Val(dwarf.AttrCallColumn).(int64) + ret = append(ret, formatLine(prefix, fileName.Name, line, col, + // Last one is the origin of the inlined function calls. + i != 0)) + } + } + return +} + +func formatLine(prefix, fileName string, line, col int64, inlined bool) string { + builder := strings.Builder{} + builder.WriteString(prefix) + builder.WriteString(fileName) + + if line != 0 { + builder.WriteString(fmt.Sprintf(":%d", line)) + if col != 0 { + builder.WriteString(fmt.Sprintf(":%d", col)) + } + } + + if inlined { + builder.WriteString(" (inlined)") + } + return builder.String() +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasmruntime/errors.go b/vendor/github.com/tetratelabs/wazero/internal/wasmruntime/errors.go new file mode 100644 index 000000000..43f951e0d --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wasmruntime/errors.go @@ -0,0 +1,44 @@ +// Package wasmruntime contains internal symbols shared between modules for error handling. +// Note: This is named wasmruntime to avoid conflicts with the normal go module. +// Note: This only imports "api" as importing "wasm" would create a cyclic dependency. +package wasmruntime + +var ( + // ErrRuntimeStackOverflow indicates that there are too many function calls, + // and the Engine terminated the execution. + ErrRuntimeStackOverflow = New("stack overflow") + // ErrRuntimeInvalidConversionToInteger indicates the Wasm function tries to + // convert NaN floating point value to integers during trunc variant instructions. + ErrRuntimeInvalidConversionToInteger = New("invalid conversion to integer") + // ErrRuntimeIntegerOverflow indicates that an integer arithmetic resulted in + // overflow value. For example, when the program tried to truncate a float value + // which doesn't fit in the range of target integer. + ErrRuntimeIntegerOverflow = New("integer overflow") + // ErrRuntimeIntegerDivideByZero indicates that an integer div or rem instructions + // was executed with 0 as the divisor. + ErrRuntimeIntegerDivideByZero = New("integer divide by zero") + // ErrRuntimeUnreachable means "unreachable" instruction was executed by the program. + ErrRuntimeUnreachable = New("unreachable") + // ErrRuntimeOutOfBoundsMemoryAccess indicates that the program tried to access the + // region beyond the linear memory. + ErrRuntimeOutOfBoundsMemoryAccess = New("out of bounds memory access") + // ErrRuntimeInvalidTableAccess means either offset to the table was out of bounds of table, or + // the target element in the table was uninitialized during call_indirect instruction. + ErrRuntimeInvalidTableAccess = New("invalid table access") + // ErrRuntimeIndirectCallTypeMismatch indicates that the type check failed during call_indirect. + ErrRuntimeIndirectCallTypeMismatch = New("indirect call type mismatch") +) + +// Error is returned by a wasm.Engine during the execution of Wasm functions, and they indicate that the Wasm runtime +// state is unrecoverable. +type Error struct { + s string +} + +func New(text string) *Error { + return &Error{s: text} +} + +func (e *Error) Error() string { + return e.s +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wazeroir/compiler.go b/vendor/github.com/tetratelabs/wazero/internal/wazeroir/compiler.go new file mode 100644 index 000000000..47ddc92bf --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wazeroir/compiler.go @@ -0,0 +1,3068 @@ +package wazeroir + +import ( + "bytes" + "encoding/binary" + "fmt" + "math" + "strings" + + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/internal/leb128" + "github.com/tetratelabs/wazero/internal/wasm" +) + +type controlFrameKind byte + +const ( + controlFrameKindBlockWithContinuationLabel controlFrameKind = iota + controlFrameKindBlockWithoutContinuationLabel + controlFrameKindFunction + controlFrameKindLoop + controlFrameKindIfWithElse + controlFrameKindIfWithoutElse +) + +type ( + controlFrame struct { + frameID uint32 + // originalStackLen holds the number of values on the stack + // when Start executing this control frame minus params for the block. + originalStackLenWithoutParam int + blockType *wasm.FunctionType + kind controlFrameKind + } + controlFrames struct{ frames []controlFrame } +) + +func (c *controlFrame) ensureContinuation() { + // Make sure that if the frame is block and doesn't have continuation, + // change the Kind so we can emit the continuation block + // later when we reach the End instruction of this frame. + if c.kind == controlFrameKindBlockWithoutContinuationLabel { + c.kind = controlFrameKindBlockWithContinuationLabel + } +} + +func (c *controlFrame) asLabel() Label { + switch c.kind { + case controlFrameKindBlockWithContinuationLabel, + controlFrameKindBlockWithoutContinuationLabel: + return NewLabel(LabelKindContinuation, c.frameID) + case controlFrameKindLoop: + return NewLabel(LabelKindHeader, c.frameID) + case controlFrameKindFunction: + return NewLabel(LabelKindReturn, 0) + case controlFrameKindIfWithElse, + controlFrameKindIfWithoutElse: + return NewLabel(LabelKindContinuation, c.frameID) + } + panic(fmt.Sprintf("unreachable: a bug in wazeroir implementation: %v", c.kind)) +} + +func (c *controlFrames) functionFrame() *controlFrame { + // No need to check stack bound + // as we can assume that all the operations + // are valid thanks to validateFunction + // at module validation phase. + return &c.frames[0] +} + +func (c *controlFrames) get(n int) *controlFrame { + // No need to check stack bound + // as we can assume that all the operations + // are valid thanks to validateFunction + // at module validation phase. + return &c.frames[len(c.frames)-n-1] +} + +func (c *controlFrames) top() *controlFrame { + // No need to check stack bound + // as we can assume that all the operations + // are valid thanks to validateFunction + // at module validation phase. + return &c.frames[len(c.frames)-1] +} + +func (c *controlFrames) empty() bool { + return len(c.frames) == 0 +} + +func (c *controlFrames) pop() (frame *controlFrame) { + // No need to check stack bound + // as we can assume that all the operations + // are valid thanks to validateFunction + // at module validation phase. + frame = c.top() + c.frames = c.frames[:len(c.frames)-1] + return +} + +func (c *controlFrames) push(frame controlFrame) { + c.frames = append(c.frames, frame) +} + +func (c *Compiler) initializeStack() { + // Reuse the existing slice. + c.localIndexToStackHeightInUint64 = c.localIndexToStackHeightInUint64[:0] + var current int + for _, lt := range c.sig.Params { + c.localIndexToStackHeightInUint64 = append(c.localIndexToStackHeightInUint64, current) + if lt == wasm.ValueTypeV128 { + current++ + } + current++ + } + + if c.callFrameStackSizeInUint64 > 0 { + // We reserve the stack slots for result values below the return call frame slots. + if diff := c.sig.ResultNumInUint64 - c.sig.ParamNumInUint64; diff > 0 { + current += diff + } + } + + // Non-func param locals Start after the return call frame. + current += c.callFrameStackSizeInUint64 + + for _, lt := range c.localTypes { + c.localIndexToStackHeightInUint64 = append(c.localIndexToStackHeightInUint64, current) + if lt == wasm.ValueTypeV128 { + current++ + } + current++ + } + + // Push function arguments. + for _, t := range c.sig.Params { + c.stackPush(wasmValueTypeToUnsignedType(t)) + } + + if c.callFrameStackSizeInUint64 > 0 { + // Reserve the stack slots for results. + for i := 0; i < c.sig.ResultNumInUint64-c.sig.ParamNumInUint64; i++ { + c.stackPush(UnsignedTypeI64) + } + + // Reserve the stack slots for call frame. + for i := 0; i < c.callFrameStackSizeInUint64; i++ { + c.stackPush(UnsignedTypeI64) + } + } +} + +// Compiler is in charge of lowering raw Wasm function body to get CompilationResult. +// This is created per *wasm.Module and reused for all functions in it to reduce memory allocations. +type Compiler struct { + module *wasm.Module + enabledFeatures api.CoreFeatures + callFrameStackSizeInUint64 int + stack []UnsignedType + currentFrameID uint32 + controlFrames controlFrames + unreachableState struct { + on bool + depth int + } + pc, currentOpPC uint64 + result CompilationResult + + // body holds the code for the function's body where Wasm instructions are stored. + body []byte + // sig is the function type of the target function. + sig *wasm.FunctionType + // localTypes holds the target function locals' value types except function params. + localTypes []wasm.ValueType + // localIndexToStackHeightInUint64 maps the local index (starting with function params) to the stack height + // where the local is places. This is the necessary mapping for functions who contain vector type locals. + localIndexToStackHeightInUint64 []int + + // types hold all the function types in the module where the targe function exists. + types []wasm.FunctionType + // funcs holds the type indexes for all declared functions in the module where the target function exists. + funcs []uint32 + // globals holds the global types for all declared globals in the module where the target function exists. + globals []wasm.GlobalType + + // needSourceOffset is true if this module requires DWARF based stack trace. + needSourceOffset bool + // bodyOffsetInCodeSection is the offset of the body of this function in the original Wasm binary's code section. + bodyOffsetInCodeSection uint64 + + ensureTermination bool + // Pre-allocated bytes.Reader to be used in various places. + br *bytes.Reader + funcTypeToSigs funcTypeToIRSignatures + + next int +} + +//lint:ignore U1000 for debugging only. +func (c *Compiler) stackDump() string { + strs := make([]string, 0, len(c.stack)) + for _, s := range c.stack { + strs = append(strs, s.String()) + } + return "[" + strings.Join(strs, ", ") + "]" +} + +func (c *Compiler) markUnreachable() { + c.unreachableState.on = true +} + +func (c *Compiler) resetUnreachable() { + c.unreachableState.on = false +} + +type CompilationResult struct { + // Operations holds wazeroir operations compiled from Wasm instructions in a Wasm function. + Operations []UnionOperation + + // IROperationSourceOffsetsInWasmBinary is index-correlated with Operation and maps each operation to the corresponding source instruction's + // offset in the original WebAssembly binary. + // Non nil only when the given Wasm module has the DWARF section. + IROperationSourceOffsetsInWasmBinary []uint64 + + // LabelCallers maps Label to the number of callers to that label. + // Here "callers" means that the call-sites which jumps to the label with br, br_if or br_table + // instructions. + // + // Note: zero possible and allowed in wasm. e.g. + // + // (block + // (br 0) + // (block i32.const 1111) + // ) + // + // This example the label corresponding to `(block i32.const 1111)` is never be reached at runtime because `br 0` exits the function before we reach there + LabelCallers map[Label]uint32 + // UsesMemory is true if this function might use memory. + UsesMemory bool + + // The following fields are per-module values, not per-function. + + // Globals holds all the declarations of globals in the module from which this function is compiled. + Globals []wasm.GlobalType + // Functions holds all the declarations of function in the module from which this function is compiled, including itself. + Functions []wasm.Index + // Types holds all the types in the module from which this function is compiled. + Types []wasm.FunctionType + // HasMemory is true if the module from which this function is compiled has memory declaration. + HasMemory bool + // HasTable is true if the module from which this function is compiled has table declaration. + HasTable bool + // HasDataInstances is true if the module has data instances which might be used by memory.init or data.drop instructions. + HasDataInstances bool + // HasDataInstances is true if the module has element instances which might be used by table.init or elem.drop instructions. + HasElementInstances bool +} + +// NewCompiler returns the new *Compiler for the given parameters. +// Use Compiler.Next function to get compilation result per function. +func NewCompiler(enabledFeatures api.CoreFeatures, callFrameStackSizeInUint64 int, module *wasm.Module, ensureTermination bool) (*Compiler, error) { + functions, globals, mem, tables, err := module.AllDeclarations() + if err != nil { + return nil, err + } + + hasMemory, hasTable, hasDataInstances, hasElementInstances := mem != nil, len(tables) > 0, + len(module.DataSection) > 0, len(module.ElementSection) > 0 + + types := module.TypeSection + + c := &Compiler{ + module: module, + enabledFeatures: enabledFeatures, + controlFrames: controlFrames{}, + callFrameStackSizeInUint64: callFrameStackSizeInUint64, + result: CompilationResult{ + Globals: globals, + Functions: functions, + Types: types, + HasMemory: hasMemory, + HasTable: hasTable, + HasDataInstances: hasDataInstances, + HasElementInstances: hasElementInstances, + LabelCallers: map[Label]uint32{}, + }, + globals: globals, + funcs: functions, + types: types, + ensureTermination: ensureTermination, + br: bytes.NewReader(nil), + funcTypeToSigs: funcTypeToIRSignatures{ + indirectCalls: make([]*signature, len(types)), + directCalls: make([]*signature, len(types)), + wasmTypes: types, + }, + needSourceOffset: module.DWARFLines != nil, + } + return c, nil +} + +// Next returns the next CompilationResult for this Compiler. +func (c *Compiler) Next() (*CompilationResult, error) { + funcIndex := c.next + code := &c.module.CodeSection[funcIndex] + sig := &c.types[c.module.FunctionSection[funcIndex]] + + // Reset the previous result. + c.result.Operations = c.result.Operations[:0] + c.result.IROperationSourceOffsetsInWasmBinary = c.result.IROperationSourceOffsetsInWasmBinary[:0] + c.result.UsesMemory = false + // Clears the existing entries in LabelCallers. + for frameID := uint32(0); frameID <= c.currentFrameID; frameID++ { + for k := LabelKind(0); k < LabelKindNum; k++ { + delete(c.result.LabelCallers, NewLabel(k, frameID)) + } + } + // Reset the previous states. + c.pc = 0 + c.currentOpPC = 0 + c.currentFrameID = 0 + c.unreachableState.on, c.unreachableState.depth = false, 0 + + if err := c.compile(sig, code.Body, code.LocalTypes, code.BodyOffsetInCodeSection); err != nil { + return nil, err + } + c.next++ + return &c.result, nil +} + +// Compile lowers given function instance into wazeroir operations +// so that the resulting operations can be consumed by the interpreter +// or the Compiler compilation engine. +func (c *Compiler) compile(sig *wasm.FunctionType, body []byte, localTypes []wasm.ValueType, bodyOffsetInCodeSection uint64) error { + // Set function specific fields. + c.body = body + c.localTypes = localTypes + c.sig = sig + c.bodyOffsetInCodeSection = bodyOffsetInCodeSection + + // Reuses the underlying slices. + c.stack = c.stack[:0] + c.controlFrames.frames = c.controlFrames.frames[:0] + + c.initializeStack() + + // Emit const expressions for locals. + // Note that here we don't take function arguments + // into account, meaning that callers must push + // arguments before entering into the function body. + for _, t := range c.localTypes { + c.emitDefaultValue(t) + } + + // Insert the function control frame. + c.controlFrames.push(controlFrame{ + frameID: c.nextFrameID(), + blockType: c.sig, + kind: controlFrameKindFunction, + }) + + // Now, enter the function body. + for !c.controlFrames.empty() && c.pc < uint64(len(c.body)) { + if err := c.handleInstruction(); err != nil { + return fmt.Errorf("handling instruction: %w", err) + } + } + return nil +} + +// Translate the current Wasm instruction to wazeroir's operations, +// and emit the results into c.results. +func (c *Compiler) handleInstruction() error { + op := c.body[c.pc] + c.currentOpPC = c.pc + if false { + var instName string + if op == wasm.OpcodeVecPrefix { + instName = wasm.VectorInstructionName(c.body[c.pc+1]) + } else if op == wasm.OpcodeMiscPrefix { + instName = wasm.MiscInstructionName(c.body[c.pc+1]) + } else { + instName = wasm.InstructionName(op) + } + fmt.Printf("handling %s, unreachable_state(on=%v,depth=%d), stack=%v\n", + instName, c.unreachableState.on, c.unreachableState.depth, c.stack, + ) + } + + var peekValueType UnsignedType + if len(c.stack) > 0 { + peekValueType = c.stackPeek() + } + + // Modify the stack according the current instruction. + // Note that some instructions will read "index" in + // applyToStack and advance c.pc inside the function. + index, err := c.applyToStack(op) + if err != nil { + return fmt.Errorf("apply stack failed for %s: %w", wasm.InstructionName(op), err) + } + // Now we handle each instruction, and + // emit the corresponding wazeroir operations to the results. +operatorSwitch: + switch op { + case wasm.OpcodeUnreachable: + c.emit(NewOperationUnreachable()) + c.markUnreachable() + case wasm.OpcodeNop: + // Nop is noop! + case wasm.OpcodeBlock: + c.br.Reset(c.body[c.pc+1:]) + bt, num, err := wasm.DecodeBlockType(c.types, c.br, c.enabledFeatures) + if err != nil { + return fmt.Errorf("reading block type for block instruction: %w", err) + } + c.pc += num + + if c.unreachableState.on { + // If it is currently in unreachable, + // just remove the entire block. + c.unreachableState.depth++ + break operatorSwitch + } + + // Create a new frame -- entering this block. + frame := controlFrame{ + frameID: c.nextFrameID(), + originalStackLenWithoutParam: len(c.stack) - len(bt.Params), + kind: controlFrameKindBlockWithoutContinuationLabel, + blockType: bt, + } + c.controlFrames.push(frame) + + case wasm.OpcodeLoop: + c.br.Reset(c.body[c.pc+1:]) + bt, num, err := wasm.DecodeBlockType(c.types, c.br, c.enabledFeatures) + if err != nil { + return fmt.Errorf("reading block type for loop instruction: %w", err) + } + c.pc += num + + if c.unreachableState.on { + // If it is currently in unreachable, + // just remove the entire block. + c.unreachableState.depth++ + break operatorSwitch + } + + // Create a new frame -- entering loop. + frame := controlFrame{ + frameID: c.nextFrameID(), + originalStackLenWithoutParam: len(c.stack) - len(bt.Params), + kind: controlFrameKindLoop, + blockType: bt, + } + c.controlFrames.push(frame) + + // Prep labels for inside and the continuation of this loop. + loopLabel := NewLabel(LabelKindHeader, frame.frameID) + c.result.LabelCallers[loopLabel]++ + + // Emit the branch operation to enter inside the loop. + c.emit(NewOperationBr(loopLabel)) + c.emit(NewOperationLabel(loopLabel)) + + // Insert the exit code check on the loop header, which is the only necessary point in the function body + // to prevent infinite loop. + // + // Note that this is a little aggressive: this checks the exit code regardless the loop header is actually + // the loop. In other words, this checks even when no br/br_if/br_table instructions jumping to this loop + // exist. However, in reality, that shouldn't be an issue since such "noop" loop header will highly likely be + // optimized out by almost all guest language compilers which have the control flow optimization passes. + if c.ensureTermination { + c.emit(NewOperationBuiltinFunctionCheckExitCode()) + } + case wasm.OpcodeIf: + c.br.Reset(c.body[c.pc+1:]) + bt, num, err := wasm.DecodeBlockType(c.types, c.br, c.enabledFeatures) + if err != nil { + return fmt.Errorf("reading block type for if instruction: %w", err) + } + c.pc += num + + if c.unreachableState.on { + // If it is currently in unreachable, + // just remove the entire block. + c.unreachableState.depth++ + break operatorSwitch + } + + // Create a new frame -- entering if. + frame := controlFrame{ + frameID: c.nextFrameID(), + originalStackLenWithoutParam: len(c.stack) - len(bt.Params), + // Note this will be set to controlFrameKindIfWithElse + // when else opcode found later. + kind: controlFrameKindIfWithoutElse, + blockType: bt, + } + c.controlFrames.push(frame) + + // Prep labels for if and else of this if. + thenLabel := NewLabel(LabelKindHeader, frame.frameID) + elseLabel := NewLabel(LabelKindElse, frame.frameID) + c.result.LabelCallers[thenLabel]++ + c.result.LabelCallers[elseLabel]++ + + // Emit the branch operation to enter the then block. + c.emit(NewOperationBrIf(thenLabel, elseLabel, NopInclusiveRange)) + c.emit(NewOperationLabel(thenLabel)) + case wasm.OpcodeElse: + frame := c.controlFrames.top() + if c.unreachableState.on && c.unreachableState.depth > 0 { + // If it is currently in unreachable, and the nested if, + // just remove the entire else block. + break operatorSwitch + } else if c.unreachableState.on { + // If it is currently in unreachable, and the non-nested if, + // reset the stack so we can correctly handle the else block. + top := c.controlFrames.top() + c.stack = c.stack[:top.originalStackLenWithoutParam] + top.kind = controlFrameKindIfWithElse + + // Re-push the parameters to the if block so that else block can use them. + for _, t := range frame.blockType.Params { + c.stackPush(wasmValueTypeToUnsignedType(t)) + } + + // We are no longer unreachable in else frame, + // so emit the correct label, and reset the unreachable state. + elseLabel := NewLabel(LabelKindElse, frame.frameID) + c.resetUnreachable() + c.emit( + NewOperationLabel(elseLabel), + ) + break operatorSwitch + } + + // Change the Kind of this If block, indicating that + // the if has else block. + frame.kind = controlFrameKindIfWithElse + + // We need to reset the stack so that + // the values pushed inside the then block + // do not affect the else block. + dropOp := NewOperationDrop(c.getFrameDropRange(frame, false)) + + // Reset the stack manipulated by the then block, and re-push the block param types to the stack. + + c.stack = c.stack[:frame.originalStackLenWithoutParam] + for _, t := range frame.blockType.Params { + c.stackPush(wasmValueTypeToUnsignedType(t)) + } + + // Prep labels for else and the continuation of this if block. + elseLabel := NewLabel(LabelKindElse, frame.frameID) + continuationLabel := NewLabel(LabelKindContinuation, frame.frameID) + c.result.LabelCallers[continuationLabel]++ + + // Emit the instructions for exiting the if loop, + // and then the initiation of else block. + c.emit(dropOp) + // Jump to the continuation of this block. + c.emit(NewOperationBr(continuationLabel)) + // Initiate the else block. + c.emit(NewOperationLabel(elseLabel)) + case wasm.OpcodeEnd: + if c.unreachableState.on && c.unreachableState.depth > 0 { + c.unreachableState.depth-- + break operatorSwitch + } else if c.unreachableState.on { + c.resetUnreachable() + + frame := c.controlFrames.pop() + if c.controlFrames.empty() { + return nil + } + + c.stack = c.stack[:frame.originalStackLenWithoutParam] + for _, t := range frame.blockType.Results { + c.stackPush(wasmValueTypeToUnsignedType(t)) + } + + continuationLabel := NewLabel(LabelKindContinuation, frame.frameID) + if frame.kind == controlFrameKindIfWithoutElse { + // Emit the else label. + elseLabel := NewLabel(LabelKindElse, frame.frameID) + c.result.LabelCallers[continuationLabel]++ + c.emit(NewOperationLabel(elseLabel)) + c.emit(NewOperationBr(continuationLabel)) + c.emit(NewOperationLabel(continuationLabel)) + } else { + c.emit( + NewOperationLabel(continuationLabel), + ) + } + + break operatorSwitch + } + + frame := c.controlFrames.pop() + + // We need to reset the stack so that + // the values pushed inside the block. + dropOp := NewOperationDrop(c.getFrameDropRange(frame, true)) + c.stack = c.stack[:frame.originalStackLenWithoutParam] + + // Push the result types onto the stack. + for _, t := range frame.blockType.Results { + c.stackPush(wasmValueTypeToUnsignedType(t)) + } + + // Emit the instructions according to the Kind of the current control frame. + switch frame.kind { + case controlFrameKindFunction: + if !c.controlFrames.empty() { + // Should never happen. If so, there's a bug in the translation. + panic("bug: found more function control frames") + } + // Return from function. + c.emit(dropOp) + c.emit(NewOperationBr(NewLabel(LabelKindReturn, 0))) + case controlFrameKindIfWithoutElse: + // This case we have to emit "empty" else label. + elseLabel := NewLabel(LabelKindElse, frame.frameID) + continuationLabel := NewLabel(LabelKindContinuation, frame.frameID) + c.result.LabelCallers[continuationLabel] += 2 + c.emit(dropOp) + c.emit(NewOperationBr(continuationLabel)) + // Emit the else which soon branches into the continuation. + c.emit(NewOperationLabel(elseLabel)) + c.emit(NewOperationBr(continuationLabel)) + // Initiate the continuation. + c.emit(NewOperationLabel(continuationLabel)) + case controlFrameKindBlockWithContinuationLabel, + controlFrameKindIfWithElse: + continuationLabel := NewLabel(LabelKindContinuation, frame.frameID) + c.result.LabelCallers[continuationLabel]++ + c.emit(dropOp) + c.emit(NewOperationBr(continuationLabel)) + c.emit(NewOperationLabel(continuationLabel)) + case controlFrameKindLoop, controlFrameKindBlockWithoutContinuationLabel: + c.emit( + dropOp, + ) + default: + // Should never happen. If so, there's a bug in the translation. + panic(fmt.Errorf("bug: invalid control frame Kind: 0x%x", frame.kind)) + } + + case wasm.OpcodeBr: + targetIndex, n, err := leb128.LoadUint32(c.body[c.pc+1:]) + if err != nil { + return fmt.Errorf("read the target for br_if: %w", err) + } + c.pc += n + + if c.unreachableState.on { + // If it is currently in unreachable, br is no-op. + break operatorSwitch + } + + targetFrame := c.controlFrames.get(int(targetIndex)) + targetFrame.ensureContinuation() + dropOp := NewOperationDrop(c.getFrameDropRange(targetFrame, false)) + targetID := targetFrame.asLabel() + c.result.LabelCallers[targetID]++ + c.emit(dropOp) + c.emit(NewOperationBr(targetID)) + // Br operation is stack-polymorphic, and mark the state as unreachable. + // That means subsequent instructions in the current control frame are "unreachable" + // and can be safely removed. + c.markUnreachable() + case wasm.OpcodeBrIf: + targetIndex, n, err := leb128.LoadUint32(c.body[c.pc+1:]) + if err != nil { + return fmt.Errorf("read the target for br_if: %w", err) + } + c.pc += n + + if c.unreachableState.on { + // If it is currently in unreachable, br-if is no-op. + break operatorSwitch + } + + targetFrame := c.controlFrames.get(int(targetIndex)) + targetFrame.ensureContinuation() + drop := c.getFrameDropRange(targetFrame, false) + target := targetFrame.asLabel() + c.result.LabelCallers[target]++ + + continuationLabel := NewLabel(LabelKindHeader, c.nextFrameID()) + c.result.LabelCallers[continuationLabel]++ + c.emit(NewOperationBrIf(target, continuationLabel, drop)) + // Start emitting else block operations. + c.emit(NewOperationLabel(continuationLabel)) + case wasm.OpcodeBrTable: + c.br.Reset(c.body[c.pc+1:]) + r := c.br + numTargets, n, err := leb128.DecodeUint32(r) + if err != nil { + return fmt.Errorf("error reading number of targets in br_table: %w", err) + } + c.pc += n + + if c.unreachableState.on { + // If it is currently in unreachable, br_table is no-op. + // But before proceeding to the next instruction, we must advance the pc + // according to the number of br_table targets. + for i := uint32(0); i <= numTargets; i++ { // inclusive as we also need to read the index of default target. + _, n, err := leb128.DecodeUint32(r) + if err != nil { + return fmt.Errorf("error reading target %d in br_table: %w", i, err) + } + c.pc += n + } + break operatorSwitch + } + + // Read the branch targets. + s := numTargets * 2 + targetLabels := make([]uint64, 2+s) // (label, InclusiveRange) * (default+numTargets) + for i := uint32(0); i < s; i += 2 { + l, n, err := leb128.DecodeUint32(r) + if err != nil { + return fmt.Errorf("error reading target %d in br_table: %w", i, err) + } + c.pc += n + targetFrame := c.controlFrames.get(int(l)) + targetFrame.ensureContinuation() + drop := c.getFrameDropRange(targetFrame, false) + targetLabel := targetFrame.asLabel() + targetLabels[i] = uint64(targetLabel) + targetLabels[i+1] = drop.AsU64() + c.result.LabelCallers[targetLabel]++ + } + + // Prep default target control frame. + l, n, err := leb128.DecodeUint32(r) + if err != nil { + return fmt.Errorf("error reading default target of br_table: %w", err) + } + c.pc += n + defaultTargetFrame := c.controlFrames.get(int(l)) + defaultTargetFrame.ensureContinuation() + defaultTargetDrop := c.getFrameDropRange(defaultTargetFrame, false) + defaultLabel := defaultTargetFrame.asLabel() + c.result.LabelCallers[defaultLabel]++ + targetLabels[s] = uint64(defaultLabel) + targetLabels[s+1] = defaultTargetDrop.AsU64() + c.emit(NewOperationBrTable(targetLabels)) + + // br_table operation is stack-polymorphic, and mark the state as unreachable. + // That means subsequent instructions in the current control frame are "unreachable" + // and can be safely removed. + c.markUnreachable() + case wasm.OpcodeReturn: + functionFrame := c.controlFrames.functionFrame() + dropOp := NewOperationDrop(c.getFrameDropRange(functionFrame, false)) + + // Cleanup the stack and then jmp to function frame's continuation (meaning return). + c.emit(dropOp) + c.emit(NewOperationBr(functionFrame.asLabel())) + + // Return operation is stack-polymorphic, and mark the state as unreachable. + // That means subsequent instructions in the current control frame are "unreachable" + // and can be safely removed. + c.markUnreachable() + case wasm.OpcodeCall: + c.emit( + NewOperationCall(index), + ) + case wasm.OpcodeCallIndirect: + typeIndex := index + tableIndex, n, err := leb128.LoadUint32(c.body[c.pc+1:]) + if err != nil { + return fmt.Errorf("read target for br_table: %w", err) + } + c.pc += n + c.emit( + NewOperationCallIndirect(typeIndex, tableIndex), + ) + case wasm.OpcodeDrop: + r := InclusiveRange{Start: 0, End: 0} + if peekValueType == UnsignedTypeV128 { + // InclusiveRange is the range in uint64 representation, so dropping a vector value on top + // should be translated as drop [0..1] inclusively. + r.End++ + } + c.emit(NewOperationDrop(r)) + case wasm.OpcodeSelect: + // If it is on the unreachable state, ignore the instruction. + if c.unreachableState.on { + break operatorSwitch + } + isTargetVector := c.stackPeek() == UnsignedTypeV128 + c.emit( + NewOperationSelect(isTargetVector), + ) + case wasm.OpcodeTypedSelect: + // Skips two bytes: vector size fixed to 1, and the value type for select. + c.pc += 2 + // If it is on the unreachable state, ignore the instruction. + if c.unreachableState.on { + break operatorSwitch + } + // Typed select is semantically equivalent to select at runtime. + isTargetVector := c.stackPeek() == UnsignedTypeV128 + c.emit( + NewOperationSelect(isTargetVector), + ) + case wasm.OpcodeLocalGet: + depth := c.localDepth(index) + if isVector := c.localType(index) == wasm.ValueTypeV128; !isVector { + c.emit( + // -1 because we already manipulated the stack before + // called localDepth ^^. + NewOperationPick(depth-1, isVector), + ) + } else { + c.emit( + // -2 because we already manipulated the stack before + // called localDepth ^^. + NewOperationPick(depth-2, isVector), + ) + } + case wasm.OpcodeLocalSet: + depth := c.localDepth(index) + + isVector := c.localType(index) == wasm.ValueTypeV128 + if isVector { + c.emit( + // +2 because we already popped the operands for this operation from the c.stack before + // called localDepth ^^, + NewOperationSet(depth+2, isVector), + ) + } else { + c.emit( + // +1 because we already popped the operands for this operation from the c.stack before + // called localDepth ^^, + NewOperationSet(depth+1, isVector), + ) + } + case wasm.OpcodeLocalTee: + depth := c.localDepth(index) + isVector := c.localType(index) == wasm.ValueTypeV128 + if isVector { + c.emit(NewOperationPick(1, isVector)) + c.emit(NewOperationSet(depth+2, isVector)) + } else { + c.emit( + NewOperationPick(0, isVector)) + c.emit(NewOperationSet(depth+1, isVector)) + } + case wasm.OpcodeGlobalGet: + c.emit( + NewOperationGlobalGet(index), + ) + case wasm.OpcodeGlobalSet: + c.emit( + NewOperationGlobalSet(index), + ) + case wasm.OpcodeI32Load: + imm, err := c.readMemoryArg(wasm.OpcodeI32LoadName) + if err != nil { + return err + } + c.emit(NewOperationLoad(UnsignedTypeI32, imm)) + case wasm.OpcodeI64Load: + imm, err := c.readMemoryArg(wasm.OpcodeI64LoadName) + if err != nil { + return err + } + c.emit(NewOperationLoad(UnsignedTypeI64, imm)) + case wasm.OpcodeF32Load: + imm, err := c.readMemoryArg(wasm.OpcodeF32LoadName) + if err != nil { + return err + } + c.emit(NewOperationLoad(UnsignedTypeF32, imm)) + case wasm.OpcodeF64Load: + imm, err := c.readMemoryArg(wasm.OpcodeF64LoadName) + if err != nil { + return err + } + c.emit(NewOperationLoad(UnsignedTypeF64, imm)) + case wasm.OpcodeI32Load8S: + imm, err := c.readMemoryArg(wasm.OpcodeI32Load8SName) + if err != nil { + return err + } + c.emit(NewOperationLoad8(SignedInt32, imm)) + case wasm.OpcodeI32Load8U: + imm, err := c.readMemoryArg(wasm.OpcodeI32Load8UName) + if err != nil { + return err + } + c.emit(NewOperationLoad8(SignedUint32, imm)) + case wasm.OpcodeI32Load16S: + imm, err := c.readMemoryArg(wasm.OpcodeI32Load16SName) + if err != nil { + return err + } + c.emit(NewOperationLoad16(SignedInt32, imm)) + case wasm.OpcodeI32Load16U: + imm, err := c.readMemoryArg(wasm.OpcodeI32Load16UName) + if err != nil { + return err + } + c.emit(NewOperationLoad16(SignedUint32, imm)) + case wasm.OpcodeI64Load8S: + imm, err := c.readMemoryArg(wasm.OpcodeI64Load8SName) + if err != nil { + return err + } + c.emit(NewOperationLoad8(SignedInt64, imm)) + case wasm.OpcodeI64Load8U: + imm, err := c.readMemoryArg(wasm.OpcodeI64Load8UName) + if err != nil { + return err + } + c.emit(NewOperationLoad8(SignedUint64, imm)) + case wasm.OpcodeI64Load16S: + imm, err := c.readMemoryArg(wasm.OpcodeI64Load16SName) + if err != nil { + return err + } + c.emit(NewOperationLoad16(SignedInt64, imm)) + case wasm.OpcodeI64Load16U: + imm, err := c.readMemoryArg(wasm.OpcodeI64Load16UName) + if err != nil { + return err + } + c.emit(NewOperationLoad16(SignedUint64, imm)) + case wasm.OpcodeI64Load32S: + imm, err := c.readMemoryArg(wasm.OpcodeI64Load32SName) + if err != nil { + return err + } + c.emit(NewOperationLoad32(true, imm)) + case wasm.OpcodeI64Load32U: + imm, err := c.readMemoryArg(wasm.OpcodeI64Load32UName) + if err != nil { + return err + } + c.emit(NewOperationLoad32(false, imm)) + case wasm.OpcodeI32Store: + imm, err := c.readMemoryArg(wasm.OpcodeI32StoreName) + if err != nil { + return err + } + c.emit( + NewOperationStore(UnsignedTypeI32, imm), + ) + case wasm.OpcodeI64Store: + imm, err := c.readMemoryArg(wasm.OpcodeI64StoreName) + if err != nil { + return err + } + c.emit( + NewOperationStore(UnsignedTypeI64, imm), + ) + case wasm.OpcodeF32Store: + imm, err := c.readMemoryArg(wasm.OpcodeF32StoreName) + if err != nil { + return err + } + c.emit( + NewOperationStore(UnsignedTypeF32, imm), + ) + case wasm.OpcodeF64Store: + imm, err := c.readMemoryArg(wasm.OpcodeF64StoreName) + if err != nil { + return err + } + c.emit( + NewOperationStore(UnsignedTypeF64, imm), + ) + case wasm.OpcodeI32Store8: + imm, err := c.readMemoryArg(wasm.OpcodeI32Store8Name) + if err != nil { + return err + } + c.emit( + NewOperationStore8(imm), + ) + case wasm.OpcodeI32Store16: + imm, err := c.readMemoryArg(wasm.OpcodeI32Store16Name) + if err != nil { + return err + } + c.emit( + NewOperationStore16(imm), + ) + case wasm.OpcodeI64Store8: + imm, err := c.readMemoryArg(wasm.OpcodeI64Store8Name) + if err != nil { + return err + } + c.emit( + NewOperationStore8(imm), + ) + case wasm.OpcodeI64Store16: + imm, err := c.readMemoryArg(wasm.OpcodeI64Store16Name) + if err != nil { + return err + } + c.emit( + NewOperationStore16(imm), + ) + case wasm.OpcodeI64Store32: + imm, err := c.readMemoryArg(wasm.OpcodeI64Store32Name) + if err != nil { + return err + } + c.emit( + NewOperationStore32(imm), + ) + case wasm.OpcodeMemorySize: + c.result.UsesMemory = true + c.pc++ // Skip the reserved one byte. + c.emit( + NewOperationMemorySize(), + ) + case wasm.OpcodeMemoryGrow: + c.result.UsesMemory = true + c.pc++ // Skip the reserved one byte. + c.emit( + NewOperationMemoryGrow(), + ) + case wasm.OpcodeI32Const: + val, num, err := leb128.LoadInt32(c.body[c.pc+1:]) + if err != nil { + return fmt.Errorf("reading i32.const value: %v", err) + } + c.pc += num + c.emit( + NewOperationConstI32(uint32(val)), + ) + case wasm.OpcodeI64Const: + val, num, err := leb128.LoadInt64(c.body[c.pc+1:]) + if err != nil { + return fmt.Errorf("reading i64.const value: %v", err) + } + c.pc += num + c.emit( + NewOperationConstI64(uint64(val)), + ) + case wasm.OpcodeF32Const: + v := math.Float32frombits(binary.LittleEndian.Uint32(c.body[c.pc+1:])) + c.pc += 4 + c.emit( + NewOperationConstF32(v), + ) + case wasm.OpcodeF64Const: + v := math.Float64frombits(binary.LittleEndian.Uint64(c.body[c.pc+1:])) + c.pc += 8 + c.emit( + NewOperationConstF64(v), + ) + case wasm.OpcodeI32Eqz: + c.emit( + NewOperationEqz(UnsignedInt32), + ) + case wasm.OpcodeI32Eq: + c.emit( + NewOperationEq(UnsignedTypeI32), + ) + case wasm.OpcodeI32Ne: + c.emit( + NewOperationNe(UnsignedTypeI32), + ) + case wasm.OpcodeI32LtS: + c.emit( + NewOperationLt(SignedTypeInt32), + ) + case wasm.OpcodeI32LtU: + c.emit( + NewOperationLt(SignedTypeUint32), + ) + case wasm.OpcodeI32GtS: + c.emit( + NewOperationGt(SignedTypeInt32), + ) + case wasm.OpcodeI32GtU: + c.emit( + NewOperationGt(SignedTypeUint32), + ) + case wasm.OpcodeI32LeS: + c.emit( + NewOperationLe(SignedTypeInt32), + ) + case wasm.OpcodeI32LeU: + c.emit( + NewOperationLe(SignedTypeUint32), + ) + case wasm.OpcodeI32GeS: + c.emit( + NewOperationGe(SignedTypeInt32), + ) + case wasm.OpcodeI32GeU: + c.emit( + NewOperationGe(SignedTypeUint32), + ) + case wasm.OpcodeI64Eqz: + c.emit( + NewOperationEqz(UnsignedInt64), + ) + case wasm.OpcodeI64Eq: + c.emit( + NewOperationEq(UnsignedTypeI64), + ) + case wasm.OpcodeI64Ne: + c.emit( + NewOperationNe(UnsignedTypeI64), + ) + case wasm.OpcodeI64LtS: + c.emit( + NewOperationLt(SignedTypeInt64), + ) + case wasm.OpcodeI64LtU: + c.emit( + NewOperationLt(SignedTypeUint64), + ) + case wasm.OpcodeI64GtS: + c.emit( + NewOperationGt(SignedTypeInt64), + ) + case wasm.OpcodeI64GtU: + c.emit( + NewOperationGt(SignedTypeUint64), + ) + case wasm.OpcodeI64LeS: + c.emit( + NewOperationLe(SignedTypeInt64), + ) + case wasm.OpcodeI64LeU: + c.emit( + NewOperationLe(SignedTypeUint64), + ) + case wasm.OpcodeI64GeS: + c.emit( + NewOperationGe(SignedTypeInt64), + ) + case wasm.OpcodeI64GeU: + c.emit( + NewOperationGe(SignedTypeUint64), + ) + case wasm.OpcodeF32Eq: + c.emit( + NewOperationEq(UnsignedTypeF32), + ) + case wasm.OpcodeF32Ne: + c.emit( + NewOperationNe(UnsignedTypeF32), + ) + case wasm.OpcodeF32Lt: + c.emit( + NewOperationLt(SignedTypeFloat32), + ) + case wasm.OpcodeF32Gt: + c.emit( + NewOperationGt(SignedTypeFloat32), + ) + case wasm.OpcodeF32Le: + c.emit( + NewOperationLe(SignedTypeFloat32), + ) + case wasm.OpcodeF32Ge: + c.emit( + NewOperationGe(SignedTypeFloat32), + ) + case wasm.OpcodeF64Eq: + c.emit( + NewOperationEq(UnsignedTypeF64), + ) + case wasm.OpcodeF64Ne: + c.emit( + NewOperationNe(UnsignedTypeF64), + ) + case wasm.OpcodeF64Lt: + c.emit( + NewOperationLt(SignedTypeFloat64), + ) + case wasm.OpcodeF64Gt: + c.emit( + NewOperationGt(SignedTypeFloat64), + ) + case wasm.OpcodeF64Le: + c.emit( + NewOperationLe(SignedTypeFloat64), + ) + case wasm.OpcodeF64Ge: + c.emit( + NewOperationGe(SignedTypeFloat64), + ) + case wasm.OpcodeI32Clz: + c.emit( + NewOperationClz(UnsignedInt32), + ) + case wasm.OpcodeI32Ctz: + c.emit( + NewOperationCtz(UnsignedInt32), + ) + case wasm.OpcodeI32Popcnt: + c.emit( + NewOperationPopcnt(UnsignedInt32), + ) + case wasm.OpcodeI32Add: + c.emit( + NewOperationAdd(UnsignedTypeI32), + ) + case wasm.OpcodeI32Sub: + c.emit( + NewOperationSub(UnsignedTypeI32), + ) + case wasm.OpcodeI32Mul: + c.emit( + NewOperationMul(UnsignedTypeI32), + ) + case wasm.OpcodeI32DivS: + c.emit( + NewOperationDiv(SignedTypeInt32), + ) + case wasm.OpcodeI32DivU: + c.emit( + NewOperationDiv(SignedTypeUint32), + ) + case wasm.OpcodeI32RemS: + c.emit( + NewOperationRem(SignedInt32), + ) + case wasm.OpcodeI32RemU: + c.emit( + NewOperationRem(SignedUint32), + ) + case wasm.OpcodeI32And: + c.emit( + NewOperationAnd(UnsignedInt32), + ) + case wasm.OpcodeI32Or: + c.emit( + NewOperationOr(UnsignedInt32), + ) + case wasm.OpcodeI32Xor: + c.emit( + NewOperationXor(UnsignedInt64), + ) + case wasm.OpcodeI32Shl: + c.emit( + NewOperationShl(UnsignedInt32), + ) + case wasm.OpcodeI32ShrS: + c.emit( + NewOperationShr(SignedInt32), + ) + case wasm.OpcodeI32ShrU: + c.emit( + NewOperationShr(SignedUint32), + ) + case wasm.OpcodeI32Rotl: + c.emit( + NewOperationRotl(UnsignedInt32), + ) + case wasm.OpcodeI32Rotr: + c.emit( + NewOperationRotr(UnsignedInt32), + ) + case wasm.OpcodeI64Clz: + c.emit( + NewOperationClz(UnsignedInt64), + ) + case wasm.OpcodeI64Ctz: + c.emit( + NewOperationCtz(UnsignedInt64), + ) + case wasm.OpcodeI64Popcnt: + c.emit( + NewOperationPopcnt(UnsignedInt64), + ) + case wasm.OpcodeI64Add: + c.emit( + NewOperationAdd(UnsignedTypeI64), + ) + case wasm.OpcodeI64Sub: + c.emit( + NewOperationSub(UnsignedTypeI64), + ) + case wasm.OpcodeI64Mul: + c.emit( + NewOperationMul(UnsignedTypeI64), + ) + case wasm.OpcodeI64DivS: + c.emit( + NewOperationDiv(SignedTypeInt64), + ) + case wasm.OpcodeI64DivU: + c.emit( + NewOperationDiv(SignedTypeUint64), + ) + case wasm.OpcodeI64RemS: + c.emit( + NewOperationRem(SignedInt64), + ) + case wasm.OpcodeI64RemU: + c.emit( + NewOperationRem(SignedUint64), + ) + case wasm.OpcodeI64And: + c.emit( + NewOperationAnd(UnsignedInt64), + ) + case wasm.OpcodeI64Or: + c.emit( + NewOperationOr(UnsignedInt64), + ) + case wasm.OpcodeI64Xor: + c.emit( + NewOperationXor(UnsignedInt64), + ) + case wasm.OpcodeI64Shl: + c.emit( + NewOperationShl(UnsignedInt64), + ) + case wasm.OpcodeI64ShrS: + c.emit( + NewOperationShr(SignedInt64), + ) + case wasm.OpcodeI64ShrU: + c.emit( + NewOperationShr(SignedUint64), + ) + case wasm.OpcodeI64Rotl: + c.emit( + NewOperationRotl(UnsignedInt64), + ) + case wasm.OpcodeI64Rotr: + c.emit( + NewOperationRotr(UnsignedInt64), + ) + case wasm.OpcodeF32Abs: + c.emit( + NewOperationAbs(Float32), + ) + case wasm.OpcodeF32Neg: + c.emit( + NewOperationNeg(Float32), + ) + case wasm.OpcodeF32Ceil: + c.emit( + NewOperationCeil(Float32), + ) + case wasm.OpcodeF32Floor: + c.emit( + NewOperationFloor(Float32), + ) + case wasm.OpcodeF32Trunc: + c.emit( + NewOperationTrunc(Float32), + ) + case wasm.OpcodeF32Nearest: + c.emit( + NewOperationNearest(Float32), + ) + case wasm.OpcodeF32Sqrt: + c.emit( + NewOperationSqrt(Float32), + ) + case wasm.OpcodeF32Add: + c.emit( + NewOperationAdd(UnsignedTypeF32), + ) + case wasm.OpcodeF32Sub: + c.emit( + NewOperationSub(UnsignedTypeF32), + ) + case wasm.OpcodeF32Mul: + c.emit( + NewOperationMul(UnsignedTypeF32), + ) + case wasm.OpcodeF32Div: + c.emit( + NewOperationDiv(SignedTypeFloat32), + ) + case wasm.OpcodeF32Min: + c.emit( + NewOperationMin(Float32), + ) + case wasm.OpcodeF32Max: + c.emit( + NewOperationMax(Float32), + ) + case wasm.OpcodeF32Copysign: + c.emit( + NewOperationCopysign(Float32), + ) + case wasm.OpcodeF64Abs: + c.emit( + NewOperationAbs(Float64), + ) + case wasm.OpcodeF64Neg: + c.emit( + NewOperationNeg(Float64), + ) + case wasm.OpcodeF64Ceil: + c.emit( + NewOperationCeil(Float64), + ) + case wasm.OpcodeF64Floor: + c.emit( + NewOperationFloor(Float64), + ) + case wasm.OpcodeF64Trunc: + c.emit( + NewOperationTrunc(Float64), + ) + case wasm.OpcodeF64Nearest: + c.emit( + NewOperationNearest(Float64), + ) + case wasm.OpcodeF64Sqrt: + c.emit( + NewOperationSqrt(Float64), + ) + case wasm.OpcodeF64Add: + c.emit( + NewOperationAdd(UnsignedTypeF64), + ) + case wasm.OpcodeF64Sub: + c.emit( + NewOperationSub(UnsignedTypeF64), + ) + case wasm.OpcodeF64Mul: + c.emit( + NewOperationMul(UnsignedTypeF64), + ) + case wasm.OpcodeF64Div: + c.emit( + NewOperationDiv(SignedTypeFloat64), + ) + case wasm.OpcodeF64Min: + c.emit( + NewOperationMin(Float64), + ) + case wasm.OpcodeF64Max: + c.emit( + NewOperationMax(Float64), + ) + case wasm.OpcodeF64Copysign: + c.emit( + NewOperationCopysign(Float64), + ) + case wasm.OpcodeI32WrapI64: + c.emit( + NewOperationI32WrapFromI64(), + ) + case wasm.OpcodeI32TruncF32S: + c.emit( + NewOperationITruncFromF(Float32, SignedInt32, false), + ) + case wasm.OpcodeI32TruncF32U: + c.emit( + NewOperationITruncFromF(Float32, SignedUint32, false), + ) + case wasm.OpcodeI32TruncF64S: + c.emit( + NewOperationITruncFromF(Float64, SignedInt32, false), + ) + case wasm.OpcodeI32TruncF64U: + c.emit( + NewOperationITruncFromF(Float64, SignedUint32, false), + ) + case wasm.OpcodeI64ExtendI32S: + c.emit( + NewOperationExtend(true), + ) + case wasm.OpcodeI64ExtendI32U: + c.emit( + NewOperationExtend(false), + ) + case wasm.OpcodeI64TruncF32S: + c.emit( + NewOperationITruncFromF(Float32, SignedInt64, false), + ) + case wasm.OpcodeI64TruncF32U: + c.emit( + NewOperationITruncFromF(Float32, SignedUint64, false), + ) + case wasm.OpcodeI64TruncF64S: + c.emit( + NewOperationITruncFromF(Float64, SignedInt64, false), + ) + case wasm.OpcodeI64TruncF64U: + c.emit( + NewOperationITruncFromF(Float64, SignedUint64, false), + ) + case wasm.OpcodeF32ConvertI32S: + c.emit( + NewOperationFConvertFromI(SignedInt32, Float32), + ) + case wasm.OpcodeF32ConvertI32U: + c.emit( + NewOperationFConvertFromI(SignedUint32, Float32), + ) + case wasm.OpcodeF32ConvertI64S: + c.emit( + NewOperationFConvertFromI(SignedInt64, Float32), + ) + case wasm.OpcodeF32ConvertI64U: + c.emit( + NewOperationFConvertFromI(SignedUint64, Float32), + ) + case wasm.OpcodeF32DemoteF64: + c.emit( + NewOperationF32DemoteFromF64(), + ) + case wasm.OpcodeF64ConvertI32S: + c.emit( + NewOperationFConvertFromI(SignedInt32, Float64), + ) + case wasm.OpcodeF64ConvertI32U: + c.emit( + NewOperationFConvertFromI(SignedUint32, Float64), + ) + case wasm.OpcodeF64ConvertI64S: + c.emit( + NewOperationFConvertFromI(SignedInt64, Float64), + ) + case wasm.OpcodeF64ConvertI64U: + c.emit( + NewOperationFConvertFromI(SignedUint64, Float64), + ) + case wasm.OpcodeF64PromoteF32: + c.emit( + NewOperationF64PromoteFromF32(), + ) + case wasm.OpcodeI32ReinterpretF32: + c.emit( + NewOperationI32ReinterpretFromF32(), + ) + case wasm.OpcodeI64ReinterpretF64: + c.emit( + NewOperationI64ReinterpretFromF64(), + ) + case wasm.OpcodeF32ReinterpretI32: + c.emit( + NewOperationF32ReinterpretFromI32(), + ) + case wasm.OpcodeF64ReinterpretI64: + c.emit( + NewOperationF64ReinterpretFromI64(), + ) + case wasm.OpcodeI32Extend8S: + c.emit( + NewOperationSignExtend32From8(), + ) + case wasm.OpcodeI32Extend16S: + c.emit( + NewOperationSignExtend32From16(), + ) + case wasm.OpcodeI64Extend8S: + c.emit( + NewOperationSignExtend64From8(), + ) + case wasm.OpcodeI64Extend16S: + c.emit( + NewOperationSignExtend64From16(), + ) + case wasm.OpcodeI64Extend32S: + c.emit( + NewOperationSignExtend64From32(), + ) + case wasm.OpcodeRefFunc: + c.pc++ + index, num, err := leb128.LoadUint32(c.body[c.pc:]) + if err != nil { + return fmt.Errorf("failed to read function index for ref.func: %v", err) + } + c.pc += num - 1 + c.emit( + NewOperationRefFunc(index), + ) + case wasm.OpcodeRefNull: + c.pc++ // Skip the type of reftype as every ref value is opaque pointer. + c.emit( + NewOperationConstI64(0), + ) + case wasm.OpcodeRefIsNull: + // Simply compare the opaque pointer (i64) with zero. + c.emit( + NewOperationEqz(UnsignedInt64), + ) + case wasm.OpcodeTableGet: + c.pc++ + tableIndex, num, err := leb128.LoadUint32(c.body[c.pc:]) + if err != nil { + return fmt.Errorf("failed to read function index for table.get: %v", err) + } + c.pc += num - 1 + c.emit( + NewOperationTableGet(tableIndex), + ) + case wasm.OpcodeTableSet: + c.pc++ + tableIndex, num, err := leb128.LoadUint32(c.body[c.pc:]) + if err != nil { + return fmt.Errorf("failed to read function index for table.set: %v", err) + } + c.pc += num - 1 + c.emit( + NewOperationTableSet(tableIndex), + ) + case wasm.OpcodeMiscPrefix: + c.pc++ + // A misc opcode is encoded as an unsigned variable 32-bit integer. + miscOp, num, err := leb128.LoadUint32(c.body[c.pc:]) + if err != nil { + return fmt.Errorf("failed to read misc opcode: %v", err) + } + c.pc += num - 1 + switch byte(miscOp) { + case wasm.OpcodeMiscI32TruncSatF32S: + c.emit( + NewOperationITruncFromF(Float32, SignedInt32, true), + ) + case wasm.OpcodeMiscI32TruncSatF32U: + c.emit( + NewOperationITruncFromF(Float32, SignedUint32, true), + ) + case wasm.OpcodeMiscI32TruncSatF64S: + c.emit( + NewOperationITruncFromF(Float64, SignedInt32, true), + ) + case wasm.OpcodeMiscI32TruncSatF64U: + c.emit( + NewOperationITruncFromF(Float64, SignedUint32, true), + ) + case wasm.OpcodeMiscI64TruncSatF32S: + c.emit( + NewOperationITruncFromF(Float32, SignedInt64, true), + ) + case wasm.OpcodeMiscI64TruncSatF32U: + c.emit( + NewOperationITruncFromF(Float32, SignedUint64, true), + ) + case wasm.OpcodeMiscI64TruncSatF64S: + c.emit( + NewOperationITruncFromF(Float64, SignedInt64, true), + ) + case wasm.OpcodeMiscI64TruncSatF64U: + c.emit( + NewOperationITruncFromF(Float64, SignedUint64, true), + ) + case wasm.OpcodeMiscMemoryInit: + c.result.UsesMemory = true + dataIndex, num, err := leb128.LoadUint32(c.body[c.pc+1:]) + if err != nil { + return fmt.Errorf("reading i32.const value: %v", err) + } + c.pc += num + 1 // +1 to skip the memory index which is fixed to zero. + c.emit( + NewOperationMemoryInit(dataIndex), + ) + case wasm.OpcodeMiscDataDrop: + dataIndex, num, err := leb128.LoadUint32(c.body[c.pc+1:]) + if err != nil { + return fmt.Errorf("reading i32.const value: %v", err) + } + c.pc += num + c.emit( + NewOperationDataDrop(dataIndex), + ) + case wasm.OpcodeMiscMemoryCopy: + c.result.UsesMemory = true + c.pc += 2 // +2 to skip two memory indexes which are fixed to zero. + c.emit( + NewOperationMemoryCopy(), + ) + case wasm.OpcodeMiscMemoryFill: + c.result.UsesMemory = true + c.pc += 1 // +1 to skip the memory index which is fixed to zero. + c.emit( + NewOperationMemoryFill(), + ) + case wasm.OpcodeMiscTableInit: + elemIndex, num, err := leb128.LoadUint32(c.body[c.pc+1:]) + if err != nil { + return fmt.Errorf("reading i32.const value: %v", err) + } + c.pc += num + // Read table index which is fixed to zero currently. + tableIndex, num, err := leb128.LoadUint32(c.body[c.pc+1:]) + if err != nil { + return fmt.Errorf("reading i32.const value: %v", err) + } + c.pc += num + c.emit( + NewOperationTableInit(elemIndex, tableIndex), + ) + case wasm.OpcodeMiscElemDrop: + elemIndex, num, err := leb128.LoadUint32(c.body[c.pc+1:]) + if err != nil { + return fmt.Errorf("reading i32.const value: %v", err) + } + c.pc += num + c.emit( + NewOperationElemDrop(elemIndex), + ) + case wasm.OpcodeMiscTableCopy: + // Read the source table inde.g. + dst, num, err := leb128.LoadUint32(c.body[c.pc+1:]) + if err != nil { + return fmt.Errorf("reading i32.const value: %v", err) + } + c.pc += num + // Read the destination table inde.g. + src, num, err := leb128.LoadUint32(c.body[c.pc+1:]) + if err != nil { + return fmt.Errorf("reading i32.const value: %v", err) + } + c.pc += num + c.emit( + NewOperationTableCopy(src, dst), + ) + case wasm.OpcodeMiscTableGrow: + // Read the source table inde.g. + tableIndex, num, err := leb128.LoadUint32(c.body[c.pc+1:]) + if err != nil { + return fmt.Errorf("reading i32.const value: %v", err) + } + c.pc += num + c.emit( + NewOperationTableGrow(tableIndex), + ) + case wasm.OpcodeMiscTableSize: + // Read the source table inde.g. + tableIndex, num, err := leb128.LoadUint32(c.body[c.pc+1:]) + if err != nil { + return fmt.Errorf("reading i32.const value: %v", err) + } + c.pc += num + c.emit( + NewOperationTableSize(tableIndex), + ) + case wasm.OpcodeMiscTableFill: + // Read the source table index. + tableIndex, num, err := leb128.LoadUint32(c.body[c.pc+1:]) + if err != nil { + return fmt.Errorf("reading i32.const value: %v", err) + } + c.pc += num + c.emit( + NewOperationTableFill(tableIndex), + ) + default: + return fmt.Errorf("unsupported misc instruction in wazeroir: 0x%x", op) + } + case wasm.OpcodeVecPrefix: + c.pc++ + switch vecOp := c.body[c.pc]; vecOp { + case wasm.OpcodeVecV128Const: + c.pc++ + lo := binary.LittleEndian.Uint64(c.body[c.pc : c.pc+8]) + c.pc += 8 + hi := binary.LittleEndian.Uint64(c.body[c.pc : c.pc+8]) + c.emit( + NewOperationV128Const(lo, hi), + ) + c.pc += 7 + case wasm.OpcodeVecV128Load: + arg, err := c.readMemoryArg(wasm.OpcodeI32LoadName) + if err != nil { + return err + } + c.emit( + NewOperationV128Load(V128LoadType128, arg), + ) + case wasm.OpcodeVecV128Load8x8s: + arg, err := c.readMemoryArg(wasm.OpcodeVecV128Load8x8SName) + if err != nil { + return err + } + c.emit( + NewOperationV128Load(V128LoadType8x8s, arg), + ) + case wasm.OpcodeVecV128Load8x8u: + arg, err := c.readMemoryArg(wasm.OpcodeVecV128Load8x8UName) + if err != nil { + return err + } + c.emit( + NewOperationV128Load(V128LoadType8x8u, arg), + ) + case wasm.OpcodeVecV128Load16x4s: + arg, err := c.readMemoryArg(wasm.OpcodeVecV128Load16x4SName) + if err != nil { + return err + } + c.emit( + NewOperationV128Load(V128LoadType16x4s, arg), + ) + case wasm.OpcodeVecV128Load16x4u: + arg, err := c.readMemoryArg(wasm.OpcodeVecV128Load16x4UName) + if err != nil { + return err + } + c.emit( + NewOperationV128Load(V128LoadType16x4u, arg), + ) + case wasm.OpcodeVecV128Load32x2s: + arg, err := c.readMemoryArg(wasm.OpcodeVecV128Load32x2SName) + if err != nil { + return err + } + c.emit( + NewOperationV128Load(V128LoadType32x2s, arg), + ) + case wasm.OpcodeVecV128Load32x2u: + arg, err := c.readMemoryArg(wasm.OpcodeVecV128Load32x2UName) + if err != nil { + return err + } + c.emit( + NewOperationV128Load(V128LoadType32x2u, arg), + ) + case wasm.OpcodeVecV128Load8Splat: + arg, err := c.readMemoryArg(wasm.OpcodeVecV128Load8SplatName) + if err != nil { + return err + } + c.emit( + NewOperationV128Load(V128LoadType8Splat, arg), + ) + case wasm.OpcodeVecV128Load16Splat: + arg, err := c.readMemoryArg(wasm.OpcodeVecV128Load16SplatName) + if err != nil { + return err + } + c.emit( + NewOperationV128Load(V128LoadType16Splat, arg), + ) + case wasm.OpcodeVecV128Load32Splat: + arg, err := c.readMemoryArg(wasm.OpcodeVecV128Load32SplatName) + if err != nil { + return err + } + c.emit( + NewOperationV128Load(V128LoadType32Splat, arg), + ) + case wasm.OpcodeVecV128Load64Splat: + arg, err := c.readMemoryArg(wasm.OpcodeVecV128Load64SplatName) + if err != nil { + return err + } + c.emit( + NewOperationV128Load(V128LoadType64Splat, arg), + ) + case wasm.OpcodeVecV128Load32zero: + arg, err := c.readMemoryArg(wasm.OpcodeVecV128Load32zeroName) + if err != nil { + return err + } + c.emit( + NewOperationV128Load(V128LoadType32zero, arg), + ) + case wasm.OpcodeVecV128Load64zero: + arg, err := c.readMemoryArg(wasm.OpcodeVecV128Load64zeroName) + if err != nil { + return err + } + c.emit( + NewOperationV128Load(V128LoadType64zero, arg), + ) + case wasm.OpcodeVecV128Load8Lane: + arg, err := c.readMemoryArg(wasm.OpcodeVecV128Load8LaneName) + if err != nil { + return err + } + c.pc++ + laneIndex := c.body[c.pc] + c.emit( + NewOperationV128LoadLane(laneIndex, 8, arg), + ) + case wasm.OpcodeVecV128Load16Lane: + arg, err := c.readMemoryArg(wasm.OpcodeVecV128Load16LaneName) + if err != nil { + return err + } + c.pc++ + laneIndex := c.body[c.pc] + c.emit( + NewOperationV128LoadLane(laneIndex, 16, arg), + ) + case wasm.OpcodeVecV128Load32Lane: + arg, err := c.readMemoryArg(wasm.OpcodeVecV128Load32LaneName) + if err != nil { + return err + } + c.pc++ + laneIndex := c.body[c.pc] + c.emit( + NewOperationV128LoadLane(laneIndex, 32, arg), + ) + case wasm.OpcodeVecV128Load64Lane: + arg, err := c.readMemoryArg(wasm.OpcodeVecV128Load64LaneName) + if err != nil { + return err + } + c.pc++ + laneIndex := c.body[c.pc] + c.emit( + NewOperationV128LoadLane(laneIndex, 64, arg), + ) + case wasm.OpcodeVecV128Store: + arg, err := c.readMemoryArg(wasm.OpcodeVecV128StoreName) + if err != nil { + return err + } + c.emit( + NewOperationV128Store(arg), + ) + case wasm.OpcodeVecV128Store8Lane: + arg, err := c.readMemoryArg(wasm.OpcodeVecV128Store8LaneName) + if err != nil { + return err + } + c.pc++ + laneIndex := c.body[c.pc] + c.emit( + NewOperationV128StoreLane(laneIndex, 8, arg), + ) + case wasm.OpcodeVecV128Store16Lane: + arg, err := c.readMemoryArg(wasm.OpcodeVecV128Store16LaneName) + if err != nil { + return err + } + c.pc++ + laneIndex := c.body[c.pc] + c.emit( + NewOperationV128StoreLane(laneIndex, 16, arg), + ) + case wasm.OpcodeVecV128Store32Lane: + arg, err := c.readMemoryArg(wasm.OpcodeVecV128Store32LaneName) + if err != nil { + return err + } + c.pc++ + laneIndex := c.body[c.pc] + c.emit( + NewOperationV128StoreLane(laneIndex, 32, arg), + ) + case wasm.OpcodeVecV128Store64Lane: + arg, err := c.readMemoryArg(wasm.OpcodeVecV128Store64LaneName) + if err != nil { + return err + } + c.pc++ + laneIndex := c.body[c.pc] + c.emit( + NewOperationV128StoreLane(laneIndex, 64, arg), + ) + case wasm.OpcodeVecI8x16ExtractLaneS: + c.pc++ + laneIndex := c.body[c.pc] + c.emit( + NewOperationV128ExtractLane(laneIndex, true, ShapeI8x16), + ) + case wasm.OpcodeVecI8x16ExtractLaneU: + c.pc++ + laneIndex := c.body[c.pc] + c.emit( + NewOperationV128ExtractLane(laneIndex, false, ShapeI8x16), + ) + case wasm.OpcodeVecI16x8ExtractLaneS: + c.pc++ + laneIndex := c.body[c.pc] + c.emit( + NewOperationV128ExtractLane(laneIndex, true, ShapeI16x8), + ) + case wasm.OpcodeVecI16x8ExtractLaneU: + c.pc++ + laneIndex := c.body[c.pc] + c.emit( + NewOperationV128ExtractLane(laneIndex, false, ShapeI16x8), + ) + case wasm.OpcodeVecI32x4ExtractLane: + c.pc++ + laneIndex := c.body[c.pc] + c.emit( + NewOperationV128ExtractLane(laneIndex, false, ShapeI32x4), + ) + case wasm.OpcodeVecI64x2ExtractLane: + c.pc++ + laneIndex := c.body[c.pc] + c.emit( + NewOperationV128ExtractLane(laneIndex, false, ShapeI64x2), + ) + case wasm.OpcodeVecF32x4ExtractLane: + c.pc++ + laneIndex := c.body[c.pc] + c.emit( + NewOperationV128ExtractLane(laneIndex, false, ShapeF32x4), + ) + case wasm.OpcodeVecF64x2ExtractLane: + c.pc++ + laneIndex := c.body[c.pc] + c.emit( + NewOperationV128ExtractLane(laneIndex, false, ShapeF64x2), + ) + case wasm.OpcodeVecI8x16ReplaceLane: + c.pc++ + laneIndex := c.body[c.pc] + c.emit( + NewOperationV128ReplaceLane(laneIndex, ShapeI8x16), + ) + case wasm.OpcodeVecI16x8ReplaceLane: + c.pc++ + laneIndex := c.body[c.pc] + c.emit( + NewOperationV128ReplaceLane(laneIndex, ShapeI16x8), + ) + case wasm.OpcodeVecI32x4ReplaceLane: + c.pc++ + laneIndex := c.body[c.pc] + c.emit( + NewOperationV128ReplaceLane(laneIndex, ShapeI32x4), + ) + case wasm.OpcodeVecI64x2ReplaceLane: + c.pc++ + laneIndex := c.body[c.pc] + c.emit( + NewOperationV128ReplaceLane(laneIndex, ShapeI64x2), + ) + case wasm.OpcodeVecF32x4ReplaceLane: + c.pc++ + laneIndex := c.body[c.pc] + c.emit( + NewOperationV128ReplaceLane(laneIndex, ShapeF32x4), + ) + case wasm.OpcodeVecF64x2ReplaceLane: + c.pc++ + laneIndex := c.body[c.pc] + c.emit( + NewOperationV128ReplaceLane(laneIndex, ShapeF64x2), + ) + case wasm.OpcodeVecI8x16Splat: + c.emit( + NewOperationV128Splat(ShapeI8x16), + ) + case wasm.OpcodeVecI16x8Splat: + c.emit( + NewOperationV128Splat(ShapeI16x8), + ) + case wasm.OpcodeVecI32x4Splat: + c.emit( + NewOperationV128Splat(ShapeI32x4), + ) + case wasm.OpcodeVecI64x2Splat: + c.emit( + NewOperationV128Splat(ShapeI64x2), + ) + case wasm.OpcodeVecF32x4Splat: + c.emit( + NewOperationV128Splat(ShapeF32x4), + ) + case wasm.OpcodeVecF64x2Splat: + c.emit( + NewOperationV128Splat(ShapeF64x2), + ) + case wasm.OpcodeVecI8x16Swizzle: + c.emit( + NewOperationV128Swizzle(), + ) + case wasm.OpcodeVecV128i8x16Shuffle: + c.pc++ + lanes := make([]uint64, 16) + for i := uint64(0); i < 16; i++ { + lanes[i] = uint64(c.body[c.pc+i]) + } + op := NewOperationV128Shuffle(lanes) + c.emit(op) + c.pc += 15 + case wasm.OpcodeVecV128AnyTrue: + c.emit( + NewOperationV128AnyTrue(), + ) + case wasm.OpcodeVecI8x16AllTrue: + c.emit( + NewOperationV128AllTrue(ShapeI8x16), + ) + case wasm.OpcodeVecI16x8AllTrue: + c.emit( + NewOperationV128AllTrue(ShapeI16x8), + ) + case wasm.OpcodeVecI32x4AllTrue: + c.emit( + NewOperationV128AllTrue(ShapeI32x4), + ) + case wasm.OpcodeVecI64x2AllTrue: + c.emit( + NewOperationV128AllTrue(ShapeI64x2), + ) + case wasm.OpcodeVecI8x16BitMask: + c.emit( + NewOperationV128BitMask(ShapeI8x16), + ) + case wasm.OpcodeVecI16x8BitMask: + c.emit( + NewOperationV128BitMask(ShapeI16x8), + ) + case wasm.OpcodeVecI32x4BitMask: + c.emit( + NewOperationV128BitMask(ShapeI32x4), + ) + case wasm.OpcodeVecI64x2BitMask: + c.emit( + NewOperationV128BitMask(ShapeI64x2), + ) + case wasm.OpcodeVecV128And: + c.emit( + NewOperationV128And(), + ) + case wasm.OpcodeVecV128Not: + c.emit( + NewOperationV128Not(), + ) + case wasm.OpcodeVecV128Or: + c.emit( + NewOperationV128Or(), + ) + case wasm.OpcodeVecV128Xor: + c.emit( + NewOperationV128Xor(), + ) + case wasm.OpcodeVecV128Bitselect: + c.emit( + NewOperationV128Bitselect(), + ) + case wasm.OpcodeVecV128AndNot: + c.emit( + NewOperationV128AndNot(), + ) + case wasm.OpcodeVecI8x16Shl: + c.emit( + NewOperationV128Shl(ShapeI8x16), + ) + case wasm.OpcodeVecI8x16ShrS: + c.emit( + NewOperationV128Shr(ShapeI8x16, true), + ) + case wasm.OpcodeVecI8x16ShrU: + c.emit( + NewOperationV128Shr(ShapeI8x16, false), + ) + case wasm.OpcodeVecI16x8Shl: + c.emit( + NewOperationV128Shl(ShapeI16x8), + ) + case wasm.OpcodeVecI16x8ShrS: + c.emit( + NewOperationV128Shr(ShapeI16x8, true), + ) + case wasm.OpcodeVecI16x8ShrU: + c.emit( + NewOperationV128Shr(ShapeI16x8, false), + ) + case wasm.OpcodeVecI32x4Shl: + c.emit( + NewOperationV128Shl(ShapeI32x4), + ) + case wasm.OpcodeVecI32x4ShrS: + c.emit( + NewOperationV128Shr(ShapeI32x4, true), + ) + case wasm.OpcodeVecI32x4ShrU: + c.emit( + NewOperationV128Shr(ShapeI32x4, false), + ) + case wasm.OpcodeVecI64x2Shl: + c.emit( + NewOperationV128Shl(ShapeI64x2), + ) + case wasm.OpcodeVecI64x2ShrS: + c.emit( + NewOperationV128Shr(ShapeI64x2, true), + ) + case wasm.OpcodeVecI64x2ShrU: + c.emit( + NewOperationV128Shr(ShapeI64x2, false), + ) + case wasm.OpcodeVecI8x16Eq: + c.emit( + NewOperationV128Cmp(V128CmpTypeI8x16Eq), + ) + case wasm.OpcodeVecI8x16Ne: + c.emit( + NewOperationV128Cmp(V128CmpTypeI8x16Ne), + ) + case wasm.OpcodeVecI8x16LtS: + c.emit( + NewOperationV128Cmp(V128CmpTypeI8x16LtS), + ) + case wasm.OpcodeVecI8x16LtU: + c.emit( + NewOperationV128Cmp(V128CmpTypeI8x16LtU), + ) + case wasm.OpcodeVecI8x16GtS: + c.emit( + NewOperationV128Cmp(V128CmpTypeI8x16GtS), + ) + case wasm.OpcodeVecI8x16GtU: + c.emit( + NewOperationV128Cmp(V128CmpTypeI8x16GtU), + ) + case wasm.OpcodeVecI8x16LeS: + c.emit( + NewOperationV128Cmp(V128CmpTypeI8x16LeS), + ) + case wasm.OpcodeVecI8x16LeU: + c.emit( + NewOperationV128Cmp(V128CmpTypeI8x16LeU), + ) + case wasm.OpcodeVecI8x16GeS: + c.emit( + NewOperationV128Cmp(V128CmpTypeI8x16GeS), + ) + case wasm.OpcodeVecI8x16GeU: + c.emit( + NewOperationV128Cmp(V128CmpTypeI8x16GeU), + ) + case wasm.OpcodeVecI16x8Eq: + c.emit( + NewOperationV128Cmp(V128CmpTypeI16x8Eq), + ) + case wasm.OpcodeVecI16x8Ne: + c.emit( + NewOperationV128Cmp(V128CmpTypeI16x8Ne), + ) + case wasm.OpcodeVecI16x8LtS: + c.emit( + NewOperationV128Cmp(V128CmpTypeI16x8LtS), + ) + case wasm.OpcodeVecI16x8LtU: + c.emit( + NewOperationV128Cmp(V128CmpTypeI16x8LtU), + ) + case wasm.OpcodeVecI16x8GtS: + c.emit( + NewOperationV128Cmp(V128CmpTypeI16x8GtS), + ) + case wasm.OpcodeVecI16x8GtU: + c.emit( + NewOperationV128Cmp(V128CmpTypeI16x8GtU), + ) + case wasm.OpcodeVecI16x8LeS: + c.emit( + NewOperationV128Cmp(V128CmpTypeI16x8LeS), + ) + case wasm.OpcodeVecI16x8LeU: + c.emit( + NewOperationV128Cmp(V128CmpTypeI16x8LeU), + ) + case wasm.OpcodeVecI16x8GeS: + c.emit( + NewOperationV128Cmp(V128CmpTypeI16x8GeS), + ) + case wasm.OpcodeVecI16x8GeU: + c.emit( + NewOperationV128Cmp(V128CmpTypeI16x8GeU), + ) + case wasm.OpcodeVecI32x4Eq: + c.emit( + NewOperationV128Cmp(V128CmpTypeI32x4Eq), + ) + case wasm.OpcodeVecI32x4Ne: + c.emit( + NewOperationV128Cmp(V128CmpTypeI32x4Ne), + ) + case wasm.OpcodeVecI32x4LtS: + c.emit( + NewOperationV128Cmp(V128CmpTypeI32x4LtS), + ) + case wasm.OpcodeVecI32x4LtU: + c.emit( + NewOperationV128Cmp(V128CmpTypeI32x4LtU), + ) + case wasm.OpcodeVecI32x4GtS: + c.emit( + NewOperationV128Cmp(V128CmpTypeI32x4GtS), + ) + case wasm.OpcodeVecI32x4GtU: + c.emit( + NewOperationV128Cmp(V128CmpTypeI32x4GtU), + ) + case wasm.OpcodeVecI32x4LeS: + c.emit( + NewOperationV128Cmp(V128CmpTypeI32x4LeS), + ) + case wasm.OpcodeVecI32x4LeU: + c.emit( + NewOperationV128Cmp(V128CmpTypeI32x4LeU), + ) + case wasm.OpcodeVecI32x4GeS: + c.emit( + NewOperationV128Cmp(V128CmpTypeI32x4GeS), + ) + case wasm.OpcodeVecI32x4GeU: + c.emit( + NewOperationV128Cmp(V128CmpTypeI32x4GeU), + ) + case wasm.OpcodeVecI64x2Eq: + c.emit( + NewOperationV128Cmp(V128CmpTypeI64x2Eq), + ) + case wasm.OpcodeVecI64x2Ne: + c.emit( + NewOperationV128Cmp(V128CmpTypeI64x2Ne), + ) + case wasm.OpcodeVecI64x2LtS: + c.emit( + NewOperationV128Cmp(V128CmpTypeI64x2LtS), + ) + case wasm.OpcodeVecI64x2GtS: + c.emit( + NewOperationV128Cmp(V128CmpTypeI64x2GtS), + ) + case wasm.OpcodeVecI64x2LeS: + c.emit( + NewOperationV128Cmp(V128CmpTypeI64x2LeS), + ) + case wasm.OpcodeVecI64x2GeS: + c.emit( + NewOperationV128Cmp(V128CmpTypeI64x2GeS), + ) + case wasm.OpcodeVecF32x4Eq: + c.emit( + NewOperationV128Cmp(V128CmpTypeF32x4Eq), + ) + case wasm.OpcodeVecF32x4Ne: + c.emit( + NewOperationV128Cmp(V128CmpTypeF32x4Ne), + ) + case wasm.OpcodeVecF32x4Lt: + c.emit( + NewOperationV128Cmp(V128CmpTypeF32x4Lt), + ) + case wasm.OpcodeVecF32x4Gt: + c.emit( + NewOperationV128Cmp(V128CmpTypeF32x4Gt), + ) + case wasm.OpcodeVecF32x4Le: + c.emit( + NewOperationV128Cmp(V128CmpTypeF32x4Le), + ) + case wasm.OpcodeVecF32x4Ge: + c.emit( + NewOperationV128Cmp(V128CmpTypeF32x4Ge), + ) + case wasm.OpcodeVecF64x2Eq: + c.emit( + NewOperationV128Cmp(V128CmpTypeF64x2Eq), + ) + case wasm.OpcodeVecF64x2Ne: + c.emit( + NewOperationV128Cmp(V128CmpTypeF64x2Ne), + ) + case wasm.OpcodeVecF64x2Lt: + c.emit( + NewOperationV128Cmp(V128CmpTypeF64x2Lt), + ) + case wasm.OpcodeVecF64x2Gt: + c.emit( + NewOperationV128Cmp(V128CmpTypeF64x2Gt), + ) + case wasm.OpcodeVecF64x2Le: + c.emit( + NewOperationV128Cmp(V128CmpTypeF64x2Le), + ) + case wasm.OpcodeVecF64x2Ge: + c.emit( + NewOperationV128Cmp(V128CmpTypeF64x2Ge), + ) + case wasm.OpcodeVecI8x16Neg: + c.emit( + NewOperationV128Neg(ShapeI8x16), + ) + case wasm.OpcodeVecI16x8Neg: + c.emit( + NewOperationV128Neg(ShapeI16x8), + ) + case wasm.OpcodeVecI32x4Neg: + c.emit( + NewOperationV128Neg(ShapeI32x4), + ) + case wasm.OpcodeVecI64x2Neg: + c.emit( + NewOperationV128Neg(ShapeI64x2), + ) + case wasm.OpcodeVecF32x4Neg: + c.emit( + NewOperationV128Neg(ShapeF32x4), + ) + case wasm.OpcodeVecF64x2Neg: + c.emit( + NewOperationV128Neg(ShapeF64x2), + ) + case wasm.OpcodeVecI8x16Add: + c.emit( + NewOperationV128Add(ShapeI8x16), + ) + case wasm.OpcodeVecI16x8Add: + c.emit( + NewOperationV128Add(ShapeI16x8), + ) + case wasm.OpcodeVecI32x4Add: + c.emit( + NewOperationV128Add(ShapeI32x4), + ) + case wasm.OpcodeVecI64x2Add: + c.emit( + NewOperationV128Add(ShapeI64x2), + ) + case wasm.OpcodeVecF32x4Add: + c.emit( + NewOperationV128Add(ShapeF32x4), + ) + case wasm.OpcodeVecF64x2Add: + c.emit( + NewOperationV128Add(ShapeF64x2), + ) + case wasm.OpcodeVecI8x16Sub: + c.emit( + NewOperationV128Sub(ShapeI8x16), + ) + case wasm.OpcodeVecI16x8Sub: + c.emit( + NewOperationV128Sub(ShapeI16x8), + ) + case wasm.OpcodeVecI32x4Sub: + c.emit( + NewOperationV128Sub(ShapeI32x4), + ) + case wasm.OpcodeVecI64x2Sub: + c.emit( + NewOperationV128Sub(ShapeI64x2), + ) + case wasm.OpcodeVecF32x4Sub: + c.emit( + NewOperationV128Sub(ShapeF32x4), + ) + case wasm.OpcodeVecF64x2Sub: + c.emit( + NewOperationV128Sub(ShapeF64x2), + ) + case wasm.OpcodeVecI8x16AddSatS: + c.emit( + NewOperationV128AddSat(ShapeI8x16, true), + ) + case wasm.OpcodeVecI8x16AddSatU: + c.emit( + NewOperationV128AddSat(ShapeI8x16, false), + ) + case wasm.OpcodeVecI16x8AddSatS: + c.emit( + NewOperationV128AddSat(ShapeI16x8, true), + ) + case wasm.OpcodeVecI16x8AddSatU: + c.emit( + NewOperationV128AddSat(ShapeI16x8, false), + ) + case wasm.OpcodeVecI8x16SubSatS: + c.emit( + NewOperationV128SubSat(ShapeI8x16, true), + ) + case wasm.OpcodeVecI8x16SubSatU: + c.emit( + NewOperationV128SubSat(ShapeI8x16, false), + ) + case wasm.OpcodeVecI16x8SubSatS: + c.emit( + NewOperationV128SubSat(ShapeI16x8, true), + ) + case wasm.OpcodeVecI16x8SubSatU: + c.emit( + NewOperationV128SubSat(ShapeI16x8, false), + ) + case wasm.OpcodeVecI16x8Mul: + c.emit( + NewOperationV128Mul(ShapeI16x8), + ) + case wasm.OpcodeVecI32x4Mul: + c.emit( + NewOperationV128Mul(ShapeI32x4), + ) + case wasm.OpcodeVecI64x2Mul: + c.emit( + NewOperationV128Mul(ShapeI64x2), + ) + case wasm.OpcodeVecF32x4Mul: + c.emit( + NewOperationV128Mul(ShapeF32x4), + ) + case wasm.OpcodeVecF64x2Mul: + c.emit( + NewOperationV128Mul(ShapeF64x2), + ) + case wasm.OpcodeVecF32x4Sqrt: + c.emit( + NewOperationV128Sqrt(ShapeF32x4), + ) + case wasm.OpcodeVecF64x2Sqrt: + c.emit( + NewOperationV128Sqrt(ShapeF64x2), + ) + case wasm.OpcodeVecF32x4Div: + c.emit( + NewOperationV128Div(ShapeF32x4), + ) + case wasm.OpcodeVecF64x2Div: + c.emit( + NewOperationV128Div(ShapeF64x2), + ) + case wasm.OpcodeVecI8x16Abs: + c.emit( + NewOperationV128Abs(ShapeI8x16), + ) + case wasm.OpcodeVecI8x16Popcnt: + c.emit( + NewOperationV128Popcnt(ShapeI8x16), + ) + case wasm.OpcodeVecI16x8Abs: + c.emit( + NewOperationV128Abs(ShapeI16x8), + ) + case wasm.OpcodeVecI32x4Abs: + c.emit( + NewOperationV128Abs(ShapeI32x4), + ) + case wasm.OpcodeVecI64x2Abs: + c.emit( + NewOperationV128Abs(ShapeI64x2), + ) + case wasm.OpcodeVecF32x4Abs: + c.emit( + NewOperationV128Abs(ShapeF32x4), + ) + case wasm.OpcodeVecF64x2Abs: + c.emit( + NewOperationV128Abs(ShapeF64x2), + ) + case wasm.OpcodeVecI8x16MinS: + c.emit( + NewOperationV128Min(ShapeI8x16, true), + ) + case wasm.OpcodeVecI8x16MinU: + c.emit( + NewOperationV128Min(ShapeI8x16, false), + ) + case wasm.OpcodeVecI8x16MaxS: + c.emit( + NewOperationV128Max(ShapeI8x16, true), + ) + case wasm.OpcodeVecI8x16MaxU: + c.emit( + NewOperationV128Max(ShapeI8x16, false), + ) + case wasm.OpcodeVecI8x16AvgrU: + c.emit( + NewOperationV128AvgrU(ShapeI8x16), + ) + case wasm.OpcodeVecI16x8MinS: + c.emit( + NewOperationV128Min(ShapeI16x8, true), + ) + case wasm.OpcodeVecI16x8MinU: + c.emit( + NewOperationV128Min(ShapeI16x8, false), + ) + case wasm.OpcodeVecI16x8MaxS: + c.emit( + NewOperationV128Max(ShapeI16x8, true), + ) + case wasm.OpcodeVecI16x8MaxU: + c.emit( + NewOperationV128Max(ShapeI16x8, false), + ) + case wasm.OpcodeVecI16x8AvgrU: + c.emit( + NewOperationV128AvgrU(ShapeI16x8), + ) + case wasm.OpcodeVecI32x4MinS: + c.emit( + NewOperationV128Min(ShapeI32x4, true), + ) + case wasm.OpcodeVecI32x4MinU: + c.emit( + NewOperationV128Min(ShapeI32x4, false), + ) + case wasm.OpcodeVecI32x4MaxS: + c.emit( + NewOperationV128Max(ShapeI32x4, true), + ) + case wasm.OpcodeVecI32x4MaxU: + c.emit( + NewOperationV128Max(ShapeI32x4, false), + ) + case wasm.OpcodeVecF32x4Min: + c.emit( + NewOperationV128Min(ShapeF32x4, false), + ) + case wasm.OpcodeVecF32x4Max: + c.emit( + NewOperationV128Max(ShapeF32x4, false), + ) + case wasm.OpcodeVecF64x2Min: + c.emit( + NewOperationV128Min(ShapeF64x2, false), + ) + case wasm.OpcodeVecF64x2Max: + c.emit( + NewOperationV128Max(ShapeF64x2, false), + ) + case wasm.OpcodeVecF32x4Pmin: + c.emit( + NewOperationV128Pmin(ShapeF32x4), + ) + case wasm.OpcodeVecF32x4Pmax: + c.emit( + NewOperationV128Pmax(ShapeF32x4), + ) + case wasm.OpcodeVecF64x2Pmin: + c.emit( + NewOperationV128Pmin(ShapeF64x2), + ) + case wasm.OpcodeVecF64x2Pmax: + c.emit( + NewOperationV128Pmax(ShapeF64x2), + ) + case wasm.OpcodeVecF32x4Ceil: + c.emit( + NewOperationV128Ceil(ShapeF32x4), + ) + case wasm.OpcodeVecF32x4Floor: + c.emit( + NewOperationV128Floor(ShapeF32x4), + ) + case wasm.OpcodeVecF32x4Trunc: + c.emit( + NewOperationV128Trunc(ShapeF32x4), + ) + case wasm.OpcodeVecF32x4Nearest: + c.emit( + NewOperationV128Nearest(ShapeF32x4), + ) + case wasm.OpcodeVecF64x2Ceil: + c.emit( + NewOperationV128Ceil(ShapeF64x2), + ) + case wasm.OpcodeVecF64x2Floor: + c.emit( + NewOperationV128Floor(ShapeF64x2), + ) + case wasm.OpcodeVecF64x2Trunc: + c.emit( + NewOperationV128Trunc(ShapeF64x2), + ) + case wasm.OpcodeVecF64x2Nearest: + c.emit( + NewOperationV128Nearest(ShapeF64x2), + ) + case wasm.OpcodeVecI16x8ExtendLowI8x16S: + c.emit( + NewOperationV128Extend(ShapeI8x16, true, true), + ) + case wasm.OpcodeVecI16x8ExtendHighI8x16S: + c.emit( + NewOperationV128Extend(ShapeI8x16, true, false), + ) + case wasm.OpcodeVecI16x8ExtendLowI8x16U: + c.emit( + NewOperationV128Extend(ShapeI8x16, false, true), + ) + case wasm.OpcodeVecI16x8ExtendHighI8x16U: + c.emit( + NewOperationV128Extend(ShapeI8x16, false, false), + ) + case wasm.OpcodeVecI32x4ExtendLowI16x8S: + c.emit( + NewOperationV128Extend(ShapeI16x8, true, true), + ) + case wasm.OpcodeVecI32x4ExtendHighI16x8S: + c.emit( + NewOperationV128Extend(ShapeI16x8, true, false), + ) + case wasm.OpcodeVecI32x4ExtendLowI16x8U: + c.emit( + NewOperationV128Extend(ShapeI16x8, false, true), + ) + case wasm.OpcodeVecI32x4ExtendHighI16x8U: + c.emit( + NewOperationV128Extend(ShapeI16x8, false, false), + ) + case wasm.OpcodeVecI64x2ExtendLowI32x4S: + c.emit( + NewOperationV128Extend(ShapeI32x4, true, true), + ) + case wasm.OpcodeVecI64x2ExtendHighI32x4S: + c.emit( + NewOperationV128Extend(ShapeI32x4, true, false), + ) + case wasm.OpcodeVecI64x2ExtendLowI32x4U: + c.emit( + NewOperationV128Extend(ShapeI32x4, false, true), + ) + case wasm.OpcodeVecI64x2ExtendHighI32x4U: + c.emit( + NewOperationV128Extend(ShapeI32x4, false, false), + ) + case wasm.OpcodeVecI16x8Q15mulrSatS: + c.emit( + NewOperationV128Q15mulrSatS(), + ) + case wasm.OpcodeVecI16x8ExtMulLowI8x16S: + c.emit( + NewOperationV128ExtMul(ShapeI8x16, true, true), + ) + case wasm.OpcodeVecI16x8ExtMulHighI8x16S: + c.emit( + NewOperationV128ExtMul(ShapeI8x16, true, false), + ) + case wasm.OpcodeVecI16x8ExtMulLowI8x16U: + c.emit( + NewOperationV128ExtMul(ShapeI8x16, false, true), + ) + case wasm.OpcodeVecI16x8ExtMulHighI8x16U: + c.emit( + NewOperationV128ExtMul(ShapeI8x16, false, false), + ) + case wasm.OpcodeVecI32x4ExtMulLowI16x8S: + c.emit( + NewOperationV128ExtMul(ShapeI16x8, true, true), + ) + case wasm.OpcodeVecI32x4ExtMulHighI16x8S: + c.emit( + NewOperationV128ExtMul(ShapeI16x8, true, false), + ) + case wasm.OpcodeVecI32x4ExtMulLowI16x8U: + c.emit( + NewOperationV128ExtMul(ShapeI16x8, false, true), + ) + case wasm.OpcodeVecI32x4ExtMulHighI16x8U: + c.emit( + NewOperationV128ExtMul(ShapeI16x8, false, false), + ) + case wasm.OpcodeVecI64x2ExtMulLowI32x4S: + c.emit( + NewOperationV128ExtMul(ShapeI32x4, true, true), + ) + case wasm.OpcodeVecI64x2ExtMulHighI32x4S: + c.emit( + NewOperationV128ExtMul(ShapeI32x4, true, false), + ) + case wasm.OpcodeVecI64x2ExtMulLowI32x4U: + c.emit( + NewOperationV128ExtMul(ShapeI32x4, false, true), + ) + case wasm.OpcodeVecI64x2ExtMulHighI32x4U: + c.emit( + NewOperationV128ExtMul(ShapeI32x4, false, false), + ) + case wasm.OpcodeVecI16x8ExtaddPairwiseI8x16S: + c.emit( + NewOperationV128ExtAddPairwise(ShapeI8x16, true), + ) + case wasm.OpcodeVecI16x8ExtaddPairwiseI8x16U: + c.emit( + NewOperationV128ExtAddPairwise(ShapeI8x16, false), + ) + case wasm.OpcodeVecI32x4ExtaddPairwiseI16x8S: + c.emit( + NewOperationV128ExtAddPairwise(ShapeI16x8, true), + ) + case wasm.OpcodeVecI32x4ExtaddPairwiseI16x8U: + c.emit( + NewOperationV128ExtAddPairwise(ShapeI16x8, false), + ) + case wasm.OpcodeVecF64x2PromoteLowF32x4Zero: + c.emit( + NewOperationV128FloatPromote(), + ) + case wasm.OpcodeVecF32x4DemoteF64x2Zero: + c.emit( + NewOperationV128FloatDemote(), + ) + case wasm.OpcodeVecF32x4ConvertI32x4S: + c.emit( + NewOperationV128FConvertFromI(ShapeF32x4, true), + ) + case wasm.OpcodeVecF32x4ConvertI32x4U: + c.emit( + NewOperationV128FConvertFromI(ShapeF32x4, false), + ) + case wasm.OpcodeVecF64x2ConvertLowI32x4S: + c.emit( + NewOperationV128FConvertFromI(ShapeF64x2, true), + ) + case wasm.OpcodeVecF64x2ConvertLowI32x4U: + c.emit( + NewOperationV128FConvertFromI(ShapeF64x2, false), + ) + case wasm.OpcodeVecI32x4DotI16x8S: + c.emit( + NewOperationV128Dot(), + ) + case wasm.OpcodeVecI8x16NarrowI16x8S: + c.emit( + NewOperationV128Narrow(ShapeI16x8, true), + ) + case wasm.OpcodeVecI8x16NarrowI16x8U: + c.emit( + NewOperationV128Narrow(ShapeI16x8, false), + ) + case wasm.OpcodeVecI16x8NarrowI32x4S: + c.emit( + NewOperationV128Narrow(ShapeI32x4, true), + ) + case wasm.OpcodeVecI16x8NarrowI32x4U: + c.emit( + NewOperationV128Narrow(ShapeI32x4, false), + ) + case wasm.OpcodeVecI32x4TruncSatF32x4S: + c.emit( + NewOperationV128ITruncSatFromF(ShapeF32x4, true), + ) + case wasm.OpcodeVecI32x4TruncSatF32x4U: + c.emit( + NewOperationV128ITruncSatFromF(ShapeF32x4, false), + ) + case wasm.OpcodeVecI32x4TruncSatF64x2SZero: + c.emit( + NewOperationV128ITruncSatFromF(ShapeF64x2, true), + ) + case wasm.OpcodeVecI32x4TruncSatF64x2UZero: + c.emit( + NewOperationV128ITruncSatFromF(ShapeF64x2, false), + ) + default: + return fmt.Errorf("unsupported vector instruction in wazeroir: %s", wasm.VectorInstructionName(vecOp)) + } + default: + return fmt.Errorf("unsupported instruction in wazeroir: 0x%x", op) + } + + // Move the program counter to point to the next instruction. + c.pc++ + return nil +} + +func (c *Compiler) nextFrameID() (id uint32) { + id = c.currentFrameID + 1 + c.currentFrameID++ + return +} + +func (c *Compiler) applyToStack(opcode wasm.Opcode) (index uint32, err error) { + switch opcode { + case + // These are the opcodes that is coupled with "index"怀immediate + // and it DOES affect the signature of opcode. + wasm.OpcodeCall, + wasm.OpcodeCallIndirect, + wasm.OpcodeLocalGet, + wasm.OpcodeLocalSet, + wasm.OpcodeLocalTee, + wasm.OpcodeGlobalGet, + wasm.OpcodeGlobalSet: + // Assumes that we are at the opcode now so skip it before read immediates. + v, num, err := leb128.LoadUint32(c.body[c.pc+1:]) + if err != nil { + return 0, fmt.Errorf("reading immediates: %w", err) + } + c.pc += num + index = v + default: + // Note that other opcodes are free of index + // as it doesn't affect the signature of opt code. + // In other words, the "index" argument of wasmOpcodeSignature + // is ignored there. + } + + if c.unreachableState.on { + return 0, nil + } + + // Retrieve the signature of the opcode. + s, err := c.wasmOpcodeSignature(opcode, index) + if err != nil { + return 0, err + } + + // Manipulate the stack according to the signature. + // Note that the following algorithm assumes that + // the unknown type is unique in the signature, + // and is determined by the actual type on the stack. + // The determined type is stored in this typeParam. + var typeParam UnsignedType + var typeParamFound bool + for i := range s.in { + want := s.in[len(s.in)-1-i] + actual := c.stackPop() + if want == UnsignedTypeUnknown && typeParamFound { + want = typeParam + } else if want == UnsignedTypeUnknown { + want = actual + typeParam = want + typeParamFound = true + } + if want != actual { + return 0, fmt.Errorf("input signature mismatch: want %s but have %s", want, actual) + } + } + + for _, target := range s.out { + if target == UnsignedTypeUnknown && !typeParamFound { + return 0, fmt.Errorf("cannot determine type of unknown result") + } else if target == UnsignedTypeUnknown { + c.stackPush(typeParam) + } else { + c.stackPush(target) + } + } + + return index, nil +} + +func (c *Compiler) stackPeek() (ret UnsignedType) { + ret = c.stack[len(c.stack)-1] + return +} + +func (c *Compiler) stackPop() (ret UnsignedType) { + // No need to check stack bound + // as we can assume that all the operations + // are valid thanks to validateFunction + // at module validation phase. + ret = c.stack[len(c.stack)-1] + c.stack = c.stack[:len(c.stack)-1] + return +} + +func (c *Compiler) stackPush(ts UnsignedType) { + c.stack = append(c.stack, ts) +} + +// emit adds the operations into the result. +func (c *Compiler) emit(op UnionOperation) { + if !c.unreachableState.on { + switch op.Kind { + case OperationKindDrop: + // If the drop range is nil, + // we could remove such operations. + // That happens when drop operation is unnecessary. + // i.e. when there's no need to adjust stack before jmp. + if int64(op.U1) == -1 { + return + } + } + c.result.Operations = append(c.result.Operations, op) + if c.needSourceOffset { + c.result.IROperationSourceOffsetsInWasmBinary = append(c.result.IROperationSourceOffsetsInWasmBinary, + c.currentOpPC+c.bodyOffsetInCodeSection) + } + } +} + +// Emit const expression with default values of the given type. +func (c *Compiler) emitDefaultValue(t wasm.ValueType) { + switch t { + case wasm.ValueTypeI32: + c.stackPush(UnsignedTypeI32) + c.emit(NewOperationConstI32(0)) + case wasm.ValueTypeI64, wasm.ValueTypeExternref, wasm.ValueTypeFuncref: + c.stackPush(UnsignedTypeI64) + c.emit(NewOperationConstI64(0)) + case wasm.ValueTypeF32: + c.stackPush(UnsignedTypeF32) + c.emit(NewOperationConstF32(0)) + case wasm.ValueTypeF64: + c.stackPush(UnsignedTypeF64) + c.emit(NewOperationConstF64(0)) + case wasm.ValueTypeV128: + c.stackPush(UnsignedTypeV128) + c.emit(NewOperationV128Const(0, 0)) + } +} + +// Returns the "depth" (starting from top of the stack) +// of the n-th local. +func (c *Compiler) localDepth(index wasm.Index) int { + height := c.localIndexToStackHeightInUint64[index] + return c.stackLenInUint64(len(c.stack)) - 1 - int(height) +} + +func (c *Compiler) localType(index wasm.Index) (t wasm.ValueType) { + if params := uint32(len(c.sig.Params)); index < params { + t = c.sig.Params[index] + } else { + t = c.localTypes[index-params] + } + return +} + +// getFrameDropRange returns the range (starting from top of the stack) that spans across the (uint64) stack. The range is +// supposed to be dropped from the stack when the given frame exists or branch into it. +// +// * frame is the control frame which the call-site is trying to branch into or exit. +// * isEnd true if the call-site is handling wasm.OpcodeEnd. +func (c *Compiler) getFrameDropRange(frame *controlFrame, isEnd bool) InclusiveRange { + var start int + if !isEnd && frame.kind == controlFrameKindLoop { + // If this is not End and the call-site is trying to branch into the Loop control frame, + // we have to Start executing from the beginning of the loop block. + // Therefore, we have to pass the inputs to the frame. + start = frame.blockType.ParamNumInUint64 + } else { + start = frame.blockType.ResultNumInUint64 + } + var end int + if frame.kind == controlFrameKindFunction { + // On the function return, we eliminate all the contents on the stack + // including locals (existing below of frame.originalStackLen) + end = c.stackLenInUint64(len(c.stack)) - 1 + } else { + end = c.stackLenInUint64(len(c.stack)) - 1 - c.stackLenInUint64(frame.originalStackLenWithoutParam) + } + if start <= end { + return InclusiveRange{Start: int32(start), End: int32(end)} + } else { + return NopInclusiveRange + } +} + +func (c *Compiler) stackLenInUint64(ceil int) (ret int) { + for i := 0; i < ceil; i++ { + if c.stack[i] == UnsignedTypeV128 { + ret += 2 + } else { + ret++ + } + } + return +} + +func (c *Compiler) readMemoryArg(tag string) (MemoryArg, error) { + c.result.UsesMemory = true + alignment, num, err := leb128.LoadUint32(c.body[c.pc+1:]) + if err != nil { + return MemoryArg{}, fmt.Errorf("reading alignment for %s: %w", tag, err) + } + c.pc += num + offset, num, err := leb128.LoadUint32(c.body[c.pc+1:]) + if err != nil { + return MemoryArg{}, fmt.Errorf("reading offset for %s: %w", tag, err) + } + c.pc += num + return MemoryArg{Offset: offset, Alignment: alignment}, nil +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wazeroir/format.go b/vendor/github.com/tetratelabs/wazero/internal/wazeroir/format.go new file mode 100644 index 000000000..789de0029 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wazeroir/format.go @@ -0,0 +1,24 @@ +package wazeroir + +import ( + "bytes" +) + +const EntrypointLabel = ".entrypoint" + +func Format(ops []UnionOperation) string { + buf := bytes.NewBuffer(nil) + + _, _ = buf.WriteString(EntrypointLabel + "\n") + for i := range ops { + op := &ops[i] + str := op.String() + isLabel := op.Kind == OperationKindLabel + if !isLabel { + const indent = "\t" + str = indent + str + } + _, _ = buf.WriteString(str + "\n") + } + return buf.String() +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wazeroir/operations.go b/vendor/github.com/tetratelabs/wazero/internal/wazeroir/operations.go new file mode 100644 index 000000000..4041944a4 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wazeroir/operations.go @@ -0,0 +1,2567 @@ +package wazeroir + +import ( + "fmt" + "math" + "strings" +) + +// UnsignedInt represents unsigned 32-bit or 64-bit integers. +type UnsignedInt byte + +const ( + UnsignedInt32 UnsignedInt = iota + UnsignedInt64 +) + +// String implements fmt.Stringer. +func (s UnsignedInt) String() (ret string) { + switch s { + case UnsignedInt32: + ret = "i32" + case UnsignedInt64: + ret = "i64" + } + return +} + +// SignedInt represents signed or unsigned integers. +type SignedInt byte + +const ( + SignedInt32 SignedInt = iota + SignedInt64 + SignedUint32 + SignedUint64 +) + +// String implements fmt.Stringer. +func (s SignedInt) String() (ret string) { + switch s { + case SignedUint32: + ret = "u32" + case SignedUint64: + ret = "u64" + case SignedInt32: + ret = "s32" + case SignedInt64: + ret = "s64" + } + return +} + +// Float represents the scalar double or single precision floating points. +type Float byte + +const ( + Float32 Float = iota + Float64 +) + +// String implements fmt.Stringer. +func (s Float) String() (ret string) { + switch s { + case Float32: + ret = "f32" + case Float64: + ret = "f64" + } + return +} + +// UnsignedType is the union of UnsignedInt, Float and V128 vector type. +type UnsignedType byte + +const ( + UnsignedTypeI32 UnsignedType = iota + UnsignedTypeI64 + UnsignedTypeF32 + UnsignedTypeF64 + UnsignedTypeV128 + UnsignedTypeUnknown +) + +// String implements fmt.Stringer. +func (s UnsignedType) String() (ret string) { + switch s { + case UnsignedTypeI32: + ret = "i32" + case UnsignedTypeI64: + ret = "i64" + case UnsignedTypeF32: + ret = "f32" + case UnsignedTypeF64: + ret = "f64" + case UnsignedTypeV128: + ret = "v128" + case UnsignedTypeUnknown: + ret = "unknown" + } + return +} + +// SignedType is the union of SignedInt and Float types. +type SignedType byte + +const ( + SignedTypeInt32 SignedType = iota + SignedTypeUint32 + SignedTypeInt64 + SignedTypeUint64 + SignedTypeFloat32 + SignedTypeFloat64 +) + +// String implements fmt.Stringer. +func (s SignedType) String() (ret string) { + switch s { + case SignedTypeInt32: + ret = "s32" + case SignedTypeUint32: + ret = "u32" + case SignedTypeInt64: + ret = "s64" + case SignedTypeUint64: + ret = "u64" + case SignedTypeFloat32: + ret = "f32" + case SignedTypeFloat64: + ret = "f64" + } + return +} + +// OperationKind is the Kind of each implementation of Operation interface. +type OperationKind uint16 + +// String implements fmt.Stringer. +func (o OperationKind) String() (ret string) { + switch o { + case OperationKindUnreachable: + ret = "Unreachable" + case OperationKindLabel: + ret = "label" + case OperationKindBr: + ret = "Br" + case OperationKindBrIf: + ret = "BrIf" + case OperationKindBrTable: + ret = "BrTable" + case OperationKindCall: + ret = "Call" + case OperationKindCallIndirect: + ret = "CallIndirect" + case OperationKindDrop: + ret = "Drop" + case OperationKindSelect: + ret = "Select" + case OperationKindPick: + ret = "Pick" + case OperationKindSet: + ret = "Swap" + case OperationKindGlobalGet: + ret = "GlobalGet" + case OperationKindGlobalSet: + ret = "GlobalSet" + case OperationKindLoad: + ret = "Load" + case OperationKindLoad8: + ret = "Load8" + case OperationKindLoad16: + ret = "Load16" + case OperationKindLoad32: + ret = "Load32" + case OperationKindStore: + ret = "Store" + case OperationKindStore8: + ret = "Store8" + case OperationKindStore16: + ret = "Store16" + case OperationKindStore32: + ret = "Store32" + case OperationKindMemorySize: + ret = "MemorySize" + case OperationKindMemoryGrow: + ret = "MemoryGrow" + case OperationKindConstI32: + ret = "ConstI32" + case OperationKindConstI64: + ret = "ConstI64" + case OperationKindConstF32: + ret = "ConstF32" + case OperationKindConstF64: + ret = "ConstF64" + case OperationKindEq: + ret = "Eq" + case OperationKindNe: + ret = "Ne" + case OperationKindEqz: + ret = "Eqz" + case OperationKindLt: + ret = "Lt" + case OperationKindGt: + ret = "Gt" + case OperationKindLe: + ret = "Le" + case OperationKindGe: + ret = "Ge" + case OperationKindAdd: + ret = "Add" + case OperationKindSub: + ret = "Sub" + case OperationKindMul: + ret = "Mul" + case OperationKindClz: + ret = "Clz" + case OperationKindCtz: + ret = "Ctz" + case OperationKindPopcnt: + ret = "Popcnt" + case OperationKindDiv: + ret = "Div" + case OperationKindRem: + ret = "Rem" + case OperationKindAnd: + ret = "And" + case OperationKindOr: + ret = "Or" + case OperationKindXor: + ret = "Xor" + case OperationKindShl: + ret = "Shl" + case OperationKindShr: + ret = "Shr" + case OperationKindRotl: + ret = "Rotl" + case OperationKindRotr: + ret = "Rotr" + case OperationKindAbs: + ret = "Abs" + case OperationKindNeg: + ret = "Neg" + case OperationKindCeil: + ret = "Ceil" + case OperationKindFloor: + ret = "Floor" + case OperationKindTrunc: + ret = "Trunc" + case OperationKindNearest: + ret = "Nearest" + case OperationKindSqrt: + ret = "Sqrt" + case OperationKindMin: + ret = "Min" + case OperationKindMax: + ret = "Max" + case OperationKindCopysign: + ret = "Copysign" + case OperationKindI32WrapFromI64: + ret = "I32WrapFromI64" + case OperationKindITruncFromF: + ret = "ITruncFromF" + case OperationKindFConvertFromI: + ret = "FConvertFromI" + case OperationKindF32DemoteFromF64: + ret = "F32DemoteFromF64" + case OperationKindF64PromoteFromF32: + ret = "F64PromoteFromF32" + case OperationKindI32ReinterpretFromF32: + ret = "I32ReinterpretFromF32" + case OperationKindI64ReinterpretFromF64: + ret = "I64ReinterpretFromF64" + case OperationKindF32ReinterpretFromI32: + ret = "F32ReinterpretFromI32" + case OperationKindF64ReinterpretFromI64: + ret = "F64ReinterpretFromI64" + case OperationKindExtend: + ret = "Extend" + case OperationKindMemoryInit: + ret = "MemoryInit" + case OperationKindDataDrop: + ret = "DataDrop" + case OperationKindMemoryCopy: + ret = "MemoryCopy" + case OperationKindMemoryFill: + ret = "MemoryFill" + case OperationKindTableInit: + ret = "TableInit" + case OperationKindElemDrop: + ret = "ElemDrop" + case OperationKindTableCopy: + ret = "TableCopy" + case OperationKindRefFunc: + ret = "RefFunc" + case OperationKindTableGet: + ret = "TableGet" + case OperationKindTableSet: + ret = "TableSet" + case OperationKindTableSize: + ret = "TableSize" + case OperationKindTableGrow: + ret = "TableGrow" + case OperationKindTableFill: + ret = "TableFill" + case OperationKindV128Const: + ret = "ConstV128" + case OperationKindV128Add: + ret = "V128Add" + case OperationKindV128Sub: + ret = "V128Sub" + case OperationKindV128Load: + ret = "V128Load" + case OperationKindV128LoadLane: + ret = "V128LoadLane" + case OperationKindV128Store: + ret = "V128Store" + case OperationKindV128StoreLane: + ret = "V128StoreLane" + case OperationKindV128ExtractLane: + ret = "V128ExtractLane" + case OperationKindV128ReplaceLane: + ret = "V128ReplaceLane" + case OperationKindV128Splat: + ret = "V128Splat" + case OperationKindV128Shuffle: + ret = "V128Shuffle" + case OperationKindV128Swizzle: + ret = "V128Swizzle" + case OperationKindV128AnyTrue: + ret = "V128AnyTrue" + case OperationKindV128AllTrue: + ret = "V128AllTrue" + case OperationKindV128And: + ret = "V128And" + case OperationKindV128Not: + ret = "V128Not" + case OperationKindV128Or: + ret = "V128Or" + case OperationKindV128Xor: + ret = "V128Xor" + case OperationKindV128Bitselect: + ret = "V128Bitselect" + case OperationKindV128AndNot: + ret = "V128AndNot" + case OperationKindV128BitMask: + ret = "V128BitMask" + case OperationKindV128Shl: + ret = "V128Shl" + case OperationKindV128Shr: + ret = "V128Shr" + case OperationKindV128Cmp: + ret = "V128Cmp" + case OperationKindSignExtend32From8: + ret = "SignExtend32From8" + case OperationKindSignExtend32From16: + ret = "SignExtend32From16" + case OperationKindSignExtend64From8: + ret = "SignExtend64From8" + case OperationKindSignExtend64From16: + ret = "SignExtend64From16" + case OperationKindSignExtend64From32: + ret = "SignExtend64From32" + case OperationKindV128AddSat: + ret = "V128AddSat" + case OperationKindV128SubSat: + ret = "V128SubSat" + case OperationKindV128Mul: + ret = "V128Mul" + case OperationKindV128Div: + ret = "V128Div" + case OperationKindV128Neg: + ret = "V128Neg" + case OperationKindV128Sqrt: + ret = "V128Sqrt" + case OperationKindV128Abs: + ret = "V128Abs" + case OperationKindV128Popcnt: + ret = "V128Popcnt" + case OperationKindV128Min: + ret = "V128Min" + case OperationKindV128Max: + ret = "V128Max" + case OperationKindV128AvgrU: + ret = "V128AvgrU" + case OperationKindV128Ceil: + ret = "V128Ceil" + case OperationKindV128Floor: + ret = "V128Floor" + case OperationKindV128Trunc: + ret = "V128Trunc" + case OperationKindV128Nearest: + ret = "V128Nearest" + case OperationKindV128Pmin: + ret = "V128Pmin" + case OperationKindV128Pmax: + ret = "V128Pmax" + case OperationKindV128Extend: + ret = "V128Extend" + case OperationKindV128ExtMul: + ret = "V128ExtMul" + case OperationKindV128Q15mulrSatS: + ret = "V128Q15mulrSatS" + case OperationKindV128ExtAddPairwise: + ret = "V128ExtAddPairwise" + case OperationKindV128FloatPromote: + ret = "V128FloatPromote" + case OperationKindV128FloatDemote: + ret = "V128FloatDemote" + case OperationKindV128FConvertFromI: + ret = "V128FConvertFromI" + case OperationKindV128Dot: + ret = "V128Dot" + case OperationKindV128Narrow: + ret = "V128Narrow" + case OperationKindV128ITruncSatFromF: + ret = "V128ITruncSatFromF" + case OperationKindBuiltinFunctionCheckExitCode: + ret = "BuiltinFunctionCheckExitCode" + default: + panic(fmt.Errorf("unknown operation %d", o)) + } + return +} + +const ( + // OperationKindUnreachable is the Kind for NewOperationUnreachable. + OperationKindUnreachable OperationKind = iota + // OperationKindLabel is the Kind for NewOperationLabel. + OperationKindLabel + // OperationKindBr is the Kind for NewOperationBr. + OperationKindBr + // OperationKindBrIf is the Kind for NewOperationBrIf. + OperationKindBrIf + // OperationKindBrTable is the Kind for NewOperationBrTable. + OperationKindBrTable + // OperationKindCall is the Kind for NewOperationCall. + OperationKindCall + // OperationKindCallIndirect is the Kind for NewOperationCallIndirect. + OperationKindCallIndirect + // OperationKindDrop is the Kind for NewOperationDrop. + OperationKindDrop + // OperationKindSelect is the Kind for NewOperationSelect. + OperationKindSelect + // OperationKindPick is the Kind for NewOperationPick. + OperationKindPick + // OperationKindSet is the Kind for NewOperationSet. + OperationKindSet + // OperationKindGlobalGet is the Kind for NewOperationGlobalGet. + OperationKindGlobalGet + // OperationKindGlobalSet is the Kind for NewOperationGlobalSet. + OperationKindGlobalSet + // OperationKindLoad is the Kind for NewOperationLoad. + OperationKindLoad + // OperationKindLoad8 is the Kind for NewOperationLoad8. + OperationKindLoad8 + // OperationKindLoad16 is the Kind for NewOperationLoad16. + OperationKindLoad16 + // OperationKindLoad32 is the Kind for NewOperationLoad32. + OperationKindLoad32 + // OperationKindStore is the Kind for NewOperationStore. + OperationKindStore + // OperationKindStore8 is the Kind for NewOperationStore8. + OperationKindStore8 + // OperationKindStore16 is the Kind for NewOperationStore16. + OperationKindStore16 + // OperationKindStore32 is the Kind for NewOperationStore32. + OperationKindStore32 + // OperationKindMemorySize is the Kind for NewOperationMemorySize. + OperationKindMemorySize + // OperationKindMemoryGrow is the Kind for NewOperationMemoryGrow. + OperationKindMemoryGrow + // OperationKindConstI32 is the Kind for NewOperationConstI32. + OperationKindConstI32 + // OperationKindConstI64 is the Kind for NewOperationConstI64. + OperationKindConstI64 + // OperationKindConstF32 is the Kind for NewOperationConstF32. + OperationKindConstF32 + // OperationKindConstF64 is the Kind for NewOperationConstF64. + OperationKindConstF64 + // OperationKindEq is the Kind for NewOperationEq. + OperationKindEq + // OperationKindNe is the Kind for NewOperationNe. + OperationKindNe + // OperationKindEqz is the Kind for NewOperationEqz. + OperationKindEqz + // OperationKindLt is the Kind for NewOperationLt. + OperationKindLt + // OperationKindGt is the Kind for NewOperationGt. + OperationKindGt + // OperationKindLe is the Kind for NewOperationLe. + OperationKindLe + // OperationKindGe is the Kind for NewOperationGe. + OperationKindGe + // OperationKindAdd is the Kind for NewOperationAdd. + OperationKindAdd + // OperationKindSub is the Kind for NewOperationSub. + OperationKindSub + // OperationKindMul is the Kind for NewOperationMul. + OperationKindMul + // OperationKindClz is the Kind for NewOperationClz. + OperationKindClz + // OperationKindCtz is the Kind for NewOperationCtz. + OperationKindCtz + // OperationKindPopcnt is the Kind for NewOperationPopcnt. + OperationKindPopcnt + // OperationKindDiv is the Kind for NewOperationDiv. + OperationKindDiv + // OperationKindRem is the Kind for NewOperationRem. + OperationKindRem + // OperationKindAnd is the Kind for NewOperationAnd. + OperationKindAnd + // OperationKindOr is the Kind for NewOperationOr. + OperationKindOr + // OperationKindXor is the Kind for NewOperationXor. + OperationKindXor + // OperationKindShl is the Kind for NewOperationShl. + OperationKindShl + // OperationKindShr is the Kind for NewOperationShr. + OperationKindShr + // OperationKindRotl is the Kind for NewOperationRotl. + OperationKindRotl + // OperationKindRotr is the Kind for NewOperationRotr. + OperationKindRotr + // OperationKindAbs is the Kind for NewOperationAbs. + OperationKindAbs + // OperationKindNeg is the Kind for NewOperationNeg. + OperationKindNeg + // OperationKindCeil is the Kind for NewOperationCeil. + OperationKindCeil + // OperationKindFloor is the Kind for NewOperationFloor. + OperationKindFloor + // OperationKindTrunc is the Kind for NewOperationTrunc. + OperationKindTrunc + // OperationKindNearest is the Kind for NewOperationNearest. + OperationKindNearest + // OperationKindSqrt is the Kind for NewOperationSqrt. + OperationKindSqrt + // OperationKindMin is the Kind for NewOperationMin. + OperationKindMin + // OperationKindMax is the Kind for NewOperationMax. + OperationKindMax + // OperationKindCopysign is the Kind for NewOperationCopysign. + OperationKindCopysign + // OperationKindI32WrapFromI64 is the Kind for NewOperationI32WrapFromI64. + OperationKindI32WrapFromI64 + // OperationKindITruncFromF is the Kind for NewOperationITruncFromF. + OperationKindITruncFromF + // OperationKindFConvertFromI is the Kind for NewOperationFConvertFromI. + OperationKindFConvertFromI + // OperationKindF32DemoteFromF64 is the Kind for NewOperationF32DemoteFromF64. + OperationKindF32DemoteFromF64 + // OperationKindF64PromoteFromF32 is the Kind for NewOperationF64PromoteFromF32. + OperationKindF64PromoteFromF32 + // OperationKindI32ReinterpretFromF32 is the Kind for NewOperationI32ReinterpretFromF32. + OperationKindI32ReinterpretFromF32 + // OperationKindI64ReinterpretFromF64 is the Kind for NewOperationI64ReinterpretFromF64. + OperationKindI64ReinterpretFromF64 + // OperationKindF32ReinterpretFromI32 is the Kind for NewOperationF32ReinterpretFromI32. + OperationKindF32ReinterpretFromI32 + // OperationKindF64ReinterpretFromI64 is the Kind for NewOperationF64ReinterpretFromI64. + OperationKindF64ReinterpretFromI64 + // OperationKindExtend is the Kind for NewOperationExtend. + OperationKindExtend + // OperationKindSignExtend32From8 is the Kind for NewOperationSignExtend32From8. + OperationKindSignExtend32From8 + // OperationKindSignExtend32From16 is the Kind for NewOperationSignExtend32From16. + OperationKindSignExtend32From16 + // OperationKindSignExtend64From8 is the Kind for NewOperationSignExtend64From8. + OperationKindSignExtend64From8 + // OperationKindSignExtend64From16 is the Kind for NewOperationSignExtend64From16. + OperationKindSignExtend64From16 + // OperationKindSignExtend64From32 is the Kind for NewOperationSignExtend64From32. + OperationKindSignExtend64From32 + // OperationKindMemoryInit is the Kind for NewOperationMemoryInit. + OperationKindMemoryInit + // OperationKindDataDrop is the Kind for NewOperationDataDrop. + OperationKindDataDrop + // OperationKindMemoryCopy is the Kind for NewOperationMemoryCopy. + OperationKindMemoryCopy + // OperationKindMemoryFill is the Kind for NewOperationMemoryFill. + OperationKindMemoryFill + // OperationKindTableInit is the Kind for NewOperationTableInit. + OperationKindTableInit + // OperationKindElemDrop is the Kind for NewOperationElemDrop. + OperationKindElemDrop + // OperationKindTableCopy is the Kind for NewOperationTableCopy. + OperationKindTableCopy + // OperationKindRefFunc is the Kind for NewOperationRefFunc. + OperationKindRefFunc + // OperationKindTableGet is the Kind for NewOperationTableGet. + OperationKindTableGet + // OperationKindTableSet is the Kind for NewOperationTableSet. + OperationKindTableSet + // OperationKindTableSize is the Kind for NewOperationTableSize. + OperationKindTableSize + // OperationKindTableGrow is the Kind for NewOperationTableGrow. + OperationKindTableGrow + // OperationKindTableFill is the Kind for NewOperationTableFill. + OperationKindTableFill + + // Vector value related instructions are prefixed by V128. + + // OperationKindV128Const is the Kind for NewOperationV128Const. + OperationKindV128Const + // OperationKindV128Add is the Kind for NewOperationV128Add. + OperationKindV128Add + // OperationKindV128Sub is the Kind for NewOperationV128Sub. + OperationKindV128Sub + // OperationKindV128Load is the Kind for NewOperationV128Load. + OperationKindV128Load + // OperationKindV128LoadLane is the Kind for NewOperationV128LoadLane. + OperationKindV128LoadLane + // OperationKindV128Store is the Kind for NewOperationV128Store. + OperationKindV128Store + // OperationKindV128StoreLane is the Kind for NewOperationV128StoreLane. + OperationKindV128StoreLane + // OperationKindV128ExtractLane is the Kind for NewOperationV128ExtractLane. + OperationKindV128ExtractLane + // OperationKindV128ReplaceLane is the Kind for NewOperationV128ReplaceLane. + OperationKindV128ReplaceLane + // OperationKindV128Splat is the Kind for NewOperationV128Splat. + OperationKindV128Splat + // OperationKindV128Shuffle is the Kind for NewOperationV128Shuffle. + OperationKindV128Shuffle + // OperationKindV128Swizzle is the Kind for NewOperationV128Swizzle. + OperationKindV128Swizzle + // OperationKindV128AnyTrue is the Kind for NewOperationV128AnyTrue. + OperationKindV128AnyTrue + // OperationKindV128AllTrue is the Kind for NewOperationV128AllTrue. + OperationKindV128AllTrue + // OperationKindV128BitMask is the Kind for NewOperationV128BitMask. + OperationKindV128BitMask + // OperationKindV128And is the Kind for NewOperationV128And. + OperationKindV128And + // OperationKindV128Not is the Kind for NewOperationV128Not. + OperationKindV128Not + // OperationKindV128Or is the Kind for NewOperationV128Or. + OperationKindV128Or + // OperationKindV128Xor is the Kind for NewOperationV128Xor. + OperationKindV128Xor + // OperationKindV128Bitselect is the Kind for NewOperationV128Bitselect. + OperationKindV128Bitselect + // OperationKindV128AndNot is the Kind for NewOperationV128AndNot. + OperationKindV128AndNot + // OperationKindV128Shl is the Kind for NewOperationV128Shl. + OperationKindV128Shl + // OperationKindV128Shr is the Kind for NewOperationV128Shr. + OperationKindV128Shr + // OperationKindV128Cmp is the Kind for NewOperationV128Cmp. + OperationKindV128Cmp + // OperationKindV128AddSat is the Kind for NewOperationV128AddSat. + OperationKindV128AddSat + // OperationKindV128SubSat is the Kind for NewOperationV128SubSat. + OperationKindV128SubSat + // OperationKindV128Mul is the Kind for NewOperationV128Mul. + OperationKindV128Mul + // OperationKindV128Div is the Kind for NewOperationV128Div. + OperationKindV128Div + // OperationKindV128Neg is the Kind for NewOperationV128Neg. + OperationKindV128Neg + // OperationKindV128Sqrt is the Kind for NewOperationV128Sqrt. + OperationKindV128Sqrt + // OperationKindV128Abs is the Kind for NewOperationV128Abs. + OperationKindV128Abs + // OperationKindV128Popcnt is the Kind for NewOperationV128Popcnt. + OperationKindV128Popcnt + // OperationKindV128Min is the Kind for NewOperationV128Min. + OperationKindV128Min + // OperationKindV128Max is the Kind for NewOperationV128Max. + OperationKindV128Max + // OperationKindV128AvgrU is the Kind for NewOperationV128AvgrU. + OperationKindV128AvgrU + // OperationKindV128Pmin is the Kind for NewOperationV128Pmin. + OperationKindV128Pmin + // OperationKindV128Pmax is the Kind for NewOperationV128Pmax. + OperationKindV128Pmax + // OperationKindV128Ceil is the Kind for NewOperationV128Ceil. + OperationKindV128Ceil + // OperationKindV128Floor is the Kind for NewOperationV128Floor. + OperationKindV128Floor + // OperationKindV128Trunc is the Kind for NewOperationV128Trunc. + OperationKindV128Trunc + // OperationKindV128Nearest is the Kind for NewOperationV128Nearest. + OperationKindV128Nearest + // OperationKindV128Extend is the Kind for NewOperationV128Extend. + OperationKindV128Extend + // OperationKindV128ExtMul is the Kind for NewOperationV128ExtMul. + OperationKindV128ExtMul + // OperationKindV128Q15mulrSatS is the Kind for NewOperationV128Q15mulrSatS. + OperationKindV128Q15mulrSatS + // OperationKindV128ExtAddPairwise is the Kind for NewOperationV128ExtAddPairwise. + OperationKindV128ExtAddPairwise + // OperationKindV128FloatPromote is the Kind for NewOperationV128FloatPromote. + OperationKindV128FloatPromote + // OperationKindV128FloatDemote is the Kind for NewOperationV128FloatDemote. + OperationKindV128FloatDemote + // OperationKindV128FConvertFromI is the Kind for NewOperationV128FConvertFromI. + OperationKindV128FConvertFromI + // OperationKindV128Dot is the Kind for NewOperationV128Dot. + OperationKindV128Dot + // OperationKindV128Narrow is the Kind for NewOperationV128Narrow. + OperationKindV128Narrow + // OperationKindV128ITruncSatFromF is the Kind for NewOperationV128ITruncSatFromF. + OperationKindV128ITruncSatFromF + + // OperationKindBuiltinFunctionCheckExitCode is the Kind for NewOperationBuiltinFunctionCheckExitCode. + OperationKindBuiltinFunctionCheckExitCode + + // operationKindEnd is always placed at the bottom of this iota definition to be used in the test. + operationKindEnd +) + +// NewOperationBuiltinFunctionCheckExitCode is a constructor for UnionOperation with Kind OperationKindBuiltinFunctionCheckExitCode. +// +// OperationBuiltinFunctionCheckExitCode corresponds to the instruction to check the api.Module is already closed due to +// context.DeadlineExceeded, context.Canceled, or the explicit call of CloseWithExitCode on api.Module. +func NewOperationBuiltinFunctionCheckExitCode() UnionOperation { + return UnionOperation{Kind: OperationKindBuiltinFunctionCheckExitCode} +} + +// Label is the unique identifier for each block in a single function in wazeroir +// where "block" consists of multiple operations, and must End with branching operations +// (e.g. OperationKindBr or OperationKindBrIf). +type Label uint64 + +// Kind returns the LabelKind encoded in this Label. +func (l Label) Kind() LabelKind { + return LabelKind(uint32(l)) +} + +// FrameID returns the frame id encoded in this Label. +func (l Label) FrameID() int { + return int(uint32(l >> 32)) +} + +// NewLabel is a constructor for a Label. +func NewLabel(kind LabelKind, frameID uint32) Label { + return Label(kind) | Label(frameID)<<32 +} + +// String implements fmt.Stringer. +func (l Label) String() (ret string) { + frameID := l.FrameID() + switch l.Kind() { + case LabelKindHeader: + ret = fmt.Sprintf(".L%d", frameID) + case LabelKindElse: + ret = fmt.Sprintf(".L%d_else", frameID) + case LabelKindContinuation: + ret = fmt.Sprintf(".L%d_cont", frameID) + case LabelKindReturn: + return ".return" + } + return +} + +func (l Label) IsReturnTarget() bool { + return l.Kind() == LabelKindReturn +} + +// LabelKind is the Kind of the label. +type LabelKind = byte + +const ( + // LabelKindHeader is the header for various blocks. For example, the "then" block of + // wasm.OpcodeIfName in Wasm has the label of this Kind. + LabelKindHeader LabelKind = iota + // LabelKindElse is the Kind of label for "else" block of wasm.OpcodeIfName in Wasm. + LabelKindElse + // LabelKindContinuation is the Kind of label which is the continuation of blocks. + // For example, for wasm text like + // (func + // .... + // (if (local.get 0) (then (nop)) (else (nop))) + // return + // ) + // we have the continuation block (of if-block) corresponding to "return" opcode. + LabelKindContinuation + LabelKindReturn + LabelKindNum +) + +// UnionOperation implements Operation and is the compilation (engine.lowerIR) result of a wazeroir.Operation. +// +// Not all operations result in a UnionOperation, e.g. wazeroir.OperationI32ReinterpretFromF32, and some operations are +// more complex than others, e.g. wazeroir.NewOperationBrTable. +// +// Note: This is a form of union type as it can store fields needed for any operation. Hence, most fields are opaque and +// only relevant when in context of its kind. +type UnionOperation struct { + // Kind determines how to interpret the other fields in this struct. + Kind OperationKind + B1, B2 byte + B3 bool + U1, U2 uint64 + U3 uint64 + Us []uint64 +} + +// String implements fmt.Stringer. +func (o UnionOperation) String() string { + switch o.Kind { + case OperationKindUnreachable, + OperationKindSelect, + OperationKindMemorySize, + OperationKindMemoryGrow, + OperationKindI32WrapFromI64, + OperationKindF32DemoteFromF64, + OperationKindF64PromoteFromF32, + OperationKindI32ReinterpretFromF32, + OperationKindI64ReinterpretFromF64, + OperationKindF32ReinterpretFromI32, + OperationKindF64ReinterpretFromI64, + OperationKindSignExtend32From8, + OperationKindSignExtend32From16, + OperationKindSignExtend64From8, + OperationKindSignExtend64From16, + OperationKindSignExtend64From32, + OperationKindMemoryInit, + OperationKindDataDrop, + OperationKindMemoryCopy, + OperationKindMemoryFill, + OperationKindTableInit, + OperationKindElemDrop, + OperationKindTableCopy, + OperationKindRefFunc, + OperationKindTableGet, + OperationKindTableSet, + OperationKindTableSize, + OperationKindTableGrow, + OperationKindTableFill, + OperationKindBuiltinFunctionCheckExitCode: + return o.Kind.String() + + case OperationKindCall, + OperationKindGlobalGet, + OperationKindGlobalSet: + return fmt.Sprintf("%s %d", o.Kind, o.B1) + + case OperationKindLabel: + return Label(o.U1).String() + + case OperationKindBr: + return fmt.Sprintf("%s %s", o.Kind, Label(o.U1).String()) + + case OperationKindBrIf: + thenTarget := Label(o.U1) + elseTarget := Label(o.U2) + return fmt.Sprintf("%s %s, %s", o.Kind, thenTarget, elseTarget) + + case OperationKindBrTable: + var targets []string + var defaultLabel Label + if len(o.Us) > 0 { + targets = make([]string, len(o.Us)-1) + for i, t := range o.Us[1:] { + targets[i] = Label(t).String() + } + defaultLabel = Label(o.Us[0]) + } + return fmt.Sprintf("%s [%s] %s", o.Kind, strings.Join(targets, ","), defaultLabel) + + case OperationKindCallIndirect: + return fmt.Sprintf("%s: type=%d, table=%d", o.Kind, o.U1, o.U2) + + case OperationKindDrop: + start := int64(o.U1) + end := int64(o.U2) + return fmt.Sprintf("%s %d..%d", o.Kind, start, end) + + case OperationKindPick, OperationKindSet: + return fmt.Sprintf("%s %d (is_vector=%v)", o.Kind, o.U1, o.B3) + + case OperationKindLoad, OperationKindStore: + return fmt.Sprintf("%s.%s (align=%d, offset=%d)", UnsignedType(o.B1), o.Kind, o.U1, o.U2) + + case OperationKindLoad8, + OperationKindLoad16: + return fmt.Sprintf("%s.%s (align=%d, offset=%d)", SignedType(o.B1), o.Kind, o.U1, o.U2) + + case OperationKindStore8, + OperationKindStore16, + OperationKindStore32: + return fmt.Sprintf("%s (align=%d, offset=%d)", o.Kind, o.U1, o.U2) + + case OperationKindLoad32: + var t string + if o.B1 == 1 { + t = "i64" + } else { + t = "u64" + } + return fmt.Sprintf("%s.%s (align=%d, offset=%d)", t, o.Kind, o.U1, o.U2) + + case OperationKindEq, + OperationKindNe, + OperationKindAdd, + OperationKindSub, + OperationKindMul: + return fmt.Sprintf("%s.%s", UnsignedType(o.B1), o.Kind) + + case OperationKindEqz, + OperationKindClz, + OperationKindCtz, + OperationKindPopcnt, + OperationKindAnd, + OperationKindOr, + OperationKindXor, + OperationKindShl, + OperationKindRotl, + OperationKindRotr: + return fmt.Sprintf("%s.%s", UnsignedInt(o.B1), o.Kind) + + case OperationKindRem, OperationKindShr: + return fmt.Sprintf("%s.%s", SignedInt(o.B1), o.Kind) + + case OperationKindLt, + OperationKindGt, + OperationKindLe, + OperationKindGe, + OperationKindDiv: + return fmt.Sprintf("%s.%s", SignedType(o.B1), o.Kind) + + case OperationKindAbs, + OperationKindNeg, + OperationKindCeil, + OperationKindFloor, + OperationKindTrunc, + OperationKindNearest, + OperationKindSqrt, + OperationKindMin, + OperationKindMax, + OperationKindCopysign: + return fmt.Sprintf("%s.%s", Float(o.B1), o.Kind) + + case OperationKindConstI32, + OperationKindConstI64: + return fmt.Sprintf("%s %#x", o.Kind, o.U1) + + case OperationKindConstF32: + return fmt.Sprintf("%s %f", o.Kind, math.Float32frombits(uint32(o.U1))) + case OperationKindConstF64: + return fmt.Sprintf("%s %f", o.Kind, math.Float64frombits(o.U1)) + + case OperationKindITruncFromF: + return fmt.Sprintf("%s.%s.%s (non_trapping=%v)", SignedInt(o.B2), o.Kind, Float(o.B1), o.B3) + case OperationKindFConvertFromI: + return fmt.Sprintf("%s.%s.%s", Float(o.B2), o.Kind, SignedInt(o.B1)) + case OperationKindExtend: + var in, out string + if o.B3 { + in = "i32" + out = "i64" + } else { + in = "u32" + out = "u64" + } + return fmt.Sprintf("%s.%s.%s", out, o.Kind, in) + + case OperationKindV128Const: + return fmt.Sprintf("%s [%#x, %#x]", o.Kind, o.U1, o.U2) + case OperationKindV128Add, + OperationKindV128Sub: + return fmt.Sprintf("%s (shape=%s)", o.Kind, shapeName(o.B1)) + case OperationKindV128Load, + OperationKindV128LoadLane, + OperationKindV128Store, + OperationKindV128StoreLane, + OperationKindV128ExtractLane, + OperationKindV128ReplaceLane, + OperationKindV128Splat, + OperationKindV128Shuffle, + OperationKindV128Swizzle, + OperationKindV128AnyTrue, + OperationKindV128AllTrue, + OperationKindV128BitMask, + OperationKindV128And, + OperationKindV128Not, + OperationKindV128Or, + OperationKindV128Xor, + OperationKindV128Bitselect, + OperationKindV128AndNot, + OperationKindV128Shl, + OperationKindV128Shr, + OperationKindV128Cmp, + OperationKindV128AddSat, + OperationKindV128SubSat, + OperationKindV128Mul, + OperationKindV128Div, + OperationKindV128Neg, + OperationKindV128Sqrt, + OperationKindV128Abs, + OperationKindV128Popcnt, + OperationKindV128Min, + OperationKindV128Max, + OperationKindV128AvgrU, + OperationKindV128Pmin, + OperationKindV128Pmax, + OperationKindV128Ceil, + OperationKindV128Floor, + OperationKindV128Trunc, + OperationKindV128Nearest, + OperationKindV128Extend, + OperationKindV128ExtMul, + OperationKindV128Q15mulrSatS, + OperationKindV128ExtAddPairwise, + OperationKindV128FloatPromote, + OperationKindV128FloatDemote, + OperationKindV128FConvertFromI, + OperationKindV128Dot, + OperationKindV128Narrow: + return o.Kind.String() + + case OperationKindV128ITruncSatFromF: + if o.B3 { + return fmt.Sprintf("%s.%sS", o.Kind, shapeName(o.B1)) + } else { + return fmt.Sprintf("%s.%sU", o.Kind, shapeName(o.B1)) + } + + default: + panic(fmt.Sprintf("TODO: %v", o.Kind)) + } +} + +// NewOperationUnreachable is a constructor for UnionOperation with OperationKindUnreachable +// +// This corresponds to wasm.OpcodeUnreachable. +// +// The engines are expected to exit the execution with wasmruntime.ErrRuntimeUnreachable error. +func NewOperationUnreachable() UnionOperation { + return UnionOperation{Kind: OperationKindUnreachable} +} + +// NewOperationLabel is a constructor for UnionOperation with OperationKindLabel. +// +// This is used to inform the engines of the beginning of a label. +func NewOperationLabel(label Label) UnionOperation { + return UnionOperation{Kind: OperationKindLabel, U1: uint64(label)} +} + +// NewOperationBr is a constructor for UnionOperation with OperationKindBr. +// +// The engines are expected to branch into U1 label. +func NewOperationBr(target Label) UnionOperation { + return UnionOperation{Kind: OperationKindBr, U1: uint64(target)} +} + +// NewOperationBrIf is a constructor for UnionOperation with OperationKindBrIf. +// +// The engines are expected to pop a value and branch into U1 label if the value equals 1. +// Otherwise, the code branches into U2 label. +func NewOperationBrIf(thenTarget, elseTarget Label, thenDrop InclusiveRange) UnionOperation { + return UnionOperation{ + Kind: OperationKindBrIf, + U1: uint64(thenTarget), + U2: uint64(elseTarget), + U3: thenDrop.AsU64(), + } +} + +// NewOperationBrTable is a constructor for UnionOperation with OperationKindBrTable. +// +// This corresponds to wasm.OpcodeBrTableName except that the label +// here means the wazeroir level, not the ones of Wasm. +// +// The engines are expected to do the br_table operation based on the default (Us[len(Us)-1], Us[len(Us)-2]) and +// targets (Us[:len(Us)-1], Rs[:len(Us)-1]). More precisely, this pops a value from the stack (called "index") +// and decides which branch we go into next based on the value. +// +// For example, assume we have operations like {default: L_DEFAULT, targets: [L0, L1, L2]}. +// If "index" >= len(defaults), then branch into the L_DEFAULT label. +// Otherwise, we enter label of targets[index]. +func NewOperationBrTable(targetLabelsAndRanges []uint64) UnionOperation { + return UnionOperation{ + Kind: OperationKindBrTable, + Us: targetLabelsAndRanges, + } +} + +// NewOperationCall is a constructor for UnionOperation with OperationKindCall. +// +// This corresponds to wasm.OpcodeCallName, and engines are expected to +// enter into a function whose index equals OperationCall.FunctionIndex. +func NewOperationCall(functionIndex uint32) UnionOperation { + return UnionOperation{Kind: OperationKindCall, U1: uint64(functionIndex)} +} + +// NewOperationCallIndirect implements Operation. +// +// This corresponds to wasm.OpcodeCallIndirectName, and engines are expected to +// consume the one value from the top of stack (called "offset"), +// and make a function call against the function whose function address equals +// Tables[OperationCallIndirect.TableIndex][offset]. +// +// Note: This is called indirect function call in the sense that the target function is indirectly +// determined by the current state (top value) of the stack. +// Therefore, two checks are performed at runtime before entering the target function: +// 1) whether "offset" exceeds the length of table Tables[OperationCallIndirect.TableIndex]. +// 2) whether the type of the function table[offset] matches the function type specified by OperationCallIndirect.TypeIndex. +func NewOperationCallIndirect(typeIndex, tableIndex uint32) UnionOperation { + return UnionOperation{Kind: OperationKindCallIndirect, U1: uint64(typeIndex), U2: uint64(tableIndex)} +} + +// InclusiveRange is the range which spans across the value stack starting from the top to the bottom, and +// both boundary are included in the range. +type InclusiveRange struct { + Start, End int32 +} + +// AsU64 is be used to convert InclusiveRange to uint64 so that it can be stored in UnionOperation. +func (i InclusiveRange) AsU64() uint64 { + return uint64(uint32(i.Start))<<32 | uint64(uint32(i.End)) +} + +// InclusiveRangeFromU64 retrieves InclusiveRange from the given uint64 which is stored in UnionOperation. +func InclusiveRangeFromU64(v uint64) InclusiveRange { + return InclusiveRange{ + Start: int32(uint32(v >> 32)), + End: int32(uint32(v)), + } +} + +// NopInclusiveRange is InclusiveRange which corresponds to no-operation. +var NopInclusiveRange = InclusiveRange{Start: -1, End: -1} + +// NewOperationDrop is a constructor for UnionOperation with OperationKindDrop. +// +// The engines are expected to discard the values selected by NewOperationDrop.Depth which +// starts from the top of the stack to the bottom. +// +// depth spans across the uint64 value stack at runtime to be dropped by this operation. +func NewOperationDrop(depth InclusiveRange) UnionOperation { + return UnionOperation{Kind: OperationKindDrop, U1: depth.AsU64()} +} + +// NewOperationSelect is a constructor for UnionOperation with OperationKindSelect. +// +// This corresponds to wasm.OpcodeSelect. +// +// The engines are expected to pop three values, say [..., x2, x1, c], then if the value "c" equals zero, +// "x1" is pushed back onto the stack and, otherwise "x2" is pushed back. +// +// isTargetVector true if the selection target value's type is wasm.ValueTypeV128. +func NewOperationSelect(isTargetVector bool) UnionOperation { + return UnionOperation{Kind: OperationKindSelect, B3: isTargetVector} +} + +// NewOperationPick is a constructor for UnionOperation with OperationKindPick. +// +// The engines are expected to copy a value pointed by depth, and push the +// copied value onto the top of the stack. +// +// depth is the location of the pick target in the uint64 value stack at runtime. +// If isTargetVector=true, this points to the location of the lower 64-bits of the vector. +func NewOperationPick(depth int, isTargetVector bool) UnionOperation { + return UnionOperation{Kind: OperationKindPick, U1: uint64(depth), B3: isTargetVector} +} + +// NewOperationSet is a constructor for UnionOperation with OperationKindSet. +// +// The engines are expected to set the top value of the stack to the location specified by +// depth. +// +// depth is the location of the set target in the uint64 value stack at runtime. +// If isTargetVector=true, this points the location of the lower 64-bits of the vector. +func NewOperationSet(depth int, isTargetVector bool) UnionOperation { + return UnionOperation{Kind: OperationKindSet, U1: uint64(depth), B3: isTargetVector} +} + +// NewOperationGlobalGet is a constructor for UnionOperation with OperationKindGlobalGet. +// +// The engines are expected to read the global value specified by OperationGlobalGet.Index, +// and push the copy of the value onto the stack. +// +// See wasm.OpcodeGlobalGet. +func NewOperationGlobalGet(index uint32) UnionOperation { + return UnionOperation{Kind: OperationKindGlobalGet, U1: uint64(index)} +} + +// NewOperationGlobalSet is a constructor for UnionOperation with OperationKindGlobalSet. +// +// The engines are expected to consume the value from the top of the stack, +// and write the value into the global specified by OperationGlobalSet.Index. +// +// See wasm.OpcodeGlobalSet. +func NewOperationGlobalSet(index uint32) UnionOperation { + return UnionOperation{Kind: OperationKindGlobalSet, U1: uint64(index)} +} + +// MemoryArg is the "memarg" to all memory instructions. +// +// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#memory-instructions%E2%91%A0 +type MemoryArg struct { + // Alignment the expected alignment (expressed as the exponent of a power of 2). Default to the natural alignment. + // + // "Natural alignment" is defined here as the smallest power of two that can hold the size of the value type. Ex + // wasm.ValueTypeI64 is encoded in 8 little-endian bytes. 2^3 = 8, so the natural alignment is three. + Alignment uint32 + + // Offset is the address offset added to the instruction's dynamic address operand, yielding a 33-bit effective + // address that is the zero-based index at which the memory is accessed. Default to zero. + Offset uint32 +} + +// NewOperationLoad is a constructor for UnionOperation with OperationKindLoad. +// +// This corresponds to wasm.OpcodeI32LoadName wasm.OpcodeI64LoadName wasm.OpcodeF32LoadName and wasm.OpcodeF64LoadName. +// +// The engines are expected to check the boundary of memory length, and exit the execution if this exceeds the boundary, +// otherwise load the corresponding value following the semantics of the corresponding WebAssembly instruction. +func NewOperationLoad(unsignedType UnsignedType, arg MemoryArg) UnionOperation { + return UnionOperation{Kind: OperationKindLoad, B1: byte(unsignedType), U1: uint64(arg.Alignment), U2: uint64(arg.Offset)} +} + +// NewOperationLoad8 is a constructor for UnionOperation with OperationKindLoad8. +// +// This corresponds to wasm.OpcodeI32Load8SName wasm.OpcodeI32Load8UName wasm.OpcodeI64Load8SName wasm.OpcodeI64Load8UName. +// +// The engines are expected to check the boundary of memory length, and exit the execution if this exceeds the boundary, +// otherwise load the corresponding value following the semantics of the corresponding WebAssembly instruction. +func NewOperationLoad8(signedInt SignedInt, arg MemoryArg) UnionOperation { + return UnionOperation{Kind: OperationKindLoad8, B1: byte(signedInt), U1: uint64(arg.Alignment), U2: uint64(arg.Offset)} +} + +// NewOperationLoad16 is a constructor for UnionOperation with OperationKindLoad16. +// +// This corresponds to wasm.OpcodeI32Load16SName wasm.OpcodeI32Load16UName wasm.OpcodeI64Load16SName wasm.OpcodeI64Load16UName. +// +// The engines are expected to check the boundary of memory length, and exit the execution if this exceeds the boundary, +// otherwise load the corresponding value following the semantics of the corresponding WebAssembly instruction. +func NewOperationLoad16(signedInt SignedInt, arg MemoryArg) UnionOperation { + return UnionOperation{Kind: OperationKindLoad16, B1: byte(signedInt), U1: uint64(arg.Alignment), U2: uint64(arg.Offset)} +} + +// NewOperationLoad32 is a constructor for UnionOperation with OperationKindLoad32. +// +// This corresponds to wasm.OpcodeI64Load32SName wasm.OpcodeI64Load32UName. +// +// The engines are expected to check the boundary of memory length, and exit the execution if this exceeds the boundary, +// otherwise load the corresponding value following the semantics of the corresponding WebAssembly instruction. +func NewOperationLoad32(signed bool, arg MemoryArg) UnionOperation { + sigB := byte(0) + if signed { + sigB = 1 + } + return UnionOperation{Kind: OperationKindLoad32, B1: sigB, U1: uint64(arg.Alignment), U2: uint64(arg.Offset)} +} + +// NewOperationStore is a constructor for UnionOperation with OperationKindStore. +// +// # This corresponds to wasm.OpcodeI32StoreName wasm.OpcodeI64StoreName wasm.OpcodeF32StoreName wasm.OpcodeF64StoreName +// +// The engines are expected to check the boundary of memory length, and exit the execution if this exceeds the boundary, +// otherwise store the corresponding value following the semantics of the corresponding WebAssembly instruction. +func NewOperationStore(unsignedType UnsignedType, arg MemoryArg) UnionOperation { + return UnionOperation{Kind: OperationKindStore, B1: byte(unsignedType), U1: uint64(arg.Alignment), U2: uint64(arg.Offset)} +} + +// NewOperationStore8 is a constructor for UnionOperation with OperationKindStore8. +// +// # This corresponds to wasm.OpcodeI32Store8Name wasm.OpcodeI64Store8Name +// +// The engines are expected to check the boundary of memory length, and exit the execution if this exceeds the boundary, +// otherwise store the corresponding value following the semantics of the corresponding WebAssembly instruction. +func NewOperationStore8(arg MemoryArg) UnionOperation { + return UnionOperation{Kind: OperationKindStore8, U1: uint64(arg.Alignment), U2: uint64(arg.Offset)} +} + +// NewOperationStore16 is a constructor for UnionOperation with OperationKindStore16. +// +// # This corresponds to wasm.OpcodeI32Store16Name wasm.OpcodeI64Store16Name +// +// The engines are expected to check the boundary of memory length, and exit the execution if this exceeds the boundary, +// otherwise store the corresponding value following the semantics of the corresponding WebAssembly instruction. +func NewOperationStore16(arg MemoryArg) UnionOperation { + return UnionOperation{Kind: OperationKindStore16, U1: uint64(arg.Alignment), U2: uint64(arg.Offset)} +} + +// NewOperationStore32 is a constructor for UnionOperation with OperationKindStore32. +// +// # This corresponds to wasm.OpcodeI64Store32Name +// +// The engines are expected to check the boundary of memory length, and exit the execution if this exceeds the boundary, +// otherwise store the corresponding value following the semantics of the corresponding WebAssembly instruction. +func NewOperationStore32(arg MemoryArg) UnionOperation { + return UnionOperation{Kind: OperationKindStore32, U1: uint64(arg.Alignment), U2: uint64(arg.Offset)} +} + +// NewOperationMemorySize is a constructor for UnionOperation with OperationKindMemorySize. +// +// This corresponds to wasm.OpcodeMemorySize. +// +// The engines are expected to push the current page size of the memory onto the stack. +func NewOperationMemorySize() UnionOperation { + return UnionOperation{Kind: OperationKindMemorySize} +} + +// NewOperationMemoryGrow is a constructor for UnionOperation with OperationKindMemoryGrow. +// +// This corresponds to wasm.OpcodeMemoryGrow. +// +// The engines are expected to pop one value from the top of the stack, then +// execute wasm.MemoryInstance Grow with the value, and push the previous +// page size of the memory onto the stack. +func NewOperationMemoryGrow() UnionOperation { + return UnionOperation{Kind: OperationKindMemoryGrow} +} + +// NewOperationConstI32 is a constructor for UnionOperation with OperationConstI32. +// +// This corresponds to wasm.OpcodeI32Const. +func NewOperationConstI32(value uint32) UnionOperation { + return UnionOperation{Kind: OperationKindConstI32, U1: uint64(value)} +} + +// NewOperationConstI64 is a constructor for UnionOperation with OperationConstI64. +// +// This corresponds to wasm.OpcodeI64Const. +func NewOperationConstI64(value uint64) UnionOperation { + return UnionOperation{Kind: OperationKindConstI64, U1: value} +} + +// NewOperationConstF32 is a constructor for UnionOperation with OperationConstF32. +// +// This corresponds to wasm.OpcodeF32Const. +func NewOperationConstF32(value float32) UnionOperation { + return UnionOperation{Kind: OperationKindConstF32, U1: uint64(math.Float32bits(value))} +} + +// NewOperationConstF64 is a constructor for UnionOperation with OperationConstF64. +// +// This corresponds to wasm.OpcodeF64Const. +func NewOperationConstF64(value float64) UnionOperation { + return UnionOperation{Kind: OperationKindConstF64, U1: math.Float64bits(value)} +} + +// NewOperationEq is a constructor for UnionOperation with OperationKindEq. +// +// This corresponds to wasm.OpcodeI32EqName wasm.OpcodeI64EqName wasm.OpcodeF32EqName wasm.OpcodeF64EqName +func NewOperationEq(b UnsignedType) UnionOperation { + return UnionOperation{Kind: OperationKindEq, B1: byte(b)} +} + +// NewOperationNe is a constructor for UnionOperation with OperationKindNe. +// +// This corresponds to wasm.OpcodeI32NeName wasm.OpcodeI64NeName wasm.OpcodeF32NeName wasm.OpcodeF64NeName +func NewOperationNe(b UnsignedType) UnionOperation { + return UnionOperation{Kind: OperationKindNe, B1: byte(b)} +} + +// NewOperationEqz is a constructor for UnionOperation with OperationKindEqz. +// +// This corresponds to wasm.OpcodeI32EqzName wasm.OpcodeI64EqzName +func NewOperationEqz(b UnsignedInt) UnionOperation { + return UnionOperation{Kind: OperationKindEqz, B1: byte(b)} +} + +// NewOperationLt is a constructor for UnionOperation with OperationKindLt. +// +// This corresponds to wasm.OpcodeI32LtS wasm.OpcodeI32LtU wasm.OpcodeI64LtS wasm.OpcodeI64LtU wasm.OpcodeF32Lt wasm.OpcodeF64Lt +func NewOperationLt(b SignedType) UnionOperation { + return UnionOperation{Kind: OperationKindLt, B1: byte(b)} +} + +// NewOperationGt is a constructor for UnionOperation with OperationKindGt. +// +// This corresponds to wasm.OpcodeI32GtS wasm.OpcodeI32GtU wasm.OpcodeI64GtS wasm.OpcodeI64GtU wasm.OpcodeF32Gt wasm.OpcodeF64Gt +func NewOperationGt(b SignedType) UnionOperation { + return UnionOperation{Kind: OperationKindGt, B1: byte(b)} +} + +// NewOperationLe is a constructor for UnionOperation with OperationKindLe. +// +// This corresponds to wasm.OpcodeI32LeS wasm.OpcodeI32LeU wasm.OpcodeI64LeS wasm.OpcodeI64LeU wasm.OpcodeF32Le wasm.OpcodeF64Le +func NewOperationLe(b SignedType) UnionOperation { + return UnionOperation{Kind: OperationKindLe, B1: byte(b)} +} + +// NewOperationGe is a constructor for UnionOperation with OperationKindGe. +// +// This corresponds to wasm.OpcodeI32GeS wasm.OpcodeI32GeU wasm.OpcodeI64GeS wasm.OpcodeI64GeU wasm.OpcodeF32Ge wasm.OpcodeF64Ge +// NewOperationGe is the constructor for OperationGe +func NewOperationGe(b SignedType) UnionOperation { + return UnionOperation{Kind: OperationKindGe, B1: byte(b)} +} + +// NewOperationAdd is a constructor for UnionOperation with OperationKindAdd. +// +// This corresponds to wasm.OpcodeI32AddName wasm.OpcodeI64AddName wasm.OpcodeF32AddName wasm.OpcodeF64AddName. +func NewOperationAdd(b UnsignedType) UnionOperation { + return UnionOperation{Kind: OperationKindAdd, B1: byte(b)} +} + +// NewOperationSub is a constructor for UnionOperation with OperationKindSub. +// +// This corresponds to wasm.OpcodeI32SubName wasm.OpcodeI64SubName wasm.OpcodeF32SubName wasm.OpcodeF64SubName. +func NewOperationSub(b UnsignedType) UnionOperation { + return UnionOperation{Kind: OperationKindSub, B1: byte(b)} +} + +// NewOperationMul is a constructor for UnionOperation with wperationKindMul. +// +// This corresponds to wasm.OpcodeI32MulName wasm.OpcodeI64MulName wasm.OpcodeF32MulName wasm.OpcodeF64MulName. +// NewOperationMul is the constructor for OperationMul +func NewOperationMul(b UnsignedType) UnionOperation { + return UnionOperation{Kind: OperationKindMul, B1: byte(b)} +} + +// NewOperationClz is a constructor for UnionOperation with OperationKindClz. +// +// This corresponds to wasm.OpcodeI32ClzName wasm.OpcodeI64ClzName. +// +// The engines are expected to count up the leading zeros in the +// current top of the stack, and push the count result. +// For example, stack of [..., 0x00_ff_ff_ff] results in [..., 8]. +// See wasm.OpcodeI32Clz wasm.OpcodeI64Clz +func NewOperationClz(b UnsignedInt) UnionOperation { + return UnionOperation{Kind: OperationKindClz, B1: byte(b)} +} + +// NewOperationCtz is a constructor for UnionOperation with OperationKindCtz. +// +// This corresponds to wasm.OpcodeI32CtzName wasm.OpcodeI64CtzName. +// +// The engines are expected to count up the trailing zeros in the +// current top of the stack, and push the count result. +// For example, stack of [..., 0xff_ff_ff_00] results in [..., 8]. +func NewOperationCtz(b UnsignedInt) UnionOperation { + return UnionOperation{Kind: OperationKindCtz, B1: byte(b)} +} + +// NewOperationPopcnt is a constructor for UnionOperation with OperationKindPopcnt. +// +// This corresponds to wasm.OpcodeI32PopcntName wasm.OpcodeI64PopcntName. +// +// The engines are expected to count up the number of set bits in the +// current top of the stack, and push the count result. +// For example, stack of [..., 0b00_00_00_11] results in [..., 2]. +func NewOperationPopcnt(b UnsignedInt) UnionOperation { + return UnionOperation{Kind: OperationKindPopcnt, B1: byte(b)} +} + +// NewOperationDiv is a constructor for UnionOperation with OperationKindDiv. +// +// This corresponds to wasm.OpcodeI32DivS wasm.OpcodeI32DivU wasm.OpcodeI64DivS +// +// wasm.OpcodeI64DivU wasm.OpcodeF32Div wasm.OpcodeF64Div. +func NewOperationDiv(b SignedType) UnionOperation { + return UnionOperation{Kind: OperationKindDiv, B1: byte(b)} +} + +// NewOperationRem is a constructor for UnionOperation with OperationKindRem. +// +// This corresponds to wasm.OpcodeI32RemS wasm.OpcodeI32RemU wasm.OpcodeI64RemS wasm.OpcodeI64RemU. +// +// The engines are expected to perform division on the top +// two values of integer type on the stack and puts the remainder of the result +// onto the stack. For example, stack [..., 10, 3] results in [..., 1] where +// the quotient is discarded. +// NewOperationRem is the constructor for OperationRem +func NewOperationRem(b SignedInt) UnionOperation { + return UnionOperation{Kind: OperationKindRem, B1: byte(b)} +} + +// NewOperationAnd is a constructor for UnionOperation with OperationKindAnd. +// +// # This corresponds to wasm.OpcodeI32AndName wasm.OpcodeI64AndName +// +// The engines are expected to perform "And" operation on +// top two values on the stack, and pushes the result. +func NewOperationAnd(b UnsignedInt) UnionOperation { + return UnionOperation{Kind: OperationKindAnd, B1: byte(b)} +} + +// NewOperationOr is a constructor for UnionOperation with OperationKindOr. +// +// # This corresponds to wasm.OpcodeI32OrName wasm.OpcodeI64OrName +// +// The engines are expected to perform "Or" operation on +// top two values on the stack, and pushes the result. +func NewOperationOr(b UnsignedInt) UnionOperation { + return UnionOperation{Kind: OperationKindOr, B1: byte(b)} +} + +// NewOperationXor is a constructor for UnionOperation with OperationKindXor. +// +// # This corresponds to wasm.OpcodeI32XorName wasm.OpcodeI64XorName +// +// The engines are expected to perform "Xor" operation on +// top two values on the stack, and pushes the result. +func NewOperationXor(b UnsignedInt) UnionOperation { + return UnionOperation{Kind: OperationKindXor, B1: byte(b)} +} + +// NewOperationShl is a constructor for UnionOperation with OperationKindShl. +// +// # This corresponds to wasm.OpcodeI32ShlName wasm.OpcodeI64ShlName +// +// The engines are expected to perform "Shl" operation on +// top two values on the stack, and pushes the result. +func NewOperationShl(b UnsignedInt) UnionOperation { + return UnionOperation{Kind: OperationKindShl, B1: byte(b)} +} + +// NewOperationShr is a constructor for UnionOperation with OperationKindShr. +// +// # This corresponds to wasm.OpcodeI32ShrSName wasm.OpcodeI32ShrUName wasm.OpcodeI64ShrSName wasm.OpcodeI64ShrUName +// +// If OperationShr.Type is signed integer, then, the engines are expected to perform arithmetic right shift on the two +// top values on the stack, otherwise do the logical right shift. +func NewOperationShr(b SignedInt) UnionOperation { + return UnionOperation{Kind: OperationKindShr, B1: byte(b)} +} + +// NewOperationRotl is a constructor for UnionOperation with OperationKindRotl. +// +// # This corresponds to wasm.OpcodeI32RotlName wasm.OpcodeI64RotlName +// +// The engines are expected to perform "Rotl" operation on +// top two values on the stack, and pushes the result. +func NewOperationRotl(b UnsignedInt) UnionOperation { + return UnionOperation{Kind: OperationKindRotl, B1: byte(b)} +} + +// NewOperationRotr is a constructor for UnionOperation with OperationKindRotr. +// +// # This corresponds to wasm.OpcodeI32RotrName wasm.OpcodeI64RotrName +// +// The engines are expected to perform "Rotr" operation on +// top two values on the stack, and pushes the result. +func NewOperationRotr(b UnsignedInt) UnionOperation { + return UnionOperation{Kind: OperationKindRotr, B1: byte(b)} +} + +// NewOperationAbs is a constructor for UnionOperation with OperationKindAbs. +// +// This corresponds to wasm.OpcodeF32Abs wasm.OpcodeF64Abs +func NewOperationAbs(b Float) UnionOperation { + return UnionOperation{Kind: OperationKindAbs, B1: byte(b)} +} + +// NewOperationNeg is a constructor for UnionOperation with OperationKindNeg. +// +// This corresponds to wasm.OpcodeF32Neg wasm.OpcodeF64Neg +func NewOperationNeg(b Float) UnionOperation { + return UnionOperation{Kind: OperationKindNeg, B1: byte(b)} +} + +// NewOperationCeil is a constructor for UnionOperation with OperationKindCeil. +// +// This corresponds to wasm.OpcodeF32CeilName wasm.OpcodeF64CeilName +func NewOperationCeil(b Float) UnionOperation { + return UnionOperation{Kind: OperationKindCeil, B1: byte(b)} +} + +// NewOperationFloor is a constructor for UnionOperation with OperationKindFloor. +// +// This corresponds to wasm.OpcodeF32FloorName wasm.OpcodeF64FloorName +func NewOperationFloor(b Float) UnionOperation { + return UnionOperation{Kind: OperationKindFloor, B1: byte(b)} +} + +// NewOperationTrunc is a constructor for UnionOperation with OperationKindTrunc. +// +// This corresponds to wasm.OpcodeF32TruncName wasm.OpcodeF64TruncName +func NewOperationTrunc(b Float) UnionOperation { + return UnionOperation{Kind: OperationKindTrunc, B1: byte(b)} +} + +// NewOperationNearest is a constructor for UnionOperation with OperationKindNearest. +// +// # This corresponds to wasm.OpcodeF32NearestName wasm.OpcodeF64NearestName +// +// Note: this is *not* equivalent to math.Round and instead has the same +// the semantics of LLVM's rint intrinsic. See https://llvm.org/docs/LangRef.html#llvm-rint-intrinsic. +// For example, math.Round(-4.5) produces -5 while we want to produce -4. +func NewOperationNearest(b Float) UnionOperation { + return UnionOperation{Kind: OperationKindNearest, B1: byte(b)} +} + +// NewOperationSqrt is a constructor for UnionOperation with OperationKindSqrt. +// +// This corresponds to wasm.OpcodeF32SqrtName wasm.OpcodeF64SqrtName +func NewOperationSqrt(b Float) UnionOperation { + return UnionOperation{Kind: OperationKindSqrt, B1: byte(b)} +} + +// NewOperationMin is a constructor for UnionOperation with OperationKindMin. +// +// # This corresponds to wasm.OpcodeF32MinName wasm.OpcodeF64MinName +// +// The engines are expected to pop two values from the stack, and push back the maximum of +// these two values onto the stack. For example, stack [..., 100.1, 1.9] results in [..., 1.9]. +// +// Note: WebAssembly specifies that min/max must always return NaN if one of values is NaN, +// which is a different behavior different from math.Min. +func NewOperationMin(b Float) UnionOperation { + return UnionOperation{Kind: OperationKindMin, B1: byte(b)} +} + +// NewOperationMax is a constructor for UnionOperation with OperationKindMax. +// +// # This corresponds to wasm.OpcodeF32MaxName wasm.OpcodeF64MaxName +// +// The engines are expected to pop two values from the stack, and push back the maximum of +// these two values onto the stack. For example, stack [..., 100.1, 1.9] results in [..., 100.1]. +// +// Note: WebAssembly specifies that min/max must always return NaN if one of values is NaN, +// which is a different behavior different from math.Max. +func NewOperationMax(b Float) UnionOperation { + return UnionOperation{Kind: OperationKindMax, B1: byte(b)} +} + +// NewOperationCopysign is a constructor for UnionOperation with OperationKindCopysign. +// +// # This corresponds to wasm.OpcodeF32CopysignName wasm.OpcodeF64CopysignName +// +// The engines are expected to pop two float values from the stack, and copy the signbit of +// the first-popped value to the last one. +// For example, stack [..., 1.213, -5.0] results in [..., -1.213]. +func NewOperationCopysign(b Float) UnionOperation { + return UnionOperation{Kind: OperationKindCopysign, B1: byte(b)} +} + +// NewOperationI32WrapFromI64 is a constructor for UnionOperation with OperationKindI32WrapFromI64. +// +// This corresponds to wasm.OpcodeI32WrapI64 and equivalent to uint64(uint32(v)) in Go. +// +// The engines are expected to replace the 64-bit int on top of the stack +// with the corresponding 32-bit integer. +func NewOperationI32WrapFromI64() UnionOperation { + return UnionOperation{Kind: OperationKindI32WrapFromI64} +} + +// NewOperationITruncFromF is a constructor for UnionOperation with OperationKindITruncFromF. +// +// This corresponds to +// +// wasm.OpcodeI32TruncF32SName wasm.OpcodeI32TruncF32UName wasm.OpcodeI32TruncF64SName +// wasm.OpcodeI32TruncF64UName wasm.OpcodeI64TruncF32SName wasm.OpcodeI64TruncF32UName wasm.OpcodeI64TruncF64SName +// wasm.OpcodeI64TruncF64UName. wasm.OpcodeI32TruncSatF32SName wasm.OpcodeI32TruncSatF32UName +// wasm.OpcodeI32TruncSatF64SName wasm.OpcodeI32TruncSatF64UName wasm.OpcodeI64TruncSatF32SName +// wasm.OpcodeI64TruncSatF32UName wasm.OpcodeI64TruncSatF64SName wasm.OpcodeI64TruncSatF64UName +// +// See [1] and [2] for when we encounter undefined behavior in the WebAssembly specification if NewOperationITruncFromF.NonTrapping == false. +// To summarize, if the source float value is NaN or doesn't fit in the destination range of integers (incl. +=Inf), +// then the runtime behavior is undefined. In wazero, the engines are expected to exit the execution in these undefined cases with +// wasmruntime.ErrRuntimeInvalidConversionToInteger error. +// +// [1] https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#-hrefop-trunc-umathrmtruncmathsfu_m-n-z for unsigned integers. +// [2] https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#-hrefop-trunc-smathrmtruncmathsfs_m-n-z for signed integers. +// +// nonTrapping true if this conversion is "nontrapping" in the sense of the +// https://github.com/WebAssembly/spec/blob/ce4b6c4d47eb06098cc7ab2e81f24748da822f20/proposals/nontrapping-float-to-int-conversion/Overview.md +func NewOperationITruncFromF(inputType Float, outputType SignedInt, nonTrapping bool) UnionOperation { + return UnionOperation{ + Kind: OperationKindITruncFromF, + B1: byte(inputType), + B2: byte(outputType), + B3: nonTrapping, + } +} + +// NewOperationFConvertFromI is a constructor for UnionOperation with OperationKindFConvertFromI. +// +// This corresponds to +// +// wasm.OpcodeF32ConvertI32SName wasm.OpcodeF32ConvertI32UName wasm.OpcodeF32ConvertI64SName wasm.OpcodeF32ConvertI64UName +// wasm.OpcodeF64ConvertI32SName wasm.OpcodeF64ConvertI32UName wasm.OpcodeF64ConvertI64SName wasm.OpcodeF64ConvertI64UName +// +// and equivalent to float32(uint32(x)), float32(int32(x)), etc in Go. +func NewOperationFConvertFromI(inputType SignedInt, outputType Float) UnionOperation { + return UnionOperation{ + Kind: OperationKindFConvertFromI, + B1: byte(inputType), + B2: byte(outputType), + } +} + +// NewOperationF32DemoteFromF64 is a constructor for UnionOperation with OperationKindF32DemoteFromF64. +// +// This corresponds to wasm.OpcodeF32DemoteF64 and is equivalent float32(float64(v)). +func NewOperationF32DemoteFromF64() UnionOperation { + return UnionOperation{Kind: OperationKindF32DemoteFromF64} +} + +// NewOperationF64PromoteFromF32 is a constructor for UnionOperation with OperationKindF64PromoteFromF32. +// +// This corresponds to wasm.OpcodeF64PromoteF32 and is equivalent float64(float32(v)). +func NewOperationF64PromoteFromF32() UnionOperation { + return UnionOperation{Kind: OperationKindF64PromoteFromF32} +} + +// NewOperationI32ReinterpretFromF32 is a constructor for UnionOperation with OperationKindI32ReinterpretFromF32. +// +// This corresponds to wasm.OpcodeI32ReinterpretF32Name. +func NewOperationI32ReinterpretFromF32() UnionOperation { + return UnionOperation{Kind: OperationKindI32ReinterpretFromF32} +} + +// NewOperationI64ReinterpretFromF64 is a constructor for UnionOperation with OperationKindI64ReinterpretFromF64. +// +// This corresponds to wasm.OpcodeI64ReinterpretF64Name. +func NewOperationI64ReinterpretFromF64() UnionOperation { + return UnionOperation{Kind: OperationKindI64ReinterpretFromF64} +} + +// NewOperationF32ReinterpretFromI32 is a constructor for UnionOperation with OperationKindF32ReinterpretFromI32. +// +// This corresponds to wasm.OpcodeF32ReinterpretI32Name. +func NewOperationF32ReinterpretFromI32() UnionOperation { + return UnionOperation{Kind: OperationKindF32ReinterpretFromI32} +} + +// NewOperationF64ReinterpretFromI64 is a constructor for UnionOperation with OperationKindF64ReinterpretFromI64. +// +// This corresponds to wasm.OpcodeF64ReinterpretI64Name. +func NewOperationF64ReinterpretFromI64() UnionOperation { + return UnionOperation{Kind: OperationKindF64ReinterpretFromI64} +} + +// NewOperationExtend is a constructor for UnionOperation with OperationKindExtend. +// +// # This corresponds to wasm.OpcodeI64ExtendI32SName wasm.OpcodeI64ExtendI32UName +// +// The engines are expected to extend the 32-bit signed or unsigned int on top of the stack +// as a 64-bit integer of corresponding signedness. For unsigned case, this is just reinterpreting the +// underlying bit pattern as 64-bit integer. For signed case, this is sign-extension which preserves the +// original integer's sign. +func NewOperationExtend(signed bool) UnionOperation { + op := UnionOperation{Kind: OperationKindExtend} + if signed { + op.B1 = 1 + } + return op +} + +// NewOperationSignExtend32From8 is a constructor for UnionOperation with OperationKindSignExtend32From8. +// +// This corresponds to wasm.OpcodeI32Extend8SName. +// +// The engines are expected to sign-extend the first 8-bits of 32-bit in as signed 32-bit int. +func NewOperationSignExtend32From8() UnionOperation { + return UnionOperation{Kind: OperationKindSignExtend32From8} +} + +// NewOperationSignExtend32From16 is a constructor for UnionOperation with OperationKindSignExtend32From16. +// +// This corresponds to wasm.OpcodeI32Extend16SName. +// +// The engines are expected to sign-extend the first 16-bits of 32-bit in as signed 32-bit int. +func NewOperationSignExtend32From16() UnionOperation { + return UnionOperation{Kind: OperationKindSignExtend32From16} +} + +// NewOperationSignExtend64From8 is a constructor for UnionOperation with OperationKindSignExtend64From8. +// +// This corresponds to wasm.OpcodeI64Extend8SName. +// +// The engines are expected to sign-extend the first 8-bits of 64-bit in as signed 32-bit int. +func NewOperationSignExtend64From8() UnionOperation { + return UnionOperation{Kind: OperationKindSignExtend64From8} +} + +// NewOperationSignExtend64From16 is a constructor for UnionOperation with OperationKindSignExtend64From16. +// +// This corresponds to wasm.OpcodeI64Extend16SName. +// +// The engines are expected to sign-extend the first 16-bits of 64-bit in as signed 32-bit int. +func NewOperationSignExtend64From16() UnionOperation { + return UnionOperation{Kind: OperationKindSignExtend64From16} +} + +// NewOperationSignExtend64From32 is a constructor for UnionOperation with OperationKindSignExtend64From32. +// +// This corresponds to wasm.OpcodeI64Extend32SName. +// +// The engines are expected to sign-extend the first 32-bits of 64-bit in as signed 32-bit int. +func NewOperationSignExtend64From32() UnionOperation { + return UnionOperation{Kind: OperationKindSignExtend64From32} +} + +// NewOperationMemoryInit is a constructor for UnionOperation with OperationKindMemoryInit. +// +// This corresponds to wasm.OpcodeMemoryInitName. +// +// dataIndex is the index of the data instance in ModuleInstance.DataInstances +// by which this operation instantiates a part of the memory. +func NewOperationMemoryInit(dataIndex uint32) UnionOperation { + return UnionOperation{Kind: OperationKindMemoryInit, U1: uint64(dataIndex)} +} + +// NewOperationDataDrop implements Operation. +// +// This corresponds to wasm.OpcodeDataDropName. +// +// dataIndex is the index of the data instance in ModuleInstance.DataInstances +// which this operation drops. +func NewOperationDataDrop(dataIndex uint32) UnionOperation { + return UnionOperation{Kind: OperationKindDataDrop, U1: uint64(dataIndex)} +} + +// NewOperationMemoryCopy is a consuctor for UnionOperation with OperationKindMemoryCopy. +// +// This corresponds to wasm.OpcodeMemoryCopyName. +func NewOperationMemoryCopy() UnionOperation { + return UnionOperation{Kind: OperationKindMemoryCopy} +} + +// NewOperationMemoryFill is a consuctor for UnionOperation with OperationKindMemoryFill. +func NewOperationMemoryFill() UnionOperation { + return UnionOperation{Kind: OperationKindMemoryFill} +} + +// NewOperationTableInit is a constructor for UnionOperation with OperationKindTableInit. +// +// This corresponds to wasm.OpcodeTableInitName. +// +// elemIndex is the index of the element by which this operation initializes a part of the table. +// tableIndex is the index of the table on which this operation initialize by the target element. +func NewOperationTableInit(elemIndex, tableIndex uint32) UnionOperation { + return UnionOperation{Kind: OperationKindTableInit, U1: uint64(elemIndex), U2: uint64(tableIndex)} +} + +// NewOperationElemDrop is a constructor for UnionOperation with OperationKindElemDrop. +// +// This corresponds to wasm.OpcodeElemDropName. +// +// elemIndex is the index of the element which this operation drops. +func NewOperationElemDrop(elemIndex uint32) UnionOperation { + return UnionOperation{Kind: OperationKindElemDrop, U1: uint64(elemIndex)} +} + +// NewOperationTableCopy implements Operation. +// +// This corresponds to wasm.OpcodeTableCopyName. +func NewOperationTableCopy(srcTableIndex, dstTableIndex uint32) UnionOperation { + return UnionOperation{Kind: OperationKindTableCopy, U1: uint64(srcTableIndex), U2: uint64(dstTableIndex)} +} + +// NewOperationRefFunc constructor for UnionOperation with OperationKindRefFunc. +// +// This corresponds to wasm.OpcodeRefFuncName, and engines are expected to +// push the opaque pointer value of engine specific func for the given FunctionIndex. +// +// Note: in wazero, we express any reference types (funcref or externref) as opaque pointers which is uint64. +// Therefore, the engine implementations emit instructions to push the address of *function onto the stack. +func NewOperationRefFunc(functionIndex uint32) UnionOperation { + return UnionOperation{Kind: OperationKindRefFunc, U1: uint64(functionIndex)} +} + +// NewOperationTableGet constructor for UnionOperation with OperationKindTableGet. +// +// This corresponds to wasm.OpcodeTableGetName. +func NewOperationTableGet(tableIndex uint32) UnionOperation { + return UnionOperation{Kind: OperationKindTableGet, U1: uint64(tableIndex)} +} + +// NewOperationTableSet constructor for UnionOperation with OperationKindTableSet. +// +// This corresponds to wasm.OpcodeTableSetName. +func NewOperationTableSet(tableIndex uint32) UnionOperation { + return UnionOperation{Kind: OperationKindTableSet, U1: uint64(tableIndex)} +} + +// NewOperationTableSize constructor for UnionOperation with OperationKindTableSize. +// +// This corresponds to wasm.OpcodeTableSizeName. +func NewOperationTableSize(tableIndex uint32) UnionOperation { + return UnionOperation{Kind: OperationKindTableSize, U1: uint64(tableIndex)} +} + +// NewOperationTableGrow constructor for UnionOperation with OperationKindTableGrow. +// +// This corresponds to wasm.OpcodeTableGrowName. +func NewOperationTableGrow(tableIndex uint32) UnionOperation { + return UnionOperation{Kind: OperationKindTableGrow, U1: uint64(tableIndex)} +} + +// NewOperationTableFill constructor for UnionOperation with OperationKindTableFill. +// +// This corresponds to wasm.OpcodeTableFillName. +func NewOperationTableFill(tableIndex uint32) UnionOperation { + return UnionOperation{Kind: OperationKindTableFill, U1: uint64(tableIndex)} +} + +// NewOperationV128Const constructor for UnionOperation with OperationKindV128Const +func NewOperationV128Const(lo, hi uint64) UnionOperation { + return UnionOperation{Kind: OperationKindV128Const, U1: lo, U2: hi} +} + +// Shape corresponds to a shape of v128 values. +// https://webassembly.github.io/spec/core/syntax/instructions.html#syntax-shape +type Shape = byte + +const ( + ShapeI8x16 Shape = iota + ShapeI16x8 + ShapeI32x4 + ShapeI64x2 + ShapeF32x4 + ShapeF64x2 +) + +func shapeName(s Shape) (ret string) { + switch s { + case ShapeI8x16: + ret = "I8x16" + case ShapeI16x8: + ret = "I16x8" + case ShapeI32x4: + ret = "I32x4" + case ShapeI64x2: + ret = "I64x2" + case ShapeF32x4: + ret = "F32x4" + case ShapeF64x2: + ret = "F64x2" + } + return +} + +// NewOperationV128Add constructor for UnionOperation with OperationKindV128Add. +// +// This corresponds to wasm.OpcodeVecI8x16AddName wasm.OpcodeVecI16x8AddName wasm.OpcodeVecI32x4AddName +// +// wasm.OpcodeVecI64x2AddName wasm.OpcodeVecF32x4AddName wasm.OpcodeVecF64x2AddName +func NewOperationV128Add(shape Shape) UnionOperation { + return UnionOperation{Kind: OperationKindV128Add, B1: shape} +} + +// NewOperationV128Sub constructor for UnionOperation with OperationKindV128Sub. +// +// This corresponds to wasm.OpcodeVecI8x16SubName wasm.OpcodeVecI16x8SubName wasm.OpcodeVecI32x4SubName +// +// wasm.OpcodeVecI64x2SubName wasm.OpcodeVecF32x4SubName wasm.OpcodeVecF64x2SubName +func NewOperationV128Sub(shape Shape) UnionOperation { + return UnionOperation{Kind: OperationKindV128Sub, B1: shape} +} + +// V128LoadType represents a type of wasm.OpcodeVecV128Load* instructions. +type V128LoadType = byte + +const ( + // V128LoadType128 corresponds to wasm.OpcodeVecV128LoadName. + V128LoadType128 V128LoadType = iota + // V128LoadType8x8s corresponds to wasm.OpcodeVecV128Load8x8SName. + V128LoadType8x8s + // V128LoadType8x8u corresponds to wasm.OpcodeVecV128Load8x8UName. + V128LoadType8x8u + // V128LoadType16x4s corresponds to wasm.OpcodeVecV128Load16x4SName + V128LoadType16x4s + // V128LoadType16x4u corresponds to wasm.OpcodeVecV128Load16x4UName + V128LoadType16x4u + // V128LoadType32x2s corresponds to wasm.OpcodeVecV128Load32x2SName + V128LoadType32x2s + // V128LoadType32x2u corresponds to wasm.OpcodeVecV128Load32x2UName + V128LoadType32x2u + // V128LoadType8Splat corresponds to wasm.OpcodeVecV128Load8SplatName + V128LoadType8Splat + // V128LoadType16Splat corresponds to wasm.OpcodeVecV128Load16SplatName + V128LoadType16Splat + // V128LoadType32Splat corresponds to wasm.OpcodeVecV128Load32SplatName + V128LoadType32Splat + // V128LoadType64Splat corresponds to wasm.OpcodeVecV128Load64SplatName + V128LoadType64Splat + // V128LoadType32zero corresponds to wasm.OpcodeVecV128Load32zeroName + V128LoadType32zero + // V128LoadType64zero corresponds to wasm.OpcodeVecV128Load64zeroName + V128LoadType64zero +) + +// NewOperationV128Load is a constructor for UnionOperation with OperationKindV128Load. +// +// This corresponds to +// +// wasm.OpcodeVecV128LoadName wasm.OpcodeVecV128Load8x8SName wasm.OpcodeVecV128Load8x8UName +// wasm.OpcodeVecV128Load16x4SName wasm.OpcodeVecV128Load16x4UName wasm.OpcodeVecV128Load32x2SName +// wasm.OpcodeVecV128Load32x2UName wasm.OpcodeVecV128Load8SplatName wasm.OpcodeVecV128Load16SplatName +// wasm.OpcodeVecV128Load32SplatName wasm.OpcodeVecV128Load64SplatName wasm.OpcodeVecV128Load32zeroName +// wasm.OpcodeVecV128Load64zeroName +func NewOperationV128Load(loadType V128LoadType, arg MemoryArg) UnionOperation { + return UnionOperation{Kind: OperationKindV128Load, B1: loadType, U1: uint64(arg.Alignment), U2: uint64(arg.Offset)} +} + +// NewOperationV128LoadLane is a constructor for UnionOperation with OperationKindV128LoadLane. +// +// This corresponds to wasm.OpcodeVecV128Load8LaneName wasm.OpcodeVecV128Load16LaneName +// +// wasm.OpcodeVecV128Load32LaneName wasm.OpcodeVecV128Load64LaneName. +// +// laneIndex is >=0 && <(128/LaneSize). +// laneSize is either 8, 16, 32, or 64. +func NewOperationV128LoadLane(laneIndex, laneSize byte, arg MemoryArg) UnionOperation { + return UnionOperation{Kind: OperationKindV128LoadLane, B1: laneSize, B2: laneIndex, U1: uint64(arg.Alignment), U2: uint64(arg.Offset)} +} + +// NewOperationV128Store is a constructor for UnionOperation with OperationKindV128Store. +// +// This corresponds to wasm.OpcodeVecV128Load8LaneName wasm.OpcodeVecV128Load16LaneName +// +// wasm.OpcodeVecV128Load32LaneName wasm.OpcodeVecV128Load64LaneName. +func NewOperationV128Store(arg MemoryArg) UnionOperation { + return UnionOperation{ + Kind: OperationKindV128Store, + U1: uint64(arg.Alignment), + U2: uint64(arg.Offset), + } +} + +// NewOperationV128StoreLane implements Operation. +// +// This corresponds to wasm.OpcodeVecV128Load8LaneName wasm.OpcodeVecV128Load16LaneName +// +// wasm.OpcodeVecV128Load32LaneName wasm.OpcodeVecV128Load64LaneName. +// +// laneIndex is >=0 && <(128/LaneSize). +// laneSize is either 8, 16, 32, or 64. +func NewOperationV128StoreLane(laneIndex byte, laneSize byte, arg MemoryArg) UnionOperation { + return UnionOperation{ + Kind: OperationKindV128StoreLane, + B1: laneSize, + B2: laneIndex, + U1: uint64(arg.Alignment), + U2: uint64(arg.Offset), + } +} + +// NewOperationV128ExtractLane is a constructor for UnionOperation with OperationKindV128ExtractLane. +// +// This corresponds to +// +// wasm.OpcodeVecI8x16ExtractLaneSName wasm.OpcodeVecI8x16ExtractLaneUName +// wasm.OpcodeVecI16x8ExtractLaneSName wasm.OpcodeVecI16x8ExtractLaneUName +// wasm.OpcodeVecI32x4ExtractLaneName wasm.OpcodeVecI64x2ExtractLaneName +// wasm.OpcodeVecF32x4ExtractLaneName wasm.OpcodeVecF64x2ExtractLaneName. +// +// laneIndex is >=0 && =0 && = l { + return nil, fmt.Errorf("invalid local index for local.get %d >= %d", index, l) + } + var t wasm.ValueType + if index < inputLen { + t = c.sig.Params[index] + } else { + t = c.localTypes[index-inputLen] + } + return wasmValueTypeToUnsignedOutSignature(t), nil + case wasm.OpcodeLocalSet: + inputLen := uint32(len(c.sig.Params)) + if l := uint32(len(c.localTypes)) + inputLen; index >= l { + return nil, fmt.Errorf("invalid local index for local.get %d >= %d", index, l) + } + var t wasm.ValueType + if index < inputLen { + t = c.sig.Params[index] + } else { + t = c.localTypes[index-inputLen] + } + return wasmValueTypeToUnsignedInSignature(t), nil + case wasm.OpcodeLocalTee: + inputLen := uint32(len(c.sig.Params)) + if l := uint32(len(c.localTypes)) + inputLen; index >= l { + return nil, fmt.Errorf("invalid local index for local.get %d >= %d", index, l) + } + var t wasm.ValueType + if index < inputLen { + t = c.sig.Params[index] + } else { + t = c.localTypes[index-inputLen] + } + return wasmValueTypeToUnsignedInOutSignature(t), nil + case wasm.OpcodeGlobalGet: + if len(c.globals) <= int(index) { + return nil, fmt.Errorf("invalid global index for global.get %d >= %d", index, len(c.globals)) + } + return wasmValueTypeToUnsignedOutSignature(c.globals[index].ValType), nil + case wasm.OpcodeGlobalSet: + if len(c.globals) <= int(index) { + return nil, fmt.Errorf("invalid global index for global.get %d >= %d", index, len(c.globals)) + } + return wasmValueTypeToUnsignedInSignature(c.globals[index].ValType), nil + case wasm.OpcodeI32Load: + return signature_I32_I32, nil + case wasm.OpcodeI64Load: + return signature_I32_I64, nil + case wasm.OpcodeF32Load: + return signature_I32_F32, nil + case wasm.OpcodeF64Load: + return signature_I32_F64, nil + case wasm.OpcodeI32Load8S, wasm.OpcodeI32Load8U, wasm.OpcodeI32Load16S, wasm.OpcodeI32Load16U: + return signature_I32_I32, nil + case wasm.OpcodeI64Load8S, wasm.OpcodeI64Load8U, wasm.OpcodeI64Load16S, wasm.OpcodeI64Load16U, + wasm.OpcodeI64Load32S, wasm.OpcodeI64Load32U: + return signature_I32_I64, nil + case wasm.OpcodeI32Store: + return signature_I32I32_None, nil + case wasm.OpcodeI64Store: + return signature_I32I64_None, nil + case wasm.OpcodeF32Store: + return signature_I32F32_None, nil + case wasm.OpcodeF64Store: + return signature_I32F64_None, nil + case wasm.OpcodeI32Store8: + return signature_I32I32_None, nil + case wasm.OpcodeI32Store16: + return signature_I32I32_None, nil + case wasm.OpcodeI64Store8: + return signature_I32I64_None, nil + case wasm.OpcodeI64Store16: + return signature_I32I64_None, nil + case wasm.OpcodeI64Store32: + return signature_I32I64_None, nil + case wasm.OpcodeMemorySize: + return signature_None_I32, nil + case wasm.OpcodeMemoryGrow: + return signature_I32_I32, nil + case wasm.OpcodeI32Const: + return signature_None_I32, nil + case wasm.OpcodeI64Const: + return signature_None_I64, nil + case wasm.OpcodeF32Const: + return signature_None_F32, nil + case wasm.OpcodeF64Const: + return signature_None_F64, nil + case wasm.OpcodeI32Eqz: + return signature_I32_I32, nil + case wasm.OpcodeI32Eq, wasm.OpcodeI32Ne, wasm.OpcodeI32LtS, + wasm.OpcodeI32LtU, wasm.OpcodeI32GtS, wasm.OpcodeI32GtU, + wasm.OpcodeI32LeS, wasm.OpcodeI32LeU, wasm.OpcodeI32GeS, + wasm.OpcodeI32GeU: + return signature_I32I32_I32, nil + case wasm.OpcodeI64Eqz: + return signature_I64_I32, nil + case wasm.OpcodeI64Eq, wasm.OpcodeI64Ne, wasm.OpcodeI64LtS, + wasm.OpcodeI64LtU, wasm.OpcodeI64GtS, wasm.OpcodeI64GtU, + wasm.OpcodeI64LeS, wasm.OpcodeI64LeU, wasm.OpcodeI64GeS, + wasm.OpcodeI64GeU: + return signature_I64I64_I32, nil + case wasm.OpcodeF32Eq, wasm.OpcodeF32Ne, wasm.OpcodeF32Lt, + wasm.OpcodeF32Gt, wasm.OpcodeF32Le, wasm.OpcodeF32Ge: + return signature_F32F32_I32, nil + case wasm.OpcodeF64Eq, wasm.OpcodeF64Ne, wasm.OpcodeF64Lt, + wasm.OpcodeF64Gt, wasm.OpcodeF64Le, wasm.OpcodeF64Ge: + return signature_F64F64_I32, nil + case wasm.OpcodeI32Clz, wasm.OpcodeI32Ctz, wasm.OpcodeI32Popcnt: + return signature_I32_I32, nil + case wasm.OpcodeI32Add, wasm.OpcodeI32Sub, wasm.OpcodeI32Mul, + wasm.OpcodeI32DivS, wasm.OpcodeI32DivU, wasm.OpcodeI32RemS, + wasm.OpcodeI32RemU, wasm.OpcodeI32And, wasm.OpcodeI32Or, + wasm.OpcodeI32Xor, wasm.OpcodeI32Shl, wasm.OpcodeI32ShrS, + wasm.OpcodeI32ShrU, wasm.OpcodeI32Rotl, wasm.OpcodeI32Rotr: + return signature_I32I32_I32, nil + case wasm.OpcodeI64Clz, wasm.OpcodeI64Ctz, wasm.OpcodeI64Popcnt: + return signature_I64_I64, nil + case wasm.OpcodeI64Add, wasm.OpcodeI64Sub, wasm.OpcodeI64Mul, + wasm.OpcodeI64DivS, wasm.OpcodeI64DivU, wasm.OpcodeI64RemS, + wasm.OpcodeI64RemU, wasm.OpcodeI64And, wasm.OpcodeI64Or, + wasm.OpcodeI64Xor, wasm.OpcodeI64Shl, wasm.OpcodeI64ShrS, + wasm.OpcodeI64ShrU, wasm.OpcodeI64Rotl, wasm.OpcodeI64Rotr: + return signature_I64I64_I64, nil + case wasm.OpcodeF32Abs, wasm.OpcodeF32Neg, wasm.OpcodeF32Ceil, + wasm.OpcodeF32Floor, wasm.OpcodeF32Trunc, wasm.OpcodeF32Nearest, + wasm.OpcodeF32Sqrt: + return signature_F32_F32, nil + case wasm.OpcodeF32Add, wasm.OpcodeF32Sub, wasm.OpcodeF32Mul, + wasm.OpcodeF32Div, wasm.OpcodeF32Min, wasm.OpcodeF32Max, + wasm.OpcodeF32Copysign: + return signature_F32F32_F32, nil + case wasm.OpcodeF64Abs, wasm.OpcodeF64Neg, wasm.OpcodeF64Ceil, + wasm.OpcodeF64Floor, wasm.OpcodeF64Trunc, wasm.OpcodeF64Nearest, + wasm.OpcodeF64Sqrt: + return signature_F64_F64, nil + case wasm.OpcodeF64Add, wasm.OpcodeF64Sub, wasm.OpcodeF64Mul, + wasm.OpcodeF64Div, wasm.OpcodeF64Min, wasm.OpcodeF64Max, + wasm.OpcodeF64Copysign: + return signature_F64F64_F64, nil + case wasm.OpcodeI32WrapI64: + return signature_I64_I32, nil + case wasm.OpcodeI32TruncF32S, wasm.OpcodeI32TruncF32U: + return signature_F32_I32, nil + case wasm.OpcodeI32TruncF64S, wasm.OpcodeI32TruncF64U: + return signature_F64_I32, nil + case wasm.OpcodeI64ExtendI32S, wasm.OpcodeI64ExtendI32U: + return signature_I32_I64, nil + case wasm.OpcodeI64TruncF32S, wasm.OpcodeI64TruncF32U: + return signature_F32_I64, nil + case wasm.OpcodeI64TruncF64S, wasm.OpcodeI64TruncF64U: + return signature_F64_I64, nil + case wasm.OpcodeF32ConvertI32S, wasm.OpcodeF32ConvertI32U: + return signature_I32_F32, nil + case wasm.OpcodeF32ConvertI64S, wasm.OpcodeF32ConvertI64U: + return signature_I64_F32, nil + case wasm.OpcodeF32DemoteF64: + return signature_F64_F32, nil + case wasm.OpcodeF64ConvertI32S, wasm.OpcodeF64ConvertI32U: + return signature_I32_F64, nil + case wasm.OpcodeF64ConvertI64S, wasm.OpcodeF64ConvertI64U: + return signature_I64_F64, nil + case wasm.OpcodeF64PromoteF32: + return signature_F32_F64, nil + case wasm.OpcodeI32ReinterpretF32: + return signature_F32_I32, nil + case wasm.OpcodeI64ReinterpretF64: + return signature_F64_I64, nil + case wasm.OpcodeF32ReinterpretI32: + return signature_I32_F32, nil + case wasm.OpcodeF64ReinterpretI64: + return signature_I64_F64, nil + case wasm.OpcodeI32Extend8S, wasm.OpcodeI32Extend16S: + return signature_I32_I32, nil + case wasm.OpcodeI64Extend8S, wasm.OpcodeI64Extend16S, wasm.OpcodeI64Extend32S: + return signature_I64_I64, nil + case wasm.OpcodeTableGet: + // table.get takes table's offset and pushes the ref type value of opaque pointer as i64 value onto the stack. + return signature_I32_I64, nil + case wasm.OpcodeTableSet: + // table.set takes table's offset and the ref type value of opaque pointer as i64 value. + return signature_I32I64_None, nil + case wasm.OpcodeRefFunc: + // ref.func is translated as pushing the compiled function's opaque pointer (uint64) at wazeroir layer. + return signature_None_I64, nil + case wasm.OpcodeRefIsNull: + // ref.is_null is translated as checking if the uint64 on the top of the stack (opaque pointer) is zero or not. + return signature_I64_I32, nil + case wasm.OpcodeRefNull: + // ref.null is translated as i64.const 0. + return signature_None_I64, nil + case wasm.OpcodeMiscPrefix: + switch miscOp := c.body[c.pc+1]; miscOp { + case wasm.OpcodeMiscI32TruncSatF32S, wasm.OpcodeMiscI32TruncSatF32U: + return signature_F32_I32, nil + case wasm.OpcodeMiscI32TruncSatF64S, wasm.OpcodeMiscI32TruncSatF64U: + return signature_F64_I32, nil + case wasm.OpcodeMiscI64TruncSatF32S, wasm.OpcodeMiscI64TruncSatF32U: + return signature_F32_I64, nil + case wasm.OpcodeMiscI64TruncSatF64S, wasm.OpcodeMiscI64TruncSatF64U: + return signature_F64_I64, nil + case wasm.OpcodeMiscMemoryInit, wasm.OpcodeMiscMemoryCopy, wasm.OpcodeMiscMemoryFill, + wasm.OpcodeMiscTableInit, wasm.OpcodeMiscTableCopy: + return signature_I32I32I32_None, nil + case wasm.OpcodeMiscDataDrop, wasm.OpcodeMiscElemDrop: + return signature_None_None, nil + case wasm.OpcodeMiscTableGrow: + return signature_I64I32_I32, nil + case wasm.OpcodeMiscTableSize: + return signature_None_I32, nil + case wasm.OpcodeMiscTableFill: + return signature_I32I64I32_None, nil + default: + return nil, fmt.Errorf("unsupported misc instruction in wazeroir: 0x%x", op) + } + case wasm.OpcodeVecPrefix: + switch vecOp := c.body[c.pc+1]; vecOp { + case wasm.OpcodeVecV128Const: + return signature_None_V128, nil + case wasm.OpcodeVecV128Load, wasm.OpcodeVecV128Load8x8s, wasm.OpcodeVecV128Load8x8u, + wasm.OpcodeVecV128Load16x4s, wasm.OpcodeVecV128Load16x4u, wasm.OpcodeVecV128Load32x2s, + wasm.OpcodeVecV128Load32x2u, wasm.OpcodeVecV128Load8Splat, wasm.OpcodeVecV128Load16Splat, + wasm.OpcodeVecV128Load32Splat, wasm.OpcodeVecV128Load64Splat, wasm.OpcodeVecV128Load32zero, + wasm.OpcodeVecV128Load64zero: + return signature_I32_V128, nil + case wasm.OpcodeVecV128Load8Lane, wasm.OpcodeVecV128Load16Lane, + wasm.OpcodeVecV128Load32Lane, wasm.OpcodeVecV128Load64Lane: + return signature_I32V128_V128, nil + case wasm.OpcodeVecV128Store, + wasm.OpcodeVecV128Store8Lane, + wasm.OpcodeVecV128Store16Lane, + wasm.OpcodeVecV128Store32Lane, + wasm.OpcodeVecV128Store64Lane: + return signature_I32V128_None, nil + case wasm.OpcodeVecI8x16ExtractLaneS, + wasm.OpcodeVecI8x16ExtractLaneU, + wasm.OpcodeVecI16x8ExtractLaneS, + wasm.OpcodeVecI16x8ExtractLaneU, + wasm.OpcodeVecI32x4ExtractLane: + return signature_V128_I32, nil + case wasm.OpcodeVecI64x2ExtractLane: + return signature_V128_I64, nil + case wasm.OpcodeVecF32x4ExtractLane: + return signature_V128_F32, nil + case wasm.OpcodeVecF64x2ExtractLane: + return signature_V128_F64, nil + case wasm.OpcodeVecI8x16ReplaceLane, wasm.OpcodeVecI16x8ReplaceLane, wasm.OpcodeVecI32x4ReplaceLane, + wasm.OpcodeVecI8x16Shl, wasm.OpcodeVecI8x16ShrS, wasm.OpcodeVecI8x16ShrU, + wasm.OpcodeVecI16x8Shl, wasm.OpcodeVecI16x8ShrS, wasm.OpcodeVecI16x8ShrU, + wasm.OpcodeVecI32x4Shl, wasm.OpcodeVecI32x4ShrS, wasm.OpcodeVecI32x4ShrU, + wasm.OpcodeVecI64x2Shl, wasm.OpcodeVecI64x2ShrS, wasm.OpcodeVecI64x2ShrU: + return signature_V128I32_V128, nil + case wasm.OpcodeVecI64x2ReplaceLane: + return signature_V128I64_V128, nil + case wasm.OpcodeVecF32x4ReplaceLane: + return signature_V128F32_V128, nil + case wasm.OpcodeVecF64x2ReplaceLane: + return signature_V128F64_V128, nil + case wasm.OpcodeVecI8x16Splat, + wasm.OpcodeVecI16x8Splat, + wasm.OpcodeVecI32x4Splat: + return signature_I32_V128, nil + case wasm.OpcodeVecI64x2Splat: + return signature_I64_V128, nil + case wasm.OpcodeVecF32x4Splat: + return signature_F32_V128, nil + case wasm.OpcodeVecF64x2Splat: + return signature_F64_V128, nil + case wasm.OpcodeVecV128i8x16Shuffle, wasm.OpcodeVecI8x16Swizzle, wasm.OpcodeVecV128And, wasm.OpcodeVecV128Or, wasm.OpcodeVecV128Xor, wasm.OpcodeVecV128AndNot: + return signature_V128V128_V128, nil + case wasm.OpcodeVecI8x16AllTrue, wasm.OpcodeVecI16x8AllTrue, wasm.OpcodeVecI32x4AllTrue, wasm.OpcodeVecI64x2AllTrue, + wasm.OpcodeVecV128AnyTrue, + wasm.OpcodeVecI8x16BitMask, wasm.OpcodeVecI16x8BitMask, wasm.OpcodeVecI32x4BitMask, wasm.OpcodeVecI64x2BitMask: + return signature_V128_I32, nil + case wasm.OpcodeVecV128Not, wasm.OpcodeVecI8x16Neg, wasm.OpcodeVecI16x8Neg, wasm.OpcodeVecI32x4Neg, wasm.OpcodeVecI64x2Neg, + wasm.OpcodeVecF32x4Neg, wasm.OpcodeVecF64x2Neg, wasm.OpcodeVecF32x4Sqrt, wasm.OpcodeVecF64x2Sqrt, + wasm.OpcodeVecI8x16Abs, wasm.OpcodeVecI8x16Popcnt, wasm.OpcodeVecI16x8Abs, wasm.OpcodeVecI32x4Abs, wasm.OpcodeVecI64x2Abs, + wasm.OpcodeVecF32x4Abs, wasm.OpcodeVecF64x2Abs, + wasm.OpcodeVecF32x4Ceil, wasm.OpcodeVecF32x4Floor, wasm.OpcodeVecF32x4Trunc, wasm.OpcodeVecF32x4Nearest, + wasm.OpcodeVecF64x2Ceil, wasm.OpcodeVecF64x2Floor, wasm.OpcodeVecF64x2Trunc, wasm.OpcodeVecF64x2Nearest, + wasm.OpcodeVecI16x8ExtendLowI8x16S, wasm.OpcodeVecI16x8ExtendHighI8x16S, wasm.OpcodeVecI16x8ExtendLowI8x16U, wasm.OpcodeVecI16x8ExtendHighI8x16U, + wasm.OpcodeVecI32x4ExtendLowI16x8S, wasm.OpcodeVecI32x4ExtendHighI16x8S, wasm.OpcodeVecI32x4ExtendLowI16x8U, wasm.OpcodeVecI32x4ExtendHighI16x8U, + wasm.OpcodeVecI64x2ExtendLowI32x4S, wasm.OpcodeVecI64x2ExtendHighI32x4S, wasm.OpcodeVecI64x2ExtendLowI32x4U, wasm.OpcodeVecI64x2ExtendHighI32x4U, + wasm.OpcodeVecI16x8ExtaddPairwiseI8x16S, wasm.OpcodeVecI16x8ExtaddPairwiseI8x16U, wasm.OpcodeVecI32x4ExtaddPairwiseI16x8S, wasm.OpcodeVecI32x4ExtaddPairwiseI16x8U, + wasm.OpcodeVecF64x2PromoteLowF32x4Zero, wasm.OpcodeVecF32x4DemoteF64x2Zero, + wasm.OpcodeVecF32x4ConvertI32x4S, wasm.OpcodeVecF32x4ConvertI32x4U, + wasm.OpcodeVecF64x2ConvertLowI32x4S, wasm.OpcodeVecF64x2ConvertLowI32x4U, + wasm.OpcodeVecI32x4TruncSatF32x4S, wasm.OpcodeVecI32x4TruncSatF32x4U, + wasm.OpcodeVecI32x4TruncSatF64x2SZero, wasm.OpcodeVecI32x4TruncSatF64x2UZero: + return signature_V128_V128, nil + case wasm.OpcodeVecV128Bitselect: + return signature_V128V128V128_V32, nil + case wasm.OpcodeVecI8x16Eq, wasm.OpcodeVecI8x16Ne, wasm.OpcodeVecI8x16LtS, wasm.OpcodeVecI8x16LtU, wasm.OpcodeVecI8x16GtS, + wasm.OpcodeVecI8x16GtU, wasm.OpcodeVecI8x16LeS, wasm.OpcodeVecI8x16LeU, wasm.OpcodeVecI8x16GeS, wasm.OpcodeVecI8x16GeU, + wasm.OpcodeVecI16x8Eq, wasm.OpcodeVecI16x8Ne, wasm.OpcodeVecI16x8LtS, wasm.OpcodeVecI16x8LtU, wasm.OpcodeVecI16x8GtS, + wasm.OpcodeVecI16x8GtU, wasm.OpcodeVecI16x8LeS, wasm.OpcodeVecI16x8LeU, wasm.OpcodeVecI16x8GeS, wasm.OpcodeVecI16x8GeU, + wasm.OpcodeVecI32x4Eq, wasm.OpcodeVecI32x4Ne, wasm.OpcodeVecI32x4LtS, wasm.OpcodeVecI32x4LtU, wasm.OpcodeVecI32x4GtS, + wasm.OpcodeVecI32x4GtU, wasm.OpcodeVecI32x4LeS, wasm.OpcodeVecI32x4LeU, wasm.OpcodeVecI32x4GeS, wasm.OpcodeVecI32x4GeU, + wasm.OpcodeVecI64x2Eq, wasm.OpcodeVecI64x2Ne, wasm.OpcodeVecI64x2LtS, wasm.OpcodeVecI64x2GtS, wasm.OpcodeVecI64x2LeS, + wasm.OpcodeVecI64x2GeS, wasm.OpcodeVecF32x4Eq, wasm.OpcodeVecF32x4Ne, wasm.OpcodeVecF32x4Lt, wasm.OpcodeVecF32x4Gt, + wasm.OpcodeVecF32x4Le, wasm.OpcodeVecF32x4Ge, wasm.OpcodeVecF64x2Eq, wasm.OpcodeVecF64x2Ne, wasm.OpcodeVecF64x2Lt, + wasm.OpcodeVecF64x2Gt, wasm.OpcodeVecF64x2Le, wasm.OpcodeVecF64x2Ge, + wasm.OpcodeVecI8x16Add, wasm.OpcodeVecI8x16AddSatS, wasm.OpcodeVecI8x16AddSatU, wasm.OpcodeVecI8x16Sub, + wasm.OpcodeVecI8x16SubSatS, wasm.OpcodeVecI8x16SubSatU, + wasm.OpcodeVecI16x8Add, wasm.OpcodeVecI16x8AddSatS, wasm.OpcodeVecI16x8AddSatU, wasm.OpcodeVecI16x8Sub, + wasm.OpcodeVecI16x8SubSatS, wasm.OpcodeVecI16x8SubSatU, wasm.OpcodeVecI16x8Mul, + wasm.OpcodeVecI32x4Add, wasm.OpcodeVecI32x4Sub, wasm.OpcodeVecI32x4Mul, + wasm.OpcodeVecI64x2Add, wasm.OpcodeVecI64x2Sub, wasm.OpcodeVecI64x2Mul, + wasm.OpcodeVecF32x4Add, wasm.OpcodeVecF32x4Sub, wasm.OpcodeVecF32x4Mul, wasm.OpcodeVecF32x4Div, + wasm.OpcodeVecF64x2Add, wasm.OpcodeVecF64x2Sub, wasm.OpcodeVecF64x2Mul, wasm.OpcodeVecF64x2Div, + wasm.OpcodeVecI8x16MinS, wasm.OpcodeVecI8x16MinU, wasm.OpcodeVecI8x16MaxS, wasm.OpcodeVecI8x16MaxU, wasm.OpcodeVecI8x16AvgrU, + wasm.OpcodeVecI16x8MinS, wasm.OpcodeVecI16x8MinU, wasm.OpcodeVecI16x8MaxS, wasm.OpcodeVecI16x8MaxU, wasm.OpcodeVecI16x8AvgrU, + wasm.OpcodeVecI32x4MinS, wasm.OpcodeVecI32x4MinU, wasm.OpcodeVecI32x4MaxS, wasm.OpcodeVecI32x4MaxU, + wasm.OpcodeVecF32x4Min, wasm.OpcodeVecF32x4Max, wasm.OpcodeVecF64x2Min, wasm.OpcodeVecF64x2Max, + wasm.OpcodeVecF32x4Pmin, wasm.OpcodeVecF32x4Pmax, wasm.OpcodeVecF64x2Pmin, wasm.OpcodeVecF64x2Pmax, + wasm.OpcodeVecI16x8Q15mulrSatS, + wasm.OpcodeVecI16x8ExtMulLowI8x16S, wasm.OpcodeVecI16x8ExtMulHighI8x16S, wasm.OpcodeVecI16x8ExtMulLowI8x16U, wasm.OpcodeVecI16x8ExtMulHighI8x16U, + wasm.OpcodeVecI32x4ExtMulLowI16x8S, wasm.OpcodeVecI32x4ExtMulHighI16x8S, wasm.OpcodeVecI32x4ExtMulLowI16x8U, wasm.OpcodeVecI32x4ExtMulHighI16x8U, + wasm.OpcodeVecI64x2ExtMulLowI32x4S, wasm.OpcodeVecI64x2ExtMulHighI32x4S, wasm.OpcodeVecI64x2ExtMulLowI32x4U, wasm.OpcodeVecI64x2ExtMulHighI32x4U, + wasm.OpcodeVecI32x4DotI16x8S, + wasm.OpcodeVecI8x16NarrowI16x8S, wasm.OpcodeVecI8x16NarrowI16x8U, wasm.OpcodeVecI16x8NarrowI32x4S, wasm.OpcodeVecI16x8NarrowI32x4U: + return signature_V128V128_V128, nil + default: + return nil, fmt.Errorf("unsupported vector instruction in wazeroir: %s", wasm.VectorInstructionName(vecOp)) + } + default: + return nil, fmt.Errorf("unsupported instruction in wazeroir: 0x%x", op) + } +} + +// funcTypeToIRSignatures is the central cache for a module to get the *signature +// for function calls. +type funcTypeToIRSignatures struct { + directCalls []*signature + indirectCalls []*signature + wasmTypes []wasm.FunctionType +} + +// get returns the *signature for the direct or indirect function call against functions whose type is at `typeIndex`. +func (f *funcTypeToIRSignatures) get(typeIndex wasm.Index, indirect bool) *signature { + var sig *signature + if indirect { + sig = f.indirectCalls[typeIndex] + } else { + sig = f.directCalls[typeIndex] + } + if sig != nil { + return sig + } + + tp := &f.wasmTypes[typeIndex] + if indirect { + sig = &signature{ + in: make([]UnsignedType, 0, len(tp.Params)+1), // +1 to reserve space for call indirect index. + out: make([]UnsignedType, 0, len(tp.Results)), + } + } else { + sig = &signature{ + in: make([]UnsignedType, 0, len(tp.Params)), + out: make([]UnsignedType, 0, len(tp.Results)), + } + } + + for _, vt := range tp.Params { + sig.in = append(sig.in, wasmValueTypeToUnsignedType(vt)) + } + for _, vt := range tp.Results { + sig.out = append(sig.out, wasmValueTypeToUnsignedType(vt)) + } + + if indirect { + sig.in = append(sig.in, UnsignedTypeI32) + f.indirectCalls[typeIndex] = sig + } else { + f.directCalls[typeIndex] = sig + } + return sig +} + +func wasmValueTypeToUnsignedType(vt wasm.ValueType) UnsignedType { + switch vt { + case wasm.ValueTypeI32: + return UnsignedTypeI32 + case wasm.ValueTypeI64, + // From wazeroir layer, ref type values are opaque 64-bit pointers. + wasm.ValueTypeExternref, wasm.ValueTypeFuncref: + return UnsignedTypeI64 + case wasm.ValueTypeF32: + return UnsignedTypeF32 + case wasm.ValueTypeF64: + return UnsignedTypeF64 + case wasm.ValueTypeV128: + return UnsignedTypeV128 + } + panic("unreachable") +} + +func wasmValueTypeToUnsignedOutSignature(vt wasm.ValueType) *signature { + switch vt { + case wasm.ValueTypeI32: + return signature_None_I32 + case wasm.ValueTypeI64, + // From wazeroir layer, ref type values are opaque 64-bit pointers. + wasm.ValueTypeExternref, wasm.ValueTypeFuncref: + return signature_None_I64 + case wasm.ValueTypeF32: + return signature_None_F32 + case wasm.ValueTypeF64: + return signature_None_F64 + case wasm.ValueTypeV128: + return signature_None_V128 + } + panic("unreachable") +} + +func wasmValueTypeToUnsignedInSignature(vt wasm.ValueType) *signature { + switch vt { + case wasm.ValueTypeI32: + return signature_I32_None + case wasm.ValueTypeI64, + // From wazeroir layer, ref type values are opaque 64-bit pointers. + wasm.ValueTypeExternref, wasm.ValueTypeFuncref: + return signature_I64_None + case wasm.ValueTypeF32: + return signature_F32_None + case wasm.ValueTypeF64: + return signature_F64_None + case wasm.ValueTypeV128: + return signature_V128_None + } + panic("unreachable") +} + +func wasmValueTypeToUnsignedInOutSignature(vt wasm.ValueType) *signature { + switch vt { + case wasm.ValueTypeI32: + return signature_I32_I32 + case wasm.ValueTypeI64, + // From wazeroir layer, ref type values are opaque 64-bit pointers. + wasm.ValueTypeExternref, wasm.ValueTypeFuncref: + return signature_I64_I64 + case wasm.ValueTypeF32: + return signature_F32_F32 + case wasm.ValueTypeF64: + return signature_F64_F64 + case wasm.ValueTypeV128: + return signature_V128_V128 + } + panic("unreachable") +} diff --git a/vendor/github.com/tetratelabs/wazero/internal/wazeroir/wazeroir.go b/vendor/github.com/tetratelabs/wazero/internal/wazeroir/wazeroir.go new file mode 100644 index 000000000..894c4598b --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/wazeroir/wazeroir.go @@ -0,0 +1,8 @@ +// Package wazeroir is a pkg to compile down the standard Wasm binary to wazero's specific IR (wazeroir). +// The wazeroir is inspired by microwasm format (a.k.a. LightbeamIR), previously used +// in the lightbeam compiler in Wasmtime, though it is not specified and only exists +// in the previous codebase of wasmtime +// e.g. https://github.com/bytecodealliance/wasmtime/blob/v0.29.0/crates/lightbeam/src/microwasm.rs +// +// See RATIONALE.md for detail. +package wazeroir diff --git a/vendor/github.com/tetratelabs/wazero/netlify.toml b/vendor/github.com/tetratelabs/wazero/netlify.toml new file mode 100644 index 000000000..1ba638bfe --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/netlify.toml @@ -0,0 +1,15 @@ +[build] + base = "site" + publish = "public" + +[build.environment] + HUGO_VERSION = "0.115.2" + +[context.production] + command = "git submodule update --init && hugo --gc --minify" + +[context.deploy-preview] + command = "git submodule update --init && hugo --gc --minify -b $DEPLOY_PRIME_URL" + +[context.branch-deploy] + command = "git submodule update --init && hugo --gc --minify -b $DEPLOY_PRIME_URL" diff --git a/vendor/github.com/tetratelabs/wazero/runtime.go b/vendor/github.com/tetratelabs/wazero/runtime.go new file mode 100644 index 000000000..220324ed8 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/runtime.go @@ -0,0 +1,374 @@ +package wazero + +import ( + "context" + "fmt" + "sync/atomic" + + "github.com/tetratelabs/wazero/api" + experimentalapi "github.com/tetratelabs/wazero/experimental" + internalclose "github.com/tetratelabs/wazero/internal/close" + internalsock "github.com/tetratelabs/wazero/internal/sock" + internalsys "github.com/tetratelabs/wazero/internal/sys" + "github.com/tetratelabs/wazero/internal/wasm" + binaryformat "github.com/tetratelabs/wazero/internal/wasm/binary" + "github.com/tetratelabs/wazero/sys" +) + +// Runtime allows embedding of WebAssembly modules. +// +// The below is an example of basic initialization: +// +// ctx := context.Background() +// r := wazero.NewRuntime(ctx) +// defer r.Close(ctx) // This closes everything this Runtime created. +// +// mod, _ := r.Instantiate(ctx, wasm) +// +// # Notes +// +// - This is an interface for decoupling, not third-party implementations. +// All implementations are in wazero. +// - Closing this closes any CompiledModule or Module it instantiated. +type Runtime interface { + // Instantiate instantiates a module from the WebAssembly binary (%.wasm) + // with default configuration, which notably calls the "_start" function, + // if it exists. + // + // Here's an example: + // ctx := context.Background() + // r := wazero.NewRuntime(ctx) + // defer r.Close(ctx) // This closes everything this Runtime created. + // + // mod, _ := r.Instantiate(ctx, wasm) + // + // # Notes + // + // - See notes on InstantiateModule for error scenarios. + // - See InstantiateWithConfig for configuration overrides. + Instantiate(ctx context.Context, source []byte) (api.Module, error) + + // InstantiateWithConfig instantiates a module from the WebAssembly binary + // (%.wasm) or errs for reasons including exit or validation. + // + // Here's an example: + // ctx := context.Background() + // r := wazero.NewRuntime(ctx) + // defer r.Close(ctx) // This closes everything this Runtime created. + // + // mod, _ := r.InstantiateWithConfig(ctx, wasm, + // wazero.NewModuleConfig().WithName("rotate")) + // + // # Notes + // + // - See notes on InstantiateModule for error scenarios. + // - If you aren't overriding defaults, use Instantiate. + // - This is a convenience utility that chains CompileModule with + // InstantiateModule. To instantiate the same source multiple times, + // use CompileModule as InstantiateModule avoids redundant decoding + // and/or compilation. + InstantiateWithConfig(ctx context.Context, source []byte, config ModuleConfig) (api.Module, error) + + // NewHostModuleBuilder lets you create modules out of functions defined in Go. + // + // Below defines and instantiates a module named "env" with one function: + // + // ctx := context.Background() + // hello := func() { + // fmt.Fprintln(stdout, "hello!") + // } + // _, err := r.NewHostModuleBuilder("env"). + // NewFunctionBuilder().WithFunc(hello).Export("hello"). + // Instantiate(ctx, r) + // + // Note: empty `moduleName` is not allowed. + NewHostModuleBuilder(moduleName string) HostModuleBuilder + + // CompileModule decodes the WebAssembly binary (%.wasm) or errs if invalid. + // Any pre-compilation done after decoding wasm is dependent on RuntimeConfig. + // + // There are two main reasons to use CompileModule instead of Instantiate: + // - Improve performance when the same module is instantiated multiple times under different names + // - Reduce the amount of errors that can occur during InstantiateModule. + // + // # Notes + // + // - The resulting module name defaults to what was binary from the custom name section. + // - Any pre-compilation done after decoding the source is dependent on RuntimeConfig. + // + // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#name-section%E2%91%A0 + CompileModule(ctx context.Context, binary []byte) (CompiledModule, error) + + // InstantiateModule instantiates the module or errs for reasons including + // exit or validation. + // + // Here's an example: + // mod, _ := n.InstantiateModule(ctx, compiled, wazero.NewModuleConfig(). + // WithName("prod")) + // + // # Errors + // + // While CompiledModule is pre-validated, there are a few situations which + // can cause an error: + // - The module name is already in use. + // - The module has a table element initializer that resolves to an index + // outside the Table minimum size. + // - The module has a start function, and it failed to execute. + // - The module was compiled to WASI and exited with a non-zero exit + // code, you'll receive a sys.ExitError. + // - RuntimeConfig.WithCloseOnContextDone was enabled and a context + // cancellation or deadline triggered before a start function returned. + InstantiateModule(ctx context.Context, compiled CompiledModule, config ModuleConfig) (api.Module, error) + + // CloseWithExitCode closes all the modules that have been initialized in this Runtime with the provided exit code. + // An error is returned if any module returns an error when closed. + // + // Here's an example: + // ctx := context.Background() + // r := wazero.NewRuntime(ctx) + // defer r.CloseWithExitCode(ctx, 2) // This closes everything this Runtime created. + // + // // Everything below here can be closed, but will anyway due to above. + // _, _ = wasi_snapshot_preview1.InstantiateSnapshotPreview1(ctx, r) + // mod, _ := r.Instantiate(ctx, wasm) + CloseWithExitCode(ctx context.Context, exitCode uint32) error + + // Module returns an instantiated module in this runtime or nil if there aren't any. + Module(moduleName string) api.Module + + // Closer closes all compiled code by delegating to CloseWithExitCode with an exit code of zero. + api.Closer +} + +// NewRuntime returns a runtime with a configuration assigned by NewRuntimeConfig. +func NewRuntime(ctx context.Context) Runtime { + return NewRuntimeWithConfig(ctx, NewRuntimeConfig()) +} + +// NewRuntimeWithConfig returns a runtime with the given configuration. +func NewRuntimeWithConfig(ctx context.Context, rConfig RuntimeConfig) Runtime { + config := rConfig.(*runtimeConfig) + var engine wasm.Engine + var cacheImpl *cache + if c := config.cache; c != nil { + // If the Cache is configured, we share the engine. + cacheImpl = c.(*cache) + engine = cacheImpl.initEngine(config.engineKind, config.newEngine, ctx, config.enabledFeatures) + } else { + // Otherwise, we create a new engine. + engine = config.newEngine(ctx, config.enabledFeatures, nil) + } + store := wasm.NewStore(config.enabledFeatures, engine) + return &runtime{ + cache: cacheImpl, + store: store, + enabledFeatures: config.enabledFeatures, + memoryLimitPages: config.memoryLimitPages, + memoryCapacityFromMax: config.memoryCapacityFromMax, + dwarfDisabled: config.dwarfDisabled, + storeCustomSections: config.storeCustomSections, + ensureTermination: config.ensureTermination, + } +} + +// runtime allows decoupling of public interfaces from internal representation. +type runtime struct { + store *wasm.Store + cache *cache + enabledFeatures api.CoreFeatures + memoryLimitPages uint32 + memoryCapacityFromMax bool + dwarfDisabled bool + storeCustomSections bool + + // closed is the pointer used both to guard moduleEngine.CloseWithExitCode and to store the exit code. + // + // The update value is 1 + exitCode << 32. This ensures an exit code of zero isn't mistaken for never closed. + // + // Note: Exclusively reading and updating this with atomics guarantees cross-goroutine observations. + // See /RATIONALE.md + closed atomic.Uint64 + + ensureTermination bool +} + +// Module implements Runtime.Module. +func (r *runtime) Module(moduleName string) api.Module { + if len(moduleName) == 0 { + return nil + } + return r.store.Module(moduleName) +} + +// CompileModule implements Runtime.CompileModule +func (r *runtime) CompileModule(ctx context.Context, binary []byte) (CompiledModule, error) { + if err := r.failIfClosed(); err != nil { + return nil, err + } + + internal, err := binaryformat.DecodeModule(binary, r.enabledFeatures, + r.memoryLimitPages, r.memoryCapacityFromMax, !r.dwarfDisabled, r.storeCustomSections) + if err != nil { + return nil, err + } else if err = internal.Validate(r.enabledFeatures); err != nil { + // TODO: decoders should validate before returning, as that allows + // them to err with the correct position in the wasm binary. + return nil, err + } + + // Now that the module is validated, cache the memory definitions. + // TODO: lazy initialization of memory definition. + internal.BuildMemoryDefinitions() + + c := &compiledModule{module: internal, compiledEngine: r.store.Engine} + + // typeIDs are static and compile-time known. + typeIDs, err := r.store.GetFunctionTypeIDs(internal.TypeSection) + if err != nil { + return nil, err + } + c.typeIDs = typeIDs + + listeners, err := buildFunctionListeners(ctx, internal) + if err != nil { + return nil, err + } + internal.AssignModuleID(binary, listeners, r.ensureTermination) + if err = r.store.Engine.CompileModule(ctx, internal, listeners, r.ensureTermination); err != nil { + return nil, err + } + return c, nil +} + +func buildFunctionListeners(ctx context.Context, internal *wasm.Module) ([]experimentalapi.FunctionListener, error) { + // Test to see if internal code are using an experimental feature. + fnlf := ctx.Value(experimentalapi.FunctionListenerFactoryKey{}) + if fnlf == nil { + return nil, nil + } + factory := fnlf.(experimentalapi.FunctionListenerFactory) + importCount := internal.ImportFunctionCount + listeners := make([]experimentalapi.FunctionListener, len(internal.FunctionSection)) + for i := 0; i < len(listeners); i++ { + listeners[i] = factory.NewFunctionListener(internal.FunctionDefinition(uint32(i) + importCount)) + } + return listeners, nil +} + +// failIfClosed returns an error if CloseWithExitCode was called implicitly (by Close) or explicitly. +func (r *runtime) failIfClosed() error { + if closed := r.closed.Load(); closed != 0 { + return fmt.Errorf("runtime closed with exit_code(%d)", uint32(closed>>32)) + } + return nil +} + +// Instantiate implements Runtime.Instantiate +func (r *runtime) Instantiate(ctx context.Context, binary []byte) (api.Module, error) { + return r.InstantiateWithConfig(ctx, binary, NewModuleConfig()) +} + +// InstantiateWithConfig implements Runtime.InstantiateWithConfig +func (r *runtime) InstantiateWithConfig(ctx context.Context, binary []byte, config ModuleConfig) (api.Module, error) { + if compiled, err := r.CompileModule(ctx, binary); err != nil { + return nil, err + } else { + compiled.(*compiledModule).closeWithModule = true + return r.InstantiateModule(ctx, compiled, config) + } +} + +// InstantiateModule implements Runtime.InstantiateModule. +func (r *runtime) InstantiateModule( + ctx context.Context, + compiled CompiledModule, + mConfig ModuleConfig, +) (mod api.Module, err error) { + if err = r.failIfClosed(); err != nil { + return nil, err + } + + code := compiled.(*compiledModule) + config := mConfig.(*moduleConfig) + + // Only add guest module configuration to guests. + if !code.module.IsHostModule { + if sockConfig, ok := ctx.Value(internalsock.ConfigKey{}).(*internalsock.Config); ok { + config.sockConfig = sockConfig + } + } + + var sysCtx *internalsys.Context + if sysCtx, err = config.toSysContext(); err != nil { + return + } + + name := config.name + if !config.nameSet && code.module.NameSection != nil && code.module.NameSection.ModuleName != "" { + name = code.module.NameSection.ModuleName + } + + // Instantiate the module. + mod, err = r.store.Instantiate(ctx, code.module, name, sysCtx, code.typeIDs) + if err != nil { + // If there was an error, don't leak the compiled module. + if code.closeWithModule { + _ = code.Close(ctx) // don't overwrite the error + } + return + } + + if closeNotifier, ok := ctx.Value(internalclose.NotifierKey{}).(internalclose.Notifier); ok { + mod.(*wasm.ModuleInstance).CloseNotifier = closeNotifier + } + + // Attach the code closer so that anything afterward closes the compiled + // code when closing the module. + if code.closeWithModule { + mod.(*wasm.ModuleInstance).CodeCloser = code + } + + // Now, invoke any start functions, failing at first error. + for _, fn := range config.startFunctions { + start := mod.ExportedFunction(fn) + if start == nil { + continue + } + if _, err = start.Call(ctx); err != nil { + _ = mod.Close(ctx) // Don't leak the module on error. + + if se, ok := err.(*sys.ExitError); ok { + if se.ExitCode() == 0 { // Don't err on success. + err = nil + } + return // Don't wrap an exit error + } + err = fmt.Errorf("module[%s] function[%s] failed: %w", name, fn, err) + return + } + } + return +} + +// Close implements api.Closer embedded in Runtime. +func (r *runtime) Close(ctx context.Context) error { + return r.CloseWithExitCode(ctx, 0) +} + +// CloseWithExitCode implements Runtime.CloseWithExitCode +// +// Note: it also marks the internal `closed` field +func (r *runtime) CloseWithExitCode(ctx context.Context, exitCode uint32) error { + closed := uint64(1) + uint64(exitCode)<<32 // Store exitCode as high-order bits. + if !r.closed.CompareAndSwap(0, closed) { + return nil + } + err := r.store.CloseWithExitCode(ctx, exitCode) + if r.cache == nil { + // Close the engine if the cache is not configured, which means that this engine is scoped in this runtime. + if errCloseEngine := r.store.Engine.Close(); errCloseEngine != nil { + return errCloseEngine + } + } + return err +} diff --git a/vendor/github.com/tetratelabs/wazero/sys/clock.go b/vendor/github.com/tetratelabs/wazero/sys/clock.go new file mode 100644 index 000000000..1c91ce246 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/sys/clock.go @@ -0,0 +1,26 @@ +package sys + +// ClockResolution is a positive granularity of clock precision in +// nanoseconds. For example, if the resolution is 1us, this returns 1000. +// +// Note: Some implementations return arbitrary resolution because there's +// no perfect alternative. For example, according to the source in time.go, +// windows monotonic resolution can be 15ms. See /RATIONALE.md. +type ClockResolution uint32 + +// Walltime returns the current unix/epoch time, seconds since midnight UTC +// 1 January 1970, with a nanosecond fraction. +type Walltime func() (sec int64, nsec int32) + +// Nanotime returns nanoseconds since an arbitrary start point, used to measure +// elapsed time. This is sometimes referred to as a tick or monotonic time. +// +// Note: There are no constraints on the value return except that it +// increments. For example, -1 is a valid if the next value is >= 0. +type Nanotime func() int64 + +// Nanosleep puts the current goroutine to sleep for at least ns nanoseconds. +type Nanosleep func(ns int64) + +// Osyield yields the processor, typically to implement spin-wait loops. +type Osyield func() diff --git a/vendor/github.com/tetratelabs/wazero/sys/error.go b/vendor/github.com/tetratelabs/wazero/sys/error.go new file mode 100644 index 000000000..c3efbad96 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/sys/error.go @@ -0,0 +1,83 @@ +// Package sys includes constants and types used by both public and internal APIs. +package sys + +import ( + "context" + "fmt" +) + +// These two special exit codes are reserved by wazero for context Cancel and Timeout integrations. +// The assumption here is that well-behaving Wasm programs won't use these two exit codes. +const ( + // ExitCodeContextCanceled corresponds to context.Canceled and returned by ExitError.ExitCode in that case. + ExitCodeContextCanceled uint32 = 0xffffffff + // ExitCodeDeadlineExceeded corresponds to context.DeadlineExceeded and returned by ExitError.ExitCode in that case. + ExitCodeDeadlineExceeded uint32 = 0xefffffff +) + +// ExitError is returned to a caller of api.Function when api.Module CloseWithExitCode was invoked, +// or context.Context passed to api.Function Call was canceled or reached the Timeout. +// +// ExitCode zero value means success while any other value is an error. +// +// Here's an example of how to get the exit code: +// +// main := module.ExportedFunction("main") +// if err := main(ctx); err != nil { +// if exitErr, ok := err.(*sys.ExitError); ok { +// // This means your module exited with non-zero code! +// } +// --snip-- +// +// Note: While possible the reason of this was "proc_exit" from "wasi_snapshot_preview1", it could be from other host +// functions, for example an AssemblyScript's abort handler, or any arbitrary caller of CloseWithExitCode. +// +// See https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md#proc_exit and +// https://www.assemblyscript.org/concepts.html#special-imports +// +// Note: In the case of context cancellation or timeout, the api.Module from which the api.Function created is closed. +type ExitError struct { + // Note: this is a struct not a uint32 type as it was originally one and + // we don't want to break call-sites that cast into it. + exitCode uint32 +} + +var exitZero = &ExitError{} + +func NewExitError(exitCode uint32) *ExitError { + if exitCode == 0 { + return exitZero + } + return &ExitError{exitCode: exitCode} +} + +// ExitCode returns zero on success, and an arbitrary value otherwise. +func (e *ExitError) ExitCode() uint32 { + return e.exitCode +} + +// Error implements the error interface. +func (e *ExitError) Error() string { + switch e.exitCode { + case ExitCodeContextCanceled: + return fmt.Sprintf("module closed with %s", context.Canceled) + case ExitCodeDeadlineExceeded: + return fmt.Sprintf("module closed with %s", context.DeadlineExceeded) + default: + return fmt.Sprintf("module closed with exit_code(%d)", e.exitCode) + } +} + +// Is allows use via errors.Is +func (e *ExitError) Is(err error) bool { + if target, ok := err.(*ExitError); ok { + return e.exitCode == target.exitCode + } + if e.exitCode == ExitCodeContextCanceled && err == context.Canceled { + return true + } + if e.exitCode == ExitCodeDeadlineExceeded && err == context.DeadlineExceeded { + return true + } + return false +} diff --git a/vendor/github.com/tetratelabs/wazero/sys/stat.go b/vendor/github.com/tetratelabs/wazero/sys/stat.go new file mode 100644 index 000000000..bb7b9e5d3 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/sys/stat.go @@ -0,0 +1,107 @@ +package sys + +import "io/fs" + +// Inode is the file serial number, or zero if unknown. +// +// Any constant value will invalidate functions that use this for +// equivalence, such as os.SameFile (Stat_t.Ino). +// +// When zero is returned by a `readdir`, some compilers will attempt to +// get a non-zero value with `lstat`. Those using this for darwin's definition +// of `getdirentries` conflate zero `d_fileno` with a deleted file, so skip the +// entry. See /RATIONALE.md for more on this. +type Inode = uint64 + +// ^-- Inode is a type alias to consolidate documentation and aid in reference +// searches. While only Stat_t is exposed publicly at the moment, this is used +// internally for Dirent and several function return values. + +// EpochNanos is a timestamp in epoch nanoseconds, or zero if unknown. +// +// This defines epoch time the same way as Walltime, except this value is +// packed into an int64. Common conversions are detailed in the examples. +type EpochNanos = int64 + +// Stat_t is similar to syscall.Stat_t, except available on all operating +// systems, including Windows. +// +// # Notes +// +// - This is used for WebAssembly ABI emulating the POSIX `stat` system call. +// Fields included are required for WebAssembly ABI including wasip1 +// (a.k.a. wasix) and wasi-filesystem (a.k.a. wasip2). See +// https://pubs.opengroup.org/onlinepubs/9699919799/functions/stat.html +// - Fields here are required for WebAssembly ABI including wasip1 +// (a.k.a. wasix) and wasi-filesystem (a.k.a. wasip2). +// - This isn't the same as syscall.Stat_t because wazero supports Windows, +// which doesn't have that type. runtime.GOOS that has this already also +// have inconsistent field lengths, which complicates wasm binding. +// - Use NewStat_t to create this from an existing fs.FileInfo. +// - For portability, numeric fields are 64-bit when at least one platform +// defines it that large. +type Stat_t struct { + // Dev is the device ID of device containing the file. + Dev uint64 + + // Ino is the file serial number, or zero if not available. See Inode for + // more details including impact returning a zero value. + Ino Inode + + // Mode is the same as Mode on fs.FileInfo containing bits to identify the + // type of the file (fs.ModeType) and its permissions (fs.ModePerm). + Mode fs.FileMode + + // Nlink is the number of hard links to the file. + // + // Note: This value is platform-specific and often at least one. Linux will + // return 1+N for a directory, where BSD (like Darwin) return 2+N, which + // includes the dot entry. + Nlink uint64 + + // Size is the length in bytes for regular files. For symbolic links, this + // is length in bytes of the pathname contained in the symbolic link. + Size int64 + + // Atim is the last data access timestamp in epoch nanoseconds. + Atim EpochNanos + + // Mtim is the last data modification timestamp in epoch nanoseconds. + Mtim EpochNanos + + // Ctim is the last file status change timestamp in epoch nanoseconds. + Ctim EpochNanos +} + +// NewStat_t fills a new Stat_t from `info`, including any runtime.GOOS-specific +// details from fs.FileInfo `Sys`. When `Sys` is already a *Stat_t, it is +// returned as-is. +// +// # Notes +// +// - When already in fs.FileInfo `Sys`, Stat_t must be a pointer. +// - When runtime.GOOS is "windows" Stat_t.Ino will be zero. +// - When fs.FileInfo `Sys` is nil or unknown, some fields not in fs.FileInfo +// are defaulted: Stat_t.Atim and Stat_t.Ctim are set to `ModTime`, and +// are set to ModTime and Stat_t.Nlink is set to 1. +func NewStat_t(info fs.FileInfo) Stat_t { + // Note: Pointer, not val, for parity with Go, which sets *syscall.Stat_t + if st, ok := info.Sys().(*Stat_t); ok { + return *st + } + return statFromFileInfo(info) +} + +func defaultStatFromFileInfo(info fs.FileInfo) Stat_t { + st := Stat_t{} + st.Ino = 0 + st.Dev = 0 + st.Mode = info.Mode() + st.Nlink = 1 + st.Size = info.Size() + mtim := info.ModTime().UnixNano() // Set all times to the mod time + st.Atim = mtim + st.Mtim = mtim + st.Ctim = mtim + return st +} diff --git a/vendor/github.com/tetratelabs/wazero/sys/stat_bsd.go b/vendor/github.com/tetratelabs/wazero/sys/stat_bsd.go new file mode 100644 index 000000000..3bf9b5d14 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/sys/stat_bsd.go @@ -0,0 +1,29 @@ +//go:build (amd64 || arm64) && (darwin || freebsd) + +package sys + +import ( + "io/fs" + "syscall" +) + +const sysParseable = true + +func statFromFileInfo(info fs.FileInfo) Stat_t { + if d, ok := info.Sys().(*syscall.Stat_t); ok { + st := Stat_t{} + st.Dev = uint64(d.Dev) + st.Ino = d.Ino + st.Mode = info.Mode() + st.Nlink = uint64(d.Nlink) + st.Size = d.Size + atime := d.Atimespec + st.Atim = atime.Sec*1e9 + atime.Nsec + mtime := d.Mtimespec + st.Mtim = mtime.Sec*1e9 + mtime.Nsec + ctime := d.Ctimespec + st.Ctim = ctime.Sec*1e9 + ctime.Nsec + return st + } + return defaultStatFromFileInfo(info) +} diff --git a/vendor/github.com/tetratelabs/wazero/sys/stat_linux.go b/vendor/github.com/tetratelabs/wazero/sys/stat_linux.go new file mode 100644 index 000000000..9b5e20e8d --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/sys/stat_linux.go @@ -0,0 +1,32 @@ +//go:build (amd64 || arm64 || riscv64) && linux + +// Note: This expression is not the same as compiler support, even if it looks +// similar. Platform functions here are used in interpreter mode as well. + +package sys + +import ( + "io/fs" + "syscall" +) + +const sysParseable = true + +func statFromFileInfo(info fs.FileInfo) Stat_t { + if d, ok := info.Sys().(*syscall.Stat_t); ok { + st := Stat_t{} + st.Dev = uint64(d.Dev) + st.Ino = uint64(d.Ino) + st.Mode = info.Mode() + st.Nlink = uint64(d.Nlink) + st.Size = d.Size + atime := d.Atim + st.Atim = atime.Sec*1e9 + atime.Nsec + mtime := d.Mtim + st.Mtim = mtime.Sec*1e9 + mtime.Nsec + ctime := d.Ctim + st.Ctim = ctime.Sec*1e9 + ctime.Nsec + return st + } + return defaultStatFromFileInfo(info) +} diff --git a/vendor/github.com/tetratelabs/wazero/sys/stat_unsupported.go b/vendor/github.com/tetratelabs/wazero/sys/stat_unsupported.go new file mode 100644 index 000000000..583c2adb0 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/sys/stat_unsupported.go @@ -0,0 +1,17 @@ +//go:build (!((amd64 || arm64 || riscv64) && linux) && !((amd64 || arm64) && (darwin || freebsd)) && !((amd64 || arm64) && windows)) || js + +package sys + +import "io/fs" + +// sysParseable is only used here as we define "supported" as being able to +// parse `info.Sys()`. The above `go:build` constraints exclude 32-bit until +// that's requested. +// +// TODO: When Go 1.21 is out, use the "unix" build constraint (as 1.21 makes +// our floor Go version 1.19. +const sysParseable = false + +func statFromFileInfo(info fs.FileInfo) Stat_t { + return defaultStatFromFileInfo(info) +} diff --git a/vendor/github.com/tetratelabs/wazero/sys/stat_windows.go b/vendor/github.com/tetratelabs/wazero/sys/stat_windows.go new file mode 100644 index 000000000..1a7070f48 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/sys/stat_windows.go @@ -0,0 +1,26 @@ +//go:build (amd64 || arm64) && windows + +package sys + +import ( + "io/fs" + "syscall" +) + +const sysParseable = true + +func statFromFileInfo(info fs.FileInfo) Stat_t { + if d, ok := info.Sys().(*syscall.Win32FileAttributeData); ok { + st := Stat_t{} + st.Ino = 0 // not in Win32FileAttributeData + st.Dev = 0 // not in Win32FileAttributeData + st.Mode = info.Mode() + st.Nlink = 1 // not in Win32FileAttributeData + st.Size = info.Size() + st.Atim = d.LastAccessTime.Nanoseconds() + st.Mtim = d.LastWriteTime.Nanoseconds() + st.Ctim = d.CreationTime.Nanoseconds() + return st + } + return defaultStatFromFileInfo(info) +} diff --git a/vendor/github.com/tetratelabs/wazero/testdata/index.html b/vendor/github.com/tetratelabs/wazero/testdata/index.html new file mode 100644 index 000000000..69e9da411 --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/testdata/index.html @@ -0,0 +1,2 @@ + + diff --git a/vendor/golang.org/x/time/LICENSE b/vendor/golang.org/x/time/LICENSE new file mode 100644 index 000000000..6a66aea5e --- /dev/null +++ b/vendor/golang.org/x/time/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/time/PATENTS b/vendor/golang.org/x/time/PATENTS new file mode 100644 index 000000000..733099041 --- /dev/null +++ b/vendor/golang.org/x/time/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/time/rate/rate.go b/vendor/golang.org/x/time/rate/rate.go new file mode 100644 index 000000000..8f6c7f493 --- /dev/null +++ b/vendor/golang.org/x/time/rate/rate.go @@ -0,0 +1,430 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package rate provides a rate limiter. +package rate + +import ( + "context" + "fmt" + "math" + "sync" + "time" +) + +// Limit defines the maximum frequency of some events. +// Limit is represented as number of events per second. +// A zero Limit allows no events. +type Limit float64 + +// Inf is the infinite rate limit; it allows all events (even if burst is zero). +const Inf = Limit(math.MaxFloat64) + +// Every converts a minimum time interval between events to a Limit. +func Every(interval time.Duration) Limit { + if interval <= 0 { + return Inf + } + return 1 / Limit(interval.Seconds()) +} + +// A Limiter controls how frequently events are allowed to happen. +// It implements a "token bucket" of size b, initially full and refilled +// at rate r tokens per second. +// Informally, in any large enough time interval, the Limiter limits the +// rate to r tokens per second, with a maximum burst size of b events. +// As a special case, if r == Inf (the infinite rate), b is ignored. +// See https://en.wikipedia.org/wiki/Token_bucket for more about token buckets. +// +// The zero value is a valid Limiter, but it will reject all events. +// Use NewLimiter to create non-zero Limiters. +// +// Limiter has three main methods, Allow, Reserve, and Wait. +// Most callers should use Wait. +// +// Each of the three methods consumes a single token. +// They differ in their behavior when no token is available. +// If no token is available, Allow returns false. +// If no token is available, Reserve returns a reservation for a future token +// and the amount of time the caller must wait before using it. +// If no token is available, Wait blocks until one can be obtained +// or its associated context.Context is canceled. +// +// The methods AllowN, ReserveN, and WaitN consume n tokens. +// +// Limiter is safe for simultaneous use by multiple goroutines. +type Limiter struct { + mu sync.Mutex + limit Limit + burst int + tokens float64 + // last is the last time the limiter's tokens field was updated + last time.Time + // lastEvent is the latest time of a rate-limited event (past or future) + lastEvent time.Time +} + +// Limit returns the maximum overall event rate. +func (lim *Limiter) Limit() Limit { + lim.mu.Lock() + defer lim.mu.Unlock() + return lim.limit +} + +// Burst returns the maximum burst size. Burst is the maximum number of tokens +// that can be consumed in a single call to Allow, Reserve, or Wait, so higher +// Burst values allow more events to happen at once. +// A zero Burst allows no events, unless limit == Inf. +func (lim *Limiter) Burst() int { + lim.mu.Lock() + defer lim.mu.Unlock() + return lim.burst +} + +// TokensAt returns the number of tokens available at time t. +func (lim *Limiter) TokensAt(t time.Time) float64 { + lim.mu.Lock() + _, tokens := lim.advance(t) // does not mutate lim + lim.mu.Unlock() + return tokens +} + +// Tokens returns the number of tokens available now. +func (lim *Limiter) Tokens() float64 { + return lim.TokensAt(time.Now()) +} + +// NewLimiter returns a new Limiter that allows events up to rate r and permits +// bursts of at most b tokens. +func NewLimiter(r Limit, b int) *Limiter { + return &Limiter{ + limit: r, + burst: b, + } +} + +// Allow reports whether an event may happen now. +func (lim *Limiter) Allow() bool { + return lim.AllowN(time.Now(), 1) +} + +// AllowN reports whether n events may happen at time t. +// Use this method if you intend to drop / skip events that exceed the rate limit. +// Otherwise use Reserve or Wait. +func (lim *Limiter) AllowN(t time.Time, n int) bool { + return lim.reserveN(t, n, 0).ok +} + +// A Reservation holds information about events that are permitted by a Limiter to happen after a delay. +// A Reservation may be canceled, which may enable the Limiter to permit additional events. +type Reservation struct { + ok bool + lim *Limiter + tokens int + timeToAct time.Time + // This is the Limit at reservation time, it can change later. + limit Limit +} + +// OK returns whether the limiter can provide the requested number of tokens +// within the maximum wait time. If OK is false, Delay returns InfDuration, and +// Cancel does nothing. +func (r *Reservation) OK() bool { + return r.ok +} + +// Delay is shorthand for DelayFrom(time.Now()). +func (r *Reservation) Delay() time.Duration { + return r.DelayFrom(time.Now()) +} + +// InfDuration is the duration returned by Delay when a Reservation is not OK. +const InfDuration = time.Duration(math.MaxInt64) + +// DelayFrom returns the duration for which the reservation holder must wait +// before taking the reserved action. Zero duration means act immediately. +// InfDuration means the limiter cannot grant the tokens requested in this +// Reservation within the maximum wait time. +func (r *Reservation) DelayFrom(t time.Time) time.Duration { + if !r.ok { + return InfDuration + } + delay := r.timeToAct.Sub(t) + if delay < 0 { + return 0 + } + return delay +} + +// Cancel is shorthand for CancelAt(time.Now()). +func (r *Reservation) Cancel() { + r.CancelAt(time.Now()) +} + +// CancelAt indicates that the reservation holder will not perform the reserved action +// and reverses the effects of this Reservation on the rate limit as much as possible, +// considering that other reservations may have already been made. +func (r *Reservation) CancelAt(t time.Time) { + if !r.ok { + return + } + + r.lim.mu.Lock() + defer r.lim.mu.Unlock() + + if r.lim.limit == Inf || r.tokens == 0 || r.timeToAct.Before(t) { + return + } + + // calculate tokens to restore + // The duration between lim.lastEvent and r.timeToAct tells us how many tokens were reserved + // after r was obtained. These tokens should not be restored. + restoreTokens := float64(r.tokens) - r.limit.tokensFromDuration(r.lim.lastEvent.Sub(r.timeToAct)) + if restoreTokens <= 0 { + return + } + // advance time to now + t, tokens := r.lim.advance(t) + // calculate new number of tokens + tokens += restoreTokens + if burst := float64(r.lim.burst); tokens > burst { + tokens = burst + } + // update state + r.lim.last = t + r.lim.tokens = tokens + if r.timeToAct == r.lim.lastEvent { + prevEvent := r.timeToAct.Add(r.limit.durationFromTokens(float64(-r.tokens))) + if !prevEvent.Before(t) { + r.lim.lastEvent = prevEvent + } + } +} + +// Reserve is shorthand for ReserveN(time.Now(), 1). +func (lim *Limiter) Reserve() *Reservation { + return lim.ReserveN(time.Now(), 1) +} + +// ReserveN returns a Reservation that indicates how long the caller must wait before n events happen. +// The Limiter takes this Reservation into account when allowing future events. +// The returned Reservationā€™s OK() method returns false if n exceeds the Limiter's burst size. +// Usage example: +// +// r := lim.ReserveN(time.Now(), 1) +// if !r.OK() { +// // Not allowed to act! Did you remember to set lim.burst to be > 0 ? +// return +// } +// time.Sleep(r.Delay()) +// Act() +// +// Use this method if you wish to wait and slow down in accordance with the rate limit without dropping events. +// If you need to respect a deadline or cancel the delay, use Wait instead. +// To drop or skip events exceeding rate limit, use Allow instead. +func (lim *Limiter) ReserveN(t time.Time, n int) *Reservation { + r := lim.reserveN(t, n, InfDuration) + return &r +} + +// Wait is shorthand for WaitN(ctx, 1). +func (lim *Limiter) Wait(ctx context.Context) (err error) { + return lim.WaitN(ctx, 1) +} + +// WaitN blocks until lim permits n events to happen. +// It returns an error if n exceeds the Limiter's burst size, the Context is +// canceled, or the expected wait time exceeds the Context's Deadline. +// The burst limit is ignored if the rate limit is Inf. +func (lim *Limiter) WaitN(ctx context.Context, n int) (err error) { + // The test code calls lim.wait with a fake timer generator. + // This is the real timer generator. + newTimer := func(d time.Duration) (<-chan time.Time, func() bool, func()) { + timer := time.NewTimer(d) + return timer.C, timer.Stop, func() {} + } + + return lim.wait(ctx, n, time.Now(), newTimer) +} + +// wait is the internal implementation of WaitN. +func (lim *Limiter) wait(ctx context.Context, n int, t time.Time, newTimer func(d time.Duration) (<-chan time.Time, func() bool, func())) error { + lim.mu.Lock() + burst := lim.burst + limit := lim.limit + lim.mu.Unlock() + + if n > burst && limit != Inf { + return fmt.Errorf("rate: Wait(n=%d) exceeds limiter's burst %d", n, burst) + } + // Check if ctx is already cancelled + select { + case <-ctx.Done(): + return ctx.Err() + default: + } + // Determine wait limit + waitLimit := InfDuration + if deadline, ok := ctx.Deadline(); ok { + waitLimit = deadline.Sub(t) + } + // Reserve + r := lim.reserveN(t, n, waitLimit) + if !r.ok { + return fmt.Errorf("rate: Wait(n=%d) would exceed context deadline", n) + } + // Wait if necessary + delay := r.DelayFrom(t) + if delay == 0 { + return nil + } + ch, stop, advance := newTimer(delay) + defer stop() + advance() // only has an effect when testing + select { + case <-ch: + // We can proceed. + return nil + case <-ctx.Done(): + // Context was canceled before we could proceed. Cancel the + // reservation, which may permit other events to proceed sooner. + r.Cancel() + return ctx.Err() + } +} + +// SetLimit is shorthand for SetLimitAt(time.Now(), newLimit). +func (lim *Limiter) SetLimit(newLimit Limit) { + lim.SetLimitAt(time.Now(), newLimit) +} + +// SetLimitAt sets a new Limit for the limiter. The new Limit, and Burst, may be violated +// or underutilized by those which reserved (using Reserve or Wait) but did not yet act +// before SetLimitAt was called. +func (lim *Limiter) SetLimitAt(t time.Time, newLimit Limit) { + lim.mu.Lock() + defer lim.mu.Unlock() + + t, tokens := lim.advance(t) + + lim.last = t + lim.tokens = tokens + lim.limit = newLimit +} + +// SetBurst is shorthand for SetBurstAt(time.Now(), newBurst). +func (lim *Limiter) SetBurst(newBurst int) { + lim.SetBurstAt(time.Now(), newBurst) +} + +// SetBurstAt sets a new burst size for the limiter. +func (lim *Limiter) SetBurstAt(t time.Time, newBurst int) { + lim.mu.Lock() + defer lim.mu.Unlock() + + t, tokens := lim.advance(t) + + lim.last = t + lim.tokens = tokens + lim.burst = newBurst +} + +// reserveN is a helper method for AllowN, ReserveN, and WaitN. +// maxFutureReserve specifies the maximum reservation wait duration allowed. +// reserveN returns Reservation, not *Reservation, to avoid allocation in AllowN and WaitN. +func (lim *Limiter) reserveN(t time.Time, n int, maxFutureReserve time.Duration) Reservation { + lim.mu.Lock() + defer lim.mu.Unlock() + + if lim.limit == Inf { + return Reservation{ + ok: true, + lim: lim, + tokens: n, + timeToAct: t, + } + } else if lim.limit == 0 { + var ok bool + if lim.burst >= n { + ok = true + lim.burst -= n + } + return Reservation{ + ok: ok, + lim: lim, + tokens: lim.burst, + timeToAct: t, + } + } + + t, tokens := lim.advance(t) + + // Calculate the remaining number of tokens resulting from the request. + tokens -= float64(n) + + // Calculate the wait duration + var waitDuration time.Duration + if tokens < 0 { + waitDuration = lim.limit.durationFromTokens(-tokens) + } + + // Decide result + ok := n <= lim.burst && waitDuration <= maxFutureReserve + + // Prepare reservation + r := Reservation{ + ok: ok, + lim: lim, + limit: lim.limit, + } + if ok { + r.tokens = n + r.timeToAct = t.Add(waitDuration) + + // Update state + lim.last = t + lim.tokens = tokens + lim.lastEvent = r.timeToAct + } + + return r +} + +// advance calculates and returns an updated state for lim resulting from the passage of time. +// lim is not changed. +// advance requires that lim.mu is held. +func (lim *Limiter) advance(t time.Time) (newT time.Time, newTokens float64) { + last := lim.last + if t.Before(last) { + last = t + } + + // Calculate the new number of tokens, due to time that passed. + elapsed := t.Sub(last) + delta := lim.limit.tokensFromDuration(elapsed) + tokens := lim.tokens + delta + if burst := float64(lim.burst); tokens > burst { + tokens = burst + } + return t, tokens +} + +// durationFromTokens is a unit conversion function from the number of tokens to the duration +// of time it takes to accumulate them at a rate of limit tokens per second. +func (limit Limit) durationFromTokens(tokens float64) time.Duration { + if limit <= 0 { + return InfDuration + } + seconds := tokens / float64(limit) + return time.Duration(float64(time.Second) * seconds) +} + +// tokensFromDuration is a unit conversion function from a time duration to the number of tokens +// which could be accumulated during that duration at a rate of limit tokens per second. +func (limit Limit) tokensFromDuration(d time.Duration) float64 { + if limit <= 0 { + return 0 + } + return d.Seconds() * float64(limit) +} diff --git a/vendor/golang.org/x/time/rate/sometimes.go b/vendor/golang.org/x/time/rate/sometimes.go new file mode 100644 index 000000000..6ba99ddb6 --- /dev/null +++ b/vendor/golang.org/x/time/rate/sometimes.go @@ -0,0 +1,67 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package rate + +import ( + "sync" + "time" +) + +// Sometimes will perform an action occasionally. The First, Every, and +// Interval fields govern the behavior of Do, which performs the action. +// A zero Sometimes value will perform an action exactly once. +// +// # Example: logging with rate limiting +// +// var sometimes = rate.Sometimes{First: 3, Interval: 10*time.Second} +// func Spammy() { +// sometimes.Do(func() { log.Info("here I am!") }) +// } +type Sometimes struct { + First int // if non-zero, the first N calls to Do will run f. + Every int // if non-zero, every Nth call to Do will run f. + Interval time.Duration // if non-zero and Interval has elapsed since f's last run, Do will run f. + + mu sync.Mutex + count int // number of Do calls + last time.Time // last time f was run +} + +// Do runs the function f as allowed by First, Every, and Interval. +// +// The model is a union (not intersection) of filters. The first call to Do +// always runs f. Subsequent calls to Do run f if allowed by First or Every or +// Interval. +// +// A non-zero First:N causes the first N Do(f) calls to run f. +// +// A non-zero Every:M causes every Mth Do(f) call, starting with the first, to +// run f. +// +// A non-zero Interval causes Do(f) to run f if Interval has elapsed since +// Do last ran f. +// +// Specifying multiple filters produces the union of these execution streams. +// For example, specifying both First:N and Every:M causes the first N Do(f) +// calls and every Mth Do(f) call, starting with the first, to run f. See +// Examples for more. +// +// If Do is called multiple times simultaneously, the calls will block and run +// serially. Therefore, Do is intended for lightweight operations. +// +// Because a call to Do may block until f returns, if f causes Do to be called, +// it will deadlock. +func (s *Sometimes) Do(f func()) { + s.mu.Lock() + defer s.mu.Unlock() + if s.count == 0 || + (s.First > 0 && s.count < s.First) || + (s.Every > 0 && s.count%s.Every == 0) || + (s.Interval > 0 && time.Since(s.last) >= s.Interval) { + f() + s.last = time.Now() + } + s.count++ +} diff --git a/vendor/golang.org/x/tools/go/types/objectpath/objectpath.go b/vendor/golang.org/x/tools/go/types/objectpath/objectpath.go new file mode 100644 index 000000000..11d5c8c3a --- /dev/null +++ b/vendor/golang.org/x/tools/go/types/objectpath/objectpath.go @@ -0,0 +1,752 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package objectpath defines a naming scheme for types.Objects +// (that is, named entities in Go programs) relative to their enclosing +// package. +// +// Type-checker objects are canonical, so they are usually identified by +// their address in memory (a pointer), but a pointer has meaning only +// within one address space. By contrast, objectpath names allow the +// identity of an object to be sent from one program to another, +// establishing a correspondence between types.Object variables that are +// distinct but logically equivalent. +// +// A single object may have multiple paths. In this example, +// +// type A struct{ X int } +// type B A +// +// the field X has two paths due to its membership of both A and B. +// The For(obj) function always returns one of these paths, arbitrarily +// but consistently. +package objectpath + +import ( + "fmt" + "go/types" + "strconv" + "strings" + + "golang.org/x/tools/internal/typeparams" +) + +// A Path is an opaque name that identifies a types.Object +// relative to its package. Conceptually, the name consists of a +// sequence of destructuring operations applied to the package scope +// to obtain the original object. +// The name does not include the package itself. +type Path string + +// Encoding +// +// An object path is a textual and (with training) human-readable encoding +// of a sequence of destructuring operators, starting from a types.Package. +// The sequences represent a path through the package/object/type graph. +// We classify these operators by their type: +// +// PO package->object Package.Scope.Lookup +// OT object->type Object.Type +// TT type->type Type.{Elem,Key,Params,Results,Underlying} [EKPRU] +// TO type->object Type.{At,Field,Method,Obj} [AFMO] +// +// All valid paths start with a package and end at an object +// and thus may be defined by the regular language: +// +// objectpath = PO (OT TT* TO)* +// +// The concrete encoding follows directly: +// - The only PO operator is Package.Scope.Lookup, which requires an identifier. +// - The only OT operator is Object.Type, +// which we encode as '.' because dot cannot appear in an identifier. +// - The TT operators are encoded as [EKPRUTC]; +// one of these (TypeParam) requires an integer operand, +// which is encoded as a string of decimal digits. +// - The TO operators are encoded as [AFMO]; +// three of these (At,Field,Method) require an integer operand, +// which is encoded as a string of decimal digits. +// These indices are stable across different representations +// of the same package, even source and export data. +// The indices used are implementation specific and may not correspond to +// the argument to the go/types function. +// +// In the example below, +// +// package p +// +// type T interface { +// f() (a string, b struct{ X int }) +// } +// +// field X has the path "T.UM0.RA1.F0", +// representing the following sequence of operations: +// +// p.Lookup("T") T +// .Type().Underlying().Method(0). f +// .Type().Results().At(1) b +// .Type().Field(0) X +// +// The encoding is not maximally compact---every R or P is +// followed by an A, for example---but this simplifies the +// encoder and decoder. +const ( + // object->type operators + opType = '.' // .Type() (Object) + + // type->type operators + opElem = 'E' // .Elem() (Pointer, Slice, Array, Chan, Map) + opKey = 'K' // .Key() (Map) + opParams = 'P' // .Params() (Signature) + opResults = 'R' // .Results() (Signature) + opUnderlying = 'U' // .Underlying() (Named) + opTypeParam = 'T' // .TypeParams.At(i) (Named, Signature) + opConstraint = 'C' // .Constraint() (TypeParam) + + // type->object operators + opAt = 'A' // .At(i) (Tuple) + opField = 'F' // .Field(i) (Struct) + opMethod = 'M' // .Method(i) (Named or Interface; not Struct: "promoted" names are ignored) + opObj = 'O' // .Obj() (Named, TypeParam) +) + +// For is equivalent to new(Encoder).For(obj). +// +// It may be more efficient to reuse a single Encoder across several calls. +func For(obj types.Object) (Path, error) { + return new(Encoder).For(obj) +} + +// An Encoder amortizes the cost of encoding the paths of multiple objects. +// The zero value of an Encoder is ready to use. +type Encoder struct { + scopeMemo map[*types.Scope][]types.Object // memoization of scopeObjects +} + +// For returns the path to an object relative to its package, +// or an error if the object is not accessible from the package's Scope. +// +// The For function guarantees to return a path only for the following objects: +// - package-level types +// - exported package-level non-types +// - methods +// - parameter and result variables +// - struct fields +// These objects are sufficient to define the API of their package. +// The objects described by a package's export data are drawn from this set. +// +// The set of objects accessible from a package's Scope depends on +// whether the package was produced by type-checking syntax, or +// reading export data; the latter may have a smaller Scope since +// export data trims objects that are not reachable from an exported +// declaration. For example, the For function will return a path for +// an exported method of an unexported type that is not reachable +// from any public declaration; this path will cause the Object +// function to fail if called on a package loaded from export data. +// TODO(adonovan): is this a bug or feature? Should this package +// compute accessibility in the same way? +// +// For does not return a path for predeclared names, imported package +// names, local names, and unexported package-level names (except +// types). +// +// Example: given this definition, +// +// package p +// +// type T interface { +// f() (a string, b struct{ X int }) +// } +// +// For(X) would return a path that denotes the following sequence of operations: +// +// p.Scope().Lookup("T") (TypeName T) +// .Type().Underlying().Method(0). (method Func f) +// .Type().Results().At(1) (field Var b) +// .Type().Field(0) (field Var X) +// +// where p is the package (*types.Package) to which X belongs. +func (enc *Encoder) For(obj types.Object) (Path, error) { + pkg := obj.Pkg() + + // This table lists the cases of interest. + // + // Object Action + // ------ ------ + // nil reject + // builtin reject + // pkgname reject + // label reject + // var + // package-level accept + // func param/result accept + // local reject + // struct field accept + // const + // package-level accept + // local reject + // func + // package-level accept + // init functions reject + // concrete method accept + // interface method accept + // type + // package-level accept + // local reject + // + // The only accessible package-level objects are members of pkg itself. + // + // The cases are handled in four steps: + // + // 1. reject nil and builtin + // 2. accept package-level objects + // 3. reject obviously invalid objects + // 4. search the API for the path to the param/result/field/method. + + // 1. reference to nil or builtin? + if pkg == nil { + return "", fmt.Errorf("predeclared %s has no path", obj) + } + scope := pkg.Scope() + + // 2. package-level object? + if scope.Lookup(obj.Name()) == obj { + // Only exported objects (and non-exported types) have a path. + // Non-exported types may be referenced by other objects. + if _, ok := obj.(*types.TypeName); !ok && !obj.Exported() { + return "", fmt.Errorf("no path for non-exported %v", obj) + } + return Path(obj.Name()), nil + } + + // 3. Not a package-level object. + // Reject obviously non-viable cases. + switch obj := obj.(type) { + case *types.TypeName: + if _, ok := obj.Type().(*types.TypeParam); !ok { + // With the exception of type parameters, only package-level type names + // have a path. + return "", fmt.Errorf("no path for %v", obj) + } + case *types.Const, // Only package-level constants have a path. + *types.Label, // Labels are function-local. + *types.PkgName: // PkgNames are file-local. + return "", fmt.Errorf("no path for %v", obj) + + case *types.Var: + // Could be: + // - a field (obj.IsField()) + // - a func parameter or result + // - a local var. + // Sadly there is no way to distinguish + // a param/result from a local + // so we must proceed to the find. + + case *types.Func: + // A func, if not package-level, must be a method. + if recv := obj.Type().(*types.Signature).Recv(); recv == nil { + return "", fmt.Errorf("func is not a method: %v", obj) + } + + if path, ok := enc.concreteMethod(obj); ok { + // Fast path for concrete methods that avoids looping over scope. + return path, nil + } + + default: + panic(obj) + } + + // 4. Search the API for the path to the var (field/param/result) or method. + + // First inspect package-level named types. + // In the presence of path aliases, these give + // the best paths because non-types may + // refer to types, but not the reverse. + empty := make([]byte, 0, 48) // initial space + objs := enc.scopeObjects(scope) + for _, o := range objs { + tname, ok := o.(*types.TypeName) + if !ok { + continue // handle non-types in second pass + } + + path := append(empty, o.Name()...) + path = append(path, opType) + + T := o.Type() + + if tname.IsAlias() { + // type alias + if r := find(obj, T, path, nil); r != nil { + return Path(r), nil + } + } else { + if named, _ := T.(*types.Named); named != nil { + if r := findTypeParam(obj, named.TypeParams(), path, nil); r != nil { + // generic named type + return Path(r), nil + } + } + // defined (named) type + if r := find(obj, T.Underlying(), append(path, opUnderlying), nil); r != nil { + return Path(r), nil + } + } + } + + // Then inspect everything else: + // non-types, and declared methods of defined types. + for _, o := range objs { + path := append(empty, o.Name()...) + if _, ok := o.(*types.TypeName); !ok { + if o.Exported() { + // exported non-type (const, var, func) + if r := find(obj, o.Type(), append(path, opType), nil); r != nil { + return Path(r), nil + } + } + continue + } + + // Inspect declared methods of defined types. + if T, ok := o.Type().(*types.Named); ok { + path = append(path, opType) + // The method index here is always with respect + // to the underlying go/types data structures, + // which ultimately derives from source order + // and must be preserved by export data. + for i := 0; i < T.NumMethods(); i++ { + m := T.Method(i) + path2 := appendOpArg(path, opMethod, i) + if m == obj { + return Path(path2), nil // found declared method + } + if r := find(obj, m.Type(), append(path2, opType), nil); r != nil { + return Path(r), nil + } + } + } + } + + return "", fmt.Errorf("can't find path for %v in %s", obj, pkg.Path()) +} + +func appendOpArg(path []byte, op byte, arg int) []byte { + path = append(path, op) + path = strconv.AppendInt(path, int64(arg), 10) + return path +} + +// concreteMethod returns the path for meth, which must have a non-nil receiver. +// The second return value indicates success and may be false if the method is +// an interface method or if it is an instantiated method. +// +// This function is just an optimization that avoids the general scope walking +// approach. You are expected to fall back to the general approach if this +// function fails. +func (enc *Encoder) concreteMethod(meth *types.Func) (Path, bool) { + // Concrete methods can only be declared on package-scoped named types. For + // that reason we can skip the expensive walk over the package scope: the + // path will always be package -> named type -> method. We can trivially get + // the type name from the receiver, and only have to look over the type's + // methods to find the method index. + // + // Methods on generic types require special consideration, however. Consider + // the following package: + // + // L1: type S[T any] struct{} + // L2: func (recv S[A]) Foo() { recv.Bar() } + // L3: func (recv S[B]) Bar() { } + // L4: type Alias = S[int] + // L5: func _[T any]() { var s S[int]; s.Foo() } + // + // The receivers of methods on generic types are instantiations. L2 and L3 + // instantiate S with the type-parameters A and B, which are scoped to the + // respective methods. L4 and L5 each instantiate S with int. Each of these + // instantiations has its own method set, full of methods (and thus objects) + // with receivers whose types are the respective instantiations. In other + // words, we have + // + // S[A].Foo, S[A].Bar + // S[B].Foo, S[B].Bar + // S[int].Foo, S[int].Bar + // + // We may thus be trying to produce object paths for any of these objects. + // + // S[A].Foo and S[B].Bar are the origin methods, and their paths are S.Foo + // and S.Bar, which are the paths that this function naturally produces. + // + // S[A].Bar, S[B].Foo, and both methods on S[int] are instantiations that + // don't correspond to the origin methods. For S[int], this is significant. + // The most precise object path for S[int].Foo, for example, is Alias.Foo, + // not S.Foo. Our function, however, would produce S.Foo, which would + // resolve to a different object. + // + // For S[A].Bar and S[B].Foo it could be argued that S.Bar and S.Foo are + // still the correct paths, since only the origin methods have meaningful + // paths. But this is likely only true for trivial cases and has edge cases. + // Since this function is only an optimization, we err on the side of giving + // up, deferring to the slower but definitely correct algorithm. Most users + // of objectpath will only be giving us origin methods, anyway, as referring + // to instantiated methods is usually not useful. + + if typeparams.OriginMethod(meth) != meth { + return "", false + } + + recvT := meth.Type().(*types.Signature).Recv().Type() + if ptr, ok := recvT.(*types.Pointer); ok { + recvT = ptr.Elem() + } + + named, ok := recvT.(*types.Named) + if !ok { + return "", false + } + + if types.IsInterface(named) { + // Named interfaces don't have to be package-scoped + // + // TODO(dominikh): opt: if scope.Lookup(name) == named, then we can apply this optimization to interface + // methods, too, I think. + return "", false + } + + // Preallocate space for the name, opType, opMethod, and some digits. + name := named.Obj().Name() + path := make([]byte, 0, len(name)+8) + path = append(path, name...) + path = append(path, opType) + + // Method indices are w.r.t. the go/types data structures, + // ultimately deriving from source order, + // which is preserved by export data. + for i := 0; i < named.NumMethods(); i++ { + if named.Method(i) == meth { + path = appendOpArg(path, opMethod, i) + return Path(path), true + } + } + + // Due to golang/go#59944, go/types fails to associate the receiver with + // certain methods on cgo types. + // + // TODO(rfindley): replace this panic once golang/go#59944 is fixed in all Go + // versions gopls supports. + return "", false + // panic(fmt.Sprintf("couldn't find method %s on type %s; methods: %#v", meth, named, enc.namedMethods(named))) +} + +// find finds obj within type T, returning the path to it, or nil if not found. +// +// The seen map is used to short circuit cycles through type parameters. If +// nil, it will be allocated as necessary. +func find(obj types.Object, T types.Type, path []byte, seen map[*types.TypeName]bool) []byte { + switch T := T.(type) { + case *types.Basic, *types.Named: + // Named types belonging to pkg were handled already, + // so T must belong to another package. No path. + return nil + case *types.Pointer: + return find(obj, T.Elem(), append(path, opElem), seen) + case *types.Slice: + return find(obj, T.Elem(), append(path, opElem), seen) + case *types.Array: + return find(obj, T.Elem(), append(path, opElem), seen) + case *types.Chan: + return find(obj, T.Elem(), append(path, opElem), seen) + case *types.Map: + if r := find(obj, T.Key(), append(path, opKey), seen); r != nil { + return r + } + return find(obj, T.Elem(), append(path, opElem), seen) + case *types.Signature: + if r := findTypeParam(obj, T.TypeParams(), path, seen); r != nil { + return r + } + if r := find(obj, T.Params(), append(path, opParams), seen); r != nil { + return r + } + return find(obj, T.Results(), append(path, opResults), seen) + case *types.Struct: + for i := 0; i < T.NumFields(); i++ { + fld := T.Field(i) + path2 := appendOpArg(path, opField, i) + if fld == obj { + return path2 // found field var + } + if r := find(obj, fld.Type(), append(path2, opType), seen); r != nil { + return r + } + } + return nil + case *types.Tuple: + for i := 0; i < T.Len(); i++ { + v := T.At(i) + path2 := appendOpArg(path, opAt, i) + if v == obj { + return path2 // found param/result var + } + if r := find(obj, v.Type(), append(path2, opType), seen); r != nil { + return r + } + } + return nil + case *types.Interface: + for i := 0; i < T.NumMethods(); i++ { + m := T.Method(i) + path2 := appendOpArg(path, opMethod, i) + if m == obj { + return path2 // found interface method + } + if r := find(obj, m.Type(), append(path2, opType), seen); r != nil { + return r + } + } + return nil + case *types.TypeParam: + name := T.Obj() + if name == obj { + return append(path, opObj) + } + if seen[name] { + return nil + } + if seen == nil { + seen = make(map[*types.TypeName]bool) + } + seen[name] = true + if r := find(obj, T.Constraint(), append(path, opConstraint), seen); r != nil { + return r + } + return nil + } + panic(T) +} + +func findTypeParam(obj types.Object, list *types.TypeParamList, path []byte, seen map[*types.TypeName]bool) []byte { + for i := 0; i < list.Len(); i++ { + tparam := list.At(i) + path2 := appendOpArg(path, opTypeParam, i) + if r := find(obj, tparam, path2, seen); r != nil { + return r + } + } + return nil +} + +// Object returns the object denoted by path p within the package pkg. +func Object(pkg *types.Package, p Path) (types.Object, error) { + pathstr := string(p) + if pathstr == "" { + return nil, fmt.Errorf("empty path") + } + + var pkgobj, suffix string + if dot := strings.IndexByte(pathstr, opType); dot < 0 { + pkgobj = pathstr + } else { + pkgobj = pathstr[:dot] + suffix = pathstr[dot:] // suffix starts with "." + } + + obj := pkg.Scope().Lookup(pkgobj) + if obj == nil { + return nil, fmt.Errorf("package %s does not contain %q", pkg.Path(), pkgobj) + } + + // abstraction of *types.{Pointer,Slice,Array,Chan,Map} + type hasElem interface { + Elem() types.Type + } + // abstraction of *types.{Named,Signature} + type hasTypeParams interface { + TypeParams() *types.TypeParamList + } + // abstraction of *types.{Named,TypeParam} + type hasObj interface { + Obj() *types.TypeName + } + + // The loop state is the pair (t, obj), + // exactly one of which is non-nil, initially obj. + // All suffixes start with '.' (the only object->type operation), + // followed by optional type->type operations, + // then a type->object operation. + // The cycle then repeats. + var t types.Type + for suffix != "" { + code := suffix[0] + suffix = suffix[1:] + + // Codes [AFM] have an integer operand. + var index int + switch code { + case opAt, opField, opMethod, opTypeParam: + rest := strings.TrimLeft(suffix, "0123456789") + numerals := suffix[:len(suffix)-len(rest)] + suffix = rest + i, err := strconv.Atoi(numerals) + if err != nil { + return nil, fmt.Errorf("invalid path: bad numeric operand %q for code %q", numerals, code) + } + index = int(i) + case opObj: + // no operand + default: + // The suffix must end with a type->object operation. + if suffix == "" { + return nil, fmt.Errorf("invalid path: ends with %q, want [AFMO]", code) + } + } + + if code == opType { + if t != nil { + return nil, fmt.Errorf("invalid path: unexpected %q in type context", opType) + } + t = obj.Type() + obj = nil + continue + } + + if t == nil { + return nil, fmt.Errorf("invalid path: code %q in object context", code) + } + + // Inv: t != nil, obj == nil + + switch code { + case opElem: + hasElem, ok := t.(hasElem) // Pointer, Slice, Array, Chan, Map + if !ok { + return nil, fmt.Errorf("cannot apply %q to %s (got %T, want pointer, slice, array, chan or map)", code, t, t) + } + t = hasElem.Elem() + + case opKey: + mapType, ok := t.(*types.Map) + if !ok { + return nil, fmt.Errorf("cannot apply %q to %s (got %T, want map)", code, t, t) + } + t = mapType.Key() + + case opParams: + sig, ok := t.(*types.Signature) + if !ok { + return nil, fmt.Errorf("cannot apply %q to %s (got %T, want signature)", code, t, t) + } + t = sig.Params() + + case opResults: + sig, ok := t.(*types.Signature) + if !ok { + return nil, fmt.Errorf("cannot apply %q to %s (got %T, want signature)", code, t, t) + } + t = sig.Results() + + case opUnderlying: + named, ok := t.(*types.Named) + if !ok { + return nil, fmt.Errorf("cannot apply %q to %s (got %T, want named)", code, t, t) + } + t = named.Underlying() + + case opTypeParam: + hasTypeParams, ok := t.(hasTypeParams) // Named, Signature + if !ok { + return nil, fmt.Errorf("cannot apply %q to %s (got %T, want named or signature)", code, t, t) + } + tparams := hasTypeParams.TypeParams() + if n := tparams.Len(); index >= n { + return nil, fmt.Errorf("tuple index %d out of range [0-%d)", index, n) + } + t = tparams.At(index) + + case opConstraint: + tparam, ok := t.(*types.TypeParam) + if !ok { + return nil, fmt.Errorf("cannot apply %q to %s (got %T, want type parameter)", code, t, t) + } + t = tparam.Constraint() + + case opAt: + tuple, ok := t.(*types.Tuple) + if !ok { + return nil, fmt.Errorf("cannot apply %q to %s (got %T, want tuple)", code, t, t) + } + if n := tuple.Len(); index >= n { + return nil, fmt.Errorf("tuple index %d out of range [0-%d)", index, n) + } + obj = tuple.At(index) + t = nil + + case opField: + structType, ok := t.(*types.Struct) + if !ok { + return nil, fmt.Errorf("cannot apply %q to %s (got %T, want struct)", code, t, t) + } + if n := structType.NumFields(); index >= n { + return nil, fmt.Errorf("field index %d out of range [0-%d)", index, n) + } + obj = structType.Field(index) + t = nil + + case opMethod: + switch t := t.(type) { + case *types.Interface: + if index >= t.NumMethods() { + return nil, fmt.Errorf("method index %d out of range [0-%d)", index, t.NumMethods()) + } + obj = t.Method(index) // Id-ordered + + case *types.Named: + if index >= t.NumMethods() { + return nil, fmt.Errorf("method index %d out of range [0-%d)", index, t.NumMethods()) + } + obj = t.Method(index) + + default: + return nil, fmt.Errorf("cannot apply %q to %s (got %T, want interface or named)", code, t, t) + } + t = nil + + case opObj: + hasObj, ok := t.(hasObj) + if !ok { + return nil, fmt.Errorf("cannot apply %q to %s (got %T, want named or type param)", code, t, t) + } + obj = hasObj.Obj() + t = nil + + default: + return nil, fmt.Errorf("invalid path: unknown code %q", code) + } + } + + if obj.Pkg() != pkg { + return nil, fmt.Errorf("path denotes %s, which belongs to a different package", obj) + } + + return obj, nil // success +} + +// scopeObjects is a memoization of scope objects. +// Callers must not modify the result. +func (enc *Encoder) scopeObjects(scope *types.Scope) []types.Object { + m := enc.scopeMemo + if m == nil { + m = make(map[*types.Scope][]types.Object) + enc.scopeMemo = m + } + objs, ok := m[scope] + if !ok { + names := scope.Names() // allocates and sorts + objs = make([]types.Object, len(names)) + for i, name := range names { + objs[i] = scope.Lookup(name) + } + m[scope] = objs + } + return objs +} diff --git a/vendor/golang.org/x/tools/internal/event/keys/util.go b/vendor/golang.org/x/tools/internal/event/keys/util.go new file mode 100644 index 000000000..c0e8e731c --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/keys/util.go @@ -0,0 +1,21 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package keys + +import ( + "sort" + "strings" +) + +// Join returns a canonical join of the keys in S: +// a sorted comma-separated string list. +func Join[S ~[]T, T ~string](s S) string { + strs := make([]string, 0, len(s)) + for _, v := range s { + strs = append(strs, string(v)) + } + sort.Strings(strs) + return strings.Join(strs, ",") +} diff --git a/vendor/golang.org/x/tools/internal/event/tag/tag.go b/vendor/golang.org/x/tools/internal/event/tag/tag.go new file mode 100644 index 000000000..581b26c20 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/tag/tag.go @@ -0,0 +1,59 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package tag provides the labels used for telemetry throughout gopls. +package tag + +import ( + "golang.org/x/tools/internal/event/keys" +) + +var ( + // create the label keys we use + Method = keys.NewString("method", "") + StatusCode = keys.NewString("status.code", "") + StatusMessage = keys.NewString("status.message", "") + RPCID = keys.NewString("id", "") + RPCDirection = keys.NewString("direction", "") + File = keys.NewString("file", "") + Directory = keys.New("directory", "") + URI = keys.New("URI", "") + Package = keys.NewString("package", "") // sorted comma-separated list of Package IDs + PackagePath = keys.NewString("package_path", "") + Query = keys.New("query", "") + Snapshot = keys.NewUInt64("snapshot", "") + Operation = keys.NewString("operation", "") + + Position = keys.New("position", "") + Category = keys.NewString("category", "") + PackageCount = keys.NewInt("packages", "") + Files = keys.New("files", "") + Port = keys.NewInt("port", "") + Type = keys.New("type", "") + HoverKind = keys.NewString("hoverkind", "") + + NewServer = keys.NewString("new_server", "A new server was added") + EndServer = keys.NewString("end_server", "A server was shut down") + + ServerID = keys.NewString("server", "The server ID an event is related to") + Logfile = keys.NewString("logfile", "") + DebugAddress = keys.NewString("debug_address", "") + GoplsPath = keys.NewString("gopls_path", "") + ClientID = keys.NewString("client_id", "") + + Level = keys.NewInt("level", "The logging level") +) + +var ( + // create the stats we measure + Started = keys.NewInt64("started", "Count of started RPCs.") + ReceivedBytes = keys.NewInt64("received_bytes", "Bytes received.") //, unit.Bytes) + SentBytes = keys.NewInt64("sent_bytes", "Bytes sent.") //, unit.Bytes) + Latency = keys.NewFloat64("latency_ms", "Elapsed time in milliseconds") //, unit.Milliseconds) +) + +const ( + Inbound = "in" + Outbound = "out" +) diff --git a/vendor/golang.org/x/tools/internal/versions/gover.go b/vendor/golang.org/x/tools/internal/versions/gover.go new file mode 100644 index 000000000..bbabcd22e --- /dev/null +++ b/vendor/golang.org/x/tools/internal/versions/gover.go @@ -0,0 +1,172 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// This is a fork of internal/gover for use by x/tools until +// go1.21 and earlier are no longer supported by x/tools. + +package versions + +import "strings" + +// A gover is a parsed Go gover: major[.Minor[.Patch]][kind[pre]] +// The numbers are the original decimal strings to avoid integer overflows +// and since there is very little actual math. (Probably overflow doesn't matter in practice, +// but at the time this code was written, there was an existing test that used +// go1.99999999999, which does not fit in an int on 32-bit platforms. +// The "big decimal" representation avoids the problem entirely.) +type gover struct { + major string // decimal + minor string // decimal or "" + patch string // decimal or "" + kind string // "", "alpha", "beta", "rc" + pre string // decimal or "" +} + +// compare returns -1, 0, or +1 depending on whether +// x < y, x == y, or x > y, interpreted as toolchain versions. +// The versions x and y must not begin with a "go" prefix: just "1.21" not "go1.21". +// Malformed versions compare less than well-formed versions and equal to each other. +// The language version "1.21" compares less than the release candidate and eventual releases "1.21rc1" and "1.21.0". +func compare(x, y string) int { + vx := parse(x) + vy := parse(y) + + if c := cmpInt(vx.major, vy.major); c != 0 { + return c + } + if c := cmpInt(vx.minor, vy.minor); c != 0 { + return c + } + if c := cmpInt(vx.patch, vy.patch); c != 0 { + return c + } + if c := strings.Compare(vx.kind, vy.kind); c != 0 { // "" < alpha < beta < rc + return c + } + if c := cmpInt(vx.pre, vy.pre); c != 0 { + return c + } + return 0 +} + +// lang returns the Go language version. For example, lang("1.2.3") == "1.2". +func lang(x string) string { + v := parse(x) + if v.minor == "" || v.major == "1" && v.minor == "0" { + return v.major + } + return v.major + "." + v.minor +} + +// isValid reports whether the version x is valid. +func isValid(x string) bool { + return parse(x) != gover{} +} + +// parse parses the Go version string x into a version. +// It returns the zero version if x is malformed. +func parse(x string) gover { + var v gover + + // Parse major version. + var ok bool + v.major, x, ok = cutInt(x) + if !ok { + return gover{} + } + if x == "" { + // Interpret "1" as "1.0.0". + v.minor = "0" + v.patch = "0" + return v + } + + // Parse . before minor version. + if x[0] != '.' { + return gover{} + } + + // Parse minor version. + v.minor, x, ok = cutInt(x[1:]) + if !ok { + return gover{} + } + if x == "" { + // Patch missing is same as "0" for older versions. + // Starting in Go 1.21, patch missing is different from explicit .0. + if cmpInt(v.minor, "21") < 0 { + v.patch = "0" + } + return v + } + + // Parse patch if present. + if x[0] == '.' { + v.patch, x, ok = cutInt(x[1:]) + if !ok || x != "" { + // Note that we are disallowing prereleases (alpha, beta, rc) for patch releases here (x != ""). + // Allowing them would be a bit confusing because we already have: + // 1.21 < 1.21rc1 + // But a prerelease of a patch would have the opposite effect: + // 1.21.3rc1 < 1.21.3 + // We've never needed them before, so let's not start now. + return gover{} + } + return v + } + + // Parse prerelease. + i := 0 + for i < len(x) && (x[i] < '0' || '9' < x[i]) { + if x[i] < 'a' || 'z' < x[i] { + return gover{} + } + i++ + } + if i == 0 { + return gover{} + } + v.kind, x = x[:i], x[i:] + if x == "" { + return v + } + v.pre, x, ok = cutInt(x) + if !ok || x != "" { + return gover{} + } + + return v +} + +// cutInt scans the leading decimal number at the start of x to an integer +// and returns that value and the rest of the string. +func cutInt(x string) (n, rest string, ok bool) { + i := 0 + for i < len(x) && '0' <= x[i] && x[i] <= '9' { + i++ + } + if i == 0 || x[0] == '0' && i != 1 { // no digits or unnecessary leading zero + return "", "", false + } + return x[:i], x[i:], true +} + +// cmpInt returns cmp.Compare(x, y) interpreting x and y as decimal numbers. +// (Copied from golang.org/x/mod/semver's compareInt.) +func cmpInt(x, y string) int { + if x == y { + return 0 + } + if len(x) < len(y) { + return -1 + } + if len(x) > len(y) { + return +1 + } + if x < y { + return -1 + } else { + return +1 + } +} diff --git a/vendor/golang.org/x/tools/internal/versions/types.go b/vendor/golang.org/x/tools/internal/versions/types.go new file mode 100644 index 000000000..562eef21f --- /dev/null +++ b/vendor/golang.org/x/tools/internal/versions/types.go @@ -0,0 +1,19 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package versions + +import ( + "go/types" +) + +// GoVersion returns the Go version of the type package. +// It returns zero if no version can be determined. +func GoVersion(pkg *types.Package) string { + // TODO(taking): x/tools can call GoVersion() [from 1.21] after 1.25. + if pkg, ok := any(pkg).(interface{ GoVersion() string }); ok { + return pkg.GoVersion() + } + return "" +} diff --git a/vendor/golang.org/x/tools/internal/versions/types_go121.go b/vendor/golang.org/x/tools/internal/versions/types_go121.go new file mode 100644 index 000000000..a7b79207a --- /dev/null +++ b/vendor/golang.org/x/tools/internal/versions/types_go121.go @@ -0,0 +1,20 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !go1.22 +// +build !go1.22 + +package versions + +import ( + "go/ast" + "go/types" +) + +// FileVersions always reports the a file's Go version as the +// zero version at this Go version. +func FileVersions(info *types.Info, file *ast.File) string { return "" } + +// InitFileVersions is a noop at this Go version. +func InitFileVersions(*types.Info) {} diff --git a/vendor/golang.org/x/tools/internal/versions/types_go122.go b/vendor/golang.org/x/tools/internal/versions/types_go122.go new file mode 100644 index 000000000..7b9ba89a8 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/versions/types_go122.go @@ -0,0 +1,24 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.22 +// +build go1.22 + +package versions + +import ( + "go/ast" + "go/types" +) + +// FileVersions maps a file to the file's semantic Go version. +// The reported version is the zero version if a version cannot be determined. +func FileVersions(info *types.Info, file *ast.File) string { + return info.FileVersions[file] +} + +// InitFileVersions initializes info to record Go versions for Go files. +func InitFileVersions(info *types.Info) { + info.FileVersions = make(map[*ast.File]string) +} diff --git a/vendor/golang.org/x/tools/internal/versions/versions.go b/vendor/golang.org/x/tools/internal/versions/versions.go new file mode 100644 index 000000000..e16f6c33a --- /dev/null +++ b/vendor/golang.org/x/tools/internal/versions/versions.go @@ -0,0 +1,52 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package versions + +// Note: If we use build tags to use go/versions when go >=1.22, +// we run into go.dev/issue/53737. Under some operations users would see an +// import of "go/versions" even if they would not compile the file. +// For example, during `go get -u ./...` (go.dev/issue/64490) we do not try to include +// For this reason, this library just a clone of go/versions for the moment. + +// Lang returns the Go language version for version x. +// If x is not a valid version, Lang returns the empty string. +// For example: +// +// Lang("go1.21rc2") = "go1.21" +// Lang("go1.21.2") = "go1.21" +// Lang("go1.21") = "go1.21" +// Lang("go1") = "go1" +// Lang("bad") = "" +// Lang("1.21") = "" +func Lang(x string) string { + v := lang(stripGo(x)) + if v == "" { + return "" + } + return x[:2+len(v)] // "go"+v without allocation +} + +// Compare returns -1, 0, or +1 depending on whether +// x < y, x == y, or x > y, interpreted as Go versions. +// The versions x and y must begin with a "go" prefix: "go1.21" not "1.21". +// Invalid versions, including the empty string, compare less than +// valid versions and equal to each other. +// The language version "go1.21" compares less than the +// release candidate and eventual releases "go1.21rc1" and "go1.21.0". +// Custom toolchain suffixes are ignored during comparison: +// "go1.21.0" and "go1.21.0-bigcorp" are equal. +func Compare(x, y string) int { return compare(stripGo(x), stripGo(y)) } + +// IsValid reports whether the version x is valid. +func IsValid(x string) bool { return isValid(stripGo(x)) } + +// stripGo converts from a "go1.21" version to a "1.21" version. +// If v does not start with "go", stripGo returns the empty string (a known invalid version). +func stripGo(v string) string { + if len(v) < 2 || v[:2] != "go" { + return "" + } + return v[2:] +} diff --git a/vendor/google.golang.org/grpc/balancer_wrapper.go b/vendor/google.golang.org/grpc/balancer_wrapper.go new file mode 100644 index 000000000..b5e30cff0 --- /dev/null +++ b/vendor/google.golang.org/grpc/balancer_wrapper.go @@ -0,0 +1,380 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package grpc + +import ( + "context" + "fmt" + "strings" + "sync" + + "google.golang.org/grpc/balancer" + "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/internal/balancer/gracefulswitch" + "google.golang.org/grpc/internal/channelz" + "google.golang.org/grpc/internal/grpcsync" + "google.golang.org/grpc/resolver" +) + +// ccBalancerWrapper sits between the ClientConn and the Balancer. +// +// ccBalancerWrapper implements methods corresponding to the ones on the +// balancer.Balancer interface. The ClientConn is free to call these methods +// concurrently and the ccBalancerWrapper ensures that calls from the ClientConn +// to the Balancer happen in order by performing them in the serializer, without +// any mutexes held. +// +// ccBalancerWrapper also implements the balancer.ClientConn interface and is +// passed to the Balancer implementations. It invokes unexported methods on the +// ClientConn to handle these calls from the Balancer. +// +// It uses the gracefulswitch.Balancer internally to ensure that balancer +// switches happen in a graceful manner. +type ccBalancerWrapper struct { + // The following fields are initialized when the wrapper is created and are + // read-only afterwards, and therefore can be accessed without a mutex. + cc *ClientConn + opts balancer.BuildOptions + serializer *grpcsync.CallbackSerializer + serializerCancel context.CancelFunc + + // The following fields are only accessed within the serializer or during + // initialization. + curBalancerName string + balancer *gracefulswitch.Balancer + + // The following field is protected by mu. Caller must take cc.mu before + // taking mu. + mu sync.Mutex + closed bool +} + +// newCCBalancerWrapper creates a new balancer wrapper in idle state. The +// underlying balancer is not created until the switchTo() method is invoked. +func newCCBalancerWrapper(cc *ClientConn) *ccBalancerWrapper { + ctx, cancel := context.WithCancel(cc.ctx) + ccb := &ccBalancerWrapper{ + cc: cc, + opts: balancer.BuildOptions{ + DialCreds: cc.dopts.copts.TransportCredentials, + CredsBundle: cc.dopts.copts.CredsBundle, + Dialer: cc.dopts.copts.Dialer, + Authority: cc.authority, + CustomUserAgent: cc.dopts.copts.UserAgent, + ChannelzParentID: cc.channelzID, + Target: cc.parsedTarget, + }, + serializer: grpcsync.NewCallbackSerializer(ctx), + serializerCancel: cancel, + } + ccb.balancer = gracefulswitch.NewBalancer(ccb, ccb.opts) + return ccb +} + +// updateClientConnState is invoked by grpc to push a ClientConnState update to +// the underlying balancer. This is always executed from the serializer, so +// it is safe to call into the balancer here. +func (ccb *ccBalancerWrapper) updateClientConnState(ccs *balancer.ClientConnState) error { + errCh := make(chan error) + ok := ccb.serializer.Schedule(func(ctx context.Context) { + defer close(errCh) + if ctx.Err() != nil || ccb.balancer == nil { + return + } + err := ccb.balancer.UpdateClientConnState(*ccs) + if logger.V(2) && err != nil { + logger.Infof("error from balancer.UpdateClientConnState: %v", err) + } + errCh <- err + }) + if !ok { + return nil + } + return <-errCh +} + +// resolverError is invoked by grpc to push a resolver error to the underlying +// balancer. The call to the balancer is executed from the serializer. +func (ccb *ccBalancerWrapper) resolverError(err error) { + ccb.serializer.Schedule(func(ctx context.Context) { + if ctx.Err() != nil || ccb.balancer == nil { + return + } + ccb.balancer.ResolverError(err) + }) +} + +// switchTo is invoked by grpc to instruct the balancer wrapper to switch to the +// LB policy identified by name. +// +// ClientConn calls newCCBalancerWrapper() at creation time. Upon receipt of the +// first good update from the name resolver, it determines the LB policy to use +// and invokes the switchTo() method. Upon receipt of every subsequent update +// from the name resolver, it invokes this method. +// +// the ccBalancerWrapper keeps track of the current LB policy name, and skips +// the graceful balancer switching process if the name does not change. +func (ccb *ccBalancerWrapper) switchTo(name string) { + ccb.serializer.Schedule(func(ctx context.Context) { + if ctx.Err() != nil || ccb.balancer == nil { + return + } + // TODO: Other languages use case-sensitive balancer registries. We should + // switch as well. See: https://github.com/grpc/grpc-go/issues/5288. + if strings.EqualFold(ccb.curBalancerName, name) { + return + } + ccb.buildLoadBalancingPolicy(name) + }) +} + +// buildLoadBalancingPolicy performs the following: +// - retrieve a balancer builder for the given name. Use the default LB +// policy, pick_first, if no LB policy with name is found in the registry. +// - instruct the gracefulswitch balancer to switch to the above builder. This +// will actually build the new balancer. +// - update the `curBalancerName` field +// +// Must be called from a serializer callback. +func (ccb *ccBalancerWrapper) buildLoadBalancingPolicy(name string) { + builder := balancer.Get(name) + if builder == nil { + channelz.Warningf(logger, ccb.cc.channelzID, "Channel switches to new LB policy %q, since the specified LB policy %q was not registered", PickFirstBalancerName, name) + builder = newPickfirstBuilder() + } else { + channelz.Infof(logger, ccb.cc.channelzID, "Channel switches to new LB policy %q", name) + } + + if err := ccb.balancer.SwitchTo(builder); err != nil { + channelz.Errorf(logger, ccb.cc.channelzID, "Channel failed to build new LB policy %q: %v", name, err) + return + } + ccb.curBalancerName = builder.Name() +} + +// close initiates async shutdown of the wrapper. cc.mu must be held when +// calling this function. To determine the wrapper has finished shutting down, +// the channel should block on ccb.serializer.Done() without cc.mu held. +func (ccb *ccBalancerWrapper) close() { + ccb.mu.Lock() + ccb.closed = true + ccb.mu.Unlock() + channelz.Info(logger, ccb.cc.channelzID, "ccBalancerWrapper: closing") + ccb.serializer.Schedule(func(context.Context) { + if ccb.balancer == nil { + return + } + ccb.balancer.Close() + ccb.balancer = nil + }) + ccb.serializerCancel() +} + +// exitIdle invokes the balancer's exitIdle method in the serializer. +func (ccb *ccBalancerWrapper) exitIdle() { + ccb.serializer.Schedule(func(ctx context.Context) { + if ctx.Err() != nil || ccb.balancer == nil { + return + } + ccb.balancer.ExitIdle() + }) +} + +func (ccb *ccBalancerWrapper) NewSubConn(addrs []resolver.Address, opts balancer.NewSubConnOptions) (balancer.SubConn, error) { + ccb.cc.mu.Lock() + defer ccb.cc.mu.Unlock() + + ccb.mu.Lock() + if ccb.closed { + ccb.mu.Unlock() + return nil, fmt.Errorf("balancer is being closed; no new SubConns allowed") + } + ccb.mu.Unlock() + + if len(addrs) == 0 { + return nil, fmt.Errorf("grpc: cannot create SubConn with empty address list") + } + ac, err := ccb.cc.newAddrConnLocked(addrs, opts) + if err != nil { + channelz.Warningf(logger, ccb.cc.channelzID, "acBalancerWrapper: NewSubConn: failed to newAddrConn: %v", err) + return nil, err + } + acbw := &acBalancerWrapper{ + ccb: ccb, + ac: ac, + producers: make(map[balancer.ProducerBuilder]*refCountedProducer), + stateListener: opts.StateListener, + } + ac.acbw = acbw + return acbw, nil +} + +func (ccb *ccBalancerWrapper) RemoveSubConn(sc balancer.SubConn) { + // The graceful switch balancer will never call this. + logger.Errorf("ccb RemoveSubConn(%v) called unexpectedly, sc") +} + +func (ccb *ccBalancerWrapper) UpdateAddresses(sc balancer.SubConn, addrs []resolver.Address) { + acbw, ok := sc.(*acBalancerWrapper) + if !ok { + return + } + acbw.UpdateAddresses(addrs) +} + +func (ccb *ccBalancerWrapper) UpdateState(s balancer.State) { + ccb.cc.mu.Lock() + defer ccb.cc.mu.Unlock() + + ccb.mu.Lock() + if ccb.closed { + ccb.mu.Unlock() + return + } + ccb.mu.Unlock() + // Update picker before updating state. Even though the ordering here does + // not matter, it can lead to multiple calls of Pick in the common start-up + // case where we wait for ready and then perform an RPC. If the picker is + // updated later, we could call the "connecting" picker when the state is + // updated, and then call the "ready" picker after the picker gets updated. + + // Note that there is no need to check if the balancer wrapper was closed, + // as we know the graceful switch LB policy will not call cc if it has been + // closed. + ccb.cc.pickerWrapper.updatePicker(s.Picker) + ccb.cc.csMgr.updateState(s.ConnectivityState) +} + +func (ccb *ccBalancerWrapper) ResolveNow(o resolver.ResolveNowOptions) { + ccb.cc.mu.RLock() + defer ccb.cc.mu.RUnlock() + + ccb.mu.Lock() + if ccb.closed { + ccb.mu.Unlock() + return + } + ccb.mu.Unlock() + ccb.cc.resolveNowLocked(o) +} + +func (ccb *ccBalancerWrapper) Target() string { + return ccb.cc.target +} + +// acBalancerWrapper is a wrapper on top of ac for balancers. +// It implements balancer.SubConn interface. +type acBalancerWrapper struct { + ac *addrConn // read-only + ccb *ccBalancerWrapper // read-only + stateListener func(balancer.SubConnState) + + mu sync.Mutex + producers map[balancer.ProducerBuilder]*refCountedProducer +} + +// updateState is invoked by grpc to push a subConn state update to the +// underlying balancer. +func (acbw *acBalancerWrapper) updateState(s connectivity.State, err error) { + acbw.ccb.serializer.Schedule(func(ctx context.Context) { + if ctx.Err() != nil || acbw.ccb.balancer == nil { + return + } + // Even though it is optional for balancers, gracefulswitch ensures + // opts.StateListener is set, so this cannot ever be nil. + // TODO: delete this comment when UpdateSubConnState is removed. + acbw.stateListener(balancer.SubConnState{ConnectivityState: s, ConnectionError: err}) + }) +} + +func (acbw *acBalancerWrapper) String() string { + return fmt.Sprintf("SubConn(id:%d)", acbw.ac.channelzID.Int()) +} + +func (acbw *acBalancerWrapper) UpdateAddresses(addrs []resolver.Address) { + acbw.ac.updateAddrs(addrs) +} + +func (acbw *acBalancerWrapper) Connect() { + go acbw.ac.connect() +} + +func (acbw *acBalancerWrapper) Shutdown() { + acbw.ccb.cc.removeAddrConn(acbw.ac, errConnDrain) +} + +// NewStream begins a streaming RPC on the addrConn. If the addrConn is not +// ready, blocks until it is or ctx expires. Returns an error when the context +// expires or the addrConn is shut down. +func (acbw *acBalancerWrapper) NewStream(ctx context.Context, desc *StreamDesc, method string, opts ...CallOption) (ClientStream, error) { + transport, err := acbw.ac.getTransport(ctx) + if err != nil { + return nil, err + } + return newNonRetryClientStream(ctx, desc, method, transport, acbw.ac, opts...) +} + +// Invoke performs a unary RPC. If the addrConn is not ready, returns +// errSubConnNotReady. +func (acbw *acBalancerWrapper) Invoke(ctx context.Context, method string, args any, reply any, opts ...CallOption) error { + cs, err := acbw.NewStream(ctx, unaryStreamDesc, method, opts...) + if err != nil { + return err + } + if err := cs.SendMsg(args); err != nil { + return err + } + return cs.RecvMsg(reply) +} + +type refCountedProducer struct { + producer balancer.Producer + refs int // number of current refs to the producer + close func() // underlying producer's close function +} + +func (acbw *acBalancerWrapper) GetOrBuildProducer(pb balancer.ProducerBuilder) (balancer.Producer, func()) { + acbw.mu.Lock() + defer acbw.mu.Unlock() + + // Look up existing producer from this builder. + pData := acbw.producers[pb] + if pData == nil { + // Not found; create a new one and add it to the producers map. + p, close := pb.Build(acbw) + pData = &refCountedProducer{producer: p, close: close} + acbw.producers[pb] = pData + } + // Account for this new reference. + pData.refs++ + + // Return a cleanup function wrapped in a OnceFunc to remove this reference + // and delete the refCountedProducer from the map if the total reference + // count goes to zero. + unref := func() { + acbw.mu.Lock() + pData.refs-- + if pData.refs == 0 { + defer pData.close() // Run outside the acbw mutex + delete(acbw.producers, pb) + } + acbw.mu.Unlock() + } + return pData.producer, grpcsync.OnceFunc(unref) +} diff --git a/vendor/google.golang.org/grpc/internal/experimental.go b/vendor/google.golang.org/grpc/internal/experimental.go new file mode 100644 index 000000000..7f7044e17 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/experimental.go @@ -0,0 +1,28 @@ +/* + * Copyright 2023 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package internal + +var ( + // WithRecvBufferPool is implemented by the grpc package and returns a dial + // option to configure a shared buffer pool for a grpc.ClientConn. + WithRecvBufferPool any // func (grpc.SharedBufferPool) grpc.DialOption + + // RecvBufferPool is implemented by the grpc package and returns a server + // option to configure a shared buffer pool for a grpc.Server. + RecvBufferPool any // func (grpc.SharedBufferPool) grpc.ServerOption +) diff --git a/vendor/google.golang.org/grpc/internal/idle/idle.go b/vendor/google.golang.org/grpc/internal/idle/idle.go new file mode 100644 index 000000000..fe49cb74c --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/idle/idle.go @@ -0,0 +1,278 @@ +/* + * + * Copyright 2023 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package idle contains a component for managing idleness (entering and exiting) +// based on RPC activity. +package idle + +import ( + "fmt" + "math" + "sync" + "sync/atomic" + "time" +) + +// For overriding in unit tests. +var timeAfterFunc = func(d time.Duration, f func()) *time.Timer { + return time.AfterFunc(d, f) +} + +// Enforcer is the functionality provided by grpc.ClientConn to enter +// and exit from idle mode. +type Enforcer interface { + ExitIdleMode() error + EnterIdleMode() +} + +// Manager implements idleness detection and calls the configured Enforcer to +// enter/exit idle mode when appropriate. Must be created by NewManager. +type Manager struct { + // State accessed atomically. + lastCallEndTime int64 // Unix timestamp in nanos; time when the most recent RPC completed. + activeCallsCount int32 // Count of active RPCs; -math.MaxInt32 means channel is idle or is trying to get there. + activeSinceLastTimerCheck int32 // Boolean; True if there was an RPC since the last timer callback. + closed int32 // Boolean; True when the manager is closed. + + // Can be accessed without atomics or mutex since these are set at creation + // time and read-only after that. + enforcer Enforcer // Functionality provided by grpc.ClientConn. + timeout time.Duration + + // idleMu is used to guarantee mutual exclusion in two scenarios: + // - Opposing intentions: + // - a: Idle timeout has fired and handleIdleTimeout() is trying to put + // the channel in idle mode because the channel has been inactive. + // - b: At the same time an RPC is made on the channel, and OnCallBegin() + // is trying to prevent the channel from going idle. + // - Competing intentions: + // - The channel is in idle mode and there are multiple RPCs starting at + // the same time, all trying to move the channel out of idle. Only one + // of them should succeed in doing so, while the other RPCs should + // piggyback on the first one and be successfully handled. + idleMu sync.RWMutex + actuallyIdle bool + timer *time.Timer +} + +// NewManager creates a new idleness manager implementation for the +// given idle timeout. It begins in idle mode. +func NewManager(enforcer Enforcer, timeout time.Duration) *Manager { + return &Manager{ + enforcer: enforcer, + timeout: timeout, + actuallyIdle: true, + activeCallsCount: -math.MaxInt32, + } +} + +// resetIdleTimerLocked resets the idle timer to the given duration. Called +// when exiting idle mode or when the timer fires and we need to reset it. +func (m *Manager) resetIdleTimerLocked(d time.Duration) { + if m.isClosed() || m.timeout == 0 || m.actuallyIdle { + return + } + + // It is safe to ignore the return value from Reset() because this method is + // only ever called from the timer callback or when exiting idle mode. + if m.timer != nil { + m.timer.Stop() + } + m.timer = timeAfterFunc(d, m.handleIdleTimeout) +} + +func (m *Manager) resetIdleTimer(d time.Duration) { + m.idleMu.Lock() + defer m.idleMu.Unlock() + m.resetIdleTimerLocked(d) +} + +// handleIdleTimeout is the timer callback that is invoked upon expiry of the +// configured idle timeout. The channel is considered inactive if there are no +// ongoing calls and no RPC activity since the last time the timer fired. +func (m *Manager) handleIdleTimeout() { + if m.isClosed() { + return + } + + if atomic.LoadInt32(&m.activeCallsCount) > 0 { + m.resetIdleTimer(m.timeout) + return + } + + // There has been activity on the channel since we last got here. Reset the + // timer and return. + if atomic.LoadInt32(&m.activeSinceLastTimerCheck) == 1 { + // Set the timer to fire after a duration of idle timeout, calculated + // from the time the most recent RPC completed. + atomic.StoreInt32(&m.activeSinceLastTimerCheck, 0) + m.resetIdleTimer(time.Duration(atomic.LoadInt64(&m.lastCallEndTime)-time.Now().UnixNano()) + m.timeout) + return + } + + // Now that we've checked that there has been no activity, attempt to enter + // idle mode, which is very likely to succeed. + if m.tryEnterIdleMode() { + // Successfully entered idle mode. No timer needed until we exit idle. + return + } + + // Failed to enter idle mode due to a concurrent RPC that kept the channel + // active, or because of an error from the channel. Undo the attempt to + // enter idle, and reset the timer to try again later. + m.resetIdleTimer(m.timeout) +} + +// tryEnterIdleMode instructs the channel to enter idle mode. But before +// that, it performs a last minute check to ensure that no new RPC has come in, +// making the channel active. +// +// Return value indicates whether or not the channel moved to idle mode. +// +// Holds idleMu which ensures mutual exclusion with exitIdleMode. +func (m *Manager) tryEnterIdleMode() bool { + // Setting the activeCallsCount to -math.MaxInt32 indicates to OnCallBegin() + // that the channel is either in idle mode or is trying to get there. + if !atomic.CompareAndSwapInt32(&m.activeCallsCount, 0, -math.MaxInt32) { + // This CAS operation can fail if an RPC started after we checked for + // activity in the timer handler, or one was ongoing from before the + // last time the timer fired, or if a test is attempting to enter idle + // mode without checking. In all cases, abort going into idle mode. + return false + } + // N.B. if we fail to enter idle mode after this, we must re-add + // math.MaxInt32 to m.activeCallsCount. + + m.idleMu.Lock() + defer m.idleMu.Unlock() + + if atomic.LoadInt32(&m.activeCallsCount) != -math.MaxInt32 { + // We raced and lost to a new RPC. Very rare, but stop entering idle. + atomic.AddInt32(&m.activeCallsCount, math.MaxInt32) + return false + } + if atomic.LoadInt32(&m.activeSinceLastTimerCheck) == 1 { + // A very short RPC could have come in (and also finished) after we + // checked for calls count and activity in handleIdleTimeout(), but + // before the CAS operation. So, we need to check for activity again. + atomic.AddInt32(&m.activeCallsCount, math.MaxInt32) + return false + } + + // No new RPCs have come in since we set the active calls count value to + // -math.MaxInt32. And since we have the lock, it is safe to enter idle mode + // unconditionally now. + m.enforcer.EnterIdleMode() + m.actuallyIdle = true + return true +} + +func (m *Manager) EnterIdleModeForTesting() { + m.tryEnterIdleMode() +} + +// OnCallBegin is invoked at the start of every RPC. +func (m *Manager) OnCallBegin() error { + if m.isClosed() { + return nil + } + + if atomic.AddInt32(&m.activeCallsCount, 1) > 0 { + // Channel is not idle now. Set the activity bit and allow the call. + atomic.StoreInt32(&m.activeSinceLastTimerCheck, 1) + return nil + } + + // Channel is either in idle mode or is in the process of moving to idle + // mode. Attempt to exit idle mode to allow this RPC. + if err := m.ExitIdleMode(); err != nil { + // Undo the increment to calls count, and return an error causing the + // RPC to fail. + atomic.AddInt32(&m.activeCallsCount, -1) + return err + } + + atomic.StoreInt32(&m.activeSinceLastTimerCheck, 1) + return nil +} + +// ExitIdleMode instructs m to call the enforcer's ExitIdleMode and update m's +// internal state. +func (m *Manager) ExitIdleMode() error { + // Holds idleMu which ensures mutual exclusion with tryEnterIdleMode. + m.idleMu.Lock() + defer m.idleMu.Unlock() + + if m.isClosed() || !m.actuallyIdle { + // This can happen in three scenarios: + // - handleIdleTimeout() set the calls count to -math.MaxInt32 and called + // tryEnterIdleMode(). But before the latter could grab the lock, an RPC + // came in and OnCallBegin() noticed that the calls count is negative. + // - Channel is in idle mode, and multiple new RPCs come in at the same + // time, all of them notice a negative calls count in OnCallBegin and get + // here. The first one to get the lock would got the channel to exit idle. + // - Channel is not in idle mode, and the user calls Connect which calls + // m.ExitIdleMode. + // + // In any case, there is nothing to do here. + return nil + } + + if err := m.enforcer.ExitIdleMode(); err != nil { + return fmt.Errorf("failed to exit idle mode: %w", err) + } + + // Undo the idle entry process. This also respects any new RPC attempts. + atomic.AddInt32(&m.activeCallsCount, math.MaxInt32) + m.actuallyIdle = false + + // Start a new timer to fire after the configured idle timeout. + m.resetIdleTimerLocked(m.timeout) + return nil +} + +// OnCallEnd is invoked at the end of every RPC. +func (m *Manager) OnCallEnd() { + if m.isClosed() { + return + } + + // Record the time at which the most recent call finished. + atomic.StoreInt64(&m.lastCallEndTime, time.Now().UnixNano()) + + // Decrement the active calls count. This count can temporarily go negative + // when the timer callback is in the process of moving the channel to idle + // mode, but one or more RPCs come in and complete before the timer callback + // can get done with the process of moving to idle mode. + atomic.AddInt32(&m.activeCallsCount, -1) +} + +func (m *Manager) isClosed() bool { + return atomic.LoadInt32(&m.closed) == 1 +} + +func (m *Manager) Close() { + atomic.StoreInt32(&m.closed, 1) + + m.idleMu.Lock() + if m.timer != nil { + m.timer.Stop() + m.timer = nil + } + m.idleMu.Unlock() +} diff --git a/vendor/google.golang.org/grpc/internal/resolver/dns/internal/internal.go b/vendor/google.golang.org/grpc/internal/resolver/dns/internal/internal.go new file mode 100644 index 000000000..c7fc557d0 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/resolver/dns/internal/internal.go @@ -0,0 +1,70 @@ +/* + * + * Copyright 2023 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package internal contains functionality internal to the dns resolver package. +package internal + +import ( + "context" + "errors" + "net" + "time" +) + +// NetResolver groups the methods on net.Resolver that are used by the DNS +// resolver implementation. This allows the default net.Resolver instance to be +// overidden from tests. +type NetResolver interface { + LookupHost(ctx context.Context, host string) (addrs []string, err error) + LookupSRV(ctx context.Context, service, proto, name string) (cname string, addrs []*net.SRV, err error) + LookupTXT(ctx context.Context, name string) (txts []string, err error) +} + +var ( + // ErrMissingAddr is the error returned when building a DNS resolver when + // the provided target name is empty. + ErrMissingAddr = errors.New("dns resolver: missing address") + + // ErrEndsWithColon is the error returned when building a DNS resolver when + // the provided target name ends with a colon that is supposed to be the + // separator between host and port. E.g. "::" is a valid address as it is + // an IPv6 address (host only) and "[::]:" is invalid as it ends with a + // colon as the host and port separator + ErrEndsWithColon = errors.New("dns resolver: missing port after port-separator colon") +) + +// The following vars are overridden from tests. +var ( + // MinResolutionRate is the minimum rate at which re-resolutions are + // allowed. This helps to prevent excessive re-resolution. + MinResolutionRate = 30 * time.Second + + // TimeAfterFunc is used by the DNS resolver to wait for the given duration + // to elapse. In non-test code, this is implemented by time.After. In test + // code, this can be used to control the amount of time the resolver is + // blocked waiting for the duration to elapse. + TimeAfterFunc func(time.Duration) <-chan time.Time + + // NewNetResolver returns the net.Resolver instance for the given target. + NewNetResolver func(string) (NetResolver, error) + + // AddressDialer is the dialer used to dial the DNS server. It accepts the + // Host portion of the URL corresponding to the user's dial target and + // returns a dial function. + AddressDialer func(address string) func(context.Context, string, string) (net.Conn, error) +) diff --git a/vendor/google.golang.org/grpc/internal/tcp_keepalive_nonunix.go b/vendor/google.golang.org/grpc/internal/tcp_keepalive_nonunix.go new file mode 100644 index 000000000..aeffd3e1c --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/tcp_keepalive_nonunix.go @@ -0,0 +1,29 @@ +//go:build !unix + +/* + * Copyright 2023 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package internal + +import ( + "net" +) + +// NetDialerWithTCPKeepalive returns a vanilla net.Dialer on non-unix platforms. +func NetDialerWithTCPKeepalive() *net.Dialer { + return &net.Dialer{} +} diff --git a/vendor/google.golang.org/grpc/internal/tcp_keepalive_unix.go b/vendor/google.golang.org/grpc/internal/tcp_keepalive_unix.go new file mode 100644 index 000000000..078137b7f --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/tcp_keepalive_unix.go @@ -0,0 +1,54 @@ +//go:build unix + +/* + * Copyright 2023 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package internal + +import ( + "net" + "syscall" + "time" + + "golang.org/x/sys/unix" +) + +// NetDialerWithTCPKeepalive returns a net.Dialer that enables TCP keepalives on +// the underlying connection with OS default values for keepalive parameters. +// +// TODO: Once https://github.com/golang/go/issues/62254 lands, and the +// appropriate Go version becomes less than our least supported Go version, we +// should look into using the new API to make things more straightforward. +func NetDialerWithTCPKeepalive() *net.Dialer { + return &net.Dialer{ + // Setting a negative value here prevents the Go stdlib from overriding + // the values of TCP keepalive time and interval. It also prevents the + // Go stdlib from enabling TCP keepalives by default. + KeepAlive: time.Duration(-1), + // This method is called after the underlying network socket is created, + // but before dialing the socket (or calling its connect() method). The + // combination of unconditionally enabling TCP keepalives here, and + // disabling the overriding of TCP keepalive parameters by setting the + // KeepAlive field to a negative value above, results in OS defaults for + // the TCP keealive interval and time parameters. + Control: func(_, _ string, c syscall.RawConn) error { + return c.Control(func(fd uintptr) { + unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_KEEPALIVE, 1) + }) + }, + } +} diff --git a/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go b/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go new file mode 100644 index 000000000..14aa6f20a --- /dev/null +++ b/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go @@ -0,0 +1,36 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package dns implements a dns resolver to be installed as the default resolver +// in grpc. +// +// Deprecated: this package is imported by grpc and should not need to be +// imported directly by users. +package dns + +import ( + "google.golang.org/grpc/internal/resolver/dns" + "google.golang.org/grpc/resolver" +) + +// NewBuilder creates a dnsBuilder which is used to factory DNS resolvers. +// +// Deprecated: import grpc and use resolver.Get("dns") instead. +func NewBuilder() resolver.Builder { + return dns.NewBuilder() +} diff --git a/vendor/google.golang.org/grpc/resolver/manual/manual.go b/vendor/google.golang.org/grpc/resolver/manual/manual.go new file mode 100644 index 000000000..f2efa2a2c --- /dev/null +++ b/vendor/google.golang.org/grpc/resolver/manual/manual.go @@ -0,0 +1,126 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package manual defines a resolver that can be used to manually send resolved +// addresses to ClientConn. +package manual + +import ( + "sync" + + "google.golang.org/grpc/resolver" +) + +// NewBuilderWithScheme creates a new manual resolver builder with the given +// scheme. Every instance of the manual resolver may only ever be used with a +// single grpc.ClientConn. Otherwise, bad things will happen. +func NewBuilderWithScheme(scheme string) *Resolver { + return &Resolver{ + BuildCallback: func(resolver.Target, resolver.ClientConn, resolver.BuildOptions) {}, + UpdateStateCallback: func(error) {}, + ResolveNowCallback: func(resolver.ResolveNowOptions) {}, + CloseCallback: func() {}, + scheme: scheme, + } +} + +// Resolver is also a resolver builder. +// It's build() function always returns itself. +type Resolver struct { + // BuildCallback is called when the Build method is called. Must not be + // nil. Must not be changed after the resolver may be built. + BuildCallback func(resolver.Target, resolver.ClientConn, resolver.BuildOptions) + // UpdateStateCallback is called when the UpdateState method is called on + // the resolver. The value passed as argument to this callback is the value + // returned by the resolver.ClientConn. Must not be nil. Must not be + // changed after the resolver may be built. + UpdateStateCallback func(err error) + // ResolveNowCallback is called when the ResolveNow method is called on the + // resolver. Must not be nil. Must not be changed after the resolver may + // be built. + ResolveNowCallback func(resolver.ResolveNowOptions) + // CloseCallback is called when the Close method is called. Must not be + // nil. Must not be changed after the resolver may be built. + CloseCallback func() + scheme string + + // Fields actually belong to the resolver. + // Guards access to below fields. + mu sync.Mutex + CC resolver.ClientConn + // Storing the most recent state update makes this resolver resilient to + // restarts, which is possible with channel idleness. + lastSeenState *resolver.State +} + +// InitialState adds initial state to the resolver so that UpdateState doesn't +// need to be explicitly called after Dial. +func (r *Resolver) InitialState(s resolver.State) { + r.lastSeenState = &s +} + +// Build returns itself for Resolver, because it's both a builder and a resolver. +func (r *Resolver) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) { + r.BuildCallback(target, cc, opts) + r.mu.Lock() + defer r.mu.Unlock() + r.CC = cc + if r.lastSeenState != nil { + err := r.CC.UpdateState(*r.lastSeenState) + go r.UpdateStateCallback(err) + } + return r, nil +} + +// Scheme returns the manual resolver's scheme. +func (r *Resolver) Scheme() string { + return r.scheme +} + +// ResolveNow is a noop for Resolver. +func (r *Resolver) ResolveNow(o resolver.ResolveNowOptions) { + r.ResolveNowCallback(o) +} + +// Close is a noop for Resolver. +func (r *Resolver) Close() { + r.CloseCallback() +} + +// UpdateState calls CC.UpdateState. +func (r *Resolver) UpdateState(s resolver.State) { + r.mu.Lock() + defer r.mu.Unlock() + var err error + if r.CC == nil { + panic("cannot update state as grpc.Dial with resolver has not been called") + } + err = r.CC.UpdateState(s) + r.lastSeenState = &s + r.UpdateStateCallback(err) +} + +// ReportError calls CC.ReportError. +func (r *Resolver) ReportError(err error) { + r.mu.Lock() + defer r.mu.Unlock() + if r.CC == nil { + panic("cannot report error as grpc.Dial with resolver has not been called") + } + r.CC.ReportError(err) +} diff --git a/vendor/google.golang.org/grpc/resolver_wrapper.go b/vendor/google.golang.org/grpc/resolver_wrapper.go new file mode 100644 index 000000000..c79bab121 --- /dev/null +++ b/vendor/google.golang.org/grpc/resolver_wrapper.go @@ -0,0 +1,197 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package grpc + +import ( + "context" + "strings" + "sync" + + "google.golang.org/grpc/internal/channelz" + "google.golang.org/grpc/internal/grpcsync" + "google.golang.org/grpc/internal/pretty" + "google.golang.org/grpc/resolver" + "google.golang.org/grpc/serviceconfig" +) + +// ccResolverWrapper is a wrapper on top of cc for resolvers. +// It implements resolver.ClientConn interface. +type ccResolverWrapper struct { + // The following fields are initialized when the wrapper is created and are + // read-only afterwards, and therefore can be accessed without a mutex. + cc *ClientConn + ignoreServiceConfig bool + serializer *grpcsync.CallbackSerializer + serializerCancel context.CancelFunc + + resolver resolver.Resolver // only accessed within the serializer + + // The following fields are protected by mu. Caller must take cc.mu before + // taking mu. + mu sync.Mutex + curState resolver.State + closed bool +} + +// newCCResolverWrapper initializes the ccResolverWrapper. It can only be used +// after calling start, which builds the resolver. +func newCCResolverWrapper(cc *ClientConn) *ccResolverWrapper { + ctx, cancel := context.WithCancel(cc.ctx) + return &ccResolverWrapper{ + cc: cc, + ignoreServiceConfig: cc.dopts.disableServiceConfig, + serializer: grpcsync.NewCallbackSerializer(ctx), + serializerCancel: cancel, + } +} + +// start builds the name resolver using the resolver.Builder in cc and returns +// any error encountered. It must always be the first operation performed on +// any newly created ccResolverWrapper, except that close may be called instead. +func (ccr *ccResolverWrapper) start() error { + errCh := make(chan error) + ccr.serializer.Schedule(func(ctx context.Context) { + if ctx.Err() != nil { + return + } + opts := resolver.BuildOptions{ + DisableServiceConfig: ccr.cc.dopts.disableServiceConfig, + DialCreds: ccr.cc.dopts.copts.TransportCredentials, + CredsBundle: ccr.cc.dopts.copts.CredsBundle, + Dialer: ccr.cc.dopts.copts.Dialer, + } + var err error + ccr.resolver, err = ccr.cc.resolverBuilder.Build(ccr.cc.parsedTarget, ccr, opts) + errCh <- err + }) + return <-errCh +} + +func (ccr *ccResolverWrapper) resolveNow(o resolver.ResolveNowOptions) { + ccr.serializer.Schedule(func(ctx context.Context) { + if ctx.Err() != nil || ccr.resolver == nil { + return + } + ccr.resolver.ResolveNow(o) + }) +} + +// close initiates async shutdown of the wrapper. To determine the wrapper has +// finished shutting down, the channel should block on ccr.serializer.Done() +// without cc.mu held. +func (ccr *ccResolverWrapper) close() { + channelz.Info(logger, ccr.cc.channelzID, "Closing the name resolver") + ccr.mu.Lock() + ccr.closed = true + ccr.mu.Unlock() + + ccr.serializer.Schedule(func(context.Context) { + if ccr.resolver == nil { + return + } + ccr.resolver.Close() + ccr.resolver = nil + }) + ccr.serializerCancel() +} + +// UpdateState is called by resolver implementations to report new state to gRPC +// which includes addresses and service config. +func (ccr *ccResolverWrapper) UpdateState(s resolver.State) error { + ccr.cc.mu.Lock() + ccr.mu.Lock() + if ccr.closed { + ccr.mu.Unlock() + ccr.cc.mu.Unlock() + return nil + } + if s.Endpoints == nil { + s.Endpoints = make([]resolver.Endpoint, 0, len(s.Addresses)) + for _, a := range s.Addresses { + ep := resolver.Endpoint{Addresses: []resolver.Address{a}, Attributes: a.BalancerAttributes} + ep.Addresses[0].BalancerAttributes = nil + s.Endpoints = append(s.Endpoints, ep) + } + } + ccr.addChannelzTraceEvent(s) + ccr.curState = s + ccr.mu.Unlock() + return ccr.cc.updateResolverStateAndUnlock(s, nil) +} + +// ReportError is called by resolver implementations to report errors +// encountered during name resolution to gRPC. +func (ccr *ccResolverWrapper) ReportError(err error) { + ccr.cc.mu.Lock() + ccr.mu.Lock() + if ccr.closed { + ccr.mu.Unlock() + ccr.cc.mu.Unlock() + return + } + ccr.mu.Unlock() + channelz.Warningf(logger, ccr.cc.channelzID, "ccResolverWrapper: reporting error to cc: %v", err) + ccr.cc.updateResolverStateAndUnlock(resolver.State{}, err) +} + +// NewAddress is called by the resolver implementation to send addresses to +// gRPC. +func (ccr *ccResolverWrapper) NewAddress(addrs []resolver.Address) { + ccr.cc.mu.Lock() + ccr.mu.Lock() + if ccr.closed { + ccr.mu.Unlock() + ccr.cc.mu.Unlock() + return + } + s := resolver.State{Addresses: addrs, ServiceConfig: ccr.curState.ServiceConfig} + ccr.addChannelzTraceEvent(s) + ccr.curState = s + ccr.mu.Unlock() + ccr.cc.updateResolverStateAndUnlock(s, nil) +} + +// ParseServiceConfig is called by resolver implementations to parse a JSON +// representation of the service config. +func (ccr *ccResolverWrapper) ParseServiceConfig(scJSON string) *serviceconfig.ParseResult { + return parseServiceConfig(scJSON) +} + +// addChannelzTraceEvent adds a channelz trace event containing the new +// state received from resolver implementations. +func (ccr *ccResolverWrapper) addChannelzTraceEvent(s resolver.State) { + var updates []string + var oldSC, newSC *ServiceConfig + var oldOK, newOK bool + if ccr.curState.ServiceConfig != nil { + oldSC, oldOK = ccr.curState.ServiceConfig.Config.(*ServiceConfig) + } + if s.ServiceConfig != nil { + newSC, newOK = s.ServiceConfig.Config.(*ServiceConfig) + } + if oldOK != newOK || (oldOK && newOK && oldSC.rawJSONString != newSC.rawJSONString) { + updates = append(updates, "service config updated") + } + if len(ccr.curState.Addresses) > 0 && len(s.Addresses) == 0 { + updates = append(updates, "resolver returned an empty address list") + } else if len(ccr.curState.Addresses) == 0 && len(s.Addresses) > 0 { + updates = append(updates, "resolver returned new addresses") + } + channelz.Infof(logger, ccr.cc.channelzID, "Resolver state updated: %s (%v)", pretty.ToJSON(s), strings.Join(updates, "; ")) +} diff --git a/vendor/google.golang.org/protobuf/internal/editiondefaults/defaults.go b/vendor/google.golang.org/protobuf/internal/editiondefaults/defaults.go new file mode 100644 index 000000000..14656b65a --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/editiondefaults/defaults.go @@ -0,0 +1,12 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package editiondefaults contains the binary representation of the editions +// defaults. +package editiondefaults + +import _ "embed" + +//go:embed editions_defaults.binpb +var Defaults []byte diff --git a/vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb b/vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb new file mode 100644 index 000000000..18f075687 --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb @@ -0,0 +1,4 @@ + +  (0ę +  (0ē +  (0č ę(č \ No newline at end of file diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/editions.go b/vendor/google.golang.org/protobuf/internal/filedesc/editions.go new file mode 100644 index 000000000..0375a49d4 --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/filedesc/editions.go @@ -0,0 +1,142 @@ +// Copyright 2024 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package filedesc + +import ( + "fmt" + + "google.golang.org/protobuf/encoding/protowire" + "google.golang.org/protobuf/internal/editiondefaults" + "google.golang.org/protobuf/internal/genid" + "google.golang.org/protobuf/reflect/protoreflect" +) + +var defaultsCache = make(map[Edition]EditionFeatures) + +func init() { + unmarshalEditionDefaults(editiondefaults.Defaults) +} + +func unmarshalGoFeature(b []byte, parent EditionFeatures) EditionFeatures { + for len(b) > 0 { + num, _, n := protowire.ConsumeTag(b) + b = b[n:] + switch num { + case genid.GoFeatures_LegacyUnmarshalJsonEnum_field_number: + v, m := protowire.ConsumeVarint(b) + b = b[m:] + parent.GenerateLegacyUnmarshalJSON = protowire.DecodeBool(v) + default: + panic(fmt.Sprintf("unkown field number %d while unmarshalling GoFeatures", num)) + } + } + return parent +} + +func unmarshalFeatureSet(b []byte, parent EditionFeatures) EditionFeatures { + for len(b) > 0 { + num, typ, n := protowire.ConsumeTag(b) + b = b[n:] + switch typ { + case protowire.VarintType: + v, m := protowire.ConsumeVarint(b) + b = b[m:] + switch num { + case genid.FeatureSet_FieldPresence_field_number: + parent.IsFieldPresence = v == genid.FeatureSet_EXPLICIT_enum_value || v == genid.FeatureSet_LEGACY_REQUIRED_enum_value + parent.IsLegacyRequired = v == genid.FeatureSet_LEGACY_REQUIRED_enum_value + case genid.FeatureSet_EnumType_field_number: + parent.IsOpenEnum = v == genid.FeatureSet_OPEN_enum_value + case genid.FeatureSet_RepeatedFieldEncoding_field_number: + parent.IsPacked = v == genid.FeatureSet_PACKED_enum_value + case genid.FeatureSet_Utf8Validation_field_number: + parent.IsUTF8Validated = v == genid.FeatureSet_VERIFY_enum_value + case genid.FeatureSet_MessageEncoding_field_number: + parent.IsDelimitedEncoded = v == genid.FeatureSet_DELIMITED_enum_value + case genid.FeatureSet_JsonFormat_field_number: + parent.IsJSONCompliant = v == genid.FeatureSet_ALLOW_enum_value + default: + panic(fmt.Sprintf("unkown field number %d while unmarshalling FeatureSet", num)) + } + case protowire.BytesType: + v, m := protowire.ConsumeBytes(b) + b = b[m:] + switch num { + case genid.GoFeatures_LegacyUnmarshalJsonEnum_field_number: + parent = unmarshalGoFeature(v, parent) + } + } + } + + return parent +} + +func featuresFromParentDesc(parentDesc protoreflect.Descriptor) EditionFeatures { + var parentFS EditionFeatures + switch p := parentDesc.(type) { + case *File: + parentFS = p.L1.EditionFeatures + case *Message: + parentFS = p.L1.EditionFeatures + default: + panic(fmt.Sprintf("unknown parent type %T", parentDesc)) + } + return parentFS +} + +func unmarshalEditionDefault(b []byte) { + var ed Edition + var fs EditionFeatures + for len(b) > 0 { + num, typ, n := protowire.ConsumeTag(b) + b = b[n:] + switch typ { + case protowire.VarintType: + v, m := protowire.ConsumeVarint(b) + b = b[m:] + switch num { + case genid.FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_number: + ed = Edition(v) + } + case protowire.BytesType: + v, m := protowire.ConsumeBytes(b) + b = b[m:] + switch num { + case genid.FeatureSetDefaults_FeatureSetEditionDefault_Features_field_number: + fs = unmarshalFeatureSet(v, fs) + } + } + } + defaultsCache[ed] = fs +} + +func unmarshalEditionDefaults(b []byte) { + for len(b) > 0 { + num, _, n := protowire.ConsumeTag(b) + b = b[n:] + switch num { + case genid.FeatureSetDefaults_Defaults_field_number: + def, m := protowire.ConsumeBytes(b) + b = b[m:] + unmarshalEditionDefault(def) + case genid.FeatureSetDefaults_MinimumEdition_field_number, + genid.FeatureSetDefaults_MaximumEdition_field_number: + // We don't care about the minimum and maximum editions. If the + // edition we are looking for later on is not in the cache we know + // it is outside of the range between minimum and maximum edition. + _, m := protowire.ConsumeVarint(b) + b = b[m:] + default: + panic(fmt.Sprintf("unkown field number %d while unmarshalling EditionDefault", num)) + } + } +} + +func getFeaturesFor(ed Edition) EditionFeatures { + if def, ok := defaultsCache[ed]; ok { + return def + } + panic(fmt.Sprintf("unsupported edition: %v", ed)) +} diff --git a/vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go b/vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go new file mode 100644 index 000000000..fd9015e8e --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go @@ -0,0 +1,31 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Code generated by generate-protos. DO NOT EDIT. + +package genid + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" +) + +const File_reflect_protodesc_proto_go_features_proto = "reflect/protodesc/proto/go_features.proto" + +// Names for google.protobuf.GoFeatures. +const ( + GoFeatures_message_name protoreflect.Name = "GoFeatures" + GoFeatures_message_fullname protoreflect.FullName = "google.protobuf.GoFeatures" +) + +// Field names for google.protobuf.GoFeatures. +const ( + GoFeatures_LegacyUnmarshalJsonEnum_field_name protoreflect.Name = "legacy_unmarshal_json_enum" + + GoFeatures_LegacyUnmarshalJsonEnum_field_fullname protoreflect.FullName = "google.protobuf.GoFeatures.legacy_unmarshal_json_enum" +) + +// Field numbers for google.protobuf.GoFeatures. +const ( + GoFeatures_LegacyUnmarshalJsonEnum_field_number protoreflect.FieldNumber = 1 +) diff --git a/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go120.go b/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go120.go new file mode 100644 index 000000000..a008acd09 --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go120.go @@ -0,0 +1,95 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !purego && !appengine && !go1.21 +// +build !purego,!appengine,!go1.21 + +package strs + +import ( + "unsafe" + + "google.golang.org/protobuf/reflect/protoreflect" +) + +type ( + stringHeader struct { + Data unsafe.Pointer + Len int + } + sliceHeader struct { + Data unsafe.Pointer + Len int + Cap int + } +) + +// UnsafeString returns an unsafe string reference of b. +// The caller must treat the input slice as immutable. +// +// WARNING: Use carefully. The returned result must not leak to the end user +// unless the input slice is provably immutable. +func UnsafeString(b []byte) (s string) { + src := (*sliceHeader)(unsafe.Pointer(&b)) + dst := (*stringHeader)(unsafe.Pointer(&s)) + dst.Data = src.Data + dst.Len = src.Len + return s +} + +// UnsafeBytes returns an unsafe bytes slice reference of s. +// The caller must treat returned slice as immutable. +// +// WARNING: Use carefully. The returned result must not leak to the end user. +func UnsafeBytes(s string) (b []byte) { + src := (*stringHeader)(unsafe.Pointer(&s)) + dst := (*sliceHeader)(unsafe.Pointer(&b)) + dst.Data = src.Data + dst.Len = src.Len + dst.Cap = src.Len + return b +} + +// Builder builds a set of strings with shared lifetime. +// This differs from strings.Builder, which is for building a single string. +type Builder struct { + buf []byte +} + +// AppendFullName is equivalent to protoreflect.FullName.Append, +// but optimized for large batches where each name has a shared lifetime. +func (sb *Builder) AppendFullName(prefix protoreflect.FullName, name protoreflect.Name) protoreflect.FullName { + n := len(prefix) + len(".") + len(name) + if len(prefix) == 0 { + n -= len(".") + } + sb.grow(n) + sb.buf = append(sb.buf, prefix...) + sb.buf = append(sb.buf, '.') + sb.buf = append(sb.buf, name...) + return protoreflect.FullName(sb.last(n)) +} + +// MakeString is equivalent to string(b), but optimized for large batches +// with a shared lifetime. +func (sb *Builder) MakeString(b []byte) string { + sb.grow(len(b)) + sb.buf = append(sb.buf, b...) + return sb.last(len(b)) +} + +func (sb *Builder) grow(n int) { + if cap(sb.buf)-len(sb.buf) >= n { + return + } + + // Unlike strings.Builder, we do not need to copy over the contents + // of the old buffer since our builder provides no API for + // retrieving previously created strings. + sb.buf = make([]byte, 0, 2*(cap(sb.buf)+n)) +} + +func (sb *Builder) last(n int) string { + return UnsafeString(sb.buf[len(sb.buf)-n:]) +} diff --git a/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go b/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go new file mode 100644 index 000000000..60166f2ba --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go @@ -0,0 +1,74 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !purego && !appengine && go1.21 +// +build !purego,!appengine,go1.21 + +package strs + +import ( + "unsafe" + + "google.golang.org/protobuf/reflect/protoreflect" +) + +// UnsafeString returns an unsafe string reference of b. +// The caller must treat the input slice as immutable. +// +// WARNING: Use carefully. The returned result must not leak to the end user +// unless the input slice is provably immutable. +func UnsafeString(b []byte) string { + return unsafe.String(unsafe.SliceData(b), len(b)) +} + +// UnsafeBytes returns an unsafe bytes slice reference of s. +// The caller must treat returned slice as immutable. +// +// WARNING: Use carefully. The returned result must not leak to the end user. +func UnsafeBytes(s string) []byte { + return unsafe.Slice(unsafe.StringData(s), len(s)) +} + +// Builder builds a set of strings with shared lifetime. +// This differs from strings.Builder, which is for building a single string. +type Builder struct { + buf []byte +} + +// AppendFullName is equivalent to protoreflect.FullName.Append, +// but optimized for large batches where each name has a shared lifetime. +func (sb *Builder) AppendFullName(prefix protoreflect.FullName, name protoreflect.Name) protoreflect.FullName { + n := len(prefix) + len(".") + len(name) + if len(prefix) == 0 { + n -= len(".") + } + sb.grow(n) + sb.buf = append(sb.buf, prefix...) + sb.buf = append(sb.buf, '.') + sb.buf = append(sb.buf, name...) + return protoreflect.FullName(sb.last(n)) +} + +// MakeString is equivalent to string(b), but optimized for large batches +// with a shared lifetime. +func (sb *Builder) MakeString(b []byte) string { + sb.grow(len(b)) + sb.buf = append(sb.buf, b...) + return sb.last(len(b)) +} + +func (sb *Builder) grow(n int) { + if cap(sb.buf)-len(sb.buf) >= n { + return + } + + // Unlike strings.Builder, we do not need to copy over the contents + // of the old buffer since our builder provides no API for + // retrieving previously created strings. + sb.buf = make([]byte, 0, 2*(cap(sb.buf)+n)) +} + +func (sb *Builder) last(n int) string { + return UnsafeString(sb.buf[len(sb.buf)-n:]) +} diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/editions.go b/vendor/google.golang.org/protobuf/reflect/protodesc/editions.go new file mode 100644 index 000000000..2a6b29d17 --- /dev/null +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/editions.go @@ -0,0 +1,148 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package protodesc + +import ( + "fmt" + "os" + "sync" + + "google.golang.org/protobuf/internal/editiondefaults" + "google.golang.org/protobuf/internal/filedesc" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/types/descriptorpb" + gofeaturespb "google.golang.org/protobuf/types/gofeaturespb" +) + +const ( + SupportedEditionsMinimum = descriptorpb.Edition_EDITION_PROTO2 + SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2023 +) + +var defaults = &descriptorpb.FeatureSetDefaults{} +var defaultsCacheMu sync.Mutex +var defaultsCache = make(map[filedesc.Edition]*descriptorpb.FeatureSet) + +func init() { + err := proto.Unmarshal(editiondefaults.Defaults, defaults) + if err != nil { + fmt.Fprintf(os.Stderr, "unmarshal editions defaults: %v\n", err) + os.Exit(1) + } +} + +func fromEditionProto(epb descriptorpb.Edition) filedesc.Edition { + return filedesc.Edition(epb) +} + +func toEditionProto(ed filedesc.Edition) descriptorpb.Edition { + switch ed { + case filedesc.EditionUnknown: + return descriptorpb.Edition_EDITION_UNKNOWN + case filedesc.EditionProto2: + return descriptorpb.Edition_EDITION_PROTO2 + case filedesc.EditionProto3: + return descriptorpb.Edition_EDITION_PROTO3 + case filedesc.Edition2023: + return descriptorpb.Edition_EDITION_2023 + default: + panic(fmt.Sprintf("unknown value for edition: %v", ed)) + } +} + +func getFeatureSetFor(ed filedesc.Edition) *descriptorpb.FeatureSet { + defaultsCacheMu.Lock() + defer defaultsCacheMu.Unlock() + if def, ok := defaultsCache[ed]; ok { + return def + } + edpb := toEditionProto(ed) + if defaults.GetMinimumEdition() > edpb || defaults.GetMaximumEdition() < edpb { + // This should never happen protodesc.(FileOptions).New would fail when + // initializing the file descriptor. + // This most likely means the embedded defaults were not updated. + fmt.Fprintf(os.Stderr, "internal error: unsupported edition %v (did you forget to update the embedded defaults (i.e. the bootstrap descriptor proto)?)\n", edpb) + os.Exit(1) + } + fs := defaults.GetDefaults()[0].GetFeatures() + // Using a linear search for now. + // Editions are guaranteed to be sorted and thus we could use a binary search. + // Given that there are only a handful of editions (with one more per year) + // there is not much reason to use a binary search. + for _, def := range defaults.GetDefaults() { + if def.GetEdition() <= edpb { + fs = def.GetFeatures() + } else { + break + } + } + defaultsCache[ed] = fs + return fs +} + +// mergeEditionFeatures merges the parent and child feature sets. This function +// should be used when initializing Go descriptors from descriptor protos which +// is why the parent is a filedesc.EditionsFeatures (Go representation) while +// the child is a descriptorproto.FeatureSet (protoc representation). +// Any feature set by the child overwrites what is set by the parent. +func mergeEditionFeatures(parentDesc protoreflect.Descriptor, child *descriptorpb.FeatureSet) filedesc.EditionFeatures { + var parentFS filedesc.EditionFeatures + switch p := parentDesc.(type) { + case *filedesc.File: + parentFS = p.L1.EditionFeatures + case *filedesc.Message: + parentFS = p.L1.EditionFeatures + default: + panic(fmt.Sprintf("unknown parent type %T", parentDesc)) + } + if child == nil { + return parentFS + } + if fp := child.FieldPresence; fp != nil { + parentFS.IsFieldPresence = *fp == descriptorpb.FeatureSet_LEGACY_REQUIRED || + *fp == descriptorpb.FeatureSet_EXPLICIT + parentFS.IsLegacyRequired = *fp == descriptorpb.FeatureSet_LEGACY_REQUIRED + } + if et := child.EnumType; et != nil { + parentFS.IsOpenEnum = *et == descriptorpb.FeatureSet_OPEN + } + + if rfe := child.RepeatedFieldEncoding; rfe != nil { + parentFS.IsPacked = *rfe == descriptorpb.FeatureSet_PACKED + } + + if utf8val := child.Utf8Validation; utf8val != nil { + parentFS.IsUTF8Validated = *utf8val == descriptorpb.FeatureSet_VERIFY + } + + if me := child.MessageEncoding; me != nil { + parentFS.IsDelimitedEncoded = *me == descriptorpb.FeatureSet_DELIMITED + } + + if jf := child.JsonFormat; jf != nil { + parentFS.IsJSONCompliant = *jf == descriptorpb.FeatureSet_ALLOW + } + + if goFeatures, ok := proto.GetExtension(child, gofeaturespb.E_Go).(*gofeaturespb.GoFeatures); ok && goFeatures != nil { + if luje := goFeatures.LegacyUnmarshalJsonEnum; luje != nil { + parentFS.GenerateLegacyUnmarshalJSON = *luje + } + } + + return parentFS +} + +// initFileDescFromFeatureSet initializes editions related fields in fd based +// on fs. If fs is nil it is assumed to be an empty featureset and all fields +// will be initialized with the appropriate default. fd.L1.Edition must be set +// before calling this function. +func initFileDescFromFeatureSet(fd *filedesc.File, fs *descriptorpb.FeatureSet) { + dfs := getFeatureSetFor(fd.L1.Edition) + // initialize the featureset with the defaults + fd.L1.EditionFeatures = mergeEditionFeatures(fd, dfs) + // overwrite any options explicitly specified + fd.L1.EditionFeatures = mergeEditionFeatures(fd, fs) +} diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go new file mode 100644 index 000000000..b1fdbe3e8 --- /dev/null +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go @@ -0,0 +1,99 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !purego && !appengine && !go1.21 +// +build !purego,!appengine,!go1.21 + +package protoreflect + +import ( + "unsafe" + + "google.golang.org/protobuf/internal/pragma" +) + +type ( + stringHeader struct { + Data unsafe.Pointer + Len int + } + sliceHeader struct { + Data unsafe.Pointer + Len int + Cap int + } + ifaceHeader struct { + Type unsafe.Pointer + Data unsafe.Pointer + } +) + +var ( + nilType = typeOf(nil) + boolType = typeOf(*new(bool)) + int32Type = typeOf(*new(int32)) + int64Type = typeOf(*new(int64)) + uint32Type = typeOf(*new(uint32)) + uint64Type = typeOf(*new(uint64)) + float32Type = typeOf(*new(float32)) + float64Type = typeOf(*new(float64)) + stringType = typeOf(*new(string)) + bytesType = typeOf(*new([]byte)) + enumType = typeOf(*new(EnumNumber)) +) + +// typeOf returns a pointer to the Go type information. +// The pointer is comparable and equal if and only if the types are identical. +func typeOf(t interface{}) unsafe.Pointer { + return (*ifaceHeader)(unsafe.Pointer(&t)).Type +} + +// value is a union where only one type can be represented at a time. +// The struct is 24B large on 64-bit systems and requires the minimum storage +// necessary to represent each possible type. +// +// The Go GC needs to be able to scan variables containing pointers. +// As such, pointers and non-pointers cannot be intermixed. +type value struct { + pragma.DoNotCompare // 0B + + // typ stores the type of the value as a pointer to the Go type. + typ unsafe.Pointer // 8B + + // ptr stores the data pointer for a String, Bytes, or interface value. + ptr unsafe.Pointer // 8B + + // num stores a Bool, Int32, Int64, Uint32, Uint64, Float32, Float64, or + // Enum value as a raw uint64. + // + // It is also used to store the length of a String or Bytes value; + // the capacity is ignored. + num uint64 // 8B +} + +func valueOfString(v string) Value { + p := (*stringHeader)(unsafe.Pointer(&v)) + return Value{typ: stringType, ptr: p.Data, num: uint64(len(v))} +} +func valueOfBytes(v []byte) Value { + p := (*sliceHeader)(unsafe.Pointer(&v)) + return Value{typ: bytesType, ptr: p.Data, num: uint64(len(v))} +} +func valueOfIface(v interface{}) Value { + p := (*ifaceHeader)(unsafe.Pointer(&v)) + return Value{typ: p.Type, ptr: p.Data} +} + +func (v Value) getString() (x string) { + *(*stringHeader)(unsafe.Pointer(&x)) = stringHeader{Data: v.ptr, Len: int(v.num)} + return x +} +func (v Value) getBytes() (x []byte) { + *(*sliceHeader)(unsafe.Pointer(&x)) = sliceHeader{Data: v.ptr, Len: int(v.num), Cap: int(v.num)} + return x +} +func (v Value) getIface() (x interface{}) { + *(*ifaceHeader)(unsafe.Pointer(&x)) = ifaceHeader{Type: v.typ, Data: v.ptr} + return x +} diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go new file mode 100644 index 000000000..435470111 --- /dev/null +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go @@ -0,0 +1,87 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !purego && !appengine && go1.21 +// +build !purego,!appengine,go1.21 + +package protoreflect + +import ( + "unsafe" + + "google.golang.org/protobuf/internal/pragma" +) + +type ( + ifaceHeader struct { + _ [0]interface{} // if interfaces have greater alignment than unsafe.Pointer, this will enforce it. + Type unsafe.Pointer + Data unsafe.Pointer + } +) + +var ( + nilType = typeOf(nil) + boolType = typeOf(*new(bool)) + int32Type = typeOf(*new(int32)) + int64Type = typeOf(*new(int64)) + uint32Type = typeOf(*new(uint32)) + uint64Type = typeOf(*new(uint64)) + float32Type = typeOf(*new(float32)) + float64Type = typeOf(*new(float64)) + stringType = typeOf(*new(string)) + bytesType = typeOf(*new([]byte)) + enumType = typeOf(*new(EnumNumber)) +) + +// typeOf returns a pointer to the Go type information. +// The pointer is comparable and equal if and only if the types are identical. +func typeOf(t interface{}) unsafe.Pointer { + return (*ifaceHeader)(unsafe.Pointer(&t)).Type +} + +// value is a union where only one type can be represented at a time. +// The struct is 24B large on 64-bit systems and requires the minimum storage +// necessary to represent each possible type. +// +// The Go GC needs to be able to scan variables containing pointers. +// As such, pointers and non-pointers cannot be intermixed. +type value struct { + pragma.DoNotCompare // 0B + + // typ stores the type of the value as a pointer to the Go type. + typ unsafe.Pointer // 8B + + // ptr stores the data pointer for a String, Bytes, or interface value. + ptr unsafe.Pointer // 8B + + // num stores a Bool, Int32, Int64, Uint32, Uint64, Float32, Float64, or + // Enum value as a raw uint64. + // + // It is also used to store the length of a String or Bytes value; + // the capacity is ignored. + num uint64 // 8B +} + +func valueOfString(v string) Value { + return Value{typ: stringType, ptr: unsafe.Pointer(unsafe.StringData(v)), num: uint64(len(v))} +} +func valueOfBytes(v []byte) Value { + return Value{typ: bytesType, ptr: unsafe.Pointer(unsafe.SliceData(v)), num: uint64(len(v))} +} +func valueOfIface(v interface{}) Value { + p := (*ifaceHeader)(unsafe.Pointer(&v)) + return Value{typ: p.Type, ptr: p.Data} +} + +func (v Value) getString() string { + return unsafe.String((*byte)(v.ptr), v.num) +} +func (v Value) getBytes() []byte { + return unsafe.Slice((*byte)(v.ptr), v.num) +} +func (v Value) getIface() (x interface{}) { + *(*ifaceHeader)(unsafe.Pointer(&x)) = ifaceHeader{Type: v.typ, Data: v.ptr} + return x +} diff --git a/vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.pb.go b/vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.pb.go new file mode 100644 index 000000000..25de5ae00 --- /dev/null +++ b/vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.pb.go @@ -0,0 +1,177 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2023 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: reflect/protodesc/proto/go_features.proto + +package proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" + reflect "reflect" + sync "sync" +) + +type GoFeatures struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Whether or not to generate the deprecated UnmarshalJSON method for enums. + LegacyUnmarshalJsonEnum *bool `protobuf:"varint,1,opt,name=legacy_unmarshal_json_enum,json=legacyUnmarshalJsonEnum" json:"legacy_unmarshal_json_enum,omitempty"` +} + +func (x *GoFeatures) Reset() { + *x = GoFeatures{} + if protoimpl.UnsafeEnabled { + mi := &file_reflect_protodesc_proto_go_features_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GoFeatures) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GoFeatures) ProtoMessage() {} + +func (x *GoFeatures) ProtoReflect() protoreflect.Message { + mi := &file_reflect_protodesc_proto_go_features_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GoFeatures.ProtoReflect.Descriptor instead. +func (*GoFeatures) Descriptor() ([]byte, []int) { + return file_reflect_protodesc_proto_go_features_proto_rawDescGZIP(), []int{0} +} + +func (x *GoFeatures) GetLegacyUnmarshalJsonEnum() bool { + if x != nil && x.LegacyUnmarshalJsonEnum != nil { + return *x.LegacyUnmarshalJsonEnum + } + return false +} + +var file_reflect_protodesc_proto_go_features_proto_extTypes = []protoimpl.ExtensionInfo{ + { + ExtendedType: (*descriptorpb.FeatureSet)(nil), + ExtensionType: (*GoFeatures)(nil), + Field: 1002, + Name: "google.protobuf.go", + Tag: "bytes,1002,opt,name=go", + Filename: "reflect/protodesc/proto/go_features.proto", + }, +} + +// Extension fields to descriptorpb.FeatureSet. +var ( + // optional google.protobuf.GoFeatures go = 1002; + E_Go = &file_reflect_protodesc_proto_go_features_proto_extTypes[0] +) + +var File_reflect_protodesc_proto_go_features_proto protoreflect.FileDescriptor + +var file_reflect_protodesc_proto_go_features_proto_rawDesc = []byte{ + 0x0a, 0x29, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x64, + 0x65, 0x73, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x5f, 0x66, 0x65, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x1a, 0x20, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6a, + 0x0a, 0x0a, 0x47, 0x6f, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x5c, 0x0a, 0x1a, + 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x75, 0x6e, 0x6d, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6c, + 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, + 0x42, 0x1f, 0x88, 0x01, 0x01, 0x98, 0x01, 0x06, 0xa2, 0x01, 0x09, 0x12, 0x04, 0x74, 0x72, 0x75, + 0x65, 0x18, 0xe6, 0x07, 0xa2, 0x01, 0x0a, 0x12, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x18, 0xe7, + 0x07, 0x52, 0x17, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x55, 0x6e, 0x6d, 0x61, 0x72, 0x73, 0x68, + 0x61, 0x6c, 0x4a, 0x73, 0x6f, 0x6e, 0x45, 0x6e, 0x75, 0x6d, 0x3a, 0x49, 0x0a, 0x02, 0x67, 0x6f, + 0x12, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x18, 0xea, 0x07, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x6f, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x73, 0x52, 0x02, 0x67, 0x6f, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2f, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x64, 0x65, 0x73, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, +} + +var ( + file_reflect_protodesc_proto_go_features_proto_rawDescOnce sync.Once + file_reflect_protodesc_proto_go_features_proto_rawDescData = file_reflect_protodesc_proto_go_features_proto_rawDesc +) + +func file_reflect_protodesc_proto_go_features_proto_rawDescGZIP() []byte { + file_reflect_protodesc_proto_go_features_proto_rawDescOnce.Do(func() { + file_reflect_protodesc_proto_go_features_proto_rawDescData = protoimpl.X.CompressGZIP(file_reflect_protodesc_proto_go_features_proto_rawDescData) + }) + return file_reflect_protodesc_proto_go_features_proto_rawDescData +} + +var file_reflect_protodesc_proto_go_features_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_reflect_protodesc_proto_go_features_proto_goTypes = []interface{}{ + (*GoFeatures)(nil), // 0: google.protobuf.GoFeatures + (*descriptorpb.FeatureSet)(nil), // 1: google.protobuf.FeatureSet +} +var file_reflect_protodesc_proto_go_features_proto_depIdxs = []int32{ + 1, // 0: google.protobuf.go:extendee -> google.protobuf.FeatureSet + 0, // 1: google.protobuf.go:type_name -> google.protobuf.GoFeatures + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 1, // [1:2] is the sub-list for extension type_name + 0, // [0:1] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_reflect_protodesc_proto_go_features_proto_init() } +func file_reflect_protodesc_proto_go_features_proto_init() { + if File_reflect_protodesc_proto_go_features_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_reflect_protodesc_proto_go_features_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GoFeatures); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_reflect_protodesc_proto_go_features_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 1, + NumServices: 0, + }, + GoTypes: file_reflect_protodesc_proto_go_features_proto_goTypes, + DependencyIndexes: file_reflect_protodesc_proto_go_features_proto_depIdxs, + MessageInfos: file_reflect_protodesc_proto_go_features_proto_msgTypes, + ExtensionInfos: file_reflect_protodesc_proto_go_features_proto_extTypes, + }.Build() + File_reflect_protodesc_proto_go_features_proto = out.File + file_reflect_protodesc_proto_go_features_proto_rawDesc = nil + file_reflect_protodesc_proto_go_features_proto_goTypes = nil + file_reflect_protodesc_proto_go_features_proto_depIdxs = nil +} diff --git a/vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.proto b/vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.proto new file mode 100644 index 000000000..d24657129 --- /dev/null +++ b/vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.proto @@ -0,0 +1,28 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2023 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +syntax = "proto2"; + +package google.protobuf; + +import "google/protobuf/descriptor.proto"; + +option go_package = "google.golang.org/protobuf/types/gofeaturespb"; + +extend google.protobuf.FeatureSet { + optional GoFeatures go = 1002; +} + +message GoFeatures { + // Whether or not to generate the deprecated UnmarshalJSON method for enums. + optional bool legacy_unmarshal_json_enum = 1 [ + retention = RETENTION_RUNTIME, + targets = TARGET_TYPE_ENUM, + edition_defaults = { edition: EDITION_PROTO2, value: "true" }, + edition_defaults = { edition: EDITION_PROTO3, value: "false" } + ]; +} From c76c3019feab3862bae72d08e5492f4bfc6e28d1 Mon Sep 17 00:00:00 2001 From: Daniel Selans Date: Wed, 13 Mar 2024 22:15:31 -0700 Subject: [PATCH 4/9] kafka integration done --- backends/kafka/relay.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backends/kafka/relay.go b/backends/kafka/relay.go index 651510b7d..0c4584484 100644 --- a/backends/kafka/relay.go +++ b/backends/kafka/relay.go @@ -40,7 +40,7 @@ func (k *Kafka) Relay(ctx context.Context, relayOpts *opts.RelayOptions, relayCh if err != nil { return errors.Wrap(err, "kafka.Relay(): unable to create new streamdal client") } - // TODO: defer sc.Close() ? Why is there no .Close() in the SDK? + // TODO: go-sdk needs to support sc.Close() so we can defer // // streamdal sdk END From 0be5a8b71da5833409fc7c791e147e6e42093f37 Mon Sep 17 00:00:00 2001 From: Daniel Selans Date: Wed, 13 Mar 2024 22:29:06 -0700 Subject: [PATCH 5/9] integrate streamdal sdk into gcp-pubsub --- backends/gcppubsub/relay.go | 50 ++++++++++++++++++++++++++++++++++++- backends/kafka/relay.go | 9 +++++-- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/backends/gcppubsub/relay.go b/backends/gcppubsub/relay.go index b686274fe..8d52afb81 100644 --- a/backends/gcppubsub/relay.go +++ b/backends/gcppubsub/relay.go @@ -2,16 +2,20 @@ package gcppubsub import ( "context" + "fmt" "sync" "time" "cloud.google.com/go/pubsub" "github.com/pkg/errors" + "github.com/sirupsen/logrus" + sdk "github.com/streamdal/streamdal/sdks/go" "github.com/batchcorp/plumber-schemas/build/go/protos/opts" "github.com/batchcorp/plumber-schemas/build/go/protos/records" "github.com/streamdal/plumber/backends/gcppubsub/types" + "github.com/streamdal/plumber/util" "github.com/streamdal/plumber/prometheus" "github.com/streamdal/plumber/validate" @@ -24,6 +28,20 @@ func (g *GCPPubSub) Relay(ctx context.Context, relayOpts *opts.RelayOptions, rel return errors.Wrap(err, "unable to validate relay options") } + llog := g.log.WithFields(logrus.Fields{ + "relay-id": relayOpts.XRelayId, + "backend": "gcp-pubsub", + }) + + // streamdal sdk BEGIN + sc, err := util.SetupStreamdalSDK(relayOpts, llog) + if err != nil { + return errors.Wrap(err, "kafka.Relay(): unable to create new streamdal client") + } + // TODO: go-sdk needs to support sc.Close() so we can defer + // + // streamdal sdk END + var m sync.Mutex var readFunc = func(ctx context.Context, msg *pubsub.Message) { @@ -36,6 +54,32 @@ func (g *GCPPubSub) Relay(ctx context.Context, relayOpts *opts.RelayOptions, rel prometheus.Incr("gcp-pubsub-relay-consumer", 1) + // streamdal sdk BEGIN + // If streamdal integration is enabled, process message via sdk + if sc != nil { + g.log.Debug("Processing message via streamdal SDK") + + resp := sc.Process(ctx, &sdk.ProcessRequest{ + ComponentName: "gcp-pubsub", + OperationType: sdk.OperationTypeConsumer, + OperationName: "relay", + Data: msg.Data, + }) + + if resp.Status == sdk.ExecStatusError { + wrappedErr := fmt.Errorf("unable to process message via streamdal: %v", resp.StatusMessage) + + prometheus.IncrPromCounter("plumber_sdk_errors", 1) + util.WriteError(llog, errorCh, wrappedErr) + + return + } + + // Update msg value with processed data + msg.Data = resp.Data + } + // streamdal sdk END + g.log.Debug("Writing message to relay channel") relayCh <- &types.RelayMessage{ @@ -48,10 +92,12 @@ func (g *GCPPubSub) Relay(ctx context.Context, relayOpts *opts.RelayOptions, rel g.log.Infof("Relaying GCP pubsub messages from '%s' queue -> '%s'", sub.ID(), relayOpts.XStreamdalGrpcAddress) +MAIN: for { select { case <-ctx.Done(): - return nil + llog.Debug("detected context cancellation") + break MAIN default: // NOOP } @@ -72,6 +118,8 @@ func (g *GCPPubSub) Relay(ctx context.Context, relayOpts *opts.RelayOptions, rel } } + llog.Debug("relay exiting") + return nil } diff --git a/backends/kafka/relay.go b/backends/kafka/relay.go index 0c4584484..301a377e4 100644 --- a/backends/kafka/relay.go +++ b/backends/kafka/relay.go @@ -6,6 +6,7 @@ import ( "time" "github.com/pkg/errors" + "github.com/sirupsen/logrus" "github.com/batchcorp/plumber-schemas/build/go/protos/opts" "github.com/batchcorp/plumber-schemas/build/go/protos/records" @@ -44,7 +45,11 @@ func (k *Kafka) Relay(ctx context.Context, relayOpts *opts.RelayOptions, relayCh // // streamdal sdk END - llog := k.log.WithField("relay-id", relayOpts.XRelayId) + llog := k.log.WithFields(logrus.Fields{ + "relay-id": relayOpts.XRelayId, + "backend": "kafka", + "function": "Relay", + }) for { msg, err := reader.ReadMessage(ctx) @@ -104,7 +109,7 @@ func (k *Kafka) Relay(ctx context.Context, relayOpts *opts.RelayOptions, relayCh } } - k.log.Debugf("relayer for '%s' exiting", relayOpts.XRelayId) + llog.Debug("relay exiting") return nil } From dad866333cc6602ec435f523b984d8cb1314d06d Mon Sep 17 00:00:00 2001 From: Mark G Date: Thu, 14 Mar 2024 09:16:45 -0400 Subject: [PATCH 6/9] Bump go-sdk version --- go.mod | 2 +- go.sum | 70 ++++--------------- .../streamdal/streamdal/sdks/go/README.md | 4 +- .../streamdal/streamdal/sdks/go/go_sdk.go | 47 ++++++++++++- .../streamdal/streamdal/sdks/go/register.go | 4 +- vendor/modules.txt | 2 +- 6 files changed, 65 insertions(+), 64 deletions(-) diff --git a/go.mod b/go.mod index e706b3c39..8a9f747d7 100644 --- a/go.mod +++ b/go.mod @@ -66,7 +66,7 @@ require ( github.com/cloudevents/sdk-go/protocol/kafka_sarama/v2 v2.13.0 github.com/cloudevents/sdk-go/protocol/nats/v2 v2.13.0 github.com/cloudevents/sdk-go/v2 v2.13.0 - github.com/streamdal/streamdal/sdks/go v0.1.12 + github.com/streamdal/streamdal/sdks/go v0.1.13 ) require ( diff --git a/go.sum b/go.sum index a2c2e02e2..ecd90f57a 100644 --- a/go.sum +++ b/go.sum @@ -5,24 +5,18 @@ cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6A cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.110.8 h1:tyNdfIxjzaWctIiLYOTalaLKZ17SI44SKFW26QbOhME= -cloud.google.com/go v0.110.8/go.mod h1:Iz8AkXJf1qmxC3Oxoep8R1T36w8B92yU29PcBhHO5fk= cloud.google.com/go v0.111.0 h1:YHLKNupSD1KqjDbQ3+LVdQ81h/UJbJyZG203cEfnQgM= cloud.google.com/go v0.111.0/go.mod h1:0mibmpKP1TyOOFYQY5izo0LnT+ecvOQ0Sg3OdmMiNRU= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= -cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= -cloud.google.com/go/iam v1.1.2 h1:gacbrBdWcoVmGLozRuStX45YKvJtzIjJdAolzUs1sm4= -cloud.google.com/go/iam v1.1.2/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= cloud.google.com/go/iam v1.1.5 h1:1jTsCu4bcsNsE4iiqNT5SHwrDRCfRmIaaaVFhRveTJI= cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXEbzv8= -cloud.google.com/go/kms v1.15.2 h1:lh6qra6oC4AyWe5fUUUBe/S27k12OHAleOOOw6KakdE= +cloud.google.com/go/kms v1.15.5 h1:pj1sRfut2eRbD9pFRjNnPNg/CzJPuQAzUujMIM1vVeM= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.33.0 h1:6SPCPvWav64tj0sVX/+npCBKhUi/UjJehy9op/V3p2g= cloud.google.com/go/pubsub v1.33.0/go.mod h1:f+w71I33OMyxf9VpMVcZbnG5KSUkCOUHYpFd5U1GdRc= @@ -120,8 +114,6 @@ github.com/batchcorp/kong v0.2.17-batch-fix h1:H6sOfst2NcL2T/EZVNLukG7YRimJDHg9D github.com/batchcorp/kong v0.2.17-batch-fix/go.mod h1:ut4pbR4KLPWzKHbpEHZspWpRqjFr4UiPY3D2xf2tzf8= github.com/batchcorp/natty v0.0.16 h1:RN20W2rlA1GtPzY3ioYIjqY0UlIFnH9Rs2c1nWajxcU= github.com/batchcorp/natty v0.0.16/go.mod h1:9vbgoZghKr/2FtueAquAlRacCSnEgfgTSA2eX2gpO54= -github.com/batchcorp/plumber-schemas v0.0.180 h1:eIGaZVMQm/O50KE9eVCX4If3Hyf5Ts/N4ACLvhyiXvM= -github.com/batchcorp/plumber-schemas v0.0.180/go.mod h1:0g9lX0S7Ec7JVa0kzAkJC3gWAFbwIUcK3/VJ0n68KhA= github.com/batchcorp/plumber-schemas v0.0.185 h1:9fMpw1pr1nVgQW1FIrGNPxK83nizgIE3E/H3pEJiG30= github.com/batchcorp/plumber-schemas v0.0.185/go.mod h1:gs6JhcCX29FLplmxzqEMns9g4ks+avrIbEzuW4uZHGI= github.com/batchcorp/plz v0.9.2 h1:bPqb+sn7OUrpHjeTEI9YO4BJS9IQ7AstDDz2gn+tcn8= @@ -160,11 +152,7 @@ github.com/cloudevents/sdk-go/v2 v2.13.0 h1:2zxDS8RyY1/wVPULGGbdgniGXSzLaRJVl136 github.com/cloudevents/sdk-go/v2 v2.13.0/go.mod h1:xDmKfzNjM8gBvjaF8ijFjM1VYOVUEeUfapHMUX1T5To= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= @@ -206,7 +194,6 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.12.0 h1:mRhaKNwANqRgUBGKmnI5ZxEk7QXmjQeCcuYFMX2bfcc= @@ -239,6 +226,8 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.0 h1:wx+BduGRXjIL6VPeeb7DRX+ii7sR/ch8DlRifHR589o= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= @@ -258,6 +247,7 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me github.com/go-stomp/stomp v2.1.4+incompatible h1:D3SheUVDOz9RsjVWkoh/1iCOwD0qWjyeTZMUZ0EXg2Y= github.com/go-stomp/stomp v2.1.4+incompatible/go.mod h1:VqCtqNZv1226A1/79yh+rMiFUcfY3R109np+7ke4n0c= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY= github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg= @@ -324,8 +314,6 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -347,8 +335,6 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -356,18 +342,13 @@ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXi github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20231212022811-ec68065c825e h1:bwOy7hAFd0C91URzMIEBfr6BAz29yk7Qj0cy6S7DJlU= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= -github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.2.4 h1:uGy6JWR/uMIILU8wbf+OkstIrNiMjGpEIyhx8f6W7s4= -github.com/googleapis/enterprise-certificate-proxy v0.2.4/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= @@ -605,8 +586,8 @@ github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042 github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= -github.com/onsi/ginkgo/v2 v2.1.6 h1:Fx2POJZfKRQcM1pH49qSZiYeu319wji004qX+GDovrU= github.com/onsi/ginkgo/v2 v2.1.6/go.mod h1:MEH45j8TBi6u9BMogfbp0stKC5cdGjumZj5Y7AG4VIk= +github.com/onsi/ginkgo/v2 v2.13.2 h1:Bi2gGVkfn6gQcjNjZJVO8Gf0FHzMPf2phUei9tejVMs= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.10.2/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= @@ -616,7 +597,6 @@ github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAl github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= -github.com/onsi/gomega v1.20.2 h1:8uQq0zMgLEfa0vRrrBgaJF2gyW9Da9BmfGV+OyUzfkY= github.com/onsi/gomega v1.20.2/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc= github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= @@ -726,8 +706,8 @@ github.com/streamdal/pgoutput v0.3.3 h1:4XLuGQFzmMFQd4U/zy1X5lMICXduHp8vG7FlbYpU github.com/streamdal/pgoutput v0.3.3/go.mod h1:19V8kXi7a88guhXqvNpL2HH7sbnCYk0i93H4Q2i5iUA= github.com/streamdal/streamdal/libs/protos v0.1.29 h1:0kMKUB+r85Z+vqXqkamezL+cMP4Y5mGkeXEdBwHaUG0= github.com/streamdal/streamdal/libs/protos v0.1.29/go.mod h1:1rQ250ydoKeRoJftIV9qGrR28Iqdb9+7Jcnoxber/eQ= -github.com/streamdal/streamdal/sdks/go v0.1.12 h1:+ThTwfcwb3foBDDce56KBGedpBSs+ZsOo10IVR98g3A= -github.com/streamdal/streamdal/sdks/go v0.1.12/go.mod h1:kxKv5WKSjEFDMAa/z1ni/m3RonHGLEmOggpEXvoVZ+c= +github.com/streamdal/streamdal/sdks/go v0.1.13 h1:xepqeFbjbq7Ud4TJgruppkFsmR9jcAvnpvUv5PmKRFU= +github.com/streamdal/streamdal/sdks/go v0.1.13/go.mod h1:kxKv5WKSjEFDMAa/z1ni/m3RonHGLEmOggpEXvoVZ+c= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= @@ -800,7 +780,11 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/otel v1.6.3/go.mod h1:7BgNga5fNlF/iZjG06hM3yofffp0ofKCDwSXx1GC4dI= +go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= +go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE= +go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o= go.opentelemetry.io/otel/trace v1.6.3/go.mod h1:GNJQusJlUgZl9/TQBPKU/Y/ty+0iVB5fjhKeJGZPGFs= +go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -831,10 +815,7 @@ golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211115234514-b4de73f9ece8/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= -golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -861,8 +842,6 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -902,8 +881,6 @@ golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220725212005-46097bf591d3/go.mod h1:AaygXjzTFtRAg2ttMY5RMuhpJ3cNnI0XpyFJD1iQRSM= -golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos= -golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -924,8 +901,6 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= -golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -981,14 +956,10 @@ golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= -golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1006,7 +977,6 @@ golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1045,8 +1015,6 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1058,8 +1026,6 @@ google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.128.0 h1:RjPESny5CnQRn9V6siglged+DZCgfu9l6mO9dkX9VOg= -google.golang.org/api v0.128.0/go.mod h1:Y611qgqaE92On/7g65MQgxYul3c0rEB894kniWLY750= google.golang.org/api v0.149.0 h1:b2CqT6kG+zqJIVKRQ3ELJVLN1PwHZ6DJ3dW8yl82rgY= google.golang.org/api v0.149.0/go.mod h1:Mwn1B7JTXrzXtnvmzQE2BD6bYZQ8DShKZDZbeN9I7qI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= @@ -1079,16 +1045,10 @@ google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBr google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 h1:SeZZZx0cP0fqUyA+oRzP9k7cSwJlvDFiROO72uwD6i0= -google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97/go.mod h1:t1VqOqqvce95G3hIDCT5FeO3YUc6Q4Oe24L/+rNMxRk= google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 h1:nz5NESFLZbJGPFxDT/HCn+V1mZ8JGNoY4nUpmW/Y2eg= google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917/go.mod h1:pZqR+glSb11aJ+JQcczCvgf47+duRuzNSKqE8YAQnV0= -google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1:W18sezcAYs+3tDZX4F80yctqa12jcP1PUS2gQu1zTPU= -google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0= google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 h1:s1w3X6gQxwrLEpxnLd/qXTVLgQE2yXwaOaoa6IlY/+o= google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0/go.mod h1:CAny0tYF+0/9rmDB9fahA9YLzX3+AEVl1qXbv5hhj6c= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac h1:nUQEQmH/csSvFECKYRv6HWEyypysidKl2I6Qpsglq/0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -1102,9 +1062,6 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= -google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= -google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -1123,9 +1080,6 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/README.md b/vendor/github.com/streamdal/streamdal/sdks/go/README.md index f51671c9a..b89fae36e 100644 --- a/vendor/github.com/streamdal/streamdal/sdks/go/README.md +++ b/vendor/github.com/streamdal/streamdal/sdks/go/README.md @@ -1,7 +1,7 @@ Streamdal Go SDK ================ [![Release](https://github.com/streamdal/streamdal/actions/workflows/sdks-go-release.yml/badge.svg)](https://github.com/streamdal/streamdal/actions/workflows/sdks-go-release.yml) -[![Pull Request](https://github.com/streamdal/streamdal/actions/workflows/sdks-go-detective-pr.yml/badge.svg)](https://github.com/streamdal/streamdal/blob/main/.github/workflows/sdks-go-detective-pr.yml) +[![Pull Request](https://github.com/streamdal/streamdal/actions/workflows/sdks-go-pr.yml/badge.svg)](https://github.com/streamdal/streamdal/blob/main/.github/workflows/sdks-go-pr.yml) [![Discord](https://img.shields.io/badge/Community-Discord-4c57e8.svg)](https://discord.gg/streamdal) @@ -93,7 +93,7 @@ order to support 12-Factor and usage of this SDK inside shims where `streamdal.C | DryRun | STREAMDAL_DRY_RUN | If true, no data will be modified | *false* | | Logger | | An optional custom logger | | | ClientType | | 1 = ClientTypeSDK, 2 = ClientTypeShim | ClientTypeSDK | -| ShutdownCtx | - | Your application's main context which will receive shutdown signals | | +| ShutdownCtx | - | Optional context used by lib to detect shutdowns | *empty* | ### Metrics diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/go_sdk.go b/vendor/github.com/streamdal/streamdal/sdks/go/go_sdk.go index c44840ce8..d98f63cf1 100644 --- a/vendor/github.com/streamdal/streamdal/sdks/go/go_sdk.go +++ b/vendor/github.com/streamdal/streamdal/sdks/go/go_sdk.go @@ -94,11 +94,19 @@ var ( // ErrPipelineTimeout is returned when a pipeline exceeds the configured timeout ErrPipelineTimeout = errors.New("pipeline timeout exceeded") + + // ErrClosedClient is returned when .Process() is called after .Close() + ErrClosedClient = errors.New("client is closed") ) type IStreamdal interface { // Process is used to run data pipelines against data Process(ctx context.Context, req *ProcessRequest) *ProcessResponse + + // Close should be called when streamdal client is no longer being used; + // will stop all active goroutines and clean up resources; client should NOT + // be re-used after Close() is called. + Close() } // Streamdal is the main struct for this library @@ -121,6 +129,11 @@ type Streamdal struct { pausedTails map[string]map[string]*Tail // k1: audienceStr k2: tailID schemas map[string]*protos.Schema // k: audienceStr schemasMtx *sync.RWMutex + cancelFunc context.CancelFunc + + // Set to true when .Close() is called; used to prevent calling .Process() + // when library instance is stopped. + closed bool } type Config struct { @@ -158,7 +171,8 @@ type Config struct { DryRun bool // ShutdownCtx is a context that the library will listen to for cancellation - // notices. Required + // notices. Upon cancelling this context, SDK will stop all active goroutines + // and free up all used resources. Optional; default: nil ShutdownCtx context.Context // Logger is a logger you can inject (such as logrus) to allow this library @@ -206,8 +220,14 @@ func New(cfg *Config) (*Streamdal, error) { return nil, nil } + // Derive a new cancellable context from the provided shutdown context. We + // do this so that .Close() can cancel all running goroutines. + ctx, cancelFunc := context.WithCancel(cfg.ShutdownCtx) + cfg.ShutdownCtx = ctx + serverClient, err := server.New(cfg.ServerURL, cfg.ServerToken) if err != nil { + cancelFunc() return nil, errors.Wrapf(err, "failed to connect to streamdal serverĀ© '%s'", cfg.ServerURL) } @@ -217,6 +237,7 @@ func New(cfg *Config) (*Streamdal, error) { Log: cfg.Logger, }) if err != nil { + cancelFunc() return nil, errors.Wrap(err, "failed to start metrics service") } @@ -224,11 +245,13 @@ func New(cfg *Config) (*Streamdal, error) { Logger: cfg.Logger, }) if err != nil { + cancelFunc() return nil, errors.Wrap(err, "failed to start kv service") } hf, err := hostfunc.New(kvInstance, cfg.Logger) if err != nil { + cancelFunc() return nil, errors.Wrap(err, "failed to create hostfunc instance") } @@ -251,6 +274,7 @@ func New(cfg *Config) (*Streamdal, error) { pausedTails: make(map[string]map[string]*Tail), schemasMtx: &sync.RWMutex{}, schemas: make(map[string]*protos.Schema), + cancelFunc: cancelFunc, } if cfg.DryRun { @@ -273,6 +297,7 @@ func New(cfg *Config) (*Streamdal, error) { // Start heartbeat go s.heartbeat(director.NewTimedLooper(director.FOREVER, time.Second, make(chan error, 1))) + // Watch for shutdown so we can properly stop tails go s.watchForShutdown() // Make sure we were able to start without issues @@ -284,6 +309,11 @@ func New(cfg *Config) (*Streamdal, error) { } } +func (s *Streamdal) Close() { + s.cancelFunc() + s.closed = true +} + func validateConfig(cfg *Config) error { if cfg == nil { return ErrEmptyConfig @@ -390,6 +420,11 @@ func (s *Streamdal) watchForShutdown() { tail.CancelFunc() } } + + // Stop this instance from being used again + s.closed = true + + s.config.Logger.Debug("watchForShutdown() exit") } func (s *Streamdal) pullInitialPipelines(ctx context.Context) error { @@ -458,6 +493,8 @@ func (s *Streamdal) heartbeat(loop *director.TimedLooper) { return nil }) + + s.config.Logger.Debug("heartbeat() exit") } func (s *Streamdal) runStep(ctx context.Context, aud *protos.Audience, step *protos.PipelineStep, data []byte, isr *protos.InterStepResult) (*protos.WASMResponse, error) { @@ -552,6 +589,14 @@ func newAudience(req *ProcessRequest, cfg *Config) *protos.Audience { } func (s *Streamdal) Process(ctx context.Context, req *ProcessRequest) *ProcessResponse { + if s.closed { + return &ProcessResponse{ + Data: req.Data, + Status: ExecStatusError, + StatusMessage: proto.String(ErrClosedClient.Error()), + } + } + resp := &ProcessResponse{ PipelineStatus: make([]*protos.PipelineStatus, 0), Metadata: make(map[string]string), diff --git a/vendor/github.com/streamdal/streamdal/sdks/go/register.go b/vendor/github.com/streamdal/streamdal/sdks/go/register.go index ebc3119a1..29bee60ab 100644 --- a/vendor/github.com/streamdal/streamdal/sdks/go/register.go +++ b/vendor/github.com/streamdal/streamdal/sdks/go/register.go @@ -19,7 +19,7 @@ func (s *Streamdal) genClientInfo() *protos.ClientInfo { return &protos.ClientInfo{ ClientType: protos.ClientType(s.config.ClientType), LibraryName: "go-sdk", - LibraryVersion: "0.1.12", + LibraryVersion: "0.1.13", Language: "go", Arch: runtime.GOARCH, Os: runtime.GOOS, @@ -161,6 +161,8 @@ func (s *Streamdal) register(looper director.Looper) error { ) } + s.config.Logger.Debug("register() exit") + return nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index 4f3f571dd..fe0fa9bbb 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -723,7 +723,7 @@ github.com/streamdal/pgoutput github.com/streamdal/streamdal/libs/protos/build/go/protos github.com/streamdal/streamdal/libs/protos/build/go/protos/shared github.com/streamdal/streamdal/libs/protos/build/go/protos/steps -# github.com/streamdal/streamdal/sdks/go v0.1.12 +# github.com/streamdal/streamdal/sdks/go v0.1.13 ## explicit; go 1.19 github.com/streamdal/streamdal/sdks/go github.com/streamdal/streamdal/sdks/go/helper From a6db789743ad2f8ad771adebd3caaebe796160bd Mon Sep 17 00:00:00 2001 From: Mark G Date: Thu, 14 Mar 2024 11:15:13 -0400 Subject: [PATCH 7/9] Bump to go1.20 --- .github/workflows/pr-test.yaml | 2 +- .github/workflows/release.yaml | 2 +- Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-test.yaml b/.github/workflows/pr-test.yaml index 94a37a35f..493c2ee8b 100644 --- a/.github/workflows/pr-test.yaml +++ b/.github/workflows/pr-test.yaml @@ -34,7 +34,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: '~1.18' # The Go version to download (if necessary) and use. + go-version: '~1.20' # The Go version to download (if necessary) and use. - name: Start up dependencies run: docker-compose up -d - name: Wait for dependencies to start up diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 86df2d1e3..202010ea7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -15,7 +15,7 @@ jobs: uses: docker/setup-buildx-action@v2 - uses: actions/setup-go@v2 with: - go-version: '^1.15.4' # The Go version to download (if necessary) and use. + go-version: '^1.20.0' # The Go version to download (if necessary) and use. - name: Set tag run: echo "GITHUB_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - name: Set short sha diff --git a/Dockerfile b/Dockerfile index e281b43c5..9189544fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # This Dockerfile utilizes a multi-stage builds ARG ALPINE_VERSION=3.14 -FROM golang:1.18-alpine$ALPINE_VERSION AS builder +FROM golang:1.20-alpine$ALPINE_VERSION AS builder ARG TARGETARCH ARG TARGETOS From d6135288ac5f73f1e94d3a7f4af8381c0aeda478 Mon Sep 17 00:00:00 2001 From: Daniel Selans Date: Thu, 14 Mar 2024 10:14:38 -0700 Subject: [PATCH 8/9] defer sc.Close() --- backends/gcppubsub/relay.go | 3 +-- backends/kafka/relay.go | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/backends/gcppubsub/relay.go b/backends/gcppubsub/relay.go index 8d52afb81..08ed293c7 100644 --- a/backends/gcppubsub/relay.go +++ b/backends/gcppubsub/relay.go @@ -38,8 +38,7 @@ func (g *GCPPubSub) Relay(ctx context.Context, relayOpts *opts.RelayOptions, rel if err != nil { return errors.Wrap(err, "kafka.Relay(): unable to create new streamdal client") } - // TODO: go-sdk needs to support sc.Close() so we can defer - // + defer sc.Close() // streamdal sdk END var m sync.Mutex diff --git a/backends/kafka/relay.go b/backends/kafka/relay.go index 301a377e4..ab9d0f2d3 100644 --- a/backends/kafka/relay.go +++ b/backends/kafka/relay.go @@ -41,8 +41,7 @@ func (k *Kafka) Relay(ctx context.Context, relayOpts *opts.RelayOptions, relayCh if err != nil { return errors.Wrap(err, "kafka.Relay(): unable to create new streamdal client") } - // TODO: go-sdk needs to support sc.Close() so we can defer - // + defer sc.Close() // streamdal sdk END llog := k.log.WithFields(logrus.Fields{ From eb7ef211cbedfc9a373e7d3f8c07fb4e203a6ef9 Mon Sep 17 00:00:00 2001 From: Daniel Selans Date: Thu, 14 Mar 2024 10:35:42 -0700 Subject: [PATCH 9/9] commenting close --- backends/gcppubsub/relay.go | 2 +- backends/kafka/relay.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backends/gcppubsub/relay.go b/backends/gcppubsub/relay.go index 08ed293c7..7888f7198 100644 --- a/backends/gcppubsub/relay.go +++ b/backends/gcppubsub/relay.go @@ -38,7 +38,7 @@ func (g *GCPPubSub) Relay(ctx context.Context, relayOpts *opts.RelayOptions, rel if err != nil { return errors.Wrap(err, "kafka.Relay(): unable to create new streamdal client") } - defer sc.Close() + // defer sc.Close() // streamdal sdk END var m sync.Mutex diff --git a/backends/kafka/relay.go b/backends/kafka/relay.go index ab9d0f2d3..179d46c05 100644 --- a/backends/kafka/relay.go +++ b/backends/kafka/relay.go @@ -41,7 +41,7 @@ func (k *Kafka) Relay(ctx context.Context, relayOpts *opts.RelayOptions, relayCh if err != nil { return errors.Wrap(err, "kafka.Relay(): unable to create new streamdal client") } - defer sc.Close() + // defer sc.Close() // streamdal sdk END llog := k.log.WithFields(logrus.Fields{