diff --git a/README.md b/README.md index 8839b94..e2075ba 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,65 @@ -# liftbridge-grpc +Liftbridge API +============== -Protobuf definitions for the [Liftbridge](https://github.com/liftbridge-io/liftbridge) gRPC API. +This repository contains the public API definitions for +[Liftbridge](https://github.com/liftbridge-io/liftbridge). It is primarily intended for +Liftbridge client developers. + +## gRPC API + +The client-facing gRPC API is defined in [api.fbs](api.fbs). + +## Direct NATS API + +It is also possible for a client to publish messages to Liftbridge via NATS directly. +Liftbridge accepts plain NATS messages, allowing it to make existing subjects durable +without any publisher changes. However, these messages will not have some features such +as acks. + +In order to opt into Liftbridge-specific features, the message must be prefixed with the +following header and be encoded as a `PublishRequest` (defined in +[api.fbs](api.fbs)). + +### Liftbridge Envelope Header + +``` +0 8 16 24 32 +├───────────────┴───────────────┴───────────────┴───────────────┤ +│ Magic Number │ +├───────────────┬───────────────┬───────────────┬───────────────┤ +│ Version │ HeaderLen │ Flags │ Reserved │ +├───────────────┴───────────────┴───────────────┴───────────────┤ +│ CRC-32C (optional) │ +└───────────────────────────────────────────────────────────────┘ +``` + + +#### Magic number [4 bytes] + +The Liftbridge magic number is `B9 0E 43 B4`. This was chosen by random but deliberately +restricted to invalid UTF-8 to reduce the chance of a collision. This was also verified +to not match known file signatures. + +#### Version [1 byte] + +The version byte allows for future protocol upgrades. This should only be bumped if the +envelope format changes or if the message encoding changes in a non-backwards-compatible +way. Adding fields to the messages should not require a version bump. + +#### HeaderLen [1 byte] + +The header length is the offset of the payload. This is included primarily for safety. + +#### Flags [1 byte] + +The flag bits are defined as follows: + +| Bit | Description | +| --- | --------------- | +| 0 | CRC-32C enabled | + +#### CRC-32C [4 bytes, optional] + +The CRC-32C (Castagnoli) is the checksum of the payload (i.e. from HeaderLen to the +end). This is optional but should significantly reduce the chance that a random NATS +message is interpreted as a Liftbridge message. diff --git a/api.fbs b/api.fbs new file mode 100644 index 0000000..61a7263 --- /dev/null +++ b/api.fbs @@ -0,0 +1,140 @@ +namespace proto; + +table MessageHeader { + key : string (id: 0); + value : [ubyte] (id: 1); +} + +// Message is the core immutable unit that is propagated/stored. +table Message { + value : [ubyte] (id: 0); + key : [ubyte] (id: 1); // Message key used for log compaction + reply : string (id: 2); // NATS subject to reply to + headers : [MessageHeader] (id: 3); // Message headers + subject : string (id: 4); // NATS subject message was received on + offset : int64 (id: 5); // Monotonic message offset in the stream +} + +table CreateStreamRequest { + subject : string (id: 0); // NATS subject to attach to + stream : string (id: 1); // Stream name (unique per subject) + group : string (id: 2); // Partitions NATS subject amongst group members + replicationFactor : int32 (id: 3); // Number of stream replicas (-1 to replicate to the entire cluster) + partitions : uint32 (id: 4); // Number of stream partitions +} + +table CreateStreamResponse { +} + +// AckPolicy controls the behavior of message acknowledgements. +enum AckPolicy : uint8 { + LEADER = 0, // The ack will be sent once the leader has written the message to its log + ALL = 1, // The ack will be sent after the ISR replicas have written the message to their logs + NONE = 2, // No ack will be sent +} + +// PublishRequest is used for both gRPC Publish requests as well as direct NATS +// publishes (see the README for the envelope format). +table PublishRequest { + message : [ubyte] (id: 0, nested_flatbuffer: "Message"); + correlationId : [ubyte] (id: 1); // User-supplied id to correlate acks to publishes + ackInbox : string (id: 2); // NATS subject to publish acks to + ackPolicy : AckPolicy (id: 3); // Controls the behavior of acks +} + +table PublishResponse { + ack : Ack (id: 0); // The ack for the published message if AckPolicy was not NONE +} + +// Ack represents an acknowledgement that a message was committed to a stream partition. +table Ack { + correlationId : [ubyte] (id: 0); // User-supplied value from the message + stream : string (id: 1); // Name of the stream + partitionSubject : string (id: 2); // NATS subject the partition is attached to + msgSubject : string (id: 3); // NATS subject the message was received on + offset : int64 (id: 4); // Stream offset the message was committed to + ackInbox : string (id: 5); // NATS subject to publish acks to + ackPolicy : AckPolicy (id: 6); // The AckPolicy sent on the message +} + +enum StartPosition : uint8 { + NEW_ONLY = 0, // Start at new messages after the latest + OFFSET = 1, // Start at a specified offset + EARLIEST = 2, // Start at the oldest message + LATEST = 3, // Start at the newest message + TIMESTAMP = 4, // Start at a specified (ack) timestamp +} + +table SubscribeRequest { + stream : string (id: 0); // Stream name to subscribe to + partitionId : uint32 (id: 1); // Stream partition to subscribe to + startPosition : StartPosition (id: 2); // Where to begin consuming from + startOffset : int64 (id: 3); // Offset to begin consuming from + startTimestamp : int64 (id: 4); // Timestamp to begin consuming from +} + +table StreamMessage { + message : [ubyte] (id: 0, nested_flatbuffer: "Message"); + subject : string (id: 1); // NATS subject message was received on + offset : int64 (id: 2); // Monotonic message offset in the stream + timestamp : int64 (id: 3); // When the message was received by the broker +} + +table Broker { + id : string (id: 0); // Broker id + host : string (id: 1); // Broker host + port : int32 (id: 2); // Broker port +} + +// PartitionMetadata contains information for a stream partition. +table PartitionMetadata { + id : uint32 (id: 0); // Partition id + leader : string (id: 1); // Broker id of the partition leader + replicas : [string] (id: 2); // Broker ids of the partition replicas + isr : [string] (id: 3); // Broker ids of the in-sync replica set +} + +enum StreamError : uint8 { + OK = 0, + UNKNOWN_STREAM = 1, +} + +table StreamMetadata { + stream : string (id: 0); + subject : string (id: 1); // NATS subject the stream is attached to + error : StreamError (id: 2); // Indicates if there was something wrong with the requested stream + partitions : [PartitionMetadata] (id: 3); // Information for the stream partitions +} + +table FetchMetadataRequest { + streams : [string] (id: 0); // The streams to fetch metadata for (all if empty) +} + +table FetchMetadataResponse { + brokers : [Broker] (id: 0); + metadata : [StreamMetadata] (id: 1); +} + +// API is the main Liftbridge server interface clients interact with. +rpc_service API { + // CreateStream creates a new stream attached to a NATS subject. It returns + // an AlreadyExists status code if a stream with the given subject and name + // already exists. + CreateStream(CreateStreamRequest) : CreateStreamResponse; + + // FetchMetadata retrieves the latest cluster metadata, including stream + // broker information. + FetchMetadata(FetchMetadataRequest) : FetchMetadataResponse; + + // Publish a new message to a subject. If the AckPolicy is not NONE and a + // deadline is provided, this will synchronously block until the ack is + // received. If the ack is not received in time, a DeadlineExceeded status + // code is returned. + Publish(PublishRequest) : PublishResponse; + + // Subscribe creates an ephemeral subscription for the given stream. It + // begins to receive messages starting at the given offset and waits for + // new messages when it reaches the end of the stream. Use the request + // context to close the subscription. + Subscribe(SubscribeRequest) : StreamMessage (streaming: "server"); +} diff --git a/go/API_grpc.go b/go/API_grpc.go new file mode 100644 index 0000000..298fe0e --- /dev/null +++ b/go/API_grpc.go @@ -0,0 +1,189 @@ +//Generated by gRPC Go plugin +//If you make any local changes, they will be lost +//source: api + +package proto + +import ( + context "context" + grpc "google.golang.org/grpc" +) + +// Client API for API service +type APIClient interface{ + CreateStream(ctx context.Context, in *CreateStreamRequest, + opts... grpc.CallOption) (* CreateStreamResponse, error) + Subscribe(ctx context.Context, in *SubscribeRequest, + opts... grpc.CallOption) (API_SubscribeClient, error) + FetchMetadata(ctx context.Context, in *FetchMetadataRequest, + opts... grpc.CallOption) (* FetchMetadataResponse, error) + Publish(ctx context.Context, in *PublishRequest, + opts... grpc.CallOption) (* PublishResponse, error) +} + +type aPIClient struct { + cc *grpc.ClientConn +} + +func NewAPIClient(cc *grpc.ClientConn) APIClient { + return &aPIClient{cc} +} + +func (c *aPIClient) CreateStream(ctx context.Context, in *CreateStreamRequest, + opts... grpc.CallOption) (* CreateStreamResponse, error) { + out := new(CreateStreamResponse) + err := grpc.Invoke(ctx, "/proto.API/CreateStream", in, out, c.cc, opts...) + if err != nil { return nil, err } + return out, nil +} + +func (c *aPIClient) Subscribe(ctx context.Context, in *SubscribeRequest, + opts... grpc.CallOption) (API_SubscribeClient, error) { + stream, err := grpc.NewClientStream(ctx, &_API_serviceDesc.Streams[0], c.cc, "/proto.API/Subscribe", opts...) + if err != nil { return nil, err } + x := &aPISubscribeClient{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 API_SubscribeClient interface { + Recv() (*Message, error) + grpc.ClientStream +} + +type aPISubscribeClient struct{ + grpc.ClientStream +} + +func (x *aPISubscribeClient) Recv() (*Message, error) { + m := new(Message) + if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } + return m, nil +} + +func (c *aPIClient) FetchMetadata(ctx context.Context, in *FetchMetadataRequest, + opts... grpc.CallOption) (* FetchMetadataResponse, error) { + out := new(FetchMetadataResponse) + err := grpc.Invoke(ctx, "/proto.API/FetchMetadata", in, out, c.cc, opts...) + if err != nil { return nil, err } + return out, nil +} + +func (c *aPIClient) Publish(ctx context.Context, in *PublishRequest, + opts... grpc.CallOption) (* PublishResponse, error) { + out := new(PublishResponse) + err := grpc.Invoke(ctx, "/proto.API/Publish", in, out, c.cc, opts...) + if err != nil { return nil, err } + return out, nil +} + +// Server API for API service +type APIServer interface { + CreateStream(context.Context, *CreateStreamRequest) (*CreateStreamResponse, error) + Subscribe(*SubscribeRequest, API_SubscribeServer) error + FetchMetadata(context.Context, *FetchMetadataRequest) (*FetchMetadataResponse, error) + Publish(context.Context, *PublishRequest) (*PublishResponse, error) +} + +func RegisterAPIServer(s *grpc.Server, srv APIServer) { + s.RegisterService(&_API_serviceDesc, srv) +} + +func _API_CreateStream_Handler(srv interface{}, ctx context.Context, + dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateStreamRequest) + if err := dec(in); err != nil { return nil, err } + if interceptor == nil { return srv.(APIServer).CreateStream(ctx, in) } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto.API/CreateStream", + } + + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(APIServer).CreateStream(ctx, req.(* CreateStreamRequest)) + } + return interceptor(ctx, in, info, handler) +} + + +func _API_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(SubscribeRequest) + if err := stream.RecvMsg(m); err != nil { return err } + return srv.(APIServer).Subscribe(m, &aPISubscribeServer{stream}) +} + +type API_SubscribeServer interface { + Send(* Message) error + grpc.ServerStream +} + +type aPISubscribeServer struct { + grpc.ServerStream +} + +func (x *aPISubscribeServer) Send(m *Message) error { + return x.ServerStream.SendMsg(m) +} + + +func _API_FetchMetadata_Handler(srv interface{}, ctx context.Context, + dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FetchMetadataRequest) + if err := dec(in); err != nil { return nil, err } + if interceptor == nil { return srv.(APIServer).FetchMetadata(ctx, in) } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto.API/FetchMetadata", + } + + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(APIServer).FetchMetadata(ctx, req.(* FetchMetadataRequest)) + } + return interceptor(ctx, in, info, handler) +} + + +func _API_Publish_Handler(srv interface{}, ctx context.Context, + dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PublishRequest) + if err := dec(in); err != nil { return nil, err } + if interceptor == nil { return srv.(APIServer).Publish(ctx, in) } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto.API/Publish", + } + + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(APIServer).Publish(ctx, req.(* PublishRequest)) + } + return interceptor(ctx, in, info, handler) +} + + +var _API_serviceDesc = grpc.ServiceDesc{ + ServiceName: "proto.API", + HandlerType: (*APIServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateStream", + Handler: _API_CreateStream_Handler, + }, + { + MethodName: "FetchMetadata", + Handler: _API_FetchMetadata_Handler, + }, + { + MethodName: "Publish", + Handler: _API_Publish_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Subscribe", + Handler: _API_Subscribe_Handler, + ServerStreams: true, + }, + }, +} + diff --git a/go/api.pb.go b/go/api.pb.go deleted file mode 100644 index 490b44e..0000000 --- a/go/api.pb.go +++ /dev/null @@ -1,3710 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: api.proto - -/* - Package proto is a generated protocol buffer package. - - It is generated from these files: - api.proto - - It has these top-level messages: - CreateStreamRequest - CreateStreamResponse - SubscribeRequest - FetchMetadataRequest - FetchMetadataResponse - PublishRequest - PublishResponse - Broker - StreamMetadata - PartitionMetadata - Message - Ack -*/ -package proto - -import proto1 "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -import context "golang.org/x/net/context" -import grpc "google.golang.org/grpc" - -import io "io" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto1.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 _ = proto1.ProtoPackageIsVersion2 // please upgrade the proto package - -// StartPosition determines the start-position type on a subscription. -type StartPosition int32 - -const ( - StartPosition_NEW_ONLY StartPosition = 0 - StartPosition_OFFSET StartPosition = 1 - StartPosition_EARLIEST StartPosition = 2 - StartPosition_LATEST StartPosition = 3 - StartPosition_TIMESTAMP StartPosition = 4 -) - -var StartPosition_name = map[int32]string{ - 0: "NEW_ONLY", - 1: "OFFSET", - 2: "EARLIEST", - 3: "LATEST", - 4: "TIMESTAMP", -} -var StartPosition_value = map[string]int32{ - "NEW_ONLY": 0, - "OFFSET": 1, - "EARLIEST": 2, - "LATEST": 3, - "TIMESTAMP": 4, -} - -func (x StartPosition) String() string { - return proto1.EnumName(StartPosition_name, int32(x)) -} -func (StartPosition) EnumDescriptor() ([]byte, []int) { return fileDescriptorApi, []int{0} } - -// AckPolicy controls the behavior of message acknowledgements. -type AckPolicy int32 - -const ( - AckPolicy_LEADER AckPolicy = 0 - AckPolicy_ALL AckPolicy = 1 - AckPolicy_NONE AckPolicy = 2 -) - -var AckPolicy_name = map[int32]string{ - 0: "LEADER", - 1: "ALL", - 2: "NONE", -} -var AckPolicy_value = map[string]int32{ - "LEADER": 0, - "ALL": 1, - "NONE": 2, -} - -func (x AckPolicy) String() string { - return proto1.EnumName(AckPolicy_name, int32(x)) -} -func (AckPolicy) EnumDescriptor() ([]byte, []int) { return fileDescriptorApi, []int{1} } - -type StreamMetadata_Error int32 - -const ( - StreamMetadata_OK StreamMetadata_Error = 0 - StreamMetadata_UNKNOWN_STREAM StreamMetadata_Error = 1 -) - -var StreamMetadata_Error_name = map[int32]string{ - 0: "OK", - 1: "UNKNOWN_STREAM", -} -var StreamMetadata_Error_value = map[string]int32{ - "OK": 0, - "UNKNOWN_STREAM": 1, -} - -func (x StreamMetadata_Error) String() string { - return proto1.EnumName(StreamMetadata_Error_name, int32(x)) -} -func (StreamMetadata_Error) EnumDescriptor() ([]byte, []int) { return fileDescriptorApi, []int{8, 0} } - -// CreateStreamRequest is sent to create a new stream. -type CreateStreamRequest struct { - Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Group string `protobuf:"bytes,3,opt,name=group,proto3" json:"group,omitempty"` - ReplicationFactor int32 `protobuf:"varint,4,opt,name=replicationFactor,proto3" json:"replicationFactor,omitempty"` - Partitions int32 `protobuf:"varint,5,opt,name=partitions,proto3" json:"partitions,omitempty"` -} - -func (m *CreateStreamRequest) Reset() { *m = CreateStreamRequest{} } -func (m *CreateStreamRequest) String() string { return proto1.CompactTextString(m) } -func (*CreateStreamRequest) ProtoMessage() {} -func (*CreateStreamRequest) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{0} } - -func (m *CreateStreamRequest) GetSubject() string { - if m != nil { - return m.Subject - } - return "" -} - -func (m *CreateStreamRequest) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *CreateStreamRequest) GetGroup() string { - if m != nil { - return m.Group - } - return "" -} - -func (m *CreateStreamRequest) GetReplicationFactor() int32 { - if m != nil { - return m.ReplicationFactor - } - return 0 -} - -func (m *CreateStreamRequest) GetPartitions() int32 { - if m != nil { - return m.Partitions - } - return 0 -} - -// CreateStreamResponse is sent by server after creating a stream. -type CreateStreamResponse struct { -} - -func (m *CreateStreamResponse) Reset() { *m = CreateStreamResponse{} } -func (m *CreateStreamResponse) String() string { return proto1.CompactTextString(m) } -func (*CreateStreamResponse) ProtoMessage() {} -func (*CreateStreamResponse) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{1} } - -// SubscribeRequest is sent to subscribe to a stream partition. -type SubscribeRequest struct { - Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` - Partition int32 `protobuf:"varint,2,opt,name=partition,proto3" json:"partition,omitempty"` - StartPosition StartPosition `protobuf:"varint,3,opt,name=startPosition,proto3,enum=proto.StartPosition" json:"startPosition,omitempty"` - StartOffset int64 `protobuf:"varint,4,opt,name=startOffset,proto3" json:"startOffset,omitempty"` - StartTimestamp int64 `protobuf:"varint,5,opt,name=startTimestamp,proto3" json:"startTimestamp,omitempty"` -} - -func (m *SubscribeRequest) Reset() { *m = SubscribeRequest{} } -func (m *SubscribeRequest) String() string { return proto1.CompactTextString(m) } -func (*SubscribeRequest) ProtoMessage() {} -func (*SubscribeRequest) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{2} } - -func (m *SubscribeRequest) GetStream() string { - if m != nil { - return m.Stream - } - return "" -} - -func (m *SubscribeRequest) GetPartition() int32 { - if m != nil { - return m.Partition - } - return 0 -} - -func (m *SubscribeRequest) GetStartPosition() StartPosition { - if m != nil { - return m.StartPosition - } - return StartPosition_NEW_ONLY -} - -func (m *SubscribeRequest) GetStartOffset() int64 { - if m != nil { - return m.StartOffset - } - return 0 -} - -func (m *SubscribeRequest) GetStartTimestamp() int64 { - if m != nil { - return m.StartTimestamp - } - return 0 -} - -// FetchMetadataRequest is sent to retrieve the latest cluster metadata. -type FetchMetadataRequest struct { - Streams []string `protobuf:"bytes,1,rep,name=streams" json:"streams,omitempty"` -} - -func (m *FetchMetadataRequest) Reset() { *m = FetchMetadataRequest{} } -func (m *FetchMetadataRequest) String() string { return proto1.CompactTextString(m) } -func (*FetchMetadataRequest) ProtoMessage() {} -func (*FetchMetadataRequest) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{3} } - -func (m *FetchMetadataRequest) GetStreams() []string { - if m != nil { - return m.Streams - } - return nil -} - -// FetchMetadataResponse contains the cluster metadata requested. -type FetchMetadataResponse struct { - Brokers []*Broker `protobuf:"bytes,1,rep,name=brokers" json:"brokers,omitempty"` - Metadata []*StreamMetadata `protobuf:"bytes,2,rep,name=metadata" json:"metadata,omitempty"` -} - -func (m *FetchMetadataResponse) Reset() { *m = FetchMetadataResponse{} } -func (m *FetchMetadataResponse) String() string { return proto1.CompactTextString(m) } -func (*FetchMetadataResponse) ProtoMessage() {} -func (*FetchMetadataResponse) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{4} } - -func (m *FetchMetadataResponse) GetBrokers() []*Broker { - if m != nil { - return m.Brokers - } - return nil -} - -func (m *FetchMetadataResponse) GetMetadata() []*StreamMetadata { - if m != nil { - return m.Metadata - } - return nil -} - -// PublishRequest is sent to publish a new message. -type PublishRequest struct { - Message *Message `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"` -} - -func (m *PublishRequest) Reset() { *m = PublishRequest{} } -func (m *PublishRequest) String() string { return proto1.CompactTextString(m) } -func (*PublishRequest) ProtoMessage() {} -func (*PublishRequest) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{5} } - -func (m *PublishRequest) GetMessage() *Message { - if m != nil { - return m.Message - } - return nil -} - -// PublishResponse is sent by the server after publishing a message. -type PublishResponse struct { - Ack *Ack `protobuf:"bytes,1,opt,name=ack" json:"ack,omitempty"` -} - -func (m *PublishResponse) Reset() { *m = PublishResponse{} } -func (m *PublishResponse) String() string { return proto1.CompactTextString(m) } -func (*PublishResponse) ProtoMessage() {} -func (*PublishResponse) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{6} } - -func (m *PublishResponse) GetAck() *Ack { - if m != nil { - return m.Ack - } - return nil -} - -// Broker contains information for a Liftbridge broker. -type Broker struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Host string `protobuf:"bytes,2,opt,name=host,proto3" json:"host,omitempty"` - Port int32 `protobuf:"varint,3,opt,name=port,proto3" json:"port,omitempty"` -} - -func (m *Broker) Reset() { *m = Broker{} } -func (m *Broker) String() string { return proto1.CompactTextString(m) } -func (*Broker) ProtoMessage() {} -func (*Broker) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{7} } - -func (m *Broker) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *Broker) GetHost() string { - if m != nil { - return m.Host - } - return "" -} - -func (m *Broker) GetPort() int32 { - if m != nil { - return m.Port - } - return 0 -} - -// StreamMetadata contains information for a stream. -type StreamMetadata struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"` - Error StreamMetadata_Error `protobuf:"varint,3,opt,name=error,proto3,enum=proto.StreamMetadata_Error" json:"error,omitempty"` - Partitions map[int32]*PartitionMetadata `protobuf:"bytes,4,rep,name=partitions" json:"partitions,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"` -} - -func (m *StreamMetadata) Reset() { *m = StreamMetadata{} } -func (m *StreamMetadata) String() string { return proto1.CompactTextString(m) } -func (*StreamMetadata) ProtoMessage() {} -func (*StreamMetadata) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{8} } - -func (m *StreamMetadata) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *StreamMetadata) GetSubject() string { - if m != nil { - return m.Subject - } - return "" -} - -func (m *StreamMetadata) GetError() StreamMetadata_Error { - if m != nil { - return m.Error - } - return StreamMetadata_OK -} - -func (m *StreamMetadata) GetPartitions() map[int32]*PartitionMetadata { - if m != nil { - return m.Partitions - } - return nil -} - -// PartitionMetadata contains information for a stream partition. -type PartitionMetadata struct { - Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Leader string `protobuf:"bytes,2,opt,name=leader,proto3" json:"leader,omitempty"` - Replicas []string `protobuf:"bytes,3,rep,name=replicas" json:"replicas,omitempty"` - Isr []string `protobuf:"bytes,4,rep,name=isr" json:"isr,omitempty"` -} - -func (m *PartitionMetadata) Reset() { *m = PartitionMetadata{} } -func (m *PartitionMetadata) String() string { return proto1.CompactTextString(m) } -func (*PartitionMetadata) ProtoMessage() {} -func (*PartitionMetadata) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{9} } - -func (m *PartitionMetadata) GetId() int32 { - if m != nil { - return m.Id - } - return 0 -} - -func (m *PartitionMetadata) GetLeader() string { - if m != nil { - return m.Leader - } - return "" -} - -func (m *PartitionMetadata) GetReplicas() []string { - if m != nil { - return m.Replicas - } - return nil -} - -func (m *PartitionMetadata) GetIsr() []string { - if m != nil { - return m.Isr - } - return nil -} - -// Message represents a message from a stream. -type Message struct { - Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,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"` - Subject string `protobuf:"bytes,5,opt,name=subject,proto3" json:"subject,omitempty"` - Reply string `protobuf:"bytes,6,opt,name=reply,proto3" json:"reply,omitempty"` - Headers map[string][]byte `protobuf:"bytes,7,rep,name=headers" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - AckInbox string `protobuf:"bytes,8,opt,name=ackInbox,proto3" json:"ackInbox,omitempty"` - CorrelationId string `protobuf:"bytes,9,opt,name=correlationId,proto3" json:"correlationId,omitempty"` - AckPolicy AckPolicy `protobuf:"varint,10,opt,name=ackPolicy,proto3,enum=proto.AckPolicy" json:"ackPolicy,omitempty"` -} - -func (m *Message) Reset() { *m = Message{} } -func (m *Message) String() string { return proto1.CompactTextString(m) } -func (*Message) ProtoMessage() {} -func (*Message) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{10} } - -func (m *Message) GetOffset() int64 { - if m != nil { - return m.Offset - } - return 0 -} - -func (m *Message) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *Message) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -func (m *Message) GetTimestamp() int64 { - if m != nil { - return m.Timestamp - } - return 0 -} - -func (m *Message) GetSubject() string { - if m != nil { - return m.Subject - } - return "" -} - -func (m *Message) GetReply() string { - if m != nil { - return m.Reply - } - return "" -} - -func (m *Message) GetHeaders() map[string][]byte { - if m != nil { - return m.Headers - } - return nil -} - -func (m *Message) GetAckInbox() string { - if m != nil { - return m.AckInbox - } - return "" -} - -func (m *Message) GetCorrelationId() string { - if m != nil { - return m.CorrelationId - } - return "" -} - -func (m *Message) GetAckPolicy() AckPolicy { - if m != nil { - return m.AckPolicy - } - return AckPolicy_LEADER -} - -// Ack represents an acknowledgement that a message was committed to a stream -// partition. -type Ack struct { - Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` - PartitionSubject string `protobuf:"bytes,2,opt,name=partitionSubject,proto3" json:"partitionSubject,omitempty"` - MsgSubject string `protobuf:"bytes,3,opt,name=msgSubject,proto3" json:"msgSubject,omitempty"` - Offset int64 `protobuf:"varint,4,opt,name=offset,proto3" json:"offset,omitempty"` - AckInbox string `protobuf:"bytes,5,opt,name=ackInbox,proto3" json:"ackInbox,omitempty"` - CorrelationId string `protobuf:"bytes,6,opt,name=correlationId,proto3" json:"correlationId,omitempty"` - AckPolicy AckPolicy `protobuf:"varint,7,opt,name=ackPolicy,proto3,enum=proto.AckPolicy" json:"ackPolicy,omitempty"` -} - -func (m *Ack) Reset() { *m = Ack{} } -func (m *Ack) String() string { return proto1.CompactTextString(m) } -func (*Ack) ProtoMessage() {} -func (*Ack) Descriptor() ([]byte, []int) { return fileDescriptorApi, []int{11} } - -func (m *Ack) GetStream() string { - if m != nil { - return m.Stream - } - return "" -} - -func (m *Ack) GetPartitionSubject() string { - if m != nil { - return m.PartitionSubject - } - return "" -} - -func (m *Ack) GetMsgSubject() string { - if m != nil { - return m.MsgSubject - } - return "" -} - -func (m *Ack) GetOffset() int64 { - if m != nil { - return m.Offset - } - return 0 -} - -func (m *Ack) GetAckInbox() string { - if m != nil { - return m.AckInbox - } - return "" -} - -func (m *Ack) GetCorrelationId() string { - if m != nil { - return m.CorrelationId - } - return "" -} - -func (m *Ack) GetAckPolicy() AckPolicy { - if m != nil { - return m.AckPolicy - } - return AckPolicy_LEADER -} - -func init() { - proto1.RegisterType((*CreateStreamRequest)(nil), "proto.CreateStreamRequest") - proto1.RegisterType((*CreateStreamResponse)(nil), "proto.CreateStreamResponse") - proto1.RegisterType((*SubscribeRequest)(nil), "proto.SubscribeRequest") - proto1.RegisterType((*FetchMetadataRequest)(nil), "proto.FetchMetadataRequest") - proto1.RegisterType((*FetchMetadataResponse)(nil), "proto.FetchMetadataResponse") - proto1.RegisterType((*PublishRequest)(nil), "proto.PublishRequest") - proto1.RegisterType((*PublishResponse)(nil), "proto.PublishResponse") - proto1.RegisterType((*Broker)(nil), "proto.Broker") - proto1.RegisterType((*StreamMetadata)(nil), "proto.StreamMetadata") - proto1.RegisterType((*PartitionMetadata)(nil), "proto.PartitionMetadata") - proto1.RegisterType((*Message)(nil), "proto.Message") - proto1.RegisterType((*Ack)(nil), "proto.Ack") - proto1.RegisterEnum("proto.StartPosition", StartPosition_name, StartPosition_value) - proto1.RegisterEnum("proto.AckPolicy", AckPolicy_name, AckPolicy_value) - proto1.RegisterEnum("proto.StreamMetadata_Error", StreamMetadata_Error_name, StreamMetadata_Error_value) -} - -// 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 - -// Client API for API service - -type APIClient interface { - // CreateStream creates a new stream attached to a NATS subject. It returns - // an AlreadyExists status code if a stream with the given subject and name - // already exists. - CreateStream(ctx context.Context, in *CreateStreamRequest, opts ...grpc.CallOption) (*CreateStreamResponse, error) - // Subscribe creates an ephemeral subscription for the given stream. It - // begins to receive messages starting at the given offset and waits for - // new messages when it reaches the end of the stream. Use the request - // context to close the subscription. - Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (API_SubscribeClient, error) - // FetchMetadata retrieves the latest cluster metadata, including stream - // broker information. - FetchMetadata(ctx context.Context, in *FetchMetadataRequest, opts ...grpc.CallOption) (*FetchMetadataResponse, error) - // Publish a new message to a subject. If the AckPolicy is not NONE and a - // deadline is provided, this will synchronously block until the ack is - // received. If the ack is not received in time, a DeadlineExceeded status - // code is returned. - Publish(ctx context.Context, in *PublishRequest, opts ...grpc.CallOption) (*PublishResponse, error) -} - -type aPIClient struct { - cc *grpc.ClientConn -} - -func NewAPIClient(cc *grpc.ClientConn) APIClient { - return &aPIClient{cc} -} - -func (c *aPIClient) CreateStream(ctx context.Context, in *CreateStreamRequest, opts ...grpc.CallOption) (*CreateStreamResponse, error) { - out := new(CreateStreamResponse) - err := grpc.Invoke(ctx, "/proto.API/CreateStream", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *aPIClient) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (API_SubscribeClient, error) { - stream, err := grpc.NewClientStream(ctx, &_API_serviceDesc.Streams[0], c.cc, "/proto.API/Subscribe", opts...) - if err != nil { - return nil, err - } - x := &aPISubscribeClient{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 API_SubscribeClient interface { - Recv() (*Message, error) - grpc.ClientStream -} - -type aPISubscribeClient struct { - grpc.ClientStream -} - -func (x *aPISubscribeClient) Recv() (*Message, error) { - m := new(Message) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *aPIClient) FetchMetadata(ctx context.Context, in *FetchMetadataRequest, opts ...grpc.CallOption) (*FetchMetadataResponse, error) { - out := new(FetchMetadataResponse) - err := grpc.Invoke(ctx, "/proto.API/FetchMetadata", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *aPIClient) Publish(ctx context.Context, in *PublishRequest, opts ...grpc.CallOption) (*PublishResponse, error) { - out := new(PublishResponse) - err := grpc.Invoke(ctx, "/proto.API/Publish", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Server API for API service - -type APIServer interface { - // CreateStream creates a new stream attached to a NATS subject. It returns - // an AlreadyExists status code if a stream with the given subject and name - // already exists. - CreateStream(context.Context, *CreateStreamRequest) (*CreateStreamResponse, error) - // Subscribe creates an ephemeral subscription for the given stream. It - // begins to receive messages starting at the given offset and waits for - // new messages when it reaches the end of the stream. Use the request - // context to close the subscription. - Subscribe(*SubscribeRequest, API_SubscribeServer) error - // FetchMetadata retrieves the latest cluster metadata, including stream - // broker information. - FetchMetadata(context.Context, *FetchMetadataRequest) (*FetchMetadataResponse, error) - // Publish a new message to a subject. If the AckPolicy is not NONE and a - // deadline is provided, this will synchronously block until the ack is - // received. If the ack is not received in time, a DeadlineExceeded status - // code is returned. - Publish(context.Context, *PublishRequest) (*PublishResponse, error) -} - -func RegisterAPIServer(s *grpc.Server, srv APIServer) { - s.RegisterService(&_API_serviceDesc, srv) -} - -func _API_CreateStream_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateStreamRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(APIServer).CreateStream(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.API/CreateStream", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(APIServer).CreateStream(ctx, req.(*CreateStreamRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _API_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(SubscribeRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(APIServer).Subscribe(m, &aPISubscribeServer{stream}) -} - -type API_SubscribeServer interface { - Send(*Message) error - grpc.ServerStream -} - -type aPISubscribeServer struct { - grpc.ServerStream -} - -func (x *aPISubscribeServer) Send(m *Message) error { - return x.ServerStream.SendMsg(m) -} - -func _API_FetchMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FetchMetadataRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(APIServer).FetchMetadata(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.API/FetchMetadata", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(APIServer).FetchMetadata(ctx, req.(*FetchMetadataRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _API_Publish_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PublishRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(APIServer).Publish(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.API/Publish", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(APIServer).Publish(ctx, req.(*PublishRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _API_serviceDesc = grpc.ServiceDesc{ - ServiceName: "proto.API", - HandlerType: (*APIServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateStream", - Handler: _API_CreateStream_Handler, - }, - { - MethodName: "FetchMetadata", - Handler: _API_FetchMetadata_Handler, - }, - { - MethodName: "Publish", - Handler: _API_Publish_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "Subscribe", - Handler: _API_Subscribe_Handler, - ServerStreams: true, - }, - }, - Metadata: "api.proto", -} - -func (m *CreateStreamRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CreateStreamRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Subject) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintApi(dAtA, i, uint64(len(m.Subject))) - i += copy(dAtA[i:], m.Subject) - } - if len(m.Name) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintApi(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) - } - if len(m.Group) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintApi(dAtA, i, uint64(len(m.Group))) - i += copy(dAtA[i:], m.Group) - } - if m.ReplicationFactor != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintApi(dAtA, i, uint64(m.ReplicationFactor)) - } - if m.Partitions != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintApi(dAtA, i, uint64(m.Partitions)) - } - return i, nil -} - -func (m *CreateStreamResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CreateStreamResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - return i, nil -} - -func (m *SubscribeRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SubscribeRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Stream) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintApi(dAtA, i, uint64(len(m.Stream))) - i += copy(dAtA[i:], m.Stream) - } - if m.Partition != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintApi(dAtA, i, uint64(m.Partition)) - } - if m.StartPosition != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintApi(dAtA, i, uint64(m.StartPosition)) - } - if m.StartOffset != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintApi(dAtA, i, uint64(m.StartOffset)) - } - if m.StartTimestamp != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintApi(dAtA, i, uint64(m.StartTimestamp)) - } - return i, nil -} - -func (m *FetchMetadataRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *FetchMetadataRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Streams) > 0 { - for _, s := range m.Streams { - dAtA[i] = 0xa - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) - } - } - return i, nil -} - -func (m *FetchMetadataResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *FetchMetadataResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Brokers) > 0 { - for _, msg := range m.Brokers { - dAtA[i] = 0xa - i++ - i = encodeVarintApi(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if len(m.Metadata) > 0 { - for _, msg := range m.Metadata { - dAtA[i] = 0x12 - i++ - i = encodeVarintApi(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - return i, nil -} - -func (m *PublishRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PublishRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Message != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintApi(dAtA, i, uint64(m.Message.Size())) - n1, err := m.Message.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - return i, nil -} - -func (m *PublishResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PublishResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Ack != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintApi(dAtA, i, uint64(m.Ack.Size())) - n2, err := m.Ack.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 - } - return i, nil -} - -func (m *Broker) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Broker) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Id) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintApi(dAtA, i, uint64(len(m.Id))) - i += copy(dAtA[i:], m.Id) - } - if len(m.Host) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintApi(dAtA, i, uint64(len(m.Host))) - i += copy(dAtA[i:], m.Host) - } - if m.Port != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintApi(dAtA, i, uint64(m.Port)) - } - return i, nil -} - -func (m *StreamMetadata) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StreamMetadata) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintApi(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) - } - if len(m.Subject) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintApi(dAtA, i, uint64(len(m.Subject))) - i += copy(dAtA[i:], m.Subject) - } - if m.Error != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintApi(dAtA, i, uint64(m.Error)) - } - if len(m.Partitions) > 0 { - for k, _ := range m.Partitions { - dAtA[i] = 0x22 - i++ - v := m.Partitions[k] - msgSize := 0 - if v != nil { - msgSize = v.Size() - msgSize += 1 + sovApi(uint64(msgSize)) - } - mapSize := 1 + sovApi(uint64(k)) + msgSize - i = encodeVarintApi(dAtA, i, uint64(mapSize)) - dAtA[i] = 0x8 - i++ - i = encodeVarintApi(dAtA, i, uint64(k)) - if v != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintApi(dAtA, i, uint64(v.Size())) - n3, err := v.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n3 - } - } - } - return i, nil -} - -func (m *PartitionMetadata) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PartitionMetadata) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Id != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintApi(dAtA, i, uint64(m.Id)) - } - if len(m.Leader) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintApi(dAtA, i, uint64(len(m.Leader))) - i += copy(dAtA[i:], m.Leader) - } - if len(m.Replicas) > 0 { - for _, s := range m.Replicas { - dAtA[i] = 0x1a - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) - } - } - if len(m.Isr) > 0 { - for _, s := range m.Isr { - dAtA[i] = 0x22 - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) - } - } - return i, nil -} - -func (m *Message) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Message) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Offset != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintApi(dAtA, i, uint64(m.Offset)) - } - if len(m.Key) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintApi(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - if len(m.Value) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintApi(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - } - if m.Timestamp != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintApi(dAtA, i, uint64(m.Timestamp)) - } - if len(m.Subject) > 0 { - dAtA[i] = 0x2a - i++ - i = encodeVarintApi(dAtA, i, uint64(len(m.Subject))) - i += copy(dAtA[i:], m.Subject) - } - if len(m.Reply) > 0 { - dAtA[i] = 0x32 - i++ - i = encodeVarintApi(dAtA, i, uint64(len(m.Reply))) - i += copy(dAtA[i:], m.Reply) - } - if len(m.Headers) > 0 { - for k, _ := range m.Headers { - dAtA[i] = 0x3a - i++ - v := m.Headers[k] - byteSize := 0 - if len(v) > 0 { - byteSize = 1 + len(v) + sovApi(uint64(len(v))) - } - mapSize := 1 + len(k) + sovApi(uint64(len(k))) + byteSize - i = encodeVarintApi(dAtA, i, uint64(mapSize)) - dAtA[i] = 0xa - i++ - i = encodeVarintApi(dAtA, i, uint64(len(k))) - i += copy(dAtA[i:], k) - if len(v) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintApi(dAtA, i, uint64(len(v))) - i += copy(dAtA[i:], v) - } - } - } - if len(m.AckInbox) > 0 { - dAtA[i] = 0x42 - i++ - i = encodeVarintApi(dAtA, i, uint64(len(m.AckInbox))) - i += copy(dAtA[i:], m.AckInbox) - } - if len(m.CorrelationId) > 0 { - dAtA[i] = 0x4a - i++ - i = encodeVarintApi(dAtA, i, uint64(len(m.CorrelationId))) - i += copy(dAtA[i:], m.CorrelationId) - } - if m.AckPolicy != 0 { - dAtA[i] = 0x50 - i++ - i = encodeVarintApi(dAtA, i, uint64(m.AckPolicy)) - } - return i, nil -} - -func (m *Ack) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Ack) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Stream) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintApi(dAtA, i, uint64(len(m.Stream))) - i += copy(dAtA[i:], m.Stream) - } - if len(m.PartitionSubject) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintApi(dAtA, i, uint64(len(m.PartitionSubject))) - i += copy(dAtA[i:], m.PartitionSubject) - } - if len(m.MsgSubject) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintApi(dAtA, i, uint64(len(m.MsgSubject))) - i += copy(dAtA[i:], m.MsgSubject) - } - if m.Offset != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintApi(dAtA, i, uint64(m.Offset)) - } - if len(m.AckInbox) > 0 { - dAtA[i] = 0x2a - i++ - i = encodeVarintApi(dAtA, i, uint64(len(m.AckInbox))) - i += copy(dAtA[i:], m.AckInbox) - } - if len(m.CorrelationId) > 0 { - dAtA[i] = 0x32 - i++ - i = encodeVarintApi(dAtA, i, uint64(len(m.CorrelationId))) - i += copy(dAtA[i:], m.CorrelationId) - } - if m.AckPolicy != 0 { - dAtA[i] = 0x38 - i++ - i = encodeVarintApi(dAtA, i, uint64(m.AckPolicy)) - } - return i, nil -} - -func encodeVarintApi(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *CreateStreamRequest) Size() (n int) { - var l int - _ = l - l = len(m.Subject) - if l > 0 { - n += 1 + l + sovApi(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovApi(uint64(l)) - } - l = len(m.Group) - if l > 0 { - n += 1 + l + sovApi(uint64(l)) - } - if m.ReplicationFactor != 0 { - n += 1 + sovApi(uint64(m.ReplicationFactor)) - } - if m.Partitions != 0 { - n += 1 + sovApi(uint64(m.Partitions)) - } - return n -} - -func (m *CreateStreamResponse) Size() (n int) { - var l int - _ = l - return n -} - -func (m *SubscribeRequest) Size() (n int) { - var l int - _ = l - l = len(m.Stream) - if l > 0 { - n += 1 + l + sovApi(uint64(l)) - } - if m.Partition != 0 { - n += 1 + sovApi(uint64(m.Partition)) - } - if m.StartPosition != 0 { - n += 1 + sovApi(uint64(m.StartPosition)) - } - if m.StartOffset != 0 { - n += 1 + sovApi(uint64(m.StartOffset)) - } - if m.StartTimestamp != 0 { - n += 1 + sovApi(uint64(m.StartTimestamp)) - } - return n -} - -func (m *FetchMetadataRequest) Size() (n int) { - var l int - _ = l - if len(m.Streams) > 0 { - for _, s := range m.Streams { - l = len(s) - n += 1 + l + sovApi(uint64(l)) - } - } - return n -} - -func (m *FetchMetadataResponse) Size() (n int) { - var l int - _ = l - if len(m.Brokers) > 0 { - for _, e := range m.Brokers { - l = e.Size() - n += 1 + l + sovApi(uint64(l)) - } - } - if len(m.Metadata) > 0 { - for _, e := range m.Metadata { - l = e.Size() - n += 1 + l + sovApi(uint64(l)) - } - } - return n -} - -func (m *PublishRequest) Size() (n int) { - var l int - _ = l - if m.Message != nil { - l = m.Message.Size() - n += 1 + l + sovApi(uint64(l)) - } - return n -} - -func (m *PublishResponse) Size() (n int) { - var l int - _ = l - if m.Ack != nil { - l = m.Ack.Size() - n += 1 + l + sovApi(uint64(l)) - } - return n -} - -func (m *Broker) Size() (n int) { - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovApi(uint64(l)) - } - l = len(m.Host) - if l > 0 { - n += 1 + l + sovApi(uint64(l)) - } - if m.Port != 0 { - n += 1 + sovApi(uint64(m.Port)) - } - return n -} - -func (m *StreamMetadata) Size() (n int) { - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovApi(uint64(l)) - } - l = len(m.Subject) - if l > 0 { - n += 1 + l + sovApi(uint64(l)) - } - if m.Error != 0 { - n += 1 + sovApi(uint64(m.Error)) - } - if len(m.Partitions) > 0 { - for k, v := range m.Partitions { - _ = k - _ = v - l = 0 - if v != nil { - l = v.Size() - l += 1 + sovApi(uint64(l)) - } - mapEntrySize := 1 + sovApi(uint64(k)) + l - n += mapEntrySize + 1 + sovApi(uint64(mapEntrySize)) - } - } - return n -} - -func (m *PartitionMetadata) Size() (n int) { - var l int - _ = l - if m.Id != 0 { - n += 1 + sovApi(uint64(m.Id)) - } - l = len(m.Leader) - if l > 0 { - n += 1 + l + sovApi(uint64(l)) - } - if len(m.Replicas) > 0 { - for _, s := range m.Replicas { - l = len(s) - n += 1 + l + sovApi(uint64(l)) - } - } - if len(m.Isr) > 0 { - for _, s := range m.Isr { - l = len(s) - n += 1 + l + sovApi(uint64(l)) - } - } - return n -} - -func (m *Message) Size() (n int) { - var l int - _ = l - if m.Offset != 0 { - n += 1 + sovApi(uint64(m.Offset)) - } - l = len(m.Key) - if l > 0 { - n += 1 + l + sovApi(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovApi(uint64(l)) - } - if m.Timestamp != 0 { - n += 1 + sovApi(uint64(m.Timestamp)) - } - l = len(m.Subject) - if l > 0 { - n += 1 + l + sovApi(uint64(l)) - } - l = len(m.Reply) - if l > 0 { - n += 1 + l + sovApi(uint64(l)) - } - if len(m.Headers) > 0 { - for k, v := range m.Headers { - _ = k - _ = v - l = 0 - if len(v) > 0 { - l = 1 + len(v) + sovApi(uint64(len(v))) - } - mapEntrySize := 1 + len(k) + sovApi(uint64(len(k))) + l - n += mapEntrySize + 1 + sovApi(uint64(mapEntrySize)) - } - } - l = len(m.AckInbox) - if l > 0 { - n += 1 + l + sovApi(uint64(l)) - } - l = len(m.CorrelationId) - if l > 0 { - n += 1 + l + sovApi(uint64(l)) - } - if m.AckPolicy != 0 { - n += 1 + sovApi(uint64(m.AckPolicy)) - } - return n -} - -func (m *Ack) Size() (n int) { - var l int - _ = l - l = len(m.Stream) - if l > 0 { - n += 1 + l + sovApi(uint64(l)) - } - l = len(m.PartitionSubject) - if l > 0 { - n += 1 + l + sovApi(uint64(l)) - } - l = len(m.MsgSubject) - if l > 0 { - n += 1 + l + sovApi(uint64(l)) - } - if m.Offset != 0 { - n += 1 + sovApi(uint64(m.Offset)) - } - l = len(m.AckInbox) - if l > 0 { - n += 1 + l + sovApi(uint64(l)) - } - l = len(m.CorrelationId) - if l > 0 { - n += 1 + l + sovApi(uint64(l)) - } - if m.AckPolicy != 0 { - n += 1 + sovApi(uint64(m.AckPolicy)) - } - return n -} - -func sovApi(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozApi(x uint64) (n int) { - return sovApi(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *CreateStreamRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CreateStreamRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CreateStreamRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Subject = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Group", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Group = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ReplicationFactor", wireType) - } - m.ReplicationFactor = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ReplicationFactor |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Partitions", wireType) - } - m.Partitions = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Partitions |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipApi(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CreateStreamResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CreateStreamResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CreateStreamResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipApi(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SubscribeRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SubscribeRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SubscribeRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Stream", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Stream = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Partition", wireType) - } - m.Partition = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Partition |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartPosition", wireType) - } - m.StartPosition = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartPosition |= (StartPosition(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartOffset", wireType) - } - m.StartOffset = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartOffset |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartTimestamp", wireType) - } - m.StartTimestamp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartTimestamp |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipApi(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *FetchMetadataRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FetchMetadataRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FetchMetadataRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Streams", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Streams = append(m.Streams, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipApi(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *FetchMetadataResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FetchMetadataResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FetchMetadataResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Brokers", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Brokers = append(m.Brokers, &Broker{}) - if err := m.Brokers[len(m.Brokers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Metadata = append(m.Metadata, &StreamMetadata{}) - if err := m.Metadata[len(m.Metadata)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipApi(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PublishRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PublishRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PublishRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Message == nil { - m.Message = &Message{} - } - if err := m.Message.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipApi(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PublishResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PublishResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PublishResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ack", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Ack == nil { - m.Ack = &Ack{} - } - if err := m.Ack.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipApi(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Broker) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Broker: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Broker: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Host", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Host = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Port", wireType) - } - m.Port = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Port |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipApi(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *StreamMetadata) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StreamMetadata: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StreamMetadata: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Subject = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - m.Error = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Error |= (StreamMetadata_Error(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Partitions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Partitions == nil { - m.Partitions = make(map[int32]*PartitionMetadata) - } - var mapkey int32 - var mapvalue *PartitionMetadata - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapkey |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - } else if fieldNum == 2 { - var mapmsglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapmsglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return ErrInvalidLengthApi - } - postmsgIndex := iNdEx + mapmsglen - if mapmsglen < 0 { - return ErrInvalidLengthApi - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = &PartitionMetadata{} - if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipApi(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Partitions[mapkey] = mapvalue - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipApi(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PartitionMetadata) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PartitionMetadata: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PartitionMetadata: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - m.Id = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Id |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Leader", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Leader = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Replicas", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Replicas = append(m.Replicas, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Isr", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Isr = append(m.Isr, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipApi(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Message) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Message: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Message: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Offset", wireType) - } - m.Offset = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Offset |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) - } - m.Timestamp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Timestamp |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Subject = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reply", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Reply = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Headers", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Headers == nil { - m.Headers = make(map[string][]byte) - } - var mapkey string - mapvalue := []byte{} - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthApi - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapbyteLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapbyteLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intMapbyteLen := int(mapbyteLen) - if intMapbyteLen < 0 { - return ErrInvalidLengthApi - } - postbytesIndex := iNdEx + intMapbyteLen - if postbytesIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = make([]byte, mapbyteLen) - copy(mapvalue, dAtA[iNdEx:postbytesIndex]) - iNdEx = postbytesIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipApi(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Headers[mapkey] = mapvalue - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AckInbox", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AckInbox = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CorrelationId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CorrelationId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AckPolicy", wireType) - } - m.AckPolicy = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.AckPolicy |= (AckPolicy(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipApi(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Ack) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Ack: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Ack: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Stream", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Stream = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PartitionSubject", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PartitionSubject = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgSubject", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MsgSubject = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Offset", wireType) - } - m.Offset = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Offset |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AckInbox", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AckInbox = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CorrelationId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthApi - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CorrelationId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AckPolicy", wireType) - } - m.AckPolicy = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowApi - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.AckPolicy |= (AckPolicy(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipApi(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipApi(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowApi - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowApi - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowApi - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthApi - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowApi - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipApi(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthApi = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowApi = fmt.Errorf("proto: integer overflow") -) - -func init() { proto1.RegisterFile("api.proto", fileDescriptorApi) } - -var fileDescriptorApi = []byte{ - // 983 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xdd, 0x6e, 0xe3, 0x44, - 0x14, 0x8e, 0xed, 0x38, 0xa9, 0x4f, 0x9b, 0xac, 0x77, 0xc8, 0x16, 0x2b, 0x5b, 0x55, 0x95, 0xf9, - 0xab, 0x2a, 0x14, 0x76, 0x83, 0x90, 0x56, 0xb9, 0x22, 0x0b, 0xae, 0x88, 0x36, 0x7f, 0x9a, 0x04, - 0x55, 0x5c, 0xad, 0x1c, 0x67, 0xb6, 0x35, 0xf9, 0x71, 0x98, 0x99, 0x20, 0xfa, 0x1e, 0x5c, 0xf0, - 0x06, 0xbc, 0x01, 0xcf, 0xc0, 0x15, 0xe2, 0x11, 0x50, 0x79, 0x04, 0x6e, 0xb9, 0x40, 0xf3, 0x63, - 0xd7, 0x4e, 0x83, 0x7a, 0xe5, 0x39, 0xdf, 0x39, 0x67, 0x7c, 0x7e, 0xbe, 0x33, 0x07, 0x9c, 0x70, - 0x13, 0xb7, 0x36, 0x34, 0xe1, 0x09, 0xb2, 0xe5, 0xc7, 0xff, 0xd5, 0x80, 0xf7, 0xbe, 0xa2, 0x24, - 0xe4, 0x64, 0xc2, 0x29, 0x09, 0x57, 0x98, 0xfc, 0xb0, 0x25, 0x8c, 0x23, 0x0f, 0xaa, 0x6c, 0x3b, - 0xfb, 0x9e, 0x44, 0xdc, 0x33, 0xce, 0x8c, 0x73, 0x07, 0xa7, 0x22, 0x42, 0x50, 0x5e, 0x87, 0x2b, - 0xe2, 0x99, 0x12, 0x96, 0x67, 0xd4, 0x00, 0xfb, 0x9a, 0x26, 0xdb, 0x8d, 0x67, 0x49, 0x50, 0x09, - 0xe8, 0x53, 0x78, 0x4a, 0xc9, 0x66, 0x19, 0x47, 0x21, 0x8f, 0x93, 0xf5, 0x65, 0x18, 0xf1, 0x84, - 0x7a, 0xe5, 0x33, 0xe3, 0xdc, 0xc6, 0x0f, 0x15, 0xe8, 0x14, 0x60, 0x13, 0x52, 0x1e, 0x0b, 0x88, - 0x79, 0xb6, 0x34, 0xcb, 0x21, 0xfe, 0x31, 0x34, 0x8a, 0x81, 0xb2, 0x4d, 0xb2, 0x66, 0xc4, 0xff, - 0xc3, 0x00, 0x77, 0xb2, 0x9d, 0xb1, 0x88, 0xc6, 0x33, 0x92, 0x86, 0x7f, 0x0c, 0x15, 0x26, 0xcd, - 0x74, 0xf4, 0x5a, 0x42, 0x27, 0xe0, 0x64, 0x57, 0xca, 0x0c, 0x6c, 0x7c, 0x0f, 0xa0, 0x0e, 0xd4, - 0x18, 0x0f, 0x29, 0x1f, 0x27, 0x4c, 0x59, 0x88, 0x74, 0xea, 0xed, 0x86, 0x2a, 0x59, 0x6b, 0x92, - 0xd7, 0xe1, 0xa2, 0x29, 0x3a, 0x83, 0x43, 0x09, 0x8c, 0xde, 0xbd, 0x63, 0x84, 0xcb, 0x34, 0x2d, - 0x9c, 0x87, 0xd0, 0xc7, 0x50, 0x97, 0xe2, 0x34, 0x5e, 0x11, 0xc6, 0xc3, 0xd5, 0x46, 0x26, 0x69, - 0xe1, 0x1d, 0xd4, 0x7f, 0x01, 0x8d, 0x4b, 0xc2, 0xa3, 0x9b, 0x01, 0xe1, 0xe1, 0x3c, 0xe4, 0x61, - 0xbe, 0x25, 0x32, 0x0b, 0xe6, 0x19, 0x67, 0x96, 0x6c, 0x89, 0x12, 0x7d, 0x06, 0xcf, 0x76, 0x3c, - 0x54, 0x6d, 0xd0, 0x27, 0x50, 0x9d, 0xd1, 0x64, 0x41, 0xa8, 0x72, 0x39, 0x6c, 0xd7, 0x74, 0x2a, - 0xaf, 0x25, 0x8a, 0x53, 0x2d, 0x7a, 0x09, 0x07, 0x2b, 0xed, 0xec, 0x99, 0xd2, 0xf2, 0x59, 0x96, - 0xb4, 0xf8, 0x47, 0x76, 0x73, 0x66, 0xe6, 0x77, 0xa0, 0x3e, 0xde, 0xce, 0x96, 0x31, 0xbb, 0x49, - 0x03, 0x3c, 0x87, 0xea, 0x8a, 0x30, 0x16, 0x5e, 0x13, 0x59, 0xf5, 0xc3, 0x76, 0x5d, 0xdf, 0x31, - 0x50, 0x28, 0x4e, 0xd5, 0xfe, 0x67, 0xf0, 0x24, 0xf3, 0xd5, 0xa1, 0x9e, 0x80, 0x15, 0x46, 0x0b, - 0xed, 0x08, 0xda, 0xb1, 0x1b, 0x2d, 0xb0, 0x80, 0xfd, 0x2f, 0xa1, 0xa2, 0x42, 0x46, 0x75, 0x30, - 0xe3, 0xb9, 0xee, 0xaa, 0x19, 0xcf, 0x05, 0x1d, 0x6f, 0x12, 0xc6, 0x53, 0x3a, 0x8a, 0xb3, 0xc0, - 0x36, 0x09, 0xe5, 0xb2, 0x7d, 0x36, 0x96, 0x67, 0xff, 0x37, 0x13, 0xea, 0xc5, 0x5c, 0x32, 0x26, - 0x1b, 0x39, 0x26, 0xe7, 0x78, 0x6f, 0x16, 0x79, 0xff, 0x12, 0x6c, 0x42, 0x69, 0x42, 0x35, 0x29, - 0x9e, 0xef, 0xad, 0x4f, 0x2b, 0x10, 0x26, 0x58, 0x59, 0xa2, 0xa0, 0x40, 0xe9, 0xb2, 0xac, 0xeb, - 0x47, 0xfb, 0xfd, 0xc6, 0x99, 0x5d, 0xb0, 0xe6, 0xf4, 0x36, 0xcf, 0xfc, 0xe6, 0x15, 0x3c, 0xd9, - 0x51, 0x23, 0x17, 0xac, 0x05, 0xb9, 0x95, 0x91, 0xdb, 0x58, 0x1c, 0x51, 0x0b, 0xec, 0x1f, 0xc3, - 0xe5, 0x56, 0xcd, 0xe5, 0x61, 0xdb, 0xd3, 0xbf, 0xc9, 0x1c, 0xb3, 0x0e, 0x2a, 0xb3, 0x8e, 0xf9, - 0xca, 0xf0, 0x3f, 0x00, 0x5b, 0xc6, 0x8b, 0x2a, 0x60, 0x8e, 0xde, 0xb8, 0x25, 0x84, 0xa0, 0xfe, - 0xed, 0xf0, 0xcd, 0x70, 0x74, 0x35, 0x7c, 0x3b, 0x99, 0xe2, 0xa0, 0x3b, 0x70, 0x0d, 0x3f, 0x86, - 0xa7, 0x0f, 0x2e, 0xc9, 0x75, 0xc1, 0x96, 0x5d, 0x38, 0x86, 0xca, 0x92, 0x84, 0x73, 0x42, 0x75, - 0xd5, 0xb4, 0x84, 0x9a, 0x70, 0xa0, 0x27, 0x9d, 0x79, 0x96, 0x24, 0x6d, 0x26, 0x8b, 0x1c, 0x62, - 0x46, 0x65, 0x59, 0x1c, 0x2c, 0x8e, 0xfe, 0xbf, 0x26, 0x54, 0x35, 0x57, 0xc4, 0x8d, 0x89, 0x1a, - 0x25, 0x43, 0x4e, 0x89, 0x96, 0xd2, 0xcc, 0xc5, 0x6f, 0x8e, 0x54, 0xe6, 0x8d, 0x34, 0x73, 0x4b, - 0x62, 0x4a, 0x10, 0x93, 0xce, 0xb3, 0x41, 0x53, 0xd3, 0x78, 0x0f, 0xe4, 0xdb, 0x6c, 0x17, 0xdb, - 0xdc, 0x00, 0x5b, 0x44, 0x78, 0xeb, 0x55, 0xd4, 0x53, 0x26, 0x05, 0xf4, 0x05, 0x54, 0x6f, 0x64, - 0x46, 0xcc, 0xab, 0xca, 0x36, 0x3e, 0x2f, 0x52, 0xbb, 0xf5, 0x8d, 0xd2, 0xaa, 0xe6, 0xa5, 0xb6, - 0x22, 0xfd, 0x30, 0x5a, 0xf4, 0xd6, 0xb3, 0xe4, 0x27, 0xef, 0x40, 0xde, 0x97, 0xc9, 0xe8, 0x43, - 0xa8, 0x45, 0x09, 0xa5, 0x64, 0x29, 0x1f, 0xc1, 0xde, 0xdc, 0x73, 0xa4, 0x41, 0x11, 0x44, 0x2d, - 0x70, 0xc2, 0x68, 0x31, 0x4e, 0x96, 0x71, 0x74, 0xeb, 0x81, 0x64, 0x9e, 0x7b, 0x3f, 0x1c, 0x0a, - 0xc7, 0xf7, 0x26, 0xcd, 0x0e, 0x1c, 0xe5, 0x43, 0xc9, 0x13, 0xc5, 0xd9, 0x29, 0x97, 0x99, 0x2b, - 0x97, 0xa4, 0xc3, 0x3f, 0x06, 0x58, 0xdd, 0x68, 0xf1, 0xbf, 0x8f, 0xe7, 0x05, 0xb8, 0x19, 0x2b, - 0x27, 0x85, 0x21, 0x79, 0x80, 0x8b, 0xd7, 0x7c, 0xc5, 0xae, 0x53, 0x2b, 0xb5, 0x16, 0x72, 0x48, - 0xae, 0xbd, 0xe5, 0x42, 0x7b, 0xf3, 0x15, 0xb3, 0x1f, 0xab, 0x58, 0xe5, 0xd1, 0x8a, 0x55, 0x1f, - 0xad, 0xd8, 0x05, 0x86, 0x5a, 0xe1, 0x61, 0x47, 0x47, 0x70, 0x30, 0x0c, 0xae, 0xde, 0x8e, 0x86, - 0xfd, 0xef, 0xdc, 0x12, 0x02, 0xa8, 0x8c, 0x2e, 0x2f, 0x27, 0xc1, 0xd4, 0x35, 0x84, 0x26, 0xe8, - 0xe2, 0x7e, 0x2f, 0x98, 0x4c, 0x5d, 0x53, 0x68, 0xfa, 0xdd, 0xa9, 0x38, 0x5b, 0xa8, 0x06, 0xce, - 0xb4, 0x37, 0x08, 0x26, 0xd3, 0xee, 0x60, 0xec, 0x96, 0x2f, 0x2e, 0xc0, 0xc9, 0xfe, 0x25, 0xed, - 0x82, 0xee, 0xd7, 0x01, 0x76, 0x4b, 0xa8, 0x0a, 0x56, 0xb7, 0xdf, 0x77, 0x0d, 0x74, 0x00, 0xe5, - 0xe1, 0x68, 0x18, 0xb8, 0x66, 0xfb, 0x67, 0x13, 0xac, 0xee, 0xb8, 0x87, 0x7a, 0x70, 0x94, 0xdf, - 0x6f, 0xa8, 0xa9, 0x83, 0xde, 0xb3, 0x9d, 0x9b, 0xcf, 0xf7, 0xea, 0xf4, 0x42, 0x2c, 0xa1, 0x57, - 0xe0, 0x64, 0x1b, 0x11, 0xbd, 0x9f, 0x3e, 0x38, 0x3b, 0x3b, 0xb2, 0xb9, 0xf3, 0x3a, 0xfb, 0xa5, - 0x17, 0x06, 0xea, 0x43, 0xad, 0xb0, 0x49, 0x50, 0xfa, 0xa7, 0x7d, 0x1b, 0xa9, 0x79, 0xb2, 0x5f, - 0x99, 0xc5, 0xd1, 0x81, 0xaa, 0x7e, 0xe6, 0x51, 0xba, 0x4e, 0x8a, 0x2b, 0xa3, 0x79, 0xbc, 0x0b, - 0xa7, 0xbe, 0xaf, 0xdd, 0xdf, 0xef, 0x4e, 0x8d, 0x3f, 0xef, 0x4e, 0x8d, 0xbf, 0xee, 0x4e, 0x8d, - 0x5f, 0xfe, 0x3e, 0x2d, 0xcd, 0x2a, 0xd2, 0xf4, 0xf3, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xe6, - 0xa1, 0xd3, 0x5f, 0xc5, 0x08, 0x00, 0x00, -} diff --git a/go/api_generated.go b/go/api_generated.go new file mode 100644 index 0000000..abb24e0 --- /dev/null +++ b/go/api_generated.go @@ -0,0 +1,1865 @@ +// Code generated by the FlatBuffers compiler. DO NOT EDIT. + +package proto + +import ( + "strconv" + + flatbuffers "github.com/google/flatbuffers/go" +) + +type StartPosition byte + +const ( + StartPosition_NEW_ONLY StartPosition = 0 + StartPosition_OFFSET StartPosition = 1 + StartPosition_EARLIEST StartPosition = 2 + StartPosition_LATEST StartPosition = 3 + StartPosition_TIMESTAMP StartPosition = 4 +) + +var EnumNamesStartPosition = map[StartPosition]string{ + StartPosition_NEW_ONLY: "NEW_ONLY", + StartPosition_OFFSET: "OFFSET", + StartPosition_EARLIEST: "EARLIEST", + StartPosition_LATEST: "LATEST", + StartPosition_TIMESTAMP: "TIMESTAMP", +} + +var EnumValuesStartPosition = map[string]StartPosition{ + "NEW_ONLY": StartPosition_NEW_ONLY, + "OFFSET": StartPosition_OFFSET, + "EARLIEST": StartPosition_EARLIEST, + "LATEST": StartPosition_LATEST, + "TIMESTAMP": StartPosition_TIMESTAMP, +} + +func (v StartPosition) String() string { + if s, ok := EnumNamesStartPosition[v]; ok { + return s + } + return "StartPosition(" + strconv.FormatInt(int64(v), 10) + ")" +} + +type StreamMetadataError byte + +const ( + StreamMetadataError_OK StreamMetadataError = 0 + StreamMetadataError_UNKNOWN_STREAM StreamMetadataError = 1 +) + +var EnumNamesStreamMetadataError = map[StreamMetadataError]string{ + StreamMetadataError_OK: "OK", + StreamMetadataError_UNKNOWN_STREAM: "UNKNOWN_STREAM", +} + +var EnumValuesStreamMetadataError = map[string]StreamMetadataError{ + "OK": StreamMetadataError_OK, + "UNKNOWN_STREAM": StreamMetadataError_UNKNOWN_STREAM, +} + +func (v StreamMetadataError) String() string { + if s, ok := EnumNamesStreamMetadataError[v]; ok { + return s + } + return "StreamMetadataError(" + strconv.FormatInt(int64(v), 10) + ")" +} + +type AckPolicy byte + +const ( + AckPolicy_LEADER AckPolicy = 0 + AckPolicy_ALL AckPolicy = 1 + AckPolicy_NONE AckPolicy = 2 +) + +var EnumNamesAckPolicy = map[AckPolicy]string{ + AckPolicy_LEADER: "LEADER", + AckPolicy_ALL: "ALL", + AckPolicy_NONE: "NONE", +} + +var EnumValuesAckPolicy = map[string]AckPolicy{ + "LEADER": AckPolicy_LEADER, + "ALL": AckPolicy_ALL, + "NONE": AckPolicy_NONE, +} + +func (v AckPolicy) String() string { + if s, ok := EnumNamesAckPolicy[v]; ok { + return s + } + return "AckPolicy(" + strconv.FormatInt(int64(v), 10) + ")" +} + +type CreateStreamRequest struct { + Subject string + Name string + Group string + ReplicationFactor int32 + Partitions int32 +} + +func CreateStreamRequestPack(builder *flatbuffers.Builder, t *CreateStreamRequest) flatbuffers.UOffsetT { + if t == nil { return 0 } + subjectOffset := builder.CreateString(t.Subject) + nameOffset := builder.CreateString(t.Name) + groupOffset := builder.CreateString(t.Group) + CreateStreamRequestStart(builder) + CreateStreamRequestAddSubject(builder, subjectOffset) + CreateStreamRequestAddName(builder, nameOffset) + CreateStreamRequestAddGroup(builder, groupOffset) + CreateStreamRequestAddReplicationFactor(builder, t.ReplicationFactor) + CreateStreamRequestAddPartitions(builder, t.Partitions) + return CreateStreamRequestEnd(builder) +} + +func (rcv *CreateStreamRequestReceiver) UnPackTo(t *CreateStreamRequest) { + t.Subject = string(rcv.Subject()) + t.Name = string(rcv.Name()) + t.Group = string(rcv.Group()) + t.ReplicationFactor = rcv.ReplicationFactor() + t.Partitions = rcv.Partitions() +} + +func (rcv *CreateStreamRequestReceiver) UnPack() *CreateStreamRequest { + if rcv == nil { return nil } + t := &CreateStreamRequest{} + rcv.UnPackTo(t) + return t +} + +func (t *CreateStreamRequest) Marshal() ([]byte, error) { + b := flatbuffers.NewBuilder(0) + b.Finish(CreateStreamRequestPack(b, t)) + return b.FinishedBytes(), nil +} + +func (t *CreateStreamRequest) Unmarshal(data []byte) error { + GetRootAsCreateStreamRequestReceiver(data, 0).UnPackTo(t) + return nil +} + +type CreateStreamRequestReceiver struct { + _tab flatbuffers.Table +} + +func GetRootAsCreateStreamRequestReceiver(buf []byte, offset flatbuffers.UOffsetT) *CreateStreamRequestReceiver { + n := flatbuffers.GetUOffsetT(buf[offset:]) + x := &CreateStreamRequestReceiver{} + x.Init(buf, n+offset) + return x +} + +func (rcv *CreateStreamRequestReceiver) Init(buf []byte, i flatbuffers.UOffsetT) { + rcv._tab.Bytes = buf + rcv._tab.Pos = i +} + +func (rcv *CreateStreamRequestReceiver) Table() flatbuffers.Table { + return rcv._tab +} + +func (rcv *CreateStreamRequestReceiver) Subject() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *CreateStreamRequestReceiver) Name() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *CreateStreamRequestReceiver) Group() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(8)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *CreateStreamRequestReceiver) ReplicationFactor() int32 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(10)) + if o != 0 { + return rcv._tab.GetInt32(o + rcv._tab.Pos) + } + return 0 +} + +func (rcv *CreateStreamRequestReceiver) MutateReplicationFactor(n int32) bool { + return rcv._tab.MutateInt32Slot(10, n) +} + +func (rcv *CreateStreamRequestReceiver) Partitions() int32 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(12)) + if o != 0 { + return rcv._tab.GetInt32(o + rcv._tab.Pos) + } + return 0 +} + +func (rcv *CreateStreamRequestReceiver) MutatePartitions(n int32) bool { + return rcv._tab.MutateInt32Slot(12, n) +} + +func CreateStreamRequestStart(builder *flatbuffers.Builder) { + builder.StartObject(5) +} +func CreateStreamRequestAddSubject(builder *flatbuffers.Builder, subject flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(subject), 0) +} +func CreateStreamRequestAddName(builder *flatbuffers.Builder, name flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(name), 0) +} +func CreateStreamRequestAddGroup(builder *flatbuffers.Builder, group flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(2, flatbuffers.UOffsetT(group), 0) +} +func CreateStreamRequestAddReplicationFactor(builder *flatbuffers.Builder, replicationFactor int32) { + builder.PrependInt32Slot(3, replicationFactor, 0) +} +func CreateStreamRequestAddPartitions(builder *flatbuffers.Builder, partitions int32) { + builder.PrependInt32Slot(4, partitions, 0) +} +func CreateStreamRequestEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { + return builder.EndObject() +} +type CreateStreamResponse struct { +} + +func CreateStreamResponsePack(builder *flatbuffers.Builder, t *CreateStreamResponse) flatbuffers.UOffsetT { + if t == nil { return 0 } + CreateStreamResponseStart(builder) + return CreateStreamResponseEnd(builder) +} + +func (rcv *CreateStreamResponseReceiver) UnPackTo(t *CreateStreamResponse) { +} + +func (rcv *CreateStreamResponseReceiver) UnPack() *CreateStreamResponse { + if rcv == nil { return nil } + t := &CreateStreamResponse{} + rcv.UnPackTo(t) + return t +} + +func (t *CreateStreamResponse) Marshal() ([]byte, error) { + b := flatbuffers.NewBuilder(0) + b.Finish(CreateStreamResponsePack(b, t)) + return b.FinishedBytes(), nil +} + +func (t *CreateStreamResponse) Unmarshal(data []byte) error { + GetRootAsCreateStreamResponseReceiver(data, 0).UnPackTo(t) + return nil +} + +type CreateStreamResponseReceiver struct { + _tab flatbuffers.Table +} + +func GetRootAsCreateStreamResponseReceiver(buf []byte, offset flatbuffers.UOffsetT) *CreateStreamResponseReceiver { + n := flatbuffers.GetUOffsetT(buf[offset:]) + x := &CreateStreamResponseReceiver{} + x.Init(buf, n+offset) + return x +} + +func (rcv *CreateStreamResponseReceiver) Init(buf []byte, i flatbuffers.UOffsetT) { + rcv._tab.Bytes = buf + rcv._tab.Pos = i +} + +func (rcv *CreateStreamResponseReceiver) Table() flatbuffers.Table { + return rcv._tab +} + +func CreateStreamResponseStart(builder *flatbuffers.Builder) { + builder.StartObject(0) +} +func CreateStreamResponseEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { + return builder.EndObject() +} +type SubscribeRequest struct { + Stream string + Partition int32 + StartPosition StartPosition + StartOffset int64 + StartTimestamp int64 +} + +func SubscribeRequestPack(builder *flatbuffers.Builder, t *SubscribeRequest) flatbuffers.UOffsetT { + if t == nil { return 0 } + streamOffset := builder.CreateString(t.Stream) + SubscribeRequestStart(builder) + SubscribeRequestAddStream(builder, streamOffset) + SubscribeRequestAddPartition(builder, t.Partition) + SubscribeRequestAddStartPosition(builder, t.StartPosition) + SubscribeRequestAddStartOffset(builder, t.StartOffset) + SubscribeRequestAddStartTimestamp(builder, t.StartTimestamp) + return SubscribeRequestEnd(builder) +} + +func (rcv *SubscribeRequestReceiver) UnPackTo(t *SubscribeRequest) { + t.Stream = string(rcv.Stream()) + t.Partition = rcv.Partition() + t.StartPosition = rcv.StartPosition() + t.StartOffset = rcv.StartOffset() + t.StartTimestamp = rcv.StartTimestamp() +} + +func (rcv *SubscribeRequestReceiver) UnPack() *SubscribeRequest { + if rcv == nil { return nil } + t := &SubscribeRequest{} + rcv.UnPackTo(t) + return t +} + +func (t *SubscribeRequest) Marshal() ([]byte, error) { + b := flatbuffers.NewBuilder(0) + b.Finish(SubscribeRequestPack(b, t)) + return b.FinishedBytes(), nil +} + +func (t *SubscribeRequest) Unmarshal(data []byte) error { + GetRootAsSubscribeRequestReceiver(data, 0).UnPackTo(t) + return nil +} + +type SubscribeRequestReceiver struct { + _tab flatbuffers.Table +} + +func GetRootAsSubscribeRequestReceiver(buf []byte, offset flatbuffers.UOffsetT) *SubscribeRequestReceiver { + n := flatbuffers.GetUOffsetT(buf[offset:]) + x := &SubscribeRequestReceiver{} + x.Init(buf, n+offset) + return x +} + +func (rcv *SubscribeRequestReceiver) Init(buf []byte, i flatbuffers.UOffsetT) { + rcv._tab.Bytes = buf + rcv._tab.Pos = i +} + +func (rcv *SubscribeRequestReceiver) Table() flatbuffers.Table { + return rcv._tab +} + +func (rcv *SubscribeRequestReceiver) Stream() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *SubscribeRequestReceiver) Partition() int32 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) + if o != 0 { + return rcv._tab.GetInt32(o + rcv._tab.Pos) + } + return 0 +} + +func (rcv *SubscribeRequestReceiver) MutatePartition(n int32) bool { + return rcv._tab.MutateInt32Slot(6, n) +} + +func (rcv *SubscribeRequestReceiver) StartPosition() StartPosition { + o := flatbuffers.UOffsetT(rcv._tab.Offset(8)) + if o != 0 { + return StartPosition(rcv._tab.GetByte(o + rcv._tab.Pos)) + } + return 0 +} + +func (rcv *SubscribeRequestReceiver) MutateStartPosition(n StartPosition) bool { + return rcv._tab.MutateByteSlot(8, byte(n)) +} + +func (rcv *SubscribeRequestReceiver) StartOffset() int64 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(10)) + if o != 0 { + return rcv._tab.GetInt64(o + rcv._tab.Pos) + } + return 0 +} + +func (rcv *SubscribeRequestReceiver) MutateStartOffset(n int64) bool { + return rcv._tab.MutateInt64Slot(10, n) +} + +func (rcv *SubscribeRequestReceiver) StartTimestamp() int64 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(12)) + if o != 0 { + return rcv._tab.GetInt64(o + rcv._tab.Pos) + } + return 0 +} + +func (rcv *SubscribeRequestReceiver) MutateStartTimestamp(n int64) bool { + return rcv._tab.MutateInt64Slot(12, n) +} + +func SubscribeRequestStart(builder *flatbuffers.Builder) { + builder.StartObject(5) +} +func SubscribeRequestAddStream(builder *flatbuffers.Builder, stream flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(stream), 0) +} +func SubscribeRequestAddPartition(builder *flatbuffers.Builder, partition int32) { + builder.PrependInt32Slot(1, partition, 0) +} +func SubscribeRequestAddStartPosition(builder *flatbuffers.Builder, startPosition StartPosition) { + builder.PrependByteSlot(2, byte(startPosition), 0) +} +func SubscribeRequestAddStartOffset(builder *flatbuffers.Builder, startOffset int64) { + builder.PrependInt64Slot(3, startOffset, 0) +} +func SubscribeRequestAddStartTimestamp(builder *flatbuffers.Builder, startTimestamp int64) { + builder.PrependInt64Slot(4, startTimestamp, 0) +} +func SubscribeRequestEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { + return builder.EndObject() +} +type FetchMetadataRequest struct { + Streams []string +} + +func FetchMetadataRequestPack(builder *flatbuffers.Builder, t *FetchMetadataRequest) flatbuffers.UOffsetT { + if t == nil { return 0 } + streamsOffset := flatbuffers.UOffsetT(0) + if t.Streams != nil { + streamsLength := len(t.Streams) + streamsOffsets := make([]flatbuffers.UOffsetT, streamsLength) + for j := 0; j < streamsLength; j++ { + streamsOffsets[j] = builder.CreateString(t.Streams[j]) + } + FetchMetadataRequestStartStreamsVector(builder, streamsLength) + for j := streamsLength - 1; j >= 0; j-- { + builder.PrependUOffsetT(streamsOffsets[j]) + } + streamsOffset = builder.EndVector(streamsLength) + } + FetchMetadataRequestStart(builder) + FetchMetadataRequestAddStreams(builder, streamsOffset) + return FetchMetadataRequestEnd(builder) +} + +func (rcv *FetchMetadataRequestReceiver) UnPackTo(t *FetchMetadataRequest) { + streamsLength := rcv.StreamsLength() + t.Streams = make([]string, streamsLength) + for j := 0; j < streamsLength; j++ { + t.Streams[j] = string(rcv.Streams(j)) + } +} + +func (rcv *FetchMetadataRequestReceiver) UnPack() *FetchMetadataRequest { + if rcv == nil { return nil } + t := &FetchMetadataRequest{} + rcv.UnPackTo(t) + return t +} + +func (t *FetchMetadataRequest) Marshal() ([]byte, error) { + b := flatbuffers.NewBuilder(0) + b.Finish(FetchMetadataRequestPack(b, t)) + return b.FinishedBytes(), nil +} + +func (t *FetchMetadataRequest) Unmarshal(data []byte) error { + GetRootAsFetchMetadataRequestReceiver(data, 0).UnPackTo(t) + return nil +} + +type FetchMetadataRequestReceiver struct { + _tab flatbuffers.Table +} + +func GetRootAsFetchMetadataRequestReceiver(buf []byte, offset flatbuffers.UOffsetT) *FetchMetadataRequestReceiver { + n := flatbuffers.GetUOffsetT(buf[offset:]) + x := &FetchMetadataRequestReceiver{} + x.Init(buf, n+offset) + return x +} + +func (rcv *FetchMetadataRequestReceiver) Init(buf []byte, i flatbuffers.UOffsetT) { + rcv._tab.Bytes = buf + rcv._tab.Pos = i +} + +func (rcv *FetchMetadataRequestReceiver) Table() flatbuffers.Table { + return rcv._tab +} + +func (rcv *FetchMetadataRequestReceiver) Streams(j int) []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) + if o != 0 { + a := rcv._tab.Vector(o) + return rcv._tab.ByteVector(a + flatbuffers.UOffsetT(j*4)) + } + return nil +} + +func (rcv *FetchMetadataRequestReceiver) StreamsLength() int { + o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) + if o != 0 { + return rcv._tab.VectorLen(o) + } + return 0 +} + +func FetchMetadataRequestStart(builder *flatbuffers.Builder) { + builder.StartObject(1) +} +func FetchMetadataRequestAddStreams(builder *flatbuffers.Builder, streams flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(streams), 0) +} +func FetchMetadataRequestStartStreamsVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT { + return builder.StartVector(4, numElems, 4) +} +func FetchMetadataRequestEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { + return builder.EndObject() +} +type FetchMetadataResponse struct { + Brokers []*Broker + Metadata []*StreamMetadata +} + +func FetchMetadataResponsePack(builder *flatbuffers.Builder, t *FetchMetadataResponse) flatbuffers.UOffsetT { + if t == nil { return 0 } + brokersOffset := flatbuffers.UOffsetT(0) + if t.Brokers != nil { + brokersLength := len(t.Brokers) + brokersOffsets := make([]flatbuffers.UOffsetT, brokersLength) + for j := 0; j < brokersLength; j++ { + brokersOffsets[j] = BrokerPack(builder, t.Brokers[j]) + } + FetchMetadataResponseStartBrokersVector(builder, brokersLength) + for j := brokersLength - 1; j >= 0; j-- { + builder.PrependUOffsetT(brokersOffsets[j]) + } + brokersOffset = builder.EndVector(brokersLength) + } + metadataOffset := flatbuffers.UOffsetT(0) + if t.Metadata != nil { + metadataLength := len(t.Metadata) + metadataOffsets := make([]flatbuffers.UOffsetT, metadataLength) + for j := 0; j < metadataLength; j++ { + metadataOffsets[j] = StreamMetadataPack(builder, t.Metadata[j]) + } + FetchMetadataResponseStartMetadataVector(builder, metadataLength) + for j := metadataLength - 1; j >= 0; j-- { + builder.PrependUOffsetT(metadataOffsets[j]) + } + metadataOffset = builder.EndVector(metadataLength) + } + FetchMetadataResponseStart(builder) + FetchMetadataResponseAddBrokers(builder, brokersOffset) + FetchMetadataResponseAddMetadata(builder, metadataOffset) + return FetchMetadataResponseEnd(builder) +} + +func (rcv *FetchMetadataResponseReceiver) UnPackTo(t *FetchMetadataResponse) { + brokersLength := rcv.BrokersLength() + t.Brokers = make([]*Broker, brokersLength) + for j := 0; j < brokersLength; j++ { + x := BrokerReceiver{} + if rcv.Brokers(&x, j) { + t.Brokers[j] = x.UnPack() + } + } + metadataLength := rcv.MetadataLength() + t.Metadata = make([]*StreamMetadata, metadataLength) + for j := 0; j < metadataLength; j++ { + x := StreamMetadataReceiver{} + if rcv.Metadata(&x, j) { + t.Metadata[j] = x.UnPack() + } + } +} + +func (rcv *FetchMetadataResponseReceiver) UnPack() *FetchMetadataResponse { + if rcv == nil { return nil } + t := &FetchMetadataResponse{} + rcv.UnPackTo(t) + return t +} + +func (t *FetchMetadataResponse) Marshal() ([]byte, error) { + b := flatbuffers.NewBuilder(0) + b.Finish(FetchMetadataResponsePack(b, t)) + return b.FinishedBytes(), nil +} + +func (t *FetchMetadataResponse) Unmarshal(data []byte) error { + GetRootAsFetchMetadataResponseReceiver(data, 0).UnPackTo(t) + return nil +} + +type FetchMetadataResponseReceiver struct { + _tab flatbuffers.Table +} + +func GetRootAsFetchMetadataResponseReceiver(buf []byte, offset flatbuffers.UOffsetT) *FetchMetadataResponseReceiver { + n := flatbuffers.GetUOffsetT(buf[offset:]) + x := &FetchMetadataResponseReceiver{} + x.Init(buf, n+offset) + return x +} + +func (rcv *FetchMetadataResponseReceiver) Init(buf []byte, i flatbuffers.UOffsetT) { + rcv._tab.Bytes = buf + rcv._tab.Pos = i +} + +func (rcv *FetchMetadataResponseReceiver) Table() flatbuffers.Table { + return rcv._tab +} + +func (rcv *FetchMetadataResponseReceiver) Brokers(obj *BrokerReceiver, j int) bool { + o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) + if o != 0 { + x := rcv._tab.Vector(o) + x += flatbuffers.UOffsetT(j) * 4 + x = rcv._tab.Indirect(x) + obj.Init(rcv._tab.Bytes, x) + return true + } + return false +} + +func (rcv *FetchMetadataResponseReceiver) BrokersLength() int { + o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) + if o != 0 { + return rcv._tab.VectorLen(o) + } + return 0 +} + +func (rcv *FetchMetadataResponseReceiver) Metadata(obj *StreamMetadataReceiver, j int) bool { + o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) + if o != 0 { + x := rcv._tab.Vector(o) + x += flatbuffers.UOffsetT(j) * 4 + x = rcv._tab.Indirect(x) + obj.Init(rcv._tab.Bytes, x) + return true + } + return false +} + +func (rcv *FetchMetadataResponseReceiver) MetadataLength() int { + o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) + if o != 0 { + return rcv._tab.VectorLen(o) + } + return 0 +} + +func FetchMetadataResponseStart(builder *flatbuffers.Builder) { + builder.StartObject(2) +} +func FetchMetadataResponseAddBrokers(builder *flatbuffers.Builder, brokers flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(brokers), 0) +} +func FetchMetadataResponseStartBrokersVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT { + return builder.StartVector(4, numElems, 4) +} +func FetchMetadataResponseAddMetadata(builder *flatbuffers.Builder, metadata flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(metadata), 0) +} +func FetchMetadataResponseStartMetadataVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT { + return builder.StartVector(4, numElems, 4) +} +func FetchMetadataResponseEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { + return builder.EndObject() +} +type PublishRequest struct { + Message *Message +} + +func PublishRequestPack(builder *flatbuffers.Builder, t *PublishRequest) flatbuffers.UOffsetT { + if t == nil { return 0 } + messageOffset := MessagePack(builder, t.Message) + PublishRequestStart(builder) + PublishRequestAddMessage(builder, messageOffset) + return PublishRequestEnd(builder) +} + +func (rcv *PublishRequestReceiver) UnPackTo(t *PublishRequest) { + t.Message = rcv.Message(nil).UnPack() +} + +func (rcv *PublishRequestReceiver) UnPack() *PublishRequest { + if rcv == nil { return nil } + t := &PublishRequest{} + rcv.UnPackTo(t) + return t +} + +func (t *PublishRequest) Marshal() ([]byte, error) { + b := flatbuffers.NewBuilder(0) + b.Finish(PublishRequestPack(b, t)) + return b.FinishedBytes(), nil +} + +func (t *PublishRequest) Unmarshal(data []byte) error { + GetRootAsPublishRequestReceiver(data, 0).UnPackTo(t) + return nil +} + +type PublishRequestReceiver struct { + _tab flatbuffers.Table +} + +func GetRootAsPublishRequestReceiver(buf []byte, offset flatbuffers.UOffsetT) *PublishRequestReceiver { + n := flatbuffers.GetUOffsetT(buf[offset:]) + x := &PublishRequestReceiver{} + x.Init(buf, n+offset) + return x +} + +func (rcv *PublishRequestReceiver) Init(buf []byte, i flatbuffers.UOffsetT) { + rcv._tab.Bytes = buf + rcv._tab.Pos = i +} + +func (rcv *PublishRequestReceiver) Table() flatbuffers.Table { + return rcv._tab +} + +func (rcv *PublishRequestReceiver) Message(obj *MessageReceiver) *MessageReceiver { + o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) + if o != 0 { + x := rcv._tab.Indirect(o + rcv._tab.Pos) + if obj == nil { + obj = new(MessageReceiver) + } + obj.Init(rcv._tab.Bytes, x) + return obj + } + return nil +} + +func PublishRequestStart(builder *flatbuffers.Builder) { + builder.StartObject(1) +} +func PublishRequestAddMessage(builder *flatbuffers.Builder, message flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(message), 0) +} +func PublishRequestEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { + return builder.EndObject() +} +type PublishResponse struct { + Ack *Ack +} + +func PublishResponsePack(builder *flatbuffers.Builder, t *PublishResponse) flatbuffers.UOffsetT { + if t == nil { return 0 } + ackOffset := AckPack(builder, t.Ack) + PublishResponseStart(builder) + PublishResponseAddAck(builder, ackOffset) + return PublishResponseEnd(builder) +} + +func (rcv *PublishResponseReceiver) UnPackTo(t *PublishResponse) { + t.Ack = rcv.Ack(nil).UnPack() +} + +func (rcv *PublishResponseReceiver) UnPack() *PublishResponse { + if rcv == nil { return nil } + t := &PublishResponse{} + rcv.UnPackTo(t) + return t +} + +func (t *PublishResponse) Marshal() ([]byte, error) { + b := flatbuffers.NewBuilder(0) + b.Finish(PublishResponsePack(b, t)) + return b.FinishedBytes(), nil +} + +func (t *PublishResponse) Unmarshal(data []byte) error { + GetRootAsPublishResponseReceiver(data, 0).UnPackTo(t) + return nil +} + +type PublishResponseReceiver struct { + _tab flatbuffers.Table +} + +func GetRootAsPublishResponseReceiver(buf []byte, offset flatbuffers.UOffsetT) *PublishResponseReceiver { + n := flatbuffers.GetUOffsetT(buf[offset:]) + x := &PublishResponseReceiver{} + x.Init(buf, n+offset) + return x +} + +func (rcv *PublishResponseReceiver) Init(buf []byte, i flatbuffers.UOffsetT) { + rcv._tab.Bytes = buf + rcv._tab.Pos = i +} + +func (rcv *PublishResponseReceiver) Table() flatbuffers.Table { + return rcv._tab +} + +func (rcv *PublishResponseReceiver) Ack(obj *AckReceiver) *AckReceiver { + o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) + if o != 0 { + x := rcv._tab.Indirect(o + rcv._tab.Pos) + if obj == nil { + obj = new(AckReceiver) + } + obj.Init(rcv._tab.Bytes, x) + return obj + } + return nil +} + +func PublishResponseStart(builder *flatbuffers.Builder) { + builder.StartObject(1) +} +func PublishResponseAddAck(builder *flatbuffers.Builder, ack flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(ack), 0) +} +func PublishResponseEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { + return builder.EndObject() +} +type Broker struct { + Id string + Host string + Port int32 +} + +func BrokerPack(builder *flatbuffers.Builder, t *Broker) flatbuffers.UOffsetT { + if t == nil { return 0 } + idOffset := builder.CreateString(t.Id) + hostOffset := builder.CreateString(t.Host) + BrokerStart(builder) + BrokerAddId(builder, idOffset) + BrokerAddHost(builder, hostOffset) + BrokerAddPort(builder, t.Port) + return BrokerEnd(builder) +} + +func (rcv *BrokerReceiver) UnPackTo(t *Broker) { + t.Id = string(rcv.Id()) + t.Host = string(rcv.Host()) + t.Port = rcv.Port() +} + +func (rcv *BrokerReceiver) UnPack() *Broker { + if rcv == nil { return nil } + t := &Broker{} + rcv.UnPackTo(t) + return t +} + +func (t *Broker) Marshal() ([]byte, error) { + b := flatbuffers.NewBuilder(0) + b.Finish(BrokerPack(b, t)) + return b.FinishedBytes(), nil +} + +func (t *Broker) Unmarshal(data []byte) error { + GetRootAsBrokerReceiver(data, 0).UnPackTo(t) + return nil +} + +type BrokerReceiver struct { + _tab flatbuffers.Table +} + +func GetRootAsBrokerReceiver(buf []byte, offset flatbuffers.UOffsetT) *BrokerReceiver { + n := flatbuffers.GetUOffsetT(buf[offset:]) + x := &BrokerReceiver{} + x.Init(buf, n+offset) + return x +} + +func (rcv *BrokerReceiver) Init(buf []byte, i flatbuffers.UOffsetT) { + rcv._tab.Bytes = buf + rcv._tab.Pos = i +} + +func (rcv *BrokerReceiver) Table() flatbuffers.Table { + return rcv._tab +} + +func (rcv *BrokerReceiver) Id() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *BrokerReceiver) Host() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *BrokerReceiver) Port() int32 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(8)) + if o != 0 { + return rcv._tab.GetInt32(o + rcv._tab.Pos) + } + return 0 +} + +func (rcv *BrokerReceiver) MutatePort(n int32) bool { + return rcv._tab.MutateInt32Slot(8, n) +} + +func BrokerStart(builder *flatbuffers.Builder) { + builder.StartObject(3) +} +func BrokerAddId(builder *flatbuffers.Builder, id flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(id), 0) +} +func BrokerAddHost(builder *flatbuffers.Builder, host flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(host), 0) +} +func BrokerAddPort(builder *flatbuffers.Builder, port int32) { + builder.PrependInt32Slot(2, port, 0) +} +func BrokerEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { + return builder.EndObject() +} +type StreamMetadata struct { + Name string + Subject string + Error StreamMetadataError + Partitions []*PartitionMetadata +} + +func StreamMetadataPack(builder *flatbuffers.Builder, t *StreamMetadata) flatbuffers.UOffsetT { + if t == nil { return 0 } + nameOffset := builder.CreateString(t.Name) + subjectOffset := builder.CreateString(t.Subject) + partitionsOffset := flatbuffers.UOffsetT(0) + if t.Partitions != nil { + partitionsLength := len(t.Partitions) + partitionsOffsets := make([]flatbuffers.UOffsetT, partitionsLength) + for j := 0; j < partitionsLength; j++ { + partitionsOffsets[j] = PartitionMetadataPack(builder, t.Partitions[j]) + } + StreamMetadataStartPartitionsVector(builder, partitionsLength) + for j := partitionsLength - 1; j >= 0; j-- { + builder.PrependUOffsetT(partitionsOffsets[j]) + } + partitionsOffset = builder.EndVector(partitionsLength) + } + StreamMetadataStart(builder) + StreamMetadataAddName(builder, nameOffset) + StreamMetadataAddSubject(builder, subjectOffset) + StreamMetadataAddError(builder, t.Error) + StreamMetadataAddPartitions(builder, partitionsOffset) + return StreamMetadataEnd(builder) +} + +func (rcv *StreamMetadataReceiver) UnPackTo(t *StreamMetadata) { + t.Name = string(rcv.Name()) + t.Subject = string(rcv.Subject()) + t.Error = rcv.Error() + partitionsLength := rcv.PartitionsLength() + t.Partitions = make([]*PartitionMetadata, partitionsLength) + for j := 0; j < partitionsLength; j++ { + x := PartitionMetadataReceiver{} + if rcv.Partitions(&x, j) { + t.Partitions[j] = x.UnPack() + } + } +} + +func (rcv *StreamMetadataReceiver) UnPack() *StreamMetadata { + if rcv == nil { return nil } + t := &StreamMetadata{} + rcv.UnPackTo(t) + return t +} + +func (t *StreamMetadata) Marshal() ([]byte, error) { + b := flatbuffers.NewBuilder(0) + b.Finish(StreamMetadataPack(b, t)) + return b.FinishedBytes(), nil +} + +func (t *StreamMetadata) Unmarshal(data []byte) error { + GetRootAsStreamMetadataReceiver(data, 0).UnPackTo(t) + return nil +} + +type StreamMetadataReceiver struct { + _tab flatbuffers.Table +} + +func GetRootAsStreamMetadataReceiver(buf []byte, offset flatbuffers.UOffsetT) *StreamMetadataReceiver { + n := flatbuffers.GetUOffsetT(buf[offset:]) + x := &StreamMetadataReceiver{} + x.Init(buf, n+offset) + return x +} + +func (rcv *StreamMetadataReceiver) Init(buf []byte, i flatbuffers.UOffsetT) { + rcv._tab.Bytes = buf + rcv._tab.Pos = i +} + +func (rcv *StreamMetadataReceiver) Table() flatbuffers.Table { + return rcv._tab +} + +func (rcv *StreamMetadataReceiver) Name() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *StreamMetadataReceiver) Subject() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *StreamMetadataReceiver) Error() StreamMetadataError { + o := flatbuffers.UOffsetT(rcv._tab.Offset(8)) + if o != 0 { + return StreamMetadataError(rcv._tab.GetByte(o + rcv._tab.Pos)) + } + return 0 +} + +func (rcv *StreamMetadataReceiver) MutateError(n StreamMetadataError) bool { + return rcv._tab.MutateByteSlot(8, byte(n)) +} + +func (rcv *StreamMetadataReceiver) Partitions(obj *PartitionMetadataReceiver, j int) bool { + o := flatbuffers.UOffsetT(rcv._tab.Offset(10)) + if o != 0 { + x := rcv._tab.Vector(o) + x += flatbuffers.UOffsetT(j) * 4 + x = rcv._tab.Indirect(x) + obj.Init(rcv._tab.Bytes, x) + return true + } + return false +} + +func (rcv *StreamMetadataReceiver) PartitionsLength() int { + o := flatbuffers.UOffsetT(rcv._tab.Offset(10)) + if o != 0 { + return rcv._tab.VectorLen(o) + } + return 0 +} + +func StreamMetadataStart(builder *flatbuffers.Builder) { + builder.StartObject(4) +} +func StreamMetadataAddName(builder *flatbuffers.Builder, name flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(name), 0) +} +func StreamMetadataAddSubject(builder *flatbuffers.Builder, subject flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(subject), 0) +} +func StreamMetadataAddError(builder *flatbuffers.Builder, error StreamMetadataError) { + builder.PrependByteSlot(2, byte(error), 0) +} +func StreamMetadataAddPartitions(builder *flatbuffers.Builder, partitions flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(3, flatbuffers.UOffsetT(partitions), 0) +} +func StreamMetadataStartPartitionsVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT { + return builder.StartVector(4, numElems, 4) +} +func StreamMetadataEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { + return builder.EndObject() +} +type PartitionMetadata struct { + Id int32 + Leader string + Replicas []string + Isr []string +} + +func PartitionMetadataPack(builder *flatbuffers.Builder, t *PartitionMetadata) flatbuffers.UOffsetT { + if t == nil { return 0 } + leaderOffset := builder.CreateString(t.Leader) + replicasOffset := flatbuffers.UOffsetT(0) + if t.Replicas != nil { + replicasLength := len(t.Replicas) + replicasOffsets := make([]flatbuffers.UOffsetT, replicasLength) + for j := 0; j < replicasLength; j++ { + replicasOffsets[j] = builder.CreateString(t.Replicas[j]) + } + PartitionMetadataStartReplicasVector(builder, replicasLength) + for j := replicasLength - 1; j >= 0; j-- { + builder.PrependUOffsetT(replicasOffsets[j]) + } + replicasOffset = builder.EndVector(replicasLength) + } + isrOffset := flatbuffers.UOffsetT(0) + if t.Isr != nil { + isrLength := len(t.Isr) + isrOffsets := make([]flatbuffers.UOffsetT, isrLength) + for j := 0; j < isrLength; j++ { + isrOffsets[j] = builder.CreateString(t.Isr[j]) + } + PartitionMetadataStartIsrVector(builder, isrLength) + for j := isrLength - 1; j >= 0; j-- { + builder.PrependUOffsetT(isrOffsets[j]) + } + isrOffset = builder.EndVector(isrLength) + } + PartitionMetadataStart(builder) + PartitionMetadataAddId(builder, t.Id) + PartitionMetadataAddLeader(builder, leaderOffset) + PartitionMetadataAddReplicas(builder, replicasOffset) + PartitionMetadataAddIsr(builder, isrOffset) + return PartitionMetadataEnd(builder) +} + +func (rcv *PartitionMetadataReceiver) UnPackTo(t *PartitionMetadata) { + t.Id = rcv.Id() + t.Leader = string(rcv.Leader()) + replicasLength := rcv.ReplicasLength() + t.Replicas = make([]string, replicasLength) + for j := 0; j < replicasLength; j++ { + t.Replicas[j] = string(rcv.Replicas(j)) + } + isrLength := rcv.IsrLength() + t.Isr = make([]string, isrLength) + for j := 0; j < isrLength; j++ { + t.Isr[j] = string(rcv.Isr(j)) + } +} + +func (rcv *PartitionMetadataReceiver) UnPack() *PartitionMetadata { + if rcv == nil { return nil } + t := &PartitionMetadata{} + rcv.UnPackTo(t) + return t +} + +func (t *PartitionMetadata) Marshal() ([]byte, error) { + b := flatbuffers.NewBuilder(0) + b.Finish(PartitionMetadataPack(b, t)) + return b.FinishedBytes(), nil +} + +func (t *PartitionMetadata) Unmarshal(data []byte) error { + GetRootAsPartitionMetadataReceiver(data, 0).UnPackTo(t) + return nil +} + +type PartitionMetadataReceiver struct { + _tab flatbuffers.Table +} + +func GetRootAsPartitionMetadataReceiver(buf []byte, offset flatbuffers.UOffsetT) *PartitionMetadataReceiver { + n := flatbuffers.GetUOffsetT(buf[offset:]) + x := &PartitionMetadataReceiver{} + x.Init(buf, n+offset) + return x +} + +func (rcv *PartitionMetadataReceiver) Init(buf []byte, i flatbuffers.UOffsetT) { + rcv._tab.Bytes = buf + rcv._tab.Pos = i +} + +func (rcv *PartitionMetadataReceiver) Table() flatbuffers.Table { + return rcv._tab +} + +func (rcv *PartitionMetadataReceiver) Id() int32 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) + if o != 0 { + return rcv._tab.GetInt32(o + rcv._tab.Pos) + } + return 0 +} + +func (rcv *PartitionMetadataReceiver) MutateId(n int32) bool { + return rcv._tab.MutateInt32Slot(4, n) +} + +func (rcv *PartitionMetadataReceiver) Leader() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *PartitionMetadataReceiver) Replicas(j int) []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(8)) + if o != 0 { + a := rcv._tab.Vector(o) + return rcv._tab.ByteVector(a + flatbuffers.UOffsetT(j*4)) + } + return nil +} + +func (rcv *PartitionMetadataReceiver) ReplicasLength() int { + o := flatbuffers.UOffsetT(rcv._tab.Offset(8)) + if o != 0 { + return rcv._tab.VectorLen(o) + } + return 0 +} + +func (rcv *PartitionMetadataReceiver) Isr(j int) []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(10)) + if o != 0 { + a := rcv._tab.Vector(o) + return rcv._tab.ByteVector(a + flatbuffers.UOffsetT(j*4)) + } + return nil +} + +func (rcv *PartitionMetadataReceiver) IsrLength() int { + o := flatbuffers.UOffsetT(rcv._tab.Offset(10)) + if o != 0 { + return rcv._tab.VectorLen(o) + } + return 0 +} + +func PartitionMetadataStart(builder *flatbuffers.Builder) { + builder.StartObject(4) +} +func PartitionMetadataAddId(builder *flatbuffers.Builder, id int32) { + builder.PrependInt32Slot(0, id, 0) +} +func PartitionMetadataAddLeader(builder *flatbuffers.Builder, leader flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(leader), 0) +} +func PartitionMetadataAddReplicas(builder *flatbuffers.Builder, replicas flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(2, flatbuffers.UOffsetT(replicas), 0) +} +func PartitionMetadataStartReplicasVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT { + return builder.StartVector(4, numElems, 4) +} +func PartitionMetadataAddIsr(builder *flatbuffers.Builder, isr flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(3, flatbuffers.UOffsetT(isr), 0) +} +func PartitionMetadataStartIsrVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT { + return builder.StartVector(4, numElems, 4) +} +func PartitionMetadataEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { + return builder.EndObject() +} +type MessageHeader struct { + Key string + Value []byte +} + +func MessageHeaderPack(builder *flatbuffers.Builder, t *MessageHeader) flatbuffers.UOffsetT { + if t == nil { return 0 } + keyOffset := builder.CreateString(t.Key) + valueOffset := flatbuffers.UOffsetT(0) + if t.Value != nil { + valueOffset = builder.CreateByteString(t.Value) + } + MessageHeaderStart(builder) + MessageHeaderAddKey(builder, keyOffset) + MessageHeaderAddValue(builder, valueOffset) + return MessageHeaderEnd(builder) +} + +func (rcv *MessageHeaderReceiver) UnPackTo(t *MessageHeader) { + t.Key = string(rcv.Key()) + t.Value = rcv.ValueBytes() +} + +func (rcv *MessageHeaderReceiver) UnPack() *MessageHeader { + if rcv == nil { return nil } + t := &MessageHeader{} + rcv.UnPackTo(t) + return t +} + +func (t *MessageHeader) Marshal() ([]byte, error) { + b := flatbuffers.NewBuilder(0) + b.Finish(MessageHeaderPack(b, t)) + return b.FinishedBytes(), nil +} + +func (t *MessageHeader) Unmarshal(data []byte) error { + GetRootAsMessageHeaderReceiver(data, 0).UnPackTo(t) + return nil +} + +type MessageHeaderReceiver struct { + _tab flatbuffers.Table +} + +func GetRootAsMessageHeaderReceiver(buf []byte, offset flatbuffers.UOffsetT) *MessageHeaderReceiver { + n := flatbuffers.GetUOffsetT(buf[offset:]) + x := &MessageHeaderReceiver{} + x.Init(buf, n+offset) + return x +} + +func (rcv *MessageHeaderReceiver) Init(buf []byte, i flatbuffers.UOffsetT) { + rcv._tab.Bytes = buf + rcv._tab.Pos = i +} + +func (rcv *MessageHeaderReceiver) Table() flatbuffers.Table { + return rcv._tab +} + +func (rcv *MessageHeaderReceiver) Key() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *MessageHeaderReceiver) Value(j int) byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) + if o != 0 { + a := rcv._tab.Vector(o) + return rcv._tab.GetByte(a + flatbuffers.UOffsetT(j*1)) + } + return 0 +} + +func (rcv *MessageHeaderReceiver) ValueLength() int { + o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) + if o != 0 { + return rcv._tab.VectorLen(o) + } + return 0 +} + +func (rcv *MessageHeaderReceiver) ValueBytes() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *MessageHeaderReceiver) MutateValue(j int, n byte) bool { + o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) + if o != 0 { + a := rcv._tab.Vector(o) + return rcv._tab.MutateByte(a+flatbuffers.UOffsetT(j*1), n) + } + return false +} + +func MessageHeaderStart(builder *flatbuffers.Builder) { + builder.StartObject(2) +} +func MessageHeaderAddKey(builder *flatbuffers.Builder, key flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(key), 0) +} +func MessageHeaderAddValue(builder *flatbuffers.Builder, value flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(value), 0) +} +func MessageHeaderStartValueVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT { + return builder.StartVector(1, numElems, 1) +} +func MessageHeaderEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { + return builder.EndObject() +} +type Message struct { + Offset int64 + Key []byte + Value []byte + Timestamp int64 + Subject string + Reply string + Headers []*MessageHeader + AckInbox string + CorrelationId string + AckPolicy AckPolicy +} + +func MessagePack(builder *flatbuffers.Builder, t *Message) flatbuffers.UOffsetT { + if t == nil { return 0 } + keyOffset := flatbuffers.UOffsetT(0) + if t.Key != nil { + keyOffset = builder.CreateByteString(t.Key) + } + valueOffset := flatbuffers.UOffsetT(0) + if t.Value != nil { + valueOffset = builder.CreateByteString(t.Value) + } + subjectOffset := builder.CreateString(t.Subject) + replyOffset := builder.CreateString(t.Reply) + headersOffset := flatbuffers.UOffsetT(0) + if t.Headers != nil { + headersLength := len(t.Headers) + headersOffsets := make([]flatbuffers.UOffsetT, headersLength) + for j := 0; j < headersLength; j++ { + headersOffsets[j] = MessageHeaderPack(builder, t.Headers[j]) + } + MessageStartHeadersVector(builder, headersLength) + for j := headersLength - 1; j >= 0; j-- { + builder.PrependUOffsetT(headersOffsets[j]) + } + headersOffset = builder.EndVector(headersLength) + } + ackInboxOffset := builder.CreateString(t.AckInbox) + correlationIdOffset := builder.CreateString(t.CorrelationId) + MessageStart(builder) + MessageAddOffset(builder, t.Offset) + MessageAddKey(builder, keyOffset) + MessageAddValue(builder, valueOffset) + MessageAddTimestamp(builder, t.Timestamp) + MessageAddSubject(builder, subjectOffset) + MessageAddReply(builder, replyOffset) + MessageAddHeaders(builder, headersOffset) + MessageAddAckInbox(builder, ackInboxOffset) + MessageAddCorrelationId(builder, correlationIdOffset) + MessageAddAckPolicy(builder, t.AckPolicy) + return MessageEnd(builder) +} + +func (rcv *MessageReceiver) UnPackTo(t *Message) { + t.Offset = rcv.Offset() + t.Key = rcv.KeyBytes() + t.Value = rcv.ValueBytes() + t.Timestamp = rcv.Timestamp() + t.Subject = string(rcv.Subject()) + t.Reply = string(rcv.Reply()) + headersLength := rcv.HeadersLength() + t.Headers = make([]*MessageHeader, headersLength) + for j := 0; j < headersLength; j++ { + x := MessageHeaderReceiver{} + if rcv.Headers(&x, j) { + t.Headers[j] = x.UnPack() + } + } + t.AckInbox = string(rcv.AckInbox()) + t.CorrelationId = string(rcv.CorrelationId()) + t.AckPolicy = rcv.AckPolicy() +} + +func (rcv *MessageReceiver) UnPack() *Message { + if rcv == nil { return nil } + t := &Message{} + rcv.UnPackTo(t) + return t +} + +func (t *Message) Marshal() ([]byte, error) { + b := flatbuffers.NewBuilder(0) + b.Finish(MessagePack(b, t)) + return b.FinishedBytes(), nil +} + +func (t *Message) Unmarshal(data []byte) error { + GetRootAsMessageReceiver(data, 0).UnPackTo(t) + return nil +} + +type MessageReceiver struct { + _tab flatbuffers.Table +} + +func GetRootAsMessageReceiver(buf []byte, offset flatbuffers.UOffsetT) *MessageReceiver { + n := flatbuffers.GetUOffsetT(buf[offset:]) + x := &MessageReceiver{} + x.Init(buf, n+offset) + return x +} + +func (rcv *MessageReceiver) Init(buf []byte, i flatbuffers.UOffsetT) { + rcv._tab.Bytes = buf + rcv._tab.Pos = i +} + +func (rcv *MessageReceiver) Table() flatbuffers.Table { + return rcv._tab +} + +func (rcv *MessageReceiver) Offset() int64 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) + if o != 0 { + return rcv._tab.GetInt64(o + rcv._tab.Pos) + } + return 0 +} + +func (rcv *MessageReceiver) MutateOffset(n int64) bool { + return rcv._tab.MutateInt64Slot(4, n) +} + +func (rcv *MessageReceiver) Key(j int) byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) + if o != 0 { + a := rcv._tab.Vector(o) + return rcv._tab.GetByte(a + flatbuffers.UOffsetT(j*1)) + } + return 0 +} + +func (rcv *MessageReceiver) KeyLength() int { + o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) + if o != 0 { + return rcv._tab.VectorLen(o) + } + return 0 +} + +func (rcv *MessageReceiver) KeyBytes() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *MessageReceiver) MutateKey(j int, n byte) bool { + o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) + if o != 0 { + a := rcv._tab.Vector(o) + return rcv._tab.MutateByte(a+flatbuffers.UOffsetT(j*1), n) + } + return false +} + +func (rcv *MessageReceiver) Value(j int) byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(8)) + if o != 0 { + a := rcv._tab.Vector(o) + return rcv._tab.GetByte(a + flatbuffers.UOffsetT(j*1)) + } + return 0 +} + +func (rcv *MessageReceiver) ValueLength() int { + o := flatbuffers.UOffsetT(rcv._tab.Offset(8)) + if o != 0 { + return rcv._tab.VectorLen(o) + } + return 0 +} + +func (rcv *MessageReceiver) ValueBytes() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(8)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *MessageReceiver) MutateValue(j int, n byte) bool { + o := flatbuffers.UOffsetT(rcv._tab.Offset(8)) + if o != 0 { + a := rcv._tab.Vector(o) + return rcv._tab.MutateByte(a+flatbuffers.UOffsetT(j*1), n) + } + return false +} + +func (rcv *MessageReceiver) Timestamp() int64 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(10)) + if o != 0 { + return rcv._tab.GetInt64(o + rcv._tab.Pos) + } + return 0 +} + +func (rcv *MessageReceiver) MutateTimestamp(n int64) bool { + return rcv._tab.MutateInt64Slot(10, n) +} + +func (rcv *MessageReceiver) Subject() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(12)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *MessageReceiver) Reply() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(14)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *MessageReceiver) Headers(obj *MessageHeaderReceiver, j int) bool { + o := flatbuffers.UOffsetT(rcv._tab.Offset(16)) + if o != 0 { + x := rcv._tab.Vector(o) + x += flatbuffers.UOffsetT(j) * 4 + x = rcv._tab.Indirect(x) + obj.Init(rcv._tab.Bytes, x) + return true + } + return false +} + +func (rcv *MessageReceiver) HeadersLength() int { + o := flatbuffers.UOffsetT(rcv._tab.Offset(16)) + if o != 0 { + return rcv._tab.VectorLen(o) + } + return 0 +} + +func (rcv *MessageReceiver) AckInbox() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(18)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *MessageReceiver) CorrelationId() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(20)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *MessageReceiver) AckPolicy() AckPolicy { + o := flatbuffers.UOffsetT(rcv._tab.Offset(22)) + if o != 0 { + return AckPolicy(rcv._tab.GetByte(o + rcv._tab.Pos)) + } + return 0 +} + +func (rcv *MessageReceiver) MutateAckPolicy(n AckPolicy) bool { + return rcv._tab.MutateByteSlot(22, byte(n)) +} + +func MessageStart(builder *flatbuffers.Builder) { + builder.StartObject(10) +} +func MessageAddOffset(builder *flatbuffers.Builder, offset int64) { + builder.PrependInt64Slot(0, offset, 0) +} +func MessageAddKey(builder *flatbuffers.Builder, key flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(key), 0) +} +func MessageStartKeyVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT { + return builder.StartVector(1, numElems, 1) +} +func MessageAddValue(builder *flatbuffers.Builder, value flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(2, flatbuffers.UOffsetT(value), 0) +} +func MessageStartValueVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT { + return builder.StartVector(1, numElems, 1) +} +func MessageAddTimestamp(builder *flatbuffers.Builder, timestamp int64) { + builder.PrependInt64Slot(3, timestamp, 0) +} +func MessageAddSubject(builder *flatbuffers.Builder, subject flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(4, flatbuffers.UOffsetT(subject), 0) +} +func MessageAddReply(builder *flatbuffers.Builder, reply flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(5, flatbuffers.UOffsetT(reply), 0) +} +func MessageAddHeaders(builder *flatbuffers.Builder, headers flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(6, flatbuffers.UOffsetT(headers), 0) +} +func MessageStartHeadersVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT { + return builder.StartVector(4, numElems, 4) +} +func MessageAddAckInbox(builder *flatbuffers.Builder, ackInbox flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(7, flatbuffers.UOffsetT(ackInbox), 0) +} +func MessageAddCorrelationId(builder *flatbuffers.Builder, correlationId flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(8, flatbuffers.UOffsetT(correlationId), 0) +} +func MessageAddAckPolicy(builder *flatbuffers.Builder, ackPolicy AckPolicy) { + builder.PrependByteSlot(9, byte(ackPolicy), 0) +} +func MessageEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { + return builder.EndObject() +} +type Ack struct { + Stream string + PartitionSubject string + MsgSubject string + Offset int64 + AckInbox string + CorrelationId string + AckPolicy AckPolicy +} + +func AckPack(builder *flatbuffers.Builder, t *Ack) flatbuffers.UOffsetT { + if t == nil { return 0 } + streamOffset := builder.CreateString(t.Stream) + partitionSubjectOffset := builder.CreateString(t.PartitionSubject) + msgSubjectOffset := builder.CreateString(t.MsgSubject) + ackInboxOffset := builder.CreateString(t.AckInbox) + correlationIdOffset := builder.CreateString(t.CorrelationId) + AckStart(builder) + AckAddStream(builder, streamOffset) + AckAddPartitionSubject(builder, partitionSubjectOffset) + AckAddMsgSubject(builder, msgSubjectOffset) + AckAddOffset(builder, t.Offset) + AckAddAckInbox(builder, ackInboxOffset) + AckAddCorrelationId(builder, correlationIdOffset) + AckAddAckPolicy(builder, t.AckPolicy) + return AckEnd(builder) +} + +func (rcv *AckReceiver) UnPackTo(t *Ack) { + t.Stream = string(rcv.Stream()) + t.PartitionSubject = string(rcv.PartitionSubject()) + t.MsgSubject = string(rcv.MsgSubject()) + t.Offset = rcv.Offset() + t.AckInbox = string(rcv.AckInbox()) + t.CorrelationId = string(rcv.CorrelationId()) + t.AckPolicy = rcv.AckPolicy() +} + +func (rcv *AckReceiver) UnPack() *Ack { + if rcv == nil { return nil } + t := &Ack{} + rcv.UnPackTo(t) + return t +} + +func (t *Ack) Marshal() ([]byte, error) { + b := flatbuffers.NewBuilder(0) + b.Finish(AckPack(b, t)) + return b.FinishedBytes(), nil +} + +func (t *Ack) Unmarshal(data []byte) error { + GetRootAsAckReceiver(data, 0).UnPackTo(t) + return nil +} + +type AckReceiver struct { + _tab flatbuffers.Table +} + +func GetRootAsAckReceiver(buf []byte, offset flatbuffers.UOffsetT) *AckReceiver { + n := flatbuffers.GetUOffsetT(buf[offset:]) + x := &AckReceiver{} + x.Init(buf, n+offset) + return x +} + +func (rcv *AckReceiver) Init(buf []byte, i flatbuffers.UOffsetT) { + rcv._tab.Bytes = buf + rcv._tab.Pos = i +} + +func (rcv *AckReceiver) Table() flatbuffers.Table { + return rcv._tab +} + +func (rcv *AckReceiver) Stream() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *AckReceiver) PartitionSubject() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *AckReceiver) MsgSubject() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(8)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *AckReceiver) Offset() int64 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(10)) + if o != 0 { + return rcv._tab.GetInt64(o + rcv._tab.Pos) + } + return 0 +} + +func (rcv *AckReceiver) MutateOffset(n int64) bool { + return rcv._tab.MutateInt64Slot(10, n) +} + +func (rcv *AckReceiver) AckInbox() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(12)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *AckReceiver) CorrelationId() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(14)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *AckReceiver) AckPolicy() AckPolicy { + o := flatbuffers.UOffsetT(rcv._tab.Offset(16)) + if o != 0 { + return AckPolicy(rcv._tab.GetByte(o + rcv._tab.Pos)) + } + return 0 +} + +func (rcv *AckReceiver) MutateAckPolicy(n AckPolicy) bool { + return rcv._tab.MutateByteSlot(16, byte(n)) +} + +func AckStart(builder *flatbuffers.Builder) { + builder.StartObject(7) +} +func AckAddStream(builder *flatbuffers.Builder, stream flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(stream), 0) +} +func AckAddPartitionSubject(builder *flatbuffers.Builder, partitionSubject flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(partitionSubject), 0) +} +func AckAddMsgSubject(builder *flatbuffers.Builder, msgSubject flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(2, flatbuffers.UOffsetT(msgSubject), 0) +} +func AckAddOffset(builder *flatbuffers.Builder, offset int64) { + builder.PrependInt64Slot(3, offset, 0) +} +func AckAddAckInbox(builder *flatbuffers.Builder, ackInbox flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(4, flatbuffers.UOffsetT(ackInbox), 0) +} +func AckAddCorrelationId(builder *flatbuffers.Builder, correlationId flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(5, flatbuffers.UOffsetT(correlationId), 0) +} +func AckAddAckPolicy(builder *flatbuffers.Builder, ackPolicy AckPolicy) { + builder.PrependByteSlot(6, byte(ackPolicy), 0) +} +func AckEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { + return builder.EndObject() +}